@jackctaylor/roblox-ts 3.0.0-projectrefs.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 (450) hide show
  1. package/CHANGELOG.md +716 -0
  2. package/LICENSE +21 -0
  3. package/README.md +55 -0
  4. package/include/Promise.lua +2068 -0
  5. package/include/RuntimeLib.lua +258 -0
  6. package/out/CLI/cli.d.ts +2 -0
  7. package/out/CLI/cli.js +41 -0
  8. package/out/CLI/commands/build.d.ts +7 -0
  9. package/out/CLI/commands/build.js +438 -0
  10. package/out/CLI/errors/CLIError.d.ts +4 -0
  11. package/out/CLI/errors/CLIError.js +12 -0
  12. package/out/CLI/index.d.ts +3 -0
  13. package/out/CLI/index.js +22 -0
  14. package/out/CLI/test.d.ts +1 -0
  15. package/out/CLI/test.js +82 -0
  16. package/out/CLI/util/patchFs.d.ts +1 -0
  17. package/out/CLI/util/patchFs.js +26 -0
  18. package/out/Project/classes/VirtualFileSystem.d.ts +14 -0
  19. package/out/Project/classes/VirtualFileSystem.js +102 -0
  20. package/out/Project/classes/VirtualProject.d.ts +15 -0
  21. package/out/Project/classes/VirtualProject.js +121 -0
  22. package/out/Project/functions/buildProject.d.ts +18 -0
  23. package/out/Project/functions/buildProject.js +48 -0
  24. package/out/Project/functions/buildProjectReferences.d.ts +3 -0
  25. package/out/Project/functions/buildProjectReferences.js +78 -0
  26. package/out/Project/functions/buildSolution.d.ts +10 -0
  27. package/out/Project/functions/buildSolution.js +97 -0
  28. package/out/Project/functions/checkFileName.d.ts +1 -0
  29. package/out/Project/functions/checkFileName.js +18 -0
  30. package/out/Project/functions/checkRojoConfig.d.ts +4 -0
  31. package/out/Project/functions/checkRojoConfig.js +26 -0
  32. package/out/Project/functions/cleanup.d.ts +2 -0
  33. package/out/Project/functions/cleanup.js +30 -0
  34. package/out/Project/functions/compileFiles.d.ts +4 -0
  35. package/out/Project/functions/compileFiles.js +160 -0
  36. package/out/Project/functions/compileProject.d.ts +14 -0
  37. package/out/Project/functions/compileProject.js +71 -0
  38. package/out/Project/functions/copyFiles.d.ts +3 -0
  39. package/out/Project/functions/copyFiles.js +13 -0
  40. package/out/Project/functions/copyInclude.d.ts +2 -0
  41. package/out/Project/functions/copyInclude.js +17 -0
  42. package/out/Project/functions/copyItem.d.ts +3 -0
  43. package/out/Project/functions/copyItem.js +27 -0
  44. package/out/Project/functions/createNodeModulesPathMapping.d.ts +1 -0
  45. package/out/Project/functions/createNodeModulesPathMapping.js +31 -0
  46. package/out/Project/functions/createPathTranslator.d.ts +4 -0
  47. package/out/Project/functions/createPathTranslator.js +22 -0
  48. package/out/Project/functions/createProgramFactory.d.ts +3 -0
  49. package/out/Project/functions/createProgramFactory.js +31 -0
  50. package/out/Project/functions/createProjectData.d.ts +2 -0
  51. package/out/Project/functions/createProjectData.js +102 -0
  52. package/out/Project/functions/createProjectProgram.d.ts +3 -0
  53. package/out/Project/functions/createProjectProgram.js +11 -0
  54. package/out/Project/functions/getChangedFilePaths.d.ts +2 -0
  55. package/out/Project/functions/getChangedFilePaths.js +47 -0
  56. package/out/Project/functions/getChangedSourceFiles.d.ts +2 -0
  57. package/out/Project/functions/getChangedSourceFiles.js +19 -0
  58. package/out/Project/functions/getParsedCommandLine.d.ts +3 -0
  59. package/out/Project/functions/getParsedCommandLine.js +41 -0
  60. package/out/Project/functions/getProjectReferences.d.ts +2 -0
  61. package/out/Project/functions/getProjectReferences.js +65 -0
  62. package/out/Project/functions/getResolvedProjectReferences.d.ts +3 -0
  63. package/out/Project/functions/getResolvedProjectReferences.js +43 -0
  64. package/out/Project/functions/setupProjectWatchProgram.d.ts +2 -0
  65. package/out/Project/functions/setupProjectWatchProgram.js +352 -0
  66. package/out/Project/functions/setupSolutionWatchProgram.d.ts +2 -0
  67. package/out/Project/functions/setupSolutionWatchProgram.js +355 -0
  68. package/out/Project/functions/tryRemoveOutput.d.ts +2 -0
  69. package/out/Project/functions/tryRemoveOutput.js +30 -0
  70. package/out/Project/functions/validateCompilerOptions.d.ts +2 -0
  71. package/out/Project/functions/validateCompilerOptions.js +87 -0
  72. package/out/Project/index.d.ts +4 -0
  73. package/out/Project/index.js +20 -0
  74. package/out/Project/preEmitDiagnostics/fileUsesCommentDirectives.d.ts +3 -0
  75. package/out/Project/preEmitDiagnostics/fileUsesCommentDirectives.js +28 -0
  76. package/out/Project/transformers/builtin/transformPaths.d.ts +5 -0
  77. package/out/Project/transformers/builtin/transformPaths.js +129 -0
  78. package/out/Project/transformers/builtin/transformTypeReferenceDirectives.d.ts +2 -0
  79. package/out/Project/transformers/builtin/transformTypeReferenceDirectives.js +23 -0
  80. package/out/Project/transformers/createTransformerList.d.ts +4 -0
  81. package/out/Project/transformers/createTransformerList.js +87 -0
  82. package/out/Project/transformers/createTransformerWatcher.d.ts +3 -0
  83. package/out/Project/transformers/createTransformerWatcher.js +59 -0
  84. package/out/Project/transformers/getPluginConfigs.d.ts +2 -0
  85. package/out/Project/transformers/getPluginConfigs.js +34 -0
  86. package/out/Project/util/createReadBuildProgramHost.d.ts +5 -0
  87. package/out/Project/util/createReadBuildProgramHost.js +15 -0
  88. package/out/Project/util/getCustomPreEmitDiagnostics.d.ts +4 -0
  89. package/out/Project/util/getCustomPreEmitDiagnostics.js +13 -0
  90. package/out/Project/util/isCompilableFile.d.ts +1 -0
  91. package/out/Project/util/isCompilableFile.js +18 -0
  92. package/out/Project/util/walkDirectorySync.d.ts +1 -0
  93. package/out/Project/util/walkDirectorySync.js +22 -0
  94. package/out/Shared/classes/Lazy.d.ts +8 -0
  95. package/out/Shared/classes/Lazy.js +22 -0
  96. package/out/Shared/classes/LogService.d.ts +9 -0
  97. package/out/Shared/classes/LogService.js +37 -0
  98. package/out/Shared/constants.d.ts +23 -0
  99. package/out/Shared/constants.js +50 -0
  100. package/out/Shared/diagnostics.d.ts +79 -0
  101. package/out/Shared/diagnostics.js +140 -0
  102. package/out/Shared/errors/DiagnosticError.d.ts +7 -0
  103. package/out/Shared/errors/DiagnosticError.js +16 -0
  104. package/out/Shared/errors/LoggableError.d.ts +5 -0
  105. package/out/Shared/errors/LoggableError.js +14 -0
  106. package/out/Shared/errors/ProjectError.d.ts +4 -0
  107. package/out/Shared/errors/ProjectError.js +12 -0
  108. package/out/Shared/index.d.ts +0 -0
  109. package/out/Shared/index.js +2 -0
  110. package/out/Shared/types.d.ts +50 -0
  111. package/out/Shared/types.js +3 -0
  112. package/out/Shared/util/assert.d.ts +1 -0
  113. package/out/Shared/util/assert.js +12 -0
  114. package/out/Shared/util/benchmark.d.ts +3 -0
  115. package/out/Shared/util/benchmark.js +32 -0
  116. package/out/Shared/util/createDiagnosticWithLocation.d.ts +3 -0
  117. package/out/Shared/util/createDiagnosticWithLocation.js +29 -0
  118. package/out/Shared/util/createGithubLink.d.ts +1 -0
  119. package/out/Shared/util/createGithubLink.js +12 -0
  120. package/out/Shared/util/createTextDiagnostic.d.ts +2 -0
  121. package/out/Shared/util/createTextDiagnostic.js +18 -0
  122. package/out/Shared/util/findAncestorDir.d.ts +1 -0
  123. package/out/Shared/util/findAncestorDir.js +16 -0
  124. package/out/Shared/util/findLastIndex.d.ts +1 -0
  125. package/out/Shared/util/findLastIndex.js +12 -0
  126. package/out/Shared/util/formatDiagnostics.d.ts +2 -0
  127. package/out/Shared/util/formatDiagnostics.js +19 -0
  128. package/out/Shared/util/getCanonicalFileName.d.ts +2 -0
  129. package/out/Shared/util/getCanonicalFileName.js +10 -0
  130. package/out/Shared/util/getOrSetDefault.d.ts +1 -0
  131. package/out/Shared/util/getOrSetDefault.js +12 -0
  132. package/out/Shared/util/getRootDirs.d.ts +2 -0
  133. package/out/Shared/util/getRootDirs.js +10 -0
  134. package/out/Shared/util/hasErrors.d.ts +2 -0
  135. package/out/Shared/util/hasErrors.js +11 -0
  136. package/out/Shared/util/isPathDescendantOf.d.ts +1 -0
  137. package/out/Shared/util/isPathDescendantOf.js +11 -0
  138. package/out/Shared/util/realPathExistsSync.d.ts +1 -0
  139. package/out/Shared/util/realPathExistsSync.js +13 -0
  140. package/out/Shared/warn.d.ts +1 -0
  141. package/out/Shared/warn.js +12 -0
  142. package/out/TSTransformer/classes/DiagnosticService.d.ts +11 -0
  143. package/out/TSTransformer/classes/DiagnosticService.js +37 -0
  144. package/out/TSTransformer/classes/MacroManager.d.ts +46 -0
  145. package/out/TSTransformer/classes/MacroManager.js +178 -0
  146. package/out/TSTransformer/classes/MultiTransformState.d.ts +9 -0
  147. package/out/TSTransformer/classes/MultiTransformState.js +15 -0
  148. package/out/TSTransformer/classes/TransformState.d.ts +73 -0
  149. package/out/TSTransformer/classes/TransformState.js +307 -0
  150. package/out/TSTransformer/index.d.ts +4 -0
  151. package/out/TSTransformer/index.js +23 -0
  152. package/out/TSTransformer/macros/callMacros.d.ts +2 -0
  153. package/out/TSTransformer/macros/callMacros.js +56 -0
  154. package/out/TSTransformer/macros/constructorMacros.d.ts +2 -0
  155. package/out/TSTransformer/macros/constructorMacros.js +97 -0
  156. package/out/TSTransformer/macros/identifierMacros.d.ts +2 -0
  157. package/out/TSTransformer/macros/identifierMacros.js +7 -0
  158. package/out/TSTransformer/macros/propertyCallMacros.d.ts +4 -0
  159. package/out/TSTransformer/macros/propertyCallMacros.js +726 -0
  160. package/out/TSTransformer/macros/types.d.ts +12 -0
  161. package/out/TSTransformer/macros/types.js +3 -0
  162. package/out/TSTransformer/nodes/binding/transformArrayAssignmentPattern.d.ts +4 -0
  163. package/out/TSTransformer/nodes/binding/transformArrayAssignmentPattern.js +78 -0
  164. package/out/TSTransformer/nodes/binding/transformArrayBindingPattern.d.ts +4 -0
  165. package/out/TSTransformer/nodes/binding/transformArrayBindingPattern.js +52 -0
  166. package/out/TSTransformer/nodes/binding/transformBindingName.d.ts +4 -0
  167. package/out/TSTransformer/nodes/binding/transformBindingName.js +30 -0
  168. package/out/TSTransformer/nodes/binding/transformObjectAssignmentPattern.d.ts +4 -0
  169. package/out/TSTransformer/nodes/binding/transformObjectAssignmentPattern.js +97 -0
  170. package/out/TSTransformer/nodes/binding/transformObjectBindingPattern.d.ts +4 -0
  171. package/out/TSTransformer/nodes/binding/transformObjectBindingPattern.js +57 -0
  172. package/out/TSTransformer/nodes/class/transformClassConstructor.d.ts +7 -0
  173. package/out/TSTransformer/nodes/class/transformClassConstructor.js +96 -0
  174. package/out/TSTransformer/nodes/class/transformClassLikeDeclaration.d.ts +7 -0
  175. package/out/TSTransformer/nodes/class/transformClassLikeDeclaration.js +262 -0
  176. package/out/TSTransformer/nodes/class/transformDecorators.d.ts +4 -0
  177. package/out/TSTransformer/nodes/class/transformDecorators.js +179 -0
  178. package/out/TSTransformer/nodes/class/transformPropertyDeclaration.d.ts +4 -0
  179. package/out/TSTransformer/nodes/class/transformPropertyDeclaration.js +33 -0
  180. package/out/TSTransformer/nodes/expressions/transformArrayLiteralExpression.d.ts +4 -0
  181. package/out/TSTransformer/nodes/expressions/transformArrayLiteralExpression.js +79 -0
  182. package/out/TSTransformer/nodes/expressions/transformAwaitExpression.d.ts +4 -0
  183. package/out/TSTransformer/nodes/expressions/transformAwaitExpression.js +13 -0
  184. package/out/TSTransformer/nodes/expressions/transformBinaryExpression.d.ts +4 -0
  185. package/out/TSTransformer/nodes/expressions/transformBinaryExpression.js +199 -0
  186. package/out/TSTransformer/nodes/expressions/transformBooleanLiteral.d.ts +3 -0
  187. package/out/TSTransformer/nodes/expressions/transformBooleanLiteral.js +15 -0
  188. package/out/TSTransformer/nodes/expressions/transformCallExpression.d.ts +7 -0
  189. package/out/TSTransformer/nodes/expressions/transformCallExpression.js +191 -0
  190. package/out/TSTransformer/nodes/expressions/transformClassExpression.d.ts +3 -0
  191. package/out/TSTransformer/nodes/expressions/transformClassExpression.js +10 -0
  192. package/out/TSTransformer/nodes/expressions/transformConditionalExpression.d.ts +4 -0
  193. package/out/TSTransformer/nodes/expressions/transformConditionalExpression.js +55 -0
  194. package/out/TSTransformer/nodes/expressions/transformDeleteExpression.d.ts +4 -0
  195. package/out/TSTransformer/nodes/expressions/transformDeleteExpression.js +14 -0
  196. package/out/TSTransformer/nodes/expressions/transformElementAccessExpression.d.ts +5 -0
  197. package/out/TSTransformer/nodes/expressions/transformElementAccessExpression.js +62 -0
  198. package/out/TSTransformer/nodes/expressions/transformExpression.d.ts +4 -0
  199. package/out/TSTransformer/nodes/expressions/transformExpression.js +107 -0
  200. package/out/TSTransformer/nodes/expressions/transformFunctionExpression.d.ts +4 -0
  201. package/out/TSTransformer/nodes/expressions/transformFunctionExpression.js +46 -0
  202. package/out/TSTransformer/nodes/expressions/transformIdentifier.d.ts +5 -0
  203. package/out/TSTransformer/nodes/expressions/transformIdentifier.js +147 -0
  204. package/out/TSTransformer/nodes/expressions/transformImportExpression.d.ts +4 -0
  205. package/out/TSTransformer/nodes/expressions/transformImportExpression.js +30 -0
  206. package/out/TSTransformer/nodes/expressions/transformJsxElement.d.ts +3 -0
  207. package/out/TSTransformer/nodes/expressions/transformJsxElement.js +8 -0
  208. package/out/TSTransformer/nodes/expressions/transformJsxExpression.d.ts +4 -0
  209. package/out/TSTransformer/nodes/expressions/transformJsxExpression.js +19 -0
  210. package/out/TSTransformer/nodes/expressions/transformJsxFragment.d.ts +4 -0
  211. package/out/TSTransformer/nodes/expressions/transformJsxFragment.js +28 -0
  212. package/out/TSTransformer/nodes/expressions/transformJsxSelfClosingElement.d.ts +3 -0
  213. package/out/TSTransformer/nodes/expressions/transformJsxSelfClosingElement.js +8 -0
  214. package/out/TSTransformer/nodes/expressions/transformNewExpression.d.ts +4 -0
  215. package/out/TSTransformer/nodes/expressions/transformNewExpression.js +26 -0
  216. package/out/TSTransformer/nodes/expressions/transformNoSubstitutionTemplateLiteral.d.ts +4 -0
  217. package/out/TSTransformer/nodes/expressions/transformNoSubstitutionTemplateLiteral.js +14 -0
  218. package/out/TSTransformer/nodes/expressions/transformNumericLiteral.d.ts +4 -0
  219. package/out/TSTransformer/nodes/expressions/transformNumericLiteral.js +13 -0
  220. package/out/TSTransformer/nodes/expressions/transformObjectLiteralExpression.d.ts +4 -0
  221. package/out/TSTransformer/nodes/expressions/transformObjectLiteralExpression.js +98 -0
  222. package/out/TSTransformer/nodes/expressions/transformOmittedExpression.d.ts +2 -0
  223. package/out/TSTransformer/nodes/expressions/transformOmittedExpression.js +11 -0
  224. package/out/TSTransformer/nodes/expressions/transformParenthesizedExpression.d.ts +4 -0
  225. package/out/TSTransformer/nodes/expressions/transformParenthesizedExpression.js +19 -0
  226. package/out/TSTransformer/nodes/expressions/transformPropertyAccessExpression.d.ts +5 -0
  227. package/out/TSTransformer/nodes/expressions/transformPropertyAccessExpression.js +36 -0
  228. package/out/TSTransformer/nodes/expressions/transformSpreadElement.d.ts +4 -0
  229. package/out/TSTransformer/nodes/expressions/transformSpreadElement.js +35 -0
  230. package/out/TSTransformer/nodes/expressions/transformStringLiteral.d.ts +4 -0
  231. package/out/TSTransformer/nodes/expressions/transformStringLiteral.js +12 -0
  232. package/out/TSTransformer/nodes/expressions/transformSuperKeyword.d.ts +2 -0
  233. package/out/TSTransformer/nodes/expressions/transformSuperKeyword.js +11 -0
  234. package/out/TSTransformer/nodes/expressions/transformTaggedTemplateExpression.d.ts +4 -0
  235. package/out/TSTransformer/nodes/expressions/transformTaggedTemplateExpression.js +27 -0
  236. package/out/TSTransformer/nodes/expressions/transformTemplateExpression.d.ts +4 -0
  237. package/out/TSTransformer/nodes/expressions/transformTemplateExpression.js +25 -0
  238. package/out/TSTransformer/nodes/expressions/transformThisExpression.d.ts +4 -0
  239. package/out/TSTransformer/nodes/expressions/transformThisExpression.js +29 -0
  240. package/out/TSTransformer/nodes/expressions/transformTypeExpression.d.ts +3 -0
  241. package/out/TSTransformer/nodes/expressions/transformTypeExpression.js +8 -0
  242. package/out/TSTransformer/nodes/expressions/transformUnaryExpression.d.ts +5 -0
  243. package/out/TSTransformer/nodes/expressions/transformUnaryExpression.js +68 -0
  244. package/out/TSTransformer/nodes/expressions/transformVoidExpression.d.ts +4 -0
  245. package/out/TSTransformer/nodes/expressions/transformVoidExpression.js +14 -0
  246. package/out/TSTransformer/nodes/expressions/transformYieldExpression.d.ts +4 -0
  247. package/out/TSTransformer/nodes/expressions/transformYieldExpression.js +46 -0
  248. package/out/TSTransformer/nodes/jsx/transformJsx.d.ts +4 -0
  249. package/out/TSTransformer/nodes/jsx/transformJsx.js +36 -0
  250. package/out/TSTransformer/nodes/jsx/transformJsxAttributes.d.ts +4 -0
  251. package/out/TSTransformer/nodes/jsx/transformJsxAttributes.js +83 -0
  252. package/out/TSTransformer/nodes/jsx/transformJsxChildren.d.ts +4 -0
  253. package/out/TSTransformer/nodes/jsx/transformJsxChildren.js +34 -0
  254. package/out/TSTransformer/nodes/jsx/transformJsxTagName.d.ts +4 -0
  255. package/out/TSTransformer/nodes/jsx/transformJsxTagName.js +42 -0
  256. package/out/TSTransformer/nodes/statements/transformBlock.d.ts +4 -0
  257. package/out/TSTransformer/nodes/statements/transformBlock.js +14 -0
  258. package/out/TSTransformer/nodes/statements/transformBreakStatement.d.ts +4 -0
  259. package/out/TSTransformer/nodes/statements/transformBreakStatement.js +24 -0
  260. package/out/TSTransformer/nodes/statements/transformClassDeclaration.d.ts +3 -0
  261. package/out/TSTransformer/nodes/statements/transformClassDeclaration.js +8 -0
  262. package/out/TSTransformer/nodes/statements/transformContinueStatement.d.ts +4 -0
  263. package/out/TSTransformer/nodes/statements/transformContinueStatement.js +24 -0
  264. package/out/TSTransformer/nodes/statements/transformDoStatement.d.ts +4 -0
  265. package/out/TSTransformer/nodes/statements/transformDoStatement.js +31 -0
  266. package/out/TSTransformer/nodes/statements/transformEnumDeclaration.d.ts +4 -0
  267. package/out/TSTransformer/nodes/statements/transformEnumDeclaration.js +97 -0
  268. package/out/TSTransformer/nodes/statements/transformExportAssignment.d.ts +4 -0
  269. package/out/TSTransformer/nodes/statements/transformExportAssignment.js +53 -0
  270. package/out/TSTransformer/nodes/statements/transformExportDeclaration.d.ts +4 -0
  271. package/out/TSTransformer/nodes/statements/transformExportDeclaration.js +109 -0
  272. package/out/TSTransformer/nodes/statements/transformExpressionStatement.d.ts +5 -0
  273. package/out/TSTransformer/nodes/statements/transformExpressionStatement.js +62 -0
  274. package/out/TSTransformer/nodes/statements/transformForOfStatement.d.ts +5 -0
  275. package/out/TSTransformer/nodes/statements/transformForOfStatement.js +375 -0
  276. package/out/TSTransformer/nodes/statements/transformForStatement.d.ts +4 -0
  277. package/out/TSTransformer/nodes/statements/transformForStatement.js +371 -0
  278. package/out/TSTransformer/nodes/statements/transformFunctionDeclaration.d.ts +4 -0
  279. package/out/TSTransformer/nodes/statements/transformFunctionDeclaration.js +68 -0
  280. package/out/TSTransformer/nodes/statements/transformIfStatement.d.ts +5 -0
  281. package/out/TSTransformer/nodes/statements/transformIfStatement.js +46 -0
  282. package/out/TSTransformer/nodes/statements/transformImportDeclaration.d.ts +4 -0
  283. package/out/TSTransformer/nodes/statements/transformImportDeclaration.js +98 -0
  284. package/out/TSTransformer/nodes/statements/transformImportEqualsDeclaration.d.ts +4 -0
  285. package/out/TSTransformer/nodes/statements/transformImportEqualsDeclaration.js +36 -0
  286. package/out/TSTransformer/nodes/statements/transformModuleDeclaration.d.ts +4 -0
  287. package/out/TSTransformer/nodes/statements/transformModuleDeclaration.js +122 -0
  288. package/out/TSTransformer/nodes/statements/transformReturnStatement.d.ts +5 -0
  289. package/out/TSTransformer/nodes/statements/transformReturnStatement.js +74 -0
  290. package/out/TSTransformer/nodes/statements/transformStatement.d.ts +4 -0
  291. package/out/TSTransformer/nodes/statements/transformStatement.js +83 -0
  292. package/out/TSTransformer/nodes/statements/transformSwitchStatement.d.ts +4 -0
  293. package/out/TSTransformer/nodes/statements/transformSwitchStatement.js +105 -0
  294. package/out/TSTransformer/nodes/statements/transformThrowStatement.d.ts +4 -0
  295. package/out/TSTransformer/nodes/statements/transformThrowStatement.js +18 -0
  296. package/out/TSTransformer/nodes/statements/transformTryStatement.d.ts +4 -0
  297. package/out/TSTransformer/nodes/statements/transformTryStatement.js +148 -0
  298. package/out/TSTransformer/nodes/statements/transformVariableStatement.d.ts +8 -0
  299. package/out/TSTransformer/nodes/statements/transformVariableStatement.js +155 -0
  300. package/out/TSTransformer/nodes/statements/transformWhileStatement.d.ts +4 -0
  301. package/out/TSTransformer/nodes/statements/transformWhileStatement.js +30 -0
  302. package/out/TSTransformer/nodes/transformEntityName.d.ts +4 -0
  303. package/out/TSTransformer/nodes/transformEntityName.js +24 -0
  304. package/out/TSTransformer/nodes/transformInitializer.d.ts +4 -0
  305. package/out/TSTransformer/nodes/transformInitializer.js +22 -0
  306. package/out/TSTransformer/nodes/transformInterpolatedStringPart.d.ts +3 -0
  307. package/out/TSTransformer/nodes/transformInterpolatedStringPart.js +12 -0
  308. package/out/TSTransformer/nodes/transformLogical.d.ts +4 -0
  309. package/out/TSTransformer/nodes/transformLogical.js +103 -0
  310. package/out/TSTransformer/nodes/transformLogicalOrCoalescingAssignmentExpression.d.ts +5 -0
  311. package/out/TSTransformer/nodes/transformLogicalOrCoalescingAssignmentExpression.js +91 -0
  312. package/out/TSTransformer/nodes/transformMethodDeclaration.d.ts +5 -0
  313. package/out/TSTransformer/nodes/transformMethodDeclaration.js +82 -0
  314. package/out/TSTransformer/nodes/transformOptionalChain.d.ts +46 -0
  315. package/out/TSTransformer/nodes/transformOptionalChain.js +257 -0
  316. package/out/TSTransformer/nodes/transformParameters.d.ts +8 -0
  317. package/out/TSTransformer/nodes/transformParameters.js +104 -0
  318. package/out/TSTransformer/nodes/transformPropertyName.d.ts +4 -0
  319. package/out/TSTransformer/nodes/transformPropertyName.js +18 -0
  320. package/out/TSTransformer/nodes/transformSourceFile.d.ts +4 -0
  321. package/out/TSTransformer/nodes/transformSourceFile.js +171 -0
  322. package/out/TSTransformer/nodes/transformStatementList.d.ts +7 -0
  323. package/out/TSTransformer/nodes/transformStatementList.js +63 -0
  324. package/out/TSTransformer/nodes/transformWritable.d.ts +9 -0
  325. package/out/TSTransformer/nodes/transformWritable.js +49 -0
  326. package/out/TSTransformer/typeGuards.d.ts +5 -0
  327. package/out/TSTransformer/typeGuards.js +27 -0
  328. package/out/TSTransformer/types.d.ts +9 -0
  329. package/out/TSTransformer/types.js +3 -0
  330. package/out/TSTransformer/util/addIndexDiagnostics.d.ts +3 -0
  331. package/out/TSTransformer/util/addIndexDiagnostics.js +24 -0
  332. package/out/TSTransformer/util/addOneIfArrayType.d.ts +4 -0
  333. package/out/TSTransformer/util/addOneIfArrayType.js +14 -0
  334. package/out/TSTransformer/util/arrayBindingPatternContainsHoists.d.ts +3 -0
  335. package/out/TSTransformer/util/arrayBindingPatternContainsHoists.js +23 -0
  336. package/out/TSTransformer/util/arrayLikeExpressionContainsSpread.d.ts +2 -0
  337. package/out/TSTransformer/util/arrayLikeExpressionContainsSpread.js +17 -0
  338. package/out/TSTransformer/util/assertNever.d.ts +1 -0
  339. package/out/TSTransformer/util/assertNever.js +36 -0
  340. package/out/TSTransformer/util/assignment.d.ts +7 -0
  341. package/out/TSTransformer/util/assignment.js +48 -0
  342. package/out/TSTransformer/util/binding/getAccessorForBindingType.d.ts +6 -0
  343. package/out/TSTransformer/util/binding/getAccessorForBindingType.js +141 -0
  344. package/out/TSTransformer/util/binding/getTargetIdForBindingPattern.d.ts +4 -0
  345. package/out/TSTransformer/util/binding/getTargetIdForBindingPattern.js +15 -0
  346. package/out/TSTransformer/util/binding/objectAccessor.d.ts +4 -0
  347. package/out/TSTransformer/util/binding/objectAccessor.js +39 -0
  348. package/out/TSTransformer/util/bitwise.d.ts +6 -0
  349. package/out/TSTransformer/util/bitwise.js +67 -0
  350. package/out/TSTransformer/util/checkVariableHoist.d.ts +3 -0
  351. package/out/TSTransformer/util/checkVariableHoist.js +33 -0
  352. package/out/TSTransformer/util/cleanModuleName.d.ts +1 -0
  353. package/out/TSTransformer/util/cleanModuleName.js +7 -0
  354. package/out/TSTransformer/util/convertToIndexableExpression.d.ts +3 -0
  355. package/out/TSTransformer/util/convertToIndexableExpression.js +14 -0
  356. package/out/TSTransformer/util/createBinaryFromOperator.d.ts +4 -0
  357. package/out/TSTransformer/util/createBinaryFromOperator.js +54 -0
  358. package/out/TSTransformer/util/createGetService.d.ts +2 -0
  359. package/out/TSTransformer/util/createGetService.js +15 -0
  360. package/out/TSTransformer/util/createHoistDeclaration.d.ts +4 -0
  361. package/out/TSTransformer/util/createHoistDeclaration.js +20 -0
  362. package/out/TSTransformer/util/createImportExpression.d.ts +5 -0
  363. package/out/TSTransformer/util/createImportExpression.js +181 -0
  364. package/out/TSTransformer/util/createStringFromLiteral.d.ts +2 -0
  365. package/out/TSTransformer/util/createStringFromLiteral.js +27 -0
  366. package/out/TSTransformer/util/createTransformServices.d.ts +3 -0
  367. package/out/TSTransformer/util/createTransformServices.js +9 -0
  368. package/out/TSTransformer/util/createTruthinessChecks.d.ts +5 -0
  369. package/out/TSTransformer/util/createTruthinessChecks.js +50 -0
  370. package/out/TSTransformer/util/createTypeCheck.d.ts +2 -0
  371. package/out/TSTransformer/util/createTypeCheck.js +11 -0
  372. package/out/TSTransformer/util/ensureTransformOrder.d.ts +5 -0
  373. package/out/TSTransformer/util/ensureTransformOrder.js +39 -0
  374. package/out/TSTransformer/util/expressionChain.d.ts +3 -0
  375. package/out/TSTransformer/util/expressionChain.js +16 -0
  376. package/out/TSTransformer/util/expressionMightMutate.d.ts +4 -0
  377. package/out/TSTransformer/util/expressionMightMutate.js +57 -0
  378. package/out/TSTransformer/util/findConstructor.d.ts +4 -0
  379. package/out/TSTransformer/util/findConstructor.js +11 -0
  380. package/out/TSTransformer/util/fixupWhitespaceAndDecodeEntities.d.ts +1 -0
  381. package/out/TSTransformer/util/fixupWhitespaceAndDecodeEntities.js +306 -0
  382. package/out/TSTransformer/util/getAddIterableToArrayBuilder.d.ts +6 -0
  383. package/out/TSTransformer/util/getAddIterableToArrayBuilder.js +253 -0
  384. package/out/TSTransformer/util/getAssignableValue.d.ts +3 -0
  385. package/out/TSTransformer/util/getAssignableValue.js +15 -0
  386. package/out/TSTransformer/util/getConstantValueLiteral.d.ts +4 -0
  387. package/out/TSTransformer/util/getConstantValueLiteral.js +19 -0
  388. package/out/TSTransformer/util/getDeclaredVariables.d.ts +2 -0
  389. package/out/TSTransformer/util/getDeclaredVariables.js +37 -0
  390. package/out/TSTransformer/util/getExtendsNode.d.ts +2 -0
  391. package/out/TSTransformer/util/getExtendsNode.js +16 -0
  392. package/out/TSTransformer/util/getFlags.d.ts +1 -0
  393. package/out/TSTransformer/util/getFlags.js +13 -0
  394. package/out/TSTransformer/util/getKindName.d.ts +2 -0
  395. package/out/TSTransformer/util/getKindName.js +61 -0
  396. package/out/TSTransformer/util/getOriginalSymbolOfNode.d.ts +2 -0
  397. package/out/TSTransformer/util/getOriginalSymbolOfNode.js +15 -0
  398. package/out/TSTransformer/util/getSourceFileFromModuleSpecifier.d.ts +3 -0
  399. package/out/TSTransformer/util/getSourceFileFromModuleSpecifier.js +33 -0
  400. package/out/TSTransformer/util/getStatements.d.ts +2 -0
  401. package/out/TSTransformer/util/getStatements.js +11 -0
  402. package/out/TSTransformer/util/hasMultipleDefinitions.d.ts +2 -0
  403. package/out/TSTransformer/util/hasMultipleDefinitions.js +17 -0
  404. package/out/TSTransformer/util/isBlockedByTryStatement.d.ts +3 -0
  405. package/out/TSTransformer/util/isBlockedByTryStatement.js +17 -0
  406. package/out/TSTransformer/util/isMethod.d.ts +4 -0
  407. package/out/TSTransformer/util/isMethod.js +90 -0
  408. package/out/TSTransformer/util/isSymbolMutable.d.ts +3 -0
  409. package/out/TSTransformer/util/isSymbolMutable.js +24 -0
  410. package/out/TSTransformer/util/isSymbolOfValue.d.ts +2 -0
  411. package/out/TSTransformer/util/isSymbolOfValue.js +11 -0
  412. package/out/TSTransformer/util/isUsedAsStatement.d.ts +2 -0
  413. package/out/TSTransformer/util/isUsedAsStatement.js +23 -0
  414. package/out/TSTransformer/util/isValidMethodIndexWithoutCall.d.ts +3 -0
  415. package/out/TSTransformer/util/isValidMethodIndexWithoutCall.js +31 -0
  416. package/out/TSTransformer/util/offset.d.ts +2 -0
  417. package/out/TSTransformer/util/offset.js +44 -0
  418. package/out/TSTransformer/util/pointer.d.ts +13 -0
  419. package/out/TSTransformer/util/pointer.js +46 -0
  420. package/out/TSTransformer/util/spreadDestructuring/index.d.ts +9 -0
  421. package/out/TSTransformer/util/spreadDestructuring/index.js +45 -0
  422. package/out/TSTransformer/util/spreadDestructuring/spreadDestructureArray.d.ts +3 -0
  423. package/out/TSTransformer/util/spreadDestructuring/spreadDestructureArray.js +17 -0
  424. package/out/TSTransformer/util/spreadDestructuring/spreadDestructureGenerator.d.ts +3 -0
  425. package/out/TSTransformer/util/spreadDestructuring/spreadDestructureGenerator.js +33 -0
  426. package/out/TSTransformer/util/spreadDestructuring/spreadDestructureMap.d.ts +3 -0
  427. package/out/TSTransformer/util/spreadDestructuring/spreadDestructureMap.js +34 -0
  428. package/out/TSTransformer/util/spreadDestructuring/spreadDestructureObject.d.ts +3 -0
  429. package/out/TSTransformer/util/spreadDestructuring/spreadDestructureObject.js +41 -0
  430. package/out/TSTransformer/util/spreadDestructuring/spreadDestructureSet.d.ts +3 -0
  431. package/out/TSTransformer/util/spreadDestructuring/spreadDestructureSet.js +28 -0
  432. package/out/TSTransformer/util/traversal.d.ts +7 -0
  433. package/out/TSTransformer/util/traversal.js +57 -0
  434. package/out/TSTransformer/util/types.d.ts +31 -0
  435. package/out/TSTransformer/util/types.js +259 -0
  436. package/out/TSTransformer/util/validateIdentifier.d.ts +3 -0
  437. package/out/TSTransformer/util/validateIdentifier.js +18 -0
  438. package/out/TSTransformer/util/validateMethodAssignment.d.ts +3 -0
  439. package/out/TSTransformer/util/validateMethodAssignment.js +81 -0
  440. package/out/TSTransformer/util/validateNotAny.d.ts +3 -0
  441. package/out/TSTransformer/util/validateNotAny.js +37 -0
  442. package/out/TSTransformer/util/valueToIdStr.d.ts +2 -0
  443. package/out/TSTransformer/util/valueToIdStr.js +29 -0
  444. package/out/TSTransformer/util/wrapExpressionStatement.d.ts +2 -0
  445. package/out/TSTransformer/util/wrapExpressionStatement.js +22 -0
  446. package/out/TSTransformer/util/wrapReturnIfLuaTuple.d.ts +4 -0
  447. package/out/TSTransformer/util/wrapReturnIfLuaTuple.js +56 -0
  448. package/out/TSTransformer/util/wrapStatementsAsGenerator.d.ts +4 -0
  449. package/out/TSTransformer/util/wrapStatementsAsGenerator.js +19 -0
  450. package/package.json +72 -0
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VirtualFileSystem = exports.PATH_SEP = void 0;
4
+ exports.pathJoin = pathJoin;
5
+ const assert_1 = require("../../Shared/util/assert");
6
+ const getOrSetDefault_1 = require("../../Shared/util/getOrSetDefault");
7
+ exports.PATH_SEP = "/";
8
+ function pathJoin(...parts) {
9
+ let result = parts[0];
10
+ for (let i = 1; i < parts.length; i++) {
11
+ if (!result.endsWith(exports.PATH_SEP)) {
12
+ result += exports.PATH_SEP;
13
+ }
14
+ result += parts[i];
15
+ }
16
+ return result;
17
+ }
18
+ class VirtualFileSystem {
19
+ constructor() {
20
+ this.root = {
21
+ name: "",
22
+ children: new Map(),
23
+ };
24
+ }
25
+ getPathParts(filePath) {
26
+ return filePath.split(exports.PATH_SEP).filter(v => v.length > 0);
27
+ }
28
+ writeFile(filePath, content) {
29
+ const pathParts = this.getPathParts(filePath);
30
+ const fileName = pathParts.pop();
31
+ let currentDir = this.root;
32
+ for (const name of pathParts) {
33
+ const child = (0, getOrSetDefault_1.getOrSetDefault)(currentDir.children, name, () => ({
34
+ name,
35
+ children: new Map(),
36
+ }));
37
+ (0, assert_1.assert)("children" in child);
38
+ currentDir = child;
39
+ }
40
+ currentDir.children.set(fileName, {
41
+ name: fileName,
42
+ content,
43
+ });
44
+ }
45
+ get(itemPath) {
46
+ const pathParts = this.getPathParts(itemPath);
47
+ const fileName = pathParts.pop();
48
+ let currentDir = this.root;
49
+ for (const name of pathParts) {
50
+ const child = currentDir.children.get(name);
51
+ if (!child)
52
+ return undefined;
53
+ if (!("children" in child))
54
+ return undefined;
55
+ currentDir = child;
56
+ }
57
+ return currentDir.children.get(fileName);
58
+ }
59
+ readFile(filePath) {
60
+ const item = this.get(filePath);
61
+ if (item && "content" in item) {
62
+ return item.content;
63
+ }
64
+ }
65
+ fileExists(filePath) {
66
+ const item = this.get(filePath);
67
+ return item !== undefined && "content" in item;
68
+ }
69
+ directoryExists(dirPath) {
70
+ const item = this.get(dirPath);
71
+ return item !== undefined && "children" in item;
72
+ }
73
+ getDirectories(dirPath) {
74
+ const result = new Array();
75
+ const item = this.get(dirPath);
76
+ if (item && "children" in item) {
77
+ for (const [name, child] of item.children) {
78
+ if ("children" in child) {
79
+ result.push(pathJoin(dirPath, name));
80
+ }
81
+ }
82
+ }
83
+ return result;
84
+ }
85
+ getFilePaths() {
86
+ const filePaths = new Array();
87
+ const search = (dir, partialPath = "") => {
88
+ for (const [name, child] of dir.children) {
89
+ if ("children" in child) {
90
+ search(child, `${partialPath}/${name}`);
91
+ }
92
+ else {
93
+ filePaths.push(`${partialPath}/${name}`);
94
+ }
95
+ }
96
+ };
97
+ search(this.root);
98
+ return filePaths;
99
+ }
100
+ }
101
+ exports.VirtualFileSystem = VirtualFileSystem;
102
+ //# sourceMappingURL=VirtualFileSystem.js.map
@@ -0,0 +1,15 @@
1
+ import { VirtualFileSystem } from "./VirtualFileSystem";
2
+ export declare class VirtualProject {
3
+ private readonly data;
4
+ readonly vfs: VirtualFileSystem;
5
+ private readonly compilerOptions;
6
+ private readonly rojoResolver;
7
+ private readonly pkgRojoResolvers;
8
+ private readonly compilerHost;
9
+ private program;
10
+ private typeChecker;
11
+ private nodeModulesPathMapping;
12
+ constructor();
13
+ compileSource(source: string): string;
14
+ setMapping(typings: string, main: string): void;
15
+ }
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.VirtualProject = void 0;
7
+ const luau_ast_1 = require("@roblox-ts/luau-ast");
8
+ const path_translator_1 = require("@roblox-ts/path-translator");
9
+ const rojo_resolver_1 = require("@roblox-ts/rojo-resolver");
10
+ const VirtualFileSystem_1 = require("./VirtualFileSystem");
11
+ const validateCompilerOptions_1 = require("../functions/validateCompilerOptions");
12
+ const getCustomPreEmitDiagnostics_1 = require("../util/getCustomPreEmitDiagnostics");
13
+ const constants_1 = require("../../Shared/constants");
14
+ const DiagnosticError_1 = require("../../Shared/errors/DiagnosticError");
15
+ const assert_1 = require("../../Shared/util/assert");
16
+ const hasErrors_1 = require("../../Shared/util/hasErrors");
17
+ const TSTransformer_1 = require("../../TSTransformer");
18
+ const DiagnosticService_1 = require("../../TSTransformer/classes/DiagnosticService");
19
+ const createTransformServices_1 = require("../../TSTransformer/util/createTransformServices");
20
+ const typescript_1 = __importDefault(require("typescript"));
21
+ const PROJECT_DIR = VirtualFileSystem_1.PATH_SEP;
22
+ const ROOT_DIR = (0, VirtualFileSystem_1.pathJoin)(PROJECT_DIR, "src");
23
+ const OUT_DIR = (0, VirtualFileSystem_1.pathJoin)(PROJECT_DIR, "out");
24
+ const PLAYGROUND_PATH = (0, VirtualFileSystem_1.pathJoin)(ROOT_DIR, "playground.tsx");
25
+ const NODE_MODULES_PATH = (0, VirtualFileSystem_1.pathJoin)(PROJECT_DIR, constants_1.NODE_MODULES);
26
+ const RBXTS_SCOPE_PATH = (0, VirtualFileSystem_1.pathJoin)(NODE_MODULES_PATH, constants_1.RBXTS_SCOPE);
27
+ const INCLUDE_PATH = (0, VirtualFileSystem_1.pathJoin)(PROJECT_DIR, "include");
28
+ class VirtualProject {
29
+ constructor() {
30
+ this.nodeModulesPathMapping = new Map();
31
+ this.data = {
32
+ isPackage: false,
33
+ nodeModulesPath: NODE_MODULES_PATH,
34
+ projectOptions: Object.assign({}, constants_1.DEFAULT_PROJECT_OPTIONS, {
35
+ rojo: "",
36
+ type: constants_1.ProjectType.Model,
37
+ optimizedLoops: true,
38
+ }),
39
+ projectPath: PROJECT_DIR,
40
+ rojoConfigPath: undefined,
41
+ tsConfigPath: "",
42
+ referencedProjects: [],
43
+ };
44
+ this.compilerOptions = {
45
+ allowSyntheticDefaultImports: true,
46
+ downlevelIteration: true,
47
+ noLib: true,
48
+ strict: true,
49
+ target: typescript_1.default.ScriptTarget.ESNext,
50
+ module: typescript_1.default.ModuleKind.CommonJS,
51
+ moduleResolution: typescript_1.default.ModuleResolutionKind.Node10,
52
+ moduleDetection: typescript_1.default.ModuleDetectionKind.Force,
53
+ typeRoots: [RBXTS_SCOPE_PATH],
54
+ resolveJsonModule: true,
55
+ experimentalDecorators: true,
56
+ rootDir: ROOT_DIR,
57
+ outDir: OUT_DIR,
58
+ jsx: typescript_1.default.JsxEmit.React,
59
+ jsxFactory: "React.createElement",
60
+ jsxFragmentFactory: "React.Fragment",
61
+ };
62
+ (0, validateCompilerOptions_1.validateCompilerOptions)(this.compilerOptions, this.data.projectPath);
63
+ this.vfs = new VirtualFileSystem_1.VirtualFileSystem();
64
+ const system = {
65
+ getExecutingFilePath: () => __filename,
66
+ getCurrentDirectory: () => "/",
67
+ };
68
+ this.compilerHost = typescript_1.default.createCompilerHostWorker(this.compilerOptions, undefined, system);
69
+ this.compilerHost.readFile = filePath => this.vfs.readFile(filePath);
70
+ this.compilerHost.fileExists = filePath => this.vfs.fileExists(filePath);
71
+ this.compilerHost.directoryExists = dirPath => this.vfs.directoryExists(dirPath);
72
+ this.compilerHost.getDirectories = dirPath => this.vfs.getDirectories(dirPath);
73
+ this.compilerHost.useCaseSensitiveFileNames = () => true;
74
+ this.compilerHost.getCurrentDirectory = () => VirtualFileSystem_1.PATH_SEP;
75
+ this.rojoResolver = rojo_resolver_1.RojoResolver.fromTree(PROJECT_DIR, {
76
+ $path: OUT_DIR,
77
+ include: {
78
+ $path: INCLUDE_PATH,
79
+ node_modules: {
80
+ $className: "Folder",
81
+ "@rbxts": {
82
+ $path: RBXTS_SCOPE_PATH,
83
+ },
84
+ },
85
+ },
86
+ });
87
+ this.pkgRojoResolvers = this.compilerOptions.typeRoots.map(rojo_resolver_1.RojoResolver.synthetic);
88
+ }
89
+ compileSource(source) {
90
+ this.vfs.writeFile(PLAYGROUND_PATH, source);
91
+ const rootNames = this.vfs
92
+ .getFilePaths()
93
+ .filter(v => v.endsWith(typescript_1.default.Extension.Ts) || v.endsWith(typescript_1.default.Extension.Tsx) || v.endsWith(typescript_1.default.Extension.Dts));
94
+ this.program = typescript_1.default.createProgram(rootNames, this.compilerOptions, this.compilerHost, this.program);
95
+ this.typeChecker = this.program.getTypeChecker();
96
+ const services = (0, createTransformServices_1.createTransformServices)(this.typeChecker);
97
+ const pathTranslator = new path_translator_1.PathTranslator(ROOT_DIR, OUT_DIR, undefined, false, this.data.projectOptions.luau);
98
+ const sourceFile = this.program.getSourceFile(PLAYGROUND_PATH);
99
+ (0, assert_1.assert)(sourceFile);
100
+ const diagnostics = new Array();
101
+ diagnostics.push(...typescript_1.default.getPreEmitDiagnostics(this.program, sourceFile));
102
+ diagnostics.push(...(0, getCustomPreEmitDiagnostics_1.getCustomPreEmitDiagnostics)(this.data, sourceFile));
103
+ if ((0, hasErrors_1.hasErrors)(diagnostics))
104
+ throw new DiagnosticError_1.DiagnosticError(diagnostics);
105
+ const multiTransformState = new TSTransformer_1.MultiTransformState();
106
+ const runtimeLibRbxPath = undefined;
107
+ const projectType = this.data.projectOptions.type;
108
+ const transformState = new TSTransformer_1.TransformState(this.program, this.data, services, pathTranslator, multiTransformState, this.compilerOptions, this.rojoResolver, this.pkgRojoResolvers, this.nodeModulesPathMapping, runtimeLibRbxPath, this.typeChecker, projectType, () => pathTranslator, sourceFile);
109
+ const luaAST = (0, TSTransformer_1.transformSourceFile)(transformState, sourceFile);
110
+ diagnostics.push(...DiagnosticService_1.DiagnosticService.flush());
111
+ if ((0, hasErrors_1.hasErrors)(diagnostics))
112
+ throw new DiagnosticError_1.DiagnosticError(diagnostics);
113
+ const luaSource = (0, luau_ast_1.renderAST)(luaAST);
114
+ return luaSource;
115
+ }
116
+ setMapping(typings, main) {
117
+ this.nodeModulesPathMapping.set(typings, main);
118
+ }
119
+ }
120
+ exports.VirtualProject = VirtualProject;
121
+ //# sourceMappingURL=VirtualProject.js.map
@@ -0,0 +1,18 @@
1
+ import { PathTranslator } from "@roblox-ts/path-translator";
2
+ import { ProjectData, ProjectOptions, ReferencedProjectInfo } from "../../Shared/types";
3
+ import ts from "typescript";
4
+ export interface BuildProjectOptions {
5
+ tsConfigPath: string;
6
+ projectOptions: ProjectOptions;
7
+ isRootProject: boolean;
8
+ referencedProjects?: Array<ReferencedProjectInfo>;
9
+ rootProjectRojoConfigPath?: string;
10
+ rootProjectIncludePath?: string;
11
+ }
12
+ export interface BuildProjectResult {
13
+ emitResult: ts.EmitResult;
14
+ data: ProjectData;
15
+ pathTranslator: PathTranslator;
16
+ program: ts.EmitAndSemanticDiagnosticsBuilderProgram;
17
+ }
18
+ export declare function buildProject(options: BuildProjectOptions): BuildProjectResult;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildProject = buildProject;
4
+ const cleanup_1 = require("./cleanup");
5
+ const compileFiles_1 = require("./compileFiles");
6
+ const copyFiles_1 = require("./copyFiles");
7
+ const copyInclude_1 = require("./copyInclude");
8
+ const createPathTranslator_1 = require("./createPathTranslator");
9
+ const createProjectData_1 = require("./createProjectData");
10
+ const createProjectProgram_1 = require("./createProjectProgram");
11
+ const getChangedSourceFiles_1 = require("./getChangedSourceFiles");
12
+ const getRootDirs_1 = require("../../Shared/util/getRootDirs");
13
+ function buildProject(options) {
14
+ const { tsConfigPath, projectOptions, isRootProject, referencedProjects, rootProjectRojoConfigPath, rootProjectIncludePath, } = options;
15
+ const effectiveProjectOptions = { ...projectOptions };
16
+ if (!isRootProject) {
17
+ effectiveProjectOptions.noInclude = true;
18
+ if (rootProjectRojoConfigPath) {
19
+ effectiveProjectOptions.rojo = rootProjectRojoConfigPath;
20
+ }
21
+ }
22
+ const data = (0, createProjectData_1.createProjectData)(tsConfigPath, effectiveProjectOptions);
23
+ if (referencedProjects && referencedProjects.length > 0) {
24
+ data.referencedProjects = referencedProjects;
25
+ data.isCompositeProject = true;
26
+ }
27
+ if (!isRootProject) {
28
+ data.isReferencedProject = true;
29
+ if (rootProjectIncludePath) {
30
+ data.rootProjectIncludePath = rootProjectIncludePath;
31
+ }
32
+ }
33
+ const program = (0, createProjectProgram_1.createProjectProgram)(data);
34
+ const pathTranslator = (0, createPathTranslator_1.createPathTranslator)(program, data);
35
+ if (isRootProject) {
36
+ (0, cleanup_1.cleanup)(pathTranslator);
37
+ (0, copyInclude_1.copyInclude)(data);
38
+ }
39
+ (0, copyFiles_1.copyFiles)(data, pathTranslator, new Set((0, getRootDirs_1.getRootDirs)(program.getCompilerOptions())));
40
+ const emitResult = (0, compileFiles_1.compileFiles)(program.getProgram(), data, pathTranslator, (0, getChangedSourceFiles_1.getChangedSourceFiles)(program));
41
+ return {
42
+ emitResult,
43
+ data,
44
+ pathTranslator,
45
+ program,
46
+ };
47
+ }
48
+ //# sourceMappingURL=buildProject.js.map
@@ -0,0 +1,3 @@
1
+ import { ProjectOptions } from "../../Shared/types";
2
+ import ts from "typescript";
3
+ export declare function buildProjectReferences(tsConfigPath: string, projectOptions: ProjectOptions, diagnosticReporter: ts.DiagnosticReporter): number;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.buildProjectReferences = buildProjectReferences;
7
+ const path_1 = __importDefault(require("path"));
8
+ const compileProject_1 = require("./compileProject");
9
+ const createProjectData_1 = require("./createProjectData");
10
+ const LogService_1 = require("../../Shared/classes/LogService");
11
+ const hasErrors_1 = require("../../Shared/util/hasErrors");
12
+ const typescript_1 = __importDefault(require("typescript"));
13
+ function buildProjectReferences(tsConfigPath, projectOptions, diagnosticReporter) {
14
+ const allDiagnostics = [];
15
+ const rootConfigPath = path_1.default.normalize(tsConfigPath);
16
+ const rootData = (0, createProjectData_1.createProjectData)(tsConfigPath, projectOptions);
17
+ const rootRojoConfigPath = rootData.rojoConfigPath;
18
+ const rootIncludePath = rootData.projectOptions.includePath;
19
+ const referencedProjects = [];
20
+ const host = typescript_1.default.createSolutionBuilderHost(typescript_1.default.sys, typescript_1.default.createEmitAndSemanticDiagnosticsBuilderProgram);
21
+ const builder = typescript_1.default.createSolutionBuilder(host, [tsConfigPath], {});
22
+ const projectsToCompile = [];
23
+ let project = builder.getNextInvalidatedProject();
24
+ while (project) {
25
+ if (project.kind === typescript_1.default.InvalidatedProjectKind.Build) {
26
+ const program = project.getProgram();
27
+ if (program) {
28
+ const configPath = path_1.default.normalize(project.project);
29
+ if (configPath !== rootConfigPath) {
30
+ const resolvedRefs = program.getResolvedProjectReferences();
31
+ if (resolvedRefs) {
32
+ (0, compileProject_1.collectReferencedProjects)(resolvedRefs, referencedProjects, rootConfigPath, projectOptions.luau);
33
+ }
34
+ }
35
+ projectsToCompile.push({ configPath, program });
36
+ }
37
+ project.emit(undefined, undefined, undefined, true);
38
+ }
39
+ project.done();
40
+ project = builder.getNextInvalidatedProject();
41
+ }
42
+ if (projectsToCompile.length > 0) {
43
+ const rootProject = projectsToCompile.find(p => p.configPath === rootConfigPath);
44
+ if (rootProject) {
45
+ const resolvedRefs = rootProject.program.getResolvedProjectReferences();
46
+ if (resolvedRefs) {
47
+ (0, compileProject_1.collectReferencedProjects)(resolvedRefs, referencedProjects, rootConfigPath, projectOptions.luau);
48
+ }
49
+ }
50
+ }
51
+ if (referencedProjects.length > 0) {
52
+ LogService_1.LogService.writeLineIfVerbose(`Found ${referencedProjects.length} referenced project(s)`);
53
+ }
54
+ for (const { configPath, program } of projectsToCompile) {
55
+ const emitResult = (0, compileProject_1.compileProject)({
56
+ program,
57
+ configPath,
58
+ projectOptions,
59
+ rootConfigPath,
60
+ rootRojoConfigPath,
61
+ rootIncludePath,
62
+ referencedProjects,
63
+ isInitialCompile: true,
64
+ });
65
+ allDiagnostics.push(...emitResult.diagnostics);
66
+ if ((0, hasErrors_1.hasErrors)(emitResult.diagnostics)) {
67
+ for (const diagnostic of allDiagnostics) {
68
+ diagnosticReporter(diagnostic);
69
+ }
70
+ return 1;
71
+ }
72
+ }
73
+ for (const diagnostic of allDiagnostics) {
74
+ diagnosticReporter(diagnostic);
75
+ }
76
+ return (0, hasErrors_1.hasErrors)(allDiagnostics) ? 1 : 0;
77
+ }
78
+ //# sourceMappingURL=buildProjectReferences.js.map
@@ -0,0 +1,10 @@
1
+ import { BuildProjectResult } from "./buildProject";
2
+ import { ProjectOptions } from "../../Shared/types";
3
+ import ts from "typescript";
4
+ export interface BuildSolutionResult {
5
+ success: boolean;
6
+ diagnostics: Array<ts.Diagnostic>;
7
+ projectResults: Array<BuildProjectResult>;
8
+ }
9
+ export declare function buildSolution(rootTsConfigPath: string, projectOptions: ProjectOptions): BuildSolutionResult;
10
+ export declare function shouldUseSolutionBuild(tsConfigPath: string): boolean;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.buildSolution = buildSolution;
7
+ exports.shouldUseSolutionBuild = shouldUseSolutionBuild;
8
+ const rojo_resolver_1 = require("@roblox-ts/rojo-resolver");
9
+ const path_1 = __importDefault(require("path"));
10
+ const buildProject_1 = require("./buildProject");
11
+ const createProjectData_1 = require("./createProjectData");
12
+ const getProjectReferences_1 = require("./getProjectReferences");
13
+ const LogService_1 = require("../../Shared/classes/LogService");
14
+ const ProjectError_1 = require("../../Shared/errors/ProjectError");
15
+ const hasErrors_1 = require("../../Shared/util/hasErrors");
16
+ const typescript_1 = __importDefault(require("typescript"));
17
+ function buildSolution(rootTsConfigPath, projectOptions) {
18
+ const allDiagnostics = [];
19
+ const projectResults = [];
20
+ const rootConfig = (0, getProjectReferences_1.getRootProjectConfig)(rootTsConfigPath);
21
+ if (!rootConfig) {
22
+ throw new ProjectError_1.ProjectError(`Failed to parse root tsconfig: ${rootTsConfigPath}`);
23
+ }
24
+ const rootProjectPath = path_1.default.dirname(rootTsConfigPath);
25
+ const referencedProjects = (0, getProjectReferences_1.getProjectReferences)(rootTsConfigPath, projectOptions.luau);
26
+ if (referencedProjects.length > 0) {
27
+ LogService_1.LogService.writeLineIfVerbose(`Found ${referencedProjects.length} referenced project(s)`);
28
+ }
29
+ const rootData = (0, createProjectData_1.createProjectData)(rootTsConfigPath, projectOptions);
30
+ const rootRojoConfigPath = rootData.rojoConfigPath;
31
+ if (projectOptions.rojo) {
32
+ const rojoConfigPath = path_1.default.resolve(rootProjectPath, projectOptions.rojo);
33
+ if (typescript_1.default.sys.fileExists(rojoConfigPath)) {
34
+ const rojoResolver = rojo_resolver_1.RojoResolver.fromPath(rojoConfigPath);
35
+ const validationDiagnostics = validateReferencedProjectsWithRojo(rojoResolver, referencedProjects, rootProjectPath);
36
+ if (validationDiagnostics.length > 0) {
37
+ allDiagnostics.push(...validationDiagnostics);
38
+ return { success: false, diagnostics: allDiagnostics, projectResults };
39
+ }
40
+ }
41
+ }
42
+ for (const refProject of referencedProjects) {
43
+ const relativePath = path_1.default.relative(rootProjectPath, refProject.tsConfigPath);
44
+ LogService_1.LogService.writeLineIfVerbose(`Building referenced project: ${relativePath}`);
45
+ const result = (0, buildProject_1.buildProject)({
46
+ tsConfigPath: refProject.tsConfigPath,
47
+ projectOptions,
48
+ isRootProject: false,
49
+ referencedProjects,
50
+ rootProjectRojoConfigPath: rootRojoConfigPath,
51
+ rootProjectIncludePath: rootData.projectOptions.includePath,
52
+ });
53
+ projectResults.push(result);
54
+ allDiagnostics.push(...result.emitResult.diagnostics);
55
+ if ((0, hasErrors_1.hasErrors)(result.emitResult.diagnostics)) {
56
+ LogService_1.LogService.writeLineIfVerbose(`Build failed for: ${relativePath}`);
57
+ return { success: false, diagnostics: allDiagnostics, projectResults };
58
+ }
59
+ }
60
+ LogService_1.LogService.writeLineIfVerbose(`Building root project: ${rootTsConfigPath}`);
61
+ const rootResult = (0, buildProject_1.buildProject)({
62
+ tsConfigPath: rootTsConfigPath,
63
+ projectOptions,
64
+ isRootProject: true,
65
+ referencedProjects,
66
+ });
67
+ projectResults.push(rootResult);
68
+ allDiagnostics.push(...rootResult.emitResult.diagnostics);
69
+ const success = !(0, hasErrors_1.hasErrors)(allDiagnostics);
70
+ return { success, diagnostics: allDiagnostics, projectResults };
71
+ }
72
+ function validateReferencedProjectsWithRojo(rojoResolver, referencedProjects, rootProjectPath) {
73
+ const diagnostics = [];
74
+ for (const project of referencedProjects) {
75
+ const testPath = path_1.default.join(project.outDir, "init.lua");
76
+ const rbxPath = rojoResolver.getRbxPathFromFilePath(testPath);
77
+ if (!rbxPath) {
78
+ const relativeTsConfig = path_1.default.relative(rootProjectPath, project.tsConfigPath);
79
+ const relativeOutDir = path_1.default.relative(rootProjectPath, project.outDir);
80
+ diagnostics.push({
81
+ category: typescript_1.default.DiagnosticCategory.Error,
82
+ code: 0,
83
+ file: undefined,
84
+ start: undefined,
85
+ length: undefined,
86
+ messageText: `Referenced project "${relativeTsConfig}" outputs to "${relativeOutDir}" ` +
87
+ `which is not covered by the Rojo configuration.\n` +
88
+ `Ensure all referenced project outDir paths are within the scope of your Rojo project file.`,
89
+ });
90
+ }
91
+ }
92
+ return diagnostics;
93
+ }
94
+ function shouldUseSolutionBuild(tsConfigPath) {
95
+ return (0, getProjectReferences_1.hasProjectReferences)(tsConfigPath);
96
+ }
97
+ //# sourceMappingURL=buildSolution.js.map
@@ -0,0 +1 @@
1
+ export declare function checkFileName(filePath: string): void;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.checkFileName = checkFileName;
7
+ const path_1 = __importDefault(require("path"));
8
+ const constants_1 = require("../../Shared/constants");
9
+ const diagnostics_1 = require("../../Shared/diagnostics");
10
+ const DiagnosticService_1 = require("../../TSTransformer/classes/DiagnosticService");
11
+ function checkFileName(filePath) {
12
+ const baseName = path_1.default.basename(filePath);
13
+ const nameWarning = constants_1.FILENAME_WARNINGS.get(baseName);
14
+ if (nameWarning) {
15
+ DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.incorrectFileName(baseName, nameWarning, filePath));
16
+ }
17
+ }
18
+ //# sourceMappingURL=checkFileName.js.map
@@ -0,0 +1,4 @@
1
+ import { PathTranslator } from "@roblox-ts/path-translator";
2
+ import { RojoResolver } from "@roblox-ts/rojo-resolver";
3
+ import { ProjectData } from "..";
4
+ export declare function checkRojoConfig(data: ProjectData, rojoResolver: RojoResolver, rootDirs: ReadonlyArray<string>, pathTranslator: PathTranslator): void;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.checkRojoConfig = checkRojoConfig;
7
+ const path_1 = __importDefault(require("path"));
8
+ const diagnostics_1 = require("../../Shared/diagnostics");
9
+ const isPathDescendantOf_1 = require("../../Shared/util/isPathDescendantOf");
10
+ const DiagnosticService_1 = require("../../TSTransformer/classes/DiagnosticService");
11
+ function checkRojoConfig(data, rojoResolver, rootDirs, pathTranslator) {
12
+ if (data.rojoConfigPath !== undefined) {
13
+ for (const partition of rojoResolver.getPartitions()) {
14
+ for (const rootDir of rootDirs) {
15
+ if ((0, isPathDescendantOf_1.isPathDescendantOf)(partition.fsPath, rootDir)) {
16
+ const rojoConfigDir = path_1.default.dirname(data.rojoConfigPath);
17
+ const outPath = pathTranslator.getOutputPath(partition.fsPath);
18
+ const inputPath = path_1.default.relative(rojoConfigDir, partition.fsPath);
19
+ const suggestedPath = path_1.default.relative(rojoConfigDir, outPath);
20
+ DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.rojoPathInSrc(inputPath, suggestedPath));
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ //# sourceMappingURL=checkRojoConfig.js.map
@@ -0,0 +1,2 @@
1
+ import { PathTranslator } from "@roblox-ts/path-translator";
2
+ export declare function cleanup(pathTranslator: PathTranslator): void;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.cleanup = cleanup;
7
+ const fs_extra_1 = __importDefault(require("fs-extra"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const tryRemoveOutput_1 = require("./tryRemoveOutput");
10
+ function cleanupDirRecursively(pathTranslator, dir) {
11
+ if (fs_extra_1.default.pathExistsSync(dir)) {
12
+ for (const name of fs_extra_1.default.readdirSync(dir)) {
13
+ const itemPath = path_1.default.join(dir, name);
14
+ if (fs_extra_1.default.statSync(itemPath).isDirectory()) {
15
+ if (name === ".git") {
16
+ continue;
17
+ }
18
+ cleanupDirRecursively(pathTranslator, itemPath);
19
+ }
20
+ (0, tryRemoveOutput_1.tryRemoveOutput)(pathTranslator, itemPath);
21
+ }
22
+ }
23
+ }
24
+ function cleanup(pathTranslator) {
25
+ const outDir = pathTranslator.outDir;
26
+ if (fs_extra_1.default.pathExistsSync(outDir)) {
27
+ cleanupDirRecursively(pathTranslator, outDir);
28
+ }
29
+ }
30
+ //# sourceMappingURL=cleanup.js.map
@@ -0,0 +1,4 @@
1
+ import { PathTranslator } from "@roblox-ts/path-translator";
2
+ import { GetProjectPathTranslator, ProjectData } from "../../Shared/types";
3
+ import ts from "typescript";
4
+ export declare function compileFiles(program: ts.Program, data: ProjectData, pathTranslator: PathTranslator, getProjectPathTranslator: GetProjectPathTranslator, sourceFiles: Array<ts.SourceFile>): ts.EmitResult;