electron-incremental-update 2.0.0-beta.5 → 2.0.0-beta.6
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/{chunk-JSYIRKTR.js → chunk-N77WQ5WB.js} +8 -6
- package/dist/index.cjs +7 -7
- package/dist/index.js +7 -7
- package/dist/provider.cjs +13 -10
- package/dist/provider.js +7 -6
- package/dist/utils.cjs +13 -6
- package/dist/utils.js +2 -1
- package/dist/vite.js +1 -1
- package/package.json +1 -1
- package/dist/core-CXETH_bb.d.ts +0 -134
- package/dist/core-DmU2Vk_S.d.cts +0 -134
- package/dist/index.d.cts +0 -78
- package/dist/index.d.ts +0 -78
- package/dist/provider.d.cts +0 -65
- package/dist/provider.d.ts +0 -65
- package/dist/types-C5P0h_bB.d.cts +0 -103
- package/dist/types-C5P0h_bB.d.ts +0 -103
- package/dist/utils.d.cts +0 -80
- package/dist/utils.d.ts +0 -80
- package/dist/vite.d.ts +0 -401
- package/dist/zip-WRrEMkgp.d.cts +0 -10
- package/dist/zip-WRrEMkgp.d.ts +0 -10
package/dist/vite.d.ts
DELETED
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
import { PluginOption } from 'vite';
|
|
2
|
-
import { ElectronSimpleOptions } from 'vite-plugin-electron/simple';
|
|
3
|
-
import { Promisable } from '@subframe7536/type-utils';
|
|
4
|
-
import { BuildOptions } from 'esbuild';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* update info json
|
|
8
|
-
*/
|
|
9
|
-
type UpdateInfo = {
|
|
10
|
-
signature: string;
|
|
11
|
-
minimumVersion: string;
|
|
12
|
-
version: string;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* {@link UpdateInfo} with beta
|
|
16
|
-
*/
|
|
17
|
-
type UpdateJSON = UpdateInfo & {
|
|
18
|
-
beta: UpdateInfo;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
interface PKG {
|
|
22
|
-
name: string;
|
|
23
|
-
version: string;
|
|
24
|
-
main: string;
|
|
25
|
-
}
|
|
26
|
-
interface DistinguishedName {
|
|
27
|
-
countryName?: string;
|
|
28
|
-
stateOrProvinceName?: string;
|
|
29
|
-
localityName?: string;
|
|
30
|
-
organizationName?: string;
|
|
31
|
-
organizationalUnitName?: string;
|
|
32
|
-
commonName?: string;
|
|
33
|
-
serialNumber?: string;
|
|
34
|
-
title?: string;
|
|
35
|
-
description?: string;
|
|
36
|
-
businessCategory?: string;
|
|
37
|
-
emailAddress?: string;
|
|
38
|
-
}
|
|
39
|
-
interface BuildEntryOption {
|
|
40
|
-
/**
|
|
41
|
-
* whether to minify
|
|
42
|
-
* @default isBuild
|
|
43
|
-
*/
|
|
44
|
-
minify?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* whether to generate sourcemap
|
|
47
|
-
* @default isBuild
|
|
48
|
-
*/
|
|
49
|
-
sourcemap?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* path to app entry output file
|
|
52
|
-
* @default 'dist-entry'
|
|
53
|
-
*/
|
|
54
|
-
entryOutputDirPath?: string;
|
|
55
|
-
/**
|
|
56
|
-
* path to app entry file
|
|
57
|
-
* @default 'electron/entry.ts'
|
|
58
|
-
*/
|
|
59
|
-
appEntryPath?: string;
|
|
60
|
-
/**
|
|
61
|
-
* esbuild path map of native modules in entry directory
|
|
62
|
-
*
|
|
63
|
-
* @default {}
|
|
64
|
-
* @example
|
|
65
|
-
* { db: './electron/native/db.ts' }
|
|
66
|
-
*/
|
|
67
|
-
nativeModuleEntryMap?: Record<string, string>;
|
|
68
|
-
/**
|
|
69
|
-
* custom options for esbuild
|
|
70
|
-
* ```ts
|
|
71
|
-
* // default options
|
|
72
|
-
* const options = {
|
|
73
|
-
* entryPoints: {
|
|
74
|
-
* entry: appEntryPath,
|
|
75
|
-
* ...moduleEntryMap,
|
|
76
|
-
* },
|
|
77
|
-
* bundle: true,
|
|
78
|
-
* platform: 'node',
|
|
79
|
-
* outdir: entryOutputDirPath,
|
|
80
|
-
* minify,
|
|
81
|
-
* sourcemap,
|
|
82
|
-
* entryNames: '[dir]/[name]',
|
|
83
|
-
* assetNames: '[dir]/[name]',
|
|
84
|
-
* external: ['electron', 'original-fs'],
|
|
85
|
-
* loader: {
|
|
86
|
-
* '.node': 'empty',
|
|
87
|
-
* },
|
|
88
|
-
* define: {
|
|
89
|
-
* __SIGNATURE_CERT__: JSON.stringify(cert),
|
|
90
|
-
* },
|
|
91
|
-
* }
|
|
92
|
-
* ```
|
|
93
|
-
*/
|
|
94
|
-
overrideEsbuildOptions?: BuildOptions;
|
|
95
|
-
/**
|
|
96
|
-
* resolve extra files on startup, such as `.node`
|
|
97
|
-
* @remark won't trigger will reload
|
|
98
|
-
*/
|
|
99
|
-
postBuild?: (args: {
|
|
100
|
-
/**
|
|
101
|
-
* get path from `entryOutputDirPath`
|
|
102
|
-
*/
|
|
103
|
-
getPathFromEntryOutputDir: (...paths: string[]) => string;
|
|
104
|
-
/**
|
|
105
|
-
* check exist and copy file to `entryOutputDirPath`
|
|
106
|
-
*
|
|
107
|
-
* if `to` absent, set to `basename(from)`
|
|
108
|
-
*
|
|
109
|
-
* if `skipIfExist` absent, skip copy if `to` exist
|
|
110
|
-
*/
|
|
111
|
-
copyToEntryOutputDir: (options: {
|
|
112
|
-
from: string;
|
|
113
|
-
to?: string;
|
|
114
|
-
/**
|
|
115
|
-
* skip copy if `to` exist
|
|
116
|
-
* @default true
|
|
117
|
-
*/
|
|
118
|
-
skipIfExist?: boolean;
|
|
119
|
-
}) => void;
|
|
120
|
-
}) => Promisable<void>;
|
|
121
|
-
}
|
|
122
|
-
interface GeneratorOverrideFunctions {
|
|
123
|
-
/**
|
|
124
|
-
* custom signature generate function
|
|
125
|
-
* @param buffer file buffer
|
|
126
|
-
* @param privateKey private key
|
|
127
|
-
* @param cert certificate string, **EOL must be '\n'**
|
|
128
|
-
* @param version current version
|
|
129
|
-
*/
|
|
130
|
-
generateSignature?: (buffer: Buffer, privateKey: string, cert: string, version: string) => string | Promise<string>;
|
|
131
|
-
/**
|
|
132
|
-
* custom generate version json function
|
|
133
|
-
* @param existingJson The existing JSON object.
|
|
134
|
-
* @param buffer file buffer
|
|
135
|
-
* @param signature generated signature
|
|
136
|
-
* @param version current version
|
|
137
|
-
* @param minVersion The minimum version
|
|
138
|
-
* @returns The updated version json
|
|
139
|
-
*/
|
|
140
|
-
generateVersionJson?: (existingJson: UpdateJSON, signature: string, version: string, minVersion: string) => UpdateJSON | Promise<UpdateJSON>;
|
|
141
|
-
/**
|
|
142
|
-
* custom generate zip file buffer
|
|
143
|
-
* @param buffer source buffer
|
|
144
|
-
*/
|
|
145
|
-
generateGzipFile?: (buffer: Buffer) => Promise<Buffer>;
|
|
146
|
-
}
|
|
147
|
-
interface ElectronUpdaterOptions {
|
|
148
|
-
/**
|
|
149
|
-
* mini version of entry
|
|
150
|
-
* @default '0.0.0'
|
|
151
|
-
*/
|
|
152
|
-
minimumVersion?: string;
|
|
153
|
-
/**
|
|
154
|
-
* config for entry (app.asar)
|
|
155
|
-
*/
|
|
156
|
-
entry?: BuildEntryOption;
|
|
157
|
-
/**
|
|
158
|
-
* paths config
|
|
159
|
-
*/
|
|
160
|
-
paths?: {
|
|
161
|
-
/**
|
|
162
|
-
* Path to asar file
|
|
163
|
-
* @default `release/${app.name}.asar`
|
|
164
|
-
*/
|
|
165
|
-
asarOutputPath?: string;
|
|
166
|
-
/**
|
|
167
|
-
* Path to version info output, content is {@link UpdateJSON}
|
|
168
|
-
* @default `version.json`
|
|
169
|
-
*/
|
|
170
|
-
versionPath?: string;
|
|
171
|
-
/**
|
|
172
|
-
* Path to gzipped asar file
|
|
173
|
-
* @default `release/${app.name}-${version}.asar.gz`
|
|
174
|
-
*/
|
|
175
|
-
gzipPath?: string;
|
|
176
|
-
/**
|
|
177
|
-
* Path to electron build output
|
|
178
|
-
* @default `dist-electron`
|
|
179
|
-
*/
|
|
180
|
-
electronDistPath?: string;
|
|
181
|
-
/**
|
|
182
|
-
* Path to renderer build output
|
|
183
|
-
* @default `dist`
|
|
184
|
-
*/
|
|
185
|
-
rendererDistPath?: string;
|
|
186
|
-
};
|
|
187
|
-
/**
|
|
188
|
-
* signature config
|
|
189
|
-
*/
|
|
190
|
-
keys?: {
|
|
191
|
-
/**
|
|
192
|
-
* path to the pem file that contains private key
|
|
193
|
-
* if not ended with .pem, it will be appended
|
|
194
|
-
*
|
|
195
|
-
* **if `UPDATER_PK` is set, will read it instead of read from `privateKeyPath`**
|
|
196
|
-
* @default 'keys/private.pem'
|
|
197
|
-
*/
|
|
198
|
-
privateKeyPath?: string;
|
|
199
|
-
/**
|
|
200
|
-
* path to the pem file that contains public key
|
|
201
|
-
* if not ended with .pem, it will be appended
|
|
202
|
-
*
|
|
203
|
-
* **if `UPDATER_CERT` is set, will read it instead of read from `certPath`**
|
|
204
|
-
* @default 'keys/cert.pem'
|
|
205
|
-
*/
|
|
206
|
-
certPath?: string;
|
|
207
|
-
/**
|
|
208
|
-
* length of the key
|
|
209
|
-
* @default 2048
|
|
210
|
-
*/
|
|
211
|
-
keyLength?: number;
|
|
212
|
-
/**
|
|
213
|
-
* X509 certificate info
|
|
214
|
-
*
|
|
215
|
-
* only generate simple **self-signed** certificate **without extensions**
|
|
216
|
-
*/
|
|
217
|
-
certInfo?: {
|
|
218
|
-
/**
|
|
219
|
-
* the subject of the certificate
|
|
220
|
-
*
|
|
221
|
-
* @default { commonName: `${app.name}`, organizationName: `org.${app.name}` }
|
|
222
|
-
*/
|
|
223
|
-
subject?: DistinguishedName;
|
|
224
|
-
/**
|
|
225
|
-
* expire days of the certificate
|
|
226
|
-
*
|
|
227
|
-
* @default 3650
|
|
228
|
-
*/
|
|
229
|
-
days?: number;
|
|
230
|
-
};
|
|
231
|
-
};
|
|
232
|
-
overrideGenerator?: GeneratorOverrideFunctions;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
interface BytecodeOptions {
|
|
236
|
-
/**
|
|
237
|
-
* strings that should be transformed
|
|
238
|
-
*/
|
|
239
|
-
protectedStrings?: string[];
|
|
240
|
-
/**
|
|
241
|
-
* Remember to set `sandbox: false` when creating window
|
|
242
|
-
*/
|
|
243
|
-
enablePreload?: boolean;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
type MakeRequired<T, K extends keyof T> = Exclude<T, undefined> & {
|
|
247
|
-
[P in K]-?: T[P];
|
|
248
|
-
};
|
|
249
|
-
type ReplaceKey<T, Key extends keyof T, NewKey extends string> = Omit<T, Key> & {
|
|
250
|
-
[P in NewKey]: T[Key];
|
|
251
|
-
};
|
|
252
|
-
type MakeRequiredAndReplaceKey<T, K extends keyof T, NewKey extends string> = MakeRequired<ReplaceKey<T, K, NewKey>, NewKey>;
|
|
253
|
-
/**
|
|
254
|
-
* startup function for debug (see {@link https://github.com/electron-vite/electron-vite-vue/blob/main/vite.config.ts electron-vite-vue template})
|
|
255
|
-
* @example
|
|
256
|
-
* import { debugStartup, buildElectronPluginOptions } from 'electron-incremental-update/vite'
|
|
257
|
-
* const options = buildElectronPluginOptions({
|
|
258
|
-
* // ...
|
|
259
|
-
* main: {
|
|
260
|
-
* // ...
|
|
261
|
-
* startup: debugStartup
|
|
262
|
-
* },
|
|
263
|
-
* })
|
|
264
|
-
*/
|
|
265
|
-
declare function debugStartup(args: {
|
|
266
|
-
startup: (argv?: string[]) => Promise<void>;
|
|
267
|
-
reload: () => void;
|
|
268
|
-
}): void;
|
|
269
|
-
type ExcludeOutputDirOptions = {
|
|
270
|
-
vite?: {
|
|
271
|
-
build?: {
|
|
272
|
-
outDir: never;
|
|
273
|
-
rollupOptions?: {
|
|
274
|
-
output?: {
|
|
275
|
-
dir: never;
|
|
276
|
-
};
|
|
277
|
-
};
|
|
278
|
-
};
|
|
279
|
-
};
|
|
280
|
-
};
|
|
281
|
-
interface ElectronWithUpdaterOptions {
|
|
282
|
-
/**
|
|
283
|
-
* whether is in build mode
|
|
284
|
-
* ```ts
|
|
285
|
-
* export default defineConfig(({ command }) => {
|
|
286
|
-
* const isBuild = command === 'build'
|
|
287
|
-
* })
|
|
288
|
-
* ```
|
|
289
|
-
*/
|
|
290
|
-
isBuild: boolean;
|
|
291
|
-
/**
|
|
292
|
-
* manually setup package.json, read name, version and main
|
|
293
|
-
* ```ts
|
|
294
|
-
* import pkg from './package.json'
|
|
295
|
-
* ```
|
|
296
|
-
*/
|
|
297
|
-
pkg?: PKG;
|
|
298
|
-
/**
|
|
299
|
-
* whether to generate sourcemap
|
|
300
|
-
* @default !isBuild
|
|
301
|
-
*/
|
|
302
|
-
sourcemap?: boolean;
|
|
303
|
-
/**
|
|
304
|
-
* whether to minify the code
|
|
305
|
-
* @default isBuild
|
|
306
|
-
*/
|
|
307
|
-
minify?: boolean;
|
|
308
|
-
/**
|
|
309
|
-
* whether to generate bytecode
|
|
310
|
-
*
|
|
311
|
-
* **only support commonjs**
|
|
312
|
-
*
|
|
313
|
-
* 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
|
|
314
|
-
*/
|
|
315
|
-
bytecode?: boolean | BytecodeOptions;
|
|
316
|
-
/**
|
|
317
|
-
* use NotBundle() plugin in main
|
|
318
|
-
* @default true
|
|
319
|
-
*/
|
|
320
|
-
useNotBundle?: boolean;
|
|
321
|
-
/**
|
|
322
|
-
* whether to generate version json
|
|
323
|
-
* @default isCI
|
|
324
|
-
*/
|
|
325
|
-
buildVersionJson?: boolean;
|
|
326
|
-
/**
|
|
327
|
-
* Whether to log parsed options
|
|
328
|
-
*
|
|
329
|
-
* to show certificate and private keys, set `logParsedOptions: { showKeys: true }`
|
|
330
|
-
*/
|
|
331
|
-
logParsedOptions?: boolean | {
|
|
332
|
-
showKeys: boolean;
|
|
333
|
-
};
|
|
334
|
-
/**
|
|
335
|
-
* main process options
|
|
336
|
-
*
|
|
337
|
-
* to change output directories, use `options.updater.paths.electronDistPath` instead
|
|
338
|
-
*/
|
|
339
|
-
main: MakeRequiredAndReplaceKey<ElectronSimpleOptions['main'], 'entry', 'files'> & ExcludeOutputDirOptions;
|
|
340
|
-
/**
|
|
341
|
-
* preload process options
|
|
342
|
-
*
|
|
343
|
-
* to change output directories, use `options.updater.paths.electronDistPath` instead
|
|
344
|
-
*/
|
|
345
|
-
preload: MakeRequiredAndReplaceKey<Exclude<ElectronSimpleOptions['preload'], undefined>, 'input', 'files'> & ExcludeOutputDirOptions;
|
|
346
|
-
/**
|
|
347
|
-
* updater options
|
|
348
|
-
*/
|
|
349
|
-
updater?: ElectronUpdaterOptions;
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* build options for `vite-plugin-electron/simple`
|
|
353
|
-
* - integrate with updater
|
|
354
|
-
* - only contains `main` and `preload` configs
|
|
355
|
-
* - remove old electron files
|
|
356
|
-
* - externalize dependencies
|
|
357
|
-
* - auto restart when entry file changes
|
|
358
|
-
* - other configs in {@link https://github.com/electron-vite/electron-vite-vue/blob/main/vite.config.ts electron-vite-vue template}
|
|
359
|
-
* - no `vite-plugin-electron-renderer` config
|
|
360
|
-
*
|
|
361
|
-
* you can override all the vite configs, except output directories (use `options.updater.paths.electronDistPath` instead)
|
|
362
|
-
*
|
|
363
|
-
* @example
|
|
364
|
-
* import { defineConfig } from 'vite'
|
|
365
|
-
* import { debugStartup, electronWithUpdater } from 'electron-incremental-update/vite'
|
|
366
|
-
* import pkg from './package.json'
|
|
367
|
-
*
|
|
368
|
-
* export default defineConfig(async ({ command }) => {
|
|
369
|
-
* const isBuild = command === 'build'
|
|
370
|
-
* return {
|
|
371
|
-
* plugins: [
|
|
372
|
-
* electronWithUpdater({
|
|
373
|
-
* pkg,
|
|
374
|
-
* isBuild,
|
|
375
|
-
* logParsedOptions: true,
|
|
376
|
-
* main: {
|
|
377
|
-
* files: ['./electron/main/index.ts', './electron/main/worker.ts'],
|
|
378
|
-
* // see https://github.com/electron-vite/electron-vite-vue/blob/85ed267c4851bf59f32888d766c0071661d4b94c/vite.config.ts#L22-L28
|
|
379
|
-
* onstart: debugStartup,
|
|
380
|
-
* },
|
|
381
|
-
* preload: {
|
|
382
|
-
* files: './electron/preload/index.ts',
|
|
383
|
-
* },
|
|
384
|
-
* updater: {
|
|
385
|
-
* // options
|
|
386
|
-
* }
|
|
387
|
-
* }),
|
|
388
|
-
* ],
|
|
389
|
-
* server: process.env.VSCODE_DEBUG && (() => {
|
|
390
|
-
* const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL)
|
|
391
|
-
* return {
|
|
392
|
-
* host: url.hostname,
|
|
393
|
-
* port: +url.port,
|
|
394
|
-
* }
|
|
395
|
-
* })(),
|
|
396
|
-
* }
|
|
397
|
-
* })
|
|
398
|
-
*/
|
|
399
|
-
declare function electronWithUpdater(options: ElectronWithUpdaterOptions): Promise<PluginOption[] | undefined>;
|
|
400
|
-
|
|
401
|
-
export { type ElectronWithUpdaterOptions, debugStartup, electronWithUpdater };
|
package/dist/zip-WRrEMkgp.d.cts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare function hashBuffer(data: string | Buffer, length: number): Buffer;
|
|
2
|
-
declare function aesEncrypt(plainText: string, key: Buffer, iv: Buffer): string;
|
|
3
|
-
declare function defaultSignature(buffer: Buffer, privateKey: string, cert: string, version: string): string;
|
|
4
|
-
declare function aesDecrypt(encryptedText: string, key: Buffer, iv: Buffer): string;
|
|
5
|
-
declare function defaultVerify(buffer: Buffer, signature: string, cert: string): string | undefined;
|
|
6
|
-
|
|
7
|
-
declare function defaultZipFile(buffer: Buffer): Promise<Buffer>;
|
|
8
|
-
declare function defaultUnzipFile(buffer: Buffer): Promise<Buffer>;
|
|
9
|
-
|
|
10
|
-
export { defaultUnzipFile as a, aesEncrypt as b, defaultSignature as c, defaultZipFile as d, aesDecrypt as e, defaultVerify as f, hashBuffer as h };
|
package/dist/zip-WRrEMkgp.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare function hashBuffer(data: string | Buffer, length: number): Buffer;
|
|
2
|
-
declare function aesEncrypt(plainText: string, key: Buffer, iv: Buffer): string;
|
|
3
|
-
declare function defaultSignature(buffer: Buffer, privateKey: string, cert: string, version: string): string;
|
|
4
|
-
declare function aesDecrypt(encryptedText: string, key: Buffer, iv: Buffer): string;
|
|
5
|
-
declare function defaultVerify(buffer: Buffer, signature: string, cert: string): string | undefined;
|
|
6
|
-
|
|
7
|
-
declare function defaultZipFile(buffer: Buffer): Promise<Buffer>;
|
|
8
|
-
declare function defaultUnzipFile(buffer: Buffer): Promise<Buffer>;
|
|
9
|
-
|
|
10
|
-
export { defaultUnzipFile as a, aesEncrypt as b, defaultSignature as c, defaultZipFile as d, aesDecrypt as e, defaultVerify as f, hashBuffer as h };
|