electron-incremental-update 2.4.3 → 3.0.0-beta.3

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.
Files changed (47) hide show
  1. package/README.md +48 -40
  2. package/dist/download-BN4uMS4_.d.mts +39 -0
  3. package/dist/download-DO7iuxEJ.d.cts +39 -0
  4. package/dist/electron-DH-Uyikp.cjs +321 -0
  5. package/dist/electron-OKQIYbcw.mjs +181 -0
  6. package/dist/index.cjs +261 -331
  7. package/dist/index.d.cts +179 -169
  8. package/dist/index.d.mts +204 -0
  9. package/dist/index.mjs +273 -0
  10. package/dist/provider.cjs +142 -330
  11. package/dist/provider.d.cts +113 -114
  12. package/dist/provider.d.mts +133 -0
  13. package/dist/provider.mjs +152 -0
  14. package/dist/types-BM9Jfu7q.d.cts +154 -0
  15. package/dist/types-DASqEPXE.d.mts +154 -0
  16. package/dist/utils.cjs +43 -381
  17. package/dist/utils.d.cts +120 -85
  18. package/dist/utils.d.mts +164 -0
  19. package/dist/utils.mjs +5 -0
  20. package/dist/version--eVB2A7n.mjs +72 -0
  21. package/dist/version-aPrLuz_-.cjs +129 -0
  22. package/dist/vite.d.mts +521 -0
  23. package/dist/vite.mjs +1094 -0
  24. package/dist/zip-BCC7FAQ_.cjs +264 -0
  25. package/dist/zip-Dwm7s1C9.mjs +185 -0
  26. package/package.json +66 -64
  27. package/dist/chunk-AAAM44NW.js +0 -70
  28. package/dist/chunk-IVHNGRZY.js +0 -122
  29. package/dist/chunk-PD4EV4MM.js +0 -147
  30. package/dist/index.d.ts +0 -194
  31. package/dist/index.js +0 -309
  32. package/dist/provider.d.ts +0 -134
  33. package/dist/provider.js +0 -152
  34. package/dist/types-CU7GyVez.d.cts +0 -151
  35. package/dist/types-CU7GyVez.d.ts +0 -151
  36. package/dist/utils.d.ts +0 -129
  37. package/dist/utils.js +0 -3
  38. package/dist/vite.d.ts +0 -533
  39. package/dist/vite.js +0 -945
  40. package/dist/zip-Blmn2vzE.d.cts +0 -71
  41. package/dist/zip-CnSv_Njj.d.ts +0 -71
  42. package/provider.d.ts +0 -1
  43. package/provider.js +0 -1
  44. package/utils.d.ts +0 -1
  45. package/utils.js +0 -1
  46. package/vite.d.ts +0 -1
  47. package/vite.js +0 -1
@@ -1,151 +0,0 @@
1
- import { Promisable } from '@subframe7536/type-utils';
2
- import { URL } from 'node:url';
3
-
4
- interface Version {
5
- /**
6
- * `4` of `4.3.2-beta.1`
7
- */
8
- major: number;
9
- /**
10
- * `3` of `4.3.2-beta.1`
11
- */
12
- minor: number;
13
- /**
14
- * `2` of `4.3.2-beta.1`
15
- */
16
- patch: number;
17
- /**
18
- * `beta` of `4.3.2-beta.1`
19
- */
20
- stage: string;
21
- /**
22
- * `1` of `4.3.2-beta.1`
23
- */
24
- stageVersion: number;
25
- }
26
- /**
27
- * Parse version string to {@link Version}, like `0.2.0-beta.1`
28
- * @param version version string
29
- */
30
- declare function parseVersion(version: string): Version;
31
- /**
32
- * Default function to check the old version is less than new version
33
- * @param oldVer old version string
34
- * @param newVer new version string
35
- */
36
- declare function defaultIsLowerVersion(oldVer: string, newVer: string): boolean;
37
- /**
38
- * Update info json
39
- */
40
- type UpdateInfo = {
41
- /**
42
- * Update Asar signature
43
- */
44
- signature: string;
45
- /**
46
- * Minimum version
47
- */
48
- minimumVersion: string;
49
- /**
50
- * Target version
51
- */
52
- version: string;
53
- };
54
- /**
55
- * {@link UpdateInfo} with beta
56
- */
57
- type UpdateJSON = UpdateInfo & {
58
- /**
59
- * Beta update info
60
- */
61
- beta: UpdateInfo;
62
- };
63
- /**
64
- * Check is `UpdateJSON`
65
- * @param json any variable
66
- */
67
- declare function isUpdateJSON(json: any): json is UpdateJSON;
68
- /**
69
- * Default function to generate `UpdateJSON`
70
- * @param existingJson exising update json
71
- * @param signature sigature
72
- * @param version target version
73
- * @param minimumVersion minimum version
74
- */
75
- declare function defaultVersionJsonGenerator(existingJson: UpdateJSON, signature: string, version: string, minimumVersion: string): UpdateJSON;
76
-
77
- type UpdateInfoWithURL = UpdateInfo & {
78
- url: string;
79
- };
80
- interface DownloadingInfo {
81
- /**
82
- * Download buffer delta
83
- */
84
- delta: number;
85
- /**
86
- * Downloaded percent, 0 ~ 100
87
- *
88
- * If no `Content-Length` header, will be -1
89
- */
90
- percent: number;
91
- /**
92
- * Total size
93
- *
94
- * If not `Content-Length` header, will be -1
95
- */
96
- total: number;
97
- /**
98
- * Downloaded size
99
- */
100
- transferred: number;
101
- /**
102
- * Download speed, bytes per second
103
- */
104
- bps: number;
105
- }
106
- type UpdateJSONWithURL = UpdateInfoWithURL & {
107
- beta: UpdateInfoWithURL;
108
- };
109
- interface IProvider {
110
- /**
111
- * Provider name
112
- */
113
- name: string;
114
- /**
115
- * Download update json
116
- * @param name app name
117
- * @param versionPath normalized version path in project
118
- * @param signal abort signal
119
- */
120
- downloadJSON: (name: string, versionPath: string, signal: AbortSignal) => Promise<UpdateJSONWithURL>;
121
- /**
122
- * Download update asar buffer
123
- * @param updateInfo existing update info
124
- * @param signal abort signal
125
- * @param onDownloading hook for on downloading
126
- */
127
- downloadAsar: (updateInfo: UpdateInfoWithURL, signal: AbortSignal, onDownloading?: (info: DownloadingInfo) => void) => Promise<Buffer>;
128
- /**
129
- * Check the old version is less than new version
130
- * @param oldVer old version string
131
- * @param newVer new version string
132
- */
133
- isLowerVersion: (oldVer: string, newVer: string) => boolean;
134
- /**
135
- * Function to decompress file using brotli
136
- * @param buffer compressed file buffer
137
- */
138
- unzipFile: (buffer: Buffer) => Promise<Buffer>;
139
- /**
140
- * Verify asar signature,
141
- * if signature is valid, returns the version, otherwise returns `undefined`
142
- * @param buffer file buffer
143
- * @param version target version
144
- * @param signature signature
145
- * @param cert certificate
146
- */
147
- verifySignaure: (buffer: Buffer, version: string, signature: string, cert: string) => Promisable<boolean>;
148
- }
149
- type URLHandler = (url: URL) => Promisable<URL | string | undefined | null>;
150
-
151
- export { type DownloadingInfo as D, type IProvider as I, type UpdateInfo as U, type Version as V, type UpdateJSON as a, type UpdateJSONWithURL as b, defaultVersionJsonGenerator as c, defaultIsLowerVersion as d, type UpdateInfoWithURL as e, type URLHandler as f, isUpdateJSON as i, parseVersion as p };
@@ -1,151 +0,0 @@
1
- import { Promisable } from '@subframe7536/type-utils';
2
- import { URL } from 'node:url';
3
-
4
- interface Version {
5
- /**
6
- * `4` of `4.3.2-beta.1`
7
- */
8
- major: number;
9
- /**
10
- * `3` of `4.3.2-beta.1`
11
- */
12
- minor: number;
13
- /**
14
- * `2` of `4.3.2-beta.1`
15
- */
16
- patch: number;
17
- /**
18
- * `beta` of `4.3.2-beta.1`
19
- */
20
- stage: string;
21
- /**
22
- * `1` of `4.3.2-beta.1`
23
- */
24
- stageVersion: number;
25
- }
26
- /**
27
- * Parse version string to {@link Version}, like `0.2.0-beta.1`
28
- * @param version version string
29
- */
30
- declare function parseVersion(version: string): Version;
31
- /**
32
- * Default function to check the old version is less than new version
33
- * @param oldVer old version string
34
- * @param newVer new version string
35
- */
36
- declare function defaultIsLowerVersion(oldVer: string, newVer: string): boolean;
37
- /**
38
- * Update info json
39
- */
40
- type UpdateInfo = {
41
- /**
42
- * Update Asar signature
43
- */
44
- signature: string;
45
- /**
46
- * Minimum version
47
- */
48
- minimumVersion: string;
49
- /**
50
- * Target version
51
- */
52
- version: string;
53
- };
54
- /**
55
- * {@link UpdateInfo} with beta
56
- */
57
- type UpdateJSON = UpdateInfo & {
58
- /**
59
- * Beta update info
60
- */
61
- beta: UpdateInfo;
62
- };
63
- /**
64
- * Check is `UpdateJSON`
65
- * @param json any variable
66
- */
67
- declare function isUpdateJSON(json: any): json is UpdateJSON;
68
- /**
69
- * Default function to generate `UpdateJSON`
70
- * @param existingJson exising update json
71
- * @param signature sigature
72
- * @param version target version
73
- * @param minimumVersion minimum version
74
- */
75
- declare function defaultVersionJsonGenerator(existingJson: UpdateJSON, signature: string, version: string, minimumVersion: string): UpdateJSON;
76
-
77
- type UpdateInfoWithURL = UpdateInfo & {
78
- url: string;
79
- };
80
- interface DownloadingInfo {
81
- /**
82
- * Download buffer delta
83
- */
84
- delta: number;
85
- /**
86
- * Downloaded percent, 0 ~ 100
87
- *
88
- * If no `Content-Length` header, will be -1
89
- */
90
- percent: number;
91
- /**
92
- * Total size
93
- *
94
- * If not `Content-Length` header, will be -1
95
- */
96
- total: number;
97
- /**
98
- * Downloaded size
99
- */
100
- transferred: number;
101
- /**
102
- * Download speed, bytes per second
103
- */
104
- bps: number;
105
- }
106
- type UpdateJSONWithURL = UpdateInfoWithURL & {
107
- beta: UpdateInfoWithURL;
108
- };
109
- interface IProvider {
110
- /**
111
- * Provider name
112
- */
113
- name: string;
114
- /**
115
- * Download update json
116
- * @param name app name
117
- * @param versionPath normalized version path in project
118
- * @param signal abort signal
119
- */
120
- downloadJSON: (name: string, versionPath: string, signal: AbortSignal) => Promise<UpdateJSONWithURL>;
121
- /**
122
- * Download update asar buffer
123
- * @param updateInfo existing update info
124
- * @param signal abort signal
125
- * @param onDownloading hook for on downloading
126
- */
127
- downloadAsar: (updateInfo: UpdateInfoWithURL, signal: AbortSignal, onDownloading?: (info: DownloadingInfo) => void) => Promise<Buffer>;
128
- /**
129
- * Check the old version is less than new version
130
- * @param oldVer old version string
131
- * @param newVer new version string
132
- */
133
- isLowerVersion: (oldVer: string, newVer: string) => boolean;
134
- /**
135
- * Function to decompress file using brotli
136
- * @param buffer compressed file buffer
137
- */
138
- unzipFile: (buffer: Buffer) => Promise<Buffer>;
139
- /**
140
- * Verify asar signature,
141
- * if signature is valid, returns the version, otherwise returns `undefined`
142
- * @param buffer file buffer
143
- * @param version target version
144
- * @param signature signature
145
- * @param cert certificate
146
- */
147
- verifySignaure: (buffer: Buffer, version: string, signature: string, cert: string) => Promisable<boolean>;
148
- }
149
- type URLHandler = (url: URL) => Promisable<URL | string | undefined | null>;
150
-
151
- export { type DownloadingInfo as D, type IProvider as I, type UpdateInfo as U, type Version as V, type UpdateJSON as a, type UpdateJSONWithURL as b, defaultVersionJsonGenerator as c, defaultIsLowerVersion as d, type UpdateInfoWithURL as e, type URLHandler as f, isUpdateJSON as i, parseVersion as p };
package/dist/utils.d.ts DELETED
@@ -1,129 +0,0 @@
1
- export { b as aesDecrypt, a as aesEncrypt, j as defaultDownloadAsar, f as defaultDownloadText, i as defaultDownloadUpdateJSON, d as defaultSignature, l as defaultUnzipFile, c as defaultVerifySignature, k as defaultZipFile, e as downloadUtil, g as getHeader, h as hashBuffer, r as resolveJson } from './zip-CnSv_Njj.js';
2
- import { BrowserWindow } from 'electron';
3
- export { U as UpdateInfo, a as UpdateJSON, V as Version, d as defaultIsLowerVersion, c as defaultVersionJsonGenerator, i as isUpdateJSON, p as parseVersion } from './types-CU7GyVez.js';
4
- import '@subframe7536/type-utils';
5
- import 'node:url';
6
-
7
- /**
8
- * Compile time dev check
9
- */
10
- declare const isDev: boolean;
11
- declare const isWin: boolean;
12
- declare const isMac: boolean;
13
- declare const isLinux: boolean;
14
- /**
15
- * Get joined path of `${electron.app.name}.asar` (not `app.asar`)
16
- *
17
- * If is in dev, **always** return `'DEV.asar'`
18
- */
19
- declare function getPathFromAppNameAsar(...paths: string[]): string;
20
- /**
21
- * Get app version, if is in dev, return `getEntryVersion()`
22
- */
23
- declare function getAppVersion(): string;
24
- /**
25
- * Get entry version
26
- */
27
- declare function getEntryVersion(): string;
28
- /**
29
- * Use `require` to load native module from entry asar
30
- * @param moduleName file name in entry
31
- * @example
32
- * requireNative<typeof import('../native/db')>('db')
33
- */
34
- declare function requireNative<T = any>(moduleName: string): T;
35
- /**
36
- * Use `import` to load native module from entry asar
37
- * @param moduleName file name in entry
38
- * @example
39
- * await importNative<typeof import('../native/db')>('db')
40
- */
41
- declare function importNative<T = any>(moduleName: string): Promise<T>;
42
- /**
43
- * Restarts the Electron app.
44
- */
45
- declare function restartApp(): void;
46
- /**
47
- * Fix app use model id, only for Windows
48
- * @param id app id, default is `org.${electron.app.name}`
49
- */
50
- declare function setAppUserModelId(id?: string): void;
51
- /**
52
- * Disable hardware acceleration for Windows 7
53
- *
54
- * Only support CommonJS
55
- */
56
- declare function disableHWAccForWin7(): void;
57
- /**
58
- * Keep single electron instance and auto restore window on `second-instance` event
59
- * @param window brwoser window to show
60
- */
61
- declare function singleInstance(window?: BrowserWindow): void;
62
- /**
63
- * Set `userData` dir to the dir of .exe file
64
- *
65
- * Useful for portable Windows app
66
- * @param dirName dir name, default to `data`
67
- * @param create whether to create dir, default to `true`
68
- */
69
- declare function setPortableDataPath(dirName?: string, create?: boolean): void;
70
- /**
71
- * @deprecated
72
- * @alias {@link setPortableDataPath}
73
- */
74
- declare const setPortableAppDataPath: typeof setPortableDataPath;
75
- /**
76
- * Load `process.env.VITE_DEV_SERVER_URL` when dev, else load html file
77
- * @param win window
78
- * @param htmlFilePath html file path, default is `index.html`
79
- */
80
- declare function loadPage(win: BrowserWindow, htmlFilePath?: string): void;
81
- interface BeautifyDevToolsOptions {
82
- /**
83
- * Sans-serif font family
84
- */
85
- sans: string;
86
- /**
87
- * Monospace font family
88
- */
89
- mono: string;
90
- /**
91
- * Whether to round scrollbar
92
- */
93
- scrollbar?: boolean;
94
- }
95
- /**
96
- * Beautify devtools' font and scrollbar
97
- * @param win target window
98
- * @param options sans font family, mono font family and scrollbar
99
- * @see https://github.com/electron/electron/issues/42055
100
- */
101
- declare function beautifyDevTools(win: BrowserWindow, options: BeautifyDevToolsOptions): void;
102
- /**
103
- * Get joined path from main dir
104
- * @param paths rest paths
105
- */
106
- declare function getPathFromMain(...paths: string[]): string;
107
- /**
108
- * Get joined path from preload dir
109
- * @param paths rest paths
110
- */
111
- declare function getPathFromPreload(...paths: string[]): string;
112
- /**
113
- * Get joined path from publich dir
114
- * @param paths rest paths
115
- */
116
- declare function getPathFromPublic(...paths: string[]): string;
117
- /**
118
- * Get joined path from entry asar
119
- * @param paths rest paths
120
- */
121
- declare function getPathFromEntryAsar(...paths: string[]): string;
122
- /**
123
- * Handle all unhandled error
124
- * @param callback callback function
125
- */
126
- declare function handleUnexpectedErrors(callback: (err: unknown) => void): void;
127
- declare function reloadOnPreloadScriptChanged(): void;
128
-
129
- export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, setPortableDataPath, singleInstance };
package/dist/utils.js DELETED
@@ -1,3 +0,0 @@
1
- export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, setPortableDataPath, singleInstance } from './chunk-IVHNGRZY.js';
2
- export { aesDecrypt, aesEncrypt, defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, defaultSignature, defaultUnzipFile, defaultVerifySignature, defaultZipFile, downloadUtil, getHeader, hashBuffer, resolveJson } from './chunk-PD4EV4MM.js';
3
- export { defaultIsLowerVersion, defaultVersionJsonGenerator, isUpdateJSON, parseVersion } from './chunk-AAAM44NW.js';