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

Precompile parser #74

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

miker2049
Copy link

@miker2049 miker2049 commented Apr 25, 2021

This leverages jison's ability to precompile a parser to greatly reduce the size of the final bundle, from 331kb to 30kb.

A npm command and grammar.json file replaces the original parser.js, and the stateful lexer is added to the runner after the parser is required.

All tests are passing

Also, moves the build system to esbuild, to reduce complexity and accessibility of the build.

Let me know what you think!

Edit: I'm seeing that the Travis CI tests fail with the esbuild, I'm kinda assuming because its testing a lower node version. I can certainly modify this to use the old build system, but keep the precompile thing. Is there a reason we are testing against a lower node version (<=5)?

@miker2049 miker2049 marked this pull request as draft April 25, 2021 13:54
@miker2049
Copy link
Author

miker2049 commented Apr 25, 2021

Not really sure what to do about the Travis checks, but have everything actually working in the browser and node with a new rollup config, as well as with changing the jison dependency to this more maintained fork, which mostly just creates a saner compiled parser module that can be consumed by a bundler and loaded by the node cli/tests.

Edit: just noticed the Rollup bundling adds some heft to the final bundle, and rollup doesn't fix the Travis tests anyway.

@miker2049 miker2049 marked this pull request as ready for review April 25, 2021 19:47
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.

1 participant