bevry / cson

CoffeeScript-Object-Notation. Same as JSON but for CoffeeScript objects.
Other
1.34k stars 55 forks source link

Can I use this lib in browser? #135

Closed tiye closed 4 years ago

tiye commented 4 years ago

SInce I already trying I think it probably does support running in a browser? Any suggestions?

balupton commented 4 years ago

Use https://npmjs.com/package/cson-parser in the browser, not this lib.

tiye commented 4 years ago

Looks nice, thanks!

tiye commented 4 years ago

Bad news cson-parser still import Node.js modules, which breaks my compilation: https://github.com/groupon/cson-parser/blob/master/lib/parse.js#L35-L36

failed to resolve: ./helpers from /Users/chen/repo/mvc-works/edn-formatter/node_modules/coffeescript/lib/coffeescript-browser-compiler-legacy/coffeescript.js
{:relative-to #object[java.io.File 0x5dca3978 "/Users/chen/repo/mvc-works/edn-formatter/node_modules/coffeescript/lib/coffeescript-browser-compiler-legacy/coffeescript.js"], :entry "./helpers"}

Not Webpack I'm using though... shadow-cljs handles most npm packages.

@thheller would be surprised that CoffeeScript has code like this...

(function(root) {
  var CoffeeScript = (function() {
    var _Mathabs = Math.abs,
      _StringfromCharCode = String.fromCharCode,
      _Mathfloor = Math.floor;
    function require(path) {
      return require[path];
    }
    return (
      (require["../../package.json"] = (function() {
        return {
          name: "coffeescript",
          description: "Unfancy JavaScript",
          keywords: ["javascript", "language", "coffeescript", "compiler"],
          author: "Jeremy Ashkenas",
          version: "2.5.0",
   var indexOf = [].indexOf,
              hasProp = {}.hasOwnProperty,
              _require = require("./helpers"),
balupton commented 4 years ago

You'd have to raise the issue on that packages's repo then. Good luck!