mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
lib, tools: remove duplicate requires
PR-URL: https://github.com/nodejs/node/pull/54987 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
parent
c6d20a034d
commit
5c22d19f44
12 changed files with 20 additions and 43 deletions
|
@ -152,6 +152,7 @@ const {
|
|||
setHasStartedUserCJSExecution,
|
||||
stripBOM,
|
||||
toRealPath,
|
||||
stripTypeScriptTypes,
|
||||
} = require('internal/modules/helpers');
|
||||
const packageJsonReader = require('internal/modules/package_json_reader');
|
||||
const { getOptionValue, getEmbedderOptions } = require('internal/options');
|
||||
|
@ -1373,7 +1374,6 @@ function loadESMFromCJS(mod, filename) {
|
|||
if (isUnderNodeModules(filename)) {
|
||||
throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING(filename);
|
||||
}
|
||||
const { stripTypeScriptTypes } = require('internal/modules/helpers');
|
||||
source = stripTypeScriptTypes(source, filename);
|
||||
}
|
||||
const cascadedLoader = require('internal/modules/esm/loader').getOrInitializeCascadedLoader();
|
||||
|
@ -1587,7 +1587,6 @@ function loadCTS(module, filename) {
|
|||
throw new ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING(filename);
|
||||
}
|
||||
const source = getMaybeCachedSource(module, filename);
|
||||
const { stripTypeScriptTypes } = require('internal/modules/helpers');
|
||||
const code = stripTypeScriptTypes(source, filename);
|
||||
module._compile(code, filename, 'commonjs');
|
||||
}
|
||||
|
@ -1603,7 +1602,6 @@ function loadTS(module, filename) {
|
|||
}
|
||||
// If already analyzed the source, then it will be cached.
|
||||
const source = getMaybeCachedSource(module, filename);
|
||||
const { stripTypeScriptTypes } = require('internal/modules/helpers');
|
||||
const content = stripTypeScriptTypes(source, filename);
|
||||
let format;
|
||||
const pkg = packageJsonReader.getNearestParentPackageJSON(filename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue