tsc-ts 0.0.10 → 0.1.0

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 (367) 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 +20 -15
  6. package/dist/api/compiler/ast.js +1023 -995
  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 +134 -90
  14. package/dist/api/compiler/checker-contextual.js +64 -61
  15. package/dist/api/compiler/checker-declaration-order.js +79 -79
  16. package/dist/api/compiler/checker-declarations.d.ts +1 -0
  17. package/dist/api/compiler/checker-declarations.js +160 -136
  18. package/dist/api/compiler/checker-declared-types.js +67 -65
  19. package/dist/api/compiler/checker-decorators.js +77 -77
  20. package/dist/api/compiler/checker-deprecation.d.ts +8 -3
  21. package/dist/api/compiler/checker-deprecation.js +76 -55
  22. package/dist/api/compiler/checker-destructuring.js +47 -45
  23. package/dist/api/compiler/checker-elaboration.js +24 -24
  24. package/dist/api/compiler/checker-emit-helpers.js +4 -4
  25. package/dist/api/compiler/checker-emit-resolver.d.ts +4 -2
  26. package/dist/api/compiler/checker-emit-resolver.js +25 -13
  27. package/dist/api/compiler/checker-evaluator.js +9 -9
  28. package/dist/api/compiler/checker-expressions.js +244 -211
  29. package/dist/api/compiler/checker-functions.js +113 -107
  30. package/dist/api/compiler/checker-generated-code.d.ts +0 -11
  31. package/dist/api/compiler/checker-generated-code.js +28 -52
  32. package/dist/api/compiler/checker-grammar.d.ts +1 -0
  33. package/dist/api/compiler/checker-grammar.js +469 -438
  34. package/dist/api/compiler/checker-heritage.js +91 -93
  35. package/dist/api/compiler/checker-inference.d.ts +77 -5
  36. package/dist/api/compiler/checker-inference.js +487 -113
  37. package/dist/api/compiler/checker-iteration.d.ts +0 -10
  38. package/dist/api/compiler/checker-iteration.js +35 -52
  39. package/dist/api/compiler/checker-javascript.js +14 -14
  40. package/dist/api/compiler/checker-jsdoc.d.ts +8 -10
  41. package/dist/api/compiler/checker-jsdoc.js +67 -58
  42. package/dist/api/compiler/checker-jsx.js +105 -88
  43. package/dist/api/compiler/checker-members.d.ts +9 -2
  44. package/dist/api/compiler/checker-members.js +210 -74
  45. package/dist/api/compiler/checker-modules.d.ts +15 -6
  46. package/dist/api/compiler/checker-modules.js +469 -309
  47. package/dist/api/compiler/checker-narrowing.js +273 -189
  48. package/dist/api/compiler/checker-object-literals.js +25 -22
  49. package/dist/api/compiler/checker-operators.js +126 -118
  50. package/dist/api/compiler/checker-overloads.js +27 -27
  51. package/dist/api/compiler/checker-property-access.js +59 -55
  52. package/dist/api/compiler/checker-services.d.ts +1 -0
  53. package/dist/api/compiler/checker-services.js +222 -210
  54. package/dist/api/compiler/checker-signatures.js +65 -49
  55. package/dist/api/compiler/checker-source-file.d.ts +5 -0
  56. package/dist/api/compiler/checker-source-file.js +154 -130
  57. package/dist/api/compiler/checker-statements.js +33 -32
  58. package/dist/api/compiler/checker-super.js +50 -50
  59. package/dist/api/compiler/checker-symbol-types.js +109 -93
  60. package/dist/api/compiler/checker-symbols.d.ts +13 -1
  61. package/dist/api/compiler/checker-symbols.js +264 -149
  62. package/dist/api/compiler/checker-type-factory.d.ts +5 -0
  63. package/dist/api/compiler/checker-type-factory.js +137 -34
  64. package/dist/api/compiler/checker-type-nodes.d.ts +1 -0
  65. package/dist/api/compiler/checker-type-nodes.js +179 -141
  66. package/dist/api/compiler/checker-type-operators.d.ts +2 -0
  67. package/dist/api/compiler/checker-type-operators.js +110 -63
  68. package/dist/api/compiler/checker-types.d.ts +80 -3
  69. package/dist/api/compiler/checker-types.js +121 -2
  70. package/dist/api/compiler/checker-unused.js +114 -118
  71. package/dist/api/compiler/checker-utilities.js +11 -11
  72. package/dist/api/compiler/checker.d.ts +93 -31
  73. package/dist/api/compiler/checker.js +143 -35
  74. package/dist/api/compiler/command-line.d.ts +1 -3
  75. package/dist/api/compiler/command-line.js +47 -44
  76. package/dist/api/compiler/compile-program.d.ts +19 -4
  77. package/dist/api/compiler/compile-program.js +45 -26
  78. package/dist/api/compiler/diagnostic-messages.d.ts +1849 -1774
  79. package/dist/api/compiler/diagnostic-messages.js +128 -122
  80. package/dist/api/compiler/diagnostics.js +7 -7
  81. package/dist/api/compiler/emitter.d.ts +7 -1
  82. package/dist/api/compiler/emitter.js +53 -11
  83. package/dist/api/compiler/file-include.d.ts +2 -1
  84. package/dist/api/compiler/file-include.js +11 -7
  85. package/dist/api/compiler/file-loader.d.ts +10 -0
  86. package/dist/api/compiler/file-loader.js +138 -41
  87. package/dist/api/compiler/instantiation.d.ts +7 -0
  88. package/dist/api/compiler/instantiation.js +101 -49
  89. package/dist/api/compiler/jsdoc.js +23 -23
  90. package/dist/api/compiler/link-tables.d.ts +48 -18
  91. package/dist/api/compiler/link-tables.js +80 -37
  92. package/dist/api/compiler/locales/cs-CZ.d.ts +1 -1
  93. package/dist/api/compiler/locales/cs-CZ.js +1 -1
  94. package/dist/api/compiler/locales/de-DE.d.ts +1 -1
  95. package/dist/api/compiler/locales/de-DE.js +1 -1
  96. package/dist/api/compiler/locales/es-ES.d.ts +1 -1
  97. package/dist/api/compiler/locales/es-ES.js +1 -1
  98. package/dist/api/compiler/locales/fr-FR.d.ts +1 -1
  99. package/dist/api/compiler/locales/fr-FR.js +1 -1
  100. package/dist/api/compiler/locales/it-IT.d.ts +1 -1
  101. package/dist/api/compiler/locales/it-IT.js +1 -1
  102. package/dist/api/compiler/locales/ja-JP.d.ts +1 -1
  103. package/dist/api/compiler/locales/ja-JP.js +1 -1
  104. package/dist/api/compiler/locales/ko-KR.d.ts +1 -1
  105. package/dist/api/compiler/locales/ko-KR.js +1 -1
  106. package/dist/api/compiler/locales/pl-PL.d.ts +1 -1
  107. package/dist/api/compiler/locales/pl-PL.js +1 -1
  108. package/dist/api/compiler/locales/pt-BR.d.ts +1 -1
  109. package/dist/api/compiler/locales/pt-BR.js +1 -1
  110. package/dist/api/compiler/locales/ru-RU.d.ts +1 -1
  111. package/dist/api/compiler/locales/ru-RU.js +1 -1
  112. package/dist/api/compiler/locales/tr-TR.d.ts +1 -1
  113. package/dist/api/compiler/locales/tr-TR.js +1 -1
  114. package/dist/api/compiler/locales/zh-CN.d.ts +1 -1
  115. package/dist/api/compiler/locales/zh-CN.js +1 -1
  116. package/dist/api/compiler/locales/zh-TW.d.ts +1 -1
  117. package/dist/api/compiler/locales/zh-TW.js +1 -1
  118. package/dist/api/compiler/module-resolution-types.js +6 -6
  119. package/dist/api/compiler/module-resolution.d.ts +10 -1
  120. package/dist/api/compiler/module-resolution.js +115 -84
  121. package/dist/api/compiler/module-specifiers.d.ts +15 -0
  122. package/dist/api/compiler/module-specifiers.js +24 -18
  123. package/dist/api/compiler/name-resolver.js +74 -65
  124. package/dist/api/compiler/node-builder-names.d.ts +11 -3
  125. package/dist/api/compiler/node-builder-names.js +210 -90
  126. package/dist/api/compiler/node-builder-pseudo.js +29 -31
  127. package/dist/api/compiler/node-builder-reuse.js +23 -22
  128. package/dist/api/compiler/node-builder.d.ts +18 -1
  129. package/dist/api/compiler/node-builder.js +191 -102
  130. package/dist/api/compiler/option-declarations.d.ts +2 -6
  131. package/dist/api/compiler/option-declarations.js +315 -375
  132. package/dist/api/compiler/options.d.ts +15 -33
  133. package/dist/api/compiler/options.js +21 -54
  134. package/dist/api/compiler/output-paths.d.ts +4 -1
  135. package/dist/api/compiler/output-paths.js +6 -11
  136. package/dist/api/compiler/package-json.d.ts +3 -3
  137. package/dist/api/compiler/package-json.js +11 -10
  138. package/dist/api/compiler/parser.d.ts +40 -19
  139. package/dist/api/compiler/parser.js +308 -216
  140. package/dist/api/compiler/path.d.ts +9 -0
  141. package/dist/api/compiler/path.js +20 -3
  142. package/dist/api/compiler/printer/emit-context.d.ts +3 -1
  143. package/dist/api/compiler/printer/emit-context.js +16 -1
  144. package/dist/api/compiler/printer/factory-base.d.ts +2 -2
  145. package/dist/api/compiler/printer/factory-base.js +7 -3
  146. package/dist/api/compiler/printer/factory.js +3 -1
  147. package/dist/api/compiler/printer/helpers.js +10 -1
  148. package/dist/api/compiler/printer/name-generator.d.ts +1 -1
  149. package/dist/api/compiler/printer/name-generator.js +35 -16
  150. package/dist/api/compiler/printer/printer.d.ts +1 -0
  151. package/dist/api/compiler/printer/printer.js +303 -281
  152. package/dist/api/compiler/printer/utilities.js +149 -147
  153. package/dist/api/compiler/program-checker.d.ts +8 -2
  154. package/dist/api/compiler/program-checker.js +84 -34
  155. package/dist/api/compiler/program-utilities.d.ts +3 -1
  156. package/dist/api/compiler/program-utilities.js +28 -15
  157. package/dist/api/compiler/program.d.ts +2 -0
  158. package/dist/api/compiler/program.js +69 -57
  159. package/dist/api/compiler/pseudo-bigint.d.ts +2 -0
  160. package/dist/api/compiler/pseudo-bigint.js +18 -0
  161. package/dist/api/compiler/regexp-checker.d.ts +1 -1
  162. package/dist/api/compiler/regexp-checker.js +93 -76
  163. package/dist/api/compiler/relations.d.ts +27 -4
  164. package/dist/api/compiler/relations.js +337 -180
  165. package/dist/api/compiler/reparser.js +60 -56
  166. package/dist/api/compiler/scanner.d.ts +19 -2
  167. package/dist/api/compiler/scanner.js +123 -108
  168. package/dist/api/compiler/shared-results.d.ts +463 -0
  169. package/dist/api/compiler/shared-results.js +2128 -0
  170. package/dist/api/compiler/sourcemap.js +2 -2
  171. package/dist/api/compiler/symbol-accessibility.js +87 -74
  172. package/dist/api/compiler/symbol.d.ts +22 -13
  173. package/dist/api/compiler/symbol.js +15 -1
  174. package/dist/api/compiler/syntax-kind.d.ts +198 -197
  175. package/dist/api/compiler/transformers/alias-references.js +247 -139
  176. package/dist/api/compiler/transformers/async-utilities.js +25 -25
  177. package/dist/api/compiler/transformers/async.d.ts +0 -1
  178. package/dist/api/compiler/transformers/async.js +64 -77
  179. package/dist/api/compiler/transformers/class-fields.d.ts +1 -0
  180. package/dist/api/compiler/transformers/class-fields.js +81 -78
  181. package/dist/api/compiler/transformers/commonjs-module.js +18 -15
  182. package/dist/api/compiler/transformers/const-enum-inliner.js +1 -1
  183. package/dist/api/compiler/transformers/declarations-diagnostics.js +247 -244
  184. package/dist/api/compiler/transformers/declarations-pseudo.js +100 -100
  185. package/dist/api/compiler/transformers/declarations-resolver.d.ts +0 -3
  186. package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -2
  187. package/dist/api/compiler/transformers/declarations-syntactic.js +134 -156
  188. package/dist/api/compiler/transformers/declarations-tracker.js +18 -18
  189. package/dist/api/compiler/transformers/declarations.d.ts +4 -1
  190. package/dist/api/compiler/transformers/declarations.js +305 -238
  191. package/dist/api/compiler/transformers/decorator-metadata.d.ts +1 -1
  192. package/dist/api/compiler/transformers/decorator-metadata.js +53 -45
  193. package/dist/api/compiler/transformers/decorator-utilities.js +24 -24
  194. package/dist/api/compiler/transformers/destructuring.js +19 -18
  195. package/dist/api/compiler/transformers/emit-resolver.js +1 -1
  196. package/dist/api/compiler/transformers/es-decorators.js +55 -55
  197. package/dist/api/compiler/transformers/external-module-info.js +3 -3
  198. package/dist/api/compiler/transformers/for-await.js +25 -25
  199. package/dist/api/compiler/transformers/import-elision.js +14 -14
  200. package/dist/api/compiler/transformers/jsx.js +12 -12
  201. package/dist/api/compiler/transformers/legacy-decorators.js +17 -17
  202. package/dist/api/compiler/transformers/module.js +8 -8
  203. package/dist/api/compiler/transformers/named-evaluation.js +4 -4
  204. package/dist/api/compiler/transformers/object-rest-spread.js +20 -20
  205. package/dist/api/compiler/transformers/optional-chain.js +10 -10
  206. package/dist/api/compiler/transformers/reference-resolver.d.ts +12 -1
  207. package/dist/api/compiler/transformers/reference-resolver.js +131 -69
  208. package/dist/api/compiler/transformers/runtime-syntax.js +35 -31
  209. package/dist/api/compiler/transformers/subtree-facts.js +47 -47
  210. package/dist/api/compiler/transformers/syntax-facts.js +56 -58
  211. package/dist/api/compiler/transformers/type-eraser.js +73 -66
  212. package/dist/api/compiler/transformers/type-serialization.js +24 -24
  213. package/dist/api/compiler/transformers/using.js +12 -12
  214. package/dist/api/compiler/transformers/utilities.js +77 -77
  215. package/dist/api/compiler/transformers/visitor-base.js +172 -172
  216. package/dist/api/compiler/transformers/visitor-hooks.js +6 -2
  217. package/dist/api/compiler/tsconfig.d.ts +10 -2
  218. package/dist/api/compiler/tsconfig.js +136 -48
  219. package/dist/api/compiler/type-printer.js +40 -3
  220. package/dist/api/compiler/types.d.ts +2 -1
  221. package/dist/api/library/ast.generated.d.ts +42 -39
  222. package/dist/api/library/ast.generated.js +1 -1
  223. package/dist/api/library/compiler-options.generated.d.ts +111 -100
  224. package/dist/api/library/compiler-options.generated.js +1 -1
  225. package/dist/api/library/disk.js +12 -1
  226. package/dist/api/library/enums.generated.d.ts +206 -206
  227. package/dist/api/library/enums.generated.js +206 -206
  228. package/dist/api/library/nodes.js +26 -26
  229. package/package.json +9 -9
  230. package/src/compiler/ast-utilities.ts +99 -7
  231. package/src/compiler/ast.ts +55 -26
  232. package/src/compiler/binder.ts +39 -4
  233. package/src/compiler/character-codes.ts +2 -2
  234. package/src/compiler/checker-calls.ts +76 -8
  235. package/src/compiler/checker-classes.ts +78 -24
  236. package/src/compiler/checker-contextual.ts +6 -1
  237. package/src/compiler/checker-declarations.ts +31 -4
  238. package/src/compiler/checker-declared-types.ts +8 -5
  239. package/src/compiler/checker-decorators.ts +1 -1
  240. package/src/compiler/checker-deprecation.ts +29 -8
  241. package/src/compiler/checker-destructuring.ts +10 -3
  242. package/src/compiler/checker-emit-helpers.ts +1 -0
  243. package/src/compiler/checker-emit-resolver.ts +16 -6
  244. package/src/compiler/checker-expressions.ts +79 -46
  245. package/src/compiler/checker-functions.ts +21 -6
  246. package/src/compiler/checker-generated-code.ts +2 -22
  247. package/src/compiler/checker-grammar.ts +133 -60
  248. package/src/compiler/checker-heritage.ts +22 -21
  249. package/src/compiler/checker-inference.ts +514 -87
  250. package/src/compiler/checker-iteration.ts +18 -31
  251. package/src/compiler/checker-javascript.ts +1 -1
  252. package/src/compiler/checker-jsdoc.ts +50 -27
  253. package/src/compiler/checker-jsx.ts +26 -4
  254. package/src/compiler/checker-members.ts +197 -55
  255. package/src/compiler/checker-modules.ts +332 -65
  256. package/src/compiler/checker-narrowing.ts +98 -19
  257. package/src/compiler/checker-object-literals.ts +3 -0
  258. package/src/compiler/checker-operators.ts +11 -4
  259. package/src/compiler/checker-property-access.ts +7 -2
  260. package/src/compiler/checker-services.ts +39 -12
  261. package/src/compiler/checker-signatures.ts +15 -1
  262. package/src/compiler/checker-source-file.ts +39 -13
  263. package/src/compiler/checker-statements.ts +3 -2
  264. package/src/compiler/checker-symbol-types.ts +29 -6
  265. package/src/compiler/checker-symbols.ts +158 -15
  266. package/src/compiler/checker-type-factory.ts +120 -21
  267. package/src/compiler/checker-type-nodes.ts +46 -3
  268. package/src/compiler/checker-type-operators.ts +83 -26
  269. package/src/compiler/checker-types.ts +147 -4
  270. package/src/compiler/checker-unused.ts +9 -14
  271. package/src/compiler/checker.ts +168 -41
  272. package/src/compiler/command-line.ts +28 -28
  273. package/src/compiler/compile-program.ts +51 -25
  274. package/src/compiler/decoder.ts +13 -4
  275. package/src/compiler/diagnostic-messages.ts +1973 -1892
  276. package/src/compiler/emitter.ts +57 -8
  277. package/src/compiler/encoder.ts +23 -8
  278. package/src/compiler/file-include.ts +9 -3
  279. package/src/compiler/file-loader.ts +139 -32
  280. package/src/compiler/help.ts +10 -14
  281. package/src/compiler/incremental.ts +86 -18
  282. package/src/compiler/init.ts +2 -7
  283. package/src/compiler/instantiation.ts +77 -22
  284. package/src/compiler/jsdoc.ts +3 -1
  285. package/src/compiler/link-tables.ts +82 -37
  286. package/src/compiler/locales/cs-CZ.ts +1 -1
  287. package/src/compiler/locales/de-DE.ts +1 -1
  288. package/src/compiler/locales/es-ES.ts +1 -1
  289. package/src/compiler/locales/fr-FR.ts +1 -1
  290. package/src/compiler/locales/it-IT.ts +1 -1
  291. package/src/compiler/locales/ja-JP.ts +1 -1
  292. package/src/compiler/locales/ko-KR.ts +1 -1
  293. package/src/compiler/locales/pl-PL.ts +1 -1
  294. package/src/compiler/locales/pt-BR.ts +1 -1
  295. package/src/compiler/locales/ru-RU.ts +1 -1
  296. package/src/compiler/locales/tr-TR.ts +1 -1
  297. package/src/compiler/locales/zh-CN.ts +1 -1
  298. package/src/compiler/locales/zh-TW.ts +1 -1
  299. package/src/compiler/module-resolution.ts +44 -8
  300. package/src/compiler/module-specifiers.ts +62 -20
  301. package/src/compiler/name-resolver.ts +9 -1
  302. package/src/compiler/node-builder-names.ts +236 -54
  303. package/src/compiler/node-builder-pseudo.ts +4 -7
  304. package/src/compiler/node-builder-reuse.ts +5 -4
  305. package/src/compiler/node-builder.ts +130 -31
  306. package/src/compiler/option-declarations.ts +33 -103
  307. package/src/compiler/options.ts +23 -62
  308. package/src/compiler/output-paths.ts +5 -18
  309. package/src/compiler/package-entrypoints.ts +345 -0
  310. package/src/compiler/package-json.ts +4 -4
  311. package/src/compiler/parallel-check.ts +197 -8
  312. package/src/compiler/parallel-emit.ts +1 -1
  313. package/src/compiler/parser.ts +156 -39
  314. package/src/compiler/path.ts +22 -2
  315. package/src/compiler/printer/emit-context.ts +16 -0
  316. package/src/compiler/printer/factory-base.ts +10 -3
  317. package/src/compiler/printer/factory.ts +4 -1
  318. package/src/compiler/printer/helpers.ts +10 -1
  319. package/src/compiler/printer/name-generator.ts +24 -2
  320. package/src/compiler/printer/printer.ts +35 -14
  321. package/src/compiler/printer/utilities.ts +8 -2
  322. package/src/compiler/program-checker.ts +53 -5
  323. package/src/compiler/program-utilities.ts +23 -10
  324. package/src/compiler/program.ts +13 -1
  325. package/src/compiler/pseudo-bigint.ts +17 -0
  326. package/src/compiler/regexp-checker.ts +63 -30
  327. package/src/compiler/relations.ts +233 -77
  328. package/src/compiler/reparser.ts +7 -2
  329. package/src/compiler/scanner.ts +109 -79
  330. package/src/compiler/shared-results.ts +2414 -0
  331. package/src/compiler/show-config.ts +18 -1
  332. package/src/compiler/sourcemap.ts +2 -2
  333. package/src/compiler/symbol-accessibility.ts +26 -3
  334. package/src/compiler/symbol.ts +31 -14
  335. package/src/compiler/syntax-kind.ts +188 -187
  336. package/src/compiler/thread-entry.ts +19 -2
  337. package/src/compiler/transformers/alias-references.ts +123 -4
  338. package/src/compiler/transformers/async.ts +2 -17
  339. package/src/compiler/transformers/class-fields.ts +13 -12
  340. package/src/compiler/transformers/commonjs-module.ts +11 -7
  341. package/src/compiler/transformers/declarations-diagnostics.ts +5 -3
  342. package/src/compiler/transformers/declarations-pseudo.ts +2 -4
  343. package/src/compiler/transformers/declarations-resolver.ts +0 -3
  344. package/src/compiler/transformers/declarations-syntactic.ts +1 -21
  345. package/src/compiler/transformers/declarations.ts +134 -48
  346. package/src/compiler/transformers/decorator-metadata.ts +9 -1
  347. package/src/compiler/transformers/destructuring.ts +4 -3
  348. package/src/compiler/transformers/external-module-info.ts +1 -1
  349. package/src/compiler/transformers/jsx.ts +2 -1
  350. package/src/compiler/transformers/reference-resolver.ts +83 -19
  351. package/src/compiler/transformers/runtime-syntax.ts +6 -1
  352. package/src/compiler/transformers/syntax-facts.ts +2 -7
  353. package/src/compiler/transformers/type-eraser.ts +10 -1
  354. package/src/compiler/transformers/type-serialization.ts +3 -2
  355. package/src/compiler/transformers/visitor-base.ts +2 -1
  356. package/src/compiler/transformers/visitor-hooks.ts +9 -4
  357. package/src/compiler/tsc-build.ts +3 -0
  358. package/src/compiler/tsc-cli.ts +2 -0
  359. package/src/compiler/tsc-compile.ts +7 -2
  360. package/src/compiler/tsc-watch.ts +74 -45
  361. package/src/compiler/tsconfig.ts +176 -19
  362. package/src/compiler/type-printer.ts +36 -2
  363. package/src/compiler/types.ts +2 -1
  364. package/src/library/ast.generated.ts +57 -41
  365. package/src/library/compiler-options.generated.ts +117 -103
  366. package/src/library/disk.ts +10 -1
  367. package/src/library/enums.generated.ts +196 -196
@@ -127,8 +127,12 @@ export class VisitorHooks {
127
127
  const factory = this.factory;
128
128
  if (updated === undefined)
129
129
  return factory.createBlock(declarations, true);
130
- if (!(updated instanceof Block))
131
- return factory.createBlock(this.context.mergeEnvironment([factory.createReturnStatement(updated)], declarations), false);
130
+ if (!(updated instanceof Block)) {
131
+ // The return statement takes the expression's range, so its comments are emitted once, before `return`.
132
+ this.context.addEmitFlags(updated, 384 /* EmitFlags.NoComments */);
133
+ const block = this.context.convertToFunctionBlock(updated, false);
134
+ return factory.updateBlock(block, this.context.mergeEnvironmentList(block.statements, declarations), block.multiLine);
135
+ }
132
136
  return factory.updateBlock(updated, this.context.mergeEnvironmentList(updated.statements, declarations), updated.multiLine);
133
137
  }
134
138
  visitTopLevelStatements(list) {
@@ -84,6 +84,11 @@ export declare class ParsedCommandLine implements OutputPathsHost {
84
84
  private outputDtsToReference;
85
85
  private commonSourceDirectoryValue;
86
86
  private referencePaths;
87
+ /**
88
+ * The config file's JSON, with what the configs it extends add to `files`, `include`, `exclude` and
89
+ * `compileOnSave`; `undefined` without a config file.
90
+ */
91
+ raw: JsonValue | undefined;
87
92
  constructor(options: CompilerOptions, typeAcquisition: TypeAcquisition | undefined, fileNames: readonly string[], projectReferences: readonly ProjectReference[], configFile: TsConfigSourceFile | undefined, errors: Diagnostic[],
88
93
  /** The config's directory, or the current directory without a config. */
89
94
  currentDirectory: string, useCaseSensitiveFileNames: boolean,
@@ -130,8 +135,11 @@ export declare function findTsConfigArrayElement(file: SourceFile | undefined, k
130
135
  export declare function findArrayElement(property: PropertyAssignment | undefined, value: string): StringLiteral | undefined;
131
136
  /** The text of a property name, or `undefined` for computed names that aren't literals. */
132
137
  export declare function propertyNameText(name: Node): string | undefined;
133
- /** Rejects specs ending in `**` (for `include`) and `..` after a `**`. */
134
- export declare function specToDiagnostic(spec: string, disallowTrailingRecursion: boolean): DiagnosticMessage | undefined;
138
+ /**
139
+ * Rejects specs that resolve to a network root (`basePath` given), specs ending in `**` (for `include`) and `..`
140
+ * after a `**`. `?` is a wildcard in specs, so only UNC and device roots name a network path there.
141
+ */
142
+ export declare function specToDiagnostic(spec: string, disallowTrailingRecursion: boolean, basePath?: string): DiagnosticMessage | undefined;
135
143
  /** Names of options given as `null` on the command line. */
136
144
  export declare function nullKeysOfCommandLine(raw: ReadonlyMap<string, OptionValue> | undefined): Set<string> | undefined;
137
145
  /** Reads config files with a file system, sharing parsed `extends` targets. */
@@ -11,11 +11,11 @@ import { enumNamesList } from './command-line.js';
11
11
  import { compareCodePoints, createCompilerDiagnostic, Diagnostic, } from './diagnostics.js';
12
12
  import { isValidLocale } from './locale.js';
13
13
  import { ModuleResolutionHost, resolveConfig } from './module-resolution.js';
14
- import { compilerOptionsByName, OptionNameMap, typeAcquisitionDeclarations, } from './option-declarations.js';
15
- import { getAllowJS, getResolveJsonModule, mergeCompilerOptions, setCompilerOption, setTypeAcquisitionOption, } from './options.js';
14
+ import { compilerOptionsByName, OptionNameMap, optionsForCompiler, typeAcquisitionDeclarations, } from './option-declarations.js';
15
+ import { getAllowJS, getResolveJsonModule, mergeCompilerOptions, PluginImport, setCompilerOption, setTypeAcquisitionOption, } from './options.js';
16
16
  import { getBuildInfoFileName, getCommonSourceDirectory, getOutputDeclarationFileName, } from './output-paths.js';
17
17
  import { parseSourceFile } from './parser.js';
18
- import { changeExtension, combinePaths, containsPath, fileExtensionIs, fileExtensionIsOneOf, getBaseFileName, getCanonicalFileName, getDirectoryPath, getNormalizedAbsolutePath, getPathComponentsRelativeTo, getPathFromPathComponents, hasJSFileExtension, isDeclarationFileName, isRootedDiskPath, normalizePath, normalizeSlashes, toPath, } from './path.js';
18
+ import { changeExtension, combinePaths, containsPath, fileExtensionIs, fileExtensionIsOneOf, getBaseFileName, getCanonicalFileName, getDirectoryPath, getNormalizedAbsolutePath, getPathComponentsRelativeTo, getPathFromPathComponents, hasJSFileExtension, isDeclarationFileName, isNetworkPathValue, isRootedDiskPath, normalizePath, normalizeSlashes, toPath, } from './path.js';
19
19
  import { skipTrivia } from './scanner.js';
20
20
  import { hasExtension, readDirectory, SpecMatcher, unlimitedDepth } from './vfs-match.js';
21
21
  export class JsonArray {
@@ -161,6 +161,11 @@ export class ParsedCommandLine {
161
161
  outputDtsToReference = undefined;
162
162
  commonSourceDirectoryValue = undefined;
163
163
  referencePaths = undefined;
164
+ /**
165
+ * The config file's JSON, with what the configs it extends add to `files`, `include`, `exclude` and
166
+ * `compileOnSave`; `undefined` without a config file.
167
+ */
168
+ raw = undefined;
164
169
  constructor(options, typeAcquisition, fileNames, projectReferences, configFile, errors,
165
170
  /** The config's directory, or the current directory without a config. */
166
171
  currentDirectory, useCaseSensitiveFileNames,
@@ -233,7 +238,7 @@ export class ParsedCommandLine {
233
238
  if (containsPath(root, file, this.useCaseSensitiveFileNames, this.currentDirectory))
234
239
  continue;
235
240
  const absolute = getCanonicalFileName(getNormalizedAbsolutePath(file, this.currentDirectory), this.useCaseSensitiveFileNames);
236
- this.errors.push(createCompilerDiagnostic(1234 /* Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files */, absolute, root));
241
+ this.errors.push(createCompilerDiagnostic(1245 /* Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files */, absolute, root));
237
242
  }
238
243
  }
239
244
  /** Maps each source of this project to its declaration output and back. */
@@ -313,15 +318,15 @@ function elementOptions(option) {
313
318
  }
314
319
  function unknownKeyMessage(parent) {
315
320
  if (parent === compilerOptionsDeclaration)
316
- return 1121 /* Diagnostics.Unknown_compiler_option_0 */;
321
+ return 1128 /* Diagnostics.Unknown_compiler_option_0 */;
317
322
  if (parent === typeAcquisitionDeclaration)
318
- return 1813 /* Diagnostics.Unknown_type_acquisition_option_0 */;
323
+ return 1833 /* Diagnostics.Unknown_type_acquisition_option_0 */;
319
324
  return undefined;
320
325
  }
321
326
  function unknownKeyDidYouMeanMessage(parent) {
322
327
  return parent === compilerOptionsDeclaration
323
- ? 1123 /* Diagnostics.Unknown_compiler_option_0_Did_you_mean_1 */
324
- : 1821 /* Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1 */;
328
+ ? 1130 /* Diagnostics.Unknown_compiler_option_0_Did_you_mean_1 */
329
+ : 1841 /* Diagnostics.Unknown_type_acquisition_option_0_Did_you_mean_1 */;
325
330
  }
326
331
  function valueTypeName(option) {
327
332
  if (option.kind === 'list')
@@ -365,6 +370,29 @@ export function findPropertyAssignment(object, key, key2 = '') {
365
370
  }
366
371
  return undefined;
367
372
  }
373
+ /**
374
+ * A diagnostic at property `propertyName` of the `index`th project reference: at its value, else at the
375
+ * reference, else a compiler diagnostic. As in tsgo, `index` counts the references the JSON value kept.
376
+ */
377
+ function diagnosticAtProjectReferenceProperty(file, index, propertyName, message, ...args) {
378
+ let node;
379
+ const root = getTsConfigObjectLiteral(file);
380
+ if (root !== undefined)
381
+ for (const property of root.properties.nodes) {
382
+ if (!(property instanceof PropertyAssignment) || propertyNameText(property.name) !== 'references')
383
+ continue;
384
+ const initializer = property.initializer;
385
+ if (!(initializer instanceof ArrayLiteralExpression))
386
+ continue;
387
+ const elements = initializer.elements.nodes;
388
+ if (index >= elements.length || !(elements[index] instanceof ObjectLiteralExpression))
389
+ continue;
390
+ const element = elements[index];
391
+ node = findPropertyAssignment(element, propertyName)?.initializer ?? element;
392
+ break;
393
+ }
394
+ return diagnosticAtNode(file, node, message, ...args);
395
+ }
368
396
  /** The string literal `value` in the array of the root property `key`. */
369
397
  export function findTsConfigArrayElement(file, key, value) {
370
398
  return findArrayElement(findPropertyAssignment(getTsConfigObjectLiteral(file), key), value);
@@ -402,12 +430,17 @@ export function propertyNameText(name) {
402
430
  return undefined;
403
431
  }
404
432
  // ---- Spec validation
405
- /** Rejects specs ending in `**` (for `include`) and `..` after a `**`. */
406
- export function specToDiagnostic(spec, disallowTrailingRecursion) {
433
+ /**
434
+ * Rejects specs that resolve to a network root (`basePath` given), specs ending in `**` (for `include`) and `..`
435
+ * after a `**`. `?` is a wildcard in specs, so only UNC and device roots name a network path there.
436
+ */
437
+ export function specToDiagnostic(spec, disallowTrailingRecursion, basePath) {
438
+ if (basePath !== undefined && getNormalizedAbsolutePath(spec, basePath).startsWith('//'))
439
+ return 1195 /* Diagnostics.Network_path_0_is_not_supported */;
407
440
  if (disallowTrailingRecursion) {
408
441
  const trimmed = spec.endsWith('/') ? spec.slice(0, -1) : spec;
409
442
  if (trimmed === '**' || trimmed.endsWith('/**')) {
410
- return 1118 /* Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0 */;
443
+ return 1125 /* Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0 */;
411
444
  }
412
445
  }
413
446
  const wildcard = spec.startsWith('**/') ? 0 : spec.indexOf('/**/');
@@ -415,15 +448,15 @@ export function specToDiagnostic(spec, disallowTrailingRecursion) {
415
448
  return undefined;
416
449
  const lastDotDot = spec.endsWith('/..') ? spec.length : spec.lastIndexOf('/../');
417
450
  return lastDotDot > wildcard
418
- ? 1140 /* Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0 */
451
+ ? 1147 /* Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0 */
419
452
  : undefined;
420
453
  }
421
- function validateSpecs(specs, disallowTrailingRecursion, file, key, errors) {
454
+ function validateSpecs(specs, disallowTrailingRecursion, basePath, file, key, errors) {
422
455
  const result = [];
423
456
  for (const spec of specs) {
424
457
  if (typeof spec !== 'string')
425
458
  continue;
426
- const message = specToDiagnostic(spec, disallowTrailingRecursion);
459
+ const message = specToDiagnostic(spec, disallowTrailingRecursion, basePath);
427
460
  if (message === undefined)
428
461
  result.push(spec);
429
462
  else
@@ -675,6 +708,8 @@ class ConfigFileConverter {
675
708
  options;
676
709
  typeAcquisition = {};
677
710
  extendedConfigPaths = undefined;
711
+ /** Names of compiler options written at the root instead of in `compilerOptions`. */
712
+ rootCompilerOptions = [];
678
713
  constructor(parser, file, basePath, configFileName, errors) {
679
714
  this.parser = parser;
680
715
  this.file = file;
@@ -707,7 +742,7 @@ class ConfigFileConverter {
707
742
  }
708
743
  }
709
744
  const name = getBaseFileName(this.file.fileName) === 'jsconfig.json' ? 'jsconfig.json' : 'tsconfig.json';
710
- this.errors.push(createCompilerDiagnostic(1166 /* Diagnostics.The_root_value_of_a_0_file_must_be_an_object */, name));
745
+ this.errors.push(diagnosticAtNode(this.file, root, 1173 /* Diagnostics.The_root_value_of_a_0_file_must_be_an_object */, name));
711
746
  return new JsonObject();
712
747
  }
713
748
  return this.convertObject(root, rootDeclaration);
@@ -728,24 +763,24 @@ class ConfigFileConverter {
728
763
  if (expression instanceof NumericLiteral)
729
764
  return Number(expression.text);
730
765
  break;
731
- case 225 /* SyntaxKind.PrefixUnaryExpression */:
766
+ case 226 /* SyntaxKind.PrefixUnaryExpression */:
732
767
  if (expression instanceof PrefixUnaryExpression &&
733
768
  expression.operator === 40 /* SyntaxKind.MinusToken */ &&
734
769
  expression.operand instanceof NumericLiteral) {
735
770
  return -Number(expression.operand.text);
736
771
  }
737
772
  break;
738
- case 211 /* SyntaxKind.ObjectLiteralExpression */:
773
+ case 212 /* SyntaxKind.ObjectLiteralExpression */:
739
774
  if (expression instanceof ObjectLiteralExpression)
740
775
  return this.convertObject(expression, option);
741
776
  break;
742
- case 210 /* SyntaxKind.ArrayLiteralExpression */:
777
+ case 211 /* SyntaxKind.ArrayLiteralExpression */:
743
778
  if (expression instanceof ArrayLiteralExpression)
744
779
  return this.convertArray(expression, option);
745
780
  break;
746
781
  }
747
782
  this.errors.push(option !== undefined
748
- ? diagnosticAtRange(this.file, expression, 1122 /* Diagnostics.Compiler_option_0_requires_a_value_of_type_1 */, option.name, valueTypeName(option))
783
+ ? diagnosticAtRange(this.file, expression, 1129 /* Diagnostics.Compiler_option_0_requires_a_value_of_type_1 */, option.name, valueTypeName(option))
749
784
  : diagnosticAtRange(this.file, expression, 264 /* Diagnostics.Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal */));
750
785
  return null;
751
786
  }
@@ -769,7 +804,7 @@ class ConfigFileConverter {
769
804
  }
770
805
  const postfix = propertyAssignmentPostfixToken(element);
771
806
  if (postfix !== undefined && postfix.kind === 57 /* SyntaxKind.QuestionToken */) {
772
- this.errors.push(diagnosticAtRange(this.file, postfix, 1741 /* Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files */, '?'));
807
+ this.errors.push(diagnosticAtRange(this.file, postfix, 1761 /* Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files */, '?'));
773
808
  }
774
809
  const key = propertyNameText(element.name) ?? '';
775
810
  let option = key !== '' && known !== undefined ? known.get(key) : undefined;
@@ -810,8 +845,14 @@ class ConfigFileConverter {
810
845
  if (option === extendsDeclaration) {
811
846
  this.extendedConfigPaths = this.parser.getExtendsConfigPaths(value, this.basePath, this.configFileName, property, property.initializer, this.file, this.errors);
812
847
  }
813
- else if (option === undefined && key === 'excludes') {
814
- this.errors.push(diagnosticAtNode(this.file, property.name, 1282 /* Diagnostics.Unknown_option_excludes_Did_you_mean_exclude */));
848
+ else if (option === undefined) {
849
+ if (key === 'excludes')
850
+ this.errors.push(diagnosticAtNode(this.file, property.name, 1293 /* Diagnostics.Unknown_option_excludes_Did_you_mean_exclude */));
851
+ for (const compilerOption of optionsForCompiler)
852
+ if (compilerOption.name === key) {
853
+ this.rootCompilerOptions.push(property.name);
854
+ break;
855
+ }
815
856
  }
816
857
  }
817
858
  }
@@ -826,6 +867,15 @@ function setCompilerOptionFromJson(options, option, value) {
826
867
  options.paths = paths;
827
868
  return;
828
869
  }
870
+ if (option.name === 'plugins') {
871
+ if (!(value instanceof JsonArray))
872
+ return;
873
+ options.plugins = value.items.map((item) => {
874
+ const name = item instanceof JsonObject ? item.entries.get('name') : undefined;
875
+ return new PluginImport(typeof name === 'string' ? name : '');
876
+ });
877
+ return;
878
+ }
829
879
  setCompilerOption(options, option.name, toOptionValue(option, value));
830
880
  }
831
881
  function setTypeAcquisitionFromJson(options, option, value) {
@@ -871,7 +921,7 @@ export class ConfigParser {
871
921
  const fileName = getNormalizedAbsolutePath(configFileName, this.currentDirectory);
872
922
  const text = this.fs.readFile(fileName);
873
923
  if (text === undefined) {
874
- errors.push(createCompilerDiagnostic(1158 /* Diagnostics.Cannot_read_file_0 */, fileName));
924
+ errors.push(createCompilerDiagnostic(1165 /* Diagnostics.Cannot_read_file_0 */, fileName));
875
925
  return undefined;
876
926
  }
877
927
  const path = toPath(fileName, this.currentDirectory, this.fs.useCaseSensitiveFileNames);
@@ -898,7 +948,7 @@ export class ConfigParser {
898
948
  const extendsValue = raw instanceof JsonObject ? (raw.entries.get('extends') ?? null) : null;
899
949
  if (files.items !== undefined && files.items.length === 0 && referenceCount === 0 && extendsValue === null) {
900
950
  const filesProperty = findPropertyAssignment(getTsConfigObjectLiteral(file.sourceFile), 'files');
901
- errors.push(diagnosticAtNode(file.sourceFile, filesProperty?.initializer, 1826 /* Diagnostics.The_files_list_in_config_file_0_is_empty */, configFileName !== '' ? configFileName : 'tsconfig.json'));
951
+ errors.push(diagnosticAtNode(file.sourceFile, filesProperty?.initializer, 1846 /* Diagnostics.The_files_list_in_config_file_0_is_empty */, configFileName !== '' ? configFileName : 'tsconfig.json'));
902
952
  }
903
953
  }
904
954
  let include = rawList(raw, 'include');
@@ -919,22 +969,28 @@ export class ConfigParser {
919
969
  let validatedIncludeBeforeSubstitution = [];
920
970
  let validatedInclude = [];
921
971
  if (include.items !== undefined) {
922
- validatedIncludeBeforeSubstitution = validateSpecs(include.items, true, file.sourceFile, 'include', errors);
972
+ validatedIncludeBeforeSubstitution = validateSpecs(include.items, true, basePathForFileNames, file.sourceFile, 'include', errors);
923
973
  validatedInclude =
924
974
  substituteConfigDirInList(validatedIncludeBeforeSubstitution, basePathForFileNames) ??
925
975
  validatedIncludeBeforeSubstitution;
926
976
  }
927
977
  let validatedExclude = [];
928
978
  if (exclude.items !== undefined) {
929
- validatedExclude = validateSpecs(exclude.items, false, file.sourceFile, 'exclude', errors);
979
+ validatedExclude = validateSpecs(exclude.items, false, basePathForFileNames, file.sourceFile, 'exclude', errors);
930
980
  validatedExclude = substituteConfigDirInList(validatedExclude, basePathForFileNames) ?? validatedExclude;
931
981
  }
932
982
  let validatedFilesBeforeSubstitution = [];
933
983
  let validatedFiles = [];
934
984
  if (files.items !== undefined) {
935
- for (const spec of files.items)
936
- if (typeof spec === 'string')
937
- validatedFilesBeforeSubstitution.push(spec);
985
+ for (const spec of files.items) {
986
+ if (typeof spec !== 'string')
987
+ continue;
988
+ if (isNetworkPathValue(spec, basePathForFileNames)) {
989
+ errors.push(diagnosticAtNode(file.sourceFile, findTsConfigArrayElement(file.sourceFile, 'files', spec), 1195 /* Diagnostics.Network_path_0_is_not_supported */, spec));
990
+ continue;
991
+ }
992
+ validatedFilesBeforeSubstitution.push(spec);
993
+ }
938
994
  validatedFiles =
939
995
  substituteConfigDirInList(validatedFilesBeforeSubstitution, basePathForFileNames) ??
940
996
  validatedFilesBeforeSubstitution;
@@ -949,32 +1005,52 @@ export class ConfigParser {
949
1005
  : [];
950
1006
  const canReportNoInputFiles = !(raw instanceof JsonObject) || (!raw.entries.has('files') && !raw.entries.has('references'));
951
1007
  if (this.expandFileNames && fileNames.length === 0 && canReportNoInputFiles) {
952
- errors.push(createCompilerDiagnostic(1827 /* Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2 */, configFileName, jsonList(include.items), jsonList(exclude.items)));
1008
+ errors.push(createCompilerDiagnostic(1847 /* Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2 */, configFileName, jsonList(include.items), jsonList(exclude.items)));
953
1009
  }
954
1010
  const projectReferences = [];
955
1011
  if (references.items !== undefined) {
956
- for (const reference of references.items) {
1012
+ const items = references.items;
1013
+ for (let index = 0; index < items.length; index++) {
1014
+ const reference = items[index];
957
1015
  if (!(reference instanceof JsonObject))
958
1016
  continue;
959
1017
  const path = reference.entries.get('path');
960
- const circular = reference.entries.get('circular');
961
- if (typeof path !== 'string' || path === '')
1018
+ if (typeof path !== 'string') {
1019
+ errors.push(diagnosticAtProjectReferenceProperty(file.sourceFile, index, 'path', 1129 /* Diagnostics.Compiler_option_0_requires_a_value_of_type_1 */, 'reference.path', 'string'));
1020
+ continue;
1021
+ }
1022
+ if (path === '') {
1023
+ errors.push(diagnosticAtProjectReferenceProperty(file.sourceFile, index, 'path', 1887 /* Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string */, 'reference.path'));
1024
+ continue;
1025
+ }
1026
+ if (isNetworkPathValue(path, basePathForFileNames)) {
1027
+ errors.push(diagnosticAtProjectReferenceProperty(file.sourceFile, index, 'path', 1195 /* Diagnostics.Network_path_0_is_not_supported */, path));
962
1028
  continue;
1029
+ }
1030
+ const circular = reference.entries.get('circular');
1031
+ if (circular !== undefined && typeof circular !== 'boolean')
1032
+ errors.push(diagnosticAtProjectReferenceProperty(file.sourceFile, index, 'circular', 1129 /* Diagnostics.Compiler_option_0_requires_a_value_of_type_1 */, 'reference.circular', 'boolean'));
963
1033
  projectReferences.push(new ProjectReference(getNormalizedAbsolutePath(path, basePathForFileNames), path, circular === true));
964
1034
  }
965
1035
  }
966
- return new ParsedCommandLine(options, parsed.typeAcquisition, fileNames, projectReferences, file, errors, basePathForFileNames, cs, literalFiles.size);
1036
+ const parsedCommandLine = new ParsedCommandLine(options, parsed.typeAcquisition, fileNames, projectReferences, file, errors, basePathForFileNames, cs, literalFiles.size);
1037
+ parsedCommandLine.raw = raw;
1038
+ return parsedCommandLine;
967
1039
  }
968
1040
  /** A config file's options with what it extends applied. */
969
1041
  parseConfig(file, basePath, configFileName, resolutionStack, errors) {
970
1042
  basePath = normalizeSlashes(basePath);
971
1043
  const resolvedPath = toPath(configFileName, basePath, this.fs.useCaseSensitiveFileNames);
972
1044
  if (resolutionStack.includes(resolvedPath)) {
973
- errors.push(createCompilerDiagnostic(1825 /* Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0 */));
1045
+ errors.push(createCompilerDiagnostic(1845 /* Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0 */));
974
1046
  return new OwnConfig(null, undefined, undefined, undefined);
975
1047
  }
976
1048
  const converter = new ConfigFileConverter(this, file.sourceFile, basePath, configFileName, errors);
977
1049
  const raw = converter.convertRoot();
1050
+ // A compiler option at the root is reported once, unless there's a `compilerOptions` too.
1051
+ const rootOption = converter.rootCompilerOptions.length > 0 ? converter.rootCompilerOptions[0] : undefined;
1052
+ if (rootOption !== undefined && raw instanceof JsonObject && !raw.entries.has('compilerOptions'))
1053
+ errors.push(diagnosticAtNode(file.sourceFile, rootOption, 1421 /* Diagnostics.X_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file */, propertyNameText(rootOption) ?? ''));
978
1054
  const own = new OwnConfig(raw, converter.options, converter.typeAcquisition, converter.extendedConfigPaths);
979
1055
  const ownOptions = converter.options;
980
1056
  // `paths` may be inherited, so remember which directory it is relative to.
@@ -1066,7 +1142,7 @@ export class ConfigParser {
1066
1142
  parseExtendedConfig(fileName, path, stack) {
1067
1143
  const text = this.fs.readFile(fileName);
1068
1144
  if (text === undefined) {
1069
- const error = createCompilerDiagnostic(1158 /* Diagnostics.Cannot_read_file_0 */, fileName);
1145
+ const error = createCompilerDiagnostic(1165 /* Diagnostics.Cannot_read_file_0 */, fileName);
1070
1146
  const file = new TsConfigSourceFile(parseConfigText(fileName, path, ''));
1071
1147
  file.sourceFile.diagnostics = [error];
1072
1148
  return new ExtendedConfig(file, undefined, [error]);
@@ -1081,11 +1157,11 @@ export class ConfigParser {
1081
1157
  /** Converts a value of `option`, reporting invalid values at `valueExpression`. */
1082
1158
  convertOption(option, value, basePath, property, valueExpression, file, errors) {
1083
1159
  if (option.isCommandLineOnly === true) {
1084
- errors.push(diagnosticAtNode(file, property?.name, 1418 /* Diagnostics.Option_0_can_only_be_specified_on_command_line */, option.name));
1160
+ errors.push(diagnosticAtNode(file, property?.name, 1429 /* Diagnostics.Option_0_can_only_be_specified_on_command_line */, option.name));
1085
1161
  return null;
1086
1162
  }
1087
1163
  if (!isOptionValue(option, value)) {
1088
- errors.push(diagnosticAtNode(file, valueExpression, 1122 /* Diagnostics.Compiler_option_0_requires_a_value_of_type_1 */, option.name, valueTypeName(option)));
1164
+ errors.push(diagnosticAtNode(file, valueExpression, 1129 /* Diagnostics.Compiler_option_0_requires_a_value_of_type_1 */, option.name, valueTypeName(option)));
1089
1165
  return null;
1090
1166
  }
1091
1167
  const element = option.element;
@@ -1105,6 +1181,10 @@ export class ConfigParser {
1105
1181
  const validated = validateOptionValue(option, value, valueExpression, file, errors);
1106
1182
  if (validated === null || option.isFilePath !== true || typeof validated !== 'string')
1107
1183
  return validated;
1184
+ if (isNetworkPathValue(validated, basePath)) {
1185
+ errors.push(diagnosticAtNode(file, valueExpression, 1195 /* Diagnostics.Network_path_0_is_not_supported */, validated));
1186
+ return null;
1187
+ }
1108
1188
  let path = normalizeSlashes(validated);
1109
1189
  if (!startsWithConfigDirTemplate(path))
1110
1190
  path = getNormalizedAbsolutePath(path, basePath);
@@ -1156,12 +1236,16 @@ export class ConfigParser {
1156
1236
  }
1157
1237
  getExtendsConfigPath(extendedConfig, basePath, valueExpression, file, errors) {
1158
1238
  extendedConfig = normalizeSlashes(extendedConfig);
1239
+ if (isNetworkPathValue(extendedConfig, basePath)) {
1240
+ errors.push(diagnosticAtNode(file, valueExpression, 1195 /* Diagnostics.Network_path_0_is_not_supported */, extendedConfig));
1241
+ return '';
1242
+ }
1159
1243
  if (isRootedDiskPath(extendedConfig) || extendedConfig.startsWith('./') || extendedConfig.startsWith('../')) {
1160
1244
  let path = getNormalizedAbsolutePath(extendedConfig, basePath);
1161
1245
  if (!this.fs.fileExists(path) && !path.endsWith('.json')) {
1162
1246
  path += '.json';
1163
1247
  if (!this.fs.fileExists(path)) {
1164
- errors.push(diagnosticAtNode(file, valueExpression, 1229 /* Diagnostics.File_0_not_found */, extendedConfig));
1248
+ errors.push(diagnosticAtNode(file, valueExpression, 1240 /* Diagnostics.File_0_not_found */, extendedConfig));
1165
1249
  return '';
1166
1250
  }
1167
1251
  }
@@ -1171,8 +1255,8 @@ export class ConfigParser {
1171
1255
  if (resolved.resolvedFileName !== '')
1172
1256
  return resolved.resolvedFileName;
1173
1257
  errors.push(extendedConfig === ''
1174
- ? diagnosticAtNode(file, valueExpression, 1867 /* Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string */, 'extends')
1175
- : diagnosticAtNode(file, valueExpression, 1229 /* Diagnostics.File_0_not_found */, extendedConfig));
1258
+ ? diagnosticAtNode(file, valueExpression, 1887 /* Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string */, 'extends')
1259
+ : diagnosticAtNode(file, valueExpression, 1240 /* Diagnostics.File_0_not_found */, extendedConfig));
1176
1260
  return '';
1177
1261
  }
1178
1262
  /** Root files: `files` as given, then `include` matches not excluded, then JSON files matched explicitly. */
@@ -1183,17 +1267,18 @@ export class ConfigParser {
1183
1267
  const wildcardJsonFiles = new Map();
1184
1268
  const supportedExtensions = getSupportedExtensions(options);
1185
1269
  const extensionsWithJson = getSupportedExtensionsWithJsonIfResolveJsonModule(options);
1186
- // Keys of literal files are the specs as written, as in tsgo.
1270
+ // Literal files are keyed by path, so `a.ts` and `./a.ts` are one file, also when `include` matches it.
1187
1271
  for (const fileName of specs.validatedFilesSpec) {
1188
- literalFiles.set(getCanonicalFileName(fileName, cs), getNormalizedAbsolutePath(fileName, basePath));
1272
+ const file = getNormalizedAbsolutePath(fileName, basePath);
1273
+ literalFiles.set(getCanonicalFileName(file, cs), file);
1189
1274
  }
1190
1275
  if (onRootFile !== undefined)
1191
1276
  for (const fileName of literalFiles.values())
1192
1277
  onRootFile(fileName);
1193
1278
  const includes = specs.validatedIncludeSpecs;
1194
1279
  if (includes.length > 0) {
1195
- // Matches go to `onRootFile` a directory at a time, without those that a file of the same name
1196
- // with a higher priority extension leaves out below.
1280
+ // Matches go to `onRootFile` a directory at a time, without the literal files, which it has, and those that a
1281
+ // file of the same name with a higher priority extension leaves out below.
1197
1282
  let directory = '';
1198
1283
  let pending = [];
1199
1284
  const flush = () => {
@@ -1202,9 +1287,12 @@ export class ConfigParser {
1202
1287
  const siblings = new Map();
1203
1288
  for (const file of pending)
1204
1289
  siblings.set(getCanonicalFileName(file, cs), file);
1205
- for (const file of pending)
1290
+ for (const file of pending) {
1291
+ if (literalFiles.has(getCanonicalFileName(file, cs)))
1292
+ continue;
1206
1293
  if (!hasFileWithHigherPriorityExtension(file, supportedExtensions, literalFiles, siblings, cs))
1207
1294
  onRootFile(file);
1295
+ }
1208
1296
  pending = [];
1209
1297
  };
1210
1298
  const onMatch = onRootFile === undefined
@@ -1289,7 +1377,7 @@ function validateOptionValue(option, value, valueExpression, file, errors) {
1289
1377
  }
1290
1378
  }
1291
1379
  else if (option.extraValidation === 'locale' && !isValidLocale(value)) {
1292
- errors.push(diagnosticAtNode(file, valueExpression, 1225 /* Diagnostics.Locale_must_be_an_IETF_BCP_47_language_tag_Examples_Colon_0_1 */, 'en', 'ja-jp'));
1380
+ errors.push(diagnosticAtNode(file, valueExpression, 1236 /* Diagnostics.Locale_must_be_an_IETF_BCP_47_language_tag_Examples_Colon_0_1 */, 'en', 'ja-jp'));
1293
1381
  return null;
1294
1382
  }
1295
1383
  return value;
@@ -1300,7 +1388,7 @@ function convertEnumOption(option, value, valueExpression, file, errors) {
1300
1388
  const enumValue = option.values?.get(value.toLowerCase());
1301
1389
  if (enumValue !== undefined)
1302
1390
  return validateOptionValue(option, enumValue, valueExpression, file, errors);
1303
- errors.push(diagnosticAtNode(file, valueExpression, 1224 /* Diagnostics.Argument_for_0_option_must_be_Colon_1 */, '--' + option.name, enumNamesList(option)));
1391
+ errors.push(diagnosticAtNode(file, valueExpression, 1235 /* Diagnostics.Argument_for_0_option_must_be_Colon_1 */, '--' + option.name, enumNamesList(option)));
1304
1392
  return null;
1305
1393
  }
1306
1394
  /** `path` relative to `currentDirectory` if absolute. */
@@ -18,16 +18,53 @@ function printSingleLine(b, node, neverAsciiEscape) {
18
18
  export function typeToString(c, t, enclosingDeclaration, flags) {
19
19
  // Without explicit flags, unique symbols print as such and aliases from other scopes are used.
20
20
  const formatFlags = flags ?? 1048576 /* NodeBuilderFlags.AllowUniqueESSymbolType */ | 16384 /* NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope */;
21
- return typeToStringFromTypeNode(c, t, enclosingDeclaration, formatFlags) ?? '';
21
+ // Prints nested in a serialization depend on its depth (typeToStringFromTypeNode), so only the others are kept.
22
+ if (c.serializationLevel !== 0)
23
+ return typeToStringFromTypeNode(c, t, enclosingDeclaration, formatFlags) ?? '';
24
+ // The variance check in progress names the marker types (`sub-T`, `super-T`) after its type parameter.
25
+ const variance = c.varianceTypeParameter;
26
+ const key = String(t.id) +
27
+ ',' +
28
+ String(enclosingDeclaration === undefined ? 0 : enclosingDeclaration.id) +
29
+ ',' +
30
+ String(formatFlags) +
31
+ ',' +
32
+ String(variance === undefined ? 0 : variance.id);
33
+ const cached = c.typeStrings.get(key);
34
+ if (cached !== undefined)
35
+ return cached;
36
+ // A print that creates no types reads only types that exist and settled state, so printing again gives the same
37
+ // text and creates nothing; prints that create types run each time, as in tsgo, so type ids stay in tsgo's order.
38
+ const typeCount = c.typeCount;
39
+ const text = typeToStringFromTypeNode(c, t, enclosingDeclaration, formatFlags) ?? '';
40
+ if (c.typeCount === typeCount)
41
+ c.typeStrings.set(key, text);
42
+ return text;
22
43
  }
23
44
  /** `symbol` as text: the expression naming it, as seen from `enclosingDeclaration` if given. */
24
45
  export function symbolToString(c, symbol, enclosingDeclaration, internalFlags = 0 /* NodeBuilderInternalFlags.None */) {
46
+ // Kept as typeToString keeps type prints: outside serializations, when printing created no types.
47
+ const key = String(enclosingDeclaration === undefined ? 0 : enclosingDeclaration.id) + ',' + String(internalFlags);
48
+ const kept = c.serializationLevel === 0 ? c.symbolStrings.get(symbol) : undefined;
49
+ const cached = kept?.get(key);
50
+ if (cached !== undefined)
51
+ return cached;
52
+ const typeCount = c.typeCount;
25
53
  const b = new NodeBuilder(c, enclosingDeclaration, 70221824 /* NodeBuilderFlags.IgnoreErrors */, internalFlags, undefined);
26
- return printSingleLine(b, symbolToExpression(b, symbol, 1073741823 /* SymbolFlags.All */), enclosingDeclaration !== undefined && enclosingDeclaration.kind === 307 /* SyntaxKind.SourceFile */);
54
+ const text = printSingleLine(b, symbolToExpression(b, symbol, 1073741823 /* SymbolFlags.All */), enclosingDeclaration !== undefined && enclosingDeclaration.kind === 308 /* SyntaxKind.SourceFile */);
55
+ if (c.serializationLevel === 0 && c.typeCount === typeCount) {
56
+ let byKey = kept;
57
+ if (byKey === undefined) {
58
+ byKey = new Map();
59
+ c.symbolStrings.set(symbol, byKey);
60
+ }
61
+ byKey.set(key, text);
62
+ }
63
+ return text;
27
64
  }
28
65
  /** `signature` as text: a call or construct signature without its trailing semicolon. */
29
66
  export function signatureToString(c, signature) {
30
- const kind = (signature.flags & 4 /* SignatureFlags.Construct */) !== 0 ? 181 /* SyntaxKind.ConstructSignature */ : 180 /* SyntaxKind.CallSignature */;
67
+ const kind = (signature.flags & 4 /* SignatureFlags.Construct */) !== 0 ? 182 /* SyntaxKind.ConstructSignature */ : 181 /* SyntaxKind.CallSignature */;
31
68
  const b = new NodeBuilder(c, undefined, 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */, 0 /* NodeBuilderInternalFlags.None */, undefined);
32
69
  b.pseudo = newPseudoChecker(c);
33
70
  const text = printSingleLine(b, b.signatureToSignatureDeclaration(signature, kind, undefined), true);
@@ -57,10 +57,11 @@ export declare const enum ScriptTarget {
57
57
  ES2023 = 10,
58
58
  ES2024 = 11,
59
59
  ES2025 = 12,
60
+ ES2026 = 13,
60
61
  ESNext = 99,
61
62
  JSON = 100,
62
63
  Latest = 99,
63
- LatestStandard = 12
64
+ LatestStandard = 13
64
65
  }
65
66
  export declare const enum LanguageVariant {
66
67
  Standard = 0,