diff options
Diffstat (limited to '.github/scripts/bundle-size.mjs')
-rw-r--r-- | .github/scripts/bundle-size.mjs | 8 |
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, |