@jsenv/core 25.4.7 → 25.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser_runtime/asset-manifest.json +2 -2
- package/dist/browser_runtime/browser_runtime_c81cd9af.js +5300 -0
- package/dist/browser_runtime/browser_runtime_c81cd9af.js.map +1089 -0
- package/dist/build_manifest.js +6 -6
- package/dist/compile_proxy/asset-manifest.json +2 -2
- package/dist/compile_proxy/{compile_proxy.html__inline__20_f4285042.js.map → compile_proxy.html__inline__20_c05fdc30.js.map} +2 -2
- package/dist/compile_proxy/{compile_proxy_ab528227.html → compile_proxy_93ec4247.html} +7 -4
- package/dist/event_source_client/asset-manifest.json +2 -2
- package/dist/event_source_client/event_source_client_69f48287.js +354 -0
- package/dist/event_source_client/{event_source_client_80644aee.js.map → event_source_client_69f48287.js.map} +2 -2
- package/dist/redirector/asset-manifest.json +2 -2
- package/dist/redirector/{redirector.html__inline__12_404b8295.js.map → redirector.html__inline__12_20421b23.js.map} +2 -2
- package/dist/redirector/{redirector_6df2620a.html → redirector_ddc79416.html} +7 -4
- package/dist/toolbar/asset-manifest.json +5 -5
- package/dist/toolbar/assets/{compilation.css_e37c747b.map → compilation.css_7421bd55.map} +3 -3
- package/dist/toolbar/assets/settings.css_942b5a9e.map +12 -0
- package/dist/toolbar/assets/{toolbar.main.css_269d7ce2.map → toolbar.main.css_b7d8bec1.map} +4 -4
- package/dist/toolbar/{toolbar.main_2c56a4e0.js.map → toolbar.main_7d7783d3.js.map} +2 -2
- package/dist/toolbar/{toolbar_17abd09a.html → toolbar_d6045dd0.html} +17 -11
- package/dist/toolbar_injector/asset-manifest.json +2 -2
- package/dist/toolbar_injector/toolbar_injector_c8c214dd.js +977 -0
- package/dist/toolbar_injector/{toolbar_injector_0f93509c.js.map → toolbar_injector_c8c214dd.js.map} +4 -4
- package/helpers/babel/asyncIterator/asyncIterator.js +61 -8
- package/helpers/babel/createClass/createClass.js +12 -12
- package/helpers/babel/inherits/inherits.js +10 -6
- package/helpers/babel/jsx/jsx.js +27 -22
- package/helpers/babel/objectSpread2/objectSpread2.js +22 -14
- package/helpers/babel/readme.md +3 -8
- package/helpers/babel/wrapRegExp/wrapRegExp.js +29 -29
- package/package.json +36 -36
- package/readme.md +21 -18
- package/src/buildProject.js +12 -20
- package/src/dev_server.js +6 -4
- package/src/executeTestPlan.js +20 -19
- package/src/internal/building/buildUsingRollup.js +5 -20
- package/src/internal/building/build_logs.js +33 -37
- package/src/internal/building/build_stats.js +2 -1
- package/src/internal/building/es_to_system.js +34 -0
- package/src/internal/building/import_references.js +0 -1
- package/src/internal/building/rollup_plugin_jsenv.js +146 -43
- package/src/internal/compiling/createCompiledFileService.js +0 -4
- package/src/internal/compiling/jsenvCompilerForJavaScript.js +2 -3
- package/src/internal/compiling/jsenv_directory/compile_context.js +1 -10
- package/src/internal/compiling/jsenv_directory/compile_profile.js +1 -2
- package/src/internal/compiling/startCompileServer.js +0 -14
- package/src/internal/dev_server/toolbar/compilation/compilation.css +3 -2
- package/src/internal/dev_server/toolbar/settings/settings.css +1 -2
- package/src/internal/dev_server/toolbar/toolbar.html +8 -4
- package/src/internal/executing/coverage/reportToCoverage.js +1 -0
- package/src/internal/executing/coverage_utils/v8_coverage_from_directory.js +2 -1
- package/src/internal/executing/executePlan.js +450 -60
- package/src/internal/jsenvCoreDirectoryUrl.js +7 -18
- package/src/internal/runtime/s.js +3 -2
- package/src/internal/runtime_support/runtime_support.js +1 -1
- package/dist/browser_runtime/browser_runtime_0e3396a1.js +0 -5298
- package/dist/browser_runtime/browser_runtime_0e3396a1.js.map +0 -1089
- package/dist/event_source_client/event_source_client_80644aee.js +0 -356
- package/dist/toolbar/assets/settings.css_61548139.map +0 -12
- package/dist/toolbar_injector/toolbar_injector_0f93509c.js +0 -976
- package/src/internal/executing/executeConcurrently.js +0 -440
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.6.2",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -51,16 +51,16 @@
|
|
|
51
51
|
"playwright": "1.x"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@babel/core": "7.16.
|
|
55
|
-
"@babel/helper-module-imports": "7.16.
|
|
56
|
-
"@babel/helpers": "7.16.
|
|
57
|
-
"@babel/parser": "7.16.
|
|
58
|
-
"@babel/plugin-proposal-dynamic-import": "7.16.
|
|
54
|
+
"@babel/core": "7.16.12",
|
|
55
|
+
"@babel/helper-module-imports": "7.16.7",
|
|
56
|
+
"@babel/helpers": "7.16.7",
|
|
57
|
+
"@babel/parser": "7.16.12",
|
|
58
|
+
"@babel/plugin-proposal-dynamic-import": "7.16.7",
|
|
59
59
|
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
|
60
|
-
"@babel/plugin-syntax-import-assertions": "7.16.
|
|
60
|
+
"@babel/plugin-syntax-import-assertions": "7.16.7",
|
|
61
61
|
"@babel/plugin-syntax-import-meta": "7.10.4",
|
|
62
62
|
"@babel/plugin-syntax-numeric-separator": "7.10.4",
|
|
63
|
-
"@babel/plugin-transform-modules-systemjs": "7.16.
|
|
63
|
+
"@babel/plugin-transform-modules-systemjs": "7.16.7",
|
|
64
64
|
"@c88/v8-coverage": "0.1.1",
|
|
65
65
|
"@jsenv/abort": "4.1.2",
|
|
66
66
|
"@jsenv/filesystem": "2.7.1",
|
|
@@ -68,20 +68,21 @@
|
|
|
68
68
|
"@jsenv/integrity": "0.0.1",
|
|
69
69
|
"@jsenv/log": "1.5.0",
|
|
70
70
|
"@jsenv/logger": "4.0.1",
|
|
71
|
-
"@jsenv/server": "12.4.
|
|
71
|
+
"@jsenv/server": "12.4.2",
|
|
72
72
|
"@jsenv/uneval": "1.6.0",
|
|
73
73
|
"@rollup/plugin-commonjs": "21.0.1",
|
|
74
74
|
"@rollup/plugin-json": "4.1.0",
|
|
75
|
-
"@rollup/plugin-node-resolve": "13.1.
|
|
76
|
-
"@rollup/plugin-replace": "3.0.
|
|
75
|
+
"@rollup/plugin-node-resolve": "13.1.3",
|
|
76
|
+
"@rollup/plugin-replace": "3.0.1",
|
|
77
77
|
"acorn-import-assertions": "1.8.0",
|
|
78
78
|
"ansi-to-html": "0.7.2",
|
|
79
|
-
"bytes": "3.1.
|
|
79
|
+
"bytes": "3.1.2",
|
|
80
80
|
"cjs-module-lexer": "1.2.2",
|
|
81
|
-
"construct-style-sheets-polyfill": "3.0
|
|
82
|
-
"cssnano": "5.0.
|
|
83
|
-
"cssnano-preset-default": "5.1.
|
|
81
|
+
"construct-style-sheets-polyfill": "3.1.0",
|
|
82
|
+
"cssnano": "5.0.16",
|
|
83
|
+
"cssnano-preset-default": "5.1.11",
|
|
84
84
|
"cuid": "2.1.8",
|
|
85
|
+
"es-iife": "0.2.2",
|
|
85
86
|
"estree-walker": "3.0.1",
|
|
86
87
|
"html-minifier": "4.0.0",
|
|
87
88
|
"humanize-duration": "3.27.1",
|
|
@@ -89,57 +90,56 @@
|
|
|
89
90
|
"istanbul-lib-coverage": "3.2.0",
|
|
90
91
|
"istanbul-lib-instrument": "5.1.0",
|
|
91
92
|
"istanbul-lib-report": "3.0.0",
|
|
92
|
-
"istanbul-reports": "3.1.
|
|
93
|
+
"istanbul-reports": "3.1.3",
|
|
93
94
|
"magic-string": "0.25.7",
|
|
94
95
|
"parse5": "6.0.1",
|
|
95
96
|
"pidtree": "0.5.0",
|
|
96
97
|
"postcss": "8.4.5",
|
|
97
98
|
"postcss-value-parser": "4.2.0",
|
|
98
99
|
"regenerator-runtime": "0.13.9",
|
|
99
|
-
"resolve": "1.
|
|
100
|
-
"rollup": "2.
|
|
100
|
+
"resolve": "1.22.0",
|
|
101
|
+
"rollup": "2.66.1",
|
|
101
102
|
"rollup-plugin-node-builtins-brofs": "2.1.3",
|
|
102
103
|
"rollup-plugin-node-globals": "1.4.0",
|
|
103
104
|
"rollup-plugin-polyfill-node": "0.8.0",
|
|
104
105
|
"source-map": "0.7.3",
|
|
106
|
+
"strip-ansi": "7.0.1",
|
|
105
107
|
"systemjs": "6.11.0",
|
|
106
108
|
"terser": "5.10.0",
|
|
107
|
-
"v8-to-istanbul": "8.1.
|
|
109
|
+
"v8-to-istanbul": "8.1.1",
|
|
108
110
|
"vm2": "3.9.5",
|
|
109
|
-
"why-is-node-running": "2.2.0",
|
|
110
111
|
"wrap-ansi": "8.0.1"
|
|
111
112
|
},
|
|
112
113
|
"devDependencies": {
|
|
113
114
|
"@babel/eslint-parser": "7.16.5",
|
|
114
|
-
"@babel/plugin-syntax-jsx": "7.16.
|
|
115
|
-
"@babel/plugin-transform-block-scoping": "7.16.
|
|
116
|
-
"@babel/plugin-transform-react-jsx": "7.16.
|
|
117
|
-
"@babel/plugin-transform-typescript": "7.16.
|
|
118
|
-
"@babel/preset-env": "7.16.
|
|
119
|
-
"@jsenv/assert": "2.5.
|
|
115
|
+
"@babel/plugin-syntax-jsx": "7.16.7",
|
|
116
|
+
"@babel/plugin-transform-block-scoping": "7.16.7",
|
|
117
|
+
"@babel/plugin-transform-react-jsx": "7.16.7",
|
|
118
|
+
"@babel/plugin-transform-typescript": "7.16.8",
|
|
119
|
+
"@babel/preset-env": "7.16.11",
|
|
120
|
+
"@jsenv/assert": "2.5.2",
|
|
120
121
|
"@jsenv/babel-preset": "1.1.2",
|
|
121
122
|
"@jsenv/eslint-config": "16.0.9",
|
|
122
|
-
"@jsenv/file-size-impact": "12.1.
|
|
123
|
+
"@jsenv/file-size-impact": "12.1.8",
|
|
123
124
|
"@jsenv/github-release-package": "1.3.4",
|
|
124
125
|
"@jsenv/https-local": "1.0.7",
|
|
125
126
|
"@jsenv/importmap-eslint-resolver": "5.2.5",
|
|
126
127
|
"@jsenv/importmap-node-module": "5.1.3",
|
|
127
128
|
"@jsenv/package-publish": "1.7.2",
|
|
128
|
-
"@jsenv/performance-impact": "2.2.
|
|
129
|
+
"@jsenv/performance-impact": "2.2.7",
|
|
129
130
|
"@jsenv/pwa": "4.0.1",
|
|
130
|
-
"babel-plugin-transform-async-to-promises": "0.8.
|
|
131
|
-
"eslint": "
|
|
131
|
+
"babel-plugin-transform-async-to-promises": "0.8.18",
|
|
132
|
+
"eslint": "8.8.0",
|
|
132
133
|
"eslint-plugin-html": "6.2.0",
|
|
133
|
-
"eslint-plugin-import": "2.25.
|
|
134
|
-
"eslint-plugin-react": "7.
|
|
134
|
+
"eslint-plugin-import": "2.25.4",
|
|
135
|
+
"eslint-plugin-react": "7.28.0",
|
|
135
136
|
"node-notifier": "10.0.0",
|
|
136
|
-
"playwright": "1.
|
|
137
|
+
"playwright": "1.18.1",
|
|
137
138
|
"postcss-import": "14.0.2",
|
|
138
|
-
"preact": "10.6.
|
|
139
|
+
"preact": "10.6.5",
|
|
139
140
|
"prettier": "2.5.1",
|
|
140
141
|
"react": "17.0.2",
|
|
141
142
|
"react-dom": "17.0.2",
|
|
142
|
-
"redux": "4.1.2"
|
|
143
|
-
"rollup-plugin-import-assert": "1.1.1"
|
|
143
|
+
"redux": "4.1.2"
|
|
144
144
|
}
|
|
145
145
|
}
|
package/readme.md
CHANGED
|
@@ -12,7 +12,7 @@ This section demos 3 things jsenv provides:
|
|
|
12
12
|
2. A dev server
|
|
13
13
|
3. A build script
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
The upcoming demos applies jsenv to simple use cases to make them straightforward.
|
|
16
16
|
|
|
17
17
|
## Test runner overview
|
|
18
18
|
|
|
@@ -216,19 +216,16 @@ await buildProject({
|
|
|
216
216
|
> node ./build.mjs
|
|
217
217
|
|
|
218
218
|
building ./main.html...
|
|
219
|
-
--- files
|
|
220
|
-
dist/assets/
|
|
221
|
-
dist/assets/
|
|
222
|
-
dist/
|
|
223
|
-
dist/main.prod.html (
|
|
224
|
-
dist/project_b237a334.importmap (29 B)
|
|
225
|
-
--- sourcemap files in the build: 2 ---
|
|
226
|
-
dist/assets/main_3b329ff0.css.map (198 B)
|
|
227
|
-
dist/main_3b329ff0.js.map (55Kb B)
|
|
219
|
+
--- build files (excluding sourcemap files) ---
|
|
220
|
+
dist/assets/favicon_25e95a00.ico (6.67 KB)
|
|
221
|
+
dist/assets/main_cd3a5025.css (70 B)
|
|
222
|
+
dist/main_c588dd03.js (167 B)
|
|
223
|
+
dist/main.prod.html (886 B)
|
|
228
224
|
------- build summary -------
|
|
229
|
-
project files:
|
|
230
|
-
build files:
|
|
231
|
-
build
|
|
225
|
+
project files: 5 (70.32 KB)
|
|
226
|
+
build files: 4 (45.77 KB)
|
|
227
|
+
build sourcemap files: 2 (705 B)
|
|
228
|
+
build duration: 0.14 seconds
|
|
232
229
|
------------------------------
|
|
233
230
|
✔ build end
|
|
234
231
|
```
|
|
@@ -241,14 +238,20 @@ build duration: 1.85 seconds
|
|
|
241
238
|
<head>
|
|
242
239
|
<title>Title</title>
|
|
243
240
|
<meta charset="utf-8" />
|
|
244
|
-
<link rel="modulepreload" href="
|
|
245
|
-
<link rel="icon" href="assets/
|
|
246
|
-
<script type="importmap"
|
|
247
|
-
|
|
241
|
+
<link rel="modulepreload" href="main_c588dd03.js" />
|
|
242
|
+
<link rel="icon" href="assets/favicon_25e95a00.ico" />
|
|
243
|
+
<script type="importmap">
|
|
244
|
+
{
|
|
245
|
+
"imports": {
|
|
246
|
+
"./main.js": "./main_c588dd03.js"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
</script>
|
|
250
|
+
<link rel="stylesheet" type="text/css" href="assets/main_cd3a5025.css" />
|
|
248
251
|
</head>
|
|
249
252
|
|
|
250
253
|
<body>
|
|
251
|
-
<script type="module" src="./
|
|
254
|
+
<script type="module" src="./main_c588dd03.js"></script>
|
|
252
255
|
</body>
|
|
253
256
|
</html>
|
|
254
257
|
```
|
package/src/buildProject.js
CHANGED
|
@@ -19,13 +19,16 @@ import {
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Generate optimized version of source files into a directory
|
|
22
|
-
* @param {
|
|
23
|
-
* @param {string|url}
|
|
24
|
-
* @param {
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {
|
|
27
|
-
* @param {
|
|
22
|
+
* @param {Object} buildProjectParameters
|
|
23
|
+
* @param {string|url} buildProjectParameters.projectDirectoryUrl Root directory of the project
|
|
24
|
+
* @param {string|url} buildProjectParameters.buildDirectoryRelativeUrl Directory where optimized files are written
|
|
25
|
+
* @param {object} buildProjectParameters.entryPoints Describe entry point paths and control their names in the build directory
|
|
26
|
+
* @param {"esmodule" | "systemjs" | "commonjs" | "global"} buildProjectParameters.format Code generated will use this module format
|
|
27
|
+
* @param {object} buildProjectParameters.runtimeSupport Code generated will be compatible with these runtimes
|
|
28
|
+
* @param {boolean} [buildProjectParameters.minify=false] Minify file content in the build directory (HTML, CSS, JS, JSON, SVG)
|
|
29
|
+
* @return {Object} An object containing the result of building files
|
|
28
30
|
*/
|
|
31
|
+
|
|
29
32
|
export const buildProject = async ({
|
|
30
33
|
signal = new AbortController().signal,
|
|
31
34
|
handleSIGINT = true,
|
|
@@ -35,11 +38,7 @@ export const buildProject = async ({
|
|
|
35
38
|
|
|
36
39
|
projectDirectoryUrl,
|
|
37
40
|
entryPoints,
|
|
38
|
-
workers = [],
|
|
39
|
-
serviceWorkers = [],
|
|
40
41
|
serviceWorkerFinalizer,
|
|
41
|
-
classicWorkers = [],
|
|
42
|
-
classicServiceWorkers = [],
|
|
43
42
|
importMapInWebWorkers = false,
|
|
44
43
|
buildDirectoryRelativeUrl,
|
|
45
44
|
buildDirectoryClean = true,
|
|
@@ -50,8 +49,9 @@ export const buildProject = async ({
|
|
|
50
49
|
|
|
51
50
|
format,
|
|
52
51
|
systemJsUrl,
|
|
53
|
-
globalName,
|
|
54
52
|
globals = {},
|
|
53
|
+
preservedDynamicImports = {},
|
|
54
|
+
|
|
55
55
|
babelPluginMap = {},
|
|
56
56
|
customCompilers,
|
|
57
57
|
runtimeSupport = format === "global" ||
|
|
@@ -92,7 +92,6 @@ export const buildProject = async ({
|
|
|
92
92
|
// https://github.com/cssnano/cssnano/tree/master/packages/cssnano-preset-default
|
|
93
93
|
minifyCssOptions,
|
|
94
94
|
|
|
95
|
-
env = {},
|
|
96
95
|
protocol,
|
|
97
96
|
privateKey,
|
|
98
97
|
certificate,
|
|
@@ -181,11 +180,8 @@ export const buildProject = async ({
|
|
|
181
180
|
certificate,
|
|
182
181
|
ip,
|
|
183
182
|
port,
|
|
184
|
-
env,
|
|
185
183
|
|
|
186
184
|
babelPluginMap,
|
|
187
|
-
workers,
|
|
188
|
-
serviceWorkers,
|
|
189
185
|
runtimeSupport,
|
|
190
186
|
customCompilers,
|
|
191
187
|
preservedUrls: {
|
|
@@ -249,13 +245,9 @@ export const buildProject = async ({
|
|
|
249
245
|
|
|
250
246
|
format,
|
|
251
247
|
systemJsUrl,
|
|
252
|
-
globalName,
|
|
253
248
|
globals,
|
|
254
|
-
|
|
255
|
-
serviceWorkers,
|
|
249
|
+
preservedDynamicImports,
|
|
256
250
|
serviceWorkerFinalizer,
|
|
257
|
-
classicWorkers,
|
|
258
|
-
classicServiceWorkers,
|
|
259
251
|
|
|
260
252
|
node,
|
|
261
253
|
browser,
|
package/src/dev_server.js
CHANGED
|
@@ -22,6 +22,11 @@ import {
|
|
|
22
22
|
} from "./internal/jsenvInternalFiles.js"
|
|
23
23
|
import { jsenvExplorableConfig } from "./jsenvExplorableConfig.js"
|
|
24
24
|
|
|
25
|
+
const EXPLORING_HTML_URL = new URL(
|
|
26
|
+
"./src/internal/dev_server/exploring/exploring.html",
|
|
27
|
+
jsenvCoreDirectoryUrl,
|
|
28
|
+
).href
|
|
29
|
+
|
|
25
30
|
export const startDevServer = async ({
|
|
26
31
|
signal = new AbortController().signal,
|
|
27
32
|
handleSIGINT = true,
|
|
@@ -67,10 +72,7 @@ export const startDevServer = async ({
|
|
|
67
72
|
await assertProjectDirectoryExists({ projectDirectoryUrl })
|
|
68
73
|
if (mainFileRelativeUrl === undefined) {
|
|
69
74
|
mainFileRelativeUrl = urlToRelativeUrl(
|
|
70
|
-
|
|
71
|
-
"./src/internal/dev_server/exploring/exploring.html",
|
|
72
|
-
jsenvCoreDirectoryUrl,
|
|
73
|
-
).href,
|
|
75
|
+
EXPLORING_HTML_URL,
|
|
74
76
|
projectDirectoryUrl,
|
|
75
77
|
)
|
|
76
78
|
}
|
package/src/executeTestPlan.js
CHANGED
|
@@ -21,14 +21,19 @@ import { jsenvCoverageConfig } from "./jsenvCoverageConfig.js"
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Execute a list of files and log how it goes
|
|
24
|
-
* @param {
|
|
25
|
-
* @param {string|url} projectDirectoryUrl Root directory of the project
|
|
26
|
-
* @param {
|
|
27
|
-
* @param {
|
|
28
|
-
* @param {
|
|
29
|
-
* @param {
|
|
30
|
-
* @param {
|
|
31
|
-
* @param {boolean} [
|
|
24
|
+
* @param {Object} testPlanParameters
|
|
25
|
+
* @param {string|url} testPlanParameters.projectDirectoryUrl Root directory of the project
|
|
26
|
+
* @param {Object} testPlanParameters.testPlan Object associating patterns leading to files to runtimes where they should be executed
|
|
27
|
+
* @param {boolean} [testPlanParameters.completedExecutionLogAbbreviation=false] Abbreviate completed execution information to shorten terminal output
|
|
28
|
+
* @param {boolean} [testPlanParameters.completedExecutionLogMerging=false] Merge completed execution logs to shorten terminal output
|
|
29
|
+
* @param {number} [testPlanParameters.maxExecutionsInParallel=1] Maximum amount of execution in parallel
|
|
30
|
+
* @param {number} [testPlanParameters.defaultMsAllocatedPerExecution=30000] Milliseconds after which execution is aborted and considered as failed by timeout
|
|
31
|
+
* @param {boolean} [testPlanParameters.failFast=false] Fails immediatly when a test execution fails
|
|
32
|
+
* @param {number} [testPlanParameters.cooldownBetweenExecutions=0] Millisecond to wait between each execution
|
|
33
|
+
* @param {boolean} [testPlanParameters.logMemoryHeapUsage=false] Add memory heap usage during logs
|
|
34
|
+
* @param {boolean} [testPlanParameters.coverage=false] Controls if coverage is collected during files executions
|
|
35
|
+
* @param {boolean} [testPlanParameters.coverageV8ConflictWarning=true] Warn when coverage from 2 executions cannot be merged
|
|
36
|
+
* @return {Object} An object containing the result of all file executions
|
|
32
37
|
*/
|
|
33
38
|
export const executeTestPlan = async ({
|
|
34
39
|
signal = new AbortController().signal,
|
|
@@ -44,15 +49,17 @@ export const executeTestPlan = async ({
|
|
|
44
49
|
|
|
45
50
|
testPlan,
|
|
46
51
|
|
|
52
|
+
logSummary = true,
|
|
47
53
|
logMemoryHeapUsage = false,
|
|
54
|
+
logFileRelativeUrl = ".jsenv/test_plan_debug.txt",
|
|
48
55
|
completedExecutionLogAbbreviation = false,
|
|
49
56
|
completedExecutionLogMerging = false,
|
|
50
|
-
logSummary = true,
|
|
51
57
|
updateProcessExitCode = true,
|
|
52
58
|
windowsProcessExitFix = true,
|
|
53
59
|
|
|
54
60
|
maxExecutionsInParallel = 1,
|
|
55
61
|
defaultMsAllocatedPerExecution = 30000,
|
|
62
|
+
failFast = false,
|
|
56
63
|
// stopAfterExecute: true to ensure runtime is stopped once executed
|
|
57
64
|
// because we have what we wants: execution is completed and
|
|
58
65
|
// we have associated coverage and capturedConsole
|
|
@@ -99,14 +106,11 @@ export const executeTestPlan = async ({
|
|
|
99
106
|
jsenvDirectoryClean,
|
|
100
107
|
}) => {
|
|
101
108
|
const logger = createLogger({ logLevel })
|
|
102
|
-
|
|
103
109
|
projectDirectoryUrl = assertProjectDirectoryUrl({ projectDirectoryUrl })
|
|
104
110
|
await assertProjectDirectoryExists({ projectDirectoryUrl })
|
|
105
|
-
|
|
106
111
|
if (typeof testPlan !== "object") {
|
|
107
112
|
throw new Error(`testPlan must be an object, got ${testPlan}`)
|
|
108
113
|
}
|
|
109
|
-
|
|
110
114
|
if (coverage) {
|
|
111
115
|
if (typeof coverageConfig !== "object") {
|
|
112
116
|
throw new TypeError(
|
|
@@ -151,7 +155,6 @@ export const executeTestPlan = async ({
|
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
}
|
|
154
|
-
|
|
155
158
|
const result = await executePlan(testPlan, {
|
|
156
159
|
signal,
|
|
157
160
|
handleSIGINT,
|
|
@@ -167,13 +170,15 @@ export const executeTestPlan = async ({
|
|
|
167
170
|
importResolutionMethod,
|
|
168
171
|
importDefaultExtension,
|
|
169
172
|
|
|
173
|
+
logSummary,
|
|
170
174
|
logMemoryHeapUsage,
|
|
175
|
+
logFileRelativeUrl,
|
|
171
176
|
completedExecutionLogMerging,
|
|
172
177
|
completedExecutionLogAbbreviation,
|
|
173
|
-
logSummary,
|
|
174
178
|
|
|
175
|
-
defaultMsAllocatedPerExecution,
|
|
176
179
|
maxExecutionsInParallel,
|
|
180
|
+
defaultMsAllocatedPerExecution,
|
|
181
|
+
failFast,
|
|
177
182
|
stopAfterExecute,
|
|
178
183
|
cooldownBetweenExecutions,
|
|
179
184
|
gcBetweenExecutions,
|
|
@@ -201,11 +206,9 @@ export const executeTestPlan = async ({
|
|
|
201
206
|
importMapInWebWorkers,
|
|
202
207
|
customCompilers,
|
|
203
208
|
})
|
|
204
|
-
|
|
205
209
|
if (updateProcessExitCode && !executionIsPassed(result)) {
|
|
206
210
|
process.exitCode = 1
|
|
207
211
|
}
|
|
208
|
-
|
|
209
212
|
const planCoverage = result.planCoverage
|
|
210
213
|
// planCoverage can be null when execution is aborted
|
|
211
214
|
if (planCoverage) {
|
|
@@ -256,7 +259,6 @@ export const executeTestPlan = async ({
|
|
|
256
259
|
}
|
|
257
260
|
await Promise.all(promises)
|
|
258
261
|
}
|
|
259
|
-
|
|
260
262
|
// Sometimes on windows test plan scripts never ends
|
|
261
263
|
// I suspect it's some node process keeping the process alive
|
|
262
264
|
// because not properly killed for some reason.
|
|
@@ -267,7 +269,6 @@ export const executeTestPlan = async ({
|
|
|
267
269
|
process.exit()
|
|
268
270
|
}, 2000).unref()
|
|
269
271
|
}
|
|
270
|
-
|
|
271
272
|
return {
|
|
272
273
|
testPlanAborted: result.aborted,
|
|
273
274
|
testPlanSummary: result.planSummary,
|
|
@@ -33,13 +33,9 @@ export const buildUsingRollup = async ({
|
|
|
33
33
|
|
|
34
34
|
format,
|
|
35
35
|
systemJsUrl,
|
|
36
|
-
globalName,
|
|
37
36
|
globals,
|
|
38
|
-
|
|
39
|
-
serviceWorkers,
|
|
37
|
+
preservedDynamicImports,
|
|
40
38
|
serviceWorkerFinalizer,
|
|
41
|
-
classicWorkers,
|
|
42
|
-
classicServiceWorkers,
|
|
43
39
|
|
|
44
40
|
node,
|
|
45
41
|
browser,
|
|
@@ -79,6 +75,9 @@ export const buildUsingRollup = async ({
|
|
|
79
75
|
|
|
80
76
|
format,
|
|
81
77
|
systemJsUrl,
|
|
78
|
+
globals,
|
|
79
|
+
preservedDynamicImports,
|
|
80
|
+
|
|
82
81
|
urlMappings,
|
|
83
82
|
importResolutionMethod,
|
|
84
83
|
importMapFileRelativeUrl,
|
|
@@ -86,11 +85,7 @@ export const buildUsingRollup = async ({
|
|
|
86
85
|
externalImportSpecifiers,
|
|
87
86
|
importPaths,
|
|
88
87
|
preservedUrls,
|
|
89
|
-
workers,
|
|
90
|
-
serviceWorkers,
|
|
91
88
|
serviceWorkerFinalizer,
|
|
92
|
-
classicWorkers,
|
|
93
|
-
classicServiceWorkers,
|
|
94
89
|
|
|
95
90
|
node,
|
|
96
91
|
browser,
|
|
@@ -118,8 +113,6 @@ export const buildUsingRollup = async ({
|
|
|
118
113
|
rollupPlugins,
|
|
119
114
|
compileProfile,
|
|
120
115
|
format,
|
|
121
|
-
globals,
|
|
122
|
-
globalName,
|
|
123
116
|
sourcemapExcludeSources,
|
|
124
117
|
preserveEntrySignatures,
|
|
125
118
|
treeshake,
|
|
@@ -224,8 +217,6 @@ const useRollup = async ({
|
|
|
224
217
|
rollupPlugins,
|
|
225
218
|
compileProfile,
|
|
226
219
|
format,
|
|
227
|
-
globals,
|
|
228
|
-
globalName,
|
|
229
220
|
sourcemapExcludeSources,
|
|
230
221
|
preserveEntrySignatures,
|
|
231
222
|
treeshake,
|
|
@@ -316,12 +307,6 @@ const useRollup = async ({
|
|
|
316
307
|
sourcemap: true,
|
|
317
308
|
sourcemapExcludeSources,
|
|
318
309
|
// preserveModules: !jsConcatenation,
|
|
319
|
-
...(format === "global"
|
|
320
|
-
? {
|
|
321
|
-
globals,
|
|
322
|
-
name: globalName,
|
|
323
|
-
}
|
|
324
|
-
: {}),
|
|
325
310
|
}
|
|
326
311
|
|
|
327
312
|
buildOperation.throwIfAborted()
|
|
@@ -336,7 +321,7 @@ const useRollup = async ({
|
|
|
336
321
|
}
|
|
337
322
|
|
|
338
323
|
const formatToRollupFormat = (format) => {
|
|
339
|
-
if (format === "global") return "
|
|
324
|
+
if (format === "global") return "esm" // will be handled by rollup_plugin_iife
|
|
340
325
|
if (format === "commonjs") return "cjs"
|
|
341
326
|
if (format === "systemjs") return "system"
|
|
342
327
|
if (format === "esmodule") return "esm"
|
|
@@ -61,37 +61,17 @@ const formatBuildDoneDetails = ({ buildStats, buildDirectoryRelativeUrl }) => {
|
|
|
61
61
|
)})`
|
|
62
62
|
})
|
|
63
63
|
const buildFileCount = buildFiles.length
|
|
64
|
-
|
|
65
64
|
const { buildSourcemapFileSizes } = buildStats
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
)
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const buildFilesDescription =
|
|
75
|
-
buildFileCount === 1
|
|
76
|
-
? "file in the build: 1"
|
|
77
|
-
: `files in the build: ${buildFileCount}`
|
|
78
|
-
|
|
79
|
-
const buildSourcemapFilesDescription =
|
|
80
|
-
sourcemapFileCount === 0
|
|
81
|
-
? ""
|
|
82
|
-
: sourcemapFileCount === 1
|
|
83
|
-
? "sourcemap file in the build: 1"
|
|
84
|
-
: `sourcemap files in the build: ${sourcemapFileCount}`
|
|
85
|
-
|
|
65
|
+
const sourcemapFileCount = Object.keys(buildSourcemapFileSizes).length
|
|
66
|
+
let buildFilesDescription =
|
|
67
|
+
buildFileCount === 1 ? "build file" : `build files`
|
|
68
|
+
if (sourcemapFileCount === 1) {
|
|
69
|
+
buildFilesDescription += ` (excluding sourcemap file)`
|
|
70
|
+
} else if (sourcemapFileCount > 1) {
|
|
71
|
+
buildFilesDescription += ` (excluding sourcemap files)`
|
|
72
|
+
}
|
|
86
73
|
let message = `--- ${buildFilesDescription} ---
|
|
87
74
|
${buildFiles.join("\n")}`
|
|
88
|
-
|
|
89
|
-
if (buildSourcemapFilesDescription) {
|
|
90
|
-
message += `
|
|
91
|
-
--- ${buildSourcemapFilesDescription} ---
|
|
92
|
-
${sourcemapFiles.join("\n")}`
|
|
93
|
-
}
|
|
94
|
-
|
|
95
75
|
return message
|
|
96
76
|
}
|
|
97
77
|
|
|
@@ -101,24 +81,40 @@ const formatBuildSummary = ({ buildStats }) => {
|
|
|
101
81
|
projectFileSizes,
|
|
102
82
|
projectTotalFileSize,
|
|
103
83
|
buildFileSizes,
|
|
104
|
-
|
|
84
|
+
buildFileTotalSize,
|
|
85
|
+
buildSourcemapFileSizes,
|
|
86
|
+
buildSourcemapFileTotalSize,
|
|
105
87
|
} = buildStats
|
|
106
88
|
|
|
107
89
|
const projectFileCount = Object.keys(projectFileSizes).length
|
|
108
90
|
const buildFileCount = Object.keys(buildFileSizes).length
|
|
91
|
+
const buildSourcemapFileCount = Object.keys(buildSourcemapFileSizes).length
|
|
109
92
|
|
|
110
93
|
return `------- build summary -------
|
|
111
|
-
${
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
)}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
94
|
+
${formatSummaryContent({
|
|
95
|
+
"project files": `${projectFileCount} (${byteAsFileSize(
|
|
96
|
+
projectTotalFileSize,
|
|
97
|
+
)})`,
|
|
98
|
+
"build files": `${buildFileCount} (${byteAsFileSize(buildFileTotalSize)})`,
|
|
99
|
+
...(buildSourcemapFileCount === 0
|
|
100
|
+
? {}
|
|
101
|
+
: {
|
|
102
|
+
"build sourcemap files": `${buildSourcemapFileCount} (${byteAsFileSize(
|
|
103
|
+
buildSourcemapFileTotalSize,
|
|
104
|
+
)})`,
|
|
105
|
+
}),
|
|
106
|
+
"build duration": msAsDuration(buildDuration),
|
|
107
|
+
})}
|
|
119
108
|
------------------------------`
|
|
120
109
|
}
|
|
121
110
|
|
|
111
|
+
const formatSummaryContent = (summaryData) => {
|
|
112
|
+
return Object.keys(summaryData).map((key) => {
|
|
113
|
+
return `${ANSI.color(`${key}:`, ANSI.GREY)} ${summaryData[key]}`
|
|
114
|
+
}).join(`
|
|
115
|
+
`)
|
|
116
|
+
}
|
|
117
|
+
|
|
122
118
|
const showHtmlSourceLocation = ({
|
|
123
119
|
htmlNode,
|
|
124
120
|
htmlUrl,
|
|
@@ -19,8 +19,9 @@ export const createBuildStats = ({
|
|
|
19
19
|
projectFileSizes: projectFileSizeInfo.fileSizes,
|
|
20
20
|
projectTotalFileSize: projectFileSizeInfo.totalSize,
|
|
21
21
|
buildFileSizes: buildFileSizeInfo.fileSizes,
|
|
22
|
-
|
|
22
|
+
buildFileTotalSize: buildFileSizeInfo.totalSize,
|
|
23
23
|
buildSourcemapFileSizes: sourcemapFileSizeInfo.fileSizes,
|
|
24
|
+
buildSourcemapFileTotalSize: sourcemapFileSizeInfo.totalSize,
|
|
24
25
|
buildDuration,
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const esToSystem = async ({ code, url, map }) => {
|
|
2
|
+
const { rollup } = await import("rollup")
|
|
3
|
+
const rollupBuild = await rollup({
|
|
4
|
+
input: url,
|
|
5
|
+
plugins: [
|
|
6
|
+
{
|
|
7
|
+
name: "es-to-system",
|
|
8
|
+
resolveId: (id) => {
|
|
9
|
+
if (id === url) {
|
|
10
|
+
return id
|
|
11
|
+
}
|
|
12
|
+
return { external: true }
|
|
13
|
+
},
|
|
14
|
+
load: (id) => {
|
|
15
|
+
if (id === url) {
|
|
16
|
+
return code
|
|
17
|
+
}
|
|
18
|
+
return null
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
})
|
|
23
|
+
const { output } = await rollupBuild.generate({
|
|
24
|
+
format: "system",
|
|
25
|
+
sourcemap: true,
|
|
26
|
+
})
|
|
27
|
+
const firstChunk = output[0]
|
|
28
|
+
code = firstChunk.code
|
|
29
|
+
map = firstChunk.map
|
|
30
|
+
return {
|
|
31
|
+
code,
|
|
32
|
+
map,
|
|
33
|
+
}
|
|
34
|
+
}
|