fix: remove tsx import.meta.dirname workaround, require Cypress >=15.17.0 (v2.1.0)#52
Merged
Merged
Conversation
tsx fixed import.meta.dirname/filename handling in 4.21.1, and Cypress began shipping the fixed tsx (4.22.4) starting in v15.17.0. The patchImportMeta.ts shim that patched Module._extensions['.js'] to inject dirname/filename/url into tsx's empty import_meta object is no longer needed. - Delete src/patchImportMeta.ts and its import in src/index.ts - Bump cypress devDependency floor to ^15.17.0 (15.16.0 and earlier still bundle the broken tsx 4.20.6 and would crash without the shim) - Update CLAUDE.md: drop the workaround, keep dynamic-import.ts docs (that helper bridges CJS->ESM loading and is unrelated to the tsx bug) - Rebuild dist/ Refs: - privatenumber/tsx#781 - web-infra-dev/rspack#13420 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a peerDependencies entry on cypress so consumers get an install-time warning if their Cypress predates the tsx import.meta.dirname fix (bundled from Cypress 15.17.0 onward). Document the requirement and the 2.0.0 fallback in the README installation and migration sections. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
The patchImportMeta.ts module was removed, so its test suite no longer applies and was failing with ERR_MODULE_NOT_FOUND in CI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 & why
Reverts the temporary
patchImportMeta.tsworkaround now that the underlying tsx bug is fixed upstream.tsx fixed its broken
import.meta.dirname/filenamehandling in tsx 4.21.1 (tsx#781). Cypress bundles the fixed tsx (4.22.4) starting in v15.17.0 — verified that v15.16.0 and earlier still ship the broken tsx 4.20.6. So the shim that patchedModule._extensions['.js']to injectdirname/filename/urlinto tsx's emptyimport_metaobject is no longer needed.Changes
src/patchImportMeta.tsand its import insrc/index.ts; rebuilddist/.^15.17.0(the shim was the only thing keeping older Cypress working).peerDependencies: { "cypress": ">=15.17.0" }so consumers get an install-time warning on older Cypress.dynamic-import.tsand its docs — that helper bridges CJS→ESM loading of rspack v2 /find-upand is unrelated to the tsx bug.Compatibility
Dropping the shim is breaking for anyone on Cypress 15.9.0–15.16.0 (those bundle the broken tsx and will now fail to start). Such users should stay on
cypress-rspack-dev-server@2.0.0.2.0.0is already published and cannot be replaced, so this ships as a new version.Refs:
import.meta.dirnameandimport.meta.filenameprivatenumber/tsx#781import.meta.dirnameis undefined in CJS context web-infra-dev/rspack#13420🤖 Generated with Claude Code