electron-incremental-update 2.2.6 → 2.3.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/dist/{chunk-KLUIYBS4.js → chunk-QPAKJHVM.js} +4 -4
- package/dist/index.cjs +64 -15
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +64 -15
- package/dist/provider.cjs +78 -77
- package/dist/provider.d.cts +58 -61
- package/dist/provider.d.ts +58 -61
- package/dist/provider.js +76 -76
- package/dist/{types-1T_tRG8a.d.cts → types-CU7GyVez.d.cts} +2 -2
- package/dist/{types-1T_tRG8a.d.ts → types-CU7GyVez.d.ts} +2 -2
- package/dist/utils.cjs +5 -4
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -1
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +33 -32
- package/dist/{zip-ChpUyjy1.d.cts → zip-Blmn2vzE.d.cts} +4 -3
- package/dist/{zip-DUHOPZrB.d.ts → zip-CnSv_Njj.d.ts} +4 -3
- package/package.json +2 -1
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { b as aesDecrypt, a as aesEncrypt, j as defaultDownloadAsar, f as
|
|
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
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-
|
|
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
4
|
import '@subframe7536/type-utils';
|
|
5
5
|
import 'node:url';
|
|
6
6
|
|
package/dist/utils.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, singleInstance } from './chunk-QKKPETVJ.js';
|
|
2
|
-
export { aesDecrypt, aesEncrypt, defaultDownloadAsar,
|
|
2
|
+
export { aesDecrypt, aesEncrypt, defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, defaultSignature, defaultUnzipFile, defaultVerifySignature, defaultZipFile, downloadUtil, getHeader, hashBuffer, resolveJson } from './chunk-QPAKJHVM.js';
|
|
3
3
|
export { defaultIsLowerVersion, defaultVersionJsonGenerator, isUpdateJSON, parseVersion } from './chunk-AAAM44NW.js';
|
package/dist/vite.d.ts
CHANGED
|
@@ -288,14 +288,14 @@ declare function convertLiteral(code: string, sourcemap?: boolean, offset?: numb
|
|
|
288
288
|
map?: any;
|
|
289
289
|
};
|
|
290
290
|
|
|
291
|
-
type MakeRequired<T, K extends keyof T> =
|
|
291
|
+
type MakeRequired<T, K extends keyof T> = NonNullable<T> & {
|
|
292
292
|
[P in K]-?: T[P];
|
|
293
293
|
};
|
|
294
294
|
type ReplaceKey<T, Key extends keyof T, NewKey extends string> = Omit<T, Key> & {
|
|
295
295
|
[P in NewKey]: T[Key];
|
|
296
296
|
};
|
|
297
297
|
type MakeRequiredAndReplaceKey<T, K extends keyof T, NewKey extends string> = MakeRequired<ReplaceKey<T, K, NewKey>, NewKey>;
|
|
298
|
-
type StartupFn =
|
|
298
|
+
type StartupFn = NonNullable<NonNullable<ElectronSimpleOptions['preload']>['onstart']>;
|
|
299
299
|
/**
|
|
300
300
|
* Startup function for debug (see {@link https://github.com/electron-vite/electron-vite-vue/blob/main/vite.config.ts electron-vite-vue template})
|
|
301
301
|
* @example
|
package/dist/vite.js
CHANGED
|
@@ -88,8 +88,8 @@ async function buildEntry({
|
|
|
88
88
|
},
|
|
89
89
|
vite: mergeConfig({
|
|
90
90
|
plugins: [
|
|
91
|
-
isESM &&
|
|
92
|
-
bytecodeOptions &&
|
|
91
|
+
isESM && import('./esm-4S4XCVEW.js').then((m) => m.esm()),
|
|
92
|
+
bytecodeOptions && import('./bytecode-7J2ZQDDO.js').then((m) => m.bytecodePlugin("main", bytecodeOptions))
|
|
93
93
|
],
|
|
94
94
|
build: {
|
|
95
95
|
sourcemap,
|
|
@@ -255,6 +255,7 @@ function parseOptions(pkg, sourcemap = false, minify = false, options = {}) {
|
|
|
255
255
|
};
|
|
256
256
|
return { buildAsarOption, buildEntryOption, buildVersionOption, postBuild, cert };
|
|
257
257
|
}
|
|
258
|
+
var vite_default = electronWithUpdater;
|
|
258
259
|
var debugStartup = (args) => {
|
|
259
260
|
if (process.env.VSCODE_DEBUG) {
|
|
260
261
|
console.log("[startup] Electron App");
|
|
@@ -349,7 +350,7 @@ async function electronWithUpdater(options) {
|
|
|
349
350
|
__EIU_SIGNATURE_CERT__: JSON.stringify(cert),
|
|
350
351
|
__EIU_VERSION_PATH__: JSON.stringify(parseVersionPath(normalizePath(buildVersionOption.versionPath)))
|
|
351
352
|
};
|
|
352
|
-
|
|
353
|
+
async function _buildEntry() {
|
|
353
354
|
await buildEntry(
|
|
354
355
|
buildEntryOption,
|
|
355
356
|
isESM,
|
|
@@ -357,38 +358,39 @@ async function electronWithUpdater(options) {
|
|
|
357
358
|
bytecodeOptions
|
|
358
359
|
);
|
|
359
360
|
log.info(`Build entry to '${entryOutputDirPath}'`, { timestamp: true });
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
361
|
+
}
|
|
362
|
+
async function _postBuild() {
|
|
363
|
+
return await postBuild?.({
|
|
364
|
+
getPathFromEntryOutputDir(...paths) {
|
|
365
|
+
return path3.join(entryOutputDirPath, ...paths);
|
|
366
|
+
},
|
|
367
|
+
copyToEntryOutputDir({ from, to, skipIfExist = true }) {
|
|
368
|
+
if (!fs2.existsSync(from)) {
|
|
369
|
+
log.warn(`${from} not found`, { timestamp: true });
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
const target = path3.join(entryOutputDirPath, to ?? path3.basename(from));
|
|
373
|
+
copyAndSkipIfExist(from, target, skipIfExist);
|
|
374
|
+
},
|
|
375
|
+
copyModules({ modules, skipIfExist = true }) {
|
|
376
|
+
const nodeModulesPath = path3.join(entryOutputDirPath, "node_modules");
|
|
377
|
+
for (const m of modules) {
|
|
378
|
+
const { rootPath } = getPackageInfoSync(m) || {};
|
|
379
|
+
if (!rootPath) {
|
|
380
|
+
log.warn(`Package '${m}' not found`, { timestamp: true });
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
copyAndSkipIfExist(rootPath, path3.join(nodeModulesPath, m), skipIfExist);
|
|
380
384
|
}
|
|
381
|
-
copyAndSkipIfExist(rootPath, path3.join(nodeModulesPath, m), skipIfExist);
|
|
382
385
|
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
+
});
|
|
387
|
+
}
|
|
386
388
|
let isInit = false;
|
|
387
389
|
const rollupOptions = {
|
|
388
390
|
external: (src) => src.startsWith("node:") || Object.keys("dependencies" in pkg ? pkg.dependencies : {}).includes(src) || src === "original-fs",
|
|
389
391
|
treeshake: true
|
|
390
392
|
};
|
|
391
|
-
const esmShimPlugin = isESM ?
|
|
393
|
+
const esmShimPlugin = isESM ? import('./esm-4S4XCVEW.js').then((m) => m.esm()) : void 0;
|
|
392
394
|
const electronPluginOptions = {
|
|
393
395
|
main: {
|
|
394
396
|
entry: _main.files,
|
|
@@ -408,7 +410,7 @@ async function electronWithUpdater(options) {
|
|
|
408
410
|
{
|
|
409
411
|
plugins: [
|
|
410
412
|
!isBuild && useNotBundle ? notBundle() : void 0,
|
|
411
|
-
bytecodeOptions &&
|
|
413
|
+
bytecodeOptions && import('./bytecode-7J2ZQDDO.js').then((m) => m.bytecodePlugin("main", bytecodeOptions)),
|
|
412
414
|
esmShimPlugin
|
|
413
415
|
],
|
|
414
416
|
build: {
|
|
@@ -428,7 +430,7 @@ async function electronWithUpdater(options) {
|
|
|
428
430
|
vite: mergeConfig(
|
|
429
431
|
{
|
|
430
432
|
plugins: [
|
|
431
|
-
bytecodeOptions &&
|
|
433
|
+
bytecodeOptions && import('./bytecode-7J2ZQDDO.js').then((m) => m.bytecodePlugin("preload", bytecodeOptions)),
|
|
432
434
|
esmShimPlugin,
|
|
433
435
|
{
|
|
434
436
|
name: `${id}-build`,
|
|
@@ -484,7 +486,7 @@ async function electronWithUpdater(options) {
|
|
|
484
486
|
apply() {
|
|
485
487
|
return !isBuild;
|
|
486
488
|
},
|
|
487
|
-
configureServer
|
|
489
|
+
configureServer(server) {
|
|
488
490
|
server.watcher.add(files).on(
|
|
489
491
|
"change",
|
|
490
492
|
(p) => files.includes(p) && _buildEntry().then(async () => {
|
|
@@ -498,6 +500,5 @@ async function electronWithUpdater(options) {
|
|
|
498
500
|
}
|
|
499
501
|
return [ElectronSimple(electronPluginOptions), extraHmrPlugin];
|
|
500
502
|
}
|
|
501
|
-
var vite_default = electronWithUpdater;
|
|
502
503
|
|
|
503
504
|
export { debugStartup, vite_default as default, electronWithUpdater, fixWinCharEncoding };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as UpdateJSON, D as DownloadingInfo } from './types-
|
|
1
|
+
import { a as UpdateJSON, D as DownloadingInfo } from './types-CU7GyVez.cjs';
|
|
2
2
|
import { Arrayable } from '@subframe7536/type-utils';
|
|
3
3
|
import { IncomingMessage } from 'electron';
|
|
4
4
|
|
|
@@ -31,6 +31,7 @@ declare function defaultVerifySignature(buffer: Buffer, version: string, signatu
|
|
|
31
31
|
declare function getHeader(headers: Record<string, Arrayable<string>>, key: any): any;
|
|
32
32
|
declare function downloadUtil<T>(url: string, headers: Record<string, any>, onResponse: (req: Electron.ClientRequest, resp: IncomingMessage, resolve: (data: T) => void, reject: (e: any) => void) => void): Promise<T>;
|
|
33
33
|
type ResolveDataFn = (data: string, resolve: (data: any) => void, reject: (e: any) => void) => void;
|
|
34
|
+
declare const resolveJson: ResolveDataFn;
|
|
34
35
|
/**
|
|
35
36
|
* Default function to download json and parse to UpdateJson
|
|
36
37
|
* @param url target url
|
|
@@ -38,7 +39,7 @@ type ResolveDataFn = (data: string, resolve: (data: any) => void, reject: (e: an
|
|
|
38
39
|
* @param signal abort signal
|
|
39
40
|
* @param resolveData on resolve
|
|
40
41
|
*/
|
|
41
|
-
declare function
|
|
42
|
+
declare function defaultDownloadText<T>(url: string, headers: Record<string, any>, signal: AbortSignal, resolveData: ResolveDataFn): Promise<T>;
|
|
42
43
|
/**
|
|
43
44
|
* Default function to download json and parse to UpdateJson
|
|
44
45
|
* @param url target url
|
|
@@ -67,4 +68,4 @@ declare function defaultZipFile(buffer: Buffer): Promise<Buffer>;
|
|
|
67
68
|
*/
|
|
68
69
|
declare function defaultUnzipFile(buffer: Buffer): Promise<Buffer>;
|
|
69
70
|
|
|
70
|
-
export { aesEncrypt as a, aesDecrypt as b, defaultVerifySignature as c, defaultSignature as d, downloadUtil as e,
|
|
71
|
+
export { aesEncrypt as a, aesDecrypt as b, defaultVerifySignature as c, defaultSignature as d, downloadUtil as e, defaultDownloadText as f, getHeader as g, hashBuffer as h, defaultDownloadUpdateJSON as i, defaultDownloadAsar as j, defaultZipFile as k, defaultUnzipFile as l, resolveJson as r };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as UpdateJSON, D as DownloadingInfo } from './types-
|
|
1
|
+
import { a as UpdateJSON, D as DownloadingInfo } from './types-CU7GyVez.js';
|
|
2
2
|
import { Arrayable } from '@subframe7536/type-utils';
|
|
3
3
|
import { IncomingMessage } from 'electron';
|
|
4
4
|
|
|
@@ -31,6 +31,7 @@ declare function defaultVerifySignature(buffer: Buffer, version: string, signatu
|
|
|
31
31
|
declare function getHeader(headers: Record<string, Arrayable<string>>, key: any): any;
|
|
32
32
|
declare function downloadUtil<T>(url: string, headers: Record<string, any>, onResponse: (req: Electron.ClientRequest, resp: IncomingMessage, resolve: (data: T) => void, reject: (e: any) => void) => void): Promise<T>;
|
|
33
33
|
type ResolveDataFn = (data: string, resolve: (data: any) => void, reject: (e: any) => void) => void;
|
|
34
|
+
declare const resolveJson: ResolveDataFn;
|
|
34
35
|
/**
|
|
35
36
|
* Default function to download json and parse to UpdateJson
|
|
36
37
|
* @param url target url
|
|
@@ -38,7 +39,7 @@ type ResolveDataFn = (data: string, resolve: (data: any) => void, reject: (e: an
|
|
|
38
39
|
* @param signal abort signal
|
|
39
40
|
* @param resolveData on resolve
|
|
40
41
|
*/
|
|
41
|
-
declare function
|
|
42
|
+
declare function defaultDownloadText<T>(url: string, headers: Record<string, any>, signal: AbortSignal, resolveData: ResolveDataFn): Promise<T>;
|
|
42
43
|
/**
|
|
43
44
|
* Default function to download json and parse to UpdateJson
|
|
44
45
|
* @param url target url
|
|
@@ -67,4 +68,4 @@ declare function defaultZipFile(buffer: Buffer): Promise<Buffer>;
|
|
|
67
68
|
*/
|
|
68
69
|
declare function defaultUnzipFile(buffer: Buffer): Promise<Buffer>;
|
|
69
70
|
|
|
70
|
-
export { aesEncrypt as a, aesDecrypt as b, defaultVerifySignature as c, defaultSignature as d, downloadUtil as e,
|
|
71
|
+
export { aesEncrypt as a, aesDecrypt as b, defaultVerifySignature as c, defaultSignature as d, downloadUtil as e, defaultDownloadText as f, getHeader as g, hashBuffer as h, defaultDownloadUpdateJSON as i, defaultDownloadAsar as j, defaultZipFile as k, defaultUnzipFile as l, resolveJson as r };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electron-incremental-update",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.3.0",
|
|
5
5
|
"description": "Electron incremental update tools with Vite plugin, support bytecode protection",
|
|
6
6
|
"author": "subframe7536",
|
|
7
7
|
"license": "MIT",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"@subframe7536/eslint-config": "^1.2.4",
|
|
74
74
|
"@types/babel__core": "^7.20.5",
|
|
75
75
|
"@types/node": "^22.15.17",
|
|
76
|
+
"@vitest/eslint-plugin": "^1.1.44",
|
|
76
77
|
"bumpp": "^10.1.0",
|
|
77
78
|
"electron": "36.2.0",
|
|
78
79
|
"esbuild": "^0.25.4",
|