@tauri-apps/plugin-fs 2.0.0-alpha.6 → 2.0.0-beta.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 CHANGED
@@ -18,7 +18,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
18
18
 
19
19
  ```toml
20
20
  [dependencies]
21
- tauri-plugin-fs = "2.0.0-alpha"
21
+ tauri-plugin-fs = "2.0.0-beta"
22
22
  # alternatively with Git:
23
23
  tauri-plugin-fs = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
24
24
  ```
package/dist-js/index.cjs CHANGED
@@ -699,7 +699,7 @@ async function watchImmediate(paths, cb, options) {
699
699
  };
700
700
  }
701
701
 
702
- Object.defineProperty(exports, 'BaseDirectory', {
702
+ Object.defineProperty(exports, "BaseDirectory", {
703
703
  enumerable: true,
704
704
  get: function () { return path.BaseDirectory; }
705
705
  });
@@ -737,33 +737,78 @@ interface DebouncedWatchOptions extends WatchOptions {
737
737
  /**
738
738
  * @since 2.0.0
739
739
  */
740
- type RawEvent = {
741
- type: RawEventKind;
740
+ type WatchEvent = {
741
+ type: WatchEventKind;
742
742
  paths: string[];
743
743
  attrs: unknown;
744
744
  };
745
745
  /**
746
746
  * @since 2.0.0
747
747
  */
748
- type RawEventKind = "any " | {
749
- access?: unknown;
748
+ type WatchEventKind = "any" | {
749
+ access: WatchEventKindAccess;
750
750
  } | {
751
- create?: unknown;
751
+ create: WatchEventKindCreate;
752
752
  } | {
753
- modify?: unknown;
753
+ modify: WatchEventKindModify;
754
754
  } | {
755
- remove?: unknown;
755
+ remove: WatchEventKindRemove;
756
756
  } | "other";
757
757
  /**
758
758
  * @since 2.0.0
759
759
  */
760
- type DebouncedEvent = {
761
- kind: "Any";
762
- path: string;
763
- }[] | {
764
- kind: "AnyContinuous";
765
- path: string;
766
- }[];
760
+ type WatchEventKindAccess = {
761
+ kind: "any";
762
+ } | {
763
+ kind: "close";
764
+ mode: "any" | "execute" | "read" | "write" | "other";
765
+ } | {
766
+ kind: "open";
767
+ mode: "any" | "execute" | "read" | "write" | "other";
768
+ } | {
769
+ kind: "other";
770
+ };
771
+ /**
772
+ * @since 2.0.0
773
+ */
774
+ type WatchEventKindCreate = {
775
+ kind: "any";
776
+ } | {
777
+ kind: "file";
778
+ } | {
779
+ kind: "folder";
780
+ } | {
781
+ kind: "other";
782
+ };
783
+ /**
784
+ * @since 2.0.0
785
+ */
786
+ type WatchEventKindModify = {
787
+ kind: "any";
788
+ } | {
789
+ kind: "data";
790
+ mode: "any" | "size" | "content" | "other";
791
+ } | {
792
+ kind: "metadata";
793
+ mode: "any" | "access-time" | "write-time" | "permissions" | "ownership" | "extended" | "other";
794
+ } | {
795
+ kind: "name";
796
+ mode: "any" | "to" | "from" | "both" | "other";
797
+ } | {
798
+ kind: "other";
799
+ };
800
+ /**
801
+ * @since 2.0.0
802
+ */
803
+ type WatchEventKindRemove = {
804
+ kind: "any";
805
+ } | {
806
+ kind: "file";
807
+ } | {
808
+ kind: "folder";
809
+ } | {
810
+ kind: "other";
811
+ };
767
812
  /**
768
813
  * @since 2.0.0
769
814
  */
@@ -773,12 +818,12 @@ type UnwatchFn = () => void;
773
818
  *
774
819
  * @since 2.0.0
775
820
  */
776
- declare function watch(paths: string | string[] | URL | URL[], cb: (event: DebouncedEvent) => void, options?: DebouncedWatchOptions): Promise<UnwatchFn>;
821
+ declare function watch(paths: string | string[] | URL | URL[], cb: (event: WatchEvent) => void, options?: DebouncedWatchOptions): Promise<UnwatchFn>;
777
822
  /**
778
823
  * Watch changes on files or directories.
779
824
  *
780
825
  * @since 2.0.0
781
826
  */
782
- declare function watchImmediate(paths: string | string[] | URL | URL[], cb: (event: RawEvent) => void, options?: WatchOptions): Promise<UnwatchFn>;
783
- export type { CreateOptions, OpenOptions, CopyFileOptions, MkdirOptions, DirEntry, ReadDirOptions, ReadFileOptions, RemoveOptions, RenameOptions, StatOptions, TruncateOptions, WriteFileOptions, ExistsOptions, FileInfo, WatchOptions, DebouncedWatchOptions, DebouncedEvent, RawEvent, UnwatchFn, };
827
+ declare function watchImmediate(paths: string | string[] | URL | URL[], cb: (event: WatchEvent) => void, options?: WatchOptions): Promise<UnwatchFn>;
828
+ export type { CreateOptions, OpenOptions, CopyFileOptions, MkdirOptions, DirEntry, ReadDirOptions, ReadFileOptions, RemoveOptions, RenameOptions, StatOptions, TruncateOptions, WriteFileOptions, ExistsOptions, FileInfo, WatchOptions, DebouncedWatchOptions, WatchEvent, WatchEventKind, WatchEventKindAccess, WatchEventKindCreate, WatchEventKindModify, WatchEventKindRemove, UnwatchFn, };
784
829
  export { BaseDirectory, FileHandle, create, open, copyFile, mkdir, readDir, readFile, readTextFile, readTextFileLines, remove, rename, SeekMode, stat, lstat, truncate, writeFile, writeTextFile, exists, watch, watchImmediate, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tauri-apps/plugin-fs",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.0-beta.0",
4
4
  "description": "Access the file system.",
5
5
  "license": "MIT or APACHE-2.0",
6
6
  "authors": [
@@ -21,7 +21,7 @@
21
21
  "LICENSE"
22
22
  ],
23
23
  "dependencies": {
24
- "@tauri-apps/api": "2.0.0-alpha.13"
24
+ "@tauri-apps/api": "2.0.0-beta.0"
25
25
  },
26
26
  "scripts": {
27
27
  "build": "rollup -c"