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

refactor: migrate default parser to babylon #31

Merged
merged 1 commit into from
Oct 10, 2023
Merged

refactor: migrate default parser to babylon #31

merged 1 commit into from
Oct 10, 2023

Conversation

pionxzh
Copy link
Owner

@pionxzh pionxzh commented Oct 10, 2023

Refs:

The jscodeshift a parser parameter defaults to babel5compat, which has a significantly reduced feature set from ts, babylon, etc.

This PR migrated the parser to use babylon, in the same time, drops Literal and Property.

Can we consider further migrating to @babel/core?

import { parseSync, loadOptions } from "@babel/core";

export const parser = {
  parse(code) {
    const options = loadOptions();

    return parseSync(code, options);
  },
};

@vercel
Copy link

vercel bot commented Oct 10, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
wakaru ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2023 5:37am

@0xdevalias
Copy link

0xdevalias commented Nov 18, 2023

Can we consider further migrating to @babel/core?

@pionxzh Did you ever figure out/look into whether @babel/core could be used with jscodeshift?

Edit: Just checked the code and seems that's what it does under the hood anyway:

@pionxzh
Copy link
Owner Author

pionxzh commented Nov 18, 2023

@0xdevalias I think it won't bring too much benefit to use babel/core for now. I saw that code snippet from somewhere I couldn't remember haha..

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.

2 participants