@teambit/typescript 1.0.492 → 1.0.493

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,37 +1,37 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <testsuites tests="32" failures="0" errors="0" skipped="0">
3
- <testsuite name="teambit.typescript/typescript@1.0.492" tests="32" failures="0" errors="0" skipped="0">
3
+ <testsuite name="teambit.typescript/typescript@1.0.493" tests="32" failures="0" errors="0" skipped="0">
4
4
  <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with classNamesTransformer" time="0.006"/>
5
- <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with functionNamesTransformer" time="0.004"/>
6
- <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with importTransformer" time="0.003"/>
7
- <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with interfaceNamesTransformer" time="0.001"/>
8
- <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with typeAliasNamesTransformer" time="0.001"/>
9
- <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with variableNamesTransformer" time="0.001"/>
5
+ <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with functionNamesTransformer" time="0.003"/>
6
+ <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with importTransformer" time="0.004"/>
7
+ <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with interfaceNamesTransformer" time="0.002"/>
8
+ <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with typeAliasNamesTransformer" time="0.002"/>
9
+ <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with variableNamesTransformer" time="0.003"/>
10
+ <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with classNamesTransformer" time="0.002"/>
10
11
  <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with classNamesTransformer" time="0.002"/>
11
- <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with classNamesTransformer" time="0.001"/>
12
12
  <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with expressionStatementTransformer" time="0.002"/>
13
13
  <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with expressionStatementTransformer" time="0.002"/>
14
- <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with interfaceNamesTransformer" time="0.001"/>
14
+ <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with interfaceNamesTransformer" time="0.002"/>
15
15
  <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with importTransformer" time="0.001"/>
16
+ <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with exportTransformer" time="0.002"/>
16
17
  <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with exportTransformer" time="0.001"/>
17
18
  <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with exportTransformer" time="0.001"/>
18
- <testcase classname="dist/transform-source-file.spec.js" name="should correctly transform source code with exportTransformer" time="0.001"/>
19
- <testcase classname="dist/transform-source-file.spec.js" name="should return original source code if no transformations are applied" time="0.001"/>
20
- <testcase classname="dist/transform-source-file.spec.js" name="should handle multiple transformers" time="0.001"/>
19
+ <testcase classname="dist/transform-source-file.spec.js" name="should return original source code if no transformations are applied" time="0.002"/>
20
+ <testcase classname="dist/transform-source-file.spec.js" name="should handle multiple transformers" time="0.002"/>
21
21
  <testcase classname="dist/typescript.parser.spec.js" name="should parse arrowFunctions" time="0.003"/>
22
22
  <testcase classname="dist/typescript.parser.spec.js" name="should parse function exports"/>
23
- <testcase classname="dist/typescript.parser.spec.js" name="should parse classes"/>
23
+ <testcase classname="dist/typescript.parser.spec.js" name="should parse classes" time="0.001"/>
24
24
  <testcase classname="dist/typescript.parser.spec.js" name="should parse declarations"/>
25
- <testcase classname="dist/typescript.parser.spec.js" name="should parse renamed declarations"/>
25
+ <testcase classname="dist/typescript.parser.spec.js" name="should parse renamed declarations" time="0.001"/>
26
26
  <testcase classname="dist/typescript.parser.spec.js" name="should parse re-exports"/>
27
- <testcase classname="dist/typescript.parser.spec.js" name="should parse re-exports with default" time="0.001"/>
28
- <testcase classname="dist/typescript.parser.spec.js" name="should parse renamed re-exports all"/>
29
- <testcase classname="dist/typescript.parser.spec.js" name="should parse default exports" time="0.001"/>
27
+ <testcase classname="dist/typescript.parser.spec.js" name="should parse re-exports with default"/>
28
+ <testcase classname="dist/typescript.parser.spec.js" name="should parse renamed re-exports all" time="0.001"/>
29
+ <testcase classname="dist/typescript.parser.spec.js" name="should parse default exports"/>
30
30
  <testcase classname="dist/typescript.parser.spec.js" name="should include staticProperties, when on arrowFunctions"/>
31
- <testcase classname="dist/typescript.parser.spec.js" name="should include staticProperties, when on regular functions" time="0.001"/>
32
- <testcase classname="dist/typescript.parser.spec.js" name="should include staticProperties, when on classes"/>
31
+ <testcase classname="dist/typescript.parser.spec.js" name="should include staticProperties, when on regular functions"/>
32
+ <testcase classname="dist/typescript.parser.spec.js" name="should include staticProperties, when on classes" time="0.001"/>
33
33
  <testcase classname="dist/typescript.parser.spec.js" name="should parse all primitive values" time="0.001"/>
34
- <testcase classname="dist/typescript.parser.spec.js" name="should skip non primitive values"/>
34
+ <testcase classname="dist/typescript.parser.spec.js" name="should skip non primitive values" time="0.001"/>
35
35
  <testcase classname="dist/typescript.parser.spec.js" name="should skip non assignment statements"/>
36
36
  </testsuite>
37
37
  </testsuites>
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.typescript/typescript-preview"]=t():e["teambit.typescript/typescript-preview"]=t()}(self,(()=>(()=>{"use strict";var e={61819:(e,t,n)=>{Object.defineProperty(t,"S",{enumerable:!0,get:function(){return o.default}});var o=r(n(36213));function r(e){return e&&e.__esModule?e:{default:e}}r.__bit_component={id:"teambit.typescript/aspect-docs/typescript@0.0.169",homepage:"https://bit.cloud/teambit/typescript/aspect-docs/typescript",exported:!0}},36213:(e,t,n)=>{var o={id:"teambit.typescript/aspect-docs/typescript@0.0.169",homepage:"https://bit.cloud/teambit/typescript/aspect-docs/typescript",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=m,p(n(41594));var r=n(5016),i=["components"];function p(e){return e&&e.__esModule?e:{default:e}}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s.apply(null,arguments)}function a(e,t){if(null==e)return{};var n,o,r=c(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function c(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.includes(o))continue;n[o]=e[o]}return n}p.__bit_component=o,s.__bit_component=o,a.__bit_component=o,c.__bit_component=o;var l={},d="wrapper";function m(e){var t=e.components,n=a(e,i);return(0,r.mdx)(d,s({},l,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)("p",null,"Typescript aspect implements the ",(0,r.mdx)("inlineCode",{parentName:"p"},"Compiler")," interface and provides the ability to transpile files on the workspace and build components in the isolated capsules."),(0,r.mdx)("h2",null,"Configuration - tsconfig.json"),(0,r.mdx)("p",null,"An env that uses typescript compiler can have two tsconfig.json files, one for the workspace and one for the build process."),(0,r.mdx)("p",null,"On the workspace, the following two configurations are overridden:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"compilerOptions.sourceRoot = <componentDir>;\ncompilerOptions.rootDir = '.';\n")),(0,r.mdx)("p",null,"The reason to override them is to make the source-map working on the workspace."),(0,r.mdx)("p",null,"As a reminder, the ",(0,r.mdx)("inlineCode",{parentName:"p"},"dists")," are written into the node_modules and not in the component-dir, without the configuration above, the source-map won't have the correct ",(0,r.mdx)("inlineCode",{parentName:"p"},"sourceRoot")," and ",(0,r.mdx)("inlineCode",{parentName:"p"},"sources")," values, and as a result, the debugger won't work."),(0,r.mdx)("p",null,"On the capsules, the following configurion is overridden:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"compilerOptions.outDir = <CompilerOptions.distDir>\n")),(0,r.mdx)("p",null,"This is done to avoid confusion when the distDir is ",(0,r.mdx)("inlineCode",{parentName:"p"},"x")," and ts-config outDir is ",(0,r.mdx)("inlineCode",{parentName:"p"},"y"),",\nin which case, the dists in the capsule are written into ",(0,r.mdx)("inlineCode",{parentName:"p"},"y"),", but other bit processes expect to find them in ",(0,r.mdx)("inlineCode",{parentName:"p"},"x"),"."),(0,r.mdx)("h1",null,"Override typescript configuration in a custom env:"),(0,r.mdx)("p",null,"When creating a new custom environment, use the following API to change the typescript compiler config."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"useTypescript(modifiers?: UseTypescriptModifiers, tsModule: any = ts)\n")),(0,r.mdx)("p",null,"The modifiers are:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"type UseTypescriptModifiers = {\n buildConfig?: TsConfigTransformer[];\n devConfig?: TsConfigTransformer[];\n};\n")),(0,r.mdx)("p",null,"As you can see, you can customize the configuration for both: the build process and for the compilation on the workspace."),(0,r.mdx)("p",null,"An example of a TsConfigTransformer used by ",(0,r.mdx)("inlineCode",{parentName:"p"},"teambit/aspect")," for the build process, which uses the typescript compiler only for generating the types:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"const tsconfig = require(\"./tsconfig.json\");\n\nconst transformer: TsConfigTransformer = (config: TypescriptConfigMutator) => {\n config\n .mergeTsConfig(tsconfig)\n .setArtifactName('declaration')\n .setDistGlobPatterns([`dist/**/*.d.ts`])\n .setShouldCopyNonSupportedFiles(false);\n return config;\n };\n")),(0,r.mdx)("p",null,"In the last example, a custom tsconfig.json was merged to the builtin tsconfig.json."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},'{\n "compilerOptions": {\n ...\n "emitDeclarationOnly": true,\n ...\n },\n}\n')),(0,r.mdx)("p",null,"Some more props were changed as well to accomodate this env"))}m.__bit_component=o,m.isMDXComponent=!0},53235:(e,t,n)=>{var o={id:"teambit.typescript/typescript@1.0.492",homepage:"https://bit.cloud/teambit/typescript/typescript",exported:!0};function r(){const e=i(n(41594));return r=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=o,i.__bit_component=o;const p=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/brands/logo-typescript.svg"}));p.__bit_component=o,t.Logo=p},5016:e=>{e.exports=MdxJsReact},41594:e=>{e.exports=React}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.r(o),n.d(o,{compositions:()=>f,compositions_metadata:()=>h,overview:()=>y});var r={};n.r(r),n.d(r,{default:()=>u});var i=n(53235),p=(n(41594),n(5016));const s=TeambitMdxUiMdxScopeContext;var a=n(61819),c=["components"];function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l.apply(null,arguments)}var d={},m="wrapper";function u(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.includes(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,c);return(0,p.mdx)(m,l({},d,n,{components:t,mdxType:"MDXLayout"}),(0,p.mdx)(s.MDXScopeProvider,{components:{Typescript:a.S},mdxType:"MDXScopeProvider"},(0,p.mdx)(a.S,{mdxType:"Typescript"})))}u.isMDXComponent=!0;const f=[i],y=[r],h={compositions:[{displayName:"Logo",identifier:"Logo"}]};return o})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.typescript/typescript-preview"]=t():e["teambit.typescript/typescript-preview"]=t()}(self,(()=>(()=>{"use strict";var e={61819:(e,t,n)=>{Object.defineProperty(t,"S",{enumerable:!0,get:function(){return o.default}});var o=r(n(36213));function r(e){return e&&e.__esModule?e:{default:e}}r.__bit_component={id:"teambit.typescript/aspect-docs/typescript@0.0.169",homepage:"https://bit.cloud/teambit/typescript/aspect-docs/typescript",exported:!0}},36213:(e,t,n)=>{var o={id:"teambit.typescript/aspect-docs/typescript@0.0.169",homepage:"https://bit.cloud/teambit/typescript/aspect-docs/typescript",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=m,p(n(41594));var r=n(5016),i=["components"];function p(e){return e&&e.__esModule?e:{default:e}}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s.apply(null,arguments)}function a(e,t){if(null==e)return{};var n,o,r=c(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function c(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.includes(o))continue;n[o]=e[o]}return n}p.__bit_component=o,s.__bit_component=o,a.__bit_component=o,c.__bit_component=o;var l={},d="wrapper";function m(e){var t=e.components,n=a(e,i);return(0,r.mdx)(d,s({},l,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)("p",null,"Typescript aspect implements the ",(0,r.mdx)("inlineCode",{parentName:"p"},"Compiler")," interface and provides the ability to transpile files on the workspace and build components in the isolated capsules."),(0,r.mdx)("h2",null,"Configuration - tsconfig.json"),(0,r.mdx)("p",null,"An env that uses typescript compiler can have two tsconfig.json files, one for the workspace and one for the build process."),(0,r.mdx)("p",null,"On the workspace, the following two configurations are overridden:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"compilerOptions.sourceRoot = <componentDir>;\ncompilerOptions.rootDir = '.';\n")),(0,r.mdx)("p",null,"The reason to override them is to make the source-map working on the workspace."),(0,r.mdx)("p",null,"As a reminder, the ",(0,r.mdx)("inlineCode",{parentName:"p"},"dists")," are written into the node_modules and not in the component-dir, without the configuration above, the source-map won't have the correct ",(0,r.mdx)("inlineCode",{parentName:"p"},"sourceRoot")," and ",(0,r.mdx)("inlineCode",{parentName:"p"},"sources")," values, and as a result, the debugger won't work."),(0,r.mdx)("p",null,"On the capsules, the following configurion is overridden:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"compilerOptions.outDir = <CompilerOptions.distDir>\n")),(0,r.mdx)("p",null,"This is done to avoid confusion when the distDir is ",(0,r.mdx)("inlineCode",{parentName:"p"},"x")," and ts-config outDir is ",(0,r.mdx)("inlineCode",{parentName:"p"},"y"),",\nin which case, the dists in the capsule are written into ",(0,r.mdx)("inlineCode",{parentName:"p"},"y"),", but other bit processes expect to find them in ",(0,r.mdx)("inlineCode",{parentName:"p"},"x"),"."),(0,r.mdx)("h1",null,"Override typescript configuration in a custom env:"),(0,r.mdx)("p",null,"When creating a new custom environment, use the following API to change the typescript compiler config."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"useTypescript(modifiers?: UseTypescriptModifiers, tsModule: any = ts)\n")),(0,r.mdx)("p",null,"The modifiers are:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"type UseTypescriptModifiers = {\n buildConfig?: TsConfigTransformer[];\n devConfig?: TsConfigTransformer[];\n};\n")),(0,r.mdx)("p",null,"As you can see, you can customize the configuration for both: the build process and for the compilation on the workspace."),(0,r.mdx)("p",null,"An example of a TsConfigTransformer used by ",(0,r.mdx)("inlineCode",{parentName:"p"},"teambit/aspect")," for the build process, which uses the typescript compiler only for generating the types:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"const tsconfig = require(\"./tsconfig.json\");\n\nconst transformer: TsConfigTransformer = (config: TypescriptConfigMutator) => {\n config\n .mergeTsConfig(tsconfig)\n .setArtifactName('declaration')\n .setDistGlobPatterns([`dist/**/*.d.ts`])\n .setShouldCopyNonSupportedFiles(false);\n return config;\n };\n")),(0,r.mdx)("p",null,"In the last example, a custom tsconfig.json was merged to the builtin tsconfig.json."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},'{\n "compilerOptions": {\n ...\n "emitDeclarationOnly": true,\n ...\n },\n}\n')),(0,r.mdx)("p",null,"Some more props were changed as well to accomodate this env"))}m.__bit_component=o,m.isMDXComponent=!0},20632:(e,t,n)=>{var o={id:"teambit.typescript/typescript@1.0.493",homepage:"https://bit.cloud/teambit/typescript/typescript",exported:!0};function r(){const e=i(n(41594));return r=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=o,i.__bit_component=o;const p=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/brands/logo-typescript.svg"}));p.__bit_component=o,t.Logo=p},5016:e=>{e.exports=MdxJsReact},41594:e=>{e.exports=React}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.r(o),n.d(o,{compositions:()=>f,compositions_metadata:()=>h,overview:()=>y});var r={};n.r(r),n.d(r,{default:()=>u});var i=n(20632),p=(n(41594),n(5016));const s=TeambitMdxUiMdxScopeContext;var a=n(61819),c=["components"];function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l.apply(null,arguments)}var d={},m="wrapper";function u(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.includes(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,c);return(0,p.mdx)(m,l({},d,n,{components:t,mdxType:"MDXLayout"}),(0,p.mdx)(s.MDXScopeProvider,{components:{Typescript:a.S},mdxType:"MDXScopeProvider"},(0,p.mdx)(a.S,{mdxType:"Typescript"})))}u.isMDXComponent=!0;const f=[i],y=[r],h={compositions:[{displayName:"Logo",identifier:"Logo"}]};return o})()));
@@ -382,7 +382,7 @@
382
382
  "componentId": {
383
383
  "scope": "teambit.component",
384
384
  "name": "sources",
385
- "version": "0.0.56"
385
+ "version": "0.0.57"
386
386
  }
387
387
  },
388
388
  "isOptional": false,
@@ -492,7 +492,7 @@
492
492
  "componentId": {
493
493
  "scope": "teambit.semantics",
494
494
  "name": "entities/semantic-schema",
495
- "version": "0.0.75"
495
+ "version": "0.0.76"
496
496
  }
497
497
  }
498
498
  ]
@@ -557,7 +557,7 @@
557
557
  "componentId": {
558
558
  "scope": "teambit.component",
559
559
  "name": "sources",
560
- "version": "0.0.56"
560
+ "version": "0.0.57"
561
561
  }
562
562
  }
563
563
  },
@@ -736,7 +736,7 @@
736
736
  "componentId": {
737
737
  "scope": "teambit.semantics",
738
738
  "name": "entities/semantic-schema",
739
- "version": "0.0.75"
739
+ "version": "0.0.76"
740
740
  }
741
741
  }
742
742
  ]
@@ -774,7 +774,7 @@
774
774
  "componentId": {
775
775
  "scope": "teambit.semantics",
776
776
  "name": "entities/semantic-schema",
777
- "version": "0.0.75"
777
+ "version": "0.0.76"
778
778
  }
779
779
  },
780
780
  "isOptional": false,
@@ -821,7 +821,7 @@
821
821
  "componentId": {
822
822
  "scope": "teambit.semantics",
823
823
  "name": "entities/semantic-schema",
824
- "version": "0.0.75"
824
+ "version": "0.0.76"
825
825
  }
826
826
  }
827
827
  ]
@@ -977,7 +977,7 @@
977
977
  "componentId": {
978
978
  "scope": "teambit.semantics",
979
979
  "name": "entities/semantic-schema",
980
- "version": "0.0.75"
980
+ "version": "0.0.76"
981
981
  }
982
982
  },
983
983
  "isOptional": false,
@@ -1064,7 +1064,7 @@
1064
1064
  "_legacy": {
1065
1065
  "scope": "teambit.typescript",
1066
1066
  "name": "typescript",
1067
- "version": "1.0.492"
1067
+ "version": "1.0.493"
1068
1068
  },
1069
1069
  "_scope": "teambit.typescript"
1070
1070
  }
@@ -1469,7 +1469,7 @@
1469
1469
  "componentId": {
1470
1470
  "scope": "teambit.typescript",
1471
1471
  "name": "ts-server",
1472
- "version": "0.0.58"
1472
+ "version": "0.0.59"
1473
1473
  }
1474
1474
  },
1475
1475
  {
@@ -1689,7 +1689,7 @@
1689
1689
  "componentId": {
1690
1690
  "scope": "teambit.typescript",
1691
1691
  "name": "ts-server",
1692
- "version": "0.0.58"
1692
+ "version": "0.0.59"
1693
1693
  }
1694
1694
  },
1695
1695
  "isOptional": true,
@@ -1746,7 +1746,7 @@
1746
1746
  "componentId": {
1747
1747
  "scope": "teambit.typescript",
1748
1748
  "name": "ts-server",
1749
- "version": "0.0.58"
1749
+ "version": "0.0.59"
1750
1750
  }
1751
1751
  }
1752
1752
  ]
@@ -1828,7 +1828,7 @@
1828
1828
  "componentId": {
1829
1829
  "scope": "teambit.typescript",
1830
1830
  "name": "ts-server",
1831
- "version": "0.0.58"
1831
+ "version": "0.0.59"
1832
1832
  }
1833
1833
  },
1834
1834
  "isOptional": true,
@@ -1885,7 +1885,7 @@
1885
1885
  "componentId": {
1886
1886
  "scope": "teambit.typescript",
1887
1887
  "name": "ts-server",
1888
- "version": "0.0.58"
1888
+ "version": "0.0.59"
1889
1889
  }
1890
1890
  }
1891
1891
  ]
@@ -4416,7 +4416,7 @@
4416
4416
  "componentId": {
4417
4417
  "scope": "teambit.semantics",
4418
4418
  "name": "entities/semantic-schema",
4419
- "version": "0.0.75"
4419
+ "version": "0.0.76"
4420
4420
  }
4421
4421
  },
4422
4422
  "isOptional": false,
@@ -4463,7 +4463,7 @@
4463
4463
  "componentId": {
4464
4464
  "scope": "teambit.semantics",
4465
4465
  "name": "entities/semantic-schema",
4466
- "version": "0.0.75"
4466
+ "version": "0.0.76"
4467
4467
  }
4468
4468
  },
4469
4469
  "isOptional": false,
@@ -4518,7 +4518,7 @@
4518
4518
  "componentId": {
4519
4519
  "scope": "teambit.semantics",
4520
4520
  "name": "entities/semantic-schema",
4521
- "version": "0.0.75"
4521
+ "version": "0.0.76"
4522
4522
  }
4523
4523
  },
4524
4524
  {
@@ -4786,7 +4786,7 @@
4786
4786
  "componentId": {
4787
4787
  "scope": "teambit.semantics",
4788
4788
  "name": "entities/semantic-schema",
4789
- "version": "0.0.75"
4789
+ "version": "0.0.76"
4790
4790
  }
4791
4791
  }
4792
4792
  ]
@@ -4959,7 +4959,7 @@
4959
4959
  "componentId": {
4960
4960
  "scope": "teambit.typescript",
4961
4961
  "name": "ts-server",
4962
- "version": "0.0.58"
4962
+ "version": "0.0.59"
4963
4963
  }
4964
4964
  },
4965
4965
  "isOptional": false,
@@ -5146,7 +5146,7 @@
5146
5146
  "componentId": {
5147
5147
  "scope": "teambit.semantics",
5148
5148
  "name": "entities/semantic-schema",
5149
- "version": "0.0.75"
5149
+ "version": "0.0.76"
5150
5150
  }
5151
5151
  },
5152
5152
  "isOptional": false,
@@ -5333,7 +5333,7 @@
5333
5333
  "componentId": {
5334
5334
  "scope": "teambit.semantics",
5335
5335
  "name": "entities/semantic-schema",
5336
- "version": "0.0.75"
5336
+ "version": "0.0.76"
5337
5337
  }
5338
5338
  },
5339
5339
  "isOptional": false,
@@ -5571,7 +5571,7 @@
5571
5571
  "componentId": {
5572
5572
  "scope": "teambit.semantics",
5573
5573
  "name": "entities/semantic-schema",
5574
- "version": "0.0.75"
5574
+ "version": "0.0.76"
5575
5575
  }
5576
5576
  }
5577
5577
  ]
@@ -5609,7 +5609,7 @@
5609
5609
  "componentId": {
5610
5610
  "scope": "teambit.semantics",
5611
5611
  "name": "entities/semantic-schema",
5612
- "version": "0.0.75"
5612
+ "version": "0.0.76"
5613
5613
  }
5614
5614
  },
5615
5615
  "isOptional": false,
@@ -5724,7 +5724,7 @@
5724
5724
  "componentId": {
5725
5725
  "scope": "teambit.semantics",
5726
5726
  "name": "entities/semantic-schema",
5727
- "version": "0.0.75"
5727
+ "version": "0.0.76"
5728
5728
  }
5729
5729
  },
5730
5730
  "modifiers": []
@@ -6612,7 +6612,7 @@
6612
6612
  "componentId": {
6613
6613
  "scope": "teambit.semantics",
6614
6614
  "name": "entities/semantic-schema",
6615
- "version": "0.0.75"
6615
+ "version": "0.0.76"
6616
6616
  }
6617
6617
  },
6618
6618
  {
@@ -6684,7 +6684,7 @@
6684
6684
  "componentId": {
6685
6685
  "scope": "teambit.semantics",
6686
6686
  "name": "entities/semantic-schema",
6687
- "version": "0.0.75"
6687
+ "version": "0.0.76"
6688
6688
  }
6689
6689
  }
6690
6690
  ]
@@ -7195,7 +7195,7 @@
7195
7195
  "componentId": {
7196
7196
  "scope": "teambit.semantics",
7197
7197
  "name": "entities/semantic-schema",
7198
- "version": "0.0.75"
7198
+ "version": "0.0.76"
7199
7199
  }
7200
7200
  }
7201
7201
  ]
@@ -7273,7 +7273,7 @@
7273
7273
  "componentId": {
7274
7274
  "scope": "teambit.semantics",
7275
7275
  "name": "entities/semantic-schema",
7276
- "version": "0.0.75"
7276
+ "version": "0.0.76"
7277
7277
  }
7278
7278
  },
7279
7279
  "isOptional": false,
@@ -7308,7 +7308,7 @@
7308
7308
  "componentId": {
7309
7309
  "scope": "teambit.semantics",
7310
7310
  "name": "entities/semantic-schema",
7311
- "version": "0.0.75"
7311
+ "version": "0.0.76"
7312
7312
  }
7313
7313
  },
7314
7314
  {
@@ -7378,7 +7378,7 @@
7378
7378
  "componentId": {
7379
7379
  "scope": "teambit.semantics",
7380
7380
  "name": "entities/semantic-schema",
7381
- "version": "0.0.75"
7381
+ "version": "0.0.76"
7382
7382
  }
7383
7383
  },
7384
7384
  "isOptional": false,
@@ -7425,7 +7425,7 @@
7425
7425
  "componentId": {
7426
7426
  "scope": "teambit.semantics",
7427
7427
  "name": "entities/semantic-schema",
7428
- "version": "0.0.75"
7428
+ "version": "0.0.76"
7429
7429
  }
7430
7430
  }
7431
7431
  ]
@@ -7486,7 +7486,7 @@
7486
7486
  "componentId": {
7487
7487
  "scope": "teambit.semantics",
7488
7488
  "name": "entities/semantic-schema",
7489
- "version": "0.0.75"
7489
+ "version": "0.0.76"
7490
7490
  }
7491
7491
  }
7492
7492
  ]
@@ -7564,7 +7564,7 @@
7564
7564
  "componentId": {
7565
7565
  "scope": "teambit.semantics",
7566
7566
  "name": "entities/semantic-schema",
7567
- "version": "0.0.75"
7567
+ "version": "0.0.76"
7568
7568
  }
7569
7569
  },
7570
7570
  "isOptional": false,
@@ -7591,7 +7591,7 @@
7591
7591
  "componentId": {
7592
7592
  "scope": "teambit.semantics",
7593
7593
  "name": "entities/semantic-schema",
7594
- "version": "0.0.75"
7594
+ "version": "0.0.76"
7595
7595
  }
7596
7596
  }
7597
7597
  ]
@@ -7660,7 +7660,7 @@
7660
7660
  "componentId": {
7661
7661
  "scope": "teambit.semantics",
7662
7662
  "name": "entities/semantic-schema",
7663
- "version": "0.0.75"
7663
+ "version": "0.0.76"
7664
7664
  }
7665
7665
  },
7666
7666
  {
@@ -8033,7 +8033,7 @@
8033
8033
  "componentId": {
8034
8034
  "scope": "teambit.component",
8035
8035
  "name": "sources",
8036
- "version": "0.0.56"
8036
+ "version": "0.0.57"
8037
8037
  }
8038
8038
  },
8039
8039
  "isOptional": false,
@@ -8143,7 +8143,7 @@
8143
8143
  "componentId": {
8144
8144
  "scope": "teambit.semantics",
8145
8145
  "name": "entities/semantic-schema",
8146
- "version": "0.0.75"
8146
+ "version": "0.0.76"
8147
8147
  }
8148
8148
  }
8149
8149
  ]
@@ -8208,7 +8208,7 @@
8208
8208
  "componentId": {
8209
8209
  "scope": "teambit.component",
8210
8210
  "name": "sources",
8211
- "version": "0.0.56"
8211
+ "version": "0.0.57"
8212
8212
  }
8213
8213
  }
8214
8214
  },
@@ -8387,7 +8387,7 @@
8387
8387
  "componentId": {
8388
8388
  "scope": "teambit.semantics",
8389
8389
  "name": "entities/semantic-schema",
8390
- "version": "0.0.75"
8390
+ "version": "0.0.76"
8391
8391
  }
8392
8392
  }
8393
8393
  ]
@@ -8425,7 +8425,7 @@
8425
8425
  "componentId": {
8426
8426
  "scope": "teambit.semantics",
8427
8427
  "name": "entities/semantic-schema",
8428
- "version": "0.0.75"
8428
+ "version": "0.0.76"
8429
8429
  }
8430
8430
  },
8431
8431
  "isOptional": false,
@@ -8472,7 +8472,7 @@
8472
8472
  "componentId": {
8473
8473
  "scope": "teambit.semantics",
8474
8474
  "name": "entities/semantic-schema",
8475
- "version": "0.0.75"
8475
+ "version": "0.0.76"
8476
8476
  }
8477
8477
  }
8478
8478
  ]
@@ -8628,7 +8628,7 @@
8628
8628
  "componentId": {
8629
8629
  "scope": "teambit.semantics",
8630
8630
  "name": "entities/semantic-schema",
8631
- "version": "0.0.75"
8631
+ "version": "0.0.76"
8632
8632
  }
8633
8633
  },
8634
8634
  "isOptional": false,
@@ -8715,7 +8715,7 @@
8715
8715
  "_legacy": {
8716
8716
  "scope": "teambit.typescript",
8717
8717
  "name": "typescript",
8718
- "version": "1.0.492"
8718
+ "version": "1.0.493"
8719
8719
  },
8720
8720
  "_scope": "teambit.typescript"
8721
8721
  }
@@ -9443,7 +9443,7 @@
9443
9443
  "componentId": {
9444
9444
  "scope": "teambit.typescript",
9445
9445
  "name": "ts-server",
9446
- "version": "0.0.58"
9446
+ "version": "0.0.59"
9447
9447
  }
9448
9448
  },
9449
9449
  {
@@ -9663,7 +9663,7 @@
9663
9663
  "componentId": {
9664
9664
  "scope": "teambit.typescript",
9665
9665
  "name": "ts-server",
9666
- "version": "0.0.58"
9666
+ "version": "0.0.59"
9667
9667
  }
9668
9668
  },
9669
9669
  "isOptional": true,
@@ -9720,7 +9720,7 @@
9720
9720
  "componentId": {
9721
9721
  "scope": "teambit.typescript",
9722
9722
  "name": "ts-server",
9723
- "version": "0.0.58"
9723
+ "version": "0.0.59"
9724
9724
  }
9725
9725
  }
9726
9726
  ]
@@ -9802,7 +9802,7 @@
9802
9802
  "componentId": {
9803
9803
  "scope": "teambit.typescript",
9804
9804
  "name": "ts-server",
9805
- "version": "0.0.58"
9805
+ "version": "0.0.59"
9806
9806
  }
9807
9807
  },
9808
9808
  "isOptional": true,
@@ -9859,7 +9859,7 @@
9859
9859
  "componentId": {
9860
9860
  "scope": "teambit.typescript",
9861
9861
  "name": "ts-server",
9862
- "version": "0.0.58"
9862
+ "version": "0.0.59"
9863
9863
  }
9864
9864
  }
9865
9865
  ]
@@ -11997,7 +11997,7 @@
11997
11997
  "componentId": {
11998
11998
  "scope": "teambit.semantics",
11999
11999
  "name": "entities/semantic-schema",
12000
- "version": "0.0.75"
12000
+ "version": "0.0.76"
12001
12001
  }
12002
12002
  }
12003
12003
  ]
@@ -12053,7 +12053,7 @@
12053
12053
  "componentId": {
12054
12054
  "scope": "teambit.semantics",
12055
12055
  "name": "entities/semantic-schema",
12056
- "version": "0.0.75"
12056
+ "version": "0.0.76"
12057
12057
  }
12058
12058
  },
12059
12059
  "isOptional": false,
@@ -12100,7 +12100,7 @@
12100
12100
  "componentId": {
12101
12101
  "scope": "teambit.semantics",
12102
12102
  "name": "entities/semantic-schema",
12103
- "version": "0.0.75"
12103
+ "version": "0.0.76"
12104
12104
  }
12105
12105
  },
12106
12106
  "isOptional": false,
@@ -12155,7 +12155,7 @@
12155
12155
  "componentId": {
12156
12156
  "scope": "teambit.semantics",
12157
12157
  "name": "entities/semantic-schema",
12158
- "version": "0.0.75"
12158
+ "version": "0.0.76"
12159
12159
  }
12160
12160
  },
12161
12161
  {
@@ -12340,7 +12340,7 @@
12340
12340
  "componentId": {
12341
12341
  "scope": "teambit.typescript",
12342
12342
  "name": "ts-server",
12343
- "version": "0.0.58"
12343
+ "version": "0.0.59"
12344
12344
  }
12345
12345
  },
12346
12346
  "isOptional": false,
@@ -12527,7 +12527,7 @@
12527
12527
  "componentId": {
12528
12528
  "scope": "teambit.semantics",
12529
12529
  "name": "entities/semantic-schema",
12530
- "version": "0.0.75"
12530
+ "version": "0.0.76"
12531
12531
  }
12532
12532
  },
12533
12533
  "isOptional": false,
@@ -12714,7 +12714,7 @@
12714
12714
  "componentId": {
12715
12715
  "scope": "teambit.semantics",
12716
12716
  "name": "entities/semantic-schema",
12717
- "version": "0.0.75"
12717
+ "version": "0.0.76"
12718
12718
  }
12719
12719
  },
12720
12720
  "isOptional": false,
@@ -12952,7 +12952,7 @@
12952
12952
  "componentId": {
12953
12953
  "scope": "teambit.semantics",
12954
12954
  "name": "entities/semantic-schema",
12955
- "version": "0.0.75"
12955
+ "version": "0.0.76"
12956
12956
  }
12957
12957
  }
12958
12958
  ]
@@ -12990,7 +12990,7 @@
12990
12990
  "componentId": {
12991
12991
  "scope": "teambit.semantics",
12992
12992
  "name": "entities/semantic-schema",
12993
- "version": "0.0.75"
12993
+ "version": "0.0.76"
12994
12994
  }
12995
12995
  },
12996
12996
  "isOptional": false,
@@ -13105,7 +13105,7 @@
13105
13105
  "componentId": {
13106
13106
  "scope": "teambit.semantics",
13107
13107
  "name": "entities/semantic-schema",
13108
- "version": "0.0.75"
13108
+ "version": "0.0.76"
13109
13109
  }
13110
13110
  },
13111
13111
  "modifiers": []
@@ -13993,7 +13993,7 @@
13993
13993
  "componentId": {
13994
13994
  "scope": "teambit.semantics",
13995
13995
  "name": "entities/semantic-schema",
13996
- "version": "0.0.75"
13996
+ "version": "0.0.76"
13997
13997
  }
13998
13998
  },
13999
13999
  {
@@ -14065,7 +14065,7 @@
14065
14065
  "componentId": {
14066
14066
  "scope": "teambit.semantics",
14067
14067
  "name": "entities/semantic-schema",
14068
- "version": "0.0.75"
14068
+ "version": "0.0.76"
14069
14069
  }
14070
14070
  }
14071
14071
  ]
@@ -14576,7 +14576,7 @@
14576
14576
  "componentId": {
14577
14577
  "scope": "teambit.semantics",
14578
14578
  "name": "entities/semantic-schema",
14579
- "version": "0.0.75"
14579
+ "version": "0.0.76"
14580
14580
  }
14581
14581
  }
14582
14582
  ]
@@ -14654,7 +14654,7 @@
14654
14654
  "componentId": {
14655
14655
  "scope": "teambit.semantics",
14656
14656
  "name": "entities/semantic-schema",
14657
- "version": "0.0.75"
14657
+ "version": "0.0.76"
14658
14658
  }
14659
14659
  },
14660
14660
  "isOptional": false,
@@ -14689,7 +14689,7 @@
14689
14689
  "componentId": {
14690
14690
  "scope": "teambit.semantics",
14691
14691
  "name": "entities/semantic-schema",
14692
- "version": "0.0.75"
14692
+ "version": "0.0.76"
14693
14693
  }
14694
14694
  },
14695
14695
  {
@@ -14759,7 +14759,7 @@
14759
14759
  "componentId": {
14760
14760
  "scope": "teambit.semantics",
14761
14761
  "name": "entities/semantic-schema",
14762
- "version": "0.0.75"
14762
+ "version": "0.0.76"
14763
14763
  }
14764
14764
  },
14765
14765
  "isOptional": false,
@@ -14806,7 +14806,7 @@
14806
14806
  "componentId": {
14807
14807
  "scope": "teambit.semantics",
14808
14808
  "name": "entities/semantic-schema",
14809
- "version": "0.0.75"
14809
+ "version": "0.0.76"
14810
14810
  }
14811
14811
  }
14812
14812
  ]
@@ -14867,7 +14867,7 @@
14867
14867
  "componentId": {
14868
14868
  "scope": "teambit.semantics",
14869
14869
  "name": "entities/semantic-schema",
14870
- "version": "0.0.75"
14870
+ "version": "0.0.76"
14871
14871
  }
14872
14872
  }
14873
14873
  ]
@@ -14945,7 +14945,7 @@
14945
14945
  "componentId": {
14946
14946
  "scope": "teambit.semantics",
14947
14947
  "name": "entities/semantic-schema",
14948
- "version": "0.0.75"
14948
+ "version": "0.0.76"
14949
14949
  }
14950
14950
  },
14951
14951
  "isOptional": false,
@@ -14972,7 +14972,7 @@
14972
14972
  "componentId": {
14973
14973
  "scope": "teambit.semantics",
14974
14974
  "name": "entities/semantic-schema",
14975
- "version": "0.0.75"
14975
+ "version": "0.0.76"
14976
14976
  }
14977
14977
  }
14978
14978
  ]
@@ -15041,7 +15041,7 @@
15041
15041
  "componentId": {
15042
15042
  "scope": "teambit.semantics",
15043
15043
  "name": "entities/semantic-schema",
15044
- "version": "0.0.75"
15044
+ "version": "0.0.76"
15045
15045
  }
15046
15046
  },
15047
15047
  {
@@ -15072,7 +15072,7 @@
15072
15072
  "componentId": {
15073
15073
  "scope": "teambit.typescript",
15074
15074
  "name": "typescript",
15075
- "version": "1.0.492"
15075
+ "version": "1.0.493"
15076
15076
  },
15077
15077
  "taggedModuleExports": []
15078
15078
  }
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.492/dist/typescript.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.492/dist/typescript.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.493/dist/typescript.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.493/dist/typescript.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -30,7 +30,7 @@ const expressionStatementTransformer = mapping => {
30
30
  return _typescript().default.factory.createIdentifier(newName);
31
31
  }
32
32
  return identifier;
33
- } catch (e) {
33
+ } catch {
34
34
  return identifier;
35
35
  }
36
36
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_typescript","data","_interopRequireDefault","require","_replaceName","e","__esModule","default","expressionStatementTransformer","mapping","context","replaceIdentifierText","identifier","ts","isIdentifier","oldName","getText","newName","replaceName","factory","createIdentifier","visit","node","isExpressionStatement","updateExpressionStatement","visitNode","expression","isPropertyAccessExpression","name","updatePropertyAccessExpression","visitEachChild","exports"],"sources":["expression-statement.ts"],"sourcesContent":["import ts from 'typescript';\nimport { SourceFileTransformer } from './index';\nimport { replaceName } from './replaceName';\n\nexport const expressionStatementTransformer: SourceFileTransformer = (mapping: Record<string, string>) => {\n return (context) => {\n const replaceIdentifierText = (identifier: ts.Identifier) => {\n try {\n if (!identifier || !ts.isIdentifier(identifier)) return identifier;\n const oldName = identifier.getText();\n const newName = replaceName(oldName, mapping);\n\n if (newName) {\n return ts.factory.createIdentifier(newName);\n }\n return identifier;\n } catch (e) {\n return identifier;\n }\n };\n\n const visit: ts.Visitor = (node) => {\n if (ts.isExpressionStatement(node)) {\n return ts.factory.updateExpressionStatement(node, ts.visitNode(node.expression, visit) as ts.Expression);\n }\n\n if (ts.isPropertyAccessExpression(node)) {\n let newName = node.name;\n if (ts.isIdentifier(node.name)) {\n newName = replaceIdentifierText(node.name);\n }\n return ts.factory.updatePropertyAccessExpression(\n node,\n ts.visitNode(node.expression, visit) as ts.Expression,\n newName\n );\n }\n\n if (ts.isIdentifier(node)) {\n return replaceIdentifierText(node);\n }\n\n return ts.visitEachChild(node, visit, context);\n };\n\n return (node) => ts.visitNode(node, visit) as ts.SourceFile;\n };\n};\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4C,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAErC,MAAMG,8BAAqD,GAAIC,OAA+B,IAAK;EACxG,OAAQC,OAAO,IAAK;IAClB,MAAMC,qBAAqB,GAAIC,UAAyB,IAAK;MAC3D,IAAI;QACF,IAAI,CAACA,UAAU,IAAI,CAACC,qBAAE,CAACC,YAAY,CAACF,UAAU,CAAC,EAAE,OAAOA,UAAU;QAClE,MAAMG,OAAO,GAAGH,UAAU,CAACI,OAAO,CAAC,CAAC;QACpC,MAAMC,OAAO,GAAG,IAAAC,0BAAW,EAACH,OAAO,EAAEN,OAAO,CAAC;QAE7C,IAAIQ,OAAO,EAAE;UACX,OAAOJ,qBAAE,CAACM,OAAO,CAACC,gBAAgB,CAACH,OAAO,CAAC;QAC7C;QACA,OAAOL,UAAU;MACnB,CAAC,CAAC,OAAOP,CAAC,EAAE;QACV,OAAOO,UAAU;MACnB;IACF,CAAC;IAED,MAAMS,KAAiB,GAAIC,IAAI,IAAK;MAClC,IAAIT,qBAAE,CAACU,qBAAqB,CAACD,IAAI,CAAC,EAAE;QAClC,OAAOT,qBAAE,CAACM,OAAO,CAACK,yBAAyB,CAACF,IAAI,EAAET,qBAAE,CAACY,SAAS,CAACH,IAAI,CAACI,UAAU,EAAEL,KAAK,CAAkB,CAAC;MAC1G;MAEA,IAAIR,qBAAE,CAACc,0BAA0B,CAACL,IAAI,CAAC,EAAE;QACvC,IAAIL,OAAO,GAAGK,IAAI,CAACM,IAAI;QACvB,IAAIf,qBAAE,CAACC,YAAY,CAACQ,IAAI,CAACM,IAAI,CAAC,EAAE;UAC9BX,OAAO,GAAGN,qBAAqB,CAACW,IAAI,CAACM,IAAI,CAAC;QAC5C;QACA,OAAOf,qBAAE,CAACM,OAAO,CAACU,8BAA8B,CAC9CP,IAAI,EACJT,qBAAE,CAACY,SAAS,CAACH,IAAI,CAACI,UAAU,EAAEL,KAAK,CAAC,EACpCJ,OACF,CAAC;MACH;MAEA,IAAIJ,qBAAE,CAACC,YAAY,CAACQ,IAAI,CAAC,EAAE;QACzB,OAAOX,qBAAqB,CAACW,IAAI,CAAC;MACpC;MAEA,OAAOT,qBAAE,CAACiB,cAAc,CAACR,IAAI,EAAED,KAAK,EAAEX,OAAO,CAAC;IAChD,CAAC;IAED,OAAQY,IAAI,IAAKT,qBAAE,CAACY,SAAS,CAACH,IAAI,EAAED,KAAK,CAAkB;EAC7D,CAAC;AACH,CAAC;AAACU,OAAA,CAAAvB,8BAAA,GAAAA,8BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_typescript","data","_interopRequireDefault","require","_replaceName","e","__esModule","default","expressionStatementTransformer","mapping","context","replaceIdentifierText","identifier","ts","isIdentifier","oldName","getText","newName","replaceName","factory","createIdentifier","visit","node","isExpressionStatement","updateExpressionStatement","visitNode","expression","isPropertyAccessExpression","name","updatePropertyAccessExpression","visitEachChild","exports"],"sources":["expression-statement.ts"],"sourcesContent":["import ts from 'typescript';\nimport { SourceFileTransformer } from './index';\nimport { replaceName } from './replaceName';\n\nexport const expressionStatementTransformer: SourceFileTransformer = (mapping: Record<string, string>) => {\n return (context) => {\n const replaceIdentifierText = (identifier: ts.Identifier) => {\n try {\n if (!identifier || !ts.isIdentifier(identifier)) return identifier;\n const oldName = identifier.getText();\n const newName = replaceName(oldName, mapping);\n\n if (newName) {\n return ts.factory.createIdentifier(newName);\n }\n return identifier;\n } catch {\n return identifier;\n }\n };\n\n const visit: ts.Visitor = (node) => {\n if (ts.isExpressionStatement(node)) {\n return ts.factory.updateExpressionStatement(node, ts.visitNode(node.expression, visit) as ts.Expression);\n }\n\n if (ts.isPropertyAccessExpression(node)) {\n let newName = node.name;\n if (ts.isIdentifier(node.name)) {\n newName = replaceIdentifierText(node.name);\n }\n return ts.factory.updatePropertyAccessExpression(\n node,\n ts.visitNode(node.expression, visit) as ts.Expression,\n newName\n );\n }\n\n if (ts.isIdentifier(node)) {\n return replaceIdentifierText(node);\n }\n\n return ts.visitEachChild(node, visit, context);\n };\n\n return (node) => ts.visitNode(node, visit) as ts.SourceFile;\n };\n};\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4C,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAErC,MAAMG,8BAAqD,GAAIC,OAA+B,IAAK;EACxG,OAAQC,OAAO,IAAK;IAClB,MAAMC,qBAAqB,GAAIC,UAAyB,IAAK;MAC3D,IAAI;QACF,IAAI,CAACA,UAAU,IAAI,CAACC,qBAAE,CAACC,YAAY,CAACF,UAAU,CAAC,EAAE,OAAOA,UAAU;QAClE,MAAMG,OAAO,GAAGH,UAAU,CAACI,OAAO,CAAC,CAAC;QACpC,MAAMC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@@ const functionNamesTransformer = mapping => {
31
31
  }
32
32
  }
33
33
  return _typescript().default.visitEachChild(node, updateTypeReference, context);
34
- } catch (e) {
34
+ } catch {
35
35
  return node;
36
36
  }
37
37
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_typescript","data","_interopRequireDefault","require","_replaceName","e","__esModule","default","functionNamesTransformer","mapping","context","updateTypeReference","node","ts","isTypeReferenceNode","typeName","getText","getSourceFile","newTypeName","replaceName","factory","updateTypeReferenceNode","createIdentifier","typeArguments","visitEachChild","visit","isFunctionDeclaration","isArrowFunction","isFunctionExpression","functionName","name","newName","Object","entries","find","key","includes","parameters","map","param","newParamType","type","visitNode","isIdentifier","oldName","newParamName","keys","updateParameterDeclaration","modifiers","dotDotDotToken","questionToken","initializer","isObjectBindingPattern","elements","element","newElementName","updateBindingElement","propertyName","createObjectBindingPattern","updatedBody","body","isBlock","updateReturnStatement","updateFunctionDeclaration","asteriskToken","typeParameters","updateArrowFunction","equalsGreaterThanToken","updateFunctionExpression","updatedStatements","statement","statements","isReturnStatement","expression","isJsxElement","jsxElement","openingElement","tagName","newTagName","updatedTagName","updatedOpeningElement","updateJsxOpeningElement","attributes","updatedClosingElement","closingElement","updateJsxClosingElement","createJsxClosingElement","updatedJsxElement","createJsxElement","children","updatedStatement","createReturnStatement","push","updateBlock","isExpressionStatement","text","updatedExpression","updatedReturnStatement","createBlock","exports"],"sources":["function.ts"],"sourcesContent":["import ts from 'typescript';\nimport { SourceFileTransformer } from './index';\nimport { replaceName } from './replaceName';\n\nexport const functionNamesTransformer: SourceFileTransformer = (mapping: Record<string, string>) => {\n return (context) => {\n const updateTypeReference: ts.Visitor = (node) => {\n try {\n if (ts.isTypeReferenceNode(node) && node.typeName) {\n const typeName = node.typeName.getText(node.getSourceFile());\n const newTypeName = replaceName(typeName, mapping);\n if (newTypeName) {\n return ts.factory.updateTypeReferenceNode(\n node,\n ts.factory.createIdentifier(newTypeName),\n node.typeArguments\n );\n }\n }\n return ts.visitEachChild(node, updateTypeReference, context);\n } catch (e) {\n return node;\n }\n };\n\n const visit: ts.Visitor = (node) => {\n if (ts.isFunctionDeclaration(node) || ts.isArrowFunction(node) || ts.isFunctionExpression(node)) {\n const functionName = node.name?.getText() ?? '';\n const newName = Object.entries(mapping).find(([key]) => functionName.includes(key))?.[1] ?? functionName;\n const parameters = node.parameters.map((param) => {\n const newParamType = param.type ? (ts.visitNode(param.type, updateTypeReference) as ts.TypeNode) : param.type;\n if (ts.isIdentifier(param.name)) {\n const oldName = param.name.getText();\n const newParamName = Object.keys(mapping).find((key) => oldName.includes(key));\n if (newParamName) {\n return ts.factory.updateParameterDeclaration(\n param,\n param.modifiers,\n param.dotDotDotToken,\n ts.factory.createIdentifier(newParamName),\n param.questionToken,\n newParamType,\n param.initializer\n );\n }\n } else if (ts.isObjectBindingPattern(param.name)) {\n const elements = param.name.elements.map((element) => {\n const newElementName = mapping[element.name.getText()];\n if (newElementName) {\n return ts.factory.updateBindingElement(\n element,\n element.dotDotDotToken,\n element.propertyName,\n ts.factory.createIdentifier(newElementName),\n element.initializer\n );\n }\n return element;\n });\n const newParamName = ts.factory.createObjectBindingPattern(elements);\n return ts.factory.updateParameterDeclaration(\n param,\n param.modifiers,\n param.dotDotDotToken,\n newParamName,\n param.questionToken,\n newParamType,\n param.initializer\n );\n }\n return param;\n });\n\n if (ts.isFunctionDeclaration(node)) {\n const updatedBody = node.body && ts.isBlock(node.body) ? updateReturnStatement(node.body) : node.body;\n return ts.factory.updateFunctionDeclaration(\n node,\n node.modifiers,\n node.asteriskToken,\n newName ? ts.factory.createIdentifier(newName) : node.name,\n node.typeParameters,\n parameters,\n node.type,\n updatedBody\n );\n }\n if (ts.isArrowFunction(node)) {\n const updatedBody = node.body && ts.isBlock(node.body) ? updateReturnStatement(node.body) : node.body;\n return ts.factory.updateArrowFunction(\n node,\n node.modifiers,\n node.typeParameters,\n parameters,\n node.type,\n node.equalsGreaterThanToken,\n updatedBody\n );\n }\n if (ts.isFunctionExpression(node)) {\n const updatedBody = node.body && ts.isBlock(node.body) ? updateReturnStatement(node.body) : node.body;\n return ts.factory.updateFunctionExpression(\n node,\n node.modifiers,\n node.asteriskToken,\n newName ? ts.factory.createIdentifier(newName) : node.name,\n node.typeParameters,\n parameters,\n node.type,\n updatedBody\n );\n }\n }\n return ts.visitEachChild(node, visit, context);\n };\n\n function updateReturnStatement(body: ts.ConciseBody): ts.Block {\n if (ts.isBlock(body)) {\n const updatedStatements: ts.Statement[] = [];\n for (const statement of body.statements) {\n if (ts.isReturnStatement(statement) && statement.expression && ts.isJsxElement(statement.expression)) {\n const jsxElement = statement.expression;\n const openingElement = jsxElement.openingElement;\n const tagName = openingElement.tagName.getText();\n const newTagName = mapping[tagName];\n if (newTagName) {\n const updatedTagName = ts.factory.createIdentifier(newTagName);\n const updatedOpeningElement = ts.factory.updateJsxOpeningElement(\n openingElement,\n updatedTagName,\n openingElement.typeArguments,\n openingElement.attributes\n );\n const updatedClosingElement = jsxElement.closingElement\n ? ts.factory.updateJsxClosingElement(jsxElement.closingElement, updatedTagName)\n : ts.factory.createJsxClosingElement(updatedTagName);\n const updatedJsxElement = ts.factory.createJsxElement(\n updatedOpeningElement,\n jsxElement.children,\n updatedClosingElement\n );\n const updatedStatement = ts.factory.createReturnStatement(updatedJsxElement);\n updatedStatements.push(updatedStatement);\n } else {\n updatedStatements.push(statement);\n }\n } else {\n updatedStatements.push(statement);\n }\n }\n return ts.factory.updateBlock(body, updatedStatements);\n }\n if (\n ts.isExpressionStatement(body) &&\n ts.isReturnStatement(body.expression) &&\n body.expression.expression &&\n ts.isIdentifier(body.expression.expression)\n ) {\n const oldName = body.expression.expression.text;\n const newName = mapping[oldName];\n if (newName) {\n const updatedExpression = ts.factory.createIdentifier(newName);\n const updatedReturnStatement = ts.factory.createReturnStatement(updatedExpression);\n return ts.factory.createBlock([updatedReturnStatement], true);\n }\n }\n return ts.factory.createBlock([], true);\n }\n return (node) => ts.visitNode(node, visit) as ts.SourceFile;\n };\n};\n"],"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CAAC,MAAM;cACLrB,iBAAiB,CAACuB,IAAI,CAACtB,SAAS,CAAC;YACnC;UACF,CAAC,MAAM;YACLD,iBAAiB,CAACuB,IAAI,CAACtB,SAAS,CAAC;UACnC;QACF;QACA,OAAOzD,qBAAE,CAACO,OAAO,CAACyE,WAAW,CAACjC,IAAI,EAAES,iBAAiB,CAAC;MACxD;MACA,IACExD,qBAAE,CAACiF,qBAAqB,CAAClC,IAAI,CAAC,IAC9B/C,qBAAE,CAAC2D,iBAAiB,CAACZ,IAAI,CAACa,UAAU,CAAC,IACrCb,IAAI,CAACa,UAAU,CAACA,UAAU,IAC1B5D,qBAAE,CAAC8B,YAAY,CAACiB,IAAI,CAACa,UAAU,CAACA,UAAU,CAAC,EAC3C;QACA,MAAM7B,OAAO,GAAGgB,IAAI,CAACa,UAAU,CAACA,UAAU,CAACsB,IAAI;QAC/C,MAAMhE,OAAO,GAAGtB,OAAO,CAACmC,OAAO,CAAC;QAChC,IAAIb,OAAO,EAAE;UACX,MAAMiE,iBAAiB,GAAGnF,qBAAE,CAACO,OAAO,CAACE,gBAAgB,CAACS,OAAO,CAAC;UAC9D,MAAMkE,sBAAsB,GAAGpF,qBAAE,CAACO,OAAO,CAACuE,qBAAqB,CAACK,iBAAiB,CAAC;UAClF,OAAOnF,qBAAE,CAACO,OAAO,CAAC8E,WAAW,CAAC,CAACD,sBAAsB,CAAC,EAAE,IAAI,CAAC;QAC/D;MACF;MACA,OAAOpF,qBAAE,CAACO,OAAO,CAAC8E,WAAW,CAAC,EAAE,EAAE,IAAI,CAAC;IACzC;IACA,OAAQtF,IAAI,IAAKC,qBAAE,CAAC6B,SAAS,CAAC9B,IAAI,EAAEa,KAAK,CAAkB;EAC7D,CAAC;AACH,CAAC;AAAC0E,OAAA,CAAA3F,wBAAA,GAAAA,wBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_typescript","data","_interopRequireDefault","require","_replaceName","e","__esModule","default","functionNamesTransformer","mapping","context","updateTypeReference","node","ts","isTypeReferenceNode","typeName","getText","getSourceFile","newTypeName","replaceName","factory","updateTypeReferenceNode","createIdentifier","typeArguments","visitEachChild","visit","isFunctionDeclaration","isArrowFunction","isFunctionExpression","functionName","name","newName","Object","entries","find","key","includes","parameters","map","param","newParamType","type","visitNode","isIdentifier","oldName","newParamName","keys","updateParameterDeclaration","modifiers","dotDotDotToken","questionToken","initializer","isObjectBindingPattern","elements","element","newElementName","updateBindingElement","propertyName","createObjectBindingPattern","updatedBody","body","isBlock","updateReturnStatement","updateFunctionDeclaration","asteriskToken","typeParameters","updateArrowFunction","equalsGreaterThanToken","updateFunctionExpression","updatedStatements","statement","statements","isReturnStatement","expression","isJsxElement","jsxElement","openingElement","tagName","newTagName","updatedTagName","updatedOpeningElement","updateJsxOpeningElement","attributes","updatedClosingElement","closingElement","updateJsxClosingElement","createJsxClosingElement","updatedJsxElement","createJsxElement","children","updatedStatement","createReturnStatement","push","updateBlock","isExpressionStatement","text","updatedExpression","updatedReturnStatement","createBlock","exports"],"sources":["function.ts"],"sourcesContent":["import ts from 'typescript';\nimport { SourceFileTransformer } from './index';\nimport { replaceName } from './replaceName';\n\nexport const functionNamesTransformer: SourceFileTransformer = (mapping: Record<string, string>) => {\n return (context) => {\n const updateTypeReference: ts.Visitor = (node) => {\n try {\n if (ts.isTypeReferenceNode(node) && node.typeName) {\n const typeName = node.typeName.getText(node.getSourceFile());\n const newTypeName = replaceName(typeName, mapping);\n if (newTypeName) {\n return ts.factory.updateTypeReferenceNode(\n node,\n ts.factory.createIdentifier(newTypeName),\n node.typeArguments\n );\n }\n }\n return ts.visitEachChild(node, updateTypeReference, context);\n } catch {\n return node;\n }\n };\n\n const visit: ts.Visitor = (node) => {\n if (ts.isFunctionDeclaration(node) || ts.isArrowFunction(node) || ts.isFunctionExpression(node)) {\n const functionName = node.name?.getText() ?? '';\n const newName = Object.entries(mapping).find(([key]) => functionName.includes(key))?.[1] ?? functionName;\n const parameters = node.parameters.map((param) => {\n const newParamType = param.type ? (ts.visitNode(param.type, updateTypeReference) as ts.TypeNode) : param.type;\n if (ts.isIdentifier(param.name)) {\n const oldName = param.name.getText();\n const newParamName = Object.keys(mapping).find((key) => oldName.includes(key));\n if (newParamName) {\n return ts.factory.updateParameterDeclaration(\n param,\n param.modifiers,\n param.dotDotDotToken,\n ts.factory.createIdentifier(newParamName),\n param.questionToken,\n newParamType,\n param.initializer\n );\n }\n } else if (ts.isObjectBindingPattern(param.name)) {\n const elements = param.name.elements.map((element) => {\n const newElementName = mapping[element.name.getText()];\n if (newElementName) {\n return ts.factory.updateBindingElement(\n element,\n element.dotDotDotToken,\n element.propertyName,\n ts.factory.createIdentifier(newElementName),\n element.initializer\n );\n }\n return element;\n });\n const newParamName = ts.factory.createObjectBindingPattern(elements);\n return ts.factory.updateParameterDeclaration(\n param,\n param.modifiers,\n param.dotDotDotToken,\n newParamName,\n param.questionToken,\n newParamType,\n param.initializer\n );\n }\n return param;\n });\n\n if (ts.isFunctionDeclaration(node)) {\n const updatedBody = node.body && ts.isBlock(node.body) ? updateReturnStatement(node.body) : node.body;\n return ts.factory.updateFunctionDeclaration(\n node,\n node.modifiers,\n node.asteriskToken,\n newName ? ts.factory.createIdentifier(newName) : node.name,\n node.typeParameters,\n parameters,\n node.type,\n updatedBody\n );\n }\n if (ts.isArrowFunction(node)) {\n const updatedBody = node.body && ts.isBlock(node.body) ? updateReturnStatement(node.body) : node.body;\n return ts.factory.updateArrowFunction(\n node,\n node.modifiers,\n node.typeParameters,\n parameters,\n node.type,\n node.equalsGreaterThanToken,\n updatedBody\n );\n }\n if (ts.isFunctionExpression(node)) {\n const updatedBody = node.body && ts.isBlock(node.body) ? updateReturnStatement(node.body) : node.body;\n return ts.factory.updateFunctionExpression(\n node,\n node.modifiers,\n node.asteriskToken,\n newName ? ts.factory.createIdentifier(newName) : node.name,\n node.typeParameters,\n parameters,\n node.type,\n updatedBody\n );\n }\n }\n return ts.visitEachChild(node, visit, context);\n };\n\n function updateReturnStatement(body: ts.ConciseBody): ts.Block {\n if (ts.isBlock(body)) {\n const updatedStatements: ts.Statement[] = [];\n for (const statement of body.statements) {\n if (ts.isReturnStatement(statement) && statement.expression && ts.isJsxElement(statement.expression)) {\n const jsxElement = statement.expression;\n const openingElement = jsxElement.openingElement;\n const tagName = openingElement.tagName.getText();\n const newTagName = mapping[tagName];\n if (newTagName) {\n const updatedTagName = ts.factory.createIdentifier(newTagName);\n const updatedOpeningElement = ts.factory.updateJsxOpeningElement(\n openingElement,\n updatedTagName,\n openingElement.typeArguments,\n openingElement.attributes\n );\n const updatedClosingElement = jsxElement.closingElement\n ? ts.factory.updateJsxClosingElement(jsxElement.closingElement, updatedTagName)\n : ts.factory.createJsxClosingElement(updatedTagName);\n const updatedJsxElement = ts.factory.createJsxElement(\n updatedOpeningElement,\n jsxElement.children,\n updatedClosingElement\n );\n const updatedStatement = ts.factory.createReturnStatement(updatedJsxElement);\n updatedStatements.push(updatedStatement);\n } else {\n updatedStatements.push(statement);\n }\n } else {\n updatedStatements.push(statement);\n }\n }\n return ts.factory.updateBlock(body, updatedStatements);\n }\n if (\n ts.isExpressionStatement(body) &&\n ts.isReturnStatement(body.expression) &&\n body.expression.expression &&\n ts.isIdentifier(body.expression.expression)\n ) {\n const oldName = body.expression.expression.text;\n const newName = mapping[oldName];\n if (newName) {\n const updatedExpression = ts.factory.createIdentifier(newName);\n const updatedReturnStatement = ts.factory.createReturnStatement(updatedExpression);\n return ts.factory.createBlock([updatedReturnStatement], true);\n }\n }\n return ts.factory.createBlock([], true);\n }\n return (node) => ts.visitNode(node, visit) as ts.SourceFile;\n };\n};\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH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,CAAClC,IAAI,CAAC,IAC9B/C,qBAAE,CAAC2D,iBAAiB,CAACZ,IAAI,CAACa,UAAU,CAAC,IACrCb,IAAI,CAACa,UAAU,CAACA,UAAU,IAC1B5D,qBAAE,CAAC8B,YAAY,CAACiB,IAAI,CAACa,UAAU,CAACA,UAAU,CAAC,EAC3C;QACA,MAAM7B,OAAO,GAAGgB,IAAI,CAACa,UAAU,CAACA,UAAU,CAACsB,IAAI;QAC/C,MAAMhE,OAAO,GAAGtB,OAAO,CAACmC,OAAO,CAAC;QAChC,IAAIb,OAAO,EAAE;UACX,MAAMiE,iBAAiB,GAAGnF,qBAAE,CAACO,OAAO,CAACE,gBAAgB,CAACS,OAAO,CAAC;UAC9D,MAAMkE,sBAAsB,GAAGpF,qBAAE,CAACO,OAAO,CAACuE,qBAAqB,CAACK,iBAAiB,CAAC;UAClF,OAAOnF,qBAAE,CAACO,OAAO,CAAC8E,WAAW,CAAC,CAACD,sBAAsB,CAAC,EAAE,IAAI,CAAC;QAC/D;MACF;MACA,OAAOpF,qBAAE,CAACO,OAAO,CAAC8E,WAAW,CAAC,EAAE,EAAE,IAAI,CAAC;IACzC;IACA,OAAQtF,IAAI,IAAKC,qBAAE,CAAC6B,SAAS,CAAC9B,IAAI,EAAEa,KAAK,CAAkB;EAC7D,CAAC;AACH,CAAC;AAAC0E,OAAA,CAAA3F,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -128,7 +128,7 @@ also, make sure the tsconfig.json in the root has the "jsx" setting defined.`);
128
128
  }
129
129
  const exportNode = await context.computeSchema(definitionNode.parent);
130
130
  return new (_semanticsEntities().ExportSchema)(location, name, exportNode, alias);
131
- } catch (e) {
131
+ } catch {
132
132
  const exportNode = new (_semanticsEntities().UnresolvedSchema)(context.getLocation(element.name), element.name.getText());
133
133
  return new (_semanticsEntities().ExportSchema)(context.getLocation(element.name), element.name.getText(), exportNode);
134
134
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_semanticsEntities","data","require","_typescript","_interopRequireWildcard","_exportIdentifier","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ExportDeclarationTransformer","predicate","node","kind","SyntaxKind","ExportDeclaration","getIdentifiers","exportDec","context","rawSourceFilePath","moduleSpecifier","getText","sourceFilePath","substring","length","exportClause","ts","NamedExports","elements","map","elm","alias","propertyName","name","undefined","id","fileName","getSourceFile","ExportIdentifier","NamespaceExport","getFileExports","transform","specifier","Error","sourceFile","getSourceFileFromNode","UnImplementedSchema","getLocation","computeSchema","schemas","namedExport","ModuleSchema","namespaceExport","exports","isSameNode","nodeA","nodeB","pos","end","Promise","all","element","exportSpecifierToSchemaNode","definitionInfo","location","exportNode","UnresolvedSchema","ExportSchema","definitionNode","definition","resolveType","parent","getLocationAsString","ExportSpecifier","namespace","filePath","getFilePathByNode","getSourceFileInsideComponent","getTypeRefForExternalPath","result"],"sources":["export-declaration.ts"],"sourcesContent":["import {\n SchemaNode,\n ModuleSchema,\n UnresolvedSchema,\n UnImplementedSchema,\n ExportSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport ts, {\n Node,\n SyntaxKind,\n ExportDeclaration as ExportDeclarationNode,\n NamedExports,\n NamespaceExport,\n ExportSpecifier,\n} from 'typescript';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { ExportIdentifier } from '../export-identifier';\n\nexport class ExportDeclarationTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.ExportDeclaration;\n }\n\n async getIdentifiers(exportDec: ExportDeclarationNode, context: SchemaExtractorContext) {\n // e.g. `export { button1, button2 } as Composition from './button';\n const rawSourceFilePath = exportDec.moduleSpecifier?.getText();\n\n // strip off quotes ''\n const sourceFilePath = rawSourceFilePath && rawSourceFilePath.substring(1, rawSourceFilePath?.length - 1);\n\n if (exportDec.exportClause?.kind === ts.SyntaxKind.NamedExports) {\n return exportDec.exportClause.elements.map((elm) => {\n const alias = (elm.propertyName && elm.name.getText()) || undefined;\n const id = elm.propertyName?.getText() || elm.name.getText();\n const fileName = elm.getSourceFile().fileName;\n\n return new ExportIdentifier(id, fileName, alias, sourceFilePath);\n });\n }\n\n // e.g. `export * as Composition from './button';\n if (exportDec.exportClause?.kind === ts.SyntaxKind.NamespaceExport) {\n return [\n new ExportIdentifier(\n exportDec.exportClause.name.getText(),\n exportDec.getSourceFile().fileName,\n undefined,\n sourceFilePath\n ),\n ];\n }\n\n if (exportDec.moduleSpecifier) {\n return context.getFileExports(exportDec);\n }\n\n return [];\n }\n\n async transform(exportDec: ExportDeclarationNode, context: SchemaExtractorContext): Promise<SchemaNode> {\n const exportClause = exportDec.exportClause;\n\n // it's export-all, e.g. `export * from './button'`;\n if (!exportClause) {\n const specifier = exportDec.moduleSpecifier;\n if (!specifier) {\n throw new Error(`fatal: no specifier`);\n }\n const sourceFile = await context.getSourceFileFromNode(specifier);\n // export * from 'webpack', export-all from a package\n if (!sourceFile) {\n return new UnImplementedSchema(\n context.getLocation(exportDec),\n exportDec.getText(),\n SyntaxKind[SyntaxKind.ExportDeclaration]\n );\n }\n return context.computeSchema(sourceFile);\n }\n\n // e.g. `export { button1, button2 } as Composition from './button';\n if (exportClause.kind === SyntaxKind.NamedExports) {\n const schemas = await namedExport(exportClause, context);\n return new ModuleSchema(context.getLocation(exportDec), schemas, []);\n }\n // e.g. `export * as Composition from './button';\n if (exportClause.kind === SyntaxKind.NamespaceExport) {\n return namespaceExport(exportClause, exportDec, context);\n }\n\n // should never reach here. exportClause can be either NamespaceExport or NamedExports\n throw new Error(`unrecognized exportClause type`);\n }\n}\n\nfunction isSameNode(nodeA: Node, nodeB: Node): boolean {\n return nodeA.kind === nodeB.kind && nodeA.pos === nodeB.pos && nodeA.end === nodeB.end;\n}\n\nasync function namedExport(exportClause: NamedExports, context: SchemaExtractorContext): Promise<ExportSchema[]> {\n const schemas = await Promise.all(\n exportClause.elements.map(async (element) => {\n return exportSpecifierToSchemaNode(element, context);\n })\n );\n\n return schemas;\n}\n\nasync function exportSpecifierToSchemaNode(\n element: ExportSpecifier,\n context: SchemaExtractorContext\n): Promise<ExportSchema> {\n try {\n const definitionInfo = await context.definitionInfo(element);\n const name = element.propertyName?.getText() || element.name.getText();\n const alias = element.propertyName ? element.name.getText() : undefined;\n const location = context.getLocation(element.name);\n\n if (!definitionInfo) {\n const exportNode = new UnresolvedSchema(location, element.name.getText());\n // happens for example when the main index.ts file exports variable from an mdx file.\n // tsserver is unable to get the definition node because it doesn't know to parse mdx files.\n // return new UnresolvedSchema(context.getLocation(element.name), element.name.getText());\n return new ExportSchema(location, name, exportNode, alias);\n }\n\n const definitionNode = await context.definition(definitionInfo);\n\n if (!definitionNode) {\n const exportNode = await context.resolveType(element, name, false);\n return new ExportSchema(location, name, exportNode, alias);\n }\n\n // if it is reexported from another export\n if (isSameNode(element, definitionNode.parent)) {\n // the definition node is the same node as element.name. tsserver wasn't able to find the source for it\n // normally, \"bit install\" should fix it. another option is to open vscode and look for errors.\n throw new Error(`error: tsserver is unable to locate the identifier \"${element.name.getText()}\" at ${context.getLocationAsString(\n element.name\n )}.\nmake sure \"bit status\" is clean and there are no errors about missing packages/links.\nalso, make sure the tsconfig.json in the root has the \"jsx\" setting defined.`);\n }\n\n if (definitionNode.parent.kind === SyntaxKind.ExportSpecifier) {\n return await exportSpecifierToSchemaNode(definitionNode.parent as ExportSpecifier, context);\n }\n\n const exportNode = await context.computeSchema(definitionNode.parent);\n return new ExportSchema(location, name, exportNode, alias);\n } catch (e) {\n const exportNode = new UnresolvedSchema(context.getLocation(element.name), element.name.getText());\n return new ExportSchema(context.getLocation(element.name), element.name.getText(), exportNode);\n }\n}\n\nasync function namespaceExport(\n exportClause: NamespaceExport,\n exportDec: ExportDeclarationNode,\n context: SchemaExtractorContext\n) {\n const namespace = exportClause.name.getText();\n const filePath = await context.getFilePathByNode(exportClause.name);\n if (!filePath) {\n throw new Error(`unable to find the file-path for \"${namespace}\"`);\n }\n const sourceFile = context.getSourceFileInsideComponent(filePath);\n if (!sourceFile) {\n // it's a namespace from another component or an external package.\n return context.getTypeRefForExternalPath(namespace, filePath, context.getLocation(exportDec));\n }\n const result = await context.computeSchema(sourceFile);\n if (!(result instanceof ModuleSchema)) {\n throw new Error(`expect result to be instance of Module`);\n }\n result.namespace = namespace;\n return result;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,mBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,kBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAG,uBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAUA,SAAAI,kBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,iBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwD,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,c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U,CAAC;EACtD,IAAI,EAAEmC,MAAM,YAAY5B,iCAAY,CAAC,EAAE;IACrC,MAAM,IAAIR,KAAK,CAAC,wCAAwC,CAAC;EAC3D;EACAoC,MAAM,CAACL,SAAS,GAAGA,SAAS;EAC5B,OAAOK,MAAM;AACf","ignoreList":[]}
1
+ {"version":3,"names":["_semanticsEntities","data","require","_typescript","_interopRequireWildcard","_exportIdentifier","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ExportDeclarationTransformer","predicate","node","kind","SyntaxKind","ExportDeclaration","getIdentifiers","exportDec","context","rawSourceFilePath","moduleSpecifier","getText","sourceFilePath","substring","length","exportClause","ts","NamedExports","elements","map","elm","alias","propertyName","name","undefined","id","fileName","getSourceFile","ExportIdentifier","NamespaceExport","getFileExports","transform","specifier","Error","sourceFile","getSourceFileFromNode","UnImplementedSchema","getLocation","computeSchema","schemas","namedExport","ModuleSchema","namespaceExport","exports","isSameNode","nodeA","nodeB","pos","end","Promise","all","element","exportSpecifierToSchemaNode","definitionInfo","location","exportNode","UnresolvedSchema","ExportSchema","definitionNode","definition","resolveType","parent","getLocationAsString","ExportSpecifier","namespace","filePath","getFilePathByNode","getSourceFileInsideComponent","getTypeRefForExternalPath","result"],"sources":["export-declaration.ts"],"sourcesContent":["import {\n SchemaNode,\n ModuleSchema,\n UnresolvedSchema,\n UnImplementedSchema,\n ExportSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport ts, {\n Node,\n SyntaxKind,\n ExportDeclaration as ExportDeclarationNode,\n NamedExports,\n NamespaceExport,\n ExportSpecifier,\n} from 'typescript';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { ExportIdentifier } from '../export-identifier';\n\nexport class ExportDeclarationTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.ExportDeclaration;\n }\n\n async getIdentifiers(exportDec: ExportDeclarationNode, context: SchemaExtractorContext) {\n // e.g. `export { button1, button2 } as Composition from './button';\n const rawSourceFilePath = exportDec.moduleSpecifier?.getText();\n\n // strip off quotes ''\n const sourceFilePath = rawSourceFilePath && rawSourceFilePath.substring(1, rawSourceFilePath?.length - 1);\n\n if (exportDec.exportClause?.kind === ts.SyntaxKind.NamedExports) {\n return exportDec.exportClause.elements.map((elm) => {\n const alias = (elm.propertyName && elm.name.getText()) || undefined;\n const id = elm.propertyName?.getText() || elm.name.getText();\n const fileName = elm.getSourceFile().fileName;\n\n return new ExportIdentifier(id, fileName, alias, sourceFilePath);\n });\n }\n\n // e.g. `export * as Composition from './button';\n if (exportDec.exportClause?.kind === ts.SyntaxKind.NamespaceExport) {\n return [\n new ExportIdentifier(\n exportDec.exportClause.name.getText(),\n exportDec.getSourceFile().fileName,\n undefined,\n sourceFilePath\n ),\n ];\n }\n\n if (exportDec.moduleSpecifier) {\n return context.getFileExports(exportDec);\n }\n\n return [];\n }\n\n async transform(exportDec: ExportDeclarationNode, context: SchemaExtractorContext): Promise<SchemaNode> {\n const exportClause = exportDec.exportClause;\n\n // it's export-all, e.g. `export * from './button'`;\n if (!exportClause) {\n const specifier = exportDec.moduleSpecifier;\n if (!specifier) {\n throw new Error(`fatal: no specifier`);\n }\n const sourceFile = await context.getSourceFileFromNode(specifier);\n // export * from 'webpack', export-all from a package\n if (!sourceFile) {\n return new UnImplementedSchema(\n context.getLocation(exportDec),\n exportDec.getText(),\n SyntaxKind[SyntaxKind.ExportDeclaration]\n );\n }\n return context.computeSchema(sourceFile);\n }\n\n // e.g. `export { button1, button2 } as Composition from './button';\n if (exportClause.kind === SyntaxKind.NamedExports) {\n const schemas = await namedExport(exportClause, context);\n return new ModuleSchema(context.getLocation(exportDec), schemas, []);\n }\n // e.g. `export * as Composition from './button';\n if (exportClause.kind === SyntaxKind.NamespaceExport) {\n return namespaceExport(exportClause, exportDec, context);\n }\n\n // should never reach here. exportClause can be either NamespaceExport or NamedExports\n throw new Error(`unrecognized exportClause type`);\n }\n}\n\nfunction isSameNode(nodeA: Node, nodeB: Node): boolean {\n return nodeA.kind === nodeB.kind && nodeA.pos === nodeB.pos && nodeA.end === nodeB.end;\n}\n\nasync function namedExport(exportClause: NamedExports, context: SchemaExtractorContext): Promise<ExportSchema[]> {\n const schemas = await Promise.all(\n exportClause.elements.map(async (element) => {\n return exportSpecifierToSchemaNode(element, context);\n })\n );\n\n return schemas;\n}\n\nasync function exportSpecifierToSchemaNode(\n element: ExportSpecifier,\n context: SchemaExtractorContext\n): Promise<ExportSchema> {\n try {\n const definitionInfo = await context.definitionInfo(element);\n const name = element.propertyName?.getText() || element.name.getText();\n const alias = element.propertyName ? element.name.getText() : undefined;\n const location = context.getLocation(element.name);\n\n if (!definitionInfo) {\n const exportNode = new UnresolvedSchema(location, element.name.getText());\n // happens for example when the main index.ts file exports variable from an mdx file.\n // tsserver is unable to get the definition node because it doesn't know to parse mdx files.\n // return new UnresolvedSchema(context.getLocation(element.name), element.name.getText());\n return new ExportSchema(location, name, exportNode, alias);\n }\n\n const definitionNode = await context.definition(definitionInfo);\n\n if (!definitionNode) {\n const exportNode = await context.resolveType(element, name, false);\n return new ExportSchema(location, name, exportNode, alias);\n }\n\n // if it is reexported from another export\n if (isSameNode(element, definitionNode.parent)) {\n // the definition node is the same node as element.name. tsserver wasn't able to find the source for it\n // normally, \"bit install\" should fix it. another option is to open vscode and look for errors.\n throw new Error(`error: tsserver is unable to locate the identifier \"${element.name.getText()}\" at ${context.getLocationAsString(\n element.name\n )}.\nmake sure \"bit status\" is clean and there are no errors about missing packages/links.\nalso, make sure the tsconfig.json in the root has the \"jsx\" setting defined.`);\n }\n\n if (definitionNode.parent.kind === SyntaxKind.ExportSpecifier) {\n return await exportSpecifierToSchemaNode(definitionNode.parent as ExportSpecifier, context);\n }\n\n const exportNode = await context.computeSchema(definitionNode.parent);\n return new ExportSchema(location, name, exportNode, alias);\n } catch {\n const exportNode = new UnresolvedSchema(context.getLocation(element.name), element.name.getText());\n return new ExportSchema(context.getLocation(element.name), element.name.getText(), exportNode);\n }\n}\n\nasync function namespaceExport(\n exportClause: NamespaceExport,\n exportDec: ExportDeclarationNode,\n context: SchemaExtractorContext\n) {\n const namespace = exportClause.name.getText();\n const filePath = await context.getFilePathByNode(exportClause.name);\n if (!filePath) {\n throw new Error(`unable to find the file-path for \"${namespace}\"`);\n }\n const sourceFile = context.getSourceFileInsideComponent(filePath);\n if (!sourceFile) {\n // it's a namespace from another component or an external package.\n return context.getTypeRefForExternalPath(namespace, filePath, context.getLocation(exportDec));\n }\n const result = await context.computeSchema(sourceFile);\n if (!(result instanceof ModuleSchema)) {\n throw new Error(`expect result to be instance of Module`);\n }\n result.namespace = namespace;\n return result;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,mBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,kBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAG,uBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAUA,SAAAI,kBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,iBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwD,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CA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C/B,UAAU,EAAE;IACf;IACA,OAAO1B,OAAO,CAAC4D,yBAAyB,CAACJ,SAAS,EAAEC,QAAQ,EAAEzD,OAAO,CAAC6B,WAAW,CAAC9B,SAAS,CAAC,CAAC;EAC/F;EACA,MAAM8D,MAAM,GAAG,MAAM7D,OAAO,CAAC8B,aAAa,CAACJ,UAAU,CAAC;EACtD,IAAI,EAAEmC,MAAM,YAAY5B,iCAAY,CAAC,EAAE;IACrC,MAAM,IAAIR,KAAK,CAAC,wCAAwC,CAAC;EAC3D;EACAoC,MAAM,CAACL,SAAS,GAAGA,SAAS;EAC5B,OAAOK,MAAM;AACf","ignoreList":[]}
@@ -72,7 +72,7 @@ async function tagParser(tag, context, formatter) {
72
72
  try {
73
73
  const formattedComment = comment && (await formatter.formatSnippet(comment));
74
74
  return new (_semanticsEntities().TagSchema)(context.getLocation(tag), tagName, formattedComment);
75
- } catch (e) {
75
+ } catch {
76
76
  return simpleTag(tag, tagName, context);
77
77
  }
78
78
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_typescript","data","require","_semanticsEntities","tagParser","tag","context","formatter","kind","SyntaxKind","JSDocReturnTag","returnTag","JSDocPropertyTag","propertyLikeTag","JSDocParameterTag","JSDocAugmentsTag","simpleTag","TagName","augments","JSDocAuthorTag","author","JSDocClassTag","class","JSDocCallbackTag","callback","JSDocPublicTag","public","JSDocPrivateTag","private","JSDocProtectedTag","protected","JSDocReadonlyTag","readonly","JSDocOverrideTag","override","JSDocDeprecatedTag","deprecated","JSDocSeeTag","see","JSDocEnumTag","enum","JSDocThisTag","this","JSDocTypeTag","type","JSDocTemplateTag","template","JSDocTypedefTag","typedef","JSDocImplementsTag","implements","tagName","getText","getSourceFile","comment","getTextOfJSDocComment","formattedComment","formatSnippet","TagSchema","getLocation","e","typeExpression","computeSchema","undefined","ReturnTagSchema","PropertyLikeTagSchema","name"],"sources":["jsdoc-to-doc-schema.ts"],"sourcesContent":["/* eslint-disable no-fallthrough */\nimport {\n getTextOfJSDocComment,\n JSDocParameterTag,\n JSDocPropertyLikeTag,\n JSDocPropertyTag,\n JSDocReturnTag,\n JSDocTag,\n SyntaxKind,\n} from 'typescript';\nimport {\n PropertyLikeTagSchema,\n ReturnTagSchema,\n TagName,\n TagSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport { Formatter } from '@teambit/formatter';\nimport { SchemaExtractorContext } from '../../schema-extractor-context';\n\nexport async function tagParser(\n tag: JSDocTag,\n context: SchemaExtractorContext,\n formatter?: Formatter\n): Promise<TagSchema> {\n // for some reason, in some cases, if `tag.getSourceFile()` is not provided to the `getText()`, it throws \"Cannot read property 'text' of undefined\"\n switch (tag.kind) {\n case SyntaxKind.JSDocReturnTag:\n return returnTag(tag as JSDocReturnTag, context);\n case SyntaxKind.JSDocPropertyTag:\n return propertyLikeTag(tag as JSDocPropertyTag, context);\n case SyntaxKind.JSDocParameterTag:\n return propertyLikeTag(tag as JSDocParameterTag, context);\n case SyntaxKind.JSDocAugmentsTag:\n return simpleTag(tag, TagName.augments, context);\n case SyntaxKind.JSDocAuthorTag:\n return simpleTag(tag, TagName.author, context);\n case SyntaxKind.JSDocClassTag:\n return simpleTag(tag, TagName.class, context);\n case SyntaxKind.JSDocCallbackTag:\n return simpleTag(tag, TagName.callback, context);\n case SyntaxKind.JSDocPublicTag:\n return simpleTag(tag, TagName.public, context);\n case SyntaxKind.JSDocPrivateTag:\n return simpleTag(tag, TagName.private, context);\n case SyntaxKind.JSDocProtectedTag:\n return simpleTag(tag, TagName.protected, context);\n case SyntaxKind.JSDocReadonlyTag:\n return simpleTag(tag, TagName.readonly, context);\n case SyntaxKind.JSDocOverrideTag:\n return simpleTag(tag, TagName.override, context);\n case SyntaxKind.JSDocDeprecatedTag:\n return simpleTag(tag, TagName.deprecated, context);\n case SyntaxKind.JSDocSeeTag:\n return simpleTag(tag, TagName.see, context);\n case SyntaxKind.JSDocEnumTag:\n return simpleTag(tag, TagName.enum, context);\n case SyntaxKind.JSDocThisTag:\n return simpleTag(tag, TagName.this, context);\n case SyntaxKind.JSDocTypeTag:\n return simpleTag(tag, TagName.type, context);\n case SyntaxKind.JSDocTemplateTag:\n return simpleTag(tag, TagName.template, context);\n case SyntaxKind.JSDocTypedefTag:\n return simpleTag(tag, TagName.typedef, context);\n case SyntaxKind.JSDocImplementsTag:\n return simpleTag(tag, TagName.implements, context);\n default: {\n const tagName: TagName | string = tag.tagName.getText(tag.getSourceFile());\n if (tagName === 'example') {\n const comment = getTextOfJSDocComment(tag.comment);\n if (!formatter) return simpleTag(tag, tagName, context);\n try {\n const formattedComment = comment && (await formatter.formatSnippet(comment));\n return new TagSchema(context.getLocation(tag), tagName, formattedComment);\n } catch (e) {\n return simpleTag(tag, tagName, context);\n }\n }\n return simpleTag(tag, tagName, context);\n }\n }\n}\n\nfunction simpleTag(tag: JSDocTag, tagName: TagName | string, context: SchemaExtractorContext): TagSchema {\n return new TagSchema(context.getLocation(tag), tagName, getTextOfJSDocComment(tag.comment));\n}\n\nasync function returnTag(tag: JSDocReturnTag, context: SchemaExtractorContext) {\n const type = tag.typeExpression?.type ? await context.computeSchema(tag.typeExpression?.type) : undefined;\n return new ReturnTagSchema(context.getLocation(tag), getTextOfJSDocComment(tag.comment), type);\n}\n\nasync function propertyLikeTag(tag: JSDocPropertyLikeTag, context: SchemaExtractorContext) {\n const type = tag.typeExpression?.type ? await context.computeSchema(tag.typeExpression?.type) : undefined;\n return new PropertyLikeTagSchema(\n context.getLocation(tag),\n tag.name.getText(),\n getTextOfJSDocComment(tag.comment),\n type\n );\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AASA,SAAAE,mBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAVA;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AEC,OAA+B,EAAE;EACzF,MAAMsC,IAAI,GAAGvC,GAAG,CAACwD,cAAc,EAAEjB,IAAI,GAAG,MAAMtC,OAAO,CAACwD,aAAa,CAACzD,GAAG,CAACwD,cAAc,EAAEjB,IAAI,CAAC,GAAGmB,SAAS;EACzG,OAAO,KAAIE,0CAAqB,EAC9B3D,OAAO,CAACqD,WAAW,CAACtD,GAAG,CAAC,EACxBA,GAAG,CAAC6D,IAAI,CAACd,OAAO,CAAC,CAAC,EAClB,IAAAG,mCAAqB,EAAClD,GAAG,CAACiD,OAAO,CAAC,EAClCV,IACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_typescript","data","require","_semanticsEntities","tagParser","tag","context","formatter","kind","SyntaxKind","JSDocReturnTag","returnTag","JSDocPropertyTag","propertyLikeTag","JSDocParameterTag","JSDocAugmentsTag","simpleTag","TagName","augments","JSDocAuthorTag","author","JSDocClassTag","class","JSDocCallbackTag","callback","JSDocPublicTag","public","JSDocPrivateTag","private","JSDocProtectedTag","protected","JSDocReadonlyTag","readonly","JSDocOverrideTag","override","JSDocDeprecatedTag","deprecated","JSDocSeeTag","see","JSDocEnumTag","enum","JSDocThisTag","this","JSDocTypeTag","type","JSDocTemplateTag","template","JSDocTypedefTag","typedef","JSDocImplementsTag","implements","tagName","getText","getSourceFile","comment","getTextOfJSDocComment","formattedComment","formatSnippet","TagSchema","getLocation","typeExpression","computeSchema","undefined","ReturnTagSchema","PropertyLikeTagSchema","name"],"sources":["jsdoc-to-doc-schema.ts"],"sourcesContent":["/* eslint-disable no-fallthrough */\nimport {\n getTextOfJSDocComment,\n JSDocParameterTag,\n JSDocPropertyLikeTag,\n JSDocPropertyTag,\n JSDocReturnTag,\n JSDocTag,\n SyntaxKind,\n} from 'typescript';\nimport {\n PropertyLikeTagSchema,\n ReturnTagSchema,\n TagName,\n TagSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport { Formatter } from '@teambit/formatter';\nimport { SchemaExtractorContext } from '../../schema-extractor-context';\n\nexport async function tagParser(\n tag: JSDocTag,\n context: SchemaExtractorContext,\n formatter?: Formatter\n): Promise<TagSchema> {\n // for some reason, in some cases, if `tag.getSourceFile()` is not provided to the `getText()`, it throws \"Cannot read property 'text' of undefined\"\n switch (tag.kind) {\n case SyntaxKind.JSDocReturnTag:\n return returnTag(tag as JSDocReturnTag, context);\n case SyntaxKind.JSDocPropertyTag:\n return propertyLikeTag(tag as JSDocPropertyTag, context);\n case SyntaxKind.JSDocParameterTag:\n return propertyLikeTag(tag as JSDocParameterTag, context);\n case SyntaxKind.JSDocAugmentsTag:\n return simpleTag(tag, TagName.augments, context);\n case SyntaxKind.JSDocAuthorTag:\n return simpleTag(tag, TagName.author, context);\n case SyntaxKind.JSDocClassTag:\n return simpleTag(tag, TagName.class, context);\n case SyntaxKind.JSDocCallbackTag:\n return simpleTag(tag, TagName.callback, context);\n case SyntaxKind.JSDocPublicTag:\n return simpleTag(tag, TagName.public, context);\n case SyntaxKind.JSDocPrivateTag:\n return simpleTag(tag, TagName.private, context);\n case SyntaxKind.JSDocProtectedTag:\n return simpleTag(tag, TagName.protected, context);\n case SyntaxKind.JSDocReadonlyTag:\n return simpleTag(tag, TagName.readonly, context);\n case SyntaxKind.JSDocOverrideTag:\n return simpleTag(tag, TagName.override, context);\n case SyntaxKind.JSDocDeprecatedTag:\n return simpleTag(tag, TagName.deprecated, context);\n case SyntaxKind.JSDocSeeTag:\n return simpleTag(tag, TagName.see, context);\n case SyntaxKind.JSDocEnumTag:\n return simpleTag(tag, TagName.enum, context);\n case SyntaxKind.JSDocThisTag:\n return simpleTag(tag, TagName.this, context);\n case SyntaxKind.JSDocTypeTag:\n return simpleTag(tag, TagName.type, context);\n case SyntaxKind.JSDocTemplateTag:\n return simpleTag(tag, TagName.template, context);\n case SyntaxKind.JSDocTypedefTag:\n return simpleTag(tag, TagName.typedef, context);\n case SyntaxKind.JSDocImplementsTag:\n return simpleTag(tag, TagName.implements, context);\n default: {\n const tagName: TagName | string = tag.tagName.getText(tag.getSourceFile());\n if (tagName === 'example') {\n const comment = getTextOfJSDocComment(tag.comment);\n if (!formatter) return simpleTag(tag, tagName, context);\n try {\n const formattedComment = comment && (await formatter.formatSnippet(comment));\n return new TagSchema(context.getLocation(tag), tagName, formattedComment);\n } catch {\n return simpleTag(tag, tagName, context);\n }\n }\n return simpleTag(tag, tagName, context);\n }\n }\n}\n\nfunction simpleTag(tag: JSDocTag, tagName: TagName | string, context: SchemaExtractorContext): TagSchema {\n return new TagSchema(context.getLocation(tag), tagName, getTextOfJSDocComment(tag.comment));\n}\n\nasync function returnTag(tag: JSDocReturnTag, context: SchemaExtractorContext) {\n const type = tag.typeExpression?.type ? await context.computeSchema(tag.typeExpression?.type) : undefined;\n return new ReturnTagSchema(context.getLocation(tag), getTextOfJSDocComment(tag.comment), type);\n}\n\nasync function propertyLikeTag(tag: JSDocPropertyLikeTag, context: SchemaExtractorContext) {\n const type = tag.typeExpression?.type ? await context.computeSchema(tag.typeExpression?.type) : undefined;\n return new PropertyLikeTagSchema(\n context.getLocation(tag),\n tag.name.getText(),\n getTextOfJSDocComment(tag.comment),\n type\n );\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AASA,SAAAE,mBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAVA;;AAmBO,eAAeG,SAASA,CAC7BC,GAAa,EACbC,OAA+B,EAC/BC,SAAqB,EACD;EACpB;EACA,QAAQF,GAAG,CAACG,IAAI;IACd,KAAKC,wBAAU,CAACC,cAAc;MAC5B,OAAOC,SAAS,CAACN,GAAG,EAAoBC,OAAO,CAAC;IAClD,KAAKG,wBAAU,CAACG,gBAAgB;MAC9B,OAAOC,eA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A,GAAG,CAAC4D,IAAI,CAACb,OAAO,CAAC,CAAC,EAClB,IAAAG,mCAAqB,EAAClD,GAAG,CAACiD,OAAO,CAAC,EAClCV,IACF,CAAC;AACH","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/typescript",
3
- "version": "1.0.492",
3
+ "version": "1.0.493",
4
4
  "homepage": "https://bit.cloud/teambit/typescript/typescript",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.typescript",
8
8
  "name": "typescript",
9
- "version": "1.0.492"
9
+ "version": "1.0.493"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -18,26 +18,26 @@
18
18
  "chalk": "2.4.2",
19
19
  "@teambit/typescript.typescript-compiler": "2.0.46",
20
20
  "@teambit/harmony": "0.4.6",
21
- "@teambit/compiler": "1.0.492",
21
+ "@teambit/compiler": "1.0.493",
22
22
  "@teambit/typescript.modules.ts-config-mutator": "0.0.84",
23
- "@teambit/builder": "1.0.492",
24
- "@teambit/component.sources": "0.0.56",
25
- "@teambit/component": "1.0.492",
26
- "@teambit/dependency-resolver": "1.0.492",
27
- "@teambit/formatter": "1.0.492",
28
- "@teambit/legacy.utils": "0.0.10",
29
- "@teambit/semantics.entities.semantic-schema": "0.0.75",
30
- "@teambit/ts-server": "0.0.58",
31
- "@teambit/aspect-loader": "1.0.492",
32
- "@teambit/envs": "1.0.492",
33
- "@teambit/logger": "0.0.1162",
34
- "@teambit/schema": "1.0.492",
35
- "@teambit/scope": "1.0.492",
36
- "@teambit/workspace": "1.0.492",
37
- "@teambit/cli": "0.0.1069",
38
- "@teambit/pkg": "1.0.492",
39
- "@teambit/watcher": "1.0.492",
40
- "@teambit/legacy.constants": "0.0.2"
23
+ "@teambit/builder": "1.0.493",
24
+ "@teambit/component.sources": "0.0.57",
25
+ "@teambit/component": "1.0.493",
26
+ "@teambit/dependency-resolver": "1.0.493",
27
+ "@teambit/formatter": "1.0.493",
28
+ "@teambit/legacy.utils": "0.0.11",
29
+ "@teambit/semantics.entities.semantic-schema": "0.0.76",
30
+ "@teambit/ts-server": "0.0.59",
31
+ "@teambit/aspect-loader": "1.0.493",
32
+ "@teambit/envs": "1.0.493",
33
+ "@teambit/logger": "0.0.1163",
34
+ "@teambit/schema": "1.0.493",
35
+ "@teambit/scope": "1.0.493",
36
+ "@teambit/workspace": "1.0.493",
37
+ "@teambit/cli": "0.0.1070",
38
+ "@teambit/pkg": "1.0.493",
39
+ "@teambit/watcher": "1.0.493",
40
+ "@teambit/legacy.constants": "0.0.3"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/lodash": "4.14.165",
@@ -14,7 +14,7 @@ export const expressionStatementTransformer: SourceFileTransformer = (mapping: R
14
14
  return ts.factory.createIdentifier(newName);
15
15
  }
16
16
  return identifier;
17
- } catch (e) {
17
+ } catch {
18
18
  return identifier;
19
19
  }
20
20
  };
@@ -18,7 +18,7 @@ export const functionNamesTransformer: SourceFileTransformer = (mapping: Record<
18
18
  }
19
19
  }
20
20
  return ts.visitEachChild(node, updateTypeReference, context);
21
- } catch (e) {
21
+ } catch {
22
22
  return node;
23
23
  }
24
24
  };
@@ -150,7 +150,7 @@ also, make sure the tsconfig.json in the root has the "jsx" setting defined.`);
150
150
 
151
151
  const exportNode = await context.computeSchema(definitionNode.parent);
152
152
  return new ExportSchema(location, name, exportNode, alias);
153
- } catch (e) {
153
+ } catch {
154
154
  const exportNode = new UnresolvedSchema(context.getLocation(element.name), element.name.getText());
155
155
  return new ExportSchema(context.getLocation(element.name), element.name.getText(), exportNode);
156
156
  }
@@ -72,7 +72,7 @@ export async function tagParser(
72
72
  try {
73
73
  const formattedComment = comment && (await formatter.formatSnippet(comment));
74
74
  return new TagSchema(context.getLocation(tag), tagName, formattedComment);
75
- } catch (e) {
75
+ } catch {
76
76
  return simpleTag(tag, tagName, context);
77
77
  }
78
78
  }
package/cmds/init.cmd.ts DELETED
File without changes
File without changes
@@ -1,3 +0,0 @@
1
- "use strict";
2
-
3
- //# sourceMappingURL=init.cmd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["init.cmd.ts"],"sourcesContent":[""],"mappings":"","ignoreList":[]}