oxlint-architecture-rules 0.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/LICENSE +21 -0
  2. package/build/dts/adapters/cli/main.d.ts +3 -0
  3. package/build/dts/adapters/cli/main.d.ts.map +1 -0
  4. package/build/dts/adapters/cli/run.d.ts +19 -0
  5. package/build/dts/adapters/cli/run.d.ts.map +1 -0
  6. package/build/dts/adapters/cli/source-facts.d.ts +9 -0
  7. package/build/dts/adapters/cli/source-facts.d.ts.map +1 -0
  8. package/build/dts/adapters/cli/source-files.d.ts +2 -0
  9. package/build/dts/adapters/cli/source-files.d.ts.map +1 -0
  10. package/build/dts/adapters/oxlint/config-loader.d.ts +23 -0
  11. package/build/dts/adapters/oxlint/config-loader.d.ts.map +1 -0
  12. package/build/dts/adapters/oxlint/exports-rule.d.ts +4 -0
  13. package/build/dts/adapters/oxlint/exports-rule.d.ts.map +1 -0
  14. package/build/dts/adapters/oxlint/imports-rule.d.ts +4 -0
  15. package/build/dts/adapters/oxlint/imports-rule.d.ts.map +1 -0
  16. package/build/dts/adapters/oxlint/members-rule.d.ts +4 -0
  17. package/build/dts/adapters/oxlint/members-rule.d.ts.map +1 -0
  18. package/build/dts/adapters/oxlint/oxlint-api.d.ts +19 -0
  19. package/build/dts/adapters/oxlint/oxlint-api.d.ts.map +1 -0
  20. package/build/dts/adapters/oxlint/plugin.d.ts +15 -0
  21. package/build/dts/adapters/oxlint/plugin.d.ts.map +1 -0
  22. package/build/dts/adapters/oxlint/structure-rule.d.ts +4 -0
  23. package/build/dts/adapters/oxlint/structure-rule.d.ts.map +1 -0
  24. package/build/dts/core/baseline.d.ts +16 -0
  25. package/build/dts/core/baseline.d.ts.map +1 -0
  26. package/build/dts/core/exports.d.ts +39 -0
  27. package/build/dts/core/exports.d.ts.map +1 -0
  28. package/build/dts/core/imports.d.ts +27 -0
  29. package/build/dts/core/imports.d.ts.map +1 -0
  30. package/build/dts/core/members.d.ts +28 -0
  31. package/build/dts/core/members.d.ts.map +1 -0
  32. package/build/dts/core/patterns.d.ts +19 -0
  33. package/build/dts/core/patterns.d.ts.map +1 -0
  34. package/build/dts/core/structure.d.ts +48 -0
  35. package/build/dts/core/structure.d.ts.map +1 -0
  36. package/build/dts/domain/architecture-config.d.ts +177 -0
  37. package/build/dts/domain/architecture-config.d.ts.map +1 -0
  38. package/build/dts/domain/architecture-error.d.ts +27 -0
  39. package/build/dts/domain/architecture-error.d.ts.map +1 -0
  40. package/build/dts/domain/violation.d.ts +11 -0
  41. package/build/dts/domain/violation.d.ts.map +1 -0
  42. package/build/dts/index.d.ts +10 -0
  43. package/build/dts/index.d.ts.map +1 -0
  44. package/build/dts/infrastructure/file-system-fake.d.ts +3 -0
  45. package/build/dts/infrastructure/file-system-fake.d.ts.map +1 -0
  46. package/build/dts/infrastructure/file-system-live.d.ts +3 -0
  47. package/build/dts/infrastructure/file-system-live.d.ts.map +1 -0
  48. package/build/dts/infrastructure/module-resolver-fake.d.ts +3 -0
  49. package/build/dts/infrastructure/module-resolver-fake.d.ts.map +1 -0
  50. package/build/dts/infrastructure/module-resolver-live.d.ts +4 -0
  51. package/build/dts/infrastructure/module-resolver-live.d.ts.map +1 -0
  52. package/build/dts/manifest/compile.d.ts +16 -0
  53. package/build/dts/manifest/compile.d.ts.map +1 -0
  54. package/build/dts/manifest/glob.d.ts +14 -0
  55. package/build/dts/manifest/glob.d.ts.map +1 -0
  56. package/build/dts/manifest/manifest.d.ts +96 -0
  57. package/build/dts/manifest/manifest.d.ts.map +1 -0
  58. package/build/dts/ports/file-system.d.ts +4 -0
  59. package/build/dts/ports/file-system.d.ts.map +1 -0
  60. package/build/dts/ports/module-resolver.d.ts +11 -0
  61. package/build/dts/ports/module-resolver.d.ts.map +1 -0
  62. package/build/esm/adapters/cli/main.js +17 -0
  63. package/build/esm/adapters/cli/main.js.map +1 -0
  64. package/build/esm/adapters/cli/run.js +188 -0
  65. package/build/esm/adapters/cli/run.js.map +1 -0
  66. package/build/esm/adapters/cli/source-facts.js +117 -0
  67. package/build/esm/adapters/cli/source-facts.js.map +1 -0
  68. package/build/esm/adapters/cli/source-files.js +40 -0
  69. package/build/esm/adapters/cli/source-files.js.map +1 -0
  70. package/build/esm/adapters/oxlint/config-loader.js +81 -0
  71. package/build/esm/adapters/oxlint/config-loader.js.map +1 -0
  72. package/build/esm/adapters/oxlint/exports-rule.js +104 -0
  73. package/build/esm/adapters/oxlint/exports-rule.js.map +1 -0
  74. package/build/esm/adapters/oxlint/imports-rule.js +55 -0
  75. package/build/esm/adapters/oxlint/imports-rule.js.map +1 -0
  76. package/build/esm/adapters/oxlint/members-rule.js +75 -0
  77. package/build/esm/adapters/oxlint/members-rule.js.map +1 -0
  78. package/build/esm/adapters/oxlint/oxlint-api.js +7 -0
  79. package/build/esm/adapters/oxlint/oxlint-api.js.map +1 -0
  80. package/build/esm/adapters/oxlint/plugin.js +23 -0
  81. package/build/esm/adapters/oxlint/plugin.js.map +1 -0
  82. package/build/esm/adapters/oxlint/structure-rule.js +37 -0
  83. package/build/esm/adapters/oxlint/structure-rule.js.map +1 -0
  84. package/build/esm/core/baseline.js +30 -0
  85. package/build/esm/core/baseline.js.map +1 -0
  86. package/build/esm/core/exports.js +96 -0
  87. package/build/esm/core/exports.js.map +1 -0
  88. package/build/esm/core/imports.js +85 -0
  89. package/build/esm/core/imports.js.map +1 -0
  90. package/build/esm/core/members.js +84 -0
  91. package/build/esm/core/members.js.map +1 -0
  92. package/build/esm/core/patterns.js +78 -0
  93. package/build/esm/core/patterns.js.map +1 -0
  94. package/build/esm/core/structure.js +256 -0
  95. package/build/esm/core/structure.js.map +1 -0
  96. package/build/esm/domain/architecture-config.js +172 -0
  97. package/build/esm/domain/architecture-config.js.map +1 -0
  98. package/build/esm/domain/architecture-error.js +29 -0
  99. package/build/esm/domain/architecture-error.js.map +1 -0
  100. package/build/esm/domain/violation.js +8 -0
  101. package/build/esm/domain/violation.js.map +1 -0
  102. package/build/esm/index.js +8 -0
  103. package/build/esm/index.js.map +1 -0
  104. package/build/esm/infrastructure/file-system-fake.js +5 -0
  105. package/build/esm/infrastructure/file-system-fake.js.map +1 -0
  106. package/build/esm/infrastructure/file-system-live.js +19 -0
  107. package/build/esm/infrastructure/file-system-live.js.map +1 -0
  108. package/build/esm/infrastructure/module-resolver-fake.js +23 -0
  109. package/build/esm/infrastructure/module-resolver-fake.js.map +1 -0
  110. package/build/esm/infrastructure/module-resolver-live.js +71 -0
  111. package/build/esm/infrastructure/module-resolver-live.js.map +1 -0
  112. package/build/esm/manifest/compile.js +503 -0
  113. package/build/esm/manifest/compile.js.map +1 -0
  114. package/build/esm/manifest/glob.js +77 -0
  115. package/build/esm/manifest/glob.js.map +1 -0
  116. package/build/esm/manifest/manifest.js +120 -0
  117. package/build/esm/manifest/manifest.js.map +1 -0
  118. package/build/esm/ports/file-system.js +2 -0
  119. package/build/esm/ports/file-system.js.map +1 -0
  120. package/build/esm/ports/module-resolver.js +2 -0
  121. package/build/esm/ports/module-resolver.js.map +1 -0
  122. package/package.json +73 -0
  123. package/src/adapters/cli/main.ts +20 -0
  124. package/src/adapters/cli/run.ts +270 -0
  125. package/src/adapters/cli/source-facts.ts +137 -0
  126. package/src/adapters/cli/source-files.ts +42 -0
  127. package/src/adapters/oxlint/config-loader.ts +136 -0
  128. package/src/adapters/oxlint/exports-rule.ts +144 -0
  129. package/src/adapters/oxlint/imports-rule.ts +67 -0
  130. package/src/adapters/oxlint/members-rule.ts +114 -0
  131. package/src/adapters/oxlint/oxlint-api.ts +25 -0
  132. package/src/adapters/oxlint/plugin.ts +35 -0
  133. package/src/adapters/oxlint/structure-rule.ts +39 -0
  134. package/src/core/baseline.ts +62 -0
  135. package/src/core/exports.ts +164 -0
  136. package/src/core/imports.ts +138 -0
  137. package/src/core/members.ts +131 -0
  138. package/src/core/patterns.ts +122 -0
  139. package/src/core/structure.ts +348 -0
  140. package/src/domain/architecture-config.ts +206 -0
  141. package/src/domain/architecture-error.ts +43 -0
  142. package/src/domain/violation.ts +24 -0
  143. package/src/index.ts +28 -0
  144. package/src/infrastructure/file-system-fake.ts +6 -0
  145. package/src/infrastructure/file-system-live.ts +20 -0
  146. package/src/infrastructure/module-resolver-fake.ts +29 -0
  147. package/src/infrastructure/module-resolver-live.ts +100 -0
  148. package/src/manifest/compile.ts +736 -0
  149. package/src/manifest/glob.ts +108 -0
  150. package/src/manifest/manifest.ts +178 -0
  151. package/src/ports/file-system.ts +5 -0
  152. package/src/ports/module-resolver.ts +23 -0
@@ -0,0 +1,503 @@
1
+ import { anchored, globToRegexSource, prefixed } from "./glob.js";
2
+ import { globsOf, } from "./manifest.js";
3
+ const FOLDER_KEY = /\/$/;
4
+ // The marker an open folder's allowlist carries: it admits any name, so it has
5
+ // no layout policy to prove.
6
+ export const ANY_FILE = "^.*$";
7
+ // The `from` side of a rule that applies to every file, wherever the repository
8
+ // happens to keep its packages.
9
+ const EVERY_FILE = "";
10
+ // A key may name several patterns that share one node: the four `*-ops.ts`
11
+ // stereotypes carry identical policy, and saying it once is the point of writing
12
+ // the architecture as a tree.
13
+ const ALTERNATIVE = /\s*\|\s*/;
14
+ const isFolderKey = (key) => FOLDER_KEY.test(key);
15
+ const stripSlash = (key) => key.replace(FOLDER_KEY, "");
16
+ // Split first, then strip: `"http/ | cli/"` carries a trailing slash on every
17
+ // alternative, not only the last one.
18
+ const alternativesOf = (key) => key
19
+ .split(ALTERNATIVE)
20
+ .map(stripSlash)
21
+ .filter((one) => one !== "");
22
+ const expandAliases = (glob, aliases) => {
23
+ for (const [alias, target] of Object.entries(aliases)) {
24
+ if (glob === alias)
25
+ return target;
26
+ if (glob.startsWith(`${alias}/`))
27
+ return target + glob.slice(alias.length);
28
+ }
29
+ return glob;
30
+ };
31
+ // A probe is the node's own path with its wildcards filled in, so a rule is
32
+ // proven against the shape it was written for and nobody hand-writes one.
33
+ const PROBE_WORDS = ["alpha", "beta", "gamma", "delta"];
34
+ const probePathOf = (pathGlob, leaf) => {
35
+ let word = 0;
36
+ const filled = pathGlob
37
+ .replace(/\{[a-zA-Z][a-zA-Z0-9]*\}/g, () => {
38
+ const value = PROBE_WORDS[word % PROBE_WORDS.length] ?? "alpha";
39
+ word += 1;
40
+ return value;
41
+ })
42
+ .replace(/\*\*/g, "deep")
43
+ .replace(/\*/g, "zz");
44
+ if (leaf === "")
45
+ return filled;
46
+ return filled === "" ? leaf : `${filled}/${leaf}`;
47
+ };
48
+ // The probe name must satisfy the rule's own `match`, or the rule cannot report
49
+ // it and the vacuity check fires on a healthy rule.
50
+ const probeMemberName = (match) => {
51
+ if (match === undefined)
52
+ return "zzProbeMember";
53
+ const first = globsOf(match)[0] ?? "";
54
+ return `${first
55
+ // A character class stands for one character, so the probe uses the first
56
+ // one it admits: `use[A-Z]*` has to be proven with `useA…`, not `use[A-Z]…`.
57
+ .replace(/\[\^?([^\]])[^\]]*\]/g, "$1")
58
+ .replace(/\*/g, "")}ZzProbe`;
59
+ };
60
+ // Each convention pairs the shape a name must have with a name that does not
61
+ // have it, so the rule's probe is generated rather than written.
62
+ const CONVENTIONS = {
63
+ "kebab-case": {
64
+ source: "^[a-z0-9]+(?:-[a-z0-9]+)*$",
65
+ violating: "zzProbeStray",
66
+ shape: "lowercase words joined by hyphens",
67
+ },
68
+ camelCase: {
69
+ source: "^[a-z][a-zA-Z0-9]*$",
70
+ violating: "zz-probe-stray",
71
+ shape: "a lowercase first word, then capitalised ones, with no separators",
72
+ },
73
+ PascalCase: {
74
+ source: "^[A-Z][a-zA-Z0-9]*$",
75
+ violating: "zz-probe-stray",
76
+ shape: "capitalised words with no separators",
77
+ },
78
+ snake_case: {
79
+ source: "^[a-z0-9]+(?:_[a-z0-9]+)*$",
80
+ violating: "zzProbeStray",
81
+ shape: "lowercase words joined by underscores",
82
+ },
83
+ };
84
+ // The folder's file list already enforces the stereotype suffix; a naming rule
85
+ // is about the concept name in front of it, so the message says which part it
86
+ // is talking about.
87
+ const namingMessageOf = (spec, subject) => {
88
+ const what = subject === "folder" ? "This folder's name" : "The concept name in front of the stereotype";
89
+ if (typeof spec === "string") {
90
+ return `${what} is ${spec} here — ${CONVENTIONS[spec]?.shape ?? ""}.`;
91
+ }
92
+ if (spec.message !== undefined)
93
+ return spec.message;
94
+ if ("like" in spec) {
95
+ return "A file here is named after its folder, so its concept name is the folder's own.";
96
+ }
97
+ return `${what} matches /${spec.regex}/ here.`;
98
+ };
99
+ // A custom convention still owes a counter-example. If none of these fails it,
100
+ // the pattern admits every name and the rule could never report anything —
101
+ // which is the vacuity this package refuses to load.
102
+ const VIOLATING_CANDIDATES = ["zzProbeStray", "zz-probe-stray", "ZZ_PROBE_STRAY", "zz probe.stray"];
103
+ const violatingSampleFor = (spec, ruleName) => {
104
+ if (typeof spec === "string") {
105
+ const convention = CONVENTIONS[spec];
106
+ if (convention === undefined)
107
+ throw new Error(`unknown naming convention "${spec}"`);
108
+ return convention.violating;
109
+ }
110
+ if ("like" in spec)
111
+ return "zzprobestray";
112
+ const matcher = new RegExp(spec.regex);
113
+ const found = VIOLATING_CANDIDATES.find((candidate) => !matcher.test(candidate));
114
+ if (found === undefined) {
115
+ throw new Error(`naming rule "${ruleName}" states /${spec.regex}/, which admits every name this ` +
116
+ `compiler can think of. A convention nothing can violate is a rule that never reports.`);
117
+ }
118
+ return found;
119
+ };
120
+ // The probe is the node's own probe path with the subject replaced by a name the
121
+ // convention rejects — located by matching, so the compiler never has to reason
122
+ // about which segment of a glob the subject came from.
123
+ const namingProbeOf = (patternSource, subject, probe, violating) => {
124
+ const found = new RegExp(patternSource, "d").exec(probe);
125
+ const span = found?.indices?.[subject];
126
+ if (span === undefined)
127
+ return probe;
128
+ return probe.slice(0, span[0]) + violating + probe.slice(span[1]);
129
+ };
130
+ const mergeImports = (frame, spec, aliases, captures, nextGroup) => {
131
+ if (spec === undefined)
132
+ return { allow: frame.allow, deny: [], importsMessage: frame.importsMessage };
133
+ const compileAllow = (glob) => prefixed(globToRegexSource(expandAliases(glob, aliases), captures, { declaring: false, nextGroup })
134
+ .source);
135
+ const own = globsOf(spec.allow ?? []).map(compileAllow);
136
+ const external = (spec.external ?? []).map((name) => `/node_modules/${name.replace(/[.+^$()|[\]\\]/g, "\\$&")}/`);
137
+ const deny = (spec.deny ?? []).flatMap((entry) => globsOf(entry.match).map((glob) => ({
138
+ match: compileAllow(glob),
139
+ matchNot: globsOf(entry.matchNot ?? []).map(compileAllow),
140
+ except: globsOf(entry.except ?? []).map(compileAllow),
141
+ message: entry.message,
142
+ probe: probePathOf(expandAliases(glob, aliases), ""),
143
+ })));
144
+ // `reset` drops inherited ALLOWANCES only. A prohibition always accumulates, so
145
+ // resetting can never make a subtree quieter than its ancestors — the direction
146
+ // a mistake here would be dangerous in.
147
+ const dropping = spec.reset === true || spec.unrestricted === true;
148
+ return {
149
+ allow: dropping ? [...own, ...external] : [...frame.allow, ...own, ...external],
150
+ // Only what this node declares. A prohibition is emitted once, over its whole
151
+ // subtree, so descendants neither re-emit it nor can escape it — which is
152
+ // what makes `reset` structurally unable to make a subtree quieter.
153
+ deny,
154
+ importsMessage: spec.message ?? frame.importsMessage,
155
+ };
156
+ };
157
+ export const lowerManifest = (manifest) => {
158
+ const aliases = manifest.aliases ?? {};
159
+ const imports = [];
160
+ const exports = [];
161
+ const members = [];
162
+ const roots = [];
163
+ const folders = [];
164
+ const parity = [];
165
+ const namingRules = [];
166
+ const walk = (key, node, parent, name, siblings) => {
167
+ const literalSiblings = siblings
168
+ .filter((sibling) => sibling !== key)
169
+ .flatMap(alternativesOf)
170
+ .filter((sibling) => !/[*{]/.test(sibling));
171
+ const alternatives = alternativesOf(key).map((one) => expandAliases(one, aliases));
172
+ const [first = ""] = alternatives;
173
+ if (alternatives.length > 1 && alternatives.some((one) => one.includes("{"))) {
174
+ throw new Error(`key "${key}" both names several patterns and declares a capture. A capture has to come ` +
175
+ `from one place, so give the capturing pattern its own key.`);
176
+ }
177
+ // The probe, the path and every descendant hang off the first alternative;
178
+ // the rest only widen what the pattern matches.
179
+ const joinedGlob = parent.pathGlob === "" ? first : `${parent.pathGlob}/${first}`;
180
+ const compiledFirst = globToRegexSource(first, parent.captures, {
181
+ declaring: true,
182
+ nextGroup: parent.nextGroup,
183
+ });
184
+ const compiled = alternatives.length === 1
185
+ ? compiledFirst
186
+ : {
187
+ captures: compiledFirst.captures,
188
+ source: `(?:${alternatives
189
+ .map((one) => globToRegexSource(one, parent.captures, {
190
+ declaring: false,
191
+ nextGroup: parent.nextGroup,
192
+ }).source)
193
+ .join("|")})`,
194
+ };
195
+ // `(?!domain-services$|ports$)` — written by the compiler, from the fact that
196
+ // those keys are siblings of this one.
197
+ const guarded = literalSiblings.length > 0 && /[*{]/.test(first)
198
+ ? `(?!(?:${literalSiblings.map((one) => one.replace(/[.+^$()|[\]\\*?{}]/g, "\\$&")).join("|")})(?:/|$))${compiled.source}`
199
+ : compiled.source;
200
+ const pathSource = parent.pathSource === "" ? guarded : `${parent.pathSource}/${guarded}`;
201
+ const nextGroup = parent.nextGroup +
202
+ (Object.keys(compiled.captures).length - Object.keys(parent.captures).length);
203
+ const merged = mergeImports(parent, node.imports, aliases, compiled.captures, nextGroup);
204
+ const ownDenials = merged.deny;
205
+ const frame = {
206
+ pathSource,
207
+ pathGlob: joinedGlob,
208
+ captures: compiled.captures,
209
+ nextGroup,
210
+ allow: merged.allow,
211
+ importsMessage: merged.importsMessage,
212
+ naming: node.name ?? parent.naming,
213
+ };
214
+ const isFolder = isFolderKey(key) || node.children !== undefined;
215
+ const selfPattern = anchored(pathSource);
216
+ // Naming, in two shapes. A folder judges its own segment (when its key
217
+ // declares a capture) and the concept name of every file directly inside
218
+ // it; a file node judges what its own `*` matched, which is where "named
219
+ // after its folder" lives.
220
+ //
221
+ // A file's concept name is its basename up to the FIRST dot, not what a `*`
222
+ // matched: the key `*-live.ts` matches `todos.repository-live.ts`, whose
223
+ // wildcard spans a stereotype segment as well as the concept.
224
+ const naming = frame.naming;
225
+ if (naming !== undefined) {
226
+ const declaredHere = Object.keys(compiled.captures).filter((one) => parent.captures[one] === undefined);
227
+ const lastDeclared = declaredHere[declaredHere.length - 1];
228
+ const isLike = typeof naming === "object" && "like" in naming;
229
+ const emit = (ruleName, patterns, subject, probe, sameAs, judging = "file") => {
230
+ namingRules.push({
231
+ name: ruleName,
232
+ message: namingMessageOf(naming, judging),
233
+ probe: {
234
+ path: sameAs === undefined
235
+ ? namingProbeOf(patterns[0] ?? "", subject, probe, violatingSampleFor(naming, ruleName))
236
+ : probe,
237
+ },
238
+ file: patterns,
239
+ subject,
240
+ ...(sameAs === undefined
241
+ ? {
242
+ convention: typeof naming === "string"
243
+ ? (CONVENTIONS[naming]?.source ?? "")
244
+ : "regex" in naming
245
+ ? naming.regex
246
+ : "",
247
+ }
248
+ : { sameAs }),
249
+ });
250
+ };
251
+ if (isFolder && !isLike) {
252
+ if (lastDeclared !== undefined) {
253
+ const subject = compiled.captures[lastDeclared];
254
+ if (subject !== undefined) {
255
+ emit(`${name}/naming-folder`, [prefixed(`${pathSource}/`)], subject, probePathOf(joinedGlob, "zzprobe.ts"), undefined, "folder");
256
+ }
257
+ }
258
+ emit(`${name}/naming`, [anchored(`${pathSource}/([^/.]+)[^/]*`)], nextGroup, probePathOf(joinedGlob, "zzprobe.ts"));
259
+ }
260
+ if (!isFolder && isLike) {
261
+ const namingCompiled = alternatives.map((one) => globToRegexSource(one, parent.captures, {
262
+ declaring: true,
263
+ nextGroup: parent.nextGroup,
264
+ capturing: true,
265
+ }));
266
+ const [firstNaming] = namingCompiled;
267
+ const subject = firstNaming?.wildcards[firstNaming.wildcards.length - 1];
268
+ const sameAs = typeof naming === "object" && "like" in naming
269
+ ? parent.captures[naming.like.replace(/[{}]/g, "")]
270
+ : undefined;
271
+ if (typeof naming === "object" && "like" in naming && sameAs === undefined) {
272
+ throw new Error(`naming at "${key}" is like ${naming.like}, which no ancestor path declares.`);
273
+ }
274
+ if (subject !== undefined && sameAs !== undefined) {
275
+ emit(`${name}/naming`, namingCompiled.map((one) => anchored(parent.pathSource === "" ? one.source : `${parent.pathSource}/${one.source}`)), subject, probePathOf(joinedGlob, ""), sameAs);
276
+ }
277
+ }
278
+ }
279
+ const childEntries = Object.entries(node.children ?? {});
280
+ // The nearest descendants — at any depth — that state their own import
281
+ // policy. A folder's allowlist covers its whole subtree except these, and
282
+ // each of them emits a rule over its own subtree in turn. Descent stops at a
283
+ // node that overrides, because everything below it is that node's business.
284
+ const overridingDescendants = (from, atPath, atCaptures, atGroup) => Object.entries(from.children ?? {}).flatMap(([childKey, child]) => alternativesOf(childKey).flatMap((one) => {
285
+ // `declaring` because a folder key may itself name a capture
286
+ // (`{subdomain}/`). The extra group is harmless in an exclusion, which
287
+ // is matched on its own rather than substituted into.
288
+ const childCompiled = globToRegexSource(one, atCaptures, {
289
+ declaring: true,
290
+ nextGroup: atGroup,
291
+ });
292
+ const source = `${atPath}/${childCompiled.source}`;
293
+ const childGroup = atGroup + (Object.keys(childCompiled.captures).length - Object.keys(atCaptures).length);
294
+ if (child.imports !== undefined) {
295
+ return [isFolderKey(childKey) ? prefixed(`${source}/`) : anchored(source)];
296
+ }
297
+ return isFolderKey(childKey)
298
+ ? overridingDescendants(child, source, childCompiled.captures, childGroup)
299
+ : [];
300
+ }));
301
+ const overridingChildren = overridingDescendants(node, pathSource, compiled.captures, nextGroup);
302
+ if (isFolder) {
303
+ const childKeys = childEntries;
304
+ const fileKeys = childKeys.filter(([childKey]) => !isFolderKey(childKey));
305
+ if (node.partial !== true)
306
+ folders.push({
307
+ name: `${name}/layout`,
308
+ message: node.message ?? "This folder does not admit that file.",
309
+ probe: { path: probePathOf(joinedGlob, "zzprobe-stray.ts") },
310
+ folder: selfPattern,
311
+ // An open folder still CLAIMS its folder — otherwise no rule governs
312
+ // it and the taxonomy root fires — it just admits any file name.
313
+ files: node.layout === "open"
314
+ ? [ANY_FILE]
315
+ : fileKeys.flatMap(([childKey]) => alternativesOf(childKey).map((one) => anchored(globToRegexSource(one, compiled.captures, { declaring: false, nextGroup })
316
+ .source))),
317
+ });
318
+ const siblingKeys = childKeys.map(([childKey]) => childKey);
319
+ for (const [childKey, child] of childKeys) {
320
+ walk(childKey, child, frame, `${name}/${alternativesOf(childKey)[0] ?? ""}`, siblingKeys);
321
+ }
322
+ }
323
+ // Outbound. One allowlist stands in for every "may not reach X" rule that
324
+ // would otherwise be written separately and far from here.
325
+ //
326
+ // Import policy belongs to a folder, so it lowers once per folder — matching
327
+ // that folder's direct children — rather than once per file kind inside it.
328
+ // A file node emits its own only when it says something its folder did not.
329
+ const emitsOwnImports = isFolder ? node.imports !== undefined : node.imports !== undefined;
330
+ const scope = isFolder ? prefixed(`${pathSource}/`) : selfPattern;
331
+ const scopeProbe = isFolder
332
+ ? probePathOf(joinedGlob, "zzprobe.ts")
333
+ : probePathOf(joinedGlob, "");
334
+ const admitsEverything = frame.allow.some((pattern) => pattern === "^.*" || pattern === "^");
335
+ const hasAllowlist = frame.allow.length > 0 && !admitsEverything;
336
+ if (emitsOwnImports && node.imports?.unrestricted !== true && !hasAllowlist) {
337
+ throw new Error(`"${name}" states an \`imports\` policy with no allowlist. If that is deliberate — the ` +
338
+ `tier is not tightened yet and only its prohibitions apply — say \`unrestricted: true\`, ` +
339
+ `so the gap is a sentence someone wrote rather than an omission nobody noticed.`);
340
+ }
341
+ if (emitsOwnImports) {
342
+ const exemptions = overridingChildren.length > 0 ? { fromNot: overridingChildren } : {};
343
+ if (hasAllowlist) {
344
+ imports.push({
345
+ name: `${name}/imports`,
346
+ message: frame.importsMessage,
347
+ probe: { from: scopeProbe, to: "packages/zzprobe/nowhere.ts" },
348
+ from: scope,
349
+ ...exemptions,
350
+ toNot: [...frame.allow],
351
+ });
352
+ }
353
+ }
354
+ // Prohibitions are emitted once, over this node's whole subtree, and carry no
355
+ // exemptions: a node cannot opt out of an ancestor's prohibition.
356
+ for (const [index, denial] of ownDenials.entries()) {
357
+ imports.push({
358
+ name: `${name}/deny-${String(index)}`,
359
+ message: denial.message,
360
+ probe: { from: probePathOf(joinedGlob, isFolder ? "zzprobe.ts" : ""), to: denial.probe },
361
+ from: isFolder ? prefixed(`${pathSource}/`) : selfPattern,
362
+ ...(denial.except.length > 0 ? { fromNot: [...denial.except] } : {}),
363
+ to: denial.match,
364
+ ...(denial.matchNot.length > 0 ? { toNot: [...denial.matchNot] } : {}),
365
+ });
366
+ }
367
+ // Inbound. "This file is private to X" belongs beside the file, not in a
368
+ // distant rule whose `from` side grows an exclusion for every new caller.
369
+ if (node.importedBy !== undefined) {
370
+ // An `importedBy` allowlist is matched against the IMPORTER, while the
371
+ // captures on this node were declared by the TARGET's path — so a
372
+ // `{capture}` here has nothing to resolve against and would compile to a
373
+ // pattern that never matches, silently over-reporting. Refuse it rather
374
+ // than emit a rule whose exemptions do not work.
375
+ for (const allowed of globsOf(node.importedBy.allow)) {
376
+ const referenced = allowed.match(/\{[a-zA-Z][a-zA-Z0-9]*\}/g) ?? [];
377
+ if (referenced.length > 0) {
378
+ throw new Error(`"${name}" allows ${referenced.join(", ")} in importedBy, but a capture from this ` +
379
+ `node's own path cannot be used there: importedBy patterns are matched against the ` +
380
+ `importing file, and ${referenced[0] ?? ""} was declared by this file's path. Use a ` +
381
+ `wildcard (the barrel rules are what stop another module reaching in), or move the ` +
382
+ `restriction to that importer's own node as an \`imports\` allowlist.`);
383
+ }
384
+ }
385
+ const asTarget = (glob) => prefixed(globToRegexSource(expandAliases(glob, aliases), compiled.captures, {
386
+ declaring: false,
387
+ nextGroup,
388
+ }).source);
389
+ // On a folder the restriction covers the whole subtree — "a module is
390
+ // private" is a statement about everything under it, not about the folder
391
+ // node itself.
392
+ const exempt = globsOf(node.importedBy.matchNot ?? []).map((glob) => anchored(`${pathSource}/${globToRegexSource(glob, compiled.captures, { declaring: false, nextGroup }).source}`));
393
+ imports.push({
394
+ name: `${name}/imported-by`,
395
+ message: node.importedBy.message,
396
+ probe: {
397
+ from: "packages/zzprobe/outsider.ts",
398
+ to: probePathOf(joinedGlob, isFolder ? "zzprobe.ts" : ""),
399
+ },
400
+ from: EVERY_FILE,
401
+ fromNot: globsOf(node.importedBy.allow).map(asTarget),
402
+ to: isFolder ? prefixed(`${pathSource}/`) : selfPattern,
403
+ ...(exempt.length > 0 ? { toNot: exempt } : {}),
404
+ });
405
+ }
406
+ for (const [index, spec] of (node.members ?? []).entries()) {
407
+ const asRegex = (globs) => globsOf(globs).map((one) => anchored(globToRegexSource(one, compiled.captures, { declaring: false, nextGroup }).source));
408
+ members.push({
409
+ name: `${name}/members-${String(index)}`,
410
+ message: spec.message,
411
+ probe: {
412
+ from: probePathOf(joinedGlob, ""),
413
+ name: probeMemberName(spec.match),
414
+ ...(spec.in === undefined ? {} : { in: "ZzProbeRepositoryShape" }),
415
+ },
416
+ from: selfPattern,
417
+ subject: spec.subject,
418
+ ...(spec.in === undefined ? {} : { in: asRegex(spec.in) }),
419
+ ...(spec.match === undefined ? {} : { match: asRegex(spec.match) }),
420
+ ...(spec.matchNot === undefined ? {} : { matchNot: asRegex(spec.matchNot) }),
421
+ ...(spec.allow === undefined ? {} : { allow: asRegex(spec.allow) }),
422
+ });
423
+ }
424
+ if (node.requires !== undefined && node.requires.length > 0) {
425
+ const exempt = (node.requiresNot ?? []).map((basename) => `/${globToRegexSource(basename, compiled.captures, { declaring: false, nextGroup }).source}$`);
426
+ parity.push({
427
+ name: `${name}/requires`,
428
+ message: node.message ?? "This file needs its sibling.",
429
+ probe: { path: probePathOf(joinedGlob, "") },
430
+ file: selfPattern,
431
+ ...(exempt.length > 0 ? { fileNot: exempt } : {}),
432
+ requires: [...node.requires],
433
+ });
434
+ }
435
+ };
436
+ const emptyFrame = {
437
+ pathSource: "",
438
+ pathGlob: "",
439
+ captures: {},
440
+ nextGroup: 1,
441
+ allow: [],
442
+ importsMessage: "This import is not on this folder's allowlist.",
443
+ naming: undefined,
444
+ };
445
+ // Repo-wide prohibitions: `from` is every file, so no tier can be written
446
+ // that escapes them.
447
+ const globalFrame = { ...emptyFrame };
448
+ for (const [index, denial] of mergeImports(globalFrame, { unrestricted: true, deny: manifest.deny ?? [] }, aliases, {}, 1).deny.entries()) {
449
+ imports.push({
450
+ name: `repo/deny-${String(index)}`,
451
+ message: denial.message,
452
+ probe: { from: "packages/zzprobe/anywhere.ts", to: denial.probe },
453
+ from: EVERY_FILE,
454
+ ...(denial.except.length > 0 ? { fromNot: [...denial.except] } : {}),
455
+ to: denial.match,
456
+ ...(denial.matchNot.length > 0 ? { toNot: [...denial.matchNot] } : {}),
457
+ });
458
+ }
459
+ for (const [key, node] of Object.entries(manifest.tree)) {
460
+ // A taxonomy root is a region whose folders are enumerated. A key naming a
461
+ // single file has no folders to deny, and an open tree governs every folder
462
+ // it contains — neither has anything for a root to catch.
463
+ if ((isFolderKey(key) || node.children !== undefined) && node.layout !== "open")
464
+ roots.push({
465
+ name: `${stripSlash(key)}/taxonomy`,
466
+ message: node.message ??
467
+ "This folder is not part of the taxonomy. Declare it in the manifest deliberately, or move the file into the folder that owns it.",
468
+ probe: { path: probePathOf(expandAliases(stripSlash(key), aliases), "zzprobe/stray.ts") },
469
+ path: prefixed(globToRegexSource(expandAliases(stripSlash(key), aliases), {}, {
470
+ declaring: true,
471
+ nextGroup: 1,
472
+ }).source),
473
+ });
474
+ walk(key, node, emptyFrame, stripSlash(key)
475
+ .replace(/[^a-zA-Z0-9]+/g, "-")
476
+ .replace(/^-|-$/g, ""), Object.keys(manifest.tree));
477
+ }
478
+ for (const rule of manifest.exports ?? []) {
479
+ const asPattern = (glob) => prefixed(globToRegexSource(expandAliases(glob, aliases), {}, { declaring: false, nextGroup: 1 })
480
+ .source);
481
+ exports.push({
482
+ name: rule.name,
483
+ message: rule.message,
484
+ probe: {
485
+ from: "packages/zzprobe/anywhere.ts",
486
+ to: probePathOf(expandAliases(globsOf(rule.module)[0] ?? "", aliases), ""),
487
+ symbol: rule.symbols?.[0] ?? "zzProbeSymbol",
488
+ },
489
+ from: EVERY_FILE,
490
+ ...(rule.except === undefined ? {} : { fromNot: globsOf(rule.except).map(asPattern) }),
491
+ to: globsOf(rule.module).map(asPattern),
492
+ ...(rule.symbols === undefined ? {} : { symbols: [...rule.symbols] }),
493
+ ...(rule.fix === undefined ? {} : { fix: rule.fix }),
494
+ });
495
+ }
496
+ return {
497
+ imports,
498
+ exports,
499
+ members,
500
+ structure: { roots, folders, parity, naming: namingRules },
501
+ };
502
+ };
503
+ //# sourceMappingURL=compile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../src/manifest/compile.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAqB,iBAAiB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,EACL,OAAO,GAKR,MAAM,eAAe,CAAC;AAiBvB,MAAM,UAAU,GAAG,KAAK,CAAC;AAEzB,+EAA+E;AAC/E,6BAA6B;AAC7B,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE/B,gFAAgF;AAChF,gCAAgC;AAChC,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,2EAA2E;AAC3E,iFAAiF;AACjF,8BAA8B;AAC9B,MAAM,WAAW,GAAG,UAAU,CAAC;AAE/B,MAAM,WAAW,GAAG,CAAC,GAAW,EAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEnE,MAAM,UAAU,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAExE,8EAA8E;AAC9E,sCAAsC;AACtC,MAAM,cAAc,GAAG,CAAC,GAAW,EAAyB,EAAE,CAC5D,GAAG;KACA,KAAK,CAAC,WAAW,CAAC;KAClB,GAAG,CAAC,UAAU,CAAC;KACf,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;AAEjC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,OAAyC,EAAU,EAAE;IAC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SAAS,CAAC;YACvC,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACrE,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;SACrD,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,OAAO;QACP,OAAO;QACP,OAAO;QACP,SAAS,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE;KAC3D,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,77 @@
1
+ // The manifest is meant to read like a filesystem, so its patterns are globs
2
+ // rather than the regexes the rule IR speaks. This is the one translation.
3
+ //
4
+ // * one path segment, or part of one
5
+ // ** any number of segments
6
+ // /** "…or nothing" — `a/**` matches `a` itself as well as `a/b/c`
7
+ // {name} a named capture of one segment when it appears in a tree key;
8
+ // elsewhere, a back-reference to the ancestor that declared it
9
+ // [A-Z] a character class, passed through as written — the one place a
10
+ // pattern needs to say something about a single character
11
+ //
12
+ // Everything else is literal, including the dots that make up a stereotype.
13
+ const ESCAPE = /[.+^$()|[\]\\]/g;
14
+ // Split on the tokens first so `**` is not read as two `*`s, `{name}`'s braces
15
+ // are not escaped, and a character class keeps its brackets.
16
+ const TOKEN_SOURCE = "\\[\\^?[^\\]]+\\]|\\{[a-zA-Z][a-zA-Z0-9]*\\}|\\*\\*|\\*|\\?";
17
+ const escapeLiteral = (value) => value.replace(ESCAPE, "\\$&");
18
+ const TOKENS = new RegExp(`(${TOKEN_SOURCE})`, "g");
19
+ // `declaring` compiles `{name}` to a new capture group and records its position;
20
+ // otherwise `{name}` becomes a `$n` back-reference to the group an ancestor
21
+ // declared, which is what the rule IR substitutes at match time.
22
+ export const globToRegexSource = (glob, captures, options) => {
23
+ const declared = { ...captures };
24
+ const wildcards = [];
25
+ let group = options.nextGroup;
26
+ let out = "";
27
+ for (const part of glob.split(TOKENS)) {
28
+ if (part === "")
29
+ continue;
30
+ if (part === "**") {
31
+ out += ".*";
32
+ continue;
33
+ }
34
+ if (part === "*") {
35
+ if (options.capturing === true) {
36
+ wildcards.push(group);
37
+ out += "([^/]*)";
38
+ group += 1;
39
+ }
40
+ else
41
+ out += "[^/]*";
42
+ continue;
43
+ }
44
+ if (part === "?") {
45
+ out += "[^/]";
46
+ continue;
47
+ }
48
+ // A character class is the one construct that passes through as written.
49
+ if (part.startsWith("[") && part.endsWith("]")) {
50
+ out += part;
51
+ continue;
52
+ }
53
+ const capture = /^\{([a-zA-Z][a-zA-Z0-9]*)\}$/.exec(part);
54
+ if (capture !== null) {
55
+ const name = capture[1] ?? "";
56
+ if (options.declaring && declared[name] === undefined) {
57
+ declared[name] = group;
58
+ out += "([^/]+)";
59
+ group += 1;
60
+ }
61
+ else {
62
+ const index = declared[name];
63
+ if (index === undefined) {
64
+ throw new Error(`pattern "${glob}" references {${name}}, which no ancestor path declares`);
65
+ }
66
+ out += `$${String(index)}`;
67
+ }
68
+ continue;
69
+ }
70
+ out += escapeLiteral(part);
71
+ }
72
+ // `a/**` should match `a` itself, not just its descendants.
73
+ return { source: out.replace(/\/\.\*$/, "(/.*)?"), captures: declared, wildcards };
74
+ };
75
+ export const anchored = (source) => `^${source}$`;
76
+ export const prefixed = (source) => `^${source}`;
77
+ //# sourceMappingURL=glob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../src/manifest/glob.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,EAAE;AACF,gDAAgD;AAChD,sCAAsC;AACtC,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,8EAA8E;AAC9E,uEAAuE;AACvE,EAAE;AACF,4EAA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