From 8080c9cf03fba501944de39346f402ec922af681 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 2 May 2026 07:38:08 +0100 Subject: [PATCH] refactor: hide npm pack budget helpers --- scripts/lib/npm-pack-budget.d.mts | 10 ---------- scripts/lib/npm-pack-budget.mjs | 6 +++--- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/scripts/lib/npm-pack-budget.d.mts b/scripts/lib/npm-pack-budget.d.mts index f38b9975be4..8a3b3a9916e 100644 --- a/scripts/lib/npm-pack-budget.d.mts +++ b/scripts/lib/npm-pack-budget.d.mts @@ -3,16 +3,6 @@ export type NpmPackBudgetResult = { unpackedSize?: number; }; -export declare const NPM_PACK_UNPACKED_SIZE_BUDGET_BYTES: number; - -export declare function formatMiB(bytes: number): string; - -export declare function formatPackUnpackedSizeBudgetError(params: { - budgetBytes?: number; - label: string; - unpackedSize: number; -}): string; - export declare function collectPackUnpackedSizeErrors( results: Iterable, options?: { diff --git a/scripts/lib/npm-pack-budget.mjs b/scripts/lib/npm-pack-budget.mjs index b1edd43de8a..7798ce0e55d 100644 --- a/scripts/lib/npm-pack-budget.mjs +++ b/scripts/lib/npm-pack-budget.mjs @@ -3,9 +3,9 @@ // dependencies, including crypto wasm, so packaged installs do not miss Docker // and gateway runtime dependencies. Keep the budget below the 2026.3.12 bloat // level while allowing that mirrored runtime surface. -export const NPM_PACK_UNPACKED_SIZE_BUDGET_BYTES = 202 * 1024 * 1024; +const NPM_PACK_UNPACKED_SIZE_BUDGET_BYTES = 202 * 1024 * 1024; -export function formatMiB(bytes) { +function formatMiB(bytes) { return `${(bytes / (1024 * 1024)).toFixed(1)} MiB`; } @@ -13,7 +13,7 @@ function resolvePackResultLabel(entry, index) { return entry.filename?.trim() || `pack result #${index + 1}`; } -export function formatPackUnpackedSizeBudgetError(params) { +function formatPackUnpackedSizeBudgetError(params) { const budgetBytes = params.budgetBytes ?? NPM_PACK_UNPACKED_SIZE_BUDGET_BYTES; return [ `${params.label} unpackedSize ${params.unpackedSize} bytes (${formatMiB(params.unpackedSize)}) exceeds budget ${budgetBytes} bytes (${formatMiB(budgetBytes)}).`,