Skip to content

Commit d582324

Browse files
committed
docs: add option page
1 parent b325626 commit d582324

File tree

10 files changed

+1073
-1057
lines changed

10 files changed

+1073
-1057
lines changed

README-zh_CN.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,3 @@ import { register } from 'node-network-devtools'
8282
const unregister = register()
8383
unregister()
8484
```
85-
86-
## 📚 文档
87-
88-
如果遇到任何问题,可以尝试清理`request-centre.lock`文件
89-
90-
![Visitors](https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2FGrinZero%2Fnode-network-devtools&labelColor=%237fa1f7&countColor=%23697689)

apps/web/docs/.vuepress/config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ export default defineUserConfig({
66
lang: 'en-US',
77
base: '/node-network-devtools/',
88

9-
title: 'VuePress',
10-
description: 'My first VuePress Site',
9+
title: 'Node Network Devtools',
10+
description: `In Chrome devtools debugger NodeJs's Request`,
1111

1212
theme: defaultTheme({
1313
logo: 'logo.png',
1414
contributors: true,
15-
navbar: ['/', '/get-started'],
15+
navbar: ['/', '/options', '/get-started'],
1616
locales: {
1717
'/': {
1818
selectLanguageName: 'English',
19-
navbar: ['/', '/get-started']
19+
navbar: ['/', '/options', '/get-started']
2020
},
2121
'/zh/': {
2222
selectLanguageName: '简体中文',
23-
navbar: ['/zh/', '/zh/get-started']
23+
navbar: ['/zh/', '/zh/options', '/zh/get-started']
2424
}
2525
}
2626
}),

apps/web/docs/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ features:
2626
details: Install and use it in seconds.
2727
- title: 🛠️ No Proxy
2828
details: Free proxy competition and trouble.
29+
- title: 😊 WebSocket Support
30+
details: Support WebSocket debugging
31+
- title: 🔍 Support network request stack tracking
32+
details: Support network request stack tracking
33+
- title: 📦 Compatibility
34+
details: Compatible with low version NodeJs
2935

3036
footer: MIT Licensed | Copyright © 2024 Node Network Devtools Community
3137
---
32-
33-
At present, it is in the early stage, although the basic functions are already available, there are still many interesting areas to explore and explore.
34-
This is an open source project, and we look forward to your participation and contribution if you are interested.

apps/web/docs/get-started.md

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,48 @@ Node Network Devtools is a network debugging tool that integrates Chrome Devtool
44

55
## Install
66

7-
<CodeGroup>
8-
<CodeGroupItem title="pnpm">
7+
::: code-tabs
8+
9+
@tab pnpm
910

1011
```bash:no-line-numbers
11-
pnpm add node-network-devtools
12+
pnpm add -D node-network-devtools
1213
```
1314

14-
</CodeGroupItem>
15-
16-
<CodeGroupItem title="yarn">
15+
@tab yarn
1716

1817
```bash:no-line-numbers
19-
yarn add node-network-devtools
18+
yarn add -D node-network-devtools
2019
```
2120

22-
</CodeGroupItem>
23-
24-
<CodeGroupItem title="npm" active>
21+
@tab npm
2522

2623
```bash:no-line-numbers
27-
npm i node-network-devtools
24+
npm i -D node-network-devtools
2825
```
2926

30-
</CodeGroupItem>
31-
</CodeGroup>
27+
:::
3228

3329
## Usage
3430

3531
Node.js programs that support both ESM and CommonJS standards only need to introduce and call the 'register' method in the entry file.
3632

37-
<CodeGroup>
38-
<CodeGroupItem title="typescript">
33+
::: code-tabs
34+
35+
@tab typescript
3936

4037
```typescript
4138
import { register } from 'node-network-devtools'
4239
register()
4340
```
4441

45-
</CodeGroupItem>
46-
47-
<CodeGroupItem title="javascript" active>
42+
@tab javascript
4843

4944
```javascript
5045
const { register } = require('node-network-devtools')
5146
register()
5247
```
5348

54-
</CodeGroupItem>
55-
</CodeGroup>
49+
:::
50+
51+
If you want to use options, you can go to [options](./options.md) to see the details.

apps/web/docs/options.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Options
2+
3+
## RegisterOptions
4+
5+
The `RegisterOptions` interface is used to configure the registration options for the network debugger. Below are detailed descriptions of each option and their default values.
6+
7+
### Example
8+
9+
Here is an example of using `RegisterOptions`:
10+
11+
```typescript
12+
import { RegisterOptions } from 'packages/network-debugger/src/common'
13+
14+
const options: RegisterOptions = {
15+
port: 5270,
16+
serverPort: 5271,
17+
autoOpenDevtool: true,
18+
intercept: {
19+
fetch: true,
20+
normal: true
21+
}
22+
}
23+
24+
// Use options to register the network debugger
25+
registerNetworkDebugger(options)
26+
```
27+
28+
### port
29+
30+
- **Description**: Main process port
31+
- **Default value**: `5270`
32+
33+
### serverPort
34+
35+
- **Description**: CDP server port for Devtool
36+
- **Link**: [devtools://devtools/bundled/inspector.html?ws=localhost:${serverPort}](devtools://devtools/bundled/inspector.html?ws=localhost:${serverPort})
37+
- **Default value**: `5271`
38+
39+
### autoOpenDevtool
40+
41+
- **Description**: Whether to automatically open Devtool
42+
- **Default value**: `true`
43+
44+
### intercept
45+
46+
- **Description**: Options for intercepting specific packets. If set to `false`, the packet will not be intercepted.
47+
48+
#### intercept.fetch
49+
50+
- **Default value**: `true`
51+
52+
- **Description**: Whether to intercept globalThis.fetch
53+
54+
#### intercept.normal
55+
56+
- **Default value**: `true`
57+
58+
- **Description**: Whether to intercept requests made by http/https basic packages
59+
60+
#### intercept.undici
61+
62+
- **Default value**: `false`
63+
- **Options**:
64+
- `fetch`: `false` or `{}`, not intercepted by default. Used to intercept `undici.fetch`
65+
- `normal`: `false` or `{}`, not intercepted by default. Used to intercept `undici.request`

apps/web/docs/zh/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ features:
2626
details: 安装,然后在几秒钟内接入完成
2727
- title: 🛠️ 无代理机制
2828
details: 无需困扰于代理冲突和麻烦
29+
- title: 😊 WebSocket 支持
30+
details: 支持 WebSocket 的调试
31+
- title: 🔍 支持网络请求堆栈跟踪
32+
details: 支持网络请求堆栈跟踪
33+
- title: 📦 兼容性
34+
details: 兼容低版本 NodeJs
2935

30-
footer: AGPL-3.0 Licensed | Copyright © 2024 Node Network Devtools Community
36+
footer: MIT Licensed | Copyright © 2024 Node Network Devtools Community
3137
---
32-
33-
目前处于早期阶段,虽然基本功能已经可用,但是仍有很多有趣的地方可以开拓和探索。
34-
这是一个开源项目,非常期待感兴趣的你可以参与贡献。

apps/web/docs/zh/get-started.md

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,48 @@ Node Network Devtools 是一款软集成了 Chrome Devtools 的网络调试工
44

55
## 安装
66

7-
<CodeGroup>
8-
<CodeGroupItem title="pnpm">
7+
::: code-tabs
8+
9+
@tab pnpm
910

1011
```bash:no-line-numbers
11-
pnpm add node-network-devtools
12+
pnpm add -D node-network-devtools
1213
```
1314

14-
</CodeGroupItem>
15-
16-
<CodeGroupItem title="yarn">
15+
@tab yarn
1716

1817
```bash:no-line-numbers
19-
yarn add node-network-devtools
18+
yarn add -D node-network-devtools
2019
```
2120

22-
</CodeGroupItem>
23-
24-
<CodeGroupItem title="npm" active>
21+
@tab npm
2522

2623
```bash:no-line-numbers
27-
npm i node-network-devtools
24+
npm i -D node-network-devtools
2825
```
2926

30-
</CodeGroupItem>
31-
</CodeGroup>
27+
:::
3228

3329
## 使用
3430

3531
支持 esm 和 commonjs 标准的nodejs程序,只需要在入口文件中引入并调用`register`方法即可。
3632

37-
<CodeGroup>
38-
<CodeGroupItem title="typescript">
33+
::: code-tabs
34+
35+
@tab typescript
3936

4037
```typescript
4138
import { register } from 'node-network-devtools'
4239
register()
4340
```
4441

45-
</CodeGroupItem>
46-
47-
<CodeGroupItem title="javascript" active>
42+
@tab javascript
4843

4944
```javascript
5045
const { register } = require('node-network-devtools')
5146
register()
5247
```
5348

54-
</CodeGroupItem>
55-
</CodeGroup>
49+
:::
50+
51+
如果需要使用选项,可以前往 [选项](./options.md) 查看详细说明。

apps/web/docs/zh/options.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# 选项
2+
3+
## RegisterOptions
4+
5+
`RegisterOptions` 接口用于配置网络调试器的注册选项。以下是各个选项的详细说明及其默认值。
6+
7+
### 示例
8+
9+
以下是一个使用 `RegisterOptions` 的示例:
10+
11+
```typescript
12+
import { RegisterOptions } from 'packages/network-debugger/src/common'
13+
14+
const options: RegisterOptions = {
15+
port: 5270,
16+
serverPort: 5271,
17+
autoOpenDevtool: true,
18+
intercept: {
19+
fetch: true,
20+
normal: true
21+
}
22+
}
23+
24+
// 使用 options 进行网络调试器的注册
25+
registerNetworkDebugger(options)
26+
```
27+
28+
### port
29+
30+
- **描述**: 主进程端口
31+
- **默认值**: `5270`
32+
33+
### serverPort
34+
35+
- **描述**: CDP 服务器端口,用于 Devtool
36+
- **链接**: [devtools://devtools/bundled/inspector.html?ws=localhost:${serverPort}](devtools://devtools/bundled/inspector.html?ws=localhost:${serverPort})
37+
- **默认值**: `5271`
38+
39+
### autoOpenDevtool
40+
41+
- **描述**: 是否自动打开 Devtool
42+
- **默认值**: `true`
43+
44+
### intercept
45+
46+
- **描述**: 拦截特定数据包的选项。如果设置为 `false`,则不会拦截该数据包。
47+
48+
#### intercept.fetch
49+
50+
- **默认值**: `true`
51+
52+
- **描述**: 是否拦截 globalThis.fetch
53+
54+
#### intercept.normal
55+
56+
- **默认值**: `true`
57+
58+
- **描述**: 是否拦截 http/https 基础包发出的请求
59+
60+
#### intercept.undici
61+
62+
- **默认值**: `false`
63+
- **选项**:
64+
- `fetch`: `false``{}`,默认不拦截。用于拦截`undici.fetch`
65+
- `normal`: `false``{}`,默认不拦截。用于拦截`undici.request`

apps/web/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
"update-package": "pnpm dlx vp-update"
1212
},
1313
"devDependencies": {
14-
"@vuepress/bundler-vite": "2.0.0-rc.13",
15-
"@vuepress/theme-default": "2.0.0-rc.32",
14+
"@vuepress/bundler-vite": "2.0.0-rc.18",
15+
"@vuepress/theme-default": "2.0.0-rc.65",
1616
"vue": "^3.4.0",
17-
"vuepress": "2.0.0-rc.13"
17+
"vuepress": "2.0.0-rc.18"
1818
},
1919
"dependencies": {
20-
"vuepress-theme-hope": "2.0.0-rc.48"
20+
"vuepress-theme-hope": "2.0.0-rc.62"
2121
}
2222
}

0 commit comments

Comments
 (0)