@jsenv/core 25.4.5 → 25.6.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/browser_runtime/asset-manifest.json +2 -2
- package/dist/browser_runtime/browser_runtime_27a156f1.js +5297 -0
- package/dist/browser_runtime/browser_runtime_27a156f1.js.map +1089 -0
- package/dist/build_manifest.js +6 -6
- package/dist/compile_proxy/asset-manifest.json +1 -1
- package/dist/compile_proxy/{compile_proxy_ab528227.html → compile_proxy_f2f16cc6.html} +3 -2
- package/dist/event_source_client/asset-manifest.json +2 -2
- package/dist/event_source_client/event_source_client_69f48287.js +354 -0
- package/dist/event_source_client/{event_source_client_80644aee.js.map → event_source_client_69f48287.js.map} +2 -2
- package/dist/redirector/asset-manifest.json +1 -1
- package/dist/redirector/{redirector_6df2620a.html → redirector_eef2bb25.html} +3 -2
- package/dist/toolbar/asset-manifest.json +5 -5
- package/dist/toolbar/assets/{compilation.css_e37c747b.map → compilation.css_7421bd55.map} +3 -3
- package/dist/toolbar/assets/settings.css_942b5a9e.map +12 -0
- package/dist/toolbar/assets/{toolbar.main.css_269d7ce2.map → toolbar.main.css_b7d8bec1.map} +4 -4
- package/dist/toolbar/{toolbar.main_279b3a68.js.map → toolbar.main_2c56a4e0.js.map} +24 -12
- package/dist/toolbar/{toolbar_0a91ca3b.html → toolbar_7447de59.html} +100 -65
- package/dist/toolbar_injector/asset-manifest.json +2 -2
- package/dist/toolbar_injector/toolbar_injector_524c2404.js +974 -0
- package/dist/toolbar_injector/{toolbar_injector_34f6ad8e.js.map → toolbar_injector_524c2404.js.map} +3 -3
- package/package.json +6 -3
- package/readme.md +20 -17
- package/src/buildProject.js +12 -20
- package/src/executeTestPlan.js +20 -19
- package/src/internal/building/buildUsingRollup.js +5 -20
- package/src/internal/building/build_logs.js +33 -37
- package/src/internal/building/build_stats.js +2 -1
- package/src/internal/building/es_to_system.js +34 -0
- package/src/internal/building/import_references.js +0 -1
- package/src/internal/building/rollup_plugin_jsenv.js +146 -43
- package/src/internal/compiling/createCompiledFileService.js +0 -4
- package/src/internal/compiling/jsenvCompilerForJavaScript.js +2 -3
- package/src/internal/compiling/jsenv_directory/compile_context.js +1 -10
- package/src/internal/compiling/jsenv_directory/compile_profile.js +1 -2
- package/src/internal/compiling/jsenv_directory/jsenv_directory.js +1 -1
- package/src/internal/compiling/startCompileServer.js +0 -14
- package/src/internal/dev_server/toolbar/compilation/compilation.css +3 -2
- package/src/internal/dev_server/toolbar/compilation/toolbar.compilation.js +19 -19
- package/src/internal/dev_server/toolbar/notification/toolbar.notification.js +66 -37
- package/src/internal/dev_server/toolbar/settings/settings.css +1 -2
- package/src/internal/dev_server/toolbar/toolbar.html +9 -5
- package/src/internal/dev_server/toolbar/toolbar.main.js +5 -3
- package/src/internal/dev_server/toolbar/util/iframe_to_parent_href.js +10 -0
- package/src/internal/executing/coverage/reportToCoverage.js +1 -0
- package/src/internal/executing/coverage_utils/v8_coverage_from_directory.js +2 -1
- package/src/internal/executing/executePlan.js +450 -60
- package/src/internal/runtime/s.js +3 -2
- package/src/internal/runtime_support/runtime_support.js +1 -1
- package/dist/browser_runtime/browser_runtime_0e3396a1.js +0 -5298
- package/dist/browser_runtime/browser_runtime_0e3396a1.js.map +0 -1089
- package/dist/event_source_client/event_source_client_80644aee.js +0 -356
- package/dist/toolbar/assets/settings.css_61548139.map +0 -12
- package/dist/toolbar_injector/toolbar_injector_34f6ad8e.js +0 -976
- package/src/internal/executing/executeConcurrently.js +0 -440
|
@@ -19,8 +19,9 @@ export const createBuildStats = ({
|
|
|
19
19
|
projectFileSizes: projectFileSizeInfo.fileSizes,
|
|
20
20
|
projectTotalFileSize: projectFileSizeInfo.totalSize,
|
|
21
21
|
buildFileSizes: buildFileSizeInfo.fileSizes,
|
|
22
|
-
|
|
22
|
+
buildFileTotalSize: buildFileSizeInfo.totalSize,
|
|
23
23
|
buildSourcemapFileSizes: sourcemapFileSizeInfo.fileSizes,
|
|
24
|
+
buildSourcemapFileTotalSize: sourcemapFileSizeInfo.totalSize,
|
|
24
25
|
buildDuration,
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const esToSystem = async ({ code, url, map }) => {
|
|
2
|
+
const { rollup } = await import("rollup")
|
|
3
|
+
const rollupBuild = await rollup({
|
|
4
|
+
input: url,
|
|
5
|
+
plugins: [
|
|
6
|
+
{
|
|
7
|
+
name: "es-to-system",
|
|
8
|
+
resolveId: (id) => {
|
|
9
|
+
if (id === url) {
|
|
10
|
+
return id
|
|
11
|
+
}
|
|
12
|
+
return { external: true }
|
|
13
|
+
},
|
|
14
|
+
load: (id) => {
|
|
15
|
+
if (id === url) {
|
|
16
|
+
return code
|
|
17
|
+
}
|
|
18
|
+
return null
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
})
|
|
23
|
+
const { output } = await rollupBuild.generate({
|
|
24
|
+
format: "system",
|
|
25
|
+
sourcemap: true,
|
|
26
|
+
})
|
|
27
|
+
const firstChunk = output[0]
|
|
28
|
+
code = firstChunk.code
|
|
29
|
+
map = firstChunk.map
|
|
30
|
+
return {
|
|
31
|
+
code,
|
|
32
|
+
map,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import path from "node:path"
|
|
2
2
|
import MagicString from "magic-string"
|
|
3
3
|
import { composeTwoImportMaps, normalizeImportMap } from "@jsenv/importmap"
|
|
4
4
|
import { isSpecifierForNodeCoreModule } from "@jsenv/importmap/src/isSpecifierForNodeCoreModule.js"
|
|
@@ -15,9 +15,11 @@ import {
|
|
|
15
15
|
urlToBasename,
|
|
16
16
|
urlToFilename,
|
|
17
17
|
readFile,
|
|
18
|
+
urlToFileSystemPath,
|
|
18
19
|
} from "@jsenv/filesystem"
|
|
19
20
|
import { UNICODE } from "@jsenv/log"
|
|
20
21
|
|
|
22
|
+
import { require } from "@jsenv/core/src/internal/require.js"
|
|
21
23
|
import { convertJsonTextToJavascriptModule } from "@jsenv/core/src/internal/building/json_module.js"
|
|
22
24
|
import { convertCssTextToJavascriptModule } from "@jsenv/core/src/internal/building/css_module.js"
|
|
23
25
|
import { transformJs } from "@jsenv/core/src/internal/compiling/js-compilation-service/transformJs.js"
|
|
@@ -49,6 +51,7 @@ import {
|
|
|
49
51
|
} from "./ressource_builder.js"
|
|
50
52
|
import { createBuildUrlGenerator } from "./build_url_generator.js"
|
|
51
53
|
import { visitImportReferences } from "./import_references.js"
|
|
54
|
+
import { esToSystem } from "./es_to_system.js"
|
|
52
55
|
import { createBuildStats } from "./build_stats.js"
|
|
53
56
|
|
|
54
57
|
export const createRollupPlugins = async ({
|
|
@@ -66,13 +69,12 @@ export const createRollupPlugins = async ({
|
|
|
66
69
|
externalImportSpecifiers,
|
|
67
70
|
importPaths,
|
|
68
71
|
preservedUrls,
|
|
69
|
-
workers,
|
|
70
|
-
serviceWorkers,
|
|
71
72
|
serviceWorkerFinalizer,
|
|
72
|
-
|
|
73
|
-
classicServiceWorkers,
|
|
73
|
+
|
|
74
74
|
format,
|
|
75
75
|
systemJsUrl,
|
|
76
|
+
globals,
|
|
77
|
+
preservedDynamicImports,
|
|
76
78
|
|
|
77
79
|
node,
|
|
78
80
|
compileServer,
|
|
@@ -127,12 +129,15 @@ export const createRollupPlugins = async ({
|
|
|
127
129
|
let buildStats = {}
|
|
128
130
|
const buildStartMs = Date.now()
|
|
129
131
|
|
|
132
|
+
const serviceWorkerUrls = []
|
|
133
|
+
const classicServiceWorkerUrls = []
|
|
134
|
+
|
|
130
135
|
let lastErrorMessage
|
|
131
136
|
const storeLatestJsenvPluginError = (error) => {
|
|
132
137
|
lastErrorMessage = error.message
|
|
133
138
|
}
|
|
134
139
|
|
|
135
|
-
const extension = extname(entryPoints[Object.keys(entryPoints)[0]])
|
|
140
|
+
const extension = path.extname(entryPoints[Object.keys(entryPoints)[0]])
|
|
136
141
|
const outputExtension = extension === ".html" ? ".js" : extension
|
|
137
142
|
|
|
138
143
|
const entryPointUrls = {}
|
|
@@ -140,19 +145,6 @@ export const createRollupPlugins = async ({
|
|
|
140
145
|
const url = resolveUrl(key, projectDirectoryUrl)
|
|
141
146
|
entryPointUrls[url] = entryPoints[key]
|
|
142
147
|
})
|
|
143
|
-
const workerUrls = workers.map((worker) =>
|
|
144
|
-
resolveUrl(worker, projectDirectoryUrl),
|
|
145
|
-
)
|
|
146
|
-
const serviceWorkerUrls = serviceWorkers.map((serviceWorker) =>
|
|
147
|
-
resolveUrl(serviceWorker, projectDirectoryUrl),
|
|
148
|
-
)
|
|
149
|
-
const classicWorkerUrls = classicWorkers.map((classicWorker) =>
|
|
150
|
-
resolveUrl(classicWorker, projectDirectoryUrl),
|
|
151
|
-
)
|
|
152
|
-
const classicServiceWorkerUrls = classicServiceWorkers.map(
|
|
153
|
-
(classicServiceWorker) =>
|
|
154
|
-
resolveUrl(classicServiceWorker, projectDirectoryUrl),
|
|
155
|
-
)
|
|
156
148
|
|
|
157
149
|
let ressourceBuilder
|
|
158
150
|
let importResolver
|
|
@@ -311,6 +303,123 @@ export const createRollupPlugins = async ({
|
|
|
311
303
|
},
|
|
312
304
|
})
|
|
313
305
|
}
|
|
306
|
+
if (format === "global") {
|
|
307
|
+
const globalsForRollup = {}
|
|
308
|
+
Object.keys(globals).forEach((key) => {
|
|
309
|
+
if (key.startsWith("./")) {
|
|
310
|
+
const keyAsUrl = resolveUrl(key, projectDirectoryUrl)
|
|
311
|
+
const keyAsPath = urlToFileSystemPath(keyAsUrl)
|
|
312
|
+
globalsForRollup[keyAsPath] = globals[key]
|
|
313
|
+
} else {
|
|
314
|
+
globalsForRollup[key] = globals[key]
|
|
315
|
+
}
|
|
316
|
+
})
|
|
317
|
+
const ESIIFE = require("es-iife")
|
|
318
|
+
const globalNameFromChunkInfo = (chunkInfo) => {
|
|
319
|
+
const originalUrl = asOriginalUrl(chunkInfo.facadeModuleId)
|
|
320
|
+
const originalPath = urlToFileSystemPath(originalUrl)
|
|
321
|
+
const nameFromGlobals = globalsForRollup[originalPath]
|
|
322
|
+
return nameFromGlobals || path.parse(chunkInfo.fileName).name
|
|
323
|
+
}
|
|
324
|
+
const structuredMetaMap = normalizeStructuredMetaMap(
|
|
325
|
+
{ preserved: preservedDynamicImports },
|
|
326
|
+
projectDirectoryUrl,
|
|
327
|
+
)
|
|
328
|
+
const isPreservedDynamicImport = (url) => {
|
|
329
|
+
const meta = urlToMeta({ url, structuredMetaMap })
|
|
330
|
+
return Boolean(meta.preserved)
|
|
331
|
+
}
|
|
332
|
+
rollupPlugins.push({
|
|
333
|
+
async transform(code, id) {
|
|
334
|
+
const serverUrl = asServerUrl(id)
|
|
335
|
+
const originalUrl = asOriginalUrl(id)
|
|
336
|
+
if (isPreservedDynamicImport(originalUrl)) {
|
|
337
|
+
return null
|
|
338
|
+
}
|
|
339
|
+
const jsRessource = ressourceBuilder.findRessource((ressource) => {
|
|
340
|
+
return ressource.url === serverUrl
|
|
341
|
+
})
|
|
342
|
+
if (!jsRessource || !jsRessource.isEntryPoint) {
|
|
343
|
+
return null
|
|
344
|
+
}
|
|
345
|
+
let map = null
|
|
346
|
+
const ast = this.parse(code, {
|
|
347
|
+
// used to know node line and column
|
|
348
|
+
locations: true,
|
|
349
|
+
})
|
|
350
|
+
let useDynamicImport = false
|
|
351
|
+
const { walk } = await import("estree-walker")
|
|
352
|
+
walk(ast, {
|
|
353
|
+
enter: (node) => {
|
|
354
|
+
if (node.type === "ImportExpression") {
|
|
355
|
+
useDynamicImport = true
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
})
|
|
359
|
+
if (!useDynamicImport) {
|
|
360
|
+
return null
|
|
361
|
+
}
|
|
362
|
+
const magicString = new MagicString(code)
|
|
363
|
+
magicString.prepend(`import "@jsenv/core/src/internal/runtime/s.js";`)
|
|
364
|
+
code = magicString.toString()
|
|
365
|
+
map = magicString.generateMap({ hires: true })
|
|
366
|
+
return { code, map }
|
|
367
|
+
},
|
|
368
|
+
|
|
369
|
+
outputOptions: (outputOptions) => {
|
|
370
|
+
outputOptions.globals = globalsForRollup
|
|
371
|
+
outputOptions.format = "esm"
|
|
372
|
+
},
|
|
373
|
+
resolveImportMeta: (property, { chunkId }) => {
|
|
374
|
+
if (property === "url") {
|
|
375
|
+
return `(document.currentScript && document.currentScript.src || new URL("${chunkId}", document.baseURI).href);`
|
|
376
|
+
}
|
|
377
|
+
return undefined
|
|
378
|
+
},
|
|
379
|
+
renderDynamicImport: ({ moduleId }) => {
|
|
380
|
+
const originalUrl = asOriginalUrl(moduleId)
|
|
381
|
+
if (isPreservedDynamicImport(originalUrl)) {
|
|
382
|
+
return null
|
|
383
|
+
}
|
|
384
|
+
return {
|
|
385
|
+
left: "System.import(",
|
|
386
|
+
right: ")",
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
async renderChunk(code, chunkInfo) {
|
|
390
|
+
const serverUrl = asServerUrl(chunkInfo.facadeModuleId)
|
|
391
|
+
const jsRessource = ressourceBuilder.findRessource(
|
|
392
|
+
(ressource) => ressource.url === serverUrl,
|
|
393
|
+
)
|
|
394
|
+
if (jsRessource.isEntryPoint) {
|
|
395
|
+
const name = globalNameFromChunkInfo(chunkInfo)
|
|
396
|
+
const out = ESIIFE.transform({
|
|
397
|
+
code,
|
|
398
|
+
parse: this.parse,
|
|
399
|
+
name,
|
|
400
|
+
sourcemap: true,
|
|
401
|
+
resolveGlobal: (specifier) => {
|
|
402
|
+
const url = resolveUrl(specifier, chunkInfo.facadeModuleId)
|
|
403
|
+
const globalName = urlToBasename(url)
|
|
404
|
+
return globalName
|
|
405
|
+
},
|
|
406
|
+
strict: true,
|
|
407
|
+
})
|
|
408
|
+
code = out.code
|
|
409
|
+
const map = out.map
|
|
410
|
+
return {
|
|
411
|
+
code,
|
|
412
|
+
map,
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return esToSystem({
|
|
416
|
+
code,
|
|
417
|
+
url: serverUrl,
|
|
418
|
+
map: chunkInfo.map,
|
|
419
|
+
})
|
|
420
|
+
},
|
|
421
|
+
})
|
|
422
|
+
}
|
|
314
423
|
if (minify) {
|
|
315
424
|
const methodHooks = {
|
|
316
425
|
minifyJs: async (...args) => {
|
|
@@ -322,7 +431,6 @@ export const createRollupPlugins = async ({
|
|
|
322
431
|
return minifyHtml(...args)
|
|
323
432
|
},
|
|
324
433
|
}
|
|
325
|
-
|
|
326
434
|
minifyJs = async ({ url, code, map, ...rest }) => {
|
|
327
435
|
const result = await methodHooks.minifyJs({
|
|
328
436
|
url,
|
|
@@ -336,11 +444,9 @@ export const createRollupPlugins = async ({
|
|
|
336
444
|
map: result.map,
|
|
337
445
|
}
|
|
338
446
|
}
|
|
339
|
-
|
|
340
447
|
minifyHtml = async (html) => {
|
|
341
448
|
return methodHooks.minifyHtml(html, minifyHtmlOptions)
|
|
342
449
|
}
|
|
343
|
-
|
|
344
450
|
rollupPlugins.push({
|
|
345
451
|
name: "jsenv_minifier",
|
|
346
452
|
async renderChunk(code, chunk) {
|
|
@@ -354,7 +460,6 @@ export const createRollupPlugins = async ({
|
|
|
354
460
|
module: format === "esmodule",
|
|
355
461
|
...(format === "global" ? { toplevel: false } : { toplevel: true }),
|
|
356
462
|
})
|
|
357
|
-
|
|
358
463
|
code = result.code
|
|
359
464
|
map = result.map
|
|
360
465
|
return {
|
|
@@ -685,19 +790,21 @@ export const createRollupPlugins = async ({
|
|
|
685
790
|
const compiledFileUrl = asCompiledServerUrl(fileUrl)
|
|
686
791
|
resolutionResult.url = compiledFileUrl
|
|
687
792
|
}
|
|
688
|
-
|
|
689
|
-
if (
|
|
793
|
+
const { searchParams } = new URL(ressourceUrl)
|
|
794
|
+
if (searchParams.has("module")) {
|
|
795
|
+
resolutionResult.isJsModule = true
|
|
796
|
+
} else if (searchParams.has("worker")) {
|
|
690
797
|
resolutionResult.isWorker = true
|
|
691
798
|
resolutionResult.isJsModule = true
|
|
692
|
-
} else if (
|
|
799
|
+
} else if (searchParams.has("service_worker")) {
|
|
693
800
|
resolutionResult.isServiceWorker = true
|
|
694
801
|
resolutionResult.isJsModule = true
|
|
695
|
-
|
|
802
|
+
serviceWorkerUrls.push(ressourceOriginalUrl)
|
|
803
|
+
} else if (searchParams.has("worker_type_classic")) {
|
|
696
804
|
resolutionResult.isWorker = true
|
|
697
|
-
} else if (
|
|
698
|
-
classicServiceWorkerUrls.includes(ressourceOriginalUrl)
|
|
699
|
-
) {
|
|
805
|
+
} else if (searchParams.has("service_worker_type_classic")) {
|
|
700
806
|
resolutionResult.isServiceWorker = true
|
|
807
|
+
classicServiceWorkerUrls.push(ressourceOriginalUrl)
|
|
701
808
|
}
|
|
702
809
|
return resolutionResult
|
|
703
810
|
},
|
|
@@ -927,6 +1034,9 @@ export const createRollupPlugins = async ({
|
|
|
927
1034
|
return ressource.rollupReferenceId === referenceId
|
|
928
1035
|
})
|
|
929
1036
|
ressource.buildRelativeUrlWithoutHash = fileName
|
|
1037
|
+
if (ressource.isJsModule) {
|
|
1038
|
+
return fileName
|
|
1039
|
+
}
|
|
930
1040
|
const buildRelativeUrl = ressource.buildRelativeUrl
|
|
931
1041
|
return buildRelativeUrl
|
|
932
1042
|
}
|
|
@@ -1047,22 +1157,16 @@ export const createRollupPlugins = async ({
|
|
|
1047
1157
|
onReferenceWithImportMetaUrlPattern: async ({ importNode }) => {
|
|
1048
1158
|
const specifier = importNode.arguments[0].value
|
|
1049
1159
|
const { line, column } = importNode.loc.start
|
|
1050
|
-
|
|
1051
1160
|
const { id } = normalizeRollupResolveReturnValue(
|
|
1052
1161
|
await this.resolve(specifier, url),
|
|
1053
1162
|
)
|
|
1054
1163
|
const ressourceUrl = asServerUrl(id)
|
|
1055
|
-
const originalUrl = asOriginalUrl(ressourceUrl)
|
|
1056
|
-
const isJsModule = Boolean(
|
|
1057
|
-
workerUrls[originalUrl] || serviceWorkerUrls[originalUrl],
|
|
1058
|
-
)
|
|
1059
1164
|
const reference = ressourceBuilder.createReferenceFoundInJsModule({
|
|
1060
1165
|
referenceLabel: "URL + import.meta.url",
|
|
1061
1166
|
jsUrl: url,
|
|
1062
1167
|
jsLine: line,
|
|
1063
1168
|
jsColumn: column,
|
|
1064
1169
|
ressourceSpecifier: ressourceUrl,
|
|
1065
|
-
isJsModule,
|
|
1066
1170
|
})
|
|
1067
1171
|
if (!reference) {
|
|
1068
1172
|
return
|
|
@@ -1363,7 +1467,6 @@ export const createRollupPlugins = async ({
|
|
|
1363
1467
|
}
|
|
1364
1468
|
return sourceUrl
|
|
1365
1469
|
}
|
|
1366
|
-
|
|
1367
1470
|
return outputOptions
|
|
1368
1471
|
},
|
|
1369
1472
|
|
|
@@ -1373,9 +1476,12 @@ export const createRollupPlugins = async ({
|
|
|
1373
1476
|
// happens for inline module scripts for instance
|
|
1374
1477
|
return null
|
|
1375
1478
|
}
|
|
1376
|
-
|
|
1377
1479
|
const url = asOriginalUrl(facadeModuleId)
|
|
1378
|
-
|
|
1480
|
+
const { searchParams } = new URL(url)
|
|
1481
|
+
if (
|
|
1482
|
+
format === "systemjs" &&
|
|
1483
|
+
(searchParams.has("worker") || searchParams.has("service_worker"))
|
|
1484
|
+
) {
|
|
1379
1485
|
const magicString = new MagicString(code)
|
|
1380
1486
|
const systemjsCode = await readFile(
|
|
1381
1487
|
new URL("../runtime/s.js", import.meta.url),
|
|
@@ -1388,7 +1494,6 @@ export const createRollupPlugins = async ({
|
|
|
1388
1494
|
map,
|
|
1389
1495
|
}
|
|
1390
1496
|
}
|
|
1391
|
-
|
|
1392
1497
|
return null
|
|
1393
1498
|
},
|
|
1394
1499
|
|
|
@@ -1609,9 +1714,9 @@ export const createRollupPlugins = async ({
|
|
|
1609
1714
|
buildMappings = sortObjectByPathnames(buildMappings)
|
|
1610
1715
|
await visitServiceWorkers({
|
|
1611
1716
|
projectDirectoryUrl,
|
|
1717
|
+
serviceWorkerFinalizer,
|
|
1612
1718
|
serviceWorkerUrls,
|
|
1613
1719
|
classicServiceWorkerUrls,
|
|
1614
|
-
serviceWorkerFinalizer,
|
|
1615
1720
|
buildMappings,
|
|
1616
1721
|
ressourceMappings,
|
|
1617
1722
|
buildFileContents,
|
|
@@ -1831,7 +1936,6 @@ const visitServiceWorkers = async ({
|
|
|
1831
1936
|
...serviceWorkerUrls,
|
|
1832
1937
|
...classicServiceWorkerUrls,
|
|
1833
1938
|
]
|
|
1834
|
-
|
|
1835
1939
|
await Promise.all(
|
|
1836
1940
|
allServiceWorkerUrls.map(async (serviceWorkerUrl) => {
|
|
1837
1941
|
const serviceWorkerRelativeUrl = urlToRelativeUrl(
|
|
@@ -1845,7 +1949,6 @@ const visitServiceWorkers = async ({
|
|
|
1845
1949
|
`"${serviceWorkerRelativeUrl}" service worker file missing in the build`,
|
|
1846
1950
|
)
|
|
1847
1951
|
}
|
|
1848
|
-
|
|
1849
1952
|
if (serviceWorkerFinalizer) {
|
|
1850
1953
|
let code = buildFileContents[serviceWorkerBuildRelativeUrl]
|
|
1851
1954
|
code = await serviceWorkerFinalizer(code, {
|
|
@@ -41,8 +41,6 @@ export const createCompiledFileService = ({
|
|
|
41
41
|
topLevelAwait,
|
|
42
42
|
prependSystemJs,
|
|
43
43
|
customCompilers,
|
|
44
|
-
workerUrls,
|
|
45
|
-
serviceWorkerUrls,
|
|
46
44
|
|
|
47
45
|
jsenvEventSourceClientInjection,
|
|
48
46
|
jsenvToolbarInjection,
|
|
@@ -167,8 +165,6 @@ export const createCompiledFileService = ({
|
|
|
167
165
|
babelPluginMap,
|
|
168
166
|
compileProfile,
|
|
169
167
|
}),
|
|
170
|
-
workerUrls,
|
|
171
|
-
serviceWorkerUrls,
|
|
172
168
|
topLevelAwait,
|
|
173
169
|
prependSystemJs,
|
|
174
170
|
|
|
@@ -11,8 +11,6 @@ export const compileJavascript = async ({
|
|
|
11
11
|
|
|
12
12
|
compileProfile,
|
|
13
13
|
babelPluginMap,
|
|
14
|
-
workerUrls,
|
|
15
|
-
serviceWorkerUrls,
|
|
16
14
|
topLevelAwait,
|
|
17
15
|
prependSystemJs,
|
|
18
16
|
|
|
@@ -22,8 +20,9 @@ export const compileJavascript = async ({
|
|
|
22
20
|
sourcemapMethod,
|
|
23
21
|
}) => {
|
|
24
22
|
if (prependSystemJs === undefined) {
|
|
23
|
+
const { searchParams } = new URL(url)
|
|
25
24
|
prependSystemJs =
|
|
26
|
-
|
|
25
|
+
searchParams.has("worker") || searchParams.has("service_worker")
|
|
27
26
|
}
|
|
28
27
|
const transformResult = await transformJs({
|
|
29
28
|
projectDirectoryUrl,
|
|
@@ -7,15 +7,10 @@ import {
|
|
|
7
7
|
} from "@jsenv/core/dist/build_manifest.js"
|
|
8
8
|
import { jsenvCoreDirectoryUrl } from "@jsenv/core/src/internal/jsenvCoreDirectoryUrl.js"
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
sameValuesInTwoArrays,
|
|
12
|
-
sameValueInTwoObjects,
|
|
13
|
-
} from "./comparison_utils.js"
|
|
10
|
+
import { sameValueInTwoObjects } from "./comparison_utils.js"
|
|
14
11
|
|
|
15
12
|
const COMPARERS = {
|
|
16
13
|
preservedUrls: sameValueInTwoObjects,
|
|
17
|
-
workers: sameValuesInTwoArrays,
|
|
18
|
-
serviceWorkers: sameValuesInTwoArrays,
|
|
19
14
|
replaceProcessEnvNodeEnv: (a, b) => a === b,
|
|
20
15
|
inlineImportMapIntoHTML: (a, b) => a === b,
|
|
21
16
|
|
|
@@ -36,15 +31,11 @@ export const compareCompileContexts = (
|
|
|
36
31
|
|
|
37
32
|
export const createCompileContext = async ({
|
|
38
33
|
preservedUrls,
|
|
39
|
-
workers,
|
|
40
|
-
serviceWorkers,
|
|
41
34
|
replaceProcessEnvNodeEnv,
|
|
42
35
|
inlineImportMapIntoHTML,
|
|
43
36
|
}) => {
|
|
44
37
|
return {
|
|
45
38
|
preservedUrls,
|
|
46
|
-
workers,
|
|
47
|
-
serviceWorkers,
|
|
48
39
|
replaceProcessEnvNodeEnv,
|
|
49
40
|
inlineImportMapIntoHTML,
|
|
50
41
|
|
|
@@ -18,7 +18,6 @@ export const createCompileProfile = ({
|
|
|
18
18
|
preservedUrls,
|
|
19
19
|
customCompilers,
|
|
20
20
|
babelPluginMapWithoutSyntax,
|
|
21
|
-
workerUrls,
|
|
22
21
|
importMapInWebWorkers,
|
|
23
22
|
moduleOutFormat,
|
|
24
23
|
sourcemapMethod,
|
|
@@ -65,7 +64,7 @@ export const createCompileProfile = ({
|
|
|
65
64
|
import_assertion_type_css: true,
|
|
66
65
|
})
|
|
67
66
|
}
|
|
68
|
-
if (env.browser
|
|
67
|
+
if (env.browser) {
|
|
69
68
|
features["worker_type_module"] = true
|
|
70
69
|
}
|
|
71
70
|
if (env.browser && importMapInWebWorkers) {
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
readRequestBody,
|
|
10
10
|
} from "@jsenv/server"
|
|
11
11
|
import {
|
|
12
|
-
resolveUrl,
|
|
13
12
|
urlToRelativeUrl,
|
|
14
13
|
resolveDirectoryUrl,
|
|
15
14
|
urlIsInsideOf,
|
|
@@ -79,8 +78,6 @@ export const startCompileServer = async ({
|
|
|
79
78
|
babelConfigFileUrl,
|
|
80
79
|
customCompilers = {},
|
|
81
80
|
preservedUrls,
|
|
82
|
-
workers = [],
|
|
83
|
-
serviceWorkers = [],
|
|
84
81
|
importMapInWebWorkers = false,
|
|
85
82
|
prependSystemJs,
|
|
86
83
|
|
|
@@ -127,12 +124,6 @@ export const startCompileServer = async ({
|
|
|
127
124
|
*/
|
|
128
125
|
...preservedUrls,
|
|
129
126
|
}
|
|
130
|
-
const workerUrls = workers.map((worker) =>
|
|
131
|
-
resolveUrl(worker, projectDirectoryUrl),
|
|
132
|
-
)
|
|
133
|
-
const serviceWorkerUrls = serviceWorkers.map((serviceWorker) =>
|
|
134
|
-
resolveUrl(serviceWorker, projectDirectoryUrl),
|
|
135
|
-
)
|
|
136
127
|
const babelPluginMapFromFile = await loadBabelPluginMapFromFile({
|
|
137
128
|
projectDirectoryUrl,
|
|
138
129
|
babelConfigFileUrl,
|
|
@@ -209,8 +200,6 @@ export const startCompileServer = async ({
|
|
|
209
200
|
})
|
|
210
201
|
const compileContext = await createCompileContext({
|
|
211
202
|
preservedUrls,
|
|
212
|
-
workers,
|
|
213
|
-
serviceWorkers,
|
|
214
203
|
replaceProcessEnvNodeEnv,
|
|
215
204
|
inlineImportMapIntoHTML,
|
|
216
205
|
})
|
|
@@ -252,7 +241,6 @@ export const startCompileServer = async ({
|
|
|
252
241
|
customCompilers,
|
|
253
242
|
babelPluginMapWithoutSyntax,
|
|
254
243
|
preservedUrls,
|
|
255
|
-
workerUrls,
|
|
256
244
|
importMapInWebWorkers,
|
|
257
245
|
moduleOutFormat,
|
|
258
246
|
sourcemapMethod,
|
|
@@ -343,8 +331,6 @@ export const startCompileServer = async ({
|
|
|
343
331
|
topLevelAwait,
|
|
344
332
|
babelPluginMap,
|
|
345
333
|
customCompilers,
|
|
346
|
-
workerUrls,
|
|
347
|
-
serviceWorkerUrls,
|
|
348
334
|
prependSystemJs,
|
|
349
335
|
jsenvEventSourceClientInjection,
|
|
350
336
|
jsenvToolbarInjection,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { scanBrowserRuntimeFeatures } from "../../../features/browser_feature_detection/browser_feature_detection.js"
|
|
2
|
+
import { setLinkHrefForParentWindow } from "../util/iframe_to_parent_href.js"
|
|
2
3
|
import { removeForceHideElement } from "../util/dom.js"
|
|
3
4
|
import { enableVariant } from "../variant/variant.js"
|
|
4
5
|
import {
|
|
@@ -101,25 +102,24 @@ export const renderCompilationInToolbar = ({ compileGroup }) => {
|
|
|
101
102
|
".files_compilation_text",
|
|
102
103
|
).innerHTML = `Files shown are compiled for ${runtimeReport.name}@${runtimeReport.version}`
|
|
103
104
|
}
|
|
104
|
-
|
|
105
|
-
()
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
"a.link_to_compiled_files",
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
"a.link_to_appropriate_files",
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
105
|
+
setLinkHrefForParentWindow(
|
|
106
|
+
filesCompilationRootNode.querySelector("a.link_to_source_files"),
|
|
107
|
+
`/${compileGroup.fileRelativeUrl}`,
|
|
108
|
+
)
|
|
109
|
+
setLinkHrefForParentWindow(
|
|
110
|
+
filesCompilationRootNode.querySelector("a.link_to_compiled_files"),
|
|
111
|
+
`/${jsenvDirectoryRelativeUrl}${expectedCompiledId}/${compileGroup.fileRelativeUrl}`,
|
|
112
|
+
)
|
|
113
|
+
setLinkHrefForParentWindow(
|
|
114
|
+
filesCompilationRootNode.querySelector(
|
|
115
|
+
"a.link_to_compilation_forced_files",
|
|
116
|
+
),
|
|
117
|
+
`/${jsenvDirectoryRelativeUrl}force/${compileGroup.fileRelativeUrl}`,
|
|
118
|
+
)
|
|
119
|
+
setLinkHrefForParentWindow(
|
|
120
|
+
filesCompilationRootNode.querySelector("a.link_to_appropriate_files"),
|
|
121
|
+
`/${jsenvDirectoryRelativeUrl}${expectedCompiledId}/${compileGroup.fileRelativeUrl}`,
|
|
122
|
+
)
|
|
123
123
|
|
|
124
124
|
if (hasWarning) {
|
|
125
125
|
enableWarningStyle()
|