@tomjs/vite-plugin-electron 1.1.1 → 1.1.2

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 CHANGED
@@ -199,7 +199,6 @@ Based on [Options](https://paka.dev/npm/tsup) of [tsup](https://tsup.egoist.dev/
199
199
 
200
200
  | Property | Type | Default | Description |
201
201
  | --- | --- | --- | --- |
202
- | name | `string` | "main" | The name of the electron main process. |
203
202
  | entry | `string` | `-` | The main process entry file. |
204
203
  | format | `'cjs' \| 'esm'` | `-` | The bundle format. If not specified, it will use the "type" field from package.json. |
205
204
  | outDir | `string` | "dist-electron/main" | The output directory for the main process files |
@@ -211,7 +210,6 @@ Based on [Options](https://paka.dev/npm/tsup) of [tsup](https://tsup.egoist.dev/
211
210
 
212
211
  | Property | Type | Default | Description |
213
212
  | --- | --- | --- | --- |
214
- | name | `string` | "preload" | The name of the electron preload process. |
215
213
  | entry | `string` | `-` | The preload process entry file. |
216
214
  | format | `'cjs' \| 'esm'` | `-` | The bundle format. If not specified, it will use the "type" field from package.json. |
217
215
  | outDir | `string` | "dist-electron/preload" | The output directory for the preload process files |
package/README.zh_CN.md CHANGED
@@ -200,7 +200,6 @@ export default defineConfig({
200
200
 
201
201
  | 参数名 | 类型 | 默认值 | 说明 |
202
202
  | --- | --- | --- | --- |
203
- | name | `string` | "main" | main 名称 |
204
203
  | **entry** | `string` | `-` | main 入口文件 |
205
204
  | format | `'cjs' \| 'esm'` | `-` | 打包格式。如果未指定,将使用 package.json 中的 "type" 字段 |
206
205
  | outDir | `string` | `"dist-electron/main"` | main 输出文件夹 |
@@ -212,7 +211,6 @@ export default defineConfig({
212
211
 
213
212
  | 参数名 | 类型 | 默认值 | 说明 |
214
213
  | --- | --- | --- | --- |
215
- | name | `string` | "preload" | preload 名称 |
216
214
  | **entry** | `string` | `-` | preload 入口文件 |
217
215
  | format | `'cjs' \| 'esm'` | `-` | 打包格式。如果未指定,将使用 package.json 中的 "type" 字段 |
218
216
  | outDir | `string` | `"dist-electron/preload"` | preload 输出文件夹 |
package/dist/index.d.mts CHANGED
@@ -4,7 +4,7 @@ import { Options } from 'tsup';
4
4
  /**
5
5
  * Electron main process options
6
6
  */
7
- type MainOptions = Omit<Options, 'name' | 'entry' | 'format' | 'outDir' | 'watch' | 'onSuccess'> & {
7
+ interface MainOptions extends Omit<Options, 'name' | 'entry' | 'format' | 'outDir' | 'watch' | 'onSuccess'> {
8
8
  /**
9
9
  * The name of the electron main process.
10
10
  * @default "main"
@@ -27,11 +27,11 @@ type MainOptions = Omit<Options, 'name' | 'entry' | 'format' | 'outDir' | 'watch
27
27
  * A function that will be executed after the build succeeds.
28
28
  */
29
29
  onSuccess?: () => Promise<void | undefined | (() => void | Promise<void>)>;
30
- };
30
+ }
31
31
  /**
32
32
  * Electron preload process options
33
33
  */
34
- type PreloadOptions = Omit<Options, 'name' | 'entry' | 'format' | 'outDir' | 'watch' | 'onSuccess'> & {
34
+ interface PreloadOptions extends Omit<Options, 'name' | 'entry' | 'format' | 'outDir' | 'watch' | 'onSuccess'> {
35
35
  /**
36
36
  * The name of the electron preload process.
37
37
  * @default "preload"
@@ -54,7 +54,7 @@ type PreloadOptions = Omit<Options, 'name' | 'entry' | 'format' | 'outDir' | 'wa
54
54
  * A function that will be executed after the build succeeds.
55
55
  */
56
56
  onSuccess?: () => Promise<void | undefined | (() => void | Promise<void>)>;
57
- };
57
+ }
58
58
  /**
59
59
  * vite plugin options
60
60
  */
@@ -84,7 +84,28 @@ interface PluginOptions {
84
84
  */
85
85
  inspect?: boolean;
86
86
  }
87
+ /**
88
+ * Only used internally
89
+ */
90
+ interface InnerOptions {
91
+ /**
92
+ * whether is vite server
93
+ */
94
+ isServer?: boolean;
95
+ /**
96
+ * vite server url, will be passed to electron
97
+ */
98
+ serverUrl?: string;
99
+ /**
100
+ * renderer outDir
101
+ */
102
+ rendererOutDir?: string;
103
+ /**
104
+ * electron main entry file
105
+ */
106
+ mainFile?: string;
107
+ }
87
108
 
88
109
  declare function vitePluginElectron(options?: PluginOptions): Plugin;
89
110
 
90
- export { vitePluginElectron as default, vitePluginElectron };
111
+ export { InnerOptions, MainOptions, PluginOptions, PreloadOptions, vitePluginElectron as default, vitePluginElectron };
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { Options } from 'tsup';
4
4
  /**
5
5
  * Electron main process options
6
6
  */
7
- type MainOptions = Omit<Options, 'name' | 'entry' | 'format' | 'outDir' | 'watch' | 'onSuccess'> & {
7
+ interface MainOptions extends Omit<Options, 'name' | 'entry' | 'format' | 'outDir' | 'watch' | 'onSuccess'> {
8
8
  /**
9
9
  * The name of the electron main process.
10
10
  * @default "main"
@@ -27,11 +27,11 @@ type MainOptions = Omit<Options, 'name' | 'entry' | 'format' | 'outDir' | 'watch
27
27
  * A function that will be executed after the build succeeds.
28
28
  */
29
29
  onSuccess?: () => Promise<void | undefined | (() => void | Promise<void>)>;
30
- };
30
+ }
31
31
  /**
32
32
  * Electron preload process options
33
33
  */
34
- type PreloadOptions = Omit<Options, 'name' | 'entry' | 'format' | 'outDir' | 'watch' | 'onSuccess'> & {
34
+ interface PreloadOptions extends Omit<Options, 'name' | 'entry' | 'format' | 'outDir' | 'watch' | 'onSuccess'> {
35
35
  /**
36
36
  * The name of the electron preload process.
37
37
  * @default "preload"
@@ -54,7 +54,7 @@ type PreloadOptions = Omit<Options, 'name' | 'entry' | 'format' | 'outDir' | 'wa
54
54
  * A function that will be executed after the build succeeds.
55
55
  */
56
56
  onSuccess?: () => Promise<void | undefined | (() => void | Promise<void>)>;
57
- };
57
+ }
58
58
  /**
59
59
  * vite plugin options
60
60
  */
@@ -84,7 +84,28 @@ interface PluginOptions {
84
84
  */
85
85
  inspect?: boolean;
86
86
  }
87
+ /**
88
+ * Only used internally
89
+ */
90
+ interface InnerOptions {
91
+ /**
92
+ * whether is vite server
93
+ */
94
+ isServer?: boolean;
95
+ /**
96
+ * vite server url, will be passed to electron
97
+ */
98
+ serverUrl?: string;
99
+ /**
100
+ * renderer outDir
101
+ */
102
+ rendererOutDir?: string;
103
+ /**
104
+ * electron main entry file
105
+ */
106
+ mainFile?: string;
107
+ }
87
108
 
88
109
  declare function vitePluginElectron(options?: PluginOptions): Plugin;
89
110
 
90
- export { vitePluginElectron as default, vitePluginElectron };
111
+ export { InnerOptions, MainOptions, PluginOptions, PreloadOptions, vitePluginElectron as default, vitePluginElectron };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomjs/vite-plugin-electron",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "A simple vite plugin for electron, supports esm/cjs.",
5
5
  "keywords": [
6
6
  "vite",