UNPKG

@oazmi/build-tools

Version:

general deno build tool scripts which I practically use in all of my typescript repos

814 lines 1.89 MB
import { DenoRuntime } from "./DenoRuntime.js"; import { ts } from "./typescript.js"; export { ts }; const DiagnosticCategory = ts.DiagnosticCategory; const EmitHint = ts.EmitHint; const LanguageVariant = ts.LanguageVariant; const ModuleKind = ts.ModuleKind; const ModuleResolutionKind = ts.ModuleResolutionKind; const NewLineKind = ts.NewLineKind; const NodeFlags = ts.NodeFlags; const ObjectFlags = ts.ObjectFlags; const ScriptKind = ts.ScriptKind; const ScriptTarget = ts.ScriptTarget; const SymbolFlags = ts.SymbolFlags; const SyntaxKind = ts.SyntaxKind; const TypeFlags = ts.TypeFlags; const TypeFormatFlags = ts.TypeFormatFlags; export { DiagnosticCategory, EmitHint, LanguageVariant, ModuleKind, ModuleResolutionKind, NewLineKind, NodeFlags, ObjectFlags, ScriptKind, ScriptTarget, SymbolFlags, SyntaxKind, TypeFlags, TypeFormatFlags }; class KeyValueCache { #cacheItems = new Map(); getSize() { return this.#cacheItems.size; } getValues() { return this.#cacheItems.values(); } getValuesAsArray() { return Array.from(this.getValues()); } getKeys() { return this.#cacheItems.keys(); } getEntries() { return this.#cacheItems.entries(); } getOrCreate(key, createFunc) { let item = this.get(key); if (item == null) { item = createFunc(); this.set(key, item); } return item; } has(key) { return this.#cacheItems.has(key); } get(key) { return this.#cacheItems.get(key); } set(key, value) { this.#cacheItems.set(key, value); } replaceKey(key, newKey) { if (!this.#cacheItems.has(key)) throw new Error("Key not found."); const value = this.#cacheItems.get(key); this.#cacheItems.delete(key); this.#cacheItems.set(newKey, value); } removeByKey(key) { this.#cacheItems.delete(key); } clear() { this.#cacheItems.clear(); } } class ComparerToStoredComparer { #comparer; #storedValue; constructor(comparer, storedValue) { this.#comparer = comparer; this.#storedValue = storedValue; } compareTo(value) { return this.#comparer.compareTo(this.#storedValue, value); } } class LocaleStringComparer { static instance = new LocaleStringComparer(); compareTo(a, b) { const comparisonResult = a.localeCompare(b, "en-us-u-kf-upper"); if (comparisonResult < 0) return -1; else if (comparisonResult === 0) return 0; return 1; } } class PropertyComparer { #comparer; #getProperty; constructor(getProperty, comparer) { this.#getProperty = getProperty; this.#comparer = comparer; } compareTo(a, b) { return this.#comparer.compareTo(this.#getProperty(a), this.#getProperty(b)); } } class PropertyStoredComparer { #comparer; #getProperty; constructor(getProperty, comparer) { this.#getProperty = getProperty; this.#comparer = comparer; } compareTo(value) { return this.#comparer.compareTo(this.#getProperty(value)); } } class ArrayUtils { constructor() { } static isReadonlyArray(a) { return a instanceof Array; } static isNullOrEmpty(a) { return !(a instanceof Array) || a.length === 0; } static getUniqueItems(a) { return a.filter((item, index) => a.indexOf(item) === index); } static removeFirst(a, item) { const index = a.indexOf(item); if (index === -1) return false; a.splice(index, 1); return true; } static removeAll(a, isMatch) { const removedItems = []; for (let i = a.length - 1; i >= 0; i--) { if (isMatch(a[i])) { removedItems.push(a[i]); a.splice(i, 1); } } return removedItems; } static *toIterator(items) { for (const item of items) yield item; } static sortByProperty(items, getProp) { items.sort((a, b) => getProp(a) <= getProp(b) ? -1 : 1); return items; } static groupBy(items, getGroup) { const result = []; const groups = {}; for (const item of items) { const group = getGroup(item).toString(); if (groups[group] == null) { groups[group] = []; result.push(groups[group]); } groups[group].push(item); } return result; } static binaryInsertWithOverwrite(items, newItem, comparer) { let top = items.length - 1; let bottom = 0; while (bottom <= top) { const mid = Math.floor((top + bottom) / 2); if (comparer.compareTo(newItem, items[mid]) < 0) top = mid - 1; else bottom = mid + 1; } if (items[top] != null && comparer.compareTo(newItem, items[top]) === 0) items[top] = newItem; else items.splice(top + 1, 0, newItem); } static binarySearch(items, storedComparer) { let top = items.length - 1; let bottom = 0; while (bottom <= top) { const mid = Math.floor((top + bottom) / 2); const comparisonResult = storedComparer.compareTo(items[mid]); if (comparisonResult === 0) return mid; else if (comparisonResult < 0) top = mid - 1; else bottom = mid + 1; } return -1; } static containsSubArray(items, subArray) { let findIndex = 0; for (const item of items) { if (subArray[findIndex] === item) { findIndex++; if (findIndex === subArray.length) return true; } else { findIndex = 0; } } return false; } } function deepClone(objToClone) { return clone(objToClone); function clone(obj) { const newObj = Object.create(obj.constructor.prototype); for (const propName of Object.keys(obj)) newObj[propName] = cloneItem(obj[propName]); return newObj; } function cloneArray(array) { return array.map(cloneItem); } function cloneItem(item) { if (item instanceof Array) return cloneArray(item); else if (typeof item === "object") return item === null ? item : clone(item); return item; } } class EventContainer { #subscriptions = []; subscribe(subscription) { const index = this.#getIndex(subscription); if (index === -1) this.#subscriptions.push(subscription); } unsubscribe(subscription) { const index = this.#getIndex(subscription); if (index >= 0) this.#subscriptions.splice(index, 1); } fire(arg) { for (const subscription of this.#subscriptions) subscription(arg); } #getIndex(subscription) { return this.#subscriptions.indexOf(subscription); } } class IterableUtils { static find(items, condition) { for (const item of items) { if (condition(item)) return item; } return undefined; } } function nameof(key1, key2) { return key2 ?? key1; } class ObjectUtils { constructor() { } static clone(obj) { if (obj == null) return undefined; if (obj instanceof Array) return cloneArray(obj); return Object.assign({}, obj); function cloneArray(a) { return a.map(item => ObjectUtils.clone(item)); } } } function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getEntries, realpath, directoryExists) { return ts.matchFiles.apply(this, arguments); } function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory) { return ts.getFileMatcherPatterns.apply(this, arguments); } function getEmitModuleResolutionKind(compilerOptions) { return ts.getEmitModuleResolutionKind.apply(this, arguments); } function getSyntaxKindName(kind) { return getKindCache()[kind]; } let kindCache = undefined; function getKindCache() { if (kindCache != null) return kindCache; kindCache = {}; for (const name of Object.keys(ts.SyntaxKind).filter(k => isNaN(parseInt(k, 10)))) { const value = ts.SyntaxKind[name]; if (kindCache[value] == null) kindCache[value] = name; } return kindCache; } var errors; (function (errors) { class BaseError extends Error { constructor(message, node) { const nodeLocation = node && getPrettyNodeLocation(node); const messageWithLocation = nodeLocation ? `${message}\n\n${nodeLocation}` : message; super(messageWithLocation); this.message = messageWithLocation; } } errors.BaseError = BaseError; class ArgumentError extends BaseError { constructor(argName, message, node) { super(`Argument Error (${argName}): ${message}`, node); } } errors.ArgumentError = ArgumentError; class ArgumentNullOrWhitespaceError extends ArgumentError { constructor(argName, node) { super(argName, "Cannot be null or whitespace.", node); } } errors.ArgumentNullOrWhitespaceError = ArgumentNullOrWhitespaceError; class ArgumentOutOfRangeError extends ArgumentError { constructor(argName, value, range, node) { super(argName, `Range is ${range[0]} to ${range[1]}, but ${value} was provided.`, node); } } errors.ArgumentOutOfRangeError = ArgumentOutOfRangeError; class ArgumentTypeError extends ArgumentError { constructor(argName, expectedType, actualType, node) { super(argName, `Expected type '${expectedType}', but was '${actualType}'.`, node); } } errors.ArgumentTypeError = ArgumentTypeError; class PathNotFoundError extends BaseError { path; constructor(path, prefix = "Path") { super(`${prefix} not found: ${path}`); this.path = path; } code = "ENOENT"; } errors.PathNotFoundError = PathNotFoundError; class DirectoryNotFoundError extends PathNotFoundError { constructor(dirPath) { super(dirPath, "Directory"); } } errors.DirectoryNotFoundError = DirectoryNotFoundError; class FileNotFoundError extends PathNotFoundError { constructor(filePath) { super(filePath, "File"); } } errors.FileNotFoundError = FileNotFoundError; class InvalidOperationError extends BaseError { constructor(message, node) { super(message, node); } } errors.InvalidOperationError = InvalidOperationError; class NotImplementedError extends BaseError { constructor(message = "Not implemented.", node) { super(message, node); } } errors.NotImplementedError = NotImplementedError; class NotSupportedError extends BaseError { constructor(message) { super(message); } } errors.NotSupportedError = NotSupportedError; function throwIfNotType(value, expectedType, argName) { if (typeof value !== expectedType) throw new ArgumentTypeError(argName, expectedType, typeof value); } errors.throwIfNotType = throwIfNotType; function throwIfNotString(value, argName) { if (typeof value !== "string") throw new ArgumentTypeError(argName, "string", typeof value); } errors.throwIfNotString = throwIfNotString; function throwIfWhitespaceOrNotString(value, argName) { throwIfNotString(value, argName); if (value.trim().length === 0) throw new ArgumentNullOrWhitespaceError(argName); } errors.throwIfWhitespaceOrNotString = throwIfWhitespaceOrNotString; function throwIfOutOfRange(value, range, argName) { if (value < range[0] || value > range[1]) throw new ArgumentOutOfRangeError(argName, value, range); } errors.throwIfOutOfRange = throwIfOutOfRange; function throwIfRangeOutOfRange(actualRange, range, argName) { if (actualRange[0] > actualRange[1]) throw new ArgumentError(argName, `The start of a range must not be greater than the end: [${actualRange[0]}, ${actualRange[1]}]`); throwIfOutOfRange(actualRange[0], range, argName); throwIfOutOfRange(actualRange[1], range, argName); } errors.throwIfRangeOutOfRange = throwIfRangeOutOfRange; function throwNotImplementedForSyntaxKindError(kind, node) { throw new NotImplementedError(`Not implemented feature for syntax kind '${getSyntaxKindName(kind)}'.`, node); } errors.throwNotImplementedForSyntaxKindError = throwNotImplementedForSyntaxKindError; function throwIfNegative(value, argName) { if (value < 0) throw new ArgumentError(argName, "Expected a non-negative value."); } errors.throwIfNegative = throwIfNegative; function throwIfNullOrUndefined(value, errorMessage, node) { if (value == null) throw new InvalidOperationError(typeof errorMessage === "string" ? errorMessage : errorMessage(), node); return value; } errors.throwIfNullOrUndefined = throwIfNullOrUndefined; function throwNotImplementedForNeverValueError(value, sourceNode) { const node = value; if (node != null && typeof node.kind === "number") return throwNotImplementedForSyntaxKindError(node.kind, sourceNode); throw new NotImplementedError(`Not implemented value: ${JSON.stringify(value)}`, sourceNode); } errors.throwNotImplementedForNeverValueError = throwNotImplementedForNeverValueError; function throwIfNotEqual(actual, expected, description) { if (actual !== expected) throw new InvalidOperationError(`Expected ${actual} to equal ${expected}. ${description}`); } errors.throwIfNotEqual = throwIfNotEqual; function throwIfTrue(value, errorMessage) { if (value === true) throw new InvalidOperationError(errorMessage); } errors.throwIfTrue = throwIfTrue; })(errors || (errors = {})); function getPrettyNodeLocation(node) { const source = getSourceLocation(node); if (!source) return undefined; return `${source.filePath}:${source.loc.line}:${source.loc.character}\n` + `> ${source.loc.line} | ${source.lineText}`; } function getSourceLocation(node) { if (!isNode(node)) return; const sourceFile = node.getSourceFile(); const sourceCode = sourceFile.getFullText(); const start = node.getStart(); const lineStart = sourceCode.lastIndexOf("\n", start) + 1; const nextNewLinePos = sourceCode.indexOf("\n", start); const lineEnd = nextNewLinePos === -1 ? sourceCode.length : nextNewLinePos; const textStart = (start - lineStart > 40) ? start - 37 : lineStart; const textEnd = (lineEnd - textStart > 80) ? textStart + 77 : lineEnd; let lineText = ""; if (textStart !== lineStart) lineText += "..."; lineText += sourceCode.substring(textStart, textEnd); if (textEnd !== lineEnd) lineText += "..."; return { filePath: sourceFile.getFilePath(), loc: { line: StringUtils.getLineNumberAtPos(sourceCode, start), character: start - lineStart + 1, }, lineText, }; } function isNode(node) { return typeof node === "object" && node !== null && ("getSourceFile" in node) && ("getStart" in node); } const CharCodes = { ASTERISK: "*".charCodeAt(0), NEWLINE: "\n".charCodeAt(0), CARRIAGE_RETURN: "\r".charCodeAt(0), SPACE: " ".charCodeAt(0), TAB: "\t".charCodeAt(0), CLOSE_BRACE: "}".charCodeAt(0), }; const regExWhitespaceSet = new Set([" ", "\f", "\n", "\r", "\t", "\v", "\u00A0", "\u2028", "\u2029"].map(c => c.charCodeAt(0))); class StringUtils { constructor() { } static isWhitespaceCharCode(charCode) { return regExWhitespaceSet.has(charCode); } static isSpaces(text) { if (text == null || text.length === 0) return false; for (let i = 0; i < text.length; i++) { if (text.charCodeAt(i) !== CharCodes.SPACE) return false; } return true; } static hasBom(text) { return text.charCodeAt(0) === 0xFEFF; } static stripBom(text) { if (StringUtils.hasBom(text)) return text.slice(1); return text; } static stripQuotes(text) { if (StringUtils.isQuoted(text)) return text.substring(1, text.length - 1); return text; } static isQuoted(text) { return text.startsWith("'") && text.endsWith("'") || text.startsWith("\"") && text.endsWith("\""); } static isNullOrWhitespace(str) { return typeof str !== "string" || StringUtils.isWhitespace(str); } static isNullOrEmpty(str) { return typeof str !== "string" || str.length === 0; } static isWhitespace(text) { if (text == null) return true; for (let i = 0; i < text.length; i++) { if (!StringUtils.isWhitespaceCharCode(text.charCodeAt(i))) return false; } return true; } static startsWithNewLine(str) { if (str == null) return false; return str.charCodeAt(0) === CharCodes.NEWLINE || str.charCodeAt(0) === CharCodes.CARRIAGE_RETURN && str.charCodeAt(1) === CharCodes.NEWLINE; } static endsWithNewLine(str) { if (str == null) return false; return str.charCodeAt(str.length - 1) === CharCodes.NEWLINE; } static insertAtLastNonWhitespace(str, insertText) { let i = str.length; while (i > 0 && StringUtils.isWhitespaceCharCode(str.charCodeAt(i - 1))) i--; return str.substring(0, i) + insertText + str.substring(i); } static getLineNumberAtPos(str, pos) { errors.throwIfOutOfRange(pos, [0, str.length], "pos"); let count = 0; for (let i = 0; i < pos; i++) { if (str.charCodeAt(i) === CharCodes.NEWLINE) count++; } return count + 1; } static getLengthFromLineStartAtPos(str, pos) { errors.throwIfOutOfRange(pos, [0, str.length], "pos"); return pos - StringUtils.getLineStartFromPos(str, pos); } static getLineStartFromPos(str, pos) { errors.throwIfOutOfRange(pos, [0, str.length], "pos"); while (pos > 0) { const previousCharCode = str.charCodeAt(pos - 1); if (previousCharCode === CharCodes.NEWLINE || previousCharCode === CharCodes.CARRIAGE_RETURN) break; pos--; } return pos; } static getLineEndFromPos(str, pos) { errors.throwIfOutOfRange(pos, [0, str.length], "pos"); while (pos < str.length) { const currentChar = str.charCodeAt(pos); if (currentChar === CharCodes.NEWLINE || currentChar === CharCodes.CARRIAGE_RETURN) break; pos++; } return pos; } static escapeForWithinString(str, quoteKind) { return StringUtils.escapeChar(str, quoteKind).replace(/(\r?\n)/g, "\\$1"); } static escapeChar(str, char) { if (char.length !== 1) throw new errors.InvalidOperationError(`Specified char must be one character long.`); let result = ""; for (const currentChar of str) { if (currentChar === char) result += "\\"; result += currentChar; } return result; } static removeIndentation(str, opts) { const { isInStringAtPos, indentSizeInSpaces } = opts; const startPositions = []; const endPositions = []; let minIndentWidth; analyze(); return buildString(); function analyze() { let isAtStartOfLine = str.charCodeAt(0) === CharCodes.SPACE || str.charCodeAt(0) === CharCodes.TAB; for (let i = 0; i < str.length; i++) { if (!isAtStartOfLine) { if (str.charCodeAt(i) === CharCodes.NEWLINE && !isInStringAtPos(i + 1)) isAtStartOfLine = true; continue; } startPositions.push(i); let spacesCount = 0; let tabsCount = 0; while (true) { if (str.charCodeAt(i) === CharCodes.SPACE) spacesCount++; else if (str.charCodeAt(i) === CharCodes.TAB) tabsCount++; else break; i++; } const indentWidth = Math.ceil(spacesCount / indentSizeInSpaces) * indentSizeInSpaces + tabsCount * indentSizeInSpaces; if (minIndentWidth == null || indentWidth < minIndentWidth) minIndentWidth = indentWidth; endPositions.push(i); isAtStartOfLine = false; } } function buildString() { if (startPositions.length === 0) return str; if (minIndentWidth == null || minIndentWidth === 0) return str; const deindentWidth = minIndentWidth; let result = ""; result += str.substring(0, startPositions[0]); let lastEndPos = startPositions[0]; for (let i = 0; i < startPositions.length; i++) { const startPosition = startPositions[i]; const endPosition = endPositions[i]; let indentCount = 0; let pos; for (pos = startPosition; pos < endPosition; pos++) { if (indentCount >= deindentWidth) break; if (str.charCodeAt(pos) === CharCodes.SPACE) indentCount++; else if (str.charCodeAt(pos) === CharCodes.TAB) indentCount += indentSizeInSpaces; } lastEndPos = startPositions[i + 1] == null ? str.length : startPositions[i + 1]; result += str.substring(pos, lastEndPos); } result += str.substring(lastEndPos); return result; } } static indent(str, times, options) { if (times === 0) return str; const { indentText, indentSizeInSpaces, isInStringAtPos } = options; const fullIndentationText = times > 0 ? indentText.repeat(times) : undefined; const totalIndentSpaces = Math.abs(times * indentSizeInSpaces); let result = ""; let lineStart = 0; let lineEnd = 0; for (let i = 0; i < str.length; i++) { lineStart = i; while (i < str.length && str.charCodeAt(i) !== CharCodes.NEWLINE) i++; lineEnd = i === str.length ? i : i + 1; appendLine(); } return result; function appendLine() { if (isInStringAtPos(lineStart)) result += str.substring(lineStart, lineEnd); else if (times > 0) result += fullIndentationText + str.substring(lineStart, lineEnd); else { let start = lineStart; let indentSpaces = 0; for (start = lineStart; start < str.length; start++) { if (indentSpaces >= totalIndentSpaces) break; if (str.charCodeAt(start) === CharCodes.SPACE) indentSpaces++; else if (str.charCodeAt(start) === CharCodes.TAB) indentSpaces += indentSizeInSpaces; else break; } result += str.substring(start, lineEnd); } } } } class SortedKeyValueArray { #array = []; #getKey; #comparer; constructor(getKey, comparer) { this.#getKey = getKey; this.#comparer = comparer; } set(value) { ArrayUtils.binaryInsertWithOverwrite(this.#array, value, new PropertyComparer(this.#getKey, this.#comparer)); } removeByValue(value) { this.removeByKey(this.#getKey(value)); } removeByKey(key) { const storedComparer = new ComparerToStoredComparer(this.#comparer, key); const index = ArrayUtils.binarySearch(this.#array, new PropertyStoredComparer(this.#getKey, storedComparer)); if (index >= 0) this.#array.splice(index, 1); } getArrayCopy() { return [...this.#array]; } hasItems() { return this.#array.length > 0; } *entries() { yield* this.#array; } } class WeakCache { #cacheItems = new WeakMap(); getOrCreate(key, createFunc) { let item = this.get(key); if (item == null) { item = createFunc(); this.set(key, item); } return item; } has(key) { return this.#cacheItems.has(key); } get(key) { return this.#cacheItems.get(key); } set(key, value) { this.#cacheItems.set(key, value); } removeByKey(key) { this.#cacheItems.delete(key); } } function createCompilerSourceFile(filePath, scriptSnapshot, optionsOrScriptTarget, version, setParentNodes, scriptKind) { return ts.createLanguageServiceSourceFile(filePath, scriptSnapshot, optionsOrScriptTarget ?? ts.ScriptTarget.Latest, version, setParentNodes, scriptKind); } function createDocumentCache(files) { const cache = new InternalDocumentCache(); cache._addFiles(files); return cache; } class FileSystemDocumentCache { #documentCache; #absoluteToOriginalPath = new Map(); constructor(fileSystem, documentCache) { for (const filePath of documentCache._getFilePaths()) this.#absoluteToOriginalPath.set(fileSystem.getStandardizedAbsolutePath(filePath), filePath); this.#documentCache = documentCache; } getDocumentIfMatch(filePath, scriptSnapshot, scriptTarget, scriptKind) { const originalFilePath = this.#absoluteToOriginalPath.get(filePath); if (originalFilePath == null) return; return this.#documentCache._getDocumentIfMatch(originalFilePath, filePath, scriptSnapshot, scriptTarget, scriptKind); } } class InternalDocumentCache { __documentCacheBrand; #fileTexts = new Map(); #documents = new Map(); _addFiles(files) { for (const file of files) this.#fileTexts.set(file.fileName, file.text); } _getFilePaths() { return this.#fileTexts.keys(); } _getCacheForFileSystem(fileSystem) { return new FileSystemDocumentCache(fileSystem, this); } _getDocumentIfMatch(filePath, absoluteFilePath, scriptSnapshot, scriptTarget, scriptKind) { const fileText = this.#fileTexts.get(filePath); if (fileText == null) return undefined; if (fileText !== scriptSnapshot.getText(0, scriptSnapshot.getLength())) return undefined; return this.#getDocument(filePath, absoluteFilePath, scriptSnapshot, scriptTarget, scriptKind); } #getDocument(filePath, absoluteFilePath, scriptSnapshot, scriptTarget, scriptKind) { const documentKey = this.#getKey(filePath, scriptTarget, scriptKind); let document = this.#documents.get(documentKey); if (document == null) { document = createCompilerSourceFile(absoluteFilePath, scriptSnapshot, scriptTarget, "-1", false, scriptKind); this.#documents.set(documentKey, document); } document = deepClone(document); document.fileName = absoluteFilePath; return document; } #getKey(filePath, scriptTarget, scriptKind) { return (filePath + (scriptTarget?.toString() ?? "-1") + (scriptKind?.toString() ?? "-1")); } } const libFiles = [{ fileName: "lib.d.ts", text: "/// <reference no-default-lib=\"true\"/>\n/// <reference lib=\"es5\" />\n/// <reference lib=\"dom\" />\n/// <reference lib=\"webworker.importscripts\" />\n/// <reference lib=\"scripthost\" />\n" }, { fileName: "lib.decorators.d.ts", text: "/// <reference no-default-lib=\"true\"/>\ntype ClassMemberDecoratorContext=|ClassMethodDecoratorContext|ClassGetterDecoratorContext|ClassSetterDecoratorContext|ClassFieldDecoratorContext|ClassAccessorDecoratorContext;type DecoratorContext=|ClassDecoratorContext|ClassMemberDecoratorContext;type DecoratorMetadataObject=Record<PropertyKey,unknown>&object;type DecoratorMetadata=typeof globalThis extends{Symbol:{readonly metadata:symbol;};}?DecoratorMetadataObject:DecoratorMetadataObject|undefined;interface ClassDecoratorContext<\nClass extends abstract new(...args:any)=>any=abstract new(...args:any)=>any,>{readonly kind:\"class\";readonly name:string|undefined;addInitializer(initializer:(this:Class)=>void):void;readonly metadata:DecoratorMetadata;}interface ClassMethodDecoratorContext<\nThis=unknown,Value extends(this:This,...args:any)=>any=(this:This,...args:any)=>any,>{readonly kind:\"method\";readonly name:string|symbol;readonly static:boolean;readonly private:boolean;readonly access:{has(object:This):boolean;get(object:This):Value;};addInitializer(initializer:(this:This)=>void):void;readonly metadata:DecoratorMetadata;}interface ClassGetterDecoratorContext<\nThis=unknown,Value=unknown,>{readonly kind:\"getter\";readonly name:string|symbol;readonly static:boolean;readonly private:boolean;readonly access:{has(object:This):boolean;get(object:This):Value;};addInitializer(initializer:(this:This)=>void):void;readonly metadata:DecoratorMetadata;}interface ClassSetterDecoratorContext<\nThis=unknown,Value=unknown,>{readonly kind:\"setter\";readonly name:string|symbol;readonly static:boolean;readonly private:boolean;readonly access:{has(object:This):boolean;set(object:This,value:Value):void;};addInitializer(initializer:(this:This)=>void):void;readonly metadata:DecoratorMetadata;}interface ClassAccessorDecoratorContext<\nThis=unknown,Value=unknown,>{readonly kind:\"accessor\";readonly name:string|symbol;readonly static:boolean;readonly private:boolean;readonly access:{has(object:This):boolean;get(object:This):Value;set(object:This,value:Value):void;};addInitializer(initializer:(this:This)=>void):void;readonly metadata:DecoratorMetadata;}interface ClassAccessorDecoratorTarget<This,Value>{get(this:This):Value;set(this:This,value:Value):void;}interface ClassAccessorDecoratorResult<This,Value>{get?(this:This):Value;set?(this:This,value:Value):void;init?(this:This,value:Value):Value;}interface ClassFieldDecoratorContext<\nThis=unknown,Value=unknown,>{readonly kind:\"field\";readonly name:string|symbol;readonly static:boolean;readonly private:boolean;readonly access:{has(object:This):boolean;get(object:This):Value;set(object:This,value:Value):void;};addInitializer(initializer:(this:This)=>void):void;readonly metadata:DecoratorMetadata;}" }, { fileName: "lib.decorators.legacy.d.ts", text: "/// <reference no-default-lib=\"true\"/>\ndeclare type ClassDecorator=<TFunction extends Function>(target:TFunction)=>TFunction|void;declare type PropertyDecorator=(target:Object,propertyKey:string|symbol)=>void;declare type MethodDecorator=<T>(target:Object,propertyKey:string|symbol,descriptor:TypedPropertyDescriptor<T>)=>TypedPropertyDescriptor<T>|void;declare type ParameterDecorator=(target:Object,propertyKey:string|symbol|undefined,parameterIndex:number)=>void;" }, { fileName: "lib.dom.asynciterable.d.ts", text: "/// <reference no-default-lib=\"true\"/>\ninterface FileSystemDirectoryHandle{[Symbol.asyncIterator]():AsyncIterableIterator<[string,FileSystemHandle]>;entries():AsyncIterableIterator<[string,FileSystemHandle]>;keys():AsyncIterableIterator<string>;values():AsyncIterableIterator<FileSystemHandle>;}interface ReadableStream<R=any>{[Symbol.asyncIterator](options?:ReadableStreamIteratorOptions):AsyncIterableIterator<R>;values(options?:ReadableStreamIteratorOptions):AsyncIterableIterator<R>;}" }, { fileName: "lib.dom.d.ts", text: "/// <reference no-default-lib=\"true\"/>\ninterface AddEventListenerOptions extends EventListenerOptions{once?:boolean;passive?:boolean;signal?:AbortSignal;}interface AesCbcParams extends Algorithm{iv:BufferSource;}interface AesCtrParams extends Algorithm{counter:BufferSource;length:number;}interface AesDerivedKeyParams extends Algorithm{length:number;}interface AesGcmParams extends Algorithm{additionalData?:BufferSource;iv:BufferSource;tagLength?:number;}interface AesKeyAlgorithm extends KeyAlgorithm{length:number;}interface AesKeyGenParams extends Algorithm{length:number;}interface Algorithm{name:string;}interface AnalyserOptions extends AudioNodeOptions{fftSize?:number;maxDecibels?:number;minDecibels?:number;smoothingTimeConstant?:number;}interface AnimationEventInit extends EventInit{animationName?:string;elapsedTime?:number;pseudoElement?:string;}interface AnimationPlaybackEventInit extends EventInit{currentTime?:CSSNumberish|null;timelineTime?:CSSNumberish|null;}interface AssignedNodesOptions{flatten?:boolean;}interface AudioBufferOptions{length:number;numberOfChannels?:number;sampleRate:number;}interface AudioBufferSourceOptions{buffer?:AudioBuffer|null;detune?:number;loop?:boolean;loopEnd?:number;loopStart?:number;playbackRate?:number;}interface AudioConfiguration{bitrate?:number;channels?:string;contentType:string;samplerate?:number;spatialRendering?:boolean;}interface AudioContextOptions{latencyHint?:AudioContextLatencyCategory|number;sampleRate?:number;}interface AudioNodeOptions{channelCount?:number;channelCountMode?:ChannelCountMode;channelInterpretation?:ChannelInterpretation;}interface AudioProcessingEventInit extends EventInit{inputBuffer:AudioBuffer;outputBuffer:AudioBuffer;playbackTime:number;}interface AudioTimestamp{contextTime?:number;performanceTime?:DOMHighResTimeStamp;}interface AudioWorkletNodeOptions extends AudioNodeOptions{numberOfInputs?:number;numberOfOutputs?:number;outputChannelCount?:number[];parameterData?:Record<string,number>;processorOptions?:any;}interface AuthenticationExtensionsClientInputs{appid?:string;credProps?:boolean;hmacCreateSecret?:boolean;minPinLength?:boolean;}interface AuthenticationExtensionsClientOutputs{appid?:boolean;credProps?:CredentialPropertiesOutput;hmacCreateSecret?:boolean;}interface AuthenticatorSelectionCriteria{authenticatorAttachment?:AuthenticatorAttachment;requireResidentKey?:boolean;residentKey?:ResidentKeyRequirement;userVerification?:UserVerificationRequirement;}interface AvcEncoderConfig{format?:AvcBitstreamFormat;}interface BiquadFilterOptions extends AudioNodeOptions{Q?:number;detune?:number;frequency?:number;gain?:number;type?:BiquadFilterType;}interface BlobEventInit{data:Blob;timecode?:DOMHighResTimeStamp;}interface BlobPropertyBag{endings?:EndingType;type?:string;}interface CSSMatrixComponentOptions{is2D?:boolean;}interface CSSNumericType{angle?:number;flex?:number;frequency?:number;length?:number;percent?:number;percentHint?:CSSNumericBaseType;resolution?:number;time?:number;}interface CSSStyleSheetInit{baseURL?:string;disabled?:boolean;media?:MediaList|string;}interface CacheQueryOptions{ignoreMethod?:boolean;ignoreSearch?:boolean;ignoreVary?:boolean;}interface CanvasRenderingContext2DSettings{alpha?:boolean;colorSpace?:PredefinedColorSpace;desynchronized?:boolean;willReadFrequently?:boolean;}interface ChannelMergerOptions extends AudioNodeOptions{numberOfInputs?:number;}interface ChannelSplitterOptions extends AudioNodeOptions{numberOfOutputs?:number;}interface CheckVisibilityOptions{checkOpacity?:boolean;checkVisibilityCSS?:boolean;contentVisibilityAuto?:boolean;opacityProperty?:boolean;visibilityProperty?:boolean;}interface ClientQueryOptions{includeUncontrolled?:boolean;type?:ClientTypes;}interface ClipboardEventInit extends EventInit{clipboardData?:DataTransfer|null;}interface ClipboardItemOptions{presentationStyle?:PresentationStyle;}interface CloseEventInit extends EventInit{code?:number;reason?:string;wasClean?:boolean;}interface CompositionEventInit extends UIEventInit{data?:string;}interface ComputedEffectTiming extends EffectTiming{activeDuration?:CSSNumberish;currentIteration?:number|null;endTime?:CSSNumberish;localTime?:CSSNumberish|null;progress?:number|null;startTime?:CSSNumberish;}interface ComputedKeyframe{composite:CompositeOperationOrAuto;computedOffset:number;easing:string;offset:number|null;[property:string]:string|number|null|undefined;}interface ConstantSourceOptions{offset?:number;}interface ConstrainBooleanParameters{exact?:boolean;ideal?:boolean;}interface ConstrainDOMStringParameters{exact?:string|string[];ideal?:string|string[];}interface ConstrainDoubleRange extends DoubleRange{exact?:number;ideal?:number;}interface ConstrainULongRange extends ULongRange{exact?:number;ideal?:number;}interface ContentVisibilityAutoStateChangeEventInit extends EventInit{skipped?:boolean;}interface ConvolverOptions extends AudioNodeOptions{buffer?:AudioBuffer|null;disableNormalization?:boolean;}interface CredentialCreationOptions{publicKey?:PublicKeyCredentialCreationOptions;signal?:AbortSignal;}interface CredentialPropertiesOutput{rk?:boolean;}interface CredentialRequestOptions{mediation?:CredentialMediationRequirement;publicKey?:PublicKeyCredentialRequestOptions;signal?:AbortSignal;}interface CryptoKeyPair{privateKey:CryptoKey;publicKey:CryptoKey;}interface CustomEventInit<T=any>extends EventInit{detail?:T;}interface DOMMatrix2DInit{a?:number;b?:number;c?:number;d?:number;e?:number;f?:number;m11?:number;m12?:number;m21?:number;m22?:number;m41?:number;m42?:number;}interface DOMMatrixInit extends DOMMatrix2DInit{is2D?:boolean;m13?:number;m14?:number;m23?:number;m24?:number;m31?:number;m32?:number;m33?:number;m34?:number;m43?:number;m44?:number;}interface DOMPointInit{w?:number;x?:number;y?:number;z?:number;}interface DOMQuadInit{p1?:DOMPointInit;p2?:DOMPointInit;p3?:DOMPointInit;p4?:DOMPointInit;}interface DOMRectInit{height?:number;width?:number;x?:number;y?:number;}interface DelayOptions extends AudioNodeOptions{delayTime?:number;maxDelayTime?:number;}interface DeviceMotionEventAccelerationInit{x?:number|null;y?:number|null;z?:number|null;}interface DeviceMotionEventInit extends EventInit{acceleration?:DeviceMotionEventAccelerationInit;accelerationIncludingGravity?:DeviceMotionEventAccelerationInit;interval?:number;rotationRate?:DeviceMotionEventRotationRateInit;}interface DeviceMotionEventRotationRateInit{alpha?:number|null;beta?:number|null;gamma?:number|null;}interface DeviceOrientationEventInit extends EventInit{absolute?:boolean;alpha?:number|null;beta?:number|null;gamma?:number|null;}interface DisplayMediaStreamOptions{audio?:boolean|MediaTrackConstraints;video?:boolean|MediaTrackConstraints;}interface DocumentTimelineOptions{originTime?:DOMHighResTimeStamp;}interface DoubleRange{max?:number;min?:number;}interface DragEventInit extends MouseEventInit{dataTransfer?:DataTransfer|null;}interface DynamicsCompressorOptions extends AudioNodeOptions{attack?:number;knee?:number;ratio?:number;release?:number;threshold?:number;}interface EcKeyAlgorithm extends KeyAlgorithm{namedCurve:NamedCurve;}interface EcKeyGenParams extends Algorithm{namedCurve:NamedCurve;}interface EcKeyImportParams extends Algorithm{namedCurve:NamedCurve;}interface EcdhKeyDeriveParams extends Algorithm{public:CryptoKey;}interface EcdsaParams extends Algorithm{hash:HashAlgorithmIdentifier;}interface EffectTiming{delay?:number;direction?:PlaybackDirection;duration?:number|CSSNumericValue|string;easing?:string;endDelay?:number;fill?:FillMode;iterationStart?:number;iterations?:number;playbackRate?:number;}interface ElementCreationOptions{is?:string;}interface ElementDefinitionOptions{extends?:string;}interface EncodedVideoChunkInit{data:AllowSharedBufferSource;duration?:number;timestamp:number;type:EncodedVideoChunkType;}interface EncodedVideoChunkMetadata{decoderConfig?:VideoDecoderConfig;}interface ErrorEventInit extends EventInit{colno?:number;error?:any;filename?:string;lineno?:number;message?:string;}interface EventInit{bubbles?:boolean;cancelable?:boolean;composed?:boolean;}interface EventListenerOptions{capture?:boolean;}interface EventModifierInit extends UIEventInit{altKey?:boolean;ctrlKey?:boolean;metaKey?:boolean;modifierAltGraph?:boolean;modifierCapsLock?:boolean;modifierFn?:boolean;modifierFnLock?:boolean;modifierHyper?:boolean;modifierNumLock?:boolean;modifierScrollLock?:boolean;modifierSuper?:boolean;modifierSymbol?:boolean;modifierSymbolLock?:boolean;shiftKey?:boolean;}interface EventSourceInit{withCredentials?:boolean;}interface FilePropertyBag extends BlobPropertyBag{lastModified?:number;}interface FileSystemCreateWritableOptions{keepExistingData?:boolean;}interface FileSystemFlags{create?:boolean;exclusive?:boolean;}interface FileSystemGetDirectoryOptions{create?:boolean;}interface FileSystemGetFileOptions{create?:boolean;}interface FileSystemRemoveOptions{recursive?:boolean;}interface FocusEventInit extends UIEventInit{relatedTarget?:EventTarget|null;}interface FocusOptions{preventScroll?:boolean;}interface FontFaceDescriptors{ascentOverride?:string;descentOverride?:string;display?:FontDisplay;featureSettings?:string;lineGapOverride?:string;stretch?:string;style?:string;unicodeRange?:string;weight?:string;}interface FontFaceSetLoadEventInit extends EventInit{fontfaces?:FontFace[];}interface FormDataEventInit extends EventInit{formData:FormData;}interface FullscreenOptions{navigationUI?:FullscreenNavigationUI;}interface GainOptions extends AudioNodeOptions{gain?:number;}interface GamepadEffectParameters{duration?:number;leftTrigger?:number;rightTrigger?:number;startDelay?:number;strongMagnitude?:number;weakMagnitude?:number;}interface GamepadEventInit extends EventInit{gamepad:Gamepad;}interface GetAnimationsOptions{subtree?:boolean;}interface GetNotificationOptions{tag?:string;}interface GetRootNodeOptions{composed?:boolean;}interface HashChangeEventInit extends EventInit{newURL?:string;oldURL?:string;}interface HkdfParams extends Algorithm{hash:HashAlgorithmIdentifier;info:BufferSource;salt:BufferSource;}interface HmacImportParams extends Algorithm{hash:HashAlgorithmIdentifier;length?:number;}interface HmacKeyAlgorithm extends KeyAlgorithm{hash:KeyAlgorithm;length:number;}interface HmacKeyGenParams extends Algorithm{hash:HashAlgorithmIdentifier;length?:number;}interface IDBDatabaseInfo{name?:string;version?:number;}interface IDBIndexParameters{multiEntry?:boolean;unique?:boolean;}interface IDBObjectStoreParameters{autoIncrement?:boolean;keyPath?:string|string[]|null;}interface IDBTransactionOptions{durability?:IDBTransactionDurability;}interface IDBVersionChangeEventInit extends EventInit{newVersion?:number|null;oldVersion?:number;}interface IIRFilterOptions extends AudioNodeOptions{feedback:number[];feedforward:number[];}interface IdleRequestOptions{timeout?:number;}interface ImageBitmapOptions{colorSpaceConversion?:ColorSpaceConversion;imageOrientation?:ImageOrientation;premultiplyAlpha?:PremultiplyAlpha;resizeHeight?:number;resizeQuality?:ResizeQuality;resizeWidth?:number;}interface ImageBitmapRenderingContextSettings{alpha?:boolean;}interface ImageDataSettings{colorSpace?:PredefinedColorSpace;}interface ImageEncodeOptions{quality?:number;type?:string;}interface ImportMeta{url:string;}interface InputEventInit extends UIEventInit{data?:string|null;dataTransfer?:DataTransfer|null;inputType?:string;isComposing?:boolean;targetRanges?:StaticRange[];}interface IntersectionObserverEntryInit{boundingClientRect:DOMRectInit;intersectionRatio:number;intersectionRect:DOMRectInit;isIntersecting:boolean;rootBounds:DOMRectInit|null;target:Element;time:DOMHighResTimeStamp;}interface IntersectionObserverInit{root?:Element|Document|null;rootMargin?:string;threshold?:number|number[];}interface JsonWebKey{alg?:string;crv?:string;d?:string;dp?:string;dq?:string;e?:string;ext?:boolean;k?:string;key_ops?:string[];kty?:string;n?:string;oth?:RsaOtherPrimesInfo[];p?:string;q?:string;qi?:string;use?:string;x?:string;y?:string;}interface KeyAlgorithm{name:string;}interface KeyboardEventInit extends EventModifierInit{charCode?:number;code?:string;isComposing?:boolean;key?:string;keyCode?:number;location?:number;repeat?:boolean;}interface Keyframe{composite?:CompositeOperationOrAuto;easing?:string;offset?:number|null;[property:string]:string|number|null|undefined;}interface KeyframeAnimationOptions extends KeyframeEffectOptions{id?:string;timeline?:AnimationTimeline|null;}interface KeyframeEffectOptions extends EffectTiming{composite?:CompositeOperation;iterationComposite?:IterationCompositeOperation;pseudoElement?:string|null;}interface LockInfo{clientId?:string;mode?:LockMode;name?:string;}interface LockManagerSnapshot{held?:LockInfo[];pending?:LockInfo[];}interface LockOptions{ifAvailable?:boolean;mode?:LockMode;signal?:AbortSignal;steal?:boolean;}interface MIDIConnectionEventInit extends EventInit{port?:MIDIPort;}interface MIDIMessageEventInit extends EventInit{data?:Uint8Array;}interface MIDIOptions{software?:boolean;sysex?:boolean;}interface MediaCapabilitiesDecodingInfo extends MediaCapabilitiesInfo{configuration?:MediaDecodingConfiguration;}interface MediaCapabilitiesEncodingInfo extends MediaCapabilitiesInfo{configuration?:MediaEncodingConfiguration;}interface MediaCapabilitiesInfo{powerEfficient:boolean;smooth:boolean;supported:boolean;}interface MediaConfiguration{audio?:AudioConfiguration;video?:VideoConfiguration;}interface MediaDecodingConfiguration extends MediaConfiguration{type:MediaDecodingType;}interface MediaElementAudioSourceOptions{mediaElement:HTMLMediaElement;}interface MediaEncodingConfiguration extends MediaConfiguration{type:MediaEncodingType;}interface MediaEncryptedEventInit extends EventInit{initData?:ArrayBuffer|null;initDataType?:string;}interface MediaImage{sizes?:string;src:string;type?:string;}interface MediaKeyMessageEventInit extends EventInit{message:ArrayBuffer;messageType:MediaKeyMessageType;}interface MediaKeySystemConfiguration{audioCapabilities?:MediaKeySystemMediaCapability[];distinctiveIdentifier?:MediaKeysRequirement;initDataTypes?:string[];label?:string;persistentState?:MediaKeysRequirement;sessionTypes?:string[];videoCapabilities?:MediaKeySystemMediaCapability[];}interface MediaKeySystemMediaCapability{contentType?:string;encryptionScheme?:string|null;robustness?:string;}interface MediaMetadataInit{album?:string;artist?:string;artwork?:MediaImage[];title?:string;}interface MediaPositionState{duration?:number;playbackRate?:number;position?:number;}interface MediaQueryListEventInit extends EventInit{matches?:boolean;media?:string;}interface MediaRecorderOptions{audioBitsPerSecond?:number;bitsPerSecond?:number;mimeType?:string;videoBitsPerSecond?:number;}interface MediaSessionActionDetails{action:MediaSessionAction;fastSeek?:boolean;seekOffset?:number;seekTime?:number;}interface MediaStreamAudioSourceOptions{mediaStream:MediaStream;}interface MediaStreamConstraints{audio?:boolean|MediaTrackConstraints;peerIdentity?:string;preferCurrentTab?:boolean;video?:boolean|MediaTrackConstraints;}interface MediaStreamTrackEventInit extends EventInit{track:MediaStreamTrack;}interface MediaTrackCapabilities{aspectRatio?:DoubleRange;autoGainControl?:boolean[];channelCount?:ULongRange;deviceId?:string;displaySurface?:string;echoCancellation?:boolean[];facingMode?:string[];frameRate?:DoubleRange;groupId?:string;height?:ULongRange;noiseSuppression?:boolean[];sampleRate?:ULongRange;sampleSize?:ULongRange;width?:ULongRange;}interface MediaTrackConstraintSet{aspectRatio?:ConstrainDouble;autoGainControl?:ConstrainBoolean;channelCount?:ConstrainULong;deviceId?:ConstrainDOMString;displaySurface?:ConstrainDOMString;echoCancellation?:ConstrainBoolean;facingMode?:ConstrainDOMString;frameRate?:ConstrainDouble;groupId?:ConstrainDOMString;height?:ConstrainULong;noiseSuppression?:ConstrainBoolean;sampleRate?:ConstrainULong;sampleSize?:ConstrainULong;width?:ConstrainULong;}interface MediaTrackConstraints extends MediaTrackConstraintSet{advanced?:MediaTrackConstraintSet[];}interface MediaTrackSettings{aspectRatio?:number;autoGainControl?:boolean;channelCount?:number;deviceId?:string;displaySurface?:string;echoCancellation?:boolean;facingMode?:string;frameRate?:number;groupId?:string;height?:number;noiseSuppression?:boolean;sampleRate?:number;sampleSize?:number;width?:number;}interface MediaTrackSupportedConstraints{aspectRatio?:boolean;autoGainControl?:boolean;channelCount?:boolean;deviceId?:boolean;displaySurface?:boolean;echoCancellation?:boolean;facingMode?:boolean;frameRate?:boolean;groupId?:boolean;height?:boolean;noiseSuppression?:boolean;sampleRate?:boolean;sampleSize?:boolean;width?:boolean;}interface MessageEventInit<T=any>extends EventInit{data?:T;lastEventId?:string;origin?:string;ports?:MessagePort[];source?:MessageEventSource|null;}interface MouseEventInit extends EventModifierInit{button?:number;buttons?:number;clientX?:number;clientY?:number;movementX?:number;movementY?:number;relatedTarget?:EventTarget|null;screenX?:number;screenY?:number;}interface MultiCacheQueryOptions extends CacheQueryOptions{cacheName?:string;}interface MutationObserverInit{attributeFilter?:string[];attributeOldValue?:boolean;attributes?:boolean;characterData?:boolean;characterDataOldValue?:boole