@jsenv/eslint-import-resolver
Advanced tools
Comparing version 0.1.17 to 0.2.0
{ | ||
"name": "@jsenv/eslint-import-resolver", | ||
"version": "0.1.17", | ||
"version": "0.2.0", | ||
"license": "MIT", | ||
@@ -22,3 +22,3 @@ "repository": { | ||
".": { | ||
"import": "./main.js", | ||
"import": "./src/main.js", | ||
"require": "./dist/jsenv_eslint_import_resolver.cjs" | ||
@@ -31,4 +31,3 @@ }, | ||
"/dist/", | ||
"/src/", | ||
"/main.js" | ||
"/src/" | ||
], | ||
@@ -41,5 +40,5 @@ "scripts": { | ||
"dependencies": { | ||
"@jsenv/filesystem": "4.0.8", | ||
"@jsenv/filesystem": "4.0.9", | ||
"@jsenv/importmap": "1.2.0", | ||
"@jsenv/node-esm-resolution": "0.0.10" | ||
"@jsenv/node-esm-resolution": "0.1.0" | ||
}, | ||
@@ -46,0 +45,0 @@ "devDependencies": { |
@@ -19,3 +19,4 @@ // https://github.com/benmosher/eslint-plugin-import/blob/master/resolvers/node/index.js | ||
readCustomConditionsFromProcessArgs, | ||
} from "@jsenv/node-esm-resolution/main.js" | ||
getExtensionsToTry, | ||
} from "@jsenv/node-esm-resolution" | ||
import { createLogger } from "./logger.js" | ||
@@ -39,4 +40,4 @@ import { applyImportmapResolution } from "./importmap_resolution.js" | ||
// one might want to enable this for node_modules but not for project files | ||
magicDirectoryIndex = false, | ||
magicExtensions = false, | ||
magicDirectoryIndex, | ||
magicExtensions, | ||
}, | ||
@@ -73,3 +74,19 @@ ) => { | ||
url = ensureWindowsDriveLetter(url, importer) | ||
if (magicDirectoryIndex === undefined) { | ||
if (url.includes("/node_modules/")) { | ||
magicDirectoryIndex = true | ||
} else { | ||
magicDirectoryIndex = false | ||
} | ||
} | ||
if (magicExtensions === undefined) { | ||
if (url.includes("/node_modules/")) { | ||
magicExtensions = ["inherit", ".js"] | ||
} else { | ||
magicExtensions = false | ||
} | ||
} | ||
return handleFileUrl(url, { | ||
importer, | ||
logger, | ||
@@ -97,3 +114,5 @@ caseSensitive, | ||
) { | ||
return onUrl(new URL(specifier.slice(1), rootDirectoryUrl).href) | ||
return onUrl(new URL(specifier.slice(1), rootDirectoryUrl).href, { | ||
resolvedBy: "url", | ||
}) | ||
} | ||
@@ -103,3 +122,5 @@ | ||
if (isAbsoluteUrl(specifier)) { | ||
return onUrl(specifier) | ||
return onUrl(specifier, { | ||
resolvedBy: "url", | ||
}) | ||
} | ||
@@ -114,3 +135,5 @@ if (importmapFileRelativeUrl) { | ||
if (urlFromImportmap) { | ||
return onUrl(urlFromImportmap) | ||
return onUrl(urlFromImportmap, { | ||
resolvedBy: "importmap", | ||
}) | ||
} | ||
@@ -122,3 +145,5 @@ } | ||
if (moduleSystem === "commonjs") { | ||
return onUrl(createRequire(importer).resolve(specifier)) | ||
return onUrl(createRequire(importer).resolve(specifier), { | ||
resolvedBy: "commonjs", | ||
}) | ||
} | ||
@@ -132,7 +157,11 @@ if (moduleSystem === "module") { | ||
if (nodeResolution) { | ||
return onUrl(nodeResolution.url) | ||
return onUrl(nodeResolution.url, { | ||
resolvedBy: "node_esm", | ||
}) | ||
} | ||
} | ||
if (moduleSystem === "url") { | ||
return onUrl(applyUrlResolution(specifier, importer)) | ||
return onUrl(applyUrlResolution(specifier, importer), { | ||
resolvedBy: "url", | ||
}) | ||
} | ||
@@ -153,3 +182,3 @@ throw new Error("not found") | ||
fileUrl, | ||
{ logger, magicDirectoryIndex, magicExtensions, caseSensitive }, | ||
{ importer, logger, magicDirectoryIndex, magicExtensions, caseSensitive }, | ||
) => { | ||
@@ -159,3 +188,3 @@ fileUrl = `file://${new URL(fileUrl).pathname}` // remove query params from url | ||
magicDirectoryIndex, | ||
magicExtensions, | ||
magicExtensions: getExtensionsToTry(magicExtensions, importer), | ||
}) | ||
@@ -162,0 +191,0 @@ if (!fileResolution.found) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74807
2728
3
+ Added@jsenv/filesystem@4.0.9(transitive)
+ Added@jsenv/node-esm-resolution@0.1.0(transitive)
+ Added@jsenv/urls@1.2.5(transitive)
- Removed@jsenv/filesystem@4.0.8(transitive)
- Removed@jsenv/node-esm-resolution@0.0.10(transitive)
- Removed@jsenv/urls@1.2.4(transitive)
Updated@jsenv/filesystem@4.0.9