()
| 488 | } |
| 489 | |
| 490 | get css() { |
| 491 | if (this._css) return this._css; |
| 492 | let css = fs.readFileSync( |
| 493 | path.resolve( |
| 494 | this._basePath, |
| 495 | /** @type {string} */ (this._element.href) |
| 496 | .replace(/^https:\/\/test\.cases\/path\//, "") |
| 497 | .replace(/^https:\/\/example\.com\//, "") |
| 498 | .split("?")[0] // Remove query parameters (e.g., ?hmr=timestamp) |
| 499 | ), |
| 500 | "utf8" |
| 501 | ); |
| 502 | |
| 503 | css = css.replace(/@import url\("([^"]+)"\);/g, (match, url) => { |
| 504 | if (!/^https:\/\/test\.cases\/path\//.test(url)) { |
| 505 | return `@import url("${url}");`; |
| 506 | } |
| 507 | |
| 508 | if (url.startsWith("#")) { |
| 509 | return url; |
| 510 | } |
| 511 | |
| 512 | return fs.readFileSync( |
| 513 | path.resolve( |
| 514 | this._basePath, |
| 515 | url.replace(/^https:\/\/test\.cases\/path\//, "") |
| 516 | ), |
| 517 | "utf8" |
| 518 | ); |
| 519 | }); |
| 520 | |
| 521 | return css; |
| 522 | } |
| 523 | |
| 524 | get cssRules() { |
| 525 | if (this._cssRules) return this._cssRules; |
no test coverage detected