fix(registry-verification): support imports on Windows - #3069
Conversation
🦋 Changeset detectedLatest commit: 78c4f6a The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 packages
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 |
There was a problem hiding this comment.
This is the right fix for the reported Windows issue. The synthetic createRequire URL used by @emdash-cms/registry-verification needs a drive letter to avoid ERR_INVALID_FILE_URL_PATH when consumers rebundle it on Windows, and the extended test:package check validates the shim under both Windows and POSIX path conventions. No AGENTS.md concerns apply here (no SQL, auth, UI, content-table, or hot-path query changes).
However, the committed GitHub Action bundle in apps/release-action/dist/index.js still inlines the old file:///emdash-registry-verification.js string. The typecheck CI job rebuilds @emdash-cms/release-action (which bundles @emdash-cms/registry-verification because its tsdown config sets noExternal: [/.*/]) and then runs git diff --exit-code -- apps/release-action/dist/index.js. Once this PR changes the upstream source, the regenerated action dist will differ from what is committed, so that guard will fail on main after merge.
The PR needs to rebuild and commit apps/release-action/dist/index.js with the new URL.
| return code.replace( | ||
| "createRequire(import.meta.url)", | ||
| 'createRequire("file:///emdash-registry-verification.js")', | ||
| 'createRequire("file:///C:/emdash-registry-verification.js")', |
There was a problem hiding this comment.
[needs fixing] The source URL now includes a drive letter, but the committed GitHub Action artifact still carries the old URL. apps/release-action/dist/index.js bundles @emdash-cms/registry-verification and still contains:
var __require = /* @__PURE__ */ createRequire("file:///emdash-registry-verification.js");The typecheck CI job rebuilds @emdash-cms/release-action and then runs git diff --exit-code -- apps/release-action/dist/index.js. Because that build inlines the changed registry-verification output, the committed dist will differ after this change and the CI guard will fail.
Fix by rebuilding and committing the regenerated action bundle:
pnpm build
pnpm --filter @emdash-cms/release-action buildthen commit apps/release-action/dist/index.js.
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
There was a problem hiding this comment.
This re-review confirms the prior blocker is resolved and the fix is otherwise clean.
The previous review asked for apps/release-action/dist/index.js to be rebuilt and committed with the new synthetic createRequire URL. The diff now updates that bundle line from file:///emdash-registry-verification.js to file:///C:/emdash-registry-verification.js, so the git diff --exit-code -- apps/release-action/dist/index.js guard in the typecheck CI job will pass after merge.
What I checked:
- The
tsdown.config.tsplugin now emits the drive-letter URL, and the comment explains why it is needed without lapsing into reviewer-facing justification. scripts/check-packed-output.mjsvalidates the packed output with both Windows and POSIXfileURLToPathconventions and confirms Node builtins resolve through the shim, which is a meaningful regression test rather than a tautological string match.- The new CI step runs
pnpm --filter @emdash-cms/registry-verification test:packageon shard 1, after the build step already covers theregistry-*packages. - A tree-wide search shows the old
file:///emdash-registry-verification.jsURL no longer appears in source or committed bundles; only the diff itself references it. - The changeset is a proportional patch entry: it leads with a present-tense observable fix and identifies the affected audience (Windows site builds).
No AGENTS.md concerns apply here (no SQL, auth, UI, content-table queries, or logged-out hot-path changes). Approving.
Overlapping PRsThis PR modifies files that are also changed by other open PRs:
This may cause merge conflicts or duplicated work. A maintainer will coordinate. |
What does this PR do?
Fixes Windows site builds failing while loading the Astro configuration. The bundled registry verifier uses a synthetic
createRequireURL without a drive letter, which Node.js rejects on Windows.Adds a drive letter to that URL and extends the packed-output check to validate Windows and POSIX paths and load the required Node builtins. CI runs this check after building the package. Updates the committed release action bundle to include the fix.
Closes #2978
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runScreenshots / test output
Screenshots: not applicable.
ERR_INVALID_FILE_URL_PATHand passes after the fix. It checks Windows path rules even on Linux.pnpm --filter @emdash-cms/registry-verification test: 114 tests and 38 Workerd tests passed.pnpm --filter @emdash-cms/release-action test: 15 tests passed. Its typecheck and rebuild consistency check also passed.pnpm build,pnpm typecheck,pnpm lint,pnpm format:check, andgit diff --checkpassed.@emdash-cms/cloudflare0.37.0, and@emdash-cms/plugin-forms0.2.6. EmDash 0.37.0 reproduced the reported config-loading failure. The published candidate at516574d, with the same URL fix, built successfully and served the homepage and setup-status endpoint with HTTP 200 in local preview.The Windows site build logged non-fatal Google Fonts network and chunk-size warnings.