Skip to content

Commit e041b2c

Browse files
committed
docs(rfc): simplify Windows bin lookup to vp.cmd only
Package managers create `.cmd` shims on Windows for JS-based bins. Trying `vp.exe` and bare `vp` as fallbacks is over-engineered noise: - `vp.exe` would only be created for native binaries; `vp` is a JS shim, so no package manager produces a .exe. - Bare `vp` (no extension) on Windows isn't materialized on disk; it works under shell environments via PATHEXT, but existsSync checks filesystem entries and would miss it anyway. Collapses the candidates loop to a single conditional path, drops the "`.cmd`/`.exe`" mention from the prose.
1 parent 401eb74 commit e041b2c

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

rfcs/editor-extension-vite-plus-detection.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,8 @@ function resolveVpAt(dir: string): string | null {
202202
} catch {
203203
return null;
204204
}
205-
const binDir = join(dir, 'node_modules', '.bin');
206-
const candidates =
207-
process.platform === 'win32'
208-
? [join(binDir, 'vp.cmd'), join(binDir, 'vp.exe'), join(binDir, 'vp')]
209-
: [join(binDir, 'vp')];
210-
for (const candidate of candidates) {
211-
if (existsSync(candidate)) return candidate;
212-
}
213-
return null;
205+
const shim = join(dir, 'node_modules', '.bin', process.platform === 'win32' ? 'vp.cmd' : 'vp');
206+
return existsSync(shim) ? shim : null;
214207
}
215208

216209
export function detectVitePlusProjectSync(start: string): DetectResult | null {
@@ -267,9 +260,9 @@ same everywhere. The path returned for spawning differs by extension,
267260
mirroring whatever pattern that extension already uses for
268261
`oxlint`/`oxfmt`:
269262

270-
- **`oxc-vscode`, `coc-oxc`** — target `node_modules/.bin/vp` (with
271-
`.cmd`/`.exe` Windows variants), the same shim path they already
272-
use for `oxlint`. Call the detector before the existing
263+
- **`oxc-vscode`, `coc-oxc`** — target `node_modules/.bin/vp`
264+
(`vp.cmd` on Windows), the same shim path they already use for
265+
`oxlint`. Call the detector before the existing
273266
`findBinary("oxlint" | "oxfmt", ...)` chain. Do **not** parameterize
274267
the existing chain with `"vp"` as a target — its
275268
`searchSettingsBin`, `searchGlobalNodeModulesBin`, `searchEnvPath`,

0 commit comments

Comments
 (0)