( absProjectDir: string, fileContents: Map<string, Buffer>, )
| 317 | * rewrite the references so the published project is self-contained. |
| 318 | */ |
| 319 | export function localizeExternalAssets( |
| 320 | absProjectDir: string, |
| 321 | fileContents: Map<string, Buffer>, |
| 322 | ): number { |
| 323 | const ctx: ExternalAssetContext = { |
| 324 | absProjectDir, |
| 325 | fileContents, |
| 326 | externalMap: new Map(), |
| 327 | usedArchivePaths: new Set(), |
| 328 | }; |
| 329 | |
| 330 | for (const [entryPath, content] of [...fileContents.entries()]) { |
| 331 | if (entryPath.startsWith(EXT_ASSETS_PREFIX + "/")) continue; |
| 332 | if (entryPath.endsWith(".html") || entryPath.endsWith(".htm")) { |
| 333 | localizeHtmlEntry(ctx, entryPath, content); |
| 334 | } else if (entryPath.endsWith(".css")) { |
| 335 | localizeCssEntry(ctx, entryPath, content); |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | return ctx.externalMap.size; |
| 340 | } |
| 341 | |
| 342 | export function createPublishArchive(projectDir: string): PublishArchiveResult { |
| 343 | const absProjectDir = resolve(projectDir); |
no test coverage detected