@conformetry/configuration 0.0.5 โ 0.0.7
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 +111 -85
- package/dist/src/index.d.ts +83 -8
- package/dist/src/index.js +192 -131
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 0.0.7 (2026-10-08)
|
|
2
|
+
|
|
3
|
+
### ๐งฑ Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated conformetry-core to 0.0.7
|
|
6
|
+
|
|
7
|
+
## 0.0.6 (2026-10-08)
|
|
8
|
+
|
|
9
|
+
### ๐ Features
|
|
10
|
+
|
|
11
|
+
- **conformetry,lexico:** โจ add frontend conformetry templates and infer validation inputs ([#1301](https://github.com/organizzolini/codebase/pull/1301))
|
|
12
|
+
|
|
13
|
+
### ๐งฑ Updated Dependencies
|
|
14
|
+
|
|
15
|
+
- Updated conformetry-core to 0.0.6
|
|
16
|
+
|
|
1
17
|
## 0.0.5 (2026-10-06)
|
|
2
18
|
|
|
3
19
|
### ๐
Refactors
|
package/README.md
CHANGED
|
@@ -98,6 +98,7 @@ instances: [
|
|
|
98
98
|
|
|
99
99
|
| Field | Purpose |
|
|
100
100
|
| ----- | ------- |
|
|
101
|
+
| `exclude` | Workspace-relative globs naming paths that are never instances, applied with or without `tags` |
|
|
101
102
|
| `patterns` | Globs locating this group's instances, workspace-relative |
|
|
102
103
|
| `substitutions` | Values the template's placeholders are rendered with for this group |
|
|
103
104
|
| `tags` | Labels selecting which hosts the group applies to, carried uninterpreted |
|
|
@@ -107,12 +108,23 @@ Groups exist so substitutions can differ per glob. `type` is `packages` for one
|
|
|
107
108
|
set of paths and `applications` for another, and no generic rule can tell them
|
|
108
109
|
apart.
|
|
109
110
|
|
|
110
|
-
> **
|
|
111
|
-
>
|
|
112
|
-
>
|
|
113
|
-
>
|
|
114
|
-
> is an
|
|
115
|
-
>
|
|
111
|
+
> **A placeholder these substitutions leave out is read from the instance.**
|
|
112
|
+
> Validation renders a random stand-in for it, captures the text the instance
|
|
113
|
+
> holds where the template's first use of it aligns, renders the template again
|
|
114
|
+
> with that text, and compares as usual โ so a later use holding different text
|
|
115
|
+
> is an ordinary difference. When nothing aligns, the instance fails with
|
|
116
|
+
> `Could not infer {{โฆ}}`. `name` and its variants always come from the
|
|
117
|
+
> instance path, and a value supplied here always wins. Generation has no
|
|
118
|
+
> instance to read, so there a placeholder nobody supplied still raises
|
|
119
|
+
> `MissingSubstitutionError` โ see
|
|
120
|
+
> [`@conformetry/generation`](../conformetry-generation/README.md) for why, and
|
|
121
|
+
> for the section syntax a template uses to make a placeholder optional.
|
|
122
|
+
|
|
123
|
+
`exclude` drops any instance whose own path โ the directory a pattern found, or
|
|
124
|
+
the files of a file instance โ matches one of its globs, whether or not the
|
|
125
|
+
group has `tags`. It is how vendored or generated code living beside real
|
|
126
|
+
instances, such as shadcn's component output, is left out of validation:
|
|
127
|
+
`exclude: ["applications/lexico/src/components/ui/**"]`.
|
|
116
128
|
|
|
117
129
|
`tags` is carried through untouched by this package, which has no notion of a
|
|
118
130
|
host to match labels against. [`@conformetry/nx`](../conformetry-nx/README.md)
|
|
@@ -271,9 +283,9 @@ Call stacks traced through `packages/ic-suite/conformetry/conformetry-configurat
|
|
|
271
283
|
|
|
272
284
|
| Measure | Value |
|
|
273
285
|
| --- | --- |
|
|
274
|
-
| Callables |
|
|
275
|
-
| Files |
|
|
276
|
-
| Calls traced |
|
|
286
|
+
| Callables | 181 |
|
|
287
|
+
| Files | 38 |
|
|
288
|
+
| Calls traced | 165 |
|
|
277
289
|
| Call stacks | 5 |
|
|
278
290
|
| Deepest stack | 10 |
|
|
279
291
|
| Stacks through recursion | 0 |
|
|
@@ -293,23 +305,23 @@ What this project is judged against, as declared in its own `callidescope.config
|
|
|
293
305
|
**1. `InstanceDiscoveryService.matchTemplates`** โ depth โฅ 10 ยท orphan-root
|
|
294
306
|
|
|
295
307
|
```text
|
|
296
|
-
๐ InstanceDiscoveryService.matchTemplates(โฆ): TemplateMatch[] [packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:
|
|
308
|
+
๐ InstanceDiscoveryService.matchTemplates(โฆ): TemplateMatch[] [packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:131]
|
|
297
309
|
โณ Ranks every template that shares a file with one instance, best first.
|
|
298
|
-
โโ> InstanceDiscoveryMatchingService.matchTemplates(โฆ): TemplateMatch[] [packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts:
|
|
310
|
+
โโ> InstanceDiscoveryMatchingService.matchTemplates(โฆ): TemplateMatch[] [packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts:180]
|
|
299
311
|
โณ Weighs every template that shares at least one file with the instance, best-first.
|
|
300
|
-
โโ> InstanceDiscoveryMatchingService.map(โฆ)(โฆ): { matchedFileCount: number; matchRatio: number; template: TemplateDefinition; } [packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts:
|
|
301
|
-
โโ> TemplateDiscoveryService.countMatchingFiles(โฆ): number [packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:
|
|
312
|
+
โโ> InstanceDiscoveryMatchingService.map(โฆ)(โฆ): { matchedFileCount: number; matchRatio: number; template: TemplateDefinition; placeholderValues: Substitutions; substitutions: Substitutions; } [packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts:186]
|
|
313
|
+
โโ> TemplateDiscoveryService.countMatchingFiles(โฆ): number [packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:146]
|
|
302
314
|
โณ Counts how many of a template's files the instance path already has.
|
|
303
|
-
โโ> TemplateDiscoveryService.filter(โฆ)(templateFilePath: string): boolean [packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:
|
|
304
|
-
โโ> TemplateDiscoveryService.resolveInstanceFilePath(โฆ): string [packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:
|
|
315
|
+
โโ> TemplateDiscoveryService.filter(โฆ)(templateFilePath: string): boolean [packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:155]
|
|
316
|
+
โโ> TemplateDiscoveryService.resolveInstanceFilePath(โฆ): string [packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:204]
|
|
305
317
|
โณ Maps a template file path to the instance file path it governs.
|
|
306
318
|
โโ> RenderingService.renderPath(โฆ): string [packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.service.ts:142]
|
|
307
319
|
โณ Renders a template path with mustache, the same way contents are rendered.
|
|
308
320
|
โโ> RenderingService.assertEverySubstitutionSupplied(โฆ): void [packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.service.ts:35]
|
|
309
321
|
โณ Refuses to render a template asking for a value nobody supplied.
|
|
310
|
-
โโ> RenderingService.collectInterpolatedNames(template: string): string[] [packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.service.ts:
|
|
322
|
+
โโ> RenderingService.collectInterpolatedNames(template: string): string[] [packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.service.ts:80]
|
|
311
323
|
โณ Every placeholder a template interpolates, deduplicated.
|
|
312
|
-
โโ> RenderingService.walk(spans: TemplateSpans): void [packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.service.ts:
|
|
324
|
+
โโ> RenderingService.walk(spans: TemplateSpans): void [packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.service.ts:82]
|
|
313
325
|
```
|
|
314
326
|
|
|
315
327
|
**2. `InputService.resolveInputsFromValues`** โ depth โฅ 8 ยท orphan-root
|
|
@@ -363,11 +375,11 @@ What this project is judged against, as declared in its own `callidescope.config
|
|
|
363
375
|
**5. `InstanceDiscoveryService.buildSubstitutions`** โ depth 3 ยท orphan-root
|
|
364
376
|
|
|
365
377
|
```text
|
|
366
|
-
๐ InstanceDiscoveryService.buildSubstitutions(โฆ): Substitutions [packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:
|
|
378
|
+
๐ InstanceDiscoveryService.buildSubstitutions(โฆ): Substitutions [packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:111]
|
|
367
379
|
โณ Builds the substitutions an instance's template is rendered with.
|
|
368
|
-
โโ> InstanceDiscoveryMatchingService.buildSubstitutions(instance: Instance): Substitutions [packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts:
|
|
380
|
+
โโ> InstanceDiscoveryMatchingService.buildSubstitutions(instance: Instance): Substitutions [packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts:97]
|
|
369
381
|
โณ Builds the substitutions an instance's template is rendered with.
|
|
370
|
-
โโ> RenderingService.buildNameSubstitutions(name: string): Substitutions [packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.service.ts:
|
|
382
|
+
โโ> RenderingService.buildNameSubstitutions(name: string): Substitutions [packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.service.ts:60]
|
|
371
383
|
โณ Derives the case variants every template can reference from one name.
|
|
372
384
|
```
|
|
373
385
|
|
|
@@ -377,20 +389,20 @@ What this project is judged against, as declared in its own `callidescope.config
|
|
|
377
389
|
|
|
378
390
|
| Callable | Breadth | Calls directly | Location |
|
|
379
391
|
| --- | --- | --- | --- |
|
|
380
|
-
| `
|
|
392
|
+
| `InstanceDiscoveryLocatingService.findInstances` | 5 | `InstanceDiscoveryLocatingService.resolveGlobSuffix`, `InstanceDiscoveryLocatingService.globEntries`, `InstanceDiscoveryLocatingService.resolveNameStem`, `InstanceDiscoveryLocatingService.map(โฆ)`, `InstanceDiscoveryLocatingService.toSorted(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-locating.service.ts:156` |
|
|
393
|
+
| `InstanceDiscoveryMatchingService.matchInstances` | 5 | `InstanceDiscoveryMatchingService.buildSubstitutions`, `InstanceDiscoveryMatchingService.matchTemplates`, `InstanceDiscoveryMatchingService.filter(โฆ)`, `InstanceDiscoveryMatchingService.map(โฆ)`, `InstanceDiscoveryMatchingService.map(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts:118` |
|
|
381
394
|
| `InputPromptingService.promptForInput` | 4 | `InputPromptingService.assertCanPrompt`, `InputSchemaService.readEnumValues`, `InputPromptingService.map(โฆ)`, `InputSchemaService.readPromptMessage` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input-prompting.service.ts:90` |
|
|
382
|
-
| `InputService.resolveInputs` | 4 | `InputSchemaService.readPropertyNames`, `InputSchemaService.describeInput`, `InputService.acceptProvidedValue`, `InputService.resolveMissingValue` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input.service.ts:53` |
|
|
383
395
|
|
|
384
396
|
<details>
|
|
385
|
-
<summary>
|
|
397
|
+
<summary>100 more callables</summary>
|
|
386
398
|
|
|
387
399
|
| Callable | Breadth | Calls directly | Location |
|
|
388
400
|
| --- | --- | --- | --- |
|
|
401
|
+
| `InputService.resolveInputs` | 4 | `InputSchemaService.readPropertyNames`, `InputSchemaService.describeInput`, `InputService.acceptProvidedValue`, `InputService.resolveMissingValue` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input.service.ts:53` |
|
|
389
402
|
| `InputService.resolveMissingValue` | 4 | `InputPromptingService.isAtTerminal`, `missingInputError`, `InputPromptingService.promptForInput`, `InputSchemaService.validateValue` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input.service.ts:94` |
|
|
390
|
-
| `
|
|
391
|
-
| `InstanceDiscoveryService.
|
|
392
|
-
| `InstanceDiscoveryService.
|
|
393
|
-
| `InstanceDiscoveryService.takeInventory` | 4 | `TemplateDiscoveryService.collectTemplates`, `InstanceDiscoveryService.flatMap(โฆ)`, `InstanceDiscoveryService.findInstances`, `InstanceDiscoveryService.map(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:255` |
|
|
403
|
+
| `InstanceDiscoveryService.resolveInventoriedInstances` | 4 | `InstanceDiscoveryService.takeInventory`, `InstanceDiscoveryService.map(โฆ)`, `InstanceDiscoveryService.filter(โฆ)`, `InstanceDiscoveryService.map(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:219` |
|
|
404
|
+
| `InstanceDiscoveryService.resolveInventoriedTemplates` | 4 | `InstanceDiscoveryService.takeInventory`, `InstanceDiscoveryService.filter(โฆ)`, `InstanceDiscoveryService.map(โฆ)`, `InstanceDiscoveryService.filter(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:244` |
|
|
405
|
+
| `InstanceDiscoveryService.takeInventory` | 4 | `TemplateDiscoveryService.collectTemplates`, `InstanceDiscoveryService.findInstances`, `InstanceDiscoveryService.readInventoryGlobs`, `InstanceDiscoveryService.map(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:283` |
|
|
394
406
|
| `ConfigurationService.loadConformetryConfiguration` | 4 | `ConfigurationService.resolveConfigurationPath`, `UnknownConfigurationFileTypeError.constructor`, `ConfigurationService.loadConfigurationModule`, `ConfigurationService.map(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/configuration/configuration.service.ts:243` |
|
|
395
407
|
| `assertNoCollisions` | 3 | `findDuplicates`, `findUnusableNames`, `findReservedNames` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/configuration/configuration.utilities.ts:28` |
|
|
396
408
|
| `findReservedNames` | 3 | `map(โฆ)`, `filter(โฆ)`, `map(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/configuration/configuration.utilities.ts:97` |
|
|
@@ -398,17 +410,20 @@ What this project is judged against, as declared in its own `callidescope.config
|
|
|
398
410
|
| `InputOptionsService.collectOneInput` | 3 | `InputOptionsService.readOptionName`, `InputOptionsService.resolvePropertyName`, `InputOptionsService.readOptionValue` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input-options.service.ts:38` |
|
|
399
411
|
| `InputSchemaService.validateValue` | 3 | `InputSchemaService.validateEnum`, `InputSchemaService.validateLength`, `InputSchemaService.validatePattern` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input-schema.service.ts:158` |
|
|
400
412
|
| `RenderingService.assertEverySubstitutionSupplied` | 3 | `RenderingService.filter(โฆ)`, `RenderingService.collectInterpolatedNames`, `MissingSubstitutionError.constructor` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.service.ts:35` |
|
|
401
|
-
| `InstanceDiscoveryMatchingService.matchTemplates` | 3 | `InstanceDiscoveryMatchingService.toSorted(โฆ)`, `InstanceDiscoveryMatchingService.filter(โฆ)`, `InstanceDiscoveryMatchingService.map(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts:
|
|
402
|
-
| `InstanceDiscoveryService.
|
|
403
|
-
| `InstanceDiscoveryService.
|
|
413
|
+
| `InstanceDiscoveryMatchingService.matchTemplates` | 3 | `InstanceDiscoveryMatchingService.toSorted(โฆ)`, `InstanceDiscoveryMatchingService.filter(โฆ)`, `InstanceDiscoveryMatchingService.map(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts:180` |
|
|
414
|
+
| `InstanceDiscoveryService.readInventoryGlobs` | 3 | `InstanceDiscoveryService.flatMap(โฆ)`, `InstanceDiscoveryService.flatMap(โฆ)`, `InstanceDiscoveryService.flatMap(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:62` |
|
|
415
|
+
| `InstanceDiscoveryService.weighInstance` | 3 | `InstanceDiscoveryService.map(โฆ)`, `InstanceDiscoveryMatchingService.matchTemplates`, `InstanceDiscoveryMatchingService.buildSubstitutions` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:84` |
|
|
416
|
+
| `InstanceDiscoveryService.map(โฆ)` | 3 | `InstanceDiscoveryService.filter(โฆ)`, `InstanceDiscoveryService.map(โฆ)`, `InstanceDiscoveryService.filter(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:146` |
|
|
404
417
|
| `findDuplicates` | 2 | `map(โฆ)`, `filter(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/configuration/configuration.utilities.ts:62` |
|
|
405
418
|
| `InputSchemaService.readEnumValues` | 2 | `InputSchemaService.readSchemaProperty`, `InputSchemaService.filter(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input-schema.service.ts:123` |
|
|
406
419
|
| `InputPromptingService.assertCanPrompt` | 2 | `InputPromptingService.isAtTerminal`, `missingInputError` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input-prompting.service.ts:50` |
|
|
407
420
|
| `InputPromptingService.promptForTemplates` | 2 | `InputPromptingService.map(โฆ)`, `InputPromptingService.filter(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input-prompting.service.ts:144` |
|
|
408
421
|
| `InputService.parseCommaDelimitedOption` | 2 | `InputService.filter(โฆ)`, `InputService.map(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input.service.ts:118` |
|
|
409
422
|
| `InputService.resolveGeneratorInputs` | 2 | `InputOptionsService.collectGeneratorInputs`, `InputService.resolveInputs` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input.service.ts:180` |
|
|
410
|
-
| `TemplateDiscoveryService.
|
|
411
|
-
| `
|
|
423
|
+
| `TemplateDiscoveryService.collectTemplate` | 2 | `TemplateDiscoveryService.collectFilePaths`, `TemplateDiscoveryService.collectPlaceholderNames` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:97` |
|
|
424
|
+
| `TemplateDiscoveryService.prepareDocument` | 2 | `TemplateDiscoveryService.resolveInstanceFilePath`, `RenderingService.renderContent` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:178` |
|
|
425
|
+
| `InstanceDiscoveryMatchingService.fillPlaceholders` | 2 | `InstanceDiscoveryMatchingService.map(โฆ)`, `InstanceDiscoveryMatchingService.filter(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts:73` |
|
|
426
|
+
| `InstanceDiscoveryMatchingService.map(โฆ)` | 2 | `InstanceDiscoveryMatchingService.fillPlaceholders`, `TemplateDiscoveryService.countMatchingFiles` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts:186` |
|
|
412
427
|
| `missingInputError` | 1 | `InputError.constructor` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input.constants.ts:65` |
|
|
413
428
|
| `InputOptionsService.resolvePropertyName` | 1 | `InputOptionsService.find(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input-options.service.ts:104` |
|
|
414
429
|
| `InputOptionsService.collectGeneratorInputs` | 1 | `InputOptionsService.collectOneInput` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input-options.service.ts:124` |
|
|
@@ -425,35 +440,41 @@ What this project is judged against, as declared in its own `callidescope.config
|
|
|
425
440
|
| `InputService.parseThresholdOption` | 1 | `InputService.parseOptionalOption` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input.service.ts:161` |
|
|
426
441
|
| `InputService.resolveInputsFromValues` | 1 | `InputService.resolveInputs` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input.service.ts:195` |
|
|
427
442
|
| `MissingSubstitutionError.constructor` | 1 | `MissingSubstitutionError.map(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.constants.ts:31` |
|
|
428
|
-
| `RenderingService.collectInterpolatedNames` | 1 | `RenderingService.walk` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.service.ts:
|
|
443
|
+
| `RenderingService.collectInterpolatedNames` | 1 | `RenderingService.walk` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.service.ts:80` |
|
|
429
444
|
| `RenderingService.renderContent` | 1 | `RenderingService.assertEverySubstitutionSupplied` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.service.ts:115` |
|
|
430
445
|
| `RenderingService.renderPath` | 1 | `RenderingService.assertEverySubstitutionSupplied` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.service.ts:142` |
|
|
431
|
-
| `TemplateDiscoveryService.
|
|
432
|
-
| `TemplateDiscoveryService.
|
|
433
|
-
| `TemplateDiscoveryService.
|
|
434
|
-
| `TemplateDiscoveryService.
|
|
435
|
-
| `TemplateDiscoveryService.
|
|
436
|
-
| `TemplateDiscoveryService.
|
|
437
|
-
| `
|
|
438
|
-
| `
|
|
439
|
-
| `
|
|
440
|
-
| `
|
|
441
|
-
| `
|
|
442
|
-
| `
|
|
443
|
-
| `
|
|
444
|
-
| `
|
|
445
|
-
| `
|
|
446
|
-
| `
|
|
447
|
-
| `InstanceDiscoveryService.
|
|
448
|
-
| `InstanceDiscoveryService.
|
|
449
|
-
| `InstanceDiscoveryService.
|
|
450
|
-
| `InstanceDiscoveryService.
|
|
451
|
-
| `InstanceDiscoveryService.
|
|
452
|
-
| `InstanceDiscoveryService.
|
|
453
|
-
| `InstanceDiscoveryService.map(โฆ)` | 1 | `
|
|
454
|
-
| `InstanceDiscoveryService.
|
|
455
|
-
| `InstanceDiscoveryService.
|
|
456
|
-
| `InstanceDiscoveryService.
|
|
446
|
+
| `TemplateDiscoveryService.collectPlaceholderNames` | 1 | `TemplateDiscoveryService.flatMap(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:71` |
|
|
447
|
+
| `TemplateDiscoveryService.flatMap(โฆ)` | 1 | `TemplateDiscoveryService.flatMap(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:77` |
|
|
448
|
+
| `TemplateDiscoveryService.flatMap(โฆ)` | 1 | `RenderingService.collectInterpolatedNames` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:81` |
|
|
449
|
+
| `TemplateDiscoveryService.collectTemplates` | 1 | `TemplateDiscoveryService.map(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:123` |
|
|
450
|
+
| `TemplateDiscoveryService.map(โฆ)` | 1 | `TemplateDiscoveryService.collectTemplate` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:127` |
|
|
451
|
+
| `TemplateDiscoveryService.countMatchingFiles` | 1 | `TemplateDiscoveryService.filter(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:146` |
|
|
452
|
+
| `TemplateDiscoveryService.filter(โฆ)` | 1 | `TemplateDiscoveryService.resolveInstanceFilePath` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:155` |
|
|
453
|
+
| `TemplateDiscoveryService.resolveInstanceFilePath` | 1 | `RenderingService.renderPath` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts:204` |
|
|
454
|
+
| `InstanceDiscoveryLocatingService.globEntries` | 1 | `InstanceDiscoveryLocatingService.filter(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-locating.service.ts:66` |
|
|
455
|
+
| `InstanceDiscoveryLocatingService.filter(โฆ)` | 1 | `InstanceDiscoveryLocatingService.isExcluded` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-locating.service.ts:76` |
|
|
456
|
+
| `InstanceDiscoveryLocatingService.isExcluded` | 1 | `InstanceDiscoveryLocatingService.some(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-locating.service.ts:85` |
|
|
457
|
+
| `InstanceDiscoveryLocatingService.resolveGlobSuffix` | 1 | `InstanceDiscoveryLocatingService.map(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-locating.service.ts:108` |
|
|
458
|
+
| `InstanceDiscoveryLocatingService.map(โฆ)` | 1 | `InstanceDiscoveryLocatingService.deriveLocationSubstitutions` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-locating.service.ts:195` |
|
|
459
|
+
| `InstanceDiscoveryMatchingService.map(โฆ)` | 1 | `createPlaceholderValue` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts:80` |
|
|
460
|
+
| `InstanceDiscoveryMatchingService.buildSubstitutions` | 1 | `RenderingService.buildNameSubstitutions` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts:97` |
|
|
461
|
+
| `InstanceDiscoveryMatchingService.toSorted(โฆ)` | 1 | `InstanceDiscoveryMatchingService.compareMatches` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts:211` |
|
|
462
|
+
| `InstanceDiscoveryService.flatMap(โฆ)` | 1 | `InstanceDiscoveryService.readWorkspaceGroups` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:72` |
|
|
463
|
+
| `InstanceDiscoveryService.buildSubstitutions` | 1 | `InstanceDiscoveryMatchingService.buildSubstitutions` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:111` |
|
|
464
|
+
| `InstanceDiscoveryService.findInstances` | 1 | `InstanceDiscoveryLocatingService.findInstances` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:118` |
|
|
465
|
+
| `InstanceDiscoveryService.matchInstances` | 1 | `InstanceDiscoveryMatchingService.matchInstances` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:123` |
|
|
466
|
+
| `InstanceDiscoveryService.matchTemplates` | 1 | `InstanceDiscoveryMatchingService.matchTemplates` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:131` |
|
|
467
|
+
| `InstanceDiscoveryService.prepareDocuments` | 1 | `InstanceDiscoveryService.map(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:141` |
|
|
468
|
+
| `InstanceDiscoveryService.map(โฆ)` | 1 | `TemplateDiscoveryService.prepareDocument` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:152` |
|
|
469
|
+
| `InstanceDiscoveryService.readWorkspaceGroups` | 1 | `InstanceDiscoveryService.filter(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:186` |
|
|
470
|
+
| `InstanceDiscoveryService.filter(โฆ)` | 1 | `InstanceGroupService.isProjectScoped` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:189` |
|
|
471
|
+
| `InstanceDiscoveryService.resolveInstanceFiles` | 1 | `InstanceDiscoveryService.flatMap(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:195` |
|
|
472
|
+
| `InstanceDiscoveryService.flatMap(โฆ)` | 1 | `InstanceDiscoveryService.map(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:196` |
|
|
473
|
+
| `InstanceDiscoveryService.map(โฆ)` | 1 | `TemplateDiscoveryService.resolveInstanceFilePath` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:197` |
|
|
474
|
+
| `InstanceDiscoveryService.map(โฆ)` | 1 | `InstanceDiscoveryService.filter(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:228` |
|
|
475
|
+
| `InstanceDiscoveryService.map(โฆ)` | 1 | `InstanceDiscoveryService.flatMap(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:256` |
|
|
476
|
+
| `InstanceDiscoveryService.flatMap(โฆ)` | 1 | `InstanceDiscoveryService.find(โฆ)` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:257` |
|
|
477
|
+
| `InstanceDiscoveryService.map(โฆ)` | 1 | `InstanceDiscoveryService.weighInstance` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts:295` |
|
|
457
478
|
| `ConfigurationService.loadConfigurationModule` | 1 | `ConfigurationService.loadJsonConfiguration` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/configuration/configuration.service.ts:135` |
|
|
458
479
|
| `ConfigurationService.resolveConfigurationPath` | 1 | `ConfigurationService.findWorkspaceRoot` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/configuration/configuration.service.ts:174` |
|
|
459
480
|
| `ConfigurationService.buildNameSubstitutions` | 1 | `RenderingService.buildNameSubstitutions` | `packages/ic-suite/conformetry/conformetry-configuration/src/modules/configuration/configuration.service.ts:202` |
|
|
@@ -583,6 +604,8 @@ graph LR
|
|
|
583
604
|
file_src_modules_rendering_rendering_service_ts["src/modules/rendering/rendering.service.ts"]
|
|
584
605
|
file_src_modules_rendering_rendering_service_unit_test_ts["src/modules/rendering/rendering.service.unit.test.ts"]
|
|
585
606
|
file_src_modules_rendering_rendering_types_ts["src/modules/rendering/rendering.types.ts"]
|
|
607
|
+
file_src_modules_rendering_rendering_utilities_ts["src/modules/rendering/rendering.utilities.ts"]
|
|
608
|
+
file_src_modules_rendering_rendering_utilities_unit_test_ts["src/modules/rendering/rendering.utilities.unit.test.ts"]
|
|
586
609
|
file_src_modules_template_discovery_template_discovery_constants_ts["src/modules/template-discovery/template-discovery.constants.ts"]
|
|
587
610
|
file_src_modules_template_discovery_template_discovery_module_ts["src/modules/template-discovery/template-discovery.module.ts"]
|
|
588
611
|
file_src_modules_template_discovery_template_discovery_service_ts["src/modules/template-discovery/template-discovery.service.ts"]
|
|
@@ -658,6 +681,7 @@ graph LR
|
|
|
658
681
|
file_src_modules_instance_discovery_instance_discovery_matching_service_ts --> file_src_modules_instance_discovery_instance_discovery_types_ts
|
|
659
682
|
file_src_modules_instance_discovery_instance_discovery_matching_service_ts --> file_src_modules_rendering_rendering_service_ts
|
|
660
683
|
file_src_modules_instance_discovery_instance_discovery_matching_service_ts --> file_src_modules_rendering_rendering_types_ts
|
|
684
|
+
file_src_modules_instance_discovery_instance_discovery_matching_service_ts --> file_src_modules_rendering_rendering_utilities_ts
|
|
661
685
|
file_src_modules_instance_discovery_instance_discovery_matching_service_ts --> file_src_modules_template_discovery_template_discovery_service_ts
|
|
662
686
|
file_src_modules_instance_discovery_instance_discovery_matching_service_ts --> file_src_modules_template_discovery_template_discovery_types_ts
|
|
663
687
|
file_src_modules_instance_discovery_instance_discovery_matching_service_unit_test_ts --> file_src_modules_instance_discovery_instance_discovery_matching_service_ts
|
|
@@ -692,6 +716,8 @@ graph LR
|
|
|
692
716
|
file_src_modules_rendering_rendering_service_ts --> file_src_modules_rendering_rendering_types_ts
|
|
693
717
|
file_src_modules_rendering_rendering_service_unit_test_ts --> file_src_modules_rendering_rendering_constants_ts
|
|
694
718
|
file_src_modules_rendering_rendering_service_unit_test_ts --> file_src_modules_rendering_rendering_service_ts
|
|
719
|
+
file_src_modules_rendering_rendering_utilities_ts --> file_src_modules_rendering_rendering_constants_ts
|
|
720
|
+
file_src_modules_rendering_rendering_utilities_unit_test_ts --> file_src_modules_rendering_rendering_utilities_ts
|
|
695
721
|
file_src_modules_template_discovery_template_discovery_module_ts --> file_src_modules_rendering_rendering_module_ts
|
|
696
722
|
file_src_modules_template_discovery_template_discovery_module_ts --> file_src_modules_template_discovery_template_discovery_service_ts
|
|
697
723
|
file_src_modules_template_discovery_template_discovery_service_ts --> file_src_modules_configuration_configuration_types_ts
|
|
@@ -710,40 +736,40 @@ graph LR
|
|
|
710
736
|
|
|
711
737
|
### Project
|
|
712
738
|
|
|
713
|
-

|
|
740
|
+

|
|
715
741
|

|
|
716
|
-

|
|
717
743
|
|
|
718
744
|
### Measured Targets
|
|
719
745
|
|
|
720
|
-

|
|
721
747
|
|
|
722
748
|
### TypeScript
|
|
723
749
|
|
|
724
|
-

|
|
725
751
|

|
|
726
752
|

|
|
727
753
|

|
|
728
754
|

|
|
729
|
-

|
|
730
756
|

|
|
731
757
|
|
|
732
758
|
### JavaScript
|
|
733
759
|
|
|
734
760
|

|
|
735
|
-

|
|
762
|
+

|
|
737
763
|

|
|
738
|
-

|
|
765
|
+

|
|
766
|
+

|
|
767
|
+

|
|
768
|
+

|
|
769
|
+

|
|
770
|
+

|
|
771
|
+

|
|
772
|
+

|
|
747
773
|

|
|
748
774
|
|
|
749
775
|
### Python
|
|
@@ -859,9 +885,9 @@ graph LR
|
|
|
859
885
|

|
|
860
886
|

|
|
861
887
|

|
|
862
|
-

|
|
863
889
|

|
|
864
|
-

|
|
865
891
|

|
|
866
892
|

|
|
867
893
|

|
|
@@ -899,20 +925,20 @@ graph LR
|
|
|
899
925
|
### Markdown
|
|
900
926
|
|
|
901
927
|

|
|
902
|
-

|
|
903
929
|

|
|
904
|
-

|
|
931
|
+

|
|
906
932
|

|
|
907
933
|

|
|
908
934
|

|
|
909
|
-

|
|
936
|
+

|
|
937
|
+

|
|
912
938
|

|
|
913
939
|

|
|
914
940
|

|
|
915
|
-

|
|
916
942
|

|
|
917
943
|

|
|
918
944
|

|
package/dist/src/index.d.ts
CHANGED
|
@@ -15,6 +15,20 @@ import { PreparedValidationDocument } from '@conformetry/core';
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const ALL_TEMPLATES_SELECTION = "all";
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Reads what each placeholder value in `templateText` stands for in
|
|
20
|
+
* `instanceText`.
|
|
21
|
+
*
|
|
22
|
+
* The template text is a pattern: its literal parts must match exactly and
|
|
23
|
+
* each placeholder value captures a non-empty run of text. Returns `undefined`
|
|
24
|
+
* when the template text holds no placeholder value or the instance text does
|
|
25
|
+
* not fit the pattern, so a caller keeps its own equality check as it was.
|
|
26
|
+
*/
|
|
27
|
+
export declare function capturePlaceholderValues(args: {
|
|
28
|
+
instanceText: string;
|
|
29
|
+
templateText: string;
|
|
30
|
+
}): Record<string, string> | undefined;
|
|
31
|
+
|
|
18
32
|
/**
|
|
19
33
|
* Provides the configuration layer's one public service.
|
|
20
34
|
*
|
|
@@ -182,6 +196,13 @@ export declare type ConformetryGeneratorInputDefinition = Record<string, unknown
|
|
|
182
196
|
* `Instance.path`.
|
|
183
197
|
*/
|
|
184
198
|
export declare interface ConformetryInstanceGroup {
|
|
199
|
+
/**
|
|
200
|
+
* Workspace-relative globs naming paths that are never instances, applied
|
|
201
|
+
* whether or not the group has tags. A directory or file the patterns found
|
|
202
|
+
* is dropped when one of these matches it โ how vendored or generated code,
|
|
203
|
+
* such as shadcn components, is left out of validation.
|
|
204
|
+
*/
|
|
205
|
+
exclude?: string[] | undefined;
|
|
185
206
|
/**
|
|
186
207
|
* Globs locating this group's instances.
|
|
187
208
|
*
|
|
@@ -217,8 +238,22 @@ export declare interface ConformetryInstanceGroup {
|
|
|
217
238
|
threshold?: number | undefined;
|
|
218
239
|
}
|
|
219
240
|
|
|
241
|
+
/**
|
|
242
|
+
* Creates a random stand-in for a placeholder nothing supplied.
|
|
243
|
+
*
|
|
244
|
+
* Validation renders it in place of the missing value, so the comparison can
|
|
245
|
+
* find where the instance holds the real one and capture it.
|
|
246
|
+
*/
|
|
247
|
+
export declare function createPlaceholderValue(): string;
|
|
248
|
+
|
|
220
249
|
/** Arguments for expanding instance globs into instances. */
|
|
221
250
|
export declare interface FindInstancesArguments {
|
|
251
|
+
/**
|
|
252
|
+
* Globs, relative to the working directory, naming paths that are never
|
|
253
|
+
* instances: a directory or file a pattern found is dropped when one of
|
|
254
|
+
* these matches it.
|
|
255
|
+
*/
|
|
256
|
+
readonly exclude?: string[] | undefined;
|
|
222
257
|
/** Glob patterns, resolved against the working directory. */
|
|
223
258
|
readonly patterns: string[];
|
|
224
259
|
/**
|
|
@@ -514,6 +549,10 @@ declare class InstanceDiscoveryLocatingService {
|
|
|
514
549
|
* projects deeper needs.
|
|
515
550
|
*/
|
|
516
551
|
private deriveLocationSubstitutions;
|
|
552
|
+
/** Expands one pattern, leaving out every path an exclude glob matches. */
|
|
553
|
+
private globEntries;
|
|
554
|
+
/** Whether an exclude glob matches a found path, workspace-relative. */
|
|
555
|
+
private isExcluded;
|
|
517
556
|
/**
|
|
518
557
|
* Returns the literal filename suffix a pattern ends with, such as
|
|
519
558
|
* `.service.ts` for `**\/*.service.ts`, or `""` when the pattern's last
|
|
@@ -568,6 +607,15 @@ declare class InstanceDiscoveryMatchingService {
|
|
|
568
607
|
* deterministic.
|
|
569
608
|
*/
|
|
570
609
|
private compareMatches;
|
|
610
|
+
/**
|
|
611
|
+
* Gives every placeholder the substitutions leave out a random stand-in.
|
|
612
|
+
*
|
|
613
|
+
* Only validation matches instances, and there a missing value is something
|
|
614
|
+
* to infer from the instance rather than an error: generation renders
|
|
615
|
+
* without this and still refuses a placeholder nobody supplied. `name` and its
|
|
616
|
+
* variants are always supplied, so they are never stood in for.
|
|
617
|
+
*/
|
|
618
|
+
private fillPlaceholders;
|
|
571
619
|
/**
|
|
572
620
|
* Builds the substitutions an instance's template is rendered with.
|
|
573
621
|
*
|
|
@@ -623,6 +671,14 @@ declare class InstanceDiscoveryService {
|
|
|
623
671
|
private readonly instanceGroupService;
|
|
624
672
|
private readonly templateDiscoveryService;
|
|
625
673
|
constructor(instanceDiscoveryLocatingService: InstanceDiscoveryLocatingService, instanceDiscoveryMatchingService: InstanceDiscoveryMatchingService, instanceGroupService: InstanceGroupService, templateDiscoveryService: TemplateDiscoveryService);
|
|
674
|
+
/**
|
|
675
|
+
* The globs an inventory expands: the configured groups' patterns and
|
|
676
|
+
* exclusions, or an explicit pattern list replacing both.
|
|
677
|
+
*
|
|
678
|
+
* One expansion rather than one per group, so an instance two groups locate
|
|
679
|
+
* is listed once; every group's exclusions therefore apply to all of them.
|
|
680
|
+
*/
|
|
681
|
+
private readInventoryGlobs;
|
|
626
682
|
/** Weighs one instance against every template, best fit first. */
|
|
627
683
|
private weighInstance;
|
|
628
684
|
/** Builds the substitutions an instance's template is rendered with. */
|
|
@@ -740,6 +796,13 @@ export declare interface MatchedInstance {
|
|
|
740
796
|
readonly instance: Instance;
|
|
741
797
|
/** How many of the template's files the instance already has. */
|
|
742
798
|
readonly matchedFileCount: number;
|
|
799
|
+
/**
|
|
800
|
+
* The random stand-in rendered for each placeholder nothing supplied, keyed
|
|
801
|
+
* by placeholder. Validation replaces each with the text the instance holds
|
|
802
|
+
* there. Absent or empty when every placeholder was supplied.
|
|
803
|
+
*/
|
|
804
|
+
readonly placeholderValues?: Substitutions;
|
|
805
|
+
/** Every value the template renders with, stand-ins included. */
|
|
743
806
|
readonly substitutions: Substitutions;
|
|
744
807
|
readonly template: TemplateDefinition;
|
|
745
808
|
}
|
|
@@ -796,6 +859,13 @@ declare class RenderingService {
|
|
|
796
859
|
constructor();
|
|
797
860
|
/** Refuses to render a template asking for a value nobody supplied. */
|
|
798
861
|
private assertEverySubstitutionSupplied;
|
|
862
|
+
/**
|
|
863
|
+
* Derives the case variants every template can reference from one name.
|
|
864
|
+
*
|
|
865
|
+
* Callers merge their own inputs over this result, so an explicit input of
|
|
866
|
+
* the same key always wins over the derived variant.
|
|
867
|
+
*/
|
|
868
|
+
buildNameSubstitutions(name: string): Substitutions;
|
|
799
869
|
/**
|
|
800
870
|
* Every placeholder a template interpolates, deduplicated.
|
|
801
871
|
*
|
|
@@ -805,14 +875,7 @@ declare class RenderingService {
|
|
|
805
875
|
* `{{^field}}` are conditionals, so absence is an answer there โ as is the
|
|
806
876
|
* implicit iterator `{{.}}`, which names no field.
|
|
807
877
|
*/
|
|
808
|
-
|
|
809
|
-
/**
|
|
810
|
-
* Derives the case variants every template can reference from one name.
|
|
811
|
-
*
|
|
812
|
-
* Callers merge their own inputs over this result, so an explicit input of
|
|
813
|
-
* the same key always wins over the derived variant.
|
|
814
|
-
*/
|
|
815
|
-
buildNameSubstitutions(name: string): Substitutions;
|
|
878
|
+
collectInterpolatedNames(template: string): string[];
|
|
816
879
|
/**
|
|
817
880
|
* Renders template contents with mustache.
|
|
818
881
|
*
|
|
@@ -912,6 +975,12 @@ export declare interface TemplateDefinition {
|
|
|
912
975
|
readonly filePaths: string[];
|
|
913
976
|
/** The template's directory name, used to identify it. */
|
|
914
977
|
readonly name: string;
|
|
978
|
+
/**
|
|
979
|
+
* Every placeholder the template's files and file paths interpolate. Read
|
|
980
|
+
* once here so validation knows which ones nothing supplied without
|
|
981
|
+
* reading the template again per instance. Absent means none.
|
|
982
|
+
*/
|
|
983
|
+
readonly placeholderNames?: string[];
|
|
915
984
|
/**
|
|
916
985
|
* Lowest conformance score an instance of this template may have, from the
|
|
917
986
|
* generator that owns it. Undefined when the generator sets none.
|
|
@@ -937,6 +1006,8 @@ declare class TemplateDiscoveryService {
|
|
|
937
1006
|
constructor(renderingService: RenderingService);
|
|
938
1007
|
/** Lists every file under a directory, recursively and sorted. */
|
|
939
1008
|
private collectFilePaths;
|
|
1009
|
+
/** Every placeholder a template's file contents and paths interpolate. */
|
|
1010
|
+
private collectPlaceholderNames;
|
|
940
1011
|
/**
|
|
941
1012
|
* Reads one template folder.
|
|
942
1013
|
*
|
|
@@ -1006,6 +1077,10 @@ export declare interface TemplateMatch {
|
|
|
1006
1077
|
readonly matchedFileCount: number;
|
|
1007
1078
|
/** Share of the template's files the instance already has, 0 to 1. */
|
|
1008
1079
|
readonly matchRatio: number;
|
|
1080
|
+
/** The stand-ins this template needed โ see `MatchedInstance`. */
|
|
1081
|
+
readonly placeholderValues: Substitutions;
|
|
1082
|
+
/** The instance's substitutions with those stand-ins added. */
|
|
1083
|
+
readonly substitutions: Substitutions;
|
|
1009
1084
|
readonly template: TemplateDefinition;
|
|
1010
1085
|
}
|
|
1011
1086
|
|
package/dist/src/index.js
CHANGED
|
@@ -5,7 +5,8 @@ import i from "lodash";
|
|
|
5
5
|
import a from "prompts";
|
|
6
6
|
import o from "mustache";
|
|
7
7
|
import s, { existsSync as c } from "node:fs";
|
|
8
|
-
import {
|
|
8
|
+
import { randomUUID as l } from "node:crypto";
|
|
9
|
+
import { access as u, readFile as ee } from "node:fs/promises";
|
|
9
10
|
import { fileURLToPath as d } from "node:url";
|
|
10
11
|
import { createJiti as f } from "jiti";
|
|
11
12
|
import { parse as p } from "jsonc-parser";
|
|
@@ -38,8 +39,8 @@ function y(e, t) {
|
|
|
38
39
|
describe: (e, t) => `${e} is the template of more than one generator: ${t.join(", ")}. Validation cannot tell which one a matching instance belongs to.`,
|
|
39
40
|
keysOf: (e) => [e.templatePath]
|
|
40
41
|
}),
|
|
41
|
-
...
|
|
42
|
-
...
|
|
42
|
+
...x(e),
|
|
43
|
+
...te(e)
|
|
43
44
|
];
|
|
44
45
|
for (let e of n) t.addIssue({
|
|
45
46
|
code: "custom",
|
|
@@ -61,7 +62,7 @@ function b(e) {
|
|
|
61
62
|
path: [n.lastIndex]
|
|
62
63
|
}));
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
+
function te(e) {
|
|
65
66
|
return e.map((e, t) => ({
|
|
66
67
|
index: t,
|
|
67
68
|
name: e.name
|
|
@@ -70,7 +71,7 @@ function x(e) {
|
|
|
70
71
|
path: [e]
|
|
71
72
|
}));
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
+
function x(e) {
|
|
74
75
|
return e.map((e, t) => ({
|
|
75
76
|
index: t,
|
|
76
77
|
name: e.name
|
|
@@ -81,11 +82,11 @@ function S(e) {
|
|
|
81
82
|
}
|
|
82
83
|
//#endregion
|
|
83
84
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/configuration/configuration.constants.ts
|
|
84
|
-
var
|
|
85
|
+
var S = class extends Error {
|
|
85
86
|
constructor(e) {
|
|
86
87
|
super(`Unsupported configuration file type: ${e}`), this.name = "UnknownConfigurationFileTypeError";
|
|
87
88
|
}
|
|
88
|
-
},
|
|
89
|
+
}, C = "pnpm-workspace.yaml", w = /* @__PURE__ */ new Set([
|
|
89
90
|
".cjs",
|
|
90
91
|
".cts",
|
|
91
92
|
".js",
|
|
@@ -94,17 +95,18 @@ var C = class extends Error {
|
|
|
94
95
|
".mjs",
|
|
95
96
|
".mts",
|
|
96
97
|
".ts"
|
|
97
|
-
]),
|
|
98
|
+
]), T = e.lazy(() => e.union([
|
|
98
99
|
e.string(),
|
|
99
100
|
e.number(),
|
|
100
101
|
e.boolean(),
|
|
101
102
|
e.null(),
|
|
102
|
-
e.array(
|
|
103
|
-
e.record(e.string(),
|
|
104
|
-
])),
|
|
103
|
+
e.array(T),
|
|
104
|
+
e.record(e.string(), T)
|
|
105
|
+
])), E = e.array(e.strictObject({
|
|
105
106
|
description: e.string().optional(),
|
|
106
|
-
inputs: e.record(e.string(), e.record(e.string(),
|
|
107
|
+
inputs: e.record(e.string(), e.record(e.string(), T)).optional(),
|
|
107
108
|
instances: e.array(e.object({
|
|
109
|
+
exclude: e.array(e.string()).optional(),
|
|
108
110
|
patterns: e.array(e.string()).optional(),
|
|
109
111
|
substitutions: e.record(e.string(), e.string()).optional(),
|
|
110
112
|
tags: e.array(e.string()).optional(),
|
|
@@ -116,12 +118,12 @@ var C = class extends Error {
|
|
|
116
118
|
})).superRefine(y);
|
|
117
119
|
//#endregion
|
|
118
120
|
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorateMetadata.js
|
|
119
|
-
function
|
|
121
|
+
function D(e, t) {
|
|
120
122
|
if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
|
|
121
123
|
}
|
|
122
124
|
//#endregion
|
|
123
125
|
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorate.js
|
|
124
|
-
function
|
|
126
|
+
function O(e, t, n, r) {
|
|
125
127
|
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
126
128
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
127
129
|
else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
|
|
@@ -129,7 +131,7 @@ function k(e, t, n, r) {
|
|
|
129
131
|
}
|
|
130
132
|
//#endregion
|
|
131
133
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input-options.service.ts
|
|
132
|
-
var
|
|
134
|
+
var k = class {
|
|
133
135
|
constructor() {}
|
|
134
136
|
collectOneInput(e) {
|
|
135
137
|
let t = e.commandArguments[e.argumentIndex];
|
|
@@ -183,10 +185,10 @@ var A = class {
|
|
|
183
185
|
return t.join(e.defaultGeneratedOutputDirectory ?? "generated", e.generatorName);
|
|
184
186
|
}
|
|
185
187
|
};
|
|
186
|
-
|
|
188
|
+
k = O([n(), D("design:paramtypes", [])], k);
|
|
187
189
|
//#endregion
|
|
188
190
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input-schema.service.ts
|
|
189
|
-
var
|
|
191
|
+
var A = class {
|
|
190
192
|
constructor() {}
|
|
191
193
|
readSchemaProperty(e, t) {
|
|
192
194
|
if (typeof e == "object" && e) return Object.entries(e).find(([e]) => e === t)?.[1];
|
|
@@ -241,10 +243,10 @@ var j = class {
|
|
|
241
243
|
}) : r;
|
|
242
244
|
}
|
|
243
245
|
};
|
|
244
|
-
|
|
246
|
+
A = O([n(), D("design:paramtypes", [])], A);
|
|
245
247
|
//#endregion
|
|
246
248
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input-prompting.service.ts
|
|
247
|
-
var
|
|
249
|
+
var j = class {
|
|
248
250
|
inputSchemaService;
|
|
249
251
|
constructor(e) {
|
|
250
252
|
this.inputSchemaService = e;
|
|
@@ -307,10 +309,10 @@ var M = class {
|
|
|
307
309
|
return n.length === 0 ? void 0 : n;
|
|
308
310
|
}
|
|
309
311
|
};
|
|
310
|
-
|
|
312
|
+
j = O([n(), D("design:paramtypes", [A === void 0 ? Object : A])], j);
|
|
311
313
|
//#endregion
|
|
312
314
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input.service.ts
|
|
313
|
-
var
|
|
315
|
+
var M = class {
|
|
314
316
|
inputOptionsService;
|
|
315
317
|
inputPromptingService;
|
|
316
318
|
inputSchemaService;
|
|
@@ -391,72 +393,63 @@ var N = class {
|
|
|
391
393
|
});
|
|
392
394
|
}
|
|
393
395
|
};
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
])],
|
|
396
|
+
M = O([n(), D("design:paramtypes", [
|
|
397
|
+
k === void 0 ? Object : k,
|
|
398
|
+
j === void 0 ? Object : j,
|
|
399
|
+
A === void 0 ? Object : A
|
|
400
|
+
])], M);
|
|
399
401
|
//#endregion
|
|
400
402
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/input/input.module.ts
|
|
401
|
-
var
|
|
402
|
-
|
|
403
|
+
var N = class {};
|
|
404
|
+
N = O([r({
|
|
403
405
|
controllers: [],
|
|
404
406
|
exports: [
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
407
|
+
k,
|
|
408
|
+
j,
|
|
409
|
+
M
|
|
408
410
|
],
|
|
409
411
|
imports: [],
|
|
410
412
|
providers: [
|
|
411
|
-
|
|
412
|
-
M,
|
|
413
|
+
k,
|
|
413
414
|
j,
|
|
414
|
-
|
|
415
|
+
A,
|
|
416
|
+
M
|
|
415
417
|
]
|
|
416
|
-
})],
|
|
418
|
+
})], N);
|
|
417
419
|
//#endregion
|
|
418
420
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-group/instance-group.service.ts
|
|
419
|
-
var
|
|
421
|
+
var P = class {
|
|
420
422
|
constructor() {}
|
|
421
423
|
isProjectScoped(e) {
|
|
422
424
|
return e.tags !== void 0 && e.tags.length > 0;
|
|
423
425
|
}
|
|
424
426
|
};
|
|
425
|
-
|
|
427
|
+
P = O([n(), D("design:paramtypes", [])], P);
|
|
426
428
|
//#endregion
|
|
427
429
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-group/instance-group.module.ts
|
|
428
|
-
var
|
|
429
|
-
|
|
430
|
+
var F = class {};
|
|
431
|
+
F = O([r({
|
|
430
432
|
controllers: [],
|
|
431
|
-
exports: [
|
|
433
|
+
exports: [P],
|
|
432
434
|
imports: [],
|
|
433
|
-
providers: [
|
|
434
|
-
})],
|
|
435
|
+
providers: [P]
|
|
436
|
+
})], F);
|
|
435
437
|
//#endregion
|
|
436
438
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.constants.ts
|
|
437
|
-
var
|
|
439
|
+
var I = { escape: String }, L = class extends Error {
|
|
438
440
|
constructor(e) {
|
|
439
441
|
let t = e.placeholders.map((e) => `{{${e}}}`).join(", ");
|
|
440
442
|
super(`No value was supplied for ${t} while rendering ${e.subject}. Declare each one as an input of the generator, and in the matching instance group's substitutions.`), this.name = "MissingSubstitutionError";
|
|
441
443
|
}
|
|
442
|
-
}, z = class {
|
|
444
|
+
}, R = /conformetry[0-9a-f]{32}/g, z = "conformetry", B = class {
|
|
443
445
|
constructor() {}
|
|
444
446
|
assertEverySubstitutionSupplied(e) {
|
|
445
447
|
let t = this.collectInterpolatedNames(e.template).filter((t) => !Object.hasOwn(e.substitutions, t));
|
|
446
|
-
if (t.length > 0) throw new
|
|
448
|
+
if (t.length > 0) throw new L({
|
|
447
449
|
placeholders: t,
|
|
448
450
|
subject: e.subject
|
|
449
451
|
});
|
|
450
452
|
}
|
|
451
|
-
collectInterpolatedNames(e) {
|
|
452
|
-
let t = /* @__PURE__ */ new Set(), n = (e) => {
|
|
453
|
-
for (let r of e) {
|
|
454
|
-
let e = r[0], i = r[1], a = r[4];
|
|
455
|
-
(e === "name" || e === "&") && i !== "." && t.add(i), Array.isArray(a) && n(a);
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
return n(o.parse(e)), [...t];
|
|
459
|
-
}
|
|
460
453
|
buildNameSubstitutions(e) {
|
|
461
454
|
let t = i.camelCase(e);
|
|
462
455
|
return {
|
|
@@ -466,34 +459,43 @@ var L = { escape: String }, R = class extends Error {
|
|
|
466
459
|
nameSnakeCase: i.snakeCase(e)
|
|
467
460
|
};
|
|
468
461
|
}
|
|
462
|
+
collectInterpolatedNames(e) {
|
|
463
|
+
let t = /* @__PURE__ */ new Set(), n = (e) => {
|
|
464
|
+
for (let r of e) {
|
|
465
|
+
let e = r[0], i = r[1], a = r[4];
|
|
466
|
+
(e === "name" || e === "&") && i !== "." && t.add(i), Array.isArray(a) && n(a);
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
return n(o.parse(e)), [...t];
|
|
470
|
+
}
|
|
469
471
|
renderContent(e) {
|
|
470
472
|
return this.assertEverySubstitutionSupplied({
|
|
471
473
|
subject: e.subject ?? "a template file",
|
|
472
474
|
substitutions: e.substitutions,
|
|
473
475
|
template: e.templateContent
|
|
474
|
-
}), o.render(e.templateContent, e.substitutions, {},
|
|
476
|
+
}), o.render(e.templateContent, e.substitutions, {}, I);
|
|
475
477
|
}
|
|
476
478
|
renderPath(e) {
|
|
477
479
|
return this.assertEverySubstitutionSupplied({
|
|
478
480
|
subject: e.subject ?? e.templatePath,
|
|
479
481
|
substitutions: e.substitutions,
|
|
480
482
|
template: e.templatePath
|
|
481
|
-
}), o.render(e.templatePath, e.substitutions, {},
|
|
483
|
+
}), o.render(e.templatePath, e.substitutions, {}, I);
|
|
482
484
|
}
|
|
483
485
|
};
|
|
484
|
-
|
|
486
|
+
B = O([n(), D("design:paramtypes", [])], B);
|
|
485
487
|
//#endregion
|
|
486
488
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.module.ts
|
|
487
|
-
var
|
|
488
|
-
|
|
489
|
+
var V = class {};
|
|
490
|
+
V = O([r({
|
|
489
491
|
controllers: [],
|
|
490
|
-
exports: [
|
|
492
|
+
exports: [B],
|
|
491
493
|
imports: [],
|
|
492
|
-
providers: [
|
|
493
|
-
})],
|
|
494
|
+
providers: [B]
|
|
495
|
+
})], V);
|
|
494
496
|
//#endregion
|
|
495
497
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.service.ts
|
|
496
|
-
var
|
|
498
|
+
var H = class {
|
|
497
499
|
renderingService;
|
|
498
500
|
constructor(e) {
|
|
499
501
|
this.renderingService = e;
|
|
@@ -510,11 +512,19 @@ var V = class {
|
|
|
510
512
|
}
|
|
511
513
|
return n.toSorted();
|
|
512
514
|
}
|
|
515
|
+
collectPlaceholderNames(e) {
|
|
516
|
+
return [...new Set(e.filePaths.flatMap((n) => [t.relative(e.directoryPath, n), s.readFileSync(n, "utf8")].flatMap((e) => this.renderingService.collectInterpolatedNames(e))))];
|
|
517
|
+
}
|
|
513
518
|
collectTemplate(e) {
|
|
519
|
+
let t = this.collectFilePaths(e.templatePath);
|
|
514
520
|
return {
|
|
515
521
|
directoryPath: e.templatePath,
|
|
516
|
-
filePaths:
|
|
522
|
+
filePaths: t,
|
|
517
523
|
name: e.name,
|
|
524
|
+
placeholderNames: this.collectPlaceholderNames({
|
|
525
|
+
directoryPath: e.templatePath,
|
|
526
|
+
filePaths: t
|
|
527
|
+
}),
|
|
518
528
|
...e.threshold === void 0 ? {} : { threshold: e.threshold }
|
|
519
529
|
};
|
|
520
530
|
}
|
|
@@ -559,42 +569,55 @@ var V = class {
|
|
|
559
569
|
}));
|
|
560
570
|
}
|
|
561
571
|
};
|
|
562
|
-
|
|
572
|
+
H = O([n(), D("design:paramtypes", [B === void 0 ? Object : B])], H);
|
|
563
573
|
//#endregion
|
|
564
574
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/template-discovery/template-discovery.module.ts
|
|
565
|
-
var
|
|
566
|
-
|
|
575
|
+
var U = class {};
|
|
576
|
+
U = O([r({
|
|
567
577
|
controllers: [],
|
|
568
|
-
exports: [
|
|
569
|
-
imports: [
|
|
570
|
-
providers: [
|
|
571
|
-
})],
|
|
578
|
+
exports: [H],
|
|
579
|
+
imports: [V],
|
|
580
|
+
providers: [H]
|
|
581
|
+
})], U);
|
|
572
582
|
//#endregion
|
|
573
583
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.constants.ts
|
|
574
|
-
var
|
|
584
|
+
var W = /\.[^.]+$/u, G = [
|
|
575
585
|
"*",
|
|
576
586
|
"?",
|
|
577
587
|
"]"
|
|
578
|
-
],
|
|
588
|
+
], K = class {
|
|
579
589
|
constructor() {}
|
|
580
590
|
deriveLocationSubstitutions(e) {
|
|
581
591
|
let [n = ""] = t.relative(e.workingDirectory, t.join(e.instancePath, e.nameStem)).split(t.sep);
|
|
582
592
|
return n === "" || n === ".." ? {} : { type: n };
|
|
583
593
|
}
|
|
594
|
+
globEntries(e) {
|
|
595
|
+
return s.globSync(e.pattern, {
|
|
596
|
+
cwd: e.workingDirectory,
|
|
597
|
+
withFileTypes: !0
|
|
598
|
+
}).filter((n) => !this.isExcluded({
|
|
599
|
+
...e,
|
|
600
|
+
entryPath: t.join(n.parentPath, n.name)
|
|
601
|
+
}));
|
|
602
|
+
}
|
|
603
|
+
isExcluded(e) {
|
|
604
|
+
let n = t.relative(e.workingDirectory, t.resolve(e.workingDirectory, e.entryPath));
|
|
605
|
+
return (e.exclude ?? []).some((e) => t.matchesGlob(n, e));
|
|
606
|
+
}
|
|
584
607
|
resolveGlobSuffix(e) {
|
|
585
|
-
let n = t.basename(e), r = Math.max(...
|
|
608
|
+
let n = t.basename(e), r = Math.max(...G.map((e) => n.lastIndexOf(e)));
|
|
586
609
|
return r === -1 ? "" : n.slice(r + 1);
|
|
587
610
|
}
|
|
588
611
|
resolveNameStem(e) {
|
|
589
|
-
return e.isDirectory ? e.entryName : e.suffix !== "" && e.entryName.endsWith(e.suffix) ? e.entryName.slice(0, -e.suffix.length) : e.entryName.replace(
|
|
612
|
+
return e.isDirectory ? e.entryName : e.suffix !== "" && e.entryName.endsWith(e.suffix) ? e.entryName.slice(0, -e.suffix.length) : e.entryName.replace(W, "");
|
|
590
613
|
}
|
|
591
614
|
findInstances(e) {
|
|
592
615
|
let n = /* @__PURE__ */ new Map();
|
|
593
616
|
for (let r of e.patterns) {
|
|
594
617
|
let i = this.resolveGlobSuffix(r);
|
|
595
|
-
for (let a of
|
|
596
|
-
|
|
597
|
-
|
|
618
|
+
for (let a of this.globEntries({
|
|
619
|
+
...e,
|
|
620
|
+
pattern: r
|
|
598
621
|
})) {
|
|
599
622
|
let e = a.isDirectory(), r = t.join(a.parentPath, a.name), o = [
|
|
600
623
|
a.parentPath,
|
|
@@ -632,10 +655,24 @@ var U = /\.[^.]+$/u, W = [
|
|
|
632
655
|
});
|
|
633
656
|
}
|
|
634
657
|
};
|
|
635
|
-
|
|
658
|
+
K = O([n(), D("design:paramtypes", [])], K);
|
|
659
|
+
//#endregion
|
|
660
|
+
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/rendering/rendering.utilities.ts
|
|
661
|
+
function q(e) {
|
|
662
|
+
let t = e.templateText.match(R) ?? [];
|
|
663
|
+
if (t.length === 0) return;
|
|
664
|
+
let n = i.escapeRegExp(e.templateText).replaceAll(R, String.raw`([\s\S]+?)`), r = RegExp(`^${n}$`, "u").exec(e.instanceText);
|
|
665
|
+
if (r === null) return;
|
|
666
|
+
let a = {};
|
|
667
|
+
for (let [e, n] of t.entries()) a[n] ??= r[e + 1] ?? "";
|
|
668
|
+
return a;
|
|
669
|
+
}
|
|
670
|
+
function J() {
|
|
671
|
+
return `${z}${l().replaceAll("-", "")}`;
|
|
672
|
+
}
|
|
636
673
|
//#endregion
|
|
637
674
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery-matching.service.ts
|
|
638
|
-
var
|
|
675
|
+
var Y = class {
|
|
639
676
|
templateDiscoveryService;
|
|
640
677
|
renderingService;
|
|
641
678
|
constructor(e, t) {
|
|
@@ -644,6 +681,16 @@ var K = class {
|
|
|
644
681
|
compareMatches(e, t) {
|
|
645
682
|
return e.matchRatio === t.matchRatio ? e.matchedFileCount === t.matchedFileCount ? e.template.name.localeCompare(t.template.name) : t.matchedFileCount - e.matchedFileCount : t.matchRatio - e.matchRatio;
|
|
646
683
|
}
|
|
684
|
+
fillPlaceholders(e) {
|
|
685
|
+
let t = Object.fromEntries((e.template.placeholderNames ?? []).filter((t) => !Object.hasOwn(e.substitutions, t)).map((e) => [e, J()]));
|
|
686
|
+
return {
|
|
687
|
+
placeholderValues: t,
|
|
688
|
+
substitutions: {
|
|
689
|
+
...t,
|
|
690
|
+
...e.substitutions
|
|
691
|
+
}
|
|
692
|
+
};
|
|
693
|
+
}
|
|
647
694
|
buildSubstitutions(e) {
|
|
648
695
|
return {
|
|
649
696
|
...this.renderingService.buildNameSubstitutions(e.nameStem),
|
|
@@ -679,7 +726,8 @@ var K = class {
|
|
|
679
726
|
t.push(...s.map((e) => ({
|
|
680
727
|
instance: r,
|
|
681
728
|
matchedFileCount: e.matchedFileCount,
|
|
682
|
-
|
|
729
|
+
placeholderValues: e.placeholderValues,
|
|
730
|
+
substitutions: e.substitutions,
|
|
683
731
|
template: e.template
|
|
684
732
|
})));
|
|
685
733
|
}
|
|
@@ -690,24 +738,28 @@ var K = class {
|
|
|
690
738
|
}
|
|
691
739
|
matchTemplates(e) {
|
|
692
740
|
return e.templates.map((t) => {
|
|
693
|
-
let n = this.
|
|
741
|
+
let n = this.fillPlaceholders({
|
|
742
|
+
substitutions: e.substitutions,
|
|
743
|
+
template: t
|
|
744
|
+
}), r = this.templateDiscoveryService.countMatchingFiles({
|
|
694
745
|
fileScope: e.instance.fileScope,
|
|
695
746
|
instancePath: e.instance.path,
|
|
696
|
-
substitutions:
|
|
747
|
+
substitutions: n.substitutions,
|
|
697
748
|
template: t
|
|
698
749
|
});
|
|
699
750
|
return {
|
|
700
|
-
|
|
701
|
-
|
|
751
|
+
...n,
|
|
752
|
+
matchedFileCount: r,
|
|
753
|
+
matchRatio: r / t.filePaths.length,
|
|
702
754
|
template: t
|
|
703
755
|
};
|
|
704
756
|
}).filter((e) => e.matchedFileCount > 0 && e.matchRatio > 0).toSorted((e, t) => this.compareMatches(e, t));
|
|
705
757
|
}
|
|
706
758
|
};
|
|
707
|
-
|
|
759
|
+
Y = O([n(), D("design:paramtypes", [H === void 0 ? Object : H, B === void 0 ? Object : B])], Y);
|
|
708
760
|
//#endregion
|
|
709
761
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.service.ts
|
|
710
|
-
var
|
|
762
|
+
var X = class {
|
|
711
763
|
instanceDiscoveryLocatingService;
|
|
712
764
|
instanceDiscoveryMatchingService;
|
|
713
765
|
instanceGroupService;
|
|
@@ -715,6 +767,18 @@ var q = class {
|
|
|
715
767
|
constructor(e, t, n, r) {
|
|
716
768
|
this.instanceDiscoveryLocatingService = e, this.instanceDiscoveryMatchingService = t, this.instanceGroupService = n, this.templateDiscoveryService = r;
|
|
717
769
|
}
|
|
770
|
+
readInventoryGlobs(e) {
|
|
771
|
+
if (e.instancePatterns !== void 0) return {
|
|
772
|
+
patterns: e.instancePatterns,
|
|
773
|
+
workingDirectory: e.workingDirectory
|
|
774
|
+
};
|
|
775
|
+
let t = e.configuration.flatMap((e) => this.readWorkspaceGroups(e.instances));
|
|
776
|
+
return {
|
|
777
|
+
exclude: t.flatMap((e) => e.exclude ?? []),
|
|
778
|
+
patterns: t.flatMap((e) => e.patterns ?? []),
|
|
779
|
+
workingDirectory: e.workingDirectory
|
|
780
|
+
};
|
|
781
|
+
}
|
|
718
782
|
weighInstance(e) {
|
|
719
783
|
let t = this.instanceDiscoveryMatchingService.matchTemplates({
|
|
720
784
|
instance: e.instance,
|
|
@@ -799,50 +863,47 @@ var q = class {
|
|
|
799
863
|
let t = this.templateDiscoveryService.collectTemplates({
|
|
800
864
|
configuration: e.configuration,
|
|
801
865
|
workingDirectory: e.workingDirectory
|
|
802
|
-
})
|
|
866
|
+
});
|
|
803
867
|
return {
|
|
804
868
|
templates: t,
|
|
805
|
-
weighed: this.findInstances({
|
|
806
|
-
patterns: n,
|
|
807
|
-
workingDirectory: e.workingDirectory
|
|
808
|
-
}).map((e) => this.weighInstance({
|
|
869
|
+
weighed: this.findInstances(this.readInventoryGlobs(e)).map((e) => this.weighInstance({
|
|
809
870
|
instance: e,
|
|
810
871
|
templates: t
|
|
811
872
|
}))
|
|
812
873
|
};
|
|
813
874
|
}
|
|
814
875
|
};
|
|
815
|
-
|
|
816
|
-
G === void 0 ? Object : G,
|
|
876
|
+
X = O([n(), D("design:paramtypes", [
|
|
817
877
|
K === void 0 ? Object : K,
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
878
|
+
Y === void 0 ? Object : Y,
|
|
879
|
+
P === void 0 ? Object : P,
|
|
880
|
+
H === void 0 ? Object : H
|
|
881
|
+
])], X);
|
|
821
882
|
//#endregion
|
|
822
883
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/instance-discovery/instance-discovery.module.ts
|
|
823
|
-
var
|
|
824
|
-
|
|
884
|
+
var Z = class {};
|
|
885
|
+
Z = O([r({
|
|
825
886
|
controllers: [],
|
|
826
887
|
exports: [
|
|
827
|
-
G,
|
|
828
888
|
K,
|
|
829
|
-
|
|
830
|
-
|
|
889
|
+
Y,
|
|
890
|
+
X,
|
|
891
|
+
U
|
|
831
892
|
],
|
|
832
893
|
imports: [
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
894
|
+
F,
|
|
895
|
+
V,
|
|
896
|
+
U
|
|
836
897
|
],
|
|
837
898
|
providers: [
|
|
838
|
-
G,
|
|
839
899
|
K,
|
|
840
|
-
|
|
900
|
+
Y,
|
|
901
|
+
X
|
|
841
902
|
]
|
|
842
|
-
})],
|
|
903
|
+
})], Z);
|
|
843
904
|
//#endregion
|
|
844
905
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/configuration/configuration.service.ts
|
|
845
|
-
var
|
|
906
|
+
var Q = class {
|
|
846
907
|
inputPromptingService;
|
|
847
908
|
inputService;
|
|
848
909
|
instanceDiscoveryService;
|
|
@@ -865,7 +926,7 @@ var Y = class {
|
|
|
865
926
|
async findWorkspaceRoot() {
|
|
866
927
|
let e = t.resolve(process.cwd());
|
|
867
928
|
for (;;) try {
|
|
868
|
-
return await
|
|
929
|
+
return await u(t.join(e, C)), e;
|
|
869
930
|
} catch {
|
|
870
931
|
let n = t.dirname(e);
|
|
871
932
|
if (n === e) return;
|
|
@@ -880,7 +941,7 @@ var Y = class {
|
|
|
880
941
|
return typeof n == "object" && n ? n : t;
|
|
881
942
|
}
|
|
882
943
|
async loadJsonConfiguration(e) {
|
|
883
|
-
let t = await
|
|
944
|
+
let t = await ee(e.configurationPath, "utf8");
|
|
884
945
|
return e.extension === ".jsonc" ? p(t) : JSON.parse(t);
|
|
885
946
|
}
|
|
886
947
|
async resolveConfigurationPath(e) {
|
|
@@ -911,12 +972,12 @@ var Y = class {
|
|
|
911
972
|
}
|
|
912
973
|
async loadConformetryConfiguration(e) {
|
|
913
974
|
let n = await this.resolveConfigurationPath(e), r = t.extname(n).toLowerCase();
|
|
914
|
-
if (!
|
|
975
|
+
if (!w.has(r)) throw new S(n);
|
|
915
976
|
let i = await this.loadConfigurationModule({
|
|
916
977
|
configurationPath: n,
|
|
917
978
|
extension: r
|
|
918
979
|
});
|
|
919
|
-
return
|
|
980
|
+
return E.parse(i).map((e) => this.applyGeneratorDefaults(e));
|
|
920
981
|
}
|
|
921
982
|
matchInstances(e) {
|
|
922
983
|
return this.instanceDiscoveryService.matchInstances(e);
|
|
@@ -961,28 +1022,28 @@ var Y = class {
|
|
|
961
1022
|
return this.instanceDiscoveryService.resolveInventoriedTemplates(e);
|
|
962
1023
|
}
|
|
963
1024
|
};
|
|
964
|
-
|
|
1025
|
+
Q = O([n(), D("design:paramtypes", [
|
|
1026
|
+
j === void 0 ? Object : j,
|
|
965
1027
|
M === void 0 ? Object : M,
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
])], Y);
|
|
1028
|
+
X === void 0 ? Object : X,
|
|
1029
|
+
P === void 0 ? Object : P,
|
|
1030
|
+
B === void 0 ? Object : B,
|
|
1031
|
+
H === void 0 ? Object : H
|
|
1032
|
+
])], Q);
|
|
972
1033
|
//#endregion
|
|
973
1034
|
//#region packages/ic-suite/conformetry/conformetry-configuration/src/modules/configuration/configuration.module.ts
|
|
974
|
-
var
|
|
975
|
-
|
|
1035
|
+
var $ = class {};
|
|
1036
|
+
$ = O([r({
|
|
976
1037
|
controllers: [],
|
|
977
|
-
exports: [
|
|
1038
|
+
exports: [Q],
|
|
978
1039
|
imports: [
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1040
|
+
N,
|
|
1041
|
+
Z,
|
|
1042
|
+
F,
|
|
1043
|
+
V,
|
|
1044
|
+
U
|
|
984
1045
|
],
|
|
985
|
-
providers: [
|
|
986
|
-
})],
|
|
1046
|
+
providers: [Q]
|
|
1047
|
+
})], $);
|
|
987
1048
|
//#endregion
|
|
988
|
-
export { h as ALL_TEMPLATES_SELECTION,
|
|
1049
|
+
export { h as ALL_TEMPLATES_SELECTION, $ as ConfigurationModule, Q as ConfigurationService, _ as InputError, L as MissingSubstitutionError, S as UnknownConfigurationFileTypeError, q as capturePlaceholderValues, J as createPlaceholderValue, v as missingInputError };
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"url": "https://github.com/organizzolini/codebase/issues"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@conformetry/core": "0.0.
|
|
7
|
+
"@conformetry/core": "0.0.7",
|
|
8
8
|
"@nestjs/common": "^11.1.21 || ^12.0.1",
|
|
9
9
|
"jiti": "^2.7.0",
|
|
10
10
|
"jsonc-parser": "^3.3.1",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"strict": true
|
|
68
68
|
},
|
|
69
69
|
"types": "./dist/src/index.d.ts",
|
|
70
|
-
"version": "0.0.
|
|
70
|
+
"version": "0.0.7"
|
|
71
71
|
}
|