@tomjs/vite-plugin-vscode 1.4.0 → 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/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: !!isDev,
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: !!isDev,
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomjs/vite-plugin-vscode",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "The vite plugin for vscode extension, supports esm and cjs.",
5
5
  "keywords": [
6
6
  "vite",