summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine du Hamel <duhamelantoine1995@gmail.com>2023-02-28 12:14:11 +0100
committerDanielle Adams <adamzdanielle@gmail.com>2023-04-10 22:18:20 -0400
commitc463f133bdbae04fc83d3dcdb2cbe335c63e803a (patch)
tree7ac97277eed156e7a22dd925e58543eeeaf4d99a
parent413493cab9d39dfa00cbc602a8a6d9b938bcd56a (diff)
downloadnode-new-c463f133bdbae04fc83d3dcdb2cbe335c63e803a.tar.gz
lib: enforce use of trailing commas
PR-URL: https://github.com/nodejs/node/pull/46881 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me>
-rw-r--r--lib/.eslintrc.yaml34
-rw-r--r--lib/internal/assert/assertion_error.js10
-rw-r--r--lib/internal/assert/calltracker.js4
-rw-r--r--lib/internal/bootstrap/browser.js5
-rw-r--r--lib/internal/bootstrap/loaders.js6
-rw-r--r--lib/internal/bootstrap/node.js26
-rw-r--r--lib/internal/bootstrap/switches/does_not_own_process_state.js2
-rw-r--r--lib/internal/bootstrap/switches/does_own_process_state.js12
-rw-r--r--lib/internal/bootstrap/switches/is_main_thread.js16
-rw-r--r--lib/internal/bootstrap/switches/is_not_main_thread.js6
-rw-r--r--lib/internal/console/constructor.js50
-rw-r--r--lib/internal/console/global.js2
-rw-r--r--lib/internal/crypto/cfrg.js4
-rw-r--r--lib/internal/crypto/cipher.js4
-rw-r--r--lib/internal/crypto/diffiehellman.js8
-rw-r--r--lib/internal/crypto/ec.js8
-rw-r--r--lib/internal/crypto/hash.js6
-rw-r--r--lib/internal/crypto/hashnames.js2
-rw-r--r--lib/internal/crypto/keygen.js12
-rw-r--r--lib/internal/crypto/keys.js24
-rw-r--r--lib/internal/crypto/mac.js2
-rw-r--r--lib/internal/crypto/random.js2
-rw-r--r--lib/internal/crypto/rsa.js12
-rw-r--r--lib/internal/crypto/scrypt.js2
-rw-r--r--lib/internal/crypto/sig.js8
-rw-r--r--lib/internal/crypto/util.js8
-rw-r--r--lib/internal/crypto/webcrypto.js6
-rw-r--r--lib/internal/crypto/x509.js6
-rw-r--r--lib/internal/dns/callback_resolver.js6
-rw-r--r--lib/internal/dns/promises.js12
-rw-r--r--lib/internal/dns/utils.js4
-rw-r--r--lib/internal/fs/cp/cp-sync.js4
-rw-r--r--lib/internal/fs/cp/cp.js4
-rw-r--r--lib/internal/http2/compat.js16
-rw-r--r--lib/internal/http2/core.js38
-rw-r--r--lib/internal/http2/util.js12
-rw-r--r--lib/internal/legacy/processbinding.js2
-rw-r--r--lib/internal/main/check_syntax.js4
-rw-r--r--lib/internal/main/environment.js2
-rw-r--r--lib/internal/main/eval_stdin.js4
-rw-r--r--lib/internal/main/eval_string.js2
-rw-r--r--lib/internal/main/inspect.js2
-rw-r--r--lib/internal/main/mksnapshot.js6
-rw-r--r--lib/internal/main/print_help.js10
-rw-r--r--lib/internal/main/prof_process.js2
-rw-r--r--lib/internal/main/repl.js4
-rw-r--r--lib/internal/main/run_main_module.js2
-rw-r--r--lib/internal/main/test_runner.js2
-rw-r--r--lib/internal/main/watch_mode.js2
-rw-r--r--lib/internal/main/worker_thread.js16
-rw-r--r--lib/internal/modules/cjs/loader.js16
-rw-r--r--lib/internal/modules/esm/initialize_import_meta.js2
-rw-r--r--lib/internal/modules/esm/loader.js4
-rw-r--r--lib/internal/modules/esm/resolve.js2
-rw-r--r--lib/internal/modules/esm/translators.js6
-rw-r--r--lib/internal/modules/esm/utils.js105
-rw-r--r--lib/internal/perf/performance.js8
-rw-r--r--lib/internal/util/colors.js2
-rw-r--r--lib/internal/util/comparisons.js4
-rw-r--r--lib/internal/util/debuglog.js4
-rw-r--r--lib/internal/util/inspect.js18
-rw-r--r--lib/internal/util/inspector.js2
-rw-r--r--lib/internal/util/iterable_weak_map.js2
-rw-r--r--lib/internal/util/types.js6
-rw-r--r--lib/internal/v8/startup_snapshot.js8
-rw-r--r--lib/internal/vm/module.js2
-rw-r--r--lib/internal/worker/io.js24
-rw-r--r--lib/internal/worker/js_transferable.js4
68 files changed, 367 insertions, 295 deletions
diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml
index 274f8dd8a4..3b406703ce 100644
--- a/lib/.eslintrc.yaml
+++ b/lib/.eslintrc.yaml
@@ -2,13 +2,6 @@ env:
es6: true
rules:
- comma-dangle: [error, {
- arrays: always-multiline,
- exports: always-multiline,
- functions: always-multiline,
- imports: always-multiline,
- objects: only-multiline,
- }]
prefer-object-spread: error
no-buffer-constructor: error
no-mixed-operators:
@@ -249,30 +242,3 @@ globals:
module: false
internalBinding: false
primordials: false
-overrides:
- - files:
- - ./*/*.js
- - ./*.js
- - ./internal/child_process/*.js
- - ./internal/cluster/*.js
- - ./internal/debugger/*.js
- - ./internal/events/*.js
- - ./internal/fs/*.js
- - ./internal/modules/*.js
- - ./internal/per_context/*.js
- - ./internal/perf/*.js
- - ./internal/policy/*.js
- - ./internal/process/*.js
- - ./internal/readline/*.js
- - ./internal/readme.md
- - ./internal/repl/*.js
- - ./internal/source_map/*.js
- - ./internal/streams/*.js
- - ./internal/test/*.js
- - ./internal/test_runner/**/*.js
- - ./internal/tls/*.js
- - ./internal/util/parse_args/*.js
- - ./internal/watch_mode/*.js
- - ./internal/webstreams/*.js
- rules:
- comma-dangle: [error, always-multiline]
diff --git a/lib/internal/assert/assertion_error.js b/lib/internal/assert/assertion_error.js
index 4f8f3760a2..dae31f9e04 100644
--- a/lib/internal/assert/assertion_error.js
+++ b/lib/internal/assert/assertion_error.js
@@ -39,7 +39,7 @@ const kReadableOperator = {
'Expected "actual" not to be reference-equal to "expected":',
notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:',
notIdentical: 'Values have same structure but are not reference-equal:',
- notDeepEqualUnequal: 'Expected values not to be loosely deep-equal:'
+ notDeepEqualUnequal: 'Expected values not to be loosely deep-equal:',
};
// Comparing short primitives should just show === / !== instead of using the
@@ -331,11 +331,11 @@ class AssertionError extends Error {
stackStartFn,
details,
// Compatibility with older versions.
- stackStartFunction
+ stackStartFunction,
} = options;
let {
actual,
- expected
+ expected,
} = options;
const limit = Error.stackTraceLimit;
@@ -430,7 +430,7 @@ class AssertionError extends Error {
value: 'AssertionError [ERR_ASSERTION]',
enumerable: false,
writable: true,
- configurable: true
+ configurable: true,
});
this.code = 'ERR_ASSERTION';
if (details) {
@@ -479,7 +479,7 @@ class AssertionError extends Error {
const result = inspect(this, {
...ctx,
customInspect: false,
- depth: 0
+ depth: 0,
});
// Reset the properties after inspection.
diff --git a/lib/internal/assert/calltracker.js b/lib/internal/assert/calltracker.js
index 2046634932..0e22753053 100644
--- a/lib/internal/assert/calltracker.js
+++ b/lib/internal/assert/calltracker.js
@@ -63,7 +63,7 @@ class CallTrackerContext {
actual: this.#calls.length,
expected: this.#expected,
operator: this.#name,
- stack: this.#stackTrace
+ stack: this.#stackTrace,
};
}
}
@@ -110,7 +110,7 @@ class CallTracker {
expected,
// eslint-disable-next-line no-restricted-syntax
stackTrace: new Error(),
- name: fn.name || 'calls'
+ name: fn.name || 'calls',
});
const tracked = new Proxy(fn, {
__proto__: null,
diff --git a/lib/internal/bootstrap/browser.js b/lib/internal/bootstrap/browser.js
index d0c01ca2a5..5be4dd6176 100644
--- a/lib/internal/bootstrap/browser.js
+++ b/lib/internal/bootstrap/browser.js
@@ -29,7 +29,8 @@ exposeGetterAndSetter(globalThis,
});
const {
- TextEncoder, TextDecoder
+ TextEncoder,
+ TextDecoder,
} = require('internal/encoding');
// https://encoding.spec.whatwg.org/#textencoder
exposeInterface(globalThis, 'TextEncoder', TextEncoder);
@@ -100,7 +101,7 @@ function exposeNamespace(target, name, namespaceObject) {
writable: true,
enumerable: false,
configurable: true,
- value: namespaceObject
+ value: namespaceObject,
});
}
diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js
index bf12c57d55..be7924ea16 100644
--- a/lib/internal/bootstrap/loaders.js
+++ b/lib/internal/bootstrap/loaders.js
@@ -69,7 +69,7 @@ ObjectDefineProperty(process, 'moduleLoadList', {
value: moduleLoadList,
configurable: true,
enumerable: true,
- writable: false
+ writable: false,
});
@@ -182,7 +182,7 @@ let internalBinding;
const loaderId = 'internal/bootstrap/loaders';
const {
builtinIds,
- compileFunction
+ compileFunction,
} = internalBinding('builtins');
const getOwn = (target, property, receiver) => {
@@ -350,7 +350,7 @@ class BuiltinModule {
const loaderExports = {
internalBinding,
BuiltinModule,
- require: requireBuiltin
+ require: requireBuiltin,
};
function requireBuiltin(id) {
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
index 6a882c2b9b..07c6d5e935 100644
--- a/lib/internal/bootstrap/node.js
+++ b/lib/internal/bootstrap/node.js
@@ -153,7 +153,7 @@ const deprecationHandler = {
setPrototypeOf(target, proto) {
this.maybeWarn();
return ObjectSetPrototypeOf(target, proto);
- }
+ },
};
// process.config is serialized config.gypi
@@ -172,7 +172,7 @@ ObjectDefineProperty(process, 'config', {
set(value) {
deprecationHandler.maybeWarn();
processConfig = value;
- }
+ },
});
require('internal/worker/js_transferable').setup();
@@ -231,7 +231,7 @@ internalBinding('async_wrap').setupHooks(nativeHooks);
const {
setupTaskQueue,
- queueMicrotask
+ queueMicrotask,
} = require('internal/process/task_queues');
// Non-standard extensions:
@@ -272,11 +272,11 @@ ObjectDefineProperty(process, 'allowedNodeEnvironmentFlags', {
value,
configurable: true,
enumerable: true,
- writable: true
+ writable: true,
});
},
enumerable: true,
- configurable: true
+ configurable: true,
});
// process.assert
@@ -301,7 +301,7 @@ const features = {
// code cache even if the binary is built with embedded code cache.
get cached_builtins() {
return binding.hasCachedBuiltins();
- }
+ },
};
ObjectDefineProperty(process, 'features', {
@@ -309,14 +309,14 @@ ObjectDefineProperty(process, 'features', {
enumerable: true,
writable: false,
configurable: false,
- value: features
+ value: features,
});
{
const {
onGlobalUncaughtException,
setUncaughtExceptionCaptureCallback,
- hasUncaughtExceptionCaptureCallback
+ hasUncaughtExceptionCaptureCallback,
} = require('internal/process/execution');
// For legacy reasons this is still called `_fatalException`, even
@@ -373,14 +373,14 @@ if (config.hasOpenSSL) {
function setupPrepareStackTrace() {
const {
setEnhanceStackForFatalException,
- setPrepareStackTraceCallback
+ setPrepareStackTraceCallback,
} = internalBinding('errors');
const {
prepareStackTrace,
fatalExceptionStackEnhancers: {
beforeInspector,
- afterInspector
- }
+ afterInspector,
+ },
} = require('internal/errors');
// Tell our PrepareStackTraceCallback passed to the V8 API
// to call prepareStackTrace().
@@ -399,7 +399,7 @@ function setupProcessObject() {
enumerable: false,
writable: true,
configurable: false,
- value: 'process'
+ value: 'process',
});
// Create global.process as getters so that we have a
@@ -425,7 +425,7 @@ function setupGlobalProxy() {
value: 'global',
writable: false,
enumerable: false,
- configurable: true
+ configurable: true,
});
globalThis.global = globalThis;
}
diff --git a/lib/internal/bootstrap/switches/does_not_own_process_state.js b/lib/internal/bootstrap/switches/does_not_own_process_state.js
index 69946e802e..21be25384f 100644
--- a/lib/internal/bootstrap/switches/does_not_own_process_state.js
+++ b/lib/internal/bootstrap/switches/does_not_own_process_state.js
@@ -23,7 +23,7 @@ if (credentials.implementsPosixCredentials) {
// ---- compare the setups side-by-side -----
const {
- codes: { ERR_WORKER_UNSUPPORTED_OPERATION }
+ codes: { ERR_WORKER_UNSUPPORTED_OPERATION },
} = require('internal/errors');
function wrappedUmask(mask) {
diff --git a/lib/internal/bootstrap/switches/does_own_process_state.js b/lib/internal/bootstrap/switches/does_own_process_state.js
index 0185a75e78..85b5c3dfcb 100644
--- a/lib/internal/bootstrap/switches/does_own_process_state.js
+++ b/lib/internal/bootstrap/switches/does_own_process_state.js
@@ -25,18 +25,18 @@ if (credentials.implementsPosixCredentials) {
const {
parseFileMode,
validateArray,
- validateString
+ validateString,
} = require('internal/validators');
function wrapPosixCredentialSetters(credentials) {
const {
codes: {
ERR_INVALID_ARG_TYPE,
- ERR_UNKNOWN_CREDENTIAL
- }
+ ERR_UNKNOWN_CREDENTIAL,
+ },
} = require('internal/errors');
const {
- validateUint32
+ validateUint32,
} = require('internal/validators');
const {
@@ -45,7 +45,7 @@ function wrapPosixCredentialSetters(credentials) {
setegid: _setegid,
seteuid: _seteuid,
setgid: _setgid,
- setuid: _setuid
+ setuid: _setuid,
} = credentials;
function initgroups(user, extraGroup) {
@@ -99,7 +99,7 @@ function wrapPosixCredentialSetters(credentials) {
setegid: wrapIdSetter('Group', _setegid),
seteuid: wrapIdSetter('User', _seteuid),
setgid: wrapIdSetter('Group', _setgid),
- setuid: wrapIdSetter('User', _setuid)
+ setuid: wrapIdSetter('User', _setuid),
};
}
diff --git a/lib/internal/bootstrap/switches/is_main_thread.js b/lib/internal/bootstrap/switches/is_main_thread.js
index e4042ebe88..b2f40d9c9b 100644
--- a/lib/internal/bootstrap/switches/is_main_thread.js
+++ b/lib/internal/bootstrap/switches/is_main_thread.js
@@ -4,7 +4,7 @@ const { ObjectDefineProperty } = primordials;
const rawMethods = internalBinding('process_methods');
const {
addSerializeCallback,
- isBuildingSnapshot
+ isBuildingSnapshot,
} = require('v8').startupSnapshot;
// TODO(joyeecheung): deprecate and remove these underscore methods
process._debugProcess = rawMethods._debugProcess;
@@ -21,7 +21,7 @@ function defineStream(name, getter) {
__proto__: null,
configurable: true,
enumerable: true,
- get: getter
+ get: getter,
});
}
@@ -32,7 +32,7 @@ defineStream('stderr', getStderr);
// Worker threads don't receive signals.
const {
startListeningIfSignal,
- stopListeningIfSignal
+ stopListeningIfSignal,
} = require('internal/process/signal');
process.on('newListener', startListeningIfSignal);
process.on('removeListener', stopListeningIfSignal);
@@ -72,13 +72,13 @@ function createWritableStdioStream(fd) {
stream = new net.Socket({
handle: process[kChannelHandle],
readable: false,
- writable: true
+ writable: true,
});
} else {
stream = new net.Socket({
fd,
readable: false,
- writable: true
+ writable: true,
});
}
@@ -93,7 +93,7 @@ function createWritableStdioStream(fd) {
stream = new Writable({
write(buf, enc, cb) {
cb();
- }
+ },
});
}
}
@@ -216,14 +216,14 @@ function getStdin() {
handle: process.channel,
readable: true,
writable: false,
- manualStart: true
+ manualStart: true,
});
} else {
stdin = new net.Socket({
fd: fd,
readable: true,
writable: false,
- manualStart: true
+ manualStart: true,
});
}
// Make sure the stdin can't be `.end()`-ed
diff --git a/lib/internal/bootstrap/switches/is_not_main_thread.js b/lib/internal/bootstrap/switches/is_not_main_thread.js
index cb129189b2..c2cb0106f0 100644
--- a/lib/internal/bootstrap/switches/is_not_main_thread.js
+++ b/lib/internal/bootstrap/switches/is_not_main_thread.js
@@ -10,7 +10,7 @@ function defineStream(name, getter) {
__proto__: null,
configurable: true,
enumerable: true,
- get: getter
+ get: getter,
});
}
@@ -21,7 +21,7 @@ defineStream('stderr', getStderr);
// Worker threads don't receive signals.
const {
startListeningIfSignal,
- stopListeningIfSignal
+ stopListeningIfSignal,
} = require('internal/process/signal');
process.removeListener('newListener', startListeningIfSignal);
process.removeListener('removeListener', stopListeningIfSignal);
@@ -30,7 +30,7 @@ process.removeListener('removeListener', stopListeningIfSignal);
// ---- compare the setups side-by-side -----
const {
- createWorkerStdio
+ createWorkerStdio,
} = require('internal/worker/io');
let workerStdio;
diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js
index b71c8c5c0c..eacf44a6ca 100644
--- a/lib/internal/console/constructor.js
+++ b/lib/internal/console/constructor.js
@@ -57,7 +57,7 @@ const { previewEntries } = internalBinding('util');
const { Buffer: { isBuffer } } = require('buffer');
const {
inspect,
- formatWithOptions
+ formatWithOptions,
} = require('internal/util/inspect');
const {
isTypedArray, isSet, isMap, isSetIterator, isMapIterator,
@@ -109,7 +109,7 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) {
options = {
stdout: options,
stderr: arguments[1],
- ignoreErrors: arguments[2]
+ ignoreErrors: arguments[2],
};
}
@@ -156,7 +156,7 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) {
this[key] = FunctionPrototypeBind(this[key], this);
ObjectDefineProperty(this[key], 'name', {
__proto__: null,
- value: key
+ value: key,
});
});
@@ -167,7 +167,7 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) {
const consolePropAttributes = {
writable: true,
enumerable: false,
- configurable: true
+ configurable: true,
};
// Fixup global.console instanceof global.console.Console
@@ -175,7 +175,7 @@ ObjectDefineProperty(Console, SymbolHasInstance, {
__proto__: null,
value(instance) {
return instance[kIsConsole];
- }
+ },
});
const kColorInspectOptions = { colors: true };
@@ -191,7 +191,7 @@ ObjectDefineProperties(Console.prototype, {
'_stdout': { __proto__: null, ...consolePropAttributes, value: stdout },
'_stderr': { __proto__: null, ...consolePropAttributes, value: stderr },
});
- }
+ },
},
[kBindStreamsLazy]: {
__proto__: null,
@@ -210,7 +210,7 @@ ObjectDefineProperties(Console.prototype, {
if (!stdout) stdout = object.stdout;
return stdout;
},
- set(value) { stdout = value; }
+ set(value) { stdout = value; },
},
'_stderr': {
__proto__: null,
@@ -220,10 +220,10 @@ ObjectDefineProperties(Console.prototype, {
if (!stderr) { stderr = object.stderr; }
return stderr;
},
- set(value) { stderr = value; }
- }
+ set(value) { stderr = value; },
+ },
});
- }
+ },
},
[kBindProperties]: {
__proto__: null,
@@ -233,17 +233,17 @@ ObjectDefineProperties(Console.prototype, {
'_stdoutErrorHandler': {
__proto__: null,
...consolePropAttributes,
- value: createWriteErrorHandler(this, kUseStdout)
+ value: createWriteErrorHandler(this, kUseStdout),
},
'_stderrErrorHandler': {
...consolePropAttributes,
__proto__: null,
- value: createWriteErrorHandler(this, kUseStderr)
+ value: createWriteErrorHandler(this, kUseStderr),
},
'_ignoreErrors': {
__proto__: null,
...consolePropAttributes,
- value: Boolean(ignoreErrors)
+ value: Boolean(ignoreErrors),
},
'_times': { __proto__: null, ...consolePropAttributes, value: new SafeMap() },
// Corresponds to https://console.spec.whatwg.org/#count-map
@@ -254,17 +254,17 @@ ObjectDefineProperties(Console.prototype, {
[kGroupIndentationWidth]: {
__proto__: null,
...consolePropAttributes,
- value: groupIndentation
+ value: groupIndentation,
},
[SymbolToStringTag]: {
__proto__: null,
writable: false,
enumerable: false,
configurable: true,
- value: 'console'
- }
+ value: 'console',
+ },
});
- }
+ },
},
[kWriteToConsole]: {
__proto__: null,
@@ -307,7 +307,7 @@ ObjectDefineProperties(Console.prototype, {
} finally {
stream.removeListener('error', noop);
}
- }
+ },
},
[kGetInspectOptions]: {
__proto__: null,
@@ -329,7 +329,7 @@ ObjectDefineProperties(Console.prototype, {
}
return color ? kColorInspectOptions : kNoColorInspectOptions;
- }
+ },
},
[kFormatForStdout]: {
__proto__: null,
@@ -338,7 +338,7 @@ ObjectDefineProperties(Console.prototype, {
const opts = this[kGetInspectOptions](this._stdout);
ArrayPrototypeUnshift(args, opts);
return ReflectApply(formatWithOptions, null, args);
- }
+ },
},
[kFormatForStderr]: {
__proto__: null,
@@ -347,7 +347,7 @@ ObjectDefineProperties(Console.prototype, {
const opts = this[kGetInspectOptions](this._stderr);
ArrayPrototypeUnshift(args, opts);
return ReflectApply(formatWithOptions, null, args);
- }
+ },
},
});
@@ -387,7 +387,7 @@ const consoleMethods = {
this[kWriteToConsole](kUseStdout, inspect(object, {
customInspect: false,
...this[kGetInspectOptions](this._stdout),
- ...options
+ ...options,
}));
},
@@ -422,7 +422,7 @@ const consoleMethods = {
trace: function trace(...args) {
const err = {
name: 'Trace',
- message: this[kFormatForStderr](args)
+ message: this[kFormatForStderr](args),
};
ErrorCaptureStackTrace(err, trace);
this.error(err.stack);
@@ -515,7 +515,7 @@ const consoleMethods = {
depth,
maxArrayLength: 3,
breakLength: Infinity,
- ...this[kGetInspectOptions](this._stdout)
+ ...this[kGetInspectOptions](this._stdout),
};
return inspect(v, opt);
};
@@ -721,5 +721,5 @@ module.exports = {
kBindStreamsLazy,
kBindProperties,
initializeGlobalConsole,
- formatTime // exported for tests
+ formatTime, // exported for tests
};
diff --git a/lib/internal/console/global.js b/lib/internal/console/global.js
index dd293b9f19..1b99b6819d 100644
--- a/lib/internal/console/global.js
+++ b/lib/internal/console/global.js
@@ -21,7 +21,7 @@ const {
} = primordials;
const {
- Console
+ Console,
} = require('internal/console/constructor');
const globalConsole = ObjectCreate({});
diff --git a/lib/internal/crypto/cfrg.js b/lib/internal/crypto/cfrg.js
index 68293663e1..a39c440ee2 100644
--- a/lib/internal/crypto/cfrg.js
+++ b/lib/internal/crypto/cfrg.js
@@ -214,7 +214,7 @@ async function cfrgImportKey(
keyObject = createPublicKey({
key: keyData,
format: 'der',
- type: 'spki'
+ type: 'spki',
});
} catch (err) {
throw lazyDOMException(
@@ -228,7 +228,7 @@ async function cfrgImportKey(
keyObject = createPrivateKey({
key: keyData,
format: 'der',
- type: 'pkcs8'
+ type: 'pkcs8',
});
} catch (err) {
throw lazyDOMException(
diff --git a/lib/internal/crypto/cipher.js b/lib/internal/crypto/cipher.js
index fe2cc0f525..69be334b7e 100644
--- a/lib/internal/crypto/cipher.js
+++ b/lib/internal/crypto/cipher.js
@@ -19,7 +19,7 @@ const {
crypto: {
RSA_PKCS1_OAEP_PADDING,
RSA_PKCS1_PADDING,
- }
+ },
} = internalBinding('constants');
const {
@@ -28,7 +28,7 @@ const {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
ERR_UNKNOWN_ENCODING,
- }
+ },
} = require('internal/errors');
const {
diff --git a/lib/internal/crypto/diffiehellman.js b/lib/internal/crypto/diffiehellman.js
index 4950dd195e..c1d97e93fa 100644
--- a/lib/internal/crypto/diffiehellman.js
+++ b/lib/internal/crypto/diffiehellman.js
@@ -27,7 +27,7 @@ const {
ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE,
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
- }
+ },
} = require('internal/errors');
const {
@@ -65,7 +65,7 @@ const {
POINT_CONVERSION_COMPRESSED,
POINT_CONVERSION_HYBRID,
POINT_CONVERSION_UNCOMPRESSED,
- }
+ },
} = internalBinding('constants');
const DH_GENERATOR = 2;
@@ -126,7 +126,7 @@ function DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) {
__proto__: null,
enumerable: true,
value: this[kHandle].verifyError,
- writable: false
+ writable: false,
});
}
@@ -139,7 +139,7 @@ function DiffieHellmanGroup(name) {
__proto__: null,
enumerable: true,
value: this[kHandle].verifyError,
- writable: false
+ writable: false,
});
}
diff --git a/lib/internal/crypto/ec.js b/lib/internal/crypto/ec.js
index d433e34c48..64b1236cd5 100644
--- a/lib/internal/crypto/ec.js
+++ b/lib/internal/crypto/ec.js
@@ -20,7 +20,7 @@ const {
const {
codes: {
ERR_MISSING_OPTION,
- }
+ },
} = require('internal/errors');
const {
@@ -181,7 +181,7 @@ async function ecImportKey(
keyObject = createPublicKey({
key: keyData,
format: 'der',
- type: 'spki'
+ type: 'spki',
});
} catch (err) {
throw lazyDOMException(
@@ -195,7 +195,7 @@ async function ecImportKey(
keyObject = createPrivateKey({
key: keyData,
format: 'der',
- type: 'pkcs8'
+ type: 'pkcs8',
});
} catch (err) {
throw lazyDOMException(
@@ -270,7 +270,7 @@ async function ecImportKey(
}
const {
- namedCurve: checkNamedCurve
+ namedCurve: checkNamedCurve,
} = keyObject[kHandle].keyDetail({});
if (kNamedCurveAliases[namedCurve] !== checkNamedCurve)
throw lazyDOMException('Named curve mismatch', 'DataError');
diff --git a/lib/internal/crypto/hash.js b/lib/internal/crypto/hash.js
index 72d127b37c..ab3dd41f5e 100644
--- a/lib/internal/crypto/hash.js
+++ b/lib/internal/crypto/hash.js
@@ -41,7 +41,7 @@ const {
ERR_CRYPTO_HASH_FINALIZED,
ERR_CRYPTO_HASH_UPDATE_FAILED,
ERR_INVALID_ARG_TYPE,
- }
+ },
} = require('internal/errors');
const {
@@ -70,7 +70,7 @@ function Hash(algorithm, options) {
validateUint32(xofLen, 'options.outputLength');
this[kHandle] = new _Hash(algorithm, xofLen);
this[kState] = {
- [kFinalized]: false
+ [kFinalized]: false,
};
ReflectApply(LazyTransform, this, [options]);
}
@@ -137,7 +137,7 @@ function Hmac(hmac, key, options) {
this[kHandle] = new _Hmac();
this[kHandle].init(hmac, key);
this[kState] = {
- [kFinalized]: false
+ [kFinalized]: false,
};
ReflectApply(LazyTransform, this, [options]);
}
diff --git a/lib/internal/crypto/hashnames.js b/lib/internal/crypto/hashnames.js
index 5c0051e0a8..54cd87b6ba 100644
--- a/lib/internal/crypto/hashnames.js
+++ b/lib/internal/crypto/hashnames.js
@@ -49,7 +49,7 @@ const kHashNames = {
[kHashContextJwkRsaPss]: 'PS512',
[kHashContextJwkRsaOaep]: 'RSA-OAEP-512',
[kHashContextJwkHmac]: 'HS512',
- }
+ },
};
{
diff --git a/lib/internal/crypto/keygen.js b/lib/internal/crypto/keygen.js
index 05b1150a20..0c2f4a6031 100644
--- a/lib/internal/crypto/keygen.js
+++ b/lib/internal/crypto/keygen.js
@@ -58,7 +58,7 @@ const {
ERR_INCOMPATIBLE_OPTION_PAIR,
ERR_INVALID_ARG_VALUE,
ERR_MISSING_OPTION,
- }
+ },
} = require('internal/errors');
const { isArrayBufferView } = require('internal/util/types');
@@ -101,7 +101,7 @@ function generateKeyPair(type, options, callback) {
ObjectDefineProperty(generateKeyPair, customPromisifyArgs, {
__proto__: null,
value: ['publicKey', 'privateKey'],
- enumerable: false
+ enumerable: false,
});
function generateKeyPairSync(type, options) {
@@ -121,7 +121,7 @@ function handleError(ret) {
// If no encoding was chosen, return key objects instead.
return {
publicKey: wrapKey(publicKey, PublicKeyObject),
- privateKey: wrapKey(privateKey, PrivateKeyObject)
+ privateKey: wrapKey(privateKey, PrivateKeyObject),
};
}
@@ -134,7 +134,7 @@ function parseKeyEncoding(keyType, options = kEmptyObject) {
} else if (typeof publicKeyEncoding === 'object') {
({
format: publicFormat,
- type: publicType
+ type: publicType,
} = parsePublicKeyEncoding(publicKeyEncoding, keyType,
'publicKeyEncoding'));
} else {
@@ -150,7 +150,7 @@ function parseKeyEncoding(keyType, options = kEmptyObject) {
format: privateFormat,
type: privateType,
cipher,
- passphrase
+ passphrase,
} = parsePrivateKeyEncoding(privateKeyEncoding, keyType,
'privateKeyEncoding'));
} else {
@@ -201,7 +201,7 @@ function createJob(mode, type, options) {
}
const {
- hash, mgf1Hash, hashAlgorithm, mgf1HashAlgorithm, saltLength
+ hash, mgf1Hash, hashAlgorithm, mgf1HashAlgorithm, saltLength,
} = options;
const pendingDeprecation = getOptionValue('--pending-deprecation');
diff --git a/lib/internal/crypto/keys.js b/lib/internal/crypto/keys.js
index b48dd30673..4b06810a87 100644
--- a/lib/internal/crypto/keys.js
+++ b/lib/internal/crypto/keys.js
@@ -41,7 +41,7 @@ const {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
ERR_INVALID_THIS,
- }
+ },
} = require('internal/errors');
const {
@@ -115,7 +115,7 @@ const {
value: handle,
enumerable: false,
configurable: false,
- writable: false
+ writable: false,
});
}
@@ -178,7 +178,7 @@ const {
return {
...details,
publicExponent:
- bigIntArrayToUnsignedBigInt(new Uint8Array(details.publicExponent))
+ bigIntArrayToUnsignedBigInt(new Uint8Array(details.publicExponent)),
};
}
return details;
@@ -222,7 +222,7 @@ const {
}
const {
format,
- type
+ type,
} = parsePublicKeyEncoding(options, this.asymmetricKeyType);
return this[kHandle].export(format, type);
}
@@ -245,7 +245,7 @@ const {
format,
type,
cipher,
- passphrase
+ passphrase,
} = parsePrivateKeyEncoding(options, this.asymmetricKeyType);
return this[kHandle].export(format, type, cipher, passphrase);
}
@@ -327,7 +327,7 @@ function parseKeyEncoding(enc, keyType, isPublic, objName) {
const {
format,
- type
+ type,
} = parseKeyFormatAndType(enc, keyType, isPublic, objName);
let cipher, passphrase, encoding;
@@ -477,7 +477,7 @@ function getKeyObjectHandleFromJwk(key, ctx) {
kty: key.kty,
crv: key.crv,
x: key.x,
- y: key.y
+ y: key.y,
};
if (!isPublic) {
@@ -500,7 +500,7 @@ function getKeyObjectHandleFromJwk(key, ctx) {
const jwk = {
kty: key.kty,
n: key.n,
- e: key.e
+ e: key.e,
};
if (!isPublic) {
@@ -561,7 +561,7 @@ function prepareAsymmetricKey(key, ctx) {
(ctx === kConsumePrivate || ctx === kCreatePrivate) ? false : undefined;
return {
data: getArrayBufferOrView(data, 'key', encoding),
- ...parseKeyEncoding(key, undefined, isPublic)
+ ...parseKeyEncoding(key, undefined, isPublic),
};
}
throw new ERR_INVALID_ARG_TYPE(
@@ -655,14 +655,14 @@ class CryptoKey {
const opts = {
...options,
- depth: options.depth == null ? null : options.depth - 1
+ depth: options.depth == null ? null : options.depth - 1,
};
return `CryptoKey ${inspect({
type: this.type,
extractable: this.extractable,
algorithm: this.algorithm,
- usages: this.usages
+ usages: this.usages,
}, opts)}`;
}
@@ -739,7 +739,7 @@ class InternalCryptoKey {
usages,
extractable,
},
- deserializeInfo: 'internal/crypto/keys:InternalCryptoKey'
+ deserializeInfo: 'internal/crypto/keys:InternalCryptoKey',
};
}
diff --git a/lib/internal/crypto/mac.js b/lib/internal/crypto/mac.js
index bcd66ae80c..41ae433706 100644
--- a/lib/internal/crypto/mac.js
+++ b/lib/internal/crypto/mac.js
@@ -32,7 +32,7 @@ const {
const {
codes: {
ERR_MISSING_OPTION,
- }
+ },
} = require('internal/errors');
const {
diff --git a/lib/internal/crypto/random.js b/lib/internal/crypto/random.js
index 874096ac23..3416b38034 100644
--- a/lib/internal/crypto/random.js
+++ b/lib/internal/crypto/random.js
@@ -43,7 +43,7 @@ const {
ERR_MISSING_ARGS,
ERR_OUT_OF_RANGE,
ERR_OPERATION_FAILED,
- }
+ },
} = require('internal/errors');
const {
diff --git a/lib/internal/crypto/rsa.js b/lib/internal/crypto/rsa.js
index 2c05f6c8c1..0b2824b3d4 100644
--- a/lib/internal/crypto/rsa.js
+++ b/lib/internal/crypto/rsa.js
@@ -25,7 +25,7 @@ const {
codes: {
ERR_INVALID_ARG_TYPE,
ERR_MISSING_OPTION,
- }
+ },
} = require('internal/errors');
const {
@@ -127,7 +127,7 @@ async function rsaKeyGenerate(
name,
modulusLength,
publicExponent,
- hash
+ hash,
} = algorithm;
if (hash === undefined)
@@ -179,7 +179,7 @@ async function rsaKeyGenerate(
name,
modulusLength,
publicExponent,
- hash: { name: hash.name }
+ hash: { name: hash.name },
};
let publicUsages;
@@ -241,7 +241,7 @@ async function rsaImportKey(
keyObject = createPublicKey({
key: keyData,
format: 'der',
- type: 'spki'
+ type: 'spki',
});
} catch (err) {
throw lazyDOMException(
@@ -255,7 +255,7 @@ async function rsaImportKey(
keyObject = createPrivateKey({
key: keyData,
format: 'der',
- type: 'pkcs8'
+ type: 'pkcs8',
});
} catch (err) {
throw lazyDOMException(
@@ -328,7 +328,7 @@ async function rsaImportKey(
name: algorithm.name,
modulusLength,
publicExponent: new Uint8Array(publicExponent),
- hash: algorithm.hash
+ hash: algorithm.hash,
}, keyUsages, extractable);
}
diff --git a/lib/internal/crypto/scrypt.js b/lib/internal/crypto/scrypt.js
index 3e6565b85d..b794322c27 100644
--- a/lib/internal/crypto/scrypt.js
+++ b/lib/internal/crypto/scrypt.js
@@ -23,7 +23,7 @@ const {
codes: {
ERR_CRYPTO_SCRYPT_INVALID_PARAMETER,
ERR_CRYPTO_SCRYPT_NOT_SUPPORTED,
- }
+ },
} = require('internal/errors');
const {
diff --git a/lib/internal/crypto/sig.js b/lib/internal/crypto/sig.js
index 457ed1d22e..71e8fbadaa 100644
--- a/lib/internal/crypto/sig.js
+++ b/lib/internal/crypto/sig.js
@@ -11,7 +11,7 @@ const {
ERR_CRYPTO_SIGN_KEY_REQUIRED,
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
- }
+ },
} = require('internal/errors');
const {
@@ -161,7 +161,7 @@ function signOneShot(algorithm, data, key, callback) {
data: keyData,
format: keyFormat,
type: keyType,
- passphrase: keyPassphrase
+ passphrase: keyPassphrase,
} = preparePrivateKey(key);
const job = new SignJob(
@@ -213,7 +213,7 @@ Verify.prototype.verify = function verify(options, signature, sigEncoding) {
data,
format,
type,
- passphrase
+ passphrase,
} = preparePublicOrPrivateKey(options, true);
sigEncoding = sigEncoding || getDefaultEncoding();
@@ -267,7 +267,7 @@ function verifyOneShot(algorithm, data, key, signature, callback) {
data: keyData,
format: keyFormat,
type: keyType,
- passphrase: keyPassphrase
+ passphrase: keyPassphrase,
} = preparePublicOrPrivateKey(key);
const job = new SignJob(
diff --git a/lib/internal/crypto/util.js b/lib/internal/crypto/util.js
index edd54c3ae9..1037d008ae 100644
--- a/lib/internal/crypto/util.js
+++ b/lib/internal/crypto/util.js
@@ -24,8 +24,8 @@ const { getOptionValue } = require('internal/options');
const {
crypto: {
- ENGINE_METHOD_ALL
- }
+ ENGINE_METHOD_ALL,
+ },
} = internalBinding('constants');
const normalizeHashName = require('internal/crypto/hashnames');
@@ -37,13 +37,13 @@ const {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
ERR_OUT_OF_RANGE,
- }
+ },
} = require('internal/errors');
const {
validateArray,
validateNumber,
- validateString
+ validateString,
} = require('internal/validators');
const { Buffer } = require('buffer');
diff --git a/lib/internal/crypto/webcrypto.js b/lib/internal/crypto/webcrypto.js
index d02fa67a36..52c68319e7 100644
--- a/lib/internal/crypto/webcrypto.js
+++ b/lib/internal/crypto/webcrypto.js
@@ -35,7 +35,7 @@ const {
ERR_ILLEGAL_CONSTRUCTOR,
ERR_INVALID_ARG_TYPE,
ERR_INVALID_THIS,
- }
+ },
} = require('internal/errors');
const {
@@ -789,7 +789,7 @@ ObjectDefineProperties(
configurable: true,
writable: true,
value: CryptoKey,
- }
+ },
});
ObjectDefineProperties(
@@ -884,7 +884,7 @@ ObjectDefineProperties(
configurable: true,
writable: true,
value: unwrapKey,
- }
+ },
});
module.exports = {
diff --git a/lib/internal/crypto/x509.js b/lib/internal/crypto/x509.js
index d08893d959..0e9d4e8750 100644
--- a/lib/internal/crypto/x509.js
+++ b/lib/internal/crypto/x509.js
@@ -44,7 +44,7 @@ const {
codes: {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
- }
+ },
} = require('internal/errors');
const {
@@ -125,7 +125,7 @@ class X509Certificate extends JSTransferable {
const opts = {
...options,
- depth: options.depth == null ? null : options.depth - 1
+ depth: options.depth == null ? null : options.depth - 1,
};
return `X509Certificate ${inspect({
@@ -147,7 +147,7 @@ class X509Certificate extends JSTransferable {
const handle = this[kHandle];
return {
data: { handle },
- deserializeInfo: 'internal/crypto/x509:InternalX509Certificate'
+ deserializeInfo: 'internal/crypto/x509:InternalX509Certificate',
};
}
diff --git a/lib/internal/dns/callback_resolver.js b/lib/internal/dns/callback_resolver.js
index 221cc9a76c..48e8f7df85 100644
--- a/lib/internal/dns/callback_resolver.js
+++ b/lib/internal/dns/callback_resolver.js
@@ -4,7 +4,7 @@ const {
ObjectDefineProperty,
ReflectApply,
ArrayPrototypeMap,
- Symbol
+ Symbol,
} = primordials;
const { toASCII } = require('internal/idna');
@@ -14,7 +14,7 @@ const {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
},
- dnsException
+ dnsException,
} = require('internal/errors');
const {
@@ -112,5 +112,5 @@ function resolve(hostname, rrtype, callback) {
}
module.exports = {
- Resolver
+ Resolver,
};
diff --git a/lib/internal/dns/promises.js b/lib/internal/dns/promises.js
index 78777752c9..494c7ecb24 100644
--- a/lib/internal/dns/promises.js
+++ b/lib/internal/dns/promises.js
@@ -52,7 +52,7 @@ const {
getnameinfo,
GetAddrInfoReqWrap,
GetNameInfoReqWrap,
- QueryReqWrap
+ QueryReqWrap,
} = internalBinding('cares_wrap');
const {
ERR_INVALID_ARG_TYPE,
@@ -103,7 +103,7 @@ function onlookupall(err, addresses) {
addresses[i] = {
address,
- family: family || isIP(addresses[i])
+ family: family || isIP(addresses[i]),
};
}
@@ -226,8 +226,8 @@ function createLookupServicePromise(hostname, port) {
name: 'lookupService',
detail: {
host: hostname,
- port
- }
+ port,
+ },
});
}
});
@@ -283,8 +283,8 @@ function createResolverPromise(resolver, bindingName, hostname, ttl) {
name: bindingName,
detail: {
host: hostname,
- ttl
- }
+ ttl,
+ },
});
}
});
diff --git a/lib/internal/dns/utils.js b/lib/internal/dns/utils.js
index 5d41c05526..e2b96011df 100644
--- a/lib/internal/dns/utils.js
+++ b/lib/internal/dns/utils.js
@@ -304,7 +304,7 @@ function createResolverClass(resolver) {
return {
resolveMap,
- Resolver
+ Resolver,
};
}
@@ -348,5 +348,5 @@ module.exports = {
setDefaultResultOrder,
errorCodes,
createResolverClass,
- initializeDns
+ initializeDns,
};
diff --git a/lib/internal/fs/cp/cp-sync.js b/lib/internal/fs/cp/cp-sync.js
index 88920bafe7..cfd54a4ff0 100644
--- a/lib/internal/fs/cp/cp-sync.js
+++ b/lib/internal/fs/cp/cp-sync.js
@@ -11,8 +11,8 @@ const {
EISDIR,
EINVAL,
ENOTDIR,
- }
- }
+ },
+ },
} = internalBinding('constants');
const {
ERR_FS_CP_DIR_TO_NON_DIR,
diff --git a/lib/internal/fs/cp/cp.js b/lib/internal/fs/cp/cp.js
index 0f49e8de4b..97378051cc 100644
--- a/lib/internal/fs/cp/cp.js
+++ b/lib/internal/fs/cp/cp.js
@@ -31,8 +31,8 @@ const {
EISDIR,
EINVAL,
ENOTDIR,
- }
- }
+ },
+ },
} = internalBinding('constants');
const {
chmod,
diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js
index 3540a752f5..bd4132fc4b 100644
--- a/lib/internal/http2/compat.js
+++ b/lib/internal/http2/compat.js
@@ -35,8 +35,8 @@ const {
HTTP_STATUS_EARLY_HINTS,
HTTP_STATUS_EXPECTATION_FAILED,
HTTP_STATUS_METHOD_NOT_ALLOWED,
- HTTP_STATUS_OK
- }
+ HTTP_STATUS_OK,
+ },
} = internalBinding('http2');
const {
codes: {
@@ -49,9 +49,9 @@ const {
ERR_HTTP2_STATUS_INVALID,
ERR_INVALID_ARG_VALUE,
ERR_INVALID_HTTP_TOKEN,
- ERR_STREAM_WRITE_AFTER_END
+ ERR_STREAM_WRITE_AFTER_END,
},
- hideStackFrames
+ hideStackFrames,
} = require('internal/errors');
const {
validateFunction,
@@ -64,7 +64,7 @@ const {
kRequest,
kProxySocket,
assertValidPseudoHeader,
- getAuthority
+ getAuthority,
} = require('internal/http2/util');
const { _checkIsHttpToken: checkIsHttpToken } = require('_http_common');
@@ -284,7 +284,7 @@ const proxySocketHandler = {
return true;
}
}
- }
+ },
};
function onStreamCloseRequest() {
@@ -832,7 +832,7 @@ class Http2ServerResponse extends Stream {
const options = {
endStream: state.ending,
waitForTrailers: true,
- sendDate: state.sendDate
+ sendDate: state.sendDate,
};
this[kStream].respond(headers, options);
}
@@ -843,7 +843,7 @@ class Http2ServerResponse extends Stream {
if (stream.headersSent || this[kState].closed)
return false;
stream.additionalHeaders({
- [HTTP2_HEADER_STATUS]: HTTP_STATUS_CONTINUE
+ [HTTP2_HEADER_STATUS]: HTTP_STATUS_CONTINUE,
});
return true;
}
diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js
index d18365efaa..c232d9c7ce 100644
--- a/lib/internal/http2/core.js
+++ b/lib/internal/http2/core.js
@@ -56,7 +56,7 @@ const { setImmediate, setTimeout, clearTimeout } = require('timers');
const {
kIncomingMessage,
- _checkIsHttpToken: checkIsHttpToken
+ _checkIsHttpToken: checkIsHttpToken,
} = require('_http_common');
const { kServerResponse } = require('_http_server');
const JSStreamSocket = require('internal/js_stream_socket');
@@ -114,10 +114,10 @@ const {
ERR_INVALID_CHAR,
ERR_INVALID_HTTP_TOKEN,
ERR_OUT_OF_RANGE,
- ERR_SOCKET_CLOSED
+ ERR_SOCKET_CLOSED,
},
hideStackFrames,
- AbortError
+ AbortError,
} = require('internal/errors');
const {
isUint32,
@@ -127,7 +127,7 @@ const {
validateNumber,
validateString,
validateUint32,
- validateAbortSignal
+ validateAbortSignal,
} = require('internal/validators');
const fsPromisesInternal = require('internal/fs/promises');
const { utcDate } = require('internal/http');
@@ -158,7 +158,7 @@ const {
sessionName,
toHeaderObject,
updateOptionsBuffer,
- updateSettingsBuffer
+ updateSettingsBuffer,
} = require('internal/http2/util');
const {
writeGeneric,
@@ -169,7 +169,7 @@ const {
kUpdateTimer,
kHandle,
kSession,
- setStreamTimeout
+ setStreamTimeout,
} = require('internal/stream_base_commons');
const { kTimeout } = require('internal/timers');
const { isArrayBufferView } = require('internal/util/types');
@@ -180,7 +180,7 @@ const binding = internalBinding('http2');
const {
ShutdownWrap,
kReadBytesOrError,
- streamBaseState
+ streamBaseState,
} = internalBinding('stream_wrap');
const { UV_EOF } = internalBinding('uv');
@@ -309,7 +309,7 @@ const {
HTTP_STATUS_MISDIRECTED_REQUEST,
STREAM_OPTION_EMPTY_PAYLOAD,
- STREAM_OPTION_GET_TRAILERS
+ STREAM_OPTION_GET_TRAILERS,
} = constants;
const STREAM_FLAGS_PENDING = 0x0;
@@ -913,7 +913,7 @@ const proxySocketHandler = {
return true;
}
}
- }
+ },
};
// pingCallback() returns a function that is invoked when an HTTP2 PING
@@ -1000,7 +1000,7 @@ function trackAssignmentsTypedArray(typedArray) {
modifiedEntries[prop] = 1;
}
return ReflectSet(obj, prop, value);
- }
+ },
});
}
@@ -1232,7 +1232,7 @@ class Http2Session extends EventEmitter {
pendingAck: 0,
shutdownWritableCalled: false,
writeQueueSize: 0,
- originSet: undefined
+ originSet: undefined,
};
this[kEncrypted] = undefined;
@@ -1406,7 +1406,7 @@ class Http2Session extends EventEmitter {
destroyed: this.destroyed,
state: this.state,
localSettings: this.localSettings,
- remoteSettings: this.remoteSettings
+ remoteSettings: this.remoteSettings,
};
return `Http2Session ${format(obj)}`;
}
@@ -1982,7 +1982,7 @@ class Http2Stream extends Duplex {
rstCode: NGHTTP2_NO_ERROR,
writeQueueSize: 0,
trailersReady: false,
- endAfterHeaders: false
+ endAfterHeaders: false,
};
// Fields used by the compat API to avoid megamorphisms.
@@ -2031,7 +2031,7 @@ class Http2Stream extends Duplex {
destroyed: this.destroyed,
state: this.state,
readableState: this._readableState,
- writableState: this._writableState
+ writableState: this._writableState,
};
return `Http2Stream ${format(obj)}`;
}
@@ -2540,7 +2540,7 @@ function doSendFD(session, options, fd, headers, streamOptions, err, stat) {
const statOptions = {
offset: options.offset !== undefined ? options.offset : 0,
- length: options.length !== undefined ? options.length : -1
+ length: options.length !== undefined ? options.length : -1,
};
// options.statCheck is a user-provided function that can be used to
@@ -2600,7 +2600,7 @@ function doSendFileFD(session, options, fd, headers, streamOptions, err, stat) {
const statOptions = {
offset: options.offset !== undefined ? options.offset : 0,
- length: options.length !== undefined ? options.length : -1
+ length: options.length !== undefined ? options.length : -1,
};
// options.statCheck is a user-provided function that can be used to
@@ -2979,7 +2979,7 @@ const setTimeoutValue = {
configurable: true,
enumerable: true,
writable: true,
- value: setStreamTimeout
+ value: setStreamTimeout,
};
ObjectDefineProperty(Http2Stream.prototype, 'setTimeout', setTimeoutValue);
ObjectDefineProperty(Http2Session.prototype, 'setTimeout', setTimeoutValue);
@@ -3316,7 +3316,7 @@ ObjectDefineProperty(connect, promisify.custom, {
return new Promise((resolve) => {
const server = connect(authority, options, () => resolve(server));
});
- }
+ },
});
function createSecureServer(options, handler) {
@@ -3413,7 +3413,7 @@ module.exports = {
Http2Stream,
ServerHttp2Session,
Http2ServerRequest,
- Http2ServerResponse
+ Http2ServerResponse,
};
/* eslint-enable no-use-before-define */
diff --git a/lib/internal/http2/util.js b/lib/internal/http2/util.js
index b1caa50c38..9c2f1d0664 100644
--- a/lib/internal/http2/util.js
+++ b/lib/internal/http2/util.js
@@ -27,7 +27,7 @@ const {
ERR_HTTP2_INVALID_PSEUDOHEADER,
ERR_HTTP2_INVALID_SETTING_VALUE,
ERR_INVALID_ARG_TYPE,
- ERR_INVALID_HTTP_TOKEN
+ ERR_INVALID_HTTP_TOKEN,
},
captureLargerStackTrace,
getMessage,
@@ -99,7 +99,7 @@ const {
HTTP2_METHOD_DELETE,
HTTP2_METHOD_GET,
- HTTP2_METHOD_HEAD
+ HTTP2_METHOD_HEAD,
} = binding.constants;
// This set is defined strictly by the HTTP/2 specification. Only
@@ -345,7 +345,7 @@ function getSettings(session, remote) {
maxHeaderListSize: settingsBuffer[IDX_SETTINGS_MAX_HEADER_LIST_SIZE],
maxHeaderSize: settingsBuffer[IDX_SETTINGS_MAX_HEADER_LIST_SIZE],
enableConnectProtocol:
- !!settingsBuffer[IDX_SETTINGS_ENABLE_CONNECT_PROTOCOL]
+ !!settingsBuffer[IDX_SETTINGS_ENABLE_CONNECT_PROTOCOL],
};
}
@@ -419,7 +419,7 @@ function getSessionState(session) {
deflateDynamicTableSize:
sessionState[IDX_SESSION_STATE_HD_DEFLATE_DYNAMIC_TABLE_SIZE],
inflateDynamicTableSize:
- sessionState[IDX_SESSION_STATE_HD_INFLATE_DYNAMIC_TABLE_SIZE]
+ sessionState[IDX_SESSION_STATE_HD_INFLATE_DYNAMIC_TABLE_SIZE],
};
}
@@ -431,7 +431,7 @@ function getStreamState(stream) {
sumDependencyWeight: streamState[IDX_STREAM_STATE_SUM_DEPENDENCY_WEIGHT],
localClose: streamState[IDX_STREAM_STATE_LOCAL_CLOSE],
remoteClose: streamState[IDX_STREAM_STATE_REMOTE_CLOSE],
- localWindowSize: streamState[IDX_STREAM_STATE_LOCAL_WINDOW_SIZE]
+ localWindowSize: streamState[IDX_STREAM_STATE_LOCAL_WINDOW_SIZE],
};
}
@@ -679,5 +679,5 @@ module.exports = {
sessionName,
toHeaderObject,
updateOptionsBuffer,
- updateSettingsBuffer
+ updateSettingsBuffer,
};
diff --git a/lib/internal/legacy/processbinding.js b/lib/internal/legacy/processbinding.js
index 3d48e3c988..4b15dd1c12 100644
--- a/lib/internal/legacy/processbinding.js
+++ b/lib/internal/legacy/processbinding.js
@@ -32,5 +32,5 @@ module.exports = {
'isAnyArrayBuffer',
], key);
})));
- }
+ },
};
diff --git a/lib/internal/main/check_syntax.js b/lib/internal/main/check_syntax.js
index 4aa0d217c2..2b7f4f1ff3 100644
--- a/lib/internal/main/check_syntax.js
+++ b/lib/internal/main/check_syntax.js
@@ -5,11 +5,11 @@
const {
prepareMainThreadExecution,
- markBootstrapComplete
+ markBootstrapComplete,
} = require('internal/process/pre_execution');
const {
- readStdin
+ readStdin,
} = require('internal/process/execution');
const { pathToFileURL } = require('url');
diff --git a/lib/internal/main/environment.js b/lib/internal/main/environment.js
index 0be982bfb6..cf8304e930 100644
--- a/lib/internal/main/environment.js
+++ b/lib/internal/main/environment.js
@@ -6,7 +6,7 @@
const {
prepareMainThreadExecution,
- markBootstrapComplete
+ markBootstrapComplete,
} = require('internal/process/pre_execution');
prepareMainThreadExecution();
diff --git a/lib/internal/main/eval_stdin.js b/lib/internal/main/eval_stdin.js
index 422e05c837..ac50f158b1 100644
--- a/lib/internal/main/eval_stdin.js
+++ b/lib/internal/main/eval_stdin.js
@@ -4,7 +4,7 @@
const {
prepareMainThreadExecution,
- markBootstrapComplete
+ markBootstrapComplete,
} = require('internal/process/pre_execution');
const { getOptionValue } = require('internal/options');
@@ -12,7 +12,7 @@ const { getOptionValue } = require('internal/options');
const {
evalModule,
evalScript,
- readStdin
+ readStdin,
} = require('internal/process/execution');
prepareMainThreadExecution();
diff --git a/lib/internal/main/eval_string.js b/lib/internal/main/eval_string.js
index d4787e151a..665408031a 100644
--- a/lib/internal/main/eval_string.js
+++ b/lib/internal/main/eval_string.js
@@ -9,7 +9,7 @@ const {
const {
prepareMainThreadExecution,
- markBootstrapComplete
+ markBootstrapComplete,
} = require('internal/process/pre_execution');
const { evalModule, evalScript } = require('internal/process/execution');
const { addBuiltinLibsToObject } = require('internal/modules/cjs/helpers');
diff --git a/lib/internal/main/inspect.js b/lib/internal/main/inspect.js
index 6c4cc7cc36..a60e4aa40b 100644
--- a/lib/internal/main/inspect.js
+++ b/lib/internal/main/inspect.js
@@ -4,7 +4,7 @@
const {
prepareMainThreadExecution,
- markBootstrapComplete
+ markBootstrapComplete,
} = require('internal/process/pre_execution');
prepareMainThreadExecution();
diff --git a/lib/internal/main/mksnapshot.js b/lib/internal/main/mksnapshot.js
index ac4a036cd1..a0a917c7ee 100644
--- a/lib/internal/main/mksnapshot.js
+++ b/lib/internal/main/mksnapshot.js
@@ -16,11 +16,11 @@ const {
} = binding;
const {
- getOptionValue
+ getOptionValue,
} = require('internal/options');
const {
- readFileSync
+ readFileSync,
} = require('fs');
const supportedModules = new SafeSet(new SafeArrayIterator([
@@ -116,7 +116,7 @@ function requireForUserSnapshot(id) {
function main() {
const {
- prepareMainThreadExecution
+ prepareMainThreadExecution,
} = require('internal/process/pre_execution');
prepareMainThreadExecution(true, false);
diff --git a/lib/internal/main/print_help.js b/lib/internal/main/print_help.js
index 4f07aedf1b..edb861668c 100644
--- a/lib/internal/main/print_help.js
+++ b/lib/internal/main/print_help.js
@@ -21,7 +21,7 @@ const hasCrypto = Boolean(process.versions.openssl);
const {
prepareMainThreadExecution,
- markBootstrapComplete
+ markBootstrapComplete,
} = require('internal/process/pre_execution');
const typeLookup = [];
@@ -134,7 +134,7 @@ function format(
);
for (const {
- 0: name, 1: { helpText, type, value, defaultIsTrue }
+ 0: name, 1: { helpText, type, value, defaultIsTrue },
} of sortedOptions) {
if (!helpText) continue;
@@ -190,7 +190,7 @@ function format(
options,
aliases,
firstColumn: maxFirstColumnUsed + 2,
- secondColumn
+ secondColumn,
});
}
@@ -214,13 +214,13 @@ function print(stream) {
' node inspect [options] [ script.js | host:port ] [arguments]\n\n' +
'Options:\n');
stream.write(indent(format({
- options, aliases, firstColumn, secondColumn
+ options, aliases, firstColumn, secondColumn,
}), 2));
stream.write('\nEnvironment variables:\n');
stream.write(format({
- options: envVars, firstColumn, secondColumn
+ options: envVars, firstColumn, secondColumn,
}));
stream.write('\nDocumentation can be found at https://nodejs.org/\n');
diff --git a/lib/internal/main/prof_process.js b/lib/internal/main/prof_process.js
index 3d56e3ec57..612e3b469d 100644
--- a/lib/internal/main/prof_process.js
+++ b/lib/internal/main/prof_process.js
@@ -2,7 +2,7 @@
const {
prepareMainThreadExecution,
- markBootstrapComplete
+ markBootstrapComplete,
} = require('internal/process/pre_execution');
prepareMainThreadExecution();
diff --git a/lib/internal/main/repl.js b/lib/internal/main/repl.js
index 34fe20b18a..444ae69cc5 100644
--- a/lib/internal/main/repl.js
+++ b/lib/internal/main/repl.js
@@ -5,11 +5,11 @@
const {
prepareMainThreadExecution,
- markBootstrapComplete
+ markBootstrapComplete,
} = require('internal/process/pre_execution');
const {
- evalScript
+ evalScript,
} = require('internal/process/execution');
const console = require('internal/console/global');
diff --git a/lib/internal/main/run_main_module.js b/lib/internal/main/run_main_module.js
index b7347c4d45..51331270a2 100644
--- a/lib/internal/main/run_main_module.js
+++ b/lib/internal/main/run_main_module.js
@@ -4,7 +4,7 @@ const { RegExpPrototypeExec } = primordials;
const {
prepareMainThreadExecution,
- markBootstrapComplete
+ markBootstrapComplete,
} = require('internal/process/pre_execution');
prepareMainThreadExecution(true);
diff --git a/lib/internal/main/test_runner.js b/lib/internal/main/test_runner.js
index 04a79343e0..134dadcf50 100644
--- a/lib/internal/main/test_runner.js
+++ b/lib/internal/main/test_runner.js
@@ -1,7 +1,7 @@
'use strict';
const {
prepareMainThreadExecution,
- markBootstrapComplete
+ markBootstrapComplete,
} = require('internal/process/pre_execution');
const { getOptionValue } = require('internal/options');
const { isUsingInspector } = require('internal/util/inspector');
diff --git a/lib/internal/main/watch_mode.js b/lib/internal/main/watch_mode.js
index 49864916df..09453e8902 100644
--- a/lib/internal/main/watch_mode.js
+++ b/lib/internal/main/watch_mode.js
@@ -10,7 +10,7 @@ const {
const {
prepareMainThreadExecution,
- markBootstrapComplete
+ markBootstrapComplete,
} = require('internal/process/pre_execution');
const { triggerUncaughtException } = internalBinding('errors');
const { getOptionValue } = require('internal/options');
diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js
index ea258e3764..7fbfb64984 100644
--- a/lib/internal/main/worker_thread.js
+++ b/lib/internal/main/worker_thread.js
@@ -19,12 +19,12 @@ const {
const {
prepareWorkerThreadExecution,
setupUserModules,
- markBootstrapComplete
+ markBootstrapComplete,
} = require('internal/process/pre_execution');
const {
threadId,
- getEnvMessagePort
+ getEnvMessagePort,
} = internalBinding('worker');
const workerIo = require('internal/worker/io');
@@ -40,11 +40,11 @@ const {
STDIO_PAYLOAD,
STDIO_WANTS_MORE_DATA,
},
- kStdioWantsMoreDataCallback
+ kStdioWantsMoreDataCallback,
} = workerIo;
const {
- onGlobalUncaughtException
+ onGlobalUncaughtException,
} = require('internal/process/execution');
let debug = require('internal/util/debuglog').debuglog('worker', (fn) => {
@@ -68,13 +68,13 @@ if (process.env.NODE_CHANNEL_FD) {
ObjectDefineProperty(process, 'channel', {
__proto__: null,
enumerable: false,
- get: workerThreadSetup.unavailable('process.channel')
+ get: workerThreadSetup.unavailable('process.channel'),
});
ObjectDefineProperty(process, 'connected', {
__proto__: null,
enumerable: false,
- get: workerThreadSetup.unavailable('process.connected')
+ get: workerThreadSetup.unavailable('process.connected'),
});
process.send = workerThreadSetup.unavailable('process.send()');
@@ -95,7 +95,7 @@ port.on('message', (message) => {
publicPort,
manifestSrc,
manifestURL,
- hasStdin
+ hasStdin,
} = message;
if (argv !== undefined) {
@@ -217,7 +217,7 @@ function workerOnGlobalUncaughtException(error, fromPromise) {
if (serialized)
port.postMessage({
type: ERROR_MESSAGE,
- error: serialized
+ error: serialized,
});
else
port.postMessage({ type: COULD_NOT_SERIALIZE_ERROR });
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index b6c5509311..31649227ed 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -72,7 +72,7 @@ const cjsParseCache = new SafeWeakMap();
// Set first due to cycle with ESM loader functions.
module.exports = {
wrapSafe, Module, toRealPath, readPackageScope, cjsParseCache,
- get hasLoadedAnyUserCJSModule() { return hasLoadedAnyUserCJSModule; }
+ get hasLoadedAnyUserCJSModule() { return hasLoadedAnyUserCJSModule; },
};
const { BuiltinModule } = require('internal/bootstrap/loaders');
@@ -143,7 +143,7 @@ const {
} = require('internal/constants');
const {
- isProxy
+ isProxy,
} = require('internal/util/types');
const asyncESM = require('internal/process/esm_loader');
@@ -152,7 +152,7 @@ const { kEvaluated } = internalBinding('module_wrap');
const {
encodedSepRegEx,
packageExportsResolve,
- packageImportsResolve
+ packageImportsResolve,
} = require('internal/modules/esm/resolve');
const isWindows = process.platform === 'win32';
@@ -286,7 +286,7 @@ let wrapperProxy = new Proxy(wrapper, {
defineProperty(target, property, descriptor) {
patched = true;
return ObjectDefineProperty(target, property, descriptor);
- }
+ },
});
ObjectDefineProperty(Module, 'wrap', {
@@ -298,7 +298,7 @@ ObjectDefineProperty(Module, 'wrap', {
set(value) {
patched = true;
wrap = value;
- }
+ },
});
ObjectDefineProperty(Module, 'wrapper', {
@@ -310,7 +310,7 @@ ObjectDefineProperty(Module, 'wrapper', {
set(value) {
patched = true;
wrapperProxy = value;
- }
+ },
});
const isPreloadingDesc = { get() { return isPreloading; } };
@@ -475,7 +475,7 @@ function tryFile(requestPath, isMain) {
function toRealPath(requestPath) {
return fs.realpathSync(requestPath, {
- [internalFS.realpathCacheKey]: realpathCache
+ [internalFS.realpathCacheKey]: realpathCache,
});
}
@@ -856,7 +856,7 @@ const CircularRequirePrototypeWarningProxy = new Proxy({}, {
return ObjectGetOwnPropertyDescriptor(target, prop);
emitCircularRequireWarning(prop);
return undefined;
- }
+ },
});
function getExportsForCircularRequire(module) {
diff --git a/lib/internal/modules/esm/initialize_import_meta.js b/lib/internal/modules/esm/initialize_import_meta.js
index 147eb0aa40..fe5ba4a3cc 100644
--- a/lib/internal/modules/esm/initialize_import_meta.js
+++ b/lib/internal/modules/esm/initialize_import_meta.js
@@ -37,5 +37,5 @@ function initializeImportMeta(meta, context) {
}
module.exports = {
- initializeImportMeta
+ initializeImportMeta,
};
diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js
index 7b6b67f339..98ddf3640e 100644
--- a/lib/internal/modules/esm/loader.js
+++ b/lib/internal/modules/esm/loader.js
@@ -49,7 +49,7 @@ const {
DEFAULT_CONDITIONS,
} = require('internal/modules/esm/resolve');
const {
- initializeImportMeta
+ initializeImportMeta,
} = require('internal/modules/esm/initialize_import_meta');
const { defaultLoad } = require('internal/modules/esm/load');
const { translators } = require(
@@ -379,7 +379,7 @@ class ESMLoader {
callbackMap.set(module, {
importModuleDynamically: (specifier, { url }, importAssertions) => {
return this.import(specifier, url, importAssertions);
- }
+ },
});
return module;
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
index f74b0b29bd..fd7d2feada 100644
--- a/lib/internal/modules/esm/resolve.js
+++ b/lib/internal/modules/esm/resolve.js
@@ -329,7 +329,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
if (!preserveSymlinks) {
const real = realpathSync(path, {
- [internalFS.realpathCacheKey]: realpathCache
+ [internalFS.realpathCacheKey]: realpathCache,
});
const { search, hash } = resolved;
resolved =
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
index 2df2228376..a425749e82 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -33,7 +33,7 @@ const {
} = require('internal/modules/cjs/helpers');
const {
Module: CJSModule,
- cjsParseCache
+ cjsParseCache,
} = require('internal/modules/cjs/loader');
const internalURLModule = require('internal/url');
const createDynamicModule = require(
@@ -45,7 +45,7 @@ let debug = require('internal/util/debuglog').debuglog('esm', (fn) => {
const { emitExperimentalWarning } = require('internal/util');
const {
ERR_UNKNOWN_BUILTIN_MODULE,
- ERR_INVALID_RETURN_PROPERTY_VALUE
+ ERR_INVALID_RETURN_PROPERTY_VALUE,
} = require('internal/errors').codes;
const { maybeCacheSourceMap } = require('internal/source_map/source_map_cache');
const moduleWrap = internalBinding('module_wrap');
@@ -299,7 +299,7 @@ translators.set('json', async function jsonStrategy(url, source) {
const exports = JSONParse(stripBOM(source));
module = {
exports,
- loaded: true
+ loaded: true,
};
} catch (err) {
// TODO (BridgeAR): We could add a NodeCore error that wraps the JSON
diff --git a/lib/internal/modules/esm/utils.js b/lib/internal/modules/esm/utils.js
new file mode 100644
index 0000000000..bf3edc8651
--- /dev/null
+++ b/lib/internal/modules/esm/utils.js
@@ -0,0 +1,105 @@
+'use strict';
+const {
+ ArrayIsArray,
+ SafeSet,
+ SafeWeakMap,
+ ObjectFreeze,
+} = primordials;
+
+const {
+ ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING,
+ ERR_INVALID_ARG_VALUE,
+} = require('internal/errors').codes;
+
+const { getOptionValue } = require('internal/options');
+
+const {
+ setImportModuleDynamicallyCallback,
+ setInitializeImportMetaObjectCallback,
+} = internalBinding('module_wrap');
+const {
+ getModuleFromWrap,
+} = require('internal/vm/module');
+const assert = require('internal/assert');
+
+const callbackMap = new SafeWeakMap();
+function setCallbackForWrap(wrap, data) {
+ callbackMap.set(wrap, data);
+}
+
+let defaultConditions;
+function getDefaultConditions() {
+ assert(defaultConditions !== undefined);
+ return defaultConditions;
+}
+
+let defaultConditionsSet;
+function getDefaultConditionsSet() {
+ assert(defaultConditionsSet !== undefined);
+ return defaultConditionsSet;
+}
+
+// This function is called during pre-execution, before any user code is run.
+function initializeDefaultConditions() {
+ const userConditions = getOptionValue('--conditions');
+ const noAddons = getOptionValue('--no-addons');
+ const addonConditions = noAddons ? [] : ['node-addons'];
+
+ defaultConditions = ObjectFreeze([
+ 'node',
+ 'import',
+ ...addonConditions,
+ ...userConditions,
+ ]);
+ defaultConditionsSet = new SafeSet(defaultConditions);
+}
+
+/**
+ * @param {string[]} [conditions]
+ * @returns {Set<string>}
+ */
+function getConditionsSet(conditions) {
+ if (conditions !== undefined && conditions !== getDefaultConditions()) {
+ if (!ArrayIsArray(conditions)) {
+ throw new ERR_INVALID_ARG_VALUE('conditions', conditions,
+ 'expected an array');
+ }
+ return new SafeSet(conditions);
+ }
+ return getDefaultConditionsSet();
+}
+
+function initializeImportMetaObject(wrap, meta) {
+ if (callbackMap.has(wrap)) {
+ const { initializeImportMeta } = callbackMap.get(wrap);
+ if (initializeImportMeta !== undefined) {
+ initializeImportMeta(meta, getModuleFromWrap(wrap) || wrap);
+ }
+ }
+}
+
+async function importModuleDynamicallyCallback(wrap, specifier, assertions) {
+ if (callbackMap.has(wrap)) {
+ const { importModuleDynamically } = callbackMap.get(wrap);
+ if (importModuleDynamically !== undefined) {
+ return importModuleDynamically(
+ specifier, getModuleFromWrap(wrap) || wrap, assertions);
+ }
+ }
+ throw new ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING();
+}
+
+function initializeESM() {
+ initializeDefaultConditions();
+ // Setup per-isolate callbacks that locate data or callbacks that we keep
+ // track of for different ESM modules.
+ setInitializeImportMetaObjectCallback(initializeImportMetaObject);
+ setImportModuleDynamicallyCallback(importModuleDynamicallyCallback);
+}
+
+module.exports = {
+ setCallbackForWrap,
+ initializeESM,
+ getDefaultConditions,
+ getConditionsSet,
+};
diff --git a/lib/internal/perf/performance.js b/lib/internal/perf/performance.js
index af318b59e6..130613c563 100644
--- a/lib/internal/perf/performance.js
+++ b/lib/internal/perf/performance.js
@@ -69,7 +69,7 @@ function toJSON() {
return {
nodeTiming: this.nodeTiming,
timeOrigin: this.timeOrigin,
- eventLoopUtilization: this.eventLoopUtilization()
+ eventLoopUtilization: this.eventLoopUtilization(),
};
}
@@ -198,7 +198,7 @@ ObjectDefineProperties(Performance.prototype, {
__proto__: null,
configurable: true,
enumerable: false,
- value: setResourceTimingBufferSize
+ value: setResourceTimingBufferSize,
},
timerify: {
__proto__: null,
@@ -221,7 +221,7 @@ ObjectDefineProperties(Performance.prototype, {
configurable: true,
enumerable: true,
value: toJSON,
- }
+ },
});
function refreshTimeOrigin() {
@@ -246,5 +246,5 @@ setDispatchBufferFull(dispatchBufferFull);
module.exports = {
Performance,
performance,
- refreshTimeOrigin
+ refreshTimeOrigin,
};
diff --git a/lib/internal/util/colors.js b/lib/internal/util/colors.js
index 79021a2bd9..e81a97ad87 100644
--- a/lib/internal/util/colors.js
+++ b/lib/internal/util/colors.js
@@ -19,7 +19,7 @@ module.exports = {
module.exports.clear = hasColors ? '\u001bc' : '';
module.exports.hasColors = hasColors;
}
- }
+ },
};
module.exports.refresh();
diff --git a/lib/internal/util/comparisons.js b/lib/internal/util/comparisons.js
index aa0973baa4..e771d90ea1 100644
--- a/lib/internal/util/comparisons.js
+++ b/lib/internal/util/comparisons.js
@@ -331,7 +331,7 @@ function keyCheck(val1, val2, strict, memos, iterationType, aKeys) {
memos = {
val1: new SafeMap(),
val2: new SafeMap(),
- position: 0
+ position: 0,
};
} else {
// We prevent up to two map.has(x) calls by directly retrieving the value
@@ -592,5 +592,5 @@ function isDeepStrictEqual(val1, val2) {
module.exports = {
isDeepEqual,
- isDeepStrictEqual
+ isDeepStrictEqual,
};
diff --git a/lib/internal/util/debuglog.js b/lib/internal/util/debuglog.js
index de39457db2..fd92b3b4b8 100644
--- a/lib/internal/util/debuglog.js
+++ b/lib/internal/util/debuglog.js
@@ -105,12 +105,12 @@ function debuglog(set, cb) {
return test();
},
configurable: true,
- enumerable: true
+ enumerable: true,
});
return logger;
}
module.exports = {
debuglog,
- initializeDebugEnv
+ initializeDebugEnv,
};
diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js
index 9a4267edc3..210662519c 100644
--- a/lib/internal/util/inspect.js
+++ b/lib/internal/util/inspect.js
@@ -115,11 +115,11 @@ const {
customInspectSymbol,
isError,
join,
- removeColors
+ removeColors,
} = require('internal/util');
const {
- isStackOverflowError
+ isStackOverflowError,
} = require('internal/errors');
const {
@@ -266,7 +266,7 @@ function getUserOptions(ctx, isCrossContext) {
sorted: ctx.sorted,
getters: ctx.getters,
numericSeparator: ctx.numericSeparator,
- ...ctx.userOptions
+ ...ctx.userOptions,
};
// Typically, the target value will be an instance of `Object`. If that is
@@ -374,7 +374,7 @@ ObjectDefineProperty(inspect, 'defaultOptions', {
set(options) {
validateObject(options, 'options');
return ObjectAssign(inspectDefaultOptions, options);
- }
+ },
});
// Set Graphics Rendition https://en.wikipedia.org/wiki/ANSI_escape_code#graphics
@@ -441,7 +441,7 @@ function defineColorAlias(target, alias) {
this[target] = value;
},
configurable: true,
- enumerable: false
+ enumerable: false,
});
}
@@ -473,7 +473,7 @@ inspect.styles = ObjectAssign(ObjectCreate(null), {
// "name": intentionally not styling
// TODO(BridgeAR): Highlight regular expressions properly.
regexp: 'red',
- module: 'underline'
+ module: 'underline',
});
function addQuotes(str, quotes) {
@@ -626,7 +626,7 @@ function getConstructorName(obj, ctx, recurseTimes, protoProps) {
return `${res} <${inspect(firstProto, {
...ctx,
customInspect: false,
- depth: -1
+ depth: -1,
})}>`;
}
@@ -2184,7 +2184,7 @@ function formatWithOptionsInternal(inspectOptions, args) {
...inspectOptions,
compact: 3,
colors: false,
- depth: 0
+ depth: 0,
});
}
break;
@@ -2211,7 +2211,7 @@ function formatWithOptionsInternal(inspectOptions, args) {
...inspectOptions,
showHidden: true,
showProxy: true,
- depth: 4
+ depth: 4,
});
break;
case 105: { // 'i'
diff --git a/lib/internal/util/inspector.js b/lib/internal/util/inspector.js
index 99d23d8647..f5cba165fc 100644
--- a/lib/internal/util/inspector.js
+++ b/lib/internal/util/inspector.js
@@ -91,7 +91,7 @@ function wrapConsole(consoleFromNode) {
);
ObjectDefineProperty(consoleFromNode[key], 'name', {
__proto__: null,
- value: key
+ value: key,
});
} else {
// Add additional console APIs from the inspector
diff --git a/lib/internal/util/iterable_weak_map.js b/lib/internal/util/iterable_weak_map.js
index 67e51ec861..16694ffdb1 100644
--- a/lib/internal/util/iterable_weak_map.js
+++ b/lib/internal/util/iterable_weak_map.js
@@ -30,7 +30,7 @@ class IterableWeakMap {
this.#refSet.add(ref);
this.#finalizationGroup.register(key, {
set: this.#refSet,
- ref
+ ref,
}, ref);
}
}
diff --git a/lib/internal/util/types.js b/lib/internal/util/types.js
index 544f4c3da4..e40700b38f 100644
--- a/lib/internal/util/types.js
+++ b/lib/internal/util/types.js
@@ -89,7 +89,7 @@ ObjectDefineProperties(module.exports, {
}
return isKeyObject(obj);
- }
+ },
},
isCryptoKey: {
__proto__: null,
@@ -105,6 +105,6 @@ ObjectDefineProperties(module.exports, {
}
return isCryptoKey(obj);
- }
- }
+ },
+ },
});
diff --git a/lib/internal/v8/startup_snapshot.js b/lib/internal/v8/startup_snapshot.js
index 655cc1903e..3f51ae5d0f 100644
--- a/lib/internal/v8/startup_snapshot.js
+++ b/lib/internal/v8/startup_snapshot.js
@@ -5,7 +5,7 @@ const {
} = require('internal/validators');
const {
ERR_NOT_BUILDING_SNAPSHOT,
- ERR_DUPLICATE_STARTUP_SNAPSHOT_MAIN_FUNCTION
+ ERR_DUPLICATE_STARTUP_SNAPSHOT_MAIN_FUNCTION,
} = require('internal/errors');
const {
@@ -85,7 +85,7 @@ function setDeserializeMainFunction(callback, data) {
_setDeserializeMainFunction(function deserializeMain() {
const {
prepareMainThreadExecution,
- markBootstrapComplete
+ markBootstrapComplete,
} = require('internal/process/pre_execution');
// This should be in sync with run_main_module.js until we make that
@@ -104,6 +104,6 @@ module.exports = {
addDeserializeCallback,
addSerializeCallback,
setDeserializeMainFunction,
- isBuildingSnapshot
- }
+ isBuildingSnapshot,
+ },
};
diff --git a/lib/internal/vm/module.js b/lib/internal/vm/module.js
index ff70c51fe7..109b2d7e5b 100644
--- a/lib/internal/vm/module.js
+++ b/lib/internal/vm/module.js
@@ -243,7 +243,7 @@ class Module {
ObjectDefineProperty(o, SymbolToStringTag, {
__proto__: null,
value: constructor.name,
- configurable: true
+ configurable: true,
});
// Lazy to avoid circular dependency
diff --git a/lib/internal/worker/io.js b/lib/internal/worker/io.js
index 61f9a53637..4e32422a5e 100644
--- a/lib/internal/worker/io.js
+++ b/lib/internal/worker/io.js
@@ -27,7 +27,7 @@ const {
const {
handle_onclose: handleOnCloseSymbol,
oninit: onInitSymbol,
- no_message_symbol: noMessageSymbol
+ no_message_symbol: noMessageSymbol,
} = internalBinding('symbols');
const {
MessagePort,
@@ -41,7 +41,7 @@ const {
DOMException,
} = internalBinding('messaging');
const {
- getEnvMessagePort
+ getEnvMessagePort,
} = internalBinding('worker');
const { Readable, Writable } = require('stream');
@@ -61,7 +61,7 @@ const {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_THIS,
ERR_MISSING_ARGS,
- }
+ },
} = require('internal/errors');
const kData = Symbol('kData');
@@ -89,7 +89,7 @@ const messageTypes = {
ERROR_MESSAGE: 'errorMessage',
STDIO_PAYLOAD: 'stdioPayload',
STDIO_WANTS_MORE_DATA: 'stdioWantsMoreData',
- LOAD_SCRIPT: 'loadScript'
+ LOAD_SCRIPT: 'loadScript',
};
// We have to mess with the MessagePort prototype a bit, so that a) we can make
@@ -240,7 +240,7 @@ ObjectDefineProperty(MessagePort.prototype, onInitSymbol, {
__proto__: null,
enumerable: true,
writable: false,
- value: oninit
+ value: oninit,
});
class MessagePortCloseEvent extends Event {
@@ -258,7 +258,7 @@ ObjectDefineProperty(MessagePort.prototype, handleOnCloseSymbol, {
__proto__: null,
enumerable: false,
writable: false,
- value: onclose
+ value: onclose,
});
MessagePort.prototype.close = function(cb) {
@@ -283,10 +283,10 @@ ObjectDefineProperty(MessagePort.prototype, inspect.custom, {
active: false,
} : {
active: true,
- refed: ref
+ refed: ref,
},
this);
- }
+ },
});
function setupPortReferencing(port, eventEmitter, eventName) {
@@ -352,7 +352,7 @@ class ReadableWorkerStdio extends Readable {
this[kPort].postMessage({
type: messageTypes.STDIO_WANTS_MORE_DATA,
- stream: this[kName]
+ stream: this[kName],
});
}
}
@@ -381,7 +381,7 @@ class WritableWorkerStdio extends Writable {
this[kPort].postMessage({
type: messageTypes.STDIO_PAYLOAD,
stream: this[kName],
- chunks: [ { chunk: null, encoding: '' } ]
+ chunks: [ { chunk: null, encoding: '' } ],
});
cb();
}
@@ -401,7 +401,7 @@ function createWorkerStdio() {
return {
stdin: new ReadableWorkerStdio(port, 'stdin'),
stdout: new WritableWorkerStdio(port, 'stdout'),
- stderr: new WritableWorkerStdio(port, 'stderr')
+ stderr: new WritableWorkerStdio(port, 'stderr'),
};
}
@@ -445,7 +445,7 @@ class BroadcastChannel extends EventTarget {
const opts = {
...options,
- depth: options.depth == null ? null : options.depth - 1
+ depth: options.depth == null ? null : options.depth - 1,
};
return `BroadcastChannel ${inspect({
diff --git a/lib/internal/worker/js_transferable.js b/lib/internal/worker/js_transferable.js
index a94893cfe7..41ef278b33 100644
--- a/lib/internal/worker/js_transferable.js
+++ b/lib/internal/worker/js_transferable.js
@@ -13,11 +13,11 @@ const {
messaging_deserialize_symbol,
messaging_transfer_symbol,
messaging_clone_symbol,
- messaging_transfer_list_symbol
+ messaging_transfer_list_symbol,
} = internalBinding('symbols');
const {
JSTransferable,
- setDeserializerCreateObjectFunction
+ setDeserializerCreateObjectFunction,
} = internalBinding('messaging');
function setup() {