fsevents 1.0.17 → 1.0.18-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fsevents might be problematic. Click here for more details.
- package/fsevents.js +3 -0
- package/install.js +7 -0
- package/node_modules/abbrev/abbrev.js +0 -1
- package/node_modules/abbrev/package.json +16 -13
- package/node_modules/ansi-regex/index.js +1 -1
- package/node_modules/ansi-regex/package.json +32 -21
- package/node_modules/ansi-regex/readme.md +10 -2
- package/node_modules/aproba/README.md +33 -3
- package/node_modules/aproba/index.js +71 -30
- package/node_modules/aproba/package.json +14 -14
- package/node_modules/aws4/aws4.js +15 -6
- package/node_modules/aws4/package.json +10 -10
- package/node_modules/bcrypt-pbkdf/index.js +1 -4
- package/node_modules/bcrypt-pbkdf/package.json +24 -12
- package/node_modules/gauge/CHANGELOG.md +10 -0
- package/node_modules/gauge/index.js +9 -6
- package/node_modules/gauge/package.json +11 -12
- package/node_modules/jsbn/index.js +8 -9
- package/node_modules/jsbn/package.json +15 -11
- package/node_modules/mime-db/HISTORY.md +16 -0
- package/node_modules/mime-db/db.json +41 -2
- package/node_modules/mime-db/package.json +23 -22
- package/node_modules/mime-types/HISTORY.md +6 -0
- package/node_modules/mime-types/package.json +14 -13
- package/node_modules/node-pre-gyp/CHANGELOG.md +4 -0
- package/node_modules/node-pre-gyp/lib/node-pre-gyp.js +1 -1
- package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +52 -0
- package/node_modules/node-pre-gyp/package.json +15 -19
- package/node_modules/object-assign/index.js +11 -4
- package/node_modules/object-assign/package.json +22 -18
- package/node_modules/object-assign/readme.md +8 -3
- package/node_modules/qs/.eslintrc +3 -3
- package/node_modules/qs/CHANGELOG.md +12 -0
- package/node_modules/qs/README.md +34 -1
- package/node_modules/qs/dist/qs.js +32 -19
- package/node_modules/qs/lib/parse.js +9 -9
- package/node_modules/qs/lib/stringify.js +22 -9
- package/node_modules/qs/lib/utils.js +1 -1
- package/node_modules/qs/package.json +17 -17
- package/node_modules/qs/test/.eslintrc +1 -0
- package/node_modules/qs/test/parse.js +29 -4
- package/node_modules/qs/test/stringify.js +1 -1
- package/node_modules/rc/package.json +14 -10
- package/node_modules/sshpk/lib/identity.js +23 -1
- package/node_modules/sshpk/package.json +10 -10
- package/node_modules/strip-json-comments/index.js +70 -0
- package/node_modules/strip-json-comments/package.json +28 -30
- package/node_modules/strip-json-comments/readme.md +12 -28
- package/node_modules/supports-color/index.js +20 -2
- package/node_modules/supports-color/package.json +32 -31
- package/node_modules/supports-color/readme.md +6 -14
- package/package.json +2 -5
- package/node_modules/chalk/node_modules/supports-color/index.js +0 -50
- package/node_modules/chalk/node_modules/supports-color/package.json +0 -113
- package/node_modules/chalk/node_modules/supports-color/readme.md +0 -36
- package/node_modules/qs/CONTRIBUTING.md +0 -1
- package/node_modules/strip-json-comments/cli.js +0 -41
- package/node_modules/strip-json-comments/strip-json-comments.js +0 -73
- package/node_modules/supports-color/cli.js +0 -28
- /package/node_modules/{chalk/node_modules/supports-color → supports-color}/license +0 -0
@@ -4,13 +4,13 @@ var utils = require('./utils');
|
|
4
4
|
var formats = require('./formats');
|
5
5
|
|
6
6
|
var arrayPrefixGenerators = {
|
7
|
-
brackets: function brackets(prefix) {
|
7
|
+
brackets: function brackets(prefix) { // eslint-disable-line func-name-matching
|
8
8
|
return prefix + '[]';
|
9
9
|
},
|
10
|
-
indices: function indices(prefix, key) {
|
10
|
+
indices: function indices(prefix, key) { // eslint-disable-line func-name-matching
|
11
11
|
return prefix + '[' + key + ']';
|
12
12
|
},
|
13
|
-
repeat: function repeat(prefix) {
|
13
|
+
repeat: function repeat(prefix) { // eslint-disable-line func-name-matching
|
14
14
|
return prefix;
|
15
15
|
}
|
16
16
|
};
|
@@ -21,14 +21,26 @@ var defaults = {
|
|
21
21
|
delimiter: '&',
|
22
22
|
encode: true,
|
23
23
|
encoder: utils.encode,
|
24
|
-
serializeDate: function serializeDate(date) {
|
24
|
+
serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching
|
25
25
|
return toISO.call(date);
|
26
26
|
},
|
27
27
|
skipNulls: false,
|
28
28
|
strictNullHandling: false
|
29
29
|
};
|
30
30
|
|
31
|
-
var stringify = function stringify(
|
31
|
+
var stringify = function stringify( // eslint-disable-line func-name-matching
|
32
|
+
object,
|
33
|
+
prefix,
|
34
|
+
generateArrayPrefix,
|
35
|
+
strictNullHandling,
|
36
|
+
skipNulls,
|
37
|
+
encoder,
|
38
|
+
filter,
|
39
|
+
sort,
|
40
|
+
allowDots,
|
41
|
+
serializeDate,
|
42
|
+
formatter
|
43
|
+
) {
|
32
44
|
var obj = object;
|
33
45
|
if (typeof filter === 'function') {
|
34
46
|
obj = filter(prefix, obj);
|
@@ -107,6 +119,11 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNu
|
|
107
119
|
module.exports = function (object, opts) {
|
108
120
|
var obj = object;
|
109
121
|
var options = opts || {};
|
122
|
+
|
123
|
+
if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {
|
124
|
+
throw new TypeError('Encoder has to be a function.');
|
125
|
+
}
|
126
|
+
|
110
127
|
var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter;
|
111
128
|
var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;
|
112
129
|
var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls;
|
@@ -124,10 +141,6 @@ module.exports = function (object, opts) {
|
|
124
141
|
var objKeys;
|
125
142
|
var filter;
|
126
143
|
|
127
|
-
if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {
|
128
|
-
throw new TypeError('Encoder has to be a function.');
|
129
|
-
}
|
130
|
-
|
131
144
|
if (typeof options.filter === 'function') {
|
132
145
|
filter = options.filter;
|
133
146
|
obj = filter('', obj);
|
@@ -126,7 +126,7 @@ exports.encode = function (str) {
|
|
126
126
|
|
127
127
|
i += 1;
|
128
128
|
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
129
|
-
out += hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)];
|
129
|
+
out += hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]; // eslint-disable-line max-len
|
130
130
|
}
|
131
131
|
|
132
132
|
return out;
|
@@ -14,19 +14,19 @@
|
|
14
14
|
]
|
15
15
|
],
|
16
16
|
"_from": "qs@>=6.3.0 <6.4.0",
|
17
|
-
"_id": "qs@6.3.
|
17
|
+
"_id": "qs@6.3.1",
|
18
18
|
"_inCache": true,
|
19
19
|
"_location": "/qs",
|
20
|
-
"_nodeVersion": "
|
20
|
+
"_nodeVersion": "7.5.0",
|
21
21
|
"_npmOperationalInternal": {
|
22
|
-
"host": "packages-
|
23
|
-
"tmp": "tmp/qs-6.3.
|
22
|
+
"host": "packages-12-west.internal.npmjs.com",
|
23
|
+
"tmp": "tmp/qs-6.3.1.tgz_1487220058786_0.35462796757929027"
|
24
24
|
},
|
25
25
|
"_npmUser": {
|
26
26
|
"name": "ljharb",
|
27
27
|
"email": "ljharb@gmail.com"
|
28
28
|
},
|
29
|
-
"_npmVersion": "
|
29
|
+
"_npmVersion": "4.1.2",
|
30
30
|
"_phantomChildren": {},
|
31
31
|
"_requested": {
|
32
32
|
"raw": "qs@~6.3.0",
|
@@ -40,8 +40,8 @@
|
|
40
40
|
"_requiredBy": [
|
41
41
|
"/request"
|
42
42
|
],
|
43
|
-
"_resolved": "https://registry.npmjs.org/qs/-/qs-6.3.
|
44
|
-
"_shasum": "
|
43
|
+
"_resolved": "https://registry.npmjs.org/qs/-/qs-6.3.1.tgz",
|
44
|
+
"_shasum": "918c0b3bcd36679772baf135b1acb4c1651ed79d",
|
45
45
|
"_shrinkwrap": null,
|
46
46
|
"_spec": "qs@~6.3.0",
|
47
47
|
"_where": "/Users/eshanker/Code/fsevents/node_modules/request",
|
@@ -58,27 +58,27 @@
|
|
58
58
|
"dependencies": {},
|
59
59
|
"description": "A querystring parser that supports nesting and arrays, with a depth limit",
|
60
60
|
"devDependencies": {
|
61
|
-
"@ljharb/eslint-config": "^
|
62
|
-
"browserify": "^
|
61
|
+
"@ljharb/eslint-config": "^11.0.0",
|
62
|
+
"browserify": "^14.1.0",
|
63
63
|
"covert": "^1.1.0",
|
64
|
-
"eslint": "^3.
|
64
|
+
"eslint": "^3.15.0",
|
65
65
|
"evalmd": "^0.0.17",
|
66
|
-
"iconv-lite": "^0.4.
|
66
|
+
"iconv-lite": "^0.4.15",
|
67
67
|
"mkdirp": "^0.5.1",
|
68
68
|
"parallelshell": "^2.0.0",
|
69
|
-
"qs-iconv": "^1.0.
|
69
|
+
"qs-iconv": "^1.0.4",
|
70
70
|
"safe-publish-latest": "^1.1.1",
|
71
|
-
"tape": "^4.6.
|
71
|
+
"tape": "^4.6.3"
|
72
72
|
},
|
73
73
|
"directories": {},
|
74
74
|
"dist": {
|
75
|
-
"shasum": "
|
76
|
-
"tarball": "https://registry.npmjs.org/qs/-/qs-6.3.
|
75
|
+
"shasum": "918c0b3bcd36679772baf135b1acb4c1651ed79d",
|
76
|
+
"tarball": "https://registry.npmjs.org/qs/-/qs-6.3.1.tgz"
|
77
77
|
},
|
78
78
|
"engines": {
|
79
79
|
"node": ">=0.6"
|
80
80
|
},
|
81
|
-
"gitHead": "
|
81
|
+
"gitHead": "153ce84948845330d90178cbad982fc7371df538",
|
82
82
|
"homepage": "https://github.com/ljharb/qs",
|
83
83
|
"keywords": [
|
84
84
|
"querystring",
|
@@ -117,5 +117,5 @@
|
|
117
117
|
"test": "npm run --silent coverage",
|
118
118
|
"tests-only": "node test"
|
119
119
|
},
|
120
|
-
"version": "6.3.
|
120
|
+
"version": "6.3.1"
|
121
121
|
}
|
@@ -131,9 +131,9 @@ test('parse()', function (t) {
|
|
131
131
|
st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar&foo[]=foo'), { foo: { bad: 'baz', 0: 'bar', 1: 'foo' } });
|
132
132
|
st.deepEqual(qs.parse('foo[0][a]=a&foo[0][b]=b&foo[1][a]=aa&foo[1][b]=bb'), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] });
|
133
133
|
|
134
|
-
st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: false }), { a: { 0: 'b',
|
134
|
+
st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: false }), { a: { 0: 'b', t: 'u' } });
|
135
135
|
st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: true }), { a: { 0: 'b', t: 'u', hasOwnProperty: 'c' } });
|
136
|
-
st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: false }), { a: { 0: 'b',
|
136
|
+
st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: false }), { a: { 0: 'b', x: 'y' } });
|
137
137
|
st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: true }), { a: { 0: 'b', hasOwnProperty: 'c', x: 'y' } });
|
138
138
|
st.end();
|
139
139
|
});
|
@@ -413,9 +413,34 @@ test('parse()', function (t) {
|
|
413
413
|
st.end();
|
414
414
|
});
|
415
415
|
|
416
|
+
t.test('does not allow overwriting prototype properties', function (st) {
|
417
|
+
st.deepEqual(qs.parse('a[hasOwnProperty]=b', { allowPrototypes: false }), {});
|
418
|
+
st.deepEqual(qs.parse('hasOwnProperty=b', { allowPrototypes: false }), {});
|
419
|
+
|
420
|
+
st.deepEqual(
|
421
|
+
qs.parse('toString', { allowPrototypes: false }),
|
422
|
+
{},
|
423
|
+
'bare "toString" results in {}'
|
424
|
+
);
|
425
|
+
|
426
|
+
st.end();
|
427
|
+
});
|
428
|
+
|
416
429
|
t.test('can allow overwriting prototype properties', function (st) {
|
417
|
-
st.deepEqual(qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }), { a: { hasOwnProperty: 'b' } }
|
418
|
-
st.deepEqual(qs.parse('hasOwnProperty=b', { allowPrototypes: true }), { hasOwnProperty: 'b' }
|
430
|
+
st.deepEqual(qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }), { a: { hasOwnProperty: 'b' } });
|
431
|
+
st.deepEqual(qs.parse('hasOwnProperty=b', { allowPrototypes: true }), { hasOwnProperty: 'b' });
|
432
|
+
|
433
|
+
st.deepEqual(
|
434
|
+
qs.parse('toString', { allowPrototypes: true }),
|
435
|
+
{ toString: '' },
|
436
|
+
'bare "toString" results in { toString: "" }'
|
437
|
+
);
|
438
|
+
|
439
|
+
st.end();
|
440
|
+
});
|
441
|
+
|
442
|
+
t.test('params starting with a closing bracket', function (st) {
|
443
|
+
st.deepEqual(qs.parse(']=toString'), { ']': 'toString' });
|
419
444
|
st.end();
|
420
445
|
});
|
421
446
|
|
@@ -385,7 +385,7 @@ test('stringify()', function (t) {
|
|
385
385
|
st.equal(prefix, '', 'prefix is empty');
|
386
386
|
st.equal(value, obj);
|
387
387
|
} else if (prefix === 'c') {
|
388
|
-
return;
|
388
|
+
return void 0;
|
389
389
|
} else if (value instanceof Date) {
|
390
390
|
st.equal(prefix, 'e[f]');
|
391
391
|
return value.getTime();
|
@@ -14,15 +14,19 @@
|
|
14
14
|
]
|
15
15
|
],
|
16
16
|
"_from": "rc@>=1.1.6 <1.2.0",
|
17
|
-
"_id": "rc@1.1.
|
17
|
+
"_id": "rc@1.1.7",
|
18
18
|
"_inCache": true,
|
19
19
|
"_location": "/rc",
|
20
|
-
"_nodeVersion": "
|
20
|
+
"_nodeVersion": "6.9.4",
|
21
|
+
"_npmOperationalInternal": {
|
22
|
+
"host": "packages-18-east.internal.npmjs.com",
|
23
|
+
"tmp": "tmp/rc-1.1.7.tgz_1487322919345_0.9128507312852889"
|
24
|
+
},
|
21
25
|
"_npmUser": {
|
22
26
|
"name": "dominictarr",
|
23
27
|
"email": "dominic.tarr@gmail.com"
|
24
28
|
},
|
25
|
-
"_npmVersion": "3.
|
29
|
+
"_npmVersion": "3.10.10",
|
26
30
|
"_phantomChildren": {},
|
27
31
|
"_requested": {
|
28
32
|
"raw": "rc@~1.1.6",
|
@@ -36,8 +40,8 @@
|
|
36
40
|
"_requiredBy": [
|
37
41
|
"/node-pre-gyp"
|
38
42
|
],
|
39
|
-
"_resolved": "https://registry.npmjs.org/rc/-/rc-1.1.
|
40
|
-
"_shasum": "
|
43
|
+
"_resolved": "https://registry.npmjs.org/rc/-/rc-1.1.7.tgz",
|
44
|
+
"_shasum": "c5ea564bb07aff9fd3a5b32e906c1d3a65940fea",
|
41
45
|
"_shrinkwrap": null,
|
42
46
|
"_spec": "rc@~1.1.6",
|
43
47
|
"_where": "/Users/eshanker/Code/fsevents/node_modules/node-pre-gyp",
|
@@ -57,16 +61,16 @@
|
|
57
61
|
"deep-extend": "~0.4.0",
|
58
62
|
"ini": "~1.3.0",
|
59
63
|
"minimist": "^1.2.0",
|
60
|
-
"strip-json-comments": "~
|
64
|
+
"strip-json-comments": "~2.0.1"
|
61
65
|
},
|
62
66
|
"description": "hardwired configuration loader",
|
63
67
|
"devDependencies": {},
|
64
68
|
"directories": {},
|
65
69
|
"dist": {
|
66
|
-
"shasum": "
|
67
|
-
"tarball": "https://registry.npmjs.org/rc/-/rc-1.1.
|
70
|
+
"shasum": "c5ea564bb07aff9fd3a5b32e906c1d3a65940fea",
|
71
|
+
"tarball": "https://registry.npmjs.org/rc/-/rc-1.1.7.tgz"
|
68
72
|
},
|
69
|
-
"gitHead": "
|
73
|
+
"gitHead": "13bca1296fa95cd7795d30681652b2b7499d85d3",
|
70
74
|
"homepage": "https://github.com/dominictarr/rc#readme",
|
71
75
|
"keywords": [
|
72
76
|
"config",
|
@@ -92,5 +96,5 @@
|
|
92
96
|
"scripts": {
|
93
97
|
"test": "set -e; node test/test.js; node test/ini.js; node test/nested-env-vars.js"
|
94
98
|
},
|
95
|
-
"version": "1.1.
|
99
|
+
"version": "1.1.7"
|
96
100
|
}
|
@@ -116,13 +116,35 @@ Identity.prototype.toString = function () {
|
|
116
116
|
}).join(', '));
|
117
117
|
};
|
118
118
|
|
119
|
+
/*
|
120
|
+
* These are from X.680 -- PrintableString allowed chars are in section 37.4
|
121
|
+
* table 8. Spec for IA5Strings is "1,6 + SPACE + DEL" where 1 refers to
|
122
|
+
* ISO IR #001 (standard ASCII control characters) and 6 refers to ISO IR #006
|
123
|
+
* (the basic ASCII character set).
|
124
|
+
*/
|
125
|
+
/* JSSTYLED */
|
126
|
+
var NOT_PRINTABLE = /[^a-zA-Z0-9 '(),+.\/:=?-]/;
|
127
|
+
/* JSSTYLED */
|
128
|
+
var NOT_IA5 = /[^\x00-\x7f]/;
|
129
|
+
|
119
130
|
Identity.prototype.toAsn1 = function (der, tag) {
|
120
131
|
der.startSequence(tag);
|
121
132
|
this.components.forEach(function (c) {
|
122
133
|
der.startSequence(asn1.Ber.Constructor | asn1.Ber.Set);
|
123
134
|
der.startSequence();
|
124
135
|
der.writeOID(c.oid);
|
125
|
-
|
136
|
+
/*
|
137
|
+
* If we fit in a PrintableString, use that. Otherwise use an
|
138
|
+
* IA5String or UTF8String.
|
139
|
+
*/
|
140
|
+
if (c.value.match(NOT_IA5)) {
|
141
|
+
var v = new Buffer(c.value, 'utf8');
|
142
|
+
der.writeBuffer(v, asn1.Ber.Utf8String);
|
143
|
+
} else if (c.value.match(NOT_PRINTABLE)) {
|
144
|
+
der.writeString(c.value, asn1.Ber.IA5String);
|
145
|
+
} else {
|
146
|
+
der.writeString(c.value, asn1.Ber.PrintableString);
|
147
|
+
}
|
126
148
|
der.endSequence();
|
127
149
|
der.endSequence();
|
128
150
|
});
|
@@ -14,19 +14,19 @@
|
|
14
14
|
]
|
15
15
|
],
|
16
16
|
"_from": "sshpk@>=1.7.0 <2.0.0",
|
17
|
-
"_id": "sshpk@1.10.
|
17
|
+
"_id": "sshpk@1.10.2",
|
18
18
|
"_inCache": true,
|
19
19
|
"_location": "/sshpk",
|
20
20
|
"_nodeVersion": "0.12.15",
|
21
21
|
"_npmOperationalInternal": {
|
22
|
-
"host": "packages-
|
23
|
-
"tmp": "tmp/sshpk-1.10.
|
22
|
+
"host": "packages-12-west.internal.npmjs.com",
|
23
|
+
"tmp": "tmp/sshpk-1.10.2.tgz_1484356342573_0.6690851037856191"
|
24
24
|
},
|
25
25
|
"_npmUser": {
|
26
26
|
"name": "arekinath",
|
27
27
|
"email": "alex@cooperi.net"
|
28
28
|
},
|
29
|
-
"_npmVersion": "3.10.
|
29
|
+
"_npmVersion": "3.10.10",
|
30
30
|
"_phantomChildren": {},
|
31
31
|
"_requested": {
|
32
32
|
"raw": "sshpk@^1.7.0",
|
@@ -40,8 +40,8 @@
|
|
40
40
|
"_requiredBy": [
|
41
41
|
"/http-signature"
|
42
42
|
],
|
43
|
-
"_resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.10.
|
44
|
-
"_shasum": "
|
43
|
+
"_resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.10.2.tgz",
|
44
|
+
"_shasum": "d5a804ce22695515638e798dbe23273de070a5fa",
|
45
45
|
"_shrinkwrap": null,
|
46
46
|
"_spec": "sshpk@^1.7.0",
|
47
47
|
"_where": "/Users/eshanker/Code/fsevents/node_modules/http-signature",
|
@@ -94,13 +94,13 @@
|
|
94
94
|
"man": "./man/man1"
|
95
95
|
},
|
96
96
|
"dist": {
|
97
|
-
"shasum": "
|
98
|
-
"tarball": "https://registry.npmjs.org/sshpk/-/sshpk-1.10.
|
97
|
+
"shasum": "d5a804ce22695515638e798dbe23273de070a5fa",
|
98
|
+
"tarball": "https://registry.npmjs.org/sshpk/-/sshpk-1.10.2.tgz"
|
99
99
|
},
|
100
100
|
"engines": {
|
101
101
|
"node": ">=0.10.0"
|
102
102
|
},
|
103
|
-
"gitHead": "
|
103
|
+
"gitHead": "3ae535658f83e610c0dd5bb97a1b2105db7220c7",
|
104
104
|
"homepage": "https://github.com/arekinath/node-sshpk#readme",
|
105
105
|
"license": "MIT",
|
106
106
|
"main": "lib/index.js",
|
@@ -131,5 +131,5 @@
|
|
131
131
|
"scripts": {
|
132
132
|
"test": "tape test/*.js"
|
133
133
|
},
|
134
|
-
"version": "1.10.
|
134
|
+
"version": "1.10.2"
|
135
135
|
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
'use strict';
|
2
|
+
var singleComment = 1;
|
3
|
+
var multiComment = 2;
|
4
|
+
|
5
|
+
function stripWithoutWhitespace() {
|
6
|
+
return '';
|
7
|
+
}
|
8
|
+
|
9
|
+
function stripWithWhitespace(str, start, end) {
|
10
|
+
return str.slice(start, end).replace(/\S/g, ' ');
|
11
|
+
}
|
12
|
+
|
13
|
+
module.exports = function (str, opts) {
|
14
|
+
opts = opts || {};
|
15
|
+
|
16
|
+
var currentChar;
|
17
|
+
var nextChar;
|
18
|
+
var insideString = false;
|
19
|
+
var insideComment = false;
|
20
|
+
var offset = 0;
|
21
|
+
var ret = '';
|
22
|
+
var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace;
|
23
|
+
|
24
|
+
for (var i = 0; i < str.length; i++) {
|
25
|
+
currentChar = str[i];
|
26
|
+
nextChar = str[i + 1];
|
27
|
+
|
28
|
+
if (!insideComment && currentChar === '"') {
|
29
|
+
var escaped = str[i - 1] === '\\' && str[i - 2] !== '\\';
|
30
|
+
if (!escaped) {
|
31
|
+
insideString = !insideString;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
if (insideString) {
|
36
|
+
continue;
|
37
|
+
}
|
38
|
+
|
39
|
+
if (!insideComment && currentChar + nextChar === '//') {
|
40
|
+
ret += str.slice(offset, i);
|
41
|
+
offset = i;
|
42
|
+
insideComment = singleComment;
|
43
|
+
i++;
|
44
|
+
} else if (insideComment === singleComment && currentChar + nextChar === '\r\n') {
|
45
|
+
i++;
|
46
|
+
insideComment = false;
|
47
|
+
ret += strip(str, offset, i);
|
48
|
+
offset = i;
|
49
|
+
continue;
|
50
|
+
} else if (insideComment === singleComment && currentChar === '\n') {
|
51
|
+
insideComment = false;
|
52
|
+
ret += strip(str, offset, i);
|
53
|
+
offset = i;
|
54
|
+
} else if (!insideComment && currentChar + nextChar === '/*') {
|
55
|
+
ret += str.slice(offset, i);
|
56
|
+
offset = i;
|
57
|
+
insideComment = multiComment;
|
58
|
+
i++;
|
59
|
+
continue;
|
60
|
+
} else if (insideComment === multiComment && currentChar + nextChar === '*/') {
|
61
|
+
i++;
|
62
|
+
insideComment = false;
|
63
|
+
ret += strip(str, offset, i + 1);
|
64
|
+
offset = i + 1;
|
65
|
+
continue;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
|
70
|
+
};
|
@@ -2,75 +2,76 @@
|
|
2
2
|
"_args": [
|
3
3
|
[
|
4
4
|
{
|
5
|
-
"raw": "strip-json-comments@~
|
5
|
+
"raw": "strip-json-comments@~2.0.1",
|
6
6
|
"scope": null,
|
7
7
|
"escapedName": "strip-json-comments",
|
8
8
|
"name": "strip-json-comments",
|
9
|
-
"rawSpec": "~
|
10
|
-
"spec": ">=
|
9
|
+
"rawSpec": "~2.0.1",
|
10
|
+
"spec": ">=2.0.1 <2.1.0",
|
11
11
|
"type": "range"
|
12
12
|
},
|
13
13
|
"/Users/eshanker/Code/fsevents/node_modules/rc"
|
14
14
|
]
|
15
15
|
],
|
16
|
-
"_from": "strip-json-comments@>=
|
17
|
-
"_id": "strip-json-comments@
|
16
|
+
"_from": "strip-json-comments@>=2.0.1 <2.1.0",
|
17
|
+
"_id": "strip-json-comments@2.0.1",
|
18
18
|
"_inCache": true,
|
19
19
|
"_location": "/strip-json-comments",
|
20
|
-
"_nodeVersion": "
|
20
|
+
"_nodeVersion": "4.2.4",
|
21
|
+
"_npmOperationalInternal": {
|
22
|
+
"host": "packages-9-west.internal.npmjs.com",
|
23
|
+
"tmp": "tmp/strip-json-comments-2.0.1.tgz_1455006605207_0.8280157081317157"
|
24
|
+
},
|
21
25
|
"_npmUser": {
|
22
26
|
"name": "sindresorhus",
|
23
27
|
"email": "sindresorhus@gmail.com"
|
24
28
|
},
|
25
|
-
"_npmVersion": "
|
29
|
+
"_npmVersion": "3.7.2",
|
26
30
|
"_phantomChildren": {},
|
27
31
|
"_requested": {
|
28
|
-
"raw": "strip-json-comments@~
|
32
|
+
"raw": "strip-json-comments@~2.0.1",
|
29
33
|
"scope": null,
|
30
34
|
"escapedName": "strip-json-comments",
|
31
35
|
"name": "strip-json-comments",
|
32
|
-
"rawSpec": "~
|
33
|
-
"spec": ">=
|
36
|
+
"rawSpec": "~2.0.1",
|
37
|
+
"spec": ">=2.0.1 <2.1.0",
|
34
38
|
"type": "range"
|
35
39
|
},
|
36
40
|
"_requiredBy": [
|
37
41
|
"/rc"
|
38
42
|
],
|
39
|
-
"_resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-
|
40
|
-
"_shasum": "
|
43
|
+
"_resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
44
|
+
"_shasum": "3c531942e908c2697c0ec344858c286c7ca0a60a",
|
41
45
|
"_shrinkwrap": null,
|
42
|
-
"_spec": "strip-json-comments@~
|
46
|
+
"_spec": "strip-json-comments@~2.0.1",
|
43
47
|
"_where": "/Users/eshanker/Code/fsevents/node_modules/rc",
|
44
48
|
"author": {
|
45
49
|
"name": "Sindre Sorhus",
|
46
50
|
"email": "sindresorhus@gmail.com",
|
47
51
|
"url": "sindresorhus.com"
|
48
52
|
},
|
49
|
-
"bin": {
|
50
|
-
"strip-json-comments": "cli.js"
|
51
|
-
},
|
52
53
|
"bugs": {
|
53
54
|
"url": "https://github.com/sindresorhus/strip-json-comments/issues"
|
54
55
|
},
|
55
56
|
"dependencies": {},
|
56
57
|
"description": "Strip comments from JSON. Lets you use comments in your JSON files!",
|
57
58
|
"devDependencies": {
|
58
|
-
"
|
59
|
+
"ava": "*",
|
60
|
+
"xo": "*"
|
59
61
|
},
|
60
62
|
"directories": {},
|
61
63
|
"dist": {
|
62
|
-
"shasum": "
|
63
|
-
"tarball": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-
|
64
|
+
"shasum": "3c531942e908c2697c0ec344858c286c7ca0a60a",
|
65
|
+
"tarball": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz"
|
64
66
|
},
|
65
67
|
"engines": {
|
66
|
-
"node": ">=0.
|
68
|
+
"node": ">=0.10.0"
|
67
69
|
},
|
68
70
|
"files": [
|
69
|
-
"
|
70
|
-
"strip-json-comments.js"
|
71
|
+
"index.js"
|
71
72
|
],
|
72
|
-
"gitHead": "
|
73
|
-
"homepage": "https://github.com/sindresorhus/strip-json-comments",
|
73
|
+
"gitHead": "1aef99eaa70d07981156e8aaa722e750c3b4eaf9",
|
74
|
+
"homepage": "https://github.com/sindresorhus/strip-json-comments#readme",
|
74
75
|
"keywords": [
|
75
76
|
"json",
|
76
77
|
"strip",
|
@@ -86,12 +87,9 @@
|
|
86
87
|
"settings",
|
87
88
|
"util",
|
88
89
|
"env",
|
89
|
-
"environment"
|
90
|
-
"cli",
|
91
|
-
"bin"
|
90
|
+
"environment"
|
92
91
|
],
|
93
92
|
"license": "MIT",
|
94
|
-
"main": "strip-json-comments",
|
95
93
|
"maintainers": [
|
96
94
|
{
|
97
95
|
"name": "sindresorhus",
|
@@ -106,7 +104,7 @@
|
|
106
104
|
"url": "git+https://github.com/sindresorhus/strip-json-comments.git"
|
107
105
|
},
|
108
106
|
"scripts": {
|
109
|
-
"test": "
|
107
|
+
"test": "xo && ava"
|
110
108
|
},
|
111
|
-
"version": "
|
109
|
+
"version": "2.0.1"
|
112
110
|
}
|
@@ -11,34 +11,23 @@ This is now possible:
|
|
11
11
|
}
|
12
12
|
```
|
13
13
|
|
14
|
-
It will
|
14
|
+
It will replace single-line comments `//` and multi-line comments `/**/` with whitespace. This allows JSON error positions to remain as close as possible to the original source.
|
15
15
|
|
16
16
|
Also available as a [gulp](https://github.com/sindresorhus/gulp-strip-json-comments)/[grunt](https://github.com/sindresorhus/grunt-strip-json-comments)/[broccoli](https://github.com/sindresorhus/broccoli-strip-json-comments) plugin.
|
17
17
|
|
18
|
-
-
|
19
|
-
|
20
|
-
*There's also [`json-comments`](https://npmjs.org/package/json-comments), but it's only for Node.js, inefficient, bloated as it also minifies, and comes with a `require` hook, which is :(*
|
21
|
-
|
22
18
|
|
23
19
|
## Install
|
24
20
|
|
25
|
-
```sh
|
26
|
-
$ npm install --save strip-json-comments
|
27
|
-
```
|
28
|
-
|
29
|
-
```sh
|
30
|
-
$ bower install --save strip-json-comments
|
31
21
|
```
|
32
|
-
|
33
|
-
```sh
|
34
|
-
$ component install sindresorhus/strip-json-comments
|
22
|
+
$ npm install --save strip-json-comments
|
35
23
|
```
|
36
24
|
|
37
25
|
|
38
26
|
## Usage
|
39
27
|
|
40
28
|
```js
|
41
|
-
|
29
|
+
const json = '{/*rainbows*/"unicorn":"cake"}';
|
30
|
+
|
42
31
|
JSON.parse(stripJsonComments(json));
|
43
32
|
//=> {unicorn: 'cake'}
|
44
33
|
```
|
@@ -46,7 +35,7 @@ JSON.parse(stripJsonComments(json));
|
|
46
35
|
|
47
36
|
## API
|
48
37
|
|
49
|
-
### stripJsonComments(input)
|
38
|
+
### stripJsonComments(input, [options])
|
50
39
|
|
51
40
|
#### input
|
52
41
|
|
@@ -54,25 +43,20 @@ Type: `string`
|
|
54
43
|
|
55
44
|
Accepts a string with JSON and returns a string without comments.
|
56
45
|
|
46
|
+
#### options
|
57
47
|
|
58
|
-
|
48
|
+
##### whitespace
|
59
49
|
|
60
|
-
|
61
|
-
|
62
|
-
```
|
50
|
+
Type: `boolean`
|
51
|
+
Default: `true`
|
63
52
|
|
64
|
-
|
65
|
-
$ strip-json-comments --help
|
66
|
-
|
67
|
-
strip-json-comments input-file > output-file
|
68
|
-
# or
|
69
|
-
strip-json-comments < input-file > output-file
|
70
|
-
```
|
53
|
+
Replace comments with whitespace instead of stripping them entirely.
|
71
54
|
|
72
55
|
|
73
56
|
## Related
|
74
57
|
|
75
|
-
- [
|
58
|
+
- [strip-json-comments-cli](https://github.com/sindresorhus/strip-json-comments-cli) - CLI for this module
|
59
|
+
- [strip-css-comments](https://github.com/sindresorhus/strip-css-comments) - Strip comments from CSS
|
76
60
|
|
77
61
|
|
78
62
|
## License
|