@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.
- package/CHANGELOG.md +716 -0
- package/LICENSE +21 -0
- package/README.md +55 -0
- package/include/Promise.lua +2068 -0
- package/include/RuntimeLib.lua +258 -0
- package/out/CLI/cli.d.ts +2 -0
- package/out/CLI/cli.js +41 -0
- package/out/CLI/commands/build.d.ts +7 -0
- package/out/CLI/commands/build.js +438 -0
- package/out/CLI/errors/CLIError.d.ts +4 -0
- package/out/CLI/errors/CLIError.js +12 -0
- package/out/CLI/index.d.ts +3 -0
- package/out/CLI/index.js +22 -0
- package/out/CLI/test.d.ts +1 -0
- package/out/CLI/test.js +82 -0
- package/out/CLI/util/patchFs.d.ts +1 -0
- package/out/CLI/util/patchFs.js +26 -0
- package/out/Project/classes/VirtualFileSystem.d.ts +14 -0
- package/out/Project/classes/VirtualFileSystem.js +102 -0
- package/out/Project/classes/VirtualProject.d.ts +15 -0
- package/out/Project/classes/VirtualProject.js +121 -0
- package/out/Project/functions/buildProject.d.ts +18 -0
- package/out/Project/functions/buildProject.js +48 -0
- package/out/Project/functions/buildProjectReferences.d.ts +3 -0
- package/out/Project/functions/buildProjectReferences.js +78 -0
- package/out/Project/functions/buildSolution.d.ts +10 -0
- package/out/Project/functions/buildSolution.js +97 -0
- package/out/Project/functions/checkFileName.d.ts +1 -0
- package/out/Project/functions/checkFileName.js +18 -0
- package/out/Project/functions/checkRojoConfig.d.ts +4 -0
- package/out/Project/functions/checkRojoConfig.js +26 -0
- package/out/Project/functions/cleanup.d.ts +2 -0
- package/out/Project/functions/cleanup.js +30 -0
- package/out/Project/functions/compileFiles.d.ts +4 -0
- package/out/Project/functions/compileFiles.js +160 -0
- package/out/Project/functions/compileProject.d.ts +14 -0
- package/out/Project/functions/compileProject.js +71 -0
- package/out/Project/functions/copyFiles.d.ts +3 -0
- package/out/Project/functions/copyFiles.js +13 -0
- package/out/Project/functions/copyInclude.d.ts +2 -0
- package/out/Project/functions/copyInclude.js +17 -0
- package/out/Project/functions/copyItem.d.ts +3 -0
- package/out/Project/functions/copyItem.js +27 -0
- package/out/Project/functions/createNodeModulesPathMapping.d.ts +1 -0
- package/out/Project/functions/createNodeModulesPathMapping.js +31 -0
- package/out/Project/functions/createPathTranslator.d.ts +4 -0
- package/out/Project/functions/createPathTranslator.js +22 -0
- package/out/Project/functions/createProgramFactory.d.ts +3 -0
- package/out/Project/functions/createProgramFactory.js +31 -0
- package/out/Project/functions/createProjectData.d.ts +2 -0
- package/out/Project/functions/createProjectData.js +102 -0
- package/out/Project/functions/createProjectProgram.d.ts +3 -0
- package/out/Project/functions/createProjectProgram.js +11 -0
- package/out/Project/functions/getChangedFilePaths.d.ts +2 -0
- package/out/Project/functions/getChangedFilePaths.js +47 -0
- package/out/Project/functions/getChangedSourceFiles.d.ts +2 -0
- package/out/Project/functions/getChangedSourceFiles.js +19 -0
- package/out/Project/functions/getParsedCommandLine.d.ts +3 -0
- package/out/Project/functions/getParsedCommandLine.js +41 -0
- package/out/Project/functions/getProjectReferences.d.ts +2 -0
- package/out/Project/functions/getProjectReferences.js +65 -0
- package/out/Project/functions/getResolvedProjectReferences.d.ts +3 -0
- package/out/Project/functions/getResolvedProjectReferences.js +43 -0
- package/out/Project/functions/setupProjectWatchProgram.d.ts +2 -0
- package/out/Project/functions/setupProjectWatchProgram.js +352 -0
- package/out/Project/functions/setupSolutionWatchProgram.d.ts +2 -0
- package/out/Project/functions/setupSolutionWatchProgram.js +355 -0
- package/out/Project/functions/tryRemoveOutput.d.ts +2 -0
- package/out/Project/functions/tryRemoveOutput.js +30 -0
- package/out/Project/functions/validateCompilerOptions.d.ts +2 -0
- package/out/Project/functions/validateCompilerOptions.js +87 -0
- package/out/Project/index.d.ts +4 -0
- package/out/Project/index.js +20 -0
- package/out/Project/preEmitDiagnostics/fileUsesCommentDirectives.d.ts +3 -0
- package/out/Project/preEmitDiagnostics/fileUsesCommentDirectives.js +28 -0
- package/out/Project/transformers/builtin/transformPaths.d.ts +5 -0
- package/out/Project/transformers/builtin/transformPaths.js +129 -0
- package/out/Project/transformers/builtin/transformTypeReferenceDirectives.d.ts +2 -0
- package/out/Project/transformers/builtin/transformTypeReferenceDirectives.js +23 -0
- package/out/Project/transformers/createTransformerList.d.ts +4 -0
- package/out/Project/transformers/createTransformerList.js +87 -0
- package/out/Project/transformers/createTransformerWatcher.d.ts +3 -0
- package/out/Project/transformers/createTransformerWatcher.js +59 -0
- package/out/Project/transformers/getPluginConfigs.d.ts +2 -0
- package/out/Project/transformers/getPluginConfigs.js +34 -0
- package/out/Project/util/createReadBuildProgramHost.d.ts +5 -0
- package/out/Project/util/createReadBuildProgramHost.js +15 -0
- package/out/Project/util/getCustomPreEmitDiagnostics.d.ts +4 -0
- package/out/Project/util/getCustomPreEmitDiagnostics.js +13 -0
- package/out/Project/util/isCompilableFile.d.ts +1 -0
- package/out/Project/util/isCompilableFile.js +18 -0
- package/out/Project/util/walkDirectorySync.d.ts +1 -0
- package/out/Project/util/walkDirectorySync.js +22 -0
- package/out/Shared/classes/Lazy.d.ts +8 -0
- package/out/Shared/classes/Lazy.js +22 -0
- package/out/Shared/classes/LogService.d.ts +9 -0
- package/out/Shared/classes/LogService.js +37 -0
- package/out/Shared/constants.d.ts +23 -0
- package/out/Shared/constants.js +50 -0
- package/out/Shared/diagnostics.d.ts +79 -0
- package/out/Shared/diagnostics.js +140 -0
- package/out/Shared/errors/DiagnosticError.d.ts +7 -0
- package/out/Shared/errors/DiagnosticError.js +16 -0
- package/out/Shared/errors/LoggableError.d.ts +5 -0
- package/out/Shared/errors/LoggableError.js +14 -0
- package/out/Shared/errors/ProjectError.d.ts +4 -0
- package/out/Shared/errors/ProjectError.js +12 -0
- package/out/Shared/index.d.ts +0 -0
- package/out/Shared/index.js +2 -0
- package/out/Shared/types.d.ts +50 -0
- package/out/Shared/types.js +3 -0
- package/out/Shared/util/assert.d.ts +1 -0
- package/out/Shared/util/assert.js +12 -0
- package/out/Shared/util/benchmark.d.ts +3 -0
- package/out/Shared/util/benchmark.js +32 -0
- package/out/Shared/util/createDiagnosticWithLocation.d.ts +3 -0
- package/out/Shared/util/createDiagnosticWithLocation.js +29 -0
- package/out/Shared/util/createGithubLink.d.ts +1 -0
- package/out/Shared/util/createGithubLink.js +12 -0
- package/out/Shared/util/createTextDiagnostic.d.ts +2 -0
- package/out/Shared/util/createTextDiagnostic.js +18 -0
- package/out/Shared/util/findAncestorDir.d.ts +1 -0
- package/out/Shared/util/findAncestorDir.js +16 -0
- package/out/Shared/util/findLastIndex.d.ts +1 -0
- package/out/Shared/util/findLastIndex.js +12 -0
- package/out/Shared/util/formatDiagnostics.d.ts +2 -0
- package/out/Shared/util/formatDiagnostics.js +19 -0
- package/out/Shared/util/getCanonicalFileName.d.ts +2 -0
- package/out/Shared/util/getCanonicalFileName.js +10 -0
- package/out/Shared/util/getOrSetDefault.d.ts +1 -0
- package/out/Shared/util/getOrSetDefault.js +12 -0
- package/out/Shared/util/getRootDirs.d.ts +2 -0
- package/out/Shared/util/getRootDirs.js +10 -0
- package/out/Shared/util/hasErrors.d.ts +2 -0
- package/out/Shared/util/hasErrors.js +11 -0
- package/out/Shared/util/isPathDescendantOf.d.ts +1 -0
- package/out/Shared/util/isPathDescendantOf.js +11 -0
- package/out/Shared/util/realPathExistsSync.d.ts +1 -0
- package/out/Shared/util/realPathExistsSync.js +13 -0
- package/out/Shared/warn.d.ts +1 -0
- package/out/Shared/warn.js +12 -0
- package/out/TSTransformer/classes/DiagnosticService.d.ts +11 -0
- package/out/TSTransformer/classes/DiagnosticService.js +37 -0
- package/out/TSTransformer/classes/MacroManager.d.ts +46 -0
- package/out/TSTransformer/classes/MacroManager.js +178 -0
- package/out/TSTransformer/classes/MultiTransformState.d.ts +9 -0
- package/out/TSTransformer/classes/MultiTransformState.js +15 -0
- package/out/TSTransformer/classes/TransformState.d.ts +73 -0
- package/out/TSTransformer/classes/TransformState.js +307 -0
- package/out/TSTransformer/index.d.ts +4 -0
- package/out/TSTransformer/index.js +23 -0
- package/out/TSTransformer/macros/callMacros.d.ts +2 -0
- package/out/TSTransformer/macros/callMacros.js +56 -0
- package/out/TSTransformer/macros/constructorMacros.d.ts +2 -0
- package/out/TSTransformer/macros/constructorMacros.js +97 -0
- package/out/TSTransformer/macros/identifierMacros.d.ts +2 -0
- package/out/TSTransformer/macros/identifierMacros.js +7 -0
- package/out/TSTransformer/macros/propertyCallMacros.d.ts +4 -0
- package/out/TSTransformer/macros/propertyCallMacros.js +726 -0
- package/out/TSTransformer/macros/types.d.ts +12 -0
- package/out/TSTransformer/macros/types.js +3 -0
- package/out/TSTransformer/nodes/binding/transformArrayAssignmentPattern.d.ts +4 -0
- package/out/TSTransformer/nodes/binding/transformArrayAssignmentPattern.js +78 -0
- package/out/TSTransformer/nodes/binding/transformArrayBindingPattern.d.ts +4 -0
- package/out/TSTransformer/nodes/binding/transformArrayBindingPattern.js +52 -0
- package/out/TSTransformer/nodes/binding/transformBindingName.d.ts +4 -0
- package/out/TSTransformer/nodes/binding/transformBindingName.js +30 -0
- package/out/TSTransformer/nodes/binding/transformObjectAssignmentPattern.d.ts +4 -0
- package/out/TSTransformer/nodes/binding/transformObjectAssignmentPattern.js +97 -0
- package/out/TSTransformer/nodes/binding/transformObjectBindingPattern.d.ts +4 -0
- package/out/TSTransformer/nodes/binding/transformObjectBindingPattern.js +57 -0
- package/out/TSTransformer/nodes/class/transformClassConstructor.d.ts +7 -0
- package/out/TSTransformer/nodes/class/transformClassConstructor.js +96 -0
- package/out/TSTransformer/nodes/class/transformClassLikeDeclaration.d.ts +7 -0
- package/out/TSTransformer/nodes/class/transformClassLikeDeclaration.js +262 -0
- package/out/TSTransformer/nodes/class/transformDecorators.d.ts +4 -0
- package/out/TSTransformer/nodes/class/transformDecorators.js +179 -0
- package/out/TSTransformer/nodes/class/transformPropertyDeclaration.d.ts +4 -0
- package/out/TSTransformer/nodes/class/transformPropertyDeclaration.js +33 -0
- package/out/TSTransformer/nodes/expressions/transformArrayLiteralExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformArrayLiteralExpression.js +79 -0
- package/out/TSTransformer/nodes/expressions/transformAwaitExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformAwaitExpression.js +13 -0
- package/out/TSTransformer/nodes/expressions/transformBinaryExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformBinaryExpression.js +199 -0
- package/out/TSTransformer/nodes/expressions/transformBooleanLiteral.d.ts +3 -0
- package/out/TSTransformer/nodes/expressions/transformBooleanLiteral.js +15 -0
- package/out/TSTransformer/nodes/expressions/transformCallExpression.d.ts +7 -0
- package/out/TSTransformer/nodes/expressions/transformCallExpression.js +191 -0
- package/out/TSTransformer/nodes/expressions/transformClassExpression.d.ts +3 -0
- package/out/TSTransformer/nodes/expressions/transformClassExpression.js +10 -0
- package/out/TSTransformer/nodes/expressions/transformConditionalExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformConditionalExpression.js +55 -0
- package/out/TSTransformer/nodes/expressions/transformDeleteExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformDeleteExpression.js +14 -0
- package/out/TSTransformer/nodes/expressions/transformElementAccessExpression.d.ts +5 -0
- package/out/TSTransformer/nodes/expressions/transformElementAccessExpression.js +62 -0
- package/out/TSTransformer/nodes/expressions/transformExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformExpression.js +107 -0
- package/out/TSTransformer/nodes/expressions/transformFunctionExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformFunctionExpression.js +46 -0
- package/out/TSTransformer/nodes/expressions/transformIdentifier.d.ts +5 -0
- package/out/TSTransformer/nodes/expressions/transformIdentifier.js +147 -0
- package/out/TSTransformer/nodes/expressions/transformImportExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformImportExpression.js +30 -0
- package/out/TSTransformer/nodes/expressions/transformJsxElement.d.ts +3 -0
- package/out/TSTransformer/nodes/expressions/transformJsxElement.js +8 -0
- package/out/TSTransformer/nodes/expressions/transformJsxExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformJsxExpression.js +19 -0
- package/out/TSTransformer/nodes/expressions/transformJsxFragment.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformJsxFragment.js +28 -0
- package/out/TSTransformer/nodes/expressions/transformJsxSelfClosingElement.d.ts +3 -0
- package/out/TSTransformer/nodes/expressions/transformJsxSelfClosingElement.js +8 -0
- package/out/TSTransformer/nodes/expressions/transformNewExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformNewExpression.js +26 -0
- package/out/TSTransformer/nodes/expressions/transformNoSubstitutionTemplateLiteral.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformNoSubstitutionTemplateLiteral.js +14 -0
- package/out/TSTransformer/nodes/expressions/transformNumericLiteral.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformNumericLiteral.js +13 -0
- package/out/TSTransformer/nodes/expressions/transformObjectLiteralExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformObjectLiteralExpression.js +98 -0
- package/out/TSTransformer/nodes/expressions/transformOmittedExpression.d.ts +2 -0
- package/out/TSTransformer/nodes/expressions/transformOmittedExpression.js +11 -0
- package/out/TSTransformer/nodes/expressions/transformParenthesizedExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformParenthesizedExpression.js +19 -0
- package/out/TSTransformer/nodes/expressions/transformPropertyAccessExpression.d.ts +5 -0
- package/out/TSTransformer/nodes/expressions/transformPropertyAccessExpression.js +36 -0
- package/out/TSTransformer/nodes/expressions/transformSpreadElement.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformSpreadElement.js +35 -0
- package/out/TSTransformer/nodes/expressions/transformStringLiteral.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformStringLiteral.js +12 -0
- package/out/TSTransformer/nodes/expressions/transformSuperKeyword.d.ts +2 -0
- package/out/TSTransformer/nodes/expressions/transformSuperKeyword.js +11 -0
- package/out/TSTransformer/nodes/expressions/transformTaggedTemplateExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformTaggedTemplateExpression.js +27 -0
- package/out/TSTransformer/nodes/expressions/transformTemplateExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformTemplateExpression.js +25 -0
- package/out/TSTransformer/nodes/expressions/transformThisExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformThisExpression.js +29 -0
- package/out/TSTransformer/nodes/expressions/transformTypeExpression.d.ts +3 -0
- package/out/TSTransformer/nodes/expressions/transformTypeExpression.js +8 -0
- package/out/TSTransformer/nodes/expressions/transformUnaryExpression.d.ts +5 -0
- package/out/TSTransformer/nodes/expressions/transformUnaryExpression.js +68 -0
- package/out/TSTransformer/nodes/expressions/transformVoidExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformVoidExpression.js +14 -0
- package/out/TSTransformer/nodes/expressions/transformYieldExpression.d.ts +4 -0
- package/out/TSTransformer/nodes/expressions/transformYieldExpression.js +46 -0
- package/out/TSTransformer/nodes/jsx/transformJsx.d.ts +4 -0
- package/out/TSTransformer/nodes/jsx/transformJsx.js +36 -0
- package/out/TSTransformer/nodes/jsx/transformJsxAttributes.d.ts +4 -0
- package/out/TSTransformer/nodes/jsx/transformJsxAttributes.js +83 -0
- package/out/TSTransformer/nodes/jsx/transformJsxChildren.d.ts +4 -0
- package/out/TSTransformer/nodes/jsx/transformJsxChildren.js +34 -0
- package/out/TSTransformer/nodes/jsx/transformJsxTagName.d.ts +4 -0
- package/out/TSTransformer/nodes/jsx/transformJsxTagName.js +42 -0
- package/out/TSTransformer/nodes/statements/transformBlock.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformBlock.js +14 -0
- package/out/TSTransformer/nodes/statements/transformBreakStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformBreakStatement.js +24 -0
- package/out/TSTransformer/nodes/statements/transformClassDeclaration.d.ts +3 -0
- package/out/TSTransformer/nodes/statements/transformClassDeclaration.js +8 -0
- package/out/TSTransformer/nodes/statements/transformContinueStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformContinueStatement.js +24 -0
- package/out/TSTransformer/nodes/statements/transformDoStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformDoStatement.js +31 -0
- package/out/TSTransformer/nodes/statements/transformEnumDeclaration.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformEnumDeclaration.js +97 -0
- package/out/TSTransformer/nodes/statements/transformExportAssignment.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformExportAssignment.js +53 -0
- package/out/TSTransformer/nodes/statements/transformExportDeclaration.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformExportDeclaration.js +109 -0
- package/out/TSTransformer/nodes/statements/transformExpressionStatement.d.ts +5 -0
- package/out/TSTransformer/nodes/statements/transformExpressionStatement.js +62 -0
- package/out/TSTransformer/nodes/statements/transformForOfStatement.d.ts +5 -0
- package/out/TSTransformer/nodes/statements/transformForOfStatement.js +375 -0
- package/out/TSTransformer/nodes/statements/transformForStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformForStatement.js +371 -0
- package/out/TSTransformer/nodes/statements/transformFunctionDeclaration.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformFunctionDeclaration.js +68 -0
- package/out/TSTransformer/nodes/statements/transformIfStatement.d.ts +5 -0
- package/out/TSTransformer/nodes/statements/transformIfStatement.js +46 -0
- package/out/TSTransformer/nodes/statements/transformImportDeclaration.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformImportDeclaration.js +98 -0
- package/out/TSTransformer/nodes/statements/transformImportEqualsDeclaration.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformImportEqualsDeclaration.js +36 -0
- package/out/TSTransformer/nodes/statements/transformModuleDeclaration.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformModuleDeclaration.js +122 -0
- package/out/TSTransformer/nodes/statements/transformReturnStatement.d.ts +5 -0
- package/out/TSTransformer/nodes/statements/transformReturnStatement.js +74 -0
- package/out/TSTransformer/nodes/statements/transformStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformStatement.js +83 -0
- package/out/TSTransformer/nodes/statements/transformSwitchStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformSwitchStatement.js +105 -0
- package/out/TSTransformer/nodes/statements/transformThrowStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformThrowStatement.js +18 -0
- package/out/TSTransformer/nodes/statements/transformTryStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformTryStatement.js +148 -0
- package/out/TSTransformer/nodes/statements/transformVariableStatement.d.ts +8 -0
- package/out/TSTransformer/nodes/statements/transformVariableStatement.js +155 -0
- package/out/TSTransformer/nodes/statements/transformWhileStatement.d.ts +4 -0
- package/out/TSTransformer/nodes/statements/transformWhileStatement.js +30 -0
- package/out/TSTransformer/nodes/transformEntityName.d.ts +4 -0
- package/out/TSTransformer/nodes/transformEntityName.js +24 -0
- package/out/TSTransformer/nodes/transformInitializer.d.ts +4 -0
- package/out/TSTransformer/nodes/transformInitializer.js +22 -0
- package/out/TSTransformer/nodes/transformInterpolatedStringPart.d.ts +3 -0
- package/out/TSTransformer/nodes/transformInterpolatedStringPart.js +12 -0
- package/out/TSTransformer/nodes/transformLogical.d.ts +4 -0
- package/out/TSTransformer/nodes/transformLogical.js +103 -0
- package/out/TSTransformer/nodes/transformLogicalOrCoalescingAssignmentExpression.d.ts +5 -0
- package/out/TSTransformer/nodes/transformLogicalOrCoalescingAssignmentExpression.js +91 -0
- package/out/TSTransformer/nodes/transformMethodDeclaration.d.ts +5 -0
- package/out/TSTransformer/nodes/transformMethodDeclaration.js +82 -0
- package/out/TSTransformer/nodes/transformOptionalChain.d.ts +46 -0
- package/out/TSTransformer/nodes/transformOptionalChain.js +257 -0
- package/out/TSTransformer/nodes/transformParameters.d.ts +8 -0
- package/out/TSTransformer/nodes/transformParameters.js +104 -0
- package/out/TSTransformer/nodes/transformPropertyName.d.ts +4 -0
- package/out/TSTransformer/nodes/transformPropertyName.js +18 -0
- package/out/TSTransformer/nodes/transformSourceFile.d.ts +4 -0
- package/out/TSTransformer/nodes/transformSourceFile.js +171 -0
- package/out/TSTransformer/nodes/transformStatementList.d.ts +7 -0
- package/out/TSTransformer/nodes/transformStatementList.js +63 -0
- package/out/TSTransformer/nodes/transformWritable.d.ts +9 -0
- package/out/TSTransformer/nodes/transformWritable.js +49 -0
- package/out/TSTransformer/typeGuards.d.ts +5 -0
- package/out/TSTransformer/typeGuards.js +27 -0
- package/out/TSTransformer/types.d.ts +9 -0
- package/out/TSTransformer/types.js +3 -0
- package/out/TSTransformer/util/addIndexDiagnostics.d.ts +3 -0
- package/out/TSTransformer/util/addIndexDiagnostics.js +24 -0
- package/out/TSTransformer/util/addOneIfArrayType.d.ts +4 -0
- package/out/TSTransformer/util/addOneIfArrayType.js +14 -0
- package/out/TSTransformer/util/arrayBindingPatternContainsHoists.d.ts +3 -0
- package/out/TSTransformer/util/arrayBindingPatternContainsHoists.js +23 -0
- package/out/TSTransformer/util/arrayLikeExpressionContainsSpread.d.ts +2 -0
- package/out/TSTransformer/util/arrayLikeExpressionContainsSpread.js +17 -0
- package/out/TSTransformer/util/assertNever.d.ts +1 -0
- package/out/TSTransformer/util/assertNever.js +36 -0
- package/out/TSTransformer/util/assignment.d.ts +7 -0
- package/out/TSTransformer/util/assignment.js +48 -0
- package/out/TSTransformer/util/binding/getAccessorForBindingType.d.ts +6 -0
- package/out/TSTransformer/util/binding/getAccessorForBindingType.js +141 -0
- package/out/TSTransformer/util/binding/getTargetIdForBindingPattern.d.ts +4 -0
- package/out/TSTransformer/util/binding/getTargetIdForBindingPattern.js +15 -0
- package/out/TSTransformer/util/binding/objectAccessor.d.ts +4 -0
- package/out/TSTransformer/util/binding/objectAccessor.js +39 -0
- package/out/TSTransformer/util/bitwise.d.ts +6 -0
- package/out/TSTransformer/util/bitwise.js +67 -0
- package/out/TSTransformer/util/checkVariableHoist.d.ts +3 -0
- package/out/TSTransformer/util/checkVariableHoist.js +33 -0
- package/out/TSTransformer/util/cleanModuleName.d.ts +1 -0
- package/out/TSTransformer/util/cleanModuleName.js +7 -0
- package/out/TSTransformer/util/convertToIndexableExpression.d.ts +3 -0
- package/out/TSTransformer/util/convertToIndexableExpression.js +14 -0
- package/out/TSTransformer/util/createBinaryFromOperator.d.ts +4 -0
- package/out/TSTransformer/util/createBinaryFromOperator.js +54 -0
- package/out/TSTransformer/util/createGetService.d.ts +2 -0
- package/out/TSTransformer/util/createGetService.js +15 -0
- package/out/TSTransformer/util/createHoistDeclaration.d.ts +4 -0
- package/out/TSTransformer/util/createHoistDeclaration.js +20 -0
- package/out/TSTransformer/util/createImportExpression.d.ts +5 -0
- package/out/TSTransformer/util/createImportExpression.js +181 -0
- package/out/TSTransformer/util/createStringFromLiteral.d.ts +2 -0
- package/out/TSTransformer/util/createStringFromLiteral.js +27 -0
- package/out/TSTransformer/util/createTransformServices.d.ts +3 -0
- package/out/TSTransformer/util/createTransformServices.js +9 -0
- package/out/TSTransformer/util/createTruthinessChecks.d.ts +5 -0
- package/out/TSTransformer/util/createTruthinessChecks.js +50 -0
- package/out/TSTransformer/util/createTypeCheck.d.ts +2 -0
- package/out/TSTransformer/util/createTypeCheck.js +11 -0
- package/out/TSTransformer/util/ensureTransformOrder.d.ts +5 -0
- package/out/TSTransformer/util/ensureTransformOrder.js +39 -0
- package/out/TSTransformer/util/expressionChain.d.ts +3 -0
- package/out/TSTransformer/util/expressionChain.js +16 -0
- package/out/TSTransformer/util/expressionMightMutate.d.ts +4 -0
- package/out/TSTransformer/util/expressionMightMutate.js +57 -0
- package/out/TSTransformer/util/findConstructor.d.ts +4 -0
- package/out/TSTransformer/util/findConstructor.js +11 -0
- package/out/TSTransformer/util/fixupWhitespaceAndDecodeEntities.d.ts +1 -0
- package/out/TSTransformer/util/fixupWhitespaceAndDecodeEntities.js +306 -0
- package/out/TSTransformer/util/getAddIterableToArrayBuilder.d.ts +6 -0
- package/out/TSTransformer/util/getAddIterableToArrayBuilder.js +253 -0
- package/out/TSTransformer/util/getAssignableValue.d.ts +3 -0
- package/out/TSTransformer/util/getAssignableValue.js +15 -0
- package/out/TSTransformer/util/getConstantValueLiteral.d.ts +4 -0
- package/out/TSTransformer/util/getConstantValueLiteral.js +19 -0
- package/out/TSTransformer/util/getDeclaredVariables.d.ts +2 -0
- package/out/TSTransformer/util/getDeclaredVariables.js +37 -0
- package/out/TSTransformer/util/getExtendsNode.d.ts +2 -0
- package/out/TSTransformer/util/getExtendsNode.js +16 -0
- package/out/TSTransformer/util/getFlags.d.ts +1 -0
- package/out/TSTransformer/util/getFlags.js +13 -0
- package/out/TSTransformer/util/getKindName.d.ts +2 -0
- package/out/TSTransformer/util/getKindName.js +61 -0
- package/out/TSTransformer/util/getOriginalSymbolOfNode.d.ts +2 -0
- package/out/TSTransformer/util/getOriginalSymbolOfNode.js +15 -0
- package/out/TSTransformer/util/getSourceFileFromModuleSpecifier.d.ts +3 -0
- package/out/TSTransformer/util/getSourceFileFromModuleSpecifier.js +33 -0
- package/out/TSTransformer/util/getStatements.d.ts +2 -0
- package/out/TSTransformer/util/getStatements.js +11 -0
- package/out/TSTransformer/util/hasMultipleDefinitions.d.ts +2 -0
- package/out/TSTransformer/util/hasMultipleDefinitions.js +17 -0
- package/out/TSTransformer/util/isBlockedByTryStatement.d.ts +3 -0
- package/out/TSTransformer/util/isBlockedByTryStatement.js +17 -0
- package/out/TSTransformer/util/isMethod.d.ts +4 -0
- package/out/TSTransformer/util/isMethod.js +90 -0
- package/out/TSTransformer/util/isSymbolMutable.d.ts +3 -0
- package/out/TSTransformer/util/isSymbolMutable.js +24 -0
- package/out/TSTransformer/util/isSymbolOfValue.d.ts +2 -0
- package/out/TSTransformer/util/isSymbolOfValue.js +11 -0
- package/out/TSTransformer/util/isUsedAsStatement.d.ts +2 -0
- package/out/TSTransformer/util/isUsedAsStatement.js +23 -0
- package/out/TSTransformer/util/isValidMethodIndexWithoutCall.d.ts +3 -0
- package/out/TSTransformer/util/isValidMethodIndexWithoutCall.js +31 -0
- package/out/TSTransformer/util/offset.d.ts +2 -0
- package/out/TSTransformer/util/offset.js +44 -0
- package/out/TSTransformer/util/pointer.d.ts +13 -0
- package/out/TSTransformer/util/pointer.js +46 -0
- package/out/TSTransformer/util/spreadDestructuring/index.d.ts +9 -0
- package/out/TSTransformer/util/spreadDestructuring/index.js +45 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureArray.d.ts +3 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureArray.js +17 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureGenerator.d.ts +3 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureGenerator.js +33 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureMap.d.ts +3 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureMap.js +34 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureObject.d.ts +3 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureObject.js +41 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureSet.d.ts +3 -0
- package/out/TSTransformer/util/spreadDestructuring/spreadDestructureSet.js +28 -0
- package/out/TSTransformer/util/traversal.d.ts +7 -0
- package/out/TSTransformer/util/traversal.js +57 -0
- package/out/TSTransformer/util/types.d.ts +31 -0
- package/out/TSTransformer/util/types.js +259 -0
- package/out/TSTransformer/util/validateIdentifier.d.ts +3 -0
- package/out/TSTransformer/util/validateIdentifier.js +18 -0
- package/out/TSTransformer/util/validateMethodAssignment.d.ts +3 -0
- package/out/TSTransformer/util/validateMethodAssignment.js +81 -0
- package/out/TSTransformer/util/validateNotAny.d.ts +3 -0
- package/out/TSTransformer/util/validateNotAny.js +37 -0
- package/out/TSTransformer/util/valueToIdStr.d.ts +2 -0
- package/out/TSTransformer/util/valueToIdStr.js +29 -0
- package/out/TSTransformer/util/wrapExpressionStatement.d.ts +2 -0
- package/out/TSTransformer/util/wrapExpressionStatement.js +22 -0
- package/out/TSTransformer/util/wrapReturnIfLuaTuple.d.ts +4 -0
- package/out/TSTransformer/util/wrapReturnIfLuaTuple.js +56 -0
- package/out/TSTransformer/util/wrapStatementsAsGenerator.d.ts +4 -0
- package/out/TSTransformer/util/wrapStatementsAsGenerator.js +19 -0
- package/package.json +72 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.TransformState = void 0;
|
|
30
|
+
const luau_ast_1 = __importStar(require("@roblox-ts/luau-ast"));
|
|
31
|
+
const rojo_resolver_1 = require("@roblox-ts/rojo-resolver");
|
|
32
|
+
const path_1 = __importDefault(require("path"));
|
|
33
|
+
const constants_1 = require("../../Shared/constants");
|
|
34
|
+
const diagnostics_1 = require("../../Shared/diagnostics");
|
|
35
|
+
const assert_1 = require("../../Shared/util/assert");
|
|
36
|
+
const getCanonicalFileName_1 = require("../../Shared/util/getCanonicalFileName");
|
|
37
|
+
const getOrSetDefault_1 = require("../../Shared/util/getOrSetDefault");
|
|
38
|
+
const DiagnosticService_1 = require("./DiagnosticService");
|
|
39
|
+
const createGetService_1 = require("../util/createGetService");
|
|
40
|
+
const expressionChain_1 = require("../util/expressionChain");
|
|
41
|
+
const traversal_1 = require("../util/traversal");
|
|
42
|
+
const valueToIdStr_1 = require("../util/valueToIdStr");
|
|
43
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
44
|
+
class TransformState {
|
|
45
|
+
debugRender(node) {
|
|
46
|
+
const state = new luau_ast_1.RenderState();
|
|
47
|
+
(0, luau_ast_1.solveTempIds)(state, node);
|
|
48
|
+
return (0, luau_ast_1.render)(state, node);
|
|
49
|
+
}
|
|
50
|
+
debugRenderList(list) {
|
|
51
|
+
const state = new luau_ast_1.RenderState();
|
|
52
|
+
(0, luau_ast_1.solveTempIds)(state, list);
|
|
53
|
+
return (0, luau_ast_1.renderStatements)(state, list);
|
|
54
|
+
}
|
|
55
|
+
constructor(program, data, services, pathTranslator, multiTransformState, compilerOptions, rojoResolver, pkgRojoResolvers, nodeModulesPathMapping, runtimeLibRbxPath, typeChecker, projectType, getProjectPathTranslator, sourceFile) {
|
|
56
|
+
this.program = program;
|
|
57
|
+
this.data = data;
|
|
58
|
+
this.services = services;
|
|
59
|
+
this.pathTranslator = pathTranslator;
|
|
60
|
+
this.multiTransformState = multiTransformState;
|
|
61
|
+
this.compilerOptions = compilerOptions;
|
|
62
|
+
this.rojoResolver = rojoResolver;
|
|
63
|
+
this.pkgRojoResolvers = pkgRojoResolvers;
|
|
64
|
+
this.nodeModulesPathMapping = nodeModulesPathMapping;
|
|
65
|
+
this.runtimeLibRbxPath = runtimeLibRbxPath;
|
|
66
|
+
this.typeChecker = typeChecker;
|
|
67
|
+
this.projectType = projectType;
|
|
68
|
+
this.getProjectPathTranslator = getProjectPathTranslator;
|
|
69
|
+
this.hasExportEquals = false;
|
|
70
|
+
this.hasExportFrom = false;
|
|
71
|
+
this.classIdentifierMap = new Map();
|
|
72
|
+
this.tryUsesStack = new Array();
|
|
73
|
+
this.prereqStatementsStack = new Array();
|
|
74
|
+
this.hoistsByStatement = new Map();
|
|
75
|
+
this.isHoisted = new Map();
|
|
76
|
+
this.getTypeCache = new Map();
|
|
77
|
+
this.usesRuntimeLib = false;
|
|
78
|
+
this.moduleIdBySymbol = new Map();
|
|
79
|
+
this.symbolToIdMap = new Map();
|
|
80
|
+
this.classElementToObjectKeyMap = new Map();
|
|
81
|
+
this.sourceFileText = sourceFile.getFullText();
|
|
82
|
+
this.resolver = typeChecker.getEmitResolver(sourceFile);
|
|
83
|
+
const sourceOutPath = this.getProjectPathTranslator(this.data.tsConfigPath).getOutputPath(sourceFile.fileName);
|
|
84
|
+
const rbxPath = this.rojoResolver.getRbxPathFromFilePath(sourceOutPath);
|
|
85
|
+
this.isInReplicatedFirst = rbxPath !== undefined && rbxPath[0] === "ReplicatedFirst";
|
|
86
|
+
}
|
|
87
|
+
pushTryUsesStack() {
|
|
88
|
+
const tryUses = {
|
|
89
|
+
usesReturn: false,
|
|
90
|
+
usesBreak: false,
|
|
91
|
+
usesContinue: false,
|
|
92
|
+
};
|
|
93
|
+
this.tryUsesStack.push(tryUses);
|
|
94
|
+
return tryUses;
|
|
95
|
+
}
|
|
96
|
+
markTryUses(property) {
|
|
97
|
+
if (this.tryUsesStack.length !== 0) {
|
|
98
|
+
this.tryUsesStack[this.tryUsesStack.length - 1][property] = true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
popTryUsesStack() {
|
|
102
|
+
this.tryUsesStack.pop();
|
|
103
|
+
}
|
|
104
|
+
prereq(statement) {
|
|
105
|
+
luau_ast_1.default.list.push(this.prereqStatementsStack[this.prereqStatementsStack.length - 1], statement);
|
|
106
|
+
}
|
|
107
|
+
prereqList(statements) {
|
|
108
|
+
luau_ast_1.default.list.pushList(this.prereqStatementsStack[this.prereqStatementsStack.length - 1], statements);
|
|
109
|
+
}
|
|
110
|
+
pushPrereqStatementsStack() {
|
|
111
|
+
const prereqStatements = luau_ast_1.default.list.make();
|
|
112
|
+
this.prereqStatementsStack.push(prereqStatements);
|
|
113
|
+
return prereqStatements;
|
|
114
|
+
}
|
|
115
|
+
popPrereqStatementsStack() {
|
|
116
|
+
const poppedValue = this.prereqStatementsStack.pop();
|
|
117
|
+
(0, assert_1.assert)(poppedValue);
|
|
118
|
+
return poppedValue;
|
|
119
|
+
}
|
|
120
|
+
getLeadingComments(node) {
|
|
121
|
+
var _a;
|
|
122
|
+
const commentRanges = (_a = typescript_1.default.getLeadingCommentRanges(this.sourceFileText, node.pos)) !== null && _a !== void 0 ? _a : [];
|
|
123
|
+
return luau_ast_1.default.list.make(...commentRanges.map(commentRange => luau_ast_1.default.comment(this.sourceFileText.substring(commentRange.pos + 2, commentRange.kind === typescript_1.default.SyntaxKind.SingleLineCommentTrivia
|
|
124
|
+
? commentRange.end
|
|
125
|
+
: commentRange.end - 2))));
|
|
126
|
+
}
|
|
127
|
+
capturePrereqs(callback) {
|
|
128
|
+
this.pushPrereqStatementsStack();
|
|
129
|
+
callback();
|
|
130
|
+
return this.popPrereqStatementsStack();
|
|
131
|
+
}
|
|
132
|
+
capture(callback) {
|
|
133
|
+
let value;
|
|
134
|
+
const prereqs = this.capturePrereqs(() => (value = callback()));
|
|
135
|
+
return [value, prereqs];
|
|
136
|
+
}
|
|
137
|
+
noPrereqs(callback) {
|
|
138
|
+
let expression;
|
|
139
|
+
const statements = this.capturePrereqs(() => (expression = callback()));
|
|
140
|
+
(0, assert_1.assert)(luau_ast_1.default.list.isEmpty(statements));
|
|
141
|
+
return expression;
|
|
142
|
+
}
|
|
143
|
+
getType(node) {
|
|
144
|
+
return (0, getOrSetDefault_1.getOrSetDefault)(this.getTypeCache, node, () => this.typeChecker.getTypeAtLocation((0, traversal_1.skipUpwards)(node)));
|
|
145
|
+
}
|
|
146
|
+
TS(node, name) {
|
|
147
|
+
this.usesRuntimeLib = true;
|
|
148
|
+
if (this.projectType === constants_1.ProjectType.Game && this.isInReplicatedFirst) {
|
|
149
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.warnings.runtimeLibUsedInReplicatedFirst(node));
|
|
150
|
+
}
|
|
151
|
+
return luau_ast_1.default.property(luau_ast_1.default.globals.TS, name);
|
|
152
|
+
}
|
|
153
|
+
createRuntimeLibImport(sourceFile) {
|
|
154
|
+
if (this.runtimeLibRbxPath) {
|
|
155
|
+
if (this.projectType === constants_1.ProjectType.Game) {
|
|
156
|
+
const serviceName = this.runtimeLibRbxPath[0];
|
|
157
|
+
(0, assert_1.assert)(serviceName);
|
|
158
|
+
let expression = (0, createGetService_1.createGetService)(serviceName);
|
|
159
|
+
for (let i = 1; i < this.runtimeLibRbxPath.length; i++) {
|
|
160
|
+
expression = luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.MethodCallExpression, {
|
|
161
|
+
expression,
|
|
162
|
+
name: "WaitForChild",
|
|
163
|
+
args: luau_ast_1.default.list.make(luau_ast_1.default.string(this.runtimeLibRbxPath[i])),
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
expression = luau_ast_1.default.call(luau_ast_1.default.globals.require, [expression]);
|
|
167
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
168
|
+
left: luau_ast_1.default.globals.TS,
|
|
169
|
+
right: expression,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
const sourceOutPath = this.pathTranslator.getOutputPath(sourceFile.fileName);
|
|
174
|
+
const rbxPath = this.rojoResolver.getRbxPathFromFilePath(sourceOutPath);
|
|
175
|
+
if (!rbxPath) {
|
|
176
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noRojoData(sourceFile, path_1.default.relative(this.data.projectPath, sourceOutPath), false));
|
|
177
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
178
|
+
left: luau_ast_1.default.globals.TS,
|
|
179
|
+
right: luau_ast_1.default.none(),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
183
|
+
left: luau_ast_1.default.globals.TS,
|
|
184
|
+
right: luau_ast_1.default.call(luau_ast_1.default.globals.require, [
|
|
185
|
+
(0, expressionChain_1.propertyAccessExpressionChain)(luau_ast_1.default.globals.script, rojo_resolver_1.RojoResolver.relative(rbxPath, this.runtimeLibRbxPath).map(v => v === rojo_resolver_1.RbxPathParent ? constants_1.PARENT_FIELD : v)),
|
|
186
|
+
]),
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
return luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
192
|
+
left: luau_ast_1.default.globals.TS,
|
|
193
|
+
right: luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
194
|
+
expression: luau_ast_1.default.globals._G,
|
|
195
|
+
index: luau_ast_1.default.globals.script,
|
|
196
|
+
}),
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
pushToVar(expression, name) {
|
|
201
|
+
const temp = luau_ast_1.default.tempId(name || (expression && (0, valueToIdStr_1.valueToIdStr)(expression)));
|
|
202
|
+
this.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.VariableDeclaration, {
|
|
203
|
+
left: temp,
|
|
204
|
+
right: expression,
|
|
205
|
+
}));
|
|
206
|
+
return temp;
|
|
207
|
+
}
|
|
208
|
+
pushToVarIfComplex(expression, name) {
|
|
209
|
+
if (luau_ast_1.default.isSimple(expression)) {
|
|
210
|
+
return expression;
|
|
211
|
+
}
|
|
212
|
+
return this.pushToVar(expression, name);
|
|
213
|
+
}
|
|
214
|
+
pushToVarIfNonId(expression, name) {
|
|
215
|
+
if (luau_ast_1.default.isAnyIdentifier(expression)) {
|
|
216
|
+
return expression;
|
|
217
|
+
}
|
|
218
|
+
return this.pushToVar(expression, name);
|
|
219
|
+
}
|
|
220
|
+
getModuleExports(moduleSymbol) {
|
|
221
|
+
return (0, getOrSetDefault_1.getOrSetDefault)(this.multiTransformState.getModuleExportsCache, moduleSymbol, () => this.typeChecker.getExportsOfModule(moduleSymbol));
|
|
222
|
+
}
|
|
223
|
+
getModuleExportsAliasMap(moduleSymbol) {
|
|
224
|
+
return (0, getOrSetDefault_1.getOrSetDefault)(this.multiTransformState.getModuleExportsAliasMapCache, moduleSymbol, () => {
|
|
225
|
+
var _a;
|
|
226
|
+
const aliasMap = new Map();
|
|
227
|
+
for (const exportSymbol of this.getModuleExports(moduleSymbol)) {
|
|
228
|
+
const originalSymbol = typescript_1.default.skipAlias(exportSymbol, this.typeChecker);
|
|
229
|
+
const declaration = (_a = exportSymbol.getDeclarations()) === null || _a === void 0 ? void 0 : _a[0];
|
|
230
|
+
if (declaration && typescript_1.default.isExportSpecifier(declaration)) {
|
|
231
|
+
aliasMap.set(originalSymbol, declaration.name.text);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
aliasMap.set(originalSymbol, exportSymbol.name);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return aliasMap;
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
getModuleSymbolFromNode(node) {
|
|
241
|
+
const moduleAncestor = (0, traversal_1.getModuleAncestor)(node);
|
|
242
|
+
const exportSymbol = this.typeChecker.getSymbolAtLocation(typescript_1.default.isSourceFile(moduleAncestor) ? moduleAncestor : moduleAncestor.name);
|
|
243
|
+
(0, assert_1.assert)(exportSymbol);
|
|
244
|
+
return exportSymbol;
|
|
245
|
+
}
|
|
246
|
+
getModuleIdFromSymbol(moduleSymbol) {
|
|
247
|
+
const moduleId = this.moduleIdBySymbol.get(moduleSymbol);
|
|
248
|
+
(0, assert_1.assert)(moduleId);
|
|
249
|
+
return moduleId;
|
|
250
|
+
}
|
|
251
|
+
setModuleIdBySymbol(moduleSymbol, moduleId) {
|
|
252
|
+
this.moduleIdBySymbol.set(moduleSymbol, moduleId);
|
|
253
|
+
}
|
|
254
|
+
getModuleIdFromNode(node) {
|
|
255
|
+
const moduleSymbol = this.getModuleSymbolFromNode(node);
|
|
256
|
+
return this.getModuleIdFromSymbol(moduleSymbol);
|
|
257
|
+
}
|
|
258
|
+
getModuleIdPropertyAccess(idSymbol) {
|
|
259
|
+
if (idSymbol.valueDeclaration) {
|
|
260
|
+
const moduleSymbol = this.getModuleSymbolFromNode(idSymbol.valueDeclaration);
|
|
261
|
+
const alias = this.getModuleExportsAliasMap(moduleSymbol).get(idSymbol);
|
|
262
|
+
if (alias) {
|
|
263
|
+
return luau_ast_1.default.property(this.getModuleIdFromSymbol(moduleSymbol), alias);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
guessVirtualPath(fsPath) {
|
|
268
|
+
var _a, _b, _c;
|
|
269
|
+
const reverseSymlinkMap = (_b = (_a = this.program).getSymlinkCache) === null || _b === void 0 ? void 0 : _b.call(_a).getSymlinkedDirectoriesByRealpath();
|
|
270
|
+
if (!reverseSymlinkMap)
|
|
271
|
+
return;
|
|
272
|
+
const original = fsPath;
|
|
273
|
+
while (true) {
|
|
274
|
+
const parent = typescript_1.default.ensureTrailingDirectorySeparator(path_1.default.dirname(fsPath));
|
|
275
|
+
if (fsPath === parent)
|
|
276
|
+
break;
|
|
277
|
+
fsPath = parent;
|
|
278
|
+
const symlink = (_c = reverseSymlinkMap.get(typescript_1.default.toPath(fsPath, this.program.getCurrentDirectory(), getCanonicalFileName_1.getCanonicalFileName))) === null || _c === void 0 ? void 0 : _c[0];
|
|
279
|
+
if (symlink) {
|
|
280
|
+
return path_1.default.join(symlink, path_1.default.relative(fsPath, original));
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
setClassElementObjectKey(classElement, identifier) {
|
|
285
|
+
(0, assert_1.assert)(!this.classElementToObjectKeyMap.has(classElement));
|
|
286
|
+
this.classElementToObjectKeyMap.set(classElement, identifier);
|
|
287
|
+
}
|
|
288
|
+
getClassElementObjectKey(classElement) {
|
|
289
|
+
return this.classElementToObjectKeyMap.get(classElement);
|
|
290
|
+
}
|
|
291
|
+
getPathTranslatorForFile(filePath) {
|
|
292
|
+
const normalizedFilePath = path_1.default.normalize(filePath);
|
|
293
|
+
for (const project of this.data.referencedProjects) {
|
|
294
|
+
const normalizedRootDir = path_1.default.normalize(project.rootDir);
|
|
295
|
+
const normalizedOutDir = path_1.default.normalize(project.outDir);
|
|
296
|
+
if (normalizedFilePath.startsWith(normalizedRootDir + path_1.default.sep) ||
|
|
297
|
+
normalizedFilePath === normalizedRootDir ||
|
|
298
|
+
normalizedFilePath.startsWith(normalizedOutDir + path_1.default.sep) ||
|
|
299
|
+
normalizedFilePath === normalizedOutDir) {
|
|
300
|
+
return this.getProjectPathTranslator(project.tsConfigPath);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return this.pathTranslator;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
exports.TransformState = TransformState;
|
|
307
|
+
//# sourceMappingURL=TransformState.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.transformSourceFile = void 0;
|
|
18
|
+
__exportStar(require("./classes/MacroManager"), exports);
|
|
19
|
+
__exportStar(require("./classes/MultiTransformState"), exports);
|
|
20
|
+
__exportStar(require("./classes/TransformState"), exports);
|
|
21
|
+
var transformSourceFile_1 = require("./nodes/transformSourceFile");
|
|
22
|
+
Object.defineProperty(exports, "transformSourceFile", { enumerable: true, get: function () { return transformSourceFile_1.transformSourceFile; } });
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,56 @@
|
|
|
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.CALL_MACROS = void 0;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const diagnostics_1 = require("../../Shared/diagnostics");
|
|
9
|
+
const DiagnosticService_1 = require("../classes/DiagnosticService");
|
|
10
|
+
const convertToIndexableExpression_1 = require("../util/convertToIndexableExpression");
|
|
11
|
+
const createImportExpression_1 = require("../util/createImportExpression");
|
|
12
|
+
const createTruthinessChecks_1 = require("../util/createTruthinessChecks");
|
|
13
|
+
const PRIMITIVE_LUAU_TYPES = new Set([
|
|
14
|
+
"nil",
|
|
15
|
+
"boolean",
|
|
16
|
+
"string",
|
|
17
|
+
"number",
|
|
18
|
+
"table",
|
|
19
|
+
"userdata",
|
|
20
|
+
"function",
|
|
21
|
+
"thread",
|
|
22
|
+
"vector",
|
|
23
|
+
"buffer",
|
|
24
|
+
]);
|
|
25
|
+
exports.CALL_MACROS = {
|
|
26
|
+
assert: (state, node, expression, args) => {
|
|
27
|
+
args[0] = (0, createTruthinessChecks_1.createTruthinessChecks)(state, args[0], node.arguments[0]);
|
|
28
|
+
return luau_ast_1.default.call(luau_ast_1.default.globals.assert, args);
|
|
29
|
+
},
|
|
30
|
+
typeOf: (state, node, expression, args) => luau_ast_1.default.call(luau_ast_1.default.globals.typeof, args),
|
|
31
|
+
typeIs: (state, node, expression, args) => {
|
|
32
|
+
const [value, typeStr] = args;
|
|
33
|
+
const typeFunc = luau_ast_1.default.isStringLiteral(typeStr) && PRIMITIVE_LUAU_TYPES.has(typeStr.value)
|
|
34
|
+
? luau_ast_1.default.globals.type
|
|
35
|
+
: luau_ast_1.default.globals.typeof;
|
|
36
|
+
return luau_ast_1.default.binary(luau_ast_1.default.call(typeFunc, [value]), "==", typeStr);
|
|
37
|
+
},
|
|
38
|
+
classIs: (state, node, expression, args) => {
|
|
39
|
+
const [value, typeStr] = args;
|
|
40
|
+
return luau_ast_1.default.binary(luau_ast_1.default.property((0, convertToIndexableExpression_1.convertToIndexableExpression)(value), "ClassName"), "==", typeStr);
|
|
41
|
+
},
|
|
42
|
+
identity: (state, node, expression, args) => args[0],
|
|
43
|
+
$range: (state, node) => {
|
|
44
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noRangeMacroOutsideForOf(node.expression));
|
|
45
|
+
return luau_ast_1.default.none();
|
|
46
|
+
},
|
|
47
|
+
$tuple: (state, node) => {
|
|
48
|
+
DiagnosticService_1.DiagnosticService.addDiagnostic(diagnostics_1.errors.noTupleMacroOutsideReturn(node));
|
|
49
|
+
return luau_ast_1.default.none();
|
|
50
|
+
},
|
|
51
|
+
$getModuleTree: (state, node) => {
|
|
52
|
+
const parts = (0, createImportExpression_1.getImportParts)(state, node.getSourceFile(), node.arguments[0]);
|
|
53
|
+
return luau_ast_1.default.array([parts.shift(), luau_ast_1.default.array(parts)]);
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=callMacros.js.map
|
|
@@ -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.CONSTRUCTOR_MACROS = void 0;
|
|
7
|
+
const luau_ast_1 = __importDefault(require("@roblox-ts/luau-ast"));
|
|
8
|
+
const assert_1 = require("../../Shared/util/assert");
|
|
9
|
+
const transformExpression_1 = require("../nodes/expressions/transformExpression");
|
|
10
|
+
const ensureTransformOrder_1 = require("../util/ensureTransformOrder");
|
|
11
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
12
|
+
function wrapWeak(state, node, macro) {
|
|
13
|
+
return luau_ast_1.default.call(luau_ast_1.default.globals.setmetatable, [
|
|
14
|
+
macro(state, node),
|
|
15
|
+
luau_ast_1.default.map([[luau_ast_1.default.strings.__mode, luau_ast_1.default.strings.k]]),
|
|
16
|
+
]);
|
|
17
|
+
}
|
|
18
|
+
const ArrayConstructor = (state, node) => {
|
|
19
|
+
if (node.arguments && node.arguments.length > 0) {
|
|
20
|
+
const args = (0, ensureTransformOrder_1.ensureTransformOrder)(state, node.arguments);
|
|
21
|
+
return luau_ast_1.default.call(luau_ast_1.default.globals.table.create, args);
|
|
22
|
+
}
|
|
23
|
+
return luau_ast_1.default.array();
|
|
24
|
+
};
|
|
25
|
+
const SetConstructor = (state, node) => {
|
|
26
|
+
if (!node.arguments || node.arguments.length === 0) {
|
|
27
|
+
return luau_ast_1.default.set();
|
|
28
|
+
}
|
|
29
|
+
const arg = node.arguments[0];
|
|
30
|
+
if (typescript_1.default.isArrayLiteralExpression(arg) && !arg.elements.some(typescript_1.default.isSpreadElement)) {
|
|
31
|
+
return luau_ast_1.default.set((0, ensureTransformOrder_1.ensureTransformOrder)(state, arg.elements));
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
const id = state.pushToVar(luau_ast_1.default.set(), "set");
|
|
35
|
+
const valueId = luau_ast_1.default.tempId("v");
|
|
36
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ForStatement, {
|
|
37
|
+
ids: luau_ast_1.default.list.make(luau_ast_1.default.tempId(), valueId),
|
|
38
|
+
expression: (0, transformExpression_1.transformExpression)(state, arg),
|
|
39
|
+
statements: luau_ast_1.default.list.make(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
40
|
+
left: luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
41
|
+
expression: id,
|
|
42
|
+
index: valueId,
|
|
43
|
+
}),
|
|
44
|
+
operator: "=",
|
|
45
|
+
right: luau_ast_1.default.bool(true),
|
|
46
|
+
})),
|
|
47
|
+
}));
|
|
48
|
+
return id;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const MapConstructor = (state, node) => {
|
|
52
|
+
if (!node.arguments || node.arguments.length === 0) {
|
|
53
|
+
return luau_ast_1.default.map();
|
|
54
|
+
}
|
|
55
|
+
const arg = node.arguments[0];
|
|
56
|
+
const transformed = (0, transformExpression_1.transformExpression)(state, arg);
|
|
57
|
+
if (luau_ast_1.default.isArray(transformed) && luau_ast_1.default.list.every(transformed.members, member => luau_ast_1.default.isArray(member))) {
|
|
58
|
+
const elements = luau_ast_1.default.list.toArray(transformed.members).map(e => {
|
|
59
|
+
(0, assert_1.assert)(luau_ast_1.default.isArray(e) && luau_ast_1.default.list.isNonEmpty(e.members));
|
|
60
|
+
return [e.members.head.value, e.members.head.next.value];
|
|
61
|
+
});
|
|
62
|
+
return luau_ast_1.default.map(elements);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
const id = state.pushToVar(luau_ast_1.default.map(), "map");
|
|
66
|
+
const valueId = luau_ast_1.default.tempId("v");
|
|
67
|
+
state.prereq(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ForStatement, {
|
|
68
|
+
ids: luau_ast_1.default.list.make(luau_ast_1.default.tempId(), valueId),
|
|
69
|
+
expression: transformed,
|
|
70
|
+
statements: luau_ast_1.default.list.make(luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.Assignment, {
|
|
71
|
+
left: luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
72
|
+
expression: id,
|
|
73
|
+
index: luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
74
|
+
expression: valueId,
|
|
75
|
+
index: luau_ast_1.default.number(1),
|
|
76
|
+
}),
|
|
77
|
+
}),
|
|
78
|
+
operator: "=",
|
|
79
|
+
right: luau_ast_1.default.create(luau_ast_1.default.SyntaxKind.ComputedIndexExpression, {
|
|
80
|
+
expression: valueId,
|
|
81
|
+
index: luau_ast_1.default.number(2),
|
|
82
|
+
}),
|
|
83
|
+
})),
|
|
84
|
+
}));
|
|
85
|
+
return id;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
exports.CONSTRUCTOR_MACROS = {
|
|
89
|
+
ArrayConstructor,
|
|
90
|
+
SetConstructor,
|
|
91
|
+
MapConstructor,
|
|
92
|
+
WeakSetConstructor: (state, node) => wrapWeak(state, node, SetConstructor),
|
|
93
|
+
WeakMapConstructor: (state, node) => wrapWeak(state, node, MapConstructor),
|
|
94
|
+
ReadonlyMapConstructor: MapConstructor,
|
|
95
|
+
ReadonlySetConstructor: SetConstructor,
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=constructorMacros.js.map
|