@tomjs/vite-plugin-vscode 4.2.0 → 4.3.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 +18 -18
- package/README.zh_CN.md +17 -17
- package/dist/client.global.js +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -47
- package/dist/index.mjs +17 -53
- package/dist/webview.js +2 -2
- package/dist/webview.mjs +2 -2
- package/package.json +39 -41
package/README.md
CHANGED
|
@@ -112,9 +112,9 @@ panel.webview.html = __getWebviewHtml__({
|
|
|
112
112
|
- `vite.config.ts`
|
|
113
113
|
|
|
114
114
|
```ts
|
|
115
|
-
import { defineConfig } from 'vite';
|
|
116
115
|
import vscode from '@tomjs/vite-plugin-vscode';
|
|
117
116
|
import vue from '@vitejs/plugin-vue';
|
|
117
|
+
import { defineConfig } from 'vite';
|
|
118
118
|
|
|
119
119
|
// https://vitejs.dev/config/
|
|
120
120
|
export default defineConfig({
|
|
@@ -138,9 +138,9 @@ export default defineConfig({
|
|
|
138
138
|
- `vite.config.ts`
|
|
139
139
|
|
|
140
140
|
```ts
|
|
141
|
-
import { defineConfig } from 'vite';
|
|
142
141
|
import vscode from '@tomjs/vite-plugin-vscode';
|
|
143
142
|
import react from '@vitejs/plugin-react-swc';
|
|
143
|
+
import { defineConfig } from 'vite';
|
|
144
144
|
|
|
145
145
|
// https://vitejs.dev/config/
|
|
146
146
|
export default defineConfig({
|
|
@@ -155,9 +155,9 @@ See [vue-import](./examples/vue-import) example
|
|
|
155
155
|
- `vite.config.ts`
|
|
156
156
|
|
|
157
157
|
```ts
|
|
158
|
-
import { defineConfig } from 'vite';
|
|
159
158
|
import path from 'node:path';
|
|
160
159
|
import vscode from '@tomjs/vite-plugin-vscode';
|
|
160
|
+
import { defineConfig } from 'vite';
|
|
161
161
|
|
|
162
162
|
export default defineConfig({
|
|
163
163
|
plugins: [vscode()],
|
|
@@ -261,12 +261,12 @@ const value = await acquireVsCodeApi().getState();
|
|
|
261
261
|
|
|
262
262
|
### PluginOptions
|
|
263
263
|
|
|
264
|
-
| Property
|
|
265
|
-
|
|
|
266
|
-
| recommended | `boolean`
|
|
267
|
-
| extension
|
|
268
|
-
| webview
|
|
269
|
-
| devtools
|
|
264
|
+
| Property | Type | Default | Description |
|
|
265
|
+
| ----------- | -------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
266
|
+
| recommended | `boolean` | `true` | This option is intended to provide recommended default parameters and behavior. |
|
|
267
|
+
| extension | [ExtensionOptions](#ExtensionOptions) | | Configuration options for the vscode extension. |
|
|
268
|
+
| webview | `boolean` \| `string` \| [WebviewOption](#WebviewOption) | `__getWebviewHtml__` | Inject html code |
|
|
269
|
+
| 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 |
|
|
270
270
|
|
|
271
271
|
#### Notice
|
|
272
272
|
|
|
@@ -298,18 +298,18 @@ During development, support standalone development tool applications for `react`
|
|
|
298
298
|
|
|
299
299
|
Based on [Options](https://paka.dev/npm/tsup) of [tsup](https://tsup.egoist.dev/), some default values are added for ease of use.
|
|
300
300
|
|
|
301
|
-
| Property
|
|
302
|
-
|
|
|
303
|
-
| entry
|
|
304
|
-
| outDir
|
|
305
|
-
| onSuccess | `() => Promise<void \| undefined \| (() => void \| Promise<void>)>` | `undefined`
|
|
301
|
+
| Property | Type | Default | Description |
|
|
302
|
+
| --------- | ------------------------------------------------------------------- | --------------------- | ---------------------------------------------------------- |
|
|
303
|
+
| entry | `string` | `extension/index.ts` | The vscode extension entry file. |
|
|
304
|
+
| outDir | `string` | `dist-extension/main` | The output directory for the vscode extension file |
|
|
305
|
+
| onSuccess | `() => Promise<void \| undefined \| (() => void \| Promise<void>)>` | `undefined` | A function that will be executed after the build succeeds. |
|
|
306
306
|
|
|
307
307
|
### WebviewOption
|
|
308
308
|
|
|
309
|
-
| Property | Type
|
|
310
|
-
|
|
|
311
|
-
| name
|
|
312
|
-
| csp
|
|
309
|
+
| Property | Type | Default | Description |
|
|
310
|
+
| -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |
|
|
311
|
+
| name | `string` | `__getWebviewHtml__` | The inject method name |
|
|
312
|
+
| csp | `string` | `<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src {{cspSource}} 'unsafe-inline'; script-src 'nonce-{{nonce}}' 'unsafe-eval';">` | The `CSP` meta for the webview |
|
|
313
313
|
|
|
314
314
|
- `{{cspSource}}`: [webview.cspSource](https://code.visualstudio.com/api/references/vscode-api#Webview)
|
|
315
315
|
- `{{nonce}}`: uuid
|
package/README.zh_CN.md
CHANGED
|
@@ -112,9 +112,9 @@ panel.webview.html = __getWebviewHtml__({
|
|
|
112
112
|
- `vite.config.ts`
|
|
113
113
|
|
|
114
114
|
```ts
|
|
115
|
-
import { defineConfig } from 'vite';
|
|
116
115
|
import vscode from '@tomjs/vite-plugin-vscode';
|
|
117
116
|
import vue from '@vitejs/plugin-vue';
|
|
117
|
+
import { defineConfig } from 'vite';
|
|
118
118
|
|
|
119
119
|
// https://vitejs.dev/config/
|
|
120
120
|
export default defineConfig({
|
|
@@ -138,9 +138,9 @@ export default defineConfig({
|
|
|
138
138
|
- `vite.config.ts`
|
|
139
139
|
|
|
140
140
|
```ts
|
|
141
|
-
import { defineConfig } from 'vite';
|
|
142
141
|
import vscode from '@tomjs/vite-plugin-vscode';
|
|
143
142
|
import react from '@vitejs/plugin-react-swc';
|
|
143
|
+
import { defineConfig } from 'vite';
|
|
144
144
|
|
|
145
145
|
// https://vitejs.dev/config/
|
|
146
146
|
export default defineConfig({
|
|
@@ -260,12 +260,12 @@ const value = await acquireVsCodeApi().getState();
|
|
|
260
260
|
|
|
261
261
|
### PluginOptions
|
|
262
262
|
|
|
263
|
-
| 参数名
|
|
264
|
-
|
|
|
265
|
-
| recommended | `boolean`
|
|
266
|
-
| extension
|
|
267
|
-
| webview
|
|
268
|
-
| devtools
|
|
263
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
264
|
+
| ----------- | -------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
265
|
+
| recommended | `boolean` | `true` | 这个选项是为了提供推荐的默认参数和行为 |
|
|
266
|
+
| extension | [ExtensionOptions](#ExtensionOptions) | | vscode extension 可选配置 |
|
|
267
|
+
| webview | `boolean` \| `string` \| [WebviewOption](#WebviewOption) | `__getWebviewHtml__` | 注入 html 代码 |
|
|
268
|
+
| devtools | `boolean` | `true` | 注入 script 代码用于 [react-devtools](https://github.com/facebook/react/tree/main/packages/react-devtools) 或 [vue-devtools](https://devtools.vuejs.org/guide/standalone) 调试 |
|
|
269
269
|
|
|
270
270
|
#### Notice
|
|
271
271
|
|
|
@@ -298,18 +298,18 @@ const value = await acquireVsCodeApi().getState();
|
|
|
298
298
|
|
|
299
299
|
继承自 [tsup](https://tsup.egoist.dev/) 的 [Options](https://paka.dev/npm/tsup),添加了一些默认值,方便使用。
|
|
300
300
|
|
|
301
|
-
| 参数名
|
|
302
|
-
|
|
|
303
|
-
| entry
|
|
304
|
-
| outDir
|
|
305
|
-
| onSuccess | `() => Promise<void \| undefined \| (() => void \| Promise<void>)>` | `undefined`
|
|
301
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
302
|
+
| --------- | ------------------------------------------------------------------- | --------------------- | ------------------------ |
|
|
303
|
+
| entry | `string` | `extension/index.ts` | 入口文件 |
|
|
304
|
+
| outDir | `string` | `dist-extension/main` | 输出文件夹 |
|
|
305
|
+
| onSuccess | `() => Promise<void \| undefined \| (() => void \| Promise<void>)>` | `undefined` | 构建成功后运行的回调函数 |
|
|
306
306
|
|
|
307
307
|
### WebviewOption
|
|
308
308
|
|
|
309
|
-
| 参数名 | 类型
|
|
310
|
-
|
|
|
311
|
-
| name
|
|
312
|
-
| csp
|
|
309
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
310
|
+
| ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
|
|
311
|
+
| name | `string` | `__getWebviewHtml__` | 注入的方法名 |
|
|
312
|
+
| csp | `string` | `<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src {{cspSource}} 'unsafe-inline'; script-src 'nonce-{{nonce}}' 'unsafe-eval';">` | webview 的 `CSP` |
|
|
313
313
|
|
|
314
314
|
- `{{cspSource}}`: [webview.cspSource](https://code.visualstudio.com/api/references/vscode-api#Webview)
|
|
315
315
|
- `{{nonce}}`: uuid
|
package/dist/client.global.js
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
patchInitData(data);
|
|
67
67
|
});
|
|
68
68
|
var KEYBOARD_EVENT_TYPE = "[vscode:client]:commands";
|
|
69
|
-
var isMac = navigator.userAgent.
|
|
69
|
+
var isMac = navigator.userAgent.includes("Macintosh");
|
|
70
70
|
document.addEventListener("keydown", (e) => {
|
|
71
71
|
console.log(e);
|
|
72
72
|
const { metaKey, shiftKey, ctrlKey, altKey, key } = e;
|
package/dist/index.d.mts
CHANGED
|
@@ -48,7 +48,7 @@ interface PluginOptions {
|
|
|
48
48
|
/**
|
|
49
49
|
* Recommended switch. Default is true.
|
|
50
50
|
* if true, will have the following default behavior:
|
|
51
|
-
*
|
|
51
|
+
* will change the extension/webview outDir to be parallel outDir;
|
|
52
52
|
* eg. if vite build.outDir is 'dist', will change extension/webview to 'dist/extension' and 'dist/webview'
|
|
53
53
|
* @default true
|
|
54
54
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ interface PluginOptions {
|
|
|
48
48
|
/**
|
|
49
49
|
* Recommended switch. Default is true.
|
|
50
50
|
* if true, will have the following default behavior:
|
|
51
|
-
*
|
|
51
|
+
* will change the extension/webview outDir to be parallel outDir;
|
|
52
52
|
* eg. if vite build.outDir is 'dist', will change extension/webview to 'dist/extension' and 'dist/webview'
|
|
53
53
|
* @default true
|
|
54
54
|
*/
|
package/dist/index.js
CHANGED
|
@@ -14,46 +14,13 @@ var PACKAGE_NAME = "@tomjs/vite-plugin-vscode";
|
|
|
14
14
|
var WEBVIEW_METHOD_NAME = "__getWebviewHtml__";
|
|
15
15
|
|
|
16
16
|
// src/logger.ts
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.withTime = _nullishCoalesce(withTime, () => ( true));
|
|
25
|
-
}
|
|
26
|
-
getTime() {
|
|
27
|
-
return `${this.withTime ? _dayjs2.default.call(void 0, ).format("HH:mm:ss") : ""} `;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* 调试
|
|
31
|
-
*/
|
|
32
|
-
debug(msg, ...rest) {
|
|
33
|
-
console.log(`${this.getTime()}${_kolorist.gray.call(void 0, this.tag)}`, msg, ...rest);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* 调试日志 等同 debug
|
|
37
|
-
*/
|
|
38
|
-
log(msg, ...rest) {
|
|
39
|
-
this.debug(msg, ...rest);
|
|
40
|
-
}
|
|
41
|
-
info(msg, ...rest) {
|
|
42
|
-
console.log(`${this.getTime()}${_kolorist.blue.call(void 0, this.tag)}`, msg, ...rest);
|
|
43
|
-
}
|
|
44
|
-
warn(msg, ...rest) {
|
|
45
|
-
console.log(`${this.getTime()}${_kolorist.yellow.call(void 0, this.tag)}`, msg, ...rest);
|
|
46
|
-
}
|
|
47
|
-
error(msg, ...rest) {
|
|
48
|
-
console.log(`${this.getTime()}${_kolorist.red.call(void 0, this.tag)}`, msg, ...rest);
|
|
49
|
-
}
|
|
50
|
-
success(msg, ...rest) {
|
|
51
|
-
console.log(`${this.getTime()}${_kolorist.green.call(void 0, this.tag)}`, msg, ...rest);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
var createLogger = (tag) => {
|
|
55
|
-
return new Logger(tag || PLUGIN_NAME, true);
|
|
56
|
-
};
|
|
17
|
+
var _logger = require('@tomjs/logger'); var _logger2 = _interopRequireDefault(_logger);
|
|
18
|
+
function createLogger() {
|
|
19
|
+
return new (0, _logger2.default)({
|
|
20
|
+
prefix: `[${PLUGIN_NAME}]`,
|
|
21
|
+
time: true
|
|
22
|
+
});
|
|
23
|
+
}
|
|
57
24
|
|
|
58
25
|
// src/utils.ts
|
|
59
26
|
function resolveHostname(hostname) {
|
|
@@ -301,7 +268,7 @@ function useVSCodePlugin(options) {
|
|
|
301
268
|
if (file.includes(`${webview.name}(`)) {
|
|
302
269
|
return {
|
|
303
270
|
contents: `import ${webview.name} from '${PACKAGE_NAME}/webview';
|
|
304
|
-
|
|
271
|
+
${file}`,
|
|
305
272
|
loader: "ts"
|
|
306
273
|
};
|
|
307
274
|
}
|
|
@@ -338,16 +305,13 @@ function useVSCodePlugin(options) {
|
|
|
338
305
|
port = 8098;
|
|
339
306
|
}
|
|
340
307
|
if (port) {
|
|
341
|
-
html = html.replace(
|
|
342
|
-
/<head>/i,
|
|
343
|
-
`<head><script src="http://localhost:${port}"></script>`
|
|
344
|
-
);
|
|
308
|
+
html = html.replace(/<head>/i, `<head><script src="http://localhost:${port}"></script>`);
|
|
345
309
|
} else if (!devtoolsFlag) {
|
|
346
310
|
devtoolsFlag = true;
|
|
347
311
|
logger.warn("Only support react-devtools and vue-devtools!");
|
|
348
312
|
}
|
|
349
313
|
}
|
|
350
|
-
return html.replace(
|
|
314
|
+
return html.replace(/<head>/i, `<head><script>${devWebviewClient}</script>`);
|
|
351
315
|
}
|
|
352
316
|
},
|
|
353
317
|
{
|
|
@@ -397,7 +361,7 @@ function useVSCodePlugin(options) {
|
|
|
397
361
|
if (file.includes(`${webview.name}(`)) {
|
|
398
362
|
return {
|
|
399
363
|
contents: `import ${webview.name} from \`${webviewPath}\`;
|
|
400
|
-
|
|
364
|
+
${file}`,
|
|
401
365
|
loader: "ts"
|
|
402
366
|
};
|
|
403
367
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
// node_modules/.pnpm/tsup@8.
|
|
2
|
-
import { fileURLToPath } from "url";
|
|
1
|
+
// node_modules/.pnpm/tsup@8.5.0_@swc+core@1.11.24_jiti@2.4.2_postcss@8.5.6_tsx@4.20.3_typescript@5.7.3_yaml@2.8.0/node_modules/tsup/assets/esm_shims.js
|
|
3
2
|
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
4
|
var getFilename = () => fileURLToPath(import.meta.url);
|
|
5
5
|
var getDirname = () => path.dirname(getFilename());
|
|
6
6
|
var __dirname = /* @__PURE__ */ getDirname();
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
|
-
import fs from "
|
|
10
|
-
import os from "
|
|
11
|
-
import path2 from "
|
|
12
|
-
import { cwd } from "
|
|
9
|
+
import fs from "fs";
|
|
10
|
+
import os from "os";
|
|
11
|
+
import path2 from "path";
|
|
12
|
+
import { cwd } from "process";
|
|
13
13
|
import { emptyDirSync, readFileSync, readJsonSync } from "@tomjs/node";
|
|
14
14
|
import merge from "lodash.merge";
|
|
15
15
|
import { parse as htmlParser } from "node-html-parser";
|
|
@@ -21,46 +21,13 @@ var PACKAGE_NAME = "@tomjs/vite-plugin-vscode";
|
|
|
21
21
|
var WEBVIEW_METHOD_NAME = "__getWebviewHtml__";
|
|
22
22
|
|
|
23
23
|
// src/logger.ts
|
|
24
|
-
import
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.withTime = withTime ?? true;
|
|
32
|
-
}
|
|
33
|
-
getTime() {
|
|
34
|
-
return `${this.withTime ? dayjs().format("HH:mm:ss") : ""} `;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* 调试
|
|
38
|
-
*/
|
|
39
|
-
debug(msg, ...rest) {
|
|
40
|
-
console.log(`${this.getTime()}${gray(this.tag)}`, msg, ...rest);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* 调试日志 等同 debug
|
|
44
|
-
*/
|
|
45
|
-
log(msg, ...rest) {
|
|
46
|
-
this.debug(msg, ...rest);
|
|
47
|
-
}
|
|
48
|
-
info(msg, ...rest) {
|
|
49
|
-
console.log(`${this.getTime()}${blue(this.tag)}`, msg, ...rest);
|
|
50
|
-
}
|
|
51
|
-
warn(msg, ...rest) {
|
|
52
|
-
console.log(`${this.getTime()}${yellow(this.tag)}`, msg, ...rest);
|
|
53
|
-
}
|
|
54
|
-
error(msg, ...rest) {
|
|
55
|
-
console.log(`${this.getTime()}${red(this.tag)}`, msg, ...rest);
|
|
56
|
-
}
|
|
57
|
-
success(msg, ...rest) {
|
|
58
|
-
console.log(`${this.getTime()}${green(this.tag)}`, msg, ...rest);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
var createLogger = (tag) => {
|
|
62
|
-
return new Logger(tag || PLUGIN_NAME, true);
|
|
63
|
-
};
|
|
24
|
+
import Logger from "@tomjs/logger";
|
|
25
|
+
function createLogger() {
|
|
26
|
+
return new Logger({
|
|
27
|
+
prefix: `[${PLUGIN_NAME}]`,
|
|
28
|
+
time: true
|
|
29
|
+
});
|
|
30
|
+
}
|
|
64
31
|
|
|
65
32
|
// src/utils.ts
|
|
66
33
|
function resolveHostname(hostname) {
|
|
@@ -308,7 +275,7 @@ function useVSCodePlugin(options) {
|
|
|
308
275
|
if (file.includes(`${webview.name}(`)) {
|
|
309
276
|
return {
|
|
310
277
|
contents: `import ${webview.name} from '${PACKAGE_NAME}/webview';
|
|
311
|
-
|
|
278
|
+
${file}`,
|
|
312
279
|
loader: "ts"
|
|
313
280
|
};
|
|
314
281
|
}
|
|
@@ -345,16 +312,13 @@ function useVSCodePlugin(options) {
|
|
|
345
312
|
port = 8098;
|
|
346
313
|
}
|
|
347
314
|
if (port) {
|
|
348
|
-
html = html.replace(
|
|
349
|
-
/<head>/i,
|
|
350
|
-
`<head><script src="http://localhost:${port}"></script>`
|
|
351
|
-
);
|
|
315
|
+
html = html.replace(/<head>/i, `<head><script src="http://localhost:${port}"></script>`);
|
|
352
316
|
} else if (!devtoolsFlag) {
|
|
353
317
|
devtoolsFlag = true;
|
|
354
318
|
logger.warn("Only support react-devtools and vue-devtools!");
|
|
355
319
|
}
|
|
356
320
|
}
|
|
357
|
-
return html.replace(
|
|
321
|
+
return html.replace(/<head>/i, `<head><script>${devWebviewClient}</script>`);
|
|
358
322
|
}
|
|
359
323
|
},
|
|
360
324
|
{
|
|
@@ -404,7 +368,7 @@ function useVSCodePlugin(options) {
|
|
|
404
368
|
if (file.includes(`${webview.name}(`)) {
|
|
405
369
|
return {
|
|
406
370
|
contents: `import ${webview.name} from \`${webviewPath}\`;
|
|
407
|
-
|
|
371
|
+
${file}`,
|
|
408
372
|
loader: "ts"
|
|
409
373
|
};
|
|
410
374
|
}
|
package/dist/webview.js
CHANGED
|
@@ -50,7 +50,7 @@ var template_default = `<!doctype html>
|
|
|
50
50
|
function sendInitData(iframe) {
|
|
51
51
|
console.log(TAG + 'init data');
|
|
52
52
|
const dataset = {};
|
|
53
|
-
Object.keys(document.body.dataset).forEach(key => {
|
|
53
|
+
Object.keys(document.body.dataset).forEach((key) => {
|
|
54
54
|
dataset[key] = document.body.dataset[key];
|
|
55
55
|
});
|
|
56
56
|
|
|
@@ -194,7 +194,7 @@ function getWebviewHtml(options) {
|
|
|
194
194
|
serverUrl: ""
|
|
195
195
|
};
|
|
196
196
|
Object.assign(opts, options);
|
|
197
|
-
return template_default.replace(
|
|
197
|
+
return template_default.replace(/\{\{serverUrl\}\}/g, opts.serverUrl);
|
|
198
198
|
}
|
|
199
199
|
var webview_default = getWebviewHtml;
|
|
200
200
|
|
package/dist/webview.mjs
CHANGED
|
@@ -50,7 +50,7 @@ var template_default = `<!doctype html>
|
|
|
50
50
|
function sendInitData(iframe) {
|
|
51
51
|
console.log(TAG + 'init data');
|
|
52
52
|
const dataset = {};
|
|
53
|
-
Object.keys(document.body.dataset).forEach(key => {
|
|
53
|
+
Object.keys(document.body.dataset).forEach((key) => {
|
|
54
54
|
dataset[key] = document.body.dataset[key];
|
|
55
55
|
});
|
|
56
56
|
|
|
@@ -194,7 +194,7 @@ function getWebviewHtml(options) {
|
|
|
194
194
|
serverUrl: ""
|
|
195
195
|
};
|
|
196
196
|
Object.assign(opts, options);
|
|
197
|
-
return template_default.replace(
|
|
197
|
+
return template_default.replace(/\{\{serverUrl\}\}/g, opts.serverUrl);
|
|
198
198
|
}
|
|
199
199
|
var webview_default = getWebviewHtml;
|
|
200
200
|
export {
|
package/package.json
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomjs/vite-plugin-vscode",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Use vue/react to develop 'vscode extension webview', supporting esm/cjs",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Tom Gao",
|
|
7
|
+
"email": "tom@tomgao.cc"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/tomjs/vite-plugin-vscode.git"
|
|
13
|
+
},
|
|
5
14
|
"keywords": [
|
|
6
15
|
"vite",
|
|
7
16
|
"plugin",
|
|
@@ -13,26 +22,21 @@
|
|
|
13
22
|
"esm",
|
|
14
23
|
"cjs"
|
|
15
24
|
],
|
|
16
|
-
"author": {
|
|
17
|
-
"name": "Tom Gao",
|
|
18
|
-
"email": "tom@tomgao.cc"
|
|
19
|
-
},
|
|
20
|
-
"license": "MIT",
|
|
21
|
-
"main": "./dist/index.js",
|
|
22
|
-
"module": "./dist/index.mjs",
|
|
23
|
-
"types": "./dist/index.d.ts",
|
|
24
25
|
"exports": {
|
|
25
26
|
".": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
27
|
+
"import": "./dist/index.mjs",
|
|
28
|
+
"require": "./dist/index.js"
|
|
28
29
|
},
|
|
29
30
|
"./webview": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
31
|
+
"import": "./dist/webview.mjs",
|
|
32
|
+
"require": "./dist/webview.js"
|
|
32
33
|
},
|
|
33
34
|
"./client": "./dist/client.global.js",
|
|
34
35
|
"./env": "./env.d.ts"
|
|
35
36
|
},
|
|
37
|
+
"main": "./dist/index.js",
|
|
38
|
+
"module": "./dist/index.mjs",
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
36
40
|
"files": [
|
|
37
41
|
"dist",
|
|
38
42
|
"env.d.ts"
|
|
@@ -44,55 +48,49 @@
|
|
|
44
48
|
"access": "public",
|
|
45
49
|
"registry": "https://registry.npmjs.org/"
|
|
46
50
|
},
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"url": "git+https://github.com/tomjs/vite-plugin-vscode.git"
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"vite": ">=2"
|
|
50
53
|
},
|
|
51
54
|
"dependencies": {
|
|
55
|
+
"@tomjs/logger": "^1.4.0",
|
|
52
56
|
"@tomjs/node": "^2.2.3",
|
|
53
57
|
"dayjs": "^1.11.13",
|
|
54
58
|
"execa": "^5.1.1",
|
|
55
59
|
"kolorist": "^1.8.0",
|
|
56
60
|
"lodash.clonedeep": "^4.5.0",
|
|
57
61
|
"lodash.merge": "^4.6.2",
|
|
58
|
-
"node-html-parser": "^
|
|
59
|
-
"tsup": "^8.
|
|
62
|
+
"node-html-parser": "^7.0.1",
|
|
63
|
+
"tsup": "^8.5.0"
|
|
60
64
|
},
|
|
61
65
|
"devDependencies": {
|
|
62
|
-
"@commitlint/cli": "^19.
|
|
63
|
-
"@tomjs/commitlint": "^
|
|
64
|
-
"@tomjs/eslint": "^
|
|
65
|
-
"@tomjs/
|
|
66
|
-
"@tomjs/
|
|
67
|
-
"@tomjs/tsconfig": "^1.7.1",
|
|
66
|
+
"@commitlint/cli": "^19.8.1",
|
|
67
|
+
"@tomjs/commitlint": "^4.0.0",
|
|
68
|
+
"@tomjs/eslint": "^5.2.0",
|
|
69
|
+
"@tomjs/stylelint": "^6.0.0",
|
|
70
|
+
"@tomjs/tsconfig": "^2.0.0",
|
|
68
71
|
"@types/lodash.clonedeep": "^4.5.9",
|
|
69
72
|
"@types/lodash.merge": "^4.6.9",
|
|
70
|
-
"@types/node": "18.19.
|
|
73
|
+
"@types/node": "18.19.120",
|
|
71
74
|
"@vitejs/plugin-vue": "^5.2.4",
|
|
72
75
|
"cross-env": "^7.0.3",
|
|
73
|
-
"eslint": "^9.
|
|
74
|
-
"globals": "^
|
|
75
|
-
"
|
|
76
|
-
"lint-staged": "^15.2.10",
|
|
76
|
+
"eslint": "^9.31.0",
|
|
77
|
+
"globals": "^16.3.0",
|
|
78
|
+
"lint-staged": "^16.1.2",
|
|
77
79
|
"npm-run-all": "^4.1.5",
|
|
78
|
-
"prettier": "^3.4.2",
|
|
79
80
|
"rimraf": "^6.0.1",
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
81
|
+
"simple-git-hooks": "^2.13.0",
|
|
82
|
+
"stylelint": "^16.22.0",
|
|
83
|
+
"tsx": "^4.20.3",
|
|
84
|
+
"typescript": "~5.7.3",
|
|
83
85
|
"vite": "^6.3.5",
|
|
84
|
-
"vue-tsc": "^2.
|
|
85
|
-
},
|
|
86
|
-
"peerDependencies": {
|
|
87
|
-
"vite": ">=2"
|
|
86
|
+
"vue-tsc": "^2.2.12"
|
|
88
87
|
},
|
|
89
88
|
"scripts": {
|
|
90
89
|
"dev": "pnpm clean && tsup --watch",
|
|
91
90
|
"build": "pnpm clean && tsup",
|
|
92
91
|
"clean": "rimraf ./dist",
|
|
93
|
-
"lint": "run-s lint:
|
|
94
|
-
"lint:eslint": "eslint
|
|
95
|
-
"lint:stylelint": "stylelint \"examples/**/*.{css,scss,less,vue,html}\" --fix --cache"
|
|
96
|
-
"lint:prettier": "prettier --write ."
|
|
92
|
+
"lint": "run-s lint:stylelint lint:eslint",
|
|
93
|
+
"lint:eslint": "eslint --fix",
|
|
94
|
+
"lint:stylelint": "stylelint \"examples/**/*.{css,scss,less,vue,html}\" --fix --cache"
|
|
97
95
|
}
|
|
98
96
|
}
|