@wailsnet/plugin-fs-watch 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 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.
@@ -0,0 +1,23 @@
1
+ /**
2
+ * fs-watch 插件前端 API(命令前缀 `fswatch.*`)。
3
+ * 对应后端 Wails.Net.Plugins.FsWatch.FsWatchPlugin 注册的命令。
4
+ * 文件变化通过 `fswatch:changed:{id}` 事件推送到前端。
5
+ */
6
+ export declare const fsWatch: {
7
+ /**
8
+ * 开始监听指定路径的文件系统变化(对应 `fswatch.watch`)。
9
+ * @param path 要监听的目录路径。
10
+ * @param recursive 是否递归监听子目录。
11
+ * @param extensionsJson 文件扩展名过滤的 JSON 数组字符串(如 `[".txt",".json"]`),为 null 或空表示监听所有文件。
12
+ * @returns 监听器 ID;路径无效时返回 0。
13
+ */
14
+ watch: (path: string, recursive: boolean, extensionsJson?: string | null) => import("@wailsnet/runtime").CancellablePromise<number>;
15
+ /** 停止指定 ID 的监听器(对应 `fswatch.unwatch`)。 */
16
+ unwatch: (id: number) => import("@wailsnet/runtime").CancellablePromise<void>;
17
+ /** 停止所有监听器(对应 `fswatch.unwatchAll`)。 */
18
+ unwatchAll: () => import("@wailsnet/runtime").CancellablePromise<void>;
19
+ /** 获取所有活动监听器的 ID 数组(对应 `fswatch.listWatches`)。 */
20
+ listWatches: () => import("@wailsnet/runtime").CancellablePromise<number[]>;
21
+ /** 检查指定 ID 的监听器是否正在监听(对应 `fswatch.isWatching`)。 */
22
+ isWatching: (id: number) => import("@wailsnet/runtime").CancellablePromise<boolean>;
23
+ };
package/dist/index.js ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @wailsnet/plugin-fs-watch — fs-watch 插件前端封装。
3
+ * 命令前缀 `fswatch.*`(M3 runtime 变薄:从 @wailsnet/runtime 迁移至此,按需安装)。
4
+ * @platform windows,linux,macos,android 全平台通用插件。
5
+ */
6
+ import { call } from "@wailsnet/runtime";
7
+ /**
8
+ * fs-watch 插件前端 API(命令前缀 `fswatch.*`)。
9
+ * 对应后端 Wails.Net.Plugins.FsWatch.FsWatchPlugin 注册的命令。
10
+ * 文件变化通过 `fswatch:changed:{id}` 事件推送到前端。
11
+ */
12
+ export const fsWatch = {
13
+ /**
14
+ * 开始监听指定路径的文件系统变化(对应 `fswatch.watch`)。
15
+ * @param path 要监听的目录路径。
16
+ * @param recursive 是否递归监听子目录。
17
+ * @param extensionsJson 文件扩展名过滤的 JSON 数组字符串(如 `[".txt",".json"]`),为 null 或空表示监听所有文件。
18
+ * @returns 监听器 ID;路径无效时返回 0。
19
+ */
20
+ watch: (path, recursive, extensionsJson) => call("fswatch.watch", [path, recursive, extensionsJson ?? null]),
21
+ /** 停止指定 ID 的监听器(对应 `fswatch.unwatch`)。 */
22
+ unwatch: (id) => call("fswatch.unwatch", [id]),
23
+ /** 停止所有监听器(对应 `fswatch.unwatchAll`)。 */
24
+ unwatchAll: () => call("fswatch.unwatchAll", []),
25
+ /** 获取所有活动监听器的 ID 数组(对应 `fswatch.listWatches`)。 */
26
+ listWatches: () => call("fswatch.listWatches", []),
27
+ /** 检查指定 ID 的监听器是否正在监听(对应 `fswatch.isWatching`)。 */
28
+ isWatching: (id) => call("fswatch.isWatching", [id]),
29
+ };
package/package.json CHANGED
@@ -1,6 +1,31 @@
1
1
  {
2
2
  "name": "@wailsnet/plugin-fs-watch",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
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
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.