@componentor/fs 3.0.41 → 3.0.42

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/dist/index.d.mts CHANGED
@@ -134,8 +134,16 @@ interface StatFs {
134
134
  ffree: number;
135
135
  }
136
136
  interface GlobOptions {
137
- cwd?: string;
138
- exclude?: (path: string) => boolean;
137
+ /** Base directory to resolve relative patterns against. Default: '/' */
138
+ cwd?: string | URL;
139
+ /**
140
+ * Exclude callback. Called with every candidate path (for `withFileTypes`,
141
+ * called with a Dirent). Returning truthy drops the entry. Matches Node's
142
+ * `fs.glob` behavior.
143
+ */
144
+ exclude?: ((path: string) => boolean) | ((dirent: Dirent) => boolean);
145
+ /** Return Dirent objects instead of path strings. Default: false */
146
+ withFileTypes?: boolean;
139
147
  }
140
148
  type PathLike = string | Uint8Array | URL;
141
149
  interface OpenAsBlobOptions {
@@ -242,6 +250,7 @@ interface FileHandle {
242
250
  appendFile(data: string | Uint8Array, options?: WriteOptions | Encoding): Promise<void>;
243
251
  chmod(mode: number): Promise<void>;
244
252
  chown(uid: number, gid: number): Promise<void>;
253
+ utimes(atime: Date | number, mtime: Date | number): Promise<void>;
245
254
  sync(): Promise<void>;
246
255
  datasync(): Promise<void>;
247
256
  close(): Promise<void>;
@@ -401,7 +410,7 @@ declare class VFSFileSystem {
401
410
  rmSync(filePath: PathLike, options?: RmOptions): void;
402
411
  unlinkSync(filePath: PathLike): void;
403
412
  readdirSync(filePath: PathLike, options?: ReaddirOptions | Encoding | null): string[] | Uint8Array[] | Dirent[];
404
- globSync(pattern: string, options?: GlobOptions): string[];
413
+ globSync(pattern: string | string[], options?: GlobOptions): string[] | Dirent[];
405
414
  opendirSync(filePath: PathLike): Dir;
406
415
  statSync(filePath: PathLike, options?: StatOptions): Stats | BigIntStats;
407
416
  lstatSync(filePath: PathLike, options?: StatOptions): Stats | BigIntStats;
@@ -415,16 +424,18 @@ declare class VFSFileSystem {
415
424
  chmodSync(filePath: PathLike, mode: number): void;
416
425
  /** Like chmodSync but operates on the symlink itself. In this VFS, delegates to chmodSync. */
417
426
  lchmodSync(filePath: string, mode: number): void;
418
- /** chmod on an open file descriptor. No-op in this VFS (permissions are cosmetic). */
419
- fchmodSync(_fd: number, _mode: number): void;
427
+ /** chmod on an open file descriptor. Resolves the fd to its inode on the
428
+ * server side and mutates the inode's mode bits directly, matching what
429
+ * native Node's libuv does. */
430
+ fchmodSync(fd: number, mode: number): void;
420
431
  chownSync(filePath: PathLike, uid: number, gid: number): void;
421
432
  /** Like chownSync but operates on the symlink itself. In this VFS, delegates to chownSync. */
422
433
  lchownSync(filePath: string, uid: number, gid: number): void;
423
- /** chown on an open file descriptor. No-op in this VFS (permissions are cosmetic). */
424
- fchownSync(_fd: number, _uid: number, _gid: number): void;
434
+ /** chown on an open file descriptor. Mutates the underlying inode's uid/gid. */
435
+ fchownSync(fd: number, uid: number, gid: number): void;
425
436
  utimesSync(filePath: PathLike, atime: Date | number, mtime: Date | number): void;
426
- /** utimes on an open file descriptor. No-op in this VFS (cannot resolve fd to path). */
427
- futimesSync(_fd: number, _atime: Date | number, _mtime: Date | number): void;
437
+ /** utimes on an open file descriptor. Mutates the underlying inode's atime/mtime. */
438
+ futimesSync(fd: number, atime: Date | number, mtime: Date | number): void;
428
439
  /** Like utimesSync but operates on the symlink itself. In this VFS, delegates to utimesSync. */
429
440
  lutimesSync(filePath: string, atime: Date | number, mtime: Date | number): void;
430
441
  symlinkSync(target: PathLike, linkPath: PathLike, type?: string | null): void;
@@ -618,7 +629,7 @@ declare class VFSPromises {
618
629
  rm(filePath: PathLike, options?: RmOptions): Promise<void>;
619
630
  unlink(filePath: PathLike): Promise<void>;
620
631
  readdir(filePath: PathLike, options?: ReaddirOptions | Encoding | null): Promise<Uint8Array<ArrayBufferLike>[] | string[] | Dirent[]>;
621
- glob(pattern: string, options?: GlobOptions): Promise<string[]>;
632
+ glob(pattern: string | string[], options?: GlobOptions): Promise<string[] | Dirent[]>;
622
633
  stat(filePath: PathLike, options?: StatOptions): Promise<BigIntStats | Stats>;
623
634
  lstat(filePath: PathLike, options?: StatOptions): Promise<BigIntStats | Stats>;
624
635
  access(filePath: PathLike, mode?: number): Promise<void>;
@@ -631,16 +642,19 @@ declare class VFSPromises {
631
642
  chmod(filePath: PathLike, mode: number): Promise<void>;
632
643
  /** Like chmod but operates on the symlink itself. In this VFS, delegates to chmod. */
633
644
  lchmod(filePath: string, mode: number): Promise<void>;
634
- /** chmod on an open file descriptor. No-op in this VFS (permissions are cosmetic). */
635
- fchmod(_fd: number, _mode: number): Promise<void>;
645
+ /** chmod on an open file descriptor. Engine resolves fd inode and
646
+ * mutates the mode bits directly. */
647
+ fchmod(fd: number, mode: number): Promise<void>;
636
648
  chown(filePath: PathLike, uid: number, gid: number): Promise<void>;
637
649
  /** Like chown but operates on the symlink itself. In this VFS, delegates to chown. */
638
650
  lchown(filePath: string, uid: number, gid: number): Promise<void>;
639
- /** chown on an open file descriptor. No-op in this VFS (permissions are cosmetic). */
640
- fchown(_fd: number, _uid: number, _gid: number): Promise<void>;
651
+ /** chown on an open file descriptor. Engine resolves fd inode and
652
+ * mutates uid/gid directly. */
653
+ fchown(fd: number, uid: number, gid: number): Promise<void>;
641
654
  utimes(filePath: PathLike, atime: Date | number, mtime: Date | number): Promise<void>;
642
- /** utimes on an open file descriptor. No-op in this VFS (cannot resolve fd to path). */
643
- futimes(_fd: number, _atime: Date | number, _mtime: Date | number): Promise<void>;
655
+ /** utimes on an open file descriptor. Engine resolves fd inode and
656
+ * mutates atime/mtime directly. */
657
+ futimes(fd: number, atime: Date | number, mtime: Date | number): Promise<void>;
644
658
  /** Like utimes but operates on the symlink itself. In this VFS, delegates to utimes. */
645
659
  lutimes(filePath: string, atime: Date | number, mtime: Date | number): Promise<void>;
646
660
  symlink(target: PathLike, linkPath: PathLike, type?: string | null): Promise<void>;