@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.
@@ -443,14 +443,7 @@ jsenvBabelPluginCompatMap["global-this-as-jsenv-import"] = {
443
443
  node: "12",
444
444
  }
445
445
 
446
- // jsenvBabelPluginCompatMap["transform-import-assertion-json"] = {
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).forEach((runtimeName) => {
11
- const runtimeVersion = runtimeSupport[runtimeName]
12
- const oneRuntimeCompat = createOneRuntimeCompat({
13
- runtimeName,
14
- runtimeVersion,
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
- minRuntimeVersions[runtimeName] = oneRuntimeCompat.minRuntimeVersion
20
- oneRuntimeCompat.pluginRequiredNameArray.forEach((babelPluginName) => {
21
- if (!pluginRequiredNameArray.includes(babelPluginName)) {
22
- pluginRequiredNameArray.push(babelPluginName)
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
- exceptionSource: unevalException(transformedError),
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
- }