From bc782cee98096d2562d87c7a0b15051b6d0d6628 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 13 Mar 2024 22:37:56 -0400 Subject: 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). --- ext/node/polyfills/01_require.js | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'ext/node/polyfills/01_require.js') 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/.* -- cgit v1.2.3