| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -51,14 +51,13 @@ const { | |||
| 51 | 51 | } = primordials; | |
| 52 | 52 | const kRejection = SymbolFor('nodejs.rejection'); | |
| 53 | 53 | ||
| 54 | - const { SymbolDispose, kEmptyObject } = require('internal/util'); | ||
| 54 | + const { SymbolDispose, kEmptyObject, spliceOne } = require('internal/util'); | ||
| 55 | 55 | ||
| 56 | 56 | const { | |
| 57 | 57 | inspect, | |
| 58 | 58 | identicalSequenceRange, | |
| 59 | 59 | } = require('internal/util/inspect'); | |
| 60 | 60 | ||
| 61 | - let spliceOne; | ||
| 62 | 61 | let FixedQueue; | |
| 63 | 62 | let kFirstEventParam; | |
| 64 | 63 | let kResistStopPropagation; | |
@@ -717,8 +716,6 @@ EventEmitter.prototype.removeListener = | |||
| 717 | 716 | if (position === 0) | |
| 718 | 717 | list.shift(); | |
| 719 | 718 | else { | |
| 720 | - if (spliceOne === undefined) | ||
| 721 | - spliceOne = require('internal/util').spliceOne; | ||
| 722 | 719 | spliceOne(list, position); | |
| 723 | 720 | } | |
| 724 | 721 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -68,10 +68,10 @@ const { | |||
| 68 | 68 | kDeserialize, | |
| 69 | 69 | kTransfer, | |
| 70 | 70 | kTransferList, | |
| 71 | + markTransferMode, | ||
| 71 | 72 | } = require('internal/worker/js_transferable'); | |
| 72 | 73 | ||
| 73 | 74 | let _MessageChannel; | |
| 74 | - let markTransferMode; | ||
| 75 | 75 | ||
| 76 | 76 | const kDontThrowSymbol = Symbol('kDontThrowSymbol'); | |
| 77 | 77 | ||
@@ -84,12 +84,6 @@ function lazyMessageChannel() { | |||
| 84 | 84 | return new _MessageChannel(); | |
| 85 | 85 | } | |
| 86 | 86 | ||
| 87 | - function lazyMarkTransferMode(obj, cloneable, transferable) { | ||
| 88 | - markTransferMode ??= | ||
| 89 | - require('internal/worker/js_transferable').markTransferMode; | ||
| 90 | - markTransferMode(obj, cloneable, transferable); | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | 87 | const clearTimeoutRegistry = new SafeFinalizationRegistry(clearTimeout); | |
| 94 | 88 | const gcPersistentSignals = new SafeSet(); | |
| 95 | 89 | ||
@@ -170,7 +164,7 @@ class AbortSignal extends EventTarget { | |||
| 170 | 164 | this[kReason] = reason; | |
| 171 | 165 | this[kComposite] = composite; | |
| 172 | 166 | if (transferable) { | |
| 173 | - lazyMarkTransferMode(this, false, true); | ||
| 167 | + markTransferMode(this, false, true); | ||
| 174 | 168 | } | |
| 175 | 169 | } | |
| 176 | 170 | ||
@@ -455,7 +449,7 @@ class AbortController { | |||
| 455 | 449 | function transferableAbortSignal(signal) { | |
| 456 | 450 | if (signal?.[kAborted] === undefined) | |
| 457 | 451 | throw new ERR_INVALID_ARG_TYPE('signal', 'AbortSignal', signal); | |
| 458 | - lazyMarkTransferMode(signal, false, true); | ||
| 452 | + markTransferMode(signal, false, true); | ||
| 459 | 453 | return signal; | |
| 460 | 454 | } | |
| 461 | 455 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,6 +33,7 @@ const { | |||
| 33 | 33 | parseFileMode, | |
| 34 | 34 | validateArray, | |
| 35 | 35 | validateString, | |
| 36 | + validateUint32, | ||
| 36 | 37 | } = require('internal/validators'); | |
| 37 | 38 | ||
| 38 | 39 | function wrapPosixCredentialSetters(credentials) { | |
@@ -42,9 +43,6 @@ function wrapPosixCredentialSetters(credentials) { | |||
| 42 | 43 | ERR_UNKNOWN_CREDENTIAL, | |
| 43 | 44 | }, | |
| 44 | 45 | } = require('internal/errors'); | |
| 45 | - const { | ||
| 46 | - validateUint32, | ||
| 47 | - } = require('internal/validators'); | ||
| 48 | 46 | ||
| 49 | 47 | const { | |
| 50 | 48 | initgroups: _initgroups, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,6 +48,8 @@ const { setupMainThreadPort } = require('internal/worker/messaging'); | |||
| 48 | 48 | ||
| 49 | 49 | const { | |
| 50 | 50 | onGlobalUncaughtException, | |
| 51 | + evalScript, | ||
| 52 | + evalModuleEntryPoint, | ||
| 51 | 53 | } = require('internal/process/execution'); | |
| 52 | 54 | ||
| 53 | 55 | let debug = require('internal/util/debuglog').debuglog('worker', (fn) => { | |
@@ -154,7 +156,6 @@ port.on('message', (message) => { | |||
| 154 | 156 | } | |
| 155 | 157 | ||
| 156 | 158 | case 'classic': if (getOptionValue('--input-type') !== 'module') { | |
| 157 | - const { evalScript } = require('internal/process/execution'); | ||
| 158 | 159 | const name = '[worker eval]'; | |
| 159 | 160 | // This is necessary for CJS module compilation. | |
| 160 | 161 | // TODO: pass this with something really internal. | |
@@ -171,7 +172,6 @@ port.on('message', (message) => { | |||
| 171 | 172 | ||
| 172 | 173 | // eslint-disable-next-line no-fallthrough | |
| 173 | 174 | case 'module': { | |
| 174 | - const { evalModuleEntryPoint } = require('internal/process/execution'); | ||
| 175 | 175 | PromisePrototypeThen(evalModuleEntryPoint(filename), undefined, (e) => { | |
| 176 | 176 | workerOnGlobalUncaughtException(e, true); | |
| 177 | 177 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -152,6 +152,7 @@ const { | |||
| 152 | 152 | setHasStartedUserCJSExecution, | |
| 153 | 153 | stripBOM, | |
| 154 | 154 | toRealPath, | |
| 155 | + stripTypeScriptTypes, | ||
| 155 | 156 | } = require('internal/modules/helpers'); | |
| 156 | 157 | const packageJsonReader = require('internal/modules/package_json_reader'); | |
| 157 | 158 | const { getOptionValue, getEmbedderOptions } = require('internal/options'); | |
@@ -1362,7 +1363,6 @@ function loadESMFromCJS(mod, filename) { | |||
| 1362 | 1363 | if (isUnderNodeModules(filename)) { | |
| 1363 | 1364 | throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING(filename); | |
| 1364 | 1365 | } | |
| 1365 | - const { stripTypeScriptTypes } = require('internal/modules/helpers'); | ||
| 1366 | 1366 | source = stripTypeScriptTypes(source, filename); | |
| 1367 | 1367 | } | |
| 1368 | 1368 | const cascadedLoader = require('internal/modules/esm/loader').getOrInitializeCascadedLoader(); | |
@@ -1576,7 +1576,6 @@ function loadCTS(module, filename) { | |||
| 1576 | 1576 | throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING(filename); | |
| 1577 | 1577 | } | |
| 1578 | 1578 | const source = getMaybeCachedSource(module, filename); | |
| 1579 | - const { stripTypeScriptTypes } = require('internal/modules/helpers'); | ||
| 1580 | 1579 | const code = stripTypeScriptTypes(source, filename); | |
| 1581 | 1580 | module._compile(code, filename, 'commonjs'); | |
| 1582 | 1581 | } | |
@@ -1592,7 +1591,6 @@ function loadTS(module, filename) { | |||
| 1592 | 1591 | } | |
| 1593 | 1592 | // If already analyzed the source, then it will be cached. | |
| 1594 | 1593 | const source = getMaybeCachedSource(module, filename); | |
| 1595 | - const { stripTypeScriptTypes } = require('internal/modules/helpers'); | ||
| 1596 | 1594 | const content = stripTypeScriptTypes(source, filename); | |
| 1597 | 1595 | let format; | |
| 1598 | 1596 | const pkg = packageJsonReader.getNearestParentPackageJSON(filename); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,6 +34,7 @@ const { kEmptyObject } = require('internal/util'); | |||
| 34 | 34 | const { | |
| 35 | 35 | compileSourceTextModule, | |
| 36 | 36 | getDefaultConditions, | |
| 37 | + forceDefaultLoader, | ||
| 37 | 38 | } = require('internal/modules/esm/utils'); | |
| 38 | 39 | const { kImplicitTypeAttribute } = require('internal/modules/esm/assert'); | |
| 39 | 40 | const { ModuleWrap, kEvaluating, kEvaluated } = internalBinding('module_wrap'); | |
@@ -798,7 +799,7 @@ function createModuleLoader() { | |||
| 798 | 799 | // Don't spawn a new worker if custom loaders are disabled. For instance, if | |
| 799 | 800 | // we're already in a worker thread created by instantiating | |
| 800 | 801 | // CustomizedModuleLoader; doing so would cause an infinite loop. | |
| 801 | - if (!require('internal/modules/esm/utils').forceDefaultLoader()) { | ||
| 802 | + if (!forceDefaultLoader()) { | ||
| 802 | 803 | const userLoaderPaths = getOptionValue('--experimental-loader'); | |
| 803 | 804 | if (userLoaderPaths.length > 0) { | |
| 804 | 805 | if (!emittedLoaderFlagWarning) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -237,7 +237,6 @@ function finalizeResolution(resolved, base, preserveSymlinks) { | |||
| 237 | 237 | try { | |
| 238 | 238 | path = fileURLToPath(resolved); | |
| 239 | 239 | } catch (err) { | |
| 240 | - const { setOwnProperty } = require('internal/util'); | ||
| 241 | 240 | setOwnProperty(err, 'input', `${resolved}`); | |
| 242 | 241 | setOwnProperty(err, 'module', `${base}`); | |
| 243 | 242 | throw err; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,6 +33,7 @@ const { | |||
| 33 | 33 | emitExperimentalWarning, | |
| 34 | 34 | SymbolAsyncDispose, | |
| 35 | 35 | SymbolDispose, | |
| 36 | + deprecate, | ||
| 36 | 37 | } = require('internal/util'); | |
| 37 | 38 | ||
| 38 | 39 | const { | |
@@ -47,6 +48,7 @@ const { | |||
| 47 | 48 | addSerializeCallback, | |
| 48 | 49 | isBuildingSnapshot, | |
| 49 | 50 | }, | |
| 51 | + runDeserializeCallbacks, | ||
| 50 | 52 | } = require('internal/v8/startup_snapshot'); | |
| 51 | 53 | ||
| 52 | 54 | function prepareMainThreadExecution(expandArgv1 = false, initializeModules = true) { | |
@@ -147,7 +149,7 @@ function prepareExecution(options) { | |||
| 147 | 149 | initializeClusterIPC(); | |
| 148 | 150 | ||
| 149 | 151 | // TODO(joyeecheung): do this for worker threads as well. | |
| 150 | - require('internal/v8/startup_snapshot').runDeserializeCallbacks(); | ||
| 152 | + runDeserializeCallbacks(); | ||
| 151 | 153 | } else { | |
| 152 | 154 | assert(!internalBinding('worker').isMainThread); | |
| 153 | 155 | // The setup should be called in LOAD_SCRIPT message handler. | |
@@ -524,7 +526,6 @@ function setupNetworkInspection() { | |||
| 524 | 526 | // this is used to deprecate APIs implemented in C++ where the deprecation | |
| 525 | 527 | // utilities are not easily accessible. | |
| 526 | 528 | function initializeDeprecations() { | |
| 527 | - const { deprecate } = require('internal/util'); | ||
| 528 | 529 | const pendingDeprecation = getOptionValue('--pending-deprecation'); | |
| 529 | 530 | ||
| 530 | 531 | // DEP0103: access to `process.binding('util').isX` type checkers | |
@@ -586,8 +587,6 @@ function initializeDeprecations() { | |||
| 586 | 587 | ||
| 587 | 588 | function setupChildProcessIpcChannel() { | |
| 588 | 589 | if (process.env.NODE_CHANNEL_FD) { | |
| 589 | - const assert = require('internal/assert'); | ||
| 590 | - | ||
| 591 | 590 | const fd = NumberParseInt(process.env.NODE_CHANNEL_FD, 10); | |
| 592 | 591 | assert(fd >= 0); | |
| 593 | 592 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,7 +26,6 @@ const { validateString } = require('internal/validators'); | |||
| 26 | 26 | let fs; | |
| 27 | 27 | let fd; | |
| 28 | 28 | let warningFile; | |
| 29 | - let options; | ||
| 30 | 29 | let traceWarningHelperShown = false; | |
| 31 | 30 | ||
| 32 | 31 | function resetForSerialization() { | |
@@ -42,15 +41,9 @@ function lazyOption() { | |||
| 42 | 41 | // This will load `warningFile` only once. If the flag is not set, | |
| 43 | 42 | // `warningFile` will be set to an empty string. | |
| 44 | 43 | if (warningFile === undefined) { | |
| 45 | - options = require('internal/options'); | ||
| 46 | - if (options.getOptionValue('--diagnostic-dir') !== '') { | ||
| 47 | - warningFile = options.getOptionValue('--diagnostic-dir'); | ||
| 48 | - } | ||
| 49 | - if (options.getOptionValue('--redirect-warnings') !== '') { | ||
| 50 | - warningFile = options.getOptionValue('--redirect-warnings'); | ||
| 51 | - } else { | ||
| 52 | - warningFile = ''; | ||
| 53 | - } | ||
| 44 | + const diagnosticDir = getOptionValue('--diagnostic-dir'); | ||
| 45 | + const redirectWarnings = getOptionValue('--redirect-warnings'); | ||
| 46 | + warningFile = diagnosticDir || redirectWarnings || ''; | ||
| 54 | 47 | } | |
| 55 | 48 | return warningFile; | |
| 56 | 49 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,6 +20,7 @@ const { | |||
| 20 | 20 | setSourceMapsEnabled: setSourceMapsNative, | |
| 21 | 21 | } = internalBinding('errors'); | |
| 22 | 22 | const { | |
| 23 | + defaultPrepareStackTrace, | ||
| 23 | 24 | setInternalPrepareStackTrace, | |
| 24 | 25 | } = require('internal/errors'); | |
| 25 | 26 | const { getLazy } = require('internal/util'); | |
@@ -64,9 +65,6 @@ function setSourceMapsEnabled(val) { | |||
| 64 | 65 | setInternalPrepareStackTrace(prepareStackTraceWithSourceMaps); | |
| 65 | 66 | } else if (sourceMapsEnabled !== undefined) { | |
| 66 | 67 | // Reset prepare stack trace callback only when disabling source maps. | |
| 67 | - const { | ||
| 68 | - defaultPrepareStackTrace, | ||
| 69 | - } = require('internal/errors'); | ||
| 70 | 68 | setInternalPrepareStackTrace(defaultPrepareStackTrace); | |
| 71 | 69 | } | |
| 72 | 70 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments