From 7b6fc4796ed9c0e59488be1172a52f338ce7454a Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 24 Sep 2026 14:43:33 +0900 Subject: [PATCH] perf(file-transfer): stop exporting helpers no other module imports (Q-B) The reference-runtime measurement exposes every export of every catalog module through a namespace object, so an export nobody imports still costs bytes. Made module-private (only used inside their own file, not by src, tests or scripts): - download-input-validation.ts: SHA256, snapshotDownloadSource, validPresignedCapabilityForInput, safeOpaqueId - checkpoint-schema.ts: RECEIPT_TOKEN, isUploadPartDescriptor, partMatchesFingerprint Barrel (index.ts) exports are untouched. file-transfer reference runtime: 55382 -> 55306 gzip bytes. Other reference runtimes unchanged. Verified: check:architecture, check:types:app, check:types:test, lint, test:unit, test:component, check:adapter-inventory. Co-Authored-By: Claude Opus 5.5 --- src/adapters/browser-files/download-input-validation.ts | 8 ++++---- .../resumable-upload/checkpoint-schema.ts | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/adapters/browser-files/download-input-validation.ts b/src/adapters/browser-files/download-input-validation.ts index 4b278218..5556f6ac 100644 --- a/src/adapters/browser-files/download-input-validation.ts +++ b/src/adapters/browser-files/download-input-validation.ts @@ -38,7 +38,7 @@ export type DownloadInputValidationOptions = Readonly<{ now?: () => number; }>; -export const SHA256 = /^[a-f0-9]{64}$/i; +const SHA256 = /^[a-f0-9]{64}$/i; export type DeliveryRequest = Parameters[0]; @@ -73,7 +73,7 @@ export function activeDeliveryInput( }); } -export function snapshotDownloadSource( +function snapshotDownloadSource( source: DownloadSource, ): DownloadSource { const kind = source.kind; @@ -230,7 +230,7 @@ export function validPresignedByteSource( ); } -export function validPresignedCapabilityForInput( +function validPresignedCapabilityForInput( capability: PresignedDownloadCapability, resourceId: string, mediaType: string, @@ -354,7 +354,7 @@ export function resolveBrowserManagedTarget( ); } -export function safeOpaqueId(value: unknown): value is string { +function safeOpaqueId(value: unknown): value is string { if (typeof value !== "string") return false; if (value.length === 0 || value.length > 256) return false; for (const character of value) { diff --git a/src/adapters/browser-transfer/resumable-upload/checkpoint-schema.ts b/src/adapters/browser-transfer/resumable-upload/checkpoint-schema.ts index 9c00647a..6311f51a 100644 --- a/src/adapters/browser-transfer/resumable-upload/checkpoint-schema.ts +++ b/src/adapters/browser-transfer/resumable-upload/checkpoint-schema.ts @@ -17,7 +17,7 @@ export const SAFE_OPAQUE_ID = /^[A-Za-z0-9_-]{8,512}$/u; */ export const SAFE_TRANSFER_ID = /^[A-Za-z0-9_-][A-Za-z0-9._:-]{0,511}$/u; export const SHA256_HEX = /^[a-f0-9]{64}$/u; -export const RECEIPT_TOKEN = +const RECEIPT_TOKEN = /^[A-Za-z0-9][A-Za-z0-9._~:+/=-]{0,511}$/u; export const MEDIA_TYPE = /^[a-z0-9!#$&^_.+-]{1,63}\/[a-z0-9!#$&^_.+-]{1,63}$/u; @@ -67,7 +67,7 @@ export function isUploadFileFingerprint( ); } -export function isUploadPartDescriptor( +function isUploadPartDescriptor( value: unknown, ): value is UploadPartDescriptor { if (!exactRecord(value, PART_KEYS)) return false; @@ -138,7 +138,7 @@ export function isResumableUploadCheckpoint( return true; } -export function partMatchesFingerprint( +function partMatchesFingerprint( part: UploadPartDescriptor, fingerprint: UploadFileFingerprint, ): boolean {