brighterscript 0.66.0-alpha.1 → 0.66.0-alpha.11
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 +224 -10
- package/README.md +13 -3
- package/bsconfig.schema.json +15 -0
- 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 +25 -0
- package/dist/AstValidationSegmenter.js +150 -0
- package/dist/AstValidationSegmenter.js.map +1 -0
- package/dist/BsConfig.d.ts +13 -4
- package/dist/BusyStatusTracker.d.ts +31 -0
- package/dist/BusyStatusTracker.js +83 -0
- package/dist/BusyStatusTracker.js.map +1 -0
- package/dist/Cache.js +3 -3
- package/dist/Cache.js.map +1 -1
- package/dist/CacheVerifier.d.ts +0 -1
- package/dist/CodeActionUtil.d.ts +2 -2
- package/dist/CommentFlagProcessor.d.ts +4 -3
- package/dist/CommentFlagProcessor.js.map +1 -1
- package/dist/DiagnosticCollection.js +8 -5
- package/dist/DiagnosticCollection.js.map +1 -1
- package/dist/DiagnosticMessages.d.ts +34 -4
- package/dist/DiagnosticMessages.js +59 -4
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/FunctionScope.d.ts +1 -1
- package/dist/LanguageServer.d.ts +23 -1
- package/dist/LanguageServer.js +139 -57
- package/dist/LanguageServer.js.map +1 -1
- package/dist/Logger.d.ts +3 -2
- package/dist/Logger.js +10 -2
- package/dist/Logger.js.map +1 -1
- package/dist/PluginInterface.d.ts +11 -2
- package/dist/PluginInterface.js +69 -10
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +138 -49
- package/dist/Program.js +644 -349
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +10 -4
- package/dist/ProgramBuilder.js +76 -74
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +52 -49
- package/dist/Scope.js +298 -274
- package/dist/Scope.js.map +1 -1
- package/dist/SymbolTable.d.ts +35 -14
- package/dist/SymbolTable.js +90 -29
- package/dist/SymbolTable.js.map +1 -1
- package/dist/Throttler.d.ts +12 -0
- package/dist/Throttler.js +39 -0
- package/dist/Throttler.js.map +1 -1
- package/dist/XmlScope.d.ts +7 -4
- package/dist/XmlScope.js +52 -12
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/{AstEditor.d.ts → Editor.d.ts} +6 -1
- package/dist/astUtils/{AstEditor.js → Editor.js} +9 -3
- package/dist/astUtils/Editor.js.map +1 -0
- package/dist/astUtils/{AstEditor.spec.js → Editor.spec.js} +10 -6
- package/dist/astUtils/Editor.spec.js.map +1 -0
- package/dist/astUtils/creators.d.ts +3 -1
- package/dist/astUtils/creators.js +14 -4
- package/dist/astUtils/creators.js.map +1 -1
- package/dist/astUtils/reflection.d.ts +37 -9
- package/dist/astUtils/reflection.js +83 -14
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/reflection.spec.js +87 -5
- package/dist/astUtils/reflection.spec.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +14 -3
- package/dist/astUtils/visitors.js +22 -2
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/visitors.spec.js +58 -7
- package/dist/astUtils/visitors.spec.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +10 -2
- package/dist/bscPlugin/BscPlugin.js +24 -4
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/CallExpressionInfo.d.ts +3 -3
- package/dist/bscPlugin/CallExpressionInfo.js.map +1 -1
- 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/codeActions/CodeActionsProcessor.js +8 -8
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +4 -4
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +50 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.js +445 -23
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +1737 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.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 +7 -3
- package/dist/bscPlugin/hover/HoverProcessor.js +133 -103
- package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -1
- package/dist/bscPlugin/hover/HoverProcessor.spec.js +241 -29
- package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +43 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +22 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/serialize/BslibInjector.spec.js +19 -0
- package/dist/bscPlugin/serialize/BslibInjector.spec.js.map +1 -0
- package/dist/bscPlugin/serialize/BslibManager.d.ts +9 -0
- package/dist/bscPlugin/serialize/BslibManager.js +40 -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 +72 -0
- package/dist/bscPlugin/serialize/FileSerializer.js.map +1 -0
- package/dist/bscPlugin/transpile/{BrsFilePreTranspileProcessor.d.ts → BrsFileTranspileProcessor.d.ts} +4 -2
- package/dist/bscPlugin/transpile/{BrsFilePreTranspileProcessor.js → BrsFileTranspileProcessor.js} +29 -5
- 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 +41 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.d.ts +2 -2
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js.map +1 -1
- package/dist/bscPlugin/validation/BrsFileValidator.d.ts +0 -4
- package/dist/bscPlugin/validation/BrsFileValidator.js +34 -29
- package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
- package/dist/bscPlugin/validation/BrsFileValidator.spec.js +1 -1
- package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.d.ts +28 -7
- package/dist/bscPlugin/validation/ScopeValidator.js +393 -205
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.spec.d.ts +1 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.js +2038 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js +2 -2
- package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -1
- package/dist/cli.js +104 -13
- package/dist/cli.js.map +1 -1
- package/dist/deferred.d.ts +3 -3
- package/dist/deferred.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +8 -2
- package/dist/diagnosticUtils.js +45 -16
- package/dist/diagnosticUtils.js.map +1 -1
- package/dist/examples/plugins/removePrint.js +1 -1
- package/dist/examples/plugins/removePrint.js.map +1 -1
- package/dist/files/AssetFile.d.ts +26 -0
- package/dist/files/AssetFile.js +26 -0
- package/dist/files/AssetFile.js.map +1 -0
- package/dist/files/BrsFile.Class.spec.js +383 -56
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +73 -46
- package/dist/files/BrsFile.js +370 -534
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +1139 -682
- package/dist/files/BrsFile.spec.js.map +1 -1
- 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/File.d.ts +106 -0
- package/dist/files/File.js +16 -0
- package/dist/files/File.js.map +1 -0
- package/dist/files/LazyFileData.d.ts +20 -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 +56 -23
- package/dist/files/XmlFile.js +88 -60
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/files/XmlFile.spec.js +64 -93
- package/dist/files/XmlFile.spec.js.map +1 -1
- package/dist/files/tests/imports.spec.js +21 -8
- package/dist/files/tests/imports.spec.js.map +1 -1
- package/dist/files/tests/optionalChaning.spec.js +14 -14
- package/dist/files/tests/optionalChaning.spec.js.map +1 -1
- package/dist/globalCallables.js +88 -84
- package/dist/globalCallables.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +389 -94
- package/dist/interfaces.js +13 -2
- package/dist/interfaces.js.map +1 -1
- package/dist/lexer/Lexer.d.ts +12 -0
- package/dist/lexer/Lexer.js +28 -8
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/lexer/Lexer.spec.js +40 -0
- package/dist/lexer/Lexer.spec.js.map +1 -1
- package/dist/lexer/Token.d.ts +4 -0
- package/dist/lexer/Token.js.map +1 -1
- package/dist/lexer/TokenKind.d.ts +5 -0
- package/dist/lexer/TokenKind.js +14 -2
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/parser/AstNode.d.ts +9 -2
- package/dist/parser/AstNode.js +16 -0
- package/dist/parser/AstNode.js.map +1 -1
- package/dist/parser/BrsTranspileState.d.ts +3 -2
- package/dist/parser/BrsTranspileState.js +3 -2
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +21 -5
- package/dist/parser/Expression.js +130 -35
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.Class.spec.js +103 -1
- package/dist/parser/Parser.Class.spec.js.map +1 -1
- package/dist/parser/Parser.d.ts +7 -0
- package/dist/parser/Parser.js +117 -21
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Parser.spec.js +557 -5
- package/dist/parser/Parser.spec.js.map +1 -1
- package/dist/parser/SGParser.d.ts +4 -4
- package/dist/parser/SGParser.js +3 -3
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGParser.spec.js +2 -2
- package/dist/parser/SGParser.spec.js.map +1 -1
- package/dist/parser/SGTypes.d.ts +2 -2
- package/dist/parser/Statement.d.ts +37 -12
- package/dist/parser/Statement.js +153 -46
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/tests/Parser.spec.js +2 -1
- package/dist/parser/tests/Parser.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/For.spec.js +16 -8
- package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/ForEach.spec.js +12 -6
- package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/While.spec.js +8 -4
- package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
- package/dist/parser/tests/expression/Call.spec.js +4 -4
- package/dist/parser/tests/expression/Call.spec.js.map +1 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +29 -29
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +10 -10
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +24 -24
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js +75 -36
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +36 -36
- package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
- 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/ConstStatement.spec.js +71 -22
- package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Continue.spec.js +2 -2
- package/dist/parser/tests/statement/Continue.spec.js.map +1 -1
- package/dist/parser/tests/statement/Enum.spec.js +38 -285
- package/dist/parser/tests/statement/Enum.spec.js.map +1 -1
- package/dist/parser/tests/statement/For.spec.js +6 -6
- package/dist/parser/tests/statement/For.spec.js.map +1 -1
- package/dist/parser/tests/statement/ForEach.spec.js +4 -4
- package/dist/parser/tests/statement/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/statement/InterfaceStatement.spec.js +26 -10
- package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +16 -13
- package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/ReturnStatement.spec.js +5 -3
- package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Set.spec.js +26 -13
- package/dist/parser/tests/statement/Set.spec.js.map +1 -1
- package/dist/preprocessor/Manifest.d.ts +1 -1
- package/dist/preprocessor/Manifest.js +2 -2
- package/dist/preprocessor/Manifest.js.map +1 -1
- package/dist/roku-types/data.json +244 -294
- package/dist/roku-types/index.d.ts +17 -38
- package/dist/types/ArrayType.d.ts +4 -1
- package/dist/types/ArrayType.js +46 -6
- package/dist/types/ArrayType.js.map +1 -1
- package/dist/types/ArrayType.spec.js +32 -3
- package/dist/types/ArrayType.spec.js.map +1 -1
- package/dist/types/AssociativeArrayType.d.ts +11 -0
- package/dist/types/AssociativeArrayType.js +52 -0
- package/dist/types/AssociativeArrayType.js.map +1 -0
- package/dist/types/BaseFunctionType.d.ts +9 -0
- package/dist/types/BaseFunctionType.js +25 -0
- package/dist/types/BaseFunctionType.js.map +1 -0
- package/dist/types/BooleanType.d.ts +2 -1
- package/dist/types/BooleanType.js +8 -2
- package/dist/types/BooleanType.js.map +1 -1
- package/dist/types/BscType.d.ts +10 -6
- package/dist/types/BscType.js +69 -16
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/BscTypeKind.d.ts +3 -0
- package/dist/types/BscTypeKind.js +3 -0
- package/dist/types/BscTypeKind.js.map +1 -1
- package/dist/types/BuiltInInterfaceAdder.d.ts +23 -0
- package/dist/types/BuiltInInterfaceAdder.js +164 -0
- package/dist/types/BuiltInInterfaceAdder.js.map +1 -0
- package/dist/types/BuiltInInterfaceAdder.spec.d.ts +1 -0
- package/dist/types/BuiltInInterfaceAdder.spec.js +116 -0
- package/dist/types/BuiltInInterfaceAdder.spec.js.map +1 -0
- package/dist/types/ClassType.d.ts +10 -4
- package/dist/types/ClassType.js +32 -5
- package/dist/types/ClassType.js.map +1 -1
- package/dist/types/ClassType.spec.js +5 -3
- package/dist/types/ClassType.spec.js.map +1 -1
- package/dist/types/ComponentType.d.ts +26 -0
- package/dist/types/ComponentType.js +83 -0
- package/dist/types/ComponentType.js.map +1 -0
- package/dist/types/DoubleType.d.ts +2 -1
- package/dist/types/DoubleType.js +9 -2
- package/dist/types/DoubleType.js.map +1 -1
- package/dist/types/DynamicType.d.ts +2 -2
- package/dist/types/DynamicType.js +3 -1
- package/dist/types/DynamicType.js.map +1 -1
- package/dist/types/EnumType.d.ts +24 -6
- package/dist/types/EnumType.js +29 -7
- package/dist/types/EnumType.js.map +1 -1
- package/dist/types/FloatType.d.ts +2 -1
- package/dist/types/FloatType.js +9 -2
- package/dist/types/FloatType.js.map +1 -1
- package/dist/types/FunctionType.d.ts +8 -20
- package/dist/types/FunctionType.js +17 -45
- package/dist/types/FunctionType.js.map +1 -1
- package/dist/types/InheritableType.d.ts +7 -4
- package/dist/types/InheritableType.js +67 -3
- package/dist/types/InheritableType.js.map +1 -1
- package/dist/types/IntegerType.d.ts +2 -1
- package/dist/types/IntegerType.js +9 -2
- package/dist/types/IntegerType.js.map +1 -1
- package/dist/types/InterfaceType.d.ts +6 -4
- package/dist/types/InterfaceType.js +8 -11
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/InterfaceType.spec.js +30 -2
- package/dist/types/InterfaceType.spec.js.map +1 -1
- package/dist/types/InvalidType.d.ts +2 -1
- package/dist/types/InvalidType.js +7 -1
- package/dist/types/InvalidType.js.map +1 -1
- package/dist/types/LongIntegerType.d.ts +2 -1
- package/dist/types/LongIntegerType.js +9 -2
- package/dist/types/LongIntegerType.js.map +1 -1
- package/dist/types/NamespaceType.d.ts +2 -1
- package/dist/types/NamespaceType.js +3 -0
- package/dist/types/NamespaceType.js.map +1 -1
- package/dist/types/ObjectType.d.ts +2 -2
- package/dist/types/ObjectType.js +5 -10
- package/dist/types/ObjectType.js.map +1 -1
- package/dist/types/ReferenceType.d.ts +15 -3
- package/dist/types/ReferenceType.js +173 -24
- package/dist/types/ReferenceType.js.map +1 -1
- package/dist/types/ReferenceType.spec.js +21 -6
- package/dist/types/ReferenceType.spec.js.map +1 -1
- package/dist/types/StringType.d.ts +2 -1
- package/dist/types/StringType.js +9 -2
- package/dist/types/StringType.js.map +1 -1
- package/dist/types/TypedFunctionType.d.ts +33 -0
- package/dist/types/TypedFunctionType.js +106 -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 +2 -1
- package/dist/types/UninitializedType.js +1 -1
- package/dist/types/UninitializedType.js.map +1 -1
- package/dist/types/UnionType.d.ts +4 -2
- package/dist/types/UnionType.js +36 -4
- package/dist/types/UnionType.js.map +1 -1
- package/dist/types/UnionType.spec.js +46 -19
- package/dist/types/UnionType.spec.js.map +1 -1
- package/dist/types/VoidType.d.ts +2 -1
- package/dist/types/VoidType.js +7 -2
- package/dist/types/VoidType.js.map +1 -1
- package/dist/types/helper.spec.js +15 -0
- package/dist/types/helper.spec.js.map +1 -1
- package/dist/types/helpers.d.ts +5 -0
- package/dist/types/helpers.js +50 -3
- package/dist/types/helpers.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/util.d.ts +71 -15
- package/dist/util.js +578 -150
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.d.ts +0 -1
- package/dist/validators/ClassValidator.js +0 -22
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +3 -2
- package/dist/astUtils/AstEditor.js.map +0 -1
- package/dist/astUtils/AstEditor.spec.js.map +0 -1
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +0 -1
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js +0 -31
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js.map +0 -1
- package/dist/types/FunctionType.spec.js +0 -23
- package/dist/types/FunctionType.spec.js.map +0 -1
- /package/dist/astUtils/{AstEditor.spec.d.ts → Editor.spec.d.ts} +0 -0
- /package/dist/bscPlugin/{transpile/BrsFilePreTranspileProcessor.spec.d.ts → completions/CompletionsProcessor.spec.d.ts} +0 -0
- /package/dist/{types/FunctionType.spec.d.ts → bscPlugin/serialize/BslibInjector.spec.d.ts} +0 -0
|
@@ -2,11 +2,11 @@ import type { CompilerPlugin } from './interfaces';
|
|
|
2
2
|
import type { Logger } from './Logger';
|
|
3
3
|
export declare type Arguments<T> = [T] extends [(...args: infer U) => any] ? U : [T] extends [void] ? [] : [T];
|
|
4
4
|
export default class PluginInterface<T extends CompilerPlugin = CompilerPlugin> {
|
|
5
|
-
private plugins;
|
|
6
5
|
constructor(plugins: CompilerPlugin[], options: {
|
|
7
6
|
logger: Logger;
|
|
8
7
|
suppressErrors?: boolean;
|
|
9
8
|
});
|
|
9
|
+
private plugins;
|
|
10
10
|
private logger;
|
|
11
11
|
/**
|
|
12
12
|
* Should plugin errors cause the program to fail, or should they be caught and simply logged
|
|
@@ -15,7 +15,11 @@ export default class PluginInterface<T extends CompilerPlugin = CompilerPlugin>
|
|
|
15
15
|
/**
|
|
16
16
|
* Call `event` on plugins
|
|
17
17
|
*/
|
|
18
|
-
emit<K extends keyof T & string>(event: K, ...args: Arguments<T[K]>):
|
|
18
|
+
emit<K extends keyof T & string>(event: K, ...args: Arguments<T[K]>): Arguments<T[K]>[0];
|
|
19
|
+
/**
|
|
20
|
+
* Call `event` on plugins, but allow the plugins to return promises that will be awaited before the next plugin is notified
|
|
21
|
+
*/
|
|
22
|
+
emitAsync<K extends keyof T & string>(event: K, ...args: Arguments<T[K]>): Promise<Arguments<T[K]>[0]>;
|
|
19
23
|
/**
|
|
20
24
|
* Add a plugin to the beginning of the list of plugins
|
|
21
25
|
*/
|
|
@@ -24,6 +28,11 @@ export default class PluginInterface<T extends CompilerPlugin = CompilerPlugin>
|
|
|
24
28
|
* Add a plugin to the end of the list of plugins
|
|
25
29
|
*/
|
|
26
30
|
add<T extends CompilerPlugin = CompilerPlugin>(plugin: T): T;
|
|
31
|
+
/**
|
|
32
|
+
* Find deprecated or removed historic plugin hooks, and warn about them.
|
|
33
|
+
* Some events can be forwards-converted
|
|
34
|
+
*/
|
|
35
|
+
private sanitizePlugin;
|
|
27
36
|
has(plugin: CompilerPlugin): boolean;
|
|
28
37
|
remove<T extends CompilerPlugin = CompilerPlugin>(plugin: T): T;
|
|
29
38
|
/**
|
package/dist/PluginInterface.js
CHANGED
|
@@ -3,34 +3,53 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const Logger_1 = require("./Logger");
|
|
4
4
|
class PluginInterface {
|
|
5
5
|
constructor(plugins, options) {
|
|
6
|
-
this.plugins =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.logger = options === null || options === void 0 ? void 0 : options.logger;
|
|
12
|
-
this.suppressErrors = (options === null || options === void 0 ? void 0 : options.suppressErrors) === false ? false : true;
|
|
6
|
+
this.plugins = [];
|
|
7
|
+
this.logger = options === null || options === void 0 ? void 0 : options.logger;
|
|
8
|
+
this.suppressErrors = (options === null || options === void 0 ? void 0 : options.suppressErrors) === false ? false : true;
|
|
9
|
+
for (const plugin of plugins) {
|
|
10
|
+
this.add(plugin);
|
|
13
11
|
}
|
|
14
12
|
}
|
|
15
13
|
/**
|
|
16
14
|
* Call `event` on plugins
|
|
17
15
|
*/
|
|
18
16
|
emit(event, ...args) {
|
|
17
|
+
var _a, _b;
|
|
19
18
|
for (let plugin of this.plugins) {
|
|
20
19
|
if (plugin[event]) {
|
|
21
20
|
try {
|
|
22
|
-
this.logger.time(Logger_1.LogLevel.debug, [plugin.name, event], () => {
|
|
21
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.time(Logger_1.LogLevel.debug, [plugin.name, event], () => {
|
|
23
22
|
plugin[event](...args);
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
25
|
catch (err) {
|
|
27
|
-
this.logger.error(`Error when calling plugin ${plugin.name}.${event}:`, err);
|
|
26
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.error(`Error when calling plugin ${plugin.name}.${event}:`, err);
|
|
28
27
|
if (!this.suppressErrors) {
|
|
29
28
|
throw err;
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
}
|
|
33
|
+
return args[0];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Call `event` on plugins, but allow the plugins to return promises that will be awaited before the next plugin is notified
|
|
37
|
+
*/
|
|
38
|
+
async emitAsync(event, ...args) {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
for (let plugin of this.plugins) {
|
|
41
|
+
if (plugin[event]) {
|
|
42
|
+
try {
|
|
43
|
+
await ((_a = this.logger) === null || _a === void 0 ? void 0 : _a.time(Logger_1.LogLevel.debug, [plugin.name, event], async () => {
|
|
44
|
+
await Promise.resolve(plugin[event](...args));
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.error(`Error when calling plugin ${plugin.name}.${event}:`, err);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return args[0];
|
|
34
53
|
}
|
|
35
54
|
/**
|
|
36
55
|
* Add a plugin to the beginning of the list of plugins
|
|
@@ -46,16 +65,56 @@ class PluginInterface {
|
|
|
46
65
|
*/
|
|
47
66
|
add(plugin) {
|
|
48
67
|
if (!this.has(plugin)) {
|
|
68
|
+
this.sanitizePlugin(plugin);
|
|
49
69
|
this.plugins.push(plugin);
|
|
50
70
|
}
|
|
51
71
|
return plugin;
|
|
52
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Find deprecated or removed historic plugin hooks, and warn about them.
|
|
75
|
+
* Some events can be forwards-converted
|
|
76
|
+
*/
|
|
77
|
+
sanitizePlugin(plugin) {
|
|
78
|
+
var _a, _b, _c;
|
|
79
|
+
const removedHooks = [
|
|
80
|
+
'beforePrepublish',
|
|
81
|
+
'afterPrepublish'
|
|
82
|
+
];
|
|
83
|
+
for (const removedHook of removedHooks) {
|
|
84
|
+
if (plugin[removedHook]) {
|
|
85
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.error(`Plugin "${plugin.name}": event ${removedHook} is no longer supported and will never be called`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const upgradeWithWarn = {
|
|
89
|
+
beforePublish: 'beforeSerializeProgram',
|
|
90
|
+
afterPublish: 'afterSerializeProgram',
|
|
91
|
+
beforeProgramTranspile: 'beforeBuildProgram',
|
|
92
|
+
afterProgramTranspile: 'afterBuildProgram',
|
|
93
|
+
beforeFileParse: 'beforeProvideFile',
|
|
94
|
+
afterFileParse: 'afterProvideFile',
|
|
95
|
+
beforeFileTranspile: 'beforePrepareFile',
|
|
96
|
+
afterFileTranspile: 'afterPrepareFile',
|
|
97
|
+
beforeFileDispose: 'beforeFileRemove',
|
|
98
|
+
afterFileDispose: 'afterFileRemove'
|
|
99
|
+
};
|
|
100
|
+
for (const [oldEvent, newEvent] of Object.entries(upgradeWithWarn)) {
|
|
101
|
+
if (plugin[oldEvent]) {
|
|
102
|
+
if (!plugin[newEvent]) {
|
|
103
|
+
plugin[newEvent] = plugin[oldEvent];
|
|
104
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.warn(`Plugin '${plugin.name}': event '${oldEvent}' is no longer supported. It has been converted to '${newEvent}' but you may encounter issues as their signatures do not match.`);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
(_c = this.logger) === null || _c === void 0 ? void 0 : _c.warn(`Plugin "${plugin.name}": event '${oldEvent}' is no longer supported and will never be called`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
53
112
|
has(plugin) {
|
|
54
113
|
return this.plugins.includes(plugin);
|
|
55
114
|
}
|
|
56
115
|
remove(plugin) {
|
|
57
116
|
if (this.has(plugin)) {
|
|
58
|
-
this.plugins.splice(this.plugins.indexOf(plugin));
|
|
117
|
+
this.plugins.splice(this.plugins.indexOf(plugin), 1);
|
|
59
118
|
}
|
|
60
119
|
return plugin;
|
|
61
120
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginInterface.js","sourceRoot":"","sources":["../src/PluginInterface.ts"],"names":[],"mappings":";;AAEA,qCAAoC;AAOpC,MAAqB,eAAe;
|
|
1
|
+
{"version":3,"file":"PluginInterface.js","sourceRoot":"","sources":["../src/PluginInterface.ts"],"names":[],"mappings":";;AAEA,qCAAoC;AAOpC,MAAqB,eAAe;IAChC,YACI,OAAyB,EACzB,OAGC;QASG,YAAO,GAAqB,EAAE,CAAC;QAPnC,IAAI,CAAC,MAAM,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,CAAC,OAAe,aAAf,OAAO,uBAAP,OAAO,CAAU,cAAc,MAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QAChF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC1B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;SACpB;IACL,CAAC;IAUD;;OAEG;IACI,IAAI,CAA6B,KAAQ,EAAE,GAAG,IAAqB;;QACtE,KAAK,IAAI,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;YAC7B,IAAK,MAAc,CAAC,KAAK,CAAC,EAAE;gBACxB,IAAI;oBACA,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,CAAC,iBAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,GAAG,EAAE;wBACxD,MAAc,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;oBACpC,CAAC,CAAC,CAAC;iBACN;gBAAC,OAAO,GAAG,EAAE;oBACV,MAAA,IAAI,CAAC,MAAM,0CAAE,KAAK,CAAC,6BAA6B,MAAM,CAAC,IAAI,IAAI,KAAK,GAAG,EAAE,GAAG,CAAC,CAAC;oBAC9E,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;wBACtB,MAAM,GAAG,CAAC;qBACb;iBACJ;aACJ;SACJ;QACD,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,SAAS,CAA6B,KAAQ,EAAE,GAAG,IAAqB;;QACjF,KAAK,IAAI,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;YAC7B,IAAK,MAAc,CAAC,KAAK,CAAC,EAAE;gBACxB,IAAI;oBACA,MAAM,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,CAAC,iBAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,KAAK,IAAI,EAAE;wBACrE,MAAM,OAAO,CAAC,OAAO,CAChB,MAAc,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAClC,CAAC;oBACN,CAAC,CAAC,CAAA,CAAC;iBACN;gBAAC,OAAO,GAAG,EAAE;oBACV,MAAA,IAAI,CAAC,MAAM,0CAAE,KAAK,CAAC,6BAA6B,MAAM,CAAC,IAAI,IAAI,KAAK,GAAG,EAAE,GAAG,CAAC,CAAC;iBACjF;aACJ;SACJ;QACD,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;IAED;;OAEG;IACI,QAAQ,CAA4C,MAAS;QAChE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YACnB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;SAChC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;OAEG;IACI,GAAG,CAA4C,MAAS;QAC3D,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YACnB,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAC5B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC7B;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;OAGG;IACK,cAAc,CAAC,MAAsB;;QACzC,MAAM,YAAY,GAAG;YACjB,kBAAkB;YAClB,iBAAiB;SACpB,CAAC;QACF,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;YACpC,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE;gBACrB,MAAA,IAAI,CAAC,MAAM,0CAAE,KAAK,CAAC,WAAW,MAAM,CAAC,IAAI,YAAY,WAAW,kDAAkD,CAAC,CAAC;aACvH;SACJ;QAED,MAAM,eAAe,GAAG;YACpB,aAAa,EAAE,wBAAwB;YACvC,YAAY,EAAE,uBAAuB;YACrC,sBAAsB,EAAE,oBAAoB;YAC5C,qBAAqB,EAAE,mBAAmB;YAC1C,eAAe,EAAE,mBAAmB;YACpC,cAAc,EAAE,kBAAkB;YAClC,mBAAmB,EAAE,mBAAmB;YACxC,kBAAkB,EAAE,kBAAkB;YACtC,iBAAiB,EAAE,kBAAkB;YACrC,gBAAgB,EAAE,iBAAiB;SACtC,CAAC;QAEF,KAAK,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;YAChE,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE;gBAClB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;oBACnB,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;oBACpC,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,CAAC,WAAW,MAAM,CAAC,IAAI,aAAa,QAAQ,uDAAuD,QAAQ,kEAAkE,CAAC,CAAC;iBACnM;qBAAM;oBACH,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,CAAC,WAAW,MAAM,CAAC,IAAI,aAAa,QAAQ,mDAAmD,CAAC,CAAC;iBACrH;aACJ;SACJ;IACL,CAAC;IAEM,GAAG,CAAC,MAAsB;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAEM,MAAM,CAA4C,MAAS;QAC9D,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YAClB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;SACxD;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;OAEG;IACI,KAAK;QACR,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;CACJ;AA9ID,kCA8IC"}
|
package/dist/Program.d.ts
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
import type { CodeAction,
|
|
1
|
+
import type { CodeAction, Position, Range, SignatureInformation, Location } from 'vscode-languageserver';
|
|
2
2
|
import type { BsConfig } from './BsConfig';
|
|
3
3
|
import { Scope } from './Scope';
|
|
4
|
-
import { BrsFile } from './files/BrsFile';
|
|
5
|
-
import { XmlFile } from './files/XmlFile';
|
|
6
|
-
import type { BsDiagnostic,
|
|
4
|
+
import type { BrsFile, ProvidedSymbolInfo } from './files/BrsFile';
|
|
5
|
+
import type { XmlFile } from './files/XmlFile';
|
|
6
|
+
import type { BsDiagnostic, FileObj, SemanticToken, FileLink, Hover } from './interfaces';
|
|
7
|
+
import type { File } from './files/File';
|
|
7
8
|
import { XmlScope } from './XmlScope';
|
|
8
9
|
import { Logger } from './Logger';
|
|
9
10
|
import PluginInterface from './PluginInterface';
|
|
10
11
|
import type { FunctionStatement } from './parser/Statement';
|
|
11
|
-
import
|
|
12
|
+
import { Editor } from './astUtils/Editor';
|
|
12
13
|
import type { Statement } from './parser/AstNode';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
srcPath: string;
|
|
16
|
-
source: string;
|
|
17
|
-
definitions?: string;
|
|
18
|
-
}
|
|
19
|
-
export interface TranspileObj {
|
|
20
|
-
file: BscFile;
|
|
21
|
-
outputPath: string;
|
|
22
|
-
}
|
|
14
|
+
import type { FileData } from './files/LazyFileData';
|
|
15
|
+
import type { UnresolvedSymbol } from './AstValidationSegmenter';
|
|
23
16
|
export interface SignatureInfoObj {
|
|
24
17
|
index: number;
|
|
25
18
|
key: string;
|
|
@@ -36,8 +29,16 @@ export declare class Program {
|
|
|
36
29
|
*/
|
|
37
30
|
options: BsConfig, logger?: Logger, plugins?: PluginInterface);
|
|
38
31
|
logger: Logger;
|
|
39
|
-
|
|
32
|
+
/**
|
|
33
|
+
* An editor that plugins can use to modify program-level things during the build flow. Don't use this to edit files (they have their own `.editor`)
|
|
34
|
+
*/
|
|
35
|
+
editor: Editor;
|
|
36
|
+
/**
|
|
37
|
+
* A factory that creates `File` instances
|
|
38
|
+
*/
|
|
39
|
+
private fileFactory;
|
|
40
40
|
private createGlobalScope;
|
|
41
|
+
private recursivelyAddNodeToSymbolTable;
|
|
41
42
|
/**
|
|
42
43
|
* Do all setup required for the global symbol table.
|
|
43
44
|
*/
|
|
@@ -65,6 +66,12 @@ export declare class Program {
|
|
|
65
66
|
* Should only be set from `this.validate()`
|
|
66
67
|
*/
|
|
67
68
|
private diagnostics;
|
|
69
|
+
private fileSymbolInformation;
|
|
70
|
+
addFileSymbolInfo(file: BrsFile): void;
|
|
71
|
+
getFileSymbolInfo(file: BrsFile): {
|
|
72
|
+
provides: ProvidedSymbolInfo;
|
|
73
|
+
requires: UnresolvedSymbol[];
|
|
74
|
+
};
|
|
68
75
|
/**
|
|
69
76
|
* The path to bslib.brs (the BrightScript runtime for certain BrighterScript features)
|
|
70
77
|
*/
|
|
@@ -73,8 +80,17 @@ export declare class Program {
|
|
|
73
80
|
/**
|
|
74
81
|
* A map of every file loaded into this program, indexed by its original file location
|
|
75
82
|
*/
|
|
76
|
-
files: Record<string,
|
|
77
|
-
|
|
83
|
+
files: Record<string, File>;
|
|
84
|
+
/**
|
|
85
|
+
* A map of every file loaded into this program, indexed by its destPath
|
|
86
|
+
*/
|
|
87
|
+
private destMap;
|
|
88
|
+
/**
|
|
89
|
+
* Plugins can contribute multiple virtual files for a single physical file.
|
|
90
|
+
* This collection links the virtual files back to the physical file that produced them.
|
|
91
|
+
* The key is the standardized and lower-cased srcPath
|
|
92
|
+
*/
|
|
93
|
+
private fileClusters;
|
|
78
94
|
private scopes;
|
|
79
95
|
protected addScope(scope: Scope): void;
|
|
80
96
|
/**
|
|
@@ -91,6 +107,10 @@ export declare class Program {
|
|
|
91
107
|
file: XmlFile;
|
|
92
108
|
scope: XmlScope;
|
|
93
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* Keeps a set of all the components that need to have their types updated during the current validation cycle
|
|
112
|
+
*/
|
|
113
|
+
private componentSymbolsToUpdate;
|
|
94
114
|
/**
|
|
95
115
|
* Register (or replace) the reference to a component in the component map
|
|
96
116
|
*/
|
|
@@ -99,6 +119,18 @@ export declare class Program {
|
|
|
99
119
|
* Remove the specified component from the components map
|
|
100
120
|
*/
|
|
101
121
|
private unregisterComponent;
|
|
122
|
+
/**
|
|
123
|
+
* Adds a component described in an XML to the set of components that needs to be updated this validation cycle.
|
|
124
|
+
* @param xmlFile XML file with <component> tag
|
|
125
|
+
*/
|
|
126
|
+
private addDeferredComponentTypeSymbolCreation;
|
|
127
|
+
private getComponentKey;
|
|
128
|
+
/**
|
|
129
|
+
* Updates the global symbol table with the first component in this.components to have the same name as the component in the file
|
|
130
|
+
* @param componentKey key getting a component from `this.components`
|
|
131
|
+
* @param componentName the unprefixed name of the component that will be added (e.g. 'MyLabel' NOT 'roSgNodeMyLabel')
|
|
132
|
+
*/
|
|
133
|
+
private updateComponentSymbolInGlobalScope;
|
|
102
134
|
/**
|
|
103
135
|
* re-attach the dependency graph with a new key for any component who changed
|
|
104
136
|
* their position in their own named array (only matters when there are multiple
|
|
@@ -122,9 +154,9 @@ export declare class Program {
|
|
|
122
154
|
* @param normalizePath should the provided path be normalized before use
|
|
123
155
|
*/
|
|
124
156
|
hasFile(filePath: string, normalizePath?: boolean): boolean;
|
|
125
|
-
getPkgPath(...args: any[]): any;
|
|
126
157
|
/**
|
|
127
158
|
* roku filesystem is case INsensitive, so find the scope by key case insensitive
|
|
159
|
+
* @param scopeName xml scope names are their `destPath`. Source scope is stored with the key `"source"`
|
|
128
160
|
*/
|
|
129
161
|
getScopeByName(scopeName: string): Scope;
|
|
130
162
|
/**
|
|
@@ -147,17 +179,17 @@ export declare class Program {
|
|
|
147
179
|
* Load a file into the program. If that file already exists, it is replaced.
|
|
148
180
|
* If file contents are provided, those are used, Otherwise, the file is loaded from the file system
|
|
149
181
|
* @param srcDestOrPkgPath the absolute path, the pkg path (i.e. `pkg:/path/to/file.brs`), or the destPath (i.e. `path/to/file.brs` relative to `pkg:/`)
|
|
150
|
-
* @param
|
|
182
|
+
* @param fileData the file contents. omit or pass `undefined` to prevent loading the data at this time
|
|
151
183
|
*/
|
|
152
|
-
setFile<T extends
|
|
184
|
+
setFile<T extends File>(srcDestOrPkgPath: string, fileData?: FileData): T;
|
|
153
185
|
/**
|
|
154
186
|
* Load a file into the program. If that file already exists, it is replaced.
|
|
155
187
|
* @param fileEntry an object that specifies src and dest for the file.
|
|
156
|
-
* @param
|
|
188
|
+
* @param fileData the file contents. omit or pass `undefined` to prevent loading the data at this time
|
|
157
189
|
*/
|
|
158
|
-
setFile<T extends
|
|
190
|
+
setFile<T extends File>(fileEntry: FileObj, fileData: FileData): T;
|
|
159
191
|
/**
|
|
160
|
-
* Given a srcPath, a
|
|
192
|
+
* Given a srcPath, a destPath, or both, resolve whichever is missing, relative to rootDir.
|
|
161
193
|
* @param fileParam an object representing file paths
|
|
162
194
|
* @param rootDir must be a pre-normalized path
|
|
163
195
|
*/
|
|
@@ -166,6 +198,14 @@ export declare class Program {
|
|
|
166
198
|
* Remove any leading `pkg:/` found in the path
|
|
167
199
|
*/
|
|
168
200
|
private removePkgPrefix;
|
|
201
|
+
/**
|
|
202
|
+
* Is this file a .brs file found somewhere within the `pkg:/source/` folder?
|
|
203
|
+
*/
|
|
204
|
+
private isSourceBrsFile;
|
|
205
|
+
/**
|
|
206
|
+
* Is this file a .brs file found somewhere within the `pkg:/source/` folder?
|
|
207
|
+
*/
|
|
208
|
+
private isComponentsXmlFile;
|
|
169
209
|
/**
|
|
170
210
|
* Ensure source scope is created.
|
|
171
211
|
* Note: automatically called internally, and no-op if it exists already.
|
|
@@ -179,14 +219,29 @@ export declare class Program {
|
|
|
179
219
|
removeFiles(srcPaths: string[], normalizePath?: boolean): void;
|
|
180
220
|
/**
|
|
181
221
|
* Remove a file from the program
|
|
182
|
-
* @param filePath can be a srcPath, a
|
|
222
|
+
* @param filePath can be a srcPath, a destPath, or a destPath with leading `pkg:/`
|
|
183
223
|
* @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
|
|
184
224
|
*/
|
|
185
|
-
removeFile(filePath: string, normalizePath?: boolean): void;
|
|
225
|
+
removeFile(filePath: string, normalizePath?: boolean, keepSymbolInformation?: boolean): void;
|
|
226
|
+
lastValidationInfo: Map<string, {
|
|
227
|
+
symbolsNotDefinedInEveryScope: {
|
|
228
|
+
symbol: UnresolvedSymbol;
|
|
229
|
+
scope: Scope;
|
|
230
|
+
}[];
|
|
231
|
+
duplicateSymbolsInSameScope: {
|
|
232
|
+
symbol: UnresolvedSymbol;
|
|
233
|
+
scope: Scope;
|
|
234
|
+
}[];
|
|
235
|
+
symbolsNotConsistentAcrossScopes: {
|
|
236
|
+
symbol: UnresolvedSymbol;
|
|
237
|
+
scopes: Scope[];
|
|
238
|
+
}[];
|
|
239
|
+
}>;
|
|
186
240
|
/**
|
|
187
241
|
* Traverse the entire project, and validate all scopes
|
|
188
242
|
*/
|
|
189
243
|
validate(): void;
|
|
244
|
+
private detectIncompatibleSymbolsAcrossScopes;
|
|
190
245
|
/**
|
|
191
246
|
* Flag all duplicate component names
|
|
192
247
|
*/
|
|
@@ -196,22 +251,22 @@ export declare class Program {
|
|
|
196
251
|
* @param filePaths can be an array of srcPath or a destPath strings
|
|
197
252
|
* @param normalizePath should this function repair and standardize the paths? Passing false should have a performance boost if you can guarantee your paths are already sanitized
|
|
198
253
|
*/
|
|
199
|
-
getFiles<T extends
|
|
254
|
+
getFiles<T extends File>(filePaths: string[], normalizePath?: boolean): T[];
|
|
200
255
|
/**
|
|
201
256
|
* Get the file at the given path
|
|
202
257
|
* @param filePath can be a srcPath or a destPath
|
|
203
258
|
* @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
|
|
204
259
|
*/
|
|
205
|
-
getFile<T extends
|
|
260
|
+
getFile<T extends File>(filePath: string, normalizePath?: boolean): T;
|
|
206
261
|
/**
|
|
207
262
|
* Get a list of all scopes the file is loaded into
|
|
208
263
|
* @param file the file
|
|
209
264
|
*/
|
|
210
|
-
getScopesForFile(file:
|
|
265
|
+
getScopesForFile(file: File | string): Scope[];
|
|
211
266
|
/**
|
|
212
267
|
* Get the first found scope for a file.
|
|
213
268
|
*/
|
|
214
|
-
getFirstScopeForFile(file:
|
|
269
|
+
getFirstScopeForFile(file: File): Scope;
|
|
215
270
|
getStatementsByName(name: string, originFile: BrsFile, namespaceName?: string): FileLink<Statement>[];
|
|
216
271
|
getStatementsForXmlFile(scope: XmlScope, filterName?: string): FileLink<FunctionStatement>[];
|
|
217
272
|
/**
|
|
@@ -219,11 +274,11 @@ export declare class Program {
|
|
|
219
274
|
* @param filePath can be a srcPath or a destPath
|
|
220
275
|
* @param position the position (line & column) where completions should be found
|
|
221
276
|
*/
|
|
222
|
-
getCompletions(filePath: string, position: Position): CompletionItem[];
|
|
277
|
+
getCompletions(filePath: string, position: Position): import("vscode-languageserver").CompletionItem[];
|
|
223
278
|
/**
|
|
224
279
|
* Goes through each file and builds a list of workspace symbols for the program. Used by LanguageServer's onWorkspaceSymbol functionality
|
|
225
280
|
*/
|
|
226
|
-
getWorkspaceSymbols(): import("vscode-languageserver
|
|
281
|
+
getWorkspaceSymbols(): import("vscode-languageserver").SymbolInformation[];
|
|
227
282
|
/**
|
|
228
283
|
* Given a position in a file, if the position is sitting on some type of identifier,
|
|
229
284
|
* go to the definition of that identifier (where this thing was first defined)
|
|
@@ -243,11 +298,6 @@ export declare class Program {
|
|
|
243
298
|
getSemanticTokens(srcPath: string): SemanticToken[];
|
|
244
299
|
getSignatureHelp(filepath: string, position: Position): SignatureInfoObj[];
|
|
245
300
|
getReferences(srcPath: string, position: Position): Location[] | Promise<Location[]>;
|
|
246
|
-
/**
|
|
247
|
-
* Get a list of all script imports, relative to the specified pkgPath
|
|
248
|
-
* @param sourcePkgPath - the pkgPath of the source that wants to resolve script imports.
|
|
249
|
-
*/
|
|
250
|
-
getScriptImportCompletions(sourcePkgPath: string, scriptImport: FileReference): CompletionItem[];
|
|
251
301
|
/**
|
|
252
302
|
* Transpile a single file and get the result as a string.
|
|
253
303
|
* This does not write anything to the file system.
|
|
@@ -257,35 +307,74 @@ export declare class Program {
|
|
|
257
307
|
* @param filePath can be a srcPath or a destPath
|
|
258
308
|
*/
|
|
259
309
|
getTranspiledFileContents(filePath: string): Promise<FileTranspileResult>;
|
|
310
|
+
private getTranspiledFileContentsPipeline;
|
|
311
|
+
/**
|
|
312
|
+
* Get the absolute output path for a file
|
|
313
|
+
*/
|
|
314
|
+
private getOutputPath;
|
|
315
|
+
private getStagingDir;
|
|
316
|
+
/**
|
|
317
|
+
* Prepare the program for building
|
|
318
|
+
* @param files the list of files that should be prepared
|
|
319
|
+
*/
|
|
320
|
+
private prepare;
|
|
260
321
|
/**
|
|
261
|
-
*
|
|
262
|
-
* This does not write anything to the file system
|
|
322
|
+
* Generate the contents of every file
|
|
263
323
|
*/
|
|
264
|
-
private
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
324
|
+
private serialize;
|
|
325
|
+
/**
|
|
326
|
+
* Write the entire project to disk
|
|
327
|
+
*/
|
|
328
|
+
private write;
|
|
329
|
+
private buildPipeline;
|
|
330
|
+
/**
|
|
331
|
+
* Build the project. This transpiles/transforms/copies all files and moves them to the staging directory
|
|
332
|
+
* @param options the list of options used to build the program
|
|
333
|
+
*/
|
|
334
|
+
build(options?: ProgramBuildOptions): Promise<void>;
|
|
268
335
|
/**
|
|
269
336
|
* Find a list of files in the program that have a function with the given name (case INsensitive)
|
|
270
337
|
*/
|
|
271
|
-
findFilesForFunction(functionName: string):
|
|
338
|
+
findFilesForFunction(functionName: string): File[];
|
|
272
339
|
/**
|
|
273
340
|
* Find a list of files in the program that have a class with the given name (case INsensitive)
|
|
274
341
|
*/
|
|
275
|
-
findFilesForClass(className: string):
|
|
276
|
-
findFilesForNamespace(name: string):
|
|
277
|
-
findFilesForEnum(name: string):
|
|
342
|
+
findFilesForClass(className: string): File[];
|
|
343
|
+
findFilesForNamespace(name: string): File[];
|
|
344
|
+
findFilesForEnum(name: string): File[];
|
|
345
|
+
private _manifest;
|
|
346
|
+
/**
|
|
347
|
+
* Modify a parsed manifest map by reading `bs_const` and injecting values from `options.manifest.bs_const`
|
|
348
|
+
* @param parsedManifest The manifest map to read from and modify
|
|
349
|
+
*/
|
|
350
|
+
private buildBsConstsIntoParsedManifest;
|
|
351
|
+
/**
|
|
352
|
+
* Try to find and load the manifest into memory
|
|
353
|
+
* @param manifestFileObj A pointer to a potential manifest file object found during loading
|
|
354
|
+
*/
|
|
355
|
+
loadManifest(manifestFileObj?: FileObj): void;
|
|
278
356
|
/**
|
|
279
357
|
* Get a map of the manifest information
|
|
280
358
|
*/
|
|
281
359
|
getManifest(): Map<string, string>;
|
|
282
|
-
private _manifest;
|
|
283
360
|
dispose(): void;
|
|
284
361
|
}
|
|
285
362
|
export interface FileTranspileResult {
|
|
286
363
|
srcPath: string;
|
|
364
|
+
destPath: string;
|
|
287
365
|
pkgPath: string;
|
|
288
366
|
code: string;
|
|
289
|
-
map:
|
|
367
|
+
map: string;
|
|
290
368
|
typedef: string;
|
|
291
369
|
}
|
|
370
|
+
export interface ProgramBuildOptions {
|
|
371
|
+
/**
|
|
372
|
+
* The directory where the final built files should be placed. This directory will be cleared before running
|
|
373
|
+
*/
|
|
374
|
+
stagingDir?: string;
|
|
375
|
+
/**
|
|
376
|
+
* An array of files to build. If omitted, the entire list of files from the program will be used instead.
|
|
377
|
+
* Typically you will want to leave this blank
|
|
378
|
+
*/
|
|
379
|
+
files?: File[];
|
|
380
|
+
}
|