@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
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
window.__html_supervisor__ = {
|
|
2
|
-
// "html_supervisor_installer.js" will implement
|
|
3
|
-
// - "addScriptToExecute"
|
|
4
|
-
// - "superviseScriptTypeModule"
|
|
5
|
-
// - "collectScriptResults"
|
|
6
|
-
// and take all executions in "scriptsToExecute" and implement their supervision
|
|
7
|
-
scriptsToExecute: [],
|
|
8
|
-
addScriptToExecute: (scriptToExecute) => {
|
|
9
|
-
window.__html_supervisor__.scriptsToExecute.push(scriptToExecute)
|
|
10
|
-
},
|
|
11
|
-
superviseScript: ({ src, isInline, crossorigin, integrity }) => {
|
|
12
|
-
const { currentScript } = document
|
|
13
|
-
window.__html_supervisor__.addScriptToExecute({
|
|
14
|
-
src,
|
|
15
|
-
type: "js_classic",
|
|
16
|
-
isInline,
|
|
17
|
-
currentScript,
|
|
18
|
-
execute: (url) => {
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
const script = document.createElement("script")
|
|
21
|
-
if (crossorigin) {
|
|
22
|
-
script.crossorigin = crossorigin
|
|
23
|
-
}
|
|
24
|
-
if (integrity) {
|
|
25
|
-
script.integrity = integrity
|
|
26
|
-
}
|
|
27
|
-
script.src = url
|
|
28
|
-
let lastWindowErrorUrl
|
|
29
|
-
let lastWindowError
|
|
30
|
-
const windowErrorCallback = (e) => {
|
|
31
|
-
lastWindowErrorUrl = e.filename
|
|
32
|
-
lastWindowError = e.error
|
|
33
|
-
}
|
|
34
|
-
const cleanup = () => {
|
|
35
|
-
// the execution of the script itself can remove script from the page
|
|
36
|
-
if (script.parentNode) {
|
|
37
|
-
script.parentNode.removeChild(script)
|
|
38
|
-
}
|
|
39
|
-
window.removeEventListener("error", windowErrorCallback)
|
|
40
|
-
}
|
|
41
|
-
window.addEventListener("error", windowErrorCallback)
|
|
42
|
-
script.addEventListener("error", () => {
|
|
43
|
-
cleanup()
|
|
44
|
-
reject(src)
|
|
45
|
-
})
|
|
46
|
-
script.addEventListener("load", () => {
|
|
47
|
-
cleanup()
|
|
48
|
-
if (lastWindowErrorUrl === url) {
|
|
49
|
-
reject(lastWindowError)
|
|
50
|
-
} else {
|
|
51
|
-
resolve()
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
if (currentScript) {
|
|
55
|
-
currentScript.parentNode.insertBefore(
|
|
56
|
-
script,
|
|
57
|
-
currentScript.nextSibling,
|
|
58
|
-
)
|
|
59
|
-
} else {
|
|
60
|
-
document.body.appendChild(script)
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
},
|
|
64
|
-
})
|
|
65
|
-
},
|
|
66
|
-
superviseScriptTypeModule: () => {
|
|
67
|
-
throw new Error("htmlSupervisor not installed")
|
|
68
|
-
},
|
|
69
|
-
getScriptExecutionResults: () => {
|
|
70
|
-
// wait for page to load before collecting script execution results
|
|
71
|
-
const htmlReadyPromise = new Promise((resolve) => {
|
|
72
|
-
if (document.readyState === "complete") {
|
|
73
|
-
resolve()
|
|
74
|
-
return
|
|
75
|
-
}
|
|
76
|
-
const loadCallback = () => {
|
|
77
|
-
window.removeEventListener("load", loadCallback)
|
|
78
|
-
resolve()
|
|
79
|
-
}
|
|
80
|
-
window.addEventListener("load", loadCallback)
|
|
81
|
-
})
|
|
82
|
-
return htmlReadyPromise.then(() => {
|
|
83
|
-
return window.__html_supervisor__.collectScriptResults()
|
|
84
|
-
})
|
|
85
|
-
},
|
|
86
|
-
collectScriptResults: () => {
|
|
87
|
-
throw new Error("htmlSupervisor not installed")
|
|
88
|
-
},
|
|
89
|
-
}
|