dragonfly_chrome_headless 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,15 @@
|
|
1
|
+
The ISC License
|
2
|
+
|
3
|
+
Copyright (c) Isaac Z. Schlueter
|
4
|
+
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
15
|
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# inflight
|
2
|
+
|
3
|
+
Add callbacks to requests in flight to avoid async duplication
|
4
|
+
|
5
|
+
## USAGE
|
6
|
+
|
7
|
+
```javascript
|
8
|
+
var inflight = require('inflight')
|
9
|
+
|
10
|
+
// some request that does some stuff
|
11
|
+
function req(key, callback) {
|
12
|
+
// key is any random string. like a url or filename or whatever.
|
13
|
+
//
|
14
|
+
// will return either a falsey value, indicating that the
|
15
|
+
// request for this key is already in flight, or a new callback
|
16
|
+
// which when called will call all callbacks passed to inflightk
|
17
|
+
// with the same key
|
18
|
+
callback = inflight(key, callback)
|
19
|
+
|
20
|
+
// If we got a falsey value back, then there's already a req going
|
21
|
+
if (!callback) return
|
22
|
+
|
23
|
+
// this is where you'd fetch the url or whatever
|
24
|
+
// callback is also once()-ified, so it can safely be assigned
|
25
|
+
// to multiple events etc. First call wins.
|
26
|
+
setTimeout(function() {
|
27
|
+
callback(null, key)
|
28
|
+
}, 100)
|
29
|
+
}
|
30
|
+
|
31
|
+
// only assigns a single setTimeout
|
32
|
+
// when it dings, all cbs get called
|
33
|
+
req('foo', cb1)
|
34
|
+
req('foo', cb2)
|
35
|
+
req('foo', cb3)
|
36
|
+
req('foo', cb4)
|
37
|
+
```
|
@@ -0,0 +1,54 @@
|
|
1
|
+
var wrappy = require('wrappy')
|
2
|
+
var reqs = Object.create(null)
|
3
|
+
var once = require('once')
|
4
|
+
|
5
|
+
module.exports = wrappy(inflight)
|
6
|
+
|
7
|
+
function inflight (key, cb) {
|
8
|
+
if (reqs[key]) {
|
9
|
+
reqs[key].push(cb)
|
10
|
+
return null
|
11
|
+
} else {
|
12
|
+
reqs[key] = [cb]
|
13
|
+
return makeres(key)
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
function makeres (key) {
|
18
|
+
return once(function RES () {
|
19
|
+
var cbs = reqs[key]
|
20
|
+
var len = cbs.length
|
21
|
+
var args = slice(arguments)
|
22
|
+
|
23
|
+
// XXX It's somewhat ambiguous whether a new callback added in this
|
24
|
+
// pass should be queued for later execution if something in the
|
25
|
+
// list of callbacks throws, or if it should just be discarded.
|
26
|
+
// However, it's such an edge case that it hardly matters, and either
|
27
|
+
// choice is likely as surprising as the other.
|
28
|
+
// As it happens, we do go ahead and schedule it for later execution.
|
29
|
+
try {
|
30
|
+
for (var i = 0; i < len; i++) {
|
31
|
+
cbs[i].apply(null, args)
|
32
|
+
}
|
33
|
+
} finally {
|
34
|
+
if (cbs.length > len) {
|
35
|
+
// added more in the interim.
|
36
|
+
// de-zalgo, just in case, but don't call again.
|
37
|
+
cbs.splice(0, len)
|
38
|
+
process.nextTick(function () {
|
39
|
+
RES.apply(null, args)
|
40
|
+
})
|
41
|
+
} else {
|
42
|
+
delete reqs[key]
|
43
|
+
}
|
44
|
+
}
|
45
|
+
})
|
46
|
+
}
|
47
|
+
|
48
|
+
function slice (args) {
|
49
|
+
var length = args.length
|
50
|
+
var array = []
|
51
|
+
|
52
|
+
for (var i = 0; i < length; i++) array[i] = args[i]
|
53
|
+
return array
|
54
|
+
}
|
@@ -0,0 +1,105 @@
|
|
1
|
+
{
|
2
|
+
"_args": [
|
3
|
+
[
|
4
|
+
{
|
5
|
+
"raw": "inflight@^1.0.4",
|
6
|
+
"scope": null,
|
7
|
+
"escapedName": "inflight",
|
8
|
+
"name": "inflight",
|
9
|
+
"rawSpec": "^1.0.4",
|
10
|
+
"spec": ">=1.0.4 <2.0.0",
|
11
|
+
"type": "range"
|
12
|
+
},
|
13
|
+
"/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/glob"
|
14
|
+
]
|
15
|
+
],
|
16
|
+
"_from": "inflight@>=1.0.4 <2.0.0",
|
17
|
+
"_id": "inflight@1.0.6",
|
18
|
+
"_inCache": true,
|
19
|
+
"_location": "/inflight",
|
20
|
+
"_nodeVersion": "6.5.0",
|
21
|
+
"_npmOperationalInternal": {
|
22
|
+
"host": "packages-16-east.internal.npmjs.com",
|
23
|
+
"tmp": "tmp/inflight-1.0.6.tgz_1476330807696_0.10388551792129874"
|
24
|
+
},
|
25
|
+
"_npmUser": {
|
26
|
+
"name": "isaacs",
|
27
|
+
"email": "i@izs.me"
|
28
|
+
},
|
29
|
+
"_npmVersion": "3.10.7",
|
30
|
+
"_phantomChildren": {},
|
31
|
+
"_requested": {
|
32
|
+
"raw": "inflight@^1.0.4",
|
33
|
+
"scope": null,
|
34
|
+
"escapedName": "inflight",
|
35
|
+
"name": "inflight",
|
36
|
+
"rawSpec": "^1.0.4",
|
37
|
+
"spec": ">=1.0.4 <2.0.0",
|
38
|
+
"type": "range"
|
39
|
+
},
|
40
|
+
"_requiredBy": [
|
41
|
+
"/glob"
|
42
|
+
],
|
43
|
+
"_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
44
|
+
"_shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9",
|
45
|
+
"_shrinkwrap": null,
|
46
|
+
"_spec": "inflight@^1.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/inflight/issues"
|
55
|
+
},
|
56
|
+
"dependencies": {
|
57
|
+
"once": "^1.3.0",
|
58
|
+
"wrappy": "1"
|
59
|
+
},
|
60
|
+
"description": "Add callbacks to requests in flight to avoid async duplication",
|
61
|
+
"devDependencies": {
|
62
|
+
"tap": "^7.1.2"
|
63
|
+
},
|
64
|
+
"directories": {},
|
65
|
+
"dist": {
|
66
|
+
"shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9",
|
67
|
+
"tarball": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz"
|
68
|
+
},
|
69
|
+
"files": [
|
70
|
+
"inflight.js"
|
71
|
+
],
|
72
|
+
"gitHead": "a547881738c8f57b27795e584071d67cf6ac1a57",
|
73
|
+
"homepage": "https://github.com/isaacs/inflight",
|
74
|
+
"license": "ISC",
|
75
|
+
"main": "inflight.js",
|
76
|
+
"maintainers": [
|
77
|
+
{
|
78
|
+
"name": "iarna",
|
79
|
+
"email": "me@re-becca.org"
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"name": "isaacs",
|
83
|
+
"email": "i@izs.me"
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"name": "othiym23",
|
87
|
+
"email": "ogd@aoaioxxysz.net"
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"name": "zkat",
|
91
|
+
"email": "kat@sykosomatic.org"
|
92
|
+
}
|
93
|
+
],
|
94
|
+
"name": "inflight",
|
95
|
+
"optionalDependencies": {},
|
96
|
+
"readme": "ERROR: No README data found!",
|
97
|
+
"repository": {
|
98
|
+
"type": "git",
|
99
|
+
"url": "git+https://github.com/npm/inflight.git"
|
100
|
+
},
|
101
|
+
"scripts": {
|
102
|
+
"test": "tap test.js --100"
|
103
|
+
},
|
104
|
+
"version": "1.0.6"
|
105
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
The ISC License
|
2
|
+
|
3
|
+
Copyright (c) Isaac Z. Schlueter
|
4
|
+
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
11
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
16
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Browser-friendly inheritance fully compatible with standard node.js
|
2
|
+
[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).
|
3
|
+
|
4
|
+
This package exports standard `inherits` from node.js `util` module in
|
5
|
+
node environment, but also provides alternative browser-friendly
|
6
|
+
implementation through [browser
|
7
|
+
field](https://gist.github.com/shtylman/4339901). Alternative
|
8
|
+
implementation is a literal copy of standard one located in standalone
|
9
|
+
module to avoid requiring of `util`. It also has a shim for old
|
10
|
+
browsers with no `Object.create` support.
|
11
|
+
|
12
|
+
While keeping you sure you are using standard `inherits`
|
13
|
+
implementation in node.js environment, it allows bundlers such as
|
14
|
+
[browserify](https://github.com/substack/node-browserify) to not
|
15
|
+
include full `util` package to your client code if all you need is
|
16
|
+
just `inherits` function. It worth, because browser shim for `util`
|
17
|
+
package is large and `inherits` is often the single function you need
|
18
|
+
from it.
|
19
|
+
|
20
|
+
It's recommended to use this package instead of
|
21
|
+
`require('util').inherits` for any code that has chances to be used
|
22
|
+
not only in node.js but in browser too.
|
23
|
+
|
24
|
+
## usage
|
25
|
+
|
26
|
+
```js
|
27
|
+
var inherits = require('inherits');
|
28
|
+
// then use exactly as the standard one
|
29
|
+
```
|
30
|
+
|
31
|
+
## note on version ~1.0
|
32
|
+
|
33
|
+
Version ~1.0 had completely different motivation and is not compatible
|
34
|
+
neither with 2.0 nor with standard node.js `inherits`.
|
35
|
+
|
36
|
+
If you are using version ~1.0 and planning to switch to ~2.0, be
|
37
|
+
careful:
|
38
|
+
|
39
|
+
* new version uses `super_` instead of `super` for referencing
|
40
|
+
superclass
|
41
|
+
* new version overwrites current prototype while old one preserves any
|
42
|
+
existing fields on it
|
@@ -0,0 +1,23 @@
|
|
1
|
+
if (typeof Object.create === 'function') {
|
2
|
+
// implementation from standard node.js 'util' module
|
3
|
+
module.exports = function inherits(ctor, superCtor) {
|
4
|
+
ctor.super_ = superCtor
|
5
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
6
|
+
constructor: {
|
7
|
+
value: ctor,
|
8
|
+
enumerable: false,
|
9
|
+
writable: true,
|
10
|
+
configurable: true
|
11
|
+
}
|
12
|
+
});
|
13
|
+
};
|
14
|
+
} else {
|
15
|
+
// old school shim for old browsers
|
16
|
+
module.exports = function inherits(ctor, superCtor) {
|
17
|
+
ctor.super_ = superCtor
|
18
|
+
var TempCtor = function () {}
|
19
|
+
TempCtor.prototype = superCtor.prototype
|
20
|
+
ctor.prototype = new TempCtor()
|
21
|
+
ctor.prototype.constructor = ctor
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,97 @@
|
|
1
|
+
{
|
2
|
+
"_args": [
|
3
|
+
[
|
4
|
+
{
|
5
|
+
"raw": "inherits@2",
|
6
|
+
"scope": null,
|
7
|
+
"escapedName": "inherits",
|
8
|
+
"name": "inherits",
|
9
|
+
"rawSpec": "2",
|
10
|
+
"spec": ">=2.0.0 <3.0.0",
|
11
|
+
"type": "range"
|
12
|
+
},
|
13
|
+
"/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/glob"
|
14
|
+
]
|
15
|
+
],
|
16
|
+
"_from": "inherits@>=2.0.0 <3.0.0",
|
17
|
+
"_id": "inherits@2.0.3",
|
18
|
+
"_inCache": true,
|
19
|
+
"_location": "/inherits",
|
20
|
+
"_nodeVersion": "6.5.0",
|
21
|
+
"_npmOperationalInternal": {
|
22
|
+
"host": "packages-16-east.internal.npmjs.com",
|
23
|
+
"tmp": "tmp/inherits-2.0.3.tgz_1473295776489_0.08142363070510328"
|
24
|
+
},
|
25
|
+
"_npmUser": {
|
26
|
+
"name": "isaacs",
|
27
|
+
"email": "i@izs.me"
|
28
|
+
},
|
29
|
+
"_npmVersion": "3.10.7",
|
30
|
+
"_phantomChildren": {},
|
31
|
+
"_requested": {
|
32
|
+
"raw": "inherits@2",
|
33
|
+
"scope": null,
|
34
|
+
"escapedName": "inherits",
|
35
|
+
"name": "inherits",
|
36
|
+
"rawSpec": "2",
|
37
|
+
"spec": ">=2.0.0 <3.0.0",
|
38
|
+
"type": "range"
|
39
|
+
},
|
40
|
+
"_requiredBy": [
|
41
|
+
"/glob"
|
42
|
+
],
|
43
|
+
"_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
44
|
+
"_shasum": "633c2c83e3da42a502f52466022480f4208261de",
|
45
|
+
"_shrinkwrap": null,
|
46
|
+
"_spec": "inherits@2",
|
47
|
+
"_where": "/Users/tomascelizna/Devel/dragonfly_chrome_headless/node_modules/glob",
|
48
|
+
"browser": "./inherits_browser.js",
|
49
|
+
"bugs": {
|
50
|
+
"url": "https://github.com/isaacs/inherits/issues"
|
51
|
+
},
|
52
|
+
"dependencies": {},
|
53
|
+
"description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
|
54
|
+
"devDependencies": {
|
55
|
+
"tap": "^7.1.0"
|
56
|
+
},
|
57
|
+
"directories": {},
|
58
|
+
"dist": {
|
59
|
+
"shasum": "633c2c83e3da42a502f52466022480f4208261de",
|
60
|
+
"tarball": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"
|
61
|
+
},
|
62
|
+
"files": [
|
63
|
+
"inherits.js",
|
64
|
+
"inherits_browser.js"
|
65
|
+
],
|
66
|
+
"gitHead": "e05d0fb27c61a3ec687214f0476386b765364d5f",
|
67
|
+
"homepage": "https://github.com/isaacs/inherits#readme",
|
68
|
+
"keywords": [
|
69
|
+
"inheritance",
|
70
|
+
"class",
|
71
|
+
"klass",
|
72
|
+
"oop",
|
73
|
+
"object-oriented",
|
74
|
+
"inherits",
|
75
|
+
"browser",
|
76
|
+
"browserify"
|
77
|
+
],
|
78
|
+
"license": "ISC",
|
79
|
+
"main": "./inherits.js",
|
80
|
+
"maintainers": [
|
81
|
+
{
|
82
|
+
"name": "isaacs",
|
83
|
+
"email": "i@izs.me"
|
84
|
+
}
|
85
|
+
],
|
86
|
+
"name": "inherits",
|
87
|
+
"optionalDependencies": {},
|
88
|
+
"readme": "ERROR: No README data found!",
|
89
|
+
"repository": {
|
90
|
+
"type": "git",
|
91
|
+
"url": "git://github.com/isaacs/inherits.git"
|
92
|
+
},
|
93
|
+
"scripts": {
|
94
|
+
"test": "node test"
|
95
|
+
},
|
96
|
+
"version": "2.0.3"
|
97
|
+
}
|
@@ -0,0 +1,212 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright 2016 Google Inc. All Rights Reserved.
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
5
|
+
*/
|
6
|
+
'use strict';
|
7
|
+
|
8
|
+
const debug = require('debug');
|
9
|
+
const EventEmitter = require('events').EventEmitter;
|
10
|
+
const isWindows = process.platform === 'win32';
|
11
|
+
|
12
|
+
// process.browser is set when browserify'd via the `process` npm module
|
13
|
+
const isBrowser = process.browser;
|
14
|
+
|
15
|
+
const colors = {
|
16
|
+
red: isBrowser ? 'crimson' : 1,
|
17
|
+
yellow: isBrowser ? 'gold' : 3,
|
18
|
+
cyan: isBrowser ? 'darkturquoise' : 6,
|
19
|
+
green: isBrowser ? 'forestgreen' : 2,
|
20
|
+
blue: isBrowser ? 'steelblue' : 4,
|
21
|
+
magenta: isBrowser ? 'palevioletred' : 5
|
22
|
+
};
|
23
|
+
|
24
|
+
// whitelist non-red/yellow colors for debug()
|
25
|
+
debug.colors = [colors.cyan, colors.green, colors.blue, colors.magenta];
|
26
|
+
|
27
|
+
class Emitter extends EventEmitter {
|
28
|
+
/**
|
29
|
+
* Fires off all status updates. Listen with
|
30
|
+
* `require('lib/log').events.addListener('status', callback)`
|
31
|
+
* @param {string} title
|
32
|
+
* @param {!Array<*>} argsArray
|
33
|
+
*/
|
34
|
+
issueStatus(title, argsArray) {
|
35
|
+
if (title === 'status' || title === 'statusEnd') {
|
36
|
+
this.emit(title, [title, ...argsArray]);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Fires off all warnings. Listen with
|
42
|
+
* `require('lib/log').events.addListener('warning', callback)`
|
43
|
+
* @param {string} title
|
44
|
+
* @param {!Array<*>} argsArray
|
45
|
+
*/
|
46
|
+
issueWarning(title, argsArray) {
|
47
|
+
this.emit('warning', [title, ...argsArray]);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
const loggersByTitle = {};
|
52
|
+
const loggingBufferColumns = 25;
|
53
|
+
|
54
|
+
class Log {
|
55
|
+
|
56
|
+
static _logToStdErr(title, argsArray) {
|
57
|
+
const log = Log.loggerfn(title);
|
58
|
+
log(...argsArray);
|
59
|
+
}
|
60
|
+
|
61
|
+
static loggerfn(title) {
|
62
|
+
let log = loggersByTitle[title];
|
63
|
+
if (!log) {
|
64
|
+
log = debug(title);
|
65
|
+
loggersByTitle[title] = log;
|
66
|
+
// errors with red, warnings with yellow.
|
67
|
+
if (title.endsWith('error')) {
|
68
|
+
log.color = colors.red;
|
69
|
+
} else if (title.endsWith('warn')) {
|
70
|
+
log.color = colors.yellow;
|
71
|
+
}
|
72
|
+
}
|
73
|
+
return log;
|
74
|
+
}
|
75
|
+
|
76
|
+
static setLevel(level) {
|
77
|
+
switch (level) {
|
78
|
+
case 'silent':
|
79
|
+
debug.enable('-*');
|
80
|
+
break;
|
81
|
+
case 'verbose':
|
82
|
+
debug.enable('*');
|
83
|
+
break;
|
84
|
+
case 'error':
|
85
|
+
debug.enable('-*, *:error');
|
86
|
+
break;
|
87
|
+
default:
|
88
|
+
debug.enable('*, -*:verbose');
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
/**
|
93
|
+
* A simple formatting utility for event logging.
|
94
|
+
* @param {string} prefix
|
95
|
+
* @param {!Object} data A JSON-serializable object of event data to log.
|
96
|
+
* @param {string=} level Optional logging level. Defaults to 'log'.
|
97
|
+
*/
|
98
|
+
static formatProtocol(prefix, data, level) {
|
99
|
+
const columns = (!process || process.browser) ? Infinity : process.stdout.columns;
|
100
|
+
const method = data.method || '?????';
|
101
|
+
const maxLength = columns - method.length - prefix.length - loggingBufferColumns;
|
102
|
+
// IO.read blacklisted here to avoid logging megabytes of trace data
|
103
|
+
const snippet = (data.params && method !== 'IO.read') ?
|
104
|
+
JSON.stringify(data.params).substr(0, maxLength) : '';
|
105
|
+
Log._logToStdErr(`${prefix}:${level || ''}`, [method, snippet]);
|
106
|
+
}
|
107
|
+
|
108
|
+
static log(title, ...args) {
|
109
|
+
Log.events.issueStatus(title, args);
|
110
|
+
return Log._logToStdErr(title, args);
|
111
|
+
}
|
112
|
+
|
113
|
+
static warn(title, ...args) {
|
114
|
+
Log.events.issueWarning(title, args);
|
115
|
+
return Log._logToStdErr(`${title}:warn`, args);
|
116
|
+
}
|
117
|
+
|
118
|
+
static error(title, ...args) {
|
119
|
+
return Log._logToStdErr(`${title}:error`, args);
|
120
|
+
}
|
121
|
+
|
122
|
+
static verbose(title, ...args) {
|
123
|
+
Log.events.issueStatus(title, args);
|
124
|
+
return Log._logToStdErr(`${title}:verbose`, args);
|
125
|
+
}
|
126
|
+
|
127
|
+
/**
|
128
|
+
* Add surrounding escape sequences to turn a string green when logged.
|
129
|
+
* @param {string} str
|
130
|
+
* @return {string}
|
131
|
+
*/
|
132
|
+
static greenify(str) {
|
133
|
+
return `${Log.green}${str}${Log.reset}`;
|
134
|
+
}
|
135
|
+
|
136
|
+
/**
|
137
|
+
* Add surrounding escape sequences to turn a string red when logged.
|
138
|
+
* @param {string} str
|
139
|
+
* @return {string}
|
140
|
+
*/
|
141
|
+
static redify(str) {
|
142
|
+
return `${Log.red}${str}${Log.reset}`;
|
143
|
+
}
|
144
|
+
|
145
|
+
static get green() {
|
146
|
+
return '\x1B[32m';
|
147
|
+
}
|
148
|
+
|
149
|
+
static get red() {
|
150
|
+
return '\x1B[31m';
|
151
|
+
}
|
152
|
+
|
153
|
+
static get yellow() {
|
154
|
+
return '\x1b[33m';
|
155
|
+
}
|
156
|
+
|
157
|
+
static get purple() {
|
158
|
+
return '\x1b[95m';
|
159
|
+
}
|
160
|
+
|
161
|
+
static get reset() {
|
162
|
+
return '\x1B[0m';
|
163
|
+
}
|
164
|
+
|
165
|
+
static get bold() {
|
166
|
+
return '\x1b[1m';
|
167
|
+
}
|
168
|
+
|
169
|
+
static get dim() {
|
170
|
+
return '\x1b[2m';
|
171
|
+
}
|
172
|
+
|
173
|
+
static get tick() {
|
174
|
+
return isWindows ? '\u221A' : '✓';
|
175
|
+
}
|
176
|
+
|
177
|
+
static get cross() {
|
178
|
+
return isWindows ? '\u00D7' : '✘';
|
179
|
+
}
|
180
|
+
|
181
|
+
static get whiteSmallSquare() {
|
182
|
+
return isWindows ? '\u0387' : '▫';
|
183
|
+
}
|
184
|
+
|
185
|
+
static get heavyHorizontal() {
|
186
|
+
return isWindows ? '\u2500' : '━';
|
187
|
+
}
|
188
|
+
|
189
|
+
static get heavyVertical() {
|
190
|
+
return isWindows ? '\u2502 ' : '┃ ';
|
191
|
+
}
|
192
|
+
|
193
|
+
static get heavyUpAndRight() {
|
194
|
+
return isWindows ? '\u2514' : '┗';
|
195
|
+
}
|
196
|
+
|
197
|
+
static get heavyVerticalAndRight() {
|
198
|
+
return isWindows ? '\u251C' : '┣';
|
199
|
+
}
|
200
|
+
|
201
|
+
static get heavyDownAndHorizontal() {
|
202
|
+
return isWindows ? '\u252C' : '┳';
|
203
|
+
}
|
204
|
+
|
205
|
+
static get doubleLightHorizontal() {
|
206
|
+
return '──';
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
Log.events = new Emitter();
|
211
|
+
|
212
|
+
module.exports = Log;
|