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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
cc37f577e3
commit
7b6fc4796e
@@ -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<DownloadDeliveryPort["deliver"]>[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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user