summaryrefslogtreecommitdiff
path: root/.github/scripts/bundle-size.mjs
diff options
context:
space:
mode:
authorGravatar Erika <3019731+Princesseuh@users.noreply.github.com> 2023-07-18 02:17:59 +0200
committerGravatar GitHub <noreply@github.com> 2023-07-18 02:17:59 +0200
commitf14e48098a3bc74d85715b5610dbba588d4943cd (patch)
tree11284e8456c5f7f52fd37d1ad6f488133e883db9 /.github/scripts/bundle-size.mjs
parentcc0f81c040e912cff0c09e89327ef1655f96b67d (diff)
downloadastro-f14e48098a3bc74d85715b5610dbba588d4943cd.tar.gz
astro-f14e48098a3bc74d85715b5610dbba588d4943cd.tar.zst
astro-f14e48098a3bc74d85715b5610dbba588d4943cd.zip
nit: use `node:` prefix everywhere (#7692)
* nit: use `node:` prefix everywhere * nit: fs/promises too * test: workaround issue in node builtin detection
Diffstat (limited to '.github/scripts/bundle-size.mjs')
-rw-r--r--.github/scripts/bundle-size.mjs8
1 files changed, 4 insertions, 4 deletions
diff --git a/.github/scripts/bundle-size.mjs b/.github/scripts/bundle-size.mjs
index 49c3c5bed..66911eab1 100644
--- a/.github/scripts/bundle-size.mjs
+++ b/.github/scripts/bundle-size.mjs
@@ -1,5 +1,5 @@
import { build } from 'esbuild';
-import { existsSync } from 'fs';
+import { existsSync } from 'node:fs';
const CLIENT_RUNTIME_PATH = 'packages/astro/src/runtime/client/';
@@ -27,13 +27,13 @@ export default async function checkBundleSize({ github, context }) {
return file.filename.startsWith(CLIENT_RUNTIME_PATH) && file.status !== 'removed'
});
if (clientRuntimeFiles.length === 0) return;
-
+
const table = [
'| File | Old Size | New Size | Change |',
'| ---- | -------- | -------- | ------ |',
];
const output = await bundle(clientRuntimeFiles);
-
+
for (let [filename, { oldSize, newSize, sourceFile }] of Object.entries(output)) {
filename = ['idle', 'load', 'media', 'only', 'visible'].includes(filename) ? `client:${filename}` : filename;
const prefix = (newSize - oldSize) === 0 ? '' : (newSize - oldSize) > 0 ? '+ ' : '- ';
@@ -60,7 +60,7 @@ ${table.join('\n')}`,
}
async function bundle(files) {
-
+
const { metafile } = await build({
entryPoints: [...files.map(({ filename }) => filename), ...files.map(({ filename }) => `main/${filename}`).filter(f => existsSync(f))],
bundle: true,