@jsenv/core 36.3.1 → 37.0.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/dist/js/autoreload.js +6 -5
- package/dist/js/import_meta_hot.js +4 -4
- package/dist/js/server_events_client.js +422 -304
- package/dist/jsenv_core.js +3819 -3256
- package/package.json +16 -16
- package/src/build/build.js +342 -658
- package/src/build/build_urls_generator.js +8 -8
- package/src/build/build_versions_manager.js +495 -0
- package/src/build/version_mappings_injection.js +27 -16
- package/src/dev/file_service.js +80 -91
- package/src/dev/start_dev_server.js +5 -3
- package/src/kitchen/errors.js +16 -16
- package/src/kitchen/fetched_content_compliance.js +4 -8
- package/src/kitchen/kitchen.js +367 -939
- package/src/kitchen/prepend_content.js +13 -35
- package/src/kitchen/url_graph/references.js +713 -0
- package/src/kitchen/url_graph/sort_by_dependencies.js +2 -2
- package/src/kitchen/url_graph/url_content.js +96 -0
- package/src/kitchen/url_graph/url_graph.js +439 -0
- package/src/kitchen/url_graph/url_graph_report.js +6 -4
- package/src/kitchen/url_graph/url_graph_visitor.js +14 -12
- package/src/kitchen/url_graph/url_info_transformations.js +180 -184
- package/src/plugins/autoreload/client/autoreload.js +1 -0
- package/src/plugins/autoreload/client/reload.js +6 -6
- package/src/plugins/autoreload/jsenv_plugin_autoreload.js +2 -2
- package/src/plugins/autoreload/jsenv_plugin_autoreload_client.js +2 -2
- package/src/plugins/autoreload/jsenv_plugin_autoreload_server.js +84 -78
- package/src/plugins/autoreload/jsenv_plugin_hot_search_param.js +52 -0
- package/src/plugins/cache_control/jsenv_plugin_cache_control.js +1 -1
- package/src/plugins/commonjs_globals/jsenv_plugin_commonjs_globals.js +2 -2
- package/src/plugins/global_scenarios/jsenv_plugin_global_scenarios.js +3 -3
- package/src/plugins/import_meta_hot/client/import_meta_hot.js +4 -4
- package/src/plugins/import_meta_hot/jsenv_plugin_import_meta_hot.js +18 -20
- package/src/plugins/import_meta_scenarios/jsenv_plugin_import_meta_scenarios.js +2 -2
- package/src/plugins/importmap/jsenv_plugin_importmap.js +35 -37
- package/src/plugins/inlining/jsenv_plugin_inlining.js +1 -17
- package/src/plugins/inlining/jsenv_plugin_inlining_as_data_url.js +70 -50
- package/src/plugins/inlining/jsenv_plugin_inlining_into_html.js +72 -54
- package/src/plugins/plugin_controller.js +92 -27
- package/src/plugins/protocol_file/jsenv_plugin_protocol_file.js +18 -20
- package/src/plugins/reference_analysis/css/jsenv_plugin_css_reference_analysis.js +4 -5
- package/src/plugins/reference_analysis/data_urls/jsenv_plugin_data_urls_analysis.js +18 -16
- package/src/plugins/reference_analysis/directory/jsenv_plugin_directory_reference_analysis.js +13 -20
- package/src/plugins/reference_analysis/html/jsenv_plugin_html_reference_analysis.js +55 -72
- package/src/plugins/reference_analysis/js/jsenv_plugin_js_reference_analysis.js +33 -42
- package/src/plugins/reference_analysis/jsenv_plugin_reference_analysis.js +16 -7
- package/src/plugins/reference_analysis/webmanifest/jsenv_plugin_webmanifest_reference_analysis.js +4 -3
- package/src/plugins/resolution_node_esm/jsenv_plugin_node_esm_resolution.js +16 -6
- package/src/plugins/resolution_node_esm/node_esm_resolver.js +30 -24
- package/src/plugins/resolution_web/jsenv_plugin_web_resolution.js +8 -5
- package/src/plugins/ribbon/jsenv_plugin_ribbon.js +3 -3
- package/src/plugins/server_events/client/server_events_client.js +460 -15
- package/src/plugins/server_events/jsenv_plugin_server_events_client_injection.js +13 -29
- package/src/plugins/version_search_param/jsenv_plugin_version_search_param.js +1 -1
- package/src/build/version_generator.js +0 -19
- package/src/kitchen/url_graph/url_graph_loader.js +0 -77
- package/src/kitchen/url_graph.js +0 -322
- package/src/plugins/autoreload/jsenv_plugin_hmr.js +0 -42
- package/src/plugins/resolution_node_esm/url_type_from_reference.js +0 -13
- package/src/plugins/server_events/client/connection_manager.js +0 -170
- package/src/plugins/server_events/client/event_source_connection.js +0 -83
- package/src/plugins/server_events/client/events_manager.js +0 -75
- package/src/plugins/server_events/client/web_socket_connection.js +0 -81
- /package/src/kitchen/{url_specifier_encoding.js → url_graph/url_specifier_encoding.js} +0 -0
|
@@ -7,8 +7,7 @@ import {
|
|
|
7
7
|
applyBabelPlugins,
|
|
8
8
|
} from "@jsenv/ast";
|
|
9
9
|
|
|
10
|
-
export const prependContent = (
|
|
11
|
-
urlInfoTransformer,
|
|
10
|
+
export const prependContent = async (
|
|
12
11
|
urlInfoReceivingCode,
|
|
13
12
|
urlInfoToPrepend,
|
|
14
13
|
) => {
|
|
@@ -22,42 +21,29 @@ export const prependContent = (
|
|
|
22
21
|
urlInfoReceivingCode.type === "html" &&
|
|
23
22
|
urlInfoToPrepend.type === "js_classic"
|
|
24
23
|
) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
urlInfoReceivingCode,
|
|
28
|
-
urlInfoToPrepend,
|
|
29
|
-
);
|
|
24
|
+
prependJsClassicInHtml(urlInfoReceivingCode, urlInfoToPrepend);
|
|
25
|
+
return;
|
|
30
26
|
}
|
|
31
27
|
if (
|
|
32
28
|
urlInfoReceivingCode.type === "js_classic" &&
|
|
33
29
|
urlInfoToPrepend.type === "js_classic"
|
|
34
30
|
) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
urlInfoReceivingCode,
|
|
38
|
-
urlInfoToPrepend,
|
|
39
|
-
);
|
|
31
|
+
prependJsClassicInJsClassic(urlInfoReceivingCode, urlInfoToPrepend);
|
|
32
|
+
return;
|
|
40
33
|
}
|
|
41
34
|
if (
|
|
42
35
|
urlInfoReceivingCode.type === "js_module" &&
|
|
43
36
|
urlInfoToPrepend.type === "js_classic"
|
|
44
37
|
) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
urlInfoReceivingCode,
|
|
48
|
-
urlInfoToPrepend,
|
|
49
|
-
);
|
|
38
|
+
await prependJsClassicInJsModule(urlInfoReceivingCode, urlInfoToPrepend);
|
|
39
|
+
return;
|
|
50
40
|
}
|
|
51
41
|
throw new Error(
|
|
52
42
|
`cannot prepend content from "${urlInfoToPrepend.type}" into "${urlInfoReceivingCode.type}"`,
|
|
53
43
|
);
|
|
54
44
|
};
|
|
55
45
|
|
|
56
|
-
const prependJsClassicInHtml = (
|
|
57
|
-
urlInfoTransformer,
|
|
58
|
-
htmlUrlInfo,
|
|
59
|
-
urlInfoToPrepend,
|
|
60
|
-
) => {
|
|
46
|
+
const prependJsClassicInHtml = (htmlUrlInfo, urlInfoToPrepend) => {
|
|
61
47
|
const htmlAst = parseHtmlString(htmlUrlInfo.content);
|
|
62
48
|
injectHtmlNodeAsEarlyAsPossible(
|
|
63
49
|
htmlAst,
|
|
@@ -71,14 +57,10 @@ const prependJsClassicInHtml = (
|
|
|
71
57
|
"jsenv:core",
|
|
72
58
|
);
|
|
73
59
|
const content = stringifyHtmlAst(htmlAst);
|
|
74
|
-
|
|
60
|
+
htmlUrlInfo.mutateContent({ content });
|
|
75
61
|
};
|
|
76
62
|
|
|
77
|
-
const prependJsClassicInJsClassic = (
|
|
78
|
-
urlInfoTransformer,
|
|
79
|
-
jsUrlInfo,
|
|
80
|
-
urlInfoToPrepend,
|
|
81
|
-
) => {
|
|
63
|
+
const prependJsClassicInJsClassic = (jsUrlInfo, urlInfoToPrepend) => {
|
|
82
64
|
const magicSource = createMagicSource(jsUrlInfo.content);
|
|
83
65
|
magicSource.prepend(`${urlInfoToPrepend.content}\n\n`);
|
|
84
66
|
const magicResult = magicSource.toContentAndSourcemap();
|
|
@@ -86,17 +68,13 @@ const prependJsClassicInJsClassic = (
|
|
|
86
68
|
jsUrlInfo.sourcemap,
|
|
87
69
|
magicResult.sourcemap,
|
|
88
70
|
);
|
|
89
|
-
|
|
71
|
+
jsUrlInfo.mutateContent({
|
|
90
72
|
content: magicResult.content,
|
|
91
73
|
sourcemap,
|
|
92
74
|
});
|
|
93
75
|
};
|
|
94
76
|
|
|
95
|
-
const prependJsClassicInJsModule = async (
|
|
96
|
-
urlInfoTransformer,
|
|
97
|
-
jsUrlInfo,
|
|
98
|
-
urlInfoToPrepend,
|
|
99
|
-
) => {
|
|
77
|
+
const prependJsClassicInJsModule = async (jsUrlInfo, urlInfoToPrepend) => {
|
|
100
78
|
const { code, map } = await applyBabelPlugins({
|
|
101
79
|
babelPlugins: [
|
|
102
80
|
[
|
|
@@ -108,7 +86,7 @@ const prependJsClassicInJsModule = async (
|
|
|
108
86
|
inputIsJsModule: true,
|
|
109
87
|
inputUrl: jsUrlInfo.originalUrl,
|
|
110
88
|
});
|
|
111
|
-
|
|
89
|
+
jsUrlInfo.mutateContent({
|
|
112
90
|
content: code,
|
|
113
91
|
sourcemap: map,
|
|
114
92
|
});
|