@jsenv/core 23.8.6 → 23.8.12
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 +346 -327
- package/dist/jsenv_browser_system.js.map +64 -66
- package/package.json +5 -6
- package/src/buildProject.js +2 -2
- package/src/internal/{runtime/createBrowserRuntime → browser-launcher}/displayErrorInDocument.js +2 -0
- package/src/internal/{runtime/createBrowserRuntime → browser-launcher}/displayErrorNotification.js +1 -0
- package/src/internal/browser-launcher/executeHtmlFile.js +8 -0
- package/src/internal/browser-launcher/jsenv-browser-system.js +37 -10
- package/src/internal/building/buildUsingRollup.js +2 -10
- package/src/internal/building/createJsenvRollupPlugin.js +11 -13
- package/src/internal/compiling/createCompiledFileService.js +30 -1
- package/src/internal/compiling/html_source_file_service.js +0 -1
- package/src/internal/compiling/js-compilation-service/jsenvTransform.js +4 -2
- package/src/internal/compiling/jsenvCompilerForHtml.js +85 -19
- package/src/internal/compiling/startCompileServer.js +29 -20
- package/src/internal/executing/coverage/reportToCoverage.js +13 -3
- package/src/internal/generateGroupMap/featuresCompatMap.js +29 -0
- package/src/internal/generateGroupMap/jsenvBabelPluginCompatMap.js +1 -8
- package/src/internal/generateGroupMap/runtime_compat.js +21 -13
- package/src/internal/import-resolution/import-resolver-importmap.js +1 -1
- package/src/internal/runtime/createBrowserRuntime/createBrowserRuntime.js +1 -21
|
@@ -443,14 +443,7 @@ jsenvBabelPluginCompatMap["global-this-as-jsenv-import"] = {
|
|
|
443
443
|
node: "12",
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
//
|
|
447
|
-
// chrome: "91",
|
|
448
|
-
// edge: "91",
|
|
449
|
-
// }
|
|
450
|
-
// jsenvBabelPluginCompatMap["transform-import-assertion-css"] = {
|
|
451
|
-
// chrome: "93",
|
|
452
|
-
// edge: "93",
|
|
453
|
-
// }
|
|
446
|
+
// needs support for both json and css
|
|
454
447
|
jsenvBabelPluginCompatMap["transform-import-assertions"] = {
|
|
455
448
|
chrome: "93",
|
|
456
449
|
edge: "93",
|
|
@@ -7,22 +7,30 @@ export const createRuntimeCompat = ({
|
|
|
7
7
|
}) => {
|
|
8
8
|
const minRuntimeVersions = {}
|
|
9
9
|
const pluginRequiredNameArray = []
|
|
10
|
-
Object.keys(runtimeSupport)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
pluginMap,
|
|
16
|
-
pluginCompatMap,
|
|
10
|
+
const runtimeNames = Object.keys(runtimeSupport)
|
|
11
|
+
if (runtimeNames.length === 0) {
|
|
12
|
+
// when runtimes are unknown, everything is required
|
|
13
|
+
Object.keys(pluginMap).forEach((pluginName) => {
|
|
14
|
+
pluginRequiredNameArray.push(pluginName)
|
|
17
15
|
})
|
|
16
|
+
} else {
|
|
17
|
+
runtimeNames.forEach((runtimeName) => {
|
|
18
|
+
const runtimeVersion = runtimeSupport[runtimeName]
|
|
19
|
+
const oneRuntimeCompat = createOneRuntimeCompat({
|
|
20
|
+
runtimeName,
|
|
21
|
+
runtimeVersion,
|
|
22
|
+
pluginMap,
|
|
23
|
+
pluginCompatMap,
|
|
24
|
+
})
|
|
18
25
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
minRuntimeVersions[runtimeName] = oneRuntimeCompat.minRuntimeVersion
|
|
27
|
+
oneRuntimeCompat.pluginRequiredNameArray.forEach((babelPluginName) => {
|
|
28
|
+
if (!pluginRequiredNameArray.includes(babelPluginName)) {
|
|
29
|
+
pluginRequiredNameArray.push(babelPluginName)
|
|
30
|
+
}
|
|
31
|
+
})
|
|
24
32
|
})
|
|
25
|
-
}
|
|
33
|
+
}
|
|
26
34
|
|
|
27
35
|
return {
|
|
28
36
|
pluginRequiredNameArray,
|
|
@@ -52,7 +52,7 @@ const createBareSpecifierError = ({ specifier, importer, importMapUrl }) => {
|
|
|
52
52
|
importer,
|
|
53
53
|
...(importMapUrl
|
|
54
54
|
? {
|
|
55
|
-
"how to fix": `Add a mapping for "${specifier}" into the importmap file at ${importMapUrl}`,
|
|
55
|
+
"how to fix": `Add a mapping for "${specifier}" into the importmap file at "${importMapUrl}"`,
|
|
56
56
|
}
|
|
57
57
|
: {
|
|
58
58
|
"how to fix": `Add an importmap with a mapping for "${specifier}"`,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { normalizeImportMap } from "@jsenv/importmap/src/normalizeImportMap.js"
|
|
2
2
|
|
|
3
|
-
import { unevalException } from "../../unevalException.js"
|
|
4
3
|
// do not use memoize from @jsenv/filesystem to avoid pulling @jsenv/filesystem code into the browser build
|
|
5
4
|
import { memoize } from "../../memoize.js"
|
|
6
5
|
import { fetchUrl } from "../../browser-utils/fetch-browser.js"
|
|
@@ -8,8 +7,6 @@ import { createImportResolverForImportmap } from "../../import-resolution/import
|
|
|
8
7
|
import { measureAsyncFnPerf } from "../../perf_browser.js"
|
|
9
8
|
|
|
10
9
|
import { createBrowserSystem } from "./createBrowserSystem.js"
|
|
11
|
-
import { displayErrorInDocument } from "./displayErrorInDocument.js"
|
|
12
|
-
import { displayErrorNotification } from "./displayErrorNotification.js"
|
|
13
10
|
import { makeNamespaceTransferable } from "./makeNamespaceTransferable.js"
|
|
14
11
|
|
|
15
12
|
const memoizedCreateBrowserSystem = memoize(createBrowserSystem)
|
|
@@ -86,9 +83,6 @@ export const createBrowserRuntime = async ({
|
|
|
86
83
|
specifier,
|
|
87
84
|
{
|
|
88
85
|
transferableNamespace = false,
|
|
89
|
-
errorExposureInConsole = true,
|
|
90
|
-
errorExposureInNotification = false,
|
|
91
|
-
errorExposureInDocument = true,
|
|
92
86
|
executionExposureOnWindow = false,
|
|
93
87
|
errorTransform = (error) => error,
|
|
94
88
|
measurePerformance,
|
|
@@ -122,19 +116,9 @@ export const createBrowserRuntime = async ({
|
|
|
122
116
|
transformedError = error
|
|
123
117
|
}
|
|
124
118
|
|
|
125
|
-
if (errorExposureInConsole) {
|
|
126
|
-
displayErrorInConsole(transformedError)
|
|
127
|
-
}
|
|
128
|
-
if (errorExposureInNotification) {
|
|
129
|
-
displayErrorNotification(transformedError)
|
|
130
|
-
}
|
|
131
|
-
if (errorExposureInDocument) {
|
|
132
|
-
displayErrorInDocument(transformedError)
|
|
133
|
-
}
|
|
134
|
-
|
|
135
119
|
return {
|
|
136
120
|
status: "errored",
|
|
137
|
-
|
|
121
|
+
error: transformedError,
|
|
138
122
|
coverage: readCoverage(),
|
|
139
123
|
}
|
|
140
124
|
}
|
|
@@ -157,7 +141,3 @@ export const createBrowserRuntime = async ({
|
|
|
157
141
|
}
|
|
158
142
|
|
|
159
143
|
const readCoverage = () => window.__coverage__
|
|
160
|
-
|
|
161
|
-
const displayErrorInConsole = (error) => {
|
|
162
|
-
console.error(error)
|
|
163
|
-
}
|