Skip to content

fix(registry-verification): use Windows-valid synthetic URL for createRequire shim - #3070

Draft
emdashbot[bot] wants to merge 1 commit into
mainfrom
bot/fix-2978
Draft

fix(registry-verification): use Windows-valid synthetic URL for createRequire shim#3070
emdashbot[bot] wants to merge 1 commit into
mainfrom
bot/fix-2978

Conversation

@emdashbot

@emdashbot emdashbot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

The @emdash-cms/registry-verification@0.3.0 ESM bundle contained a driveless file:///emdash-registry-verification.js URL for the createRequire CJS-interop shim. On Windows fileURLToPath() rejects that URL, so any consumer that inlines the package (such as emdash@0.37.0) fails to load the Astro config.

This change updates the rebundleSafeRequire plugin to emit file:///C:/emdash-registry-verification.js, which is accepted as an absolute file URL on every platform, and adds a regression guard to scripts/check-packed-output.mjs so the packed output is validated for a Windows-safe drive letter.

Verification

  • rebuilt dist/index.js and confirmed the shim now uses the drive-letter URL
  • added guard failed against the previous driveless URL and passes after the fix
  • pnpm --filter @emdash-cms/registry-verification test + test:package pass
  • pnpm typecheck, pnpm lint:json, and pnpm lint:quick are clean

Fixes #2978

Closes #2978.

A candidate change the reporter confirmed against their own site via the preview build:

npm i https://pkg.pr.new/emdash@bot/fix-2978

Opened automatically by emdashbot as a draft. A maintainer must review before merge.

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

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). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • I have added and reviewed the user-facing changeset (if this PR changes a published package)
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/...
  • I have included screenshots below if this PR changes the UI

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: emdashbot + Kimi K2.7 Code

Screenshots / test output

@changeset-bot

changeset-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0f55d64

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 21 packages
Name Type
@emdash-cms/registry-verification Patch
emdash Patch
@emdash-cms/labeler Patch
@emdash-cms/release-action Patch
@emdash-cms/release-service Patch
@emdash-cms/release-verifier Patch
@emdash-cms/cloudflare Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/do-demo-site Patch
@emdash-cms/do-solo-demo-site Patch
@emdash-cms/admin Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
create-emdash Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

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

@pkg-pr-new

pkg-pr-new Bot commented Sep 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

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

@emdash-cms/auth

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

@emdash-cms/auth-atproto

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

@emdash-cms/blocks

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

@emdash-cms/cloudflare

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

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

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

emdash

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

create-emdash

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

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

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

@emdash-cms/plugin-cli

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

@emdash-cms/plugin-types

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

@emdash-cms/registry-client

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

@emdash-cms/registry-lexicons

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

@emdash-cms/registry-moderation

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

@emdash-cms/registry-verification

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

@emdash-cms/sandbox-workerd

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

@emdash-cms/x402

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

@emdash-cms/plugin-ai-moderation

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

@emdash-cms/plugin-atproto

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

@emdash-cms/plugin-audit-log

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

@emdash-cms/plugin-color

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

@emdash-cms/plugin-embeds

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

@emdash-cms/plugin-field-kit

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

@emdash-cms/plugin-forms

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

@emdash-cms/plugin-webhook-notifier

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

commit: 0f55d64

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 11, 2026

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://bot-fix-2978.try.emdashcms.com, https://bot-fix-2978-emdash-playground.emdash-cms.workers.dev (commit 0f55d64)

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://7377c602.try.emdashcms.com, https://7377c602-emdash-playground.emdash-cms.workers.dev 0f55d64 2026-09-12T01:48:07.341Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://4aa24874.try.emdashcms.com, https://4aa24874-emdash-playground.emdash-cms.workers.dev b6dec9a 2026-09-11T16:12:40.118Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://86ebd60f.try.emdashcms.com, https://86ebd60f-emdash-playground.emdash-cms.workers.dev 516574d 2026-09-09T13:11:46.727Z Visit the dashboard ↗

@emdashbot

emdashbot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Completed

All focused checks pass. Publishing revised candidate.

  • Inspect workspace state and Typecheck failure
  • Run typecheck to capture the exact error
  • Revise the candidate to fix the typecheck error
  • Run focused checks and final verification
  • Publish candidate and report result

Outcome: The failing Typecheck CI job for the #2978 candidate was actually caused by the release-action dist freshness check (`git diff --exit-code -- apps/release-action/dist/index.js`), not a TypeScript error. The release-action bundles `@emdash-cms/registry-verification`, so changing the verifier’s `createRequire` shim from `file:///emdash-registry-verification.js` to `file:///C:/emdash-registry-verification.js` produced a one-line diff in the generated `apps/release-action/dist/index.js`. The previous candidate had not committed that regenerated bundle.

### What changed

  • Added the regenerated `apps/release-action/dist/index.js` to the candidate so the inlined registry-verification chunk uses the Windows-valid `file:///C:/emdash-registry-verification.js` URL.
  • Existing changes remain: `packages/registry-verification/tsdown.config.ts`, `packages/registry-verification/scripts/check-packed-output.mjs`, and the patch changeset.

### Verification

  • `pnpm --filter @emdash-cms/registry-verification test:package` passed (rebuild + packed-output guard).
  • `pnpm typecheck` passed.
  • `pnpm lint:json | jq '.diagnostics | length'` returned `0` and `pnpm lint:quick` passed.
  • `pnpm format:check` passed.
  • `git diff --exit-code -- apps/release-action/dist/index.js` now passes locally.

The revised candidate has been published.

Mode: revise

View live dashboard · Run: b734da3a-8a9f-434f-8508-6ba0023d1e38

@emdashbot

emdashbot Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

Completed

Revise fix for #2978: verified Windows-valid createRequire URL, ran tests/typecheck/lint/format, published candidate.

  • Inspect previous candidate changes for conflicts/correctness
  • Reproduce the Windows-invalid createRequire URL issue
  • Build package and verify packed output uses Windows-valid URL
  • Run package tests, typecheck, lint, and format
  • Publish candidate and report result

Outcome: Verified the accepted fix for the Windows build failure in `@emdash-cms/registry-verification`.

What changed:

  • `packages/registry-verification/tsdown.config.ts`: `rebundleSafeRequire` now emits `createRequire("file:///C:/emdash-registry-verification.js")` instead of the driveless URL, keeping `fileURLToPath()` valid on Windows while remaining a synthetic rebundle base elsewhere.
  • `packages/registry-verification/scripts/check-packed-output.mjs`: added a regression guard that rejects a packed `createRequire` URL without a drive letter and verifies `fileURLToPath()` resolves to an absolute path.
  • `apps/release-action/dist/index.js`: rebuilt artifact that inlines the updated bundle.
  • `.changeset/fix-windows-registry-verification.md`: patch changeset for `@emdash-cms/registry-verification`.

Verification:

  • Build produced `dist/index.js` with the drive-letter URL.
  • `pnpm --filter @emdash-cms/registry-verification test:package` passed.
  • `pnpm --filter @emdash-cms/registry-verification test` passed: 114 vitest + 38 workerd tests.
  • `pnpm typecheck` passed.
  • `pnpm lint:quick` returned 0 diagnostics.
  • `pnpm format` applied cleanly.

The exact Windows `createRequire()` error cannot be reproduced in this Linux workspace; the new guard rejects the old URL, and the reporter confirmed the preview resolves the Windows build failure.

Note: `attw --pack` left a stray `emdash-cms-registry-verification-0.3.0.tgz` in the package directory, which was inadvertently included in the published candidate commit. It is not part of the intended fix.

candidate branch changed since this run started (expected b6dec9a, found 0f55d64)

Failed stage: publication

Mode: revise

View live dashboard · Run: 1f5940f5-3319-4192-b510-d4d2158613cb

…eRequire shim

EmDash-Run: 1f5940f5-3319-4192-b510-d4d2158613cb
@github-actions

Copy link
Copy Markdown
Contributor

Overlapping PRs

This PR modifies files that are also changed by other open PRs:

This may cause merge conflicts or duplicated work. A maintainer will coordinate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

emdash@0.37.0 fails to build on Windows: createRequire() with a driveless file URL in @emdash-cms/registry-verification@0.3.0

0 participants