electron-incremental-update 1.3.0 → 2.0.0-beta.1
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 +6 -2
- package/dist/chunk-RSLOPAIZ.js +247 -0
- package/dist/decrypt-BNBcodiO.d.cts +4 -0
- package/dist/decrypt-BNBcodiO.d.ts +4 -0
- package/dist/index.cjs +108 -261
- package/dist/index.d.cts +68 -161
- package/dist/index.d.ts +68 -161
- package/dist/index.js +76 -195
- package/dist/provider.cjs +227 -0
- package/dist/provider.d.cts +37 -0
- package/dist/provider.d.ts +37 -0
- package/dist/provider.js +98 -0
- package/dist/types-DxPmQmaq.d.cts +61 -0
- package/dist/types-seJf3Wbc.d.ts +61 -0
- package/dist/utils.cjs +139 -115
- package/dist/utils.d.cts +31 -76
- package/dist/utils.d.ts +31 -76
- package/dist/utils.js +35 -11
- package/dist/{pure-GoN_3MEj.d.cts → version-CffZWDhZ.d.cts} +8 -7
- package/dist/{pure-GoN_3MEj.d.ts → version-CffZWDhZ.d.ts} +8 -7
- package/dist/vite.js +70 -117
- package/package.json +12 -6
- package/provider.d.ts +1 -0
- package/provider.js +1 -0
- package/dist/chunk-7ET4GMTZ.js +0 -236
- package/dist/chunk-CXHA5TF7.js +0 -236
- package/dist/chunk-HWUYTDEF.js +0 -236
- package/dist/chunk-RQCTJY4L.js +0 -236
- package/dist/chunk-SBPTSLG7.js +0 -235
- package/dist/vite.d.ts +0 -372
package/dist/utils.d.cts
CHANGED
|
@@ -1,60 +1,40 @@
|
|
|
1
1
|
import { BrowserWindow } from 'electron';
|
|
2
|
-
export {
|
|
2
|
+
export { a as UpdateInfo, U as UpdateJSON, V as Version, h as handleUnexpectedErrors, i as isLowerVersionDefault, b as isUpdateJSON, p as parseVersion } from './version-CffZWDhZ.cjs';
|
|
3
|
+
export { d as decrypt, v as verifySignatureDefault } from './decrypt-BNBcodiO.cjs';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* compile time dev check
|
|
6
7
|
*/
|
|
7
|
-
declare const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
readonly linux: boolean;
|
|
12
|
-
};
|
|
8
|
+
declare const isDev: boolean;
|
|
9
|
+
declare const isWin: boolean;
|
|
10
|
+
declare const isMac: boolean;
|
|
11
|
+
declare const isLinux: boolean;
|
|
13
12
|
/**
|
|
14
13
|
* get the absolute path of `${electron.app.name}.asar` (not `app.asar`)
|
|
15
14
|
*
|
|
16
|
-
* if is in dev, return `'DEV.asar'`
|
|
15
|
+
* if is in dev, **always** return `'DEV.asar'`
|
|
17
16
|
*/
|
|
18
17
|
declare function getPathFromAppNameAsar(...path: string[]): string;
|
|
19
18
|
/**
|
|
20
|
-
* get
|
|
21
|
-
*
|
|
22
|
-
* App version is read from `version` file in `${electron.app.name}.asar`
|
|
23
|
-
*
|
|
24
|
-
* Entry version is read from `package.json`
|
|
25
|
-
*
|
|
26
|
-
* SystemVersion: `${platform} ${os.release()}`
|
|
19
|
+
* get app version, if is in dev, return `getEntryVersion()`
|
|
27
20
|
*/
|
|
28
|
-
declare function
|
|
29
|
-
appVersion: string;
|
|
30
|
-
entryVersion: string;
|
|
31
|
-
electronVersion: string;
|
|
32
|
-
nodeVersion: string;
|
|
33
|
-
systemVersion: string;
|
|
34
|
-
};
|
|
21
|
+
declare function getAppVersion(): string;
|
|
35
22
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @param moduleName file name in entry
|
|
23
|
+
* get entry version
|
|
38
24
|
*/
|
|
39
|
-
|
|
25
|
+
declare function getEntryVersion(): string;
|
|
40
26
|
/**
|
|
41
|
-
* load module from entry
|
|
42
|
-
* @
|
|
43
|
-
* @param devEntryDirPath entry directory path when dev, default `../../dist-entry`
|
|
44
|
-
* @param entryDirPath entry directory path when not dev, default `join(app.getAppPath(), basename(devEntryDirPath))`
|
|
45
|
-
* @example
|
|
46
|
-
* const requireNative = loadNativeModuleFromEntry()
|
|
47
|
-
* const db = requireNative<typeof import('../native/db')>('db')
|
|
48
|
-
* db.test()
|
|
27
|
+
* use `require` to load native module from entry
|
|
28
|
+
* @param moduleName file name in entry
|
|
49
29
|
*/
|
|
50
|
-
declare function
|
|
30
|
+
declare function requireNative<T = any>(moduleName: string): T;
|
|
51
31
|
/**
|
|
52
32
|
* Restarts the Electron app.
|
|
53
33
|
*/
|
|
54
34
|
declare function restartApp(): void;
|
|
55
35
|
/**
|
|
56
36
|
* fix app use model id, only for Windows
|
|
57
|
-
* @param id app id
|
|
37
|
+
* @param id app id, default is `org.${electron.app.name}`
|
|
58
38
|
*/
|
|
59
39
|
declare function setAppUserModelId(id?: string): void;
|
|
60
40
|
/**
|
|
@@ -80,47 +60,22 @@ declare function setPortableAppDataPath(dirName?: string): void;
|
|
|
80
60
|
*/
|
|
81
61
|
declare function waitAppReady(timeout?: number): Promise<void>;
|
|
82
62
|
/**
|
|
83
|
-
*
|
|
84
|
-
* @param
|
|
63
|
+
* load `process.env.VITE_DEV_SERVER_URL` when dev, else load html file
|
|
64
|
+
* @param win window
|
|
65
|
+
* @param htmlFilePath html file path, default is `index.html`
|
|
85
66
|
*/
|
|
86
|
-
declare function
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
* devServerURL && win.loadURL(devServerURL)
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
devServerURL: string | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* @example
|
|
96
|
-
* ```ts
|
|
97
|
-
* win.loadFile(indexHTMLPath)
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
indexHTMLPath: string;
|
|
101
|
-
/**
|
|
102
|
-
* get path inside entry asar
|
|
103
|
-
* @param paths joined path
|
|
104
|
-
*/
|
|
105
|
-
getPathFromEntryAsar(...paths: string[]): string;
|
|
106
|
-
/**
|
|
107
|
-
* get path inside `${electron.app.name}.asar/main`
|
|
108
|
-
* @param paths joined path
|
|
109
|
-
*/
|
|
110
|
-
getPathFromMain(...paths: string[]): string;
|
|
111
|
-
/**
|
|
112
|
-
* get path inside `${electron.app.name}.asar/preload`
|
|
113
|
-
* @param paths joined path
|
|
114
|
-
*/
|
|
115
|
-
getPathFromPreload(...paths: string[]): string;
|
|
116
|
-
/**
|
|
117
|
-
* get path inside public dir
|
|
118
|
-
* @param paths joined path
|
|
119
|
-
*/
|
|
120
|
-
getPathFromPublic(...paths: string[]): string;
|
|
121
|
-
};
|
|
67
|
+
declare function loadPage(win: BrowserWindow, htmlFilePath?: string): void;
|
|
68
|
+
declare function getPathFromPreload(...paths: string[]): string;
|
|
69
|
+
declare function getPathFromPublic(...paths: string[]): string;
|
|
70
|
+
declare function getPathFromEntryAsar(...paths: string[]): string;
|
|
122
71
|
|
|
123
|
-
declare function unzipFile(gzipPath: string, targetFilePath?: string): Promise<unknown>;
|
|
124
72
|
declare function zipFile(filePath: string, targetFilePath?: string): Promise<unknown>;
|
|
125
73
|
|
|
126
|
-
|
|
74
|
+
declare function unzipFile(gzipPath: string, targetFilePath?: string): Promise<unknown>;
|
|
75
|
+
|
|
76
|
+
declare function encrypt(plainText: string, key: Buffer, iv: Buffer): string;
|
|
77
|
+
declare function signature(buffer: Buffer, privateKey: string, cert: string, version: string): string;
|
|
78
|
+
|
|
79
|
+
declare function hashString(data: string | Buffer, length: number): Buffer;
|
|
80
|
+
|
|
81
|
+
export { disableHWAccForWin7, encrypt, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromPreload, getPathFromPublic, hashString, isDev, isLinux, isMac, isWin, loadPage, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, signature, singleInstance, unzipFile, waitAppReady, zipFile };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,60 +1,40 @@
|
|
|
1
1
|
import { BrowserWindow } from 'electron';
|
|
2
|
-
export {
|
|
2
|
+
export { a as UpdateInfo, U as UpdateJSON, V as Version, h as handleUnexpectedErrors, i as isLowerVersionDefault, b as isUpdateJSON, p as parseVersion } from './version-CffZWDhZ.js';
|
|
3
|
+
export { d as decrypt, v as verifySignatureDefault } from './decrypt-BNBcodiO.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* compile time dev check
|
|
6
7
|
*/
|
|
7
|
-
declare const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
readonly linux: boolean;
|
|
12
|
-
};
|
|
8
|
+
declare const isDev: boolean;
|
|
9
|
+
declare const isWin: boolean;
|
|
10
|
+
declare const isMac: boolean;
|
|
11
|
+
declare const isLinux: boolean;
|
|
13
12
|
/**
|
|
14
13
|
* get the absolute path of `${electron.app.name}.asar` (not `app.asar`)
|
|
15
14
|
*
|
|
16
|
-
* if is in dev, return `'DEV.asar'`
|
|
15
|
+
* if is in dev, **always** return `'DEV.asar'`
|
|
17
16
|
*/
|
|
18
17
|
declare function getPathFromAppNameAsar(...path: string[]): string;
|
|
19
18
|
/**
|
|
20
|
-
* get
|
|
21
|
-
*
|
|
22
|
-
* App version is read from `version` file in `${electron.app.name}.asar`
|
|
23
|
-
*
|
|
24
|
-
* Entry version is read from `package.json`
|
|
25
|
-
*
|
|
26
|
-
* SystemVersion: `${platform} ${os.release()}`
|
|
19
|
+
* get app version, if is in dev, return `getEntryVersion()`
|
|
27
20
|
*/
|
|
28
|
-
declare function
|
|
29
|
-
appVersion: string;
|
|
30
|
-
entryVersion: string;
|
|
31
|
-
electronVersion: string;
|
|
32
|
-
nodeVersion: string;
|
|
33
|
-
systemVersion: string;
|
|
34
|
-
};
|
|
21
|
+
declare function getAppVersion(): string;
|
|
35
22
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @param moduleName file name in entry
|
|
23
|
+
* get entry version
|
|
38
24
|
*/
|
|
39
|
-
|
|
25
|
+
declare function getEntryVersion(): string;
|
|
40
26
|
/**
|
|
41
|
-
* load module from entry
|
|
42
|
-
* @
|
|
43
|
-
* @param devEntryDirPath entry directory path when dev, default `../../dist-entry`
|
|
44
|
-
* @param entryDirPath entry directory path when not dev, default `join(app.getAppPath(), basename(devEntryDirPath))`
|
|
45
|
-
* @example
|
|
46
|
-
* const requireNative = loadNativeModuleFromEntry()
|
|
47
|
-
* const db = requireNative<typeof import('../native/db')>('db')
|
|
48
|
-
* db.test()
|
|
27
|
+
* use `require` to load native module from entry
|
|
28
|
+
* @param moduleName file name in entry
|
|
49
29
|
*/
|
|
50
|
-
declare function
|
|
30
|
+
declare function requireNative<T = any>(moduleName: string): T;
|
|
51
31
|
/**
|
|
52
32
|
* Restarts the Electron app.
|
|
53
33
|
*/
|
|
54
34
|
declare function restartApp(): void;
|
|
55
35
|
/**
|
|
56
36
|
* fix app use model id, only for Windows
|
|
57
|
-
* @param id app id
|
|
37
|
+
* @param id app id, default is `org.${electron.app.name}`
|
|
58
38
|
*/
|
|
59
39
|
declare function setAppUserModelId(id?: string): void;
|
|
60
40
|
/**
|
|
@@ -80,47 +60,22 @@ declare function setPortableAppDataPath(dirName?: string): void;
|
|
|
80
60
|
*/
|
|
81
61
|
declare function waitAppReady(timeout?: number): Promise<void>;
|
|
82
62
|
/**
|
|
83
|
-
*
|
|
84
|
-
* @param
|
|
63
|
+
* load `process.env.VITE_DEV_SERVER_URL` when dev, else load html file
|
|
64
|
+
* @param win window
|
|
65
|
+
* @param htmlFilePath html file path, default is `index.html`
|
|
85
66
|
*/
|
|
86
|
-
declare function
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
* devServerURL && win.loadURL(devServerURL)
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
devServerURL: string | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* @example
|
|
96
|
-
* ```ts
|
|
97
|
-
* win.loadFile(indexHTMLPath)
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
indexHTMLPath: string;
|
|
101
|
-
/**
|
|
102
|
-
* get path inside entry asar
|
|
103
|
-
* @param paths joined path
|
|
104
|
-
*/
|
|
105
|
-
getPathFromEntryAsar(...paths: string[]): string;
|
|
106
|
-
/**
|
|
107
|
-
* get path inside `${electron.app.name}.asar/main`
|
|
108
|
-
* @param paths joined path
|
|
109
|
-
*/
|
|
110
|
-
getPathFromMain(...paths: string[]): string;
|
|
111
|
-
/**
|
|
112
|
-
* get path inside `${electron.app.name}.asar/preload`
|
|
113
|
-
* @param paths joined path
|
|
114
|
-
*/
|
|
115
|
-
getPathFromPreload(...paths: string[]): string;
|
|
116
|
-
/**
|
|
117
|
-
* get path inside public dir
|
|
118
|
-
* @param paths joined path
|
|
119
|
-
*/
|
|
120
|
-
getPathFromPublic(...paths: string[]): string;
|
|
121
|
-
};
|
|
67
|
+
declare function loadPage(win: BrowserWindow, htmlFilePath?: string): void;
|
|
68
|
+
declare function getPathFromPreload(...paths: string[]): string;
|
|
69
|
+
declare function getPathFromPublic(...paths: string[]): string;
|
|
70
|
+
declare function getPathFromEntryAsar(...paths: string[]): string;
|
|
122
71
|
|
|
123
|
-
declare function unzipFile(gzipPath: string, targetFilePath?: string): Promise<unknown>;
|
|
124
72
|
declare function zipFile(filePath: string, targetFilePath?: string): Promise<unknown>;
|
|
125
73
|
|
|
126
|
-
|
|
74
|
+
declare function unzipFile(gzipPath: string, targetFilePath?: string): Promise<unknown>;
|
|
75
|
+
|
|
76
|
+
declare function encrypt(plainText: string, key: Buffer, iv: Buffer): string;
|
|
77
|
+
declare function signature(buffer: Buffer, privateKey: string, cert: string, version: string): string;
|
|
78
|
+
|
|
79
|
+
declare function hashString(data: string | Buffer, length: number): Buffer;
|
|
80
|
+
|
|
81
|
+
export { disableHWAccForWin7, encrypt, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromPreload, getPathFromPublic, hashString, isDev, isLinux, isMac, isWin, loadPage, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, signature, singleInstance, unzipFile, waitAppReady, zipFile };
|
package/dist/utils.js
CHANGED
|
@@ -1,38 +1,62 @@
|
|
|
1
1
|
import {
|
|
2
|
+
decrypt,
|
|
2
3
|
disableHWAccForWin7,
|
|
4
|
+
encrypt,
|
|
5
|
+
getAppVersion,
|
|
6
|
+
getEntryVersion,
|
|
3
7
|
getPathFromAppNameAsar,
|
|
4
|
-
|
|
5
|
-
|
|
8
|
+
getPathFromEntryAsar,
|
|
9
|
+
getPathFromPreload,
|
|
10
|
+
getPathFromPublic,
|
|
6
11
|
handleUnexpectedErrors,
|
|
7
|
-
|
|
12
|
+
hashString,
|
|
13
|
+
isDev,
|
|
14
|
+
isLinux,
|
|
15
|
+
isLowerVersionDefault,
|
|
16
|
+
isMac,
|
|
8
17
|
isUpdateJSON,
|
|
9
|
-
|
|
10
|
-
|
|
18
|
+
isWin,
|
|
19
|
+
loadPage,
|
|
11
20
|
parseVersion,
|
|
21
|
+
requireNative,
|
|
12
22
|
restartApp,
|
|
13
23
|
setAppUserModelId,
|
|
14
24
|
setPortableAppDataPath,
|
|
25
|
+
signature,
|
|
15
26
|
singleInstance,
|
|
16
27
|
unzipFile,
|
|
28
|
+
verifySignatureDefault,
|
|
17
29
|
waitAppReady,
|
|
18
30
|
zipFile
|
|
19
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-RSLOPAIZ.js";
|
|
20
32
|
export {
|
|
33
|
+
decrypt,
|
|
21
34
|
disableHWAccForWin7,
|
|
35
|
+
encrypt,
|
|
36
|
+
getAppVersion,
|
|
37
|
+
getEntryVersion,
|
|
22
38
|
getPathFromAppNameAsar,
|
|
23
|
-
|
|
24
|
-
|
|
39
|
+
getPathFromEntryAsar,
|
|
40
|
+
getPathFromPreload,
|
|
41
|
+
getPathFromPublic,
|
|
25
42
|
handleUnexpectedErrors,
|
|
26
|
-
|
|
43
|
+
hashString,
|
|
44
|
+
isDev,
|
|
45
|
+
isLinux,
|
|
46
|
+
isLowerVersionDefault,
|
|
47
|
+
isMac,
|
|
27
48
|
isUpdateJSON,
|
|
28
|
-
|
|
29
|
-
|
|
49
|
+
isWin,
|
|
50
|
+
loadPage,
|
|
30
51
|
parseVersion,
|
|
52
|
+
requireNative,
|
|
31
53
|
restartApp,
|
|
32
54
|
setAppUserModelId,
|
|
33
55
|
setPortableAppDataPath,
|
|
56
|
+
signature,
|
|
34
57
|
singleInstance,
|
|
35
58
|
unzipFile,
|
|
59
|
+
verifySignatureDefault,
|
|
36
60
|
waitAppReady,
|
|
37
61
|
zipFile
|
|
38
62
|
};
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* parse Github CDN URL for accelerating the speed of downloading
|
|
3
|
-
*
|
|
4
|
-
* {@link https://github.com/XIU2/UserScript/blob/master/GithubEnhanced-High-Speed-Download.user.js#L34 some public CDN links}
|
|
5
|
-
*/
|
|
6
|
-
declare function parseGithubCdnURL(originRepoURL: string, cdnPrefix: string, relativeFilePath: string): string;
|
|
7
1
|
/**
|
|
8
2
|
* handle all unhandled error
|
|
9
3
|
* @param callback callback function
|
|
@@ -17,15 +11,22 @@ interface Version {
|
|
|
17
11
|
stageVersion: number;
|
|
18
12
|
}
|
|
19
13
|
declare function parseVersion(version: string): Version;
|
|
14
|
+
declare function isLowerVersionDefault(oldVer: string, newVer: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* update info json
|
|
17
|
+
*/
|
|
20
18
|
type UpdateInfo = {
|
|
21
19
|
signature: string;
|
|
22
20
|
minimumVersion: string;
|
|
23
21
|
version: string;
|
|
24
22
|
size: number;
|
|
25
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* {@link UpdateInfo} with beta
|
|
26
|
+
*/
|
|
26
27
|
type UpdateJSON = UpdateInfo & {
|
|
27
28
|
beta: UpdateInfo;
|
|
28
29
|
};
|
|
29
30
|
declare function isUpdateJSON(json: any): json is UpdateJSON;
|
|
30
31
|
|
|
31
|
-
export { type
|
|
32
|
+
export { type UpdateJSON as U, type Version as V, type UpdateInfo as a, isUpdateJSON as b, handleUnexpectedErrors as h, isLowerVersionDefault as i, parseVersion as p };
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* parse Github CDN URL for accelerating the speed of downloading
|
|
3
|
-
*
|
|
4
|
-
* {@link https://github.com/XIU2/UserScript/blob/master/GithubEnhanced-High-Speed-Download.user.js#L34 some public CDN links}
|
|
5
|
-
*/
|
|
6
|
-
declare function parseGithubCdnURL(originRepoURL: string, cdnPrefix: string, relativeFilePath: string): string;
|
|
7
1
|
/**
|
|
8
2
|
* handle all unhandled error
|
|
9
3
|
* @param callback callback function
|
|
@@ -17,15 +11,22 @@ interface Version {
|
|
|
17
11
|
stageVersion: number;
|
|
18
12
|
}
|
|
19
13
|
declare function parseVersion(version: string): Version;
|
|
14
|
+
declare function isLowerVersionDefault(oldVer: string, newVer: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* update info json
|
|
17
|
+
*/
|
|
20
18
|
type UpdateInfo = {
|
|
21
19
|
signature: string;
|
|
22
20
|
minimumVersion: string;
|
|
23
21
|
version: string;
|
|
24
22
|
size: number;
|
|
25
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* {@link UpdateInfo} with beta
|
|
26
|
+
*/
|
|
26
27
|
type UpdateJSON = UpdateInfo & {
|
|
27
28
|
beta: UpdateInfo;
|
|
28
29
|
};
|
|
29
30
|
declare function isUpdateJSON(json: any): json is UpdateJSON;
|
|
30
31
|
|
|
31
|
-
export { type
|
|
32
|
+
export { type UpdateJSON as U, type Version as V, type UpdateInfo as a, isUpdateJSON as b, handleUnexpectedErrors as h, isLowerVersionDefault as i, parseVersion as p };
|