@jsenv/core 28.0.2 → 28.1.0
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 -2
- package/dist/controllable_worker_thread.mjs +1 -2
- package/dist/js/autoreload.js +25 -9
- package/dist/js/execute_using_dynamic_import.js +804 -1
- package/dist/js/script_type_module_supervisor.js +129 -0
- package/dist/js/supervisor.js +921 -0
- package/dist/main.js +432 -492
- package/package.json +13 -13
- package/readme.md +1 -1
- package/src/build/inject_global_version_mappings.js +3 -3
- package/src/dev/start_dev_server.js +2 -2
- package/src/execute/execute.js +1 -1
- package/src/execute/run.js +26 -38
- package/src/execute/runtimes/browsers/from_playwright.js +51 -77
- package/src/execute/runtimes/node/node_child_process.js +36 -36
- package/src/execute/runtimes/node/node_worker_thread.js +36 -36
- package/src/omega/kitchen.js +12 -9
- package/src/omega/omega_server.js +2 -2
- package/src/omega/server/file_service.js +2 -2
- package/src/omega/url_graph/url_info_transformations.js +8 -1
- package/src/plugins/autoreload/client/reload.js +20 -7
- package/src/plugins/autoreload/jsenv_plugin_autoreload_client.js +4 -4
- package/src/plugins/import_meta_hot/html_hot_dependencies.js +2 -2
- package/src/plugins/importmap/jsenv_plugin_importmap.js +5 -3
- package/src/plugins/inject_globals/inject_globals.js +3 -3
- package/src/plugins/inline/jsenv_plugin_data_urls.js +1 -1
- package/src/plugins/inline/jsenv_plugin_html_inline_content.js +10 -5
- package/src/plugins/plugins.js +5 -5
- package/src/plugins/server_events/jsenv_plugin_server_events_client_injection.js +4 -4
- package/src/plugins/supervisor/client/script_type_module_supervisor.js +108 -0
- package/src/plugins/supervisor/client/supervisor.js +921 -0
- package/src/plugins/{html_supervisor/jsenv_plugin_html_supervisor.js → supervisor/jsenv_plugin_supervisor.js} +128 -102
- package/src/plugins/toolbar/client/execution/toolbar_execution.js +1 -1
- package/src/plugins/toolbar/jsenv_plugin_toolbar.js +4 -4
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic.js +7 -5
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_html.js +5 -4
- package/src/plugins/transpilation/babel/jsenv_plugin_babel.js +13 -7
- package/src/plugins/transpilation/babel/new_stylesheet/babel_plugin_new_stylesheet_as_jsenv_import.js +6 -4
- package/src/plugins/transpilation/jsenv_plugin_transpilation.js +4 -2
- package/src/plugins/url_analysis/html/html_urls.js +11 -10
- package/src/test/coverage/babel_plugin_instrument.js +1 -35
- package/src/test/coverage/empty_coverage_factory.js +1 -1
- package/src/test/execute_plan.js +7 -3
- package/src/test/execute_test_plan.js +2 -1
- package/src/test/logs_file_execution.js +49 -8
- package/dist/js/html_supervisor_installer.js +0 -1091
- package/dist/js/html_supervisor_setup.js +0 -89
- package/dist/js/uneval.js +0 -804
- package/src/plugins/html_supervisor/client/error_formatter.js +0 -426
- package/src/plugins/html_supervisor/client/error_in_notification.js +0 -21
- package/src/plugins/html_supervisor/client/error_overlay.js +0 -191
- package/src/plugins/html_supervisor/client/html_supervisor_installer.js +0 -315
- package/src/plugins/html_supervisor/client/html_supervisor_setup.js +0 -89
- package/src/plugins/html_supervisor/client/perf_browser.js +0 -17
- package/src/plugins/html_supervisor/client/uneval_exception.js +0 -8
package/dist/main.js
CHANGED
|
@@ -23,7 +23,7 @@ import v8, { takeCoverage } from "node:v8";
|
|
|
23
23
|
import wrapAnsi from "wrap-ansi";
|
|
24
24
|
import stripAnsi from "strip-ansi";
|
|
25
25
|
import cuid from "cuid";
|
|
26
|
-
import { runInNewContext
|
|
26
|
+
import { runInNewContext } from "node:vm";
|
|
27
27
|
import { fork } from "node:child_process";
|
|
28
28
|
|
|
29
29
|
/*
|
|
@@ -1159,7 +1159,7 @@ const removeNoop = () => {};
|
|
|
1159
1159
|
*/
|
|
1160
1160
|
const Abort = {
|
|
1161
1161
|
isAbortError: error => {
|
|
1162
|
-
return error.name === "AbortError";
|
|
1162
|
+
return error && error.name === "AbortError";
|
|
1163
1163
|
},
|
|
1164
1164
|
startOperation: () => {
|
|
1165
1165
|
return createOperation();
|
|
@@ -1475,52 +1475,44 @@ const readDirectory = async (url, {
|
|
|
1475
1475
|
emfileMaxWait = 1000
|
|
1476
1476
|
} = {}) => {
|
|
1477
1477
|
const directoryUrl = assertAndNormalizeDirectoryUrl(url);
|
|
1478
|
-
const
|
|
1478
|
+
const directoryUrlObject = new URL(directoryUrl);
|
|
1479
1479
|
const startMs = Date.now();
|
|
1480
1480
|
let attemptCount = 0;
|
|
1481
1481
|
|
|
1482
|
-
const attempt = () => {
|
|
1483
|
-
|
|
1484
|
-
|
|
1482
|
+
const attempt = async () => {
|
|
1483
|
+
try {
|
|
1484
|
+
const names = await new Promise((resolve, reject) => {
|
|
1485
|
+
readdir(directoryUrlObject, (error, names) => {
|
|
1486
|
+
if (error) {
|
|
1487
|
+
reject(error);
|
|
1488
|
+
} else {
|
|
1489
|
+
resolve(names);
|
|
1490
|
+
}
|
|
1491
|
+
});
|
|
1492
|
+
});
|
|
1493
|
+
return names.map(encodeURIComponent);
|
|
1494
|
+
} catch (e) {
|
|
1495
|
+
// https://nodejs.org/dist/latest-v13.x/docs/api/errors.html#errors_common_system_errors
|
|
1496
|
+
if (e.code === "EMFILE" || e.code === "ENFILE") {
|
|
1485
1497
|
attemptCount++;
|
|
1486
1498
|
const nowMs = Date.now();
|
|
1487
1499
|
const timeSpentWaiting = nowMs - startMs;
|
|
1488
1500
|
|
|
1489
1501
|
if (timeSpentWaiting > emfileMaxWait) {
|
|
1490
|
-
throw
|
|
1502
|
+
throw e;
|
|
1491
1503
|
}
|
|
1492
1504
|
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
resolve(attempt());
|
|
1496
|
-
}, attemptCount);
|
|
1497
|
-
});
|
|
1505
|
+
await new Promise(resolve => setTimeout(resolve), attemptCount);
|
|
1506
|
+
return await attempt();
|
|
1498
1507
|
}
|
|
1499
|
-
|
|
1508
|
+
|
|
1509
|
+
throw e;
|
|
1510
|
+
}
|
|
1500
1511
|
};
|
|
1501
1512
|
|
|
1502
1513
|
return attempt();
|
|
1503
1514
|
};
|
|
1504
1515
|
|
|
1505
|
-
const readdirNaive = (directoryPath, {
|
|
1506
|
-
handleTooManyFilesOpenedError = null
|
|
1507
|
-
} = {}) => {
|
|
1508
|
-
return new Promise((resolve, reject) => {
|
|
1509
|
-
readdir(directoryPath, (error, names) => {
|
|
1510
|
-
if (error) {
|
|
1511
|
-
// https://nodejs.org/dist/latest-v13.x/docs/api/errors.html#errors_common_system_errors
|
|
1512
|
-
if (handleTooManyFilesOpenedError && (error.code === "EMFILE" || error.code === "ENFILE")) {
|
|
1513
|
-
resolve(handleTooManyFilesOpenedError(error));
|
|
1514
|
-
} else {
|
|
1515
|
-
reject(error);
|
|
1516
|
-
}
|
|
1517
|
-
} else {
|
|
1518
|
-
resolve(names);
|
|
1519
|
-
}
|
|
1520
|
-
});
|
|
1521
|
-
});
|
|
1522
|
-
};
|
|
1523
|
-
|
|
1524
1516
|
const comparePathnames = (leftPathame, rightPathname) => {
|
|
1525
1517
|
const leftPartArray = leftPathame.split("/");
|
|
1526
1518
|
const rightPartArray = rightPathname.split("/");
|
|
@@ -3080,6 +3072,7 @@ const FAILURE_RAW = canUseUnicode ? `✖` : `×`;
|
|
|
3080
3072
|
const DEBUG_RAW = canUseUnicode ? `◆` : `♦`;
|
|
3081
3073
|
const INFO_RAW = canUseUnicode ? `ℹ` : `i`;
|
|
3082
3074
|
const WARNING_RAW = canUseUnicode ? `⚠` : `‼`;
|
|
3075
|
+
const CIRCLE_CROSS_RAW = canUseUnicode ? `ⓧ` : `(×)`;
|
|
3083
3076
|
const COMMAND = ANSI.color(COMMAND_RAW, ANSI.GREY); // ANSI_MAGENTA)
|
|
3084
3077
|
|
|
3085
3078
|
const OK = ANSI.color(OK_RAW, ANSI.GREEN);
|
|
@@ -3087,6 +3080,7 @@ const FAILURE = ANSI.color(FAILURE_RAW, ANSI.RED);
|
|
|
3087
3080
|
const DEBUG = ANSI.color(DEBUG_RAW, ANSI.GREY);
|
|
3088
3081
|
const INFO = ANSI.color(INFO_RAW, ANSI.BLUE);
|
|
3089
3082
|
const WARNING = ANSI.color(WARNING_RAW, ANSI.YELLOW);
|
|
3083
|
+
const CIRCLE_CROSS = ANSI.color(CIRCLE_CROSS_RAW, ANSI.RED);
|
|
3090
3084
|
const UNICODE = {
|
|
3091
3085
|
COMMAND,
|
|
3092
3086
|
OK,
|
|
@@ -3094,12 +3088,14 @@ const UNICODE = {
|
|
|
3094
3088
|
DEBUG,
|
|
3095
3089
|
INFO,
|
|
3096
3090
|
WARNING,
|
|
3091
|
+
CIRCLE_CROSS,
|
|
3097
3092
|
COMMAND_RAW,
|
|
3098
3093
|
OK_RAW,
|
|
3099
3094
|
FAILURE_RAW,
|
|
3100
3095
|
DEBUG_RAW,
|
|
3101
3096
|
INFO_RAW,
|
|
3102
3097
|
WARNING_RAW,
|
|
3098
|
+
CIRCLE_CROSS_RAW,
|
|
3103
3099
|
supported: canUseUnicode
|
|
3104
3100
|
};
|
|
3105
3101
|
|
|
@@ -4305,12 +4301,12 @@ const visitHtmlUrls = ({
|
|
|
4305
4301
|
attributeName,
|
|
4306
4302
|
specifier
|
|
4307
4303
|
}) => {
|
|
4308
|
-
const
|
|
4304
|
+
const isContentCooked = getHtmlNodeAttribute(node, "jsenv-plugin-action") === "content_cooked";
|
|
4309
4305
|
let position;
|
|
4310
4306
|
|
|
4311
|
-
if (
|
|
4307
|
+
if (isContentCooked) {
|
|
4312
4308
|
// when generated from inline content,
|
|
4313
|
-
// line, column is not "src" nor "
|
|
4309
|
+
// line, column is not "src" nor "inlined-from-src" but "original-position"
|
|
4314
4310
|
position = getHtmlNodePosition(node);
|
|
4315
4311
|
} else {
|
|
4316
4312
|
position = getHtmlNodeAttributePosition(node, attributeName);
|
|
@@ -4342,9 +4338,9 @@ const visitHtmlUrls = ({
|
|
|
4342
4338
|
const value = getHtmlNodeAttribute(node, attributeName);
|
|
4343
4339
|
|
|
4344
4340
|
if (value) {
|
|
4345
|
-
const
|
|
4341
|
+
const jsenvPluginOwner = getHtmlNodeAttribute(node, "jsenv-plugin-owner");
|
|
4346
4342
|
|
|
4347
|
-
if (
|
|
4343
|
+
if (jsenvPluginOwner === "jsenv:importmap") {
|
|
4348
4344
|
// during build the importmap is inlined
|
|
4349
4345
|
// and shoud not be considered as a dependency anymore
|
|
4350
4346
|
return;
|
|
@@ -4353,17 +4349,17 @@ const visitHtmlUrls = ({
|
|
|
4353
4349
|
addDependency({ ...rest,
|
|
4354
4350
|
node,
|
|
4355
4351
|
attributeName,
|
|
4356
|
-
specifier: attributeName === "
|
|
4352
|
+
specifier: attributeName === "inlined-from-src" || attributeName === "inlined-from-href" ? new URL(value, url).href : value
|
|
4357
4353
|
});
|
|
4358
4354
|
} else if (attributeName === "src") {
|
|
4359
4355
|
visitAttributeAsUrlSpecifier({ ...rest,
|
|
4360
4356
|
node,
|
|
4361
|
-
attributeName: "
|
|
4357
|
+
attributeName: "inlined-from-src"
|
|
4362
4358
|
});
|
|
4363
4359
|
} else if (attributeName === "href") {
|
|
4364
4360
|
visitAttributeAsUrlSpecifier({ ...rest,
|
|
4365
4361
|
node,
|
|
4366
|
-
attributeName: "
|
|
4362
|
+
attributeName: "inlined-from-href"
|
|
4367
4363
|
});
|
|
4368
4364
|
}
|
|
4369
4365
|
};
|
|
@@ -4413,6 +4409,7 @@ const visitHtmlUrls = ({
|
|
|
4413
4409
|
if (type === "text") {
|
|
4414
4410
|
// ignore <script type="whatever" src="./file.js">
|
|
4415
4411
|
// per HTML spec https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-type
|
|
4412
|
+
// this will be handled by jsenv_plugin_html_inline_content
|
|
4416
4413
|
return;
|
|
4417
4414
|
}
|
|
4418
4415
|
|
|
@@ -5001,7 +4998,8 @@ const jsenvPluginHtmlInlineContent = ({
|
|
|
5001
4998
|
});
|
|
5002
4999
|
setHtmlNodeText(styleNode, inlineStyleUrlInfo.content);
|
|
5003
5000
|
setHtmlNodeAttributes(styleNode, {
|
|
5004
|
-
"
|
|
5001
|
+
"jsenv-plugin-owner": "jsenv:html_inline_content",
|
|
5002
|
+
"jsenv-plugin-action": "content_cooked"
|
|
5005
5003
|
});
|
|
5006
5004
|
});
|
|
5007
5005
|
},
|
|
@@ -5015,13 +5013,13 @@ const jsenvPluginHtmlInlineContent = ({
|
|
|
5015
5013
|
// - we want to avoid cooking twice a script during build
|
|
5016
5014
|
|
|
5017
5015
|
|
|
5018
|
-
const
|
|
5016
|
+
const jsenvPluginOwner = getHtmlNodeAttribute(scriptNode, "jsenv-plugin-owner");
|
|
5019
5017
|
|
|
5020
|
-
if (
|
|
5018
|
+
if (jsenvPluginOwner === "jsenv:as_js_classic_html" && !analyzeConvertedScripts) {
|
|
5021
5019
|
return;
|
|
5022
5020
|
}
|
|
5023
5021
|
|
|
5024
|
-
if (
|
|
5022
|
+
if (jsenvPluginOwner === "jsenv:supervisor") {
|
|
5025
5023
|
return;
|
|
5026
5024
|
}
|
|
5027
5025
|
|
|
@@ -5067,7 +5065,8 @@ const jsenvPluginHtmlInlineContent = ({
|
|
|
5067
5065
|
});
|
|
5068
5066
|
setHtmlNodeText(scriptNode, inlineScriptUrlInfo.content);
|
|
5069
5067
|
setHtmlNodeAttributes(scriptNode, {
|
|
5070
|
-
"
|
|
5068
|
+
"jsenv-plugin-owner": "jsenv:html_inline_content",
|
|
5069
|
+
"jsenv-plugin-action": "content_cooked",
|
|
5071
5070
|
...(extension ? {
|
|
5072
5071
|
type: type === "js_module" ? "module" : undefined
|
|
5073
5072
|
} : {})
|
|
@@ -5605,7 +5604,7 @@ const jsenvPluginDataUrls = () => {
|
|
|
5605
5604
|
}
|
|
5606
5605
|
|
|
5607
5606
|
const specifier = DATA_URL.stringify({
|
|
5608
|
-
contentType: urlInfo.
|
|
5607
|
+
contentType: urlInfo.contentType,
|
|
5609
5608
|
base64Flag: urlInfo.data.base64Flag,
|
|
5610
5609
|
data: urlInfo.data.base64Flag ? dataToBase64(urlInfo.content) : String(urlInfo.content)
|
|
5611
5610
|
});
|
|
@@ -5943,7 +5942,8 @@ const jsenvPluginAsJsClassicHtml = ({
|
|
|
5943
5942
|
setHtmlNodeText(moduleScriptNode, newUrlInfo.content);
|
|
5944
5943
|
setHtmlNodeAttributes(moduleScriptNode, {
|
|
5945
5944
|
"type": undefined,
|
|
5946
|
-
"
|
|
5945
|
+
"jsenv-plugin-owner": "jsenv:as_js_classic_html",
|
|
5946
|
+
"jsenv-plugin-action": "content_cooked"
|
|
5947
5947
|
});
|
|
5948
5948
|
});
|
|
5949
5949
|
}
|
|
@@ -6010,10 +6010,9 @@ const jsenvPluginAsJsClassicHtml = ({
|
|
|
6010
6010
|
specifier: systemJsClientFileUrl
|
|
6011
6011
|
});
|
|
6012
6012
|
injectScriptNodeAsEarlyAsPossible(htmlAst, createHtmlNode({
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
}));
|
|
6013
|
+
tagName: "script",
|
|
6014
|
+
src: systemJsReference.generatedSpecifier
|
|
6015
|
+
}), "jsenv:as_js_classic_html");
|
|
6017
6016
|
}
|
|
6018
6017
|
}
|
|
6019
6018
|
|
|
@@ -10409,7 +10408,7 @@ function default_1({
|
|
|
10409
10408
|
* and prefer to unique identifier based solely on the specifier basename for instance
|
|
10410
10409
|
*/
|
|
10411
10410
|
const jsenvPluginAsJsClassic = ({
|
|
10412
|
-
systemJsInjection
|
|
10411
|
+
systemJsInjection = true
|
|
10413
10412
|
}) => {
|
|
10414
10413
|
const systemJsClientFileUrl = new URL("./js/s.js", import.meta.url).href;
|
|
10415
10414
|
return [jsenvPluginAsJsClassicConversion({
|
|
@@ -10483,7 +10482,7 @@ const jsenvPluginAsJsClassicConversion = ({
|
|
|
10483
10482
|
// - the reference contains ?entry_point
|
|
10484
10483
|
// When js is entry point there can be no HTML to inject systemjs
|
|
10485
10484
|
// and systemjs must be injected into the js file
|
|
10486
|
-
|
|
10485
|
+
urlInfo.isEntryPoint && // if it's an entry point without dependency (it does not use import)
|
|
10487
10486
|
// then we can use UMD, otherwise we have to use systemjs
|
|
10488
10487
|
// because it is imported by systemjs
|
|
10489
10488
|
!originalUrlInfo.data.usesImport ? "umd" : "system";
|
|
@@ -10493,7 +10492,8 @@ const jsenvPluginAsJsClassicConversion = ({
|
|
|
10493
10492
|
} = await convertJsModuleToJsClassic({
|
|
10494
10493
|
systemJsInjection,
|
|
10495
10494
|
systemJsClientFileUrl,
|
|
10496
|
-
urlInfo
|
|
10495
|
+
urlInfo,
|
|
10496
|
+
originalUrlInfo,
|
|
10497
10497
|
jsClassicFormat
|
|
10498
10498
|
});
|
|
10499
10499
|
urlInfo.data.jsClassicFormat = jsClassicFormat;
|
|
@@ -10537,6 +10537,7 @@ const convertJsModuleToJsClassic = async ({
|
|
|
10537
10537
|
systemJsInjection,
|
|
10538
10538
|
systemJsClientFileUrl,
|
|
10539
10539
|
urlInfo,
|
|
10540
|
+
originalUrlInfo,
|
|
10540
10541
|
jsClassicFormat
|
|
10541
10542
|
}) => {
|
|
10542
10543
|
const {
|
|
@@ -10550,9 +10551,9 @@ const convertJsModuleToJsClassic = async ({
|
|
|
10550
10551
|
}]] : [[requireBabelPlugin("babel-plugin-transform-async-to-promises"), {
|
|
10551
10552
|
topLevelAwait: "simple"
|
|
10552
10553
|
}], babelPluginTransformImportMetaUrl, requireFromJsenv("@babel/plugin-transform-modules-umd")])],
|
|
10553
|
-
urlInfo
|
|
10554
|
+
urlInfo: originalUrlInfo
|
|
10554
10555
|
});
|
|
10555
|
-
let sourcemap =
|
|
10556
|
+
let sourcemap = originalUrlInfo.sourcemap;
|
|
10556
10557
|
sourcemap = await composeTwoSourcemaps(sourcemap, map);
|
|
10557
10558
|
|
|
10558
10559
|
if (systemJsInjection && jsClassicFormat === "system" && urlInfo.isEntryPoint) {
|
|
@@ -11397,7 +11398,8 @@ const jsenvPluginImportmap = () => {
|
|
|
11397
11398
|
});
|
|
11398
11399
|
setHtmlNodeText(importmap, inlineImportmapUrlInfo.content);
|
|
11399
11400
|
setHtmlNodeAttributes(importmap, {
|
|
11400
|
-
"
|
|
11401
|
+
"jsenv-plugin-owner": "jsenv:importmap",
|
|
11402
|
+
"jsenv-plugin-action": "content_cooked"
|
|
11401
11403
|
});
|
|
11402
11404
|
onHtmlImportmapParsed(JSON.parse(inlineImportmapUrlInfo.content), htmlUrlInfo.url);
|
|
11403
11405
|
};
|
|
@@ -11417,8 +11419,9 @@ const jsenvPluginImportmap = () => {
|
|
|
11417
11419
|
setHtmlNodeText(importmap, importmapUrlInfo.content);
|
|
11418
11420
|
setHtmlNodeAttributes(importmap, {
|
|
11419
11421
|
"src": undefined,
|
|
11420
|
-
"
|
|
11421
|
-
"
|
|
11422
|
+
"jsenv-plugin-owner": "jsenv:importmap",
|
|
11423
|
+
"jsenv-plugin-action": "inlined",
|
|
11424
|
+
"inlined-from-src": src
|
|
11422
11425
|
});
|
|
11423
11426
|
const {
|
|
11424
11427
|
line,
|
|
@@ -13164,21 +13167,60 @@ const jsenvPluginHttpUrls = () => {
|
|
|
13164
13167
|
};
|
|
13165
13168
|
|
|
13166
13169
|
/*
|
|
13167
|
-
*
|
|
13168
|
-
*
|
|
13169
|
-
*
|
|
13170
|
+
* Jsenv needs to wait for all js execution inside an HTML page before killing the browser.
|
|
13171
|
+
* A naive approach would consider execution done when "load" event is dispatched on window but:
|
|
13172
|
+
*
|
|
13173
|
+
* scenario | covered by window "load"
|
|
13174
|
+
* ------------------------------------------- | -------------------------
|
|
13175
|
+
* js referenced by <script src> | yes
|
|
13176
|
+
* js inlined into <script> | yes
|
|
13177
|
+
* js referenced by <script type="module" src> | partially (not for import and top level await)
|
|
13178
|
+
* js inlined into <script type="module"> | not at all
|
|
13179
|
+
*
|
|
13180
|
+
* This plugin provides a way for jsenv to know when js execution is done
|
|
13181
|
+
* As a side effect this plugin enables ability to hot reload js inlined into <script hot-accept>
|
|
13182
|
+
*
|
|
13183
|
+
* <script src="file.js">
|
|
13184
|
+
* becomes
|
|
13185
|
+
* <script>
|
|
13186
|
+
* window.__supervisor__.superviseScript({ src: 'file.js' })
|
|
13187
|
+
* </script>
|
|
13188
|
+
*
|
|
13189
|
+
* <script>
|
|
13190
|
+
* console.log(42)
|
|
13191
|
+
* </script>
|
|
13192
|
+
* becomes
|
|
13193
|
+
* <script>
|
|
13194
|
+
* window.__supervisor__.superviseScript({ src: 'main.html@L10-L13.js' })
|
|
13195
|
+
* </script>
|
|
13196
|
+
*
|
|
13197
|
+
* <script type="module" src="module.js"></script>
|
|
13198
|
+
* becomes
|
|
13199
|
+
* <script type="module">
|
|
13200
|
+
* import { superviseScriptTypeModule } from 'supervisor'
|
|
13201
|
+
* superviseScriptTypeModule({ src: "module.js" })
|
|
13202
|
+
* </script>
|
|
13203
|
+
*
|
|
13204
|
+
* <script type="module">
|
|
13205
|
+
* console.log(42)
|
|
13206
|
+
* </script>
|
|
13207
|
+
* becomes
|
|
13208
|
+
* <script type="module">
|
|
13209
|
+
* import { superviseScriptTypeModule } from 'supervisor'
|
|
13210
|
+
* superviseScriptTypeModule({ src: 'main.html@L10-L13.js' })
|
|
13211
|
+
* </script>
|
|
13170
13212
|
*/
|
|
13171
|
-
const
|
|
13213
|
+
const jsenvPluginSupervisor = ({
|
|
13172
13214
|
logs = false,
|
|
13173
13215
|
measurePerf = false,
|
|
13174
13216
|
errorOverlay = true,
|
|
13175
13217
|
openInEditor = true,
|
|
13176
13218
|
errorBaseUrl
|
|
13177
13219
|
}) => {
|
|
13178
|
-
const
|
|
13179
|
-
const
|
|
13220
|
+
const supervisorFileUrl = new URL("./js/supervisor.js", import.meta.url).href;
|
|
13221
|
+
const scriptTypeModuleSupervisorFileUrl = new URL("./js/script_type_module_supervisor.js", import.meta.url).href;
|
|
13180
13222
|
return {
|
|
13181
|
-
name: "jsenv:
|
|
13223
|
+
name: "jsenv:supervisor",
|
|
13182
13224
|
appliesDuring: "dev",
|
|
13183
13225
|
serve: async (request, context) => {
|
|
13184
13226
|
if (request.pathname.startsWith("/__get_code_frame__/")) {
|
|
@@ -13186,7 +13228,8 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
13186
13228
|
pathname,
|
|
13187
13229
|
searchParams
|
|
13188
13230
|
} = new URL(request.url);
|
|
13189
|
-
|
|
13231
|
+
let urlWithLineAndColumn = pathname.slice("/__get_code_frame__/".length);
|
|
13232
|
+
urlWithLineAndColumn = decodeURIComponent(urlWithLineAndColumn);
|
|
13190
13233
|
const match = urlWithLineAndColumn.match(/:([0-9]+):([0-9]+)$/);
|
|
13191
13234
|
|
|
13192
13235
|
if (!match) {
|
|
@@ -13203,7 +13246,10 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
13203
13246
|
|
|
13204
13247
|
if (!urlInfo) {
|
|
13205
13248
|
return {
|
|
13206
|
-
status:
|
|
13249
|
+
status: 204,
|
|
13250
|
+
headers: {
|
|
13251
|
+
"cache-control": "no-store"
|
|
13252
|
+
}
|
|
13207
13253
|
};
|
|
13208
13254
|
}
|
|
13209
13255
|
|
|
@@ -13213,14 +13259,20 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
13213
13259
|
const sourcemap = urlInfo.sourcemap;
|
|
13214
13260
|
|
|
13215
13261
|
if (sourcemap) {
|
|
13216
|
-
const original =
|
|
13262
|
+
const original = getOriginalPosition({
|
|
13217
13263
|
sourcemap,
|
|
13218
13264
|
url: file,
|
|
13219
13265
|
line,
|
|
13220
13266
|
column
|
|
13221
13267
|
});
|
|
13222
|
-
|
|
13223
|
-
|
|
13268
|
+
|
|
13269
|
+
if (original.line !== null) {
|
|
13270
|
+
line = original.line;
|
|
13271
|
+
|
|
13272
|
+
if (original.column !== null) {
|
|
13273
|
+
column = original.column;
|
|
13274
|
+
}
|
|
13275
|
+
}
|
|
13224
13276
|
}
|
|
13225
13277
|
}
|
|
13226
13278
|
|
|
@@ -13233,6 +13285,7 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
13233
13285
|
return {
|
|
13234
13286
|
status: 200,
|
|
13235
13287
|
headers: {
|
|
13288
|
+
"cache-control": "no-store",
|
|
13236
13289
|
"content-type": "text/plain",
|
|
13237
13290
|
"content-length": Buffer.byteLength(codeFrame)
|
|
13238
13291
|
},
|
|
@@ -13241,7 +13294,8 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
13241
13294
|
}
|
|
13242
13295
|
|
|
13243
13296
|
if (request.pathname.startsWith("/__get_error_cause__/")) {
|
|
13244
|
-
|
|
13297
|
+
let file = request.pathname.slice("/__get_error_cause__/".length);
|
|
13298
|
+
file = decodeURIComponent(file);
|
|
13245
13299
|
|
|
13246
13300
|
if (!file) {
|
|
13247
13301
|
return {
|
|
@@ -13292,7 +13346,7 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
13292
13346
|
return {
|
|
13293
13347
|
status: 200,
|
|
13294
13348
|
headers: {
|
|
13295
|
-
"cache-control": "no-
|
|
13349
|
+
"cache-control": "no-store",
|
|
13296
13350
|
"content-type": "application/json",
|
|
13297
13351
|
"content-length": Buffer.byteLength(body)
|
|
13298
13352
|
},
|
|
@@ -13301,7 +13355,8 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
13301
13355
|
}
|
|
13302
13356
|
|
|
13303
13357
|
if (request.pathname.startsWith("/__open_in_editor__/")) {
|
|
13304
|
-
|
|
13358
|
+
let file = request.pathname.slice("/__open_in_editor__/".length);
|
|
13359
|
+
file = decodeURIComponent(file);
|
|
13305
13360
|
|
|
13306
13361
|
if (!file) {
|
|
13307
13362
|
return {
|
|
@@ -13387,9 +13442,6 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
13387
13442
|
const crossorigin = getHtmlNodeAttribute(node, "crossorigin") !== undefined;
|
|
13388
13443
|
const defer = getHtmlNodeAttribute(node, "defer") !== undefined;
|
|
13389
13444
|
const async = getHtmlNodeAttribute(node, "async") !== undefined;
|
|
13390
|
-
setHtmlNodeAttributes(node, {
|
|
13391
|
-
src: undefined
|
|
13392
|
-
});
|
|
13393
13445
|
scriptsToSupervise.push({
|
|
13394
13446
|
node,
|
|
13395
13447
|
type,
|
|
@@ -13411,15 +13463,15 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
13411
13463
|
return;
|
|
13412
13464
|
}
|
|
13413
13465
|
|
|
13414
|
-
const
|
|
13466
|
+
const jsenvPluginOwner = getHtmlNodeAttribute(node, "jsenv-plugin-owner");
|
|
13415
13467
|
|
|
13416
|
-
if (
|
|
13468
|
+
if (jsenvPluginOwner !== undefined) {
|
|
13417
13469
|
return;
|
|
13418
13470
|
}
|
|
13419
13471
|
|
|
13420
|
-
const
|
|
13472
|
+
const noSupervisor = getHtmlNodeAttribute(node, "no-supervisor");
|
|
13421
13473
|
|
|
13422
|
-
if (
|
|
13474
|
+
if (noSupervisor !== undefined) {
|
|
13423
13475
|
return;
|
|
13424
13476
|
}
|
|
13425
13477
|
|
|
@@ -13438,36 +13490,33 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
13438
13490
|
}
|
|
13439
13491
|
}
|
|
13440
13492
|
});
|
|
13441
|
-
const [
|
|
13493
|
+
const [scriptTypeModuleSupervisorFileReference] = context.referenceUtils.inject({
|
|
13442
13494
|
type: "js_import_export",
|
|
13443
13495
|
expectedType: "js_module",
|
|
13444
|
-
specifier:
|
|
13496
|
+
specifier: scriptTypeModuleSupervisorFileUrl
|
|
13497
|
+
});
|
|
13498
|
+
const [supervisorFileReference] = context.referenceUtils.inject({
|
|
13499
|
+
type: "script_src",
|
|
13500
|
+
expectedType: "js_classic",
|
|
13501
|
+
specifier: supervisorFileUrl
|
|
13445
13502
|
});
|
|
13446
13503
|
injectScriptNodeAsEarlyAsPossible(htmlAst, createHtmlNode({
|
|
13447
|
-
|
|
13448
|
-
|
|
13449
|
-
|
|
13450
|
-
import { installHtmlSupervisor } from ${htmlSupervisorInstallerFileReference.generatedSpecifier}
|
|
13451
|
-
installHtmlSupervisor(${JSON.stringify({
|
|
13504
|
+
tagName: "script",
|
|
13505
|
+
textContent: `
|
|
13506
|
+
window.__supervisor__.setup(${JSON.stringify({
|
|
13452
13507
|
rootDirectoryUrl: context.rootDirectoryUrl,
|
|
13453
13508
|
errorBaseUrl,
|
|
13454
13509
|
logs,
|
|
13455
13510
|
measurePerf,
|
|
13456
13511
|
errorOverlay,
|
|
13457
13512
|
openInEditor
|
|
13458
|
-
}, null, " ")})
|
|
13459
|
-
|
|
13460
|
-
}));
|
|
13461
|
-
const [htmlSupervisorSetupFileReference] = context.referenceUtils.inject({
|
|
13462
|
-
type: "script_src",
|
|
13463
|
-
expectedType: "js_classic",
|
|
13464
|
-
specifier: htmlSupervisorSetupFileUrl
|
|
13465
|
-
});
|
|
13513
|
+
}, null, " ")})
|
|
13514
|
+
`
|
|
13515
|
+
}), "jsenv:supervisor");
|
|
13466
13516
|
injectScriptNodeAsEarlyAsPossible(htmlAst, createHtmlNode({
|
|
13467
|
-
|
|
13468
|
-
|
|
13469
|
-
|
|
13470
|
-
}));
|
|
13517
|
+
tagName: "script",
|
|
13518
|
+
src: supervisorFileReference.generatedSpecifier
|
|
13519
|
+
}), "jsenv:supervisor");
|
|
13471
13520
|
scriptsToSupervise.forEach(({
|
|
13472
13521
|
node,
|
|
13473
13522
|
isInline,
|
|
@@ -13478,25 +13527,39 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
13478
13527
|
integrity,
|
|
13479
13528
|
crossorigin
|
|
13480
13529
|
}) => {
|
|
13481
|
-
|
|
13482
|
-
type,
|
|
13530
|
+
const paramsAsJson = JSON.stringify({
|
|
13483
13531
|
src,
|
|
13484
13532
|
isInline,
|
|
13485
13533
|
defer,
|
|
13486
13534
|
async,
|
|
13487
13535
|
integrity,
|
|
13488
|
-
crossorigin
|
|
13489
|
-
htmlSupervisorInstallerSpecifier: htmlSupervisorInstallerFileReference.generatedSpecifier
|
|
13490
|
-
}));
|
|
13491
|
-
setHtmlNodeAttributes(node, {
|
|
13492
|
-
"generated-by": "jsenv:html_supervisor",
|
|
13493
|
-
...(src ? {
|
|
13494
|
-
"generated-from-src": src
|
|
13495
|
-
} : {}),
|
|
13496
|
-
...(isInline ? {
|
|
13497
|
-
"generated-from-inline-content": ""
|
|
13498
|
-
} : {})
|
|
13536
|
+
crossorigin
|
|
13499
13537
|
});
|
|
13538
|
+
|
|
13539
|
+
if (type === "js_module") {
|
|
13540
|
+
setHtmlNodeText(node, `
|
|
13541
|
+
import { superviseScriptTypeModule } from ${scriptTypeModuleSupervisorFileReference.generatedSpecifier}
|
|
13542
|
+
superviseScriptTypeModule(${paramsAsJson})
|
|
13543
|
+
`);
|
|
13544
|
+
} else {
|
|
13545
|
+
setHtmlNodeText(node, `
|
|
13546
|
+
window.__supervisor__.superviseScript(${paramsAsJson})
|
|
13547
|
+
`);
|
|
13548
|
+
}
|
|
13549
|
+
|
|
13550
|
+
if (src) {
|
|
13551
|
+
setHtmlNodeAttributes(node, {
|
|
13552
|
+
"jsenv-plugin-owner": "jsenv:supervisor",
|
|
13553
|
+
"jsenv-plugin-action": "inlined",
|
|
13554
|
+
"src": undefined,
|
|
13555
|
+
"inlined-from-src": src
|
|
13556
|
+
});
|
|
13557
|
+
} else {
|
|
13558
|
+
setHtmlNodeAttributes(node, {
|
|
13559
|
+
"jsenv-plugin-owner": "jsenv:supervisor",
|
|
13560
|
+
"jsenv-plugin-action": "content_cooked"
|
|
13561
|
+
});
|
|
13562
|
+
}
|
|
13500
13563
|
});
|
|
13501
13564
|
const htmlModified = stringifyHtmlAst(htmlAst);
|
|
13502
13565
|
return {
|
|
@@ -13505,38 +13568,6 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
13505
13568
|
}
|
|
13506
13569
|
}
|
|
13507
13570
|
};
|
|
13508
|
-
}; // Ideally jsenv should take into account eventual
|
|
13509
|
-
// "integrity" and "crossorigin" attribute during supervision
|
|
13510
|
-
|
|
13511
|
-
const generateCodeToSuperviseScript = ({
|
|
13512
|
-
type,
|
|
13513
|
-
src,
|
|
13514
|
-
isInline,
|
|
13515
|
-
defer,
|
|
13516
|
-
async,
|
|
13517
|
-
integrity,
|
|
13518
|
-
crossorigin,
|
|
13519
|
-
htmlSupervisorInstallerSpecifier
|
|
13520
|
-
}) => {
|
|
13521
|
-
const paramsAsJson = JSON.stringify({
|
|
13522
|
-
src,
|
|
13523
|
-
isInline,
|
|
13524
|
-
defer,
|
|
13525
|
-
async,
|
|
13526
|
-
integrity,
|
|
13527
|
-
crossorigin
|
|
13528
|
-
});
|
|
13529
|
-
|
|
13530
|
-
if (type === "js_module") {
|
|
13531
|
-
return `
|
|
13532
|
-
import { superviseScriptTypeModule } from ${htmlSupervisorInstallerSpecifier}
|
|
13533
|
-
superviseScriptTypeModule(${paramsAsJson})
|
|
13534
|
-
`;
|
|
13535
|
-
}
|
|
13536
|
-
|
|
13537
|
-
return `
|
|
13538
|
-
window.__html_supervisor__.superviseScript(${paramsAsJson})
|
|
13539
|
-
`;
|
|
13540
13571
|
};
|
|
13541
13572
|
|
|
13542
13573
|
/*
|
|
@@ -14044,11 +14075,7 @@ export default inlineContent.text`,
|
|
|
14044
14075
|
};
|
|
14045
14076
|
|
|
14046
14077
|
const babelPluginInstrument = (api, {
|
|
14047
|
-
|
|
14048
|
-
useInlineSourceMaps = false,
|
|
14049
|
-
coverageConfig = {
|
|
14050
|
-
"./**/*": true
|
|
14051
|
-
}
|
|
14078
|
+
useInlineSourceMaps = false
|
|
14052
14079
|
}) => {
|
|
14053
14080
|
const {
|
|
14054
14081
|
programVisitor
|
|
@@ -14056,17 +14083,6 @@ const babelPluginInstrument = (api, {
|
|
|
14056
14083
|
const {
|
|
14057
14084
|
types
|
|
14058
14085
|
} = api;
|
|
14059
|
-
const associations = URL_META.resolveAssociations({
|
|
14060
|
-
cover: coverageConfig
|
|
14061
|
-
}, rootDirectoryUrl);
|
|
14062
|
-
|
|
14063
|
-
const shouldInstrument = url => {
|
|
14064
|
-
return URL_META.applyAssociations({
|
|
14065
|
-
url,
|
|
14066
|
-
associations
|
|
14067
|
-
}).cover;
|
|
14068
|
-
};
|
|
14069
|
-
|
|
14070
14086
|
return {
|
|
14071
14087
|
name: "transform-instrument",
|
|
14072
14088
|
visitor: {
|
|
@@ -14078,19 +14094,6 @@ const babelPluginInstrument = (api, {
|
|
|
14078
14094
|
const {
|
|
14079
14095
|
opts
|
|
14080
14096
|
} = file;
|
|
14081
|
-
|
|
14082
|
-
if (!opts.sourceFileName) {
|
|
14083
|
-
console.warn(`cannot instrument file when "sourceFileName" option is not set`);
|
|
14084
|
-
return;
|
|
14085
|
-
}
|
|
14086
|
-
|
|
14087
|
-
const fileUrl = fileSystemPathToUrl$1(opts.sourceFileName);
|
|
14088
|
-
|
|
14089
|
-
if (!shouldInstrument(fileUrl)) {
|
|
14090
|
-
return;
|
|
14091
|
-
}
|
|
14092
|
-
|
|
14093
|
-
this.__dv__ = null;
|
|
14094
14097
|
let inputSourceMap;
|
|
14095
14098
|
|
|
14096
14099
|
if (useInlineSourceMaps) {
|
|
@@ -15069,13 +15072,13 @@ const babelPluginNewStylesheetAsJsenvImport = (babel, {
|
|
|
15069
15072
|
return {
|
|
15070
15073
|
name: "new-stylesheet-as-jsenv-import",
|
|
15071
15074
|
visitor: {
|
|
15072
|
-
Program: (programPath, {
|
|
15073
|
-
filename
|
|
15074
|
-
|
|
15075
|
-
const fileUrl = pathToFileURL(filename).href;
|
|
15075
|
+
Program: (programPath, babelState) => {
|
|
15076
|
+
if (babelState.filename) {
|
|
15077
|
+
const fileUrl = pathToFileURL(babelState.filename).href;
|
|
15076
15078
|
|
|
15077
|
-
|
|
15078
|
-
|
|
15079
|
+
if (fileUrl === newStylesheetClientFileUrl) {
|
|
15080
|
+
return;
|
|
15081
|
+
}
|
|
15079
15082
|
}
|
|
15080
15083
|
|
|
15081
15084
|
let usesNewStylesheet = false;
|
|
@@ -15309,10 +15312,17 @@ const jsenvPluginBabel = ({
|
|
|
15309
15312
|
const requestHeaders = context.request.headers;
|
|
15310
15313
|
|
|
15311
15314
|
if (requestHeaders["x-coverage-instanbul"]) {
|
|
15312
|
-
|
|
15313
|
-
|
|
15314
|
-
|
|
15315
|
-
}
|
|
15315
|
+
const coverageConfig = JSON.parse(requestHeaders["x-coverage-instanbul"]);
|
|
15316
|
+
const associations = URL_META.resolveAssociations({
|
|
15317
|
+
cover: coverageConfig
|
|
15318
|
+
}, context.rootDirectoryUrl);
|
|
15319
|
+
|
|
15320
|
+
if (URL_META.applyAssociations({
|
|
15321
|
+
url: urlInfo.url,
|
|
15322
|
+
associations
|
|
15323
|
+
}).cover) {
|
|
15324
|
+
babelPluginStructure["transform-instrument"] = [babelPluginInstrument];
|
|
15325
|
+
}
|
|
15316
15326
|
}
|
|
15317
15327
|
}
|
|
15318
15328
|
|
|
@@ -15472,7 +15482,6 @@ const jsenvPluginTranspilation = ({
|
|
|
15472
15482
|
importAssertions = true,
|
|
15473
15483
|
css = true,
|
|
15474
15484
|
jsModuleAsJsClassic = true,
|
|
15475
|
-
systemJsInjection = true,
|
|
15476
15485
|
topLevelAwait = true,
|
|
15477
15486
|
babelHelpersAsImport = true,
|
|
15478
15487
|
getCustomBabelPlugins
|
|
@@ -15481,6 +15490,10 @@ const jsenvPluginTranspilation = ({
|
|
|
15481
15490
|
importAssertions = {};
|
|
15482
15491
|
}
|
|
15483
15492
|
|
|
15493
|
+
if (jsModuleAsJsClassic === true) {
|
|
15494
|
+
jsModuleAsJsClassic = {};
|
|
15495
|
+
}
|
|
15496
|
+
|
|
15484
15497
|
return [// import assertions we want it all the time
|
|
15485
15498
|
...(importAssertions ? [jsenvPluginImportAssertions(importAssertions)] : []), // babel also so that rollup can bundle babel helpers for instance
|
|
15486
15499
|
jsenvPluginBabel({
|
|
@@ -15491,9 +15504,7 @@ const jsenvPluginTranspilation = ({
|
|
|
15491
15504
|
// we want to do it after bundling
|
|
15492
15505
|
// so the build function will disable jsModuleAsJsClassic during build
|
|
15493
15506
|
// and enable it manually during postbuild
|
|
15494
|
-
...(jsModuleAsJsClassic ? [jsenvPluginAsJsClassic(
|
|
15495
|
-
systemJsInjection
|
|
15496
|
-
})] : []), // topLevelAwait must come after js_module_as_js_classic because it's related to the module format
|
|
15507
|
+
...(jsModuleAsJsClassic ? [jsenvPluginAsJsClassic(jsModuleAsJsClassic)] : []), // topLevelAwait must come after js_module_as_js_classic because it's related to the module format
|
|
15497
15508
|
// so we want to wait to know the module format before transforming things related to top level await
|
|
15498
15509
|
...(topLevelAwait ? [jsenvPluginTopLevelAwait()] : []), ...(css ? [jsenvPluginCssParcel()] : [])];
|
|
15499
15510
|
};
|
|
@@ -16306,7 +16317,7 @@ const collectHotDataFromHtmlAst = htmlAst => {
|
|
|
16306
16317
|
});
|
|
16307
16318
|
visitUrlSpecifierAttribute({
|
|
16308
16319
|
node,
|
|
16309
|
-
attributeName: "
|
|
16320
|
+
attributeName: "inlined-from-href",
|
|
16310
16321
|
hotAccepted
|
|
16311
16322
|
});
|
|
16312
16323
|
}
|
|
@@ -16319,7 +16330,7 @@ const collectHotDataFromHtmlAst = htmlAst => {
|
|
|
16319
16330
|
});
|
|
16320
16331
|
visitUrlSpecifierAttribute({
|
|
16321
16332
|
node,
|
|
16322
|
-
attributeName: "
|
|
16333
|
+
attributeName: "inlined-from-src",
|
|
16323
16334
|
hotAccepted
|
|
16324
16335
|
});
|
|
16325
16336
|
}
|
|
@@ -16687,11 +16698,10 @@ const jsenvPluginAutoreloadClient = () => {
|
|
|
16687
16698
|
specifier: autoreloadClientFileUrl
|
|
16688
16699
|
});
|
|
16689
16700
|
injectScriptNodeAsEarlyAsPossible(htmlAst, createHtmlNode({
|
|
16690
|
-
|
|
16691
|
-
|
|
16692
|
-
|
|
16693
|
-
|
|
16694
|
-
}));
|
|
16701
|
+
tagName: "script",
|
|
16702
|
+
type: "module",
|
|
16703
|
+
src: autoreloadClientReference.generatedSpecifier
|
|
16704
|
+
}), "jsenv:autoreload_client");
|
|
16695
16705
|
const htmlModified = stringifyHtmlAst(htmlAst);
|
|
16696
16706
|
return {
|
|
16697
16707
|
content: htmlModified
|
|
@@ -17039,7 +17049,7 @@ const getCorePlugins = ({
|
|
|
17039
17049
|
rootDirectoryUrl,
|
|
17040
17050
|
runtimeCompat,
|
|
17041
17051
|
urlAnalysis = {},
|
|
17042
|
-
|
|
17052
|
+
supervisor,
|
|
17043
17053
|
nodeEsmResolution = true,
|
|
17044
17054
|
fileSystemMagicResolution,
|
|
17045
17055
|
directoryReferenceAllowed,
|
|
@@ -17051,8 +17061,8 @@ const getCorePlugins = ({
|
|
|
17051
17061
|
clientFilesPruneCallbackList,
|
|
17052
17062
|
explorer
|
|
17053
17063
|
} = {}) => {
|
|
17054
|
-
if (
|
|
17055
|
-
|
|
17064
|
+
if (supervisor === true) {
|
|
17065
|
+
supervisor = {};
|
|
17056
17066
|
}
|
|
17057
17067
|
|
|
17058
17068
|
if (nodeEsmResolution === true) {
|
|
@@ -17070,7 +17080,7 @@ const getCorePlugins = ({
|
|
|
17070
17080
|
return [jsenvPluginUrlAnalysis({
|
|
17071
17081
|
rootDirectoryUrl,
|
|
17072
17082
|
...urlAnalysis
|
|
17073
|
-
}), jsenvPluginTranspilation(transpilation), ...(
|
|
17083
|
+
}), jsenvPluginTranspilation(transpilation), ...(supervisor ? [jsenvPluginSupervisor(supervisor)] : []), // before inline as it turns inline <script> into <script src>
|
|
17074
17084
|
jsenvPluginImportmap(), // before node esm to handle bare specifiers
|
|
17075
17085
|
// + before node esm to handle importmap before inline content
|
|
17076
17086
|
jsenvPluginInline(), // before "file urls" to resolve and load inline urls
|
|
@@ -21348,6 +21358,10 @@ const createUrlInfoTransformer = ({
|
|
|
21348
21358
|
|
|
21349
21359
|
if (!SOURCEMAP.enabledOnContentType(urlInfo.contentType)) {
|
|
21350
21360
|
return;
|
|
21361
|
+
}
|
|
21362
|
+
|
|
21363
|
+
if (urlInfo.generatedUrl.startsWith("data:")) {
|
|
21364
|
+
return;
|
|
21351
21365
|
} // sourcemap is a special kind of reference:
|
|
21352
21366
|
// It's a reference to a content generated dynamically the content itself.
|
|
21353
21367
|
// For this reason sourcemap are not added to urlInfo.references
|
|
@@ -21454,7 +21468,7 @@ const createUrlInfoTransformer = ({
|
|
|
21454
21468
|
await applyIntermediateTransformations(urlInfo, transformations);
|
|
21455
21469
|
}
|
|
21456
21470
|
|
|
21457
|
-
if (sourcemapsEnabled && urlInfo.sourcemap) {
|
|
21471
|
+
if (sourcemapsEnabled && urlInfo.sourcemap && !urlInfo.generatedUrl.startsWith("data:")) {
|
|
21458
21472
|
// during build this function can be called after the file is cooked
|
|
21459
21473
|
// - to update content and sourcemap after "optimize" hook
|
|
21460
21474
|
// - to inject versioning into the entry point content
|
|
@@ -22000,9 +22014,9 @@ const createKitchen = ({
|
|
|
22000
22014
|
newReference.original = reference.original || reference; // newReference.isEntryPoint = reference.isEntryPoint
|
|
22001
22015
|
};
|
|
22002
22016
|
|
|
22003
|
-
const resolveReference = reference => {
|
|
22017
|
+
const resolveReference = (reference, context = kitchenContext) => {
|
|
22004
22018
|
try {
|
|
22005
|
-
let resolvedUrl = pluginController.callHooksUntil("resolveUrl", reference,
|
|
22019
|
+
let resolvedUrl = pluginController.callHooksUntil("resolveUrl", reference, context);
|
|
22006
22020
|
|
|
22007
22021
|
if (!resolvedUrl) {
|
|
22008
22022
|
throw new Error(`NO_RESOLVE`);
|
|
@@ -22010,7 +22024,7 @@ const createKitchen = ({
|
|
|
22010
22024
|
|
|
22011
22025
|
resolvedUrl = normalizeUrl(resolvedUrl);
|
|
22012
22026
|
reference.url = resolvedUrl;
|
|
22013
|
-
pluginController.callHooks("redirectUrl", reference,
|
|
22027
|
+
pluginController.callHooks("redirectUrl", reference, context, returnValue => {
|
|
22014
22028
|
const normalizedReturnValue = normalizeUrl(returnValue);
|
|
22015
22029
|
|
|
22016
22030
|
if (normalizedReturnValue === reference.url) {
|
|
@@ -22031,20 +22045,20 @@ const createKitchen = ({
|
|
|
22031
22045
|
}
|
|
22032
22046
|
|
|
22033
22047
|
const urlInfo = urlGraph.reuseOrCreateUrlInfo(reference.url);
|
|
22034
|
-
applyReferenceEffectsOnUrlInfo(reference, urlInfo,
|
|
22048
|
+
applyReferenceEffectsOnUrlInfo(reference, urlInfo, context); // This hook must touch reference.generatedUrl, NOT reference.url
|
|
22035
22049
|
// And this is because this hook inject query params used to:
|
|
22036
22050
|
// - bypass browser cache (?v)
|
|
22037
22051
|
// - convey information (?hmr)
|
|
22038
22052
|
// But do not represent an other resource, it is considered as
|
|
22039
22053
|
// the same resource under the hood
|
|
22040
22054
|
|
|
22041
|
-
pluginController.callHooks("transformUrlSearchParams", reference,
|
|
22055
|
+
pluginController.callHooks("transformUrlSearchParams", reference, context, returnValue => {
|
|
22042
22056
|
Object.keys(returnValue).forEach(key => {
|
|
22043
22057
|
referenceUrlObject.searchParams.set(key, returnValue[key]);
|
|
22044
22058
|
});
|
|
22045
22059
|
reference.generatedUrl = normalizeUrl(referenceUrlObject.href);
|
|
22046
22060
|
});
|
|
22047
|
-
const returnValue = pluginController.callHooksUntil("formatUrl", reference,
|
|
22061
|
+
const returnValue = pluginController.callHooksUntil("formatUrl", reference, context);
|
|
22048
22062
|
reference.generatedSpecifier = returnValue || reference.generatedUrl;
|
|
22049
22063
|
reference.generatedSpecifier = urlSpecifierEncoding.encode(reference);
|
|
22050
22064
|
return urlInfo;
|
|
@@ -22241,7 +22255,7 @@ const createKitchen = ({
|
|
|
22241
22255
|
...props
|
|
22242
22256
|
});
|
|
22243
22257
|
references.push(reference);
|
|
22244
|
-
const referencedUrlInfo = resolveReference(reference);
|
|
22258
|
+
const referencedUrlInfo = resolveReference(reference, context);
|
|
22245
22259
|
return [reference, referencedUrlInfo];
|
|
22246
22260
|
};
|
|
22247
22261
|
|
|
@@ -22316,7 +22330,7 @@ const createKitchen = ({
|
|
|
22316
22330
|
});
|
|
22317
22331
|
references[index] = nextReference;
|
|
22318
22332
|
mutateReference(previousReference, nextReference);
|
|
22319
|
-
const newUrlInfo = resolveReference(nextReference);
|
|
22333
|
+
const newUrlInfo = resolveReference(nextReference, context);
|
|
22320
22334
|
const currentUrlInfo = context.urlGraph.getUrlInfo(currentReference.url);
|
|
22321
22335
|
|
|
22322
22336
|
if (currentUrlInfo && currentUrlInfo !== newUrlInfo && currentUrlInfo.dependents.size === 0) {
|
|
@@ -22512,7 +22526,8 @@ const createKitchen = ({
|
|
|
22512
22526
|
reference: originalReference
|
|
22513
22527
|
});
|
|
22514
22528
|
|
|
22515
|
-
if (originalUrlInfo.dependents.size === 0
|
|
22529
|
+
if (originalUrlInfo.dependents.size === 0 // && context.scenarios.build
|
|
22530
|
+
) {
|
|
22516
22531
|
context.urlGraph.deleteUrlInfo(originalUrlInfo.url);
|
|
22517
22532
|
}
|
|
22518
22533
|
|
|
@@ -23370,12 +23385,11 @@ const injectors = {
|
|
|
23370
23385
|
storeOriginalPositions: false
|
|
23371
23386
|
});
|
|
23372
23387
|
injectScriptNodeAsEarlyAsPossible(htmlAst, createHtmlNode({
|
|
23373
|
-
|
|
23374
|
-
|
|
23388
|
+
tagName: "script",
|
|
23389
|
+
textContent: generateClientCodeForVersionMappings(versionMappings, {
|
|
23375
23390
|
globalName: "window"
|
|
23376
|
-
})
|
|
23377
|
-
|
|
23378
|
-
}));
|
|
23391
|
+
})
|
|
23392
|
+
}), "jsenv:versioning");
|
|
23379
23393
|
return {
|
|
23380
23394
|
content: stringifyHtmlAst(htmlAst)
|
|
23381
23395
|
};
|
|
@@ -25032,11 +25046,10 @@ const jsenvPluginServerEventsClientInjection = () => {
|
|
|
25032
25046
|
specifier: serverEventsClientFileUrl
|
|
25033
25047
|
});
|
|
25034
25048
|
injectScriptNodeAsEarlyAsPossible(htmlAst, createHtmlNode({
|
|
25035
|
-
|
|
25036
|
-
|
|
25037
|
-
|
|
25038
|
-
|
|
25039
|
-
}));
|
|
25049
|
+
tagName: "script",
|
|
25050
|
+
type: "module",
|
|
25051
|
+
src: serverEventsClientFileReference.generatedSpecifier
|
|
25052
|
+
}), "jsenv:server_events");
|
|
25040
25053
|
const htmlModified = stringifyHtmlAst(htmlAst);
|
|
25041
25054
|
return {
|
|
25042
25055
|
content: htmlModified
|
|
@@ -25082,7 +25095,7 @@ const createFileService = ({
|
|
|
25082
25095
|
runtimeCompat,
|
|
25083
25096
|
plugins,
|
|
25084
25097
|
urlAnalysis,
|
|
25085
|
-
|
|
25098
|
+
supervisor,
|
|
25086
25099
|
nodeEsmResolution,
|
|
25087
25100
|
fileSystemMagicResolution,
|
|
25088
25101
|
transpilation,
|
|
@@ -25196,7 +25209,7 @@ const createFileService = ({
|
|
|
25196
25209
|
rootDirectoryUrl,
|
|
25197
25210
|
runtimeCompat,
|
|
25198
25211
|
urlAnalysis,
|
|
25199
|
-
|
|
25212
|
+
supervisor,
|
|
25200
25213
|
nodeEsmResolution,
|
|
25201
25214
|
fileSystemMagicResolution,
|
|
25202
25215
|
transpilation,
|
|
@@ -25475,7 +25488,7 @@ const startOmegaServer = async ({
|
|
|
25475
25488
|
runtimeCompat,
|
|
25476
25489
|
plugins,
|
|
25477
25490
|
urlAnalysis,
|
|
25478
|
-
|
|
25491
|
+
supervisor,
|
|
25479
25492
|
nodeEsmResolution,
|
|
25480
25493
|
fileSystemMagicResolution,
|
|
25481
25494
|
transpilation,
|
|
@@ -25528,7 +25541,7 @@ const startOmegaServer = async ({
|
|
|
25528
25541
|
runtimeCompat,
|
|
25529
25542
|
plugins,
|
|
25530
25543
|
urlAnalysis,
|
|
25531
|
-
|
|
25544
|
+
supervisor,
|
|
25532
25545
|
nodeEsmResolution,
|
|
25533
25546
|
fileSystemMagicResolution,
|
|
25534
25547
|
transpilation,
|
|
@@ -25636,7 +25649,7 @@ const startDevServer = async ({
|
|
|
25636
25649
|
runtimeCompat = defaultRuntimeCompat,
|
|
25637
25650
|
plugins = [],
|
|
25638
25651
|
urlAnalysis = {},
|
|
25639
|
-
|
|
25652
|
+
supervisor = true,
|
|
25640
25653
|
nodeEsmResolution,
|
|
25641
25654
|
fileSystemMagicResolution,
|
|
25642
25655
|
transpilation,
|
|
@@ -25762,7 +25775,7 @@ const startDevServer = async ({
|
|
|
25762
25775
|
runtimeCompat,
|
|
25763
25776
|
plugins,
|
|
25764
25777
|
urlAnalysis,
|
|
25765
|
-
|
|
25778
|
+
supervisor,
|
|
25766
25779
|
nodeEsmResolution,
|
|
25767
25780
|
fileSystemMagicResolution,
|
|
25768
25781
|
transpilation,
|
|
@@ -26157,9 +26170,7 @@ const relativeUrlToEmptyCoverage = async (relativeUrl, {
|
|
|
26157
26170
|
const {
|
|
26158
26171
|
metadata
|
|
26159
26172
|
} = await applyBabelPlugins({
|
|
26160
|
-
babelPlugins: [
|
|
26161
|
-
rootDirectoryUrl
|
|
26162
|
-
}]],
|
|
26173
|
+
babelPlugins: [babelPluginInstrument],
|
|
26163
26174
|
urlInfo: {
|
|
26164
26175
|
originalUrl: fileUrl,
|
|
26165
26176
|
content
|
|
@@ -26394,7 +26405,11 @@ const run = async ({
|
|
|
26394
26405
|
runtime,
|
|
26395
26406
|
runtimeParams
|
|
26396
26407
|
}) => {
|
|
26397
|
-
const result = {
|
|
26408
|
+
const result = {
|
|
26409
|
+
status: "pending",
|
|
26410
|
+
errors: [],
|
|
26411
|
+
namespace: null
|
|
26412
|
+
};
|
|
26398
26413
|
const callbacks = [];
|
|
26399
26414
|
const onConsoleRef = {
|
|
26400
26415
|
current: () => {}
|
|
@@ -26405,25 +26420,14 @@ const run = async ({
|
|
|
26405
26420
|
const runtimeLabel = `${runtime.name}/${runtime.version}`;
|
|
26406
26421
|
const runOperation = Abort.startOperation();
|
|
26407
26422
|
runOperation.addAbortSignal(signal);
|
|
26423
|
+
let timeoutAbortSource;
|
|
26408
26424
|
|
|
26409
26425
|
if ( // ideally we would rather log than the timeout is ignored
|
|
26410
26426
|
// when keepRunning is true
|
|
26411
26427
|
!keepRunning && typeof allocatedMs === "number" && allocatedMs !== Infinity) {
|
|
26412
|
-
|
|
26413
|
-
callbacks.push(() => {
|
|
26414
|
-
if (result.status === "errored" && Abort.isAbortError(result.error) && timeoutAbortSource.signal.aborted) {
|
|
26415
|
-
result.status = "timedout";
|
|
26416
|
-
delete result.error;
|
|
26417
|
-
}
|
|
26418
|
-
});
|
|
26428
|
+
timeoutAbortSource = runOperation.timeout(allocatedMs);
|
|
26419
26429
|
}
|
|
26420
26430
|
|
|
26421
|
-
callbacks.push(() => {
|
|
26422
|
-
if (result.status === "errored" && Abort.isAbortError(result.error)) {
|
|
26423
|
-
result.status = "aborted";
|
|
26424
|
-
delete result.error;
|
|
26425
|
-
}
|
|
26426
|
-
});
|
|
26427
26431
|
const consoleCalls = [];
|
|
26428
26432
|
|
|
26429
26433
|
onConsoleRef.current = ({
|
|
@@ -26447,9 +26451,7 @@ const run = async ({
|
|
|
26447
26451
|
};
|
|
26448
26452
|
|
|
26449
26453
|
if (collectConsole) {
|
|
26450
|
-
|
|
26451
|
-
result.consoleCalls = consoleCalls;
|
|
26452
|
-
});
|
|
26454
|
+
result.consoleCalls = consoleCalls;
|
|
26453
26455
|
} // we do not keep coverage in memory, it can grow very big
|
|
26454
26456
|
// instead we store it on the filesystem
|
|
26455
26457
|
// and they can be read later at "coverageFileUrl"
|
|
@@ -26516,35 +26518,35 @@ const run = async ({
|
|
|
26516
26518
|
const {
|
|
26517
26519
|
status,
|
|
26518
26520
|
namespace,
|
|
26519
|
-
|
|
26521
|
+
errors,
|
|
26520
26522
|
performance
|
|
26521
26523
|
} = winner.data;
|
|
26522
26524
|
result.status = status;
|
|
26523
|
-
|
|
26524
|
-
|
|
26525
|
-
result.error = error;
|
|
26526
|
-
} else {
|
|
26527
|
-
result.namespace = namespace;
|
|
26528
|
-
}
|
|
26525
|
+
result.errors.push(...errors);
|
|
26526
|
+
result.namespace = namespace;
|
|
26529
26527
|
|
|
26530
26528
|
if (collectPerformance) {
|
|
26531
26529
|
result.performance = performance;
|
|
26532
26530
|
}
|
|
26533
|
-
|
|
26534
|
-
callbacks.forEach(callback => {
|
|
26535
|
-
callback();
|
|
26536
|
-
});
|
|
26537
|
-
return result;
|
|
26538
26531
|
} catch (e) {
|
|
26539
|
-
|
|
26540
|
-
|
|
26541
|
-
|
|
26542
|
-
|
|
26543
|
-
|
|
26544
|
-
|
|
26532
|
+
if (Abort.isAbortError(e)) {
|
|
26533
|
+
if (timeoutAbortSource && timeoutAbortSource.signal.aborted) {
|
|
26534
|
+
result.status = "timedout";
|
|
26535
|
+
} else {
|
|
26536
|
+
result.status = "aborted";
|
|
26537
|
+
}
|
|
26538
|
+
} else {
|
|
26539
|
+
result.status = "errored";
|
|
26540
|
+
result.errors.push(e);
|
|
26541
|
+
}
|
|
26545
26542
|
} finally {
|
|
26546
26543
|
await runOperation.end();
|
|
26547
26544
|
}
|
|
26545
|
+
|
|
26546
|
+
callbacks.forEach(callback => {
|
|
26547
|
+
callback();
|
|
26548
|
+
});
|
|
26549
|
+
return result;
|
|
26548
26550
|
};
|
|
26549
26551
|
|
|
26550
26552
|
const pingServer = async url => {
|
|
@@ -26693,9 +26695,10 @@ const createExecutionLog = ({
|
|
|
26693
26695
|
|
|
26694
26696
|
const {
|
|
26695
26697
|
consoleCalls = [],
|
|
26696
|
-
|
|
26698
|
+
errors = []
|
|
26697
26699
|
} = executionResult;
|
|
26698
26700
|
const consoleOutput = formatConsoleCalls(consoleCalls);
|
|
26701
|
+
const errorsOutput = formatErrors(errors);
|
|
26699
26702
|
return formatExecution({
|
|
26700
26703
|
label: `${description}${summary}`,
|
|
26701
26704
|
details: {
|
|
@@ -26705,14 +26708,39 @@ const createExecutionLog = ({
|
|
|
26705
26708
|
} : {}),
|
|
26706
26709
|
...(logEachDuration ? {
|
|
26707
26710
|
duration: status === "executing" ? msAsEllapsedTime(Date.now() - startMs) : msAsDuration(endMs - startMs)
|
|
26708
|
-
} : {}),
|
|
26709
|
-
...(error ? {
|
|
26710
|
-
error: error.stack || error.message || error
|
|
26711
26711
|
} : {})
|
|
26712
26712
|
},
|
|
26713
|
-
consoleOutput
|
|
26713
|
+
consoleOutput,
|
|
26714
|
+
errorsOutput
|
|
26714
26715
|
});
|
|
26715
26716
|
};
|
|
26717
|
+
|
|
26718
|
+
const formatErrors = errors => {
|
|
26719
|
+
if (errors.length === 0) {
|
|
26720
|
+
return "";
|
|
26721
|
+
}
|
|
26722
|
+
|
|
26723
|
+
const formatError = error => error.stack || error.message || error;
|
|
26724
|
+
|
|
26725
|
+
if (errors.length === 1) {
|
|
26726
|
+
return `${ANSI.color(`-------- error --------`, ANSI.RED)}
|
|
26727
|
+
${formatError(errors[0])}
|
|
26728
|
+
${ANSI.color(`-------------------------`, ANSI.RED)}`;
|
|
26729
|
+
}
|
|
26730
|
+
|
|
26731
|
+
let output = [];
|
|
26732
|
+
errors.forEach(error => {
|
|
26733
|
+
output.push(prefixFirstAndIndentRemainingLines({
|
|
26734
|
+
prefix: `${UNICODE.CIRCLE_CROSS} `,
|
|
26735
|
+
indentation: " ",
|
|
26736
|
+
text: formatError(error)
|
|
26737
|
+
}));
|
|
26738
|
+
});
|
|
26739
|
+
return `${ANSI.color(`-------- errors (${errors.length}) --------`, ANSI.RED)}
|
|
26740
|
+
${output.join(`\n`)}
|
|
26741
|
+
${ANSI.color(`-------------------------`, ANSI.RED)}`;
|
|
26742
|
+
};
|
|
26743
|
+
|
|
26716
26744
|
const createSummaryLog = summary => `-------------- summary -----------------
|
|
26717
26745
|
${createAllExecutionsSummary(summary)}
|
|
26718
26746
|
total duration: ${msAsDuration(summary.duration)}
|
|
@@ -26917,6 +26945,7 @@ const formatConsoleOutput = consoleCalls => {
|
|
|
26917
26945
|
const textFormatted = prefixFirstAndIndentRemainingLines({
|
|
26918
26946
|
prefix: CONSOLE_ICONS[regroupedCall.type],
|
|
26919
26947
|
text,
|
|
26948
|
+
trimLines: true,
|
|
26920
26949
|
trimLastLine: index === regroupedCalls.length - 1
|
|
26921
26950
|
});
|
|
26922
26951
|
consoleOutput += textFormatted;
|
|
@@ -26926,17 +26955,18 @@ const formatConsoleOutput = consoleCalls => {
|
|
|
26926
26955
|
|
|
26927
26956
|
const prefixFirstAndIndentRemainingLines = ({
|
|
26928
26957
|
prefix,
|
|
26958
|
+
indentation = " ",
|
|
26929
26959
|
text,
|
|
26960
|
+
trimLines,
|
|
26930
26961
|
trimLastLine
|
|
26931
26962
|
}) => {
|
|
26932
26963
|
const lines = text.split(/\r?\n/);
|
|
26933
26964
|
const firstLine = lines.shift();
|
|
26934
26965
|
let result = `${prefix} ${firstLine}`;
|
|
26935
26966
|
let i = 0;
|
|
26936
|
-
const indentation = ` `;
|
|
26937
26967
|
|
|
26938
26968
|
while (i < lines.length) {
|
|
26939
|
-
const line = lines[i].trim();
|
|
26969
|
+
const line = trimLines ? lines[i].trim() : lines[i];
|
|
26940
26970
|
i++;
|
|
26941
26971
|
result += line.length ? `\n${indentation}${line}` : trimLastLine && i === lines.length ? "" : `\n`;
|
|
26942
26972
|
}
|
|
@@ -26987,7 +27017,8 @@ const formatConsoleSummary = repartition => {
|
|
|
26987
27017
|
const formatExecution = ({
|
|
26988
27018
|
label,
|
|
26989
27019
|
details = {},
|
|
26990
|
-
consoleOutput
|
|
27020
|
+
consoleOutput,
|
|
27021
|
+
errorsOutput
|
|
26991
27022
|
}) => {
|
|
26992
27023
|
let message = ``;
|
|
26993
27024
|
message += label;
|
|
@@ -26997,8 +27028,11 @@ ${key}: ${details[key]}`;
|
|
|
26997
27028
|
});
|
|
26998
27029
|
|
|
26999
27030
|
if (consoleOutput) {
|
|
27000
|
-
message +=
|
|
27001
|
-
|
|
27031
|
+
message += `\n${consoleOutput}`;
|
|
27032
|
+
}
|
|
27033
|
+
|
|
27034
|
+
if (errorsOutput) {
|
|
27035
|
+
message += `\n${errorsOutput}`;
|
|
27002
27036
|
}
|
|
27003
27037
|
|
|
27004
27038
|
return message;
|
|
@@ -27008,6 +27042,7 @@ const executePlan = async (plan, {
|
|
|
27008
27042
|
signal,
|
|
27009
27043
|
handleSIGINT,
|
|
27010
27044
|
logger,
|
|
27045
|
+
logRefresh,
|
|
27011
27046
|
logRuntime,
|
|
27012
27047
|
logEachDuration,
|
|
27013
27048
|
logSummary,
|
|
@@ -27180,7 +27215,7 @@ const executePlan = async (plan, {
|
|
|
27180
27215
|
|
|
27181
27216
|
const debugLogsEnabled = loggerToLevels(logger).debug;
|
|
27182
27217
|
const executionLogsEnabled = loggerToLevels(logger).info;
|
|
27183
|
-
const executionSpinner = !debugLogsEnabled && executionLogsEnabled && process.stdout.isTTY && // if there is an error during execution npm will mess up the output
|
|
27218
|
+
const executionSpinner = logRefresh && !debugLogsEnabled && executionLogsEnabled && process.stdout.isTTY && // if there is an error during execution npm will mess up the output
|
|
27184
27219
|
// (happens when npm runs several command in a workspace)
|
|
27185
27220
|
// so we enable spinner only when !process.exitCode (no error so far)
|
|
27186
27221
|
process.exitCode !== 1;
|
|
@@ -27280,7 +27315,7 @@ const executePlan = async (plan, {
|
|
|
27280
27315
|
} else {
|
|
27281
27316
|
executionResult = {
|
|
27282
27317
|
status: "errored",
|
|
27283
|
-
|
|
27318
|
+
errors: [new Error(`No file at ${fileRelativeUrl} for execution "${executionName}"`)]
|
|
27284
27319
|
};
|
|
27285
27320
|
}
|
|
27286
27321
|
|
|
@@ -27526,6 +27561,7 @@ const executeTestPlan = async ({
|
|
|
27526
27561
|
signal = new AbortController().signal,
|
|
27527
27562
|
handleSIGINT = true,
|
|
27528
27563
|
logLevel = "info",
|
|
27564
|
+
logRefresh = true,
|
|
27529
27565
|
logRuntime = true,
|
|
27530
27566
|
logEachDuration = true,
|
|
27531
27567
|
logSummary = true,
|
|
@@ -27616,7 +27652,7 @@ const executeTestPlan = async ({
|
|
|
27616
27652
|
signal,
|
|
27617
27653
|
handleSIGINT,
|
|
27618
27654
|
logger,
|
|
27619
|
-
|
|
27655
|
+
logRefresh,
|
|
27620
27656
|
logSummary,
|
|
27621
27657
|
logRuntime,
|
|
27622
27658
|
logEachDuration,
|
|
@@ -27698,54 +27734,6 @@ const executeTestPlan = async ({
|
|
|
27698
27734
|
};
|
|
27699
27735
|
};
|
|
27700
27736
|
|
|
27701
|
-
const escapeChars = (string, replacements) => {
|
|
27702
|
-
const charsToEscape = Object.keys(replacements);
|
|
27703
|
-
let result = "";
|
|
27704
|
-
let last = 0;
|
|
27705
|
-
let i = 0;
|
|
27706
|
-
|
|
27707
|
-
while (i < string.length) {
|
|
27708
|
-
const char = string[i];
|
|
27709
|
-
i++;
|
|
27710
|
-
|
|
27711
|
-
if (charsToEscape.includes(char) && !isEscaped(i - 1, string)) {
|
|
27712
|
-
if (last === i - 1) {
|
|
27713
|
-
result += replacements[char];
|
|
27714
|
-
} else {
|
|
27715
|
-
result += `${string.slice(last, i - 1)}${replacements[char]}`;
|
|
27716
|
-
}
|
|
27717
|
-
|
|
27718
|
-
last = i;
|
|
27719
|
-
}
|
|
27720
|
-
}
|
|
27721
|
-
|
|
27722
|
-
if (last !== string.length) {
|
|
27723
|
-
result += string.slice(last);
|
|
27724
|
-
}
|
|
27725
|
-
|
|
27726
|
-
return result;
|
|
27727
|
-
};
|
|
27728
|
-
|
|
27729
|
-
const escapeRegexpSpecialChars = string => {
|
|
27730
|
-
return escapeChars(String(string), {
|
|
27731
|
-
"/": "\\/",
|
|
27732
|
-
"^": "\\^",
|
|
27733
|
-
"\\": "\\\\",
|
|
27734
|
-
"[": "\\[",
|
|
27735
|
-
"]": "\\]",
|
|
27736
|
-
"(": "\\(",
|
|
27737
|
-
")": "\\)",
|
|
27738
|
-
"{": "\\{",
|
|
27739
|
-
"}": "\\}",
|
|
27740
|
-
"?": "\\?",
|
|
27741
|
-
"+": "\\+",
|
|
27742
|
-
"*": "\\*",
|
|
27743
|
-
".": "\\.",
|
|
27744
|
-
"|": "\\|",
|
|
27745
|
-
"$": "\\$"
|
|
27746
|
-
});
|
|
27747
|
-
};
|
|
27748
|
-
|
|
27749
27737
|
const createRuntimeFromPlaywright = ({
|
|
27750
27738
|
browserName,
|
|
27751
27739
|
browserVersion,
|
|
@@ -27861,7 +27849,11 @@ const createRuntimeFromPlaywright = ({
|
|
|
27861
27849
|
}
|
|
27862
27850
|
};
|
|
27863
27851
|
|
|
27864
|
-
const result = {
|
|
27852
|
+
const result = {
|
|
27853
|
+
status: "pending",
|
|
27854
|
+
namespace: null,
|
|
27855
|
+
errors: []
|
|
27856
|
+
};
|
|
27865
27857
|
const callbacks = [];
|
|
27866
27858
|
|
|
27867
27859
|
if (coverageEnabled) {
|
|
@@ -27983,19 +27975,18 @@ const createRuntimeFromPlaywright = ({
|
|
|
27983
27975
|
});
|
|
27984
27976
|
},
|
|
27985
27977
|
// https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md#event-pageerror
|
|
27986
|
-
pageerror:
|
|
27987
|
-
|
|
27988
|
-
|
|
27989
|
-
|
|
27990
|
-
|
|
27991
|
-
|
|
27992
|
-
|
|
27993
|
-
|
|
27994
|
-
|
|
27995
|
-
|
|
27996
|
-
|
|
27997
|
-
|
|
27998
|
-
},
|
|
27978
|
+
// pageerror: () => {
|
|
27979
|
+
// return registerEvent({
|
|
27980
|
+
// object: page,
|
|
27981
|
+
// eventType: "pageerror",
|
|
27982
|
+
// callback: (error) => {
|
|
27983
|
+
// if (ignoreErrorHook(error)) {
|
|
27984
|
+
// return
|
|
27985
|
+
// }
|
|
27986
|
+
// result.errors.push(transformErrorHook(error))
|
|
27987
|
+
// },
|
|
27988
|
+
// })
|
|
27989
|
+
// },
|
|
27999
27990
|
closed: cb => {
|
|
28000
27991
|
// https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md#event-disconnected
|
|
28001
27992
|
if (isBrowserDedicatedToExecution) {
|
|
@@ -28041,39 +28032,15 @@ const createRuntimeFromPlaywright = ({
|
|
|
28041
28032
|
|
|
28042
28033
|
/* istanbul ignore next */
|
|
28043
28034
|
() => {
|
|
28044
|
-
if (!window.
|
|
28045
|
-
throw new Error(`window.
|
|
28035
|
+
if (!window.__supervisor__) {
|
|
28036
|
+
throw new Error(`window.__supervisor__ not found`);
|
|
28046
28037
|
}
|
|
28047
28038
|
|
|
28048
|
-
return window.
|
|
28039
|
+
return window.__supervisor__.getScriptExecutionResults();
|
|
28049
28040
|
}
|
|
28050
28041
|
/* eslint-enable no-undef */
|
|
28051
28042
|
);
|
|
28052
|
-
|
|
28053
|
-
status,
|
|
28054
|
-
scriptExecutionResults
|
|
28055
|
-
} = returnValue;
|
|
28056
|
-
|
|
28057
|
-
if (status === "errored") {
|
|
28058
|
-
const {
|
|
28059
|
-
exceptionSource
|
|
28060
|
-
} = returnValue;
|
|
28061
|
-
const error = evalException(exceptionSource, {
|
|
28062
|
-
rootDirectoryUrl,
|
|
28063
|
-
devServerOrigin,
|
|
28064
|
-
transformErrorHook
|
|
28065
|
-
});
|
|
28066
|
-
cb({
|
|
28067
|
-
status: "errored",
|
|
28068
|
-
error,
|
|
28069
|
-
namespace: scriptExecutionResults
|
|
28070
|
-
});
|
|
28071
|
-
} else {
|
|
28072
|
-
cb({
|
|
28073
|
-
status: "completed",
|
|
28074
|
-
namespace: scriptExecutionResults
|
|
28075
|
-
});
|
|
28076
|
-
}
|
|
28043
|
+
cb(returnValue);
|
|
28077
28044
|
} catch (e) {
|
|
28078
28045
|
reject(e);
|
|
28079
28046
|
}
|
|
@@ -28081,47 +28048,48 @@ const createRuntimeFromPlaywright = ({
|
|
|
28081
28048
|
}, resolve);
|
|
28082
28049
|
});
|
|
28083
28050
|
|
|
28084
|
-
const
|
|
28051
|
+
const writeResult = async () => {
|
|
28085
28052
|
const winner = await winnerPromise;
|
|
28086
28053
|
|
|
28087
28054
|
if (winner.name === "aborted") {
|
|
28088
|
-
|
|
28089
|
-
|
|
28090
|
-
};
|
|
28055
|
+
result.status = "aborted";
|
|
28056
|
+
return;
|
|
28091
28057
|
}
|
|
28092
28058
|
|
|
28093
|
-
if (winner.name === "error"
|
|
28094
|
-
|
|
28095
|
-
|
|
28096
|
-
|
|
28097
|
-
|
|
28098
|
-
};
|
|
28059
|
+
if (winner.name === "error") {
|
|
28060
|
+
let error = winner.data;
|
|
28061
|
+
result.status = "errored";
|
|
28062
|
+
result.errors.push(error);
|
|
28063
|
+
return;
|
|
28099
28064
|
}
|
|
28100
28065
|
|
|
28101
28066
|
if (winner.name === "closed") {
|
|
28102
|
-
|
|
28103
|
-
|
|
28104
|
-
|
|
28105
|
-
|
|
28106
|
-
|
|
28067
|
+
result.status = "errored";
|
|
28068
|
+
result.errors.push(isBrowserDedicatedToExecution ? new Error(`browser disconnected during execution`) : new Error(`page closed during execution`));
|
|
28069
|
+
return;
|
|
28070
|
+
} // winner.name = 'response'
|
|
28071
|
+
|
|
28107
28072
|
|
|
28108
|
-
|
|
28073
|
+
const {
|
|
28074
|
+
executionResults
|
|
28075
|
+
} = winner.data;
|
|
28076
|
+
result.status = "completed";
|
|
28077
|
+
result.namespace = executionResults;
|
|
28078
|
+
Object.keys(executionResults).forEach(key => {
|
|
28079
|
+
const executionResult = executionResults[key];
|
|
28080
|
+
|
|
28081
|
+
if (executionResult.status === "errored") {
|
|
28082
|
+
result.status = "errored";
|
|
28083
|
+
result.errors.push({ ...executionResult.exception,
|
|
28084
|
+
stack: executionResult.exception.text
|
|
28085
|
+
});
|
|
28086
|
+
}
|
|
28087
|
+
});
|
|
28088
|
+
return;
|
|
28109
28089
|
};
|
|
28110
28090
|
|
|
28111
28091
|
try {
|
|
28112
|
-
|
|
28113
|
-
status,
|
|
28114
|
-
error,
|
|
28115
|
-
namespace,
|
|
28116
|
-
performance
|
|
28117
|
-
} = await getResult();
|
|
28118
|
-
result.status = status;
|
|
28119
|
-
|
|
28120
|
-
if (status === "errored") {
|
|
28121
|
-
result.error = error;
|
|
28122
|
-
} else {
|
|
28123
|
-
result.namespace = namespace;
|
|
28124
|
-
}
|
|
28092
|
+
await writeResult();
|
|
28125
28093
|
|
|
28126
28094
|
if (collectPerformance) {
|
|
28127
28095
|
result.performance = performance;
|
|
@@ -28133,7 +28101,7 @@ const createRuntimeFromPlaywright = ({
|
|
|
28133
28101
|
}, Promise.resolve());
|
|
28134
28102
|
} catch (e) {
|
|
28135
28103
|
result.status = "errored";
|
|
28136
|
-
result.
|
|
28104
|
+
result.errors = [e];
|
|
28137
28105
|
}
|
|
28138
28106
|
|
|
28139
28107
|
if (keepRunning) {
|
|
@@ -28294,25 +28262,6 @@ const registerEvent = ({
|
|
|
28294
28262
|
};
|
|
28295
28263
|
};
|
|
28296
28264
|
|
|
28297
|
-
const evalException = (exceptionSource, {
|
|
28298
|
-
rootDirectoryUrl,
|
|
28299
|
-
devServerOrigin,
|
|
28300
|
-
transformErrorHook
|
|
28301
|
-
}) => {
|
|
28302
|
-
const script = new Script(exceptionSource, {
|
|
28303
|
-
filename: ""
|
|
28304
|
-
});
|
|
28305
|
-
const error = script.runInThisContext();
|
|
28306
|
-
|
|
28307
|
-
if (error && error instanceof Error) {
|
|
28308
|
-
const remoteRootRegexp = new RegExp(escapeRegexpSpecialChars(`${devServerOrigin}/`), "g");
|
|
28309
|
-
error.stack = error.stack.replace(remoteRootRegexp, rootDirectoryUrl);
|
|
28310
|
-
error.message = error.message.replace(remoteRootRegexp, rootDirectoryUrl);
|
|
28311
|
-
}
|
|
28312
|
-
|
|
28313
|
-
return transformErrorHook(error);
|
|
28314
|
-
};
|
|
28315
|
-
|
|
28316
28265
|
const chromium = createRuntimeFromPlaywright({
|
|
28317
28266
|
browserName: "chromium",
|
|
28318
28267
|
browserVersion: "104.0.5112.48",
|
|
@@ -28808,8 +28757,13 @@ nodeChildProcess.run = async ({
|
|
|
28808
28757
|
}
|
|
28809
28758
|
}, resolve);
|
|
28810
28759
|
});
|
|
28760
|
+
const result = {
|
|
28761
|
+
status: "executing",
|
|
28762
|
+
errors: [],
|
|
28763
|
+
namespace: null
|
|
28764
|
+
};
|
|
28811
28765
|
|
|
28812
|
-
const
|
|
28766
|
+
const writeResult = async () => {
|
|
28813
28767
|
actionOperation.throwIfAborted();
|
|
28814
28768
|
await childProcessReadyPromise;
|
|
28815
28769
|
actionOperation.throwIfAborted();
|
|
@@ -28832,18 +28786,16 @@ nodeChildProcess.run = async ({
|
|
|
28832
28786
|
const winner = await winnerPromise;
|
|
28833
28787
|
|
|
28834
28788
|
if (winner.name === "aborted") {
|
|
28835
|
-
|
|
28836
|
-
|
|
28837
|
-
};
|
|
28789
|
+
result.status = "aborted";
|
|
28790
|
+
return;
|
|
28838
28791
|
}
|
|
28839
28792
|
|
|
28840
28793
|
if (winner.name === "error") {
|
|
28841
28794
|
const error = winner.data;
|
|
28842
28795
|
removeOutputListener();
|
|
28843
|
-
|
|
28844
|
-
|
|
28845
|
-
|
|
28846
|
-
};
|
|
28796
|
+
result.status = "errored";
|
|
28797
|
+
result.errors.push(error);
|
|
28798
|
+
return;
|
|
28847
28799
|
}
|
|
28848
28800
|
|
|
28849
28801
|
if (winner.name === "exit") {
|
|
@@ -28853,25 +28805,22 @@ nodeChildProcess.run = async ({
|
|
|
28853
28805
|
await cleanup("process exit");
|
|
28854
28806
|
|
|
28855
28807
|
if (code === 12) {
|
|
28856
|
-
|
|
28857
|
-
|
|
28858
|
-
|
|
28859
|
-
};
|
|
28808
|
+
result.status = "errored";
|
|
28809
|
+
result.errors.push(new Error(`node process exited with 12 (the forked child process wanted to use a non-available port for debug)`));
|
|
28810
|
+
return;
|
|
28860
28811
|
}
|
|
28861
28812
|
|
|
28862
28813
|
if (code === null || code === 0 || code === EXIT_CODES.SIGINT || code === EXIT_CODES.SIGTERM || code === EXIT_CODES.SIGABORT) {
|
|
28863
|
-
|
|
28864
|
-
|
|
28865
|
-
|
|
28866
|
-
};
|
|
28814
|
+
result.status = "errored";
|
|
28815
|
+
result.errors.push(new Error(`node process exited during execution`));
|
|
28816
|
+
return;
|
|
28867
28817
|
} // process.exit(1) in child process or process.exitCode = 1 + process.exit()
|
|
28868
28818
|
// means there was an error even if we don't know exactly what.
|
|
28869
28819
|
|
|
28870
28820
|
|
|
28871
|
-
|
|
28872
|
-
|
|
28873
|
-
|
|
28874
|
-
};
|
|
28821
|
+
result.status = "errored";
|
|
28822
|
+
result.errors.push(new Error(`node process exited with code ${code} during execution`));
|
|
28823
|
+
return;
|
|
28875
28824
|
}
|
|
28876
28825
|
|
|
28877
28826
|
const {
|
|
@@ -28880,27 +28829,27 @@ nodeChildProcess.run = async ({
|
|
|
28880
28829
|
} = winner.data;
|
|
28881
28830
|
|
|
28882
28831
|
if (status === "action-failed") {
|
|
28883
|
-
|
|
28884
|
-
|
|
28885
|
-
|
|
28886
|
-
};
|
|
28832
|
+
result.status = "errored";
|
|
28833
|
+
result.errors.push(value);
|
|
28834
|
+
return;
|
|
28887
28835
|
}
|
|
28888
28836
|
|
|
28889
|
-
|
|
28890
|
-
|
|
28891
|
-
|
|
28892
|
-
|
|
28837
|
+
const {
|
|
28838
|
+
namespace,
|
|
28839
|
+
performance,
|
|
28840
|
+
coverage
|
|
28841
|
+
} = value;
|
|
28842
|
+
result.status = "completed";
|
|
28843
|
+
result.namespace = namespace;
|
|
28844
|
+
result.performance = performance;
|
|
28845
|
+
result.coverage = coverage;
|
|
28893
28846
|
};
|
|
28894
28847
|
|
|
28895
|
-
let result;
|
|
28896
|
-
|
|
28897
28848
|
try {
|
|
28898
|
-
|
|
28849
|
+
await writeResult();
|
|
28899
28850
|
} catch (e) {
|
|
28900
|
-
result =
|
|
28901
|
-
|
|
28902
|
-
error: e
|
|
28903
|
-
};
|
|
28851
|
+
result.status = "errored";
|
|
28852
|
+
result.errors.push(e);
|
|
28904
28853
|
}
|
|
28905
28854
|
|
|
28906
28855
|
if (keepRunning) {
|
|
@@ -29107,8 +29056,13 @@ nodeWorkerThread.run = async ({
|
|
|
29107
29056
|
}
|
|
29108
29057
|
}, resolve);
|
|
29109
29058
|
});
|
|
29059
|
+
const result = {
|
|
29060
|
+
status: "executing",
|
|
29061
|
+
errors: [],
|
|
29062
|
+
namespace: null
|
|
29063
|
+
};
|
|
29110
29064
|
|
|
29111
|
-
const
|
|
29065
|
+
const writeResult = async () => {
|
|
29112
29066
|
actionOperation.throwIfAborted();
|
|
29113
29067
|
await workerThreadReadyPromise;
|
|
29114
29068
|
actionOperation.throwIfAborted();
|
|
@@ -29131,18 +29085,16 @@ nodeWorkerThread.run = async ({
|
|
|
29131
29085
|
const winner = await winnerPromise;
|
|
29132
29086
|
|
|
29133
29087
|
if (winner.name === "aborted") {
|
|
29134
|
-
|
|
29135
|
-
|
|
29136
|
-
};
|
|
29088
|
+
result.status = "aborted";
|
|
29089
|
+
return;
|
|
29137
29090
|
}
|
|
29138
29091
|
|
|
29139
29092
|
if (winner.name === "error") {
|
|
29140
29093
|
const error = winner.data;
|
|
29141
29094
|
removeOutputListener();
|
|
29142
|
-
|
|
29143
|
-
|
|
29144
|
-
|
|
29145
|
-
};
|
|
29095
|
+
result.status = "errored";
|
|
29096
|
+
result.errors.push(error);
|
|
29097
|
+
return;
|
|
29146
29098
|
}
|
|
29147
29099
|
|
|
29148
29100
|
if (winner.name === "exit") {
|
|
@@ -29152,25 +29104,21 @@ nodeWorkerThread.run = async ({
|
|
|
29152
29104
|
await cleanup("process exit");
|
|
29153
29105
|
|
|
29154
29106
|
if (code === 12) {
|
|
29155
|
-
|
|
29156
|
-
|
|
29157
|
-
|
|
29158
|
-
};
|
|
29107
|
+
result.status = "errored";
|
|
29108
|
+
result.errors.push(new Error(`node process exited with 12 (the forked child process wanted to use a non-available port for debug)`));
|
|
29109
|
+
return;
|
|
29159
29110
|
}
|
|
29160
29111
|
|
|
29161
29112
|
if (code === null || code === 0 || code === EXIT_CODES.SIGINT || code === EXIT_CODES.SIGTERM || code === EXIT_CODES.SIGABORT) {
|
|
29162
|
-
|
|
29163
|
-
|
|
29164
|
-
|
|
29165
|
-
};
|
|
29113
|
+
result.status = "errored";
|
|
29114
|
+
result.errors.push(new Error(`node worker thread exited during execution`));
|
|
29115
|
+
return;
|
|
29166
29116
|
} // process.exit(1) in child process or process.exitCode = 1 + process.exit()
|
|
29167
29117
|
// means there was an error even if we don't know exactly what.
|
|
29168
29118
|
|
|
29169
29119
|
|
|
29170
|
-
|
|
29171
|
-
|
|
29172
|
-
error: new Error(`node worker thread exited with code ${code} during execution`)
|
|
29173
|
-
};
|
|
29120
|
+
result.status = "errored";
|
|
29121
|
+
result.errors.push(new Error(`node worker thread exited with code ${code} during execution`));
|
|
29174
29122
|
}
|
|
29175
29123
|
|
|
29176
29124
|
const {
|
|
@@ -29179,10 +29127,9 @@ nodeWorkerThread.run = async ({
|
|
|
29179
29127
|
} = winner.data;
|
|
29180
29128
|
|
|
29181
29129
|
if (status === "action-failed") {
|
|
29182
|
-
|
|
29183
|
-
|
|
29184
|
-
|
|
29185
|
-
};
|
|
29130
|
+
result.status = "errored";
|
|
29131
|
+
result.errors.push(value);
|
|
29132
|
+
return;
|
|
29186
29133
|
}
|
|
29187
29134
|
|
|
29188
29135
|
const {
|
|
@@ -29190,23 +29137,17 @@ nodeWorkerThread.run = async ({
|
|
|
29190
29137
|
performance,
|
|
29191
29138
|
coverage
|
|
29192
29139
|
} = value;
|
|
29193
|
-
|
|
29194
|
-
|
|
29195
|
-
|
|
29196
|
-
|
|
29197
|
-
coverage
|
|
29198
|
-
};
|
|
29140
|
+
result.status = "completed";
|
|
29141
|
+
result.namespace = namespace;
|
|
29142
|
+
result.performance = performance;
|
|
29143
|
+
result.coverage = coverage;
|
|
29199
29144
|
};
|
|
29200
29145
|
|
|
29201
|
-
let result;
|
|
29202
|
-
|
|
29203
29146
|
try {
|
|
29204
|
-
|
|
29147
|
+
await writeResult();
|
|
29205
29148
|
} catch (e) {
|
|
29206
|
-
result =
|
|
29207
|
-
|
|
29208
|
-
error: e
|
|
29209
|
-
};
|
|
29149
|
+
result.status = "errored";
|
|
29150
|
+
result.errors.push(e);
|
|
29210
29151
|
}
|
|
29211
29152
|
|
|
29212
29153
|
if (keepRunning) {
|
|
@@ -29593,7 +29534,7 @@ const execute = async ({
|
|
|
29593
29534
|
*/
|
|
29594
29535
|
|
|
29595
29536
|
|
|
29596
|
-
throw result.
|
|
29537
|
+
throw result.errors[result.errors.length - 1];
|
|
29597
29538
|
}
|
|
29598
29539
|
|
|
29599
29540
|
return result;
|
|
@@ -29626,10 +29567,9 @@ const globalInjectorOnHtml = async (urlInfo, globals) => {
|
|
|
29626
29567
|
isWebWorker: false
|
|
29627
29568
|
});
|
|
29628
29569
|
injectScriptNodeAsEarlyAsPossible(htmlAst, createHtmlNode({
|
|
29629
|
-
|
|
29630
|
-
|
|
29631
|
-
|
|
29632
|
-
}));
|
|
29570
|
+
tagName: "script",
|
|
29571
|
+
textContent: clientCode
|
|
29572
|
+
}), "jsenv:inject_globals");
|
|
29633
29573
|
return stringifyHtmlAst(htmlAst);
|
|
29634
29574
|
};
|
|
29635
29575
|
|