{"id":13685480,"url":"https://github.com/eggjs/egg-development-proxyworker","last_synced_at":"2025-05-01T04:31:09.722Z","repository":{"id":57220379,"uuid":"86657212","full_name":"eggjs/egg-development-proxyworker","owner":"eggjs","description":"**[DEPRECATED]** A proxy worker for debugging worker on egg","archived":true,"fork":false,"pushed_at":"2017-09-14T13:56:43.000Z","size":32,"stargazers_count":17,"open_issues_count":0,"forks_count":2,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-10-29T21:05:52.747Z","etag":null,"topics":["egg","egg-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eggjs.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-30T04:00:06.000Z","updated_at":"2023-01-28T21:23:10.000Z","dependencies_parsed_at":"2022-08-28T23:23:18.929Z","dependency_job_id":null,"html_url":"https://github.com/eggjs/egg-development-proxyworker","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-development-proxyworker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-development-proxyworker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-development-proxyworker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-development-proxyworker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs","download_url":"https://codeload.github.com/eggjs/egg-development-proxyworker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223742702,"owners_count":17195142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["egg","egg-plugin"],"created_at":"2024-08-02T14:00:52.214Z","updated_at":"2024-11-12T07:30:46.673Z","avatar_url":"https://github.com/eggjs.png","language":"JavaScript","readme":"# egg-development-proxyworker\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-development-proxyworker.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-development-proxyworker\n[download-image]: https://img.shields.io/npm/dm/egg-development-proxyworker.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-development-proxyworker\n[travis-image]: https://img.shields.io/travis/eggjs/egg-development-proxyworker.svg?style=flat-square\n[travis-url]: https://travis-ci.org/eggjs/egg-development-proxyworker\n[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-development-proxyworker.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/eggjs/egg-development-proxyworker?branch=master\n[david-image]: https://img.shields.io/david/eggjs/egg-development-proxyworker.svg?style=flat-square\n[david-url]: https://david-dm.org/eggjs/egg-development-proxyworker\n[snyk-image]: https://snyk.io/test/npm/egg-development-proxyworker/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/egg-development-proxyworker\n\nA proxy worker for debugging worker on egg\n\n**DEPRECATED, use [egg-bin debug](https://github.com/eggjs/egg-bin#debug) instead.**\n\nAs in development stage, when we modify the code and save, the application will automatically restart the worker. But every time the worker's updates make the debug port change, And [VSCode] is required to attach to a fixed debug port. So we enabled a proxy service called `proxyworker`. Worker debugging information will be proxied to this service. And then [VSCode] through the fixed attach to proxyworker to debug the worker\n\nThe following are the installation steps:\n\n##### 1. Install [egg-development-proxyworker](https://github.com/eggjs/egg-development-proxyworker) plugin\n\n```bash\nnpm i egg-development-proxyworker --save\n```\n\n##### 2. Enable the plugin\n\n```js\n// config/plugin.js\nexports.proxyworker = {\n  enable: true,\n  package: 'egg-development-proxyworker',\n};\n\n// config/config.default.js\n// If 10086 is occupied, you can specify the other port number through this configuration\nexports.proxyworker = {\n  port: 10086,\n};\n```\n\n##### 3. Add debug configuration in `.vscode/launch.json` :\n\n```js\n{\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n    {\n      \"name\": \"Launch Egg\",\n      \"type\": \"node\",\n      \"request\": \"launch\",\n      \"cwd\": \"${workspaceRoot}\",\n      \"runtimeExecutable\": \"npm\",\n      \"windows\": {\n        \"runtimeExecutable\": \"npm.cmd\"\n      },\n      \"runtimeArgs\": [\n        \"run\", \"dev\", \"--\", \"--debug\"\n      ],\n      \"port\": 5858\n    },\n    {\n      \"name\": \"Attach Agent\",\n      \"type\": \"node\",\n      \"request\": \"attach\",\n      \"port\": 5856\n    },\n    {\n      \"name\": \"Attach Worker\",\n      \"type\": \"node\",\n      \"request\": \"attach\",\n      \"restart\": true,\n      \"port\": 10086\n    }\n  ],\n  \"compounds\": [\n    {\n      \"name\": \"Debug Egg\",\n      \"configurations\": [\"Launch Egg\", \"Attach Agent\", \"Attach Worker\"]\n    }\n  ]\n}\n```\nAs V8 Debugger [Legacy Protocol] will be removed after Node.js 8.x, And replace the use of [Inspector Protocol]\n\nThe new protocol has three major advantages:\n1. Support very large JavaScript object\n2. Support ES6 Proxy\n3. Support Source Map better\n\nFor and **only** for Node.js \u003e= 7.x we should use [Inspector Protocol] for debugging.\n\nIn the above debug configuration, you need to modify some parameters to open the new protocol:\n- `Launch Egg` adjust the parameter `\"runtimeArgs\": [\"run\", \"debug\"]`\n- `Attach Worker` add the parameter `\"protocol\": \"inspector\"`\n\nIn addition, if you use the new protocol can also use chrome devtools for debugging, debugging address:\n```\nchrome-devtools://devtools/bundled/inspector.html?experiments=true\u0026v8only=true\u0026ws=127.0.0.1:10087\n```\n\n\n##### 4. Start debugging\n\nIn [VSCode], switch to the debug page. Select the Debug Egg configuration to start.\n\nMore VSCode Debug usage can be found in the documentation: [Node.js Debugging in VS Code](https://code.visualstudio.com/docs/nodejs/nodejs-debugging)\n\n## Questions \u0026 Suggestions\n\nPlease open an issue [here](https://github.com/okoala/egg-development-proxyworker/issues).\n\n## License\n\n[MIT](LICENSE)\n\n[VSCode]: https://code.visualstudio.com\n[Legacy Protocol]: https://github.com/buggerjs/bugger-v8-client/blob/master/PROTOCOL.md\n[Inspector Protocol]: https://chromedevtools.github.io/debugger-protocol-viewer/v8\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-development-proxyworker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs%2Fegg-development-proxyworker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-development-proxyworker/lists"}