(path: string)
| 687 | * encodePathLikeUrl('/path/already%20encoded') // '/path/already%20encoded' (preserved) |
| 688 | */ |
| 689 | export function encodePathLikeUrl(path: string): string { |
| 690 | // Encode whitespace and non-ASCII characters that browsers encode in URLs |
| 691 | |
| 692 | // biome-ignore lint/suspicious/noControlCharactersInRegex: intentional ASCII range check |
| 693 | // eslint-disable-next-line no-control-regex |
| 694 | if (!/\s|[^\u0000-\u007F]/.test(path)) return path |
| 695 | // biome-ignore lint/suspicious/noControlCharactersInRegex: intentional ASCII range check |
| 696 | // eslint-disable-next-line no-control-regex |
| 697 | return path.replace(/\s|[^\u0000-\u007F]/gu, encodeURIComponent) |
| 698 | } |
| 699 | |
| 700 | /** |
| 701 | * Builds the dev-mode CSS styles URL for route-scoped CSS collection. |
no test coverage detected