@teambit/schema 0.0.893 → 0.0.895
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 +137 -27
- 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 +137 -27
- package/package-tar/teambit-schema-0.0.895.tgz +0 -0
- package/package.json +10 -8
- package/{preview-1667706059705.js → preview-1667965305919.js} +3 -3
- package/package-tar/teambit-schema-0.0.893.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,7 +520,7 @@
|
|
|
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",
|
|
@@ -531,7 +534,7 @@
|
|
|
531
534
|
"__schema": "InferenceTypeSchema",
|
|
532
535
|
"location": {
|
|
533
536
|
"filePath": "button.composition.tsx",
|
|
534
|
-
"line":
|
|
537
|
+
"line": 14,
|
|
535
538
|
"character": 1
|
|
536
539
|
},
|
|
537
540
|
"type": "any"
|
|
@@ -551,7 +554,7 @@
|
|
|
551
554
|
"__schema": "FunctionLikeSchema",
|
|
552
555
|
"location": {
|
|
553
556
|
"filePath": "button.composition.tsx",
|
|
554
|
-
"line":
|
|
557
|
+
"line": 18,
|
|
555
558
|
"character": 14
|
|
556
559
|
},
|
|
557
560
|
"name": "ButtonWithCustomStyles",
|
|
@@ -562,7 +565,7 @@
|
|
|
562
565
|
"__schema": "InferenceTypeSchema",
|
|
563
566
|
"location": {
|
|
564
567
|
"filePath": "button.composition.tsx",
|
|
565
|
-
"line":
|
|
568
|
+
"line": 18,
|
|
566
569
|
"character": 14
|
|
567
570
|
},
|
|
568
571
|
"type": "any"
|
|
@@ -572,7 +575,7 @@
|
|
|
572
575
|
"__schema": "FunctionLikeSchema",
|
|
573
576
|
"location": {
|
|
574
577
|
"filePath": "button.composition.tsx",
|
|
575
|
-
"line":
|
|
578
|
+
"line": 22,
|
|
576
579
|
"character": 14
|
|
577
580
|
},
|
|
578
581
|
"name": "ButtonWithIcon",
|
|
@@ -583,7 +586,7 @@
|
|
|
583
586
|
"__schema": "InferenceTypeSchema",
|
|
584
587
|
"location": {
|
|
585
588
|
"filePath": "button.composition.tsx",
|
|
586
|
-
"line":
|
|
589
|
+
"line": 22,
|
|
587
590
|
"character": 14
|
|
588
591
|
},
|
|
589
592
|
"type": "any"
|
|
@@ -593,7 +596,7 @@
|
|
|
593
596
|
"__schema": "FunctionLikeSchema",
|
|
594
597
|
"location": {
|
|
595
598
|
"filePath": "button.composition.tsx",
|
|
596
|
-
"line":
|
|
599
|
+
"line": 31,
|
|
597
600
|
"character": 14
|
|
598
601
|
},
|
|
599
602
|
"name": "ButtonAsALink",
|
|
@@ -604,7 +607,7 @@
|
|
|
604
607
|
"__schema": "InferenceTypeSchema",
|
|
605
608
|
"location": {
|
|
606
609
|
"filePath": "button.composition.tsx",
|
|
607
|
-
"line":
|
|
610
|
+
"line": 31,
|
|
608
611
|
"character": 14
|
|
609
612
|
},
|
|
610
613
|
"type": "any"
|
|
@@ -677,12 +680,15 @@
|
|
|
677
680
|
},
|
|
678
681
|
{
|
|
679
682
|
"__schema": "ClassSchema",
|
|
680
|
-
"
|
|
683
|
+
"name": "ClassSomething",
|
|
681
684
|
"location": {
|
|
682
685
|
"filePath": "index.ts",
|
|
683
686
|
"line": 36,
|
|
684
687
|
"character": 1
|
|
685
688
|
},
|
|
689
|
+
"signature": "class ClassSomething",
|
|
690
|
+
"extendsNodes": [],
|
|
691
|
+
"implementNodes": [],
|
|
686
692
|
"members": [
|
|
687
693
|
{
|
|
688
694
|
"__schema": "VariableLikeSchema",
|
|
@@ -711,6 +717,7 @@
|
|
|
711
717
|
"line": 38,
|
|
712
718
|
"character": 3
|
|
713
719
|
},
|
|
720
|
+
"signature": "constructor ClassSomething(da: 'dsa'): ClassSomething",
|
|
714
721
|
"params": [
|
|
715
722
|
{
|
|
716
723
|
"__schema": "ParameterSchema",
|
|
@@ -870,6 +877,8 @@
|
|
|
870
877
|
"character": 1
|
|
871
878
|
},
|
|
872
879
|
"name": "Hello",
|
|
880
|
+
"signature": "interface Hello",
|
|
881
|
+
"extendsNodes": [],
|
|
873
882
|
"members": [
|
|
874
883
|
{
|
|
875
884
|
"__schema": "VariableLikeSchema",
|
|
@@ -972,7 +981,7 @@
|
|
|
972
981
|
"line": 63,
|
|
973
982
|
"character": 28
|
|
974
983
|
},
|
|
975
|
-
"
|
|
984
|
+
"name": "keyof",
|
|
976
985
|
"type": {
|
|
977
986
|
"__schema": "TypeQuerySchema",
|
|
978
987
|
"location": {
|
|
@@ -1133,10 +1142,38 @@
|
|
|
1133
1142
|
"character": 1
|
|
1134
1143
|
},
|
|
1135
1144
|
"name": "Food",
|
|
1145
|
+
"signature": "enum Food",
|
|
1136
1146
|
"members": [
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1147
|
+
{
|
|
1148
|
+
"__schema": "EnumMemberSchema",
|
|
1149
|
+
"location": {
|
|
1150
|
+
"filePath": "index.ts",
|
|
1151
|
+
"line": 74,
|
|
1152
|
+
"character": 3
|
|
1153
|
+
},
|
|
1154
|
+
"name": "Falafel",
|
|
1155
|
+
"signature": "(enum member) Food.Falafel = 0"
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
"__schema": "EnumMemberSchema",
|
|
1159
|
+
"location": {
|
|
1160
|
+
"filePath": "index.ts",
|
|
1161
|
+
"line": 75,
|
|
1162
|
+
"character": 3
|
|
1163
|
+
},
|
|
1164
|
+
"name": "Hummus",
|
|
1165
|
+
"signature": "(enum member) Food.Hummus = 1"
|
|
1166
|
+
},
|
|
1167
|
+
{
|
|
1168
|
+
"__schema": "EnumMemberSchema",
|
|
1169
|
+
"location": {
|
|
1170
|
+
"filePath": "index.ts",
|
|
1171
|
+
"line": 76,
|
|
1172
|
+
"character": 3
|
|
1173
|
+
},
|
|
1174
|
+
"name": "Tahini",
|
|
1175
|
+
"signature": "(enum member) Food.Tahini = 2"
|
|
1176
|
+
}
|
|
1140
1177
|
]
|
|
1141
1178
|
},
|
|
1142
1179
|
{
|
|
@@ -1291,7 +1328,7 @@
|
|
|
1291
1328
|
"line": 90,
|
|
1292
1329
|
"character": 44
|
|
1293
1330
|
},
|
|
1294
|
-
"
|
|
1331
|
+
"name": "str",
|
|
1295
1332
|
"hasAssertsModifier": false,
|
|
1296
1333
|
"type": {
|
|
1297
1334
|
"__schema": "KeywordTypeSchema",
|
|
@@ -1363,7 +1400,7 @@
|
|
|
1363
1400
|
"line": 94,
|
|
1364
1401
|
"character": 70
|
|
1365
1402
|
},
|
|
1366
|
-
"
|
|
1403
|
+
"name": "condition",
|
|
1367
1404
|
"hasAssertsModifier": true
|
|
1368
1405
|
}
|
|
1369
1406
|
},
|
|
@@ -1521,6 +1558,8 @@
|
|
|
1521
1558
|
"character": 1
|
|
1522
1559
|
},
|
|
1523
1560
|
"name": "ComputedNameWithType",
|
|
1561
|
+
"signature": "interface ComputedNameWithType",
|
|
1562
|
+
"extendsNodes": [],
|
|
1524
1563
|
"members": [
|
|
1525
1564
|
{
|
|
1526
1565
|
"__schema": "VariableLikeSchema",
|
|
@@ -1552,6 +1591,8 @@
|
|
|
1552
1591
|
"character": 1
|
|
1553
1592
|
},
|
|
1554
1593
|
"name": "ComputedNameNoType",
|
|
1594
|
+
"signature": "interface ComputedNameNoType",
|
|
1595
|
+
"extendsNodes": [],
|
|
1555
1596
|
"members": [
|
|
1556
1597
|
{
|
|
1557
1598
|
"__schema": "VariableLikeSchema",
|
|
@@ -1642,6 +1683,8 @@
|
|
|
1642
1683
|
"character": 1
|
|
1643
1684
|
},
|
|
1644
1685
|
"name": "CallSignatureWithTypeParams",
|
|
1686
|
+
"signature": "interface CallSignatureWithTypeParams",
|
|
1687
|
+
"extendsNodes": [],
|
|
1645
1688
|
"members": [
|
|
1646
1689
|
{
|
|
1647
1690
|
"__schema": "FunctionLikeSchema",
|
|
@@ -1713,7 +1756,7 @@
|
|
|
1713
1756
|
"line": 127,
|
|
1714
1757
|
"character": 30
|
|
1715
1758
|
},
|
|
1716
|
-
"type": "
|
|
1759
|
+
"type": "T",
|
|
1717
1760
|
"name": "T"
|
|
1718
1761
|
},
|
|
1719
1762
|
"extendsType": {
|
|
@@ -1723,7 +1766,7 @@
|
|
|
1723
1766
|
"line": 127,
|
|
1724
1767
|
"character": 40
|
|
1725
1768
|
},
|
|
1726
|
-
"type": "
|
|
1769
|
+
"type": "U",
|
|
1727
1770
|
"name": "U"
|
|
1728
1771
|
},
|
|
1729
1772
|
"trueType": {
|
|
@@ -1733,7 +1776,7 @@
|
|
|
1733
1776
|
"line": 127,
|
|
1734
1777
|
"character": 44
|
|
1735
1778
|
},
|
|
1736
|
-
"type": "
|
|
1779
|
+
"type": "Y",
|
|
1737
1780
|
"name": "Y"
|
|
1738
1781
|
},
|
|
1739
1782
|
"falseType": {
|
|
@@ -1743,7 +1786,7 @@
|
|
|
1743
1786
|
"line": 127,
|
|
1744
1787
|
"character": 48
|
|
1745
1788
|
},
|
|
1746
|
-
"type": "
|
|
1789
|
+
"type": "N",
|
|
1747
1790
|
"name": "N"
|
|
1748
1791
|
}
|
|
1749
1792
|
},
|
|
@@ -1757,6 +1800,73 @@
|
|
|
1757
1800
|
"raw": "/**\n * Conditional Generic Type\n */",
|
|
1758
1801
|
"comment": "Conditional Generic Type"
|
|
1759
1802
|
}
|
|
1803
|
+
},
|
|
1804
|
+
{
|
|
1805
|
+
"__schema": "FunctionLikeSchema",
|
|
1806
|
+
"location": {
|
|
1807
|
+
"filePath": "index.ts",
|
|
1808
|
+
"line": 129,
|
|
1809
|
+
"character": 1
|
|
1810
|
+
},
|
|
1811
|
+
"name": "genericFunction",
|
|
1812
|
+
"signature": "function genericFunction<T>(a: T): <T>(a: T) => void",
|
|
1813
|
+
"modifiers": [
|
|
1814
|
+
"export"
|
|
1815
|
+
],
|
|
1816
|
+
"typeParams": [
|
|
1817
|
+
"T"
|
|
1818
|
+
],
|
|
1819
|
+
"params": [
|
|
1820
|
+
{
|
|
1821
|
+
"__schema": "ParameterSchema",
|
|
1822
|
+
"location": {
|
|
1823
|
+
"filePath": "index.ts",
|
|
1824
|
+
"line": 129,
|
|
1825
|
+
"character": 36
|
|
1826
|
+
},
|
|
1827
|
+
"name": "a",
|
|
1828
|
+
"isOptional": false,
|
|
1829
|
+
"type": {
|
|
1830
|
+
"__schema": "InferenceTypeSchema",
|
|
1831
|
+
"location": {
|
|
1832
|
+
"filePath": "index.ts",
|
|
1833
|
+
"line": 129,
|
|
1834
|
+
"character": 39
|
|
1835
|
+
},
|
|
1836
|
+
"type": "T",
|
|
1837
|
+
"name": "T"
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
],
|
|
1841
|
+
"returnType": {
|
|
1842
|
+
"__schema": "InferenceTypeSchema",
|
|
1843
|
+
"location": {
|
|
1844
|
+
"filePath": "index.ts",
|
|
1845
|
+
"line": 129,
|
|
1846
|
+
"character": 1
|
|
1847
|
+
},
|
|
1848
|
+
"type": "<T>(a: T) => void"
|
|
1849
|
+
}
|
|
1850
|
+
},
|
|
1851
|
+
{
|
|
1852
|
+
"__schema": "VariableLikeSchema",
|
|
1853
|
+
"location": {
|
|
1854
|
+
"filePath": "index.ts",
|
|
1855
|
+
"line": 133,
|
|
1856
|
+
"character": 14
|
|
1857
|
+
},
|
|
1858
|
+
"name": "gfnc2",
|
|
1859
|
+
"signature": "const gfnc2: <T>(a: T) => void",
|
|
1860
|
+
"isOptional": false,
|
|
1861
|
+
"type": {
|
|
1862
|
+
"__schema": "InferenceTypeSchema",
|
|
1863
|
+
"location": {
|
|
1864
|
+
"filePath": "index.ts",
|
|
1865
|
+
"line": 133,
|
|
1866
|
+
"character": 14
|
|
1867
|
+
},
|
|
1868
|
+
"type": "<T>(a: T) => void"
|
|
1869
|
+
}
|
|
1760
1870
|
}
|
|
1761
1871
|
]
|
|
1762
1872
|
},
|
|
@@ -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;EA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Ae,EAC1B;IACA,MAAMK,MAAM,GAAGoD,UAAU,CAACC,YAAY,CAACvB,sBAAY,CAACR,EAAE,CAAC;IACvD,MAAMgC,MAAM,GAAG,IAAI7D,UAAU,CAACE,UAAU,EAAEC,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAEC,SAAS,EAAEC,MAAM,CAAC;IACnF,MAAMuD,UAAU,GAAG,KAAIC,qBAAU,EAAC1B,sBAAY,CAACR,EAAE,EAAEgC,MAAM,EAAEtD,MAAM,CAAC;IAClEF,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;E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AE,CAAC;IACvD,MAAMmC,MAAM,GAAG,IAAIhE,UAAU,CAACE,UAAU,EAAEC,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAEC,SAAS,EAAEC,MAAM,CAAC;IACnF,MAAM0D,UAAU,GAAG,KAAIC,qBAAU,EAAC1B,sBAAY,CAACX,EAAE,EAAEmC,MAAM,EAAEzD,MAAM,CAAC;IAClEF,OAAO,CAAC8D,kBAAkB,CAAC,CAACF,UAAU,CAAC,CAAC;IACxCL,GAAG,CAACF,QAAQ,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,7 +520,7 @@
|
|
|
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",
|
|
@@ -531,7 +534,7 @@
|
|
|
531
534
|
"__schema": "InferenceTypeSchema",
|
|
532
535
|
"location": {
|
|
533
536
|
"filePath": "button.composition.tsx",
|
|
534
|
-
"line":
|
|
537
|
+
"line": 14,
|
|
535
538
|
"character": 1
|
|
536
539
|
},
|
|
537
540
|
"type": "any"
|
|
@@ -551,7 +554,7 @@
|
|
|
551
554
|
"__schema": "FunctionLikeSchema",
|
|
552
555
|
"location": {
|
|
553
556
|
"filePath": "button.composition.tsx",
|
|
554
|
-
"line":
|
|
557
|
+
"line": 18,
|
|
555
558
|
"character": 14
|
|
556
559
|
},
|
|
557
560
|
"name": "ButtonWithCustomStyles",
|
|
@@ -562,7 +565,7 @@
|
|
|
562
565
|
"__schema": "InferenceTypeSchema",
|
|
563
566
|
"location": {
|
|
564
567
|
"filePath": "button.composition.tsx",
|
|
565
|
-
"line":
|
|
568
|
+
"line": 18,
|
|
566
569
|
"character": 14
|
|
567
570
|
},
|
|
568
571
|
"type": "any"
|
|
@@ -572,7 +575,7 @@
|
|
|
572
575
|
"__schema": "FunctionLikeSchema",
|
|
573
576
|
"location": {
|
|
574
577
|
"filePath": "button.composition.tsx",
|
|
575
|
-
"line":
|
|
578
|
+
"line": 22,
|
|
576
579
|
"character": 14
|
|
577
580
|
},
|
|
578
581
|
"name": "ButtonWithIcon",
|
|
@@ -583,7 +586,7 @@
|
|
|
583
586
|
"__schema": "InferenceTypeSchema",
|
|
584
587
|
"location": {
|
|
585
588
|
"filePath": "button.composition.tsx",
|
|
586
|
-
"line":
|
|
589
|
+
"line": 22,
|
|
587
590
|
"character": 14
|
|
588
591
|
},
|
|
589
592
|
"type": "any"
|
|
@@ -593,7 +596,7 @@
|
|
|
593
596
|
"__schema": "FunctionLikeSchema",
|
|
594
597
|
"location": {
|
|
595
598
|
"filePath": "button.composition.tsx",
|
|
596
|
-
"line":
|
|
599
|
+
"line": 31,
|
|
597
600
|
"character": 14
|
|
598
601
|
},
|
|
599
602
|
"name": "ButtonAsALink",
|
|
@@ -604,7 +607,7 @@
|
|
|
604
607
|
"__schema": "InferenceTypeSchema",
|
|
605
608
|
"location": {
|
|
606
609
|
"filePath": "button.composition.tsx",
|
|
607
|
-
"line":
|
|
610
|
+
"line": 31,
|
|
608
611
|
"character": 14
|
|
609
612
|
},
|
|
610
613
|
"type": "any"
|
|
@@ -677,12 +680,15 @@
|
|
|
677
680
|
},
|
|
678
681
|
{
|
|
679
682
|
"__schema": "ClassSchema",
|
|
680
|
-
"
|
|
683
|
+
"name": "ClassSomething",
|
|
681
684
|
"location": {
|
|
682
685
|
"filePath": "index.ts",
|
|
683
686
|
"line": 36,
|
|
684
687
|
"character": 1
|
|
685
688
|
},
|
|
689
|
+
"signature": "class ClassSomething",
|
|
690
|
+
"extendsNodes": [],
|
|
691
|
+
"implementNodes": [],
|
|
686
692
|
"members": [
|
|
687
693
|
{
|
|
688
694
|
"__schema": "VariableLikeSchema",
|
|
@@ -711,6 +717,7 @@
|
|
|
711
717
|
"line": 38,
|
|
712
718
|
"character": 3
|
|
713
719
|
},
|
|
720
|
+
"signature": "constructor ClassSomething(da: 'dsa'): ClassSomething",
|
|
714
721
|
"params": [
|
|
715
722
|
{
|
|
716
723
|
"__schema": "ParameterSchema",
|
|
@@ -870,6 +877,8 @@
|
|
|
870
877
|
"character": 1
|
|
871
878
|
},
|
|
872
879
|
"name": "Hello",
|
|
880
|
+
"signature": "interface Hello",
|
|
881
|
+
"extendsNodes": [],
|
|
873
882
|
"members": [
|
|
874
883
|
{
|
|
875
884
|
"__schema": "VariableLikeSchema",
|
|
@@ -972,7 +981,7 @@
|
|
|
972
981
|
"line": 63,
|
|
973
982
|
"character": 28
|
|
974
983
|
},
|
|
975
|
-
"
|
|
984
|
+
"name": "keyof",
|
|
976
985
|
"type": {
|
|
977
986
|
"__schema": "TypeQuerySchema",
|
|
978
987
|
"location": {
|
|
@@ -1133,10 +1142,38 @@
|
|
|
1133
1142
|
"character": 1
|
|
1134
1143
|
},
|
|
1135
1144
|
"name": "Food",
|
|
1145
|
+
"signature": "enum Food",
|
|
1136
1146
|
"members": [
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1147
|
+
{
|
|
1148
|
+
"__schema": "EnumMemberSchema",
|
|
1149
|
+
"location": {
|
|
1150
|
+
"filePath": "index.ts",
|
|
1151
|
+
"line": 74,
|
|
1152
|
+
"character": 3
|
|
1153
|
+
},
|
|
1154
|
+
"name": "Falafel",
|
|
1155
|
+
"signature": "(enum member) Food.Falafel = 0"
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
"__schema": "EnumMemberSchema",
|
|
1159
|
+
"location": {
|
|
1160
|
+
"filePath": "index.ts",
|
|
1161
|
+
"line": 75,
|
|
1162
|
+
"character": 3
|
|
1163
|
+
},
|
|
1164
|
+
"name": "Hummus",
|
|
1165
|
+
"signature": "(enum member) Food.Hummus = 1"
|
|
1166
|
+
},
|
|
1167
|
+
{
|
|
1168
|
+
"__schema": "EnumMemberSchema",
|
|
1169
|
+
"location": {
|
|
1170
|
+
"filePath": "index.ts",
|
|
1171
|
+
"line": 76,
|
|
1172
|
+
"character": 3
|
|
1173
|
+
},
|
|
1174
|
+
"name": "Tahini",
|
|
1175
|
+
"signature": "(enum member) Food.Tahini = 2"
|
|
1176
|
+
}
|
|
1140
1177
|
]
|
|
1141
1178
|
},
|
|
1142
1179
|
{
|
|
@@ -1291,7 +1328,7 @@
|
|
|
1291
1328
|
"line": 90,
|
|
1292
1329
|
"character": 44
|
|
1293
1330
|
},
|
|
1294
|
-
"
|
|
1331
|
+
"name": "str",
|
|
1295
1332
|
"hasAssertsModifier": false,
|
|
1296
1333
|
"type": {
|
|
1297
1334
|
"__schema": "KeywordTypeSchema",
|
|
@@ -1363,7 +1400,7 @@
|
|
|
1363
1400
|
"line": 94,
|
|
1364
1401
|
"character": 70
|
|
1365
1402
|
},
|
|
1366
|
-
"
|
|
1403
|
+
"name": "condition",
|
|
1367
1404
|
"hasAssertsModifier": true
|
|
1368
1405
|
}
|
|
1369
1406
|
},
|
|
@@ -1521,6 +1558,8 @@
|
|
|
1521
1558
|
"character": 1
|
|
1522
1559
|
},
|
|
1523
1560
|
"name": "ComputedNameWithType",
|
|
1561
|
+
"signature": "interface ComputedNameWithType",
|
|
1562
|
+
"extendsNodes": [],
|
|
1524
1563
|
"members": [
|
|
1525
1564
|
{
|
|
1526
1565
|
"__schema": "VariableLikeSchema",
|
|
@@ -1552,6 +1591,8 @@
|
|
|
1552
1591
|
"character": 1
|
|
1553
1592
|
},
|
|
1554
1593
|
"name": "ComputedNameNoType",
|
|
1594
|
+
"signature": "interface ComputedNameNoType",
|
|
1595
|
+
"extendsNodes": [],
|
|
1555
1596
|
"members": [
|
|
1556
1597
|
{
|
|
1557
1598
|
"__schema": "VariableLikeSchema",
|
|
@@ -1642,6 +1683,8 @@
|
|
|
1642
1683
|
"character": 1
|
|
1643
1684
|
},
|
|
1644
1685
|
"name": "CallSignatureWithTypeParams",
|
|
1686
|
+
"signature": "interface CallSignatureWithTypeParams",
|
|
1687
|
+
"extendsNodes": [],
|
|
1645
1688
|
"members": [
|
|
1646
1689
|
{
|
|
1647
1690
|
"__schema": "FunctionLikeSchema",
|
|
@@ -1713,7 +1756,7 @@
|
|
|
1713
1756
|
"line": 127,
|
|
1714
1757
|
"character": 30
|
|
1715
1758
|
},
|
|
1716
|
-
"type": "
|
|
1759
|
+
"type": "T",
|
|
1717
1760
|
"name": "T"
|
|
1718
1761
|
},
|
|
1719
1762
|
"extendsType": {
|
|
@@ -1723,7 +1766,7 @@
|
|
|
1723
1766
|
"line": 127,
|
|
1724
1767
|
"character": 40
|
|
1725
1768
|
},
|
|
1726
|
-
"type": "
|
|
1769
|
+
"type": "U",
|
|
1727
1770
|
"name": "U"
|
|
1728
1771
|
},
|
|
1729
1772
|
"trueType": {
|
|
@@ -1733,7 +1776,7 @@
|
|
|
1733
1776
|
"line": 127,
|
|
1734
1777
|
"character": 44
|
|
1735
1778
|
},
|
|
1736
|
-
"type": "
|
|
1779
|
+
"type": "Y",
|
|
1737
1780
|
"name": "Y"
|
|
1738
1781
|
},
|
|
1739
1782
|
"falseType": {
|
|
@@ -1743,7 +1786,7 @@
|
|
|
1743
1786
|
"line": 127,
|
|
1744
1787
|
"character": 48
|
|
1745
1788
|
},
|
|
1746
|
-
"type": "
|
|
1789
|
+
"type": "N",
|
|
1747
1790
|
"name": "N"
|
|
1748
1791
|
}
|
|
1749
1792
|
},
|
|
@@ -1757,6 +1800,73 @@
|
|
|
1757
1800
|
"raw": "/**\n * Conditional Generic Type\n */",
|
|
1758
1801
|
"comment": "Conditional Generic Type"
|
|
1759
1802
|
}
|
|
1803
|
+
},
|
|
1804
|
+
{
|
|
1805
|
+
"__schema": "FunctionLikeSchema",
|
|
1806
|
+
"location": {
|
|
1807
|
+
"filePath": "index.ts",
|
|
1808
|
+
"line": 129,
|
|
1809
|
+
"character": 1
|
|
1810
|
+
},
|
|
1811
|
+
"name": "genericFunction",
|
|
1812
|
+
"signature": "function genericFunction<T>(a: T): <T>(a: T) => void",
|
|
1813
|
+
"modifiers": [
|
|
1814
|
+
"export"
|
|
1815
|
+
],
|
|
1816
|
+
"typeParams": [
|
|
1817
|
+
"T"
|
|
1818
|
+
],
|
|
1819
|
+
"params": [
|
|
1820
|
+
{
|
|
1821
|
+
"__schema": "ParameterSchema",
|
|
1822
|
+
"location": {
|
|
1823
|
+
"filePath": "index.ts",
|
|
1824
|
+
"line": 129,
|
|
1825
|
+
"character": 36
|
|
1826
|
+
},
|
|
1827
|
+
"name": "a",
|
|
1828
|
+
"isOptional": false,
|
|
1829
|
+
"type": {
|
|
1830
|
+
"__schema": "InferenceTypeSchema",
|
|
1831
|
+
"location": {
|
|
1832
|
+
"filePath": "index.ts",
|
|
1833
|
+
"line": 129,
|
|
1834
|
+
"character": 39
|
|
1835
|
+
},
|
|
1836
|
+
"type": "T",
|
|
1837
|
+
"name": "T"
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
],
|
|
1841
|
+
"returnType": {
|
|
1842
|
+
"__schema": "InferenceTypeSchema",
|
|
1843
|
+
"location": {
|
|
1844
|
+
"filePath": "index.ts",
|
|
1845
|
+
"line": 129,
|
|
1846
|
+
"character": 1
|
|
1847
|
+
},
|
|
1848
|
+
"type": "<T>(a: T) => void"
|
|
1849
|
+
}
|
|
1850
|
+
},
|
|
1851
|
+
{
|
|
1852
|
+
"__schema": "VariableLikeSchema",
|
|
1853
|
+
"location": {
|
|
1854
|
+
"filePath": "index.ts",
|
|
1855
|
+
"line": 133,
|
|
1856
|
+
"character": 14
|
|
1857
|
+
},
|
|
1858
|
+
"name": "gfnc2",
|
|
1859
|
+
"signature": "const gfnc2: <T>(a: T) => void",
|
|
1860
|
+
"isOptional": false,
|
|
1861
|
+
"type": {
|
|
1862
|
+
"__schema": "InferenceTypeSchema",
|
|
1863
|
+
"location": {
|
|
1864
|
+
"filePath": "index.ts",
|
|
1865
|
+
"line": 133,
|
|
1866
|
+
"character": 14
|
|
1867
|
+
},
|
|
1868
|
+
"type": "<T>(a: T) => void"
|
|
1869
|
+
}
|
|
1760
1870
|
}
|
|
1761
1871
|
]
|
|
1762
1872
|
},
|
|
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.895",
|
|
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.895"
|
|
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.47",
|
|
21
|
+
"@teambit/component": "0.0.895",
|
|
22
|
+
"@teambit/formatter": "0.0.446",
|
|
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.895",
|
|
26
|
+
"@teambit/defender.prettier.config-mutator": "0.0.90",
|
|
27
|
+
"@teambit/envs": "0.0.895",
|
|
28
|
+
"@teambit/graphql": "0.0.895",
|
|
29
|
+
"@teambit/workspace": "0.0.895"
|
|
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.895/dist/schema.composition.js';
|
|
2
|
+
import * as compositions_1 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_schema@0.0.895/dist/mock/button/button.composition.js';
|
|
3
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.semantics_schema@0.0.895/dist/schema.docs.mdx';
|
|
4
4
|
|
|
5
5
|
export const compositions = [compositions_0, compositions_1];
|
|
6
6
|
export const overview = [overview_0];
|
|
Binary file
|