@effect/platform 0.0.0 → 0.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 (76) hide show
  1. package/Command.d.ts +251 -0
  2. package/Command.d.ts.map +1 -0
  3. package/Command.js +164 -0
  4. package/Command.js.map +1 -0
  5. package/CommandExecutor.d.ts +140 -0
  6. package/CommandExecutor.d.ts.map +1 -0
  7. package/CommandExecutor.js +40 -0
  8. package/CommandExecutor.js.map +1 -0
  9. package/Console.d.ts +114 -12
  10. package/Console.d.ts.map +1 -1
  11. package/Console.js +109 -1
  12. package/Console.js.map +1 -1
  13. package/Error.d.ts +1 -1
  14. package/Error.d.ts.map +1 -1
  15. package/FileSystem.d.ts +246 -47
  16. package/FileSystem.d.ts.map +1 -1
  17. package/FileSystem.js +24 -1
  18. package/FileSystem.js.map +1 -1
  19. package/Path.d.ts +59 -0
  20. package/Path.d.ts.map +1 -0
  21. package/{FileSystem/File.js → Path.js} +14 -24
  22. package/Path.js.map +1 -0
  23. package/internal/command.d.ts +2 -0
  24. package/internal/command.d.ts.map +1 -0
  25. package/internal/command.js +184 -0
  26. package/internal/command.js.map +1 -0
  27. package/internal/commandExecutor.d.ts +2 -0
  28. package/internal/commandExecutor.d.ts.map +1 -0
  29. package/internal/commandExecutor.js +55 -0
  30. package/internal/commandExecutor.js.map +1 -0
  31. package/internal/console.js +63 -3
  32. package/internal/console.js.map +1 -1
  33. package/internal/fileSystem.js +3 -3
  34. package/internal/fileSystem.js.map +1 -1
  35. package/internal/path.d.ts +2 -0
  36. package/internal/path.d.ts.map +1 -0
  37. package/internal/path.js +97 -0
  38. package/internal/path.js.map +1 -0
  39. package/mjs/Command.mjs +139 -0
  40. package/mjs/Command.mjs.map +1 -0
  41. package/mjs/CommandExecutor.mjs +27 -0
  42. package/mjs/CommandExecutor.mjs.map +1 -0
  43. package/mjs/Console.mjs +90 -0
  44. package/mjs/Console.mjs.map +1 -1
  45. package/mjs/FileSystem.mjs +19 -0
  46. package/mjs/FileSystem.mjs.map +1 -1
  47. package/mjs/Path.mjs +20 -0
  48. package/mjs/Path.mjs.map +1 -0
  49. package/mjs/internal/command.mjs +159 -0
  50. package/mjs/internal/command.mjs.map +1 -0
  51. package/mjs/internal/commandExecutor.mjs +42 -0
  52. package/mjs/internal/commandExecutor.mjs.map +1 -0
  53. package/mjs/internal/console.mjs +44 -2
  54. package/mjs/internal/console.mjs.map +1 -1
  55. package/mjs/internal/fileSystem.mjs +3 -3
  56. package/mjs/internal/fileSystem.mjs.map +1 -1
  57. package/mjs/internal/path.mjs +87 -0
  58. package/mjs/internal/path.mjs.map +1 -0
  59. package/package.json +5 -4
  60. package/src/Command.ts +278 -0
  61. package/src/CommandExecutor.ts +191 -0
  62. package/src/Console.ts +132 -12
  63. package/src/Error.ts +1 -1
  64. package/src/FileSystem.ts +356 -119
  65. package/src/Path.ts +64 -0
  66. package/src/internal/command.ts +211 -0
  67. package/src/internal/commandExecutor.ts +69 -0
  68. package/src/internal/console.ts +92 -14
  69. package/src/internal/fileSystem.ts +4 -5
  70. package/src/internal/path.ts +101 -0
  71. package/FileSystem/File.d.ts +0 -91
  72. package/FileSystem/File.d.ts.map +0 -1
  73. package/FileSystem/File.js.map +0 -1
  74. package/mjs/FileSystem/File.mjs +0 -28
  75. package/mjs/FileSystem/File.mjs.map +0 -1
  76. package/src/FileSystem/File.ts +0 -125
@@ -1,125 +0,0 @@
1
- /**
2
- * @since 1.0.0
3
- */
4
- import * as Brand from "@effect/data/Brand"
5
- import type { Option } from "@effect/data/Option"
6
- import type * as Effect from "@effect/io/Effect"
7
- import type { PlatformError } from "@effect/platform/Error"
8
- import type { Size } from "@effect/platform/FileSystem"
9
-
10
- /**
11
- * @since 1.0.0
12
- * @category type id
13
- */
14
- export const FileTypeId: unique symbol = Symbol.for(
15
- "@effect/platform/FileSystem/File"
16
- )
17
-
18
- /**
19
- * @since 1.0.0
20
- * @category type id
21
- */
22
- export type FileTypeId = typeof FileTypeId
23
-
24
- /**
25
- * @since 1.0.0
26
- * @category guard
27
- */
28
- export const isFile = (u: unknown): u is File => typeof u === "object" && u !== null && FileTypeId in u
29
-
30
- /**
31
- * @since 1.0.0
32
- * @category model
33
- */
34
- export interface File {
35
- readonly [FileTypeId]: FileTypeId
36
- readonly fd: File.Descriptor
37
- readonly stat: Effect.Effect<never, PlatformError, File.Info>
38
- readonly read: (
39
- buffer: Uint8Array,
40
- options?: FileReadOptions
41
- ) => Effect.Effect<never, PlatformError, Size>
42
- readonly readAlloc: (
43
- size: Size,
44
- options?: FileReadOptions
45
- ) => Effect.Effect<never, PlatformError, Option<Uint8Array>>
46
- readonly truncate: (
47
- length?: Size
48
- ) => Effect.Effect<never, PlatformError, void>
49
- readonly write: (
50
- buffer: Uint8Array
51
- ) => Effect.Effect<never, PlatformError, Size>
52
- readonly writeAll: (
53
- buffer: Uint8Array
54
- ) => Effect.Effect<never, PlatformError, void>
55
- }
56
-
57
- /**
58
- * @since 1.0.0
59
- * @category constructor
60
- */
61
- export const make = (impl: Omit<File, FileTypeId>): File => ({
62
- [FileTypeId]: FileTypeId,
63
- ...impl
64
- })
65
-
66
- /**
67
- * @since 1.0.0
68
- */
69
- export namespace File {
70
- /**
71
- * @since 1.0.0
72
- * @category model
73
- */
74
- export type Descriptor = Brand.Branded<number, "FileDescriptor">
75
-
76
- /**
77
- * @since 1.0.0
78
- * @category model
79
- */
80
- export type Type =
81
- | "File"
82
- | "Directory"
83
- | "SymbolicLink"
84
- | "BlockDevice"
85
- | "CharacterDevice"
86
- | "FIFO"
87
- | "Socket"
88
- | "Unknown"
89
-
90
- /**
91
- * @since 1.0.0
92
- * @category model
93
- */
94
- export interface Info {
95
- readonly type: Type
96
- readonly mtime: Option<Date>
97
- readonly atime: Option<Date>
98
- readonly birthtime: Option<Date>
99
- readonly dev: number
100
- readonly ino: Option<number>
101
- readonly mode: number
102
- readonly nlink: Option<number>
103
- readonly uid: Option<number>
104
- readonly gid: Option<number>
105
- readonly rdev: Option<number>
106
- readonly size: Size
107
- readonly blksize: Option<Size>
108
- readonly blocks: Option<number>
109
- }
110
- }
111
-
112
- /**
113
- * @since 1.0.0
114
- * @category constructor
115
- */
116
- export const Descriptor = Brand.nominal<File.Descriptor>()
117
-
118
- /**
119
- * @since 1.0.0
120
- * @category model
121
- */
122
- export interface FileReadOptions {
123
- readonly offset?: Size
124
- readonly length?: Size
125
- }