electron-incremental-update 2.2.5 → 2.2.6

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.
@@ -138,8 +138,11 @@ module.exports=${bytecodeModuleBlock}
138
138
  }
139
139
  }
140
140
  const bytecodeLoaderBlock = getBytecodeLoaderBlock(chunk.fileName);
141
- _code = hasBytecodeMoudle ? _code.replace(useStrict, `${useStrict}
142
- ${bytecodeLoaderBlock}`) : _code;
141
+ _code = hasBytecodeMoudle ? _code.replace(
142
+ new RegExp(`(${useStrict})|("use strict";)`),
143
+ `${useStrict}
144
+ ${bytecodeLoaderBlock}`
145
+ ) : _code;
143
146
  }
144
147
  fs.writeFileSync(chunkFilePath, _code);
145
148
  }
@@ -185,7 +185,7 @@ function convertLiteral(code, sourcemap, offset) {
185
185
  }
186
186
  return {
187
187
  code: s.toString(),
188
- map: sourcemap ? s.generateMap({ hires: true }) : undefined
188
+ map: sourcemap ? s.generateMap({ hires: true }) : void 0
189
189
  };
190
190
  }
191
191
 
package/dist/index.cjs CHANGED
@@ -177,7 +177,7 @@ var Updater = class extends events.EventEmitter {
177
177
  this.err("Download failed", "ERR_PARAM", "No update asar buffer and provider");
178
178
  return false;
179
179
  }
180
- const buffer = await this.fetch("buffer", data ? Buffer.from(data) : undefined);
180
+ const buffer = await this.fetch("buffer", data ? Buffer.from(data) : void 0);
181
181
  if (!buffer) {
182
182
  this.err("Download failed", "ERR_PARAM", "No update asar file buffer");
183
183
  return false;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { Promisable } from '@subframe7536/type-utils';
2
1
  import { U as UpdateInfo, I as IProvider, D as DownloadingInfo, a as UpdateJSON, b as UpdateJSONWithURL } from './types-1T_tRG8a.cjs';
2
+ import { Promisable } from '@subframe7536/type-utils';
3
3
  import { EventEmitter } from 'node:events';
4
4
  import 'node:url';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Promisable } from '@subframe7536/type-utils';
2
1
  import { U as UpdateInfo, I as IProvider, D as DownloadingInfo, a as UpdateJSON, b as UpdateJSONWithURL } from './types-1T_tRG8a.js';
2
+ import { Promisable } from '@subframe7536/type-utils';
3
3
  import { EventEmitter } from 'node:events';
4
4
  import 'node:url';
5
5
 
package/dist/index.js CHANGED
@@ -141,7 +141,7 @@ var Updater = class extends EventEmitter {
141
141
  this.err("Download failed", "ERR_PARAM", "No update asar buffer and provider");
142
142
  return false;
143
143
  }
144
- const buffer = await this.fetch("buffer", data ? Buffer.from(data) : undefined);
144
+ const buffer = await this.fetch("buffer", data ? Buffer.from(data) : void 0);
145
145
  if (!buffer) {
146
146
  this.err("Download failed", "ERR_PARAM", "No update asar file buffer");
147
147
  return false;
@@ -1,5 +1,5 @@
1
- import { c as defaultVerifySignature, l as defaultUnzipFile } from './zip-DemXr4mk.cjs';
2
- export { j as defaultDownloadAsar, f as defaultDownloadJSON, i as defaultDownloadUpdateJSON, e as downloadUtil, g as getHeader } from './zip-DemXr4mk.cjs';
1
+ import { c as defaultVerifySignature, l as defaultUnzipFile } from './zip-ChpUyjy1.cjs';
2
+ export { j as defaultDownloadAsar, f as defaultDownloadJSON, i as defaultDownloadUpdateJSON, e as downloadUtil, g as getHeader } from './zip-ChpUyjy1.cjs';
3
3
  import { e as UpdateInfoWithURL, I as IProvider, d as defaultIsLowerVersion, D as DownloadingInfo, f as URLHandler } from './types-1T_tRG8a.cjs';
4
4
  export { b as UpdateJSONWithURL } from './types-1T_tRG8a.cjs';
5
5
  import '@subframe7536/type-utils';
@@ -1,5 +1,5 @@
1
- import { c as defaultVerifySignature, l as defaultUnzipFile } from './zip-CDmogV-s.js';
2
- export { j as defaultDownloadAsar, f as defaultDownloadJSON, i as defaultDownloadUpdateJSON, e as downloadUtil, g as getHeader } from './zip-CDmogV-s.js';
1
+ import { c as defaultVerifySignature, l as defaultUnzipFile } from './zip-DUHOPZrB.js';
2
+ export { j as defaultDownloadAsar, f as defaultDownloadJSON, i as defaultDownloadUpdateJSON, e as downloadUtil, g as getHeader } from './zip-DUHOPZrB.js';
3
3
  import { e as UpdateInfoWithURL, I as IProvider, d as defaultIsLowerVersion, D as DownloadingInfo, f as URLHandler } from './types-1T_tRG8a.js';
4
4
  export { b as UpdateJSONWithURL } from './types-1T_tRG8a.js';
5
5
  import '@subframe7536/type-utils';
package/dist/utils.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { b as aesDecrypt, a as aesEncrypt, j as defaultDownloadAsar, f as defaultDownloadJSON, i as defaultDownloadUpdateJSON, d as defaultSignature, l as defaultUnzipFile, c as defaultVerifySignature, k as defaultZipFile, e as downloadUtil, g as getHeader, h as hashBuffer } from './zip-DemXr4mk.cjs';
1
+ export { b as aesDecrypt, a as aesEncrypt, j as defaultDownloadAsar, f as defaultDownloadJSON, i as defaultDownloadUpdateJSON, d as defaultSignature, l as defaultUnzipFile, c as defaultVerifySignature, k as defaultZipFile, e as downloadUtil, g as getHeader, h as hashBuffer } from './zip-ChpUyjy1.cjs';
2
2
  import { BrowserWindow } from 'electron';
3
3
  export { U as UpdateInfo, a as UpdateJSON, V as Version, d as defaultIsLowerVersion, c as defaultVersionJsonGenerator, i as isUpdateJSON, p as parseVersion } from './types-1T_tRG8a.cjs';
4
4
  import '@subframe7536/type-utils';
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { b as aesDecrypt, a as aesEncrypt, j as defaultDownloadAsar, f as defaultDownloadJSON, i as defaultDownloadUpdateJSON, d as defaultSignature, l as defaultUnzipFile, c as defaultVerifySignature, k as defaultZipFile, e as downloadUtil, g as getHeader, h as hashBuffer } from './zip-CDmogV-s.js';
1
+ export { b as aesDecrypt, a as aesEncrypt, j as defaultDownloadAsar, f as defaultDownloadJSON, i as defaultDownloadUpdateJSON, d as defaultSignature, l as defaultUnzipFile, c as defaultVerifySignature, k as defaultZipFile, e as downloadUtil, g as getHeader, h as hashBuffer } from './zip-DUHOPZrB.js';
2
2
  import { BrowserWindow } from 'electron';
3
3
  export { U as UpdateInfo, a as UpdateJSON, V as Version, d as defaultIsLowerVersion, c as defaultVersionJsonGenerator, i as isUpdateJSON, p as parseVersion } from './types-1T_tRG8a.js';
4
4
  import '@subframe7536/type-utils';
package/dist/vite.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import { Promisable } from '@subframe7536/type-utils';
1
2
  import { InlineConfig, PluginOption } from 'vite';
2
3
  import { ElectronSimpleOptions } from 'vite-plugin-electron/simple';
3
- 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
 
@@ -90,7 +90,7 @@ interface BuildEntryOption {
90
90
  */
91
91
  appEntryPath?: string;
92
92
  /**
93
- * Esbuild path map of native modules in entry directory
93
+ * Vite input options of native modules in entry directory
94
94
  *
95
95
  * @default {}
96
96
  * @example
package/dist/vite.js CHANGED
@@ -89,7 +89,7 @@ async function buildEntry({
89
89
  vite: mergeConfig({
90
90
  plugins: [
91
91
  isESM && await import('./esm-4S4XCVEW.js').then((m) => m.esm()),
92
- bytecodeOptions && await import('./bytecode-R2B4KTMV.js').then((m) => m.bytecodePlugin("main", bytecodeOptions))
92
+ bytecodeOptions && await import('./bytecode-7J2ZQDDO.js').then((m) => m.bytecodePlugin("main", bytecodeOptions))
93
93
  ],
94
94
  build: {
95
95
  sourcemap,
@@ -226,7 +226,7 @@ function parseOptions(pkg, sourcemap = false, minify = false, options = {}) {
226
226
  return false;
227
227
  }
228
228
  if (!external) {
229
- return undefined;
229
+ return void 0;
230
230
  }
231
231
  if (typeof external === "string") {
232
232
  return source === external;
@@ -309,16 +309,16 @@ async function electronWithUpdater(options) {
309
309
  } = options;
310
310
  if (!pkg || !pkg.version || !pkg.name || !pkg.main) {
311
311
  log.error("package.json not found or invalid", { timestamp: true });
312
- return undefined;
312
+ return void 0;
313
313
  }
314
314
  const isESM = pkg.type === "module";
315
- let bytecodeOptions = typeof bytecode === "object" ? bytecode : bytecode === true ? { enable: true } : undefined;
315
+ let bytecodeOptions = typeof bytecode === "object" ? bytecode : bytecode === true ? { enable: true } : void 0;
316
316
  if (isESM && bytecodeOptions?.enable) {
317
317
  (await import('./constant-ME27JB5D.js')).bytecodeLog.warn(
318
318
  '`bytecodePlugin` does not support ES module, please remove "type": "module" in package.json',
319
319
  { timestamp: true }
320
320
  );
321
- bytecodeOptions = undefined;
321
+ bytecodeOptions = void 0;
322
322
  }
323
323
  const {
324
324
  buildAsarOption,
@@ -388,7 +388,7 @@ async function electronWithUpdater(options) {
388
388
  external: (src) => src.startsWith("node:") || Object.keys("dependencies" in pkg ? pkg.dependencies : {}).includes(src) || src === "original-fs",
389
389
  treeshake: true
390
390
  };
391
- const esmShimPlugin = isESM ? (await import('./esm-4S4XCVEW.js')).esm() : undefined;
391
+ const esmShimPlugin = isESM ? (await import('./esm-4S4XCVEW.js')).esm() : void 0;
392
392
  const electronPluginOptions = {
393
393
  main: {
394
394
  entry: _main.files,
@@ -407,8 +407,8 @@ async function electronWithUpdater(options) {
407
407
  vite: mergeConfig(
408
408
  {
409
409
  plugins: [
410
- !isBuild && useNotBundle ? notBundle() : undefined,
411
- bytecodeOptions && await import('./bytecode-R2B4KTMV.js').then((m) => m.bytecodePlugin("main", bytecodeOptions)),
410
+ !isBuild && useNotBundle ? notBundle() : void 0,
411
+ bytecodeOptions && await import('./bytecode-7J2ZQDDO.js').then((m) => m.bytecodePlugin("main", bytecodeOptions)),
412
412
  esmShimPlugin
413
413
  ],
414
414
  build: {
@@ -428,7 +428,7 @@ async function electronWithUpdater(options) {
428
428
  vite: mergeConfig(
429
429
  {
430
430
  plugins: [
431
- bytecodeOptions && (await import('./bytecode-R2B4KTMV.js')).bytecodePlugin("preload", bytecodeOptions),
431
+ bytecodeOptions && (await import('./bytecode-7J2ZQDDO.js')).bytecodePlugin("preload", bytecodeOptions),
432
432
  esmShimPlugin,
433
433
  {
434
434
  name: `${id}-build`,
@@ -449,7 +449,7 @@ async function electronWithUpdater(options) {
449
449
  }
450
450
  ],
451
451
  build: {
452
- sourcemap: sourcemap ? "inline" : undefined,
452
+ sourcemap: sourcemap ? "inline" : void 0,
453
453
  minify,
454
454
  outDir: `${buildAsarOption.electronDistPath}/preload`,
455
455
  rollupOptions
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "electron-incremental-update",
3
3
  "type": "module",
4
- "version": "2.2.5",
4
+ "version": "2.2.6",
5
5
  "description": "Electron incremental update tools with Vite plugin, support bytecode protection",
6
6
  "author": "subframe7536",
7
7
  "license": "MIT",
@@ -56,36 +56,41 @@
56
56
  "registry": "https://registry.npmjs.org/"
57
57
  },
58
58
  "peerDependencies": {
59
- "@electron/asar": "*",
60
- "esbuild": "*"
59
+ "@electron/asar": "*"
61
60
  },
62
61
  "dependencies": {
63
- "@babel/core": "^7.26.7",
64
- "@babel/plugin-transform-arrow-functions": "^7.25.9",
65
- "@babel/plugin-transform-template-literals": "^7.25.9",
66
- "@subframe7536/type-utils": "^0.1.6",
67
- "ci-info": "^4.1.0",
68
- "local-pkg": "^1.0.0",
62
+ "@babel/core": "^7.27.1",
63
+ "@babel/plugin-transform-arrow-functions": "^7.27.1",
64
+ "@babel/plugin-transform-template-literals": "^7.27.1",
65
+ "@subframe7536/type-utils": "^0.2.0",
66
+ "ci-info": "^4.2.0",
67
+ "local-pkg": "^1.1.1",
69
68
  "magic-string": "^0.30.17",
70
69
  "selfsigned": "^2.4.1",
71
70
  "vite-plugin-electron": "^0.29.0"
72
71
  },
73
72
  "devDependencies": {
74
- "@subframe7536/eslint-config": "^1.1.8",
73
+ "@subframe7536/eslint-config": "^1.2.4",
75
74
  "@types/babel__core": "^7.20.5",
76
- "@types/node": "^20.17.17",
77
- "bumpp": "^10.0.1",
78
- "electron": "34.0.2",
79
- "eslint": "^9.19.0",
80
- "tsup": "^8.3.6",
81
- "typescript": "^5.7.3",
82
- "vite": "^6.0.11",
75
+ "@types/node": "^22.15.17",
76
+ "bumpp": "^10.1.0",
77
+ "electron": "36.2.0",
78
+ "esbuild": "^0.25.4",
79
+ "eslint": "^9.26.0",
80
+ "tsup": "^8.4.0",
81
+ "typescript": "^5.8.3",
82
+ "vite": "^6.3.5",
83
83
  "vite-plugin-electron": "^0.29.0",
84
- "vitest": "^3.0.5"
84
+ "vitest": "^3.1.3"
85
85
  },
86
86
  "pnpm": {
87
87
  "overrides": {
88
- "is-core-module": "npm:@nolyfill/is-core-module@^1"
89
- }
88
+ "is-core-module": "npm:@nolyfill/is-core-module@^1.0.39"
89
+ },
90
+ "onlyBuiltDependencies": [
91
+ "electron",
92
+ "esbuild",
93
+ "unrs-resolver"
94
+ ]
90
95
  }
91
96
  }
@@ -1,5 +1,5 @@
1
- import { Arrayable } from '@subframe7536/type-utils';
2
1
  import { a as UpdateJSON, D as DownloadingInfo } from './types-1T_tRG8a.cjs';
2
+ import { Arrayable } from '@subframe7536/type-utils';
3
3
  import { IncomingMessage } from 'electron';
4
4
 
5
5
  declare function hashBuffer(data: string | Buffer, length: number): Buffer;
@@ -1,5 +1,5 @@
1
- import { Arrayable } from '@subframe7536/type-utils';
2
1
  import { a as UpdateJSON, D as DownloadingInfo } from './types-1T_tRG8a.js';
2
+ import { Arrayable } from '@subframe7536/type-utils';
3
3
  import { IncomingMessage } from 'electron';
4
4
 
5
5
  declare function hashBuffer(data: string | Buffer, length: number): Buffer;