@opencode/util 0.0.0-dev-20401 → 0.0.0-dev-20402

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/fs-util.d.ts CHANGED
@@ -19,6 +19,8 @@ export declare namespace FSUtil {
19
19
  readonly start: string;
20
20
  readonly stop?: string;
21
21
  readonly mode?: "all" | "first";
22
+ /** Only match regular files or directories (following symlinks). By default any existing path matches. */
23
+ readonly type?: "file" | "directory";
22
24
  }
23
25
  export interface Interface extends FileSystem.FileSystem {
24
26
  readonly isDir: (path: string) => Effect.Effect<boolean>;
package/dist/fs-util.js CHANGED
@@ -97,7 +97,12 @@ export var FSUtil;
97
97
  while (true) {
98
98
  for (const target of options.targets) {
99
99
  const search = join(current, target);
100
- if (yield* fs.exists(search)) {
100
+ const found = options.type === "file"
101
+ ? yield* isFile(search)
102
+ : options.type === "directory"
103
+ ? yield* isDir(search)
104
+ : yield* fs.exists(search);
105
+ if (found) {
101
106
  result.push(search);
102
107
  if (options.mode === "first")
103
108
  return result;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/util",
4
- "version": "0.0.0-dev-20401",
4
+ "version": "0.0.0-dev-20402",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {