brighterscript 0.66.0-alpha.6 → 0.66.0-alpha.8
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 +88 -10
- package/README.md +16 -0
- 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 +15 -1
- package/dist/CommentFlagProcessor.d.ts +4 -3
- package/dist/CommentFlagProcessor.js.map +1 -1
- package/dist/DiagnosticMessages.d.ts +8 -1
- package/dist/DiagnosticMessages.js +30 -13
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/LanguageServer.js +7 -1
- package/dist/LanguageServer.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 +107 -38
- package/dist/Program.js +502 -270
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +10 -4
- package/dist/ProgramBuilder.js +44 -54
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +26 -38
- package/dist/Scope.js +153 -174
- package/dist/Scope.js.map +1 -1
- package/dist/SymbolTable.d.ts +4 -1
- package/dist/SymbolTable.js +19 -7
- package/dist/SymbolTable.js.map +1 -1
- package/dist/XmlScope.d.ts +5 -4
- package/dist/XmlScope.js +16 -14
- 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/reflection.d.ts +9 -4
- package/dist/astUtils/reflection.js +23 -7
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/reflection.spec.js +2 -2
- 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/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.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +7 -2
- package/dist/bscPlugin/completions/CompletionsProcessor.js +112 -44
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +212 -6
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +1 -1
- 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 +1 -7
- package/dist/bscPlugin/hover/HoverProcessor.js +10 -8
- package/dist/bscPlugin/hover/HoverProcessor.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.js +8 -3
- 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 +5 -9
- package/dist/bscPlugin/validation/ScopeValidator.js +214 -222
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.spec.js +669 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -1
- package/dist/bscPlugin/validation/XmlFileValidator.js +2 -2
- package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -1
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/deferred.d.ts +2 -2
- package/dist/deferred.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +1 -0
- package/dist/diagnosticUtils.js +4 -3
- 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 +241 -40
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +66 -16
- package/dist/files/BrsFile.js +330 -80
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +1134 -167
- 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 +55 -17
- package/dist/files/XmlFile.js +88 -47
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/files/XmlFile.spec.js +64 -57
- 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 +1 -1
- package/dist/globalCallables.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +357 -89
- package/dist/interfaces.js +10 -2
- package/dist/interfaces.js.map +1 -1
- package/dist/lexer/Lexer.js +1 -1
- package/dist/lexer/TokenKind.d.ts +1 -0
- package/dist/lexer/TokenKind.js +4 -1
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/parser/AstNode.d.ts +2 -2
- package/dist/parser/AstNode.js +1 -1
- 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 +2 -2
- package/dist/parser/Expression.js +23 -19
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.Class.spec.js +103 -0
- package/dist/parser/Parser.Class.spec.js.map +1 -1
- package/dist/parser/Parser.js +61 -13
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Parser.spec.js +227 -1
- package/dist/parser/Parser.spec.js.map +1 -1
- package/dist/parser/SGParser.d.ts +2 -2
- 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 +1 -1
- package/dist/parser/Statement.d.ts +12 -5
- package/dist/parser/Statement.js +56 -26
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +16 -16
- 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 +64 -36
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +34 -34
- 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 +90 -16
- 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 +35 -26
- 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 +20 -12
- package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +10 -10
- package/dist/parser/tests/statement/PrintStatement.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 +98 -193
- package/dist/roku-types/index.d.ts +15 -11
- package/dist/types/ArrayType.d.ts +1 -1
- package/dist/types/ArrayType.js +4 -0
- package/dist/types/ArrayType.js.map +1 -1
- package/dist/types/ArrayType.spec.js +1 -1
- package/dist/types/ArrayType.spec.js.map +1 -1
- package/dist/types/AssociativeArrayType.d.ts +1 -1
- package/dist/types/AssociativeArrayType.js +1 -1
- package/dist/types/AssociativeArrayType.js.map +1 -1
- package/dist/types/BooleanType.d.ts +1 -1
- package/dist/types/BooleanType.js +2 -1
- package/dist/types/BooleanType.js.map +1 -1
- package/dist/types/BscType.d.ts +2 -2
- package/dist/types/BscType.js +30 -9
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/BuiltInInterfaceAdder.d.ts +3 -0
- package/dist/types/BuiltInInterfaceAdder.js +37 -16
- package/dist/types/BuiltInInterfaceAdder.js.map +1 -1
- package/dist/types/BuiltInInterfaceAdder.spec.js +7 -0
- package/dist/types/BuiltInInterfaceAdder.spec.js.map +1 -1
- package/dist/types/ClassType.d.ts +4 -3
- package/dist/types/ClassType.js +6 -3
- 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 +1 -1
- package/dist/types/ComponentType.js +3 -0
- package/dist/types/ComponentType.js.map +1 -1
- package/dist/types/DoubleType.js +3 -1
- package/dist/types/DoubleType.js.map +1 -1
- package/dist/types/EnumType.d.ts +1 -1
- package/dist/types/EnumType.js +7 -2
- package/dist/types/EnumType.js.map +1 -1
- package/dist/types/FloatType.js +3 -1
- package/dist/types/FloatType.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.js +3 -1
- package/dist/types/IntegerType.js.map +1 -1
- package/dist/types/InterfaceType.d.ts +5 -4
- package/dist/types/InterfaceType.js +5 -12
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/InterfaceType.spec.js +23 -0
- package/dist/types/InterfaceType.spec.js.map +1 -1
- package/dist/types/LongIntegerType.js +3 -1
- 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 +1 -1
- package/dist/types/ReferenceType.js +40 -6
- package/dist/types/ReferenceType.js.map +1 -1
- package/dist/types/StringType.js +2 -2
- package/dist/types/StringType.js.map +1 -1
- package/dist/types/TypedFunctionType.d.ts +6 -1
- package/dist/types/TypedFunctionType.js +46 -16
- package/dist/types/TypedFunctionType.js.map +1 -1
- package/dist/types/TypedFunctionType.spec.js +99 -0
- package/dist/types/TypedFunctionType.spec.js.map +1 -1
- package/dist/types/UnionType.js +8 -0
- package/dist/types/UnionType.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 +3 -0
- package/dist/types/helpers.js +33 -1
- package/dist/types/helpers.js.map +1 -1
- package/dist/util.d.ts +25 -9
- package/dist/util.js +165 -72
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +2 -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/astUtils/{AstEditor.spec.d.ts → Editor.spec.d.ts} +0 -0
- /package/dist/bscPlugin/{transpile/BrsFilePreTranspileProcessor.spec.d.ts → serialize/BslibInjector.spec.d.ts} +0 -0
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
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';
|
|
@@ -7,25 +8,37 @@ 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 { AstNode, 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';
|
|
18
22
|
import type { CallExpression } from './parser/Expression';
|
|
19
23
|
export interface BsDiagnostic extends Diagnostic {
|
|
20
|
-
file:
|
|
24
|
+
file: File;
|
|
21
25
|
/**
|
|
22
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.
|
|
23
27
|
*/
|
|
24
28
|
data?: any;
|
|
25
29
|
}
|
|
26
|
-
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
|
+
}
|
|
27
40
|
export interface Callable {
|
|
28
|
-
file:
|
|
41
|
+
file: File;
|
|
29
42
|
name: string;
|
|
30
43
|
/**
|
|
31
44
|
* Is the callable declared as "sub". If falsey, assumed declared as "function"
|
|
@@ -103,12 +116,12 @@ export interface FileObj {
|
|
|
103
116
|
*/
|
|
104
117
|
export interface FileReference {
|
|
105
118
|
/**
|
|
106
|
-
* The
|
|
119
|
+
* The destPath for the referenced file.
|
|
107
120
|
*/
|
|
108
|
-
|
|
121
|
+
destPath: string;
|
|
109
122
|
text: string;
|
|
110
123
|
/**
|
|
111
|
-
* 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.
|
|
112
125
|
*/
|
|
113
126
|
sourceFile: XmlFile | BrsFile;
|
|
114
127
|
/**
|
|
@@ -119,14 +132,6 @@ export interface FileReference {
|
|
|
119
132
|
*/
|
|
120
133
|
filePathRange?: Range;
|
|
121
134
|
}
|
|
122
|
-
export interface File {
|
|
123
|
-
/**
|
|
124
|
-
* The absolute path to the file, relative to the pkg
|
|
125
|
-
*/
|
|
126
|
-
pkgPath: string;
|
|
127
|
-
srcPath: string;
|
|
128
|
-
getDiagnostics(): BsDiagnostic[];
|
|
129
|
-
}
|
|
130
135
|
export interface VariableDeclaration {
|
|
131
136
|
name: string;
|
|
132
137
|
getType: () => BscType;
|
|
@@ -160,7 +165,7 @@ export interface CallableContainer {
|
|
|
160
165
|
}
|
|
161
166
|
export declare type CallableContainerMap = Map<string, CallableContainer[]>;
|
|
162
167
|
export interface CommentFlag {
|
|
163
|
-
file:
|
|
168
|
+
file: File;
|
|
164
169
|
/**
|
|
165
170
|
* The location of the ignore comment.
|
|
166
171
|
*/
|
|
@@ -174,18 +179,42 @@ export interface CommentFlag {
|
|
|
174
179
|
export declare type CompilerPluginFactory = () => CompilerPlugin;
|
|
175
180
|
export interface CompilerPlugin {
|
|
176
181
|
name: string;
|
|
182
|
+
/**
|
|
183
|
+
* Called before a new program is created
|
|
184
|
+
*/
|
|
177
185
|
beforeProgramCreate?: PluginHandler<BeforeProgramCreateEvent>;
|
|
186
|
+
/**
|
|
187
|
+
* Called after a new program is created
|
|
188
|
+
*/
|
|
178
189
|
afterProgramCreate?: PluginHandler<AfterProgramCreateEvent>;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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
|
+
*/
|
|
183
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
|
+
*/
|
|
184
213
|
afterProgramValidate?: PluginHandler<AfterProgramValidateEvent>;
|
|
185
|
-
|
|
186
|
-
|
|
214
|
+
/**
|
|
215
|
+
* Called right before the program is disposed/destroyed
|
|
216
|
+
*/
|
|
187
217
|
beforeProgramDispose?: PluginHandler<BeforeProgramDisposeEvent>;
|
|
188
|
-
onGetCodeActions?: PluginHandler<OnGetCodeActionsEvent>;
|
|
189
218
|
/**
|
|
190
219
|
* Emitted before the program starts collecting completions
|
|
191
220
|
*/
|
|
@@ -210,15 +239,49 @@ export interface CompilerPlugin {
|
|
|
210
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.
|
|
211
240
|
*/
|
|
212
241
|
afterProvideHover?: PluginHandler<AfterProvideHoverEvent>;
|
|
213
|
-
|
|
242
|
+
/**
|
|
243
|
+
* Called after a scope was created
|
|
244
|
+
*/
|
|
214
245
|
afterScopeCreate?: PluginHandler<AfterScopeCreateEvent>;
|
|
215
246
|
beforeScopeDispose?: PluginHandler<BeforeScopeDisposeEvent>;
|
|
247
|
+
onScopeDispose?: PluginHandler<OnScopeDisposeEvent>;
|
|
216
248
|
afterScopeDispose?: PluginHandler<AfterScopeDisposeEvent>;
|
|
217
249
|
beforeScopeValidate?: PluginHandler<BeforeScopeValidateEvent>;
|
|
218
250
|
onScopeValidate?: PluginHandler<OnScopeValidateEvent>;
|
|
219
251
|
afterScopeValidate?: PluginHandler<BeforeScopeValidateEvent>;
|
|
220
|
-
|
|
221
|
-
|
|
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>;
|
|
222
285
|
/**
|
|
223
286
|
* Called before each file is validated
|
|
224
287
|
*/
|
|
@@ -231,61 +294,111 @@ export interface CompilerPlugin {
|
|
|
231
294
|
* Called after each file is validated
|
|
232
295
|
*/
|
|
233
296
|
afterFileValidate?: PluginHandler<AfterFileValidateEvent>;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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>;
|
|
238
362
|
}
|
|
239
363
|
export declare type PluginHandler<T, R = void> = (event: T) => R;
|
|
240
|
-
export interface
|
|
241
|
-
builder: ProgramBuilder;
|
|
242
|
-
}
|
|
243
|
-
export interface AfterProgramCreateEvent {
|
|
244
|
-
builder: ProgramBuilder;
|
|
364
|
+
export interface OnGetCodeActionsEvent<TFile extends File = File> {
|
|
245
365
|
program: Program;
|
|
366
|
+
file: TFile;
|
|
367
|
+
range: Range;
|
|
368
|
+
scopes: Scope[];
|
|
369
|
+
diagnostics: BsDiagnostic[];
|
|
370
|
+
codeActions: CodeAction[];
|
|
246
371
|
}
|
|
247
|
-
export interface
|
|
372
|
+
export interface BeforeProgramCreateEvent {
|
|
248
373
|
builder: ProgramBuilder;
|
|
249
|
-
program: Program;
|
|
250
|
-
files: FileObj[];
|
|
251
374
|
}
|
|
252
|
-
export
|
|
253
|
-
export interface BeforePublishEvent {
|
|
375
|
+
export interface AfterProgramCreateEvent {
|
|
254
376
|
builder: ProgramBuilder;
|
|
255
377
|
program: Program;
|
|
256
|
-
files: FileObj[];
|
|
257
378
|
}
|
|
258
|
-
export declare type AfterPublishEvent = BeforePublishEvent;
|
|
259
379
|
export interface BeforeProgramValidateEvent {
|
|
260
380
|
program: Program;
|
|
261
381
|
}
|
|
382
|
+
export declare type OnProgramValidateEvent = BeforeProgramValidateEvent;
|
|
262
383
|
export declare type AfterProgramValidateEvent = BeforeProgramValidateEvent;
|
|
263
|
-
export interface
|
|
264
|
-
program: Program;
|
|
265
|
-
entries: TranspileEntry[];
|
|
266
|
-
editor: AstEditor;
|
|
267
|
-
}
|
|
268
|
-
export declare type AfterProgramTranspileEvent = BeforeProgramTranspileEvent;
|
|
269
|
-
export interface OnGetCodeActionsEvent {
|
|
270
|
-
program: Program;
|
|
271
|
-
file: BscFile;
|
|
272
|
-
range: Range;
|
|
273
|
-
scopes: Scope[];
|
|
274
|
-
diagnostics: BsDiagnostic[];
|
|
275
|
-
codeActions: CodeAction[];
|
|
276
|
-
}
|
|
277
|
-
export interface ProvideCompletionsEvent<TFile extends BscFile = BscFile> {
|
|
384
|
+
export interface ProvideCompletionsEvent<TFile extends File = File> {
|
|
278
385
|
program: Program;
|
|
279
386
|
file: TFile;
|
|
280
387
|
scopes: Scope[];
|
|
281
388
|
position: Position;
|
|
282
389
|
completions: CompletionItem[];
|
|
283
390
|
}
|
|
284
|
-
export declare type BeforeProvideCompletionsEvent<TFile extends
|
|
285
|
-
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;
|
|
286
399
|
export interface ProvideHoverEvent {
|
|
287
400
|
program: Program;
|
|
288
|
-
file:
|
|
401
|
+
file: File;
|
|
289
402
|
position: Position;
|
|
290
403
|
scopes: Scope[];
|
|
291
404
|
hovers: Hover[];
|
|
@@ -315,6 +428,10 @@ export interface BeforeScopeDisposeEvent {
|
|
|
315
428
|
program: Program;
|
|
316
429
|
scope: Scope;
|
|
317
430
|
}
|
|
431
|
+
export interface OnScopeDisposeEvent {
|
|
432
|
+
program: Program;
|
|
433
|
+
scope: Scope;
|
|
434
|
+
}
|
|
318
435
|
export interface AfterScopeDisposeEvent {
|
|
319
436
|
program: Program;
|
|
320
437
|
scope: Scope;
|
|
@@ -329,11 +446,16 @@ export interface BeforeFileParseEvent {
|
|
|
329
446
|
srcPath: string;
|
|
330
447
|
source: string;
|
|
331
448
|
}
|
|
449
|
+
export interface OnFileParseEvent {
|
|
450
|
+
program: Program;
|
|
451
|
+
srcPath: string;
|
|
452
|
+
source: string;
|
|
453
|
+
}
|
|
332
454
|
export interface AfterFileParseEvent {
|
|
333
455
|
program: Program;
|
|
334
|
-
file:
|
|
456
|
+
file: File;
|
|
335
457
|
}
|
|
336
|
-
export interface OnGetSemanticTokensEvent<T extends
|
|
458
|
+
export interface OnGetSemanticTokensEvent<T extends File = File> {
|
|
337
459
|
/**
|
|
338
460
|
* The program this file is from
|
|
339
461
|
*/
|
|
@@ -352,32 +474,31 @@ export interface OnGetSemanticTokensEvent<T extends BscFile = BscFile> {
|
|
|
352
474
|
semanticTokens: SemanticToken[];
|
|
353
475
|
}
|
|
354
476
|
export declare type BeforeFileValidateEvent = OnFileValidateEvent;
|
|
355
|
-
export interface OnFileValidateEvent<T extends
|
|
477
|
+
export interface OnFileValidateEvent<T extends File = File> {
|
|
356
478
|
program: Program;
|
|
357
479
|
file: T;
|
|
358
480
|
}
|
|
359
481
|
export declare type AfterFileValidateEvent = OnFileValidateEvent;
|
|
482
|
+
export interface OnFileValidateEvent<T extends File = File> {
|
|
483
|
+
program: Program;
|
|
484
|
+
file: T;
|
|
485
|
+
}
|
|
360
486
|
export interface TranspileEntry {
|
|
361
|
-
file:
|
|
487
|
+
file: File;
|
|
362
488
|
outputPath: string;
|
|
363
489
|
}
|
|
490
|
+
export interface ScopeValidationOptions {
|
|
491
|
+
changedFiles?: File[];
|
|
492
|
+
changedSymbols?: Map<SymbolTypeFlag, Set<string>>;
|
|
493
|
+
force?: boolean;
|
|
494
|
+
}
|
|
364
495
|
export interface OnScopeValidateEvent {
|
|
365
496
|
program: Program;
|
|
366
497
|
scope: Scope;
|
|
498
|
+
changedFiles?: File[];
|
|
499
|
+
changedSymbols?: Map<SymbolTypeFlag, Set<string>>;
|
|
367
500
|
}
|
|
368
|
-
export
|
|
369
|
-
export interface BeforeFileTranspileEvent<TFile extends BscFile = BscFile> {
|
|
370
|
-
program: Program;
|
|
371
|
-
file: TFile;
|
|
372
|
-
outputPath: string;
|
|
373
|
-
/**
|
|
374
|
-
* An editor that can be used to transform properties or arrays. Once the `afterFileTranspile` event has fired, these changes will be reverted,
|
|
375
|
-
* 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
|
|
376
|
-
* the changes to persist in the in-memory file.
|
|
377
|
-
*/
|
|
378
|
-
editor: Editor;
|
|
379
|
-
}
|
|
380
|
-
export interface AfterFileTranspileEvent<TFile extends BscFile = BscFile> {
|
|
501
|
+
export interface AfterFileTranspileEvent<TFile extends File = File> {
|
|
381
502
|
/**
|
|
382
503
|
* The program this event was triggered for
|
|
383
504
|
*/
|
|
@@ -391,21 +512,145 @@ export interface AfterFileTranspileEvent<TFile extends BscFile = BscFile> {
|
|
|
391
512
|
/**
|
|
392
513
|
* The sourceMaps for the generated code (if emitting source maps is enabled)
|
|
393
514
|
*/
|
|
394
|
-
map?:
|
|
515
|
+
map?: string;
|
|
395
516
|
/**
|
|
396
517
|
* The generated type definition file contents (if emitting type definitions are enabled)
|
|
397
518
|
*/
|
|
398
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;
|
|
539
|
+
/**
|
|
540
|
+
* An array of files that should be added to the program as a result of this event
|
|
541
|
+
*/
|
|
542
|
+
files: TFile[];
|
|
543
|
+
/**
|
|
544
|
+
* The program for this event
|
|
545
|
+
*/
|
|
546
|
+
program: Program;
|
|
399
547
|
/**
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
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)
|
|
403
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;
|
|
571
|
+
editor: Editor;
|
|
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;
|
|
404
581
|
editor: Editor;
|
|
405
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
|
+
}
|
|
406
651
|
export interface BeforeFileDisposeEvent {
|
|
407
652
|
program: Program;
|
|
408
|
-
file:
|
|
653
|
+
file: File;
|
|
409
654
|
}
|
|
410
655
|
export declare type AfterFileDisposeEvent = BeforeFileDisposeEvent;
|
|
411
656
|
export interface BeforeProgramDisposeEvent {
|
|
@@ -423,7 +668,7 @@ export interface TypedefProvider {
|
|
|
423
668
|
getTypedef(state: TranspileState): Array<SourceNode | string>;
|
|
424
669
|
}
|
|
425
670
|
export declare type TranspileResult = Array<(string | SourceNode)>;
|
|
426
|
-
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;
|
|
427
672
|
export interface ExpressionInfo {
|
|
428
673
|
expressions: Expression[];
|
|
429
674
|
varExpressions: Expression[];
|
|
@@ -438,19 +683,22 @@ export interface ExtraSymbolData {
|
|
|
438
683
|
definingNode?: AstNode;
|
|
439
684
|
description?: string;
|
|
440
685
|
completionPriority?: number;
|
|
686
|
+
flags?: SymbolTypeFlag;
|
|
441
687
|
}
|
|
442
688
|
export interface GetTypeOptions {
|
|
443
689
|
flags: SymbolTypeFlag;
|
|
444
690
|
typeChain?: TypeChainEntry[];
|
|
445
691
|
data?: ExtraSymbolData;
|
|
446
692
|
ignoreCall?: boolean;
|
|
693
|
+
onlyCacheResolvedTypes?: boolean;
|
|
447
694
|
}
|
|
448
695
|
export declare class TypeChainEntry {
|
|
449
696
|
name: string;
|
|
450
697
|
type: BscType;
|
|
698
|
+
flags: SymbolTypeFlag;
|
|
451
699
|
range: Range;
|
|
452
700
|
separatorToken: Token;
|
|
453
|
-
constructor(name: string, type: BscType, range: Range, separatorToken?: Token);
|
|
701
|
+
constructor(name: string, type: BscType, flags: SymbolTypeFlag, range: Range, separatorToken?: Token);
|
|
454
702
|
get isResolved(): boolean;
|
|
455
703
|
}
|
|
456
704
|
export interface TypeChainProcessResult {
|
|
@@ -471,4 +719,24 @@ export interface TypeCompatibilityData {
|
|
|
471
719
|
expectedType: BscType;
|
|
472
720
|
actualType: BscType;
|
|
473
721
|
}[];
|
|
722
|
+
depth?: number;
|
|
723
|
+
}
|
|
724
|
+
export interface NamespaceContainer {
|
|
725
|
+
file: File;
|
|
726
|
+
fullName: string;
|
|
727
|
+
fullNameLower: string;
|
|
728
|
+
parentNameLower: string;
|
|
729
|
+
nameParts: Identifier[];
|
|
730
|
+
nameRange: Range;
|
|
731
|
+
lastPartName: string;
|
|
732
|
+
lastPartNameLower: string;
|
|
733
|
+
functionStatements: Map<string, FunctionStatement>;
|
|
734
|
+
isTopLevel: boolean;
|
|
735
|
+
namespaceStatements?: NamespaceStatement[];
|
|
736
|
+
statements?: Statement[];
|
|
737
|
+
classStatements?: Map<string, ClassStatement>;
|
|
738
|
+
enumStatements?: Map<string, EnumStatement>;
|
|
739
|
+
constStatements?: Map<string, ConstStatement>;
|
|
740
|
+
namespaces?: Map<string, NamespaceContainer>;
|
|
741
|
+
symbolTable: SymbolTable;
|
|
474
742
|
}
|
package/dist/interfaces.js
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
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
4
|
const creators_1 = require("./astUtils/creators");
|
|
5
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 = {}));
|
|
6
13
|
class TypeChainEntry {
|
|
7
|
-
constructor(name, type, range, separatorToken = (0, creators_1.createToken)(TokenKind_1.TokenKind.Dot)) {
|
|
14
|
+
constructor(name, type, flags, range, separatorToken = (0, creators_1.createToken)(TokenKind_1.TokenKind.Dot)) {
|
|
8
15
|
this.name = name;
|
|
9
16
|
this.type = type;
|
|
17
|
+
this.flags = flags;
|
|
10
18
|
this.range = range;
|
|
11
19
|
this.separatorToken = separatorToken;
|
|
12
20
|
}
|
package/dist/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;AAqBA,kDAAkD;AAClD,iDAA8C;AAU9C,IAAY,gBAKX;AALD,WAAY,gBAAgB;IACxB,uCAAmB,CAAA;IACnB,mCAAe,CAAA;IACf,iCAAa,CAAA;IACb,6CAAyB,CAAA;AAC7B,CAAC,EALW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAK3B;AA6uBD,MAAa,cAAc;IACvB,YAAmB,IAAY,EAAS,IAAa,EAAS,KAAqB,EAAS,KAAY,EAAS,iBAAwB,IAAA,sBAAW,EAAC,qBAAS,CAAC,GAAG,CAAC;QAAhJ,SAAI,GAAJ,IAAI,CAAQ;QAAS,SAAI,GAAJ,IAAI,CAAS;QAAS,UAAK,GAAL,KAAK,CAAgB;QAAS,UAAK,GAAL,KAAK,CAAO;QAAS,mBAAc,GAAd,cAAc,CAAoC;IACnK,CAAC;IACD,IAAI,UAAU;;QACV,OAAO,MAAA,IAAI,CAAC,IAAI,0CAAE,YAAY,EAAE,CAAC;IACrC,CAAC;CACJ;AAND,wCAMC"}
|
package/dist/lexer/Lexer.js
CHANGED