@suss/adapter-ruby 0.30.0 → 0.31.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/dist/index.d.cts CHANGED
@@ -635,6 +635,8 @@ declare function createFileCache(parse: (source: string) => Promise<Node>, readF
635
635
  * among them, is one of these and can be passed straight through.
636
636
  */
637
637
  interface BodyReadOptions {
638
+ /** The run's own facts, which the value evaluator reads a name through. Absent in a test that builds one file by hand. */
639
+ readonly facts?: Database | undefined;
638
640
  /** What a pack needs to say a call talks to the database. Absent when no pack does. */
639
641
  readonly storage?: RbStorageOptions | undefined;
640
642
  /** The methods every pack in the run said its own library defines, which are left off an effect list. */
@@ -652,8 +654,6 @@ interface DiscoveryOptions extends BodyReadOptions {
652
654
  absoluteFile?: string;
653
655
  /** What a summary's `location.file` says for a file other than the one being read, which a controller's filters need when an ancestor defines them. */
654
656
  displayPathOf?: (absolute: string) => string;
655
- /** The run's own facts, which the value evaluator reads a name through. Absent in a test that builds one file by hand. */
656
- facts?: Database;
657
657
  cache: FileCache;
658
658
  /** Called once per discovered unit whose own body is a method this run can follow calls out of, so the reach walk has a place to start. */
659
659
  onReachSeed?: (raw: RawCodeStructure, seed: ReachSeed) => void;
@@ -742,6 +742,11 @@ declare function nodeId(filePath: string, node: Node): string;
742
742
  * The key a read of this expression joins on, for a caller that has an
743
743
  * expression in hand and wants to ask the rules about it. `enclosing` is
744
744
  * the method the expression is written in, or null outside one.
745
+ *
746
+ * Two Ruby spellings are keyed on a node rather than on a name. Ruby
747
+ * gives `receiver.method` no node of its own, so the method name is
748
+ * where the callee is keyed, and a name Ruby runs as a method is the
749
+ * call itself.
745
750
  */
746
751
  declare function readKey(filePath: string, written: Node, enclosing: Node | null): string;
747
752
  /**
@@ -856,6 +861,21 @@ interface ExtractRubyResult {
856
861
  summaries: BehavioralSummary[];
857
862
  facts: Database;
858
863
  }
864
+ /** One parsed file and the packs a run over it would load. */
865
+ interface FileFactsOptions {
866
+ file: string;
867
+ root: Node;
868
+ packs: readonly RubyPack[];
869
+ }
870
+ /**
871
+ * The facts for a single parsed file, with the evaluator bound to them,
872
+ * for a caller that has one file and no project. A pack's own tests need
873
+ * these: what built a receiver is an answer the rules give, and without
874
+ * facts they have nothing to give it from. A project run emits the same
875
+ * facts across every file at once, so a name written in another file
876
+ * resolves there and never here.
877
+ */
878
+ declare function factsForFile(options: FileFactsOptions): Database;
859
879
  declare function extractRubyProject(options: ExtractRubyOptions): Promise<ExtractRubyResult>;
860
880
  /** Every `.rb` file under `root`, depth-first, skipping the usual non-source directories. */
861
881
  declare function findRubyFiles(root: string): string[];
@@ -944,8 +964,12 @@ interface ProjectNodes {
944
964
  declare function bindEvaluator(db: Database, nodes: ProjectNodes): void;
945
965
  /** Strings to read for the parameters of the block or method `node` is written in, the way a caller would supply them. */
946
966
  type ParameterBindings = ReadonlyMap<string, string>;
947
- /** The abstract value `node` comes down to, through the facts when `db` was bound. */
948
- declare function evaluatedValue(node: Node, db?: Database, bindings?: ParameterBindings): Value;
967
+ /**
968
+ * The abstract value `node` comes down to, through the facts when `db`
969
+ * was bound. With a site, what it comes down to when the receiver
970
+ * behind it is the instance that site made; that run is not memoized.
971
+ */
972
+ declare function evaluatedValue(node: Node, db?: Database, bindings?: ParameterBindings, site?: string): Value;
949
973
  /** The one string `node` comes down to, or null when it does not settle on one. */
950
974
  declare function stringValueOf(node: Node, db?: Database, bindings?: ParameterBindings): string | null;
951
975
  /** Every method a file defines, keyed the way the facts key it, for `bindEvaluator`. */
@@ -961,4 +985,4 @@ declare function methodDefinitionsIn(file: string, root: Node): Map<string, Node
961
985
  */
962
986
  declare const ADAPTER_VERSION = "0.1.0";
963
987
 
964
- export { ADAPTER_VERSION, type AncestorEntry, type AncestorLookup, type Ancestry, type CallArgs, type ClassInfo, type ConstantPathConvention, type ControllerActions, type DiscoveryOptions, type EvaluatedFile, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type FileConstants, type GraphqlObjectFields, type GraphqlTypeNameConvention, type MethodLookup, type ParameterBindings, type ProjectNodes, type Range, type RbBodyBlock, type RbInflections, type RbStatusCall, type RbStoragePattern, type ReachedBody, type RubyDiscoveryPattern, type RubyExtendsSite, type RubyPack, type RubyRequireSite, type RubyStubEvidence, type RubyStubEvidenceOptions, type RubyValueHandle, RubyWhySession, type RubyWhySessionOptions, type TypeReadContext, ancestryOf, bindEvaluator, bodyStatements, booleanLiteralValue, collectFileConstants, createFileCache, discoverUnits, emitConstantBindings, emitEntryFact, emitValueFacts, evaluatedValue, extractRubyProject, field, findRubyFiles, graphqlTypeNameFromQualified, hashKeySymbolName, inheritedStatements, methodDefinitionsIn, methodInAncestry, nestedStatements, nodeId, parseRuby, parseRubySync, preloadRubyGrammar, qualifyConstantRef, reachDefinition, readCallArgs, readKey, resolveConstantFile, rubyStubEvidence, runStatements, stringLiteralValue, stringValueOf, symbolValue, typeShapeFromNode, underscoreConstantPath, unitKey, walkClasses, walkDefinitions };
988
+ export { ADAPTER_VERSION, type AncestorEntry, type AncestorLookup, type Ancestry, type CallArgs, type ClassInfo, type ConstantPathConvention, type ControllerActions, type DiscoveryOptions, type EvaluatedFile, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type FileConstants, type FileFactsOptions, type GraphqlObjectFields, type GraphqlTypeNameConvention, type MethodLookup, type ParameterBindings, type ProjectNodes, type Range, type RbBodyBlock, type RbInflections, type RbStatusCall, type RbStoragePattern, type ReachedBody, type RubyDiscoveryPattern, type RubyExtendsSite, type RubyPack, type RubyRequireSite, type RubyStubEvidence, type RubyStubEvidenceOptions, type RubyValueHandle, RubyWhySession, type RubyWhySessionOptions, type TypeReadContext, ancestryOf, bindEvaluator, bodyStatements, booleanLiteralValue, collectFileConstants, createFileCache, discoverUnits, emitConstantBindings, emitEntryFact, emitValueFacts, evaluatedValue, extractRubyProject, factsForFile, field, findRubyFiles, graphqlTypeNameFromQualified, hashKeySymbolName, inheritedStatements, methodDefinitionsIn, methodInAncestry, nestedStatements, nodeId, parseRuby, parseRubySync, preloadRubyGrammar, qualifyConstantRef, reachDefinition, readCallArgs, readKey, resolveConstantFile, rubyStubEvidence, runStatements, stringLiteralValue, stringValueOf, symbolValue, typeShapeFromNode, underscoreConstantPath, unitKey, walkClasses, walkDefinitions };
package/dist/index.d.ts CHANGED
@@ -635,6 +635,8 @@ declare function createFileCache(parse: (source: string) => Promise<Node>, readF
635
635
  * among them, is one of these and can be passed straight through.
636
636
  */
637
637
  interface BodyReadOptions {
638
+ /** The run's own facts, which the value evaluator reads a name through. Absent in a test that builds one file by hand. */
639
+ readonly facts?: Database | undefined;
638
640
  /** What a pack needs to say a call talks to the database. Absent when no pack does. */
639
641
  readonly storage?: RbStorageOptions | undefined;
640
642
  /** The methods every pack in the run said its own library defines, which are left off an effect list. */
@@ -652,8 +654,6 @@ interface DiscoveryOptions extends BodyReadOptions {
652
654
  absoluteFile?: string;
653
655
  /** What a summary's `location.file` says for a file other than the one being read, which a controller's filters need when an ancestor defines them. */
654
656
  displayPathOf?: (absolute: string) => string;
655
- /** The run's own facts, which the value evaluator reads a name through. Absent in a test that builds one file by hand. */
656
- facts?: Database;
657
657
  cache: FileCache;
658
658
  /** Called once per discovered unit whose own body is a method this run can follow calls out of, so the reach walk has a place to start. */
659
659
  onReachSeed?: (raw: RawCodeStructure, seed: ReachSeed) => void;
@@ -742,6 +742,11 @@ declare function nodeId(filePath: string, node: Node): string;
742
742
  * The key a read of this expression joins on, for a caller that has an
743
743
  * expression in hand and wants to ask the rules about it. `enclosing` is
744
744
  * the method the expression is written in, or null outside one.
745
+ *
746
+ * Two Ruby spellings are keyed on a node rather than on a name. Ruby
747
+ * gives `receiver.method` no node of its own, so the method name is
748
+ * where the callee is keyed, and a name Ruby runs as a method is the
749
+ * call itself.
745
750
  */
746
751
  declare function readKey(filePath: string, written: Node, enclosing: Node | null): string;
747
752
  /**
@@ -856,6 +861,21 @@ interface ExtractRubyResult {
856
861
  summaries: BehavioralSummary[];
857
862
  facts: Database;
858
863
  }
864
+ /** One parsed file and the packs a run over it would load. */
865
+ interface FileFactsOptions {
866
+ file: string;
867
+ root: Node;
868
+ packs: readonly RubyPack[];
869
+ }
870
+ /**
871
+ * The facts for a single parsed file, with the evaluator bound to them,
872
+ * for a caller that has one file and no project. A pack's own tests need
873
+ * these: what built a receiver is an answer the rules give, and without
874
+ * facts they have nothing to give it from. A project run emits the same
875
+ * facts across every file at once, so a name written in another file
876
+ * resolves there and never here.
877
+ */
878
+ declare function factsForFile(options: FileFactsOptions): Database;
859
879
  declare function extractRubyProject(options: ExtractRubyOptions): Promise<ExtractRubyResult>;
860
880
  /** Every `.rb` file under `root`, depth-first, skipping the usual non-source directories. */
861
881
  declare function findRubyFiles(root: string): string[];
@@ -944,8 +964,12 @@ interface ProjectNodes {
944
964
  declare function bindEvaluator(db: Database, nodes: ProjectNodes): void;
945
965
  /** Strings to read for the parameters of the block or method `node` is written in, the way a caller would supply them. */
946
966
  type ParameterBindings = ReadonlyMap<string, string>;
947
- /** The abstract value `node` comes down to, through the facts when `db` was bound. */
948
- declare function evaluatedValue(node: Node, db?: Database, bindings?: ParameterBindings): Value;
967
+ /**
968
+ * The abstract value `node` comes down to, through the facts when `db`
969
+ * was bound. With a site, what it comes down to when the receiver
970
+ * behind it is the instance that site made; that run is not memoized.
971
+ */
972
+ declare function evaluatedValue(node: Node, db?: Database, bindings?: ParameterBindings, site?: string): Value;
949
973
  /** The one string `node` comes down to, or null when it does not settle on one. */
950
974
  declare function stringValueOf(node: Node, db?: Database, bindings?: ParameterBindings): string | null;
951
975
  /** Every method a file defines, keyed the way the facts key it, for `bindEvaluator`. */
@@ -961,4 +985,4 @@ declare function methodDefinitionsIn(file: string, root: Node): Map<string, Node
961
985
  */
962
986
  declare const ADAPTER_VERSION = "0.1.0";
963
987
 
964
- export { ADAPTER_VERSION, type AncestorEntry, type AncestorLookup, type Ancestry, type CallArgs, type ClassInfo, type ConstantPathConvention, type ControllerActions, type DiscoveryOptions, type EvaluatedFile, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type FileConstants, type GraphqlObjectFields, type GraphqlTypeNameConvention, type MethodLookup, type ParameterBindings, type ProjectNodes, type Range, type RbBodyBlock, type RbInflections, type RbStatusCall, type RbStoragePattern, type ReachedBody, type RubyDiscoveryPattern, type RubyExtendsSite, type RubyPack, type RubyRequireSite, type RubyStubEvidence, type RubyStubEvidenceOptions, type RubyValueHandle, RubyWhySession, type RubyWhySessionOptions, type TypeReadContext, ancestryOf, bindEvaluator, bodyStatements, booleanLiteralValue, collectFileConstants, createFileCache, discoverUnits, emitConstantBindings, emitEntryFact, emitValueFacts, evaluatedValue, extractRubyProject, field, findRubyFiles, graphqlTypeNameFromQualified, hashKeySymbolName, inheritedStatements, methodDefinitionsIn, methodInAncestry, nestedStatements, nodeId, parseRuby, parseRubySync, preloadRubyGrammar, qualifyConstantRef, reachDefinition, readCallArgs, readKey, resolveConstantFile, rubyStubEvidence, runStatements, stringLiteralValue, stringValueOf, symbolValue, typeShapeFromNode, underscoreConstantPath, unitKey, walkClasses, walkDefinitions };
988
+ export { ADAPTER_VERSION, type AncestorEntry, type AncestorLookup, type Ancestry, type CallArgs, type ClassInfo, type ConstantPathConvention, type ControllerActions, type DiscoveryOptions, type EvaluatedFile, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type FileConstants, type FileFactsOptions, type GraphqlObjectFields, type GraphqlTypeNameConvention, type MethodLookup, type ParameterBindings, type ProjectNodes, type Range, type RbBodyBlock, type RbInflections, type RbStatusCall, type RbStoragePattern, type ReachedBody, type RubyDiscoveryPattern, type RubyExtendsSite, type RubyPack, type RubyRequireSite, type RubyStubEvidence, type RubyStubEvidenceOptions, type RubyValueHandle, RubyWhySession, type RubyWhySessionOptions, type TypeReadContext, ancestryOf, bindEvaluator, bodyStatements, booleanLiteralValue, collectFileConstants, createFileCache, discoverUnits, emitConstantBindings, emitEntryFact, emitValueFacts, evaluatedValue, extractRubyProject, factsForFile, field, findRubyFiles, graphqlTypeNameFromQualified, hashKeySymbolName, inheritedStatements, methodDefinitionsIn, methodInAncestry, nestedStatements, nodeId, parseRuby, parseRubySync, preloadRubyGrammar, qualifyConstantRef, reachDefinition, readCallArgs, readKey, resolveConstantFile, rubyStubEvidence, runStatements, stringLiteralValue, stringValueOf, symbolValue, typeShapeFromNode, underscoreConstantPath, unitKey, walkClasses, walkDefinitions };