@teambit/semantics.entities.semantic-schema 0.0.65 → 0.0.67
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/preview-1708259356169.js +7 -0
- package/dist/schemas/array-literal-expression.d.ts +12 -0
- package/dist/schemas/array-literal-expression.js +24 -0
- package/dist/schemas/array-literal-expression.js.map +1 -0
- package/dist/schemas/class.d.ts +3 -1
- package/dist/schemas/class.js +10 -6
- package/dist/schemas/class.js.map +1 -1
- package/dist/schemas/decorator.d.ts +32 -0
- package/dist/schemas/decorator.js +37 -0
- package/dist/schemas/decorator.js.map +1 -0
- package/dist/schemas/function-like.d.ts +4 -2
- package/dist/schemas/function-like.js +14 -10
- package/dist/schemas/function-like.js.map +1 -1
- package/dist/schemas/index.d.ts +5 -0
- package/dist/schemas/index.js +11 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/literal-value.d.ts +11 -0
- package/dist/schemas/literal-value.js +25 -0
- package/dist/schemas/literal-value.js.map +1 -0
- package/dist/schemas/object-literal-expression.d.ts +13 -0
- package/dist/schemas/object-literal-expression.js +28 -0
- package/dist/schemas/object-literal-expression.js.map +1 -0
- package/dist/schemas/property-assignment.d.ts +32 -0
- package/dist/schemas/property-assignment.js +31 -0
- package/dist/schemas/property-assignment.js.map +1 -0
- package/package.json +9 -7
- package/schemas/array-literal-expression.ts +25 -0
- package/schemas/class.ts +17 -3
- package/schemas/decorator.ts +41 -0
- package/schemas/function-like.ts +17 -7
- package/schemas/index.ts +5 -0
- package/schemas/literal-value.ts +25 -0
- package/schemas/object-literal-expression.ts +30 -0
- package/schemas/property-assignment.ts +36 -0
- package/tsconfig.json +32 -0
- package/types/asset.d.ts +29 -0
- package/types/style.d.ts +42 -0
- package/.bit-capsule-ready +0 -0
- package/package-tar/teambit-semantics.entities.semantic-schema-0.0.65.tgz +0 -0
- package/schema.json +0 -102109
- package/teambit_semantics_entities_semantic_schema-preview.js +0 -1
package/schemas/class.ts
CHANGED
|
@@ -16,7 +16,8 @@ export class ClassSchema extends SchemaNode {
|
|
|
16
16
|
doc?: DocSchema,
|
|
17
17
|
readonly typeParams?: string[],
|
|
18
18
|
readonly extendsNodes?: ExpressionWithTypeArgumentsSchema[],
|
|
19
|
-
readonly implementNodes?: ExpressionWithTypeArgumentsSchema[]
|
|
19
|
+
readonly implementNodes?: ExpressionWithTypeArgumentsSchema[],
|
|
20
|
+
readonly decorators?: SchemaNode[]
|
|
20
21
|
) {
|
|
21
22
|
super();
|
|
22
23
|
this.members = members;
|
|
@@ -29,7 +30,8 @@ export class ClassSchema extends SchemaNode {
|
|
|
29
30
|
|
|
30
31
|
toString() {
|
|
31
32
|
const membersStr = this.members.map((m) => `* ${m.toString()}`).join('\n');
|
|
32
|
-
|
|
33
|
+
const decoratorsStr = this.decorators?.map((decorator) => decorator.toString()).join('\n');
|
|
34
|
+
return `${this.decorators ? `${decoratorsStr}\n` : ''}${chalk.bold.underline(this.name)}\n${membersStr}`;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
toObject() {
|
|
@@ -42,6 +44,7 @@ export class ClassSchema extends SchemaNode {
|
|
|
42
44
|
typeParams: this.typeParams,
|
|
43
45
|
extendsNodes: this.extendsNodes?.map((node) => node.toObject()),
|
|
44
46
|
implementNodes: this.implementNodes?.map((node) => node.toObject()),
|
|
47
|
+
decorators: this.decorators?.map((decorator) => decorator.toObject()),
|
|
45
48
|
};
|
|
46
49
|
}
|
|
47
50
|
|
|
@@ -54,6 +57,17 @@ export class ClassSchema extends SchemaNode {
|
|
|
54
57
|
const typeParams = obj.typeParams;
|
|
55
58
|
const extendsNodes = obj.extendsNodes?.map((node: any) => ExpressionWithTypeArgumentsSchema.fromObject(node));
|
|
56
59
|
const implementNodes = obj.implementNodes?.map((node: any) => ExpressionWithTypeArgumentsSchema.fromObject(node));
|
|
57
|
-
|
|
60
|
+
const decorators = obj.decorators?.map((decorator: any) => SchemaRegistry.fromObject(decorator));
|
|
61
|
+
return new ClassSchema(
|
|
62
|
+
name,
|
|
63
|
+
members,
|
|
64
|
+
location,
|
|
65
|
+
signature,
|
|
66
|
+
doc,
|
|
67
|
+
typeParams,
|
|
68
|
+
extendsNodes,
|
|
69
|
+
implementNodes,
|
|
70
|
+
decorators
|
|
71
|
+
);
|
|
58
72
|
}
|
|
59
73
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SchemaLocation, SchemaNode } from '../schema-node';
|
|
2
|
+
import { SchemaRegistry } from '../schema-registry';
|
|
3
|
+
import { DocSchema } from './docs';
|
|
4
|
+
|
|
5
|
+
export class DecoratorSchema extends SchemaNode {
|
|
6
|
+
constructor(
|
|
7
|
+
readonly location: SchemaLocation,
|
|
8
|
+
readonly name: string,
|
|
9
|
+
readonly doc?: DocSchema,
|
|
10
|
+
readonly args?: SchemaNode[]
|
|
11
|
+
) {
|
|
12
|
+
super();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getNodes() {
|
|
16
|
+
return this.args || [];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
toString() {
|
|
20
|
+
// name and args
|
|
21
|
+
const argsStr = this.args?.map((arg) => arg.toString()).join(', ');
|
|
22
|
+
return `@${this.name}${argsStr ? `(${argsStr})` : ''}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
toObject() {
|
|
26
|
+
return {
|
|
27
|
+
...super.toObject(),
|
|
28
|
+
name: this.name,
|
|
29
|
+
doc: this.doc?.toObject(),
|
|
30
|
+
args: this.args?.map((arg) => arg.toObject()),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static fromObject(obj: Record<string, any>): DecoratorSchema {
|
|
35
|
+
const location = obj.location;
|
|
36
|
+
const name = obj.name;
|
|
37
|
+
const doc = obj.doc ? DocSchema.fromObject(obj.doc) : undefined;
|
|
38
|
+
const args = obj.args ? obj.args.map((arg) => SchemaRegistry.fromObject(arg)) : undefined;
|
|
39
|
+
return new DecoratorSchema(location, name, doc, args);
|
|
40
|
+
}
|
|
41
|
+
}
|
package/schemas/function-like.ts
CHANGED
|
@@ -33,7 +33,8 @@ export class FunctionLikeSchema extends SchemaNode {
|
|
|
33
33
|
signature: string,
|
|
34
34
|
readonly modifiers: Modifier[] = [],
|
|
35
35
|
doc?: DocSchema,
|
|
36
|
-
readonly typeParams?: string[]
|
|
36
|
+
readonly typeParams?: string[],
|
|
37
|
+
readonly decorators?: SchemaNode[]
|
|
37
38
|
) {
|
|
38
39
|
super();
|
|
39
40
|
this.params = params;
|
|
@@ -43,13 +44,14 @@ export class FunctionLikeSchema extends SchemaNode {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
getNodes() {
|
|
46
|
-
return [...this.params, this.returnType];
|
|
47
|
+
return [...this.params, this.returnType, ...(this.decorators || [])];
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
toString() {
|
|
50
51
|
const paramsStr = this.params.map((param) => param.toString()).join(', ');
|
|
51
52
|
const typeParamsStr = this.typeParams ? `<${this.typeParams.join(', ')}>` : '';
|
|
52
|
-
|
|
53
|
+
const decoratorsStr = this.decorators?.map((decorator) => decorator.toString()).join('\n');
|
|
54
|
+
return `${this.decorators ? `${decoratorsStr}\n` : ''}${this.modifiersToString()}${typeParamsStr}${chalk.bold(
|
|
53
55
|
this.name
|
|
54
56
|
)}(${paramsStr}): ${this.returnType.toString()}`;
|
|
55
57
|
}
|
|
@@ -63,10 +65,15 @@ export class FunctionLikeSchema extends SchemaNode {
|
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
generateSignature(): string {
|
|
66
|
-
return FunctionLikeSchema.createSignature(this.name, this.params, this.returnType);
|
|
68
|
+
return FunctionLikeSchema.createSignature(this.name, this.params, this.returnType, this.decorators);
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
static createSignature(
|
|
71
|
+
static createSignature(
|
|
72
|
+
name: string,
|
|
73
|
+
params: ParameterSchema[],
|
|
74
|
+
returnType: SchemaNode,
|
|
75
|
+
decorators?: SchemaNode[]
|
|
76
|
+
): string {
|
|
70
77
|
const paramsStr = params
|
|
71
78
|
.map((param) => {
|
|
72
79
|
let type = param.type.toString();
|
|
@@ -74,7 +81,8 @@ export class FunctionLikeSchema extends SchemaNode {
|
|
|
74
81
|
return `${param.name}${param.isOptional ? '?' : ''}: ${type}`;
|
|
75
82
|
})
|
|
76
83
|
.join(', ');
|
|
77
|
-
|
|
84
|
+
const decoratorsStr = decorators?.map((decorator) => decorator.toString()).join('\n');
|
|
85
|
+
return `${decorators ? `${decoratorsStr}\n` : ''}${name}(${paramsStr}): ${returnType.toString()}`;
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
toObject() {
|
|
@@ -87,6 +95,7 @@ export class FunctionLikeSchema extends SchemaNode {
|
|
|
87
95
|
modifiers: this.modifiers,
|
|
88
96
|
doc: this.doc?.toObject(),
|
|
89
97
|
typeParams: this.typeParams,
|
|
98
|
+
decorators: this.decorators?.map((decorator) => decorator.toObject()),
|
|
90
99
|
};
|
|
91
100
|
}
|
|
92
101
|
|
|
@@ -99,7 +108,8 @@ export class FunctionLikeSchema extends SchemaNode {
|
|
|
99
108
|
obj.signature,
|
|
100
109
|
obj.modifiers,
|
|
101
110
|
obj.doc ? DocSchema.fromObject(obj.doc) : undefined,
|
|
102
|
-
obj.typeParams
|
|
111
|
+
obj.typeParams,
|
|
112
|
+
obj.decorators?.map((decorator) => SchemaRegistry.fromObject(decorator))
|
|
103
113
|
);
|
|
104
114
|
}
|
|
105
115
|
|
package/schemas/index.ts
CHANGED
|
@@ -39,4 +39,9 @@ export { ConditionalTypeSchema } from './conditional-type';
|
|
|
39
39
|
export { ExpressionWithTypeArgumentsSchema } from './expression-with-arguments';
|
|
40
40
|
export { NamedTupleSchema } from './named-tuple';
|
|
41
41
|
export { UnImplementedSchema } from './unimplemented-schema';
|
|
42
|
+
export { ObjectLiteralExpressionSchema } from './object-literal-expression';
|
|
43
|
+
export { ArrayLiteralExpressionSchema } from './array-literal-expression';
|
|
44
|
+
export { PropertyAssignmentSchema } from './property-assignment';
|
|
45
|
+
export { DecoratorSchema } from './decorator';
|
|
46
|
+
export { LiteralValueSchema } from './literal-value';
|
|
42
47
|
export * from './docs';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SchemaLocation, SchemaNode } from '../schema-node';
|
|
2
|
+
|
|
3
|
+
export class LiteralValueSchema extends SchemaNode {
|
|
4
|
+
constructor(readonly location: SchemaLocation, readonly value: string) {
|
|
5
|
+
super();
|
|
6
|
+
this.value = this.value.replace(/^['"]|['"]$/g, '');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
toString() {
|
|
10
|
+
return this.value;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
toObject() {
|
|
14
|
+
return {
|
|
15
|
+
...super.toObject(),
|
|
16
|
+
value: this.value,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static fromObject(obj: Record<string, any>): LiteralValueSchema {
|
|
21
|
+
const location = obj.location;
|
|
22
|
+
const value = obj.value;
|
|
23
|
+
return new LiteralValueSchema(location, value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SchemaLocation, SchemaNode } from '../schema-node';
|
|
2
|
+
import { SchemaRegistry } from '../schema-registry';
|
|
3
|
+
|
|
4
|
+
export class ObjectLiteralExpressionSchema extends SchemaNode {
|
|
5
|
+
constructor(readonly members: SchemaNode[], readonly location: SchemaLocation) {
|
|
6
|
+
super();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
getNodes() {
|
|
10
|
+
return this.members;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
toString(): string {
|
|
14
|
+
return `{\n${this.members.map((member) => `\t${member.toString()}`).join('\n')}\n}`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
toObject() {
|
|
18
|
+
return {
|
|
19
|
+
...super.toObject(),
|
|
20
|
+
members: this.members.map((element) => element.toObject()),
|
|
21
|
+
location: this.location,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static fromObject(obj: Record<string, any>): ObjectLiteralExpressionSchema {
|
|
26
|
+
const members = obj.members.map((member) => SchemaRegistry.fromObject(member));
|
|
27
|
+
const location = obj.location;
|
|
28
|
+
return new ObjectLiteralExpressionSchema(members, location);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SchemaNode, SchemaLocation } from '../schema-node';
|
|
2
|
+
import { SchemaRegistry } from '../schema-registry';
|
|
3
|
+
import { DocSchema } from './docs';
|
|
4
|
+
|
|
5
|
+
export class PropertyAssignmentSchema extends SchemaNode {
|
|
6
|
+
constructor(
|
|
7
|
+
readonly name: string,
|
|
8
|
+
readonly value: SchemaNode,
|
|
9
|
+
readonly location: SchemaLocation,
|
|
10
|
+
readonly doc?: DocSchema
|
|
11
|
+
) {
|
|
12
|
+
super();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
toString() {
|
|
16
|
+
return `${this.name}: ${this.value.toString()}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
toObject() {
|
|
20
|
+
return {
|
|
21
|
+
...super.toObject(),
|
|
22
|
+
name: this.name,
|
|
23
|
+
value: this.value.toObject(),
|
|
24
|
+
doc: this.doc?.toObject(),
|
|
25
|
+
location: this.location,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static fromObject(obj: Record<string, any>): PropertyAssignmentSchema {
|
|
30
|
+
const name = obj.name;
|
|
31
|
+
const value = SchemaRegistry.fromObject(obj.value);
|
|
32
|
+
const location = obj.location;
|
|
33
|
+
const doc = obj.doc ? DocSchema.fromObject(obj.doc) : undefined;
|
|
34
|
+
return new PropertyAssignmentSchema(name, value, location, doc);
|
|
35
|
+
}
|
|
36
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": [
|
|
4
|
+
"es2019",
|
|
5
|
+
"DOM",
|
|
6
|
+
"ES6",
|
|
7
|
+
"DOM.Iterable"
|
|
8
|
+
],
|
|
9
|
+
"target": "es2015",
|
|
10
|
+
"module": "CommonJS",
|
|
11
|
+
"jsx": "react",
|
|
12
|
+
"allowJs": true,
|
|
13
|
+
"composite": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"experimentalDecorators": true,
|
|
18
|
+
"outDir": "dist",
|
|
19
|
+
"moduleResolution": "node",
|
|
20
|
+
"esModuleInterop": true,
|
|
21
|
+
"rootDir": ".",
|
|
22
|
+
"resolveJsonModule": true
|
|
23
|
+
},
|
|
24
|
+
"exclude": [
|
|
25
|
+
"dist",
|
|
26
|
+
"package.json"
|
|
27
|
+
],
|
|
28
|
+
"include": [
|
|
29
|
+
"**/*",
|
|
30
|
+
"**/*.json"
|
|
31
|
+
]
|
|
32
|
+
}
|
package/types/asset.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare module '*.png' {
|
|
2
|
+
const value: any;
|
|
3
|
+
export = value;
|
|
4
|
+
}
|
|
5
|
+
declare module '*.svg' {
|
|
6
|
+
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
|
+
|
|
8
|
+
export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
|
|
9
|
+
const src: string;
|
|
10
|
+
export default src;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// @TODO Gilad
|
|
14
|
+
declare module '*.jpg' {
|
|
15
|
+
const value: any;
|
|
16
|
+
export = value;
|
|
17
|
+
}
|
|
18
|
+
declare module '*.jpeg' {
|
|
19
|
+
const value: any;
|
|
20
|
+
export = value;
|
|
21
|
+
}
|
|
22
|
+
declare module '*.gif' {
|
|
23
|
+
const value: any;
|
|
24
|
+
export = value;
|
|
25
|
+
}
|
|
26
|
+
declare module '*.bmp' {
|
|
27
|
+
const value: any;
|
|
28
|
+
export = value;
|
|
29
|
+
}
|
package/types/style.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
declare module '*.module.css' {
|
|
2
|
+
const classes: { readonly [key: string]: string };
|
|
3
|
+
export default classes;
|
|
4
|
+
}
|
|
5
|
+
declare module '*.module.scss' {
|
|
6
|
+
const classes: { readonly [key: string]: string };
|
|
7
|
+
export default classes;
|
|
8
|
+
}
|
|
9
|
+
declare module '*.module.sass' {
|
|
10
|
+
const classes: { readonly [key: string]: string };
|
|
11
|
+
export default classes;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare module '*.module.less' {
|
|
15
|
+
const classes: { readonly [key: string]: string };
|
|
16
|
+
export default classes;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module '*.less' {
|
|
20
|
+
const classes: { readonly [key: string]: string };
|
|
21
|
+
export default classes;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare module '*.css' {
|
|
25
|
+
const classes: { readonly [key: string]: string };
|
|
26
|
+
export default classes;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module '*.sass' {
|
|
30
|
+
const classes: { readonly [key: string]: string };
|
|
31
|
+
export default classes;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare module '*.scss' {
|
|
35
|
+
const classes: { readonly [key: string]: string };
|
|
36
|
+
export default classes;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module '*.mdx' {
|
|
40
|
+
const component: any;
|
|
41
|
+
export default component;
|
|
42
|
+
}
|
package/.bit-capsule-ready
DELETED
|
File without changes
|
|
Binary file
|