@suss/adapter-typescript 0.13.0 → 0.13.2

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.cjs CHANGED
@@ -2688,13 +2688,22 @@ var ORIGIN = {
2688
2688
  declaredBy: (origin, receiver) => receiver.callee !== null && origin.importedFrom.some(
2689
2689
  (module2) => methodDeclaredIn(receiver.callee, module2, receiver.resolve)
2690
2690
  ),
2691
- constructed: (origin, receiver) => origin.importedFrom.some(
2691
+ constructed: (origin, receiver) => madeFromNamed(origin, madeBy(receiver)) && origin.importedFrom.some(
2692
2692
  (module2) => isImportedFrom(madeBy(receiver), module2)
2693
2693
  )
2694
2694
  };
2695
+ function madeFromNamed(origin, made) {
2696
+ if (origin.origin !== "constructed" || origin.named === void 0) {
2697
+ return true;
2698
+ }
2699
+ return origin.named.includes(made.getText());
2700
+ }
2695
2701
  var CALL_ORIGIN = {
2696
2702
  declaredBy: ORIGIN.declaredBy,
2697
- constructed: (origin, receiver) => origin.importedFrom.some(
2703
+ constructed: (origin, receiver) => madeFromNamed(
2704
+ origin,
2705
+ rootIdentifier(receiver.expression) ?? receiver.expression
2706
+ ) && origin.importedFrom.some(
2698
2707
  (module2) => isImportedFrom(
2699
2708
  rootIdentifier(receiver.expression) ?? receiver.expression,
2700
2709
  module2
@@ -2746,6 +2755,7 @@ function valueOpsFor(value, resolve2) {
2746
2755
  };
2747
2756
  return {
2748
2757
  text: () => literalText(written()),
2758
+ name: (unsettled) => readName(written(), { resolve: resolve2, unsettled }),
2749
2759
  flag: () => literalFlag(written()),
2750
2760
  entries: (unsettled) => entriesOf(written(), unsettled, resolve2),
2751
2761
  items: () => itemsOf(written(), resolve2),
package/dist/index.d.cts CHANGED
@@ -1,10 +1,8 @@
1
1
  import { SourceFile, Node, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, CallExpression, Project, Symbol, Expression, NewExpression, TaggedTemplateExpression, PropertyAccessExpression } from 'ts-morph';
2
- import { PackDeclarations, TransparentWrapper, RawCondition, DiscoveryPattern, TerminalPattern, InputMappingPattern, LanguageAdapter, PatternPack, ExtractorOptions, InvocationRecognizer, AccessRecognizer, RawCodeStructure, RawTerminal, RawBranch, EffectArg, RawDeclaredContract, ContractPattern, ResponsePropertyMapping } from '@suss/extractor';
2
+ import { PackDeclarations, TransparentWrapper, RawCondition, DiscoveryPattern, TerminalPattern, InputMappingPattern, LanguageAdapter, PatternPack, ExtractorOptions, InvocationRecognizer, AccessRecognizer, RawCodeStructure, RawTerminal, RawBranch, EffectArg, RawDeclaredContract, ContractPattern, AstCapableOps, CallOps, ResponsePropertyMapping } from '@suss/extractor';
3
3
  import { BehavioralSummary, MessageBusSemantics, DeployableUnit, BoundaryBinding, Predicate, TypeShape, ValueRef } from '@suss/behavioral-ir';
4
4
  import { Proof, Atom } from '@suss/datalog';
5
5
  import { ResolutionExplanation } from '@suss/resolution';
6
- import { AstCapableOps } from '@suss/recognize/ast';
7
- import { CallOps } from '@suss/recognize';
8
6
 
9
7
  /**
10
8
  * cache.ts: the on-disk extraction cache.
@@ -1014,7 +1012,7 @@ declare function parseConditionExpression(expr: Expression, depth?: number): Pre
1014
1012
  *
1015
1013
  * Every question here was already worked out somewhere in this adapter,
1016
1014
  * once per pack that needed it. Collecting them behind the one
1017
- * interface `@suss/recognize` declares is what lets a pack stop being a
1015
+ * interface `@suss/extractor` declares is what lets a pack stop being a
1018
1016
  * walk over ts-morph and start being data.
1019
1017
  *
1020
1018
  * Two of the receiver origins are implemented. The migration plan for
@@ -1106,7 +1104,7 @@ interface TsInvocationRecognizerContext {
1106
1104
  resolveWrittenValue(value: Node): Node | null;
1107
1105
  /**
1108
1106
  * What a declared pack asks about this call, in the vocabulary
1109
- * `@suss/recognize` defines. A pack written as a chain of data links
1107
+ * `@suss/extractor` defines. A pack written as a chain of data links
1110
1108
  * reads only this; the members above are what a pack written as code
1111
1109
  * reaches for.
1112
1110
  */
package/dist/index.d.ts CHANGED
@@ -1,10 +1,8 @@
1
1
  import { SourceFile, Node, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, CallExpression, Project, Symbol, Expression, NewExpression, TaggedTemplateExpression, PropertyAccessExpression } from 'ts-morph';
2
- import { PackDeclarations, TransparentWrapper, RawCondition, DiscoveryPattern, TerminalPattern, InputMappingPattern, LanguageAdapter, PatternPack, ExtractorOptions, InvocationRecognizer, AccessRecognizer, RawCodeStructure, RawTerminal, RawBranch, EffectArg, RawDeclaredContract, ContractPattern, ResponsePropertyMapping } from '@suss/extractor';
2
+ import { PackDeclarations, TransparentWrapper, RawCondition, DiscoveryPattern, TerminalPattern, InputMappingPattern, LanguageAdapter, PatternPack, ExtractorOptions, InvocationRecognizer, AccessRecognizer, RawCodeStructure, RawTerminal, RawBranch, EffectArg, RawDeclaredContract, ContractPattern, AstCapableOps, CallOps, ResponsePropertyMapping } from '@suss/extractor';
3
3
  import { BehavioralSummary, MessageBusSemantics, DeployableUnit, BoundaryBinding, Predicate, TypeShape, ValueRef } from '@suss/behavioral-ir';
4
4
  import { Proof, Atom } from '@suss/datalog';
5
5
  import { ResolutionExplanation } from '@suss/resolution';
6
- import { AstCapableOps } from '@suss/recognize/ast';
7
- import { CallOps } from '@suss/recognize';
8
6
 
9
7
  /**
10
8
  * cache.ts: the on-disk extraction cache.
@@ -1014,7 +1012,7 @@ declare function parseConditionExpression(expr: Expression, depth?: number): Pre
1014
1012
  *
1015
1013
  * Every question here was already worked out somewhere in this adapter,
1016
1014
  * once per pack that needed it. Collecting them behind the one
1017
- * interface `@suss/recognize` declares is what lets a pack stop being a
1015
+ * interface `@suss/extractor` declares is what lets a pack stop being a
1018
1016
  * walk over ts-morph and start being data.
1019
1017
  *
1020
1018
  * Two of the receiver origins are implemented. The migration plan for
@@ -1106,7 +1104,7 @@ interface TsInvocationRecognizerContext {
1106
1104
  resolveWrittenValue(value: Node): Node | null;
1107
1105
  /**
1108
1106
  * What a declared pack asks about this call, in the vocabulary
1109
- * `@suss/recognize` defines. A pack written as a chain of data links
1107
+ * `@suss/extractor` defines. A pack written as a chain of data links
1110
1108
  * reads only this; the members above are what a pack written as code
1111
1109
  * reaches for.
1112
1110
  */
package/dist/index.js CHANGED
@@ -2651,13 +2651,22 @@ var ORIGIN = {
2651
2651
  declaredBy: (origin, receiver) => receiver.callee !== null && origin.importedFrom.some(
2652
2652
  (module) => methodDeclaredIn(receiver.callee, module, receiver.resolve)
2653
2653
  ),
2654
- constructed: (origin, receiver) => origin.importedFrom.some(
2654
+ constructed: (origin, receiver) => madeFromNamed(origin, madeBy(receiver)) && origin.importedFrom.some(
2655
2655
  (module) => isImportedFrom(madeBy(receiver), module)
2656
2656
  )
2657
2657
  };
2658
+ function madeFromNamed(origin, made) {
2659
+ if (origin.origin !== "constructed" || origin.named === void 0) {
2660
+ return true;
2661
+ }
2662
+ return origin.named.includes(made.getText());
2663
+ }
2658
2664
  var CALL_ORIGIN = {
2659
2665
  declaredBy: ORIGIN.declaredBy,
2660
- constructed: (origin, receiver) => origin.importedFrom.some(
2666
+ constructed: (origin, receiver) => madeFromNamed(
2667
+ origin,
2668
+ rootIdentifier(receiver.expression) ?? receiver.expression
2669
+ ) && origin.importedFrom.some(
2661
2670
  (module) => isImportedFrom(
2662
2671
  rootIdentifier(receiver.expression) ?? receiver.expression,
2663
2672
  module
@@ -2709,6 +2718,7 @@ function valueOpsFor(value, resolve2) {
2709
2718
  };
2710
2719
  return {
2711
2720
  text: () => literalText(written()),
2721
+ name: (unsettled) => readName(written(), { resolve: resolve2, unsettled }),
2712
2722
  flag: () => literalFlag(written()),
2713
2723
  entries: (unsettled) => entriesOf(written(), unsettled, resolve2),
2714
2724
  items: () => itemsOf(written(), resolve2),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/adapter-typescript",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "type": "module",
5
5
  "description": "TypeScript adapter for suss — walks source files with ts-morph and emits raw extractions for the suss pipeline.",
6
6
  "keywords": [
@@ -46,11 +46,10 @@
46
46
  "typecheck": "tsc --noEmit"
47
47
  },
48
48
  "dependencies": {
49
- "@suss/behavioral-ir": "0.13.0",
50
- "@suss/datalog": "0.13.0",
51
- "@suss/extractor": "0.13.0",
52
- "@suss/recognize": "0.13.0",
53
- "@suss/resolution": "0.13.0",
49
+ "@suss/behavioral-ir": "0.13.2",
50
+ "@suss/datalog": "0.13.2",
51
+ "@suss/extractor": "0.13.2",
52
+ "@suss/resolution": "0.13.2",
54
53
  "graphql": "^16.8.0",
55
54
  "picomatch": "^4.0.4",
56
55
  "ts-morph": "^23.0.0"