brighterscript 1.0.0-alpha.5 → 1.0.0-alpha.50
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/README.md +76 -138
- package/bsconfig.schema.json +121 -5
- package/dist/ActionPipeline.d.ts +10 -0
- package/dist/ActionPipeline.js +40 -0
- package/dist/ActionPipeline.js.map +1 -0
- package/dist/AstValidationSegmenter.d.ts +45 -0
- package/dist/AstValidationSegmenter.js +322 -0
- package/dist/AstValidationSegmenter.js.map +1 -0
- package/dist/BsConfig.d.ts +72 -39
- package/dist/BusyStatusTracker.d.ts +61 -0
- package/dist/BusyStatusTracker.js +148 -0
- package/dist/BusyStatusTracker.js.map +1 -0
- package/dist/Cache.d.ts +3 -8
- package/dist/Cache.js +9 -14
- package/dist/Cache.js.map +1 -1
- package/dist/CacheVerifier.d.ts +7 -0
- package/dist/CacheVerifier.js +20 -0
- package/dist/CacheVerifier.js.map +1 -0
- package/dist/CodeActionUtil.d.ts +12 -4
- package/dist/CodeActionUtil.js +22 -5
- package/dist/CodeActionUtil.js.map +1 -1
- package/dist/CommentFlagProcessor.d.ts +7 -6
- package/dist/CommentFlagProcessor.js +11 -8
- package/dist/CommentFlagProcessor.js.map +1 -1
- package/dist/CrossScopeValidator.d.ts +68 -0
- package/dist/CrossScopeValidator.js +642 -0
- package/dist/CrossScopeValidator.js.map +1 -0
- package/dist/DependencyGraph.d.ts +8 -3
- package/dist/DependencyGraph.js +49 -16
- package/dist/DependencyGraph.js.map +1 -1
- package/dist/DiagnosticCollection.d.ts +21 -5
- package/dist/DiagnosticCollection.js +77 -24
- package/dist/DiagnosticCollection.js.map +1 -1
- package/dist/DiagnosticFilterer.d.ts +27 -6
- package/dist/DiagnosticFilterer.js +273 -60
- package/dist/DiagnosticFilterer.js.map +1 -1
- package/dist/DiagnosticManager.d.ts +82 -0
- package/dist/DiagnosticManager.js +406 -0
- package/dist/DiagnosticManager.js.map +1 -0
- package/dist/DiagnosticMessages.d.ts +558 -196
- package/dist/DiagnosticMessages.js +870 -340
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/DiagnosticSeverityAdjuster.d.ts +7 -0
- package/dist/DiagnosticSeverityAdjuster.js +45 -0
- package/dist/DiagnosticSeverityAdjuster.js.map +1 -0
- package/dist/FunctionScope.d.ts +28 -0
- package/dist/FunctionScope.js +52 -0
- package/dist/FunctionScope.js.map +1 -0
- package/dist/KeyedThrottler.d.ts +3 -3
- package/dist/KeyedThrottler.js +3 -3
- package/dist/KeyedThrottler.js.map +1 -1
- package/dist/LanguageServer.d.ts +100 -105
- package/dist/LanguageServer.js +444 -745
- package/dist/LanguageServer.js.map +1 -1
- package/dist/Logger.d.ts +17 -13
- package/dist/Logger.js +64 -34
- package/dist/Logger.js.map +1 -1
- package/dist/PluginInterface.d.ts +32 -10
- package/dist/PluginInterface.js +117 -7
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +241 -98
- package/dist/Program.js +1432 -717
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +47 -23
- package/dist/ProgramBuilder.js +224 -178
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +149 -109
- package/dist/Scope.js +557 -550
- package/dist/Scope.js.map +1 -1
- package/dist/SemanticTokenUtils.js +5 -1
- package/dist/SemanticTokenUtils.js.map +1 -1
- package/dist/Stopwatch.d.ts +4 -0
- package/dist/Stopwatch.js +8 -1
- package/dist/Stopwatch.js.map +1 -1
- package/dist/SymbolTable.d.ts +136 -24
- package/dist/SymbolTable.js +565 -64
- package/dist/SymbolTable.js.map +1 -1
- package/dist/SymbolTypeFlag.d.ts +9 -0
- package/dist/SymbolTypeFlag.js +14 -0
- package/dist/SymbolTypeFlag.js.map +1 -0
- package/dist/Throttler.d.ts +12 -0
- package/dist/Throttler.js +39 -0
- package/dist/Throttler.js.map +1 -1
- package/dist/Watcher.d.ts +0 -3
- package/dist/Watcher.js +0 -3
- package/dist/Watcher.js.map +1 -1
- package/dist/XmlScope.d.ts +5 -15
- package/dist/XmlScope.js +34 -90
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/CachedLookups.d.ts +50 -0
- package/dist/astUtils/CachedLookups.js +334 -0
- package/dist/astUtils/CachedLookups.js.map +1 -0
- package/dist/astUtils/CachedLookups.spec.js +39 -0
- package/dist/astUtils/CachedLookups.spec.js.map +1 -0
- package/dist/astUtils/Editor.d.ts +69 -0
- package/dist/astUtils/Editor.js +245 -0
- package/dist/astUtils/Editor.js.map +1 -0
- package/dist/astUtils/Editor.spec.js +258 -0
- package/dist/astUtils/Editor.spec.js.map +1 -0
- package/dist/astUtils/creators.d.ts +54 -19
- package/dist/astUtils/creators.js +242 -42
- package/dist/astUtils/creators.js.map +1 -1
- package/dist/astUtils/creators.spec.js +5 -5
- package/dist/astUtils/creators.spec.js.map +1 -1
- package/dist/astUtils/reflection.d.ts +196 -85
- package/dist/astUtils/reflection.js +497 -144
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/reflection.spec.js +267 -167
- package/dist/astUtils/reflection.spec.js.map +1 -1
- package/dist/astUtils/stackedVisitor.js.map +1 -1
- package/dist/astUtils/stackedVisitor.spec.js +14 -14
- package/dist/astUtils/stackedVisitor.spec.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +116 -53
- package/dist/astUtils/visitors.js +95 -15
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/visitors.spec.js +629 -51
- package/dist/astUtils/visitors.spec.js.map +1 -1
- package/dist/astUtils/xml.d.ts +9 -8
- package/dist/astUtils/xml.js +12 -7
- package/dist/astUtils/xml.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +24 -4
- package/dist/bscPlugin/BscPlugin.js +88 -4
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/CallExpressionInfo.d.ts +36 -0
- package/dist/bscPlugin/CallExpressionInfo.js +143 -0
- package/dist/bscPlugin/CallExpressionInfo.js.map +1 -0
- package/dist/bscPlugin/FileWriter.d.ts +6 -0
- package/dist/bscPlugin/FileWriter.js +24 -0
- package/dist/bscPlugin/FileWriter.js.map +1 -0
- package/dist/bscPlugin/SignatureHelpUtil.d.ts +10 -0
- package/dist/bscPlugin/SignatureHelpUtil.js +137 -0
- package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -0
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.d.ts +6 -5
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +173 -27
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +138 -21
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +65 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.js +633 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +2512 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/definition/DefinitionProvider.d.ts +13 -0
- package/dist/bscPlugin/definition/DefinitionProvider.js +212 -0
- package/dist/bscPlugin/definition/DefinitionProvider.js.map +1 -0
- package/dist/bscPlugin/definition/DefinitionProvider.spec.js +87 -0
- package/dist/bscPlugin/definition/DefinitionProvider.spec.js.map +1 -0
- package/dist/bscPlugin/fileProviders/FileProvider.d.ts +9 -0
- package/dist/bscPlugin/fileProviders/FileProvider.js +51 -0
- package/dist/bscPlugin/fileProviders/FileProvider.js.map +1 -0
- package/dist/bscPlugin/hover/HoverProcessor.d.ts +18 -0
- package/dist/bscPlugin/hover/HoverProcessor.js +230 -0
- package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -0
- package/dist/bscPlugin/hover/HoverProcessor.spec.js +991 -0
- package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/references/ReferencesProvider.d.ts +12 -0
- package/dist/bscPlugin/references/ReferencesProvider.js +57 -0
- package/dist/bscPlugin/references/ReferencesProvider.js.map +1 -0
- package/dist/bscPlugin/references/ReferencesProvider.spec.d.ts +1 -0
- package/dist/bscPlugin/references/ReferencesProvider.spec.js +51 -0
- package/dist/bscPlugin/references/ReferencesProvider.spec.js.map +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +14 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +164 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +564 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/serialize/BslibInjector.spec.d.ts +1 -0
- package/dist/bscPlugin/serialize/BslibInjector.spec.js +33 -0
- package/dist/bscPlugin/serialize/BslibInjector.spec.js.map +1 -0
- package/dist/bscPlugin/serialize/BslibManager.d.ts +12 -0
- package/dist/bscPlugin/serialize/BslibManager.js +46 -0
- package/dist/bscPlugin/serialize/BslibManager.js.map +1 -0
- package/dist/bscPlugin/serialize/FileSerializer.d.ts +9 -0
- package/dist/bscPlugin/serialize/FileSerializer.js +75 -0
- package/dist/bscPlugin/serialize/FileSerializer.js.map +1 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.d.ts +7 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.js +22 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.js.map +1 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.js +291 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.d.ts +7 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.js +26 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.js.map +1 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.js +245 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/symbols/symbolUtils.d.ts +5 -0
- package/dist/bscPlugin/symbols/symbolUtils.js +141 -0
- package/dist/bscPlugin/symbols/symbolUtils.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.d.ts +27 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js +418 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js +75 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.d.ts +12 -0
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js +99 -0
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js.map +1 -0
- package/dist/bscPlugin/validation/BrsFileAfterValidator.d.ts +7 -0
- package/dist/bscPlugin/validation/BrsFileAfterValidator.js +18 -0
- package/dist/bscPlugin/validation/BrsFileAfterValidator.js.map +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.d.ts +37 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js +638 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.spec.d.ts +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.spec.js +1517 -0
- package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -0
- package/dist/bscPlugin/validation/ProgramValidator.d.ts +11 -0
- package/dist/bscPlugin/validation/ProgramValidator.js +33 -0
- package/dist/bscPlugin/validation/ProgramValidator.js.map +1 -0
- package/dist/bscPlugin/validation/ScopeValidator.d.ts +141 -0
- package/dist/bscPlugin/validation/ScopeValidator.js +1323 -0
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.d.ts +1 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.js +6135 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -0
- package/dist/bscPlugin/validation/XmlFileValidator.d.ts +8 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js +36 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -0
- package/dist/cli.js +126 -27
- package/dist/cli.js.map +1 -1
- package/dist/common/Sequencer.d.ts +53 -0
- package/dist/common/Sequencer.js +233 -0
- package/dist/common/Sequencer.js.map +1 -0
- package/dist/common/Sequencer.spec.d.ts +1 -0
- package/dist/common/Sequencer.spec.js +75 -0
- package/dist/common/Sequencer.spec.js.map +1 -0
- package/dist/deferred.d.ts +5 -3
- package/dist/deferred.js +10 -0
- package/dist/deferred.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +10 -3
- package/dist/diagnosticUtils.js +64 -25
- package/dist/diagnosticUtils.js.map +1 -1
- package/dist/examples/plugins/removePrint.d.ts +2 -2
- package/dist/examples/plugins/removePrint.js +8 -12
- package/dist/examples/plugins/removePrint.js.map +1 -1
- package/dist/files/AssetFile.d.ts +24 -0
- package/dist/files/AssetFile.js +25 -0
- package/dist/files/AssetFile.js.map +1 -0
- package/dist/files/BrsFile.Class.spec.js +1213 -259
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +145 -87
- package/dist/files/BrsFile.js +836 -934
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +4226 -902
- package/dist/files/BrsFile.spec.js.map +1 -1
- package/dist/files/BscFile.d.ts +102 -0
- package/dist/files/BscFile.js +15 -0
- package/dist/files/BscFile.js.map +1 -0
- package/dist/files/Factory.d.ts +25 -0
- package/dist/files/Factory.js +22 -0
- package/dist/files/Factory.js.map +1 -0
- package/dist/files/LazyFileData.d.ts +21 -0
- package/dist/files/LazyFileData.js +54 -0
- package/dist/files/LazyFileData.js.map +1 -0
- package/dist/files/LazyFileData.spec.d.ts +1 -0
- package/dist/files/LazyFileData.spec.js +27 -0
- package/dist/files/LazyFileData.spec.js.map +1 -0
- package/dist/files/XmlFile.d.ts +80 -41
- package/dist/files/XmlFile.js +161 -137
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/files/XmlFile.spec.js +444 -336
- package/dist/files/XmlFile.spec.js.map +1 -1
- package/dist/files/tests/imports.spec.js +62 -52
- package/dist/files/tests/imports.spec.js.map +1 -1
- package/dist/files/tests/optionalChaning.spec.d.ts +1 -0
- package/dist/files/tests/optionalChaning.spec.js +152 -0
- package/dist/files/tests/optionalChaning.spec.js.map +1 -0
- package/dist/globalCallables.d.ts +3 -1
- package/dist/globalCallables.js +424 -184
- package/dist/globalCallables.js.map +1 -1
- package/dist/index.d.ts +32 -4
- package/dist/index.js +54 -7
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +942 -125
- package/dist/interfaces.js +21 -0
- package/dist/interfaces.js.map +1 -1
- package/dist/lexer/Character.spec.js +5 -5
- package/dist/lexer/Character.spec.js.map +1 -1
- package/dist/lexer/Lexer.d.ts +51 -12
- package/dist/lexer/Lexer.js +215 -65
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/lexer/Lexer.spec.js +812 -568
- package/dist/lexer/Lexer.spec.js.map +1 -1
- package/dist/lexer/Token.d.ts +27 -11
- package/dist/lexer/Token.js +10 -2
- package/dist/lexer/Token.js.map +1 -1
- package/dist/lexer/TokenKind.d.ts +40 -2
- package/dist/lexer/TokenKind.js +147 -10
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/logging.d.ts +14 -0
- package/dist/logging.js +29 -0
- package/dist/logging.js.map +1 -0
- package/dist/lsp/ActionQueue.d.ts +35 -0
- package/dist/lsp/ActionQueue.js +115 -0
- package/dist/lsp/ActionQueue.js.map +1 -0
- package/dist/lsp/ActionQueue.spec.d.ts +1 -0
- package/dist/lsp/ActionQueue.spec.js +80 -0
- package/dist/lsp/ActionQueue.spec.js.map +1 -0
- package/dist/lsp/DocumentManager.d.ts +63 -0
- package/dist/lsp/DocumentManager.js +122 -0
- package/dist/lsp/DocumentManager.js.map +1 -0
- package/dist/lsp/DocumentManager.spec.d.ts +1 -0
- package/dist/lsp/DocumentManager.spec.js +103 -0
- package/dist/lsp/DocumentManager.spec.js.map +1 -0
- package/dist/lsp/LspProject.d.ts +239 -0
- package/dist/lsp/LspProject.js +3 -0
- package/dist/lsp/LspProject.js.map +1 -0
- package/dist/lsp/PathFilterer.d.ts +75 -0
- package/dist/lsp/PathFilterer.js +196 -0
- package/dist/lsp/PathFilterer.js.map +1 -0
- package/dist/lsp/PathFilterer.spec.d.ts +1 -0
- package/dist/lsp/PathFilterer.spec.js +182 -0
- package/dist/lsp/PathFilterer.spec.js.map +1 -0
- package/dist/lsp/Project.d.ts +168 -0
- package/dist/lsp/Project.js +437 -0
- package/dist/lsp/Project.js.map +1 -0
- package/dist/lsp/Project.spec.d.ts +1 -0
- package/dist/lsp/Project.spec.js +267 -0
- package/dist/lsp/Project.spec.js.map +1 -0
- package/dist/lsp/ProjectManager.d.ts +242 -0
- package/dist/lsp/ProjectManager.js +824 -0
- package/dist/lsp/ProjectManager.js.map +1 -0
- package/dist/lsp/ProjectManager.spec.d.ts +1 -0
- package/dist/lsp/ProjectManager.spec.js +913 -0
- package/dist/lsp/ProjectManager.spec.js.map +1 -0
- package/dist/lsp/ReaderWriterManager.d.ts +21 -0
- package/dist/lsp/ReaderWriterManager.js +60 -0
- package/dist/lsp/ReaderWriterManager.js.map +1 -0
- package/dist/lsp/worker/MessageHandler.d.ts +99 -0
- package/dist/lsp/worker/MessageHandler.js +138 -0
- package/dist/lsp/worker/MessageHandler.js.map +1 -0
- package/dist/lsp/worker/MessageHandler.spec.d.ts +1 -0
- package/dist/lsp/worker/MessageHandler.spec.js +64 -0
- package/dist/lsp/worker/MessageHandler.spec.js.map +1 -0
- package/dist/lsp/worker/WorkerPool.d.ts +38 -0
- package/dist/lsp/worker/WorkerPool.js +78 -0
- package/dist/lsp/worker/WorkerPool.js.map +1 -0
- package/dist/lsp/worker/WorkerPool.spec.d.ts +1 -0
- package/dist/lsp/worker/WorkerPool.spec.js +59 -0
- package/dist/lsp/worker/WorkerPool.spec.js.map +1 -0
- package/dist/lsp/worker/WorkerThreadProject.d.ts +143 -0
- package/dist/lsp/worker/WorkerThreadProject.js +189 -0
- package/dist/lsp/worker/WorkerThreadProject.js.map +1 -0
- package/dist/lsp/worker/WorkerThreadProject.spec.d.ts +2 -0
- package/dist/lsp/worker/WorkerThreadProject.spec.js +71 -0
- package/dist/lsp/worker/WorkerThreadProject.spec.js.map +1 -0
- package/dist/lsp/worker/WorkerThreadProjectRunner.d.ts +15 -0
- package/dist/lsp/worker/WorkerThreadProjectRunner.js +58 -0
- package/dist/lsp/worker/WorkerThreadProjectRunner.js.map +1 -0
- package/dist/lsp/worker/run.d.ts +1 -0
- package/dist/lsp/worker/run.js +14 -0
- package/dist/lsp/worker/run.js.map +1 -0
- package/dist/parser/AstNode.d.ts +203 -0
- package/dist/parser/AstNode.js +303 -0
- package/dist/parser/AstNode.js.map +1 -0
- package/dist/parser/AstNode.spec.d.ts +1 -0
- package/dist/parser/AstNode.spec.js +1455 -0
- package/dist/parser/AstNode.spec.js.map +1 -0
- package/dist/parser/BrightScriptDocParser.d.ts +56 -0
- package/dist/parser/BrightScriptDocParser.js +294 -0
- package/dist/parser/BrightScriptDocParser.js.map +1 -0
- package/dist/parser/BrightScriptDocParser.spec.d.ts +1 -0
- package/dist/parser/BrightScriptDocParser.spec.js +310 -0
- package/dist/parser/BrightScriptDocParser.spec.js.map +1 -0
- package/dist/parser/BrsTranspileState.d.ts +22 -3
- package/dist/parser/BrsTranspileState.js +19 -0
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +553 -221
- package/dist/parser/Expression.js +1414 -505
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Expression.spec.d.ts +1 -0
- package/dist/parser/Expression.spec.js +40 -0
- package/dist/parser/Expression.spec.js.map +1 -0
- package/dist/parser/Parser.Class.spec.js +255 -125
- package/dist/parser/Parser.Class.spec.js.map +1 -1
- package/dist/parser/Parser.d.ts +117 -124
- package/dist/parser/Parser.js +1669 -982
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Parser.spec.d.ts +3 -1
- package/dist/parser/Parser.spec.js +2111 -525
- package/dist/parser/Parser.spec.js.map +1 -1
- package/dist/parser/SGParser.d.ts +29 -13
- package/dist/parser/SGParser.js +85 -56
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGParser.spec.js +30 -45
- package/dist/parser/SGParser.spec.js.map +1 -1
- package/dist/parser/SGTypes.d.ts +134 -46
- package/dist/parser/SGTypes.js +206 -115
- package/dist/parser/SGTypes.js.map +1 -1
- package/dist/parser/Statement.d.ts +849 -267
- package/dist/parser/Statement.js +2412 -625
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/Statement.spec.js +133 -36
- package/dist/parser/Statement.spec.js.map +1 -1
- package/dist/parser/TranspileState.d.ts +26 -12
- package/dist/parser/TranspileState.js +115 -24
- package/dist/parser/TranspileState.js.map +1 -1
- package/dist/parser/tests/Parser.spec.d.ts +3 -9
- package/dist/parser/tests/Parser.spec.js +7 -13
- package/dist/parser/tests/Parser.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/For.spec.js +83 -75
- package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/ForEach.spec.js +85 -51
- package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/If.spec.js +382 -239
- package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/While.spec.js +52 -45
- package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
- package/dist/parser/tests/expression/Additive.spec.js +51 -43
- package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
- package/dist/parser/tests/expression/ArrayLiterals.spec.js +192 -142
- package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +236 -160
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
- package/dist/parser/tests/expression/Boolean.spec.js +41 -34
- package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
- package/dist/parser/tests/expression/Call.spec.js +173 -55
- package/dist/parser/tests/expression/Call.spec.js.map +1 -1
- package/dist/parser/tests/expression/Exponential.spec.js +20 -20
- package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
- package/dist/parser/tests/expression/Function.spec.js +291 -282
- package/dist/parser/tests/expression/Function.spec.js.map +1 -1
- package/dist/parser/tests/expression/Indexing.spec.js +193 -110
- package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
- package/dist/parser/tests/expression/Multiplicative.spec.js +42 -42
- package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +260 -115
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/PrefixUnary.spec.js +58 -52
- package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
- package/dist/parser/tests/expression/Primary.spec.js +76 -60
- package/dist/parser/tests/expression/Primary.spec.js.map +1 -1
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.d.ts +1 -0
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +171 -0
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -0
- package/dist/parser/tests/expression/Relational.spec.js +50 -50
- package/dist/parser/tests/expression/Relational.spec.js.map +1 -1
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +31 -31
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js +281 -94
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +747 -192
- package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TypeExpression.spec.d.ts +1 -0
- package/dist/parser/tests/expression/TypeExpression.spec.js +126 -0
- package/dist/parser/tests/expression/TypeExpression.spec.js.map +1 -0
- package/dist/parser/tests/expression/UnaryExpression.spec.d.ts +1 -0
- package/dist/parser/tests/expression/UnaryExpression.spec.js +52 -0
- package/dist/parser/tests/expression/UnaryExpression.spec.js.map +1 -0
- package/dist/parser/tests/statement/AssignmentOperators.spec.js +44 -44
- package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +1 -1
- package/dist/parser/tests/statement/ConstStatement.spec.d.ts +1 -0
- package/dist/parser/tests/statement/ConstStatement.spec.js +500 -0
- package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -0
- package/dist/parser/tests/statement/Continue.spec.d.ts +1 -0
- package/dist/parser/tests/statement/Continue.spec.js +119 -0
- package/dist/parser/tests/statement/Continue.spec.js.map +1 -0
- package/dist/parser/tests/statement/Declaration.spec.js +61 -55
- package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
- package/dist/parser/tests/statement/Dim.spec.js +29 -22
- package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
- package/dist/parser/tests/statement/Enum.spec.d.ts +1 -0
- package/dist/parser/tests/statement/Enum.spec.js +744 -0
- package/dist/parser/tests/statement/Enum.spec.js.map +1 -0
- package/dist/parser/tests/statement/For.spec.d.ts +1 -0
- package/dist/parser/tests/statement/For.spec.js +45 -0
- package/dist/parser/tests/statement/For.spec.js.map +1 -0
- package/dist/parser/tests/statement/ForEach.spec.d.ts +1 -0
- package/dist/parser/tests/statement/ForEach.spec.js +36 -0
- package/dist/parser/tests/statement/ForEach.spec.js.map +1 -0
- package/dist/parser/tests/statement/Function.spec.js +226 -215
- package/dist/parser/tests/statement/Function.spec.js.map +1 -1
- package/dist/parser/tests/statement/Goto.spec.js +16 -15
- package/dist/parser/tests/statement/Goto.spec.js.map +1 -1
- package/dist/parser/tests/statement/Increment.spec.js +64 -61
- package/dist/parser/tests/statement/Increment.spec.js.map +1 -1
- package/dist/parser/tests/statement/InterfaceStatement.spec.d.ts +1 -0
- package/dist/parser/tests/statement/InterfaceStatement.spec.js +110 -0
- package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -0
- package/dist/parser/tests/statement/LibraryStatement.spec.js +22 -22
- package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Misc.spec.js +127 -168
- package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +133 -114
- package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/ReturnStatement.spec.js +57 -54
- package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Set.spec.js +131 -117
- package/dist/parser/tests/statement/Set.spec.js.map +1 -1
- package/dist/parser/tests/statement/Stop.spec.js +14 -13
- package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
- package/dist/parser/tests/statement/Throw.spec.js +11 -8
- package/dist/parser/tests/statement/Throw.spec.js.map +1 -1
- package/dist/parser/tests/statement/TryCatch.spec.js +26 -15
- package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
- package/dist/preprocessor/Manifest.d.ts +6 -6
- package/dist/preprocessor/Manifest.js +17 -38
- package/dist/preprocessor/Manifest.js.map +1 -1
- package/dist/preprocessor/Manifest.spec.d.ts +1 -0
- package/dist/preprocessor/Manifest.spec.js +78 -103
- package/dist/preprocessor/Manifest.spec.js.map +1 -1
- package/dist/roku-types/data.json +20347 -0
- package/dist/roku-types/index.d.ts +5726 -0
- package/dist/roku-types/index.js +11 -0
- package/dist/roku-types/index.js.map +1 -0
- package/dist/types/ArrayType.d.ts +12 -5
- package/dist/types/ArrayType.js +89 -24
- package/dist/types/ArrayType.js.map +1 -1
- package/dist/types/ArrayType.spec.js +39 -11
- package/dist/types/ArrayType.spec.js.map +1 -1
- package/dist/types/AssociativeArrayType.d.ts +15 -0
- package/dist/types/AssociativeArrayType.js +64 -0
- package/dist/types/AssociativeArrayType.js.map +1 -0
- package/dist/types/BaseFunctionType.d.ts +10 -0
- package/dist/types/BaseFunctionType.js +26 -0
- package/dist/types/BaseFunctionType.js.map +1 -0
- package/dist/types/BooleanType.d.ts +9 -5
- package/dist/types/BooleanType.js +19 -8
- package/dist/types/BooleanType.js.map +1 -1
- package/dist/types/BooleanType.spec.js +10 -4
- package/dist/types/BooleanType.spec.js.map +1 -1
- package/dist/types/BscType.d.ts +41 -3
- package/dist/types/BscType.js +152 -0
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/BscTypeKind.d.ts +28 -0
- package/dist/types/BscTypeKind.js +33 -0
- package/dist/types/BscTypeKind.js.map +1 -0
- package/dist/types/BuiltInInterfaceAdder.d.ts +28 -0
- package/dist/types/BuiltInInterfaceAdder.js +212 -0
- package/dist/types/BuiltInInterfaceAdder.js.map +1 -0
- package/dist/types/BuiltInInterfaceAdder.spec.d.ts +1 -0
- package/dist/types/BuiltInInterfaceAdder.spec.js +115 -0
- package/dist/types/BuiltInInterfaceAdder.spec.js.map +1 -0
- package/dist/types/CallFuncableType.d.ts +24 -0
- package/dist/types/CallFuncableType.js +91 -0
- package/dist/types/CallFuncableType.js.map +1 -0
- package/dist/types/ClassType.d.ts +17 -0
- package/dist/types/ClassType.js +60 -0
- package/dist/types/ClassType.js.map +1 -0
- package/dist/types/ClassType.spec.d.ts +1 -0
- package/dist/types/ClassType.spec.js +76 -0
- package/dist/types/ClassType.spec.js.map +1 -0
- package/dist/types/ComponentType.d.ts +22 -0
- package/dist/types/ComponentType.js +107 -0
- package/dist/types/ComponentType.js.map +1 -0
- package/dist/types/DoubleType.d.ts +10 -5
- package/dist/types/DoubleType.js +21 -17
- package/dist/types/DoubleType.js.map +1 -1
- package/dist/types/DoubleType.spec.js +12 -4
- package/dist/types/DoubleType.spec.js.map +1 -1
- package/dist/types/DynamicType.d.ts +13 -5
- package/dist/types/DynamicType.js +26 -5
- package/dist/types/DynamicType.js.map +1 -1
- package/dist/types/DynamicType.spec.js +16 -5
- package/dist/types/DynamicType.spec.js.map +1 -1
- package/dist/types/EnumType.d.ts +42 -0
- package/dist/types/EnumType.js +98 -0
- package/dist/types/EnumType.js.map +1 -0
- package/dist/types/EnumType.spec.d.ts +1 -0
- package/dist/types/EnumType.spec.js +33 -0
- package/dist/types/EnumType.spec.js.map +1 -0
- package/dist/types/FloatType.d.ts +10 -5
- package/dist/types/FloatType.js +21 -17
- package/dist/types/FloatType.js.map +1 -1
- package/dist/types/FloatType.spec.js +4 -4
- package/dist/types/FloatType.spec.js.map +1 -1
- package/dist/types/FunctionType.d.ts +8 -22
- package/dist/types/FunctionType.js +25 -63
- package/dist/types/FunctionType.js.map +1 -1
- package/dist/types/InheritableType.d.ts +29 -0
- package/dist/types/InheritableType.js +173 -0
- package/dist/types/InheritableType.js.map +1 -0
- package/dist/types/InlineInterfaceType.d.ts +5 -0
- package/dist/types/InlineInterfaceType.js +17 -0
- package/dist/types/InlineInterfaceType.js.map +1 -0
- package/dist/types/IntegerType.d.ts +10 -5
- package/dist/types/IntegerType.js +21 -17
- package/dist/types/IntegerType.js.map +1 -1
- package/dist/types/IntegerType.spec.js +8 -4
- package/dist/types/IntegerType.spec.js.map +1 -1
- package/dist/types/InterfaceType.d.ts +14 -6
- package/dist/types/InterfaceType.js +30 -15
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/InterfaceType.spec.d.ts +1 -0
- package/dist/types/InterfaceType.spec.js +227 -0
- package/dist/types/InterfaceType.spec.js.map +1 -0
- package/dist/types/IntersectionType.d.ts +29 -0
- package/dist/types/IntersectionType.js +253 -0
- package/dist/types/IntersectionType.js.map +1 -0
- package/dist/types/IntersectionType.spec.d.ts +1 -0
- package/dist/types/IntersectionType.spec.js +150 -0
- package/dist/types/IntersectionType.spec.js.map +1 -0
- package/dist/types/InvalidType.d.ts +10 -5
- package/dist/types/InvalidType.js +21 -9
- package/dist/types/InvalidType.js.map +1 -1
- package/dist/types/InvalidType.spec.js +8 -4
- package/dist/types/InvalidType.spec.js.map +1 -1
- package/dist/types/LongIntegerType.d.ts +10 -5
- package/dist/types/LongIntegerType.js +21 -17
- package/dist/types/LongIntegerType.js.map +1 -1
- package/dist/types/LongIntegerType.spec.js +10 -4
- package/dist/types/LongIntegerType.spec.js.map +1 -1
- package/dist/types/NamespaceType.d.ts +12 -0
- package/dist/types/NamespaceType.js +28 -0
- package/dist/types/NamespaceType.js.map +1 -0
- package/dist/types/ObjectType.d.ts +12 -5
- package/dist/types/ObjectType.js +25 -8
- package/dist/types/ObjectType.js.map +1 -1
- package/dist/types/ObjectType.spec.js +3 -3
- package/dist/types/ObjectType.spec.js.map +1 -1
- package/dist/types/ReferenceType.d.ts +123 -0
- package/dist/types/ReferenceType.js +720 -0
- package/dist/types/ReferenceType.js.map +1 -0
- package/dist/types/ReferenceType.spec.d.ts +1 -0
- package/dist/types/ReferenceType.spec.js +151 -0
- package/dist/types/ReferenceType.spec.js.map +1 -0
- package/dist/types/StringType.d.ts +12 -5
- package/dist/types/StringType.js +23 -8
- package/dist/types/StringType.js.map +1 -1
- package/dist/types/StringType.spec.js +3 -3
- package/dist/types/StringType.spec.js.map +1 -1
- package/dist/types/TypeStatementType.d.ts +18 -0
- package/dist/types/TypeStatementType.js +45 -0
- package/dist/types/TypeStatementType.js.map +1 -0
- package/dist/types/TypedFunctionType.d.ts +34 -0
- package/dist/types/TypedFunctionType.js +147 -0
- package/dist/types/TypedFunctionType.js.map +1 -0
- package/dist/types/TypedFunctionType.spec.d.ts +1 -0
- package/dist/types/TypedFunctionType.spec.js +122 -0
- package/dist/types/TypedFunctionType.spec.js.map +1 -0
- package/dist/types/UninitializedType.d.ts +11 -6
- package/dist/types/UninitializedType.js +20 -11
- package/dist/types/UninitializedType.js.map +1 -1
- package/dist/types/UnionType.d.ts +27 -0
- package/dist/types/UnionType.js +193 -0
- package/dist/types/UnionType.js.map +1 -0
- package/dist/types/UnionType.spec.d.ts +1 -0
- package/dist/types/UnionType.spec.js +205 -0
- package/dist/types/UnionType.spec.js.map +1 -0
- package/dist/types/VoidType.d.ts +11 -5
- package/dist/types/VoidType.js +22 -8
- package/dist/types/VoidType.js.map +1 -1
- package/dist/types/VoidType.spec.js +3 -3
- package/dist/types/VoidType.spec.js.map +1 -1
- package/dist/types/helper.spec.d.ts +1 -0
- package/dist/types/helper.spec.js +174 -0
- package/dist/types/helper.spec.js.map +1 -0
- package/dist/types/helpers.d.ts +51 -0
- package/dist/types/helpers.js +323 -0
- package/dist/types/helpers.js.map +1 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.js +39 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/roFunctionType.d.ts +11 -0
- package/dist/types/roFunctionType.js +37 -0
- package/dist/types/roFunctionType.js.map +1 -0
- package/dist/types/roFunctionType.spec.d.ts +1 -0
- package/dist/types/roFunctionType.spec.js +20 -0
- package/dist/types/roFunctionType.spec.js.map +1 -0
- package/dist/util.d.ts +288 -187
- package/dist/util.js +2018 -575
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.d.ts +9 -15
- package/dist/validators/ClassValidator.js +93 -138
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +185 -138
- package/CHANGELOG.md +0 -1188
- package/dist/astUtils/index.d.ts +0 -7
- package/dist/astUtils/index.js +0 -26
- package/dist/astUtils/index.js.map +0 -1
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.d.ts +0 -7
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.js +0 -63
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.js.map +0 -1
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.spec.js +0 -45
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.spec.js.map +0 -1
- package/dist/lexer/index.d.ts +0 -3
- package/dist/lexer/index.js +0 -17
- package/dist/lexer/index.js.map +0 -1
- package/dist/parser/SGTypes.spec.js +0 -351
- package/dist/parser/SGTypes.spec.js.map +0 -1
- package/dist/parser/index.d.ts +0 -3
- package/dist/parser/index.js +0 -16
- package/dist/parser/index.js.map +0 -1
- package/dist/preprocessor/Chunk.d.ts +0 -82
- package/dist/preprocessor/Chunk.js +0 -77
- package/dist/preprocessor/Chunk.js.map +0 -1
- package/dist/preprocessor/Preprocessor.d.ts +0 -60
- package/dist/preprocessor/Preprocessor.js +0 -156
- package/dist/preprocessor/Preprocessor.js.map +0 -1
- package/dist/preprocessor/Preprocessor.spec.js +0 -152
- package/dist/preprocessor/Preprocessor.spec.js.map +0 -1
- package/dist/preprocessor/PreprocessorParser.d.ts +0 -61
- package/dist/preprocessor/PreprocessorParser.js +0 -194
- package/dist/preprocessor/PreprocessorParser.js.map +0 -1
- package/dist/preprocessor/PreprocessorParser.spec.js +0 -116
- package/dist/preprocessor/PreprocessorParser.spec.js.map +0 -1
- package/dist/preprocessor/index.d.ts +0 -3
- package/dist/preprocessor/index.js +0 -16
- package/dist/preprocessor/index.js.map +0 -1
- package/dist/types/CustomType.d.ts +0 -10
- package/dist/types/CustomType.js +0 -35
- package/dist/types/CustomType.js.map +0 -1
- package/dist/types/FunctionType.spec.js +0 -29
- package/dist/types/FunctionType.spec.js.map +0 -1
- package/dist/types/LazyType.d.ts +0 -15
- package/dist/types/LazyType.js +0 -32
- package/dist/types/LazyType.js.map +0 -1
- /package/dist/{bscPlugin/semanticTokens/SemanticTokensProcessor.spec.d.ts → astUtils/CachedLookups.spec.d.ts} +0 -0
- /package/dist/{parser/SGTypes.spec.d.ts → astUtils/Editor.spec.d.ts} +0 -0
- /package/dist/{preprocessor/Preprocessor.spec.d.ts → bscPlugin/completions/CompletionsProcessor.spec.d.ts} +0 -0
- /package/dist/{preprocessor/PreprocessorParser.spec.d.ts → bscPlugin/definition/DefinitionProvider.spec.d.ts} +0 -0
- /package/dist/{types/FunctionType.spec.d.ts → bscPlugin/hover/HoverProcessor.spec.d.ts} +0 -0
package/dist/ProgramBuilder.js
CHANGED
|
@@ -3,32 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ProgramBuilder = void 0;
|
|
4
4
|
const debounce = require("debounce-promise");
|
|
5
5
|
const path = require("path");
|
|
6
|
-
const
|
|
6
|
+
const roku_deploy_1 = require("roku-deploy");
|
|
7
7
|
const Program_1 = require("./Program");
|
|
8
8
|
const util_1 = require("./util");
|
|
9
9
|
const Watcher_1 = require("./Watcher");
|
|
10
10
|
const vscode_languageserver_1 = require("vscode-languageserver");
|
|
11
|
-
const
|
|
11
|
+
const logging_1 = require("./logging");
|
|
12
12
|
const PluginInterface_1 = require("./PluginInterface");
|
|
13
13
|
const diagnosticUtils = require("./diagnosticUtils");
|
|
14
14
|
const fsExtra = require("fs-extra");
|
|
15
|
+
const requireRelative = require("require-relative");
|
|
16
|
+
const Throttler_1 = require("./Throttler");
|
|
17
|
+
const DiagnosticManager_1 = require("./DiagnosticManager");
|
|
15
18
|
/**
|
|
16
19
|
* A runner class that handles
|
|
17
20
|
*/
|
|
18
21
|
class ProgramBuilder {
|
|
19
|
-
constructor() {
|
|
22
|
+
constructor(options) {
|
|
23
|
+
var _a;
|
|
20
24
|
/**
|
|
21
25
|
* Determines whether the console should be cleared after a run (true for cli, false for languageserver)
|
|
22
26
|
*/
|
|
23
27
|
this.allowConsoleClearing = true;
|
|
28
|
+
this.options = util_1.util.normalizeConfig({});
|
|
24
29
|
this.isRunning = false;
|
|
25
|
-
this.logger = new Logger_1.Logger();
|
|
26
|
-
this.plugins = new PluginInterface_1.default([], this.logger);
|
|
27
30
|
this.fileResolvers = [];
|
|
28
|
-
|
|
29
|
-
* A list of diagnostics that are always added to the `getDiagnostics()` call.
|
|
30
|
-
*/
|
|
31
|
-
this.staticDiagnostics = [];
|
|
31
|
+
this.diagnostics = new DiagnosticManager_1.DiagnosticManager();
|
|
32
32
|
/**
|
|
33
33
|
* A method that is used to cancel a previous run task.
|
|
34
34
|
* Does nothing if previous run has completed or was already canceled
|
|
@@ -36,110 +36,154 @@ class ProgramBuilder {
|
|
|
36
36
|
this.cancelLastRun = () => {
|
|
37
37
|
return Promise.resolve();
|
|
38
38
|
};
|
|
39
|
+
this.buildThrottler = new Throttler_1.Throttler(0);
|
|
40
|
+
this.logger = (_a = options === null || options === void 0 ? void 0 : options.logger) !== null && _a !== void 0 ? _a : (0, logging_1.createLogger)();
|
|
41
|
+
this.plugins = new PluginInterface_1.default([], { logger: this.logger });
|
|
39
42
|
//add the default file resolver (used to load source file contents).
|
|
40
43
|
this.addFileResolver((filePath) => {
|
|
41
|
-
return fsExtra.readFile(filePath)
|
|
42
|
-
return value.toString();
|
|
43
|
-
});
|
|
44
|
+
return fsExtra.readFile(filePath);
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Add file resolvers that will be able to provide file contents before loading from the file system
|
|
49
|
+
* @param fileResolvers a list of file resolvers
|
|
50
|
+
*/
|
|
51
|
+
addFileResolver(...fileResolvers) {
|
|
52
|
+
this.fileResolvers.push(...fileResolvers);
|
|
48
53
|
}
|
|
49
54
|
/**
|
|
50
55
|
* Get the contents of the specified file as a string.
|
|
51
56
|
* This walks backwards through the file resolvers until we get a value.
|
|
52
57
|
* This allow the language server to provide file contents directly from memory.
|
|
53
|
-
* @param srcPath The absolute path to the source file on disk
|
|
54
|
-
* @param normalizePath should this function repair and standardize the path? Passing false should have a performance boost if you can guarantee your path is already sanitized
|
|
55
58
|
*/
|
|
56
|
-
async getFileContents(srcPath
|
|
57
|
-
|
|
58
|
-
srcPath = util_1.util.standardizePath(srcPath);
|
|
59
|
-
}
|
|
59
|
+
async getFileContents(srcPath) {
|
|
60
|
+
srcPath = (0, util_1.standardizePath) `${srcPath}`;
|
|
60
61
|
let reversedResolvers = [...this.fileResolvers].reverse();
|
|
61
62
|
for (let fileResolver of reversedResolvers) {
|
|
62
63
|
let result = await fileResolver(srcPath);
|
|
63
|
-
if (typeof result === 'string') {
|
|
64
|
+
if (typeof result === 'string' || Buffer.isBuffer(result)) {
|
|
64
65
|
return result;
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
throw new Error(`Could not load file "${srcPath}"`);
|
|
68
69
|
}
|
|
69
|
-
/**
|
|
70
|
-
* @param srcPath The absolute path to the source file on disk
|
|
71
|
-
*/
|
|
72
70
|
addDiagnostic(srcPath, diagnostic) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
if (!this.program) {
|
|
72
|
+
throw new Error('Cannot call `ProgramBuilder.addDiagnostic` before `ProgramBuilder.run()`');
|
|
73
|
+
}
|
|
74
|
+
if (!diagnostic.location) {
|
|
75
|
+
diagnostic.location = {
|
|
76
|
+
uri: util_1.util.pathToUri(srcPath),
|
|
77
|
+
range: util_1.util.createRange(0, 0, 0, 0)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
diagnostic.location.uri = util_1.util.pathToUri(srcPath);
|
|
82
|
+
}
|
|
83
|
+
this.diagnostics.register(diagnostic, { tags: ['ProgramBuilder'] });
|
|
78
84
|
}
|
|
79
85
|
getDiagnostics() {
|
|
80
|
-
|
|
81
|
-
return [
|
|
82
|
-
...this.staticDiagnostics,
|
|
83
|
-
...((_b = (_a = this.program) === null || _a === void 0 ? void 0 : _a.getDiagnostics()) !== null && _b !== void 0 ? _b : [])
|
|
84
|
-
];
|
|
86
|
+
return this.diagnostics.getDiagnostics();
|
|
85
87
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
this.isRunning = true;
|
|
88
|
+
/**
|
|
89
|
+
* Load the project and all the files, but don't run the validation, transpile, or watch cycles
|
|
90
|
+
*/
|
|
91
|
+
async load(options) {
|
|
92
|
+
var _a, _b;
|
|
92
93
|
try {
|
|
93
94
|
this.options = util_1.util.normalizeAndResolveConfig(options);
|
|
95
|
+
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.logLevel) !== undefined) {
|
|
96
|
+
this.logger.logLevel = (_b = this.options) === null || _b === void 0 ? void 0 : _b.logLevel;
|
|
97
|
+
}
|
|
98
|
+
if (this.options.noProject) {
|
|
99
|
+
this.logger.log(`'noProject' flag is set so bsconfig.json loading is disabled'`);
|
|
100
|
+
}
|
|
101
|
+
else if (this.options.project) {
|
|
102
|
+
this.logger.log(`Using config file: "${this.options.project}"`);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
this.logger.log(`No bsconfig.json file found, using default options`);
|
|
106
|
+
}
|
|
107
|
+
this.loadRequires();
|
|
94
108
|
this.loadPlugins();
|
|
95
109
|
}
|
|
96
110
|
catch (e) {
|
|
97
|
-
|
|
111
|
+
//For now, just use a default options object so we have a functioning program
|
|
112
|
+
this.options = util_1.util.normalizeConfig({
|
|
113
|
+
showDiagnosticsInConsole: options === null || options === void 0 ? void 0 : options.showDiagnosticsInConsole
|
|
114
|
+
});
|
|
115
|
+
if ((e === null || e === void 0 ? void 0 : e.location) && e.message && e.code) {
|
|
98
116
|
let err = e;
|
|
99
|
-
this.
|
|
117
|
+
this.diagnostics.register(err);
|
|
100
118
|
}
|
|
101
119
|
else {
|
|
102
120
|
//if this is not a diagnostic, something else is wrong...
|
|
103
121
|
throw e;
|
|
104
122
|
}
|
|
105
123
|
this.printDiagnostics();
|
|
106
|
-
//we added diagnostics, so hopefully that draws attention to the underlying issues.
|
|
107
|
-
//For now, just use a default options object so we have a functioning program
|
|
108
|
-
this.options = util_1.util.normalizeConfig({});
|
|
109
124
|
}
|
|
110
125
|
this.logger.logLevel = this.options.logLevel;
|
|
111
|
-
this.
|
|
126
|
+
this.createProgram();
|
|
112
127
|
//parse every file in the entire project
|
|
113
|
-
await this.
|
|
128
|
+
await this.loadFiles();
|
|
129
|
+
}
|
|
130
|
+
async run(options) {
|
|
131
|
+
if (options === null || options === void 0 ? void 0 : options.logLevel) {
|
|
132
|
+
this.logger.logLevel = options.logLevel;
|
|
133
|
+
}
|
|
134
|
+
if (this.isRunning) {
|
|
135
|
+
throw new Error('Server is already running');
|
|
136
|
+
}
|
|
137
|
+
this.isRunning = true;
|
|
138
|
+
await this.load(options);
|
|
114
139
|
if (this.options.watch) {
|
|
115
140
|
this.logger.log('Starting compilation in watch mode...');
|
|
116
|
-
await this.runOnce(
|
|
141
|
+
await this.runOnce({
|
|
142
|
+
validate: options === null || options === void 0 ? void 0 : options.validate,
|
|
143
|
+
noEmit: options === null || options === void 0 ? void 0 : options.noEmit
|
|
144
|
+
});
|
|
117
145
|
this.enableWatchMode();
|
|
118
146
|
}
|
|
119
147
|
else {
|
|
120
|
-
await this.runOnce(
|
|
148
|
+
await this.runOnce({
|
|
149
|
+
validate: options === null || options === void 0 ? void 0 : options.validate,
|
|
150
|
+
noEmit: options === null || options === void 0 ? void 0 : options.noEmit
|
|
151
|
+
});
|
|
121
152
|
}
|
|
122
153
|
}
|
|
123
154
|
createProgram() {
|
|
124
|
-
|
|
125
|
-
this.plugins.emit('
|
|
155
|
+
this.program = new Program_1.Program(this.options, this.logger, this.plugins, this.diagnostics);
|
|
156
|
+
this.plugins.emit('provideProgram', {
|
|
126
157
|
builder: this,
|
|
127
|
-
program: program
|
|
158
|
+
program: this.program
|
|
128
159
|
});
|
|
129
|
-
|
|
160
|
+
this.plugins.emit('afterProvideProgram', {
|
|
161
|
+
builder: this,
|
|
162
|
+
program: this.program
|
|
163
|
+
});
|
|
164
|
+
return this.program;
|
|
130
165
|
}
|
|
131
166
|
loadPlugins() {
|
|
132
|
-
var _a, _b, _c;
|
|
167
|
+
var _a, _b, _c, _d;
|
|
133
168
|
const cwd = (_a = this.options.cwd) !== null && _a !== void 0 ? _a : process.cwd();
|
|
134
|
-
const plugins = util_1.util.loadPlugins(cwd, this.options.plugins, (pathOrModule, err) => this.logger.error(`Error when loading plugin '${pathOrModule}':`, err));
|
|
135
|
-
this.logger.log(`Loading ${(
|
|
169
|
+
const plugins = util_1.util.loadPlugins(cwd, (_b = this.options.plugins) !== null && _b !== void 0 ? _b : [], (pathOrModule, err) => this.logger.error(`Error when loading plugin '${pathOrModule}':`, err));
|
|
170
|
+
this.logger.log(`Loading ${(_d = (_c = this.options.plugins) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0} plugins for cwd "${cwd}"`, this.options.plugins);
|
|
136
171
|
for (let plugin of plugins) {
|
|
137
172
|
this.plugins.add(plugin);
|
|
138
173
|
}
|
|
139
|
-
this.plugins.emit('
|
|
174
|
+
this.plugins.emit('beforeProvideProgram', {
|
|
140
175
|
builder: this
|
|
141
176
|
});
|
|
142
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* `require()` every options.require path
|
|
180
|
+
*/
|
|
181
|
+
loadRequires() {
|
|
182
|
+
var _a;
|
|
183
|
+
for (const dep of (_a = this.options.require) !== null && _a !== void 0 ? _a : []) {
|
|
184
|
+
requireRelative(dep, this.options.cwd);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
143
187
|
clearConsole() {
|
|
144
188
|
if (this.allowConsoleClearing) {
|
|
145
189
|
util_1.util.clearConsole();
|
|
@@ -154,7 +198,7 @@ class ProgramBuilder {
|
|
|
154
198
|
this.watchInterval = setInterval(() => { }, 1073741824);
|
|
155
199
|
//clear the console
|
|
156
200
|
this.clearConsole();
|
|
157
|
-
let fileObjects = rokuDeploy.normalizeFilesArray(this.options.files ? this.options.files : []);
|
|
201
|
+
let fileObjects = roku_deploy_1.rokuDeploy.normalizeFilesArray(this.options.files ? this.options.files : []);
|
|
158
202
|
//add each set of files to the file watcher
|
|
159
203
|
for (let fileObject of fileObjects) {
|
|
160
204
|
let src = typeof fileObject === 'string' ? fileObject : fileObject.src;
|
|
@@ -168,15 +212,18 @@ class ProgramBuilder {
|
|
|
168
212
|
}, 50);
|
|
169
213
|
//on any file watcher event
|
|
170
214
|
this.watcher.on('all', async (event, thePath) => {
|
|
171
|
-
|
|
215
|
+
if (!this.program) {
|
|
216
|
+
throw new Error('Internal invariant exception: somehow file watcher ran before `ProgramBuilder.run()`');
|
|
217
|
+
}
|
|
218
|
+
thePath = (0, util_1.standardizePath) `${path.resolve(this.rootDir, thePath)}`;
|
|
172
219
|
if (event === 'add' || event === 'change') {
|
|
173
220
|
const fileObj = {
|
|
174
221
|
src: thePath,
|
|
175
|
-
dest: rokuDeploy.getDestPath(thePath, this.program.options.files,
|
|
222
|
+
dest: roku_deploy_1.rokuDeploy.getDestPath(thePath, this.program.options.files,
|
|
176
223
|
//some shells will toTowerCase the drive letter, so do it to rootDir for consistency
|
|
177
224
|
util_1.util.driveLetterToLower(this.rootDir))
|
|
178
225
|
};
|
|
179
|
-
this.program.setFile(fileObj, await this.getFileContents(fileObj.src
|
|
226
|
+
this.program.setFile(fileObj, await this.getFileContents(fileObj.src));
|
|
180
227
|
}
|
|
181
228
|
else if (event === 'unlink') {
|
|
182
229
|
this.program.removeFile(thePath);
|
|
@@ -189,19 +236,26 @@ class ProgramBuilder {
|
|
|
189
236
|
* The rootDir for this program.
|
|
190
237
|
*/
|
|
191
238
|
get rootDir() {
|
|
239
|
+
if (!this.program) {
|
|
240
|
+
throw new Error('Cannot access `ProgramBuilder.rootDir` until after `ProgramBuilder.run()`');
|
|
241
|
+
}
|
|
192
242
|
return this.program.options.rootDir;
|
|
193
243
|
}
|
|
194
244
|
/**
|
|
195
245
|
* Run the entire process exactly one time.
|
|
196
246
|
*/
|
|
197
|
-
runOnce() {
|
|
247
|
+
runOnce(options) {
|
|
198
248
|
//clear the console
|
|
199
249
|
this.clearConsole();
|
|
200
250
|
let cancellationToken = { isCanceled: false };
|
|
201
251
|
//wait for the previous run to complete
|
|
202
252
|
let runPromise = this.cancelLastRun().then(() => {
|
|
203
253
|
//start the new run
|
|
204
|
-
return this._runOnce(
|
|
254
|
+
return this._runOnce({
|
|
255
|
+
cancellationToken: cancellationToken,
|
|
256
|
+
validate: options === null || options === void 0 ? void 0 : options.validate,
|
|
257
|
+
noEmit: options === null || options === void 0 ? void 0 : options.noEmit
|
|
258
|
+
});
|
|
205
259
|
});
|
|
206
260
|
//a function used to cancel this run
|
|
207
261
|
this.cancelLastRun = () => {
|
|
@@ -211,8 +265,8 @@ class ProgramBuilder {
|
|
|
211
265
|
return runPromise;
|
|
212
266
|
}
|
|
213
267
|
printDiagnostics(diagnostics) {
|
|
214
|
-
var _a, _b;
|
|
215
|
-
if (this.options.showDiagnosticsInConsole === false) {
|
|
268
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
269
|
+
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.showDiagnosticsInConsole) === false) {
|
|
216
270
|
return;
|
|
217
271
|
}
|
|
218
272
|
if (!diagnostics) {
|
|
@@ -221,54 +275,70 @@ class ProgramBuilder {
|
|
|
221
275
|
//group the diagnostics by file
|
|
222
276
|
let diagnosticsByFile = {};
|
|
223
277
|
for (let diagnostic of diagnostics) {
|
|
224
|
-
|
|
225
|
-
|
|
278
|
+
const diagnosticFileKey = (_c = (_b = diagnostic.location) === null || _b === void 0 ? void 0 : _b.uri) !== null && _c !== void 0 ? _c : 'no-uri';
|
|
279
|
+
if (!diagnosticsByFile[diagnosticFileKey]) {
|
|
280
|
+
diagnosticsByFile[diagnosticFileKey] = [];
|
|
226
281
|
}
|
|
227
|
-
diagnosticsByFile[
|
|
282
|
+
diagnosticsByFile[diagnosticFileKey].push(diagnostic);
|
|
228
283
|
}
|
|
229
284
|
//get printing options
|
|
230
285
|
const options = diagnosticUtils.getPrintDiagnosticOptions(this.options);
|
|
231
286
|
const { cwd, emitFullPaths } = options;
|
|
232
|
-
let
|
|
233
|
-
for (let
|
|
234
|
-
let diagnosticsForFile = diagnosticsByFile[
|
|
287
|
+
let fileUris = Object.keys(diagnosticsByFile).sort();
|
|
288
|
+
for (let fileUri of fileUris) {
|
|
289
|
+
let diagnosticsForFile = diagnosticsByFile[fileUri];
|
|
235
290
|
//sort the diagnostics in line and column order
|
|
236
291
|
let sortedDiagnostics = diagnosticsForFile.sort((a, b) => {
|
|
237
|
-
|
|
238
|
-
|
|
292
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
293
|
+
return (((_c = (_b = (_a = a.location) === null || _a === void 0 ? void 0 : _a.range) === null || _b === void 0 ? void 0 : _b.start.line) !== null && _c !== void 0 ? _c : -1) - ((_f = (_e = (_d = b.location) === null || _d === void 0 ? void 0 : _d.range) === null || _e === void 0 ? void 0 : _e.start.line) !== null && _f !== void 0 ? _f : -1) ||
|
|
294
|
+
((_j = (_h = (_g = a.location) === null || _g === void 0 ? void 0 : _g.range) === null || _h === void 0 ? void 0 : _h.start.character) !== null && _j !== void 0 ? _j : -1) - ((_m = (_l = (_k = b.location) === null || _k === void 0 ? void 0 : _k.range) === null || _l === void 0 ? void 0 : _l.start.character) !== null && _m !== void 0 ? _m : -1));
|
|
239
295
|
});
|
|
240
|
-
let filePath =
|
|
296
|
+
let filePath = util_1.util.uriToPath(fileUri);
|
|
241
297
|
if (!emitFullPaths) {
|
|
242
298
|
filePath = path.relative(cwd, filePath);
|
|
243
299
|
}
|
|
244
300
|
//load the file text
|
|
245
|
-
const file = this.program.getFile(
|
|
301
|
+
const file = (_d = this.program) === null || _d === void 0 ? void 0 : _d.getFile(fileUri);
|
|
246
302
|
//get the file's in-memory contents if available
|
|
247
|
-
const lines = (
|
|
303
|
+
const lines = (_f = (_e = file === null || file === void 0 ? void 0 : file.fileContents) === null || _e === void 0 ? void 0 : _e.split(/\r?\n/g)) !== null && _f !== void 0 ? _f : [];
|
|
248
304
|
for (let diagnostic of sortedDiagnostics) {
|
|
249
305
|
//default the severity to error if undefined
|
|
250
306
|
let severity = typeof diagnostic.severity === 'number' ? diagnostic.severity : vscode_languageserver_1.DiagnosticSeverity.Error;
|
|
307
|
+
let relatedInformation = ((_h = (_g = util_1.util.toDiagnostic(diagnostic, diagnostic.source)) === null || _g === void 0 ? void 0 : _g.relatedInformation) !== null && _h !== void 0 ? _h : []).map(x => {
|
|
308
|
+
var _a;
|
|
309
|
+
let relatedInfoFilePath = util_1.util.uriToPath((_a = x.location) === null || _a === void 0 ? void 0 : _a.uri);
|
|
310
|
+
if (!emitFullPaths) {
|
|
311
|
+
relatedInfoFilePath = path.relative(cwd, relatedInfoFilePath);
|
|
312
|
+
}
|
|
313
|
+
return {
|
|
314
|
+
filePath: relatedInfoFilePath,
|
|
315
|
+
range: x.location.range,
|
|
316
|
+
message: x.message
|
|
317
|
+
};
|
|
318
|
+
});
|
|
251
319
|
//format output
|
|
252
|
-
diagnosticUtils.printDiagnostic(options, severity, filePath, lines, diagnostic);
|
|
320
|
+
diagnosticUtils.printDiagnostic(options, severity, filePath, lines, diagnostic, relatedInformation);
|
|
253
321
|
}
|
|
254
322
|
}
|
|
255
323
|
}
|
|
256
324
|
/**
|
|
257
|
-
* Run the process once, allowing
|
|
325
|
+
* Run the process once, allowing it to be cancelled.
|
|
258
326
|
* NOTE: This should only be called by `runOnce`.
|
|
259
|
-
* @param cancellationToken
|
|
260
327
|
*/
|
|
261
|
-
async _runOnce(
|
|
328
|
+
async _runOnce(options) {
|
|
329
|
+
var _a, _b, _c;
|
|
262
330
|
let wereDiagnosticsPrinted = false;
|
|
263
331
|
try {
|
|
264
332
|
//maybe cancel?
|
|
265
|
-
if (cancellationToken.isCanceled === true) {
|
|
333
|
+
if (((_a = options === null || options === void 0 ? void 0 : options.cancellationToken) === null || _a === void 0 ? void 0 : _a.isCanceled) === true) {
|
|
266
334
|
return -1;
|
|
267
335
|
}
|
|
268
|
-
//validate program
|
|
269
|
-
|
|
336
|
+
//validate program. false means no, everything else (including missing) means true
|
|
337
|
+
if ((options === null || options === void 0 ? void 0 : options.validate) !== false) {
|
|
338
|
+
this.validateProject();
|
|
339
|
+
}
|
|
270
340
|
//maybe cancel?
|
|
271
|
-
if (cancellationToken.isCanceled === true) {
|
|
341
|
+
if (((_b = options === null || options === void 0 ? void 0 : options.cancellationToken) === null || _b === void 0 ? void 0 : _b.isCanceled) === true) {
|
|
272
342
|
return -1;
|
|
273
343
|
}
|
|
274
344
|
const diagnostics = this.getDiagnostics();
|
|
@@ -279,14 +349,13 @@ class ProgramBuilder {
|
|
|
279
349
|
this.logger.log(`Found ${errorCount} ${errorCount === 1 ? 'error' : 'errors'}`);
|
|
280
350
|
return errorCount;
|
|
281
351
|
}
|
|
282
|
-
|
|
283
|
-
|
|
352
|
+
if (options.noEmit !== true) {
|
|
353
|
+
await this.transpile();
|
|
354
|
+
}
|
|
284
355
|
//maybe cancel?
|
|
285
|
-
if (cancellationToken.isCanceled === true) {
|
|
356
|
+
if (((_c = options === null || options === void 0 ? void 0 : options.cancellationToken) === null || _c === void 0 ? void 0 : _c.isCanceled) === true) {
|
|
286
357
|
return -1;
|
|
287
358
|
}
|
|
288
|
-
//deploy the package
|
|
289
|
-
await this.deployPackageIfEnabled();
|
|
290
359
|
return 0;
|
|
291
360
|
}
|
|
292
361
|
catch (e) {
|
|
@@ -296,120 +365,97 @@ class ProgramBuilder {
|
|
|
296
365
|
throw e;
|
|
297
366
|
}
|
|
298
367
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
368
|
+
/**
|
|
369
|
+
* Build the entire project and place the contents into the staging directory
|
|
370
|
+
*/
|
|
371
|
+
async build() {
|
|
372
|
+
await this.buildThrottler.run(async () => {
|
|
373
|
+
//get every file referenced by the files array
|
|
374
|
+
let fileMap = Object.values(this.program.files).map(x => {
|
|
375
|
+
return {
|
|
376
|
+
src: x.srcPath,
|
|
377
|
+
dest: x.destPath
|
|
378
|
+
};
|
|
379
|
+
});
|
|
380
|
+
//remove files currently loaded in the program, we will transpile those instead (even if just for source maps)
|
|
381
|
+
let filteredFileMap = [];
|
|
382
|
+
for (let fileEntry of fileMap) {
|
|
383
|
+
if (this.program.hasFile(fileEntry.src) === false) {
|
|
384
|
+
filteredFileMap.push(fileEntry);
|
|
385
|
+
}
|
|
308
386
|
}
|
|
309
|
-
|
|
387
|
+
await this.logger.time(logging_1.LogLevel.log, ['Building'], async () => {
|
|
388
|
+
//transpile any brighterscript files
|
|
389
|
+
await this.program.build();
|
|
390
|
+
});
|
|
391
|
+
});
|
|
310
392
|
}
|
|
311
393
|
/**
|
|
312
394
|
* Transpiles the entire program into the staging folder
|
|
395
|
+
* @deprecated use `.build()` instead
|
|
313
396
|
*/
|
|
314
397
|
async transpile() {
|
|
315
|
-
|
|
316
|
-
return rokuDeploy.getOptions(Object.assign(Object.assign({}, this.options), { outDir: util_1.util.getOutDir(this.options), outFile: path.basename(this.options.outFile) }));
|
|
317
|
-
});
|
|
318
|
-
//get every file referenced by the files array
|
|
319
|
-
let fileEntries = await rokuDeploy.getFilePaths(options.files, options.rootDir);
|
|
320
|
-
//remove files currently loaded in the program, we will transpile those instead (even if just for source maps)
|
|
321
|
-
let filteredFileEntries = [];
|
|
322
|
-
for (let fileEntry of fileEntries) {
|
|
323
|
-
if (this.program.hasFile(fileEntry.src) === false) {
|
|
324
|
-
filteredFileEntries.push(fileEntry);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
this.plugins.emit('beforePrepublish', {
|
|
328
|
-
builder: this,
|
|
329
|
-
program: this.program,
|
|
330
|
-
files: filteredFileEntries
|
|
331
|
-
});
|
|
332
|
-
await this.logger.time(Logger_1.LogLevel.log, ['Copying to staging directory'], async () => {
|
|
333
|
-
//prepublish all non-program-loaded files to staging
|
|
334
|
-
await rokuDeploy.prepublishToStaging(Object.assign(Object.assign({}, options), { files: filteredFileEntries }));
|
|
335
|
-
});
|
|
336
|
-
this.plugins.emit('afterPrepublish', {
|
|
337
|
-
builder: this,
|
|
338
|
-
program: this.program,
|
|
339
|
-
files: filteredFileEntries
|
|
340
|
-
});
|
|
341
|
-
this.plugins.emit('beforePublish', {
|
|
342
|
-
builder: this,
|
|
343
|
-
program: this.program,
|
|
344
|
-
files: fileEntries
|
|
345
|
-
});
|
|
346
|
-
await this.logger.time(Logger_1.LogLevel.log, ['Transpiling'], async () => {
|
|
347
|
-
//transpile any brighterscript files
|
|
348
|
-
await this.program.transpile(fileEntries, options.stagingFolderPath);
|
|
349
|
-
});
|
|
350
|
-
this.plugins.emit('afterPublish', {
|
|
351
|
-
builder: this,
|
|
352
|
-
program: this.program,
|
|
353
|
-
files: fileEntries
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
async deployPackageIfEnabled() {
|
|
357
|
-
//deploy the project if configured to do so
|
|
358
|
-
if (this.options.deploy) {
|
|
359
|
-
await this.logger.time(Logger_1.LogLevel.log, ['Deploying package to', this.options.host], async () => {
|
|
360
|
-
await rokuDeploy.publish(Object.assign(Object.assign({}, this.options), { outDir: util_1.util.getOutDir(this.options), outFile: path.basename(this.options.outFile) }));
|
|
361
|
-
});
|
|
362
|
-
}
|
|
398
|
+
return this.build();
|
|
363
399
|
}
|
|
364
400
|
/**
|
|
365
|
-
*
|
|
401
|
+
* Load every file into the project
|
|
366
402
|
*/
|
|
367
|
-
async
|
|
368
|
-
await this.logger.time(
|
|
369
|
-
let
|
|
370
|
-
let files = await this.logger.time(Logger_1.LogLevel.debug, ['getFlePaths'], async () => {
|
|
403
|
+
async loadFiles() {
|
|
404
|
+
await this.logger.time(logging_1.LogLevel.log, ['load files'], async () => {
|
|
405
|
+
let files = await this.logger.time(logging_1.LogLevel.debug, ['getFilePaths'], async () => {
|
|
371
406
|
return util_1.util.getFilePaths(this.options);
|
|
372
407
|
});
|
|
373
|
-
this.logger.trace('ProgramBuilder.
|
|
408
|
+
this.logger.trace('ProgramBuilder.loadFiles() files:', files);
|
|
374
409
|
const typedefFiles = [];
|
|
375
|
-
const
|
|
410
|
+
const allOtherFiles = [];
|
|
411
|
+
let manifestFile = null;
|
|
376
412
|
for (const file of files) {
|
|
377
|
-
|
|
378
|
-
if (
|
|
413
|
+
// typedef files
|
|
414
|
+
if (/\.d\.bs$/i.test(file.dest)) {
|
|
379
415
|
typedefFiles.push(file);
|
|
416
|
+
// all other files
|
|
380
417
|
}
|
|
381
418
|
else {
|
|
382
|
-
|
|
419
|
+
if (/^manifest$/i.test(file.dest)) {
|
|
420
|
+
//manifest file
|
|
421
|
+
manifestFile = file;
|
|
422
|
+
}
|
|
423
|
+
allOtherFiles.push(file);
|
|
383
424
|
}
|
|
384
425
|
}
|
|
385
|
-
//
|
|
386
|
-
|
|
426
|
+
//load the manifest file first
|
|
427
|
+
if (manifestFile) {
|
|
428
|
+
this.program.loadManifest(manifestFile, false);
|
|
429
|
+
}
|
|
430
|
+
const loadFile = async (fileObj) => {
|
|
387
431
|
try {
|
|
388
432
|
this.program.setFile(fileObj, await this.getFileContents(fileObj.src));
|
|
389
433
|
}
|
|
390
434
|
catch (e) {
|
|
391
|
-
//log the error, but don't fail this process because the file might be fixable later
|
|
392
|
-
this.logger.log(e);
|
|
393
|
-
}
|
|
394
|
-
}));
|
|
395
|
-
const acceptableExtensions = ['.bs', '.brs', '.xml'];
|
|
396
|
-
//parse every file other than the type definitions
|
|
397
|
-
await Promise.all(nonTypedefFiles.map(async (fileObj) => {
|
|
398
|
-
try {
|
|
399
|
-
let fileExtension = path.extname(fileObj.src).toLowerCase();
|
|
400
|
-
//only process certain file types
|
|
401
|
-
if (acceptableExtensions.includes(fileExtension)) {
|
|
402
|
-
this.program.setFile(fileObj, await this.getFileContents(fileObj.src));
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
catch (e) {
|
|
406
|
-
//log the error, but don't fail this process because the file might be fixable later
|
|
407
|
-
this.logger.log(e);
|
|
435
|
+
this.logger.log(e); // log the error, but don't fail this process because the file might be fixable later
|
|
408
436
|
}
|
|
409
|
-
}
|
|
410
|
-
|
|
437
|
+
};
|
|
438
|
+
// preload every type definition file, which eliminates duplicate file loading
|
|
439
|
+
await Promise.all(typedefFiles.map(loadFile));
|
|
440
|
+
// load all other files
|
|
441
|
+
await Promise.all(allOtherFiles.map(loadFile));
|
|
411
442
|
});
|
|
412
443
|
}
|
|
444
|
+
/**
|
|
445
|
+
* Remove all files from the program that are in the specified folder path
|
|
446
|
+
* @param srcPath the path to the folder to remove
|
|
447
|
+
*/
|
|
448
|
+
removeFilesInFolder(srcPath) {
|
|
449
|
+
let removedSomeFiles = false;
|
|
450
|
+
for (let filePath in this.program.files) {
|
|
451
|
+
//if the file path starts with the parent path and the file path does not exactly match the folder path
|
|
452
|
+
if (filePath.startsWith(srcPath) && filePath !== srcPath) {
|
|
453
|
+
this.program.removeFile(filePath);
|
|
454
|
+
removedSomeFiles = true;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
return removedSomeFiles;
|
|
458
|
+
}
|
|
413
459
|
/**
|
|
414
460
|
* Scan every file and resolve all variable references.
|
|
415
461
|
* If no errors were encountered, return true. Otherwise return false.
|