Revert Prism LazyChunks

This commit is contained in:
thororen1234 2026-03-19 13:56:23 -04:00
parent b140471e20
commit bf7303208c
No known key found for this signature in database

View file

@ -30,18 +30,6 @@ function getWebpackChunkMap() {
return v;
}
async function promiseAllSettledBatched<T>(tasks: (() => Promise<T>)[], batchSize = 8): Promise<T[]> {
const results: T[] = [];
for (let i = 0; i < tasks.length; i += batchSize) {
const batch = tasks.slice(i, i + batchSize);
const settled = await Promise.allSettled(batch.map(t => t()));
for (const r of settled) {
if (r.status === "fulfilled") results.push(r.value);
}
}
return results;
}
export async function loadLazyChunks() {
const LazyChunkLoaderLogger = new Logger("LazyChunkLoader");
const queue = pLimit(50);
@ -73,7 +61,7 @@ export async function loadLazyChunks() {
const shouldForceDefer = false;
await promiseAllSettledBatched(Array.from(lazyChunks).map(([, rawChunkIds, entryPoint]) => async () => {
await Promise.all(Array.from(lazyChunks).map(async ([, rawChunkIds, entryPoint]) => {
const chunkIds = rawChunkIds
?.matchAll(Webpack.ChunkIdsRegex)
.map(m => {
@ -124,9 +112,9 @@ export async function loadLazyChunks() {
}));
// Loads all found valid chunk groups
await promiseAllSettledBatched(
await Promise.all(
Array.from(validChunkGroups)
.map(([chunkIds]) => () =>
.map(([chunkIds]) =>
Promise.all(chunkIds.map(id => wreq.e(id)))
)
);
@ -202,7 +190,7 @@ export async function loadLazyChunks() {
return !(validChunks.has(id) || invalidChunks.has(id));
});
await promiseAllSettledBatched(chunksLeft.map(id => async () => queue(async () => {
await Promise.all(chunksLeft.map(async id => queue(async () => {
const isWorkerAsset = await fetch(wreq.p + wreq.u(id))
.then(r => r.text())
.then(t => /importScripts\(|self\.postMessage/.test(t));