diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index c72a5749c..f9ba8cf65 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,9 +1,9 @@ -# Microsoft Open Source Code of Conduct - -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). - -Resources: - -- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) -- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) -- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns +# Microsoft Open Source Code of Conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). + +Resources: + +- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) +- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5885a41da..2667b3b22 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,29 +1,29 @@ -# Contributing - -This project welcomes contributions and suggestions. Most contributions require you to agree to a -Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us -the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. - -When you submit a pull request, a CLA bot will automatically determine whether you need to provide -a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions -provided by the bot. You will only need to do this once across all repos using our CLA. - -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or -contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. - -## Development - -For basic development of the extension, you can run: - -1. Clone the repo and run `npm install` -2. Run `npm run watch` in a terminal. This will compile and watch for changes in sources. -3. Run the `Extension` launch configuration. - -For debugging the companion app used to launch browsers from remotes, the process is similar: - -- Also clone `vscode-js-debug-companion` as a sibling directory to `vscode-js-debug`. -- Run `npm run watch` for the companion. -- Run the `Extension and Companion` launch configuration. - -This will cause both js-debug and its companion to boot. It sets an environment variable that forces the companion app to be used for launching the browser. +# Contributing + +This project welcomes contributions and suggestions. Most contributions require you to agree to a +Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us +the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. + +When you submit a pull request, a CLA bot will automatically determine whether you need to provide +a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions +provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +## Development + +For basic development of the extension, you can run: + +1. Clone the repo and run `npm install` +2. Run `npm run watch` in a terminal. This will compile and watch for changes in sources. +3. Run the `Extension` launch configuration. + +For debugging the companion app used to launch browsers from remotes, the process is similar: + +- Also clone `vscode-js-debug-companion` as a sibling directory to `vscode-js-debug`. +- Run `npm run watch` for the companion. +- Run the `Extension and Companion` launch configuration. + +This will cause both js-debug and its companion to boot. It sets an environment variable that forces the companion app to be used for launching the browser. diff --git a/README.md b/README.md index 486441c7e..06ea5d227 100644 --- a/README.md +++ b/README.md @@ -1,99 +1,99 @@ -# js-debug - -This repo contains the new, upcoming JavaScript debugger for VS Code. It's currently a work in progress, expect minor bugs and incompatibilities at this stage. - -## Installation - -You can use this extension from the marketplace by: - -1. Installing the `js-debug-nightly` extension, -2. Adding `"debug.node.useV3": true` and `"debug.chrome.useV3": true` to your user settings, -3. Then you should be able to run and debug your programs without changing your launch config. If you can't, then please file an issue. - -Or alternatively by self-hosting: - -1. Clone this repository and run `npm install`, -1. Then either: - - Run `gulp package` to package a `.vsix` you can install manually, or - - Run `npm run compile`, then open the repository in VS Code and select "Run Extension" -1. Then you should be able to run and debug your programs without changing your launch config. If you can't, then please file an issue. - -## Features - -### Multiple threads - -- Attaching to relevant browser threads: page, out of process iframes, web workers, related service workers - - Screen Shot 2019-07-25 at 9 27 36 AM - -- Node debugging auto-attaches to all Node sub-processes - - Screen Shot 2019-07-30 at 4 16 15 PM - -* Full stack debugging with all targets at a glance. - - Screen Shot 2019-07-30 at 4 13 21 PM - -### Console - -- Evaluate in selected execution context - - Screen Shot 2019-07-25 at 9 29 47 AM - -- Unified console for everything: service workers, page, workers - - Screen Shot 2019-07-22 at 9 54 30 PM - -- Top-level await in console - - Screen Shot 2019-07-22 at 9 40 36 PM - -- Serialized console output - - Screen Shot 2019-07-22 at 9 42 03 PM - -- Console message formatting improvements from CDT - - Screen Shot 2019-07-22 at 10 01 08 PM - -- Per-thread Output with timestamps available post-session - - Screen Shot 2019-07-24 at 10 28 05 PM - - Screen Shot 2019-07-24 at 10 29 43 PM - -- Complete command line API: - - - `inspect(function)` - reveal function definition - - `copy(value)` - copies value into clipboard - - `queryObjects(prototype)` - returns all heap objects of type - - Screen Shot 2019-07-22 at 10 32 03 PM - -### Debugging - -- Instrumentation breakpoints - - Screen Shot 2019-07-22 at 9 50 35 PM - - Screen Shot 2019-07-22 at 9 50 10 PM - -- Pretty print minified source with complete debugging support - - - - ![pretty_print](https://user-images.githubusercontent.com/883973/61990381-71f0d380-aff4-11e9-95ae-10f2b1a732ec.gif) - - - Screen Shot 2019-07-22 at 9 56 12 PM - -- Step into async, step into Worker, etc - - ![step_into](https://user-images.githubusercontent.com/883973/61990326-2c7fd680-aff3-11e9-9602-ba4b25c7f138.gif) - -- All locations go through source maps: stack trace on pause, console methods, exceptions, function locations -- Breakpoints set in source maps are guranteed to be resolved in time (in newer V8 versions). - -## Contributing - -This project welcomes contributions and suggestions. See [CONTRIBUTING.md](CONTRIBUTING.md) for details. +# js-debug + +This repo contains the new, upcoming JavaScript debugger for VS Code. It's currently a work in progress, expect minor bugs and incompatibilities at this stage. + +## Installation + +You can use this extension from the marketplace by: + +1. Installing the `js-debug-nightly` extension, +2. Adding `"debug.node.useV3": true` and `"debug.chrome.useV3": true` to your user settings, +3. Then you should be able to run and debug your programs without changing your launch config. If you can't, then please file an issue. + +Or alternatively by self-hosting: + +1. Clone this repository and run `npm install`, +1. Then either: + - Run `gulp package` to package a `.vsix` you can install manually, or + - Run `npm run compile`, then open the repository in VS Code and select "Run Extension" +1. Then you should be able to run and debug your programs without changing your launch config. If you can't, then please file an issue. + +## Features + +### Multiple threads + +- Attaching to relevant browser threads: page, out of process iframes, web workers, related service workers + + Screen Shot 2019-07-25 at 9 27 36 AM + +- Node debugging auto-attaches to all Node sub-processes + + Screen Shot 2019-07-30 at 4 16 15 PM + +* Full stack debugging with all targets at a glance. + + Screen Shot 2019-07-30 at 4 13 21 PM + +### Console + +- Evaluate in selected execution context + + Screen Shot 2019-07-25 at 9 29 47 AM + +- Unified console for everything: service workers, page, workers + + Screen Shot 2019-07-22 at 9 54 30 PM + +- Top-level await in console + + Screen Shot 2019-07-22 at 9 40 36 PM + +- Serialized console output + + Screen Shot 2019-07-22 at 9 42 03 PM + +- Console message formatting improvements from CDT + + Screen Shot 2019-07-22 at 10 01 08 PM + +- Per-thread Output with timestamps available post-session + + Screen Shot 2019-07-24 at 10 28 05 PM + + Screen Shot 2019-07-24 at 10 29 43 PM + +- Complete command line API: + + - `inspect(function)` - reveal function definition + - `copy(value)` - copies value into clipboard + - `queryObjects(prototype)` - returns all heap objects of type + + Screen Shot 2019-07-22 at 10 32 03 PM + +### Debugging + +- Instrumentation breakpoints + + Screen Shot 2019-07-22 at 9 50 35 PM + + Screen Shot 2019-07-22 at 9 50 10 PM + +- Pretty print minified source with complete debugging support + + + + ![pretty_print](https://user-images.githubusercontent.com/883973/61990381-71f0d380-aff4-11e9-95ae-10f2b1a732ec.gif) + + + Screen Shot 2019-07-22 at 9 56 12 PM + +- Step into async, step into Worker, etc + + ![step_into](https://user-images.githubusercontent.com/883973/61990326-2c7fd680-aff3-11e9-9602-ba4b25c7f138.gif) + +- All locations go through source maps: stack trace on pause, console methods, exceptions, function locations +- Breakpoints set in source maps are guranteed to be resolved in time (in newer V8 versions). + +## Contributing + +This project welcomes contributions and suggestions. See [CONTRIBUTING.md](CONTRIBUTING.md) for details. diff --git a/package-lock.json b/package-lock.json index 26af9b7d9..b1676704c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -165,24 +165,83 @@ } }, "@mixer/parallel-prettier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@mixer/parallel-prettier/-/parallel-prettier-1.0.0.tgz", - "integrity": "sha512-2KP7/O82RxOhpvItREB9YTcqj9BWp4Fx2509INU9ycF3nAOMGZ1SIqBzxkMS+fj8jxx4izFqADYbBlbVNyjtZw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@mixer/parallel-prettier/-/parallel-prettier-2.0.0.tgz", + "integrity": "sha512-GB2KN4I6L1HOrbqXKPDXFI2ptGocbEf1CGmKe0IqEhH3/qfCVKt5b5wVMP1ILeMmPHilz7O/PHUNWbEqlAa1hQ==", "dev": true, "requires": { - "chalk": "^2.4.2", - "commander": "^2.20.0", + "chalk": "^4.0.0", + "commander": "^5.0.0", "glob-stream": "^6.1.0", - "ora": "^3.4.0", - "prettier": "^1.17.0", - "rxjs": "^6.5.1" + "ora": "^4.0.3", + "prettier": "^2.0.4", + "rxjs": "^6.5.5" }, "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz", + "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-5.0.0.tgz", + "integrity": "sha512-JrDGPAKjMGSP1G0DUoaceEJ3DZgAfr/q6X7FVk4+U5KxUSKviYGM2k6zWkfyyBHy5rAtzgYJFa1ro2O9PtoxwQ==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true + }, + "rxjs": { + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz", + "integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, @@ -2062,9 +2121,9 @@ } }, "cli-spinners": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.2.0.tgz", - "integrity": "sha512-tgU3fKwzYjiLEQgPMD9Jt+JjHVL9kW93FiIMX/l7rivvOD4/LL0Mf7gda3+4U2KJBloybwgj5KEoQgGRioMiKQ==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.3.0.tgz", + "integrity": "sha512-Xs2Hf2nzrvJMFKimOR7YR0QwZ8fc0u98kdtwN1eNAZzNQgH3vK2pXzff6GJtKh7S5hoJ87ECiAiZFS2fb5Ii2w==", "dev": true }, "cli-width": { @@ -6157,6 +6216,12 @@ "is-extglob": "^2.1.1" } }, + "is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "dev": true + }, "is-negated-glob": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", @@ -8407,66 +8472,145 @@ } }, "ora": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/ora/-/ora-3.4.0.tgz", - "integrity": "sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/ora/-/ora-4.0.3.tgz", + "integrity": "sha512-fnDebVFyz309A73cqCipVL1fBZewq4vwgSHfxh43vVy31mbyoQ8sCH3Oeaog/owYOs/lLlGVPCISQonTneg6Pg==", "dev": true, "requires": { - "chalk": "^2.4.2", - "cli-cursor": "^2.1.0", - "cli-spinners": "^2.0.0", - "log-symbols": "^2.2.0", - "strip-ansi": "^5.2.0", + "chalk": "^3.0.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.2.0", + "is-interactive": "^1.0.0", + "log-symbols": "^3.0.0", + "mute-stream": "0.0.8", + "strip-ansi": "^6.0.0", "wcwidth": "^1.0.1" }, "dependencies": { "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "dev": true }, - "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", "dev": true, "requires": { - "restore-cursor": "^2.0.0" + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" } }, - "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "dev": true + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } }, - "onetime": { + "color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "requires": { - "mimic-fn": "^1.0.0" + "color-name": "~1.1.4" } }, - "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "log-symbols": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", "dev": true, "requires": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" + "chalk": "^2.4.2" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" } } } @@ -8935,9 +9079,9 @@ "dev": true }, "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.4.tgz", + "integrity": "sha512-SVJIQ51spzFDvh4fIbCLvciiDMCrRhlN3mbZvv/+ycjvmF5E73bKdGfU8QDLNmjYJf+lsGnDBC4UUnvTe5OO0w==", "dev": true }, "pretty-hrtime": { diff --git a/package.json b/package.json index dfcfad8ee..53e55d8a7 100644 --- a/package.json +++ b/package.json @@ -67,11 +67,12 @@ "prettier": { "trailingComma": "all", "singleQuote": true, + "arrowParens": "avoid", "printWidth": 100, "tabWidth": 2 }, "devDependencies": { - "@mixer/parallel-prettier": "^1.0.0", + "@mixer/parallel-prettier": "^2.0.0", "@pptr/testrunner": "^0.7.0", "@types/chai": "^4.2.3", "@types/chai-string": "^1.4.1", @@ -131,7 +132,7 @@ "mocha-multi-reporters": "^1.1.7", "npm-run-all": "^4.1.5", "nyc": "^14.1.1", - "prettier": "^1.19.1", + "prettier": "^2.0.4", "puppeteer": "^1.20.0", "request": "^2.88.0", "request-promise-native": "^1.0.7", diff --git a/src/adapter/breakpoints/conditions/logPoint.ts b/src/adapter/breakpoints/conditions/logPoint.ts index 4fb7591dd..7a41d4cc2 100644 --- a/src/adapter/breakpoints/conditions/logPoint.ts +++ b/src/adapter/breakpoints/conditions/logPoint.ts @@ -117,10 +117,7 @@ export class LogPointCompiler { } const result = `console.log(${[JSON.stringify(formatParts.join('')), ...args].join(', ')})`; - const hash = createHash('sha1') - .update(result) - .digest('hex') - .slice(0, 7); + const hash = createHash('sha1').update(result).digest('hex').slice(0, 7); return result + `\n//# sourceURL=logpoint-${hash}.cdp`; } diff --git a/src/adapter/objectPreview/contexts.ts b/src/adapter/objectPreview/contexts.ts index eec63eb83..6b71dbb76 100644 --- a/src/adapter/objectPreview/contexts.ts +++ b/src/adapter/objectPreview/contexts.ts @@ -33,11 +33,7 @@ const repl: IPreviewContext = { budget: 1000, quoted: true }; const hover: IPreviewContext = { budget: 1000, quoted: true, - postProcess: str => - str - .replace(/\n/gm, '\\n') - .replace(/\r/gm, '\\r') - .replace(/\t/gm, '\\t'), + postProcess: str => str.replace(/\n/gm, '\\n').replace(/\r/gm, '\\r').replace(/\t/gm, '\\t'), }; const copy: IPreviewContext = { budget: Infinity, quoted: false }; const fallback: IPreviewContext = { budget: 100, quoted: true }; diff --git a/src/adapter/objectPreview/index.ts b/src/adapter/objectPreview/index.ts index b61f48859..7eaa6a2a8 100644 --- a/src/adapter/objectPreview/index.ts +++ b/src/adapter/objectPreview/index.ts @@ -461,22 +461,14 @@ export function formatAsTable(param: Cdp.Runtime.ObjectPreview): string { const table: string[] = []; table.push( - rowTemplate - .replace('[', '╭') - .replace(/\|/g, '┬') - .replace(']', '╮') - .replace(/-/g, '┄'), + rowTemplate.replace('[', '╭').replace(/\|/g, '┬').replace(']', '╮').replace(/-/g, '┄'), ); const header: string[] = []; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion for (const name of colNames.values()) header.push(pad(name || '', colLengths.get(name)!)); table.push('┊ ' + header.join(' ┊ ') + ' ┊'); table.push( - rowTemplate - .replace('[', '├') - .replace(/\|/g, '┼') - .replace(']', '┤') - .replace(/-/g, '┄'), + rowTemplate.replace('[', '├').replace(/\|/g, '┼').replace(']', '┤').replace(/-/g, '┄'), ); for (const value of rows) { @@ -488,11 +480,7 @@ export function formatAsTable(param: Cdp.Runtime.ObjectPreview): string { table.push('┊ ' + row.join(' ┊ ') + ' ┊'); } table.push( - rowTemplate - .replace('[', '╰') - .replace(/\|/g, '┴') - .replace(']', '╯') - .replace(/-/g, '┄'), + rowTemplate.replace('[', '╰').replace(/\|/g, '┴').replace(']', '╯').replace(/-/g, '┄'), ); return table.map(row => stringUtils.trimEnd(row, maxTableWidth)).join('\n'); } diff --git a/src/adapter/sources.ts b/src/adapter/sources.ts index 67c8ee5ec..e2b18c095 100644 --- a/src/adapter/sources.ts +++ b/src/adapter/sources.ts @@ -347,8 +347,9 @@ export class Source { } if (this.inlineScriptOffset) { - fqname += `\uA789${this.inlineScriptOffset.lineOffset + 1}:${this.inlineScriptOffset - .columnOffset + 1}`; + fqname += `\uA789${this.inlineScriptOffset.lineOffset + 1}:${ + this.inlineScriptOffset.columnOffset + 1 + }`; } return fqname; } @@ -484,12 +485,7 @@ export class SourceContainer { * rewritten to source reference ID 0. */ public getSourceReference(url: string): number { - let id = Math.abs( - createHash('sha1') - .update(url) - .digest() - .readInt32BE(0), - ); + let id = Math.abs(createHash('sha1').update(url).digest().readInt32BE(0)); for (let i = 0; i < 0xffff; i++) { if (!this._sourceByReference.has(id)) { diff --git a/src/adapter/templates/enumerateProperties.ts b/src/adapter/templates/enumerateProperties.ts index a4cafd111..2ff346eaf 100644 --- a/src/adapter/templates/enumerateProperties.ts +++ b/src/adapter/templates/enumerateProperties.ts @@ -10,7 +10,7 @@ import { ICompletionWithSort, CompletionKind } from '../completions'; /** * Enumerates completion items of the property. */ -export const enumerateProperties = remoteFunction(function( +export const enumerateProperties = remoteFunction(function ( this: unknown, target: unknown, prefix: string, diff --git a/src/adapter/templates/getArrayProperties.ts b/src/adapter/templates/getArrayProperties.ts index 460f820ae..1d767f091 100644 --- a/src/adapter/templates/getArrayProperties.ts +++ b/src/adapter/templates/getArrayProperties.ts @@ -7,7 +7,7 @@ import { remoteFunction } from '.'; /** * Returns non-indexed properties of the array. */ -export const getArrayProperties = remoteFunction(function(this: unknown[]) { +export const getArrayProperties = remoteFunction(function (this: unknown[]) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const result = { __proto__: (this as any).__proto__ }; const names = Object.getOwnPropertyNames(this); diff --git a/src/adapter/templates/getArraySlots.ts b/src/adapter/templates/getArraySlots.ts index 7e1a6d0ca..41f864e9b 100644 --- a/src/adapter/templates/getArraySlots.ts +++ b/src/adapter/templates/getArraySlots.ts @@ -8,7 +8,7 @@ import { remoteFunction } from '.'; * Returns an object containing array property descriptors for the given * range of array indices. */ -export const getArraySlots = remoteFunction(function( +export const getArraySlots = remoteFunction(function ( this: unknown[], start: number, count: number, diff --git a/src/adapter/templates/index.ts b/src/adapter/templates/index.ts index 704a545c3..4112dc89f 100644 --- a/src/adapter/templates/index.ts +++ b/src/adapter/templates/index.ts @@ -138,10 +138,9 @@ export function remoteFunction(fn: (...args: Args) => Cdp.Runtime.CallFunctionOnParams, 'functionDeclaration' | 'arguments' | 'returnByValue' > & - (ByValue extends true ? { returnByValue: ByValue } : {})): Promise> => { + (ByValue extends true ? { returnByValue: ByValue } : {})): Promise< + RemoteObjectWithType + > => { const result = await cdp.Runtime.callFunctionOn({ functionDeclaration: stringified, arguments: args.map(value => ({ value })), diff --git a/src/adapter/templates/invokeGetter.ts b/src/adapter/templates/invokeGetter.ts index 14e9e2fab..81348905f 100644 --- a/src/adapter/templates/invokeGetter.ts +++ b/src/adapter/templates/invokeGetter.ts @@ -7,7 +7,7 @@ import { remoteFunction } from '.'; /** * Gets the object property. */ -export const invokeGetter = remoteFunction(function( +export const invokeGetter = remoteFunction(function ( this: { [key: string]: unknown }, property: string | number, ) { diff --git a/src/adapter/templates/previewThis.ts b/src/adapter/templates/previewThis.ts index 2f46e85c8..b8438e40b 100644 --- a/src/adapter/templates/previewThis.ts +++ b/src/adapter/templates/previewThis.ts @@ -7,6 +7,6 @@ import { remoteFunction } from '.'; /** * Returns a preview of the current context. */ -export const previewThis = remoteFunction(function(this: unknown) { +export const previewThis = remoteFunction(function (this: unknown) { return this; }); diff --git a/src/adapter/templates/toStringForClipboard.ts b/src/adapter/templates/toStringForClipboard.ts index 88ee39a75..0972a621d 100644 --- a/src/adapter/templates/toStringForClipboard.ts +++ b/src/adapter/templates/toStringForClipboard.ts @@ -7,7 +7,7 @@ import { remoteFunction } from '.'; /** * Stringifies the current object for the clipboard. */ -export const toStringForClipboard = remoteFunction(function( +export const toStringForClipboard = remoteFunction(function ( this: unknown, subtype: string | undefined, ) { diff --git a/src/common/cancellation.ts b/src/common/cancellation.ts index fe16042db..6c071e7b7 100644 --- a/src/common/cancellation.ts +++ b/src/common/cancellation.ts @@ -56,7 +56,7 @@ export function cancellableRace( return Promise.race(todo); } -const shortcutEvent = Object.freeze(function(callback, context?): IDisposable { +const shortcutEvent = Object.freeze(function (callback, context?): IDisposable { const handle = setTimeout(callback.bind(context), 0); return { dispose() { diff --git a/src/ioc.ts b/src/ioc.ts index 5d351ff13..76c91ea51 100644 --- a/src/ioc.ts +++ b/src/ioc.ts @@ -109,37 +109,19 @@ export const createTargetContainer = ( .inSingletonScope() .onActivation(trackDispose); - container - .bind(SourceContainer) - .toSelf() - .inSingletonScope(); + container.bind(SourceContainer).toSelf().inSingletonScope(); - container - .bind(IScriptSkipper) - .to(ScriptSkipper) - .inSingletonScope(); + container.bind(IScriptSkipper).to(ScriptSkipper).inSingletonScope(); - container - .bind(ICompletions) - .to(Completions) - .inSingletonScope(); + container.bind(ICompletions).to(Completions).inSingletonScope(); - container - .bind(IEvaluator) - .to(Evaluator) - .inSingletonScope(); + container.bind(IEvaluator).to(Evaluator).inSingletonScope(); container.bind(BasicCpuProfiler).toSelf(); - container - .bind(IProfilerFactory) - .to(ProfilerFactory) - .inSingletonScope(); + container.bind(IProfilerFactory).to(ProfilerFactory).inSingletonScope(); - container - .bind(IProfileController) - .to(ProfileController) - .inSingletonScope(); + container.bind(IProfileController).to(ProfileController).inSingletonScope(); return container; }; @@ -158,11 +140,7 @@ export const createTopLevelSessionContainer = (parent: Container) => { container.bind(IContainer).toConstantValue(container); // Core services: - container - .bind(ILogger) - .to(Logger) - .inSingletonScope() - .onActivation(trackDispose); + container.bind(ILogger).to(Logger).inSingletonScope().onActivation(trackDispose); container .bind(ITelemetryReporter) @@ -177,10 +155,7 @@ export const createTopLevelSessionContainer = (parent: Container) => { .inSingletonScope() .onActivation(trackDispose); - container - .bind(IBreakpointsPredictor) - .to(BreakpointsPredictor) - .inSingletonScope(); + container.bind(IBreakpointsPredictor).to(BreakpointsPredictor).inSingletonScope(); container .bind(ISourceMapRepository) @@ -193,18 +168,9 @@ export const createTopLevelSessionContainer = (parent: Container) => { // Launcher logic: container.bind(RestartPolicyFactory).toSelf(); - container - .bind(ILauncher) - .to(ExtensionHostAttacher) - .onActivation(trackDispose); - container - .bind(ILauncher) - .to(ExtensionHostLauncher) - .onActivation(trackDispose); - container - .bind(ILauncher) - .to(NodeLauncher) - .onActivation(trackDispose); + container.bind(ILauncher).to(ExtensionHostAttacher).onActivation(trackDispose); + container.bind(ILauncher).to(ExtensionHostLauncher).onActivation(trackDispose); + container.bind(ILauncher).to(NodeLauncher).onActivation(trackDispose); container.bind(IProgramLauncher).to(SubprocessProgramLauncher); container.bind(IProgramLauncher).to(TerminalProgramLauncher); @@ -216,23 +182,12 @@ export const createTopLevelSessionContainer = (parent: Container) => { .onActivation(trackDispose); } - container - .bind(ILauncher) - .to(NodeAttacher) - .onActivation(trackDispose); + container.bind(ILauncher).to(NodeAttacher).onActivation(trackDispose); if (container.get(ExtensionLocation) === 'local') { - container - .bind(ChromeLauncher) - .toSelf() - .inSingletonScope() - .onActivation(trackDispose); + container.bind(ChromeLauncher).toSelf().inSingletonScope().onActivation(trackDispose); container.bind(ILauncher).toService(ChromeLauncher); - container - .bind(ILauncher) - .to(EdgeLauncher) - .inSingletonScope() - .onActivation(trackDispose); + container.bind(ILauncher).to(EdgeLauncher).inSingletonScope().onActivation(trackDispose); } else { container .bind(ILauncher) @@ -241,10 +196,7 @@ export const createTopLevelSessionContainer = (parent: Container) => { .onActivation(trackDispose); } - container - .bind(ILauncher) - .to(BrowserAttacher) - .onActivation(trackDispose); + container.bind(ILauncher).to(BrowserAttacher).onActivation(trackDispose); container .bind(ILauncher) .toDynamicValue(() => parent.get(DelegateLauncherFactory).createLauncher()) @@ -276,10 +228,7 @@ export const createGlobalContainer = (options: { const container = new Container(); container.bind(IContainer).toConstantValue(container); - container - .bind(DelegateLauncherFactory) - .toSelf() - .inSingletonScope(); + container.bind(DelegateLauncherFactory).toSelf().inSingletonScope(); container.bind(StoragePath).toConstantValue(options.storagePath); container.bind(IsVSCode).toConstantValue(options.isVsCode); @@ -307,10 +256,7 @@ export const createGlobalContainer = (options: { export const provideLaunchParams = (container: Container, params: AnyLaunchConfiguration) => { container.bind(AnyLaunchConfiguration).toConstantValue(params); - container - .bind(SourcePathResolverFactory) - .toSelf() - .inSingletonScope(); + container.bind(SourcePathResolverFactory).toSelf().inSingletonScope(); container .bind(ISourcePathResolver) diff --git a/src/targets/node/bootloader.ts b/src/targets/node/bootloader.ts index 296abf0a2..93656ad3c 100644 --- a/src/targets/node/bootloader.ts +++ b/src/targets/node/bootloader.ts @@ -15,7 +15,7 @@ function debugLog(text: string) { // require('fs').appendFileSync(require('path').join(require('os').homedir(), 'bootloader.txt'), `BOOTLOADER [${process.pid}] ${text}\n`); } -(function() { +(function () { debugLog('args: ' + process.argv.join(' ')); if (!process.env.NODE_INSPECTOR_IPC) return; diff --git a/src/test/browser/browser-args.test.ts b/src/test/browser/browser-args.test.ts index f65c02bd0..556024cab 100644 --- a/src/test/browser/browser-args.test.ts +++ b/src/test/browser/browser-args.test.ts @@ -12,10 +12,7 @@ describe('BrowserArgs', () => { }); it('add', () => { - const actual = new BrowserArgs(['--a', '--b=foo']) - .add('--a') - .add('--b', 'bar') - .add('--c'); + const actual = new BrowserArgs(['--a', '--b=foo']).add('--a').add('--b', 'bar').add('--c'); expect(actual.toArray()).to.deep.equal(['--a', '--b=bar', '--c']); }); diff --git a/src/test/common/cancellation.test.ts b/src/test/common/cancellation.test.ts index 16b14ddc4..59fd02bb8 100644 --- a/src/test/common/cancellation.test.ts +++ b/src/test/common/cancellation.test.ts @@ -19,7 +19,7 @@ describe('CancellationToken', () => { expect(typeof NeverCancelled.onCancellationRequested).to.equal('function'); }); - it('cancel before token', function(done) { + it('cancel before token', function (done) { const source = new CancellationTokenSource(); expect(source.token.isCancellationRequested).to.equal(false); source.cancel(); diff --git a/src/test/framework/reactTest.ts b/src/test/framework/reactTest.ts index 810f03959..0f2a20d33 100644 --- a/src/test/framework/reactTest.ts +++ b/src/test/framework/reactTest.ts @@ -32,7 +32,7 @@ describe('react', () => { }); describe('TS', () => { - beforeEach(async function() { + beforeEach(async function () { this.timeout(60000 * 4); projectFolder = join(testFixturesDir, projectName); await setupCRA(projectName, testFixturesDir, ['--template', 'cra-template-typescript']); @@ -57,7 +57,7 @@ describe('react', () => { }); describe('JS', () => { - beforeEach(async function() { + beforeEach(async function () { this.timeout(60000 * 4); projectFolder = join(testFixturesDir, projectName); await setupCRA(projectName, testFixturesDir); diff --git a/src/test/testIntegrationUtils.ts b/src/test/testIntegrationUtils.ts index 25c505a09..723cb6098 100644 --- a/src/test/testIntegrationUtils.ts +++ b/src/test/testIntegrationUtils.ts @@ -51,7 +51,7 @@ const itIntegratesBasic = ( fn: (s: IIntegrationState) => Promise | void, testFunction: TestFunction | ExclusiveTestFunction = it, ) => - testFunction(test, async function() { + testFunction(test, async function () { const golden = new GoldenText(this.test!.titlePath().join(' '), testWorkspace); const root = new TestRoot(golden, this.test!.fullTitle()); await root.initialize; diff --git a/src/ui/processTree/darwinProcessTree.ts b/src/ui/processTree/darwinProcessTree.ts index 3eff7fa5b..2608081f2 100644 --- a/src/ui/processTree/darwinProcessTree.ts +++ b/src/ui/processTree/darwinProcessTree.ts @@ -23,11 +23,7 @@ export class DarwinProcessTree extends BaseProcessTree { ]); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const cwd = stdout - .trim() - .split('\n') - .pop()! - .slice(1); + const cwd = stdout.trim().split('\n').pop()!.slice(1); return cwd && isAbsolute(cwd) && (await exists(cwd)) ? cwd : undefined; } catch (e) { diff --git a/src/ui/ui-ioc.ts b/src/ui/ui-ioc.ts index 9c7461fbf..9f62db95d 100644 --- a/src/ui/ui-ioc.ts +++ b/src/ui/ui-ioc.ts @@ -30,14 +30,6 @@ export const registerUiComponents = (container: Container) => { container.bind(IDebugConfigurationProvider).to(cls); }); - container - .bind(DebugSessionTracker) - .toSelf() - .inSingletonScope() - .onActivation(trackDispose); - container - .bind(UiProfileManager) - .toSelf() - .inSingletonScope() - .onActivation(trackDispose); + container.bind(DebugSessionTracker).toSelf().inSingletonScope().onActivation(trackDispose); + container.bind(UiProfileManager).toSelf().inSingletonScope().onActivation(trackDispose); };