@component-compass/reference-graph 0.1.24 → 0.1.25
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/dist/engine/component-shape.d.ts +26 -2
- package/dist/engine/component-shape.js +73 -10
- package/dist/engine/component-shape.js.map +1 -1
- package/dist/engine/denotation.d.ts +7 -0
- package/dist/engine/denotation.js +15 -0
- package/dist/engine/denotation.js.map +1 -1
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.js +353 -261
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/member-identity.d.ts +8 -0
- package/dist/engine/member-identity.js +15 -0
- package/dist/engine/member-identity.js.map +1 -1
- package/dist/engine/registry.d.ts +57 -13
- package/dist/engine/registry.js +105 -57
- package/dist/engine/registry.js.map +1 -1
- package/dist/engine/wrapper-folding.d.ts +10 -3
- package/dist/engine/wrapper-folding.js +133 -76
- package/dist/engine/wrapper-folding.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { FileGraph, Graph, InferredType } from "../index.js";
|
|
2
2
|
import { type ArgumentMap } from "./argument-map.js";
|
|
3
3
|
import { type CycleGuard } from "./cycle-detection.js";
|
|
4
|
+
import type { OpaqueSemantics } from "./denotation.js";
|
|
4
5
|
/**
|
|
5
6
|
* THE component-shape predicate. Reduces an InferredType
|
|
6
7
|
* to what its VALUE is:
|
|
@@ -18,8 +19,8 @@ import { type CycleGuard } from "./cycle-detection.js";
|
|
|
18
19
|
* not "jsx", so the outer function is "other" — a factory. That single rule
|
|
19
20
|
* separates `createField` from its products. Do not add a second
|
|
20
21
|
* implementation anywhere; every
|
|
21
|
-
* caller — registry membership
|
|
22
|
-
* calls this one. Named in docs/CONTEXT.md ("Component-shape seam").
|
|
22
|
+
* caller — registry membership and the registry's component judge, owner
|
|
23
|
+
* classification — calls this one. Named in docs/CONTEXT.md ("Component-shape seam").
|
|
23
24
|
*/
|
|
24
25
|
export type ValueKind = "jsx" | "component" | "unresolved" | "other";
|
|
25
26
|
export declare function evalKind(type: InferredType, graph: Graph, fileGraph: FileGraph, argMap?: ArgumentMap, guard?: CycleGuard): ValueKind;
|
|
@@ -36,6 +37,20 @@ export declare function isComponentShaped(type: InferredType, graph: Graph, file
|
|
|
36
37
|
* plain params (not this module's private `Ctx`) so a caller outside this
|
|
37
38
|
* file doesn't need to construct one. */
|
|
38
39
|
export declare function isImportBackedLeaf(t: InferredType, graph: Graph, fileGraph: FileGraph, guard: CycleGuard): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The semantics of the non-component value a call produces: the stub table's
|
|
42
|
+
* entry for the callee's export, when the callee is an import the graph cannot
|
|
43
|
+
* see (`isImportBackedLeaf`, the same predicate the unseen-hook rule uses).
|
|
44
|
+
* Null for every other call. Exported: `walkReturnTypeOf` names such a call's
|
|
45
|
+
* product from it, and `evalCall` below answers "other" for it; neither
|
|
46
|
+
* re-derives it.
|
|
47
|
+
*
|
|
48
|
+
* The callee's spelling is read through `libraryExportFor`, the one table
|
|
49
|
+
* `libraryStubFor` reads: a reference (a named import, or a default /
|
|
50
|
+
* namespace import carrying the member on the ref) or a member access on one
|
|
51
|
+
* (`React.createContext`).
|
|
52
|
+
*/
|
|
53
|
+
export declare function nonComponentProduct(graph: Graph, fileGraph: FileGraph, callee: InferredType, guard: CycleGuard): OpaqueSemantics | null;
|
|
39
54
|
/** Answers "is there an `import()` anywhere in this value" — for reporting
|
|
40
55
|
* only. It descends every node kind that can hold one and never claims a
|
|
41
56
|
* projection, so the specifier it hands back names the import the diagnostic
|
|
@@ -47,3 +62,12 @@ export declare function isImportBackedLeaf(t: InferredType, graph: Graph, fileGr
|
|
|
47
62
|
export declare function firstDynamicImport(t: InferredType): Extract<InferredType, {
|
|
48
63
|
kind: "DynamicImport";
|
|
49
64
|
}> | null;
|
|
65
|
+
/** True when there is an `import()` anywhere in this value, by
|
|
66
|
+
* `firstDynamicImport`'s descent; it claims no projection. Given `at`, a
|
|
67
|
+
* reference is followed once: the binding it names is found scope-aware in
|
|
68
|
+
* the file the reference was written in, and that binding's value is
|
|
69
|
+
* searched with no further peek. */
|
|
70
|
+
export declare function containsDynamicImport(t: InferredType, at?: {
|
|
71
|
+
graph: Graph;
|
|
72
|
+
fileGraph: FileGraph;
|
|
73
|
+
}): boolean;
|
|
@@ -3,6 +3,8 @@ import { createCycleGuard } from "./cycle-detection.js";
|
|
|
3
3
|
import { fileGraphForRef, resolveReference } from "./resolve-reference.js";
|
|
4
4
|
import { resolveToFunctions, resolveType, DYNAMIC_MEMBER_KEY } from "./resolve-type.js";
|
|
5
5
|
import { assertNever } from "./assert-never.js";
|
|
6
|
+
import { libraryExportFor } from "./library-stubs.js";
|
|
7
|
+
import { findLocalDeclaration } from "./helper-callers.js";
|
|
6
8
|
export function evalKind(type, graph, fileGraph, argMap = createArgumentMap(), guard = createCycleGuard()) {
|
|
7
9
|
return evalInner(type, { graph, fileGraph, argMap, guard });
|
|
8
10
|
}
|
|
@@ -87,9 +89,12 @@ function evalInner(t, ctx) {
|
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
function evalCall(t, ctx) {
|
|
92
|
+
// A non-component product (a context) holds its arguments; it never wraps them.
|
|
93
|
+
if (nonComponentProduct(ctx.graph, ctx.fileGraph, t.callee, ctx.guard) !== null)
|
|
94
|
+
return "other";
|
|
90
95
|
// `lazy(() => import('./x'))` and friends: the engine's lazy-import rule
|
|
91
96
|
// owns identity; for shape purposes the call is a component.
|
|
92
|
-
if (t.args.some(containsDynamicImport))
|
|
97
|
+
if (t.args.some((a) => containsDynamicImport(a)))
|
|
93
98
|
return "component";
|
|
94
99
|
const fns = resolveToFunctions(ctx.graph, ctx.fileGraph, t.callee, ctx.argMap, ctx.guard);
|
|
95
100
|
const resolvable = [];
|
|
@@ -99,8 +104,10 @@ function evalCall(t, ctx) {
|
|
|
99
104
|
}
|
|
100
105
|
if (resolvable.length === 0) {
|
|
101
106
|
// Opaque callee: component iff some argument is
|
|
102
|
-
// component-shaped or an import-backed leaf the engine will fold to.
|
|
103
|
-
|
|
107
|
+
// component-shaped or an import-backed leaf the engine will fold to. A
|
|
108
|
+
// non-component product call (`withX(createContext(…))`) is neither.
|
|
109
|
+
const isProductCall = (a) => a.kind === "ReturnTypeOf" && nonComponentProduct(ctx.graph, ctx.fileGraph, a.callee, ctx.guard) !== null;
|
|
110
|
+
const carries = t.args.some((a) => evalInner(a, ctx) === "component" || (isImportBackedLeaf(a, ctx.graph, ctx.fileGraph, ctx.guard) && !isProductCall(a)));
|
|
104
111
|
if (!carries)
|
|
105
112
|
return "unresolved";
|
|
106
113
|
// A method call on non-import-backed data — a parameter,
|
|
@@ -158,6 +165,33 @@ export function isImportBackedLeaf(t, graph, fileGraph, guard) {
|
|
|
158
165
|
return false;
|
|
159
166
|
return resolveReference(graph, fileGraph, cur.ref, guard).kind === "Unknown";
|
|
160
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* The semantics of the non-component value a call produces: the stub table's
|
|
170
|
+
* entry for the callee's export, when the callee is an import the graph cannot
|
|
171
|
+
* see (`isImportBackedLeaf`, the same predicate the unseen-hook rule uses).
|
|
172
|
+
* Null for every other call. Exported: `walkReturnTypeOf` names such a call's
|
|
173
|
+
* product from it, and `evalCall` below answers "other" for it; neither
|
|
174
|
+
* re-derives it.
|
|
175
|
+
*
|
|
176
|
+
* The callee's spelling is read through `libraryExportFor`, the one table
|
|
177
|
+
* `libraryStubFor` reads: a reference (a named import, or a default /
|
|
178
|
+
* namespace import carrying the member on the ref) or a member access on one
|
|
179
|
+
* (`React.createContext`).
|
|
180
|
+
*/
|
|
181
|
+
export function nonComponentProduct(graph, fileGraph, callee, guard) {
|
|
182
|
+
const ref = callee.kind === "TypeOf"
|
|
183
|
+
? callee.ref
|
|
184
|
+
: callee.kind === "MemberOf" && callee.obj.kind === "TypeOf"
|
|
185
|
+
? { ...callee.obj.ref, memberChain: [callee.member] }
|
|
186
|
+
: null;
|
|
187
|
+
if (ref === null)
|
|
188
|
+
return null;
|
|
189
|
+
const imp = fileGraphForRef(graph, ref, fileGraph).importsByLocal.get(ref.symbol);
|
|
190
|
+
const entry = imp === undefined ? null : libraryExportFor(imp, ref);
|
|
191
|
+
if (entry === null || entry.kind !== "non-component-product")
|
|
192
|
+
return null;
|
|
193
|
+
return isImportBackedLeaf(callee, graph, fileGraph, guard) ? entry.semantics : null;
|
|
194
|
+
}
|
|
161
195
|
/** Answers "is there an `import()` anywhere in this value" — for reporting
|
|
162
196
|
* only. It descends every node kind that can hold one and never claims a
|
|
163
197
|
* projection, so the specifier it hands back names the import the diagnostic
|
|
@@ -167,41 +201,70 @@ export function isImportBackedLeaf(t, graph, fileGraph, guard) {
|
|
|
167
201
|
* credit, is deliberately narrower, and is the only one that may claim a
|
|
168
202
|
* projection. */
|
|
169
203
|
export function firstDynamicImport(t) {
|
|
204
|
+
return searchDynamicImport(t, null);
|
|
205
|
+
}
|
|
206
|
+
function searchDynamicImport(t, peek) {
|
|
170
207
|
switch (t.kind) {
|
|
171
208
|
case "DynamicImport":
|
|
172
209
|
return t;
|
|
173
210
|
case "Function":
|
|
174
211
|
for (const r of t.returns) {
|
|
175
|
-
const hit =
|
|
212
|
+
const hit = searchDynamicImport(r, peek);
|
|
176
213
|
if (hit)
|
|
177
214
|
return hit;
|
|
178
215
|
}
|
|
179
216
|
return null;
|
|
180
217
|
case "ReturnTypeOf": {
|
|
181
|
-
const inCallee =
|
|
218
|
+
const inCallee = searchDynamicImport(t.callee, peek);
|
|
182
219
|
if (inCallee)
|
|
183
220
|
return inCallee;
|
|
184
221
|
for (const a of t.args) {
|
|
185
|
-
const hit =
|
|
222
|
+
const hit = searchDynamicImport(a, peek);
|
|
186
223
|
if (hit)
|
|
187
224
|
return hit;
|
|
188
225
|
}
|
|
189
226
|
return null;
|
|
190
227
|
}
|
|
191
228
|
case "MemberOf":
|
|
192
|
-
return
|
|
229
|
+
return searchDynamicImport(t.obj, peek);
|
|
193
230
|
case "Union":
|
|
194
231
|
for (const u of t.types) {
|
|
195
|
-
const hit =
|
|
232
|
+
const hit = searchDynamicImport(u, peek);
|
|
196
233
|
if (hit)
|
|
197
234
|
return hit;
|
|
198
235
|
}
|
|
199
236
|
return null;
|
|
237
|
+
case "Object":
|
|
238
|
+
for (const v of Object.values(t.props)) {
|
|
239
|
+
const hit = searchDynamicImport(v, peek);
|
|
240
|
+
if (hit)
|
|
241
|
+
return hit;
|
|
242
|
+
}
|
|
243
|
+
return null;
|
|
244
|
+
case "Array":
|
|
245
|
+
for (const e of t.elements) {
|
|
246
|
+
const hit = searchDynamicImport(e, peek);
|
|
247
|
+
if (hit)
|
|
248
|
+
return hit;
|
|
249
|
+
}
|
|
250
|
+
return null;
|
|
251
|
+
case "TypeOf": {
|
|
252
|
+
const bound = peek?.(t) ?? null;
|
|
253
|
+
return bound === null ? null : searchDynamicImport(bound, null);
|
|
254
|
+
}
|
|
200
255
|
default:
|
|
201
256
|
return null;
|
|
202
257
|
}
|
|
203
258
|
}
|
|
204
|
-
|
|
205
|
-
|
|
259
|
+
/** True when there is an `import()` anywhere in this value, by
|
|
260
|
+
* `firstDynamicImport`'s descent; it claims no projection. Given `at`, a
|
|
261
|
+
* reference is followed once: the binding it names is found scope-aware in
|
|
262
|
+
* the file the reference was written in, and that binding's value is
|
|
263
|
+
* searched with no further peek. */
|
|
264
|
+
export function containsDynamicImport(t, at) {
|
|
265
|
+
const peek = at === undefined
|
|
266
|
+
? null
|
|
267
|
+
: (ref) => findLocalDeclaration(fileGraphForRef(at.graph, ref.ref, at.fileGraph), ref.ref)?.value ?? null;
|
|
268
|
+
return searchDynamicImport(t, peek) !== null;
|
|
206
269
|
}
|
|
207
270
|
//# sourceMappingURL=component-shape.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-shape.js","sourceRoot":"","sources":["../../src/engine/component-shape.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAoB,MAAM,m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;gBACzC,IAAI,GAAG;oBAAE,OAAO,GAAG,CAAC;YACtB,CAAC;YACD,OAAO,IAAI,CAAC;QACd,KAAK,OAAO;YACV,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;gBAC3B,MAAM,GAAG,GAAG,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;gBACzC,IAAI,GAAG;oBAAE,OAAO,GAAG,CAAC;YACtB,CAAC;YACD,OAAO,IAAI,CAAC;QACd,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;YAChC,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAClE,CAAC;QACD;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED;;;;qCAIqC;AACrC,MAAM,UAAU,qBAAqB,CAAC,CAAe,EAAE,EAA2C;IAChG,MAAM,IAAI,GACR,EAAE,KAAK,SAAS;QACd,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,oBAAoB,CAAC,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,IAAI,IAAI,CAAC;IAC9G,OAAO,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC;AAC/C,CAAC"}
|
|
@@ -42,6 +42,11 @@ export type Denotation =
|
|
|
42
42
|
/** Nothing known. */
|
|
43
43
|
| {
|
|
44
44
|
kind: "indeterminate";
|
|
45
|
+
}
|
|
46
|
+
/** A function reached at a tag position: what JSX renders is the function
|
|
47
|
+
* itself, whatever it returns. */
|
|
48
|
+
| {
|
|
49
|
+
kind: "callable";
|
|
45
50
|
};
|
|
46
51
|
export type OpaqueSemantics = "context";
|
|
47
52
|
export type LateBoundSource = "parameter" | "parameter-member" | "hook-result";
|
|
@@ -80,4 +85,6 @@ export type RenderOutcome = {
|
|
|
80
85
|
* with the holder fold and argument-site seeding so there is not one
|
|
81
86
|
* classification per arm. Empty when nothing is credited. */
|
|
82
87
|
export declare function creditedTerminals(e: readonly Terminal[]): Terminal[];
|
|
88
|
+
/** True when this terminal is a function a tag renders. */
|
|
89
|
+
export declare function isCallable(t: Terminal): boolean;
|
|
83
90
|
export declare function renderOutcome(e: Evaluation): RenderOutcome;
|
|
@@ -12,6 +12,7 @@ const RENDER_VERDICT = {
|
|
|
12
12
|
"late-bound": () => "late-bound",
|
|
13
13
|
data: () => "unresolved",
|
|
14
14
|
indeterminate: () => "unresolved",
|
|
15
|
+
callable: () => "credit",
|
|
15
16
|
};
|
|
16
17
|
/** THE fan-out precedence: a Union / dynamic-map evaluation has several
|
|
17
18
|
* terminals with different verdicts. Highest wins, once, here. */
|
|
@@ -22,6 +23,20 @@ const VERDICT_ORDER = ["credit", "silent", "late-bound", "unresolved"];
|
|
|
22
23
|
export function creditedTerminals(e) {
|
|
23
24
|
return e.filter((t) => matchDenotation(t, RENDER_VERDICT) === "credit");
|
|
24
25
|
}
|
|
26
|
+
const IS_CALLABLE = {
|
|
27
|
+
element: () => false,
|
|
28
|
+
foreign: () => false,
|
|
29
|
+
"host-string": () => false,
|
|
30
|
+
opaque: () => false,
|
|
31
|
+
"late-bound": () => false,
|
|
32
|
+
data: () => false,
|
|
33
|
+
indeterminate: () => false,
|
|
34
|
+
callable: () => true,
|
|
35
|
+
};
|
|
36
|
+
/** True when this terminal is a function a tag renders. */
|
|
37
|
+
export function isCallable(t) {
|
|
38
|
+
return matchDenotation(t, IS_CALLABLE);
|
|
39
|
+
}
|
|
25
40
|
export function renderOutcome(e) {
|
|
26
41
|
const verdicts = e.map((t) => matchDenotation(t, RENDER_VERDICT));
|
|
27
42
|
const winner = VERDICT_ORDER.find((v) => verdicts.includes(v)) ?? "unresolved";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"denotation.js","sourceRoot":"","sources":["../../src/engine/denotation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"denotation.js","sourceRoot":"","sources":["../../src/engine/denotation.ts"],"names":[],"mappings":"AAuDA,8EAA8E;AAC9E,MAAM,UAAU,eAAe,CAAI,CAAW,EAAE,KAAyB;IACvE,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAsC,CAAC;IAC9E,OAAO,OAAO,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;AAClC,CAAC;AAID,4EAA4E;AAC5E,MAAM,cAAc,GAAmC;IACrD,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ;IACvB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ;IACvB,aAAa,EAAE,GAAG,EAAE,CAAC,QAAQ;IAC7B,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ;IACtB,YAAY,EAAE,GAAG,EAAE,CAAC,YAAY;IAChC,IAAI,EAAE,GAAG,EAAE,CAAC,YAAY;IACxB,aAAa,EAAE,GAAG,EAAE,CAAC,YAAY;IACjC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ;CACzB,CAAC;AAEF;mEACmE;AACnE,MAAM,aAAa,GAA6B,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;AAOjG;;8DAE8D;AAC9D,MAAM,UAAU,iBAAiB,CAAC,CAAsB;IACtD,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC,EAAE,cAAc,CAAC,KAAK,QAAQ,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,WAAW,GAA6B;IAC5C,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK;IACpB,OAAO,EAA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B,EAAE,CAAC;QACzD,KAAK,YAAY;YACf,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC;IAC9D,CAAC;AACH,CAAC"}
|
package/dist/engine/index.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export type EngineOccurrence = {
|
|
|
53
53
|
};
|
|
54
54
|
export type ResolvedGraph = {
|
|
55
55
|
occurrences: EngineOccurrence[];
|
|
56
|
-
/** The component registry this resolution
|
|
56
|
+
/** The component registry this resolution judged identities against.
|
|
57
57
|
* The CLI's roster join (`buildComponentSeeds`) reads it. */
|
|
58
58
|
registry: ComponentRegistry;
|
|
59
59
|
};
|