@jsenv/node-esm-resolution 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/node-esm-resolution",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"directory": "packages/node-esm-resolution"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
|
-
"access": "public"
|
|
11
|
+
"access": "public",
|
|
12
|
+
"registry": "https://registry.npmjs.org"
|
|
12
13
|
},
|
|
13
14
|
"type": "module",
|
|
14
15
|
"exports": {
|
|
@@ -22,5 +23,8 @@
|
|
|
22
23
|
"/dist/",
|
|
23
24
|
"/src/",
|
|
24
25
|
"/main.js"
|
|
25
|
-
]
|
|
26
|
-
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"test": "node ./test/test.mjs"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { existsSync } from "node:fs"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getParentUrl, asDirectoryUrl } from "./url_utils.js"
|
|
4
4
|
|
|
5
5
|
export const lookupPackageScope = (url) => {
|
|
6
6
|
let scopeUrl = asDirectoryUrl(url)
|
|
7
|
-
while (scopeUrl !==
|
|
7
|
+
while (scopeUrl !== "file:///") {
|
|
8
8
|
if (scopeUrl.endsWith("node_modules/")) {
|
|
9
9
|
return null
|
|
10
10
|
}
|
|
@@ -14,7 +14,7 @@ import { existsSync, readFileSync } from "node:fs"
|
|
|
14
14
|
import { isSpecifierForNodeBuiltin } from "./node_builtin_specifiers.js"
|
|
15
15
|
import { lookupPackageScope } from "./lookup_package_scope.js"
|
|
16
16
|
import { readPackageJson } from "./read_package_json.js"
|
|
17
|
-
import {
|
|
17
|
+
import { getParentUrl, isValidUrl } from "./url_utils.js"
|
|
18
18
|
import {
|
|
19
19
|
createInvalidModuleSpecifierError,
|
|
20
20
|
createModuleNotFoundError,
|
|
@@ -238,7 +238,7 @@ const applyPackageResolve = ({ conditions, parentUrl, packageSpecifier }) => {
|
|
|
238
238
|
return selfResolution
|
|
239
239
|
}
|
|
240
240
|
let currentUrl = parentUrl
|
|
241
|
-
while (currentUrl !==
|
|
241
|
+
while (currentUrl !== "file:///") {
|
|
242
242
|
const packageUrl = new URL(`node_modules/${packageName}/`, currentUrl).href
|
|
243
243
|
if (!existsSync(new URL(packageUrl))) {
|
|
244
244
|
currentUrl = getParentUrl(currentUrl)
|