Skip to content

refactor: replace pathe with pathslash - #288

Merged
Brooooooklyn merged 4 commits into
mainfrom
07-24-refactor_replace_pathe_with_pathslash
Jul 28, 2026
Merged

Brooooooklyn merged 4 commits into
mainfrom
07-24-refactor_replace_pathe_with_pathslash

Conversation

@shulaoda

Copy link
Copy Markdown
Member

Related to #287

Swap pathe for pathslash across the workspace. pathslash re-exports the same node:path API with forward-slash normalization but does not carry pathe's Windows correctness bugs.

@socket-security

socket-security Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpathslash@​0.1.0721008888100

View full report

@Brooooooklyn
Brooooooklyn merged commit adf0eed into main Jul 28, 2026
7 checks passed
@Brooooooklyn
Brooooooklyn deleted the 07-24-refactor_replace_pathe_with_pathslash branch July 28, 2026 03:44
Brooooooklyn pushed a commit that referenced this pull request Jul 29, 2026
Fixes #285. Third task of #287.

## Problem

`runNodePrerenderRunner()` writes `.void/prerender-runner.mjs` into the
consumer app and executes it as a separate Node process. The generated
file imported the path library as a bare specifier:

```js
import { join, dirname } from "pathslash"; // previously "pathe"
```

Bare specifiers in `<app>/.void/` resolve from the application, not from
the installed `void` package. Under strict pnpm, any `target: "node"` +
`output: "static"` app that doesn't install the path library directly
fails:

```
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'pathslash' imported from <app>/.void/prerender-runner.mjs
```

The `pathe` → `pathslash` swap (#288) did not fix this — it only changed
the name of the missing package.

## Fix

The runner only handles local filesystem paths, so it now imports from
the Node built-in:

```js
import { dirname, join } from "node:path";
```

## Why CI never caught this

`playground/node-static` declared the path library (`pathe`, then
`pathslash`) as its own devDependency — the exact workaround reported in
#285, baked into the test fixture. The runner's bare import always
resolved inside the monorepo, so `node-static.test.ts` stayed green
while every real strict-pnpm consumer broke.

This PR removes that dependency so the playground resolves modules like
a real consumer app, turning the existing integration test into a
genuine regression test for #285. The only in-playground user of
`pathslash` was the dev-convenience `scripts/serve-static.mjs`, which
now uses `node:path` (with an oxlint exemption documenting why this
playground must not depend on `pathslash`) — it only builds local fs
paths, so no slash normalization is needed.

## Verification

| Runner import | Playground `pathslash` dep | `node-static.test.ts` |
| --------------------- | -------------------------- |
------------------------------------------- |
| `pathslash` (no fix) | present (old state) | green — bug masked |
| `pathslash` (no fix) | removed | red — `ERR_MODULE_NOT_FOUND` for the
runner |
| `node:path` (this PR) | removed | green — 13/13 pass |

Also verified: `vp lint` passes, `serve:static` smoke-tested (serves
pages, path-traversal guard intact), `void` package typecheck passes.
The lockfile change is only the dependency removal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants