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

option to generate an es module instead of commonjs module #663

Open
mreinstein opened this issue Mar 25, 2021 · 12 comments
Open

option to generate an es module instead of commonjs module #663

mreinstein opened this issue Mar 25, 2021 · 12 comments

Comments

@mreinstein
Copy link

Issue type

Feature Request:

Description

When pegjs produces an output .js file, it is in common js format:

module.exports = {
  SyntaxError: peg$SyntaxError,
  parse:       peg$parse
};

I want the output as an es module instead:

export { peg$parse as parse, peg$SyntaxError as SyntaxError };
@GreenImp
Copy link

GreenImp commented Apr 15, 2021

I'm not sure, but from the PR description, this may have been resolved on the Peggy fork: peggyjs/peggy#11

It looks like Peggy is gaining some momentum as an active replacement for pegjs.

@hildjj
Copy link

hildjj commented Apr 15, 2021

Yes, it's resolved in Peggy. We're working toward a first release within days, I hope.

@GreenImp
Copy link

That's fantastic! Really nice to see this project coming back to life.

@mreinstein
Copy link
Author

oh wow, that is fantastic news. pegjs has one of the most pleasant syntaxes, so I'm really happy to see peggy breathe new life into it! Will head over there and start exploring. :)

@hildjj
Copy link

hildjj commented Apr 15, 2021

We just did a pre-release version of peggy, 1.0.0-rc.0. Can a few of you try this out in your existing projects, please? We'll do a full release as soon as we have a few data points.

@stoneRdev
Copy link

@hildjj I might try it, if it's suitable as a drop in replacement for PEGjs. Meaning if I don't have to change any of my grammars or actions, I'll give it a try

@mreinstein
Copy link
Author

I've definitely been meaning to try this in my own project, just haven't gotten to it yet mreinstein/constraint-solver#5

@hildjj
Copy link

hildjj commented Apr 22, 2021

The intent is that you just s/pegjs/peggy/g and nothing changes other than you get support. :)

@hildjj
Copy link

hildjj commented Apr 22, 2021

An example, on one of my projects: hildjj/resolv-conf@e175e13

@mreinstein
Copy link
Author

I'll try to find some time this afternoon to take it for a spin, I'm definitely keen/excited to try this, just overworked at the moment. :)

@stoneRdev
Copy link

Well, as far as the online version goes, it all checks out, so consider me migrated

@mreinstein
Copy link
Author

Same, I'm migragted to peggy!

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

4 participants