electron-incremental-update 2.0.0-beta.6 → 2.0.0-beta.7
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/core-DJdvtwvU.d.ts +134 -0
- package/dist/core-ZUlLHadf.d.cts +134 -0
- package/dist/index.d.cts +78 -0
- package/dist/index.d.ts +78 -0
- package/dist/provider.d.cts +76 -0
- package/dist/provider.d.ts +76 -0
- package/dist/types-CItP6bL-.d.cts +104 -0
- package/dist/types-CItP6bL-.d.ts +104 -0
- package/dist/utils.cjs +0 -5
- package/dist/utils.d.cts +80 -0
- package/dist/utils.d.ts +80 -0
- package/dist/utils.js +0 -1
- package/dist/vite.d.ts +402 -0
- package/dist/vite.js +17 -14
- package/dist/zip-DPF5IFkK.d.cts +10 -0
- package/dist/zip-DPF5IFkK.d.ts +10 -0
- package/package.json +1 -1
package/dist/vite.js
CHANGED
|
@@ -6,6 +6,7 @@ import { startup } from 'vite-plugin-electron';
|
|
|
6
6
|
import { notBundle } from 'vite-plugin-electron/plugin';
|
|
7
7
|
import { getPackageInfoSync, loadPackageJSON } from 'local-pkg';
|
|
8
8
|
import { isCI } from 'ci-info';
|
|
9
|
+
export { isCI } from 'ci-info';
|
|
9
10
|
import Asar from '@electron/asar';
|
|
10
11
|
import { build } from 'esbuild';
|
|
11
12
|
import { spawn } from 'node:child_process';
|
|
@@ -102,7 +103,7 @@ function toRelativePath(filename, importer) {
|
|
|
102
103
|
}
|
|
103
104
|
function compileToBytecode(code) {
|
|
104
105
|
let data = Buffer.from([]);
|
|
105
|
-
const logErr = (...args) =>
|
|
106
|
+
const logErr = (...args) => bytecodeLog.error(args.join(" "), { timestamp: true });
|
|
106
107
|
const electronPath = getElectronPath();
|
|
107
108
|
const bytecodePath = getBytecodeCompilerPath();
|
|
108
109
|
return new Promise((resolve2, reject) => {
|
|
@@ -151,11 +152,11 @@ function convertString(code, strings, sourcemap) {
|
|
|
151
152
|
map: sourcemap ? s.generateMap({ hires: "boundary" }) : null
|
|
152
153
|
} : { code };
|
|
153
154
|
}
|
|
155
|
+
var decodeFn = "function(a,b){return String.fromCharCode.apply(0,a.map(function(x){return x-b}))}";
|
|
154
156
|
function obfuscateString(input) {
|
|
155
|
-
const offset = Math.
|
|
156
|
-
const hexArray =
|
|
157
|
-
|
|
158
|
-
return `(${decodeFn})([${hexArray.join(",")}],${offset})`;
|
|
157
|
+
const offset = Math.random() << 4 | 0;
|
|
158
|
+
const hexArray = input.split("").map((c) => "0x" + (c.charCodeAt(0) + offset).toString(16));
|
|
159
|
+
return `(${decodeFn})(${JSON.stringify(hexArray)},${offset})`;
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
// src/build-plugins/utils.ts
|
|
@@ -247,6 +248,7 @@ async function buildEntry({
|
|
|
247
248
|
entryNames: "[dir]/[name]",
|
|
248
249
|
assetNames: "[dir]/[name]",
|
|
249
250
|
external: ["electron", "original-fs"],
|
|
251
|
+
treeShaking: true,
|
|
250
252
|
loader: {
|
|
251
253
|
".node": "empty"
|
|
252
254
|
},
|
|
@@ -431,8 +433,8 @@ function parseOptions(pkg, sourcemap = false, minify = false, options = {}) {
|
|
|
431
433
|
};
|
|
432
434
|
return { buildAsarOption, buildEntryOption, buildVersionOption, postBuild, cert };
|
|
433
435
|
}
|
|
434
|
-
function bytecodePlugin(
|
|
435
|
-
if (!
|
|
436
|
+
function bytecodePlugin(enable, env, options = {}) {
|
|
437
|
+
if (!enable) {
|
|
436
438
|
return null;
|
|
437
439
|
}
|
|
438
440
|
const {
|
|
@@ -577,8 +579,6 @@ ${bytecodeLoaderBlock}`) : _code;
|
|
|
577
579
|
}
|
|
578
580
|
};
|
|
579
581
|
}
|
|
580
|
-
|
|
581
|
-
// src/vite.ts
|
|
582
582
|
function debugStartup(args) {
|
|
583
583
|
if (process.env.VSCODE_DEBUG) {
|
|
584
584
|
console.log("[startup] Electron App");
|
|
@@ -616,7 +616,7 @@ async function electronWithUpdater(options) {
|
|
|
616
616
|
preload: _preload,
|
|
617
617
|
sourcemap = !isBuild,
|
|
618
618
|
minify = isBuild,
|
|
619
|
-
buildVersionJson
|
|
619
|
+
buildVersionJson,
|
|
620
620
|
updater,
|
|
621
621
|
bytecode,
|
|
622
622
|
useNotBundle = true,
|
|
@@ -685,7 +685,8 @@ async function electronWithUpdater(options) {
|
|
|
685
685
|
};
|
|
686
686
|
let isInit = false;
|
|
687
687
|
const rollupOptions = {
|
|
688
|
-
external: (src) => src.startsWith("node:") || Object.keys("dependencies" in pkg ? pkg.dependencies : {}).includes(src)
|
|
688
|
+
external: (src) => src.startsWith("node:") || Object.keys("dependencies" in pkg ? pkg.dependencies : {}).includes(src),
|
|
689
|
+
treeshake: true
|
|
689
690
|
};
|
|
690
691
|
const electronPluginOptions = {
|
|
691
692
|
main: {
|
|
@@ -706,7 +707,7 @@ async function electronWithUpdater(options) {
|
|
|
706
707
|
{
|
|
707
708
|
plugins: [
|
|
708
709
|
!isBuild && useNotBundle ? notBundle() : void 0,
|
|
709
|
-
bytecodeOptions && bytecodePlugin(
|
|
710
|
+
bytecodeOptions && bytecodePlugin(!!bytecode, "main", bytecodeOptions)
|
|
710
711
|
],
|
|
711
712
|
build: {
|
|
712
713
|
sourcemap,
|
|
@@ -725,7 +726,7 @@ async function electronWithUpdater(options) {
|
|
|
725
726
|
vite: mergeConfig(
|
|
726
727
|
{
|
|
727
728
|
plugins: [
|
|
728
|
-
bytecodeOptions && bytecodePlugin(
|
|
729
|
+
bytecodeOptions && bytecodePlugin(!!bytecode, "preload", bytecodeOptions),
|
|
729
730
|
{
|
|
730
731
|
name: `${id}-build`,
|
|
731
732
|
enforce: "post",
|
|
@@ -736,7 +737,9 @@ async function electronWithUpdater(options) {
|
|
|
736
737
|
await _buildEntry();
|
|
737
738
|
await _postBuild();
|
|
738
739
|
const buffer = await buildAsar(buildAsarOption);
|
|
739
|
-
if (buildVersionJson) {
|
|
740
|
+
if (!buildVersionJson && !isCI) {
|
|
741
|
+
log.warn("no `buildVersionJson` setup, skip build version json. Will build in CI by default", { timestamp: true });
|
|
742
|
+
} else {
|
|
740
743
|
await buildVersion(buildVersionOption, buffer);
|
|
741
744
|
}
|
|
742
745
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare function hashBuffer(data: string | Buffer, length: number): Buffer;
|
|
2
|
+
declare function aesEncrypt(plainText: string, key: Buffer, iv: Buffer): string;
|
|
3
|
+
declare function defaultSignature(buffer: Buffer, privateKey: string, cert: string, version: string): string;
|
|
4
|
+
declare function aesDecrypt(encryptedText: string, key: Buffer, iv: Buffer): string;
|
|
5
|
+
declare function defaultVerifySignature(buffer: Buffer, version: string, signature: string, cert: string): boolean;
|
|
6
|
+
|
|
7
|
+
declare function defaultZipFile(buffer: Buffer): Promise<Buffer>;
|
|
8
|
+
declare function defaultUnzipFile(buffer: Buffer): Promise<Buffer>;
|
|
9
|
+
|
|
10
|
+
export { defaultUnzipFile as a, aesEncrypt as b, defaultSignature as c, defaultZipFile as d, aesDecrypt as e, defaultVerifySignature as f, hashBuffer as h };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare function hashBuffer(data: string | Buffer, length: number): Buffer;
|
|
2
|
+
declare function aesEncrypt(plainText: string, key: Buffer, iv: Buffer): string;
|
|
3
|
+
declare function defaultSignature(buffer: Buffer, privateKey: string, cert: string, version: string): string;
|
|
4
|
+
declare function aesDecrypt(encryptedText: string, key: Buffer, iv: Buffer): string;
|
|
5
|
+
declare function defaultVerifySignature(buffer: Buffer, version: string, signature: string, cert: string): boolean;
|
|
6
|
+
|
|
7
|
+
declare function defaultZipFile(buffer: Buffer): Promise<Buffer>;
|
|
8
|
+
declare function defaultUnzipFile(buffer: Buffer): Promise<Buffer>;
|
|
9
|
+
|
|
10
|
+
export { defaultUnzipFile as a, aesEncrypt as b, defaultSignature as c, defaultZipFile as d, aesDecrypt as e, defaultVerifySignature as f, hashBuffer as h };
|
package/package.json
CHANGED