gitnexus 1.6.3-rc.2 → 1.6.3-rc.21
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/_shared/graph/types.d.ts +16 -0
- package/dist/_shared/graph/types.d.ts.map +1 -1
- package/dist/_shared/index.d.ts +41 -1
- package/dist/_shared/index.d.ts.map +1 -1
- package/dist/_shared/index.js +28 -0
- package/dist/_shared/index.js.map +1 -1
- package/dist/_shared/scope-resolution/def-index.d.ts +36 -0
- package/dist/_shared/scope-resolution/def-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/def-index.js +51 -0
- package/dist/_shared/scope-resolution/def-index.js.map +1 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.d.ts +139 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.js +479 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.js.map +1 -0
- package/dist/_shared/scope-resolution/method-dispatch-index.d.ts +80 -0
- package/dist/_shared/scope-resolution/method-dispatch-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/method-dispatch-index.js +79 -0
- package/dist/_shared/scope-resolution/method-dispatch-index.js.map +1 -0
- package/dist/_shared/scope-resolution/module-scope-index.d.ts +46 -0
- package/dist/_shared/scope-resolution/module-scope-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/module-scope-index.js +58 -0
- package/dist/_shared/scope-resolution/module-scope-index.js.map +1 -0
- package/dist/_shared/scope-resolution/parsed-file.d.ts +64 -0
- package/dist/_shared/scope-resolution/parsed-file.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/parsed-file.js +42 -0
- package/dist/_shared/scope-resolution/parsed-file.js.map +1 -0
- package/dist/_shared/scope-resolution/position-index.d.ts +62 -0
- package/dist/_shared/scope-resolution/position-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/position-index.js +134 -0
- package/dist/_shared/scope-resolution/position-index.js.map +1 -0
- package/dist/_shared/scope-resolution/qualified-name-index.d.ts +44 -0
- package/dist/_shared/scope-resolution/qualified-name-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/qualified-name-index.js +75 -0
- package/dist/_shared/scope-resolution/qualified-name-index.js.map +1 -0
- package/dist/_shared/scope-resolution/reference-site.d.ts +67 -0
- package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/reference-site.js +24 -0
- package/dist/_shared/scope-resolution/reference-site.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/class-registry.d.ts +27 -0
- package/dist/_shared/scope-resolution/registries/class-registry.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/class-registry.js +30 -0
- package/dist/_shared/scope-resolution/registries/class-registry.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/context.d.ts +69 -0
- package/dist/_shared/scope-resolution/registries/context.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/context.js +44 -0
- package/dist/_shared/scope-resolution/registries/context.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/evidence.d.ts +56 -0
- package/dist/_shared/scope-resolution/registries/evidence.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/evidence.js +150 -0
- package/dist/_shared/scope-resolution/registries/evidence.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/field-registry.d.ts +26 -0
- package/dist/_shared/scope-resolution/registries/field-registry.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/field-registry.js +31 -0
- package/dist/_shared/scope-resolution/registries/field-registry.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/lookup-core.d.ts +81 -0
- package/dist/_shared/scope-resolution/registries/lookup-core.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/lookup-core.js +332 -0
- package/dist/_shared/scope-resolution/registries/lookup-core.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/lookup-qualified.d.ts +33 -0
- package/dist/_shared/scope-resolution/registries/lookup-qualified.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/lookup-qualified.js +56 -0
- package/dist/_shared/scope-resolution/registries/lookup-qualified.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/method-registry.d.ts +36 -0
- package/dist/_shared/scope-resolution/registries/method-registry.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/method-registry.js +32 -0
- package/dist/_shared/scope-resolution/registries/method-registry.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/tie-breaks.d.ts +43 -0
- package/dist/_shared/scope-resolution/registries/tie-breaks.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/tie-breaks.js +60 -0
- package/dist/_shared/scope-resolution/registries/tie-breaks.js.map +1 -0
- package/dist/_shared/scope-resolution/resolve-type-ref.d.ts +53 -0
- package/dist/_shared/scope-resolution/resolve-type-ref.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/resolve-type-ref.js +126 -0
- package/dist/_shared/scope-resolution/resolve-type-ref.js.map +1 -0
- package/dist/_shared/scope-resolution/scope-id.d.ts +43 -0
- package/dist/_shared/scope-resolution/scope-id.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/scope-id.js +46 -0
- package/dist/_shared/scope-resolution/scope-id.js.map +1 -0
- package/dist/_shared/scope-resolution/scope-tree.d.ts +61 -0
- package/dist/_shared/scope-resolution/scope-tree.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/scope-tree.js +186 -0
- package/dist/_shared/scope-resolution/scope-tree.js.map +1 -0
- package/dist/_shared/scope-resolution/shadow/aggregate.d.ts +63 -0
- package/dist/_shared/scope-resolution/shadow/aggregate.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/shadow/aggregate.js +122 -0
- package/dist/_shared/scope-resolution/shadow/aggregate.js.map +1 -0
- package/dist/_shared/scope-resolution/shadow/diff.d.ts +59 -0
- package/dist/_shared/scope-resolution/shadow/diff.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/shadow/diff.js +79 -0
- package/dist/_shared/scope-resolution/shadow/diff.js.map +1 -0
- package/dist/_shared/scope-resolution/types.d.ts +156 -0
- package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
- package/dist/cli/analyze.d.ts +15 -0
- package/dist/cli/analyze.js +22 -1
- package/dist/cli/index.js +4 -0
- package/dist/cli/list.js +11 -1
- package/dist/core/ingestion/emit-references.d.ts +88 -0
- package/dist/core/ingestion/emit-references.js +229 -0
- package/dist/core/ingestion/finalize-orchestrator.d.ts +63 -0
- package/dist/core/ingestion/finalize-orchestrator.js +139 -0
- package/dist/core/ingestion/framework-detection.js +6 -2
- package/dist/core/ingestion/import-target-adapter.d.ts +73 -0
- package/dist/core/ingestion/import-target-adapter.js +95 -0
- package/dist/core/ingestion/language-provider.d.ts +187 -1
- package/dist/core/ingestion/model/scope-resolution-indexes.d.ts +59 -0
- package/dist/core/ingestion/model/scope-resolution-indexes.js +42 -0
- package/dist/core/ingestion/model/semantic-model.d.ts +25 -0
- package/dist/core/ingestion/model/semantic-model.js +16 -0
- package/dist/core/ingestion/parsing-processor.d.ts +9 -0
- package/dist/core/ingestion/parsing-processor.js +10 -0
- package/dist/core/ingestion/registry-primary-flag.d.ts +59 -0
- package/dist/core/ingestion/registry-primary-flag.js +78 -0
- package/dist/core/ingestion/scope-extractor-bridge.d.ts +32 -0
- package/dist/core/ingestion/scope-extractor-bridge.js +44 -0
- package/dist/core/ingestion/scope-extractor.d.ts +87 -0
- package/dist/core/ingestion/scope-extractor.js +603 -0
- package/dist/core/ingestion/shadow-harness.d.ts +113 -0
- package/dist/core/ingestion/shadow-harness.js +148 -0
- package/dist/core/ingestion/workers/parse-worker.d.ts +9 -0
- package/dist/core/ingestion/workers/parse-worker.js +20 -1
- package/dist/core/run-analyze.d.ts +21 -0
- package/dist/core/run-analyze.js +15 -4
- package/dist/core/search/phase-timer.d.ts +72 -0
- package/dist/core/search/phase-timer.js +106 -0
- package/dist/mcp/local/local-backend.js +70 -8
- package/dist/storage/git.d.ts +25 -0
- package/dist/storage/git.js +52 -0
- package/dist/storage/repo-manager.d.ts +70 -1
- package/dist/storage/repo-manager.js +107 -5
- package/package.json +1 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `REGISTRY_PRIMARY_<LANG>` per-language feature flags for the scope-based
|
|
3
|
+
* resolution rollout (RFC §6.1 Ring 3; Ring 2 PKG #924).
|
|
4
|
+
*
|
|
5
|
+
* This module is the single source of truth for whether a given language
|
|
6
|
+
* has been flipped to registry-primary call resolution. When a language's
|
|
7
|
+
* flag is true, its files route through `Registry.lookup` (RFC §4) instead
|
|
8
|
+
* of the legacy call-resolution DAG; when false (the default), the legacy
|
|
9
|
+
* DAG runs unchanged.
|
|
10
|
+
*
|
|
11
|
+
* ## Contract
|
|
12
|
+
*
|
|
13
|
+
* - Env-var name per language: `REGISTRY_PRIMARY_<UPPER(enum-value)>`.
|
|
14
|
+
* Example: `SupportedLanguages.Python` → `REGISTRY_PRIMARY_PYTHON`;
|
|
15
|
+
* `SupportedLanguages.CPlusPlus` (value `'cpp'`) → `REGISTRY_PRIMARY_CPP`.
|
|
16
|
+
* - Truthy values: `'true'`, `'1'`, `'yes'` (case-insensitive,
|
|
17
|
+
* whitespace-trimmed). Anything else — including `undefined`, empty
|
|
18
|
+
* string, or unknown tokens — is `false`.
|
|
19
|
+
* - No per-process caching. `process.env` is read on every call. The
|
|
20
|
+
* flag is consulted once per file at call-resolution time, so the
|
|
21
|
+
* overhead is negligible; skipping caching keeps test isolation
|
|
22
|
+
* trivial (no `resetFlagCache()` coordination needed).
|
|
23
|
+
*
|
|
24
|
+
* ## Integration site
|
|
25
|
+
*
|
|
26
|
+
* `call-processor.ts` integration lands in **#921** (`finalize-orchestrator`)
|
|
27
|
+
* where the `SemanticModel` becomes accessible and `Registry.lookup` can
|
|
28
|
+
* actually be called with a populated context. This module ships the flag
|
|
29
|
+
* primitive in isolation so #921 has a clean, tested utility to consult.
|
|
30
|
+
*
|
|
31
|
+
* ## Shadow mode is orthogonal
|
|
32
|
+
*
|
|
33
|
+
* Shadow mode (`GITNEXUS_SHADOW_MODE=1`, introduced in #923) runs BOTH
|
|
34
|
+
* legacy and registry paths regardless of the per-language flag, so the
|
|
35
|
+
* parity dashboard has signal even for un-flipped languages. That logic
|
|
36
|
+
* lives in `shadow-harness.ts` (#923), not here.
|
|
37
|
+
*/
|
|
38
|
+
import { SupportedLanguages } from '../../_shared/index.js';
|
|
39
|
+
/**
|
|
40
|
+
* Return the env-var name that controls a given language's registry-
|
|
41
|
+
* primary flag. Exported for test assertions and for the PR-labeling
|
|
42
|
+
* CI job that cross-references per-language flag changes.
|
|
43
|
+
*/
|
|
44
|
+
export function envVarNameFor(lang) {
|
|
45
|
+
return `REGISTRY_PRIMARY_${lang.toUpperCase()}`;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Whether `lang` has been flipped to registry-primary call resolution.
|
|
49
|
+
*
|
|
50
|
+
* Returns `false` by default — a language must explicitly set its env
|
|
51
|
+
* var to a truthy value to opt in. The flag is the sole control surface:
|
|
52
|
+
* flipping it requires no code change, and reverting it requires no code
|
|
53
|
+
* change.
|
|
54
|
+
*/
|
|
55
|
+
export function isRegistryPrimary(lang) {
|
|
56
|
+
return parseFlag(process.env[envVarNameFor(lang)]);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* All languages whose registry-primary flag is currently on. Useful for
|
|
60
|
+
* startup-time logging + the shadow-harness dashboard, which wants to
|
|
61
|
+
* distinguish "primary: legacy" from "primary: registry" rows.
|
|
62
|
+
*/
|
|
63
|
+
export function primaryLanguages() {
|
|
64
|
+
const out = new Set();
|
|
65
|
+
for (const lang of Object.values(SupportedLanguages)) {
|
|
66
|
+
if (isRegistryPrimary(lang))
|
|
67
|
+
out.add(lang);
|
|
68
|
+
}
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
// ─── Internal ───────────────────────────────────────────────────────────────
|
|
72
|
+
/** Accepted truthy strings (case-insensitive, trimmed). */
|
|
73
|
+
const TRUTHY_VALUES = new Set(['true', '1', 'yes']);
|
|
74
|
+
function parseFlag(raw) {
|
|
75
|
+
if (raw === undefined)
|
|
76
|
+
return false;
|
|
77
|
+
return TRUTHY_VALUES.has(raw.trim().toLowerCase());
|
|
78
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge between a language provider's `emitScopeCaptures` hook and the
|
|
3
|
+
* `ScopeExtractor` (RFC #909 Ring 2 PKG #920).
|
|
4
|
+
*
|
|
5
|
+
* Extracted into its own module so it can be imported by test code
|
|
6
|
+
* without pulling in `parse-worker.ts` — which has a top-level
|
|
7
|
+
* `parentPort!.on('message', ...)` call that assumes a worker-thread
|
|
8
|
+
* context and throws on direct import.
|
|
9
|
+
*
|
|
10
|
+
* The bridge:
|
|
11
|
+
*
|
|
12
|
+
* 1. Short-circuits when the provider has NOT implemented
|
|
13
|
+
* `emitScopeCaptures`. Returns `undefined`; zero work done. This is
|
|
14
|
+
* the state of every language today — `ParsedFile` production stays
|
|
15
|
+
* dormant until a language migrates.
|
|
16
|
+
* 2. Invokes the hook + feeds its output to `ScopeExtractor.extract`.
|
|
17
|
+
* 3. **Swallows exceptions from either side.** A failure here returns
|
|
18
|
+
* `undefined` and emits a warning via `onWarn`; legacy parsing on
|
|
19
|
+
* the same file continues unaffected by the scope-extraction miss.
|
|
20
|
+
* Scope-based resolution is the new path under construction — it
|
|
21
|
+
* must not destabilize the legacy DAG.
|
|
22
|
+
*/
|
|
23
|
+
import type { ParsedFile } from '../../_shared/index.js';
|
|
24
|
+
import type { LanguageProvider } from './language-provider.js';
|
|
25
|
+
/** Callback used to report scope-extraction warnings to the host (worker or direct). */
|
|
26
|
+
export type ScopeBridgeWarn = (message: string) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Produce a `ParsedFile` for the given file, or `undefined` when the
|
|
29
|
+
* provider hasn't migrated / the extractor throws. Never propagates
|
|
30
|
+
* exceptions.
|
|
31
|
+
*/
|
|
32
|
+
export declare function extractParsedFile(provider: LanguageProvider, sourceText: string, filePath: string, onWarn?: ScopeBridgeWarn): ParsedFile | undefined;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge between a language provider's `emitScopeCaptures` hook and the
|
|
3
|
+
* `ScopeExtractor` (RFC #909 Ring 2 PKG #920).
|
|
4
|
+
*
|
|
5
|
+
* Extracted into its own module so it can be imported by test code
|
|
6
|
+
* without pulling in `parse-worker.ts` — which has a top-level
|
|
7
|
+
* `parentPort!.on('message', ...)` call that assumes a worker-thread
|
|
8
|
+
* context and throws on direct import.
|
|
9
|
+
*
|
|
10
|
+
* The bridge:
|
|
11
|
+
*
|
|
12
|
+
* 1. Short-circuits when the provider has NOT implemented
|
|
13
|
+
* `emitScopeCaptures`. Returns `undefined`; zero work done. This is
|
|
14
|
+
* the state of every language today — `ParsedFile` production stays
|
|
15
|
+
* dormant until a language migrates.
|
|
16
|
+
* 2. Invokes the hook + feeds its output to `ScopeExtractor.extract`.
|
|
17
|
+
* 3. **Swallows exceptions from either side.** A failure here returns
|
|
18
|
+
* `undefined` and emits a warning via `onWarn`; legacy parsing on
|
|
19
|
+
* the same file continues unaffected by the scope-extraction miss.
|
|
20
|
+
* Scope-based resolution is the new path under construction — it
|
|
21
|
+
* must not destabilize the legacy DAG.
|
|
22
|
+
*/
|
|
23
|
+
import { extract as extractScope } from './scope-extractor.js';
|
|
24
|
+
/**
|
|
25
|
+
* Produce a `ParsedFile` for the given file, or `undefined` when the
|
|
26
|
+
* provider hasn't migrated / the extractor throws. Never propagates
|
|
27
|
+
* exceptions.
|
|
28
|
+
*/
|
|
29
|
+
export function extractParsedFile(provider, sourceText, filePath, onWarn) {
|
|
30
|
+
if (provider.emitScopeCaptures === undefined)
|
|
31
|
+
return undefined;
|
|
32
|
+
try {
|
|
33
|
+
const captures = provider.emitScopeCaptures(sourceText, filePath);
|
|
34
|
+
return extractScope(captures, filePath, provider);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
const message = `scope extraction failed for ${filePath}: ${err instanceof Error ? err.message : String(err)}`;
|
|
38
|
+
if (onWarn !== undefined)
|
|
39
|
+
onWarn(message);
|
|
40
|
+
else
|
|
41
|
+
console.warn(message);
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ScopeExtractor` — the central, source-agnostic driver that turns a
|
|
3
|
+
* language provider's `CaptureMatch[]` into a `ParsedFile`
|
|
4
|
+
* (RFC §5.3 + §3.2 Phase 1; Ring 2 PKG #919).
|
|
5
|
+
*
|
|
6
|
+
* Exactly one entry point: `extract(matches, filePath, provider) → ParsedFile`.
|
|
7
|
+
* Runs a five-pass pipeline over the matches. Each pass is internal; the
|
|
8
|
+
* public contract is the output `ParsedFile`.
|
|
9
|
+
*
|
|
10
|
+
* ## Design principles
|
|
11
|
+
*
|
|
12
|
+
* - **Source-agnostic.** Consumes `CaptureMatch[]` from providers;
|
|
13
|
+
* doesn't know whether they came from tree-sitter queries or COBOL's
|
|
14
|
+
* regex tagger. No `Tree` / `SyntaxNode` types leak into this file.
|
|
15
|
+
* - **One AST walk per language.** Providers do the AST walk inside
|
|
16
|
+
* their `emitScopeCaptures` hook; this driver does zero further
|
|
17
|
+
* traversal — it consumes captures only.
|
|
18
|
+
* - **Pure-ish.** The extractor itself is pure (same matches →
|
|
19
|
+
* same ParsedFile) when providers are pure. No side effects, no I/O.
|
|
20
|
+
* - **Centralized invariant enforcement.** Structural invariants on the
|
|
21
|
+
* scope tree (non-module has parent; parent contains child; siblings
|
|
22
|
+
* don't overlap) are enforced by `buildScopeTree` from Ring 2 SHARED
|
|
23
|
+
* (#912). Malformed inputs throw `ScopeTreeInvariantError`.
|
|
24
|
+
*
|
|
25
|
+
* ## The five passes
|
|
26
|
+
*
|
|
27
|
+
* 1. **Build scope tree.** Walk `@scope.*` matches. For each, consult
|
|
28
|
+
* `provider.shouldCreateScope` (default true) and
|
|
29
|
+
* `provider.resolveScopeKind` (default: suffix of the capture name).
|
|
30
|
+
* Derive parent by lexical-range containment. Hand the resulting
|
|
31
|
+
* `Scope[]` to `buildScopeTree` for validation.
|
|
32
|
+
* 2. **Attach declarations + local bindings.** Walk `@declaration.*`
|
|
33
|
+
* matches. For each, build a `SymbolDefinition` and attach it to
|
|
34
|
+
* `provider.bindingScopeFor` (default: innermost containing scope)
|
|
35
|
+
* as `ownedDefs` + a local `BindingRef { origin: 'local' }`.
|
|
36
|
+
* 3. **Collect raw imports.** Walk `@import.*` matches. Call
|
|
37
|
+
* `provider.interpretImport` per match; attach the returned
|
|
38
|
+
* `ParsedImport` to the ParsedFile (not to any `Scope` — finalize
|
|
39
|
+
* reconstructs the owning scope via `provider.importOwningScope`
|
|
40
|
+
* during Phase 2).
|
|
41
|
+
* 4. **Collect type bindings.** Walk `@type-binding.*` matches. Call
|
|
42
|
+
* `provider.interpretTypeBinding` per match. Attach the resulting
|
|
43
|
+
* `TypeRef` to the innermost containing scope's `typeBindings`
|
|
44
|
+
* (or override via `provider.bindingScopeFor` if set).
|
|
45
|
+
* 5. **Collect reference sites.** Walk `@reference.*` matches. Emit
|
|
46
|
+
* one `ReferenceSite` per match. Classify call form via
|
|
47
|
+
* `provider.classifyCallForm` (default: the capture's sub-tag if
|
|
48
|
+
* present; else `'free'`).
|
|
49
|
+
*
|
|
50
|
+
* ## What gets attached where
|
|
51
|
+
*
|
|
52
|
+
* - `Scope.bindings` — **local bindings only** at this stage (Pass 2).
|
|
53
|
+
* Finalize (#915) merges imports/wildcards on top.
|
|
54
|
+
* - `Scope.ownedDefs` — declarations structurally owned by this scope.
|
|
55
|
+
* - `Scope.typeBindings` — local type facts (parameter annotations, `self`).
|
|
56
|
+
* - `Scope.imports` — empty here. Populated by the finalize algorithm
|
|
57
|
+
* when it resolves `ParsedImport.targetRaw`.
|
|
58
|
+
* - `ParsedFile.parsedImports` — every raw import in this file.
|
|
59
|
+
* - `ParsedFile.localDefs` — flattened union of `Scope.ownedDefs`.
|
|
60
|
+
* - `ParsedFile.referenceSites` — pre-resolution usage facts.
|
|
61
|
+
*/
|
|
62
|
+
import type { CaptureMatch, ParsedFile } from '../../_shared/index.js';
|
|
63
|
+
import type { LanguageProvider } from './language-provider.js';
|
|
64
|
+
/**
|
|
65
|
+
* The subset of `LanguageProvider` hooks that `extract()` reads. Declared
|
|
66
|
+
* as its own type so:
|
|
67
|
+
*
|
|
68
|
+
* - Tests can implement just these six hooks without faking the whole
|
|
69
|
+
* `LanguageProvider` interface (which is ~40 fields including the
|
|
70
|
+
* legacy-DAG surface).
|
|
71
|
+
* - The extractor's dependency contract stays explicit — adding a new
|
|
72
|
+
* hook read requires updating this type.
|
|
73
|
+
*
|
|
74
|
+
* Real callers pass a full `LanguageProvider` — structural typing makes it
|
|
75
|
+
* a `ScopeExtractorHooks` for free.
|
|
76
|
+
*/
|
|
77
|
+
export type ScopeExtractorHooks = Pick<LanguageProvider, 'shouldCreateScope' | 'resolveScopeKind' | 'bindingScopeFor' | 'interpretImport' | 'interpretTypeBinding' | 'classifyCallForm'>;
|
|
78
|
+
/**
|
|
79
|
+
* Drive the five extraction passes and return a `ParsedFile`.
|
|
80
|
+
*
|
|
81
|
+
* Throws `ScopeTreeInvariantError` (from #912) when the provider emits
|
|
82
|
+
* captures that violate structural scope invariants. The error surfaces
|
|
83
|
+
* upward rather than being silently corrected — a malformed capture set
|
|
84
|
+
* is a bug in the provider's `emitScopeCaptures`, not a data condition
|
|
85
|
+
* to tolerate.
|
|
86
|
+
*/
|
|
87
|
+
export declare function extract(matches: readonly CaptureMatch[], filePath: string, provider: ScopeExtractorHooks): ParsedFile;
|