@jsenv/core 36.0.2 → 36.1.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/jsenv_core.js +149 -879
- package/package.json +4 -4
- package/src/build/build.js +29 -40
- package/src/dev/file_service.js +18 -3
- package/src/dev/start_dev_server.js +2 -0
- package/src/kitchen/kitchen.js +65 -12
- package/src/kitchen/url_graph/url_graph_report.js +9 -5
- package/src/kitchen/url_graph.js +0 -1
- package/src/plugins/plugin_controller.js +15 -7
- package/src/plugins/plugins.js +2 -1
- package/src/plugins/protocol_file/jsenv_plugin_protocol_file.js +44 -39
- package/src/plugins/protocol_http/jsenv_plugin_protocol_http.js +4 -3
- package/src/plugins/reference_analysis/jsenv_plugin_reference_analysis.js +0 -88
- package/dist/js/supervisor.js +0 -1175
- package/src/helpers/basic_fetch.js +0 -53
- package/src/helpers/ping_server.js +0 -30
- package/src/plugins/supervisor/client/supervisor.js +0 -1153
- package/src/plugins/supervisor/html_supervisor_injection.js +0 -281
- package/src/plugins/supervisor/js_supervisor_injection.js +0 -283
- package/src/plugins/supervisor/jsenv_plugin_supervisor.js +0 -218
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { URL_META } from "@jsenv/url-meta";
|
|
2
|
-
|
|
3
1
|
import { jsenvPluginReferenceExpectedTypes } from "./jsenv_plugin_reference_expected_types.js";
|
|
4
2
|
import { jsenvPluginDirectoryReferenceAnalysis } from "./directory/jsenv_plugin_directory_reference_analysis.js";
|
|
5
3
|
import { jsenvPluginDataUrlsAnalysis } from "./data_urls/jsenv_plugin_data_urls_analysis.js";
|
|
@@ -9,21 +7,12 @@ import { jsenvPluginCssReferenceAnalysis } from "./css/jsenv_plugin_css_referenc
|
|
|
9
7
|
import { jsenvPluginJsReferenceAnalysis } from "./js/jsenv_plugin_js_reference_analysis.js";
|
|
10
8
|
|
|
11
9
|
export const jsenvPluginReferenceAnalysis = ({
|
|
12
|
-
include,
|
|
13
|
-
supportedProtocols = ["file:", "data:", "virtual:", "http:", "https:"],
|
|
14
|
-
|
|
15
|
-
ignoreProtocol = "remove",
|
|
16
10
|
inlineContent = true,
|
|
17
11
|
inlineConvertedScript = false,
|
|
18
12
|
fetchInlineUrls = true,
|
|
19
13
|
allowEscapeForVersioning = false,
|
|
20
14
|
}) => {
|
|
21
15
|
return [
|
|
22
|
-
jsenvPluginReferenceAnalysisInclude({
|
|
23
|
-
include,
|
|
24
|
-
supportedProtocols,
|
|
25
|
-
ignoreProtocol,
|
|
26
|
-
}),
|
|
27
16
|
jsenvPluginDirectoryReferenceAnalysis(),
|
|
28
17
|
jsenvPluginHtmlReferenceAnalysis({
|
|
29
18
|
inlineContent,
|
|
@@ -43,83 +32,6 @@ export const jsenvPluginReferenceAnalysis = ({
|
|
|
43
32
|
];
|
|
44
33
|
};
|
|
45
34
|
|
|
46
|
-
const jsenvPluginReferenceAnalysisInclude = ({
|
|
47
|
-
include,
|
|
48
|
-
supportedProtocols,
|
|
49
|
-
ignoreProtocol,
|
|
50
|
-
}) => {
|
|
51
|
-
// eslint-disable-next-line no-unused-vars
|
|
52
|
-
let getIncludeInfo = (url) => undefined;
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
name: "jsenv:reference_analysis_include",
|
|
56
|
-
appliesDuring: "*",
|
|
57
|
-
init: ({ rootDirectoryUrl }) => {
|
|
58
|
-
if (include) {
|
|
59
|
-
const associations = URL_META.resolveAssociations(
|
|
60
|
-
{ include },
|
|
61
|
-
rootDirectoryUrl,
|
|
62
|
-
);
|
|
63
|
-
getIncludeInfo = (url) => {
|
|
64
|
-
const { include } = URL_META.applyAssociations({
|
|
65
|
-
url,
|
|
66
|
-
associations,
|
|
67
|
-
});
|
|
68
|
-
return include;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
redirectReference: (reference) => {
|
|
73
|
-
if (reference.mustIgnore !== undefined) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if (
|
|
77
|
-
reference.specifier[0] === "#" &&
|
|
78
|
-
// For Html, css and in general "#" refer to a resource in the page
|
|
79
|
-
// so that urls must be kept intact
|
|
80
|
-
// However for js import specifiers they have a different meaning and we want
|
|
81
|
-
// to resolve them (https://nodejs.org/api/packages.html#imports for instance)
|
|
82
|
-
reference.type !== "js_import"
|
|
83
|
-
) {
|
|
84
|
-
reference.mustIgnore = true;
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (reference.url.startsWith("ignore:")) {
|
|
88
|
-
reference.mustIgnore = true;
|
|
89
|
-
if (ignoreProtocol === "remove") {
|
|
90
|
-
reference.specifier = reference.specifier.slice("ignore:".length);
|
|
91
|
-
}
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const includeInfo = getIncludeInfo(reference.url);
|
|
95
|
-
if (includeInfo === true) {
|
|
96
|
-
reference.mustIgnore = false;
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (includeInfo === false) {
|
|
100
|
-
reference.mustIgnore = true;
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const { protocol } = new URL(reference.url);
|
|
104
|
-
const protocolIsSupported = supportedProtocols.some(
|
|
105
|
-
(supportedProtocol) => protocol === supportedProtocol,
|
|
106
|
-
);
|
|
107
|
-
if (!protocolIsSupported) {
|
|
108
|
-
reference.mustIgnore = true;
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
formatReference: (reference) => {
|
|
112
|
-
if (
|
|
113
|
-
ignoreProtocol === "inject" &&
|
|
114
|
-
reference.mustIgnore &&
|
|
115
|
-
!reference.url.startsWith("ignore:")
|
|
116
|
-
) {
|
|
117
|
-
reference.specifier = `ignore:${reference.specifier}`;
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
|
|
123
35
|
const jsenvPluginInlineContentFetcher = () => {
|
|
124
36
|
return {
|
|
125
37
|
name: "jsenv:inline_content_fetcher",
|