forked from denoland/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: flatten navigation structure and rework content pages (denoland…
…#746) Co-authored-by: Marvin Hagemeister <[email protected]>
- Loading branch information
1 parent
f491fdf
commit 26e8f40
Showing
52 changed files
with
2,275 additions
and
3,792 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
{ | ||
"permissions": "/runtime/manual/basics/permissions/", | ||
"config": "/runtime/manual/getting_started/configuration_file/", | ||
"ide": "/runtime/manual/getting_started/setup_your_environment/#using-an-editor%2Fide", | ||
"--allow-env": "/runtime/manual/basics/permissions/#environment-access", | ||
"--allow-ffi": "/runtime/manual/basics/permissions/#ffi-(foreign-function-interface)", | ||
"--allow-hrtime": "/runtime/manual/basics/permissions/#high-resolution-time", | ||
"--allow-net": "/runtime/manual/basics/permissions/#network-access", | ||
"--allow-read": "/runtime/manual/basics/permissions/#file-system-read-access", | ||
"--allow-run": "/runtime/manual/basics/permissions/#running-subprocesses", | ||
"--allow-sys": "/runtime/manual/basics/permissions/#system-information", | ||
"--allow-write": "/runtime/manual/basics/permissions/#file-system-write-access", | ||
"--allow-all": "/runtime/manual/basics/permissions/#all-permissions", | ||
"--unsafely-ignore-certificate-errors": "/runtime/manual/basics/permissions/#certification-errors" | ||
"permissions": "/runtime/fundamentals/security/", | ||
"config": "/runtime/fundamentals/configuration/", | ||
"ide": "/runtime/getting_started/setup_your_environment/#setting-up-your-editor%2Fide", | ||
"--allow-env": "/runtime/fundamentals/security/#environment-access", | ||
"--allow-ffi": "/runtime/fundamentals/security/#ffi-(foreign-function-interface)", | ||
"--allow-hrtime": "/runtime/fundamentals/security/#high-resolution-time", | ||
"--allow-net": "/runtime/fundamentals/security/#network-access", | ||
"--allow-read": "/runtime/fundamentals/security/#file-system-read-access", | ||
"--allow-run": "/runtime/fundamentals/security/#running-subprocesses", | ||
"--allow-sys": "/runtime/fundamentals/security/#system-information", | ||
"--allow-write": "/runtime/fundamentals/security/#file-system-write-access", | ||
"--allow-all": "/runtime/fundamentals/security/#all-permissions", | ||
"--unsafely-ignore-certificate-errors": "/runtime/fundamentals/security/#certification-errors" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
runtime/manual/advanced/_category_.json → runtime/fundamentals/_category_.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...ual/getting_started/configuration_file.md → runtime/fundamentals/configuration.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected]/file-server | ||
Debugger listening on ws://127.0.0.1:9229/ws/1e82c406-85a9-44ab-86b6-7341583480b1 | ||
... | ||
|
@@ -66,11 +72,11 @@ Debugger listening on ws://127.0.0.1:9229/ws/1e82c406-85a9-44ab-86b6-7341583480b | |
In a Chromium derived browser such as Google Chrome or Microsoft Edge, open | ||
`chrome://inspect` and click `Inspect` next to target: | ||
|
||
![chrome://inspect](../images/debugger1.jpg) | ||
![chrome://inspect](./images/debugger1.jpg) | ||
|
||
It might take a few seconds after opening the DevTools to load all modules. | ||
|
||
![DevTools opened](../images/debugger2.jpg) | ||
![DevTools opened](./images/debugger2.jpg) | ||
|
||
You might notice that DevTools pauses execution on the first line of | ||
`_constants.ts` instead of `file_server.ts`. This is expected behavior caused by | ||
|
@@ -81,7 +87,7 @@ At this point all source code is available in the DevTools, so let's open up | |
`file_server.ts` and add a breakpoint there; go to "Sources" pane and expand the | ||
tree: | ||
|
||
![Open file_server.ts](../images/debugger3.jpg) | ||
![Open file_server.ts](./images/debugger3.jpg) | ||
|
||
_Looking closely you'll find duplicate entries for each file; one written | ||
regularly and one in italics. The former is compiled source file (so in the case | ||
|
@@ -90,7 +96,7 @@ source map for the file._ | |
|
||
Next, add a breakpoint in the `listenAndServe` method: | ||
|
||
![Break in file_server.ts](../images/debugger4.jpg) | ||
![Break in file_server.ts](./images/debugger4.jpg) | ||
|
||
As soon as we've added the breakpoint, DevTools automatically opens up the | ||
source map file, which allows us step through the actual source code that | ||
|
@@ -102,11 +108,11 @@ 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/ | ||
``` | ||
|
||
![Break in request handling](../images/debugger5.jpg) | ||
![Break in request handling](./images/debugger5.jpg) | ||
|
||
At this point we can introspect the contents of the request and go step-by-step | ||
to debug the code. | ||
|
@@ -127,7 +133,7 @@ and enabled in Preferences / Settings | Plugins. For more information, see | |
You can debug Deno using your JetBrains IDE by right-clicking the file you want | ||
to debug and selecting the `Debug 'Deno: <file name>'` option. | ||
|
||
![Debug file](../images/jb-ide-debug.png) | ||
![Debug file](./images/jb-ide-debug.png) | ||
|
||
This will create a run/debug configuration with no permission flags set. If you | ||
want to configure them, open your run/debug configuration and add the required | ||
|
@@ -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 | ||
``` | ||
|
||
|
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions
1
...me/manual/getting_started/installation.md → runtime/fundamentals/installation.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.