@corsa-bind/napi 1.13.2 → 1.14.1
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/README.md +6 -1
- package/dist/checker_batch.d.mts +22 -0
- package/dist/checker_batch.mjs +43 -0
- package/dist/checker_batch.mjs.map +1 -0
- package/dist/index.d.mts +83 -16
- package/dist/index.mjs +75 -2
- package/dist/index.mjs.map +1 -1
- package/dist/orchestrator.d.mts +18 -0
- package/dist/orchestrator.mjs +332 -0
- package/dist/orchestrator.mjs.map +1 -0
- package/dist/orchestrator_types.d.mts +95 -0
- package/dist/orchestrator_types.mjs +1 -0
- package/dist/types.d.mts +92 -1
- package/index.d.ts +64 -20
- package/index.js +59 -55
- package/package.json +16 -9
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ bun run ./main.ts
|
|
|
30
30
|
|
|
31
31
|
- native JS bindings for the `corsa` API and LSP surface
|
|
32
32
|
- an ESM TypeScript wrapper under `dist/`
|
|
33
|
+
- an `@corsa-bind/napi/orchestrator` subpath for workflow-level JS helpers
|
|
33
34
|
- no bundled Corsa executable
|
|
34
35
|
|
|
35
36
|
## Runtime requirement
|
|
@@ -45,6 +46,10 @@ and `closeAsync` for production Node services and editor integrations. The
|
|
|
45
46
|
older synchronous methods remain available for short scripts and latency-bounded
|
|
46
47
|
tooling, but they run on the JavaScript call path.
|
|
47
48
|
|
|
49
|
+
The root entry point intentionally stays close to the upstream binding surface.
|
|
50
|
+
Workflow strategies such as checker query coalescing live under
|
|
51
|
+
`@corsa-bind/napi/orchestrator`.
|
|
52
|
+
|
|
48
53
|
## Development
|
|
49
54
|
|
|
50
55
|
```bash
|
|
@@ -54,5 +59,5 @@ vp test run --config ./vite.config.ts src/bindings/nodejs/corsa_node/ts/**/*.tes
|
|
|
54
59
|
```
|
|
55
60
|
|
|
56
61
|
Repository-level executable examples live under [`examples/`](../../examples/README.md),
|
|
57
|
-
including mock-client, virtual-document,
|
|
62
|
+
including mock-client, virtual-document, and
|
|
58
63
|
real-Corsa snapshot samples.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CheckerBatchRequest, CheckerBatchResponse } from "./types.mjs";
|
|
2
|
+
//#region checker_batch.d.ts
|
|
3
|
+
interface CheckerBatchCapableClient {
|
|
4
|
+
callJson<T>(method: string, params?: unknown): T;
|
|
5
|
+
}
|
|
6
|
+
interface AsyncCheckerBatchCapableClient {
|
|
7
|
+
callJsonAsync<T>(method: string, params?: unknown): Promise<T>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Sends multiple raw checker endpoint calls through upstream `batchRequests`.
|
|
11
|
+
*
|
|
12
|
+
* This keeps the original typed primitives available while giving hot paths a
|
|
13
|
+
* single transport round trip for relation-heavy workflows.
|
|
14
|
+
*/
|
|
15
|
+
declare function batchCheckerRequests(client: CheckerBatchCapableClient, requests: readonly CheckerBatchRequest[]): CheckerBatchResponse[];
|
|
16
|
+
/**
|
|
17
|
+
* Async counterpart of {@link batchCheckerRequests}.
|
|
18
|
+
*/
|
|
19
|
+
declare function batchCheckerRequestsAsync(client: AsyncCheckerBatchCapableClient, requests: readonly CheckerBatchRequest[]): Promise<CheckerBatchResponse[]>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { AsyncCheckerBatchCapableClient, CheckerBatchCapableClient, batchCheckerRequests, batchCheckerRequestsAsync };
|
|
22
|
+
//# sourceMappingURL=checker_batch.d.mts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region checker_batch.ts
|
|
2
|
+
/**
|
|
3
|
+
* Sends multiple raw checker endpoint calls through upstream `batchRequests`.
|
|
4
|
+
*
|
|
5
|
+
* This keeps the original typed primitives available while giving hot paths a
|
|
6
|
+
* single transport round trip for relation-heavy workflows.
|
|
7
|
+
*/
|
|
8
|
+
function batchCheckerRequests(client, requests) {
|
|
9
|
+
if (requests.length === 0) return [];
|
|
10
|
+
return normalizeCheckerBatchResponses(client.callJson("batchRequests", { requests: requests.map(normalizeCheckerBatchRequest) }), requests.length);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Async counterpart of {@link batchCheckerRequests}.
|
|
14
|
+
*/
|
|
15
|
+
async function batchCheckerRequestsAsync(client, requests) {
|
|
16
|
+
if (requests.length === 0) return [];
|
|
17
|
+
return normalizeCheckerBatchResponses(await client.callJsonAsync("batchRequests", { requests: requests.map(normalizeCheckerBatchRequest) }), requests.length);
|
|
18
|
+
}
|
|
19
|
+
function normalizeCheckerBatchRequest(request) {
|
|
20
|
+
if (request.params === void 0) return { method: request.method };
|
|
21
|
+
return {
|
|
22
|
+
method: request.method,
|
|
23
|
+
params: request.params
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function normalizeCheckerBatchResponses(response, expectedLength) {
|
|
27
|
+
if (typeof response !== "object" || response === null) throw new Error("batchRequests returned a malformed response");
|
|
28
|
+
const responses = response.responses;
|
|
29
|
+
if (!Array.isArray(responses)) throw new Error("batchRequests returned a malformed response list");
|
|
30
|
+
if (responses.length !== expectedLength) throw new Error(`batchRequests returned ${responses.length} responses for ${expectedLength} requests`);
|
|
31
|
+
return responses.map((item, index) => {
|
|
32
|
+
if (typeof item !== "object" || item === null) throw new Error(`batchRequests response ${index} is not an object`);
|
|
33
|
+
const record = item;
|
|
34
|
+
const normalized = { method: typeof record.method === "string" ? record.method : "" };
|
|
35
|
+
if (typeof record.error === "string" && record.error.length > 0) normalized.error = record.error;
|
|
36
|
+
if ("result" in record) normalized.result = record.result;
|
|
37
|
+
return normalized;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { batchCheckerRequests, batchCheckerRequestsAsync };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=checker_batch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checker_batch.mjs","names":[],"sources":["../ts/checker_batch.ts"],"sourcesContent":["import type { CheckerBatchRequest, CheckerBatchResponse } from \"./types\";\n\nexport interface CheckerBatchCapableClient {\n callJson<T>(method: string, params?: unknown): T;\n}\n\nexport interface AsyncCheckerBatchCapableClient {\n callJsonAsync<T>(method: string, params?: unknown): Promise<T>;\n}\n\n/**\n * Sends multiple raw checker endpoint calls through upstream `batchRequests`.\n *\n * This keeps the original typed primitives available while giving hot paths a\n * single transport round trip for relation-heavy workflows.\n */\nexport function batchCheckerRequests(\n client: CheckerBatchCapableClient,\n requests: readonly CheckerBatchRequest[],\n): CheckerBatchResponse[] {\n if (requests.length === 0) {\n return [];\n }\n const response = client.callJson<{ responses: unknown }>(\"batchRequests\", {\n requests: requests.map(normalizeCheckerBatchRequest),\n });\n return normalizeCheckerBatchResponses(response, requests.length);\n}\n\n/**\n * Async counterpart of {@link batchCheckerRequests}.\n */\nexport async function batchCheckerRequestsAsync(\n client: AsyncCheckerBatchCapableClient,\n requests: readonly CheckerBatchRequest[],\n): Promise<CheckerBatchResponse[]> {\n if (requests.length === 0) {\n return [];\n }\n const response = await client.callJsonAsync<{ responses: unknown }>(\"batchRequests\", {\n requests: requests.map(normalizeCheckerBatchRequest),\n });\n return normalizeCheckerBatchResponses(response, requests.length);\n}\n\nfunction normalizeCheckerBatchRequest(request: CheckerBatchRequest): CheckerBatchRequest {\n if (request.params === undefined) {\n return { method: request.method };\n }\n return { method: request.method, params: request.params };\n}\n\nfunction normalizeCheckerBatchResponses(\n response: { responses?: unknown },\n expectedLength: number,\n): CheckerBatchResponse[] {\n if (typeof response !== \"object\" || response === null) {\n throw new Error(\"batchRequests returned a malformed response\");\n }\n const responses = response.responses;\n if (!Array.isArray(responses)) {\n throw new Error(\"batchRequests returned a malformed response list\");\n }\n if (responses.length !== expectedLength) {\n throw new Error(\n `batchRequests returned ${responses.length} responses for ${expectedLength} requests`,\n );\n }\n return responses.map((item, index) => {\n if (typeof item !== \"object\" || item === null) {\n throw new Error(`batchRequests response ${index} is not an object`);\n }\n const record = item as Record<string, unknown>;\n const method = typeof record.method === \"string\" ? record.method : \"\";\n const normalized: CheckerBatchResponse = { method };\n if (typeof record.error === \"string\" && record.error.length > 0) {\n normalized.error = record.error;\n }\n if (\"result\" in record) {\n normalized.result = record.result;\n }\n return normalized;\n });\n}\n"],"mappings":";;;;;;;AAgBA,SAAgB,qBACd,QACA,UACwB;CACxB,IAAI,SAAS,WAAW,GACtB,OAAO,CAAC;CAKV,OAAO,+BAHU,OAAO,SAAiC,iBAAiB,EACxE,UAAU,SAAS,IAAI,4BAA4B,EACrD,CAC6C,GAAG,SAAS,MAAM;AACjE;;;;AAKA,eAAsB,0BACpB,QACA,UACiC;CACjC,IAAI,SAAS,WAAW,GACtB,OAAO,CAAC;CAKV,OAAO,+BAA+B,MAHf,OAAO,cAAsC,iBAAiB,EACnF,UAAU,SAAS,IAAI,4BAA4B,EACrD,CAAC,GAC+C,SAAS,MAAM;AACjE;AAEA,SAAS,6BAA6B,SAAmD;CACvF,IAAI,QAAQ,WAAW,KAAA,GACrB,OAAO,EAAE,QAAQ,QAAQ,OAAO;CAElC,OAAO;EAAE,QAAQ,QAAQ;EAAQ,QAAQ,QAAQ;CAAO;AAC1D;AAEA,SAAS,+BACP,UACA,gBACwB;CACxB,IAAI,OAAO,aAAa,YAAY,aAAa,MAC/C,MAAM,IAAI,MAAM,6CAA6C;CAE/D,MAAM,YAAY,SAAS;CAC3B,IAAI,CAAC,MAAM,QAAQ,SAAS,GAC1B,MAAM,IAAI,MAAM,kDAAkD;CAEpE,IAAI,UAAU,WAAW,gBACvB,MAAM,IAAI,MACR,0BAA0B,UAAU,OAAO,iBAAiB,eAAe,UAC7E;CAEF,OAAO,UAAU,KAAK,MAAM,UAAU;EACpC,IAAI,OAAO,SAAS,YAAY,SAAS,MACvC,MAAM,IAAI,MAAM,0BAA0B,MAAM,kBAAkB;EAEpE,MAAM,SAAS;EAEf,MAAM,aAAmC,EAAE,QAD5B,OAAO,OAAO,WAAW,WAAW,OAAO,SAAS,GACjB;EAClD,IAAI,OAAO,OAAO,UAAU,YAAY,OAAO,MAAM,SAAS,GAC5D,WAAW,QAAQ,OAAO;EAE5B,IAAI,YAAY,QACd,WAAW,SAAS,OAAO;EAE7B,OAAO;CACT,CAAC;AACH"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { ApiClientOptions, ApiMode, CapabilitiesResponse, ConfigResponse, DiagnosticsCapabilities, DocumentIdentifier, EditorCapabilities, FileChangeSummary, FileChanges, FileDiagnosticsResponse, InitializeResponse, LspCapabilities, NativeLintDiagnostic, NativeLintFix, NativeLintNode, NativeLintRange, NativeLintRuleMeta, NativeLintSuggestion, NativeNodeMetadataDepth, NativeRuleBridgeRequirements, OverlayCapabilities, OverlayChanges, OverlayUpdate, ProjectDiagnosticsResponse, ProjectResponse, RuntimeCapabilities, SnapshotDiagnosticsResponse, SymbolResponse, TypeResponse, TypeTextKind, UnsafeTypeFlowInput, UpdateSnapshotParams, UpdateSnapshotResponse, VirtualChange, VirtualDocumentState } from "./types.mjs";
|
|
1
|
+
import { ApiClientOptions, ApiMode, CapabilitiesResponse, CheckerBatchRequest, CheckerBatchResponse, ConfigResponse, ContentMapperDefinition, ContentMapping, DiagnosticDirectivePolicy, DiagnosticsCapabilities, DocumentIdentifier, EditorCapabilities, EncodedSourceFile, FileChangeSummary, FileChanges, FileDiagnosticsResponse, InitializeResponse, LspCapabilities, MappedDiagnosticDirective, MappedPosition, MappedRange, NativeLintDiagnostic, NativeLintFix, NativeLintNode, NativeLintRange, NativeLintRuleMeta, NativeLintSuggestion, NativeNodeMetadataDepth, NativeRuleBridgeRequirements, OverlayCapabilities, OverlayChanges, OverlayUpdate, ProjectDiagnosticsResponse, ProjectResponse, RuntimeCapabilities, SnapshotDiagnosticsResponse, SpanMapFidelity, SpanMapKind, SpanMapSegment, SymbolResponse, TextRange, TypeResponse, TypeTextKind, UnsafeTypeFlowInput, UpdateSnapshotParams, UpdateSnapshotResponse, VirtualChange, VirtualDocumentState } from "./types.mjs";
|
|
2
|
+
import { AsyncCheckerBatchCapableClient, CheckerBatchCapableClient, batchCheckerRequests, batchCheckerRequestsAsync } from "./checker_batch.mjs";
|
|
3
|
+
import { CheckerBatchQuery, CheckerBatchResult, CheckerBatchScope, ResolvedCheckerBatchItem } from "./orchestrator_types.mjs";
|
|
2
4
|
//#region index.d.ts
|
|
3
5
|
declare const binding: typeof import("../index.js");
|
|
4
6
|
type CorsaApiClientConstructor = {
|
|
@@ -14,6 +16,8 @@ interface CorsaApiClient {
|
|
|
14
16
|
updateSnapshotAsync(params?: UpdateSnapshotParams): Promise<UpdateSnapshotResponse>;
|
|
15
17
|
getSourceFile(snapshot: string, project: string, file: string): Uint8Array | null;
|
|
16
18
|
getSourceFileAsync(snapshot: string, project: string, file: string): Promise<Uint8Array | null>;
|
|
19
|
+
getEncodedSourceFile(snapshot: string, project: string, file: string): EncodedSourceFile | null;
|
|
20
|
+
getEncodedSourceFileAsync(snapshot: string, project: string, file: string): Promise<EncodedSourceFile | null>;
|
|
17
21
|
getStringType(snapshot: string, project: string): TypeResponse;
|
|
18
22
|
getStringTypeAsync(snapshot: string, project: string): Promise<TypeResponse>;
|
|
19
23
|
getTypeAtPosition(snapshot: string, project: string, file: string, position: number): TypeResponse | null;
|
|
@@ -59,19 +63,6 @@ interface CorsaApiClient {
|
|
|
59
63
|
close(): void;
|
|
60
64
|
closeAsync(): Promise<void>;
|
|
61
65
|
}
|
|
62
|
-
type CorsaDistributedOrchestratorConstructor = {
|
|
63
|
-
new (nodeIds: string[]): CorsaDistributedOrchestrator;
|
|
64
|
-
};
|
|
65
|
-
interface CorsaDistributedOrchestrator {
|
|
66
|
-
campaign(nodeId: string): number;
|
|
67
|
-
leaderId(): string | null;
|
|
68
|
-
state<T>(): T | null;
|
|
69
|
-
nodeState<T>(nodeId: string): T | null;
|
|
70
|
-
document(nodeId: string, uri: string): VirtualDocumentState | null;
|
|
71
|
-
openVirtualDocument(document: VirtualDocumentState): VirtualDocumentState;
|
|
72
|
-
changeVirtualDocument(uri: string, changes: VirtualChange[]): VirtualDocumentState;
|
|
73
|
-
closeVirtualDocument(uri: string): void;
|
|
74
|
-
}
|
|
75
66
|
type CorsaVirtualDocumentConstructor = {
|
|
76
67
|
untitled(path: string, languageId: string, text: string): CorsaVirtualDocument;
|
|
77
68
|
inMemory(authority: string, path: string, languageId: string, text: string): CorsaVirtualDocument;
|
|
@@ -86,8 +77,74 @@ interface CorsaVirtualDocument {
|
|
|
86
77
|
applyChanges(changes: VirtualChange[]): unknown[];
|
|
87
78
|
}
|
|
88
79
|
declare const CorsaApiClient: CorsaApiClientConstructor;
|
|
89
|
-
declare const CorsaDistributedOrchestrator: CorsaDistributedOrchestratorConstructor;
|
|
90
80
|
declare const CorsaVirtualDocument: CorsaVirtualDocumentConstructor;
|
|
81
|
+
/**
|
|
82
|
+
* Bidirectional mapping between a mapper's virtual text and the original file.
|
|
83
|
+
*
|
|
84
|
+
* Every query takes an optional `feature` bitmask (see {@link SpanMap}); when it
|
|
85
|
+
* is omitted, all features are considered.
|
|
86
|
+
*/
|
|
87
|
+
interface CorsaSpanMap {
|
|
88
|
+
readonly segments: SpanMapSegment[];
|
|
89
|
+
readonly segmentCount: number;
|
|
90
|
+
virtualToOriginalPosition(position: number, feature?: number): MappedPosition;
|
|
91
|
+
virtualToOriginalSpan(pos: number, end: number, feature?: number): MappedRange;
|
|
92
|
+
originalToVirtualPositions(position: number, feature?: number): MappedPosition[];
|
|
93
|
+
originalToVirtualSpans(pos: number, end: number, feature?: number): MappedRange[];
|
|
94
|
+
}
|
|
95
|
+
type CorsaSpanMapConstructor = {
|
|
96
|
+
fromSegments(segments: readonly SpanMapSegment[]): CorsaSpanMap;
|
|
97
|
+
};
|
|
98
|
+
declare const CorsaSpanMap: CorsaSpanMapConstructor;
|
|
99
|
+
/** Decodes the source-file fields of a `getSourceFile` payload. */
|
|
100
|
+
declare const decodeSourceFile: (payload: Uint8Array) => EncodedSourceFile;
|
|
101
|
+
/** Reports whether a `getSourceFile` payload came out of a content mapper. */
|
|
102
|
+
declare const isContentMappedSourceFile: (payload: Uint8Array) => boolean;
|
|
103
|
+
/** Builds the span map of a payload, or `null` when the file is not mapped. */
|
|
104
|
+
declare const spanMapForSourceFile: (payload: Uint8Array) => CorsaSpanMap | null;
|
|
105
|
+
/** Reads the content mappers a parsed `tsconfig` declares. */
|
|
106
|
+
declare const contentMappersFromConfig: (config: unknown) => ContentMapperDefinition[];
|
|
107
|
+
/**
|
|
108
|
+
* Numeric enums mirrored from upstream `spanMapKind`, `spanMapFidelity`, and
|
|
109
|
+
* `spanMapFeature`.
|
|
110
|
+
*/
|
|
111
|
+
declare const SpanMap: Readonly<{
|
|
112
|
+
readonly Kind: Readonly<{
|
|
113
|
+
Verbatim: 0;
|
|
114
|
+
Atom: 1;
|
|
115
|
+
Alias: 2;
|
|
116
|
+
}>;
|
|
117
|
+
readonly Fidelity: Readonly<{
|
|
118
|
+
Exact: 0;
|
|
119
|
+
Atom: 1;
|
|
120
|
+
Approximate: 2;
|
|
121
|
+
None: 3;
|
|
122
|
+
}>;
|
|
123
|
+
readonly Feature: Readonly<{
|
|
124
|
+
Hover: number;
|
|
125
|
+
SignatureHelp: number;
|
|
126
|
+
Completion: number;
|
|
127
|
+
Definition: number;
|
|
128
|
+
TypeDefinition: number;
|
|
129
|
+
Implementation: number;
|
|
130
|
+
References: number;
|
|
131
|
+
DocumentHighlights: number;
|
|
132
|
+
Rename: number;
|
|
133
|
+
CallHierarchy: number;
|
|
134
|
+
CodeActions: number;
|
|
135
|
+
Formatting: number;
|
|
136
|
+
InlayHints: number;
|
|
137
|
+
SemanticTokens: number;
|
|
138
|
+
FoldingRanges: number;
|
|
139
|
+
SelectionRanges: number;
|
|
140
|
+
LinkedEditing: number;
|
|
141
|
+
AutoInsert: number;
|
|
142
|
+
DocumentSymbols: number;
|
|
143
|
+
CodeLens: number;
|
|
144
|
+
None: 0;
|
|
145
|
+
All: number;
|
|
146
|
+
}>;
|
|
147
|
+
}>;
|
|
91
148
|
declare const version: () => string;
|
|
92
149
|
declare const spawnCorsaApiClientAsync: (options: ApiClientOptions) => Promise<CorsaApiClient>;
|
|
93
150
|
declare const isUnsafeAssignment: (input: UnsafeTypeFlowInput) => boolean;
|
|
@@ -106,6 +163,16 @@ declare const isArrayLikeTypeTexts: (typeTexts: readonly string[]) => boolean;
|
|
|
106
163
|
declare const isStringArrayLikeTypeTexts: (typeTexts: readonly string[]) => boolean;
|
|
107
164
|
declare const isPromiseLikeTypeTexts: (typeTexts: readonly string[], propertyNames?: readonly string[]) => boolean;
|
|
108
165
|
declare const isErrorLikeTypeTexts: (typeTexts: readonly string[], propertyNames?: readonly string[]) => boolean;
|
|
166
|
+
/**
|
|
167
|
+
* @deprecated Import from `@corsa-bind/napi/orchestrator` instead. The root
|
|
168
|
+
* export remains as a compatibility shim and warns once at runtime.
|
|
169
|
+
*/
|
|
170
|
+
declare function resolveCheckerBatch(client: CheckerBatchCapableClient, scope: CheckerBatchScope, queries: readonly CheckerBatchQuery[]): ResolvedCheckerBatchItem[];
|
|
171
|
+
/**
|
|
172
|
+
* @deprecated Import from `@corsa-bind/napi/orchestrator` instead. The root
|
|
173
|
+
* export remains as a compatibility shim and warns once at runtime.
|
|
174
|
+
*/
|
|
175
|
+
declare function resolveCheckerBatchAsync(client: AsyncCheckerBatchCapableClient, scope: CheckerBatchScope, queries: readonly CheckerBatchQuery[]): Promise<ResolvedCheckerBatchItem[]>;
|
|
109
176
|
declare const Utils: Readonly<{
|
|
110
177
|
classifyTypeText: (text?: string) => TypeTextKind;
|
|
111
178
|
splitTopLevelTypeText: (text: string, delimiter: string) => string[];
|
|
@@ -121,5 +188,5 @@ declare const Utils: Readonly<{
|
|
|
121
188
|
isErrorLikeTypeTexts: (typeTexts: readonly string[], propertyNames?: readonly string[]) => boolean;
|
|
122
189
|
}>;
|
|
123
190
|
//#endregion
|
|
124
|
-
export { type ApiClientOptions, type ApiMode, type CapabilitiesResponse, type ConfigResponse, CorsaApiClient,
|
|
191
|
+
export { type ApiClientOptions, type ApiMode, type AsyncCheckerBatchCapableClient, type CapabilitiesResponse, type CheckerBatchCapableClient, type CheckerBatchQuery, type CheckerBatchRequest, type CheckerBatchResponse, type CheckerBatchResult, type CheckerBatchScope, type ConfigResponse, type ContentMapperDefinition, type ContentMapping, CorsaApiClient, CorsaSpanMap, CorsaVirtualDocument, type DiagnosticDirectivePolicy, type DiagnosticsCapabilities, type DocumentIdentifier, type EditorCapabilities, type EncodedSourceFile, type FileChangeSummary, type FileChanges, type FileDiagnosticsResponse, type InitializeResponse, type LspCapabilities, type MappedDiagnosticDirective, type MappedPosition, type MappedRange, type NativeLintDiagnostic, type NativeLintFix, type NativeLintNode, type NativeLintRange, type NativeLintRuleMeta, type NativeLintSuggestion, type NativeNodeMetadataDepth, type NativeRuleBridgeRequirements, type OverlayCapabilities, type OverlayChanges, type OverlayUpdate, type ProjectDiagnosticsResponse, type ProjectResponse, type ResolvedCheckerBatchItem, type RuntimeCapabilities, type SnapshotDiagnosticsResponse, SpanMap, type SpanMapFidelity, type SpanMapKind, type SpanMapSegment, type SymbolResponse, type TextRange, type TypeResponse, type TypeTextKind, type UnsafeTypeFlowInput, type UpdateSnapshotParams, type UpdateSnapshotResponse, Utils, type VirtualChange, type VirtualDocumentState, batchCheckerRequests, batchCheckerRequestsAsync, classifyTypeText, contentMappersFromConfig, decodeSourceFile, binding as default, isAnyLikeTypeTexts, isArrayLikeTypeTexts, isBigIntLikeTypeTexts, isContentMappedSourceFile, isErrorLikeTypeTexts, isNumberLikeTypeTexts, isPromiseLikeTypeTexts, isStringArrayLikeTypeTexts, isStringLikeTypeTexts, isUnknownLikeTypeTexts, isUnsafeAssignment, isUnsafeReturn, nativeLintRuleMetas, resolveCheckerBatch, resolveCheckerBatchAsync, runNativeLintRule, spanMapForSourceFile, spawnCorsaApiClientAsync, splitTopLevelTypeText, splitTypeText, version };
|
|
125
192
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,60 @@
|
|
|
1
|
+
import { batchCheckerRequests, batchCheckerRequestsAsync } from "./checker_batch.mjs";
|
|
2
|
+
import { resolveCheckerBatch as resolveCheckerBatch$1, resolveCheckerBatchAsync as resolveCheckerBatchAsync$1 } from "./orchestrator.mjs";
|
|
1
3
|
import * as nativeModule from "../index.js";
|
|
2
4
|
//#region index.ts
|
|
3
5
|
const binding = "default" in nativeModule ? nativeModule.default : nativeModule;
|
|
4
6
|
const CorsaApiClient = binding.CorsaApiClient;
|
|
5
|
-
const CorsaDistributedOrchestrator = binding.CorsaDistributedOrchestrator;
|
|
6
7
|
const CorsaVirtualDocument = binding.CorsaVirtualDocument;
|
|
8
|
+
const CorsaSpanMap = binding.CorsaSpanMap;
|
|
9
|
+
/** Decodes the source-file fields of a `getSourceFile` payload. */
|
|
10
|
+
const decodeSourceFile = binding.decodeSourceFile;
|
|
11
|
+
/** Reports whether a `getSourceFile` payload came out of a content mapper. */
|
|
12
|
+
const isContentMappedSourceFile = binding.isContentMappedSourceFile;
|
|
13
|
+
/** Builds the span map of a payload, or `null` when the file is not mapped. */
|
|
14
|
+
const spanMapForSourceFile = binding.spanMapForSourceFile;
|
|
15
|
+
/** Reads the content mappers a parsed `tsconfig` declares. */
|
|
16
|
+
const contentMappersFromConfig = binding.contentMappersFromConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Numeric enums mirrored from upstream `spanMapKind`, `spanMapFidelity`, and
|
|
19
|
+
* `spanMapFeature`.
|
|
20
|
+
*/
|
|
21
|
+
const SpanMap = Object.freeze({
|
|
22
|
+
Kind: Object.freeze({
|
|
23
|
+
Verbatim: 0,
|
|
24
|
+
Atom: 1,
|
|
25
|
+
Alias: 2
|
|
26
|
+
}),
|
|
27
|
+
Fidelity: Object.freeze({
|
|
28
|
+
Exact: 0,
|
|
29
|
+
Atom: 1,
|
|
30
|
+
Approximate: 2,
|
|
31
|
+
None: 3
|
|
32
|
+
}),
|
|
33
|
+
Feature: Object.freeze({
|
|
34
|
+
Hover: 1,
|
|
35
|
+
SignatureHelp: 2,
|
|
36
|
+
Completion: 4,
|
|
37
|
+
Definition: 8,
|
|
38
|
+
TypeDefinition: 16,
|
|
39
|
+
Implementation: 32,
|
|
40
|
+
References: 64,
|
|
41
|
+
DocumentHighlights: 128,
|
|
42
|
+
Rename: 256,
|
|
43
|
+
CallHierarchy: 512,
|
|
44
|
+
CodeActions: 1024,
|
|
45
|
+
Formatting: 2048,
|
|
46
|
+
InlayHints: 4096,
|
|
47
|
+
SemanticTokens: 8192,
|
|
48
|
+
FoldingRanges: 16384,
|
|
49
|
+
SelectionRanges: 32768,
|
|
50
|
+
LinkedEditing: 65536,
|
|
51
|
+
AutoInsert: 1 << 17,
|
|
52
|
+
DocumentSymbols: 1 << 18,
|
|
53
|
+
CodeLens: 1 << 19,
|
|
54
|
+
None: 0,
|
|
55
|
+
All: (1 << 20) - 1
|
|
56
|
+
})
|
|
57
|
+
});
|
|
7
58
|
const version = binding.version;
|
|
8
59
|
const spawnCorsaApiClientAsync = binding.spawnCorsaApiClientAsync;
|
|
9
60
|
const isUnsafeAssignment = binding.isUnsafeAssignment;
|
|
@@ -22,6 +73,23 @@ const isArrayLikeTypeTexts = binding.isArrayLikeTypeTexts;
|
|
|
22
73
|
const isStringArrayLikeTypeTexts = binding.isStringArrayLikeTypeTexts;
|
|
23
74
|
const isPromiseLikeTypeTexts = binding.isPromiseLikeTypeTexts;
|
|
24
75
|
const isErrorLikeTypeTexts = binding.isErrorLikeTypeTexts;
|
|
76
|
+
let rootCheckerBatchResolverWarningShown = false;
|
|
77
|
+
/**
|
|
78
|
+
* @deprecated Import from `@corsa-bind/napi/orchestrator` instead. The root
|
|
79
|
+
* export remains as a compatibility shim and warns once at runtime.
|
|
80
|
+
*/
|
|
81
|
+
function resolveCheckerBatch(client, scope, queries) {
|
|
82
|
+
warnRootCheckerBatchResolver();
|
|
83
|
+
return resolveCheckerBatch$1(client, scope, queries);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @deprecated Import from `@corsa-bind/napi/orchestrator` instead. The root
|
|
87
|
+
* export remains as a compatibility shim and warns once at runtime.
|
|
88
|
+
*/
|
|
89
|
+
async function resolveCheckerBatchAsync(client, scope, queries) {
|
|
90
|
+
warnRootCheckerBatchResolver();
|
|
91
|
+
return resolveCheckerBatchAsync$1(client, scope, queries);
|
|
92
|
+
}
|
|
25
93
|
const Utils = Object.freeze({
|
|
26
94
|
classifyTypeText,
|
|
27
95
|
splitTopLevelTypeText,
|
|
@@ -36,7 +104,12 @@ const Utils = Object.freeze({
|
|
|
36
104
|
isPromiseLikeTypeTexts,
|
|
37
105
|
isErrorLikeTypeTexts
|
|
38
106
|
});
|
|
107
|
+
function warnRootCheckerBatchResolver() {
|
|
108
|
+
if (rootCheckerBatchResolverWarningShown) return;
|
|
109
|
+
rootCheckerBatchResolverWarningShown = true;
|
|
110
|
+
console.warn("@corsa-bind/napi: resolveCheckerBatch is a compatibility shim; import from @corsa-bind/napi/orchestrator for new code.");
|
|
111
|
+
}
|
|
39
112
|
//#endregion
|
|
40
|
-
export { CorsaApiClient,
|
|
113
|
+
export { CorsaApiClient, CorsaSpanMap, CorsaVirtualDocument, SpanMap, Utils, batchCheckerRequests, batchCheckerRequestsAsync, classifyTypeText, contentMappersFromConfig, decodeSourceFile, binding as default, isAnyLikeTypeTexts, isArrayLikeTypeTexts, isBigIntLikeTypeTexts, isContentMappedSourceFile, isErrorLikeTypeTexts, isNumberLikeTypeTexts, isPromiseLikeTypeTexts, isStringArrayLikeTypeTexts, isStringLikeTypeTexts, isUnknownLikeTypeTexts, isUnsafeAssignment, isUnsafeReturn, nativeLintRuleMetas, resolveCheckerBatch, resolveCheckerBatchAsync, runNativeLintRule, spanMapForSourceFile, spawnCorsaApiClientAsync, splitTopLevelTypeText, splitTypeText, version };
|
|
41
114
|
|
|
42
115
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../ts/index.ts"],"sourcesContent":["import * as nativeModule from \"../index.js\";\n\nimport type {\n ApiClientOptions,\n ConfigResponse,\n InitializeResponse,\n NativeLintDiagnostic,\n NativeLintNode,\n NativeLintRuleMeta,\n SymbolResponse,\n TypeResponse,\n TypeTextKind,\n UnsafeTypeFlowInput,\n UpdateSnapshotParams,\n UpdateSnapshotResponse,\n VirtualChange,\n VirtualDocumentState,\n} from \"./types\";\n\nconst binding = (\n \"default\" in nativeModule ? nativeModule.default : nativeModule\n) as typeof import(\"../index.js\");\n\ntype CorsaApiClientConstructor = {\n spawn(options: ApiClientOptions): CorsaApiClient;\n spawnAsync(options: ApiClientOptions): Promise<CorsaApiClient>;\n};\n\nexport interface CorsaApiClient {\n initialize(): InitializeResponse;\n initializeAsync(): Promise<InitializeResponse>;\n parseConfigFile(file: string): ConfigResponse;\n parseConfigFileAsync(file: string): Promise<ConfigResponse>;\n updateSnapshot(params?: UpdateSnapshotParams): UpdateSnapshotResponse;\n updateSnapshotAsync(params?: UpdateSnapshotParams): Promise<UpdateSnapshotResponse>;\n getSourceFile(snapshot: string, project: string, file: string): Uint8Array | null;\n getSourceFileAsync(snapshot: string, project: string, file: string): Promise<Uint8Array | null>;\n getStringType(snapshot: string, project: string): TypeResponse;\n getStringTypeAsync(snapshot: string, project: string): Promise<TypeResponse>;\n getTypeAtPosition(\n snapshot: string,\n project: string,\n file: string,\n position: number,\n ): TypeResponse | null;\n getTypeAtPositionAsync(\n snapshot: string,\n project: string,\n file: string,\n position: number,\n ): Promise<TypeResponse | null>;\n getTypesAtPositions(\n snapshot: string,\n project: string,\n file: string,\n positions: number[],\n ): Array<TypeResponse | null>;\n getTypesAtPositionsAsync(\n snapshot: string,\n project: string,\n file: string,\n positions: number[],\n ): Promise<Array<TypeResponse | null>>;\n getTypeAtSourceRange(\n snapshot: string,\n project: string,\n file: string,\n start: number,\n end: number,\n sourceText: string,\n kind?: string,\n ): TypeResponse | null;\n getTypeAtSourceRangeAsync(\n snapshot: string,\n project: string,\n file: string,\n start: number,\n end: number,\n sourceText: string,\n kind?: string,\n ): Promise<TypeResponse | null>;\n getSymbolAtPosition(\n snapshot: string,\n project: string,\n file: string,\n position: number,\n ): SymbolResponse | null;\n getSymbolAtPositionAsync(\n snapshot: string,\n project: string,\n file: string,\n position: number,\n ): Promise<SymbolResponse | null>;\n getSymbolsAtPositions(\n snapshot: string,\n project: string,\n file: string,\n positions: number[],\n ): Array<SymbolResponse | null>;\n getSymbolsAtPositionsAsync(\n snapshot: string,\n project: string,\n file: string,\n positions: number[],\n ): Promise<Array<SymbolResponse | null>>;\n getAliasedSymbol(snapshot: string, project: string, symbol: string): SymbolResponse | null;\n getAliasedSymbolAsync(\n snapshot: string,\n project: string,\n symbol: string,\n ): Promise<SymbolResponse | null>;\n getImmediateAliasedSymbol(\n snapshot: string,\n project: string,\n symbol: string,\n ): SymbolResponse | null;\n getImmediateAliasedSymbolAsync(\n snapshot: string,\n project: string,\n symbol: string,\n ): Promise<SymbolResponse | null>;\n getExportsOfModule(snapshot: string, project: string, symbol: string): SymbolResponse[];\n getExportsOfModuleAsync(\n snapshot: string,\n project: string,\n symbol: string,\n ): Promise<SymbolResponse[]>;\n getSymbolOfType(snapshot: string, typeHandle: string, project?: string): SymbolResponse | null;\n getSymbolOfTypeAsync(\n snapshot: string,\n typeHandle: string,\n project?: string,\n ): Promise<SymbolResponse | null>;\n getTypeArguments(\n snapshot: string,\n project: string,\n typeHandle: string,\n objectFlags?: number,\n ): TypeResponse[];\n getTypeArgumentsAtSourceRange(\n snapshot: string,\n project: string,\n typeHandle: string,\n objectFlags: number | undefined | null,\n file: string,\n start: number,\n end: number,\n sourceText: string,\n ): TypeResponse[];\n getTypeArgumentsAsync(\n snapshot: string,\n project: string,\n typeHandle: string,\n objectFlags?: number,\n ): Promise<TypeResponse[]>;\n getTypeArgumentsAtSourceRangeAsync(\n snapshot: string,\n project: string,\n typeHandle: string,\n objectFlags: number | undefined | null,\n file: string,\n start: number,\n end: number,\n sourceText: string,\n ): Promise<TypeResponse[]>;\n getPropertyOfType(\n snapshot: string,\n project: string,\n typeHandle: string,\n name: string,\n ): SymbolResponse | null;\n getPropertyOfTypeAsync(\n snapshot: string,\n project: string,\n typeHandle: string,\n name: string,\n ): Promise<SymbolResponse | null>;\n isTypeAssignableTo(snapshot: string, project: string, source: string, target: string): boolean;\n isTypeAssignableToAsync(\n snapshot: string,\n project: string,\n source: string,\n target: string,\n ): Promise<boolean>;\n getConstraintOfType(snapshot: string, project: string, typeHandle: string): TypeResponse | null;\n getConstraintOfTypeAsync(\n snapshot: string,\n project: string,\n typeHandle: string,\n ): Promise<TypeResponse | null>;\n getTypeOfSymbol(snapshot: string, project: string, symbol: string): TypeResponse | null;\n getTypeOfSymbolAsync(\n snapshot: string,\n project: string,\n symbol: string,\n ): Promise<TypeResponse | null>;\n getDeclaredTypeOfSymbol(snapshot: string, project: string, symbol: string): TypeResponse | null;\n getDeclaredTypeOfSymbolAsync(\n snapshot: string,\n project: string,\n symbol: string,\n ): Promise<TypeResponse | null>;\n typeToString(\n snapshot: string,\n project: string,\n typeHandle: string,\n location?: string,\n flags?: number,\n ): string;\n typeToStringAsync(\n snapshot: string,\n project: string,\n typeHandle: string,\n location?: string,\n flags?: number,\n ): Promise<string>;\n callJson<T>(method: string, params?: unknown): T;\n callJsonAsync<T>(method: string, params?: unknown): Promise<T>;\n callBinary(method: string, params?: unknown): Uint8Array | null;\n callBinaryAsync(method: string, params?: unknown): Promise<Uint8Array | null>;\n releaseHandle(handle: string): void;\n releaseHandleAsync(handle: string): Promise<void>;\n close(): void;\n closeAsync(): Promise<void>;\n}\n\ntype CorsaDistributedOrchestratorConstructor = {\n new (nodeIds: string[]): CorsaDistributedOrchestrator;\n};\n\nexport interface CorsaDistributedOrchestrator {\n campaign(nodeId: string): number;\n leaderId(): string | null;\n state<T>(): T | null;\n nodeState<T>(nodeId: string): T | null;\n document(nodeId: string, uri: string): VirtualDocumentState | null;\n openVirtualDocument(document: VirtualDocumentState): VirtualDocumentState;\n changeVirtualDocument(uri: string, changes: VirtualChange[]): VirtualDocumentState;\n closeVirtualDocument(uri: string): void;\n}\n\ntype CorsaVirtualDocumentConstructor = {\n untitled(path: string, languageId: string, text: string): CorsaVirtualDocument;\n inMemory(authority: string, path: string, languageId: string, text: string): CorsaVirtualDocument;\n};\n\nexport interface CorsaVirtualDocument {\n readonly uri: string;\n readonly languageId: string;\n readonly version: number;\n readonly text: string;\n state(): VirtualDocumentState;\n replace(text: string): void;\n applyChanges(changes: VirtualChange[]): unknown[];\n}\n\nexport const CorsaApiClient = binding.CorsaApiClient as unknown as CorsaApiClientConstructor;\nexport const CorsaDistributedOrchestrator =\n binding.CorsaDistributedOrchestrator as unknown as CorsaDistributedOrchestratorConstructor;\nexport const CorsaVirtualDocument =\n binding.CorsaVirtualDocument as unknown as CorsaVirtualDocumentConstructor;\n\nexport const version = binding.version as () => string;\nexport const spawnCorsaApiClientAsync = binding.spawnCorsaApiClientAsync as (\n options: ApiClientOptions,\n) => Promise<CorsaApiClient>;\nexport const isUnsafeAssignment = binding.isUnsafeAssignment as (\n input: UnsafeTypeFlowInput,\n) => boolean;\nexport const isUnsafeReturn = binding.isUnsafeReturn as (input: UnsafeTypeFlowInput) => boolean;\nexport const runNativeLintRule = binding.runNativeLintRule as (\n ruleName: string,\n node: NativeLintNode,\n) => NativeLintDiagnostic[];\nexport const nativeLintRuleMetas = binding.nativeLintRuleMetas as () => NativeLintRuleMeta[];\nexport const classifyTypeText = binding.classifyTypeText as (text?: string) => TypeTextKind;\nexport const splitTopLevelTypeText = binding.splitTopLevelTypeText as (\n text: string,\n delimiter: string,\n) => string[];\nexport const splitTypeText = binding.splitTypeText as (text: string) => string[];\nexport const isStringLikeTypeTexts = binding.isStringLikeTypeTexts as (\n typeTexts: readonly string[],\n) => boolean;\nexport const isNumberLikeTypeTexts = binding.isNumberLikeTypeTexts as (\n typeTexts: readonly string[],\n) => boolean;\nexport const isBigIntLikeTypeTexts = binding.isBigIntLikeTypeTexts as (\n typeTexts: readonly string[],\n) => boolean;\nexport const isAnyLikeTypeTexts = binding.isAnyLikeTypeTexts as (\n typeTexts: readonly string[],\n) => boolean;\nexport const isUnknownLikeTypeTexts = binding.isUnknownLikeTypeTexts as (\n typeTexts: readonly string[],\n) => boolean;\nexport const isArrayLikeTypeTexts = binding.isArrayLikeTypeTexts as (\n typeTexts: readonly string[],\n) => boolean;\nexport const isStringArrayLikeTypeTexts = binding.isStringArrayLikeTypeTexts as (\n typeTexts: readonly string[],\n) => boolean;\nexport const isPromiseLikeTypeTexts = binding.isPromiseLikeTypeTexts as (\n typeTexts: readonly string[],\n propertyNames?: readonly string[],\n) => boolean;\nexport const isErrorLikeTypeTexts = binding.isErrorLikeTypeTexts as (\n typeTexts: readonly string[],\n propertyNames?: readonly string[],\n) => boolean;\n\nexport const Utils = Object.freeze({\n classifyTypeText,\n splitTopLevelTypeText,\n splitTypeText,\n isStringLikeTypeTexts,\n isNumberLikeTypeTexts,\n isBigIntLikeTypeTexts,\n isAnyLikeTypeTexts,\n isUnknownLikeTypeTexts,\n isArrayLikeTypeTexts,\n isStringArrayLikeTypeTexts,\n isPromiseLikeTypeTexts,\n isErrorLikeTypeTexts,\n});\n\nexport default binding;\nexport type * from \"./types\";\n"],"mappings":";;AAmBA,MAAM,UACJ,aAAa,eAAe,aAAa,UAAU;AA4OrD,MAAa,iBAAiB,QAAQ;AACtC,MAAa,+BACX,QAAQ;AACV,MAAa,uBACX,QAAQ;AAEV,MAAa,UAAU,QAAQ;AAC/B,MAAa,2BAA2B,QAAQ;AAGhD,MAAa,qBAAqB,QAAQ;AAG1C,MAAa,iBAAiB,QAAQ;AACtC,MAAa,oBAAoB,QAAQ;AAIzC,MAAa,sBAAsB,QAAQ;AAC3C,MAAa,mBAAmB,QAAQ;AACxC,MAAa,wBAAwB,QAAQ;AAI7C,MAAa,gBAAgB,QAAQ;AACrC,MAAa,wBAAwB,QAAQ;AAG7C,MAAa,wBAAwB,QAAQ;AAG7C,MAAa,wBAAwB,QAAQ;AAG7C,MAAa,qBAAqB,QAAQ;AAG1C,MAAa,yBAAyB,QAAQ;AAG9C,MAAa,uBAAuB,QAAQ;AAG5C,MAAa,6BAA6B,QAAQ;AAGlD,MAAa,yBAAyB,QAAQ;AAI9C,MAAa,uBAAuB,QAAQ;AAK5C,MAAa,QAAQ,OAAO,OAAO;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["resolveCheckerBatchFromOrchestrator","resolveCheckerBatchAsyncFromOrchestrator"],"sources":["../ts/index.ts"],"sourcesContent":["import * as nativeModule from \"../index.js\";\n\nimport {\n resolveCheckerBatch as resolveCheckerBatchFromOrchestrator,\n resolveCheckerBatchAsync as resolveCheckerBatchAsyncFromOrchestrator,\n} from \"./orchestrator\";\nimport type { AsyncCheckerBatchCapableClient, CheckerBatchCapableClient } from \"./checker_batch\";\nimport type {\n CheckerBatchQuery,\n CheckerBatchScope,\n ResolvedCheckerBatchItem,\n} from \"./orchestrator_types\";\nimport type {\n ApiClientOptions,\n ConfigResponse,\n ContentMapperDefinition,\n EncodedSourceFile,\n InitializeResponse,\n MappedPosition,\n MappedRange,\n SpanMapSegment,\n NativeLintDiagnostic,\n NativeLintNode,\n NativeLintRuleMeta,\n SymbolResponse,\n TypeResponse,\n TypeTextKind,\n UnsafeTypeFlowInput,\n UpdateSnapshotParams,\n UpdateSnapshotResponse,\n VirtualChange,\n VirtualDocumentState,\n} from \"./types\";\n\nconst binding = (\n \"default\" in nativeModule ? nativeModule.default : nativeModule\n) as typeof import(\"../index.js\");\n\ntype CorsaApiClientConstructor = {\n spawn(options: ApiClientOptions): CorsaApiClient;\n spawnAsync(options: ApiClientOptions): Promise<CorsaApiClient>;\n};\n\nexport interface CorsaApiClient {\n initialize(): InitializeResponse;\n initializeAsync(): Promise<InitializeResponse>;\n parseConfigFile(file: string): ConfigResponse;\n parseConfigFileAsync(file: string): Promise<ConfigResponse>;\n updateSnapshot(params?: UpdateSnapshotParams): UpdateSnapshotResponse;\n updateSnapshotAsync(params?: UpdateSnapshotParams): Promise<UpdateSnapshotResponse>;\n getSourceFile(snapshot: string, project: string, file: string): Uint8Array | null;\n getSourceFileAsync(snapshot: string, project: string, file: string): Promise<Uint8Array | null>;\n getEncodedSourceFile(snapshot: string, project: string, file: string): EncodedSourceFile | null;\n getEncodedSourceFileAsync(\n snapshot: string,\n project: string,\n file: string,\n ): Promise<EncodedSourceFile | null>;\n getStringType(snapshot: string, project: string): TypeResponse;\n getStringTypeAsync(snapshot: string, project: string): Promise<TypeResponse>;\n getTypeAtPosition(\n snapshot: string,\n project: string,\n file: string,\n position: number,\n ): TypeResponse | null;\n getTypeAtPositionAsync(\n snapshot: string,\n project: string,\n file: string,\n position: number,\n ): Promise<TypeResponse | null>;\n getTypesAtPositions(\n snapshot: string,\n project: string,\n file: string,\n positions: number[],\n ): Array<TypeResponse | null>;\n getTypesAtPositionsAsync(\n snapshot: string,\n project: string,\n file: string,\n positions: number[],\n ): Promise<Array<TypeResponse | null>>;\n getTypeAtSourceRange(\n snapshot: string,\n project: string,\n file: string,\n start: number,\n end: number,\n sourceText: string,\n kind?: string,\n ): TypeResponse | null;\n getTypeAtSourceRangeAsync(\n snapshot: string,\n project: string,\n file: string,\n start: number,\n end: number,\n sourceText: string,\n kind?: string,\n ): Promise<TypeResponse | null>;\n getSymbolAtPosition(\n snapshot: string,\n project: string,\n file: string,\n position: number,\n ): SymbolResponse | null;\n getSymbolAtPositionAsync(\n snapshot: string,\n project: string,\n file: string,\n position: number,\n ): Promise<SymbolResponse | null>;\n getSymbolsAtPositions(\n snapshot: string,\n project: string,\n file: string,\n positions: number[],\n ): Array<SymbolResponse | null>;\n getSymbolsAtPositionsAsync(\n snapshot: string,\n project: string,\n file: string,\n positions: number[],\n ): Promise<Array<SymbolResponse | null>>;\n getAliasedSymbol(snapshot: string, project: string, symbol: string): SymbolResponse | null;\n getAliasedSymbolAsync(\n snapshot: string,\n project: string,\n symbol: string,\n ): Promise<SymbolResponse | null>;\n getImmediateAliasedSymbol(\n snapshot: string,\n project: string,\n symbol: string,\n ): SymbolResponse | null;\n getImmediateAliasedSymbolAsync(\n snapshot: string,\n project: string,\n symbol: string,\n ): Promise<SymbolResponse | null>;\n getExportsOfModule(snapshot: string, project: string, symbol: string): SymbolResponse[];\n getExportsOfModuleAsync(\n snapshot: string,\n project: string,\n symbol: string,\n ): Promise<SymbolResponse[]>;\n getSymbolOfType(snapshot: string, typeHandle: string, project?: string): SymbolResponse | null;\n getSymbolOfTypeAsync(\n snapshot: string,\n typeHandle: string,\n project?: string,\n ): Promise<SymbolResponse | null>;\n getTypeArguments(\n snapshot: string,\n project: string,\n typeHandle: string,\n objectFlags?: number,\n ): TypeResponse[];\n getTypeArgumentsAtSourceRange(\n snapshot: string,\n project: string,\n typeHandle: string,\n objectFlags: number | undefined | null,\n file: string,\n start: number,\n end: number,\n sourceText: string,\n ): TypeResponse[];\n getTypeArgumentsAsync(\n snapshot: string,\n project: string,\n typeHandle: string,\n objectFlags?: number,\n ): Promise<TypeResponse[]>;\n getTypeArgumentsAtSourceRangeAsync(\n snapshot: string,\n project: string,\n typeHandle: string,\n objectFlags: number | undefined | null,\n file: string,\n start: number,\n end: number,\n sourceText: string,\n ): Promise<TypeResponse[]>;\n getPropertyOfType(\n snapshot: string,\n project: string,\n typeHandle: string,\n name: string,\n ): SymbolResponse | null;\n getPropertyOfTypeAsync(\n snapshot: string,\n project: string,\n typeHandle: string,\n name: string,\n ): Promise<SymbolResponse | null>;\n isTypeAssignableTo(snapshot: string, project: string, source: string, target: string): boolean;\n isTypeAssignableToAsync(\n snapshot: string,\n project: string,\n source: string,\n target: string,\n ): Promise<boolean>;\n getConstraintOfType(snapshot: string, project: string, typeHandle: string): TypeResponse | null;\n getConstraintOfTypeAsync(\n snapshot: string,\n project: string,\n typeHandle: string,\n ): Promise<TypeResponse | null>;\n getTypeOfSymbol(snapshot: string, project: string, symbol: string): TypeResponse | null;\n getTypeOfSymbolAsync(\n snapshot: string,\n project: string,\n symbol: string,\n ): Promise<TypeResponse | null>;\n getDeclaredTypeOfSymbol(snapshot: string, project: string, symbol: string): TypeResponse | null;\n getDeclaredTypeOfSymbolAsync(\n snapshot: string,\n project: string,\n symbol: string,\n ): Promise<TypeResponse | null>;\n typeToString(\n snapshot: string,\n project: string,\n typeHandle: string,\n location?: string,\n flags?: number,\n ): string;\n typeToStringAsync(\n snapshot: string,\n project: string,\n typeHandle: string,\n location?: string,\n flags?: number,\n ): Promise<string>;\n callJson<T>(method: string, params?: unknown): T;\n callJsonAsync<T>(method: string, params?: unknown): Promise<T>;\n callBinary(method: string, params?: unknown): Uint8Array | null;\n callBinaryAsync(method: string, params?: unknown): Promise<Uint8Array | null>;\n releaseHandle(handle: string): void;\n releaseHandleAsync(handle: string): Promise<void>;\n close(): void;\n closeAsync(): Promise<void>;\n}\n\ntype CorsaVirtualDocumentConstructor = {\n untitled(path: string, languageId: string, text: string): CorsaVirtualDocument;\n inMemory(authority: string, path: string, languageId: string, text: string): CorsaVirtualDocument;\n};\n\nexport interface CorsaVirtualDocument {\n readonly uri: string;\n readonly languageId: string;\n readonly version: number;\n readonly text: string;\n state(): VirtualDocumentState;\n replace(text: string): void;\n applyChanges(changes: VirtualChange[]): unknown[];\n}\n\nexport const CorsaApiClient = binding.CorsaApiClient as unknown as CorsaApiClientConstructor;\nexport const CorsaVirtualDocument =\n binding.CorsaVirtualDocument as unknown as CorsaVirtualDocumentConstructor;\n\n/**\n * Bidirectional mapping between a mapper's virtual text and the original file.\n *\n * Every query takes an optional `feature` bitmask (see {@link SpanMap}); when it\n * is omitted, all features are considered.\n */\nexport interface CorsaSpanMap {\n readonly segments: SpanMapSegment[];\n readonly segmentCount: number;\n virtualToOriginalPosition(position: number, feature?: number): MappedPosition;\n virtualToOriginalSpan(pos: number, end: number, feature?: number): MappedRange;\n originalToVirtualPositions(position: number, feature?: number): MappedPosition[];\n originalToVirtualSpans(pos: number, end: number, feature?: number): MappedRange[];\n}\n\ntype CorsaSpanMapConstructor = {\n fromSegments(segments: readonly SpanMapSegment[]): CorsaSpanMap;\n};\n\nexport const CorsaSpanMap = binding.CorsaSpanMap as unknown as CorsaSpanMapConstructor;\n\n/** Decodes the source-file fields of a `getSourceFile` payload. */\nexport const decodeSourceFile = binding.decodeSourceFile as (\n payload: Uint8Array,\n) => EncodedSourceFile;\n\n/** Reports whether a `getSourceFile` payload came out of a content mapper. */\nexport const isContentMappedSourceFile = binding.isContentMappedSourceFile as (\n payload: Uint8Array,\n) => boolean;\n\n/** Builds the span map of a payload, or `null` when the file is not mapped. */\nexport const spanMapForSourceFile = binding.spanMapForSourceFile as (\n payload: Uint8Array,\n) => CorsaSpanMap | null;\n\n/** Reads the content mappers a parsed `tsconfig` declares. */\nexport const contentMappersFromConfig = binding.contentMappersFromConfig as (\n config: unknown,\n) => ContentMapperDefinition[];\n\n/**\n * Numeric enums mirrored from upstream `spanMapKind`, `spanMapFidelity`, and\n * `spanMapFeature`.\n */\nexport const SpanMap = Object.freeze({\n Kind: Object.freeze({ Verbatim: 0, Atom: 1, Alias: 2 }),\n Fidelity: Object.freeze({ Exact: 0, Atom: 1, Approximate: 2, None: 3 }),\n Feature: Object.freeze({\n Hover: 1 << 0,\n SignatureHelp: 1 << 1,\n Completion: 1 << 2,\n Definition: 1 << 3,\n TypeDefinition: 1 << 4,\n Implementation: 1 << 5,\n References: 1 << 6,\n DocumentHighlights: 1 << 7,\n Rename: 1 << 8,\n CallHierarchy: 1 << 9,\n CodeActions: 1 << 10,\n Formatting: 1 << 11,\n InlayHints: 1 << 12,\n SemanticTokens: 1 << 13,\n FoldingRanges: 1 << 14,\n SelectionRanges: 1 << 15,\n LinkedEditing: 1 << 16,\n AutoInsert: 1 << 17,\n DocumentSymbols: 1 << 18,\n CodeLens: 1 << 19,\n None: 0,\n All: (1 << 20) - 1,\n }),\n} as const);\n\nexport const version = binding.version as () => string;\nexport const spawnCorsaApiClientAsync = binding.spawnCorsaApiClientAsync as (\n options: ApiClientOptions,\n) => Promise<CorsaApiClient>;\nexport const isUnsafeAssignment = binding.isUnsafeAssignment as (\n input: UnsafeTypeFlowInput,\n) => boolean;\nexport const isUnsafeReturn = binding.isUnsafeReturn as (input: UnsafeTypeFlowInput) => boolean;\nexport const runNativeLintRule = binding.runNativeLintRule as (\n ruleName: string,\n node: NativeLintNode,\n) => NativeLintDiagnostic[];\nexport const nativeLintRuleMetas = binding.nativeLintRuleMetas as () => NativeLintRuleMeta[];\nexport const classifyTypeText = binding.classifyTypeText as (text?: string) => TypeTextKind;\nexport const splitTopLevelTypeText = binding.splitTopLevelTypeText as (\n text: string,\n delimiter: string,\n) => string[];\nexport const splitTypeText = binding.splitTypeText as (text: string) => string[];\nexport const isStringLikeTypeTexts = binding.isStringLikeTypeTexts as (\n typeTexts: readonly string[],\n) => boolean;\nexport const isNumberLikeTypeTexts = binding.isNumberLikeTypeTexts as (\n typeTexts: readonly string[],\n) => boolean;\nexport const isBigIntLikeTypeTexts = binding.isBigIntLikeTypeTexts as (\n typeTexts: readonly string[],\n) => boolean;\nexport const isAnyLikeTypeTexts = binding.isAnyLikeTypeTexts as (\n typeTexts: readonly string[],\n) => boolean;\nexport const isUnknownLikeTypeTexts = binding.isUnknownLikeTypeTexts as (\n typeTexts: readonly string[],\n) => boolean;\nexport const isArrayLikeTypeTexts = binding.isArrayLikeTypeTexts as (\n typeTexts: readonly string[],\n) => boolean;\nexport const isStringArrayLikeTypeTexts = binding.isStringArrayLikeTypeTexts as (\n typeTexts: readonly string[],\n) => boolean;\nexport const isPromiseLikeTypeTexts = binding.isPromiseLikeTypeTexts as (\n typeTexts: readonly string[],\n propertyNames?: readonly string[],\n) => boolean;\nexport const isErrorLikeTypeTexts = binding.isErrorLikeTypeTexts as (\n typeTexts: readonly string[],\n propertyNames?: readonly string[],\n) => boolean;\n\nlet rootCheckerBatchResolverWarningShown = false;\n\n/**\n * @deprecated Import from `@corsa-bind/napi/orchestrator` instead. The root\n * export remains as a compatibility shim and warns once at runtime.\n */\nexport function resolveCheckerBatch(\n client: CheckerBatchCapableClient,\n scope: CheckerBatchScope,\n queries: readonly CheckerBatchQuery[],\n): ResolvedCheckerBatchItem[] {\n warnRootCheckerBatchResolver();\n return resolveCheckerBatchFromOrchestrator(client, scope, queries);\n}\n\n/**\n * @deprecated Import from `@corsa-bind/napi/orchestrator` instead. The root\n * export remains as a compatibility shim and warns once at runtime.\n */\nexport async function resolveCheckerBatchAsync(\n client: AsyncCheckerBatchCapableClient,\n scope: CheckerBatchScope,\n queries: readonly CheckerBatchQuery[],\n): Promise<ResolvedCheckerBatchItem[]> {\n warnRootCheckerBatchResolver();\n return resolveCheckerBatchAsyncFromOrchestrator(client, scope, queries);\n}\n\nexport const Utils = Object.freeze({\n classifyTypeText,\n splitTopLevelTypeText,\n splitTypeText,\n isStringLikeTypeTexts,\n isNumberLikeTypeTexts,\n isBigIntLikeTypeTexts,\n isAnyLikeTypeTexts,\n isUnknownLikeTypeTexts,\n isArrayLikeTypeTexts,\n isStringArrayLikeTypeTexts,\n isPromiseLikeTypeTexts,\n isErrorLikeTypeTexts,\n});\n\nexport default binding;\nexport { batchCheckerRequests, batchCheckerRequestsAsync } from \"./checker_batch\";\nexport type { AsyncCheckerBatchCapableClient, CheckerBatchCapableClient } from \"./checker_batch\";\nexport type {\n CheckerBatchQuery,\n CheckerBatchResult,\n CheckerBatchScope,\n ResolvedCheckerBatchItem,\n} from \"./orchestrator_types\";\nexport type * from \"./types\";\n\nfunction warnRootCheckerBatchResolver(): void {\n if (rootCheckerBatchResolverWarningShown) {\n return;\n }\n rootCheckerBatchResolverWarningShown = true;\n console.warn(\n \"@corsa-bind/napi: resolveCheckerBatch is a compatibility shim; import from @corsa-bind/napi/orchestrator for new code.\",\n );\n}\n"],"mappings":";;;;AAkCA,MAAM,UACJ,aAAa,eAAe,aAAa,UAAU;AAmOrD,MAAa,iBAAiB,QAAQ;AACtC,MAAa,uBACX,QAAQ;AAqBV,MAAa,eAAe,QAAQ;;AAGpC,MAAa,mBAAmB,QAAQ;;AAKxC,MAAa,4BAA4B,QAAQ;;AAKjD,MAAa,uBAAuB,QAAQ;;AAK5C,MAAa,2BAA2B,QAAQ;;;;;AAQhD,MAAa,UAAU,OAAO,OAAO;CACnC,MAAM,OAAO,OAAO;EAAE,UAAU;EAAG,MAAM;EAAG,OAAO;CAAE,CAAC;CACtD,UAAU,OAAO,OAAO;EAAE,OAAO;EAAG,MAAM;EAAG,aAAa;EAAG,MAAM;CAAE,CAAC;CACtE,SAAS,OAAO,OAAO;EACrB,OAAO;EACP,eAAe;EACf,YAAY;EACZ,YAAY;EACZ,gBAAgB;EAChB,gBAAgB;EAChB,YAAY;EACZ,oBAAoB;EACpB,QAAQ;EACR,eAAe;EACf,aAAa;EACb,YAAY;EACZ,YAAY;EACZ,gBAAgB;EAChB,eAAe;EACf,iBAAiB;EACjB,eAAe;EACf,YAAY,KAAK;EACjB,iBAAiB,KAAK;EACtB,UAAU,KAAK;EACf,MAAM;EACN,MAAM,KAAK,MAAM;CACnB,CAAC;AACH,CAAU;AAEV,MAAa,UAAU,QAAQ;AAC/B,MAAa,2BAA2B,QAAQ;AAGhD,MAAa,qBAAqB,QAAQ;AAG1C,MAAa,iBAAiB,QAAQ;AACtC,MAAa,oBAAoB,QAAQ;AAIzC,MAAa,sBAAsB,QAAQ;AAC3C,MAAa,mBAAmB,QAAQ;AACxC,MAAa,wBAAwB,QAAQ;AAI7C,MAAa,gBAAgB,QAAQ;AACrC,MAAa,wBAAwB,QAAQ;AAG7C,MAAa,wBAAwB,QAAQ;AAG7C,MAAa,wBAAwB,QAAQ;AAG7C,MAAa,qBAAqB,QAAQ;AAG1C,MAAa,yBAAyB,QAAQ;AAG9C,MAAa,uBAAuB,QAAQ;AAG5C,MAAa,6BAA6B,QAAQ;AAGlD,MAAa,yBAAyB,QAAQ;AAI9C,MAAa,uBAAuB,QAAQ;AAK5C,IAAI,uCAAuC;;;;;AAM3C,SAAgB,oBACd,QACA,OACA,SAC4B;CAC5B,6BAA6B;CAC7B,OAAOA,sBAAoC,QAAQ,OAAO,OAAO;AACnE;;;;;AAMA,eAAsB,yBACpB,QACA,OACA,SACqC;CACrC,6BAA6B;CAC7B,OAAOC,2BAAyC,QAAQ,OAAO,OAAO;AACxE;AAEA,MAAa,QAAQ,OAAO,OAAO;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAaD,SAAS,+BAAqC;CAC5C,IAAI,sCACF;CAEF,uCAAuC;CACvC,QAAQ,KACN,wHACF;AACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AsyncCheckerBatchCapableClient, CheckerBatchCapableClient } from "./checker_batch.mjs";
|
|
2
|
+
import { CheckerBatchQuery, CheckerBatchResult, CheckerBatchScope, ResolvedCheckerBatchItem } from "./orchestrator_types.mjs";
|
|
3
|
+
//#region orchestrator.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Resolves common project-scoped checker lookups as one coalesced batch.
|
|
6
|
+
*
|
|
7
|
+
* Position queries are grouped per source file and symbol-type queries use
|
|
8
|
+
* `getTypesOfSymbols`, so callers can express per-node facts without writing
|
|
9
|
+
* their own N+1 loop.
|
|
10
|
+
*/
|
|
11
|
+
declare function resolveCheckerBatch(client: CheckerBatchCapableClient, scope: CheckerBatchScope, queries: readonly CheckerBatchQuery[]): ResolvedCheckerBatchItem[];
|
|
12
|
+
/**
|
|
13
|
+
* Async counterpart of {@link resolveCheckerBatch}.
|
|
14
|
+
*/
|
|
15
|
+
declare function resolveCheckerBatchAsync(client: AsyncCheckerBatchCapableClient, scope: CheckerBatchScope, queries: readonly CheckerBatchQuery[]): Promise<ResolvedCheckerBatchItem[]>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { type CheckerBatchQuery, type CheckerBatchResult, type CheckerBatchScope, type ResolvedCheckerBatchItem, resolveCheckerBatch, resolveCheckerBatchAsync };
|
|
18
|
+
//# sourceMappingURL=orchestrator.d.mts.map
|