gitnexus 1.6.11-rc.14 → 1.6.11-rc.16

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.
@@ -0,0 +1,62 @@
1
+ /**
2
+ * ASP.NET Core ViewComponent convention support.
3
+ *
4
+ * Same bound as Spring Boot DI in Java/Kotlin: do not resolve into the SDK
5
+ * (`Microsoft.AspNetCore.Mvc.ViewComponent`, `IViewComponentHelper`,
6
+ * `Component.InvokeAsync` itself). Those types live outside the workspace.
7
+ * The only hop worth taking is the framework convention that lands on an
8
+ * **in-repo** class — `InvokeAsync("Foo")` → workspace `FooViewComponent`,
9
+ * just as a Spring `@Autowired IFoo` fans out to an in-repo `@Service`,
10
+ * not to `ApplicationContext`.
11
+ *
12
+ * Razor templates are not parsed as C# (markup + code would poison
13
+ * tree-sitter-c-sharp). A small Razor state machine extracts C# islands and
14
+ * markup tag helpers; C# files use a string/comment-aware lexer so attributes
15
+ * and literals are not mistaken for helper calls. Literal names are enough
16
+ * because the target catalog is already built from parsed `.cs` classes.
17
+ */
18
+ import type { ParsedFile } from '../../../../_shared/index.js';
19
+ import type { KnowledgeGraph } from '../../../graph/types.js';
20
+ import type { GraphNodeLookup } from '../../scope-resolution/graph-bridge/node-lookup.js';
21
+ export interface RazorViewComponentConfig {
22
+ /** Repo-relative `.cshtml` path → extracted invocation names. */
23
+ readonly views: ReadonlyMap<string, readonly string[]>;
24
+ }
25
+ export interface ViewComponentAliasBind {
26
+ readonly className: string;
27
+ /** 1-based line of the type declaration (including leading attributes). */
28
+ readonly startLine: number;
29
+ /** 0-based column of the type declaration (including leading attributes). */
30
+ readonly startCol: number;
31
+ readonly aliases: readonly string[];
32
+ }
33
+ /** In-repo C# `Component.InvokeAsync("X")` / `ViewComponent("X")` literals. */
34
+ export declare function extractCsharpViewComponentInvocations(source: string): string[];
35
+ /**
36
+ * Explicit `[ViewComponent(Name = "...")]` aliases keyed to the following
37
+ * class declaration. Positional constructor arguments are ignored: the MVC
38
+ * attribute only exposes `Name` as a property.
39
+ */
40
+ export declare function extractViewComponentAliasBinds(source: string): ViewComponentAliasBind[];
41
+ /** Extract explicit `[ViewComponent(Name = "...")]` aliases by class name. */
42
+ export declare function extractViewComponentAliases(source: string): ReadonlyMap<string, readonly string[]>;
43
+ /** Extract statically resolvable ViewComponent names from one Razor template. */
44
+ export declare function extractRazorViewComponentInvocations(source: string): string[];
45
+ /**
46
+ * Read Razor views once per C# resolution pass. The same ignore rules and file
47
+ * size ceiling as repository scanning are applied, and edge emission later
48
+ * additionally requires a live File node. This prevents ignored, oversized,
49
+ * or concurrently removed templates from entering the graph.
50
+ */
51
+ export declare function loadRazorViewComponentConfig(repoRoot: string): Promise<RazorViewComponentConfig>;
52
+ /**
53
+ * Emit workspace File → in-repo ViewComponent Class CALLS edges.
54
+ *
55
+ * Targets are only Class nodes produced from this repo's `.cs` files. There is
56
+ * no lookup of ASP.NET SDK types; `: ViewComponent` in source is a naming
57
+ * hint, not a resolved EXTENDS edge to `Microsoft.AspNetCore.Mvc.ViewComponent`.
58
+ *
59
+ * Ambiguous component names fail closed: two in-repo classes claiming the
60
+ * same name is not evidence for picking either one.
61
+ */
62
+ export declare function emitRazorViewComponentEdges(graph: KnowledgeGraph, parsedFiles: readonly ParsedFile[], nodeLookup: GraphNodeLookup, config: RazorViewComponentConfig | undefined, csharpSources: ReadonlyMap<string, string>): void;