electron-incremental-update 2.2.6 → 2.3.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/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 +37 -33
- 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['main']>['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,
|
|
@@ -222,7 +222,7 @@ function parseOptions(pkg, sourcemap = false, minify = false, options = {}) {
|
|
|
222
222
|
overrideViteOptions,
|
|
223
223
|
ignoreDynamicRequires,
|
|
224
224
|
external: (source, importer, isResolved) => {
|
|
225
|
-
if (source.endsWith(".node")) {
|
|
225
|
+
if (source.endsWith(".node") || source.startsWith("node:")) {
|
|
226
226
|
return false;
|
|
227
227
|
}
|
|
228
228
|
if (!external) {
|
|
@@ -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");
|
|
@@ -293,6 +294,9 @@ function parseVersionPath(versionPath) {
|
|
|
293
294
|
}
|
|
294
295
|
return new URL(versionPath, "file://").pathname.slice(1);
|
|
295
296
|
}
|
|
297
|
+
var ex = startup.exit;
|
|
298
|
+
startup.exit = () => ex().catch(() => {
|
|
299
|
+
});
|
|
296
300
|
async function electronWithUpdater(options) {
|
|
297
301
|
let {
|
|
298
302
|
isBuild,
|
|
@@ -349,7 +353,7 @@ async function electronWithUpdater(options) {
|
|
|
349
353
|
__EIU_SIGNATURE_CERT__: JSON.stringify(cert),
|
|
350
354
|
__EIU_VERSION_PATH__: JSON.stringify(parseVersionPath(normalizePath(buildVersionOption.versionPath)))
|
|
351
355
|
};
|
|
352
|
-
|
|
356
|
+
async function _buildEntry() {
|
|
353
357
|
await buildEntry(
|
|
354
358
|
buildEntryOption,
|
|
355
359
|
isESM,
|
|
@@ -357,38 +361,39 @@ async function electronWithUpdater(options) {
|
|
|
357
361
|
bytecodeOptions
|
|
358
362
|
);
|
|
359
363
|
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
|
-
|
|
364
|
+
}
|
|
365
|
+
async function _postBuild() {
|
|
366
|
+
return await postBuild?.({
|
|
367
|
+
getPathFromEntryOutputDir(...paths) {
|
|
368
|
+
return path3.join(entryOutputDirPath, ...paths);
|
|
369
|
+
},
|
|
370
|
+
copyToEntryOutputDir({ from, to, skipIfExist = true }) {
|
|
371
|
+
if (!fs2.existsSync(from)) {
|
|
372
|
+
log.warn(`${from} not found`, { timestamp: true });
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
const target = path3.join(entryOutputDirPath, to ?? path3.basename(from));
|
|
376
|
+
copyAndSkipIfExist(from, target, skipIfExist);
|
|
377
|
+
},
|
|
378
|
+
copyModules({ modules, skipIfExist = true }) {
|
|
379
|
+
const nodeModulesPath = path3.join(entryOutputDirPath, "node_modules");
|
|
380
|
+
for (const m of modules) {
|
|
381
|
+
const { rootPath } = getPackageInfoSync(m) || {};
|
|
382
|
+
if (!rootPath) {
|
|
383
|
+
log.warn(`Package '${m}' not found`, { timestamp: true });
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
copyAndSkipIfExist(rootPath, path3.join(nodeModulesPath, m), skipIfExist);
|
|
380
387
|
}
|
|
381
|
-
copyAndSkipIfExist(rootPath, path3.join(nodeModulesPath, m), skipIfExist);
|
|
382
388
|
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
};
|
|
389
|
+
});
|
|
390
|
+
}
|
|
386
391
|
let isInit = false;
|
|
387
392
|
const rollupOptions = {
|
|
388
393
|
external: (src) => src.startsWith("node:") || Object.keys("dependencies" in pkg ? pkg.dependencies : {}).includes(src) || src === "original-fs",
|
|
389
394
|
treeshake: true
|
|
390
395
|
};
|
|
391
|
-
const esmShimPlugin = isESM ?
|
|
396
|
+
const esmShimPlugin = isESM ? import('./esm-4S4XCVEW.js').then((m) => m.esm()) : void 0;
|
|
392
397
|
const electronPluginOptions = {
|
|
393
398
|
main: {
|
|
394
399
|
entry: _main.files,
|
|
@@ -408,7 +413,7 @@ async function electronWithUpdater(options) {
|
|
|
408
413
|
{
|
|
409
414
|
plugins: [
|
|
410
415
|
!isBuild && useNotBundle ? notBundle() : void 0,
|
|
411
|
-
bytecodeOptions &&
|
|
416
|
+
bytecodeOptions && import('./bytecode-7J2ZQDDO.js').then((m) => m.bytecodePlugin("main", bytecodeOptions)),
|
|
412
417
|
esmShimPlugin
|
|
413
418
|
],
|
|
414
419
|
build: {
|
|
@@ -428,7 +433,7 @@ async function electronWithUpdater(options) {
|
|
|
428
433
|
vite: mergeConfig(
|
|
429
434
|
{
|
|
430
435
|
plugins: [
|
|
431
|
-
bytecodeOptions &&
|
|
436
|
+
bytecodeOptions && import('./bytecode-7J2ZQDDO.js').then((m) => m.bytecodePlugin("preload", bytecodeOptions)),
|
|
432
437
|
esmShimPlugin,
|
|
433
438
|
{
|
|
434
439
|
name: `${id}-build`,
|
|
@@ -484,7 +489,7 @@ async function electronWithUpdater(options) {
|
|
|
484
489
|
apply() {
|
|
485
490
|
return !isBuild;
|
|
486
491
|
},
|
|
487
|
-
configureServer
|
|
492
|
+
configureServer(server) {
|
|
488
493
|
server.watcher.add(files).on(
|
|
489
494
|
"change",
|
|
490
495
|
(p) => files.includes(p) && _buildEntry().then(async () => {
|
|
@@ -498,6 +503,5 @@ async function electronWithUpdater(options) {
|
|
|
498
503
|
}
|
|
499
504
|
return [ElectronSimple(electronPluginOptions), extraHmrPlugin];
|
|
500
505
|
}
|
|
501
|
-
var vite_default = electronWithUpdater;
|
|
502
506
|
|
|
503
507
|
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.1",
|
|
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",
|