( ctx: ExternalAssetContext, css: string, referrerAbsDir: string, entryPath: string, )
| 228 | } |
| 229 | |
| 230 | function rewriteCssUrls( |
| 231 | ctx: ExternalAssetContext, |
| 232 | css: string, |
| 233 | referrerAbsDir: string, |
| 234 | entryPath: string, |
| 235 | ): { css: string; modified: boolean } { |
| 236 | let modified = false; |
| 237 | const rewritten = css.replace(CSS_URL_RE, (full, quote: string, rawUrl: string) => { |
| 238 | const archivePath = tryResolveExternal(ctx, (rawUrl || "").trim(), referrerAbsDir); |
| 239 | if (!archivePath) return full; |
| 240 | modified = true; |
| 241 | return `url(${quote || ""}${posix.relative(posix.dirname(entryPath), archivePath)}${quote || ""})`; |
| 242 | }); |
| 243 | return { css: rewritten, modified }; |
| 244 | } |
| 245 | |
| 246 | function rewriteHtmlAttributes( |
| 247 | ctx: ExternalAssetContext, |
no test coverage detected