electron-incremental-update 0.7.8 → 0.7.9

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/vite.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Plugin } from 'vite';
2
2
  import { Buffer } from 'node:buffer';
3
- import { U as UpdateJSON } from './updateJson-7e45d9e1.js';
3
+ import { UpdateJSON } from './updateJson.js';
4
4
 
5
5
  type DistinguishedName = {
6
6
  countryName?: string;
@@ -15,8 +15,26 @@ type DistinguishedName = {
15
15
  businessCategory?: string;
16
16
  emailAddress?: string;
17
17
  };
18
- type FunctionGenerateSignature = (buffer: Buffer, privateKey: string, cert: string, version: string) => string | Promise<string>;
19
- type FunctionGenerateVersionJson = (existingJson: UpdateJSON, buffer: Buffer, signature: string, version: string, minVersion: string) => UpdateJSON | Promise<UpdateJSON>;
18
+ type GeneratorOverrideFunctions = {
19
+ /**
20
+ * custom signature generate function
21
+ * @param buffer file buffer
22
+ * @param privateKey private key
23
+ * @param cert certificate string, **EOL must be '\n'**
24
+ * @param version current version
25
+ */
26
+ generateSignature?: (buffer: Buffer, privateKey: string, cert: string, version: string) => string | Promise<string>;
27
+ /**
28
+ * custom generate version json function
29
+ * @param existingJson The existing JSON object.
30
+ * @param buffer file buffer
31
+ * @param signature generated signature
32
+ * @param version current version
33
+ * @param minVersion The minimum version
34
+ * @returns The updated version json
35
+ */
36
+ generateVersionJson?: (existingJson: UpdateJSON, buffer: Buffer, signature: string, version: string, minVersion: string) => UpdateJSON | Promise<UpdateJSON>;
37
+ };
20
38
  type Options = {
21
39
  /**
22
40
  * whether is in build mode
@@ -123,22 +141,7 @@ type Options = {
123
141
  */
124
142
  days?: number;
125
143
  };
126
- overrideFunctions?: {
127
- /**
128
- * custom signature generate function {@link FunctionGenerateSignature}
129
- * @param buffer file buffer
130
- * @param privateKey private key
131
- * @param cert certificate
132
- */
133
- generateSignature?: FunctionGenerateSignature;
134
- /**
135
- * custom signature generate function {@link FunctionGenerateVersionJson}
136
- * @param signature generated signature
137
- * @param version currentVersion
138
- * @param cert certificate
139
- */
140
- generateVersionJson?: FunctionGenerateVersionJson;
141
- };
144
+ overrideFunctions?: GeneratorOverrideFunctions;
142
145
  };
143
146
  };
144
147
 
package/dist/vite.js CHANGED
@@ -76,10 +76,22 @@ function parseVersion(version) {
76
76
  throw new TypeError(`invalid version: ${version}`);
77
77
  }
78
78
  const [major, minor, patch] = match.slice(1, 4).map(Number);
79
- if (isNaN(major) || isNaN(minor) || isNaN(patch)) {
79
+ const ret = {
80
+ major,
81
+ minor,
82
+ patch,
83
+ stage: "",
84
+ stageVersion: -1
85
+ };
86
+ if (match[4]) {
87
+ let [stage, _v] = match[4].split(".");
88
+ ret.stage = stage;
89
+ ret.stageVersion = Number(_v) || -1;
90
+ }
91
+ if (isNaN(major) || isNaN(minor) || isNaN(patch) || isNaN(ret.stageVersion)) {
80
92
  throw new TypeError(`invalid version: ${version}`);
81
93
  }
82
- return { major, minor, patch, stage: match[4] };
94
+ return ret;
83
95
  }
84
96
 
85
97
  // src/updateJson.ts
package/dist/vite.mjs CHANGED
@@ -1,11 +1,14 @@
1
1
  import {
2
- isUpdateJSON,
3
2
  signature
4
- } from "./chunk-2XHZMWRR.mjs";
3
+ } from "./chunk-Q2K52LOG.mjs";
5
4
  import {
6
5
  parseVersion,
7
6
  zipFile
8
- } from "./chunk-SWXNCK6H.mjs";
7
+ } from "./chunk-4TION32M.mjs";
8
+ import {
9
+ isUpdateJSON
10
+ } from "./chunk-2JVXVTC5.mjs";
11
+ import "./chunk-ZFXKCRJC.mjs";
9
12
 
10
13
  // src/vite.ts
11
14
  import { createLogger } from "vite";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "electron-incremental-update",
3
3
  "author": "subframe7536",
4
- "version": "0.7.8",
4
+ "version": "0.7.9",
5
5
  "description": "electron incremental update tools, powered by vite",
6
6
  "scripts": {
7
7
  "build": "tsup && node fix-module.js",
@@ -58,4 +58,4 @@
58
58
  "ci-info": "^3.8.0",
59
59
  "selfsigned": "^2.1.1"
60
60
  }
61
- }
61
+ }