dragonfly_chrome_headless 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +12 -0
  4. data/Gemfile +4 -0
  5. data/README.md +53 -0
  6. data/Rakefile +10 -0
  7. data/bin/console +14 -0
  8. data/bin/setup +8 -0
  9. data/dragonfly_chrome_headless.gemspec +27 -0
  10. data/lib/dragonfly_chrome_headless.rb +9 -0
  11. data/lib/dragonfly_chrome_headless/plugin.rb +17 -0
  12. data/lib/dragonfly_chrome_headless/processors/rasterize.rb +33 -0
  13. data/lib/dragonfly_chrome_headless/version.rb +3 -0
  14. data/node_modules/.bin/chrome-remote-interface +1 -0
  15. data/node_modules/.bin/mkdirp +1 -0
  16. data/node_modules/.bin/rimraf +1 -0
  17. data/node_modules/@types/core-js/LICENSE +21 -0
  18. data/node_modules/@types/core-js/README.md +16 -0
  19. data/node_modules/@types/core-js/index.d.ts +2452 -0
  20. data/node_modules/@types/core-js/package.json +85 -0
  21. data/node_modules/@types/mkdirp/README.md +18 -0
  22. data/node_modules/@types/mkdirp/index.d.ts +14 -0
  23. data/node_modules/@types/mkdirp/package.json +77 -0
  24. data/node_modules/@types/mkdirp/types-metadata.json +25 -0
  25. data/node_modules/@types/node/README.md +16 -0
  26. data/node_modules/@types/node/index.d.ts +4132 -0
  27. data/node_modules/@types/node/package.json +84 -0
  28. data/node_modules/balanced-match/.npmignore +5 -0
  29. data/node_modules/balanced-match/LICENSE.md +21 -0
  30. data/node_modules/balanced-match/README.md +91 -0
  31. data/node_modules/balanced-match/index.js +59 -0
  32. data/node_modules/balanced-match/package.json +112 -0
  33. data/node_modules/brace-expansion/README.md +123 -0
  34. data/node_modules/brace-expansion/index.js +201 -0
  35. data/node_modules/brace-expansion/package.json +114 -0
  36. data/node_modules/chrome-launcher/.clang-format +6 -0
  37. data/node_modules/chrome-launcher/.npmignore +11 -0
  38. data/node_modules/chrome-launcher/README.md +123 -0
  39. data/node_modules/chrome-launcher/ask.js +32 -0
  40. data/node_modules/chrome-launcher/ask.ts +35 -0
  41. data/node_modules/chrome-launcher/chrome-finder.js +157 -0
  42. data/node_modules/chrome-launcher/chrome-finder.ts +186 -0
  43. data/node_modules/chrome-launcher/chrome-launcher.js +245 -0
  44. data/node_modules/chrome-launcher/chrome-launcher.ts +312 -0
  45. data/node_modules/chrome-launcher/compiled-check.js +14 -0
  46. data/node_modules/chrome-launcher/flags.js +27 -0
  47. data/node_modules/chrome-launcher/flags.ts +26 -0
  48. data/node_modules/chrome-launcher/index.js +7 -0
  49. data/node_modules/chrome-launcher/index.ts +1 -0
  50. data/node_modules/chrome-launcher/manual-chrome-launcher.js +30 -0
  51. data/node_modules/chrome-launcher/package.json +116 -0
  52. data/node_modules/chrome-launcher/random-port.js +24 -0
  53. data/node_modules/chrome-launcher/random-port.ts +23 -0
  54. data/node_modules/chrome-launcher/tsconfig.json +19 -0
  55. data/node_modules/chrome-launcher/utils.js +52 -0
  56. data/node_modules/chrome-launcher/utils.ts +44 -0
  57. data/node_modules/chrome-launcher/yarn.lock +1486 -0
  58. data/node_modules/chrome-remote-interface/LICENSE +18 -0
  59. data/node_modules/chrome-remote-interface/README.md +849 -0
  60. data/node_modules/chrome-remote-interface/bin/client.js +337 -0
  61. data/node_modules/chrome-remote-interface/chrome-remote-interface.js +11 -0
  62. data/node_modules/chrome-remote-interface/index.js +39 -0
  63. data/node_modules/chrome-remote-interface/lib/api.js +84 -0
  64. data/node_modules/chrome-remote-interface/lib/chrome.js +307 -0
  65. data/node_modules/chrome-remote-interface/lib/defaults.js +4 -0
  66. data/node_modules/chrome-remote-interface/lib/devtools.js +245 -0
  67. data/node_modules/chrome-remote-interface/lib/external-request.js +28 -0
  68. data/node_modules/chrome-remote-interface/lib/protocol.json +13780 -0
  69. data/node_modules/chrome-remote-interface/lib/websocket-wrapper.js +32 -0
  70. data/node_modules/chrome-remote-interface/package.json +128 -0
  71. data/node_modules/chrome-remote-interface/webpack.config.js +55 -0
  72. data/node_modules/commander/Readme.md +195 -0
  73. data/node_modules/commander/index.js +851 -0
  74. data/node_modules/commander/package.json +92 -0
  75. data/node_modules/concat-map/.travis.yml +4 -0
  76. data/node_modules/concat-map/LICENSE +18 -0
  77. data/node_modules/concat-map/README.markdown +62 -0
  78. data/node_modules/concat-map/example/map.js +6 -0
  79. data/node_modules/concat-map/index.js +13 -0
  80. data/node_modules/concat-map/package.json +117 -0
  81. data/node_modules/concat-map/test/map.js +39 -0
  82. data/node_modules/debug/.coveralls.yml +1 -0
  83. data/node_modules/debug/.eslintrc +11 -0
  84. data/node_modules/debug/.npmignore +9 -0
  85. data/node_modules/debug/.travis.yml +14 -0
  86. data/node_modules/debug/CHANGELOG.md +357 -0
  87. data/node_modules/debug/LICENSE +19 -0
  88. data/node_modules/debug/Makefile +50 -0
  89. data/node_modules/debug/Readme.md +312 -0
  90. data/node_modules/debug/component.json +19 -0
  91. data/node_modules/debug/karma.conf.js +70 -0
  92. data/node_modules/debug/node.js +1 -0
  93. data/node_modules/debug/package.json +124 -0
  94. data/node_modules/debug/src/browser.js +185 -0
  95. data/node_modules/debug/src/debug.js +202 -0
  96. data/node_modules/debug/src/index.js +10 -0
  97. data/node_modules/debug/src/node.js +246 -0
  98. data/node_modules/fs.realpath/LICENSE +43 -0
  99. data/node_modules/fs.realpath/README.md +33 -0
  100. data/node_modules/fs.realpath/index.js +66 -0
  101. data/node_modules/fs.realpath/old.js +303 -0
  102. data/node_modules/fs.realpath/package.json +94 -0
  103. data/node_modules/glob/LICENSE +15 -0
  104. data/node_modules/glob/README.md +368 -0
  105. data/node_modules/glob/changelog.md +67 -0
  106. data/node_modules/glob/common.js +240 -0
  107. data/node_modules/glob/glob.js +790 -0
  108. data/node_modules/glob/package.json +112 -0
  109. data/node_modules/glob/sync.js +486 -0
  110. data/node_modules/html-pdf-chrome/.npmignore +9 -0
  111. data/node_modules/html-pdf-chrome/LICENSE +21 -0
  112. data/node_modules/html-pdf-chrome/README.md +165 -0
  113. data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.d.ts +87 -0
  114. data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.js +4 -0
  115. data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.js.map +1 -0
  116. data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.d.ts +120 -0
  117. data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.js +206 -0
  118. data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.js.map +1 -0
  119. data/node_modules/html-pdf-chrome/lib/src/CreateResult.d.ts +70 -0
  120. data/node_modules/html-pdf-chrome/lib/src/CreateResult.js +98 -0
  121. data/node_modules/html-pdf-chrome/lib/src/CreateResult.js.map +1 -0
  122. data/node_modules/html-pdf-chrome/lib/src/index.d.ts +72 -0
  123. data/node_modules/html-pdf-chrome/lib/src/index.js +123 -0
  124. data/node_modules/html-pdf-chrome/lib/src/index.js.map +1 -0
  125. data/node_modules/html-pdf-chrome/package.json +133 -0
  126. data/node_modules/html-pdf-chrome/src/ChromePrintOptions.ts +99 -0
  127. data/node_modules/html-pdf-chrome/src/CompletionTrigger.ts +201 -0
  128. data/node_modules/html-pdf-chrome/src/CreateResult.ts +100 -0
  129. data/node_modules/html-pdf-chrome/src/index.ts +179 -0
  130. data/node_modules/inflight/LICENSE +15 -0
  131. data/node_modules/inflight/README.md +37 -0
  132. data/node_modules/inflight/inflight.js +54 -0
  133. data/node_modules/inflight/package.json +105 -0
  134. data/node_modules/inherits/LICENSE +16 -0
  135. data/node_modules/inherits/README.md +42 -0
  136. data/node_modules/inherits/inherits.js +7 -0
  137. data/node_modules/inherits/inherits_browser.js +23 -0
  138. data/node_modules/inherits/package.json +97 -0
  139. data/node_modules/lighthouse-logger/README.md +4 -0
  140. data/node_modules/lighthouse-logger/index.js +212 -0
  141. data/node_modules/lighthouse-logger/package.json +69 -0
  142. data/node_modules/lighthouse-logger/yarn.lock +13 -0
  143. data/node_modules/minimatch/LICENSE +15 -0
  144. data/node_modules/minimatch/README.md +209 -0
  145. data/node_modules/minimatch/minimatch.js +923 -0
  146. data/node_modules/minimatch/package.json +99 -0
  147. data/node_modules/minimist/.travis.yml +4 -0
  148. data/node_modules/minimist/LICENSE +18 -0
  149. data/node_modules/minimist/example/parse.js +2 -0
  150. data/node_modules/minimist/index.js +187 -0
  151. data/node_modules/minimist/package.json +101 -0
  152. data/node_modules/minimist/readme.markdown +73 -0
  153. data/node_modules/minimist/test/dash.js +24 -0
  154. data/node_modules/minimist/test/default_bool.js +20 -0
  155. data/node_modules/minimist/test/dotted.js +16 -0
  156. data/node_modules/minimist/test/long.js +31 -0
  157. data/node_modules/minimist/test/parse.js +318 -0
  158. data/node_modules/minimist/test/parse_modified.js +9 -0
  159. data/node_modules/minimist/test/short.js +67 -0
  160. data/node_modules/minimist/test/whitespace.js +8 -0
  161. data/node_modules/mkdirp/.travis.yml +8 -0
  162. data/node_modules/mkdirp/LICENSE +21 -0
  163. data/node_modules/mkdirp/bin/cmd.js +33 -0
  164. data/node_modules/mkdirp/bin/usage.txt +12 -0
  165. data/node_modules/mkdirp/examples/pow.js +6 -0
  166. data/node_modules/mkdirp/index.js +98 -0
  167. data/node_modules/mkdirp/package.json +93 -0
  168. data/node_modules/mkdirp/readme.markdown +100 -0
  169. data/node_modules/mkdirp/test/chmod.js +41 -0
  170. data/node_modules/mkdirp/test/clobber.js +38 -0
  171. data/node_modules/mkdirp/test/mkdirp.js +28 -0
  172. data/node_modules/mkdirp/test/opts_fs.js +29 -0
  173. data/node_modules/mkdirp/test/opts_fs_sync.js +27 -0
  174. data/node_modules/mkdirp/test/perm.js +32 -0
  175. data/node_modules/mkdirp/test/perm_sync.js +36 -0
  176. data/node_modules/mkdirp/test/race.js +37 -0
  177. data/node_modules/mkdirp/test/rel.js +32 -0
  178. data/node_modules/mkdirp/test/return.js +25 -0
  179. data/node_modules/mkdirp/test/return_sync.js +24 -0
  180. data/node_modules/mkdirp/test/root.js +19 -0
  181. data/node_modules/mkdirp/test/sync.js +32 -0
  182. data/node_modules/mkdirp/test/umask.js +28 -0
  183. data/node_modules/mkdirp/test/umask_sync.js +32 -0
  184. data/node_modules/ms/README.md +51 -0
  185. data/node_modules/ms/index.js +152 -0
  186. data/node_modules/ms/license.md +21 -0
  187. data/node_modules/ms/package.json +109 -0
  188. data/node_modules/once/LICENSE +15 -0
  189. data/node_modules/once/README.md +79 -0
  190. data/node_modules/once/once.js +42 -0
  191. data/node_modules/once/package.json +101 -0
  192. data/node_modules/path-is-absolute/index.js +20 -0
  193. data/node_modules/path-is-absolute/license +21 -0
  194. data/node_modules/path-is-absolute/package.json +111 -0
  195. data/node_modules/path-is-absolute/readme.md +59 -0
  196. data/node_modules/rimraf/LICENSE +15 -0
  197. data/node_modules/rimraf/README.md +101 -0
  198. data/node_modules/rimraf/bin.js +50 -0
  199. data/node_modules/rimraf/package.json +99 -0
  200. data/node_modules/rimraf/rimraf.js +363 -0
  201. data/node_modules/ultron/LICENSE +22 -0
  202. data/node_modules/ultron/index.js +138 -0
  203. data/node_modules/ultron/package.json +112 -0
  204. data/node_modules/wrappy/LICENSE +15 -0
  205. data/node_modules/wrappy/README.md +36 -0
  206. data/node_modules/wrappy/package.json +97 -0
  207. data/node_modules/wrappy/wrappy.js +33 -0
  208. data/node_modules/ws/LICENSE +21 -0
  209. data/node_modules/ws/README.md +259 -0
  210. data/node_modules/ws/SECURITY.md +33 -0
  211. data/node_modules/ws/index.js +15 -0
  212. data/node_modules/ws/lib/BufferUtil.fallback.js +56 -0
  213. data/node_modules/ws/lib/BufferUtil.js +15 -0
  214. data/node_modules/ws/lib/ErrorCodes.js +28 -0
  215. data/node_modules/ws/lib/EventTarget.js +158 -0
  216. data/node_modules/ws/lib/Extensions.js +69 -0
  217. data/node_modules/ws/lib/PerMessageDeflate.js +339 -0
  218. data/node_modules/ws/lib/Receiver.js +520 -0
  219. data/node_modules/ws/lib/Sender.js +438 -0
  220. data/node_modules/ws/lib/Validation.fallback.js +9 -0
  221. data/node_modules/ws/lib/Validation.js +17 -0
  222. data/node_modules/ws/lib/WebSocket.js +705 -0
  223. data/node_modules/ws/lib/WebSocketServer.js +336 -0
  224. data/node_modules/ws/package.json +122 -0
  225. data/package.json +26 -0
  226. data/samples/sample.html +13 -0
  227. data/script/rasterize.js +18 -0
  228. metadata +325 -0
@@ -0,0 +1,99 @@
1
+ {
2
+ "_args": [
3
+ [
4
+ {
5
+ "raw": "minimatch@^3.0.4",
6
+ "scope": null,
7
+ "escapedName": "minimatch",
8
+ "name": "minimatch",
9
+ "rawSpec": "^3.0.4",
10
+ "spec": ">=3.0.4 <4.0.0",
11
+ "type": "range"
12
+ },
13
+ "/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/glob"
14
+ ]
15
+ ],
16
+ "_from": "minimatch@>=3.0.4 <4.0.0",
17
+ "_id": "minimatch@3.0.4",
18
+ "_inCache": true,
19
+ "_location": "/minimatch",
20
+ "_nodeVersion": "8.0.0-pre",
21
+ "_npmOperationalInternal": {
22
+ "host": "packages-18-east.internal.npmjs.com",
23
+ "tmp": "tmp/minimatch-3.0.4.tgz_1494180669024_0.22628829116001725"
24
+ },
25
+ "_npmUser": {
26
+ "name": "isaacs",
27
+ "email": "i@izs.me"
28
+ },
29
+ "_npmVersion": "5.0.0-beta.43",
30
+ "_phantomChildren": {},
31
+ "_requested": {
32
+ "raw": "minimatch@^3.0.4",
33
+ "scope": null,
34
+ "escapedName": "minimatch",
35
+ "name": "minimatch",
36
+ "rawSpec": "^3.0.4",
37
+ "spec": ">=3.0.4 <4.0.0",
38
+ "type": "range"
39
+ },
40
+ "_requiredBy": [
41
+ "/glob"
42
+ ],
43
+ "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
44
+ "_shasum": "5166e286457f03306064be5497e8dbb0c3d32083",
45
+ "_shrinkwrap": null,
46
+ "_spec": "minimatch@^3.0.4",
47
+ "_where": "/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/glob",
48
+ "author": {
49
+ "name": "Isaac Z. Schlueter",
50
+ "email": "i@izs.me",
51
+ "url": "http://blog.izs.me"
52
+ },
53
+ "bugs": {
54
+ "url": "https://github.com/isaacs/minimatch/issues"
55
+ },
56
+ "dependencies": {
57
+ "brace-expansion": "^1.1.7"
58
+ },
59
+ "description": "a glob matcher in javascript",
60
+ "devDependencies": {
61
+ "tap": "^10.3.2"
62
+ },
63
+ "directories": {},
64
+ "dist": {
65
+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
66
+ "shasum": "5166e286457f03306064be5497e8dbb0c3d32083",
67
+ "tarball": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz"
68
+ },
69
+ "engines": {
70
+ "node": "*"
71
+ },
72
+ "files": [
73
+ "minimatch.js"
74
+ ],
75
+ "gitHead": "e46989a323d5f0aa4781eff5e2e6e7aafa223321",
76
+ "homepage": "https://github.com/isaacs/minimatch#readme",
77
+ "license": "ISC",
78
+ "main": "minimatch.js",
79
+ "maintainers": [
80
+ {
81
+ "name": "isaacs",
82
+ "email": "i@izs.me"
83
+ }
84
+ ],
85
+ "name": "minimatch",
86
+ "optionalDependencies": {},
87
+ "readme": "ERROR: No README data found!",
88
+ "repository": {
89
+ "type": "git",
90
+ "url": "git://github.com/isaacs/minimatch.git"
91
+ },
92
+ "scripts": {
93
+ "postpublish": "git push origin --all; git push origin --tags",
94
+ "postversion": "npm publish",
95
+ "preversion": "npm test",
96
+ "test": "tap test/*.js --cov"
97
+ },
98
+ "version": "3.0.4"
99
+ }
@@ -0,0 +1,4 @@
1
+ language: node_js
2
+ node_js:
3
+ - "0.8"
4
+ - "0.10"
@@ -0,0 +1,18 @@
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.
@@ -0,0 +1,2 @@
1
+ var argv = require('../')(process.argv.slice(2));
2
+ console.dir(argv);
@@ -0,0 +1,187 @@
1
+ module.exports = function (args, opts) {
2
+ if (!opts) opts = {};
3
+
4
+ var flags = { bools : {}, strings : {} };
5
+
6
+ [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
7
+ flags.bools[key] = true;
8
+ });
9
+
10
+ [].concat(opts.string).filter(Boolean).forEach(function (key) {
11
+ flags.strings[key] = true;
12
+ });
13
+
14
+ var aliases = {};
15
+ Object.keys(opts.alias || {}).forEach(function (key) {
16
+ aliases[key] = [].concat(opts.alias[key]);
17
+ aliases[key].forEach(function (x) {
18
+ aliases[x] = [key].concat(aliases[key].filter(function (y) {
19
+ return x !== y;
20
+ }));
21
+ });
22
+ });
23
+
24
+ var defaults = opts['default'] || {};
25
+
26
+ var argv = { _ : [] };
27
+ Object.keys(flags.bools).forEach(function (key) {
28
+ setArg(key, defaults[key] === undefined ? false : defaults[key]);
29
+ });
30
+
31
+ var notFlags = [];
32
+
33
+ if (args.indexOf('--') !== -1) {
34
+ notFlags = args.slice(args.indexOf('--')+1);
35
+ args = args.slice(0, args.indexOf('--'));
36
+ }
37
+
38
+ function setArg (key, val) {
39
+ var value = !flags.strings[key] && isNumber(val)
40
+ ? Number(val) : val
41
+ ;
42
+ setKey(argv, key.split('.'), value);
43
+
44
+ (aliases[key] || []).forEach(function (x) {
45
+ setKey(argv, x.split('.'), value);
46
+ });
47
+ }
48
+
49
+ for (var i = 0; i < args.length; i++) {
50
+ var arg = args[i];
51
+
52
+ if (/^--.+=/.test(arg)) {
53
+ // Using [\s\S] instead of . because js doesn't support the
54
+ // 'dotall' regex modifier. See:
55
+ // http://stackoverflow.com/a/1068308/13216
56
+ var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
57
+ setArg(m[1], m[2]);
58
+ }
59
+ else if (/^--no-.+/.test(arg)) {
60
+ var key = arg.match(/^--no-(.+)/)[1];
61
+ setArg(key, false);
62
+ }
63
+ else if (/^--.+/.test(arg)) {
64
+ var key = arg.match(/^--(.+)/)[1];
65
+ var next = args[i + 1];
66
+ if (next !== undefined && !/^-/.test(next)
67
+ && !flags.bools[key]
68
+ && (aliases[key] ? !flags.bools[aliases[key]] : true)) {
69
+ setArg(key, next);
70
+ i++;
71
+ }
72
+ else if (/^(true|false)$/.test(next)) {
73
+ setArg(key, next === 'true');
74
+ i++;
75
+ }
76
+ else {
77
+ setArg(key, flags.strings[key] ? '' : true);
78
+ }
79
+ }
80
+ else if (/^-[^-]+/.test(arg)) {
81
+ var letters = arg.slice(1,-1).split('');
82
+
83
+ var broken = false;
84
+ for (var j = 0; j < letters.length; j++) {
85
+ var next = arg.slice(j+2);
86
+
87
+ if (next === '-') {
88
+ setArg(letters[j], next)
89
+ continue;
90
+ }
91
+
92
+ if (/[A-Za-z]/.test(letters[j])
93
+ && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
94
+ setArg(letters[j], next);
95
+ broken = true;
96
+ break;
97
+ }
98
+
99
+ if (letters[j+1] && letters[j+1].match(/\W/)) {
100
+ setArg(letters[j], arg.slice(j+2));
101
+ broken = true;
102
+ break;
103
+ }
104
+ else {
105
+ setArg(letters[j], flags.strings[letters[j]] ? '' : true);
106
+ }
107
+ }
108
+
109
+ var key = arg.slice(-1)[0];
110
+ if (!broken && key !== '-') {
111
+ if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
112
+ && !flags.bools[key]
113
+ && (aliases[key] ? !flags.bools[aliases[key]] : true)) {
114
+ setArg(key, args[i+1]);
115
+ i++;
116
+ }
117
+ else if (args[i+1] && /true|false/.test(args[i+1])) {
118
+ setArg(key, args[i+1] === 'true');
119
+ i++;
120
+ }
121
+ else {
122
+ setArg(key, flags.strings[key] ? '' : true);
123
+ }
124
+ }
125
+ }
126
+ else {
127
+ argv._.push(
128
+ flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
129
+ );
130
+ }
131
+ }
132
+
133
+ Object.keys(defaults).forEach(function (key) {
134
+ if (!hasKey(argv, key.split('.'))) {
135
+ setKey(argv, key.split('.'), defaults[key]);
136
+
137
+ (aliases[key] || []).forEach(function (x) {
138
+ setKey(argv, x.split('.'), defaults[key]);
139
+ });
140
+ }
141
+ });
142
+
143
+ notFlags.forEach(function(key) {
144
+ argv._.push(key);
145
+ });
146
+
147
+ return argv;
148
+ };
149
+
150
+ function hasKey (obj, keys) {
151
+ var o = obj;
152
+ keys.slice(0,-1).forEach(function (key) {
153
+ o = (o[key] || {});
154
+ });
155
+
156
+ var key = keys[keys.length - 1];
157
+ return key in o;
158
+ }
159
+
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
+ function isNumber (x) {
180
+ if (typeof x === 'number') return true;
181
+ if (/^0x[0-9a-f]+$/i.test(x)) return true;
182
+ return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
183
+ }
184
+
185
+ function longest (xs) {
186
+ return Math.max.apply(null, xs.map(function (x) { return x.length }));
187
+ }
@@ -0,0 +1,101 @@
1
+ {
2
+ "_args": [
3
+ [
4
+ {
5
+ "raw": "minimist@0.0.8",
6
+ "scope": null,
7
+ "escapedName": "minimist",
8
+ "name": "minimist",
9
+ "rawSpec": "0.0.8",
10
+ "spec": "0.0.8",
11
+ "type": "version"
12
+ },
13
+ "/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/mkdirp"
14
+ ]
15
+ ],
16
+ "_from": "minimist@0.0.8",
17
+ "_id": "minimist@0.0.8",
18
+ "_inCache": true,
19
+ "_location": "/minimist",
20
+ "_npmUser": {
21
+ "name": "substack",
22
+ "email": "mail@substack.net"
23
+ },
24
+ "_npmVersion": "1.4.3",
25
+ "_phantomChildren": {},
26
+ "_requested": {
27
+ "raw": "minimist@0.0.8",
28
+ "scope": null,
29
+ "escapedName": "minimist",
30
+ "name": "minimist",
31
+ "rawSpec": "0.0.8",
32
+ "spec": "0.0.8",
33
+ "type": "version"
34
+ },
35
+ "_requiredBy": [
36
+ "/mkdirp"
37
+ ],
38
+ "_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
39
+ "_shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d",
40
+ "_shrinkwrap": null,
41
+ "_spec": "minimist@0.0.8",
42
+ "_where": "/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/mkdirp",
43
+ "author": {
44
+ "name": "James Halliday",
45
+ "email": "mail@substack.net",
46
+ "url": "http://substack.net"
47
+ },
48
+ "bugs": {
49
+ "url": "https://github.com/substack/minimist/issues"
50
+ },
51
+ "dependencies": {},
52
+ "description": "parse argument options",
53
+ "devDependencies": {
54
+ "tap": "~0.4.0",
55
+ "tape": "~1.0.4"
56
+ },
57
+ "directories": {},
58
+ "dist": {
59
+ "shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d",
60
+ "tarball": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz"
61
+ },
62
+ "homepage": "https://github.com/substack/minimist",
63
+ "keywords": [
64
+ "argv",
65
+ "getopt",
66
+ "parser",
67
+ "optimist"
68
+ ],
69
+ "license": "MIT",
70
+ "main": "index.js",
71
+ "maintainers": [
72
+ {
73
+ "name": "substack",
74
+ "email": "mail@substack.net"
75
+ }
76
+ ],
77
+ "name": "minimist",
78
+ "optionalDependencies": {},
79
+ "readme": "ERROR: No README data found!",
80
+ "repository": {
81
+ "type": "git",
82
+ "url": "git://github.com/substack/minimist.git"
83
+ },
84
+ "scripts": {
85
+ "test": "tap test/*.js"
86
+ },
87
+ "testling": {
88
+ "files": "test/*.js",
89
+ "browsers": [
90
+ "ie/6..latest",
91
+ "ff/5",
92
+ "firefox/latest",
93
+ "chrome/10",
94
+ "chrome/latest",
95
+ "safari/5.1",
96
+ "safari/latest",
97
+ "opera/12"
98
+ ]
99
+ },
100
+ "version": "0.0.8"
101
+ }
@@ -0,0 +1,73 @@
1
+ # minimist
2
+
3
+ parse argument options
4
+
5
+ This module is the guts of optimist's argument parser without all the
6
+ fanciful decoration.
7
+
8
+ [![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist)
9
+
10
+ [![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist)
11
+
12
+ # example
13
+
14
+ ``` js
15
+ var argv = require('minimist')(process.argv.slice(2));
16
+ console.dir(argv);
17
+ ```
18
+
19
+ ```
20
+ $ node example/parse.js -a beep -b boop
21
+ { _: [], a: 'beep', b: 'boop' }
22
+ ```
23
+
24
+ ```
25
+ $ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
26
+ { _: [ 'foo', 'bar', 'baz' ],
27
+ x: 3,
28
+ y: 4,
29
+ n: 5,
30
+ a: true,
31
+ b: true,
32
+ c: true,
33
+ beep: 'boop' }
34
+ ```
35
+
36
+ # methods
37
+
38
+ ``` js
39
+ var parseArgs = require('minimist')
40
+ ```
41
+
42
+ ## var argv = parseArgs(args, opts={})
43
+
44
+ Return an argument object `argv` populated with the array arguments from `args`.
45
+
46
+ `argv._` contains all the arguments that didn't have an option associated with
47
+ them.
48
+
49
+ Numeric-looking arguments will be returned as numbers unless `opts.string` or
50
+ `opts.boolean` is set for that argument name.
51
+
52
+ Any arguments after `'--'` will not be parsed and will end up in `argv._`.
53
+
54
+ options can be:
55
+
56
+ * `opts.string` - a string or array of strings argument names to always treat as
57
+ strings
58
+ * `opts.boolean` - a string or array of strings to always treat as booleans
59
+ * `opts.alias` - an object mapping string names to strings or arrays of string
60
+ argument names to use as aliases
61
+ * `opts.default` - an object mapping string argument names to default values
62
+
63
+ # install
64
+
65
+ With [npm](https://npmjs.org) do:
66
+
67
+ ```
68
+ npm install minimist
69
+ ```
70
+
71
+ # license
72
+
73
+ MIT