@jsenv/node-esm-resolution 1.0.2 → 1.0.4
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/main.js
CHANGED
package/package.json
CHANGED
|
@@ -9,21 +9,21 @@
|
|
|
9
9
|
* maintain symlink as facade url when it's outside project directory
|
|
10
10
|
* or use the real path when inside
|
|
11
11
|
*/
|
|
12
|
-
import { pathToFileURL } from "node:url";
|
|
13
12
|
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
13
|
+
import { pathToFileURL } from "node:url";
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { readCustomConditionsFromProcessArgs } from "./custom_conditions.js";
|
|
16
16
|
import { defaultLookupPackageScope } from "./default_lookup_package_scope.js";
|
|
17
17
|
import { defaultReadPackageJson } from "./default_read_package_json.js";
|
|
18
|
-
import { getParentUrl, isValidUrl } from "./url_utils.js";
|
|
19
18
|
import {
|
|
20
19
|
createInvalidModuleSpecifierError,
|
|
20
|
+
createInvalidPackageTargetError,
|
|
21
21
|
createModuleNotFoundError,
|
|
22
22
|
createPackageImportNotDefinedError,
|
|
23
23
|
createPackagePathNotExportedError,
|
|
24
|
-
createInvalidPackageTargetError,
|
|
25
24
|
} from "./errors.js";
|
|
26
|
-
import {
|
|
25
|
+
import { isSpecifierForNodeBuiltin } from "./node_builtin_specifiers.js";
|
|
26
|
+
import { getParentUrl, isValidUrl } from "./url_utils.js";
|
|
27
27
|
|
|
28
28
|
export const applyNodeEsmResolution = ({
|
|
29
29
|
specifier,
|
|
@@ -103,9 +103,11 @@ const applyPackageSpecifierResolution = (specifier, resolutionContext) => {
|
|
|
103
103
|
return browserFieldResolution;
|
|
104
104
|
}
|
|
105
105
|
const packageResolution = applyPackageResolve(specifier, resolutionContext);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
if (packageResolution.type !== "relative_specifier") {
|
|
107
|
+
const search = new URL(specifier, "file://").search;
|
|
108
|
+
if (search) {
|
|
109
|
+
packageResolution.url = `${packageResolution.url}${search}`;
|
|
110
|
+
}
|
|
109
111
|
}
|
|
110
112
|
return packageResolution;
|
|
111
113
|
}
|