@jsenv/plugin-transpilation 1.0.0 → 1.2.0
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 +26 -26
- package/src/as_js_module/jsenv_plugin_as_js_module.js +14 -28
- package/src/babel/babel_helper_directory/README.md +1 -1
- package/src/babel/babel_helper_directory/babel_helpers/applyDecs2301/applyDecs2301.js +547 -528
- package/src/babel/babel_helper_directory/babel_helpers/applyDecs2305/applyDecs2305.js +681 -0
- package/src/babel/babel_plugin_structure.js +1 -1
- package/src/babel/jsenv_plugin_babel.js +91 -19
- package/src/babel/new_stylesheet/babel_plugin_new_stylesheet_injector.js +11 -135
- package/src/babel/new_stylesheet/constructable_stylesheet_usage.js +114 -0
- package/src/babel/new_stylesheet/new_stylesheet_client_file_url.js +4 -0
- package/src/babel/regenerator_runtime/babel_plugin_regenerator_runtime_injector.js +11 -35
- package/src/babel/regenerator_runtime/regenerator_runtime_client_file_url.js +4 -0
- package/src/babel/regenerator_runtime/regenerator_runtime_usage.js +23 -0
- package/src/babel/{polyfill_injection_in_babel_ast.js → side_effect_injection_in_babel_ast.js} +8 -8
- package/src/css/jsenv_plugin_css_transpilation.js +2 -2
- package/src/import_assertions/jsenv_plugin_import_assertions.js +39 -78
- package/src/import_meta_resolve/jsenv_plugin_import_meta_resolve.js +17 -13
- package/src/js_module_fallback/jsenv_plugin_js_module_conversion.js +56 -48
- package/src/js_module_fallback/jsenv_plugin_js_module_fallback.js +3 -38
- package/src/js_module_fallback/jsenv_plugin_js_module_fallback_inside_html.js +63 -122
- package/src/js_module_fallback/jsenv_plugin_js_module_fallback_on_workers.js +15 -6
- package/src/babel/apply_js_transpilation.js +0 -74
- package/src/babel/global_this/babel_plugin_global_this_injector.js +0 -56
- package/src/babel/global_this/client/global_this_js_classic.js +0 -25
- package/src/babel/global_this/client/global_this_js_module.js +0 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/plugin-transpilation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "TODO",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,35 +26,35 @@
|
|
|
26
26
|
"@babel/plugin-proposal-optional-catch-binding": "7.18.6",
|
|
27
27
|
"@babel/plugin-proposal-optional-chaining": "7.21.0",
|
|
28
28
|
"@babel/plugin-proposal-unicode-property-regex": "7.18.6",
|
|
29
|
-
"@babel/plugin-syntax-import-assertions": "7.
|
|
29
|
+
"@babel/plugin-syntax-import-assertions": "7.22.5",
|
|
30
30
|
"@babel/plugin-syntax-object-rest-spread": "7.8.3",
|
|
31
31
|
"@babel/plugin-syntax-optional-catch-binding": "7.8.3",
|
|
32
|
-
"@babel/plugin-transform-arrow-functions": "7.
|
|
33
|
-
"@babel/plugin-transform-block-scoped-functions": "7.
|
|
34
|
-
"@babel/plugin-transform-block-scoping": "7.
|
|
35
|
-
"@babel/plugin-transform-classes": "7.
|
|
36
|
-
"@babel/plugin-transform-computed-properties": "7.
|
|
37
|
-
"@babel/plugin-transform-destructuring": "7.
|
|
38
|
-
"@babel/plugin-transform-dotall-regex": "7.
|
|
39
|
-
"@babel/plugin-transform-duplicate-keys": "7.
|
|
40
|
-
"@babel/plugin-transform-exponentiation-operator": "7.
|
|
41
|
-
"@babel/plugin-transform-for-of": "7.
|
|
42
|
-
"@babel/plugin-transform-function-name": "7.
|
|
43
|
-
"@babel/plugin-transform-literals": "7.
|
|
44
|
-
"@babel/plugin-transform-new-target": "7.22.
|
|
45
|
-
"@babel/plugin-transform-object-super": "7.
|
|
46
|
-
"@babel/plugin-transform-parameters": "7.22.
|
|
47
|
-
"@babel/plugin-transform-regenerator": "7.
|
|
48
|
-
"@babel/plugin-transform-shorthand-properties": "7.
|
|
49
|
-
"@babel/plugin-transform-spread": "7.
|
|
50
|
-
"@babel/plugin-transform-sticky-regex": "7.
|
|
51
|
-
"@babel/plugin-transform-template-literals": "7.
|
|
52
|
-
"@babel/plugin-transform-typeof-symbol": "7.
|
|
53
|
-
"@babel/plugin-transform-unicode-regex": "7.
|
|
32
|
+
"@babel/plugin-transform-arrow-functions": "7.22.5",
|
|
33
|
+
"@babel/plugin-transform-block-scoped-functions": "7.22.5",
|
|
34
|
+
"@babel/plugin-transform-block-scoping": "7.22.5",
|
|
35
|
+
"@babel/plugin-transform-classes": "7.22.6",
|
|
36
|
+
"@babel/plugin-transform-computed-properties": "7.22.5",
|
|
37
|
+
"@babel/plugin-transform-destructuring": "7.22.5",
|
|
38
|
+
"@babel/plugin-transform-dotall-regex": "7.22.5",
|
|
39
|
+
"@babel/plugin-transform-duplicate-keys": "7.22.5",
|
|
40
|
+
"@babel/plugin-transform-exponentiation-operator": "7.22.5",
|
|
41
|
+
"@babel/plugin-transform-for-of": "7.22.5",
|
|
42
|
+
"@babel/plugin-transform-function-name": "7.22.5",
|
|
43
|
+
"@babel/plugin-transform-literals": "7.22.5",
|
|
44
|
+
"@babel/plugin-transform-new-target": "7.22.5",
|
|
45
|
+
"@babel/plugin-transform-object-super": "7.22.5",
|
|
46
|
+
"@babel/plugin-transform-parameters": "7.22.5",
|
|
47
|
+
"@babel/plugin-transform-regenerator": "7.22.5",
|
|
48
|
+
"@babel/plugin-transform-shorthand-properties": "7.22.5",
|
|
49
|
+
"@babel/plugin-transform-spread": "7.22.5",
|
|
50
|
+
"@babel/plugin-transform-sticky-regex": "7.22.5",
|
|
51
|
+
"@babel/plugin-transform-template-literals": "7.22.5",
|
|
52
|
+
"@babel/plugin-transform-typeof-symbol": "7.22.5",
|
|
53
|
+
"@babel/plugin-transform-unicode-regex": "7.22.5",
|
|
54
54
|
"babel-plugin-transform-async-to-promises": "0.8.18",
|
|
55
55
|
"construct-style-sheets-polyfill": "3.1.0",
|
|
56
|
-
"@jsenv/ast": "
|
|
56
|
+
"@jsenv/ast": "5.0.0",
|
|
57
57
|
"@jsenv/runtime-compat": "1.0.0",
|
|
58
|
-
"lightningcss": "1.
|
|
58
|
+
"lightningcss": "1.21.5"
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -20,38 +20,24 @@ export const jsenvPluginAsJsModule = () => {
|
|
|
20
20
|
redirectReference: (reference) => {
|
|
21
21
|
if (reference.searchParams.has("as_js_module")) {
|
|
22
22
|
reference.expectedType = "js_module";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
if (!reference.filename) {
|
|
24
|
+
const filename = urlToFilename(reference.url);
|
|
25
|
+
const [basename] = splitFileExtension(filename);
|
|
26
|
+
reference.filename = `${basename}.mjs`;
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
29
|
},
|
|
28
|
-
fetchUrlContent: async (urlInfo
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// override the expectedType to "js_classic"
|
|
35
|
-
// because when there is ?as_js_module it means the underlying resource
|
|
36
|
-
// is js_classic
|
|
37
|
-
expectedType: "js_classic",
|
|
38
|
-
});
|
|
39
|
-
if (!jsClassicReference) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
await context.fetchUrlContent(jsClassicUrlInfo, {
|
|
43
|
-
reference: jsClassicReference,
|
|
30
|
+
fetchUrlContent: async (urlInfo) => {
|
|
31
|
+
const jsClassicUrlInfo = urlInfo.getWithoutSearchParam("as_js_module", {
|
|
32
|
+
// override the expectedType to "js_classic"
|
|
33
|
+
// because when there is ?as_js_module it means the underlying resource
|
|
34
|
+
// is js_classic
|
|
35
|
+
expectedType: "js_classic",
|
|
44
36
|
});
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
type: "js_import",
|
|
48
|
-
subtype: jsClassicReference.subtype,
|
|
49
|
-
specifier: jsClassicReference.url,
|
|
50
|
-
expectedType: "js_classic",
|
|
51
|
-
});
|
|
52
|
-
} else if (context.build && jsClassicUrlInfo.dependents.size === 0) {
|
|
53
|
-
context.urlGraph.deleteUrlInfo(jsClassicUrlInfo.url);
|
|
37
|
+
if (!jsClassicUrlInfo) {
|
|
38
|
+
return null;
|
|
54
39
|
}
|
|
40
|
+
await jsClassicUrlInfo.fetchContent();
|
|
55
41
|
const { content, sourcemap } = await convertJsClassicToJsModule({
|
|
56
42
|
input: jsClassicUrlInfo.content,
|
|
57
43
|
inputSourcemap: jsClassicUrlInfo.sourcemap,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Babel helpers are copied in there to properly appear in sourcemap.
|
|
4
4
|
|
|
5
|
-
- Last sync date:
|
|
5
|
+
- Last sync date: 9 June 2023
|
|
6
6
|
|
|
7
7
|
- Helpers file: https://github.com/babel/babel/blob/main/packages/babel-helpers/src/helpers.ts
|
|
8
8
|
- Individual helpers: https://github.com/babel/babel/tree/main/packages/babel-helpers/src/helpers
|