@jsenv/core 25.3.0-alpha.0 → 25.4.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/browser_runtime/asset-manifest.json +2 -2
- package/dist/browser_runtime/{browser_runtime_91c5a3b8.js → browser_runtime_0e3396a1.js} +15 -16
- package/dist/browser_runtime/{browser_runtime_91c5a3b8.js.map → browser_runtime_0e3396a1.js.map} +13 -13
- package/dist/build_manifest.js +5 -5
- package/dist/compile_proxy/asset-manifest.json +2 -2
- package/dist/compile_proxy/compile_proxy.html__inline__20_f4285042.js.map +343 -0
- package/dist/compile_proxy/{compile_proxy_8dfaee51.html → compile_proxy_ab528227.html} +358 -397
- package/dist/redirector/asset-manifest.json +2 -2
- package/dist/redirector/redirector.html__inline__12_404b8295.js.map +349 -0
- package/dist/redirector/{redirector_3e9a97b9.html → redirector_6df2620a.html} +369 -407
- package/dist/toolbar/asset-manifest.json +2 -2
- package/dist/toolbar/toolbar.main_279b3a68.js.map +764 -0
- package/dist/toolbar/{toolbar_361afb84.html → toolbar_0a91ca3b.html} +1509 -1583
- package/dist/toolbar_injector/asset-manifest.json +2 -2
- package/dist/toolbar_injector/{toolbar_injector_fac1e995.js → toolbar_injector_34f6ad8e.js} +18 -15
- package/dist/toolbar_injector/{toolbar_injector_fac1e995.js.map → toolbar_injector_34f6ad8e.js.map} +15 -15
- package/package.json +10 -10
- package/src/buildProject.js +31 -26
- package/src/dev_server.js +111 -92
- package/src/execute.js +3 -8
- package/src/importUsingChildProcess.js +1 -0
- package/src/internal/browser_launcher/{browser_runtime_report.js → browser_runtime_profile.js} +21 -15
- package/src/internal/browser_launcher/executeHtmlFile.js +22 -14
- package/src/internal/browser_launcher/from_playwright.js +6 -4
- package/src/internal/browser_runtime/browser_runtime.js +12 -14
- package/src/internal/browser_runtime/createBrowserRuntime.js +7 -6
- package/src/internal/browser_utils/fetchAndEvalUsingFetch.js +1 -1
- package/src/internal/browser_utils/fetchJson.js +1 -1
- package/src/internal/browser_utils/{fetch-browser.js → fetch_browser.js} +0 -2
- package/src/internal/building/buildUsingRollup.js +41 -57
- package/src/internal/building/rollup_plugin_jsenv.js +28 -8
- package/src/internal/compiling/babel_parse_error.js +9 -0
- package/src/internal/{babel_plugin_transform_import_meta.js → compiling/babel_plugin_transform_import_meta.js} +53 -36
- package/src/internal/compiling/compileFile.js +2 -2
- package/src/internal/compiling/compileHtml.js +1 -1
- package/src/internal/compiling/createCompiledFileService.js +25 -74
- package/src/internal/compiling/js-compilation-service/transformJs.js +151 -23
- package/src/internal/compiling/jsenvCompilerForHtml.js +29 -32
- package/src/internal/compiling/jsenvCompilerForImportmap.js +2 -2
- package/src/internal/compiling/jsenvCompilerForJavaScript.js +2 -4
- package/src/internal/compiling/jsenv_directory/comparison_utils.js +24 -0
- package/src/internal/compiling/{compile-directory/compile-asset.js → jsenv_directory/compile_asset.js} +0 -0
- package/src/internal/compiling/jsenv_directory/compile_context.js +68 -0
- package/src/internal/compiling/jsenv_directory/compile_profile.js +218 -0
- package/src/internal/compiling/{compile-directory/createLockRegistry.js → jsenv_directory/file_lock_registry.js} +0 -0
- package/src/internal/compiling/{compile-directory/createLockRegistry.test.js → jsenv_directory/file_lock_registry.test.js} +2 -1
- package/src/internal/compiling/{compile-directory → jsenv_directory}/fs-optimized-for-cache.js +0 -0
- package/src/internal/compiling/{compile-directory → jsenv_directory}/getOrGenerateCompiledFile.js +2 -2
- package/src/internal/compiling/jsenv_directory/jsenv_directory.js +174 -0
- package/src/internal/compiling/{compile-directory → jsenv_directory}/updateMeta.js +1 -1
- package/src/internal/compiling/{compile-directory → jsenv_directory}/validateCache.js +0 -0
- package/src/internal/compiling/sse_service/sse_service.js +369 -0
- package/src/internal/compiling/startCompileServer.js +157 -804
- package/src/internal/compiling/transformResultToCompilationResult.js +2 -2
- package/src/internal/dev_server/exploring/exploring.js +10 -8
- package/src/internal/dev_server/toolbar/compilation/toolbar.compilation.js +92 -78
- package/src/internal/dev_server/toolbar/settings/toolbar.settings.js +13 -0
- package/src/internal/dev_server/toolbar/toolbar.html +46 -16
- package/src/internal/dev_server/toolbar/toolbar.injector.js +17 -15
- package/src/internal/dev_server/toolbar/toolbar.main.js +12 -16
- package/src/internal/executing/executeConcurrently.js +1 -1
- package/src/internal/executing/executePlan.js +2 -3
- package/src/internal/{generateGroupMap → features}/babel_plugins_compatibility.js +8 -8
- package/src/internal/features/browser_feature_detection/browser_feature_detect_dynamic_import.js +20 -0
- package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_css.js +23 -0
- package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_json.js +25 -0
- package/src/internal/features/browser_feature_detection/browser_feature_detect_importmap.js +37 -0
- package/src/internal/features/browser_feature_detection/browser_feature_detect_new_stylesheet.js +9 -0
- package/src/internal/features/browser_feature_detection/browser_feature_detect_top_level_await.js +14 -0
- package/src/internal/features/browser_feature_detection/browser_feature_detection.js +89 -0
- package/src/internal/{browser_feature_detection → features/browser_feature_detection}/compile_proxy.html +1 -1
- package/src/internal/features/browser_feature_detection/execute_with_script_module.js +24 -0
- package/src/internal/features/features_compat_from_runtime.js +38 -0
- package/src/internal/features/features_compat_from_runtime_support.js +31 -0
- package/src/internal/{generateGroupMap → features}/features_compatibility.js +3 -3
- package/src/internal/{node_feature_detection → features/node_feature_detection}/feature_detect_dynamic_import.mjs +0 -0
- package/src/internal/{node_feature_detection → features/node_feature_detection}/feature_detect_top_level_await.mjs +0 -0
- package/src/internal/{node_feature_detection/nodeSupportsDynamicImport.js → features/node_feature_detection/node_feature_detect_dynamic_import.js} +0 -0
- package/src/internal/{node_feature_detection/nodeSupportsTopLevelAwait.js → features/node_feature_detection/node_feature_detect_top_level_await.js} +0 -0
- package/src/internal/features/node_feature_detection/node_feature_detection.js +66 -0
- package/src/internal/node_launcher/createControllableNodeProcess.js +4 -6
- package/src/internal/node_launcher/node_runtime_report.js +15 -9
- package/src/internal/node_runtime/fetchSource.js +2 -4
- package/src/internal/node_runtime/nodeControllableFile.mjs +1 -5
- package/src/internal/node_runtime/node_execution_systemjs.js +2 -5
- package/src/internal/redirector/redirector.html +40 -0
- package/src/internal/{generateGroupMap/jsenvRuntimeSupport.js → runtime_support/jsenv_runtime_support.js} +0 -0
- package/src/internal/{generateGroupMap → runtime_support}/runtime_support.js +0 -0
- package/src/internal/url_conversion.js +12 -17
- package/src/launchNode.js +29 -41
- package/dist/compile_proxy/compile_proxy.html__inline__20_809f35f7.js.map +0 -392
- package/dist/redirector/redirector.html__inline__15_e391410e.js.map +0 -397
- package/dist/toolbar/toolbar.main_6c1b3d82.js.map +0 -802
- package/src/internal/CONSTANTS.js +0 -11
- package/src/internal/browser_feature_detection/browser_feature_detection.js +0 -274
- package/src/internal/compiling/js-compilation-service/jsenvTransform.js +0 -242
- package/src/internal/dev_server/redirector/redirector.html +0 -48
- package/src/internal/generateGroupMap/generateGroupMap.js +0 -65
- package/src/internal/generateGroupMap/one_runtime_compat.js +0 -38
- package/src/internal/generateGroupMap/runtime_compat.js +0 -34
- package/src/internal/generateGroupMap/runtime_compat_composition.js +0 -76
- package/src/internal/generateGroupMap/shake_babel_plugin_map.js +0 -21
- package/src/internal/node_feature_detection/node_feature_detection.js +0 -117
- package/src/internal/node_runtime/detectNode.js +0 -3
- package/src/internal/runtime/computeCompileIdFromGroupId.js +0 -30
- package/src/internal/runtime/resolveGroup.js +0 -13
- package/src/internal/runtime/resolveRuntimeGroup.js +0 -11
|
@@ -150,33 +150,28 @@ const normalizeUrlMappings = (urlMappings, baseUrl) => {
|
|
|
150
150
|
|
|
151
151
|
export const serverUrlToCompileInfo = (
|
|
152
152
|
url,
|
|
153
|
-
{ compileServerOrigin,
|
|
153
|
+
{ compileServerOrigin, jsenvDirectoryRelativeUrl },
|
|
154
154
|
) => {
|
|
155
|
-
const
|
|
156
|
-
|
|
155
|
+
const jsenvDirectoryServerUrl = resolveDirectoryUrl(
|
|
156
|
+
jsenvDirectoryRelativeUrl,
|
|
157
157
|
compileServerOrigin,
|
|
158
158
|
)
|
|
159
159
|
// not inside compile directory -> nothing to compile
|
|
160
|
-
if (!url.startsWith(
|
|
160
|
+
if (!url.startsWith(jsenvDirectoryServerUrl)) {
|
|
161
161
|
return { insideCompileDirectory: false }
|
|
162
162
|
}
|
|
163
|
-
|
|
164
|
-
const afterOutDirectory = url.slice(outDirectoryServerUrl.length)
|
|
165
|
-
|
|
163
|
+
const afterJsenvDirectory = url.slice(jsenvDirectoryServerUrl.length)
|
|
166
164
|
// serve files inside /.jsenv/* directly without compilation
|
|
167
165
|
// this is just to allow some files to be written inside outDirectory and read directly
|
|
168
|
-
|
|
169
|
-
if (!afterOutDirectory.includes("/") || afterOutDirectory[0] === "/") {
|
|
166
|
+
if (!afterJsenvDirectory.includes("/") || afterJsenvDirectory[0] === "/") {
|
|
170
167
|
return { insideCompileDirectory: true }
|
|
171
168
|
}
|
|
172
|
-
|
|
173
|
-
const parts = afterOutDirectory.split("/")
|
|
169
|
+
const parts = afterJsenvDirectory.split("/")
|
|
174
170
|
const compileId = parts[0]
|
|
175
171
|
// no compileId, we don't know what to compile (not supposed so happen)
|
|
176
172
|
if (compileId === "") {
|
|
177
173
|
return { insideCompileDirectory: true, compileId: null }
|
|
178
174
|
}
|
|
179
|
-
|
|
180
175
|
const afterCompileId = parts.slice(1).join("/")
|
|
181
176
|
// note: afterCompileId can be '' (but not supposed to happen)
|
|
182
177
|
return { insideCompileDirectory: true, compileId, afterCompileId }
|
|
@@ -260,7 +255,7 @@ const originalProjectUrlFromUrl = (
|
|
|
260
255
|
{
|
|
261
256
|
projectDirectoryUrl,
|
|
262
257
|
compileServerOrigin,
|
|
263
|
-
|
|
258
|
+
jsenvDirectoryRelativeUrl,
|
|
264
259
|
compileDirectoryRelativeUrl,
|
|
265
260
|
},
|
|
266
261
|
) => {
|
|
@@ -280,7 +275,7 @@ const originalProjectUrlFromUrl = (
|
|
|
280
275
|
compileDirectoryRelativeUrl = extractCompileDirectoryRelativeUrl({
|
|
281
276
|
serverUrl,
|
|
282
277
|
compileServerOrigin,
|
|
283
|
-
|
|
278
|
+
jsenvDirectoryRelativeUrl,
|
|
284
279
|
})
|
|
285
280
|
if (!compileDirectoryRelativeUrl) {
|
|
286
281
|
return projectUrl
|
|
@@ -305,14 +300,14 @@ const originalProjectUrlFromUrl = (
|
|
|
305
300
|
const extractCompileDirectoryRelativeUrl = ({
|
|
306
301
|
serverUrl,
|
|
307
302
|
compileServerOrigin,
|
|
308
|
-
|
|
303
|
+
jsenvDirectoryRelativeUrl,
|
|
309
304
|
}) => {
|
|
310
305
|
const compileInfo = serverUrlToCompileInfo(serverUrl, {
|
|
311
306
|
compileServerOrigin,
|
|
312
|
-
|
|
307
|
+
jsenvDirectoryRelativeUrl,
|
|
313
308
|
})
|
|
314
309
|
if (compileInfo.compiledId) {
|
|
315
|
-
return `${
|
|
310
|
+
return `${jsenvDirectoryRelativeUrl}${compileInfo.compileId}/`
|
|
316
311
|
}
|
|
317
312
|
return null
|
|
318
313
|
}
|
package/src/launchNode.js
CHANGED
|
@@ -18,7 +18,7 @@ nodeRuntime.launch = async ({
|
|
|
18
18
|
projectDirectoryUrl,
|
|
19
19
|
compileServerId,
|
|
20
20
|
compileServerOrigin,
|
|
21
|
-
|
|
21
|
+
jsenvDirectoryRelativeUrl,
|
|
22
22
|
|
|
23
23
|
measurePerformance,
|
|
24
24
|
collectPerformance,
|
|
@@ -26,6 +26,9 @@ nodeRuntime.launch = async ({
|
|
|
26
26
|
coverageForceIstanbul,
|
|
27
27
|
coverageConfig,
|
|
28
28
|
|
|
29
|
+
moduleOutFormat,
|
|
30
|
+
forceCompilation,
|
|
31
|
+
|
|
29
32
|
debugPort,
|
|
30
33
|
debugMode,
|
|
31
34
|
debugModeInheritBreak,
|
|
@@ -36,26 +39,9 @@ nodeRuntime.launch = async ({
|
|
|
36
39
|
stdout,
|
|
37
40
|
stderr,
|
|
38
41
|
stopAfterExecute,
|
|
39
|
-
forceSystemJs,
|
|
40
42
|
|
|
41
43
|
remap = true,
|
|
42
44
|
}) => {
|
|
43
|
-
if (typeof projectDirectoryUrl !== "string") {
|
|
44
|
-
throw new TypeError(
|
|
45
|
-
`projectDirectoryUrl must be a string, got ${projectDirectoryUrl}`,
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
if (typeof compileServerOrigin !== "string") {
|
|
49
|
-
throw new TypeError(
|
|
50
|
-
`compileServerOrigin must be a string, got ${compileServerOrigin}`,
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
if (typeof outDirectoryRelativeUrl !== "string") {
|
|
54
|
-
throw new TypeError(
|
|
55
|
-
`outDirectoryRelativeUrl must be a string, got ${outDirectoryRelativeUrl}`,
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
45
|
env = {
|
|
60
46
|
...env,
|
|
61
47
|
COVERAGE_ENABLED: collectCoverage,
|
|
@@ -100,7 +86,7 @@ nodeRuntime.launch = async ({
|
|
|
100
86
|
const executeParams = {
|
|
101
87
|
projectDirectoryUrl,
|
|
102
88
|
compileServerOrigin,
|
|
103
|
-
|
|
89
|
+
jsenvDirectoryRelativeUrl,
|
|
104
90
|
jsenvCoreDirectoryUrl,
|
|
105
91
|
|
|
106
92
|
fileRelativeUrl,
|
|
@@ -115,45 +101,47 @@ nodeRuntime.launch = async ({
|
|
|
115
101
|
remap,
|
|
116
102
|
}
|
|
117
103
|
|
|
118
|
-
//
|
|
119
|
-
|
|
104
|
+
// https://nodejs.org/docs/latest-v15.x/api/cli.html#cli_node_v8_coverage_dir
|
|
105
|
+
// instrumentation CAN be handed by process.env.NODE_V8_COVERAGE
|
|
106
|
+
// "transform-instrument" becomes non mandatory
|
|
107
|
+
const coverageHandledFromOutside =
|
|
108
|
+
!coverageForceIstanbul && process.env.NODE_V8_COVERAGE
|
|
109
|
+
const nodeRuntimeReport = await getNodeRuntimeReport({
|
|
120
110
|
runtime: nodeRuntime,
|
|
121
111
|
compileServerId,
|
|
122
112
|
compileServerOrigin,
|
|
123
|
-
outDirectoryRelativeUrl,
|
|
124
|
-
// https://nodejs.org/docs/latest-v15.x/api/cli.html#cli_node_v8_coverage_dir
|
|
125
|
-
// instrumentation CAN be handed by process.env.NODE_V8_COVERAGE
|
|
126
|
-
// "transform-instrument" becomes non mandatory
|
|
127
|
-
coverageHandledFromOutside:
|
|
128
|
-
!coverageForceIstanbul && process.env.NODE_V8_COVERAGE,
|
|
129
|
-
})
|
|
130
|
-
const { canAvoidCompilation, compileId, importDefaultExtension } =
|
|
131
|
-
nodeFeatures
|
|
132
113
|
|
|
114
|
+
moduleOutFormat,
|
|
115
|
+
forceCompilation,
|
|
116
|
+
coverageHandledFromOutside,
|
|
117
|
+
})
|
|
118
|
+
const { compileProfile, compileId } = nodeRuntimeReport
|
|
133
119
|
let executionResult
|
|
134
|
-
if (
|
|
120
|
+
if (compileId) {
|
|
135
121
|
executionResult = await requestActionOnChildProcess({
|
|
136
122
|
signal,
|
|
137
|
-
actionType:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
executionResult = await requestActionOnChildProcess({
|
|
142
|
-
signal,
|
|
143
|
-
actionType: "execute-using-systemjs",
|
|
123
|
+
actionType:
|
|
124
|
+
compileProfile.moduleOutFormat === "systemjs"
|
|
125
|
+
? "execute-using-systemjs"
|
|
126
|
+
: "execute-using-dynamic-import",
|
|
144
127
|
actionParams: {
|
|
145
128
|
compileId,
|
|
146
|
-
importDefaultExtension
|
|
129
|
+
importDefaultExtension:
|
|
130
|
+
compileProfile.missingFeatures["import_default_extension"],
|
|
147
131
|
...executeParams,
|
|
148
132
|
},
|
|
149
133
|
})
|
|
134
|
+
} else {
|
|
135
|
+
executionResult = await requestActionOnChildProcess({
|
|
136
|
+
signal,
|
|
137
|
+
actionType: "execute-using-dynamic-import",
|
|
138
|
+
actionParams: executeParams,
|
|
139
|
+
})
|
|
150
140
|
}
|
|
151
|
-
|
|
152
141
|
executionResult = transformExecutionResult(executionResult, {
|
|
153
142
|
compileServerOrigin,
|
|
154
143
|
projectDirectoryUrl,
|
|
155
144
|
})
|
|
156
|
-
|
|
157
145
|
return executionResult
|
|
158
146
|
}
|
|
159
147
|
|