electron-incremental-update 2.3.2 → 2.3.4
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 +4 -2
- package/dist/vite.d.ts +27 -6
- package/dist/vite.js +508 -81
- package/package.json +1 -1
- package/dist/bytecode-7J2ZQDDO.js +0 -167
- package/dist/chunk-5NKEXGI3.js +0 -10
- package/dist/chunk-LR7LR5WG.js +0 -192
- package/dist/chunk-TPTWE33H.js +0 -23
- package/dist/constant-ME27JB5D.js +0 -1
- package/dist/esm-4S4XCVEW.js +0 -64
package/dist/vite.js
CHANGED
|
@@ -1,22 +1,447 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
export { convertLiteral } from './chunk-LR7LR5WG.js';
|
|
4
|
-
import { log, id } from './chunk-5NKEXGI3.js';
|
|
5
|
-
import fs2 from 'node:fs';
|
|
6
|
-
import path3 from 'node:path';
|
|
1
|
+
import fs5 from 'node:fs';
|
|
2
|
+
import path5 from 'node:path';
|
|
7
3
|
import { isCI } from 'ci-info';
|
|
8
4
|
export { isCI } from 'ci-info';
|
|
9
|
-
import {
|
|
5
|
+
import { getPackageInfoSync, loadPackageJSON } from 'local-pkg';
|
|
10
6
|
export { getPackageInfo, getPackageInfoSync, loadPackageJSON, resolveModule } from 'local-pkg';
|
|
11
|
-
import { normalizePath, mergeConfig } from 'vite';
|
|
7
|
+
import { createLogger, normalizePath, mergeConfig, createFilter } from 'vite';
|
|
12
8
|
import { startup, build } from 'vite-plugin-electron';
|
|
13
9
|
import { notBundle } from 'vite-plugin-electron/plugin';
|
|
14
10
|
import ElectronSimple from 'vite-plugin-electron/simple';
|
|
15
11
|
import Asar from '@electron/asar';
|
|
12
|
+
import MagicString from 'magic-string';
|
|
13
|
+
import cp from 'node:child_process';
|
|
14
|
+
import * as babel from '@babel/core';
|
|
15
|
+
import { builtinModules } from 'node:module';
|
|
16
16
|
import crypto from 'node:crypto';
|
|
17
17
|
import zlib from 'node:zlib';
|
|
18
18
|
import { generate } from 'selfsigned';
|
|
19
19
|
|
|
20
|
+
// src/vite/index.ts
|
|
21
|
+
|
|
22
|
+
// src/utils/version.ts
|
|
23
|
+
function parseVersion(version) {
|
|
24
|
+
const match = /^(\d+)\.(\d+)\.(\d+)(?:-([a-z0-9.-]+))?/i.exec(version);
|
|
25
|
+
if (!match) {
|
|
26
|
+
throw new TypeError(`invalid version: ${version}`);
|
|
27
|
+
}
|
|
28
|
+
const [major, minor, patch] = match.slice(1, 4).map(Number);
|
|
29
|
+
const ret = {
|
|
30
|
+
major,
|
|
31
|
+
minor,
|
|
32
|
+
patch,
|
|
33
|
+
stage: "",
|
|
34
|
+
stageVersion: -1
|
|
35
|
+
};
|
|
36
|
+
if (match[4]) {
|
|
37
|
+
let [stage, _v] = match[4].split(".");
|
|
38
|
+
ret.stage = stage;
|
|
39
|
+
ret.stageVersion = Number(_v) || -1;
|
|
40
|
+
}
|
|
41
|
+
if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch) || Number.isNaN(ret.stageVersion)) {
|
|
42
|
+
throw new TypeError(`Invalid version: ${version}`);
|
|
43
|
+
}
|
|
44
|
+
return ret;
|
|
45
|
+
}
|
|
46
|
+
var is = (j) => !!(j && j.minimumVersion && j.signature && j.version);
|
|
47
|
+
function isUpdateJSON(json) {
|
|
48
|
+
return is(json) && is(json?.beta);
|
|
49
|
+
}
|
|
50
|
+
function defaultVersionJsonGenerator(existingJson, signature, version, minimumVersion) {
|
|
51
|
+
existingJson.beta = {
|
|
52
|
+
version,
|
|
53
|
+
minimumVersion,
|
|
54
|
+
signature
|
|
55
|
+
};
|
|
56
|
+
if (!parseVersion(version).stage) {
|
|
57
|
+
existingJson.version = version;
|
|
58
|
+
existingJson.minimumVersion = minimumVersion;
|
|
59
|
+
existingJson.signature = signature;
|
|
60
|
+
}
|
|
61
|
+
return existingJson;
|
|
62
|
+
}
|
|
63
|
+
var id = "electron-incremental-updater";
|
|
64
|
+
var bytecodeId = `${id}-bytecode`;
|
|
65
|
+
var esmId = `${id}-esm`;
|
|
66
|
+
var log = createLogger("info", { prefix: `[${id}]` });
|
|
67
|
+
var bytecodeLog = createLogger("info", { prefix: `[${bytecodeId}]` });
|
|
68
|
+
function readableSize(size) {
|
|
69
|
+
const units = ["B", "KB", "MB", "GB"];
|
|
70
|
+
let i = 0;
|
|
71
|
+
while (size >= 1024 && i < units.length - 1) {
|
|
72
|
+
size /= 1024;
|
|
73
|
+
i++;
|
|
74
|
+
}
|
|
75
|
+
return `${size.toFixed(2)} ${units[i]}`;
|
|
76
|
+
}
|
|
77
|
+
function copyAndSkipIfExist(from, to, skipIfExist) {
|
|
78
|
+
if (!skipIfExist || !fs5.existsSync(to)) {
|
|
79
|
+
try {
|
|
80
|
+
fs5.cpSync(from, to, { recursive: true });
|
|
81
|
+
} catch (error) {
|
|
82
|
+
log.warn(`Copy failed: ${error}`, { timestamp: true });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// src/vite/bytecode/code.ts
|
|
88
|
+
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";
|
|
89
|
+
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';
|
|
90
|
+
var electronModule = getPackageInfoSync("electron");
|
|
91
|
+
var electronMajorVersion = parseVersion(electronModule.version).major;
|
|
92
|
+
var useStrict = "'use strict';";
|
|
93
|
+
var bytecodeModuleLoader = "__loader__.js";
|
|
94
|
+
function getElectronPath() {
|
|
95
|
+
const electronModulePath = electronModule.rootPath;
|
|
96
|
+
let electronExecPath = process.env.ELECTRON_EXEC_PATH || "";
|
|
97
|
+
if (!electronExecPath) {
|
|
98
|
+
if (!electronModulePath) {
|
|
99
|
+
throw new Error("Electron is not installed");
|
|
100
|
+
}
|
|
101
|
+
const pathFile = path5.join(electronModulePath, "path.txt");
|
|
102
|
+
let executablePath;
|
|
103
|
+
if (fs5.existsSync(pathFile)) {
|
|
104
|
+
executablePath = fs5.readFileSync(pathFile, "utf-8");
|
|
105
|
+
}
|
|
106
|
+
if (executablePath) {
|
|
107
|
+
electronExecPath = path5.join(electronModulePath, "dist", executablePath);
|
|
108
|
+
process.env.ELECTRON_EXEC_PATH = electronExecPath;
|
|
109
|
+
} else {
|
|
110
|
+
throw new Error("Electron executable file is not existed");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return electronExecPath;
|
|
114
|
+
}
|
|
115
|
+
function getBytecodeCompilerPath() {
|
|
116
|
+
const scriptPath = path5.join(electronModule.rootPath, "EIU_bytenode.cjs");
|
|
117
|
+
if (!fs5.existsSync(scriptPath)) {
|
|
118
|
+
fs5.writeFileSync(scriptPath, bytecodeGeneratorScript);
|
|
119
|
+
}
|
|
120
|
+
return scriptPath;
|
|
121
|
+
}
|
|
122
|
+
function toRelativePath(filename, importer) {
|
|
123
|
+
const relPath = path5.posix.relative(path5.dirname(importer), filename);
|
|
124
|
+
return relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
125
|
+
}
|
|
126
|
+
var logErr = (...args) => bytecodeLog.error(args.join(" "), { timestamp: true });
|
|
127
|
+
function compileToBytecode(code, electronPath = getElectronPath()) {
|
|
128
|
+
let data = Buffer.from([]);
|
|
129
|
+
const bytecodePath = getBytecodeCompilerPath();
|
|
130
|
+
return new Promise((resolve, reject) => {
|
|
131
|
+
const proc = cp.spawn(electronPath, [bytecodePath], {
|
|
132
|
+
env: { ELECTRON_RUN_AS_NODE: "1" },
|
|
133
|
+
stdio: ["pipe", "pipe", "pipe", "ipc"]
|
|
134
|
+
});
|
|
135
|
+
if (proc.stdin) {
|
|
136
|
+
proc.stdin.write(code);
|
|
137
|
+
proc.stdin.end();
|
|
138
|
+
}
|
|
139
|
+
if (proc.stdout) {
|
|
140
|
+
proc.stdout.on("data", (chunk) => data = Buffer.concat([data, chunk]));
|
|
141
|
+
proc.stdout.on("error", (err) => logErr(err));
|
|
142
|
+
proc.stdout.on("end", () => resolve(data));
|
|
143
|
+
}
|
|
144
|
+
if (proc.stderr) {
|
|
145
|
+
proc.stderr.on("data", (chunk) => logErr("Error: ", chunk.toString()));
|
|
146
|
+
proc.stderr.on("error", (err) => logErr("Error: ", err));
|
|
147
|
+
}
|
|
148
|
+
proc.addListener("error", (err) => logErr(err));
|
|
149
|
+
proc.on("error", (err) => reject(err));
|
|
150
|
+
proc.on("exit", () => resolve(data));
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function convertArrowFunctionAndTemplate(code) {
|
|
154
|
+
const result = babel.transform(code, {
|
|
155
|
+
plugins: ["@babel/plugin-transform-arrow-functions", "@babel/plugin-transform-template-literals"]
|
|
156
|
+
});
|
|
157
|
+
return {
|
|
158
|
+
code: result?.code || code,
|
|
159
|
+
map: result?.map
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
var decodeFn = ";function _0xstr_(a,b){return String.fromCharCode.apply(0,a.map(function(x){return x-b}))};";
|
|
163
|
+
function obfuscateString(input, offset = ~~(Math.random() * 16) + 1) {
|
|
164
|
+
const hexArray = input.split("").map((c) => `0x${(c.charCodeAt(0) + offset).toString(16)}`);
|
|
165
|
+
return `_0xstr_([${hexArray.join(",")}],${offset})`;
|
|
166
|
+
}
|
|
167
|
+
function convertLiteral(code, sourcemap, offset) {
|
|
168
|
+
const s = new MagicString(code);
|
|
169
|
+
let hasTransformed = false;
|
|
170
|
+
const ast = babel.parse(code, { ast: true });
|
|
171
|
+
if (!ast) {
|
|
172
|
+
throw new Error("Cannot parse code");
|
|
173
|
+
}
|
|
174
|
+
babel.traverse(ast, {
|
|
175
|
+
StringLiteral(path6) {
|
|
176
|
+
const parent = path6.parent;
|
|
177
|
+
const node = path6.node;
|
|
178
|
+
if (parent.type === "CallExpression") {
|
|
179
|
+
if (parent.callee.type === "Identifier" && parent.callee.name === "require") {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
if (parent.callee.type === "Import") {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (parent.type.startsWith("Export")) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (parent.type.startsWith("Import")) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (parent.type === "ObjectMethod" && parent.key === node) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (parent.type === "ObjectProperty" && parent.key === node) {
|
|
196
|
+
const result2 = `[${obfuscateString(node.value, offset)}]`;
|
|
197
|
+
const start2 = node.start;
|
|
198
|
+
const end2 = node.end;
|
|
199
|
+
if (start2 && end2) {
|
|
200
|
+
s.overwrite(start2, end2, result2);
|
|
201
|
+
hasTransformed = true;
|
|
202
|
+
}
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (!node.value.trim()) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const result = obfuscateString(node.value, offset);
|
|
209
|
+
const start = node.start;
|
|
210
|
+
const end = node.end;
|
|
211
|
+
if (start && end) {
|
|
212
|
+
s.overwrite(start, end, result);
|
|
213
|
+
hasTransformed = true;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
if (hasTransformed) {
|
|
218
|
+
s.append("\n").append(decodeFn);
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
code: s.toString(),
|
|
222
|
+
map: sourcemap ? s.generateMap({ hires: true }) : void 0
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// src/vite/bytecode/index.ts
|
|
227
|
+
function getBytecodeLoaderBlock(chunkFileName) {
|
|
228
|
+
return `require("${toRelativePath(bytecodeModuleLoader, normalizePath(chunkFileName))}");`;
|
|
229
|
+
}
|
|
230
|
+
function bytecodePlugin(env, options) {
|
|
231
|
+
const {
|
|
232
|
+
enable,
|
|
233
|
+
preload = false,
|
|
234
|
+
electronPath,
|
|
235
|
+
beforeCompile
|
|
236
|
+
} = options;
|
|
237
|
+
if (!enable) {
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
if (!preload && env === "preload") {
|
|
241
|
+
bytecodeLog.warn('`bytecodePlugin` is skiped in preload. To enable in preload, please manually set the "enablePreload" option to true and set `sandbox: false` when creating the window', { timestamp: true });
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
const filter = createFilter(/\.(m?[jt]s|[jt]sx)$/);
|
|
245
|
+
let config;
|
|
246
|
+
let bytecodeRequired = false;
|
|
247
|
+
let bytecodeFiles = [];
|
|
248
|
+
return {
|
|
249
|
+
name: `${bytecodeId}-${env}`,
|
|
250
|
+
apply: "build",
|
|
251
|
+
enforce: "post",
|
|
252
|
+
configResolved(resolvedConfig) {
|
|
253
|
+
config = resolvedConfig;
|
|
254
|
+
},
|
|
255
|
+
transform(code, id2) {
|
|
256
|
+
if (!filter(id2)) {
|
|
257
|
+
return convertLiteral(code, !!config.build.sourcemap);
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
generateBundle(options2) {
|
|
261
|
+
if (options2.format !== "es" && bytecodeRequired) {
|
|
262
|
+
this.emitFile({
|
|
263
|
+
type: "asset",
|
|
264
|
+
source: `${bytecodeModuleLoaderCode}
|
|
265
|
+
`,
|
|
266
|
+
name: "Bytecode Loader File",
|
|
267
|
+
fileName: bytecodeModuleLoader
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
renderChunk(code, chunk, options2) {
|
|
272
|
+
if (options2.format === "es") {
|
|
273
|
+
bytecodeLog.warn(
|
|
274
|
+
'`bytecodePlugin` does not support ES module, please set "build.rollupOptions.output.format" option to "cjs"',
|
|
275
|
+
{ timestamp: true }
|
|
276
|
+
);
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
if (chunk.type === "chunk") {
|
|
280
|
+
bytecodeRequired = true;
|
|
281
|
+
return convertArrowFunctionAndTemplate(code);
|
|
282
|
+
}
|
|
283
|
+
return null;
|
|
284
|
+
},
|
|
285
|
+
async writeBundle(options2, output) {
|
|
286
|
+
if (options2.format === "es" || !bytecodeRequired) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
const outDir = options2.dir;
|
|
290
|
+
bytecodeFiles = [];
|
|
291
|
+
const bundles = Object.keys(output);
|
|
292
|
+
const chunks = Object.values(output).filter(
|
|
293
|
+
(chunk) => chunk.type === "chunk" && chunk.fileName !== bytecodeModuleLoader
|
|
294
|
+
);
|
|
295
|
+
const bytecodeChunks = chunks.map((chunk) => chunk.fileName);
|
|
296
|
+
const nonEntryChunks = chunks.filter((chunk) => !chunk.isEntry).map((chunk) => path5.basename(chunk.fileName));
|
|
297
|
+
const pattern = nonEntryChunks.map((chunk) => `(${chunk})`).join("|");
|
|
298
|
+
const bytecodeRE = pattern ? new RegExp(`require\\(\\S*(?=(${pattern})\\S*\\))`, "g") : null;
|
|
299
|
+
await Promise.all(
|
|
300
|
+
bundles.map(async (name) => {
|
|
301
|
+
const chunk = output[name];
|
|
302
|
+
if (chunk.type === "chunk") {
|
|
303
|
+
let _code = chunk.code;
|
|
304
|
+
const chunkFilePath = path5.resolve(outDir, name);
|
|
305
|
+
if (beforeCompile) {
|
|
306
|
+
const cbResult = await beforeCompile(_code, chunkFilePath);
|
|
307
|
+
if (cbResult) {
|
|
308
|
+
_code = cbResult;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
if (bytecodeRE && _code.match(bytecodeRE)) {
|
|
312
|
+
let match;
|
|
313
|
+
const s = new MagicString(_code);
|
|
314
|
+
while (match = bytecodeRE.exec(_code)) {
|
|
315
|
+
const [prefix, chunkName] = match;
|
|
316
|
+
const len = prefix.length + chunkName.length;
|
|
317
|
+
s.overwrite(match.index, match.index + len, `${prefix + chunkName}c`, {
|
|
318
|
+
contentOnly: true
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
_code = s.toString();
|
|
322
|
+
}
|
|
323
|
+
if (bytecodeChunks.includes(name)) {
|
|
324
|
+
const bytecodeBuffer = await compileToBytecode(_code, electronPath);
|
|
325
|
+
fs5.writeFileSync(`${chunkFilePath}c`, bytecodeBuffer);
|
|
326
|
+
if (chunk.isEntry) {
|
|
327
|
+
const bytecodeLoaderBlock = getBytecodeLoaderBlock(chunk.fileName);
|
|
328
|
+
const bytecodeModuleBlock = `require("./${`${path5.basename(name)}c`}");`;
|
|
329
|
+
const code = `${useStrict}
|
|
330
|
+
${bytecodeLoaderBlock}
|
|
331
|
+
module.exports=${bytecodeModuleBlock}
|
|
332
|
+
`;
|
|
333
|
+
fs5.writeFileSync(chunkFilePath, code);
|
|
334
|
+
} else {
|
|
335
|
+
fs5.unlinkSync(chunkFilePath);
|
|
336
|
+
}
|
|
337
|
+
bytecodeFiles.push({ name: `${name}c`, size: bytecodeBuffer.length });
|
|
338
|
+
} else {
|
|
339
|
+
if (chunk.isEntry) {
|
|
340
|
+
let hasBytecodeMoudle = false;
|
|
341
|
+
const idsToHandle = /* @__PURE__ */ new Set([...chunk.imports, ...chunk.dynamicImports]);
|
|
342
|
+
for (const moduleId of idsToHandle) {
|
|
343
|
+
if (bytecodeChunks.includes(moduleId)) {
|
|
344
|
+
hasBytecodeMoudle = true;
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
const moduleInfo = this.getModuleInfo(moduleId);
|
|
348
|
+
if (moduleInfo && !moduleInfo.isExternal) {
|
|
349
|
+
const { importers, dynamicImporters } = moduleInfo;
|
|
350
|
+
for (const importerId of importers) {
|
|
351
|
+
idsToHandle.add(importerId);
|
|
352
|
+
}
|
|
353
|
+
for (const importerId of dynamicImporters) {
|
|
354
|
+
idsToHandle.add(importerId);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
const bytecodeLoaderBlock = getBytecodeLoaderBlock(chunk.fileName);
|
|
359
|
+
_code = hasBytecodeMoudle ? _code.replace(
|
|
360
|
+
new RegExp(`(${useStrict})|("use strict";)`),
|
|
361
|
+
`${useStrict}
|
|
362
|
+
${bytecodeLoaderBlock}`
|
|
363
|
+
) : _code;
|
|
364
|
+
}
|
|
365
|
+
fs5.writeFileSync(chunkFilePath, _code);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
})
|
|
369
|
+
);
|
|
370
|
+
},
|
|
371
|
+
closeBundle() {
|
|
372
|
+
const outDir = `${normalizePath(path5.relative(config.root, path5.resolve(config.root, config.build.outDir)))}/`;
|
|
373
|
+
bytecodeFiles.forEach((file) => {
|
|
374
|
+
bytecodeLog.info(
|
|
375
|
+
`${outDir}${file.name} [${readableSize(file.size)}]`,
|
|
376
|
+
{ timestamp: true }
|
|
377
|
+
);
|
|
378
|
+
});
|
|
379
|
+
bytecodeLog.info(`${bytecodeFiles.length} bundles compiled into bytecode.`, { timestamp: true });
|
|
380
|
+
bytecodeFiles = [];
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// src/vite/esm/constant.ts
|
|
386
|
+
var CJSShim = `
|
|
387
|
+
// -- CommonJS Shims --
|
|
388
|
+
import __cjs_url__ from 'node:url';
|
|
389
|
+
import __cjs_path__ from 'node:path';
|
|
390
|
+
import __cjs_mod__ from 'node:module';
|
|
391
|
+
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
392
|
+
const __dirname = __cjs_path__.dirname(__filename);
|
|
393
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
394
|
+
`;
|
|
395
|
+
var CJSShim_electron_30 = `
|
|
396
|
+
// -- CommonJS Shims --
|
|
397
|
+
import __cjs_mod__ from 'node:module';
|
|
398
|
+
const __filename = import.meta.filename;
|
|
399
|
+
const __dirname = import.meta.dirname;
|
|
400
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
401
|
+
`;
|
|
402
|
+
var shim = electronMajorVersion >= 30 ? CJSShim_electron_30 : CJSShim;
|
|
403
|
+
|
|
404
|
+
// src/vite/esm/utils.ts
|
|
405
|
+
var ESMStaticImportRe = /(?<=\s|^|;)import\s*([\s"']*(?<imports>[\p{L}\p{M}\w\t\n\r $*,/{}@.]+)from\s*)?["']\s*(?<specifier>(?<=")[^"]*[^\s"](?=\s*")|(?<=')[^']*[^\s'](?=\s*'))\s*["'][\s;]*/gmu;
|
|
406
|
+
function findStaticImports(code) {
|
|
407
|
+
const matches = [];
|
|
408
|
+
for (const match of code.matchAll(ESMStaticImportRe)) {
|
|
409
|
+
matches.push({ end: (match.index || 0) + match[0].length });
|
|
410
|
+
}
|
|
411
|
+
return matches;
|
|
412
|
+
}
|
|
413
|
+
function insertCJSShim(code, sourcemap, insertPosition = 0) {
|
|
414
|
+
if (code.includes(shim) || !/__filename|__dirname|require\(|require\.resolve\(|require\.apply\(/.test(code)) {
|
|
415
|
+
return null;
|
|
416
|
+
}
|
|
417
|
+
const s = new MagicString(code);
|
|
418
|
+
s.appendRight(insertPosition, shim);
|
|
419
|
+
return {
|
|
420
|
+
code: s.toString(),
|
|
421
|
+
map: sourcemap ? s.generateMap({ hires: "boundary" }) : null
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// src/vite/esm/index.ts
|
|
426
|
+
function esm() {
|
|
427
|
+
let sourcemap;
|
|
428
|
+
return {
|
|
429
|
+
name: esmId,
|
|
430
|
+
enforce: "post",
|
|
431
|
+
configResolved(config) {
|
|
432
|
+
sourcemap = config.build.sourcemap;
|
|
433
|
+
},
|
|
434
|
+
renderChunk(code, _chunk, options) {
|
|
435
|
+
if (options.format === "es") {
|
|
436
|
+
const lastESMImport = findStaticImports(code).pop();
|
|
437
|
+
const pos = lastESMImport ? lastESMImport.end : 0;
|
|
438
|
+
return insertCJSShim(code, sourcemap, pos);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// src/vite/build.ts
|
|
20
445
|
async function buildAsar({
|
|
21
446
|
version,
|
|
22
447
|
asarOutputPath,
|
|
@@ -25,11 +450,11 @@ async function buildAsar({
|
|
|
25
450
|
rendererDistPath,
|
|
26
451
|
generateGzipFile
|
|
27
452
|
}) {
|
|
28
|
-
|
|
29
|
-
|
|
453
|
+
fs5.renameSync(rendererDistPath, path5.join(electronDistPath, "renderer"));
|
|
454
|
+
fs5.writeFileSync(path5.join(electronDistPath, "version"), version);
|
|
30
455
|
await Asar.createPackage(electronDistPath, asarOutputPath);
|
|
31
|
-
const buf = await generateGzipFile(
|
|
32
|
-
|
|
456
|
+
const buf = await generateGzipFile(fs5.readFileSync(asarOutputPath));
|
|
457
|
+
fs5.writeFileSync(gzipPath, buf);
|
|
33
458
|
log.info(`Build update asar to '${gzipPath}' [${readableSize(buf.length)}]`, { timestamp: true });
|
|
34
459
|
return buf;
|
|
35
460
|
}
|
|
@@ -52,9 +477,9 @@ async function buildUpdateJson({
|
|
|
52
477
|
signature: "",
|
|
53
478
|
version
|
|
54
479
|
};
|
|
55
|
-
if (
|
|
480
|
+
if (fs5.existsSync(versionPath)) {
|
|
56
481
|
try {
|
|
57
|
-
const oldVersionJson = JSON.parse(
|
|
482
|
+
const oldVersionJson = JSON.parse(fs5.readFileSync(versionPath, "utf-8"));
|
|
58
483
|
if (isUpdateJSON(oldVersionJson)) {
|
|
59
484
|
_json = oldVersionJson;
|
|
60
485
|
} else {
|
|
@@ -68,7 +493,7 @@ async function buildUpdateJson({
|
|
|
68
493
|
if (!isUpdateJSON(_json)) {
|
|
69
494
|
throw new Error("Invalid update json");
|
|
70
495
|
}
|
|
71
|
-
|
|
496
|
+
fs5.writeFileSync(versionPath, JSON.stringify(_json, null, 2));
|
|
72
497
|
log.info(`build update json to '${versionPath}'`, { timestamp: true });
|
|
73
498
|
}
|
|
74
499
|
async function buildEntry({
|
|
@@ -88,8 +513,8 @@ async function buildEntry({
|
|
|
88
513
|
},
|
|
89
514
|
vite: mergeConfig({
|
|
90
515
|
plugins: [
|
|
91
|
-
isESM &&
|
|
92
|
-
bytecodeOptions &&
|
|
516
|
+
isESM && esm(),
|
|
517
|
+
bytecodeOptions && bytecodePlugin("main", bytecodeOptions)
|
|
93
518
|
],
|
|
94
519
|
build: {
|
|
95
520
|
sourcemap,
|
|
@@ -120,21 +545,21 @@ async function defaultZipFile(buffer) {
|
|
|
120
545
|
});
|
|
121
546
|
}
|
|
122
547
|
function generateKeyPair(keyLength, subject, days, privateKeyPath, certPath) {
|
|
123
|
-
const privateKeyDir =
|
|
124
|
-
if (!
|
|
125
|
-
|
|
548
|
+
const privateKeyDir = path5.dirname(privateKeyPath);
|
|
549
|
+
if (!fs5.existsSync(privateKeyDir)) {
|
|
550
|
+
fs5.mkdirSync(privateKeyDir, { recursive: true });
|
|
126
551
|
}
|
|
127
|
-
const certDir =
|
|
128
|
-
if (!
|
|
129
|
-
|
|
552
|
+
const certDir = path5.dirname(certPath);
|
|
553
|
+
if (!fs5.existsSync(certDir)) {
|
|
554
|
+
fs5.mkdirSync(certDir, { recursive: true });
|
|
130
555
|
}
|
|
131
556
|
const { cert, private: privateKey } = generate(subject, {
|
|
132
557
|
keySize: keyLength,
|
|
133
558
|
algorithm: "sha256",
|
|
134
559
|
days
|
|
135
560
|
});
|
|
136
|
-
|
|
137
|
-
|
|
561
|
+
fs5.writeFileSync(privateKeyPath, privateKey.replace(/\r\n?/g, "\n"));
|
|
562
|
+
fs5.writeFileSync(certPath, cert.replace(/\r\n?/g, "\n"));
|
|
138
563
|
}
|
|
139
564
|
function parseKeys({
|
|
140
565
|
keyLength,
|
|
@@ -143,22 +568,22 @@ function parseKeys({
|
|
|
143
568
|
subject,
|
|
144
569
|
days
|
|
145
570
|
}) {
|
|
146
|
-
const keysDir =
|
|
571
|
+
const keysDir = path5.dirname(privateKeyPath);
|
|
147
572
|
let privateKey = process.env.UPDATER_PK;
|
|
148
573
|
let cert = process.env.UPDATER_CERT;
|
|
149
574
|
if (privateKey && cert) {
|
|
150
575
|
log.info("Use `UPDATER_PK` and `UPDATER_CERT` from environment variables", { timestamp: true });
|
|
151
576
|
return { privateKey, cert };
|
|
152
577
|
}
|
|
153
|
-
if (!
|
|
154
|
-
|
|
578
|
+
if (!fs5.existsSync(keysDir)) {
|
|
579
|
+
fs5.mkdirSync(keysDir);
|
|
155
580
|
}
|
|
156
|
-
if (!
|
|
581
|
+
if (!fs5.existsSync(privateKeyPath) || !fs5.existsSync(certPath)) {
|
|
157
582
|
log.info("No key pair found, generate new key pair", { timestamp: true });
|
|
158
583
|
generateKeyPair(keyLength, parseSubjects(subject), days, privateKeyPath, certPath);
|
|
159
584
|
}
|
|
160
|
-
privateKey =
|
|
161
|
-
cert =
|
|
585
|
+
privateKey = fs5.readFileSync(privateKeyPath, "utf-8");
|
|
586
|
+
cert = fs5.readFileSync(certPath, "utf-8");
|
|
162
587
|
return { privateKey, cert };
|
|
163
588
|
}
|
|
164
589
|
function parseSubjects(subject) {
|
|
@@ -166,7 +591,7 @@ function parseSubjects(subject) {
|
|
|
166
591
|
}
|
|
167
592
|
|
|
168
593
|
// src/vite/option.ts
|
|
169
|
-
function parseOptions(
|
|
594
|
+
function parseOptions(isBuild, pkg, sourcemap = false, minify = false, options = {}) {
|
|
170
595
|
const {
|
|
171
596
|
minimumVersion = "0.0.0",
|
|
172
597
|
entry: {
|
|
@@ -177,7 +602,13 @@ function parseOptions(pkg, defaultExternal, sourcemap = false, minify = false, o
|
|
|
177
602
|
nativeModuleEntryMap = {},
|
|
178
603
|
postBuild,
|
|
179
604
|
ignoreDynamicRequires = false,
|
|
180
|
-
external
|
|
605
|
+
external = [
|
|
606
|
+
/^node:.*/,
|
|
607
|
+
/.*\.(node|dll|dylib|so)$/,
|
|
608
|
+
"original-fs",
|
|
609
|
+
...builtinModules,
|
|
610
|
+
...isBuild ? [] : Object.keys("dependencies" in pkg ? pkg.dependencies : {})
|
|
611
|
+
],
|
|
181
612
|
overrideViteOptions = {}
|
|
182
613
|
} = {},
|
|
183
614
|
paths: {
|
|
@@ -221,18 +652,7 @@ function parseOptions(pkg, defaultExternal, sourcemap = false, minify = false, o
|
|
|
221
652
|
nativeModuleEntryMap,
|
|
222
653
|
overrideViteOptions,
|
|
223
654
|
ignoreDynamicRequires,
|
|
224
|
-
external
|
|
225
|
-
if (!external) {
|
|
226
|
-
return defaultExternal(source);
|
|
227
|
-
}
|
|
228
|
-
if (typeof external === "string") {
|
|
229
|
-
return source === external;
|
|
230
|
-
}
|
|
231
|
-
if (Array.isArray(external)) {
|
|
232
|
-
return external.includes(source);
|
|
233
|
-
}
|
|
234
|
-
return external(source, importer, isResolved);
|
|
235
|
-
}
|
|
655
|
+
external
|
|
236
656
|
};
|
|
237
657
|
const { privateKey, cert } = parseKeys({
|
|
238
658
|
keyLength,
|
|
@@ -253,13 +673,23 @@ function parseOptions(pkg, defaultExternal, sourcemap = false, minify = false, o
|
|
|
253
673
|
return { buildAsarOption, buildEntryOption, buildVersionOption, postBuild, cert };
|
|
254
674
|
}
|
|
255
675
|
var vite_default = electronWithUpdater;
|
|
256
|
-
var debugStartup = (args) => {
|
|
676
|
+
var debugStartup = async (args) => {
|
|
257
677
|
if (process.env.VSCODE_DEBUG) {
|
|
258
678
|
console.log("[startup] Electron App");
|
|
259
679
|
} else {
|
|
260
|
-
args.startup();
|
|
680
|
+
await args.startup();
|
|
261
681
|
}
|
|
262
682
|
};
|
|
683
|
+
async function filterErrorMessageStartup(args, filter) {
|
|
684
|
+
await args.startup(void 0, { stdio: ["inherit", "inherit", "pipe", "ipc"] });
|
|
685
|
+
const elec = process.electronApp;
|
|
686
|
+
elec.stderr.addListener("data", (data) => {
|
|
687
|
+
const message = data.toString();
|
|
688
|
+
if (filter(message)) {
|
|
689
|
+
console.error(message);
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
}
|
|
263
693
|
function fixWinCharEncoding(fn) {
|
|
264
694
|
return async (...args) => {
|
|
265
695
|
if (process.platform === "win32") {
|
|
@@ -271,9 +701,9 @@ function fixWinCharEncoding(fn) {
|
|
|
271
701
|
function getMainFileBaseName(options) {
|
|
272
702
|
let mainFilePath;
|
|
273
703
|
if (typeof options === "string") {
|
|
274
|
-
mainFilePath =
|
|
704
|
+
mainFilePath = path5.basename(options);
|
|
275
705
|
} else if (Array.isArray(options)) {
|
|
276
|
-
mainFilePath =
|
|
706
|
+
mainFilePath = path5.basename(options[0]);
|
|
277
707
|
} else {
|
|
278
708
|
const name = options?.index ?? options?.main;
|
|
279
709
|
if (!name) {
|
|
@@ -312,36 +742,33 @@ async function electronWithUpdater(options) {
|
|
|
312
742
|
const isESM = pkg.type === "module";
|
|
313
743
|
let bytecodeOptions = typeof bytecode === "object" ? bytecode : bytecode === true ? { enable: true } : void 0;
|
|
314
744
|
if (isESM && bytecodeOptions?.enable) {
|
|
315
|
-
|
|
745
|
+
bytecodeLog.warn(
|
|
316
746
|
'`bytecodePlugin` does not support ES module, please remove "type": "module" in package.json',
|
|
317
747
|
{ timestamp: true }
|
|
318
748
|
);
|
|
319
749
|
bytecodeOptions = void 0;
|
|
320
750
|
}
|
|
321
|
-
const defaultExternal = (src) => {
|
|
322
|
-
return src.startsWith("node:") || Object.keys("dependencies" in pkg ? pkg.dependencies : {}).includes(src) || src === "original-fs";
|
|
323
|
-
};
|
|
324
751
|
const {
|
|
325
752
|
buildAsarOption,
|
|
326
753
|
buildEntryOption,
|
|
327
754
|
buildVersionOption,
|
|
328
755
|
postBuild,
|
|
329
756
|
cert
|
|
330
|
-
} = parseOptions(
|
|
331
|
-
const { entryOutputDirPath, nativeModuleEntryMap, appEntryPath } = buildEntryOption;
|
|
757
|
+
} = parseOptions(isBuild, pkg, sourcemap, minify, updater);
|
|
758
|
+
const { entryOutputDirPath, nativeModuleEntryMap, appEntryPath, external } = buildEntryOption;
|
|
332
759
|
try {
|
|
333
|
-
|
|
334
|
-
|
|
760
|
+
fs5.rmSync(buildAsarOption.electronDistPath, { recursive: true, force: true });
|
|
761
|
+
fs5.rmSync(entryOutputDirPath, { recursive: true, force: true });
|
|
335
762
|
} catch {
|
|
336
763
|
}
|
|
337
764
|
log.info(`Clear cache files`, { timestamp: true });
|
|
338
765
|
sourcemap ??= isBuild || !!process.env.VSCODE_DEBUG;
|
|
339
|
-
const _appPath = normalizePath(
|
|
340
|
-
if (
|
|
766
|
+
const _appPath = normalizePath(path5.join(entryOutputDirPath, "entry.js"));
|
|
767
|
+
if (path5.resolve(normalizePath(pkg.main)) !== path5.resolve(_appPath)) {
|
|
341
768
|
throw new Error(`Wrong "main" field in package.json: "${pkg.main}", it should be "${_appPath}"`);
|
|
342
769
|
}
|
|
343
770
|
const define = {
|
|
344
|
-
__EIU_ASAR_BASE_NAME__: JSON.stringify(
|
|
771
|
+
__EIU_ASAR_BASE_NAME__: JSON.stringify(path5.basename(buildAsarOption.asarOutputPath)),
|
|
345
772
|
__EIU_ELECTRON_DIST_PATH__: JSON.stringify(normalizePath(buildAsarOption.electronDistPath)),
|
|
346
773
|
__EIU_ENTRY_DIST_PATH__: JSON.stringify(normalizePath(buildEntryOption.entryOutputDirPath)),
|
|
347
774
|
__EIU_IS_DEV__: JSON.stringify(!isBuild),
|
|
@@ -360,35 +787,34 @@ async function electronWithUpdater(options) {
|
|
|
360
787
|
log.info(`Build entry to '${entryOutputDirPath}'`, { timestamp: true });
|
|
361
788
|
await postBuild?.({
|
|
362
789
|
getPathFromEntryOutputDir(...paths) {
|
|
363
|
-
return
|
|
790
|
+
return path5.join(entryOutputDirPath, ...paths);
|
|
364
791
|
},
|
|
365
792
|
copyToEntryOutputDir({ from, to, skipIfExist = true }) {
|
|
366
|
-
if (!
|
|
793
|
+
if (!fs5.existsSync(from)) {
|
|
367
794
|
log.warn(`${from} not found`, { timestamp: true });
|
|
368
795
|
return;
|
|
369
796
|
}
|
|
370
|
-
const target =
|
|
797
|
+
const target = path5.join(entryOutputDirPath, to ?? path5.basename(from));
|
|
371
798
|
copyAndSkipIfExist(from, target, skipIfExist);
|
|
372
799
|
},
|
|
373
800
|
copyModules({ modules, skipIfExist = true }) {
|
|
374
|
-
const nodeModulesPath =
|
|
801
|
+
const nodeModulesPath = path5.join(entryOutputDirPath, "node_modules");
|
|
375
802
|
for (const m of modules) {
|
|
376
803
|
const { rootPath } = getPackageInfoSync(m) || {};
|
|
377
804
|
if (!rootPath) {
|
|
378
805
|
log.warn(`Package '${m}' not found`, { timestamp: true });
|
|
379
806
|
continue;
|
|
380
807
|
}
|
|
381
|
-
copyAndSkipIfExist(rootPath,
|
|
808
|
+
copyAndSkipIfExist(rootPath, path5.join(nodeModulesPath, m), skipIfExist);
|
|
382
809
|
}
|
|
383
810
|
}
|
|
384
811
|
});
|
|
385
812
|
}
|
|
386
813
|
let isInit = false;
|
|
387
814
|
const rollupOptions = {
|
|
388
|
-
external
|
|
815
|
+
external,
|
|
389
816
|
treeshake: true
|
|
390
817
|
};
|
|
391
|
-
const esmShimPlugin = isESM ? import('./esm-4S4XCVEW.js').then((m) => m.esm()) : void 0;
|
|
392
818
|
const electronPluginOptions = {
|
|
393
819
|
main: {
|
|
394
820
|
entry: _main.files,
|
|
@@ -398,17 +824,17 @@ async function electronWithUpdater(options) {
|
|
|
398
824
|
await _buildEntry();
|
|
399
825
|
}
|
|
400
826
|
if (_main.onstart) {
|
|
401
|
-
_main.onstart(args);
|
|
827
|
+
await _main.onstart(args);
|
|
402
828
|
} else {
|
|
403
|
-
args.startup();
|
|
829
|
+
await args.startup();
|
|
404
830
|
}
|
|
405
831
|
},
|
|
406
832
|
vite: mergeConfig(
|
|
407
833
|
{
|
|
408
834
|
plugins: [
|
|
409
|
-
!isBuild && useNotBundle
|
|
410
|
-
bytecodeOptions &&
|
|
411
|
-
|
|
835
|
+
!isBuild && useNotBundle && notBundle(),
|
|
836
|
+
bytecodeOptions && bytecodePlugin("main", bytecodeOptions),
|
|
837
|
+
isESM && esm()
|
|
412
838
|
],
|
|
413
839
|
build: {
|
|
414
840
|
sourcemap,
|
|
@@ -427,8 +853,8 @@ async function electronWithUpdater(options) {
|
|
|
427
853
|
vite: mergeConfig(
|
|
428
854
|
{
|
|
429
855
|
plugins: [
|
|
430
|
-
bytecodeOptions &&
|
|
431
|
-
|
|
856
|
+
bytecodeOptions && bytecodePlugin("preload", bytecodeOptions),
|
|
857
|
+
isESM && esm(),
|
|
432
858
|
{
|
|
433
859
|
name: `${id}-build`,
|
|
434
860
|
enforce: "post",
|
|
@@ -459,25 +885,26 @@ async function electronWithUpdater(options) {
|
|
|
459
885
|
}
|
|
460
886
|
};
|
|
461
887
|
if (logParsedOptions) {
|
|
888
|
+
const shouldShowKey = typeof logParsedOptions === "object" && logParsedOptions.showKeys === true;
|
|
462
889
|
log.info(
|
|
463
890
|
JSON.stringify(
|
|
464
891
|
{
|
|
465
892
|
...electronPluginOptions,
|
|
466
893
|
updater: { buildAsarOption, buildEntryOption, buildVersionOption }
|
|
467
894
|
},
|
|
468
|
-
(key, value) =>
|
|
895
|
+
(key, value) => (key === "privateKey" || key === "cert") && shouldShowKey ? value : `<${key.toUpperCase()}>`,
|
|
469
896
|
2
|
|
470
897
|
),
|
|
471
898
|
{ timestamp: true }
|
|
472
899
|
);
|
|
473
900
|
}
|
|
474
|
-
|
|
901
|
+
const result = [ElectronSimple(electronPluginOptions)];
|
|
475
902
|
if (nativeModuleEntryMap) {
|
|
476
903
|
const files = [
|
|
477
904
|
...Object.values(nativeModuleEntryMap),
|
|
478
905
|
appEntryPath
|
|
479
|
-
].map((file) =>
|
|
480
|
-
|
|
906
|
+
].map((file) => path5.resolve(normalizePath(file)));
|
|
907
|
+
result.push({
|
|
481
908
|
name: `${id}-dev`,
|
|
482
909
|
apply() {
|
|
483
910
|
return !isBuild;
|
|
@@ -508,9 +935,9 @@ async function electronWithUpdater(options) {
|
|
|
508
935
|
}
|
|
509
936
|
);
|
|
510
937
|
}
|
|
511
|
-
};
|
|
938
|
+
});
|
|
512
939
|
}
|
|
513
|
-
return
|
|
940
|
+
return result;
|
|
514
941
|
}
|
|
515
942
|
|
|
516
|
-
export { debugStartup, vite_default as default, electronWithUpdater, fixWinCharEncoding };
|
|
943
|
+
export { convertLiteral, debugStartup, vite_default as default, electronWithUpdater, filterErrorMessageStartup, fixWinCharEncoding };
|