@jsenv/node-esm-resolution 0.2.0 → 1.0.1
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 +1 -1
- package/src/node_esm_resolution.js +11 -3
package/package.json
CHANGED
|
@@ -102,7 +102,12 @@ const applyPackageSpecifierResolution = (specifier, resolutionContext) => {
|
|
|
102
102
|
if (browserFieldResolution) {
|
|
103
103
|
return browserFieldResolution
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
const packageResolution = applyPackageResolve(specifier, resolutionContext)
|
|
106
|
+
const search = new URL(specifier, "file://").search
|
|
107
|
+
if (search) {
|
|
108
|
+
packageResolution.url = `${packageResolution.url}${search}`
|
|
109
|
+
}
|
|
110
|
+
return packageResolution
|
|
106
111
|
}
|
|
107
112
|
}
|
|
108
113
|
|
|
@@ -207,8 +212,7 @@ const applyPackageResolve = (packageSpecifier, resolutionContext) => {
|
|
|
207
212
|
url: `node:${packageSpecifier}`,
|
|
208
213
|
}
|
|
209
214
|
}
|
|
210
|
-
|
|
211
|
-
parsePackageSpecifier(packageSpecifier)
|
|
215
|
+
let { packageName, packageSubpath } = parsePackageSpecifier(packageSpecifier)
|
|
212
216
|
if (
|
|
213
217
|
packageName[0] === "." ||
|
|
214
218
|
packageName.includes("\\") ||
|
|
@@ -223,6 +227,10 @@ const applyPackageResolve = (packageSpecifier, resolutionContext) => {
|
|
|
223
227
|
if (packageSubpath.endsWith("/")) {
|
|
224
228
|
throw new Error("invalid module specifier")
|
|
225
229
|
}
|
|
230
|
+
const questionCharIndex = packageName.indexOf("?")
|
|
231
|
+
if (questionCharIndex > -1) {
|
|
232
|
+
packageName = packageName.slice(0, questionCharIndex)
|
|
233
|
+
}
|
|
226
234
|
const selfResolution = applyPackageSelfResolution(packageSubpath, {
|
|
227
235
|
...resolutionContext,
|
|
228
236
|
packageName,
|