Skip to content

Support Babel 8#16

Open
umar-ahmed with Copilot wants to merge 5 commits into
mainfrom
copilot/support-babel-8
Open

Support Babel 8#16
umar-ahmed with Copilot wants to merge 5 commits into
mainfrom
copilot/support-babel-8

Conversation

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown

Plugin fails to load with Babel 8 because api.assertVersion(7) rejects any version outside ^7.0.0-0.

  • Widen api.assertVersion to "^7.0.0-0 || ^8.0.0-0"
  • Widen @babel/helper-plugin-utils dependency to "^7.22.5 || ^8.0.0" (Babel 8 ships v8 of its helper packages)

No API changes in declare or the visitor interface between Babel 7 and 8 affect this plugin, so the version assertion is the only code change needed.

Copilot AI linked an issue Jul 2, 2026 that may be closed by this pull request
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 AI changed the title [WIP] Support Babel 8 compatibility in build process Support Babel 8 Jul 2, 2026
Copilot AI requested a review from umar-ahmed July 2, 2026 00:19
@umar-ahmed

Copy link
Copy Markdown
Collaborator

@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.

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Author

@copilot add test suite for both v7 and v8 so that we can be sure that the implementation doesn't regress

Added a babel version compatibility test suite in commit 5e2e8e4 that:

  • Verifies the plugin loads with Babel 7 (7.21.8)
  • Verifies the plugin loads with Babel 8 (8.0.1)
  • Verifies the plugin rejects Babel 6 (6.26.3)
  • Runs an end-to-end transform to confirm the full pipeline works

Uses a mock API with semver.satisfies to simulate different Babel versions calling into the plugin factory.

@umar-ahmed

Copy link
Copy Markdown
Collaborator

@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.

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Author

@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

Replaced the mocked tests with real packages in commit 05e40ea. The test suite now installs babel-core-8 (alias for @babel/core@^8.0.0) alongside @babel/core v7, and runs all 5 transform tests against both versions using describe.each. All 10 tests pass.

Comment thread package.json
Keep @babel/core for the source import and add babel-core-7 alias
for symmetry with babel-core-8 in the test suite.
Copilot AI requested a review from umar-ahmed July 2, 2026 00:30
@umar-ahmed

Copy link
Copy Markdown
Collaborator

@copilot are there any differences between the transpiled output between babel v7 and v8?

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Author

@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 src/__snapshots__/index.test.ts.snap; each 'Babel 7' > ... entry matches its corresponding 'Babel 8' > ... entry exactly.

@umar-ahmed umar-ahmed marked this pull request as ready for review July 2, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Babel 8

2 participants