electron-incremental-update 2.2.1 → 2.2.2

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/provider.js CHANGED
@@ -1,8 +1,24 @@
1
- import { defaultVerifySignature, defaultUnzipFile } from './chunk-PUVBFHOK.js';
2
- import { isUpdateJSON, defaultIsLowerVersion } from './chunk-AAAM44NW.js';
3
- import { URL } from 'node:url';
1
+ import { defaultVerifySignature, defaultUnzipFile } from './chunk-XGWQQVIZ.js';
2
+ import { defaultIsLowerVersion, isUpdateJSON } from './chunk-AAAM44NW.js';
4
3
  import electron from 'electron';
4
+ import { URL } from 'node:url';
5
5
 
6
+ // src/provider/base.ts
7
+ var BaseProvider = class {
8
+ name = "BaseProvider";
9
+ /**
10
+ * @inheritdoc
11
+ */
12
+ isLowerVersion = defaultIsLowerVersion;
13
+ /**
14
+ * @inheritdoc
15
+ */
16
+ verifySignaure = defaultVerifySignature;
17
+ /**
18
+ * @inheritdoc
19
+ */
20
+ unzipFile = defaultUnzipFile;
21
+ };
6
22
  function getHeader(headers, key) {
7
23
  const value = headers[key];
8
24
  if (Array.isArray(value)) {
@@ -94,25 +110,6 @@ async function defaultDownloadAsar(url, headers, signal, onDownloading) {
94
110
  }
95
111
  );
96
112
  }
97
-
98
- // src/provider/base.ts
99
- var BaseProvider = class {
100
- name = "BaseProvider";
101
- /**
102
- * @inheritdoc
103
- */
104
- isLowerVersion = defaultIsLowerVersion;
105
- /**
106
- * @inheritdoc
107
- */
108
- verifySignaure = defaultVerifySignature;
109
- /**
110
- * @inheritdoc
111
- */
112
- unzipFile = defaultUnzipFile;
113
- };
114
-
115
- // src/provider/github.ts
116
113
  var GitHubProvider = class extends BaseProvider {
117
114
  name = "GithubProvider";
118
115
  options;
@@ -1,5 +1,6 @@
1
1
  import { Promisable } from '@subframe7536/type-utils';
2
- import { U as UpdateInfo } from './version-BYVQ367i.cjs';
2
+ import { URL } from 'node:url';
3
+ import { U as UpdateInfo } from './version-Bl_0oO5f.js';
3
4
 
4
5
  type UpdateInfoWithURL = UpdateInfo & {
5
6
  url: string;
@@ -34,7 +35,7 @@ interface DownloadingInfo {
34
35
  type UpdateJSONWithURL = UpdateInfoWithURL & {
35
36
  beta: UpdateInfoWithURL;
36
37
  };
37
- interface IProvider {
38
+ interface IProvider<T extends UpdateInfoWithURL = UpdateInfoWithURL> {
38
39
  /**
39
40
  * Provider name
40
41
  */
@@ -45,7 +46,7 @@ interface IProvider {
45
46
  * @param versionPath normalized version path in project
46
47
  * @param signal abort signal
47
48
  */
48
- downloadJSON: (name: string, versionPath: string, signal: AbortSignal) => Promise<UpdateJSONWithURL>;
49
+ downloadJSON: (name: string, versionPath: string, signal: AbortSignal) => Promise<T>;
49
50
  /**
50
51
  * Download update asar
51
52
  * @param updateInfo existing update info
@@ -1,5 +1,6 @@
1
1
  import { Promisable } from '@subframe7536/type-utils';
2
- import { U as UpdateInfo } from './version-BYVQ367i.js';
2
+ import { URL } from 'node:url';
3
+ import { U as UpdateInfo } from './version-Bl_0oO5f.cjs';
3
4
 
4
5
  type UpdateInfoWithURL = UpdateInfo & {
5
6
  url: string;
@@ -34,7 +35,7 @@ interface DownloadingInfo {
34
35
  type UpdateJSONWithURL = UpdateInfoWithURL & {
35
36
  beta: UpdateInfoWithURL;
36
37
  };
37
- interface IProvider {
38
+ interface IProvider<T extends UpdateInfoWithURL = UpdateInfoWithURL> {
38
39
  /**
39
40
  * Provider name
40
41
  */
@@ -45,7 +46,7 @@ interface IProvider {
45
46
  * @param versionPath normalized version path in project
46
47
  * @param signal abort signal
47
48
  */
48
- downloadJSON: (name: string, versionPath: string, signal: AbortSignal) => Promise<UpdateJSONWithURL>;
49
+ downloadJSON: (name: string, versionPath: string, signal: AbortSignal) => Promise<T>;
49
50
  /**
50
51
  * Download update asar
51
52
  * @param updateInfo existing update info
package/dist/utils.cjs CHANGED
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
 
3
+ var crypto = require('crypto');
3
4
  var fs = require('fs');
4
5
  var path = require('path');
5
6
  var electron = require('electron');
6
7
  var zlib = require('zlib');
7
- var crypto = require('crypto');
8
8
 
9
9
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
10
 
11
+ var crypto__default = /*#__PURE__*/_interopDefault(crypto);
11
12
  var fs__default = /*#__PURE__*/_interopDefault(fs);
12
13
  var path__default = /*#__PURE__*/_interopDefault(path);
13
14
  var electron__default = /*#__PURE__*/_interopDefault(electron);
14
15
  var zlib__default = /*#__PURE__*/_interopDefault(zlib);
15
- var crypto__default = /*#__PURE__*/_interopDefault(crypto);
16
16
 
17
17
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
18
18
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
@@ -20,6 +20,33 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
20
20
  if (typeof require !== "undefined") return require.apply(this, arguments);
21
21
  throw Error('Dynamic require of "' + x + '" is not supported');
22
22
  });
23
+ function hashBuffer(data, length) {
24
+ const hash = crypto__default.default.createHash("SHA256").update(data).digest("binary");
25
+ return Buffer.from(hash).subarray(0, length);
26
+ }
27
+ function aesEncrypt(plainText, key, iv) {
28
+ const cipher = crypto__default.default.createCipheriv("aes-256-cbc", key, iv);
29
+ return cipher.update(plainText, "utf8", "base64url") + cipher.final("base64url");
30
+ }
31
+ function defaultSignature(buffer, privateKey, cert, version) {
32
+ const sig = crypto__default.default.createSign("RSA-SHA256").update(buffer).sign(crypto__default.default.createPrivateKey(privateKey), "base64");
33
+ return aesEncrypt(`${sig}%${version}`, hashBuffer(cert, 32), hashBuffer(buffer, 16));
34
+ }
35
+ function aesDecrypt(encryptedText, key, iv) {
36
+ const decipher = crypto__default.default.createDecipheriv("aes-256-cbc", key, iv);
37
+ return decipher.update(encryptedText, "base64url", "utf8") + decipher.final("utf8");
38
+ }
39
+ function defaultVerifySignature(buffer, version, signature, cert) {
40
+ try {
41
+ const [sig, ver] = aesDecrypt(signature, hashBuffer(cert, 32), hashBuffer(buffer, 16)).split("%");
42
+ if (ver !== version) {
43
+ return false;
44
+ }
45
+ return crypto__default.default.createVerify("RSA-SHA256").update(buffer).verify(cert, sig, "base64");
46
+ } catch {
47
+ return false;
48
+ }
49
+ }
23
50
  var isDev = __EIU_IS_DEV__;
24
51
  var isWin = process.platform === "win32";
25
52
  var isMac = process.platform === "darwin";
@@ -113,16 +140,6 @@ function handleUnexpectedErrors(callback) {
113
140
  process.on("uncaughtException", callback);
114
141
  process.on("unhandledRejection", callback);
115
142
  }
116
- async function defaultZipFile(buffer) {
117
- return new Promise((resolve, reject) => {
118
- zlib__default.default.brotliCompress(buffer, (err, buffer2) => err ? reject(err) : resolve(buffer2));
119
- });
120
- }
121
- async function defaultUnzipFile(buffer) {
122
- return new Promise((resolve, reject) => {
123
- zlib__default.default.brotliDecompress(buffer, (err, buffer2) => err ? reject(err) : resolve(buffer2));
124
- });
125
- }
126
143
 
127
144
  // src/utils/version.ts
128
145
  function parseVersion(version) {
@@ -185,32 +202,15 @@ function defaultVersionJsonGenerator(existingJson, signature, version, minimumVe
185
202
  }
186
203
  return existingJson;
187
204
  }
188
- function hashBuffer(data, length) {
189
- const hash = crypto__default.default.createHash("SHA256").update(data).digest("binary");
190
- return Buffer.from(hash).subarray(0, length);
191
- }
192
- function aesEncrypt(plainText, key, iv) {
193
- const cipher = crypto__default.default.createCipheriv("aes-256-cbc", key, iv);
194
- return cipher.update(plainText, "utf8", "base64url") + cipher.final("base64url");
195
- }
196
- function defaultSignature(buffer, privateKey, cert, version) {
197
- const sig = crypto__default.default.createSign("RSA-SHA256").update(buffer).sign(crypto__default.default.createPrivateKey(privateKey), "base64");
198
- return aesEncrypt(`${sig}%${version}`, hashBuffer(cert, 32), hashBuffer(buffer, 16));
199
- }
200
- function aesDecrypt(encryptedText, key, iv) {
201
- const decipher = crypto__default.default.createDecipheriv("aes-256-cbc", key, iv);
202
- return decipher.update(encryptedText, "base64url", "utf8") + decipher.final("utf8");
205
+ async function defaultZipFile(buffer) {
206
+ return new Promise((resolve, reject) => {
207
+ zlib__default.default.brotliCompress(buffer, (err, buffer2) => err ? reject(err) : resolve(buffer2));
208
+ });
203
209
  }
204
- function defaultVerifySignature(buffer, version, signature, cert) {
205
- try {
206
- const [sig, ver] = aesDecrypt(signature, hashBuffer(cert, 32), hashBuffer(buffer, 16)).split("%");
207
- if (ver !== version) {
208
- return false;
209
- }
210
- return crypto__default.default.createVerify("RSA-SHA256").update(buffer).verify(cert, sig, "base64");
211
- } catch {
212
- return false;
213
- }
210
+ async function defaultUnzipFile(buffer) {
211
+ return new Promise((resolve, reject) => {
212
+ zlib__default.default.brotliDecompress(buffer, (err, buffer2) => err ? reject(err) : resolve(buffer2));
213
+ });
214
214
  }
215
215
 
216
216
  exports.aesDecrypt = aesDecrypt;
package/dist/utils.d.cts CHANGED
@@ -1,6 +1,6 @@
1
+ export { b as aesDecrypt, a as aesEncrypt, d as defaultSignature, f as defaultUnzipFile, c as defaultVerifySignature, e as defaultZipFile, h as hashBuffer } from './zip-DQdr8pFv.cjs';
1
2
  import { BrowserWindow } from 'electron';
2
- export { e as aesDecrypt, b as aesEncrypt, c as defaultSignature, a as defaultUnzipFile, f as defaultVerifySignature, d as defaultZipFile, h as hashBuffer } from './crypto-Zynscwmj.cjs';
3
- export { U as UpdateInfo, a as UpdateJSON, V as Version, d as defaultIsLowerVersion, b as defaultVersionJsonGenerator, i as isUpdateJSON, p as parseVersion } from './version-BYVQ367i.cjs';
3
+ export { U as UpdateInfo, a as UpdateJSON, V as Version, d as defaultIsLowerVersion, b as defaultVersionJsonGenerator, i as isUpdateJSON, p as parseVersion } from './version-Bl_0oO5f.cjs';
4
4
 
5
5
  /**
6
6
  * Compile time dev check
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ export { b as aesDecrypt, a as aesEncrypt, d as defaultSignature, f as defaultUnzipFile, c as defaultVerifySignature, e as defaultZipFile, h as hashBuffer } from './zip-DQdr8pFv.js';
1
2
  import { BrowserWindow } from 'electron';
2
- export { e as aesDecrypt, b as aesEncrypt, c as defaultSignature, a as defaultUnzipFile, f as defaultVerifySignature, d as defaultZipFile, h as hashBuffer } from './crypto-Zynscwmj.js';
3
- export { U as UpdateInfo, a as UpdateJSON, V as Version, d as defaultIsLowerVersion, b as defaultVersionJsonGenerator, i as isUpdateJSON, p as parseVersion } from './version-BYVQ367i.js';
3
+ export { U as UpdateInfo, a as UpdateJSON, V as Version, d as defaultIsLowerVersion, b as defaultVersionJsonGenerator, i as isUpdateJSON, p as parseVersion } from './version-Bl_0oO5f.js';
4
4
 
5
5
  /**
6
6
  * Compile time dev check
package/dist/utils.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, singleInstance } from './chunk-JI27JWJN.js';
2
- export { aesDecrypt, aesEncrypt, defaultSignature, defaultUnzipFile, defaultVerifySignature, defaultZipFile, hashBuffer } from './chunk-PUVBFHOK.js';
2
+ export { aesDecrypt, aesEncrypt, defaultSignature, defaultUnzipFile, defaultVerifySignature, defaultZipFile, hashBuffer } from './chunk-XGWQQVIZ.js';
3
3
  export { defaultIsLowerVersion, defaultVersionJsonGenerator, isUpdateJSON, parseVersion } from './chunk-AAAM44NW.js';
@@ -35,14 +35,26 @@ declare function defaultIsLowerVersion(oldVer: string, newVer: string): boolean;
35
35
  * Update info json
36
36
  */
37
37
  type UpdateInfo = {
38
+ /**
39
+ * Update Asar signature
40
+ */
38
41
  signature: string;
42
+ /**
43
+ * Minimum version
44
+ */
39
45
  minimumVersion: string;
46
+ /**
47
+ * Target version
48
+ */
40
49
  version: string;
41
50
  };
42
51
  /**
43
52
  * {@link UpdateInfo} with beta
44
53
  */
45
54
  type UpdateJSON = UpdateInfo & {
55
+ /**
56
+ * Beta update info
57
+ */
46
58
  beta: UpdateInfo;
47
59
  };
48
60
  /**
@@ -35,14 +35,26 @@ declare function defaultIsLowerVersion(oldVer: string, newVer: string): boolean;
35
35
  * Update info json
36
36
  */
37
37
  type UpdateInfo = {
38
+ /**
39
+ * Update Asar signature
40
+ */
38
41
  signature: string;
42
+ /**
43
+ * Minimum version
44
+ */
39
45
  minimumVersion: string;
46
+ /**
47
+ * Target version
48
+ */
40
49
  version: string;
41
50
  };
42
51
  /**
43
52
  * {@link UpdateInfo} with beta
44
53
  */
45
54
  type UpdateJSON = UpdateInfo & {
55
+ /**
56
+ * Beta update info
57
+ */
46
58
  beta: UpdateInfo;
47
59
  };
48
60
  /**
package/dist/vite.d.ts CHANGED
@@ -4,18 +4,48 @@ import { Promisable } from '@subframe7536/type-utils';
4
4
  export { isCI } from 'ci-info';
5
5
  export { getPackageInfo, getPackageInfoSync, loadPackageJSON, resolveModule } from 'local-pkg';
6
6
 
7
+ interface BytecodeOptions {
8
+ enable: boolean;
9
+ /**
10
+ * Enable in preload script. Remember to set `sandbox: false` when creating window
11
+ */
12
+ preload?: boolean;
13
+ /**
14
+ * Custom electron binary path
15
+ */
16
+ electronPath?: string;
17
+ /**
18
+ * Before transformed code compile function. If return `Falsy` value, it will be ignored
19
+ * @param code transformed code
20
+ * @param id file path
21
+ */
22
+ beforeCompile?: (code: string, id: string) => Promisable<string | null | undefined | void>;
23
+ }
24
+
7
25
  /**
8
26
  * Update info json
9
27
  */
10
28
  type UpdateInfo = {
29
+ /**
30
+ * Update Asar signature
31
+ */
11
32
  signature: string;
33
+ /**
34
+ * Minimum version
35
+ */
12
36
  minimumVersion: string;
37
+ /**
38
+ * Target version
39
+ */
13
40
  version: string;
14
41
  };
15
42
  /**
16
43
  * {@link UpdateInfo} with beta
17
44
  */
18
45
  type UpdateJSON = UpdateInfo & {
46
+ /**
47
+ * Beta update info
48
+ */
19
49
  beta: UpdateInfo;
20
50
  };
21
51
 
@@ -248,24 +278,6 @@ interface ElectronUpdaterOptions {
248
278
  overrideGenerator?: GeneratorOverrideFunctions;
249
279
  }
250
280
 
251
- interface BytecodeOptions {
252
- enable: boolean;
253
- /**
254
- * Enable in preload script. Remember to set `sandbox: false` when creating window
255
- */
256
- preload?: boolean;
257
- /**
258
- * Custom electron binary path
259
- */
260
- electronPath?: string;
261
- /**
262
- * Before transformed code compile function. If return `Falsy` value, it will be ignored
263
- * @param code transformed code
264
- * @param id file path
265
- */
266
- beforeCompile?: (code: string, id: string) => Promisable<string | null | undefined | void>;
267
- }
268
-
269
281
  /**
270
282
  * Obfuscate string
271
283
  * @param code source code
@@ -284,8 +296,9 @@ type ReplaceKey<T, Key extends keyof T, NewKey extends string> = Omit<T, Key> &
284
296
  [P in NewKey]: T[Key];
285
297
  };
286
298
  type MakeRequiredAndReplaceKey<T, K extends keyof T, NewKey extends string> = MakeRequired<ReplaceKey<T, K, NewKey>, NewKey>;
299
+ type StartupFn = Exclude<Exclude<ElectronSimpleOptions['preload'], undefined>['onstart'], undefined>;
287
300
  /**
288
- * startup function for debug (see {@link https://github.com/electron-vite/electron-vite-vue/blob/main/vite.config.ts electron-vite-vue template})
301
+ * Startup function for debug (see {@link https://github.com/electron-vite/electron-vite-vue/blob/main/vite.config.ts electron-vite-vue template})
289
302
  * @example
290
303
  * import { debugStartup, buildElectronPluginOptions } from 'electron-incremental-update/vite'
291
304
  * const options = buildElectronPluginOptions({
@@ -296,10 +309,20 @@ type MakeRequiredAndReplaceKey<T, K extends keyof T, NewKey extends string> = Ma
296
309
  * },
297
310
  * })
298
311
  */
299
- declare function debugStartup(args: {
300
- startup: (argv?: string[]) => Promise<void>;
301
- reload: () => void;
302
- }): void;
312
+ declare const debugStartup: StartupFn;
313
+ /**
314
+ * Startup function util to fix Windows terminal charset
315
+ * @example
316
+ * import { debugStartup, fixWinCharEncoding, buildElectronPluginOptions } from 'electron-incremental-update/vite'
317
+ * const options = buildElectronPluginOptions({
318
+ * // ...
319
+ * main: {
320
+ * // ...
321
+ * startup: fixWinCharEncoding(debugStartup)
322
+ * },
323
+ * })
324
+ */
325
+ declare function fixWinCharEncoding(fn: StartupFn): StartupFn;
303
326
  type ExcludeOutputDirOptions = {
304
327
  vite?: {
305
328
  build?: {
@@ -432,4 +455,4 @@ interface ElectronWithUpdaterOptions {
432
455
  */
433
456
  declare function electronWithUpdater(options: ElectronWithUpdaterOptions): Promise<PluginOption[] | undefined>;
434
457
 
435
- export { type ElectronWithUpdaterOptions, convertLiteral, debugStartup, electronWithUpdater as default, electronWithUpdater };
458
+ export { type ElectronWithUpdaterOptions, convertLiteral, debugStartup, electronWithUpdater as default, electronWithUpdater, fixWinCharEncoding };
package/dist/vite.js CHANGED
@@ -1,20 +1,20 @@
1
1
  import { readableSize, copyAndSkipIfExist } from './chunk-TPTWE33H.js';
2
- import { isUpdateJSON, defaultVersionJsonGenerator } from './chunk-7JCGLFGU.js';
3
- export { convertLiteral } from './chunk-7JCGLFGU.js';
2
+ import { isUpdateJSON, defaultVersionJsonGenerator } from './chunk-LR7LR5WG.js';
3
+ export { convertLiteral } from './chunk-LR7LR5WG.js';
4
4
  import { log, id } from './chunk-5NKEXGI3.js';
5
- import path3 from 'node:path';
6
5
  import fs2 from 'node:fs';
6
+ import path3 from 'node:path';
7
+ import { isCI } from 'ci-info';
8
+ export { isCI } from 'ci-info';
7
9
  import { loadPackageJSON, getPackageInfoSync } from 'local-pkg';
8
10
  export { getPackageInfo, getPackageInfoSync, loadPackageJSON, resolveModule } from 'local-pkg';
9
11
  import { normalizePath, mergeConfig } from 'vite';
10
- import ElectronSimple from 'vite-plugin-electron/simple';
11
12
  import { startup, build } from 'vite-plugin-electron';
12
13
  import { notBundle } from 'vite-plugin-electron/plugin';
13
- import { isCI } from 'ci-info';
14
- export { isCI } from 'ci-info';
14
+ import ElectronSimple from 'vite-plugin-electron/simple';
15
15
  import Asar from '@electron/asar';
16
- import zlib from 'node:zlib';
17
16
  import crypto from 'node:crypto';
17
+ import zlib from 'node:zlib';
18
18
  import { generate } from 'selfsigned';
19
19
 
20
20
  async function buildAsar({
@@ -88,8 +88,8 @@ async function buildEntry({
88
88
  },
89
89
  vite: mergeConfig({
90
90
  plugins: [
91
- isESM && await import('./esm-UJAQJA65.js').then((m) => m.esm()),
92
- bytecodeOptions && await import('./bytecode-7V24FFYI.js').then((m) => m.bytecodePlugin("main", bytecodeOptions))
91
+ isESM && await import('./esm-4S4XCVEW.js').then((m) => m.esm()),
92
+ bytecodeOptions && await import('./bytecode-R2B4KTMV.js').then((m) => m.bytecodePlugin("main", bytecodeOptions))
93
93
  ],
94
94
  build: {
95
95
  sourcemap,
@@ -102,11 +102,6 @@ async function buildEntry({
102
102
  }, overrideViteOptions ?? {})
103
103
  });
104
104
  }
105
- async function defaultZipFile(buffer) {
106
- return new Promise((resolve, reject) => {
107
- zlib.brotliCompress(buffer, (err, buffer2) => err ? reject(err) : resolve(buffer2));
108
- });
109
- }
110
105
  function hashBuffer(data, length) {
111
106
  const hash = crypto.createHash("SHA256").update(data).digest("binary");
112
107
  return Buffer.from(hash).subarray(0, length);
@@ -119,6 +114,11 @@ function defaultSignature(buffer, privateKey, cert, version) {
119
114
  const sig = crypto.createSign("RSA-SHA256").update(buffer).sign(crypto.createPrivateKey(privateKey), "base64");
120
115
  return aesEncrypt(`${sig}%${version}`, hashBuffer(cert, 32), hashBuffer(buffer, 16));
121
116
  }
117
+ async function defaultZipFile(buffer) {
118
+ return new Promise((resolve, reject) => {
119
+ zlib.brotliCompress(buffer, (err, buffer2) => err ? reject(err) : resolve(buffer2));
120
+ });
121
+ }
122
122
  function generateKeyPair(keyLength, subject, days, privateKeyPath, certPath) {
123
123
  const privateKeyDir = path3.dirname(privateKeyPath);
124
124
  if (!fs2.existsSync(privateKeyDir)) {
@@ -255,12 +255,20 @@ function parseOptions(pkg, sourcemap = false, minify = false, options = {}) {
255
255
  };
256
256
  return { buildAsarOption, buildEntryOption, buildVersionOption, postBuild, cert };
257
257
  }
258
- function debugStartup(args) {
258
+ var debugStartup = (args) => {
259
259
  if (process.env.VSCODE_DEBUG) {
260
260
  console.log("[startup] Electron App");
261
261
  } else {
262
262
  args.startup();
263
263
  }
264
+ };
265
+ function fixWinCharEncoding(fn) {
266
+ return async (...args) => {
267
+ if (process.platform === "win32") {
268
+ (await import('node:child_process')).spawnSync("chcp", ["65001"]);
269
+ }
270
+ await fn(...args);
271
+ };
264
272
  }
265
273
  function getMainFileBaseName(options) {
266
274
  let mainFilePath;
@@ -332,6 +340,7 @@ async function electronWithUpdater(options) {
332
340
  throw new Error(`Wrong "main" field in package.json: "${pkg.main}", it should be "${_appPath}"`);
333
341
  }
334
342
  const define = {
343
+ __EIU_ASAR_BASE_NAME__: JSON.stringify(path3.basename(buildAsarOption.asarOutputPath)),
335
344
  __EIU_ELECTRON_DIST_PATH__: JSON.stringify(normalizePath(buildAsarOption.electronDistPath)),
336
345
  __EIU_ENTRY_DIST_PATH__: JSON.stringify(normalizePath(buildEntryOption.entryOutputDirPath)),
337
346
  __EIU_IS_DEV__: JSON.stringify(!isBuild),
@@ -379,7 +388,7 @@ async function electronWithUpdater(options) {
379
388
  external: (src) => src.startsWith("node:") || Object.keys("dependencies" in pkg ? pkg.dependencies : {}).includes(src) || src === "original-fs",
380
389
  treeshake: true
381
390
  };
382
- const esmShimPlugin = isESM ? (await import('./esm-UJAQJA65.js')).esm() : void 0;
391
+ const esmShimPlugin = isESM ? (await import('./esm-4S4XCVEW.js')).esm() : void 0;
383
392
  const electronPluginOptions = {
384
393
  main: {
385
394
  entry: _main.files,
@@ -399,7 +408,7 @@ async function electronWithUpdater(options) {
399
408
  {
400
409
  plugins: [
401
410
  !isBuild && useNotBundle ? notBundle() : void 0,
402
- bytecodeOptions && await import('./bytecode-7V24FFYI.js').then((m) => m.bytecodePlugin("main", bytecodeOptions)),
411
+ bytecodeOptions && await import('./bytecode-R2B4KTMV.js').then((m) => m.bytecodePlugin("main", bytecodeOptions)),
403
412
  esmShimPlugin
404
413
  ],
405
414
  build: {
@@ -419,7 +428,7 @@ async function electronWithUpdater(options) {
419
428
  vite: mergeConfig(
420
429
  {
421
430
  plugins: [
422
- bytecodeOptions && (await import('./bytecode-7V24FFYI.js')).bytecodePlugin("preload", bytecodeOptions),
431
+ bytecodeOptions && (await import('./bytecode-R2B4KTMV.js')).bytecodePlugin("preload", bytecodeOptions),
423
432
  esmShimPlugin,
424
433
  {
425
434
  name: `${id}-build`,
@@ -491,4 +500,4 @@ async function electronWithUpdater(options) {
491
500
  }
492
501
  var vite_default = electronWithUpdater;
493
502
 
494
- export { debugStartup, vite_default as default, electronWithUpdater };
503
+ export { debugStartup, vite_default as default, electronWithUpdater, fixWinCharEncoding };
@@ -1,14 +1,3 @@
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
-
12
1
  declare function hashBuffer(data: string | Buffer, length: number): Buffer;
13
2
  declare function aesEncrypt(plainText: string, key: Buffer, iv: Buffer): string;
14
3
  /**
@@ -30,4 +19,15 @@ declare function aesDecrypt(encryptedText: string, key: Buffer, iv: Buffer): str
30
19
  */
31
20
  declare function defaultVerifySignature(buffer: Buffer, version: string, signature: string, cert: string): boolean;
32
21
 
33
- export { defaultUnzipFile as a, aesEncrypt as b, defaultSignature as c, defaultZipFile as d, aesDecrypt as e, defaultVerifySignature as f, hashBuffer as h };
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
+ export { aesEncrypt as a, aesDecrypt as b, defaultVerifySignature as c, defaultSignature as d, defaultZipFile as e, defaultUnzipFile as f, hashBuffer as h };
@@ -1,14 +1,3 @@
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
-
12
1
  declare function hashBuffer(data: string | Buffer, length: number): Buffer;
13
2
  declare function aesEncrypt(plainText: string, key: Buffer, iv: Buffer): string;
14
3
  /**
@@ -30,4 +19,15 @@ declare function aesDecrypt(encryptedText: string, key: Buffer, iv: Buffer): str
30
19
  */
31
20
  declare function defaultVerifySignature(buffer: Buffer, version: string, signature: string, cert: string): boolean;
32
21
 
33
- export { defaultUnzipFile as a, aesEncrypt as b, defaultSignature as c, defaultZipFile as d, aesDecrypt as e, defaultVerifySignature as f, hashBuffer as h };
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
+ export { aesEncrypt as a, aesDecrypt as b, defaultVerifySignature as c, defaultSignature as d, defaultZipFile as e, defaultUnzipFile as f, hashBuffer as h };