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 <webadmin@geoffreybooth.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
  • 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
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
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
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
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
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
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
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
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.