peggyjs / peggy

Peggy: Parser generator for JavaScript
https://peggyjs.org/
MIT License
883 stars 63 forks source link

Format bare gives no error when trying to import another parser #490

Closed XenoS-ITA closed 4 months ago

XenoS-ITA commented 4 months ago

When trying to compile a file with peggy if you set the format to bare the import is simply ignored with no warning indicating that bare cannot import

Step to reproduce:

What should come out: An error or warning that the import was ignored. Maybe for the api change the default format to commonjs or throw an error

hildjj commented 4 months ago

I don't think we can change the default format in the API; that would break existing code.

XenoS-ITA commented 4 months ago

you are totally right, it could be done with the next big version also because the fact that the CLI has commonjs as default and the API as bare does not makes not too much logical sense (in my opinion)

hildjj commented 4 months ago

Let's fix this, and we can then open another issue to revisit the default at the next breaking change.

hildjj commented 4 months ago

I'm not going to cut a release just for this, since there is a work-around.