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/Program.d.ts
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import type { CodeAction, Position, Range, SignatureInformation, Location } from 'vscode-languageserver';
|
|
2
2
|
import type { BsConfig } from './BsConfig';
|
|
3
3
|
import { Scope } from './Scope';
|
|
4
|
-
import { BrsFile } from './files/BrsFile';
|
|
5
|
-
import { XmlFile } from './files/XmlFile';
|
|
6
|
-
import type { BsDiagnostic,
|
|
4
|
+
import type { BrsFile, ProvidedSymbolInfo } from './files/BrsFile';
|
|
5
|
+
import type { XmlFile } from './files/XmlFile';
|
|
6
|
+
import type { BsDiagnostic, FileObj, SemanticToken, FileLink, Hover } from './interfaces';
|
|
7
|
+
import type { File } from './files/File';
|
|
7
8
|
import { XmlScope } from './XmlScope';
|
|
8
9
|
import { Logger } from './Logger';
|
|
9
10
|
import PluginInterface from './PluginInterface';
|
|
10
11
|
import type { FunctionStatement } from './parser/Statement';
|
|
11
|
-
import
|
|
12
|
+
import { Editor } from './astUtils/Editor';
|
|
12
13
|
import type { Statement } from './parser/AstNode';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
source: string;
|
|
16
|
-
definitions?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface TranspileObj {
|
|
19
|
-
file: BscFile;
|
|
20
|
-
outputPath: string;
|
|
21
|
-
}
|
|
14
|
+
import type { FileData } from './files/LazyFileData';
|
|
15
|
+
import type { UnresolvedSymbol } from './AstValidationSegmenter';
|
|
22
16
|
export interface SignatureInfoObj {
|
|
23
17
|
index: number;
|
|
24
18
|
key: string;
|
|
@@ -35,6 +29,14 @@ export declare class Program {
|
|
|
35
29
|
*/
|
|
36
30
|
options: BsConfig, logger?: Logger, plugins?: PluginInterface);
|
|
37
31
|
logger: Logger;
|
|
32
|
+
/**
|
|
33
|
+
* An editor that plugins can use to modify program-level things during the build flow. Don't use this to edit files (they have their own `.editor`)
|
|
34
|
+
*/
|
|
35
|
+
editor: Editor;
|
|
36
|
+
/**
|
|
37
|
+
* A factory that creates `File` instances
|
|
38
|
+
*/
|
|
39
|
+
private fileFactory;
|
|
38
40
|
private createGlobalScope;
|
|
39
41
|
private recursivelyAddNodeToSymbolTable;
|
|
40
42
|
/**
|
|
@@ -64,6 +66,12 @@ export declare class Program {
|
|
|
64
66
|
* Should only be set from `this.validate()`
|
|
65
67
|
*/
|
|
66
68
|
private diagnostics;
|
|
69
|
+
private fileSymbolInformation;
|
|
70
|
+
addFileSymbolInfo(file: BrsFile): void;
|
|
71
|
+
getFileSymbolInfo(file: BrsFile): {
|
|
72
|
+
provides: ProvidedSymbolInfo;
|
|
73
|
+
requires: UnresolvedSymbol[];
|
|
74
|
+
};
|
|
67
75
|
/**
|
|
68
76
|
* The path to bslib.brs (the BrightScript runtime for certain BrighterScript features)
|
|
69
77
|
*/
|
|
@@ -72,8 +80,17 @@ export declare class Program {
|
|
|
72
80
|
/**
|
|
73
81
|
* A map of every file loaded into this program, indexed by its original file location
|
|
74
82
|
*/
|
|
75
|
-
files: Record<string,
|
|
76
|
-
|
|
83
|
+
files: Record<string, File>;
|
|
84
|
+
/**
|
|
85
|
+
* A map of every file loaded into this program, indexed by its destPath
|
|
86
|
+
*/
|
|
87
|
+
private destMap;
|
|
88
|
+
/**
|
|
89
|
+
* Plugins can contribute multiple virtual files for a single physical file.
|
|
90
|
+
* This collection links the virtual files back to the physical file that produced them.
|
|
91
|
+
* The key is the standardized and lower-cased srcPath
|
|
92
|
+
*/
|
|
93
|
+
private fileClusters;
|
|
77
94
|
private scopes;
|
|
78
95
|
protected addScope(scope: Scope): void;
|
|
79
96
|
/**
|
|
@@ -137,9 +154,9 @@ export declare class Program {
|
|
|
137
154
|
* @param normalizePath should the provided path be normalized before use
|
|
138
155
|
*/
|
|
139
156
|
hasFile(filePath: string, normalizePath?: boolean): boolean;
|
|
140
|
-
getPkgPath(...args: any[]): any;
|
|
141
157
|
/**
|
|
142
158
|
* roku filesystem is case INsensitive, so find the scope by key case insensitive
|
|
159
|
+
* @param scopeName xml scope names are their `destPath`. Source scope is stored with the key `"source"`
|
|
143
160
|
*/
|
|
144
161
|
getScopeByName(scopeName: string): Scope;
|
|
145
162
|
/**
|
|
@@ -162,17 +179,17 @@ export declare class Program {
|
|
|
162
179
|
* Load a file into the program. If that file already exists, it is replaced.
|
|
163
180
|
* If file contents are provided, those are used, Otherwise, the file is loaded from the file system
|
|
164
181
|
* @param srcDestOrPkgPath the absolute path, the pkg path (i.e. `pkg:/path/to/file.brs`), or the destPath (i.e. `path/to/file.brs` relative to `pkg:/`)
|
|
165
|
-
* @param
|
|
182
|
+
* @param fileData the file contents. omit or pass `undefined` to prevent loading the data at this time
|
|
166
183
|
*/
|
|
167
|
-
setFile<T extends
|
|
184
|
+
setFile<T extends File>(srcDestOrPkgPath: string, fileData?: FileData): T;
|
|
168
185
|
/**
|
|
169
186
|
* Load a file into the program. If that file already exists, it is replaced.
|
|
170
187
|
* @param fileEntry an object that specifies src and dest for the file.
|
|
171
|
-
* @param
|
|
188
|
+
* @param fileData the file contents. omit or pass `undefined` to prevent loading the data at this time
|
|
172
189
|
*/
|
|
173
|
-
setFile<T extends
|
|
190
|
+
setFile<T extends File>(fileEntry: FileObj, fileData: FileData): T;
|
|
174
191
|
/**
|
|
175
|
-
* Given a srcPath, a
|
|
192
|
+
* Given a srcPath, a destPath, or both, resolve whichever is missing, relative to rootDir.
|
|
176
193
|
* @param fileParam an object representing file paths
|
|
177
194
|
* @param rootDir must be a pre-normalized path
|
|
178
195
|
*/
|
|
@@ -181,6 +198,14 @@ export declare class Program {
|
|
|
181
198
|
* Remove any leading `pkg:/` found in the path
|
|
182
199
|
*/
|
|
183
200
|
private removePkgPrefix;
|
|
201
|
+
/**
|
|
202
|
+
* Is this file a .brs file found somewhere within the `pkg:/source/` folder?
|
|
203
|
+
*/
|
|
204
|
+
private isSourceBrsFile;
|
|
205
|
+
/**
|
|
206
|
+
* Is this file a .brs file found somewhere within the `pkg:/source/` folder?
|
|
207
|
+
*/
|
|
208
|
+
private isComponentsXmlFile;
|
|
184
209
|
/**
|
|
185
210
|
* Ensure source scope is created.
|
|
186
211
|
* Note: automatically called internally, and no-op if it exists already.
|
|
@@ -194,14 +219,29 @@ export declare class Program {
|
|
|
194
219
|
removeFiles(srcPaths: string[], normalizePath?: boolean): void;
|
|
195
220
|
/**
|
|
196
221
|
* Remove a file from the program
|
|
197
|
-
* @param filePath can be a srcPath, a
|
|
222
|
+
* @param filePath can be a srcPath, a destPath, or a destPath with leading `pkg:/`
|
|
198
223
|
* @param normalizePath should this function repair and standardize the path? Passing false should have a performance boost if you can guarantee your path is already sanitized
|
|
199
224
|
*/
|
|
200
|
-
removeFile(filePath: string, normalizePath?: boolean): void;
|
|
225
|
+
removeFile(filePath: string, normalizePath?: boolean, keepSymbolInformation?: boolean): void;
|
|
226
|
+
lastValidationInfo: Map<string, {
|
|
227
|
+
symbolsNotDefinedInEveryScope: {
|
|
228
|
+
symbol: UnresolvedSymbol;
|
|
229
|
+
scope: Scope;
|
|
230
|
+
}[];
|
|
231
|
+
duplicateSymbolsInSameScope: {
|
|
232
|
+
symbol: UnresolvedSymbol;
|
|
233
|
+
scope: Scope;
|
|
234
|
+
}[];
|
|
235
|
+
symbolsNotConsistentAcrossScopes: {
|
|
236
|
+
symbol: UnresolvedSymbol;
|
|
237
|
+
scopes: Scope[];
|
|
238
|
+
}[];
|
|
239
|
+
}>;
|
|
201
240
|
/**
|
|
202
241
|
* Traverse the entire project, and validate all scopes
|
|
203
242
|
*/
|
|
204
243
|
validate(): void;
|
|
244
|
+
private detectIncompatibleSymbolsAcrossScopes;
|
|
205
245
|
/**
|
|
206
246
|
* Flag all duplicate component names
|
|
207
247
|
*/
|
|
@@ -211,22 +251,22 @@ export declare class Program {
|
|
|
211
251
|
* @param filePaths can be an array of srcPath or a destPath strings
|
|
212
252
|
* @param normalizePath should this function repair and standardize the paths? Passing false should have a performance boost if you can guarantee your paths are already sanitized
|
|
213
253
|
*/
|
|
214
|
-
getFiles<T extends
|
|
254
|
+
getFiles<T extends File>(filePaths: string[], normalizePath?: boolean): T[];
|
|
215
255
|
/**
|
|
216
256
|
* Get the file at the given path
|
|
217
257
|
* @param filePath can be a srcPath or a destPath
|
|
218
258
|
* @param normalizePath should this function repair and standardize the path? Passing false should have a performance boost if you can guarantee your path is already sanitized
|
|
219
259
|
*/
|
|
220
|
-
getFile<T extends
|
|
260
|
+
getFile<T extends File>(filePath: string, normalizePath?: boolean): T;
|
|
221
261
|
/**
|
|
222
262
|
* Get a list of all scopes the file is loaded into
|
|
223
263
|
* @param file the file
|
|
224
264
|
*/
|
|
225
|
-
getScopesForFile(file:
|
|
265
|
+
getScopesForFile(file: File | string): Scope[];
|
|
226
266
|
/**
|
|
227
267
|
* Get the first found scope for a file.
|
|
228
268
|
*/
|
|
229
|
-
getFirstScopeForFile(file:
|
|
269
|
+
getFirstScopeForFile(file: File): Scope;
|
|
230
270
|
getStatementsByName(name: string, originFile: BrsFile, namespaceName?: string): FileLink<Statement>[];
|
|
231
271
|
getStatementsForXmlFile(scope: XmlScope, filterName?: string): FileLink<FunctionStatement>[];
|
|
232
272
|
/**
|
|
@@ -267,24 +307,41 @@ export declare class Program {
|
|
|
267
307
|
* @param filePath can be a srcPath or a destPath
|
|
268
308
|
*/
|
|
269
309
|
getTranspiledFileContents(filePath: string): Promise<FileTranspileResult>;
|
|
310
|
+
private getTranspiledFileContentsPipeline;
|
|
311
|
+
/**
|
|
312
|
+
* Get the absolute output path for a file
|
|
313
|
+
*/
|
|
314
|
+
private getOutputPath;
|
|
315
|
+
private getStagingDir;
|
|
316
|
+
/**
|
|
317
|
+
* Prepare the program for building
|
|
318
|
+
* @param files the list of files that should be prepared
|
|
319
|
+
*/
|
|
320
|
+
private prepare;
|
|
321
|
+
/**
|
|
322
|
+
* Generate the contents of every file
|
|
323
|
+
*/
|
|
324
|
+
private serialize;
|
|
270
325
|
/**
|
|
271
|
-
*
|
|
272
|
-
* This does not write anything to the file system
|
|
326
|
+
* Write the entire project to disk
|
|
273
327
|
*/
|
|
274
|
-
private
|
|
275
|
-
private
|
|
276
|
-
|
|
277
|
-
|
|
328
|
+
private write;
|
|
329
|
+
private buildPipeline;
|
|
330
|
+
/**
|
|
331
|
+
* Build the project. This transpiles/transforms/copies all files and moves them to the staging directory
|
|
332
|
+
* @param options the list of options used to build the program
|
|
333
|
+
*/
|
|
334
|
+
build(options?: ProgramBuildOptions): Promise<void>;
|
|
278
335
|
/**
|
|
279
336
|
* Find a list of files in the program that have a function with the given name (case INsensitive)
|
|
280
337
|
*/
|
|
281
|
-
findFilesForFunction(functionName: string):
|
|
338
|
+
findFilesForFunction(functionName: string): File[];
|
|
282
339
|
/**
|
|
283
340
|
* Find a list of files in the program that have a class with the given name (case INsensitive)
|
|
284
341
|
*/
|
|
285
|
-
findFilesForClass(className: string):
|
|
286
|
-
findFilesForNamespace(name: string):
|
|
287
|
-
findFilesForEnum(name: string):
|
|
342
|
+
findFilesForClass(className: string): File[];
|
|
343
|
+
findFilesForNamespace(name: string): File[];
|
|
344
|
+
findFilesForEnum(name: string): File[];
|
|
288
345
|
/**
|
|
289
346
|
* Get a map of the manifest information
|
|
290
347
|
*/
|
|
@@ -294,8 +351,20 @@ export declare class Program {
|
|
|
294
351
|
}
|
|
295
352
|
export interface FileTranspileResult {
|
|
296
353
|
srcPath: string;
|
|
354
|
+
destPath: string;
|
|
297
355
|
pkgPath: string;
|
|
298
356
|
code: string;
|
|
299
|
-
map:
|
|
357
|
+
map: string;
|
|
300
358
|
typedef: string;
|
|
301
359
|
}
|
|
360
|
+
export interface ProgramBuildOptions {
|
|
361
|
+
/**
|
|
362
|
+
* The directory where the final built files should be placed. This directory will be cleared before running
|
|
363
|
+
*/
|
|
364
|
+
stagingDir?: string;
|
|
365
|
+
/**
|
|
366
|
+
* An array of files to build. If omitted, the entire list of files from the program will be used instead.
|
|
367
|
+
* Typically you will want to leave this blank
|
|
368
|
+
*/
|
|
369
|
+
files?: File[];
|
|
370
|
+
}
|