@wailsnet/plugin-updater 0.0.0-stage → 0.1.0-alpha.1
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/LICENSE +21 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +20 -0
- package/package.json +28 -3
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Wails.Net Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** 更新检查结果(`updater.check` 返回的 JSON 解析结果)。 */
|
|
2
|
+
export interface UpdateCheckResult {
|
|
3
|
+
/** 最新版本号。 */
|
|
4
|
+
version: string;
|
|
5
|
+
/** 是否有可用更新。 */
|
|
6
|
+
available: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** 检查并下载结果(`updater.checkAndDownload` 返回的 JSON 解析结果)。 */
|
|
9
|
+
export interface CheckAndDownloadResult {
|
|
10
|
+
/** 最新版本号。 */
|
|
11
|
+
version: string;
|
|
12
|
+
/** 是否有可用更新。 */
|
|
13
|
+
available: boolean;
|
|
14
|
+
/** 下载文件的本地路径;无可下载地址时为 null。 */
|
|
15
|
+
path: string | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* updater 插件前端 API(命令前缀 `updater.*`)。
|
|
19
|
+
* 对应后端 Wails.Net.Plugins.Updater.UpdaterPlugin 注册的命令。
|
|
20
|
+
*/
|
|
21
|
+
export declare const updater: {
|
|
22
|
+
/** 检查是否有可用更新(对应 `updater.check`)。 */
|
|
23
|
+
check: () => Promise<UpdateCheckResult>;
|
|
24
|
+
/** 下载更新包,返回下载文件的本地路径(对应 `updater.download`)。 */
|
|
25
|
+
download: () => import("@wailsnet/runtime").CancellablePromise<string>;
|
|
26
|
+
/** 安装指定路径的更新包(对应 `updater.install`)。 */
|
|
27
|
+
install: (archivePath: string) => import("@wailsnet/runtime").CancellablePromise<void>;
|
|
28
|
+
/** 检查并下载更新,返回版本、可用性与下载路径(对应 `updater.checkAndDownload`)。 */
|
|
29
|
+
checkAndDownload: () => Promise<CheckAndDownloadResult>;
|
|
30
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @wailsnet/plugin-updater — updater 插件前端封装。
|
|
3
|
+
* 命令前缀 `updater.*`(M3 runtime 变薄:从 @wailsnet/runtime 迁移至此,按需安装)。
|
|
4
|
+
* @platform windows,linux,macos,android 全平台通用插件。
|
|
5
|
+
*/
|
|
6
|
+
import { call } from "@wailsnet/runtime";
|
|
7
|
+
/**
|
|
8
|
+
* updater 插件前端 API(命令前缀 `updater.*`)。
|
|
9
|
+
* 对应后端 Wails.Net.Plugins.Updater.UpdaterPlugin 注册的命令。
|
|
10
|
+
*/
|
|
11
|
+
export const updater = {
|
|
12
|
+
/** 检查是否有可用更新(对应 `updater.check`)。 */
|
|
13
|
+
check: () => call("updater.check", []).then((json) => JSON.parse(json)),
|
|
14
|
+
/** 下载更新包,返回下载文件的本地路径(对应 `updater.download`)。 */
|
|
15
|
+
download: () => call("updater.download", []),
|
|
16
|
+
/** 安装指定路径的更新包(对应 `updater.install`)。 */
|
|
17
|
+
install: (archivePath) => call("updater.install", [archivePath]),
|
|
18
|
+
/** 检查并下载更新,返回版本、可用性与下载路径(对应 `updater.checkAndDownload`)。 */
|
|
19
|
+
checkAndDownload: () => call("updater.checkAndDownload", []).then((json) => JSON.parse(json)),
|
|
20
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wailsnet/plugin-updater",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@wailsnet/runtime": "0.1.0-alpha.1"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"typescript": "^5.9.3"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public",
|
|
25
|
+
"registry": "https://registry.npmjs.org"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc -p tsconfig.json",
|
|
29
|
+
"typecheck": "tsc --noEmit"
|
|
30
|
+
}
|
|
6
31
|
}
|
package/README.md
DELETED