@teambit/schema 0.0.894 → 0.0.896
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.ts +3 -1
- package/dist/index.js +17 -14
- package/dist/index.js.map +1 -1
- package/dist/mock/button/button.composition.js +1 -0
- package/dist/mock/button/button.composition.js.map +1 -1
- package/dist/mock/button/index.d.ts +2 -0
- package/dist/mock/button/index.js +11 -1
- package/dist/mock/button/index.js.map +1 -1
- package/dist/mock/button-old-schema.json +1 -1
- package/dist/mock/button-schemas.json +164 -30
- package/dist/schema-extractor.d.ts +2 -1
- package/dist/schema-extractor.js.map +1 -1
- package/dist/schema.graphql.d.ts +1 -3
- package/dist/schema.graphql.js +1 -1
- package/dist/schema.graphql.js.map +1 -1
- package/dist/schema.main.runtime.js +6 -1
- package/dist/schema.main.runtime.js.map +1 -1
- package/mock/button/button.composition.tsx +1 -0
- package/mock/button/index.ts +6 -0
- package/mock/button-old-schema.json +1 -1
- package/mock/button-schemas.json +164 -30
- package/package-tar/teambit-schema-0.0.896.tgz +0 -0
- package/package.json +10 -8
- package/{preview-1667878820252.js → preview-1668051814135.js} +3 -3
- package/package-tar/teambit-schema-0.0.894.tgz +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { SchemaAspect } from './schema.aspect';
|
|
1
2
|
export { Parser } from './parser';
|
|
2
3
|
export { SchemaExtractor } from './schema-extractor';
|
|
3
4
|
export { SchemaTask, SCHEMA_ARTIFACT_NAME, SCHEMA_TASK_NAME, getSchemaArtifactDef, getSchemaArtifactPath, } from './schema.task';
|
|
4
5
|
export type { SchemaMain } from './schema.main.runtime';
|
|
5
|
-
export
|
|
6
|
+
export default SchemaAspect;
|
|
7
|
+
export { SchemaAspect };
|
package/dist/index.js
CHANGED
|
@@ -12,19 +12,19 @@ Object.defineProperty(exports, "Parser", {
|
|
|
12
12
|
Object.defineProperty(exports, "SCHEMA_ARTIFACT_NAME", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _schema2().SCHEMA_ARTIFACT_NAME;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "SCHEMA_TASK_NAME", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function () {
|
|
21
|
-
return
|
|
21
|
+
return _schema2().SCHEMA_TASK_NAME;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "SchemaAspect", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function () {
|
|
27
|
-
return
|
|
27
|
+
return _schema().SchemaAspect;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "SchemaExtractor", {
|
|
@@ -36,21 +36,29 @@ Object.defineProperty(exports, "SchemaExtractor", {
|
|
|
36
36
|
Object.defineProperty(exports, "SchemaTask", {
|
|
37
37
|
enumerable: true,
|
|
38
38
|
get: function () {
|
|
39
|
-
return
|
|
39
|
+
return _schema2().SchemaTask;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
+
exports.default = void 0;
|
|
42
43
|
Object.defineProperty(exports, "getSchemaArtifactDef", {
|
|
43
44
|
enumerable: true,
|
|
44
45
|
get: function () {
|
|
45
|
-
return
|
|
46
|
+
return _schema2().getSchemaArtifactDef;
|
|
46
47
|
}
|
|
47
48
|
});
|
|
48
49
|
Object.defineProperty(exports, "getSchemaArtifactPath", {
|
|
49
50
|
enumerable: true,
|
|
50
51
|
get: function () {
|
|
51
|
-
return
|
|
52
|
+
return _schema2().getSchemaArtifactPath;
|
|
52
53
|
}
|
|
53
54
|
});
|
|
55
|
+
function _schema() {
|
|
56
|
+
const data = require("./schema.aspect");
|
|
57
|
+
_schema = function () {
|
|
58
|
+
return data;
|
|
59
|
+
};
|
|
60
|
+
return data;
|
|
61
|
+
}
|
|
54
62
|
function _parser() {
|
|
55
63
|
const data = require("./parser");
|
|
56
64
|
_parser = function () {
|
|
@@ -65,19 +73,14 @@ function _schemaExtractor() {
|
|
|
65
73
|
};
|
|
66
74
|
return data;
|
|
67
75
|
}
|
|
68
|
-
function _schema() {
|
|
69
|
-
const data = require("./schema.task");
|
|
70
|
-
_schema = function () {
|
|
71
|
-
return data;
|
|
72
|
-
};
|
|
73
|
-
return data;
|
|
74
|
-
}
|
|
75
76
|
function _schema2() {
|
|
76
|
-
const data = require("./schema.
|
|
77
|
+
const data = require("./schema.task");
|
|
77
78
|
_schema2 = function () {
|
|
78
79
|
return data;
|
|
79
80
|
};
|
|
80
81
|
return data;
|
|
81
82
|
}
|
|
83
|
+
var _default = _schema().SchemaAspect;
|
|
84
|
+
exports.default = _default;
|
|
82
85
|
|
|
83
86
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["SchemaAspect"],"sources":["index.ts"],"sourcesContent":["import { SchemaAspect } from './schema.aspect';\n\nexport { Parser } from './parser';\nexport { SchemaExtractor } from './schema-extractor';\nexport {\n SchemaTask,\n SCHEMA_ARTIFACT_NAME,\n SCHEMA_TASK_NAME,\n getSchemaArtifactDef,\n getSchemaArtifactPath,\n} from './schema.task';\nexport type { SchemaMain } from './schema.main.runtime';\nexport default SchemaAspect;\nexport { SchemaAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMuB,eAERA,sBAAY;AAAA"}
|
|
@@ -30,6 +30,7 @@ const BasicButton = () => {
|
|
|
30
30
|
/**
|
|
31
31
|
* example of passing a JSX Element as a parameter
|
|
32
32
|
*/
|
|
33
|
+
// eslint-disable-next-line react/prop-types
|
|
33
34
|
exports.BasicButton = BasicButton;
|
|
34
35
|
function Footer({
|
|
35
36
|
children = /*#__PURE__*/_react().default.createElement(BasicButton, null)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BasicButton","Footer","children","ButtonWithCustomStyles","background","ButtonWithIcon","ButtonAsALink"],"sources":["button.composition.tsx"],"sourcesContent":["/* eslint-disable no-alert */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport React from 'react';\nimport { Button } from './button';\n\nexport const BasicButton = () => {\n return <Button>click me</Button>;\n};\n\n/**\n * example of passing a JSX Element as a parameter\n */\nexport function Footer({ children = <BasicButton /> }) {\n return <Button>{children}</Button>;\n}\n\nexport const ButtonWithCustomStyles = () => {\n return <Button style={{ background: 'red' }}>click me</Button>;\n};\n\nexport const ButtonWithIcon = () => {\n return (\n <Button>\n {/* <Image src=\"https://static.bit.dev/bit-logo.svg\" /> */}\n click me\n </Button>\n );\n};\n\nexport const ButtonAsALink = () => {\n return <Button href=\"https://bit.dev\">Bit</Button>;\n};\n"],"mappings":";;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAHA;AACA;;AAIO,MAAMA,WAAW,GAAG,MAAM;EAC/B,oBAAO,+BAAC,gBAAM,mBAAkB;AAClC,CAAC;;AAED;AACA;AACA;
|
|
1
|
+
{"version":3,"names":["BasicButton","Footer","children","ButtonWithCustomStyles","background","ButtonWithIcon","ButtonAsALink"],"sources":["button.composition.tsx"],"sourcesContent":["/* eslint-disable no-alert */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport React from 'react';\nimport { Button } from './button';\n\nexport const BasicButton = () => {\n return <Button>click me</Button>;\n};\n\n/**\n * example of passing a JSX Element as a parameter\n */\n// eslint-disable-next-line react/prop-types\nexport function Footer({ children = <BasicButton /> }) {\n return <Button>{children}</Button>;\n}\n\nexport const ButtonWithCustomStyles = () => {\n return <Button style={{ background: 'red' }}>click me</Button>;\n};\n\nexport const ButtonWithIcon = () => {\n return (\n <Button>\n {/* <Image src=\"https://static.bit.dev/bit-logo.svg\" /> */}\n click me\n </Button>\n );\n};\n\nexport const ButtonAsALink = () => {\n return <Button href=\"https://bit.dev\">Bit</Button>;\n};\n"],"mappings":";;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAHA;AACA;;AAIO,MAAMA,WAAW,GAAG,MAAM;EAC/B,oBAAO,+BAAC,gBAAM,mBAAkB;AAClC,CAAC;;AAED;AACA;AACA;AACA;AAAA;AACO,SAASC,MAAM,CAAC;EAAEC,QAAQ,gBAAG,+BAAC,WAAW;AAAI,CAAC,EAAE;EACrD,oBAAO,+BAAC,gBAAM,QAAEA,QAAQ,CAAU;AACpC;AAEO,MAAMC,sBAAsB,GAAG,MAAM;EAC1C,oBAAO,+BAAC,gBAAM;IAAC,KAAK,EAAE;MAAEC,UAAU,EAAE;IAAM;EAAE,cAAkB;AAChE,CAAC;AAAC;AAEK,MAAMC,cAAc,GAAG,MAAM;EAClC,oBACE,+BAAC,gBAAM,mBAGE;AAEb,CAAC;AAAC;AAEK,MAAMC,aAAa,GAAG,MAAM;EACjC,oBAAO,+BAAC,gBAAM;IAAC,IAAI,EAAC;EAAiB,SAAa;AACpD,CAAC;AAAC"}
|
|
@@ -86,3 +86,5 @@ export interface CallSignatureWithTypeParams {
|
|
|
86
86
|
* Conditional Generic Type
|
|
87
87
|
*/
|
|
88
88
|
export declare type If<T, U, Y, N> = T extends U ? Y : N;
|
|
89
|
+
export declare function genericFunction<T>(a: T): <T_1>(a: T_1) => void;
|
|
90
|
+
export declare const gfnc2: <T>(a: T) => void;
|
|
@@ -24,14 +24,19 @@ var _exportNames = {
|
|
|
24
24
|
typePredicateNoTypeFn: true,
|
|
25
25
|
objectBindingElements: true,
|
|
26
26
|
arrayBindingElements: true,
|
|
27
|
+
genericFunction: true,
|
|
28
|
+
gfnc2: true,
|
|
27
29
|
Compositions: true
|
|
28
30
|
};
|
|
29
31
|
exports.Function = exports.Food = exports.Compositions = exports.ClassSomething = exports.Array = void 0;
|
|
30
32
|
exports.Hi = Hi;
|
|
31
33
|
exports.a1 = exports.a = exports.HiThere = void 0;
|
|
32
34
|
exports.arrayBindingElements = arrayBindingElements;
|
|
33
|
-
exports.
|
|
35
|
+
exports.b = void 0;
|
|
36
|
+
exports.genericFunction = genericFunction;
|
|
37
|
+
exports.getBar = void 0;
|
|
34
38
|
exports.getPromise = getPromise;
|
|
39
|
+
exports.gfnc2 = void 0;
|
|
35
40
|
exports.myFunc = myFunc;
|
|
36
41
|
exports.objectBindingElements = objectBindingElements;
|
|
37
42
|
exports.tuple = void 0;
|
|
@@ -157,5 +162,10 @@ async function arrayBindingElements([prop]) {
|
|
|
157
162
|
return prop;
|
|
158
163
|
}
|
|
159
164
|
const computedName = 'str';
|
|
165
|
+
function genericFunction(a) {
|
|
166
|
+
return function (a) {};
|
|
167
|
+
}
|
|
168
|
+
const gfnc2 = genericFunction('');
|
|
169
|
+
exports.gfnc2 = gfnc2;
|
|
160
170
|
|
|
161
171
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["myFunc","a","b","Hi","HiThere","Function","Array","Foo","ClassSomething","constructor","da","getter","setter","obj","a1","Bar","foo","getBar","bar","tuple","c","Food","getPromise","T1","T2","T3","typePredicateFn","str","typePredicateNoTypeFn","condition","msg","objectBindingElements","prop","arrayBindingElements","computedName"],"sources":["index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n/* eslint-disable @typescript-eslint/no-shadow */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/prefer-as-const */\n/* eslint-disable one-var */\n/* eslint-disable max-classes-per-file */\n\n/**\n * General comment of the myFunc\n * @deprecate example of deprecation tag\n * @param a { number } this is A\n * @param b this is B\n * @returns { number } results of adding a to b\n */\nexport function myFunc(a = 4, b = 5): number {\n return a + b;\n}\n\nexport * from './button';\n\nexport function Hi() {}\n\nexport const a = 4,\n b: 5 = 5;\n\nexport * as Compositions from './button.composition';\n\nexport const HiThere = 'HiThere';\n\nexport const Function = () => {};\n\nexport const Array = ['hi', 'there'];\n\nclass Foo {}\n\nclass ClassSomething {\n app = '';\n constructor(readonly da: 'dsa') {}\n\n a() {\n return new Foo();\n }\n get getter() {\n return 'hi';\n }\n\n set setter(a: boolean) {}\n}\n\nexport { ClassSomething };\n\nexport type IndexSig = { [key: string]: boolean };\n\nexport interface Hello {\n propertySig: () => void;\n methodSig(): string;\n}\n\nconst obj = { a: 1, b: 2 };\n\nexport const a1: typeof obj = { a: 5, b: 9 };\n\nexport type TypeOperator = keyof typeof obj;\n\n// this is for Jump in the definition\nclass Bar {\n foo() {}\n}\nexport const getBar = (bar: Bar) => new Bar();\n\nexport const tuple = ([a, b, c]: [string, Function, Record<string, any>]) => {};\n\nexport enum Food {\n Falafel,\n Hummus,\n Tahini,\n}\n\nexport async function getPromise(): Promise<string> {\n return 'promise';\n}\n\nclass T1 {}\nclass T2 {}\nclass T3<T, K> {}\nexport type TypeRefWithArgs = T3<T1, T2>;\n\nexport type ParenthesizedType = (T1 | T2)[];\n\nexport function typePredicateFn(str: any): str is string {\n return str;\n}\n\nexport function typePredicateNoTypeFn(condition: any, msg?: string): asserts condition {}\n\nexport async function objectBindingElements({ prop = 1 }) {\n return prop;\n}\nexport async function arrayBindingElements([prop]: [string]) {\n return prop;\n}\n\ninterface config {\n someField: { a: string; b: boolean };\n}\nexport type IndexedAccessType = config['someField'];\n\nconst computedName = 'str';\nexport interface ComputedNameWithType {\n [computedName]: boolean;\n}\nexport interface ComputedNameNoType {\n [computedName];\n}\n\ntype World1 = 'world1-a' | 'world1-b';\ntype World2 = 'world2';\nexport type templateLiteralType = `hello ${World1} hi ${World2}`;\n\nexport interface CallSignatureWithTypeParams {\n <T>(a: string): T;\n}\n\n/**\n * Conditional Generic Type\n */\nexport type If<T, U, Y, N> = T extends U ? Y : N;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["myFunc","a","b","Hi","HiThere","Function","Array","Foo","ClassSomething","constructor","da","getter","setter","obj","a1","Bar","foo","getBar","bar","tuple","c","Food","getPromise","T1","T2","T3","typePredicateFn","str","typePredicateNoTypeFn","condition","msg","objectBindingElements","prop","arrayBindingElements","computedName","genericFunction","gfnc2"],"sources":["index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n/* eslint-disable @typescript-eslint/no-shadow */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/prefer-as-const */\n/* eslint-disable one-var */\n/* eslint-disable max-classes-per-file */\n\n/**\n * General comment of the myFunc\n * @deprecate example of deprecation tag\n * @param a { number } this is A\n * @param b this is B\n * @returns { number } results of adding a to b\n */\nexport function myFunc(a = 4, b = 5): number {\n return a + b;\n}\n\nexport * from './button';\n\nexport function Hi() {}\n\nexport const a = 4,\n b: 5 = 5;\n\nexport * as Compositions from './button.composition';\n\nexport const HiThere = 'HiThere';\n\nexport const Function = () => {};\n\nexport const Array = ['hi', 'there'];\n\nclass Foo {}\n\nclass ClassSomething {\n app = '';\n constructor(readonly da: 'dsa') {}\n\n a() {\n return new Foo();\n }\n get getter() {\n return 'hi';\n }\n\n set setter(a: boolean) {}\n}\n\nexport { ClassSomething };\n\nexport type IndexSig = { [key: string]: boolean };\n\nexport interface Hello {\n propertySig: () => void;\n methodSig(): string;\n}\n\nconst obj = { a: 1, b: 2 };\n\nexport const a1: typeof obj = { a: 5, b: 9 };\n\nexport type TypeOperator = keyof typeof obj;\n\n// this is for Jump in the definition\nclass Bar {\n foo() {}\n}\nexport const getBar = (bar: Bar) => new Bar();\n\nexport const tuple = ([a, b, c]: [string, Function, Record<string, any>]) => {};\n\nexport enum Food {\n Falafel,\n Hummus,\n Tahini,\n}\n\nexport async function getPromise(): Promise<string> {\n return 'promise';\n}\n\nclass T1 {}\nclass T2 {}\nclass T3<T, K> {}\nexport type TypeRefWithArgs = T3<T1, T2>;\n\nexport type ParenthesizedType = (T1 | T2)[];\n\nexport function typePredicateFn(str: any): str is string {\n return str;\n}\n\nexport function typePredicateNoTypeFn(condition: any, msg?: string): asserts condition {}\n\nexport async function objectBindingElements({ prop = 1 }) {\n return prop;\n}\nexport async function arrayBindingElements([prop]: [string]) {\n return prop;\n}\n\ninterface config {\n someField: { a: string; b: boolean };\n}\nexport type IndexedAccessType = config['someField'];\n\nconst computedName = 'str';\nexport interface ComputedNameWithType {\n [computedName]: boolean;\n}\nexport interface ComputedNameNoType {\n [computedName];\n}\n\ntype World1 = 'world1-a' | 'world1-b';\ntype World2 = 'world2';\nexport type templateLiteralType = `hello ${World1} hi ${World2}`;\n\nexport interface CallSignatureWithTypeParams {\n <T>(a: string): T;\n}\n\n/**\n * Conditional Generic Type\n */\nexport type If<T, U, Y, N> = T extends U ? Y : N;\n\nexport function genericFunction<T>(a: T) {\n return function <T>(a: T) {};\n}\n\nexport const gfnc2 = genericFunction<string>('');\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAAyB;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAA;EAAA;EAAA;IAAA;EAAA;AAAA;AAAA;AAAA;AAlBzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,MAAM,CAACC,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAG,CAAC,EAAU;EAC3C,OAAOD,CAAC,GAAGC,CAAC;AACd;AAIO,SAASC,EAAE,GAAG,CAAC;AAEf,MAAMF,CAAC,GAAG,CAAC;EAChBC,CAAI,GAAG,CAA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CAACC,SAAc,EAAEC,GAAY,EAAqB,CAAC;AAEjF,eAAeC,qBAAqB,CAAC;EAAEC,IAAI,GAAG;AAAE,CAAC,EAAE;EACxD,OAAOA,IAAI;AACb;AACO,eAAeC,oBAAoB,CAAC,CAACD,IAAI,CAAW,EAAE;EAC3D,OAAOA,IAAI;AACb;AAOA,MAAME,YAAY,GAAG,KAAK;AAqBnB,SAASC,eAAe,CAAIlC,CAAI,EAAE;EACvC,OAAO,UAAaA,CAAI,EAAE,CAAC,CAAC;AAC9B;AAEO,MAAMmC,KAAK,GAAGD,eAAe,CAAS,EAAE,CAAC;AAAC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"character": 1
|
|
7
7
|
},
|
|
8
8
|
"module": {
|
|
9
|
-
"__schema": "
|
|
9
|
+
"__schema": "ModuleSchema",
|
|
10
10
|
"location": {
|
|
11
11
|
"filePath": "index.ts",
|
|
12
12
|
"line": 15,
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
},
|
|
106
106
|
"tagName": "parameter",
|
|
107
107
|
"comment": "this is A",
|
|
108
|
-
"
|
|
108
|
+
"name": "a",
|
|
109
109
|
"type": {
|
|
110
110
|
"__schema": "KeywordTypeSchema",
|
|
111
111
|
"location": {
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
},
|
|
126
126
|
"tagName": "parameter",
|
|
127
127
|
"comment": "this is B",
|
|
128
|
-
"
|
|
128
|
+
"name": "b"
|
|
129
129
|
},
|
|
130
130
|
{
|
|
131
131
|
"__schema": "ReturnTagSchema",
|
|
@@ -361,12 +361,15 @@
|
|
|
361
361
|
},
|
|
362
362
|
{
|
|
363
363
|
"__schema": "ClassSchema",
|
|
364
|
-
"
|
|
364
|
+
"name": "Bar",
|
|
365
365
|
"location": {
|
|
366
366
|
"filePath": "button.tsx",
|
|
367
367
|
"line": 61,
|
|
368
368
|
"character": 1
|
|
369
369
|
},
|
|
370
|
+
"signature": "class Bar",
|
|
371
|
+
"extendsNodes": [],
|
|
372
|
+
"implementNodes": [],
|
|
370
373
|
"members": [
|
|
371
374
|
{
|
|
372
375
|
"__schema": "FunctionLikeSchema",
|
|
@@ -455,7 +458,7 @@
|
|
|
455
458
|
}
|
|
456
459
|
},
|
|
457
460
|
{
|
|
458
|
-
"__schema": "
|
|
461
|
+
"__schema": "ModuleSchema",
|
|
459
462
|
"location": {
|
|
460
463
|
"filePath": "button.composition.tsx",
|
|
461
464
|
"line": 3,
|
|
@@ -487,7 +490,7 @@
|
|
|
487
490
|
"__schema": "FunctionLikeSchema",
|
|
488
491
|
"location": {
|
|
489
492
|
"filePath": "button.composition.tsx",
|
|
490
|
-
"line":
|
|
493
|
+
"line": 14,
|
|
491
494
|
"character": 1
|
|
492
495
|
},
|
|
493
496
|
"name": "Footer",
|
|
@@ -500,7 +503,7 @@
|
|
|
500
503
|
"__schema": "ParameterSchema",
|
|
501
504
|
"location": {
|
|
502
505
|
"filePath": "button.composition.tsx",
|
|
503
|
-
"line":
|
|
506
|
+
"line": 14,
|
|
504
507
|
"character": 24
|
|
505
508
|
},
|
|
506
509
|
"name": "{ children = <BasicButton /> }",
|
|
@@ -509,7 +512,7 @@
|
|
|
509
512
|
"__schema": "TypeLiteralSchema",
|
|
510
513
|
"location": {
|
|
511
514
|
"filePath": "button.composition.tsx",
|
|
512
|
-
"line":
|
|
515
|
+
"line": 14,
|
|
513
516
|
"character": 24
|
|
514
517
|
},
|
|
515
518
|
"members": [
|
|
@@ -517,21 +520,33 @@
|
|
|
517
520
|
"__schema": "InferenceTypeSchema",
|
|
518
521
|
"location": {
|
|
519
522
|
"filePath": "button.composition.tsx",
|
|
520
|
-
"line":
|
|
523
|
+
"line": 14,
|
|
521
524
|
"character": 24
|
|
522
525
|
},
|
|
523
526
|
"type": "any",
|
|
524
527
|
"name": "children"
|
|
525
528
|
}
|
|
526
529
|
]
|
|
527
|
-
}
|
|
530
|
+
},
|
|
531
|
+
"objectBindingNodes": [
|
|
532
|
+
{
|
|
533
|
+
"__schema": "InferenceTypeSchema",
|
|
534
|
+
"location": {
|
|
535
|
+
"filePath": "button.composition.tsx",
|
|
536
|
+
"line": 14,
|
|
537
|
+
"character": 24
|
|
538
|
+
},
|
|
539
|
+
"type": "any",
|
|
540
|
+
"name": "children"
|
|
541
|
+
}
|
|
542
|
+
]
|
|
528
543
|
}
|
|
529
544
|
],
|
|
530
545
|
"returnType": {
|
|
531
546
|
"__schema": "InferenceTypeSchema",
|
|
532
547
|
"location": {
|
|
533
548
|
"filePath": "button.composition.tsx",
|
|
534
|
-
"line":
|
|
549
|
+
"line": 14,
|
|
535
550
|
"character": 1
|
|
536
551
|
},
|
|
537
552
|
"type": "any"
|
|
@@ -551,7 +566,7 @@
|
|
|
551
566
|
"__schema": "FunctionLikeSchema",
|
|
552
567
|
"location": {
|
|
553
568
|
"filePath": "button.composition.tsx",
|
|
554
|
-
"line":
|
|
569
|
+
"line": 18,
|
|
555
570
|
"character": 14
|
|
556
571
|
},
|
|
557
572
|
"name": "ButtonWithCustomStyles",
|
|
@@ -562,7 +577,7 @@
|
|
|
562
577
|
"__schema": "InferenceTypeSchema",
|
|
563
578
|
"location": {
|
|
564
579
|
"filePath": "button.composition.tsx",
|
|
565
|
-
"line":
|
|
580
|
+
"line": 18,
|
|
566
581
|
"character": 14
|
|
567
582
|
},
|
|
568
583
|
"type": "any"
|
|
@@ -572,7 +587,7 @@
|
|
|
572
587
|
"__schema": "FunctionLikeSchema",
|
|
573
588
|
"location": {
|
|
574
589
|
"filePath": "button.composition.tsx",
|
|
575
|
-
"line":
|
|
590
|
+
"line": 22,
|
|
576
591
|
"character": 14
|
|
577
592
|
},
|
|
578
593
|
"name": "ButtonWithIcon",
|
|
@@ -583,7 +598,7 @@
|
|
|
583
598
|
"__schema": "InferenceTypeSchema",
|
|
584
599
|
"location": {
|
|
585
600
|
"filePath": "button.composition.tsx",
|
|
586
|
-
"line":
|
|
601
|
+
"line": 22,
|
|
587
602
|
"character": 14
|
|
588
603
|
},
|
|
589
604
|
"type": "any"
|
|
@@ -593,7 +608,7 @@
|
|
|
593
608
|
"__schema": "FunctionLikeSchema",
|
|
594
609
|
"location": {
|
|
595
610
|
"filePath": "button.composition.tsx",
|
|
596
|
-
"line":
|
|
611
|
+
"line": 31,
|
|
597
612
|
"character": 14
|
|
598
613
|
},
|
|
599
614
|
"name": "ButtonAsALink",
|
|
@@ -604,7 +619,7 @@
|
|
|
604
619
|
"__schema": "InferenceTypeSchema",
|
|
605
620
|
"location": {
|
|
606
621
|
"filePath": "button.composition.tsx",
|
|
607
|
-
"line":
|
|
622
|
+
"line": 31,
|
|
608
623
|
"character": 14
|
|
609
624
|
},
|
|
610
625
|
"type": "any"
|
|
@@ -677,12 +692,15 @@
|
|
|
677
692
|
},
|
|
678
693
|
{
|
|
679
694
|
"__schema": "ClassSchema",
|
|
680
|
-
"
|
|
695
|
+
"name": "ClassSomething",
|
|
681
696
|
"location": {
|
|
682
697
|
"filePath": "index.ts",
|
|
683
698
|
"line": 36,
|
|
684
699
|
"character": 1
|
|
685
700
|
},
|
|
701
|
+
"signature": "class ClassSomething",
|
|
702
|
+
"extendsNodes": [],
|
|
703
|
+
"implementNodes": [],
|
|
686
704
|
"members": [
|
|
687
705
|
{
|
|
688
706
|
"__schema": "VariableLikeSchema",
|
|
@@ -711,6 +729,7 @@
|
|
|
711
729
|
"line": 38,
|
|
712
730
|
"character": 3
|
|
713
731
|
},
|
|
732
|
+
"signature": "constructor ClassSomething(da: 'dsa'): ClassSomething",
|
|
714
733
|
"params": [
|
|
715
734
|
{
|
|
716
735
|
"__schema": "ParameterSchema",
|
|
@@ -870,6 +889,8 @@
|
|
|
870
889
|
"character": 1
|
|
871
890
|
},
|
|
872
891
|
"name": "Hello",
|
|
892
|
+
"signature": "interface Hello",
|
|
893
|
+
"extendsNodes": [],
|
|
873
894
|
"members": [
|
|
874
895
|
{
|
|
875
896
|
"__schema": "VariableLikeSchema",
|
|
@@ -972,7 +993,7 @@
|
|
|
972
993
|
"line": 63,
|
|
973
994
|
"character": 28
|
|
974
995
|
},
|
|
975
|
-
"
|
|
996
|
+
"name": "keyof",
|
|
976
997
|
"type": {
|
|
977
998
|
"__schema": "TypeQuerySchema",
|
|
978
999
|
"location": {
|
|
@@ -1133,10 +1154,38 @@
|
|
|
1133
1154
|
"character": 1
|
|
1134
1155
|
},
|
|
1135
1156
|
"name": "Food",
|
|
1157
|
+
"signature": "enum Food",
|
|
1136
1158
|
"members": [
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1159
|
+
{
|
|
1160
|
+
"__schema": "EnumMemberSchema",
|
|
1161
|
+
"location": {
|
|
1162
|
+
"filePath": "index.ts",
|
|
1163
|
+
"line": 74,
|
|
1164
|
+
"character": 3
|
|
1165
|
+
},
|
|
1166
|
+
"name": "Falafel",
|
|
1167
|
+
"signature": "(enum member) Food.Falafel = 0"
|
|
1168
|
+
},
|
|
1169
|
+
{
|
|
1170
|
+
"__schema": "EnumMemberSchema",
|
|
1171
|
+
"location": {
|
|
1172
|
+
"filePath": "index.ts",
|
|
1173
|
+
"line": 75,
|
|
1174
|
+
"character": 3
|
|
1175
|
+
},
|
|
1176
|
+
"name": "Hummus",
|
|
1177
|
+
"signature": "(enum member) Food.Hummus = 1"
|
|
1178
|
+
},
|
|
1179
|
+
{
|
|
1180
|
+
"__schema": "EnumMemberSchema",
|
|
1181
|
+
"location": {
|
|
1182
|
+
"filePath": "index.ts",
|
|
1183
|
+
"line": 76,
|
|
1184
|
+
"character": 3
|
|
1185
|
+
},
|
|
1186
|
+
"name": "Tahini",
|
|
1187
|
+
"signature": "(enum member) Food.Tahini = 2"
|
|
1188
|
+
}
|
|
1140
1189
|
]
|
|
1141
1190
|
},
|
|
1142
1191
|
{
|
|
@@ -1291,7 +1340,7 @@
|
|
|
1291
1340
|
"line": 90,
|
|
1292
1341
|
"character": 44
|
|
1293
1342
|
},
|
|
1294
|
-
"
|
|
1343
|
+
"name": "str",
|
|
1295
1344
|
"hasAssertsModifier": false,
|
|
1296
1345
|
"type": {
|
|
1297
1346
|
"__schema": "KeywordTypeSchema",
|
|
@@ -1363,7 +1412,7 @@
|
|
|
1363
1412
|
"line": 94,
|
|
1364
1413
|
"character": 70
|
|
1365
1414
|
},
|
|
1366
|
-
"
|
|
1415
|
+
"name": "condition",
|
|
1367
1416
|
"hasAssertsModifier": true
|
|
1368
1417
|
}
|
|
1369
1418
|
},
|
|
@@ -1409,7 +1458,19 @@
|
|
|
1409
1458
|
"name": "prop"
|
|
1410
1459
|
}
|
|
1411
1460
|
]
|
|
1412
|
-
}
|
|
1461
|
+
},
|
|
1462
|
+
"objectBindingNodes": [
|
|
1463
|
+
{
|
|
1464
|
+
"__schema": "InferenceTypeSchema",
|
|
1465
|
+
"location": {
|
|
1466
|
+
"filePath": "index.ts",
|
|
1467
|
+
"line": 96,
|
|
1468
|
+
"character": 45
|
|
1469
|
+
},
|
|
1470
|
+
"type": "number",
|
|
1471
|
+
"name": "prop"
|
|
1472
|
+
}
|
|
1473
|
+
]
|
|
1413
1474
|
}
|
|
1414
1475
|
],
|
|
1415
1476
|
"returnType": {
|
|
@@ -1521,6 +1582,8 @@
|
|
|
1521
1582
|
"character": 1
|
|
1522
1583
|
},
|
|
1523
1584
|
"name": "ComputedNameWithType",
|
|
1585
|
+
"signature": "interface ComputedNameWithType",
|
|
1586
|
+
"extendsNodes": [],
|
|
1524
1587
|
"members": [
|
|
1525
1588
|
{
|
|
1526
1589
|
"__schema": "VariableLikeSchema",
|
|
@@ -1552,6 +1615,8 @@
|
|
|
1552
1615
|
"character": 1
|
|
1553
1616
|
},
|
|
1554
1617
|
"name": "ComputedNameNoType",
|
|
1618
|
+
"signature": "interface ComputedNameNoType",
|
|
1619
|
+
"extendsNodes": [],
|
|
1555
1620
|
"members": [
|
|
1556
1621
|
{
|
|
1557
1622
|
"__schema": "VariableLikeSchema",
|
|
@@ -1642,6 +1707,8 @@
|
|
|
1642
1707
|
"character": 1
|
|
1643
1708
|
},
|
|
1644
1709
|
"name": "CallSignatureWithTypeParams",
|
|
1710
|
+
"signature": "interface CallSignatureWithTypeParams",
|
|
1711
|
+
"extendsNodes": [],
|
|
1645
1712
|
"members": [
|
|
1646
1713
|
{
|
|
1647
1714
|
"__schema": "FunctionLikeSchema",
|
|
@@ -1713,7 +1780,7 @@
|
|
|
1713
1780
|
"line": 127,
|
|
1714
1781
|
"character": 30
|
|
1715
1782
|
},
|
|
1716
|
-
"type": "
|
|
1783
|
+
"type": "T",
|
|
1717
1784
|
"name": "T"
|
|
1718
1785
|
},
|
|
1719
1786
|
"extendsType": {
|
|
@@ -1723,7 +1790,7 @@
|
|
|
1723
1790
|
"line": 127,
|
|
1724
1791
|
"character": 40
|
|
1725
1792
|
},
|
|
1726
|
-
"type": "
|
|
1793
|
+
"type": "U",
|
|
1727
1794
|
"name": "U"
|
|
1728
1795
|
},
|
|
1729
1796
|
"trueType": {
|
|
@@ -1733,7 +1800,7 @@
|
|
|
1733
1800
|
"line": 127,
|
|
1734
1801
|
"character": 44
|
|
1735
1802
|
},
|
|
1736
|
-
"type": "
|
|
1803
|
+
"type": "Y",
|
|
1737
1804
|
"name": "Y"
|
|
1738
1805
|
},
|
|
1739
1806
|
"falseType": {
|
|
@@ -1743,7 +1810,7 @@
|
|
|
1743
1810
|
"line": 127,
|
|
1744
1811
|
"character": 48
|
|
1745
1812
|
},
|
|
1746
|
-
"type": "
|
|
1813
|
+
"type": "N",
|
|
1747
1814
|
"name": "N"
|
|
1748
1815
|
}
|
|
1749
1816
|
},
|
|
@@ -1757,6 +1824,73 @@
|
|
|
1757
1824
|
"raw": "/**\n * Conditional Generic Type\n */",
|
|
1758
1825
|
"comment": "Conditional Generic Type"
|
|
1759
1826
|
}
|
|
1827
|
+
},
|
|
1828
|
+
{
|
|
1829
|
+
"__schema": "FunctionLikeSchema",
|
|
1830
|
+
"location": {
|
|
1831
|
+
"filePath": "index.ts",
|
|
1832
|
+
"line": 129,
|
|
1833
|
+
"character": 1
|
|
1834
|
+
},
|
|
1835
|
+
"name": "genericFunction",
|
|
1836
|
+
"signature": "function genericFunction<T>(a: T): <T>(a: T) => void",
|
|
1837
|
+
"modifiers": [
|
|
1838
|
+
"export"
|
|
1839
|
+
],
|
|
1840
|
+
"typeParams": [
|
|
1841
|
+
"T"
|
|
1842
|
+
],
|
|
1843
|
+
"params": [
|
|
1844
|
+
{
|
|
1845
|
+
"__schema": "ParameterSchema",
|
|
1846
|
+
"location": {
|
|
1847
|
+
"filePath": "index.ts",
|
|
1848
|
+
"line": 129,
|
|
1849
|
+
"character": 36
|
|
1850
|
+
},
|
|
1851
|
+
"name": "a",
|
|
1852
|
+
"isOptional": false,
|
|
1853
|
+
"type": {
|
|
1854
|
+
"__schema": "InferenceTypeSchema",
|
|
1855
|
+
"location": {
|
|
1856
|
+
"filePath": "index.ts",
|
|
1857
|
+
"line": 129,
|
|
1858
|
+
"character": 39
|
|
1859
|
+
},
|
|
1860
|
+
"type": "T",
|
|
1861
|
+
"name": "T"
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
],
|
|
1865
|
+
"returnType": {
|
|
1866
|
+
"__schema": "InferenceTypeSchema",
|
|
1867
|
+
"location": {
|
|
1868
|
+
"filePath": "index.ts",
|
|
1869
|
+
"line": 129,
|
|
1870
|
+
"character": 1
|
|
1871
|
+
},
|
|
1872
|
+
"type": "<T>(a: T) => void"
|
|
1873
|
+
}
|
|
1874
|
+
},
|
|
1875
|
+
{
|
|
1876
|
+
"__schema": "VariableLikeSchema",
|
|
1877
|
+
"location": {
|
|
1878
|
+
"filePath": "index.ts",
|
|
1879
|
+
"line": 133,
|
|
1880
|
+
"character": 14
|
|
1881
|
+
},
|
|
1882
|
+
"name": "gfnc2",
|
|
1883
|
+
"signature": "const gfnc2: <T>(a: T) => void",
|
|
1884
|
+
"isOptional": false,
|
|
1885
|
+
"type": {
|
|
1886
|
+
"__schema": "InferenceTypeSchema",
|
|
1887
|
+
"location": {
|
|
1888
|
+
"filePath": "index.ts",
|
|
1889
|
+
"line": 133,
|
|
1890
|
+
"character": 14
|
|
1891
|
+
},
|
|
1892
|
+
"type": "<T>(a: T) => void"
|
|
1893
|
+
}
|
|
1760
1894
|
}
|
|
1761
1895
|
]
|
|
1762
1896
|
},
|
|
@@ -1764,4 +1898,4 @@
|
|
|
1764
1898
|
"name": "button",
|
|
1765
1899
|
"scope": "org.scope"
|
|
1766
1900
|
}
|
|
1767
|
-
}
|
|
1901
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Component } from '@teambit/component';
|
|
2
2
|
import { APISchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
+
import { Formatter } from '@teambit/formatter';
|
|
3
4
|
export interface SchemaExtractor {
|
|
4
5
|
/**
|
|
5
6
|
* extract a semantic schema from a component.
|
|
6
7
|
*/
|
|
7
|
-
extract(component: Component): Promise<APISchema>;
|
|
8
|
+
extract(component: Component, formatter: Formatter): Promise<APISchema>;
|
|
8
9
|
/**
|
|
9
10
|
* release resources if no schemas are needed for this process.
|
|
10
11
|
* for typescript, this will kill the tsserver process.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["schema-extractor.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { APISchema } from '@teambit/semantics.entities.semantic-schema';\n\nexport interface SchemaExtractor {\n /**\n * extract a semantic schema from a component.\n */\n extract(component: Component): Promise<APISchema>;\n
|
|
1
|
+
{"version":3,"names":[],"sources":["schema-extractor.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { APISchema } from '@teambit/semantics.entities.semantic-schema';\nimport { Formatter } from '@teambit/formatter';\n\nexport interface SchemaExtractor {\n /**\n * extract a semantic schema from a component.\n */\n extract(component: Component, formatter: Formatter): Promise<APISchema>;\n /**\n * release resources if no schemas are needed for this process.\n * for typescript, this will kill the tsserver process.\n * for performance reasons, this is not automatically run after \"extract\". otherwise, running extract on multiple\n * components will be very slow.\n */\n dispose(): void;\n}\n"],"mappings":""}
|
package/dist/schema.graphql.d.ts
CHANGED
|
@@ -7,9 +7,7 @@ export declare function schemaSchema(schema: SchemaMain): {
|
|
|
7
7
|
ComponentHost: {
|
|
8
8
|
getSchema: (host: ComponentFactory, { id }: {
|
|
9
9
|
id: string;
|
|
10
|
-
}) => Promise<
|
|
11
|
-
exports: never[];
|
|
12
|
-
}>;
|
|
10
|
+
}) => Promise<Record<string, any>>;
|
|
13
11
|
};
|
|
14
12
|
};
|
|
15
13
|
};
|
package/dist/schema.graphql.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["schemaSchema","schema","typeDefs","gql","resolvers","JSONObject","GraphQLJSONObject","ComponentHost","getSchema","host","id","componentId","resolveComponentId","component","get","empty","exports","docs"],"sources":["schema.graphql.ts"],"sourcesContent":["import { ComponentFactory } from '@teambit/component';\nimport { GraphQLJSONObject } from 'graphql-type-json';\nimport gql from 'graphql-tag';\n\nimport { SchemaMain } from './schema.main.runtime';\n\nexport function schemaSchema(schema: SchemaMain) {\n return {\n typeDefs: gql`\n scalar JSONObject\n extend type ComponentHost {\n getSchema(id: String!): JSONObject\n }\n `,\n resolvers: {\n JSONObject: GraphQLJSONObject,\n ComponentHost: {\n getSchema: async (host: ComponentFactory, { id }: { id: string }) => {\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 docs = await schema.getSchema(component);\n if (!docs) return empty;\n\n return docs;\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIO,SAASA,YAAY,CAACC,MAAkB,EAAE;EAC/C,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAG,CAAC;AAClB;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,UAAU,EAAEC,oCAAiB;MAC7BC,aAAa,EAAE;QACbC,SAAS,EAAE,OAAOC,IAAsB,EAAE;UAAEC;QAAmB,CAAC,KAAK;UACnE,MAAMC,WAAW,GAAG,MAAMF,IAAI,CAACG,kBAAkB,CAACF,EAAE,CAAC;UACrD,MAAMG,SAAS,GAAG,MAAMJ,IAAI,CAACK,GAAG,CAACH,WAAW,CAAC;UAC7C,MAAMI,KAAK,GAAG;YACZC,OAAO,EAAE;UACX,CAAC;UAED,IAAI,CAACH,SAAS,EAAE,OAAOE,KAAK;UAC5B,MAAME,IAAI,GAAG,MAAMhB,MAAM,CAACO,SAAS,CAACK,SAAS,CAAC;UAC9C,IAAI,CAACI,IAAI,EAAE,OAAOF,KAAK;UAEvB,OAAOE,IAAI;
|
|
1
|
+
{"version":3,"names":["schemaSchema","schema","typeDefs","gql","resolvers","JSONObject","GraphQLJSONObject","ComponentHost","getSchema","host","id","componentId","resolveComponentId","component","get","empty","exports","docs","toObject"],"sources":["schema.graphql.ts"],"sourcesContent":["import { ComponentFactory } from '@teambit/component';\nimport { GraphQLJSONObject } from 'graphql-type-json';\nimport gql from 'graphql-tag';\n\nimport { SchemaMain } from './schema.main.runtime';\n\nexport function schemaSchema(schema: SchemaMain) {\n return {\n typeDefs: gql`\n scalar JSONObject\n extend type ComponentHost {\n getSchema(id: String!): JSONObject\n }\n `,\n resolvers: {\n JSONObject: GraphQLJSONObject,\n ComponentHost: {\n getSchema: async (host: ComponentFactory, { id }: { id: string }) => {\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 docs = await schema.getSchema(component);\n if (!docs) return empty;\n\n return docs.toObject();\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIO,SAASA,YAAY,CAACC,MAAkB,EAAE;EAC/C,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAG,CAAC;AAClB;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,UAAU,EAAEC,oCAAiB;MAC7BC,aAAa,EAAE;QACbC,SAAS,EAAE,OAAOC,IAAsB,EAAE;UAAEC;QAAmB,CAAC,KAAK;UACnE,MAAMC,WAAW,GAAG,MAAMF,IAAI,CAACG,kBAAkB,CAACF,EAAE,CAAC;UACrD,MAAMG,SAAS,GAAG,MAAMJ,IAAI,CAACK,GAAG,CAACH,WAAW,CAAC;UAC7C,MAAMI,KAAK,GAAG;YACZC,OAAO,EAAE;UACX,CAAC;UAED,IAAI,CAACH,SAAS,EAAE,OAAOE,KAAK;UAC5B,MAAME,IAAI,GAAG,MAAMhB,MAAM,CAACO,SAAS,CAACK,SAAS,CAAC;UAC9C,IAAI,CAACI,IAAI,EAAE,OAAOF,KAAK;UAEvB,OAAOE,IAAI,CAACC,QAAQ,EAAE;QACxB;MACF;IACF;EACF,CAAC;AACH"}
|
|
@@ -166,11 +166,16 @@ class SchemaMain {
|
|
|
166
166
|
// if on workspace get schema from ts server
|
|
167
167
|
if (this.workspace) {
|
|
168
168
|
const env = this.envs.getEnv(component).env;
|
|
169
|
+
// types need to be fixed
|
|
170
|
+
const formatter = env.getFormatter(null, [config => {
|
|
171
|
+
config.setKey('parser', 'typescript');
|
|
172
|
+
return config;
|
|
173
|
+
}]);
|
|
169
174
|
if (typeof env.getSchemaExtractor === 'undefined') {
|
|
170
175
|
throw new Error(`No SchemaExtractor defined for ${env.name}`);
|
|
171
176
|
}
|
|
172
177
|
const schemaExtractor = env.getSchemaExtractor();
|
|
173
|
-
const result = await schemaExtractor.extract(component);
|
|
178
|
+
const result = await schemaExtractor.extract(component, formatter);
|
|
174
179
|
if (shouldDisposeResourcesOnceDone) schemaExtractor.dispose();
|
|
175
180
|
return result;
|
|
176
181
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SchemaMain","constructor","parserSlot","envs","config","builder","workspace","logger","getDefaultParser","get","defaultParser","parseModule","path","parsers","toArray","maybeParser","find","parser","match","extension","getSchemaExtractor","component","env","getEnv","Error","name","getSchema","shouldDisposeResourcesOnceDone","debug","id","toString","schemaExtractor","result","extract","dispose","schemaArtifact","getArtifactsVinylByAspectAndTaskName","SchemaAspect","SCHEMA_TASK_NAME","length","APISchema","empty","schemaJsonStr","contents","schemaJson","JSON","parse","getSchemaFromObject","e","SyntaxError","error","message","obj","fromObject","registerParser","register","provider","cli","graphql","loggerMain","createLogger","schema","schemaTask","SchemaTask","registerBuildTasks","SchemaCommand","schemaSchema","MainRuntime","EnvsAspect","CLIAspect","ComponentAspect","GraphqlAspect","LoggerAspect","BuilderAspect","WorkspaceAspect","Slot","withType","addRuntime"],"sources":["schema.main.runtime.ts"],"sourcesContent":["import { MainRuntime, CLIMain, CLIAspect } from '@teambit/cli';\nimport ComponentAspect, { Component, ComponentMain } from '@teambit/component';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport GraphqlAspect, { GraphqlMain } from '@teambit/graphql';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { APISchema, Export } from '@teambit/semantics.entities.semantic-schema';\nimport { BuilderMain, BuilderAspect } from '@teambit/builder';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { Parser } from './parser';\nimport { SchemaAspect } from './schema.aspect';\nimport { SchemaExtractor } from './schema-extractor';\nimport { SchemaCommand } from './schema.cmd';\nimport { schemaSchema } from './schema.graphql';\nimport { SchemaTask, SCHEMA_TASK_NAME } from './schema.task';\n\nexport type ParserSlot = SlotRegistry<Parser>;\n\nexport type SchemaConfig = {\n /**\n * default parser\n */\n defaultParser: string;\n};\n\n/**\n * extension for extracting component schemas.\n */\nexport class SchemaMain {\n constructor(\n /**\n * parsers slot.\n */\n private parserSlot: ParserSlot,\n\n private envs: EnvsMain,\n\n private config: SchemaConfig,\n\n private builder: BuilderMain,\n\n private workspace: Workspace,\n\n private logger: Logger\n ) {}\n\n /**\n * get the default parser.\n */\n getDefaultParser(): Parser {\n return this.parserSlot.get(this.config.defaultParser) as Parser;\n }\n\n /**\n * parse a module into a component schema.\n */\n parseModule(path: string): Export[] {\n const parsers = this.parserSlot.toArray();\n let maybeParser = parsers.find(([, parser]) => {\n const match = path.match(parser.extension);\n return match;\n });\n\n if (!maybeParser) {\n maybeParser = [this.config.defaultParser, this.getDefaultParser()];\n }\n\n const [, parser] = maybeParser;\n return parser.parseModule(path);\n }\n\n getSchemaExtractor(component: Component) {\n const env = this.envs.getEnv(component).env;\n if (typeof env.getSchemaExtractor === 'undefined') {\n throw new Error(`No SchemaExtractor defined for ${env.name}`);\n }\n\n return env.getSchemaExtractor();\n }\n\n /**\n * get a schema of a component.\n * @param component target component.\n * @param shouldDisposeResourcesOnceDone for long-running processes, such as bit-start/bit-watch, this is not\n * relevant. for calling the API only to get a schema for one component, this is needed to ensure the ts-server is\n * not kept alive. otherwise, the process will never end.\n */\n async getSchema(component: Component, shouldDisposeResourcesOnceDone = false): Promise<APISchema> {\n this.logger.debug(`getSchema of ${component.id.toString()}`);\n\n // if on workspace get schema from ts server\n if (this.workspace) {\n const env = this.envs.getEnv(component).env;\n if (typeof env.getSchemaExtractor === 'undefined') {\n throw new Error(`No SchemaExtractor defined for ${env.name}`);\n }\n const schemaExtractor: SchemaExtractor = env.getSchemaExtractor();\n\n const result = await schemaExtractor.extract(component);\n if (shouldDisposeResourcesOnceDone) schemaExtractor.dispose();\n\n return result;\n }\n\n // on scope get schema from builder api\n const schemaArtifact = await this.builder.getArtifactsVinylByAspectAndTaskName(\n component,\n SchemaAspect.id,\n SCHEMA_TASK_NAME\n );\n\n if (schemaArtifact.length === 0) {\n /**\n * return empty schema\n * when tag/snap without build\n * or backwards compatibility\n */\n return APISchema.empty(component.id);\n }\n\n const schemaJsonStr = schemaArtifact[0].contents.toString('utf-8');\n\n try {\n const schemaJson = JSON.parse(schemaJsonStr);\n return this.getSchemaFromObject(schemaJson);\n } catch (e) {\n if (e instanceof SyntaxError) {\n this.logger.error(e.message);\n throw new Error(`Invalid schema.json for ${component.id}`);\n }\n throw e;\n }\n }\n\n getSchemaFromObject(obj: Record<string, any>): APISchema {\n return APISchema.fromObject(obj);\n }\n\n /**\n * register a new parser.\n */\n registerParser(parser: Parser): SchemaMain {\n this.parserSlot.register(parser);\n return this;\n }\n\n static runtime = MainRuntime;\n static dependencies = [\n EnvsAspect,\n CLIAspect,\n ComponentAspect,\n GraphqlAspect,\n LoggerAspect,\n BuilderAspect,\n WorkspaceAspect,\n ];\n static slots = [Slot.withType<Parser>()];\n\n static defaultConfig = {\n defaultParser: 'teambit.typescript/typescript',\n };\n\n static async provider(\n [envs, cli, component, graphql, loggerMain, builder, workspace]: [\n EnvsMain,\n CLIMain,\n ComponentMain,\n GraphqlMain,\n LoggerMain,\n BuilderMain,\n Workspace\n ],\n config: SchemaConfig,\n [parserSlot]: [ParserSlot]\n ) {\n const logger = loggerMain.createLogger(SchemaAspect.id);\n const schema = new SchemaMain(parserSlot, envs, config, builder, workspace, logger);\n const schemaTask = new SchemaTask(SchemaAspect.id, schema, logger);\n builder.registerBuildTasks([schemaTask]);\n cli.register(new SchemaCommand(schema, component, logger));\n graphql.register(schemaSchema(schema));\n\n // workspace.onComponentLoad(async (component) => {\n // const apiSchema = await schema.getSchema(component);\n // return {};\n // });\n\n return schema;\n }\n}\n\nSchemaAspect.addRuntime(SchemaMain);\n\nexport default SchemaMain;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAA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,OAAO,CAAC2D,kBAAkB,CAAC,CAACF,UAAU,CAAC,CAAC;IACxCL,GAAG,CAACF,QAAQ,CAAC,KAAIU,wBAAa,EAACJ,MAAM,EAAExC,SAAS,EAAEd,MAAM,CAAC,CAAC;IAC1DmD,OAAO,CAACH,QAAQ,CAAC,IAAAW,uBAAY,EAACL,MAAM,CAAC,CAAC;;IAEtC;IACA;IACA;IACA;;IAEA,OAAOA,MAAM;EACf;AACF;AAAC;AAAA,gCAjKY7D,UAAU,aAsHJmE,kBAAW;AAAA,gCAtHjBnE,UAAU,kBAuHC,CACpBoE,kBAAU,EACVC,gBAAS,EACTC,oBAAe,EACfC,kBAAa,EACbC,sBAAY,EACZC,wBAAa,EACbC,4BAAe,CAChB;AAAA,gCA/HU1E,UAAU,WAgIN,CAAC2E,eAAI,CAACC,QAAQ,EAAU,CAAC;AAAA,gCAhI7B5E,UAAU,mBAkIE;EACrBU,aAAa,EAAE;AACjB,CAAC;AA+BH2B,sBAAY,CAACwC,UAAU,CAAC7E,UAAU,CAAC;AAAC,eAErBA,UAAU;AAAA"}
|
|
1
|
+
{"version":3,"names":["SchemaMain","constructor","parserSlot","envs","config","builder","workspace","logger","getDefaultParser","get","defaultParser","parseModule","path","parsers","toArray","maybeParser","find","parser","match","extension","getSchemaExtractor","component","env","getEnv","Error","name","getSchema","shouldDisposeResourcesOnceDone","debug","id","toString","formatter","getFormatter","setKey","schemaExtractor","result","extract","dispose","schemaArtifact","getArtifactsVinylByAspectAndTaskName","SchemaAspect","SCHEMA_TASK_NAME","length","APISchema","empty","schemaJsonStr","contents","schemaJson","JSON","parse","getSchemaFromObject","e","SyntaxError","error","message","obj","fromObject","registerParser","register","provider","cli","graphql","loggerMain","createLogger","schema","schemaTask","SchemaTask","registerBuildTasks","SchemaCommand","schemaSchema","MainRuntime","EnvsAspect","CLIAspect","ComponentAspect","GraphqlAspect","LoggerAspect","BuilderAspect","WorkspaceAspect","Slot","withType","addRuntime"],"sources":["schema.main.runtime.ts"],"sourcesContent":["import { MainRuntime, CLIMain, CLIAspect } from '@teambit/cli';\nimport ComponentAspect, { Component, ComponentMain } from '@teambit/component';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport GraphqlAspect, { GraphqlMain } from '@teambit/graphql';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { PrettierConfigMutator } from '@teambit/defender.prettier.config-mutator';\nimport { APISchema, Export } from '@teambit/semantics.entities.semantic-schema';\nimport { BuilderMain, BuilderAspect } from '@teambit/builder';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { Parser } from './parser';\nimport { SchemaAspect } from './schema.aspect';\nimport { SchemaExtractor } from './schema-extractor';\nimport { SchemaCommand } from './schema.cmd';\nimport { schemaSchema } from './schema.graphql';\nimport { SchemaTask, SCHEMA_TASK_NAME } from './schema.task';\n\nexport type ParserSlot = SlotRegistry<Parser>;\n\nexport type SchemaConfig = {\n /**\n * default parser\n */\n defaultParser: string;\n};\n\n/**\n * extension for extracting component schemas.\n */\nexport class SchemaMain {\n constructor(\n /**\n * parsers slot.\n */\n private parserSlot: ParserSlot,\n\n private envs: EnvsMain,\n\n private config: SchemaConfig,\n\n private builder: BuilderMain,\n\n private workspace: Workspace,\n\n private logger: Logger\n ) {}\n\n /**\n * get the default parser.\n */\n getDefaultParser(): Parser {\n return this.parserSlot.get(this.config.defaultParser) as Parser;\n }\n\n /**\n * parse a module into a component schema.\n */\n parseModule(path: string): Export[] {\n const parsers = this.parserSlot.toArray();\n let maybeParser = parsers.find(([, parser]) => {\n const match = path.match(parser.extension);\n return match;\n });\n\n if (!maybeParser) {\n maybeParser = [this.config.defaultParser, this.getDefaultParser()];\n }\n\n const [, parser] = maybeParser;\n return parser.parseModule(path);\n }\n\n getSchemaExtractor(component: Component) {\n const env = this.envs.getEnv(component).env;\n if (typeof env.getSchemaExtractor === 'undefined') {\n throw new Error(`No SchemaExtractor defined for ${env.name}`);\n }\n\n return env.getSchemaExtractor();\n }\n\n /**\n * get a schema of a component.\n * @param component target component.\n * @param shouldDisposeResourcesOnceDone for long-running processes, such as bit-start/bit-watch, this is not\n * relevant. for calling the API only to get a schema for one component, this is needed to ensure the ts-server is\n * not kept alive. otherwise, the process will never end.\n */\n async getSchema(component: Component, shouldDisposeResourcesOnceDone = false): Promise<APISchema> {\n this.logger.debug(`getSchema of ${component.id.toString()}`);\n\n // if on workspace get schema from ts server\n if (this.workspace) {\n const env = this.envs.getEnv(component).env;\n // types need to be fixed\n const formatter = env.getFormatter(null, [\n (config: PrettierConfigMutator) => {\n config.setKey('parser', 'typescript');\n return config;\n },\n ]);\n if (typeof env.getSchemaExtractor === 'undefined') {\n throw new Error(`No SchemaExtractor defined for ${env.name}`);\n }\n const schemaExtractor: SchemaExtractor = env.getSchemaExtractor();\n\n const result = await schemaExtractor.extract(component, formatter);\n if (shouldDisposeResourcesOnceDone) schemaExtractor.dispose();\n\n return result;\n }\n\n // on scope get schema from builder api\n const schemaArtifact = await this.builder.getArtifactsVinylByAspectAndTaskName(\n component,\n SchemaAspect.id,\n SCHEMA_TASK_NAME\n );\n\n if (schemaArtifact.length === 0) {\n /**\n * return empty schema\n * when tag/snap without build\n * or backwards compatibility\n */\n return APISchema.empty(component.id);\n }\n\n const schemaJsonStr = schemaArtifact[0].contents.toString('utf-8');\n\n try {\n const schemaJson = JSON.parse(schemaJsonStr);\n return this.getSchemaFromObject(schemaJson);\n } catch (e) {\n if (e instanceof SyntaxError) {\n this.logger.error(e.message);\n throw new Error(`Invalid schema.json for ${component.id}`);\n }\n throw e;\n }\n }\n\n getSchemaFromObject(obj: Record<string, any>): APISchema {\n return APISchema.fromObject(obj);\n }\n\n /**\n * register a new parser.\n */\n registerParser(parser: Parser): SchemaMain {\n this.parserSlot.register(parser);\n return this;\n }\n\n static runtime = MainRuntime;\n static dependencies = [\n EnvsAspect,\n CLIAspect,\n ComponentAspect,\n GraphqlAspect,\n LoggerAspect,\n BuilderAspect,\n WorkspaceAspect,\n ];\n static slots = [Slot.withType<Parser>()];\n\n static defaultConfig = {\n defaultParser: 'teambit.typescript/typescript',\n };\n\n static async provider(\n [envs, cli, component, graphql, loggerMain, builder, workspace]: [\n EnvsMain,\n CLIMain,\n ComponentMain,\n GraphqlMain,\n LoggerMain,\n BuilderMain,\n Workspace\n ],\n config: SchemaConfig,\n [parserSlot]: [ParserSlot]\n ) {\n const logger = loggerMain.createLogger(SchemaAspect.id);\n const schema = new SchemaMain(parserSlot, envs, config, builder, workspace, logger);\n const schemaTask = new SchemaTask(SchemaAspect.id, schema, logger);\n builder.registerBuildTasks([schemaTask]);\n cli.register(new SchemaCommand(schema, component, logger));\n graphql.register(schemaSchema(schema));\n\n // workspace.onComponentLoad(async (component) => {\n // const apiSchema = await schema.getSchema(component);\n // return {};\n // });\n\n return schema;\n }\n}\n\nSchemaAspect.addRuntime(SchemaMain);\n\nexport default SchemaMain;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAWA;AACA;AACA;AACO,MAAMA,UAAU,CAAC;EACtBC,WAAW;EACT;AACJ;AACA;EACYC,UAAsB,EAEt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,CAAC,KAAIU,wBAAa,EAACJ,MAAM,EAAE3C,SAAS,EAAEd,MAAM,CAAC,CAAC;IAC1DsD,OAAO,CAACH,QAAQ,CAAC,IAAAW,uBAAY,EAACL,MAAM,CAAC,CAAC;;IAEtC;IACA;IACA;IACA;;IAEA,OAAOA,MAAM;EACf;AACF;AAAC;AAAA,gCAxKYhE,UAAU,aA6HJsE,kBAAW;AAAA,gCA7HjBtE,UAAU,kBA8HC,CACpBuE,kBAAU,EACVC,gBAAS,EACTC,oBAAe,EACfC,kBAAa,EACbC,sBAAY,EACZC,wBAAa,EACbC,4BAAe,CAChB;AAAA,gCAtIU7E,UAAU,WAuIN,CAAC8E,eAAI,CAACC,QAAQ,EAAU,CAAC;AAAA,gCAvI7B/E,UAAU,mBAyIE;EACrBU,aAAa,EAAE;AACjB,CAAC;AA+BH8B,sBAAY,CAACwC,UAAU,CAAChF,UAAU,CAAC;AAAC,eAErBA,UAAU;AAAA"}
|
package/mock/button/index.ts
CHANGED
|
@@ -125,3 +125,9 @@ export interface CallSignatureWithTypeParams {
|
|
|
125
125
|
* Conditional Generic Type
|
|
126
126
|
*/
|
|
127
127
|
export type If<T, U, Y, N> = T extends U ? Y : N;
|
|
128
|
+
|
|
129
|
+
export function genericFunction<T>(a: T) {
|
|
130
|
+
return function <T>(a: T) {};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export const gfnc2 = genericFunction<string>('');
|
package/mock/button-schemas.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"character": 1
|
|
7
7
|
},
|
|
8
8
|
"module": {
|
|
9
|
-
"__schema": "
|
|
9
|
+
"__schema": "ModuleSchema",
|
|
10
10
|
"location": {
|
|
11
11
|
"filePath": "index.ts",
|
|
12
12
|
"line": 15,
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
},
|
|
106
106
|
"tagName": "parameter",
|
|
107
107
|
"comment": "this is A",
|
|
108
|
-
"
|
|
108
|
+
"name": "a",
|
|
109
109
|
"type": {
|
|
110
110
|
"__schema": "KeywordTypeSchema",
|
|
111
111
|
"location": {
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
},
|
|
126
126
|
"tagName": "parameter",
|
|
127
127
|
"comment": "this is B",
|
|
128
|
-
"
|
|
128
|
+
"name": "b"
|
|
129
129
|
},
|
|
130
130
|
{
|
|
131
131
|
"__schema": "ReturnTagSchema",
|
|
@@ -361,12 +361,15 @@
|
|
|
361
361
|
},
|
|
362
362
|
{
|
|
363
363
|
"__schema": "ClassSchema",
|
|
364
|
-
"
|
|
364
|
+
"name": "Bar",
|
|
365
365
|
"location": {
|
|
366
366
|
"filePath": "button.tsx",
|
|
367
367
|
"line": 61,
|
|
368
368
|
"character": 1
|
|
369
369
|
},
|
|
370
|
+
"signature": "class Bar",
|
|
371
|
+
"extendsNodes": [],
|
|
372
|
+
"implementNodes": [],
|
|
370
373
|
"members": [
|
|
371
374
|
{
|
|
372
375
|
"__schema": "FunctionLikeSchema",
|
|
@@ -455,7 +458,7 @@
|
|
|
455
458
|
}
|
|
456
459
|
},
|
|
457
460
|
{
|
|
458
|
-
"__schema": "
|
|
461
|
+
"__schema": "ModuleSchema",
|
|
459
462
|
"location": {
|
|
460
463
|
"filePath": "button.composition.tsx",
|
|
461
464
|
"line": 3,
|
|
@@ -487,7 +490,7 @@
|
|
|
487
490
|
"__schema": "FunctionLikeSchema",
|
|
488
491
|
"location": {
|
|
489
492
|
"filePath": "button.composition.tsx",
|
|
490
|
-
"line":
|
|
493
|
+
"line": 14,
|
|
491
494
|
"character": 1
|
|
492
495
|
},
|
|
493
496
|
"name": "Footer",
|
|
@@ -500,7 +503,7 @@
|
|
|
500
503
|
"__schema": "ParameterSchema",
|
|
501
504
|
"location": {
|
|
502
505
|
"filePath": "button.composition.tsx",
|
|
503
|
-
"line":
|
|
506
|
+
"line": 14,
|
|
504
507
|
"character": 24
|
|
505
508
|
},
|
|
506
509
|
"name": "{ children = <BasicButton /> }",
|
|
@@ -509,7 +512,7 @@
|
|
|
509
512
|
"__schema": "TypeLiteralSchema",
|
|
510
513
|
"location": {
|
|
511
514
|
"filePath": "button.composition.tsx",
|
|
512
|
-
"line":
|
|
515
|
+
"line": 14,
|
|
513
516
|
"character": 24
|
|
514
517
|
},
|
|
515
518
|
"members": [
|
|
@@ -517,21 +520,33 @@
|
|
|
517
520
|
"__schema": "InferenceTypeSchema",
|
|
518
521
|
"location": {
|
|
519
522
|
"filePath": "button.composition.tsx",
|
|
520
|
-
"line":
|
|
523
|
+
"line": 14,
|
|
521
524
|
"character": 24
|
|
522
525
|
},
|
|
523
526
|
"type": "any",
|
|
524
527
|
"name": "children"
|
|
525
528
|
}
|
|
526
529
|
]
|
|
527
|
-
}
|
|
530
|
+
},
|
|
531
|
+
"objectBindingNodes": [
|
|
532
|
+
{
|
|
533
|
+
"__schema": "InferenceTypeSchema",
|
|
534
|
+
"location": {
|
|
535
|
+
"filePath": "button.composition.tsx",
|
|
536
|
+
"line": 14,
|
|
537
|
+
"character": 24
|
|
538
|
+
},
|
|
539
|
+
"type": "any",
|
|
540
|
+
"name": "children"
|
|
541
|
+
}
|
|
542
|
+
]
|
|
528
543
|
}
|
|
529
544
|
],
|
|
530
545
|
"returnType": {
|
|
531
546
|
"__schema": "InferenceTypeSchema",
|
|
532
547
|
"location": {
|
|
533
548
|
"filePath": "button.composition.tsx",
|
|
534
|
-
"line":
|
|
549
|
+
"line": 14,
|
|
535
550
|
"character": 1
|
|
536
551
|
},
|
|
537
552
|
"type": "any"
|
|
@@ -551,7 +566,7 @@
|
|
|
551
566
|
"__schema": "FunctionLikeSchema",
|
|
552
567
|
"location": {
|
|
553
568
|
"filePath": "button.composition.tsx",
|
|
554
|
-
"line":
|
|
569
|
+
"line": 18,
|
|
555
570
|
"character": 14
|
|
556
571
|
},
|
|
557
572
|
"name": "ButtonWithCustomStyles",
|
|
@@ -562,7 +577,7 @@
|
|
|
562
577
|
"__schema": "InferenceTypeSchema",
|
|
563
578
|
"location": {
|
|
564
579
|
"filePath": "button.composition.tsx",
|
|
565
|
-
"line":
|
|
580
|
+
"line": 18,
|
|
566
581
|
"character": 14
|
|
567
582
|
},
|
|
568
583
|
"type": "any"
|
|
@@ -572,7 +587,7 @@
|
|
|
572
587
|
"__schema": "FunctionLikeSchema",
|
|
573
588
|
"location": {
|
|
574
589
|
"filePath": "button.composition.tsx",
|
|
575
|
-
"line":
|
|
590
|
+
"line": 22,
|
|
576
591
|
"character": 14
|
|
577
592
|
},
|
|
578
593
|
"name": "ButtonWithIcon",
|
|
@@ -583,7 +598,7 @@
|
|
|
583
598
|
"__schema": "InferenceTypeSchema",
|
|
584
599
|
"location": {
|
|
585
600
|
"filePath": "button.composition.tsx",
|
|
586
|
-
"line":
|
|
601
|
+
"line": 22,
|
|
587
602
|
"character": 14
|
|
588
603
|
},
|
|
589
604
|
"type": "any"
|
|
@@ -593,7 +608,7 @@
|
|
|
593
608
|
"__schema": "FunctionLikeSchema",
|
|
594
609
|
"location": {
|
|
595
610
|
"filePath": "button.composition.tsx",
|
|
596
|
-
"line":
|
|
611
|
+
"line": 31,
|
|
597
612
|
"character": 14
|
|
598
613
|
},
|
|
599
614
|
"name": "ButtonAsALink",
|
|
@@ -604,7 +619,7 @@
|
|
|
604
619
|
"__schema": "InferenceTypeSchema",
|
|
605
620
|
"location": {
|
|
606
621
|
"filePath": "button.composition.tsx",
|
|
607
|
-
"line":
|
|
622
|
+
"line": 31,
|
|
608
623
|
"character": 14
|
|
609
624
|
},
|
|
610
625
|
"type": "any"
|
|
@@ -677,12 +692,15 @@
|
|
|
677
692
|
},
|
|
678
693
|
{
|
|
679
694
|
"__schema": "ClassSchema",
|
|
680
|
-
"
|
|
695
|
+
"name": "ClassSomething",
|
|
681
696
|
"location": {
|
|
682
697
|
"filePath": "index.ts",
|
|
683
698
|
"line": 36,
|
|
684
699
|
"character": 1
|
|
685
700
|
},
|
|
701
|
+
"signature": "class ClassSomething",
|
|
702
|
+
"extendsNodes": [],
|
|
703
|
+
"implementNodes": [],
|
|
686
704
|
"members": [
|
|
687
705
|
{
|
|
688
706
|
"__schema": "VariableLikeSchema",
|
|
@@ -711,6 +729,7 @@
|
|
|
711
729
|
"line": 38,
|
|
712
730
|
"character": 3
|
|
713
731
|
},
|
|
732
|
+
"signature": "constructor ClassSomething(da: 'dsa'): ClassSomething",
|
|
714
733
|
"params": [
|
|
715
734
|
{
|
|
716
735
|
"__schema": "ParameterSchema",
|
|
@@ -870,6 +889,8 @@
|
|
|
870
889
|
"character": 1
|
|
871
890
|
},
|
|
872
891
|
"name": "Hello",
|
|
892
|
+
"signature": "interface Hello",
|
|
893
|
+
"extendsNodes": [],
|
|
873
894
|
"members": [
|
|
874
895
|
{
|
|
875
896
|
"__schema": "VariableLikeSchema",
|
|
@@ -972,7 +993,7 @@
|
|
|
972
993
|
"line": 63,
|
|
973
994
|
"character": 28
|
|
974
995
|
},
|
|
975
|
-
"
|
|
996
|
+
"name": "keyof",
|
|
976
997
|
"type": {
|
|
977
998
|
"__schema": "TypeQuerySchema",
|
|
978
999
|
"location": {
|
|
@@ -1133,10 +1154,38 @@
|
|
|
1133
1154
|
"character": 1
|
|
1134
1155
|
},
|
|
1135
1156
|
"name": "Food",
|
|
1157
|
+
"signature": "enum Food",
|
|
1136
1158
|
"members": [
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1159
|
+
{
|
|
1160
|
+
"__schema": "EnumMemberSchema",
|
|
1161
|
+
"location": {
|
|
1162
|
+
"filePath": "index.ts",
|
|
1163
|
+
"line": 74,
|
|
1164
|
+
"character": 3
|
|
1165
|
+
},
|
|
1166
|
+
"name": "Falafel",
|
|
1167
|
+
"signature": "(enum member) Food.Falafel = 0"
|
|
1168
|
+
},
|
|
1169
|
+
{
|
|
1170
|
+
"__schema": "EnumMemberSchema",
|
|
1171
|
+
"location": {
|
|
1172
|
+
"filePath": "index.ts",
|
|
1173
|
+
"line": 75,
|
|
1174
|
+
"character": 3
|
|
1175
|
+
},
|
|
1176
|
+
"name": "Hummus",
|
|
1177
|
+
"signature": "(enum member) Food.Hummus = 1"
|
|
1178
|
+
},
|
|
1179
|
+
{
|
|
1180
|
+
"__schema": "EnumMemberSchema",
|
|
1181
|
+
"location": {
|
|
1182
|
+
"filePath": "index.ts",
|
|
1183
|
+
"line": 76,
|
|
1184
|
+
"character": 3
|
|
1185
|
+
},
|
|
1186
|
+
"name": "Tahini",
|
|
1187
|
+
"signature": "(enum member) Food.Tahini = 2"
|
|
1188
|
+
}
|
|
1140
1189
|
]
|
|
1141
1190
|
},
|
|
1142
1191
|
{
|
|
@@ -1291,7 +1340,7 @@
|
|
|
1291
1340
|
"line": 90,
|
|
1292
1341
|
"character": 44
|
|
1293
1342
|
},
|
|
1294
|
-
"
|
|
1343
|
+
"name": "str",
|
|
1295
1344
|
"hasAssertsModifier": false,
|
|
1296
1345
|
"type": {
|
|
1297
1346
|
"__schema": "KeywordTypeSchema",
|
|
@@ -1363,7 +1412,7 @@
|
|
|
1363
1412
|
"line": 94,
|
|
1364
1413
|
"character": 70
|
|
1365
1414
|
},
|
|
1366
|
-
"
|
|
1415
|
+
"name": "condition",
|
|
1367
1416
|
"hasAssertsModifier": true
|
|
1368
1417
|
}
|
|
1369
1418
|
},
|
|
@@ -1409,7 +1458,19 @@
|
|
|
1409
1458
|
"name": "prop"
|
|
1410
1459
|
}
|
|
1411
1460
|
]
|
|
1412
|
-
}
|
|
1461
|
+
},
|
|
1462
|
+
"objectBindingNodes": [
|
|
1463
|
+
{
|
|
1464
|
+
"__schema": "InferenceTypeSchema",
|
|
1465
|
+
"location": {
|
|
1466
|
+
"filePath": "index.ts",
|
|
1467
|
+
"line": 96,
|
|
1468
|
+
"character": 45
|
|
1469
|
+
},
|
|
1470
|
+
"type": "number",
|
|
1471
|
+
"name": "prop"
|
|
1472
|
+
}
|
|
1473
|
+
]
|
|
1413
1474
|
}
|
|
1414
1475
|
],
|
|
1415
1476
|
"returnType": {
|
|
@@ -1521,6 +1582,8 @@
|
|
|
1521
1582
|
"character": 1
|
|
1522
1583
|
},
|
|
1523
1584
|
"name": "ComputedNameWithType",
|
|
1585
|
+
"signature": "interface ComputedNameWithType",
|
|
1586
|
+
"extendsNodes": [],
|
|
1524
1587
|
"members": [
|
|
1525
1588
|
{
|
|
1526
1589
|
"__schema": "VariableLikeSchema",
|
|
@@ -1552,6 +1615,8 @@
|
|
|
1552
1615
|
"character": 1
|
|
1553
1616
|
},
|
|
1554
1617
|
"name": "ComputedNameNoType",
|
|
1618
|
+
"signature": "interface ComputedNameNoType",
|
|
1619
|
+
"extendsNodes": [],
|
|
1555
1620
|
"members": [
|
|
1556
1621
|
{
|
|
1557
1622
|
"__schema": "VariableLikeSchema",
|
|
@@ -1642,6 +1707,8 @@
|
|
|
1642
1707
|
"character": 1
|
|
1643
1708
|
},
|
|
1644
1709
|
"name": "CallSignatureWithTypeParams",
|
|
1710
|
+
"signature": "interface CallSignatureWithTypeParams",
|
|
1711
|
+
"extendsNodes": [],
|
|
1645
1712
|
"members": [
|
|
1646
1713
|
{
|
|
1647
1714
|
"__schema": "FunctionLikeSchema",
|
|
@@ -1713,7 +1780,7 @@
|
|
|
1713
1780
|
"line": 127,
|
|
1714
1781
|
"character": 30
|
|
1715
1782
|
},
|
|
1716
|
-
"type": "
|
|
1783
|
+
"type": "T",
|
|
1717
1784
|
"name": "T"
|
|
1718
1785
|
},
|
|
1719
1786
|
"extendsType": {
|
|
@@ -1723,7 +1790,7 @@
|
|
|
1723
1790
|
"line": 127,
|
|
1724
1791
|
"character": 40
|
|
1725
1792
|
},
|
|
1726
|
-
"type": "
|
|
1793
|
+
"type": "U",
|
|
1727
1794
|
"name": "U"
|
|
1728
1795
|
},
|
|
1729
1796
|
"trueType": {
|
|
@@ -1733,7 +1800,7 @@
|
|
|
1733
1800
|
"line": 127,
|
|
1734
1801
|
"character": 44
|
|
1735
1802
|
},
|
|
1736
|
-
"type": "
|
|
1803
|
+
"type": "Y",
|
|
1737
1804
|
"name": "Y"
|
|
1738
1805
|
},
|
|
1739
1806
|
"falseType": {
|
|
@@ -1743,7 +1810,7 @@
|
|
|
1743
1810
|
"line": 127,
|
|
1744
1811
|
"character": 48
|
|
1745
1812
|
},
|
|
1746
|
-
"type": "
|
|
1813
|
+
"type": "N",
|
|
1747
1814
|
"name": "N"
|
|
1748
1815
|
}
|
|
1749
1816
|
},
|
|
@@ -1757,6 +1824,73 @@
|
|
|
1757
1824
|
"raw": "/**\n * Conditional Generic Type\n */",
|
|
1758
1825
|
"comment": "Conditional Generic Type"
|
|
1759
1826
|
}
|
|
1827
|
+
},
|
|
1828
|
+
{
|
|
1829
|
+
"__schema": "FunctionLikeSchema",
|
|
1830
|
+
"location": {
|
|
1831
|
+
"filePath": "index.ts",
|
|
1832
|
+
"line": 129,
|
|
1833
|
+
"character": 1
|
|
1834
|
+
},
|
|
1835
|
+
"name": "genericFunction",
|
|
1836
|
+
"signature": "function genericFunction<T>(a: T): <T>(a: T) => void",
|
|
1837
|
+
"modifiers": [
|
|
1838
|
+
"export"
|
|
1839
|
+
],
|
|
1840
|
+
"typeParams": [
|
|
1841
|
+
"T"
|
|
1842
|
+
],
|
|
1843
|
+
"params": [
|
|
1844
|
+
{
|
|
1845
|
+
"__schema": "ParameterSchema",
|
|
1846
|
+
"location": {
|
|
1847
|
+
"filePath": "index.ts",
|
|
1848
|
+
"line": 129,
|
|
1849
|
+
"character": 36
|
|
1850
|
+
},
|
|
1851
|
+
"name": "a",
|
|
1852
|
+
"isOptional": false,
|
|
1853
|
+
"type": {
|
|
1854
|
+
"__schema": "InferenceTypeSchema",
|
|
1855
|
+
"location": {
|
|
1856
|
+
"filePath": "index.ts",
|
|
1857
|
+
"line": 129,
|
|
1858
|
+
"character": 39
|
|
1859
|
+
},
|
|
1860
|
+
"type": "T",
|
|
1861
|
+
"name": "T"
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
],
|
|
1865
|
+
"returnType": {
|
|
1866
|
+
"__schema": "InferenceTypeSchema",
|
|
1867
|
+
"location": {
|
|
1868
|
+
"filePath": "index.ts",
|
|
1869
|
+
"line": 129,
|
|
1870
|
+
"character": 1
|
|
1871
|
+
},
|
|
1872
|
+
"type": "<T>(a: T) => void"
|
|
1873
|
+
}
|
|
1874
|
+
},
|
|
1875
|
+
{
|
|
1876
|
+
"__schema": "VariableLikeSchema",
|
|
1877
|
+
"location": {
|
|
1878
|
+
"filePath": "index.ts",
|
|
1879
|
+
"line": 133,
|
|
1880
|
+
"character": 14
|
|
1881
|
+
},
|
|
1882
|
+
"name": "gfnc2",
|
|
1883
|
+
"signature": "const gfnc2: <T>(a: T) => void",
|
|
1884
|
+
"isOptional": false,
|
|
1885
|
+
"type": {
|
|
1886
|
+
"__schema": "InferenceTypeSchema",
|
|
1887
|
+
"location": {
|
|
1888
|
+
"filePath": "index.ts",
|
|
1889
|
+
"line": 133,
|
|
1890
|
+
"character": 14
|
|
1891
|
+
},
|
|
1892
|
+
"type": "<T>(a: T) => void"
|
|
1893
|
+
}
|
|
1760
1894
|
}
|
|
1761
1895
|
]
|
|
1762
1896
|
},
|
|
@@ -1764,4 +1898,4 @@
|
|
|
1764
1898
|
"name": "button",
|
|
1765
1899
|
"scope": "org.scope"
|
|
1766
1900
|
}
|
|
1767
|
-
}
|
|
1901
|
+
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/schema",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.896",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/semantics/schema",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.semantics",
|
|
8
8
|
"name": "schema",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.896"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"p-map-series": "2.1.0",
|
|
@@ -17,14 +17,16 @@
|
|
|
17
17
|
"core-js": "^3.0.0",
|
|
18
18
|
"@teambit/harmony": "0.3.3",
|
|
19
19
|
"@teambit/base-react.navigation.link": "2.0.27",
|
|
20
|
-
"@teambit/semantics.entities.semantic-schema": "0.0.
|
|
21
|
-
"@teambit/component": "0.0.
|
|
20
|
+
"@teambit/semantics.entities.semantic-schema": "0.0.48",
|
|
21
|
+
"@teambit/component": "0.0.896",
|
|
22
|
+
"@teambit/formatter": "0.0.447",
|
|
22
23
|
"@teambit/cli": "0.0.599",
|
|
23
24
|
"@teambit/logger": "0.0.692",
|
|
24
|
-
"@teambit/builder": "0.0.
|
|
25
|
-
"@teambit/
|
|
26
|
-
"@teambit/
|
|
27
|
-
"@teambit/
|
|
25
|
+
"@teambit/builder": "0.0.896",
|
|
26
|
+
"@teambit/defender.prettier.config-mutator": "0.0.90",
|
|
27
|
+
"@teambit/envs": "0.0.896",
|
|
28
|
+
"@teambit/graphql": "0.0.896",
|
|
29
|
+
"@teambit/workspace": "0.0.896"
|
|
28
30
|
},
|
|
29
31
|
"devDependencies": {
|
|
30
32
|
"@types/react": "^17.0.8",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_schema@0.0.
|
|
2
|
-
import * as compositions_1 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_schema@0.0.
|
|
3
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_schema@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_schema@0.0.896/dist/schema.composition.js';
|
|
2
|
+
import * as compositions_1 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_schema@0.0.896/dist/mock/button/button.composition.js';
|
|
3
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_schema@0.0.896/dist/schema.docs.mdx';
|
|
4
4
|
|
|
5
5
|
export const compositions = [compositions_0, compositions_1];
|
|
6
6
|
export const overview = [overview_0];
|
|
Binary file
|