Skip to content

fix(compiler): restore Windows path portability - #330

Draft
Chronicle-IRAS wants to merge 2 commits into
pocket-stack:mainfrom
Chronicle-IRAS:codex/fix-compiler-windows-portability
Draft

fix(compiler): restore Windows path portability#330
Chronicle-IRAS wants to merge 2 commits into
pocket-stack:mainfrom
Chronicle-IRAS:codex/fix-compiler-windows-portability

Conversation

@Chronicle-IRAS

Copy link
Copy Markdown

Summary

Restore Windows-safe compiler path handling and add regression coverage
for compiler portability.

Problem

PocketJS compiler code paths were mixing URL pathname semantics with
filesystem path consumers.

On Windows, URL.pathname can produce paths like:

/C:/...

which are not valid native filesystem paths for Bun filesystem APIs.

Compiler path matching also assumed / separators, and JSXText comparison
did not account for CRLF normalization performed by Babel.

Root cause

Filesystem paths, URL paths, and module resolution paths were treated as
the same representation.

Some portability handling previously introduced for Windows was lost during
later compiler changes, allowing these assumptions to return.

Changes

  • Use fileURLToPath for compiler-owned filesystem paths.
  • Keep compiler source hashing in URL pathname space where required.
  • Normalize Windows separators for compiler path matching.
  • Fix generated-style path detection on Windows.
  • Normalize JSXText CRLF comparison without changing output text or
    allowing HTML entities.
  • Add compiler portability regression tests.

Historical context

Related:

#122 introduced broader Windows portability fixes.

#193 later addressed overlapping compiler file URL handling but was closed
without merging.

This PR revisits the issue against current main and additionally covers
current compiler registry paths, separator handling, generated-style build
walking, CRLF behavior, and regression tests.

The public record does not state why #193 was closed.

Validation

Validated on Windows:

  • git diff --check
  • compiler portability regression tests
  • bun run test:tailwind
  • bun run dev
  • Browser host HTTP validation
  • Solid build
  • Vue Vapor build
  • Octane build

Regression coverage includes:

  • filesystem path consumers
  • cache/runtime paths
  • Windows separator handling
  • LF/CRLF JSXText behavior
  • entity rejection behavior

Known limitations

  • Repository currently has no Windows CI runner.
  • Some existing Windows baseline tests outside this patch still fail due
    to unrelated pathname assumptions and missing platform tools.
  • PSP/Vita/Playdate/device toolchains were not tested.

XLYXH added 2 commits August 23, 2026 15:56
Restore compiler filesystem path handling that was lost during later compiler refactors.

Use fileURLToPath for compiler-owned filesystem paths while keeping URL pathname semantics where required. Normalize Windows separators in path matching logic and preserve JSXText CRLF behavior without weakening entity checks.
Add regression coverage for compiler filesystem paths, Windows separator handling, and JSXText line-ending behavior.

Ensure future compiler changes do not reintroduce unsafe URL pathname assumptions on Windows.
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