webui(build): gulp html modifications should not happen in parallel

Promise.all() does not handle array members in sequence
This commit is contained in:
Maxim Prokhorov
2025-04-14 04:12:52 +03:00
parent 93d7d3986b
commit 68631fbbcd
12 changed files with 16654 additions and 17220 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -504,7 +504,11 @@ function modifyHtml(handlers) {
const dom = new JSDOM(source.contents, {includeNodeLocations: true});
const results = await Promise.all(handlers.map((x) => x(dom)));
let results = [];
for (const handler of handlers) {
results.push(await Promise.resolve(handler(dom)));
}
if (results.some((x) => x)) {
source.contents = Buffer.from(dom.serialize());
}

View File

@@ -1,4 +1,3 @@
/** @import { Plugin as EsbuildPlugin } from 'esbuild' */
/** @import { Modules } from './preset.mjs' */
/** @import { JSDOM } from 'jsdom' */
@@ -162,7 +161,7 @@ export async function maybeInline(dom, elem, {resolve, load, post} = {}) {
* as the result, no code from the module should be bundled into the output when module was not initialized
* however, since light module depends on iro.js and does not have `sideEffects: false` in package.json, it would still get bundled because of top-level import
* (...and since module modifying something in global scope is not unheard of...)
* @returns {EsbuildPlugin}
* @returns {import('esbuild').Plugin}
*/
export function forceNoSideEffects() {
return {