@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
package/src/FileSystem.ts CHANGED
@@ -1,16 +1,231 @@
1
1
  /**
2
2
  * @since 1.0.0
3
3
  */
4
- import type * as Brand from "@effect/data/Brand"
4
+ import * as Brand from "@effect/data/Brand"
5
5
  import type { Tag } from "@effect/data/Context"
6
+ import type { Option } from "@effect/data/Option"
6
7
  import type * as Effect from "@effect/io/Effect"
7
8
  import type { Scope } from "@effect/io/Scope"
8
9
  import type { PlatformError } from "@effect/platform/Error"
9
- import type { File } from "@effect/platform/FileSystem/File"
10
10
  import * as internal from "@effect/platform/internal/fileSystem"
11
11
  import type { Sink } from "@effect/stream/Sink"
12
12
  import type { Stream } from "@effect/stream/Stream"
13
13
 
14
+ /**
15
+ * @since 1.0.0
16
+ * @category model
17
+ */
18
+ export interface FileSystem {
19
+ /**
20
+ * Check if a file can be accessed.
21
+ * You can optionally specify the level of access to check for.
22
+ */
23
+ readonly access: (
24
+ path: string,
25
+ options?: AccessFileOptions
26
+ ) => Effect.Effect<never, PlatformError, void>
27
+ /**
28
+ * Copy a file or directory from `fromPath` to `toPath`.
29
+ *
30
+ * Equivalent to `cp -r`.
31
+ */
32
+ readonly copy: (
33
+ fromPath: string,
34
+ toPath: string,
35
+ options?: CopyOptions
36
+ ) => Effect.Effect<never, PlatformError, void>
37
+ /**
38
+ * Copy a file from `fromPath` to `toPath`.
39
+ */
40
+ readonly copyFile: (
41
+ fromPath: string,
42
+ toPath: string
43
+ ) => Effect.Effect<never, PlatformError, void>
44
+ /**
45
+ * Change the permissions of a file.
46
+ */
47
+ readonly chmod: (
48
+ path: string,
49
+ mode: number
50
+ ) => Effect.Effect<never, PlatformError, void>
51
+ /**
52
+ * Change the owner and group of a file.
53
+ */
54
+ readonly chown: (
55
+ path: string,
56
+ uid: number,
57
+ gid: number
58
+ ) => Effect.Effect<never, PlatformError, void>
59
+ /**
60
+ * Create a hard link from `fromPath` to `toPath`.
61
+ */
62
+ readonly link: (
63
+ fromPath: string,
64
+ toPath: string
65
+ ) => Effect.Effect<never, PlatformError, void>
66
+ /**
67
+ * Create a directory at `path`. You can optionally specify the mode and
68
+ * whether to recursively create nested directories.
69
+ */
70
+ readonly makeDirectory: (
71
+ path: string,
72
+ options?: MakeDirectoryOptions
73
+ ) => Effect.Effect<never, PlatformError, void>
74
+ /**
75
+ * Create a temporary directory.
76
+ *
77
+ * By default the directory will be created inside the system's default
78
+ * temporary directory, but you can specify a different location by setting
79
+ * the `directory` option.
80
+ *
81
+ * You can also specify a prefix for the directory name by setting the
82
+ * `prefix` option.
83
+ */
84
+ readonly makeTempDirectory: (
85
+ options?: MakeTempDirectoryOptions
86
+ ) => Effect.Effect<never, PlatformError, string>
87
+ /**
88
+ * Create a temporary directory inside a scope.
89
+ *
90
+ * Functionally equivalent to `makeTempDirectory`, but the directory will be
91
+ * automatically deleted when the scope is closed.
92
+ */
93
+ readonly makeTempDirectoryScoped: (
94
+ options?: MakeTempDirectoryOptions
95
+ ) => Effect.Effect<Scope, PlatformError, string>
96
+ /**
97
+ * Create a temporary file.
98
+ * The directory creation is functionally equivalent to `makeTempDirectory`.
99
+ * The file name will be a randomly generated string.
100
+ */
101
+ readonly makeTempFile: (
102
+ options?: MakeTempFileOptions
103
+ ) => Effect.Effect<never, PlatformError, string>
104
+ /**
105
+ * Create a temporary file inside a scope.
106
+ *
107
+ * Functionally equivalent to `makeTempFile`, but the file will be
108
+ * automatically deleted when the scope is closed.
109
+ */
110
+ readonly makeTempFileScoped: (
111
+ options?: MakeTempFileOptions
112
+ ) => Effect.Effect<Scope, PlatformError, string>
113
+ /**
114
+ * Open a file at `path` with the specified `options`.
115
+ *
116
+ * The file handle will be automatically closed when the scope is closed.
117
+ */
118
+ readonly open: (
119
+ path: string,
120
+ options?: OpenFileOptions
121
+ ) => Effect.Effect<Scope, PlatformError, File>
122
+ /**
123
+ * List the contents of a directory.
124
+ *
125
+ * You can recursively list the contents of nested directories by setting the
126
+ * `recursive` option.
127
+ */
128
+ readonly readDirectory: (
129
+ path: string,
130
+ options?: ReadDirectoryOptions
131
+ ) => Effect.Effect<never, PlatformError, ReadonlyArray<string>>
132
+ /**
133
+ * Read the contents of a file.
134
+ */
135
+ readonly readFile: (
136
+ path: string
137
+ ) => Effect.Effect<never, PlatformError, Uint8Array>
138
+ /**
139
+ * Read the destination of a symbolic link.
140
+ */
141
+ readonly readLink: (
142
+ path: string
143
+ ) => Effect.Effect<never, PlatformError, string>
144
+ /**
145
+ * Resolve a path to its canonicalized absolute pathname.
146
+ */
147
+ readonly realPath: (
148
+ path: string
149
+ ) => Effect.Effect<never, PlatformError, string>
150
+ /**
151
+ * Remove a file or directory.
152
+ *
153
+ * By setting the `recursive` option to `true`, you can recursively remove
154
+ * nested directories.
155
+ */
156
+ readonly remove: (
157
+ path: string,
158
+ options?: RemoveOptions
159
+ ) => Effect.Effect<never, PlatformError, void>
160
+ /**
161
+ * Rename a file or directory.
162
+ */
163
+ readonly rename: (
164
+ oldPath: string,
165
+ newPath: string
166
+ ) => Effect.Effect<never, PlatformError, void>
167
+ /**
168
+ * Create a writable `Sink` for the specified `path`.
169
+ */
170
+ readonly sink: (
171
+ path: string,
172
+ options?: SinkOptions
173
+ ) => Sink<never, PlatformError, Uint8Array, never, void>
174
+ /**
175
+ * Get information about a file at `path`.
176
+ */
177
+ readonly stat: (
178
+ path: string
179
+ ) => Effect.Effect<never, PlatformError, File.Info>
180
+ /**
181
+ * Create a readable `Stream` for the specified `path`.
182
+ *
183
+ * Changing the `bufferSize` option will change the internal buffer size of
184
+ * the stream. It defaults to `4`.
185
+ *
186
+ * The `chunkSize` option will change the size of the chunks emitted by the
187
+ * stream. It defaults to 64kb.
188
+ *
189
+ * Changing `offset` and `bytesToRead` will change the offset and the number
190
+ * of bytes to read from the file.
191
+ */
192
+ readonly stream: (
193
+ path: string,
194
+ options?: StreamOptions
195
+ ) => Stream<never, PlatformError, Uint8Array>
196
+ /**
197
+ * Create a symbolic link from `fromPath` to `toPath`.
198
+ */
199
+ readonly symlink: (
200
+ fromPath: string,
201
+ toPath: string
202
+ ) => Effect.Effect<never, PlatformError, void>
203
+ /**
204
+ * Truncate a file to a specified length. If the `length` is not specified,
205
+ * the file will be truncated to length `0`.
206
+ */
207
+ readonly truncate: (
208
+ path: string,
209
+ length?: Size
210
+ ) => Effect.Effect<never, PlatformError, void>
211
+ /**
212
+ * Change the file system timestamps of the file at `path`.
213
+ */
214
+ readonly utimes: (
215
+ path: string,
216
+ atime: Date | number,
217
+ mtime: Date | number
218
+ ) => Effect.Effect<never, PlatformError, void>
219
+ /**
220
+ * Write data to a file at `path`.
221
+ */
222
+ readonly writeFile: (
223
+ path: string,
224
+ data: Uint8Array,
225
+ options?: WriteFileOptions
226
+ ) => Effect.Effect<never, PlatformError, void>
227
+ }
228
+
14
229
  /**
15
230
  * Represents a size in bytes.
16
231
  *
@@ -29,6 +244,22 @@ export const Size: (bytes: number | bigint) => Size = internal.Size
29
244
  * @since 1.0.0
30
245
  * @category model
31
246
  */
247
+ export type OpenFlag =
248
+ | "r"
249
+ | "r+"
250
+ | "w"
251
+ | "wx"
252
+ | "w+"
253
+ | "wx+"
254
+ | "a"
255
+ | "ax"
256
+ | "a+"
257
+ | "ax+"
258
+
259
+ /**
260
+ * @since 1.0.0
261
+ * @category options
262
+ */
32
263
  export interface AccessFileOptions {
33
264
  readonly ok?: boolean
34
265
  readonly readable?: boolean
@@ -37,7 +268,7 @@ export interface AccessFileOptions {
37
268
 
38
269
  /**
39
270
  * @since 1.0.0
40
- * @category model
271
+ * @category options
41
272
  */
42
273
  export interface MakeDirectoryOptions {
43
274
  readonly recursive?: boolean
@@ -46,41 +277,34 @@ export interface MakeDirectoryOptions {
46
277
 
47
278
  /**
48
279
  * @since 1.0.0
49
- * @category model
280
+ * @category options
50
281
  */
51
- export interface MakeTempDirectoryOptions {
52
- readonly directory?: string
53
- readonly prefix?: string
282
+ export interface CopyOptions {
283
+ readonly overwrite?: boolean
284
+ readonly preserveTimestamps?: boolean
54
285
  }
55
286
 
56
287
  /**
57
288
  * @since 1.0.0
58
- * @category model
289
+ * @category options
59
290
  */
60
- export interface MakeTempFileOptions {
291
+ export interface MakeTempDirectoryOptions {
61
292
  readonly directory?: string
62
293
  readonly prefix?: string
63
294
  }
64
295
 
65
296
  /**
66
297
  * @since 1.0.0
67
- * @category model
298
+ * @category options
68
299
  */
69
- export type OpenFlag =
70
- | "r"
71
- | "r+"
72
- | "w"
73
- | "wx"
74
- | "w+"
75
- | "wx+"
76
- | "a"
77
- | "ax"
78
- | "a+"
79
- | "ax+"
300
+ export interface MakeTempFileOptions {
301
+ readonly directory?: string
302
+ readonly prefix?: string
303
+ }
80
304
 
81
305
  /**
82
306
  * @since 1.0.0
83
- * @category model
307
+ * @category options
84
308
  */
85
309
  export interface OpenFileOptions {
86
310
  readonly flag?: OpenFlag
@@ -89,7 +313,7 @@ export interface OpenFileOptions {
89
313
 
90
314
  /**
91
315
  * @since 1.0.0
92
- * @category model
316
+ * @category options
93
317
  */
94
318
  export interface ReadDirectoryOptions {
95
319
  readonly recursive?: boolean
@@ -97,7 +321,7 @@ export interface ReadDirectoryOptions {
97
321
 
98
322
  /**
99
323
  * @since 1.0.0
100
- * @category model
324
+ * @category options
101
325
  */
102
326
  export interface RemoveOptions {
103
327
  readonly recursive?: boolean
@@ -105,133 +329,146 @@ export interface RemoveOptions {
105
329
 
106
330
  /**
107
331
  * @since 1.0.0
108
- * @category model
332
+ * @category options
109
333
  */
110
334
  export interface SinkOptions extends OpenFileOptions {}
111
335
 
112
336
  /**
113
337
  * @since 1.0.0
114
- * @category model
338
+ * @category options
115
339
  */
116
340
  export interface StreamOptions {
117
- bufferSize?: number
118
- bytesToRead?: Size
119
- chunkSize?: Size
120
- offset?: Size
341
+ readonly bufferSize?: number
342
+ readonly bytesToRead?: Size
343
+ readonly chunkSize?: Size
344
+ readonly offset?: Size
121
345
  }
122
346
 
123
347
  /**
124
348
  * @since 1.0.0
125
- * @category model
349
+ * @category options
126
350
  */
127
351
  export interface WriteFileOptions {
128
352
  readonly flag?: OpenFlag
129
353
  readonly mode?: number
130
354
  }
131
355
 
356
+ /**
357
+ * @since 1.0.0
358
+ * @category tag
359
+ */
360
+ export const FileSystem: Tag<FileSystem, FileSystem> = internal.tag
361
+
362
+ /**
363
+ * @since 1.0.0
364
+ * @category constructor
365
+ */
366
+ export const make: (impl: Omit<FileSystem, "stream" | "sink">) => FileSystem = internal.make
367
+
368
+ /**
369
+ * @since 1.0.0
370
+ * @category type id
371
+ */
372
+ export const FileTypeId: unique symbol = Symbol.for(
373
+ "@effect/platform/FileSystem/File"
374
+ )
375
+
376
+ /**
377
+ * @since 1.0.0
378
+ * @category type id
379
+ */
380
+ export type FileTypeId = typeof FileTypeId
381
+
382
+ /**
383
+ * @since 1.0.0
384
+ * @category guard
385
+ */
386
+ export const isFile = (u: unknown): u is File => typeof u === "object" && u !== null && FileTypeId in u
387
+
132
388
  /**
133
389
  * @since 1.0.0
134
390
  * @category model
135
391
  */
136
- export interface FileSystem {
137
- readonly access: (
138
- path: string,
139
- options?: AccessFileOptions
140
- ) => Effect.Effect<never, PlatformError, void>
141
- readonly copyFile: (
142
- fromPath: string,
143
- toPath: string
144
- ) => Effect.Effect<never, PlatformError, void>
145
- readonly chmod: (
146
- path: string,
147
- mode: number
148
- ) => Effect.Effect<never, PlatformError, void>
149
- readonly chown: (
150
- path: string,
151
- uid: number,
152
- gid: number
153
- ) => Effect.Effect<never, PlatformError, void>
154
- readonly link: (
155
- fromPath: string,
156
- toPath: string
157
- ) => Effect.Effect<never, PlatformError, void>
158
- readonly makeDirectory: (
159
- path: string,
160
- options?: MakeDirectoryOptions
161
- ) => Effect.Effect<never, PlatformError, void>
162
- readonly makeTempDirectory: (
163
- options?: MakeTempDirectoryOptions
164
- ) => Effect.Effect<never, PlatformError, string>
165
- readonly makeTempDirectoryScoped: (
166
- options?: MakeTempDirectoryOptions
167
- ) => Effect.Effect<Scope, PlatformError, string>
168
- readonly makeTempFile: (
169
- options?: MakeTempFileOptions
170
- ) => Effect.Effect<Scope, PlatformError, File>
171
- readonly open: (
172
- path: string,
173
- options?: OpenFileOptions
174
- ) => Effect.Effect<Scope, PlatformError, File>
175
- readonly readDirectory: (
176
- path: string,
177
- options?: ReadDirectoryOptions
178
- ) => Effect.Effect<never, PlatformError, ReadonlyArray<string>>
179
- readonly readFile: (
180
- path: string
181
- ) => Effect.Effect<never, PlatformError, Uint8Array>
182
- readonly readLink: (
183
- path: string
184
- ) => Effect.Effect<never, PlatformError, string>
185
- readonly realPath: (
186
- path: string
187
- ) => Effect.Effect<never, PlatformError, string>
188
- readonly remove: (
189
- path: string,
190
- options?: RemoveOptions
191
- ) => Effect.Effect<never, PlatformError, void>
192
- readonly rename: (
193
- oldPath: string,
194
- newPath: string
195
- ) => Effect.Effect<never, PlatformError, void>
196
- readonly sink: (
197
- path: string,
198
- options?: SinkOptions
199
- ) => Sink<never, PlatformError, Uint8Array, never, void>
200
- readonly stat: (
201
- path: string
202
- ) => Effect.Effect<never, PlatformError, File.Info>
203
- readonly stream: (
204
- path: string,
205
- options?: StreamOptions
206
- ) => Stream<never, PlatformError, Uint8Array>
207
- readonly symlink: (
208
- fromPath: string,
209
- toPath: string
210
- ) => Effect.Effect<never, PlatformError, void>
392
+ export interface File {
393
+ readonly [FileTypeId]: (_: never) => unknown
394
+ readonly fd: File.Descriptor
395
+ readonly stat: Effect.Effect<never, PlatformError, File.Info>
396
+ readonly read: (
397
+ buffer: Uint8Array,
398
+ options?: FileReadOptions
399
+ ) => Effect.Effect<never, PlatformError, Size>
400
+ readonly readAlloc: (
401
+ size: Size,
402
+ options?: FileReadOptions
403
+ ) => Effect.Effect<never, PlatformError, Option<Uint8Array>>
211
404
  readonly truncate: (
212
- path: string,
213
405
  length?: Size
214
406
  ) => Effect.Effect<never, PlatformError, void>
215
- readonly utime: (
216
- path: string,
217
- atime: Date | number,
218
- mtime: Date | number
219
- ) => Effect.Effect<never, PlatformError, void>
220
- readonly writeFile: (
221
- path: string,
222
- data: Uint8Array,
223
- options?: WriteFileOptions
407
+ readonly write: (
408
+ buffer: Uint8Array
409
+ ) => Effect.Effect<never, PlatformError, Size>
410
+ readonly writeAll: (
411
+ buffer: Uint8Array
224
412
  ) => Effect.Effect<never, PlatformError, void>
225
413
  }
226
414
 
227
415
  /**
228
416
  * @since 1.0.0
229
- * @category tag
230
417
  */
231
- export const FileSystem: Tag<FileSystem, FileSystem> = internal.tag
418
+ export namespace File {
419
+ /**
420
+ * @since 1.0.0
421
+ * @category model
422
+ */
423
+ export type Descriptor = Brand.Branded<number, "FileDescriptor">
424
+
425
+ /**
426
+ * @since 1.0.0
427
+ * @category model
428
+ */
429
+ export type Type =
430
+ | "File"
431
+ | "Directory"
432
+ | "SymbolicLink"
433
+ | "BlockDevice"
434
+ | "CharacterDevice"
435
+ | "FIFO"
436
+ | "Socket"
437
+ | "Unknown"
438
+
439
+ /**
440
+ * @since 1.0.0
441
+ * @category model
442
+ */
443
+ export interface Info {
444
+ readonly type: Type
445
+ readonly mtime: Option<Date>
446
+ readonly atime: Option<Date>
447
+ readonly birthtime: Option<Date>
448
+ readonly dev: number
449
+ readonly ino: Option<number>
450
+ readonly mode: number
451
+ readonly nlink: Option<number>
452
+ readonly uid: Option<number>
453
+ readonly gid: Option<number>
454
+ readonly rdev: Option<number>
455
+ readonly size: Size
456
+ readonly blksize: Option<Size>
457
+ readonly blocks: Option<number>
458
+ }
459
+ }
232
460
 
233
461
  /**
234
462
  * @since 1.0.0
235
463
  * @category constructor
236
464
  */
237
- export const make: (impl: Omit<FileSystem, "stream" | "sink">) => FileSystem = internal.make
465
+ export const FileDescriptor = Brand.nominal<File.Descriptor>()
466
+
467
+ /**
468
+ * @since 1.0.0
469
+ * @category model
470
+ */
471
+ export interface FileReadOptions {
472
+ readonly offset?: Size
473
+ readonly length?: Size
474
+ }
package/src/Path.ts ADDED
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+
5
+ import type { Tag } from "@effect/data/Context"
6
+ import type { Effect } from "@effect/io/Effect"
7
+ import type { Layer } from "@effect/io/Layer"
8
+ import type { BadArgument } from "@effect/platform/Error"
9
+ import * as internal from "@effect/platform/internal/path"
10
+
11
+ /**
12
+ * @since 1.0.0
13
+ * @category model
14
+ */
15
+ export interface Path {
16
+ readonly sep: string
17
+ readonly basename: (path: string, suffix?: string) => string
18
+ readonly dirname: (path: string) => string
19
+ readonly extname: (path: string) => string
20
+ readonly format: (pathObject: Partial<Path.Parsed>) => string
21
+ readonly fromFileUrl: (url: URL) => Effect<never, BadArgument, string>
22
+ readonly isAbsolute: (path: string) => boolean
23
+ readonly join: (...paths: ReadonlyArray<string>) => string
24
+ readonly normalize: (path: string) => string
25
+ readonly parse: (path: string) => Path.Parsed
26
+ readonly relative: (from: string, to: string) => string
27
+ readonly resolve: (...pathSegments: ReadonlyArray<string>) => string
28
+ readonly toFileUrl: (path: string) => Effect<never, BadArgument, URL>
29
+ readonly toNamespacedPath: (path: string) => string
30
+ }
31
+
32
+ /**
33
+ * @since 1.0.0
34
+ */
35
+ export namespace Path {
36
+ /**
37
+ * @since 1.0.0
38
+ * @category model
39
+ */
40
+ export interface Parsed {
41
+ readonly root: string
42
+ readonly dir: string
43
+ readonly base: string
44
+ readonly ext: string
45
+ readonly name: string
46
+ }
47
+ }
48
+
49
+ /**
50
+ * @since 1.0.0
51
+ * @category tag
52
+ */
53
+ export const Path: Tag<Path, Path> = internal.Path
54
+
55
+ /**
56
+ * An implementation of the Path interface that can be used in all environments
57
+ * (including browsers).
58
+ *
59
+ * It uses the POSIX standard for paths.
60
+ *
61
+ * @since 1.0.0
62
+ * @category layer
63
+ */
64
+ export const layer: Layer<never, never, Path> = internal.layer