Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jsenv/eslint-import-resolver

Package Overview
Dependencies
Maintainers
2
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsenv/eslint-import-resolver - npm Package Compare versions

Comparing version 0.1.17 to 0.2.0

src/main.js

11

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc