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