Skip to content

Commit

Permalink
module: 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: nodejs/node#45849
Backport-PR-URL: nodejs/node#46425
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
  • Loading branch information
sercher committed Apr 24, 2024
1 parent 4a03486 commit 1d98201
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion graal-nodejs/lib/internal/main/eval_string.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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 graal-nodejs/lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,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 graal-nodejs/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
2 changes: 1 addition & 1 deletion graal-nodejs/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 graal-nodejs/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 = [];
Expand Down
2 changes: 1 addition & 1 deletion graal-nodejs/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 graal-nodejs/test/parallel/test-bootstrap-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const expectedModules = new Set([
'NativeModule internal/graal/buffer',
'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 graal-nodejs/test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2829,7 +2829,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 1d98201

Please sign in to comment.