Skip to main content

Module extract

Module extract 

Source
Expand description

C# and TypeScript declaration and reference extraction.

Structs§

DefRecord
Represents DefRecord.
ExtensionMethod
One extensionMethods entry. Field order (name, thisType, arityMin, arityMax, thisArgs) is significant: it fixes the serialized field order.
Extraction
Represents Extraction.
Fact
One receiver fact: the declared type NAME plus that type’s top-level type-argument descriptors when it carried any. Two facts agree only when BOTH halves do, so Box<int> a and Box<string> a in sibling blocks conflict exactly like two different type names would.
NameRecord
One declared name and the line its own NAME TOKEN sits on. Deliberately not the declaration node’s start row: a member’s span begins at its attribute list, so an attributed member would point a reader at the [ line instead of the line carrying the name they searched for.
RefRecord
Represents RefRecord.
TsBinding
One local name an import statement binds, and the export it names in the source module. imported is "default" for a default clause and "*" for a namespace clause (or a whole-module require).
TsFileExtraction
One TS/JS file’s whole contribution, off ONE parse: its purpose (when the file exports anything) and its reference fragment (always), from the same tree. A parse failure yields None, leaving the file out of BOTH outputs.
TsFragment
The whole per-file fragment, in serialization order: defs, imports, reexports, refs, then default when the file has one. The ts: 1 tag itself lives on the serde type (graph::TsFragment), which this converts into – exactly as extract::Extraction converts into graph::Fragment.
TsFragmentDef
One exported top-level declaration, in the shape the fragment serializes: name, kind, line, in that order.
TsImport
Represents TsImport.
TsReexport
Represents TsReexport.
TsReexportName
export { A as B } from 'm' re-exports A under the name B: exported is what a consumer of THIS file imports, imported is what the source module declares.
TsRef
One recorded reference. Field order (kind, name, optional member, line) is significant.

Enums§

UsingRecord
Represents UsingRecord.

Functions§

compose_hybrid_ts_purpose
Compose a leading-comment hybrid purpose prefix. comment_text is walk::default_purpose_detailed’s output (already ≤100 chars); the SAME global truncate() every other purpose bucket uses applies to the combined string over the RAW (pre-truncation) segment join, so the AST tail fills the remainder under the 200-char cap instead of compounding two independent truncations.
extract
Extract both outputs from one parse of C# source: the file’s purpose signature and its graph fragment (defs, usings, refs, names).
extract_ts_file
Parses TypeScript-family source into its optional purpose and graph fragment.
extract_ts_fragment
Extract the reference fragment (imports, exports, refs) from a parsed TS/JS program node.
extract_ts_purpose
Extract a one-line purpose signature from TS/JS source, or None when the file exports nothing or fails to parse (in which case the caller falls back to the heuristic purpose). grammar comes from parse::ts_grammar_for. PURE – no heuristic or disk access; see extract_ts_purpose_with_heuristic below for the hybrid-aware entry point that mapcmd.rs and run_extract_dump actually use.
extract_ts_purpose_with_heuristic
Hybrid-aware entry point used by mapcmd.rs’s per-file dispatch. Returns None exactly when extract_ts_purpose would (zero-export or parse failure) – a zero-export file has no purpose to prefix. When there IS a purpose, root/rel are used ONLY to ask walk::default_purpose_detailed whether the heuristic’s match for this file came from the comment-marker branch; if so, the comment text is prefixed via compose_hybrid_ts_purpose before the final truncate, else the plain (unprefixed) purpose is returned exactly as extract_ts_purpose would produce it.
extraction_to_json
Serializes a C# extraction as JSON.
run_extract_dump
Extracts the C# file at path and prints the extraction as JSON.
ts_extraction_to_json
Render a TS/JS file’s dump-extract JSON. The reader expects {purpose, defs, usings, refs, names}, and a TS fragment carries no usings and no names, so both keys are dropped – the dump is a three-key object.