mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 17:50:45 +00:00
refactor: hide npm pack budget helpers
This commit is contained in:
@@ -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<NpmPackBudgetResult>,
|
||||
options?: {
|
||||
|
||||
@@ -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)}).`,
|
||||
|
||||
Reference in New Issue
Block a user