@teambit/schema 1.0.256 → 1.0.258

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.
@@ -714,152 +714,161 @@
714
714
  "defaultValue": "['hi', 'there']"
715
715
  },
716
716
  {
717
- "__schema": "ClassSchema",
717
+ "__schema": "ExportSchema",
718
718
  "location": {
719
719
  "filePath": "index.ts",
720
- "line": 36,
721
- "character": 1
720
+ "line": 50,
721
+ "character": 10
722
722
  },
723
- "signature": "class ClassSomething",
724
723
  "name": "ClassSomething",
725
- "members": [
726
- {
727
- "__schema": "VariableLikeSchema",
728
- "location": {
729
- "filePath": "index.ts",
730
- "line": 37,
731
- "character": 3
732
- },
733
- "signature": "(property) ClassSomething.app: string",
734
- "name": "app",
735
- "type": {
736
- "__schema": "InferenceTypeSchema",
724
+ "exportNode": {
725
+ "__schema": "ClassSchema",
726
+ "location": {
727
+ "filePath": "index.ts",
728
+ "line": 36,
729
+ "character": 1
730
+ },
731
+ "signature": "class ClassSomething",
732
+ "name": "ClassSomething",
733
+ "members": [
734
+ {
735
+ "__schema": "VariableLikeSchema",
737
736
  "location": {
738
737
  "filePath": "index.ts",
739
738
  "line": 37,
740
739
  "character": 3
741
740
  },
742
- "type": "string"
743
- },
744
- "isOptional": true,
745
- "defaultValue": "''"
746
- },
747
- {
748
- "__schema": "ConstructorSchema",
749
- "location": {
750
- "filePath": "index.ts",
751
- "line": 38,
752
- "character": 3
753
- },
754
- "signature": "constructor ClassSomething(da: 'dsa'): ClassSomething",
755
- "name": "constructor",
756
- "params": [
757
- {
758
- "__schema": "ParameterSchema",
741
+ "signature": "(property) ClassSomething.app: string",
742
+ "name": "app",
743
+ "type": {
744
+ "__schema": "InferenceTypeSchema",
759
745
  "location": {
760
746
  "filePath": "index.ts",
761
- "line": 38,
762
- "character": 15
747
+ "line": 37,
748
+ "character": 3
763
749
  },
764
- "name": "da",
765
- "type": {
766
- "__schema": "LiteralTypeSchema",
750
+ "type": "string"
751
+ },
752
+ "isOptional": true,
753
+ "defaultValue": "''"
754
+ },
755
+ {
756
+ "__schema": "ConstructorSchema",
757
+ "location": {
758
+ "filePath": "index.ts",
759
+ "line": 38,
760
+ "character": 3
761
+ },
762
+ "signature": "constructor ClassSomething(da: 'dsa'): ClassSomething",
763
+ "name": "constructor",
764
+ "params": [
765
+ {
766
+ "__schema": "ParameterSchema",
767
767
  "location": {
768
768
  "filePath": "index.ts",
769
769
  "line": 38,
770
- "character": 28
770
+ "character": 15
771
771
  },
772
- "name": "'dsa'"
772
+ "name": "da",
773
+ "type": {
774
+ "__schema": "LiteralTypeSchema",
775
+ "location": {
776
+ "filePath": "index.ts",
777
+ "line": 38,
778
+ "character": 28
779
+ },
780
+ "name": "'dsa'"
781
+ },
782
+ "isOptional": false,
783
+ "isSpread": false
784
+ }
785
+ ],
786
+ "returnType": {
787
+ "__schema": "ThisTypeSchema",
788
+ "location": {
789
+ "filePath": "index.ts",
790
+ "line": 36,
791
+ "character": 1
773
792
  },
774
- "isOptional": false,
775
- "isSpread": false
776
- }
777
- ],
778
- "returnType": {
779
- "__schema": "ThisTypeSchema",
780
- "location": {
781
- "filePath": "index.ts",
782
- "line": 36,
783
- "character": 1
793
+ "name": "ClassSomething"
784
794
  },
785
- "name": "ClassSomething"
786
- },
787
- "modifiers": []
788
- },
789
- {
790
- "__schema": "FunctionLikeSchema",
791
- "location": {
792
- "filePath": "index.ts",
793
- "line": 40,
794
- "character": 3
795
+ "modifiers": []
795
796
  },
796
- "signature": "(method) ClassSomething.a(): Foo",
797
- "name": "a",
798
- "params": [],
799
- "returnType": {
800
- "__schema": "TypeRefSchema",
797
+ {
798
+ "__schema": "FunctionLikeSchema",
801
799
  "location": {
802
800
  "filePath": "index.ts",
803
801
  "line": 40,
804
802
  "character": 3
805
803
  },
806
- "name": "Foo",
807
- "internalFilePath": "index.ts"
808
- },
809
- "modifiers": []
810
- },
811
- {
812
- "__schema": "GetAccessorSchema",
813
- "location": {
814
- "filePath": "index.ts",
815
- "line": 43,
816
- "character": 3
804
+ "signature": "(method) ClassSomething.a(): Foo",
805
+ "name": "a",
806
+ "params": [],
807
+ "returnType": {
808
+ "__schema": "TypeRefSchema",
809
+ "location": {
810
+ "filePath": "index.ts",
811
+ "line": 40,
812
+ "character": 3
813
+ },
814
+ "name": "Foo",
815
+ "internalFilePath": "index.ts"
816
+ },
817
+ "modifiers": []
817
818
  },
818
- "signature": "(getter) ClassSomething.getter: string",
819
- "name": "getter",
820
- "type": {
821
- "__schema": "InferenceTypeSchema",
819
+ {
820
+ "__schema": "GetAccessorSchema",
822
821
  "location": {
823
822
  "filePath": "index.ts",
824
823
  "line": 43,
825
824
  "character": 3
826
825
  },
827
- "type": "string"
828
- }
829
- },
830
- {
831
- "__schema": "SetAccessorSchema",
832
- "location": {
833
- "filePath": "index.ts",
834
- "line": 47,
835
- "character": 3
826
+ "signature": "(getter) ClassSomething.getter: string",
827
+ "name": "getter",
828
+ "type": {
829
+ "__schema": "InferenceTypeSchema",
830
+ "location": {
831
+ "filePath": "index.ts",
832
+ "line": 43,
833
+ "character": 3
834
+ },
835
+ "type": "string"
836
+ }
836
837
  },
837
- "signature": "(setter) ClassSomething.setter: boolean",
838
- "name": "setter",
839
- "param": {
840
- "__schema": "ParameterSchema",
838
+ {
839
+ "__schema": "SetAccessorSchema",
841
840
  "location": {
842
841
  "filePath": "index.ts",
843
842
  "line": 47,
844
- "character": 14
843
+ "character": 3
845
844
  },
846
- "name": "a",
847
- "type": {
848
- "__schema": "KeywordTypeSchema",
845
+ "signature": "(setter) ClassSomething.setter: boolean",
846
+ "name": "setter",
847
+ "param": {
848
+ "__schema": "ParameterSchema",
849
849
  "location": {
850
850
  "filePath": "index.ts",
851
851
  "line": 47,
852
- "character": 17
852
+ "character": 14
853
853
  },
854
- "name": "boolean"
855
- },
856
- "isOptional": false,
857
- "isSpread": false
854
+ "name": "a",
855
+ "type": {
856
+ "__schema": "KeywordTypeSchema",
857
+ "location": {
858
+ "filePath": "index.ts",
859
+ "line": 47,
860
+ "character": 17
861
+ },
862
+ "name": "boolean"
863
+ },
864
+ "isOptional": false,
865
+ "isSpread": false
866
+ }
858
867
  }
859
- }
860
- ],
861
- "extendsNodes": [],
862
- "implementNodes": []
868
+ ],
869
+ "extendsNodes": [],
870
+ "implementNodes": []
871
+ }
863
872
  },
864
873
  {
865
874
  "__schema": "TypeSchema",
@@ -1,6 +1,6 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.semantics_schema@1.0.256/dist/schema.composition.js';
2
- import * as compositions_1 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.semantics_schema@1.0.256/dist/mock/button/button.composition.js';
3
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.semantics_schema@1.0.256/dist/schema.docs.mdx';
1
+ import * as compositions_0 from '/Users/giladshoham/Library/Caches/Bit/capsules/root/b5ea46ec3/teambit.semantics_schema@1.0.258/dist/schema.composition.js';
2
+ import * as compositions_1 from '/Users/giladshoham/Library/Caches/Bit/capsules/root/b5ea46ec3/teambit.semantics_schema@1.0.258/dist/mock/button/button.composition.js';
3
+ import * as overview_0 from '/Users/giladshoham/Library/Caches/Bit/capsules/root/b5ea46ec3/teambit.semantics_schema@1.0.258/dist/schema.docs.mdx';
4
4
 
5
5
  export const compositions = [compositions_0, compositions_1];
6
6
  export const overview = [overview_0];
@@ -47,9 +47,7 @@ function schemaSchema(schema) {
47
47
  }) => {
48
48
  const componentId = await host.resolveComponentId(id);
49
49
  const component = await host.get(componentId);
50
- const empty = {
51
- exports: []
52
- };
50
+ const empty = _semanticsEntities().APISchema.empty(componentId).toObject();
53
51
  if (!component) return empty;
54
52
  const api = await schema.getSchema(component, undefined, undefined, undefined, undefined, skipInternals);
55
53
  if (!api) return empty;
@@ -61,9 +59,19 @@ function schemaSchema(schema) {
61
59
  }
62
60
  function filterUnimplementedAndAddDefaults(api) {
63
61
  const apiObject = api.toObject();
64
- const filteredExports = apiObject.module.exports.filter(exp => exp.__schema !== _semanticsEntities().UnImplementedSchema.name);
62
+ const filteredExports = apiObject.module.exports.filter(exp => {
63
+ if (exp.exportNode) {
64
+ return exp.exportNode.__schema !== _semanticsEntities().UnImplementedSchema.name;
65
+ }
66
+ return exp.__schema !== _semanticsEntities().UnImplementedSchema.name;
67
+ });
65
68
  const filteredInternals = apiObject.internals.map(internalObject => {
66
- const filteredInternalExports = internalObject.exports.filter(exp => exp.__schema !== _semanticsEntities().UnImplementedSchema.name);
69
+ const filteredInternalExports = internalObject.exports.filter(exp => {
70
+ if (exp.exportNode) {
71
+ return exp.exportNode.__schema !== _semanticsEntities().UnImplementedSchema.name;
72
+ }
73
+ return exp.__schema !== _semanticsEntities().UnImplementedSchema.name;
74
+ });
67
75
  const filteredInternalNodes = internalObject.internals.filter(exp => exp.__schema !== _semanticsEntities().UnImplementedSchema.name);
68
76
  return _objectSpread(_objectSpread({}, internalObject), {}, {
69
77
  exports: filteredInternalExports,
@@ -71,9 +79,18 @@ function filterUnimplementedAndAddDefaults(api) {
71
79
  });
72
80
  });
73
81
  const filteredTaggedExports = apiObject.taggedModuleExports.filter(exp => exp.__schema !== _semanticsEntities().UnImplementedSchema.name);
74
- const defaultTaggedExports = filteredExports.filter(exportedModule => exportedModule.__schema === 'ReactSchema');
82
+ const defaultTaggedExports = filteredExports.filter(exportedModule => {
83
+ if (exportedModule.exportNode) {
84
+ return exportedModule.exportNode.__schema === 'ReactSchema';
85
+ }
86
+ return exportedModule.__schema === 'ReactSchema';
87
+ }).map(exportedModule => {
88
+ if (exportedModule.exportNode) {
89
+ return exportedModule.exportNode;
90
+ }
91
+ return exportedModule;
92
+ });
75
93
  return _objectSpread(_objectSpread({}, apiObject), {}, {
76
- exports: filteredExports,
77
94
  internals: filteredInternals,
78
95
  taggedModuleExports: filteredTaggedExports.length > 0 ? filteredTaggedExports : defaultTaggedExports
79
96
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_graphqlTypeJson","data","require","_graphqlTag","_semanticsEntities","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","schemaSchema","schema","typeDefs","gql","resolvers","JSONObject","GraphQLJSONObject","ComponentHost","getSchema","host","id","skipInternals","componentId","resolveComponentId","component","get","empty","exports","api","undefined","filterUnimplementedAndAddDefaults","apiObject","toObject","filteredExports","module","exp","__schema","UnImplementedSchema","name","filteredInternals","internals","map","internalObject","filteredInternalExports","filteredInternalNodes","filteredTaggedExports","taggedModuleExports","defaultTaggedExports","exportedModule"],"sources":["schema.graphql.ts"],"sourcesContent":["import { ComponentFactory } from '@teambit/component';\nimport { GraphQLJSONObject } from 'graphql-type-json';\nimport { gql } from 'graphql-tag';\nimport { APISchema, UnImplementedSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { Schema } from '@teambit/graphql';\nimport { SchemaMain } from './schema.main.runtime';\n\nexport function schemaSchema(schema: SchemaMain): Schema {\n return {\n typeDefs: gql`\n scalar JSONObject\n extend type ComponentHost {\n getSchema(id: String!, skipInternals: Boolean): JSONObject\n }\n `,\n resolvers: {\n JSONObject: GraphQLJSONObject,\n ComponentHost: {\n getSchema: async (host: ComponentFactory, { id, skipInternals }: { id: string; skipInternals?: boolean }) => {\n const componentId = await host.resolveComponentId(id);\n const component = await host.get(componentId);\n const empty = {\n exports: [],\n };\n\n if (!component) return empty;\n const api = await schema.getSchema(component, undefined, undefined, undefined, undefined, skipInternals);\n if (!api) return empty;\n\n return filterUnimplementedAndAddDefaults(api);\n },\n },\n },\n };\n}\n\nfunction filterUnimplementedAndAddDefaults(api: APISchema) {\n const apiObject = api.toObject();\n const filteredExports = apiObject.module.exports.filter((exp) => exp.__schema !== UnImplementedSchema.name);\n const filteredInternals = apiObject.internals.map((internalObject) => {\n const filteredInternalExports = internalObject.exports.filter((exp) => exp.__schema !== UnImplementedSchema.name);\n const filteredInternalNodes = internalObject.internals.filter((exp) => exp.__schema !== UnImplementedSchema.name);\n return {\n ...internalObject,\n exports: filteredInternalExports,\n internals: filteredInternalNodes,\n };\n });\n\n const filteredTaggedExports = apiObject.taggedModuleExports.filter(\n (exp) => exp.__schema !== UnImplementedSchema.name\n );\n\n const defaultTaggedExports = filteredExports.filter((exportedModule) => exportedModule.__schema === 'ReactSchema');\n\n return {\n ...apiObject,\n exports: filteredExports,\n internals: filteredInternals,\n taggedModuleExports: filteredTaggedExports.length > 0 ? filteredTaggedExports : defaultTaggedExports,\n };\n}\n"],"mappings":";;;;;;AACA,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6F,SAAAI,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAA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AC5C,MAAM,CAAEoD,GAAG,IAAKA,GAAG,CAACC,QAAQ,KAAKC,wCAAmB,CAACC,IAAI,CAAC;IACjH,MAAMM,qBAAqB,GAAGF,cAAc,CAACF,SAAS,CAACzD,MAAM,CAAEoD,GAAG,IAAKA,GAAG,CAACC,QAAQ,KAAKC,wCAAmB,CAACC,IAAI,CAAC;IACjH,OAAAlD,aAAA,CAAAA,aAAA,KACKsD,cAAc;MACjBf,OAAO,EAAEgB,uBAAuB;MAChCH,SAAS,EAAEI;IAAqB;EAEpC,CAAC,CAAC;EAEF,MAAMC,qBAAqB,GAAGd,SAAS,CAACe,mBAAmB,CAAC/D,MAAM,CAC/DoD,GAAG,IAAKA,GAAG,CAACC,QAAQ,KAAKC,wCAAmB,CAACC,IAChD,CAAC;EAED,MAAMS,oBAAoB,GAAGd,eAAe,CAAClD,MAAM,CAAEiE,cAAc,IAAKA,cAAc,CAACZ,QAAQ,KAAK,aAAa,CAAC;EAElH,OAAAhD,aAAA,CAAAA,aAAA,KACK2C,SAAS;IACZJ,OAAO,EAAEM,eAAe;IACxBO,SAAS,EAAED,iBAAiB;IAC5BO,mBAAmB,EAAED,qBAAqB,CAACvD,MAAM,GAAG,CAAC,GAAGuD,qBAAqB,GAAGE;EAAoB;AAExG","ignoreList":[]}
1
+ {"version":3,"names":["_graphqlTypeJson","data","require","_graphqlTag","_semanticsEntities","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","schemaSchema","schema","typeDefs","gql","resolvers","JSONObject","GraphQLJSONObject","ComponentHost","getSchema","host","id","skipInternals","componentId","resolveComponentId","component","get","empty","APISchema","toObject","api","undefined","filterUnimplementedAndAddDefaults","apiObject","filteredExports","module","exports","exp","exportNode","__schema","UnImplementedSchema","name","filteredInternals","internals","map","internalObject","filteredInternalExports","filteredInternalNodes","filteredTaggedExports","taggedModuleExports","defaultTaggedExports","exportedModule"],"sources":["schema.graphql.ts"],"sourcesContent":["import { ComponentFactory } from '@teambit/component';\nimport { GraphQLJSONObject } from 'graphql-type-json';\nimport { gql } from 'graphql-tag';\nimport { APISchema, UnImplementedSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { Schema } from '@teambit/graphql';\nimport { SchemaMain } from './schema.main.runtime';\n\nexport function schemaSchema(schema: SchemaMain): Schema {\n return {\n typeDefs: gql`\n scalar JSONObject\n extend type ComponentHost {\n getSchema(id: String!, skipInternals: Boolean): JSONObject\n }\n `,\n resolvers: {\n JSONObject: GraphQLJSONObject,\n ComponentHost: {\n getSchema: async (host: ComponentFactory, { id, skipInternals }: { id: string; skipInternals?: boolean }) => {\n const componentId = await host.resolveComponentId(id);\n const component = await host.get(componentId);\n const empty = APISchema.empty(componentId).toObject();\n\n if (!component) return empty;\n const api = await schema.getSchema(component, undefined, undefined, undefined, undefined, skipInternals);\n if (!api) return empty;\n\n return filterUnimplementedAndAddDefaults(api);\n },\n },\n },\n };\n}\n\nfunction filterUnimplementedAndAddDefaults(api: APISchema) {\n const apiObject = api.toObject();\n\n const filteredExports = apiObject.module.exports.filter((exp) => {\n if (exp.exportNode) {\n return exp.exportNode.__schema !== UnImplementedSchema.name;\n }\n return (exp as Record<string, any>).__schema !== UnImplementedSchema.name;\n });\n\n const filteredInternals = apiObject.internals.map((internalObject) => {\n const filteredInternalExports = internalObject.exports.filter((exp) => {\n if (exp.exportNode) {\n return exp.exportNode.__schema !== UnImplementedSchema.name;\n }\n return (exp as Record<string, any>).__schema !== UnImplementedSchema.name;\n });\n const filteredInternalNodes = internalObject.internals.filter((exp) => exp.__schema !== UnImplementedSchema.name);\n return {\n ...internalObject,\n exports: filteredInternalExports,\n internals: filteredInternalNodes,\n };\n });\n\n const filteredTaggedExports = apiObject.taggedModuleExports.filter(\n (exp) => exp.__schema !== UnImplementedSchema.name\n );\n\n const defaultTaggedExports = filteredExports\n .filter((exportedModule) => {\n if (exportedModule.exportNode) {\n return exportedModule.exportNode.__schema === 'ReactSchema';\n }\n return (exportedModule as Record<string, any>).__schema === 'ReactSchema';\n })\n .map((exportedModule) => {\n if (exportedModule.exportNode) {\n return exportedModule.exportNode;\n }\n return exportedModule;\n });\n\n return {\n ...apiObject,\n internals: filteredInternals,\n taggedModuleExports: filteredTaggedExports.length > 0 ? filteredTaggedExports : defaultTaggedExports,\n };\n}\n"],"mappings":";;;;;;AACA,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6F,SAAAI,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WA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,qBAAqB,GAAGE;EAAoB;AAExG","ignoreList":[]}
@@ -714,152 +714,161 @@
714
714
  "defaultValue": "['hi', 'there']"
715
715
  },
716
716
  {
717
- "__schema": "ClassSchema",
717
+ "__schema": "ExportSchema",
718
718
  "location": {
719
719
  "filePath": "index.ts",
720
- "line": 36,
721
- "character": 1
720
+ "line": 50,
721
+ "character": 10
722
722
  },
723
- "signature": "class ClassSomething",
724
723
  "name": "ClassSomething",
725
- "members": [
726
- {
727
- "__schema": "VariableLikeSchema",
728
- "location": {
729
- "filePath": "index.ts",
730
- "line": 37,
731
- "character": 3
732
- },
733
- "signature": "(property) ClassSomething.app: string",
734
- "name": "app",
735
- "type": {
736
- "__schema": "InferenceTypeSchema",
724
+ "exportNode": {
725
+ "__schema": "ClassSchema",
726
+ "location": {
727
+ "filePath": "index.ts",
728
+ "line": 36,
729
+ "character": 1
730
+ },
731
+ "signature": "class ClassSomething",
732
+ "name": "ClassSomething",
733
+ "members": [
734
+ {
735
+ "__schema": "VariableLikeSchema",
737
736
  "location": {
738
737
  "filePath": "index.ts",
739
738
  "line": 37,
740
739
  "character": 3
741
740
  },
742
- "type": "string"
743
- },
744
- "isOptional": true,
745
- "defaultValue": "''"
746
- },
747
- {
748
- "__schema": "ConstructorSchema",
749
- "location": {
750
- "filePath": "index.ts",
751
- "line": 38,
752
- "character": 3
753
- },
754
- "signature": "constructor ClassSomething(da: 'dsa'): ClassSomething",
755
- "name": "constructor",
756
- "params": [
757
- {
758
- "__schema": "ParameterSchema",
741
+ "signature": "(property) ClassSomething.app: string",
742
+ "name": "app",
743
+ "type": {
744
+ "__schema": "InferenceTypeSchema",
759
745
  "location": {
760
746
  "filePath": "index.ts",
761
- "line": 38,
762
- "character": 15
747
+ "line": 37,
748
+ "character": 3
763
749
  },
764
- "name": "da",
765
- "type": {
766
- "__schema": "LiteralTypeSchema",
750
+ "type": "string"
751
+ },
752
+ "isOptional": true,
753
+ "defaultValue": "''"
754
+ },
755
+ {
756
+ "__schema": "ConstructorSchema",
757
+ "location": {
758
+ "filePath": "index.ts",
759
+ "line": 38,
760
+ "character": 3
761
+ },
762
+ "signature": "constructor ClassSomething(da: 'dsa'): ClassSomething",
763
+ "name": "constructor",
764
+ "params": [
765
+ {
766
+ "__schema": "ParameterSchema",
767
767
  "location": {
768
768
  "filePath": "index.ts",
769
769
  "line": 38,
770
- "character": 28
770
+ "character": 15
771
771
  },
772
- "name": "'dsa'"
772
+ "name": "da",
773
+ "type": {
774
+ "__schema": "LiteralTypeSchema",
775
+ "location": {
776
+ "filePath": "index.ts",
777
+ "line": 38,
778
+ "character": 28
779
+ },
780
+ "name": "'dsa'"
781
+ },
782
+ "isOptional": false,
783
+ "isSpread": false
784
+ }
785
+ ],
786
+ "returnType": {
787
+ "__schema": "ThisTypeSchema",
788
+ "location": {
789
+ "filePath": "index.ts",
790
+ "line": 36,
791
+ "character": 1
773
792
  },
774
- "isOptional": false,
775
- "isSpread": false
776
- }
777
- ],
778
- "returnType": {
779
- "__schema": "ThisTypeSchema",
780
- "location": {
781
- "filePath": "index.ts",
782
- "line": 36,
783
- "character": 1
793
+ "name": "ClassSomething"
784
794
  },
785
- "name": "ClassSomething"
786
- },
787
- "modifiers": []
788
- },
789
- {
790
- "__schema": "FunctionLikeSchema",
791
- "location": {
792
- "filePath": "index.ts",
793
- "line": 40,
794
- "character": 3
795
+ "modifiers": []
795
796
  },
796
- "signature": "(method) ClassSomething.a(): Foo",
797
- "name": "a",
798
- "params": [],
799
- "returnType": {
800
- "__schema": "TypeRefSchema",
797
+ {
798
+ "__schema": "FunctionLikeSchema",
801
799
  "location": {
802
800
  "filePath": "index.ts",
803
801
  "line": 40,
804
802
  "character": 3
805
803
  },
806
- "name": "Foo",
807
- "internalFilePath": "index.ts"
808
- },
809
- "modifiers": []
810
- },
811
- {
812
- "__schema": "GetAccessorSchema",
813
- "location": {
814
- "filePath": "index.ts",
815
- "line": 43,
816
- "character": 3
804
+ "signature": "(method) ClassSomething.a(): Foo",
805
+ "name": "a",
806
+ "params": [],
807
+ "returnType": {
808
+ "__schema": "TypeRefSchema",
809
+ "location": {
810
+ "filePath": "index.ts",
811
+ "line": 40,
812
+ "character": 3
813
+ },
814
+ "name": "Foo",
815
+ "internalFilePath": "index.ts"
816
+ },
817
+ "modifiers": []
817
818
  },
818
- "signature": "(getter) ClassSomething.getter: string",
819
- "name": "getter",
820
- "type": {
821
- "__schema": "InferenceTypeSchema",
819
+ {
820
+ "__schema": "GetAccessorSchema",
822
821
  "location": {
823
822
  "filePath": "index.ts",
824
823
  "line": 43,
825
824
  "character": 3
826
825
  },
827
- "type": "string"
828
- }
829
- },
830
- {
831
- "__schema": "SetAccessorSchema",
832
- "location": {
833
- "filePath": "index.ts",
834
- "line": 47,
835
- "character": 3
826
+ "signature": "(getter) ClassSomething.getter: string",
827
+ "name": "getter",
828
+ "type": {
829
+ "__schema": "InferenceTypeSchema",
830
+ "location": {
831
+ "filePath": "index.ts",
832
+ "line": 43,
833
+ "character": 3
834
+ },
835
+ "type": "string"
836
+ }
836
837
  },
837
- "signature": "(setter) ClassSomething.setter: boolean",
838
- "name": "setter",
839
- "param": {
840
- "__schema": "ParameterSchema",
838
+ {
839
+ "__schema": "SetAccessorSchema",
841
840
  "location": {
842
841
  "filePath": "index.ts",
843
842
  "line": 47,
844
- "character": 14
843
+ "character": 3
845
844
  },
846
- "name": "a",
847
- "type": {
848
- "__schema": "KeywordTypeSchema",
845
+ "signature": "(setter) ClassSomething.setter: boolean",
846
+ "name": "setter",
847
+ "param": {
848
+ "__schema": "ParameterSchema",
849
849
  "location": {
850
850
  "filePath": "index.ts",
851
851
  "line": 47,
852
- "character": 17
852
+ "character": 14
853
853
  },
854
- "name": "boolean"
855
- },
856
- "isOptional": false,
857
- "isSpread": false
854
+ "name": "a",
855
+ "type": {
856
+ "__schema": "KeywordTypeSchema",
857
+ "location": {
858
+ "filePath": "index.ts",
859
+ "line": 47,
860
+ "character": 17
861
+ },
862
+ "name": "boolean"
863
+ },
864
+ "isOptional": false,
865
+ "isSpread": false
866
+ }
858
867
  }
859
- }
860
- ],
861
- "extendsNodes": [],
862
- "implementNodes": []
868
+ ],
869
+ "extendsNodes": [],
870
+ "implementNodes": []
871
+ }
863
872
  },
864
873
  {
865
874
  "__schema": "TypeSchema",