Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix moduleAttributesVersion errors with stage-0 preset in babel standalone #11631

Conversation

hamlim
Copy link
Contributor

@hamlim hamlim commented May 27, 2020

Q                       A
Fixed Issues? Fixes #11628
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

Changes:

  • Expose moduleAttributesVersion config option on the stage-0 preset for babel standalone
  • Forward that moduleAttributesVersion onto the config for stage-1 preset
  • Fix version mismatch in the module-attributes plugin and plugin-utils file (one was expecting version: 'apr-2020' and the other was expecting version: 'may-2020', I assumed that may is the correct version here) See: https://github.com/babel/babel/blob/master/packages/babel-parser/src/plugin-utils.js#L95-L101
  • Updated config in the example.htm file for testing the changes locally

Testing steps:

  • make prepublish-build-standalone
  • npx serve ./packages/babel-standalone
  • Visit localhost and navigate to examples/example.htm
  • Verify that babel doesn't hit an error when transforming the code from the textarea

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 27, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a6336c8:

Sandbox Source
falling-dawn-n0w1r Configuration
nostalgic-tharp-wjrhq Configuration

@babel-bot
Copy link
Collaborator

babel-bot commented May 27, 2020

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/23060/

@@ -3,11 +3,11 @@ import { declare } from "@babel/helper-plugin-utils";
export default declare((api, { version }) => {
api.assertVersion(7);

if (typeof version !== "string" || version !== "apr-2020") {
if (typeof version !== "string" || version !== "may-2020") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@existentialism existentialism added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label May 27, 2020
@nicolo-ribaudo
Copy link
Member

I now we don't have many tests for standalone, but could you add one to https://github.com/babel/babel/blob/master/packages/babel-standalone/test/babel.js? 🙏

@hamlim
Copy link
Contributor Author

hamlim commented May 27, 2020

I now we don't have many tests for standalone, but could you add one to /packages/babel-standalone/test/babel.js@master ? 🙏

Sure! Would something like asserting that stage-0 doesn't throw when passing moduleAttributesVersion work?

@hamlim
Copy link
Contributor Author

hamlim commented May 27, 2020

Added a small regression test 👍

Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@JLHwung JLHwung merged commit 8e41f26 into babel:master May 28, 2020
@hamlim hamlim deleted the fix-babel-standalone-stage-0-moduleAttributesVersion branch May 28, 2020 22:25
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Aug 28, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: standalone PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

babel stand alone version 7.10.0 doesnt work
5 participants