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

Add swc parser #1014

Closed
GianlucaGuarini opened this issue Dec 11, 2021 · 7 comments
Closed

Add swc parser #1014

GianlucaGuarini opened this issue Dec 11, 2021 · 7 comments

Comments

@GianlucaGuarini
Copy link

What do you think about adding the swc parser?

import { parseSync } from '@swc/core'
import {parse} from 'recast'

/**
 * Parse a js source to generate the AST
 * @param   {string} source - javascript source
 * @param   {Object} options - parser options
 * @returns {AST} AST tree
 */
export default function generateAST(source, options) {
  return parse(source, {
    parser: {
      parse: parseSync
    },
    ...options
  })
}

I am trying handling this feature outside of recast but it seems that the parser output is not yet compatible

@GianlucaGuarini
Copy link
Author

Notice that this topic was already discussed on the swc repo swc-project/swc#1392

@benjamn
Copy link
Owner

benjamn commented Jan 31, 2022

@GianlucaGuarini This seems like a good idea! If you have time to get things started (using the other parsers as a guide), I would be happy to look at a PR.

@GianlucaGuarini
Copy link
Author

@benjamn it seems that the swc author is rewriting it in golang and probably it makes more sense to wait a bit before starting working on this patch.

@reesericci
Copy link

STC has been abandoned: dudykr/stc#1101

@GianlucaGuarini
Copy link
Author

Fair enough we can close this issue

@reesericci
Copy link

I don't think it needs to be closed, SWC still has a parser, we just can work on implementing it now instead of waiting on STC

@GianlucaGuarini
Copy link
Author

No progress towards this issue was done during the last 2 years. I think it makes sense to close it anyway as it become stale

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

No branches or pull requests

3 participants