@jsenv/node-esm-resolution 1.0.6 → 1.1.0
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,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/node-esm-resolution",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/jsenv/core",
|
|
8
|
-
"directory": "packages/independent/node-esm-resolution"
|
|
8
|
+
"directory": "packages/independent/tooling/node-esm-resolution"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
@@ -22,8 +22,5 @@
|
|
|
22
22
|
"/dist/",
|
|
23
23
|
"/src/",
|
|
24
24
|
"/main.js"
|
|
25
|
-
]
|
|
26
|
-
"scripts": {
|
|
27
|
-
"test": "node --conditions=development ./tests/test.mjs"
|
|
28
|
-
}
|
|
25
|
+
]
|
|
29
26
|
}
|
package/src/custom_conditions.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// https://nodejs.org/api/packages.html#resolving-user-conditions
|
|
2
2
|
export const readCustomConditionsFromProcessArgs = () => {
|
|
3
3
|
const packageConditions = [];
|
|
4
|
-
process.execArgv
|
|
4
|
+
for (const arg of process.execArgv) {
|
|
5
5
|
if (arg.includes("-C=")) {
|
|
6
6
|
const packageCondition = arg.slice(0, "-C=".length);
|
|
7
7
|
packageConditions.push(packageCondition);
|
|
@@ -10,6 +10,6 @@ export const readCustomConditionsFromProcessArgs = () => {
|
|
|
10
10
|
const packageCondition = arg.slice("--conditions=".length);
|
|
11
11
|
packageConditions.push(packageCondition);
|
|
12
12
|
}
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
return packageConditions;
|
|
15
15
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { readEntryStatSync } from "@jsenv/filesystem";
|
|
3
2
|
import { urlToExtension, urlToFilename } from "./url_utils.js";
|
|
4
3
|
|
|
5
4
|
export const applyFileSystemMagicResolution = (
|
|
@@ -16,7 +15,7 @@ export const applyFileSystemMagicResolution = (
|
|
|
16
15
|
|
|
17
16
|
if (fileStat === undefined) {
|
|
18
17
|
try {
|
|
19
|
-
fileStat =
|
|
18
|
+
fileStat = readEntryStatSync(new URL(fileUrl));
|
|
20
19
|
} catch (e) {
|
|
21
20
|
if (e.code === "ENOENT") {
|
|
22
21
|
result.lastENOENTError = e;
|
|
@@ -58,7 +57,7 @@ export const applyFileSystemMagicResolution = (
|
|
|
58
57
|
const urlCandidate = `${parentUrl}${urlFilename}${extensionToTry}`;
|
|
59
58
|
let stat;
|
|
60
59
|
try {
|
|
61
|
-
stat =
|
|
60
|
+
stat = readEntryStatSync(new URL(urlCandidate));
|
|
62
61
|
} catch (e) {
|
|
63
62
|
if (e.code === "ENOENT") {
|
|
64
63
|
stat = null;
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
13
13
|
import { pathToFileURL } from "node:url";
|
|
14
|
-
|
|
15
14
|
import { readCustomConditionsFromProcessArgs } from "./custom_conditions.js";
|
|
16
15
|
import { defaultLookupPackageScope } from "./default_lookup_package_scope.js";
|
|
17
16
|
import { defaultReadPackageJson } from "./default_read_package_json.js";
|