Skip to content

Commit

Permalink
modules: move modules/cjs/helpers.js to modules/helpers.js
Browse files Browse the repository at this point in the history
The helpers are actually shared by the two loaders, so move them
under modules/ directly.

PR-URL: #45849
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
  • Loading branch information
joyeecheung authored and targos committed Jan 1, 2023
1 parent 508e830 commit c6ab449
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/internal/main/eval_string.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
markBootstrapComplete
} = require('internal/process/pre_execution');
const { evalModule, evalScript } = require('internal/process/execution');
const { addBuiltinLibsToObject } = require('internal/modules/cjs/helpers');
const { addBuiltinLibsToObject } = require('internal/modules/helpers');

const { getOptionValue } = require('internal/options');

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const {
makeRequireFunction,
normalizeReferrerURL,
stripBOM,
} = require('internal/modules/cjs/helpers');
} = require('internal/modules/helpers');
const { getOptionValue } = require('internal/options');
const preserveSymlinks = getOptionValue('--preserve-symlinks');
const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/esm/translators.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const {
hasEsmSyntax,
loadBuiltinModule,
stripBOM,
} = require('internal/modules/cjs/helpers');
} = require('internal/modules/helpers');
const {
Module: CJSModule,
cjsParseCache
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/internal/source_map/source_map_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const { getOptionValue } = require('internal/options');
const { IterableWeakMap } = require('internal/util/iterable_weak_map');
const {
normalizeReferrerURL,
} = require('internal/modules/cjs/helpers');
} = require('internal/modules/helpers');
const { validateBoolean } = require('internal/validators');
const { setMaybeCacheGeneratedSourceMap } = internalBinding('errors');

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/util/inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function installConsoleExtensions(commandLineApi) {
if (commandLineApi.require) { return; }
const { tryGetCwd } = require('internal/process/execution');
const CJSModule = require('internal/modules/cjs/loader').Module;
const { makeRequireFunction } = require('internal/modules/cjs/helpers');
const { makeRequireFunction } = require('internal/modules/helpers');
const consoleAPIModule = new CJSModule('<inspector console>');
const cwd = tryGetCwd();
consoleAPIModule.paths = ArrayPrototypeConcat(
Expand Down
2 changes: 1 addition & 1 deletion lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const { BuiltinModule } = require('internal/bootstrap/loaders');
const {
makeRequireFunction,
addBuiltinLibsToObject
} = require('internal/modules/cjs/helpers');
} = require('internal/modules/helpers');
const {
isIdentifierStart,
isIdentifierChar
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-bootstrap-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const expectedModules = new Set([
'NativeModule internal/fs/utils',
'NativeModule internal/idna',
'NativeModule internal/linkedlist',
'NativeModule internal/modules/cjs/helpers',
'NativeModule internal/modules/helpers',
'NativeModule internal/modules/cjs/loader',
'NativeModule internal/modules/esm/assert',
'NativeModule internal/modules/esm/formats',
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2832,7 +2832,7 @@ assert.strictEqual(
' at Function.Module._load (node:internal/modules/cjs/loader:621:3)',
// This file is not an actual Node.js core file.
' at Module.require [as weird/name] (node:internal/aaaaa/loader:735:19)',
' at require (node:internal/modules/cjs/helpers:14:16)',
' at require (node:internal/modules/helpers:14:16)',
' at Array.forEach (<anonymous>)',
` at ${process.cwd()}/test/parallel/test-util-inspect.js:2760:12`,
` at Object.<anonymous> (${process.cwd()}/node_modules/hyper_module/folder/file.js:2753:10)`,
Expand Down

0 comments on commit c6ab449

Please sign in to comment.