File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,6 +54,9 @@ class CompatSource extends Source {
5454 return this . _sourceLike . source ( ) ;
5555 }
5656
57+ /**
58+ * @returns {Buffer } buffer
59+ */
5760 buffer ( ) {
5861 if ( typeof this . _sourceLike . buffer === "function" ) {
5962 return this . _sourceLike . buffer ( ) ;
@@ -71,6 +74,9 @@ class CompatSource extends Source {
7174 return super . buffers ( ) ;
7275 }
7376
77+ /**
78+ * @returns {number } size
79+ */
7480 size ( ) {
7581 if ( typeof this . _sourceLike . size === "function" ) {
7682 return this . _sourceLike . size ( ) ;
Original file line number Diff line number Diff line change @@ -88,6 +88,9 @@ class ConcatSource extends Source {
8888 }
8989 }
9090
91+ /**
92+ * @returns {Buffer } buffer
93+ */
9194 buffer ( ) {
9295 return Buffer . concat ( this . buffers ( ) ) ;
9396 }
@@ -140,6 +143,9 @@ class ConcatSource extends Source {
140143 return source ;
141144 }
142145
146+ /**
147+ * @returns {number } size
148+ */
143149 size ( ) {
144150 if ( ! this . _isOptimized ) this . _optimize ( ) ;
145151 const children = /** @type {Source[] } */ ( this . _children ) ;
Original file line number Diff line number Diff line change @@ -71,6 +71,9 @@ class OriginalSource extends Source {
7171 return this . _value ;
7272 }
7373
74+ /**
75+ * @returns {Buffer } buffer
76+ */
7477 buffer ( ) {
7578 if ( this . _valueAsBuffer === undefined ) {
7679 const value = Buffer . from ( /** @type {string } */ ( this . _value ) , "utf8" ) ;
@@ -83,10 +86,7 @@ class OriginalSource extends Source {
8386 }
8487
8588 /**
86- * Override Source.prototype.size (= `this.buffer().length`) to avoid
87- * allocating a Buffer just to read the byte length, and memoize the
88- * result so repeated calls don't re-scan the string.
89- * @returns {number } byte length
89+ * @returns {number } size
9090 */
9191 size ( ) {
9292 if ( this . _cachedSize !== undefined ) return this . _cachedSize ;
Original file line number Diff line number Diff line change @@ -82,6 +82,9 @@ class RawSource extends Source {
8282 return this . _value ;
8383 }
8484
85+ /**
86+ * @returns {Buffer } buffer
87+ */
8588 buffer ( ) {
8689 if ( this . _valueAsBuffer === undefined ) {
8790 const value = Buffer . from ( /** @type {string } */ ( this . _value ) , "utf8" ) ;
@@ -94,10 +97,7 @@ class RawSource extends Source {
9497 }
9598
9699 /**
97- * Override Source.prototype.size (= `this.buffer().length`) to avoid
98- * allocating a Buffer just to read the byte length, and memoize the
99- * result so repeated calls don't re-scan the string.
100- * @returns {number } byte length
100+ * @returns {number } size
101101 */
102102 size ( ) {
103103 if ( this . _cachedSize !== undefined ) return this . _cachedSize ;
Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ class SizeOnlySource extends Source {
3131 ) ;
3232 }
3333
34+ /**
35+ * @returns {number } size
36+ */
3437 size ( ) {
3538 return this . _size ;
3639 }
Original file line number Diff line number Diff line change @@ -62,6 +62,9 @@ class Source {
6262 return [ this . buffer ( ) ] ;
6363 }
6464
65+ /**
66+ * @returns {number } size
67+ */
6568 size ( ) {
6669 return this . buffer ( ) . length ;
6770 }
Original file line number Diff line number Diff line change @@ -129,6 +129,9 @@ class SourceMapSource extends Source {
129129 ] ;
130130 }
131131
132+ /**
133+ * @returns {Buffer } buffer
134+ */
132135 buffer ( ) {
133136 if ( this . _valueAsBuffer === undefined ) {
134137 const value = Buffer . from (
@@ -144,10 +147,7 @@ class SourceMapSource extends Source {
144147 }
145148
146149 /**
147- * Override Source.prototype.size (= `this.buffer().length`) to avoid
148- * allocating a Buffer just to read the byte length, and memoize the
149- * result so repeated calls don't re-scan the string.
150- * @returns {number } byte length
150+ * @returns {number } size
151151 */
152152 size ( ) {
153153 if ( this . _cachedSize !== undefined ) return this . _cachedSize ;
You can’t perform that action at this time.
0 commit comments