@reqvire-org/ads-guard 0.0.0 → 0.5.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.
@@ -0,0 +1,498 @@
1
+ import * as ast from "typescript/ast";
2
+ import type { Node, ScriptKind, SourceFile } from "typescript/ast";
3
+ import { JsxEmit, ModuleKind, ModuleResolutionKind, SymbolFlags, TypeFlags, TypeFormatFlags, type Diagnostic, type ParsedCommandLine, type ReadConfigFileResponse, type TranspileOptions, type TranspileOutput } from "typescript/async";
4
+ import { type PathMappedOptions } from "./compiler-options.mts";
5
+ /** Closes the idle client. A caller also waits for a close already in flight (the
6
+ * idle timer's, say), so it never returns while the native process is still closing. */
7
+ export declare function closeSyntax(): Promise<void>;
8
+ /** Parses `text` as `file`; inside an analysis, the captured revision's own AST is reused. */
9
+ export declare function parseSource(file: string, text: string, scriptKind?: ScriptKind): Promise<SourceFile>;
10
+ /** Reads configuration `text` as if it were a file beside `file`, without writing it. */
11
+ export declare function parseConfigText(file: string, text: string): Promise<ReadConfigFileResponse>;
12
+ export declare const readConfig: (file: string) => Promise<ReadConfigFileResponse>;
13
+ export declare const parseConfig: (config: unknown, directory: string) => Promise<ParsedCommandLine>;
14
+ export declare const parseCompilerOptions: (config: Readonly<Record<string, unknown>>, directory: string) => Promise<ParsedCommandLine>;
15
+ export declare const parseConfigFile: (file: string) => Promise<ParsedCommandLine>;
16
+ /** A transpile diagnostic, also under the classic compiler's `messageText` name. */
17
+ export type TranspileDiagnostic = Diagnostic & {
18
+ readonly messageText: string;
19
+ };
20
+ export interface TranspileResult extends Omit<TranspileOutput, "diagnostics"> {
21
+ readonly diagnostics: readonly TranspileDiagnostic[] | undefined;
22
+ }
23
+ export declare const transpileSource: (input: string, options?: TranspileOptions) => Promise<TranspileResult>;
24
+ /** Keep the syntax client and resolver leases alive for exactly one capture. */
25
+ export declare function withModuleResolutionScope<T>(run: () => T | Promise<T>): Promise<T>;
26
+ /** The file `specifier` resolves to from `file`, within the current resolution scope. */
27
+ export declare function resolveModule(specifier: string, file: string, options: PathMappedOptions): Promise<string | undefined>;
28
+ declare function findConfigFile(directory: string, exists?: (file: string) => boolean, name?: string): string | undefined;
29
+ /** A diagnostic message in either the native (`text`, `messageChain`) or classic (`messageText`, `next`) shape. */
30
+ export type DiagnosticMessage = string | undefined | {
31
+ readonly text?: string;
32
+ readonly messageText?: DiagnosticMessage;
33
+ readonly next?: readonly DiagnosticMessage[] | undefined;
34
+ readonly messageChain?: readonly DiagnosticMessage[] | undefined;
35
+ };
36
+ declare const flattenDiagnosticMessageText: (message: DiagnosticMessage, separator?: string) => string;
37
+ declare const isIterationStatement: (node: Node) => boolean;
38
+ /** The native AST vocabulary under the classic compiler's names ADS rules use. */
39
+ declare const ts: {
40
+ SpanMap: typeof ast.SpanMap;
41
+ factory: typeof ast.factory;
42
+ getTokenAtPosition(sourceFile: SourceFile, position: number): Node;
43
+ getTouchingPropertyName(sourceFile: SourceFile, position: number): Node;
44
+ getTouchingToken(sourceFile: SourceFile, position: number): Node;
45
+ findNextToken(previousToken: Node, parent: Node, sourceFile: SourceFile): Node | undefined;
46
+ findPrecedingToken(sourceFile: SourceFile, position: number): Node | undefined;
47
+ getChildren(node: Node, sourceFile?: SourceFile): readonly Node[];
48
+ getFirstToken(node: Node, sourceFile?: SourceFile): Node | undefined;
49
+ getLastToken(node: Node, sourceFile?: SourceFile): Node | undefined;
50
+ getSynthesizedDeepClone<T extends Node>(node: T, includeTrivia?: boolean): T;
51
+ getSynthesizedDeepClone<T extends Node>(node: T | undefined, includeTrivia?: boolean): T | undefined;
52
+ getSynthesizedDeepClones<T extends Node>(nodes: ast.NodeArray<T>, includeTrivia?: boolean): ast.NodeArray<T>;
53
+ getSynthesizedDeepClones<T extends Node>(nodes: ast.NodeArray<T> | undefined, includeTrivia?: boolean): ast.NodeArray<T> | undefined;
54
+ isToken: typeof ast.isToken;
55
+ isIdentifier: typeof ast.isIdentifier;
56
+ isPrivateIdentifier: typeof ast.isPrivateIdentifier;
57
+ isQualifiedName: typeof ast.isQualifiedName;
58
+ isComputedPropertyName: typeof ast.isComputedPropertyName;
59
+ isDecorator: typeof ast.isDecorator;
60
+ isEmptyStatement: typeof ast.isEmptyStatement;
61
+ isIfStatement: typeof ast.isIfStatement;
62
+ isDoStatement: typeof ast.isDoStatement;
63
+ isWhileStatement: typeof ast.isWhileStatement;
64
+ isForStatement: typeof ast.isForStatement;
65
+ isBreakStatement: typeof ast.isBreakStatement;
66
+ isContinueStatement: typeof ast.isContinueStatement;
67
+ isReturnStatement: typeof ast.isReturnStatement;
68
+ isWithStatement: typeof ast.isWithStatement;
69
+ isSwitchStatement: typeof ast.isSwitchStatement;
70
+ isCaseBlock: typeof ast.isCaseBlock;
71
+ isThrowStatement: typeof ast.isThrowStatement;
72
+ isTryStatement: typeof ast.isTryStatement;
73
+ isCatchClause: typeof ast.isCatchClause;
74
+ isDebuggerStatement: typeof ast.isDebuggerStatement;
75
+ isLabeledStatement: typeof ast.isLabeledStatement;
76
+ isExpressionStatement: typeof ast.isExpressionStatement;
77
+ isBlock: typeof ast.isBlock;
78
+ isVariableStatement: typeof ast.isVariableStatement;
79
+ isVariableDeclaration: typeof ast.isVariableDeclaration;
80
+ isVariableDeclarationList: typeof ast.isVariableDeclarationList;
81
+ isParameterDeclaration: typeof ast.isParameterDeclaration;
82
+ isBindingElement: typeof ast.isBindingElement;
83
+ isMissingDeclaration: typeof ast.isMissingDeclaration;
84
+ isFunctionDeclaration: typeof ast.isFunctionDeclaration;
85
+ isClassDeclaration: typeof ast.isClassDeclaration;
86
+ isClassExpression: typeof ast.isClassExpression;
87
+ isHeritageClause: typeof ast.isHeritageClause;
88
+ isInterfaceDeclaration: typeof ast.isInterfaceDeclaration;
89
+ isTypeAliasDeclaration: typeof ast.isTypeAliasDeclaration;
90
+ isEnumMember: typeof ast.isEnumMember;
91
+ isEnumDeclaration: typeof ast.isEnumDeclaration;
92
+ isModuleBlock: typeof ast.isModuleBlock;
93
+ isNotEmittedStatement: typeof ast.isNotEmittedStatement;
94
+ isNotEmittedTypeElement: typeof ast.isNotEmittedTypeElement;
95
+ isImportDeclaration: typeof ast.isImportDeclaration;
96
+ isExternalModuleReference: typeof ast.isExternalModuleReference;
97
+ isNamespaceImport: typeof ast.isNamespaceImport;
98
+ isNamedImports: typeof ast.isNamedImports;
99
+ isExportAssignment: typeof ast.isExportAssignment;
100
+ isNamespaceExportDeclaration: typeof ast.isNamespaceExportDeclaration;
101
+ isNamespaceExport: typeof ast.isNamespaceExport;
102
+ isNamedExports: typeof ast.isNamedExports;
103
+ isExportSpecifier: typeof ast.isExportSpecifier;
104
+ isCallSignatureDeclaration: typeof ast.isCallSignatureDeclaration;
105
+ isConstructSignatureDeclaration: typeof ast.isConstructSignatureDeclaration;
106
+ isConstructorDeclaration: typeof ast.isConstructorDeclaration;
107
+ isGetAccessorDeclaration: typeof ast.isGetAccessorDeclaration;
108
+ isSetAccessorDeclaration: typeof ast.isSetAccessorDeclaration;
109
+ isIndexSignatureDeclaration: typeof ast.isIndexSignatureDeclaration;
110
+ isMethodSignatureDeclaration: typeof ast.isMethodSignatureDeclaration;
111
+ isMethodDeclaration: typeof ast.isMethodDeclaration;
112
+ isPropertySignatureDeclaration: typeof ast.isPropertySignatureDeclaration;
113
+ isPropertyDeclaration: typeof ast.isPropertyDeclaration;
114
+ isSemicolonClassElement: typeof ast.isSemicolonClassElement;
115
+ isClassStaticBlockDeclaration: typeof ast.isClassStaticBlockDeclaration;
116
+ isOmittedExpression: typeof ast.isOmittedExpression;
117
+ isKeywordExpression: typeof ast.isKeywordExpression;
118
+ isStringLiteral: typeof ast.isStringLiteral;
119
+ isNumericLiteral: typeof ast.isNumericLiteral;
120
+ isBigIntLiteral: typeof ast.isBigIntLiteral;
121
+ isRegularExpressionLiteral: typeof ast.isRegularExpressionLiteral;
122
+ isNoSubstitutionTemplateLiteral: typeof ast.isNoSubstitutionTemplateLiteral;
123
+ isBinaryExpression: typeof ast.isBinaryExpression;
124
+ isPrefixUnaryExpression: typeof ast.isPrefixUnaryExpression;
125
+ isPostfixUnaryExpression: typeof ast.isPostfixUnaryExpression;
126
+ isYieldExpression: typeof ast.isYieldExpression;
127
+ isArrowFunction: typeof ast.isArrowFunction;
128
+ isFunctionExpression: typeof ast.isFunctionExpression;
129
+ isAsExpression: typeof ast.isAsExpression;
130
+ isSatisfiesExpression: typeof ast.isSatisfiesExpression;
131
+ isConditionalExpression: typeof ast.isConditionalExpression;
132
+ isPropertyAccessExpression: typeof ast.isPropertyAccessExpression;
133
+ isElementAccessExpression: typeof ast.isElementAccessExpression;
134
+ isCallExpression: typeof ast.isCallExpression;
135
+ isNewExpression: typeof ast.isNewExpression;
136
+ isMetaProperty: typeof ast.isMetaProperty;
137
+ isNonNullExpression: typeof ast.isNonNullExpression;
138
+ isSpreadElement: typeof ast.isSpreadElement;
139
+ isTemplateExpression: typeof ast.isTemplateExpression;
140
+ isTemplateSpan: typeof ast.isTemplateSpan;
141
+ isTaggedTemplateExpression: typeof ast.isTaggedTemplateExpression;
142
+ isParenthesizedExpression: typeof ast.isParenthesizedExpression;
143
+ isArrayLiteralExpression: typeof ast.isArrayLiteralExpression;
144
+ isObjectLiteralExpression: typeof ast.isObjectLiteralExpression;
145
+ isSpreadAssignment: typeof ast.isSpreadAssignment;
146
+ isPropertyAssignment: typeof ast.isPropertyAssignment;
147
+ isShorthandPropertyAssignment: typeof ast.isShorthandPropertyAssignment;
148
+ isDeleteExpression: typeof ast.isDeleteExpression;
149
+ isTypeOfExpression: typeof ast.isTypeOfExpression;
150
+ isVoidExpression: typeof ast.isVoidExpression;
151
+ isAwaitExpression: typeof ast.isAwaitExpression;
152
+ isTypeAssertion: typeof ast.isTypeAssertion;
153
+ isKeywordTypeNode: typeof ast.isKeywordTypeNode;
154
+ isUnionTypeNode: typeof ast.isUnionTypeNode;
155
+ isIntersectionTypeNode: typeof ast.isIntersectionTypeNode;
156
+ isConditionalTypeNode: typeof ast.isConditionalTypeNode;
157
+ isTypeOperatorNode: typeof ast.isTypeOperatorNode;
158
+ isInferTypeNode: typeof ast.isInferTypeNode;
159
+ isArrayTypeNode: typeof ast.isArrayTypeNode;
160
+ isIndexedAccessTypeNode: typeof ast.isIndexedAccessTypeNode;
161
+ isTypeReferenceNode: typeof ast.isTypeReferenceNode;
162
+ isExpressionWithTypeArguments: typeof ast.isExpressionWithTypeArguments;
163
+ isLiteralTypeNode: typeof ast.isLiteralTypeNode;
164
+ isThisTypeNode: typeof ast.isThisTypeNode;
165
+ isTypePredicateNode: typeof ast.isTypePredicateNode;
166
+ isImportAttribute: typeof ast.isImportAttribute;
167
+ isImportAttributes: typeof ast.isImportAttributes;
168
+ isTypeQueryNode: typeof ast.isTypeQueryNode;
169
+ isMappedTypeNode: typeof ast.isMappedTypeNode;
170
+ isTypeLiteralNode: typeof ast.isTypeLiteralNode;
171
+ isTupleTypeNode: typeof ast.isTupleTypeNode;
172
+ isNamedTupleMember: typeof ast.isNamedTupleMember;
173
+ isOptionalTypeNode: typeof ast.isOptionalTypeNode;
174
+ isRestTypeNode: typeof ast.isRestTypeNode;
175
+ isParenthesizedTypeNode: typeof ast.isParenthesizedTypeNode;
176
+ isFunctionTypeNode: typeof ast.isFunctionTypeNode;
177
+ isConstructorTypeNode: typeof ast.isConstructorTypeNode;
178
+ isTemplateHead: typeof ast.isTemplateHead;
179
+ isTemplateMiddle: typeof ast.isTemplateMiddle;
180
+ isTemplateTail: typeof ast.isTemplateTail;
181
+ isTemplateLiteralTypeNode: typeof ast.isTemplateLiteralTypeNode;
182
+ isTemplateLiteralTypeSpan: typeof ast.isTemplateLiteralTypeSpan;
183
+ isSyntheticExpression: typeof ast.isSyntheticExpression;
184
+ isPartiallyEmittedExpression: typeof ast.isPartiallyEmittedExpression;
185
+ isJsxElement: typeof ast.isJsxElement;
186
+ isJsxAttributes: typeof ast.isJsxAttributes;
187
+ isJsxNamespacedName: typeof ast.isJsxNamespacedName;
188
+ isJsxOpeningElement: typeof ast.isJsxOpeningElement;
189
+ isJsxSelfClosingElement: typeof ast.isJsxSelfClosingElement;
190
+ isJsxFragment: typeof ast.isJsxFragment;
191
+ isJsxOpeningFragment: typeof ast.isJsxOpeningFragment;
192
+ isJsxClosingFragment: typeof ast.isJsxClosingFragment;
193
+ isJsxAttribute: typeof ast.isJsxAttribute;
194
+ isJsxSpreadAttribute: typeof ast.isJsxSpreadAttribute;
195
+ isJsxClosingElement: typeof ast.isJsxClosingElement;
196
+ isJsxExpression: typeof ast.isJsxExpression;
197
+ isJsxText: typeof ast.isJsxText;
198
+ isSyntaxList: typeof ast.isSyntaxList;
199
+ isJSDoc: typeof ast.isJSDoc;
200
+ isJSDocTypeExpression: typeof ast.isJSDocTypeExpression;
201
+ isJSDocNonNullableType: typeof ast.isJSDocNonNullableType;
202
+ isJSDocNullableType: typeof ast.isJSDocNullableType;
203
+ isJSDocAllType: typeof ast.isJSDocAllType;
204
+ isJSDocVariadicType: typeof ast.isJSDocVariadicType;
205
+ isJSDocOptionalType: typeof ast.isJSDocOptionalType;
206
+ isJSDocTypeTag: typeof ast.isJSDocTypeTag;
207
+ isJSDocUnknownTag: typeof ast.isJSDocUnknownTag;
208
+ isJSDocTemplateTag: typeof ast.isJSDocTemplateTag;
209
+ isJSDocReturnTag: typeof ast.isJSDocReturnTag;
210
+ isJSDocPublicTag: typeof ast.isJSDocPublicTag;
211
+ isJSDocPrivateTag: typeof ast.isJSDocPrivateTag;
212
+ isJSDocProtectedTag: typeof ast.isJSDocProtectedTag;
213
+ isJSDocReadonlyTag: typeof ast.isJSDocReadonlyTag;
214
+ isJSDocOverrideTag: typeof ast.isJSDocOverrideTag;
215
+ isJSDocDeprecatedTag: typeof ast.isJSDocDeprecatedTag;
216
+ isJSDocSeeTag: typeof ast.isJSDocSeeTag;
217
+ isJSDocImplementsTag: typeof ast.isJSDocImplementsTag;
218
+ isJSDocAugmentsTag: typeof ast.isJSDocAugmentsTag;
219
+ isJSDocSatisfiesTag: typeof ast.isJSDocSatisfiesTag;
220
+ isJSDocThrowsTag: typeof ast.isJSDocThrowsTag;
221
+ isJSDocThisTag: typeof ast.isJSDocThisTag;
222
+ isJSDocImportTag: typeof ast.isJSDocImportTag;
223
+ isJSDocCallbackTag: typeof ast.isJSDocCallbackTag;
224
+ isJSDocOverloadTag: typeof ast.isJSDocOverloadTag;
225
+ isJSDocTypedefTag: typeof ast.isJSDocTypedefTag;
226
+ isJSDocSignature: typeof ast.isJSDocSignature;
227
+ isJSDocNameReference: typeof ast.isJSDocNameReference;
228
+ isSourceFile: typeof ast.isSourceFile;
229
+ isModuleDeclaration: typeof ast.isModuleDeclaration;
230
+ isImportEqualsDeclaration: typeof ast.isImportEqualsDeclaration;
231
+ isExportDeclaration: typeof ast.isExportDeclaration;
232
+ isImportTypeNode: typeof ast.isImportTypeNode;
233
+ isImportClause: typeof ast.isImportClause;
234
+ isImportSpecifier: typeof ast.isImportSpecifier;
235
+ isJSDocText: typeof ast.isJSDocText;
236
+ isJSDocLink: typeof ast.isJSDocLink;
237
+ isJSDocLinkPlain: typeof ast.isJSDocLinkPlain;
238
+ isJSDocLinkCode: typeof ast.isJSDocLinkCode;
239
+ isTypeParameterDeclaration: typeof ast.isTypeParameterDeclaration;
240
+ isSyntheticReferenceExpression: typeof ast.isSyntheticReferenceExpression;
241
+ isJSDocTypeLiteral: typeof ast.isJSDocTypeLiteral;
242
+ isForInStatement: typeof ast.isForInStatement;
243
+ isForOfStatement: typeof ast.isForOfStatement;
244
+ isCaseClause: typeof ast.isCaseClause;
245
+ isDefaultClause: typeof ast.isDefaultClause;
246
+ isObjectBindingPattern: typeof ast.isObjectBindingPattern;
247
+ isArrayBindingPattern: typeof ast.isArrayBindingPattern;
248
+ isJSDocParameterTag: typeof ast.isJSDocParameterTag;
249
+ isJSDocPropertyTag: typeof ast.isJSDocPropertyTag;
250
+ isHeritageClauseElement: typeof ast.isHeritageClauseElement;
251
+ isAccessExpression: typeof ast.isAccessExpression;
252
+ isDeclarationName: typeof ast.isDeclarationName;
253
+ isModuleName: typeof ast.isModuleName;
254
+ isModuleExportName: typeof ast.isModuleExportName;
255
+ isPropertyName: typeof ast.isPropertyName;
256
+ isModuleBody: typeof ast.isModuleBody;
257
+ isJSDocFullName: typeof ast.isJSDocFullName;
258
+ isModuleReference: typeof ast.isModuleReference;
259
+ isNamedImportBindings: typeof ast.isNamedImportBindings;
260
+ isNamedExportBindings: typeof ast.isNamedExportBindings;
261
+ isMemberName: typeof ast.isMemberName;
262
+ isEntityName: typeof ast.isEntityName;
263
+ isBindingName: typeof ast.isBindingName;
264
+ isModifierLike: typeof ast.isModifierLike;
265
+ isJsxChild: typeof ast.isJsxChild;
266
+ isJsxAttributeLike: typeof ast.isJsxAttributeLike;
267
+ isJsxAttributeName: typeof ast.isJsxAttributeName;
268
+ isJsxAttributeValue: typeof ast.isJsxAttributeValue;
269
+ isClassLikeDeclaration: typeof ast.isClassLikeDeclaration;
270
+ isAccessorDeclaration: typeof ast.isAccessorDeclaration;
271
+ isLiteralLikeNode: typeof ast.isLiteralLikeNode;
272
+ isLiteralExpression: typeof ast.isLiteralExpression;
273
+ isUnionOrIntersectionTypeNode: typeof ast.isUnionOrIntersectionTypeNode;
274
+ isTemplateLiteralLikeNode: typeof ast.isTemplateLiteralLikeNode;
275
+ isTemplateMiddleOrTail: typeof ast.isTemplateMiddleOrTail;
276
+ isTemplateLiteral: typeof ast.isTemplateLiteral;
277
+ isTypePredicateParameterName: typeof ast.isTypePredicateParameterName;
278
+ isImportAttributeName: typeof ast.isImportAttributeName;
279
+ isJSDocComment: typeof ast.isJSDocComment;
280
+ isSignatureDeclaration: typeof ast.isSignatureDeclaration;
281
+ isStringLiteralLikeNode: typeof ast.isStringLiteralLikeNode;
282
+ isNumericOrStringLikeLiteral: typeof ast.isNumericOrStringLikeLiteral;
283
+ isObjectLiteralLikeNode: typeof ast.isObjectLiteralLikeNode;
284
+ isObjectTypeDeclaration: typeof ast.isObjectTypeDeclaration;
285
+ isJsxOpeningLikeElement: typeof ast.isJsxOpeningLikeElement;
286
+ isNamedImportsOrExports: typeof ast.isNamedImportsOrExports;
287
+ isBreakOrContinueStatement: typeof ast.isBreakOrContinueStatement;
288
+ isCallLikeExpression: typeof ast.isCallLikeExpression;
289
+ isFunctionLikeDeclaration: typeof ast.isFunctionLikeDeclaration;
290
+ isVariableOrParameterDeclaration: typeof ast.isVariableOrParameterDeclaration;
291
+ isVariableOrPropertyDeclaration: typeof ast.isVariableOrPropertyDeclaration;
292
+ isCallOrNewExpression: typeof ast.isCallOrNewExpression;
293
+ isImportClauseOrBindingPattern: typeof ast.isImportClauseOrBindingPattern;
294
+ isAnyImportSyntax: typeof ast.isAnyImportSyntax;
295
+ isArrayBindingElement: typeof ast.isArrayBindingElement;
296
+ isAssertionExpression: typeof ast.isAssertionExpression;
297
+ isBooleanLiteral: typeof ast.isBooleanLiteral;
298
+ isDestructuringAssignment: typeof ast.isDestructuringAssignment;
299
+ isLiteralToken: typeof ast.isLiteralToken;
300
+ isModifier: typeof ast.isModifier;
301
+ isObjectLiteralElementLike: typeof ast.isObjectLiteralElementLike;
302
+ isPropertyNameLiteral: typeof ast.isPropertyNameLiteral;
303
+ isPseudoLiteralToken: typeof ast.isPseudoLiteralToken;
304
+ isTemplateLiteralToken: typeof ast.isTemplateLiteralToken;
305
+ isArrayDestructuringAssignment: typeof ast.isArrayDestructuringAssignment;
306
+ isObjectDestructuringAssignment: typeof ast.isObjectDestructuringAssignment;
307
+ isFunctionBody: typeof ast.isFunctionBody;
308
+ isTriviaKind(kind: ast.SyntaxKind): kind is ast.TriviaSyntaxKind;
309
+ isPseudoLiteralKind(kind: ast.SyntaxKind): kind is ast.PseudoLiteralSyntaxKind;
310
+ isModifierKind(kind: ast.SyntaxKind): kind is ast.ModifierSyntaxKind;
311
+ isKeywordTypeKind(kind: ast.SyntaxKind): kind is ast.KeywordTypeSyntaxKind;
312
+ isKeywordExpressionKind(kind: ast.SyntaxKind): kind is ast.KeywordExpressionSyntaxKind;
313
+ isJsxTokenKind(kind: ast.SyntaxKind): kind is ast.JsxTokenSyntaxKind;
314
+ isImportPhaseModifierKind(kind: ast.SyntaxKind): kind is ast.ImportPhaseModifierSyntaxKind;
315
+ isPostfixUnaryOperator(kind: ast.SyntaxKind): kind is ast.PostfixUnaryOperator;
316
+ isPrefixUnaryOperator(kind: ast.SyntaxKind): kind is ast.PrefixUnaryOperator;
317
+ isAssignmentOperator(kind: ast.SyntaxKind): kind is ast.AssignmentOperator;
318
+ isBinaryOperator(kind: ast.SyntaxKind): kind is ast.BinaryOperator;
319
+ isExponentiationOperator(kind: ast.SyntaxKind): kind is ast.ExponentiationOperator;
320
+ isMultiplicativeOperator(kind: ast.SyntaxKind): kind is ast.MultiplicativeOperator;
321
+ isMultiplicativeOperatorOrHigher(kind: ast.SyntaxKind): kind is ast.MultiplicativeOperatorOrHigher;
322
+ isAdditiveOperator(kind: ast.SyntaxKind): kind is ast.AdditiveOperator;
323
+ isAdditiveOperatorOrHigher(kind: ast.SyntaxKind): kind is ast.AdditiveOperatorOrHigher;
324
+ isShiftOperator(kind: ast.SyntaxKind): kind is ast.ShiftOperator;
325
+ isShiftOperatorOrHigher(kind: ast.SyntaxKind): kind is ast.ShiftOperatorOrHigher;
326
+ isRelationalOperator(kind: ast.SyntaxKind): kind is ast.RelationalOperator;
327
+ isRelationalOperatorOrHigher(kind: ast.SyntaxKind): kind is ast.RelationalOperatorOrHigher;
328
+ isEqualityOperator(kind: ast.SyntaxKind): kind is ast.EqualityOperator;
329
+ isEqualityOperatorOrHigher(kind: ast.SyntaxKind): kind is ast.EqualityOperatorOrHigher;
330
+ isBitwiseOperator(kind: ast.SyntaxKind): kind is ast.BitwiseOperator;
331
+ isBitwiseOperatorOrHigher(kind: ast.SyntaxKind): kind is ast.BitwiseOperatorOrHigher;
332
+ isLogicalOperator(kind: ast.SyntaxKind): kind is ast.LogicalOperator;
333
+ isLogicalOperatorOrHigher(kind: ast.SyntaxKind): kind is ast.LogicalOperatorOrHigher;
334
+ isCompoundAssignmentOperator(kind: ast.SyntaxKind): kind is ast.CompoundAssignmentOperator;
335
+ isAssignmentOperatorOrHigher(kind: ast.SyntaxKind): kind is ast.AssignmentOperatorOrHigher;
336
+ isLogicalOrCoalescingAssignmentOperator(kind: ast.SyntaxKind): kind is ast.LogicalOrCoalescingAssignmentOperator;
337
+ isLiteralKind(kind: ast.SyntaxKind): boolean;
338
+ isPunctuationKind(kind: ast.SyntaxKind): boolean;
339
+ isKeywordKind(kind: ast.SyntaxKind): boolean;
340
+ isTokenKind(kind: ast.SyntaxKind): boolean;
341
+ isJSDocNodeKind(kind: ast.SyntaxKind): boolean;
342
+ isEndOfFile: typeof ast.isEndOfFile;
343
+ isDotToken: typeof ast.isDotToken;
344
+ isDotDotDotToken: typeof ast.isDotDotDotToken;
345
+ isQuestionToken: typeof ast.isQuestionToken;
346
+ isExclamationToken: typeof ast.isExclamationToken;
347
+ isColonToken: typeof ast.isColonToken;
348
+ isEqualsToken: typeof ast.isEqualsToken;
349
+ isAsteriskToken: typeof ast.isAsteriskToken;
350
+ isEqualsGreaterThanToken: typeof ast.isEqualsGreaterThanToken;
351
+ isPlusToken: typeof ast.isPlusToken;
352
+ isMinusToken: typeof ast.isMinusToken;
353
+ isQuestionDotToken: typeof ast.isQuestionDotToken;
354
+ isAssertsKeyword: typeof ast.isAssertsKeyword;
355
+ isAssertKeyword: typeof ast.isAssertKeyword;
356
+ isAwaitKeyword: typeof ast.isAwaitKeyword;
357
+ isCaseKeyword: typeof ast.isCaseKeyword;
358
+ isAbstractKeyword: typeof ast.isAbstractKeyword;
359
+ isAccessorKeyword: typeof ast.isAccessorKeyword;
360
+ isAsyncKeyword: typeof ast.isAsyncKeyword;
361
+ isConstKeyword: typeof ast.isConstKeyword;
362
+ isDeclareKeyword: typeof ast.isDeclareKeyword;
363
+ isDefaultKeyword: typeof ast.isDefaultKeyword;
364
+ isExportKeyword: typeof ast.isExportKeyword;
365
+ isInKeyword: typeof ast.isInKeyword;
366
+ isPrivateKeyword: typeof ast.isPrivateKeyword;
367
+ isProtectedKeyword: typeof ast.isProtectedKeyword;
368
+ isPublicKeyword: typeof ast.isPublicKeyword;
369
+ isReadonlyKeyword: typeof ast.isReadonlyKeyword;
370
+ isOutKeyword: typeof ast.isOutKeyword;
371
+ isOverrideKeyword: typeof ast.isOverrideKeyword;
372
+ isStaticKeyword: typeof ast.isStaticKeyword;
373
+ isBinaryOperatorToken: typeof ast.isBinaryOperatorToken;
374
+ isAssignmentOperatorToken: typeof ast.isAssignmentOperatorToken;
375
+ isNullLiteral: typeof ast.isNullLiteral;
376
+ isTrueLiteral: typeof ast.isTrueLiteral;
377
+ isFalseLiteral: typeof ast.isFalseLiteral;
378
+ isThisExpression: typeof ast.isThisExpression;
379
+ isSuperExpression: typeof ast.isSuperExpression;
380
+ isImportExpression: typeof ast.isImportExpression;
381
+ isTypeNode(node: Node): node is ast.TypeNode;
382
+ isStatement(node: Node): node is ast.Statement;
383
+ isExpression(node: Node): node is ast.Expression;
384
+ isValidTypeOnlyAliasUseSite(useSite: Node): boolean;
385
+ isBlockOrExpression(node: Node): node is ast.BlockOrExpression;
386
+ isLeftHandSideExpression(node: Node): node is ast.LeftHandSideExpression;
387
+ skipPartiallyEmittedExpressions(node: ast.Expression): ast.Expression;
388
+ skipPartiallyEmittedExpressions(node: Node): Node;
389
+ isUnaryExpression(node: Node): node is ast.UnaryExpressionBase;
390
+ isBindingPattern(node: Node): node is ast.BindingPattern;
391
+ isConciseBody(node: Node): node is ast.ConciseBody;
392
+ isForInitializer(node: Node): node is ast.ForInitializer;
393
+ isQuestionOrExclamationToken(node: Node): node is ast.QuestionToken | ast.ExclamationToken;
394
+ isIdentifierOrThisTypeNode(node: Node): node is ast.Identifier | ast.ThisTypeNode;
395
+ isReadonlyKeywordOrPlusOrMinusToken(node: Node): node is ast.ReadonlyKeyword | ast.PlusToken | ast.MinusToken;
396
+ isQuestionOrPlusOrMinusToken(node: Node): node is ast.QuestionToken | ast.PlusToken | ast.MinusToken;
397
+ isTemplateMiddleOrTemplateTail(node: Node): node is ast.TemplateMiddle | ast.TemplateTail;
398
+ isLiteralTypeLiteral(node: Node): node is ast.NullLiteral | ast.BooleanLiteral | ast.LiteralExpression | ast.PrefixUnaryExpression;
399
+ isIdentifierOrJSDocNamespaceDeclaration(node: Node): node is ast.Identifier | ast.ModuleDeclaration;
400
+ isJSDocTypeExpressionOrJSDocTypeLiteral(node: Node): node is ast.JSDocTypeExpression | ast.JSDocTypeLiteral;
401
+ isJsxTagNameExpression(node: Node): node is ast.JsxTagNameExpression;
402
+ getJSDocTags(node: Node): readonly ast.JSDocTag[];
403
+ getAllJSDocTags<T extends ast.JSDocTag>(node: Node, predicate: (tag: ast.JSDocTag) => tag is T): readonly T[];
404
+ getAllJSDocTagsOfKind(node: Node, kind: ast.SyntaxKind): readonly ast.JSDocTag[];
405
+ getTextOfJSDocComment(comment?: string | ast.NodeArray<ast.JSDocComment>): string | undefined;
406
+ getJSDocCommentsAndTags(hostNode: Node): (ast.JSDoc | ast.JSDocTag)[];
407
+ tokenIsIdentifierOrKeyword(token: ast.SyntaxKind): boolean;
408
+ tokenIsIdentifierOrKeywordOrGreaterThan(token: ast.SyntaxKind): boolean;
409
+ textToKeywordObj: Record<string, ast.KeywordSyntaxKind>;
410
+ isUnicodeIdentifierStart(code: number): boolean;
411
+ tokenToString(t: ast.SyntaxKind): string | undefined;
412
+ stringToToken(s: string): ast.SyntaxKind | undefined;
413
+ characterCodeToRegularExpressionFlag(ch: number): ast.RegularExpressionFlags | undefined;
414
+ computeLineStarts(text: string): number[];
415
+ isWhiteSpaceLike(ch: number): boolean;
416
+ isWhiteSpaceSingleLine(ch: number): boolean;
417
+ isLineBreak(ch: number): boolean;
418
+ couldStartTrivia(text: string, pos: number): boolean;
419
+ skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean, stopAtComments?: boolean, inJSDoc?: boolean): number;
420
+ forEachLeadingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: ast.CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined;
421
+ forEachLeadingCommentRange<U>(text: string, pos: number, cb: (pos: number, end: number, kind: ast.CommentKind, hasTrailingNewLine: boolean) => U): U | undefined;
422
+ forEachTrailingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: ast.CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined;
423
+ forEachTrailingCommentRange<U>(text: string, pos: number, cb: (pos: number, end: number, kind: ast.CommentKind, hasTrailingNewLine: boolean) => U): U | undefined;
424
+ reduceEachLeadingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: ast.CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T, initial: U): U | undefined;
425
+ reduceEachTrailingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: ast.CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T, initial: U): U | undefined;
426
+ getLeadingCommentRanges(text: string, pos: number): ast.CommentRange[] | undefined;
427
+ getTrailingCommentRanges(text: string, pos: number): ast.CommentRange[] | undefined;
428
+ getShebang(text: string): string | undefined;
429
+ isIdentifierStart(ch: number, _languageVersion?: ast.ScriptTarget): boolean;
430
+ isIdentifierPart(ch: number, _languageVersion?: ast.ScriptTarget, identifierVariant?: ast.LanguageVariant): boolean;
431
+ isIdentifierText(name: string, _languageVersion?: ast.ScriptTarget, identifierVariant?: ast.LanguageVariant): boolean;
432
+ utf16EncodeAsString(codePoint: number): string;
433
+ createScanner(skipTrivia: boolean, languageVariant?: ast.LanguageVariant, textInitial?: string, start?: number, length?: number): ast.Scanner;
434
+ formatSyntaxKind(kind: ast.SyntaxKind): string;
435
+ unescapeLeadingUnderscores(identifier: ast.__String): string;
436
+ escapeLeadingUnderscores(identifier: string): ast.__String;
437
+ tryGetAmbientModuleNameFromSymbolName(name: ast.__String): string | undefined;
438
+ tryCast<TOut extends TIn, TIn = any>(value: TIn | undefined, test: (value: TIn) => value is TOut): TOut | undefined;
439
+ cast<TOut extends TIn, TIn = any>(value: TIn | undefined, test: (value: TIn) => value is TOut): TOut;
440
+ hasExpression(node: Node): node is ast.HasExpression;
441
+ hasInitializer(node: Node): node is ast.HasInitializer;
442
+ hasObjectAssignmentInitializer(node: Node): node is ast.ObjectAssignmentInitializer;
443
+ isExternalModule(file: SourceFile): boolean;
444
+ getCombinedModifierFlags(node: ast.Declaration): ast.ModifierFlags;
445
+ getNameOfDeclaration(declaration: ast.Declaration | ast.Expression | undefined): ast.DeclarationName | undefined;
446
+ cloneSourceFileData(sourceFile: SourceFile): Record<string, unknown>;
447
+ visitEachChild: typeof ast.visitEachChild;
448
+ visitNode: typeof ast.visitNode;
449
+ visitNodes: typeof ast.visitNodes;
450
+ visitNodesArray: typeof ast.visitNodesArray;
451
+ forEachChildOfJSDocParameterTag: typeof ast.forEachChildOfJSDocParameterTag;
452
+ forEachChildOfJSDocPropertyTag: typeof ast.forEachChildOfJSDocParameterTag;
453
+ yieldEachChildOfJSDocParameterTag: typeof ast.yieldEachChildOfJSDocParameterTag;
454
+ yieldEachChildOfJSDocPropertyTag: typeof ast.yieldEachChildOfJSDocParameterTag;
455
+ visitEachChildOfJSDocParameterTag: typeof ast.visitEachChildOfJSDocParameterTag;
456
+ visitEachChildOfJSDocPropertyTag: typeof ast.visitEachChildOfJSDocParameterTag;
457
+ CharacterCodes: typeof ast.CharacterCodes;
458
+ CommentDirectiveType: typeof ast.CommentDirectiveType;
459
+ DiagnosticDirectivePolicy: typeof ast.DiagnosticDirectivePolicy;
460
+ InternalSymbolName: typeof ast.InternalSymbolName;
461
+ LanguageVariant: typeof ast.LanguageVariant;
462
+ ModifierFlags: typeof ast.ModifierFlags;
463
+ NodeFlags: typeof ast.NodeFlags;
464
+ RegularExpressionFlags: typeof ast.RegularExpressionFlags;
465
+ ScriptKind: typeof ScriptKind;
466
+ ScriptTarget: typeof ast.ScriptTarget;
467
+ SpanMapFeature: typeof ast.SpanMapFeature;
468
+ SpanMapFidelity: typeof ast.SpanMapFidelity;
469
+ SpanMapKind: typeof ast.SpanMapKind;
470
+ SyntaxKind: typeof ast.SyntaxKind;
471
+ TokenFlags: typeof ast.TokenFlags;
472
+ ModuleKind: typeof ModuleKind;
473
+ ModuleResolutionKind: typeof ModuleResolutionKind;
474
+ JsxEmit: typeof JsxEmit;
475
+ SymbolFlags: typeof SymbolFlags;
476
+ TypeFlags: typeof TypeFlags;
477
+ TypeFormatFlags: typeof TypeFormatFlags;
478
+ isStringLiteralLike: typeof ast.isStringLiteralLikeNode;
479
+ isFunctionLike: typeof ast.isFunctionLikeDeclaration;
480
+ isPropertySignature: typeof ast.isPropertySignatureDeclaration;
481
+ isParameter: typeof ast.isParameterDeclaration;
482
+ isIterationStatement: typeof isIterationStatement;
483
+ forEachChild: <T>(node: Node, visit: (child: Node) => T) => T | undefined;
484
+ createSourceFile: (file: string, text: string, _target?: unknown, _parents?: unknown, scriptKind?: ScriptKind) => Promise<SourceFile>;
485
+ readConfigFile: typeof readConfig;
486
+ parseJsonConfigFileContent: (config: unknown, _host: unknown, directory: string) => Promise<ParsedCommandLine>;
487
+ parseConfigFileTextToJson: typeof parseConfigText;
488
+ resolveProjectReferencePath: (reference: {
489
+ readonly path: string;
490
+ }) => string;
491
+ flattenDiagnosticMessageText: typeof flattenDiagnosticMessageText;
492
+ findConfigFile: typeof findConfigFile;
493
+ sys: {
494
+ fileExists: (file: string) => boolean;
495
+ readFile: (file: string) => string | undefined;
496
+ };
497
+ };
498
+ export default ts;
@@ -0,0 +1,33 @@
1
+ import { type DesignSystemEntry, type DesignUsageAllowance, type DesignUsageProblem } from "./analysis/design-usage.mts";
2
+ export type { DesignSystemEntry, DesignUsageAllowance, DesignUsageProblem } from "./analysis/design-usage.mts";
3
+ /** One finding in a source file: where, which rule, and what to do. */
4
+ export interface DesignUsageFinding {
5
+ readonly file: string;
6
+ /** 1-based. */
7
+ readonly line: number;
8
+ /** 1-based. */
9
+ readonly column: number;
10
+ /** `design-usage/<kind>`: stable, for filtering and reports. */
11
+ readonly code: `design-usage/${DesignUsageProblem["kind"]}`;
12
+ readonly message: string;
13
+ readonly repair: string;
14
+ }
15
+ /** A source file to check: its path (for the findings) and its text. */
16
+ export interface DesignUsageSource {
17
+ readonly file: string;
18
+ readonly text: string;
19
+ }
20
+ /**
21
+ * The design-use findings of `sources`, in the order given and in source order within a file.
22
+ * `entry` names the specifier the design system is imported from and which of its exports are
23
+ * patterns ({@link designSystemEntry} reads both from the design system's public entry file).
24
+ */
25
+ export declare function checkDesignUsage(sources: readonly DesignUsageSource[], entry: DesignSystemEntry, allowance?: DesignUsageAllowance): Promise<readonly DesignUsageFinding[]>;
26
+ /**
27
+ * The design system as the check needs it, read from its public entry file (the emitted or
28
+ * authored `index.ts`): `publicEntry` is the specifier sources import it by, and its patterns are
29
+ * the names the entry re-exports from `./patterns/`.
30
+ */
31
+ export declare function designSystemEntry(publicEntry: string, entryFile: string): Promise<DesignSystemEntry>;
32
+ /** Releases the parser the check started. Call it when the last check is done, or the process stays alive. */
33
+ export declare const closeDesignUsage: () => Promise<void>;
@@ -0,0 +1,20 @@
1
+ import { type Result } from "../result.mts";
2
+ export declare const GUARD_CONFIG_FILE = "ads-guard.config.json";
3
+ /** The configuration as written. */
4
+ export interface GuardConfig {
5
+ /** The specifier the application imports the design system by (`@acme/design`, `@ds`). */
6
+ readonly designSystem: string;
7
+ /**
8
+ * The design system's public entry file, relative to the configuration, when the specifier is an alias
9
+ * that Node cannot resolve (a bundler or TypeScript path). Without it the specifier is resolved as a package.
10
+ */
11
+ readonly entry?: string;
12
+ /** The folders with the application's sources, relative to the configuration. */
13
+ readonly include: readonly string[];
14
+ /** Folders and files under `include` that are not checked. Every run reports them. */
15
+ readonly exclude: readonly string[];
16
+ /** Components of other packages that carry no design, by package specifier. */
17
+ readonly allow: ReadonlyMap<string, ReadonlySet<string>>;
18
+ }
19
+ /** Reads and validates the configuration in `root`. Every problem is one message that names the field. */
20
+ export declare function readGuardConfig(root: string): Result<GuardConfig, readonly string[]>;
@@ -0,0 +1,16 @@
1
+ /** What a run covers, so a result always says how much of the source it speaks for. */
2
+ export interface GuardScope {
3
+ /** The files to check, relative to the root, sorted. */
4
+ readonly files: readonly string[];
5
+ /** The excluded paths of the configuration with the number of source files under each. */
6
+ readonly excluded: readonly {
7
+ readonly path: string;
8
+ readonly files: number;
9
+ }[];
10
+ /** Test files left out by convention. */
11
+ readonly tests: number;
12
+ /** Files of the design system itself, left out when it lives under an included folder. */
13
+ readonly designSystem: number;
14
+ }
15
+ /** The scope of a run. `designSystemFolder` is the folder of the design system's entry, absolute, or `null` when it is outside the root. */
16
+ export declare function guardScope(root: string, include: readonly string[], exclude: readonly string[], designSystemFolder: string | null): GuardScope;
@@ -0,0 +1,6 @@
1
+ export { checkDesignUsage, closeDesignUsage, designSystemEntry } from "../design-usage.mts";
2
+ export type { DesignSystemEntry, DesignUsageAllowance, DesignUsageFinding, DesignUsageProblem, DesignUsageSource } from "../design-usage.mts";
3
+ export { GUARD_CONFIG_FILE, readGuardConfig } from "./config.mts";
4
+ export type { GuardConfig } from "./config.mts";
5
+ export { guardText, runGuard } from "./run.mts";
6
+ export type { GuardReport } from "./run.mts";
@@ -0,0 +1,20 @@
1
+ import { type DesignUsageFinding } from "../design-usage.mts";
2
+ import { type Result } from "../result.mts";
3
+ import { type GuardScope } from "./files.mts";
4
+ /** A finished run. */
5
+ export interface GuardReport {
6
+ /** True when no file has a finding. */
7
+ readonly ok: boolean;
8
+ readonly designSystem: string;
9
+ /** The design system's public entry file, relative to the root where it is inside it. */
10
+ readonly entry: string;
11
+ /** The number of exports the entry declares as patterns. */
12
+ readonly patterns: number;
13
+ readonly checked: number;
14
+ readonly scope: Omit<GuardScope, "files">;
15
+ readonly findings: readonly DesignUsageFinding[];
16
+ }
17
+ /** Runs the guard for the application in `root`. An error is a problem with the configuration, not with the source. */
18
+ export declare function runGuard(root: string): Promise<Result<GuardReport, readonly string[]>>;
19
+ /** The report as text: one line for each finding, then what the run covered. */
20
+ export declare function guardText(report: GuardReport): string;
@@ -0,0 +1,34 @@
1
+ /** A success or a typed failure. Failures are values, not thrown control flow. */
2
+ export type Result<T, E> = Ok<T> | Err<E>;
3
+ export interface Ok<T> {
4
+ readonly kind: "ok";
5
+ readonly value: T;
6
+ }
7
+ export interface Err<E> {
8
+ readonly kind: "err";
9
+ readonly error: E;
10
+ }
11
+ export declare const ok: <T>(value: T) => Ok<T>;
12
+ export declare const err: <E>(error: E) => Err<E>;
13
+ /** Exhaustiveness guard for `switch` over a discriminated union. */
14
+ export declare function assertNever(value: never, context: string): never;
15
+ /** Collects successes in order; returns the first failure unchanged. */
16
+ export declare function collect<T, E>(results: Iterable<Result<T, E>>): Result<readonly T[], E>;
17
+ /** Maps a success, leaving a failure unchanged. */
18
+ export declare function map<T, U, E>(result: Result<T, E>, transform: (value: T) => U): Result<U, E>;
19
+ /** Maps a failure, leaving a success unchanged. */
20
+ export declare function mapErr<T, E, F>(result: Result<T, E>, transform: (error: E) => F): Result<T, F>;
21
+ /** Stops the enclosing {@link attempt} with a typed failure. */
22
+ export type Reject<E> = (failure: E) => never;
23
+ /**
24
+ * Runs deeply nested validation that stops at its first failure, returning that
25
+ * failure as a value. The rejection is private to this call: an unrelated
26
+ * exception, or a rejection from another attempt, propagates unchanged.
27
+ */
28
+ export declare function attempt<T, E>(run: (reject: Reject<E>) => T): Result<T, E>;
29
+ /** {@link attempt} for asynchronous work. */
30
+ export declare function attemptAsync<T, E>(run: (reject: Reject<E>) => Promise<T>): Promise<Result<T, E>>;
31
+ /** Unwraps a result inside an {@link attempt}, translating its failure. */
32
+ export declare function unwrapOr<T, E, F>(result: Result<T, E>, reject: Reject<F>, translate: (error: E) => F): T;
33
+ /** Message of an unknown thrown value, without assuming it is an Error. */
34
+ export declare function thrownMessage(thrown: unknown): string;
@@ -0,0 +1,9 @@
1
+ /** A plain object (not an array or a Map). */
2
+ export declare const isRecord: (value: unknown) => value is Readonly<Record<string, unknown>>;
3
+ export type ExportKind = "function" | "object" | "string";
4
+ /**
5
+ * Verifies a loaded module (an object, or a CommonJS function export) and its named exports (and an optional structural check),
6
+ * then returns it under its declared shape. A mismatch is a defect: the
7
+ * boundary's declaration and the module disagree.
8
+ */
9
+ export declare function checkedModule<T extends object>(module: unknown, label: string, exports: Readonly<Record<keyof T & string, ExportKind>>, valid?: (module: object) => boolean): T;