Support Babel 8#16
Conversation
Change api.assertVersion(7) to accept both Babel 7 and 8 via "^7.0.0-0 || ^8.0.0-0" and update @babel/helper-plugin-utils dependency to "^7.22.5 || ^8.0.0". Closes #15
|
@copilot add test suite for both v7 and v8 so that we can be sure that the implementation doesn't regress |
Add tests that verify the plugin loads correctly with Babel 7, Babel 8, and rejects unsupported versions (Babel 6). Also adds an end-to-end transform test to ensure the full pipeline works with the current Babel version.
Added a
Uses a mock API with |
|
@copilot no I don't want you to mock anything out, actually add both v7 and v8 versions of the package and test with both in the test suite |
Replace mocked version tests with actual @babel/core v7 and babel-core-8 (alias for @babel/core@^8) running the full transform pipeline. All 5 test cases now run against both Babel versions using describe.each.
Replaced the mocked tests with real packages in commit 05e40ea. The test suite now installs |
Keep @babel/core for the source import and add babel-core-7 alias for symmetry with babel-core-8 in the test suite.
|
@copilot are there any differences between the transpiled output between babel v7 and v8? |
No — the transpiled output is identical between Babel 7 and Babel 8. You can verify this by comparing the snapshot pairs in |
Plugin fails to load with Babel 8 because
api.assertVersion(7)rejects any version outside^7.0.0-0.api.assertVersionto"^7.0.0-0 || ^8.0.0-0"@babel/helper-plugin-utilsdependency to"^7.22.5 || ^8.0.0"(Babel 8 ships v8 of its helper packages)No API changes in
declareor the visitor interface between Babel 7 and 8 affect this plugin, so the version assertion is the only code change needed.