@jsenv/core 27.3.1 → 27.3.4
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 +169 -146
- 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 +29 -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 +13 -2
- package/src/omega/url_graph/url_graph_report.js +2 -4
- package/src/omega/url_graph.js +29 -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
package/dist/main.js
CHANGED
|
@@ -2654,6 +2654,22 @@ const statusIsClientError = status => status >= 400 && status < 500;
|
|
|
2654
2654
|
|
|
2655
2655
|
const statusIsServerError = status => status >= 500 && status < 600;
|
|
2656
2656
|
|
|
2657
|
+
const applyDnsResolution = async hostname => {
|
|
2658
|
+
const dnsResolution = await new Promise((resolve, reject) => {
|
|
2659
|
+
lookup(hostname, (error, address, family) => {
|
|
2660
|
+
if (error) {
|
|
2661
|
+
reject(error);
|
|
2662
|
+
} else {
|
|
2663
|
+
resolve({
|
|
2664
|
+
address,
|
|
2665
|
+
family
|
|
2666
|
+
});
|
|
2667
|
+
}
|
|
2668
|
+
});
|
|
2669
|
+
});
|
|
2670
|
+
return dnsResolution;
|
|
2671
|
+
};
|
|
2672
|
+
|
|
2657
2673
|
const getServerOrigins = async ({
|
|
2658
2674
|
protocol,
|
|
2659
2675
|
ip,
|
|
@@ -2684,22 +2700,6 @@ const getServerOrigins = async ({
|
|
|
2684
2700
|
};
|
|
2685
2701
|
};
|
|
2686
2702
|
|
|
2687
|
-
const applyDnsResolution = async hostname => {
|
|
2688
|
-
const dnsResolution = await new Promise((resolve, reject) => {
|
|
2689
|
-
lookup(hostname, (error, address, family) => {
|
|
2690
|
-
if (error) {
|
|
2691
|
-
reject(error);
|
|
2692
|
-
} else {
|
|
2693
|
-
resolve({
|
|
2694
|
-
address,
|
|
2695
|
-
family
|
|
2696
|
-
});
|
|
2697
|
-
}
|
|
2698
|
-
});
|
|
2699
|
-
});
|
|
2700
|
-
return dnsResolution;
|
|
2701
|
-
};
|
|
2702
|
-
|
|
2703
2703
|
const createServerOrigin = ({
|
|
2704
2704
|
protocol,
|
|
2705
2705
|
hostname,
|
|
@@ -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;
|
|
@@ -20887,6 +20871,13 @@ const createUrlGraph = ({
|
|
|
20887
20871
|
iterate(dependentUrlInfo);
|
|
20888
20872
|
}
|
|
20889
20873
|
});
|
|
20874
|
+
urlInfo.dependencies.forEach(dependencyUrl => {
|
|
20875
|
+
const dependencyUrlInfo = getUrlInfo(dependencyUrl);
|
|
20876
|
+
|
|
20877
|
+
if (dependencyUrlInfo.isInline) {
|
|
20878
|
+
iterate(dependencyUrlInfo);
|
|
20879
|
+
}
|
|
20880
|
+
});
|
|
20890
20881
|
};
|
|
20891
20882
|
|
|
20892
20883
|
iterate(urlInfo);
|
|
@@ -20908,7 +20899,7 @@ const createUrlGraph = ({
|
|
|
20908
20899
|
};
|
|
20909
20900
|
|
|
20910
20901
|
return {
|
|
20911
|
-
|
|
20902
|
+
urlInfoMap,
|
|
20912
20903
|
reuseOrCreateUrlInfo,
|
|
20913
20904
|
getUrlInfo,
|
|
20914
20905
|
deleteUrlInfo,
|
|
@@ -20917,13 +20908,20 @@ const createUrlGraph = ({
|
|
|
20917
20908
|
updateReferences,
|
|
20918
20909
|
considerModified,
|
|
20919
20910
|
getRelatedUrlInfos,
|
|
20911
|
+
toObject: () => {
|
|
20912
|
+
const data = {};
|
|
20913
|
+
urlInfoMap.forEach(urlInfo => {
|
|
20914
|
+
data[urlInfo.url] = urlInfo;
|
|
20915
|
+
});
|
|
20916
|
+
return data;
|
|
20917
|
+
},
|
|
20920
20918
|
toJSON: rootDirectoryUrl => {
|
|
20921
20919
|
const data = {};
|
|
20922
|
-
|
|
20923
|
-
const dependencyUrls = Array.from(
|
|
20920
|
+
urlInfoMap.forEach(urlInfo => {
|
|
20921
|
+
const dependencyUrls = Array.from(urlInfo.dependencies);
|
|
20924
20922
|
|
|
20925
20923
|
if (dependencyUrls.length) {
|
|
20926
|
-
const relativeUrl = urlToRelativeUrl(url, rootDirectoryUrl);
|
|
20924
|
+
const relativeUrl = urlToRelativeUrl(urlInfo.url, rootDirectoryUrl);
|
|
20927
20925
|
data[relativeUrl] = dependencyUrls.map(dependencyUrl => urlToRelativeUrl(dependencyUrl, rootDirectoryUrl));
|
|
20928
20926
|
}
|
|
20929
20927
|
});
|
|
@@ -24003,7 +24001,7 @@ const reportToCoverage = async (report, {
|
|
|
24003
24001
|
// coverDescription will generate empty coverage for files
|
|
24004
24002
|
// that were suppose to be coverage but were not.
|
|
24005
24003
|
if (executionResult.status === "completed" && executionResult.type === "node" && coverageMethodForNodeJs !== "NODE_V8_COVERAGE") {
|
|
24006
|
-
logger.warn(`
|
|
24004
|
+
logger.warn(`"${executionName}" execution of ${file} did not properly write coverage into ${executionResult.coverageFileUrl}`);
|
|
24007
24005
|
}
|
|
24008
24006
|
}
|
|
24009
24007
|
});
|
|
@@ -24084,17 +24082,22 @@ const getCoverageFromReport = async ({
|
|
|
24084
24082
|
const {
|
|
24085
24083
|
coverageFileUrl
|
|
24086
24084
|
} = executionResultForFileOnRuntime;
|
|
24085
|
+
let executionCoverage;
|
|
24087
24086
|
|
|
24088
|
-
|
|
24089
|
-
|
|
24090
|
-
|
|
24091
|
-
|
|
24092
|
-
|
|
24093
|
-
|
|
24094
|
-
|
|
24095
|
-
|
|
24087
|
+
try {
|
|
24088
|
+
executionCoverage = JSON.parse(String(readFileSync$1(new URL(coverageFileUrl))));
|
|
24089
|
+
} catch (e) {
|
|
24090
|
+
if (e.code === "ENOENT" || e.name === "SyntaxError") {
|
|
24091
|
+
onMissing({
|
|
24092
|
+
executionName,
|
|
24093
|
+
file,
|
|
24094
|
+
executionResult: executionResultForFileOnRuntime
|
|
24095
|
+
});
|
|
24096
|
+
return;
|
|
24097
|
+
}
|
|
24096
24098
|
|
|
24097
|
-
|
|
24099
|
+
throw e;
|
|
24100
|
+
}
|
|
24098
24101
|
|
|
24099
24102
|
if (isV8Coverage(executionCoverage)) {
|
|
24100
24103
|
v8Coverage = v8Coverage ? composeTwoV8Coverages(v8Coverage, executionCoverage) : executionCoverage;
|
|
@@ -24127,7 +24130,7 @@ const run = async ({
|
|
|
24127
24130
|
runtime,
|
|
24128
24131
|
runtimeParams
|
|
24129
24132
|
}) => {
|
|
24130
|
-
|
|
24133
|
+
const result = {};
|
|
24131
24134
|
const callbacks = [];
|
|
24132
24135
|
const onConsoleRef = {
|
|
24133
24136
|
current: () => {}
|
|
@@ -24145,18 +24148,16 @@ const run = async ({
|
|
|
24145
24148
|
const timeoutAbortSource = runOperation.timeout(allocatedMs);
|
|
24146
24149
|
callbacks.push(() => {
|
|
24147
24150
|
if (result.status === "errored" && Abort.isAbortError(result.error) && timeoutAbortSource.signal.aborted) {
|
|
24148
|
-
result =
|
|
24149
|
-
|
|
24150
|
-
};
|
|
24151
|
+
result.status = "timedout";
|
|
24152
|
+
delete result.error;
|
|
24151
24153
|
}
|
|
24152
24154
|
});
|
|
24153
24155
|
}
|
|
24154
24156
|
|
|
24155
24157
|
callbacks.push(() => {
|
|
24156
24158
|
if (result.status === "errored" && Abort.isAbortError(result.error)) {
|
|
24157
|
-
result =
|
|
24158
|
-
|
|
24159
|
-
};
|
|
24159
|
+
result.status = "aborted";
|
|
24160
|
+
delete result.error;
|
|
24160
24161
|
}
|
|
24161
24162
|
});
|
|
24162
24163
|
const consoleCalls = [];
|
|
@@ -24185,6 +24186,22 @@ const run = async ({
|
|
|
24185
24186
|
callbacks.push(() => {
|
|
24186
24187
|
result.consoleCalls = consoleCalls;
|
|
24187
24188
|
});
|
|
24189
|
+
} // we do not keep coverage in memory, it can grow very big
|
|
24190
|
+
// instead we store it on the filesystem
|
|
24191
|
+
// and they can be read later at "coverageFileUrl"
|
|
24192
|
+
|
|
24193
|
+
|
|
24194
|
+
let coverageFileUrl;
|
|
24195
|
+
|
|
24196
|
+
if (coverageEnabled) {
|
|
24197
|
+
coverageFileUrl = new URL(`./${runtime.name}/${cuid()}.json`, coverageTempDirectoryUrl).href;
|
|
24198
|
+
await ensureParentDirectories(coverageFileUrl);
|
|
24199
|
+
|
|
24200
|
+
if (coverageEnabled) {
|
|
24201
|
+
result.coverageFileUrl = coverageFileUrl; // written within the child_process/worker_thread or during runtime.run()
|
|
24202
|
+
// for browsers
|
|
24203
|
+
// (because it takes time to serialize and transfer the coverage object)
|
|
24204
|
+
}
|
|
24188
24205
|
}
|
|
24189
24206
|
|
|
24190
24207
|
const startMs = Date.now();
|
|
@@ -24209,7 +24226,9 @@ const run = async ({
|
|
|
24209
24226
|
signal: runOperation.signal,
|
|
24210
24227
|
logger,
|
|
24211
24228
|
...runtimeParams,
|
|
24229
|
+
collectConsole,
|
|
24212
24230
|
collectPerformance,
|
|
24231
|
+
coverageFileUrl,
|
|
24213
24232
|
keepRunning,
|
|
24214
24233
|
stopSignal,
|
|
24215
24234
|
onConsole: log => onConsoleRef.current(log)
|
|
@@ -24234,8 +24253,7 @@ const run = async ({
|
|
|
24234
24253
|
status,
|
|
24235
24254
|
namespace,
|
|
24236
24255
|
error,
|
|
24237
|
-
performance
|
|
24238
|
-
coverage
|
|
24256
|
+
performance
|
|
24239
24257
|
} = winner.data;
|
|
24240
24258
|
result.status = status;
|
|
24241
24259
|
|
|
@@ -24249,27 +24267,13 @@ const run = async ({
|
|
|
24249
24267
|
result.performance = performance;
|
|
24250
24268
|
}
|
|
24251
24269
|
|
|
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
24270
|
callbacks.forEach(callback => {
|
|
24265
24271
|
callback();
|
|
24266
24272
|
});
|
|
24267
24273
|
return result;
|
|
24268
24274
|
} catch (e) {
|
|
24269
|
-
result =
|
|
24270
|
-
|
|
24271
|
-
error: e
|
|
24272
|
-
};
|
|
24275
|
+
result.status = "errored";
|
|
24276
|
+
result.error = e;
|
|
24273
24277
|
callbacks.forEach(callback => {
|
|
24274
24278
|
callback();
|
|
24275
24279
|
});
|
|
@@ -24767,7 +24771,7 @@ const executePlan = async (plan, {
|
|
|
24767
24771
|
} else {
|
|
24768
24772
|
coverageMethodForNodeJs = "Profiler";
|
|
24769
24773
|
logger.warn(createDetailedMessage$1(`process.env.NODE_V8_COVERAGE is required to generate coverage for Node.js subprocesses`, {
|
|
24770
|
-
"suggestion": `
|
|
24774
|
+
"suggestion": `set process.env.NODE_V8_COVERAGE`,
|
|
24771
24775
|
"suggestion 2": `use coverageMethodForNodeJs: "Profiler". But it means coverage for child_process and worker_thread cannot be collected`
|
|
24772
24776
|
}));
|
|
24773
24777
|
}
|
|
@@ -24845,7 +24849,7 @@ const executePlan = async (plan, {
|
|
|
24845
24849
|
getCustomBabelPlugins: ({
|
|
24846
24850
|
clientRuntimeCompat
|
|
24847
24851
|
}) => {
|
|
24848
|
-
if (coverageEnabled && Object.keys(clientRuntimeCompat)[0] !== "chrome") {
|
|
24852
|
+
if (coverageEnabled && (coverageMethodForBrowsers !== "playwright_api" || Object.keys(clientRuntimeCompat)[0] !== "chrome")) {
|
|
24849
24853
|
return {
|
|
24850
24854
|
"transform-instrument": [babelPluginInstrument, {
|
|
24851
24855
|
rootDirectoryUrl,
|
|
@@ -25269,8 +25273,7 @@ const executeTestPlan = async ({
|
|
|
25269
25273
|
},
|
|
25270
25274
|
coverageIncludeMissing = true,
|
|
25271
25275
|
coverageAndExecutionAllowed = false,
|
|
25272
|
-
coverageMethodForNodeJs = "NODE_V8_COVERAGE",
|
|
25273
|
-
// "Profiler" also accepted
|
|
25276
|
+
coverageMethodForNodeJs = process.env.NODE_V8_COVERAGE ? "NODE_V8_COVERAGE" : "Profiler",
|
|
25274
25277
|
coverageMethodForBrowsers = "playwright_api",
|
|
25275
25278
|
// "istanbul" also accepted
|
|
25276
25279
|
coverageV8ConflictWarning = true,
|
|
@@ -25508,6 +25511,7 @@ const createRuntimeFromPlaywright = ({
|
|
|
25508
25511
|
coverageEnabled = false,
|
|
25509
25512
|
coverageConfig,
|
|
25510
25513
|
coverageMethodForBrowsers,
|
|
25514
|
+
coverageFileUrl,
|
|
25511
25515
|
stopAfterAllSignal,
|
|
25512
25516
|
stopSignal,
|
|
25513
25517
|
keepRunning,
|
|
@@ -25590,13 +25594,14 @@ const createRuntimeFromPlaywright = ({
|
|
|
25590
25594
|
}
|
|
25591
25595
|
};
|
|
25592
25596
|
|
|
25593
|
-
|
|
25597
|
+
const result = {};
|
|
25598
|
+
const callbacks = [];
|
|
25594
25599
|
|
|
25595
25600
|
if (coverageEnabled) {
|
|
25596
25601
|
if (coveragePlaywrightAPIAvailable && coverageMethodForBrowsers === "playwright_api") {
|
|
25597
25602
|
await page.coverage.startJSCoverage({// reportAnonymousScripts: true,
|
|
25598
25603
|
});
|
|
25599
|
-
|
|
25604
|
+
callbacks.push(async () => {
|
|
25600
25605
|
const v8CoveragesWithWebUrls = await page.coverage.stopJSCoverage(); // we convert urls starting with http:// to file:// because we later
|
|
25601
25606
|
// convert the url to filesystem path in istanbulCoverageFromV8Coverage function
|
|
25602
25607
|
|
|
@@ -25617,23 +25622,20 @@ const createRuntimeFromPlaywright = ({
|
|
|
25617
25622
|
rootDirectoryUrl,
|
|
25618
25623
|
coverageConfig
|
|
25619
25624
|
});
|
|
25620
|
-
|
|
25621
|
-
coverage
|
|
25622
|
-
};
|
|
25625
|
+
writeFileSync$1(new URL(coverageFileUrl), JSON.stringify(coverage, null, " "));
|
|
25623
25626
|
});
|
|
25624
25627
|
} else {
|
|
25625
|
-
|
|
25628
|
+
callbacks.push(() => {
|
|
25626
25629
|
const scriptExecutionResults = result.namespace;
|
|
25627
25630
|
|
|
25628
25631
|
if (scriptExecutionResults) {
|
|
25629
|
-
|
|
25632
|
+
const coverage = generateCoverageForPage(scriptExecutionResults) || {};
|
|
25633
|
+
writeFileSync$1(new URL(coverageFileUrl), JSON.stringify(coverage, null, " "));
|
|
25630
25634
|
}
|
|
25631
|
-
|
|
25632
|
-
return result;
|
|
25633
25635
|
});
|
|
25634
25636
|
}
|
|
25635
25637
|
} else {
|
|
25636
|
-
|
|
25638
|
+
callbacks.push(() => {
|
|
25637
25639
|
const scriptExecutionResults = result.namespace;
|
|
25638
25640
|
|
|
25639
25641
|
if (scriptExecutionResults) {
|
|
@@ -25641,13 +25643,11 @@ const createRuntimeFromPlaywright = ({
|
|
|
25641
25643
|
delete scriptExecutionResults[fileRelativeUrl].coverage;
|
|
25642
25644
|
});
|
|
25643
25645
|
}
|
|
25644
|
-
|
|
25645
|
-
return result;
|
|
25646
25646
|
});
|
|
25647
25647
|
}
|
|
25648
25648
|
|
|
25649
25649
|
if (collectPerformance) {
|
|
25650
|
-
|
|
25650
|
+
callbacks.push(async () => {
|
|
25651
25651
|
const performance = await page.evaluate(
|
|
25652
25652
|
/* eslint-disable no-undef */
|
|
25653
25653
|
|
|
@@ -25676,7 +25676,6 @@ const createRuntimeFromPlaywright = ({
|
|
|
25676
25676
|
/* eslint-enable no-undef */
|
|
25677
25677
|
);
|
|
25678
25678
|
result.performance = performance;
|
|
25679
|
-
return result;
|
|
25680
25679
|
});
|
|
25681
25680
|
}
|
|
25682
25681
|
|
|
@@ -25770,7 +25769,7 @@ const createRuntimeFromPlaywright = ({
|
|
|
25770
25769
|
await page.goto(fileClientUrl, {
|
|
25771
25770
|
timeout: 0
|
|
25772
25771
|
});
|
|
25773
|
-
const
|
|
25772
|
+
const returnValue = await page.evaluate(
|
|
25774
25773
|
/* eslint-disable no-undef */
|
|
25775
25774
|
|
|
25776
25775
|
/* istanbul ignore next */
|
|
@@ -25786,12 +25785,12 @@ const createRuntimeFromPlaywright = ({
|
|
|
25786
25785
|
const {
|
|
25787
25786
|
status,
|
|
25788
25787
|
scriptExecutionResults
|
|
25789
|
-
} =
|
|
25788
|
+
} = returnValue;
|
|
25790
25789
|
|
|
25791
25790
|
if (status === "errored") {
|
|
25792
25791
|
const {
|
|
25793
25792
|
exceptionSource
|
|
25794
|
-
} =
|
|
25793
|
+
} = returnValue;
|
|
25795
25794
|
const error = evalException(exceptionSource, {
|
|
25796
25795
|
rootDirectoryUrl,
|
|
25797
25796
|
server,
|
|
@@ -25842,16 +25841,32 @@ const createRuntimeFromPlaywright = ({
|
|
|
25842
25841
|
return winner.data;
|
|
25843
25842
|
};
|
|
25844
25843
|
|
|
25845
|
-
let result;
|
|
25846
|
-
|
|
25847
25844
|
try {
|
|
25848
|
-
|
|
25849
|
-
|
|
25845
|
+
const {
|
|
25846
|
+
status,
|
|
25847
|
+
error,
|
|
25848
|
+
namespace,
|
|
25849
|
+
performance
|
|
25850
|
+
} = await getResult();
|
|
25851
|
+
result.status = status;
|
|
25852
|
+
|
|
25853
|
+
if (status === "errored") {
|
|
25854
|
+
result.error = error;
|
|
25855
|
+
} else {
|
|
25856
|
+
result.namespace = namespace;
|
|
25857
|
+
}
|
|
25858
|
+
|
|
25859
|
+
if (collectPerformance) {
|
|
25860
|
+
result.performance = performance;
|
|
25861
|
+
}
|
|
25862
|
+
|
|
25863
|
+
await callbacks.reduce(async (previous, callback) => {
|
|
25864
|
+
await previous;
|
|
25865
|
+
await callback();
|
|
25866
|
+
}, Promise.resolve());
|
|
25850
25867
|
} catch (e) {
|
|
25851
|
-
result =
|
|
25852
|
-
|
|
25853
|
-
error: e
|
|
25854
|
-
};
|
|
25868
|
+
result.status = "errored";
|
|
25869
|
+
result.error = e;
|
|
25855
25870
|
}
|
|
25856
25871
|
|
|
25857
25872
|
if (keepRunning) {
|
|
@@ -25969,13 +25984,6 @@ const isTargetClosedError = error => {
|
|
|
25969
25984
|
return false;
|
|
25970
25985
|
};
|
|
25971
25986
|
|
|
25972
|
-
const composeTransformer = (previousTransformer, transformer) => {
|
|
25973
|
-
return async value => {
|
|
25974
|
-
const transformedValue = await previousTransformer(value);
|
|
25975
|
-
return transformer(transformedValue);
|
|
25976
|
-
};
|
|
25977
|
-
};
|
|
25978
|
-
|
|
25979
25987
|
const extractTextFromConsoleMessage = consoleMessage => {
|
|
25980
25988
|
return consoleMessage.text(); // ensure we use a string so that istanbul won't try
|
|
25981
25989
|
// to put any coverage statement inside it
|
|
@@ -26385,6 +26393,7 @@ nodeChildProcess.run = async ({
|
|
|
26385
26393
|
coverageEnabled = false,
|
|
26386
26394
|
coverageConfig,
|
|
26387
26395
|
coverageMethodForNodeJs,
|
|
26396
|
+
coverageFileUrl,
|
|
26388
26397
|
collectPerformance,
|
|
26389
26398
|
env,
|
|
26390
26399
|
debugPort,
|
|
@@ -26548,6 +26557,7 @@ nodeChildProcess.run = async ({
|
|
|
26548
26557
|
coverageEnabled,
|
|
26549
26558
|
coverageConfig,
|
|
26550
26559
|
coverageMethodForNodeJs,
|
|
26560
|
+
coverageFileUrl,
|
|
26551
26561
|
exitAfterAction: true
|
|
26552
26562
|
}
|
|
26553
26563
|
}
|
|
@@ -26728,10 +26738,12 @@ nodeWorkerThread.run = async ({
|
|
|
26728
26738
|
keepRunning,
|
|
26729
26739
|
stopSignal,
|
|
26730
26740
|
onConsole,
|
|
26741
|
+
collectConsole = false,
|
|
26742
|
+
collectPerformance,
|
|
26743
|
+
coverageEnabled = false,
|
|
26731
26744
|
coverageConfig,
|
|
26732
26745
|
coverageMethodForNodeJs,
|
|
26733
|
-
|
|
26734
|
-
collectPerformance,
|
|
26746
|
+
coverageFileUrl,
|
|
26735
26747
|
env,
|
|
26736
26748
|
debugPort,
|
|
26737
26749
|
debugMode,
|
|
@@ -26795,6 +26807,16 @@ nodeWorkerThread.run = async ({
|
|
|
26795
26807
|
onceWorkerThreadMessage(workerThread, "ready", resolve);
|
|
26796
26808
|
});
|
|
26797
26809
|
const stop = memoize(async () => {
|
|
26810
|
+
// read all stdout before terminating
|
|
26811
|
+
// (no need for stderr because it's sync)
|
|
26812
|
+
if (collectConsole) {
|
|
26813
|
+
while (workerThread.stdout.read() !== null) {}
|
|
26814
|
+
|
|
26815
|
+
await new Promise(resolve => {
|
|
26816
|
+
setTimeout(resolve, 50);
|
|
26817
|
+
});
|
|
26818
|
+
}
|
|
26819
|
+
|
|
26798
26820
|
await workerThread.terminate();
|
|
26799
26821
|
});
|
|
26800
26822
|
const winnerPromise = new Promise(resolve => {
|
|
@@ -26834,6 +26856,7 @@ nodeWorkerThread.run = async ({
|
|
|
26834
26856
|
coverageEnabled,
|
|
26835
26857
|
coverageConfig,
|
|
26836
26858
|
coverageMethodForNodeJs,
|
|
26859
|
+
coverageFileUrl,
|
|
26837
26860
|
exitAfterAction: true
|
|
26838
26861
|
}
|
|
26839
26862
|
}
|
|
@@ -27091,9 +27114,6 @@ ${createRepartitionMessage(graphReport)}
|
|
|
27091
27114
|
};
|
|
27092
27115
|
|
|
27093
27116
|
const createUrlGraphReport = urlGraph => {
|
|
27094
|
-
const {
|
|
27095
|
-
urlInfos
|
|
27096
|
-
} = urlGraph;
|
|
27097
27117
|
const countGroups = {
|
|
27098
27118
|
sourcemaps: 0,
|
|
27099
27119
|
html: 0,
|
|
@@ -27112,15 +27132,14 @@ const createUrlGraphReport = urlGraph => {
|
|
|
27112
27132
|
other: 0,
|
|
27113
27133
|
total: 0
|
|
27114
27134
|
};
|
|
27115
|
-
|
|
27116
|
-
if (url.startsWith("data:")) {
|
|
27135
|
+
urlGraph.urlInfoMap.forEach(urlInfo => {
|
|
27136
|
+
if (urlInfo.url.startsWith("data:")) {
|
|
27117
27137
|
return;
|
|
27118
|
-
}
|
|
27119
|
-
|
|
27120
|
-
const urlInfo = urlInfos[url]; // ignore:
|
|
27138
|
+
} // ignore:
|
|
27121
27139
|
// - inline files: they are already taken into account in the file where they appear
|
|
27122
27140
|
// - ignored files: we don't know their content
|
|
27123
27141
|
|
|
27142
|
+
|
|
27124
27143
|
if (urlInfo.isInline || !urlInfo.shouldHandle) {
|
|
27125
27144
|
return;
|
|
27126
27145
|
} // file loaded via import assertion are already inside the graph
|
|
@@ -27298,20 +27317,18 @@ const createRepartitionMessage = ({
|
|
|
27298
27317
|
|
|
27299
27318
|
const GRAPH = {
|
|
27300
27319
|
map: (graph, callback) => {
|
|
27301
|
-
|
|
27302
|
-
|
|
27320
|
+
const array = [];
|
|
27321
|
+
graph.urlInfoMap.forEach(urlInfo => {
|
|
27322
|
+
array.push(callback(urlInfo));
|
|
27303
27323
|
});
|
|
27324
|
+
return array;
|
|
27304
27325
|
},
|
|
27305
27326
|
forEach: (graph, callback) => {
|
|
27306
|
-
|
|
27307
|
-
callback(graph.urlInfos[url], url);
|
|
27308
|
-
});
|
|
27327
|
+
graph.urlInfoMap.forEach(callback);
|
|
27309
27328
|
},
|
|
27310
27329
|
filter: (graph, callback) => {
|
|
27311
27330
|
const urlInfos = [];
|
|
27312
|
-
|
|
27313
|
-
const urlInfo = graph.urlInfos[url];
|
|
27314
|
-
|
|
27331
|
+
graph.urlInfoMap.forEach(urlInfo => {
|
|
27315
27332
|
if (callback(urlInfo)) {
|
|
27316
27333
|
urlInfos.push(urlInfo);
|
|
27317
27334
|
}
|
|
@@ -27319,10 +27336,16 @@ const GRAPH = {
|
|
|
27319
27336
|
return urlInfos;
|
|
27320
27337
|
},
|
|
27321
27338
|
find: (graph, callback) => {
|
|
27322
|
-
|
|
27323
|
-
|
|
27324
|
-
|
|
27325
|
-
|
|
27339
|
+
let found = null;
|
|
27340
|
+
|
|
27341
|
+
for (const urlInfo of graph.urlInfoMap.values()) {
|
|
27342
|
+
if (callback(urlInfo)) {
|
|
27343
|
+
found = urlInfo;
|
|
27344
|
+
break;
|
|
27345
|
+
}
|
|
27346
|
+
}
|
|
27347
|
+
|
|
27348
|
+
return found;
|
|
27326
27349
|
}
|
|
27327
27350
|
};
|
|
27328
27351
|
|
|
@@ -28468,7 +28491,7 @@ build ${entryPointKeys.length} entry points`);
|
|
|
28468
28491
|
|
|
28469
28492
|
buildTask.done();
|
|
28470
28493
|
logger.debug(`graph urls pre-versioning:
|
|
28471
|
-
${
|
|
28494
|
+
${Array.from(finalGraph.urlInfoMap.keys()).join("\n")}`);
|
|
28472
28495
|
|
|
28473
28496
|
if (versioning) {
|
|
28474
28497
|
await applyUrlVersioning({
|
|
@@ -28724,7 +28747,7 @@ const applyUrlVersioning = async ({
|
|
|
28724
28747
|
});
|
|
28725
28748
|
|
|
28726
28749
|
try {
|
|
28727
|
-
const urlsSorted = sortByDependencies(finalGraph.
|
|
28750
|
+
const urlsSorted = sortByDependencies(finalGraph.toObject());
|
|
28728
28751
|
urlsSorted.forEach(url => {
|
|
28729
28752
|
if (url.startsWith("data:")) {
|
|
28730
28753
|
return;
|