dragonfly_chrome_headless 0.2.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.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +12 -0
- data/Gemfile +4 -0
- data/README.md +53 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/dragonfly_chrome_headless.gemspec +27 -0
- data/lib/dragonfly_chrome_headless.rb +9 -0
- data/lib/dragonfly_chrome_headless/plugin.rb +17 -0
- data/lib/dragonfly_chrome_headless/processors/rasterize.rb +33 -0
- data/lib/dragonfly_chrome_headless/version.rb +3 -0
- data/node_modules/.bin/chrome-remote-interface +1 -0
- data/node_modules/.bin/mkdirp +1 -0
- data/node_modules/.bin/rimraf +1 -0
- data/node_modules/@types/core-js/LICENSE +21 -0
- data/node_modules/@types/core-js/README.md +16 -0
- data/node_modules/@types/core-js/index.d.ts +2452 -0
- data/node_modules/@types/core-js/package.json +85 -0
- data/node_modules/@types/mkdirp/README.md +18 -0
- data/node_modules/@types/mkdirp/index.d.ts +14 -0
- data/node_modules/@types/mkdirp/package.json +77 -0
- data/node_modules/@types/mkdirp/types-metadata.json +25 -0
- data/node_modules/@types/node/README.md +16 -0
- data/node_modules/@types/node/index.d.ts +4132 -0
- data/node_modules/@types/node/package.json +84 -0
- data/node_modules/balanced-match/.npmignore +5 -0
- data/node_modules/balanced-match/LICENSE.md +21 -0
- data/node_modules/balanced-match/README.md +91 -0
- data/node_modules/balanced-match/index.js +59 -0
- data/node_modules/balanced-match/package.json +112 -0
- data/node_modules/brace-expansion/README.md +123 -0
- data/node_modules/brace-expansion/index.js +201 -0
- data/node_modules/brace-expansion/package.json +114 -0
- data/node_modules/chrome-launcher/.clang-format +6 -0
- data/node_modules/chrome-launcher/.npmignore +11 -0
- data/node_modules/chrome-launcher/README.md +123 -0
- data/node_modules/chrome-launcher/ask.js +32 -0
- data/node_modules/chrome-launcher/ask.ts +35 -0
- data/node_modules/chrome-launcher/chrome-finder.js +157 -0
- data/node_modules/chrome-launcher/chrome-finder.ts +186 -0
- data/node_modules/chrome-launcher/chrome-launcher.js +245 -0
- data/node_modules/chrome-launcher/chrome-launcher.ts +312 -0
- data/node_modules/chrome-launcher/compiled-check.js +14 -0
- data/node_modules/chrome-launcher/flags.js +27 -0
- data/node_modules/chrome-launcher/flags.ts +26 -0
- data/node_modules/chrome-launcher/index.js +7 -0
- data/node_modules/chrome-launcher/index.ts +1 -0
- data/node_modules/chrome-launcher/manual-chrome-launcher.js +30 -0
- data/node_modules/chrome-launcher/package.json +116 -0
- data/node_modules/chrome-launcher/random-port.js +24 -0
- data/node_modules/chrome-launcher/random-port.ts +23 -0
- data/node_modules/chrome-launcher/tsconfig.json +19 -0
- data/node_modules/chrome-launcher/utils.js +52 -0
- data/node_modules/chrome-launcher/utils.ts +44 -0
- data/node_modules/chrome-launcher/yarn.lock +1486 -0
- data/node_modules/chrome-remote-interface/LICENSE +18 -0
- data/node_modules/chrome-remote-interface/README.md +849 -0
- data/node_modules/chrome-remote-interface/bin/client.js +337 -0
- data/node_modules/chrome-remote-interface/chrome-remote-interface.js +11 -0
- data/node_modules/chrome-remote-interface/index.js +39 -0
- data/node_modules/chrome-remote-interface/lib/api.js +84 -0
- data/node_modules/chrome-remote-interface/lib/chrome.js +307 -0
- data/node_modules/chrome-remote-interface/lib/defaults.js +4 -0
- data/node_modules/chrome-remote-interface/lib/devtools.js +245 -0
- data/node_modules/chrome-remote-interface/lib/external-request.js +28 -0
- data/node_modules/chrome-remote-interface/lib/protocol.json +13780 -0
- data/node_modules/chrome-remote-interface/lib/websocket-wrapper.js +32 -0
- data/node_modules/chrome-remote-interface/package.json +128 -0
- data/node_modules/chrome-remote-interface/webpack.config.js +55 -0
- data/node_modules/commander/Readme.md +195 -0
- data/node_modules/commander/index.js +851 -0
- data/node_modules/commander/package.json +92 -0
- data/node_modules/concat-map/.travis.yml +4 -0
- data/node_modules/concat-map/LICENSE +18 -0
- data/node_modules/concat-map/README.markdown +62 -0
- data/node_modules/concat-map/example/map.js +6 -0
- data/node_modules/concat-map/index.js +13 -0
- data/node_modules/concat-map/package.json +117 -0
- data/node_modules/concat-map/test/map.js +39 -0
- data/node_modules/debug/.coveralls.yml +1 -0
- data/node_modules/debug/.eslintrc +11 -0
- data/node_modules/debug/.npmignore +9 -0
- data/node_modules/debug/.travis.yml +14 -0
- data/node_modules/debug/CHANGELOG.md +357 -0
- data/node_modules/debug/LICENSE +19 -0
- data/node_modules/debug/Makefile +50 -0
- data/node_modules/debug/Readme.md +312 -0
- data/node_modules/debug/component.json +19 -0
- data/node_modules/debug/karma.conf.js +70 -0
- data/node_modules/debug/node.js +1 -0
- data/node_modules/debug/package.json +124 -0
- data/node_modules/debug/src/browser.js +185 -0
- data/node_modules/debug/src/debug.js +202 -0
- data/node_modules/debug/src/index.js +10 -0
- data/node_modules/debug/src/node.js +246 -0
- data/node_modules/fs.realpath/LICENSE +43 -0
- data/node_modules/fs.realpath/README.md +33 -0
- data/node_modules/fs.realpath/index.js +66 -0
- data/node_modules/fs.realpath/old.js +303 -0
- data/node_modules/fs.realpath/package.json +94 -0
- data/node_modules/glob/LICENSE +15 -0
- data/node_modules/glob/README.md +368 -0
- data/node_modules/glob/changelog.md +67 -0
- data/node_modules/glob/common.js +240 -0
- data/node_modules/glob/glob.js +790 -0
- data/node_modules/glob/package.json +112 -0
- data/node_modules/glob/sync.js +486 -0
- data/node_modules/html-pdf-chrome/.npmignore +9 -0
- data/node_modules/html-pdf-chrome/LICENSE +21 -0
- data/node_modules/html-pdf-chrome/README.md +165 -0
- data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.d.ts +87 -0
- data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.js +4 -0
- data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.js.map +1 -0
- data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.d.ts +120 -0
- data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.js +206 -0
- data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.js.map +1 -0
- data/node_modules/html-pdf-chrome/lib/src/CreateResult.d.ts +70 -0
- data/node_modules/html-pdf-chrome/lib/src/CreateResult.js +98 -0
- data/node_modules/html-pdf-chrome/lib/src/CreateResult.js.map +1 -0
- data/node_modules/html-pdf-chrome/lib/src/index.d.ts +72 -0
- data/node_modules/html-pdf-chrome/lib/src/index.js +123 -0
- data/node_modules/html-pdf-chrome/lib/src/index.js.map +1 -0
- data/node_modules/html-pdf-chrome/package.json +133 -0
- data/node_modules/html-pdf-chrome/src/ChromePrintOptions.ts +99 -0
- data/node_modules/html-pdf-chrome/src/CompletionTrigger.ts +201 -0
- data/node_modules/html-pdf-chrome/src/CreateResult.ts +100 -0
- data/node_modules/html-pdf-chrome/src/index.ts +179 -0
- data/node_modules/inflight/LICENSE +15 -0
- data/node_modules/inflight/README.md +37 -0
- data/node_modules/inflight/inflight.js +54 -0
- data/node_modules/inflight/package.json +105 -0
- data/node_modules/inherits/LICENSE +16 -0
- data/node_modules/inherits/README.md +42 -0
- data/node_modules/inherits/inherits.js +7 -0
- data/node_modules/inherits/inherits_browser.js +23 -0
- data/node_modules/inherits/package.json +97 -0
- data/node_modules/lighthouse-logger/README.md +4 -0
- data/node_modules/lighthouse-logger/index.js +212 -0
- data/node_modules/lighthouse-logger/package.json +69 -0
- data/node_modules/lighthouse-logger/yarn.lock +13 -0
- data/node_modules/minimatch/LICENSE +15 -0
- data/node_modules/minimatch/README.md +209 -0
- data/node_modules/minimatch/minimatch.js +923 -0
- data/node_modules/minimatch/package.json +99 -0
- data/node_modules/minimist/.travis.yml +4 -0
- data/node_modules/minimist/LICENSE +18 -0
- data/node_modules/minimist/example/parse.js +2 -0
- data/node_modules/minimist/index.js +187 -0
- data/node_modules/minimist/package.json +101 -0
- data/node_modules/minimist/readme.markdown +73 -0
- data/node_modules/minimist/test/dash.js +24 -0
- data/node_modules/minimist/test/default_bool.js +20 -0
- data/node_modules/minimist/test/dotted.js +16 -0
- data/node_modules/minimist/test/long.js +31 -0
- data/node_modules/minimist/test/parse.js +318 -0
- data/node_modules/minimist/test/parse_modified.js +9 -0
- data/node_modules/minimist/test/short.js +67 -0
- data/node_modules/minimist/test/whitespace.js +8 -0
- data/node_modules/mkdirp/.travis.yml +8 -0
- data/node_modules/mkdirp/LICENSE +21 -0
- data/node_modules/mkdirp/bin/cmd.js +33 -0
- data/node_modules/mkdirp/bin/usage.txt +12 -0
- data/node_modules/mkdirp/examples/pow.js +6 -0
- data/node_modules/mkdirp/index.js +98 -0
- data/node_modules/mkdirp/package.json +93 -0
- data/node_modules/mkdirp/readme.markdown +100 -0
- data/node_modules/mkdirp/test/chmod.js +41 -0
- data/node_modules/mkdirp/test/clobber.js +38 -0
- data/node_modules/mkdirp/test/mkdirp.js +28 -0
- data/node_modules/mkdirp/test/opts_fs.js +29 -0
- data/node_modules/mkdirp/test/opts_fs_sync.js +27 -0
- data/node_modules/mkdirp/test/perm.js +32 -0
- data/node_modules/mkdirp/test/perm_sync.js +36 -0
- data/node_modules/mkdirp/test/race.js +37 -0
- data/node_modules/mkdirp/test/rel.js +32 -0
- data/node_modules/mkdirp/test/return.js +25 -0
- data/node_modules/mkdirp/test/return_sync.js +24 -0
- data/node_modules/mkdirp/test/root.js +19 -0
- data/node_modules/mkdirp/test/sync.js +32 -0
- data/node_modules/mkdirp/test/umask.js +28 -0
- data/node_modules/mkdirp/test/umask_sync.js +32 -0
- data/node_modules/ms/README.md +51 -0
- data/node_modules/ms/index.js +152 -0
- data/node_modules/ms/license.md +21 -0
- data/node_modules/ms/package.json +109 -0
- data/node_modules/once/LICENSE +15 -0
- data/node_modules/once/README.md +79 -0
- data/node_modules/once/once.js +42 -0
- data/node_modules/once/package.json +101 -0
- data/node_modules/path-is-absolute/index.js +20 -0
- data/node_modules/path-is-absolute/license +21 -0
- data/node_modules/path-is-absolute/package.json +111 -0
- data/node_modules/path-is-absolute/readme.md +59 -0
- data/node_modules/rimraf/LICENSE +15 -0
- data/node_modules/rimraf/README.md +101 -0
- data/node_modules/rimraf/bin.js +50 -0
- data/node_modules/rimraf/package.json +99 -0
- data/node_modules/rimraf/rimraf.js +363 -0
- data/node_modules/ultron/LICENSE +22 -0
- data/node_modules/ultron/index.js +138 -0
- data/node_modules/ultron/package.json +112 -0
- data/node_modules/wrappy/LICENSE +15 -0
- data/node_modules/wrappy/README.md +36 -0
- data/node_modules/wrappy/package.json +97 -0
- data/node_modules/wrappy/wrappy.js +33 -0
- data/node_modules/ws/LICENSE +21 -0
- data/node_modules/ws/README.md +259 -0
- data/node_modules/ws/SECURITY.md +33 -0
- data/node_modules/ws/index.js +15 -0
- data/node_modules/ws/lib/BufferUtil.fallback.js +56 -0
- data/node_modules/ws/lib/BufferUtil.js +15 -0
- data/node_modules/ws/lib/ErrorCodes.js +28 -0
- data/node_modules/ws/lib/EventTarget.js +158 -0
- data/node_modules/ws/lib/Extensions.js +69 -0
- data/node_modules/ws/lib/PerMessageDeflate.js +339 -0
- data/node_modules/ws/lib/Receiver.js +520 -0
- data/node_modules/ws/lib/Sender.js +438 -0
- data/node_modules/ws/lib/Validation.fallback.js +9 -0
- data/node_modules/ws/lib/Validation.js +17 -0
- data/node_modules/ws/lib/WebSocket.js +705 -0
- data/node_modules/ws/lib/WebSocketServer.js +336 -0
- data/node_modules/ws/package.json +122 -0
- data/package.json +26 -0
- data/samples/sample.html +13 -0
- data/script/rasterize.js +18 -0
- metadata +325 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_args": [
|
|
3
|
+
[
|
|
4
|
+
{
|
|
5
|
+
"raw": "@types/node@6.0.66",
|
|
6
|
+
"scope": "@types",
|
|
7
|
+
"escapedName": "@types%2fnode",
|
|
8
|
+
"name": "@types/node",
|
|
9
|
+
"rawSpec": "6.0.66",
|
|
10
|
+
"spec": "6.0.66",
|
|
11
|
+
"type": "version"
|
|
12
|
+
},
|
|
13
|
+
"/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/chrome-launcher"
|
|
14
|
+
]
|
|
15
|
+
],
|
|
16
|
+
"_from": "@types/node@6.0.66",
|
|
17
|
+
"_id": "@types/node@6.0.66",
|
|
18
|
+
"_inCache": true,
|
|
19
|
+
"_location": "/@types/node",
|
|
20
|
+
"_npmOperationalInternal": {
|
|
21
|
+
"host": "packages-12-west.internal.npmjs.com",
|
|
22
|
+
"tmp": "tmp/node-6.0.66.tgz_1490223088343_0.11855865782126784"
|
|
23
|
+
},
|
|
24
|
+
"_npmUser": {
|
|
25
|
+
"name": "types",
|
|
26
|
+
"email": "ts-npm-types@microsoft.com"
|
|
27
|
+
},
|
|
28
|
+
"_phantomChildren": {},
|
|
29
|
+
"_requested": {
|
|
30
|
+
"raw": "@types/node@6.0.66",
|
|
31
|
+
"scope": "@types",
|
|
32
|
+
"escapedName": "@types%2fnode",
|
|
33
|
+
"name": "@types/node",
|
|
34
|
+
"rawSpec": "6.0.66",
|
|
35
|
+
"spec": "6.0.66",
|
|
36
|
+
"type": "version"
|
|
37
|
+
},
|
|
38
|
+
"_requiredBy": [
|
|
39
|
+
"/chrome-launcher"
|
|
40
|
+
],
|
|
41
|
+
"_resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.66.tgz",
|
|
42
|
+
"_shasum": "5680b74a6135d33d4c00447e7c3dc691a4601625",
|
|
43
|
+
"_shrinkwrap": null,
|
|
44
|
+
"_spec": "@types/node@6.0.66",
|
|
45
|
+
"_where": "/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/chrome-launcher",
|
|
46
|
+
"contributors": [
|
|
47
|
+
{
|
|
48
|
+
"name": "Microsoft TypeScript",
|
|
49
|
+
"url": "http://typescriptlang.org"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "DefinitelyTyped",
|
|
53
|
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"dependencies": {},
|
|
57
|
+
"description": "TypeScript definitions for Node.js",
|
|
58
|
+
"devDependencies": {},
|
|
59
|
+
"directories": {},
|
|
60
|
+
"dist": {
|
|
61
|
+
"shasum": "5680b74a6135d33d4c00447e7c3dc691a4601625",
|
|
62
|
+
"tarball": "https://registry.npmjs.org/@types/node/-/node-6.0.66.tgz"
|
|
63
|
+
},
|
|
64
|
+
"license": "MIT",
|
|
65
|
+
"main": "",
|
|
66
|
+
"maintainers": [
|
|
67
|
+
{
|
|
68
|
+
"name": "types",
|
|
69
|
+
"email": "ryan.cavanaugh@microsoft.com"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"name": "@types/node",
|
|
73
|
+
"optionalDependencies": {},
|
|
74
|
+
"peerDependencies": {},
|
|
75
|
+
"readme": "ERROR: No README data found!",
|
|
76
|
+
"repository": {
|
|
77
|
+
"type": "git",
|
|
78
|
+
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
|
|
79
|
+
},
|
|
80
|
+
"scripts": {},
|
|
81
|
+
"typeScriptVersion": "2.0",
|
|
82
|
+
"typesPublisherContentHash": "f696c6b23ef8b95ed3be81a70ebb948983958ff6f84bc312e5cf8ff9326eff46",
|
|
83
|
+
"version": "6.0.66"
|
|
84
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
(MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
10
|
+
so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# balanced-match
|
|
2
|
+
|
|
3
|
+
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
|
|
4
|
+
|
|
5
|
+
[](http://travis-ci.org/juliangruber/balanced-match)
|
|
6
|
+
[](https://www.npmjs.org/package/balanced-match)
|
|
7
|
+
|
|
8
|
+
[](https://ci.testling.com/juliangruber/balanced-match)
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
Get the first matching pair of braces:
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
var balanced = require('balanced-match');
|
|
16
|
+
|
|
17
|
+
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
|
18
|
+
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
|
19
|
+
console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The matches are:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
$ node example.js
|
|
26
|
+
{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
|
|
27
|
+
{ start: 3,
|
|
28
|
+
end: 9,
|
|
29
|
+
pre: 'pre',
|
|
30
|
+
body: 'first',
|
|
31
|
+
post: 'between{second}post' }
|
|
32
|
+
{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## API
|
|
36
|
+
|
|
37
|
+
### var m = balanced(a, b, str)
|
|
38
|
+
|
|
39
|
+
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
|
40
|
+
object with those keys:
|
|
41
|
+
|
|
42
|
+
* **start** the index of the first match of `a`
|
|
43
|
+
* **end** the index of the matching `b`
|
|
44
|
+
* **pre** the preamble, `a` and `b` not included
|
|
45
|
+
* **body** the match, `a` and `b` not included
|
|
46
|
+
* **post** the postscript, `a` and `b` not included
|
|
47
|
+
|
|
48
|
+
If there's no match, `undefined` will be returned.
|
|
49
|
+
|
|
50
|
+
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
|
|
51
|
+
|
|
52
|
+
### var r = balanced.range(a, b, str)
|
|
53
|
+
|
|
54
|
+
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
|
55
|
+
array with indexes: `[ <a index>, <b index> ]`.
|
|
56
|
+
|
|
57
|
+
If there's no match, `undefined` will be returned.
|
|
58
|
+
|
|
59
|
+
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
With [npm](https://npmjs.org) do:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm install balanced-match
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
(MIT)
|
|
72
|
+
|
|
73
|
+
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
74
|
+
|
|
75
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
76
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
77
|
+
the Software without restriction, including without limitation the rights to
|
|
78
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
79
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
80
|
+
so, subject to the following conditions:
|
|
81
|
+
|
|
82
|
+
The above copyright notice and this permission notice shall be included in all
|
|
83
|
+
copies or substantial portions of the Software.
|
|
84
|
+
|
|
85
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
86
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
87
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
88
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
89
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
90
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
91
|
+
SOFTWARE.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
module.exports = balanced;
|
|
3
|
+
function balanced(a, b, str) {
|
|
4
|
+
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
5
|
+
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
6
|
+
|
|
7
|
+
var r = range(a, b, str);
|
|
8
|
+
|
|
9
|
+
return r && {
|
|
10
|
+
start: r[0],
|
|
11
|
+
end: r[1],
|
|
12
|
+
pre: str.slice(0, r[0]),
|
|
13
|
+
body: str.slice(r[0] + a.length, r[1]),
|
|
14
|
+
post: str.slice(r[1] + b.length)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function maybeMatch(reg, str) {
|
|
19
|
+
var m = str.match(reg);
|
|
20
|
+
return m ? m[0] : null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
balanced.range = range;
|
|
24
|
+
function range(a, b, str) {
|
|
25
|
+
var begs, beg, left, right, result;
|
|
26
|
+
var ai = str.indexOf(a);
|
|
27
|
+
var bi = str.indexOf(b, ai + 1);
|
|
28
|
+
var i = ai;
|
|
29
|
+
|
|
30
|
+
if (ai >= 0 && bi > 0) {
|
|
31
|
+
begs = [];
|
|
32
|
+
left = str.length;
|
|
33
|
+
|
|
34
|
+
while (i >= 0 && !result) {
|
|
35
|
+
if (i == ai) {
|
|
36
|
+
begs.push(i);
|
|
37
|
+
ai = str.indexOf(a, i + 1);
|
|
38
|
+
} else if (begs.length == 1) {
|
|
39
|
+
result = [ begs.pop(), bi ];
|
|
40
|
+
} else {
|
|
41
|
+
beg = begs.pop();
|
|
42
|
+
if (beg < left) {
|
|
43
|
+
left = beg;
|
|
44
|
+
right = bi;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
bi = str.indexOf(b, i + 1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
i = ai < bi && ai >= 0 ? ai : bi;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (begs.length) {
|
|
54
|
+
result = [ left, right ];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_args": [
|
|
3
|
+
[
|
|
4
|
+
{
|
|
5
|
+
"raw": "balanced-match@^1.0.0",
|
|
6
|
+
"scope": null,
|
|
7
|
+
"escapedName": "balanced-match",
|
|
8
|
+
"name": "balanced-match",
|
|
9
|
+
"rawSpec": "^1.0.0",
|
|
10
|
+
"spec": ">=1.0.0 <2.0.0",
|
|
11
|
+
"type": "range"
|
|
12
|
+
},
|
|
13
|
+
"/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/brace-expansion"
|
|
14
|
+
]
|
|
15
|
+
],
|
|
16
|
+
"_from": "balanced-match@>=1.0.0 <2.0.0",
|
|
17
|
+
"_id": "balanced-match@1.0.0",
|
|
18
|
+
"_inCache": true,
|
|
19
|
+
"_location": "/balanced-match",
|
|
20
|
+
"_nodeVersion": "7.8.0",
|
|
21
|
+
"_npmOperationalInternal": {
|
|
22
|
+
"host": "s3://npm-registry-packages",
|
|
23
|
+
"tmp": "tmp/balanced-match-1.0.0.tgz_1497251909645_0.8755026108119637"
|
|
24
|
+
},
|
|
25
|
+
"_npmUser": {
|
|
26
|
+
"name": "juliangruber",
|
|
27
|
+
"email": "julian@juliangruber.com"
|
|
28
|
+
},
|
|
29
|
+
"_npmVersion": "4.2.0",
|
|
30
|
+
"_phantomChildren": {},
|
|
31
|
+
"_requested": {
|
|
32
|
+
"raw": "balanced-match@^1.0.0",
|
|
33
|
+
"scope": null,
|
|
34
|
+
"escapedName": "balanced-match",
|
|
35
|
+
"name": "balanced-match",
|
|
36
|
+
"rawSpec": "^1.0.0",
|
|
37
|
+
"spec": ">=1.0.0 <2.0.0",
|
|
38
|
+
"type": "range"
|
|
39
|
+
},
|
|
40
|
+
"_requiredBy": [
|
|
41
|
+
"/brace-expansion"
|
|
42
|
+
],
|
|
43
|
+
"_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
|
44
|
+
"_shasum": "89b4d199ab2bee49de164ea02b89ce462d71b767",
|
|
45
|
+
"_shrinkwrap": null,
|
|
46
|
+
"_spec": "balanced-match@^1.0.0",
|
|
47
|
+
"_where": "/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/brace-expansion",
|
|
48
|
+
"author": {
|
|
49
|
+
"name": "Julian Gruber",
|
|
50
|
+
"email": "mail@juliangruber.com",
|
|
51
|
+
"url": "http://juliangruber.com"
|
|
52
|
+
},
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/juliangruber/balanced-match/issues"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {},
|
|
57
|
+
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"matcha": "^0.7.0",
|
|
60
|
+
"tape": "^4.6.0"
|
|
61
|
+
},
|
|
62
|
+
"directories": {},
|
|
63
|
+
"dist": {
|
|
64
|
+
"shasum": "89b4d199ab2bee49de164ea02b89ce462d71b767",
|
|
65
|
+
"tarball": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz"
|
|
66
|
+
},
|
|
67
|
+
"gitHead": "d701a549a7653a874eebce7eca25d3577dc868ac",
|
|
68
|
+
"homepage": "https://github.com/juliangruber/balanced-match",
|
|
69
|
+
"keywords": [
|
|
70
|
+
"match",
|
|
71
|
+
"regexp",
|
|
72
|
+
"test",
|
|
73
|
+
"balanced",
|
|
74
|
+
"parse"
|
|
75
|
+
],
|
|
76
|
+
"license": "MIT",
|
|
77
|
+
"main": "index.js",
|
|
78
|
+
"maintainers": [
|
|
79
|
+
{
|
|
80
|
+
"name": "juliangruber",
|
|
81
|
+
"email": "julian@juliangruber.com"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"name": "balanced-match",
|
|
85
|
+
"optionalDependencies": {},
|
|
86
|
+
"readme": "ERROR: No README data found!",
|
|
87
|
+
"repository": {
|
|
88
|
+
"type": "git",
|
|
89
|
+
"url": "git://github.com/juliangruber/balanced-match.git"
|
|
90
|
+
},
|
|
91
|
+
"scripts": {
|
|
92
|
+
"bench": "make bench",
|
|
93
|
+
"test": "make test"
|
|
94
|
+
},
|
|
95
|
+
"testling": {
|
|
96
|
+
"files": "test/*.js",
|
|
97
|
+
"browsers": [
|
|
98
|
+
"ie/8..latest",
|
|
99
|
+
"firefox/20..latest",
|
|
100
|
+
"firefox/nightly",
|
|
101
|
+
"chrome/25..latest",
|
|
102
|
+
"chrome/canary",
|
|
103
|
+
"opera/12..latest",
|
|
104
|
+
"opera/next",
|
|
105
|
+
"safari/5.1..latest",
|
|
106
|
+
"ipad/6.0..latest",
|
|
107
|
+
"iphone/6.0..latest",
|
|
108
|
+
"android-browser/4.2..latest"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"version": "1.0.0"
|
|
112
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# brace-expansion
|
|
2
|
+
|
|
3
|
+
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
|
|
4
|
+
as known from sh/bash, in JavaScript.
|
|
5
|
+
|
|
6
|
+
[](http://travis-ci.org/juliangruber/brace-expansion)
|
|
7
|
+
[](https://www.npmjs.org/package/brace-expansion)
|
|
8
|
+
[](https://greenkeeper.io/)
|
|
9
|
+
|
|
10
|
+
[](https://ci.testling.com/juliangruber/brace-expansion)
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
var expand = require('brace-expansion');
|
|
16
|
+
|
|
17
|
+
expand('file-{a,b,c}.jpg')
|
|
18
|
+
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
|
19
|
+
|
|
20
|
+
expand('-v{,,}')
|
|
21
|
+
// => ['-v', '-v', '-v']
|
|
22
|
+
|
|
23
|
+
expand('file{0..2}.jpg')
|
|
24
|
+
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
|
|
25
|
+
|
|
26
|
+
expand('file-{a..c}.jpg')
|
|
27
|
+
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
|
28
|
+
|
|
29
|
+
expand('file{2..0}.jpg')
|
|
30
|
+
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
|
|
31
|
+
|
|
32
|
+
expand('file{0..4..2}.jpg')
|
|
33
|
+
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
|
|
34
|
+
|
|
35
|
+
expand('file-{a..e..2}.jpg')
|
|
36
|
+
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
|
|
37
|
+
|
|
38
|
+
expand('file{00..10..5}.jpg')
|
|
39
|
+
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
|
|
40
|
+
|
|
41
|
+
expand('{{A..C},{a..c}}')
|
|
42
|
+
// => ['A', 'B', 'C', 'a', 'b', 'c']
|
|
43
|
+
|
|
44
|
+
expand('ppp{,config,oe{,conf}}')
|
|
45
|
+
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## API
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
var expand = require('brace-expansion');
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### var expanded = expand(str)
|
|
55
|
+
|
|
56
|
+
Return an array of all possible and valid expansions of `str`. If none are
|
|
57
|
+
found, `[str]` is returned.
|
|
58
|
+
|
|
59
|
+
Valid expansions are:
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
/^(.*,)+(.+)?$/
|
|
63
|
+
// {a,b,...}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
A comma seperated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
|
70
|
+
// {x..y[..incr]}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
A numeric sequence from `x` to `y` inclusive, with optional increment.
|
|
74
|
+
If `x` or `y` start with a leading `0`, all the numbers will be padded
|
|
75
|
+
to have equal length. Negative numbers and backwards iteration work too.
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
|
79
|
+
// {x..y[..incr]}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
|
|
83
|
+
`x` and `y` must be exactly one character, and if given, `incr` must be a
|
|
84
|
+
number.
|
|
85
|
+
|
|
86
|
+
For compatibility reasons, the string `${` is not eligible for brace expansion.
|
|
87
|
+
|
|
88
|
+
## Installation
|
|
89
|
+
|
|
90
|
+
With [npm](https://npmjs.org) do:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npm install brace-expansion
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Contributors
|
|
97
|
+
|
|
98
|
+
- [Julian Gruber](https://github.com/juliangruber)
|
|
99
|
+
- [Isaac Z. Schlueter](https://github.com/isaacs)
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
(MIT)
|
|
104
|
+
|
|
105
|
+
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
106
|
+
|
|
107
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
108
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
109
|
+
the Software without restriction, including without limitation the rights to
|
|
110
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
111
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
112
|
+
so, subject to the following conditions:
|
|
113
|
+
|
|
114
|
+
The above copyright notice and this permission notice shall be included in all
|
|
115
|
+
copies or substantial portions of the Software.
|
|
116
|
+
|
|
117
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
118
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
119
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
120
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
121
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
122
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
123
|
+
SOFTWARE.
|