@tomjs/vite-plugin-vscode 7.0.0 → 7.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 +5 -0
- package/README.zh_CN.md +2 -1
- package/dist/index.js +8 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -431,6 +431,11 @@ Run `Debug Extension` through `vscode` to debug. For debugging tools, refer to [
|
|
|
431
431
|
}
|
|
432
432
|
```
|
|
433
433
|
|
|
434
|
+
### Webpage Debugging
|
|
435
|
+
|
|
436
|
+
- You can use the standalone applications of [react-devtools](https://github.com/facebook/react/tree/main/packages/react-devtools) and [vue-devtools](https://devtools.vuejs.org/guide/standalone) to debug `webview`.
|
|
437
|
+
- For Vue projects, you can use the [vite-plugin-vue-devtools](https://devtools.vuejs.org/guide/vite-plugin) Vite plugin.
|
|
438
|
+
|
|
434
439
|
## Examples
|
|
435
440
|
|
|
436
441
|
First execute the following command to install dependencies and generate library files:
|
package/README.zh_CN.md
CHANGED
|
@@ -433,7 +433,8 @@ const value = await acquireVsCodeApi().getState();
|
|
|
433
433
|
|
|
434
434
|
### 网页调试
|
|
435
435
|
|
|
436
|
-
可以使用 [react-devtools](https://github.com/facebook/react/tree/main/packages/react-devtools) 和 [vue-devtools](https://devtools.vuejs.org/guide/standalone) 的独立应用调试 `webview`
|
|
436
|
+
- 可以使用 [react-devtools](https://github.com/facebook/react/tree/main/packages/react-devtools) 和 [vue-devtools](https://devtools.vuejs.org/guide/standalone) 的独立应用调试 `webview`
|
|
437
|
+
- `vue` 项目可以使用 [vite-plugin-vue-devtools](https://devtools.vuejs.org/guide/vite-plugin) 这个 `vite` 插件
|
|
437
438
|
|
|
438
439
|
## 示例
|
|
439
440
|
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import colors from "picocolors";
|
|
|
10
10
|
import { build } from "tsdown";
|
|
11
11
|
import { createLogger } from "vite";
|
|
12
12
|
|
|
13
|
-
//#region node_modules/.pnpm/tsdown@0.19.0_publint@0.3.16_synckit@0.11.11_typescript@5.9.3_vue-tsc@3.2.
|
|
13
|
+
//#region node_modules/.pnpm/tsdown@0.19.0_publint@0.3.16_synckit@0.11.11_typescript@5.9.3_vue-tsc@3.2.2_typescript@5.9.3_/node_modules/tsdown/esm-shims.js
|
|
14
14
|
const getFilename = () => fileURLToPath(import.meta.url);
|
|
15
15
|
const getDirname = () => path.dirname(getFilename());
|
|
16
16
|
const __dirname = /* @__PURE__ */ getDirname();
|
|
@@ -193,19 +193,17 @@ function useVSCodePlugin(options) {
|
|
|
193
193
|
opts.extension.outDir = path.resolve(outDir, "extension");
|
|
194
194
|
outDir = path.resolve(outDir, "webview");
|
|
195
195
|
}
|
|
196
|
-
const assetsDir = config?.build?.assetsDir || "assets";
|
|
197
|
-
const outputDefault = {
|
|
198
|
-
chunkFileNames: `${assetsDir}/[name].js`,
|
|
199
|
-
entryFileNames: `${assetsDir}/[name].js`,
|
|
200
|
-
assetFileNames: `${assetsDir}/[name].[ext]`
|
|
201
|
-
};
|
|
202
196
|
const outputOptions = {};
|
|
203
197
|
const buildConfig = config.build || {};
|
|
204
198
|
const optKey = isRolldown ? "rolldownOptions" : ["rolldownOptions", "rollupOptions"].find((s) => buildConfig[s]) || "rollupOptions";
|
|
199
|
+
const outputDefault = {};
|
|
200
|
+
const inputs = buildConfig[optKey]?.input;
|
|
201
|
+
if (Array.isArray(inputs) && inputs.length === 1) if (isRolldown) outputDefault.codeSplitting = false;
|
|
202
|
+
else outputDefault.inlineDynamicImports = true;
|
|
205
203
|
let output = buildConfig[optKey]?.output || {};
|
|
206
|
-
if (Array.isArray(output)) output.map((s) => Object.assign(
|
|
207
|
-
else output = Object.assign({},
|
|
208
|
-
outputOptions[optKey] = Object.assign(outputOptions[optKey] || {}, { output });
|
|
204
|
+
if (Array.isArray(output)) output.map((s) => Object.assign({}, outputDefault, s));
|
|
205
|
+
else output = Object.assign({}, outputDefault, output);
|
|
206
|
+
outputOptions[optKey] = Object.assign(outputOptions[optKey] || {}, isRolldown ? {} : {}, { output });
|
|
209
207
|
return { build: {
|
|
210
208
|
outDir,
|
|
211
209
|
sourcemap: isDev ? true : config?.build?.sourcemap,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomjs/vite-plugin-vscode",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.1.0",
|
|
5
5
|
"description": "Use vue/react to develop 'vscode extension webview', supporting esm/cjs",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Tom Gao",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"stylelint": "^16.26.1",
|
|
78
78
|
"tsx": "^4.21.0",
|
|
79
79
|
"typescript": "~5.9.3",
|
|
80
|
-
"vite": "^
|
|
80
|
+
"vite": "^8.0.0-beta.8"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
83
83
|
"dev": "pnpm clean && tsdown --watch",
|