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
@@ -2,15 +2,17 @@
2
2
  * Finds every file of a program: root files, libraries, references, imports and type directives, in tsgo's order.
3
3
  */
4
4
  import { ImportDeclaration, ParseOptions, StringLiteral, getText, } from './ast.js';
5
+ import { messageWithArgs } from './diagnostics.js';
5
6
  import { FileIncludeReason, IncludeProcessor, ProcessingDiagnostic } from './file-include.js';
6
7
  import { ModuleResolutionHost, Resolver, getAutomaticTypeDirectiveNames } from './module-resolution.js';
7
8
  import { getResolutionDiagnostic, inferredTypesContainingFile, } from './module-resolution-types.js';
8
9
  import { getAllowJS, getIsolatedModules, getModuleResolutionKind, ModuleKind, ModuleResolutionKind, } from './options.js';
9
10
  import { isPrepared, preparedLoad, preparedPackageJsonLookups, takePreparedFile, } from './parallel-parse.js';
10
- import { parseSourceFile } from './parser.js';
11
+ import { parseSourceFile, getScriptKindFromFileName } from './parser.js';
11
12
  import { mark } from './timeline.js';
12
- import { combinePaths, fileExtensionIsOneOf, getCanonicalFileName, getDirectoryPath, getNormalizedAbsolutePath, getRootLength, hasJSFileExtension, isRootedDiskPath, normalizePath, normalizeSlashes, removeTrailingDirectorySeparator, supportedTSExtensionsWithJsonFlat, toFileNameLowerCase, toPath, } from './path.js';
13
+ import { combinePaths, fileExtensionIsOneOf, getCanonicalFileName, getDirectoryPath, getNormalizedAbsolutePath, getRootLength, hasJSFileExtension, isRootedDiskPath, normalizePath, normalizeSlashes, removeTrailingDirectorySeparator, supportedTSExtensionsWithJsonFlat, toFileNameLowerCase, toPath, isNetworkPath, } from './path.js';
13
14
  import { getDefaultLibFileName, getDefaultResolutionModeForFile, getExternalModuleIndicatorOptions, getImpliedNodeFormatForFile, getJSXImplicitImportBase, getJSXRuntimeImport, getLibFileName, getModeForUsageLocation, isExternalModule, isSourceFileJS, libFileMetadata, libNames, SourceFileMetadata, } from './program-utilities.js';
15
+ import { isSourcePhaseImport } from './ast-utilities.js';
14
16
  import { hasExtension } from './vfs-match.js';
15
17
  import { ConfigParser, flattenExtensions, getSupportedExtensions, getSupportedExtensionsWithJsonIfResolveJsonModule, } from './tsconfig.js';
16
18
  /** Files and services the compiler reads through. */
@@ -58,7 +60,10 @@ export class CompilerHost extends ModuleResolutionHost {
58
60
  const text = this.fs.readFile(fileName);
59
61
  if (text === undefined)
60
62
  return undefined;
61
- return parseSourceFile(fileName, text, new ParseOptions(path, 0 /* ScriptKind.Unknown */, externalModuleIndicatorOptions));
63
+ // A file without a known extension (with allowNonTsExtensions) parses as TypeScript.
64
+ const kind = getScriptKindFromFileName(fileName);
65
+ const scriptKind = kind === 0 /* ScriptKind.Unknown */ ? 3 /* ScriptKind.TS */ : kind;
66
+ return parseSourceFile(fileName, text, new ParseOptions(path, scriptKind, externalModuleIndicatorOptions));
62
67
  }
63
68
  /** The config of a referenced project, or `undefined` if it can't be read. */
64
69
  getResolvedProjectReference(fileName) {
@@ -187,6 +192,8 @@ class ParseTask {
187
192
  subTasks = undefined;
188
193
  loaded = false;
189
194
  startedSubTasks = false;
195
+ /** A root file name that resolved to no supported file: the task only carries its processing diagnostic. */
196
+ failedLookup = false;
190
197
  metadata = libFileMetadata;
191
198
  resolutionsInFile = undefined;
192
199
  resolutionsTrace = undefined;
@@ -197,6 +204,8 @@ class ParseTask {
197
204
  jsxRuntimeImport = undefined;
198
205
  /** The task of the same file name that was loaded instead of this one. */
199
206
  loadedTask = undefined;
207
+ /** The index in `FileLoader.taskData` of the tasks of this task's path, once known; -1 before. */
208
+ dataIndex = -1;
200
209
  /** Whether an import or a type reference directive adds the file (`ProcessedFiles.addedFiles`). */
201
210
  byImport;
202
211
  constructor(normalizedFilePath, libFile, includeReason, isForAutomaticTypeDirective, increaseDepth,
@@ -228,9 +237,29 @@ class ParseTask {
228
237
  }
229
238
  }
230
239
  const noData = [];
240
+ /** The resolution of a module the importing file declares itself: none. */
241
+ const locallyDeclaredModule = {
242
+ resolvedFileName: '',
243
+ originalPath: '',
244
+ extension: '',
245
+ resolvedUsingTsExtension: false,
246
+ packageId: undefined,
247
+ isExternalLibraryImport: false,
248
+ alternateResult: '',
249
+ resolutionDiagnostics: [],
250
+ };
231
251
  /** The tasks of one path, by file name casing. */
232
252
  class ParseTaskData {
233
253
  tasks = new Map();
254
+ /** Whether a task of the path is queued (`start`). */
255
+ queued = false;
256
+ /** The path's first queued task, the first of `tasks`. */
257
+ first = undefined;
258
+ /**
259
+ * Whether every task of `tasks` is loaded (`run`): then more work of the path does nothing unless it
260
+ * reaches the path at a lower depth.
261
+ */
262
+ settled = false;
234
263
  lowestDepth = Number.MAX_SAFE_INTEGER;
235
264
  startedSubTasks = false;
236
265
  packageId = undefined;
@@ -240,9 +269,10 @@ class ParseTaskData {
240
269
  keptCopy = undefined;
241
270
  /** The paths the file's imports and type reference directives add, once collected. */
242
271
  added = noData;
243
- constructor(task) {
244
- this.tasks.set(task.normalizedFilePath, task);
245
- }
272
+ /** The file name `collect` reached the path by first, once it did. */
273
+ collectedName = undefined;
274
+ /** The path's include reasons, once `collect` found one: the list in `IncludeProcessor.fileIncludeReasons`. */
275
+ reasons = undefined;
246
276
  }
247
277
  /** Pending processing of `tasks[index]`. */
248
278
  class ParseWork {
@@ -407,7 +437,7 @@ export function needsImportHelpersImportSpecifier(file, options) {
407
437
  }
408
438
  /** The module `file` imports the JSX runtime from under `options`, or '' if it imports none. */
409
439
  export function jsxRuntimeImportOf(file, options) {
410
- if (file.scriptKind !== 2 /* ScriptKind.JSX */ && file.scriptKind !== 4 /* ScriptKind.TSX */)
440
+ if (!isSourceFileJS(file) && file.scriptKind !== 4 /* ScriptKind.TSX */)
411
441
  return '';
412
442
  return getJSXRuntimeImport(getJSXImplicitImportBase(options, file), options);
413
443
  }
@@ -481,6 +511,9 @@ export class FileLoader {
481
511
  supportedExtensionsWithJson;
482
512
  maxNodeModuleJsDepth;
483
513
  rootTasks = [];
514
+ /** The tasks of each path, created when a task of the path is first queued or built ahead. */
515
+ taskData = [];
516
+ /** The index in `taskData` of each path's tasks. */
484
517
  taskDataByPath = new Map();
485
518
  /** Work queued by `start`, run last-in first-out like tsgo's single-threaded work group. */
486
519
  work = [];
@@ -548,8 +581,11 @@ export class FileLoader {
548
581
  if (loaded === undefined)
549
582
  continue;
550
583
  const subTasks = this.subTasksOf(loaded);
551
- for (const task of subTasks)
584
+ // Their paths and tasks, found here while threads parse rather than when the walk reaches them.
585
+ for (const task of subTasks) {
552
586
  task.path = this.toPath(task.normalizedFilePath);
587
+ task.dataIndex = this.dataIndexOf(task.path);
588
+ }
553
589
  this.subTasksAhead.set(prepared.fileName, new SubTasksAhead(loaded, subTasks));
554
590
  }
555
591
  }
@@ -616,7 +652,7 @@ export class FileLoader {
616
652
  }
617
653
  walk() {
618
654
  for (let work = this.work.pop(); work !== undefined; work = this.work.pop()) {
619
- if (this.walkingAhead && this.parsesUnprepared(work.tasks[work.index], work.data)) {
655
+ if (this.walkingAhead && !this.elides(work) && this.parsesUnprepared(work.tasks[work.index], work.data)) {
620
656
  this.work.push(work);
621
657
  return;
622
658
  }
@@ -631,6 +667,7 @@ export class FileLoader {
631
667
  */
632
668
  release() {
633
669
  this.rootTasks.length = 0;
670
+ this.taskData.length = 0;
634
671
  this.taskDataByPath.clear();
635
672
  this.work.length = 0;
636
673
  this.subTasksAhead.clear();
@@ -776,6 +813,7 @@ export class FileLoader {
776
813
  return;
777
814
  }
778
815
  const task = new ParseTask(absolute, undefined, reason, false, false, false, undefined);
816
+ task.failedLookup = true;
779
817
  task.addProcessingDiagnostic(ProcessingDiagnostic.explainingFileInclude('', reason, resolved.message, resolved.args));
780
818
  this.rootTasks.push(task);
781
819
  }
@@ -793,17 +831,19 @@ export class FileLoader {
793
831
  getSourceFileFromReference(fileName, referenceText, containingFile, reason) {
794
832
  const allowNonTsExtensions = this.options.allowNonTsExtensions === true;
795
833
  const diagnosticFileName = normalizeSlashes(referenceText);
834
+ if (isNetworkPath(fileName))
835
+ return new ReferenceDiagnostic(1195 /* Diagnostics.Network_path_0_is_not_supported */, [diagnosticFileName]);
796
836
  const fs = this.host.fs;
797
837
  if (hasExtension(fileName)) {
798
838
  const canonicalFileName = getCanonicalFileName(fileName, fs.useCaseSensitiveFileNames);
799
839
  if (!allowNonTsExtensions && !this.isSupportedExtension(canonicalFileName)) {
800
840
  if (hasJSFileExtension(canonicalFileName)) {
801
- return new ReferenceDiagnostic(1519 /* Diagnostics.File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option */, [diagnosticFileName]);
841
+ return new ReferenceDiagnostic(1530 /* Diagnostics.File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option */, [diagnosticFileName]);
802
842
  }
803
- return new ReferenceDiagnostic(1230 /* Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1 */, [diagnosticFileName, this.supportedExtensionsList()]);
843
+ return new ReferenceDiagnostic(1241 /* Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1 */, [diagnosticFileName, this.supportedExtensionsList()]);
804
844
  }
805
845
  if (!fs.fileExists(fileName))
806
- return new ReferenceDiagnostic(1229 /* Diagnostics.File_0_not_found */, [diagnosticFileName]);
846
+ return new ReferenceDiagnostic(1240 /* Diagnostics.File_0_not_found */, [diagnosticFileName]);
807
847
  if (reason.isReferencedFile() &&
808
848
  getCanonicalFileName(containingFile, fs.useCaseSensitiveFileNames) === canonicalFileName) {
809
849
  return new ReferenceDiagnostic(3 /* Diagnostics.A_file_cannot_have_a_reference_to_itself */, []);
@@ -813,14 +853,14 @@ export class FileLoader {
813
853
  if (allowNonTsExtensions) {
814
854
  return fs.fileExists(fileName)
815
855
  ? fileName
816
- : new ReferenceDiagnostic(1229 /* Diagnostics.File_0_not_found */, [diagnosticFileName]);
856
+ : new ReferenceDiagnostic(1240 /* Diagnostics.File_0_not_found */, [diagnosticFileName]);
817
857
  }
818
858
  for (const extension of this.supportedExtensions[0]) {
819
859
  const candidate = fileName + extension;
820
860
  if (fs.fileExists(candidate))
821
861
  return candidate;
822
862
  }
823
- return new ReferenceDiagnostic(1383 /* Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1 */, [
863
+ return new ReferenceDiagnostic(1394 /* Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1 */, [
824
864
  diagnosticFileName,
825
865
  this.supportedExtensionsList(),
826
866
  ]);
@@ -876,31 +916,51 @@ export class FileLoader {
876
916
  }
877
917
  // ---- Loading
878
918
  start(tasks, depth) {
919
+ const taskData = this.taskData;
879
920
  for (let i = 0; i < tasks.length; i++) {
880
921
  const task = tasks[i];
881
- // Sub-tasks built ahead have their paths.
882
- if (task.path === '')
883
- task.path = this.toPath(task.normalizedFilePath);
884
- let data = this.taskDataByPath.get(task.path);
885
- const loaded = data !== undefined;
886
- if (data === undefined) {
887
- data = new ParseTaskData(task);
888
- this.taskDataByPath.set(task.path, data);
922
+ // Sub-tasks built ahead have their paths and tasks.
923
+ let k = task.dataIndex;
924
+ if (k < 0) {
925
+ if (task.path === '')
926
+ task.path = this.toPath(task.normalizedFilePath);
927
+ k = this.dataIndexOf(task.path);
928
+ task.dataIndex = k;
929
+ }
930
+ const data = taskData[k];
931
+ const loaded = data.queued;
932
+ if (!loaded) {
933
+ data.queued = true;
934
+ data.first = task;
935
+ data.tasks.set(task.normalizedFilePath, task);
889
936
  }
890
937
  this.work.push(new ParseWork(tasks, i, data, loaded, depth));
891
938
  }
892
939
  }
940
+ /** The index in `taskData` of the tasks of `path`, created if needed. */
941
+ dataIndexOf(path) {
942
+ let k = this.taskDataByPath.get(path);
943
+ if (k === undefined) {
944
+ k = this.taskData.length;
945
+ this.taskData.push(new ParseTaskData());
946
+ this.taskDataByPath.set(path, k);
947
+ }
948
+ return k;
949
+ }
893
950
  run(work) {
894
951
  const task = work.tasks[work.index];
895
952
  const data = work.data;
896
953
  let startSubTasks = false;
897
954
  if (work.loaded) {
898
- const existing = data.tasks.get(task.normalizedFilePath);
955
+ const name = task.normalizedFilePath;
956
+ const first = data.first;
957
+ const existing = first !== undefined && first.normalizedFilePath === name ? first : data.tasks.get(name);
899
958
  if (existing !== undefined) {
900
959
  task.loadedTask = existing;
901
960
  }
902
961
  else {
903
- data.tasks.set(task.normalizedFilePath, task);
962
+ data.tasks.set(name, task);
963
+ data.settled = false;
904
964
  // A new casing of a file: load its references if another casing's were.
905
965
  startSubTasks = data.startedSubTasks;
906
966
  }
@@ -908,7 +968,8 @@ export class FileLoader {
908
968
  if (data.packageId === undefined && task.packageId !== undefined)
909
969
  data.packageId = task.packageId;
910
970
  const depth = task.increaseDepth ? work.depth + 1 : work.depth;
911
- if (depth < data.lowestDepth) {
971
+ const lowered = depth < data.lowestDepth;
972
+ if (lowered) {
912
973
  // Reached at a lower depth than before: load references again.
913
974
  data.lowestDepth = depth;
914
975
  startSubTasks = true;
@@ -916,6 +977,9 @@ export class FileLoader {
916
977
  }
917
978
  if (task.elideOnDepth && depth > this.maxNodeModuleJsDepth)
918
979
  return;
980
+ // Most work reaches a path already loaded, at no lower depth.
981
+ if (data.settled && !startSubTasks)
982
+ return;
919
983
  for (const taskByFileName of data.tasks.values()) {
920
984
  let loadSubTasks = startSubTasks;
921
985
  if (!taskByFileName.loaded) {
@@ -925,12 +989,23 @@ export class FileLoader {
925
989
  data.startedSubTasks = true;
926
990
  }
927
991
  }
928
- if (!taskByFileName.startedSubTasks && loadSubTasks) {
992
+ // A lower depth restarts references already started, which may now be loaded past `maxNodeModuleJsDepth`.
993
+ // Every file reached from them is at least as deep, so a depth past it changes nothing they load.
994
+ if (loadSubTasks && ((lowered && depth <= this.maxNodeModuleJsDepth) || !taskByFileName.startedSubTasks)) {
929
995
  taskByFileName.startedSubTasks = true;
930
996
  if (taskByFileName.subTasks !== undefined)
931
997
  this.start(taskByFileName.subTasks, data.lowestDepth);
932
998
  }
933
999
  }
1000
+ data.settled = true;
1001
+ }
1002
+ /**
1003
+ * Whether `run` drops `work` without loading its file: a JavaScript file past `maxNodeModuleJsDepth`,
1004
+ * which no parse thread prepares, so the walk ahead does not wait for it.
1005
+ */
1006
+ elides(work) {
1007
+ const task = work.tasks[work.index];
1008
+ return task.elideOnDepth && (task.increaseDepth ? work.depth + 1 : work.depth) > this.maxNodeModuleJsDepth;
934
1009
  }
935
1010
  /**
936
1011
  * Whether running the work of `task` (of `data`'s path) may parse a file that parse threads have not
@@ -950,6 +1025,8 @@ export class FileLoader {
950
1025
  this.loadAutomaticTypeDirectives(task);
951
1026
  return;
952
1027
  }
1028
+ if (task.failedLookup)
1029
+ return;
953
1030
  const redirect = this.mapper.getParseFileRedirect(task.path);
954
1031
  if (redirect !== '') {
955
1032
  const redirected = new ParseTask(normalizePath(redirect), task.libFile, task.includeReason, false, false, false, undefined);
@@ -962,8 +1039,8 @@ export class FileLoader {
962
1039
  const canonicalFileName = getCanonicalFileName(task.normalizedFilePath, fs.useCaseSensitiveFileNames);
963
1040
  if (!this.isSupportedExtension(canonicalFileName)) {
964
1041
  task.addProcessingDiagnostic(hasJSFileExtension(canonicalFileName)
965
- ? ProcessingDiagnostic.explainingFileInclude('', task.includeReason, 1519 /* Diagnostics.File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option */, [task.normalizedFilePath])
966
- : ProcessingDiagnostic.explainingFileInclude('', task.includeReason, 1230 /* Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1 */, [task.normalizedFilePath, this.supportedExtensionsList()]));
1042
+ ? ProcessingDiagnostic.explainingFileInclude('', task.includeReason, 1530 /* Diagnostics.File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option */, [task.normalizedFilePath])
1043
+ : ProcessingDiagnostic.explainingFileInclude('', task.includeReason, 1241 /* Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1 */, [task.normalizedFilePath, this.supportedExtensionsList()]));
967
1044
  return;
968
1045
  }
969
1046
  }
@@ -1085,7 +1162,7 @@ export class FileLoader {
1085
1162
  task.addSubTask(resolved.resolvedFileName, undefined, FileIncludeReason.automaticTypeDirective(name, resolved.packageId), resolved.isExternalLibraryImport, false, resolved.packageId);
1086
1163
  }
1087
1164
  else {
1088
- task.addProcessingDiagnostic(ProcessingDiagnostic.explainingFileInclude('', FileIncludeReason.automaticTypeDirective(name, undefined), 821 /* Diagnostics.Cannot_find_type_definition_file_for_0 */, [name]));
1165
+ task.addProcessingDiagnostic(ProcessingDiagnostic.explainingFileInclude('', FileIncludeReason.automaticTypeDirective(name, undefined), 828 /* Diagnostics.Cannot_find_type_definition_file_for_0 */, [name]));
1089
1166
  }
1090
1167
  }
1091
1168
  task.typeResolutionsInFile = resolutions;
@@ -1120,9 +1197,19 @@ export class FileLoader {
1120
1197
  for (let index = 0; index < moduleNames.length; index++) {
1121
1198
  const entry = moduleNames[index];
1122
1199
  const moduleName = getText(entry);
1123
- if (moduleName === '')
1200
+ // A source phase import loads no module declarations.
1201
+ if (moduleName === '' || isSourcePhaseImport(entry.parent))
1124
1202
  continue;
1125
1203
  const mode = getModeForUsageLocation(file.fileName, task.metadata, entry, options);
1204
+ // A module the file declares itself (`declare module "m"`) isn't resolved.
1205
+ if (file.ambientModuleNames.includes(moduleName)) {
1206
+ if (options.traceResolution === true)
1207
+ task
1208
+ .moduleTraces(true)
1209
+ .push(messageWithArgs(1319 /* Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1 */, moduleName, file.fileName));
1210
+ resolutions.set(modeAwareKey(moduleName, mode), locallyDeclaredModule);
1211
+ continue;
1212
+ }
1126
1213
  const resolved = this.resolver.resolveModuleName(moduleName, containingFile, mode, redirect?.resolved, task.moduleTraces(this.options.traceResolution === true));
1127
1214
  resolutions.set(modeAwareKey(moduleName, mode), resolved);
1128
1215
  const resolvedFileName = resolved.resolvedFileName;
@@ -1173,7 +1260,7 @@ export class FileLoader {
1173
1260
  const redirectFilesByPath = new Map();
1174
1261
  const packageIdToSourceFile = new Map();
1175
1262
  const checkCasing = this.options.forceConsistentCasingInFileNames !== false;
1176
- const seen = new Map();
1263
+ const taskData = this.taskData;
1177
1264
  // The paths each file's imports and type reference directives add (the tasks of each path), for
1178
1265
  // `ProcessedFiles.addedFiles`: recorded while collecting visits them, as their files are only known
1179
1266
  // once every file is collected.
@@ -1189,14 +1276,14 @@ export class FileLoader {
1189
1276
  if (task.loadedTask !== undefined)
1190
1277
  task = task.loadedTask;
1191
1278
  if (includeReason !== undefined)
1192
- addIncludeReason(includeProcessor, task, includeReason);
1279
+ addIncludeReason(includeProcessor, taskData, task, includeReason);
1193
1280
  }
1194
- const data = this.taskDataByPath.get(task.path);
1281
+ const data = task.dataIndex >= 0 ? taskData[task.dataIndex] : undefined;
1195
1282
  if (added !== undefined && data !== undefined && byImport)
1196
1283
  added.push(data);
1197
1284
  if (!task.loaded || data === undefined)
1198
1285
  continue;
1199
- const checkedName = seen.get(data);
1286
+ const checkedName = data.collectedName;
1200
1287
  if (checkedName !== undefined) {
1201
1288
  // The same name normalizes the same: only another spelling needs comparing.
1202
1289
  if (checkCasing &&
@@ -1207,7 +1294,7 @@ export class FileLoader {
1207
1294
  }
1208
1295
  continue;
1209
1296
  }
1210
- seen.set(data, task.normalizedFilePath);
1297
+ data.collectedName = task.normalizedFilePath;
1211
1298
  if (tasksSeenByNameIgnoreCase !== undefined) {
1212
1299
  const lowerCasePath = toFileNameLowerCase(task.path);
1213
1300
  const existing = tasksSeenByNameIgnoreCase.get(lowerCasePath);
@@ -1259,13 +1346,15 @@ export class FileLoader {
1259
1346
  includeProcessor.addProcessingDiagnostic(diagnostic);
1260
1347
  continue;
1261
1348
  }
1262
- const path = task.path;
1263
1349
  for (const diagnostic of task.processingDiagnostics ?? noProcessingDiagnostics)
1264
1350
  includeProcessor.addProcessingDiagnostic(diagnostic);
1265
1351
  if (file === undefined) {
1266
1352
  missingFiles.push(task.normalizedFilePath);
1267
1353
  continue;
1268
1354
  }
1355
+ // The program's maps of the file are keyed by the file's own path: lookups by `file.path` then find
1356
+ // the same string, also for a file a parse thread created, whose path is another string than the task's.
1357
+ const path = file.path === task.path ? file.path : task.path;
1269
1358
  if (task.libFile !== undefined) {
1270
1359
  libFiles.push(file);
1271
1360
  libData.set(file, data);
@@ -1336,12 +1425,20 @@ const noPackageJsonLookups = [];
1336
1425
  export function releaseLater(loader) {
1337
1426
  setImmediate(() => loader.release());
1338
1427
  }
1339
- function addIncludeReason(processor, task, reason) {
1428
+ function addIncludeReason(processor, taskData, task, reason) {
1340
1429
  const redirected = task.redirectedParseTask;
1341
1430
  if (redirected !== undefined)
1342
- addIncludeReason(processor, redirected, reason);
1343
- else if (task.loaded)
1344
- processor.addReason(task.path, reason);
1431
+ addIncludeReason(processor, taskData, redirected, reason);
1432
+ else if (task.loaded) {
1433
+ // The path's list, without looking the path up for each reference to the file.
1434
+ const data = task.dataIndex >= 0 ? taskData[task.dataIndex] : undefined;
1435
+ if (data === undefined)
1436
+ processor.addReason(task.path, reason);
1437
+ else if (data.reasons !== undefined)
1438
+ data.reasons.push(reason);
1439
+ else
1440
+ data.reasons = processor.addReason(task.path, reason);
1441
+ }
1345
1442
  }
1346
1443
  function createProjectReferenceTasks(paths) {
1347
1444
  const tasks = [];
@@ -1358,7 +1455,7 @@ function withoutRoot(path) {
1358
1455
  /** A specifier of an import the compiler adds, such as `tslib` for `importHelpers`. */
1359
1456
  function createSyntheticImport(text, file) {
1360
1457
  const specifier = new StringLiteral(text, 0 /* TokenFlags.None */);
1361
- const declaration = new ImportDeclaration(273 /* SyntaxKind.ImportDeclaration */, undefined, undefined, specifier, undefined);
1458
+ const declaration = new ImportDeclaration(274 /* SyntaxKind.ImportDeclaration */, undefined, undefined, specifier, undefined);
1362
1459
  specifier.parent = declaration;
1363
1460
  declaration.parent = file;
1364
1461
  return specifier;
@@ -0,0 +1,9 @@
1
+ import type { ProgramLifetime } from '@scriptc/types';
2
+ /**
3
+ * The text of an identifier. The identifiers a parser's scanner interns with the same text share one
4
+ * (scanner.ts `IdentifierTable`), and natively an identifier refers to it in 4 bytes.
5
+ */
6
+ export declare class IdentifierName implements ProgramLifetime {
7
+ readonly text: string;
8
+ constructor(text: string);
9
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The text of an identifier. The identifiers a parser's scanner interns with the same text share one
3
+ * (scanner.ts `IdentifierTable`), and natively an identifier refers to it in 4 bytes.
4
+ */
5
+ export class IdentifierName {
6
+ text;
7
+ constructor(text) {
8
+ this.text = text;
9
+ }
10
+ }
@@ -38,6 +38,8 @@ export declare class UniqueLiteralMapper extends TypeMapper {
38
38
  export declare function combineTypeMappers(c: Checker, m1: TypeMapper | undefined, m2: TypeMapper): TypeMapper;
39
39
  export declare function instantiateType(c: Checker, type: Type, mapper: TypeMapper | undefined): Type;
40
40
  export declare function instantiateTypeWithAlias(c: Checker, type: Type, mapper: TypeMapper | undefined, alias: TypeAlias | undefined): Type;
41
+ /** `'a', 'b', 'c'`. */
42
+ export declare function quotedAndCommaSeparated(items: readonly string[]): string;
41
43
  /** Whether `type` could reference a type parameter we infer for. Cached on the type. */
42
44
  export declare function couldContainTypeVariables(c: Checker, type: Type): boolean;
43
45
  /** Whether `node` has a reference to `tp` (or one that may be to it, such as a type query). */
@@ -65,6 +67,11 @@ export declare function instantiateSymbol(c: Checker, symbol: Symbol, mapper: Ty
65
67
  * is resolved yet, so lazily instantiated members record it when tsgo would instantiate them.
66
68
  */
67
69
  export declare function keepsSymbolUnderInstantiation(c: Checker, symbol: Symbol, mapper: TypeMapper): boolean;
70
+ /**
71
+ * Whether the resolved type of `symbol` (and its write type) can't change under instantiation, so that
72
+ * `instantiateSymbol` keeps it whatever the mapper. Once true, it stays true: types are resolved once.
73
+ */
74
+ export declare function keepsSymbolTypeUnderInstantiation(c: Checker, symbol: Symbol): boolean;
68
75
  /** The instantiated copy of `symbol` that `instantiateSymbol` creates when it doesn't keep it. */
69
76
  export declare function newInstantiatedSymbol(c: Checker, symbol: Symbol, mapper: TypeMapper): Symbol;
70
77
  /** Conservatively, whether a parameter or member's type can't reference `this`. */