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.
Files changed (187) hide show
  1. package/.travis.yml +1 -0
  2. package/binding.gyp +1 -9
  3. package/fsevents.cc +8 -11
  4. package/fsevents.js +1 -3
  5. package/node_modules/abbrev/package.json +1 -1
  6. package/node_modules/ansi-regex/package.json +1 -1
  7. package/node_modules/aproba/package.json +1 -1
  8. package/node_modules/are-we-there-yet/package.json +1 -1
  9. package/node_modules/balanced-match/package.json +1 -1
  10. package/node_modules/brace-expansion/package.json +1 -1
  11. package/node_modules/chownr/chownr.js +98 -19
  12. package/node_modules/chownr/package.json +13 -10
  13. package/node_modules/code-point-at/package.json +1 -1
  14. package/node_modules/concat-map/package.json +1 -1
  15. package/node_modules/console-control-strings/package.json +1 -1
  16. package/node_modules/core-util-is/package.json +1 -1
  17. package/node_modules/debug/README.md +0 -18
  18. package/node_modules/debug/dist/debug.js +2 -28
  19. package/node_modules/debug/node.js +1 -0
  20. package/node_modules/debug/package.json +12 -24
  21. package/node_modules/debug/src/browser.js +103 -187
  22. package/node_modules/debug/src/common.js +240 -257
  23. package/node_modules/debug/src/index.js +5 -3
  24. package/node_modules/debug/src/node.js +82 -165
  25. package/node_modules/deep-extend/package.json +1 -1
  26. package/node_modules/delegates/package.json +1 -1
  27. package/node_modules/detect-libc/package.json +2 -2
  28. package/node_modules/fs-minipass/index.js +2 -1
  29. package/node_modules/fs-minipass/package.json +13 -10
  30. package/node_modules/fs.realpath/package.json +1 -1
  31. package/node_modules/gauge/package.json +1 -1
  32. package/node_modules/glob/LICENSE +6 -0
  33. package/node_modules/glob/README.md +8 -1
  34. package/node_modules/glob/package.json +9 -6
  35. package/node_modules/has-unicode/package.json +1 -1
  36. package/node_modules/iconv-lite/package.json +1 -1
  37. package/node_modules/ignore-walk/README.md +1 -1
  38. package/node_modules/ignore-walk/index.js +9 -5
  39. package/node_modules/ignore-walk/package.json +11 -8
  40. package/node_modules/inflight/package.json +1 -1
  41. package/node_modules/inherits/inherits.js +2 -0
  42. package/node_modules/inherits/inherits_browser.js +18 -14
  43. package/node_modules/inherits/package.json +8 -8
  44. package/node_modules/ini/package.json +1 -1
  45. package/node_modules/is-fullwidth-code-point/package.json +1 -1
  46. package/node_modules/isarray/package.json +1 -1
  47. package/node_modules/minimatch/package.json +1 -1
  48. package/node_modules/minimist/.travis.yml +4 -0
  49. package/node_modules/minimist/example/parse.js +1 -1
  50. package/node_modules/minimist/index.js +112 -54
  51. package/node_modules/minimist/package.json +17 -14
  52. package/node_modules/minimist/readme.markdown +28 -6
  53. package/node_modules/{rc/node_modules/minimist → minimist}/test/all_bool.js +0 -0
  54. package/node_modules/{rc/node_modules/minimist → minimist}/test/bool.js +12 -0
  55. package/node_modules/minimist/test/dash.js +7 -0
  56. package/node_modules/minimist/test/default_bool.js +15 -0
  57. package/node_modules/minimist/test/dotted.js +6 -0
  58. package/node_modules/{rc/node_modules/minimist → minimist}/test/kv_short.js +0 -0
  59. package/node_modules/{rc/node_modules/minimist → minimist}/test/num.js +0 -0
  60. package/node_modules/minimist/test/parse.js +23 -144
  61. package/node_modules/minimist/test/parse_modified.js +1 -1
  62. package/node_modules/minimist/test/proto.js +44 -0
  63. package/node_modules/{rc/node_modules/minimist → minimist}/test/stop_early.js +0 -0
  64. package/node_modules/{rc/node_modules/minimist → minimist}/test/unknown.js +0 -0
  65. package/node_modules/minipass/README.md +486 -4
  66. package/node_modules/minipass/index.js +190 -28
  67. package/node_modules/minipass/package.json +17 -14
  68. package/node_modules/minizlib/README.md +36 -27
  69. package/node_modules/minizlib/constants.js +73 -4
  70. package/node_modules/minizlib/index.js +137 -152
  71. package/node_modules/minizlib/package.json +12 -12
  72. package/node_modules/mkdirp/package.json +17 -10
  73. package/node_modules/ms/index.js +2 -2
  74. package/node_modules/ms/package.json +6 -6
  75. package/node_modules/ms/readme.md +1 -1
  76. package/node_modules/needle/.github/workflows/nodejs.yml +27 -0
  77. package/node_modules/needle/README.md +5 -5
  78. package/node_modules/needle/lib/needle.js +11 -3
  79. package/node_modules/needle/package.json +8 -8
  80. package/node_modules/needle/test/compression_spec.js +18 -0
  81. package/node_modules/needle/test/headers_spec.js +1 -1
  82. package/node_modules/node-pre-gyp/CHANGELOG.md +11 -0
  83. package/node_modules/node-pre-gyp/lib/install.js +44 -14
  84. package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +240 -0
  85. package/node_modules/node-pre-gyp/lib/util/napi.js +3 -2
  86. package/node_modules/node-pre-gyp/package.json +13 -13
  87. package/node_modules/nopt/lib/nopt.js +6 -1
  88. package/node_modules/nopt/package.json +15 -8
  89. package/node_modules/npm-bundled/index.js +13 -5
  90. package/node_modules/npm-bundled/package.json +9 -6
  91. package/node_modules/npm-normalize-package-bin/.github/settings.yml +2 -0
  92. package/node_modules/npm-normalize-package-bin/.npmignore +24 -0
  93. package/node_modules/npm-normalize-package-bin/LICENSE +15 -0
  94. package/node_modules/npm-normalize-package-bin/README.md +14 -0
  95. package/node_modules/npm-normalize-package-bin/index.js +60 -0
  96. package/node_modules/npm-normalize-package-bin/package-lock.json +3529 -0
  97. package/node_modules/npm-normalize-package-bin/package.json +58 -0
  98. package/node_modules/npm-normalize-package-bin/test/array.js +37 -0
  99. package/node_modules/npm-normalize-package-bin/test/nobin.js +35 -0
  100. package/node_modules/npm-normalize-package-bin/test/object.js +141 -0
  101. package/node_modules/npm-normalize-package-bin/test/string.js +37 -0
  102. package/node_modules/npm-packlist/index.js +55 -16
  103. package/node_modules/npm-packlist/package.json +18 -10
  104. package/node_modules/npmlog/package.json +1 -1
  105. package/node_modules/number-is-nan/package.json +1 -1
  106. package/node_modules/object-assign/package.json +1 -1
  107. package/node_modules/once/package.json +1 -1
  108. package/node_modules/os-homedir/package.json +1 -1
  109. package/node_modules/os-tmpdir/package.json +1 -1
  110. package/node_modules/osenv/package.json +1 -1
  111. package/node_modules/path-is-absolute/package.json +1 -1
  112. package/node_modules/process-nextick-args/index.js +2 -1
  113. package/node_modules/process-nextick-args/package.json +6 -6
  114. package/node_modules/rc/package.json +2 -2
  115. package/node_modules/readable-stream/.travis.yml +9 -30
  116. package/node_modules/readable-stream/lib/_stream_duplex.js +1 -1
  117. package/node_modules/readable-stream/lib/_stream_passthrough.js +1 -1
  118. package/node_modules/readable-stream/lib/_stream_readable.js +1 -1
  119. package/node_modules/readable-stream/lib/_stream_transform.js +1 -1
  120. package/node_modules/readable-stream/lib/_stream_writable.js +1 -1
  121. package/node_modules/readable-stream/package.json +6 -6
  122. package/node_modules/rimraf/package.json +7 -7
  123. package/node_modules/rimraf/rimraf.js +9 -1
  124. package/node_modules/safe-buffer/package.json +1 -1
  125. package/node_modules/safer-buffer/package.json +1 -1
  126. package/node_modules/sax/package.json +1 -1
  127. package/node_modules/semver/README.md +12 -11
  128. package/node_modules/semver/package.json +7 -7
  129. package/node_modules/set-blocking/package.json +1 -1
  130. package/node_modules/signal-exit/package.json +1 -1
  131. package/node_modules/string-width/package.json +1 -1
  132. package/node_modules/string_decoder/package.json +1 -1
  133. package/node_modules/strip-ansi/package.json +1 -1
  134. package/node_modules/strip-json-comments/package.json +1 -1
  135. package/node_modules/tar/lib/large-numbers.js +32 -27
  136. package/node_modules/tar/lib/mkdir.js +2 -2
  137. package/node_modules/tar/lib/parse.js +6 -1
  138. package/node_modules/tar/lib/read-entry.js +4 -0
  139. package/node_modules/tar/lib/write-entry.js +2 -2
  140. package/node_modules/tar/package.json +22 -18
  141. package/node_modules/util-deprecate/package.json +1 -1
  142. package/node_modules/wide-align/package.json +1 -1
  143. package/node_modules/wrappy/package.json +1 -1
  144. package/node_modules/yallist/package.json +11 -11
  145. package/node_modules/yallist/yallist.js +50 -0
  146. package/package.json +5 -15
  147. package/src/constants.cc +20 -20
  148. package/install.js +0 -7
  149. package/node_modules/mkdirp/.travis.yml +0 -8
  150. package/node_modules/mkdirp/examples/pow.js +0 -6
  151. package/node_modules/mkdirp/test/chmod.js +0 -41
  152. package/node_modules/mkdirp/test/clobber.js +0 -38
  153. package/node_modules/mkdirp/test/mkdirp.js +0 -28
  154. package/node_modules/mkdirp/test/opts_fs.js +0 -29
  155. package/node_modules/mkdirp/test/opts_fs_sync.js +0 -27
  156. package/node_modules/mkdirp/test/perm.js +0 -32
  157. package/node_modules/mkdirp/test/perm_sync.js +0 -36
  158. package/node_modules/mkdirp/test/race.js +0 -37
  159. package/node_modules/mkdirp/test/rel.js +0 -32
  160. package/node_modules/mkdirp/test/return.js +0 -25
  161. package/node_modules/mkdirp/test/return_sync.js +0 -24
  162. package/node_modules/mkdirp/test/root.js +0 -19
  163. package/node_modules/mkdirp/test/sync.js +0 -32
  164. package/node_modules/mkdirp/test/umask.js +0 -28
  165. package/node_modules/mkdirp/test/umask_sync.js +0 -32
  166. package/node_modules/needle/.npmignore +0 -6
  167. package/node_modules/needle/package-lock.json +0 -395
  168. package/node_modules/needle/test/keys/ssl.cert +0 -21
  169. package/node_modules/needle/test/keys/ssl.key +0 -27
  170. package/node_modules/nopt/.npmignore +0 -1
  171. package/node_modules/nopt/.travis.yml +0 -8
  172. package/node_modules/nopt/examples/my-program.js +0 -30
  173. package/node_modules/nopt/test/basic.js +0 -303
  174. package/node_modules/rc/node_modules/minimist/.travis.yml +0 -8
  175. package/node_modules/rc/node_modules/minimist/LICENSE +0 -18
  176. package/node_modules/rc/node_modules/minimist/example/parse.js +0 -2
  177. package/node_modules/rc/node_modules/minimist/index.js +0 -236
  178. package/node_modules/rc/node_modules/minimist/package.json +0 -73
  179. package/node_modules/rc/node_modules/minimist/readme.markdown +0 -91
  180. package/node_modules/rc/node_modules/minimist/test/dash.js +0 -31
  181. package/node_modules/rc/node_modules/minimist/test/default_bool.js +0 -35
  182. package/node_modules/rc/node_modules/minimist/test/dotted.js +0 -22
  183. package/node_modules/rc/node_modules/minimist/test/long.js +0 -31
  184. package/node_modules/rc/node_modules/minimist/test/parse.js +0 -197
  185. package/node_modules/rc/node_modules/minimist/test/parse_modified.js +0 -9
  186. package/node_modules/rc/node_modules/minimist/test/short.js +0 -67
  187. package/node_modules/rc/node_modules/minimist/test/whitespace.js +0 -8
@@ -1,303 +0,0 @@
1
- var nopt = require("../")
2
- , test = require('tap').test
3
- , isWin = process.platform === 'win32'
4
-
5
- test("passing a string results in a string", function (t) {
6
- var parsed = nopt({ key: String }, {}, ["--key", "myvalue"], 0)
7
- t.same(parsed.key, "myvalue")
8
- t.end()
9
- })
10
-
11
- // https://github.com/npm/nopt/issues/31
12
- test("Empty String results in empty string, not true", function (t) {
13
- var parsed = nopt({ empty: String }, {}, ["--empty"], 0)
14
- t.same(parsed.empty, "")
15
- t.end()
16
- })
17
-
18
- // https://github.com/npm/nopt/issues/65
19
- test("Empty String should not swallow next flag", function (t) {
20
- var parsed = nopt({ empty: String, foo: String }, {}, ["--empty", "--foo"], 0)
21
- t.same(parsed.empty, "")
22
- t.same(parsed.foo, "")
23
- t.end()
24
- })
25
-
26
- // https://github.com/npm/nopt/issues/66
27
- test("Empty String should not be true when type is single item Array", function (t) {
28
- var parsed = nopt({ 'foo': [String] }, {}, ["--foo"], 0)
29
- t.same(parsed.foo, "")
30
- t.end()
31
- })
32
-
33
- test("~ path is resolved to " + (isWin ? '%USERPROFILE%' : '$HOME'), function (t) {
34
- var path = require("path")
35
- , the
36
-
37
- if (isWin) {
38
- the = {
39
- key: 'USERPROFILE',
40
- dir: 'C:\\temp',
41
- val: '~\\val'
42
- }
43
- } else {
44
- the = {
45
- key: 'HOME',
46
- dir: '/tmp',
47
- val: '~/val'
48
- }
49
- }
50
- if (!process.env[the.key]) process.env[the.key] = v.dir
51
- var parsed = nopt({key: path}, {}, ["--key=" + the.val], 0)
52
- t.same(parsed.key, path.resolve(process.env[the.key], "val"))
53
- t.end()
54
- })
55
-
56
- // https://github.com/npm/nopt/issues/24
57
- test("Unknown options are not parsed as numbers", function (t) {
58
- var parsed = nopt({"parse-me": Number}, null, ['--leave-as-is=1.20', '--parse-me=1.20'], 0)
59
- t.equal(parsed['leave-as-is'], '1.20')
60
- t.equal(parsed['parse-me'], 1.2)
61
- t.end()
62
- });
63
-
64
- // https://github.com/npm/nopt/issues/48
65
- test("Check types based on name of type", function (t) {
66
- var parsed = nopt({"parse-me": {name: "Number"}}, null, ['--parse-me=1.20'], 0)
67
- t.equal(parsed['parse-me'], 1.2)
68
- t.end()
69
- })
70
-
71
-
72
- test("Missing types are not parsed", function (t) {
73
- var parsed = nopt({"parse-me": {}}, null, ['--parse-me=1.20'], 0)
74
- //should only contain argv
75
- t.equal(Object.keys(parsed).length, 1)
76
- t.end()
77
- })
78
-
79
- test("Types passed without a name are not parsed", function (t) {
80
- var parsed = nopt({"parse-me": {}}, {}, ['--parse-me=1.20'], 0)
81
- //should only contain argv
82
- t.equal(Object.keys(parsed).length, 1)
83
- t.end()
84
- })
85
-
86
- test("other tests", function (t) {
87
-
88
- var util = require("util")
89
- , Stream = require("stream")
90
- , path = require("path")
91
- , url = require("url")
92
-
93
- , shorthands =
94
- { s : ["--loglevel", "silent"]
95
- , d : ["--loglevel", "info"]
96
- , dd : ["--loglevel", "verbose"]
97
- , ddd : ["--loglevel", "silly"]
98
- , noreg : ["--no-registry"]
99
- , reg : ["--registry"]
100
- , "no-reg" : ["--no-registry"]
101
- , silent : ["--loglevel", "silent"]
102
- , verbose : ["--loglevel", "verbose"]
103
- , h : ["--usage"]
104
- , H : ["--usage"]
105
- , "?" : ["--usage"]
106
- , help : ["--usage"]
107
- , v : ["--version"]
108
- , f : ["--force"]
109
- , desc : ["--description"]
110
- , "no-desc" : ["--no-description"]
111
- , "local" : ["--no-global"]
112
- , l : ["--long"]
113
- , p : ["--parseable"]
114
- , porcelain : ["--parseable"]
115
- , g : ["--global"]
116
- }
117
-
118
- , types =
119
- { aoa: Array
120
- , nullstream: [null, Stream]
121
- , date: Date
122
- , str: String
123
- , browser : String
124
- , cache : path
125
- , color : ["always", Boolean]
126
- , depth : Number
127
- , description : Boolean
128
- , dev : Boolean
129
- , editor : path
130
- , force : Boolean
131
- , global : Boolean
132
- , globalconfig : path
133
- , group : [String, Number]
134
- , gzipbin : String
135
- , logfd : [Number, Stream]
136
- , loglevel : ["silent","win","error","warn","info","verbose","silly"]
137
- , long : Boolean
138
- , "node-version" : [false, String]
139
- , npaturl : url
140
- , npat : Boolean
141
- , "onload-script" : [false, String]
142
- , outfd : [Number, Stream]
143
- , parseable : Boolean
144
- , pre: Boolean
145
- , prefix: path
146
- , proxy : url
147
- , "rebuild-bundle" : Boolean
148
- , registry : url
149
- , searchopts : String
150
- , searchexclude: [null, String]
151
- , shell : path
152
- , t: [Array, String]
153
- , tag : String
154
- , tar : String
155
- , tmp : path
156
- , "unsafe-perm" : Boolean
157
- , usage : Boolean
158
- , user : String
159
- , username : String
160
- , userconfig : path
161
- , version : Boolean
162
- , viewer: path
163
- , _exit : Boolean
164
- , path: path
165
- }
166
-
167
- ; [["-v", {version:true}, []]
168
- ,["---v", {version:true}, []]
169
- ,["ls -s --no-reg connect -d",
170
- {loglevel:"info",registry:null},["ls","connect"]]
171
- ,["ls ---s foo",{loglevel:"silent"},["ls","foo"]]
172
- ,["ls --registry blargle", {}, ["ls"]]
173
- ,["--no-registry", {registry:null}, []]
174
- ,["--no-color true", {color:false}, []]
175
- ,["--no-color false", {color:true}, []]
176
- ,["--no-color", {color:false}, []]
177
- ,["--color false", {color:false}, []]
178
- ,["--color --logfd 7", {logfd:7,color:true}, []]
179
- ,["--color=true", {color:true}, []]
180
- ,["--logfd=10", {logfd:10}, []]
181
- ,["--tmp=/tmp -tar=gtar", {tmp: isWin ? "C:\\tmp" : "/tmp",tar:"gtar"},[]]
182
- ,["--tmp=tmp -tar=gtar",
183
- {tmp:path.resolve(process.cwd(), "tmp"),tar:"gtar"},[]]
184
- ,["--logfd x", {}, []]
185
- ,["a -true -- -no-false", {true:true},["a","-no-false"]]
186
- ,["a -no-false", {false:false},["a"]]
187
- ,["a -no-no-true", {true:true}, ["a"]]
188
- ,["a -no-no-no-false", {false:false}, ["a"]]
189
- ,["---NO-no-No-no-no-no-nO-no-no"+
190
- "-No-no-no-no-no-no-no-no-no"+
191
- "-no-no-no-no-NO-NO-no-no-no-no-no-no"+
192
- "-no-body-can-do-the-boogaloo-like-I-do"
193
- ,{"body-can-do-the-boogaloo-like-I-do":false}, []]
194
- ,["we are -no-strangers-to-love "+
195
- "--you-know=the-rules --and=so-do-i "+
196
- "---im-thinking-of=a-full-commitment "+
197
- "--no-you-would-get-this-from-any-other-guy "+
198
- "--no-gonna-give-you-up "+
199
- "-no-gonna-let-you-down=true "+
200
- "--no-no-gonna-run-around false "+
201
- "--desert-you=false "+
202
- "--make-you-cry false "+
203
- "--no-tell-a-lie "+
204
- "--no-no-and-hurt-you false"
205
- ,{"strangers-to-love":false
206
- ,"you-know":"the-rules"
207
- ,"and":"so-do-i"
208
- ,"you-would-get-this-from-any-other-guy":false
209
- ,"gonna-give-you-up":false
210
- ,"gonna-let-you-down":false
211
- ,"gonna-run-around":false
212
- ,"desert-you":false
213
- ,"make-you-cry":false
214
- ,"tell-a-lie":false
215
- ,"and-hurt-you":false
216
- },["we", "are"]]
217
- ,["-t one -t two -t three"
218
- ,{t: ["one", "two", "three"]}
219
- ,[]]
220
- ,["-t one -t null -t three four five null"
221
- ,{t: ["one", "null", "three"]}
222
- ,["four", "five", "null"]]
223
- ,["-t foo"
224
- ,{t:["foo"]}
225
- ,[]]
226
- ,["--no-t"
227
- ,{t:["false"]}
228
- ,[]]
229
- ,["-no-no-t"
230
- ,{t:["true"]}
231
- ,[]]
232
- ,["-aoa one -aoa null -aoa 100"
233
- ,{aoa:["one", null, '100']}
234
- ,[]]
235
- ,["-str 100"
236
- ,{str:"100"}
237
- ,[]]
238
- ,["--color always"
239
- ,{color:"always"}
240
- ,[]]
241
- ,["--no-nullstream"
242
- ,{nullstream:null}
243
- ,[]]
244
- ,["--nullstream false"
245
- ,{nullstream:null}
246
- ,[]]
247
- ,["--notadate=2011-01-25"
248
- ,{notadate: "2011-01-25"}
249
- ,[]]
250
- ,["--date 2011-01-25"
251
- ,{date: new Date("2011-01-25")}
252
- ,[]]
253
- ,["-cl 1"
254
- ,{config: true, length: 1}
255
- ,[]
256
- ,{config: Boolean, length: Number, clear: Boolean}
257
- ,{c: "--config", l: "--length"}]
258
- ,["--acount bla"
259
- ,{"acount":true}
260
- ,["bla"]
261
- ,{account: Boolean, credentials: Boolean, options: String}
262
- ,{a:"--account", c:"--credentials",o:"--options"}]
263
- ,["--clear"
264
- ,{clear:true}
265
- ,[]
266
- ,{clear:Boolean,con:Boolean,len:Boolean,exp:Boolean,add:Boolean,rep:Boolean}
267
- ,{c:"--con",l:"--len",e:"--exp",a:"--add",r:"--rep"}]
268
- ,["--file -"
269
- ,{"file":"-"}
270
- ,[]
271
- ,{file:String}
272
- ,{}]
273
- ,["--file -"
274
- ,{"file":true}
275
- ,["-"]
276
- ,{file:Boolean}
277
- ,{}]
278
- ,["--path"
279
- ,{"path":null}
280
- ,[]]
281
- ,["--path ."
282
- ,{"path":process.cwd()}
283
- ,[]]
284
- ].forEach(function (test) {
285
- var argv = test[0].split(/\s+/)
286
- , opts = test[1]
287
- , rem = test[2]
288
- , actual = nopt(test[3] || types, test[4] || shorthands, argv, 0)
289
- , parsed = actual.argv
290
- delete actual.argv
291
- for (var i in opts) {
292
- var e = JSON.stringify(opts[i])
293
- , a = JSON.stringify(actual[i] === undefined ? null : actual[i])
294
- if (e && typeof e === "object") {
295
- t.deepEqual(e, a)
296
- } else {
297
- t.equal(e, a)
298
- }
299
- }
300
- t.deepEqual(rem, parsed.remain)
301
- })
302
- t.end()
303
- })
@@ -1,8 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "0.8"
4
- - "0.10"
5
- - "0.12"
6
- - "iojs"
7
- before_install:
8
- - npm install -g npm@~1.4.6
@@ -1,18 +0,0 @@
1
- This software is released under the MIT license:
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- this software and associated documentation files (the "Software"), to deal in
5
- the Software without restriction, including without limitation the rights to
6
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
- the Software, and to permit persons to whom the Software is furnished to do so,
8
- subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,2 +0,0 @@
1
- var argv = require('../')(process.argv.slice(2));
2
- console.dir(argv);
@@ -1,236 +0,0 @@
1
- module.exports = function (args, opts) {
2
- if (!opts) opts = {};
3
-
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
- }
17
-
18
- var aliases = {};
19
- Object.keys(opts.alias || {}).forEach(function (key) {
20
- aliases[key] = [].concat(opts.alias[key]);
21
- aliases[key].forEach(function (x) {
22
- aliases[x] = [key].concat(aliases[key].filter(function (y) {
23
- return x !== y;
24
- }));
25
- });
26
- });
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
-
35
- var defaults = opts['default'] || {};
36
-
37
- var argv = { _ : [] };
38
- Object.keys(flags.bools).forEach(function (key) {
39
- setArg(key, defaults[key] === undefined ? false : defaults[key]);
40
- });
41
-
42
- var notFlags = [];
43
-
44
- if (args.indexOf('--') !== -1) {
45
- notFlags = args.slice(args.indexOf('--')+1);
46
- args = args.slice(0, args.indexOf('--'));
47
- }
48
-
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
-
59
- var value = !flags.strings[key] && isNumber(val)
60
- ? Number(val) : val
61
- ;
62
- setKey(argv, key.split('.'), value);
63
-
64
- (aliases[key] || []).forEach(function (x) {
65
- setKey(argv, x.split('.'), value);
66
- });
67
- }
68
-
69
- function setKey (obj, keys, value) {
70
- var o = obj;
71
- keys.slice(0,-1).forEach(function (key) {
72
- if (o[key] === undefined) o[key] = {};
73
- o = o[key];
74
- });
75
-
76
- var key = keys[keys.length - 1];
77
- if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
78
- o[key] = value;
79
- }
80
- else if (Array.isArray(o[key])) {
81
- o[key].push(value);
82
- }
83
- else {
84
- o[key] = [ o[key], value ];
85
- }
86
- }
87
-
88
- function aliasIsBoolean(key) {
89
- return aliases[key].some(function (x) {
90
- return flags.bools[x];
91
- });
92
- }
93
-
94
- for (var i = 0; i < args.length; i++) {
95
- var arg = args[i];
96
-
97
- if (/^--.+=/.test(arg)) {
98
- // Using [\s\S] instead of . because js doesn't support the
99
- // 'dotall' regex modifier. See:
100
- // http://stackoverflow.com/a/1068308/13216
101
- var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
102
- var key = m[1];
103
- var value = m[2];
104
- if (flags.bools[key]) {
105
- value = value !== 'false';
106
- }
107
- setArg(key, value, arg);
108
- }
109
- else if (/^--no-.+/.test(arg)) {
110
- var key = arg.match(/^--no-(.+)/)[1];
111
- setArg(key, false, arg);
112
- }
113
- else if (/^--.+/.test(arg)) {
114
- var key = arg.match(/^--(.+)/)[1];
115
- var next = args[i + 1];
116
- if (next !== undefined && !/^-/.test(next)
117
- && !flags.bools[key]
118
- && !flags.allBools
119
- && (aliases[key] ? !aliasIsBoolean(key) : true)) {
120
- setArg(key, next, arg);
121
- i++;
122
- }
123
- else if (/^(true|false)$/.test(next)) {
124
- setArg(key, next === 'true', arg);
125
- i++;
126
- }
127
- else {
128
- setArg(key, flags.strings[key] ? '' : true, arg);
129
- }
130
- }
131
- else if (/^-[^-]+/.test(arg)) {
132
- var letters = arg.slice(1,-1).split('');
133
-
134
- var broken = false;
135
- for (var j = 0; j < letters.length; j++) {
136
- var next = arg.slice(j+2);
137
-
138
- if (next === '-') {
139
- setArg(letters[j], next, arg)
140
- continue;
141
- }
142
-
143
- if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
144
- setArg(letters[j], next.split('=')[1], arg);
145
- broken = true;
146
- break;
147
- }
148
-
149
- if (/[A-Za-z]/.test(letters[j])
150
- && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
151
- setArg(letters[j], next, arg);
152
- broken = true;
153
- break;
154
- }
155
-
156
- if (letters[j+1] && letters[j+1].match(/\W/)) {
157
- setArg(letters[j], arg.slice(j+2), arg);
158
- broken = true;
159
- break;
160
- }
161
- else {
162
- setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
163
- }
164
- }
165
-
166
- var key = arg.slice(-1)[0];
167
- if (!broken && key !== '-') {
168
- if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
169
- && !flags.bools[key]
170
- && (aliases[key] ? !aliasIsBoolean(key) : true)) {
171
- setArg(key, args[i+1], arg);
172
- i++;
173
- }
174
- else if (args[i+1] && /true|false/.test(args[i+1])) {
175
- setArg(key, args[i+1] === 'true', arg);
176
- i++;
177
- }
178
- else {
179
- setArg(key, flags.strings[key] ? '' : true, arg);
180
- }
181
- }
182
- }
183
- else {
184
- if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
185
- argv._.push(
186
- flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
187
- );
188
- }
189
- if (opts.stopEarly) {
190
- argv._.push.apply(argv._, args.slice(i + 1));
191
- break;
192
- }
193
- }
194
- }
195
-
196
- Object.keys(defaults).forEach(function (key) {
197
- if (!hasKey(argv, key.split('.'))) {
198
- setKey(argv, key.split('.'), defaults[key]);
199
-
200
- (aliases[key] || []).forEach(function (x) {
201
- setKey(argv, x.split('.'), defaults[key]);
202
- });
203
- }
204
- });
205
-
206
- if (opts['--']) {
207
- argv['--'] = new Array();
208
- notFlags.forEach(function(key) {
209
- argv['--'].push(key);
210
- });
211
- }
212
- else {
213
- notFlags.forEach(function(key) {
214
- argv._.push(key);
215
- });
216
- }
217
-
218
- return argv;
219
- };
220
-
221
- function hasKey (obj, keys) {
222
- var o = obj;
223
- keys.slice(0,-1).forEach(function (key) {
224
- o = (o[key] || {});
225
- });
226
-
227
- var key = keys[keys.length - 1];
228
- return key in o;
229
- }
230
-
231
- function isNumber (x) {
232
- if (typeof x === 'number') return true;
233
- if (/^0x[0-9a-f]+$/i.test(x)) return true;
234
- return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
235
- }
236
-
@@ -1,73 +0,0 @@
1
- {
2
- "_from": "minimist@^1.2.0",
3
- "_id": "minimist@1.2.0",
4
- "_inBundle": false,
5
- "_integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
6
- "_location": "/rc/minimist",
7
- "_phantomChildren": {},
8
- "_requested": {
9
- "type": "range",
10
- "registry": true,
11
- "raw": "minimist@^1.2.0",
12
- "name": "minimist",
13
- "escapedName": "minimist",
14
- "rawSpec": "^1.2.0",
15
- "saveSpec": null,
16
- "fetchSpec": "^1.2.0"
17
- },
18
- "_requiredBy": [
19
- "/rc"
20
- ],
21
- "_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
22
- "_shasum": "a35008b20f41383eec1fb914f4cd5df79a264284",
23
- "_spec": "minimist@^1.2.0",
24
- "_where": "/Users/pipobscure/fsevents/node_modules/rc",
25
- "author": {
26
- "name": "James Halliday",
27
- "email": "mail@substack.net",
28
- "url": "http://substack.net"
29
- },
30
- "bugs": {
31
- "url": "https://github.com/substack/minimist/issues"
32
- },
33
- "bundleDependencies": false,
34
- "deprecated": false,
35
- "description": "parse argument options",
36
- "devDependencies": {
37
- "covert": "^1.0.0",
38
- "tap": "~0.4.0",
39
- "tape": "^3.5.0"
40
- },
41
- "homepage": "https://github.com/substack/minimist",
42
- "keywords": [
43
- "argv",
44
- "getopt",
45
- "parser",
46
- "optimist"
47
- ],
48
- "license": "MIT",
49
- "main": "index.js",
50
- "name": "minimist",
51
- "repository": {
52
- "type": "git",
53
- "url": "git://github.com/substack/minimist.git"
54
- },
55
- "scripts": {
56
- "coverage": "covert test/*.js",
57
- "test": "tap test/*.js"
58
- },
59
- "testling": {
60
- "files": "test/*.js",
61
- "browsers": [
62
- "ie/6..latest",
63
- "ff/5",
64
- "firefox/latest",
65
- "chrome/10",
66
- "chrome/latest",
67
- "safari/5.1",
68
- "safari/latest",
69
- "opera/12"
70
- ]
71
- },
72
- "version": "1.2.0"
73
- }