(
cacheKey: string,
identityPath: string,
fingerprint: string | null,
)
| 437 | } |
| 438 | |
| 439 | async function getCachedTransformedFile( |
| 440 | cacheKey: string, |
| 441 | identityPath: string, |
| 442 | fingerprint: string | null, |
| 443 | ): Promise<EmittedFile | null> { |
| 444 | if (!resolvedOptions.cache) return null |
| 445 | |
| 446 | let file = await resolvedOptions.cache.get(cacheKey) |
| 447 | if (!file) return null |
| 448 | |
| 449 | let body = new Uint8Array(await file.arrayBuffer()) |
| 450 | let metadata = |
| 451 | transformedAssetMetadataByCacheKey.get(cacheKey) ?? |
| 452 | (await createEmittedFileMetadata(body, { |
| 453 | extension: path.extname(file.name).toLowerCase(), |
| 454 | filePath: identityPath, |
| 455 | fingerprint, |
| 456 | })) |
| 457 | |
| 458 | rememberTransformedAssetMetadata(cacheKey, identityPath, metadata) |
| 459 | |
| 460 | return { |
| 461 | body, |
| 462 | ...metadata, |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | async function setCachedTransformedFile( |
| 467 | cacheKey: string, |
no test coverage detected
searching dependent graphs…