@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,160 @@
|
|
|
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.compileFiles = compileFiles;
|
|
7
|
+
const luau_ast_1 = require("@roblox-ts/luau-ast");
|
|
8
|
+
const rojo_resolver_1 = require("@roblox-ts/rojo-resolver");
|
|
9
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const checkFileName_1 = require("./checkFileName");
|
|
12
|
+
const checkRojoConfig_1 = require("./checkRojoConfig");
|
|
13
|
+
const createNodeModulesPathMapping_1 = require("./createNodeModulesPathMapping");
|
|
14
|
+
const transformPaths_1 = __importDefault(require("../transformers/builtin/transformPaths"));
|
|
15
|
+
const transformTypeReferenceDirectives_1 = require("../transformers/builtin/transformTypeReferenceDirectives");
|
|
16
|
+
const createTransformerList_1 = require("../transformers/createTransformerList");
|
|
17
|
+
const createTransformerWatcher_1 = require("../transformers/createTransformerWatcher");
|
|
18
|
+
const getPluginConfigs_1 = require("../transformers/getPluginConfigs");
|
|
19
|
+
const getCustomPreEmitDiagnostics_1 = require("../util/getCustomPreEmitDiagnostics");
|
|
20
|
+
const LogService_1 = require("../../Shared/classes/LogService");
|
|
21
|
+
const constants_1 = require("../../Shared/constants");
|
|
22
|
+
const assert_1 = require("../../Shared/util/assert");
|
|
23
|
+
const benchmark_1 = require("../../Shared/util/benchmark");
|
|
24
|
+
const createTextDiagnostic_1 = require("../../Shared/util/createTextDiagnostic");
|
|
25
|
+
const getRootDirs_1 = require("../../Shared/util/getRootDirs");
|
|
26
|
+
const TSTransformer_1 = require("../../TSTransformer");
|
|
27
|
+
const DiagnosticService_1 = require("../../TSTransformer/classes/DiagnosticService");
|
|
28
|
+
const createTransformServices_1 = require("../../TSTransformer/util/createTransformServices");
|
|
29
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
30
|
+
function inferProjectType(data, rojoResolver) {
|
|
31
|
+
if (data.isPackage) {
|
|
32
|
+
return constants_1.ProjectType.Package;
|
|
33
|
+
}
|
|
34
|
+
else if (rojoResolver.isGame) {
|
|
35
|
+
return constants_1.ProjectType.Game;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return constants_1.ProjectType.Model;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function emitResultFailure(messageText) {
|
|
42
|
+
return {
|
|
43
|
+
emitSkipped: true,
|
|
44
|
+
diagnostics: [(0, createTextDiagnostic_1.createTextDiagnostic)(messageText)],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function compileFiles(program, data, pathTranslator, getProjectPathTranslator, sourceFiles) {
|
|
48
|
+
var _a;
|
|
49
|
+
const compilerOptions = program.getCompilerOptions();
|
|
50
|
+
const multiTransformState = new TSTransformer_1.MultiTransformState();
|
|
51
|
+
const outDir = compilerOptions.outDir;
|
|
52
|
+
const rojoResolver = data.rojoConfigPath
|
|
53
|
+
? rojo_resolver_1.RojoResolver.fromPath(data.rojoConfigPath)
|
|
54
|
+
: rojo_resolver_1.RojoResolver.synthetic(outDir);
|
|
55
|
+
for (const warning of rojoResolver.getWarnings()) {
|
|
56
|
+
LogService_1.LogService.warn(warning);
|
|
57
|
+
}
|
|
58
|
+
(0, checkRojoConfig_1.checkRojoConfig)(data, rojoResolver, (0, getRootDirs_1.getRootDirs)(compilerOptions), pathTranslator);
|
|
59
|
+
for (const sourceFile of program.getSourceFiles()) {
|
|
60
|
+
if (!path_1.default.normalize(sourceFile.fileName).startsWith(data.nodeModulesPath)) {
|
|
61
|
+
(0, checkFileName_1.checkFileName)(sourceFile.fileName);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const pkgRojoResolvers = compilerOptions.typeRoots.map(rojo_resolver_1.RojoResolver.synthetic);
|
|
65
|
+
const nodeModulesPathMapping = (0, createNodeModulesPathMapping_1.createNodeModulesPathMapping)(compilerOptions.typeRoots);
|
|
66
|
+
const projectType = (_a = data.projectOptions.type) !== null && _a !== void 0 ? _a : inferProjectType(data, rojoResolver);
|
|
67
|
+
if (projectType !== constants_1.ProjectType.Package && data.rojoConfigPath === undefined) {
|
|
68
|
+
return emitResultFailure("Non-package projects must have a Rojo project file!");
|
|
69
|
+
}
|
|
70
|
+
let runtimeLibRbxPath;
|
|
71
|
+
if (projectType !== constants_1.ProjectType.Package) {
|
|
72
|
+
runtimeLibRbxPath = rojoResolver.getRbxPathFromFilePath(path_1.default.join(data.projectOptions.includePath, "RuntimeLib.lua"));
|
|
73
|
+
if (!runtimeLibRbxPath) {
|
|
74
|
+
return emitResultFailure("Rojo project contained no data for include folder!");
|
|
75
|
+
}
|
|
76
|
+
else if (rojoResolver.getNetworkType(runtimeLibRbxPath) !== rojo_resolver_1.NetworkType.Unknown) {
|
|
77
|
+
return emitResultFailure("Runtime library cannot be in a server-only or client-only container!");
|
|
78
|
+
}
|
|
79
|
+
else if (rojoResolver.isIsolated(runtimeLibRbxPath)) {
|
|
80
|
+
return emitResultFailure("Runtime library cannot be in an isolated container!");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (DiagnosticService_1.DiagnosticService.hasErrors())
|
|
84
|
+
return { emitSkipped: true, diagnostics: DiagnosticService_1.DiagnosticService.flush() };
|
|
85
|
+
LogService_1.LogService.writeLineIfVerbose(`compiling as ${projectType}..`);
|
|
86
|
+
const fileWriteQueue = new Array();
|
|
87
|
+
const progressMaxLength = `${sourceFiles.length}/${sourceFiles.length}`.length;
|
|
88
|
+
let proxyProgram = program;
|
|
89
|
+
if (compilerOptions.plugins && compilerOptions.plugins.length > 0) {
|
|
90
|
+
(0, benchmark_1.benchmarkIfVerbose)(`running transformers..`, () => {
|
|
91
|
+
var _a;
|
|
92
|
+
const pluginConfigs = (0, getPluginConfigs_1.getPluginConfigs)(data.tsConfigPath);
|
|
93
|
+
const transformerList = (0, createTransformerList_1.createTransformerList)(program, pluginConfigs, data.projectPath);
|
|
94
|
+
const transformers = (0, createTransformerList_1.flattenIntoTransformers)(transformerList);
|
|
95
|
+
if (transformers.length > 0) {
|
|
96
|
+
const { service, updateFile } = ((_a = data.transformerWatcher) !== null && _a !== void 0 ? _a : (data.transformerWatcher = (0, createTransformerWatcher_1.createTransformerWatcher)(program)));
|
|
97
|
+
const transformResult = typescript_1.default.transformNodes(undefined, undefined, typescript_1.default.factory, compilerOptions, sourceFiles, transformers, false);
|
|
98
|
+
if (transformResult.diagnostics)
|
|
99
|
+
DiagnosticService_1.DiagnosticService.addDiagnostics(transformResult.diagnostics);
|
|
100
|
+
for (const sourceFile of transformResult.transformed) {
|
|
101
|
+
if (typescript_1.default.isSourceFile(sourceFile)) {
|
|
102
|
+
const source = typescript_1.default.createPrinter().printFile(sourceFile);
|
|
103
|
+
updateFile(sourceFile.fileName, source);
|
|
104
|
+
if (data.projectOptions.writeTransformedFiles) {
|
|
105
|
+
const outPath = pathTranslator.getOutputTransformedPath(sourceFile.fileName);
|
|
106
|
+
fs_extra_1.default.outputFileSync(outPath, source);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
proxyProgram = service.getProgram();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
if (DiagnosticService_1.DiagnosticService.hasErrors())
|
|
115
|
+
return { emitSkipped: true, diagnostics: DiagnosticService_1.DiagnosticService.flush() };
|
|
116
|
+
const typeChecker = proxyProgram.getTypeChecker();
|
|
117
|
+
const services = (0, createTransformServices_1.createTransformServices)(typeChecker);
|
|
118
|
+
for (let i = 0; i < sourceFiles.length; i++) {
|
|
119
|
+
const sourceFile = proxyProgram.getSourceFile(sourceFiles[i].fileName);
|
|
120
|
+
(0, assert_1.assert)(sourceFile);
|
|
121
|
+
const progress = `${i + 1}/${sourceFiles.length}`.padStart(progressMaxLength);
|
|
122
|
+
(0, benchmark_1.benchmarkIfVerbose)(`${progress} compile ${path_1.default.relative(process.cwd(), sourceFile.fileName)}`, () => {
|
|
123
|
+
DiagnosticService_1.DiagnosticService.addDiagnostics(typescript_1.default.getPreEmitDiagnostics(proxyProgram, sourceFile));
|
|
124
|
+
DiagnosticService_1.DiagnosticService.addDiagnostics((0, getCustomPreEmitDiagnostics_1.getCustomPreEmitDiagnostics)(data, sourceFile));
|
|
125
|
+
if (DiagnosticService_1.DiagnosticService.hasErrors())
|
|
126
|
+
return;
|
|
127
|
+
const transformState = new TSTransformer_1.TransformState(proxyProgram, data, services, pathTranslator, multiTransformState, compilerOptions, rojoResolver, pkgRojoResolvers, nodeModulesPathMapping, runtimeLibRbxPath, typeChecker, projectType, getProjectPathTranslator, sourceFile);
|
|
128
|
+
const luauAST = (0, TSTransformer_1.transformSourceFile)(transformState, sourceFile);
|
|
129
|
+
if (DiagnosticService_1.DiagnosticService.hasErrors())
|
|
130
|
+
return;
|
|
131
|
+
const source = (0, luau_ast_1.renderAST)(luauAST);
|
|
132
|
+
fileWriteQueue.push({ sourceFile, source });
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
if (DiagnosticService_1.DiagnosticService.hasErrors())
|
|
136
|
+
return { emitSkipped: true, diagnostics: DiagnosticService_1.DiagnosticService.flush() };
|
|
137
|
+
const emittedFiles = new Array();
|
|
138
|
+
if (fileWriteQueue.length > 0) {
|
|
139
|
+
(0, benchmark_1.benchmarkIfVerbose)("writing compiled files", () => {
|
|
140
|
+
const afterDeclarations = compilerOptions.declaration
|
|
141
|
+
? [transformTypeReferenceDirectives_1.transformTypeReferenceDirectives, (0, transformPaths_1.default)(program, {})]
|
|
142
|
+
: undefined;
|
|
143
|
+
for (const { sourceFile, source } of fileWriteQueue) {
|
|
144
|
+
const outPath = pathTranslator.getOutputPath(sourceFile.fileName);
|
|
145
|
+
if (!data.projectOptions.writeOnlyChanged ||
|
|
146
|
+
!fs_extra_1.default.pathExistsSync(outPath) ||
|
|
147
|
+
fs_extra_1.default.readFileSync(outPath).toString() !== source) {
|
|
148
|
+
fs_extra_1.default.outputFileSync(outPath, source);
|
|
149
|
+
emittedFiles.push(outPath);
|
|
150
|
+
}
|
|
151
|
+
if (compilerOptions.declaration) {
|
|
152
|
+
proxyProgram.emit(sourceFile, typescript_1.default.sys.writeFile, undefined, true, { afterDeclarations });
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
program.emitBuildInfo();
|
|
158
|
+
return { emittedFiles, emitSkipped: false, diagnostics: DiagnosticService_1.DiagnosticService.flush() };
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=compileFiles.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ProjectOptions, ReferencedProjectInfo } from "../../Shared/types";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
export interface CompileProjectOptions {
|
|
4
|
+
program: ts.Program;
|
|
5
|
+
configPath: string;
|
|
6
|
+
projectOptions: ProjectOptions;
|
|
7
|
+
rootConfigPath: string;
|
|
8
|
+
rootRojoConfigPath: string | undefined;
|
|
9
|
+
rootIncludePath: string;
|
|
10
|
+
referencedProjects: Array<ReferencedProjectInfo>;
|
|
11
|
+
isInitialCompile: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function compileProject(opts: CompileProjectOptions): ts.EmitResult;
|
|
14
|
+
export declare function collectReferencedProjects(refs: readonly (ts.ResolvedProjectReference | undefined)[], results: Array<ReferencedProjectInfo>, rootConfigPath: string, luau: boolean, visited?: Set<string>): void;
|
|
@@ -0,0 +1,71 @@
|
|
|
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.compileProject = compileProject;
|
|
7
|
+
exports.collectReferencedProjects = collectReferencedProjects;
|
|
8
|
+
const path_translator_1 = require("@roblox-ts/path-translator");
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const cleanup_1 = require("./cleanup");
|
|
11
|
+
const compileFiles_1 = require("./compileFiles");
|
|
12
|
+
const copyFiles_1 = require("./copyFiles");
|
|
13
|
+
const copyInclude_1 = require("./copyInclude");
|
|
14
|
+
const createProjectData_1 = require("./createProjectData");
|
|
15
|
+
const LogService_1 = require("../../Shared/classes/LogService");
|
|
16
|
+
const getRootDirs_1 = require("../../Shared/util/getRootDirs");
|
|
17
|
+
function compileProject(opts) {
|
|
18
|
+
const { program, configPath, projectOptions, rootConfigPath, rootRojoConfigPath, rootIncludePath, referencedProjects, isInitialCompile, } = opts;
|
|
19
|
+
const options = program.getCompilerOptions();
|
|
20
|
+
const normalizedConfigPath = path_1.default.normalize(configPath);
|
|
21
|
+
const isRoot = normalizedConfigPath === path_1.default.normalize(rootConfigPath);
|
|
22
|
+
LogService_1.LogService.writeLineIfVerbose(`Building: ${path_1.default.relative(process.cwd(), configPath)}`);
|
|
23
|
+
const currentProjectOptions = isRoot
|
|
24
|
+
? projectOptions
|
|
25
|
+
: { ...projectOptions, noInclude: true, rojo: rootRojoConfigPath };
|
|
26
|
+
const data = (0, createProjectData_1.createProjectData)(configPath, currentProjectOptions);
|
|
27
|
+
data.referencedProjects = referencedProjects;
|
|
28
|
+
if (!isRoot) {
|
|
29
|
+
data.rootProjectIncludePath = rootIncludePath;
|
|
30
|
+
}
|
|
31
|
+
const configDir = path_1.default.dirname(configPath);
|
|
32
|
+
const rootDir = options.rootDir ? path_1.default.resolve(configDir, options.rootDir) : configDir;
|
|
33
|
+
const outDir = options.outDir ? path_1.default.resolve(configDir, options.outDir) : configDir;
|
|
34
|
+
const pathTranslator = new path_translator_1.PathTranslator(rootDir, outDir, undefined, options.declaration === true, projectOptions.luau);
|
|
35
|
+
if (isRoot && isInitialCompile) {
|
|
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)(options)));
|
|
40
|
+
const sourceFiles = program
|
|
41
|
+
.getSourceFiles()
|
|
42
|
+
.filter(sf => !sf.isDeclarationFile &&
|
|
43
|
+
!sf.fileName.includes("node_modules") &&
|
|
44
|
+
path_1.default.normalize(sf.fileName).startsWith(rootDir));
|
|
45
|
+
return (0, compileFiles_1.compileFiles)(program, data, pathTranslator, sourceFiles);
|
|
46
|
+
}
|
|
47
|
+
function collectReferencedProjects(refs, results, rootConfigPath, luau, visited = new Set()) {
|
|
48
|
+
for (const ref of refs) {
|
|
49
|
+
if (!ref)
|
|
50
|
+
continue;
|
|
51
|
+
const configPath = path_1.default.normalize(ref.sourceFile.fileName);
|
|
52
|
+
if (visited.has(configPath) || configPath === path_1.default.normalize(rootConfigPath))
|
|
53
|
+
continue;
|
|
54
|
+
visited.add(configPath);
|
|
55
|
+
if (ref.references) {
|
|
56
|
+
collectReferencedProjects(ref.references, results, rootConfigPath, luau, visited);
|
|
57
|
+
}
|
|
58
|
+
const options = ref.commandLine.options;
|
|
59
|
+
const configDir = path_1.default.dirname(configPath);
|
|
60
|
+
const rootDir = options.rootDir ? path_1.default.resolve(configDir, options.rootDir) : configDir;
|
|
61
|
+
const outDir = options.outDir ? path_1.default.resolve(configDir, options.outDir) : configDir;
|
|
62
|
+
results.push({
|
|
63
|
+
tsConfigPath: configPath,
|
|
64
|
+
rootDir,
|
|
65
|
+
outDir,
|
|
66
|
+
pathTranslator: new path_translator_1.PathTranslator(rootDir, outDir, undefined, true, luau),
|
|
67
|
+
fileNames: ref.commandLine.fileNames,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=compileProject.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.copyFiles = copyFiles;
|
|
4
|
+
const copyItem_1 = require("./copyItem");
|
|
5
|
+
const benchmark_1 = require("../../Shared/util/benchmark");
|
|
6
|
+
function copyFiles(data, pathTranslator, sources) {
|
|
7
|
+
(0, benchmark_1.benchmarkIfVerbose)("copy non-compiled files", () => {
|
|
8
|
+
for (const source of sources) {
|
|
9
|
+
(0, copyItem_1.copyItem)(data, pathTranslator, source);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=copyFiles.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
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.copyInclude = copyInclude;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const constants_1 = require("../../Shared/constants");
|
|
9
|
+
const benchmark_1 = require("../../Shared/util/benchmark");
|
|
10
|
+
function copyInclude(data) {
|
|
11
|
+
if (!data.projectOptions.noInclude &&
|
|
12
|
+
data.projectOptions.type !== constants_1.ProjectType.Package &&
|
|
13
|
+
!(data.projectOptions.type === undefined && data.isPackage)) {
|
|
14
|
+
(0, benchmark_1.benchmarkIfVerbose)("copy include files", () => fs_extra_1.default.copySync(constants_1.INCLUDE_PATH, data.projectOptions.includePath, { dereference: true }));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=copyInclude.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
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.copyItem = copyItem;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const isCompilableFile_1 = require("../util/isCompilableFile");
|
|
9
|
+
const constants_1 = require("../../Shared/constants");
|
|
10
|
+
function copyItem(data, pathTranslator, item) {
|
|
11
|
+
fs_extra_1.default.copySync(item, pathTranslator.getOutputPath(item), {
|
|
12
|
+
filter: (src, dest) => {
|
|
13
|
+
if (data.projectOptions.writeOnlyChanged &&
|
|
14
|
+
fs_extra_1.default.pathExistsSync(dest) &&
|
|
15
|
+
!fs_extra_1.default.lstatSync(src).isDirectory() &&
|
|
16
|
+
fs_extra_1.default.readFileSync(src).toString() === fs_extra_1.default.readFileSync(dest).toString()) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if (src.endsWith(constants_1.DTS_EXT)) {
|
|
20
|
+
return pathTranslator.declaration;
|
|
21
|
+
}
|
|
22
|
+
return !(0, isCompilableFile_1.isCompilableFile)(src);
|
|
23
|
+
},
|
|
24
|
+
dereference: true,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=copyItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createNodeModulesPathMapping(typeRoots: Array<string>): Map<string, string>;
|
|
@@ -0,0 +1,31 @@
|
|
|
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.createNodeModulesPathMapping = createNodeModulesPathMapping;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const getCanonicalFileName_1 = require("../../Shared/util/getCanonicalFileName");
|
|
10
|
+
const realPathExistsSync_1 = require("../../Shared/util/realPathExistsSync");
|
|
11
|
+
function createNodeModulesPathMapping(typeRoots) {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const nodeModulesPathMapping = new Map();
|
|
14
|
+
for (const scopePath of typeRoots) {
|
|
15
|
+
if (fs_extra_1.default.pathExistsSync(scopePath)) {
|
|
16
|
+
for (const pkgName of fs_extra_1.default.readdirSync(scopePath)) {
|
|
17
|
+
const pkgPath = path_1.default.join(scopePath, pkgName);
|
|
18
|
+
const pkgJsonPath = (0, realPathExistsSync_1.realPathExistsSync)(path_1.default.join(pkgPath, "package.json"));
|
|
19
|
+
if (pkgJsonPath !== undefined) {
|
|
20
|
+
const pkgJson = fs_extra_1.default.readJsonSync(pkgJsonPath);
|
|
21
|
+
const typesPath = (_b = (_a = pkgJson.types) !== null && _a !== void 0 ? _a : pkgJson.typings) !== null && _b !== void 0 ? _b : "index.d.ts";
|
|
22
|
+
if (pkgJson.main) {
|
|
23
|
+
nodeModulesPathMapping.set((0, getCanonicalFileName_1.getCanonicalFileName)(path_1.default.resolve(pkgPath, typesPath)), path_1.default.resolve(pkgPath, pkgJson.main));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return nodeModulesPathMapping;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=createNodeModulesPathMapping.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
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.createPathTranslator = createPathTranslator;
|
|
7
|
+
const path_translator_1 = require("@roblox-ts/path-translator");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const findAncestorDir_1 = require("../../Shared/util/findAncestorDir");
|
|
10
|
+
const getRootDirs_1 = require("../../Shared/util/getRootDirs");
|
|
11
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
12
|
+
function createPathTranslator(compilerOptions, data) {
|
|
13
|
+
const rootDir = (0, findAncestorDir_1.findAncestorDir)((0, getRootDirs_1.getRootDirs)(compilerOptions));
|
|
14
|
+
const outDir = compilerOptions.outDir;
|
|
15
|
+
let buildInfoPath = typescript_1.default.getTsBuildInfoEmitOutputFilePath(compilerOptions);
|
|
16
|
+
if (buildInfoPath !== undefined) {
|
|
17
|
+
buildInfoPath = path_1.default.normalize(buildInfoPath);
|
|
18
|
+
}
|
|
19
|
+
const declaration = compilerOptions.declaration === true;
|
|
20
|
+
return new path_translator_1.PathTranslator(rootDir, outDir, buildInfoPath, declaration, data.projectOptions.luau);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=createPathTranslator.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ProjectData } from "..";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
export declare function createProgramFactory(data: ProjectData, options: ts.CompilerOptions, projectReferences?: ReadonlyArray<ts.ProjectReference>): ts.CreateProgram<ts.EmitAndSemanticDiagnosticsBuilderProgram>;
|
|
@@ -0,0 +1,31 @@
|
|
|
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.createProgramFactory = createProgramFactory;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const createReadBuildProgramHost_1 = require("../util/createReadBuildProgramHost");
|
|
9
|
+
const constants_1 = require("../../Shared/constants");
|
|
10
|
+
const assert_1 = require("../../Shared/util/assert");
|
|
11
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
12
|
+
function createCompilerHost(data, compilerOptions) {
|
|
13
|
+
var _a;
|
|
14
|
+
const host = typescript_1.default.createIncrementalCompilerHost(compilerOptions);
|
|
15
|
+
let contentsToHash = "";
|
|
16
|
+
contentsToHash += `version=${constants_1.COMPILER_VERSION},`;
|
|
17
|
+
contentsToHash += `type=${String(data.projectOptions.type)},`;
|
|
18
|
+
contentsToHash += `isPackage=${String(data.isPackage)},`;
|
|
19
|
+
contentsToHash += `plugins=${JSON.stringify((_a = compilerOptions.plugins) !== null && _a !== void 0 ? _a : [])},`;
|
|
20
|
+
if (data.rojoConfigPath && fs_extra_1.default.existsSync(data.rojoConfigPath)) {
|
|
21
|
+
contentsToHash += fs_extra_1.default.readFileSync(data.rojoConfigPath).toString();
|
|
22
|
+
}
|
|
23
|
+
(0, assert_1.assert)(host.createHash);
|
|
24
|
+
const origCreateHash = host.createHash;
|
|
25
|
+
host.createHash = (data) => origCreateHash(contentsToHash + data);
|
|
26
|
+
return host;
|
|
27
|
+
}
|
|
28
|
+
function createProgramFactory(data, options, projectReferences) {
|
|
29
|
+
return (rootNames, compilerOptions = options, host = createCompilerHost(data, options), oldProgram = typescript_1.default.readBuilderProgram(options, (0, createReadBuildProgramHost_1.createReadBuildProgramHost)()), configFileParsingDiagnostics, refs = projectReferences) => typescript_1.default.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, refs);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=createProgramFactory.js.map
|
|
@@ -0,0 +1,102 @@
|
|
|
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.createProjectData = createProjectData;
|
|
7
|
+
const rojo_resolver_1 = require("@roblox-ts/rojo-resolver");
|
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const LogService_1 = require("../../Shared/classes/LogService");
|
|
11
|
+
const constants_1 = require("../../Shared/constants");
|
|
12
|
+
const ProjectError_1 = require("../../Shared/errors/ProjectError");
|
|
13
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
14
|
+
const PACKAGE_REGEX = /^@[a-z0-9-]*\//;
|
|
15
|
+
function createProjectData(tsConfigPath, projectOptions) {
|
|
16
|
+
var _a;
|
|
17
|
+
const projectPath = path_1.default.dirname(tsConfigPath);
|
|
18
|
+
const pkgJsonPath = typescript_1.default.findPackageJson(projectPath, typescript_1.default.sys);
|
|
19
|
+
if (!pkgJsonPath) {
|
|
20
|
+
throw new ProjectError_1.ProjectError("Unable to find package.json");
|
|
21
|
+
}
|
|
22
|
+
let isPackage = false;
|
|
23
|
+
try {
|
|
24
|
+
const pkgJson = JSON.parse(fs_extra_1.default.readFileSync(pkgJsonPath).toString());
|
|
25
|
+
isPackage = PACKAGE_REGEX.test((_a = pkgJson.name) !== null && _a !== void 0 ? _a : "");
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
}
|
|
29
|
+
projectOptions.includePath = path_1.default.resolve(projectOptions.includePath || path_1.default.join(projectPath, "include"));
|
|
30
|
+
const nodeModulesPath = path_1.default.join(path_1.default.dirname(pkgJsonPath), constants_1.NODE_MODULES);
|
|
31
|
+
let rojoConfigPath;
|
|
32
|
+
if (projectOptions.rojo) {
|
|
33
|
+
rojoConfigPath = path_1.default.resolve(projectOptions.rojo);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
const { path, warnings } = rojo_resolver_1.RojoResolver.findRojoConfigFilePath(projectPath);
|
|
37
|
+
rojoConfigPath = path;
|
|
38
|
+
for (const warning of warnings) {
|
|
39
|
+
LogService_1.LogService.warn(warning);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
tsConfigPath,
|
|
44
|
+
isPackage,
|
|
45
|
+
nodeModulesPath,
|
|
46
|
+
projectOptions,
|
|
47
|
+
projectPath,
|
|
48
|
+
rojoConfigPath,
|
|
49
|
+
referencedProjects: collectProjectReferences(tsConfigPath, new Set(), projectOptions.luau),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function collectProjectReferences(tsConfigPath, visited, luau) {
|
|
53
|
+
const normalizedPath = path_1.default.normalize(tsConfigPath);
|
|
54
|
+
if (visited.has(normalizedPath)) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
visited.add(normalizedPath);
|
|
58
|
+
const parsed = parseProjectConfig(tsConfigPath);
|
|
59
|
+
if (!parsed) {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
const results = [];
|
|
63
|
+
for (const ref of parsed.references) {
|
|
64
|
+
const refConfigPath = resolveReferencePath(tsConfigPath, ref.path);
|
|
65
|
+
const refParsed = parseProjectConfig(refConfigPath);
|
|
66
|
+
if (!refParsed) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
results.push(...collectProjectReferences(refConfigPath, visited, luau), {
|
|
70
|
+
tsConfigPath: refConfigPath,
|
|
71
|
+
rootDir: refParsed.rootDir,
|
|
72
|
+
outDir: refParsed.outDir,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return results;
|
|
76
|
+
}
|
|
77
|
+
function parseProjectConfig(tsConfigPath) {
|
|
78
|
+
var _a, _b, _c;
|
|
79
|
+
const configFile = typescript_1.default.readConfigFile(tsConfigPath, typescript_1.default.sys.readFile);
|
|
80
|
+
if (configFile.error) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
const configDir = path_1.default.dirname(tsConfigPath);
|
|
84
|
+
const parsedConfig = typescript_1.default.parseJsonConfigFileContent(configFile.config, typescript_1.default.sys, configDir);
|
|
85
|
+
const rootDir = (_a = parsedConfig.options.rootDir) !== null && _a !== void 0 ? _a : configDir;
|
|
86
|
+
const outDir = (_b = parsedConfig.options.outDir) !== null && _b !== void 0 ? _b : configDir;
|
|
87
|
+
return {
|
|
88
|
+
tsConfigPath,
|
|
89
|
+
rootDir: path_1.default.resolve(configDir, rootDir),
|
|
90
|
+
outDir: path_1.default.resolve(configDir, outDir),
|
|
91
|
+
references: (_c = parsedConfig.projectReferences) !== null && _c !== void 0 ? _c : [],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function resolveReferencePath(fromConfigPath, refPath) {
|
|
95
|
+
const configDir = path_1.default.dirname(fromConfigPath);
|
|
96
|
+
const resolvedPath = path_1.default.resolve(configDir, refPath);
|
|
97
|
+
if (typescript_1.default.sys.directoryExists(resolvedPath)) {
|
|
98
|
+
return path_1.default.join(resolvedPath, "tsconfig.json");
|
|
99
|
+
}
|
|
100
|
+
return resolvedPath;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=createProjectData.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createProjectProgram = createProjectProgram;
|
|
4
|
+
const createProgramFactory_1 = require("./createProgramFactory");
|
|
5
|
+
const getParsedCommandLine_1 = require("./getParsedCommandLine");
|
|
6
|
+
function createProjectProgram(data, host) {
|
|
7
|
+
const { fileNames, options, projectReferences } = (0, getParsedCommandLine_1.getParsedCommandLine)(data);
|
|
8
|
+
const createProgram = (0, createProgramFactory_1.createProgramFactory)(data, options, projectReferences);
|
|
9
|
+
return createProgram(fileNames, options, host);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=createProjectProgram.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
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.getChangedFilePaths = getChangedFilePaths;
|
|
7
|
+
const getCanonicalFileName_1 = require("../../Shared/util/getCanonicalFileName");
|
|
8
|
+
const getOrSetDefault_1 = require("../../Shared/util/getOrSetDefault");
|
|
9
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
10
|
+
function getChangedFilePaths(program, pathHints) {
|
|
11
|
+
var _a, _b, _c;
|
|
12
|
+
const compilerOptions = program.getCompilerOptions();
|
|
13
|
+
const buildState = program.getState();
|
|
14
|
+
const reversedReferencedMap = new Map();
|
|
15
|
+
const referencedMap = buildState.referencedMap;
|
|
16
|
+
if (referencedMap) {
|
|
17
|
+
for (const filePath of typescript_1.default.arrayFrom(referencedMap.keys())) {
|
|
18
|
+
(_a = referencedMap.getValues(filePath)) === null || _a === void 0 ? void 0 : _a.forEach((_, refFilePath) => {
|
|
19
|
+
(0, getOrSetDefault_1.getOrSetDefault)(reversedReferencedMap, refFilePath, () => new Set()).add(filePath);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const changedFilesSet = new Set();
|
|
24
|
+
const search = (filePath) => {
|
|
25
|
+
var _a;
|
|
26
|
+
changedFilesSet.add(filePath);
|
|
27
|
+
(_a = reversedReferencedMap.get(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(refFilePath => {
|
|
28
|
+
if (!changedFilesSet.has(refFilePath)) {
|
|
29
|
+
changedFilesSet.add(refFilePath);
|
|
30
|
+
if (compilerOptions.assumeChangesOnlyAffectDirectDependencies !== true) {
|
|
31
|
+
search(refFilePath);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
if (pathHints) {
|
|
37
|
+
for (const hint of pathHints) {
|
|
38
|
+
search((0, getCanonicalFileName_1.getCanonicalFileName)(hint));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
(_b = buildState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.forEach((_, fileName) => search(fileName));
|
|
43
|
+
(_c = buildState.changedFilesSet) === null || _c === void 0 ? void 0 : _c.clear();
|
|
44
|
+
}
|
|
45
|
+
return changedFilesSet;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=getChangedFilePaths.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
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.getChangedSourceFiles = getChangedSourceFiles;
|
|
7
|
+
const getChangedFilePaths_1 = require("./getChangedFilePaths");
|
|
8
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
9
|
+
function getChangedSourceFiles(program, pathHints) {
|
|
10
|
+
const sourceFiles = new Array();
|
|
11
|
+
for (const fileName of (0, getChangedFilePaths_1.getChangedFilePaths)(program, pathHints)) {
|
|
12
|
+
const sourceFile = program.getSourceFile(fileName);
|
|
13
|
+
if (sourceFile && !sourceFile.isDeclarationFile && !typescript_1.default.isJsonSourceFile(sourceFile)) {
|
|
14
|
+
sourceFiles.push(sourceFile);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return sourceFiles;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=getChangedSourceFiles.js.map
|