@gesslar/toolkit 4.0.0 → 4.2.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.
Files changed (38) hide show
  1. package/README.md +1 -0
  2. package/package.json +4 -4
  3. package/src/browser/lib/Data.js +4 -4
  4. package/src/browser/lib/TypeSpec.js +115 -39
  5. package/src/node/index.js +2 -1
  6. package/src/node/lib/Cache.js +105 -35
  7. package/src/node/lib/Data.js +49 -0
  8. package/src/node/lib/DirectoryObject.js +4 -7
  9. package/src/node/lib/FileObject.js +89 -53
  10. package/src/node/lib/FileSystem.js +47 -2
  11. package/src/node/lib/Font.js +1 -1
  12. package/src/node/lib/Notify.js +26 -6
  13. package/src/node/lib/Term.js +1 -1
  14. package/src/node/lib/Util.js +47 -5
  15. package/src/node/lib/Watcher.js +118 -0
  16. package/types/browser/lib/Data.d.ts +2 -8
  17. package/types/browser/lib/Data.d.ts.map +1 -1
  18. package/types/browser/lib/TypeSpec.d.ts +21 -36
  19. package/types/browser/lib/TypeSpec.d.ts.map +1 -1
  20. package/types/node/index.d.ts +2 -1
  21. package/types/node/lib/Cache.d.ts +36 -5
  22. package/types/node/lib/Cache.d.ts.map +1 -1
  23. package/types/node/lib/Data.d.ts +19 -0
  24. package/types/node/lib/Data.d.ts.map +1 -0
  25. package/types/node/lib/DirectoryObject.d.ts +6 -5
  26. package/types/node/lib/DirectoryObject.d.ts.map +1 -1
  27. package/types/node/lib/FileObject.d.ts +54 -26
  28. package/types/node/lib/FileObject.d.ts.map +1 -1
  29. package/types/node/lib/FileSystem.d.ts +19 -0
  30. package/types/node/lib/FileSystem.d.ts.map +1 -1
  31. package/types/node/lib/Notify.d.ts +23 -10
  32. package/types/node/lib/Notify.d.ts.map +1 -1
  33. package/types/node/lib/Term.d.ts +2 -2
  34. package/types/node/lib/Term.d.ts.map +1 -1
  35. package/types/node/lib/Util.d.ts +20 -6
  36. package/types/node/lib/Util.d.ts.map +1 -1
  37. package/types/node/lib/Watcher.d.ts +38 -0
  38. package/types/node/lib/Watcher.d.ts.map +1 -0
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @import FileObject from "./FileObject.js"
3
+ * @import DirectoryObject from "./DirectoryObject.js"
4
+ */
5
+ export const OverFlowBehaviour: Readonly<{
6
+ IGNORE: "ignore";
7
+ THROW: "throw";
8
+ }>;
9
+ export default class Watcher {
10
+ /**
11
+ * Watch one or more file/directory targets for changes, invoking a callback
12
+ * with debounce protection.
13
+ *
14
+ * @param {FileObject|DirectoryObject|Array.<(FileObject|DirectoryObject)>} targets - The target(s) to watch
15
+ * @param {object} options - Watch options
16
+ * @param {(target: FileObject|DirectoryObject) => void} options.onChange - Callback invoked on change
17
+ * @param {number} [options.debounceMs=50] - Debounce interval in milliseconds
18
+ * @param {boolean} [options.persistent=true] - Keep the process alive while watching
19
+ * @param {boolean} [options.recursive=false] - Watch subdirectories (directories only)
20
+ * @param {string} [options.overflow="ignore"] - Overflow behaviour ("ignore" or "throw")
21
+ * @returns {Promise<undefined>}
22
+ */
23
+ watch(targets: FileObject | DirectoryObject | Array<(FileObject | DirectoryObject)>, { onChange, debounceMs, persistent, recursive, overflow }?: {
24
+ onChange: (target: FileObject | DirectoryObject) => void;
25
+ debounceMs?: number;
26
+ persistent?: boolean;
27
+ recursive?: boolean;
28
+ overflow?: string;
29
+ }): Promise<undefined>;
30
+ /**
31
+ * Stop watching all targets.
32
+ */
33
+ stopWatching(): void;
34
+ #private;
35
+ }
36
+ import type FileObject from "./FileObject.js";
37
+ import type DirectoryObject from "./DirectoryObject.js";
38
+ //# sourceMappingURL=Watcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Watcher.d.ts","sourceRoot":"","sources":["../../../src/node/lib/Watcher.js"],"names":[],"mappings":"AAKA;;;GAGG;AAEH;;;GAGE;AAEF;IAIE;;;;;;;;;;;;OAYG;IACH,eATW,UAAU,GAAC,eAAe,GAAC,KAAK,CAAE,CAAC,UAAU,GAAC,eAAe,CAAC,CAAC,8DAEvE;QAA8D,QAAQ,EAA9D,CAAC,MAAM,EAAE,UAAU,GAAC,eAAe,KAAK,IAAI;QAC3B,UAAU,GAA3B,MAAM;QACY,UAAU,GAA5B,OAAO;QACW,SAAS,GAA3B,OAAO;QACU,QAAQ,GAAzB,MAAM;KACd,GAAU,OAAO,CAAC,SAAS,CAAC,CA6E9B;IAED;;OAEG;IACH,qBAIC;;CACF;4BA/G0B,iBAAiB;iCACZ,sBAAsB"}