fsevents 1.2.8 → 1.2.12
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.
- package/.travis.yml +1 -0
- package/binding.gyp +1 -9
- package/fsevents.cc +8 -11
- package/fsevents.js +1 -3
- package/node_modules/abbrev/package.json +1 -1
- package/node_modules/ansi-regex/package.json +1 -1
- package/node_modules/aproba/package.json +1 -1
- package/node_modules/are-we-there-yet/package.json +1 -1
- package/node_modules/balanced-match/package.json +1 -1
- package/node_modules/brace-expansion/package.json +1 -1
- package/node_modules/chownr/chownr.js +98 -19
- package/node_modules/chownr/package.json +13 -10
- package/node_modules/code-point-at/package.json +1 -1
- package/node_modules/concat-map/package.json +1 -1
- package/node_modules/console-control-strings/package.json +1 -1
- package/node_modules/core-util-is/package.json +1 -1
- package/node_modules/debug/README.md +0 -18
- package/node_modules/debug/dist/debug.js +2 -28
- package/node_modules/debug/node.js +1 -0
- package/node_modules/debug/package.json +12 -24
- package/node_modules/debug/src/browser.js +103 -187
- package/node_modules/debug/src/common.js +240 -257
- package/node_modules/debug/src/index.js +5 -3
- package/node_modules/debug/src/node.js +82 -165
- package/node_modules/deep-extend/package.json +1 -1
- package/node_modules/delegates/package.json +1 -1
- package/node_modules/detect-libc/package.json +2 -2
- package/node_modules/fs-minipass/index.js +2 -1
- package/node_modules/fs-minipass/package.json +13 -10
- package/node_modules/fs.realpath/package.json +1 -1
- package/node_modules/gauge/package.json +1 -1
- package/node_modules/glob/LICENSE +6 -0
- package/node_modules/glob/README.md +8 -1
- package/node_modules/glob/package.json +9 -6
- package/node_modules/has-unicode/package.json +1 -1
- package/node_modules/iconv-lite/package.json +1 -1
- package/node_modules/ignore-walk/README.md +1 -1
- package/node_modules/ignore-walk/index.js +9 -5
- package/node_modules/ignore-walk/package.json +11 -8
- package/node_modules/inflight/package.json +1 -1
- package/node_modules/inherits/inherits.js +2 -0
- package/node_modules/inherits/inherits_browser.js +18 -14
- package/node_modules/inherits/package.json +8 -8
- package/node_modules/ini/package.json +1 -1
- package/node_modules/is-fullwidth-code-point/package.json +1 -1
- package/node_modules/isarray/package.json +1 -1
- package/node_modules/minimatch/package.json +1 -1
- package/node_modules/minimist/.travis.yml +4 -0
- package/node_modules/minimist/example/parse.js +1 -1
- package/node_modules/minimist/index.js +112 -54
- package/node_modules/minimist/package.json +17 -14
- package/node_modules/minimist/readme.markdown +28 -6
- package/node_modules/{rc/node_modules/minimist → minimist}/test/all_bool.js +0 -0
- package/node_modules/{rc/node_modules/minimist → minimist}/test/bool.js +12 -0
- package/node_modules/minimist/test/dash.js +7 -0
- package/node_modules/minimist/test/default_bool.js +15 -0
- package/node_modules/minimist/test/dotted.js +6 -0
- package/node_modules/{rc/node_modules/minimist → minimist}/test/kv_short.js +0 -0
- package/node_modules/{rc/node_modules/minimist → minimist}/test/num.js +0 -0
- package/node_modules/minimist/test/parse.js +23 -144
- package/node_modules/minimist/test/parse_modified.js +1 -1
- package/node_modules/minimist/test/proto.js +44 -0
- package/node_modules/{rc/node_modules/minimist → minimist}/test/stop_early.js +0 -0
- package/node_modules/{rc/node_modules/minimist → minimist}/test/unknown.js +0 -0
- package/node_modules/minipass/README.md +486 -4
- package/node_modules/minipass/index.js +190 -28
- package/node_modules/minipass/package.json +17 -14
- package/node_modules/minizlib/README.md +36 -27
- package/node_modules/minizlib/constants.js +73 -4
- package/node_modules/minizlib/index.js +137 -152
- package/node_modules/minizlib/package.json +12 -12
- package/node_modules/mkdirp/package.json +17 -10
- package/node_modules/ms/index.js +2 -2
- package/node_modules/ms/package.json +6 -6
- package/node_modules/ms/readme.md +1 -1
- package/node_modules/needle/.github/workflows/nodejs.yml +27 -0
- package/node_modules/needle/README.md +5 -5
- package/node_modules/needle/lib/needle.js +11 -3
- package/node_modules/needle/package.json +8 -8
- package/node_modules/needle/test/compression_spec.js +18 -0
- package/node_modules/needle/test/headers_spec.js +1 -1
- package/node_modules/node-pre-gyp/CHANGELOG.md +11 -0
- package/node_modules/node-pre-gyp/lib/install.js +44 -14
- package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +240 -0
- package/node_modules/node-pre-gyp/lib/util/napi.js +3 -2
- package/node_modules/node-pre-gyp/package.json +13 -13
- package/node_modules/nopt/lib/nopt.js +6 -1
- package/node_modules/nopt/package.json +15 -8
- package/node_modules/npm-bundled/index.js +13 -5
- package/node_modules/npm-bundled/package.json +9 -6
- package/node_modules/npm-normalize-package-bin/.github/settings.yml +2 -0
- package/node_modules/npm-normalize-package-bin/.npmignore +24 -0
- package/node_modules/npm-normalize-package-bin/LICENSE +15 -0
- package/node_modules/npm-normalize-package-bin/README.md +14 -0
- package/node_modules/npm-normalize-package-bin/index.js +60 -0
- package/node_modules/npm-normalize-package-bin/package-lock.json +3529 -0
- package/node_modules/npm-normalize-package-bin/package.json +58 -0
- package/node_modules/npm-normalize-package-bin/test/array.js +37 -0
- package/node_modules/npm-normalize-package-bin/test/nobin.js +35 -0
- package/node_modules/npm-normalize-package-bin/test/object.js +141 -0
- package/node_modules/npm-normalize-package-bin/test/string.js +37 -0
- package/node_modules/npm-packlist/index.js +55 -16
- package/node_modules/npm-packlist/package.json +18 -10
- package/node_modules/npmlog/package.json +1 -1
- package/node_modules/number-is-nan/package.json +1 -1
- package/node_modules/object-assign/package.json +1 -1
- package/node_modules/once/package.json +1 -1
- package/node_modules/os-homedir/package.json +1 -1
- package/node_modules/os-tmpdir/package.json +1 -1
- package/node_modules/osenv/package.json +1 -1
- package/node_modules/path-is-absolute/package.json +1 -1
- package/node_modules/process-nextick-args/index.js +2 -1
- package/node_modules/process-nextick-args/package.json +6 -6
- package/node_modules/rc/package.json +2 -2
- package/node_modules/readable-stream/.travis.yml +9 -30
- package/node_modules/readable-stream/lib/_stream_duplex.js +1 -1
- package/node_modules/readable-stream/lib/_stream_passthrough.js +1 -1
- package/node_modules/readable-stream/lib/_stream_readable.js +1 -1
- package/node_modules/readable-stream/lib/_stream_transform.js +1 -1
- package/node_modules/readable-stream/lib/_stream_writable.js +1 -1
- package/node_modules/readable-stream/package.json +6 -6
- package/node_modules/rimraf/package.json +7 -7
- package/node_modules/rimraf/rimraf.js +9 -1
- package/node_modules/safe-buffer/package.json +1 -1
- package/node_modules/safer-buffer/package.json +1 -1
- package/node_modules/sax/package.json +1 -1
- package/node_modules/semver/README.md +12 -11
- package/node_modules/semver/package.json +7 -7
- package/node_modules/set-blocking/package.json +1 -1
- package/node_modules/signal-exit/package.json +1 -1
- package/node_modules/string-width/package.json +1 -1
- package/node_modules/string_decoder/package.json +1 -1
- package/node_modules/strip-ansi/package.json +1 -1
- package/node_modules/strip-json-comments/package.json +1 -1
- package/node_modules/tar/lib/large-numbers.js +32 -27
- package/node_modules/tar/lib/mkdir.js +2 -2
- package/node_modules/tar/lib/parse.js +6 -1
- package/node_modules/tar/lib/read-entry.js +4 -0
- package/node_modules/tar/lib/write-entry.js +2 -2
- package/node_modules/tar/package.json +22 -18
- package/node_modules/util-deprecate/package.json +1 -1
- package/node_modules/wide-align/package.json +1 -1
- package/node_modules/wrappy/package.json +1 -1
- package/node_modules/yallist/package.json +11 -11
- package/node_modules/yallist/yallist.js +50 -0
- package/package.json +5 -15
- package/src/constants.cc +20 -20
- package/install.js +0 -7
- package/node_modules/mkdirp/.travis.yml +0 -8
- package/node_modules/mkdirp/examples/pow.js +0 -6
- package/node_modules/mkdirp/test/chmod.js +0 -41
- package/node_modules/mkdirp/test/clobber.js +0 -38
- package/node_modules/mkdirp/test/mkdirp.js +0 -28
- package/node_modules/mkdirp/test/opts_fs.js +0 -29
- package/node_modules/mkdirp/test/opts_fs_sync.js +0 -27
- package/node_modules/mkdirp/test/perm.js +0 -32
- package/node_modules/mkdirp/test/perm_sync.js +0 -36
- package/node_modules/mkdirp/test/race.js +0 -37
- package/node_modules/mkdirp/test/rel.js +0 -32
- package/node_modules/mkdirp/test/return.js +0 -25
- package/node_modules/mkdirp/test/return_sync.js +0 -24
- package/node_modules/mkdirp/test/root.js +0 -19
- package/node_modules/mkdirp/test/sync.js +0 -32
- package/node_modules/mkdirp/test/umask.js +0 -28
- package/node_modules/mkdirp/test/umask_sync.js +0 -32
- package/node_modules/needle/.npmignore +0 -6
- package/node_modules/needle/package-lock.json +0 -395
- package/node_modules/needle/test/keys/ssl.cert +0 -21
- package/node_modules/needle/test/keys/ssl.key +0 -27
- package/node_modules/nopt/.npmignore +0 -1
- package/node_modules/nopt/.travis.yml +0 -8
- package/node_modules/nopt/examples/my-program.js +0 -30
- package/node_modules/nopt/test/basic.js +0 -303
- package/node_modules/rc/node_modules/minimist/.travis.yml +0 -8
- package/node_modules/rc/node_modules/minimist/LICENSE +0 -18
- package/node_modules/rc/node_modules/minimist/example/parse.js +0 -2
- package/node_modules/rc/node_modules/minimist/index.js +0 -236
- package/node_modules/rc/node_modules/minimist/package.json +0 -73
- package/node_modules/rc/node_modules/minimist/readme.markdown +0 -91
- package/node_modules/rc/node_modules/minimist/test/dash.js +0 -31
- package/node_modules/rc/node_modules/minimist/test/default_bool.js +0 -35
- package/node_modules/rc/node_modules/minimist/test/dotted.js +0 -22
- package/node_modules/rc/node_modules/minimist/test/long.js +0 -31
- package/node_modules/rc/node_modules/minimist/test/parse.js +0 -197
- package/node_modules/rc/node_modules/minimist/test/parse_modified.js +0 -9
- package/node_modules/rc/node_modules/minimist/test/short.js +0 -67
- package/node_modules/rc/node_modules/minimist/test/whitespace.js +0 -8
@@ -1,23 +1,27 @@
|
|
1
1
|
if (typeof Object.create === 'function') {
|
2
2
|
// implementation from standard node.js 'util' module
|
3
3
|
module.exports = function inherits(ctor, superCtor) {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
4
|
+
if (superCtor) {
|
5
|
+
ctor.super_ = superCtor
|
6
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
7
|
+
constructor: {
|
8
|
+
value: ctor,
|
9
|
+
enumerable: false,
|
10
|
+
writable: true,
|
11
|
+
configurable: true
|
12
|
+
}
|
13
|
+
})
|
14
|
+
}
|
13
15
|
};
|
14
16
|
} else {
|
15
17
|
// old school shim for old browsers
|
16
18
|
module.exports = function inherits(ctor, superCtor) {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
if (superCtor) {
|
20
|
+
ctor.super_ = superCtor
|
21
|
+
var TempCtor = function () {}
|
22
|
+
TempCtor.prototype = superCtor.prototype
|
23
|
+
ctor.prototype = new TempCtor()
|
24
|
+
ctor.prototype.constructor = ctor
|
25
|
+
}
|
22
26
|
}
|
23
27
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"_from": "inherits@~2.0.3",
|
3
|
-
"_id": "inherits@2.0.
|
3
|
+
"_id": "inherits@2.0.4",
|
4
4
|
"_inBundle": false,
|
5
|
-
"_integrity": "
|
5
|
+
"_integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
6
6
|
"_location": "/inherits",
|
7
7
|
"_phantomChildren": {},
|
8
8
|
"_requested": {
|
@@ -19,10 +19,10 @@
|
|
19
19
|
"/glob",
|
20
20
|
"/readable-stream"
|
21
21
|
],
|
22
|
-
"_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.
|
23
|
-
"_shasum": "
|
22
|
+
"_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
23
|
+
"_shasum": "0fa2c64f932917c3433a0ded55363aae37416b7c",
|
24
24
|
"_spec": "inherits@~2.0.3",
|
25
|
-
"_where": "/Users/
|
25
|
+
"_where": "/Users/user/Developer/personal/fsevents/node_modules/readable-stream",
|
26
26
|
"browser": "./inherits_browser.js",
|
27
27
|
"bugs": {
|
28
28
|
"url": "https://github.com/isaacs/inherits/issues"
|
@@ -31,7 +31,7 @@
|
|
31
31
|
"deprecated": false,
|
32
32
|
"description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
|
33
33
|
"devDependencies": {
|
34
|
-
"tap": "^
|
34
|
+
"tap": "^14.2.4"
|
35
35
|
},
|
36
36
|
"files": [
|
37
37
|
"inherits.js",
|
@@ -56,7 +56,7 @@
|
|
56
56
|
"url": "git://github.com/isaacs/inherits.git"
|
57
57
|
},
|
58
58
|
"scripts": {
|
59
|
-
"test": "
|
59
|
+
"test": "tap"
|
60
60
|
},
|
61
|
-
"version": "2.0.
|
61
|
+
"version": "2.0.4"
|
62
62
|
}
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"_resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
|
22
22
|
"_shasum": "eee25f56db1c9ec6085e0c22778083f596abf927",
|
23
23
|
"_spec": "ini@~1.3.0",
|
24
|
-
"_where": "/Users/
|
24
|
+
"_where": "/Users/user/Developer/personal/fsevents/node_modules/rc",
|
25
25
|
"author": {
|
26
26
|
"name": "Isaac Z. Schlueter",
|
27
27
|
"email": "i@izs.me",
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"_resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
|
22
22
|
"_shasum": "ef9e31386f031a7f0d643af82fde50c457ef00cb",
|
23
23
|
"_spec": "is-fullwidth-code-point@^1.0.0",
|
24
|
-
"_where": "/Users/
|
24
|
+
"_where": "/Users/user/Developer/personal/fsevents/node_modules/string-width",
|
25
25
|
"author": {
|
26
26
|
"name": "Sindre Sorhus",
|
27
27
|
"email": "sindresorhus@gmail.com",
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"_resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
22
22
|
"_shasum": "bb935d48582cba168c06834957a54a3e07124f11",
|
23
23
|
"_spec": "isarray@~1.0.0",
|
24
|
-
"_where": "/Users/
|
24
|
+
"_where": "/Users/user/Developer/personal/fsevents/node_modules/readable-stream",
|
25
25
|
"author": {
|
26
26
|
"name": "Julian Gruber",
|
27
27
|
"email": "mail@juliangruber.com",
|
@@ -22,7 +22,7 @@
|
|
22
22
|
"_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
23
23
|
"_shasum": "5166e286457f03306064be5497e8dbb0c3d32083",
|
24
24
|
"_spec": "minimatch@^3.0.4",
|
25
|
-
"_where": "/Users/
|
25
|
+
"_where": "/Users/user/Developer/personal/fsevents/node_modules/ignore-walk",
|
26
26
|
"author": {
|
27
27
|
"name": "Isaac Z. Schlueter",
|
28
28
|
"email": "i@izs.me",
|
@@ -1,2 +1,2 @@
|
|
1
1
|
var argv = require('../')(process.argv.slice(2));
|
2
|
-
console.
|
2
|
+
console.log(argv);
|
@@ -1,15 +1,19 @@
|
|
1
1
|
module.exports = function (args, opts) {
|
2
2
|
if (!opts) opts = {};
|
3
3
|
|
4
|
-
var flags = { bools : {}, strings : {} };
|
5
|
-
|
6
|
-
|
7
|
-
flags.
|
8
|
-
}
|
9
|
-
|
10
|
-
[]
|
11
|
-
|
12
|
-
}
|
4
|
+
var flags = { bools : {}, strings : {}, unknownFn: null };
|
5
|
+
|
6
|
+
if (typeof opts['unknown'] === 'function') {
|
7
|
+
flags.unknownFn = opts['unknown'];
|
8
|
+
}
|
9
|
+
|
10
|
+
if (typeof opts['boolean'] === 'boolean' && opts['boolean']) {
|
11
|
+
flags.allBools = true;
|
12
|
+
} else {
|
13
|
+
[].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
|
14
|
+
flags.bools[key] = true;
|
15
|
+
});
|
16
|
+
}
|
13
17
|
|
14
18
|
var aliases = {};
|
15
19
|
Object.keys(opts.alias || {}).forEach(function (key) {
|
@@ -20,7 +24,14 @@ module.exports = function (args, opts) {
|
|
20
24
|
}));
|
21
25
|
});
|
22
26
|
});
|
23
|
-
|
27
|
+
|
28
|
+
[].concat(opts.string).filter(Boolean).forEach(function (key) {
|
29
|
+
flags.strings[key] = true;
|
30
|
+
if (aliases[key]) {
|
31
|
+
flags.strings[aliases[key]] = true;
|
32
|
+
}
|
33
|
+
});
|
34
|
+
|
24
35
|
var defaults = opts['default'] || {};
|
25
36
|
|
26
37
|
var argv = { _ : [] };
|
@@ -35,7 +46,16 @@ module.exports = function (args, opts) {
|
|
35
46
|
args = args.slice(0, args.indexOf('--'));
|
36
47
|
}
|
37
48
|
|
38
|
-
function
|
49
|
+
function argDefined(key, arg) {
|
50
|
+
return (flags.allBools && /^--[^=]+$/.test(arg)) ||
|
51
|
+
flags.strings[key] || flags.bools[key] || aliases[key];
|
52
|
+
}
|
53
|
+
|
54
|
+
function setArg (key, val, arg) {
|
55
|
+
if (arg && flags.unknownFn && !argDefined(key, arg)) {
|
56
|
+
if (flags.unknownFn(arg) === false) return;
|
57
|
+
}
|
58
|
+
|
39
59
|
var value = !flags.strings[key] && isNumber(val)
|
40
60
|
? Number(val) : val
|
41
61
|
;
|
@@ -45,7 +65,41 @@ module.exports = function (args, opts) {
|
|
45
65
|
setKey(argv, x.split('.'), value);
|
46
66
|
});
|
47
67
|
}
|
68
|
+
|
69
|
+
function setKey (obj, keys, value) {
|
70
|
+
var o = obj;
|
71
|
+
for (var i = 0; i < keys.length-1; i++) {
|
72
|
+
var key = keys[i];
|
73
|
+
if (key === '__proto__') return;
|
74
|
+
if (o[key] === undefined) o[key] = {};
|
75
|
+
if (o[key] === Object.prototype || o[key] === Number.prototype
|
76
|
+
|| o[key] === String.prototype) o[key] = {};
|
77
|
+
if (o[key] === Array.prototype) o[key] = [];
|
78
|
+
o = o[key];
|
79
|
+
}
|
80
|
+
|
81
|
+
var key = keys[keys.length - 1];
|
82
|
+
if (key === '__proto__') return;
|
83
|
+
if (o === Object.prototype || o === Number.prototype
|
84
|
+
|| o === String.prototype) o = {};
|
85
|
+
if (o === Array.prototype) o = [];
|
86
|
+
if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
|
87
|
+
o[key] = value;
|
88
|
+
}
|
89
|
+
else if (Array.isArray(o[key])) {
|
90
|
+
o[key].push(value);
|
91
|
+
}
|
92
|
+
else {
|
93
|
+
o[key] = [ o[key], value ];
|
94
|
+
}
|
95
|
+
}
|
48
96
|
|
97
|
+
function aliasIsBoolean(key) {
|
98
|
+
return aliases[key].some(function (x) {
|
99
|
+
return flags.bools[x];
|
100
|
+
});
|
101
|
+
}
|
102
|
+
|
49
103
|
for (var i = 0; i < args.length; i++) {
|
50
104
|
var arg = args[i];
|
51
105
|
|
@@ -54,27 +108,33 @@ module.exports = function (args, opts) {
|
|
54
108
|
// 'dotall' regex modifier. See:
|
55
109
|
// http://stackoverflow.com/a/1068308/13216
|
56
110
|
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
|
57
|
-
|
111
|
+
var key = m[1];
|
112
|
+
var value = m[2];
|
113
|
+
if (flags.bools[key]) {
|
114
|
+
value = value !== 'false';
|
115
|
+
}
|
116
|
+
setArg(key, value, arg);
|
58
117
|
}
|
59
118
|
else if (/^--no-.+/.test(arg)) {
|
60
119
|
var key = arg.match(/^--no-(.+)/)[1];
|
61
|
-
setArg(key, false);
|
120
|
+
setArg(key, false, arg);
|
62
121
|
}
|
63
122
|
else if (/^--.+/.test(arg)) {
|
64
123
|
var key = arg.match(/^--(.+)/)[1];
|
65
124
|
var next = args[i + 1];
|
66
125
|
if (next !== undefined && !/^-/.test(next)
|
67
126
|
&& !flags.bools[key]
|
68
|
-
&&
|
69
|
-
|
127
|
+
&& !flags.allBools
|
128
|
+
&& (aliases[key] ? !aliasIsBoolean(key) : true)) {
|
129
|
+
setArg(key, next, arg);
|
70
130
|
i++;
|
71
131
|
}
|
72
132
|
else if (/^(true|false)$/.test(next)) {
|
73
|
-
setArg(key, next === 'true');
|
133
|
+
setArg(key, next === 'true', arg);
|
74
134
|
i++;
|
75
135
|
}
|
76
136
|
else {
|
77
|
-
setArg(key, flags.strings[key] ? '' : true);
|
137
|
+
setArg(key, flags.strings[key] ? '' : true, arg);
|
78
138
|
}
|
79
139
|
}
|
80
140
|
else if (/^-[^-]+/.test(arg)) {
|
@@ -85,24 +145,30 @@ module.exports = function (args, opts) {
|
|
85
145
|
var next = arg.slice(j+2);
|
86
146
|
|
87
147
|
if (next === '-') {
|
88
|
-
setArg(letters[j], next)
|
148
|
+
setArg(letters[j], next, arg)
|
89
149
|
continue;
|
90
150
|
}
|
91
151
|
|
152
|
+
if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
|
153
|
+
setArg(letters[j], next.split('=')[1], arg);
|
154
|
+
broken = true;
|
155
|
+
break;
|
156
|
+
}
|
157
|
+
|
92
158
|
if (/[A-Za-z]/.test(letters[j])
|
93
159
|
&& /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
|
94
|
-
setArg(letters[j], next);
|
160
|
+
setArg(letters[j], next, arg);
|
95
161
|
broken = true;
|
96
162
|
break;
|
97
163
|
}
|
98
164
|
|
99
165
|
if (letters[j+1] && letters[j+1].match(/\W/)) {
|
100
|
-
setArg(letters[j], arg.slice(j+2));
|
166
|
+
setArg(letters[j], arg.slice(j+2), arg);
|
101
167
|
broken = true;
|
102
168
|
break;
|
103
169
|
}
|
104
170
|
else {
|
105
|
-
setArg(letters[j], flags.strings[letters[j]] ? '' : true);
|
171
|
+
setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
|
106
172
|
}
|
107
173
|
}
|
108
174
|
|
@@ -110,23 +176,29 @@ module.exports = function (args, opts) {
|
|
110
176
|
if (!broken && key !== '-') {
|
111
177
|
if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
|
112
178
|
&& !flags.bools[key]
|
113
|
-
&& (aliases[key] ? !
|
114
|
-
setArg(key, args[i+1]);
|
179
|
+
&& (aliases[key] ? !aliasIsBoolean(key) : true)) {
|
180
|
+
setArg(key, args[i+1], arg);
|
115
181
|
i++;
|
116
182
|
}
|
117
|
-
else if (args[i+1] &&
|
118
|
-
setArg(key, args[i+1] === 'true');
|
183
|
+
else if (args[i+1] && /^(true|false)$/.test(args[i+1])) {
|
184
|
+
setArg(key, args[i+1] === 'true', arg);
|
119
185
|
i++;
|
120
186
|
}
|
121
187
|
else {
|
122
|
-
setArg(key, flags.strings[key] ? '' : true);
|
188
|
+
setArg(key, flags.strings[key] ? '' : true, arg);
|
123
189
|
}
|
124
190
|
}
|
125
191
|
}
|
126
192
|
else {
|
127
|
-
|
128
|
-
|
129
|
-
|
193
|
+
if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
|
194
|
+
argv._.push(
|
195
|
+
flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
|
196
|
+
);
|
197
|
+
}
|
198
|
+
if (opts.stopEarly) {
|
199
|
+
argv._.push.apply(argv._, args.slice(i + 1));
|
200
|
+
break;
|
201
|
+
}
|
130
202
|
}
|
131
203
|
}
|
132
204
|
|
@@ -140,9 +212,17 @@ module.exports = function (args, opts) {
|
|
140
212
|
}
|
141
213
|
});
|
142
214
|
|
143
|
-
|
144
|
-
argv
|
145
|
-
|
215
|
+
if (opts['--']) {
|
216
|
+
argv['--'] = new Array();
|
217
|
+
notFlags.forEach(function(key) {
|
218
|
+
argv['--'].push(key);
|
219
|
+
});
|
220
|
+
}
|
221
|
+
else {
|
222
|
+
notFlags.forEach(function(key) {
|
223
|
+
argv._.push(key);
|
224
|
+
});
|
225
|
+
}
|
146
226
|
|
147
227
|
return argv;
|
148
228
|
};
|
@@ -157,31 +237,9 @@ function hasKey (obj, keys) {
|
|
157
237
|
return key in o;
|
158
238
|
}
|
159
239
|
|
160
|
-
function setKey (obj, keys, value) {
|
161
|
-
var o = obj;
|
162
|
-
keys.slice(0,-1).forEach(function (key) {
|
163
|
-
if (o[key] === undefined) o[key] = {};
|
164
|
-
o = o[key];
|
165
|
-
});
|
166
|
-
|
167
|
-
var key = keys[keys.length - 1];
|
168
|
-
if (o[key] === undefined || typeof o[key] === 'boolean') {
|
169
|
-
o[key] = value;
|
170
|
-
}
|
171
|
-
else if (Array.isArray(o[key])) {
|
172
|
-
o[key].push(value);
|
173
|
-
}
|
174
|
-
else {
|
175
|
-
o[key] = [ o[key], value ];
|
176
|
-
}
|
177
|
-
}
|
178
|
-
|
179
240
|
function isNumber (x) {
|
180
241
|
if (typeof x === 'number') return true;
|
181
242
|
if (/^0x[0-9a-f]+$/i.test(x)) return true;
|
182
243
|
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
|
183
244
|
}
|
184
245
|
|
185
|
-
function longest (xs) {
|
186
|
-
return Math.max.apply(null, xs.map(function (x) { return x.length }));
|
187
|
-
}
|
@@ -1,27 +1,28 @@
|
|
1
1
|
{
|
2
|
-
"_from": "minimist
|
3
|
-
"_id": "minimist@
|
2
|
+
"_from": "minimist@^1.2.5",
|
3
|
+
"_id": "minimist@1.2.5",
|
4
4
|
"_inBundle": false,
|
5
|
-
"_integrity": "
|
5
|
+
"_integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
6
6
|
"_location": "/minimist",
|
7
7
|
"_phantomChildren": {},
|
8
8
|
"_requested": {
|
9
|
-
"type": "
|
9
|
+
"type": "range",
|
10
10
|
"registry": true,
|
11
|
-
"raw": "minimist
|
11
|
+
"raw": "minimist@^1.2.5",
|
12
12
|
"name": "minimist",
|
13
13
|
"escapedName": "minimist",
|
14
|
-
"rawSpec": "
|
14
|
+
"rawSpec": "^1.2.5",
|
15
15
|
"saveSpec": null,
|
16
|
-
"fetchSpec": "
|
16
|
+
"fetchSpec": "^1.2.5"
|
17
17
|
},
|
18
18
|
"_requiredBy": [
|
19
|
-
"/mkdirp"
|
19
|
+
"/mkdirp",
|
20
|
+
"/rc"
|
20
21
|
],
|
21
|
-
"_resolved": "https://registry.npmjs.org/minimist/-/minimist-
|
22
|
-
"_shasum": "
|
23
|
-
"_spec": "minimist
|
24
|
-
"_where": "/Users/
|
22
|
+
"_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
23
|
+
"_shasum": "67d66014b66a6a8aaa0c083c5fd58df4e4e97602",
|
24
|
+
"_spec": "minimist@^1.2.5",
|
25
|
+
"_where": "/Users/user/Developer/personal/fsevents/node_modules/mkdirp",
|
25
26
|
"author": {
|
26
27
|
"name": "James Halliday",
|
27
28
|
"email": "mail@substack.net",
|
@@ -34,8 +35,9 @@
|
|
34
35
|
"deprecated": false,
|
35
36
|
"description": "parse argument options",
|
36
37
|
"devDependencies": {
|
38
|
+
"covert": "^1.0.0",
|
37
39
|
"tap": "~0.4.0",
|
38
|
-
"tape": "
|
40
|
+
"tape": "^3.5.0"
|
39
41
|
},
|
40
42
|
"homepage": "https://github.com/substack/minimist",
|
41
43
|
"keywords": [
|
@@ -52,6 +54,7 @@
|
|
52
54
|
"url": "git://github.com/substack/minimist.git"
|
53
55
|
},
|
54
56
|
"scripts": {
|
57
|
+
"coverage": "covert test/*.js",
|
55
58
|
"test": "tap test/*.js"
|
56
59
|
},
|
57
60
|
"testling": {
|
@@ -67,5 +70,5 @@
|
|
67
70
|
"opera/12"
|
68
71
|
]
|
69
72
|
},
|
70
|
-
"version": "
|
73
|
+
"version": "1.2.5"
|
71
74
|
}
|
@@ -5,15 +5,11 @@ parse argument options
|
|
5
5
|
This module is the guts of optimist's argument parser without all the
|
6
6
|
fanciful decoration.
|
7
7
|
|
8
|
-
[](http://ci.testling.com/substack/minimist)
|
9
|
-
|
10
|
-
[](http://travis-ci.org/substack/minimist)
|
11
|
-
|
12
8
|
# example
|
13
9
|
|
14
10
|
``` js
|
15
11
|
var argv = require('minimist')(process.argv.slice(2));
|
16
|
-
console.
|
12
|
+
console.log(argv);
|
17
13
|
```
|
18
14
|
|
19
15
|
```
|
@@ -33,6 +29,13 @@ $ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
|
|
33
29
|
beep: 'boop' }
|
34
30
|
```
|
35
31
|
|
32
|
+
# security
|
33
|
+
|
34
|
+
Previous versions had a prototype pollution bug that could cause privilege
|
35
|
+
escalation in some circumstances when handling untrusted user input.
|
36
|
+
|
37
|
+
Please use version 1.2.3 or later: https://snyk.io/vuln/SNYK-JS-MINIMIST-559764
|
38
|
+
|
36
39
|
# methods
|
37
40
|
|
38
41
|
``` js
|
@@ -55,10 +58,29 @@ options can be:
|
|
55
58
|
|
56
59
|
* `opts.string` - a string or array of strings argument names to always treat as
|
57
60
|
strings
|
58
|
-
* `opts.boolean` - a string or array of strings to always treat as
|
61
|
+
* `opts.boolean` - a boolean, string or array of strings to always treat as
|
62
|
+
booleans. if `true` will treat all double hyphenated arguments without equal signs
|
63
|
+
as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`)
|
59
64
|
* `opts.alias` - an object mapping string names to strings or arrays of string
|
60
65
|
argument names to use as aliases
|
61
66
|
* `opts.default` - an object mapping string argument names to default values
|
67
|
+
* `opts.stopEarly` - when true, populate `argv._` with everything after the
|
68
|
+
first non-option
|
69
|
+
* `opts['--']` - when true, populate `argv._` with everything before the `--`
|
70
|
+
and `argv['--']` with everything after the `--`. Here's an example:
|
71
|
+
|
72
|
+
```
|
73
|
+
> require('./')('one two three -- four five --six'.split(' '), { '--': true })
|
74
|
+
{ _: [ 'one', 'two', 'three' ],
|
75
|
+
'--': [ 'four', 'five', '--six' ] }
|
76
|
+
```
|
77
|
+
|
78
|
+
Note that with `opts['--']` set, parsing for arguments still stops after the
|
79
|
+
`--`.
|
80
|
+
|
81
|
+
* `opts.unknown` - a function which is invoked with a command line parameter not
|
82
|
+
defined in the `opts` configuration object. If the function returns `false`, the
|
83
|
+
unknown option is not added to `argv`.
|
62
84
|
|
63
85
|
# install
|
64
86
|
|
File without changes
|
@@ -164,3 +164,15 @@ test('boolean --boool=false', function (t) {
|
|
164
164
|
t.same(parsed.boool, false);
|
165
165
|
t.end();
|
166
166
|
});
|
167
|
+
|
168
|
+
test('boolean using something similar to true', function (t) {
|
169
|
+
var opts = { boolean: 'h' };
|
170
|
+
var result = parse(['-h', 'true.txt'], opts);
|
171
|
+
var expected = {
|
172
|
+
h: true,
|
173
|
+
'_': ['true.txt']
|
174
|
+
};
|
175
|
+
|
176
|
+
t.same(result, expected);
|
177
|
+
t.end();
|
178
|
+
});
|
@@ -22,3 +22,10 @@ test('-a -- b', function (t) {
|
|
22
22
|
t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
|
23
23
|
t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
|
24
24
|
});
|
25
|
+
|
26
|
+
test('move arguments after the -- into their own `--` array', function(t) {
|
27
|
+
t.plan(1);
|
28
|
+
t.deepEqual(
|
29
|
+
parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }),
|
30
|
+
{ name: 'John', _: [ 'before' ], '--': [ 'after' ] });
|
31
|
+
});
|
@@ -18,3 +18,18 @@ test('boolean default false', function (t) {
|
|
18
18
|
t.equal(argv.somefalse, false);
|
19
19
|
t.end();
|
20
20
|
});
|
21
|
+
|
22
|
+
test('boolean default to null', function (t) {
|
23
|
+
var argv = parse([], {
|
24
|
+
boolean: 'maybe',
|
25
|
+
default: { maybe: null }
|
26
|
+
});
|
27
|
+
t.equal(argv.maybe, null);
|
28
|
+
var argv = parse(['--maybe'], {
|
29
|
+
boolean: 'maybe',
|
30
|
+
default: { maybe: null }
|
31
|
+
});
|
32
|
+
t.equal(argv.maybe, true);
|
33
|
+
t.end();
|
34
|
+
|
35
|
+
})
|
File without changes
|
File without changes
|