electron-incremental-update 1.0.3 → 1.2.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/vite.d.ts CHANGED
@@ -1,9 +1,17 @@
1
- import * as vite from 'vite';
2
1
  import { Plugin } from 'vite';
3
2
  import { ElectronSimpleOptions } from 'vite-plugin-electron/simple';
4
3
  import { Promisable } from '@subframe7536/type-utils';
5
4
  import { BuildOptions } from 'esbuild';
6
- import { a as UpdateJSON } from './noDep-TvZoKVF8.js';
5
+
6
+ type UpdateInfo = {
7
+ signature: string;
8
+ minimumVersion: string;
9
+ version: string;
10
+ size: number;
11
+ };
12
+ type UpdateJSON = UpdateInfo & {
13
+ beta: UpdateInfo;
14
+ };
7
15
 
8
16
  type PKG = {
9
17
  name: string;
@@ -72,6 +80,9 @@ type BuildEntryOption = {
72
80
  * loader: {
73
81
  * '.node': 'empty',
74
82
  * },
83
+ * define: {
84
+ * __SIGNATURE_CERT__: JSON.stringify(cert),
85
+ * },
75
86
  * }
76
87
  * ```
77
88
  */
@@ -86,13 +97,13 @@ type BuildEntryOption = {
86
97
  */
87
98
  getPathFromEntryOutputDir: (...paths: string[]) => string;
88
99
  /**
89
- * copy file to `entryOutputDirPath`
100
+ * check exist and copy file to `entryOutputDirPath`
90
101
  *
91
102
  * if `to` absent, set to `basename(from)`
92
103
  *
93
104
  * if `skipIfExist` absent, skip copy if `to` exist
94
105
  */
95
- existsAndCopyToEntryOutputDir: (options: {
106
+ copyToEntryOutputDir: (options: {
96
107
  from: string;
97
108
  to?: string;
98
109
  /**
@@ -211,6 +222,17 @@ type ElectronUpdaterOptions = {
211
222
  };
212
223
  };
213
224
 
225
+ type BytecodeOptions = {
226
+ /**
227
+ * strings that should be transformed
228
+ */
229
+ protectedStrings?: string[];
230
+ /**
231
+ * Remember to set `sandbox: false` when creating window
232
+ */
233
+ enablePreload?: boolean;
234
+ };
235
+
214
236
  type MakeRequired<T, K extends keyof T> = Exclude<T, undefined> & {
215
237
  [P in K]-?: T[P];
216
238
  };
@@ -245,24 +267,30 @@ type ElectronWithUpdaterOptions = {
245
267
  */
246
268
  isBuild: boolean;
247
269
  /**
248
- * name, version and main in `package.json`
270
+ * manually setup package.json, read name, version and main
249
271
  * ```ts
250
272
  * import pkg from './package.json'
251
273
  * ```
252
274
  */
253
- pkg: PKG;
275
+ pkg?: PKG;
254
276
  /**
255
- * main options
277
+ * whether to generate sourcemap
278
+ * @default !isBuild
256
279
  */
257
- main: MakeRequiredAndReplaceKey<ElectronSimpleOptions['main'], 'entry', 'files'>;
280
+ sourcemap?: boolean;
258
281
  /**
259
- * preload options
282
+ * whether to minify the code
283
+ * @default isBuild
260
284
  */
261
- preload: MakeRequiredAndReplaceKey<Exclude<ElectronSimpleOptions['preload'], undefined>, 'input', 'files'>;
285
+ minify?: boolean;
262
286
  /**
263
- * updater options
287
+ * whether to generate bytecode
288
+ *
289
+ * **only support commonjs**
290
+ *
291
+ * only main process by default, if you want to use in preload script, please use `electronWithUpdater({ bytecode: { enablePreload: true } })` and set `sandbox: false` when creating window
264
292
  */
265
- updater?: ElectronUpdaterOptions;
293
+ bytecode?: boolean | BytecodeOptions;
266
294
  /**
267
295
  * use NotBundle() plugin in main
268
296
  * @default true
@@ -270,10 +298,25 @@ type ElectronWithUpdaterOptions = {
270
298
  useNotBundle?: boolean;
271
299
  /**
272
300
  * Whether to log parsed options
301
+ *
302
+ * to show certificate and private keys, set `logParsedOptions: { showKeys: true }`
303
+ */
304
+ logParsedOptions?: boolean | {
305
+ showKeys: boolean;
306
+ };
307
+ /**
308
+ * main options
273
309
  */
274
- logParsedOptions?: boolean;
310
+ main: MakeRequiredAndReplaceKey<ElectronSimpleOptions['main'], 'entry', 'files'>;
311
+ /**
312
+ * preload options
313
+ */
314
+ preload: MakeRequiredAndReplaceKey<Exclude<ElectronSimpleOptions['preload'], undefined>, 'input', 'files'>;
315
+ /**
316
+ * updater options
317
+ */
318
+ updater?: ElectronUpdaterOptions;
275
319
  };
276
- declare const log: vite.Logger;
277
320
  /**
278
321
  * build options for `vite-plugin-electron/simple`
279
322
  * - integrate with updater
@@ -324,6 +367,6 @@ declare const log: vite.Logger;
324
367
  * }
325
368
  * })
326
369
  */
327
- declare function electronWithUpdater(options: ElectronWithUpdaterOptions): (Plugin<any> | Promise<Plugin<any>[]> | undefined)[];
370
+ declare function electronWithUpdater(options: ElectronWithUpdaterOptions): Promise<(Plugin<any> | Promise<Plugin<any>[]> | undefined)[] | null>;
328
371
 
329
- export { type ElectronWithUpdaterOptions, debugStartup, electronWithUpdater, log };
372
+ export { type ElectronWithUpdaterOptions, debugStartup, electronWithUpdater };