@jsenv/core 23.1.4 → 23.2.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/jsenv_browser_system.js +18 -82
- package/dist/jsenv_browser_system.js.map +11 -20
- package/dist/jsenv_compile_proxy.js +18 -82
- package/dist/jsenv_compile_proxy.js.map +11 -21
- package/dist/jsenv_exploring_index.js +127 -274
- package/dist/jsenv_exploring_index.js.map +76 -90
- package/dist/jsenv_exploring_redirector.js +21 -89
- package/dist/jsenv_exploring_redirector.js.map +13 -25
- package/dist/jsenv_toolbar.js +81 -149
- package/dist/jsenv_toolbar.js.map +50 -61
- package/dist/jsenv_toolbar_injector.js +56 -124
- package/dist/jsenv_toolbar_injector.js.map +27 -41
- package/{LICENSE → license} +0 -0
- package/package.json +6 -10
- package/src/abort/abortable.js +172 -0
- package/src/abort/callback_list.js +64 -0
- package/src/abort/callback_race.js +34 -0
- package/src/abort/cleaner.js +22 -0
- package/src/abort/main.js +32 -0
- package/src/abort/process_teardown_events.js +59 -0
- package/src/buildProject.js +132 -123
- package/src/execute.js +108 -107
- package/src/executeTestPlan.js +101 -121
- package/src/importUsingChildProcess.js +2 -1
- package/src/internal/browser-launcher/executeHtmlFile.js +22 -10
- package/src/internal/browser-utils/fetch-browser.js +4 -29
- package/src/internal/browser-utils/fetchUsingXHR.js +5 -7
- package/src/internal/building/buildUsingRollup.js +60 -24
- package/src/internal/building/createJsenvRollupPlugin.js +13 -31
- package/src/internal/building/ressource_builder.js +3 -6
- package/src/internal/building/sourcemap_loader.js +4 -5
- package/src/internal/building/url_fetcher.js +2 -5
- package/src/internal/building/url_loader.js +3 -6
- package/src/internal/compiling/compileFile.js +1 -2
- package/src/internal/compiling/createCompiledFileService.js +4 -4
- package/src/internal/compiling/startCompileServer.js +52 -109
- package/src/internal/executing/coverage/relativeUrlToEmptyCoverage.js +19 -30
- package/src/internal/executing/coverage/reportToCoverage.js +44 -24
- package/src/internal/executing/coverage/v8CoverageFromNodeV8Directory.js +2 -15
- package/src/internal/executing/createSummaryLog.js +47 -34
- package/src/internal/executing/executeConcurrently.js +89 -47
- package/src/internal/executing/executePlan.js +33 -7
- package/src/internal/executing/executionLogs.js +25 -28
- package/src/internal/executing/execution_colors.js +15 -0
- package/src/internal/executing/generateExecutionSteps.js +3 -2
- package/src/internal/executing/launchAndExecute.js +213 -257
- package/src/internal/exploring/fetchExploringJson.js +3 -4
- package/src/internal/fetchUrl.js +6 -2
- package/src/internal/logs/log_style.js +16 -28
- package/src/internal/logs/msAsDuration.js +1 -1
- package/src/internal/node-launcher/createChildProcessOptions.js +4 -5
- package/src/internal/node-launcher/createControllableNodeProcess.js +117 -229
- package/src/internal/node-launcher/kill_process_tree.js +76 -0
- package/src/internal/node-launcher/nodeControllableFile.mjs +16 -10
- package/src/internal/{promise_track_race.js → promise_race.js} +2 -2
- package/src/internal/toolbar/util/animation.js +3 -7
- package/src/internal/toolbar/util/fetching.js +1 -30
- package/src/jsenvServiceWorkerFinalizer.js +1 -2
- package/src/launchBrowser.js +127 -127
- package/src/launchNode.js +32 -17
- package/src/playwright_browser_versions.js +3 -3
- package/src/requireUsingChildProcess.js +2 -1
- package/src/signal/signal.js +65 -0
- package/src/startExploring.js +69 -73
- package/src/internal/executeJsenvAsyncFunction.js +0 -34
- package/src/internal/trackRessources.js +0 -23
package/src/startExploring.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createCancellationToken,
|
|
3
|
-
composeCancellationToken,
|
|
4
|
-
} from "@jsenv/cancellation"
|
|
5
1
|
import {
|
|
6
2
|
normalizeStructuredMetaMap,
|
|
7
3
|
collectFiles,
|
|
8
4
|
urlToRelativeUrl,
|
|
9
5
|
} from "@jsenv/filesystem"
|
|
10
6
|
|
|
11
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
Abortable,
|
|
9
|
+
raceProcessTeardownEvents,
|
|
10
|
+
} from "@jsenv/core/src/abort/main.js"
|
|
12
11
|
import { jsenvCoreDirectoryUrl } from "./internal/jsenvCoreDirectoryUrl.js"
|
|
13
12
|
import {
|
|
14
13
|
assertProjectDirectoryUrl,
|
|
@@ -31,8 +30,8 @@ import {
|
|
|
31
30
|
import { jsenvRuntimeSupportDuringDev } from "./jsenvRuntimeSupportDuringDev.js"
|
|
32
31
|
|
|
33
32
|
export const startExploring = async ({
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
signal = new AbortController().signal,
|
|
34
|
+
handleSIGINT = true,
|
|
36
35
|
|
|
37
36
|
explorableConfig = jsenvExplorableConfig,
|
|
38
37
|
projectDirectoryUrl,
|
|
@@ -58,79 +57,76 @@ export const startExploring = async ({
|
|
|
58
57
|
livereloadWatchConfig,
|
|
59
58
|
jsenvDirectoryClean,
|
|
60
59
|
}) => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
cancellationToken,
|
|
64
|
-
jsenvCancellationToken,
|
|
65
|
-
)
|
|
60
|
+
projectDirectoryUrl = assertProjectDirectoryUrl({ projectDirectoryUrl })
|
|
61
|
+
await assertProjectDirectoryExists({ projectDirectoryUrl })
|
|
66
62
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
const exploringServerOperation = Abortable.fromSignal(signal)
|
|
64
|
+
if (handleSIGINT) {
|
|
65
|
+
Abortable.effect(exploringServerOperation, (cb) =>
|
|
66
|
+
raceProcessTeardownEvents(
|
|
67
|
+
{
|
|
68
|
+
SIGINT: true,
|
|
69
|
+
},
|
|
70
|
+
cb,
|
|
71
|
+
),
|
|
72
|
+
)
|
|
73
|
+
}
|
|
75
74
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
projectDirectoryUrl,
|
|
82
|
-
outDirectoryRelativeUrl,
|
|
83
|
-
explorableConfig,
|
|
84
|
-
livereloading,
|
|
85
|
-
})
|
|
86
|
-
const serveExplorableListAsJson = createExplorableListAsJsonService({
|
|
87
|
-
projectDirectoryUrl,
|
|
88
|
-
outDirectoryRelativeUrl,
|
|
89
|
-
explorableConfig,
|
|
90
|
-
})
|
|
75
|
+
const outDirectoryRelativeUrl = computeOutDirectoryRelativeUrl({
|
|
76
|
+
projectDirectoryUrl,
|
|
77
|
+
jsenvDirectoryRelativeUrl,
|
|
78
|
+
outDirectoryName,
|
|
79
|
+
})
|
|
91
80
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
customCompilers,
|
|
109
|
-
jsenvDirectoryRelativeUrl,
|
|
110
|
-
outDirectoryName,
|
|
111
|
-
inlineImportMapIntoHTML,
|
|
81
|
+
const redirectFiles = createRedirectFilesService({
|
|
82
|
+
projectDirectoryUrl,
|
|
83
|
+
outDirectoryRelativeUrl,
|
|
84
|
+
})
|
|
85
|
+
const serveExploringData = createExploringDataService({
|
|
86
|
+
projectDirectoryUrl,
|
|
87
|
+
outDirectoryRelativeUrl,
|
|
88
|
+
explorableConfig,
|
|
89
|
+
livereloading,
|
|
90
|
+
})
|
|
91
|
+
const serveExplorableListAsJson = createExplorableListAsJsonService({
|
|
92
|
+
projectDirectoryUrl,
|
|
93
|
+
outDirectoryRelativeUrl,
|
|
94
|
+
explorableConfig,
|
|
95
|
+
})
|
|
112
96
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
compileServerPort,
|
|
117
|
-
compileServerProtocol,
|
|
118
|
-
compileServerHttp2,
|
|
119
|
-
compileServerCertificate,
|
|
120
|
-
compileServerPrivateKey,
|
|
121
|
-
sourcemapMethod,
|
|
122
|
-
babelPluginMap,
|
|
123
|
-
runtimeSupport: runtimeSupportDuringDev,
|
|
124
|
-
livereloadWatchConfig,
|
|
125
|
-
jsenvDirectoryClean,
|
|
126
|
-
})
|
|
97
|
+
const compileServer = await startCompileServer({
|
|
98
|
+
signal: exploringServerOperation.signal,
|
|
99
|
+
keepProcessAlive,
|
|
127
100
|
|
|
128
|
-
|
|
129
|
-
|
|
101
|
+
projectDirectoryUrl,
|
|
102
|
+
livereloadSSE: livereloading,
|
|
103
|
+
jsenvToolbarInjection: jsenvToolbar,
|
|
104
|
+
customServices: {
|
|
105
|
+
"service:exploring-redirect": (request) => redirectFiles(request),
|
|
106
|
+
"service:exploring-data": (request) => serveExploringData(request),
|
|
107
|
+
"service:explorables": (request) => serveExplorableListAsJson(request),
|
|
108
|
+
},
|
|
109
|
+
customCompilers,
|
|
110
|
+
jsenvDirectoryRelativeUrl,
|
|
111
|
+
outDirectoryName,
|
|
112
|
+
inlineImportMapIntoHTML,
|
|
130
113
|
|
|
131
|
-
|
|
132
|
-
|
|
114
|
+
compileServerLogLevel,
|
|
115
|
+
compileServerCanReadFromFilesystem,
|
|
116
|
+
compileServerCanWriteOnFilesystem,
|
|
117
|
+
compileServerPort,
|
|
118
|
+
compileServerProtocol,
|
|
119
|
+
compileServerHttp2,
|
|
120
|
+
compileServerCertificate,
|
|
121
|
+
compileServerPrivateKey,
|
|
122
|
+
sourcemapMethod,
|
|
123
|
+
babelPluginMap,
|
|
124
|
+
runtimeSupport: runtimeSupportDuringDev,
|
|
125
|
+
livereloadWatchConfig,
|
|
126
|
+
jsenvDirectoryClean,
|
|
133
127
|
})
|
|
128
|
+
|
|
129
|
+
return compileServer
|
|
134
130
|
}
|
|
135
131
|
|
|
136
132
|
const createRedirectFilesService = ({ projectDirectoryUrl }) => {
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
executeAsyncFunction,
|
|
3
|
-
createCancellationSource,
|
|
4
|
-
} from "@jsenv/cancellation"
|
|
5
|
-
import { SIGINTSignal } from "@jsenv/node-signals"
|
|
6
|
-
|
|
7
|
-
export const executeJsenvAsyncFunction = (
|
|
8
|
-
fn,
|
|
9
|
-
{ cancelOnSIGINT = false } = {},
|
|
10
|
-
) => {
|
|
11
|
-
return executeAsyncFunction(
|
|
12
|
-
async () => {
|
|
13
|
-
const jsenvCancellationSource = createCancellationSource()
|
|
14
|
-
const jsenvCancellationToken = jsenvCancellationSource.token
|
|
15
|
-
|
|
16
|
-
if (cancelOnSIGINT) {
|
|
17
|
-
const unregister = SIGINTSignal.addCallback(() => {
|
|
18
|
-
jsenvCancellationSource.cancel("process SIGINT")
|
|
19
|
-
})
|
|
20
|
-
try {
|
|
21
|
-
return await fn({ jsenvCancellationToken })
|
|
22
|
-
} finally {
|
|
23
|
-
unregister()
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return fn({ jsenvCancellationToken })
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
catchCancellation: true,
|
|
31
|
-
considerUnhandledRejectionsAsExceptions: true,
|
|
32
|
-
},
|
|
33
|
-
)
|
|
34
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { memoize } from "@jsenv/filesystem"
|
|
2
|
-
|
|
3
|
-
export const trackRessources = () => {
|
|
4
|
-
const callbackArray = []
|
|
5
|
-
|
|
6
|
-
const registerCleanupCallback = (callback) => {
|
|
7
|
-
if (typeof callback !== "function")
|
|
8
|
-
throw new TypeError(`callback must be a function
|
|
9
|
-
callback: ${callback}`)
|
|
10
|
-
callbackArray.push(callback)
|
|
11
|
-
return () => {
|
|
12
|
-
const index = callbackArray.indexOf(callback)
|
|
13
|
-
if (index > -1) callbackArray.splice(index, 1)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const cleanup = memoize(async (reason) => {
|
|
18
|
-
const localCallbackArray = callbackArray.slice()
|
|
19
|
-
await Promise.all(localCallbackArray.map((callback) => callback(reason)))
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
return { registerCleanupCallback, cleanup }
|
|
23
|
-
}
|