@teambit/typescript 0.0.994 → 0.0.995

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.
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.994/dist/typescript.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.994/dist/typescript.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.995/dist/typescript.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.995/dist/typescript.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -1,12 +1,12 @@
1
1
  import { Parser } from '@teambit/schema';
2
2
  import { Export, StaticProperties } from '@teambit/semantics.entities.semantic-schema';
3
3
  import { Logger } from '@teambit/logger';
4
- import { SourceFile } from 'typescript';
4
+ import ts from 'typescript';
5
5
  export declare class TypeScriptParser implements Parser {
6
6
  private logger?;
7
7
  extension: RegExp;
8
- getExports(sourceFile: SourceFile): Export[];
8
+ getExports(sourceFile: ts.SourceFile): Export[];
9
9
  parseModule(modulePath: string): Export[];
10
- parseStaticProperties(sourceFile: SourceFile): Map<string, StaticProperties>;
10
+ parseStaticProperties(sourceFile: ts.SourceFile): Map<string, StaticProperties>;
11
11
  constructor(logger?: Logger | undefined);
12
12
  }
@@ -28,41 +28,69 @@ function _fsExtra() {
28
28
  return data;
29
29
  }
30
30
  function _typescript() {
31
- const data = _interopRequireWildcard(require("typescript"));
31
+ const data = _interopRequireDefault(require("typescript"));
32
32
  _typescript = function () {
33
33
  return data;
34
34
  };
35
35
  return data;
36
36
  }
37
- 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); }
38
- 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; }
39
37
  class TypeScriptParser {
40
38
  getExports(sourceFile) {
41
39
  const staticProperties = this.parseStaticProperties(sourceFile);
42
- const exports = sourceFile.statements.filter(statement => {
43
- if (!statement.modifiers) return false;
44
- return statement.modifiers.find(modifier => {
45
- return modifier.kind === _typescript().default.SyntaxKind.ExportKeyword;
46
- });
47
- });
48
- const exportModels = exports.map(statement => {
49
- // todo refactor to a registry of variable statements.
50
- if ((0, _typescript().isVariableStatement)(statement)) {
51
- const child = statement.declarationList.declarations[0];
52
- const name = child.name.text;
53
- return new (_semanticsEntities().Export)(name, staticProperties.get(name));
40
+ const exportModels = [];
41
+ sourceFile.statements.forEach(statement => {
42
+ // export default
43
+ if (_typescript().default.isExportAssignment(statement)) {
44
+ // export default
54
45
  }
55
- if ((0, _typescript().isFunctionDeclaration)(statement)) {
56
- if (!statement.name) return undefined;
57
- const name = statement.name.text;
58
- return new (_semanticsEntities().Export)(name, staticProperties.get(name));
46
+
47
+ // export declarations or re-exports
48
+ if (_typescript().default.isExportDeclaration(statement)) {
49
+ if (statement.exportClause) {
50
+ if (_typescript().default.isNamedExports(statement.exportClause)) {
51
+ statement.exportClause.elements.forEach(element => {
52
+ const name = element.name.escapedText.toString();
53
+ if (name !== 'default') {
54
+ exportModels.push(new (_semanticsEntities().Export)(name, staticProperties.get(name)));
55
+ }
56
+ });
57
+ }
58
+ if (_typescript().default.isNamespaceExport(statement.exportClause)) {
59
+ const name = statement.exportClause.name.escapedText.toString();
60
+ exportModels.push(new (_semanticsEntities().Export)(name, staticProperties.get(name)));
61
+ }
62
+ }
59
63
  }
60
- if ((0, _typescript().isClassDeclaration)(statement)) {
61
- if (!statement.name) return undefined;
62
- const name = statement.name.text;
63
- return new (_semanticsEntities().Export)(name, staticProperties.get(name));
64
+
65
+ // export modifiers
66
+ // - variable statement
67
+ // - function statement
68
+ // - class statement
69
+ if (statement.modifiers) {
70
+ statement.modifiers.some(modifier => {
71
+ if (modifier.kind === _typescript().default.SyntaxKind.ExportKeyword) {
72
+ if (_typescript().default.isVariableStatement(statement)) {
73
+ const child = statement.declarationList.declarations[0];
74
+ if (_typescript().default.isIdentifier(child.name)) {
75
+ const name = child.name.escapedText.toString();
76
+ exportModels.push(new (_semanticsEntities().Export)(name, staticProperties.get(name)));
77
+ }
78
+ } else if (_typescript().default.isFunctionDeclaration(statement)) {
79
+ if (statement.name) {
80
+ const name = statement.name.escapedText.toString();
81
+ exportModels.push(new (_semanticsEntities().Export)(name, staticProperties.get(name)));
82
+ }
83
+ } else if (_typescript().default.isClassDeclaration(statement)) {
84
+ if (statement.name) {
85
+ const name = statement.name.escapedText.toString();
86
+ exportModels.push(new (_semanticsEntities().Export)(name, staticProperties.get(name)));
87
+ }
88
+ }
89
+ return true;
90
+ }
91
+ return false;
92
+ });
64
93
  }
65
- return undefined;
66
94
  });
67
95
  const withoutEmpty = exportModels.filter(exportModel => exportModel !== undefined);
68
96
  // @ts-ignore
@@ -1 +1 @@
1
- {"version":3,"names":["TypeScriptParser","getExports","sourceFile","staticProperties","parseStaticProperties","exports","statements","filter","statement","modifiers","find","modifier","kind","ts","SyntaxKind","ExportKeyword","exportModels","map","isVariableStatement","child","declarationList","declarations","name","text","Export","get","isFunctionDeclaration","undefined","isClassDeclaration","withoutEmpty","exportModel","parseModule","modulePath","ast","createSourceFile","readFileSync","ScriptTarget","Latest","moduleExports","exportStaticProperties","Map","forEach","isExpressionStatement","isBinaryExpression","expression","operatorToken","EqualsToken","isPropertyAccessExpression","left","isIdentifier","targetName","propertyName","has","set","existingProperties","isStringLiteral","right","isNumericLiteral","UndefinedKeyword","NullKeyword","TrueKeyword","FalseKeyword","err","logger","error","constructor"],"sources":["typescript.parser.ts"],"sourcesContent":["import { Parser } from '@teambit/schema';\nimport { Export, StaticProperties } from '@teambit/semantics.entities.semantic-schema';\nimport { Logger } from '@teambit/logger';\nimport { readFileSync } from 'fs-extra';\nimport ts, {\n isClassDeclaration,\n isFunctionDeclaration,\n isVariableStatement,\n SourceFile,\n VariableStatement,\n} from 'typescript';\n\nexport class TypeScriptParser implements Parser {\n public extension = /^.*\\.(js|jsx|ts|tsx)$/;\n\n getExports(sourceFile: SourceFile): Export[] {\n const staticProperties = this.parseStaticProperties(sourceFile);\n\n const exports = sourceFile.statements.filter((statement) => {\n if (!statement.modifiers) return false;\n return statement.modifiers.find((modifier) => {\n return modifier.kind === ts.SyntaxKind.ExportKeyword;\n });\n });\n\n const exportModels = exports.map((statement) => {\n // todo refactor to a registry of variable statements.\n if (isVariableStatement(statement)) {\n const child = (statement as VariableStatement).declarationList.declarations[0];\n const name = (child as any).name.text;\n return new Export(name, staticProperties.get(name));\n }\n\n if (isFunctionDeclaration(statement)) {\n if (!statement.name) return undefined;\n const name = statement.name.text;\n return new Export(name, staticProperties.get(name));\n }\n\n if (isClassDeclaration(statement)) {\n if (!statement.name) return undefined;\n const name = statement.name.text;\n return new Export(name, staticProperties.get(name));\n }\n\n return undefined;\n });\n const withoutEmpty = exportModels.filter((exportModel) => exportModel !== undefined);\n // @ts-ignore\n return withoutEmpty;\n }\n\n parseModule(modulePath: string) {\n const ast = ts.createSourceFile(modulePath, readFileSync(modulePath, 'utf8'), ts.ScriptTarget.Latest);\n\n const moduleExports = this.getExports(ast);\n return moduleExports;\n }\n\n parseStaticProperties(sourceFile: SourceFile) {\n // TODO - should we also parse staticProperties inside classes / objects?\n\n const exportStaticProperties = new Map<string, StaticProperties>();\n\n sourceFile.statements.forEach((statement) => {\n try {\n if (!ts.isExpressionStatement(statement)) return;\n if (!ts.isBinaryExpression(statement.expression)) return;\n if (statement.expression.operatorToken.kind !== ts.SyntaxKind.EqualsToken) return;\n if (!ts.isPropertyAccessExpression(statement.expression.left)) return;\n if (!ts.isIdentifier(statement.expression.left.expression)) return;\n\n const targetName = statement.expression.left.expression.text;\n const propertyName = statement.expression.left.name.text;\n\n if (!exportStaticProperties.has(targetName)) exportStaticProperties.set(targetName, new Map());\n\n const existingProperties = exportStaticProperties.get(targetName);\n\n if (ts.isStringLiteral(statement.expression.right)) {\n existingProperties?.set(propertyName, statement.expression.right.text);\n } else if (ts.isNumericLiteral(statement.expression.right)) {\n existingProperties?.set(propertyName, +statement.expression.right.text);\n } else if (statement.expression.right.kind === ts.SyntaxKind.UndefinedKeyword) {\n existingProperties?.set(propertyName, undefined);\n } else if (statement.expression.right.kind === ts.SyntaxKind.NullKeyword) {\n existingProperties?.set(propertyName, null);\n } else if (statement.expression.right.kind === ts.SyntaxKind.TrueKeyword) {\n existingProperties?.set(propertyName, true);\n } else if (statement.expression.right.kind === ts.SyntaxKind.FalseKeyword) {\n existingProperties?.set(propertyName, false);\n }\n } catch (err) {\n this.logger?.error('failed parsing static properties', err);\n }\n });\n\n return exportStaticProperties;\n }\n\n constructor(private logger?: Logger | undefined) {}\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;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,MAAM,IAAI3C,SAAS,CAACoC,UAAU,CAACY,KAAK,CAAC5C,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAAC8C,WAAW,EAAE;UACxEN,kBAAkB,aAAlBA,kBAAkB,uBAAlBA,kBAAkB,CAAED,GAAG,CAACF,YAAY,EAAE,IAAI,CAAC;QAC7C,CAAC,MAAM,IAAI3C,SAAS,CAACoC,UAAU,CAACY,KAAK,CAAC5C,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAAC+C,YAAY,EAAE;UACzEP,kBAAkB,aAAlBA,kBAAkB,uBAAlBA,kBAAkB,CAAED,GAAG,CAACF,YAAY,EAAE,KAAK,CAAC;QAC9C;MACF,CAAC,CAAC,OAAOW,GAAG,EAAE;QAAA;QACZ,oBAAI,CAACC,MAAM,iDAAX,aAAaC,KAAK,CAAC,kCAAkC,EAAEF,GAAG,CAAC;MAC7D;IACF,CAAC,CAAC;IAEF,OAAOvB,sBAAsB;EAC/B;EAEA0B,WAAW,CAASF,MAA2B,EAAE;IAAA,KAA7BA,MAA2B,GAA3BA,MAA2B;IAAA,mDAvF5B,uBAAuB;EAuFQ;AACpD;AAAC"}
1
+ {"version":3,"names":["TypeScriptParser","getExports","sourceFile","staticProperties","parseStaticProperties","exportModels","statements","forEach","statement","ts","isExportAssignment","isExportDeclaration","exportClause","isNamedExports","elements","element","name","escapedText","toString","push","Export","get","isNamespaceExport","modifiers","some","modifier","kind","SyntaxKind","ExportKeyword","isVariableStatement","child","declarationList","declarations","isIdentifier","isFunctionDeclaration","isClassDeclaration","withoutEmpty","filter","exportModel","undefined","parseModule","modulePath","ast","createSourceFile","readFileSync","ScriptTarget","Latest","moduleExports","exportStaticProperties","Map","isExpressionStatement","isBinaryExpression","expression","operatorToken","EqualsToken","isPropertyAccessExpression","left","targetName","text","propertyName","has","set","existingProperties","isStringLiteral","right","isNumericLiteral","UndefinedKeyword","NullKeyword","TrueKeyword","FalseKeyword","err","logger","error","constructor"],"sources":["typescript.parser.ts"],"sourcesContent":["import { Parser } from '@teambit/schema';\nimport { Export, StaticProperties } from '@teambit/semantics.entities.semantic-schema';\nimport { Logger } from '@teambit/logger';\nimport { readFileSync } from 'fs-extra';\nimport ts from 'typescript';\n\nexport class TypeScriptParser implements Parser {\n public extension = /^.*\\.(js|jsx|ts|tsx)$/;\n\n getExports(sourceFile: ts.SourceFile): Export[] {\n const staticProperties = this.parseStaticProperties(sourceFile);\n const exportModels: Export[] = [];\n\n sourceFile.statements.forEach((statement) => {\n // export default\n if (ts.isExportAssignment(statement)) {\n // export default\n }\n\n // export declarations or re-exports\n if (ts.isExportDeclaration(statement)) {\n if (statement.exportClause) {\n if (ts.isNamedExports(statement.exportClause)) {\n statement.exportClause.elements.forEach((element) => {\n const name = element.name.escapedText.toString();\n if (name !== 'default') {\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n });\n }\n if (ts.isNamespaceExport(statement.exportClause)) {\n const name = statement.exportClause.name.escapedText.toString();\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n }\n }\n\n // export modifiers\n // - variable statement\n // - function statement\n // - class statement\n if (statement.modifiers) {\n statement.modifiers.some((modifier) => {\n if (modifier.kind === ts.SyntaxKind.ExportKeyword) {\n if (ts.isVariableStatement(statement)) {\n const child = statement.declarationList.declarations[0];\n if (ts.isIdentifier(child.name)) {\n const name = child.name.escapedText.toString();\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n } else if (ts.isFunctionDeclaration(statement)) {\n if (statement.name) {\n const name = statement.name.escapedText.toString();\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n } else if (ts.isClassDeclaration(statement)) {\n if (statement.name) {\n const name = statement.name.escapedText.toString();\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n }\n return true;\n }\n return false;\n });\n }\n });\n\n const withoutEmpty = exportModels.filter((exportModel) => exportModel !== undefined);\n // @ts-ignore\n return withoutEmpty;\n }\n\n parseModule(modulePath: string) {\n const ast = ts.createSourceFile(modulePath, readFileSync(modulePath, 'utf8'), ts.ScriptTarget.Latest);\n\n const moduleExports = this.getExports(ast);\n return moduleExports;\n }\n\n parseStaticProperties(sourceFile: ts.SourceFile) {\n // TODO - should we also parse staticProperties inside classes / objects?\n\n const exportStaticProperties = new Map<string, StaticProperties>();\n\n sourceFile.statements.forEach((statement) => {\n try {\n if (!ts.isExpressionStatement(statement)) return;\n if (!ts.isBinaryExpression(statement.expression)) return;\n if (statement.expression.operatorToken.kind !== ts.SyntaxKind.EqualsToken) return;\n if (!ts.isPropertyAccessExpression(statement.expression.left)) return;\n if (!ts.isIdentifier(statement.expression.left.expression)) return;\n\n const targetName = statement.expression.left.expression.text;\n const propertyName = statement.expression.left.name.text;\n\n if (!exportStaticProperties.has(targetName)) exportStaticProperties.set(targetName, new Map());\n\n const existingProperties = exportStaticProperties.get(targetName);\n\n if (ts.isStringLiteral(statement.expression.right)) {\n existingProperties?.set(propertyName, statement.expression.right.text);\n } else if (ts.isNumericLiteral(statement.expression.right)) {\n existingProperties?.set(propertyName, +statement.expression.right.text);\n } else if (statement.expression.right.kind === ts.SyntaxKind.UndefinedKeyword) {\n existingProperties?.set(propertyName, undefined);\n } else if (statement.expression.right.kind === ts.SyntaxKind.NullKeyword) {\n existingProperties?.set(propertyName, null);\n } else if (statement.expression.right.kind === ts.SyntaxKind.TrueKeyword) {\n existingProperties?.set(propertyName, true);\n } else if (statement.expression.right.kind === ts.SyntaxKind.FalseKeyword) {\n existingProperties?.set(propertyName, false);\n }\n } catch (err) {\n this.logger?.error('failed parsing static properties', err);\n }\n });\n\n return exportStaticProperties;\n }\n\n constructor(private logger?: Logger | undefined) {}\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,gBAAgB,CAAmB;EAG9CC,UAAU,CAACC,UAAyB,EAAY;IAC9C,MAAMC,g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K,CAACtC,IAAI,KAAKjB,qBAAE,CAACkB,UAAU,CAAC0C,YAAY,EAAE;UACzEP,kBAAkB,aAAlBA,kBAAkB,uBAAlBA,kBAAkB,CAAED,GAAG,CAACF,YAAY,EAAE,KAAK,CAAC;QAC9C;MACF,CAAC,CAAC,OAAOW,GAAG,EAAE;QAAA;QACZ,oBAAI,CAACC,MAAM,iDAAX,aAAaC,KAAK,CAAC,kCAAkC,EAAEF,GAAG,CAAC;MAC7D;IACF,CAAC,CAAC;IAEF,OAAOtB,sBAAsB;EAC/B;EAEAyB,WAAW,CAASF,MAA2B,EAAE;IAAA,KAA7BA,MAA2B,GAA3BA,MAA2B;IAAA,mDAlH5B,uBAAuB;EAkHQ;AACpD;AAAC"}
@@ -24,6 +24,9 @@ function _typescript2() {
24
24
  }
25
25
  describe('TypescriptParser', () => {
26
26
  describe('getExports', () => {
27
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export
28
+ // https://www.typescriptlang.org/docs/handbook/modules.html#export
29
+
27
30
  const exampleArrowFunction = `
28
31
  export const arrow = () => { return 3; }
29
32
  arrow.textProperty = "propertyValue";
@@ -36,6 +39,29 @@ describe('TypescriptParser', () => {
36
39
  export class classy{ render() { return 3; } }
37
40
  classy.textProperty = "propertyValue";
38
41
  `;
42
+ const exampleStatement = `
43
+ function myFunction2 () { return 3; }
44
+ const myVariable2 = 3;
45
+ export { myFunction2, myVariable2 };
46
+ `;
47
+ const exampleRenamedStatement = `
48
+ function myFunction2 () { return 3; }
49
+ const myVariable2 = 3;
50
+ export { myFunction2, myVariable2 as myVariable2Alias };
51
+ `;
52
+ const exampleReExport = `
53
+ export { default as function1, function2 } from "bar.js";
54
+ `;
55
+ const exampleReExportDefault = `
56
+ export { default, function2 } from "bar.js";
57
+ `;
58
+ const exampleRenamedReExportAll = `
59
+ export * as ns from "mod";
60
+ `;
61
+ const exampleExportDefault = `
62
+ const a: number = 1
63
+ export default { a };
64
+ `;
39
65
  it('should parse arrowFunctions', () => {
40
66
  const ast = _typescript().default.createSourceFile('example.tsx', exampleArrowFunction, _typescript().default.ScriptTarget.Latest);
41
67
  const exports = new (_typescript2().TypeScriptParser)().getExports(ast);
@@ -54,6 +80,49 @@ describe('TypescriptParser', () => {
54
80
  const exportClass = exports.find(x => x.identifier === 'classy');
55
81
  (0, _chai().expect)(exportClass).to.exist;
56
82
  });
83
+ it('should parse declarations', () => {
84
+ const ast = _typescript().default.createSourceFile('example.tsx', exampleStatement, _typescript().default.ScriptTarget.Latest);
85
+ const exports = new (_typescript2().TypeScriptParser)().getExports(ast);
86
+ const exportFunction = exports.find(x => x.identifier === 'myFunction2');
87
+ const exportVariable = exports.find(x => x.identifier === 'myVariable2');
88
+ (0, _chai().expect)(exportFunction).to.exist;
89
+ (0, _chai().expect)(exportVariable).to.exist;
90
+ });
91
+ it('should parse renamed declarations', () => {
92
+ const ast = _typescript().default.createSourceFile('example.tsx', exampleRenamedStatement, _typescript().default.ScriptTarget.Latest);
93
+ const exports = new (_typescript2().TypeScriptParser)().getExports(ast);
94
+ const exportFunction = exports.find(x => x.identifier === 'myFunction2');
95
+ const exportVariable = exports.find(x => x.identifier === 'myVariable2Alias');
96
+ (0, _chai().expect)(exportFunction).to.exist;
97
+ (0, _chai().expect)(exportVariable).to.exist;
98
+ });
99
+ it('should parse re-exports', () => {
100
+ const ast = _typescript().default.createSourceFile('example.tsx', exampleReExport, _typescript().default.ScriptTarget.Latest);
101
+ const exports = new (_typescript2().TypeScriptParser)().getExports(ast);
102
+ const exportFunction1 = exports.find(x => x.identifier === 'function1');
103
+ const exportFunction2 = exports.find(x => x.identifier === 'function2');
104
+ (0, _chai().expect)(exportFunction1).to.exist;
105
+ (0, _chai().expect)(exportFunction2).to.exist;
106
+ });
107
+ it('should parse re-exports with default', () => {
108
+ const ast = _typescript().default.createSourceFile('example.tsx', exampleReExportDefault, _typescript().default.ScriptTarget.Latest);
109
+ const exports = new (_typescript2().TypeScriptParser)().getExports(ast);
110
+ const exportFunction1 = exports.find(x => x.identifier === 'default');
111
+ const exportFunction2 = exports.find(x => x.identifier === 'function2');
112
+ (0, _chai().expect)(exportFunction1).not.to.exist;
113
+ (0, _chai().expect)(exportFunction2).to.exist;
114
+ });
115
+ it('should parse renamed re-exports all', () => {
116
+ const ast = _typescript().default.createSourceFile('example.tsx', exampleRenamedReExportAll, _typescript().default.ScriptTarget.Latest);
117
+ const exports = new (_typescript2().TypeScriptParser)().getExports(ast);
118
+ const exportFunction1 = exports.find(x => x.identifier === 'ns');
119
+ (0, _chai().expect)(exportFunction1).to.exist;
120
+ });
121
+ it('should parse default exports', () => {
122
+ const ast = _typescript().default.createSourceFile('example.tsx', exampleExportDefault, _typescript().default.ScriptTarget.Latest);
123
+ const exports = new (_typescript2().TypeScriptParser)().getExports(ast);
124
+ (0, _chai().expect)(exports.length).to.equal(0);
125
+ });
57
126
  describe('staticProperties', () => {
58
127
  it('should include staticProperties, when on arrowFunctions', () => {
59
128
  var _exportArrow$staticPr;
@@ -1 +1 @@
1
- {"version":3,"names":["describe","exampleArrowFunction","exampleFunction","exampleClass","it","ast","ts","createSourceFile","ScriptTarget","Latest","exports","TypeScriptParser","getExports","exportArrow","find","x","identifier","expect","to","exist","exportFunction","exportClass","staticProperties","get","equal","exampleFile","parseStaticProperties","exportHello","undefined","has","be","false"],"sources":["typescript.parser.spec.ts"],"sourcesContent":["import ts from 'typescript';\nimport { expect } from 'chai';\n\nimport { TypeScriptParser } from './typescript.parser';\n\ndescribe('TypescriptParser', () => {\n describe('getExports', () => {\n const exampleArrowFunction = `\n export const arrow = () => { return 3; }\n arrow.textProperty = \"propertyValue\";\n `;\n\n const exampleFunction = `\n export function func() { return 3; }\n func.textProperty = \"propertyValue\";\n `;\n\n const exampleClass = `\n export class classy{ render() { return 3; } }\n classy.textProperty = \"propertyValue\";\n `;\n\n it('should parse arrowFunctions', () => {\n const ast = ts.createSourceFile('example.tsx', exampleArrowFunction, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportArrow = exports.find((x) => x.identifier === 'arrow');\n\n expect(exportArrow).to.exist;\n });\n\n it('should parse function exports', () => {\n const ast = ts.createSourceFile('example.tsx', exampleFunction, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportFunction = exports.find((x) => x.identifier === 'func');\n\n expect(exportFunction).to.exist;\n });\n\n it('should parse classes', () => {\n const ast = ts.createSourceFile('example.tsx', exampleClass, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportClass = exports.find((x) => x.identifier === 'classy');\n\n expect(exportClass).to.exist;\n });\n\n describe('staticProperties', () => {\n it('should include staticProperties, when on arrowFunctions', () => {\n const ast = ts.createSourceFile('example.tsx', exampleArrowFunction, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportArrow = exports.find((x) => x.identifier === 'arrow');\n\n expect(exportArrow?.staticProperties?.get('textProperty')).to.equal('propertyValue');\n });\n\n it('should include staticProperties, when on regular functions', () => {\n const ast = ts.createSourceFile('example.tsx', exampleFunction, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportClass = exports.find((x) => x.identifier === 'func');\n\n expect(exportClass?.staticProperties?.get('textProperty')).to.equal('propertyValue');\n });\n\n it('should include staticProperties, when on classes', () => {\n const ast = ts.createSourceFile('example.tsx', exampleClass, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportClass = exports.find((x) => x.identifier === 'classy');\n\n expect(exportClass?.staticProperties?.get('textProperty')).to.equal('propertyValue');\n });\n });\n });\n\n describe('collectStaticProperties', () => {\n const exampleFile = `\n export const hello = () => { return 3; }\n\n hello.text = \"is\";\n hello.count = 3;\n hello.nullish = null;\n hello.undef = undefined;\n hello.disable = false;\n hello.enable = true;\n hello.complextLiteral = \\`what \\${hello.text} it?\\`;\n hello.nonAssignedProperty += 'value';\n `;\n\n it('should parse all primitive values', () => {\n const ast = ts.createSourceFile('example.tsx', exampleFile, ts.ScriptTarget.Latest);\n const staticProperties = new TypeScriptParser().parseStaticProperties(ast);\n\n expect(staticProperties).to.exist;\n\n const exportHello = staticProperties.get('hello');\n expect(exportHello).to.exist;\n\n expect(exportHello?.get('text')).to.equal('is');\n expect(exportHello?.get('count')).to.equal(3);\n expect(exportHello?.get('nullish')).to.equal(null);\n expect(exportHello?.get('undef')).to.equal(undefined);\n expect(exportHello?.get('disable')).to.equal(false);\n expect(exportHello?.get('enable')).to.equal(true);\n\n expect(exportHello?.has('complextLiteral')).to.be.false;\n });\n\n it('should skip non primitive values', () => {\n const ast = ts.createSourceFile('example.tsx', exampleFile, ts.ScriptTarget.Latest);\n const staticProperties = new TypeScriptParser().parseStaticProperties(ast);\n const exportHello = staticProperties.get('hello');\n\n expect(exportHello?.has('complextLiteral')).to.be.false;\n });\n\n it('should skip non assignment statements', () => {\n const ast = ts.createSourceFile('example.tsx', exampleFile, ts.ScriptTarget.Latest);\n const staticProperties = new TypeScriptParser().parseStaticProperties(ast);\n const exportHello = staticProperties.get('hello');\n\n expect(exportHello?.has('nonAssignedProperty')).to.be.false;\n });\n });\n});\n"],"mappings":";;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEAA,QAAQ,CAAC,kBAAkB,EAAE,MAAM;EACjCA,QAAQ,CAAC,YAAY,EAAE,MAAM;IAC3B,MAAMC,oBAAoB,GAAI;AAClC;AACA;AACA,KAAK;IAED,MAAMC,eAAe,GAAI;AAC7B;AACA;AACA,KAAK;IAED,MAAMC,YAAY,GAAI;AAC1B;AACA;AACA,KAAK;IAEDC,EAAE,CAAC,6BAA6B,EAAE,MAAM;MACtC,MAAMC,GAAG,GAAGC,qBAAE,CAACC,gBAAgB,CAAC,aAAa,EAAEN,oBAAoB,EAAEK,qBAAE,CAACE,YAAY,CAACC,MAAM,C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EAAEnB,qBAAE,CAACE,YAAY,CAACC,MAAM,CAAC;MACnF,MAAMa,gBAAgB,GAAG,KAAIX,+BAAgB,GAAE,CAACe,qBAAqB,CAACrB,GAAG,CAAC;MAC1E,MAAMsB,WAAW,GAAGL,gBAAgB,CAACC,GAAG,CAAC,OAAO,CAAC;MAEjD,IAAAN,cAAM,EAACU,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEE,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAACX,EAAE,CAACY,EAAE,CAACC,KAAK;IAC7D,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"names":["describe","exampleArrowFunction","exampleFunction","exampleClass","exampleStatement","exampleRenamedStatement","exampleReExport","exampleReExportDefault","exampleRenamedReExportAll","exampleExportDefault","it","ast","ts","createSourceFile","ScriptTarget","Latest","exports","TypeScriptParser","getExports","exportArrow","find","x","identifier","expect","to","exist","exportFunction","exportClass","exportVariable","exportFunction1","exportFunction2","not","length","equal","staticProperties","get","exampleFile","parseStaticProperties","exportHello","undefined","has","be","false"],"sources":["typescript.parser.spec.ts"],"sourcesContent":["import ts from 'typescript';\nimport { expect } from 'chai';\n\nimport { TypeScriptParser } from './typescript.parser';\n\ndescribe('TypescriptParser', () => {\n describe('getExports', () => {\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export\n // https://www.typescriptlang.org/docs/handbook/modules.html#export\n\n const exampleArrowFunction = `\n export const arrow = () => { return 3; }\n arrow.textProperty = \"propertyValue\";\n `;\n\n const exampleFunction = `\n export function func() { return 3; }\n func.textProperty = \"propertyValue\";\n `;\n\n const exampleClass = `\n export class classy{ render() { return 3; } }\n classy.textProperty = \"propertyValue\";\n `;\n\n const exampleStatement = `\n function myFunction2 () { return 3; }\n const myVariable2 = 3;\n export { myFunction2, myVariable2 };\n `;\n\n const exampleRenamedStatement = `\n function myFunction2 () { return 3; }\n const myVariable2 = 3;\n export { myFunction2, myVariable2 as myVariable2Alias };\n `;\n\n const exampleReExport = `\n export { default as function1, function2 } from \"bar.js\";\n `;\n\n const exampleReExportDefault = `\n export { default, function2 } from \"bar.js\";\n `;\n\n const exampleRenamedReExportAll = `\n export * as ns from \"mod\";\n `;\n\n const exampleExportDefault = `\n const a: number = 1\n export default { a };\n `;\n\n it('should parse arrowFunctions', () => {\n const ast = ts.createSourceFile('example.tsx', exampleArrowFunction, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportArrow = exports.find((x) => x.identifier === 'arrow');\n\n expect(exportArrow).to.exist;\n });\n\n it('should parse function exports', () => {\n const ast = ts.createSourceFile('example.tsx', exampleFunction, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportFunction = exports.find((x) => x.identifier === 'func');\n\n expect(exportFunction).to.exist;\n });\n\n it('should parse classes', () => {\n const ast = ts.createSourceFile('example.tsx', exampleClass, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportClass = exports.find((x) => x.identifier === 'classy');\n\n expect(exportClass).to.exist;\n });\n\n it('should parse declarations', () => {\n const ast = ts.createSourceFile('example.tsx', exampleStatement, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportFunction = exports.find((x) => x.identifier === 'myFunction2');\n const exportVariable = exports.find((x) => x.identifier === 'myVariable2');\n\n expect(exportFunction).to.exist;\n expect(exportVariable).to.exist;\n });\n\n it('should parse renamed declarations', () => {\n const ast = ts.createSourceFile('example.tsx', exampleRenamedStatement, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportFunction = exports.find((x) => x.identifier === 'myFunction2');\n const exportVariable = exports.find((x) => x.identifier === 'myVariable2Alias');\n\n expect(exportFunction).to.exist;\n expect(exportVariable).to.exist;\n });\n\n it('should parse re-exports', () => {\n const ast = ts.createSourceFile('example.tsx', exampleReExport, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportFunction1 = exports.find((x) => x.identifier === 'function1');\n const exportFunction2 = exports.find((x) => x.identifier === 'function2');\n\n expect(exportFunction1).to.exist;\n expect(exportFunction2).to.exist;\n });\n\n it('should parse re-exports with default', () => {\n const ast = ts.createSourceFile('example.tsx', exampleReExportDefault, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportFunction1 = exports.find((x) => x.identifier === 'default');\n const exportFunction2 = exports.find((x) => x.identifier === 'function2');\n\n expect(exportFunction1).not.to.exist;\n expect(exportFunction2).to.exist;\n });\n\n it('should parse renamed re-exports all', () => {\n const ast = ts.createSourceFile('example.tsx', exampleRenamedReExportAll, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportFunction1 = exports.find((x) => x.identifier === 'ns');\n\n expect(exportFunction1).to.exist;\n });\n\n it('should parse default exports', () => {\n const ast = ts.createSourceFile('example.tsx', exampleExportDefault, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n expect(exports.length).to.equal(0);\n });\n\n describe('staticProperties', () => {\n it('should include staticProperties, when on arrowFunctions', () => {\n const ast = ts.createSourceFile('example.tsx', exampleArrowFunction, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportArrow = exports.find((x) => x.identifier === 'arrow');\n\n expect(exportArrow?.staticProperties?.get('textProperty')).to.equal('propertyValue');\n });\n\n it('should include staticProperties, when on regular functions', () => {\n const ast = ts.createSourceFile('example.tsx', exampleFunction, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportClass = exports.find((x) => x.identifier === 'func');\n\n expect(exportClass?.staticProperties?.get('textProperty')).to.equal('propertyValue');\n });\n\n it('should include staticProperties, when on classes', () => {\n const ast = ts.createSourceFile('example.tsx', exampleClass, ts.ScriptTarget.Latest);\n const exports = new TypeScriptParser().getExports(ast);\n\n const exportClass = exports.find((x) => x.identifier === 'classy');\n\n expect(exportClass?.staticProperties?.get('textProperty')).to.equal('propertyValue');\n });\n });\n });\n\n describe('collectStaticProperties', () => {\n const exampleFile = `\n export const hello = () => { return 3; }\n\n hello.text = \"is\";\n hello.count = 3;\n hello.nullish = null;\n hello.undef = undefined;\n hello.disable = false;\n hello.enable = true;\n hello.complextLiteral = \\`what \\${hello.text} it?\\`;\n hello.nonAssignedProperty += 'value';\n `;\n\n it('should parse all primitive values', () => {\n const ast = ts.createSourceFile('example.tsx', exampleFile, ts.ScriptTarget.Latest);\n const staticProperties = new TypeScriptParser().parseStaticProperties(ast);\n\n expect(staticProperties).to.exist;\n\n const exportHello = staticProperties.get('hello');\n expect(exportHello).to.exist;\n\n expect(exportHello?.get('text')).to.equal('is');\n expect(exportHello?.get('count')).to.equal(3);\n expect(exportHello?.get('nullish')).to.equal(null);\n expect(exportHello?.get('undef')).to.equal(undefined);\n expect(exportHello?.get('disable')).to.equal(false);\n expect(exportHello?.get('enable')).to.equal(true);\n\n expect(exportHello?.has('complextLiteral')).to.be.false;\n });\n\n it('should skip non primitive values', () => {\n const ast = ts.createSourceFile('example.tsx', exampleFile, ts.ScriptTarget.Latest);\n const staticProperties = new TypeScriptParser().parseStaticProperties(ast);\n const exportHello = staticProperties.get('hello');\n\n expect(exportHello?.has('complextLiteral')).to.be.false;\n });\n\n it('should skip non assignment statements', () => {\n const ast = ts.createSourceFile('example.tsx', exampleFile, ts.ScriptTarget.Latest);\n const staticProperties = new TypeScriptParser().parseStaticProperties(ast);\n const exportHello = staticProperties.get('hello');\n\n expect(exportHello?.has('nonAssignedProperty')).to.be.false;\n });\n });\n});\n"],"mappings":";;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEAA,QAAQ,CAAC,kBAAkB,EAAE,MAAM;EACjCA,QAAQ,CAAC,YAAY,EAAE,MAAM;IAC3B;IACA;;IAEA,MAA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EAAEuB,WAAW,EAAExB,qBAAE,CAACE,YAAY,CAACC,MAAM,CAAC;MACnF,MAAMmB,gBAAgB,GAAG,KAAIjB,+BAAgB,GAAE,CAACoB,qBAAqB,CAAC1B,GAAG,CAAC;MAC1E,MAAM2B,WAAW,GAAGJ,gBAAgB,CAACC,GAAG,CAAC,OAAO,CAAC;MAEjD,IAAAZ,cAAM,EAACe,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEE,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAChB,EAAE,CAACiB,EAAE,CAACC,KAAK;IAC7D,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/typescript",
3
- "version": "0.0.994",
3
+ "version": "0.0.995",
4
4
  "homepage": "https://bit.dev/teambit/typescript/typescript",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.typescript",
8
8
  "name": "typescript",
9
- "version": "0.0.994"
9
+ "version": "0.0.995"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -20,24 +20,24 @@
20
20
  "core-js": "^3.0.0",
21
21
  "@babel/runtime": "7.20.0",
22
22
  "@teambit/harmony": "0.4.6",
23
- "@teambit/compiler": "0.0.994",
23
+ "@teambit/compiler": "0.0.995",
24
24
  "@teambit/typescript.modules.ts-config-mutator": "0.0.76",
25
- "@teambit/component": "0.0.994",
26
- "@teambit/dependency-resolver": "0.0.994",
27
- "@teambit/formatter": "0.0.545",
25
+ "@teambit/component": "0.0.995",
26
+ "@teambit/dependency-resolver": "0.0.995",
27
+ "@teambit/formatter": "0.0.546",
28
28
  "@teambit/semantics.entities.semantic-schema": "0.0.51",
29
29
  "@teambit/ts-server": "0.0.43",
30
- "@teambit/aspect-loader": "0.0.994",
31
- "@teambit/envs": "0.0.994",
30
+ "@teambit/aspect-loader": "0.0.995",
31
+ "@teambit/envs": "0.0.995",
32
32
  "@teambit/logger": "0.0.761",
33
- "@teambit/workspace": "0.0.994",
33
+ "@teambit/workspace": "0.0.995",
34
34
  "@teambit/bit-error": "0.0.402",
35
- "@teambit/builder": "0.0.994",
36
- "@teambit/isolator": "0.0.994",
37
- "@teambit/schema": "0.0.994",
35
+ "@teambit/builder": "0.0.995",
36
+ "@teambit/isolator": "0.0.995",
37
+ "@teambit/schema": "0.0.995",
38
38
  "@teambit/cli": "0.0.668",
39
- "@teambit/pkg": "0.0.994",
40
- "@teambit/watcher": "0.0.6"
39
+ "@teambit/pkg": "0.0.995",
40
+ "@teambit/watcher": "0.0.7"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/lodash": "4.14.165",