Comparing version 1.4.5 to 1.6.0
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.6.3 | ||
// Generated by CoffeeScript 1.7.1 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var CSON, argv, filePath, fs, path, result; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.6.3 | ||
// Generated by CoffeeScript 1.7.1 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var CSON, argv, filePath, fs, path, result; |
@@ -1,4 +0,4 @@ | ||
// Generated by CoffeeScript 1.6.3 | ||
// Generated by CoffeeScript 1.7.1 | ||
(function() { | ||
var CSON, coffee, extractOpts, fsUtil, js2coffee, pathUtil, requireFreshSafe, wait; | ||
var CSON, ambi, coffee, extractOpts, fsUtil, js2coffee, pathUtil, requireFreshSafe, wait; | ||
@@ -13,2 +13,4 @@ coffee = require('coffee-script'); | ||
ambi = require('ambi'); | ||
extractOpts = require('extract-opts').extractOpts; | ||
@@ -18,2 +20,4 @@ | ||
require('coffee-script/register'); | ||
wait = function(delay, fn) { | ||
@@ -25,4 +29,3 @@ return setTimeout(fn, delay); | ||
parseFile: function(filePath, opts, next) { | ||
var err, _ref, | ||
_this = this; | ||
var err, _ref; | ||
_ref = extractOpts(opts, next), opts = _ref[0], next = _ref[1]; | ||
@@ -33,10 +36,13 @@ filePath = pathUtil.resolve(filePath); | ||
} else if (/\.(json|cson)$/.test(filePath)) { | ||
fsUtil.readFile(filePath, function(err, data) { | ||
var dataStr; | ||
if (err) { | ||
return next(err); | ||
} | ||
dataStr = data.toString(); | ||
return _this.parse(dataStr, opts, next); | ||
}); | ||
fsUtil.readFile(filePath, (function(_this) { | ||
return function(err, data) { | ||
var dataStr; | ||
if (err) { | ||
return next(err); | ||
} | ||
dataStr = data.toString(); | ||
opts.filename = filePath; | ||
return _this.parse(dataStr, opts, next); | ||
}; | ||
})(this)); | ||
} else { | ||
@@ -53,5 +59,11 @@ err = new Error("CSON.parseFile: Unknown extension type for " + filePath); | ||
if (/\.(js|coffee)$/.test(filePath)) { | ||
return result = requireFreshSafe(filePath); | ||
try { | ||
return result = requireFreshSafe(filePath); | ||
} catch (_error) { | ||
err = _error; | ||
return result = err; | ||
} | ||
} else if (/\.(json|cson)$/.test(filePath)) { | ||
data = fsUtil.readFileSync(filePath); | ||
opts.filename = filePath; | ||
if (data instanceof Error) { | ||
@@ -70,14 +82,9 @@ result = data; | ||
parse: function(src, opts, next) { | ||
var _ref, | ||
_this = this; | ||
var _ref; | ||
_ref = extractOpts(opts, next), opts = _ref[0], next = _ref[1]; | ||
wait(0, function() { | ||
var result; | ||
result = _this.parseSync(src, opts); | ||
if (result instanceof Error) { | ||
return next(result); | ||
} else { | ||
return next(null, result); | ||
} | ||
}); | ||
wait(0, (function(_this) { | ||
return function() { | ||
return ambi(_this.parseSync, src, opts, next); | ||
}; | ||
})(this)); | ||
return this; | ||
@@ -105,12 +112,7 @@ }, | ||
stringify: function(obj, next) { | ||
var _this = this; | ||
wait(0, function() { | ||
var result; | ||
result = _this.stringifySync(obj); | ||
if (result instanceof Error) { | ||
return next(result); | ||
} else { | ||
return next(null, result); | ||
} | ||
}); | ||
wait(0, (function(_this) { | ||
return function() { | ||
return ambi(_this.stringifySync, obj, next); | ||
}; | ||
})(this)); | ||
return this; | ||
@@ -117,0 +119,0 @@ }, |
{ | ||
"title": "CSON", | ||
"name": "cson", | ||
"version": "1.4.5", | ||
"version": "1.6.0", | ||
"description": "CoffeeScript-Object-Notation Parser. Same as JSON but for CoffeeScript objects", | ||
@@ -13,5 +13,9 @@ "homepage": "https://github.com/bevry/cson", | ||
"npm": true, | ||
"david": true, | ||
"daviddev": true, | ||
"gittip": "bevry", | ||
"flattr": "344188/balupton-on-Flattr", | ||
"paypal": "QB8GQPZAH84N6" | ||
"paypal": "QB8GQPZAH84N6", | ||
"bitcoin": "https://coinbase.com/checkouts/9ef59f5479eec1d97d63382c9ebcb93a", | ||
"wishlist": "http://amzn.com/w/2F8TXKSNAFG4V" | ||
}, | ||
@@ -31,6 +35,10 @@ "keywords": [ | ||
"contributors": [ | ||
"attilaolah (https://github.com/attilaolah)", | ||
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)", | ||
"evinugur (https://github.com/evinugur)", | ||
"jasonkarns (https://github.com/jasonkarns)", | ||
"Joel Perras <joel.perras@gmail.com> (https://github.com/jperras)", | ||
"Linus G Thiel <linus@hanssonlarsson.se> (https://github.com/linus)", | ||
"Nicolae Claudius <claudius.nicolae@gmail.com> (https://github.com/clyfe)", | ||
"RobLoach (https://github.com/RobLoach)", | ||
"Ryan LeFevre <meltingice8917@gmail.com> (https://github.com/meltingice)", | ||
@@ -50,12 +58,13 @@ "Zhang Cheng <czhang.oss@gmail.com> (https://github.com/zhangcheng)" | ||
"dependencies": { | ||
"coffee-script": "~1.6.3", | ||
"js2coffee": "~0.2.3", | ||
"ambi": "^2.2.0", | ||
"coffee-script": "~1.7.1", | ||
"extract-opts": "~2.2.0", | ||
"js2coffee": "~0.3.0", | ||
"requirefresh": "~1.1.2" | ||
}, | ||
"devDependencies": { | ||
"chai": "~1.8.1", | ||
"chai": "~1.9.0", | ||
"joe": "~1.3.0", | ||
"joe-reporter-console": "~1.2.1", | ||
"projectz": "~0.2.5" | ||
"projectz": "~0.3.10" | ||
}, | ||
@@ -73,3 +82,6 @@ "directories": { | ||
}, | ||
"main": "./out/lib/cson" | ||
"main": "./out/lib/cson", | ||
"cakeConfiguration": { | ||
"COFFEE_SRC_PATH": "src" | ||
} | ||
} |
@@ -1,2 +0,1 @@ | ||
<!-- TITLE/ --> | ||
@@ -13,5 +12,9 @@ | ||
[![NPM version](http://badge.fury.io/js/cson.png)](https://npmjs.org/package/cson "View this project on NPM") | ||
[![Dependency Status](https://david-dm.org/bevry/cson.png?theme=shields.io)](https://david-dm.org/bevry/cson) | ||
[![Development Dependency Status](https://david-dm.org/bevry/cson/dev-status.png?theme=shields.io)](https://david-dm.org/bevry/cson#info=devDependencies)<br/> | ||
[![Gittip donate button](http://img.shields.io/gittip/bevry.png)](https://www.gittip.com/bevry/ "Donate weekly to this project using Gittip") | ||
[![Flattr donate button](http://img.shields.io/flattr/donate.png?color=yellow)](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr") | ||
[![PayPayl donate button](http://img.shields.io/paypal/donate.png?color=yellow)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QB8GQPZAH84N6 "Donate once-off to this project using Paypal") | ||
[![BitCoin donate button](http://img.shields.io/bitcoin/donate.png?color=yellow)](https://coinbase.com/checkouts/9ef59f5479eec1d97d63382c9ebcb93a "Donate once-off to this project using BitCoin") | ||
[![Wishlist browse button](http://img.shields.io/wishlist/browse.png?color=yellow)](http://amzn.com/w/2F8TXKSNAFG4V "Buy an item on our wishlist for us") | ||
@@ -21,9 +24,7 @@ <!-- /BADGES --> | ||
<!-- DESCRIPTION/ --> | ||
CoffeeScript-Object-Notation Parser. Same as JSON but for CoffeeScript objects. | ||
CoffeeScript-Object-Notation Parser. Same as JSON but for CoffeeScript objects | ||
[Projects using CSON.](https://www.npmjs.org/browse/depended/cson) | ||
<!-- /DESCRIPTION --> | ||
<!-- INSTALL/ --> | ||
@@ -33,10 +34,6 @@ | ||
### [Node](http://nodejs.org/), [Browserify](http://browserify.org/) | ||
### [NPM](http://npmjs.org/) | ||
- Use: `require('cson')` | ||
- Install: `npm install --save cson` | ||
### [Ender](http://ender.jit.su/) | ||
- Use: `require('cson')` | ||
- Install: `ender add cson` | ||
<!-- /INSTALL --> | ||
@@ -79,18 +76,6 @@ | ||
Which is far more lenient than JSON, nicer to write and read, you don't have to quote everything, you have comments, and won't fail if you forget a comma. | ||
Which is far more lenient than JSON, way nicer to write and read, no need to quote everything, has comments and readable multi-line strings, and won't fail if you forget a comma. | ||
## Installing | ||
1. [Install Node.js](http://bevry.me/node/install) | ||
2. Install CSON | ||
``` bash | ||
npm install --save cson | ||
``` | ||
## Using CSON | ||
@@ -127,3 +112,3 @@ | ||
CSON.parseFile 'data.cson', (err,obj) -> # async | ||
result = CSON.parseFile('data.cson') # sync | ||
result = CSON.parseFileSync('data.cson') # sync | ||
@@ -150,6 +135,12 @@ # Parse a string | ||
## Use Case | ||
CSON is fantastic for developers writing their own configuration to be executed on their own machines, but bad for configuration you can't trust. This is because parsing CSON will execute the CSON input as CoffeeScript code (making it unsafe, so `while true` would work) but it does so inside a [node virtual machine](http://nodejs.org/api/vm.html) for isolation (making it secure, so `require('fs')` won't work) resulting in the evaluated JavaScript object. This is a non-issue for the only use case which CSON actually makes sense for (developers writing their own configuration to be executed on their own machines). [Issue #32 has more information.](https://github.com/bevry/cson/issues/32) | ||
<!-- HISTORY/ --> | ||
## History | ||
[Discover the change history by heading on over to the `History.md` file.](https://github.com/bevry/cson/blob/master/History.md#files) | ||
[Discover the change history by heading on over to the `HISTORY.md` file.](https://github.com/bevry/cson/blob/master/HISTORY.md#files) | ||
@@ -163,3 +154,3 @@ <!-- /HISTORY --> | ||
[Discover how you can contribute by heading on over to the `Contributing.md` file.](https://github.com/bevry/cson/blob/master/Contributing.md#files) | ||
[Discover how you can contribute by heading on over to the `CONTRIBUTING.md` file.](https://github.com/bevry/cson/blob/master/CONTRIBUTING.md#files) | ||
@@ -186,2 +177,4 @@ <!-- /CONTRIBUTE --> | ||
[![PayPayl donate button](http://img.shields.io/paypal/donate.png?color=yellow)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QB8GQPZAH84N6 "Donate once-off to this project using Paypal") | ||
[![BitCoin donate button](http://img.shields.io/bitcoin/donate.png?color=yellow)](https://coinbase.com/checkouts/9ef59f5479eec1d97d63382c9ebcb93a "Donate once-off to this project using BitCoin") | ||
[![Wishlist browse button](http://img.shields.io/wishlist/browse.png?color=yellow)](http://amzn.com/w/2F8TXKSNAFG4V "Buy an item on our wishlist for us") | ||
@@ -192,10 +185,14 @@ ### Contributors | ||
- Benjamin Lupton <b@lupton.cc> (https://github.com/balupton) - [view contributions](https://github.com/bevry/cson/commits?author=balupton) | ||
- Joel Perras <joel.perras@gmail.com> (https://github.com/jperras) - [view contributions](https://github.com/bevry/cson/commits?author=jperras) | ||
- Linus G Thiel <linus@hanssonlarsson.se> (https://github.com/linus) - [view contributions](https://github.com/bevry/cson/commits?author=linus) | ||
- Nicolae Claudius <claudius.nicolae@gmail.com> (https://github.com/clyfe) - [view contributions](https://github.com/bevry/cson/commits?author=clyfe) | ||
- Ryan LeFevre <meltingice8917@gmail.com> (https://github.com/meltingice) - [view contributions](https://github.com/bevry/cson/commits?author=meltingice) | ||
- Zhang Cheng <czhang.oss@gmail.com> (https://github.com/zhangcheng) - [view contributions](https://github.com/bevry/cson/commits?author=zhangcheng) | ||
- [attilaolah](https://github.com/attilaolah) — [view contributions](https://github.com/bevry/cson/commits?author=attilaolah) | ||
- [Benjamin Lupton](https://github.com/balupton) <b@lupton.cc> — [view contributions](https://github.com/bevry/cson/commits?author=balupton) | ||
- [evinugur](https://github.com/evinugur) — [view contributions](https://github.com/bevry/cson/commits?author=evinugur) | ||
- [jasonkarns](https://github.com/jasonkarns) — [view contributions](https://github.com/bevry/cson/commits?author=jasonkarns) | ||
- [Joel Perras](https://github.com/jperras) <joel.perras@gmail.com> — [view contributions](https://github.com/bevry/cson/commits?author=jperras) | ||
- [Linus G Thiel](https://github.com/linus) <linus@hanssonlarsson.se> — [view contributions](https://github.com/bevry/cson/commits?author=linus) | ||
- [Nicolae Claudius](https://github.com/clyfe) <claudius.nicolae@gmail.com> — [view contributions](https://github.com/bevry/cson/commits?author=clyfe) | ||
- [RobLoach](https://github.com/RobLoach) — [view contributions](https://github.com/bevry/cson/commits?author=RobLoach) | ||
- [Ryan LeFevre](https://github.com/meltingice) <meltingice8917@gmail.com> — [view contributions](https://github.com/bevry/cson/commits?author=meltingice) | ||
- [Zhang Cheng](https://github.com/zhangcheng) <czhang.oss@gmail.com> — [view contributions](https://github.com/bevry/cson/commits?author=zhangcheng) | ||
[Become a contributor!](https://github.com/bevry/cson/blob/master/Contributing.md#files) | ||
[Become a contributor!](https://github.com/bevry/cson/blob/master/CONTRIBUTING.md#files) | ||
@@ -202,0 +199,0 @@ <!-- /BACKERS --> |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16800
5
10
205
+ Addedambi@^2.2.0
+ Addedambi@2.5.0(transitive)
+ Addedcoffee-script@1.7.1(transitive)
+ Addededitions@1.3.42.3.1(transitive)
+ Addederrlop@2.2.0(transitive)
+ Addedjs2coffee@0.3.5(transitive)
+ Addedmkdirp@0.3.5(transitive)
+ Addednopt@3.0.6(transitive)
+ Addedsemver@6.3.1(transitive)
+ Addedtypechecker@4.11.0(transitive)
+ Addedunderscore@1.6.0(transitive)
- Removedcoffee-script@1.6.3(transitive)
- Removedjs2coffee@0.2.7(transitive)
- Removednopt@2.1.2(transitive)
- Removedunderscore@1.5.2(transitive)
Updatedcoffee-script@~1.7.1
Updatedjs2coffee@~0.3.0