@tomjs/vite-plugin-vscode 6.0.1 → 6.1.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 CHANGED
@@ -101,6 +101,32 @@ panel.webview.html = getWebviewHtml({
101
101
  });
102
102
  ```
103
103
 
104
+ - Add `"@tomjs/vite-plugin-vscode/types"` to `tsconfig.node.json` or `*.d.ts` file.
105
+
106
+ `tsconfig.node.json`
107
+
108
+ ```json
109
+ {
110
+ "extends": "@tomjs/tsconfig/node.json",
111
+ "compilerOptions": {
112
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
113
+ "types": [
114
+ "@tomjs/vite-plugin-vscode/types"
115
+ ]
116
+ },
117
+ "include": [
118
+ "extension",
119
+ "*.config.ts"
120
+ ]
121
+ }
122
+ ```
123
+
124
+ `*.dt.s`
125
+
126
+ ```ts
127
+ /// <reference types="@tomjs/vite-plugin-vscode/types" />
128
+ ```
129
+
104
130
  - `package.json`
105
131
 
106
132
  ```json
@@ -260,12 +286,12 @@ const value = await acquireVsCodeApi().getState();
260
286
 
261
287
  ### PluginOptions
262
288
 
263
- | Property | Type | Default | Description |
264
- | ----------- | -------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
265
- | recommended | `boolean` | `true` | This option is intended to provide recommended default parameters and behavior. |
266
- | extension | [ExtensionOptions](#ExtensionOptions) | | Configuration options for the vscode extension. |
267
- | webview | `boolean` \| `string` \| [WebviewOption](#WebviewOption) | `__getWebviewHtml__` | Inject html code |
268
- | devtools | `boolean` | `true` | Inject script code for [react-devtools](https://github.com/facebook/react/tree/main/packages/react-devtools) or [vue-devtools](https://devtools.vuejs.org/guide/standalone) debugging |
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` | `true` | Inject script code for [react-devtools](https://github.com/facebook/react/tree/main/packages/react-devtools) or [vue-devtools](https://devtools.vuejs.org/guide/standalone) debugging |
269
295
 
270
296
  #### Notice
271
297
 
package/README.zh_CN.md CHANGED
@@ -79,6 +79,32 @@ npm i @tomjs/vite-plugin-vscode -D
79
79
 
80
80
  ### extension
81
81
 
82
+ - 添加 `"@tomjs/vite-plugin-vscode/types"` 到 `tsconfig.node.json` 或 `*.d.ts`
83
+
84
+ `tsconfig.node.json`
85
+
86
+ ```json
87
+ {
88
+ "extends": "@tomjs/tsconfig/node.json",
89
+ "compilerOptions": {
90
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
91
+ "types": [
92
+ "@tomjs/vite-plugin-vscode/types"
93
+ ]
94
+ },
95
+ "include": [
96
+ "extension",
97
+ "*.config.ts"
98
+ ]
99
+ }
100
+ ```
101
+
102
+ `*.dt.s`
103
+
104
+ ```ts
105
+ /// <reference types="@tomjs/vite-plugin-vscode/types" />
106
+ ```
107
+
82
108
  代码片段,更多配置看示例
83
109
 
84
110
  ```ts
@@ -259,12 +285,12 @@ const value = await acquireVsCodeApi().getState();
259
285
 
260
286
  ### PluginOptions
261
287
 
262
- | 参数名 | 类型 | 默认值 | 说明 |
263
- | ----------- | -------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
264
- | recommended | `boolean` | `true` | 这个选项是为了提供推荐的默认参数和行为 |
265
- | extension | [ExtensionOptions](#ExtensionOptions) | | vscode extension 可选配置 |
266
- | webview | `boolean` \| `string` \| [WebviewOption](#WebviewOption) | `__getWebviewHtml__` | 注入 html 代码 |
267
- | devtools | `boolean` | `true` | 注入 script 代码用于 [react-devtools](https://github.com/facebook/react/tree/main/packages/react-devtools) 或 [vue-devtools](https://devtools.vuejs.org/guide/standalone) 调试 |
288
+ | 参数名 | 类型 | 默认值 | 说明 |
289
+ | ----------- | -------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
290
+ | recommended | `boolean` | `true` | 这个选项是为了提供推荐的默认参数和行为 |
291
+ | extension | [ExtensionOptions](#ExtensionOptions) | | vscode extension 可选配置 |
292
+ | webview | `boolean` \| [WebviewOption](#WebviewOption) | `true` | 注入 html 代码 |
293
+ | devtools | `boolean` | `true` | 注入 script 代码用于 [react-devtools](https://github.com/facebook/react/tree/main/packages/react-devtools) 或 [vue-devtools](https://devtools.vuejs.org/guide/standalone) 调试 |
268
294
 
269
295
  #### Notice
270
296
 
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { parse } from "node-html-parser";
9
9
  import { build } from "tsdown";
10
10
  import Logger from "@tomjs/logger";
11
11
 
12
- //#region node_modules/.pnpm/tsdown@0.18.3_publint@0.3.16_synckit@0.11.11_typescript@5.9.3_vue-tsc@3.2.0_typescript@5.9.3_/node_modules/tsdown/esm-shims.js
12
+ //#region node_modules/.pnpm/tsdown@0.18.4_publint@0.3.16_synckit@0.11.11_typescript@5.9.3_vue-tsc@3.2.1_typescript@5.9.3_/node_modules/tsdown/esm-shims.js
13
13
  const getFilename = () => fileURLToPath(import.meta.url);
14
14
  const getDirname = () => path.dirname(getFilename());
15
15
  const __dirname = /* @__PURE__ */ getDirname();
@@ -153,7 +153,7 @@ function uuid() {
153
153
  return text;
154
154
  }
155
155
 
156
- export default function getWebviewHtml(options){
156
+ export function getWebviewHtml(options){
157
157
  const { webview, context, inputName, injectCode } = options || {};
158
158
  const nonce = uuid();
159
159
  const baseUri = webview.asWebviewUri(Uri.joinPath(context.extensionUri, (process.env.VITE_WEBVIEW_DIST || 'dist')));
@@ -164,7 +164,9 @@ export default function getWebviewHtml(options){
164
164
 
165
165
  return html.replaceAll('{{cspSource}}', webview.cspSource).replaceAll('{{nonce}}', nonce).replaceAll('{{baseUri}}', baseUri);
166
166
  }
167
- `;
167
+
168
+ export default getWebviewHtml;
169
+ `;
168
170
  }
169
171
  function useVSCodePlugin(options) {
170
172
  const opts = preMergeOptions(options);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tomjs/vite-plugin-vscode",
3
3
  "type": "module",
4
- "version": "6.0.1",
4
+ "version": "6.1.0",
5
5
  "description": "Use vue/react to develop 'vscode extension webview', supporting esm/cjs",
6
6
  "author": {
7
7
  "name": "Tom Gao",
@@ -27,7 +27,10 @@
27
27
  ".": "./dist/index.js",
28
28
  "./webview": "./dist/webview.js",
29
29
  "./client": "./dist/client.iife.js",
30
- "./env": "./env.d.ts"
30
+ "./env": "./env.d.ts",
31
+ "./types": {
32
+ "types": "./env.d.ts"
33
+ }
31
34
  },
32
35
  "module": "./dist/index.js",
33
36
  "types": "./dist/index.d.ts",
@@ -52,15 +55,15 @@
52
55
  "execa": "^9.6.1",
53
56
  "lodash.merge": "^4.6.2",
54
57
  "node-html-parser": "^7.0.1",
55
- "tsdown": "~0.18.3"
58
+ "tsdown": "~0.18.4"
56
59
  },
57
60
  "devDependencies": {
58
61
  "@antfu/eslint-config": "^6.7.3",
59
62
  "@commitlint/cli": "^20.2.0",
60
63
  "@tomjs/commitlint": "^5.0.0",
61
- "@tomjs/eslint": "^6.0.0",
64
+ "@tomjs/eslint": "^6.3.0",
62
65
  "@tomjs/stylelint": "^7.0.0",
63
- "@tomjs/tsconfig": "^2.2.0",
66
+ "@tomjs/tsconfig": "^3.0.1",
64
67
  "@types/lodash.merge": "^4.6.9",
65
68
  "@types/node": "^20.19.27",
66
69
  "@vitejs/plugin-vue": "^6.0.3",
@@ -76,7 +79,7 @@
76
79
  "tsx": "^4.21.0",
77
80
  "typescript": "~5.9.3",
78
81
  "vite": "^7.3.0",
79
- "vue-tsc": "^3.2.0"
82
+ "vue-tsc": "^3.2.1"
80
83
  },
81
84
  "scripts": {
82
85
  "dev": "pnpm clean && tsdown --watch",