@coinagerie/vocabulary 0.0.0-stage → 0.0.2
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 +24 -0
- package/LICENSE +21 -0
- package/README.md +465 -2
- package/dist/src/index.d.ts +219 -0
- package/dist/src/index.js +215 -0
- package/package.json +62 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
## 0.0.2 (2026-11-04)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **coinagerie:** ✨ accept regular expressions in exclude.words ([#2109](https://github.com/organizzolini/codebase/pull/2109))
|
|
6
|
+
|
|
7
|
+
### 🧱 Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated coinagerie-configuration to 0.0.2
|
|
10
|
+
- Updated coinagerie-languages to 0.0.2
|
|
11
|
+
|
|
12
|
+
## 0.0.1 (2026-11-04)
|
|
13
|
+
|
|
14
|
+
### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- **coinagerie:** 📦️ publish coinagerie to npm ([#2088](https://github.com/organizzolini/codebase/pull/2088), [#1793](https://github.com/organizzolini/codebase/issues/1793))
|
|
17
|
+
- **configuration,coinagerie:** ✨ adopt coinagerie with a root glossary ([#1888](https://github.com/organizzolini/codebase/pull/1888), [#1785](https://github.com/organizzolini/codebase/issues/1785))
|
|
18
|
+
- **coinagerie:** ✨ fold word forms and exclude configured words ([#1882](https://github.com/organizzolini/codebase/pull/1882), [#1762](https://github.com/organizzolini/codebase/issues/1762))
|
|
19
|
+
- **coinagerie:** ✨ build a markdown glossary from typescript ([#1875](https://github.com/organizzolini/codebase/pull/1875), [#1755](https://github.com/organizzolini/codebase/issues/1755))
|
|
20
|
+
|
|
21
|
+
### 🧱 Updated Dependencies
|
|
22
|
+
|
|
23
|
+
- Updated coinagerie-configuration to 0.0.1
|
|
24
|
+
- Updated coinagerie-languages to 0.0.1
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jimmy Paolini
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,466 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @coinagerie/vocabulary
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@coinagerie/vocabulary)
|
|
4
|
+
|
|
5
|
+
File discovery, word splitting, folding, and exclusion: the part of coinagerie that turns a codebase into a sorted list of headwords.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @coinagerie/vocabulary
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Test
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
nx run coinagerie-vocabulary:vitest
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 👔 Conformetry
|
|
18
|
+
|
|
19
|
+
This project was generated from the [nestjs-service-project](../../configuration/conformetry-templates/nestjs-service-project) conformetry template.
|
|
20
|
+
|
|
21
|
+
<!-- coinagerie:start -->
|
|
22
|
+
|
|
23
|
+
## 🪙 Coinagerie
|
|
24
|
+
|
|
25
|
+
The words this package uses that the root glossary does not define, regenerated with `nx run coinagerie-vocabulary:coinagerie-check:write`.
|
|
26
|
+
|
|
27
|
+
- **ancestor**:
|
|
28
|
+
- **aspect**:
|
|
29
|
+
- **breadth**:
|
|
30
|
+
- **bundle**:
|
|
31
|
+
- **discovery**:
|
|
32
|
+
- **dist**:
|
|
33
|
+
- **doc**:
|
|
34
|
+
- **glossary**:
|
|
35
|
+
- **guide**:
|
|
36
|
+
- **headword**:
|
|
37
|
+
- **ignorecase**:
|
|
38
|
+
- **logo**:
|
|
39
|
+
- **lowercase**:
|
|
40
|
+
- **mark**:
|
|
41
|
+
- **phase**:
|
|
42
|
+
- **png**:
|
|
43
|
+
- **posix**:
|
|
44
|
+
- **reload**:
|
|
45
|
+
- **scoped**:
|
|
46
|
+
- **singular**:
|
|
47
|
+
- **symbolic**:
|
|
48
|
+
- **symlink**:
|
|
49
|
+
- **term**:
|
|
50
|
+
- **thing**:
|
|
51
|
+
- **tokenizer**:
|
|
52
|
+
- **unignored**:
|
|
53
|
+
- **unmock**:
|
|
54
|
+
- **vendor**:
|
|
55
|
+
- **verb**:
|
|
56
|
+
- **verdict**:
|
|
57
|
+
- **vocabulary**:
|
|
58
|
+
|
|
59
|
+
<!-- coinagerie:end -->
|
|
60
|
+
|
|
61
|
+
<!-- callidescope:start -->
|
|
62
|
+
|
|
63
|
+
## 🔭 Callidescope
|
|
64
|
+
|
|
65
|
+
Call stacks traced through `projects/ic-suite/coinagerie/coinagerie-vocabulary`, deepest first. Each frame shows what it takes, what it returns, and what its documentation says.
|
|
66
|
+
|
|
67
|
+
| Measure | Value |
|
|
68
|
+
| --- | --- |
|
|
69
|
+
| Callables | 42 |
|
|
70
|
+
| Files | 25 |
|
|
71
|
+
| Calls traced | 44 |
|
|
72
|
+
| Call stacks | 0 |
|
|
73
|
+
| Deepest stack | 0 |
|
|
74
|
+
| Stacks through recursion | 0 |
|
|
75
|
+
| Unfollowable calls | 1 |
|
|
76
|
+
|
|
77
|
+
### Limits
|
|
78
|
+
|
|
79
|
+
What this project is judged against, as declared in its own `callidescope.config.ts`.
|
|
80
|
+
|
|
81
|
+
| Limit | Value |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| `maximumDepth` | 7 |
|
|
84
|
+
| `maximumBreadth` | 7 |
|
|
85
|
+
|
|
86
|
+
### Call stacks (depth)
|
|
87
|
+
|
|
88
|
+
None.
|
|
89
|
+
|
|
90
|
+
### Breadth
|
|
91
|
+
|
|
92
|
+
| Callable | Breadth | Calls directly | Location |
|
|
93
|
+
| --- | --- | --- | --- |
|
|
94
|
+
| `DiscoveryService.discover` | 7 | `DiscoveryService.findRepositoryRoot`, `DiscoveryService.map(…)`, `DiscoveryService.filter(…)`, `DiscoveryService.map(…)`, `DiscoveryService.filter(…)`, `DiscoveryService.walk`, `DiscoveryService.readAncestorScopes` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/discovery/discovery.service.ts:152` |
|
|
95
|
+
| `VocabularyService.collect` | 7 | `DiscoveryService.discover`, `VocabularyService.map(…)`, `VocabularyService.excludedHeadwords`, `VocabularyService.collectFile`, `FoldingService.headword`, `VocabularyService.matchesPattern`, `VocabularyService.filter(…)` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/vocabulary/vocabulary.service.ts:108` |
|
|
96
|
+
| `DiscoveryService.walk` | 4 | `DiscoveryService.toPosix`, `IgnoreRulesService.readScope`, `DiscoveryService.flatMap(…)`, `DiscoveryService.filter(…)` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/discovery/discovery.service.ts:107` |
|
|
97
|
+
|
|
98
|
+
<details>
|
|
99
|
+
<summary>16 more callables</summary>
|
|
100
|
+
|
|
101
|
+
| Callable | Breadth | Calls directly | Location |
|
|
102
|
+
| --- | --- | --- | --- |
|
|
103
|
+
| `DiscoveryService.readAncestorScopes` | 3 | `DiscoveryService.filter(…)`, `DiscoveryService.toPosix`, `DiscoveryService.flatMap(…)` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/discovery/discovery.service.ts:78` |
|
|
104
|
+
| `DiscoveryService.flatMap(…)` | 3 | `IgnoreRulesService.isIgnored`, `DiscoveryService.isExcludedFolder`, `DiscoveryService.walk` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/discovery/discovery.service.ts:122` |
|
|
105
|
+
| `WordsService.splitIdentifier` | 3 | `WordsService.filter(…)`, `WordsService.map(…)`, `WordsService.flatMap(…)` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/words/words.service.ts:43` |
|
|
106
|
+
| `VocabularyService.collectFile` | 3 | `WordsService.splitPath`, `LanguagesService.tokenizerFor`, `VocabularyService.flatMap(…)` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/vocabulary/vocabulary.service.ts:42` |
|
|
107
|
+
| `DiscoveryService.isExcludedFolder` | 2 | `DiscoveryService.toPosix`, `DiscoveryService.some(…)` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/discovery/discovery.service.ts:56` |
|
|
108
|
+
| `DiscoveryService.isSelected` | 2 | `DiscoveryService.some(…)`, `DiscoveryService.some(…)` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/discovery/discovery.service.ts:67` |
|
|
109
|
+
| `IgnoreRulesService.isIgnored` | 1 | `IgnoreRulesService.toScopedPath` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/discovery/ignore-rules.service.ts:49` |
|
|
110
|
+
| `DiscoveryService.flatMap(…)` | 1 | `IgnoreRulesService.readScope` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/discovery/discovery.service.ts:86` |
|
|
111
|
+
| `DiscoveryService.map(…)` | 1 | `DiscoveryService.toPosix` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/discovery/discovery.service.ts:163` |
|
|
112
|
+
| `DiscoveryService.filter(…)` | 1 | `DiscoveryService.isSelected` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/discovery/discovery.service.ts:166` |
|
|
113
|
+
| `FoldingService.headword` | 1 | `FoldingService.fold` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/folding/folding.service.ts:49` |
|
|
114
|
+
| `WordsService.filter(…)` | 1 | `WordsService.isTerm` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/words/words.service.ts:48` |
|
|
115
|
+
| `WordsService.splitPath` | 1 | `WordsService.splitIdentifier` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/words/words.service.ts:56` |
|
|
116
|
+
| `VocabularyService.flatMap(…)` | 1 | `WordsService.splitIdentifier` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/vocabulary/vocabulary.service.ts:57` |
|
|
117
|
+
| `VocabularyService.excludedHeadwords` | 1 | `FoldingService.headword` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/vocabulary/vocabulary.service.ts:70` |
|
|
118
|
+
| `VocabularyService.matchesPattern` | 1 | `VocabularyService.some(…)` | `projects/ic-suite/coinagerie/coinagerie-vocabulary/src/modules/vocabulary/vocabulary.service.ts:88` |
|
|
119
|
+
|
|
120
|
+
</details>
|
|
121
|
+
<!-- callidescope:end -->
|
|
122
|
+
|
|
123
|
+
## 🕸️ Codependix
|
|
124
|
+
|
|
125
|
+
Dependency graphs exported by [codependix](https://github.com/Organizzolini/codebase/tree/main/projects/ic-suite/codependix/codependix-cli), regenerated by `nx run configuration:codependix:write`.
|
|
126
|
+
|
|
127
|
+
### Nx Neighborhood
|
|
128
|
+
|
|
129
|
+
<!-- codependix:start name="codependix-nx-projects" -->
|
|
130
|
+
```mermaid
|
|
131
|
+
graph LR
|
|
132
|
+
coinagerie_cli["coinagerie-cli"]
|
|
133
|
+
coinagerie_configuration["coinagerie-configuration"]
|
|
134
|
+
coinagerie_languages["coinagerie-languages"]
|
|
135
|
+
coinagerie_vocabulary["coinagerie-vocabulary"]
|
|
136
|
+
coinagerie_cli --> coinagerie_vocabulary
|
|
137
|
+
coinagerie_vocabulary --> coinagerie_configuration
|
|
138
|
+
coinagerie_vocabulary --> coinagerie_languages
|
|
139
|
+
classDef subject fill:#7c3aed,color:#fff,stroke:#4c1d95,stroke-width:2px
|
|
140
|
+
class coinagerie_vocabulary subject
|
|
141
|
+
```
|
|
142
|
+
<!-- codependix:end name="codependix-nx-projects" -->
|
|
143
|
+
|
|
144
|
+
### NestJS Module Graph
|
|
145
|
+
|
|
146
|
+
<!-- codependix:start name="codependix-nestjs-modules" -->
|
|
147
|
+
```mermaid
|
|
148
|
+
flowchart LR
|
|
149
|
+
CssModule
|
|
150
|
+
DiscoveryModule
|
|
151
|
+
FoldingModule
|
|
152
|
+
HclModule
|
|
153
|
+
JsonModule
|
|
154
|
+
LanguagesModule
|
|
155
|
+
PythonModule
|
|
156
|
+
ScannerModule
|
|
157
|
+
ShellModule
|
|
158
|
+
SqlModule
|
|
159
|
+
TomlModule
|
|
160
|
+
TypescriptModule
|
|
161
|
+
VocabularyModule
|
|
162
|
+
WordsModule
|
|
163
|
+
YamlModule
|
|
164
|
+
CssModule --> ScannerModule
|
|
165
|
+
HclModule --> ScannerModule
|
|
166
|
+
JsonModule --> ScannerModule
|
|
167
|
+
LanguagesModule --> CssModule
|
|
168
|
+
LanguagesModule --> HclModule
|
|
169
|
+
LanguagesModule --> JsonModule
|
|
170
|
+
LanguagesModule --> PythonModule
|
|
171
|
+
LanguagesModule --> ShellModule
|
|
172
|
+
LanguagesModule --> SqlModule
|
|
173
|
+
LanguagesModule --> TomlModule
|
|
174
|
+
LanguagesModule --> TypescriptModule
|
|
175
|
+
LanguagesModule --> YamlModule
|
|
176
|
+
PythonModule --> ScannerModule
|
|
177
|
+
ShellModule --> ScannerModule
|
|
178
|
+
SqlModule --> ScannerModule
|
|
179
|
+
TomlModule --> ScannerModule
|
|
180
|
+
VocabularyModule --> DiscoveryModule
|
|
181
|
+
VocabularyModule --> FoldingModule
|
|
182
|
+
VocabularyModule --> LanguagesModule
|
|
183
|
+
VocabularyModule --> WordsModule
|
|
184
|
+
```
|
|
185
|
+
<!-- codependix:end name="codependix-nestjs-modules" -->
|
|
186
|
+
|
|
187
|
+
### File Imports
|
|
188
|
+
|
|
189
|
+
<!-- codependix:start name="codependix-file-imports" -->
|
|
190
|
+
```mermaid
|
|
191
|
+
graph LR
|
|
192
|
+
file_callidescope_config_ts["callidescope.config.ts"]
|
|
193
|
+
file_codependix_config_ts["codependix.config.ts"]
|
|
194
|
+
file_codometer_config_ts["codometer.config.ts"]
|
|
195
|
+
file_coinagerie_config_ts["coinagerie.config.ts"]
|
|
196
|
+
file_eslint_config_ts["eslint.config.ts"]
|
|
197
|
+
file_src_index_ts["src/index.ts"]
|
|
198
|
+
file_src_index_unit_test_ts["src/index.unit.test.ts"]
|
|
199
|
+
file_src_modules_discovery_discovery_constants_ts["src/modules/discovery/discovery.constants.ts"]
|
|
200
|
+
file_src_modules_discovery_discovery_module_ts["src/modules/discovery/discovery.module.ts"]
|
|
201
|
+
file_src_modules_discovery_discovery_service_ts["src/modules/discovery/discovery.service.ts"]
|
|
202
|
+
file_src_modules_discovery_discovery_service_unit_test_ts["src/modules/discovery/discovery.service.unit.test.ts"]
|
|
203
|
+
file_src_modules_discovery_discovery_types_ts["src/modules/discovery/discovery.types.ts"]
|
|
204
|
+
file_src_modules_discovery_ignore_rules_service_ts["src/modules/discovery/ignore-rules.service.ts"]
|
|
205
|
+
file_src_modules_discovery_ignore_rules_service_unit_test_ts["src/modules/discovery/ignore-rules.service.unit.test.ts"]
|
|
206
|
+
file_src_modules_folding_folding_constants_ts["src/modules/folding/folding.constants.ts"]
|
|
207
|
+
file_src_modules_folding_folding_module_ts["src/modules/folding/folding.module.ts"]
|
|
208
|
+
file_src_modules_folding_folding_service_ts["src/modules/folding/folding.service.ts"]
|
|
209
|
+
file_src_modules_folding_folding_service_unit_test_ts["src/modules/folding/folding.service.unit.test.ts"]
|
|
210
|
+
file_src_modules_folding_folding_types_ts["src/modules/folding/folding.types.ts"]
|
|
211
|
+
file_src_modules_vocabulary_vocabulary_constants_ts["src/modules/vocabulary/vocabulary.constants.ts"]
|
|
212
|
+
file_src_modules_vocabulary_vocabulary_module_ts["src/modules/vocabulary/vocabulary.module.ts"]
|
|
213
|
+
file_src_modules_vocabulary_vocabulary_service_ts["src/modules/vocabulary/vocabulary.service.ts"]
|
|
214
|
+
file_src_modules_vocabulary_vocabulary_service_unit_test_ts["src/modules/vocabulary/vocabulary.service.unit.test.ts"]
|
|
215
|
+
file_src_modules_vocabulary_vocabulary_types_ts["src/modules/vocabulary/vocabulary.types.ts"]
|
|
216
|
+
file_src_modules_words_words_constants_ts["src/modules/words/words.constants.ts"]
|
|
217
|
+
file_src_modules_words_words_module_ts["src/modules/words/words.module.ts"]
|
|
218
|
+
file_src_modules_words_words_service_ts["src/modules/words/words.service.ts"]
|
|
219
|
+
file_src_modules_words_words_service_unit_test_ts["src/modules/words/words.service.unit.test.ts"]
|
|
220
|
+
file_src_modules_words_words_types_ts["src/modules/words/words.types.ts"]
|
|
221
|
+
file_testing_mocks_ts["testing/mocks.ts"]
|
|
222
|
+
file_testing_setup_ts["testing/setup.ts"]
|
|
223
|
+
file_vite_config_ts["vite.config.ts"]
|
|
224
|
+
file_vitest_config_ts["vitest.config.ts"]
|
|
225
|
+
file_src_index_unit_test_ts --> file_src_index_ts
|
|
226
|
+
file_src_modules_discovery_discovery_module_ts --> file_src_modules_discovery_discovery_service_ts
|
|
227
|
+
file_src_modules_discovery_discovery_module_ts --> file_src_modules_discovery_ignore_rules_service_ts
|
|
228
|
+
file_src_modules_discovery_discovery_service_ts --> file_src_modules_discovery_discovery_constants_ts
|
|
229
|
+
file_src_modules_discovery_discovery_service_ts --> file_src_modules_discovery_discovery_types_ts
|
|
230
|
+
file_src_modules_discovery_discovery_service_ts --> file_src_modules_discovery_ignore_rules_service_ts
|
|
231
|
+
file_src_modules_discovery_discovery_service_unit_test_ts --> file_src_modules_discovery_discovery_service_ts
|
|
232
|
+
file_src_modules_discovery_discovery_service_unit_test_ts --> file_src_modules_discovery_ignore_rules_service_ts
|
|
233
|
+
file_src_modules_discovery_ignore_rules_service_ts --> file_src_modules_discovery_discovery_types_ts
|
|
234
|
+
file_src_modules_discovery_ignore_rules_service_unit_test_ts --> file_src_modules_discovery_discovery_types_ts
|
|
235
|
+
file_src_modules_discovery_ignore_rules_service_unit_test_ts --> file_src_modules_discovery_ignore_rules_service_ts
|
|
236
|
+
file_src_modules_folding_folding_module_ts --> file_src_modules_folding_folding_service_ts
|
|
237
|
+
file_src_modules_folding_folding_service_ts --> file_src_modules_words_words_constants_ts
|
|
238
|
+
file_src_modules_folding_folding_service_unit_test_ts --> file_src_modules_folding_folding_service_ts
|
|
239
|
+
file_src_modules_vocabulary_vocabulary_module_ts --> file_src_modules_discovery_discovery_module_ts
|
|
240
|
+
file_src_modules_vocabulary_vocabulary_module_ts --> file_src_modules_folding_folding_module_ts
|
|
241
|
+
file_src_modules_vocabulary_vocabulary_module_ts --> file_src_modules_vocabulary_vocabulary_service_ts
|
|
242
|
+
file_src_modules_vocabulary_vocabulary_module_ts --> file_src_modules_words_words_module_ts
|
|
243
|
+
file_src_modules_vocabulary_vocabulary_service_ts --> file_src_modules_discovery_discovery_service_ts
|
|
244
|
+
file_src_modules_vocabulary_vocabulary_service_ts --> file_src_modules_folding_folding_service_ts
|
|
245
|
+
file_src_modules_vocabulary_vocabulary_service_ts --> file_src_modules_words_words_service_ts
|
|
246
|
+
file_src_modules_vocabulary_vocabulary_service_unit_test_ts --> file_src_modules_discovery_discovery_module_ts
|
|
247
|
+
file_src_modules_vocabulary_vocabulary_service_unit_test_ts --> file_src_modules_folding_folding_module_ts
|
|
248
|
+
file_src_modules_vocabulary_vocabulary_service_unit_test_ts --> file_src_modules_vocabulary_vocabulary_service_ts
|
|
249
|
+
file_src_modules_vocabulary_vocabulary_service_unit_test_ts --> file_src_modules_words_words_module_ts
|
|
250
|
+
file_src_modules_words_words_module_ts --> file_src_modules_words_words_service_ts
|
|
251
|
+
file_src_modules_words_words_service_ts --> file_src_modules_words_words_constants_ts
|
|
252
|
+
file_src_modules_words_words_service_unit_test_ts --> file_src_modules_words_words_service_ts
|
|
253
|
+
```
|
|
254
|
+
<!-- codependix:end name="codependix-file-imports" -->
|
|
255
|
+
|
|
256
|
+
<!-- codometer:start -->
|
|
257
|
+
|
|
258
|
+
## ⏲️ Codometer
|
|
259
|
+
|
|
260
|
+
### Project
|
|
261
|
+
|
|
262
|
+

|
|
263
|
+

|
|
264
|
+

|
|
265
|
+

|
|
266
|
+
|
|
267
|
+
### TypeScript
|
|
268
|
+
|
|
269
|
+

|
|
270
|
+

|
|
271
|
+

|
|
272
|
+

|
|
273
|
+

|
|
274
|
+

|
|
275
|
+

|
|
276
|
+
|
|
277
|
+
### JavaScript
|
|
278
|
+
|
|
279
|
+

|
|
280
|
+

|
|
281
|
+

|
|
282
|
+

|
|
283
|
+

|
|
284
|
+

|
|
285
|
+

|
|
286
|
+

|
|
287
|
+

|
|
288
|
+

|
|
289
|
+

|
|
290
|
+

|
|
291
|
+

|
|
292
|
+

|
|
293
|
+
|
|
294
|
+
### Python
|
|
295
|
+
|
|
296
|
+

|
|
297
|
+

|
|
298
|
+

|
|
299
|
+

|
|
300
|
+

|
|
301
|
+

|
|
302
|
+

|
|
303
|
+

|
|
304
|
+

|
|
305
|
+

|
|
306
|
+

|
|
307
|
+

|
|
308
|
+
|
|
309
|
+
### JSON
|
|
310
|
+
|
|
311
|
+

|
|
312
|
+

|
|
313
|
+

|
|
314
|
+

|
|
315
|
+

|
|
316
|
+

|
|
317
|
+

|
|
318
|
+

|
|
319
|
+

|
|
320
|
+

|
|
321
|
+

|
|
322
|
+

|
|
323
|
+
|
|
324
|
+
### YAML
|
|
325
|
+
|
|
326
|
+

|
|
327
|
+

|
|
328
|
+

|
|
329
|
+

|
|
330
|
+

|
|
331
|
+

|
|
332
|
+

|
|
333
|
+

|
|
334
|
+

|
|
335
|
+

|
|
336
|
+

|
|
337
|
+
|
|
338
|
+
### TOML
|
|
339
|
+
|
|
340
|
+

|
|
341
|
+

|
|
342
|
+

|
|
343
|
+

|
|
344
|
+

|
|
345
|
+

|
|
346
|
+

|
|
347
|
+
|
|
348
|
+
### Shell
|
|
349
|
+
|
|
350
|
+

|
|
351
|
+

|
|
352
|
+

|
|
353
|
+

|
|
354
|
+

|
|
355
|
+

|
|
356
|
+

|
|
357
|
+

|
|
358
|
+

|
|
359
|
+

|
|
360
|
+

|
|
361
|
+
|
|
362
|
+
### SQL
|
|
363
|
+
|
|
364
|
+

|
|
365
|
+

|
|
366
|
+

|
|
367
|
+

|
|
368
|
+

|
|
369
|
+

|
|
370
|
+

|
|
371
|
+

|
|
372
|
+

|
|
373
|
+

|
|
374
|
+

|
|
375
|
+
|
|
376
|
+
### HCL
|
|
377
|
+
|
|
378
|
+

|
|
379
|
+

|
|
380
|
+

|
|
381
|
+

|
|
382
|
+

|
|
383
|
+

|
|
384
|
+

|
|
385
|
+

|
|
386
|
+

|
|
387
|
+
|
|
388
|
+
### CSS
|
|
389
|
+
|
|
390
|
+

|
|
391
|
+

|
|
392
|
+

|
|
393
|
+

|
|
394
|
+

|
|
395
|
+

|
|
396
|
+

|
|
397
|
+

|
|
398
|
+

|
|
399
|
+
|
|
400
|
+
### Conventions
|
|
401
|
+
|
|
402
|
+

|
|
403
|
+

|
|
404
|
+

|
|
405
|
+

|
|
406
|
+

|
|
407
|
+

|
|
408
|
+

|
|
409
|
+

|
|
410
|
+

|
|
411
|
+

|
|
412
|
+

|
|
413
|
+

|
|
414
|
+

|
|
415
|
+

|
|
416
|
+

|
|
417
|
+

|
|
418
|
+

|
|
419
|
+

|
|
420
|
+
|
|
421
|
+
### Jupyter
|
|
422
|
+
|
|
423
|
+

|
|
424
|
+

|
|
425
|
+

|
|
426
|
+

|
|
427
|
+

|
|
428
|
+

|
|
429
|
+

|
|
430
|
+

|
|
431
|
+

|
|
432
|
+

|
|
433
|
+

|
|
434
|
+

|
|
435
|
+

|
|
436
|
+

|
|
437
|
+

|
|
438
|
+

|
|
439
|
+

|
|
440
|
+

|
|
441
|
+

|
|
442
|
+

|
|
443
|
+
|
|
444
|
+
### Markdown
|
|
445
|
+
|
|
446
|
+

|
|
447
|
+

|
|
448
|
+

|
|
449
|
+

|
|
450
|
+

|
|
451
|
+

|
|
452
|
+

|
|
453
|
+

|
|
454
|
+

|
|
455
|
+

|
|
456
|
+

|
|
457
|
+

|
|
458
|
+

|
|
459
|
+

|
|
460
|
+

|
|
461
|
+

|
|
462
|
+

|
|
463
|
+

|
|
464
|
+

|
|
465
|
+

|
|
466
|
+
<!-- codometer:end -->
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { Ignore } from 'ignore';
|
|
2
|
+
import { LanguagesService } from '@coinagerie/languages';
|
|
3
|
+
import { ResolvedCoinagerieConfiguration } from '@coinagerie/configuration';
|
|
4
|
+
|
|
5
|
+
/** What `discover` is asked to list. */
|
|
6
|
+
export declare interface DiscoverArguments {
|
|
7
|
+
/** The absolute root the run scans. */
|
|
8
|
+
directory: string;
|
|
9
|
+
/** Globs, relative to the root, naming files to leave out. */
|
|
10
|
+
exclude: string[];
|
|
11
|
+
/** Globs, relative to the root, naming the files to keep. */
|
|
12
|
+
include: string[];
|
|
13
|
+
/** Absolute paths always left out: the files the run writes. */
|
|
14
|
+
skip: string[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Provides file discovery. `IgnoreRulesService` is a provider rather than an
|
|
19
|
+
* export: it is how discovery reads `.gitignore`, and nothing else needs it.
|
|
20
|
+
*/
|
|
21
|
+
export declare class DiscoveryModule {
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Lists the files a run scans.
|
|
26
|
+
*
|
|
27
|
+
* Every `.gitignore` git would honor is honored — those inside the root, and
|
|
28
|
+
* those above it up to the repository root — and then the configuration's
|
|
29
|
+
* own `include` and `exclude.paths` globs decide among what is left.
|
|
30
|
+
*/
|
|
31
|
+
export declare class DiscoveryService {
|
|
32
|
+
private readonly ignoreRulesService;
|
|
33
|
+
constructor(ignoreRulesService: IgnoreRulesService);
|
|
34
|
+
/**
|
|
35
|
+
* The nearest folder at or above the root holding a `.git` entry, or the
|
|
36
|
+
* root itself outside any repository. A worktree's `.git` is a file, which
|
|
37
|
+
* counts the same.
|
|
38
|
+
*/
|
|
39
|
+
private findRepositoryRoot;
|
|
40
|
+
/**
|
|
41
|
+
* Whether an `exclude.paths` glob names a folder outright, which excludes
|
|
42
|
+
* everything in it — so `exclude: ["dist"]` reads the way a `.gitignore`
|
|
43
|
+
* line does, and the folder is never walked.
|
|
44
|
+
*/
|
|
45
|
+
private isExcludedFolder;
|
|
46
|
+
/** Whether the configuration's globs keep a root-relative file. */
|
|
47
|
+
private isSelected;
|
|
48
|
+
/**
|
|
49
|
+
* The ignore files of every folder from the repository root down to, but
|
|
50
|
+
* not including, the scan root — whose own file the walk reads.
|
|
51
|
+
*/
|
|
52
|
+
private readAncestorScopes;
|
|
53
|
+
/** A path with forward slashes, which is what every glob is written in. */
|
|
54
|
+
private toPosix;
|
|
55
|
+
/**
|
|
56
|
+
* Every file under one folder that no ignore file claims, as absolute
|
|
57
|
+
* paths. Symbolic links are skipped rather than followed, so nothing is
|
|
58
|
+
* read twice and a link to an ancestor cannot loop.
|
|
59
|
+
*/
|
|
60
|
+
private walk;
|
|
61
|
+
/**
|
|
62
|
+
* Every file the run scans, relative to the root, sorted so the same tree
|
|
63
|
+
* yields the same list on every machine.
|
|
64
|
+
*/
|
|
65
|
+
discover(args: DiscoverArguments): string[];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Provides the folding of word forms into headwords. */
|
|
69
|
+
export declare class FoldingModule {
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Folds the surface forms of a word into one headword, so the glossary lists
|
|
74
|
+
* a term once however the code inflects it.
|
|
75
|
+
*
|
|
76
|
+
* Plurals fold into their singular and inflected verbs into their lemma:
|
|
77
|
+
* `aspects` into `aspect`, `configured` and `configuring` into `configure`.
|
|
78
|
+
* Derivational families stay apart, so `configuration` keeps its own entry —
|
|
79
|
+
* unless the configuration's own `fold` merges them.
|
|
80
|
+
*/
|
|
81
|
+
export declare class FoldingService {
|
|
82
|
+
constructor();
|
|
83
|
+
/**
|
|
84
|
+
* The headword a lowercase word folds into: its singular, then its lemma.
|
|
85
|
+
*
|
|
86
|
+
* A fold that would leave a single letter (`ts` into `t`) is refused, since
|
|
87
|
+
* one-letter words are not terms.
|
|
88
|
+
*/
|
|
89
|
+
fold(word: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* The headword a word is listed under: folded into its singular and lemma,
|
|
92
|
+
* then through the configuration's own `fold` when it has one. A fault in
|
|
93
|
+
* that function surfaces as an `InvalidConfigurationError` naming the file.
|
|
94
|
+
*/
|
|
95
|
+
headword(word: string, configuration: ResolvedCoinagerieConfiguration): string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Reads `.gitignore` files and judges paths against them, without git.
|
|
100
|
+
*
|
|
101
|
+
* Reading the syntax here rather than asking git is what lets a run scan a
|
|
102
|
+
* folder that is not a repository at all.
|
|
103
|
+
*/
|
|
104
|
+
declare class IgnoreRulesService {
|
|
105
|
+
constructor();
|
|
106
|
+
/** A path as a scope sees it, or `undefined` when it lies outside the scope. */
|
|
107
|
+
private toScopedPath;
|
|
108
|
+
/**
|
|
109
|
+
* Whether the scopes ignore a repository-relative path, the innermost
|
|
110
|
+
* deciding — which is how a nested `!pattern` re-includes a file its parent
|
|
111
|
+
* ignored. A folder is judged with a trailing slash.
|
|
112
|
+
*/
|
|
113
|
+
isIgnored(scopes: IgnoreScope[], relativePath: string): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Reads one ignore file, or `undefined` when it does not exist.
|
|
116
|
+
*
|
|
117
|
+
* Case-sensitive on every platform, so the same file ignores the same paths
|
|
118
|
+
* on a developer's machine and in CI.
|
|
119
|
+
*/
|
|
120
|
+
readScope(args: ReadIgnoreScopeArguments): IgnoreScope | undefined;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The rules of one `.gitignore`, and the folder they were written in.
|
|
125
|
+
*
|
|
126
|
+
* `base` is relative to the repository root, `""` for the root itself; the
|
|
127
|
+
* patterns only ever see paths relative to it.
|
|
128
|
+
*/
|
|
129
|
+
declare interface IgnoreScope {
|
|
130
|
+
base: string;
|
|
131
|
+
matcher: Ignore;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Where to read one ignore file from, and the folder it governs. */
|
|
135
|
+
declare interface ReadIgnoreScopeArguments {
|
|
136
|
+
base: string;
|
|
137
|
+
filePath: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Provides the vocabulary pipeline, wired to discovery, the language
|
|
142
|
+
* tokenizers, word splitting, folding, and exclusion.
|
|
143
|
+
*/
|
|
144
|
+
export declare class VocabularyModule {
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* The coinagerie pipeline: from a configuration to the sorted list of every
|
|
149
|
+
* word the code uses.
|
|
150
|
+
*
|
|
151
|
+
* Discovers the files, splits every path into words, tokenizes every file a
|
|
152
|
+
* language claims and splits its identifiers into words, folds each word into
|
|
153
|
+
* its headword, leaves out the headwords the configuration excludes, then
|
|
154
|
+
* de-duplicates and sorts. A fault in the configuration's `fold` aborts the
|
|
155
|
+
* run, naming the configuration file. A file no language claims still
|
|
156
|
+
* contributes its path.
|
|
157
|
+
*/
|
|
158
|
+
export declare class VocabularyService {
|
|
159
|
+
private readonly discoveryService;
|
|
160
|
+
private readonly foldingService;
|
|
161
|
+
private readonly languagesService;
|
|
162
|
+
private readonly wordsService;
|
|
163
|
+
constructor(discoveryService: DiscoveryService, foldingService: FoldingService, languagesService: LanguagesService, wordsService: WordsService);
|
|
164
|
+
/** The words of one file: its path's, then its identifiers'. */
|
|
165
|
+
private collectFile;
|
|
166
|
+
/**
|
|
167
|
+
* The headwords the configuration leaves out by exact word.
|
|
168
|
+
*
|
|
169
|
+
* Its words are folded the way the code's are, so exclusion compares
|
|
170
|
+
* headwords: excluding `service` covers `services`, and excluding
|
|
171
|
+
* `implements` covers the `implement` it folds into.
|
|
172
|
+
*/
|
|
173
|
+
private excludedHeadwords;
|
|
174
|
+
/** Whether a pattern leaves out a word: it matches the word or its headword. */
|
|
175
|
+
private matchesPattern;
|
|
176
|
+
/**
|
|
177
|
+
* Every word the configured files use, sorted and de-duplicated.
|
|
178
|
+
*
|
|
179
|
+
* The files a configuration writes a glossary to are left out, so a run
|
|
180
|
+
* never reads its own output back as vocabulary. A headword a pattern
|
|
181
|
+
* matches is left out wholly, as a string leaves out a headword: the pattern
|
|
182
|
+
* is tested against each occurrence's lowercase word and its headword.
|
|
183
|
+
*/
|
|
184
|
+
collect(configuration: ResolvedCoinagerieConfiguration): Promise<string[]>;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Provides the splitting and normalizing of identifiers and paths into
|
|
189
|
+
* words.
|
|
190
|
+
*/
|
|
191
|
+
export declare class WordsModule {
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Splits names into the words a glossary lists.
|
|
196
|
+
*
|
|
197
|
+
* A word leaves here lowercase, at least two characters long, and not a bare
|
|
198
|
+
* number. It is not yet folded: `aspects` and `aspect` are still two words.
|
|
199
|
+
*/
|
|
200
|
+
export declare class WordsService {
|
|
201
|
+
constructor();
|
|
202
|
+
/** Whether a lowercase word is a term rather than noise. */
|
|
203
|
+
private isTerm;
|
|
204
|
+
/**
|
|
205
|
+
* The words of one identifier, in the order written, repeats kept.
|
|
206
|
+
*
|
|
207
|
+
* Splits on every separator, then on case changes, keeping acronym runs
|
|
208
|
+
* together: `XMLHttpRequest` is `xml`, `http`, and `request`.
|
|
209
|
+
*/
|
|
210
|
+
splitIdentifier(raw: string): string[];
|
|
211
|
+
/**
|
|
212
|
+
* The words of a relative file path: every folder name, and the file name
|
|
213
|
+
* with only its final extension removed, so `glossary.service.ts`
|
|
214
|
+
* contributes `glossary` and `service`.
|
|
215
|
+
*/
|
|
216
|
+
splitPath(relativePath: string): string[];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export { }
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { Injectable as e, Module as t } from "@nestjs/common";
|
|
2
|
+
import { existsSync as n, readFileSync as r, readdirSync as i } from "node:fs";
|
|
3
|
+
import a from "node:path";
|
|
4
|
+
import o from "ignore";
|
|
5
|
+
import s from "pluralize";
|
|
6
|
+
import c from "wink-lemmatizer";
|
|
7
|
+
import { LanguagesModule as l, LanguagesService as u } from "@coinagerie/languages";
|
|
8
|
+
import { readFile as d } from "node:fs/promises";
|
|
9
|
+
// \0rolldown/runtime.js
|
|
10
|
+
var f = ".gitignore";
|
|
11
|
+
// \0@oxc-project+runtime@0.155.0/helpers/esm/decorateMetadata.js
|
|
12
|
+
function __decorateMetadata(e, t) {
|
|
13
|
+
if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
|
|
14
|
+
}
|
|
15
|
+
// \0@oxc-project+runtime@0.155.0/helpers/esm/decorate.js
|
|
16
|
+
function __decorate(e, t, n, r) {
|
|
17
|
+
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
18
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
19
|
+
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);
|
|
20
|
+
return i > 3 && a && Object.defineProperty(t, n, a), a;
|
|
21
|
+
}
|
|
22
|
+
// src/modules/discovery/ignore-rules.service.ts
|
|
23
|
+
var p = class IgnoreRulesService {
|
|
24
|
+
constructor() {}
|
|
25
|
+
toScopedPath(e, t) {
|
|
26
|
+
if (e.base === "") return t;
|
|
27
|
+
let n = `${e.base}/`;
|
|
28
|
+
return t.startsWith(n) ? t.slice(n.length) : void 0;
|
|
29
|
+
}
|
|
30
|
+
isIgnored(e, t) {
|
|
31
|
+
let n = !1;
|
|
32
|
+
for (let r of e) {
|
|
33
|
+
let e = this.toScopedPath(r, t);
|
|
34
|
+
if (e === void 0) continue;
|
|
35
|
+
let i = r.matcher.test(e);
|
|
36
|
+
(i.ignored || i.unignored) && (n = i.ignored);
|
|
37
|
+
}
|
|
38
|
+
return n;
|
|
39
|
+
}
|
|
40
|
+
readScope(e) {
|
|
41
|
+
if (n(e.filePath)) return {
|
|
42
|
+
base: e.base,
|
|
43
|
+
matcher: o({ ignorecase: !1 }).add(r(e.filePath, "utf8"))
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
p = __decorate([e(), __decorateMetadata("design:paramtypes", [])], p);
|
|
48
|
+
// src/modules/discovery/discovery.service.ts
|
|
49
|
+
var m = class DiscoveryService {
|
|
50
|
+
ignoreRulesService;
|
|
51
|
+
constructor(e) {
|
|
52
|
+
this.ignoreRulesService = e;
|
|
53
|
+
}
|
|
54
|
+
findRepositoryRoot(e) {
|
|
55
|
+
for (let t = e;; t = a.dirname(t)) {
|
|
56
|
+
if (n(a.join(t, ".git"))) return t;
|
|
57
|
+
if (a.dirname(t) === t) return e;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
isExcludedFolder(e, t) {
|
|
61
|
+
let n = this.toPosix(a.relative(e.discover.directory, t));
|
|
62
|
+
return e.discover.exclude.some((e) => a.matchesGlob(n, e));
|
|
63
|
+
}
|
|
64
|
+
isSelected(e, t) {
|
|
65
|
+
return e.include.some((e) => a.matchesGlob(t, e)) && !e.exclude.some((e) => a.matchesGlob(t, e));
|
|
66
|
+
}
|
|
67
|
+
readAncestorScopes(e, t) {
|
|
68
|
+
let n = this.toPosix(a.relative(e, t)).split("/").filter((e) => e !== "");
|
|
69
|
+
return n.flatMap((t, r) => {
|
|
70
|
+
let i = n.slice(0, r).join("/"), o = this.ignoreRulesService.readScope({
|
|
71
|
+
base: i,
|
|
72
|
+
filePath: a.join(e, i, f)
|
|
73
|
+
});
|
|
74
|
+
return o === void 0 ? [] : [o];
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
toPosix(e) {
|
|
78
|
+
return e.split(a.sep).join("/");
|
|
79
|
+
}
|
|
80
|
+
walk(e) {
|
|
81
|
+
let t = this.toPosix(a.relative(e.repositoryRoot, e.absoluteDirectory)), n = this.ignoreRulesService.readScope({
|
|
82
|
+
base: t,
|
|
83
|
+
filePath: a.join(e.absoluteDirectory, f)
|
|
84
|
+
}), r = n === void 0 ? e.scopes : [...e.scopes, n];
|
|
85
|
+
return i(e.absoluteDirectory, { withFileTypes: !0 }).filter((e) => !e.isSymbolicLink() && e.name !== ".git").flatMap((n) => {
|
|
86
|
+
let i = a.join(e.absoluteDirectory, n.name), o = t === "" ? n.name : `${t}/${n.name}`, s = n.isDirectory();
|
|
87
|
+
return this.ignoreRulesService.isIgnored(r, s ? `${o}/` : o) ? [] : s ? this.isExcludedFolder(e, i) ? [] : this.walk({
|
|
88
|
+
...e,
|
|
89
|
+
absoluteDirectory: i,
|
|
90
|
+
scopes: r
|
|
91
|
+
}) : [i];
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
discover(e) {
|
|
95
|
+
let t = this.findRepositoryRoot(e.directory), n = new Set(e.skip.map((e) => a.resolve(e)));
|
|
96
|
+
return this.walk({
|
|
97
|
+
absoluteDirectory: e.directory,
|
|
98
|
+
discover: e,
|
|
99
|
+
repositoryRoot: t,
|
|
100
|
+
scopes: this.readAncestorScopes(t, e.directory)
|
|
101
|
+
}).filter((e) => !n.has(e)).map((t) => this.toPosix(a.relative(e.directory, t))).filter((t) => this.isSelected(e, t)).toSorted();
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
m = __decorate([e(), __decorateMetadata("design:paramtypes", [p === void 0 ? Object : p])], m);
|
|
105
|
+
// src/modules/discovery/discovery.module.ts
|
|
106
|
+
var h = class DiscoveryModule {};
|
|
107
|
+
h = __decorate([t({
|
|
108
|
+
controllers: [],
|
|
109
|
+
exports: [m],
|
|
110
|
+
imports: [],
|
|
111
|
+
providers: [m, p]
|
|
112
|
+
})], h);
|
|
113
|
+
// src/modules/words/words.constants.ts
|
|
114
|
+
var g = /[^\p{L}\p{M}\p{N}]+/u, _ = /\p{Lu}+(?![\p{Ll}\p{Lo}\p{Lm}])\p{N}*|\p{Lu}?[\p{Ll}\p{Lo}\p{Lm}\p{M}]+\p{N}*|\p{N}+[\p{Ll}\p{Lo}\p{Lm}\p{M}]*/gu, v = /^\p{N}+$/u, y = /^.{2,}$/su, b = class FoldingService {
|
|
115
|
+
constructor() {}
|
|
116
|
+
fold(e) {
|
|
117
|
+
let t = c.verb(s.singular(e));
|
|
118
|
+
return y.test(t) ? t : e;
|
|
119
|
+
}
|
|
120
|
+
headword(e, t) {
|
|
121
|
+
let n = this.fold(e);
|
|
122
|
+
return t.fold === void 0 ? n : t.fold(n);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
b = __decorate([e(), __decorateMetadata("design:paramtypes", [])], b);
|
|
126
|
+
// src/modules/folding/folding.module.ts
|
|
127
|
+
var x = class FoldingModule {};
|
|
128
|
+
x = __decorate([t({
|
|
129
|
+
controllers: [],
|
|
130
|
+
exports: [b],
|
|
131
|
+
imports: [],
|
|
132
|
+
providers: [b]
|
|
133
|
+
})], x);
|
|
134
|
+
// src/modules/words/words.service.ts
|
|
135
|
+
var S = class WordsService {
|
|
136
|
+
constructor() {}
|
|
137
|
+
isTerm(e) {
|
|
138
|
+
return y.test(e) && !v.test(e);
|
|
139
|
+
}
|
|
140
|
+
splitIdentifier(e) {
|
|
141
|
+
return e.split(g).flatMap((e) => e.match(_) ?? []).map((e) => e.toLowerCase()).filter((e) => this.isTerm(e));
|
|
142
|
+
}
|
|
143
|
+
splitPath(e) {
|
|
144
|
+
return this.splitIdentifier(e.slice(0, e.length - a.extname(e).length));
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
S = __decorate([e(), __decorateMetadata("design:paramtypes", [])], S);
|
|
148
|
+
// src/modules/words/words.module.ts
|
|
149
|
+
var C = class WordsModule {};
|
|
150
|
+
C = __decorate([t({
|
|
151
|
+
controllers: [],
|
|
152
|
+
exports: [S],
|
|
153
|
+
imports: [],
|
|
154
|
+
providers: [S]
|
|
155
|
+
})], C);
|
|
156
|
+
// src/modules/vocabulary/vocabulary.service.ts
|
|
157
|
+
var w = class VocabularyService {
|
|
158
|
+
discoveryService;
|
|
159
|
+
foldingService;
|
|
160
|
+
languagesService;
|
|
161
|
+
wordsService;
|
|
162
|
+
constructor(e, t, n, r) {
|
|
163
|
+
this.discoveryService = e, this.foldingService = t, this.languagesService = n, this.wordsService = r;
|
|
164
|
+
}
|
|
165
|
+
async collectFile(e, t) {
|
|
166
|
+
let n = this.wordsService.splitPath(t), r = this.languagesService.tokenizerFor(t);
|
|
167
|
+
if (r === void 0) return n;
|
|
168
|
+
let i = await d(a.join(e, t), "utf8");
|
|
169
|
+
return [...n, ...r(i, t).flatMap((e) => this.wordsService.splitIdentifier(e))];
|
|
170
|
+
}
|
|
171
|
+
excludedHeadwords(e) {
|
|
172
|
+
let t = /* @__PURE__ */ new Set();
|
|
173
|
+
for (let n of e.exclude.words) {
|
|
174
|
+
let r = n.toLowerCase();
|
|
175
|
+
t.add(r), t.add(this.foldingService.headword(r, e));
|
|
176
|
+
}
|
|
177
|
+
return t;
|
|
178
|
+
}
|
|
179
|
+
matchesPattern(e, t, n) {
|
|
180
|
+
return n.some((n) => n.test(e) || n.test(t));
|
|
181
|
+
}
|
|
182
|
+
async collect(e) {
|
|
183
|
+
let t = this.discoveryService.discover({
|
|
184
|
+
directory: e.directory,
|
|
185
|
+
exclude: e.exclude.paths,
|
|
186
|
+
include: e.include,
|
|
187
|
+
skip: e.outputs.map((e) => e.path)
|
|
188
|
+
}), n = this.excludedHeadwords(e), r = e.exclude.patterns, i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set();
|
|
189
|
+
for (let s of t) for (let t of await this.collectFile(e.directory, s)) {
|
|
190
|
+
let s = a.get(t) ?? this.foldingService.headword(t, e);
|
|
191
|
+
a.set(t, s), this.matchesPattern(t, s, r) && o.add(s), n.has(s) || i.add(s);
|
|
192
|
+
}
|
|
193
|
+
return [...i].filter((e) => !o.has(e)).toSorted();
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
w = __decorate([e(), __decorateMetadata("design:paramtypes", [
|
|
197
|
+
m === void 0 ? Object : m,
|
|
198
|
+
b === void 0 ? Object : b,
|
|
199
|
+
u === void 0 ? Object : u,
|
|
200
|
+
S === void 0 ? Object : S
|
|
201
|
+
])], w);
|
|
202
|
+
// src/modules/vocabulary/vocabulary.module.ts
|
|
203
|
+
var T = class VocabularyModule {};
|
|
204
|
+
T = __decorate([t({
|
|
205
|
+
controllers: [],
|
|
206
|
+
exports: [w],
|
|
207
|
+
imports: [
|
|
208
|
+
h,
|
|
209
|
+
x,
|
|
210
|
+
l,
|
|
211
|
+
C
|
|
212
|
+
],
|
|
213
|
+
providers: [w]
|
|
214
|
+
})], T);
|
|
215
|
+
export { h as DiscoveryModule, m as DiscoveryService, x as FoldingModule, b as FoldingService, T as VocabularyModule, w as VocabularyService, C as WordsModule, S as WordsService };
|
package/package.json
CHANGED
|
@@ -1,6 +1,65 @@
|
|
|
1
1
|
{
|
|
2
|
+
"author": "Jimmy Paolini",
|
|
3
|
+
"bugs": {
|
|
4
|
+
"url": "https://github.com/organizzolini/codebase/issues"
|
|
5
|
+
},
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@coinagerie/configuration": "0.0.2",
|
|
8
|
+
"@coinagerie/languages": "0.0.2",
|
|
9
|
+
"@nestjs/common": "^11.1.21 || ^12.0.1",
|
|
10
|
+
"ignore": "7.0.14",
|
|
11
|
+
"pluralize": "^8.0.0",
|
|
12
|
+
"reflect-metadata": "^0.2.2",
|
|
13
|
+
"wink-lemmatizer": "^3.0.4"
|
|
14
|
+
},
|
|
15
|
+
"description": "File discovery, word splitting, folding, and exclusion that turn a codebase into a sorted list of headwords",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@golevelup/ts-vitest": "^4.0.0",
|
|
18
|
+
"@nestjs/testing": "^12.0.1",
|
|
19
|
+
"@nx/eslint-plugin": "^24.0.0",
|
|
20
|
+
"@swc/helpers": "^0.5.21",
|
|
21
|
+
"@types/node": "^26.5.1",
|
|
22
|
+
"@types/pluralize": "^0.0.33",
|
|
23
|
+
"@vitest/coverage-v8": "^5.0.0",
|
|
24
|
+
"vitest": "^5.0.0"
|
|
25
|
+
},
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/src/index.d.ts",
|
|
29
|
+
"default": "./dist/src/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"CHANGELOG.md",
|
|
35
|
+
"dist",
|
|
36
|
+
"LICENSE",
|
|
37
|
+
"README.md"
|
|
38
|
+
],
|
|
39
|
+
"homepage": "https://github.com/organizzolini/codebase/tree/main/projects/ic-suite/coinagerie/coinagerie-vocabulary#readme",
|
|
40
|
+
"keywords": [
|
|
41
|
+
"coinagerie",
|
|
42
|
+
"glossary",
|
|
43
|
+
"vocabulary",
|
|
44
|
+
"words"
|
|
45
|
+
],
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"main": "./dist/src/index.js",
|
|
2
48
|
"name": "@coinagerie/vocabulary",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public",
|
|
51
|
+
"registry": "https://registry.npmjs.org"
|
|
52
|
+
},
|
|
53
|
+
"repository": {
|
|
54
|
+
"directory": "projects/ic-suite/coinagerie/coinagerie-vocabulary",
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "git+https://github.com/organizzolini/codebase.git"
|
|
57
|
+
},
|
|
58
|
+
"type": "module",
|
|
59
|
+
"typeCoverage": {
|
|
60
|
+
"atLeast": 100,
|
|
61
|
+
"strict": true
|
|
62
|
+
},
|
|
63
|
+
"types": "./dist/src/index.d.ts",
|
|
64
|
+
"version": "0.0.2"
|
|
6
65
|
}
|