chore(deps): migrate frontend to cucumber ESM (gherkin 40, messages 33) — browser-fixed#821
Draft
tdjager wants to merge 1 commit into
Draft
chore(deps): migrate frontend to cucumber ESM (gherkin 40, messages 33) — browser-fixed#821tdjager wants to merge 1 commit into
tdjager wants to merge 1 commit into
Conversation
…s 33) Re-applies the cucumber major bump that was reverted in #820. @cucumber/messages 33 (pure ESM) runs `createRequire(import.meta.url)('../package.json').version` at import time; createRequire is Node-only, so in the browser it threw "createRequire is not a function" and crashed every view importing the gherkin parser (the whole editor went blank). Fix: alias `node:module` to a tiny browser shim providing a harmless createRequire, scoped to the build only (vitest keeps the real one). Also inline @cucumber/* for the vmThreads vitest pool ("Linked modules must use the same context"). Verified in a real browser this time: built dist + dev server, /editor mounts (no createRequire error) and parseFeature parses a feature/scenario/steps correctly with gherkin 40 + messages 33. markdown-it 14.2.0 override retained.
Preview Deployment — editor — editorYour changes have been deployed to a preview environment: URL: https://editor.pr821.rig.prd1.gn2.quattro.rijksapps.nl This deployment will be automatically cleaned up when the PR is closed. |
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.
What
Re-applies the cucumber major bump reverted in #820, this time with the browser-runtime fix:
@cucumber/gherkin39.1.0 → 40.0.0@cucumber/messages32.3.1 → 33.0.2The bug that took down the editor (and how this fixes it)
@cucumber/messages33 (pure ESM) runs this at import time (dist/version.js):createRequireis a Node-only API. In the browser the bundler stubsnode:moduleto an empty object, so the call threwTypeError: createRequire is not a function— crashing every view that imports the gherkin parser (src/gherkin/parser.js), i.e. the entire editor (blank/editor/*). The first attempt (#818) shipped this because the only verification was Node-based vitest, wherecreateRequireexists.Fix: alias
node:moduleto a tiny browser shim (src/shims/node-module.js) that provides a harmlesscreateRequire(we don't use the version string). Scoped to the build only viaprocess.env.VITEST, so Node-based vitest keeps the real module. Also re-addstest.server.deps.inline: [/@cucumber\//]for thevmThreadspool ("Linked modules must use the same context").Verification — in a real browser this time
vite buildsucceeds;createRequireno longer present in any built asset.distviavite preview→/editormounts (was blank<!---->), zerocreateRequireerrors.import('/src/gherkin/parser.js')→parseFeature(...)parses feature name, scenario, and all 4 steps correctly under gherkin 40 / messages 33.npx vitest run src/gherkin/→ 30 pass.npm audit→ 0 vulnerabilities. markdown-it 14.2.0 override retained.Custom config reported (per CLAUDE.md)
No custom CSS. Two build-config additions: the
node:moduleresolve alias (browser shim) and the vitestdeps.inlinefor@cucumber/*. Both are dependency-compat shims, not UI changes.Note
Draft — not auto-merging. Given the prior incident, I'd suggest a browser smoke-test on the PR preview deployment before merge.