@jsenv/core 27.0.0-alpha.8 → 27.0.0-alpha.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/package.json +1 -1
- package/src/build/build.js +29 -19
package/package.json
CHANGED
package/src/build/build.js
CHANGED
|
@@ -185,28 +185,38 @@ ${Object.keys(rawGraph.urlInfos).join("\n")}`,
|
|
|
185
185
|
}
|
|
186
186
|
Object.keys(rawGraph.urlInfos).forEach((rawUrl) => {
|
|
187
187
|
const rawUrlInfo = rawGraph.getUrlInfo(rawUrl)
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
188
|
+
if (rawUrlInfo.data.isEntryPoint) {
|
|
189
|
+
addToBundlerIfAny(rawUrlInfo)
|
|
190
|
+
if (rawUrlInfo.type === "html") {
|
|
191
|
+
rawUrlInfo.dependencies.forEach((dependencyUrl) => {
|
|
192
|
+
const dependencyUrlInfo = rawGraph.getUrlInfo(dependencyUrl)
|
|
193
|
+
if (dependencyUrlInfo.isInline) {
|
|
194
|
+
if (dependencyUrlInfo.type === "js_module") {
|
|
195
|
+
// bundle inline script type module deps
|
|
196
|
+
dependencyUrlInfo.references.forEach((inlineScriptRef) => {
|
|
197
|
+
if (inlineScriptRef.type === "js_import_export") {
|
|
198
|
+
addToBundlerIfAny(rawGraph.getUrlInfo(inlineScriptRef.url))
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
}
|
|
202
|
+
// inline content cannot be bundled
|
|
203
|
+
return
|
|
203
204
|
}
|
|
204
|
-
|
|
205
|
-
|
|
205
|
+
addToBundlerIfAny(dependencyUrlInfo)
|
|
206
|
+
})
|
|
207
|
+
return
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// File referenced with new URL('./file.js', import.meta.url)
|
|
211
|
+
// are entry points that can be bundled
|
|
212
|
+
// For instance we will bundle service worker/workers detected like this
|
|
213
|
+
if (rawUrlInfo.type === "js_module") {
|
|
214
|
+
rawUrlInfo.references.forEach((reference) => {
|
|
215
|
+
if (reference.type === "js_import_meta_url_pattern") {
|
|
216
|
+
const urlInfo = rawGraph.getUrlInfo(reference.url)
|
|
217
|
+
addToBundlerIfAny(urlInfo)
|
|
206
218
|
}
|
|
207
|
-
addToBundlerIfAny(dependencyUrlInfo)
|
|
208
219
|
})
|
|
209
|
-
return
|
|
210
220
|
}
|
|
211
221
|
})
|
|
212
222
|
await Object.keys(bundlers).reduce(async (previous, type) => {
|