@jsenv/core 35.0.2 → 35.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/dist/html/explorer.html +107 -107
- package/dist/js/new_stylesheet.js +3 -0
- package/dist/js/s.js.map +3 -3
- package/dist/jsenv_core.js +15 -17
- package/package.json +1 -1
- package/src/build/build.js +589 -587
- package/src/build/build_urls_generator.js +44 -44
- package/src/build/graph_utils.js +14 -14
- package/src/build/jsenv_plugin_line_break_normalization.js +6 -6
- package/src/build/line_break_unix.js +11 -11
- package/src/build/start_build_server.js +37 -37
- package/src/build/version_generator.js +7 -7
- package/src/build/version_mappings_injection.js +23 -23
- package/src/dev/file_service.js +136 -135
- package/src/dev/start_dev_server.js +56 -56
- package/src/dev/user_agent.js +8 -8
- package/src/helpers/basic_fetch.js +24 -24
- package/src/helpers/command/command.js +28 -28
- package/src/helpers/lookup_package_directory.js +19 -16
- package/src/helpers/ping_server.js +17 -17
- package/src/helpers/require_from_jsenv.js +2 -2
- package/src/helpers/watch_source_files.js +9 -9
- package/src/helpers/web_url_converter.js +10 -10
- package/src/helpers/worker_reload.js +27 -27
- package/src/kitchen/compat/features_compatibility.js +1 -1
- package/src/kitchen/compat/runtime_compat.js +26 -24
- package/src/kitchen/errors.js +75 -75
- package/src/kitchen/fetched_content_compliance.js +8 -8
- package/src/kitchen/kitchen.js +251 -250
- package/src/kitchen/url_graph/sort_by_dependencies.js +17 -17
- package/src/kitchen/url_graph/url_graph_loader.js +30 -30
- package/src/kitchen/url_graph/url_graph_report.js +57 -57
- package/src/kitchen/url_graph/url_info_transformations.js +77 -77
- package/src/kitchen/url_graph.js +121 -121
- package/src/kitchen/url_specifier_encoding.js +21 -21
- package/src/kitchen/web_workers.js +5 -5
- package/src/main.js +3 -3
- package/src/plugins/autoreload/client/autoreload.js +96 -96
- package/src/plugins/autoreload/client/reload.js +56 -56
- package/src/plugins/autoreload/client/url_helpers.js +13 -13
- package/src/plugins/autoreload/jsenv_plugin_autoreload.js +5 -5
- package/src/plugins/autoreload/jsenv_plugin_autoreload_client.js +9 -9
- package/src/plugins/autoreload/jsenv_plugin_autoreload_server.js +61 -60
- package/src/plugins/autoreload/jsenv_plugin_hmr.js +15 -15
- package/src/plugins/cache_control/jsenv_plugin_cache_control.js +5 -5
- package/src/plugins/commonjs_globals/jsenv_plugin_commonjs_globals.js +57 -57
- package/src/plugins/explorer/client/explorer.html +107 -107
- package/src/plugins/explorer/jsenv_plugin_explorer.js +23 -25
- package/src/plugins/file_urls/jsenv_plugin_file_urls.js +60 -60
- package/src/plugins/global_scenarios/jsenv_plugin_global_scenarios.js +5 -5
- package/src/plugins/http_urls/jsenv_plugin_http_urls.js +3 -3
- package/src/plugins/import_meta_hot/babel_plugin_metadata_import_meta_hot.js +35 -35
- package/src/plugins/import_meta_hot/client/import_meta_hot.js +26 -26
- package/src/plugins/import_meta_hot/html_hot_dependencies.js +43 -43
- package/src/plugins/import_meta_hot/jsenv_plugin_import_meta_hot.js +44 -40
- package/src/plugins/import_meta_scenarios/jsenv_plugin_import_meta_scenarios.js +35 -35
- package/src/plugins/import_meta_url/client/import_meta_url_browser.js +21 -21
- package/src/plugins/import_meta_url/client/import_meta_url_commonjs.mjs +3 -3
- package/src/plugins/importmap/jsenv_plugin_importmap.js +54 -54
- package/src/plugins/inline_content_analysis/client/inline_content.js +3 -3
- package/src/plugins/inline_content_analysis/jsenv_plugin_data_urls.js +26 -26
- package/src/plugins/inline_content_analysis/jsenv_plugin_html_inline_content_analysis.js +47 -47
- package/src/plugins/inline_content_analysis/jsenv_plugin_inline_content_analysis.js +9 -9
- package/src/plugins/inline_content_analysis/jsenv_plugin_js_inline_content_analysis.js +101 -101
- package/src/plugins/inlining/jsenv_plugin_inlining.js +9 -9
- package/src/plugins/inlining/jsenv_plugin_inlining_as_data_url.js +11 -11
- package/src/plugins/inlining/jsenv_plugin_inlining_into_html.js +48 -46
- package/src/plugins/node_runtime/jsenv_plugin_node_runtime.js +4 -4
- package/src/plugins/plugin_controller.js +124 -124
- package/src/plugins/plugins.js +30 -30
- package/src/plugins/ribbon/client/ribbon.js +6 -6
- package/src/plugins/ribbon/jsenv_plugin_ribbon.js +15 -15
- package/src/plugins/server_events/client/connection_manager.js +52 -52
- package/src/plugins/server_events/client/event_source_connection.js +36 -36
- package/src/plugins/server_events/client/events_manager.js +37 -37
- package/src/plugins/server_events/client/server_events_client.js +7 -7
- package/src/plugins/server_events/client/web_socket_connection.js +39 -39
- package/src/plugins/server_events/jsenv_plugin_server_events_client_injection.js +9 -9
- package/src/plugins/server_events/server_events_dispatcher.js +43 -43
- package/src/plugins/supervisor/client/supervisor.js +455 -450
- package/src/plugins/supervisor/html_supervisor_injection.js +64 -62
- package/src/plugins/supervisor/js_supervisor_injection.js +67 -67
- package/src/plugins/supervisor/jsenv_plugin_supervisor.js +54 -51
- package/src/plugins/transpilation/as_js_module/convert_js_classic_to_js_module.js +13 -13
- package/src/plugins/transpilation/as_js_module/jsenv_plugin_as_js_module.js +19 -19
- package/src/plugins/transpilation/babel/global_this/babel_plugin_global_this_as_jsenv_import.js +10 -10
- package/src/plugins/transpilation/babel/global_this/client/global_this.js +8 -8
- package/src/plugins/transpilation/babel/helpers/babel_plugin_babel_helpers_as_jsenv_imports.js +16 -16
- package/src/plugins/transpilation/babel/helpers/babel_plugin_structure.js +36 -36
- package/src/plugins/transpilation/babel/helpers/babel_plugins_compatibility.js +3 -3
- package/src/plugins/transpilation/babel/jsenv_plugin_babel.js +24 -24
- package/src/plugins/transpilation/babel/new_stylesheet/babel_plugin_new_stylesheet_as_jsenv_import.js +44 -44
- package/src/plugins/transpilation/babel/new_stylesheet/client/new_stylesheet.js +166 -166
- package/src/plugins/transpilation/babel/regenerator_runtime/babel_plugin_regenerator_runtime_as_jsenv_import.js +10 -10
- package/src/plugins/transpilation/babel/require_babel_plugin.js +6 -6
- package/src/plugins/transpilation/css/jsenv_plugin_css_transpilation.js +20 -20
- package/src/plugins/transpilation/import_assertions/jsenv_plugin_import_assertions.js +62 -62
- package/src/plugins/transpilation/js_module_fallback/client/s.js +214 -209
- package/src/plugins/transpilation/js_module_fallback/convert_js_module_to_js_classic.js +45 -45
- package/src/plugins/transpilation/js_module_fallback/helpers/babel_plugin_transform_import_meta_resolve.js +6 -6
- package/src/plugins/transpilation/js_module_fallback/helpers/babel_plugin_transform_import_meta_url.js +17 -17
- package/src/plugins/transpilation/js_module_fallback/helpers-string.js +1 -1
- package/src/plugins/transpilation/js_module_fallback/jsenv_plugin_js_module_conversion.js +32 -32
- package/src/plugins/transpilation/js_module_fallback/jsenv_plugin_js_module_fallback.js +17 -17
- package/src/plugins/transpilation/js_module_fallback/jsenv_plugin_js_module_fallback_inside_html.js +63 -63
- package/src/plugins/transpilation/js_module_fallback/jsenv_plugin_js_module_fallback_on_workers.js +15 -15
- package/src/plugins/transpilation/jsenv_plugin_import_meta_resolve.js +20 -20
- package/src/plugins/transpilation/jsenv_plugin_top_level_await.js +23 -23
- package/src/plugins/transpilation/jsenv_plugin_transpilation.js +11 -11
- package/src/plugins/url_analysis/css/css_urls.js +12 -12
- package/src/plugins/url_analysis/html/html_urls.js +85 -85
- package/src/plugins/url_analysis/js/js_urls.js +16 -16
- package/src/plugins/url_analysis/jsenv_plugin_reference_expected_types.js +16 -16
- package/src/plugins/url_analysis/jsenv_plugin_url_analysis.js +40 -40
- package/src/plugins/url_analysis/webmanifest/webmanifest_urls.js +12 -12
- package/src/plugins/url_resolution/jsenv_plugin_url_resolution.js +36 -36
- package/src/plugins/url_resolution/node_esm_resolver.js +26 -26
- package/src/plugins/url_version/jsenv_plugin_url_version.js +11 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsenvPluginInliningAsDataUrl } from "./jsenv_plugin_inlining_as_data_url.js"
|
|
2
|
-
import { jsenvPluginInliningIntoHtml } from "./jsenv_plugin_inlining_into_html.js"
|
|
1
|
+
import { jsenvPluginInliningAsDataUrl } from "./jsenv_plugin_inlining_as_data_url.js";
|
|
2
|
+
import { jsenvPluginInliningIntoHtml } from "./jsenv_plugin_inlining_into_html.js";
|
|
3
3
|
|
|
4
4
|
export const jsenvPluginInlining = () => {
|
|
5
5
|
return [
|
|
@@ -7,16 +7,16 @@ export const jsenvPluginInlining = () => {
|
|
|
7
7
|
name: "jsenv:inlining",
|
|
8
8
|
appliesDuring: "*",
|
|
9
9
|
redirectUrl: (reference) => {
|
|
10
|
-
const { searchParams } = reference
|
|
10
|
+
const { searchParams } = reference;
|
|
11
11
|
if (searchParams.has("inline")) {
|
|
12
|
-
const urlObject = new URL(reference.url)
|
|
13
|
-
urlObject.searchParams.delete("inline")
|
|
14
|
-
return urlObject.href
|
|
12
|
+
const urlObject = new URL(reference.url);
|
|
13
|
+
urlObject.searchParams.delete("inline");
|
|
14
|
+
return urlObject.href;
|
|
15
15
|
}
|
|
16
|
-
return null
|
|
16
|
+
return null;
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
jsenvPluginInliningAsDataUrl(),
|
|
20
20
|
jsenvPluginInliningIntoHtml(),
|
|
21
|
-
]
|
|
22
|
-
}
|
|
21
|
+
];
|
|
22
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DATA_URL } from "@jsenv/urls"
|
|
1
|
+
import { DATA_URL } from "@jsenv/urls";
|
|
2
2
|
|
|
3
3
|
export const jsenvPluginInliningAsDataUrl = () => {
|
|
4
4
|
return {
|
|
@@ -19,29 +19,29 @@ export const jsenvPluginInliningAsDataUrl = () => {
|
|
|
19
19
|
!reference.original ||
|
|
20
20
|
!reference.original.searchParams.has("inline")
|
|
21
21
|
) {
|
|
22
|
-
return null
|
|
22
|
+
return null;
|
|
23
23
|
}
|
|
24
24
|
// <link rel="stylesheet"> and <script> can be inlined in the html
|
|
25
25
|
if (
|
|
26
26
|
reference.type === "link_href" &&
|
|
27
27
|
reference.subtype === "stylesheet"
|
|
28
28
|
) {
|
|
29
|
-
return null
|
|
29
|
+
return null;
|
|
30
30
|
}
|
|
31
31
|
if (reference.type === "script") {
|
|
32
|
-
return null
|
|
32
|
+
return null;
|
|
33
33
|
}
|
|
34
34
|
return (async () => {
|
|
35
|
-
const urlInfo = context.urlGraph.getUrlInfo(reference.url)
|
|
36
|
-
await context.cook(urlInfo, { reference })
|
|
35
|
+
const urlInfo = context.urlGraph.getUrlInfo(reference.url);
|
|
36
|
+
await context.cook(urlInfo, { reference });
|
|
37
37
|
const specifier = DATA_URL.stringify({
|
|
38
38
|
mediaType: urlInfo.contentType,
|
|
39
39
|
base64Flag: true,
|
|
40
40
|
data: Buffer.from(urlInfo.content).toString("base64"),
|
|
41
|
-
})
|
|
42
|
-
return specifier
|
|
43
|
-
})()
|
|
41
|
+
});
|
|
42
|
+
return specifier;
|
|
43
|
+
})();
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
|
-
}
|
|
47
|
-
}
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
setHtmlNodeAttributes,
|
|
9
9
|
setHtmlNodeText,
|
|
10
10
|
getHtmlNodePosition,
|
|
11
|
-
} from "@jsenv/ast"
|
|
11
|
+
} from "@jsenv/ast";
|
|
12
12
|
|
|
13
13
|
export const jsenvPluginInliningIntoHtml = () => {
|
|
14
14
|
return {
|
|
@@ -16,9 +16,9 @@ export const jsenvPluginInliningIntoHtml = () => {
|
|
|
16
16
|
appliesDuring: "*",
|
|
17
17
|
transformUrlContent: {
|
|
18
18
|
html: async (urlInfo, context) => {
|
|
19
|
-
const htmlAst = parseHtmlString(urlInfo.content)
|
|
20
|
-
const mutations = []
|
|
21
|
-
const actions = []
|
|
19
|
+
const htmlAst = parseHtmlString(urlInfo.content);
|
|
20
|
+
const mutations = [];
|
|
21
|
+
const actions = [];
|
|
22
22
|
|
|
23
23
|
const onStyleSheet = (linkNode, { href }) => {
|
|
24
24
|
const linkReference = context.referenceUtils.find(
|
|
@@ -26,21 +26,21 @@ export const jsenvPluginInliningIntoHtml = () => {
|
|
|
26
26
|
ref.generatedSpecifier === href &&
|
|
27
27
|
ref.type === "link_href" &&
|
|
28
28
|
ref.subtype === "stylesheet",
|
|
29
|
-
)
|
|
29
|
+
);
|
|
30
30
|
if (
|
|
31
31
|
!linkReference.original ||
|
|
32
32
|
!linkReference.original.searchParams.has("inline")
|
|
33
33
|
) {
|
|
34
|
-
return
|
|
34
|
+
return;
|
|
35
35
|
}
|
|
36
|
-
const linkUrlInfo = context.urlGraph.getUrlInfo(linkReference.url)
|
|
36
|
+
const linkUrlInfo = context.urlGraph.getUrlInfo(linkReference.url);
|
|
37
37
|
actions.push(async () => {
|
|
38
38
|
await context.cook(linkUrlInfo, {
|
|
39
39
|
reference: linkReference,
|
|
40
|
-
})
|
|
40
|
+
});
|
|
41
41
|
const { line, column, isOriginal } = getHtmlNodePosition(linkNode, {
|
|
42
42
|
preferOriginal: true,
|
|
43
|
-
})
|
|
43
|
+
});
|
|
44
44
|
context.referenceUtils.becomesInline(linkReference, {
|
|
45
45
|
line: line - 1,
|
|
46
46
|
column,
|
|
@@ -48,7 +48,7 @@ export const jsenvPluginInliningIntoHtml = () => {
|
|
|
48
48
|
specifier: linkReference.generatedSpecifier,
|
|
49
49
|
content: linkUrlInfo.content,
|
|
50
50
|
contentType: linkUrlInfo.contentType,
|
|
51
|
-
})
|
|
51
|
+
});
|
|
52
52
|
mutations.push(() => {
|
|
53
53
|
setHtmlNodeAttributes(linkNode, {
|
|
54
54
|
"inlined-from-href": href,
|
|
@@ -59,36 +59,38 @@ export const jsenvPluginInliningIntoHtml = () => {
|
|
|
59
59
|
"crossorigin": undefined,
|
|
60
60
|
"integrity": undefined,
|
|
61
61
|
"jsenv-inlined-by": "jsenv:inlining_into_html",
|
|
62
|
-
})
|
|
63
|
-
linkNode.nodeName = "style"
|
|
64
|
-
linkNode.tagName = "style"
|
|
62
|
+
});
|
|
63
|
+
linkNode.nodeName = "style";
|
|
64
|
+
linkNode.tagName = "style";
|
|
65
65
|
setHtmlNodeText(linkNode, linkUrlInfo.content, {
|
|
66
66
|
indentation: "auto",
|
|
67
|
-
})
|
|
68
|
-
})
|
|
69
|
-
})
|
|
70
|
-
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
71
|
const onScriptWithSrc = (scriptNode, { src }) => {
|
|
72
72
|
const scriptReference = context.referenceUtils.find(
|
|
73
73
|
(ref) => ref.generatedSpecifier === src && ref.type === "script",
|
|
74
|
-
)
|
|
74
|
+
);
|
|
75
75
|
if (
|
|
76
76
|
!scriptReference.original ||
|
|
77
77
|
!scriptReference.original.searchParams.has("inline")
|
|
78
78
|
) {
|
|
79
|
-
return
|
|
79
|
+
return;
|
|
80
80
|
}
|
|
81
|
-
const scriptUrlInfo = context.urlGraph.getUrlInfo(
|
|
81
|
+
const scriptUrlInfo = context.urlGraph.getUrlInfo(
|
|
82
|
+
scriptReference.url,
|
|
83
|
+
);
|
|
82
84
|
actions.push(async () => {
|
|
83
85
|
await context.cook(scriptUrlInfo, {
|
|
84
86
|
reference: scriptReference,
|
|
85
|
-
})
|
|
87
|
+
});
|
|
86
88
|
const { line, column, isOriginal } = getHtmlNodePosition(
|
|
87
89
|
scriptNode,
|
|
88
90
|
{
|
|
89
91
|
preferOriginal: true,
|
|
90
92
|
},
|
|
91
|
-
)
|
|
93
|
+
);
|
|
92
94
|
context.referenceUtils.becomesInline(scriptReference, {
|
|
93
95
|
line: line - 1,
|
|
94
96
|
column,
|
|
@@ -96,7 +98,7 @@ export const jsenvPluginInliningIntoHtml = () => {
|
|
|
96
98
|
specifier: scriptReference.generatedSpecifier,
|
|
97
99
|
content: scriptUrlInfo.content,
|
|
98
100
|
contentType: scriptUrlInfo.contentType,
|
|
99
|
-
})
|
|
101
|
+
});
|
|
100
102
|
mutations.push(() => {
|
|
101
103
|
setHtmlNodeAttributes(scriptNode, {
|
|
102
104
|
"inlined-from-src": src,
|
|
@@ -104,46 +106,46 @@ export const jsenvPluginInliningIntoHtml = () => {
|
|
|
104
106
|
"crossorigin": undefined,
|
|
105
107
|
"integrity": undefined,
|
|
106
108
|
"jsenv-inlined-by": "jsenv:inlining_into_html",
|
|
107
|
-
})
|
|
109
|
+
});
|
|
108
110
|
setHtmlNodeText(scriptNode, scriptUrlInfo.content, {
|
|
109
111
|
indentation: "auto",
|
|
110
|
-
})
|
|
111
|
-
})
|
|
112
|
-
})
|
|
113
|
-
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
};
|
|
114
116
|
|
|
115
117
|
visitHtmlNodes(htmlAst, {
|
|
116
118
|
link: (linkNode) => {
|
|
117
|
-
const rel = getHtmlNodeAttribute(linkNode, "rel")
|
|
119
|
+
const rel = getHtmlNodeAttribute(linkNode, "rel");
|
|
118
120
|
if (rel !== "stylesheet") {
|
|
119
|
-
return
|
|
121
|
+
return;
|
|
120
122
|
}
|
|
121
|
-
const href = getHtmlNodeAttribute(linkNode, "href")
|
|
123
|
+
const href = getHtmlNodeAttribute(linkNode, "href");
|
|
122
124
|
if (!href) {
|
|
123
|
-
return
|
|
125
|
+
return;
|
|
124
126
|
}
|
|
125
|
-
onStyleSheet(linkNode, { href })
|
|
127
|
+
onStyleSheet(linkNode, { href });
|
|
126
128
|
},
|
|
127
129
|
script: (scriptNode) => {
|
|
128
|
-
const { type } = analyzeScriptNode(scriptNode)
|
|
129
|
-
const scriptNodeText = getHtmlNodeText(scriptNode)
|
|
130
|
+
const { type } = analyzeScriptNode(scriptNode);
|
|
131
|
+
const scriptNodeText = getHtmlNodeText(scriptNode);
|
|
130
132
|
if (scriptNodeText) {
|
|
131
|
-
return
|
|
133
|
+
return;
|
|
132
134
|
}
|
|
133
|
-
const src = getHtmlNodeAttribute(scriptNode, "src")
|
|
135
|
+
const src = getHtmlNodeAttribute(scriptNode, "src");
|
|
134
136
|
if (!src) {
|
|
135
|
-
return
|
|
137
|
+
return;
|
|
136
138
|
}
|
|
137
|
-
onScriptWithSrc(scriptNode, { type, src })
|
|
139
|
+
onScriptWithSrc(scriptNode, { type, src });
|
|
138
140
|
},
|
|
139
|
-
})
|
|
141
|
+
});
|
|
140
142
|
if (actions.length > 0) {
|
|
141
|
-
await Promise.all(actions.map((action) => action()))
|
|
143
|
+
await Promise.all(actions.map((action) => action()));
|
|
142
144
|
}
|
|
143
|
-
mutations.forEach((mutation) => mutation())
|
|
144
|
-
const htmlModified = stringifyHtmlAst(htmlAst)
|
|
145
|
-
return htmlModified
|
|
145
|
+
mutations.forEach((mutation) => mutation());
|
|
146
|
+
const htmlModified = stringifyHtmlAst(htmlAst);
|
|
147
|
+
return htmlModified;
|
|
146
148
|
},
|
|
147
149
|
},
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
+
};
|
|
151
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export const jsenvPluginNodeRuntime = ({ runtimeCompat }) => {
|
|
2
|
-
const nodeFound = Object.keys(runtimeCompat).includes("node")
|
|
2
|
+
const nodeFound = Object.keys(runtimeCompat).includes("node");
|
|
3
3
|
if (!nodeFound) {
|
|
4
|
-
return []
|
|
4
|
+
return [];
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
// what do we need to do?
|
|
8
8
|
return {
|
|
9
9
|
name: "jsenv:node_runtime",
|
|
10
10
|
appliesDuring: "*",
|
|
11
|
-
}
|
|
12
|
-
}
|
|
11
|
+
};
|
|
12
|
+
};
|