/// /// import type { Diagnostic, Position, Range, Location } from 'vscode-languageserver'; import type { BsConfig, FinalizedBsConfig } from './BsConfig'; import type { CallableContainer, BsDiagnostic, FileReference, CallableContainerMap, Plugin, ExpressionInfo, TranspileResult, MaybePromise, DisposableLike } from './interfaces'; import { BooleanType } from './types/BooleanType'; import { DoubleType } from './types/DoubleType'; import { DynamicType } from './types/DynamicType'; import { FloatType } from './types/FloatType'; import { FunctionType } from './types/FunctionType'; import { IntegerType } from './types/IntegerType'; import { InvalidType } from './types/InvalidType'; import { LongIntegerType } from './types/LongIntegerType'; import { ObjectType } from './types/ObjectType'; import { StringType } from './types/StringType'; import { VoidType } from './types/VoidType'; import type { DottedGetExpression, VariableExpression } from './parser/Expression'; import type { Identifier, Locatable, Token } from './lexer/Token'; import { CustomType } from './types/CustomType'; import { SourceNode } from 'source-map'; import type { RawSourceMap, SourceMapGenerator } from 'source-map'; import type { SGAttribute } from './parser/SGTypes'; import type { BrsFile } from './files/BrsFile'; import type { XmlFile } from './files/XmlFile'; import type { Expression, Statement } from './parser/AstNode'; export declare class Util { clearConsole(): void; /** * Get the version of brighterscript */ getBrighterScriptVersion(): any; /** * Returns the number of parent directories in the filPath */ getParentDirectoryCount(filePath: string | undefined): number; /** * Determine if the file exists */ pathExists(filePath: string | undefined): Promise; /** * Determine if the file exists */ pathExistsSync(filePath: string | undefined): boolean; /** * Determine if this path is a directory */ isDirectorySync(dirPath: string | undefined): boolean; /** * Read a file from disk. If a failure occurrs, simply return undefined * @param filePath path to the file * @returns the string contents, or undefined if the file doesn't exist */ readFileSync(filePath: string): Buffer | undefined; /** * Given a pkg path of any kind, transform it to a roku-specific pkg path (i.e. "pkg:/some/path.brs") */ sanitizePkgPath(pkgPath: string): string; /** * Determine if the given path starts with a protocol */ startsWithProtocol(path: string): boolean; /** * Given a pkg path of any kind, transform it to a roku-specific pkg path (i.e. "pkg:/some/path.brs") */ getRokuPkgPath(pkgPath: string): string; /** * Given a path to a file/directory, replace all path separators with the current system's version. */ pathSepNormalize(filePath: string, separator?: string): string; /** * Find the path to the config file. * If the config file path doesn't exist * @param cwd the current working directory where the search for configs should begin */ getConfigFilePath(cwd?: string): string; getRangeFromOffsetLength(text: string, offset: number, length: number): Range; /** * Load the contents of a config file. * If the file extends another config, this will load the base config as well. * @param configFilePath the relative or absolute path to a brighterscript config json file * @param parentProjectPaths a list of parent config files. This is used by this method to recursively build the config list */ loadConfigFile(configFilePath: string | undefined, parentProjectPaths?: string[], cwd?: string): BsConfig | undefined; /** * Convert relative paths to absolute paths, relative to the given directory. Also de-dupes the paths. Modifies the array in-place * @param collection usually a bsconfig. * @param key a key of the config to read paths from (usually this is `'plugins'` or `'require'`) * @param relativeDir the path to the folder where the paths should be resolved relative to. This should be an absolute path */ resolvePathsRelativeTo(collection: any, key: string, relativeDir: string): void; /** * Do work within the scope of a changed current working directory * @param targetCwd the cwd where the work should be performed * @param callback a function to call when the cwd has been changed to `targetCwd` */ cwdWork(targetCwd: string | null | undefined, callback: () => T): T; /** * Given a BsConfig object, start with defaults, * merge with bsconfig.json and the provided options. * @param config a bsconfig object to use as the baseline for the resulting config */ normalizeAndResolveConfig(config: BsConfig | undefined): FinalizedBsConfig; /** * Set defaults for any missing items * @param config a bsconfig object to use as the baseline for the resulting config */ normalizeConfig(config: BsConfig | undefined): FinalizedBsConfig; /** * Get the root directory from options. * Falls back to options.cwd. * Falls back to process.cwd * @param options a bsconfig object */ getRootDir(options: BsConfig): string; /** * Given a list of callables as a dictionary indexed by their full name (namespace included, transpiled to underscore-separated. */ getCallableContainersByLowerName(callables: CallableContainer[]): CallableContainerMap; /** * Split a file by newline characters (LF or CRLF) */ getLines(text: string): string[]; /** * Given an absolute path to a source file, and a target path, * compute the pkg path for the target relative to the source file's location */ getPkgPathFromTarget(containingFilePathAbsolute: string, targetPath: string): string; /** * Compute the replacement text for a file-path string (used in `import` statements and XML `