Skip to content

Commit 41c762e

Browse files
committed
fixup! src,lib: reducing C++ calls of esm legacy main resolve
Backport-PR-URL: nodejs#48325
1 parent 9bfc75e commit 41c762e

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

lib/internal/modules/esm/resolve.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ const experimentalNetworkImports =
4444
getOptionValue('--experimental-network-imports');
4545
const typeFlag = getOptionValue('--input-type');
4646
const { URL, pathToFileURL, fileURLToPath, isURL } = require('internal/url');
47-
const { canParse: URLCanParse } = internalBinding('url');
4847
const { legacyMainResolve: FSLegacyMainResolve } = internalBinding('fs');
4948
const {
5049
ERR_INPUT_TYPE_NOT_ALLOWED,
@@ -58,6 +57,7 @@ const {
5857
ERR_PACKAGE_PATH_NOT_EXPORTED,
5958
ERR_UNSUPPORTED_DIR_IMPORT,
6059
ERR_NETWORK_IMPORT_DISALLOWED,
60+
ERR_INVALID_ARG_TYPE,
6161
} = require('internal/errors').codes;
6262

6363
const { Module: CJSModule } = require('internal/modules/cjs/loader');
@@ -1183,6 +1183,7 @@ module.exports = {
11831183
getPackageType,
11841184
packageExportsResolve,
11851185
packageImportsResolve,
1186+
legacyMainResolve,
11861187
};
11871188

11881189
// cycle

src/node_file.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2635,8 +2635,9 @@ static bool FileURLToPath(
26352635
for (size_t i = 0; i < pathname_size; i++) {
26362636
if (pathname[i] == '/') {
26372637
pathname_escaped_slash += '\\';
2638-
} else
2638+
} else {
26392639
pathname_escaped_slash += pathname[i];
2640+
}
26402641

26412642
if (pathname[i] != '%') continue;
26422643

src/node_file.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ constexpr size_t kFsStatFsBufferLength =
5656

5757
class BindingData : public SnapshotableObject {
5858
public:
59-
6059
enum class FilePathIsFileReturnType {
6160
kIsFile = 0,
6261
kIsNotFile,

0 commit comments

Comments
 (0)