@jsenv/node-esm-resolution 1.3.0 → 1.3.3
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 +2 -2
- package/src/node_esm_resolution.js +14 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/node-esm-resolution",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"/src/"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@jsenv/filesystem": "4.15.
|
|
24
|
+
"@jsenv/filesystem": "4.15.17"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@jsenv/assert": "../assert",
|
|
@@ -207,13 +207,11 @@ const applyPackageResolve = (packageSpecifier, resolutionContext) => {
|
|
|
207
207
|
if (packageSpecifier === "") {
|
|
208
208
|
throw new Error("invalid module specifier");
|
|
209
209
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
isSpecifierForNodeBuiltin(packageSpecifier)
|
|
213
|
-
) {
|
|
210
|
+
// "node:" prefixed specifiers always resolve to node builtins
|
|
211
|
+
if (packageSpecifier.startsWith("node:")) {
|
|
214
212
|
return createResolutionResult({
|
|
215
213
|
type: "node_builtin_specifier",
|
|
216
|
-
url:
|
|
214
|
+
url: packageSpecifier,
|
|
217
215
|
});
|
|
218
216
|
}
|
|
219
217
|
let { packageName, packageSubpath } = parsePackageSpecifier(packageSpecifier);
|
|
@@ -273,6 +271,17 @@ const applyPackageResolve = (packageSpecifier, resolutionContext) => {
|
|
|
273
271
|
packageJson,
|
|
274
272
|
});
|
|
275
273
|
}
|
|
274
|
+
// Bare builtin names (without "node:" prefix) are valid only if no local package found
|
|
275
|
+
// Local packages always take priority over builtins with the same name
|
|
276
|
+
if (
|
|
277
|
+
conditions.includes("node") &&
|
|
278
|
+
isSpecifierForNodeBuiltin(packageSpecifier)
|
|
279
|
+
) {
|
|
280
|
+
return createResolutionResult({
|
|
281
|
+
type: "node_builtin_specifier",
|
|
282
|
+
url: `node:${packageSpecifier}`,
|
|
283
|
+
});
|
|
284
|
+
}
|
|
276
285
|
throw createModuleNotFoundError(packageName, resolutionContext);
|
|
277
286
|
};
|
|
278
287
|
|