@jsenv/core 30.2.0 → 30.3.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/controllable_child_process.mjs +1 -1
- package/dist/controllable_worker_thread.mjs +1 -1
- package/dist/js/execute_using_dynamic_import.js +2 -2
- package/dist/js/v8_coverage.js +4 -4
- package/dist/main.js +249 -91
- package/package.json +3 -3
- package/src/build/build.js +153 -44
- package/src/build/{inject_global_version_mappings.js → version_mappings_injection.js} +44 -33
- package/src/dev/file_service.js +12 -4
- package/src/kitchen/compat/features_compatibility.js +59 -0
- package/src/kitchen/kitchen.js +5 -1
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_html.js +13 -22
- package/src/plugins/transpilation/jsenv_plugin_import_meta_resolve.js +1 -5
- package/src/plugins/transpilation/jsenv_plugin_top_level_await.js +1 -5
|
@@ -23,8 +23,6 @@ export const jsenvPluginAsJsClassicHtml = ({
|
|
|
23
23
|
systemJsInjection,
|
|
24
24
|
systemJsClientFileUrl,
|
|
25
25
|
}) => {
|
|
26
|
-
let shouldTransformScriptTypeModule
|
|
27
|
-
|
|
28
26
|
const turnIntoJsClassicProxy = (reference) => {
|
|
29
27
|
return injectQueryParams(reference.url, { as_js_classic: "" })
|
|
30
28
|
}
|
|
@@ -32,26 +30,16 @@ export const jsenvPluginAsJsClassicHtml = ({
|
|
|
32
30
|
return {
|
|
33
31
|
name: "jsenv:as_js_classic_html",
|
|
34
32
|
appliesDuring: "*",
|
|
35
|
-
init: (context) => {
|
|
36
|
-
const nodeRuntimeEnabled = Object.keys(context.runtimeCompat).includes(
|
|
37
|
-
"node",
|
|
38
|
-
)
|
|
39
|
-
shouldTransformScriptTypeModule = nodeRuntimeEnabled
|
|
40
|
-
? false
|
|
41
|
-
: !context.isSupportedOnCurrentClients("script_type_module") ||
|
|
42
|
-
!context.isSupportedOnCurrentClients("import_dynamic") ||
|
|
43
|
-
!context.isSupportedOnCurrentClients("import_meta")
|
|
44
|
-
},
|
|
45
33
|
redirectUrl: {
|
|
46
|
-
link_href: (reference) => {
|
|
34
|
+
link_href: (reference, context) => {
|
|
47
35
|
if (
|
|
48
|
-
|
|
36
|
+
context.systemJsTranspilation &&
|
|
49
37
|
reference.subtype === "modulepreload"
|
|
50
38
|
) {
|
|
51
39
|
return turnIntoJsClassicProxy(reference)
|
|
52
40
|
}
|
|
53
41
|
if (
|
|
54
|
-
|
|
42
|
+
context.systemJsTranspilation &&
|
|
55
43
|
reference.subtype === "preload" &&
|
|
56
44
|
reference.expectedType === "js_module"
|
|
57
45
|
) {
|
|
@@ -59,18 +47,18 @@ export const jsenvPluginAsJsClassicHtml = ({
|
|
|
59
47
|
}
|
|
60
48
|
return null
|
|
61
49
|
},
|
|
62
|
-
script_src: (reference) => {
|
|
50
|
+
script_src: (reference, context) => {
|
|
63
51
|
if (
|
|
64
|
-
|
|
52
|
+
context.systemJsTranspilation &&
|
|
65
53
|
reference.expectedType === "js_module"
|
|
66
54
|
) {
|
|
67
55
|
return turnIntoJsClassicProxy(reference)
|
|
68
56
|
}
|
|
69
57
|
return null
|
|
70
58
|
},
|
|
71
|
-
js_url: (reference) => {
|
|
59
|
+
js_url: (reference, context) => {
|
|
72
60
|
if (
|
|
73
|
-
|
|
61
|
+
context.systemJsTranspilation &&
|
|
74
62
|
reference.expectedType === "js_module"
|
|
75
63
|
) {
|
|
76
64
|
return turnIntoJsClassicProxy(reference)
|
|
@@ -101,7 +89,10 @@ export const jsenvPluginAsJsClassicHtml = ({
|
|
|
101
89
|
if (!isOrWasExpectingJsModule(reference)) {
|
|
102
90
|
return
|
|
103
91
|
}
|
|
104
|
-
if (
|
|
92
|
+
if (
|
|
93
|
+
rel === "modulepreload" &&
|
|
94
|
+
reference.expectedType === "js_classic"
|
|
95
|
+
) {
|
|
105
96
|
mutations.push(() => {
|
|
106
97
|
setHtmlNodeAttributes(node, {
|
|
107
98
|
rel: "preload",
|
|
@@ -110,7 +101,7 @@ export const jsenvPluginAsJsClassicHtml = ({
|
|
|
110
101
|
})
|
|
111
102
|
})
|
|
112
103
|
}
|
|
113
|
-
if (rel === "preload") {
|
|
104
|
+
if (rel === "preload" && reference.expectedType === "js_classic") {
|
|
114
105
|
mutations.push(() => {
|
|
115
106
|
setHtmlNodeAttributes(node, { crossorigin: undefined })
|
|
116
107
|
})
|
|
@@ -137,7 +128,7 @@ export const jsenvPluginAsJsClassicHtml = ({
|
|
|
137
128
|
setHtmlNodeAttributes(node, { type: undefined })
|
|
138
129
|
})
|
|
139
130
|
}
|
|
140
|
-
} else if (
|
|
131
|
+
} else if (context.systemJsTranspilation) {
|
|
141
132
|
mutations.push(() => {
|
|
142
133
|
setHtmlNodeAttributes(node, { type: undefined })
|
|
143
134
|
})
|
|
@@ -8,12 +8,8 @@ export const jsenvPluginImportMetaResolve = () => {
|
|
|
8
8
|
if (context.isSupportedOnCurrentClients("import_meta_resolve")) {
|
|
9
9
|
return false
|
|
10
10
|
}
|
|
11
|
-
const willTransformJsModules =
|
|
12
|
-
!context.isSupportedOnCurrentClients("script_type_module") ||
|
|
13
|
-
!context.isSupportedOnCurrentClients("import_dynamic") ||
|
|
14
|
-
!context.isSupportedOnCurrentClients("import_meta")
|
|
15
11
|
// keep it untouched, systemjs will handle it
|
|
16
|
-
if (
|
|
12
|
+
if (context.systemJsTranspilation) {
|
|
17
13
|
return false
|
|
18
14
|
}
|
|
19
15
|
return true
|
|
@@ -11,11 +11,7 @@ export const jsenvPluginTopLevelAwait = () => {
|
|
|
11
11
|
return false
|
|
12
12
|
}
|
|
13
13
|
// keep it untouched, systemjs will handle it
|
|
14
|
-
|
|
15
|
-
!context.isSupportedOnCurrentClients("script_type_module") ||
|
|
16
|
-
!context.isSupportedOnCurrentClients("import_dynamic") ||
|
|
17
|
-
!context.isSupportedOnCurrentClients("import_meta")
|
|
18
|
-
if (willTransformJsModules) {
|
|
14
|
+
if (context.systemJsTranspilation) {
|
|
19
15
|
return false
|
|
20
16
|
}
|
|
21
17
|
return true
|