From 1b94dda63009cff9aeec9259ad30abeb8336829d Mon Sep 17 00:00:00 2001 From: Jo Franchetti Date: Wed, 21 Aug 2024 21:30:18 +0100 Subject: [PATCH 1/2] moving debugging over --- .../debugging.md} | 32 +++++++++++------- .../images/debugger1.jpg | Bin .../images/debugger2.jpg | Bin .../images/debugger3.jpg | Bin .../images/debugger4.jpg | Bin .../images/debugger5.jpg | Bin .../images/debugger7.jpg | Bin 7 files changed, 19 insertions(+), 13 deletions(-) rename runtime/{manual/basics/debugging_your_code.md => fundamentals/debugging.md} (91%) rename runtime/{manual => fundamentals}/images/debugger1.jpg (100%) rename runtime/{manual => fundamentals}/images/debugger2.jpg (100%) rename runtime/{manual => fundamentals}/images/debugger3.jpg (100%) rename runtime/{manual => fundamentals}/images/debugger4.jpg (100%) rename runtime/{manual => fundamentals}/images/debugger5.jpg (100%) rename runtime/{manual => fundamentals}/images/debugger7.jpg (100%) diff --git a/runtime/manual/basics/debugging_your_code.md b/runtime/fundamentals/debugging.md similarity index 91% rename from runtime/manual/basics/debugging_your_code.md rename to runtime/fundamentals/debugging.md index e5e870d4f..4e864eae1 100644 --- a/runtime/manual/basics/debugging_your_code.md +++ b/runtime/fundamentals/debugging.md @@ -1,6 +1,8 @@ --- title: "Debugging Your Code" -oldUrl: /runtime/manual/getting_started/debugging_your_code/ +oldUrl: +- /runtime/manual/getting_started/debugging_your_code/ +- /runtime/manual/basics/debugging_your_code/ --- Deno supports the [V8 Inspector Protocol](https://v8.dev/docs/inspector) used by @@ -18,22 +20,26 @@ for example Chrome DevTools. Visit `chrome://inspect` in a Chromium derived browser to connect Deno to the inspector server. This allows you to inspect your code, add breakpoints, and step through your code. -```shell +```sh deno run --inspect your_script.ts ``` -> ⚠️ If you use the `--inspect` flag, the code will start executing immediately. -> If your program is short, you might not have enough time to connect the -> debugger before the program finishes execution. In such cases, try running -> with `--inspect-wait` or `--inspect-brk` flag instead, or add a timeout at the -> end of your code. +:::note + +If you use the `--inspect` flag, the code will start executing immediately. If +your program is short, you might not have enough time to connect the debugger +before the program finishes execution. In such cases, try running with +`--inspect-wait` or `--inspect-brk` flag instead, or add a timeout at the end of +your code. + +::: ## --inspect-wait Before running the code, the `--inspect-wait` flag will pause execution until a debugger is attached. -```shell +```sh deno run --inspect-wait your_script.ts ``` @@ -45,7 +51,7 @@ additional breakpoints or evaluate expressions before resuming execution. **This is the most commonly used inspect flag**. JetBrains and VSCode IDEs use this flag by default. -```shell +```sh deno run --inspect-brk your_script.ts ``` @@ -57,7 +63,7 @@ server. Use the `--inspect-brk` flag to break execution on the first line: -```shell +```sh $ deno run --inspect-brk --allow-read --allow-net jsr:@std/http@1.0.0-rc.5/file-server Debugger listening on ws://127.0.0.1:9229/ws/1e82c406-85a9-44ab-86b6-7341583480b1 ... @@ -102,7 +108,7 @@ button to do so. You might even need to hit it twice! Once our script is running, try send a request and inspect it in Devtools: -```console +```sh curl http://0.0.0.0:4507/ ``` @@ -140,7 +146,7 @@ If you're having trouble connecting to the inspector, you can use the will show you information like module resolution, network requests, and other permission checks. -```shell +```sh deno run --inspect-brk --log-level=debug your_script.ts ``` @@ -152,7 +158,7 @@ networking, and timers to JavaScript. The `--strace-ops` flag will print out all ops that are being executed by Deno when a program is run along with their timings. -```shell +```sh deno run --strace-ops your_script.ts ``` diff --git a/runtime/manual/images/debugger1.jpg b/runtime/fundamentals/images/debugger1.jpg similarity index 100% rename from runtime/manual/images/debugger1.jpg rename to runtime/fundamentals/images/debugger1.jpg diff --git a/runtime/manual/images/debugger2.jpg b/runtime/fundamentals/images/debugger2.jpg similarity index 100% rename from runtime/manual/images/debugger2.jpg rename to runtime/fundamentals/images/debugger2.jpg diff --git a/runtime/manual/images/debugger3.jpg b/runtime/fundamentals/images/debugger3.jpg similarity index 100% rename from runtime/manual/images/debugger3.jpg rename to runtime/fundamentals/images/debugger3.jpg diff --git a/runtime/manual/images/debugger4.jpg b/runtime/fundamentals/images/debugger4.jpg similarity index 100% rename from runtime/manual/images/debugger4.jpg rename to runtime/fundamentals/images/debugger4.jpg diff --git a/runtime/manual/images/debugger5.jpg b/runtime/fundamentals/images/debugger5.jpg similarity index 100% rename from runtime/manual/images/debugger5.jpg rename to runtime/fundamentals/images/debugger5.jpg diff --git a/runtime/manual/images/debugger7.jpg b/runtime/fundamentals/images/debugger7.jpg similarity index 100% rename from runtime/manual/images/debugger7.jpg rename to runtime/fundamentals/images/debugger7.jpg From 1ea53f549a12ecbc247b7b2ddf5d079627933247 Mon Sep 17 00:00:00 2001 From: Jo Franchetti Date: Wed, 21 Aug 2024 21:36:03 +0100 Subject: [PATCH 2/2] other files --- runtime/_data.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/_data.ts b/runtime/_data.ts index d993e7afa..e690e12c3 100644 --- a/runtime/_data.ts +++ b/runtime/_data.ts @@ -18,6 +18,7 @@ export const sidebar = [ items: [ "/runtime/fundamentals/ts_support/", "/runtime/fundamentals/permissions/", + "/runtime/fundamentals/debugging/", ], }, {