@tomjs/vite-plugin-vscode 6.2.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -6
- package/README.zh_CN.md +10 -6
- package/dist/index.d.ts +3 -2
- package/dist/index.js +7 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -286,12 +286,12 @@ const value = await acquireVsCodeApi().getState();
|
|
|
286
286
|
|
|
287
287
|
### PluginOptions
|
|
288
288
|
|
|
289
|
-
| Property | Type | Default | Description
|
|
290
|
-
| ----------- | -------------------------------------------- | ------- |
|
|
291
|
-
| recommended | `boolean` | `true` | This option is intended to provide recommended default parameters and behavior.
|
|
292
|
-
| extension | [ExtensionOptions](#ExtensionOptions) | | Configuration options for the vscode extension.
|
|
293
|
-
| webview | `boolean` \| [WebviewOption](#WebviewOption) | `true` | Inject html code
|
|
294
|
-
| devtools | `boolean`
|
|
289
|
+
| Property | Type | Default | Description |
|
|
290
|
+
| ----------- | -------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
291
|
+
| recommended | `boolean` | `true` | This option is intended to provide recommended default parameters and behavior. |
|
|
292
|
+
| extension | [ExtensionOptions](#ExtensionOptions) | | Configuration options for the vscode extension. |
|
|
293
|
+
| webview | `boolean` \| [WebviewOption](#WebviewOption) | `true` | Inject html code |
|
|
294
|
+
| devtools | `boolean` \| `number` | `false` | Inject script code is used for debugging in [react-devtools](https://github.com/facebook/react/tree/main/packages/react-devtools) or [vue-devtools](https://devtools.vuejs.org/guide/standalone), and the port can be customized. |
|
|
295
295
|
|
|
296
296
|
#### Notice
|
|
297
297
|
|
|
@@ -456,6 +456,10 @@ Open the [examples](./examples) directory, there are `vue` and `react` examples.
|
|
|
456
456
|
|
|
457
457
|
## Important Notes
|
|
458
458
|
|
|
459
|
+
### v7.0.0
|
|
460
|
+
|
|
461
|
+
Change the default value of the parameter `devtools` to `false`.
|
|
462
|
+
|
|
459
463
|
### v6.0.0
|
|
460
464
|
|
|
461
465
|
**Breaking Updates:**
|
package/README.zh_CN.md
CHANGED
|
@@ -285,12 +285,12 @@ const value = await acquireVsCodeApi().getState();
|
|
|
285
285
|
|
|
286
286
|
### PluginOptions
|
|
287
287
|
|
|
288
|
-
| 参数名 | 类型 | 默认值
|
|
289
|
-
| ----------- | -------------------------------------------- |
|
|
290
|
-
| recommended | `boolean` | `true`
|
|
291
|
-
| extension | [ExtensionOptions](#ExtensionOptions) |
|
|
292
|
-
| webview | `boolean` \| [WebviewOption](#WebviewOption) | `true`
|
|
293
|
-
| devtools | `boolean`
|
|
288
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
289
|
+
| ----------- | -------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
290
|
+
| recommended | `boolean` | `true` | 这个选项是为了提供推荐的默认参数和行为 |
|
|
291
|
+
| extension | [ExtensionOptions](#ExtensionOptions) | | vscode extension 可选配置 |
|
|
292
|
+
| webview | `boolean` \| [WebviewOption](#WebviewOption) | `true` | 注入 html 代码 |
|
|
293
|
+
| devtools | `boolean` \| `number` | `false` | 注入 script 代码用于 [react-devtools](https://github.com/facebook/react/tree/main/packages/react-devtools) 或 [vue-devtools](https://devtools.vuejs.org/guide/standalone) 调试,可自定义端口 |
|
|
294
294
|
|
|
295
295
|
#### Notice
|
|
296
296
|
|
|
@@ -460,6 +460,10 @@ pnpm build
|
|
|
460
460
|
|
|
461
461
|
## 重要说明
|
|
462
462
|
|
|
463
|
+
### v7.0.0
|
|
464
|
+
|
|
465
|
+
参数 `devtools` 默认值改为 `false`
|
|
466
|
+
|
|
463
467
|
### v6.0.0
|
|
464
468
|
|
|
465
469
|
**破坏性更新:**
|
package/dist/index.d.ts
CHANGED
|
@@ -69,9 +69,10 @@ interface PluginOptions {
|
|
|
69
69
|
* - true:
|
|
70
70
|
* - react: inject `<script src="http://localhost:8097"></script>`
|
|
71
71
|
* - vue: inject `<script src="http://localhost:8098"></script>`
|
|
72
|
-
*
|
|
72
|
+
* - `number`: custom port
|
|
73
|
+
* @default false
|
|
73
74
|
*/
|
|
74
|
-
devtools?: boolean;
|
|
75
|
+
devtools?: boolean | number;
|
|
75
76
|
}
|
|
76
77
|
//#endregion
|
|
77
78
|
//#region src/index.d.ts
|
package/dist/index.js
CHANGED
|
@@ -285,10 +285,14 @@ function useVSCodePlugin(options) {
|
|
|
285
285
|
},
|
|
286
286
|
transformIndexHtml(html) {
|
|
287
287
|
if (!opts.webview) return html;
|
|
288
|
-
|
|
288
|
+
const devtools = opts.devtools;
|
|
289
|
+
if (devtools) {
|
|
289
290
|
let port;
|
|
290
|
-
if (
|
|
291
|
-
else if (
|
|
291
|
+
if (typeof devtools === "number") port = devtools;
|
|
292
|
+
else if (devtools === true) {
|
|
293
|
+
if (resolvedConfig.plugins.find((s) => ["vite:vue", "vite:vue2"].includes(s.name))) port = 8098;
|
|
294
|
+
else if (resolvedConfig.plugins.find((s) => ["vite:react-refresh", "vite:react-swc"].includes(s.name))) port = 8097;
|
|
295
|
+
}
|
|
292
296
|
if (port) html = html.replace(/<head>/i, `<head><script src="http://localhost:${port}"><\/script>`);
|
|
293
297
|
else if (!devtoolsFlag) {
|
|
294
298
|
devtoolsFlag = true;
|