@tomjs/vite-plugin-electron 1.9.3 → 2.0.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
@@ -1,135 +1,136 @@
1
- import { Plugin } from 'vite';
2
- import { Configuration } from 'electron-builder';
3
- import { Options } from 'tsup';
1
+ import { UserConfig } from "tsdown";
2
+ import { Configuration } from "electron-builder";
3
+ import { Plugin } from "vite";
4
+
5
+ //#region src/types.d.ts
4
6
 
5
7
  /**
6
8
  * Electron main process options. See [tsup](https://tsup.egoist.dev/) and [API Doc](https://www.jsdocs.io/package/tsup) for more information.
7
9
  * @see https://www.jsdocs.io/package/tsup
8
10
  * @see https://unpkg.com/browse/tsup/dist/index.d.ts
9
11
  */
10
- interface MainOptions extends Omit<Options, 'entry' | 'format' | 'outDir' | 'watch' | 'onSuccess'> {
11
- /**
12
- * The main process entry file.
13
- */
14
- entry?: string;
15
- /**
16
- * The bundle format. If not specified, it will use the "type" field from package.json.
17
- */
18
- format?: 'cjs' | 'esm';
19
- /**
20
- * The output directory for the main process files. Defaults to `"dist-electron/main"`.
21
- * @default "dist-electron/main"
22
- */
23
- outDir?: string;
24
- /**
25
- * A function that will be executed after the build succeeds.
26
- */
27
- onSuccess?: () => Promise<void | undefined | (() => void | Promise<void>)>;
12
+ interface MainOptions extends Omit<UserConfig, 'entry' | 'format' | 'outDir' | 'watch'> {
13
+ /**
14
+ * The main process entry file.
15
+ */
16
+ entry?: string;
17
+ /**
18
+ * The bundle format. If not specified, it will use the "type" field from package.json.
19
+ */
20
+ format?: 'cjs' | 'esm';
21
+ /**
22
+ * The output directory for the main process files. Defaults to `"dist-electron/main"`.
23
+ * @default "dist-electron/main"
24
+ */
25
+ outDir?: string;
26
+ /**
27
+ * `tsdown` watches the current working directory by default. You can set files that need to be watched, which may improve performance.
28
+ *
29
+ * If no value is specified, the default value of the "recommended" parameter is ["dist-electron"] when it is true, otherwise 'watch' defaults to "true"
30
+ */
31
+ watchFiles?: string | string[];
28
32
  }
29
33
  /**
30
34
  * Electron preload process options. See [tsup](https://tsup.egoist.dev/) and [API Doc](https://www.jsdocs.io/package/tsup) for more information.
31
35
  * @see https://www.jsdocs.io/package/tsup
32
36
  * @see https://unpkg.com/browse/tsup/dist/index.d.ts
33
37
  */
34
- interface PreloadOptions extends Omit<Options, 'entry' | 'format' | 'outDir' | 'watch' | 'onSuccess'> {
35
- /**
36
- * The preload process entry file
37
- */
38
- entry?: string | string[] | Record<string, string>;
39
- /**
40
- * The bundle format. If not specified, it will use the "type" field from package.json.
41
- */
42
- format?: 'cjs' | 'esm';
43
- /**
44
- * The output directory for the preload process files. Defaults is `"dist-electron/preload"`.
45
- * @default "dist-electron/preload"
46
- */
47
- outDir?: string;
48
- /**
49
- * A function that will be executed after the build succeeds.
50
- */
51
- onSuccess?: () => Promise<void | undefined | (() => void | Promise<void>)>;
38
+ interface PreloadOptions extends Omit<UserConfig, 'entry' | 'format' | 'outDir' | 'watch'> {
39
+ /**
40
+ * The preload process entry file
41
+ */
42
+ entry?: string | string[] | Record<string, string>;
43
+ /**
44
+ * The bundle format. If not specified, it will use the "type" field from package.json.
45
+ */
46
+ format?: 'cjs' | 'esm';
47
+ /**
48
+ * The output directory for the preload process files. Defaults is `"dist-electron/preload"`.
49
+ * @default "dist-electron/preload"
50
+ */
51
+ outDir?: string;
52
+ /**
53
+ * `tsdown` watches the current working directory by default. You can set files that need to be watched, which may improve performance.
54
+ *
55
+ * If no value is specified, the default value of the "recommended" parameter is ["dist-electron"] when it is true, otherwise 'watch' defaults to "true"
56
+ */
57
+ watchFiles?: string | string[];
52
58
  }
53
59
  /**
54
60
  * When `recommended` and `builder.enable` are both `true`, use [electron-builder](https://www.electron.build) to package Electron applications.
55
61
  *
56
- * * In the `build.outDir` directory configured in vite, generate a new package.json based on the configuration and package.json, excluding non-dependencies.
57
- * * Execute `npm install` and then package.
62
+ * In the `build.outDir` directory configured in vite, generate a new package.json based on the configuration and package.json, excluding non-dependencies.
63
+ * Execute `npm install` and then package.
58
64
  */
59
65
  interface BuilderOptions {
60
- /**
61
- * Whether to enable the [electron-builder](https://www.electron.build), the default is false.
62
- * @default false
63
- * @deprecated
64
- */
65
- enable?: boolean;
66
- /**
67
- * The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as
68
- * [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.
69
- * @default com.electron.${name}
70
- */
71
- appId?: string | null;
72
- /**
73
- * As [name](#Metadata-name), but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the [name property](https://docs.npmjs.com/files/package.json#name).
74
- * If not specified inside of the `build` configuration, `productName` property defined at the top level of `package.json` is used. If not specified at the top level of `package.json`, [name property](https://docs.npmjs.com/files/package.json#name) is used.
75
- */
76
- productName?: string | null;
77
- /**
78
- * The [electron-builder](https://www.electron.build/configuration/configuration) configuration.
79
- */
80
- builderConfig?: Configuration;
66
+ /**
67
+ * The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as
68
+ * [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.
69
+ * @default com.electron.${name}
70
+ */
71
+ appId?: string | null;
72
+ /**
73
+ * As [name](#Metadata-name), but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the [name property](https://docs.npmjs.com/files/package.json#name).
74
+ * If not specified inside of the `build` configuration, `productName` property defined at the top level of `package.json` is used. If not specified at the top level of `package.json`, [name property](https://docs.npmjs.com/files/package.json#name) is used.
75
+ */
76
+ productName?: string | null;
77
+ /**
78
+ * The [electron-builder](https://www.electron.build/configuration/configuration) configuration.
79
+ */
80
+ builderConfig?: Configuration;
81
81
  }
82
82
  /**
83
83
  * vite plugin options
84
84
  */
85
85
  interface PluginOptions {
86
- /**
87
- * Recommended switch. Default is true.
88
- * if true, will have the following default behavior:
89
- * * will change the main/preload/renderer outDir to be parallel outDir;
90
- * eg. if vite build.outDir is 'dist', will change main/preload/render to 'dist/main' and 'dist/preload' and 'dist/renderer'
91
- * @default true
92
- */
93
- recommended?: boolean;
94
- /**
95
- * Don't bundle these modules, but dependencies and peerDependencies in your package.json are always excluded. [See more](https://tsup.egoist.dev/#excluding-packages)
96
- * @see https://tsup.egoist.dev/#excluding-packages
97
- */
98
- external?: (string | RegExp)[];
99
- /**
100
- * electron main process options
101
- */
102
- main?: MainOptions;
103
- /**
104
- * electron preload process options
105
- */
106
- preload?: PreloadOptions;
107
- /**
108
- * When `recommended` and `builder.enable` are both `true`, use [electron-builder](https://www.electron.build) to package Electron applications.
109
- *
110
- * * In the `build.outDir` directory configured in vite, generate a new package.json based on the configuration and package.json, excluding non-dependencies.
111
- * * Execute `npm install` and then package.
112
- */
113
- builder?: boolean | BuilderOptions;
114
- /**
115
- * electron debug mode, don't startup electron. You can also use `process.env.VITE_ELECTRON_DEBUG`. Default is false.
116
- * @default false
117
- */
118
- debug?: boolean;
119
- /**
120
- * Electron will listen for V8 inspector protocol messages on the specified port, an external debugger will need to connect on this port.
121
- * You can also use `process.env.VITE_ELECTRON_INSPECT`. See [debugging-main-process](https://www.electronjs.org/docs/latest/tutorial/debugging-main-process) for more information.
122
- * The default port is false.
123
- * @see https://www.electronjs.org/docs/latest/tutorial/debugging-main-process
124
- * @default false
125
- */
126
- inspect?: number | boolean;
86
+ /**
87
+ * Recommended switch. Default is true.
88
+ * if true, will have the following default behavior:
89
+ * will change the main/preload/renderer outDir to be parallel outDir;
90
+ * eg. if vite build.outDir is 'dist', will change main/preload/render to 'dist/main' and 'dist/preload' and 'dist/renderer'
91
+ * @default true
92
+ */
93
+ recommended?: boolean;
94
+ /**
95
+ * Don't bundle these modules, but dependencies and peerDependencies in your package.json are always excluded. [See more](https://tsup.egoist.dev/#excluding-packages)
96
+ * @see https://tsup.egoist.dev/#excluding-packages
97
+ */
98
+ external?: (string | RegExp)[];
99
+ /**
100
+ * electron main process options
101
+ */
102
+ main?: MainOptions;
103
+ /**
104
+ * electron preload process options
105
+ */
106
+ preload?: PreloadOptions;
107
+ /**
108
+ * When `recommended` and `builder.enable` are both `true`, use [electron-builder](https://www.electron.build) to package Electron applications.
109
+ *
110
+ * In the `build.outDir` directory configured in vite, generate a new package.json based on the configuration and package.json, excluding non-dependencies.
111
+ * Execute `npm install` and then package.
112
+ */
113
+ builder?: boolean | BuilderOptions;
114
+ /**
115
+ * electron debug mode, don't startup electron. You can also use `process.env.VITE_ELECTRON_DEBUG`. Default is false.
116
+ * @default false
117
+ */
118
+ debug?: boolean;
119
+ /**
120
+ * Electron will listen for V8 inspector protocol messages on the specified port, an external debugger will need to connect on this port.
121
+ * You can also use `process.env.VITE_ELECTRON_INSPECT`. See [debugging-main-process](https://www.electronjs.org/docs/latest/tutorial/debugging-main-process) for more information.
122
+ * The default port is false.
123
+ * @see https://www.electronjs.org/docs/latest/tutorial/debugging-main-process
124
+ * @default false
125
+ */
126
+ inspect?: number | boolean;
127
127
  }
128
-
128
+ //#endregion
129
+ //#region src/index.d.ts
129
130
  /**
130
131
  * A simple vite plugin for electron
131
132
  * @param options
132
133
  */
133
134
  declare function useElectronPlugin(options?: PluginOptions): Plugin;
134
-
135
- export { BuilderOptions, MainOptions, PluginOptions, PreloadOptions, useElectronPlugin as default, useElectronPlugin };
135
+ //#endregion
136
+ export { BuilderOptions, MainOptions, PluginOptions, PreloadOptions, useElectronPlugin as default, useElectronPlugin };