@jsenv/core 28.1.3 → 28.2.2
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/script_type_module_supervisor.js +8 -13
- package/dist/js/supervisor.js +690 -504
- package/dist/main.js +13332 -13179
- package/package.json +5 -5
- package/readme.md +3 -3
- package/src/build/build.js +980 -713
- package/src/build/inject_global_version_mappings.js +5 -20
- package/src/build/start_build_server.js +2 -2
- package/src/dev/start_dev_server.js +6 -3
- package/src/omega/compat/runtime_compat.js +9 -6
- package/src/omega/errors.js +3 -0
- package/src/omega/fetched_content_compliance.js +2 -2
- package/src/omega/kitchen.js +191 -146
- package/src/omega/server/file_service.js +104 -71
- package/src/omega/url_graph/url_graph_loader.js +77 -0
- package/src/omega/url_graph/url_info_transformations.js +12 -15
- package/src/omega/url_graph.js +118 -101
- package/src/plugins/autoreload/jsenv_plugin_autoreload_client.js +1 -0
- package/src/plugins/autoreload/jsenv_plugin_autoreload_server.js +34 -36
- package/src/plugins/autoreload/jsenv_plugin_hmr.js +3 -2
- package/src/plugins/bundling/js_module/{bundle_js_module.js → bundle_js_modules.js} +51 -14
- package/src/plugins/bundling/jsenv_plugin_bundling.js +2 -2
- package/src/plugins/import_meta_hot/jsenv_plugin_import_meta_hot.js +11 -0
- package/src/plugins/inline/jsenv_plugin_html_inline_content.js +73 -62
- package/src/plugins/node_esm_resolution/jsenv_plugin_node_esm_resolution.js +77 -89
- package/src/plugins/plugin_controller.js +26 -22
- package/src/plugins/server_events/jsenv_plugin_server_events_client_injection.js +1 -0
- package/src/plugins/supervisor/client/script_type_module_supervisor.js +7 -9
- package/src/plugins/supervisor/client/supervisor.js +99 -52
- package/src/plugins/supervisor/jsenv_plugin_supervisor.js +2 -4
- package/src/plugins/transpilation/as_js_classic/async-to-promises.js +16 -0
- package/src/plugins/transpilation/as_js_classic/convert_js_module_to_js_classic.js +85 -0
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic.js +48 -190
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_conversion.js +104 -0
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_html.js +161 -240
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_library.js +92 -0
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_workers.js +19 -12
- package/src/plugins/transpilation/babel/jsenv_plugin_babel.js +1 -24
- package/src/plugins/transpilation/import_assertions/jsenv_plugin_import_assertions.js +82 -52
- package/src/plugins/transpilation/jsenv_plugin_transpilation.js +12 -13
- package/src/plugins/url_analysis/html/html_urls.js +91 -34
- package/src/plugins/url_analysis/js/js_urls.js +5 -4
- package/src/plugins/url_resolution/jsenv_plugin_url_resolution.js +1 -0
- package/src/test/execute_plan.js +3 -8
- package/src/build/inject_service_worker_urls.js +0 -78
- package/src/build/resync_resource_hints.js +0 -112
- package/src/omega/url_graph/url_graph_load.js +0 -74
|
@@ -9,31 +9,16 @@ import {
|
|
|
9
9
|
} from "@jsenv/ast"
|
|
10
10
|
|
|
11
11
|
import { isWebWorkerUrlInfo } from "@jsenv/core/src/omega/web_workers.js"
|
|
12
|
-
import { GRAPH } from "./graph_utils.js"
|
|
13
12
|
|
|
14
|
-
export const
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
export const injectVersionMappings = async ({
|
|
14
|
+
urlInfo,
|
|
15
|
+
kitchen,
|
|
17
16
|
versionMappings,
|
|
18
17
|
}) => {
|
|
19
|
-
await Promise.all(
|
|
20
|
-
GRAPH.map(finalGraph, async (urlInfo) => {
|
|
21
|
-
if (urlInfo.isEntryPoint) {
|
|
22
|
-
await injectVersionMappings({
|
|
23
|
-
urlInfo,
|
|
24
|
-
kitchen: finalGraphKitchen,
|
|
25
|
-
versionMappings,
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
}),
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const injectVersionMappings = async ({ urlInfo, kitchen, versionMappings }) => {
|
|
33
18
|
const injector = injectors[urlInfo.type]
|
|
34
19
|
if (injector) {
|
|
35
|
-
const { content, sourcemap } = injector(urlInfo, { versionMappings })
|
|
36
|
-
|
|
20
|
+
const { content, sourcemap } = await injector(urlInfo, { versionMappings })
|
|
21
|
+
kitchen.urlInfoTransformer.applyFinalTransformations(urlInfo, {
|
|
37
22
|
content,
|
|
38
23
|
sourcemap,
|
|
39
24
|
})
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
registerDirectoryLifecycle,
|
|
27
27
|
} from "@jsenv/filesystem"
|
|
28
28
|
import { Abort, raceProcessTeardownEvents } from "@jsenv/abort"
|
|
29
|
-
import { createLogger,
|
|
29
|
+
import { createLogger, createTaskLog } from "@jsenv/log"
|
|
30
30
|
import { getCallerPosition } from "@jsenv/urls"
|
|
31
31
|
|
|
32
32
|
import { createReloadableWorker } from "@jsenv/core/src/helpers/worker_reload.js"
|
|
@@ -146,7 +146,7 @@ export const startBuildServer = async ({
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
const startBuildServerTask = createTaskLog("start build server", {
|
|
149
|
-
disabled: !
|
|
149
|
+
disabled: !logger.levels.info,
|
|
150
150
|
})
|
|
151
151
|
const server = await startServer({
|
|
152
152
|
signal,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
registerDirectoryLifecycle,
|
|
5
5
|
} from "@jsenv/filesystem"
|
|
6
6
|
import { Abort, raceProcessTeardownEvents } from "@jsenv/abort"
|
|
7
|
-
import { createLogger,
|
|
7
|
+
import { createLogger, createTaskLog } from "@jsenv/log"
|
|
8
8
|
import { getCallerPosition } from "@jsenv/urls"
|
|
9
9
|
|
|
10
10
|
import { defaultRuntimeCompat } from "@jsenv/core/src/build/build.js"
|
|
@@ -32,6 +32,7 @@ export const startDevServer = async ({
|
|
|
32
32
|
clientFiles = {
|
|
33
33
|
"./src/": true,
|
|
34
34
|
"./tests/": true,
|
|
35
|
+
"./package.json": true,
|
|
35
36
|
},
|
|
36
37
|
devServerFiles = {
|
|
37
38
|
"./package.json": true,
|
|
@@ -67,7 +68,9 @@ export const startDevServer = async ({
|
|
|
67
68
|
sourcemaps = "inline",
|
|
68
69
|
sourcemapsSourcesProtocol,
|
|
69
70
|
sourcemapsSourcesContent,
|
|
70
|
-
|
|
71
|
+
// no real need to write files during github workflow
|
|
72
|
+
// and mitigates https://github.com/actions/runner-images/issues/3885
|
|
73
|
+
writeGeneratedFiles = !process.env.CI,
|
|
71
74
|
}) => {
|
|
72
75
|
const logger = createLogger({ logLevel })
|
|
73
76
|
rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl)
|
|
@@ -139,7 +142,7 @@ export const startDevServer = async ({
|
|
|
139
142
|
}
|
|
140
143
|
|
|
141
144
|
const startDevServerTask = createTaskLog("start dev server", {
|
|
142
|
-
disabled: !
|
|
145
|
+
disabled: !logger.levels.info,
|
|
143
146
|
})
|
|
144
147
|
|
|
145
148
|
const server = await startOmegaServer({
|
|
@@ -10,12 +10,15 @@ export const RUNTIME_COMPAT = {
|
|
|
10
10
|
const runtimeCompat = {
|
|
11
11
|
...originalRuntimeCompat,
|
|
12
12
|
}
|
|
13
|
-
Object.keys(
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
Object.keys(originalRuntimeCompat).forEach((runtimeName) => {
|
|
14
|
+
const secondVersion = featureCompat[runtimeName] // the version supported by the feature
|
|
15
|
+
if (secondVersion) {
|
|
16
|
+
const firstVersion = originalRuntimeCompat[runtimeName]
|
|
17
|
+
runtimeCompat[runtimeName] = findHighestVersion(
|
|
18
|
+
firstVersion,
|
|
19
|
+
secondVersion,
|
|
20
|
+
)
|
|
21
|
+
}
|
|
19
22
|
})
|
|
20
23
|
return runtimeCompat
|
|
21
24
|
},
|
package/src/omega/errors.js
CHANGED
|
@@ -168,6 +168,9 @@ export const createFinalizeUrlContentError = ({
|
|
|
168
168
|
...detailsFromPluginController(pluginController),
|
|
169
169
|
}),
|
|
170
170
|
)
|
|
171
|
+
if (error && error instanceof Error) {
|
|
172
|
+
finalizeError.cause = error
|
|
173
|
+
}
|
|
171
174
|
finalizeError.name = "FINALIZE_URL_CONTENT_ERROR"
|
|
172
175
|
finalizeError.reason = `An error occured during "finalizeUrlContent"`
|
|
173
176
|
return finalizeError
|
|
@@ -4,13 +4,13 @@ export const assertFetchedContentCompliance = ({ reference, urlInfo }) => {
|
|
|
4
4
|
const { expectedContentType } = reference
|
|
5
5
|
if (expectedContentType && urlInfo.contentType !== expectedContentType) {
|
|
6
6
|
throw new Error(
|
|
7
|
-
`Unexpected content-type on url:
|
|
7
|
+
`Unexpected content-type on url: "${expectedContentType}" was expected but got "${urlInfo.contentType}`,
|
|
8
8
|
)
|
|
9
9
|
}
|
|
10
10
|
const { expectedType } = reference
|
|
11
11
|
if (expectedType && urlInfo.type !== expectedType) {
|
|
12
12
|
throw new Error(
|
|
13
|
-
`Unexpected type on url:
|
|
13
|
+
`Unexpected type on url: "${expectedType}" was expected but got "${urlInfo.type}"`,
|
|
14
14
|
)
|
|
15
15
|
}
|
|
16
16
|
const { integrity } = reference
|