bondage.js icon indicating copy to clipboard operation
bondage.js copied to clipboard

Precompile parser

Open miker2049 opened this issue 3 years ago • 1 comments

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 avatar Apr 25 '21 01:04 miker2049

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 avatar Apr 25 '21 19:04 miker2049