@nielspeter/eess 0.5.1 → 0.6.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.
@@ -26,6 +26,25 @@ export interface PathUniverse {
26
26
  readonly tsconfigRelativeFilePaths: readonly string[];
27
27
  /** `parentDirs` relative to the tsconfig directory, for message wording. */
28
28
  readonly tsconfigRelativeParentDirs: readonly string[];
29
+ /**
30
+ * `filePaths` named from the **identity root** — the `.git`/workspace root
31
+ * above the tsconfig, as `discoverIdentityRoot` finds it.
32
+ *
33
+ * A third view, because the first two cannot express how a monorepo addresses
34
+ * its own packages. `'**\/apps/api/src/**'` names segments BETWEEN the
35
+ * repository root and the tsconfig directory: the absolute view carries the
36
+ * checkout's own path (and a dot-segment in it stops `**` dead), while the
37
+ * tsconfig-relative view has `apps/api/` stripped off the front — the very
38
+ * thing the glob names. [Bug 0348](../../../work/bugs/fixed/0348-a-glob-naming-segments-above-the-tsconfig-root-still-dies-under-a-dot-directory.md).
39
+ *
40
+ * Required rather than optional deliberately. An optional view is one a
41
+ * materializer can omit and still typecheck, and a missing view here makes a
42
+ * live glob look unsatisfiable — a dead-selector finding against a rule that
43
+ * works, which is ADR-009 rule 2's confidently-wrong cause.
44
+ */
45
+ readonly repoRelativeFilePaths: readonly string[];
46
+ /** `parentDirs` named from the identity root. See `repoRelativeFilePaths`. */
47
+ readonly repoRelativeParentDirs: readonly string[];
29
48
  }
30
49
  /**
31
50
  * The views a glob of this kind is matched against.
@@ -39,6 +58,39 @@ export interface PathUniverse {
39
58
  *
40
59
  * `import-target`, `specifier` and `literal` are not path kinds and have no
41
60
  * views, so they can never be found unsatisfiable here.
61
+ *
62
+ * ## Why the identity view is asked for and the others are not
63
+ *
64
+ * `readsRepoRelative` is the caller's answer to "does the MATCHER give this
65
+ * glob the identity-root view?" — the dialect owns that rule (ADR-013: the
66
+ * kernel takes the fact, not the policy), and it is required rather than
67
+ * defaulted because a caller that forgets would get the generous union.
68
+ *
69
+ * Generosity is safe for the tsconfig view and is not for this one, which is the
70
+ * whole reason for the asymmetry. The tsconfig view differs from the absolute
71
+ * path only by a prefix the matcher usually strips too. The identity view adds
72
+ * the segments BETWEEN the repository root and the package — so in a monorepo
73
+ * `'apps/identity/**'`, a project-relative glob that selects nothing because the
74
+ * project root is `apps/api`, matches `apps/identity/src/…` in this view and
75
+ * stops being reported dead. Measured while fixing bug 0348, before this
76
+ * parameter existed, with that glob selecting 0 subjects:
77
+ *
78
+ * | the rule | with this gate | without it |
79
+ * | --------------------------------- | -------------- | ---------- |
80
+ * | `…notImportFrom(x)` | the dead-selector finding, which names the cause | ADR-010's floor, which does not |
81
+ * | `…notImportFrom(x).expectEmpty()` | the dead-selector finding | **nothing — green** |
82
+ *
83
+ * The second row is why this is a required parameter and not a default. A
84
+ * declaration is an assertion that EXPIRES, and expiry needs `examined > 0`
85
+ * (`terminal-execution.ts`); when a checkout path empties the selector rather than
86
+ * the code, expiry can never engage and the declaration silently outlives what it
87
+ * was declared about.
88
+ *
89
+ * The tsconfig view needs no such gate, and that was MEASURED rather than
90
+ * assumed: the two globs the matcher withholds it from — `'*\/x/**'` and
91
+ * anything carrying a `'./'` segment — are caught by `syntacticFault` before
92
+ * any view is consulted, so each still reports as dead. A draft of this
93
+ * comment cited a bug for that case; there is none.
42
94
  */
43
- export declare function viewsFor(universe: PathUniverse, kind: 'file-path' | 'parent-dir' | 'import-target' | 'specifier' | 'literal'): readonly (readonly string[])[];
95
+ export declare function viewsFor(universe: PathUniverse, kind: 'file-path' | 'parent-dir' | 'import-target' | 'specifier' | 'literal', readsRepoRelative: boolean): readonly (readonly string[])[];
44
96
  //# sourceMappingURL=path-universe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"path-universe.d.ts","sourceRoot":"","sources":["../src/path-universe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,SAAS,MA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,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAUhC"}
@@ -10,12 +10,49 @@
10
10
  *
11
11
  * `import-target`, `specifier` and `literal` are not path kinds and have no
12
12
  * views, so they can never be found unsatisfiable here.
13
+ *
14
+ * ## Why the identity view is asked for and the others are not
15
+ *
16
+ * `readsRepoRelative` is the caller's answer to "does the MATCHER give this
17
+ * glob the identity-root view?" — the dialect owns that rule (ADR-013: the
18
+ * kernel takes the fact, not the policy), and it is required rather than
19
+ * defaulted because a caller that forgets would get the generous union.
20
+ *
21
+ * Generosity is safe for the tsconfig view and is not for this one, which is the
22
+ * whole reason for the asymmetry. The tsconfig view differs from the absolute
23
+ * path only by a prefix the matcher usually strips too. The identity view adds
24
+ * the segments BETWEEN the repository root and the package — so in a monorepo
25
+ * `'apps/identity/**'`, a project-relative glob that selects nothing because the
26
+ * project root is `apps/api`, matches `apps/identity/src/…` in this view and
27
+ * stops being reported dead. Measured while fixing bug 0348, before this
28
+ * parameter existed, with that glob selecting 0 subjects:
29
+ *
30
+ * | the rule | with this gate | without it |
31
+ * | --------------------------------- | -------------- | ---------- |
32
+ * | `…notImportFrom(x)` | the dead-selector finding, which names the cause | ADR-010's floor, which does not |
33
+ * | `…notImportFrom(x).expectEmpty()` | the dead-selector finding | **nothing — green** |
34
+ *
35
+ * The second row is why this is a required parameter and not a default. A
36
+ * declaration is an assertion that EXPIRES, and expiry needs `examined > 0`
37
+ * (`terminal-execution.ts`); when a checkout path empties the selector rather than
38
+ * the code, expiry can never engage and the declaration silently outlives what it
39
+ * was declared about.
40
+ *
41
+ * The tsconfig view needs no such gate, and that was MEASURED rather than
42
+ * assumed: the two globs the matcher withholds it from — `'*\/x/**'` and
43
+ * anything carrying a `'./'` segment — are caught by `syntacticFault` before
44
+ * any view is consulted, so each still reports as dead. A draft of this
45
+ * comment cited a bug for that case; there is none.
13
46
  */
14
- export function viewsFor(universe, kind) {
47
+ export function viewsFor(universe, kind, readsRepoRelative) {
15
48
  if (kind === 'file-path')
16
- return [universe.filePaths, universe.tsconfigRelativeFilePaths];
49
+ return readsRepoRelative
50
+ ? [universe.filePaths, universe.tsconfigRelativeFilePaths, universe.repoRelativeFilePaths]
51
+ : [universe.filePaths, universe.tsconfigRelativeFilePaths];
17
52
  if (kind === 'parent-dir')
18
- return [universe.parentDirs, universe.tsconfigRelativeParentDirs];
53
+ return readsRepoRelative
54
+ ? [universe.parentDirs, universe.tsconfigRelativeParentDirs, universe.repoRelativeParentDirs]
55
+ : [universe.parentDirs, universe.tsconfigRelativeParentDirs];
19
56
  return [];
20
57
  }
21
58
  //# sourceMappingURL=path-universe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"path-universe.js","sourceRoot":"","sources":["../src/path-universe.ts"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CACtB,QAAsB,EACtB,IAA4E;IAE5E,IAAI,IAAI,KAAK,WAAW;QAAE,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAA;IACzF,IAAI,IAAI,KAAK,YAAY;QAAE,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,0BAA0B,CAAC,CAAA;IAC5F,OAAO,EAAE,CAAA;AACX,CAAC"}
1
+ {"version":3,"file":"path-universe.js","sourceRoot":"","sources":["../src/path-universe.ts"],"names":[],"mappings":"AAiDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,UAAU,QAAQ,CACtB,QAAsB,EACtB,IAA4E,EAC5E,iBAA0B;IAE1B,IAAI,IAAI,KAAK,WAAW;QACtB,OAAO,iBAAiB;YACtB,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,yBAAyB,EAAE,QAAQ,CAAC,qBAAqB,CAAC;YAC1F,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAA;IAC9D,IAAI,IAAI,KAAK,YAAY;QACvB,OAAO,iBAAiB;YACtB,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,0BAA0B,EAAE,QAAQ,CAAC,sBAAsB,CAAC;YAC7F,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,0BAA0B,CAAC,CAAA;IAChE,OAAO,EAAE,CAAA;AACX,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nielspeter/eess",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "eess kernel — the dialect-independent rule engine (RuleBuilder, Predicate, Condition, baseline, formatters). Specifications you can run.",
5
5
  "type": "module",
6
6
  "exports": {