@spikedpunch/mast 0.1.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.
- package/LICENSE +21 -0
- package/MAST_SPEC.md +2926 -0
- package/README.md +842 -0
- package/assets/skill.md +45 -0
- package/dist/ast/extract.d.ts +65 -0
- package/dist/ast/extract.d.ts.map +1 -0
- package/dist/ast/extract.js +147 -0
- package/dist/ast/extract.js.map +1 -0
- package/dist/ast/extractor.d.ts +85 -0
- package/dist/ast/extractor.d.ts.map +1 -0
- package/dist/ast/extractor.js +2 -0
- package/dist/ast/extractor.js.map +1 -0
- package/dist/ast/extractors/markdown.d.ts +40 -0
- package/dist/ast/extractors/markdown.d.ts.map +1 -0
- package/dist/ast/extractors/markdown.js +175 -0
- package/dist/ast/extractors/markdown.js.map +1 -0
- package/dist/ast/extractors/typescript.d.ts +179 -0
- package/dist/ast/extractors/typescript.d.ts.map +1 -0
- package/dist/ast/extractors/typescript.js +1439 -0
- package/dist/ast/extractors/typescript.js.map +1 -0
- package/dist/ast/parser.d.ts +5 -0
- package/dist/ast/parser.d.ts.map +1 -0
- package/dist/ast/parser.js +21 -0
- package/dist/ast/parser.js.map +1 -0
- package/dist/ast/types.d.ts +586 -0
- package/dist/ast/types.d.ts.map +1 -0
- package/dist/ast/types.js +3 -0
- package/dist/ast/types.js.map +1 -0
- package/dist/cli/docs-cmd.d.ts +22 -0
- package/dist/cli/docs-cmd.d.ts.map +1 -0
- package/dist/cli/docs-cmd.js +100 -0
- package/dist/cli/docs-cmd.js.map +1 -0
- package/dist/cli/index-cmd.d.ts +72 -0
- package/dist/cli/index-cmd.d.ts.map +1 -0
- package/dist/cli/index-cmd.js +263 -0
- package/dist/cli/index-cmd.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init.d.ts +14 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +64 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/install-hooks.d.ts +3 -0
- package/dist/cli/install-hooks.d.ts.map +1 -0
- package/dist/cli/install-hooks.js +34 -0
- package/dist/cli/install-hooks.js.map +1 -0
- package/dist/cli/metrics-cmd.d.ts +3 -0
- package/dist/cli/metrics-cmd.d.ts.map +1 -0
- package/dist/cli/metrics-cmd.js +164 -0
- package/dist/cli/metrics-cmd.js.map +1 -0
- package/dist/cli/program.d.ts +14 -0
- package/dist/cli/program.d.ts.map +1 -0
- package/dist/cli/program.js +44 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/query.d.ts +46 -0
- package/dist/cli/query.d.ts.map +1 -0
- package/dist/cli/query.js +153 -0
- package/dist/cli/query.js.map +1 -0
- package/dist/cli/search-cmd.d.ts +33 -0
- package/dist/cli/search-cmd.d.ts.map +1 -0
- package/dist/cli/search-cmd.js +114 -0
- package/dist/cli/search-cmd.js.map +1 -0
- package/dist/cli/serve.d.ts +3 -0
- package/dist/cli/serve.d.ts.map +1 -0
- package/dist/cli/serve.js +19 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/skill-install.d.ts +39 -0
- package/dist/cli/skill-install.d.ts.map +1 -0
- package/dist/cli/skill-install.js +57 -0
- package/dist/cli/skill-install.js.map +1 -0
- package/dist/cli/status.d.ts +35 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +117 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli/upgrade-cmd.d.ts +48 -0
- package/dist/cli/upgrade-cmd.d.ts.map +1 -0
- package/dist/cli/upgrade-cmd.js +129 -0
- package/dist/cli/upgrade-cmd.js.map +1 -0
- package/dist/cli/version.d.ts +3 -0
- package/dist/cli/version.d.ts.map +1 -0
- package/dist/cli/version.js +19 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/env.d.ts +17 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +17 -0
- package/dist/env.js.map +1 -0
- package/dist/graph/checker-resolver.d.ts +156 -0
- package/dist/graph/checker-resolver.d.ts.map +1 -0
- package/dist/graph/checker-resolver.js +458 -0
- package/dist/graph/checker-resolver.js.map +1 -0
- package/dist/graph/db.d.ts +318 -0
- package/dist/graph/db.d.ts.map +1 -0
- package/dist/graph/db.js +266 -0
- package/dist/graph/db.js.map +1 -0
- package/dist/graph/index.d.ts +4 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +5 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/local-type-env.d.ts +45 -0
- package/dist/graph/local-type-env.d.ts.map +1 -0
- package/dist/graph/local-type-env.js +59 -0
- package/dist/graph/local-type-env.js.map +1 -0
- package/dist/graph/path-range.d.ts +40 -0
- package/dist/graph/path-range.d.ts.map +1 -0
- package/dist/graph/path-range.js +42 -0
- package/dist/graph/path-range.js.map +1 -0
- package/dist/graph/populate.d.ts +263 -0
- package/dist/graph/populate.d.ts.map +1 -0
- package/dist/graph/populate.js +984 -0
- package/dist/graph/populate.js.map +1 -0
- package/dist/graph/queries.d.ts +114 -0
- package/dist/graph/queries.d.ts.map +1 -0
- package/dist/graph/queries.js +415 -0
- package/dist/graph/queries.js.map +1 -0
- package/dist/graph/sqliteBatch.d.ts +48 -0
- package/dist/graph/sqliteBatch.d.ts.map +1 -0
- package/dist/graph/sqliteBatch.js +93 -0
- package/dist/graph/sqliteBatch.js.map +1 -0
- package/dist/indexer/freshness.d.ts +48 -0
- package/dist/indexer/freshness.d.ts.map +1 -0
- package/dist/indexer/freshness.js +72 -0
- package/dist/indexer/freshness.js.map +1 -0
- package/dist/indexer/import-resolver.d.ts +50 -0
- package/dist/indexer/import-resolver.d.ts.map +1 -0
- package/dist/indexer/import-resolver.js +318 -0
- package/dist/indexer/import-resolver.js.map +1 -0
- package/dist/indexer/index.d.ts +249 -0
- package/dist/indexer/index.d.ts.map +1 -0
- package/dist/indexer/index.js +560 -0
- package/dist/indexer/index.js.map +1 -0
- package/dist/indexer/walker.d.ts +60 -0
- package/dist/indexer/walker.d.ts.map +1 -0
- package/dist/indexer/walker.js +128 -0
- package/dist/indexer/walker.js.map +1 -0
- package/dist/indexer/watcher.d.ts +80 -0
- package/dist/indexer/watcher.d.ts.map +1 -0
- package/dist/indexer/watcher.js +151 -0
- package/dist/indexer/watcher.js.map +1 -0
- package/dist/mcp/context.d.ts +23 -0
- package/dist/mcp/context.d.ts.map +1 -0
- package/dist/mcp/context.js +2 -0
- package/dist/mcp/context.js.map +1 -0
- package/dist/mcp/register-tools.d.ts +21 -0
- package/dist/mcp/register-tools.d.ts.map +1 -0
- package/dist/mcp/register-tools.js +42 -0
- package/dist/mcp/register-tools.js.map +1 -0
- package/dist/mcp/server.d.ts +58 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +177 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/staleness.d.ts +72 -0
- package/dist/mcp/staleness.d.ts.map +1 -0
- package/dist/mcp/staleness.js +213 -0
- package/dist/mcp/staleness.js.map +1 -0
- package/dist/mcp/startup.d.ts +40 -0
- package/dist/mcp/startup.d.ts.map +1 -0
- package/dist/mcp/startup.js +114 -0
- package/dist/mcp/startup.js.map +1 -0
- package/dist/mcp/tools/_helpers.d.ts +26 -0
- package/dist/mcp/tools/_helpers.d.ts.map +1 -0
- package/dist/mcp/tools/_helpers.js +54 -0
- package/dist/mcp/tools/_helpers.js.map +1 -0
- package/dist/mcp/tools/callers.d.ts +4 -0
- package/dist/mcp/tools/callers.d.ts.map +1 -0
- package/dist/mcp/tools/callers.js +112 -0
- package/dist/mcp/tools/callers.js.map +1 -0
- package/dist/mcp/tools/dependencies.d.ts +4 -0
- package/dist/mcp/tools/dependencies.d.ts.map +1 -0
- package/dist/mcp/tools/dependencies.js +36 -0
- package/dist/mcp/tools/dependencies.js.map +1 -0
- package/dist/mcp/tools/efficiency.d.ts +4 -0
- package/dist/mcp/tools/efficiency.d.ts.map +1 -0
- package/dist/mcp/tools/efficiency.js +39 -0
- package/dist/mcp/tools/efficiency.js.map +1 -0
- package/dist/mcp/tools/exports.d.ts +4 -0
- package/dist/mcp/tools/exports.d.ts.map +1 -0
- package/dist/mcp/tools/exports.js +56 -0
- package/dist/mcp/tools/exports.js.map +1 -0
- package/dist/mcp/tools/implementors.d.ts +4 -0
- package/dist/mcp/tools/implementors.d.ts.map +1 -0
- package/dist/mcp/tools/implementors.js +47 -0
- package/dist/mcp/tools/implementors.js.map +1 -0
- package/dist/mcp/tools/project-skeleton.d.ts +4 -0
- package/dist/mcp/tools/project-skeleton.d.ts.map +1 -0
- package/dist/mcp/tools/project-skeleton.js +61 -0
- package/dist/mcp/tools/project-skeleton.js.map +1 -0
- package/dist/mcp/tools/reindex.d.ts +14 -0
- package/dist/mcp/tools/reindex.d.ts.map +1 -0
- package/dist/mcp/tools/reindex.js +32 -0
- package/dist/mcp/tools/reindex.js.map +1 -0
- package/dist/mcp/tools/rename-impact.d.ts +4 -0
- package/dist/mcp/tools/rename-impact.d.ts.map +1 -0
- package/dist/mcp/tools/rename-impact.js +124 -0
- package/dist/mcp/tools/rename-impact.js.map +1 -0
- package/dist/mcp/tools/search.d.ts +4 -0
- package/dist/mcp/tools/search.d.ts.map +1 -0
- package/dist/mcp/tools/search.js +69 -0
- package/dist/mcp/tools/search.js.map +1 -0
- package/dist/mcp/tools/signature.d.ts +4 -0
- package/dist/mcp/tools/signature.d.ts.map +1 -0
- package/dist/mcp/tools/signature.js +127 -0
- package/dist/mcp/tools/signature.js.map +1 -0
- package/dist/mcp/tools/status.d.ts +4 -0
- package/dist/mcp/tools/status.d.ts.map +1 -0
- package/dist/mcp/tools/status.js +30 -0
- package/dist/mcp/tools/status.js.map +1 -0
- package/dist/search/declex.d.ts +109 -0
- package/dist/search/declex.d.ts.map +1 -0
- package/dist/search/declex.js +242 -0
- package/dist/search/declex.js.map +1 -0
- package/dist/search/fts.d.ts +77 -0
- package/dist/search/fts.d.ts.map +1 -0
- package/dist/search/fts.js +223 -0
- package/dist/search/fts.js.map +1 -0
- package/dist/search/fused.d.ts +110 -0
- package/dist/search/fused.d.ts.map +1 -0
- package/dist/search/fused.js +323 -0
- package/dist/search/fused.js.map +1 -0
- package/dist/search/potential-matches.d.ts +88 -0
- package/dist/search/potential-matches.d.ts.map +1 -0
- package/dist/search/potential-matches.js +83 -0
- package/dist/search/potential-matches.js.map +1 -0
- package/dist/search/scope.d.ts +66 -0
- package/dist/search/scope.d.ts.map +1 -0
- package/dist/search/scope.js +71 -0
- package/dist/search/scope.js.map +1 -0
- package/dist/store/config.d.ts +57 -0
- package/dist/store/config.d.ts.map +1 -0
- package/dist/store/config.js +208 -0
- package/dist/store/config.js.map +1 -0
- package/dist/store/lock.d.ts +101 -0
- package/dist/store/lock.d.ts.map +1 -0
- package/dist/store/lock.js +182 -0
- package/dist/store/lock.js.map +1 -0
- package/dist/store/lockMetrics.d.ts +52 -0
- package/dist/store/lockMetrics.d.ts.map +1 -0
- package/dist/store/lockMetrics.js +29 -0
- package/dist/store/lockMetrics.js.map +1 -0
- package/dist/store/sqliteChunkStore.d.ts +44 -0
- package/dist/store/sqliteChunkStore.d.ts.map +1 -0
- package/dist/store/sqliteChunkStore.js +135 -0
- package/dist/store/sqliteChunkStore.js.map +1 -0
- package/dist/telemetry/lockMetricsSummary.d.ts +42 -0
- package/dist/telemetry/lockMetricsSummary.d.ts.map +1 -0
- package/dist/telemetry/lockMetricsSummary.js +139 -0
- package/dist/telemetry/lockMetricsSummary.js.map +1 -0
- package/dist/telemetry/metrics.d.ts +140 -0
- package/dist/telemetry/metrics.d.ts.map +1 -0
- package/dist/telemetry/metrics.js +312 -0
- package/dist/telemetry/metrics.js.map +1 -0
- package/dist/telemetry/tokenizer.d.ts +125 -0
- package/dist/telemetry/tokenizer.d.ts.map +1 -0
- package/dist/telemetry/tokenizer.js +174 -0
- package/dist/telemetry/tokenizer.js.map +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { type Tree, type SyntaxNode } from '../parser.js';
|
|
2
|
+
import type { LanguageExtractor, FileExtraction, ExtractorOptions } from '../extractor.js';
|
|
3
|
+
import type { Chunk, Language, SymbolRecord, ImportRecord, EdgeRecord, ParamEntry } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* TypeScript/JavaScript chunk extractor.
|
|
6
|
+
*
|
|
7
|
+
* Implements §10.1 chunking strategy and §10.2 signature extraction.
|
|
8
|
+
* Handles class decomposition (shell + method chunks) and the two-pass
|
|
9
|
+
* walk for `is_exported` detection. tree-sitter parsing is internal —
|
|
10
|
+
* callers only see the `LanguageExtractor` contract.
|
|
11
|
+
*/
|
|
12
|
+
export declare class TypeScriptExtractor implements LanguageExtractor {
|
|
13
|
+
readonly language = "typescript";
|
|
14
|
+
readonly extensions: readonly [".ts", ".tsx", ".js", ".jsx"];
|
|
15
|
+
extract(src: string, filePath: string, fileMtime: number, options: ExtractorOptions): FileExtraction;
|
|
16
|
+
extractChunks(parsedTree: Tree, src: string, filePath: string, fileMtime: number, contextLines: number, chunkSplitThreshold: number): Chunk[];
|
|
17
|
+
declarationHash(node: SyntaxNode, src: string): string;
|
|
18
|
+
bodyHash(node: SyntaxNode, src: string): string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Synthesise the class_shell content: class declaration header + member
|
|
22
|
+
* signatures (TSDoc + signature line, no bodies) + closing brace.
|
|
23
|
+
*/
|
|
24
|
+
export declare function synthesiseClassShell(classNode: SyntaxNode, bodyNode: SyntaxNode | null, src: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Extract declaration text up to (not including) the body block.
|
|
27
|
+
* For interfaces and type aliases the full node is the signature.
|
|
28
|
+
*/
|
|
29
|
+
export declare function extractSignatureText(node: SyntaxNode, src: string): string;
|
|
30
|
+
/** A symbol's declaration as the AST sees it: no body, structured params. */
|
|
31
|
+
export interface ExtractedSignature {
|
|
32
|
+
/** Qualified `Class.method` for methods; bare name otherwise. */
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly line: number;
|
|
35
|
+
readonly signature: string;
|
|
36
|
+
readonly params: readonly ParamEntry[];
|
|
37
|
+
readonly returnType: string | null;
|
|
38
|
+
readonly doc: string | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Extract a body-free signature (plus structured params and return type) for
|
|
42
|
+
* every top-level symbol and class method in `tree`. Used by `mast_signature`
|
|
43
|
+
* and `mast_exports` so they report the declaration, not the function body.
|
|
44
|
+
*/
|
|
45
|
+
export declare function extractSignatures(tree: Tree, src: string): ExtractedSignature[];
|
|
46
|
+
export interface NamedReExport {
|
|
47
|
+
/** Name the barrel exposes (`bar` in `export { foo as bar } from './x'`). */
|
|
48
|
+
readonly exportedName: string;
|
|
49
|
+
/** Name in the source module (`foo` above); equals exportedName when unaliased. */
|
|
50
|
+
readonly sourceName: string;
|
|
51
|
+
readonly line: number;
|
|
52
|
+
/** The `from` clause's module specifier (`'./x'` above) — resolved to a real
|
|
53
|
+
* file by the caller (`extract()`, which has the import resolver in scope),
|
|
54
|
+
* since this pure function has no filesystem access. Carries the file
|
|
55
|
+
* evidence a same-named RE_EXPORTS edge needs to resolve correctly. */
|
|
56
|
+
readonly module: string;
|
|
57
|
+
}
|
|
58
|
+
export interface StarReExport {
|
|
59
|
+
readonly module: string;
|
|
60
|
+
readonly line: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Extract `from`-clause re-exports from a file's top level (§10.1).
|
|
64
|
+
*
|
|
65
|
+
* - `export { Foo, Bar as Baz } from './x'` → named records (one per specifier).
|
|
66
|
+
* - `export * from './x'` (incl. `export * as ns from`) → star record; stars
|
|
67
|
+
* carry no per-symbol names, so they map to `re_export_files` rows rather
|
|
68
|
+
* than symbols/edges.
|
|
69
|
+
*
|
|
70
|
+
* Local aliases without `from` are NOT re-exports — they are handled by
|
|
71
|
+
* `localExportAliases`.
|
|
72
|
+
*/
|
|
73
|
+
export declare function extractReExports(parsedTree: Tree): {
|
|
74
|
+
named: NamedReExport[];
|
|
75
|
+
stars: StarReExport[];
|
|
76
|
+
};
|
|
77
|
+
export declare function sha256(text: string): string;
|
|
78
|
+
export declare function chunkId(filePath: string, startLine: number): string;
|
|
79
|
+
/** Determine language from extension. */
|
|
80
|
+
export declare function languageFromExt(ext: string): Language;
|
|
81
|
+
/**
|
|
82
|
+
* Expand chunk content by `contextLines` around `[startLine, endLine]`.
|
|
83
|
+
* Returns the expanded content slice; `startLine`/`endLine` in the chunk
|
|
84
|
+
* record always reflect AST boundaries, not the expanded region.
|
|
85
|
+
*/
|
|
86
|
+
export declare function expandContent(lines: readonly string[], startLine: number, // 1-indexed
|
|
87
|
+
endLine: number, // 1-indexed, inclusive
|
|
88
|
+
contextLines: number): string;
|
|
89
|
+
/**
|
|
90
|
+
* Derive `SymbolRecord` entries from an already-extracted chunk list.
|
|
91
|
+
* Skips anonymous chunks (`symbol_name === null`) and raw `block` chunks.
|
|
92
|
+
*/
|
|
93
|
+
export declare function symbolsFromChunks(chunks: readonly Chunk[]): SymbolRecord[];
|
|
94
|
+
/**
|
|
95
|
+
* Extract import records from the tree-sitter AST.
|
|
96
|
+
*
|
|
97
|
+
* Handles named imports (`import { foo } from './bar'`). Side-effect imports
|
|
98
|
+
* (`import './side-effect'`), default imports, and namespace imports are
|
|
99
|
+
* recorded with an empty `symbols` array.
|
|
100
|
+
*
|
|
101
|
+
* Specifier-to-file resolution (relative probing, tsconfig aliases, workspace
|
|
102
|
+
* packages) is NOT done here — it needs project context and is applied by
|
|
103
|
+
* `extract.ts` via the import resolver (§13.7).
|
|
104
|
+
*/
|
|
105
|
+
export declare function extractImports(parsedTree: Tree, _filePath: string): ImportRecord[];
|
|
106
|
+
/**
|
|
107
|
+
* Extract graph edge records from a parsed tree:
|
|
108
|
+
* - IMPLEMENTS — class → interface (`implements` clause)
|
|
109
|
+
* - EXTENDS — class/interface → its base (`extends` clause)
|
|
110
|
+
* - PARENT_OF — class → its method symbols
|
|
111
|
+
* - POTENTIAL_CALL — caller symbol → statically-resolved callee (§10.3.1)
|
|
112
|
+
*
|
|
113
|
+
* Edge records use symbol *names*; `insertEdges` resolves them to ids after all
|
|
114
|
+
* files' symbols are inserted (two-pass requirement). A POTENTIAL_CALL whose
|
|
115
|
+
* callee name is not a known indexed symbol is dropped there — that is how the
|
|
116
|
+
* "only a known symbol becomes a verified edge" rule from §10.3 is enforced.
|
|
117
|
+
*
|
|
118
|
+
* `src` is the raw source, used to attach the call-site line + context.
|
|
119
|
+
*
|
|
120
|
+
* `onCallSite` (D7, Stage 4) is an optional diagnostics seam: when provided,
|
|
121
|
+
* it is invoked exactly once per `call_expression` node returned by
|
|
122
|
+
* `collectCalls`, classifying the outcome of resolving that call. It exists
|
|
123
|
+
* to make the invariant "every visited call yields an edge or a recorded
|
|
124
|
+
* drop-reason" assertable in tests (`call-oracle.test.ts`); it is not
|
|
125
|
+
* persisted, configured, or surfaced in any tool response — a future
|
|
126
|
+
* instrumentation hook (E2's registered corpus measurement), not a shipped
|
|
127
|
+
* feature. Leaving it `undefined` (the default) costs one `undefined`-check
|
|
128
|
+
* per call site and zero allocation on the production path.
|
|
129
|
+
*/
|
|
130
|
+
export declare function extractEdges(parsedTree: Tree, _filePath: string, src: string, onCallSite?: (outcome: CallSiteOutcome) => void): EdgeRecord[];
|
|
131
|
+
/**
|
|
132
|
+
* D7 (Stage 4) closed outcome union for the `onCallSite` diagnostics seam.
|
|
133
|
+
* Every `call_expression` node `collectCalls` returns is classified into
|
|
134
|
+
* EXACTLY one of these four buckets by `emitCallEdges` — that totality is
|
|
135
|
+
* the self-oracle invariant `call-oracle.test.ts` asserts over mast's own
|
|
136
|
+
* `src/` corpus:
|
|
137
|
+
*
|
|
138
|
+
* - `edge_emitted`: `parseCallee` extracted a receiver/method AND
|
|
139
|
+
* `LocalTypeEnvironment.resolveCall` linked it — a POTENTIAL_CALL edge
|
|
140
|
+
* was pushed.
|
|
141
|
+
* - `unparseable_callee`: `parseCallee` returned null — the callee shape is
|
|
142
|
+
* not a bare identifier or a member-expression whose receiver
|
|
143
|
+
* `receiverString` can stringify (e.g. a chained call `getX().m()`, or a
|
|
144
|
+
* dynamic/computed receiver `registry['key'].m()`).
|
|
145
|
+
* - `unresolved_receiver`: the callee parsed to a non-null receiver string
|
|
146
|
+
* (`repo`, `this.repo`, `this`, `super`, ...) but `resolveCall` found no
|
|
147
|
+
* binding for it — an unannotated local, a DI container lookup, or any
|
|
148
|
+
* other §10.3.1 "does NOT catch" receiver shape.
|
|
149
|
+
* - `bare_call_unresolved`: the callee parsed as a receiver-less call
|
|
150
|
+
* (`foo()`) but the name matched neither an import nor a same-file symbol.
|
|
151
|
+
*
|
|
152
|
+
* **Boundary**: `collectCalls` does not descend into nested
|
|
153
|
+
* function/method/class bodies (its own skip-list, see below) — those call
|
|
154
|
+
* sites are never handed to `parseCallee` at all and are therefore, by
|
|
155
|
+
* design, outside this invariant. A file with heavy use of inline
|
|
156
|
+
* `function`-expression callbacks will visit fewer calls than it contains.
|
|
157
|
+
*/
|
|
158
|
+
export type CallSiteOutcome = 'edge_emitted' | 'unparseable_callee' | 'unresolved_receiver' | 'bare_call_unresolved';
|
|
159
|
+
/** Collect call_expression nodes within a body, not descending into nested
|
|
160
|
+
* named/anonymous functions, generators, methods, or classes (their bodies
|
|
161
|
+
* are their own scope — non-arrow functions also get their own dynamic
|
|
162
|
+
* `this`, so a `this.foo()` inside one is never the enclosing class
|
|
163
|
+
* instance; F4's `this_method`/`super_method` bindings must not leak in.
|
|
164
|
+
* Arrow functions are deliberately NOT in this list — they inherit the
|
|
165
|
+
* enclosing scope's `this` and calls inside them must still resolve).
|
|
166
|
+
*
|
|
167
|
+
* Exported (D7, Stage 4) so `call-oracle.test.ts` can independently
|
|
168
|
+
* enumerate the same call sites `emitCallEdges` visits, as the ground
|
|
169
|
+
* truth for the `onCallSite` accounting invariant — not part of the
|
|
170
|
+
* extractor's public tool-facing surface. */
|
|
171
|
+
export declare function collectCalls(bodyNode: SyntaxNode): SyntaxNode[];
|
|
172
|
+
/**
|
|
173
|
+
* Extract all identifier tokens from chunk content for `identifier_fts`.
|
|
174
|
+
* Returns a whitespace-separated, deduplicated list of identifier strings.
|
|
175
|
+
* Uses a word-boundary regex — sufficient for the unicode61 tokeniser's
|
|
176
|
+
* identifier-boundary separators.
|
|
177
|
+
*/
|
|
178
|
+
export declare function extractIdentifiers(content: string): string;
|
|
179
|
+
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/ast/extractors/typescript.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAqC,MAAM,iBAAiB,CAAC;AAC9H,OAAO,KAAK,EAAE,KAAK,EAAa,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAoB,UAAU,EAAE,MAAM,aAAa,CAAC;AAQpI;;;;;;;GAOG;AACH,qBAAa,mBAAoB,YAAW,iBAAiB;IAC3D,QAAQ,CAAC,QAAQ,gBAAgB;IACjC,QAAQ,CAAC,UAAU,0CAA2C;IAE9D,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,cAAc;IAkGpG,aAAa,CACX,UAAU,EAAE,IAAI,EAChB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,mBAAmB,EAAE,MAAM,GAC1B,KAAK,EAAE;IA6GV,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAItD,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,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