Skip to content

fix(core): normalize Astro compiler filenames for Windows declaration builds - #4771

Open
emdash-autofix[bot] wants to merge 1 commit into
mainfrom
emdash-bot/issue-4770
Open

emdash-autofix[bot] wants to merge 1 commit into
mainfrom
emdash-bot/issue-4770

Conversation

@emdash-autofix

@emdash-autofix emdash-autofix Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Normalizes backslashes only in the filename passed to Astro's TSX compiler during Core UI declaration generation. Native paths remain unchanged for file reads, declaration writes, and TypeScript. Astro 2.13.1 embeds backslashes in external sourcemap JSON without escaping them, causing the reported JSON parsing error.

Extracts the compiler invocation into a build-script helper and tests it against the real compiler with Windows drive, UNC, forward-slash drive, and POSIX filenames. Before normalization, the two backslash cases fail with the reported JSON error; afterward all four pass.

Type of change

  • Bug fix
  • Feature (requires an accepted feature plan or RFC)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Your connection to this change

Prepared by the project-operated autofix bot through auto-intake for the concrete reproduction in #4770, under the AI policy's autofix exception.

  • I use EmDash and ran into the problem this PR addresses
  • I maintain a tool, dependency, or service that EmDash uses, and this change concerns that integration
  • A Maintainer approved this specific change before I opened the PR

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable)
  • I have added and reviewed the user-facing changeset (if this PR changes a published package)
  • New features link to their merged design PR
  • I have included screenshots below if this PR changes the UI

No UI or public API changes; localization, screenshots, and feature designs do not apply. No changeset: this is build tooling only; the build script is not shipped and declaration contents are unchanged.

AI assistance disclosure

  • This PR includes AI-generated code or text — model/tool: cloudflare-ai-gateway:gpt-6.1-sol via the EmDash bot (Pi Durable)

Screenshots / test output

Screenshots: Not applicable.

Verified on Linux with Node v24.22.2:

  • Reporter reproduction: backslash filename throws Bad escaped character in JSON; slash filename succeeds.
  • pnpm --filter emdash exec vitest run tests/unit/build-ui-types.test.ts: 4 passed (2 backslash cases failed before the fix).
  • pnpm format: passed.
  • pnpm lint:quick: 0 diagnostics.
  • pnpm build: passed.
  • pnpm --filter emdash typecheck: passed after the root build supplied dependency declarations.
  • Core build generated all four nonempty UI declaration files.
  • git diff HEAD --check: passed.

Native Windows and macOS builds have not been run; Windows and UNC filename strings are exercised on Linux without mocking the compiler. Full workspace typecheck and type-aware lint are left to CI.

Closes #4770

The EmDash bot took this issue on automatically when it was opened; no maintainer has assigned it yet.

… builds

Normalize only Astro's compiler filename to forward slashes, preserving native filesystem and TypeScript paths. Reproduced the reported JSON escaping error on Node 24 and added four real-compiler regression cases covering Windows drive, UNC, forward-slash drive, and POSIX filenames. All four now pass; root build, Core typecheck, format, and quick lint pass. Independent review found no blockers.

EmDash-Bot-Case: 1198246700-issue-6276493834
EmDash-Bot-Candidate: cand-1-9b9b96e210
@emdash-autofix emdash-autofix Bot added the bot:fix Assign this issue or pull request to the EmDash bot to fix label Nov 8, 2026
@emdash-autofix

emdash-autofix Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor Author

EmDash bot: Ready for human review

Plan

The four real-compiler regression cases, root build, Core typecheck, formatting, and quick lint pass. Independent review found no blockers; ready to publish.

  • Read the declaration builder and reproduce the Windows filename failure
  • Normalize compiler filenames and add regression coverage
  • Run focused checks and independent review, then publish

Status

  • Required checks passed, the review bot approved the current head, and the head merges cleanly.

Next action: A maintainer will review and approve the pull request.

Details
Candidate cand-1-9b9b96e210 (tree 61f6b72f4a58)
Published head f95d9f76ee82
Reviewer's latest review of head approved
Reporter confirmation not yet
Human approval required before merge

Required checks on the current head:

  • Typecheck: succeeded
  • Tests: succeeded
  • Smoke Tests: succeeded
  • Browser Tests: succeeded
  • Format: succeeded
  • CLAssistant: succeeded
  • Measure: succeeded

This status is generated from recorded evidence. It is not a review and contains no instructions.

@changeset-bot

changeset-bot Bot commented Nov 8, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f95d9f7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://emdash-bot-issue-4770.try.emdashcms.com, https://emdash-bot-issue-4770-emdash-playground.emdash-cms.workers.dev (commit f95d9f7)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://c94720f8.try.emdashcms.com, https://c94720f8-emdash-playground.emdash-cms.workers.dev f95d9f7 2026-11-08T22:52:07.421Z Visit the dashboard ↗

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach is sound and narrowly scoped. Only the filename passed to Astro's convertToTSX is normalized to forward slashes, which fixes the Windows sourcemap failure reported in #4770. File reads, TypeScript fileName values and .d.ts writes keep native paths. Both reviewers approved and found nothing to fix. The regression test runs the real compiler on a Windows drive path, a UNC path, a forward-slash drive path and a POSIX path, and checks map.sources. Omitting a changeset is appropriate because this is build tooling only. The review was static, and native Windows builds were not independently run.


Reviewed by anthropic/claude-opus-5-5 and openai/gpt-6.1-sol.

@pkg-pr-new

pkg-pr-new Bot commented Nov 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@4771

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@4771

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@4771

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@4771

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@4771

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@4771

emdash

npm i https://pkg.pr.new/emdash@4771

create-emdash

npm i https://pkg.pr.new/create-emdash@4771

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@4771

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@4771

@emdash-cms/plugin-test

npm i https://pkg.pr.new/@emdash-cms/plugin-test@4771

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@4771

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@4771

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@4771

@emdash-cms/registry-loader

npm i https://pkg.pr.new/@emdash-cms/registry-loader@4771

@emdash-cms/registry-moderation

npm i https://pkg.pr.new/@emdash-cms/registry-moderation@4771

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@4771

upgrade-emdash

npm i https://pkg.pr.new/upgrade-emdash@4771

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@4771

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@4771

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@4771

@emdash-cms/plugin-ai-search

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-search@4771

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@4771

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@4771

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@4771

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@4771

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@4771

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@4771

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@4771

commit: f95d9f7

@emdash-autofix emdash-autofix Bot added the triage/awaiting-reporter Fix pushed, waiting on reporter to verify label Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core bot:fix Assign this issue or pull request to the EmDash bot to fix cla: signed size/S triage/awaiting-reporter Fix pushed, waiting on reporter to verify

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Core declaration build fails on Windows paths passed to Astro convertToTSX

0 participants