@jsenv/core 27.3.2 → 27.3.3
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/controllable_child_process.mjs +1 -0
- package/dist/controllable_worker_thread.mjs +1 -0
- package/dist/js/execute_using_dynamic_import.js +5 -3
- package/dist/main.js +141 -134
- package/package.json +1 -1
- package/src/build/build.js +2 -2
- package/src/build/graph_utils.js +14 -11
- package/src/execute/run.js +27 -28
- package/src/execute/runtimes/browsers/from_playwright.js +90 -92
- package/src/execute/runtimes/node/execute_using_dynamic_import.js +8 -2
- package/src/execute/runtimes/node/node_child_process.js +2 -0
- package/src/execute/runtimes/node/node_worker_thread.js +11 -6
- package/src/omega/url_graph/url_graph_report.js +2 -4
- package/src/omega/url_graph.js +23 -16
- package/src/plugins/autoreload/dev_sse/jsenv_plugin_dev_sse_server.js +1 -2
- package/src/plugins/bundling/js_module/bundle_js_module.js +0 -1
- package/src/plugins/node_esm_resolution/jsenv_plugin_node_esm_resolution.js +1 -2
- package/src/plugins/url_analysis/js/js_urls.js +0 -9
- package/src/test/coverage/report_to_coverage.js +16 -11
- package/src/test/execute_plan.js +3 -2
- package/src/test/execute_test_plan.js +3 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { writeFileSync } from "node:fs";
|
|
1
2
|
import { Session } from "node:inspector";
|
|
2
3
|
import { performance, PerformanceObserver } from "node:perf_hooks";
|
|
3
4
|
|
|
@@ -122,9 +123,10 @@ const executeUsingDynamicImport = async ({
|
|
|
122
123
|
collectPerformance,
|
|
123
124
|
coverageEnabled,
|
|
124
125
|
coverageConfig,
|
|
125
|
-
coverageMethodForNodeJs
|
|
126
|
+
coverageMethodForNodeJs,
|
|
127
|
+
coverageFileUrl
|
|
126
128
|
}) => {
|
|
127
|
-
|
|
129
|
+
const result = {};
|
|
128
130
|
const afterImportCallbacks = [];
|
|
129
131
|
|
|
130
132
|
if (coverageEnabled && coverageMethodForNodeJs === "Profiler") {
|
|
@@ -140,7 +142,7 @@ const executeUsingDynamicImport = async ({
|
|
|
140
142
|
rootDirectoryUrl,
|
|
141
143
|
coverageConfig
|
|
142
144
|
});
|
|
143
|
-
|
|
145
|
+
writeFileSync(new URL(coverageFileUrl), JSON.stringify(coverageLight, null, " "));
|
|
144
146
|
});
|
|
145
147
|
}
|
|
146
148
|
|
package/dist/main.js
CHANGED
|
@@ -8470,22 +8470,11 @@ const parseAndTransformJsUrls = async (urlInfo, context) => {
|
|
|
8470
8470
|
} = context;
|
|
8471
8471
|
const actions = [];
|
|
8472
8472
|
const magicSource = createMagicSource(urlInfo.content);
|
|
8473
|
-
urlInfo.data.usesImport = false;
|
|
8474
|
-
urlInfo.data.usesExport = false;
|
|
8475
|
-
urlInfo.data.usesImportAssertion = false;
|
|
8476
8473
|
jsMentions.forEach(jsMention => {
|
|
8477
|
-
if (jsMention.assert) {
|
|
8478
|
-
urlInfo.data.usesImportAssertion = true;
|
|
8479
|
-
}
|
|
8480
|
-
|
|
8481
8474
|
if (jsMention.subtype === "import_static" || jsMention.subtype === "import_dynamic") {
|
|
8482
8475
|
urlInfo.data.usesImport = true;
|
|
8483
8476
|
}
|
|
8484
8477
|
|
|
8485
|
-
if (jsMention.subtype === "export") {
|
|
8486
|
-
urlInfo.data.usesExport = true;
|
|
8487
|
-
}
|
|
8488
|
-
|
|
8489
8478
|
const [reference] = referenceUtils.found({
|
|
8490
8479
|
type: jsMention.type,
|
|
8491
8480
|
subtype: jsMention.subtype,
|
|
@@ -10927,9 +10916,7 @@ const jsenvPluginNodeEsmResolution = ({
|
|
|
10927
10916
|
const onFileChange = () => {
|
|
10928
10917
|
packageScopesCache.clear();
|
|
10929
10918
|
packageJsonsCache.clear();
|
|
10930
|
-
|
|
10931
|
-
const urlInfo = urlGraph.getUrlInfo(url);
|
|
10932
|
-
|
|
10919
|
+
urlGraph.urlInfoMap.forEach(urlInfo => {
|
|
10933
10920
|
if (urlInfo.dependsOnPackageJson) {
|
|
10934
10921
|
urlGraph.considerModified(urlInfo);
|
|
10935
10922
|
}
|
|
@@ -19338,8 +19325,7 @@ const rollupPluginJsenv = ({
|
|
|
19338
19325
|
data: {
|
|
19339
19326
|
generatedBy: "rollup",
|
|
19340
19327
|
bundleRelativeUrl: rollupFileInfo.fileName,
|
|
19341
|
-
usesImport: rollupFileInfo.imports.length > 0 || rollupFileInfo.dynamicImports.length > 0
|
|
19342
|
-
usesExport: rollupFileInfo.exports.length > 0
|
|
19328
|
+
usesImport: rollupFileInfo.imports.length > 0 || rollupFileInfo.dynamicImports.length > 0
|
|
19343
19329
|
},
|
|
19344
19330
|
contentType: "text/javascript",
|
|
19345
19331
|
content: rollupFileInfo.code,
|
|
@@ -20338,8 +20324,6 @@ const jsenvPluginDevSSEServer = ({
|
|
|
20338
20324
|
};
|
|
20339
20325
|
|
|
20340
20326
|
const propagateUpdate = firstUrlInfo => {
|
|
20341
|
-
const urlInfos = urlGraph.urlInfos;
|
|
20342
|
-
|
|
20343
20327
|
const iterate = (urlInfo, trace) => {
|
|
20344
20328
|
if (urlInfo.data.hotAcceptSelf) {
|
|
20345
20329
|
return {
|
|
@@ -20359,7 +20343,7 @@ const jsenvPluginDevSSEServer = ({
|
|
|
20359
20343
|
const instructions = [];
|
|
20360
20344
|
|
|
20361
20345
|
for (const dependentUrl of dependents) {
|
|
20362
|
-
const dependentUrlInfo =
|
|
20346
|
+
const dependentUrlInfo = urlGraph.getUrlInfo(dependentUrl);
|
|
20363
20347
|
|
|
20364
20348
|
if (dependentUrlInfo.data.hotDecline) {
|
|
20365
20349
|
return {
|
|
@@ -20722,15 +20706,15 @@ const createUrlGraph = ({
|
|
|
20722
20706
|
clientFileChangeCallbackList,
|
|
20723
20707
|
clientFilesPruneCallbackList
|
|
20724
20708
|
} = {}) => {
|
|
20725
|
-
const
|
|
20709
|
+
const urlInfoMap = new Map();
|
|
20726
20710
|
|
|
20727
|
-
const getUrlInfo = url =>
|
|
20711
|
+
const getUrlInfo = url => urlInfoMap.get(url);
|
|
20728
20712
|
|
|
20729
20713
|
const deleteUrlInfo = url => {
|
|
20730
|
-
const urlInfo =
|
|
20714
|
+
const urlInfo = urlInfoMap.get(url);
|
|
20731
20715
|
|
|
20732
20716
|
if (urlInfo) {
|
|
20733
|
-
delete
|
|
20717
|
+
urlInfoMap.delete(url);
|
|
20734
20718
|
|
|
20735
20719
|
if (urlInfo.sourcemapReference) {
|
|
20736
20720
|
deleteUrlInfo(urlInfo.sourcemapReference.url);
|
|
@@ -20739,15 +20723,15 @@ const createUrlGraph = ({
|
|
|
20739
20723
|
};
|
|
20740
20724
|
|
|
20741
20725
|
const reuseOrCreateUrlInfo = url => {
|
|
20742
|
-
const existingUrlInfo =
|
|
20726
|
+
const existingUrlInfo = getUrlInfo(url);
|
|
20743
20727
|
if (existingUrlInfo) return existingUrlInfo;
|
|
20744
20728
|
const urlInfo = createUrlInfo(url);
|
|
20745
|
-
|
|
20729
|
+
urlInfoMap.set(url, urlInfo);
|
|
20746
20730
|
return urlInfo;
|
|
20747
20731
|
};
|
|
20748
20732
|
|
|
20749
20733
|
const inferReference = (specifier, parentUrl) => {
|
|
20750
|
-
const parentUrlInfo =
|
|
20734
|
+
const parentUrlInfo = getUrlInfo(parentUrl);
|
|
20751
20735
|
|
|
20752
20736
|
if (!parentUrlInfo) {
|
|
20753
20737
|
return null;
|
|
@@ -20760,7 +20744,7 @@ const createUrlGraph = ({
|
|
|
20760
20744
|
};
|
|
20761
20745
|
|
|
20762
20746
|
const findDependent = (url, predicate) => {
|
|
20763
|
-
const urlInfo =
|
|
20747
|
+
const urlInfo = getUrlInfo(url);
|
|
20764
20748
|
|
|
20765
20749
|
if (!urlInfo) {
|
|
20766
20750
|
return null;
|
|
@@ -20768,7 +20752,7 @@ const createUrlGraph = ({
|
|
|
20768
20752
|
|
|
20769
20753
|
const visitDependents = urlInfo => {
|
|
20770
20754
|
for (const dependentUrl of urlInfo.dependents) {
|
|
20771
|
-
const dependent =
|
|
20755
|
+
const dependent = getUrlInfo(dependentUrl);
|
|
20772
20756
|
|
|
20773
20757
|
if (predicate(dependent)) {
|
|
20774
20758
|
return dependent;
|
|
@@ -20818,7 +20802,7 @@ const createUrlGraph = ({
|
|
|
20818
20802
|
const removeDependencies = (urlInfo, urlsToPrune) => {
|
|
20819
20803
|
urlsToPrune.forEach(urlToPrune => {
|
|
20820
20804
|
urlInfo.dependencies.delete(urlToPrune);
|
|
20821
|
-
const dependency =
|
|
20805
|
+
const dependency = getUrlInfo(urlToPrune);
|
|
20822
20806
|
|
|
20823
20807
|
if (!dependency) {
|
|
20824
20808
|
return;
|
|
@@ -20858,7 +20842,7 @@ const createUrlGraph = ({
|
|
|
20858
20842
|
clientFileChangeCallbackList.push(({
|
|
20859
20843
|
url
|
|
20860
20844
|
}) => {
|
|
20861
|
-
const urlInfo =
|
|
20845
|
+
const urlInfo = getUrlInfo(url);
|
|
20862
20846
|
|
|
20863
20847
|
if (urlInfo) {
|
|
20864
20848
|
considerModified(urlInfo, Date.now());
|
|
@@ -20878,7 +20862,7 @@ const createUrlGraph = ({
|
|
|
20878
20862
|
urlInfo.modifiedTimestamp = modifiedTimestamp;
|
|
20879
20863
|
urlInfo.contentEtag = undefined;
|
|
20880
20864
|
urlInfo.dependents.forEach(dependentUrl => {
|
|
20881
|
-
const dependentUrlInfo =
|
|
20865
|
+
const dependentUrlInfo = getUrlInfo(dependentUrl);
|
|
20882
20866
|
const {
|
|
20883
20867
|
hotAcceptDependencies = []
|
|
20884
20868
|
} = dependentUrlInfo.data;
|
|
@@ -20908,7 +20892,7 @@ const createUrlGraph = ({
|
|
|
20908
20892
|
};
|
|
20909
20893
|
|
|
20910
20894
|
return {
|
|
20911
|
-
|
|
20895
|
+
urlInfoMap,
|
|
20912
20896
|
reuseOrCreateUrlInfo,
|
|
20913
20897
|
getUrlInfo,
|
|
20914
20898
|
deleteUrlInfo,
|
|
@@ -20917,13 +20901,20 @@ const createUrlGraph = ({
|
|
|
20917
20901
|
updateReferences,
|
|
20918
20902
|
considerModified,
|
|
20919
20903
|
getRelatedUrlInfos,
|
|
20904
|
+
toObject: () => {
|
|
20905
|
+
const data = {};
|
|
20906
|
+
urlInfoMap.forEach(urlInfo => {
|
|
20907
|
+
data[urlInfo.url] = urlInfo;
|
|
20908
|
+
});
|
|
20909
|
+
return data;
|
|
20910
|
+
},
|
|
20920
20911
|
toJSON: rootDirectoryUrl => {
|
|
20921
20912
|
const data = {};
|
|
20922
|
-
|
|
20923
|
-
const dependencyUrls = Array.from(
|
|
20913
|
+
urlInfoMap.forEach(urlInfo => {
|
|
20914
|
+
const dependencyUrls = Array.from(urlInfo.dependencies);
|
|
20924
20915
|
|
|
20925
20916
|
if (dependencyUrls.length) {
|
|
20926
|
-
const relativeUrl = urlToRelativeUrl(url, rootDirectoryUrl);
|
|
20917
|
+
const relativeUrl = urlToRelativeUrl(urlInfo.url, rootDirectoryUrl);
|
|
20927
20918
|
data[relativeUrl] = dependencyUrls.map(dependencyUrl => urlToRelativeUrl(dependencyUrl, rootDirectoryUrl));
|
|
20928
20919
|
}
|
|
20929
20920
|
});
|
|
@@ -24003,7 +23994,7 @@ const reportToCoverage = async (report, {
|
|
|
24003
23994
|
// coverDescription will generate empty coverage for files
|
|
24004
23995
|
// that were suppose to be coverage but were not.
|
|
24005
23996
|
if (executionResult.status === "completed" && executionResult.type === "node" && coverageMethodForNodeJs !== "NODE_V8_COVERAGE") {
|
|
24006
|
-
logger.warn(`
|
|
23997
|
+
logger.warn(`"${executionName}" execution of ${file} did not properly write coverage into ${executionResult.coverageFileUrl}`);
|
|
24007
23998
|
}
|
|
24008
23999
|
}
|
|
24009
24000
|
});
|
|
@@ -24084,17 +24075,22 @@ const getCoverageFromReport = async ({
|
|
|
24084
24075
|
const {
|
|
24085
24076
|
coverageFileUrl
|
|
24086
24077
|
} = executionResultForFileOnRuntime;
|
|
24078
|
+
let executionCoverage;
|
|
24087
24079
|
|
|
24088
|
-
|
|
24089
|
-
|
|
24090
|
-
|
|
24091
|
-
|
|
24092
|
-
|
|
24093
|
-
|
|
24094
|
-
|
|
24095
|
-
|
|
24080
|
+
try {
|
|
24081
|
+
executionCoverage = JSON.parse(String(readFileSync$1(new URL(coverageFileUrl))));
|
|
24082
|
+
} catch (e) {
|
|
24083
|
+
if (e.code === "ENOENT" || e.name === "SyntaxError") {
|
|
24084
|
+
onMissing({
|
|
24085
|
+
executionName,
|
|
24086
|
+
file,
|
|
24087
|
+
executionResult: executionResultForFileOnRuntime
|
|
24088
|
+
});
|
|
24089
|
+
return;
|
|
24090
|
+
}
|
|
24096
24091
|
|
|
24097
|
-
|
|
24092
|
+
throw e;
|
|
24093
|
+
}
|
|
24098
24094
|
|
|
24099
24095
|
if (isV8Coverage(executionCoverage)) {
|
|
24100
24096
|
v8Coverage = v8Coverage ? composeTwoV8Coverages(v8Coverage, executionCoverage) : executionCoverage;
|
|
@@ -24127,7 +24123,7 @@ const run = async ({
|
|
|
24127
24123
|
runtime,
|
|
24128
24124
|
runtimeParams
|
|
24129
24125
|
}) => {
|
|
24130
|
-
|
|
24126
|
+
const result = {};
|
|
24131
24127
|
const callbacks = [];
|
|
24132
24128
|
const onConsoleRef = {
|
|
24133
24129
|
current: () => {}
|
|
@@ -24145,18 +24141,14 @@ const run = async ({
|
|
|
24145
24141
|
const timeoutAbortSource = runOperation.timeout(allocatedMs);
|
|
24146
24142
|
callbacks.push(() => {
|
|
24147
24143
|
if (result.status === "errored" && Abort.isAbortError(result.error) && timeoutAbortSource.signal.aborted) {
|
|
24148
|
-
result =
|
|
24149
|
-
status: "timedout"
|
|
24150
|
-
};
|
|
24144
|
+
result.status = "timedout";
|
|
24151
24145
|
}
|
|
24152
24146
|
});
|
|
24153
24147
|
}
|
|
24154
24148
|
|
|
24155
24149
|
callbacks.push(() => {
|
|
24156
24150
|
if (result.status === "errored" && Abort.isAbortError(result.error)) {
|
|
24157
|
-
result =
|
|
24158
|
-
status: "aborted"
|
|
24159
|
-
};
|
|
24151
|
+
result.status = "aborted";
|
|
24160
24152
|
}
|
|
24161
24153
|
});
|
|
24162
24154
|
const consoleCalls = [];
|
|
@@ -24185,6 +24177,22 @@ const run = async ({
|
|
|
24185
24177
|
callbacks.push(() => {
|
|
24186
24178
|
result.consoleCalls = consoleCalls;
|
|
24187
24179
|
});
|
|
24180
|
+
} // we do not keep coverage in memory, it can grow very big
|
|
24181
|
+
// instead we store it on the filesystem
|
|
24182
|
+
// and they can be read later at "coverageFileUrl"
|
|
24183
|
+
|
|
24184
|
+
|
|
24185
|
+
let coverageFileUrl;
|
|
24186
|
+
|
|
24187
|
+
if (coverageEnabled) {
|
|
24188
|
+
coverageFileUrl = new URL(`./${runtime.name}/${cuid()}.json`, coverageTempDirectoryUrl).href;
|
|
24189
|
+
await ensureParentDirectories(coverageFileUrl);
|
|
24190
|
+
|
|
24191
|
+
if (coverageEnabled) {
|
|
24192
|
+
result.coverageFileUrl = coverageFileUrl; // written within the child_process/worker_thread or during runtime.run()
|
|
24193
|
+
// for browsers
|
|
24194
|
+
// (because it takes time to serialize and transfer the coverage object)
|
|
24195
|
+
}
|
|
24188
24196
|
}
|
|
24189
24197
|
|
|
24190
24198
|
const startMs = Date.now();
|
|
@@ -24209,7 +24217,9 @@ const run = async ({
|
|
|
24209
24217
|
signal: runOperation.signal,
|
|
24210
24218
|
logger,
|
|
24211
24219
|
...runtimeParams,
|
|
24220
|
+
collectConsole,
|
|
24212
24221
|
collectPerformance,
|
|
24222
|
+
coverageFileUrl,
|
|
24213
24223
|
keepRunning,
|
|
24214
24224
|
stopSignal,
|
|
24215
24225
|
onConsole: log => onConsoleRef.current(log)
|
|
@@ -24234,8 +24244,7 @@ const run = async ({
|
|
|
24234
24244
|
status,
|
|
24235
24245
|
namespace,
|
|
24236
24246
|
error,
|
|
24237
|
-
performance
|
|
24238
|
-
coverage
|
|
24247
|
+
performance
|
|
24239
24248
|
} = winner.data;
|
|
24240
24249
|
result.status = status;
|
|
24241
24250
|
|
|
@@ -24249,27 +24258,13 @@ const run = async ({
|
|
|
24249
24258
|
result.performance = performance;
|
|
24250
24259
|
}
|
|
24251
24260
|
|
|
24252
|
-
if (coverageEnabled) {
|
|
24253
|
-
if (coverage) {
|
|
24254
|
-
// we do not keep coverage in memory, it can grow very big
|
|
24255
|
-
// instead we store it on the filesystem
|
|
24256
|
-
// and they can be read later at "coverageFileUrl"
|
|
24257
|
-
const coverageFileUrl = new URL(`./${runtime.name}/${cuid()}.json`, coverageTempDirectoryUrl);
|
|
24258
|
-
writeFileSync(coverageFileUrl, JSON.stringify(coverage, null, " "));
|
|
24259
|
-
result.coverageFileUrl = coverageFileUrl.href;
|
|
24260
|
-
} else {// will eventually log a warning in report_to_coverage.js
|
|
24261
|
-
}
|
|
24262
|
-
}
|
|
24263
|
-
|
|
24264
24261
|
callbacks.forEach(callback => {
|
|
24265
24262
|
callback();
|
|
24266
24263
|
});
|
|
24267
24264
|
return result;
|
|
24268
24265
|
} catch (e) {
|
|
24269
|
-
result =
|
|
24270
|
-
|
|
24271
|
-
error: e
|
|
24272
|
-
};
|
|
24266
|
+
result.status = "errored";
|
|
24267
|
+
result.error = e;
|
|
24273
24268
|
callbacks.forEach(callback => {
|
|
24274
24269
|
callback();
|
|
24275
24270
|
});
|
|
@@ -24767,7 +24762,7 @@ const executePlan = async (plan, {
|
|
|
24767
24762
|
} else {
|
|
24768
24763
|
coverageMethodForNodeJs = "Profiler";
|
|
24769
24764
|
logger.warn(createDetailedMessage$1(`process.env.NODE_V8_COVERAGE is required to generate coverage for Node.js subprocesses`, {
|
|
24770
|
-
"suggestion": `
|
|
24765
|
+
"suggestion": `set process.env.NODE_V8_COVERAGE`,
|
|
24771
24766
|
"suggestion 2": `use coverageMethodForNodeJs: "Profiler". But it means coverage for child_process and worker_thread cannot be collected`
|
|
24772
24767
|
}));
|
|
24773
24768
|
}
|
|
@@ -24845,7 +24840,7 @@ const executePlan = async (plan, {
|
|
|
24845
24840
|
getCustomBabelPlugins: ({
|
|
24846
24841
|
clientRuntimeCompat
|
|
24847
24842
|
}) => {
|
|
24848
|
-
if (coverageEnabled && Object.keys(clientRuntimeCompat)[0] !== "chrome") {
|
|
24843
|
+
if (coverageEnabled && (coverageMethodForBrowsers !== "playwright_api" || Object.keys(clientRuntimeCompat)[0] !== "chrome")) {
|
|
24849
24844
|
return {
|
|
24850
24845
|
"transform-instrument": [babelPluginInstrument, {
|
|
24851
24846
|
rootDirectoryUrl,
|
|
@@ -25269,8 +25264,7 @@ const executeTestPlan = async ({
|
|
|
25269
25264
|
},
|
|
25270
25265
|
coverageIncludeMissing = true,
|
|
25271
25266
|
coverageAndExecutionAllowed = false,
|
|
25272
|
-
coverageMethodForNodeJs = "NODE_V8_COVERAGE",
|
|
25273
|
-
// "Profiler" also accepted
|
|
25267
|
+
coverageMethodForNodeJs = process.env.NODE_V8_COVERAGE ? "NODE_V8_COVERAGE" : "Profiler",
|
|
25274
25268
|
coverageMethodForBrowsers = "playwright_api",
|
|
25275
25269
|
// "istanbul" also accepted
|
|
25276
25270
|
coverageV8ConflictWarning = true,
|
|
@@ -25508,6 +25502,7 @@ const createRuntimeFromPlaywright = ({
|
|
|
25508
25502
|
coverageEnabled = false,
|
|
25509
25503
|
coverageConfig,
|
|
25510
25504
|
coverageMethodForBrowsers,
|
|
25505
|
+
coverageFileUrl,
|
|
25511
25506
|
stopAfterAllSignal,
|
|
25512
25507
|
stopSignal,
|
|
25513
25508
|
keepRunning,
|
|
@@ -25590,13 +25585,14 @@ const createRuntimeFromPlaywright = ({
|
|
|
25590
25585
|
}
|
|
25591
25586
|
};
|
|
25592
25587
|
|
|
25593
|
-
|
|
25588
|
+
const result = {};
|
|
25589
|
+
const callbacks = [];
|
|
25594
25590
|
|
|
25595
25591
|
if (coverageEnabled) {
|
|
25596
25592
|
if (coveragePlaywrightAPIAvailable && coverageMethodForBrowsers === "playwright_api") {
|
|
25597
25593
|
await page.coverage.startJSCoverage({// reportAnonymousScripts: true,
|
|
25598
25594
|
});
|
|
25599
|
-
|
|
25595
|
+
callbacks.push(async () => {
|
|
25600
25596
|
const v8CoveragesWithWebUrls = await page.coverage.stopJSCoverage(); // we convert urls starting with http:// to file:// because we later
|
|
25601
25597
|
// convert the url to filesystem path in istanbulCoverageFromV8Coverage function
|
|
25602
25598
|
|
|
@@ -25617,23 +25613,20 @@ const createRuntimeFromPlaywright = ({
|
|
|
25617
25613
|
rootDirectoryUrl,
|
|
25618
25614
|
coverageConfig
|
|
25619
25615
|
});
|
|
25620
|
-
|
|
25621
|
-
coverage
|
|
25622
|
-
};
|
|
25616
|
+
writeFileSync$1(new URL(coverageFileUrl), JSON.stringify(coverage, null, " "));
|
|
25623
25617
|
});
|
|
25624
25618
|
} else {
|
|
25625
|
-
|
|
25619
|
+
callbacks.push(() => {
|
|
25626
25620
|
const scriptExecutionResults = result.namespace;
|
|
25627
25621
|
|
|
25628
25622
|
if (scriptExecutionResults) {
|
|
25629
|
-
|
|
25623
|
+
const coverage = generateCoverageForPage(scriptExecutionResults) || {};
|
|
25624
|
+
writeFileSync$1(new URL(coverageFileUrl), JSON.stringify(coverage, null, " "));
|
|
25630
25625
|
}
|
|
25631
|
-
|
|
25632
|
-
return result;
|
|
25633
25626
|
});
|
|
25634
25627
|
}
|
|
25635
25628
|
} else {
|
|
25636
|
-
|
|
25629
|
+
callbacks.push(() => {
|
|
25637
25630
|
const scriptExecutionResults = result.namespace;
|
|
25638
25631
|
|
|
25639
25632
|
if (scriptExecutionResults) {
|
|
@@ -25641,13 +25634,11 @@ const createRuntimeFromPlaywright = ({
|
|
|
25641
25634
|
delete scriptExecutionResults[fileRelativeUrl].coverage;
|
|
25642
25635
|
});
|
|
25643
25636
|
}
|
|
25644
|
-
|
|
25645
|
-
return result;
|
|
25646
25637
|
});
|
|
25647
25638
|
}
|
|
25648
25639
|
|
|
25649
25640
|
if (collectPerformance) {
|
|
25650
|
-
|
|
25641
|
+
callbacks.push(async () => {
|
|
25651
25642
|
const performance = await page.evaluate(
|
|
25652
25643
|
/* eslint-disable no-undef */
|
|
25653
25644
|
|
|
@@ -25676,7 +25667,6 @@ const createRuntimeFromPlaywright = ({
|
|
|
25676
25667
|
/* eslint-enable no-undef */
|
|
25677
25668
|
);
|
|
25678
25669
|
result.performance = performance;
|
|
25679
|
-
return result;
|
|
25680
25670
|
});
|
|
25681
25671
|
}
|
|
25682
25672
|
|
|
@@ -25770,7 +25760,7 @@ const createRuntimeFromPlaywright = ({
|
|
|
25770
25760
|
await page.goto(fileClientUrl, {
|
|
25771
25761
|
timeout: 0
|
|
25772
25762
|
});
|
|
25773
|
-
const
|
|
25763
|
+
const returnValue = await page.evaluate(
|
|
25774
25764
|
/* eslint-disable no-undef */
|
|
25775
25765
|
|
|
25776
25766
|
/* istanbul ignore next */
|
|
@@ -25786,12 +25776,12 @@ const createRuntimeFromPlaywright = ({
|
|
|
25786
25776
|
const {
|
|
25787
25777
|
status,
|
|
25788
25778
|
scriptExecutionResults
|
|
25789
|
-
} =
|
|
25779
|
+
} = returnValue;
|
|
25790
25780
|
|
|
25791
25781
|
if (status === "errored") {
|
|
25792
25782
|
const {
|
|
25793
25783
|
exceptionSource
|
|
25794
|
-
} =
|
|
25784
|
+
} = returnValue;
|
|
25795
25785
|
const error = evalException(exceptionSource, {
|
|
25796
25786
|
rootDirectoryUrl,
|
|
25797
25787
|
server,
|
|
@@ -25842,16 +25832,32 @@ const createRuntimeFromPlaywright = ({
|
|
|
25842
25832
|
return winner.data;
|
|
25843
25833
|
};
|
|
25844
25834
|
|
|
25845
|
-
let result;
|
|
25846
|
-
|
|
25847
25835
|
try {
|
|
25848
|
-
|
|
25849
|
-
|
|
25836
|
+
const {
|
|
25837
|
+
status,
|
|
25838
|
+
error,
|
|
25839
|
+
namespace,
|
|
25840
|
+
performance
|
|
25841
|
+
} = await getResult();
|
|
25842
|
+
result.status = status;
|
|
25843
|
+
|
|
25844
|
+
if (status === "errored") {
|
|
25845
|
+
result.error = error;
|
|
25846
|
+
} else {
|
|
25847
|
+
result.namespace = namespace;
|
|
25848
|
+
}
|
|
25849
|
+
|
|
25850
|
+
if (collectPerformance) {
|
|
25851
|
+
result.performance = performance;
|
|
25852
|
+
}
|
|
25853
|
+
|
|
25854
|
+
await callbacks.reduce(async (previous, callback) => {
|
|
25855
|
+
await previous;
|
|
25856
|
+
await callback();
|
|
25857
|
+
}, Promise.resolve());
|
|
25850
25858
|
} catch (e) {
|
|
25851
|
-
result =
|
|
25852
|
-
|
|
25853
|
-
error: e
|
|
25854
|
-
};
|
|
25859
|
+
result.status = "errored";
|
|
25860
|
+
result.error = e;
|
|
25855
25861
|
}
|
|
25856
25862
|
|
|
25857
25863
|
if (keepRunning) {
|
|
@@ -25969,13 +25975,6 @@ const isTargetClosedError = error => {
|
|
|
25969
25975
|
return false;
|
|
25970
25976
|
};
|
|
25971
25977
|
|
|
25972
|
-
const composeTransformer = (previousTransformer, transformer) => {
|
|
25973
|
-
return async value => {
|
|
25974
|
-
const transformedValue = await previousTransformer(value);
|
|
25975
|
-
return transformer(transformedValue);
|
|
25976
|
-
};
|
|
25977
|
-
};
|
|
25978
|
-
|
|
25979
25978
|
const extractTextFromConsoleMessage = consoleMessage => {
|
|
25980
25979
|
return consoleMessage.text(); // ensure we use a string so that istanbul won't try
|
|
25981
25980
|
// to put any coverage statement inside it
|
|
@@ -26385,6 +26384,7 @@ nodeChildProcess.run = async ({
|
|
|
26385
26384
|
coverageEnabled = false,
|
|
26386
26385
|
coverageConfig,
|
|
26387
26386
|
coverageMethodForNodeJs,
|
|
26387
|
+
coverageFileUrl,
|
|
26388
26388
|
collectPerformance,
|
|
26389
26389
|
env,
|
|
26390
26390
|
debugPort,
|
|
@@ -26548,6 +26548,7 @@ nodeChildProcess.run = async ({
|
|
|
26548
26548
|
coverageEnabled,
|
|
26549
26549
|
coverageConfig,
|
|
26550
26550
|
coverageMethodForNodeJs,
|
|
26551
|
+
coverageFileUrl,
|
|
26551
26552
|
exitAfterAction: true
|
|
26552
26553
|
}
|
|
26553
26554
|
}
|
|
@@ -26728,10 +26729,12 @@ nodeWorkerThread.run = async ({
|
|
|
26728
26729
|
keepRunning,
|
|
26729
26730
|
stopSignal,
|
|
26730
26731
|
onConsole,
|
|
26732
|
+
collectConsole = false,
|
|
26733
|
+
collectPerformance,
|
|
26734
|
+
coverageEnabled = false,
|
|
26731
26735
|
coverageConfig,
|
|
26732
26736
|
coverageMethodForNodeJs,
|
|
26733
|
-
|
|
26734
|
-
collectPerformance,
|
|
26737
|
+
coverageFileUrl,
|
|
26735
26738
|
env,
|
|
26736
26739
|
debugPort,
|
|
26737
26740
|
debugMode,
|
|
@@ -26797,11 +26800,14 @@ nodeWorkerThread.run = async ({
|
|
|
26797
26800
|
const stop = memoize(async () => {
|
|
26798
26801
|
// read all stdout before terminating
|
|
26799
26802
|
// (no need for stderr because it's sync)
|
|
26800
|
-
|
|
26803
|
+
if (collectConsole) {
|
|
26804
|
+
while (workerThread.stdout.read() !== null) {}
|
|
26805
|
+
|
|
26806
|
+
await new Promise(resolve => {
|
|
26807
|
+
setTimeout(resolve, 50);
|
|
26808
|
+
});
|
|
26809
|
+
}
|
|
26801
26810
|
|
|
26802
|
-
await new Promise(resolve => {
|
|
26803
|
-
setTimeout(resolve);
|
|
26804
|
-
});
|
|
26805
26811
|
await workerThread.terminate();
|
|
26806
26812
|
});
|
|
26807
26813
|
const winnerPromise = new Promise(resolve => {
|
|
@@ -26841,6 +26847,7 @@ nodeWorkerThread.run = async ({
|
|
|
26841
26847
|
coverageEnabled,
|
|
26842
26848
|
coverageConfig,
|
|
26843
26849
|
coverageMethodForNodeJs,
|
|
26850
|
+
coverageFileUrl,
|
|
26844
26851
|
exitAfterAction: true
|
|
26845
26852
|
}
|
|
26846
26853
|
}
|
|
@@ -27098,9 +27105,6 @@ ${createRepartitionMessage(graphReport)}
|
|
|
27098
27105
|
};
|
|
27099
27106
|
|
|
27100
27107
|
const createUrlGraphReport = urlGraph => {
|
|
27101
|
-
const {
|
|
27102
|
-
urlInfos
|
|
27103
|
-
} = urlGraph;
|
|
27104
27108
|
const countGroups = {
|
|
27105
27109
|
sourcemaps: 0,
|
|
27106
27110
|
html: 0,
|
|
@@ -27119,15 +27123,14 @@ const createUrlGraphReport = urlGraph => {
|
|
|
27119
27123
|
other: 0,
|
|
27120
27124
|
total: 0
|
|
27121
27125
|
};
|
|
27122
|
-
|
|
27123
|
-
if (url.startsWith("data:")) {
|
|
27126
|
+
urlGraph.urlInfoMap.forEach(urlInfo => {
|
|
27127
|
+
if (urlInfo.url.startsWith("data:")) {
|
|
27124
27128
|
return;
|
|
27125
|
-
}
|
|
27126
|
-
|
|
27127
|
-
const urlInfo = urlInfos[url]; // ignore:
|
|
27129
|
+
} // ignore:
|
|
27128
27130
|
// - inline files: they are already taken into account in the file where they appear
|
|
27129
27131
|
// - ignored files: we don't know their content
|
|
27130
27132
|
|
|
27133
|
+
|
|
27131
27134
|
if (urlInfo.isInline || !urlInfo.shouldHandle) {
|
|
27132
27135
|
return;
|
|
27133
27136
|
} // file loaded via import assertion are already inside the graph
|
|
@@ -27305,20 +27308,18 @@ const createRepartitionMessage = ({
|
|
|
27305
27308
|
|
|
27306
27309
|
const GRAPH = {
|
|
27307
27310
|
map: (graph, callback) => {
|
|
27308
|
-
|
|
27309
|
-
|
|
27311
|
+
const array = [];
|
|
27312
|
+
graph.urlInfoMap.forEach(urlInfo => {
|
|
27313
|
+
array.push(callback(urlInfo));
|
|
27310
27314
|
});
|
|
27315
|
+
return array;
|
|
27311
27316
|
},
|
|
27312
27317
|
forEach: (graph, callback) => {
|
|
27313
|
-
|
|
27314
|
-
callback(graph.urlInfos[url], url);
|
|
27315
|
-
});
|
|
27318
|
+
graph.urlInfoMap.forEach(callback);
|
|
27316
27319
|
},
|
|
27317
27320
|
filter: (graph, callback) => {
|
|
27318
27321
|
const urlInfos = [];
|
|
27319
|
-
|
|
27320
|
-
const urlInfo = graph.urlInfos[url];
|
|
27321
|
-
|
|
27322
|
+
graph.urlInfoMap.forEach(urlInfo => {
|
|
27322
27323
|
if (callback(urlInfo)) {
|
|
27323
27324
|
urlInfos.push(urlInfo);
|
|
27324
27325
|
}
|
|
@@ -27326,10 +27327,16 @@ const GRAPH = {
|
|
|
27326
27327
|
return urlInfos;
|
|
27327
27328
|
},
|
|
27328
27329
|
find: (graph, callback) => {
|
|
27329
|
-
|
|
27330
|
-
|
|
27331
|
-
|
|
27332
|
-
|
|
27330
|
+
let found = null;
|
|
27331
|
+
|
|
27332
|
+
for (const urlInfo of graph.urlInfoMap.values()) {
|
|
27333
|
+
if (callback(urlInfo)) {
|
|
27334
|
+
found = urlInfo;
|
|
27335
|
+
break;
|
|
27336
|
+
}
|
|
27337
|
+
}
|
|
27338
|
+
|
|
27339
|
+
return found;
|
|
27333
27340
|
}
|
|
27334
27341
|
};
|
|
27335
27342
|
|
|
@@ -28475,7 +28482,7 @@ build ${entryPointKeys.length} entry points`);
|
|
|
28475
28482
|
|
|
28476
28483
|
buildTask.done();
|
|
28477
28484
|
logger.debug(`graph urls pre-versioning:
|
|
28478
|
-
${
|
|
28485
|
+
${Array.from(finalGraph.urlInfoMap.keys()).join("\n")}`);
|
|
28479
28486
|
|
|
28480
28487
|
if (versioning) {
|
|
28481
28488
|
await applyUrlVersioning({
|
|
@@ -28731,7 +28738,7 @@ const applyUrlVersioning = async ({
|
|
|
28731
28738
|
});
|
|
28732
28739
|
|
|
28733
28740
|
try {
|
|
28734
|
-
const urlsSorted = sortByDependencies(finalGraph.
|
|
28741
|
+
const urlsSorted = sortByDependencies(finalGraph.toObject());
|
|
28735
28742
|
urlsSorted.forEach(url => {
|
|
28736
28743
|
if (url.startsWith("data:")) {
|
|
28737
28744
|
return;
|