Skip to content

Commit

Permalink
fixup! src,lib: reducing C++ calls of esm legacy main resolve
Browse files Browse the repository at this point in the history
Backport-PR-URL: nodejs#48325
  • Loading branch information
H4ad committed Dec 2, 2023
1 parent f260c35 commit edbc6b5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/internal/modules/esm/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const {
ERR_PACKAGE_PATH_NOT_EXPORTED,
ERR_UNSUPPORTED_DIR_IMPORT,
ERR_NETWORK_IMPORT_DISALLOWED,
ERR_INVALID_ARG_TYPE,
} = require('internal/errors').codes;

const { Module: CJSModule } = require('internal/modules/cjs/loader');
Expand Down Expand Up @@ -1249,6 +1250,7 @@ module.exports = {
packageExportsResolve,
packageImportsResolve,
throwIfInvalidParentURL,
legacyMainResolve,
};

// cycle
Expand Down
3 changes: 2 additions & 1 deletion src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2633,8 +2633,9 @@ static bool FileURLToPath(
for (size_t i = 0; i < pathname_size; i++) {
if (pathname[i] == '/') {
pathname_escaped_slash += '\\';
} else
} else {
pathname_escaped_slash += pathname[i];
}

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

Expand Down
1 change: 0 additions & 1 deletion src/node_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ constexpr size_t kFsStatFsBufferLength =

class BindingData : public SnapshotableObject {
public:

enum class FilePathIsFileReturnType {
kIsFile = 0,
kIsNotFile,
Expand Down

0 comments on commit edbc6b5

Please sign in to comment.