electron-incremental-update 2.3.5 → 2.3.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/README.md CHANGED
@@ -433,12 +433,13 @@ function disableHWAccForWin7(): void
433
433
  */
434
434
  function singleInstance(window?: BrowserWindow): void
435
435
  /**
436
- * Set `AppData` dir to the dir of .exe file
436
+ * Set `userData` dir to the dir of .exe file
437
437
  *
438
438
  * Useful for portable Windows app
439
439
  * @param dirName dir name, default to `data`
440
+ * @param create whether to create dir, default to `true`
440
441
  */
441
- function setPortableAppDataPath(dirName?: string): void
442
+ function setPortableDataPath(dirName?: string, create?: boolean): void
442
443
  /**
443
444
  * Load `process.env.VITE_DEV_SERVER_URL` when dev, else load html file
444
445
  * @param win window
@@ -1,6 +1,6 @@
1
1
  import { __require } from './chunk-AAAM44NW.js';
2
- import fs from 'node:fs';
3
- import path from 'node:path';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
4
  import electron from 'electron';
5
5
 
6
6
  var isDev = __EIU_IS_DEV__;
@@ -40,7 +40,7 @@ function setAppUserModelId(id) {
40
40
  }
41
41
  }
42
42
  function disableHWAccForWin7() {
43
- if (!__EIU_IS_ESM__ && __require("node:os").release().startsWith("6.1")) {
43
+ if (!__EIU_IS_ESM__ && __require("os").release().startsWith("6.1")) {
44
44
  electron.app.disableHardwareAcceleration();
45
45
  }
46
46
  }
@@ -55,13 +55,24 @@ function singleInstance(window) {
55
55
  }
56
56
  });
57
57
  }
58
- function setPortableAppDataPath(dirName = "data") {
59
- const portablePath = path.join(path.dirname(electron.app.getPath("exe")), dirName);
60
- if (!fs.existsSync(portablePath)) {
61
- fs.mkdirSync(portablePath);
58
+ function setPortableDataPath(dirName = "data", create = true) {
59
+ if (electron.app.isReady()) {
60
+ throw new Error("Portable app data dir must be setup before app is ready");
62
61
  }
63
- electron.app.setPath("appData", portablePath);
62
+ const portableDir = path.join(path.dirname(electron.app.getPath("exe")), dirName);
63
+ if (create) {
64
+ if (!fs.existsSync(portableDir)) {
65
+ fs.mkdirSync(portableDir);
66
+ } else if (!fs.statSync(portableDir).isDirectory()) {
67
+ fs.rmSync(portableDir);
68
+ fs.mkdirSync(portableDir);
69
+ }
70
+ } else if (!fs.existsSync(portableDir)) {
71
+ throw new Error("Portable app data dir does not exists");
72
+ }
73
+ electron.app.setPath("userData", portableDir);
64
74
  }
75
+ var setPortableAppDataPath = setPortableDataPath;
65
76
  function loadPage(win, htmlFilePath = "index.html") {
66
77
  if (isDev) {
67
78
  win.loadURL(process.env.VITE_DEV_SERVER_URL + htmlFilePath);
@@ -108,4 +119,4 @@ function reloadOnPreloadScriptChanged() {
108
119
  }
109
120
  }
110
121
 
111
- export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, singleInstance };
122
+ export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, setPortableDataPath, singleInstance };
@@ -1,7 +1,7 @@
1
1
  import { isUpdateJSON } from './chunk-AAAM44NW.js';
2
- import crypto from 'node:crypto';
2
+ import crypto from 'crypto';
3
3
  import electron from 'electron';
4
- import zlib from 'node:zlib';
4
+ import zlib from 'zlib';
5
5
 
6
6
  function hashBuffer(data, length) {
7
7
  const hash = crypto.createHash("SHA256").update(data).digest("binary");
package/dist/index.cjs CHANGED
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var fs3 = require('fs');
3
+ var fs2 = require('fs');
4
4
  var path2 = require('path');
5
5
  var electron = require('electron');
6
6
  var events = require('events');
7
7
 
8
8
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
9
 
10
- var fs3__default = /*#__PURE__*/_interopDefault(fs3);
10
+ var fs2__default = /*#__PURE__*/_interopDefault(fs2);
11
11
  var path2__default = /*#__PURE__*/_interopDefault(path2);
12
12
  var electron__default = /*#__PURE__*/_interopDefault(electron);
13
13
 
@@ -25,7 +25,7 @@ function getPathFromAppNameAsar(...paths) {
25
25
  return isDev ? "DEV.asar" : path2__default.default.join(path2__default.default.dirname(electron__default.default.app.getAppPath()), `${electron__default.default.app.name}.asar`, ...paths);
26
26
  }
27
27
  function getAppVersion() {
28
- return isDev ? getEntryVersion() : fs3__default.default.readFileSync(getPathFromAppNameAsar("version"), "utf-8");
28
+ return isDev ? getEntryVersion() : fs2__default.default.readFileSync(getPathFromAppNameAsar("version"), "utf-8");
29
29
  }
30
30
  function getEntryVersion() {
31
31
  return electron__default.default.app.getVersion();
@@ -55,6 +55,7 @@ var Updater = class extends events.EventEmitter {
55
55
  CERT;
56
56
  controller;
57
57
  info;
58
+ tmpFilePath;
58
59
  provider;
59
60
  /**
60
61
  * Updater logger
@@ -118,12 +119,24 @@ var Updater = class extends events.EventEmitter {
118
119
  this.err(`Fetch ${format} failed`, "ERR_NETWORK", e instanceof Error ? e.message : e.toString());
119
120
  }
120
121
  }
122
+ cleanup() {
123
+ if (this.tmpFilePath && fs2__default.default.existsSync(this.tmpFilePath)) {
124
+ try {
125
+ fs2__default.default.unlinkSync(this.tmpFilePath);
126
+ this.tmpFilePath = void 0;
127
+ this.logger?.debug("Cleaned up temporary update file");
128
+ } catch (error) {
129
+ this.logger?.warn(`Failed to clean up temporary update file: ${error}`);
130
+ }
131
+ }
132
+ }
121
133
  /**
122
134
  * Handle error message and emit error event
123
135
  */
124
136
  err(msg, code, errorInfo) {
125
137
  const err = new UpdaterError(code, errorInfo);
126
138
  this.logger?.error(`[${code}] ${msg}`, err);
139
+ this.cleanup();
127
140
  this.emit("error", err);
128
141
  }
129
142
  async checkForUpdates(data) {
@@ -234,14 +247,15 @@ var Updater = class extends events.EventEmitter {
234
247
  }
235
248
  this.logger?.debug("Validation end");
236
249
  try {
237
- const tmpFilePath = `${getPathFromAppNameAsar()}.tmp`;
238
- this.logger?.debug(`Install to ${tmpFilePath}`);
239
- fs3__default.default.writeFileSync(tmpFilePath, await this.provider.unzipFile(buffer));
250
+ this.tmpFilePath = `${getPathFromAppNameAsar()}.tmp`;
251
+ this.logger?.debug(`Install to ${this.tmpFilePath}`);
252
+ fs2__default.default.writeFileSync(this.tmpFilePath, await this.provider.unzipFile(buffer));
240
253
  this.logger?.info(`Download success, version: ${_version}`);
241
254
  this.info = void 0;
242
255
  this.emit("update-downloaded");
243
256
  return true;
244
257
  } catch (error) {
258
+ this.cleanup();
245
259
  this.err(
246
260
  "Download failed",
247
261
  "ERR_DOWNLOAD",
@@ -262,6 +276,7 @@ var Updater = class extends events.EventEmitter {
262
276
  return;
263
277
  }
264
278
  this.controller.abort();
279
+ this.cleanup();
265
280
  this.logger?.info("Cancel update");
266
281
  this.emit("update-cancelled");
267
282
  this.controller = new AbortController();
@@ -294,9 +309,9 @@ async function createElectronApp(appOptions = {}) {
294
309
  const logger = updaterInstance.logger;
295
310
  try {
296
311
  const tempAsarPath = `${appNameAsarPath}.tmp`;
297
- if (fs3__default.default.existsSync(tempAsarPath)) {
312
+ if (fs2__default.default.existsSync(tempAsarPath)) {
298
313
  logger?.info(`Installing new asar from ${tempAsarPath}`);
299
- await onInstall(() => fs3__default.default.renameSync(tempAsarPath, appNameAsarPath), tempAsarPath, appNameAsarPath, logger);
314
+ await onInstall(() => fs2__default.default.renameSync(tempAsarPath, appNameAsarPath), tempAsarPath, appNameAsarPath, logger);
300
315
  }
301
316
  await beforeStart?.(mainPath, logger);
302
317
  if (__EIU_IS_ESM__) {
package/dist/index.d.cts CHANGED
@@ -61,6 +61,7 @@ declare class Updater<T extends UpdateInfoWithExtraVersion = UpdateInfoWithExtra
61
61
  private CERT;
62
62
  private controller;
63
63
  private info?;
64
+ private tmpFilePath?;
64
65
  provider?: IProvider;
65
66
  /**
66
67
  * Updater logger
@@ -86,6 +87,7 @@ declare class Updater<T extends UpdateInfoWithExtraVersion = UpdateInfoWithExtra
86
87
  * else if data is `UpdateJSON`, return it
87
88
  */
88
89
  private fetch;
90
+ private cleanup;
89
91
  /**
90
92
  * Handle error message and emit error event
91
93
  */
package/dist/index.d.ts CHANGED
@@ -61,6 +61,7 @@ declare class Updater<T extends UpdateInfoWithExtraVersion = UpdateInfoWithExtra
61
61
  private CERT;
62
62
  private controller;
63
63
  private info?;
64
+ private tmpFilePath?;
64
65
  provider?: IProvider;
65
66
  /**
66
67
  * Updater logger
@@ -86,6 +87,7 @@ declare class Updater<T extends UpdateInfoWithExtraVersion = UpdateInfoWithExtra
86
87
  * else if data is `UpdateJSON`, return it
87
88
  */
88
89
  private fetch;
90
+ private cleanup;
89
91
  /**
90
92
  * Handle error message and emit error event
91
93
  */
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { isDev, getEntryVersion, getAppVersion, getPathFromAppNameAsar, restartApp } from './chunk-QKKPETVJ.js';
1
+ import { isDev, getEntryVersion, getAppVersion, getPathFromAppNameAsar, restartApp } from './chunk-IVHNGRZY.js';
2
2
  import { isUpdateJSON, __require } from './chunk-AAAM44NW.js';
3
- import fs2 from 'node:fs';
4
- import path from 'node:path';
3
+ import fs from 'fs';
4
+ import path from 'path';
5
5
  import electron2 from 'electron';
6
- import { EventEmitter } from 'node:events';
6
+ import { EventEmitter } from 'events';
7
7
 
8
8
  // src/entry/types.ts
9
9
  var UpdaterError = class extends Error {
@@ -19,6 +19,7 @@ var Updater = class extends EventEmitter {
19
19
  CERT;
20
20
  controller;
21
21
  info;
22
+ tmpFilePath;
22
23
  provider;
23
24
  /**
24
25
  * Updater logger
@@ -82,12 +83,24 @@ var Updater = class extends EventEmitter {
82
83
  this.err(`Fetch ${format} failed`, "ERR_NETWORK", e instanceof Error ? e.message : e.toString());
83
84
  }
84
85
  }
86
+ cleanup() {
87
+ if (this.tmpFilePath && fs.existsSync(this.tmpFilePath)) {
88
+ try {
89
+ fs.unlinkSync(this.tmpFilePath);
90
+ this.tmpFilePath = void 0;
91
+ this.logger?.debug("Cleaned up temporary update file");
92
+ } catch (error) {
93
+ this.logger?.warn(`Failed to clean up temporary update file: ${error}`);
94
+ }
95
+ }
96
+ }
85
97
  /**
86
98
  * Handle error message and emit error event
87
99
  */
88
100
  err(msg, code, errorInfo) {
89
101
  const err = new UpdaterError(code, errorInfo);
90
102
  this.logger?.error(`[${code}] ${msg}`, err);
103
+ this.cleanup();
91
104
  this.emit("error", err);
92
105
  }
93
106
  async checkForUpdates(data) {
@@ -198,14 +211,15 @@ var Updater = class extends EventEmitter {
198
211
  }
199
212
  this.logger?.debug("Validation end");
200
213
  try {
201
- const tmpFilePath = `${getPathFromAppNameAsar()}.tmp`;
202
- this.logger?.debug(`Install to ${tmpFilePath}`);
203
- fs2.writeFileSync(tmpFilePath, await this.provider.unzipFile(buffer));
214
+ this.tmpFilePath = `${getPathFromAppNameAsar()}.tmp`;
215
+ this.logger?.debug(`Install to ${this.tmpFilePath}`);
216
+ fs.writeFileSync(this.tmpFilePath, await this.provider.unzipFile(buffer));
204
217
  this.logger?.info(`Download success, version: ${_version}`);
205
218
  this.info = void 0;
206
219
  this.emit("update-downloaded");
207
220
  return true;
208
221
  } catch (error) {
222
+ this.cleanup();
209
223
  this.err(
210
224
  "Download failed",
211
225
  "ERR_DOWNLOAD",
@@ -226,6 +240,7 @@ var Updater = class extends EventEmitter {
226
240
  return;
227
241
  }
228
242
  this.controller.abort();
243
+ this.cleanup();
229
244
  this.logger?.info("Cancel update");
230
245
  this.emit("update-cancelled");
231
246
  this.controller = new AbortController();
@@ -258,9 +273,9 @@ async function createElectronApp(appOptions = {}) {
258
273
  const logger = updaterInstance.logger;
259
274
  try {
260
275
  const tempAsarPath = `${appNameAsarPath}.tmp`;
261
- if (fs2.existsSync(tempAsarPath)) {
276
+ if (fs.existsSync(tempAsarPath)) {
262
277
  logger?.info(`Installing new asar from ${tempAsarPath}`);
263
- await onInstall(() => fs2.renameSync(tempAsarPath, appNameAsarPath), tempAsarPath, appNameAsarPath, logger);
278
+ await onInstall(() => fs.renameSync(tempAsarPath, appNameAsarPath), tempAsarPath, appNameAsarPath, logger);
264
279
  }
265
280
  await beforeStart?.(mainPath, logger);
266
281
  if (__EIU_IS_ESM__) {
package/dist/provider.js CHANGED
@@ -1,7 +1,7 @@
1
- import { defaultVerifySignature, defaultUnzipFile, defaultDownloadUpdateJSON, defaultDownloadAsar, defaultDownloadText, resolveJson } from './chunk-QPAKJHVM.js';
2
- export { defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, downloadUtil, getHeader, resolveJson } from './chunk-QPAKJHVM.js';
1
+ import { defaultVerifySignature, defaultUnzipFile, defaultDownloadUpdateJSON, defaultDownloadAsar, defaultDownloadText, resolveJson } from './chunk-PD4EV4MM.js';
2
+ export { defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, downloadUtil, getHeader, resolveJson } from './chunk-PD4EV4MM.js';
3
3
  import { defaultIsLowerVersion } from './chunk-AAAM44NW.js';
4
- import { URL } from 'node:url';
4
+ import { URL } from 'url';
5
5
 
6
6
  // src/provider/base.ts
7
7
  var BaseProvider = class {
@@ -149,8 +149,6 @@ var GitHubAtomProvider = class extends BaseGitHubProvider {
149
149
  return `releases/download/v${tag}/${versionPath}`;
150
150
  }
151
151
  };
152
-
153
- // src/provider/github/file.ts
154
152
  var GitHubProvider = class extends BaseGitHubProvider {
155
153
  name = "GithubProvider";
156
154
  /**
package/dist/utils.cjs CHANGED
@@ -266,13 +266,24 @@ function singleInstance(window) {
266
266
  }
267
267
  });
268
268
  }
269
- function setPortableAppDataPath(dirName = "data") {
270
- const portablePath = path__default.default.join(path__default.default.dirname(electron2__default.default.app.getPath("exe")), dirName);
271
- if (!fs__default.default.existsSync(portablePath)) {
272
- fs__default.default.mkdirSync(portablePath);
269
+ function setPortableDataPath(dirName = "data", create = true) {
270
+ if (electron2__default.default.app.isReady()) {
271
+ throw new Error("Portable app data dir must be setup before app is ready");
273
272
  }
274
- electron2__default.default.app.setPath("appData", portablePath);
273
+ const portableDir = path__default.default.join(path__default.default.dirname(electron2__default.default.app.getPath("exe")), dirName);
274
+ if (create) {
275
+ if (!fs__default.default.existsSync(portableDir)) {
276
+ fs__default.default.mkdirSync(portableDir);
277
+ } else if (!fs__default.default.statSync(portableDir).isDirectory()) {
278
+ fs__default.default.rmSync(portableDir);
279
+ fs__default.default.mkdirSync(portableDir);
280
+ }
281
+ } else if (!fs__default.default.existsSync(portableDir)) {
282
+ throw new Error("Portable app data dir does not exists");
283
+ }
284
+ electron2__default.default.app.setPath("userData", portableDir);
275
285
  }
286
+ var setPortableAppDataPath = setPortableDataPath;
276
287
  function loadPage(win, htmlFilePath = "index.html") {
277
288
  if (isDev) {
278
289
  win.loadURL(process.env.VITE_DEV_SERVER_URL + htmlFilePath);
@@ -367,4 +378,5 @@ exports.resolveJson = resolveJson;
367
378
  exports.restartApp = restartApp;
368
379
  exports.setAppUserModelId = setAppUserModelId;
369
380
  exports.setPortableAppDataPath = setPortableAppDataPath;
381
+ exports.setPortableDataPath = setPortableDataPath;
370
382
  exports.singleInstance = singleInstance;
package/dist/utils.d.cts CHANGED
@@ -60,12 +60,18 @@ declare function disableHWAccForWin7(): void;
60
60
  */
61
61
  declare function singleInstance(window?: BrowserWindow): void;
62
62
  /**
63
- * Set `AppData` dir to the dir of .exe file
63
+ * Set `userData` dir to the dir of .exe file
64
64
  *
65
65
  * Useful for portable Windows app
66
66
  * @param dirName dir name, default to `data`
67
+ * @param create whether to create dir, default to `true`
67
68
  */
68
- declare function setPortableAppDataPath(dirName?: string): void;
69
+ declare function setPortableDataPath(dirName?: string, create?: boolean): void;
70
+ /**
71
+ * @deprecated
72
+ * @alias {@link setPortableDataPath}
73
+ */
74
+ declare const setPortableAppDataPath: typeof setPortableDataPath;
69
75
  /**
70
76
  * Load `process.env.VITE_DEV_SERVER_URL` when dev, else load html file
71
77
  * @param win window
@@ -120,4 +126,4 @@ declare function getPathFromEntryAsar(...paths: string[]): string;
120
126
  declare function handleUnexpectedErrors(callback: (err: unknown) => void): void;
121
127
  declare function reloadOnPreloadScriptChanged(): void;
122
128
 
123
- export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, singleInstance };
129
+ export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, setPortableDataPath, singleInstance };
package/dist/utils.d.ts CHANGED
@@ -60,12 +60,18 @@ declare function disableHWAccForWin7(): void;
60
60
  */
61
61
  declare function singleInstance(window?: BrowserWindow): void;
62
62
  /**
63
- * Set `AppData` dir to the dir of .exe file
63
+ * Set `userData` dir to the dir of .exe file
64
64
  *
65
65
  * Useful for portable Windows app
66
66
  * @param dirName dir name, default to `data`
67
+ * @param create whether to create dir, default to `true`
67
68
  */
68
- declare function setPortableAppDataPath(dirName?: string): void;
69
+ declare function setPortableDataPath(dirName?: string, create?: boolean): void;
70
+ /**
71
+ * @deprecated
72
+ * @alias {@link setPortableDataPath}
73
+ */
74
+ declare const setPortableAppDataPath: typeof setPortableDataPath;
69
75
  /**
70
76
  * Load `process.env.VITE_DEV_SERVER_URL` when dev, else load html file
71
77
  * @param win window
@@ -120,4 +126,4 @@ declare function getPathFromEntryAsar(...paths: string[]): string;
120
126
  declare function handleUnexpectedErrors(callback: (err: unknown) => void): void;
121
127
  declare function reloadOnPreloadScriptChanged(): void;
122
128
 
123
- export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, singleInstance };
129
+ export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, setPortableDataPath, singleInstance };
package/dist/utils.js CHANGED
@@ -1,3 +1,3 @@
1
- export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, singleInstance } from './chunk-QKKPETVJ.js';
2
- export { aesDecrypt, aesEncrypt, defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, defaultSignature, defaultUnzipFile, defaultVerifySignature, defaultZipFile, downloadUtil, getHeader, hashBuffer, resolveJson } from './chunk-QPAKJHVM.js';
1
+ export { beautifyDevTools, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromMain, getPathFromPreload, getPathFromPublic, handleUnexpectedErrors, importNative, isDev, isLinux, isMac, isWin, loadPage, reloadOnPreloadScriptChanged, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, setPortableDataPath, singleInstance } from './chunk-IVHNGRZY.js';
2
+ export { aesDecrypt, aesEncrypt, defaultDownloadAsar, defaultDownloadText, defaultDownloadUpdateJSON, defaultSignature, defaultUnzipFile, defaultVerifySignature, defaultZipFile, downloadUtil, getHeader, hashBuffer, resolveJson } from './chunk-PD4EV4MM.js';
3
3
  export { defaultIsLowerVersion, defaultVersionJsonGenerator, isUpdateJSON, parseVersion } from './chunk-AAAM44NW.js';
package/dist/vite.js CHANGED
@@ -1,5 +1,5 @@
1
- import fs5 from 'node:fs';
2
- import path5 from 'node:path';
1
+ import fs5 from 'fs';
2
+ import path5 from 'path';
3
3
  import { isCI } from 'ci-info';
4
4
  export { isCI } from 'ci-info';
5
5
  import { getPackageInfoSync, loadPackageJSON } from 'local-pkg';
@@ -10,11 +10,11 @@ import { notBundle } from 'vite-plugin-electron/plugin';
10
10
  import ElectronSimple from 'vite-plugin-electron/simple';
11
11
  import Asar from '@electron/asar';
12
12
  import MagicString from 'magic-string';
13
- import cp from 'node:child_process';
13
+ import cp from 'child_process';
14
14
  import * as babel from '@babel/core';
15
- import { builtinModules } from 'node:module';
16
- import crypto from 'node:crypto';
17
- import zlib from 'node:zlib';
15
+ import { builtinModules } from 'module';
16
+ import crypto from 'crypto';
17
+ import zlib from 'zlib';
18
18
  import { generate } from 'selfsigned';
19
19
 
20
20
  // src/vite/index.ts
@@ -683,7 +683,7 @@ var debugStartup = async (args) => {
683
683
  async function filterErrorMessageStartup(args, filter) {
684
684
  await args.startup(void 0, { stdio: ["inherit", "pipe", "pipe", "ipc"] });
685
685
  const elec = process.electronApp;
686
- elec.stderr.addListener("data", (data) => {
686
+ elec.stdout.addListener("data", (data) => {
687
687
  console.log(data.toString().trimEnd());
688
688
  });
689
689
  elec.stderr.addListener("data", (data) => {
@@ -696,7 +696,7 @@ async function filterErrorMessageStartup(args, filter) {
696
696
  function fixWinCharEncoding(fn) {
697
697
  return async (...args) => {
698
698
  if (process.platform === "win32") {
699
- (await import('node:child_process')).spawnSync("chcp", ["65001"]);
699
+ (await import('child_process')).spawnSync("chcp", ["65001"]);
700
700
  }
701
701
  await fn(...args);
702
702
  };
@@ -895,7 +895,7 @@ async function electronWithUpdater(options) {
895
895
  ...electronPluginOptions,
896
896
  updater: { buildAsarOption, buildEntryOption, buildVersionOption }
897
897
  },
898
- (key, value) => (key === "privateKey" || key === "cert") && shouldShowKey ? `<${key.toUpperCase()}>` : value,
898
+ (key, value) => key === "privateKey" || key === "cert" ? shouldShowKey ? value : `<${key.toUpperCase()}>` : value,
899
899
  2
900
900
  ),
901
901
  { timestamp: true }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "electron-incremental-update",
3
3
  "type": "module",
4
- "version": "2.3.5",
4
+ "version": "2.3.7",
5
5
  "description": "Electron incremental update tools with Vite plugin, support bytecode protection",
6
6
  "author": "subframe7536",
7
7
  "license": "MIT",
@@ -59,7 +59,7 @@
59
59
  "@electron/asar": "*"
60
60
  },
61
61
  "dependencies": {
62
- "@babel/core": "^7.27.1",
62
+ "@babel/core": "^7.27.4",
63
63
  "@babel/plugin-transform-arrow-functions": "^7.27.1",
64
64
  "@babel/plugin-transform-template-literals": "^7.27.1",
65
65
  "@subframe7536/type-utils": "^0.2.0",
@@ -70,19 +70,19 @@
70
70
  "vite-plugin-electron": "^0.29.0"
71
71
  },
72
72
  "devDependencies": {
73
- "@subframe7536/eslint-config": "^1.2.4",
73
+ "@subframe7536/eslint-config": "^1.3.1",
74
74
  "@types/babel__core": "^7.20.5",
75
- "@types/node": "^22.15.17",
76
- "@vitest/eslint-plugin": "^1.1.44",
77
- "bumpp": "^10.1.0",
75
+ "@types/node": "^22.15.30",
76
+ "@vitest/eslint-plugin": "^1.2.1",
77
+ "bumpp": "^10.1.1",
78
78
  "electron": "36.2.0",
79
79
  "esbuild": "^0.25.4",
80
- "eslint": "^9.26.0",
81
- "tsup": "^8.4.0",
80
+ "eslint": "^9.28.0",
81
+ "tsup": "^8.5.0",
82
82
  "typescript": "^5.8.3",
83
83
  "vite": "^6.3.5",
84
84
  "vite-plugin-electron": "^0.29.0",
85
- "vitest": "^3.1.3"
85
+ "vitest": "^3.2.2"
86
86
  },
87
87
  "pnpm": {
88
88
  "overrides": {