electron-incremental-update 0.8.3 → 0.8.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.
@@ -13,13 +13,13 @@ var info = {
13
13
  appPath: Electron.app?.getAppPath()
14
14
  };
15
15
  function getProductAsarPath(name) {
16
- return info.dev ? join(dirname(info.appPath), `${name}.asar`) : "dev.asar";
16
+ return info.dev ? "dev.asar" : join(dirname(info.appPath), `${name}.asar`);
17
17
  }
18
18
  function getEntryVersion() {
19
19
  return Electron.app.getVersion();
20
20
  }
21
21
  function getProductVersion(name) {
22
- return info.dev ? readFileSync(join(getProductAsarPath(name), "version"), "utf-8") : getEntryVersion();
22
+ return info.dev ? getEntryVersion() : readFileSync(join(getProductAsarPath(name), "version"), "utf-8");
23
23
  }
24
24
  var NoSuchNativeModuleError = class extends Error {
25
25
  moduleName;
@@ -29,7 +29,7 @@ var NoSuchNativeModuleError = class extends Error {
29
29
  }
30
30
  };
31
31
  function requireNative(packageName) {
32
- const path = info.dev ? join(info.appPath, "node_modules", packageName) : packageName;
32
+ const path = info.dev ? packageName : join(info.appPath, "node_modules", packageName);
33
33
  try {
34
34
  return __require(path);
35
35
  } catch (error) {
package/dist/index.js CHANGED
@@ -54,13 +54,13 @@ var info = {
54
54
  appPath: import_electron.default.app?.getAppPath()
55
55
  };
56
56
  function getProductAsarPath(name) {
57
- return info.dev ? (0, import_node_path.join)((0, import_node_path.dirname)(info.appPath), `${name}.asar`) : "dev.asar";
57
+ return info.dev ? "dev.asar" : (0, import_node_path.join)((0, import_node_path.dirname)(info.appPath), `${name}.asar`);
58
58
  }
59
59
  function getEntryVersion() {
60
60
  return import_electron.default.app.getVersion();
61
61
  }
62
62
  function getProductVersion(name) {
63
- return info.dev ? (0, import_node_fs.readFileSync)((0, import_node_path.join)(getProductAsarPath(name), "version"), "utf-8") : getEntryVersion();
63
+ return info.dev ? getEntryVersion() : (0, import_node_fs.readFileSync)((0, import_node_path.join)(getProductAsarPath(name), "version"), "utf-8");
64
64
  }
65
65
  function waitAppReady(duration = 1e3) {
66
66
  return new Promise((resolve2, reject) => {
package/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  parseVersion,
9
9
  unzipFile,
10
10
  waitAppReady
11
- } from "./chunk-7R4GHFED.mjs";
11
+ } from "./chunk-CR6HTU6P.mjs";
12
12
  import {
13
13
  isUpdateJSON
14
14
  } from "./chunk-2JVXVTC5.mjs";
package/dist/utils.js CHANGED
@@ -57,13 +57,13 @@ var info = {
57
57
  appPath: import_electron.default.app?.getAppPath()
58
58
  };
59
59
  function getProductAsarPath(name) {
60
- return info.dev ? (0, import_node_path.join)((0, import_node_path.dirname)(info.appPath), `${name}.asar`) : "dev.asar";
60
+ return info.dev ? "dev.asar" : (0, import_node_path.join)((0, import_node_path.dirname)(info.appPath), `${name}.asar`);
61
61
  }
62
62
  function getEntryVersion() {
63
63
  return import_electron.default.app.getVersion();
64
64
  }
65
65
  function getProductVersion(name) {
66
- return info.dev ? (0, import_node_fs.readFileSync)((0, import_node_path.join)(getProductAsarPath(name), "version"), "utf-8") : getEntryVersion();
66
+ return info.dev ? getEntryVersion() : (0, import_node_fs.readFileSync)((0, import_node_path.join)(getProductAsarPath(name), "version"), "utf-8");
67
67
  }
68
68
  var NoSuchNativeModuleError = class extends Error {
69
69
  moduleName;
@@ -73,7 +73,7 @@ var NoSuchNativeModuleError = class extends Error {
73
73
  }
74
74
  };
75
75
  function requireNative(packageName) {
76
- const path = info.dev ? (0, import_node_path.join)(info.appPath, "node_modules", packageName) : packageName;
76
+ const path = info.dev ? packageName : (0, import_node_path.join)(info.appPath, "node_modules", packageName);
77
77
  try {
78
78
  return require(path);
79
79
  } catch (error) {
package/dist/utils.mjs CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  unzipFile,
15
15
  waitAppReady,
16
16
  zipFile
17
- } from "./chunk-7R4GHFED.mjs";
17
+ } from "./chunk-CR6HTU6P.mjs";
18
18
  import "./chunk-ZFXKCRJC.mjs";
19
19
  export {
20
20
  NoSuchNativeModuleError,
package/dist/vite.js CHANGED
@@ -33,13 +33,13 @@ __export(vite_exports, {
33
33
  ElectronUpdater: () => ElectronUpdater
34
34
  });
35
35
  module.exports = __toCommonJS(vite_exports);
36
- var import_vite2 = require("vite");
36
+ var import_vite = require("vite");
37
37
 
38
38
  // src/build-plugins/build.ts
39
39
  var import_promises = require("fs/promises");
40
40
  var import_node_fs2 = require("fs");
41
41
  var import_asar = __toESM(require("@electron/asar"));
42
- var import_vite = require("vite");
42
+ var import_esbuild = require("esbuild");
43
43
 
44
44
  // src/crypto.ts
45
45
  var import_node_crypto = require("crypto");
@@ -184,21 +184,13 @@ async function buildEntry({
184
184
  entryOutputPath: outfile,
185
185
  minify
186
186
  }) {
187
- await (0, import_vite.build)({
188
- build: {
189
- lib: {
190
- entry: entryPath,
191
- formats: ["cjs"]
192
- },
193
- minify,
194
- rollupOptions: {
195
- treeshake: true,
196
- external: ["electron", "original-fs"],
197
- output: {
198
- file: outfile
199
- }
200
- }
201
- }
187
+ await (0, import_esbuild.build)({
188
+ entryPoints: [entryPath],
189
+ bundle: true,
190
+ platform: "node",
191
+ outfile,
192
+ minify,
193
+ external: ["electron", "original-fs"]
202
194
  });
203
195
  }
204
196
 
@@ -353,7 +345,7 @@ function ElectronUpdater(options) {
353
345
  const { entryPath, entryOutputPath } = buildEntryOption;
354
346
  const { asarOutputPath } = buildAsarOption;
355
347
  const id = "electron-incremental-updater";
356
- const log = (0, import_vite2.createLogger)("info", { prefix: `[${id}]` });
348
+ const log = (0, import_vite.createLogger)("info", { prefix: `[${id}]` });
357
349
  return {
358
350
  name: `vite-plugin-${id}`,
359
351
  enforce: "post",
package/dist/vite.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  parseVersion,
6
6
  zipFile
7
- } from "./chunk-7R4GHFED.mjs";
7
+ } from "./chunk-CR6HTU6P.mjs";
8
8
  import {
9
9
  isUpdateJSON
10
10
  } from "./chunk-2JVXVTC5.mjs";
@@ -17,7 +17,7 @@ import { createLogger } from "vite";
17
17
  import { readFile, rename, writeFile } from "node:fs/promises";
18
18
  import { existsSync } from "node:fs";
19
19
  import Asar from "@electron/asar";
20
- import { build } from "vite";
20
+ import { build } from "esbuild";
21
21
  async function buildAsar({
22
22
  version,
23
23
  asarOutputPath,
@@ -88,20 +88,12 @@ async function buildEntry({
88
88
  minify
89
89
  }) {
90
90
  await build({
91
- build: {
92
- lib: {
93
- entry: entryPath,
94
- formats: ["cjs"]
95
- },
96
- minify,
97
- rollupOptions: {
98
- treeshake: true,
99
- external: ["electron", "original-fs"],
100
- output: {
101
- file: outfile
102
- }
103
- }
104
- }
91
+ entryPoints: [entryPath],
92
+ bundle: true,
93
+ platform: "node",
94
+ outfile,
95
+ minify,
96
+ external: ["electron", "original-fs"]
105
97
  });
106
98
  }
107
99
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "electron-incremental-update",
3
3
  "author": "subframe7536",
4
- "version": "0.8.3",
4
+ "version": "0.8.4",
5
5
  "description": "electron incremental update tools, powered by vite",
6
6
  "scripts": {
7
7
  "build": "tsup && node fix-module.js",