stream: add trailing commas in stream source files

PR-URL: https://github.com/nodejs/node/pull/46686
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
Antoine du Hamel 2023-02-18 18:53:57 +01:00 committed by GitHub
parent 109545a8fa
commit 3a648af0f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 64 additions and 63 deletions

View File

@ -290,6 +290,7 @@ overrides:
- ./internal/readme.md
- ./internal/repl/history.js
- ./internal/source_map/prepare_stack_trace.js
- ./internal/streams/*.js
- ./internal/structured_clone.js
- ./internal/test/*.js
- ./internal/test_runner/**/*.js

View File

@ -175,7 +175,7 @@ module.exports = class BufferList {
// Only inspect one level.
depth: 0,
// It should not recurse.
customInspect: false
customInspect: false,
});
}
};

View File

@ -14,7 +14,7 @@ const {
kDestroyed,
isDestroyed,
isFinished,
isServerRequest
isServerRequest,
} = require('internal/streams/utils');
const kDestroy = Symbol('kDestroy');
@ -334,5 +334,5 @@ module.exports = {
destroyer,
destroy,
undestroy,
errorOrDestroy
errorOrDestroy,
};

View File

@ -114,8 +114,8 @@ ObjectDefineProperties(Duplex.prototype, {
this._readableState.destroyed = value;
this._writableState.destroyed = value;
}
}
}
},
},
});
let webStreamsAdapters;

View File

@ -32,7 +32,7 @@ const {
const { AbortController } = require('internal/abort_controller');
const {
FunctionPrototypeCall
FunctionPrototypeCall,
} = primordials;
// This is needed for pre node 17.
@ -91,7 +91,7 @@ module.exports = function duplexify(body, name) {
objectMode: true,
write,
final,
destroy
destroy,
});
}
@ -127,7 +127,7 @@ module.exports = function duplexify(body, name) {
}
});
},
destroy
destroy,
});
}
@ -143,7 +143,7 @@ module.exports = function duplexify(body, name) {
return from(Duplexify, body, {
// TODO (ronag): highWaterMark?
objectMode: true,
writable: false
writable: false,
});
}
@ -192,7 +192,7 @@ module.exports = function duplexify(body, name) {
return d = new Duplexify({
objectMode: true,
writable: false,
read() {}
read() {},
});
}
@ -236,7 +236,7 @@ function fromAsyncGen(fn) {
destroy(err, cb) {
ac.abort();
cb(err);
}
},
};
}

View File

@ -9,7 +9,7 @@ const {
} = require('internal/errors');
const {
ERR_INVALID_ARG_TYPE,
ERR_STREAM_PREMATURE_CLOSE
ERR_STREAM_PREMATURE_CLOSE,
} = codes;
const {
kEmptyObject,
@ -19,7 +19,7 @@ const {
validateAbortSignal,
validateFunction,
validateObject,
validateBoolean
validateBoolean,
} = require('internal/validators');
const { Promise, PromisePrototypeThen } = primordials;

View File

@ -9,7 +9,7 @@ const { Buffer } = require('buffer');
const {
ERR_INVALID_ARG_TYPE,
ERR_STREAM_NULL_VALUES
ERR_STREAM_NULL_VALUES,
} = require('internal/errors').codes;
function from(Readable, iterable, opts) {
@ -21,7 +21,7 @@ function from(Readable, iterable, opts) {
read() {
this.push(iterable);
this.push(null);
}
},
});
}

View File

@ -12,7 +12,7 @@ const {
const stream = require('stream');
const {
getDefaultEncoding
getDefaultEncoding,
} = require('internal/crypto/util');
module.exports = LazyTransform;
@ -43,7 +43,7 @@ function makeSetter(name) {
value: val,
enumerable: true,
configurable: true,
writable: true
writable: true,
});
};
}
@ -54,13 +54,13 @@ ObjectDefineProperties(LazyTransform.prototype, {
get: makeGetter('_readableState'),
set: makeSetter('_readableState'),
configurable: true,
enumerable: true
enumerable: true,
},
_writableState: {
__proto__: null,
get: makeGetter('_writableState'),
set: makeSetter('_writableState'),
configurable: true,
enumerable: true
}
enumerable: true,
},
});

View File

@ -27,7 +27,7 @@ const {
const {
validateFunction,
validateAbortSignal
validateAbortSignal,
} = require('internal/validators');
const {
@ -60,7 +60,7 @@ function destroyer(stream, reading, writing) {
finished = true;
destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED('pipe'));
},
cleanup
cleanup,
};
}
@ -314,7 +314,7 @@ function pipelineImpl(streams, callback, opts) {
// composed through `.pipe(stream)`.
const pt = new PassThrough({
objectMode: true
objectMode: true,
});
// Handle Promises/A+ spec, `then` could be a getter that throws on

View File

@ -32,7 +32,7 @@ const {
Promise,
SafeSet,
SymbolAsyncIterator,
Symbol
Symbol,
} = primordials;
module.exports = Readable;
@ -54,7 +54,7 @@ const BufferList = require('internal/streams/buffer_list');
const destroyImpl = require('internal/streams/destroy');
const {
getHighWaterMark,
getDefaultHighWaterMark
getDefaultHighWaterMark,
} = require('internal/streams/state');
const {
@ -65,8 +65,8 @@ const {
ERR_OUT_OF_RANGE,
ERR_STREAM_PUSH_AFTER_EOF,
ERR_STREAM_UNSHIFT_AFTER_END_EVENT,
ERR_UNKNOWN_ENCODING
}
ERR_UNKNOWN_ENCODING,
},
} = require('internal/errors');
const { validateObject } = require('internal/validators');
@ -1174,7 +1174,7 @@ ObjectDefineProperties(Readable.prototype, {
if (this._readableState) {
this._readableState.readable = !!val;
}
}
},
},
readableDidRead: {
@ -1182,7 +1182,7 @@ ObjectDefineProperties(Readable.prototype, {
enumerable: false,
get: function() {
return this._readableState.dataEmitted;
}
},
},
readableAborted: {
@ -1194,7 +1194,7 @@ ObjectDefineProperties(Readable.prototype, {
(this._readableState.destroyed || this._readableState.errored) &&
!this._readableState.endEmitted
);
}
},
},
readableHighWaterMark: {
@ -1202,7 +1202,7 @@ ObjectDefineProperties(Readable.prototype, {
enumerable: false,
get: function() {
return this._readableState.highWaterMark;
}
},
},
readableBuffer: {
@ -1210,7 +1210,7 @@ ObjectDefineProperties(Readable.prototype, {
enumerable: false,
get: function() {
return this._readableState && this._readableState.buffer;
}
},
},
readableFlowing: {
@ -1223,7 +1223,7 @@ ObjectDefineProperties(Readable.prototype, {
if (this._readableState) {
this._readableState.flowing = state;
}
}
},
},
readableLength: {
@ -1231,7 +1231,7 @@ ObjectDefineProperties(Readable.prototype, {
enumerable: false,
get() {
return this._readableState.length;
}
},
},
readableObjectMode: {
@ -1239,7 +1239,7 @@ ObjectDefineProperties(Readable.prototype, {
enumerable: false,
get() {
return this._readableState ? this._readableState.objectMode : false;
}
},
},
readableEncoding: {
@ -1247,7 +1247,7 @@ ObjectDefineProperties(Readable.prototype, {
enumerable: false,
get() {
return this._readableState ? this._readableState.encoding : null;
}
},
},
errored: {
@ -1255,14 +1255,14 @@ ObjectDefineProperties(Readable.prototype, {
enumerable: false,
get() {
return this._readableState ? this._readableState.errored : null;
}
},
},
closed: {
__proto__: null,
get() {
return this._readableState ? this._readableState.closed : false;
}
},
},
destroyed: {
@ -1281,7 +1281,7 @@ ObjectDefineProperties(Readable.prototype, {
// Backward compatibility, the user is explicitly
// managing destroyed.
this._readableState.destroyed = value;
}
},
},
readableEnded: {
@ -1289,7 +1289,7 @@ ObjectDefineProperties(Readable.prototype, {
enumerable: false,
get() {
return this._readableState ? this._readableState.endEmitted : false;
}
},
},
});
@ -1300,7 +1300,7 @@ ObjectDefineProperties(ReadableState.prototype, {
__proto__: null,
get() {
return this.pipes.length;
}
},
},
// Legacy property for `paused`.
@ -1311,8 +1311,8 @@ ObjectDefineProperties(ReadableState.prototype, {
},
set(value) {
this[kPaused] = !!value;
}
}
},
},
});
// Exposed for testing purposes only.
@ -1426,6 +1426,6 @@ Readable.wrap = function(src, options) {
destroy(err, callback) {
destroyImpl.destroyer(src, err);
callback(err);
}
},
}).wrap(src);
};

View File

@ -32,5 +32,5 @@ function getHighWaterMark(state, options, duplexKey, isDuplex) {
module.exports = {
getHighWaterMark,
getDefaultHighWaterMark
getDefaultHighWaterMark,
};

View File

@ -70,7 +70,7 @@ const {
module.exports = Transform;
const {
ERR_METHOD_NOT_IMPLEMENTED
ERR_METHOD_NOT_IMPLEMENTED,
} = require('internal/errors').codes;
const Duplex = require('internal/streams/duplex');
const { getHighWaterMark } = require('internal/streams/state');
@ -99,7 +99,7 @@ function Transform(options) {
// a "bug" where we check needDrain before calling _write and not after.
// Refs: https://github.com/nodejs/node/pull/32887
// Refs: https://github.com/nodejs/node/pull/35941
writableHighWaterMark: options.writableHighWaterMark || 0
writableHighWaterMark: options.writableHighWaterMark || 0,
};
}

View File

@ -51,7 +51,7 @@ const {
const {
getHighWaterMark,
getDefaultHighWaterMark
getDefaultHighWaterMark,
} = require('internal/streams/state');
const {
ERR_INVALID_ARG_TYPE,
@ -62,7 +62,7 @@ const {
ERR_STREAM_ALREADY_FINISHED,
ERR_STREAM_NULL_VALUES,
ERR_STREAM_WRITE_AFTER_END,
ERR_UNKNOWN_ENCODING
ERR_UNKNOWN_ENCODING,
} = require('internal/errors').codes;
const { errorOrDestroy } = destroyImpl;
@ -221,7 +221,7 @@ ObjectDefineProperty(WritableState.prototype, 'bufferedRequestCount', {
__proto__: null,
get() {
return this.buffered.length - this.bufferedIndex;
}
},
});
function Writable(options) {
@ -778,7 +778,7 @@ ObjectDefineProperties(Writable.prototype, {
__proto__: null,
get() {
return this._writableState ? this._writableState.closed : false;
}
},
},
destroyed: {
@ -791,7 +791,7 @@ ObjectDefineProperties(Writable.prototype, {
if (this._writableState) {
this._writableState.destroyed = value;
}
}
},
},
writable: {
@ -810,35 +810,35 @@ ObjectDefineProperties(Writable.prototype, {
if (this._writableState) {
this._writableState.writable = !!val;
}
}
},
},
writableFinished: {
__proto__: null,
get() {
return this._writableState ? this._writableState.finished : false;
}
},
},
writableObjectMode: {
__proto__: null,
get() {
return this._writableState ? this._writableState.objectMode : false;
}
},
},
writableBuffer: {
__proto__: null,
get() {
return this._writableState && this._writableState.getBuffer();
}
},
},
writableEnded: {
__proto__: null,
get() {
return this._writableState ? this._writableState.ending : false;
}
},
},
writableNeedDrain: {
@ -847,28 +847,28 @@ ObjectDefineProperties(Writable.prototype, {
const wState = this._writableState;
if (!wState) return false;
return !wState.destroyed && !wState.ending && wState.needDrain;
}
},
},
writableHighWaterMark: {
__proto__: null,
get() {
return this._writableState && this._writableState.highWaterMark;
}
},
},
writableCorked: {
__proto__: null,
get() {
return this._writableState ? this._writableState.corked : 0;
}
},
},
writableLength: {
__proto__: null,
get() {
return this._writableState && this._writableState.length;
}
},
},
errored: {
@ -876,7 +876,7 @@ ObjectDefineProperties(Writable.prototype, {
enumerable: false,
get() {
return this._writableState ? this._writableState.errored : null;
}
},
},
writableAborted: {
@ -888,7 +888,7 @@ ObjectDefineProperties(Writable.prototype, {
(this._writableState.destroyed || this._writableState.errored) &&
!this._writableState.finished
);
}
},
},
});