tsc-ts 0.0.10 → 0.1.1

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 (379) hide show
  1. package/README.md +1 -1
  2. package/bin/tsc-ts.js +70 -1
  3. package/dist/api/compiler/ast-utilities.d.ts +19 -1
  4. package/dist/api/compiler/ast-utilities.js +180 -95
  5. package/dist/api/compiler/ast.d.ts +29 -18
  6. package/dist/api/compiler/ast.js +1040 -1007
  7. package/dist/api/compiler/astnav.js +15 -15
  8. package/dist/api/compiler/binder-utilities.js +186 -186
  9. package/dist/api/compiler/binder.js +290 -263
  10. package/dist/api/compiler/character-codes.js +2 -2
  11. package/dist/api/compiler/checker-calls.js +173 -123
  12. package/dist/api/compiler/checker-classes.d.ts +14 -3
  13. package/dist/api/compiler/checker-classes.js +136 -91
  14. package/dist/api/compiler/checker-contextual.d.ts +20 -0
  15. package/dist/api/compiler/checker-contextual.js +175 -62
  16. package/dist/api/compiler/checker-declaration-order.js +79 -79
  17. package/dist/api/compiler/checker-declarations.d.ts +1 -0
  18. package/dist/api/compiler/checker-declarations.js +160 -136
  19. package/dist/api/compiler/checker-declared-types.js +67 -65
  20. package/dist/api/compiler/checker-decorators.js +77 -77
  21. package/dist/api/compiler/checker-deprecation.d.ts +8 -3
  22. package/dist/api/compiler/checker-deprecation.js +76 -55
  23. package/dist/api/compiler/checker-destructuring.js +47 -45
  24. package/dist/api/compiler/checker-elaboration.js +24 -24
  25. package/dist/api/compiler/checker-emit-helpers.js +4 -4
  26. package/dist/api/compiler/checker-emit-resolver.d.ts +4 -2
  27. package/dist/api/compiler/checker-emit-resolver.js +25 -13
  28. package/dist/api/compiler/checker-evaluator.js +9 -9
  29. package/dist/api/compiler/checker-expressions.js +258 -212
  30. package/dist/api/compiler/checker-functions.js +113 -107
  31. package/dist/api/compiler/checker-generated-code.d.ts +0 -11
  32. package/dist/api/compiler/checker-generated-code.js +28 -52
  33. package/dist/api/compiler/checker-grammar.d.ts +1 -0
  34. package/dist/api/compiler/checker-grammar.js +469 -438
  35. package/dist/api/compiler/checker-heritage.js +91 -93
  36. package/dist/api/compiler/checker-inference.d.ts +77 -5
  37. package/dist/api/compiler/checker-inference.js +487 -113
  38. package/dist/api/compiler/checker-iteration.d.ts +0 -10
  39. package/dist/api/compiler/checker-iteration.js +35 -52
  40. package/dist/api/compiler/checker-javascript.js +14 -14
  41. package/dist/api/compiler/checker-jsdoc.d.ts +8 -10
  42. package/dist/api/compiler/checker-jsdoc.js +67 -58
  43. package/dist/api/compiler/checker-jsx.js +107 -89
  44. package/dist/api/compiler/checker-members.d.ts +9 -2
  45. package/dist/api/compiler/checker-members.js +210 -74
  46. package/dist/api/compiler/checker-modules.d.ts +15 -6
  47. package/dist/api/compiler/checker-modules.js +469 -309
  48. package/dist/api/compiler/checker-narrowing.js +273 -189
  49. package/dist/api/compiler/checker-object-literals.js +25 -22
  50. package/dist/api/compiler/checker-operators.js +126 -118
  51. package/dist/api/compiler/checker-overloads.js +27 -27
  52. package/dist/api/compiler/checker-property-access.js +59 -55
  53. package/dist/api/compiler/checker-services.d.ts +1 -0
  54. package/dist/api/compiler/checker-services.js +222 -210
  55. package/dist/api/compiler/checker-signatures.js +65 -49
  56. package/dist/api/compiler/checker-source-file.d.ts +5 -0
  57. package/dist/api/compiler/checker-source-file.js +154 -130
  58. package/dist/api/compiler/checker-statements.js +33 -32
  59. package/dist/api/compiler/checker-super.js +50 -50
  60. package/dist/api/compiler/checker-symbol-types.js +109 -93
  61. package/dist/api/compiler/checker-symbols.d.ts +13 -1
  62. package/dist/api/compiler/checker-symbols.js +264 -149
  63. package/dist/api/compiler/checker-type-factory.d.ts +5 -0
  64. package/dist/api/compiler/checker-type-factory.js +190 -46
  65. package/dist/api/compiler/checker-type-nodes.d.ts +1 -0
  66. package/dist/api/compiler/checker-type-nodes.js +179 -141
  67. package/dist/api/compiler/checker-type-operators.d.ts +2 -0
  68. package/dist/api/compiler/checker-type-operators.js +110 -63
  69. package/dist/api/compiler/checker-types.d.ts +80 -3
  70. package/dist/api/compiler/checker-types.js +121 -2
  71. package/dist/api/compiler/checker-unused.js +114 -118
  72. package/dist/api/compiler/checker-utilities.js +11 -11
  73. package/dist/api/compiler/checker.d.ts +97 -31
  74. package/dist/api/compiler/checker.js +149 -35
  75. package/dist/api/compiler/command-line.d.ts +1 -3
  76. package/dist/api/compiler/command-line.js +47 -44
  77. package/dist/api/compiler/compile-program.d.ts +24 -4
  78. package/dist/api/compiler/compile-program.js +53 -26
  79. package/dist/api/compiler/diagnostic-messages.d.ts +1849 -1774
  80. package/dist/api/compiler/diagnostic-messages.js +128 -122
  81. package/dist/api/compiler/diagnostics.js +7 -7
  82. package/dist/api/compiler/emitter.d.ts +7 -1
  83. package/dist/api/compiler/emitter.js +53 -11
  84. package/dist/api/compiler/expr-record.d.ts +11 -0
  85. package/dist/api/compiler/expr-record.js +53 -0
  86. package/dist/api/compiler/file-include.d.ts +2 -1
  87. package/dist/api/compiler/file-include.js +11 -7
  88. package/dist/api/compiler/file-loader.d.ts +10 -0
  89. package/dist/api/compiler/file-loader.js +138 -41
  90. package/dist/api/compiler/identifier-name.d.ts +9 -0
  91. package/dist/api/compiler/identifier-name.js +10 -0
  92. package/dist/api/compiler/instantiation.d.ts +7 -0
  93. package/dist/api/compiler/instantiation.js +101 -49
  94. package/dist/api/compiler/jsdoc.js +27 -25
  95. package/dist/api/compiler/link-tables.d.ts +48 -18
  96. package/dist/api/compiler/link-tables.js +80 -37
  97. package/dist/api/compiler/locales/cs-CZ.d.ts +1 -1
  98. package/dist/api/compiler/locales/cs-CZ.js +1 -1
  99. package/dist/api/compiler/locales/de-DE.d.ts +1 -1
  100. package/dist/api/compiler/locales/de-DE.js +1 -1
  101. package/dist/api/compiler/locales/es-ES.d.ts +1 -1
  102. package/dist/api/compiler/locales/es-ES.js +1 -1
  103. package/dist/api/compiler/locales/fr-FR.d.ts +1 -1
  104. package/dist/api/compiler/locales/fr-FR.js +1 -1
  105. package/dist/api/compiler/locales/it-IT.d.ts +1 -1
  106. package/dist/api/compiler/locales/it-IT.js +1 -1
  107. package/dist/api/compiler/locales/ja-JP.d.ts +1 -1
  108. package/dist/api/compiler/locales/ja-JP.js +1 -1
  109. package/dist/api/compiler/locales/ko-KR.d.ts +1 -1
  110. package/dist/api/compiler/locales/ko-KR.js +1 -1
  111. package/dist/api/compiler/locales/pl-PL.d.ts +1 -1
  112. package/dist/api/compiler/locales/pl-PL.js +1 -1
  113. package/dist/api/compiler/locales/pt-BR.d.ts +1 -1
  114. package/dist/api/compiler/locales/pt-BR.js +1 -1
  115. package/dist/api/compiler/locales/ru-RU.d.ts +1 -1
  116. package/dist/api/compiler/locales/ru-RU.js +1 -1
  117. package/dist/api/compiler/locales/tr-TR.d.ts +1 -1
  118. package/dist/api/compiler/locales/tr-TR.js +1 -1
  119. package/dist/api/compiler/locales/zh-CN.d.ts +1 -1
  120. package/dist/api/compiler/locales/zh-CN.js +1 -1
  121. package/dist/api/compiler/locales/zh-TW.d.ts +1 -1
  122. package/dist/api/compiler/locales/zh-TW.js +1 -1
  123. package/dist/api/compiler/module-resolution-types.js +6 -6
  124. package/dist/api/compiler/module-resolution.d.ts +10 -1
  125. package/dist/api/compiler/module-resolution.js +115 -84
  126. package/dist/api/compiler/module-specifiers.d.ts +15 -0
  127. package/dist/api/compiler/module-specifiers.js +24 -18
  128. package/dist/api/compiler/name-resolver.js +74 -65
  129. package/dist/api/compiler/node-builder-names.d.ts +11 -3
  130. package/dist/api/compiler/node-builder-names.js +210 -90
  131. package/dist/api/compiler/node-builder-pseudo.js +29 -31
  132. package/dist/api/compiler/node-builder-reuse.js +23 -22
  133. package/dist/api/compiler/node-builder.d.ts +18 -1
  134. package/dist/api/compiler/node-builder.js +191 -102
  135. package/dist/api/compiler/option-declarations.d.ts +2 -6
  136. package/dist/api/compiler/option-declarations.js +315 -375
  137. package/dist/api/compiler/options.d.ts +15 -33
  138. package/dist/api/compiler/options.js +21 -54
  139. package/dist/api/compiler/output-paths.d.ts +4 -1
  140. package/dist/api/compiler/output-paths.js +6 -11
  141. package/dist/api/compiler/package-json.d.ts +3 -3
  142. package/dist/api/compiler/package-json.js +11 -10
  143. package/dist/api/compiler/parser.d.ts +42 -20
  144. package/dist/api/compiler/parser.js +318 -224
  145. package/dist/api/compiler/path.d.ts +9 -0
  146. package/dist/api/compiler/path.js +20 -3
  147. package/dist/api/compiler/printer/emit-context.d.ts +3 -1
  148. package/dist/api/compiler/printer/emit-context.js +16 -1
  149. package/dist/api/compiler/printer/factory-base.d.ts +2 -2
  150. package/dist/api/compiler/printer/factory-base.js +7 -3
  151. package/dist/api/compiler/printer/factory.js +6 -3
  152. package/dist/api/compiler/printer/helpers.js +10 -1
  153. package/dist/api/compiler/printer/name-generator.d.ts +1 -1
  154. package/dist/api/compiler/printer/name-generator.js +35 -16
  155. package/dist/api/compiler/printer/printer.d.ts +1 -0
  156. package/dist/api/compiler/printer/printer.js +306 -283
  157. package/dist/api/compiler/printer/utilities.js +149 -147
  158. package/dist/api/compiler/program-checker.d.ts +8 -2
  159. package/dist/api/compiler/program-checker.js +84 -34
  160. package/dist/api/compiler/program-utilities.d.ts +3 -1
  161. package/dist/api/compiler/program-utilities.js +28 -15
  162. package/dist/api/compiler/program.d.ts +2 -0
  163. package/dist/api/compiler/program.js +69 -57
  164. package/dist/api/compiler/pseudo-bigint.d.ts +2 -0
  165. package/dist/api/compiler/pseudo-bigint.js +18 -0
  166. package/dist/api/compiler/regexp-checker.d.ts +1 -1
  167. package/dist/api/compiler/regexp-checker.js +93 -76
  168. package/dist/api/compiler/relations.d.ts +27 -4
  169. package/dist/api/compiler/relations.js +337 -180
  170. package/dist/api/compiler/reparser.js +64 -59
  171. package/dist/api/compiler/scanner.d.ts +27 -2
  172. package/dist/api/compiler/scanner.js +181 -150
  173. package/dist/api/compiler/shared-results.d.ts +696 -0
  174. package/dist/api/compiler/shared-results.js +2905 -0
  175. package/dist/api/compiler/sourcemap.js +2 -2
  176. package/dist/api/compiler/symbol-accessibility.js +87 -74
  177. package/dist/api/compiler/symbol.d.ts +22 -13
  178. package/dist/api/compiler/symbol.js +15 -1
  179. package/dist/api/compiler/syntax-kind.d.ts +198 -197
  180. package/dist/api/compiler/transformers/alias-references.js +247 -139
  181. package/dist/api/compiler/transformers/async-utilities.js +25 -25
  182. package/dist/api/compiler/transformers/async.d.ts +0 -1
  183. package/dist/api/compiler/transformers/async.js +64 -77
  184. package/dist/api/compiler/transformers/class-fields.d.ts +1 -0
  185. package/dist/api/compiler/transformers/class-fields.js +81 -78
  186. package/dist/api/compiler/transformers/commonjs-module.js +18 -15
  187. package/dist/api/compiler/transformers/const-enum-inliner.js +1 -1
  188. package/dist/api/compiler/transformers/declarations-diagnostics.js +247 -244
  189. package/dist/api/compiler/transformers/declarations-pseudo.js +100 -100
  190. package/dist/api/compiler/transformers/declarations-resolver.d.ts +0 -3
  191. package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -2
  192. package/dist/api/compiler/transformers/declarations-syntactic.js +134 -156
  193. package/dist/api/compiler/transformers/declarations-tracker.js +18 -18
  194. package/dist/api/compiler/transformers/declarations.d.ts +4 -1
  195. package/dist/api/compiler/transformers/declarations.js +307 -239
  196. package/dist/api/compiler/transformers/decorator-metadata.d.ts +1 -1
  197. package/dist/api/compiler/transformers/decorator-metadata.js +53 -45
  198. package/dist/api/compiler/transformers/decorator-utilities.js +24 -24
  199. package/dist/api/compiler/transformers/destructuring.js +19 -18
  200. package/dist/api/compiler/transformers/emit-resolver.js +1 -1
  201. package/dist/api/compiler/transformers/es-decorators.js +55 -55
  202. package/dist/api/compiler/transformers/external-module-info.js +3 -3
  203. package/dist/api/compiler/transformers/for-await.js +25 -25
  204. package/dist/api/compiler/transformers/import-elision.js +14 -14
  205. package/dist/api/compiler/transformers/jsx.js +12 -12
  206. package/dist/api/compiler/transformers/legacy-decorators.js +17 -17
  207. package/dist/api/compiler/transformers/module.js +8 -8
  208. package/dist/api/compiler/transformers/named-evaluation.js +4 -4
  209. package/dist/api/compiler/transformers/object-rest-spread.js +20 -20
  210. package/dist/api/compiler/transformers/optional-chain.js +10 -10
  211. package/dist/api/compiler/transformers/reference-resolver.d.ts +12 -1
  212. package/dist/api/compiler/transformers/reference-resolver.js +131 -69
  213. package/dist/api/compiler/transformers/runtime-syntax.js +35 -31
  214. package/dist/api/compiler/transformers/subtree-facts.js +47 -47
  215. package/dist/api/compiler/transformers/syntax-facts.js +56 -58
  216. package/dist/api/compiler/transformers/type-eraser.js +73 -66
  217. package/dist/api/compiler/transformers/type-serialization.js +24 -24
  218. package/dist/api/compiler/transformers/using.js +12 -12
  219. package/dist/api/compiler/transformers/utilities.js +77 -77
  220. package/dist/api/compiler/transformers/visitor-base.js +172 -172
  221. package/dist/api/compiler/transformers/visitor-hooks.js +6 -2
  222. package/dist/api/compiler/tsconfig.d.ts +10 -2
  223. package/dist/api/compiler/tsconfig.js +136 -48
  224. package/dist/api/compiler/type-printer.js +40 -3
  225. package/dist/api/compiler/types.d.ts +2 -1
  226. package/dist/api/library/ast.generated.d.ts +42 -39
  227. package/dist/api/library/ast.generated.js +1 -1
  228. package/dist/api/library/compiler-options.generated.d.ts +111 -100
  229. package/dist/api/library/compiler-options.generated.js +1 -1
  230. package/dist/api/library/disk.js +12 -1
  231. package/dist/api/library/enums.generated.d.ts +206 -206
  232. package/dist/api/library/enums.generated.js +206 -206
  233. package/dist/api/library/nodes.js +26 -26
  234. package/package.json +9 -9
  235. package/src/compiler/ast-utilities.ts +99 -7
  236. package/src/compiler/ast.ts +74 -38
  237. package/src/compiler/binder.ts +39 -4
  238. package/src/compiler/cgroup.ts +157 -0
  239. package/src/compiler/character-codes.ts +2 -2
  240. package/src/compiler/checker-calls.ts +76 -8
  241. package/src/compiler/checker-classes.ts +80 -25
  242. package/src/compiler/checker-contextual.ts +110 -1
  243. package/src/compiler/checker-declarations.ts +31 -4
  244. package/src/compiler/checker-declared-types.ts +8 -5
  245. package/src/compiler/checker-decorators.ts +1 -1
  246. package/src/compiler/checker-deprecation.ts +29 -8
  247. package/src/compiler/checker-destructuring.ts +10 -3
  248. package/src/compiler/checker-emit-helpers.ts +1 -0
  249. package/src/compiler/checker-emit-resolver.ts +16 -6
  250. package/src/compiler/checker-expressions.ts +95 -47
  251. package/src/compiler/checker-functions.ts +21 -6
  252. package/src/compiler/checker-generated-code.ts +2 -22
  253. package/src/compiler/checker-grammar.ts +133 -60
  254. package/src/compiler/checker-heritage.ts +22 -21
  255. package/src/compiler/checker-inference.ts +514 -87
  256. package/src/compiler/checker-iteration.ts +18 -31
  257. package/src/compiler/checker-javascript.ts +1 -1
  258. package/src/compiler/checker-jsdoc.ts +50 -27
  259. package/src/compiler/checker-jsx.ts +28 -5
  260. package/src/compiler/checker-members.ts +197 -55
  261. package/src/compiler/checker-modules.ts +332 -65
  262. package/src/compiler/checker-narrowing.ts +98 -19
  263. package/src/compiler/checker-object-literals.ts +3 -0
  264. package/src/compiler/checker-operators.ts +11 -4
  265. package/src/compiler/checker-property-access.ts +7 -2
  266. package/src/compiler/checker-services.ts +39 -12
  267. package/src/compiler/checker-signatures.ts +15 -1
  268. package/src/compiler/checker-source-file.ts +39 -13
  269. package/src/compiler/checker-statements.ts +3 -2
  270. package/src/compiler/checker-symbol-types.ts +29 -6
  271. package/src/compiler/checker-symbols.ts +158 -15
  272. package/src/compiler/checker-type-factory.ts +173 -35
  273. package/src/compiler/checker-type-nodes.ts +46 -3
  274. package/src/compiler/checker-type-operators.ts +83 -26
  275. package/src/compiler/checker-types.ts +147 -4
  276. package/src/compiler/checker-unused.ts +9 -14
  277. package/src/compiler/checker.ts +175 -41
  278. package/src/compiler/command-line.ts +28 -28
  279. package/src/compiler/compile-program.ts +59 -25
  280. package/src/compiler/decoder.ts +15 -5
  281. package/src/compiler/diagnostic-messages.ts +1973 -1892
  282. package/src/compiler/doctor-report.ts +133 -0
  283. package/src/compiler/emitter.ts +57 -8
  284. package/src/compiler/encoder.ts +23 -8
  285. package/src/compiler/expr-record.ts +59 -0
  286. package/src/compiler/file-include.ts +9 -3
  287. package/src/compiler/file-loader.ts +139 -32
  288. package/src/compiler/help.ts +10 -14
  289. package/src/compiler/identifier-name.ts +13 -0
  290. package/src/compiler/incremental.ts +86 -18
  291. package/src/compiler/init.ts +2 -7
  292. package/src/compiler/instantiation.ts +77 -22
  293. package/src/compiler/jsdoc.ts +7 -3
  294. package/src/compiler/link-tables.ts +82 -37
  295. package/src/compiler/locales/cs-CZ.ts +1 -1
  296. package/src/compiler/locales/de-DE.ts +1 -1
  297. package/src/compiler/locales/es-ES.ts +1 -1
  298. package/src/compiler/locales/fr-FR.ts +1 -1
  299. package/src/compiler/locales/it-IT.ts +1 -1
  300. package/src/compiler/locales/ja-JP.ts +1 -1
  301. package/src/compiler/locales/ko-KR.ts +1 -1
  302. package/src/compiler/locales/pl-PL.ts +1 -1
  303. package/src/compiler/locales/pt-BR.ts +1 -1
  304. package/src/compiler/locales/ru-RU.ts +1 -1
  305. package/src/compiler/locales/tr-TR.ts +1 -1
  306. package/src/compiler/locales/zh-CN.ts +1 -1
  307. package/src/compiler/locales/zh-TW.ts +1 -1
  308. package/src/compiler/module-resolution.ts +44 -8
  309. package/src/compiler/module-specifiers.ts +62 -20
  310. package/src/compiler/name-resolver.ts +9 -1
  311. package/src/compiler/node-builder-names.ts +236 -54
  312. package/src/compiler/node-builder-pseudo.ts +4 -7
  313. package/src/compiler/node-builder-reuse.ts +5 -4
  314. package/src/compiler/node-builder.ts +130 -31
  315. package/src/compiler/option-declarations.ts +33 -103
  316. package/src/compiler/options.ts +23 -62
  317. package/src/compiler/output-paths.ts +5 -18
  318. package/src/compiler/package-entrypoints.ts +345 -0
  319. package/src/compiler/package-json.ts +4 -4
  320. package/src/compiler/parallel-check.ts +543 -147
  321. package/src/compiler/parallel-emit.ts +4 -4
  322. package/src/compiler/parser.ts +166 -47
  323. package/src/compiler/path.ts +22 -2
  324. package/src/compiler/printer/emit-context.ts +16 -0
  325. package/src/compiler/printer/factory-base.ts +10 -3
  326. package/src/compiler/printer/factory.ts +7 -3
  327. package/src/compiler/printer/helpers.ts +10 -1
  328. package/src/compiler/printer/name-generator.ts +24 -2
  329. package/src/compiler/printer/printer.ts +39 -16
  330. package/src/compiler/printer/utilities.ts +8 -2
  331. package/src/compiler/program-checker.ts +53 -5
  332. package/src/compiler/program-utilities.ts +23 -10
  333. package/src/compiler/program.ts +13 -1
  334. package/src/compiler/pseudo-bigint.ts +17 -0
  335. package/src/compiler/regexp-checker.ts +63 -30
  336. package/src/compiler/relations.ts +233 -77
  337. package/src/compiler/reparser.ts +14 -5
  338. package/src/compiler/run-config.ts +1383 -0
  339. package/src/compiler/run-record-read.ts +87 -0
  340. package/src/compiler/run-records.ts +575 -0
  341. package/src/compiler/scanner.ts +166 -120
  342. package/src/compiler/shared-results.ts +3144 -0
  343. package/src/compiler/show-config.ts +18 -1
  344. package/src/compiler/sourcemap.ts +2 -2
  345. package/src/compiler/symbol-accessibility.ts +26 -3
  346. package/src/compiler/symbol.ts +31 -14
  347. package/src/compiler/syntax-kind.ts +188 -187
  348. package/src/compiler/thread-entry.ts +22 -3
  349. package/src/compiler/transformers/alias-references.ts +123 -4
  350. package/src/compiler/transformers/async.ts +2 -17
  351. package/src/compiler/transformers/class-fields.ts +13 -12
  352. package/src/compiler/transformers/commonjs-module.ts +11 -7
  353. package/src/compiler/transformers/declarations-diagnostics.ts +5 -3
  354. package/src/compiler/transformers/declarations-pseudo.ts +2 -4
  355. package/src/compiler/transformers/declarations-resolver.ts +0 -3
  356. package/src/compiler/transformers/declarations-syntactic.ts +1 -21
  357. package/src/compiler/transformers/declarations.ts +136 -49
  358. package/src/compiler/transformers/decorator-metadata.ts +9 -1
  359. package/src/compiler/transformers/destructuring.ts +4 -3
  360. package/src/compiler/transformers/external-module-info.ts +1 -1
  361. package/src/compiler/transformers/jsx.ts +2 -1
  362. package/src/compiler/transformers/reference-resolver.ts +83 -19
  363. package/src/compiler/transformers/runtime-syntax.ts +6 -1
  364. package/src/compiler/transformers/syntax-facts.ts +2 -7
  365. package/src/compiler/transformers/type-eraser.ts +10 -1
  366. package/src/compiler/transformers/type-serialization.ts +3 -2
  367. package/src/compiler/transformers/visitor-base.ts +2 -1
  368. package/src/compiler/transformers/visitor-hooks.ts +9 -4
  369. package/src/compiler/tsc-build.ts +67 -6
  370. package/src/compiler/tsc-cli.ts +35 -4
  371. package/src/compiler/tsc-compile.ts +220 -10
  372. package/src/compiler/tsc-watch.ts +97 -47
  373. package/src/compiler/tsconfig.ts +176 -19
  374. package/src/compiler/type-printer.ts +36 -2
  375. package/src/compiler/types.ts +2 -1
  376. package/src/library/ast.generated.ts +57 -41
  377. package/src/library/compiler-options.generated.ts +117 -103
  378. package/src/library/disk.ts +10 -1
  379. package/src/library/enums.generated.ts +196 -196
@@ -527,26 +527,45 @@ export class ReferenceResolver {
527
527
  const moduleDeclaration = moduleDeclarationOfSpecifier(declaration);
528
528
  if (imported === undefined || moduleDeclaration === undefined) return false;
529
529
  const moduleSymbol = this.resolveModuleSpecifier(declaration, getModuleSpecifierOf(moduleDeclaration));
530
- return moduleSymbol !== undefined && this.isExportedThroughTypeOnlyStar(moduleSymbol, imported, new Set<Symbol>());
530
+ return moduleSymbol !== undefined && this.isExportedThroughTypeOnlyStar(moduleSymbol, imported);
531
531
  }
532
532
 
533
- /** Whether a module's export `name` comes from another module through an `export type *` on the way. */
534
- private isExportedThroughTypeOnlyStar(moduleSymbol: Symbol, name: string, visited: Set<Symbol>): boolean {
535
- if (visited.has(moduleSymbol)) return false;
536
- visited.add(moduleSymbol);
537
- const exports = moduleSymbol.exports;
538
- if (exports === undefined || exports.has(name) || name === InternalSymbolName.Default) return false;
533
+ /**
534
+ * Whether a module's export `name` comes from another module through an `export type *`, as tsgo's
535
+ * getExportsOfModuleWorker decides: a module reached through a type-only `export *` has its exports marked, and a
536
+ * module reached without one, even if already visited, clears the mark of its own exports.
537
+ */
538
+ private isExportedThroughTypeOnlyStar(moduleSymbol: Symbol, name: string): boolean {
539
+ if (name === InternalSymbolName.Default) return false;
540
+ const walk = new TypeOnlyStarWalk(name);
541
+ this.visitExportStars(walk, moduleSymbol, false, false);
542
+ return walk.typeOnly && !walk.nonTypeOnly;
543
+ }
544
+
545
+ /** Visits a module of an `export *` walk; returns whether it exports the walk's name. */
546
+ private visitExportStars(
547
+ walk: TypeOnlyStarWalk,
548
+ symbol: Symbol | undefined,
549
+ starIsTypeOnly: boolean,
550
+ isTypeOnly: boolean,
551
+ ): boolean {
552
+ const exports = symbol === undefined ? undefined : symbol.exports;
553
+ if (!isTypeOnly && exports !== undefined && exports.has(walk.name)) walk.nonTypeOnly = true;
554
+ if (symbol === undefined || exports === undefined || walk.visited.has(symbol)) return false;
555
+ walk.visited.add(symbol);
556
+ let found = exports.has(walk.name);
539
557
  const star = exports.get(InternalSymbolName.ExportStar);
540
- if (star === undefined) return false;
541
- for (const declaration of getDeclarations(star)) {
542
- if (!(declaration instanceof ExportDeclaration)) continue;
543
- const target = this.resolveExternalModuleSymbol(
544
- this.resolveModuleSpecifier(declaration, declaration.moduleSpecifier),
545
- );
546
- if (target === undefined || this.getExportFromTable(target, name, new Set<Symbol>()) === undefined) continue;
547
- return declaration.isTypeOnly || this.isExportedThroughTypeOnlyStar(target, name, visited);
548
- }
549
- return false;
558
+ if (star !== undefined)
559
+ for (const declaration of getDeclarations(star)) {
560
+ if (!(declaration instanceof ExportDeclaration)) continue;
561
+ const target = this.resolveExternalModuleSymbol(
562
+ this.resolveModuleSpecifier(declaration, declaration.moduleSpecifier),
563
+ );
564
+ if (this.visitExportStars(walk, target, declaration.isTypeOnly, isTypeOnly || declaration.isTypeOnly))
565
+ found = true;
566
+ }
567
+ if (starIsTypeOnly && found) walk.typeOnly = true;
568
+ return found;
550
569
  }
551
570
 
552
571
  /** Whether a symbol is declared in the global scope. */
@@ -803,6 +822,34 @@ export class ReferenceResolver {
803
822
 
804
823
  // Constant values
805
824
 
825
+ /**
826
+ * The symbol an entity name expression such as `E.A` refers to as an expression: tsgo takes the symbol its checker
827
+ * resolves the expression to, where each name on the left is a value, so a local `let E` hides a const enum `E`.
828
+ */
829
+ private resolveValueEntityName(name: Node): Symbol | undefined {
830
+ let symbol: Symbol | undefined;
831
+ if (name instanceof Identifier) {
832
+ const resolved = this.resolveName(name, name.text, SymbolFlags.Value | SymbolFlags.Alias);
833
+ symbol = resolved === undefined ? undefined : this.getMergedSymbol(resolved);
834
+ } else if (name instanceof PropertyAccessExpression) {
835
+ const left = this.resolveValueEntityName(name.expression);
836
+ const right = name.name;
837
+ if (left === undefined || !(right instanceof Identifier)) return undefined;
838
+ let member = left.exports === undefined ? undefined : left.exports.get(right.text);
839
+ // A namespace merged with an alias also has the members of what the alias names, as its type does.
840
+ if (member === undefined && (left.flags & SymbolFlags.Alias) !== 0) {
841
+ const target = this.resolveAlias(left);
842
+ const targetExports = target === undefined ? undefined : target.exports;
843
+ if (targetExports !== undefined) member = targetExports.get(right.text);
844
+ }
845
+ if (member === undefined || (member.flags & (SymbolFlags.Value | SymbolFlags.Alias)) === 0) return undefined;
846
+ symbol = this.getMergedSymbol(member);
847
+ } else return undefined;
848
+ if (symbol === undefined || (symbol.flags & SymbolFlags.Alias) === 0) return symbol;
849
+ const target = this.resolveAlias(symbol);
850
+ return target === undefined ? undefined : this.getMergedSymbol(target);
851
+ }
852
+
806
853
  /** The value of an enum member, computing the values of its whole declaration. */
807
854
  getEnumMemberValue(member: Node): Evaluation {
808
855
  const declaration = member.parent;
@@ -816,11 +863,11 @@ export class ReferenceResolver {
816
863
  if (node instanceof EnumMember) return this.getEnumMemberValue(node);
817
864
  let symbol: Symbol | undefined;
818
865
  if (node instanceof PropertyAccessExpression) {
819
- if (isEntityNameExpressionNode(node)) symbol = this.resolveEntityName(node, SymbolFlags.Value, false);
866
+ if (isEntityNameExpressionNode(node)) symbol = this.resolveValueEntityName(node);
820
867
  } else if (node instanceof ElementAccessExpression) {
821
868
  const argument = stringLiteralText(node.argumentExpression);
822
869
  if (isEntityNameExpressionNode(node.expression) && argument !== undefined) {
823
- const root = this.resolveEntityName(node.expression, SymbolFlags.Value, false);
870
+ const root = this.resolveValueEntityName(node.expression);
824
871
  const exports = root === undefined ? undefined : root.exports;
825
872
  const member = exports === undefined ? undefined : exports.get(argument);
826
873
  if (member !== undefined) symbol = this.getMergedSymbol(member);
@@ -1131,6 +1178,23 @@ export function getDeclarationOfAliasSymbol(symbol: Symbol): Node | undefined {
1131
1178
  return undefined;
1132
1179
  }
1133
1180
 
1181
+ /** The state of `isExportedThroughTypeOnlyStar`'s walk over the `export *` declarations of modules for one name. */
1182
+ class TypeOnlyStarWalk {
1183
+ readonly name: string;
1184
+ readonly visited: Set<Symbol>;
1185
+ /** Whether a module reached through a type-only `export *` exports the name. */
1186
+ typeOnly: boolean;
1187
+ /** Whether a module reached without one exports the name itself. */
1188
+ nonTypeOnly: boolean;
1189
+
1190
+ constructor(name: string) {
1191
+ this.name = name;
1192
+ this.visited = new Set<Symbol>();
1193
+ this.typeOnly = false;
1194
+ this.nonTypeOnly = false;
1195
+ }
1196
+ }
1197
+
1134
1198
  function isTypeOnlyAlias(symbol: Symbol): boolean {
1135
1199
  let node = getDeclarationOfAliasSymbol(symbol);
1136
1200
  while (node !== undefined) {
@@ -56,6 +56,7 @@ import {
56
56
  import type { EmitResolver } from './emit-resolver.js';
57
57
  import { ConstantKind, type Evaluation } from './reference-resolver.js';
58
58
  import { type TypeScriptFacts } from './subtree-facts.js';
59
+ import { nodeIsDecorated } from './decorator-utilities.js';
59
60
  import { Transformer } from './transformer.js';
60
61
  import {
61
62
  getInnermostModuleDeclaration,
@@ -65,6 +66,7 @@ import {
65
66
  isInstantiatedModule,
66
67
  isParameterPropertyDeclaration,
67
68
  isSameNode,
69
+ modifierFlagsOf,
68
70
  } from './utilities.js';
69
71
 
70
72
  const typeScriptModifiers =
@@ -577,7 +579,10 @@ export class RuntimeSyntax extends Transformer {
577
579
  let name = visitedName instanceof Identifier ? (visitedName as Identifier) : undefined;
578
580
  if (
579
581
  name === undefined &&
580
- (exported || childIsDecorated(this.options.experimentalDecorators === true, node.members))
582
+ (exported ||
583
+ childIsDecorated(this.options.experimentalDecorators === true, node.members) ||
584
+ ((modifierFlagsOf(node) & exportDefault) !== exportDefault &&
585
+ nodeIsDecorated(this.options.experimentalDecorators === true, node, undefined, undefined)))
581
586
  )
582
587
  name = this.factory.createGeneratedNameForNode(node, 0, '', '');
583
588
  const updated: Node = this.factory.updateClassDeclaration(
@@ -4,7 +4,6 @@ import {
4
4
  BinaryExpression,
5
5
  BindingElement,
6
6
  BindingPattern,
7
- CallExpression,
8
7
  CatchClause,
9
8
  ForInOrOfStatement,
10
9
  FunctionDeclaration,
@@ -29,6 +28,7 @@ import {
29
28
  import { ClusteredIntLinkTable } from '../link-tables.js';
30
29
  import { isTypeNodeKind } from '../printer/utilities.js';
31
30
  import { SyntaxKind } from '../syntax-kind.js';
31
+ import { isImportCall } from '../ast-utilities.js';
32
32
  import { TokenFlags } from '../types.js';
33
33
  import { getElementsOfBindingOrAssignmentPattern, getTargetOfBindingOrAssignmentElement } from './destructuring.js';
34
34
 
@@ -267,12 +267,7 @@ export class SyntaxFacts extends NodeVisitor {
267
267
  : SubtreeFacts.None)
268
268
  );
269
269
  case SyntaxKind.CallExpression:
270
- return (
271
- this.children(node) |
272
- (node instanceof CallExpression && node.expression.kind === SyntaxKind.ImportKeyword
273
- ? SubtreeFacts.ContainsDynamicImport
274
- : SubtreeFacts.None)
275
- );
270
+ return this.children(node) | (isImportCall(node) ? SubtreeFacts.ContainsDynamicImport : SubtreeFacts.None);
276
271
  case SyntaxKind.MetaProperty:
277
272
  return node instanceof MetaProperty ? this.propagate(node.name) & ~SubtreeFacts.ContainsIdentifier : 0;
278
273
  case SyntaxKind.SpreadElement:
@@ -398,7 +398,16 @@ export class TypeEraser extends Transformer {
398
398
  case SyntaxKind.ImportClause:
399
399
  if (node instanceof ImportClause) {
400
400
  if (node.phaseModifier === SyntaxKind.TypeKeyword) return undefined;
401
- const bindings = this.visitNode(node.namedBindings);
401
+ let bindings = this.visitNode(node.namedBindings);
402
+ // With a default import, `{}` left by erasing type-only specifiers goes; a `{}` written in the source stays.
403
+ if (
404
+ node.name !== undefined &&
405
+ bindings instanceof NamedImports &&
406
+ bindings.elements.nodes.length === 0 &&
407
+ node.namedBindings instanceof NamedImports &&
408
+ node.namedBindings.elements.nodes.length !== 0
409
+ )
410
+ bindings = undefined;
402
411
  if (node.name === undefined && bindings === undefined) return undefined;
403
412
  return factory.updateImportClause(node, node.phaseModifier, node.name, bindings);
404
413
  }
@@ -22,6 +22,7 @@ import {
22
22
  UnionTypeNode,
23
23
  VariableDeclaration,
24
24
  getIsTypeOnly,
25
+ getText,
25
26
  } from '../ast.js';
26
27
  import { getStrictOptionValue } from '../options.js';
27
28
  import { SyntaxKind } from '../syntax-kind.js';
@@ -119,10 +120,10 @@ function resolveEntityName(
119
120
  const namespace = resolveEntityName(resolver, name.left, SymbolFlags.Namespace, false, location);
120
121
  if (namespace === undefined) return undefined;
121
122
  if (namespace === unknownSymbol) return namespace;
122
- let member = resolver.getExportOfSymbol(namespace, name.right.text);
123
+ let member = resolver.getExportOfSymbol(namespace, getText(name.right));
123
124
  if (member === undefined && (namespace.flags & SymbolFlags.Alias) !== 0) {
124
125
  const target = resolver.resolveAlias(namespace);
125
- if (target !== undefined) member = resolver.getExportOfSymbol(target, name.right.text);
126
+ if (target !== undefined) member = resolver.getExportOfSymbol(target, getText(name.right));
126
127
  }
127
128
  if (member === undefined || (member.flags & (meaning | SymbolFlags.Alias)) === 0) return undefined;
128
129
  symbol = member;
@@ -1186,6 +1186,7 @@ export abstract class VisitorBase extends VisitorHooks {
1186
1186
  this.visitModifiers(node.modifiers),
1187
1187
  node.keyword,
1188
1188
  required(this.visitNode(node.name), node.name),
1189
+ this.visitNode(node.attributes) as TypeLiteralNode | undefined,
1189
1190
  this.visitNode(node.body),
1190
1191
  );
1191
1192
  break;
@@ -1340,7 +1341,7 @@ export abstract class VisitorBase extends VisitorHooks {
1340
1341
  return this.factory.updateQualifiedName(
1341
1342
  node,
1342
1343
  required(this.visitNode(node.left), node.left),
1343
- asIdentifier(this.visitNode(node.right), node.right),
1344
+ required(this.visitNode(node.right), node.right),
1344
1345
  );
1345
1346
  break;
1346
1347
  case SyntaxKind.RestType:
@@ -144,11 +144,16 @@ export abstract class VisitorHooks {
144
144
  if (declarations.length === 0) return updated;
145
145
  const factory = this.factory;
146
146
  if (updated === undefined) return factory.createBlock(declarations, true);
147
- if (!(updated instanceof Block))
148
- return factory.createBlock(
149
- this.context.mergeEnvironment([factory.createReturnStatement(updated)], declarations),
150
- false,
147
+ if (!(updated instanceof Block)) {
148
+ // The return statement takes the expression's range, so its comments are emitted once, before `return`.
149
+ this.context.addEmitFlags(updated, EmitFlags.NoComments);
150
+ const block = this.context.convertToFunctionBlock(updated, false);
151
+ return factory.updateBlock(
152
+ block,
153
+ this.context.mergeEnvironmentList(block.statements, declarations),
154
+ block.multiLine,
151
155
  );
156
+ }
152
157
  return factory.updateBlock(
153
158
  updated,
154
159
  this.context.mergeEnvironmentList(updated.statements, declarations),
@@ -62,12 +62,15 @@ import {
62
62
  exitStatusOf,
63
63
  rechecksOnThreads,
64
64
  reportEmitAndErrors,
65
+ saveRunRecord,
65
66
  Statistics,
66
67
  statisticsOf,
67
68
  SystemTimeStamps,
68
69
  } from './tsc-compile.js';
69
70
  import { sharesPublishedGraphs } from '@scriptc/threads';
70
- import { checkerThreads, parseThreads, shareWithCheckers, startParallelCheck } from './parallel-check.js';
71
+ import { checkerThreads, shareWithCheckers, startParallelCheck } from './parallel-check.js';
72
+ import { preParseConfig, reportRunConfig, type RunConfig } from './run-config.js';
73
+ import { openRecord } from './run-record-read.js';
71
74
  import { emitThreads } from './parallel-emit.js';
72
75
  import { LoadKind, ParseSession, clearPreparedFiles, parallelParse, reportPreparedFiles } from './parallel-parse.js';
73
76
  import { assignSymbolIdsAtCreation } from './symbol.js';
@@ -182,6 +185,8 @@ class BuildTask {
182
185
  buildKind = BuildKind.None;
183
186
  filesToDelete: string[] = [];
184
187
  configTime = 0;
188
+ /** The project's run configuration (run-config.ts), one per project of the build. */
189
+ run: RunConfig | undefined = undefined;
185
190
 
186
191
  constructor(readonly config: string) {}
187
192
  }
@@ -726,6 +731,33 @@ export class Orchestrator {
726
731
  const host = new BuildCompilerHost(sys, this.fs, this.locale);
727
732
  const configOptions = config.options;
728
733
  const checkers = threads ? checkerThreads(configOptions.checkers, configOptions.singleThreaded) : 1;
734
+ // The projects of a build that builds several at once run beside each other, and each one's timings
735
+ // are the machine's, not its own: none keeps a record (run-records.ts). A watcher's builds measure a
736
+ // change, not the project: they keep none either, and read none.
737
+ const builders = this.command.buildOptions.builders ?? (configOptions.singleThreaded === true ? 1 : 4);
738
+ const learning = builders === 1 && !this.watching;
739
+ const opened = learning
740
+ ? openRecord({
741
+ configFile: configOptions.configFilePath ?? task.config,
742
+ rootNames: config.fileNames,
743
+ options: configOptions,
744
+ })
745
+ : undefined;
746
+ // One configuration per project: its parse threads, and the pins of its checker count and sharing.
747
+ const run = (task.run = preParseConfig(configOptions, checkers, process.env, opened?.record, learning));
748
+ if (opened !== undefined) {
749
+ run.recordDirectory = opened.directory;
750
+ run.recordKey = opened.key;
751
+ run.recordFile = opened.file;
752
+ }
753
+ if (builders > 1) {
754
+ run.records = false;
755
+ run.recordsReason = 'concurrent projects';
756
+ }
757
+ if (this.watching) {
758
+ run.records = false;
759
+ run.recordsReason = 'watch mode';
760
+ }
729
761
  if (threads && configOptions.singleThreaded !== true && parallelParse.spawn !== undefined) {
730
762
  // Threads parse and bind the program's files ahead of it (parallel-parse.ts), as for plain
731
763
  // compiles. Here also when the program is checked on this thread, with one checker or after a
@@ -735,7 +767,7 @@ export class Orchestrator {
735
767
  // and parse threads don't load them again.
736
768
  const libraryDirectory = getNormalizedAbsolutePath(sys.defaultLibraryPath, sys.currentDirectory);
737
769
  const session = new ParseSession(
738
- parseThreads(checkers),
770
+ run.parseThreads,
739
771
  configOptions,
740
772
  sys.currentDirectory,
741
773
  task.config,
@@ -777,9 +809,21 @@ export class Orchestrator {
777
809
  times.parseTime = performance.now() - parseStart;
778
810
  const bindStart = performance.now();
779
811
  const checked = new CheckedProgram(program);
812
+ // The project's incremental program, made after checking, keeps the globals found checking a file
813
+ // with the file.
814
+ checked.globalsInFileDiagnostics = true;
780
815
  times.bindTime = performance.now() - bindStart;
781
816
  const options = program.options;
782
817
  const count = mayUseThreads ? checkerThreads(options.checkers, options.singleThreaded, program) : 1;
818
+ // The run's configuration reports the count that checks: a checker thread run decides again once
819
+ // the plan is made (`startParallelCheck`, run-config.ts).
820
+ if (task.run !== undefined) task.run.checkers = count;
821
+ // A project rebuilt on its old build info checks the files a change affects, not the project: it
822
+ // keeps no sample, which records only keep full checks of (`run-records.ts`).
823
+ if (task.run !== undefined && oldSnapshot !== undefined && isIncremental(options)) {
824
+ task.run.records = false;
825
+ task.run.recordsReason = 'incremental recheck';
826
+ }
783
827
  if (count > 1 && oldSnapshot !== undefined) {
784
828
  if (isIncremental(options)) return this.recheckOnThreads(task, checked, times, oldSnapshot, count, then);
785
829
  // Build info of a project that is no longer incremental has no pending emit to give the threads,
@@ -791,10 +835,20 @@ export class Orchestrator {
791
835
  if (count > 1) {
792
836
  // Checker threads also emit the files they check; the incremental program records their
793
837
  // declaration signatures on this thread.
794
- startParallelCheck(checked, count, (checkTime) => {
795
- this.emitAndReport(task, checked, times, oldSnapshot, checkTime);
796
- then();
797
- });
838
+ startParallelCheck(
839
+ checked,
840
+ count,
841
+ (checkTime) => {
842
+ this.emitAndReport(task, checked, times, oldSnapshot, checkTime);
843
+ then();
844
+ },
845
+ true,
846
+ undefined,
847
+ true,
848
+ undefined,
849
+ undefined,
850
+ task.run,
851
+ );
798
852
  return true;
799
853
  }
800
854
  if (mayUseThreads && this.emitsOnThreads(checked, oldSnapshot))
@@ -896,6 +950,9 @@ export class Orchestrator {
896
950
  true,
897
951
  incrementalProgram.emitKindsOnCheckers(files),
898
952
  incrementalProgram.checksOnCheckers,
953
+ undefined,
954
+ undefined,
955
+ task.run,
899
956
  );
900
957
  return true;
901
958
  }
@@ -942,10 +999,14 @@ export class Orchestrator {
942
999
  task.exitStatus = exitStatusOf(result);
943
1000
  if (parallelCheckTime !== undefined) times.checkTime = parallelCheckTime;
944
1001
  const options = program.options;
1002
+ // A project's sample is kept whether or not the build reports statistics, and the section reports
1003
+ // where it went (`run-records.ts`).
1004
+ const records = saveRunRecord(sys, incrementalProgram, task.run);
945
1005
  if (options.diagnostics === true || options.extendedDiagnostics === true) {
946
1006
  times.totalTime = sys.sinceStart();
947
1007
  const statistics = statisticsOf(incrementalProgram);
948
1008
  statistics.report(sys);
1009
+ if (options.extendedDiagnostics === true && task.run !== undefined) reportRunConfig(sys, task.run, records);
949
1010
  task.statistics = statistics;
950
1011
  }
951
1012
  const status = task.status;
@@ -33,8 +33,10 @@ import { Colors, defaultIsPretty, header, printBuildHelp, printHelp, printVersio
33
33
  import { generateTSConfig } from './init.js';
34
34
  import { isIncremental, type CompilerOptions } from './options.js';
35
35
  import { combinePaths, getDirectoryPath, normalizePath } from './path.js';
36
- import { checkerThreads, parseThreads } from './parallel-check.js';
36
+ import { checkerThreads } from './parallel-check.js';
37
37
  import { ParseSession, parallelParse, reportPreparedFiles } from './parallel-parse.js';
38
+ import { preParseConfig, type RunConfig } from './run-config.js';
39
+ import { openRecord } from './run-record-read.js';
38
40
  import { showConfig, type ShowConfigInput } from './show-config.js';
39
41
  import { assignSymbolIdsAtCreation } from './symbol.js';
40
42
  import { sharesPublishedGraphs } from '@scriptc/threads';
@@ -64,6 +66,8 @@ export abstract class System extends CommandLineHost {
64
66
 
65
67
  /** Returns `''` for unset variables. */
66
68
  abstract getEnvironmentVariable(name: string): string;
69
+ /** Whether the variable is set, perhaps to `''`. */
70
+ abstract hasEnvironmentVariable(name: string): boolean;
67
71
  abstract write(text: string): void;
68
72
  abstract fileExists(path: string): boolean;
69
73
  abstract directoryExists(path: string): boolean;
@@ -161,6 +165,8 @@ export type CommandLineResult =
161
165
  readonly errorSummary: ErrorSummaryReporter;
162
166
  /** The build info of an incremental program, read while threads parsed its files; `undefined` if not read yet. */
163
167
  readonly buildInfo?: EarlyBuildInfo;
168
+ /** How the run is configured: parse threads, checker count and sharing (run-config.ts). */
169
+ readonly config: RunConfig;
164
170
  }
165
171
  /** Threads are preparing the program's files; `run` calls back with the result once they are done. */
166
172
  | { readonly kind: 'deferred'; readonly run: (done: (result: CommandLineResult) => void) => void }
@@ -361,6 +367,31 @@ function executeCompile(sys: System, commandLine: ParsedCommandLine): CommandLin
361
367
  const configStart = performance.now();
362
368
  mark('config start');
363
369
  const errors: Diagnostic[] = [];
370
+ // The run's configuration, made once the config's options are known: its parse threads are needed
371
+ // before the first file is parsed.
372
+ let run: RunConfig | undefined = undefined;
373
+ const runConfigOf = (projectOptions: CompilerOptions): RunConfig => {
374
+ if (run === undefined) {
375
+ const opened = openRecord({
376
+ configFile: projectOptions.configFilePath ?? (configFileName === '' ? undefined : configFileName),
377
+ rootNames: fileNames,
378
+ options: projectOptions,
379
+ });
380
+ const made = preParseConfig(
381
+ projectOptions,
382
+ checkerThreads(projectOptions.checkers, projectOptions.singleThreaded),
383
+ process.env,
384
+ opened?.record,
385
+ );
386
+ if (opened !== undefined) {
387
+ made.recordDirectory = opened.directory;
388
+ made.recordKey = opened.key;
389
+ made.recordFile = opened.file;
390
+ }
391
+ run = made;
392
+ }
393
+ return run;
394
+ };
364
395
  // Where threads parse and bind the program's files ahead of it (parallel-parse.ts), they start with
365
396
  // the libraries and the root files found so far while the config's `include` patterns are matched.
366
397
  let session: ParseSession | undefined = undefined;
@@ -368,7 +399,7 @@ function executeCompile(sys: System, commandLine: ParsedCommandLine): CommandLin
368
399
  if (projectOptions.watch === true || options.showConfig === true || !parsesAhead(projectOptions)) return undefined;
369
400
  assignSymbolIdsAtCreation();
370
401
  const started = new ParseSession(
371
- parseThreads(checkerThreads(projectOptions.checkers, projectOptions.singleThreaded)),
402
+ runConfigOf(projectOptions).parseThreads,
372
403
  projectOptions,
373
404
  sys.currentDirectory,
374
405
  configFileName,
@@ -422,20 +453,20 @@ function executeCompile(sys: System, commandLine: ParsedCommandLine): CommandLin
422
453
  reporter,
423
454
  errorSummary,
424
455
  buildInfo,
456
+ config: runConfigOf(config.options),
425
457
  };
426
458
  };
427
459
  if (parsesAhead(config.options)) {
428
460
  // Threads parse and bind the files the program is expected to load first (parallel-parse.ts), and
429
461
  // share the program it becomes: its symbols get their ids when they are created.
430
462
  assignSymbolIdsAtCreation();
431
- const threads = checkerThreads(config.options.checkers, config.options.singleThreaded);
432
463
  return {
433
464
  kind: 'deferred',
434
465
  run: (done: (result: CommandLineResult) => void) => {
435
466
  const session =
436
467
  early ??
437
468
  new ParseSession(
438
- parseThreads(threads),
469
+ runConfigOf(config.options).parseThreads,
439
470
  config.options,
440
471
  sys.currentDirectory,
441
472
  configFileName,