@teambit/typescript 0.0.0-0011b14535950761bc956ecbf5ef2ce74376d826

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. package/cmds/check-types.cmd.ts +114 -0
  2. package/dist/cmds/check-types.cmd.d.ts +37 -0
  3. package/dist/cmds/check-types.cmd.js +146 -0
  4. package/dist/cmds/check-types.cmd.js.map +1 -0
  5. package/dist/compiler-options.d.ts +22 -0
  6. package/dist/compiler-options.js +3 -0
  7. package/dist/compiler-options.js.map +1 -0
  8. package/dist/esm.mjs +21 -0
  9. package/dist/exceptions/index.d.ts +1 -0
  10. package/dist/exceptions/index.js +20 -0
  11. package/dist/exceptions/index.js.map +1 -0
  12. package/dist/exceptions/transformer-not-found.d.ts +8 -0
  13. package/dist/exceptions/transformer-not-found.js +26 -0
  14. package/dist/exceptions/transformer-not-found.js.map +1 -0
  15. package/dist/export-identifier.d.ts +6 -0
  16. package/dist/export-identifier.js +29 -0
  17. package/dist/export-identifier.js.map +1 -0
  18. package/dist/extractor-options.d.ts +31 -0
  19. package/dist/extractor-options.js +3 -0
  20. package/dist/extractor-options.js.map +1 -0
  21. package/dist/identifier-list.d.ts +7 -0
  22. package/dist/identifier-list.js +21 -0
  23. package/dist/identifier-list.js.map +1 -0
  24. package/dist/identifier.d.ts +11 -0
  25. package/dist/identifier.js +54 -0
  26. package/dist/identifier.js.map +1 -0
  27. package/dist/index.d.ts +9 -0
  28. package/dist/index.js +91 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/preview-1773859434576.js +7 -0
  31. package/dist/remove-types-task.d.ts +12 -0
  32. package/dist/remove-types-task.js +64 -0
  33. package/dist/remove-types-task.js.map +1 -0
  34. package/dist/schema-extractor-context.d.ts +178 -0
  35. package/dist/schema-extractor-context.js +793 -0
  36. package/dist/schema-extractor-context.js.map +1 -0
  37. package/dist/schema-transformer.d.ts +19 -0
  38. package/dist/schema-transformer.js +3 -0
  39. package/dist/schema-transformer.js.map +1 -0
  40. package/dist/schema-transformer.plugin.d.ts +9 -0
  41. package/dist/schema-transformer.plugin.js +22 -0
  42. package/dist/schema-transformer.plugin.js.map +1 -0
  43. package/dist/sourceFileTransformers/class.d.ts +2 -0
  44. package/dist/sourceFileTransformers/class.js +57 -0
  45. package/dist/sourceFileTransformers/class.js.map +1 -0
  46. package/dist/sourceFileTransformers/empty-line-encoder.d.ts +14 -0
  47. package/dist/sourceFileTransformers/empty-line-encoder.js +62 -0
  48. package/dist/sourceFileTransformers/empty-line-encoder.js.map +1 -0
  49. package/dist/sourceFileTransformers/export.d.ts +2 -0
  50. package/dist/sourceFileTransformers/export.js +58 -0
  51. package/dist/sourceFileTransformers/export.js.map +1 -0
  52. package/dist/sourceFileTransformers/expression-statement.d.ts +2 -0
  53. package/dist/sourceFileTransformers/expression-statement.js +58 -0
  54. package/dist/sourceFileTransformers/expression-statement.js.map +1 -0
  55. package/dist/sourceFileTransformers/function.d.ts +2 -0
  56. package/dist/sourceFileTransformers/function.js +119 -0
  57. package/dist/sourceFileTransformers/function.js.map +1 -0
  58. package/dist/sourceFileTransformers/import.d.ts +2 -0
  59. package/dist/sourceFileTransformers/import.js +71 -0
  60. package/dist/sourceFileTransformers/import.js.map +1 -0
  61. package/dist/sourceFileTransformers/index.d.ts +12 -0
  62. package/dist/sourceFileTransformers/index.js +137 -0
  63. package/dist/sourceFileTransformers/index.js.map +1 -0
  64. package/dist/sourceFileTransformers/interface.d.ts +2 -0
  65. package/dist/sourceFileTransformers/interface.js +50 -0
  66. package/dist/sourceFileTransformers/interface.js.map +1 -0
  67. package/dist/sourceFileTransformers/replaceName.d.ts +1 -0
  68. package/dist/sourceFileTransformers/replaceName.js +19 -0
  69. package/dist/sourceFileTransformers/replaceName.js.map +1 -0
  70. package/dist/sourceFileTransformers/transform.d.ts +12 -0
  71. package/dist/sourceFileTransformers/transform.js +76 -0
  72. package/dist/sourceFileTransformers/transform.js.map +1 -0
  73. package/dist/sourceFileTransformers/type-reference.d.ts +2 -0
  74. package/dist/sourceFileTransformers/type-reference.js +38 -0
  75. package/dist/sourceFileTransformers/type-reference.js.map +1 -0
  76. package/dist/sourceFileTransformers/typeAlias.d.ts +2 -0
  77. package/dist/sourceFileTransformers/typeAlias.js +41 -0
  78. package/dist/sourceFileTransformers/typeAlias.js.map +1 -0
  79. package/dist/sourceFileTransformers/variable.d.ts +2 -0
  80. package/dist/sourceFileTransformers/variable.js +41 -0
  81. package/dist/sourceFileTransformers/variable.js.map +1 -0
  82. package/dist/transform-source-file.spec.d.ts +1 -0
  83. package/dist/transform-source-file.spec.js +182 -0
  84. package/dist/transform-source-file.spec.js.map +1 -0
  85. package/dist/transformers/array-literal-expression.d.ts +10 -0
  86. package/dist/transformers/array-literal-expression.js +51 -0
  87. package/dist/transformers/array-literal-expression.js.map +1 -0
  88. package/dist/transformers/array-type.d.ts +10 -0
  89. package/dist/transformers/array-type.js +37 -0
  90. package/dist/transformers/array-type.js.map +1 -0
  91. package/dist/transformers/binding-element.d.ts +17 -0
  92. package/dist/transformers/binding-element.js +63 -0
  93. package/dist/transformers/binding-element.js.map +1 -0
  94. package/dist/transformers/class-declaration.d.ts +12 -0
  95. package/dist/transformers/class-declaration.js +116 -0
  96. package/dist/transformers/class-declaration.js.map +1 -0
  97. package/dist/transformers/conditional-type.d.ts +10 -0
  98. package/dist/transformers/conditional-type.js +38 -0
  99. package/dist/transformers/conditional-type.js.map +1 -0
  100. package/dist/transformers/constructor.d.ts +10 -0
  101. package/dist/transformers/constructor.js +49 -0
  102. package/dist/transformers/constructor.js.map +1 -0
  103. package/dist/transformers/decorator.d.ts +10 -0
  104. package/dist/transformers/decorator.js +54 -0
  105. package/dist/transformers/decorator.js.map +1 -0
  106. package/dist/transformers/enum-declaration.d.ts +10 -0
  107. package/dist/transformers/enum-declaration.js +60 -0
  108. package/dist/transformers/enum-declaration.js.map +1 -0
  109. package/dist/transformers/export-assignment.d.ts +14 -0
  110. package/dist/transformers/export-assignment.js +54 -0
  111. package/dist/transformers/export-assignment.js.map +1 -0
  112. package/dist/transformers/export-declaration.d.ts +10 -0
  113. package/dist/transformers/export-declaration.js +154 -0
  114. package/dist/transformers/export-declaration.js.map +1 -0
  115. package/dist/transformers/expression-statement.d.ts +10 -0
  116. package/dist/transformers/expression-statement.js +36 -0
  117. package/dist/transformers/expression-statement.js.map +1 -0
  118. package/dist/transformers/function-like.d.ts +11 -0
  119. package/dist/transformers/function-like.js +81 -0
  120. package/dist/transformers/function-like.js.map +1 -0
  121. package/dist/transformers/get-accessor.d.ts +10 -0
  122. package/dist/transformers/get-accessor.js +46 -0
  123. package/dist/transformers/get-accessor.js.map +1 -0
  124. package/dist/transformers/import-declaration.d.ts +10 -0
  125. package/dist/transformers/import-declaration.js +72 -0
  126. package/dist/transformers/import-declaration.js.map +1 -0
  127. package/dist/transformers/index-signature.d.ts +10 -0
  128. package/dist/transformers/index-signature.js +41 -0
  129. package/dist/transformers/index-signature.js.map +1 -0
  130. package/dist/transformers/index.d.ts +43 -0
  131. package/dist/transformers/index.js +566 -0
  132. package/dist/transformers/index.js.map +1 -0
  133. package/dist/transformers/indexed-access-type.d.ts +10 -0
  134. package/dist/transformers/indexed-access-type.js +36 -0
  135. package/dist/transformers/indexed-access-type.js.map +1 -0
  136. package/dist/transformers/interface-declaration.d.ts +11 -0
  137. package/dist/transformers/interface-declaration.js +86 -0
  138. package/dist/transformers/interface-declaration.js.map +1 -0
  139. package/dist/transformers/intersection-type.d.ts +10 -0
  140. package/dist/transformers/intersection-type.js +47 -0
  141. package/dist/transformers/intersection-type.js.map +1 -0
  142. package/dist/transformers/keyword-type.d.ts +13 -0
  143. package/dist/transformers/keyword-type.js +54 -0
  144. package/dist/transformers/keyword-type.js.map +1 -0
  145. package/dist/transformers/literal-type.d.ts +13 -0
  146. package/dist/transformers/literal-type.js +39 -0
  147. package/dist/transformers/literal-type.js.map +1 -0
  148. package/dist/transformers/literal-value.d.ts +12 -0
  149. package/dist/transformers/literal-value.js +35 -0
  150. package/dist/transformers/literal-value.js.map +1 -0
  151. package/dist/transformers/module-declaration.d.ts +10 -0
  152. package/dist/transformers/module-declaration.js +36 -0
  153. package/dist/transformers/module-declaration.js.map +1 -0
  154. package/dist/transformers/named-tuple.d.ts +10 -0
  155. package/dist/transformers/named-tuple.js +37 -0
  156. package/dist/transformers/named-tuple.js.map +1 -0
  157. package/dist/transformers/object-literal-expression.d.ts +9 -0
  158. package/dist/transformers/object-literal-expression.js +73 -0
  159. package/dist/transformers/object-literal-expression.js.map +1 -0
  160. package/dist/transformers/parameter.d.ts +14 -0
  161. package/dist/transformers/parameter.js +109 -0
  162. package/dist/transformers/parameter.js.map +1 -0
  163. package/dist/transformers/parenthesized-type.d.ts +10 -0
  164. package/dist/transformers/parenthesized-type.js +35 -0
  165. package/dist/transformers/parenthesized-type.js.map +1 -0
  166. package/dist/transformers/property-assignment.d.ts +9 -0
  167. package/dist/transformers/property-assignment.js +39 -0
  168. package/dist/transformers/property-assignment.js.map +1 -0
  169. package/dist/transformers/property-declaration.d.ts +11 -0
  170. package/dist/transformers/property-declaration.js +56 -0
  171. package/dist/transformers/property-declaration.js.map +1 -0
  172. package/dist/transformers/set-accessor.d.ts +10 -0
  173. package/dist/transformers/set-accessor.js +44 -0
  174. package/dist/transformers/set-accessor.js.map +1 -0
  175. package/dist/transformers/source-file-transformer.d.ts +15 -0
  176. package/dist/transformers/source-file-transformer.js +108 -0
  177. package/dist/transformers/source-file-transformer.js.map +1 -0
  178. package/dist/transformers/template-literal-type-span.d.ts +10 -0
  179. package/dist/transformers/template-literal-type-span.js +36 -0
  180. package/dist/transformers/template-literal-type-span.js.map +1 -0
  181. package/dist/transformers/template-literal-type.d.ts +10 -0
  182. package/dist/transformers/template-literal-type.js +44 -0
  183. package/dist/transformers/template-literal-type.js.map +1 -0
  184. package/dist/transformers/this-type.d.ts +10 -0
  185. package/dist/transformers/this-type.js +34 -0
  186. package/dist/transformers/this-type.js.map +1 -0
  187. package/dist/transformers/tuple-type.d.ts +10 -0
  188. package/dist/transformers/tuple-type.js +46 -0
  189. package/dist/transformers/tuple-type.js.map +1 -0
  190. package/dist/transformers/type-alias.d.ts +11 -0
  191. package/dist/transformers/type-alias.js +48 -0
  192. package/dist/transformers/type-alias.js.map +1 -0
  193. package/dist/transformers/type-literal.d.ts +14 -0
  194. package/dist/transformers/type-literal.js +48 -0
  195. package/dist/transformers/type-literal.js.map +1 -0
  196. package/dist/transformers/type-operator.d.ts +15 -0
  197. package/dist/transformers/type-operator.js +51 -0
  198. package/dist/transformers/type-operator.js.map +1 -0
  199. package/dist/transformers/type-predicate.d.ts +10 -0
  200. package/dist/transformers/type-predicate.js +37 -0
  201. package/dist/transformers/type-predicate.js.map +1 -0
  202. package/dist/transformers/type-query.d.ts +13 -0
  203. package/dist/transformers/type-query.js +41 -0
  204. package/dist/transformers/type-query.js.map +1 -0
  205. package/dist/transformers/type-reference.d.ts +17 -0
  206. package/dist/transformers/type-reference.js +58 -0
  207. package/dist/transformers/type-reference.js.map +1 -0
  208. package/dist/transformers/union-type.d.ts +10 -0
  209. package/dist/transformers/union-type.js +47 -0
  210. package/dist/transformers/union-type.js.map +1 -0
  211. package/dist/transformers/utils/jsdoc-to-doc-schema.d.ts +5 -0
  212. package/dist/transformers/utils/jsdoc-to-doc-schema.js +114 -0
  213. package/dist/transformers/utils/jsdoc-to-doc-schema.js.map +1 -0
  214. package/dist/transformers/utils/parse-type-from-quick-info.d.ts +36 -0
  215. package/dist/transformers/utils/parse-type-from-quick-info.js +111 -0
  216. package/dist/transformers/utils/parse-type-from-quick-info.js.map +1 -0
  217. package/dist/transformers/variable-declaration.d.ts +11 -0
  218. package/dist/transformers/variable-declaration.js +107 -0
  219. package/dist/transformers/variable-declaration.js.map +1 -0
  220. package/dist/transformers/variable-statement.d.ts +14 -0
  221. package/dist/transformers/variable-statement.js +67 -0
  222. package/dist/transformers/variable-statement.js.map +1 -0
  223. package/dist/tsconfig.default.json +25 -0
  224. package/dist/typescript.aspect.d.ts +2 -0
  225. package/dist/typescript.aspect.js +18 -0
  226. package/dist/typescript.aspect.js.map +1 -0
  227. package/dist/typescript.composition.d.ts +1 -0
  228. package/dist/typescript.composition.js +29 -0
  229. package/dist/typescript.composition.js.map +1 -0
  230. package/dist/typescript.docs.mdx +8 -0
  231. package/dist/typescript.extractor.d.ts +57 -0
  232. package/dist/typescript.extractor.js +317 -0
  233. package/dist/typescript.extractor.js.map +1 -0
  234. package/dist/typescript.main.runtime.d.ts +130 -0
  235. package/dist/typescript.main.runtime.js +400 -0
  236. package/dist/typescript.main.runtime.js.map +1 -0
  237. package/dist/typescript.parser.d.ts +13 -0
  238. package/dist/typescript.parser.js +154 -0
  239. package/dist/typescript.parser.js.map +1 -0
  240. package/dist/typescript.parser.spec.d.ts +1 -0
  241. package/dist/typescript.parser.spec.js +189 -0
  242. package/dist/typescript.parser.spec.js.map +1 -0
  243. package/esm.mjs +21 -0
  244. package/exceptions/index.ts +1 -0
  245. package/exceptions/transformer-not-found.ts +20 -0
  246. package/package.json +88 -0
  247. package/sourceFileTransformers/class.ts +73 -0
  248. package/sourceFileTransformers/empty-line-encoder.ts +56 -0
  249. package/sourceFileTransformers/export.ts +65 -0
  250. package/sourceFileTransformers/expression-statement.ts +48 -0
  251. package/sourceFileTransformers/function.ts +170 -0
  252. package/sourceFileTransformers/import.ts +101 -0
  253. package/sourceFileTransformers/index.ts +14 -0
  254. package/sourceFileTransformers/interface.ts +41 -0
  255. package/sourceFileTransformers/replaceName.ts +11 -0
  256. package/sourceFileTransformers/transform.ts +70 -0
  257. package/sourceFileTransformers/type-reference.ts +19 -0
  258. package/sourceFileTransformers/typeAlias.ts +25 -0
  259. package/sourceFileTransformers/variable.ts +25 -0
  260. package/transformers/array-literal-expression.ts +31 -0
  261. package/transformers/array-type.ts +22 -0
  262. package/transformers/binding-element.ts +35 -0
  263. package/transformers/class-declaration.ts +109 -0
  264. package/transformers/conditional-type.ts +24 -0
  265. package/transformers/constructor.ts +37 -0
  266. package/transformers/decorator.ts +30 -0
  267. package/transformers/enum-declaration.ts +32 -0
  268. package/transformers/export-assignment.ts +48 -0
  269. package/transformers/export-declaration.ts +182 -0
  270. package/transformers/expression-statement.ts +21 -0
  271. package/transformers/function-like.ts +72 -0
  272. package/transformers/get-accessor.ts +25 -0
  273. package/transformers/import-declaration.ts +57 -0
  274. package/transformers/index-signature.ts +27 -0
  275. package/transformers/index.ts +43 -0
  276. package/transformers/indexed-access-type.ts +22 -0
  277. package/transformers/interface-declaration.ts +68 -0
  278. package/transformers/intersection-type.ts +26 -0
  279. package/transformers/keyword-type.ts +40 -0
  280. package/transformers/literal-type.ts +24 -0
  281. package/transformers/literal-value.ts +40 -0
  282. package/transformers/module-declaration.ts +21 -0
  283. package/transformers/named-tuple.ts +23 -0
  284. package/transformers/object-literal-expression.ts +64 -0
  285. package/transformers/parameter.ts +115 -0
  286. package/transformers/parenthesized-type.ts +21 -0
  287. package/transformers/property-assignment.ts +24 -0
  288. package/transformers/property-declaration.ts +35 -0
  289. package/transformers/set-accessor.ts +27 -0
  290. package/transformers/source-file-transformer.ts +95 -0
  291. package/transformers/template-literal-type-span.ts +22 -0
  292. package/transformers/template-literal-type.ts +26 -0
  293. package/transformers/this-type.ts +20 -0
  294. package/transformers/tuple-type.ts +25 -0
  295. package/transformers/type-alias.ts +27 -0
  296. package/transformers/type-literal.ts +27 -0
  297. package/transformers/type-operator.ts +38 -0
  298. package/transformers/type-predicate.ts +23 -0
  299. package/transformers/type-query.ts +26 -0
  300. package/transformers/type-reference.ts +37 -0
  301. package/transformers/union-type.ts +26 -0
  302. package/transformers/utils/jsdoc-to-doc-schema.ts +114 -0
  303. package/transformers/utils/parse-type-from-quick-info.ts +99 -0
  304. package/transformers/variable-declaration.ts +116 -0
  305. package/transformers/variable-statement.ts +34 -0
  306. package/types/asset.d.ts +41 -0
  307. package/types/style.d.ts +42 -0
  308. package/typescript.composition.tsx +7 -0
  309. package/typescript.docs.mdx +8 -0
@@ -0,0 +1,114 @@
1
+ import type { Command, CommandOptions } from '@teambit/cli';
2
+ import type { Logger } from '@teambit/logger';
3
+ import type { Workspace } from '@teambit/workspace';
4
+ import { OutsideWorkspaceError } from '@teambit/workspace';
5
+ import chalk from 'chalk';
6
+ import { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';
7
+ import type { TypescriptMain } from '../typescript.main.runtime';
8
+
9
+ export class CheckTypesCmd implements Command {
10
+ name = 'check-types [component-pattern]';
11
+ description = 'validate TypeScript type correctness';
12
+ extendedDescription = `checks for TypeScript type errors in component files, similar to running tsc.
13
+ by default only checks new and modified components. use --unmodified to check all components.
14
+ useful for catching type issues before tagging, snapping or building components.`;
15
+ arguments = [{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP }];
16
+ alias = '';
17
+ group = 'testing';
18
+ options = [
19
+ ['a', 'all', 'DEPRECATED. (use --unmodified)'],
20
+ ['u', 'unmodified', 'check-types for all components, not only modified and new'],
21
+ ['', 'strict', 'in case issues found, exit with code 1'],
22
+ ['j', 'json', 'return the output in json format'],
23
+ ] as CommandOptions;
24
+
25
+ constructor(
26
+ private typescript: TypescriptMain,
27
+ private workspace: Workspace,
28
+ private logger: Logger
29
+ ) {}
30
+
31
+ async report(
32
+ [pattern]: [string],
33
+ { all = false, unmodified = false, strict = false }: { all: boolean; unmodified: boolean; strict: boolean }
34
+ ) {
35
+ if (all) {
36
+ unmodified = all;
37
+ this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);
38
+ }
39
+ const start = Date.now();
40
+ const { tsserver, componentsCount } = await this.runDiagnosticOnTsServer(false, pattern, unmodified);
41
+ if (!tsserver) {
42
+ const data = chalk.bold(`no components found to check.
43
+ use "--unmodified" flag to check all components or specify the ids to check.
44
+ otherwise, only new and modified components will be checked`);
45
+ return { code: 0, data };
46
+ }
47
+ const end = Date.now() - start;
48
+ const msg = `completed type checking ${componentsCount} component(s) (${end / 1000} sec)`;
49
+ tsserver.killTsServer();
50
+ if (tsserver.lastDiagnostics.length) {
51
+ return {
52
+ code: strict ? 1 : 0,
53
+ data: chalk.red(`${msg}. found errors in ${tsserver.lastDiagnostics.length} files.`),
54
+ };
55
+ }
56
+ return {
57
+ code: 0,
58
+ data: chalk.green(`${msg}. no errors were found.`),
59
+ };
60
+ }
61
+
62
+ async json(
63
+ [pattern]: [string],
64
+ { all = false, unmodified = false, strict = false }: { all: boolean; unmodified: boolean; strict: boolean }
65
+ ) {
66
+ if (all) {
67
+ unmodified = all;
68
+ this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);
69
+ }
70
+ const { tsserver } = await this.runDiagnosticOnTsServer(true, pattern, unmodified);
71
+ if (!tsserver) {
72
+ return { code: 0, data: [] };
73
+ }
74
+ const diagData = tsserver.diagnosticData;
75
+ tsserver.killTsServer();
76
+ if (tsserver.lastDiagnostics.length) {
77
+ return {
78
+ code: strict ? 1 : 0,
79
+ data: diagData,
80
+ };
81
+ }
82
+ return {
83
+ code: 0,
84
+ data: diagData,
85
+ };
86
+ }
87
+
88
+ private async runDiagnosticOnTsServer(
89
+ isJson: boolean,
90
+ pattern: string,
91
+ unmodified: boolean
92
+ ): Promise<{ tsserver: ReturnType<TypescriptMain['getTsserverClient']>; componentsCount: number }> {
93
+ if (!this.workspace) throw new OutsideWorkspaceError();
94
+ // If pattern is provided, don't pass the unmodified flag - the pattern should take precedence
95
+ const components = await this.workspace.getComponentsByUserInput(pattern ? false : unmodified, pattern);
96
+ if (!components.length) {
97
+ return { tsserver: undefined, componentsCount: 0 };
98
+ }
99
+ const files = this.typescript.getSupportedFilesForTsserver(components);
100
+ await this.typescript.initTsserverClientFromWorkspace(
101
+ {
102
+ aggregateDiagnosticData: isJson,
103
+ printTypeErrors: !isJson,
104
+ },
105
+ files
106
+ );
107
+ const tsserver = this.typescript.getTsserverClient();
108
+ if (!tsserver) throw new Error(`unable to start tsserver`);
109
+ // Use batching for large file sets to avoid overwhelming tsserver
110
+ const BATCH_SIZE = 50;
111
+ await tsserver.getDiagnostic(files, files.length > BATCH_SIZE ? BATCH_SIZE : undefined);
112
+ return { tsserver, componentsCount: components.length };
113
+ }
114
+ }
@@ -0,0 +1,37 @@
1
+ import type { Command, CommandOptions } from '@teambit/cli';
2
+ import type { Logger } from '@teambit/logger';
3
+ import type { Workspace } from '@teambit/workspace';
4
+ import type { TypescriptMain } from '../typescript.main.runtime';
5
+ export declare class CheckTypesCmd implements Command {
6
+ private typescript;
7
+ private workspace;
8
+ private logger;
9
+ name: string;
10
+ description: string;
11
+ extendedDescription: string;
12
+ arguments: {
13
+ name: string;
14
+ description: string;
15
+ }[];
16
+ alias: string;
17
+ group: string;
18
+ options: CommandOptions;
19
+ constructor(typescript: TypescriptMain, workspace: Workspace, logger: Logger);
20
+ report([pattern]: [string], { all, unmodified, strict }: {
21
+ all: boolean;
22
+ unmodified: boolean;
23
+ strict: boolean;
24
+ }): Promise<{
25
+ code: number;
26
+ data: string;
27
+ }>;
28
+ json([pattern]: [string], { all, unmodified, strict }: {
29
+ all: boolean;
30
+ unmodified: boolean;
31
+ strict: boolean;
32
+ }): Promise<{
33
+ code: number;
34
+ data: import("@teambit/ts-server/ts-server-client").DiagnosticData[];
35
+ }>;
36
+ private runDiagnosticOnTsServer;
37
+ }
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CheckTypesCmd = void 0;
7
+ function _workspace() {
8
+ const data = require("@teambit/workspace");
9
+ _workspace = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _chalk() {
15
+ const data = _interopRequireDefault(require("chalk"));
16
+ _chalk = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _legacy() {
22
+ const data = require("@teambit/legacy.constants");
23
+ _legacy = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
29
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
30
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
31
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
32
+ class CheckTypesCmd {
33
+ constructor(typescript, workspace, logger) {
34
+ this.typescript = typescript;
35
+ this.workspace = workspace;
36
+ this.logger = logger;
37
+ _defineProperty(this, "name", 'check-types [component-pattern]');
38
+ _defineProperty(this, "description", 'validate TypeScript type correctness');
39
+ _defineProperty(this, "extendedDescription", `checks for TypeScript type errors in component files, similar to running tsc.
40
+ by default only checks new and modified components. use --unmodified to check all components.
41
+ useful for catching type issues before tagging, snapping or building components.`);
42
+ _defineProperty(this, "arguments", [{
43
+ name: 'component-pattern',
44
+ description: _legacy().COMPONENT_PATTERN_HELP
45
+ }]);
46
+ _defineProperty(this, "alias", '');
47
+ _defineProperty(this, "group", 'testing');
48
+ _defineProperty(this, "options", [['a', 'all', 'DEPRECATED. (use --unmodified)'], ['u', 'unmodified', 'check-types for all components, not only modified and new'], ['', 'strict', 'in case issues found, exit with code 1'], ['j', 'json', 'return the output in json format']]);
49
+ }
50
+ async report([pattern], {
51
+ all = false,
52
+ unmodified = false,
53
+ strict = false
54
+ }) {
55
+ if (all) {
56
+ unmodified = all;
57
+ this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);
58
+ }
59
+ const start = Date.now();
60
+ const {
61
+ tsserver,
62
+ componentsCount
63
+ } = await this.runDiagnosticOnTsServer(false, pattern, unmodified);
64
+ if (!tsserver) {
65
+ const data = _chalk().default.bold(`no components found to check.
66
+ use "--unmodified" flag to check all components or specify the ids to check.
67
+ otherwise, only new and modified components will be checked`);
68
+ return {
69
+ code: 0,
70
+ data
71
+ };
72
+ }
73
+ const end = Date.now() - start;
74
+ const msg = `completed type checking ${componentsCount} component(s) (${end / 1000} sec)`;
75
+ tsserver.killTsServer();
76
+ if (tsserver.lastDiagnostics.length) {
77
+ return {
78
+ code: strict ? 1 : 0,
79
+ data: _chalk().default.red(`${msg}. found errors in ${tsserver.lastDiagnostics.length} files.`)
80
+ };
81
+ }
82
+ return {
83
+ code: 0,
84
+ data: _chalk().default.green(`${msg}. no errors were found.`)
85
+ };
86
+ }
87
+ async json([pattern], {
88
+ all = false,
89
+ unmodified = false,
90
+ strict = false
91
+ }) {
92
+ if (all) {
93
+ unmodified = all;
94
+ this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);
95
+ }
96
+ const {
97
+ tsserver
98
+ } = await this.runDiagnosticOnTsServer(true, pattern, unmodified);
99
+ if (!tsserver) {
100
+ return {
101
+ code: 0,
102
+ data: []
103
+ };
104
+ }
105
+ const diagData = tsserver.diagnosticData;
106
+ tsserver.killTsServer();
107
+ if (tsserver.lastDiagnostics.length) {
108
+ return {
109
+ code: strict ? 1 : 0,
110
+ data: diagData
111
+ };
112
+ }
113
+ return {
114
+ code: 0,
115
+ data: diagData
116
+ };
117
+ }
118
+ async runDiagnosticOnTsServer(isJson, pattern, unmodified) {
119
+ if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
120
+ // If pattern is provided, don't pass the unmodified flag - the pattern should take precedence
121
+ const components = await this.workspace.getComponentsByUserInput(pattern ? false : unmodified, pattern);
122
+ if (!components.length) {
123
+ return {
124
+ tsserver: undefined,
125
+ componentsCount: 0
126
+ };
127
+ }
128
+ const files = this.typescript.getSupportedFilesForTsserver(components);
129
+ await this.typescript.initTsserverClientFromWorkspace({
130
+ aggregateDiagnosticData: isJson,
131
+ printTypeErrors: !isJson
132
+ }, files);
133
+ const tsserver = this.typescript.getTsserverClient();
134
+ if (!tsserver) throw new Error(`unable to start tsserver`);
135
+ // Use batching for large file sets to avoid overwhelming tsserver
136
+ const BATCH_SIZE = 50;
137
+ await tsserver.getDiagnostic(files, files.length > BATCH_SIZE ? BATCH_SIZE : undefined);
138
+ return {
139
+ tsserver,
140
+ componentsCount: components.length
141
+ };
142
+ }
143
+ }
144
+ exports.CheckTypesCmd = CheckTypesCmd;
145
+
146
+ //# sourceMappingURL=check-types.cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_workspace","data","require","_chalk","_interopRequireDefault","_legacy","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CheckTypesCmd","constructor","typescript","workspace","logger","name","description","COMPONENT_PATTERN_HELP","report","pattern","all","unmodified","strict","consoleWarning","start","Date","now","tsserver","componentsCount","runDiagnosticOnTsServer","chalk","bold","code","end","msg","killTsServer","lastDiagnostics","length","red","green","json","diagData","diagnosticData","isJson","OutsideWorkspaceError","components","getComponentsByUserInput","undefined","files","getSupportedFilesForTsserver","initTsserverClientFromWorkspace","aggregateDiagnosticData","printTypeErrors","getTsserverClient","Error","BATCH_SIZE","getDiagnostic","exports"],"sources":["check-types.cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport type { Logger } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { OutsideWorkspaceError } from '@teambit/workspace';\nimport chalk from 'chalk';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { TypescriptMain } from '../typescript.main.runtime';\n\nexport class CheckTypesCmd implements Command {\n name = 'check-types [component-pattern]';\n description = 'validate TypeScript type correctness';\n extendedDescription = `checks for TypeScript type errors in component files, similar to running tsc.\nby default only checks new and modified components. use --unmodified to check all components.\nuseful for catching type issues before tagging, snapping or building components.`;\n arguments = [{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP }];\n alias = '';\n group = 'testing';\n options = [\n ['a', 'all', 'DEPRECATED. (use --unmodified)'],\n ['u', 'unmodified', 'check-types for all components, not only modified and new'],\n ['', 'strict', 'in case issues found, exit with code 1'],\n ['j', 'json', 'return the output in json format'],\n ] as CommandOptions;\n\n constructor(\n private typescript: TypescriptMain,\n private workspace: Workspace,\n private logger: Logger\n ) {}\n\n async report(\n [pattern]: [string],\n { all = false, unmodified = false, strict = false }: { all: boolean; unmodified: boolean; strict: boolean }\n ) {\n if (all) {\n unmodified = all;\n this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);\n }\n const start = Date.now();\n const { tsserver, componentsCount } = await this.runDiagnosticOnTsServer(false, pattern, unmodified);\n if (!tsserver) {\n const data = chalk.bold(`no components found to check.\nuse \"--unmodified\" flag to check all components or specify the ids to check.\notherwise, only new and modified components will be checked`);\n return { code: 0, data };\n }\n const end = Date.now() - start;\n const msg = `completed type checking ${componentsCount} component(s) (${end / 1000} sec)`;\n tsserver.killTsServer();\n if (tsserver.lastDiagnostics.length) {\n return {\n code: strict ? 1 : 0,\n data: chalk.red(`${msg}. found errors in ${tsserver.lastDiagnostics.length} files.`),\n };\n }\n return {\n code: 0,\n data: chalk.green(`${msg}. no errors were found.`),\n };\n }\n\n async json(\n [pattern]: [string],\n { all = false, unmodified = false, strict = false }: { all: boolean; unmodified: boolean; strict: boolean }\n ) {\n if (all) {\n unmodified = all;\n this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);\n }\n const { tsserver } = await this.runDiagnosticOnTsServer(true, pattern, unmodified);\n if (!tsserver) {\n return { code: 0, data: [] };\n }\n const diagData = tsserver.diagnosticData;\n tsserver.killTsServer();\n if (tsserver.lastDiagnostics.length) {\n return {\n code: strict ? 1 : 0,\n data: diagData,\n };\n }\n return {\n code: 0,\n data: diagData,\n };\n }\n\n private async runDiagnosticOnTsServer(\n isJson: boolean,\n pattern: string,\n unmodified: boolean\n ): Promise<{ tsserver: ReturnType<TypescriptMain['getTsserverClient']>; componentsCount: number }> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n // If pattern is provided, don't pass the unmodified flag - the pattern should take precedence\n const components = await this.workspace.getComponentsByUserInput(pattern ? false : unmodified, pattern);\n if (!components.length) {\n return { tsserver: undefined, componentsCount: 0 };\n }\n const files = this.typescript.getSupportedFilesForTsserver(components);\n await this.typescript.initTsserverClientFromWorkspace(\n {\n aggregateDiagnosticData: isJson,\n printTypeErrors: !isJson,\n },\n files\n );\n const tsserver = this.typescript.getTsserverClient();\n if (!tsserver) throw new Error(`unable to start tsserver`);\n // Use batching for large file sets to avoid overwhelming tsserver\n const BATCH_SIZE = 50;\n await tsserver.getDiagnostic(files, files.length > BATCH_SIZE ? BATCH_SIZE : undefined);\n return { tsserver, componentsCount: components.length };\n }\n}\n"],"mappings":";;;;;;AAGA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmE,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAA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1B,QAAQ,EAAE,MAAM,IAAI2B,KAAK,CAAC,0BAA0B,CAAC;IAC1D;IACA,MAAMC,UAAU,GAAG,EAAE;IACrB,MAAM5B,QAAQ,CAAC6B,aAAa,CAACR,KAAK,EAAEA,KAAK,CAACX,MAAM,GAAGkB,UAAU,GAAGA,UAAU,GAAGR,SAAS,CAAC;IACvF,OAAO;MAAEpB,QAAQ;MAAEC,eAAe,EAAEiB,UAAU,CAACR;IAAO,CAAC;EACzD;AACF;AAACoB,OAAA,CAAA/C,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ import type { CompilerOptions } from '@teambit/compiler';
2
+ export type TypeScriptCompilerOptions = {
3
+ /**
4
+ * tsconfig to use during compilation.
5
+ */
6
+ tsconfig: Record<string, any>;
7
+ /**
8
+ * path for .d.ts files to include during build.
9
+ */
10
+ types: string[];
11
+ /**
12
+ * Run the compiler for .js files. this will only affect whether to run the compiler on the files
13
+ * or not. It won't change the tsconfig to support or not support js files.
14
+ */
15
+ compileJs?: boolean;
16
+ /**
17
+ * Run the compiler for .js files. this will only affect whether to run the compiler on the files
18
+ * or not. It won't change the tsconfig to support or not support jsx files.
19
+ */
20
+ compileJsx?: boolean;
21
+ } & Partial<CompilerOptions>;
22
+ export type TsCompilerOptionsWithoutTsConfig = Omit<TypeScriptCompilerOptions, 'tsconfig'>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ //# sourceMappingURL=compiler-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["compiler-options.ts"],"sourcesContent":["import type { CompilerOptions } from '@teambit/compiler';\n\nexport type TypeScriptCompilerOptions = {\n /**\n * tsconfig to use during compilation.\n */\n tsconfig: Record<string, any>;\n\n /**\n * path for .d.ts files to include during build.\n */\n types: string[];\n\n /**\n * Run the compiler for .js files. this will only affect whether to run the compiler on the files\n * or not. It won't change the tsconfig to support or not support js files.\n */\n compileJs?: boolean;\n\n /**\n * Run the compiler for .js files. this will only affect whether to run the compiler on the files\n * or not. It won't change the tsconfig to support or not support jsx files.\n */\n compileJsx?: boolean;\n} & Partial<CompilerOptions>;\n\nexport type TsCompilerOptionsWithoutTsConfig = Omit<TypeScriptCompilerOptions, 'tsconfig'>;\n"],"mappings":"","ignoreList":[]}
package/dist/esm.mjs ADDED
@@ -0,0 +1,21 @@
1
+ // eslint-disable-next-line import/no-unresolved
2
+ import cjsModule from './index.js';
3
+
4
+ export const TypescriptConfigMutator = cjsModule.TypescriptConfigMutator;
5
+ export const TypeScriptExtractor = cjsModule.TypeScriptExtractor;
6
+ export const TypescriptCompiler = cjsModule.TypescriptCompiler;
7
+ export const TypescriptAspect = cjsModule.TypescriptAspect;
8
+ export const SchemaExtractorContext = cjsModule.SchemaExtractorContext;
9
+ export const importTransformer = cjsModule.importTransformer;
10
+ export const exportTransformer = cjsModule.exportTransformer;
11
+ export const classNamesTransformer = cjsModule.classNamesTransformer;
12
+ export const functionNamesTransformer = cjsModule.functionNamesTransformer;
13
+ export const interfaceNamesTransformer = cjsModule.interfaceNamesTransformer;
14
+ export const typeAliasNamesTransformer = cjsModule.typeAliasNamesTransformer;
15
+ export const variableNamesTransformer = cjsModule.variableNamesTransformer;
16
+ export const transformSourceFile = cjsModule.transformSourceFile;
17
+ export const expressionStatementTransformer = cjsModule.expressionStatementTransformer;
18
+ export const typeReferenceTransformer = cjsModule.typeReferenceTransformer;
19
+
20
+ export default cjsModule;
21
+
@@ -0,0 +1 @@
1
+ export { TransformerNotFound } from './transformer-not-found';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "TransformerNotFound", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _transformerNotFound().TransformerNotFound;
10
+ }
11
+ });
12
+ function _transformerNotFound() {
13
+ const data = require("./transformer-not-found");
14
+ _transformerNotFound = function () {
15
+ return data;
16
+ };
17
+ return data;
18
+ }
19
+
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_transformerNotFound","data","require"],"sources":["index.ts"],"sourcesContent":["export { TransformerNotFound } from './transformer-not-found';\n"],"mappings":";;;;;;;;;;;AAAA,SAAAA,qBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,oBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import type { Node } from 'typescript';
2
+ import type { Component } from '@teambit/component';
3
+ import type { Location } from '@teambit/semantics.entities.semantic-schema';
4
+ export declare class TransformerNotFound extends Error {
5
+ readonly node: Node;
6
+ readonly component: Component;
7
+ constructor(node: Node, component: Component, location: Location);
8
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TransformerNotFound = void 0;
7
+ function _typescript() {
8
+ const data = _interopRequireDefault(require("typescript"));
9
+ _typescript = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ class TransformerNotFound extends Error {
16
+ constructor(node, component, location) {
17
+ super(`typescript: could not find schema transformer for node of kind ${node.kind} (${_typescript().default.SyntaxKind[node.kind]}) in component ${component.id.toString()}.
18
+ location: ${node.getSourceFile().fileName}, line: ${location.line}, character: ${location.character}.
19
+ node-text: ${node.getFullText()}`);
20
+ this.node = node;
21
+ this.component = component;
22
+ }
23
+ }
24
+ exports.TransformerNotFound = TransformerNotFound;
25
+
26
+ //# sourceMappingURL=transformer-not-found.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_typescript","data","_interopRequireDefault","require","e","__esModule","default","TransformerNotFound","Error","constructor","node","component","location","kind","ts","SyntaxKind","id","toString","getSourceFile","fileName","line","character","getFullText","exports"],"sources":["transformer-not-found.ts"],"sourcesContent":["import type { Node } from 'typescript';\nimport ts from 'typescript';\nimport type { Component } from '@teambit/component';\nimport type { Location } from '@teambit/semantics.entities.semantic-schema';\n\nexport class TransformerNotFound extends Error {\n constructor(\n readonly node: Node,\n readonly component: Component,\n location: Location\n ) {\n super(\n `typescript: could not find schema transformer for node of kind ${node.kind} (${\n ts.SyntaxKind[node.kind]\n }) in component ${component.id.toString()}.\nlocation: ${node.getSourceFile().fileName}, line: ${location.line}, character: ${location.character}.\nnode-text: ${node.getFullText()}`\n );\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIrB,MAAMG,mBAAmB,SAASC,KAAK,CAAC;EAC7CC,WAAWA,CACAC,IAAU,EACVC,SAAoB,EAC7BC,QAAkB,EAClB;IACA,KAAK,CACH,kEAAkEF,IAAI,CAACG,IAAI,KACzEC,qBAAE,CAACC,UAAU,CAACL,IAAI,CAACG,IAAI,CAAC,kBACRF,SAAS,CAACK,EAAE,CAACC,QAAQ,CAAC,CAAC;AAC/C,aAAaP,IAAI,CAACQ,aAAa,CAAC,CAAC,CAACC,QAAQ,WAAWP,QAAQ,CAACQ,IAAI,gBAAgBR,QAAQ,CAACS,SAAS;AACpG,aAAaX,IAAI,CAACY,WAAW,CAAC,CAAC,EAC3B,CAAC;IAAC,KAVOZ,IAAU,GAAVA,IAAU;IAAA,KACVC,SAAoB,GAApBA,SAAoB;EAU/B;AACF;AAACY,OAAA,CAAAhB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import { Identifier } from './identifier';
2
+ export declare class ExportIdentifier extends Identifier {
3
+ exported: true;
4
+ constructor(id: string, filePath: string, aliasId?: string, sourceFilePath?: string);
5
+ static isExportIdentifier(identifier: Identifier): identifier is ExportIdentifier;
6
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ExportIdentifier = void 0;
7
+ function _identifier() {
8
+ const data = require("./identifier");
9
+ _identifier = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
15
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
16
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
17
+ class ExportIdentifier extends _identifier().Identifier {
18
+ constructor(id, filePath, aliasId, sourceFilePath) {
19
+ super(id, filePath, aliasId, sourceFilePath);
20
+ _defineProperty(this, "exported", void 0);
21
+ this.exported = true;
22
+ }
23
+ static isExportIdentifier(identifier) {
24
+ return 'exported' in identifier;
25
+ }
26
+ }
27
+ exports.ExportIdentifier = ExportIdentifier;
28
+
29
+ //# sourceMappingURL=export-identifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_identifier","data","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ExportIdentifier","Identifier","constructor","id","filePath","aliasId","sourceFilePath","exported","isExportIdentifier","identifier","exports"],"sources":["export-identifier.ts"],"sourcesContent":["import { Identifier } from './identifier';\n\nexport class ExportIdentifier extends Identifier {\n exported: true;\n\n constructor(id: string, filePath: string, aliasId?: string, sourceFilePath?: string) {\n super(id, filePath, aliasId, sourceFilePath);\n this.exported = true;\n }\n\n static isExportIdentifier(identifier: Identifier): identifier is ExportIdentifier {\n return 'exported' in identifier;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0C,SAAAE,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAEnC,MAAMgB,gBAAgB,SAASC,wBAAU,CAAC;EAG/CC,WAAWA,CAACC,EAAU,EAAEC,QAAgB,EAAEC,OAAgB,EAAEC,cAAuB,EAAE;IACnF,KAAK,CAACH,EAAE,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,cAAc,CAAC;IAACzB,eAAA;IAC7C,IAAI,CAAC0B,QAAQ,GAAG,IAAI;EACtB;EAEA,OAAOC,kBAAkBA,CAACC,UAAsB,EAAkC;IAChF,OAAO,UAAU,IAAIA,UAAU;EACjC;AACF;AAACC,OAAA,CAAAV,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ import type { SchemaNodeTransformer, SchemaTransformer } from './schema-transformer';
2
+ export type ExtractorOptions = {
3
+ /**
4
+ * name of the string.
5
+ */
6
+ name?: string;
7
+ /**
8
+ * tsconfig string path.
9
+ */
10
+ tsconfig?: string;
11
+ /**
12
+ * TODO: support typescript module path.
13
+ */
14
+ /**
15
+ * typescript compiler options. always overrides all.
16
+ */
17
+ compilerOptions?: string;
18
+ /**
19
+ * schema transformers.
20
+ */
21
+ schemaTransformers?: SchemaTransformer[];
22
+ /**
23
+ * api transformers.
24
+ */
25
+ apiTransformers?: SchemaNodeTransformer[];
26
+ /**
27
+ * Component-relative includes. Exact if no wildcard; glob-lite if contains * or **.
28
+ * Always materialized under `internals` unless already part of the public API graph.
29
+ */
30
+ includeFiles?: string[];
31
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ //# sourceMappingURL=extractor-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["extractor-options.ts"],"sourcesContent":["import type { SchemaNodeTransformer, SchemaTransformer } from './schema-transformer';\n\nexport type ExtractorOptions = {\n /**\n * name of the string.\n */\n name?: string;\n\n /**\n * tsconfig string path.\n */\n tsconfig?: string;\n\n /**\n * TODO: support typescript module path.\n */\n // typescript?: string;\n\n /**\n * typescript compiler options. always overrides all.\n */\n compilerOptions?: string;\n\n /**\n * schema transformers.\n */\n schemaTransformers?: SchemaTransformer[];\n\n /**\n * api transformers.\n */\n apiTransformers?: SchemaNodeTransformer[];\n\n /**\n * Component-relative includes. Exact if no wildcard; glob-lite if contains * or **.\n * Always materialized under `internals` unless already part of the public API graph.\n */\n includeFiles?: string[];\n};\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import type { Identifier } from './identifier';
2
+ export declare class IdentifierList {
3
+ readonly identifiers: Identifier[];
4
+ constructor(identifiers: Identifier[]);
5
+ find(identifier: Identifier): Identifier | undefined;
6
+ includes(identifier: Identifier): boolean;
7
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.IdentifierList = void 0;
7
+ class IdentifierList {
8
+ constructor(identifiers) {
9
+ this.identifiers = identifiers;
10
+ }
11
+ find(identifier) {
12
+ const result = this.identifiers.find(_identifier => _identifier.isEqual(identifier));
13
+ return result;
14
+ }
15
+ includes(identifier) {
16
+ return Boolean(this.find(identifier));
17
+ }
18
+ }
19
+ exports.IdentifierList = IdentifierList;
20
+
21
+ //# sourceMappingURL=identifier-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["IdentifierList","constructor","identifiers","find","identifier","result","_identifier","isEqual","includes","Boolean","exports"],"sources":["identifier-list.ts"],"sourcesContent":["import type { Identifier } from './identifier';\n\nexport class IdentifierList {\n constructor(readonly identifiers: Identifier[]) {}\n\n find(identifier: Identifier) {\n const result = this.identifiers.find((_identifier) => _identifier.isEqual(identifier));\n return result;\n }\n\n includes(identifier: Identifier) {\n return Boolean(this.find(identifier));\n }\n}\n"],"mappings":";;;;;;AAEO,MAAMA,cAAc,CAAC;EAC1BC,WAAWA,CAAUC,WAAyB,EAAE;IAAA,KAA3BA,WAAyB,GAAzBA,WAAyB;EAAG;EAEjDC,IAAIA,CAACC,UAAsB,EAAE;IAC3B,MAAMC,MAAM,GAAG,IAAI,CAACH,WAAW,CAACC,IAAI,CAAEG,WAAW,IAAKA,WAAW,CAACC,OAAO,CAACH,UAAU,CAAC,CAAC;IACtF,OAAOC,MAAM;EACf;EAEAG,QAAQA,CAACJ,UAAsB,EAAE;IAC/B,OAAOK,OAAO,CAAC,IAAI,CAACN,IAAI,CAACC,UAAU,CAAC,CAAC;EACvC;AACF;AAACM,OAAA,CAAAV,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ export declare class Identifier {
2
+ readonly id: string;
3
+ readonly filePath: string;
4
+ readonly aliasId?: string | undefined;
5
+ readonly sourceFilePath?: string | undefined;
6
+ readonly normalizedPath: string;
7
+ constructor(id: string, filePath: string, aliasId?: string | undefined, sourceFilePath?: string | undefined);
8
+ private static computeNormalizedPath;
9
+ isEqual(identifier: Identifier): boolean;
10
+ static isDefault(identifier: Identifier): boolean;
11
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Identifier = void 0;
7
+ function _path() {
8
+ const data = require("path");
9
+ _path = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _legacy() {
15
+ const data = require("@teambit/legacy.utils");
16
+ _legacy = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
22
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
23
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
24
+ class Identifier {
25
+ constructor(id, filePath, aliasId, sourceFilePath) {
26
+ this.id = id;
27
+ this.filePath = filePath;
28
+ this.aliasId = aliasId;
29
+ this.sourceFilePath = sourceFilePath;
30
+ _defineProperty(this, "normalizedPath", void 0);
31
+ this.normalizedPath = Identifier.computeNormalizedPath(filePath, sourceFilePath);
32
+ }
33
+ static computeNormalizedPath(filePath, sourceFilePath) {
34
+ let effectivePath = filePath;
35
+ const isAbsoluteSourceFilePath = sourceFilePath && (0, _path().isAbsolute)(sourceFilePath);
36
+ const isRelativeSourceFilePath = sourceFilePath && (0, _legacy().isRelativeImport)(sourceFilePath);
37
+ if (isAbsoluteSourceFilePath || isRelativeSourceFilePath) {
38
+ effectivePath = isAbsoluteSourceFilePath ? sourceFilePath : (0, _path().resolve)((0, _path().dirname)(filePath), sourceFilePath);
39
+ }
40
+ return (0, _path().normalize)(effectivePath).replace(/\\/g, '/');
41
+ }
42
+ isEqual(identifier) {
43
+ if (this.filePath !== identifier.filePath && this.normalizedPath !== identifier.normalizedPath) return false;
44
+ if (Identifier.isDefault(identifier) && Identifier.isDefault(this)) return true;
45
+ if (Identifier.isDefault(identifier) || Identifier.isDefault(this)) return false;
46
+ return this.id === identifier.id;
47
+ }
48
+ static isDefault(identifier) {
49
+ return identifier.id === 'default';
50
+ }
51
+ }
52
+ exports.Identifier = Identifier;
53
+
54
+ //# sourceMappingURL=identifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_path","data","require","_legacy","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Identifier","constructor","id","filePath","aliasId","sourceFilePath","normalizedPath","computeNormalizedPath","effectivePath","isAbsoluteSourceFilePath","isAbsolute","isRelativeSourceFilePath","isRelativeImport","resolve","dirname","normalize","replace","isEqual","identifier","isDefault","exports"],"sources":["identifier.ts"],"sourcesContent":["import { isAbsolute, resolve, dirname, normalize } from 'path';\nimport { isRelativeImport } from '@teambit/legacy.utils';\n\nexport class Identifier {\n public readonly normalizedPath: string;\n\n constructor(\n readonly id: string,\n readonly filePath: string,\n readonly aliasId?: string,\n readonly sourceFilePath?: string\n ) {\n this.normalizedPath = Identifier.computeNormalizedPath(filePath, sourceFilePath);\n }\n\n private static computeNormalizedPath(filePath: string, sourceFilePath?: string): string {\n let effectivePath = filePath;\n const isAbsoluteSourceFilePath = sourceFilePath && isAbsolute(sourceFilePath);\n const isRelativeSourceFilePath = sourceFilePath && isRelativeImport(sourceFilePath);\n if (isAbsoluteSourceFilePath || isRelativeSourceFilePath) {\n effectivePath = isAbsoluteSourceFilePath ? sourceFilePath : resolve(dirname(filePath), sourceFilePath);\n }\n return normalize(effectivePath).replace(/\\\\/g, '/');\n }\n\n isEqual(identifier: Identifier): boolean {\n if (this.filePath !== identifier.filePath && this.normalizedPath !== identifier.normalizedPath) return false;\n if (Identifier.isDefault(identifier) && Identifier.isDefault(this)) return true;\n if (Identifier.isDefault(identifier) || Identifier.isDefault(this)) return false;\n return this.id === identifier.id;\n }\n\n static isDefault(identifier: Identifier) {\n return identifier.id === 'default';\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyD,SAAAG,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,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