@component-compass/reference-graph 0.1.24 → 0.1.26

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 (35) hide show
  1. package/dist/engine/binding.d.ts +96 -0
  2. package/dist/engine/binding.js +405 -0
  3. package/dist/engine/binding.js.map +1 -0
  4. package/dist/engine/component-shape.d.ts +26 -2
  5. package/dist/engine/component-shape.js +74 -11
  6. package/dist/engine/component-shape.js.map +1 -1
  7. package/dist/engine/denotation.d.ts +7 -0
  8. package/dist/engine/denotation.js +15 -0
  9. package/dist/engine/denotation.js.map +1 -1
  10. package/dist/engine/helper-callers.d.ts +0 -7
  11. package/dist/engine/helper-callers.js +2 -23
  12. package/dist/engine/helper-callers.js.map +1 -1
  13. package/dist/engine/index.d.ts +1 -1
  14. package/dist/engine/index.js +259 -308
  15. package/dist/engine/index.js.map +1 -1
  16. package/dist/engine/member-identity.d.ts +7 -19
  17. package/dist/engine/member-identity.js +13 -19
  18. package/dist/engine/member-identity.js.map +1 -1
  19. package/dist/engine/re-export-chain.d.ts +1 -1
  20. package/dist/engine/re-export-chain.js +6 -6
  21. package/dist/engine/re-export-chain.js.map +1 -1
  22. package/dist/engine/registry.d.ts +52 -13
  23. package/dist/engine/registry.js +73 -58
  24. package/dist/engine/registry.js.map +1 -1
  25. package/dist/engine/resolve-reference.d.ts +2 -21
  26. package/dist/engine/resolve-reference.js +4 -178
  27. package/dist/engine/resolve-reference.js.map +1 -1
  28. package/dist/engine/resolve-type.d.ts +7 -7
  29. package/dist/engine/resolve-type.js +23 -29
  30. package/dist/engine/resolve-type.js.map +1 -1
  31. package/dist/engine/wrapper-folding.d.ts +18 -22
  32. package/dist/engine/wrapper-folding.js +147 -282
  33. package/dist/engine/wrapper-folding.js.map +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/package.json +1 -1
@@ -0,0 +1,96 @@
1
+ import type { BindingDecl, ExportRecord, FileGraph, Graph, InferredType, Reference } from "../index.js";
2
+ import { type CycleGuard } from "./cycle-detection.js";
3
+ import type { TerminalIdentity } from "./wrapper-folding.js";
4
+ /** The identity a walk credits for a binding whose re-export chain stopped
5
+ * short of it or never reached it: the barrel or file the chain ended at, the
6
+ * name sought in a file that does not export it or never binds it, or an
7
+ * unparsed file named through its import. `bindingIdentity` returns it.
8
+ * Transitional (#633): reproduces the identity a walk named before the
9
+ * resolver; removed, with `ChainEnd`, `recordOnChain`, `followRecord`'s
10
+ * second resolution, `withWalkIdentity` and `sameIdentity`, when walks
11
+ * credit the binding the resolver finds. */
12
+ type WalkIdentity = Exclude<TerminalIdentity, null>;
13
+ /** What a name refers to. `path` is the member chain past the binding.
14
+ * `mainGap: "namespace-member"` marks a binding reached as a member of a
15
+ * namespace import; `bindingValue` gives `Unknown` for it. An `unparsed`
16
+ * binding names the resolved target as found (a workspace member's absolute
17
+ * path, else its graph key), not pinned to its definition. Its
18
+ * `through-parsed-barrel` mark says it was reached through a parsed file:
19
+ * `barrel` is the file whose imported local led out of the graph, null for
20
+ * an `export … from` hop. `walkIdentity` is transitional (see `WalkIdentity`). */
21
+ export type Binding = {
22
+ kind: "declaration";
23
+ file: string;
24
+ decl: BindingDecl;
25
+ path: readonly string[];
26
+ inScope: boolean;
27
+ mainGap?: "namespace-member";
28
+ walkIdentity?: WalkIdentity;
29
+ } | {
30
+ kind: "package-export";
31
+ specifier: string;
32
+ exportName: string;
33
+ path: readonly string[];
34
+ stub: InferredType | null;
35
+ mainGap?: "namespace-member";
36
+ walkIdentity?: WalkIdentity;
37
+ } | {
38
+ kind: "unparsed";
39
+ file: string;
40
+ exportName: string;
41
+ path: readonly string[];
42
+ mainGap?: {
43
+ kind: "through-parsed-barrel";
44
+ barrel: string | null;
45
+ };
46
+ walkIdentity?: WalkIdentity;
47
+ } | {
48
+ kind: "unbound";
49
+ walkIdentity?: WalkIdentity;
50
+ } | {
51
+ kind: "import-failed";
52
+ specifier: string;
53
+ exportName: string;
54
+ path: readonly string[];
55
+ walkIdentity?: WalkIdentity;
56
+ } | {
57
+ kind: "no-export";
58
+ walkIdentity?: WalkIdentity;
59
+ };
60
+ /**
61
+ * Walk the scope chain for `ref.symbol` in `fileGraph.declarations` and
62
+ * return the first matching BindingDecl, or null if not found. THE
63
+ * scope-chain walk — `registry.ts`'s `resolveUsageTarget` calls this
64
+ * seam instead of re-deriving it.
65
+ */
66
+ export declare function findLocalDeclaration(fileGraph: FileGraph, ref: Reference): BindingDecl | null;
67
+ /**
68
+ * Pick the FileGraph a Reference should be resolved against. When
69
+ * `ref.originFile` is set, prefer that file's graph; this is how refs that
70
+ * have travelled across a module boundary get looked up in their authoring
71
+ * context. Falls back to the caller's `fileGraph` when no annotation is
72
+ * present (synthetic refs / parsers without ref-origin tagging).
73
+ */
74
+ export declare function fileGraphForRef(graph: Graph, ref: Reference, fallback: FileGraph): FileGraph;
75
+ /** The graph key for an absolute path; null when it lies outside the repo root. */
76
+ export declare function graphKeyFor(graph: Graph, abs: string): string | null;
77
+ /** The file's own named export `name`, or its default export for `"default"`. */
78
+ export declare function exportRecordFor(fileGraph: FileGraph, name: string): ExportRecord | undefined;
79
+ /** The binding `ref` names: its scope chain, then its file's imports. */
80
+ export declare function resolveBinding(graph: Graph, fileGraph: FileGraph, ref: Reference, guard?: CycleGuard): Binding;
81
+ /** The binding `import { imported } from specifier` names in `fromFile`,
82
+ * with `memberChain` the members accessed on the import. */
83
+ export declare function resolveModuleExport(graph: Graph, fromFile: string, specifier: string, imported: string, memberChain: readonly string[], guard?: CycleGuard): Binding;
84
+ /** The value a binding names: a declaration's value wrapped in `MemberOf`
85
+ * per `path` segment, a package export's library stub, else `Unknown`. */
86
+ export declare function bindingValue(binding: Binding): InferredType;
87
+ /** The identity a binding names: its `walkIdentity` when it carries one;
88
+ * else a declaration or an unparsed file is local, a package export or a
89
+ * failed import is the import as written. Only a declaration with nothing
90
+ * left on its path carries the declaration. */
91
+ export declare function bindingIdentity(binding: Binding): TerminalIdentity;
92
+ /** A workspace member's `unparsed` binding, reached directly, pinned to the
93
+ * definition the host's `resolveLocalDefinition` finds for it; the resolved
94
+ * entry when the host finds none. Any other binding is returned unchanged. */
95
+ export declare function pinUnparsed<B extends Binding>(graph: Graph, binding: B): B;
96
+ export {};
@@ -0,0 +1,405 @@
1
+ import { isAbsolute } from "node:path";
2
+ import { MODULE_SCOPE } from "../index.js";
3
+ import { createCycleGuard } from "./cycle-detection.js";
4
+ import { libraryStubFor } from "./library-stubs.js";
5
+ import { compoundExportName, effectiveExportName, residualMemberChain } from "./member-identity.js";
6
+ import { packageNameFromSpecifier } from "./specifier.js";
7
+ const NO_EXPORT = { kind: "no-export" };
8
+ const UNBOUND = { kind: "unbound" };
9
+ /**
10
+ * Walk the scope chain for `ref.symbol` in `fileGraph.declarations` and
11
+ * return the first matching BindingDecl, or null if not found. THE
12
+ * scope-chain walk — `registry.ts`'s `resolveUsageTarget` calls this
13
+ * seam instead of re-deriving it.
14
+ */
15
+ export function findLocalDeclaration(fileGraph, ref) {
16
+ let scope = ref.scope;
17
+ while (true) {
18
+ const decl = fileGraph.declarations.get(`${scope}::${ref.symbol}`);
19
+ if (decl)
20
+ return decl;
21
+ if (scope === MODULE_SCOPE)
22
+ return null;
23
+ const parent = fileGraph.scopes.get(scope)?.parent;
24
+ if (parent === null || parent === undefined)
25
+ return null;
26
+ scope = parent;
27
+ }
28
+ }
29
+ /**
30
+ * Pick the FileGraph a Reference should be resolved against. When
31
+ * `ref.originFile` is set, prefer that file's graph; this is how refs that
32
+ * have travelled across a module boundary get looked up in their authoring
33
+ * context. Falls back to the caller's `fileGraph` when no annotation is
34
+ * present (synthetic refs / parsers without ref-origin tagging).
35
+ */
36
+ export function fileGraphForRef(graph, ref, fallback) {
37
+ if (!ref.originFile || ref.originFile === fallback.filePath)
38
+ return fallback;
39
+ return graph.files.get(ref.originFile) ?? fallback;
40
+ }
41
+ /** The graph key for an absolute path; null when it lies outside the repo root. */
42
+ export function graphKeyFor(graph, abs) {
43
+ return graph.resolveToGraphKey ? graph.resolveToGraphKey(abs) : abs;
44
+ }
45
+ /** The file's own named export `name`, or its default export for `"default"`. */
46
+ export function exportRecordFor(fileGraph, name) {
47
+ return fileGraph.exports.find((e) => (e.kind === "named" && e.exportedAs === name) || (e.kind === "default" && name === "default"));
48
+ }
49
+ /** The binding `ref` names: its scope chain, then its file's imports. */
50
+ export function resolveBinding(graph, fileGraph, ref, guard = createCycleGuard()) {
51
+ const found = bindingIn(graph, fileGraphForRef(graph, ref, fileGraph), ref, guard, new Set());
52
+ return withWalkIdentity(graph, found, ref.memberChain);
53
+ }
54
+ /** The binding `import { imported } from specifier` names in `fromFile`,
55
+ * with `memberChain` the members accessed on the import. */
56
+ export function resolveModuleExport(graph, fromFile, specifier, imported, memberChain, guard = createCycleGuard()) {
57
+ const found = moduleExport(graph, fromFile, specifier, imported, memberChain, guard, new Set());
58
+ return withWalkIdentity(graph, { ...found, module: { specifier, imported, target: found.target } }, memberChain);
59
+ }
60
+ /** `chain` holds every `file::name` the re-export chain has sought so far; a
61
+ * name sought again ends nowhere. */
62
+ function bindingIn(graph, fileGraph, ref, guard, chain) {
63
+ const decl = findLocalDeclaration(fileGraph, ref);
64
+ if (decl) {
65
+ return { binding: { kind: "declaration", file: fileGraph.filePath, decl, path: ref.memberChain, inScope: true }, end: null };
66
+ }
67
+ const imp = fileGraph.importsByLocal.get(ref.symbol);
68
+ if (!imp)
69
+ return { binding: UNBOUND, end: null };
70
+ const stub = libraryStubFor(imp, ref);
71
+ if (stub) {
72
+ const binding = {
73
+ kind: "package-export",
74
+ specifier: imp.specifier,
75
+ exportName: effectiveExportName(imp.imported, ref.memberChain),
76
+ path: residualMemberChain(imp.imported, ref.memberChain),
77
+ stub,
78
+ };
79
+ return { binding, end: null };
80
+ }
81
+ const found = moduleExport(graph, fileGraph.filePath, imp.specifier, imp.imported, ref.memberChain, guard, chain);
82
+ return { ...found, module: { specifier: imp.specifier, imported: imp.imported, target: found.target } };
83
+ }
84
+ function moduleExport(graph, fromFile, specifier, imported, memberChain, guard, chain) {
85
+ const exportName = effectiveExportName(imported, memberChain);
86
+ const path = residualMemberChain(imported, memberChain);
87
+ const target = moduleTarget(graph, fromFile, specifier, exportName, path);
88
+ if (target.kind === "outside")
89
+ return { binding: target.binding, end: null, target };
90
+ if (imported === "*" && memberChain.length === 0)
91
+ return { binding: NO_EXPORT, end: null, target };
92
+ const found = exportIn(graph, target.key, exportName, path, guard, chain);
93
+ const b = found.binding;
94
+ if (imported === "*" && (b.kind === "declaration" || b.kind === "package-export")) {
95
+ return { binding: { ...b, mainGap: "namespace-member" }, end: found.end, target };
96
+ }
97
+ return { binding: b, end: found.end, target };
98
+ }
99
+ /** Classify the module `specifier` resolves to from `fromFile`. */
100
+ function moduleTarget(graph, fromFile, specifier, exportName, path) {
101
+ const isPackage = packageNameFromSpecifier(specifier) !== null;
102
+ const abs = graph.moduleResolver(fromFile, specifier);
103
+ if (!abs) {
104
+ const binding = isPackage
105
+ ? { kind: "package-export", specifier, exportName, path, stub: null }
106
+ : { kind: "import-failed", specifier, exportName, path };
107
+ return { kind: "outside", binding, graphKey: null, member: false };
108
+ }
109
+ const graphKey = graphKeyFor(graph, abs);
110
+ const key = graphKey ?? abs;
111
+ if (graph.files.has(key))
112
+ return { kind: "parsed", key };
113
+ if (graph.workspaceMembership?.(abs) === true) {
114
+ return { kind: "outside", binding: { kind: "unparsed", file: abs, exportName, path }, graphKey, member: true };
115
+ }
116
+ const binding = isPackage
117
+ ? { kind: "package-export", specifier, exportName, path, stub: null }
118
+ : { kind: "unparsed", file: key, exportName, path };
119
+ return { kind: "outside", binding, graphKey, member: false };
120
+ }
121
+ /** The binding the export `name` of parsed `file` names. */
122
+ function exportIn(graph, file, name, path, guard, chain) {
123
+ const again = soughtAgain(chain, file, name);
124
+ const found = findExportRecord(graph, file, name, new Set());
125
+ if (!found)
126
+ return { binding: packageStarExport(graph, file, name, path, new Set()) ?? NO_EXPORT, end: null };
127
+ const inner = followRecord(graph, found, file, name, path, guard, chain);
128
+ return again ? { binding: inner.binding, end: null } : inner;
129
+ }
130
+ /** The binding `found` names, with the chain end of the record the chain
131
+ * finds for `name` in `file`: the same record unless an `export *` target
132
+ * the chain has already sought hid one. Only the chain end follows that
133
+ * record; the binding is resolved on a copy of `chain`. Transitional: the
134
+ * second resolution goes with `WalkIdentity`. */
135
+ function followRecord(graph, found, file, name, path, guard, chain) {
136
+ const onChain = recordOnChain(graph, file, name, chain);
137
+ if (onChain?.record === found.record)
138
+ return bindingForRecord(graph, found.fileGraph, found.record, name, path, guard, chain);
139
+ const { binding } = bindingForRecord(graph, found.fileGraph, found.record, name, path, guard, new Set(chain));
140
+ const end = onChain ? bindingForRecord(graph, onChain.fileGraph, onChain.record, name, path, guard, chain).end : null;
141
+ return { binding, end };
142
+ }
143
+ /** Records `file::name` as sought by the re-export chain; true when it was already. */
144
+ function soughtAgain(chain, file, name) {
145
+ const key = `${file}::${name}`;
146
+ if (chain.has(key))
147
+ return true;
148
+ chain.add(key);
149
+ return false;
150
+ }
151
+ /** The export record `name` finds in `file`, following `export *` entries in
152
+ * source order; `seen` is shared across star siblings. */
153
+ function findExportRecord(graph, file, name, seen) {
154
+ const seenKey = `${file}::${name}`;
155
+ if (seen.has(seenKey))
156
+ return null;
157
+ seen.add(seenKey);
158
+ const fileGraph = graph.files.get(file);
159
+ if (!fileGraph)
160
+ return null;
161
+ const record = exportRecordFor(fileGraph, name);
162
+ if (record)
163
+ return { record, fileGraph };
164
+ for (const star of fileGraph.exports) {
165
+ if (star.kind !== "star")
166
+ continue;
167
+ const abs = graph.moduleResolver(file, star.from);
168
+ if (!abs)
169
+ continue;
170
+ const found = findExportRecord(graph, graphKeyFor(graph, abs) ?? abs, name, seen);
171
+ if (found)
172
+ return found;
173
+ }
174
+ return null;
175
+ }
176
+ /** The package export `name` names through `export *`, for a name no parsed
177
+ * branch exports: the `export *` targets outside the graph, collected through
178
+ * `file`'s parsed `export *` targets, must be exactly one, and a package.
179
+ * Null otherwise, and always for `default`, which `export *` never
180
+ * re-exports. */
181
+ function packageStarExport(graph, file, name, path, seen) {
182
+ if (name === "default")
183
+ return null;
184
+ const outside = [];
185
+ const visit = (f) => {
186
+ if (seen.has(f))
187
+ return;
188
+ seen.add(f);
189
+ const fileGraph = graph.files.get(f);
190
+ if (!fileGraph)
191
+ return;
192
+ for (const star of fileGraph.exports) {
193
+ if (star.kind !== "star")
194
+ continue;
195
+ const target = moduleTarget(graph, f, star.from, name, path);
196
+ if (target.kind === "parsed")
197
+ visit(target.key);
198
+ else
199
+ outside.push(target.binding);
200
+ }
201
+ };
202
+ visit(file);
203
+ return outside.length === 1 && outside[0]?.kind === "package-export" ? outside[0] : null;
204
+ }
205
+ /** The export record the re-export chain finds for `name` in `file` (already
206
+ * recorded in `chain`): `export *` targets in source order, skipping one
207
+ * whose `file::name` the chain has already sought and recording each one
208
+ * visited. Transitional: a second `export *` traversal that reproduces the
209
+ * chain end a walk named before the resolver; removed with `WalkIdentity`. */
210
+ function recordOnChain(graph, file, name, chain) {
211
+ const fileGraph = graph.files.get(file);
212
+ if (!fileGraph)
213
+ return null;
214
+ const record = exportRecordFor(fileGraph, name);
215
+ if (record)
216
+ return { record, fileGraph };
217
+ for (const star of fileGraph.exports) {
218
+ if (star.kind !== "star")
219
+ continue;
220
+ const abs = graph.moduleResolver(file, star.from);
221
+ if (!abs)
222
+ continue;
223
+ const next = graphKeyFor(graph, abs);
224
+ if (next === null || soughtAgain(chain, next, name))
225
+ continue;
226
+ const found = recordOnChain(graph, next, name, chain);
227
+ if (found)
228
+ return found;
229
+ }
230
+ return null;
231
+ }
232
+ /** The binding export record `exp` of `fg` names, and where the re-export
233
+ * chain ends: a relative imported local is followed, any other imported
234
+ * local ends at `fg`; an `export … from` hop ends at the target's graph key
235
+ * unless the chain continues there. */
236
+ function bindingForRecord(graph, fg, exp, name, path, guard, chain) {
237
+ if (exp.kind === "star")
238
+ return { binding: NO_EXPORT, end: null };
239
+ if ("local" in exp) {
240
+ const here = { file: fg.filePath, name: exp.local };
241
+ if (guard.push(fg.filePath, exp.local) !== "ok")
242
+ return { binding: NO_EXPORT, end: here };
243
+ try {
244
+ const ref = { symbol: exp.local, scope: MODULE_SCOPE, memberChain: [...path], loc: { line: 0, column: 0 } };
245
+ const found = bindingIn(graph, fg, ref, guard, chain);
246
+ const b = found.binding;
247
+ const followed = found.module !== undefined &&
248
+ found.module.imported !== "*" &&
249
+ packageNameFromSpecifier(found.module.specifier) === null &&
250
+ found.module.target.kind === "parsed";
251
+ return {
252
+ binding: b.kind === "declaration" ? { ...b, inScope: false } : leftGraphThrough(b, fg.filePath),
253
+ end: (followed ? found.end : null) ?? here,
254
+ };
255
+ }
256
+ finally {
257
+ guard.pop(fg.filePath, exp.local);
258
+ }
259
+ }
260
+ const target = moduleTarget(graph, fg.filePath, exp.from, exp.fromImported, path);
261
+ if (target.kind === "outside") {
262
+ const end = target.graphKey === null ? { file: fg.filePath, name } : { file: target.graphKey, name: exp.fromImported };
263
+ return { binding: leftGraphThrough(target.binding, null), end };
264
+ }
265
+ const next = { file: target.key, name: exp.fromImported };
266
+ const again = soughtAgain(chain, target.key, exp.fromImported);
267
+ const found = findExportRecord(graph, target.key, exp.fromImported, new Set());
268
+ if (!found)
269
+ return { binding: packageStarExport(graph, target.key, exp.fromImported, path, new Set()) ?? NO_EXPORT, end: next };
270
+ if (guard.push(fg.filePath, exp.exportedAs) !== "ok")
271
+ return { binding: NO_EXPORT, end: next };
272
+ try {
273
+ const inner = followRecord(graph, found, target.key, exp.fromImported, path, guard, chain);
274
+ return { binding: inner.binding, end: (again ? null : inner.end) ?? next };
275
+ }
276
+ finally {
277
+ guard.pop(fg.filePath, exp.exportedAs);
278
+ }
279
+ }
280
+ /** Mark an unparsed binding reached through a parsed file. The innermost mark
281
+ * wins. */
282
+ function leftGraphThrough(b, barrel) {
283
+ if (b.kind === "unparsed" && b.mainGap === undefined) {
284
+ return { ...b, mainGap: { kind: "through-parsed-barrel", barrel } };
285
+ }
286
+ return b;
287
+ }
288
+ /** The binding with the identity a walk credits for its import, where that
289
+ * differs from `bindingIdentity`'s own: a package specifier into a parsed
290
+ * file names the file its re-export chain ends at when that file is parsed,
291
+ * else the import as written; a relative specifier names the chain's end,
292
+ * else the import as written with the target's graph key as its resolved
293
+ * file. A package export, unless reached as a namespace member, keeps its
294
+ * own. Transitional: goes with `WalkIdentity`. */
295
+ function withWalkIdentity(graph, found, memberChain) {
296
+ const { binding, module } = found;
297
+ if (module === undefined)
298
+ return binding;
299
+ if (binding.kind === "package-export" && binding.mainGap === undefined)
300
+ return binding;
301
+ const { specifier, imported, target } = module;
302
+ const name = effectiveExportName(imported, memberChain);
303
+ const residual = residualMemberChain(imported, memberChain);
304
+ const isPackage = packageNameFromSpecifier(specifier) !== null;
305
+ const asWritten = (resolvedFile) => ({
306
+ kind: "imported",
307
+ specifier,
308
+ imported: compoundExportName(name, residual),
309
+ resolvedFile,
310
+ });
311
+ const local = (file, exportName) => ({
312
+ kind: "local",
313
+ filePath: file,
314
+ export: compoundExportName(exportName, residual),
315
+ });
316
+ let walked;
317
+ if (target.kind === "outside") {
318
+ if (isPackage || target.member || binding.kind !== "unparsed")
319
+ return binding;
320
+ walked = asWritten(target.graphKey);
321
+ }
322
+ else if (isPackage) {
323
+ const file = found.end?.file ?? target.key;
324
+ walked = graph.files.has(file) ? local(file, found.end?.name ?? name) : asWritten(null);
325
+ }
326
+ else {
327
+ walked = found.end ? local(found.end.file, found.end.name) : asWritten(target.key);
328
+ }
329
+ return sameIdentity(walked, naturalIdentity(binding)) ? binding : { ...binding, walkIdentity: walked };
330
+ }
331
+ /** Transitional: goes with `WalkIdentity`. */
332
+ function sameIdentity(a, b) {
333
+ if (b === null || a.kind !== b.kind)
334
+ return false;
335
+ if (a.kind === "local" && b.kind === "local")
336
+ return a.filePath === b.filePath && a.export === b.export;
337
+ if (a.kind === "imported" && b.kind === "imported") {
338
+ return a.specifier === b.specifier && a.imported === b.imported && a.resolvedFile === b.resolvedFile;
339
+ }
340
+ return false;
341
+ }
342
+ /** The value a binding names: a declaration's value wrapped in `MemberOf`
343
+ * per `path` segment, a package export's library stub, else `Unknown`. */
344
+ export function bindingValue(binding) {
345
+ switch (binding.kind) {
346
+ case "declaration": {
347
+ if (binding.mainGap === "namespace-member")
348
+ return { kind: "Unknown" };
349
+ let value = binding.decl.value;
350
+ for (const member of binding.path)
351
+ value = { kind: "MemberOf", obj: value, member };
352
+ return value;
353
+ }
354
+ case "package-export":
355
+ return binding.mainGap === "namespace-member" ? { kind: "Unknown" } : (binding.stub ?? { kind: "Unknown" });
356
+ default:
357
+ return { kind: "Unknown" };
358
+ }
359
+ }
360
+ /** The identity a binding names: its `walkIdentity` when it carries one;
361
+ * else a declaration or an unparsed file is local, a package export or a
362
+ * failed import is the import as written. Only a declaration with nothing
363
+ * left on its path carries the declaration. */
364
+ export function bindingIdentity(binding) {
365
+ if (binding.walkIdentity !== undefined)
366
+ return binding.walkIdentity;
367
+ return naturalIdentity(binding);
368
+ }
369
+ function naturalIdentity(binding) {
370
+ switch (binding.kind) {
371
+ case "declaration":
372
+ return {
373
+ kind: "local",
374
+ filePath: binding.file,
375
+ export: compoundExportName(binding.decl.symbol, binding.path),
376
+ ...(binding.path.length === 0 ? { declaration: binding.decl } : {}),
377
+ };
378
+ case "unparsed":
379
+ return { kind: "local", filePath: binding.file, export: compoundExportName(binding.exportName, binding.path) };
380
+ case "package-export":
381
+ case "import-failed":
382
+ return {
383
+ kind: "imported",
384
+ specifier: binding.specifier,
385
+ imported: compoundExportName(binding.exportName, binding.path),
386
+ resolvedFile: null,
387
+ };
388
+ default:
389
+ return null;
390
+ }
391
+ }
392
+ /** A workspace member's `unparsed` binding, reached directly, pinned to the
393
+ * definition the host's `resolveLocalDefinition` finds for it; the resolved
394
+ * entry when the host finds none. Any other binding is returned unchanged. */
395
+ export function pinUnparsed(graph, binding) {
396
+ // Transitional: an unparsed binding reached through a parsed file stays
397
+ // unpinned, as before the resolver; removed when it is pinned (#628).
398
+ if (binding.kind !== "unparsed" || binding.mainGap !== undefined || !isAbsolute(binding.file))
399
+ return binding;
400
+ if (graph.workspaceMembership?.(binding.file) !== true)
401
+ return binding;
402
+ const def = graph.resolveLocalDefinition?.(binding.file, binding.exportName) ?? null;
403
+ return def === null ? binding : { ...binding, file: def.absFile, exportName: def.exportName };
404
+ }
405
+ //# sourceMappingURL=binding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binding.js","sourceRoot":"","sources":["../../src/engine/binding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAmB,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAoD1D,MAAM,SAAS,GAAY,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AACjD,MAAM,OAAO,GAAY,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAsB7C;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAoB,EAAE,GAAc;IACvE,IAAI,KAAK,GAAY,GAAG,CAAC,KAAK,CAAC;IAC/B,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,KAAK,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QACnE,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC;QACtB,IAAI,KAAK,KAAK,YAAY;YAAE,OAAO,IAAI,CAAC;QACxC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QACnD,IAAI,MAAM,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,IAAI,EAAE,MAAM,EAAE,kBAAkB,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACjH,KAAK,gBAAgB,CAAC;QACtB,KAAK,eAAe;YAClB,OAAO;gBACL,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC;gBAC9D,YAAY,EAAE,IAAI;aACnB,CAAC;QACJ;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED;;+EAE+E;AAC/E,MAAM,UAAU,WAAW,CAAoB,KAAY,EAAE,OAAU;IACrE,wEAAwE;IACxE,sEAAsE;IACtE,IAAI,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC;IAC9G,IAAI,KAAK,CAAC,mBAAmB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC;IACvE,MAAM,GAAG,GAAG,KAAK,CAAC,sBAAsB,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC;IACrF,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC;AAChG,CAAC"}
@@ -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, owner classification, occurrence admission —
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;