Disable unused moduleMain code for browserify compatibility #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The jison parser generator by default will generate a command-line interface built into the parser. node-mojangson only uses the parser object and not the command-line interface, and has no way to access it, so it can be safely disabled -- since it causes compatibility issues with some browserify transforms (and is unused): zaach/jison#300 browserify/static-eval#12)
Unfortunately, the
jison
command does not accept the option to disable moduleMain (open pull request to jison: zaach/jison#316 Pass moduleMain option to generator), so I had to write a simple script using the jison API to generate the grammar as part of the prepublish script. Not too happy about this, would be a much simpler change if zaach/jison#316 is accepted:but jison last published a release in 2014, there is still an open question about its maintenance path going forward zaach/jison#297 so I think a workaround using the API instead of CLI is most expedient for now, though admittedly less than ideal.
This change also slightly reduces the generated file size, removing what was only dead code.