@tomjs/vite-plugin-vscode 4.0.0 → 4.2.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 +6 -0
- package/README.zh_CN.md +6 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -4
- package/dist/index.mjs +10 -9
- package/dist/webview.d.mts +1 -1
- package/dist/webview.d.ts +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -13,11 +13,16 @@ In development mode, inject the same code of [@tomjs/vscode-extension-webview](h
|
|
|
13
13
|
- Use [tsup](https://github.com/egoist/tsup) to quickly build `extension code`
|
|
14
14
|
- Simple configuration, focus on business
|
|
15
15
|
- Support `esm` and `cjs`
|
|
16
|
+
- Support ESM extension (vscode `v1.100.0+`)
|
|
16
17
|
- Support webview `HMR`
|
|
17
18
|
- Support `acquireVsCodeApi` of [@types/vscode-webview](https://www.npmjs.com/package/@types/vscode-webview)
|
|
18
19
|
- Support [Multi-Page App](https://vitejs.dev/guide/build.html#multi-page-app)
|
|
19
20
|
- Supports `vue` and `react` and other [frameworks](https://cn.vitejs.dev/guide/#trying-vite-online) supported by `vite`
|
|
20
21
|
|
|
22
|
+
### ESM extension
|
|
23
|
+
|
|
24
|
+
The NodeJS extension host now (`v1.100.0+`) supports extensions that use JavaScript-modules (ESM). All it needs is the `"type": "module"` entry in your extension's `package.json` file. With that, the JavaScript code can use `import` and `export` statements, including the special module `import('vscode')`.
|
|
25
|
+
|
|
21
26
|
## Install
|
|
22
27
|
|
|
23
28
|
```bash
|
|
@@ -427,6 +432,7 @@ Open the [examples](./examples) directory, there are `vue` and `react` examples.
|
|
|
427
432
|
|
|
428
433
|
- [react](./examples/react): Simple react example.
|
|
429
434
|
- [vue](./examples/vue): Simple vue example.
|
|
435
|
+
- [vue-esm](./examples/vue-esm): Simple vue (ESM Extension) example.
|
|
430
436
|
- [vue-import](./examples/vue-import): Dynamic import() and multi-page examples.
|
|
431
437
|
|
|
432
438
|
## Related
|
package/README.zh_CN.md
CHANGED
|
@@ -13,11 +13,16 @@
|
|
|
13
13
|
- 使用 [tsup](https://github.com/egoist/tsup) 快速构建 `扩展代码`
|
|
14
14
|
- 配置简单,专注业务
|
|
15
15
|
- 支持 `esm`和 `cjs`
|
|
16
|
+
- 支持 ESM 扩展(vscode `v1.100.0+`)
|
|
16
17
|
- 支持 webview `HMR`
|
|
17
18
|
- 支持 [@types/vscode-webview](https://www.npmjs.com/package/@types/vscode-webview) 的 `acquireVsCodeApi`
|
|
18
19
|
- 支持[多页面应用](https://cn.vitejs.dev/guide/build.html#multi-page-app)
|
|
19
20
|
- 支持 `vue` 、`react` 等其他 `vite` 支持的[框架](https://cn.vitejs.dev/guide/#trying-vite-online)
|
|
20
21
|
|
|
22
|
+
### ESM 扩展
|
|
23
|
+
|
|
24
|
+
NodeJS 扩展现在(`v1.100.0+`)支持使用 JavaScript 模块 (ESM) 的扩展。它只需要在扩展的 `package.json` 文件中添加 `"type": "module"` 条目即可。这样,JavaScript 代码就可以使用 `import` 和 `export` 语句,包括特殊的模块 `import('vscode')`
|
|
25
|
+
|
|
21
26
|
## 安装
|
|
22
27
|
|
|
23
28
|
```bash
|
|
@@ -431,6 +436,7 @@ pnpm build
|
|
|
431
436
|
|
|
432
437
|
- [react](./examples/react):简单的 react 示例。
|
|
433
438
|
- [vue](./examples/vue):简单的 vue 示例。
|
|
439
|
+
- [vue-esm](./examples/vue-esm):简单的 vue(ESM 扩展)示例。
|
|
434
440
|
- [vue-import](./examples/vue-import):动态 import() 和多页面示例。
|
|
435
441
|
|
|
436
442
|
## 关联
|
package/dist/index.d.mts
CHANGED
|
@@ -90,4 +90,4 @@ interface PluginOptions {
|
|
|
90
90
|
|
|
91
91
|
declare function useVSCodePlugin(options?: PluginOptions): PluginOption;
|
|
92
92
|
|
|
93
|
-
export { ExtensionOptions, PluginOptions, WebviewOption, useVSCodePlugin as default, useVSCodePlugin };
|
|
93
|
+
export { type ExtensionOptions, type PluginOptions, type WebviewOption, useVSCodePlugin as default, useVSCodePlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -90,4 +90,4 @@ interface PluginOptions {
|
|
|
90
90
|
|
|
91
91
|
declare function useVSCodePlugin(options?: PluginOptions): PluginOption;
|
|
92
92
|
|
|
93
|
-
export { ExtensionOptions, PluginOptions, WebviewOption, useVSCodePlugin as default, useVSCodePlugin };
|
|
93
|
+
export { type ExtensionOptions, type PluginOptions, type WebviewOption, useVSCodePlugin as default, useVSCodePlugin };
|
package/dist/index.js
CHANGED
|
@@ -97,6 +97,7 @@ function getPkg() {
|
|
|
97
97
|
}
|
|
98
98
|
function preMergeOptions(options) {
|
|
99
99
|
const pkg = getPkg();
|
|
100
|
+
const format = pkg.type === "module" ? "esm" : "cjs";
|
|
100
101
|
const opts = _lodashmerge2.default.call(void 0,
|
|
101
102
|
{
|
|
102
103
|
webview: true,
|
|
@@ -105,8 +106,8 @@ function preMergeOptions(options) {
|
|
|
105
106
|
extension: {
|
|
106
107
|
entry: "extension/index.ts",
|
|
107
108
|
outDir: "dist-extension",
|
|
108
|
-
target: ["es2019", "node14"],
|
|
109
|
-
format
|
|
109
|
+
target: format === "esm" ? ["node20"] : ["es2019", "node14"],
|
|
110
|
+
format,
|
|
110
111
|
shims: true,
|
|
111
112
|
clean: true,
|
|
112
113
|
dts: false,
|
|
@@ -417,8 +418,8 @@ function useVSCodePlugin(options) {
|
|
|
417
418
|
}
|
|
418
419
|
];
|
|
419
420
|
}
|
|
420
|
-
var
|
|
421
|
+
var index_default = useVSCodePlugin;
|
|
421
422
|
|
|
422
423
|
|
|
423
424
|
|
|
424
|
-
exports.default =
|
|
425
|
+
exports.default = index_default; exports.useVSCodePlugin = useVSCodePlugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// node_modules/.pnpm/tsup@
|
|
1
|
+
// node_modules/.pnpm/tsup@8.4.0_@swc+core@1.11.24_jiti@1.21.0_postcss@8.4.49_tsx@4.19.2_typescript@5.3.3_yaml@2.5.1/node_modules/tsup/assets/esm_shims.js
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
3
|
import path from "path";
|
|
4
4
|
var getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -6,10 +6,10 @@ var getDirname = () => path.dirname(getFilename());
|
|
|
6
6
|
var __dirname = /* @__PURE__ */ getDirname();
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
|
-
import fs from "fs";
|
|
10
|
-
import os from "os";
|
|
11
|
-
import path2 from "path";
|
|
12
|
-
import { cwd } from "process";
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
import os from "node:os";
|
|
11
|
+
import path2 from "node:path";
|
|
12
|
+
import { cwd } from "node: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";
|
|
@@ -104,6 +104,7 @@ function getPkg() {
|
|
|
104
104
|
}
|
|
105
105
|
function preMergeOptions(options) {
|
|
106
106
|
const pkg = getPkg();
|
|
107
|
+
const format = pkg.type === "module" ? "esm" : "cjs";
|
|
107
108
|
const opts = merge(
|
|
108
109
|
{
|
|
109
110
|
webview: true,
|
|
@@ -112,8 +113,8 @@ function preMergeOptions(options) {
|
|
|
112
113
|
extension: {
|
|
113
114
|
entry: "extension/index.ts",
|
|
114
115
|
outDir: "dist-extension",
|
|
115
|
-
target: ["es2019", "node14"],
|
|
116
|
-
format
|
|
116
|
+
target: format === "esm" ? ["node20"] : ["es2019", "node14"],
|
|
117
|
+
format,
|
|
117
118
|
shims: true,
|
|
118
119
|
clean: true,
|
|
119
120
|
dts: false,
|
|
@@ -424,8 +425,8 @@ function useVSCodePlugin(options) {
|
|
|
424
425
|
}
|
|
425
426
|
];
|
|
426
427
|
}
|
|
427
|
-
var
|
|
428
|
+
var index_default = useVSCodePlugin;
|
|
428
429
|
export {
|
|
429
|
-
|
|
430
|
+
index_default as default,
|
|
430
431
|
useVSCodePlugin
|
|
431
432
|
};
|
package/dist/webview.d.mts
CHANGED
|
@@ -10,4 +10,4 @@ interface WebviewHtmlOptions {
|
|
|
10
10
|
*/
|
|
11
11
|
declare function getWebviewHtml(options: WebviewHtmlOptions): string;
|
|
12
12
|
|
|
13
|
-
export { WebviewHtmlOptions, getWebviewHtml as default, getWebviewHtml };
|
|
13
|
+
export { type WebviewHtmlOptions, getWebviewHtml as default, getWebviewHtml };
|
package/dist/webview.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ interface WebviewHtmlOptions {
|
|
|
10
10
|
*/
|
|
11
11
|
declare function getWebviewHtml(options: WebviewHtmlOptions): string;
|
|
12
12
|
|
|
13
|
-
export { WebviewHtmlOptions, getWebviewHtml as default, getWebviewHtml };
|
|
13
|
+
export { type WebviewHtmlOptions, getWebviewHtml as default, getWebviewHtml };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomjs/vite-plugin-vscode",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Use vue/react to develop 'vscode extension webview', supporting esm/cjs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"env.d.ts"
|
|
39
39
|
],
|
|
40
40
|
"engines": {
|
|
41
|
-
"node": ">=
|
|
41
|
+
"node": ">=18"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"lodash.clonedeep": "^4.5.0",
|
|
57
57
|
"lodash.merge": "^4.6.2",
|
|
58
58
|
"node-html-parser": "^6.1.13",
|
|
59
|
-
"tsup": "
|
|
59
|
+
"tsup": "^8.4.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@commitlint/cli": "^19.6.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@types/lodash.clonedeep": "^4.5.9",
|
|
69
69
|
"@types/lodash.merge": "^4.6.9",
|
|
70
70
|
"@types/node": "18.19.67",
|
|
71
|
-
"@vitejs/plugin-vue": "^5.
|
|
71
|
+
"@vitejs/plugin-vue": "^5.2.4",
|
|
72
72
|
"cross-env": "^7.0.3",
|
|
73
73
|
"eslint": "^9.16.0",
|
|
74
74
|
"globals": "^15.13.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"stylelint": "^16.11.0",
|
|
81
81
|
"tsx": "^4.19.2",
|
|
82
82
|
"typescript": "~5.3.3",
|
|
83
|
-
"vite": "^
|
|
83
|
+
"vite": "^6.3.5",
|
|
84
84
|
"vue-tsc": "^2.1.10"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|