electron-incremental-update 2.3.6 → 2.3.8
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 +79 -7
- package/dist/{chunk-QKKPETVJ.js → chunk-IVHNGRZY.js} +20 -9
- package/dist/{chunk-QPAKJHVM.js → chunk-PD4EV4MM.js} +2 -2
- package/dist/index.js +4 -4
- package/dist/provider.js +3 -5
- package/dist/utils.cjs +17 -5
- package/dist/utils.d.cts +9 -3
- package/dist/utils.d.ts +9 -3
- package/dist/utils.js +2 -2
- package/dist/vite.d.ts +9 -3
- package/dist/vite.js +11 -11
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -278,7 +278,7 @@ const plugin = electronWithUpdater({
|
|
|
278
278
|
db: './electron/native/db.ts',
|
|
279
279
|
img: './electron/native/img.ts',
|
|
280
280
|
},
|
|
281
|
-
postBuild:
|
|
281
|
+
postBuild: ({ copyToEntryOutputDir, copyModules }) => {
|
|
282
282
|
// for better-sqlite3
|
|
283
283
|
copyToEntryOutputDir({
|
|
284
284
|
from: './node_modules/better-sqlite3/build/Release/better_sqlite3.node',
|
|
@@ -286,7 +286,7 @@ const plugin = electronWithUpdater({
|
|
|
286
286
|
})
|
|
287
287
|
// for @napi-rs/image
|
|
288
288
|
const startStr = '@napi-rs+image-'
|
|
289
|
-
const fileName = (
|
|
289
|
+
const fileName = readdirSync('./node_modules/.pnpm').find(p => p.startsWith(startStr))!
|
|
290
290
|
const archName = fileName.substring(startStr.length).split('@')[0]
|
|
291
291
|
copyToEntryOutputDir({
|
|
292
292
|
from: `./node_modules/.pnpm/${fileName}/node_modules/@napi-rs/image-${archName}/image.${archName}.node`,
|
|
@@ -350,6 +350,74 @@ module.exports = {
|
|
|
350
350
|
}
|
|
351
351
|
```
|
|
352
352
|
|
|
353
|
+
#### Result in app.asar
|
|
354
|
+
|
|
355
|
+
Before: Redundant 🤮
|
|
356
|
+
|
|
357
|
+
```
|
|
358
|
+
.
|
|
359
|
+
├── dist-entry
|
|
360
|
+
│ ├── chunk-IVHNGRZY-BPUeB0jT.js
|
|
361
|
+
│ ├── db.js
|
|
362
|
+
│ ├── entry.js
|
|
363
|
+
│ └── image.js
|
|
364
|
+
├── node_modules
|
|
365
|
+
│ ├── @napi-rs
|
|
366
|
+
│ ├── base64-js
|
|
367
|
+
│ ├── better-sqlite3
|
|
368
|
+
│ ├── bindings
|
|
369
|
+
│ ├── bl
|
|
370
|
+
│ ├── buffer
|
|
371
|
+
│ ├── chownr
|
|
372
|
+
│ ├── decompress-response
|
|
373
|
+
│ ├── deep-extend
|
|
374
|
+
│ ├── detect-libc
|
|
375
|
+
│ ├── end-of-stream
|
|
376
|
+
│ ├── expand-template
|
|
377
|
+
│ ├── file-uri-to-path
|
|
378
|
+
│ ├── fs-constants
|
|
379
|
+
│ ├── github-from-package
|
|
380
|
+
│ ├── ieee754
|
|
381
|
+
│ ├── inherits
|
|
382
|
+
│ ├── ini
|
|
383
|
+
│ ├── mimic-response
|
|
384
|
+
│ ├── minimist
|
|
385
|
+
│ ├── mkdirp-classic
|
|
386
|
+
│ ├── napi-build-utils
|
|
387
|
+
│ ├── node-abi
|
|
388
|
+
│ ├── once
|
|
389
|
+
│ ├── prebuild-install
|
|
390
|
+
│ ├── pump
|
|
391
|
+
│ ├── rc
|
|
392
|
+
│ ├── readable-stream
|
|
393
|
+
│ ├── safe-buffer
|
|
394
|
+
│ ├── semver
|
|
395
|
+
│ ├── simple-concat
|
|
396
|
+
│ ├── simple-get
|
|
397
|
+
│ ├── string_decoder
|
|
398
|
+
│ ├── strip-json-comments
|
|
399
|
+
│ ├── tar-fs
|
|
400
|
+
│ ├── tar-stream
|
|
401
|
+
│ ├── tunnel-agent
|
|
402
|
+
│ ├── util-deprecate
|
|
403
|
+
│ └── wrappy
|
|
404
|
+
└── package.json
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
After: Clean 😍
|
|
408
|
+
|
|
409
|
+
```
|
|
410
|
+
.
|
|
411
|
+
├── dist-entry
|
|
412
|
+
│ ├── better_sqlite3.node
|
|
413
|
+
│ ├── chunk-IVHNGRZY-BPUeB0jT.js
|
|
414
|
+
│ ├── db.js
|
|
415
|
+
│ ├── entry.js
|
|
416
|
+
│ ├── image.js
|
|
417
|
+
│ └── image.win32-x64-msvc.node
|
|
418
|
+
└── package.json
|
|
419
|
+
```
|
|
420
|
+
|
|
353
421
|
### Bytecode Protection
|
|
354
422
|
|
|
355
423
|
Use V8 cache to protect the source code
|
|
@@ -433,12 +501,13 @@ function disableHWAccForWin7(): void
|
|
|
433
501
|
*/
|
|
434
502
|
function singleInstance(window?: BrowserWindow): void
|
|
435
503
|
/**
|
|
436
|
-
* Set `
|
|
504
|
+
* Set `userData` dir to the dir of .exe file
|
|
437
505
|
*
|
|
438
506
|
* Useful for portable Windows app
|
|
439
507
|
* @param dirName dir name, default to `data`
|
|
508
|
+
* @param create whether to create dir, default to `true`
|
|
440
509
|
*/
|
|
441
|
-
function
|
|
510
|
+
function setPortableDataPath(dirName?: string, create?: boolean): void
|
|
442
511
|
/**
|
|
443
512
|
* Load `process.env.VITE_DEV_SERVER_URL` when dev, else load html file
|
|
444
513
|
* @param win window
|
|
@@ -922,7 +991,9 @@ export interface BuildEntryOption {
|
|
|
922
991
|
/**
|
|
923
992
|
* `external` option in `build.rollupOptions`,
|
|
924
993
|
* default is node built-in modules or native modules.
|
|
925
|
-
*
|
|
994
|
+
*
|
|
995
|
+
* If is in dev and {@link postBuild} is not setup, will also
|
|
996
|
+
* external `dependencies` in `package.json`
|
|
926
997
|
*/
|
|
927
998
|
external?: NonNullable<NonNullable<InlineConfig['build']>['rollupOptions']>['external']
|
|
928
999
|
/**
|
|
@@ -943,8 +1014,9 @@ export interface BuildEntryOption {
|
|
|
943
1014
|
*/
|
|
944
1015
|
overrideViteOptions?: InlineConfig
|
|
945
1016
|
/**
|
|
946
|
-
*
|
|
947
|
-
*
|
|
1017
|
+
* By default, all the unbundled modules will be packaged by packager like `electron-builder`.
|
|
1018
|
+
* If setup, all the `dependencies` in `package.json` will be bundled by default, and you need
|
|
1019
|
+
* to manually handle the native module files.
|
|
948
1020
|
*/
|
|
949
1021
|
postBuild?: (args: {
|
|
950
1022
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __require } from './chunk-AAAM44NW.js';
|
|
2
|
-
import fs from '
|
|
3
|
-
import path from '
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
4
|
import electron from 'electron';
|
|
5
5
|
|
|
6
6
|
var isDev = __EIU_IS_DEV__;
|
|
@@ -40,7 +40,7 @@ function setAppUserModelId(id) {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
function disableHWAccForWin7() {
|
|
43
|
-
if (!__EIU_IS_ESM__ && __require("
|
|
43
|
+
if (!__EIU_IS_ESM__ && __require("os").release().startsWith("6.1")) {
|
|
44
44
|
electron.app.disableHardwareAcceleration();
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -55,13 +55,24 @@ function singleInstance(window) {
|
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
fs.mkdirSync(portablePath);
|
|
58
|
+
function setPortableDataPath(dirName = "data", create = true) {
|
|
59
|
+
if (electron.app.isReady()) {
|
|
60
|
+
throw new Error("Portable app data dir must be setup before app is ready");
|
|
62
61
|
}
|
|
63
|
-
electron.app.
|
|
62
|
+
const portableDir = path.join(path.dirname(electron.app.getPath("exe")), dirName);
|
|
63
|
+
if (create) {
|
|
64
|
+
if (!fs.existsSync(portableDir)) {
|
|
65
|
+
fs.mkdirSync(portableDir);
|
|
66
|
+
} else if (!fs.statSync(portableDir).isDirectory()) {
|
|
67
|
+
fs.rmSync(portableDir);
|
|
68
|
+
fs.mkdirSync(portableDir);
|
|
69
|
+
}
|
|
70
|
+
} else if (!fs.existsSync(portableDir)) {
|
|
71
|
+
throw new Error("Portable app data dir does not exists");
|
|
72
|
+
}
|
|
73
|
+
electron.app.setPath("userData", portableDir);
|
|
64
74
|
}
|
|
75
|
+
var setPortableAppDataPath = setPortableDataPath;
|
|
65
76
|
function loadPage(win, htmlFilePath = "index.html") {
|
|
66
77
|
if (isDev) {
|
|
67
78
|
win.loadURL(process.env.VITE_DEV_SERVER_URL + htmlFilePath);
|
|
@@ -108,4 +119,4 @@ function reloadOnPreloadScriptChanged() {
|
|
|
108
119
|
}
|
|
109
120
|
}
|
|
110
121
|
|
|
111
|
-
export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, singleInstance };
|
|
122
|
+
export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, setPortableDataPath, singleInstance };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isUpdateJSON } from './chunk-AAAM44NW.js';
|
|
2
|
-
import crypto from '
|
|
2
|
+
import crypto from 'crypto';
|
|
3
3
|
import electron from 'electron';
|
|
4
|
-
import zlib from '
|
|
4
|
+
import zlib from 'zlib';
|
|
5
5
|
|
|
6
6
|
function hashBuffer(data, length) {
|
|
7
7
|
const hash = crypto.createHash("SHA256").update(data).digest("binary");
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { isDev, getEntryVersion, getAppVersion, getPathFromAppNameAsar, restartApp } from './chunk-
|
|
1
|
+
import { isDev, getEntryVersion, getAppVersion, getPathFromAppNameAsar, restartApp } from './chunk-IVHNGRZY.js';
|
|
2
2
|
import { isUpdateJSON, __require } from './chunk-AAAM44NW.js';
|
|
3
|
-
import fs from '
|
|
4
|
-
import path from '
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
5
|
import electron2 from 'electron';
|
|
6
|
-
import { EventEmitter } from '
|
|
6
|
+
import { EventEmitter } from 'events';
|
|
7
7
|
|
|
8
8
|
// src/entry/types.ts
|
|
9
9
|
var UpdaterError = class extends Error {
|
package/dist/provider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defaultVerifySignature, defaultUnzipFile, defaultDownloadUpdateJSON, defaultDownloadAsar, defaultDownloadText, resolveJson } from './chunk-
|
|
2
|
-
export { defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, downloadUtil, getHeader, resolveJson } from './chunk-
|
|
1
|
+
import { defaultVerifySignature, defaultUnzipFile, defaultDownloadUpdateJSON, defaultDownloadAsar, defaultDownloadText, resolveJson } from './chunk-PD4EV4MM.js';
|
|
2
|
+
export { defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, downloadUtil, getHeader, resolveJson } from './chunk-PD4EV4MM.js';
|
|
3
3
|
import { defaultIsLowerVersion } from './chunk-AAAM44NW.js';
|
|
4
|
-
import { URL } from '
|
|
4
|
+
import { URL } from 'url';
|
|
5
5
|
|
|
6
6
|
// src/provider/base.ts
|
|
7
7
|
var BaseProvider = class {
|
|
@@ -149,8 +149,6 @@ var GitHubAtomProvider = class extends BaseGitHubProvider {
|
|
|
149
149
|
return `releases/download/v${tag}/${versionPath}`;
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
|
-
|
|
153
|
-
// src/provider/github/file.ts
|
|
154
152
|
var GitHubProvider = class extends BaseGitHubProvider {
|
|
155
153
|
name = "GithubProvider";
|
|
156
154
|
/**
|
package/dist/utils.cjs
CHANGED
|
@@ -266,13 +266,24 @@ function singleInstance(window) {
|
|
|
266
266
|
}
|
|
267
267
|
});
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
fs__default.default.mkdirSync(portablePath);
|
|
269
|
+
function setPortableDataPath(dirName = "data", create = true) {
|
|
270
|
+
if (electron2__default.default.app.isReady()) {
|
|
271
|
+
throw new Error("Portable app data dir must be setup before app is ready");
|
|
273
272
|
}
|
|
274
|
-
electron2__default.default.app.
|
|
273
|
+
const portableDir = path__default.default.join(path__default.default.dirname(electron2__default.default.app.getPath("exe")), dirName);
|
|
274
|
+
if (create) {
|
|
275
|
+
if (!fs__default.default.existsSync(portableDir)) {
|
|
276
|
+
fs__default.default.mkdirSync(portableDir);
|
|
277
|
+
} else if (!fs__default.default.statSync(portableDir).isDirectory()) {
|
|
278
|
+
fs__default.default.rmSync(portableDir);
|
|
279
|
+
fs__default.default.mkdirSync(portableDir);
|
|
280
|
+
}
|
|
281
|
+
} else if (!fs__default.default.existsSync(portableDir)) {
|
|
282
|
+
throw new Error("Portable app data dir does not exists");
|
|
283
|
+
}
|
|
284
|
+
electron2__default.default.app.setPath("userData", portableDir);
|
|
275
285
|
}
|
|
286
|
+
var setPortableAppDataPath = setPortableDataPath;
|
|
276
287
|
function loadPage(win, htmlFilePath = "index.html") {
|
|
277
288
|
if (isDev) {
|
|
278
289
|
win.loadURL(process.env.VITE_DEV_SERVER_URL + htmlFilePath);
|
|
@@ -367,4 +378,5 @@ exports.resolveJson = resolveJson;
|
|
|
367
378
|
exports.restartApp = restartApp;
|
|
368
379
|
exports.setAppUserModelId = setAppUserModelId;
|
|
369
380
|
exports.setPortableAppDataPath = setPortableAppDataPath;
|
|
381
|
+
exports.setPortableDataPath = setPortableDataPath;
|
|
370
382
|
exports.singleInstance = singleInstance;
|
package/dist/utils.d.cts
CHANGED
|
@@ -60,12 +60,18 @@ declare function disableHWAccForWin7(): void;
|
|
|
60
60
|
*/
|
|
61
61
|
declare function singleInstance(window?: BrowserWindow): void;
|
|
62
62
|
/**
|
|
63
|
-
* Set `
|
|
63
|
+
* Set `userData` dir to the dir of .exe file
|
|
64
64
|
*
|
|
65
65
|
* Useful for portable Windows app
|
|
66
66
|
* @param dirName dir name, default to `data`
|
|
67
|
+
* @param create whether to create dir, default to `true`
|
|
67
68
|
*/
|
|
68
|
-
declare function
|
|
69
|
+
declare function setPortableDataPath(dirName?: string, create?: boolean): void;
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated
|
|
72
|
+
* @alias {@link setPortableDataPath}
|
|
73
|
+
*/
|
|
74
|
+
declare const setPortableAppDataPath: typeof setPortableDataPath;
|
|
69
75
|
/**
|
|
70
76
|
* Load `process.env.VITE_DEV_SERVER_URL` when dev, else load html file
|
|
71
77
|
* @param win window
|
|
@@ -120,4 +126,4 @@ declare function getPathFromEntryAsar(...paths: string[]): string;
|
|
|
120
126
|
declare function handleUnexpectedErrors(callback: (err: unknown) => void): void;
|
|
121
127
|
declare function reloadOnPreloadScriptChanged(): void;
|
|
122
128
|
|
|
123
|
-
export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, singleInstance };
|
|
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.d.ts
CHANGED
|
@@ -60,12 +60,18 @@ declare function disableHWAccForWin7(): void;
|
|
|
60
60
|
*/
|
|
61
61
|
declare function singleInstance(window?: BrowserWindow): void;
|
|
62
62
|
/**
|
|
63
|
-
* Set `
|
|
63
|
+
* Set `userData` dir to the dir of .exe file
|
|
64
64
|
*
|
|
65
65
|
* Useful for portable Windows app
|
|
66
66
|
* @param dirName dir name, default to `data`
|
|
67
|
+
* @param create whether to create dir, default to `true`
|
|
67
68
|
*/
|
|
68
|
-
declare function
|
|
69
|
+
declare function setPortableDataPath(dirName?: string, create?: boolean): void;
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated
|
|
72
|
+
* @alias {@link setPortableDataPath}
|
|
73
|
+
*/
|
|
74
|
+
declare const setPortableAppDataPath: typeof setPortableDataPath;
|
|
69
75
|
/**
|
|
70
76
|
* Load `process.env.VITE_DEV_SERVER_URL` when dev, else load html file
|
|
71
77
|
* @param win window
|
|
@@ -120,4 +126,4 @@ declare function getPathFromEntryAsar(...paths: string[]): string;
|
|
|
120
126
|
declare function handleUnexpectedErrors(callback: (err: unknown) => void): void;
|
|
121
127
|
declare function reloadOnPreloadScriptChanged(): void;
|
|
122
128
|
|
|
123
|
-
export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, singleInstance };
|
|
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
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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-
|
|
2
|
-
export { aesDecrypt, aesEncrypt, defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, defaultSignature, defaultUnzipFile, defaultVerifySignature, defaultZipFile, downloadUtil, getHeader, hashBuffer, resolveJson } from './chunk-
|
|
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
3
|
export { defaultIsLowerVersion, defaultVersionJsonGenerator, isUpdateJSON, parseVersion } from './chunk-AAAM44NW.js';
|
package/dist/vite.d.ts
CHANGED
|
@@ -106,7 +106,9 @@ interface BuildEntryOption {
|
|
|
106
106
|
/**
|
|
107
107
|
* `external` option in `build.rollupOptions`,
|
|
108
108
|
* default is node built-in modules or native modules.
|
|
109
|
-
*
|
|
109
|
+
*
|
|
110
|
+
* If is in dev and {@link postBuild} is not setup, will also
|
|
111
|
+
* external `dependencies` in `package.json`
|
|
110
112
|
*/
|
|
111
113
|
external?: NonNullable<NonNullable<InlineConfig['build']>['rollupOptions']>['external'];
|
|
112
114
|
/**
|
|
@@ -127,8 +129,12 @@ interface BuildEntryOption {
|
|
|
127
129
|
*/
|
|
128
130
|
overrideViteOptions?: InlineConfig;
|
|
129
131
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
+
* By default, all the unbundled modules will be packaged by packager like `electron-builder`.
|
|
133
|
+
* If setup, all the `dependencies` in `package.json` will be bundled by default, and you need
|
|
134
|
+
* to manually handle the native module files.
|
|
135
|
+
*
|
|
136
|
+
* If you are using `electron-buidler`, don't forget to append `'!node_modules/**'` in
|
|
137
|
+
* electron-build config's `files` array
|
|
132
138
|
*/
|
|
133
139
|
postBuild?: (args: {
|
|
134
140
|
/**
|
package/dist/vite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import fs5 from '
|
|
2
|
-
import path5 from '
|
|
1
|
+
import fs5 from 'fs';
|
|
2
|
+
import path5 from 'path';
|
|
3
3
|
import { isCI } from 'ci-info';
|
|
4
4
|
export { isCI } from 'ci-info';
|
|
5
5
|
import { getPackageInfoSync, loadPackageJSON } from 'local-pkg';
|
|
@@ -10,11 +10,11 @@ import { notBundle } from 'vite-plugin-electron/plugin';
|
|
|
10
10
|
import ElectronSimple from 'vite-plugin-electron/simple';
|
|
11
11
|
import Asar from '@electron/asar';
|
|
12
12
|
import MagicString from 'magic-string';
|
|
13
|
-
import cp from '
|
|
13
|
+
import cp from 'child_process';
|
|
14
14
|
import * as babel from '@babel/core';
|
|
15
|
-
import { builtinModules } from '
|
|
16
|
-
import crypto from '
|
|
17
|
-
import zlib from '
|
|
15
|
+
import { builtinModules } from 'module';
|
|
16
|
+
import crypto from 'crypto';
|
|
17
|
+
import zlib from 'zlib';
|
|
18
18
|
import { generate } from 'selfsigned';
|
|
19
19
|
|
|
20
20
|
// src/vite/index.ts
|
|
@@ -607,7 +607,7 @@ function parseOptions(isBuild, pkg, sourcemap = false, minify = false, options =
|
|
|
607
607
|
/.*\.(node|dll|dylib|so)$/,
|
|
608
608
|
"original-fs",
|
|
609
609
|
...builtinModules,
|
|
610
|
-
...isBuild ? [] : Object.keys("dependencies" in pkg ? pkg.dependencies : {})
|
|
610
|
+
...isBuild || postBuild ? [] : Object.keys("dependencies" in pkg ? pkg.dependencies : {})
|
|
611
611
|
],
|
|
612
612
|
overrideViteOptions = {}
|
|
613
613
|
} = {},
|
|
@@ -696,7 +696,7 @@ async function filterErrorMessageStartup(args, filter) {
|
|
|
696
696
|
function fixWinCharEncoding(fn) {
|
|
697
697
|
return async (...args) => {
|
|
698
698
|
if (process.platform === "win32") {
|
|
699
|
-
(await import('
|
|
699
|
+
(await import('child_process')).spawnSync("chcp", ["65001"]);
|
|
700
700
|
}
|
|
701
701
|
await fn(...args);
|
|
702
702
|
};
|
|
@@ -792,12 +792,12 @@ async function electronWithUpdater(options) {
|
|
|
792
792
|
getPathFromEntryOutputDir(...paths) {
|
|
793
793
|
return path5.join(entryOutputDirPath, ...paths);
|
|
794
794
|
},
|
|
795
|
-
copyToEntryOutputDir({ from, to, skipIfExist = true }) {
|
|
795
|
+
copyToEntryOutputDir({ from, to = path5.basename(from), skipIfExist = true }) {
|
|
796
796
|
if (!fs5.existsSync(from)) {
|
|
797
797
|
log.warn(`${from} not found`, { timestamp: true });
|
|
798
798
|
return;
|
|
799
799
|
}
|
|
800
|
-
const target = path5.join(entryOutputDirPath, to
|
|
800
|
+
const target = path5.join(entryOutputDirPath, to);
|
|
801
801
|
copyAndSkipIfExist(from, target, skipIfExist);
|
|
802
802
|
},
|
|
803
803
|
copyModules({ modules, skipIfExist = true }) {
|
|
@@ -895,7 +895,7 @@ async function electronWithUpdater(options) {
|
|
|
895
895
|
...electronPluginOptions,
|
|
896
896
|
updater: { buildAsarOption, buildEntryOption, buildVersionOption }
|
|
897
897
|
},
|
|
898
|
-
(key, value) =>
|
|
898
|
+
(key, value) => key === "privateKey" || key === "cert" ? shouldShowKey ? value : `<${key.toUpperCase()}>` : value,
|
|
899
899
|
2
|
|
900
900
|
),
|
|
901
901
|
{ timestamp: true }
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electron-incremental-update",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.8",
|
|
5
5
|
"description": "Electron incremental update tools with Vite plugin, support bytecode protection",
|
|
6
6
|
"author": "subframe7536",
|
|
7
7
|
"license": "MIT",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@electron/asar": "*"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@babel/core": "^7.27.
|
|
62
|
+
"@babel/core": "^7.27.4",
|
|
63
63
|
"@babel/plugin-transform-arrow-functions": "^7.27.1",
|
|
64
64
|
"@babel/plugin-transform-template-literals": "^7.27.1",
|
|
65
65
|
"@subframe7536/type-utils": "^0.2.0",
|
|
@@ -70,19 +70,19 @@
|
|
|
70
70
|
"vite-plugin-electron": "^0.29.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@subframe7536/eslint-config": "^1.
|
|
73
|
+
"@subframe7536/eslint-config": "^1.3.1",
|
|
74
74
|
"@types/babel__core": "^7.20.5",
|
|
75
|
-
"@types/node": "^22.15.
|
|
76
|
-
"@vitest/eslint-plugin": "^1.1
|
|
77
|
-
"bumpp": "^10.1.
|
|
75
|
+
"@types/node": "^22.15.30",
|
|
76
|
+
"@vitest/eslint-plugin": "^1.2.1",
|
|
77
|
+
"bumpp": "^10.1.1",
|
|
78
78
|
"electron": "36.2.0",
|
|
79
79
|
"esbuild": "^0.25.4",
|
|
80
|
-
"eslint": "^9.
|
|
81
|
-
"tsup": "^8.
|
|
80
|
+
"eslint": "^9.28.0",
|
|
81
|
+
"tsup": "^8.5.0",
|
|
82
82
|
"typescript": "^5.8.3",
|
|
83
83
|
"vite": "^6.3.5",
|
|
84
84
|
"vite-plugin-electron": "^0.29.0",
|
|
85
|
-
"vitest": "^3.
|
|
85
|
+
"vitest": "^3.2.2"
|
|
86
86
|
},
|
|
87
87
|
"pnpm": {
|
|
88
88
|
"overrides": {
|