Socket
Socket
Sign inDemoInstall

@jsenv/node-esm-resolution

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsenv/node-esm-resolution - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

src/default_lookup_package_scope.js

4

main.js
export { applyNodeEsmResolution } from "./src/node_esm_resolution.js"
export { determineModuleSystem } from "./src/determine_module_system.js"
export { applyFileSystemMagicResolution } from "./src/filesystem_magic_resolution.js"
export { lookupPackageScope } from "./src/lookup_package_scope.js"
export { readPackageJson } from "./src/read_package_json.js"
export { defaultLookupPackageScope } from "./src/default_lookup_package_scope.js"
export { defaultReadPackageJson } from "./src/default_read_package_json.js"
{
"name": "@jsenv/node-esm-resolution",
"version": "0.0.5",
"version": "0.0.6",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": {

@@ -1,3 +0,3 @@

import { lookupPackageScope } from "./lookup_package_scope.js"
import { readPackageJson } from "./read_package_json.js"
import { defaultLookupPackageScope } from "./default_lookup_package_scope.js"
import { defaultReadPackageJson } from "./default_read_package_json.js"

@@ -32,7 +32,7 @@ // https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#packages_determining_module_system)

if (ambiguousExtensions.includes(extension)) {
const packageUrl = lookupPackageScope(url)
const packageUrl = defaultLookupPackageScope(url)
if (!packageUrl) {
return "commonjs"
}
const packageJson = readPackageJson(packageUrl)
const packageJson = defaultReadPackageJson(packageUrl)
if (packageJson.type === "module") {

@@ -39,0 +39,0 @@ return "module"

@@ -15,4 +15,4 @@ /*

import { isSpecifierForNodeBuiltin } from "./node_builtin_specifiers.js"
import { lookupPackageScope } from "./lookup_package_scope.js"
import { readPackageJson } from "./read_package_json.js"
import { defaultLookupPackageScope } from "./default_lookup_package_scope.js"
import { defaultReadPackageJson } from "./default_read_package_json.js"
import { getParentUrl, isValidUrl } from "./url_utils.js"

@@ -31,2 +31,4 @@ import {

specifier,
lookupPackageScope = defaultLookupPackageScope,
readPackageJson = defaultReadPackageJson,
}) => {

@@ -37,2 +39,4 @@ const resolution = applyPackageSpecifierResolution({

specifier,
lookupPackageScope,
readPackageJson,
})

@@ -57,2 +61,4 @@ const { url } = resolution

specifier,
lookupPackageScope,
readPackageJson,
}) => {

@@ -70,2 +76,4 @@ // relative specifier

specifier,
lookupPackageScope,
readPackageJson,
})

@@ -86,2 +94,4 @@ if (browserFieldResolution) {

specifier,
lookupPackageScope,
readPackageJson,
})

@@ -101,2 +111,4 @@ }

packageSpecifier: specifier,
lookupPackageScope,
readPackageJson,
})

@@ -110,2 +122,4 @@ if (browserFieldResolution) {

packageSpecifier: specifier,
lookupPackageScope,
readPackageJson,
})

@@ -119,2 +133,4 @@ }

packageSpecifier,
lookupPackageScope,
readPackageJson,
}) => {

@@ -176,2 +192,4 @@ const browserCondition = conditions.includes("browser")

specifier,
lookupPackageScope,
readPackageJson,
}) => {

@@ -205,2 +223,4 @@ if (!specifier.startsWith("#")) {

isImports: true,
lookupPackageScope,
readPackageJson,
})

@@ -219,3 +239,9 @@ if (resolved) {

const applyPackageResolve = ({ conditions, parentUrl, packageSpecifier }) => {
const applyPackageResolve = ({
conditions,
parentUrl,
packageSpecifier,
lookupPackageScope,
readPackageJson,
}) => {
if (packageSpecifier === "") {

@@ -254,2 +280,4 @@ throw new Error("invalid module specifier")

packageSubpath,
lookupPackageScope,
readPackageJson,
})

@@ -277,2 +305,4 @@ if (selfResolution) {

exports,
lookupPackageScope,
readPackageJson,
})

@@ -287,2 +317,4 @@ }

packageSubpath,
lookupPackageScope,
readPackageJson,
})

@@ -301,2 +333,4 @@ }

packageSubpath,
lookupPackageScope,
readPackageJson,
}) => {

@@ -322,2 +356,4 @@ const packageUrl = lookupPackageScope(parentUrl)

packageSubpath,
lookupPackageScope,
readPackageJson,
})

@@ -336,2 +372,4 @@ if (subpathResolution && subpathResolution.type !== "subpath") {

exports,
lookupPackageScope,
readPackageJson,
})

@@ -348,2 +386,4 @@ }

exports,
lookupPackageScope,
readPackageJson,
}) => {

@@ -367,2 +407,4 @@ const exportsInfo = readExports({ exports, packageUrl })

target: mainExport,
lookupPackageScope,
readPackageJson,
})

@@ -387,2 +429,4 @@ if (resolved) {

isImports: false,
lookupPackageScope,
readPackageJson,
})

@@ -408,2 +452,4 @@ if (resolved) {

isImports,
lookupPackageScope,
readPackageJson,
}) => {

@@ -420,2 +466,4 @@ if (!matchKey.includes("*") && matchObject.hasOwnProperty(matchKey)) {

internal: isImports,
lookupPackageScope,
readPackageJson,
})

@@ -449,2 +497,4 @@ }

internal: isImports,
lookupPackageScope,
readPackageJson,
})

@@ -465,2 +515,4 @@ }

internal = false,
lookupPackageScope,
readPackageJson,
}) => {

@@ -508,2 +560,4 @@ if (typeof target === "string") {

: `${target}${subpath}`,
lookupPackageScope,
readPackageJson,
})

@@ -531,2 +585,4 @@ }

internal,
lookupPackageScope,
readPackageJson,
})

@@ -570,2 +626,4 @@ if (resolved) {

internal,
lookupPackageScope,
readPackageJson,
})

@@ -689,2 +747,4 @@ if (resolved) {

packageSubpath,
lookupPackageScope,
readPackageJson,
}) => {

@@ -702,2 +762,4 @@ if (packageSubpath === ".") {

specifier: packageSubpath,
lookupPackageScope,
readPackageJson,
})

@@ -704,0 +766,0 @@ if (browserFieldResolution) {

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