diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 0000000..aa485a7 --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,12 @@ +--- +engines: + coffeelint: + enabled: true + config: .config/coffeelint.json + fixme: + enabled: true +ratings: + paths: + - "src/**.coffee" +exclude_paths: +- test/ diff --git a/.config/coffeelint.json b/.config/coffeelint.json new file mode 100644 index 0000000..bd75cb7 --- /dev/null +++ b/.config/coffeelint.json @@ -0,0 +1,130 @@ +{ + "arrow_spacing": { + "level": "ignore" + }, + "braces_spacing": { + "level": "ignore", + "spaces": 0, + "empty_object_spaces": 0 + }, + "camel_case_classes": { + "level": "error" + }, + "coffeescript_error": { + "level": "error" + }, + "colon_assignment_spacing": { + "level": "ignore", + "spacing": { + "left": 0, + "right": 0 + } + }, + "cyclomatic_complexity": { + "value": 10, + "level": "ignore" + }, + "duplicate_key": { + "level": "error" + }, + "empty_constructor_needs_parens": { + "level": "ignore" + }, + "ensure_comprehensions": { + "level": "ignore" + }, + "eol_last": { + "level": "ignore" + }, + "indentation": { + "value": 1, + "use": "tabs", + "level": "ignore" + }, + "line_endings": { + "level": "ignore", + "value": "unix" + }, + "max_line_length": { + "value": 80, + "level": "ignore", + "limitComments": true + }, + "missing_fat_arrows": { + "level": "ignore", + "is_strict": false + }, + "newlines_after_classes": { + "value": 3, + "level": "ignore" + }, + "no_backticks": { + "level": "error" + }, + "no_debugger": { + "level": "ignore", + "console": false + }, + "no_empty_functions": { + "level": "ignore" + }, + "no_empty_param_list": { + "level": "ignore" + }, + "no_implicit_braces": { + "level": "ignore", + "strict": true + }, + "no_implicit_parens": { + "strict": true, + "level": "ignore" + }, + "no_interpolation_in_single_quotes": { + "level": "error" + }, + "no_plusplus": { + "level": "ignore" + }, + "no_stand_alone_at": { + "level": "ignore" + }, + "no_tabs": { + "level": "ignore" + }, + "no_this": { + "level": "error" + }, + "no_throwing_strings": { + "level": "error" + }, + "no_trailing_semicolons": { + "level": "ignore" + }, + "no_trailing_whitespace": { + "level": "ignore", + "allowed_in_comments": false, + "allowed_in_empty_lines": true + }, + "no_unnecessary_double_quotes": { + "level": "ignore" + }, + "no_unnecessary_fat_arrows": { + "level": "warn" + }, + "non_empty_constructor_needs_parens": { + "level": "ignore" + }, + "prefer_english_operator": { + "level": "ignore", + "doubleNotLevel": "ignore" + }, + "space_operators": { + "level": "ignore" + }, + "spacing_after_comma": { + "level": "ignore" + }, + "transform_messes_up_line_numbers": { + "level": "warn" + } +} diff --git a/.config/img/demo1.gif b/.config/img/demo1.gif new file mode 100644 index 0000000..427bdd9 Binary files /dev/null and b/.config/img/demo1.gif differ diff --git a/.config/img/demo2.gif b/.config/img/demo2.gif new file mode 100644 index 0000000..5aa2e19 Binary files /dev/null and b/.config/img/demo2.gif differ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1b7d08d --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +node_modules/ + +coverage/ + +config.codekit + +*.sublime-* + +data + +.codekit-cache + +*.sassc + +logfile + +logs/error.log + +*.log + +settings-db.json + +build/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..1bfa33e --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# inspector-on-demand +[![Code Climate](https://codeclimate.com/github/danielkalen/inspector-on-demand/badges/gpa.svg)](https://codeclimate.com/github/danielkalen/inspector-on-demand) +[![NPM](https://img.shields.io/npm/v/inspector-on-demand.svg)](https://npmjs.com/package/inspector-on-demand) +[![NPM](https://img.shields.io/npm/dm/inspector-on-demand.svg)](https://npmjs.com/package/inspector-on-demand) + +Launch v8 inspector/chrome-dev-tools on-demand for long-running apps. Requires node >= v8.0.0, otherwise dev + +## Demo +[![Demo 1](.config/img/demo1.png?raw=true)](https://github.com/danielkalen/inspector-on-demand) +[![Demo 2](.config/img/demo2.png?raw=true)](https://github.com/danielkalen/inspector-on-demand) + + +## Usage +Load the `inspector-on-demand` module at any point in your app using `require('inspector-on-demand')` and type any of the following commands in your terminal to launch the inspector: + +- `CTRL+Y` - activate inspector listener. This will not pause further script execution. +- `CTRL+U` - activate inspector listener and pause further script execution until inspector is open. +- `CTRL+X` - deactivate inspector listener. After this combo, the inspector cannot be re-enabled. + +Then launch chrome and navigate to `chrome://inspect` and launch the newly added remote target. If you are having trouble launching the inspector you might want to consider using [NiM Inspector Manager Chrome Extension](https://chrome.google.com/webstore/detail/nodejs-v8-inspector-manag/gnhhdgbaldcilmgcpfddgdbkhjohddkj?hl=en). + + + + + + + +## License +MIT © [Daniel Kalen](https://github.com/danielkalen) diff --git a/index.coffee b/index.coffee new file mode 100644 index 0000000..078ab4c --- /dev/null +++ b/index.coffee @@ -0,0 +1,20 @@ +term = require('terminal-kit').terminal +count = 0 + +setInterval ()-> + console.log 'count',require('chalk').red(count) +,2500 +term.grabInput() +term.on 'key', (name,matches,data)-> + if name is 'CTRL_C' + # process.exit() + ; + else + if name is 'CTRL_U' + console.log 'pressed CTRL_U' + count++ + term.grabInput(false) +# term.on 'CTRL_I', ()-> console.log 'CTRL_I!'; count++ +# term.on 'CTRL_F', ()-> console.log 'CTRL_F!'; count++ +# term.on 'T', ()-> console.log 'T!'; count++ + diff --git a/index.js b/index.js new file mode 100644 index 0000000..05004ba --- /dev/null +++ b/index.js @@ -0,0 +1,2 @@ +require('coffee-register'); +module.exports = require('./lib/index'); diff --git a/lib/index.coffee b/lib/index.coffee new file mode 100644 index 0000000..1fbf388 --- /dev/null +++ b/lib/index.coffee @@ -0,0 +1,43 @@ +nodeVersion = parseFloat process.version.slice(1) +supportsInspector = nodeVersion >= 8 +port = process.env.INSPECTOR_PORT +host = process.env.INSPECTOR_HOST + +if supportsInspector + term = require('terminal-kit').terminal + term.grabInput(true) + inspector = require 'inspector' + + term.on 'key', (key)-> + inspectorURL = inspector.url() + switch + when key is 'CTRL_C' + term.processExit() + + when (key is 'CTRL_Y' or key is 'CTRL_U') and inspectorURL + term.dim inspectorURL+'\n' + + when key is 'CTRL_Y' + inspector.open(port, host, false) + + when key is 'CTRL_U' + inspector.open(port, host, true) + + when key is 'CTRL_X' and inspectorURL + term.dim 'deactivating inspector\n' + inspector.close() + term.grabInput(false) + + +else if process.env.INSPECTOR_SUPPORT + console.warn " + inspector-on-demand is unsupported by your verison of node + (requires >=v8.0.0; current #{process.verison}) + " + + + + + + + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..c75b5a1 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,637 @@ +{ + "name": "inspector-on-demand", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@danielkalen/source-map-support": { + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/@danielkalen/source-map-support/-/source-map-support-0.4.16.tgz", + "integrity": "sha512-1lc1ptKNT+f6eS9FA7sJPAeqjM00xfwcEU6fBjVa6VLPI0pjGJHRoxBuA2ghQ16TyjilDnCxZb6dQl+WW54CKg==", + "requires": { + "source-map": "0.5.7" + } + }, + "ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "requires": { + "co": "4.6.0", + "json-stable-stringify": "1.0.1" + } + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" + }, + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=" + }, + "async-kit": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/async-kit/-/async-kit-2.2.3.tgz", + "integrity": "sha1-JkdRonndxfWbQZY4uAWuLEmFj7c=", + "requires": { + "nextgen-events": "0.9.9", + "tree-kit": "0.5.26" + }, + "dependencies": { + "nextgen-events": { + "version": "0.9.9", + "resolved": "https://registry.npmjs.org/nextgen-events/-/nextgen-events-0.9.9.tgz", + "integrity": "sha1-OaivxKK4RTiMV+LGu5cWcRmGo6A=" + } + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=" + }, + "aws4": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "requires": { + "hoek": "2.16.3" + } + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "coffee-register": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/coffee-register/-/coffee-register-0.1.2.tgz", + "integrity": "sha512-Orq2ehC280ZA1UL7cvRxn5WVSzKcDftTLKcU4SZ+p3WBJ1Rfxrd15pfMYqQbkXYE3WKG2Sb+aXrS8OaZSTtgxA==", + "requires": { + "@danielkalen/source-map-support": "0.4.16", + "coffee-script": "1.12.7", + "fs-jetpack": "0.13.3", + "md5": "2.2.1" + }, + "dependencies": { + "fs-jetpack": { + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/fs-jetpack/-/fs-jetpack-0.13.3.tgz", + "integrity": "sha1-nmxHEY8Ls9iAzIj5+KfSWGP0+xU=", + "requires": { + "minimatch": "3.0.4" + } + } + } + }, + "coffee-script": { + "version": "1.12.7", + "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz", + "integrity": "sha512-fLeEhqwymYat/MpTPUjSKHVYYl0ec2mOyALEMLmzr5i1isuG+6jfI2j2d5oBO3VIzgUXgBVIcOT9uH1TFxBckw==" + }, + "combined-stream": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "requires": { + "delayed-stream": "1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=" + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "requires": { + "boom": "2.10.1" + } + }, + "cwise-compiler": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/cwise-compiler/-/cwise-compiler-1.1.3.tgz", + "integrity": "sha1-9NZnQQ6FDToxOn0tt7HlBbsDTMU=", + "requires": { + "uniq": "1.0.1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "data-uri-to-buffer": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-0.0.3.tgz", + "integrity": "sha1-GK6XmmoMqZSwYlhTkW0mYruuCxo=" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.17" + } + }, + "get-pixels": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/get-pixels/-/get-pixels-3.3.0.tgz", + "integrity": "sha1-jZeVvq4YhQuED3SVgbrcBdPjbkE=", + "requires": { + "data-uri-to-buffer": "0.0.3", + "jpeg-js": "0.1.2", + "mime-types": "2.1.17", + "ndarray": "1.0.18", + "ndarray-pack": "1.2.1", + "node-bitmap": "0.0.1", + "omggif": "1.0.8", + "parse-data-uri": "0.2.0", + "pngjs": "2.3.1", + "request": "2.81.0", + "through": "2.3.8" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "har-schema": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", + "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=" + }, + "har-validator": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", + "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", + "requires": { + "ajv": "4.11.8", + "har-schema": "1.0.5" + } + }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "requires": { + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" + } + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "requires": { + "assert-plus": "0.2.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } + }, + "iota-array": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/iota-array/-/iota-array-1.0.0.tgz", + "integrity": "sha1-ge9X/l0FgUzVjCSDYyqZwwoOgIc=" + }, + "is-buffer": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", + "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jpeg-js": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.1.2.tgz", + "integrity": "sha1-E1uZLAV1yYXPoPSUoyJ+0jhYPs4=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "requires": { + "jsonify": "0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "md5": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz", + "integrity": "sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=", + "requires": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "1.1.5" + } + }, + "mime-db": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=" + }, + "mime-types": { + "version": "2.1.17", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", + "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", + "requires": { + "mime-db": "1.30.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "1.1.8" + } + }, + "ndarray": { + "version": "1.0.18", + "resolved": "https://registry.npmjs.org/ndarray/-/ndarray-1.0.18.tgz", + "integrity": "sha1-tg06cyJOxVXQ+qeXEeUCRI/T95M=", + "requires": { + "iota-array": "1.0.0", + "is-buffer": "1.1.5" + } + }, + "ndarray-pack": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ndarray-pack/-/ndarray-pack-1.2.1.tgz", + "integrity": "sha1-jK6+qqJNXs9w/4YCBjeXfajuWFo=", + "requires": { + "cwise-compiler": "1.1.3", + "ndarray": "1.0.18" + } + }, + "nextgen-events": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/nextgen-events/-/nextgen-events-0.10.0.tgz", + "integrity": "sha1-9H1NIOwRS/mfSPjEmujUq2Ni7s0=" + }, + "node-bitmap": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/node-bitmap/-/node-bitmap-0.0.1.tgz", + "integrity": "sha1-GA6scAPgxwdhjvMTaPYvhLKmkJE=" + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + }, + "omggif": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.8.tgz", + "integrity": "sha1-F483sqsLPXtG7ToORr0HkLWNNTA=" + }, + "parse-data-uri": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/parse-data-uri/-/parse-data-uri-0.2.0.tgz", + "integrity": "sha1-vwTYUd1ch7CrI45dAazklLYEtMk=", + "requires": { + "data-uri-to-buffer": "0.0.3" + } + }, + "performance-now": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", + "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=" + }, + "pngjs": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-2.3.1.tgz", + "integrity": "sha1-EdHhK5y2TWPjDBQ6Mw9MH1Z9qF8=" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", + "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=" + }, + "request": { + "version": "2.81.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", + "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.1.4", + "har-validator": "4.2.1", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.17", + "oauth-sign": "0.8.2", + "performance-now": "0.2.0", + "qs": "6.4.0", + "safe-buffer": "5.1.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.2", + "tunnel-agent": "0.6.0", + "uuid": "3.1.0" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "requires": { + "hoek": "2.16.3" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + }, + "sshpk": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", + "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "string-kit": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/string-kit/-/string-kit-0.6.1.tgz", + "integrity": "sha512-TSdRAi2iLv8huO77ZXThDkOn9o7Y+XSLVeNzmh2Y/GG/wQFdOIsA8LPVph0YelRvsMKkTnLGd/U9Vrxofk5edQ==", + "requires": { + "xregexp": "3.2.0" + } + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" + }, + "terminal-kit": { + "version": "1.13.11", + "resolved": "https://registry.npmjs.org/terminal-kit/-/terminal-kit-1.13.11.tgz", + "integrity": "sha512-LkMsBIvS/ePRfvJ2IOfWHDtPunneJ01xuKxPFL6SE5oza7mlPZ/b5wm+xP4/d0PeQAaBqXPjHn1DHG2jpbpQpQ==", + "requires": { + "async-kit": "2.2.3", + "get-pixels": "3.3.0", + "ndarray": "1.0.18", + "nextgen-events": "0.10.0", + "string-kit": "0.6.1", + "tree-kit": "0.5.26" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "tough-cookie": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", + "integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", + "requires": { + "punycode": "1.4.1" + } + }, + "tree-kit": { + "version": "0.5.26", + "resolved": "https://registry.npmjs.org/tree-kit/-/tree-kit-0.5.26.tgz", + "integrity": "sha1-hXHIb6JNHbdU5bDLOn4J9B50qN8=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "5.1.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "uniq": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", + "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=" + }, + "uuid": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", + "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "xregexp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-3.2.0.tgz", + "integrity": "sha1-yzYBmHv+JpW1hAAMGPHEqMMih44=" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..59d0bbe --- /dev/null +++ b/package.json @@ -0,0 +1,27 @@ +{ + "name": "inspector-on-demand", + "version": "1.0.0", + "description": "Launch v8 inspector/devtools on demand for long-running apps", + "main": "index.js", + "engines": { + "node": ">=8.0.0" + }, + "mocha_opts": "-u tdd --compilers coffee:coffee-script/register --slow 1000 --timeout 5000", + "scripts": { + "postversion": "git add . && git commit -a -m '[Build]'", + "postpublish": "git push", + "test": "echo 'N/A'" + }, + "author": "danielkalen", + "repository": { + "type": "git", + "url": "https://github.com/danielkalen/inspector-on-demand" + }, + "license": "ISC", + "devDependencies": {}, + "dependencies": { + "coffee-register": "^0.1.2", + "coffee-script": "^1.12.7", + "terminal-kit": "^1.13.11" + } +} diff --git a/test/demo.js b/test/demo.js new file mode 100644 index 0000000..59c76fd --- /dev/null +++ b/test/demo.js @@ -0,0 +1,6 @@ +var startTime = Date.now(); +require('inspector-on-demand'); + +setInterval(function(){ + console.log(`${Date.now() - startTime}ms passed`); +}, 1000); diff --git a/test/test.coffee b/test/test.coffee new file mode 100644 index 0000000..104d697 --- /dev/null +++ b/test/test.coffee @@ -0,0 +1,6 @@ +startTime = Date.now() +require '../' + +setInterval ()-> + console.log "#{Date.now() - startTime}ms passed" +, 1e3 \ No newline at end of file