electron-incremental-update 2.0.0 → 2.0.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/README.md +20 -1
- package/dist/{chunk-IABBXJFB.js → chunk-GTDMND3I.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/vite.d.ts +4 -0
- package/dist/vite.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -340,7 +340,8 @@ electronWithUpdater({
|
|
|
340
340
|
|
|
341
341
|
https://electron-vite.org/guide/source-code-protection
|
|
342
342
|
|
|
343
|
-
- Improve the string protection (see [original issue](https://github.com/alex8088/electron-vite/issues/552))
|
|
343
|
+
- Improve the string protection (see [original issue](https://github.com/alex8088/electron-vite/issues/552))
|
|
344
|
+
- Protect all strings by default
|
|
344
345
|
- Minification is allowed
|
|
345
346
|
|
|
346
347
|
#### Limitation
|
|
@@ -669,6 +670,24 @@ export interface ElectronUpdaterOptions {
|
|
|
669
670
|
overrideGenerator?: GeneratorOverrideFunctions
|
|
670
671
|
}
|
|
671
672
|
|
|
673
|
+
export interface BytecodeOptions {
|
|
674
|
+
enable: boolean
|
|
675
|
+
/**
|
|
676
|
+
* Enable in preload script. Remember to set `sandbox: false` when creating window
|
|
677
|
+
*/
|
|
678
|
+
preload?: boolean
|
|
679
|
+
/**
|
|
680
|
+
* Custom electron binary path
|
|
681
|
+
*/
|
|
682
|
+
electronPath?: string
|
|
683
|
+
/**
|
|
684
|
+
* Before transformed code compile function. If return `Falsy` value, it will be ignored
|
|
685
|
+
* @param code transformed code
|
|
686
|
+
* @param id file path
|
|
687
|
+
*/
|
|
688
|
+
beforeCompile?: (code: string, id: string) => Promisable<string | null | undefined | void>
|
|
689
|
+
}
|
|
690
|
+
|
|
672
691
|
export interface BuildEntryOption {
|
|
673
692
|
/**
|
|
674
693
|
* Override to minify on entry
|
|
@@ -20,7 +20,7 @@ function requireNative(moduleName) {
|
|
|
20
20
|
if (__EIU_IS_ESM__) {
|
|
21
21
|
throw new Error(`Cannot require "${path.join(__EIU_ENTRY_DIST_PATH__, moduleName)}", \`requireNative\` only support CommonJS`);
|
|
22
22
|
}
|
|
23
|
-
return __require(
|
|
23
|
+
return __require(getPathFromEntryAsar(moduleName));
|
|
24
24
|
}
|
|
25
25
|
function restartApp() {
|
|
26
26
|
electron.app.relaunch();
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isDev, getEntryVersion, getAppVersion, getPathFromAppNameAsar, restartApp } from './chunk-
|
|
1
|
+
import { isDev, getEntryVersion, getAppVersion, getPathFromAppNameAsar, restartApp } from './chunk-GTDMND3I.js';
|
|
2
2
|
import { isUpdateJSON, __require } from './chunk-RCRKUKFX.js';
|
|
3
3
|
import fs2 from 'node:fs';
|
|
4
4
|
import { EventEmitter } from 'node:events';
|
package/dist/utils.cjs
CHANGED
|
@@ -37,7 +37,7 @@ function requireNative(moduleName) {
|
|
|
37
37
|
if (__EIU_IS_ESM__) {
|
|
38
38
|
throw new Error(`Cannot require "${path__default.default.join(__EIU_ENTRY_DIST_PATH__, moduleName)}", \`requireNative\` only support CommonJS`);
|
|
39
39
|
}
|
|
40
|
-
return __require(
|
|
40
|
+
return __require(getPathFromEntryAsar(moduleName));
|
|
41
41
|
}
|
|
42
42
|
function restartApp() {
|
|
43
43
|
electron__default.default.app.relaunch();
|
package/dist/utils.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, isDev, isLinux, isMac, isWin, loadPage, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, singleInstance } from './chunk-
|
|
1
|
+
export { disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, isDev, isLinux, isMac, isWin, loadPage, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, singleInstance } from './chunk-GTDMND3I.js';
|
|
2
2
|
export { aesDecrypt, aesEncrypt, defaultSignature, defaultUnzipFile, defaultVerifySignature, defaultZipFile, hashBuffer } from './chunk-KZSYEXLO.js';
|
|
3
3
|
export { defaultIsLowerVersion, defaultVersionJsonGenerator, isUpdateJSON, parseVersion } from './chunk-RCRKUKFX.js';
|
package/dist/vite.d.ts
CHANGED
|
@@ -237,6 +237,10 @@ interface BytecodeOptions {
|
|
|
237
237
|
* Enable in preload script. Remember to set `sandbox: false` when creating window
|
|
238
238
|
*/
|
|
239
239
|
preload?: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Custom electron binary path
|
|
242
|
+
*/
|
|
243
|
+
electronPath?: string;
|
|
240
244
|
/**
|
|
241
245
|
* Before transformed code compile function. If return `Falsy` value, it will be ignored
|
|
242
246
|
* @param code transformed code
|
package/dist/vite.js
CHANGED
|
@@ -101,10 +101,9 @@ function toRelativePath(filename, importer) {
|
|
|
101
101
|
const relPath = path5.posix.relative(path5.dirname(importer), filename);
|
|
102
102
|
return relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
103
103
|
}
|
|
104
|
-
function compileToBytecode(code) {
|
|
104
|
+
function compileToBytecode(code, electronPath = getElectronPath()) {
|
|
105
105
|
let data = Buffer.from([]);
|
|
106
106
|
const logErr = (...args) => bytecodeLog.error(args.join(" "), { timestamp: true });
|
|
107
|
-
const electronPath = getElectronPath();
|
|
108
107
|
const bytecodePath = getBytecodeCompilerPath();
|
|
109
108
|
return new Promise((resolve, reject) => {
|
|
110
109
|
const proc = cp.spawn(electronPath, [bytecodePath], {
|
|
@@ -316,7 +315,7 @@ async function buildEntry({
|
|
|
316
315
|
transformedCode = result;
|
|
317
316
|
}
|
|
318
317
|
}
|
|
319
|
-
const buffer = await compileToBytecode(transformedCode);
|
|
318
|
+
const buffer = await compileToBytecode(transformedCode, bytecodeOptions.electronPath);
|
|
320
319
|
fs3.writeFileSync(
|
|
321
320
|
filePath,
|
|
322
321
|
`${isEntry ? bytecodeModuleLoaderCode : useStrict}${isEntry ? "" : "module.exports = "}require("./${fileName}c")`
|
|
@@ -474,6 +473,7 @@ function bytecodePlugin(env, options) {
|
|
|
474
473
|
const {
|
|
475
474
|
enable,
|
|
476
475
|
preload = false,
|
|
476
|
+
electronPath,
|
|
477
477
|
beforeCompile
|
|
478
478
|
} = options;
|
|
479
479
|
if (!enable) {
|
|
@@ -566,7 +566,7 @@ function bytecodePlugin(env, options) {
|
|
|
566
566
|
_code = s.toString();
|
|
567
567
|
}
|
|
568
568
|
if (bytecodeChunks.includes(name)) {
|
|
569
|
-
const bytecodeBuffer = await compileToBytecode(_code);
|
|
569
|
+
const bytecodeBuffer = await compileToBytecode(_code, electronPath);
|
|
570
570
|
fs3.writeFileSync(`${chunkFilePath}c`, bytecodeBuffer);
|
|
571
571
|
if (chunk.isEntry) {
|
|
572
572
|
const bytecodeLoaderBlock = getBytecodeLoaderBlock(chunk.fileName);
|
package/package.json
CHANGED