@jsenv/core 25.0.0-alpha.0 → 25.0.0-alpha.1
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/browser_runtime/asset-manifest.json +2 -2
- package/dist/browser_runtime/{browser_runtime_a8097085.js → browser_runtime_91c5a3b8.js} +137 -26
- package/dist/browser_runtime/browser_runtime_91c5a3b8.js.map +1089 -0
- package/dist/build_manifest.js +5 -5
- package/dist/compile_proxy/asset-manifest.json +2 -2
- package/dist/compile_proxy/{compile_proxy_e16d7de8.html → compile_proxy_7ad5faa6.html} +119 -26
- package/dist/compile_proxy/{compile_proxy_e3b0c442_9e168143.js.map → compile_proxy_e3b0c442_809f35f7.js.map} +6 -6
- package/dist/redirector/asset-manifest.json +2 -2
- package/dist/redirector/{redirector_e3b0c442_3a34a156.js.map → redirector_e3b0c442_e391410e.js.map} +6 -6
- package/dist/redirector/{redirector_2e0c8abe.html → redirector_eb92e8a7.html} +119 -26
- package/dist/toolbar/asset-manifest.json +11 -11
- package/dist/toolbar/{toolbar.main_a5ef2c60.js.map → toolbar.main2_6c1b3d82.js.map} +8 -8
- package/dist/toolbar/{toolbar_412abb83.html → toolbar_04ba410c.html} +127 -32
- package/dist/toolbar_injector/asset-manifest.json +2 -2
- package/dist/toolbar_injector/{toolbar_injector_4f9c19e5.js → toolbar_injector_4a48bc53.js} +2 -2
- package/dist/toolbar_injector/{toolbar_injector_4f9c19e5.js.map → toolbar_injector_4a48bc53.js.map} +2 -2
- package/package.json +5 -4
- package/readme.md +22 -89
- package/src/buildProject.js +28 -15
- package/src/dev_server.js +8 -2
- package/src/execute.js +7 -1
- package/src/executeTestPlan.js +6 -0
- package/src/internal/browser_feature_detection/browser_feature_detection.js +18 -25
- package/src/internal/browser_runtime/browser_runtime.js +2 -2
- package/src/internal/browser_runtime/createBrowserRuntime.js +1 -1
- package/src/internal/browser_runtime/displayErrorInDocument.js +2 -0
- package/src/internal/browser_runtime/displayErrorNotification.js +1 -1
- package/src/internal/building/buildUsingRollup.js +3 -8
- package/src/internal/building/ressource_builder.js +35 -42
- package/src/internal/building/rollup_plugin_jsenv.js +195 -186
- package/src/internal/building/url_versioning.js +36 -42
- package/src/internal/compiling/createCompiledFileService.js +28 -40
- package/src/internal/compiling/html_source_file_service.js +66 -51
- package/src/internal/compiling/js-compilation-service/babel_plugin_systemjs_prepend.js +23 -0
- package/src/internal/compiling/js-compilation-service/jsenvTransform.js +16 -12
- package/src/internal/compiling/js-compilation-service/transformJs.js +2 -0
- package/src/internal/compiling/jsenvCompilerForHtml.js +43 -44
- package/src/internal/compiling/jsenvCompilerForImportmap.js +15 -76
- package/src/internal/compiling/jsenvCompilerForJavaScript.js +9 -0
- package/src/internal/compiling/startCompileServer.js +29 -5
- package/src/internal/dev_server/toolbar/compilation/toolbar.compilation.js +9 -9
- package/src/internal/executing/executePlan.js +6 -0
- package/src/internal/generateGroupMap/{jsenvBabelPluginCompatMap.js → babel_plugins_compatibility.js} +0 -0
- package/src/internal/generateGroupMap/{featuresCompatMap.js → features_compatibility.js} +9 -1
- package/src/internal/generateGroupMap/generateGroupMap.js +6 -35
- package/src/internal/generateGroupMap/one_runtime_compat.js +9 -12
- package/src/internal/generateGroupMap/runtime_compat.js +10 -15
- package/src/internal/generateGroupMap/runtime_compat_composition.js +2 -2
- package/src/internal/generateGroupMap/shake_babel_plugin_map.js +21 -0
- package/src/internal/import-resolution/importmap_default.js +52 -0
- package/src/internal/node_feature_detection/node_feature_detection.js +25 -19
- package/src/internal/runtime/s.js +101 -6
- package/src/internal/unevalException.js +1 -1
- package/src/jsenvServiceWorkerFinalizer.js +3 -1
- package/dist/browser_runtime/browser_runtime_a8097085.js.map +0 -1067
- package/src/internal/generateGroupMap/jsenvPluginCompatMap.js +0 -1
- package/src/internal/import-resolution/importmap-default.js +0 -34
package/src/buildProject.js
CHANGED
|
@@ -2,6 +2,7 @@ import { createLogger, createDetailedMessage } from "@jsenv/logger"
|
|
|
2
2
|
import { resolveDirectoryUrl } from "@jsenv/filesystem"
|
|
3
3
|
import { Abort, raceProcessTeardownEvents } from "@jsenv/abort"
|
|
4
4
|
|
|
5
|
+
import { shakeBabelPluginMap } from "@jsenv/core/src/internal/generateGroupMap/shake_babel_plugin_map.js"
|
|
5
6
|
import { COMPILE_ID_BEST } from "./internal/CONSTANTS.js"
|
|
6
7
|
import {
|
|
7
8
|
assertProjectDirectoryUrl,
|
|
@@ -23,6 +24,12 @@ export const buildProject = async ({
|
|
|
23
24
|
|
|
24
25
|
projectDirectoryUrl,
|
|
25
26
|
entryPoints,
|
|
27
|
+
workers = [],
|
|
28
|
+
serviceWorkers = [],
|
|
29
|
+
serviceWorkerFinalizer,
|
|
30
|
+
classicWorkers = [],
|
|
31
|
+
classicServiceWorkers = [],
|
|
32
|
+
importMapInWebWorkers = false,
|
|
26
33
|
buildDirectoryRelativeUrl,
|
|
27
34
|
buildDirectoryClean = true,
|
|
28
35
|
assetManifestFile = false,
|
|
@@ -77,12 +84,6 @@ export const buildProject = async ({
|
|
|
77
84
|
// https://github.com/cssnano/cssnano/tree/master/packages/cssnano-preset-default
|
|
78
85
|
minifyCssOptions,
|
|
79
86
|
|
|
80
|
-
workers = {},
|
|
81
|
-
serviceWorkers = {},
|
|
82
|
-
serviceWorkerFinalizer,
|
|
83
|
-
classicWorkers = {},
|
|
84
|
-
classicServiceWorkers = {},
|
|
85
|
-
|
|
86
87
|
env = {},
|
|
87
88
|
protocol,
|
|
88
89
|
privateKey,
|
|
@@ -114,6 +115,11 @@ export const buildProject = async ({
|
|
|
114
115
|
`runtimeSupport must be an object, got ${runtimeSupport}`,
|
|
115
116
|
)
|
|
116
117
|
}
|
|
118
|
+
if (format !== "systemjs" && importMapInWebWorkers) {
|
|
119
|
+
throw new Error(
|
|
120
|
+
`format must be "systemjs" when importMapInWebWorkers is enabled`,
|
|
121
|
+
)
|
|
122
|
+
}
|
|
117
123
|
|
|
118
124
|
projectDirectoryUrl = assertProjectDirectoryUrl({ projectDirectoryUrl })
|
|
119
125
|
await assertProjectDirectoryExists({ projectDirectoryUrl })
|
|
@@ -166,6 +172,7 @@ export const buildProject = async ({
|
|
|
166
172
|
moduleOutFormat: "esmodule", // rollup will transform into the right format
|
|
167
173
|
importMetaFormat: "esmodule", // rollup will transform into the right format
|
|
168
174
|
topLevelAwait: "ignore", // rollup will transform if needed
|
|
175
|
+
prependSystemJs: false,
|
|
169
176
|
|
|
170
177
|
protocol,
|
|
171
178
|
privateKey,
|
|
@@ -174,9 +181,10 @@ export const buildProject = async ({
|
|
|
174
181
|
port,
|
|
175
182
|
env,
|
|
176
183
|
babelPluginMap,
|
|
177
|
-
|
|
184
|
+
workers,
|
|
185
|
+
serviceWorkers,
|
|
178
186
|
runtimeSupport,
|
|
179
|
-
|
|
187
|
+
customCompilers,
|
|
180
188
|
compileServerCanReadFromFilesystem: filesystemCache,
|
|
181
189
|
compileServerCanWriteOnFilesystem: filesystemCache,
|
|
182
190
|
// keep source html untouched
|
|
@@ -219,8 +227,19 @@ export const buildProject = async ({
|
|
|
219
227
|
systemJsUrl,
|
|
220
228
|
globalName,
|
|
221
229
|
globals,
|
|
222
|
-
babelPluginMap:
|
|
230
|
+
babelPluginMap: shakeBabelPluginMap({
|
|
231
|
+
babelPluginMap: compileServer.babelPluginMap,
|
|
232
|
+
missingFeatureNames:
|
|
233
|
+
compileServer.compileServerGroupMap[COMPILE_ID_BEST]
|
|
234
|
+
.missingFeatureNames,
|
|
235
|
+
}),
|
|
223
236
|
runtimeSupport,
|
|
237
|
+
workers,
|
|
238
|
+
serviceWorkers,
|
|
239
|
+
serviceWorkerFinalizer,
|
|
240
|
+
classicWorkers,
|
|
241
|
+
classicServiceWorkers,
|
|
242
|
+
importMapInWebWorkers,
|
|
224
243
|
|
|
225
244
|
urlVersioning,
|
|
226
245
|
lineBreakNormalization,
|
|
@@ -235,12 +254,6 @@ export const buildProject = async ({
|
|
|
235
254
|
minifyJsOptions,
|
|
236
255
|
minifyCssOptions,
|
|
237
256
|
|
|
238
|
-
workers,
|
|
239
|
-
serviceWorkers,
|
|
240
|
-
serviceWorkerFinalizer,
|
|
241
|
-
classicWorkers,
|
|
242
|
-
classicServiceWorkers,
|
|
243
|
-
|
|
244
257
|
writeOnFileSystem,
|
|
245
258
|
sourcemapExcludeSources,
|
|
246
259
|
})
|
package/src/dev_server.js
CHANGED
|
@@ -45,17 +45,20 @@ export const startDevServer = async ({
|
|
|
45
45
|
keepProcessAlive = true,
|
|
46
46
|
|
|
47
47
|
babelPluginMap,
|
|
48
|
+
workers,
|
|
49
|
+
serviceWorkers,
|
|
50
|
+
importMapInWebWorkers,
|
|
51
|
+
customCompilers,
|
|
48
52
|
runtimeSupportDuringDev = {
|
|
49
53
|
// this allows to compile nothing or almost nothing when opening files
|
|
50
54
|
// with a recent chrome. Without this we would compile all the things not yet unsupported
|
|
51
55
|
// by Firefox and Safari such as top level await, importmap, etc
|
|
52
|
-
chrome: "
|
|
56
|
+
chrome: "96",
|
|
53
57
|
},
|
|
54
58
|
logLevel,
|
|
55
59
|
compileServerCanReadFromFilesystem,
|
|
56
60
|
compileServerCanWriteOnFilesystem,
|
|
57
61
|
sourcemapMethod,
|
|
58
|
-
customCompilers,
|
|
59
62
|
livereloadWatchConfig,
|
|
60
63
|
livereloadLogLevel,
|
|
61
64
|
jsenvDirectoryClean,
|
|
@@ -124,6 +127,9 @@ export const startDevServer = async ({
|
|
|
124
127
|
customCompilers,
|
|
125
128
|
sourcemapMethod,
|
|
126
129
|
babelPluginMap,
|
|
130
|
+
workers,
|
|
131
|
+
serviceWorkers,
|
|
132
|
+
importMapInWebWorkers,
|
|
127
133
|
runtimeSupport: runtimeSupportDuringDev,
|
|
128
134
|
livereloadWatchConfig,
|
|
129
135
|
livereloadLogLevel,
|
package/src/execute.js
CHANGED
|
@@ -46,6 +46,9 @@ export const execute = async ({
|
|
|
46
46
|
port,
|
|
47
47
|
babelPluginMap,
|
|
48
48
|
customCompilers,
|
|
49
|
+
workers,
|
|
50
|
+
serviceWorkers,
|
|
51
|
+
importMapInWebWorkers,
|
|
49
52
|
compileServerCanReadFromFilesystem,
|
|
50
53
|
compileServerCanWriteOnFilesystem,
|
|
51
54
|
|
|
@@ -105,10 +108,13 @@ export const execute = async ({
|
|
|
105
108
|
ip,
|
|
106
109
|
port,
|
|
107
110
|
babelPluginMap,
|
|
108
|
-
customCompilers,
|
|
109
111
|
runtimeSupport: normalizeRuntimeSupport({
|
|
110
112
|
[runtime.name]: runtime.version,
|
|
111
113
|
}),
|
|
114
|
+
customCompilers,
|
|
115
|
+
workers,
|
|
116
|
+
serviceWorkers,
|
|
117
|
+
importMapInWebWorkers,
|
|
112
118
|
compileServerCanReadFromFilesystem,
|
|
113
119
|
compileServerCanWriteOnFilesystem,
|
|
114
120
|
})
|
package/src/executeTestPlan.js
CHANGED
|
@@ -79,6 +79,9 @@ export const executeTestPlan = async ({
|
|
|
79
79
|
compileServerCanWriteOnFilesystem,
|
|
80
80
|
babelPluginMap,
|
|
81
81
|
babelConfigFileUrl,
|
|
82
|
+
workers,
|
|
83
|
+
serviceWorkers,
|
|
84
|
+
importMapInWebWorkers,
|
|
82
85
|
customCompilers,
|
|
83
86
|
jsenvDirectoryClean,
|
|
84
87
|
}) => {
|
|
@@ -179,6 +182,9 @@ export const executeTestPlan = async ({
|
|
|
179
182
|
compileServerCanWriteOnFilesystem,
|
|
180
183
|
babelPluginMap,
|
|
181
184
|
babelConfigFileUrl,
|
|
185
|
+
workers,
|
|
186
|
+
serviceWorkers,
|
|
187
|
+
importMapInWebWorkers,
|
|
182
188
|
customCompilers,
|
|
183
189
|
})
|
|
184
190
|
|
|
@@ -36,17 +36,14 @@ export const scanBrowserRuntimeFeatures = async ({
|
|
|
36
36
|
failFastOnFeatureDetection,
|
|
37
37
|
inlineImportMapIntoHTML,
|
|
38
38
|
})
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
coverageHandledFromOutside,
|
|
44
|
-
},
|
|
45
|
-
)
|
|
39
|
+
const missingFeatureNames = await adjustMissingFeatureNames(groupInfo, {
|
|
40
|
+
featuresReport,
|
|
41
|
+
coverageHandledFromOutside,
|
|
42
|
+
})
|
|
46
43
|
|
|
47
44
|
const canAvoidCompilation =
|
|
48
45
|
customCompilerPatterns.length === 0 &&
|
|
49
|
-
|
|
46
|
+
missingFeatureNames.length === 0 &&
|
|
50
47
|
featuresReport.importmap &&
|
|
51
48
|
featuresReport.dynamicImport &&
|
|
52
49
|
featuresReport.topLevelAwait
|
|
@@ -55,7 +52,7 @@ export const scanBrowserRuntimeFeatures = async ({
|
|
|
55
52
|
canAvoidCompilation,
|
|
56
53
|
featuresReport,
|
|
57
54
|
customCompilerPatterns,
|
|
58
|
-
|
|
55
|
+
missingFeatureNames,
|
|
59
56
|
inlineImportMapIntoHTML,
|
|
60
57
|
outDirectoryRelativeUrl,
|
|
61
58
|
compileId,
|
|
@@ -63,27 +60,25 @@ export const scanBrowserRuntimeFeatures = async ({
|
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
62
|
|
|
66
|
-
const
|
|
63
|
+
const adjustMissingFeatureNames = async (
|
|
67
64
|
groupInfo,
|
|
68
65
|
{ featuresReport, coverageHandledFromOutside },
|
|
69
66
|
) => {
|
|
70
|
-
const {
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
const index =
|
|
67
|
+
const { missingFeatureNames } = groupInfo
|
|
68
|
+
const missingFeatureNamesCopy = missingFeatureNames.slice()
|
|
69
|
+
const markAsSupported = (name) => {
|
|
70
|
+
const index = missingFeatureNamesCopy.indexOf(name)
|
|
74
71
|
if (index > -1) {
|
|
75
|
-
|
|
72
|
+
missingFeatureNamesCopy.splice(index, 1)
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
|
-
|
|
79
75
|
// When instrumentation CAN be handed by playwright
|
|
80
76
|
// https://playwright.dev/docs/api/class-chromiumcoverage#chromiumcoveragestartjscoverageoptions
|
|
81
77
|
// coverageHandledFromOutside is true and "transform-instrument" becomes non mandatory
|
|
82
78
|
if (coverageHandledFromOutside) {
|
|
83
|
-
|
|
79
|
+
markAsSupported("transform-instrument")
|
|
84
80
|
}
|
|
85
|
-
|
|
86
|
-
if (pluginRequiredNameArray.includes("transform-import-assertions")) {
|
|
81
|
+
if (missingFeatureNames.includes("transform-import-assertions")) {
|
|
87
82
|
const jsonImportAssertions = await supportsJsonImportAssertions()
|
|
88
83
|
featuresReport.jsonImportAssertions = jsonImportAssertions
|
|
89
84
|
|
|
@@ -91,17 +86,15 @@ const pluginRequiredNamesFromGroupInfo = async (
|
|
|
91
86
|
featuresReport.cssImportAssertions = cssImportAssertions
|
|
92
87
|
|
|
93
88
|
if (jsonImportAssertions && cssImportAssertions) {
|
|
94
|
-
|
|
89
|
+
markAsSupported("transform-import-assertions")
|
|
95
90
|
}
|
|
96
91
|
}
|
|
97
|
-
|
|
98
|
-
if (pluginRequiredNameArray.includes("new-stylesheet-as-jsenv-import")) {
|
|
92
|
+
if (missingFeatureNames.includes("new-stylesheet-as-jsenv-import")) {
|
|
99
93
|
const newStylesheet = supportsNewStylesheet()
|
|
100
94
|
featuresReport.newStylesheet = newStylesheet
|
|
101
|
-
|
|
95
|
+
markAsSupported("new-stylesheet-as-jsenv-import")
|
|
102
96
|
}
|
|
103
|
-
|
|
104
|
-
return requiredPluginNames
|
|
97
|
+
return missingFeatureNamesCopy
|
|
105
98
|
}
|
|
106
99
|
|
|
107
100
|
const detectSupportedFeatures = async ({
|
|
@@ -127,12 +127,12 @@ const onExecutionError = (
|
|
|
127
127
|
},
|
|
128
128
|
) => {
|
|
129
129
|
const error = executionResult.error
|
|
130
|
-
if (error.code === "NETWORK_FAILURE") {
|
|
130
|
+
if (error && error.code === "NETWORK_FAILURE") {
|
|
131
131
|
if (currentScript) {
|
|
132
132
|
const errorEvent = new Event("error")
|
|
133
133
|
currentScript.dispatchEvent(errorEvent)
|
|
134
134
|
}
|
|
135
|
-
} else {
|
|
135
|
+
} else if (typeof error === "object") {
|
|
136
136
|
const { parsingError } = error
|
|
137
137
|
const globalErrorEvent = new Event("error")
|
|
138
138
|
if (parsingError) {
|
|
@@ -40,7 +40,7 @@ export const createBrowserRuntime = async ({
|
|
|
40
40
|
// if there is an importmap in the document we use it instead of fetching.
|
|
41
41
|
// systemjs style with systemjs-importmap
|
|
42
42
|
const importmapScript = document.querySelector(
|
|
43
|
-
`script[type="
|
|
43
|
+
`script[type="systemjs-importmap"]`,
|
|
44
44
|
)
|
|
45
45
|
let importMap
|
|
46
46
|
let importMapUrl
|
|
@@ -7,7 +7,7 @@ const displayErrorNotificationImplementation = (error, { icon } = {}) => {
|
|
|
7
7
|
if (Notification.permission === "granted") {
|
|
8
8
|
const notification = new Notification("An error occured", {
|
|
9
9
|
lang: "en",
|
|
10
|
-
body: error.stack,
|
|
10
|
+
body: error ? error.stack : "undefined",
|
|
11
11
|
icon,
|
|
12
12
|
})
|
|
13
13
|
notification.onclick = () => {
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
isNodePartOfSupportedRuntimes,
|
|
14
14
|
isBrowserPartOfSupportedRuntimes,
|
|
15
15
|
} from "@jsenv/core/src/internal/generateGroupMap/runtime_support.js"
|
|
16
|
-
import { featuresCompatMap } from "@jsenv/core/src/internal/generateGroupMap/featuresCompatMap.js"
|
|
17
16
|
import { createRuntimeCompat } from "@jsenv/core/src/internal/generateGroupMap/runtime_compat.js"
|
|
18
17
|
import { createRollupPlugins } from "./rollup_plugin_jsenv.js"
|
|
19
18
|
|
|
@@ -70,21 +69,17 @@ export const buildUsingRollup = async ({
|
|
|
70
69
|
|
|
71
70
|
const runtimeCompatMap = createRuntimeCompat({
|
|
72
71
|
runtimeSupport,
|
|
73
|
-
|
|
74
|
-
import_assertion_type_json: true,
|
|
75
|
-
import_assertion_type_css: true,
|
|
76
|
-
},
|
|
77
|
-
pluginCompatMap: featuresCompatMap,
|
|
72
|
+
featureNames: ["import_assertion_type_json", "import_assertion_type_css"],
|
|
78
73
|
})
|
|
79
74
|
const importAssertionsSupport = {
|
|
80
75
|
json:
|
|
81
76
|
format === "esmodule" &&
|
|
82
|
-
!runtimeCompatMap.
|
|
77
|
+
!runtimeCompatMap.missingFeatureNames.includes(
|
|
83
78
|
"import_assertion_type_json",
|
|
84
79
|
),
|
|
85
80
|
css:
|
|
86
81
|
format === "esmodule" &&
|
|
87
|
-
!runtimeCompatMap.
|
|
82
|
+
!runtimeCompatMap.missingFeatureNames.includes(
|
|
88
83
|
"import_assertion_type_json",
|
|
89
84
|
),
|
|
90
85
|
}
|
|
@@ -114,6 +114,7 @@ export const createRessourceBuilder = (
|
|
|
114
114
|
jsLine,
|
|
115
115
|
jsColumn,
|
|
116
116
|
isImportAssertion,
|
|
117
|
+
isJsModule,
|
|
117
118
|
|
|
118
119
|
contentTypeExpected,
|
|
119
120
|
ressourceSpecifier,
|
|
@@ -131,6 +132,7 @@ export const createRessourceBuilder = (
|
|
|
131
132
|
|
|
132
133
|
contentType,
|
|
133
134
|
bufferBeforeBuild,
|
|
135
|
+
isJsModule,
|
|
134
136
|
})
|
|
135
137
|
return reference
|
|
136
138
|
}
|
|
@@ -772,64 +774,55 @@ export const createRessourceBuilder = (
|
|
|
772
774
|
}
|
|
773
775
|
|
|
774
776
|
const rollupBuildEnd = ({
|
|
775
|
-
|
|
776
|
-
rollupAssetFileInfos,
|
|
777
|
+
rollupResult,
|
|
777
778
|
useImportMapToMaximizeCacheReuse,
|
|
778
779
|
}) => {
|
|
779
780
|
const jsRessources = {}
|
|
781
|
+
|
|
780
782
|
Object.keys(ressourceMap).forEach((ressourceUrl) => {
|
|
781
783
|
const ressource = ressourceMap[ressourceUrl]
|
|
782
|
-
const
|
|
783
|
-
const rollupFileInfo =
|
|
784
|
-
return
|
|
784
|
+
const rollupFileName = Object.keys(rollupResult).find((key) => {
|
|
785
|
+
const rollupFileInfo = rollupResult[key]
|
|
786
|
+
return (
|
|
787
|
+
rollupFileInfo.url === ressourceUrl ||
|
|
788
|
+
// asset
|
|
789
|
+
ressource.fileName === key ||
|
|
790
|
+
ressource.relativeUrl === key
|
|
791
|
+
)
|
|
785
792
|
})
|
|
786
|
-
if (
|
|
787
|
-
const rollupFileInfo =
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
793
|
+
if (rollupFileName) {
|
|
794
|
+
const rollupFileInfo = rollupResult[rollupFileName]
|
|
795
|
+
if (rollupFileInfo.type === "asset") {
|
|
796
|
+
ressource.fileName = rollupFileName
|
|
797
|
+
return
|
|
798
|
+
}
|
|
799
|
+
if (rollupFileInfo.type === "chunk") {
|
|
800
|
+
applyBuildEndEffects(ressource, {
|
|
801
|
+
rollupFileInfo,
|
|
802
|
+
rollupResult,
|
|
803
|
+
useImportMapToMaximizeCacheReuse,
|
|
804
|
+
})
|
|
805
|
+
const { rollupBuildDoneCallbacks } = ressource
|
|
806
|
+
rollupBuildDoneCallbacks.forEach((rollupBuildDoneCallback) => {
|
|
807
|
+
rollupBuildDoneCallback()
|
|
808
|
+
})
|
|
809
|
+
if (rollupFileInfo.type === "chunk") {
|
|
810
|
+
jsRessources[ressourceUrl] = ressource
|
|
802
811
|
}
|
|
803
|
-
|
|
804
|
-
`${shortenUrl(ressource.url)} cannot be found in the build info`,
|
|
805
|
-
)
|
|
812
|
+
return
|
|
806
813
|
}
|
|
807
|
-
applyBuildEndEffects(ressource, {
|
|
808
|
-
rollupFileInfo,
|
|
809
|
-
rollupAssetFileInfos,
|
|
810
|
-
useImportMapToMaximizeCacheReuse,
|
|
811
|
-
})
|
|
812
|
-
const { rollupBuildDoneCallbacks } = ressource
|
|
813
|
-
rollupBuildDoneCallbacks.forEach((rollupBuildDoneCallback) => {
|
|
814
|
-
rollupBuildDoneCallback()
|
|
815
|
-
})
|
|
816
|
-
jsRessources[ressourceUrl] = ressource
|
|
817
|
-
return
|
|
818
814
|
}
|
|
819
815
|
})
|
|
820
|
-
|
|
821
816
|
return { jsRessources }
|
|
822
817
|
}
|
|
823
818
|
|
|
824
819
|
const applyBuildEndEffects = (
|
|
825
820
|
ressource,
|
|
826
|
-
{ rollupFileInfo,
|
|
821
|
+
{ rollupFileInfo, rollupResult, useImportMapToMaximizeCacheReuse },
|
|
827
822
|
) => {
|
|
828
823
|
const fileName = rollupFileInfo.fileName
|
|
829
824
|
let code = rollupFileInfo.code
|
|
830
|
-
|
|
831
|
-
ressource.contentType = "application/javascript"
|
|
832
|
-
}
|
|
825
|
+
ressource.contentType = "application/javascript"
|
|
833
826
|
|
|
834
827
|
if (useImportMapToMaximizeCacheReuse) {
|
|
835
828
|
ressource.fileName = fileName
|
|
@@ -842,8 +835,7 @@ export const createRessourceBuilder = (
|
|
|
842
835
|
const map = rollupFileInfo.map
|
|
843
836
|
if (map) {
|
|
844
837
|
const sourcemapBuildRelativeUrl = `${ressource.buildRelativeUrl}.map`
|
|
845
|
-
const sourcemapRollupFileInfo =
|
|
846
|
-
rollupAssetFileInfos[sourcemapBuildRelativeUrl]
|
|
838
|
+
const sourcemapRollupFileInfo = rollupResult[sourcemapBuildRelativeUrl]
|
|
847
839
|
if (!sourcemapRollupFileInfo) {
|
|
848
840
|
const ressourceBuildUrl = resolveUrl(
|
|
849
841
|
ressource.buildRelativeUrl,
|
|
@@ -873,6 +865,7 @@ export const createRessourceBuilder = (
|
|
|
873
865
|
// ${"//#"} is to avoid a parser thinking there is a sourceMappingUrl for this file
|
|
874
866
|
referenceColumn: `${"//#"} sourceMappingURL=`.length + 1,
|
|
875
867
|
isSourcemap: true,
|
|
868
|
+
isPlaceholder: true,
|
|
876
869
|
})
|
|
877
870
|
sourcemapReference.ressource.buildEnd(
|
|
878
871
|
sourcemapAsString,
|