electron-incremental-update 3.0.0-beta.5 → 3.0.0
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 +338 -373
- package/dist/crypto-BSky88mL.cjs +259 -0
- package/dist/crypto-DZzMmoz2.mjs +164 -0
- package/dist/{download-BN4uMS4_.d.mts → download-BVmLiAvB.d.cts} +2 -2
- package/dist/download-BdX4fZYM.mjs +130 -0
- package/dist/{download-DO7iuxEJ.d.cts → download-GONr15zK.d.mts} +2 -2
- package/dist/download-KySXUyWC.cjs +165 -0
- package/dist/{electron-BJCk7uxG.mjs → electron-BrIF1urZ.mjs} +38 -13
- package/dist/electron-CaS0I3S2.cjs +346 -0
- package/dist/index.cjs +66 -34
- package/dist/index.d.cts +10 -13
- package/dist/index.d.mts +10 -13
- package/dist/index.mjs +62 -31
- package/dist/local-C5jw-7o5.mjs +105 -0
- package/dist/local-DbXBG1D9.cjs +118 -0
- package/dist/provider.cjs +24 -43
- package/dist/provider.d.cts +58 -20
- package/dist/provider.d.mts +58 -20
- package/dist/provider.mjs +12 -33
- package/dist/{types-BM9Jfu7q.d.cts → types-q78spjKB.d.cts} +22 -7
- package/dist/{types-DASqEPXE.d.mts → types-q78spjKB.d.mts} +22 -7
- package/dist/utils.cjs +22 -22
- package/dist/utils.d.cts +6 -6
- package/dist/utils.d.mts +6 -6
- package/dist/utils.mjs +4 -5
- package/dist/vite.d.mts +99 -110
- package/dist/vite.mjs +656 -732
- package/package.json +30 -35
- package/dist/electron-C-qmVhAt.cjs +0 -321
- package/dist/version--eVB2A7n.mjs +0 -72
- package/dist/version-aPrLuz_-.cjs +0 -129
- package/dist/zip-BCC7FAQ_.cjs +0 -264
- package/dist/zip-Dwm7s1C9.mjs +0 -185
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electron-incremental-update",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Electron incremental update tools with Vite plugin, support bytecode protection",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bytecode",
|
|
@@ -12,16 +12,10 @@
|
|
|
12
12
|
"author": "subframe7536",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/
|
|
15
|
+
"url": "git+https://github.com/electron-vite/electron-incremental-update.git"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
|
-
"dist"
|
|
19
|
-
"provider.d.ts",
|
|
20
|
-
"provider.js",
|
|
21
|
-
"utils.d.ts",
|
|
22
|
-
"utils.js",
|
|
23
|
-
"vite.d.ts",
|
|
24
|
-
"vite.js"
|
|
18
|
+
"dist"
|
|
25
19
|
],
|
|
26
20
|
"type": "module",
|
|
27
21
|
"main": "./dist/index.cjs",
|
|
@@ -39,16 +33,16 @@
|
|
|
39
33
|
},
|
|
40
34
|
"exports": {
|
|
41
35
|
".": {
|
|
42
|
-
"
|
|
43
|
-
"
|
|
36
|
+
"import": "./dist/index.mjs",
|
|
37
|
+
"require": "./dist/index.cjs"
|
|
44
38
|
},
|
|
45
39
|
"./provider": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
40
|
+
"import": "./dist/provider.mjs",
|
|
41
|
+
"require": "./dist/provider.cjs"
|
|
48
42
|
},
|
|
49
43
|
"./utils": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
44
|
+
"import": "./dist/utils.mjs",
|
|
45
|
+
"require": "./dist/utils.cjs"
|
|
52
46
|
},
|
|
53
47
|
"./vite": "./dist/vite.mjs",
|
|
54
48
|
"./package.json": "./package.json"
|
|
@@ -60,39 +54,40 @@
|
|
|
60
54
|
"scripts": {
|
|
61
55
|
"dev": "tsdown --watch",
|
|
62
56
|
"build": "tsdown",
|
|
63
|
-
"play": "vite",
|
|
57
|
+
"play": "bun run build && vite",
|
|
58
|
+
"play:build": "vite build",
|
|
64
59
|
"release": "bun run format && bun run lint && bun run test && bun run build && bumpp --all",
|
|
65
60
|
"test": "bun test --preload ./tests/setup.ts",
|
|
66
61
|
"test:dev": "bun test --watch",
|
|
67
62
|
"format": "oxfmt",
|
|
68
63
|
"lint": "oxlint --fix",
|
|
69
|
-
"qa": "
|
|
64
|
+
"qa": "bun run lint && bun run format && tsc --noEmit"
|
|
70
65
|
},
|
|
71
66
|
"dependencies": {
|
|
72
|
-
"@babel/plugin-transform-arrow-functions": "^7.
|
|
73
|
-
"@babel/plugin-transform-template-literals": "^7.
|
|
74
|
-
"ci-info": "^4.
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"selfsigned": "^5.5.0"
|
|
67
|
+
"@babel/plugin-transform-arrow-functions": "^7.29.7",
|
|
68
|
+
"@babel/plugin-transform-template-literals": "^7.29.7",
|
|
69
|
+
"ci-info": "^4.4.0",
|
|
70
|
+
"selfsigned": "^5.5.0",
|
|
71
|
+
"vite-plugin-electron": "~1.0.4"
|
|
78
72
|
},
|
|
79
73
|
"devDependencies": {
|
|
80
|
-
"@
|
|
74
|
+
"@subf/config": "^0.2.1",
|
|
75
|
+
"@tsdown/css": "^0.22.2",
|
|
81
76
|
"@types/babel__core": "^7.20.5",
|
|
82
|
-
"@types/bun": "^1.3.
|
|
83
|
-
"bumpp": "^
|
|
84
|
-
"electron": "
|
|
85
|
-
"oxfmt": "^0.
|
|
86
|
-
"oxlint": "^1.
|
|
87
|
-
"tsdown": "^0.
|
|
88
|
-
"typescript": "^
|
|
89
|
-
"vite": "^8.0.
|
|
77
|
+
"@types/bun": "^1.3.14",
|
|
78
|
+
"bumpp": "^11.1.0",
|
|
79
|
+
"electron": "42.2.0",
|
|
80
|
+
"oxfmt": "^0.54.0",
|
|
81
|
+
"oxlint": "^1.69.0",
|
|
82
|
+
"tsdown": "^0.22.2",
|
|
83
|
+
"typescript": "^6.0.3",
|
|
84
|
+
"vite": "^8.0.16"
|
|
90
85
|
},
|
|
91
86
|
"peerDependencies": {
|
|
92
|
-
"@babel/core": "^7",
|
|
93
|
-
"@electron/asar": "
|
|
87
|
+
"@babel/core": "^7.29.7",
|
|
88
|
+
"@electron/asar": "4.2.0"
|
|
94
89
|
},
|
|
95
90
|
"overrides": {
|
|
96
|
-
"
|
|
91
|
+
"@electron/get": "^5.0.0"
|
|
97
92
|
}
|
|
98
93
|
}
|
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
const require_version = require('./version-aPrLuz_-.cjs');
|
|
2
|
-
let electron = require("electron");
|
|
3
|
-
let node_fs = require("node:fs");
|
|
4
|
-
node_fs = require_version.__toESM(node_fs);
|
|
5
|
-
let node_path = require("node:path");
|
|
6
|
-
node_path = require_version.__toESM(node_path);
|
|
7
|
-
|
|
8
|
-
//#region src/utils/electron.ts
|
|
9
|
-
/**
|
|
10
|
-
* Compile time dev check
|
|
11
|
-
*/
|
|
12
|
-
const isDev = __EIU_IS_DEV__;
|
|
13
|
-
const isWin = process.platform === "win32";
|
|
14
|
-
const isMac = process.platform === "darwin";
|
|
15
|
-
const isLinux = process.platform === "linux";
|
|
16
|
-
/**
|
|
17
|
-
* Get joined path of `${electron.app.name}.asar` (not `app.asar`)
|
|
18
|
-
*
|
|
19
|
-
* If is in dev, **always** return `'DEV.asar'`
|
|
20
|
-
*/
|
|
21
|
-
function getPathFromAppNameAsar(...paths) {
|
|
22
|
-
return isDev ? "DEV.asar" : node_path.default.join(node_path.default.dirname(electron.app.getAppPath()), `${electron.app.name}.asar`, ...paths);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Get app version, if is in dev, return `getEntryVersion()`
|
|
26
|
-
*/
|
|
27
|
-
function getAppVersion() {
|
|
28
|
-
return isDev ? getEntryVersion() : node_fs.default.readFileSync(getPathFromAppNameAsar("version"), "utf-8");
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Get entry version
|
|
32
|
-
*/
|
|
33
|
-
function getEntryVersion() {
|
|
34
|
-
return electron.app.getVersion();
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Use `require` to load native module from entry asar
|
|
38
|
-
* @param moduleName file name in entry
|
|
39
|
-
* @example
|
|
40
|
-
* requireNative<typeof import('../native/db')>('db')
|
|
41
|
-
*/
|
|
42
|
-
function requireNative(moduleName) {
|
|
43
|
-
const m = getPathFromEntryAsar(moduleName);
|
|
44
|
-
if (__EIU_IS_ESM__) throw new Error(`Cannot require "${m}", \`requireNative\` only support CommonJS, use \`importNative\` instead`);
|
|
45
|
-
return require(m);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Use `import` to load native module from entry asar
|
|
49
|
-
* @param moduleName file name in entry
|
|
50
|
-
* @example
|
|
51
|
-
* await importNative<typeof import('../native/db')>('db')
|
|
52
|
-
*/
|
|
53
|
-
async function importNative(moduleName) {
|
|
54
|
-
const m = getPathFromEntryAsar(moduleName);
|
|
55
|
-
if (!__EIU_IS_ESM__) throw new Error(`Cannot import "${m}", \`importNative\` only support ESModule, use \`requireNative\` instead`);
|
|
56
|
-
return await import(`file://${m}.js`);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Restarts the Electron app.
|
|
60
|
-
*/
|
|
61
|
-
function restartApp() {
|
|
62
|
-
electron.app.relaunch();
|
|
63
|
-
electron.app.quit();
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Fix app use model id, only for Windows
|
|
67
|
-
* @param id app id, default is `org.${electron.app.name}`
|
|
68
|
-
*/
|
|
69
|
-
function setAppUserModelId(id) {
|
|
70
|
-
if (isWin) electron.app.setAppUserModelId(id ?? `org.${electron.app.name}`);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Disable hardware acceleration for Windows 7
|
|
74
|
-
*
|
|
75
|
-
* Only support CommonJS
|
|
76
|
-
*/
|
|
77
|
-
function disableHWAccForWin7() {
|
|
78
|
-
if (!__EIU_IS_ESM__ && require("node:os").release().startsWith("6.1")) electron.app.disableHardwareAcceleration();
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Keep single electron instance and auto restore window on `second-instance` event
|
|
82
|
-
* @param window brwoser window to show
|
|
83
|
-
*/
|
|
84
|
-
function singleInstance(window) {
|
|
85
|
-
electron.app.on("second-instance", () => {
|
|
86
|
-
if (window) {
|
|
87
|
-
window.show();
|
|
88
|
-
if (window.isMinimized()) window.restore();
|
|
89
|
-
window.focus();
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Set `userData` dir to the dir of .exe file
|
|
95
|
-
*
|
|
96
|
-
* Useful for portable Windows app
|
|
97
|
-
* @param dirName dir name, default to `data`
|
|
98
|
-
* @param create whether to create dir, default to `true`
|
|
99
|
-
*/
|
|
100
|
-
function setPortableDataPath(dirName = "data", create = true) {
|
|
101
|
-
if (electron.app.isReady()) throw new Error("Portable app data dir must be setup before app is ready");
|
|
102
|
-
const portableDir = node_path.default.join(node_path.default.dirname(electron.app.getPath("exe")), dirName);
|
|
103
|
-
if (create) {
|
|
104
|
-
if (!node_fs.default.existsSync(portableDir)) node_fs.default.mkdirSync(portableDir);
|
|
105
|
-
else if (!node_fs.default.statSync(portableDir).isDirectory()) {
|
|
106
|
-
node_fs.default.rmSync(portableDir);
|
|
107
|
-
node_fs.default.mkdirSync(portableDir);
|
|
108
|
-
}
|
|
109
|
-
} else if (!node_fs.default.existsSync(portableDir)) throw new Error("Portable app data dir does not exists");
|
|
110
|
-
electron.app.setPath("userData", portableDir);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* @deprecated Use {@link setPortableDataPath} instead
|
|
114
|
-
*/
|
|
115
|
-
const setPortableAppDataPath = setPortableDataPath;
|
|
116
|
-
/**
|
|
117
|
-
* Load `process.env.VITE_DEV_SERVER_URL` when dev, else load html file
|
|
118
|
-
* @param win window
|
|
119
|
-
* @param htmlFilePath html file path, default is `index.html`
|
|
120
|
-
*/
|
|
121
|
-
function loadPage(win, htmlFilePath = "index.html") {
|
|
122
|
-
if (isDev) win.loadURL(process.env.VITE_DEV_SERVER_URL + htmlFilePath);
|
|
123
|
-
else win.loadFile(getPathFromAppNameAsar("renderer", htmlFilePath));
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Beautify devtools' font and scrollbar
|
|
127
|
-
* @param win target window
|
|
128
|
-
* @param options sans font family, mono font family and scrollbar
|
|
129
|
-
* @see https://github.com/electron/electron/issues/42055
|
|
130
|
-
*/
|
|
131
|
-
function beautifyDevTools(win, options) {
|
|
132
|
-
const { mono, sans, scrollbar = true } = options;
|
|
133
|
-
win.webContents.on("devtools-opened", async () => {
|
|
134
|
-
let css = `:root{--sans:${sans};--mono:${mono}}:root, body { --source-code-font-family: var(--mono) !important; --source-code-font-size: 12px !important; --monospace-font-family: var(--mono) !important; --monospace-font-size: 12px !important; --default-font-family: var(--sans), sans-serif !important; --default-font-size: 12px !important; } button, input, select, .undisplayable-text, .expandable-inline-button { font-family: var(--sans) !important; } `;
|
|
135
|
-
if (scrollbar) css += ":root { --scrollbar-width: max(0.85vw, 10px); } @media (prefers-color-scheme: light) { :root { --scrollbar-color-rgb: 0, 0, 0; } } @media (prefers-color-scheme: dark) { :root { --scrollbar-color-rgb: 255, 255, 255; } } *::-webkit-scrollbar { width: var(--scrollbar-width) !important; height: var(--scrollbar-width) !important; } *::-webkit-scrollbar-track { background-color: transparent !important; border-radius: var(--scrollbar-width) !important; box-shadow: none !important; } *::-webkit-scrollbar-thumb { box-shadow: inset 0 0 0 var(--scrollbar-width) !important; border-radius: var(--scrollbar-width) !important; border: calc(var(--scrollbar-width) * 2 / 9) solid transparent !important; background-clip: content-box; background-color: transparent !important; color: rgba(var(--scrollbar-color-rgb), 30%) !important; } *::-webkit-scrollbar-thumb:hover { color: rgba(var(--scrollbar-color-rgb), 45%) !important; } *::-webkit-scrollbar-thumb:active { color: rgba(var(--scrollbar-color-rgb), 60%) !important; } @supports not selector(::-webkit-scrollbar) { html { scrollbar-color: rgb(var(--scrollbar-color-rgb)); scrollbar-width: thin; } } ";
|
|
136
|
-
const js = `const __CSS__='${css}';function e(e){let t=document.createElement(\`style\`);t.innerHTML=e,document.body.append(t),[\`platform-windows\`,\`platform-mac\`,\`platform-linux\`].forEach(e=>document.querySelectorAll(\`.\${e}\`).forEach(t=>t.classList.remove(e))),r();let n=new MutationObserver(e=>{for(let t of e)if(t.type===\`childList\`)for(let e=0;e<t.addedNodes.length;e++)t.addedNodes[e].classList.contains(\`editor-tooltip-host\`)&&r()});n.observe(document.body,{childList:!0});function r(){document.querySelectorAll(\`.editor-tooltip-host\`).forEach(t=>{if(t?.shadowRoot?.querySelectorAll(\`[data-key="overridden-dev-tools-font"]\`).length===0){let n=document.createElement(\`style\`);n.dataset.key=\`overridden-dev-tools-font\`,n.innerHTML=\`\${e}.cm-tooltip-autocomplete ul[role=listbox]{font-family:var(--mono)!important;}\`,t.shadowRoot.append(n)}})}window.onbeforeunload=()=>n.disconnect()}e(__CSS__);`;
|
|
137
|
-
await win?.webContents.devToolsWebContents?.executeJavaScript(js);
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Get joined path from main dir
|
|
142
|
-
* @param paths rest paths
|
|
143
|
-
*/
|
|
144
|
-
function getPathFromMain(...paths) {
|
|
145
|
-
return isDev ? node_path.default.join(electron.app.getAppPath(), __EIU_ELECTRON_DIST_PATH__, "main", ...paths) : getPathFromAppNameAsar("main", ...paths);
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Get joined path from preload dir
|
|
149
|
-
* @param paths rest paths
|
|
150
|
-
*/
|
|
151
|
-
function getPathFromPreload(...paths) {
|
|
152
|
-
return isDev ? node_path.default.join(electron.app.getAppPath(), __EIU_ELECTRON_DIST_PATH__, "preload", ...paths) : getPathFromAppNameAsar("preload", ...paths);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Get joined path from publich dir
|
|
156
|
-
* @param paths rest paths
|
|
157
|
-
*/
|
|
158
|
-
function getPathFromPublic(...paths) {
|
|
159
|
-
return isDev ? node_path.default.join(electron.app.getAppPath(), "public", ...paths) : getPathFromAppNameAsar("renderer", ...paths);
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Get joined path from entry asar
|
|
163
|
-
* @param paths rest paths
|
|
164
|
-
*/
|
|
165
|
-
function getPathFromEntryAsar(...paths) {
|
|
166
|
-
return node_path.default.join(electron.app.getAppPath(), __EIU_ENTRY_DIST_PATH__, ...paths);
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Handle all unhandled error
|
|
170
|
-
* @param callback callback function
|
|
171
|
-
*/
|
|
172
|
-
function handleUnexpectedErrors(callback) {
|
|
173
|
-
process.on("uncaughtException", callback);
|
|
174
|
-
process.on("unhandledRejection", callback);
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* @deprecated No longer needed. It is embeded in `startupWithUpdater()`
|
|
178
|
-
*/
|
|
179
|
-
function reloadOnPreloadScriptChanged() {
|
|
180
|
-
console.warn("`reloadOnPreloadScriptChange()` is no longer needed. It is embeded in `startupWithUpdater()`");
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
//#endregion
|
|
184
|
-
Object.defineProperty(exports, 'beautifyDevTools', {
|
|
185
|
-
enumerable: true,
|
|
186
|
-
get: function () {
|
|
187
|
-
return beautifyDevTools;
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
Object.defineProperty(exports, 'disableHWAccForWin7', {
|
|
191
|
-
enumerable: true,
|
|
192
|
-
get: function () {
|
|
193
|
-
return disableHWAccForWin7;
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
Object.defineProperty(exports, 'getAppVersion', {
|
|
197
|
-
enumerable: true,
|
|
198
|
-
get: function () {
|
|
199
|
-
return getAppVersion;
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
Object.defineProperty(exports, 'getEntryVersion', {
|
|
203
|
-
enumerable: true,
|
|
204
|
-
get: function () {
|
|
205
|
-
return getEntryVersion;
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
Object.defineProperty(exports, 'getPathFromAppNameAsar', {
|
|
209
|
-
enumerable: true,
|
|
210
|
-
get: function () {
|
|
211
|
-
return getPathFromAppNameAsar;
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
Object.defineProperty(exports, 'getPathFromEntryAsar', {
|
|
215
|
-
enumerable: true,
|
|
216
|
-
get: function () {
|
|
217
|
-
return getPathFromEntryAsar;
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
Object.defineProperty(exports, 'getPathFromMain', {
|
|
221
|
-
enumerable: true,
|
|
222
|
-
get: function () {
|
|
223
|
-
return getPathFromMain;
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
Object.defineProperty(exports, 'getPathFromPreload', {
|
|
227
|
-
enumerable: true,
|
|
228
|
-
get: function () {
|
|
229
|
-
return getPathFromPreload;
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
Object.defineProperty(exports, 'getPathFromPublic', {
|
|
233
|
-
enumerable: true,
|
|
234
|
-
get: function () {
|
|
235
|
-
return getPathFromPublic;
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
Object.defineProperty(exports, 'handleUnexpectedErrors', {
|
|
239
|
-
enumerable: true,
|
|
240
|
-
get: function () {
|
|
241
|
-
return handleUnexpectedErrors;
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
Object.defineProperty(exports, 'importNative', {
|
|
245
|
-
enumerable: true,
|
|
246
|
-
get: function () {
|
|
247
|
-
return importNative;
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
Object.defineProperty(exports, 'isDev', {
|
|
251
|
-
enumerable: true,
|
|
252
|
-
get: function () {
|
|
253
|
-
return isDev;
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
Object.defineProperty(exports, 'isLinux', {
|
|
257
|
-
enumerable: true,
|
|
258
|
-
get: function () {
|
|
259
|
-
return isLinux;
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
Object.defineProperty(exports, 'isMac', {
|
|
263
|
-
enumerable: true,
|
|
264
|
-
get: function () {
|
|
265
|
-
return isMac;
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
Object.defineProperty(exports, 'isWin', {
|
|
269
|
-
enumerable: true,
|
|
270
|
-
get: function () {
|
|
271
|
-
return isWin;
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
Object.defineProperty(exports, 'loadPage', {
|
|
275
|
-
enumerable: true,
|
|
276
|
-
get: function () {
|
|
277
|
-
return loadPage;
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
Object.defineProperty(exports, 'reloadOnPreloadScriptChanged', {
|
|
281
|
-
enumerable: true,
|
|
282
|
-
get: function () {
|
|
283
|
-
return reloadOnPreloadScriptChanged;
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
Object.defineProperty(exports, 'requireNative', {
|
|
287
|
-
enumerable: true,
|
|
288
|
-
get: function () {
|
|
289
|
-
return requireNative;
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
Object.defineProperty(exports, 'restartApp', {
|
|
293
|
-
enumerable: true,
|
|
294
|
-
get: function () {
|
|
295
|
-
return restartApp;
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
Object.defineProperty(exports, 'setAppUserModelId', {
|
|
299
|
-
enumerable: true,
|
|
300
|
-
get: function () {
|
|
301
|
-
return setAppUserModelId;
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
Object.defineProperty(exports, 'setPortableAppDataPath', {
|
|
305
|
-
enumerable: true,
|
|
306
|
-
get: function () {
|
|
307
|
-
return setPortableAppDataPath;
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
Object.defineProperty(exports, 'setPortableDataPath', {
|
|
311
|
-
enumerable: true,
|
|
312
|
-
get: function () {
|
|
313
|
-
return setPortableDataPath;
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
Object.defineProperty(exports, 'singleInstance', {
|
|
317
|
-
enumerable: true,
|
|
318
|
-
get: function () {
|
|
319
|
-
return singleInstance;
|
|
320
|
-
}
|
|
321
|
-
});
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
//#region src/utils/version.ts
|
|
2
|
-
/**
|
|
3
|
-
* Parse version string to {@link Version}, like `0.2.0-beta.1`
|
|
4
|
-
* @param version version string
|
|
5
|
-
*/
|
|
6
|
-
function parseVersion(version) {
|
|
7
|
-
const match = /^(\d+)\.(\d+)\.(\d+)(?:-([a-z0-9.-]+))?/i.exec(version);
|
|
8
|
-
if (!match) throw new TypeError(`invalid version: ${version}`);
|
|
9
|
-
const [major, minor, patch] = match.slice(1, 4).map(Number);
|
|
10
|
-
const ret = {
|
|
11
|
-
major,
|
|
12
|
-
minor,
|
|
13
|
-
patch,
|
|
14
|
-
stage: "",
|
|
15
|
-
stageVersion: -1
|
|
16
|
-
};
|
|
17
|
-
if (match[4]) {
|
|
18
|
-
let [stage, _v] = match[4].split(".");
|
|
19
|
-
ret.stage = stage;
|
|
20
|
-
ret.stageVersion = Number(_v) || -1;
|
|
21
|
-
}
|
|
22
|
-
if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch) || Number.isNaN(ret.stageVersion)) throw new TypeError(`Invalid version: ${version}`);
|
|
23
|
-
return ret;
|
|
24
|
-
}
|
|
25
|
-
function compareStrings(str1, str2) {
|
|
26
|
-
if (str1 === "") return str2 !== "";
|
|
27
|
-
else if (str2 === "") return true;
|
|
28
|
-
return str1 < str2;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Default function to check the old version is less than new version
|
|
32
|
-
* @param oldVer old version string
|
|
33
|
-
* @param newVer new version string
|
|
34
|
-
*/
|
|
35
|
-
function defaultIsLowerVersion(oldVer, newVer) {
|
|
36
|
-
const oldV = parseVersion(oldVer);
|
|
37
|
-
const newV = parseVersion(newVer);
|
|
38
|
-
for (let key of Object.keys(oldV)) if (key === "stage" && compareStrings(oldV[key], newV[key])) return true;
|
|
39
|
-
else if (oldV[key] !== newV[key]) return oldV[key] < newV[key];
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
const is = (j) => !!(j && j.minimumVersion && j.signature && j.version);
|
|
43
|
-
/**
|
|
44
|
-
* Check is `UpdateJSON`
|
|
45
|
-
* @param json any variable
|
|
46
|
-
*/
|
|
47
|
-
function isUpdateJSON(json) {
|
|
48
|
-
return is(json) && is(json?.beta);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Default function to generate `UpdateJSON`
|
|
52
|
-
* @param existingJson exising update json
|
|
53
|
-
* @param signature sigature
|
|
54
|
-
* @param version target version
|
|
55
|
-
* @param minimumVersion minimum version
|
|
56
|
-
*/
|
|
57
|
-
function defaultVersionJsonGenerator(existingJson, signature, version, minimumVersion) {
|
|
58
|
-
existingJson.beta = {
|
|
59
|
-
version,
|
|
60
|
-
minimumVersion,
|
|
61
|
-
signature
|
|
62
|
-
};
|
|
63
|
-
if (!parseVersion(version).stage) {
|
|
64
|
-
existingJson.version = version;
|
|
65
|
-
existingJson.minimumVersion = minimumVersion;
|
|
66
|
-
existingJson.signature = signature;
|
|
67
|
-
}
|
|
68
|
-
return existingJson;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
//#endregion
|
|
72
|
-
export { parseVersion as i, defaultVersionJsonGenerator as n, isUpdateJSON as r, defaultIsLowerVersion as t };
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
|
|
29
|
-
//#region src/utils/version.ts
|
|
30
|
-
/**
|
|
31
|
-
* Parse version string to {@link Version}, like `0.2.0-beta.1`
|
|
32
|
-
* @param version version string
|
|
33
|
-
*/
|
|
34
|
-
function parseVersion(version) {
|
|
35
|
-
const match = /^(\d+)\.(\d+)\.(\d+)(?:-([a-z0-9.-]+))?/i.exec(version);
|
|
36
|
-
if (!match) throw new TypeError(`invalid version: ${version}`);
|
|
37
|
-
const [major, minor, patch] = match.slice(1, 4).map(Number);
|
|
38
|
-
const ret = {
|
|
39
|
-
major,
|
|
40
|
-
minor,
|
|
41
|
-
patch,
|
|
42
|
-
stage: "",
|
|
43
|
-
stageVersion: -1
|
|
44
|
-
};
|
|
45
|
-
if (match[4]) {
|
|
46
|
-
let [stage, _v] = match[4].split(".");
|
|
47
|
-
ret.stage = stage;
|
|
48
|
-
ret.stageVersion = Number(_v) || -1;
|
|
49
|
-
}
|
|
50
|
-
if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch) || Number.isNaN(ret.stageVersion)) throw new TypeError(`Invalid version: ${version}`);
|
|
51
|
-
return ret;
|
|
52
|
-
}
|
|
53
|
-
function compareStrings(str1, str2) {
|
|
54
|
-
if (str1 === "") return str2 !== "";
|
|
55
|
-
else if (str2 === "") return true;
|
|
56
|
-
return str1 < str2;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Default function to check the old version is less than new version
|
|
60
|
-
* @param oldVer old version string
|
|
61
|
-
* @param newVer new version string
|
|
62
|
-
*/
|
|
63
|
-
function defaultIsLowerVersion(oldVer, newVer) {
|
|
64
|
-
const oldV = parseVersion(oldVer);
|
|
65
|
-
const newV = parseVersion(newVer);
|
|
66
|
-
for (let key of Object.keys(oldV)) if (key === "stage" && compareStrings(oldV[key], newV[key])) return true;
|
|
67
|
-
else if (oldV[key] !== newV[key]) return oldV[key] < newV[key];
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
const is = (j) => !!(j && j.minimumVersion && j.signature && j.version);
|
|
71
|
-
/**
|
|
72
|
-
* Check is `UpdateJSON`
|
|
73
|
-
* @param json any variable
|
|
74
|
-
*/
|
|
75
|
-
function isUpdateJSON(json) {
|
|
76
|
-
return is(json) && is(json?.beta);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Default function to generate `UpdateJSON`
|
|
80
|
-
* @param existingJson exising update json
|
|
81
|
-
* @param signature sigature
|
|
82
|
-
* @param version target version
|
|
83
|
-
* @param minimumVersion minimum version
|
|
84
|
-
*/
|
|
85
|
-
function defaultVersionJsonGenerator(existingJson, signature, version, minimumVersion) {
|
|
86
|
-
existingJson.beta = {
|
|
87
|
-
version,
|
|
88
|
-
minimumVersion,
|
|
89
|
-
signature
|
|
90
|
-
};
|
|
91
|
-
if (!parseVersion(version).stage) {
|
|
92
|
-
existingJson.version = version;
|
|
93
|
-
existingJson.minimumVersion = minimumVersion;
|
|
94
|
-
existingJson.signature = signature;
|
|
95
|
-
}
|
|
96
|
-
return existingJson;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
//#endregion
|
|
100
|
-
Object.defineProperty(exports, '__toESM', {
|
|
101
|
-
enumerable: true,
|
|
102
|
-
get: function () {
|
|
103
|
-
return __toESM;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
Object.defineProperty(exports, 'defaultIsLowerVersion', {
|
|
107
|
-
enumerable: true,
|
|
108
|
-
get: function () {
|
|
109
|
-
return defaultIsLowerVersion;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
Object.defineProperty(exports, 'defaultVersionJsonGenerator', {
|
|
113
|
-
enumerable: true,
|
|
114
|
-
get: function () {
|
|
115
|
-
return defaultVersionJsonGenerator;
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
Object.defineProperty(exports, 'isUpdateJSON', {
|
|
119
|
-
enumerable: true,
|
|
120
|
-
get: function () {
|
|
121
|
-
return isUpdateJSON;
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
Object.defineProperty(exports, 'parseVersion', {
|
|
125
|
-
enumerable: true,
|
|
126
|
-
get: function () {
|
|
127
|
-
return parseVersion;
|
|
128
|
-
}
|
|
129
|
-
});
|