@effected/xdg 0.8.2 → 0.9.1
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/AppDirs.js +18 -11
- package/NativeDirs.js +1 -2
- package/README.md +4 -4
- package/Xdg.js +21 -11
- package/XdgConfig.js +10 -10
- package/index.d.ts +51 -34
- package/package.json +8 -4
package/AppDirs.js
CHANGED
|
@@ -23,8 +23,7 @@ const AppDirKind = Schema.Literals([
|
|
|
23
23
|
* layer construction, from an environment that is already resolved — so this
|
|
24
24
|
* error means exactly one thing: the `mkdir -p` did not work. `directory` says
|
|
25
25
|
* which kind, `path` says where, and `cause` carries the underlying
|
|
26
|
-
* `PlatformError` structurally.
|
|
27
|
-
* that could also be the string `"all"`.
|
|
26
|
+
* `PlatformError` structurally.
|
|
28
27
|
*
|
|
29
28
|
* @public
|
|
30
29
|
*/
|
|
@@ -69,8 +68,8 @@ var ResolvedAppDirs = class extends Schema.Class("ResolvedAppDirs")({
|
|
|
69
68
|
*
|
|
70
69
|
* @remarks
|
|
71
70
|
* The app's own config directory, then each `$XDG_CONFIG_DIRS` entry
|
|
72
|
-
* namespaced.
|
|
73
|
-
*
|
|
71
|
+
* namespaced. It is what makes {@link XdgConfig.resolver} a real search
|
|
72
|
+
* rather than a single stat.
|
|
74
73
|
*/
|
|
75
74
|
configSearchPath: Schema.Array(Schema.String),
|
|
76
75
|
/** Where to look for data files, in priority order. */
|
|
@@ -86,9 +85,8 @@ var ResolvedAppDirs = class extends Schema.Class("ResolvedAppDirs")({
|
|
|
86
85
|
* 5. `$HOME/.<namespace>`.
|
|
87
86
|
*
|
|
88
87
|
* Rungs 4 and 5 are deliberately **not** the XDG spec's per-kind defaults
|
|
89
|
-
* (`~/.config`, `~/.local/share`, …)
|
|
90
|
-
*
|
|
91
|
-
* documented rather than left for a reader to discover.
|
|
88
|
+
* (`~/.config`, `~/.local/share`, …): a CLI wanting spec defaults passes them as
|
|
89
|
+
* `dirs` overrides.
|
|
92
90
|
*/
|
|
93
91
|
const resolveDir = (input) => {
|
|
94
92
|
const { override, xdgHome, native, options, home, path } = input;
|
|
@@ -150,8 +148,18 @@ const badNamespace = (namespace) => {
|
|
|
150
148
|
*
|
|
151
149
|
* @example
|
|
152
150
|
* ```ts
|
|
153
|
-
*
|
|
154
|
-
*
|
|
151
|
+
* import { AppDirs, Xdg } from "@effected/xdg";
|
|
152
|
+
* import { Effect, Layer } from "effect";
|
|
153
|
+
*
|
|
154
|
+
* // Bound once to a const, with the ambient `Xdg` environment provided and kept.
|
|
155
|
+
* const AppDirsLive = Layer.provideMerge(AppDirs.layer({ namespace: "myapp", native: true }), Xdg.layer);
|
|
156
|
+
*
|
|
157
|
+
* const program = Effect.gen(function* () {
|
|
158
|
+
* const appDirs = yield* AppDirs;
|
|
159
|
+
* const configDir = yield* appDirs.ensureConfig;
|
|
160
|
+
* console.log(configDir);
|
|
161
|
+
* });
|
|
162
|
+
* // Requires `FileSystem` and `Path` from the platform layer.
|
|
155
163
|
* ```
|
|
156
164
|
*
|
|
157
165
|
* @public
|
|
@@ -164,8 +172,7 @@ var AppDirs = class AppDirs extends Context.Service()("@effected/xdg/AppDirs") {
|
|
|
164
172
|
* @remarks
|
|
165
173
|
* The error channel is `never`. The one failure that could happen during
|
|
166
174
|
* resolution — an unset `HOME` — surfaces on {@link Xdg.layer} as an
|
|
167
|
-
* `XdgEnvError`, before an `AppDirs` exists at all.
|
|
168
|
-
* `AppDirsError({ directory: "all" })`.
|
|
175
|
+
* `XdgEnvError`, before an `AppDirs` exists at all.
|
|
169
176
|
*/
|
|
170
177
|
static layer(options) {
|
|
171
178
|
return Layer.effect(AppDirs, Effect.gen(function* () {
|
package/NativeDirs.js
CHANGED
|
@@ -28,8 +28,7 @@ var NativeDirs = class NativeDirs extends Schema.Class("NativeDirs")({
|
|
|
28
28
|
* **Pure**: no filesystem, no environment, no `process.platform`. Every input
|
|
29
29
|
* is a parameter, which is what makes the whole platform matrix testable
|
|
30
30
|
* without any platform IO. Paths are joined through the supplied `Path`, so a
|
|
31
|
-
* win32 `Path` layer yields win32 separators
|
|
32
|
-
* platform.
|
|
31
|
+
* win32 `Path` layer yields win32 separators.
|
|
33
32
|
*
|
|
34
33
|
* - **darwin** — `config`/`data`/`state` under `~/Library/Application Support/<ns>`;
|
|
35
34
|
* `cache` under `~/Library/Caches/<ns>`.
|
package/README.md
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
XDG Base Directory resolution for Effect. `Xdg` reads the environment — `$HOME`, the four `*_HOME` variables, `$XDG_RUNTIME_DIR`, and the `$XDG_CONFIG_DIRS` / `$XDG_DATA_DIRS` search paths — once, at layer construction. `AppDirs` turns that into the config, data, cache, state and runtime directories for one application namespace, with on-demand creation. `NativeDirs` supplies the macOS and Windows conventions for applications that want them, and `XdgConfig` plugs the whole thing into [`@effected/config-file`](../config-file) as a resolver chain and a save target.
|
|
9
9
|
|
|
10
|
-
> **Pre
|
|
11
|
-
>
|
|
12
|
-
> `1.0.0`
|
|
13
|
-
>
|
|
10
|
+
> **Pre-`1.0.0`.** This package is part of the `@effected/*` kit, built on stable
|
|
11
|
+
> Effect v4 (`effect` `^4.0.0`) and still in `0.x` development. Stable Effect
|
|
12
|
+
> makes a kit `1.0.0` possible, not automatic. To keep your `effect` and
|
|
13
|
+
> `@effect/*` versions on the line the kit is built and tested against, install
|
|
14
14
|
> [`@effected/pnpm-plugin-effect`](https://www.npmjs.com/package/@effected/pnpm-plugin-effect).
|
|
15
15
|
>
|
|
16
16
|
> **Stability: unstable.** This package's API surface is not yet considered
|
package/Xdg.js
CHANGED
|
@@ -32,7 +32,7 @@ const detectPlatform = () => {
|
|
|
32
32
|
* The platform every native-directory decision is taken against.
|
|
33
33
|
*
|
|
34
34
|
* @remarks
|
|
35
|
-
* A
|
|
35
|
+
* A `Context.Reference`, not a global read. It
|
|
36
36
|
* defaults to `process.platform`, so production behaviour is what you expect;
|
|
37
37
|
* a test pins macOS or Windows semantics with
|
|
38
38
|
* `Layer.succeed(CurrentPlatform, "win32")` and exercises the whole native-path
|
|
@@ -47,7 +47,7 @@ const CurrentPlatform = Context.Reference("@effected/xdg/CurrentPlatform", { def
|
|
|
47
47
|
* @remarks
|
|
48
48
|
* Raised only for `HOME`: every other XDG variable is optional by construction,
|
|
49
49
|
* and its absence is a resolved default rather than a failure. `cause` carries
|
|
50
|
-
* the underlying `ConfigError` structurally
|
|
50
|
+
* the underlying `ConfigError` structurally.
|
|
51
51
|
*
|
|
52
52
|
* @public
|
|
53
53
|
*/
|
|
@@ -67,8 +67,7 @@ var XdgEnvError = class extends Schema.TaggedError()("XdgEnvError", {
|
|
|
67
67
|
* @remarks
|
|
68
68
|
* Every field but `home` is optional because the corresponding variable is:
|
|
69
69
|
* `Schema.optionalKey`, so an unset variable is an **absent key** and the read
|
|
70
|
-
* is `paths.configHome ?? fallback`.
|
|
71
|
-
* `Option.some(...)` into the construction API of everything downstream.
|
|
70
|
+
* is `paths.configHome ?? fallback`.
|
|
72
71
|
*
|
|
73
72
|
* `configDirs` and `dataDirs` are the colon-separated system search paths, split
|
|
74
73
|
* and defaulted per the spec (`/etc/xdg` and `/usr/local/share:/usr/share`).
|
|
@@ -116,11 +115,9 @@ const splitDirs = (raw, fallback) => {
|
|
|
116
115
|
*
|
|
117
116
|
* @remarks
|
|
118
117
|
* The service's shape **is** {@link XdgPaths}: the environment is read once, at
|
|
119
|
-
* layer construction, and the service is the resolved value.
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* of strings, and the only failure — an unset `HOME` — happens once, where the
|
|
123
|
-
* layer is built.
|
|
118
|
+
* layer construction, and the service is the resolved value. `yield* Xdg` gives
|
|
119
|
+
* you a record of strings, and the only failure — an unset `HOME` — happens
|
|
120
|
+
* once, where the layer is built.
|
|
124
121
|
*
|
|
125
122
|
* @public
|
|
126
123
|
*/
|
|
@@ -177,8 +174,21 @@ var Xdg = class Xdg extends Context.Service()("@effected/xdg/Xdg") {
|
|
|
177
174
|
*
|
|
178
175
|
* @remarks
|
|
179
176
|
* The test layer, and the escape hatch for an application that resolves its
|
|
180
|
-
* environment some other way. It needs no filesystem
|
|
181
|
-
*
|
|
177
|
+
* environment some other way. It needs no filesystem.
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* import { Xdg, XdgPaths } from "@effected/xdg";
|
|
182
|
+
*
|
|
183
|
+
* const TestXdg = Xdg.layerFrom(
|
|
184
|
+
* XdgPaths.make({
|
|
185
|
+
* home: "/home/test",
|
|
186
|
+
* configHome: "/home/test/.config",
|
|
187
|
+
* configDirs: ["/etc/xdg"],
|
|
188
|
+
* dataDirs: ["/usr/local/share", "/usr/share"],
|
|
189
|
+
* }),
|
|
190
|
+
* );
|
|
191
|
+
* ```
|
|
182
192
|
*/
|
|
183
193
|
static layerFrom(paths) {
|
|
184
194
|
return Layer.succeed(Xdg, paths);
|
package/XdgConfig.js
CHANGED
|
@@ -48,16 +48,13 @@ var XdgConfig = class {
|
|
|
48
48
|
*
|
|
49
49
|
* @remarks
|
|
50
50
|
* Probes the app's own config directory first, then each `$XDG_CONFIG_DIRS`
|
|
51
|
-
* entry namespaced — `~/.config/myapp/rc`, then `/etc/xdg/myapp/rc`.
|
|
52
|
-
* only the first of those; the system search path is half the XDG spec and it
|
|
53
|
-
* was missing.
|
|
51
|
+
* entry namespaced — `~/.config/myapp/rc`, then `/etc/xdg/myapp/rc`.
|
|
54
52
|
*
|
|
55
53
|
* The scan runs through `Walker.firstMatch`, so a failure on one candidate means
|
|
56
|
-
* "this candidate did not match" and the search continues to the next
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* caller, which is the resolver contract — `resolve`'s error channel is `never`.
|
|
54
|
+
* "this candidate did not match" and the search continues to the next: an unreadable
|
|
55
|
+
* `/etc/xdg` never hides a readable `~/.config`. Not-found and cannot-look stay
|
|
56
|
+
* indistinguishable to the caller, which is the resolver contract —
|
|
57
|
+
* `resolve`'s error channel is `never`.
|
|
61
58
|
*
|
|
62
59
|
* Place it **before** {@link XdgConfig.nativeResolver} in a chain, so an
|
|
63
60
|
* existing `~/.config/<app>` still wins over the OS-native directory.
|
|
@@ -86,14 +83,17 @@ var XdgConfig = class {
|
|
|
86
83
|
* @remarks
|
|
87
84
|
* Drops straight into `ConfigFileOptions.defaultPath`, whose slot is typed
|
|
88
85
|
* `Effect<string, never, RR>`. That infallible channel is the whole reason
|
|
89
|
-
* {@link AppDirs} resolves at layer-construction time
|
|
90
|
-
*
|
|
86
|
+
* {@link AppDirs} resolves at layer-construction time, so no `orDie` is needed
|
|
87
|
+
* to fit the slot.
|
|
91
88
|
*
|
|
92
89
|
* It does **not** create the directory — `ConfigFile.save` already `mkdir -p`s
|
|
93
90
|
* the parent of whatever path it is given.
|
|
94
91
|
*
|
|
95
92
|
* @example
|
|
96
93
|
* ```ts
|
|
94
|
+
* import { XdgConfig } from "@effected/xdg";
|
|
95
|
+
* import { ConfigFile, JsonCodec, MergeStrategy } from "@effected/config-file";
|
|
96
|
+
*
|
|
97
97
|
* const layer = ConfigFile.layer(AppConfig, {
|
|
98
98
|
* schema: AppShape,
|
|
99
99
|
* codec: JsonCodec,
|
package/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type XdgPlatform = typeof XdgPlatform.Type;
|
|
|
22
22
|
* The platform every native-directory decision is taken against.
|
|
23
23
|
*
|
|
24
24
|
* @remarks
|
|
25
|
-
* A
|
|
25
|
+
* A `Context.Reference`, not a global read. It
|
|
26
26
|
* defaults to `process.platform`, so production behaviour is what you expect;
|
|
27
27
|
* a test pins macOS or Windows semantics with
|
|
28
28
|
* `Layer.succeed(CurrentPlatform, "win32")` and exercises the whole native-path
|
|
@@ -43,7 +43,7 @@ declare const XdgEnvError_base: Schema.Class<XdgEnvError, Schema.TaggedStruct<"X
|
|
|
43
43
|
* @remarks
|
|
44
44
|
* Raised only for `HOME`: every other XDG variable is optional by construction,
|
|
45
45
|
* and its absence is a resolved default rather than a failure. `cause` carries
|
|
46
|
-
* the underlying `ConfigError` structurally
|
|
46
|
+
* the underlying `ConfigError` structurally.
|
|
47
47
|
*
|
|
48
48
|
* @public
|
|
49
49
|
*/
|
|
@@ -78,8 +78,7 @@ declare const XdgPaths_base: Schema.Class<XdgPaths, Schema.Struct<{
|
|
|
78
78
|
* @remarks
|
|
79
79
|
* Every field but `home` is optional because the corresponding variable is:
|
|
80
80
|
* `Schema.optionalKey`, so an unset variable is an **absent key** and the read
|
|
81
|
-
* is `paths.configHome ?? fallback`.
|
|
82
|
-
* `Option.some(...)` into the construction API of everything downstream.
|
|
81
|
+
* is `paths.configHome ?? fallback`.
|
|
83
82
|
*
|
|
84
83
|
* `configDirs` and `dataDirs` are the colon-separated system search paths, split
|
|
85
84
|
* and defaulted per the spec (`/etc/xdg` and `/usr/local/share:/usr/share`).
|
|
@@ -95,11 +94,9 @@ declare const Xdg_base: Context.ServiceClass<Xdg, "@effected/xdg/Xdg", XdgPaths>
|
|
|
95
94
|
*
|
|
96
95
|
* @remarks
|
|
97
96
|
* The service's shape **is** {@link XdgPaths}: the environment is read once, at
|
|
98
|
-
* layer construction, and the service is the resolved value.
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* of strings, and the only failure — an unset `HOME` — happens once, where the
|
|
102
|
-
* layer is built.
|
|
97
|
+
* layer construction, and the service is the resolved value. `yield* Xdg` gives
|
|
98
|
+
* you a record of strings, and the only failure — an unset `HOME` — happens
|
|
99
|
+
* once, where the layer is built.
|
|
103
100
|
*
|
|
104
101
|
* @public
|
|
105
102
|
*/
|
|
@@ -118,8 +115,21 @@ export declare class Xdg extends Xdg_base {
|
|
|
118
115
|
*
|
|
119
116
|
* @remarks
|
|
120
117
|
* The test layer, and the escape hatch for an application that resolves its
|
|
121
|
-
* environment some other way. It needs no filesystem
|
|
122
|
-
*
|
|
118
|
+
* environment some other way. It needs no filesystem.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* import { Xdg, XdgPaths } from "@effected/xdg";
|
|
123
|
+
*
|
|
124
|
+
* const TestXdg = Xdg.layerFrom(
|
|
125
|
+
* XdgPaths.make({
|
|
126
|
+
* home: "/home/test",
|
|
127
|
+
* configHome: "/home/test/.config",
|
|
128
|
+
* configDirs: ["/etc/xdg"],
|
|
129
|
+
* dataDirs: ["/usr/local/share", "/usr/share"],
|
|
130
|
+
* }),
|
|
131
|
+
* );
|
|
132
|
+
* ```
|
|
123
133
|
*/
|
|
124
134
|
static layerFrom(paths: XdgPaths): Layer.Layer<Xdg>;
|
|
125
135
|
}
|
|
@@ -153,8 +163,7 @@ declare const AppDirsError_base: Schema.Class<AppDirsError, Schema.TaggedStruct<
|
|
|
153
163
|
* layer construction, from an environment that is already resolved — so this
|
|
154
164
|
* error means exactly one thing: the `mkdir -p` did not work. `directory` says
|
|
155
165
|
* which kind, `path` says where, and `cause` carries the underlying
|
|
156
|
-
* `PlatformError` structurally.
|
|
157
|
-
* that could also be the string `"all"`.
|
|
166
|
+
* `PlatformError` structurally.
|
|
158
167
|
*
|
|
159
168
|
* @public
|
|
160
169
|
*/
|
|
@@ -185,8 +194,8 @@ declare const ResolvedAppDirs_base: Schema.Class<ResolvedAppDirs, Schema.Struct<
|
|
|
185
194
|
*
|
|
186
195
|
* @remarks
|
|
187
196
|
* The app's own config directory, then each `$XDG_CONFIG_DIRS` entry
|
|
188
|
-
* namespaced.
|
|
189
|
-
*
|
|
197
|
+
* namespaced. It is what makes {@link XdgConfig.resolver} a real search
|
|
198
|
+
* rather than a single stat.
|
|
190
199
|
*/
|
|
191
200
|
readonly configSearchPath: Schema.$Array<Schema.String>;
|
|
192
201
|
/** Where to look for data files, in priority order. */
|
|
@@ -219,9 +228,9 @@ interface AppDirOverrides {
|
|
|
219
228
|
* Options for {@link AppDirs.layer}.
|
|
220
229
|
*
|
|
221
230
|
* @remarks
|
|
222
|
-
* Plain optional fields, not `Option`s:
|
|
223
|
-
* `fallbackDir:
|
|
224
|
-
*
|
|
231
|
+
* Plain optional fields, not `Option`s: `Option` is an internal
|
|
232
|
+
* representation, not an input format, so write `fallbackDir: ".myapp"` and
|
|
233
|
+
* omit `dirs` when unused.
|
|
225
234
|
*
|
|
226
235
|
* @public
|
|
227
236
|
*/
|
|
@@ -300,8 +309,18 @@ declare const AppDirs_base: Context.ServiceClass<AppDirs, "@effected/xdg/AppDirs
|
|
|
300
309
|
*
|
|
301
310
|
* @example
|
|
302
311
|
* ```ts
|
|
303
|
-
*
|
|
304
|
-
*
|
|
312
|
+
* import { AppDirs, Xdg } from "@effected/xdg";
|
|
313
|
+
* import { Effect, Layer } from "effect";
|
|
314
|
+
*
|
|
315
|
+
* // Bound once to a const, with the ambient `Xdg` environment provided and kept.
|
|
316
|
+
* const AppDirsLive = Layer.provideMerge(AppDirs.layer({ namespace: "myapp", native: true }), Xdg.layer);
|
|
317
|
+
*
|
|
318
|
+
* const program = Effect.gen(function* () {
|
|
319
|
+
* const appDirs = yield* AppDirs;
|
|
320
|
+
* const configDir = yield* appDirs.ensureConfig;
|
|
321
|
+
* console.log(configDir);
|
|
322
|
+
* });
|
|
323
|
+
* // Requires `FileSystem` and `Path` from the platform layer.
|
|
305
324
|
* ```
|
|
306
325
|
*
|
|
307
326
|
* @public
|
|
@@ -314,8 +333,7 @@ export declare class AppDirs extends AppDirs_base {
|
|
|
314
333
|
* @remarks
|
|
315
334
|
* The error channel is `never`. The one failure that could happen during
|
|
316
335
|
* resolution — an unset `HOME` — surfaces on {@link Xdg.layer} as an
|
|
317
|
-
* `XdgEnvError`, before an `AppDirs` exists at all.
|
|
318
|
-
* `AppDirsError({ directory: "all" })`.
|
|
336
|
+
* `XdgEnvError`, before an `AppDirs` exists at all.
|
|
319
337
|
*/
|
|
320
338
|
static layer(options: AppDirsOptions): Layer.Layer<AppDirs, never, Xdg | FileSystem.FileSystem | Path.Path>;
|
|
321
339
|
}
|
|
@@ -349,8 +367,7 @@ export declare class NativeDirs extends NativeDirs_base {
|
|
|
349
367
|
* **Pure**: no filesystem, no environment, no `process.platform`. Every input
|
|
350
368
|
* is a parameter, which is what makes the whole platform matrix testable
|
|
351
369
|
* without any platform IO. Paths are joined through the supplied `Path`, so a
|
|
352
|
-
* win32 `Path` layer yields win32 separators
|
|
353
|
-
* platform.
|
|
370
|
+
* win32 `Path` layer yields win32 separators.
|
|
354
371
|
*
|
|
355
372
|
* - **darwin** — `config`/`data`/`state` under `~/Library/Application Support/<ns>`;
|
|
356
373
|
* `cache` under `~/Library/Caches/<ns>`.
|
|
@@ -384,16 +401,13 @@ export declare class XdgConfig {
|
|
|
384
401
|
*
|
|
385
402
|
* @remarks
|
|
386
403
|
* Probes the app's own config directory first, then each `$XDG_CONFIG_DIRS`
|
|
387
|
-
* entry namespaced — `~/.config/myapp/rc`, then `/etc/xdg/myapp/rc`.
|
|
388
|
-
* only the first of those; the system search path is half the XDG spec and it
|
|
389
|
-
* was missing.
|
|
404
|
+
* entry namespaced — `~/.config/myapp/rc`, then `/etc/xdg/myapp/rc`.
|
|
390
405
|
*
|
|
391
406
|
* The scan runs through `Walker.firstMatch`, so a failure on one candidate means
|
|
392
|
-
* "this candidate did not match" and the search continues to the next
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
* caller, which is the resolver contract — `resolve`'s error channel is `never`.
|
|
407
|
+
* "this candidate did not match" and the search continues to the next: an unreadable
|
|
408
|
+
* `/etc/xdg` never hides a readable `~/.config`. Not-found and cannot-look stay
|
|
409
|
+
* indistinguishable to the caller, which is the resolver contract —
|
|
410
|
+
* `resolve`'s error channel is `never`.
|
|
397
411
|
*
|
|
398
412
|
* Place it **before** {@link XdgConfig.nativeResolver} in a chain, so an
|
|
399
413
|
* existing `~/.config/<app>` still wins over the OS-native directory.
|
|
@@ -427,14 +441,17 @@ export declare class XdgConfig {
|
|
|
427
441
|
* @remarks
|
|
428
442
|
* Drops straight into `ConfigFileOptions.defaultPath`, whose slot is typed
|
|
429
443
|
* `Effect<string, never, RR>`. That infallible channel is the whole reason
|
|
430
|
-
* {@link AppDirs} resolves at layer-construction time
|
|
431
|
-
*
|
|
444
|
+
* {@link AppDirs} resolves at layer-construction time, so no `orDie` is needed
|
|
445
|
+
* to fit the slot.
|
|
432
446
|
*
|
|
433
447
|
* It does **not** create the directory — `ConfigFile.save` already `mkdir -p`s
|
|
434
448
|
* the parent of whatever path it is given.
|
|
435
449
|
*
|
|
436
450
|
* @example
|
|
437
451
|
* ```ts
|
|
452
|
+
* import { XdgConfig } from "@effected/xdg";
|
|
453
|
+
* import { ConfigFile, JsonCodec, MergeStrategy } from "@effected/config-file";
|
|
454
|
+
*
|
|
438
455
|
* const layer = ConfigFile.layer(AppConfig, {
|
|
439
456
|
* schema: AppShape,
|
|
440
457
|
* codec: JsonCodec,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effected/xdg",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "XDG Base Directory resolution for Effect: environment paths, app-namespaced directories, native OS conventions and config-file resolvers.",
|
|
6
6
|
"keywords": [
|
|
@@ -38,9 +38,13 @@
|
|
|
38
38
|
"./package.json": "./package.json"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@effected/config-file": "^0.
|
|
42
|
-
"@effected/
|
|
43
|
-
"
|
|
41
|
+
"@effected/config-file": "^0.14.3",
|
|
42
|
+
"@effected/glob": "^0.10.1",
|
|
43
|
+
"@effected/jsonc": "^0.15.2",
|
|
44
|
+
"@effected/toml": "^0.11.2",
|
|
45
|
+
"@effected/walker": "^0.15.1",
|
|
46
|
+
"@effected/yaml": "^0.19.2",
|
|
47
|
+
"effect": "4.0.2"
|
|
44
48
|
},
|
|
45
49
|
"engines": {
|
|
46
50
|
"node": ">=24.11.0"
|