diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-03-13 22:37:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-13 22:37:56 -0400 |
commit | bc782cee98096d2562d87c7a0b15051b6d0d6628 (patch) | |
tree | 34895fe5b4006d894bfd0d61d9d5bb91e3ededc4 /ext/node/polyfills/01_require.js | |
parent | 6f5a86ce5166440980a9100db5051452e9734fa6 (diff) |
fix(node): resolve types via package.json for directory import (#22878)
Does a package resolve when resolving types for a directory (copying the
behaviour that typescript does).
Diffstat (limited to 'ext/node/polyfills/01_require.js')
-rw-r--r-- | ext/node/polyfills/01_require.js | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/ext/node/polyfills/01_require.js b/ext/node/polyfills/01_require.js index 8136bc68e..8d34a51b1 100644 --- a/ext/node/polyfills/01_require.js +++ b/ext/node/polyfills/01_require.js @@ -491,31 +491,6 @@ Module.globalPaths = modulePaths; const CHAR_FORWARD_SLASH = 47; const TRAILING_SLASH_REGEX = /(?:^|\/)\.?\.$/; -const encodedSepRegEx = /%2F|%2C/i; - -function finalizeEsmResolution( - resolved, - parentPath, - pkgPath, -) { - if (RegExpPrototypeTest(encodedSepRegEx, resolved)) { - throw new ERR_INVALID_MODULE_SPECIFIER( - resolved, - 'must not include encoded "/" or "\\" characters', - parentPath, - ); - } - // const filename = fileURLToPath(resolved); - const filename = resolved; - const actual = tryFile(filename, false); - if (actual) { - return actual; - } - throw new ERR_MODULE_NOT_FOUND( - filename, - path.resolve(pkgPath, "package.json"), - ); -} // This only applies to requests of a specific form: // 1. name/.* |