This commit is contained in:
Ron Buckton 2018-06-20 21:40:48 -07:00
Родитель c8c0428162
Коммит 2fc014a2d8
12 изменённых файлов: 69468 добавлений и 31098 удалений

Просмотреть файл

@ -3,7 +3,6 @@
/// <reference types="jake" />
const fs = require("fs");
const fs2 = require("fs-extra");
const os = require("os");
const path = require("path");
const fold = require("travis-fold");

Просмотреть файл

@ -70,5 +70,4 @@ function createCancellationToken(args) {
}
}
module.exports = createCancellationToken;
//# sourceMappingURL=cancellationToken.js.map
//# sourceMappingURL=cancellationToken.js.map

51
lib/protocol.d.ts поставляемый
Просмотреть файл

@ -458,7 +458,7 @@ declare namespace ts.server.protocol {
scope: OrganizeImportsScope;
}
interface OrganizeImportsResponse extends Response {
edits: ReadonlyArray<FileCodeEdits>;
body: ReadonlyArray<FileCodeEdits>;
}
interface GetEditsForFileRenameRequest extends Request {
command: CommandTypes.GetEditsForFileRename;
@ -469,7 +469,7 @@ declare namespace ts.server.protocol {
readonly newFilePath: string;
}
interface GetEditsForFileRenameResponse extends Response {
edits: ReadonlyArray<FileCodeEdits>;
body: ReadonlyArray<FileCodeEdits>;
}
/**
* Request for the available codefixes at a specific position.
@ -2255,6 +2255,7 @@ declare namespace ts.server.protocol {
interface TextInsertion {
newText: string;
/** The position in newText the caret should point to after the insertion. */
caretOffset: number;
}
@ -2270,9 +2271,13 @@ declare namespace ts.server.protocol {
}
enum OutliningSpanKind {
/** Single or multi-line comments */
Comment = "comment",
/** Sections marked by '// #region' and '// #endregion' comments */
Region = "region",
/** Declarations and expressions */
Code = "code",
/** Contiguous blocks of import declarations */
Imports = "imports"
}
@ -2286,27 +2291,56 @@ declare namespace ts.server.protocol {
enum ScriptElementKind {
unknown = "",
warning = "warning",
/** predefined type (void) or keyword (class) */
keyword = "keyword",
/** top level script node */
scriptElement = "script",
/** module foo {} */
moduleElement = "module",
/** class X {} */
classElement = "class",
/** var x = class X {} */
localClassElement = "local class",
/** interface Y {} */
interfaceElement = "interface",
/** type T = ... */
typeElement = "type",
/** enum E */
enumElement = "enum",
enumMemberElement = "enum member",
/**
* Inside module and script only
* const v = ..
*/
variableElement = "var",
/** Inside function */
localVariableElement = "local var",
/**
* Inside module and script only
* function f() { }
*/
functionElement = "function",
/** Inside function */
localFunctionElement = "local function",
/** class X { [public|private]* foo() {} } */
memberFunctionElement = "method",
/** class X { [public|private]* [get|set] foo:number; } */
memberGetAccessorElement = "getter",
memberSetAccessorElement = "setter",
/**
* class X { [public|private]* foo:number; }
* interface Y { foo:number; }
*/
memberVariableElement = "property",
/** class X { constructor() { } } */
constructorImplementationElement = "constructor",
/** interface Y { ():number; } */
callSignatureElement = "call",
/** interface Y { []:number; } */
indexSignatureElement = "index",
/** interface Y { new():Y; } */
constructSignatureElement = "construct",
/** function foo(*Y*: string) */
parameterElement = "parameter",
typeParameterElement = "type parameter",
primitiveType = "primitive type",
@ -2316,7 +2350,11 @@ declare namespace ts.server.protocol {
letElement = "let",
directory = "directory",
externalModuleName = "external module name",
/**
* <JsxTagName attribute1 attribute2={0} />
*/
jsxAttribute = "JSX attribute",
/** String literal */
string = "string"
}
@ -2339,6 +2377,11 @@ declare namespace ts.server.protocol {
text?: string;
}
/**
* Type of objects whose values are all of the same type.
* The `in` and `for-in` operators can *not* be safely used,
* since `Object.prototype` may be modified by outside code.
*/
interface MapLike<T> {
[index: string]: T;
}
@ -2348,9 +2391,13 @@ declare namespace ts.server.protocol {
}
interface ProjectReference {
/** A normalized path on disk */
path: string;
/** The path as the user originally wrote it */
originalPath?: string;
/** True if the output of this reference should be prepended to the output of this project. Only valid for --outFile compilations */
prepend?: boolean;
/** True if it is intended that this reference form a circularity */
circular?: boolean;
}

Просмотреть файл

@ -1,11 +1,14 @@
"use strict";"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
@ -53963,7 +53966,7 @@ var ts;
name: "typescript:assign",
scoped: false,
priority: 1,
text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };"
text: "\n var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };"
};
function createAssignHelper(context, attributesSegments) {
if (context.getCompilerOptions().target >= 2) {
@ -56440,7 +56443,7 @@ var ts;
name: "typescript:extends",
scoped: false,
priority: 0,
text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();"
text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();"
};
var templateObjectHelper = {
name: "typescript:makeTemplateObject",
@ -61783,13 +61786,17 @@ var ts;
var offsetLine_1 = writer.getLine();
var firstLineColumnOffset_1 = writer.getColumn();
var originalMap_1 = parsed;
var sourcesDirectoryPath_1 = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
var resolvedPathCache_1 = ts.createMap();
ts.sourcemaps.calculateDecodedMappings(originalMap_1, function (raw) {
var rawPath = originalMap_1.sources[raw.sourceIndex];
var relativePath = originalMap_1.sourceRoot ? ts.combinePaths(originalMap_1.sourceRoot, rawPath) : rawPath;
var combinedPath = ts.combinePaths(ts.getDirectoryPath(node.sourceMapPath), relativePath);
var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
var resolvedPath = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, combinedPath, host.getCurrentDirectory(), host.getCanonicalFileName, true);
var absolutePath = ts.getNormalizedAbsolutePath(resolvedPath, sourcesDirectoryPath);
if (!resolvedPathCache_1.has(combinedPath)) {
resolvedPathCache_1.set(combinedPath, ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath_1, combinedPath, host.getCurrentDirectory(), host.getCanonicalFileName, true));
}
var resolvedPath = resolvedPathCache_1.get(combinedPath);
var absolutePath = ts.getNormalizedAbsolutePath(resolvedPath, sourcesDirectoryPath_1);
setupSourceEntry(absolutePath, originalMap_1.sourcesContent ? originalMap_1.sourcesContent[raw.sourceIndex] : null);
var newIndex = sourceMapData.sourceMapSources.indexOf(resolvedPath);
encodeLastRecordedSourceMapSpan();
@ -70335,11 +70342,6 @@ var ts;
}
ts.createSolutionBuilder = createSolutionBuilder;
function getUpToDateStatus(host, project) {
if (project === undefined) {
return {
type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build"
};
}
if (project === undefined) {
return { type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
}
@ -70415,6 +70417,7 @@ var ts;
}
var pseudoUpToDate = false;
var usesPrepend = false;
var upstreamChangedProject;
if (project.projectReferences && host.parseConfigFile) {
for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
var ref = _d[_c];
@ -70438,6 +70441,7 @@ var ts;
}
if (refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
pseudoUpToDate = true;
upstreamChangedProject = ref.path;
continue;
}
ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
@ -70461,8 +70465,12 @@ var ts;
newerInputFileName: newestInputFileName
};
}
if (usesPrepend) {
pseudoUpToDate = false;
if (usesPrepend && pseudoUpToDate) {
return {
type: UpToDateStatusType.OutOfDateWithUpstream,
outOfDateOutputFileName: oldestOutputFileName,
newerProjectName: upstreamChangedProject
};
}
return {
type: pseudoUpToDate ? UpToDateStatusType.UpToDateWithUpstreamTypes : UpToDateStatusType.UpToDate,

Просмотреть файл

@ -65494,7 +65494,7 @@ var ts;
name: "typescript:assign",
scoped: false,
priority: 1,
text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };"
text: "\n var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };"
};
function createAssignHelper(context, attributesSegments) {
if (context.getCompilerOptions().target >= 2 /* ES2015 */) {
@ -69112,7 +69112,7 @@ var ts;
name: "typescript:extends",
scoped: false,
priority: 0,
text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();"
text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();"
};
var templateObjectHelper = {
name: "typescript:makeTemplateObject",
@ -76863,15 +76863,19 @@ var ts;
var firstLineColumnOffset_1 = writer.getColumn();
// First, decode the old component sourcemap
var originalMap_1 = parsed;
var sourcesDirectoryPath_1 = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
var resolvedPathCache_1 = ts.createMap();
ts.sourcemaps.calculateDecodedMappings(originalMap_1, function (raw) {
// Apply offsets to each position and fixup source entries
var rawPath = originalMap_1.sources[raw.sourceIndex];
var relativePath = originalMap_1.sourceRoot ? ts.combinePaths(originalMap_1.sourceRoot, rawPath) : rawPath;
var combinedPath = ts.combinePaths(ts.getDirectoryPath(node.sourceMapPath), relativePath);
var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
var resolvedPath = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, combinedPath, host.getCurrentDirectory(), host.getCanonicalFileName,
/*isAbsolutePathAnUrl*/ true);
var absolutePath = ts.getNormalizedAbsolutePath(resolvedPath, sourcesDirectoryPath);
if (!resolvedPathCache_1.has(combinedPath)) {
resolvedPathCache_1.set(combinedPath, ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath_1, combinedPath, host.getCurrentDirectory(), host.getCanonicalFileName,
/*isAbsolutePathAnUrl*/ true));
}
var resolvedPath = resolvedPathCache_1.get(combinedPath);
var absolutePath = ts.getNormalizedAbsolutePath(resolvedPath, sourcesDirectoryPath_1);
// tslint:disable-next-line:no-null-keyword
setupSourceEntry(absolutePath, originalMap_1.sourcesContent ? originalMap_1.sourcesContent[raw.sourceIndex] : null); // TODO: Lookup content for inlining?
var newIndex = sourceMapData.sourceMapSources.indexOf(resolvedPath);
@ -82959,7 +82963,7 @@ var ts;
}
function parseProjectReferenceConfigFile(ref) {
// The actual filename (i.e. add "/tsconfig.json" if necessary)
var refPath = resolveProjectReferencePath(host, ref); // TODO: GH#18217
var refPath = resolveProjectReferencePath(host, ref);
// An absolute path pointing to the containing directory of the config file
var basePath = ts.getNormalizedAbsolutePath(ts.getDirectoryPath(refPath), host.getCurrentDirectory());
var sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
@ -86542,11 +86546,6 @@ var ts;
* Gets the UpToDateStatus for a project
*/
function getUpToDateStatus(host, project) {
if (project === undefined) {
return {
type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build"
};
}
if (project === undefined) {
return { type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
}
@ -86633,6 +86632,7 @@ var ts;
}
var pseudoUpToDate = false;
var usesPrepend = false;
var upstreamChangedProject;
if (project.projectReferences && host.parseConfigFile) {
for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
var ref = _d[_c];
@ -86662,6 +86662,7 @@ var ts;
// *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
if (refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
pseudoUpToDate = true;
upstreamChangedProject = ref.path;
continue;
}
// We have an output older than an upstream output - we are out of date
@ -86686,8 +86687,12 @@ var ts;
newerInputFileName: newestInputFileName
};
}
if (usesPrepend) {
pseudoUpToDate = false;
if (usesPrepend && pseudoUpToDate) {
return {
type: UpToDateStatusType.OutOfDateWithUpstream,
outOfDateOutputFileName: oldestOutputFileName,
newerProjectName: upstreamChangedProject
};
}
// Up to date
return {
@ -86745,7 +86750,6 @@ var ts;
}
ts.formatUpToDateStatus = formatUpToDateStatus;
})(ts || (ts = {}));
//# sourceMappingURL=compiler.js.map
"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
@ -111803,7 +111807,6 @@ var TypeScript;
// TODO: it should be moved into a namespace though.
/* @internal */
var toolsVersion = ts.versionMajorMinor;
//# sourceMappingURL=services.js.map
"use strict";
/* @internal */
@ -112214,7 +112217,6 @@ var ts;
}());
ts.Semver = Semver;
})(ts || (ts = {}));
//# sourceMappingURL=jsTyping.js.map
"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
@ -118419,8 +118421,8 @@ var ts;
}());
})(server = ts.server || (ts.server = {}));
})(ts || (ts = {}));
//# sourceMappingURL=server.js.map
// tslint:disable no-unnecessary-type-assertion (TODO: tslint can't find node types)
var ts;
(function (ts) {
var server;
@ -118472,7 +118474,7 @@ var ts;
output: process.stdout,
terminal: false,
});
var Logger = (function () {
var Logger = /** @class */ (function () {
function Logger(logFilename, traceToConsole, level) {
this.logFilename = logFilename;
this.traceToConsole = traceToConsole;
@ -118486,6 +118488,7 @@ var ts;
this.fd = fs.openSync(this.logFilename, "w");
}
catch (_) {
// swallow the error and keep logging disabled if file cannot be opened
}
}
}
@ -118546,7 +118549,8 @@ var ts;
Logger.prototype.write = function (s) {
if (this.fd >= 0) {
var buf = new Buffer(s);
fs.writeSync(this.fd, buf, 0, buf.length, null);
// tslint:disable-next-line no-null-keyword
fs.writeSync(this.fd, buf, 0, buf.length, /*position*/ null); // TODO: GH#18217
}
if (this.traceToConsole) {
console.warn(s);
@ -118554,7 +118558,7 @@ var ts;
};
return Logger;
}());
var NodeTypingsInstaller = (function () {
var NodeTypingsInstaller = /** @class */ (function () {
function NodeTypingsInstaller(telemetryEnabled, logger, host, globalTypingsCacheLocation, typingSafeListLocation, typesMapLocation, npmLocation, event) {
this.telemetryEnabled = telemetryEnabled;
this.logger = logger;
@ -118566,11 +118570,12 @@ var ts;
this.event = event;
this.activeRequestCount = 0;
this.requestQueue = [];
this.requestMap = ts.createMap();
this.requestMap = ts.createMap(); // Maps operation ID to newest requestQueue entry with that ID
}
NodeTypingsInstaller.prototype.isKnownTypesPackageName = function (name) {
// We want to avoid looking this up in the registry as that is expensive. So first check that it's actually an NPM package.
var validationResult = ts.JsTyping.validatePackageName(name);
if (validationResult !== 0) {
if (validationResult !== 0 /* Ok */) {
return false;
}
if (this.requestedRegistry) {
@ -118616,6 +118621,8 @@ var ts;
var arg = _a[_i];
var match = /^--((?:debug|inspect)(?:-brk)?)(?:=(\d+))?$/.exec(arg);
if (match) {
// if port is specified - use port + 1
// otherwise pick a default port depending on if 'debug' or 'inspect' and use its value + 1
var currentPort = match[2] !== undefined
? +match[2]
: match[1].charAt(0) === "d" ? 5858 : 9229;
@ -118681,6 +118688,7 @@ var ts;
}
this.packageInstalledPromise = undefined;
this.projectService.updateTypingsForProject(response);
// The behavior is the same as for setTypings, so send the same event.
this.event(response, "setTypings");
break;
}
@ -118765,11 +118773,16 @@ var ts;
this.activeRequestCount++;
this.host.setTimeout(request.operation, NodeTypingsInstaller.requestDelayMillis);
};
// This number is essentially arbitrary. Processing more than one typings request
// at a time makes sense, but having too many in the pipe results in a hang
// (see https://github.com/nodejs/node/issues/7657).
// It would be preferable to base our limit on the amount of space left in the
// buffer, but we have yet to find a way to retrieve that value.
NodeTypingsInstaller.maxActiveRequestCount = 10;
NodeTypingsInstaller.requestDelayMillis = 100;
return NodeTypingsInstaller;
}());
var IOSession = (function (_super) {
var IOSession = /** @class */ (function (_super) {
__extends(IOSession, _super);
function IOSession() {
var _this = this;
@ -118778,6 +118791,10 @@ var ts;
_this.event(body, eventName);
}
else {
// It is unsafe to dereference `this` before initialization completes,
// so we defer until the next tick.
//
// Construction should finish before the next tick fires, so we do not need to do this recursively.
setImmediate(function () { return _this.event(body, eventName); });
}
};
@ -118807,6 +118824,7 @@ var ts;
var s_1 = net.connect({ port: _this.eventPort }, function () {
_this.eventSocket = s_1;
if (_this.socketEventQueue) {
// flush queue.
for (var _i = 0, _a = _this.socketEventQueue; _i < _a.length; _i++) {
var event_1 = _a[_i];
_this.writeToEventSocket(event_1.body, event_1.eventName);
@ -118890,13 +118908,13 @@ var ts;
function getEntireValue(initialIndex) {
var pathStart = args[initialIndex];
var extraPartCounter = 0;
if (pathStart.charCodeAt(0) === 34 &&
pathStart.charCodeAt(pathStart.length - 1) !== 34) {
if (pathStart.charCodeAt(0) === 34 /* doubleQuote */ &&
pathStart.charCodeAt(pathStart.length - 1) !== 34 /* doubleQuote */) {
for (var i = initialIndex + 1; i < args.length; i++) {
pathStart += " ";
pathStart += args[i];
extraPartCounter++;
if (pathStart.charCodeAt(pathStart.length - 1) === 34)
if (pathStart.charCodeAt(pathStart.length - 1) === 34 /* doubleQuote */)
break;
}
}
@ -118914,6 +118932,7 @@ var ts;
}
return undefined;
}
// TSS_LOG "{ level: "normal | verbose | terse", file?: string}"
function createLogger() {
var cmdLineLogFileName = server.findArgument("--logFile");
var cmdLineVerbosity = getLogLevel(server.findArgument("--logVerbosity"));
@ -118924,8 +118943,12 @@ var ts;
? envLogOptions.file || (__dirname + "/.log" + process.pid.toString())
: undefined;
var logVerbosity = cmdLineVerbosity || envLogOptions.detailLevel;
return new Logger(logFileName, envLogOptions.traceToConsole, logVerbosity);
return new Logger(logFileName, envLogOptions.traceToConsole, logVerbosity); // TODO: GH#18217
}
// This places log file in the directory containing editorServices.js
// TODO: check that this location is writable
// average async stat takes about 30 microseconds
// set chunk size to do 30 files in < 1 millisecond
function createPollingWatchedFileSet(interval, chunkSize) {
if (interval === void 0) { interval = 2500; }
if (chunkSize === void 0) { chunkSize = 30; }
@ -118957,6 +118980,9 @@ var ts;
}
});
}
// this implementation uses polling and
// stat due to inconsistencies of fs.watch
// and efficiency of stat on modern filesystems
function startWatchTimer() {
setInterval(function () {
var count = 0;
@ -118982,7 +119008,7 @@ var ts;
callback: callback,
mtime: sys.fileExists(fileName)
? getModifiedTime(fileName)
: ts.missingFileModifiedTime
: ts.missingFileModifiedTime // Any subsequent modification will occur after this time
};
watchedFiles.push(file);
if (watchedFiles.length === 1) {
@ -118994,6 +119020,19 @@ var ts;
ts.unorderedRemoveItem(watchedFiles, file);
}
}
// REVIEW: for now this implementation uses polling.
// The advantage of polling is that it works reliably
// on all os and with network mounted files.
// For 90 referenced files, the average time to detect
// changes is 2*msInterval (by default 5 seconds).
// The overhead of this is .04 percent (1/2500) with
// average pause of < 1 millisecond (and max
// pause less than 1.5 milliseconds); question is
// do we anticipate reference sets in the 100s and
// do we care about waiting 10-20 seconds to detect
// changes for large reference sets? If so, do we want
// to increase the chunk size or decrease the interval
// time dynamically to match the large reference set?
var pollingWatchedFileSet = createPollingWatchedFileSet();
var pending = [];
var canWrite = true;
@ -119015,30 +119054,40 @@ var ts;
function extractWatchDirectoryCacheKey(path, currentDriveKey) {
path = ts.normalizeSlashes(path);
if (isUNCPath(path)) {
// UNC path: extract server name
// //server/location
// ^ <- from 0 to this position
var firstSlash = path.indexOf(ts.directorySeparator, 2);
return firstSlash !== -1 ? path.substring(0, firstSlash).toLowerCase() : path;
}
var rootLength = ts.getRootLength(path);
if (rootLength === 0) {
// relative path - assume file is on the current drive
return currentDriveKey;
}
if (path.charCodeAt(1) === 58 && path.charCodeAt(2) === 47) {
if (path.charCodeAt(1) === 58 /* colon */ && path.charCodeAt(2) === 47 /* slash */) {
// rooted path that starts with c:/... - extract drive letter
return path.charAt(0).toLowerCase();
}
if (path.charCodeAt(0) === 47 && path.charCodeAt(1) !== 47) {
if (path.charCodeAt(0) === 47 /* slash */ && path.charCodeAt(1) !== 47 /* slash */) {
// rooted path that starts with slash - /somename - use key for current drive
return currentDriveKey;
}
// do not cache any other cases
return undefined;
}
function isUNCPath(s) {
return s.length > 2 && s.charCodeAt(0) === 47 && s.charCodeAt(1) === 47;
return s.length > 2 && s.charCodeAt(0) === 47 /* slash */ && s.charCodeAt(1) === 47 /* slash */;
}
var logger = createLogger();
var sys = ts.sys;
var nodeVersion = ts.getNodeMajorVersion();
// use watchGuard process on Windows when node version is 4 or later
var useWatchGuard = process.platform === "win32" && nodeVersion >= 4;
var originalWatchDirectory = sys.watchDirectory.bind(sys);
var noopWatcher = { close: ts.noop };
// This is the function that catches the exceptions when watching directory, and yet lets project service continue to function
// Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
function watchDirectorySwallowingException(path, callback, recursive) {
try {
return originalWatchDirectory(path, callback, recursive);
@ -119049,7 +119098,7 @@ var ts;
}
}
if (useWatchGuard) {
var currentDrive_1 = extractWatchDirectoryCacheKey(sys.resolvePath(sys.getCurrentDirectory()), undefined);
var currentDrive_1 = extractWatchDirectoryCacheKey(sys.resolvePath(sys.getCurrentDirectory()), /*currentDriveKey*/ undefined);
var statusCache_1 = ts.createMap();
sys.watchDirectory = function (path, callback, recursive) {
var cacheKey = extractWatchDirectoryCacheKey(path, currentDrive_1);
@ -119083,9 +119132,11 @@ var ts;
logger.info("watchDirectory for " + path + " uses cached drive information.");
}
if (status) {
// this drive is safe to use - call real 'watchDirectory'
return watchDirectorySwallowingException(path, callback, recursive);
}
else {
// this drive is unsafe - return no-op watcher
return noopWatcher;
}
};
@ -119093,6 +119144,7 @@ var ts;
else {
sys.watchDirectory = watchDirectorySwallowingException;
}
// Override sys.write because fs.writeSync is not reliable on Node 4
sys.write = function (s) { return writeMessage(new Buffer(s, "utf8")); };
sys.watchFile = function (fileName, callback) {
var watchedFile = pollingWatchedFileSet.addFile(fileName, callback);
@ -119136,7 +119188,7 @@ var ts;
ts.validateLocaleAndSetLanguage(localeStr, sys);
}
ts.setStackTraceLimit();
var typingSafeListLocation = server.findArgument(server.Arguments.TypingSafeListLocation);
var typingSafeListLocation = server.findArgument(server.Arguments.TypingSafeListLocation); // TODO: GH#18217
var typesMapLocation = server.findArgument(server.Arguments.TypesMapLocation) || ts.combinePaths(sys.getExecutingFilePath(), "../typesMap.json");
var npmLocation = server.findArgument(server.Arguments.NpmLocation);
function parseStringArray(argName) {
@ -119164,9 +119216,11 @@ var ts;
process.on("uncaughtException", function (err) {
ioSession.logError(err, "unknown");
});
// See https://github.com/Microsoft/TypeScript/issues/11348
// tslint:disable-next-line no-unnecessary-type-assertion-2
process.noAsar = true;
// Start listening
ioSession.listen();
})(server = ts.server || (ts.server = {}));
})(ts || (ts = {}));
//# sourceMappingURL=tsserver.js.map
//# sourceMappingURL=tsserver.js.map

5
lib/tsserverlibrary.d.ts поставляемый
Просмотреть файл

@ -14,6 +14,7 @@ and limitations under the License.
***************************************************************************** */
declare namespace ts {
const versionMajorMinor = "3.0";
/** The version of the TypeScript compiler release */
@ -12460,7 +12461,7 @@ declare namespace ts.server.protocol {
scope: OrganizeImportsScope;
}
interface OrganizeImportsResponse extends Response {
edits: ReadonlyArray<FileCodeEdits>;
body: ReadonlyArray<FileCodeEdits>;
}
interface GetEditsForFileRenameRequest extends Request {
command: CommandTypes.GetEditsForFileRename;
@ -12471,7 +12472,7 @@ declare namespace ts.server.protocol {
readonly newFilePath: string;
}
interface GetEditsForFileRenameResponse extends Response {
edits: ReadonlyArray<FileCodeEdits>;
body: ReadonlyArray<FileCodeEdits>;
}
interface CodeFixRequest extends Request {
command: CommandTypes.GetCodeFixes;

1190
lib/typescript.d.ts поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

1188
lib/typescriptServices.d.ts поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -65494,7 +65494,7 @@ var ts;
name: "typescript:assign",
scoped: false,
priority: 1,
text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };"
text: "\n var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };"
};
function createAssignHelper(context, attributesSegments) {
if (context.getCompilerOptions().target >= 2 /* ES2015 */) {
@ -69112,7 +69112,7 @@ var ts;
name: "typescript:extends",
scoped: false,
priority: 0,
text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();"
text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();"
};
var templateObjectHelper = {
name: "typescript:makeTemplateObject",
@ -76863,15 +76863,19 @@ var ts;
var firstLineColumnOffset_1 = writer.getColumn();
// First, decode the old component sourcemap
var originalMap_1 = parsed;
var sourcesDirectoryPath_1 = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
var resolvedPathCache_1 = ts.createMap();
ts.sourcemaps.calculateDecodedMappings(originalMap_1, function (raw) {
// Apply offsets to each position and fixup source entries
var rawPath = originalMap_1.sources[raw.sourceIndex];
var relativePath = originalMap_1.sourceRoot ? ts.combinePaths(originalMap_1.sourceRoot, rawPath) : rawPath;
var combinedPath = ts.combinePaths(ts.getDirectoryPath(node.sourceMapPath), relativePath);
var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
var resolvedPath = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, combinedPath, host.getCurrentDirectory(), host.getCanonicalFileName,
/*isAbsolutePathAnUrl*/ true);
var absolutePath = ts.getNormalizedAbsolutePath(resolvedPath, sourcesDirectoryPath);
if (!resolvedPathCache_1.has(combinedPath)) {
resolvedPathCache_1.set(combinedPath, ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath_1, combinedPath, host.getCurrentDirectory(), host.getCanonicalFileName,
/*isAbsolutePathAnUrl*/ true));
}
var resolvedPath = resolvedPathCache_1.get(combinedPath);
var absolutePath = ts.getNormalizedAbsolutePath(resolvedPath, sourcesDirectoryPath_1);
// tslint:disable-next-line:no-null-keyword
setupSourceEntry(absolutePath, originalMap_1.sourcesContent ? originalMap_1.sourcesContent[raw.sourceIndex] : null); // TODO: Lookup content for inlining?
var newIndex = sourceMapData.sourceMapSources.indexOf(resolvedPath);
@ -82959,7 +82963,7 @@ var ts;
}
function parseProjectReferenceConfigFile(ref) {
// The actual filename (i.e. add "/tsconfig.json" if necessary)
var refPath = resolveProjectReferencePath(host, ref); // TODO: GH#18217
var refPath = resolveProjectReferencePath(host, ref);
// An absolute path pointing to the containing directory of the config file
var basePath = ts.getNormalizedAbsolutePath(ts.getDirectoryPath(refPath), host.getCurrentDirectory());
var sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
@ -86542,11 +86546,6 @@ var ts;
* Gets the UpToDateStatus for a project
*/
function getUpToDateStatus(host, project) {
if (project === undefined) {
return {
type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build"
};
}
if (project === undefined) {
return { type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
}
@ -86633,6 +86632,7 @@ var ts;
}
var pseudoUpToDate = false;
var usesPrepend = false;
var upstreamChangedProject;
if (project.projectReferences && host.parseConfigFile) {
for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
var ref = _d[_c];
@ -86662,6 +86662,7 @@ var ts;
// *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
if (refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
pseudoUpToDate = true;
upstreamChangedProject = ref.path;
continue;
}
// We have an output older than an upstream output - we are out of date
@ -86686,8 +86687,12 @@ var ts;
newerInputFileName: newestInputFileName
};
}
if (usesPrepend) {
pseudoUpToDate = false;
if (usesPrepend && pseudoUpToDate) {
return {
type: UpToDateStatusType.OutOfDateWithUpstream,
outOfDateOutputFileName: oldestOutputFileName,
newerProjectName: upstreamChangedProject
};
}
// Up to date
return {
@ -86745,7 +86750,6 @@ var ts;
}
ts.formatUpToDateStatus = formatUpToDateStatus;
})(ts || (ts = {}));
//# sourceMappingURL=compiler.js.map
"use strict";
/* @internal */
@ -87156,7 +87160,6 @@ var ts;
}());
ts.Semver = Semver;
})(ts || (ts = {}));
//# sourceMappingURL=jsTyping.js.map
"use strict";
var ts;
@ -87633,7 +87636,6 @@ var ts;
})(typingsInstaller = server.typingsInstaller || (server.typingsInstaller = {}));
})(server = ts.server || (ts.server = {}));
})(ts || (ts = {}));
//# sourceMappingURL=typingsInstallerCore.js.map
var ts;
(function (ts) {
@ -87844,5 +87846,4 @@ var ts;
})(typingsInstaller = server.typingsInstaller || (server.typingsInstaller = {}));
})(server = ts.server || (ts.server = {}));
})(ts || (ts = {}));
//# sourceMappingURL=typingsInstaller.js.map
//# sourceMappingURL=typingsInstaller.js.map

Просмотреть файл

@ -26,5 +26,4 @@ try {
}
catch (_a) { }
process.exit(0);
//# sourceMappingURL=watchGuard.js.map
//# sourceMappingURL=watchGuard.js.map