electron-incremental-update 3.0.0-beta.5 → 3.0.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/README.md +338 -373
- package/dist/crypto-BSky88mL.cjs +259 -0
- package/dist/crypto-DZzMmoz2.mjs +164 -0
- package/dist/{download-BN4uMS4_.d.mts → download-BVmLiAvB.d.cts} +2 -2
- package/dist/download-BdX4fZYM.mjs +130 -0
- package/dist/{download-DO7iuxEJ.d.cts → download-GONr15zK.d.mts} +2 -2
- package/dist/download-KySXUyWC.cjs +165 -0
- package/dist/{electron-BJCk7uxG.mjs → electron-BrIF1urZ.mjs} +38 -13
- package/dist/electron-CaS0I3S2.cjs +346 -0
- package/dist/index.cjs +66 -34
- package/dist/index.d.cts +10 -13
- package/dist/index.d.mts +10 -13
- package/dist/index.mjs +62 -31
- package/dist/local-C5jw-7o5.mjs +105 -0
- package/dist/local-DbXBG1D9.cjs +118 -0
- package/dist/provider.cjs +24 -43
- package/dist/provider.d.cts +58 -20
- package/dist/provider.d.mts +58 -20
- package/dist/provider.mjs +12 -33
- package/dist/{types-BM9Jfu7q.d.cts → types-q78spjKB.d.cts} +22 -7
- package/dist/{types-DASqEPXE.d.mts → types-q78spjKB.d.mts} +22 -7
- package/dist/utils.cjs +22 -22
- package/dist/utils.d.cts +6 -6
- package/dist/utils.d.mts +6 -6
- package/dist/utils.mjs +4 -5
- package/dist/vite.d.mts +99 -110
- package/dist/vite.mjs +656 -732
- package/package.json +30 -35
- package/dist/electron-C-qmVhAt.cjs +0 -321
- package/dist/version--eVB2A7n.mjs +0 -72
- package/dist/version-aPrLuz_-.cjs +0 -129
- package/dist/zip-BCC7FAQ_.cjs +0 -264
- package/dist/zip-Dwm7s1C9.mjs +0 -185
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region src/utils/type.d.ts
|
|
2
2
|
type Promisable<T> = T | Promise<T>;
|
|
3
3
|
type Arrayable<T> = T | T[];
|
|
4
4
|
//#endregion
|
|
@@ -27,6 +27,11 @@ interface Version {
|
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Parse version string to {@link Version}, like `0.2.0-beta.1`
|
|
30
|
+
*
|
|
31
|
+
* **Supported format**: `major.minor.patch[-stage[.stageVersion]]`
|
|
32
|
+
*
|
|
33
|
+
* Build metadata (`+build`) and complex semver prerelease identifiers
|
|
34
|
+
* (e.g. `1.0.0-beta.1.2`) are not supported yet.
|
|
30
35
|
* @param version version string
|
|
31
36
|
*/
|
|
32
37
|
declare function parseVersion(version: string): Version;
|
|
@@ -66,7 +71,7 @@ type UpdateJSON = UpdateInfo & {
|
|
|
66
71
|
* Check is `UpdateJSON`
|
|
67
72
|
* @param json any variable
|
|
68
73
|
*/
|
|
69
|
-
declare function isUpdateJSON(json:
|
|
74
|
+
declare function isUpdateJSON(json: object): json is UpdateJSON;
|
|
70
75
|
/**
|
|
71
76
|
* Default function to generate `UpdateJSON`
|
|
72
77
|
* @param existingJson exising update json
|
|
@@ -106,7 +111,7 @@ interface DownloadingInfo {
|
|
|
106
111
|
*/
|
|
107
112
|
bps: number;
|
|
108
113
|
}
|
|
109
|
-
type
|
|
114
|
+
type VersionJSON = UpdateInfoWithURL & {
|
|
110
115
|
beta: UpdateInfoWithURL;
|
|
111
116
|
};
|
|
112
117
|
interface IProvider {
|
|
@@ -120,7 +125,7 @@ interface IProvider {
|
|
|
120
125
|
* @param versionPath normalized version path in project
|
|
121
126
|
* @param signal abort signal
|
|
122
127
|
*/
|
|
123
|
-
downloadJSON: (name: string, versionPath: string, signal: AbortSignal) => Promise<
|
|
128
|
+
downloadJSON: (name: string, versionPath: string, signal: AbortSignal) => Promise<VersionJSON>;
|
|
124
129
|
/**
|
|
125
130
|
* Download update asar buffer
|
|
126
131
|
* @param updateInfo existing update info
|
|
@@ -138,7 +143,7 @@ interface IProvider {
|
|
|
138
143
|
* Function to decompress file using brotli
|
|
139
144
|
* @param buffer compressed file buffer
|
|
140
145
|
*/
|
|
141
|
-
|
|
146
|
+
decompressFile: (buffer: Buffer) => Promise<Buffer>;
|
|
142
147
|
/**
|
|
143
148
|
* Verify asar signature,
|
|
144
149
|
* if signature is valid, returns the version, otherwise returns `undefined`
|
|
@@ -147,8 +152,18 @@ interface IProvider {
|
|
|
147
152
|
* @param signature signature
|
|
148
153
|
* @param cert certificate
|
|
149
154
|
*/
|
|
150
|
-
|
|
155
|
+
verifySignature: (buffer: Buffer, version: string, signature: string, cert: string) => Promisable<boolean>;
|
|
151
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Custom URL handler for GitHub provider, useful for mirrors and custom gateways
|
|
159
|
+
* @param url original URL
|
|
160
|
+
* @example
|
|
161
|
+
* (url) => {
|
|
162
|
+
* url.hostname = 'mirror.ghproxy.com'
|
|
163
|
+
* url.pathname = 'https://github.com' + url.pathname
|
|
164
|
+
* return url
|
|
165
|
+
* }
|
|
166
|
+
*/
|
|
152
167
|
type URLHandler = (url: URL) => Promisable<URL | string | undefined | null>;
|
|
153
168
|
//#endregion
|
|
154
|
-
export {
|
|
169
|
+
export { VersionJSON as a, Version as c, isUpdateJSON as d, parseVersion as f, UpdateInfoWithURL as i, defaultIsLowerVersion as l, Promisable as m, IProvider as n, UpdateInfo as o, Arrayable as p, URLHandler as r, UpdateJSON as s, DownloadingInfo as t, defaultVersionJsonGenerator as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region src/utils/type.d.ts
|
|
2
2
|
type Promisable<T> = T | Promise<T>;
|
|
3
3
|
type Arrayable<T> = T | T[];
|
|
4
4
|
//#endregion
|
|
@@ -27,6 +27,11 @@ interface Version {
|
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Parse version string to {@link Version}, like `0.2.0-beta.1`
|
|
30
|
+
*
|
|
31
|
+
* **Supported format**: `major.minor.patch[-stage[.stageVersion]]`
|
|
32
|
+
*
|
|
33
|
+
* Build metadata (`+build`) and complex semver prerelease identifiers
|
|
34
|
+
* (e.g. `1.0.0-beta.1.2`) are not supported yet.
|
|
30
35
|
* @param version version string
|
|
31
36
|
*/
|
|
32
37
|
declare function parseVersion(version: string): Version;
|
|
@@ -66,7 +71,7 @@ type UpdateJSON = UpdateInfo & {
|
|
|
66
71
|
* Check is `UpdateJSON`
|
|
67
72
|
* @param json any variable
|
|
68
73
|
*/
|
|
69
|
-
declare function isUpdateJSON(json:
|
|
74
|
+
declare function isUpdateJSON(json: object): json is UpdateJSON;
|
|
70
75
|
/**
|
|
71
76
|
* Default function to generate `UpdateJSON`
|
|
72
77
|
* @param existingJson exising update json
|
|
@@ -106,7 +111,7 @@ interface DownloadingInfo {
|
|
|
106
111
|
*/
|
|
107
112
|
bps: number;
|
|
108
113
|
}
|
|
109
|
-
type
|
|
114
|
+
type VersionJSON = UpdateInfoWithURL & {
|
|
110
115
|
beta: UpdateInfoWithURL;
|
|
111
116
|
};
|
|
112
117
|
interface IProvider {
|
|
@@ -120,7 +125,7 @@ interface IProvider {
|
|
|
120
125
|
* @param versionPath normalized version path in project
|
|
121
126
|
* @param signal abort signal
|
|
122
127
|
*/
|
|
123
|
-
downloadJSON: (name: string, versionPath: string, signal: AbortSignal) => Promise<
|
|
128
|
+
downloadJSON: (name: string, versionPath: string, signal: AbortSignal) => Promise<VersionJSON>;
|
|
124
129
|
/**
|
|
125
130
|
* Download update asar buffer
|
|
126
131
|
* @param updateInfo existing update info
|
|
@@ -138,7 +143,7 @@ interface IProvider {
|
|
|
138
143
|
* Function to decompress file using brotli
|
|
139
144
|
* @param buffer compressed file buffer
|
|
140
145
|
*/
|
|
141
|
-
|
|
146
|
+
decompressFile: (buffer: Buffer) => Promise<Buffer>;
|
|
142
147
|
/**
|
|
143
148
|
* Verify asar signature,
|
|
144
149
|
* if signature is valid, returns the version, otherwise returns `undefined`
|
|
@@ -147,8 +152,18 @@ interface IProvider {
|
|
|
147
152
|
* @param signature signature
|
|
148
153
|
* @param cert certificate
|
|
149
154
|
*/
|
|
150
|
-
|
|
155
|
+
verifySignature: (buffer: Buffer, version: string, signature: string, cert: string) => Promisable<boolean>;
|
|
151
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Custom URL handler for GitHub provider, useful for mirrors and custom gateways
|
|
159
|
+
* @param url original URL
|
|
160
|
+
* @example
|
|
161
|
+
* (url) => {
|
|
162
|
+
* url.hostname = 'mirror.ghproxy.com'
|
|
163
|
+
* url.pathname = 'https://github.com' + url.pathname
|
|
164
|
+
* return url
|
|
165
|
+
* }
|
|
166
|
+
*/
|
|
152
167
|
type URLHandler = (url: URL) => Promisable<URL | string | undefined | null>;
|
|
153
168
|
//#endregion
|
|
154
|
-
export {
|
|
169
|
+
export { VersionJSON as a, Version as c, isUpdateJSON as d, parseVersion as f, UpdateInfoWithURL as i, defaultIsLowerVersion as l, Promisable as m, IProvider as n, UpdateInfo as o, Arrayable as p, URLHandler as r, UpdateJSON as s, DownloadingInfo as t, defaultVersionJsonGenerator as u };
|
package/dist/utils.cjs
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
exports.aesDecrypt =
|
|
6
|
-
exports.aesEncrypt =
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_crypto = require("./crypto-BSky88mL.cjs");
|
|
3
|
+
const require_electron = require("./electron-CaS0I3S2.cjs");
|
|
4
|
+
const require_download = require("./download-KySXUyWC.cjs");
|
|
5
|
+
exports.aesDecrypt = require_crypto.aesDecrypt;
|
|
6
|
+
exports.aesEncrypt = require_crypto.aesEncrypt;
|
|
7
7
|
exports.beautifyDevTools = require_electron.beautifyDevTools;
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
8
|
+
exports.defaultCompressFile = require_crypto.defaultCompressFile;
|
|
9
|
+
exports.defaultDecompressFile = require_crypto.defaultDecompressFile;
|
|
10
|
+
exports.defaultDownloadAsar = require_download.defaultDownloadAsar;
|
|
11
|
+
exports.defaultDownloadText = require_download.defaultDownloadText;
|
|
12
|
+
exports.defaultDownloadUpdateJSON = require_download.defaultDownloadUpdateJSON;
|
|
13
|
+
exports.defaultIsLowerVersion = require_crypto.defaultIsLowerVersion;
|
|
14
|
+
exports.defaultSignature = require_crypto.defaultSignature;
|
|
15
|
+
exports.defaultVerifySignature = require_crypto.defaultVerifySignature;
|
|
16
|
+
exports.defaultVersionJsonGenerator = require_crypto.defaultVersionJsonGenerator;
|
|
17
17
|
exports.disableHWAccForWin7 = require_electron.disableHWAccForWin7;
|
|
18
|
-
exports.downloadUtil =
|
|
18
|
+
exports.downloadUtil = require_download.downloadUtil;
|
|
19
19
|
exports.getAppVersion = require_electron.getAppVersion;
|
|
20
20
|
exports.getEntryVersion = require_electron.getEntryVersion;
|
|
21
|
-
exports.getHeader =
|
|
21
|
+
exports.getHeader = require_download.getHeader;
|
|
22
22
|
exports.getPathFromAppNameAsar = require_electron.getPathFromAppNameAsar;
|
|
23
23
|
exports.getPathFromEntryAsar = require_electron.getPathFromEntryAsar;
|
|
24
24
|
exports.getPathFromMain = require_electron.getPathFromMain;
|
|
25
25
|
exports.getPathFromPreload = require_electron.getPathFromPreload;
|
|
26
26
|
exports.getPathFromPublic = require_electron.getPathFromPublic;
|
|
27
27
|
exports.handleUnexpectedErrors = require_electron.handleUnexpectedErrors;
|
|
28
|
-
exports.hashBuffer =
|
|
28
|
+
exports.hashBuffer = require_crypto.hashBuffer;
|
|
29
29
|
exports.importNative = require_electron.importNative;
|
|
30
30
|
exports.isDev = require_electron.isDev;
|
|
31
31
|
exports.isLinux = require_electron.isLinux;
|
|
32
32
|
exports.isMac = require_electron.isMac;
|
|
33
|
-
exports.isUpdateJSON =
|
|
33
|
+
exports.isUpdateJSON = require_crypto.isUpdateJSON;
|
|
34
34
|
exports.isWin = require_electron.isWin;
|
|
35
35
|
exports.loadPage = require_electron.loadPage;
|
|
36
|
-
exports.parseVersion =
|
|
36
|
+
exports.parseVersion = require_crypto.parseVersion;
|
|
37
37
|
exports.reloadOnPreloadScriptChanged = require_electron.reloadOnPreloadScriptChanged;
|
|
38
38
|
exports.requireNative = require_electron.requireNative;
|
|
39
|
-
exports.resolveJson =
|
|
39
|
+
exports.resolveJson = require_download.resolveJson;
|
|
40
40
|
exports.restartApp = require_electron.restartApp;
|
|
41
41
|
exports.setAppUserModelId = require_electron.setAppUserModelId;
|
|
42
42
|
exports.setPortableAppDataPath = require_electron.setPortableAppDataPath;
|
|
43
43
|
exports.setPortableDataPath = require_electron.setPortableDataPath;
|
|
44
|
-
exports.singleInstance = require_electron.singleInstance;
|
|
44
|
+
exports.singleInstance = require_electron.singleInstance;
|
package/dist/utils.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as Version, d as isUpdateJSON, f as parseVersion, l as defaultIsLowerVersion, o as UpdateInfo, s as UpdateJSON, u as defaultVersionJsonGenerator } from "./types-
|
|
2
|
-
import { a as getHeader, i as downloadUtil, n as defaultDownloadText, o as resolveJson, r as defaultDownloadUpdateJSON, t as defaultDownloadAsar } from "./download-
|
|
1
|
+
import { c as Version, d as isUpdateJSON, f as parseVersion, l as defaultIsLowerVersion, o as UpdateInfo, s as UpdateJSON, u as defaultVersionJsonGenerator } from "./types-q78spjKB.cjs";
|
|
2
|
+
import { a as getHeader, i as downloadUtil, n as defaultDownloadText, o as resolveJson, r as defaultDownloadUpdateJSON, t as defaultDownloadAsar } from "./download-BVmLiAvB.cjs";
|
|
3
3
|
import { BrowserWindow } from "electron";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/crypto.d.ts
|
|
@@ -149,16 +149,16 @@ declare function handleUnexpectedErrors(callback: (err: unknown) => void): void;
|
|
|
149
149
|
*/
|
|
150
150
|
declare function reloadOnPreloadScriptChanged(): void;
|
|
151
151
|
//#endregion
|
|
152
|
-
//#region src/utils/
|
|
152
|
+
//#region src/utils/compress.d.ts
|
|
153
153
|
/**
|
|
154
154
|
* Default function to compress file using brotli
|
|
155
155
|
* @param buffer uncompressed file buffer
|
|
156
156
|
*/
|
|
157
|
-
declare function
|
|
157
|
+
declare function defaultCompressFile(buffer: Buffer): Promise<Buffer>;
|
|
158
158
|
/**
|
|
159
159
|
* Default function to decompress file using brotli
|
|
160
160
|
* @param buffer compressed file buffer
|
|
161
161
|
*/
|
|
162
|
-
declare function
|
|
162
|
+
declare function defaultDecompressFile(buffer: Buffer): Promise<Buffer>;
|
|
163
163
|
//#endregion
|
|
164
|
-
export { UpdateInfo, UpdateJSON, Version, aesDecrypt, aesEncrypt, beautifyDevTools, defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, defaultIsLowerVersion, defaultSignature,
|
|
164
|
+
export { UpdateInfo, UpdateJSON, Version, aesDecrypt, aesEncrypt, beautifyDevTools, defaultCompressFile, defaultDecompressFile, defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, defaultIsLowerVersion, defaultSignature, defaultVerifySignature, defaultVersionJsonGenerator, disableHWAccForWin7, downloadUtil, getAppVersion, getEntryVersion, getHeader, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, hashBuffer, importNative, isDev, isLinux, isMac, isUpdateJSON, isWin, loadPage, parseVersion, reloadOnPreloadScriptChanged, requireNative, resolveJson, restartApp, setAppUserModelId, setPortableAppDataPath, setPortableDataPath, singleInstance };
|
package/dist/utils.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as Version, d as isUpdateJSON, f as parseVersion, l as defaultIsLowerVersion, o as UpdateInfo, s as UpdateJSON, u as defaultVersionJsonGenerator } from "./types-
|
|
2
|
-
import { a as getHeader, i as downloadUtil, n as defaultDownloadText, o as resolveJson, r as defaultDownloadUpdateJSON, t as defaultDownloadAsar } from "./download-
|
|
1
|
+
import { c as Version, d as isUpdateJSON, f as parseVersion, l as defaultIsLowerVersion, o as UpdateInfo, s as UpdateJSON, u as defaultVersionJsonGenerator } from "./types-q78spjKB.mjs";
|
|
2
|
+
import { a as getHeader, i as downloadUtil, n as defaultDownloadText, o as resolveJson, r as defaultDownloadUpdateJSON, t as defaultDownloadAsar } from "./download-GONr15zK.mjs";
|
|
3
3
|
import { BrowserWindow } from "electron";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/crypto.d.ts
|
|
@@ -149,16 +149,16 @@ declare function handleUnexpectedErrors(callback: (err: unknown) => void): void;
|
|
|
149
149
|
*/
|
|
150
150
|
declare function reloadOnPreloadScriptChanged(): void;
|
|
151
151
|
//#endregion
|
|
152
|
-
//#region src/utils/
|
|
152
|
+
//#region src/utils/compress.d.ts
|
|
153
153
|
/**
|
|
154
154
|
* Default function to compress file using brotli
|
|
155
155
|
* @param buffer uncompressed file buffer
|
|
156
156
|
*/
|
|
157
|
-
declare function
|
|
157
|
+
declare function defaultCompressFile(buffer: Buffer): Promise<Buffer>;
|
|
158
158
|
/**
|
|
159
159
|
* Default function to decompress file using brotli
|
|
160
160
|
* @param buffer compressed file buffer
|
|
161
161
|
*/
|
|
162
|
-
declare function
|
|
162
|
+
declare function defaultDecompressFile(buffer: Buffer): Promise<Buffer>;
|
|
163
163
|
//#endregion
|
|
164
|
-
export { UpdateInfo, UpdateJSON, Version, aesDecrypt, aesEncrypt, beautifyDevTools, defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, defaultIsLowerVersion, defaultSignature,
|
|
164
|
+
export { UpdateInfo, UpdateJSON, Version, aesDecrypt, aesEncrypt, beautifyDevTools, defaultCompressFile, defaultDecompressFile, defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, defaultIsLowerVersion, defaultSignature, defaultVerifySignature, defaultVersionJsonGenerator, disableHWAccForWin7, downloadUtil, getAppVersion, getEntryVersion, getHeader, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, hashBuffer, importNative, isDev, isLinux, isMac, isUpdateJSON, isWin, loadPage, parseVersion, reloadOnPreloadScriptChanged, requireNative, resolveJson, restartApp, setAppUserModelId, setPortableAppDataPath, setPortableDataPath, singleInstance };
|
package/dist/utils.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as
|
|
3
|
-
import { a as
|
|
4
|
-
|
|
5
|
-
export { aesDecrypt, aesEncrypt, beautifyDevTools, defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, defaultIsLowerVersion, defaultSignature, defaultUnzipFile, defaultVerifySignature, defaultVersionJsonGenerator, defaultZipFile, disableHWAccForWin7, downloadUtil, getAppVersion, getEntryVersion, getHeader, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, hashBuffer, importNative, isDev, isLinux, isMac, isUpdateJSON, isWin, loadPage, parseVersion, reloadOnPreloadScriptChanged, requireNative, resolveJson, restartApp, setAppUserModelId, setPortableAppDataPath, setPortableDataPath, singleInstance };
|
|
1
|
+
import { a as hashBuffer, c as defaultIsLowerVersion, d as parseVersion, i as defaultVerifySignature, l as defaultVersionJsonGenerator, n as aesEncrypt, o as defaultCompressFile, r as defaultSignature, s as defaultDecompressFile, t as aesDecrypt, u as isUpdateJSON } from "./crypto-DZzMmoz2.mjs";
|
|
2
|
+
import { C as singleInstance, S as setPortableDataPath, _ as reloadOnPreloadScriptChanged, a as getPathFromAppNameAsar, b as setAppUserModelId, c as getPathFromPreload, d as importNative, f as isDev, g as loadPage, h as isWin, i as getEntryVersion, l as getPathFromPublic, m as isMac, n as disableHWAccForWin7, o as getPathFromEntryAsar, p as isLinux, r as getAppVersion, s as getPathFromMain, t as beautifyDevTools, u as handleUnexpectedErrors, v as requireNative, x as setPortableAppDataPath, y as restartApp } from "./electron-BrIF1urZ.mjs";
|
|
3
|
+
import { a as getHeader, i as downloadUtil, n as defaultDownloadText, o as resolveJson, r as defaultDownloadUpdateJSON, t as defaultDownloadAsar } from "./download-BdX4fZYM.mjs";
|
|
4
|
+
export { aesDecrypt, aesEncrypt, beautifyDevTools, defaultCompressFile, defaultDecompressFile, defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, defaultIsLowerVersion, defaultSignature, defaultVerifySignature, defaultVersionJsonGenerator, disableHWAccForWin7, downloadUtil, getAppVersion, getEntryVersion, getHeader, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, hashBuffer, importNative, isDev, isLinux, isMac, isUpdateJSON, isWin, loadPage, parseVersion, reloadOnPreloadScriptChanged, requireNative, resolveJson, restartApp, setAppUserModelId, setPortableAppDataPath, setPortableDataPath, singleInstance };
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,50 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Plugin, UserConfig } from "vite";
|
|
2
|
+
import { MultiEnvElectronOptions } from "vite-plugin-electron/multi-env";
|
|
3
|
+
import { RolldownOrRollupOptions } from "vite-plugin-electron";
|
|
3
4
|
|
|
4
|
-
//#region
|
|
5
|
+
//#region src/utils/type.d.ts
|
|
5
6
|
type Promisable<T> = T | Promise<T>;
|
|
6
|
-
type AnyFunction
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/vite/electron/core.d.ts
|
|
9
|
-
interface ElectronOptions {
|
|
10
|
-
/**
|
|
11
|
-
* Shortcut of `build.lib.entry`
|
|
12
|
-
*/
|
|
13
|
-
entry?: LibraryOptions["entry"];
|
|
14
|
-
vite?: InlineConfig;
|
|
15
|
-
/**
|
|
16
|
-
* Triggered when Vite is built every time -- `vite serve` command only.
|
|
17
|
-
*
|
|
18
|
-
* If this `onstart` is passed, Electron App will not start automatically.
|
|
19
|
-
* However, you can start Electroo App via `startup` function.
|
|
20
|
-
*/
|
|
21
|
-
onstart?: (args: {
|
|
22
|
-
/**
|
|
23
|
-
* Electron App startup function.
|
|
24
|
-
* It will mount the Electron App child-process to `process.electronApp`.
|
|
25
|
-
* - argv: electron startup arguments (default `['.', '--no-sandbox']`)
|
|
26
|
-
* - options: options for `child_process.spawn`
|
|
27
|
-
* - customElectronPkg: custom electron package name (default: `'electron'`)
|
|
28
|
-
*/
|
|
29
|
-
startup: (argv?: string[], options?: SpawnOptions, customElectronPkg?: string) => Promise<void>; /** Reload Electron-Renderer */
|
|
30
|
-
reload: () => void;
|
|
31
|
-
}) => void | Promise<void>;
|
|
32
|
-
}
|
|
7
|
+
type AnyFunction = (...args: any[]) => any;
|
|
33
8
|
//#endregion
|
|
34
9
|
//#region src/vite/startup.d.ts
|
|
35
|
-
type StartupFn = NonNullable<ElectronOptions["onstart"]>;
|
|
36
|
-
/**
|
|
37
|
-
* Debug mode startup function
|
|
38
|
-
* Automatically starts Electron in VSCode debug mode
|
|
39
|
-
* @param args - Startup arguments
|
|
40
|
-
*/
|
|
41
|
-
declare function debugStartup(args: Parameters<StartupFn>[0]): Promise<void>;
|
|
42
10
|
/**
|
|
43
11
|
* Filter error messages from stdout/stderr during startup
|
|
44
12
|
* @param args - Startup arguments
|
|
45
13
|
* @param filter - Filter function to determine which messages to show
|
|
46
14
|
*/
|
|
47
|
-
declare function filterErrorMessageStartup(
|
|
15
|
+
declare function filterErrorMessageStartup(filter: (msg: string) => boolean): Promise<void>;
|
|
48
16
|
/**
|
|
49
17
|
* Fix Windows character encoding by setting code page to UTF-8
|
|
50
18
|
* @param fn - Function to wrap with encoding fix
|
|
@@ -83,8 +51,11 @@ type UpdateJSON = UpdateInfo & {
|
|
|
83
51
|
//#region src/vite/bytecode/index.d.ts
|
|
84
52
|
/** Options for bytecode compilation */
|
|
85
53
|
interface BytecodeOptions {
|
|
86
|
-
/**
|
|
87
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Enable bytecode compilation
|
|
56
|
+
* @default true
|
|
57
|
+
*/
|
|
58
|
+
enable?: boolean;
|
|
88
59
|
/**
|
|
89
60
|
* Enable in preload script. Remember to set `sandbox: false` when creating window
|
|
90
61
|
*/
|
|
@@ -131,16 +102,16 @@ interface DistinguishedName {
|
|
|
131
102
|
emailAddress?: string;
|
|
132
103
|
}
|
|
133
104
|
//#endregion
|
|
134
|
-
//#region src/vite/
|
|
105
|
+
//#region src/vite/types.d.ts
|
|
135
106
|
interface CommonBuildOption {
|
|
136
107
|
/**
|
|
137
108
|
* Shortcut of `build.rolldownOptions.input`
|
|
138
109
|
*/
|
|
139
|
-
files: NonNullable<
|
|
110
|
+
files: NonNullable<MultiEnvElectronOptions["input"]>;
|
|
140
111
|
/**
|
|
141
112
|
* Override vite options
|
|
142
113
|
*/
|
|
143
|
-
|
|
114
|
+
options?: MultiEnvElectronOptions["options"] & {
|
|
144
115
|
build?: {
|
|
145
116
|
outDir: never;
|
|
146
117
|
sourcemap: never;
|
|
@@ -154,21 +125,6 @@ interface CommonBuildOption {
|
|
|
154
125
|
};
|
|
155
126
|
}
|
|
156
127
|
interface ElectronWithUpdaterOptions {
|
|
157
|
-
/**
|
|
158
|
-
* Whether is in build mode
|
|
159
|
-
* ```ts
|
|
160
|
-
* export default defineConfig(({ command }) => {
|
|
161
|
-
* const isBuild = command === 'build'
|
|
162
|
-
* })
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
165
|
-
isBuild: boolean;
|
|
166
|
-
/**
|
|
167
|
-
* Project root directory. Can be an absolute path, or a path relative from
|
|
168
|
-
* the location of the config file itself.
|
|
169
|
-
* @default process.cwd()
|
|
170
|
-
*/
|
|
171
|
-
root?: string;
|
|
172
128
|
/**
|
|
173
129
|
* Whether to generate sourcemap
|
|
174
130
|
* @default !isBuild || !!process.env.VSCODE_DEBUG
|
|
@@ -188,9 +144,15 @@ interface ElectronWithUpdaterOptions {
|
|
|
188
144
|
*/
|
|
189
145
|
bytecode?: boolean | BytecodeOptions;
|
|
190
146
|
/**
|
|
191
|
-
*
|
|
147
|
+
* Faster dev startup by externalize all node modules in entry and main.
|
|
148
|
+
*
|
|
149
|
+
* Only works in development (`isBuild === false`).
|
|
192
150
|
* @default true
|
|
193
151
|
*/
|
|
152
|
+
notBundle?: boolean | RolldownOrRollupOptions["external"];
|
|
153
|
+
/**
|
|
154
|
+
* @deprecated use `notBundle` instead
|
|
155
|
+
*/
|
|
194
156
|
useNotBundle?: boolean;
|
|
195
157
|
/**
|
|
196
158
|
* Whether to generate version json
|
|
@@ -198,12 +160,21 @@ interface ElectronWithUpdaterOptions {
|
|
|
198
160
|
*/
|
|
199
161
|
buildVersionJson?: boolean;
|
|
200
162
|
/**
|
|
163
|
+
* Generate and serve a local update package during dev startup.
|
|
164
|
+
*
|
|
165
|
+
* This is useful for testing update checks, simulated download progress,
|
|
166
|
+
* and restart/install behavior without publishing a remote release.
|
|
167
|
+
*
|
|
168
|
+
* @default false
|
|
169
|
+
*/
|
|
170
|
+
localDevUpdate?: boolean | LocalDevUpdateOptions;
|
|
171
|
+
/**
|
|
201
172
|
* Addtional `external` option in `build.rolldownOptions`,
|
|
202
173
|
*
|
|
203
|
-
* If
|
|
174
|
+
* If equals `true`,
|
|
204
175
|
* external `dependencies` in `package.json` by default
|
|
205
176
|
*/
|
|
206
|
-
external?: (string | RegExp)[];
|
|
177
|
+
external?: (string | RegExp)[] | boolean;
|
|
207
178
|
/**
|
|
208
179
|
* Options for entry (app.asar)
|
|
209
180
|
*
|
|
@@ -273,7 +244,7 @@ interface ElectronWithUpdaterOptions {
|
|
|
273
244
|
* @param options options for `child_process.spawn`
|
|
274
245
|
* @param customElectronPkg custom electron package name (default: 'electron')
|
|
275
246
|
*/
|
|
276
|
-
onstart?:
|
|
247
|
+
onstart?: MultiEnvElectronOptions["onstart"];
|
|
277
248
|
} & CommonBuildOption;
|
|
278
249
|
/**
|
|
279
250
|
* Preload process options
|
|
@@ -286,29 +257,37 @@ interface ElectronWithUpdaterOptions {
|
|
|
286
257
|
*/
|
|
287
258
|
updater?: UpdaterOptions;
|
|
288
259
|
}
|
|
289
|
-
interface
|
|
260
|
+
interface LocalDevUpdateOptions {
|
|
290
261
|
/**
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
262
|
+
* Package file used for local dev update name/version.
|
|
263
|
+
*
|
|
264
|
+
* This is useful when the Electron app package is not the project root
|
|
265
|
+
* package, such as a playground or example app.
|
|
266
|
+
*
|
|
267
|
+
* @default project package.json
|
|
296
268
|
*/
|
|
297
|
-
|
|
269
|
+
packageJsonPath?: string;
|
|
298
270
|
/**
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
* @
|
|
271
|
+
* Directory that contains local update resources.
|
|
272
|
+
*
|
|
273
|
+
* The generated version file is written under `{baseDir}/{versionPath}` and
|
|
274
|
+
* update archives are written as `{baseDir}/{name}-{version}.asar.br`.
|
|
275
|
+
*
|
|
276
|
+
* @default 'release/local-update'
|
|
305
277
|
*/
|
|
306
|
-
|
|
278
|
+
baseDir?: string;
|
|
307
279
|
/**
|
|
308
|
-
*
|
|
309
|
-
*
|
|
280
|
+
* Local read chunk size for simulated download progress.
|
|
281
|
+
*
|
|
282
|
+
* @default LocalDevProvider default
|
|
310
283
|
*/
|
|
311
|
-
|
|
284
|
+
chunkSize?: number;
|
|
285
|
+
/**
|
|
286
|
+
* Delay between simulated progress chunks in milliseconds.
|
|
287
|
+
*
|
|
288
|
+
* @default LocalDevProvider default
|
|
289
|
+
*/
|
|
290
|
+
chunkDelay?: number;
|
|
312
291
|
}
|
|
313
292
|
interface UpdaterOptions {
|
|
314
293
|
/**
|
|
@@ -332,14 +311,14 @@ interface UpdaterOptions {
|
|
|
332
311
|
entryOutDir?: string;
|
|
333
312
|
/**
|
|
334
313
|
* Path to version info output, content is {@link UpdateJSON}
|
|
335
|
-
* @default `version.json`
|
|
314
|
+
* @default `release/version.json`
|
|
336
315
|
*/
|
|
337
316
|
versionPath?: string;
|
|
338
317
|
/**
|
|
339
|
-
* Path to
|
|
340
|
-
* @default `release/${app.name}-${version}.asar.
|
|
318
|
+
* Path to compressed asar file
|
|
319
|
+
* @default `release/${app.name}-${version}.asar.br`
|
|
341
320
|
*/
|
|
342
|
-
|
|
321
|
+
compressedPath?: string;
|
|
343
322
|
/**
|
|
344
323
|
* Path to electron build output
|
|
345
324
|
* @default `dist-electron`
|
|
@@ -398,23 +377,45 @@ interface UpdaterOptions {
|
|
|
398
377
|
};
|
|
399
378
|
overrideGenerator?: GeneratorOverrideFunctions;
|
|
400
379
|
}
|
|
380
|
+
interface GeneratorOverrideFunctions {
|
|
381
|
+
/**
|
|
382
|
+
* Custom signature generate function
|
|
383
|
+
* @param buffer file buffer
|
|
384
|
+
* @param privateKey private key
|
|
385
|
+
* @param cert certificate string, **EOL must be `\n`**
|
|
386
|
+
* @param version current version
|
|
387
|
+
*/
|
|
388
|
+
generateSignature?: (buffer: Buffer, privateKey: string, cert: string, version: string) => Promisable<string>;
|
|
389
|
+
/**
|
|
390
|
+
* Custom generate update json function
|
|
391
|
+
* @param existingJson The existing JSON object.
|
|
392
|
+
* @param signature generated signature
|
|
393
|
+
* @param version current version
|
|
394
|
+
* @param minVersion The minimum version
|
|
395
|
+
*/
|
|
396
|
+
generateUpdateJson?: (existingJson: UpdateJSON, signature: string, version: string, minVersion: string) => Promisable<UpdateJSON>;
|
|
397
|
+
/**
|
|
398
|
+
* Custom generate compressed file buffer
|
|
399
|
+
* @param buffer source buffer
|
|
400
|
+
*/
|
|
401
|
+
generateCompressedFile?: (buffer: Buffer) => Promisable<Buffer>;
|
|
402
|
+
}
|
|
401
403
|
//#endregion
|
|
402
404
|
//#region src/vite/core.d.ts
|
|
403
405
|
/**
|
|
404
|
-
* Base on
|
|
406
|
+
* Base on `vite-plugin-electron/multi-env`
|
|
405
407
|
* - integrate with updater
|
|
406
408
|
* - no `renderer` config
|
|
407
409
|
* - remove old output file
|
|
408
410
|
* - externalize dependencies
|
|
409
411
|
* - auto restart when entry file changes
|
|
410
|
-
* - other configs in {@link https://github.com/electron-vite/electron-vite-vue/blob/main/vite.config.ts electron-vite-vue template}
|
|
411
412
|
*
|
|
412
|
-
* You can override all the
|
|
413
|
+
* You can override all the environment configs, except output directories (use `options.updater.paths.electronDistPath` instead)
|
|
413
414
|
*
|
|
414
415
|
* @example
|
|
415
416
|
* ```ts
|
|
416
417
|
* import { defineConfig } from 'vite'
|
|
417
|
-
* import {
|
|
418
|
+
* import { electronWithUpdater } from 'electron-incremental-update/vite'
|
|
418
419
|
*
|
|
419
420
|
* export default defineConfig(async ({ command }) => {
|
|
420
421
|
* const isBuild = command === 'build'
|
|
@@ -424,8 +425,6 @@ interface UpdaterOptions {
|
|
|
424
425
|
* isBuild,
|
|
425
426
|
* main: {
|
|
426
427
|
* files: ['./electron/main/index.ts', './electron/main/worker.ts'],
|
|
427
|
-
* // see https://github.com/electron-vite/electron-vite-vue/blob/85ed267c4851bf59f32888d766c0071661d4b94c/vite.config.ts#L22-L28
|
|
428
|
-
* onstart: debugStartup,
|
|
429
428
|
* },
|
|
430
429
|
* preload: {
|
|
431
430
|
* files: './electron/preload/index.ts',
|
|
@@ -435,22 +434,19 @@ interface UpdaterOptions {
|
|
|
435
434
|
* }
|
|
436
435
|
* }),
|
|
437
436
|
* ],
|
|
438
|
-
* server: process.env.VSCODE_DEBUG && (() => {
|
|
439
|
-
* const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL)
|
|
440
|
-
* return {
|
|
441
|
-
* host: url.hostname,
|
|
442
|
-
* port: +url.port,
|
|
443
|
-
* }
|
|
444
|
-
* })(),
|
|
445
437
|
* }
|
|
446
438
|
* })
|
|
447
439
|
* ```
|
|
448
440
|
*/
|
|
449
|
-
declare function electronWithUpdater(options: ElectronWithUpdaterOptions): Promise<
|
|
441
|
+
declare function electronWithUpdater(options: ElectronWithUpdaterOptions): Promise<Plugin[] | undefined>;
|
|
450
442
|
//#endregion
|
|
451
443
|
//#region src/vite/define.d.ts
|
|
452
|
-
|
|
453
|
-
|
|
444
|
+
interface ElectronViteHelperOptions extends ElectronWithUpdaterOptions {
|
|
445
|
+
/**
|
|
446
|
+
* Root dir of project
|
|
447
|
+
* @default process.cwd()
|
|
448
|
+
*/
|
|
449
|
+
root?: string;
|
|
454
450
|
/**
|
|
455
451
|
* Config for renderer process
|
|
456
452
|
*/
|
|
@@ -464,10 +460,9 @@ interface ElectronViteHelperOptions extends MakeOptional<ElectronWithUpdaterOpti
|
|
|
464
460
|
* import { defineElectronConfig } from 'electron-incremental-update/vite'
|
|
465
461
|
*
|
|
466
462
|
* export default defineElectronConfig({
|
|
463
|
+
* // root: './apps'
|
|
467
464
|
* main: {
|
|
468
465
|
* files: ['./electron/main/index.ts', './electron/main/worker.ts'],
|
|
469
|
-
* // see https://github.com/electron-vite/electron-vite-vue/blob/85ed267c4851bf59f32888d766c0071661d4b94c/vite.config.ts#L22-L28
|
|
470
|
-
* onstart: debugStartup,
|
|
471
466
|
* },
|
|
472
467
|
* preload: {
|
|
473
468
|
* files: './electron/preload/index.ts',
|
|
@@ -476,17 +471,11 @@ interface ElectronViteHelperOptions extends MakeOptional<ElectronWithUpdaterOpti
|
|
|
476
471
|
* // options
|
|
477
472
|
* },
|
|
478
473
|
* renderer: {
|
|
479
|
-
*
|
|
480
|
-
* const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL)
|
|
481
|
-
* return {
|
|
482
|
-
* host: url.hostname,
|
|
483
|
-
* port: +url.port,
|
|
484
|
-
* }
|
|
485
|
-
* })(),
|
|
474
|
+
* // plugins: []
|
|
486
475
|
* }
|
|
487
476
|
* })
|
|
488
477
|
* ```
|
|
489
478
|
*/
|
|
490
|
-
declare function defineElectronConfig(options: ElectronViteHelperOptions):
|
|
479
|
+
declare function defineElectronConfig(options: ElectronViteHelperOptions): UserConfig;
|
|
491
480
|
//#endregion
|
|
492
|
-
export { type ElectronViteHelperOptions, type ElectronWithUpdaterOptions,
|
|
481
|
+
export { type ElectronViteHelperOptions, type ElectronWithUpdaterOptions, type LocalDevUpdateOptions, electronWithUpdater as default, electronWithUpdater, defineElectronConfig, filterErrorMessageStartup, fixWinCharEncoding };
|