( item: PendingStaticFile, outDir: string, )
| 559 | } |
| 560 | |
| 561 | export async function prepareStaticFile( |
| 562 | item: PendingStaticFile, |
| 563 | outDir: string, |
| 564 | ): Promise< |
| 565 | { |
| 566 | name: string; |
| 567 | hash: string; |
| 568 | filePath: string; |
| 569 | contentType: string; |
| 570 | immutable?: boolean; |
| 571 | } |
| 572 | > { |
| 573 | const file = await Deno.open(item.filePath); |
| 574 | const hash = item.hash ? item.hash : await hashContent(file.readable); |
| 575 | const encodedPathname = systemPathToUrlEncoded(item.pathname); |
| 576 | |
| 577 | return { |
| 578 | name: encodedPathname, |
| 579 | hash, |
| 580 | filePath: toPosix( |
| 581 | path.isAbsolute(item.filePath) |
| 582 | ? path.relative(outDir, item.filePath) |
| 583 | : item.filePath, |
| 584 | ), |
| 585 | contentType: getContentType(item.filePath), |
| 586 | immutable: item.immutable, |
| 587 | }; |
| 588 | } |
| 589 | |
| 590 | export function generateServerEntry( |
| 591 | options: { |
no test coverage detected