@jsenv/core 27.0.0-alpha.49 → 27.0.0-alpha.51
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/package.json +2 -2
- package/src/build/build_urls_generator.js +2 -2
- package/src/execute/runtimes/browsers/from_playwright.js +3 -0
- package/src/omega/server/file_service.js +3 -3
- package/src/omega/server/user_agent.js +4 -2
- package/src/plugins/html_supervisor/jsenv_plugin_html_supervisor.js +0 -3
- package/src/plugins/plugin_controller.js +3 -0
- package/src/test/logs_file_execution.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "27.0.0-alpha.
|
|
3
|
+
"version": "27.0.0-alpha.51",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@jsenv/node-esm-resolution": "0.0.6",
|
|
69
69
|
"@jsenv/server": "12.6.2",
|
|
70
70
|
"@jsenv/uneval": "1.6.0",
|
|
71
|
-
"@jsenv/utils": "1.7.
|
|
71
|
+
"@jsenv/utils": "1.7.1",
|
|
72
72
|
"construct-style-sheets-polyfill": "3.1.0",
|
|
73
73
|
"cssnano": "5.1.7",
|
|
74
74
|
"cssnano-preset-default": "5.2.7",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { urlToFilename } from "@jsenv/filesystem"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { memoizeByFirstArgument } from "@jsenv/utils/memoize/memoize_by_first_argument.js"
|
|
4
4
|
|
|
5
5
|
export const createBuilUrlsGenerator = ({ buildDirectoryUrl }) => {
|
|
6
6
|
const cache = {}
|
|
@@ -15,7 +15,7 @@ export const createBuilUrlsGenerator = ({ buildDirectoryUrl }) => {
|
|
|
15
15
|
return urlToFilename(url)
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const generate =
|
|
18
|
+
const generate = memoizeByFirstArgument((url, { urlInfo, parentUrlInfo }) => {
|
|
19
19
|
const directoryPath = determineDirectoryPath({
|
|
20
20
|
urlInfo,
|
|
21
21
|
parentUrlInfo,
|
|
@@ -262,6 +262,9 @@ export const createRuntimeFromPlaywright = ({
|
|
|
262
262
|
cb({ reason: "page closed" })
|
|
263
263
|
})
|
|
264
264
|
cleanupCallbackList.add(closePage)
|
|
265
|
+
cleanupCallbackList.add(() => {
|
|
266
|
+
browser.removeListener("disconnected", disconnectedCallback)
|
|
267
|
+
})
|
|
265
268
|
const notifyPrevious = stopAfterAllSignal.notify
|
|
266
269
|
stopAfterAllSignal.notify = async () => {
|
|
267
270
|
await notifyPrevious()
|
|
@@ -39,9 +39,6 @@ export const createFileService = ({
|
|
|
39
39
|
if (responseFromPlugin) {
|
|
40
40
|
return responseFromPlugin
|
|
41
41
|
}
|
|
42
|
-
const { runtimeName, runtimeVersion } = parseUserAgentHeader(
|
|
43
|
-
request.headers["user-agent"],
|
|
44
|
-
)
|
|
45
42
|
const [reference, urlInfo] = kitchen.prepareEntryPoint({
|
|
46
43
|
parentUrl: inferParentFromRequest(request, rootDirectoryUrl),
|
|
47
44
|
type: "entry_point",
|
|
@@ -65,6 +62,9 @@ export const createFileService = ({
|
|
|
65
62
|
if (!urlInfo.isInline && !urlInfo.type === "sourcemap") {
|
|
66
63
|
urlGraph.resetUrlInfo(urlInfo)
|
|
67
64
|
}
|
|
65
|
+
const { runtimeName, runtimeVersion } = parseUserAgentHeader(
|
|
66
|
+
request.headers["user-agent"],
|
|
67
|
+
)
|
|
68
68
|
await kitchen.cook({
|
|
69
69
|
reference: referenceFromGraph || reference,
|
|
70
70
|
urlInfo,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { createRequire } from "node:module"
|
|
2
2
|
|
|
3
|
+
import { memoizeByFirstArgument } from "@jsenv/utils/memoize/memoize_by_first_argument.js"
|
|
4
|
+
|
|
3
5
|
const require = createRequire(import.meta.url)
|
|
4
6
|
|
|
5
|
-
export const parseUserAgentHeader = (userAgent) => {
|
|
7
|
+
export const parseUserAgentHeader = memoizeByFirstArgument((userAgent) => {
|
|
6
8
|
if (userAgent.includes("node-fetch/")) {
|
|
7
9
|
// it's not really node and conceptually we can't assume the node version
|
|
8
10
|
// but good enough for now
|
|
@@ -19,4 +21,4 @@ export const parseUserAgentHeader = (userAgent) => {
|
|
|
19
21
|
runtimeVersion:
|
|
20
22
|
family === "Other" ? "unknown" : `${major}.${minor}${patch}`,
|
|
21
23
|
}
|
|
22
|
-
}
|
|
24
|
+
})
|
|
@@ -147,9 +147,6 @@ export const jsenvPluginHtmlSupervisor = ({
|
|
|
147
147
|
return
|
|
148
148
|
}
|
|
149
149
|
})
|
|
150
|
-
if (scriptsToSupervise.length === 0) {
|
|
151
|
-
return null
|
|
152
|
-
}
|
|
153
150
|
const [htmlSupervisorInstallerFileReference] = referenceUtils.inject({
|
|
154
151
|
type: "js_import_export",
|
|
155
152
|
expectedType: "js_module",
|
|
@@ -113,6 +113,9 @@ export const createPluginController = ({
|
|
|
113
113
|
}
|
|
114
114
|
const callAsyncHooksUntil = (hookName, info, context) => {
|
|
115
115
|
const hooks = hookGroups[hookName]
|
|
116
|
+
if (hooks.length === 0) {
|
|
117
|
+
return null
|
|
118
|
+
}
|
|
116
119
|
return new Promise((resolve, reject) => {
|
|
117
120
|
const visit = (index) => {
|
|
118
121
|
if (index >= hooks.length) {
|
|
@@ -60,7 +60,7 @@ export const formatExecutionResult = (
|
|
|
60
60
|
file: fileRelativeUrl,
|
|
61
61
|
runtime: `${runtimeName}/${runtimeVersion}`,
|
|
62
62
|
duration: msAsDuration(duration),
|
|
63
|
-
...(error ? { error: error.stack } : {}),
|
|
63
|
+
...(error ? { error: error.stack || error.message || error } : {}),
|
|
64
64
|
},
|
|
65
65
|
consoleOutput,
|
|
66
66
|
})
|