@jsenv/core 27.3.2 → 27.3.3
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 -0
- package/dist/controllable_worker_thread.mjs +1 -0
- package/dist/js/execute_using_dynamic_import.js +5 -3
- package/dist/main.js +141 -134
- package/package.json +1 -1
- package/src/build/build.js +2 -2
- package/src/build/graph_utils.js +14 -11
- package/src/execute/run.js +27 -28
- package/src/execute/runtimes/browsers/from_playwright.js +90 -92
- package/src/execute/runtimes/node/execute_using_dynamic_import.js +8 -2
- package/src/execute/runtimes/node/node_child_process.js +2 -0
- package/src/execute/runtimes/node/node_worker_thread.js +11 -6
- package/src/omega/url_graph/url_graph_report.js +2 -4
- package/src/omega/url_graph.js +23 -16
- package/src/plugins/autoreload/dev_sse/jsenv_plugin_dev_sse_server.js +1 -2
- package/src/plugins/bundling/js_module/bundle_js_module.js +0 -1
- package/src/plugins/node_esm_resolution/jsenv_plugin_node_esm_resolution.js +1 -2
- package/src/plugins/url_analysis/js/js_urls.js +0 -9
- package/src/test/coverage/report_to_coverage.js +16 -11
- package/src/test/execute_plan.js +3 -2
- package/src/test/execute_test_plan.js +3 -1
|
@@ -125,7 +125,6 @@ const rollupPluginJsenv = ({
|
|
|
125
125
|
usesImport:
|
|
126
126
|
rollupFileInfo.imports.length > 0 ||
|
|
127
127
|
rollupFileInfo.dynamicImports.length > 0,
|
|
128
|
-
usesExport: rollupFileInfo.exports.length > 0,
|
|
129
128
|
},
|
|
130
129
|
contentType: "text/javascript",
|
|
131
130
|
content: rollupFileInfo.code,
|
|
@@ -56,8 +56,7 @@ export const jsenvPluginNodeEsmResolution = ({
|
|
|
56
56
|
const onFileChange = () => {
|
|
57
57
|
packageScopesCache.clear()
|
|
58
58
|
packageJsonsCache.clear()
|
|
59
|
-
|
|
60
|
-
const urlInfo = urlGraph.getUrlInfo(url)
|
|
59
|
+
urlGraph.urlInfoMap.forEach((urlInfo) => {
|
|
61
60
|
if (urlInfo.dependsOnPackageJson) {
|
|
62
61
|
urlGraph.considerModified(urlInfo)
|
|
63
62
|
}
|
|
@@ -13,22 +13,13 @@ export const parseAndTransformJsUrls = async (urlInfo, context) => {
|
|
|
13
13
|
const { rootDirectoryUrl, referenceUtils } = context
|
|
14
14
|
const actions = []
|
|
15
15
|
const magicSource = createMagicSource(urlInfo.content)
|
|
16
|
-
urlInfo.data.usesImport = false
|
|
17
|
-
urlInfo.data.usesExport = false
|
|
18
|
-
urlInfo.data.usesImportAssertion = false
|
|
19
16
|
jsMentions.forEach((jsMention) => {
|
|
20
|
-
if (jsMention.assert) {
|
|
21
|
-
urlInfo.data.usesImportAssertion = true
|
|
22
|
-
}
|
|
23
17
|
if (
|
|
24
18
|
jsMention.subtype === "import_static" ||
|
|
25
19
|
jsMention.subtype === "import_dynamic"
|
|
26
20
|
) {
|
|
27
21
|
urlInfo.data.usesImport = true
|
|
28
22
|
}
|
|
29
|
-
if (jsMention.subtype === "export") {
|
|
30
|
-
urlInfo.data.usesExport = true
|
|
31
|
-
}
|
|
32
23
|
const [reference] = referenceUtils.found({
|
|
33
24
|
type: jsMention.type,
|
|
34
25
|
subtype: jsMention.subtype,
|
|
@@ -50,7 +50,7 @@ export const reportToCoverage = async (
|
|
|
50
50
|
coverageMethodForNodeJs !== "NODE_V8_COVERAGE"
|
|
51
51
|
) {
|
|
52
52
|
logger.warn(
|
|
53
|
-
`
|
|
53
|
+
`"${executionName}" execution of ${file} did not properly write coverage into ${executionResult.coverageFileUrl}`,
|
|
54
54
|
)
|
|
55
55
|
}
|
|
56
56
|
},
|
|
@@ -152,18 +152,23 @@ const getCoverageFromReport = async ({ signal, report, onMissing }) => {
|
|
|
152
152
|
const executionResultForFileOnRuntime =
|
|
153
153
|
executionResultForFile[executionName]
|
|
154
154
|
const { coverageFileUrl } = executionResultForFileOnRuntime
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
155
|
+
let executionCoverage
|
|
156
|
+
try {
|
|
157
|
+
executionCoverage = JSON.parse(
|
|
158
|
+
String(readFileSync(new URL(coverageFileUrl))),
|
|
159
|
+
)
|
|
160
|
+
} catch (e) {
|
|
161
|
+
if (e.code === "ENOENT" || e.name === "SyntaxError") {
|
|
162
|
+
onMissing({
|
|
163
|
+
executionName,
|
|
164
|
+
file,
|
|
165
|
+
executionResult: executionResultForFileOnRuntime,
|
|
166
|
+
})
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
throw e
|
|
162
170
|
}
|
|
163
171
|
|
|
164
|
-
const executionCoverage = JSON.parse(
|
|
165
|
-
String(readFileSync(new URL(coverageFileUrl))),
|
|
166
|
-
)
|
|
167
172
|
if (isV8Coverage(executionCoverage)) {
|
|
168
173
|
v8Coverage = v8Coverage
|
|
169
174
|
? composeTwoV8Coverages(v8Coverage, executionCoverage)
|
package/src/test/execute_plan.js
CHANGED
|
@@ -143,7 +143,7 @@ export const executePlan = async (
|
|
|
143
143
|
createDetailedMessage(
|
|
144
144
|
`process.env.NODE_V8_COVERAGE is required to generate coverage for Node.js subprocesses`,
|
|
145
145
|
{
|
|
146
|
-
"suggestion": `
|
|
146
|
+
"suggestion": `set process.env.NODE_V8_COVERAGE`,
|
|
147
147
|
"suggestion 2": `use coverageMethodForNodeJs: "Profiler". But it means coverage for child_process and worker_thread cannot be collected`,
|
|
148
148
|
},
|
|
149
149
|
),
|
|
@@ -224,7 +224,8 @@ export const executePlan = async (
|
|
|
224
224
|
getCustomBabelPlugins: ({ clientRuntimeCompat }) => {
|
|
225
225
|
if (
|
|
226
226
|
coverageEnabled &&
|
|
227
|
-
|
|
227
|
+
(coverageMethodForBrowsers !== "playwright_api" ||
|
|
228
|
+
Object.keys(clientRuntimeCompat)[0] !== "chrome")
|
|
228
229
|
) {
|
|
229
230
|
return {
|
|
230
231
|
"transform-instrument": [
|
|
@@ -67,7 +67,9 @@ export const executeTestPlan = async ({
|
|
|
67
67
|
},
|
|
68
68
|
coverageIncludeMissing = true,
|
|
69
69
|
coverageAndExecutionAllowed = false,
|
|
70
|
-
coverageMethodForNodeJs =
|
|
70
|
+
coverageMethodForNodeJs = process.env.NODE_V8_COVERAGE
|
|
71
|
+
? "NODE_V8_COVERAGE"
|
|
72
|
+
: "Profiler",
|
|
71
73
|
coverageMethodForBrowsers = "playwright_api", // "istanbul" also accepted
|
|
72
74
|
coverageV8ConflictWarning = true,
|
|
73
75
|
coverageTempDirectoryRelativeUrl = "./.coverage/tmp/",
|