@oazmi/build-tools
Version:
general deno build tool scripts which I practically use in all of my typescript repos
840 lines • 1.87 MB
JavaScript
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 positions = [];
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;
}
let startPosition = i;
let spacesCount = 0;
let tabsCount = 0;
while (true) {
let charCode = str.charCodeAt(i);
if (charCode === CharCodes.SPACE)
spacesCount++;
else if (charCode === CharCodes.TAB)
tabsCount++;
else if (charCode === CharCodes.NEWLINE || charCode === CharCodes.CARRIAGE_RETURN && str.charCodeAt(i + 1) === CharCodes.NEWLINE) {
spacesCount = 0;
tabsCount = 0;
positions.push([startPosition, i]);
if (charCode === CharCodes.CARRIAGE_RETURN) {
startPosition = i + 2;
i++;
}
else {
startPosition = i + 1;
}
}
else if (charCode == null)
break;
else {
const indentWidth = Math.ceil(spacesCount / indentSizeInSpaces) * indentSizeInSpaces + tabsCount * indentSizeInSpaces;
if (minIndentWidth == null || indentWidth < minIndentWidth)
minIndentWidth = indentWidth;
positions.push([startPosition, i]);
isAtStartOfLine = false;
break;
}
i++;
}
}
}
function buildString() {
if (positions.length === 0)
return str;
if (minIndentWidth == null || minIndentWidth === 0)
return str;
const deindentWidth = minIndentWidth;
let result = "";
result += str.substring(0, positions[0][0]);
for (let i = 0; i < positions.length; i++) {
const [startPosition, endPosition] = positions[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;
}
result += str.substring(pos, positions[i + 1]?.[0] ?? str.length);
}
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.es2019.object.d.ts",
text: "/// <reference no-default-lib=\"true\"/>\n/// <reference lib=\"es2015.iterable\" />\ninterface ObjectConstructor{fromEntries<T=any>(entries:Iterable<readonly[PropertyKey,T]>):{[k:string]:T;};fromEntries(entries:Iterable<readonly any[]>):any;}"
}, {
fileName: "lib.dom.iterable.d.ts",
text: "/// <reference no-default-lib=\"true\"/>\ninterface AbortSignal{any(signals:Iterable<AbortSignal>):AbortSignal;}interface AudioParam{setValueCurveAtTime(values:Iterable<number>,startTime:number,duration:number):AudioParam;}interface AudioParamMap extends ReadonlyMap<string,AudioParam>{}interface BaseAudioContext{createIIRFilter(feedforward:Iterable<number>,feedback:Iterable<number>):IIRFilterNode;createPeriodicWave(real:Iterable<number>,imag:Iterable<number>,constraints?:PeriodicWaveConstraints):PeriodicWave;}interface CSSKeyframesRule{[Symbol.iterator]():ArrayIterator<CSSKeyframeRule>;}interface CSSNumericArray{[Symbol.iterator]():ArrayIterator<CSSNumericValue>;entries():ArrayIterator<[number,CSSNumericValue]>;keys():ArrayIterator<number>;values():ArrayIterator<CSSNumericValue>;}interface CSSRuleList{[Symbol.iterator]():ArrayIterator<CSSRule>;}interface CSSStyleDeclaration{[Symbol.iterator]():ArrayIterator<string>;}interface CSSTransformValue{[Symbol.iterator]():ArrayIterator<CSSTransformComponent>;entries():ArrayIterator<[number,CSSTransformComponent]>;keys():ArrayIterator<number>;values():ArrayIterator<CSSTransformComponent>;}interface CSSUnparsedValue{[Symbol.iterator]():ArrayIterator<CSSUnparsedSegment>;entries():ArrayIterator<[number,CSSUnparsedSegment]>;keys():ArrayIterator<number>;values():ArrayIterator<CSSUnparsedSegment>;}interface Cache{addAll(requests:Iterable<RequestInfo>):Promise<void>;}interface CanvasPath{roundRect(x:number,y:number,w:number,h:number,radii?:number|DOMPointInit|Iterable<number|DOMPointInit>):void;}interface CanvasPathDrawingStyles{setLineDash(segments:Iterable<number>):void;}interface CustomStateSet extends Set<string>{}interface DOMRectList{[Symbol.iterator]():ArrayIterator<DOMRect>;}interface DOMStringList{[Symbol.iterator]():ArrayIterator<string>;}interface DOMTokenList{[Symbol.iterator]():ArrayIterator<string>;entries():ArrayIterator<[number,string]>;keys():ArrayIterator<number>;values():ArrayIterator<string>;}interface DataTransferItemList{[Symbol.iterator]():ArrayIterator<DataTransferItem>;}interface EventCounts extends ReadonlyMap<string,number>{}interface FileList{[Symbol.iterator]():ArrayIterator<File>;}interface FontFaceSet extends Set<FontFace>{}interface FormDataIterator<T>extends IteratorObject<T,BuiltinIteratorReturn,unknown>{[Symbol.iterator]():FormDataIterator<T>;}interface FormData{[Symbol.iterator]():FormDataIterator<[string,FormDataEntryValue]>;entries():FormDataIterator<[string,FormDataEntryValue]>;keys():FormDataIterator<string>;values():FormDataIterator<FormDataEntryValue>;}interface HTMLAllCollection{[Symbol.iterator]():ArrayIterator<Element>;}interface HTMLCollectionBase{[Symbol.iterator]():ArrayIterator<Element>;}interface HTMLCollectionOf<T extends Element>{[Symbol.iterator]():ArrayIterator<T>;}interface HTMLFormElement{[Symbol.iterator]():ArrayIterator<Element>;}interface HTMLSelectElement{[Symbol.iterator]():ArrayIterator<HTMLOptionElement>;}interface HeadersIterator<T>extends IteratorObject<T,BuiltinIteratorReturn,unknown>{[Symbol.iterator]():HeadersIterator<T>;}interface Headers{[Symbol.iterator]():HeadersIterator<[string,string]>;entries():HeadersIterator<[string,string]>;keys():HeadersIterator<string>;values():HeadersIterator<string>;}interface Highlight extends Set<AbstractRange>{}interface HighlightRegistry extends Map<string,Highlight>{}interface IDBDatabase{transaction(storeNames:string|Iterable<string>,mode?:IDBTransactionMode,options?:IDBTransactionOptions):IDBTransaction;}interface IDBObjectStore{createIndex(name:string,keyPath:string|Iterable<string>,options?:IDBIndexParameters):IDBIndex;}interface MIDIInputMap extends ReadonlyMap<string,MIDIInput>{}interface MIDIOutput{send(data:Iterable<number>,timestamp?:DOMHighResTimeStamp):void;}interface MIDIOutputMap extends ReadonlyMap<string,MIDIOutput>{}interface MediaKeyStatusMapIterator<T>extends IteratorObject<T,BuiltinIteratorReturn,unknown>{[Symbol.iterator]():MediaKeyStatusMapIterator<T>;}interface MediaKeyStatusMap{[Symbol.iterator]():MediaKeyStatusMapIterator<[BufferSource,MediaKeyStatus]>;entries():MediaKeyStatusMapIterator<[BufferSource,MediaKeyStatus]>;keys():MediaKeyStatusMapIterator<BufferSource>;values():MediaKeyStatusMapIterator<MediaKeyStatus>;}interface MediaList{[Symbol.iterator]():ArrayIterator<string>;}interface MessageEvent<T=any>{initMessageEvent(type:string,bubbles?:boolean,cancelable?:boolean,data?:any,origin?:string,lastEventId?:string,source?:MessageEventSource|null,ports?:Iterable<MessagePort>):void;}interface MimeTypeArray{[Symbol.iterator]():ArrayIterator<MimeType>;}interface NamedNodeMap{[Symbol.iterator]():ArrayIterator<Attr>;}interface Navigator{requestMediaKeySystemAccess(keySystem:string,supportedConfigurations:Iterable<MediaKeySystemConfiguration>):Promise<MediaKeySystemAccess>;vibrate(pattern:Iterable<number>):boolean;}interface NodeList{[Symbol.iterator]():ArrayIterator<Node>;entries():ArrayIterator<[number,Node]>;keys():ArrayIterator<number>;values():ArrayIterator<Node>;}interface NodeListOf<TNode extends Node>{[Symbol.iterator]():ArrayIterator<TNode>;entries():ArrayIterator<[number,TNode]>;keys():ArrayIterator<number>;values():ArrayIterator<TNode>;}interface Plugin{[Symbol.iterator]():ArrayIterator<MimeType>;}interface PluginArray{[Symbol.iterator]():ArrayIterator<Plugin>;}interface RTCRtpTransceiver{setCodecPreferences(codecs:Iterable<RTCRtpCodec>):void;}interface RTCStatsReport extends ReadonlyMap<string,any>{}interface SVGLengthList{[Symbol.iterator]():ArrayIterator<SVGLength>;}interface SVGNumberList{[Symbol.iterator]():ArrayIterator<SVGNumber>;}interface SVGPointList{[Symbol.iterator]():ArrayIterator<DOMPoint>;}interface SVGStringList{[Symbol.iterator]():ArrayIterator<string>;}interface SVGTransformList{[Symbol.iterator]():ArrayIterator<SVGTransform>;}interface SourceBufferList{[Symbol.iterator]():ArrayIterator<SourceBuffer>;}interface SpeechRecognitionResult{[Symbol.iterator]():ArrayIterator<SpeechRecognitionAlternative>;}interface SpeechRecognitionResultList{[Symbol.iterator]():ArrayIterator<SpeechRecognitionResult>;}interface StylePropertyMapReadOnlyIterator<T>extends IteratorObject<T,BuiltinIteratorReturn,unknown>{[Symbol.iterator]():StylePropertyMapReadOnlyIterator<T>;}interface StylePropertyMapReadOnly{[Symbol.iterator]():StylePropertyMapReadOnlyIterator<[string,Iterable<CSSStyleValue>]>;entries():StylePropertyMapReadOnlyIterator<[string,Iterable<CSSStyleValue>]>;keys():StylePropertyMapReadOnlyIterator<string>;values():StylePropertyMapReadOnlyIterator<Iterable<CSSStyleValue>>;}interface StyleSheetList{[Symbol.iterator]():ArrayIterator<CSSStyleSheet>;}interface SubtleCrypto{deriveKey(algorithm:AlgorithmIdentifier|EcdhKeyDeriveParams|HkdfParams|Pbkdf2Params,baseKey:CryptoKey,derivedKeyType:AlgorithmIdentifier|AesDerivedKeyParams|HmacImportParams|HkdfParams|Pbkdf2Params,extractable:boolean,keyUsages:Iterable<KeyUsage>):Promise<CryptoKey>;generateKey(algorithm:\"Ed25519\",extractable:boolean,keyUsages:ReadonlyArray<\"sign\"|\"verify\">):Promise<CryptoKeyPair>;generateKey(algorithm:RsaHashedKeyGenParams|EcKeyGenParams,extractable:boolean,keyUsages:ReadonlyArray<KeyUsage>):Promise<CryptoKeyPair>;generateKey(algorithm:AesKeyGenParams|HmacKeyGenParams|Pbkdf2Params,extractable:boolean,keyUsages:ReadonlyArray<KeyUsage>):Promise<CryptoKey>;generateKey(algorithm:AlgorithmIdentifier,extractable:boolean,keyUsages:Iterable<KeyUsage>):Promise<CryptoKeyPair|CryptoKey>;importKey(format:\"jwk\",keyData:JsonWebKey,algorithm:AlgorithmIdentifier|RsaHashedImportParams|EcKeyImportParams|HmacImportParams|AesKeyAlgorithm,extractable:boolean,keyUsages:ReadonlyArray<KeyUsage>):Promise<CryptoKey>;importKey(format:Exclude<KeyFormat,\"jwk\">,keyData:BufferSource,algorithm:AlgorithmIdentifier|RsaHashedImportParams|EcKeyImportParams|HmacImportParams|AesKeyAlgorithm,extractable:boolean,keyUsages:Iterable<KeyUsage>):Promise<CryptoKey>;unwrapKey(format:KeyFormat,wrappedKey:BufferSource,unwrappingKey:CryptoKey,unwrapAlgorithm:AlgorithmIdentifier|RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams,unwrappedKeyAlgorithm:AlgorithmIdentifier|RsaHashedImportParams|EcKeyImportParams|HmacImportParams|AesKeyAlgorithm,extractable:boolean,keyUsages:Iterable<KeyUsage>):Promise<CryptoKey>;}interface TextTrackCueList{[Symbol.iterator]():ArrayIterator<TextTrackCue>;}interface TextTrackList{[Symbol.iterator]():ArrayIterator<TextTrack>;}interface TouchList{[Symbol.iterator]():ArrayIterator<Touch>;}interface URLSearchParamsIterator<T>extends IteratorObject<T,BuiltinIteratorReturn,unknown>{[Symbol.iterator]():URLSearchParamsIterator<T>;}interface URLSearchParams{[Symbol.iterator]():URLSearchParamsIterator<[string,string]>;entries():URLSearchParamsIterator<[string,string]>;keys():URLSearchParamsIterator<string>;values():URLSearchParamsIterator<string>;}interface WEBGL_draw_buffers{drawBuffersWEBGL(buffers:Iterable<GLenum>):void;}interface WEBGL_multi_draw{multiDrawArraysInstancedWEBGL(mode:GLenum,firstsList:Int32Array|Iterable<GLint>,firstsOffset:number,countsList:Int32Array|Iterable<GLsizei>,countsOffset:number,instanceCountsList:Int32Array|Iterable<GLsizei>,instanceCountsOffset:number,drawcount:GLsizei):void;multiDrawArraysWEBGL(mode:GLenum,firstsList:Int32Array|Iterable<GLint>,firstsOffset:number,countsList:Int32Array|Iterable<GLsizei>,countsOffset:number,drawcount:GLsizei):void;multiDrawElementsInstancedWEBGL(mode:GLenum,countsList:Int32Array|Iterable<GLsizei>,countsOffset:number,type:GLenum,offsetsList:Int32Array|Iterable<GLsizei>,offsetsOffset:number,instanceCountsList:Int32Array|Iterable<GLsizei>,instanceCountsOffset:number,drawcount:GLsizei):void;multiDrawElementsWEBGL(mode:GLenum,countsList:Int32Array|Iterable<GLsizei>,countsOffset:number,type:GLenum,offsetsList:Int32Array|Iterable<GLsizei>,offsetsOffset:number,drawcount:GLsizei):void;}interface WebGL2RenderingContextBase{clearBufferfv(buffer:GLenum,drawbuffer:GLint,values:Iterable<GLfloat>,srcOffset?:number):void;clearBufferiv(buffer:GLenum,drawbuffer:GLint,values:Iterable<GLint>,srcOffset?:number):void;clearBufferuiv(buffer:GLenum,drawbuffer:GLint,values:Iterable<GLuint>,srcOffset?:number):void;drawBuffers(buffers:Iterable<GLenum>):void;getActiveUniforms(program:WebGLProgram,uniformIndices:Iterable<GLuint>,pname:GLenum):any;getUniformIndices(program:WebGLProgram,uniformNames:Iterable<string>):Iterable<GLuint>|null;invalidateFramebuffer(target:GLenum,attachments:Iterable<GLenum>):void;invalidateSubFramebuffer(target:GLenum,attachments:Iterable<GLenum>,x:GLint,y:GLint,width:GLsizei,height:GLsizei):void;transformFeedbackVaryings(program:WebGLProgram,varyings:Iterable<string>,bufferMode:GLenum):void;uniform1uiv(location:WebGLUniformLocation|null,data:Iterable<GLuint>,srcOffset?:number,srcLength?:GLuint):void;uniform2uiv(location:WebGLUniformLocation|null,data:Iterable<GLuint>,srcOffset?:number,srcLength?:GLuint):void;uniform3uiv(location:WebGLUniformLocation|null,data:Iterable<GLuint>,srcOffset?:number,srcLength?:GLuint):void;uniform4uiv(location:WebGLUniformLocation|null,data:Iterable<GLuint>,srcOffset?:number,srcLength?:GLuint):void;uniformMatrix2x3fv(location:WebGLUniformLocation|null,transpose:GLboolean,data:Iterable<GLfloat>,srcOffset?:number,srcLength?:GLuint):void;uniformMatrix2x4fv(location:WebGLUniformLocation|null,transpose:GLboolean,data:Iterable<GLfloat>,srcOffset?:number,srcLength?:GLuint):void;uniformMatrix3x2fv(location:WebGLUniformLocation|null,transpose:GLboolean,data:Iterable<GLfloat>,srcOffset?:number,srcLength?:GLuint):void;uniformMatrix3x4fv(location:WebGLUniformLocation|null,transpose:GLboolean,data:Iterable<GLfloat>,srcOffset?:number,srcLength?:GLuint):void;uniformMatrix4x2fv(location:WebGLUniformLocation|null,transpose:GLboolean,data:Iterable<GLfloat>,srcOffset?:number,srcLength?:GLuint):void;uniformMatrix4x3fv(location:WebGLUniformLocation|null,transpose:GLboolean,data:Iterable<GLfloat>,srcOffset?:number,srcLength?:GLuint):void;vertexAttribI4iv(index:GLuint,values:Iterable<GLint>):void;vertexAttribI4uiv(index:GLuint,values:Iterable<GLuint>):void;}interface WebGL2RenderingContextOverloads{uniform1fv(location:WebGLUniformLocation|null,data:Iterable<GLfloat>,srcOffset?:number,srcLength?:GLuint):void;uniform1iv(location:WebGLUniformLocation|null,data:Iterable<GLint>,srcOffset?:number,srcLength?:GLuint):void;uniform2fv(location:WebGLUniformLocation|null,data:Iterable<GLfloat>,srcOffset?:number,srcLength?:GLuint):void;uniform2iv(location:WebGLUniformLocation|null,data:Iterable<GLint>,srcOffset?:number,srcLength?:GLuint):void;uniform3fv(location:WebGLUniformLocation|null,data:Iterable<GLfloat>,srcOffset?:number,srcLength?:GLuint):void;uniform3iv(location:WebGLUniformLocation|null,data:Iterable<GLint>,srcOffset?:number,srcLength?:GLuint):void;uniform4fv(location:WebGLUniformLocation|null,data:Iterable<GLfloat>,srcOffset?:number,srcLength?:GLuint):void;uniform4iv(location:WebGLUniformLocation|null,data:Iterable<GLint>,srcOffset?:number,srcLength?:GLuint):void;uniformMatrix2fv(location:WebGLUniformLocation|null,transpose:GLboolean,data:Iterable<GLfloat>,srcOffset?:number,srcLength?:GLuint):void;uniformMatrix3fv(location:WebGLUniformLocation|null,transpose:GLboolean,data:Iterable<GLfloat>,srcOffset?:number,srcLength?:GLuint):void;uniformMatrix4fv(location:WebGLUniformLocation|null,transpose:GLboolean,data:Iterable<GLfloat>,srcOffset?:number,srcLength?:GLuint):void;}interface WebGLRenderingContextBase{vertexAttrib1fv(index:GLuint,values:Iterable<GLfloat>):void;vertexAttrib2fv(index:GLuint,values:Iterable<GLfloat>):void;vertexAttrib3fv(index:GLuint,values:Iterable<GLfloat>):void;vertexAttrib4fv(index:GLuint,values:Iterable<GLfloat>):void;}interface WebGLRenderingContextOverloads{uniform1fv(location:WebGLUniformLocation|null,v:Iterable<GLfloat>):void;uniform1iv(location:WebGLUniformLocation|null,v:Iterable<GLint>):void;uniform2fv(location:WebGLUniformLocation|null,v:Iterable<GLfloat>):void;uniform2iv(location:WebGLUniformLocation|null,v:Iterable<GLint>):void;uniform3fv(location:WebGLUniformLocation|null,v:Iterable<GLfloat>):void;uniform3iv(location:WebGLUniformLocation|null,v:Iterable<GLint>):void;uniform4fv(location:WebGLUniformLocation|null,v:Iterable<GLfloat>):void;uniform4iv(location:WebGLUniformLocation|null,v:Iterable<GLint>):void;uniformMatrix2fv(location:WebGLUniformLocation|null,transpose:GLboolean,value:Iterable<GLfloat>):void;uniformMatrix3fv(location:WebGLUniformLocation|null,transpose:GLboolean,value:Iterable<GLfloat>):void;uniformMatrix4fv(location:WebGLUniformLocation|null,transpose:GLboolean,value:Iterable<GLfloat>):void;}"
}, {
fileName: "lib.es2018.full.d.ts",
text: "/// <reference no-default-lib=\"true\"/>\n/// <reference lib=\"es2018\" />\n/// <reference lib=\"dom\" />\n/// <reference lib=\"webworker.importscripts\" />\n/// <reference lib=\"scripthost\" />\n/// <reference lib=\"dom.iterable\" />\n/// <reference lib=\"dom.asynciterable\" />\n"
}, {
fileName: "lib.esnext.collection.d.ts",
text: "/// <reference no-default-lib=\"true\"/>\ninterface MapConstructor{groupBy<K,T>(items:Iterable<T>,keySelector:(item:T,index:number)=>K,):Map<K,T[]>;}interface ReadonlySetLike<T>{keys():Iterator<T>;has(value:T):boolean;readonly size:number;}interface Set<T>{union<U>(other:ReadonlySetLike<U>):Set<T|U>;intersection<U>(other:ReadonlySetLike<U>):Set<T&U>;difference<U>(other:ReadonlySetLike<U>):Set<T>;symmetricDifference<U>(other:ReadonlySetLike<U>):Set<T|U>;isSubsetOf(other:ReadonlySetLike<unknown>):boolean;isSupersetOf(other:ReadonlySetLike<unknown>):boolean;isDisjointFrom(other:ReadonlySetLike<unknown>):boolean;}interface ReadonlySet<T>{union<U>(other:ReadonlySetLike<U>):Set<T|U>;intersection<U>(other:ReadonlySetLike<U>):Set<T&U>;difference<U>(other:ReadonlySetLike<U>):Set<T>;symmetricDifference<U>(other:ReadonlySetLike<U>):Set<T|U>;isSubsetOf(other:ReadonlySetLike<unknown>):boolean;isSupersetOf(other:ReadonlySetLike<unknown>):boolean;isDisjointFrom(other:ReadonlySetLike<unknown>):boolean;}"
}, {
fileName: "lib.es2015.reflect.d.ts",
text: "/// <reference no-default-lib=\"true\"/>\ndeclare namespace Reflect{function apply<T,A extends readonly any[],R>(target:(this:T,...args:A)=>R,thisArgument:T,argumentsList:Readonly<A>,):R;function apply(target:Function,thisArgument:any,argumentsList:ArrayLike<any>):any;function construct<A extends readonly any[],R>(target:new(...args:A)=>R,argumentsList:Readonly<A>,newTarget?:new(...args:any)=>any,):R;function construct(target:Function,argumentsList:ArrayLike<any>,newTarget?:Function):any;function defineProperty(target:object,propertyKey:PropertyKey,attributes:PropertyDescriptor&ThisType<any>):boolean;function deleteProperty(target:object,propertyKey:PropertyKey):boolean;function get<T extends object,P extends PropertyKey>(target:T,propertyKey:P,receiver?:unknown,):P extends keyof T?T[P]:any;function getOwnPropertyDescriptor<T extends object,P extends PropertyKey>(target:T,propertyKey:P,):TypedPropertyDescriptor<P extends keyof T?T[P]:any>|undefined;function getPrototypeOf(target:object):object|null;function has(target:object,propertyKey:PropertyKey):boolean;function isExtensible(target:object):boolean;function ownKeys(target:object):(string|symbol)[];function preventExtensions(target:object):boolean;function set<T extends object,P extends PropertyKey>(target:T,propertyKey:P,value:P extends keyof T?T[P]:any,receiver?:any,):boolean;function set(target:object,propertyKey:PropertyKey,value:any,receiver?:any):boolean;function setPrototypeOf(target:object,proto:object|null):boolean;}"
}, {
fileName: "lib.es2019.string.d.ts",
text: "/// <reference no-default-lib=\"true\"/>\ninterface String{trimEnd():string;trimStart():string;trimLeft():string;trimRight():string;}"
}, {
fileName: "lib.es2017.date.d.ts",
text: "/// <reference no-default-lib=\"true\"/>\ninterface DateConstructor{UTC(year:number,monthIndex?:number,date?:number,hours?:number,minutes?:number,seconds?:number,ms?:number):number;}"
}, {
fileName: "lib.es2021.intl.d.ts",
text: "/// <reference no-default-lib=\"true\"/>\ndeclare namespace Intl{interface DateTimeFormatPartTypesRegistry{fractionalSecond:any;}interface DateTimeFormatOptions{formatMatcher?:\"basic\"|\"best fit\"|\"best fit\"|undefined;dateStyle?:\"full\"|\"long\"|\"medium\"|\"short\"|undefined;timeStyle?:\"full\"|\"long\"|\"medium\"|\"short\"|undefined;dayPeriod?:\"narrow\"|\"short\"|\"long\"|undefined;fractionalSecondDigits?:1|2|3|undefined;}interface DateTimeRangeFormatPart extends DateTimeFormatPart{source:\"startRange\"|\"endRange\"|\"shared\";}interface DateTimeFormat{formatRange(startDate:Date|number|bigint,endDate:Date|number|bigint):string;formatRangeToParts(startDate:Date|number|bigint,endDate:Date|number|bigint):DateTimeRangeFormatPart[];}interface ResolvedDateTimeFormatOptions{formatMatcher?:\"basic\"|\"best fit\"|\"best fit\";dateStyle?:\"full\"|\"long\"|\"medium\"|\"short\";timeStyle?:\"full\"|\"long\"|\"medium\"|\"short\";hourCycle?:\"h11\"|\"h12\"|\"h23\"|\"h24\";dayPeriod?:\"narrow\"|\"short\"|\"long\";fractionalSecondDigits?:1|2|3;}type ListFormatLocaleMatcher=\"lookup\"|\"best fit\";type ListFormatType=\"conjunction\"|\"disjunction\"|\"unit\";type ListFormatStyle=\"long\"|\"short\"|\"narrow\";interface ListFormatOptions{localeMatcher?:ListFormatLocaleMatcher|undefined;type?:ListFormatType|undefined;style?:ListFormatStyle|undefined;}interface ResolvedListFormatOptions{locale:string;style:ListFormatStyle;type:ListFormatType;}interface ListFormat{format(list:Iterable<string>):string;formatToParts(list:Iterable<string>):{type:\"element\"|\"literal\";value:string;}[];resolvedOptions():ResolvedListFormatOptions;}const ListFormat:{prototype:ListFormat;new(locales?:LocalesArgument,options?:ListFormatOptions):ListFormat;supportedLocalesOf(locales:LocalesArgument,options?:Pick<ListFormatOptions,\"localeMatcher\">):UnicodeBCP47LocaleIdentifier[];};}"
}, {
fileName: "lib.es2016.d.ts",
text: "/// <reference no-default-lib=\"true\"/>\n/// <reference lib=\"es2015\" />\n/// <reference lib=\"es2016.array.include\" />\n/// <reference lib=\"es2016.intl\" />\n"
}, {
fileName: "lib.es2015.core.d.ts",
text: "/// <reference no-default-lib=\"true\"/>\ninterface Array<T>{find<S extends T>(predicate:(value:T,index:number,obj:T[])=>value is S,thisArg?:any):S|undefined;find(predicate:(value:T,index:number,obj:T[])=>unknown,thisArg?:any):T|undefined;findIndex(predicate:(value:T,index:number,obj:T[])=>unknown,thisArg?:any):number;fill(value:T,sta