@coinagerie/configuration 0.0.1 โ 0.0.3
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/CHANGELOG.md +16 -0
- package/README.md +25 -81
- package/dist/src/index.d.ts +16 -6
- package/dist/src/index.js +31 -22
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 0.0.3 (2026-11-04)
|
|
2
|
+
|
|
3
|
+
### ๐งฑ Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated coinagerie-core to 0.0.3
|
|
6
|
+
|
|
7
|
+
## 0.0.2 (2026-11-04)
|
|
8
|
+
|
|
9
|
+
### ๐ Features
|
|
10
|
+
|
|
11
|
+
- **coinagerie:** โจ accept regular expressions in exclude.words ([#2109](https://github.com/organizzolini/codebase/pull/2109))
|
|
12
|
+
|
|
13
|
+
### ๐งฑ Updated Dependencies
|
|
14
|
+
|
|
15
|
+
- Updated coinagerie-core to 0.0.2
|
|
16
|
+
|
|
1
17
|
## 0.0.1 (2026-11-04)
|
|
2
18
|
|
|
3
19
|
### ๐ Features
|
package/README.md
CHANGED
|
@@ -24,68 +24,12 @@ This project was generated from the [nestjs-service-project](../../configuration
|
|
|
24
24
|
|
|
25
25
|
The words this package uses that the root glossary does not define, regenerated with `nx run coinagerie-configuration:coinagerie-check:write`.
|
|
26
26
|
|
|
27
|
-
- **absolute**:
|
|
28
|
-
- **after**:
|
|
29
|
-
- **array**:
|
|
30
27
|
- **breadth**:
|
|
31
|
-
- **bug**:
|
|
32
|
-
- **clear**:
|
|
33
|
-
- **compile**:
|
|
34
|
-
- **compiler**:
|
|
35
|
-
- **console**:
|
|
36
|
-
- **constant**:
|
|
37
|
-
- **controller**:
|
|
38
|
-
- **custom**:
|
|
39
|
-
- **decorator**:
|
|
40
|
-
- **define**:
|
|
41
|
-
- **describe**:
|
|
42
28
|
- **discriminate**:
|
|
43
|
-
- **
|
|
44
|
-
- **equal**:
|
|
45
|
-
- **experimental**:
|
|
46
|
-
- **fake**:
|
|
47
|
-
- **field**:
|
|
48
|
-
- **flag**:
|
|
29
|
+
- **exact**:
|
|
49
30
|
- **forbid**:
|
|
50
|
-
- **force**:
|
|
51
|
-
- **gitkeep**:
|
|
52
|
-
- **homepage**:
|
|
53
|
-
- **implementation**:
|
|
54
|
-
- **injectable**:
|
|
55
|
-
- **invalid**:
|
|
56
|
-
- **least**:
|
|
57
|
-
- **length**:
|
|
58
|
-
- **literal**:
|
|
59
|
-
- **load**:
|
|
60
|
-
- **locate**:
|
|
61
|
-
- **location**:
|
|
62
|
-
- **maximum**:
|
|
63
|
-
- **meta**:
|
|
64
|
-
- **min**:
|
|
65
|
-
- **mkdtemp**:
|
|
66
|
-
- **mock**:
|
|
67
|
-
- **optional**:
|
|
68
31
|
- **prettify**:
|
|
69
|
-
- **promise**:
|
|
70
|
-
- **publish**:
|
|
71
|
-
- **real**:
|
|
72
|
-
- **reason**:
|
|
73
|
-
- **recursive**:
|
|
74
32
|
- **refine**:
|
|
75
|
-
- **regex**:
|
|
76
|
-
- **reject**:
|
|
77
|
-
- **relative**:
|
|
78
|
-
- **resolution**:
|
|
79
|
-
- **safe**:
|
|
80
|
-
- **sort**:
|
|
81
|
-
- **spy**:
|
|
82
|
-
- **strict**:
|
|
83
|
-
- **stringify**:
|
|
84
|
-
- **success**:
|
|
85
|
-
- **synthetic**:
|
|
86
|
-
- **temporary**:
|
|
87
|
-
- **timer**:
|
|
88
|
-
- **vi**:
|
|
89
33
|
|
|
90
34
|
<!-- coinagerie:end -->
|
|
91
35
|
|
|
@@ -119,7 +63,7 @@ What this project is judged against, as declared in its own `callidescope.config
|
|
|
119
63
|
**1. `ConfigurationService.anonymous`** โ depth โฅ 2 ยท orphan-root
|
|
120
64
|
|
|
121
65
|
```text
|
|
122
|
-
๐ ConfigurationService.anonymous(word: string): string [projects/ic-suite/coinagerie/coinagerie-configuration/src/modules/configuration/configuration.service.ts:
|
|
66
|
+
๐ ConfigurationService.anonymous(word: string): string [projects/ic-suite/coinagerie/coinagerie-configuration/src/modules/configuration/configuration.service.ts:67]
|
|
123
67
|
โโ> InvalidConfigurationError.constructor(filePath: string, reason: string): InvalidConfigurationError [projects/ic-suite/coinagerie/coinagerie-core/src/modules/coinagerie-core/coinagerie-core.constants.ts:32]
|
|
124
68
|
```
|
|
125
69
|
|
|
@@ -127,17 +71,17 @@ What this project is judged against, as declared in its own `callidescope.config
|
|
|
127
71
|
|
|
128
72
|
| Callable | Breadth | Calls directly | Location |
|
|
129
73
|
| --- | --- | --- | --- |
|
|
130
|
-
| `ConfigurationService.locate` | 3 | `ConfigurationFileNotFoundError.constructor`, `ConfigurationService.find(โฆ)`, `ConfigurationService.map(โฆ)` | `projects/ic-suite/coinagerie/coinagerie-configuration/src/modules/configuration/configuration.service.ts:
|
|
131
|
-
| `ConfigurationService.read` | 3 | `InvalidConfigurationError.constructor`, `ConfigurationService.describe`, `ConfigurationService.resolveWords` | `projects/ic-suite/coinagerie/coinagerie-configuration/src/modules/configuration/configuration.service.ts:
|
|
132
|
-
| `ConfigurationService.resolve` | 3 | `InvalidConfigurationError.constructor`, `ConfigurationService.override`, `ConfigurationService.guardFold` | `projects/ic-suite/coinagerie/coinagerie-configuration/src/modules/configuration/configuration.service.ts:
|
|
74
|
+
| `ConfigurationService.locate` | 3 | `ConfigurationFileNotFoundError.constructor`, `ConfigurationService.find(โฆ)`, `ConfigurationService.map(โฆ)` | `projects/ic-suite/coinagerie/coinagerie-configuration/src/modules/configuration/configuration.service.ts:99` |
|
|
75
|
+
| `ConfigurationService.read` | 3 | `InvalidConfigurationError.constructor`, `ConfigurationService.describe`, `ConfigurationService.resolveWords` | `projects/ic-suite/coinagerie/coinagerie-configuration/src/modules/configuration/configuration.service.ts:169` |
|
|
76
|
+
| `ConfigurationService.resolve` | 3 | `InvalidConfigurationError.constructor`, `ConfigurationService.override`, `ConfigurationService.guardFold` | `projects/ic-suite/coinagerie/coinagerie-configuration/src/modules/configuration/configuration.service.ts:205` |
|
|
133
77
|
|
|
134
78
|
<details>
|
|
135
79
|
<summary>2 more callables</summary>
|
|
136
80
|
|
|
137
81
|
| Callable | Breadth | Calls directly | Location |
|
|
138
82
|
| --- | --- | --- | --- |
|
|
139
|
-
| `ConfigurationService.loadConfiguration` | 3 | `ConfigurationService.locate`, `ConfigurationService.resolve`, `ConfigurationService.read` | `projects/ic-suite/coinagerie/coinagerie-configuration/src/modules/configuration/configuration.service.ts:
|
|
140
|
-
| `ConfigurationService.anonymous` | 2 | `InvalidConfigurationError.constructor`, `ConfigurationService.describe` | `projects/ic-suite/coinagerie/coinagerie-configuration/src/modules/configuration/configuration.service.ts:
|
|
83
|
+
| `ConfigurationService.loadConfiguration` | 3 | `ConfigurationService.locate`, `ConfigurationService.resolve`, `ConfigurationService.read` | `projects/ic-suite/coinagerie/coinagerie-configuration/src/modules/configuration/configuration.service.ts:320` |
|
|
84
|
+
| `ConfigurationService.anonymous` | 2 | `InvalidConfigurationError.constructor`, `ConfigurationService.describe` | `projects/ic-suite/coinagerie/coinagerie-configuration/src/modules/configuration/configuration.service.ts:67` |
|
|
141
85
|
|
|
142
86
|
</details>
|
|
143
87
|
<!-- callidescope:end -->
|
|
@@ -213,19 +157,19 @@ graph LR
|
|
|
213
157
|
|
|
214
158
|
### Project
|
|
215
159
|
|
|
216
|
-

|
|
161
|
+

|
|
218
162
|

|
|
219
163
|

|
|
220
164
|
|
|
221
165
|
### TypeScript
|
|
222
166
|
|
|
223
167
|

|
|
224
|
-

|
|
225
169
|

|
|
226
170
|

|
|
227
171
|

|
|
228
|
-

|
|
229
173
|

|
|
230
174
|
|
|
231
175
|
### JavaScript
|
|
@@ -234,15 +178,15 @@ graph LR
|
|
|
234
178
|

|
|
235
179
|

|
|
236
180
|

|
|
237
|
-

|
|
238
182
|

|
|
239
|
-

|
|
184
|
+

|
|
185
|
+

|
|
242
186
|

|
|
243
|
-

|
|
188
|
+

|
|
189
|
+

|
|
246
190
|

|
|
247
191
|
|
|
248
192
|
### Python
|
|
@@ -398,20 +342,20 @@ graph LR
|
|
|
398
342
|
### Markdown
|
|
399
343
|
|
|
400
344
|

|
|
401
|
-

|
|
402
346
|

|
|
403
|
-

|
|
348
|
+

|
|
405
349
|

|
|
406
350
|

|
|
407
351
|

|
|
408
|
-

|
|
353
|
+

|
|
354
|
+

|
|
411
355
|

|
|
412
356
|

|
|
413
357
|

|
|
414
|
-

|
|
415
359
|

|
|
416
360
|

|
|
417
361
|

|
package/dist/src/index.d.ts
CHANGED
|
@@ -29,8 +29,10 @@ export declare interface CoinagerieExclusions {
|
|
|
29
29
|
/**
|
|
30
30
|
* Words left out of the glossary, as a list or as a function returning one,
|
|
31
31
|
* synchronously or not โ the function is where a configuration reads
|
|
32
|
-
* whatever else it wants to exclude.
|
|
33
|
-
*
|
|
32
|
+
* whatever else it wants to exclude. A string leaves out that exact word.
|
|
33
|
+
* A regular expression leaves out every word it matches, tested against the
|
|
34
|
+
* lowercase word and against its folded headword. Exclusion applies after
|
|
35
|
+
* folding, so excluding `service` also covers `services`. Defaults to none.
|
|
34
36
|
*/
|
|
35
37
|
words?: ExcludedWords | undefined;
|
|
36
38
|
}
|
|
@@ -142,7 +144,8 @@ export declare class ConfigurationService {
|
|
|
142
144
|
/** Fills in every default and makes every path absolute. */
|
|
143
145
|
private resolve;
|
|
144
146
|
/**
|
|
145
|
-
* The
|
|
147
|
+
* The entries a configuration excludes, calling its function when it has
|
|
148
|
+
* one, split into exact words and patterns.
|
|
146
149
|
*
|
|
147
150
|
* Throws a plain error for the caller to name the file in, so that no frame
|
|
148
151
|
* is spent on building the report here.
|
|
@@ -166,8 +169,11 @@ export declare class ConfigurationService {
|
|
|
166
169
|
*/
|
|
167
170
|
export declare const DEFAULT_INCLUDE: readonly ["**", "**/.*", "**/.*/**"];
|
|
168
171
|
|
|
169
|
-
/**
|
|
170
|
-
|
|
172
|
+
/** One entry of `exclude.words`: an exact word, or a pattern matching many. */
|
|
173
|
+
declare type ExcludedWord = RegExp | string;
|
|
174
|
+
|
|
175
|
+
/** A list of excluded words or patterns, or a function that returns one. */
|
|
176
|
+
export declare type ExcludedWords = (() => ExcludedWord[] | Promise<ExcludedWord[]>) | ExcludedWord[];
|
|
171
177
|
|
|
172
178
|
/** A function from a word to the headword it is folded into. */
|
|
173
179
|
export declare type FoldWord = (word: string) => string;
|
|
@@ -198,9 +204,13 @@ export declare interface ResolvedCoinagerieConfiguration {
|
|
|
198
204
|
/** The root the run scans: the configuration file's folder, or the
|
|
199
205
|
* working directory when there is no file. */
|
|
200
206
|
directory: string;
|
|
201
|
-
/**
|
|
207
|
+
/**
|
|
208
|
+
* `words` and `patterns` are resolved: a function in the file has been
|
|
209
|
+
* called, and every entry is either an exact word or a pattern.
|
|
210
|
+
*/
|
|
202
211
|
exclude: {
|
|
203
212
|
paths: string[];
|
|
213
|
+
patterns: RegExp[];
|
|
204
214
|
words: string[];
|
|
205
215
|
};
|
|
206
216
|
/**
|
package/dist/src/index.js
CHANGED
|
@@ -20,24 +20,24 @@ var l = [
|
|
|
20
20
|
], d = /^\s*(?:[-*+]\s|<!--)/mu, f = e.strictObject({
|
|
21
21
|
path: e.string().min(1),
|
|
22
22
|
type: e.literal("json")
|
|
23
|
-
}), p = e.string().refine((e) => !d.test(e), { message: "A description may not hold a list item or an HTML comment, which would read back as part of the glossary" }), isFunction = (e) => typeof e == "function", m = e.
|
|
23
|
+
}), p = e.string().refine((e) => !d.test(e), { message: "A description may not hold a list item or an HTML comment, which would read back as part of the glossary" }), isFunction = (e) => typeof e == "function", m = e.union([e.string(), e.instanceof(RegExp)]), h = e.array(m), g = e.string().regex(/^[^\s*]+$/u), _ = e.strictObject({
|
|
24
24
|
description: p.optional(),
|
|
25
25
|
path: e.string().min(1),
|
|
26
26
|
type: e.literal("markdown")
|
|
27
|
-
}),
|
|
27
|
+
}), v = e.strictObject({
|
|
28
28
|
description: p.optional(),
|
|
29
29
|
excludePaths: e.array(e.string()).optional(),
|
|
30
30
|
include: e.array(e.string()).optional(),
|
|
31
31
|
outputJson: e.string().min(1).optional(),
|
|
32
32
|
outputMarkdown: e.string().min(1).optional()
|
|
33
|
-
}),
|
|
33
|
+
}), y = e.strictObject({
|
|
34
34
|
exclude: e.strictObject({
|
|
35
35
|
paths: e.array(e.string()).optional(),
|
|
36
|
-
words: e.union([e.array(
|
|
36
|
+
words: e.union([e.array(m), e.custom(isFunction, { message: "Expected a list of words or regular expressions, or a function returning one" })]).optional()
|
|
37
37
|
}).optional(),
|
|
38
38
|
fold: e.custom(isFunction, { message: "Expected a function" }).optional(),
|
|
39
39
|
include: e.array(e.string()).optional(),
|
|
40
|
-
outputs: e.array(e.discriminatedUnion("type", [f,
|
|
40
|
+
outputs: e.array(e.discriminatedUnion("type", [f, _])).optional()
|
|
41
41
|
});
|
|
42
42
|
// \0@oxc-project+runtime@0.155.0/helpers/esm/decorateMetadata.js
|
|
43
43
|
function __decorateMetadata(e, t) {
|
|
@@ -51,7 +51,7 @@ function __decorate(e, t, n, r) {
|
|
|
51
51
|
return i > 3 && a && Object.defineProperty(t, n, a), a;
|
|
52
52
|
}
|
|
53
53
|
// src/modules/configuration/configuration.service.ts
|
|
54
|
-
var
|
|
54
|
+
var b = class ConfigurationService {
|
|
55
55
|
constructor() {}
|
|
56
56
|
describe(e) {
|
|
57
57
|
return e instanceof Error ? e.message : String(e);
|
|
@@ -64,7 +64,7 @@ var y = class ConfigurationService {
|
|
|
64
64
|
} catch (e) {
|
|
65
65
|
throw new s(t, `fold threw on "${n}": ${this.describe(e)}`);
|
|
66
66
|
}
|
|
67
|
-
let i =
|
|
67
|
+
let i = g.safeParse(r);
|
|
68
68
|
if (!i.success) throw new s(t, `fold must return a non-empty string without whitespace or "*", but returned ${typeof r == "string" ? JSON.stringify(r) : `a value of type ${typeof r}`} for "${n}"; it must be synchronous`);
|
|
69
69
|
return i.data;
|
|
70
70
|
};
|
|
@@ -102,19 +102,19 @@ var y = class ConfigurationService {
|
|
|
102
102
|
} catch (e) {
|
|
103
103
|
throw new s(t, this.describe(e));
|
|
104
104
|
}
|
|
105
|
-
let r =
|
|
105
|
+
let r = y.safeParse(n);
|
|
106
106
|
if (!r.success) throw new s(t, e.prettifyError(r.error));
|
|
107
107
|
try {
|
|
108
108
|
return {
|
|
109
109
|
configuration: r.data,
|
|
110
|
-
|
|
110
|
+
excluded: await this.resolveWords(r.data.exclude?.words)
|
|
111
111
|
};
|
|
112
112
|
} catch (e) {
|
|
113
113
|
throw new s(t, `exclude.words ${this.describe(e)}`);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
resolve(t) {
|
|
117
|
-
let { directory: n, location: r } = t, a =
|
|
117
|
+
let { directory: n, location: r } = t, a = v.safeParse(t.overrides ?? {});
|
|
118
118
|
if (!a.success) throw new s("the command line", e.prettifyError(a.error));
|
|
119
119
|
let o = this.override({
|
|
120
120
|
configuration: t.loaded.configuration,
|
|
@@ -138,7 +138,8 @@ var y = class ConfigurationService {
|
|
|
138
138
|
directory: n,
|
|
139
139
|
exclude: {
|
|
140
140
|
paths: o.exclude?.paths ?? [],
|
|
141
|
-
|
|
141
|
+
patterns: t.loaded.excluded.patterns,
|
|
142
|
+
words: t.loaded.excluded.words
|
|
142
143
|
},
|
|
143
144
|
fold: o.fold === void 0 ? void 0 : this.guardFold(o.fold, r),
|
|
144
145
|
include: o.include ?? [...u],
|
|
@@ -146,9 +147,14 @@ var y = class ConfigurationService {
|
|
|
146
147
|
};
|
|
147
148
|
}
|
|
148
149
|
async resolveWords(e) {
|
|
149
|
-
let t = typeof e == "function" ? await e() : e ?? [], n =
|
|
150
|
-
if (!n.success) throw Error("must be a list of strings, or a function returning one");
|
|
151
|
-
|
|
150
|
+
let t = typeof e == "function" ? await e() : e ?? [], n = h.safeParse(t);
|
|
151
|
+
if (!n.success) throw Error("must be a list of strings or RegExp objects, or a function returning one");
|
|
152
|
+
let r = [], i = [];
|
|
153
|
+
for (let e of n.data) e instanceof RegExp ? r.push(new RegExp(e.source, e.flags.replaceAll(/[gy]/gu, ""))) : i.push(e);
|
|
154
|
+
return {
|
|
155
|
+
patterns: r,
|
|
156
|
+
words: i
|
|
157
|
+
};
|
|
152
158
|
}
|
|
153
159
|
async loadConfiguration(e) {
|
|
154
160
|
let t = this.locate(e);
|
|
@@ -157,7 +163,10 @@ var y = class ConfigurationService {
|
|
|
157
163
|
directory: e.workingDirectory,
|
|
158
164
|
loaded: {
|
|
159
165
|
configuration: {},
|
|
160
|
-
|
|
166
|
+
excluded: {
|
|
167
|
+
patterns: [],
|
|
168
|
+
words: []
|
|
169
|
+
}
|
|
161
170
|
},
|
|
162
171
|
location: e.workingDirectory,
|
|
163
172
|
overrides: e.overrides,
|
|
@@ -172,13 +181,13 @@ var y = class ConfigurationService {
|
|
|
172
181
|
});
|
|
173
182
|
}
|
|
174
183
|
};
|
|
175
|
-
|
|
184
|
+
b = __decorate([t(), __decorateMetadata("design:paramtypes", [])], b);
|
|
176
185
|
// src/modules/configuration/configuration.module.ts
|
|
177
|
-
var
|
|
178
|
-
|
|
186
|
+
var x = class ConfigurationModule {};
|
|
187
|
+
x = __decorate([n({
|
|
179
188
|
controllers: [],
|
|
180
|
-
exports: [
|
|
189
|
+
exports: [b],
|
|
181
190
|
imports: [],
|
|
182
|
-
providers: [
|
|
183
|
-
})],
|
|
184
|
-
export { l as CONFIGURATION_FILE_NAMES,
|
|
191
|
+
providers: [b]
|
|
192
|
+
})], x);
|
|
193
|
+
export { l as CONFIGURATION_FILE_NAMES, x as ConfigurationModule, b as ConfigurationService, u as DEFAULT_INCLUDE };
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"url": "https://github.com/organizzolini/codebase/issues"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@coinagerie/core": "0.0.
|
|
7
|
+
"@coinagerie/core": "0.0.3",
|
|
8
8
|
"@nestjs/common": "^11.1.21 || ^12.0.1",
|
|
9
9
|
"jiti": "^2.7.0",
|
|
10
10
|
"reflect-metadata": "^0.2.2",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"strict": true
|
|
60
60
|
},
|
|
61
61
|
"types": "./dist/src/index.d.ts",
|
|
62
|
-
"version": "0.0.
|
|
62
|
+
"version": "0.0.3"
|
|
63
63
|
}
|