@teambit/typescript 0.0.741 → 0.0.744

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.
Files changed (64) hide show
  1. package/dist/transformers/class-deceleration.js +10 -40
  2. package/dist/transformers/class-deceleration.js.map +1 -1
  3. package/dist/transformers/index.d.ts +0 -6
  4. package/dist/transformers/index.js +0 -96
  5. package/dist/transformers/index.js.map +1 -1
  6. package/dist/transformers/interface-declaration.js +13 -6
  7. package/dist/transformers/interface-declaration.js.map +1 -1
  8. package/dist/transformers/utils/class-element-to-schema.d.ts +4 -0
  9. package/dist/transformers/utils/class-element-to-schema.js +122 -0
  10. package/dist/transformers/utils/class-element-to-schema.js.map +1 -0
  11. package/dist/transformers/utils/jsdoc-to-doc-schema.d.ts +4 -0
  12. package/dist/transformers/utils/jsdoc-to-doc-schema.js +163 -0
  13. package/dist/transformers/utils/jsdoc-to-doc-schema.js.map +1 -0
  14. package/dist/transformers/utils/to-function-schema.d.ts +1 -1
  15. package/dist/transformers/utils/to-function-schema.js +17 -7
  16. package/dist/transformers/utils/to-function-schema.js.map +1 -1
  17. package/dist/transformers/utils/type-element-to-schema.d.ts +7 -0
  18. package/dist/transformers/utils/type-element-to-schema.js +134 -0
  19. package/dist/transformers/utils/type-element-to-schema.js.map +1 -0
  20. package/dist/transformers/utils/type-node-to-schema.js +32 -7
  21. package/dist/transformers/utils/type-node-to-schema.js.map +1 -1
  22. package/dist/transformers/variable-declaration.js +15 -1
  23. package/dist/transformers/variable-declaration.js.map +1 -1
  24. package/dist/typescript.extractor.js +1 -1
  25. package/dist/typescript.extractor.js.map +1 -1
  26. package/dist/typescript.main.runtime.js +1 -1
  27. package/dist/typescript.main.runtime.js.map +1 -1
  28. package/package-tar/teambit-typescript-0.0.744.tgz +0 -0
  29. package/package.json +17 -17
  30. package/{preview-1653494536947.js → preview-1653827208409.js} +2 -2
  31. package/transformers/class-deceleration.ts +7 -26
  32. package/transformers/index.ts +0 -6
  33. package/transformers/interface-declaration.ts +4 -6
  34. package/transformers/utils/class-element-to-schema.ts +61 -0
  35. package/transformers/utils/jsdoc-to-doc-schema.ts +81 -0
  36. package/transformers/utils/to-function-schema.ts +12 -8
  37. package/transformers/utils/type-element-to-schema.ts +72 -0
  38. package/transformers/utils/type-node-to-schema.ts +15 -6
  39. package/transformers/variable-declaration.ts +5 -2
  40. package/dist/transformers/constructor.d.ts +0 -10
  41. package/dist/transformers/constructor.js +0 -70
  42. package/dist/transformers/constructor.js.map +0 -1
  43. package/dist/transformers/index-signature.d.ts +0 -9
  44. package/dist/transformers/index-signature.js +0 -71
  45. package/dist/transformers/index-signature.js.map +0 -1
  46. package/dist/transformers/method-declaration.d.ts +0 -11
  47. package/dist/transformers/method-declaration.js +0 -65
  48. package/dist/transformers/method-declaration.js.map +0 -1
  49. package/dist/transformers/method-signature.d.ts +0 -10
  50. package/dist/transformers/method-signature.js +0 -53
  51. package/dist/transformers/method-signature.js.map +0 -1
  52. package/dist/transformers/property-declaration.d.ts +0 -11
  53. package/dist/transformers/property-declaration.js +0 -80
  54. package/dist/transformers/property-declaration.js.map +0 -1
  55. package/dist/transformers/property-signature.d.ts +0 -10
  56. package/dist/transformers/property-signature.js +0 -72
  57. package/dist/transformers/property-signature.js.map +0 -1
  58. package/package-tar/teambit-typescript-0.0.741.tgz +0 -0
  59. package/transformers/constructor.ts +0 -22
  60. package/transformers/index-signature.ts +0 -22
  61. package/transformers/method-declaration.ts +0 -24
  62. package/transformers/method-signature.ts +0 -23
  63. package/transformers/property-declaration.ts +0 -30
  64. package/transformers/property-signature.ts +0 -28
@@ -1,70 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- require("core-js/modules/es.promise.js");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.Constructor = void 0;
11
-
12
- function _semanticsEntities() {
13
- const data = require("@teambit/semantics.entities.semantic-schema");
14
-
15
- _semanticsEntities = function () {
16
- return data;
17
- };
18
-
19
- return data;
20
- }
21
-
22
- function _typescript() {
23
- const data = _interopRequireDefault(require("typescript"));
24
-
25
- _typescript = function () {
26
- return data;
27
- };
28
-
29
- return data;
30
- }
31
-
32
- function _exportIdentifier() {
33
- const data = require("../export-identifier");
34
-
35
- _exportIdentifier = function () {
36
- return data;
37
- };
38
-
39
- return data;
40
- }
41
-
42
- function _getParams() {
43
- const data = require("./utils/get-params");
44
-
45
- _getParams = function () {
46
- return data;
47
- };
48
-
49
- return data;
50
- }
51
-
52
- class Constructor {
53
- predicate(node) {
54
- return node.kind === _typescript().default.SyntaxKind.Constructor;
55
- }
56
-
57
- async getIdentifiers(node) {
58
- return [new (_exportIdentifier().ExportIdentifier)('constructor', node.getSourceFile().fileName)];
59
- }
60
-
61
- async transform(constructorDec, context) {
62
- const args = await (0, _getParams().getParams)(constructorDec.parameters, context);
63
- return new (_semanticsEntities().ConstructorSchema)(context.getLocation(constructorDec), args);
64
- }
65
-
66
- }
67
-
68
- exports.Constructor = Constructor;
69
-
70
- //# sourceMappingURL=constructor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["Constructor","predicate","node","kind","ts","SyntaxKind","getIdentifiers","ExportIdentifier","getSourceFile","fileName","transform","constructorDec","context","args","getParams","parameters","ConstructorSchema","getLocation"],"sources":["constructor.ts"],"sourcesContent":["import { SchemaNode, ConstructorSchema } from '@teambit/semantics.entities.semantic-schema';\nimport ts, { Node, ConstructorDeclaration } from 'typescript';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { ExportIdentifier } from '../export-identifier';\nimport { getParams } from './utils/get-params';\n\nexport class Constructor implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.Constructor;\n }\n\n async getIdentifiers(node: ConstructorDeclaration) {\n return [new ExportIdentifier('constructor', node.getSourceFile().fileName)];\n }\n\n async transform(constructorDec: ConstructorDeclaration, context: SchemaExtractorContext): Promise<SchemaNode> {\n const args = await getParams(constructorDec.parameters, context);\n\n return new ConstructorSchema(context.getLocation(constructorDec), args);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,WAAN,CAA+C;EACpDC,SAAS,CAACC,IAAD,EAAa;IACpB,OAAOA,IAAI,CAACC,IAAL,KAAcC,qBAAA,CAAGC,UAAH,CAAcL,WAAnC;EACD;;EAEmB,MAAdM,cAAc,CAACJ,IAAD,EAA+B;IACjD,OAAO,CAAC,KAAIK,oCAAJ,EAAqB,aAArB,EAAoCL,IAAI,CAACM,aAAL,GAAqBC,QAAzD,CAAD,CAAP;EACD;;EAEc,MAATC,SAAS,CAACC,cAAD,EAAyCC,OAAzC,EAA+F;IAC5G,MAAMC,IAAI,GAAG,MAAM,IAAAC,sBAAA,EAAUH,cAAc,CAACI,UAAzB,EAAqCH,OAArC,CAAnB;IAEA,OAAO,KAAII,sCAAJ,EAAsBJ,OAAO,CAACK,WAAR,CAAoBN,cAApB,CAAtB,EAA2DE,IAA3D,CAAP;EACD;;AAbmD"}
@@ -1,9 +0,0 @@
1
- import { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
2
- import { Node, IndexSignatureDeclaration } from 'typescript';
3
- import { SchemaTransformer } from '../schema-transformer';
4
- import { SchemaExtractorContext } from '../schema-extractor-context';
5
- export declare class IndexSignature implements SchemaTransformer {
6
- predicate(node: Node): boolean;
7
- getIdentifiers(): Promise<never[]>;
8
- transform(indexSig: IndexSignatureDeclaration, context: SchemaExtractorContext): Promise<SchemaNode>;
9
- }
@@ -1,71 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- require("core-js/modules/es.promise.js");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.IndexSignature = void 0;
11
-
12
- function _semanticsEntities() {
13
- const data = require("@teambit/semantics.entities.semantic-schema");
14
-
15
- _semanticsEntities = function () {
16
- return data;
17
- };
18
-
19
- return data;
20
- }
21
-
22
- function _typescript() {
23
- const data = _interopRequireDefault(require("typescript"));
24
-
25
- _typescript = function () {
26
- return data;
27
- };
28
-
29
- return data;
30
- }
31
-
32
- function _getParams() {
33
- const data = require("./utils/get-params");
34
-
35
- _getParams = function () {
36
- return data;
37
- };
38
-
39
- return data;
40
- }
41
-
42
- function _typeNodeToSchema() {
43
- const data = require("./utils/type-node-to-schema");
44
-
45
- _typeNodeToSchema = function () {
46
- return data;
47
- };
48
-
49
- return data;
50
- }
51
-
52
- class IndexSignature {
53
- predicate(node) {
54
- return node.kind === _typescript().default.SyntaxKind.IndexSignature;
55
- }
56
-
57
- async getIdentifiers() {
58
- return [];
59
- }
60
-
61
- async transform(indexSig, context) {
62
- const params = await (0, _getParams().getParams)(indexSig.parameters, context);
63
- const type = await (0, _typeNodeToSchema().typeNodeToSchema)(indexSig.type, context);
64
- return new (_semanticsEntities().IndexSignatureSchema)(context.getLocation(indexSig), params, type);
65
- }
66
-
67
- }
68
-
69
- exports.IndexSignature = IndexSignature;
70
-
71
- //# sourceMappingURL=index-signature.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["IndexSignature","predicate","node","kind","ts","SyntaxKind","getIdentifiers","transform","indexSig","context","params","getParams","parameters","type","typeNodeToSchema","IndexSignatureSchema","getLocation"],"sources":["index-signature.ts"],"sourcesContent":["import { SchemaNode, IndexSignatureSchema } from '@teambit/semantics.entities.semantic-schema';\nimport ts, { Node, IndexSignatureDeclaration } from 'typescript';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { getParams } from './utils/get-params';\nimport { typeNodeToSchema } from './utils/type-node-to-schema';\n\nexport class IndexSignature implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.IndexSignature;\n }\n\n async getIdentifiers() {\n return [];\n }\n\n async transform(indexSig: IndexSignatureDeclaration, context: SchemaExtractorContext): Promise<SchemaNode> {\n const params = await getParams(indexSig.parameters, context);\n const type = await typeNodeToSchema(indexSig.type, context);\n return new IndexSignatureSchema(context.getLocation(indexSig), params, type);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,cAAN,CAAkD;EACvDC,SAAS,CAACC,IAAD,EAAa;IACpB,OAAOA,IAAI,CAACC,IAAL,KAAcC,qBAAA,CAAGC,UAAH,CAAcL,cAAnC;EACD;;EAEmB,MAAdM,cAAc,GAAG;IACrB,OAAO,EAAP;EACD;;EAEc,MAATC,SAAS,CAACC,QAAD,EAAsCC,OAAtC,EAA4F;IACzG,MAAMC,MAAM,GAAG,MAAM,IAAAC,sBAAA,EAAUH,QAAQ,CAACI,UAAnB,EAA+BH,OAA/B,CAArB;IACA,MAAMI,IAAI,GAAG,MAAM,IAAAC,oCAAA,EAAiBN,QAAQ,CAACK,IAA1B,EAAgCJ,OAAhC,CAAnB;IACA,OAAO,KAAIM,yCAAJ,EAAyBN,OAAO,CAACO,WAAR,CAAoBR,QAApB,CAAzB,EAAwDE,MAAxD,EAAgEG,IAAhE,CAAP;EACD;;AAbsD"}
@@ -1,11 +0,0 @@
1
- import { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
2
- import { Node, MethodDeclaration as MethodDeclarationNode } from 'typescript';
3
- import { SchemaExtractorContext } from '../schema-extractor-context';
4
- import { SchemaTransformer } from '../schema-transformer';
5
- import { ExportIdentifier } from '../export-identifier';
6
- export declare class MethodDeclaration implements SchemaTransformer {
7
- predicate(node: Node): boolean;
8
- getIdentifiers(funcDec: MethodDeclarationNode): Promise<ExportIdentifier[]>;
9
- private getName;
10
- transform(methodDec: MethodDeclarationNode, context: SchemaExtractorContext): Promise<SchemaNode>;
11
- }
@@ -1,65 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- require("core-js/modules/es.promise.js");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.MethodDeclaration = void 0;
11
-
12
- function _typescript() {
13
- const data = _interopRequireDefault(require("typescript"));
14
-
15
- _typescript = function () {
16
- return data;
17
- };
18
-
19
- return data;
20
- }
21
-
22
- function _exportIdentifier() {
23
- const data = require("../export-identifier");
24
-
25
- _exportIdentifier = function () {
26
- return data;
27
- };
28
-
29
- return data;
30
- }
31
-
32
- function _toFunctionSchema() {
33
- const data = require("./utils/to-function-schema");
34
-
35
- _toFunctionSchema = function () {
36
- return data;
37
- };
38
-
39
- return data;
40
- }
41
-
42
- class MethodDeclaration {
43
- predicate(node) {
44
- return node.kind === _typescript().default.SyntaxKind.MethodDeclaration;
45
- }
46
-
47
- async getIdentifiers(funcDec) {
48
- return [new (_exportIdentifier().ExportIdentifier)(this.getName(funcDec), funcDec.getSourceFile().fileName)];
49
- }
50
-
51
- getName(funcDec) {
52
- var _funcDec$name;
53
-
54
- return ((_funcDec$name = funcDec.name) === null || _funcDec$name === void 0 ? void 0 : _funcDec$name.getText()) || '';
55
- }
56
-
57
- async transform(methodDec, context) {
58
- return (0, _toFunctionSchema().toFunctionLikeSchema)(methodDec, context);
59
- }
60
-
61
- }
62
-
63
- exports.MethodDeclaration = MethodDeclaration;
64
-
65
- //# sourceMappingURL=method-declaration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["MethodDeclaration","predicate","node","kind","ts","SyntaxKind","getIdentifiers","funcDec","ExportIdentifier","getName","getSourceFile","fileName","name","getText","transform","methodDec","context","toFunctionLikeSchema"],"sources":["method-declaration.ts"],"sourcesContent":["import { SchemaNode } from '@teambit/semantics.entities.semantic-schema';\nimport ts, { Node, MethodDeclaration as MethodDeclarationNode } from 'typescript';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { ExportIdentifier } from '../export-identifier';\nimport { toFunctionLikeSchema } from './utils/to-function-schema';\n\nexport class MethodDeclaration implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.MethodDeclaration;\n }\n\n async getIdentifiers(funcDec: MethodDeclarationNode) {\n return [new ExportIdentifier(this.getName(funcDec), funcDec.getSourceFile().fileName)];\n }\n\n private getName(funcDec: MethodDeclarationNode) {\n return funcDec.name?.getText() || '';\n }\n\n async transform(methodDec: MethodDeclarationNode, context: SchemaExtractorContext): Promise<SchemaNode> {\n return toFunctionLikeSchema(methodDec, context);\n }\n}\n"],"mappings":";;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,iBAAN,CAAqD;EAC1DC,SAAS,CAACC,IAAD,EAAa;IACpB,OAAOA,IAAI,CAACC,IAAL,KAAcC,qBAAA,CAAGC,UAAH,CAAcL,iBAAnC;EACD;;EAEmB,MAAdM,cAAc,CAACC,OAAD,EAAiC;IACnD,OAAO,CAAC,KAAIC,oCAAJ,EAAqB,KAAKC,OAAL,CAAaF,OAAb,CAArB,EAA4CA,OAAO,CAACG,aAAR,GAAwBC,QAApE,CAAD,CAAP;EACD;;EAEOF,OAAO,CAACF,OAAD,EAAiC;IAAA;;IAC9C,OAAO,kBAAAA,OAAO,CAACK,IAAR,gEAAcC,OAAd,OAA2B,EAAlC;EACD;;EAEc,MAATC,SAAS,CAACC,SAAD,EAAmCC,OAAnC,EAAyF;IACtG,OAAO,IAAAC,wCAAA,EAAqBF,SAArB,EAAgCC,OAAhC,CAAP;EACD;;AAfyD"}
@@ -1,10 +0,0 @@
1
- import { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
2
- import { Node, MethodSignature as MethodSignatureNode } from 'typescript';
3
- import { SchemaTransformer } from '../schema-transformer';
4
- import { SchemaExtractorContext } from '../schema-extractor-context';
5
- export declare class MethodSignatureTransformer implements SchemaTransformer {
6
- predicate(node: Node): boolean;
7
- getName(node: MethodSignatureNode): string;
8
- getIdentifiers(): Promise<never[]>;
9
- transform(methodSig: MethodSignatureNode, context: SchemaExtractorContext): Promise<SchemaNode>;
10
- }
@@ -1,53 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- require("core-js/modules/es.promise.js");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.MethodSignatureTransformer = void 0;
11
-
12
- function _typescript() {
13
- const data = _interopRequireDefault(require("typescript"));
14
-
15
- _typescript = function () {
16
- return data;
17
- };
18
-
19
- return data;
20
- }
21
-
22
- function _toFunctionSchema() {
23
- const data = require("./utils/to-function-schema");
24
-
25
- _toFunctionSchema = function () {
26
- return data;
27
- };
28
-
29
- return data;
30
- }
31
-
32
- class MethodSignatureTransformer {
33
- predicate(node) {
34
- return node.kind === _typescript().default.SyntaxKind.MethodSignature;
35
- }
36
-
37
- getName(node) {
38
- return node.name.getText();
39
- }
40
-
41
- async getIdentifiers() {
42
- return [];
43
- }
44
-
45
- async transform(methodSig, context) {
46
- return (0, _toFunctionSchema().toFunctionLikeSchema)(methodSig, context);
47
- }
48
-
49
- }
50
-
51
- exports.MethodSignatureTransformer = MethodSignatureTransformer;
52
-
53
- //# sourceMappingURL=method-signature.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["MethodSignatureTransformer","predicate","node","kind","ts","SyntaxKind","MethodSignature","getName","name","getText","getIdentifiers","transform","methodSig","context","toFunctionLikeSchema"],"sources":["method-signature.ts"],"sourcesContent":["import { SchemaNode } from '@teambit/semantics.entities.semantic-schema';\nimport ts, { Node, MethodSignature as MethodSignatureNode } from 'typescript';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { toFunctionLikeSchema } from './utils/to-function-schema';\n\nexport class MethodSignatureTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.MethodSignature;\n }\n\n getName(node: MethodSignatureNode) {\n return node.name.getText();\n }\n\n async getIdentifiers() {\n return [];\n }\n\n async transform(methodSig: MethodSignatureNode, context: SchemaExtractorContext): Promise<SchemaNode> {\n return toFunctionLikeSchema(methodSig, context);\n }\n}\n"],"mappings":";;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,0BAAN,CAA8D;EACnEC,SAAS,CAACC,IAAD,EAAa;IACpB,OAAOA,IAAI,CAACC,IAAL,KAAcC,qBAAA,CAAGC,UAAH,CAAcC,eAAnC;EACD;;EAEDC,OAAO,CAACL,IAAD,EAA4B;IACjC,OAAOA,IAAI,CAACM,IAAL,CAAUC,OAAV,EAAP;EACD;;EAEmB,MAAdC,cAAc,GAAG;IACrB,OAAO,EAAP;EACD;;EAEc,MAATC,SAAS,CAACC,SAAD,EAAiCC,OAAjC,EAAuF;IACpG,OAAO,IAAAC,wCAAA,EAAqBF,SAArB,EAAgCC,OAAhC,CAAP;EACD;;AAfkE"}
@@ -1,11 +0,0 @@
1
- import { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
2
- import { Node, PropertyDeclaration as PropertyDeclarationNode } from 'typescript';
3
- import { SchemaTransformer } from '../schema-transformer';
4
- import { SchemaExtractorContext } from '../schema-extractor-context';
5
- import { ExportIdentifier } from '../export-identifier';
6
- export declare class PropertyDeclaration implements SchemaTransformer {
7
- predicate(node: Node): boolean;
8
- getName(node: PropertyDeclarationNode): string;
9
- getIdentifiers(node: PropertyDeclarationNode): Promise<ExportIdentifier[]>;
10
- transform(propertyDec: PropertyDeclarationNode, context: SchemaExtractorContext): Promise<SchemaNode>;
11
- }
@@ -1,80 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- require("core-js/modules/es.promise.js");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.PropertyDeclaration = void 0;
11
-
12
- function _semanticsEntities() {
13
- const data = require("@teambit/semantics.entities.semantic-schema");
14
-
15
- _semanticsEntities = function () {
16
- return data;
17
- };
18
-
19
- return data;
20
- }
21
-
22
- function _typescript() {
23
- const data = _interopRequireDefault(require("typescript"));
24
-
25
- _typescript = function () {
26
- return data;
27
- };
28
-
29
- return data;
30
- }
31
-
32
- function _exportIdentifier() {
33
- const data = require("../export-identifier");
34
-
35
- _exportIdentifier = function () {
36
- return data;
37
- };
38
-
39
- return data;
40
- }
41
-
42
- function _parseTypeFromQuickInfo() {
43
- const data = require("./utils/parse-type-from-quick-info");
44
-
45
- _parseTypeFromQuickInfo = function () {
46
- return data;
47
- };
48
-
49
- return data;
50
- }
51
-
52
- class PropertyDeclaration {
53
- predicate(node) {
54
- return node.kind === _typescript().default.SyntaxKind.PropertyDeclaration;
55
- }
56
-
57
- getName(node) {
58
- return node.name.getText();
59
- }
60
-
61
- async getIdentifiers(node) {
62
- return [new (_exportIdentifier().ExportIdentifier)(node.name.getText(), node.getSourceFile().fileName)];
63
- }
64
-
65
- async transform(propertyDec, context) {
66
- var _info$body;
67
-
68
- const name = this.getName(propertyDec);
69
- const info = await context.getQuickInfo(propertyDec.name);
70
- const displaySig = info === null || info === void 0 ? void 0 : (_info$body = info.body) === null || _info$body === void 0 ? void 0 : _info$body.displayString;
71
- const typeStr = (0, _parseTypeFromQuickInfo().parseTypeFromQuickInfo)(info);
72
- const type = await context.resolveType(propertyDec, typeStr);
73
- return new (_semanticsEntities().VariableSchema)(context.getLocation(propertyDec), name, displaySig || '', type);
74
- }
75
-
76
- }
77
-
78
- exports.PropertyDeclaration = PropertyDeclaration;
79
-
80
- //# sourceMappingURL=property-declaration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["PropertyDeclaration","predicate","node","kind","ts","SyntaxKind","getName","name","getText","getIdentifiers","ExportIdentifier","getSourceFile","fileName","transform","propertyDec","context","info","getQuickInfo","displaySig","body","displayString","typeStr","parseTypeFromQuickInfo","type","resolveType","VariableSchema","getLocation"],"sources":["property-declaration.ts"],"sourcesContent":["import { SchemaNode, VariableSchema } from '@teambit/semantics.entities.semantic-schema';\nimport ts, { Node, PropertyDeclaration as PropertyDeclarationNode } from 'typescript';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { ExportIdentifier } from '../export-identifier';\nimport { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';\n\nexport class PropertyDeclaration implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.PropertyDeclaration;\n }\n\n getName(node: PropertyDeclarationNode) {\n return node.name.getText();\n }\n\n async getIdentifiers(node: PropertyDeclarationNode) {\n return [new ExportIdentifier(node.name.getText(), node.getSourceFile().fileName)];\n }\n\n async transform(propertyDec: PropertyDeclarationNode, context: SchemaExtractorContext): Promise<SchemaNode> {\n const name = this.getName(propertyDec);\n const info = await context.getQuickInfo(propertyDec.name);\n const displaySig = info?.body?.displayString;\n const typeStr = parseTypeFromQuickInfo(info);\n const type = await context.resolveType(propertyDec, typeStr);\n\n return new VariableSchema(context.getLocation(propertyDec), name, displaySig || '', type);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,mBAAN,CAAuD;EAC5DC,SAAS,CAACC,IAAD,EAAa;IACpB,OAAOA,IAAI,CAACC,IAAL,KAAcC,qBAAA,CAAGC,UAAH,CAAcL,mBAAnC;EACD;;EAEDM,OAAO,CAACJ,IAAD,EAAgC;IACrC,OAAOA,IAAI,CAACK,IAAL,CAAUC,OAAV,EAAP;EACD;;EAEmB,MAAdC,cAAc,CAACP,IAAD,EAAgC;IAClD,OAAO,CAAC,KAAIQ,oCAAJ,EAAqBR,IAAI,CAACK,IAAL,CAAUC,OAAV,EAArB,EAA0CN,IAAI,CAACS,aAAL,GAAqBC,QAA/D,CAAD,CAAP;EACD;;EAEc,MAATC,SAAS,CAACC,WAAD,EAAuCC,OAAvC,EAA6F;IAAA;;IAC1G,MAAMR,IAAI,GAAG,KAAKD,OAAL,CAAaQ,WAAb,CAAb;IACA,MAAME,IAAI,GAAG,MAAMD,OAAO,CAACE,YAAR,CAAqBH,WAAW,CAACP,IAAjC,CAAnB;IACA,MAAMW,UAAU,GAAGF,IAAH,aAAGA,IAAH,qCAAGA,IAAI,CAAEG,IAAT,+CAAG,WAAYC,aAA/B;IACA,MAAMC,OAAO,GAAG,IAAAC,gDAAA,EAAuBN,IAAvB,CAAhB;IACA,MAAMO,IAAI,GAAG,MAAMR,OAAO,CAACS,WAAR,CAAoBV,WAApB,EAAiCO,OAAjC,CAAnB;IAEA,OAAO,KAAII,mCAAJ,EAAmBV,OAAO,CAACW,WAAR,CAAoBZ,WAApB,CAAnB,EAAqDP,IAArD,EAA2DW,UAAU,IAAI,EAAzE,EAA6EK,IAA7E,CAAP;EACD;;AArB2D"}
@@ -1,10 +0,0 @@
1
- import { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
2
- import { Node, PropertySignature as PropertySignatureNode } from 'typescript';
3
- import { SchemaTransformer } from '../schema-transformer';
4
- import { SchemaExtractorContext } from '../schema-extractor-context';
5
- export declare class PropertySignature implements SchemaTransformer {
6
- predicate(node: Node): boolean;
7
- getName(node: PropertySignatureNode): string;
8
- getIdentifiers(): Promise<never[]>;
9
- transform(prop: PropertySignatureNode, context: SchemaExtractorContext): Promise<SchemaNode>;
10
- }
@@ -1,72 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.promise.js");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.PropertySignature = void 0;
9
-
10
- function _semanticsEntities() {
11
- const data = require("@teambit/semantics.entities.semantic-schema");
12
-
13
- _semanticsEntities = function () {
14
- return data;
15
- };
16
-
17
- return data;
18
- }
19
-
20
- function _typescript() {
21
- const data = _interopRequireWildcard(require("typescript"));
22
-
23
- _typescript = function () {
24
- return data;
25
- };
26
-
27
- return data;
28
- }
29
-
30
- function _parseTypeFromQuickInfo() {
31
- const data = require("./utils/parse-type-from-quick-info");
32
-
33
- _parseTypeFromQuickInfo = function () {
34
- return data;
35
- };
36
-
37
- return data;
38
- }
39
-
40
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
41
-
42
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
43
-
44
- class PropertySignature {
45
- predicate(node) {
46
- return node.kind === _typescript().default.SyntaxKind.PropertySignature;
47
- }
48
-
49
- getName(node) {
50
- return node.name.getText();
51
- }
52
-
53
- async getIdentifiers() {
54
- return [];
55
- }
56
-
57
- async transform(prop, context) {
58
- var _info$body;
59
-
60
- const name = this.getName(prop);
61
- const info = (0, _typescript().isComputedPropertyName)(prop.name) ? undefined : await context.getQuickInfo(prop.name);
62
- const displaySig = (info === null || info === void 0 ? void 0 : (_info$body = info.body) === null || _info$body === void 0 ? void 0 : _info$body.displayString) || '';
63
- const typeStr = (0, _parseTypeFromQuickInfo().parseTypeFromQuickInfo)(info);
64
- const type = await context.resolveType(prop, typeStr);
65
- return new (_semanticsEntities().VariableSchema)(context.getLocation(prop), name, displaySig, type);
66
- }
67
-
68
- }
69
-
70
- exports.PropertySignature = PropertySignature;
71
-
72
- //# sourceMappingURL=property-signature.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["PropertySignature","predicate","node","kind","ts","SyntaxKind","getName","name","getText","getIdentifiers","transform","prop","context","info","isComputedPropertyName","undefined","getQuickInfo","displaySig","body","displayString","typeStr","parseTypeFromQuickInfo","type","resolveType","VariableSchema","getLocation"],"sources":["property-signature.ts"],"sourcesContent":["import { SchemaNode, VariableSchema } from '@teambit/semantics.entities.semantic-schema';\nimport ts, { isComputedPropertyName, Node, PropertySignature as PropertySignatureNode } from 'typescript';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';\n\nexport class PropertySignature implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.PropertySignature;\n }\n\n getName(node: PropertySignatureNode) {\n return node.name.getText();\n }\n\n async getIdentifiers() {\n return [];\n }\n\n async transform(prop: PropertySignatureNode, context: SchemaExtractorContext): Promise<SchemaNode> {\n const name = this.getName(prop);\n const info = isComputedPropertyName(prop.name) ? undefined : await context.getQuickInfo(prop.name);\n const displaySig = info?.body?.displayString || '';\n const typeStr = parseTypeFromQuickInfo(info);\n const type = await context.resolveType(prop, typeStr);\n return new VariableSchema(context.getLocation(prop), name, displaySig, type);\n }\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;AAEO,MAAMA,iBAAN,CAAqD;EAC1DC,SAAS,CAACC,IAAD,EAAa;IACpB,OAAOA,IAAI,CAACC,IAAL,KAAcC,qBAAA,CAAGC,UAAH,CAAcL,iBAAnC;EACD;;EAEDM,OAAO,CAACJ,IAAD,EAA8B;IACnC,OAAOA,IAAI,CAACK,IAAL,CAAUC,OAAV,EAAP;EACD;;EAEmB,MAAdC,cAAc,GAAG;IACrB,OAAO,EAAP;EACD;;EAEc,MAATC,SAAS,CAACC,IAAD,EAA8BC,OAA9B,EAAoF;IAAA;;IACjG,MAAML,IAAI,GAAG,KAAKD,OAAL,CAAaK,IAAb,CAAb;IACA,MAAME,IAAI,GAAG,IAAAC,oCAAA,EAAuBH,IAAI,CAACJ,IAA5B,IAAoCQ,SAApC,GAAgD,MAAMH,OAAO,CAACI,YAAR,CAAqBL,IAAI,CAACJ,IAA1B,CAAnE;IACA,MAAMU,UAAU,GAAG,CAAAJ,IAAI,SAAJ,IAAAA,IAAI,WAAJ,0BAAAA,IAAI,CAAEK,IAAN,0DAAYC,aAAZ,KAA6B,EAAhD;IACA,MAAMC,OAAO,GAAG,IAAAC,gDAAA,EAAuBR,IAAvB,CAAhB;IACA,MAAMS,IAAI,GAAG,MAAMV,OAAO,CAACW,WAAR,CAAoBZ,IAApB,EAA0BS,OAA1B,CAAnB;IACA,OAAO,KAAII,mCAAJ,EAAmBZ,OAAO,CAACa,WAAR,CAAoBd,IAApB,CAAnB,EAA8CJ,IAA9C,EAAoDU,UAApD,EAAgEK,IAAhE,CAAP;EACD;;AApByD"}
@@ -1,22 +0,0 @@
1
- import { SchemaNode, ConstructorSchema } from '@teambit/semantics.entities.semantic-schema';
2
- import ts, { Node, ConstructorDeclaration } from 'typescript';
3
- import { SchemaExtractorContext } from '../schema-extractor-context';
4
- import { SchemaTransformer } from '../schema-transformer';
5
- import { ExportIdentifier } from '../export-identifier';
6
- import { getParams } from './utils/get-params';
7
-
8
- export class Constructor implements SchemaTransformer {
9
- predicate(node: Node) {
10
- return node.kind === ts.SyntaxKind.Constructor;
11
- }
12
-
13
- async getIdentifiers(node: ConstructorDeclaration) {
14
- return [new ExportIdentifier('constructor', node.getSourceFile().fileName)];
15
- }
16
-
17
- async transform(constructorDec: ConstructorDeclaration, context: SchemaExtractorContext): Promise<SchemaNode> {
18
- const args = await getParams(constructorDec.parameters, context);
19
-
20
- return new ConstructorSchema(context.getLocation(constructorDec), args);
21
- }
22
- }
@@ -1,22 +0,0 @@
1
- import { SchemaNode, IndexSignatureSchema } from '@teambit/semantics.entities.semantic-schema';
2
- import ts, { Node, IndexSignatureDeclaration } from 'typescript';
3
- import { SchemaTransformer } from '../schema-transformer';
4
- import { SchemaExtractorContext } from '../schema-extractor-context';
5
- import { getParams } from './utils/get-params';
6
- import { typeNodeToSchema } from './utils/type-node-to-schema';
7
-
8
- export class IndexSignature implements SchemaTransformer {
9
- predicate(node: Node) {
10
- return node.kind === ts.SyntaxKind.IndexSignature;
11
- }
12
-
13
- async getIdentifiers() {
14
- return [];
15
- }
16
-
17
- async transform(indexSig: IndexSignatureDeclaration, context: SchemaExtractorContext): Promise<SchemaNode> {
18
- const params = await getParams(indexSig.parameters, context);
19
- const type = await typeNodeToSchema(indexSig.type, context);
20
- return new IndexSignatureSchema(context.getLocation(indexSig), params, type);
21
- }
22
- }
@@ -1,24 +0,0 @@
1
- import { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
2
- import ts, { Node, MethodDeclaration as MethodDeclarationNode } from 'typescript';
3
- import { SchemaExtractorContext } from '../schema-extractor-context';
4
- import { SchemaTransformer } from '../schema-transformer';
5
- import { ExportIdentifier } from '../export-identifier';
6
- import { toFunctionLikeSchema } from './utils/to-function-schema';
7
-
8
- export class MethodDeclaration implements SchemaTransformer {
9
- predicate(node: Node) {
10
- return node.kind === ts.SyntaxKind.MethodDeclaration;
11
- }
12
-
13
- async getIdentifiers(funcDec: MethodDeclarationNode) {
14
- return [new ExportIdentifier(this.getName(funcDec), funcDec.getSourceFile().fileName)];
15
- }
16
-
17
- private getName(funcDec: MethodDeclarationNode) {
18
- return funcDec.name?.getText() || '';
19
- }
20
-
21
- async transform(methodDec: MethodDeclarationNode, context: SchemaExtractorContext): Promise<SchemaNode> {
22
- return toFunctionLikeSchema(methodDec, context);
23
- }
24
- }
@@ -1,23 +0,0 @@
1
- import { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
2
- import ts, { Node, MethodSignature as MethodSignatureNode } from 'typescript';
3
- import { SchemaTransformer } from '../schema-transformer';
4
- import { SchemaExtractorContext } from '../schema-extractor-context';
5
- import { toFunctionLikeSchema } from './utils/to-function-schema';
6
-
7
- export class MethodSignatureTransformer implements SchemaTransformer {
8
- predicate(node: Node) {
9
- return node.kind === ts.SyntaxKind.MethodSignature;
10
- }
11
-
12
- getName(node: MethodSignatureNode) {
13
- return node.name.getText();
14
- }
15
-
16
- async getIdentifiers() {
17
- return [];
18
- }
19
-
20
- async transform(methodSig: MethodSignatureNode, context: SchemaExtractorContext): Promise<SchemaNode> {
21
- return toFunctionLikeSchema(methodSig, context);
22
- }
23
- }
@@ -1,30 +0,0 @@
1
- import { SchemaNode, VariableSchema } from '@teambit/semantics.entities.semantic-schema';
2
- import ts, { Node, PropertyDeclaration as PropertyDeclarationNode } from 'typescript';
3
- import { SchemaTransformer } from '../schema-transformer';
4
- import { SchemaExtractorContext } from '../schema-extractor-context';
5
- import { ExportIdentifier } from '../export-identifier';
6
- import { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';
7
-
8
- export class PropertyDeclaration implements SchemaTransformer {
9
- predicate(node: Node) {
10
- return node.kind === ts.SyntaxKind.PropertyDeclaration;
11
- }
12
-
13
- getName(node: PropertyDeclarationNode) {
14
- return node.name.getText();
15
- }
16
-
17
- async getIdentifiers(node: PropertyDeclarationNode) {
18
- return [new ExportIdentifier(node.name.getText(), node.getSourceFile().fileName)];
19
- }
20
-
21
- async transform(propertyDec: PropertyDeclarationNode, context: SchemaExtractorContext): Promise<SchemaNode> {
22
- const name = this.getName(propertyDec);
23
- const info = await context.getQuickInfo(propertyDec.name);
24
- const displaySig = info?.body?.displayString;
25
- const typeStr = parseTypeFromQuickInfo(info);
26
- const type = await context.resolveType(propertyDec, typeStr);
27
-
28
- return new VariableSchema(context.getLocation(propertyDec), name, displaySig || '', type);
29
- }
30
- }