-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
1,073 additions
and
1,057 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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Options | ||
|
||
## RegisterOptions | ||
|
||
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. | ||
|
||
### Example | ||
|
||
Here is an example of using `RegisterOptions`: | ||
|
||
```typescript | ||
import { RegisterOptions } from 'packages/network-debugger/src/common' | ||
|
||
const options: RegisterOptions = { | ||
port: 5270, | ||
serverPort: 5271, | ||
autoOpenDevtool: true, | ||
intercept: { | ||
fetch: true, | ||
normal: true | ||
} | ||
} | ||
|
||
// Use options to register the network debugger | ||
registerNetworkDebugger(options) | ||
``` | ||
|
||
### port | ||
|
||
- **Description**: Main process port | ||
- **Default value**: `5270` | ||
|
||
### serverPort | ||
|
||
- **Description**: CDP server port for Devtool | ||
- **Link**: [devtools://devtools/bundled/inspector.html?ws=localhost:${serverPort}](devtools://devtools/bundled/inspector.html?ws=localhost:${serverPort}) | ||
- **Default value**: `5271` | ||
|
||
### autoOpenDevtool | ||
|
||
- **Description**: Whether to automatically open Devtool | ||
- **Default value**: `true` | ||
|
||
### intercept | ||
|
||
- **Description**: Options for intercepting specific packets. If set to `false`, the packet will not be intercepted. | ||
|
||
#### intercept.fetch | ||
|
||
- **Default value**: `true` | ||
|
||
- **Description**: Whether to intercept globalThis.fetch | ||
|
||
#### intercept.normal | ||
|
||
- **Default value**: `true` | ||
|
||
- **Description**: Whether to intercept requests made by http/https basic packages | ||
|
||
#### intercept.undici | ||
|
||
- **Default value**: `false` | ||
- **Options**: | ||
- `fetch`: `false` or `{}`, not intercepted by default. Used to intercept `undici.fetch` | ||
- `normal`: `false` or `{}`, not intercepted by default. Used to intercept `undici.request` |
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# 选项 | ||
|
||
## RegisterOptions | ||
|
||
`RegisterOptions` 接口用于配置网络调试器的注册选项。以下是各个选项的详细说明及其默认值。 | ||
|
||
### 示例 | ||
|
||
以下是一个使用 `RegisterOptions` 的示例: | ||
|
||
```typescript | ||
import { RegisterOptions } from 'packages/network-debugger/src/common' | ||
|
||
const options: RegisterOptions = { | ||
port: 5270, | ||
serverPort: 5271, | ||
autoOpenDevtool: true, | ||
intercept: { | ||
fetch: true, | ||
normal: true | ||
} | ||
} | ||
|
||
// 使用 options 进行网络调试器的注册 | ||
registerNetworkDebugger(options) | ||
``` | ||
|
||
### port | ||
|
||
- **描述**: 主进程端口 | ||
- **默认值**: `5270` | ||
|
||
### serverPort | ||
|
||
- **描述**: CDP 服务器端口,用于 Devtool | ||
- **链接**: [devtools://devtools/bundled/inspector.html?ws=localhost:${serverPort}](devtools://devtools/bundled/inspector.html?ws=localhost:${serverPort}) | ||
- **默认值**: `5271` | ||
|
||
### autoOpenDevtool | ||
|
||
- **描述**: 是否自动打开 Devtool | ||
- **默认值**: `true` | ||
|
||
### intercept | ||
|
||
- **描述**: 拦截特定数据包的选项。如果设置为 `false`,则不会拦截该数据包。 | ||
|
||
#### intercept.fetch | ||
|
||
- **默认值**: `true` | ||
|
||
- **描述**: 是否拦截 globalThis.fetch | ||
|
||
#### intercept.normal | ||
|
||
- **默认值**: `true` | ||
|
||
- **描述**: 是否拦截 http/https 基础包发出的请求 | ||
|
||
#### intercept.undici | ||
|
||
- **默认值**: `false` | ||
- **选项**: | ||
- `fetch`: `false` 或 `{}`,默认不拦截。用于拦截`undici.fetch` | ||
- `normal`: `false` 或 `{}`,默认不拦截。用于拦截`undici.request` |
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.