{"name":"inspector-proxy","version":"0.3.0","description":"node inspector proxy","bin":{"inspector-proxy":"bin/bin.js"},"dependencies":{"cfork":"^1.6.1","co":"^4.6.0","opn":"^5.1.0","tcp-proxy.js":"^1.0.5","urllib":"^2.24.0"},"devDependencies":{"autod":"^2.8.0","coffee":"^4.1.0","cross-spawn":"^5.1.0","egg-bin":"^3.4.0","egg-ci":"^1.7.0","eslint":"^4.0.0","eslint-config-egg":"^4.2.0","nyc":"^11.2.1","webstorm-disable-index":"^1.2.0","ws":"^3.1.0"},"engines":{"node":">=6.0.0"},"scripts":{"autod":"autod","lint":"eslint .","test":"npm run lint -- --fix && egg-bin pkgfiles && npm run test-local","test-local":"egg-bin test","cov":"nyc -r json -r lcov -r text-summary npm test","ci":"npm run lint && egg-bin pkgfiles --check && npm run cov","pkgfiles":"egg-bin pkgfiles"},"ci":{"version":"6, 8"},"repository":{"type":"git","url":"git+https://github.com/whxaxes/inspector-proxy.git"},"bugs":{"url":"https://github.com/whxaxes/inspector-proxy/issues"},"homepage":"https://github.com/whxaxes/inspector-proxy#readme","files":["index.js","bin"],"author":{"name":"wanghx"},"license":"MIT","gitHead":"2031c7b776a4663d5927f6e95e64dbb68c2e68d3","_id":"inspector-proxy@0.3.0","_shasum":"ad5c24533be638ba577577cca5a455dbab604efb","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"wanghx","email":"whxaxes@gmail.com"},"dist":{"shasum":"ad5c24533be638ba577577cca5a455dbab604efb","tarball":"http://registry-npm.ywwl.com/inspector-proxy/download/inspector-proxy-0.3.0.tgz","integrity":"sha512-+P2hc3VtCyigdaoeimLP4QRb+cEuHZFonQp80Nj7scjrdWAaAO3YzcErfHXlnfm7+pFKpeSRUlU26L0z/VNmtA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC9adkledGGU7PvPtDtozfy5sGFxT2F4zPOIwimVVQ0LwIgTlMk03oRID53SGfP79lIzsW8GVR3E4GlzBrRug4z3+k="}],"size":2899,"noattachment":false,"key":"/inspector-proxy/-/inspector-proxy-0.3.0.tgz"},"maintainers":[{"name":"wanghx","email":"whxaxes@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/inspector-proxy-0.3.0.tgz_1504944327718_0.09177649114280939"},"directories":{},"readme":"# inspector-proxy\n\nnode inspector proxy\n\n[![NPM version][npm-image]][npm-url]\n[![Build Status][travis-image]][travis-url]\n[![Appveyor status][appveyor-image]][appveyor-url]\n[![Coverage Status][coveralls-image]][coveralls-url]\n\n[npm-image]: https://img.shields.io/npm/v/inspector-proxy.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/inspector-proxy\n[travis-url]: https://travis-ci.org/whxaxes/inspector-proxy\n[travis-image]: http://img.shields.io/travis/whxaxes/inspector-proxy.svg\n[appveyor-url]: https://ci.appveyor.com/project/whxaxes/inspector-proxy/branch/master\n[appveyor-image]: https://ci.appveyor.com/api/projects/status/github/whxaxes/inspector-proxy?branch=master&svg=true\n[coveralls-url]: https://coveralls.io/r/whxaxes/inspector-proxy\n[coveralls-image]: https://img.shields.io/coveralls/whxaxes/inspector-proxy.svg\n\n## Usage\n\n```bash\n$ npm i inspector-proxy -g\n```\n\nCLI\n\n```bash\n# base usage\n$ inspector-proxy ./test.js\n\n# appoint port\n$ inspector-proxy --proxy=9228 --debug=9888 ./test.js\n```\n\n```bash\n# exec by node\n$ node --inspect ./test.js\n\n# start a inspect proxy in other terminal\n$ inspector-proxy --proxy=9228\n```\n\nwork with `nodemon`\n\n```bash\n$ nodemon --exec 'inspector-proxy ./test.js'\n```\n\nUsing in code\n\n```js\nconst InspectorProxy = require('inspector-proxy');\nconst cfork = require('cfork');\nconst proxy = new InspectorProxy({ port: 9229 });\n\n// use cfork to inspect file\ncfork({\n  exec: './test.js',\n  execArgv: [ '--inspect' ],\n  count: 1,\n  refork: true,\n}).on('fork', worker => {\n  let port;\n  // match debug port from argv\n  worker.process.spawnargs\n    .some(arg => {\n      let matches;\n      // node-6: --inspect=9888\n      // node-8: --inspect-port=9888\n      if (arg.startsWith('--inspect') && (matches = arg.match(/\\d+/))) {\n        port = matches[0];\n        return true;\n      }\n      return false;\n    });\n\n  proxy.start({ debugPort: port })\n    .then(() => {\n      console.log(`\\nproxy url: ${proxy.url}\\n`);\n    });\n});\n```\n\n## Log Explanation\n\n```bash\n# inspector server opened\n9229 opened\n\n# inspector server closed\n9229 closed\n\n# inspector has been attached\nDebugger attached\n```\n\n## Debug log\n\n```bash\n$ DEBUG=*-proxy inspector-proxy ./test.js\n```\n\n## License\n\nMIT\n\n---\n\n![](./screen.gif)\n","publish_time":1504944327858,"_cnpm_publish_time":1504944327858,"dist-tags":{"latest":"1.2.3"}}