groupon / cson-parser

Simple & safe CSON parser
BSD 3-Clause "New" or "Revised" License
133 stars 27 forks source link

Browser support? #66

Closed corps closed 7 years ago

corps commented 7 years ago

I was hoping to use CSON in the front end for an HTML frontend to some backend configuration. Unfortunately, I was disappointed to see that the cson-parser itself just relies directly on importing the entire coffeescript package. Even if I were to stub the modules that are not needed for the string parsing only portion, the size is actually quite big without teasing apart only the absolutely necessary parts of the coffeescript engine, and the worst part is the maintenance aspect; every time I update cson, if it updates it's coffeescript engine again, I may be forced into a similar dance of stubbing modules, checking for security concerns, etc.

How difficult do you think it would be to teasing apart the CSON parser separate from the coffeescript compiler itself? I can imagine many similar use cases where supporting a CSON configured backend would warrant a general browser frontend to configure it as well.

jkrems commented 7 years ago

It's something we had our eyes on for a while now (see https://github.com/groupon/cson-parser/issues/7). For the stringify parts it's easy (require('cson-parser/lib/stringify')) which technically isn't officially supported but works. CSON.parse is a lot harder.

I'm going to close this because it feels like a duplicate of #7 but let me know if you disagree! :)