brighterscript 0.66.0-alpha.1 → 0.66.0-alpha.10
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 +215 -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 +637 -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 +442 -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 +128 -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 +243 -293
- 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 +157 -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
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,36 +1,50 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import type { Range, Diagnostic, CodeAction, SemanticTokenTypes, SemanticTokenModifiers, Position, CompletionItem } from 'vscode-languageserver';
|
|
2
3
|
import type { Scope } from './Scope';
|
|
3
4
|
import type { BrsFile } from './files/BrsFile';
|
|
4
5
|
import type { XmlFile } from './files/XmlFile';
|
|
5
6
|
import type { FunctionScope } from './FunctionScope';
|
|
6
|
-
import type {
|
|
7
|
+
import type { TypedFunctionType } from './types/TypedFunctionType';
|
|
7
8
|
import type { ParseMode } from './parser/Parser';
|
|
8
9
|
import type { Program } from './Program';
|
|
9
10
|
import type { ProgramBuilder } from './ProgramBuilder';
|
|
10
|
-
import type { FunctionStatement } from './parser/Statement';
|
|
11
|
-
import type { Expression } from './parser/AstNode';
|
|
11
|
+
import type { ClassStatement, ConstStatement, EnumStatement, FunctionStatement, NamespaceStatement } from './parser/Statement';
|
|
12
|
+
import type { AstNode, Expression, Statement } from './parser/AstNode';
|
|
12
13
|
import type { TranspileState } from './parser/TranspileState';
|
|
13
|
-
import type {
|
|
14
|
+
import type { SourceNode } from 'source-map';
|
|
14
15
|
import type { BscType } from './types/BscType';
|
|
15
|
-
import type {
|
|
16
|
-
import type { Token } from './lexer/Token';
|
|
17
|
-
import type {
|
|
16
|
+
import type { Editor } from './astUtils/Editor';
|
|
17
|
+
import type { Identifier, Token } from './lexer/Token';
|
|
18
|
+
import type { File } from './files/File';
|
|
19
|
+
import type { FileFactory } from './files/Factory';
|
|
20
|
+
import type { LazyFileData } from './files/LazyFileData';
|
|
21
|
+
import type { SymbolTable, SymbolTypeFlag } from './SymbolTable';
|
|
22
|
+
import type { CallExpression } from './parser/Expression';
|
|
18
23
|
export interface BsDiagnostic extends Diagnostic {
|
|
19
|
-
file:
|
|
24
|
+
file: File;
|
|
20
25
|
/**
|
|
21
26
|
* A generic data container where additional details of the diagnostic can be stored. These are stripped out before being sent to a languageclient, and not printed to the console.
|
|
22
27
|
*/
|
|
23
28
|
data?: any;
|
|
24
29
|
}
|
|
25
|
-
export declare
|
|
30
|
+
export declare enum DiagnosticOrigin {
|
|
31
|
+
Program = "Program",
|
|
32
|
+
Scope = "Scope",
|
|
33
|
+
File = "File",
|
|
34
|
+
ASTSegment = "AstSegment"
|
|
35
|
+
}
|
|
36
|
+
export interface BsDiagnosticWithOrigin extends BsDiagnostic {
|
|
37
|
+
origin: DiagnosticOrigin;
|
|
38
|
+
astSegment?: AstNode;
|
|
39
|
+
}
|
|
26
40
|
export interface Callable {
|
|
27
|
-
file:
|
|
41
|
+
file: File;
|
|
28
42
|
name: string;
|
|
29
43
|
/**
|
|
30
44
|
* Is the callable declared as "sub". If falsey, assumed declared as "function"
|
|
31
45
|
*/
|
|
32
46
|
isSub: boolean;
|
|
33
|
-
type:
|
|
47
|
+
type: TypedFunctionType;
|
|
34
48
|
/**
|
|
35
49
|
* A short description of the callable. Should be a short sentence.
|
|
36
50
|
*/
|
|
@@ -64,6 +78,7 @@ export interface FunctionCall {
|
|
|
64
78
|
* The full range of this function call (from the start of the function name to its closing paren)
|
|
65
79
|
*/
|
|
66
80
|
range: Range;
|
|
81
|
+
expression: CallExpression;
|
|
67
82
|
functionScope: FunctionScope;
|
|
68
83
|
file: File;
|
|
69
84
|
name: string;
|
|
@@ -101,12 +116,12 @@ export interface FileObj {
|
|
|
101
116
|
*/
|
|
102
117
|
export interface FileReference {
|
|
103
118
|
/**
|
|
104
|
-
* The
|
|
119
|
+
* The destPath for the referenced file.
|
|
105
120
|
*/
|
|
106
|
-
|
|
121
|
+
destPath: string;
|
|
107
122
|
text: string;
|
|
108
123
|
/**
|
|
109
|
-
* The file that is doing the import. Note this is NOT the file the
|
|
124
|
+
* The file that is doing the import. Note this is NOT the file the destPath points to.
|
|
110
125
|
*/
|
|
111
126
|
sourceFile: XmlFile | BrsFile;
|
|
112
127
|
/**
|
|
@@ -117,14 +132,6 @@ export interface FileReference {
|
|
|
117
132
|
*/
|
|
118
133
|
filePathRange?: Range;
|
|
119
134
|
}
|
|
120
|
-
export interface File {
|
|
121
|
-
/**
|
|
122
|
-
* The absolute path to the file, relative to the pkg
|
|
123
|
-
*/
|
|
124
|
-
pkgPath: string;
|
|
125
|
-
srcPath: string;
|
|
126
|
-
getDiagnostics(): BsDiagnostic[];
|
|
127
|
-
}
|
|
128
135
|
export interface VariableDeclaration {
|
|
129
136
|
name: string;
|
|
130
137
|
getType: () => BscType;
|
|
@@ -158,7 +165,7 @@ export interface CallableContainer {
|
|
|
158
165
|
}
|
|
159
166
|
export declare type CallableContainerMap = Map<string, CallableContainer[]>;
|
|
160
167
|
export interface CommentFlag {
|
|
161
|
-
file:
|
|
168
|
+
file: File;
|
|
162
169
|
/**
|
|
163
170
|
* The location of the ignore comment.
|
|
164
171
|
*/
|
|
@@ -172,17 +179,42 @@ export interface CommentFlag {
|
|
|
172
179
|
export declare type CompilerPluginFactory = () => CompilerPlugin;
|
|
173
180
|
export interface CompilerPlugin {
|
|
174
181
|
name: string;
|
|
182
|
+
/**
|
|
183
|
+
* Called before a new program is created
|
|
184
|
+
*/
|
|
175
185
|
beforeProgramCreate?: PluginHandler<BeforeProgramCreateEvent>;
|
|
186
|
+
/**
|
|
187
|
+
* Called after a new program is created
|
|
188
|
+
*/
|
|
176
189
|
afterProgramCreate?: PluginHandler<AfterProgramCreateEvent>;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Called before the program gets prepared for building
|
|
192
|
+
*/
|
|
193
|
+
beforePrepareProgram?: PluginHandler<BeforePrepareProgramEvent>;
|
|
194
|
+
/**
|
|
195
|
+
* Called when the program gets prepared for building
|
|
196
|
+
*/
|
|
197
|
+
prepareProgram?: PluginHandler<PrepareProgramEvent>;
|
|
198
|
+
/**
|
|
199
|
+
* Called after the program gets prepared for building
|
|
200
|
+
*/
|
|
201
|
+
afterPrepareProgram?: PluginHandler<AfterPrepareProgramEvent>;
|
|
202
|
+
/**
|
|
203
|
+
* Called before the entire program is validated
|
|
204
|
+
*/
|
|
181
205
|
beforeProgramValidate?: PluginHandler<BeforeProgramValidateEvent>;
|
|
206
|
+
/**
|
|
207
|
+
* Called before the entire program is validated
|
|
208
|
+
*/
|
|
209
|
+
onProgramValidate?: PluginHandler<OnProgramValidateEvent>;
|
|
210
|
+
/**
|
|
211
|
+
* Called after the program has been validated
|
|
212
|
+
*/
|
|
182
213
|
afterProgramValidate?: PluginHandler<AfterProgramValidateEvent>;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
214
|
+
/**
|
|
215
|
+
* Called right before the program is disposed/destroyed
|
|
216
|
+
*/
|
|
217
|
+
beforeProgramDispose?: PluginHandler<BeforeProgramDisposeEvent>;
|
|
186
218
|
/**
|
|
187
219
|
* Emitted before the program starts collecting completions
|
|
188
220
|
*/
|
|
@@ -207,15 +239,49 @@ export interface CompilerPlugin {
|
|
|
207
239
|
* Called after the `provideHover` hook. Use this if you want to intercept or sanitize the hover data (even from other plugins) before it gets sent to the client.
|
|
208
240
|
*/
|
|
209
241
|
afterProvideHover?: PluginHandler<AfterProvideHoverEvent>;
|
|
210
|
-
|
|
242
|
+
/**
|
|
243
|
+
* Called after a scope was created
|
|
244
|
+
*/
|
|
211
245
|
afterScopeCreate?: PluginHandler<AfterScopeCreateEvent>;
|
|
212
246
|
beforeScopeDispose?: PluginHandler<BeforeScopeDisposeEvent>;
|
|
247
|
+
onScopeDispose?: PluginHandler<OnScopeDisposeEvent>;
|
|
213
248
|
afterScopeDispose?: PluginHandler<AfterScopeDisposeEvent>;
|
|
214
249
|
beforeScopeValidate?: PluginHandler<BeforeScopeValidateEvent>;
|
|
215
250
|
onScopeValidate?: PluginHandler<OnScopeValidateEvent>;
|
|
216
251
|
afterScopeValidate?: PluginHandler<BeforeScopeValidateEvent>;
|
|
217
|
-
|
|
218
|
-
|
|
252
|
+
onGetCodeActions?: PluginHandler<OnGetCodeActionsEvent>;
|
|
253
|
+
onGetSemanticTokens?: PluginHandler<OnGetSemanticTokensEvent>;
|
|
254
|
+
/**
|
|
255
|
+
* Called before plugins are asked to provide files to the program. (excludes virtual files produced by `provideFile` events).
|
|
256
|
+
* Call the `setFileData()` method to override the file contents.
|
|
257
|
+
*/
|
|
258
|
+
beforeProvideFile?: PluginHandler<BeforeProvideFileEvent>;
|
|
259
|
+
/**
|
|
260
|
+
* Give plugins the opportunity to handle processing a file. (excludes virtual files produced by `provideFile` events)
|
|
261
|
+
*/
|
|
262
|
+
provideFile?: PluginHandler<ProvideFileEvent>;
|
|
263
|
+
/**
|
|
264
|
+
* Called after a file was added to the program. (excludes virtual files produced by `provideFile` events)
|
|
265
|
+
*/
|
|
266
|
+
afterProvideFile?: PluginHandler<AfterProvideFileEvent>;
|
|
267
|
+
/**
|
|
268
|
+
* Called before a file is added to the program.
|
|
269
|
+
* Includes physical files as well as any virtual files produced by `provideFile` events
|
|
270
|
+
*/
|
|
271
|
+
beforeFileAdd?: PluginHandler<BeforeFileAddEvent>;
|
|
272
|
+
/**
|
|
273
|
+
* Called after a file has been added to the program.
|
|
274
|
+
* Includes physical files as well as any virtual files produced by `provideFile` events
|
|
275
|
+
*/
|
|
276
|
+
afterFileAdd?: PluginHandler<AfterFileAddEvent>;
|
|
277
|
+
/**
|
|
278
|
+
* Called before a file is removed from the program. This includes physical and virtual files
|
|
279
|
+
*/
|
|
280
|
+
beforeFileRemove?: PluginHandler<BeforeFileRemoveEvent>;
|
|
281
|
+
/**
|
|
282
|
+
* Called after a file has been removed from the program. This includes physical and virtual files
|
|
283
|
+
*/
|
|
284
|
+
afterFileRemove?: PluginHandler<AfterFileRemoveEvent>;
|
|
219
285
|
/**
|
|
220
286
|
* Called before each file is validated
|
|
221
287
|
*/
|
|
@@ -228,61 +294,111 @@ export interface CompilerPlugin {
|
|
|
228
294
|
* Called after each file is validated
|
|
229
295
|
*/
|
|
230
296
|
afterFileValidate?: PluginHandler<AfterFileValidateEvent>;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
297
|
+
/**
|
|
298
|
+
* Called right before the program builds (i.e. generates the code and puts it in the stagingDir
|
|
299
|
+
*/
|
|
300
|
+
beforeBuildProgram?: PluginHandler<BeforeBuildProgramEvent>;
|
|
301
|
+
/**
|
|
302
|
+
* Called right after the program builds (i.e. generates the code and puts it in the stagingDir
|
|
303
|
+
*/
|
|
304
|
+
afterBuildProgram?: PluginHandler<AfterBuildProgramEvent>;
|
|
305
|
+
/**
|
|
306
|
+
* Before preparing the file for building
|
|
307
|
+
*/
|
|
308
|
+
beforePrepareFile?: PluginHandler<BeforePrepareFileEvent>;
|
|
309
|
+
/**
|
|
310
|
+
* Prepare the file for building
|
|
311
|
+
*/
|
|
312
|
+
prepareFile?: PluginHandler<PrepareFileEvent>;
|
|
313
|
+
/**
|
|
314
|
+
* After preparing the file for building
|
|
315
|
+
*/
|
|
316
|
+
afterPrepareFile?: PluginHandler<AfterPrepareFileEvent>;
|
|
317
|
+
/**
|
|
318
|
+
* Before the program turns all file objects into their final buffers
|
|
319
|
+
*/
|
|
320
|
+
beforeSerializeProgram?: PluginHandler<BeforeSerializeProgramEvent>;
|
|
321
|
+
/**
|
|
322
|
+
* Emitted right at the start of the program turning all file objects into their final buffers
|
|
323
|
+
*/
|
|
324
|
+
onSerializeProgram?: PluginHandler<OnSerializeProgramEvent>;
|
|
325
|
+
/**
|
|
326
|
+
* After the program turns all file objects into their final buffers
|
|
327
|
+
*/
|
|
328
|
+
afterSerializeProgram?: PluginHandler<AfterSerializeProgramEvent>;
|
|
329
|
+
/**
|
|
330
|
+
* Before turning the file into its final contents
|
|
331
|
+
*/
|
|
332
|
+
beforeSerializeFile?: PluginHandler<BeforeSerializeFileEvent>;
|
|
333
|
+
/**
|
|
334
|
+
* Turn the file into its final contents (i.e. transpile a bs file, compress a jpeg, etc)
|
|
335
|
+
*/
|
|
336
|
+
serializeFile?: PluginHandler<SerializeFileEvent>;
|
|
337
|
+
/**
|
|
338
|
+
* After turning the file into its final contents
|
|
339
|
+
*/
|
|
340
|
+
afterSerializeFile?: PluginHandler<AfterSerializeFileEvent>;
|
|
341
|
+
/**
|
|
342
|
+
* Called before any files are written
|
|
343
|
+
*/
|
|
344
|
+
beforeWriteProgram?: PluginHandler<BeforeWriteProgramEvent>;
|
|
345
|
+
/**
|
|
346
|
+
* Called after all files are written
|
|
347
|
+
*/
|
|
348
|
+
afterWriteProgram?: PluginHandler<AfterWriteProgramEvent>;
|
|
349
|
+
/**
|
|
350
|
+
* Before a file is written to disk. These are raw files that contain the final output. One `File` may produce several of these
|
|
351
|
+
*/
|
|
352
|
+
beforeWriteFile?: PluginHandler<BeforeWriteFileEvent>;
|
|
353
|
+
/**
|
|
354
|
+
* Called when a file should be persisted (usually writing to storage). These are raw files that contain the final output. One `File` may produce several of these.
|
|
355
|
+
* When a plugin has handled a file, it should be pushed to the `handledFiles` set so future plugins don't write the file multiple times
|
|
356
|
+
*/
|
|
357
|
+
writeFile?: PluginHandler<WriteFileEvent>;
|
|
358
|
+
/**
|
|
359
|
+
* Before a file is written to disk. These are raw files that contain the final output. One `File` may produce several of these
|
|
360
|
+
*/
|
|
361
|
+
afterWriteFile?: PluginHandler<AfterWriteFileEvent>;
|
|
235
362
|
}
|
|
236
363
|
export declare type PluginHandler<T, R = void> = (event: T) => R;
|
|
237
|
-
export interface
|
|
238
|
-
builder: ProgramBuilder;
|
|
239
|
-
}
|
|
240
|
-
export interface AfterProgramCreateEvent {
|
|
241
|
-
builder: ProgramBuilder;
|
|
364
|
+
export interface OnGetCodeActionsEvent<TFile extends File = File> {
|
|
242
365
|
program: Program;
|
|
366
|
+
file: TFile;
|
|
367
|
+
range: Range;
|
|
368
|
+
scopes: Scope[];
|
|
369
|
+
diagnostics: BsDiagnostic[];
|
|
370
|
+
codeActions: CodeAction[];
|
|
243
371
|
}
|
|
244
|
-
export interface
|
|
372
|
+
export interface BeforeProgramCreateEvent {
|
|
245
373
|
builder: ProgramBuilder;
|
|
246
|
-
program: Program;
|
|
247
|
-
files: FileObj[];
|
|
248
374
|
}
|
|
249
|
-
export
|
|
250
|
-
export interface BeforePublishEvent {
|
|
375
|
+
export interface AfterProgramCreateEvent {
|
|
251
376
|
builder: ProgramBuilder;
|
|
252
377
|
program: Program;
|
|
253
|
-
files: FileObj[];
|
|
254
378
|
}
|
|
255
|
-
export declare type AfterPublishEvent = BeforePublishEvent;
|
|
256
379
|
export interface BeforeProgramValidateEvent {
|
|
257
380
|
program: Program;
|
|
258
381
|
}
|
|
382
|
+
export declare type OnProgramValidateEvent = BeforeProgramValidateEvent;
|
|
259
383
|
export declare type AfterProgramValidateEvent = BeforeProgramValidateEvent;
|
|
260
|
-
export interface
|
|
261
|
-
program: Program;
|
|
262
|
-
entries: TranspileEntry[];
|
|
263
|
-
editor: AstEditor;
|
|
264
|
-
}
|
|
265
|
-
export declare type AfterProgramTranspileEvent = BeforeProgramTranspileEvent;
|
|
266
|
-
export interface OnGetCodeActionsEvent {
|
|
267
|
-
program: Program;
|
|
268
|
-
file: BscFile;
|
|
269
|
-
range: Range;
|
|
270
|
-
scopes: Scope[];
|
|
271
|
-
diagnostics: BsDiagnostic[];
|
|
272
|
-
codeActions: CodeAction[];
|
|
273
|
-
}
|
|
274
|
-
export interface ProvideCompletionsEvent<TFile extends BscFile = BscFile> {
|
|
384
|
+
export interface ProvideCompletionsEvent<TFile extends File = File> {
|
|
275
385
|
program: Program;
|
|
276
386
|
file: TFile;
|
|
277
387
|
scopes: Scope[];
|
|
278
388
|
position: Position;
|
|
279
389
|
completions: CompletionItem[];
|
|
280
390
|
}
|
|
281
|
-
export declare type BeforeProvideCompletionsEvent<TFile extends
|
|
282
|
-
export declare type AfterProvideCompletionsEvent<TFile extends
|
|
391
|
+
export declare type BeforeProvideCompletionsEvent<TFile extends File = File> = ProvideCompletionsEvent<TFile>;
|
|
392
|
+
export declare type AfterProvideCompletionsEvent<TFile extends File = File> = ProvideCompletionsEvent<TFile>;
|
|
393
|
+
export interface BeforeBuildProgramEvent {
|
|
394
|
+
program: Program;
|
|
395
|
+
files: File[];
|
|
396
|
+
editor: Editor;
|
|
397
|
+
}
|
|
398
|
+
export declare type AfterBuildProgramEvent = BeforeBuildProgramEvent;
|
|
283
399
|
export interface ProvideHoverEvent {
|
|
284
400
|
program: Program;
|
|
285
|
-
file:
|
|
401
|
+
file: File;
|
|
286
402
|
position: Position;
|
|
287
403
|
scopes: Scope[];
|
|
288
404
|
hovers: Hover[];
|
|
@@ -312,6 +428,10 @@ export interface BeforeScopeDisposeEvent {
|
|
|
312
428
|
program: Program;
|
|
313
429
|
scope: Scope;
|
|
314
430
|
}
|
|
431
|
+
export interface OnScopeDisposeEvent {
|
|
432
|
+
program: Program;
|
|
433
|
+
scope: Scope;
|
|
434
|
+
}
|
|
315
435
|
export interface AfterScopeDisposeEvent {
|
|
316
436
|
program: Program;
|
|
317
437
|
scope: Scope;
|
|
@@ -326,11 +446,16 @@ export interface BeforeFileParseEvent {
|
|
|
326
446
|
srcPath: string;
|
|
327
447
|
source: string;
|
|
328
448
|
}
|
|
449
|
+
export interface OnFileParseEvent {
|
|
450
|
+
program: Program;
|
|
451
|
+
srcPath: string;
|
|
452
|
+
source: string;
|
|
453
|
+
}
|
|
329
454
|
export interface AfterFileParseEvent {
|
|
330
455
|
program: Program;
|
|
331
|
-
file:
|
|
456
|
+
file: File;
|
|
332
457
|
}
|
|
333
|
-
export interface OnGetSemanticTokensEvent<T extends
|
|
458
|
+
export interface OnGetSemanticTokensEvent<T extends File = File> {
|
|
334
459
|
/**
|
|
335
460
|
* The program this file is from
|
|
336
461
|
*/
|
|
@@ -349,32 +474,31 @@ export interface OnGetSemanticTokensEvent<T extends BscFile = BscFile> {
|
|
|
349
474
|
semanticTokens: SemanticToken[];
|
|
350
475
|
}
|
|
351
476
|
export declare type BeforeFileValidateEvent = OnFileValidateEvent;
|
|
352
|
-
export interface OnFileValidateEvent<T extends
|
|
477
|
+
export interface OnFileValidateEvent<T extends File = File> {
|
|
353
478
|
program: Program;
|
|
354
479
|
file: T;
|
|
355
480
|
}
|
|
356
481
|
export declare type AfterFileValidateEvent = OnFileValidateEvent;
|
|
482
|
+
export interface OnFileValidateEvent<T extends File = File> {
|
|
483
|
+
program: Program;
|
|
484
|
+
file: T;
|
|
485
|
+
}
|
|
357
486
|
export interface TranspileEntry {
|
|
358
|
-
file:
|
|
487
|
+
file: File;
|
|
359
488
|
outputPath: string;
|
|
360
489
|
}
|
|
490
|
+
export interface ScopeValidationOptions {
|
|
491
|
+
changedFiles?: File[];
|
|
492
|
+
changedSymbols?: Map<SymbolTypeFlag, Set<string>>;
|
|
493
|
+
force?: boolean;
|
|
494
|
+
}
|
|
361
495
|
export interface OnScopeValidateEvent {
|
|
362
496
|
program: Program;
|
|
363
497
|
scope: Scope;
|
|
498
|
+
changedFiles?: File[];
|
|
499
|
+
changedSymbols?: Map<SymbolTypeFlag, Set<string>>;
|
|
364
500
|
}
|
|
365
|
-
export
|
|
366
|
-
export interface BeforeFileTranspileEvent<TFile extends BscFile = BscFile> {
|
|
367
|
-
program: Program;
|
|
368
|
-
file: TFile;
|
|
369
|
-
outputPath: string;
|
|
370
|
-
/**
|
|
371
|
-
* An editor that can be used to transform properties or arrays. Once the `afterFileTranspile` event has fired, these changes will be reverted,
|
|
372
|
-
* restoring the objects to their prior state. This is useful for changing code right before a file gets transpiled, but when you don't want
|
|
373
|
-
* the changes to persist in the in-memory file.
|
|
374
|
-
*/
|
|
375
|
-
editor: Editor;
|
|
376
|
-
}
|
|
377
|
-
export interface AfterFileTranspileEvent<TFile extends BscFile = BscFile> {
|
|
501
|
+
export interface AfterFileTranspileEvent<TFile extends File = File> {
|
|
378
502
|
/**
|
|
379
503
|
* The program this event was triggered for
|
|
380
504
|
*/
|
|
@@ -388,23 +512,150 @@ export interface AfterFileTranspileEvent<TFile extends BscFile = BscFile> {
|
|
|
388
512
|
/**
|
|
389
513
|
* The sourceMaps for the generated code (if emitting source maps is enabled)
|
|
390
514
|
*/
|
|
391
|
-
map?:
|
|
515
|
+
map?: string;
|
|
392
516
|
/**
|
|
393
517
|
* The generated type definition file contents (if emitting type definitions are enabled)
|
|
394
518
|
*/
|
|
395
519
|
typedef?: string;
|
|
520
|
+
}
|
|
521
|
+
export declare type BeforeProvideFileEvent<TFile extends File = File> = ProvideFileEvent<TFile>;
|
|
522
|
+
export interface ProvideFileEvent<TFile extends File = File> {
|
|
523
|
+
/**
|
|
524
|
+
* The lower-case file extension for the srcPath. (i.e. ".brs", ".xml")
|
|
525
|
+
*/
|
|
526
|
+
srcExtension: string;
|
|
527
|
+
/**
|
|
528
|
+
* The srcPath for the file. (i.e. `/user/bob/projects/VideoApp/source/main.bs`)
|
|
529
|
+
*/
|
|
530
|
+
srcPath: string;
|
|
531
|
+
/**
|
|
532
|
+
* The destPath for the file. (i.e. for `/user/bob/projects/VideoApp/source/main.bs`, destPath would be `source/main.bs`)
|
|
533
|
+
*/
|
|
534
|
+
destPath: string;
|
|
535
|
+
/**
|
|
536
|
+
* A lazy-loading container for this file's data. Call `.get()` to lazy load the data, and `.set()` to override file contents
|
|
537
|
+
*/
|
|
538
|
+
data: LazyFileData;
|
|
396
539
|
/**
|
|
397
|
-
* An
|
|
398
|
-
* restoring the objects to their prior state. This is useful for changing code right before a file gets transpiled, but when you don't want
|
|
399
|
-
* the changes to persist in the in-memory file.
|
|
540
|
+
* An array of files that should be added to the program as a result of this event
|
|
400
541
|
*/
|
|
542
|
+
files: TFile[];
|
|
543
|
+
/**
|
|
544
|
+
* The program for this event
|
|
545
|
+
*/
|
|
546
|
+
program: Program;
|
|
547
|
+
/**
|
|
548
|
+
* A factory used to create new instances of the BrighterScript built-in file types. This mitigates the issue
|
|
549
|
+
* of a plugin's version of a File not being the same as the LanguageServer or CLI version of BrighterScript
|
|
550
|
+
* (due to npm installing multiple versions of brighterscript)
|
|
551
|
+
*/
|
|
552
|
+
fileFactory: FileFactory;
|
|
553
|
+
}
|
|
554
|
+
export declare type AfterProvideFileEvent<TFile extends File = File> = ProvideFileEvent<TFile>;
|
|
555
|
+
export interface BeforeFileAddEvent<TFile extends File = File> {
|
|
556
|
+
file: TFile;
|
|
557
|
+
program: Program;
|
|
558
|
+
}
|
|
559
|
+
export declare type AfterFileAddEvent<TFile extends File = File> = BeforeFileAddEvent<TFile>;
|
|
560
|
+
export interface BeforeFileRemoveEvent<TFile extends File = File> {
|
|
561
|
+
file: TFile;
|
|
562
|
+
program: Program;
|
|
563
|
+
}
|
|
564
|
+
export declare type AfterFileRemoveEvent<TFile extends File = File> = BeforeFileRemoveEvent<TFile>;
|
|
565
|
+
export declare type BeforePrepareProgramEvent = PrepareProgramEvent;
|
|
566
|
+
/**
|
|
567
|
+
* Event for when the program prepares itself for building
|
|
568
|
+
*/
|
|
569
|
+
export interface PrepareProgramEvent {
|
|
570
|
+
program: Program;
|
|
401
571
|
editor: Editor;
|
|
402
572
|
}
|
|
573
|
+
export declare type AfterPrepareProgramEvent = PrepareProgramEvent;
|
|
574
|
+
export declare type BeforePrepareFileEvent<TFile extends File = File> = PrepareFileEvent<TFile>;
|
|
575
|
+
/**
|
|
576
|
+
* Prepare the file for building
|
|
577
|
+
*/
|
|
578
|
+
export interface PrepareFileEvent<TFile extends File = File> {
|
|
579
|
+
program: Program;
|
|
580
|
+
file: TFile;
|
|
581
|
+
editor: Editor;
|
|
582
|
+
}
|
|
583
|
+
export declare type OnPrepareFileEvent<TFile extends File = File> = PrepareFileEvent<TFile>;
|
|
584
|
+
export declare type AfterPrepareFileEvent<TFile extends File = File> = PrepareFileEvent<TFile>;
|
|
585
|
+
/**
|
|
586
|
+
* A container that holds the code, map, and typedef for serialized code files.
|
|
587
|
+
*/
|
|
588
|
+
export interface SerializedCodeFile {
|
|
589
|
+
code?: string;
|
|
590
|
+
map?: string;
|
|
591
|
+
typedef?: string;
|
|
592
|
+
}
|
|
593
|
+
export interface BeforeSerializeProgramEvent {
|
|
594
|
+
program: Program;
|
|
595
|
+
files: File[];
|
|
596
|
+
result: Map<File, SerializedFile[]>;
|
|
597
|
+
}
|
|
598
|
+
export declare type OnSerializeProgramEvent = BeforeSerializeProgramEvent;
|
|
599
|
+
export declare type AfterSerializeProgramEvent = BeforeSerializeProgramEvent;
|
|
600
|
+
/**
|
|
601
|
+
* During the `SerializeFile` events, this is how plugins will contribute file data for a specific file
|
|
602
|
+
*/
|
|
603
|
+
export interface SerializedFile {
|
|
604
|
+
/**
|
|
605
|
+
* The raw data for this file (i.e. a binary buffer for a .jpeg file, or the transpiled code for a .bs file)
|
|
606
|
+
*/
|
|
607
|
+
data: Buffer;
|
|
608
|
+
/**
|
|
609
|
+
* The pkgPath for this chunk of data.
|
|
610
|
+
*/
|
|
611
|
+
pkgPath: string;
|
|
612
|
+
}
|
|
613
|
+
export declare type BeforeSerializeFileEvent<TFile extends File = File> = SerializeFileEvent<TFile>;
|
|
614
|
+
export interface SerializeFileEvent<TFile extends File = File> {
|
|
615
|
+
program: Program;
|
|
616
|
+
file: TFile;
|
|
617
|
+
/**
|
|
618
|
+
* The list of all files created across all the `SerializeFile` events.
|
|
619
|
+
* The key is the pkgPath of the file, and the
|
|
620
|
+
*/
|
|
621
|
+
result: Map<TFile, SerializedFile[]>;
|
|
622
|
+
}
|
|
623
|
+
export declare type AfterSerializeFileEvent<TFile extends File = File> = SerializeFileEvent<TFile>;
|
|
624
|
+
export interface BeforeWriteProgramEvent {
|
|
625
|
+
program: Program;
|
|
626
|
+
stagingDir: string;
|
|
627
|
+
files: Map<File, SerializedFile[]>;
|
|
628
|
+
}
|
|
629
|
+
export declare type AfterWriteProgramEvent = BeforeWriteProgramEvent;
|
|
630
|
+
export declare type BeforeWriteFileEvent = WriteFileEvent;
|
|
631
|
+
export interface WriteFileEvent {
|
|
632
|
+
program: Program;
|
|
633
|
+
file: SerializedFile;
|
|
634
|
+
/**
|
|
635
|
+
* The full path to where the file was (or will be) written to.
|
|
636
|
+
*/
|
|
637
|
+
outputPath: string;
|
|
638
|
+
/**
|
|
639
|
+
* A set of all files that have been properly written. Plugins should add any handled files to this list so future plugins don't write then again
|
|
640
|
+
*/
|
|
641
|
+
processedFiles: Set<SerializedFile>;
|
|
642
|
+
}
|
|
643
|
+
export declare type AfterWriteFileEvent = BeforeWriteFileEvent;
|
|
644
|
+
export interface TranspileObj {
|
|
645
|
+
file: File;
|
|
646
|
+
/**
|
|
647
|
+
* The absolute path to where the file should be written during build. (i.e. somewhere inside the stagingDir)
|
|
648
|
+
*/
|
|
649
|
+
outputPath: string;
|
|
650
|
+
}
|
|
403
651
|
export interface BeforeFileDisposeEvent {
|
|
404
652
|
program: Program;
|
|
405
|
-
file:
|
|
653
|
+
file: File;
|
|
406
654
|
}
|
|
407
655
|
export declare type AfterFileDisposeEvent = BeforeFileDisposeEvent;
|
|
656
|
+
export interface BeforeProgramDisposeEvent {
|
|
657
|
+
program: Program;
|
|
658
|
+
}
|
|
408
659
|
export interface SemanticToken {
|
|
409
660
|
range: Range;
|
|
410
661
|
tokenType: SemanticTokenTypes;
|
|
@@ -417,7 +668,7 @@ export interface TypedefProvider {
|
|
|
417
668
|
getTypedef(state: TranspileState): Array<SourceNode | string>;
|
|
418
669
|
}
|
|
419
670
|
export declare type TranspileResult = Array<(string | SourceNode)>;
|
|
420
|
-
export declare type FileResolver = (srcPath: string) => string | undefined | Thenable<string | undefined> | void;
|
|
671
|
+
export declare type FileResolver = (srcPath: string) => string | Buffer | undefined | Thenable<string | Buffer | undefined> | void;
|
|
421
672
|
export interface ExpressionInfo {
|
|
422
673
|
expressions: Expression[];
|
|
423
674
|
varExpressions: Expression[];
|
|
@@ -428,21 +679,65 @@ export interface FileLink<T> {
|
|
|
428
679
|
item: T;
|
|
429
680
|
file: BrsFile;
|
|
430
681
|
}
|
|
682
|
+
export interface ExtraSymbolData {
|
|
683
|
+
definingNode?: AstNode;
|
|
684
|
+
description?: string;
|
|
685
|
+
completionPriority?: number;
|
|
686
|
+
flags?: SymbolTypeFlag;
|
|
687
|
+
}
|
|
431
688
|
export interface GetTypeOptions {
|
|
432
689
|
flags: SymbolTypeFlag;
|
|
433
690
|
typeChain?: TypeChainEntry[];
|
|
691
|
+
data?: ExtraSymbolData;
|
|
692
|
+
ignoreCall?: boolean;
|
|
693
|
+
onlyCacheResolvedTypes?: boolean;
|
|
694
|
+
ignoreCacheForRetrieval?: boolean;
|
|
434
695
|
}
|
|
435
696
|
export declare class TypeChainEntry {
|
|
436
697
|
name: string;
|
|
437
698
|
type: BscType;
|
|
699
|
+
flags: SymbolTypeFlag;
|
|
438
700
|
range: Range;
|
|
439
|
-
|
|
701
|
+
separatorToken: Token;
|
|
702
|
+
constructor(name: string, type: BscType, flags: SymbolTypeFlag, range: Range, separatorToken?: Token);
|
|
440
703
|
get isResolved(): boolean;
|
|
441
704
|
}
|
|
442
705
|
export interface TypeChainProcessResult {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
706
|
+
itemName: string;
|
|
707
|
+
itemParentTypeName: string;
|
|
708
|
+
fullNameOfItem: string;
|
|
446
709
|
fullChainName: string;
|
|
447
710
|
range: Range;
|
|
711
|
+
containsDynamic: boolean;
|
|
712
|
+
}
|
|
713
|
+
export interface TypeCompatibilityData {
|
|
714
|
+
missingFields?: {
|
|
715
|
+
name: string;
|
|
716
|
+
expectedType: BscType;
|
|
717
|
+
}[];
|
|
718
|
+
fieldMismatches?: {
|
|
719
|
+
name: string;
|
|
720
|
+
expectedType: BscType;
|
|
721
|
+
actualType: BscType;
|
|
722
|
+
}[];
|
|
723
|
+
depth?: number;
|
|
724
|
+
}
|
|
725
|
+
export interface NamespaceContainer {
|
|
726
|
+
file: File;
|
|
727
|
+
fullName: string;
|
|
728
|
+
fullNameLower: string;
|
|
729
|
+
parentNameLower: string;
|
|
730
|
+
nameParts: Identifier[];
|
|
731
|
+
nameRange: Range;
|
|
732
|
+
lastPartName: string;
|
|
733
|
+
lastPartNameLower: string;
|
|
734
|
+
functionStatements: Map<string, FunctionStatement>;
|
|
735
|
+
isTopLevel: boolean;
|
|
736
|
+
namespaceStatements?: NamespaceStatement[];
|
|
737
|
+
statements?: Statement[];
|
|
738
|
+
classStatements?: Map<string, ClassStatement>;
|
|
739
|
+
enumStatements?: Map<string, EnumStatement>;
|
|
740
|
+
constStatements?: Map<string, ConstStatement>;
|
|
741
|
+
namespaces?: Map<string, NamespaceContainer>;
|
|
742
|
+
symbolTable: SymbolTable;
|
|
448
743
|
}
|
package/dist/interfaces.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TypeChainEntry = void 0;
|
|
3
|
+
exports.TypeChainEntry = exports.DiagnosticOrigin = void 0;
|
|
4
|
+
const creators_1 = require("./astUtils/creators");
|
|
5
|
+
const TokenKind_1 = require("./lexer/TokenKind");
|
|
6
|
+
var DiagnosticOrigin;
|
|
7
|
+
(function (DiagnosticOrigin) {
|
|
8
|
+
DiagnosticOrigin["Program"] = "Program";
|
|
9
|
+
DiagnosticOrigin["Scope"] = "Scope";
|
|
10
|
+
DiagnosticOrigin["File"] = "File";
|
|
11
|
+
DiagnosticOrigin["ASTSegment"] = "AstSegment";
|
|
12
|
+
})(DiagnosticOrigin = exports.DiagnosticOrigin || (exports.DiagnosticOrigin = {}));
|
|
4
13
|
class TypeChainEntry {
|
|
5
|
-
constructor(name, type, range) {
|
|
14
|
+
constructor(name, type, flags, range, separatorToken = (0, creators_1.createToken)(TokenKind_1.TokenKind.Dot)) {
|
|
6
15
|
this.name = name;
|
|
7
16
|
this.type = type;
|
|
17
|
+
this.flags = flags;
|
|
8
18
|
this.range = range;
|
|
19
|
+
this.separatorToken = separatorToken;
|
|
9
20
|
}
|
|
10
21
|
get isResolved() {
|
|
11
22
|
var _a;
|