Skip to content

Commit a2b5f16

Browse files
committed
refactor: inspect/debugging as useInspector
This PR rewrites the logic for establishing a connection with the debugging socket, and adds some enhancements along the way. Part of solving #188. Some highlights - - I've installed `"devtools-protocol`, a convenient package that has the static types for the devtools protocol (duh) autogenerated from chrome's devtools codebase. - We now log messages and exceptions into the terminal directly, so you don't have to open devtools to see those messages. - Messages are now buffered until a devtools instance connects, so you won't lose any messages while devtools isn't connected. - We don't lose the connection on making changes to the worker, removing the need for the kludgy hack on the devtools side (where we refresh the whole page when there's a change) Some things that I still have to do, and will do so in followup PRs - - clear the console whenever we make a change to the worker - stay connected when we shift between local/remote mode - eventually, move to using the devtools hosted at cloudflareworkers.com.
1 parent 79d0f2d commit a2b5f16

File tree

6 files changed

+559
-481
lines changed

6 files changed

+559
-481
lines changed

.changeset/slimy-suits-hope.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
Refactor inspection/debugging code -
6+
7+
- I've installed devtools-protocol, a convenient package that has the static types for the devtools protocol (duh) autogenerated from chrome's devtools codebase.
8+
- We now log messages and exceptions into the terminal directly, so you don't have to open devtools to see those messages.
9+
- Messages are now buffered until a devtools instance connects, so you won't lose any messages while devtools isn't connected.
10+
- We don't lose the connection on making changes to the worker, removing the need for the kludgy hack on the devtools side (where we refresh the whole page when there's a change)

package-lock.json

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/wrangler/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"chokidar": "^3.5.2",
6060
"clipboardy": "^3.0.0",
6161
"command-exists": "^1.2.9",
62+
"devtools-protocol": "^0.0.955664",
6263
"execa": "^6.0.0",
6364
"faye-websocket": "^0.11.4",
6465
"finalhandler": "^1.1.2",

0 commit comments

Comments
 (0)