@effected/config-file 0.20.1 → 0.21.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.
- package/ConfigResolver.js +3 -3
- package/index.d.ts +42 -20
- package/package.json +4 -4
package/ConfigResolver.js
CHANGED
|
@@ -111,8 +111,8 @@ var ConfigResolver = class {
|
|
|
111
111
|
};
|
|
112
112
|
})));
|
|
113
113
|
/**
|
|
114
|
-
* Ascends from `cwd` (or the process cwd) toward `stopAt
|
|
115
|
-
* first `subpaths/filename` combination found at each level.
|
|
114
|
+
* Ascends from `cwd` (or the process cwd) toward `stopAt` or `ceiling`,
|
|
115
|
+
* resolving the first `subpaths/filename` combination found at each level.
|
|
116
116
|
*
|
|
117
117
|
* @remarks
|
|
118
118
|
* `filenames` replaces `filename` with a per-directory candidate list: every
|
|
@@ -130,7 +130,7 @@ var ConfigResolver = class {
|
|
|
130
130
|
const path = yield* Path.Path;
|
|
131
131
|
const subpaths = options.subpaths ?? ["."];
|
|
132
132
|
const filenames = options.filenames ?? [options.filename];
|
|
133
|
-
const dirs = yield* Walker.ascend(cwdOf(options.cwd), { ...options.stopAt !== void 0 && { stopAt: options.stopAt } });
|
|
133
|
+
const dirs = options.ceiling !== void 0 ? yield* Walker.ascendWithin(cwdOf(options.cwd), Option.some(options.ceiling)) : yield* Walker.ascend(cwdOf(options.cwd), { ...options.stopAt !== void 0 && { stopAt: options.stopAt } });
|
|
134
134
|
const candidates = [];
|
|
135
135
|
for (const dir of dirs) for (const sub of subpaths) for (const filename of filenames) candidates.push({
|
|
136
136
|
path: path.join(dir, sub, filename),
|
package/index.d.ts
CHANGED
|
@@ -411,16 +411,53 @@ interface ConfigProbe {
|
|
|
411
411
|
* (`".config/app.toml"`), which is how a mixed convention is spelled without a
|
|
412
412
|
* `subpaths` cross product.
|
|
413
413
|
*
|
|
414
|
+
* At most one of `stopAt` (a lexical ceiling) and `ceiling` (a physical
|
|
415
|
+
* one) is given. Bound the walk by a path git answered — `Git.repoRoot` — with
|
|
416
|
+
* `ceiling`; `stopAt` never matches a symlink-resolved spelling of the start.
|
|
417
|
+
*
|
|
414
418
|
* @public
|
|
415
419
|
*/
|
|
416
|
-
type UpwardWalkOptions = {
|
|
420
|
+
type UpwardWalkOptions = ({
|
|
417
421
|
/** The single file name probed at each ancestor directory. */
|
|
418
422
|
readonly filename: string;
|
|
419
423
|
readonly filenames?: undefined;
|
|
424
|
+
} | {
|
|
425
|
+
/**
|
|
426
|
+
* The candidate file names probed at each ancestor directory, in order,
|
|
427
|
+
* before the walk ascends.
|
|
428
|
+
*/
|
|
429
|
+
readonly filenames: ReadonlyArray<string>;
|
|
430
|
+
readonly filename?: undefined;
|
|
431
|
+
}) & ({
|
|
432
|
+
/**
|
|
433
|
+
* An absolute ceiling the walk stops at, inclusive, compared
|
|
434
|
+
* LEXICALLY (`Walker.ascend`'s `stopAt`).
|
|
435
|
+
*
|
|
436
|
+
* @remarks
|
|
437
|
+
* A ceiling spelled differently from the walk's own path never
|
|
438
|
+
* matches, and the walk runs on to the filesystem root. That is
|
|
439
|
+
* every physical path — `Git.repoRoot`'s answer from a symlinked or
|
|
440
|
+
* macOS-tmpdir start — so bound by such a path with `ceiling`.
|
|
441
|
+
*/
|
|
442
|
+
readonly stopAt?: string;
|
|
443
|
+
readonly ceiling?: undefined;
|
|
444
|
+
} | {
|
|
445
|
+
/**
|
|
446
|
+
* A ceiling the walk stops at, inclusive, compared PHYSICALLY: the
|
|
447
|
+
* nearest ancestor whose real path is the ceiling's real path
|
|
448
|
+
* (`Walker.ascendWithin`).
|
|
449
|
+
*
|
|
450
|
+
* @remarks
|
|
451
|
+
* For a ceiling that may be spelled differently from the walk's own
|
|
452
|
+
* path, above all `Git.repoRoot`'s symlink-resolved answer. Omit it
|
|
453
|
+
* to walk to the filesystem root. A relative ceiling is a defect.
|
|
454
|
+
* Cannot be combined with `stopAt`.
|
|
455
|
+
*/
|
|
456
|
+
readonly ceiling?: string;
|
|
457
|
+
readonly stopAt?: undefined;
|
|
458
|
+
}) & {
|
|
420
459
|
/** Where the walk starts. Defaults to the process cwd. */
|
|
421
460
|
readonly cwd?: string;
|
|
422
|
-
/** An absolute ceiling the walk stops at, inclusive. */
|
|
423
|
-
readonly stopAt?: string;
|
|
424
461
|
/** Directories probed under each ancestor, in order. Defaults to `["."]`. */
|
|
425
462
|
readonly subpaths?: ReadonlyArray<string>;
|
|
426
463
|
/**
|
|
@@ -433,21 +470,6 @@ type UpwardWalkOptions = {
|
|
|
433
470
|
* identifies the matching candidate rather than the resolver.
|
|
434
471
|
*/
|
|
435
472
|
readonly name?: string;
|
|
436
|
-
} | {
|
|
437
|
-
/**
|
|
438
|
-
* The candidate file names probed at each ancestor directory, in order,
|
|
439
|
-
* before the walk ascends.
|
|
440
|
-
*/
|
|
441
|
-
readonly filenames: ReadonlyArray<string>;
|
|
442
|
-
readonly filename?: undefined;
|
|
443
|
-
/** Where the walk starts. Defaults to the process cwd. */
|
|
444
|
-
readonly cwd?: string;
|
|
445
|
-
/** An absolute ceiling the walk stops at, inclusive. */
|
|
446
|
-
readonly stopAt?: string;
|
|
447
|
-
/** Directories probed under each ancestor, in order. Defaults to `["."]`. */
|
|
448
|
-
readonly subpaths?: ReadonlyArray<string>;
|
|
449
|
-
/** The resolver's reported name. Defaults to `"walk"`. */
|
|
450
|
-
readonly name?: string;
|
|
451
473
|
};
|
|
452
474
|
/**
|
|
453
475
|
* Built-in resolvers, in the order a typical chain uses them.
|
|
@@ -464,8 +486,8 @@ export declare class ConfigResolver {
|
|
|
464
486
|
readonly filename: string;
|
|
465
487
|
}) => ConfigResolver<FileSystem.FileSystem | Path.Path>;
|
|
466
488
|
/**
|
|
467
|
-
* Ascends from `cwd` (or the process cwd) toward `stopAt
|
|
468
|
-
* first `subpaths/filename` combination found at each level.
|
|
489
|
+
* Ascends from `cwd` (or the process cwd) toward `stopAt` or `ceiling`,
|
|
490
|
+
* resolving the first `subpaths/filename` combination found at each level.
|
|
469
491
|
*
|
|
470
492
|
* @remarks
|
|
471
493
|
* `filenames` replaces `filename` with a per-directory candidate list: every
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effected/config-file",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Composable config file loading for Effect: JSON, JSONC, YAML and TOML codecs, resolution strategies, and merge behaviors.",
|
|
6
6
|
"keywords": [
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"./package.json": "./package.json"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@effected/glob": "^0.
|
|
62
|
-
"@effected/jsonc": "^0.20.
|
|
61
|
+
"@effected/glob": "^0.15.0",
|
|
62
|
+
"@effected/jsonc": "^0.20.1",
|
|
63
63
|
"@effected/toml": "^0.16.0",
|
|
64
|
-
"@effected/walker": "^0.
|
|
64
|
+
"@effected/walker": "^0.21.0",
|
|
65
65
|
"@effected/yaml": "^0.25.1",
|
|
66
66
|
"effect": "^4.0.0"
|
|
67
67
|
},
|