@enhance-eng/archangel 0.3.3 → 0.3.4
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/README.md +7 -6
- package/archangel.schema.json +36 -12
- package/index.d.ts +12 -9
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
**Make architecture verifiable.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### [Read the docs →](https://enhancelabs.ai/archangel/)
|
|
6
|
+
|
|
7
|
+

|
|
6
8
|
|
|
7
9
|
Architecture tests for TypeScript, checked in milliseconds. You write a table of what each part of
|
|
8
10
|
your code may import. Archangel tells you when the code breaks the table, and what to do about it. It checks
|
|
@@ -18,11 +20,10 @@ Archangel checks imports, import cycles, file and folder names, the files that f
|
|
|
18
20
|
and exports. It has presets for Feature-Sliced Design and Next.js, and you can write your own
|
|
19
21
|
conditions in TypeScript.
|
|
20
22
|
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
23
|
-
- [
|
|
24
|
-
- [
|
|
25
|
-
- [Commands](https://github.com/enhance-labs-builds/archangel/blob/main/docs/commands.md)
|
|
23
|
+
- [Getting started](https://enhancelabs.ai/archangel/start/getting-started/)
|
|
24
|
+
- [Guides](https://enhancelabs.ai/archangel/guides/existing-repository/)
|
|
25
|
+
- [Reference](https://enhancelabs.ai/archangel/reference/conditions/)
|
|
26
|
+
- [Docs for coding agents](https://enhancelabs.ai/archangel/llms.txt)
|
|
26
27
|
|
|
27
28
|
The package includes a prebuilt binary for macOS, Linux and Windows. You do not need Rust.
|
|
28
29
|
|
package/archangel.schema.json
CHANGED
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"oneOf": [
|
|
103
103
|
{
|
|
104
104
|
"type": "object",
|
|
105
|
-
"description": "Each listed
|
|
105
|
+
"description": "Each listed part or group may import only itself and later listed ones.",
|
|
106
106
|
"additionalProperties": false,
|
|
107
107
|
"required": [
|
|
108
108
|
"kind",
|
|
@@ -132,9 +132,10 @@
|
|
|
132
132
|
"enum": [
|
|
133
133
|
"all",
|
|
134
134
|
"runtime",
|
|
135
|
+
"static",
|
|
135
136
|
"types"
|
|
136
137
|
],
|
|
137
|
-
"description": "Which imports the rule checks: all of them, those that stay at runtime, or type imports."
|
|
138
|
+
"description": "Which imports the rule checks: all of them, those that stay at runtime, the runtime imports other than `import()`, or type imports."
|
|
138
139
|
},
|
|
139
140
|
"examples": {
|
|
140
141
|
"$ref": "#/definitions/examples"
|
|
@@ -146,7 +147,7 @@
|
|
|
146
147
|
"minLength": 1
|
|
147
148
|
},
|
|
148
149
|
"minItems": 1,
|
|
149
|
-
"description": "Each listed
|
|
150
|
+
"description": "Each listed part or group may import only itself and later listed ones."
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
},
|
|
@@ -182,9 +183,10 @@
|
|
|
182
183
|
"enum": [
|
|
183
184
|
"all",
|
|
184
185
|
"runtime",
|
|
186
|
+
"static",
|
|
185
187
|
"types"
|
|
186
188
|
],
|
|
187
|
-
"description": "Which imports the rule checks: all of them, those that stay at runtime, or type imports."
|
|
189
|
+
"description": "Which imports the rule checks: all of them, those that stay at runtime, the runtime imports other than `import()`, or type imports."
|
|
188
190
|
},
|
|
189
191
|
"examples": {
|
|
190
192
|
"$ref": "#/definitions/examples"
|
|
@@ -229,9 +231,10 @@
|
|
|
229
231
|
"enum": [
|
|
230
232
|
"all",
|
|
231
233
|
"runtime",
|
|
234
|
+
"static",
|
|
232
235
|
"types"
|
|
233
236
|
],
|
|
234
|
-
"description": "Which imports the rule checks: all of them, those that stay at runtime, or type imports."
|
|
237
|
+
"description": "Which imports the rule checks: all of them, those that stay at runtime, the runtime imports other than `import()`, or type imports."
|
|
235
238
|
},
|
|
236
239
|
"examples": {
|
|
237
240
|
"$ref": "#/definitions/examples"
|
|
@@ -322,9 +325,10 @@
|
|
|
322
325
|
"enum": [
|
|
323
326
|
"all",
|
|
324
327
|
"runtime",
|
|
328
|
+
"static",
|
|
325
329
|
"types"
|
|
326
330
|
],
|
|
327
|
-
"description": "Which imports the rule checks: all of them, those that stay at runtime, or type imports."
|
|
331
|
+
"description": "Which imports the rule checks: all of them, those that stay at runtime, the runtime imports other than `import()`, or type imports."
|
|
328
332
|
},
|
|
329
333
|
"names": {
|
|
330
334
|
"type": "array",
|
|
@@ -395,9 +399,10 @@
|
|
|
395
399
|
"enum": [
|
|
396
400
|
"all",
|
|
397
401
|
"runtime",
|
|
402
|
+
"static",
|
|
398
403
|
"types"
|
|
399
404
|
],
|
|
400
|
-
"description": "Which imports the rule checks: all of them, those that stay at runtime, or type imports."
|
|
405
|
+
"description": "Which imports the rule checks: all of them, those that stay at runtime, the runtime imports other than `import()`, or type imports."
|
|
401
406
|
},
|
|
402
407
|
"examples": {
|
|
403
408
|
"$ref": "#/definitions/examples"
|
|
@@ -474,7 +479,8 @@
|
|
|
474
479
|
"imports": {
|
|
475
480
|
"enum": [
|
|
476
481
|
"all",
|
|
477
|
-
"runtime"
|
|
482
|
+
"runtime",
|
|
483
|
+
"static"
|
|
478
484
|
]
|
|
479
485
|
},
|
|
480
486
|
"names": false,
|
|
@@ -517,9 +523,10 @@
|
|
|
517
523
|
"enum": [
|
|
518
524
|
"all",
|
|
519
525
|
"runtime",
|
|
526
|
+
"static",
|
|
520
527
|
"types"
|
|
521
528
|
],
|
|
522
|
-
"description": "Which imports the rule checks: all of them, those that stay at runtime, or type imports."
|
|
529
|
+
"description": "Which imports the rule checks: all of them, those that stay at runtime, the runtime imports other than `import()`, or type imports."
|
|
523
530
|
},
|
|
524
531
|
"examples": {
|
|
525
532
|
"$ref": "#/definitions/examples"
|
|
@@ -607,9 +614,10 @@
|
|
|
607
614
|
"enum": [
|
|
608
615
|
"all",
|
|
609
616
|
"runtime",
|
|
617
|
+
"static",
|
|
610
618
|
"types"
|
|
611
619
|
],
|
|
612
|
-
"description": "Which imports the rule checks: all of them, those that stay at runtime, or type imports."
|
|
620
|
+
"description": "Which imports the rule checks: all of them, those that stay at runtime, the runtime imports other than `import()`, or type imports."
|
|
613
621
|
},
|
|
614
622
|
"examples": {
|
|
615
623
|
"$ref": "#/definitions/examples"
|
|
@@ -1126,9 +1134,10 @@
|
|
|
1126
1134
|
"enum": [
|
|
1127
1135
|
"all",
|
|
1128
1136
|
"runtime",
|
|
1137
|
+
"static",
|
|
1129
1138
|
"types"
|
|
1130
1139
|
],
|
|
1131
|
-
"description": "Which imports the rule checks: all of them, those that stay at runtime, or type imports."
|
|
1140
|
+
"description": "Which imports the rule checks: all of them, those that stay at runtime, the runtime imports other than `import()`, or type imports."
|
|
1132
1141
|
},
|
|
1133
1142
|
"examples": {
|
|
1134
1143
|
"$ref": "#/definitions/examples"
|
|
@@ -1168,9 +1177,10 @@
|
|
|
1168
1177
|
"enum": [
|
|
1169
1178
|
"all",
|
|
1170
1179
|
"runtime",
|
|
1180
|
+
"static",
|
|
1171
1181
|
"types"
|
|
1172
1182
|
],
|
|
1173
|
-
"description": "Which imports the rule's import sentences check: all of them, those that stay at runtime, or type imports."
|
|
1183
|
+
"description": "Which imports the rule's import sentences check: all of them, those that stay at runtime, the runtime imports other than `import()`, or type imports."
|
|
1174
1184
|
},
|
|
1175
1185
|
"examples": {
|
|
1176
1186
|
"$ref": "#/definitions/examples"
|
|
@@ -1379,6 +1389,20 @@
|
|
|
1379
1389
|
"description": "The files that start with this directive, such as `use client`."
|
|
1380
1390
|
}
|
|
1381
1391
|
}
|
|
1392
|
+
},
|
|
1393
|
+
{
|
|
1394
|
+
"type": "object",
|
|
1395
|
+
"additionalProperties": false,
|
|
1396
|
+
"required": [
|
|
1397
|
+
"tag"
|
|
1398
|
+
],
|
|
1399
|
+
"properties": {
|
|
1400
|
+
"tag": {
|
|
1401
|
+
"type": "string",
|
|
1402
|
+
"pattern": "^@.",
|
|
1403
|
+
"description": "The files whose comments before the first statement carry this JSDoc tag, such as `@side-effect-free`."
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1382
1406
|
}
|
|
1383
1407
|
]
|
|
1384
1408
|
},
|
package/index.d.ts
CHANGED
|
@@ -79,7 +79,9 @@ export type SelectorObject<N extends string, F extends string = N> =
|
|
|
79
79
|
readonly directive?: never;
|
|
80
80
|
}
|
|
81
81
|
/** The files that start with a directive, such as `'use client'`. */
|
|
82
|
-
| { readonly directive: string; readonly element?: never }
|
|
82
|
+
| { readonly directive: string; readonly element?: never; readonly tag?: never }
|
|
83
|
+
/** The files whose comments before the first statement carry a JSDoc tag, such as `'@side-effect-free'`. */
|
|
84
|
+
| { readonly tag: `@${string}`; readonly element?: never; readonly directive?: never };
|
|
83
85
|
|
|
84
86
|
/** The selectors, by name. */
|
|
85
87
|
export type Selectors = Record<string, SelectorDefinition<string>>;
|
|
@@ -135,7 +137,8 @@ export interface CommonOptions {
|
|
|
135
137
|
/** Where to read more, shown with each violation. */
|
|
136
138
|
readonly link?: string;
|
|
137
139
|
/** Which imports the rule checks: all of them, those that stay at runtime, or type imports. */
|
|
138
|
-
|
|
140
|
+
/** `'static'` is the runtime imports other than `import()`: a transitive rule then stops at each `import()`. */
|
|
141
|
+
readonly imports?: 'all' | 'runtime' | 'static' | 'types';
|
|
139
142
|
/** Examples that the rule must accept and must reject, which `archangel test` checks. */
|
|
140
143
|
readonly examples?: Examples;
|
|
141
144
|
}
|
|
@@ -244,7 +247,7 @@ export type Sentence<E extends Elements, S extends Selectors> = Omit<CommonOptio
|
|
|
244
247
|
/** Files where a chain ends, such as `{ directive: 'use server' }`. */
|
|
245
248
|
readonly stopAt?: Files<E, S>;
|
|
246
249
|
/** A chain of type imports never runs, so a transitive rule checks no type imports. */
|
|
247
|
-
readonly imports?: 'all' | 'runtime';
|
|
250
|
+
readonly imports?: 'all' | 'runtime' | 'static';
|
|
248
251
|
})
|
|
249
252
|
| (Only<Side<E, S>, 'mayOnlyImport'> & ImportLimits & NoChains & Area<E, S> & Pick<CommonOptions, 'imports'>)
|
|
250
253
|
| (Only<Side<E, S>, 'mayOnlyBeImportedBy'> &
|
|
@@ -287,8 +290,8 @@ export type FolderSentence = Omit<CommonOptions, 'imports'> & Because & {
|
|
|
287
290
|
type InnerSentence<T> = T extends unknown ? Omit<T, 'name' | 'reason' | 'because' | 'link' | 'examples' | 'imports'> : never;
|
|
288
291
|
|
|
289
292
|
/** A shorthand as one sentence of a rule of several sentences. */
|
|
290
|
-
type InnerShorthand<E extends Elements> =
|
|
291
|
-
| { readonly kind: 'layers'; readonly order: readonly NoInfer<ElementName<E>>[] }
|
|
293
|
+
type InnerShorthand<E extends Elements, S extends Selectors> =
|
|
294
|
+
| { readonly kind: 'layers'; readonly order: readonly NoInfer<ElementName<E> | Extract<keyof S, string>>[] }
|
|
292
295
|
| { readonly kind: 'isolate'; readonly element: NoInfer<CapturedElement<E>> }
|
|
293
296
|
| { readonly kind: 'entry'; readonly element: NoInfer<ElementName<E>>; readonly files: readonly string[] };
|
|
294
297
|
|
|
@@ -299,7 +302,7 @@ export type SeveralSentences<E extends Elements, S extends Selectors> = Omit<Com
|
|
|
299
302
|
/** The rule's name, for exceptions and the baseline. */
|
|
300
303
|
readonly name: string;
|
|
301
304
|
/** The sentences, each about `files` or `folders` with one condition, or a shorthand. */
|
|
302
|
-
readonly sentences: readonly (InnerSentence<Sentence<E, S> | FolderSentence> | InnerShorthand<E>)[];
|
|
305
|
+
readonly sentences: readonly (InnerSentence<Sentence<E, S> | FolderSentence> | InnerShorthand<E, S>)[];
|
|
303
306
|
};
|
|
304
307
|
|
|
305
308
|
/** The plugins a config loads, by the name its rules use them by. */
|
|
@@ -404,7 +407,7 @@ type Body<T> = T extends unknown ? Omit<T, 'name'> & { readonly name?: never } :
|
|
|
404
407
|
|
|
405
408
|
/** A rule, as an object: one of the three shorthands, a table, a sentence, or a plugin rule. */
|
|
406
409
|
export type Rule<E extends Elements, S extends Selectors = {}, P extends Plugins = {}> =
|
|
407
|
-
| (RuleOptions & { readonly kind: 'layers'; readonly order: readonly NoInfer<ElementName<E>>[] })
|
|
410
|
+
| (RuleOptions & { readonly kind: 'layers'; readonly order: readonly NoInfer<ElementName<E> | Extract<keyof S, string>>[] })
|
|
408
411
|
| (RuleOptions & { readonly kind: 'isolate'; readonly element: NoInfer<CapturedElement<E>> })
|
|
409
412
|
| (RuleOptions & {
|
|
410
413
|
readonly kind: 'entry';
|
|
@@ -427,9 +430,9 @@ export interface RuleBuilders<
|
|
|
427
430
|
P extends Plugins = {},
|
|
428
431
|
X extends string = string,
|
|
429
432
|
> {
|
|
430
|
-
/** Each listed element may import only itself and later listed
|
|
433
|
+
/** Each listed element or group may import only itself and later listed ones. */
|
|
431
434
|
readonly layers: <const N extends string = string>(
|
|
432
|
-
order: readonly NoInfer<ElementName<E>>[],
|
|
435
|
+
order: readonly NoInfer<ElementName<E> | Extract<keyof S, string>>[],
|
|
433
436
|
options?: RuleOptions & Named<N, X>,
|
|
434
437
|
) => Rule<E, S, P>;
|
|
435
438
|
/** The instances of the element may not import each other. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enhance-eng/archangel",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Make architecture verifiable. Architecture tests for TypeScript, checked in milliseconds: imports, cycles, names, folder structure and exports.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"architecture",
|
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
"pluralize": "8.0.0"
|
|
54
54
|
},
|
|
55
55
|
"optionalDependencies": {
|
|
56
|
-
"@enhance-eng/archangel-darwin-arm64": "0.3.
|
|
57
|
-
"@enhance-eng/archangel-darwin-x64": "0.3.
|
|
58
|
-
"@enhance-eng/archangel-linux-arm64-gnu": "0.3.
|
|
59
|
-
"@enhance-eng/archangel-linux-arm64-musl": "0.3.
|
|
60
|
-
"@enhance-eng/archangel-linux-x64-gnu": "0.3.
|
|
61
|
-
"@enhance-eng/archangel-linux-x64-musl": "0.3.
|
|
62
|
-
"@enhance-eng/archangel-win32-x64": "0.3.
|
|
56
|
+
"@enhance-eng/archangel-darwin-arm64": "0.3.4",
|
|
57
|
+
"@enhance-eng/archangel-darwin-x64": "0.3.4",
|
|
58
|
+
"@enhance-eng/archangel-linux-arm64-gnu": "0.3.4",
|
|
59
|
+
"@enhance-eng/archangel-linux-arm64-musl": "0.3.4",
|
|
60
|
+
"@enhance-eng/archangel-linux-x64-gnu": "0.3.4",
|
|
61
|
+
"@enhance-eng/archangel-linux-x64-musl": "0.3.4",
|
|
62
|
+
"@enhance-eng/archangel-win32-x64": "0.3.4"
|
|
63
63
|
},
|
|
64
64
|
"tsd": {
|
|
65
65
|
"compilerOptions": {
|