@jsenv/core 32.1.2 → 32.2.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/dist/main.js
CHANGED
|
@@ -17152,6 +17152,7 @@ const addRelationshipWithPackageJson = ({
|
|
|
17152
17152
|
* - "css_@import"
|
|
17153
17153
|
* - "css_url"
|
|
17154
17154
|
* - "js_import"
|
|
17155
|
+
* - "js_import_script"
|
|
17155
17156
|
* - "js_url"
|
|
17156
17157
|
* - "js_inline_content"
|
|
17157
17158
|
* - "sourcemap_comment"
|
|
@@ -17173,21 +17174,19 @@ const jsenvPluginUrlResolution = ({
|
|
|
17173
17174
|
Object.keys(urlResolution).forEach(urlType => {
|
|
17174
17175
|
const resolver = urlResolution[urlType];
|
|
17175
17176
|
if (typeof resolver !== "object") {
|
|
17176
|
-
throw new Error(`
|
|
17177
|
-
"${urlType}" resolution value must be an object, got ${resolver}`);
|
|
17177
|
+
throw new Error(`urlResolution values must be objects, got ${resolver} on "${urlType}"`);
|
|
17178
17178
|
}
|
|
17179
17179
|
let {
|
|
17180
17180
|
web,
|
|
17181
17181
|
node_esm,
|
|
17182
17182
|
...rest
|
|
17183
17183
|
} = resolver;
|
|
17184
|
-
const
|
|
17185
|
-
if (
|
|
17186
|
-
throw new
|
|
17187
|
-
"${urlType}" resolution key must be "web" or "node_esm", found "${Object.keys(rest)[0]}"`);
|
|
17184
|
+
const unexpectedKeys = Object.keys(rest);
|
|
17185
|
+
if (unexpectedKeys.length) {
|
|
17186
|
+
throw new TypeError(`${unexpectedKeys.join(",")}: there is no such configuration on "${urlType}"`);
|
|
17188
17187
|
}
|
|
17189
17188
|
if (node_esm === undefined) {
|
|
17190
|
-
node_esm = urlType === "
|
|
17189
|
+
node_esm = urlType === "js_import";
|
|
17191
17190
|
}
|
|
17192
17191
|
if (web === undefined) {
|
|
17193
17192
|
web = true;
|
|
@@ -17207,11 +17206,20 @@ const jsenvPluginUrlResolution = ({
|
|
|
17207
17206
|
resolvers[urlType] = resolveUrlUsingWebResolution;
|
|
17208
17207
|
}
|
|
17209
17208
|
});
|
|
17209
|
+
const nodeEsmResolverDefault = createNodeEsmResolver({
|
|
17210
|
+
runtimeCompat,
|
|
17211
|
+
preservesSymlink: true
|
|
17212
|
+
});
|
|
17210
17213
|
if (!resolvers.js_module) {
|
|
17211
|
-
resolvers.js_module =
|
|
17212
|
-
|
|
17213
|
-
|
|
17214
|
-
|
|
17214
|
+
resolvers.js_module = nodeEsmResolverDefault;
|
|
17215
|
+
}
|
|
17216
|
+
if (!resolvers.js_classic) {
|
|
17217
|
+
resolvers.js_classic = (reference, context) => {
|
|
17218
|
+
if (reference.subtype === "self_import_scripts_arg") {
|
|
17219
|
+
return nodeEsmResolverDefault(reference, context);
|
|
17220
|
+
}
|
|
17221
|
+
return resolveUrlUsingWebResolution(reference);
|
|
17222
|
+
};
|
|
17215
17223
|
}
|
|
17216
17224
|
if (!resolvers["*"]) {
|
|
17217
17225
|
resolvers["*"] = resolveUrlUsingWebResolution;
|
package/package.json
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* - "css_@import"
|
|
22
22
|
* - "css_url"
|
|
23
23
|
* - "js_import"
|
|
24
|
+
* - "js_import_script"
|
|
24
25
|
* - "js_url"
|
|
25
26
|
* - "js_inline_content"
|
|
26
27
|
* - "sourcemap_comment"
|
|
@@ -49,22 +50,20 @@ export const jsenvPluginUrlResolution = ({
|
|
|
49
50
|
const resolver = urlResolution[urlType]
|
|
50
51
|
if (typeof resolver !== "object") {
|
|
51
52
|
throw new Error(
|
|
52
|
-
`
|
|
53
|
-
"${urlType}" resolution value must be an object, got ${resolver}`,
|
|
53
|
+
`urlResolution values must be objects, got ${resolver} on "${urlType}"`,
|
|
54
54
|
)
|
|
55
55
|
}
|
|
56
56
|
let { web, node_esm, ...rest } = resolver
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
throw new
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
}"`,
|
|
57
|
+
const unexpectedKeys = Object.keys(rest)
|
|
58
|
+
if (unexpectedKeys.length) {
|
|
59
|
+
throw new TypeError(
|
|
60
|
+
`${unexpectedKeys.join(
|
|
61
|
+
",",
|
|
62
|
+
)}: there is no such configuration on "${urlType}"`,
|
|
64
63
|
)
|
|
65
64
|
}
|
|
66
65
|
if (node_esm === undefined) {
|
|
67
|
-
node_esm = urlType === "
|
|
66
|
+
node_esm = urlType === "js_import"
|
|
68
67
|
}
|
|
69
68
|
if (web === undefined) {
|
|
70
69
|
web = true
|
|
@@ -82,11 +81,20 @@ export const jsenvPluginUrlResolution = ({
|
|
|
82
81
|
}
|
|
83
82
|
})
|
|
84
83
|
|
|
84
|
+
const nodeEsmResolverDefault = createNodeEsmResolver({
|
|
85
|
+
runtimeCompat,
|
|
86
|
+
preservesSymlink: true,
|
|
87
|
+
})
|
|
85
88
|
if (!resolvers.js_module) {
|
|
86
|
-
resolvers.js_module =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
resolvers.js_module = nodeEsmResolverDefault
|
|
90
|
+
}
|
|
91
|
+
if (!resolvers.js_classic) {
|
|
92
|
+
resolvers.js_classic = (reference, context) => {
|
|
93
|
+
if (reference.subtype === "self_import_scripts_arg") {
|
|
94
|
+
return nodeEsmResolverDefault(reference, context)
|
|
95
|
+
}
|
|
96
|
+
return resolveUrlUsingWebResolution(reference, context)
|
|
97
|
+
}
|
|
90
98
|
}
|
|
91
99
|
if (!resolvers["*"]) {
|
|
92
100
|
resolvers["*"] = resolveUrlUsingWebResolution
|