-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from zh-lx/release-0.1.12
Release 0.1.12
- Loading branch information
Showing
9 changed files
with
122 additions
and
23 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,11 @@ | ||
## Try it online | ||
|
||
<b>vue online demo:</b><br/> | ||
[ | ||
![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg) | ||
](https://stackblitz.com/edit/vitejs-vite-4pseos?file=vite.config.ts) | ||
|
||
<b>react online demo:</b><br/> | ||
[ | ||
![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg) | ||
](https://stackblitz.com/edit/vitejs-vite-4pseos?file=vite.config.ts) |
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,21 +1,52 @@ | ||
# API | ||
|
||
## 参数 | ||
|
||
`CodeInspectorPlugin` 接收一个名为 `options` 的参数: | ||
`CodeInspectorPlugin` 的详细参数配置如下所示: | ||
|
||
```typescript | ||
import { CodeInspectorPlugin } from 'code-inspector-plugin'; | ||
|
||
CodeInspectorPlugin(options); | ||
CodeInspectorPlugin({ | ||
bundler: 'vite', | ||
showSwitch: false, | ||
hotKeys: ['altKey', 'shiftKey'], | ||
autoToggle: true, | ||
needEnvInspector: false, | ||
hideConsole: false, | ||
}); | ||
``` | ||
|
||
`options` 的属性及说明如下表: | ||
## bundler | ||
|
||
- 必传项 | ||
- 类型:`string`,可选值有 `vite` / `webpack` | ||
- 说明:指定的打包工具类型 | ||
|
||
## showSwitch | ||
|
||
- 可选项。默认值为 `false` | ||
- 类型:`boolean` | ||
- 说明: 是否在页面展示一个控制源码定位功能的开关(开关打开时和按住组合键的效果是相同的) | ||
|
||
## hotKeys | ||
|
||
- 可选项。默认值为 `['altKey', 'shiftKey']` | ||
- 类型:`false` 或 `string[]`。类型为数组时,数组项为 `ctrlKey`、`altKey`、`metaKey`、`shiftKey` 中的一个或多个。 | ||
- 说明:触发源码定位功能的组合键,为 `false` 或者空数组则关闭组合键触发。(`ctrlKey` 对应 Mac 中的 `control` 键;`altKey` 对应 Mac 中的 `option` 键;`metaKey` 对应 Mac 中的 `command` 键) | ||
|
||
## autoToggle | ||
|
||
- 可选项。默认值为 `true` | ||
- 类型:`boolean` | ||
- 说明:`showSwitch` 为 `true` 的情况下,点击触发源码定位功能跳转 IDE 后是否自动关闭开关(主要是为了用户体验) | ||
|
||
## needEnvInspector | ||
|
||
- 可选项。默认值为 `false` | ||
- 类型:`boolean` | ||
- 说明:为 `true` 时,仅当 `.env.local` 文件存在且其包含 `CODE_INSPECTOR=true` 时插件生效。(主要是解决团队内有部分成员不想使用该插件的需求) | ||
|
||
## hideConsole | ||
|
||
| 参数 | 描述 | 是否必传 | 类型 | 可选值 | 默认值 | | ||
| ---------------- | ------------------------------------------------------------------------------- | --------------- | ------------------- | -------------------------------------------------------------------- | ------------------------ | | ||
| bundler | 指定的打包工具 | 是 . | `string` | `vite/webpack` | - | | ||
| showSwitch | 是否在页面展示功能开关按钮 | 否 | `boolean` | `true/false` | `false` | | ||
| hotKeys | 触发功能的组合键,为 `false` 或者空数组则关闭组合键触发 | 否 | `string[] \| false` | Array<`'ctrlKey'`\|`'altKey'`\|`'metaKey'`\|`'shiftKey'`> \| `false` | `['altKey', 'shiftKey']` | | ||
| autoToggle | 打开功能开关的情况下,点击触发跳转编辑器时是否自动关闭开关 | 否 | `boolean` | `true/false` | `true` | | ||
| needEnvInspector | 为 true 时,仅当 `.env.local` 文件存在且其包含 `CODE_INSPECTOR=true` 时插件生效 | 否 | `boolean` | `true/false` | `false` | | ||
- 可选项。默认值为 `false` | ||
- 类型:`boolean` | ||
- 说明:默认情况下,插件在项目首次启动时在控制台打印一行按键提示,设置此项为 `true` 可禁用打印 |
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,9 @@ | ||
## 在线体验 | ||
|
||
<b>vue online demo:</b><br/> | ||
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg) | ||
](https://stackblitz.com/edit/vitejs-vite-4pseos?file=vite.config.ts) | ||
|
||
<b>react online demo:</b><br/> | ||
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg) | ||
](https://stackblitz.com/edit/vitejs-vite-4pseos?file=vite.config.ts) |