@tomjs/vite-plugin-vscode 6.0.2 → 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 +26 -0
- package/README.zh_CN.md +26 -0
- package/dist/index.js +5 -3
- package/package.json +9 -6
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
|
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
|
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.
|
|
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
|
|
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
|
|
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.
|
|
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.
|
|
64
|
+
"@tomjs/eslint": "^6.3.0",
|
|
62
65
|
"@tomjs/stylelint": "^7.0.0",
|
|
63
|
-
"@tomjs/tsconfig": "^
|
|
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.
|
|
82
|
+
"vue-tsc": "^3.2.1"
|
|
80
83
|
},
|
|
81
84
|
"scripts": {
|
|
82
85
|
"dev": "pnpm clean && tsdown --watch",
|