UNPKG

grunt-tsc

Version:

Compile typescript files via grunt tasks

1,035 lines (1,032 loc) 1.31 MB
/*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ var ts; (function (ts) { (function (ExitStatus) { ExitStatus[ExitStatus["Success"] = 0] = "Success"; ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped"; ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated"; })(ts.ExitStatus || (ts.ExitStatus = {})); var ExitStatus = ts.ExitStatus; (function (DiagnosticCategory) { DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message"; })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); var DiagnosticCategory = ts.DiagnosticCategory; })(ts || (ts = {})); /// <reference path="types.ts"/> var ts; (function (ts) { function createFileMap(getCanonicalFileName) { var files = {}; return { get: get, set: set, contains: contains, remove: remove, forEachValue: forEachValueInMap }; function set(fileName, value) { files[normalizeKey(fileName)] = value; } function get(fileName) { return files[normalizeKey(fileName)]; } function contains(fileName) { return hasProperty(files, normalizeKey(fileName)); } function remove(fileName) { var key = normalizeKey(fileName); delete files[key]; } function forEachValueInMap(f) { forEachValue(files, f); } function normalizeKey(key) { return getCanonicalFileName(normalizeSlashes(key)); } } ts.createFileMap = createFileMap; function forEach(array, callback) { if (array) { for (var i = 0, len = array.length; i < len; i++) { var result = callback(array[i], i); if (result) { return result; } } } return undefined; } ts.forEach = forEach; function contains(array, value) { if (array) { for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (v === value) { return true; } } } return false; } ts.contains = contains; function indexOf(array, value) { if (array) { for (var i = 0, len = array.length; i < len; i++) { if (array[i] === value) { return i; } } } return -1; } ts.indexOf = indexOf; function countWhere(array, predicate) { var count = 0; if (array) { for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; if (predicate(v)) { count++; } } } return count; } ts.countWhere = countWhere; function filter(array, f) { var result; if (array) { result = []; for (var _i = 0; _i < array.length; _i++) { var item = array[_i]; if (f(item)) { result.push(item); } } } return result; } ts.filter = filter; function map(array, f) { var result; if (array) { result = []; for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result.push(f(v)); } } return result; } ts.map = map; function concatenate(array1, array2) { if (!array2 || !array2.length) return array1; if (!array1 || !array1.length) return array2; return array1.concat(array2); } ts.concatenate = concatenate; function deduplicate(array) { var result; if (array) { result = []; for (var _i = 0; _i < array.length; _i++) { var item = array[_i]; if (!contains(result, item)) { result.push(item); } } } return result; } ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; for (var _i = 0; _i < array.length; _i++) { var v = array[_i]; result += v[prop]; } return result; } ts.sum = sum; function addRange(to, from) { if (to && from) { for (var _i = 0; _i < from.length; _i++) { var v = from[_i]; to.push(v); } } } ts.addRange = addRange; function lastOrUndefined(array) { if (array.length === 0) { return undefined; } return array[array.length - 1]; } ts.lastOrUndefined = lastOrUndefined; function binarySearch(array, value) { var low = 0; var high = array.length - 1; while (low <= high) { var middle = low + ((high - low) >> 1); var midValue = array[middle]; if (midValue === value) { return middle; } else if (midValue > value) { high = middle - 1; } else { low = middle + 1; } } return ~low; } ts.binarySearch = binarySearch; function reduceLeft(array, f, initial) { if (array) { var count = array.length; if (count > 0) { var pos = 0; var result = arguments.length <= 2 ? array[pos++] : initial; while (pos < count) { result = f(result, array[pos++]); } return result; } } return initial; } ts.reduceLeft = reduceLeft; function reduceRight(array, f, initial) { if (array) { var pos = array.length - 1; if (pos >= 0) { var result = arguments.length <= 2 ? array[pos--] : initial; while (pos >= 0) { result = f(result, array[pos--]); } return result; } } return initial; } ts.reduceRight = reduceRight; var hasOwnProperty = Object.prototype.hasOwnProperty; function hasProperty(map, key) { return hasOwnProperty.call(map, key); } ts.hasProperty = hasProperty; function getProperty(map, key) { return hasOwnProperty.call(map, key) ? map[key] : undefined; } ts.getProperty = getProperty; function isEmpty(map) { for (var id in map) { if (hasProperty(map, id)) { return false; } } return true; } ts.isEmpty = isEmpty; function clone(object) { var result = {}; for (var id in object) { result[id] = object[id]; } return result; } ts.clone = clone; function extend(first, second) { var result = {}; for (var id in first) { result[id] = first[id]; } for (var id in second) { if (!hasProperty(result, id)) { result[id] = second[id]; } } return result; } ts.extend = extend; function forEachValue(map, callback) { var result; for (var id in map) { if (result = callback(map[id])) break; } return result; } ts.forEachValue = forEachValue; function forEachKey(map, callback) { var result; for (var id in map) { if (result = callback(id)) break; } return result; } ts.forEachKey = forEachKey; function lookUp(map, key) { return hasProperty(map, key) ? map[key] : undefined; } ts.lookUp = lookUp; function copyMap(source, target) { for (var p in source) { target[p] = source[p]; } } ts.copyMap = copyMap; function arrayToMap(array, makeKey) { var result = {}; forEach(array, function (value) { result[makeKey(value)] = value; }); return result; } ts.arrayToMap = arrayToMap; function memoize(callback) { var value; return function () { if (callback) { value = callback(); callback = undefined; } return value; }; } ts.memoize = memoize; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); } ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; } ts.getLocaleSpecificMessage = getLocaleSpecificMessage; function createFileDiagnostic(file, start, length, message) { var end = start + length; Debug.assert(start >= 0, "start must be non-negative, is " + start); Debug.assert(length >= 0, "length must be non-negative, is " + length); Debug.assert(start <= file.text.length, "start must be within the bounds of the file. " + start + " > " + file.text.length); Debug.assert(end <= file.text.length, "end must be the bounds of the file. " + end + " > " + file.text.length); var text = getLocaleSpecificMessage(message.key); if (arguments.length > 4) { text = formatStringFromArgs(text, arguments, 4); } return { file: file, start: start, length: length, messageText: text, category: message.category, code: message.code }; } ts.createFileDiagnostic = createFileDiagnostic; function createCompilerDiagnostic(message) { var text = getLocaleSpecificMessage(message.key); if (arguments.length > 1) { text = formatStringFromArgs(text, arguments, 1); } return { file: undefined, start: undefined, length: undefined, messageText: text, category: message.category, code: message.code }; } ts.createCompilerDiagnostic = createCompilerDiagnostic; function chainDiagnosticMessages(details, message) { var text = getLocaleSpecificMessage(message.key); if (arguments.length > 2) { text = formatStringFromArgs(text, arguments, 2); } return { messageText: text, category: message.category, code: message.code, next: details }; } ts.chainDiagnosticMessages = chainDiagnosticMessages; function concatenateDiagnosticMessageChains(headChain, tailChain) { Debug.assert(!headChain.next); headChain.next = tailChain; return headChain; } ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains; function compareValues(a, b) { if (a === b) return 0; if (a === undefined) return -1; if (b === undefined) return 1; return a < b ? -1 : 1; } ts.compareValues = compareValues; function getDiagnosticFileName(diagnostic) { return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { while (text1 && text2) { var string1 = typeof text1 === "string" ? text1 : text1.messageText; var string2 = typeof text2 === "string" ? text2 : text2.messageText; var res = compareValues(string1, string2); if (res) { return res; } text1 = typeof text1 === "string" ? undefined : text1.next; text2 = typeof text2 === "string" ? undefined : text2.next; } if (!text1 && !text2) { return 0; } return text1 ? 1 : -1; } function sortAndDeduplicateDiagnostics(diagnostics) { return deduplicateSortedDiagnostics(diagnostics.sort(compareDiagnostics)); } ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics; function deduplicateSortedDiagnostics(diagnostics) { if (diagnostics.length < 2) { return diagnostics; } var newDiagnostics = [diagnostics[0]]; var previousDiagnostic = diagnostics[0]; for (var i = 1; i < diagnostics.length; i++) { var currentDiagnostic = diagnostics[i]; var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0; if (!isDupe) { newDiagnostics.push(currentDiagnostic); previousDiagnostic = currentDiagnostic; } } return newDiagnostics; } ts.deduplicateSortedDiagnostics = deduplicateSortedDiagnostics; function normalizeSlashes(path) { return path.replace(/\\/g, "/"); } ts.normalizeSlashes = normalizeSlashes; function getRootLength(path) { if (path.charCodeAt(0) === 47) { if (path.charCodeAt(1) !== 47) return 1; var p1 = path.indexOf("/", 2); if (p1 < 0) return 2; var p2 = path.indexOf("/", p1 + 1); if (p2 < 0) return p1 + 1; return p2 + 1; } if (path.charCodeAt(1) === 58) { if (path.charCodeAt(2) === 47) return 3; return 2; } if (path.lastIndexOf("file:///", 0) === 0) { return "file:///".length; } var idx = path.indexOf('://'); if (idx !== -1) { return idx + "://".length; } return 0; } ts.getRootLength = getRootLength; ts.directorySeparator = "/"; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; for (var _i = 0; _i < parts.length; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && lastOrUndefined(normalized) !== "..") { normalized.pop(); } else { if (part) { normalized.push(part); } } } } return normalized; } function normalizePath(path) { path = normalizeSlashes(path); var rootLength = getRootLength(path); var normalized = getNormalizedParts(path, rootLength); return path.substr(0, rootLength) + normalized.join(ts.directorySeparator); } ts.normalizePath = normalizePath; function getDirectoryPath(path) { return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator))); } ts.getDirectoryPath = getDirectoryPath; function isUrl(path) { return path && !isRootedDiskPath(path) && path.indexOf("://") !== -1; } ts.isUrl = isUrl; function isRootedDiskPath(path) { return getRootLength(path) !== 0; } ts.isRootedDiskPath = isRootedDiskPath; function normalizedPathComponents(path, rootLength) { var normalizedParts = getNormalizedParts(path, rootLength); return [path.substr(0, rootLength)].concat(normalizedParts); } function getNormalizedPathComponents(path, currentDirectory) { path = normalizeSlashes(path); var rootLength = getRootLength(path); if (rootLength == 0) { path = combinePaths(normalizeSlashes(currentDirectory), path); rootLength = getRootLength(path); } return normalizedPathComponents(path, rootLength); } ts.getNormalizedPathComponents = getNormalizedPathComponents; function getNormalizedAbsolutePath(fileName, currentDirectory) { return getNormalizedPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory)); } ts.getNormalizedAbsolutePath = getNormalizedAbsolutePath; function getNormalizedPathFromPathComponents(pathComponents) { if (pathComponents && pathComponents.length) { return pathComponents[0] + pathComponents.slice(1).join(ts.directorySeparator); } } ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; function getNormalizedPathComponentsOfUrl(url) { // Get root length of http://www.website.com/folder1/foler2/ // In this example the root is: http://www.website.com/ // normalized path components should be ["http://www.website.com/", "folder1", "folder2"] var urlLength = url.length; var rootLength = url.indexOf("://") + "://".length; while (rootLength < urlLength) { if (url.charCodeAt(rootLength) === 47) { rootLength++; } else { break; } } if (rootLength === urlLength) { return [url]; } var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); if (indexOfNextSlash !== -1) { rootLength = indexOfNextSlash + 1; return normalizedPathComponents(url, rootLength); } else { return [url + ts.directorySeparator]; } } function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { if (isUrl(pathOrUrl)) { return getNormalizedPathComponentsOfUrl(pathOrUrl); } else { return getNormalizedPathComponents(pathOrUrl, currentDirectory); } } function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) { var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory); var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory); if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === "") { directoryComponents.length--; } for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) { break; } } if (joinStartIndex) { var relativePath = ""; var relativePathComponents = pathComponents.slice(joinStartIndex, pathComponents.length); for (; joinStartIndex < directoryComponents.length; joinStartIndex++) { if (directoryComponents[joinStartIndex] !== "") { relativePath = relativePath + ".." + ts.directorySeparator; } } return relativePath + relativePathComponents.join(ts.directorySeparator); } var absolutePath = getNormalizedPathFromPathComponents(pathComponents); if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) { absolutePath = "file:///" + absolutePath; } return absolutePath; } ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl; function getBaseFileName(path) { var i = path.lastIndexOf(ts.directorySeparator); return i < 0 ? path : path.substring(i + 1); } ts.getBaseFileName = getBaseFileName; function combinePaths(path1, path2) { if (!(path1 && path1.length)) return path2; if (!(path2 && path2.length)) return path1; if (getRootLength(path2) !== 0) return path2; if (path1.charAt(path1.length - 1) === ts.directorySeparator) return path1 + path2; return path1 + ts.directorySeparator + path2; } ts.combinePaths = combinePaths; function fileExtensionIs(path, extension) { var pathLen = path.length; var extLen = extension.length; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; var supportedExtensions = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { for (var _i = 0; _i < supportedExtensions.length; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } } return path; } ts.removeFileExtension = removeFileExtension; var backslashOrDoubleQuote = /[\"\\]/g; var escapedCharsRegExp = /[\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; var escapedCharsMap = { "\0": "\\0", "\t": "\\t", "\v": "\\v", "\f": "\\f", "\b": "\\b", "\r": "\\r", "\n": "\\n", "\\": "\\\\", "\"": "\\\"", "\u2028": "\\u2028", "\u2029": "\\u2029", "\u0085": "\\u0085" }; function Symbol(flags, name) { this.flags = flags; this.name = name; this.declarations = undefined; } function Type(checker, flags) { this.flags = flags; } function Signature(checker) { } ts.objectAllocator = { getNodeConstructor: function (kind) { function Node() { } Node.prototype = { kind: kind, pos: 0, end: 0, flags: 0, parent: undefined }; return Node; }, getSymbolConstructor: function () { return Symbol; }, getTypeConstructor: function () { return Type; }, getSignatureConstructor: function () { return Signature; } }; var Debug; (function (Debug) { var currentAssertionLevel = 0; function shouldAssert(level) { return currentAssertionLevel >= level; } Debug.shouldAssert = shouldAssert; function assert(expression, message, verboseDebugInfo) { if (!expression) { var verboseDebugString = ""; if (verboseDebugInfo) { verboseDebugString = "\r\nVerbose Debug Information: " + verboseDebugInfo(); } throw new Error("Debug Failure. False expression: " + (message || "") + verboseDebugString); } } Debug.assert = assert; function fail(message) { Debug.assert(false, message); } Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); })(ts || (ts = {})); /// <reference path="core.ts"/> var ts; (function (ts) { ts.sys = (function () { function getWScriptSystem() { var fso = new ActiveXObject("Scripting.FileSystemObject"); var fileStream = new ActiveXObject("ADODB.Stream"); fileStream.Type = 2; var binaryStream = new ActiveXObject("ADODB.Stream"); binaryStream.Type = 1; var args = []; for (var i = 0; i < WScript.Arguments.length; i++) { args[i] = WScript.Arguments.Item(i); } function readFile(fileName, encoding) { if (!fso.FileExists(fileName)) { return undefined; } fileStream.Open(); try { if (encoding) { fileStream.Charset = encoding; fileStream.LoadFromFile(fileName); } else { fileStream.Charset = "x-ansi"; fileStream.LoadFromFile(fileName); var bom = fileStream.ReadText(2) || ""; fileStream.Position = 0; fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8"; } return fileStream.ReadText(); } catch (e) { throw e; } finally { fileStream.Close(); } } function writeFile(fileName, data, writeByteOrderMark) { fileStream.Open(); binaryStream.Open(); try { fileStream.Charset = "utf-8"; fileStream.WriteText(data); if (writeByteOrderMark) { fileStream.Position = 0; } else { fileStream.Position = 3; } fileStream.CopyTo(binaryStream); binaryStream.SaveToFile(fileName, 2); } finally { binaryStream.Close(); fileStream.Close(); } } function getNames(collection) { var result = []; for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { result.push(e.item().Name); } return result.sort(); } function readDirectory(path, extension) { var result = []; visitDirectory(path); return result; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); for (var _i = 0; _i < files.length; _i++) { var name_1 = files[_i]; if (!extension || ts.fileExtensionIs(name_1, extension)) { result.push(ts.combinePaths(path, name_1)); } } var subfolders = getNames(folder.subfolders); for (var _a = 0; _a < subfolders.length; _a++) { var current = subfolders[_a]; visitDirectory(ts.combinePaths(path, current)); } } } return { args: args, newLine: "\r\n", useCaseSensitiveFileNames: false, write: function (s) { WScript.StdOut.Write(s); }, readFile: readFile, writeFile: writeFile, resolvePath: function (path) { return fso.GetAbsolutePathName(path); }, fileExists: function (path) { return fso.FileExists(path); }, directoryExists: function (path) { return fso.FolderExists(path); }, createDirectory: function (directoryName) { if (!this.directoryExists(directoryName)) { fso.CreateFolder(directoryName); } }, getExecutingFilePath: function () { return WScript.ScriptFullName; }, getCurrentDirectory: function () { return new ActiveXObject("WScript.Shell").CurrentDirectory; }, readDirectory: readDirectory, exit: function (exitCode) { try { WScript.Quit(exitCode); } catch (e) { } } }; } function getNodeSystem() { var _fs = require("fs"); var _path = require("path"); var _os = require('os'); var platform = _os.platform(); var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; function readFile(fileName, encoding) { if (!_fs.existsSync(fileName)) { return undefined; } var buffer = _fs.readFileSync(fileName); var len = buffer.length; if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) { len &= ~1; for (var i = 0; i < len; i += 2) { var temp = buffer[i]; buffer[i] = buffer[i + 1]; buffer[i + 1] = temp; } return buffer.toString("utf16le", 2); } if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) { return buffer.toString("utf16le", 2); } if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) { return buffer.toString("utf8", 3); } return buffer.toString("utf8"); } function writeFile(fileName, data, writeByteOrderMark) { if (writeByteOrderMark) { data = '\uFEFF' + data; } _fs.writeFileSync(fileName, data, "utf8"); } function readDirectory(path, extension) { var result = []; visitDirectory(path); return result; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; for (var _i = 0; _i < files.length; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); if (stat.isFile()) { if (!extension || ts.fileExtensionIs(name, extension)) { result.push(name); } } else if (stat.isDirectory()) { directories.push(name); } } for (var _a = 0; _a < directories.length; _a++) { var current = directories[_a]; visitDirectory(current); } } } return { args: process.argv.slice(2), newLine: _os.EOL, useCaseSensitiveFileNames: useCaseSensitiveFileNames, write: function (s) { _fs.writeSync(1, s); }, readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); return { close: function () { _fs.unwatchFile(fileName, fileChanged); } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { return; } callback(fileName); } ; }, resolvePath: function (path) { return _path.resolve(path); }, fileExists: function (path) { return _fs.existsSync(path); }, directoryExists: function (path) { return _fs.existsSync(path) && _fs.statSync(path).isDirectory(); }, createDirectory: function (directoryName) { if (!this.directoryExists(directoryName)) { _fs.mkdirSync(directoryName); } }, getExecutingFilePath: function () { return __filename; }, getCurrentDirectory: function () { return process.cwd(); }, readDirectory: readDirectory, getMemoryUsage: function () { if (global.gc) { global.gc(); } return process.memoryUsage().heapUsed; }, exit: function (exitCode) { process.exit(exitCode); } }; } if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { return getWScriptSystem(); } else if (typeof module !== "undefined" && module.exports) { return getNodeSystem(); } else { return undefined; } })(); })(ts || (ts = {})); /// <reference path="types.ts" /> var ts; (function (ts) { ts.Diagnostics = { Unterminated_string_literal: { code: 1002, category: ts.DiagnosticCategory.Error, key: "Unterminated string literal." }, Identifier_expected: { code: 1003, category: ts.DiagnosticCategory.Error, key: "Identifier expected." }, _0_expected: { code: 1005, category: ts.DiagnosticCategory.Error, key: "'{0}' expected." }, A_file_cannot_have_a_reference_to_itself: { code: 1006, category: ts.DiagnosticCategory.Error, key: "A file cannot have a reference to itself." }, Trailing_comma_not_allowed: { code: 1009, category: ts.DiagnosticCategory.Error, key: "Trailing comma not allowed." }, Asterisk_Slash_expected: { code: 1010, category: ts.DiagnosticCategory.Error, key: "'*/' expected." }, Unexpected_token: { code: 1012, category: ts.DiagnosticCategory.Error, key: "Unexpected token." }, A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: ts.DiagnosticCategory.Error, key: "A rest parameter must be last in a parameter list." }, Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: ts.DiagnosticCategory.Error, key: "Parameter cannot have question mark and initializer." }, A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: ts.DiagnosticCategory.Error, key: "A required parameter cannot follow an optional parameter." }, An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: ts.DiagnosticCategory.Error, key: "An index signature cannot have a rest parameter." }, An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: ts.DiagnosticCategory.Error, key: "An index signature parameter cannot have an accessibility modifier." }, An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: ts.DiagnosticCategory.Error, key: "An index signature parameter cannot have a question mark." }, An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: ts.DiagnosticCategory.Error, key: "An index signature parameter cannot have an initializer." }, An_index_signature_must_have_a_type_annotation: { code: 1021, category: ts.DiagnosticCategory.Error, key: "An index signature must have a type annotation." }, An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: ts.DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation." }, An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: ts.DiagnosticCategory.Error, key: "An index signature parameter type must be 'string' or 'number'." }, A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: ts.DiagnosticCategory.Error, key: "A class or interface declaration can only have one 'extends' clause." }, An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: ts.DiagnosticCategory.Error, key: "An 'extends' clause must precede an 'implements' clause." }, A_class_can_only_extend_a_single_class: { code: 1026, category: ts.DiagnosticCategory.Error, key: "A class can only extend a single class." }, A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: ts.DiagnosticCategory.Error, key: "A class declaration can only have one 'implements' clause." }, Accessibility_modifier_already_seen: { code: 1028, category: ts.DiagnosticCategory.Error, key: "Accessibility modifier already seen." }, _0_modifier_must_precede_1_modifier: { code: 1029, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier must precede '{1}' modifier." }, _0_modifier_already_seen: { code: 1030, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier already seen." }, _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a class element." }, An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: ts.DiagnosticCategory.Error, key: "An interface declaration cannot have an 'implements' clause." }, super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: ts.DiagnosticCategory.Error, key: "'super' must be followed by an argument list or member access." }, Only_ambient_modules_can_use_quoted_names: { code: 1035, category: ts.DiagnosticCategory.Error, key: "Only ambient modules can use quoted names." }, Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: ts.DiagnosticCategory.Error, key: "Statements are not allowed in ambient contexts." }, A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: ts.DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used in an already ambient context." }, Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: ts.DiagnosticCategory.Error, key: "Initializers are not allowed in ambient contexts." }, _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element." }, A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: ts.DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an interface declaration." }, A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: ts.DiagnosticCategory.Error, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, A_rest_parameter_cannot_be_optional: { code: 1047, category: ts.DiagnosticCategory.Error, key: "A rest parameter cannot be optional." }, A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: ts.DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer." }, A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: ts.DiagnosticCategory.Error, key: "A 'set' accessor must have exactly one parameter." }, A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: ts.DiagnosticCategory.Error, key: "A 'set' accessor cannot have an optional parameter." }, A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: ts.DiagnosticCategory.Error, key: "A 'set' accessor parameter cannot have an initializer." }, A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: ts.DiagnosticCategory.Error, key: "A 'set' accessor cannot have rest parameter." }, A_get_accessor_cannot_have_parameters: { code: 1054, category: ts.DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters." }, Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum member must have initializer." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot be used in a namespace." }, Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: ts.DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid 'reference' directive syntax." }, Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a parameter." }, Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: ts.DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: ts.DiagnosticCategory.Error, key: "Type parameters cannot appear on a constructor declaration." }, Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: ts.DiagnosticCategory.Error, key: "Type annotation cannot appear on a constructor declaration." }, An_accessor_cannot_have_type_parameters: { code: 1094, category: ts.DiagnosticCategory.Error, key: "An accessor cannot have type parameters." }, A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: ts.DiagnosticCategory.Error, key: "A 'set' accessor cannot have a return type annotation." }, An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: ts.DiagnosticCategory.Error, key: "An index signature must have exactly one parameter." }, _0_list_cannot_be_empty: { code: 1097, category: ts.DiagnosticCategory.Error, key: "'{0}' list cannot be empty." }, Type_parameter_list_cannot_be_empty: { code: 1098, category: ts.DiagnosticCategory.Error, key: "Type parameter list cannot be empty." }, Type_argument_list_cannot_be_empty: { code: 1099, category: ts.DiagnosticCategory.Error, key: "Type argument list cannot be empty." }, Invalid_use_of_0_in_strict_mode: { code: 1100, category: ts.DiagnosticCategory.Error, key: "Invalid use of '{0}' in strict mode." }, with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in strict mode." }, delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: ts.DiagnosticCategory.Error, key: "'delete' cannot be called on an identifier in strict mode." }, A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: ts.DiagnosticCategory.Error, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: ts.DiagnosticCategory.Error, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, Jump_target_cannot_cross_function_boundary: { code: 1107, category: ts.DiagnosticCategory.Error, key: "Jump target cannot cross function boundary." }, A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: ts.DiagnosticCategory.Error, key: "A 'return' statement can only be used within a function body." }, Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: "Expression expected." }, Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: "Type expected." }, A_class_member_cannot_be_declared_optional: { code: 1112, category: ts.DiagnosticCategory.Error, key: "A class member cannot be declared optional." }, A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate label '{0}'" }, A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: ts.DiagnosticCategory.Error, key: "A 'break' statement can only jump to a label of an enclosing statement." }, An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: ts.DiagnosticCategory.Error, key: "An object literal cannot have multiple properties with the same name in strict mode." }, An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: ts.DiagnosticCategory.Error, key: "An object literal cannot have multiple get/set accessors with the same name." }, An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: ts.DiagnosticCategory.Error, key: "An object literal cannot have property and accessor with the same name." }, An_export_assignment_cannot_have_modifiers: { code: 1120, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot have modifiers." }, Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: ts.DiagnosticCategory.Error, key: "Octal literals are not allowed in strict mode." }, A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: ts.DiagnosticCategory.Error, key: "A tuple type element list cannot be empty." }, Variable_declaration_list_cannot_be_empty: { code: 1123, category: ts.Dia