@jsenv/core 23.2.2 → 23.3.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/{license → LICENSE} +0 -0
- package/package.json +13 -14
- package/src/buildProject.js +12 -13
- package/src/execute.js +92 -93
- package/src/internal/browser-launcher/executeHtmlFile.js +6 -7
- package/src/internal/building/buildUsingRollup.js +3 -4
- package/src/internal/building/build_logs.js +7 -6
- package/src/internal/building/createJsenvRollupPlugin.js +9 -14
- package/src/internal/building/url_trace.js +3 -4
- package/src/internal/compiling/createCompiledFileService.js +8 -5
- package/src/internal/compiling/startCompileServer.js +55 -46
- package/src/internal/executing/coverage/relativeUrlToEmptyCoverage.js +2 -3
- package/src/internal/executing/createSummaryLog.js +12 -14
- package/src/internal/executing/executeConcurrently.js +7 -5
- package/src/internal/executing/executePlan.js +80 -80
- package/src/internal/executing/executionLogs.js +14 -18
- package/src/internal/executing/execution_colors.js +6 -12
- package/src/internal/executing/launchAndExecute.js +125 -145
- package/src/internal/node-launcher/createControllableNodeProcess.js +26 -23
- package/src/launchBrowser.js +64 -61
- package/src/launchNode.js +6 -6
- package/src/startExploring.js +2 -17
- package/src/abort/abortable.js +0 -172
- package/src/abort/callback_list.js +0 -64
- package/src/abort/callback_race.js +0 -34
- package/src/abort/cleaner.js +0 -22
- package/src/abort/main.js +0 -32
- package/src/abort/process_teardown_events.js +0 -59
- package/src/internal/createCallbackList.js +0 -21
- package/src/internal/executing/logUtils.js +0 -30
- package/src/internal/executing/writeLog.js +0 -106
- package/src/internal/executing/writeLog.test-manual.js +0 -62
- package/src/internal/logs/log_style.js +0 -40
- package/src/signal/signal.js +0 -65
package/{license → LICENSE}
RENAMED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.3.0",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"node": ">=14.9.0"
|
|
12
12
|
},
|
|
13
13
|
"publishConfig": {
|
|
14
|
-
"access": "public"
|
|
14
|
+
"access": "public",
|
|
15
|
+
"registry": "https://registry.npmjs.org"
|
|
15
16
|
},
|
|
16
17
|
"type": "module",
|
|
17
18
|
"exports": {
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"postpublish": "node ./script/publish/restore_postinstall.mjs"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
|
-
"@babel/core": "7.
|
|
55
|
+
"@babel/core": "7.16.0",
|
|
55
56
|
"@babel/helper-module-imports": "7.15.4",
|
|
56
57
|
"@babel/helpers": "7.15.4",
|
|
57
58
|
"@babel/parser": "7.15.8",
|
|
@@ -62,11 +63,12 @@
|
|
|
62
63
|
"@babel/plugin-syntax-numeric-separator": "7.10.4",
|
|
63
64
|
"@babel/plugin-transform-modules-systemjs": "7.15.4",
|
|
64
65
|
"@c88/v8-coverage": "0.1.1",
|
|
65
|
-
"@jsenv/abort": "
|
|
66
|
-
"@jsenv/filesystem": "2.
|
|
66
|
+
"@jsenv/abort": "4.0.0",
|
|
67
|
+
"@jsenv/filesystem": "2.5.0",
|
|
67
68
|
"@jsenv/importmap": "1.1.0",
|
|
69
|
+
"@jsenv/log": "1.1.0",
|
|
68
70
|
"@jsenv/logger": "4.0.1",
|
|
69
|
-
"@jsenv/server": "
|
|
71
|
+
"@jsenv/server": "10.0.0",
|
|
70
72
|
"@jsenv/uneval": "1.6.0",
|
|
71
73
|
"@jsenv/workers": "1.2.0",
|
|
72
74
|
"@rollup/plugin-commonjs": "21.0.0",
|
|
@@ -78,13 +80,12 @@
|
|
|
78
80
|
"bytes": "3.1.0",
|
|
79
81
|
"cjs-module-lexer": "1.2.2",
|
|
80
82
|
"construct-style-sheets-polyfill": "3.0.4",
|
|
81
|
-
"cssnano": "5.0.
|
|
82
|
-
"cssnano-preset-default": "5.1.
|
|
83
|
+
"cssnano": "5.0.9",
|
|
84
|
+
"cssnano-preset-default": "5.1.5",
|
|
83
85
|
"cuid": "2.1.8",
|
|
84
86
|
"estree-walker": "3.0.0",
|
|
85
87
|
"html-minifier": "4.0.0",
|
|
86
88
|
"humanize-duration": "3.27.0",
|
|
87
|
-
"is-unicode-supported": "1.1.0",
|
|
88
89
|
"is-valid-identifier": "2.0.2",
|
|
89
90
|
"istanbul-lib-coverage": "3.0.2",
|
|
90
91
|
"istanbul-lib-instrument": "5.0.3",
|
|
@@ -104,8 +105,6 @@
|
|
|
104
105
|
"rollup-plugin-node-globals": "1.4.0",
|
|
105
106
|
"rollup-plugin-polyfill-node": "0.7.0",
|
|
106
107
|
"source-map": "0.7.3",
|
|
107
|
-
"string-width": "5.0.1",
|
|
108
|
-
"supports-color": "9.0.2",
|
|
109
108
|
"systemjs": "6.11.0",
|
|
110
109
|
"terser": "5.9.0",
|
|
111
110
|
"v8-to-istanbul": "8.1.0",
|
|
@@ -113,7 +112,7 @@
|
|
|
113
112
|
"wrap-ansi": "8.0.1"
|
|
114
113
|
},
|
|
115
114
|
"devDependencies": {
|
|
116
|
-
"@babel/eslint-parser": "7.
|
|
115
|
+
"@babel/eslint-parser": "7.16.0",
|
|
117
116
|
"@babel/plugin-syntax-jsx": "7.14.5",
|
|
118
117
|
"@babel/plugin-transform-block-scoping": "7.15.3",
|
|
119
118
|
"@babel/plugin-transform-react-jsx": "7.14.9",
|
|
@@ -127,7 +126,7 @@
|
|
|
127
126
|
"@jsenv/importmap-eslint-resolver": "5.1.2",
|
|
128
127
|
"@jsenv/importmap-node-module": "2.4.1",
|
|
129
128
|
"@jsenv/package-publish": "1.6.2",
|
|
130
|
-
"@jsenv/performance-impact": "2.2.
|
|
129
|
+
"@jsenv/performance-impact": "2.2.1",
|
|
131
130
|
"@jsenv/prettier-check-project": "5.6.1",
|
|
132
131
|
"@jsenv/pwa": "4.0.0",
|
|
133
132
|
"babel-plugin-transform-async-to-promises": "0.8.15",
|
|
@@ -140,7 +139,7 @@
|
|
|
140
139
|
"prettier": "2.4.1",
|
|
141
140
|
"react": "17.0.2",
|
|
142
141
|
"react-dom": "17.0.2",
|
|
143
|
-
"redux": "4.1.
|
|
142
|
+
"redux": "4.1.2",
|
|
144
143
|
"rollup-plugin-import-assert": "1.1.1"
|
|
145
144
|
}
|
|
146
145
|
}
|
package/src/buildProject.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { createLogger, createDetailedMessage } from "@jsenv/logger"
|
|
2
2
|
import { resolveDirectoryUrl } from "@jsenv/filesystem"
|
|
3
|
+
import { Abort, raceProcessTeardownEvents } from "@jsenv/abort"
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
-
Abortable,
|
|
6
|
-
raceProcessTeardownEvents,
|
|
7
|
-
} from "@jsenv/core/src/abort/main.js"
|
|
8
5
|
import { COMPILE_ID_BEST } from "./internal/CONSTANTS.js"
|
|
9
6
|
import {
|
|
10
7
|
assertProjectDirectoryUrl,
|
|
@@ -136,16 +133,18 @@ export const buildProject = async ({
|
|
|
136
133
|
projectDirectoryUrl,
|
|
137
134
|
})
|
|
138
135
|
|
|
139
|
-
const buildOperation =
|
|
136
|
+
const buildOperation = Abort.startOperation()
|
|
137
|
+
buildOperation.addAbortSignal(signal)
|
|
138
|
+
|
|
140
139
|
if (handleSIGINT) {
|
|
141
|
-
|
|
142
|
-
raceProcessTeardownEvents(
|
|
140
|
+
buildOperation.addAbortSource((abort) => {
|
|
141
|
+
return raceProcessTeardownEvents(
|
|
143
142
|
{
|
|
144
143
|
SIGINT: true,
|
|
145
144
|
},
|
|
146
|
-
|
|
147
|
-
)
|
|
148
|
-
)
|
|
145
|
+
abort,
|
|
146
|
+
)
|
|
147
|
+
})
|
|
149
148
|
}
|
|
150
149
|
|
|
151
150
|
const compileServer = await startCompileServer({
|
|
@@ -183,7 +182,7 @@ export const buildProject = async ({
|
|
|
183
182
|
transformHtmlSourceFiles: false,
|
|
184
183
|
})
|
|
185
184
|
|
|
186
|
-
buildOperation.
|
|
185
|
+
buildOperation.addEndCallback(async () => {
|
|
187
186
|
await compileServer.stop(`build cleanup`)
|
|
188
187
|
})
|
|
189
188
|
|
|
@@ -239,13 +238,13 @@ export const buildProject = async ({
|
|
|
239
238
|
|
|
240
239
|
return result
|
|
241
240
|
} catch (e) {
|
|
242
|
-
if (
|
|
241
|
+
if (Abort.isAbortError(e)) {
|
|
243
242
|
logger.info("build aborted")
|
|
244
243
|
return null
|
|
245
244
|
}
|
|
246
245
|
throw e
|
|
247
246
|
} finally {
|
|
248
|
-
await buildOperation.
|
|
247
|
+
await buildOperation.end()
|
|
249
248
|
}
|
|
250
249
|
}
|
|
251
250
|
|
package/src/execute.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
raceProcessTeardownEvents,
|
|
4
|
-
} from "@jsenv/core/src/abort/main.js"
|
|
1
|
+
import { Abort, raceProcessTeardownEvents } from "@jsenv/abort"
|
|
2
|
+
|
|
5
3
|
import { normalizeRuntimeSupport } from "@jsenv/core/src/internal/generateGroupMap/runtime_support.js"
|
|
6
4
|
import {
|
|
7
5
|
assertProjectDirectoryUrl,
|
|
@@ -58,7 +56,7 @@ export const execute = async ({
|
|
|
58
56
|
runtimeStartedCallback,
|
|
59
57
|
runtimeStoppedCallback,
|
|
60
58
|
runtimeErrorAfterExecutionCallback,
|
|
61
|
-
runtimeDisconnectCallback
|
|
59
|
+
runtimeDisconnectCallback,
|
|
62
60
|
}) => {
|
|
63
61
|
projectDirectoryUrl = assertProjectDirectoryUrl({ projectDirectoryUrl })
|
|
64
62
|
await assertProjectDirectoryExists({ projectDirectoryUrl })
|
|
@@ -79,101 +77,99 @@ export const execute = async ({
|
|
|
79
77
|
)
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
const executeOperation =
|
|
80
|
+
const executeOperation = Abort.startOperation()
|
|
81
|
+
executeOperation.addAbortSignal(signal)
|
|
83
82
|
if (handleSIGINT) {
|
|
84
|
-
|
|
85
|
-
raceProcessTeardownEvents(
|
|
83
|
+
executeOperation.addAbortSource((abort) => {
|
|
84
|
+
return raceProcessTeardownEvents(
|
|
86
85
|
{
|
|
87
86
|
SIGINT: true,
|
|
88
87
|
},
|
|
89
|
-
|
|
90
|
-
)
|
|
91
|
-
)
|
|
88
|
+
abort,
|
|
89
|
+
)
|
|
90
|
+
})
|
|
92
91
|
}
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
origin: compileServerOrigin,
|
|
97
|
-
stop,
|
|
98
|
-
} = await startCompileServer({
|
|
99
|
-
signal: executeOperation.signal,
|
|
100
|
-
compileServerLogLevel,
|
|
101
|
-
|
|
102
|
-
projectDirectoryUrl,
|
|
103
|
-
jsenvDirectoryRelativeUrl,
|
|
104
|
-
jsenvDirectoryClean,
|
|
105
|
-
outDirectoryName: "out-dev",
|
|
106
|
-
|
|
107
|
-
importDefaultExtension,
|
|
108
|
-
|
|
109
|
-
compileServerProtocol,
|
|
110
|
-
compileServerPrivateKey,
|
|
111
|
-
compileServerCertificate,
|
|
112
|
-
compileServerIp,
|
|
113
|
-
compileServerPort,
|
|
114
|
-
babelPluginMap,
|
|
115
|
-
customCompilers,
|
|
116
|
-
runtimeSupport: normalizeRuntimeSupport({
|
|
117
|
-
[runtime.name]: runtime.version,
|
|
118
|
-
}),
|
|
119
|
-
compileServerCanReadFromFilesystem,
|
|
120
|
-
compileServerCanWriteOnFilesystem,
|
|
121
|
-
})
|
|
122
|
-
executeOperation.cleaner.addCallback(() => {
|
|
123
|
-
return stop()
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
const result = await launchAndExecute({
|
|
127
|
-
signal: executeOperation.signal,
|
|
128
|
-
launchAndExecuteLogLevel,
|
|
129
|
-
|
|
130
|
-
runtime,
|
|
131
|
-
runtimeParams: {
|
|
132
|
-
projectDirectoryUrl,
|
|
133
|
-
compileServerOrigin,
|
|
93
|
+
try {
|
|
94
|
+
const {
|
|
134
95
|
outDirectoryRelativeUrl,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
},
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
if (collectCompileServerInfo) {
|
|
168
|
-
result.outDirectoryRelativeUrl = outDirectoryRelativeUrl
|
|
169
|
-
result.compileServerOrigin = compileServerOrigin
|
|
170
|
-
}
|
|
96
|
+
origin: compileServerOrigin,
|
|
97
|
+
stop,
|
|
98
|
+
} = await startCompileServer({
|
|
99
|
+
signal: executeOperation.signal,
|
|
100
|
+
compileServerLogLevel,
|
|
101
|
+
|
|
102
|
+
projectDirectoryUrl,
|
|
103
|
+
jsenvDirectoryRelativeUrl,
|
|
104
|
+
jsenvDirectoryClean,
|
|
105
|
+
outDirectoryName: "out-dev",
|
|
106
|
+
|
|
107
|
+
importDefaultExtension,
|
|
108
|
+
|
|
109
|
+
compileServerProtocol,
|
|
110
|
+
compileServerPrivateKey,
|
|
111
|
+
compileServerCertificate,
|
|
112
|
+
compileServerIp,
|
|
113
|
+
compileServerPort,
|
|
114
|
+
babelPluginMap,
|
|
115
|
+
customCompilers,
|
|
116
|
+
runtimeSupport: normalizeRuntimeSupport({
|
|
117
|
+
[runtime.name]: runtime.version,
|
|
118
|
+
}),
|
|
119
|
+
compileServerCanReadFromFilesystem,
|
|
120
|
+
compileServerCanWriteOnFilesystem,
|
|
121
|
+
})
|
|
122
|
+
executeOperation.addEndCallback(async () => {
|
|
123
|
+
await stop("execution done")
|
|
124
|
+
})
|
|
171
125
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
126
|
+
const result = await launchAndExecute({
|
|
127
|
+
signal: executeOperation.signal,
|
|
128
|
+
launchAndExecuteLogLevel,
|
|
129
|
+
|
|
130
|
+
runtime,
|
|
131
|
+
runtimeParams: {
|
|
132
|
+
projectDirectoryUrl,
|
|
133
|
+
compileServerOrigin,
|
|
134
|
+
outDirectoryRelativeUrl,
|
|
135
|
+
...runtimeParams,
|
|
136
|
+
},
|
|
137
|
+
executeParams: {
|
|
138
|
+
fileRelativeUrl,
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
allocatedMs,
|
|
142
|
+
measureDuration,
|
|
143
|
+
mirrorConsole,
|
|
144
|
+
captureConsole,
|
|
145
|
+
collectRuntimeName,
|
|
146
|
+
collectRuntimeVersion,
|
|
147
|
+
inheritCoverage,
|
|
148
|
+
collectCoverage,
|
|
149
|
+
measurePerformance,
|
|
150
|
+
collectPerformance,
|
|
151
|
+
|
|
152
|
+
stopAfterExecute,
|
|
153
|
+
stopAfterExecuteReason,
|
|
154
|
+
gracefulStopAllocatedMs,
|
|
155
|
+
|
|
156
|
+
runtimeConsoleCallback,
|
|
157
|
+
runtimeStartedCallback,
|
|
158
|
+
runtimeStoppedCallback,
|
|
159
|
+
runtimeErrorAfterExecutionCallback,
|
|
160
|
+
runtimeDisconnectCallback,
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
if (collectCompileServerInfo) {
|
|
164
|
+
result.outDirectoryRelativeUrl = outDirectoryRelativeUrl
|
|
165
|
+
result.compileServerOrigin = compileServerOrigin
|
|
175
166
|
}
|
|
176
|
-
|
|
167
|
+
|
|
168
|
+
if (result.status === "errored") {
|
|
169
|
+
if (ignoreError) {
|
|
170
|
+
return result
|
|
171
|
+
}
|
|
172
|
+
/*
|
|
177
173
|
Warning: when node launched with --unhandled-rejections=strict, despites
|
|
178
174
|
this promise being rejected by throw result.error node will compltely ignore it.
|
|
179
175
|
|
|
@@ -185,7 +181,10 @@ export const execute = async ({
|
|
|
185
181
|
```
|
|
186
182
|
But it feels like a hack.
|
|
187
183
|
*/
|
|
188
|
-
|
|
184
|
+
throw result.error
|
|
185
|
+
}
|
|
186
|
+
return result
|
|
187
|
+
} finally {
|
|
188
|
+
await executeOperation.end()
|
|
189
189
|
}
|
|
190
|
-
return result
|
|
191
190
|
}
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
urlToExtension,
|
|
6
6
|
} from "@jsenv/filesystem"
|
|
7
7
|
|
|
8
|
-
import { Abortable } from "@jsenv/core/src/abort/main.js"
|
|
9
8
|
import { jsenvCompileProxyHtmlFileInfo } from "@jsenv/core/src/internal/jsenvInternalFiles.js"
|
|
10
9
|
import { v8CoverageFromAllV8Coverages } from "@jsenv/core/src/internal/executing/coverage/v8CoverageFromAllV8Coverages.js"
|
|
11
10
|
import { composeIstanbulCoverages } from "@jsenv/core/src/internal/executing/coverage/composeIstanbulCoverages.js"
|
|
@@ -15,7 +14,7 @@ import { escapeRegexpSpecialCharacters } from "../escapeRegexpSpecialCharacters.
|
|
|
15
14
|
export const executeHtmlFile = async (
|
|
16
15
|
fileRelativeUrl,
|
|
17
16
|
{
|
|
18
|
-
|
|
17
|
+
executeOperation,
|
|
19
18
|
projectDirectoryUrl,
|
|
20
19
|
compileServerOrigin,
|
|
21
20
|
outDirectoryRelativeUrl,
|
|
@@ -47,13 +46,13 @@ export const executeHtmlFile = async (
|
|
|
47
46
|
compileProxyProjectRelativeUrl,
|
|
48
47
|
compileServerOrigin,
|
|
49
48
|
)
|
|
50
|
-
|
|
49
|
+
executeOperation.throwIfAborted()
|
|
51
50
|
await page.goto(compileProxyClientUrl)
|
|
52
51
|
|
|
53
52
|
const coverageHandledFromOutside =
|
|
54
53
|
coveragePlaywrightAPIAvailable && !coverageForceIstanbul
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
executeOperation.throwIfAborted()
|
|
57
56
|
const browserRuntimeFeaturesReport = await page.evaluate(
|
|
58
57
|
/* istanbul ignore next */
|
|
59
58
|
({ coverageHandledFromOutside }) => {
|
|
@@ -69,7 +68,7 @@ export const executeHtmlFile = async (
|
|
|
69
68
|
try {
|
|
70
69
|
let executionResult
|
|
71
70
|
const { canAvoidCompilation, compileId } = browserRuntimeFeaturesReport
|
|
72
|
-
|
|
71
|
+
executeOperation.throwIfAborted()
|
|
73
72
|
if (canAvoidCompilation) {
|
|
74
73
|
executionResult = await executeSource({
|
|
75
74
|
projectDirectoryUrl,
|
|
@@ -125,8 +124,8 @@ export const executeHtmlFile = async (
|
|
|
125
124
|
// if browser is closed due to abort
|
|
126
125
|
// before it is able to finish evaluate we can safely ignore
|
|
127
126
|
// and rethrow with current abort error
|
|
128
|
-
if (
|
|
129
|
-
|
|
127
|
+
if (executeOperation.signal.aborted && isBrowserClosedError(error)) {
|
|
128
|
+
executeOperation.throwIfAborted()
|
|
130
129
|
}
|
|
131
130
|
throw error
|
|
132
131
|
}
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
} from "@jsenv/filesystem"
|
|
9
9
|
import { createDetailedMessage } from "@jsenv/logger"
|
|
10
10
|
|
|
11
|
-
import { Abortable } from "@jsenv/core/src/abort/main.js"
|
|
12
11
|
import { buildServiceWorker } from "@jsenv/core/src/internal/building/buildServiceWorker.js"
|
|
13
12
|
import { humanizeUrl } from "@jsenv/core/src/internal/building/url_trace.js"
|
|
14
13
|
import {
|
|
@@ -272,7 +271,7 @@ const useRollup = async ({
|
|
|
272
271
|
buildDirectoryUrl,
|
|
273
272
|
asOriginalUrl,
|
|
274
273
|
}) => {
|
|
275
|
-
|
|
274
|
+
buildOperation.throwIfAborted()
|
|
276
275
|
const { rollup } = await import("rollup")
|
|
277
276
|
const { importAssertions } = await import("acorn-import-assertions")
|
|
278
277
|
|
|
@@ -350,10 +349,10 @@ const useRollup = async ({
|
|
|
350
349
|
: {}),
|
|
351
350
|
}
|
|
352
351
|
|
|
353
|
-
|
|
352
|
+
buildOperation.throwIfAborted()
|
|
354
353
|
const rollupReturnValue = await rollup(rollupInputOptions)
|
|
355
354
|
|
|
356
|
-
|
|
355
|
+
buildOperation.throwIfAborted()
|
|
357
356
|
const rollupOutputArray = await rollupReturnValue.generate(
|
|
358
357
|
rollupOutputOptions,
|
|
359
358
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ANSI, UNICODE } from "@jsenv/log"
|
|
2
|
+
|
|
1
3
|
import { getHtmlNodeLocation } from "@jsenv/core/src/internal/compiling/compileHtml.js"
|
|
2
|
-
import { setANSIColor, ANSI_GREY, okSign } from "../logs/log_style.js"
|
|
3
4
|
import { byteAsFileSize } from "../logs/byteAsFileSize.js"
|
|
4
5
|
import { msAsDuration } from "../logs/msAsDuration.js"
|
|
5
6
|
import { stringifyUrlSite } from "./url_trace.js"
|
|
@@ -47,7 +48,7 @@ export const formatBuildDoneInfo = ({
|
|
|
47
48
|
}) => {
|
|
48
49
|
return `${formatBuildDoneDetails({ buildStats, buildDirectoryRelativeUrl })}
|
|
49
50
|
${formatBuildSummary({ buildStats })}
|
|
50
|
-
${
|
|
51
|
+
${UNICODE.OK} build end
|
|
51
52
|
`
|
|
52
53
|
}
|
|
53
54
|
|
|
@@ -107,14 +108,14 @@ const formatBuildSummary = ({ buildStats }) => {
|
|
|
107
108
|
const buildFileCount = Object.keys(buildFileSizes).length
|
|
108
109
|
|
|
109
110
|
return `------- build summary -------
|
|
110
|
-
${
|
|
111
|
+
${ANSI.color(
|
|
111
112
|
`project files:`,
|
|
112
|
-
|
|
113
|
+
ANSI.GREY,
|
|
113
114
|
)} ${projectFileCount} (${byteAsFileSize(projectTotalFileSize)})
|
|
114
|
-
${
|
|
115
|
+
${ANSI.color(`build files:`, ANSI.GREY)} ${buildFileCount} (${byteAsFileSize(
|
|
115
116
|
buildTotalFileSize,
|
|
116
117
|
)})
|
|
117
|
-
${
|
|
118
|
+
${ANSI.color(`build duration:`, ANSI.GREY)} ${msAsDuration(buildDuration)}
|
|
118
119
|
------------------------------`
|
|
119
120
|
}
|
|
120
121
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable import/max-dependencies */
|
|
2
1
|
import { extname } from "node:path"
|
|
3
2
|
import { normalizeImportMap } from "@jsenv/importmap"
|
|
4
3
|
import { isSpecifierForNodeCoreModule } from "@jsenv/importmap/src/isSpecifierForNodeCoreModule.js"
|
|
@@ -15,15 +14,14 @@ import {
|
|
|
15
14
|
urlToMeta,
|
|
16
15
|
} from "@jsenv/filesystem"
|
|
17
16
|
import { createWorkersForJavaScriptModules } from "@jsenv/workers"
|
|
17
|
+
import { UNICODE } from "@jsenv/log"
|
|
18
18
|
|
|
19
|
-
import { Abortable } from "@jsenv/core/src/abort/main.js"
|
|
20
19
|
import { createUrlConverter } from "@jsenv/core/src/internal/url_conversion.js"
|
|
21
20
|
import { createUrlFetcher } from "@jsenv/core/src/internal/building/url_fetcher.js"
|
|
22
21
|
import { createUrlLoader } from "@jsenv/core/src/internal/building/url_loader.js"
|
|
23
22
|
import { stringifyUrlTrace } from "@jsenv/core/src/internal/building/url_trace.js"
|
|
24
23
|
import { sortObjectByPathnames } from "@jsenv/core/src/internal/building/sortObjectByPathnames.js"
|
|
25
24
|
import { jsenvHelpersDirectoryInfo } from "@jsenv/core/src/internal/jsenvInternalFiles.js"
|
|
26
|
-
import { infoSign } from "@jsenv/core/src/internal/logs/log_style.js"
|
|
27
25
|
import { setUrlSearchParamsDescriptor } from "@jsenv/core/src/internal/url_utils.js"
|
|
28
26
|
|
|
29
27
|
import {
|
|
@@ -753,16 +751,13 @@ export const createJsenvRollupPlugin = async ({
|
|
|
753
751
|
|
|
754
752
|
let url = asServerUrl(rollupUrl)
|
|
755
753
|
|
|
756
|
-
const loadResult = await
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
})
|
|
764
|
-
},
|
|
765
|
-
)
|
|
754
|
+
const loadResult = await buildOperation.withSignal((signal) => {
|
|
755
|
+
return urlLoader.loadUrl(rollupUrl, {
|
|
756
|
+
signal,
|
|
757
|
+
logger,
|
|
758
|
+
ressourceBuilder,
|
|
759
|
+
})
|
|
760
|
+
})
|
|
766
761
|
|
|
767
762
|
url = loadResult.url
|
|
768
763
|
const code = loadResult.code
|
|
@@ -1368,7 +1363,7 @@ const prepareEntryPoints = async (
|
|
|
1368
1363
|
buildDirectoryUrl,
|
|
1369
1364
|
)
|
|
1370
1365
|
|
|
1371
|
-
logger.debug(`${
|
|
1366
|
+
logger.debug(`${UNICODE.INFO} load entry point ${entryProjectRelativeUrl}`)
|
|
1372
1367
|
|
|
1373
1368
|
const entryServerUrl = resolveUrl(
|
|
1374
1369
|
entryProjectRelativeUrl,
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
// https://github.com/babel/babel/blob/eea156b2cb8deecfcf82d52aa1b71ba4995c7d68/packages/babel-code-frame/src/index.js#L1
|
|
5
5
|
|
|
6
6
|
import { urlToFileSystemPath } from "@jsenv/filesystem"
|
|
7
|
-
|
|
8
|
-
import { setANSIColor, ANSI_GREY, ANSI_RED } from "../logs/log_style.js"
|
|
7
|
+
import { ANSI } from "@jsenv/log"
|
|
9
8
|
|
|
10
9
|
export const stringifyUrlTrace = (trace) => {
|
|
11
10
|
let string = ""
|
|
@@ -89,8 +88,8 @@ export const showSourceLocation = ({
|
|
|
89
88
|
let mark = (string) => string
|
|
90
89
|
let aside = (string) => string
|
|
91
90
|
if (color) {
|
|
92
|
-
mark = (string) =>
|
|
93
|
-
aside = (string) =>
|
|
91
|
+
mark = (string) => ANSI.color(string, ANSI.RED)
|
|
92
|
+
aside = (string) => ANSI.color(string, ANSI.GREY)
|
|
94
93
|
}
|
|
95
94
|
|
|
96
95
|
const lines = source.split(/\r?\n/)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { nextService, fetchFileSystem } from "@jsenv/server"
|
|
2
2
|
import {
|
|
3
3
|
resolveUrl,
|
|
4
4
|
resolveDirectoryUrl,
|
|
@@ -88,10 +88,13 @@ export const createCompiledFileService = ({
|
|
|
88
88
|
// this is just to allow some files to be written inside outDirectory and read directly
|
|
89
89
|
// if asked by the client (such as env.json, groupMap.json, meta.json)
|
|
90
90
|
if (!compileId) {
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
return fetchFileSystem(
|
|
92
|
+
new URL(request.ressource.slice(1), projectDirectoryUrl),
|
|
93
|
+
{
|
|
94
|
+
headers: request.headers,
|
|
95
|
+
etagEnabled: true,
|
|
96
|
+
},
|
|
97
|
+
)
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
const allowedCompileIds = [
|