fix(compiler): restore Windows path portability - #330
Draft
Chronicle-IRAS wants to merge 2 commits into
Draft
Conversation
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.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 comparisondid 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
allowing HTML entities.
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:
Regression coverage includes:
Known limitations
to unrelated pathname assumptions and missing platform tools.