Repository navigation
Commit ab73bf7
authored
chore(void): drop no-op backslash normalization on pathe relative() paths (#252)
## What
This removes the `.replace(/\\/g, '/')` calls that were applied to the
results of pathe `relative()` and `join()` across seven files. The
source files are codegen/env-types.ts, codegen/project-tsconfig.ts,
drizzle/config.ts, drizzle/discover.ts, ssr/entry.ts, and sveltekit.ts,
and the same no-op appeared in a test/unit/prerender.test.ts assertion,
for nine occurrences in total.
## Why
pathe returns POSIX forward slash paths on every platform, including
Windows, so calling `.replace(/\\/g, '/')` on a pathe `relative()` or
`join()` result can never match anything. It is dead defensive code.
codegen/route-types.ts and codegen/queue-types.ts already follow this
convention and omit the call, so this brings the rest of the package in
line.
## Safety
There is no behavior change. It was verified empirically that pathe
`relative()` returns forward slashes for both POSIX and Windows
backslash inputs, so `relative('C:\\a\\b\\.void',
'C:\\a\\b\\src\\env.ts')` returns `../src/env.ts`. The six other
`.replace(/\\/g, '/')` calls in the package operate on raw path
parameters rather than pathe output. Those live in shared/utils.ts (the
slash helper), router/parse-filename.ts, router/websocket.ts,
cli/package.ts, and prerender.ts, and they are intentionally left
untouched because they normalize real OS separators.
## Verification
The void package typechecks cleanly with tsgo and passes oxlint. The net
change is nine insertions and nine deletions across seven files with no
functional effect.1 parent 9284ea2 commit ab73bf7
7 files changed
Lines changed: 9 additions & 9 deletions
File tree
- packages/void
- src
- codegen
- drizzle
- ssr
- test/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
| 67 | + | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
0 commit comments