@jsenv/core 23.8.7 → 23.8.9
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 +334 -322
- package/dist/jsenv_browser_system.js.map +63 -65
- package/package.json +5 -5
- 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 +33 -10
- package/src/internal/runtime/createBrowserRuntime/createBrowserRuntime.js +1 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "23.8.
|
|
3
|
+
"version": "23.8.9",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@c88/v8-coverage": "0.1.1",
|
|
68
68
|
"@jsenv/abort": "4.1.1",
|
|
69
69
|
"@jsenv/filesystem": "2.5.1",
|
|
70
|
-
"@jsenv/importmap": "1.
|
|
70
|
+
"@jsenv/importmap": "1.2.0",
|
|
71
71
|
"@jsenv/log": "1.4.0",
|
|
72
72
|
"@jsenv/logger": "4.0.1",
|
|
73
73
|
"@jsenv/server": "10.0.11",
|
|
@@ -121,11 +121,11 @@
|
|
|
121
121
|
"@babel/preset-env": "7.15.8",
|
|
122
122
|
"@jsenv/assert": "2.3.2",
|
|
123
123
|
"@jsenv/babel-preset": "./packages/jsenv-babel-preset",
|
|
124
|
-
"@jsenv/eslint-config": "16.0.
|
|
124
|
+
"@jsenv/eslint-config": "16.0.9",
|
|
125
125
|
"@jsenv/github-release-package": "1.2.3",
|
|
126
|
-
"@jsenv/https-local": "1.0.
|
|
126
|
+
"@jsenv/https-local": "1.0.3",
|
|
127
127
|
"@jsenv/importmap-eslint-resolver": "5.1.2",
|
|
128
|
-
"@jsenv/importmap-node-module": "2.
|
|
128
|
+
"@jsenv/importmap-node-module": "2.7.0",
|
|
129
129
|
"@jsenv/package-publish": "1.6.2",
|
|
130
130
|
"@jsenv/performance-impact": "2.2.1",
|
|
131
131
|
"@jsenv/prettier-check-project": "5.6.1",
|
|
@@ -186,6 +186,14 @@ const executeSource = async ({
|
|
|
186
186
|
coverage,
|
|
187
187
|
}
|
|
188
188
|
})
|
|
189
|
+
} else {
|
|
190
|
+
transformResult = composeTransformer(transformResult, (result) => {
|
|
191
|
+
const { namespace: fileExecutionResultMap } = result
|
|
192
|
+
Object.keys(fileExecutionResultMap).forEach((fileRelativeUrl) => {
|
|
193
|
+
delete fileExecutionResultMap[fileRelativeUrl].coverage
|
|
194
|
+
})
|
|
195
|
+
return result
|
|
196
|
+
})
|
|
189
197
|
}
|
|
190
198
|
|
|
191
199
|
const fileClientUrl = resolveUrl(fileRelativeUrl, `${compileServerOrigin}/`)
|
|
@@ -7,6 +7,9 @@ import { fetchUrl } from "../browser-utils/fetch-browser.js"
|
|
|
7
7
|
import { fetchAndEvalUsingFetch } from "../browser-utils/fetchAndEvalUsingFetch.js"
|
|
8
8
|
import { memoize } from "../memoize.js"
|
|
9
9
|
|
|
10
|
+
import { displayErrorInDocument } from "./displayErrorInDocument.js"
|
|
11
|
+
import { displayErrorNotification } from "./displayErrorNotification.js"
|
|
12
|
+
|
|
10
13
|
const getNavigationStartTime = () => {
|
|
11
14
|
try {
|
|
12
15
|
return window.performance.timing.navigationStart
|
|
@@ -80,7 +83,7 @@ const executeFileUsingDynamicImport = async (
|
|
|
80
83
|
performance.measure(`jsenv_file_import`, `jsenv_file_import_start`)
|
|
81
84
|
const executionResult = {
|
|
82
85
|
status: "errored",
|
|
83
|
-
|
|
86
|
+
error: e,
|
|
84
87
|
coverage: readCoverage(),
|
|
85
88
|
}
|
|
86
89
|
onExecutionError(executionResult, { currentScript })
|
|
@@ -114,16 +117,23 @@ const executeFileUsingSystemJs = (specifier) => {
|
|
|
114
117
|
return fileExecutionResultPromise
|
|
115
118
|
}
|
|
116
119
|
|
|
117
|
-
const onExecutionError = (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
const onExecutionError = (
|
|
121
|
+
executionResult,
|
|
122
|
+
{
|
|
123
|
+
currentScript,
|
|
124
|
+
errorExposureInConsole = true,
|
|
125
|
+
errorExposureInNotification = false,
|
|
126
|
+
errorExposureInDocument = true,
|
|
127
|
+
},
|
|
128
|
+
) => {
|
|
129
|
+
const error = executionResult.error
|
|
130
|
+
if (error.code === "NETWORK_FAILURE") {
|
|
121
131
|
if (currentScript) {
|
|
122
132
|
const errorEvent = new Event("error")
|
|
123
133
|
currentScript.dispatchEvent(errorEvent)
|
|
124
134
|
}
|
|
125
135
|
} else {
|
|
126
|
-
const { parsingError } =
|
|
136
|
+
const { parsingError } = error
|
|
127
137
|
const globalErrorEvent = new Event("error")
|
|
128
138
|
if (parsingError) {
|
|
129
139
|
globalErrorEvent.filename = parsingError.filename
|
|
@@ -131,13 +141,26 @@ const onExecutionError = (executionResult, { currentScript }) => {
|
|
|
131
141
|
globalErrorEvent.message = parsingError.message
|
|
132
142
|
globalErrorEvent.colno = parsingError.columnNumber
|
|
133
143
|
} else {
|
|
134
|
-
globalErrorEvent.filename =
|
|
135
|
-
globalErrorEvent.lineno =
|
|
136
|
-
globalErrorEvent.message =
|
|
137
|
-
globalErrorEvent.colno =
|
|
144
|
+
globalErrorEvent.filename = error.filename
|
|
145
|
+
globalErrorEvent.lineno = error.lineno
|
|
146
|
+
globalErrorEvent.message = error.message
|
|
147
|
+
globalErrorEvent.colno = error.columnno
|
|
138
148
|
}
|
|
139
149
|
window.dispatchEvent(globalErrorEvent)
|
|
140
150
|
}
|
|
151
|
+
|
|
152
|
+
if (errorExposureInConsole) {
|
|
153
|
+
console.error(error)
|
|
154
|
+
}
|
|
155
|
+
if (errorExposureInNotification) {
|
|
156
|
+
displayErrorNotification(error)
|
|
157
|
+
}
|
|
158
|
+
if (errorExposureInDocument) {
|
|
159
|
+
displayErrorInDocument(error)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
executionResult.exceptionSource = unevalException(error)
|
|
163
|
+
delete executionResult.error
|
|
141
164
|
}
|
|
142
165
|
|
|
143
166
|
const getBrowserRuntime = memoize(async () => {
|
|
@@ -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
|
-
}
|