ci: fix resource exhaustion errors
This commit is contained in:
parent
2448edfc48
commit
2f129373ca
4 changed files with 36 additions and 17 deletions
8
.github/workflows/reportBrokenPlugins.yml
vendored
8
.github/workflows/reportBrokenPlugins.yml
vendored
|
|
@ -44,12 +44,6 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
pnpm install --frozen-lockfile
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Install Google Chrome
|
|
||||||
id: setup-chrome
|
|
||||||
uses: browser-actions/setup-chrome@82b9ce628cc5595478a9ebadc480958a36457dc2
|
|
||||||
with:
|
|
||||||
chrome-version: stable
|
|
||||||
|
|
||||||
- name: Build Vencord Reporter Version
|
- name: Build Vencord Reporter Version
|
||||||
run: pnpm buildReporter
|
run: pnpm buildReporter
|
||||||
|
|
||||||
|
|
@ -57,7 +51,7 @@ jobs:
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
run: |
|
run: |
|
||||||
export PATH="$PWD/node_modules/.bin:$PATH"
|
export PATH="$PWD/node_modules/.bin:$PATH"
|
||||||
export CHROMIUM_BIN=${{ steps.setup-chrome.outputs.chrome-path }}
|
export CHROMIUM_BIN=/usr/bin/google-chrome
|
||||||
|
|
||||||
esbuild scripts/generateReport.ts > dist/report.mjs
|
esbuild scripts/generateReport.ts > dist/report.mjs
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@
|
||||||
"highlight.js": "11.11.1",
|
"highlight.js": "11.11.1",
|
||||||
"html-minifier-terser": "^7.2.0",
|
"html-minifier-terser": "^7.2.0",
|
||||||
"moment": "^2.22.2",
|
"moment": "^2.22.2",
|
||||||
|
"p-limit": "^7.3.0",
|
||||||
"puppeteer-core": "^24.30.0",
|
"puppeteer-core": "^24.30.0",
|
||||||
"standalone-electron-types": "^34.2.0",
|
"standalone-electron-types": "^34.2.0",
|
||||||
"stylelint": "^16.25.0",
|
"stylelint": "^16.25.0",
|
||||||
|
|
|
||||||
20
pnpm-lock.yaml
generated
20
pnpm-lock.yaml
generated
|
|
@ -98,6 +98,9 @@ importers:
|
||||||
moment:
|
moment:
|
||||||
specifier: ^2.22.2
|
specifier: ^2.22.2
|
||||||
version: 2.30.1
|
version: 2.30.1
|
||||||
|
p-limit:
|
||||||
|
specifier: ^7.3.0
|
||||||
|
version: 7.3.0
|
||||||
puppeteer-core:
|
puppeteer-core:
|
||||||
specifier: ^24.30.0
|
specifier: ^24.30.0
|
||||||
version: 24.30.0
|
version: 24.30.0
|
||||||
|
|
@ -966,6 +969,7 @@ packages:
|
||||||
basic-ftp@5.0.5:
|
basic-ftp@5.0.5:
|
||||||
resolution: {integrity: sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==}
|
resolution: {integrity: sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==}
|
||||||
engines: {node: '>=10.0.0'}
|
engines: {node: '>=10.0.0'}
|
||||||
|
deprecated: Security vulnerability fixed in 5.2.0, please upgrade
|
||||||
|
|
||||||
boolbase@1.0.0:
|
boolbase@1.0.0:
|
||||||
resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==}
|
resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==}
|
||||||
|
|
@ -2154,6 +2158,10 @@ packages:
|
||||||
resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
|
resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
|
p-limit@7.3.0:
|
||||||
|
resolution: {integrity: sha512-7cIXg/Z0M5WZRblrsOla88S4wAK+zOQQWeBYfV3qJuJXMr+LnbYjaadrFaS0JILfEDPVqHyKnZ1Z/1d6J9VVUw==}
|
||||||
|
engines: {node: '>=20'}
|
||||||
|
|
||||||
p-locate@5.0.0:
|
p-locate@5.0.0:
|
||||||
resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==}
|
resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
@ -2814,6 +2822,10 @@ packages:
|
||||||
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
|
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
|
yocto-queue@1.2.2:
|
||||||
|
resolution: {integrity: sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==}
|
||||||
|
engines: {node: '>=12.20'}
|
||||||
|
|
||||||
zip-local@0.3.5:
|
zip-local@0.3.5:
|
||||||
resolution: {integrity: sha512-GRV3D5TJY+/PqyeRm5CYBs7xVrKTKzljBoEXvocZu0HJ7tPEcgpSOYa2zFIsCZWgKWMuc4U3yMFgFkERGFIB9w==}
|
resolution: {integrity: sha512-GRV3D5TJY+/PqyeRm5CYBs7xVrKTKzljBoEXvocZu0HJ7tPEcgpSOYa2zFIsCZWgKWMuc4U3yMFgFkERGFIB9w==}
|
||||||
|
|
||||||
|
|
@ -3193,7 +3205,7 @@ snapshots:
|
||||||
|
|
||||||
'@types/react-dom@18.3.1':
|
'@types/react-dom@18.3.1':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/react': 18.3.1
|
'@types/react': 19.0.12
|
||||||
|
|
||||||
'@types/react-dom@19.0.4(@types/react@19.0.12)':
|
'@types/react-dom@19.0.4(@types/react@19.0.12)':
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
@ -4899,6 +4911,10 @@ snapshots:
|
||||||
dependencies:
|
dependencies:
|
||||||
yocto-queue: 0.1.0
|
yocto-queue: 0.1.0
|
||||||
|
|
||||||
|
p-limit@7.3.0:
|
||||||
|
dependencies:
|
||||||
|
yocto-queue: 1.2.2
|
||||||
|
|
||||||
p-locate@5.0.0:
|
p-locate@5.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
p-limit: 3.1.0
|
p-limit: 3.1.0
|
||||||
|
|
@ -5726,6 +5742,8 @@ snapshots:
|
||||||
|
|
||||||
yocto-queue@0.1.0: {}
|
yocto-queue@0.1.0: {}
|
||||||
|
|
||||||
|
yocto-queue@1.2.2: {}
|
||||||
|
|
||||||
zip-local@0.3.5:
|
zip-local@0.3.5:
|
||||||
dependencies:
|
dependencies:
|
||||||
async: 1.5.2
|
async: 1.5.2
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import { canonicalizeMatch } from "@utils/patches";
|
||||||
import { ModuleFactory } from "@vencord/discord-types/webpack";
|
import { ModuleFactory } from "@vencord/discord-types/webpack";
|
||||||
import * as Webpack from "@webpack";
|
import * as Webpack from "@webpack";
|
||||||
import { wreq } from "@webpack";
|
import { wreq } from "@webpack";
|
||||||
|
import pLimit from "p-limit";
|
||||||
import { AnyModuleFactory } from "webpack";
|
import { AnyModuleFactory } from "webpack";
|
||||||
|
|
||||||
function getWebpackChunkMap() {
|
function getWebpackChunkMap() {
|
||||||
|
|
@ -31,6 +32,7 @@ function getWebpackChunkMap() {
|
||||||
|
|
||||||
export async function loadLazyChunks() {
|
export async function loadLazyChunks() {
|
||||||
const LazyChunkLoaderLogger = new Logger("LazyChunkLoader");
|
const LazyChunkLoaderLogger = new Logger("LazyChunkLoader");
|
||||||
|
const queue = pLimit(50);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LazyChunkLoaderLogger.log("Loading all chunks...");
|
LazyChunkLoaderLogger.log("Loading all chunks...");
|
||||||
|
|
@ -59,11 +61,15 @@ export async function loadLazyChunks() {
|
||||||
|
|
||||||
const shouldForceDefer = false;
|
const shouldForceDefer = false;
|
||||||
|
|
||||||
await Promise.all(Array.from(lazyChunks).map(async ([, rawChunkIds, entryPoint]) => {
|
await Promise.all(Array.from(lazyChunks).map(async ([, rawChunkIds, entryPoint]) => queue(async () => {
|
||||||
const chunkIds = rawChunkIds ? Array.from(rawChunkIds.matchAll(Webpack.ChunkIdsRegex)).map(m => {
|
const chunkIds = rawChunkIds
|
||||||
const numChunkId = Number(m[1]);
|
?.matchAll(Webpack.ChunkIdsRegex)
|
||||||
return Number.isNaN(numChunkId) ? m[1] : numChunkId;
|
.map(m => {
|
||||||
}) : [];
|
const numChunkId = Number(m[1]);
|
||||||
|
return Number.isNaN(numChunkId) ? m[1] : numChunkId;
|
||||||
|
})
|
||||||
|
.toArray()
|
||||||
|
?? [];
|
||||||
|
|
||||||
if (chunkIds.length === 0) {
|
if (chunkIds.length === 0) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -101,13 +107,13 @@ export async function loadLazyChunks() {
|
||||||
const numEntryPoint = Number(entryPoint);
|
const numEntryPoint = Number(entryPoint);
|
||||||
validChunkGroups.add([chunkIds, Number.isNaN(numEntryPoint) ? entryPoint : numEntryPoint]);
|
validChunkGroups.add([chunkIds, Number.isNaN(numEntryPoint) ? entryPoint : numEntryPoint]);
|
||||||
}
|
}
|
||||||
}));
|
})));
|
||||||
|
|
||||||
// Loads all found valid chunk groups
|
// Loads all found valid chunk groups
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
Array.from(validChunkGroups)
|
Array.from(validChunkGroups)
|
||||||
.map(([chunkIds]) =>
|
.map(([chunkIds]) =>
|
||||||
Promise.all(chunkIds.map(id => wreq.e(id)))
|
Promise.all(chunkIds.map(id => queue(() => wreq.e(id))))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -182,7 +188,7 @@ export async function loadLazyChunks() {
|
||||||
return !(validChunks.has(id) || invalidChunks.has(id));
|
return !(validChunks.has(id) || invalidChunks.has(id));
|
||||||
});
|
});
|
||||||
|
|
||||||
await Promise.all(chunksLeft.map(async id => {
|
await Promise.all(chunksLeft.map(async id => queue(async () => {
|
||||||
const isWorkerAsset = await fetch(wreq.p + wreq.u(id))
|
const isWorkerAsset = await fetch(wreq.p + wreq.u(id))
|
||||||
.then(r => r.text())
|
.then(r => r.text())
|
||||||
.then(t => /importScripts\(|self\.postMessage/.test(t));
|
.then(t => /importScripts\(|self\.postMessage/.test(t));
|
||||||
|
|
@ -191,7 +197,7 @@ export async function loadLazyChunks() {
|
||||||
if (!isWorkerAsset) {
|
if (!isWorkerAsset) {
|
||||||
await wreq.e(id);
|
await wreq.e(id);
|
||||||
}
|
}
|
||||||
}));
|
})));
|
||||||
|
|
||||||
LazyChunkLoaderLogger.log("Finished loading all chunks!");
|
LazyChunkLoaderLogger.log("Finished loading all chunks!");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue