@tomjs/vite-plugin-vscode 1.3.2 → 1.5.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 +1 -2
- package/README.zh_CN.md +1 -2
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +9 -3
- package/dist/index.mjs +9 -3
- package/env.d.ts +31 -0
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -87,8 +87,7 @@ private _getWebviewContent(webview: Webview, extensionUri: Uri) {
|
|
|
87
87
|
const nonce = uuid();
|
|
88
88
|
|
|
89
89
|
if (process.env.VITE_DEV_SERVER_URL) {
|
|
90
|
-
|
|
91
|
-
return __getWebviewHtml__({ serverUrl: process.env.VITE_DEV_SERVER_URL });
|
|
90
|
+
return __getWebviewHtml__(process.env.VITE_DEV_SERVER_URL);
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
// Tip: Install the es6-string-html VS Code extension to enable code highlighting below
|
package/README.zh_CN.md
CHANGED
|
@@ -87,8 +87,7 @@ private _getWebviewContent(webview: Webview, extensionUri: Uri) {
|
|
|
87
87
|
const nonce = uuid();
|
|
88
88
|
|
|
89
89
|
if (process.env.VITE_DEV_SERVER_URL) {
|
|
90
|
-
|
|
91
|
-
return __getWebviewHtml__({ serverUrl: process.env.VITE_DEV_SERVER_URL });
|
|
90
|
+
return __getWebviewHtml__(process.env.VITE_DEV_SERVER_URL);
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
// Tip: Install the es6-string-html VS Code extension to enable code highlighting below
|
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { Options } from 'tsup';
|
|
|
4
4
|
/**
|
|
5
5
|
* vscode extension options. See [tsup](https://tsup.egoist.dev/) and [API Doc](https://paka.dev/npm/tsup) for more information.
|
|
6
6
|
*/
|
|
7
|
-
interface ExtensionOptions extends Omit<Options, 'entry' | 'format' | 'outDir' | 'watch' | 'onSuccess'> {
|
|
7
|
+
interface ExtensionOptions extends Omit<Options, 'entry' | 'format' | 'outDir' | 'watch' | 'onSuccess' | 'skipNodeModulesBundle'> {
|
|
8
8
|
/**
|
|
9
9
|
* The extension entry file.
|
|
10
10
|
* @default "extension/index.ts"
|
|
@@ -19,6 +19,10 @@ interface ExtensionOptions extends Omit<Options, 'entry' | 'format' | 'outDir' |
|
|
|
19
19
|
* The bundle format. Currently only supports cjs.
|
|
20
20
|
*/
|
|
21
21
|
format?: 'cjs';
|
|
22
|
+
/**
|
|
23
|
+
* Skip dependencies and peerDependencies bundle. Default is false.
|
|
24
|
+
*/
|
|
25
|
+
skipNodeModulesBundle?: boolean;
|
|
22
26
|
/**
|
|
23
27
|
* A function that will be executed after the build succeeds.
|
|
24
28
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Options } from 'tsup';
|
|
|
4
4
|
/**
|
|
5
5
|
* vscode extension options. See [tsup](https://tsup.egoist.dev/) and [API Doc](https://paka.dev/npm/tsup) for more information.
|
|
6
6
|
*/
|
|
7
|
-
interface ExtensionOptions extends Omit<Options, 'entry' | 'format' | 'outDir' | 'watch' | 'onSuccess'> {
|
|
7
|
+
interface ExtensionOptions extends Omit<Options, 'entry' | 'format' | 'outDir' | 'watch' | 'onSuccess' | 'skipNodeModulesBundle'> {
|
|
8
8
|
/**
|
|
9
9
|
* The extension entry file.
|
|
10
10
|
* @default "extension/index.ts"
|
|
@@ -19,6 +19,10 @@ interface ExtensionOptions extends Omit<Options, 'entry' | 'format' | 'outDir' |
|
|
|
19
19
|
* The bundle format. Currently only supports cjs.
|
|
20
20
|
*/
|
|
21
21
|
format?: 'cjs';
|
|
22
|
+
/**
|
|
23
|
+
* Skip dependencies and peerDependencies bundle. Default is false.
|
|
24
|
+
*/
|
|
25
|
+
skipNodeModulesBundle?: boolean;
|
|
22
26
|
/**
|
|
23
27
|
* A function that will be executed after the build succeeds.
|
|
24
28
|
*/
|
package/dist/index.js
CHANGED
|
@@ -101,7 +101,7 @@ function getPkg() {
|
|
|
101
101
|
return pkg;
|
|
102
102
|
}
|
|
103
103
|
function preMergeOptions(options) {
|
|
104
|
-
getPkg();
|
|
104
|
+
const pkg = getPkg();
|
|
105
105
|
const opts = _lodashmerge2.default.call(void 0,
|
|
106
106
|
{
|
|
107
107
|
webview: true,
|
|
@@ -115,11 +115,12 @@ function preMergeOptions(options) {
|
|
|
115
115
|
shims: true,
|
|
116
116
|
clean: true,
|
|
117
117
|
dts: false,
|
|
118
|
-
treeshake:
|
|
118
|
+
treeshake: isDev ? false : "smallest",
|
|
119
119
|
outExtension() {
|
|
120
120
|
return { js: ".js" };
|
|
121
121
|
},
|
|
122
|
-
external: ["vscode"]
|
|
122
|
+
external: ["vscode"],
|
|
123
|
+
skipNodeModulesBundle: isDev
|
|
123
124
|
}
|
|
124
125
|
},
|
|
125
126
|
_lodashclonedeep2.default.call(void 0, options)
|
|
@@ -139,6 +140,11 @@ function preMergeOptions(options) {
|
|
|
139
140
|
opt.external = ["vscode", WEBVIEW_PACKAGE_NAME].concat(
|
|
140
141
|
_nullishCoalesce(opt.external, () => ( []))
|
|
141
142
|
);
|
|
143
|
+
if (!opt.skipNodeModulesBundle) {
|
|
144
|
+
opt.noExternal = Object.keys(pkg.dependencies || {}).concat(
|
|
145
|
+
Object.keys(pkg.peerDependencies || {})
|
|
146
|
+
);
|
|
147
|
+
}
|
|
142
148
|
opts.extension = opt;
|
|
143
149
|
if (opts.webview === true) {
|
|
144
150
|
opts.webview = WEBVIEW_METHOD_NAME;
|
package/dist/index.mjs
CHANGED
|
@@ -100,7 +100,7 @@ function getPkg() {
|
|
|
100
100
|
return pkg;
|
|
101
101
|
}
|
|
102
102
|
function preMergeOptions(options) {
|
|
103
|
-
getPkg();
|
|
103
|
+
const pkg = getPkg();
|
|
104
104
|
const opts = merge(
|
|
105
105
|
{
|
|
106
106
|
webview: true,
|
|
@@ -114,11 +114,12 @@ function preMergeOptions(options) {
|
|
|
114
114
|
shims: true,
|
|
115
115
|
clean: true,
|
|
116
116
|
dts: false,
|
|
117
|
-
treeshake:
|
|
117
|
+
treeshake: isDev ? false : "smallest",
|
|
118
118
|
outExtension() {
|
|
119
119
|
return { js: ".js" };
|
|
120
120
|
},
|
|
121
|
-
external: ["vscode"]
|
|
121
|
+
external: ["vscode"],
|
|
122
|
+
skipNodeModulesBundle: isDev
|
|
122
123
|
}
|
|
123
124
|
},
|
|
124
125
|
cloneDeep(options)
|
|
@@ -138,6 +139,11 @@ function preMergeOptions(options) {
|
|
|
138
139
|
opt.external = ["vscode", WEBVIEW_PACKAGE_NAME].concat(
|
|
139
140
|
opt.external ?? []
|
|
140
141
|
);
|
|
142
|
+
if (!opt.skipNodeModulesBundle) {
|
|
143
|
+
opt.noExternal = Object.keys(pkg.dependencies || {}).concat(
|
|
144
|
+
Object.keys(pkg.peerDependencies || {})
|
|
145
|
+
);
|
|
146
|
+
}
|
|
141
147
|
opts.extension = opt;
|
|
142
148
|
if (opts.webview === true) {
|
|
143
149
|
opts.webview = WEBVIEW_METHOD_NAME;
|
package/env.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export {}; // Make this a module
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
/**
|
|
5
|
+
* fix code hint
|
|
6
|
+
*/
|
|
7
|
+
type UnionType<T> = T | (string & {});
|
|
8
|
+
|
|
9
|
+
namespace NodeJS {
|
|
10
|
+
interface ProcessEnv {
|
|
11
|
+
/**
|
|
12
|
+
* Node.js environment
|
|
13
|
+
*/
|
|
14
|
+
NODE_ENV: UnionType<'development' | 'production'>;
|
|
15
|
+
/**
|
|
16
|
+
* `[vite serve]` The url of the vite dev server.
|
|
17
|
+
*/
|
|
18
|
+
VITE_DEV_SERVER_URL?: string;
|
|
19
|
+
/**
|
|
20
|
+
* `[vite build]` All js files in the dist directory, excluding index.js. It's to be a json string.
|
|
21
|
+
*/
|
|
22
|
+
VITE_DIST_FILES?: string;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* `[vite serve]` Get the html of the development webview.
|
|
28
|
+
* @param options serverUrl: The url of the vite dev server.
|
|
29
|
+
*/
|
|
30
|
+
function __getWebviewHtml__(options?: string | { serverUrl: string }): string;
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomjs/vite-plugin-vscode",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "The vite plugin for vscode extension, supports esm and cjs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
|
-
"dist"
|
|
30
|
+
"dist",
|
|
31
|
+
"env.d.ts"
|
|
31
32
|
],
|
|
32
33
|
"engines": {
|
|
33
34
|
"node": ">=16"
|
|
@@ -49,22 +50,22 @@
|
|
|
49
50
|
"tsup": "7.2.0"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@commitlint/cli": "^18.4.
|
|
53
|
-
"@tomjs/commitlint": "^2.1.
|
|
54
|
-
"@tomjs/eslint": "^1.2.
|
|
53
|
+
"@commitlint/cli": "^18.4.4",
|
|
54
|
+
"@tomjs/commitlint": "^2.1.2",
|
|
55
|
+
"@tomjs/eslint": "^1.2.2",
|
|
55
56
|
"@tomjs/prettier": "^1.1.1",
|
|
56
|
-
"@tomjs/stylelint": "^2.
|
|
57
|
-
"@tomjs/tsconfig": "^1.
|
|
57
|
+
"@tomjs/stylelint": "^2.2.0",
|
|
58
|
+
"@tomjs/tsconfig": "^1.3.0",
|
|
58
59
|
"@types/lodash.clonedeep": "^4.5.9",
|
|
59
60
|
"@types/lodash.merge": "^4.6.9",
|
|
60
|
-
"@types/node": "^18.19.
|
|
61
|
+
"@types/node": "^18.19.7",
|
|
61
62
|
"cross-env": "^7.0.3",
|
|
62
63
|
"eslint": "^8.56.0",
|
|
63
64
|
"husky": "^8.0.3",
|
|
64
65
|
"lint-staged": "^15.2.0",
|
|
65
66
|
"np": "^9.2.0",
|
|
66
67
|
"npm-run-all": "^4.1.5",
|
|
67
|
-
"prettier": "^3.
|
|
68
|
+
"prettier": "^3.2.2",
|
|
68
69
|
"rimraf": "^5.0.5",
|
|
69
70
|
"stylelint": "^16.1.0",
|
|
70
71
|
"tsx": "^4.7.0",
|