electron-incremental-update 2.1.2 → 2.2.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 +33 -17
- package/dist/{bytecode-I4PMYUGT.js → bytecode-7V24FFYI.js} +5 -7
- package/dist/{chunk-AUY7A2FL.js → chunk-7JCGLFGU.js} +49 -4
- package/dist/{chunk-RCRKUKFX.js → chunk-AAAM44NW.js} +9 -9
- package/dist/{chunk-2XSFM3E5.js → chunk-JI27JWJN.js} +1 -1
- package/dist/chunk-TPTWE33H.js +23 -0
- package/dist/{chunk-5CE27A6G.js → esm-UJAQJA65.js} +22 -2
- package/dist/index.cjs +7 -8
- package/dist/index.d.cts +41 -4
- package/dist/index.d.ts +41 -4
- package/dist/index.js +6 -11
- package/dist/provider.cjs +10 -10
- package/dist/provider.d.cts +4 -4
- package/dist/provider.d.ts +4 -4
- package/dist/provider.js +2 -2
- package/dist/{types-DQKdsHc_.d.ts → types-C6lSLZWB.d.cts} +2 -40
- package/dist/{types-BPH66pNz.d.cts → types-nE_pIMPo.d.ts} +2 -40
- package/dist/utils.cjs +9 -9
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +2 -2
- package/dist/{version-DcFMG3pT.d.ts → version-BYVQ367i.d.cts} +1 -1
- package/dist/{version-DcFMG3pT.d.cts → version-BYVQ367i.d.ts} +1 -1
- package/dist/vite.d.ts +54 -26
- package/dist/vite.js +88 -119
- package/package.json +87 -87
- package/dist/chunk-7IRGAAL2.js +0 -5
- package/dist/chunk-7M7DIMDN.js +0 -43
- package/dist/chunk-WYQ5DRO7.js +0 -12
- package/dist/code-P5OANH3Q.js +0 -1
- package/dist/esm-ZFXJ56BN.js +0 -26
- package/dist/utils-JZ4CMTJG.js +0 -4
- package/dist/utils-KPSYP7HQ.js +0 -5
- package/dist/{zip-rm9ED9nU.d.ts → crypto-Zynscwmj.d.cts} +11 -11
- package/dist/{zip-rm9ED9nU.d.cts → crypto-Zynscwmj.d.ts} +11 -11
package/package.json
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "electron-incremental-update",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"version": "2.1
|
|
5
|
-
"description": "Electron incremental update tools with Vite plugin, support bytecode protection",
|
|
6
|
-
"author": "subframe7536",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/subframe7536/electron-incremental-update.git"
|
|
11
|
-
},
|
|
12
|
-
"keywords": [
|
|
13
|
-
"electron",
|
|
14
|
-
"incremental update",
|
|
15
|
-
"updater",
|
|
16
|
-
"bytecode"
|
|
17
|
-
],
|
|
18
|
-
"exports": {
|
|
19
|
-
".": {
|
|
20
|
-
"import": "./dist/index.js",
|
|
21
|
-
"require": "./dist/index.cjs"
|
|
22
|
-
},
|
|
23
|
-
"./vite": {
|
|
24
|
-
"import": "./dist/vite.js"
|
|
25
|
-
},
|
|
26
|
-
"./utils": {
|
|
27
|
-
"import": "./dist/utils.js",
|
|
28
|
-
"require": "./dist/utils.cjs"
|
|
29
|
-
},
|
|
30
|
-
"./provider": {
|
|
31
|
-
"import": "./dist/provider.js",
|
|
32
|
-
"require": "./dist/provider.cjs"
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"main": "dist/index.cjs",
|
|
36
|
-
"module": "dist/index.js",
|
|
37
|
-
"files": [
|
|
38
|
-
"dist",
|
|
39
|
-
"provider.d.ts",
|
|
40
|
-
"provider.js",
|
|
41
|
-
"utils.d.ts",
|
|
42
|
-
"utils.js",
|
|
43
|
-
"vite.d.ts",
|
|
44
|
-
"vite.js"
|
|
45
|
-
],
|
|
46
|
-
"scripts": {
|
|
47
|
-
"dev": "tsup --watch",
|
|
48
|
-
"build": "tsup && esno fix-module.cjs",
|
|
49
|
-
"release": "pnpm test && pnpm run build && bumpp --all && npm publish",
|
|
50
|
-
"test": "vitest --run",
|
|
51
|
-
"test:dev": "vitest",
|
|
52
|
-
"format": "eslint . --fix"
|
|
53
|
-
},
|
|
54
|
-
"publishConfig": {
|
|
55
|
-
"access": "public",
|
|
56
|
-
"registry": "https://registry.npmjs.org/"
|
|
57
|
-
},
|
|
58
|
-
"peerDependencies": {
|
|
59
|
-
"@electron/asar": "*",
|
|
60
|
-
"esbuild": "*"
|
|
61
|
-
},
|
|
62
|
-
"dependencies": {
|
|
63
|
-
"@babel/core": "^7.25.2",
|
|
64
|
-
"@babel/plugin-transform-arrow-functions": "^7.24.7",
|
|
65
|
-
"@babel/plugin-transform-template-literals": "^7.24.7",
|
|
66
|
-
"@subframe7536/type-utils": "^0.1.6",
|
|
67
|
-
"ci-info": "^4.0.0",
|
|
68
|
-
"local-pkg": "^0.5.0",
|
|
69
|
-
"magic-string": "^0.30.11",
|
|
70
|
-
"selfsigned": "^2.4.1",
|
|
71
|
-
"vite-plugin-electron": "^0.28.7"
|
|
72
|
-
},
|
|
73
|
-
"devDependencies": {
|
|
74
|
-
"@subframe7536/eslint-config": "^0.
|
|
75
|
-
"@types/babel__core": "^7.20.5",
|
|
76
|
-
"@types/node": "^20.
|
|
77
|
-
"bumpp": "^9.5.
|
|
78
|
-
"electron": "28.2.10",
|
|
79
|
-
"eslint": "^9.9.
|
|
80
|
-
"esno": "^4.7.0",
|
|
81
|
-
"tsup": "^8.2.4",
|
|
82
|
-
"typescript": "^5.5.4",
|
|
83
|
-
"vite": "^5.4.
|
|
84
|
-
"vite-plugin-electron": "^0.28.7",
|
|
85
|
-
"vitest": "^2.0.5"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "electron-incremental-update",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "2.2.1",
|
|
5
|
+
"description": "Electron incremental update tools with Vite plugin, support bytecode protection",
|
|
6
|
+
"author": "subframe7536",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/subframe7536/electron-incremental-update.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"electron",
|
|
14
|
+
"incremental update",
|
|
15
|
+
"updater",
|
|
16
|
+
"bytecode"
|
|
17
|
+
],
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"require": "./dist/index.cjs"
|
|
22
|
+
},
|
|
23
|
+
"./vite": {
|
|
24
|
+
"import": "./dist/vite.js"
|
|
25
|
+
},
|
|
26
|
+
"./utils": {
|
|
27
|
+
"import": "./dist/utils.js",
|
|
28
|
+
"require": "./dist/utils.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./provider": {
|
|
31
|
+
"import": "./dist/provider.js",
|
|
32
|
+
"require": "./dist/provider.cjs"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"main": "dist/index.cjs",
|
|
36
|
+
"module": "dist/index.js",
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"provider.d.ts",
|
|
40
|
+
"provider.js",
|
|
41
|
+
"utils.d.ts",
|
|
42
|
+
"utils.js",
|
|
43
|
+
"vite.d.ts",
|
|
44
|
+
"vite.js"
|
|
45
|
+
],
|
|
46
|
+
"scripts": {
|
|
47
|
+
"dev": "tsup --watch",
|
|
48
|
+
"build": "tsup && esno fix-module.cjs",
|
|
49
|
+
"release": "pnpm test && pnpm run build && bumpp --all && npm publish",
|
|
50
|
+
"test": "vitest --run",
|
|
51
|
+
"test:dev": "vitest",
|
|
52
|
+
"format": "eslint . --fix"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public",
|
|
56
|
+
"registry": "https://registry.npmjs.org/"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"@electron/asar": "*",
|
|
60
|
+
"esbuild": "*"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"@babel/core": "^7.25.2",
|
|
64
|
+
"@babel/plugin-transform-arrow-functions": "^7.24.7",
|
|
65
|
+
"@babel/plugin-transform-template-literals": "^7.24.7",
|
|
66
|
+
"@subframe7536/type-utils": "^0.1.6",
|
|
67
|
+
"ci-info": "^4.0.0",
|
|
68
|
+
"local-pkg": "^0.5.0",
|
|
69
|
+
"magic-string": "^0.30.11",
|
|
70
|
+
"selfsigned": "^2.4.1",
|
|
71
|
+
"vite-plugin-electron": "^0.28.7"
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@subframe7536/eslint-config": "^0.9.0",
|
|
75
|
+
"@types/babel__core": "^7.20.5",
|
|
76
|
+
"@types/node": "^20.16.5",
|
|
77
|
+
"bumpp": "^9.5.2",
|
|
78
|
+
"electron": "28.2.10",
|
|
79
|
+
"eslint": "^9.9.1",
|
|
80
|
+
"esno": "^4.7.0",
|
|
81
|
+
"tsup": "^8.2.4",
|
|
82
|
+
"typescript": "^5.5.4",
|
|
83
|
+
"vite": "^5.4.3",
|
|
84
|
+
"vite-plugin-electron": "^0.28.7",
|
|
85
|
+
"vitest": "^2.0.5"
|
|
86
|
+
}
|
|
87
|
+
}
|
package/dist/chunk-7IRGAAL2.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// src/vite/bytecode/code.ts
|
|
2
|
-
var bytecodeGeneratorScript = "const vm = require('vm')\nconst v8 = require('v8')\nconst wrap = require('module').wrap\nv8.setFlagsFromString('--no-lazy')\nv8.setFlagsFromString('--no-flush-bytecode')\nlet code = ''\nprocess.stdin.setEncoding('utf-8')\nprocess.stdin.on('readable', () => {\n const data = process.stdin.read()\n if (data !== null) {\n code += data\n }\n})\nprocess.stdin.on('end', () => {\n try {\n if (typeof code !== 'string') {\n throw new Error('javascript code must be string.')\n }\n const script = new vm.Script(wrap(code), { produceCachedData: true })\n const bytecodeBuffer = script.createCachedData()\n process.stdout.write(bytecodeBuffer)\n } catch (error) {\n console.error(error)\n }\n})\n";
|
|
3
|
-
var bytecodeModuleLoaderCode = '"use strict";\nconst fs = require("fs");\nconst path = require("path");\nconst vm = require("vm");\nconst v8 = require("v8");\nconst Module = require("module");\nv8.setFlagsFromString("--no-lazy");\nv8.setFlagsFromString("--no-flush-bytecode");\nconst FLAG_HASH_OFFSET = 12;\nconst SOURCE_HASH_OFFSET = 8;\nlet dummyBytecode;\nfunction setFlagHashHeader(bytecodeBuffer) {\n if (!dummyBytecode) {\n const script = new vm.Script("", {\n produceCachedData: true\n });\n dummyBytecode = script.createCachedData();\n }\n dummyBytecode.slice(FLAG_HASH_OFFSET, FLAG_HASH_OFFSET + 4).copy(bytecodeBuffer, FLAG_HASH_OFFSET);\n};\nfunction getSourceHashHeader(bytecodeBuffer) {\n return bytecodeBuffer.slice(SOURCE_HASH_OFFSET, SOURCE_HASH_OFFSET + 4);\n};\nfunction buffer2Number(buffer) {\n let ret = 0;\n ret |= buffer[3] << 24;\n ret |= buffer[2] << 16;\n ret |= buffer[1] << 8;\n ret |= buffer[0];\n return ret;\n};\nModule._extensions[".jsc"] = Module._extensions[".cjsc"] = function (module, filename) {\n const bytecodeBuffer = fs.readFileSync(filename);\n if (!Buffer.isBuffer(bytecodeBuffer)) {\n throw new Error("BytecodeBuffer must be a buffer object.");\n }\n setFlagHashHeader(bytecodeBuffer);\n const length = buffer2Number(getSourceHashHeader(bytecodeBuffer));\n let dummyCode = "";\n if (length > 1) {\n dummyCode = "\\"" + "\\u200b".repeat(length - 2) + "\\"";\n }\n const script = new vm.Script(dummyCode, {\n filename: filename,\n lineOffset: 0,\n displayErrors: true,\n cachedData: bytecodeBuffer\n });\n if (script.cachedDataRejected) {\n throw new Error("Invalid or incompatible cached data (cachedDataRejected)");\n }\n const require = function (id) {\n return module.require(id);\n };\n require.resolve = function (request, options) {\n return Module._resolveFilename(request, module, false, options);\n };\n if (process.mainModule) {\n require.main = process.mainModule;\n }\n require.extensions = Module._extensions;\n require.cache = Module._cache;\n const compiledWrapper = script.runInThisContext({\n filename: filename,\n lineOffset: 0,\n columnOffset: 0,\n displayErrors: true\n });\n const dirname = path.dirname(filename);\n const args = [module.exports, require, module, filename, dirname, process, global];\n return compiledWrapper.apply(module.exports, args);\n};\n';
|
|
4
|
-
|
|
5
|
-
export { bytecodeGeneratorScript, bytecodeModuleLoaderCode };
|
package/dist/chunk-7M7DIMDN.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// src/utils/version.ts
|
|
2
|
-
function parseVersion(version) {
|
|
3
|
-
const match = /^(\d+)\.(\d+)\.(\d+)(?:-([a-z0-9.-]+))?/i.exec(version);
|
|
4
|
-
if (!match) {
|
|
5
|
-
throw new TypeError(`invalid version: ${version}`);
|
|
6
|
-
}
|
|
7
|
-
const [major, minor, patch] = match.slice(1, 4).map(Number);
|
|
8
|
-
const ret = {
|
|
9
|
-
major,
|
|
10
|
-
minor,
|
|
11
|
-
patch,
|
|
12
|
-
stage: "",
|
|
13
|
-
stageVersion: -1
|
|
14
|
-
};
|
|
15
|
-
if (match[4]) {
|
|
16
|
-
let [stage, _v] = match[4].split(".");
|
|
17
|
-
ret.stage = stage;
|
|
18
|
-
ret.stageVersion = Number(_v) || -1;
|
|
19
|
-
}
|
|
20
|
-
if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch) || Number.isNaN(ret.stageVersion)) {
|
|
21
|
-
throw new TypeError(`Invalid version: ${version}`);
|
|
22
|
-
}
|
|
23
|
-
return ret;
|
|
24
|
-
}
|
|
25
|
-
function isUpdateJSON(json) {
|
|
26
|
-
const is = (j) => !!(j && j.minimumVersion && j.signature && j.version);
|
|
27
|
-
return is(json) && is(json?.beta);
|
|
28
|
-
}
|
|
29
|
-
function defaultVersionJsonGenerator(existingJson, signature, version, minimumVersion) {
|
|
30
|
-
existingJson.beta = {
|
|
31
|
-
version,
|
|
32
|
-
minimumVersion,
|
|
33
|
-
signature
|
|
34
|
-
};
|
|
35
|
-
if (!parseVersion(version).stage) {
|
|
36
|
-
existingJson.version = version;
|
|
37
|
-
existingJson.minimumVersion = minimumVersion;
|
|
38
|
-
existingJson.signature = signature;
|
|
39
|
-
}
|
|
40
|
-
return existingJson;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { defaultVersionJsonGenerator, isUpdateJSON, parseVersion };
|
package/dist/chunk-WYQ5DRO7.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// src/vite/utils.ts
|
|
2
|
-
function readableSize(size) {
|
|
3
|
-
const units = ["B", "KB", "MB", "GB"];
|
|
4
|
-
let i = 0;
|
|
5
|
-
while (size >= 1024 && i < units.length - 1) {
|
|
6
|
-
size /= 1024;
|
|
7
|
-
i++;
|
|
8
|
-
}
|
|
9
|
-
return `${size.toFixed(2)} ${units[i]}`;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { readableSize };
|
package/dist/code-P5OANH3Q.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { bytecodeGeneratorScript, bytecodeModuleLoaderCode } from './chunk-7IRGAAL2.js';
|
package/dist/esm-ZFXJ56BN.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { findStaticImports, insertCJSShim } from './chunk-5CE27A6G.js';
|
|
2
|
-
import './chunk-AUY7A2FL.js';
|
|
3
|
-
import './chunk-7M7DIMDN.js';
|
|
4
|
-
import { esmId } from './chunk-5NKEXGI3.js';
|
|
5
|
-
import './chunk-7IRGAAL2.js';
|
|
6
|
-
|
|
7
|
-
// src/vite/esm/index.ts
|
|
8
|
-
function esm() {
|
|
9
|
-
let sourcemap;
|
|
10
|
-
return {
|
|
11
|
-
name: esmId,
|
|
12
|
-
enforce: "post",
|
|
13
|
-
configResolved(config) {
|
|
14
|
-
sourcemap = config.build.sourcemap;
|
|
15
|
-
},
|
|
16
|
-
renderChunk(code, _chunk, options) {
|
|
17
|
-
if (options.format === "es") {
|
|
18
|
-
const lastESMImport = findStaticImports(code).pop();
|
|
19
|
-
const pos = lastESMImport ? lastESMImport.end : 0;
|
|
20
|
-
return insertCJSShim(code, sourcemap, pos);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { esm };
|
package/dist/utils-JZ4CMTJG.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { bytecodeModuleLoader, compileToBytecode, convertArrowFunctionAndTemplate, convertLiteral, decodeFn, electronMajorVersion, electronModule, obfuscateString, toRelativePath, useStrict } from './chunk-AUY7A2FL.js';
|
|
2
|
-
import './chunk-7M7DIMDN.js';
|
|
3
|
-
import './chunk-5NKEXGI3.js';
|
|
4
|
-
import './chunk-7IRGAAL2.js';
|
package/dist/utils-KPSYP7HQ.js
DELETED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default function to compress file using brotli
|
|
3
|
+
* @param buffer uncompressed file buffer
|
|
4
|
+
*/
|
|
5
|
+
declare function defaultZipFile(buffer: Buffer): Promise<Buffer>;
|
|
6
|
+
/**
|
|
7
|
+
* Default function to decompress file using brotli
|
|
8
|
+
* @param buffer compressed file buffer
|
|
9
|
+
*/
|
|
10
|
+
declare function defaultUnzipFile(buffer: Buffer): Promise<Buffer>;
|
|
11
|
+
|
|
1
12
|
declare function hashBuffer(data: string | Buffer, length: number): Buffer;
|
|
2
13
|
declare function aesEncrypt(plainText: string, key: Buffer, iv: Buffer): string;
|
|
3
14
|
/**
|
|
@@ -19,15 +30,4 @@ declare function aesDecrypt(encryptedText: string, key: Buffer, iv: Buffer): str
|
|
|
19
30
|
*/
|
|
20
31
|
declare function defaultVerifySignature(buffer: Buffer, version: string, signature: string, cert: string): boolean;
|
|
21
32
|
|
|
22
|
-
/**
|
|
23
|
-
* Default function to compress file using brotli
|
|
24
|
-
* @param buffer uncompressed file buffer
|
|
25
|
-
*/
|
|
26
|
-
declare function defaultZipFile(buffer: Buffer): Promise<Buffer>;
|
|
27
|
-
/**
|
|
28
|
-
* Default function to decompress file using brotli
|
|
29
|
-
* @param buffer compressed file buffer
|
|
30
|
-
*/
|
|
31
|
-
declare function defaultUnzipFile(buffer: Buffer): Promise<Buffer>;
|
|
32
|
-
|
|
33
33
|
export { defaultUnzipFile as a, aesEncrypt as b, defaultSignature as c, defaultZipFile as d, aesDecrypt as e, defaultVerifySignature as f, hashBuffer as h };
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default function to compress file using brotli
|
|
3
|
+
* @param buffer uncompressed file buffer
|
|
4
|
+
*/
|
|
5
|
+
declare function defaultZipFile(buffer: Buffer): Promise<Buffer>;
|
|
6
|
+
/**
|
|
7
|
+
* Default function to decompress file using brotli
|
|
8
|
+
* @param buffer compressed file buffer
|
|
9
|
+
*/
|
|
10
|
+
declare function defaultUnzipFile(buffer: Buffer): Promise<Buffer>;
|
|
11
|
+
|
|
1
12
|
declare function hashBuffer(data: string | Buffer, length: number): Buffer;
|
|
2
13
|
declare function aesEncrypt(plainText: string, key: Buffer, iv: Buffer): string;
|
|
3
14
|
/**
|
|
@@ -19,15 +30,4 @@ declare function aesDecrypt(encryptedText: string, key: Buffer, iv: Buffer): str
|
|
|
19
30
|
*/
|
|
20
31
|
declare function defaultVerifySignature(buffer: Buffer, version: string, signature: string, cert: string): boolean;
|
|
21
32
|
|
|
22
|
-
/**
|
|
23
|
-
* Default function to compress file using brotli
|
|
24
|
-
* @param buffer uncompressed file buffer
|
|
25
|
-
*/
|
|
26
|
-
declare function defaultZipFile(buffer: Buffer): Promise<Buffer>;
|
|
27
|
-
/**
|
|
28
|
-
* Default function to decompress file using brotli
|
|
29
|
-
* @param buffer compressed file buffer
|
|
30
|
-
*/
|
|
31
|
-
declare function defaultUnzipFile(buffer: Buffer): Promise<Buffer>;
|
|
32
|
-
|
|
33
33
|
export { defaultUnzipFile as a, aesEncrypt as b, defaultSignature as c, defaultZipFile as d, aesDecrypt as e, defaultVerifySignature as f, hashBuffer as h };
|