Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: inspector read file for vite 3.1 (#423)
* fix: load inspector files with a clean filename; update lock and types * fix: one clean is enough * docs: remove comment
- Loading branch information
Showing
5 changed files
with
69 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@sveltejs/vite-plugin-svelte': patch | ||
--- | ||
|
||
fix svelte-inspector import for vite 3.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const FS_PREFIX = `/@fs/`; | ||
const IS_WINDOWS = process.platform === 'win32'; | ||
const queryRE = /\?.*$/s; | ||
const hashRE = /#.*$/s; | ||
|
||
export function idToFile(id: string): string { | ||
// strip /@fs/ but keep leading / on non-windows | ||
if (id.startsWith(FS_PREFIX)) { | ||
id = id = id.slice(IS_WINDOWS ? FS_PREFIX.length : FS_PREFIX.length - 1); | ||
} | ||
// strip query and hash | ||
return id.replace(hashRE, '').replace(queryRE, ''); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.