filesystem.ts 833 B

1234567891011121314151617181920212223242526
  1. export * as FileSystem from "./filesystem"
  2. import { Schema } from "effect"
  3. import { NonNegativeInt, PositiveInt, RelativePath } from "./schema"
  4. export interface Entry extends Schema.Schema.Type<typeof Entry> {}
  5. export const Entry = Schema.Struct({
  6. path: RelativePath,
  7. type: Schema.Literals(["file", "directory"]),
  8. }).annotate({ identifier: "FileSystem.Entry" })
  9. export interface Submatch extends Schema.Schema.Type<typeof Submatch> {}
  10. export const Submatch = Schema.Struct({
  11. text: Schema.String,
  12. start: NonNegativeInt,
  13. end: NonNegativeInt,
  14. })
  15. export interface Match extends Schema.Schema.Type<typeof Match> {}
  16. export const Match = Schema.Struct({
  17. entry: Entry,
  18. line: PositiveInt,
  19. offset: NonNegativeInt,
  20. text: Schema.String,
  21. submatches: Schema.Array(Submatch),
  22. }).annotate({ identifier: "FileSystem.Match" })