@jsenv/core 24.4.6 → 24.5.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/build_manifest.js +4 -4
- package/dist/compile_proxy/asset-manifest.json +1 -2
- package/dist/compile_proxy/{compile_proxy-e666f204.html → compile_proxy-1dfca609.html} +254 -218
- package/dist/redirector/asset-manifest.json +1 -2
- package/dist/redirector/{redirector-bee67b92.html → redirector-d1316407.html} +254 -218
- package/dist/toolbar/asset-manifest.json +1 -2
- package/dist/toolbar/{toolbar-3e2e70d3.html → toolbar-afb71355.html} +262 -222
- package/dist/toolbar/{toolbar.main-b23f63e6.js.map → toolbar.main-feac7fa3.js.map} +3 -3
- package/dist/toolbar_injector/asset-manifest.json +1 -1
- package/dist/toolbar_injector/{toolbar_injector-69fc0515.js → toolbar_injector-445d3ea0.js} +2 -2
- package/dist/toolbar_injector/{toolbar_injector-69fc0515.js.map → toolbar_injector-445d3ea0.js.map} +3 -3
- package/package.json +3 -2
- package/readme.md +32 -36
- package/src/buildProject.js +2 -0
- package/src/internal/building/buildUsingRollup.js +16 -28
- package/src/internal/building/{bundleWorker.js → js/babel_plugin_inline_worker_imports.js} +25 -61
- package/src/internal/building/js/parseJsRessource.js +12 -13
- package/src/internal/building/js/transform_worker.js +55 -0
- package/src/internal/building/resolve_import_url_helper.js +2 -1
- package/src/internal/building/ressource_builder.js +59 -15
- package/src/internal/building/{createJsenvRollupPlugin.js → rollup_plugin_jsenv.js} +81 -9
- package/src/internal/building/url_loader.js +0 -2
- package/src/internal/compiling/createCompiledFileService.js +3 -3
- package/src/internal/dev_server/toolbar/toolbar.html +1 -1
- package/src/internal/dev_server/toolbar/toolbar.main.js +4 -0
- package/src/internal/dev_server/toolbar/util/dom.js +1 -1
- package/src/internal/executing/coverage_utils/v8_coverage_from_directory.js +9 -1
- package/src/internal/executing/createSummaryLog.js +4 -4
- package/src/internal/executing/executeConcurrently.js +1 -0
- package/src/internal/executing/executePlan.js +24 -10
- package/src/internal/executing/executionLogs.js +1 -1
- package/src/jsenvServiceWorkerFinalizer.js +19 -2
- package/dist/compile_proxy/assets/s.js-fcba0e35.map +0 -246
- package/dist/redirector/assets/s.js-fcba0e35.map +0 -246
- package/dist/toolbar/assets/s.js-fcba0e35.map +0 -246
- package/src/internal/building/buildServiceWorker.js +0 -75
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
urlToParentUrl,
|
|
6
6
|
urlToFilename,
|
|
7
7
|
} from "@jsenv/filesystem"
|
|
8
|
-
import { createLogger } from "@jsenv/logger"
|
|
8
|
+
import { createLogger, loggerToLevels } from "@jsenv/logger"
|
|
9
9
|
|
|
10
10
|
import { setJavaScriptSourceMappingUrl } from "@jsenv/core/src/internal/sourceMappingURLUtils.js"
|
|
11
11
|
import { racePromises } from "../promise_race.js"
|
|
@@ -143,6 +143,9 @@ export const createRessourceBuilder = (
|
|
|
143
143
|
contentType,
|
|
144
144
|
bufferBeforeBuild,
|
|
145
145
|
})
|
|
146
|
+
if (!reference) {
|
|
147
|
+
return null
|
|
148
|
+
}
|
|
146
149
|
await reference.ressource.getReadyPromise()
|
|
147
150
|
return reference
|
|
148
151
|
}
|
|
@@ -229,10 +232,18 @@ export const createRessourceBuilder = (
|
|
|
229
232
|
|
|
230
233
|
let ressourceUrl
|
|
231
234
|
let isExternal = false
|
|
235
|
+
let isWorker = false
|
|
236
|
+
let isServiceWorker = false
|
|
232
237
|
if (typeof ressourceUrlResolution === "object") {
|
|
233
|
-
if (ressourceUrlResolution.
|
|
238
|
+
if (ressourceUrlResolution.isExternal) {
|
|
234
239
|
isExternal = true
|
|
235
240
|
}
|
|
241
|
+
if (ressourceUrlResolution.isWorker) {
|
|
242
|
+
isWorker = true
|
|
243
|
+
}
|
|
244
|
+
if (ressourceUrlResolution.isServiceWorker) {
|
|
245
|
+
isServiceWorker = true
|
|
246
|
+
}
|
|
236
247
|
ressourceUrl = ressourceUrlResolution.url
|
|
237
248
|
} else {
|
|
238
249
|
ressourceUrl = ressourceUrlResolution
|
|
@@ -292,6 +303,8 @@ export const createRessourceBuilder = (
|
|
|
292
303
|
isExternal,
|
|
293
304
|
isInline,
|
|
294
305
|
isPlaceholder,
|
|
306
|
+
isWorker,
|
|
307
|
+
isServiceWorker,
|
|
295
308
|
fileNamePattern,
|
|
296
309
|
urlVersioningDisabled,
|
|
297
310
|
})
|
|
@@ -330,14 +343,16 @@ export const createRessourceBuilder = (
|
|
|
330
343
|
} else {
|
|
331
344
|
ressource.references.push(reference)
|
|
332
345
|
const effects = ressource.applyReferenceEffects(reference, { isJsModule })
|
|
333
|
-
logger.debug
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
346
|
+
if (loggerToLevels(logger).debug) {
|
|
347
|
+
logger.debug(
|
|
348
|
+
formatFoundReference({
|
|
349
|
+
reference,
|
|
350
|
+
referenceEffects: effects,
|
|
351
|
+
showReferenceSourceLocation,
|
|
352
|
+
shortenUrl,
|
|
353
|
+
}),
|
|
354
|
+
)
|
|
355
|
+
}
|
|
341
356
|
}
|
|
342
357
|
|
|
343
358
|
return reference
|
|
@@ -356,9 +371,11 @@ export const createRessourceBuilder = (
|
|
|
356
371
|
isExternal = false,
|
|
357
372
|
isInline = false,
|
|
358
373
|
isPlaceholder = false,
|
|
374
|
+
isWorker = false,
|
|
375
|
+
isServiceWorker = false,
|
|
359
376
|
|
|
360
377
|
fileNamePattern,
|
|
361
|
-
urlVersioningDisabled =
|
|
378
|
+
urlVersioningDisabled = isServiceWorker,
|
|
362
379
|
}) => {
|
|
363
380
|
const ressource = {
|
|
364
381
|
contentType,
|
|
@@ -373,6 +390,8 @@ export const createRessourceBuilder = (
|
|
|
373
390
|
isInline,
|
|
374
391
|
isExternal,
|
|
375
392
|
isPlaceholder,
|
|
393
|
+
isWorker,
|
|
394
|
+
isServiceWorker,
|
|
376
395
|
|
|
377
396
|
urlVersioningDisabled,
|
|
378
397
|
fileNamePattern,
|
|
@@ -424,12 +443,13 @@ export const createRessourceBuilder = (
|
|
|
424
443
|
|
|
425
444
|
const response = await urlFetcher.fetchUrl(ressource.url, {
|
|
426
445
|
contentTypeExpected: ressource.firstStrongReference.contentTypeExpected,
|
|
427
|
-
urlTrace: () =>
|
|
428
|
-
createRessourceTrace({
|
|
446
|
+
urlTrace: () => {
|
|
447
|
+
return createRessourceTrace({
|
|
429
448
|
ressource,
|
|
430
449
|
createUrlSiteFromReference,
|
|
431
450
|
findRessourceByUrl,
|
|
432
|
-
})
|
|
451
|
+
})
|
|
452
|
+
},
|
|
433
453
|
})
|
|
434
454
|
if (response.url !== ressource.url) {
|
|
435
455
|
const urlBeforeRedirection = ressource.url
|
|
@@ -875,7 +895,7 @@ export const createRessourceBuilder = (
|
|
|
875
895
|
? String(referenceSource)
|
|
876
896
|
: ""
|
|
877
897
|
|
|
878
|
-
|
|
898
|
+
const urlSite = {
|
|
879
899
|
type:
|
|
880
900
|
referenceRessource && referenceRessource.isJsModule
|
|
881
901
|
? "import"
|
|
@@ -885,6 +905,30 @@ export const createRessourceBuilder = (
|
|
|
885
905
|
column: referenceColumn,
|
|
886
906
|
source: referenceSourceAsString,
|
|
887
907
|
}
|
|
908
|
+
|
|
909
|
+
if (!referenceRessource.isInline) {
|
|
910
|
+
return urlSite
|
|
911
|
+
}
|
|
912
|
+
const { firstStrongReference } = referenceRessource
|
|
913
|
+
if (!firstStrongReference) {
|
|
914
|
+
return urlSite
|
|
915
|
+
}
|
|
916
|
+
const htmlUrlSite = createUrlSiteFromReference(firstStrongReference)
|
|
917
|
+
// when the html node is injected there is no line in the source file to target
|
|
918
|
+
if (htmlUrlSite.line === undefined) {
|
|
919
|
+
return urlSite
|
|
920
|
+
}
|
|
921
|
+
const importerRessource = findRessourceByUrl(
|
|
922
|
+
firstStrongReference.referenceUrl,
|
|
923
|
+
)
|
|
924
|
+
if (!importerRessource || importerRessource.contentType !== "text/html") {
|
|
925
|
+
return urlSite
|
|
926
|
+
}
|
|
927
|
+
return {
|
|
928
|
+
...htmlUrlSite,
|
|
929
|
+
line: htmlUrlSite.line + urlSite.line,
|
|
930
|
+
column: htmlUrlSite.column + urlSite.column,
|
|
931
|
+
}
|
|
888
932
|
}
|
|
889
933
|
|
|
890
934
|
const showReferenceSourceLocation = (reference) => {
|
|
@@ -65,6 +65,9 @@ export const createJsenvRollupPlugin = async ({
|
|
|
65
65
|
externalImportSpecifiers,
|
|
66
66
|
externalImportUrlPatterns,
|
|
67
67
|
importPaths,
|
|
68
|
+
workers,
|
|
69
|
+
serviceWorkers,
|
|
70
|
+
serviceWorkerFinalizer,
|
|
68
71
|
|
|
69
72
|
format,
|
|
70
73
|
systemJsUrl,
|
|
@@ -98,6 +101,15 @@ export const createJsenvRollupPlugin = async ({
|
|
|
98
101
|
lastErrorMessage = error.message
|
|
99
102
|
}
|
|
100
103
|
|
|
104
|
+
const workerUrls = Object.keys(workers).map((key) =>
|
|
105
|
+
resolveUrl(key, projectDirectoryUrl),
|
|
106
|
+
)
|
|
107
|
+
const serviceWorkerUrls = Object.keys(serviceWorkers).map((key) =>
|
|
108
|
+
resolveUrl(key, projectDirectoryUrl),
|
|
109
|
+
)
|
|
110
|
+
const isWorkerUrl = (url) => workerUrls.includes(url)
|
|
111
|
+
const isServiceWorkerUrl = (url) => serviceWorkerUrls.includes(url)
|
|
112
|
+
|
|
101
113
|
let ressourceBuilder
|
|
102
114
|
let importResolver
|
|
103
115
|
let rollupEmitFile = () => {}
|
|
@@ -194,7 +206,7 @@ export const createJsenvRollupPlugin = async ({
|
|
|
194
206
|
compileDirectoryRelativeUrl,
|
|
195
207
|
projectDirectoryUrl,
|
|
196
208
|
)
|
|
197
|
-
const
|
|
209
|
+
const compileDirectoryServerUrl = resolveDirectoryUrl(
|
|
198
210
|
compileDirectoryRelativeUrl,
|
|
199
211
|
compileServerOrigin,
|
|
200
212
|
)
|
|
@@ -371,7 +383,7 @@ export const createJsenvRollupPlugin = async ({
|
|
|
371
383
|
)
|
|
372
384
|
importMapUrl = applyUrlMappings(importMapUrl)
|
|
373
385
|
|
|
374
|
-
if (!urlIsInsideOf(importMapUrl,
|
|
386
|
+
if (!urlIsInsideOf(importMapUrl, compileDirectoryServerUrl)) {
|
|
375
387
|
logger.warn(
|
|
376
388
|
formatImportmapOutsideCompileDirectory({
|
|
377
389
|
importMapInfo: importMapInfoFromHtml,
|
|
@@ -392,7 +404,7 @@ export const createJsenvRollupPlugin = async ({
|
|
|
392
404
|
firstHtmlEntryPoint.entryProjectRelativeUrl
|
|
393
405
|
const htmlCompiledUrl = resolveUrl(
|
|
394
406
|
htmlProjectRelativeUrl,
|
|
395
|
-
|
|
407
|
+
compileDirectoryServerUrl,
|
|
396
408
|
)
|
|
397
409
|
importMapUrl = htmlCompiledUrl
|
|
398
410
|
fetchImportMap = () => {
|
|
@@ -404,7 +416,7 @@ export const createJsenvRollupPlugin = async ({
|
|
|
404
416
|
} else if (importMapFileRelativeUrl) {
|
|
405
417
|
importMapUrl = resolveUrl(
|
|
406
418
|
importMapFileRelativeUrl,
|
|
407
|
-
|
|
419
|
+
compileDirectoryServerUrl,
|
|
408
420
|
)
|
|
409
421
|
fetchImportMap = () => {
|
|
410
422
|
return fetchImportMapFromUrl(
|
|
@@ -428,7 +440,7 @@ export const createJsenvRollupPlugin = async ({
|
|
|
428
440
|
})
|
|
429
441
|
const entryCompileServerUrl = resolveUrl(
|
|
430
442
|
entryProjectRelativeUrl,
|
|
431
|
-
|
|
443
|
+
compileDirectoryServerUrl,
|
|
432
444
|
)
|
|
433
445
|
return normalizeImportMap(defaultImportMap, entryCompileServerUrl)
|
|
434
446
|
}
|
|
@@ -550,8 +562,26 @@ export const createJsenvRollupPlugin = async ({
|
|
|
550
562
|
// and ignore them and console.info/debug about remote url (https, http, ...)
|
|
551
563
|
const projectUrl = asProjectUrl(ressourceUrl)
|
|
552
564
|
if (!projectUrl) {
|
|
553
|
-
return {
|
|
565
|
+
return {
|
|
566
|
+
isExternal: true,
|
|
567
|
+
url: ressourceUrl,
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
const originalUrl = asOriginalUrl(projectUrl)
|
|
572
|
+
if (isWorkerUrl(originalUrl)) {
|
|
573
|
+
return {
|
|
574
|
+
isWorker: true,
|
|
575
|
+
url: ressourceUrl,
|
|
576
|
+
}
|
|
554
577
|
}
|
|
578
|
+
if (isServiceWorkerUrl(originalUrl)) {
|
|
579
|
+
return {
|
|
580
|
+
isServiceWorker: true,
|
|
581
|
+
url: ressourceUrl,
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
555
585
|
return ressourceUrl
|
|
556
586
|
},
|
|
557
587
|
emitChunk,
|
|
@@ -565,7 +595,7 @@ export const createJsenvRollupPlugin = async ({
|
|
|
565
595
|
urlImporterMap[jsModuleUrl] = {
|
|
566
596
|
url: resolveUrl(
|
|
567
597
|
entryPointsPrepared[0].entryProjectRelativeUrl,
|
|
568
|
-
|
|
598
|
+
compileDirectoryServerUrl,
|
|
569
599
|
),
|
|
570
600
|
line: undefined,
|
|
571
601
|
column: undefined,
|
|
@@ -615,7 +645,7 @@ export const createJsenvRollupPlugin = async ({
|
|
|
615
645
|
const entryUrl =
|
|
616
646
|
entryContentType === "text/html"
|
|
617
647
|
? resolveUrl(entryProjectRelativeUrl, compileServerOrigin)
|
|
618
|
-
: resolveUrl(entryProjectRelativeUrl,
|
|
648
|
+
: resolveUrl(entryProjectRelativeUrl, compileDirectoryServerUrl)
|
|
619
649
|
await ressourceBuilder.createReferenceForEntryPoint({
|
|
620
650
|
entryContentType,
|
|
621
651
|
entryUrl,
|
|
@@ -640,7 +670,7 @@ export const createJsenvRollupPlugin = async ({
|
|
|
640
670
|
if (specifier.endsWith(".html")) {
|
|
641
671
|
importer = compileServerOrigin
|
|
642
672
|
} else {
|
|
643
|
-
importer =
|
|
673
|
+
importer = compileDirectoryServerUrl
|
|
644
674
|
}
|
|
645
675
|
} else {
|
|
646
676
|
importer = asServerUrl(importer)
|
|
@@ -1284,6 +1314,18 @@ export const createJsenvRollupPlugin = async ({
|
|
|
1284
1314
|
}
|
|
1285
1315
|
})
|
|
1286
1316
|
|
|
1317
|
+
await finalizeServiceWorkers({
|
|
1318
|
+
serviceWorkers,
|
|
1319
|
+
serviceWorkerFinalizer,
|
|
1320
|
+
projectDirectoryUrl,
|
|
1321
|
+
buildDirectoryUrl,
|
|
1322
|
+
rollupBuild,
|
|
1323
|
+
buildMappings,
|
|
1324
|
+
buildManifest,
|
|
1325
|
+
lineBreakNormalization,
|
|
1326
|
+
minify,
|
|
1327
|
+
})
|
|
1328
|
+
|
|
1287
1329
|
rollupBuild = sortObjectByPathnames(rollupBuild)
|
|
1288
1330
|
buildManifest = sortObjectByPathnames(buildManifest)
|
|
1289
1331
|
buildMappings = sortObjectByPathnames(buildMappings)
|
|
@@ -1505,3 +1547,33 @@ const acceptsJsonContentType = ({ node, format }) => {
|
|
|
1505
1547
|
}
|
|
1506
1548
|
return false
|
|
1507
1549
|
}
|
|
1550
|
+
|
|
1551
|
+
const finalizeServiceWorkers = async ({
|
|
1552
|
+
serviceWorkers,
|
|
1553
|
+
serviceWorkerFinalizer,
|
|
1554
|
+
buildMappings,
|
|
1555
|
+
buildManifest,
|
|
1556
|
+
rollupBuild,
|
|
1557
|
+
lineBreakNormalization,
|
|
1558
|
+
}) => {
|
|
1559
|
+
await Promise.all(
|
|
1560
|
+
Object.keys(serviceWorkers).map(async (projectRelativeUrl) => {
|
|
1561
|
+
const projectUrl = resolveUrl(projectRelativeUrl, "file://")
|
|
1562
|
+
projectRelativeUrl = urlToRelativeUrl(projectUrl, "file://")
|
|
1563
|
+
const serviceWorkerBuildRelativeUrl = buildMappings[projectRelativeUrl]
|
|
1564
|
+
if (!serviceWorkerBuildRelativeUrl) {
|
|
1565
|
+
throw new Error(
|
|
1566
|
+
`"${projectRelativeUrl}" service worker file missing in the build`,
|
|
1567
|
+
)
|
|
1568
|
+
}
|
|
1569
|
+
const buildFileContent = rollupBuild[serviceWorkerBuildRelativeUrl].source
|
|
1570
|
+
rollupBuild[serviceWorkerBuildRelativeUrl].source =
|
|
1571
|
+
serviceWorkerFinalizer(buildFileContent, {
|
|
1572
|
+
serviceWorkerBuildRelativeUrl,
|
|
1573
|
+
buildManifest,
|
|
1574
|
+
rollupBuild,
|
|
1575
|
+
lineBreakNormalization,
|
|
1576
|
+
})
|
|
1577
|
+
}),
|
|
1578
|
+
)
|
|
1579
|
+
}
|
|
@@ -24,7 +24,6 @@ export const createUrlLoader = ({
|
|
|
24
24
|
const loadUrl = async (rollupUrl, { signal, logger, ressourceBuilder }) => {
|
|
25
25
|
let url = asServerUrl(rollupUrl)
|
|
26
26
|
const { importType, urlWithoutImportType } = extractImportTypeFromUrl(url)
|
|
27
|
-
|
|
28
27
|
// importing CSS from JS with import assertions
|
|
29
28
|
if (importType === "css") {
|
|
30
29
|
const importer = urlImporterMap[url]
|
|
@@ -79,7 +78,6 @@ export const createUrlLoader = ({
|
|
|
79
78
|
map,
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
|
-
|
|
83
81
|
// importing json from JS with import assertion
|
|
84
82
|
if (importType === "json") {
|
|
85
83
|
const importer = urlImporterMap[url]
|
|
@@ -56,9 +56,9 @@ export const createCompiledFileService = ({
|
|
|
56
56
|
sourcemapMethod,
|
|
57
57
|
sourcemapExcludeSources,
|
|
58
58
|
}) => {
|
|
59
|
-
const
|
|
59
|
+
const compileIdModuleFormats = {}
|
|
60
60
|
Object.keys(groupMap).forEach((groupName) => {
|
|
61
|
-
|
|
61
|
+
compileIdModuleFormats[groupName] = canAvoidSystemJs({
|
|
62
62
|
runtimeSupport: groupMap[groupName].minRuntimeVersions,
|
|
63
63
|
})
|
|
64
64
|
? "esmodule"
|
|
@@ -187,7 +187,7 @@ export const createCompiledFileService = ({
|
|
|
187
187
|
runtimeSupport,
|
|
188
188
|
moduleOutFormat:
|
|
189
189
|
moduleOutFormat === undefined
|
|
190
|
-
?
|
|
190
|
+
? compileIdModuleFormats[compileId]
|
|
191
191
|
: moduleOutFormat,
|
|
192
192
|
importMetaFormat,
|
|
193
193
|
transformTopLevelAwait,
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<div id="toolbar">
|
|
19
19
|
<div id="toolbar-wrapper">
|
|
20
20
|
<section id="file-list-link" data-responsive-toolbar-element>
|
|
21
|
-
<a class="toolbar-icon-wrapper" href="
|
|
21
|
+
<a class="toolbar-icon-wrapper" href="javascript:void(0);">
|
|
22
22
|
<svg
|
|
23
23
|
id="fileIconSvg"
|
|
24
24
|
class="iconToolbar"
|
|
@@ -54,6 +54,10 @@ const renderToolbar = async () => {
|
|
|
54
54
|
hideToolbar({ animate: false })
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
document.querySelector(".toolbar-icon-wrapper").onclick = () => {
|
|
58
|
+
window.parent.location.href = "/"
|
|
59
|
+
}
|
|
60
|
+
|
|
57
61
|
renderToolbarNotification()
|
|
58
62
|
makeToolbarResponsive()
|
|
59
63
|
renderToolbarSettings()
|
|
@@ -35,9 +35,13 @@ export const visitNodeV8Directory = async ({
|
|
|
35
35
|
await previous
|
|
36
36
|
|
|
37
37
|
const dirEntryUrl = resolveUrl(dirEntry, coverageDirectoryUrl)
|
|
38
|
-
const tryReadJsonFile = async () => {
|
|
38
|
+
const tryReadJsonFile = async (timeSpentTrying = 0) => {
|
|
39
39
|
const fileContent = await readFile(dirEntryUrl, { as: "string" })
|
|
40
40
|
if (fileContent === "") {
|
|
41
|
+
if (timeSpentTrying < 400) {
|
|
42
|
+
await new Promise((resolve) => setTimeout(resolve, 200))
|
|
43
|
+
return tryReadJsonFile(timeSpentTrying + 200)
|
|
44
|
+
}
|
|
41
45
|
console.warn(`Coverage JSON file is empty at ${dirEntryUrl}`)
|
|
42
46
|
return null
|
|
43
47
|
}
|
|
@@ -46,6 +50,10 @@ export const visitNodeV8Directory = async ({
|
|
|
46
50
|
const fileAsJson = JSON.parse(fileContent)
|
|
47
51
|
return fileAsJson
|
|
48
52
|
} catch (e) {
|
|
53
|
+
if (timeSpentTrying < 400) {
|
|
54
|
+
await new Promise((resolve) => setTimeout(resolve, 200))
|
|
55
|
+
return tryReadJsonFile(timeSpentTrying + 200)
|
|
56
|
+
}
|
|
49
57
|
console.warn(
|
|
50
58
|
createDetailedMessage(`Error while reading coverage file`, {
|
|
51
59
|
"error stack": e.stack,
|
|
@@ -3,12 +3,12 @@ import { ANSI } from "@jsenv/log"
|
|
|
3
3
|
import { msAsDuration } from "../logs/msAsDuration.js"
|
|
4
4
|
import { EXECUTION_COLORS } from "./execution_colors.js"
|
|
5
5
|
|
|
6
|
-
export const createSummaryLog = (
|
|
7
|
-
|
|
6
|
+
export const createSummaryLog = (
|
|
7
|
+
summary,
|
|
8
|
+
) => `-------------- summary -----------------
|
|
8
9
|
${createSummaryMessage(summary)}
|
|
9
10
|
total duration: ${msAsDuration(summary.duration)}
|
|
10
|
-
|
|
11
|
-
`
|
|
11
|
+
----------------------------------------`
|
|
12
12
|
|
|
13
13
|
const createSummaryMessage = ({
|
|
14
14
|
executionCount,
|
|
@@ -129,16 +129,30 @@ export const executePlan = async (
|
|
|
129
129
|
})
|
|
130
130
|
|
|
131
131
|
logger.debug(`Generate executions`)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
132
|
+
|
|
133
|
+
let executionSteps
|
|
134
|
+
try {
|
|
135
|
+
executionSteps = await generateExecutionSteps(
|
|
136
|
+
{
|
|
137
|
+
...plan,
|
|
138
|
+
[compileServer.outDirectoryRelativeUrl]: null,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
signal: multipleExecutionsOperation.signal,
|
|
142
|
+
projectDirectoryUrl,
|
|
143
|
+
},
|
|
144
|
+
)
|
|
145
|
+
} catch (e) {
|
|
146
|
+
if (Abort.isAbortError(e)) {
|
|
147
|
+
return {
|
|
148
|
+
aborted: true,
|
|
149
|
+
planSummary: {},
|
|
150
|
+
planReport: {},
|
|
151
|
+
planCoverage: null,
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
throw e
|
|
155
|
+
}
|
|
142
156
|
logger.debug(`${executionSteps.length} executions planned`)
|
|
143
157
|
|
|
144
158
|
const result = await executeConcurrently(executionSteps, {
|
|
@@ -99,7 +99,7 @@ const descriptionFormatters = {
|
|
|
99
99
|
},
|
|
100
100
|
errored: ({ executionNumber, executionCount }) => {
|
|
101
101
|
return ANSI.color(
|
|
102
|
-
`${UNICODE.FAILURE_RAW} execution ${executionNumber} of ${executionCount}
|
|
102
|
+
`${UNICODE.FAILURE_RAW} execution ${executionNumber} of ${executionCount} errored`,
|
|
103
103
|
EXECUTION_COLORS.errored,
|
|
104
104
|
)
|
|
105
105
|
},
|
|
@@ -1,19 +1,36 @@
|
|
|
1
|
+
import { resolveUrl, urlToRelativeUrl } from "@jsenv/filesystem"
|
|
2
|
+
|
|
1
3
|
import { generateContentHash } from "./internal/building/url-versioning.js"
|
|
2
4
|
|
|
3
5
|
export const jsenvServiceWorkerFinalizer = (
|
|
4
6
|
code,
|
|
5
|
-
{
|
|
7
|
+
{
|
|
8
|
+
serviceWorkerBuildRelativeUrl,
|
|
9
|
+
buildManifest,
|
|
10
|
+
rollupBuild,
|
|
11
|
+
lineBreakNormalization,
|
|
12
|
+
},
|
|
6
13
|
) => {
|
|
7
14
|
const generatedUrlsConfig = {}
|
|
8
15
|
Object.keys(buildManifest).forEach((projectRelativeUrl) => {
|
|
9
16
|
if (projectRelativeUrl.endsWith(".map")) {
|
|
10
17
|
return
|
|
11
18
|
}
|
|
19
|
+
|
|
12
20
|
const buildRelativeUrl = buildManifest[projectRelativeUrl]
|
|
21
|
+
const buildUrl = resolveUrl(buildRelativeUrl, "file://")
|
|
22
|
+
const serviceWorkerBuildUrl = resolveUrl(
|
|
23
|
+
serviceWorkerBuildRelativeUrl,
|
|
24
|
+
"file://",
|
|
25
|
+
)
|
|
26
|
+
const urlRelativeToServiceWorker = urlToRelativeUrl(
|
|
27
|
+
buildUrl,
|
|
28
|
+
serviceWorkerBuildUrl,
|
|
29
|
+
)
|
|
13
30
|
const versioned = fileNameContainsHash(buildRelativeUrl)
|
|
14
31
|
const rollupFile = rollupBuild[buildRelativeUrl]
|
|
15
32
|
|
|
16
|
-
generatedUrlsConfig[
|
|
33
|
+
generatedUrlsConfig[urlRelativeToServiceWorker] = {
|
|
17
34
|
versioned,
|
|
18
35
|
...(versioned
|
|
19
36
|
? {}
|