@suss/adapter-typescript 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/index.cjs +1751 -1416
- package/dist/index.d.cts +39 -9
- package/dist/index.d.ts +39 -9
- package/dist/index.js +1682 -1343
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SourceFile, Node, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, CallExpression, PropertyAccessExpression, TaggedTemplateExpression, Project, ImportDeclaration, ArrayLiteralExpression, ObjectLiteralExpression, ObjectLiteralElementLike,
|
|
1
|
+
import { SourceFile, Node, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, Symbol, CallExpression, PropertyAccessExpression, TaggedTemplateExpression, Project, ImportDeclaration, ArrayLiteralExpression, ObjectLiteralExpression, ObjectLiteralElementLike, Expression, NewExpression, Identifier } from 'ts-morph';
|
|
2
2
|
import { TransparentWrapper, RawCondition, DiscoveryPattern, TerminalPattern, InputMappingPattern, EffectArg, CallOps, LanguageAdapter, PatternPack, ExtractorOptions, TimingReport, CacheDiagnostic, ExtractionReport, InvocationRecognizer, AccessRecognizer, RawCodeStructure, RawTerminal, RawBranch, configuredCallOption, RawDeclaredContract, ContractPattern, AstCapableOps, ResponsePropertyMapping } from '@suss/extractor';
|
|
3
3
|
export { EmptyStage, ExtractionReport, PackFunnel, Timer, TimingReport, computeContentHash } from '@suss/extractor';
|
|
4
4
|
import { MessageBusSemantics, DeployableUnit, UnfollowedCall, WrapperReference, BehavioralSummary, BoundaryBinding, Predicate, TypeShape, ValueRef } from '@suss/behavioral-ir';
|
|
@@ -11,6 +11,12 @@ import { z } from 'zod';
|
|
|
11
11
|
interface FileSetQuery {
|
|
12
12
|
sourceFiles: ReadonlyArray<SourceFile>;
|
|
13
13
|
packages: ReadonlyArray<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Files the asking pack's code generator leaves beside a module it
|
|
16
|
+
* wrote into the project. A relative import into such a directory
|
|
17
|
+
* counts as an import of the package.
|
|
18
|
+
*/
|
|
19
|
+
generatedMarkers?: ReadonlyArray<string>;
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
/**
|
|
@@ -160,6 +166,18 @@ declare class ResolutionStore {
|
|
|
160
166
|
* parameter's own function with no join against `bodyCalls` needed.
|
|
161
167
|
*/
|
|
162
168
|
callsPassing(parameter: Node): PassedArgument[];
|
|
169
|
+
/**
|
|
170
|
+
* Whether this expression's value is the environment object: the way
|
|
171
|
+
* a pack spells it, a name declared as that, or a parameter some
|
|
172
|
+
* caller hands one to, however many calls deep.
|
|
173
|
+
*
|
|
174
|
+
* A parameter is the only shape whose answer can change once its
|
|
175
|
+
* callers are in, and reading those means reading every file that
|
|
176
|
+
* imports this one, so a value that is not one is answered from what
|
|
177
|
+
* the store already has.
|
|
178
|
+
*/
|
|
179
|
+
isEnvironmentValue(value: Node): boolean;
|
|
180
|
+
private hasAnswer;
|
|
163
181
|
/**
|
|
164
182
|
* Which parameters an environment read takes its variable's name
|
|
165
183
|
* from, for a reader standing at a call. One question covers the
|
|
@@ -174,15 +192,19 @@ declare class ResolutionStore {
|
|
|
174
192
|
envNamers(definedIn: SourceFile): EnvironmentNamers;
|
|
175
193
|
private sitesNamedBy;
|
|
176
194
|
/**
|
|
177
|
-
* Seed every
|
|
178
|
-
* per parameter. The question is dropped afterwards, so
|
|
179
|
-
* over a larger fact set derives it again.
|
|
195
|
+
* Seed every expression that spells the environment, derive, and take
|
|
196
|
+
* the sites back per parameter. The question is dropped afterwards, so
|
|
197
|
+
* a later ask over a larger fact set derives it again.
|
|
198
|
+
*
|
|
199
|
+
* The reads themselves cannot be the seed: one written through a
|
|
200
|
+
* parameter is off an object a scan of the source has no way to pick
|
|
201
|
+
* out, and the whole point of asking is to find those.
|
|
180
202
|
*/
|
|
181
203
|
private askEnvNamers;
|
|
182
204
|
/**
|
|
183
|
-
* The project's files that
|
|
184
|
-
*
|
|
185
|
-
*
|
|
205
|
+
* The project's files that hand the environment object somewhere,
|
|
206
|
+
* read into the store. Which files those are cannot depend on what a
|
|
207
|
+
* reader happened to ask about first, so the scan is over the
|
|
186
208
|
* project's own sources and it happens once.
|
|
187
209
|
*/
|
|
188
210
|
private environmentSiteFiles;
|
|
@@ -381,7 +403,14 @@ declare function collectAncestorBranches(terminalNode: Node, functionRoot: Funct
|
|
|
381
403
|
* a call into a dependency stays on the other side of it.
|
|
382
404
|
*/
|
|
383
405
|
|
|
384
|
-
declare function hasBody(fn:
|
|
406
|
+
declare function hasBody(fn: Node): boolean;
|
|
407
|
+
/**
|
|
408
|
+
* Every declaration behind a callee, with an imported or re-exported
|
|
409
|
+
* name followed through to its last one. A barrel that forwards a
|
|
410
|
+
* dependency's function would otherwise look like project code, because
|
|
411
|
+
* the only declaration in sight is the import in the calling file.
|
|
412
|
+
*/
|
|
413
|
+
declare function declarationsBehind(symbol: Symbol | undefined): Node[];
|
|
385
414
|
|
|
386
415
|
interface ClientCallSite {
|
|
387
416
|
callExpression: CallExpression;
|
|
@@ -592,6 +621,7 @@ interface DiscoveredUnit {
|
|
|
592
621
|
*/
|
|
593
622
|
routeUnfollowed?: UnfollowedCall[];
|
|
594
623
|
}
|
|
624
|
+
declare function toFunctionRoot(node: Node): FunctionRoot | null;
|
|
595
625
|
/** Walk to the nearest enclosing function-shaped node, or null if none. */
|
|
596
626
|
declare function findEnclosingFunction(node: Node): FunctionRoot | null;
|
|
597
627
|
|
|
@@ -1623,4 +1653,4 @@ declare function climbSyntax(node: Node): Node;
|
|
|
1623
1653
|
*/
|
|
1624
1654
|
declare function peelValue(node: Node): Node;
|
|
1625
1655
|
|
|
1626
|
-
export { ADAPTER_VERSION, type Accessed, type CallAccountingEntry, type CallAccountingOutcome, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DescentBarriers, type DiscoveredUnit, type EnvironmentNamers, type ExplainCallableOptions, type ExplainedResolution, type FoundTerminal, type FunctionRoot, GENERIC_TERMINALS, type ImportScanOptions, NO_BARRIERS, type ObservedStubCall, type RawBranchResult, type ReadNameOptions, ResolutionStore, type StubCallEvidence, type StubEvidenceOptions, TSCONFIG_NAMES, type TsDiscoveryContext, type TsInvocationRecognizerContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, TypeScriptWhySession, type WhySessionOptions, accessContextFor, arrayLiteralOf, buildProjectHelperIndex, callOpsFor, climbSyntax, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, couldNameAValue, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, discoverUnits, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findEnclosingFunction, findNearestTsconfig, findTerminals, functionTargetOf, functionValueOf, hasBody, importDeclarationsOf, importedNamesOf, importedRootsOf, invocationContextFor, isDefaultedAt, isImportedFrom, methodDeclaredIn, namedImportsOf, objectLiteralOf, parseConditionExpression, peelSyntax, peelValue, propertiesOf, propertyFunctionOf, propertyNameOf, propertyOf, propertyValueOf, readConfiguredCall, readContract, readContractForClientCall, readName, resolveAliasedSymbol, resolveSubject, rootIdentifier, startsItsOwnScope, stringPropertyOf, stringValueOf, stubEvidence, stubEvidenceIn, symbolBehind, workspaceRootFor, writtenNodeOf };
|
|
1656
|
+
export { ADAPTER_VERSION, type Accessed, type CallAccountingEntry, type CallAccountingOutcome, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DescentBarriers, type DiscoveredUnit, type EnvironmentNamers, type ExplainCallableOptions, type ExplainedResolution, type FoundTerminal, type FunctionRoot, GENERIC_TERMINALS, type ImportScanOptions, NO_BARRIERS, type ObservedStubCall, type RawBranchResult, type ReadNameOptions, ResolutionStore, type StubCallEvidence, type StubEvidenceOptions, TSCONFIG_NAMES, type TsDiscoveryContext, type TsInvocationRecognizerContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, TypeScriptWhySession, type WhySessionOptions, accessContextFor, arrayLiteralOf, buildProjectHelperIndex, callOpsFor, climbSyntax, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, couldNameAValue, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, declarationsBehind, discoverUnits, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findEnclosingFunction, findNearestTsconfig, findTerminals, functionTargetOf, functionValueOf, hasBody, importDeclarationsOf, importedNamesOf, importedRootsOf, invocationContextFor, isDefaultedAt, isImportedFrom, methodDeclaredIn, namedImportsOf, objectLiteralOf, parseConditionExpression, peelSyntax, peelValue, propertiesOf, propertyFunctionOf, propertyNameOf, propertyOf, propertyValueOf, readConfiguredCall, readContract, readContractForClientCall, readName, resolveAliasedSymbol, resolveSubject, rootIdentifier, startsItsOwnScope, stringPropertyOf, stringValueOf, stubEvidence, stubEvidenceIn, symbolBehind, toFunctionRoot, workspaceRootFor, writtenNodeOf };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SourceFile, Node, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, CallExpression, PropertyAccessExpression, TaggedTemplateExpression, Project, ImportDeclaration, ArrayLiteralExpression, ObjectLiteralExpression, ObjectLiteralElementLike,
|
|
1
|
+
import { SourceFile, Node, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, Symbol, CallExpression, PropertyAccessExpression, TaggedTemplateExpression, Project, ImportDeclaration, ArrayLiteralExpression, ObjectLiteralExpression, ObjectLiteralElementLike, Expression, NewExpression, Identifier } from 'ts-morph';
|
|
2
2
|
import { TransparentWrapper, RawCondition, DiscoveryPattern, TerminalPattern, InputMappingPattern, EffectArg, CallOps, LanguageAdapter, PatternPack, ExtractorOptions, TimingReport, CacheDiagnostic, ExtractionReport, InvocationRecognizer, AccessRecognizer, RawCodeStructure, RawTerminal, RawBranch, configuredCallOption, RawDeclaredContract, ContractPattern, AstCapableOps, ResponsePropertyMapping } from '@suss/extractor';
|
|
3
3
|
export { EmptyStage, ExtractionReport, PackFunnel, Timer, TimingReport, computeContentHash } from '@suss/extractor';
|
|
4
4
|
import { MessageBusSemantics, DeployableUnit, UnfollowedCall, WrapperReference, BehavioralSummary, BoundaryBinding, Predicate, TypeShape, ValueRef } from '@suss/behavioral-ir';
|
|
@@ -11,6 +11,12 @@ import { z } from 'zod';
|
|
|
11
11
|
interface FileSetQuery {
|
|
12
12
|
sourceFiles: ReadonlyArray<SourceFile>;
|
|
13
13
|
packages: ReadonlyArray<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Files the asking pack's code generator leaves beside a module it
|
|
16
|
+
* wrote into the project. A relative import into such a directory
|
|
17
|
+
* counts as an import of the package.
|
|
18
|
+
*/
|
|
19
|
+
generatedMarkers?: ReadonlyArray<string>;
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
/**
|
|
@@ -160,6 +166,18 @@ declare class ResolutionStore {
|
|
|
160
166
|
* parameter's own function with no join against `bodyCalls` needed.
|
|
161
167
|
*/
|
|
162
168
|
callsPassing(parameter: Node): PassedArgument[];
|
|
169
|
+
/**
|
|
170
|
+
* Whether this expression's value is the environment object: the way
|
|
171
|
+
* a pack spells it, a name declared as that, or a parameter some
|
|
172
|
+
* caller hands one to, however many calls deep.
|
|
173
|
+
*
|
|
174
|
+
* A parameter is the only shape whose answer can change once its
|
|
175
|
+
* callers are in, and reading those means reading every file that
|
|
176
|
+
* imports this one, so a value that is not one is answered from what
|
|
177
|
+
* the store already has.
|
|
178
|
+
*/
|
|
179
|
+
isEnvironmentValue(value: Node): boolean;
|
|
180
|
+
private hasAnswer;
|
|
163
181
|
/**
|
|
164
182
|
* Which parameters an environment read takes its variable's name
|
|
165
183
|
* from, for a reader standing at a call. One question covers the
|
|
@@ -174,15 +192,19 @@ declare class ResolutionStore {
|
|
|
174
192
|
envNamers(definedIn: SourceFile): EnvironmentNamers;
|
|
175
193
|
private sitesNamedBy;
|
|
176
194
|
/**
|
|
177
|
-
* Seed every
|
|
178
|
-
* per parameter. The question is dropped afterwards, so
|
|
179
|
-
* over a larger fact set derives it again.
|
|
195
|
+
* Seed every expression that spells the environment, derive, and take
|
|
196
|
+
* the sites back per parameter. The question is dropped afterwards, so
|
|
197
|
+
* a later ask over a larger fact set derives it again.
|
|
198
|
+
*
|
|
199
|
+
* The reads themselves cannot be the seed: one written through a
|
|
200
|
+
* parameter is off an object a scan of the source has no way to pick
|
|
201
|
+
* out, and the whole point of asking is to find those.
|
|
180
202
|
*/
|
|
181
203
|
private askEnvNamers;
|
|
182
204
|
/**
|
|
183
|
-
* The project's files that
|
|
184
|
-
*
|
|
185
|
-
*
|
|
205
|
+
* The project's files that hand the environment object somewhere,
|
|
206
|
+
* read into the store. Which files those are cannot depend on what a
|
|
207
|
+
* reader happened to ask about first, so the scan is over the
|
|
186
208
|
* project's own sources and it happens once.
|
|
187
209
|
*/
|
|
188
210
|
private environmentSiteFiles;
|
|
@@ -381,7 +403,14 @@ declare function collectAncestorBranches(terminalNode: Node, functionRoot: Funct
|
|
|
381
403
|
* a call into a dependency stays on the other side of it.
|
|
382
404
|
*/
|
|
383
405
|
|
|
384
|
-
declare function hasBody(fn:
|
|
406
|
+
declare function hasBody(fn: Node): boolean;
|
|
407
|
+
/**
|
|
408
|
+
* Every declaration behind a callee, with an imported or re-exported
|
|
409
|
+
* name followed through to its last one. A barrel that forwards a
|
|
410
|
+
* dependency's function would otherwise look like project code, because
|
|
411
|
+
* the only declaration in sight is the import in the calling file.
|
|
412
|
+
*/
|
|
413
|
+
declare function declarationsBehind(symbol: Symbol | undefined): Node[];
|
|
385
414
|
|
|
386
415
|
interface ClientCallSite {
|
|
387
416
|
callExpression: CallExpression;
|
|
@@ -592,6 +621,7 @@ interface DiscoveredUnit {
|
|
|
592
621
|
*/
|
|
593
622
|
routeUnfollowed?: UnfollowedCall[];
|
|
594
623
|
}
|
|
624
|
+
declare function toFunctionRoot(node: Node): FunctionRoot | null;
|
|
595
625
|
/** Walk to the nearest enclosing function-shaped node, or null if none. */
|
|
596
626
|
declare function findEnclosingFunction(node: Node): FunctionRoot | null;
|
|
597
627
|
|
|
@@ -1623,4 +1653,4 @@ declare function climbSyntax(node: Node): Node;
|
|
|
1623
1653
|
*/
|
|
1624
1654
|
declare function peelValue(node: Node): Node;
|
|
1625
1655
|
|
|
1626
|
-
export { ADAPTER_VERSION, type Accessed, type CallAccountingEntry, type CallAccountingOutcome, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DescentBarriers, type DiscoveredUnit, type EnvironmentNamers, type ExplainCallableOptions, type ExplainedResolution, type FoundTerminal, type FunctionRoot, GENERIC_TERMINALS, type ImportScanOptions, NO_BARRIERS, type ObservedStubCall, type RawBranchResult, type ReadNameOptions, ResolutionStore, type StubCallEvidence, type StubEvidenceOptions, TSCONFIG_NAMES, type TsDiscoveryContext, type TsInvocationRecognizerContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, TypeScriptWhySession, type WhySessionOptions, accessContextFor, arrayLiteralOf, buildProjectHelperIndex, callOpsFor, climbSyntax, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, couldNameAValue, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, discoverUnits, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findEnclosingFunction, findNearestTsconfig, findTerminals, functionTargetOf, functionValueOf, hasBody, importDeclarationsOf, importedNamesOf, importedRootsOf, invocationContextFor, isDefaultedAt, isImportedFrom, methodDeclaredIn, namedImportsOf, objectLiteralOf, parseConditionExpression, peelSyntax, peelValue, propertiesOf, propertyFunctionOf, propertyNameOf, propertyOf, propertyValueOf, readConfiguredCall, readContract, readContractForClientCall, readName, resolveAliasedSymbol, resolveSubject, rootIdentifier, startsItsOwnScope, stringPropertyOf, stringValueOf, stubEvidence, stubEvidenceIn, symbolBehind, workspaceRootFor, writtenNodeOf };
|
|
1656
|
+
export { ADAPTER_VERSION, type Accessed, type CallAccountingEntry, type CallAccountingOutcome, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DescentBarriers, type DiscoveredUnit, type EnvironmentNamers, type ExplainCallableOptions, type ExplainedResolution, type FoundTerminal, type FunctionRoot, GENERIC_TERMINALS, type ImportScanOptions, NO_BARRIERS, type ObservedStubCall, type RawBranchResult, type ReadNameOptions, ResolutionStore, type StubCallEvidence, type StubEvidenceOptions, TSCONFIG_NAMES, type TsDiscoveryContext, type TsInvocationRecognizerContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, TypeScriptWhySession, type WhySessionOptions, accessContextFor, arrayLiteralOf, buildProjectHelperIndex, callOpsFor, climbSyntax, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, couldNameAValue, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, declarationsBehind, discoverUnits, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findEnclosingFunction, findNearestTsconfig, findTerminals, functionTargetOf, functionValueOf, hasBody, importDeclarationsOf, importedNamesOf, importedRootsOf, invocationContextFor, isDefaultedAt, isImportedFrom, methodDeclaredIn, namedImportsOf, objectLiteralOf, parseConditionExpression, peelSyntax, peelValue, propertiesOf, propertyFunctionOf, propertyNameOf, propertyOf, propertyValueOf, readConfiguredCall, readContract, readContractForClientCall, readName, resolveAliasedSymbol, resolveSubject, rootIdentifier, startsItsOwnScope, stringPropertyOf, stringValueOf, stubEvidence, stubEvidenceIn, symbolBehind, toFunctionRoot, workspaceRootFor, writtenNodeOf };
|