From 6487690f91a0440a7071dd04df8000c9ca156a6e Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 17 Aug 2018 13:52:50 -0700 Subject: [PATCH 1/8] 3.0.2 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index c180bb97ed1..33f23b6a0c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "typescript", - "version": "3.0.0", + "version": "3.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 969e764d4bd..2d23d3c5608 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "http://typescriptlang.org/", - "version": "3.0.1", + "version": "3.0.2", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ From 244dc10eb1664a9997e094ee87b220d9d9b0ff66 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 17 Aug 2018 14:02:20 -0700 Subject: [PATCH 2/8] Update LKG --- lib/lib.dom.d.ts | 1 + lib/tsc.js | 45 ++++++++++++++++++++++++++-------- lib/tsserver.js | 47 ++++++++++++++++++++++++++++-------- lib/tsserverlibrary.js | 51 ++++++++++++++++++++++++++++++--------- lib/typescript.js | 51 ++++++++++++++++++++++++++++++--------- lib/typescriptServices.js | 51 ++++++++++++++++++++++++++++++--------- lib/typingsInstaller.js | 47 ++++++++++++++++++++++++++++-------- 7 files changed, 227 insertions(+), 66 deletions(-) diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index 920c0ad2dae..78532a218e9 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -14132,6 +14132,7 @@ interface Storage { * storage[key] = value */ setItem(key: string, value: string): void; + [name: string]: any; } declare var Storage: { diff --git a/lib/tsc.js b/lib/tsc.js index 126f5f19bd6..b9fd54df617 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -27809,19 +27809,23 @@ var ts; return createAnonymousType(symbol, exports_1, ts.emptyArray, ts.emptyArray, jsObjectLiteralIndexInfo, undefined); } } - function getAnnotatedAccessorType(accessor) { + function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { if (accessor.kind === 156) { var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation && getTypeFromTypeNode(getterTypeAnnotation); + return getterTypeAnnotation; } else { var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation; } } return undefined; } + function getAnnotatedAccessorType(accessor) { + var node = getAnnotatedAccessorTypeNode(accessor); + return node && getTypeFromTypeNode(node); + } function getAnnotatedAccessorThisParameter(accessor) { var parameter = getAccessorThisParameter(accessor); return parameter && parameter.symbol; @@ -42059,9 +42063,13 @@ var ts; } } break; - case 154: case 156: case 157: + var otherKind = node.kind === 156 ? 157 : 156; + var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); + markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); + break; + case 154: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); @@ -53166,14 +53174,19 @@ var ts; } return false; } + function getAccessorTypeNode(node) { + var accessors = resolver.getAllAccessorDeclarations(node); + return accessors.setAccessor && ts.getSetAccessorTypeAnnotationNode(accessors.setAccessor) + || accessors.getAccessor && ts.getEffectiveReturnTypeNode(accessors.getAccessor); + } function serializeTypeOfNode(node) { switch (node.kind) { case 152: case 149: - case 156: return serializeTypeNode(node.type); case 157: - return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); + case 156: + return serializeTypeNode(getAccessorTypeNode(node)); case 238: case 207: case 154: @@ -61494,7 +61507,7 @@ var ts; } if (node.kind === 278) { isBundledEmit = true; - var refs_1 = ts.createMap(); + refs = ts.createMap(); var hasNoDefaultLib_1 = false; var bundle = ts.createBundle(ts.map(node.sourceFiles, function (sourceFile) { if (sourceFile.isDeclarationFile || ts.isSourceFileJavaScript(sourceFile)) @@ -61508,7 +61521,7 @@ var ts; getSymbolAccessibilityDiagnostic = throwDiagnostic; needsScopeFixMarker = false; resultHasScopeMarker = false; - collectReferences(sourceFile, refs_1); + collectReferences(sourceFile, refs); if (ts.isExternalModule(sourceFile)) { resultHasExternalModuleIndicator = false; needsDeclare = false; @@ -61529,7 +61542,7 @@ var ts; bundle.hasNoDefaultLib = hasNoDefaultLib_1; var outputFilePath_1 = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, true).declarationFilePath)); var referenceVisitor_1 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath_1); - refs_1.forEach(referenceVisitor_1); + refs.forEach(referenceVisitor_1); return bundle; } needsDeclare = true; @@ -62229,6 +62242,15 @@ var ts; } return false; } + function isScopeMarker(node) { + return ts.isExportAssignment(node) || ts.isExportDeclaration(node); + } + function hasScopeMarker(node) { + if (ts.isModuleBlock(node)) { + return ts.some(node.statements, isScopeMarker); + } + return false; + } function ensureModifiers(node, privateDeclaration) { var currentFlags = ts.getModifierFlags(node); var newFlags = ensureModifierFlags(node, privateDeclaration); @@ -62242,7 +62264,7 @@ var ts; var additions = (needsDeclare && !isAlwaysType(node)) ? 2 : 0; var parentIsFile = node.parent.kind === 277; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { - mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) ? 0 : 1) | 512 | 2); + mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) || hasScopeMarker(node.parent) ? 0 : 1) | 2); additions = 0; } return maskModifierFlags(node, mask, additions); @@ -62299,6 +62321,9 @@ var ts; if (modifierMask === void 0) { modifierMask = 3071 ^ 4; } if (modifierAdditions === void 0) { modifierAdditions = 0; } var flags = (ts.getModifierFlags(node) & modifierMask) | modifierAdditions; + if (flags & 512 && !(flags & 1)) { + flags ^= 1; + } if (flags & 512 && flags & 2) { flags ^= 2; } diff --git a/lib/tsserver.js b/lib/tsserver.js index 106825a7e83..f5a945ff945 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -33849,19 +33849,23 @@ var ts; return createAnonymousType(symbol, exports_1, ts.emptyArray, ts.emptyArray, jsObjectLiteralIndexInfo, undefined); } } - function getAnnotatedAccessorType(accessor) { + function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { if (accessor.kind === 156 /* GetAccessor */) { var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation && getTypeFromTypeNode(getterTypeAnnotation); + return getterTypeAnnotation; } else { var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation; } } return undefined; } + function getAnnotatedAccessorType(accessor) { + var node = getAnnotatedAccessorTypeNode(accessor); + return node && getTypeFromTypeNode(node); + } function getAnnotatedAccessorThisParameter(accessor) { var parameter = getAccessorThisParameter(accessor); return parameter && parameter.symbol; @@ -50647,9 +50651,13 @@ var ts; } } break; - case 154 /* MethodDeclaration */: case 156 /* GetAccessor */: case 157 /* SetAccessor */: + var otherKind = node.kind === 156 /* GetAccessor */ ? 157 /* SetAccessor */ : 156 /* GetAccessor */; + var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); + markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); + break; + case 154 /* MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); @@ -63980,6 +63988,11 @@ var ts; } return false; } + function getAccessorTypeNode(node) { + var accessors = resolver.getAllAccessorDeclarations(node); + return accessors.setAccessor && ts.getSetAccessorTypeAnnotationNode(accessors.setAccessor) + || accessors.getAccessor && ts.getEffectiveReturnTypeNode(accessors.getAccessor); + } /** * Serializes the type of a node for use with decorator type metadata. * @@ -63989,10 +64002,10 @@ var ts; switch (node.kind) { case 152 /* PropertyDeclaration */: case 149 /* Parameter */: - case 156 /* GetAccessor */: return serializeTypeNode(node.type); case 157 /* SetAccessor */: - return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); + case 156 /* GetAccessor */: + return serializeTypeNode(getAccessorTypeNode(node)); case 238 /* ClassDeclaration */: case 207 /* ClassExpression */: case 154 /* MethodDeclaration */: @@ -76386,7 +76399,7 @@ var ts; } if (node.kind === 278 /* Bundle */) { isBundledEmit = true; - var refs_1 = ts.createMap(); + refs = ts.createMap(); var hasNoDefaultLib_1 = false; var bundle = ts.createBundle(ts.map(node.sourceFiles, function (sourceFile) { if (sourceFile.isDeclarationFile || ts.isSourceFileJavaScript(sourceFile)) @@ -76400,7 +76413,7 @@ var ts; getSymbolAccessibilityDiagnostic = throwDiagnostic; needsScopeFixMarker = false; resultHasScopeMarker = false; - collectReferences(sourceFile, refs_1); + collectReferences(sourceFile, refs); if (ts.isExternalModule(sourceFile)) { resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; @@ -76421,7 +76434,7 @@ var ts; bundle.hasNoDefaultLib = hasNoDefaultLib_1; var outputFilePath_1 = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, /*forceDtsPaths*/ true).declarationFilePath)); var referenceVisitor_1 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath_1); - refs_1.forEach(referenceVisitor_1); + refs.forEach(referenceVisitor_1); return bundle; } // Single source file @@ -77198,6 +77211,15 @@ var ts; } return false; } + function isScopeMarker(node) { + return ts.isExportAssignment(node) || ts.isExportDeclaration(node); + } + function hasScopeMarker(node) { + if (ts.isModuleBlock(node)) { + return ts.some(node.statements, isScopeMarker); + } + return false; + } function ensureModifiers(node, privateDeclaration) { var currentFlags = ts.getModifierFlags(node); var newFlags = ensureModifierFlags(node, privateDeclaration); @@ -77211,7 +77233,7 @@ var ts; var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* Ambient */ : 0 /* None */; var parentIsFile = node.parent.kind === 277 /* SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { - mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) ? 0 : 1 /* Export */) | 512 /* Default */ | 2 /* Ambient */); + mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) || hasScopeMarker(node.parent) ? 0 : 1 /* Export */) | 2 /* Ambient */); additions = 0 /* None */; } return maskModifierFlags(node, mask, additions); @@ -77270,6 +77292,11 @@ var ts; if (modifierMask === void 0) { modifierMask = 3071 /* All */ ^ 4 /* Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* None */; } var flags = (ts.getModifierFlags(node) & modifierMask) | modifierAdditions; + if (flags & 512 /* Default */ && !(flags & 1 /* Export */)) { + // A non-exported default is a nonsequitor - we usually try to remove all export modifiers + // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid + flags ^= 1 /* Export */; + } if (flags & 512 /* Default */ && flags & 2 /* Ambient */) { flags ^= 2 /* Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 9baa1bf240f..47c6a0a7aaf 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -33836,19 +33836,23 @@ var ts; return createAnonymousType(symbol, exports_1, ts.emptyArray, ts.emptyArray, jsObjectLiteralIndexInfo, undefined); } } - function getAnnotatedAccessorType(accessor) { + function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { if (accessor.kind === 156 /* GetAccessor */) { var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation && getTypeFromTypeNode(getterTypeAnnotation); + return getterTypeAnnotation; } else { var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation; } } return undefined; } + function getAnnotatedAccessorType(accessor) { + var node = getAnnotatedAccessorTypeNode(accessor); + return node && getTypeFromTypeNode(node); + } function getAnnotatedAccessorThisParameter(accessor) { var parameter = getAccessorThisParameter(accessor); return parameter && parameter.symbol; @@ -50634,9 +50638,13 @@ var ts; } } break; - case 154 /* MethodDeclaration */: case 156 /* GetAccessor */: case 157 /* SetAccessor */: + var otherKind = node.kind === 156 /* GetAccessor */ ? 157 /* SetAccessor */ : 156 /* GetAccessor */; + var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); + markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); + break; + case 154 /* MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); @@ -63967,6 +63975,11 @@ var ts; } return false; } + function getAccessorTypeNode(node) { + var accessors = resolver.getAllAccessorDeclarations(node); + return accessors.setAccessor && ts.getSetAccessorTypeAnnotationNode(accessors.setAccessor) + || accessors.getAccessor && ts.getEffectiveReturnTypeNode(accessors.getAccessor); + } /** * Serializes the type of a node for use with decorator type metadata. * @@ -63976,10 +63989,10 @@ var ts; switch (node.kind) { case 152 /* PropertyDeclaration */: case 149 /* Parameter */: - case 156 /* GetAccessor */: return serializeTypeNode(node.type); case 157 /* SetAccessor */: - return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); + case 156 /* GetAccessor */: + return serializeTypeNode(getAccessorTypeNode(node)); case 238 /* ClassDeclaration */: case 207 /* ClassExpression */: case 154 /* MethodDeclaration */: @@ -76373,7 +76386,7 @@ var ts; } if (node.kind === 278 /* Bundle */) { isBundledEmit = true; - var refs_1 = ts.createMap(); + refs = ts.createMap(); var hasNoDefaultLib_1 = false; var bundle = ts.createBundle(ts.map(node.sourceFiles, function (sourceFile) { if (sourceFile.isDeclarationFile || ts.isSourceFileJavaScript(sourceFile)) @@ -76387,7 +76400,7 @@ var ts; getSymbolAccessibilityDiagnostic = throwDiagnostic; needsScopeFixMarker = false; resultHasScopeMarker = false; - collectReferences(sourceFile, refs_1); + collectReferences(sourceFile, refs); if (ts.isExternalModule(sourceFile)) { resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; @@ -76408,7 +76421,7 @@ var ts; bundle.hasNoDefaultLib = hasNoDefaultLib_1; var outputFilePath_1 = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, /*forceDtsPaths*/ true).declarationFilePath)); var referenceVisitor_1 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath_1); - refs_1.forEach(referenceVisitor_1); + refs.forEach(referenceVisitor_1); return bundle; } // Single source file @@ -77185,6 +77198,15 @@ var ts; } return false; } + function isScopeMarker(node) { + return ts.isExportAssignment(node) || ts.isExportDeclaration(node); + } + function hasScopeMarker(node) { + if (ts.isModuleBlock(node)) { + return ts.some(node.statements, isScopeMarker); + } + return false; + } function ensureModifiers(node, privateDeclaration) { var currentFlags = ts.getModifierFlags(node); var newFlags = ensureModifierFlags(node, privateDeclaration); @@ -77198,7 +77220,7 @@ var ts; var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* Ambient */ : 0 /* None */; var parentIsFile = node.parent.kind === 277 /* SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { - mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) ? 0 : 1 /* Export */) | 512 /* Default */ | 2 /* Ambient */); + mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) || hasScopeMarker(node.parent) ? 0 : 1 /* Export */) | 2 /* Ambient */); additions = 0 /* None */; } return maskModifierFlags(node, mask, additions); @@ -77257,6 +77279,11 @@ var ts; if (modifierMask === void 0) { modifierMask = 3071 /* All */ ^ 4 /* Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* None */; } var flags = (ts.getModifierFlags(node) & modifierMask) | modifierAdditions; + if (flags & 512 /* Default */ && !(flags & 1 /* Export */)) { + // A non-exported default is a nonsequitor - we usually try to remove all export modifiers + // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid + flags ^= 1 /* Export */; + } if (flags & 512 /* Default */ && flags & 2 /* Ambient */) { flags ^= 2 /* Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } @@ -113800,8 +113827,8 @@ var ts; return undefined; } var result = []; - for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) { - var ref = refs_2[_i]; + for (var _i = 0, refs_1 = refs; _i < refs_1.length; _i++) { + var ref = refs_1[_i]; result.push({ path: ts.normalizeSlashes(ref.fileName), position: ref.pos, diff --git a/lib/typescript.js b/lib/typescript.js index b03617a8bf4..ffd4559dc01 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -33836,19 +33836,23 @@ var ts; return createAnonymousType(symbol, exports_1, ts.emptyArray, ts.emptyArray, jsObjectLiteralIndexInfo, undefined); } } - function getAnnotatedAccessorType(accessor) { + function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { if (accessor.kind === 156 /* GetAccessor */) { var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation && getTypeFromTypeNode(getterTypeAnnotation); + return getterTypeAnnotation; } else { var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation; } } return undefined; } + function getAnnotatedAccessorType(accessor) { + var node = getAnnotatedAccessorTypeNode(accessor); + return node && getTypeFromTypeNode(node); + } function getAnnotatedAccessorThisParameter(accessor) { var parameter = getAccessorThisParameter(accessor); return parameter && parameter.symbol; @@ -50634,9 +50638,13 @@ var ts; } } break; - case 154 /* MethodDeclaration */: case 156 /* GetAccessor */: case 157 /* SetAccessor */: + var otherKind = node.kind === 156 /* GetAccessor */ ? 157 /* SetAccessor */ : 156 /* GetAccessor */; + var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); + markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); + break; + case 154 /* MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); @@ -63967,6 +63975,11 @@ var ts; } return false; } + function getAccessorTypeNode(node) { + var accessors = resolver.getAllAccessorDeclarations(node); + return accessors.setAccessor && ts.getSetAccessorTypeAnnotationNode(accessors.setAccessor) + || accessors.getAccessor && ts.getEffectiveReturnTypeNode(accessors.getAccessor); + } /** * Serializes the type of a node for use with decorator type metadata. * @@ -63976,10 +63989,10 @@ var ts; switch (node.kind) { case 152 /* PropertyDeclaration */: case 149 /* Parameter */: - case 156 /* GetAccessor */: return serializeTypeNode(node.type); case 157 /* SetAccessor */: - return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); + case 156 /* GetAccessor */: + return serializeTypeNode(getAccessorTypeNode(node)); case 238 /* ClassDeclaration */: case 207 /* ClassExpression */: case 154 /* MethodDeclaration */: @@ -76373,7 +76386,7 @@ var ts; } if (node.kind === 278 /* Bundle */) { isBundledEmit = true; - var refs_1 = ts.createMap(); + refs = ts.createMap(); var hasNoDefaultLib_1 = false; var bundle = ts.createBundle(ts.map(node.sourceFiles, function (sourceFile) { if (sourceFile.isDeclarationFile || ts.isSourceFileJavaScript(sourceFile)) @@ -76387,7 +76400,7 @@ var ts; getSymbolAccessibilityDiagnostic = throwDiagnostic; needsScopeFixMarker = false; resultHasScopeMarker = false; - collectReferences(sourceFile, refs_1); + collectReferences(sourceFile, refs); if (ts.isExternalModule(sourceFile)) { resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; @@ -76408,7 +76421,7 @@ var ts; bundle.hasNoDefaultLib = hasNoDefaultLib_1; var outputFilePath_1 = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, /*forceDtsPaths*/ true).declarationFilePath)); var referenceVisitor_1 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath_1); - refs_1.forEach(referenceVisitor_1); + refs.forEach(referenceVisitor_1); return bundle; } // Single source file @@ -77185,6 +77198,15 @@ var ts; } return false; } + function isScopeMarker(node) { + return ts.isExportAssignment(node) || ts.isExportDeclaration(node); + } + function hasScopeMarker(node) { + if (ts.isModuleBlock(node)) { + return ts.some(node.statements, isScopeMarker); + } + return false; + } function ensureModifiers(node, privateDeclaration) { var currentFlags = ts.getModifierFlags(node); var newFlags = ensureModifierFlags(node, privateDeclaration); @@ -77198,7 +77220,7 @@ var ts; var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* Ambient */ : 0 /* None */; var parentIsFile = node.parent.kind === 277 /* SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { - mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) ? 0 : 1 /* Export */) | 512 /* Default */ | 2 /* Ambient */); + mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) || hasScopeMarker(node.parent) ? 0 : 1 /* Export */) | 2 /* Ambient */); additions = 0 /* None */; } return maskModifierFlags(node, mask, additions); @@ -77257,6 +77279,11 @@ var ts; if (modifierMask === void 0) { modifierMask = 3071 /* All */ ^ 4 /* Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* None */; } var flags = (ts.getModifierFlags(node) & modifierMask) | modifierAdditions; + if (flags & 512 /* Default */ && !(flags & 1 /* Export */)) { + // A non-exported default is a nonsequitor - we usually try to remove all export modifiers + // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid + flags ^= 1 /* Export */; + } if (flags & 512 /* Default */ && flags & 2 /* Ambient */) { flags ^= 2 /* Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } @@ -113800,8 +113827,8 @@ var ts; return undefined; } var result = []; - for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) { - var ref = refs_2[_i]; + for (var _i = 0, refs_1 = refs; _i < refs_1.length; _i++) { + var ref = refs_1[_i]; result.push({ path: ts.normalizeSlashes(ref.fileName), position: ref.pos, diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index b03617a8bf4..ffd4559dc01 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -33836,19 +33836,23 @@ var ts; return createAnonymousType(symbol, exports_1, ts.emptyArray, ts.emptyArray, jsObjectLiteralIndexInfo, undefined); } } - function getAnnotatedAccessorType(accessor) { + function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { if (accessor.kind === 156 /* GetAccessor */) { var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation && getTypeFromTypeNode(getterTypeAnnotation); + return getterTypeAnnotation; } else { var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation; } } return undefined; } + function getAnnotatedAccessorType(accessor) { + var node = getAnnotatedAccessorTypeNode(accessor); + return node && getTypeFromTypeNode(node); + } function getAnnotatedAccessorThisParameter(accessor) { var parameter = getAccessorThisParameter(accessor); return parameter && parameter.symbol; @@ -50634,9 +50638,13 @@ var ts; } } break; - case 154 /* MethodDeclaration */: case 156 /* GetAccessor */: case 157 /* SetAccessor */: + var otherKind = node.kind === 156 /* GetAccessor */ ? 157 /* SetAccessor */ : 156 /* GetAccessor */; + var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); + markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); + break; + case 154 /* MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); @@ -63967,6 +63975,11 @@ var ts; } return false; } + function getAccessorTypeNode(node) { + var accessors = resolver.getAllAccessorDeclarations(node); + return accessors.setAccessor && ts.getSetAccessorTypeAnnotationNode(accessors.setAccessor) + || accessors.getAccessor && ts.getEffectiveReturnTypeNode(accessors.getAccessor); + } /** * Serializes the type of a node for use with decorator type metadata. * @@ -63976,10 +63989,10 @@ var ts; switch (node.kind) { case 152 /* PropertyDeclaration */: case 149 /* Parameter */: - case 156 /* GetAccessor */: return serializeTypeNode(node.type); case 157 /* SetAccessor */: - return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); + case 156 /* GetAccessor */: + return serializeTypeNode(getAccessorTypeNode(node)); case 238 /* ClassDeclaration */: case 207 /* ClassExpression */: case 154 /* MethodDeclaration */: @@ -76373,7 +76386,7 @@ var ts; } if (node.kind === 278 /* Bundle */) { isBundledEmit = true; - var refs_1 = ts.createMap(); + refs = ts.createMap(); var hasNoDefaultLib_1 = false; var bundle = ts.createBundle(ts.map(node.sourceFiles, function (sourceFile) { if (sourceFile.isDeclarationFile || ts.isSourceFileJavaScript(sourceFile)) @@ -76387,7 +76400,7 @@ var ts; getSymbolAccessibilityDiagnostic = throwDiagnostic; needsScopeFixMarker = false; resultHasScopeMarker = false; - collectReferences(sourceFile, refs_1); + collectReferences(sourceFile, refs); if (ts.isExternalModule(sourceFile)) { resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; @@ -76408,7 +76421,7 @@ var ts; bundle.hasNoDefaultLib = hasNoDefaultLib_1; var outputFilePath_1 = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, /*forceDtsPaths*/ true).declarationFilePath)); var referenceVisitor_1 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath_1); - refs_1.forEach(referenceVisitor_1); + refs.forEach(referenceVisitor_1); return bundle; } // Single source file @@ -77185,6 +77198,15 @@ var ts; } return false; } + function isScopeMarker(node) { + return ts.isExportAssignment(node) || ts.isExportDeclaration(node); + } + function hasScopeMarker(node) { + if (ts.isModuleBlock(node)) { + return ts.some(node.statements, isScopeMarker); + } + return false; + } function ensureModifiers(node, privateDeclaration) { var currentFlags = ts.getModifierFlags(node); var newFlags = ensureModifierFlags(node, privateDeclaration); @@ -77198,7 +77220,7 @@ var ts; var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* Ambient */ : 0 /* None */; var parentIsFile = node.parent.kind === 277 /* SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { - mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) ? 0 : 1 /* Export */) | 512 /* Default */ | 2 /* Ambient */); + mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) || hasScopeMarker(node.parent) ? 0 : 1 /* Export */) | 2 /* Ambient */); additions = 0 /* None */; } return maskModifierFlags(node, mask, additions); @@ -77257,6 +77279,11 @@ var ts; if (modifierMask === void 0) { modifierMask = 3071 /* All */ ^ 4 /* Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* None */; } var flags = (ts.getModifierFlags(node) & modifierMask) | modifierAdditions; + if (flags & 512 /* Default */ && !(flags & 1 /* Export */)) { + // A non-exported default is a nonsequitor - we usually try to remove all export modifiers + // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid + flags ^= 1 /* Export */; + } if (flags & 512 /* Default */ && flags & 2 /* Ambient */) { flags ^= 2 /* Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } @@ -113800,8 +113827,8 @@ var ts; return undefined; } var result = []; - for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) { - var ref = refs_2[_i]; + for (var _i = 0, refs_1 = refs; _i < refs_1.length; _i++) { + var ref = refs_1[_i]; result.push({ path: ts.normalizeSlashes(ref.fileName), position: ref.pos, diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index a6c148813da..930576fb7e7 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -33849,19 +33849,23 @@ var ts; return createAnonymousType(symbol, exports_1, ts.emptyArray, ts.emptyArray, jsObjectLiteralIndexInfo, undefined); } } - function getAnnotatedAccessorType(accessor) { + function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { if (accessor.kind === 156 /* GetAccessor */) { var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation && getTypeFromTypeNode(getterTypeAnnotation); + return getterTypeAnnotation; } else { var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + return setterTypeAnnotation; } } return undefined; } + function getAnnotatedAccessorType(accessor) { + var node = getAnnotatedAccessorTypeNode(accessor); + return node && getTypeFromTypeNode(node); + } function getAnnotatedAccessorThisParameter(accessor) { var parameter = getAccessorThisParameter(accessor); return parameter && parameter.symbol; @@ -50647,9 +50651,13 @@ var ts; } } break; - case 154 /* MethodDeclaration */: case 156 /* GetAccessor */: case 157 /* SetAccessor */: + var otherKind = node.kind === 156 /* GetAccessor */ ? 157 /* SetAccessor */ : 156 /* GetAccessor */; + var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); + markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); + break; + case 154 /* MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); @@ -63980,6 +63988,11 @@ var ts; } return false; } + function getAccessorTypeNode(node) { + var accessors = resolver.getAllAccessorDeclarations(node); + return accessors.setAccessor && ts.getSetAccessorTypeAnnotationNode(accessors.setAccessor) + || accessors.getAccessor && ts.getEffectiveReturnTypeNode(accessors.getAccessor); + } /** * Serializes the type of a node for use with decorator type metadata. * @@ -63989,10 +64002,10 @@ var ts; switch (node.kind) { case 152 /* PropertyDeclaration */: case 149 /* Parameter */: - case 156 /* GetAccessor */: return serializeTypeNode(node.type); case 157 /* SetAccessor */: - return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); + case 156 /* GetAccessor */: + return serializeTypeNode(getAccessorTypeNode(node)); case 238 /* ClassDeclaration */: case 207 /* ClassExpression */: case 154 /* MethodDeclaration */: @@ -76386,7 +76399,7 @@ var ts; } if (node.kind === 278 /* Bundle */) { isBundledEmit = true; - var refs_1 = ts.createMap(); + refs = ts.createMap(); var hasNoDefaultLib_1 = false; var bundle = ts.createBundle(ts.map(node.sourceFiles, function (sourceFile) { if (sourceFile.isDeclarationFile || ts.isSourceFileJavaScript(sourceFile)) @@ -76400,7 +76413,7 @@ var ts; getSymbolAccessibilityDiagnostic = throwDiagnostic; needsScopeFixMarker = false; resultHasScopeMarker = false; - collectReferences(sourceFile, refs_1); + collectReferences(sourceFile, refs); if (ts.isExternalModule(sourceFile)) { resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; @@ -76421,7 +76434,7 @@ var ts; bundle.hasNoDefaultLib = hasNoDefaultLib_1; var outputFilePath_1 = ts.getDirectoryPath(ts.normalizeSlashes(ts.getOutputPathsFor(node, host, /*forceDtsPaths*/ true).declarationFilePath)); var referenceVisitor_1 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath_1); - refs_1.forEach(referenceVisitor_1); + refs.forEach(referenceVisitor_1); return bundle; } // Single source file @@ -77198,6 +77211,15 @@ var ts; } return false; } + function isScopeMarker(node) { + return ts.isExportAssignment(node) || ts.isExportDeclaration(node); + } + function hasScopeMarker(node) { + if (ts.isModuleBlock(node)) { + return ts.some(node.statements, isScopeMarker); + } + return false; + } function ensureModifiers(node, privateDeclaration) { var currentFlags = ts.getModifierFlags(node); var newFlags = ensureModifierFlags(node, privateDeclaration); @@ -77211,7 +77233,7 @@ var ts; var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* Ambient */ : 0 /* None */; var parentIsFile = node.parent.kind === 277 /* SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { - mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) ? 0 : 1 /* Export */) | 512 /* Default */ | 2 /* Ambient */); + mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) || hasScopeMarker(node.parent) ? 0 : 1 /* Export */) | 2 /* Ambient */); additions = 0 /* None */; } return maskModifierFlags(node, mask, additions); @@ -77270,6 +77292,11 @@ var ts; if (modifierMask === void 0) { modifierMask = 3071 /* All */ ^ 4 /* Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* None */; } var flags = (ts.getModifierFlags(node) & modifierMask) | modifierAdditions; + if (flags & 512 /* Default */ && !(flags & 1 /* Export */)) { + // A non-exported default is a nonsequitor - we usually try to remove all export modifiers + // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid + flags ^= 1 /* Export */; + } if (flags & 512 /* Default */ && flags & 2 /* Ambient */) { flags ^= 2 /* Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } From 1f30a03f3c19533ff6c9bc03620e215c692205ab Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 17 Aug 2018 14:08:59 -0700 Subject: [PATCH 3/8] Update core.ts patch version number --- src/compiler/core.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index ea15ace7d73..d4ba1d8fb3b 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -3,7 +3,7 @@ namespace ts { // If changing the text in this section, be sure to test `configureNightly` too. export const versionMajorMinor = "3.0"; /** The version of the TypeScript compiler release */ - export const version = `${versionMajorMinor}.1`; + export const version = `${versionMajorMinor}.2`; } namespace ts { From 5bec7e1c560bd5a3781f9f5404dec44b531488af Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 17 Aug 2018 14:10:51 -0700 Subject: [PATCH 4/8] Re-update LKG --- lib/tsc.js | 2 +- lib/tsserver.js | 2 +- lib/tsserverlibrary.js | 2 +- lib/typescript.js | 2 +- lib/typescriptServices.js | 2 +- lib/typingsInstaller.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index b9fd54df617..bdc44d6a94e 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -60,7 +60,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook var ts; (function (ts) { ts.versionMajorMinor = "3.0"; - ts.version = ts.versionMajorMinor + ".1"; + ts.version = ts.versionMajorMinor + ".2"; })(ts || (ts = {})); (function (ts) { function createDictionaryObject() { diff --git a/lib/tsserver.js b/lib/tsserver.js index f5a945ff945..5bd4d19f13e 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -88,7 +88,7 @@ var ts; // If changing the text in this section, be sure to test `configureNightly` too. ts.versionMajorMinor = "3.0"; /** The version of the TypeScript compiler release */ - ts.version = ts.versionMajorMinor + ".1"; + ts.version = ts.versionMajorMinor + ".2"; })(ts || (ts = {})); (function (ts) { /* @internal */ diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 47c6a0a7aaf..dc12972e062 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -75,7 +75,7 @@ var ts; // If changing the text in this section, be sure to test `configureNightly` too. ts.versionMajorMinor = "3.0"; /** The version of the TypeScript compiler release */ - ts.version = ts.versionMajorMinor + ".1"; + ts.version = ts.versionMajorMinor + ".2"; })(ts || (ts = {})); (function (ts) { /* @internal */ diff --git a/lib/typescript.js b/lib/typescript.js index ffd4559dc01..50814f734ba 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -75,7 +75,7 @@ var ts; // If changing the text in this section, be sure to test `configureNightly` too. ts.versionMajorMinor = "3.0"; /** The version of the TypeScript compiler release */ - ts.version = ts.versionMajorMinor + ".1"; + ts.version = ts.versionMajorMinor + ".2"; })(ts || (ts = {})); (function (ts) { /* @internal */ diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index ffd4559dc01..50814f734ba 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -75,7 +75,7 @@ var ts; // If changing the text in this section, be sure to test `configureNightly` too. ts.versionMajorMinor = "3.0"; /** The version of the TypeScript compiler release */ - ts.version = ts.versionMajorMinor + ".1"; + ts.version = ts.versionMajorMinor + ".2"; })(ts || (ts = {})); (function (ts) { /* @internal */ diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 930576fb7e7..b0374bf2454 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -88,7 +88,7 @@ var ts; // If changing the text in this section, be sure to test `configureNightly` too. ts.versionMajorMinor = "3.0"; /** The version of the TypeScript compiler release */ - ts.version = ts.versionMajorMinor + ".1"; + ts.version = ts.versionMajorMinor + ".2"; })(ts || (ts = {})); (function (ts) { /* @internal */ From 01bd57e9863a728b47dd9e1223330a0090db0a51 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 17 Aug 2018 14:31:38 -0700 Subject: [PATCH 5/8] Add internal to tsbuild --- lib/tsserver.js | 1 + lib/tsserverlibrary.d.ts | 182 ------------------------------------ lib/tsserverlibrary.js | 1 + lib/typescript.d.ts | 182 ------------------------------------ lib/typescript.js | 1 + lib/typescriptServices.d.ts | 182 ------------------------------------ lib/typescriptServices.js | 1 + lib/typingsInstaller.js | 1 + src/compiler/tsbuild.ts | 1 + src/compiler/types.ts | 1 + 10 files changed, 7 insertions(+), 546 deletions(-) diff --git a/lib/tsserver.js b/lib/tsserver.js index 5bd4d19f13e..3f9dc40a2c8 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -86939,6 +86939,7 @@ var ts; } ts.createWatchProgram = createWatchProgram; })(ts || (ts = {})); +/* @internal */ var ts; (function (ts) { var minimumDate = new Date(-8640000000000000); diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index 4b9c0307810..b16026b18a8 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -2579,14 +2579,6 @@ declare namespace ts { oldProgram?: Program; configFileParsingDiagnostics?: ReadonlyArray; } - interface UpToDateHost { - fileExists(fileName: string): boolean; - getModifiedTime(fileName: string): Date; - getUnchangedTime?(fileName: string): Date | undefined; - getLastStatus?(fileName: string): UpToDateStatus | undefined; - setLastStatus?(fileName: string, status: UpToDateStatus): void; - parseConfigFile?(configFilePath: ResolvedConfigFileName): ParsedCommandLine | undefined; - } interface ModuleResolutionHost { fileExists(fileName: string): boolean; readFile(fileName: string): string | undefined; @@ -4406,180 +4398,6 @@ declare namespace ts { */ function createWatchProgram(host: WatchCompilerHostOfConfigFile): WatchOfConfigFile; } -declare namespace ts { - interface BuildHost { - verbose(diag: DiagnosticMessage, ...args: string[]): void; - error(diag: DiagnosticMessage, ...args: string[]): void; - errorDiagnostic(diag: Diagnostic): void; - message(diag: DiagnosticMessage, ...args: string[]): void; - } - /** - * A BuildContext tracks what's going on during the course of a build. - * - * Callers may invoke any number of build requests within the same context; - * until the context is reset, each project will only be built at most once. - * - * Example: In a standard setup where project B depends on project A, and both are out of date, - * a failed build of A will result in A remaining out of date. When we try to build - * B, we should immediately bail instead of recomputing A's up-to-date status again. - * - * This also matters for performing fast (i.e. fake) downstream builds of projects - * when their upstream .d.ts files haven't changed content (but have newer timestamps) - */ - interface BuildContext { - options: BuildOptions; - /** - * Map from output file name to its pre-build timestamp - */ - unchangedOutputs: FileMap; - /** - * Map from config file name to up-to-date status - */ - projectStatus: FileMap; - invalidatedProjects: FileMap; - queuedProjects: FileMap; - missingRoots: Map; - } - type Mapper = ReturnType; - interface DependencyGraph { - buildQueue: ResolvedConfigFileName[]; - dependencyMap: Mapper; - } - interface BuildOptions { - dry: boolean; - force: boolean; - verbose: boolean; - } - enum UpToDateStatusType { - Unbuildable = 0, - UpToDate = 1, - /** - * The project appears out of date because its upstream inputs are newer than its outputs, - * but all of its outputs are actually newer than the previous identical outputs of its (.d.ts) inputs. - * This means we can Pseudo-build (just touch timestamps), as if we had actually built this project. - */ - UpToDateWithUpstreamTypes = 2, - OutputMissing = 3, - OutOfDateWithSelf = 4, - OutOfDateWithUpstream = 5, - UpstreamOutOfDate = 6, - UpstreamBlocked = 7, - /** - * Projects with no outputs (i.e. "solution" files) - */ - ContainerOnly = 8 - } - type UpToDateStatus = Status.Unbuildable | Status.UpToDate | Status.OutputMissing | Status.OutOfDateWithSelf | Status.OutOfDateWithUpstream | Status.UpstreamOutOfDate | Status.UpstreamBlocked | Status.ContainerOnly; - namespace Status { - /** - * The project can't be built at all in its current state. For example, - * its config file cannot be parsed, or it has a syntax error or missing file - */ - interface Unbuildable { - type: UpToDateStatusType.Unbuildable; - reason: string; - } - /** - * This project doesn't have any outputs, so "is it up to date" is a meaningless question. - */ - interface ContainerOnly { - type: UpToDateStatusType.ContainerOnly; - } - /** - * The project is up to date with respect to its inputs. - * We track what the newest input file is. - */ - interface UpToDate { - type: UpToDateStatusType.UpToDate | UpToDateStatusType.UpToDateWithUpstreamTypes; - newestInputFileTime?: Date; - newestInputFileName?: string; - newestDeclarationFileContentChangedTime?: Date; - newestOutputFileTime?: Date; - newestOutputFileName?: string; - oldestOutputFileName?: string; - } - /** - * One or more of the outputs of the project does not exist. - */ - interface OutputMissing { - type: UpToDateStatusType.OutputMissing; - /** - * The name of the first output file that didn't exist - */ - missingOutputFileName: string; - } - /** - * One or more of the project's outputs is older than its newest input. - */ - interface OutOfDateWithSelf { - type: UpToDateStatusType.OutOfDateWithSelf; - outOfDateOutputFileName: string; - newerInputFileName: string; - } - /** - * This project depends on an out-of-date project, so shouldn't be built yet - */ - interface UpstreamOutOfDate { - type: UpToDateStatusType.UpstreamOutOfDate; - upstreamProjectName: string; - } - /** - * This project depends an upstream project with build errors - */ - interface UpstreamBlocked { - type: UpToDateStatusType.UpstreamBlocked; - upstreamProjectName: string; - } - /** - * One or more of the project's outputs is older than the newest output of - * an upstream project. - */ - interface OutOfDateWithUpstream { - type: UpToDateStatusType.OutOfDateWithUpstream; - outOfDateOutputFileName: string; - newerProjectName: string; - } - } - interface FileMap { - setValue(fileName: string, value: T): void; - getValue(fileName: string): T | never; - getValueOrUndefined(fileName: string): T | undefined; - hasKey(fileName: string): boolean; - removeKey(fileName: string): void; - getKeys(): string[]; - } - function createDependencyMapper(): { - addReference: (childConfigFileName: ResolvedConfigFileName, parentConfigFileName: ResolvedConfigFileName) => void; - getReferencesTo: (parentConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[]; - getReferencesOf: (childConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[]; - getKeys: () => ReadonlyArray; - }; - function createBuildContext(options: BuildOptions): BuildContext; - function performBuild(args: string[], compilerHost: CompilerHost, buildHost: BuildHost, system?: System): number | undefined; - /** - * A SolutionBuilder has an immutable set of rootNames that are the "entry point" projects, but - * can dynamically add/remove other projects based on changes on the rootNames' references - */ - function createSolutionBuilder(compilerHost: CompilerHost, buildHost: BuildHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions, system?: System): { - buildAllProjects: () => ExitStatus; - getUpToDateStatus: (project: ParsedCommandLine | undefined) => UpToDateStatus; - getUpToDateStatusOfFile: (configFileName: ResolvedConfigFileName) => UpToDateStatus; - cleanAllProjects: () => ExitStatus.Success | ExitStatus.DiagnosticsPresent_OutputsSkipped; - resetBuildContext: (opts?: BuildOptions) => void; - getBuildGraph: (configFileNames: ReadonlyArray) => DependencyGraph | undefined; - invalidateProject: (configFileName: string) => void; - buildInvalidatedProjects: () => void; - buildDependentInvalidatedProjects: () => void; - resolveProjectName: (name: string) => ResolvedConfigFileName | undefined; - startWatching: () => void; - }; - /** - * Gets the UpToDateStatus for a project - */ - function getUpToDateStatus(host: UpToDateHost, project: ParsedCommandLine | undefined): UpToDateStatus; - function getAllProjectOutputs(project: ParsedCommandLine): ReadonlyArray; - function formatUpToDateStatus(configFileName: string, status: UpToDateStatus, relName: (fileName: string) => string, formatMessage: (message: DiagnosticMessage, ...args: string[]) => T): T | undefined; -} declare namespace ts.server { type ActionSet = "action::set"; type ActionInvalidate = "action::invalidate"; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index dc12972e062..7f18dd84548 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -86926,6 +86926,7 @@ var ts; } ts.createWatchProgram = createWatchProgram; })(ts || (ts = {})); +/* @internal */ var ts; (function (ts) { var minimumDate = new Date(-8640000000000000); diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 4a792a34763..bb03f59ceb8 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -2579,14 +2579,6 @@ declare namespace ts { oldProgram?: Program; configFileParsingDiagnostics?: ReadonlyArray; } - interface UpToDateHost { - fileExists(fileName: string): boolean; - getModifiedTime(fileName: string): Date; - getUnchangedTime?(fileName: string): Date | undefined; - getLastStatus?(fileName: string): UpToDateStatus | undefined; - setLastStatus?(fileName: string, status: UpToDateStatus): void; - parseConfigFile?(configFilePath: ResolvedConfigFileName): ParsedCommandLine | undefined; - } interface ModuleResolutionHost { fileExists(fileName: string): boolean; readFile(fileName: string): string | undefined; @@ -4406,180 +4398,6 @@ declare namespace ts { */ function createWatchProgram(host: WatchCompilerHostOfConfigFile): WatchOfConfigFile; } -declare namespace ts { - interface BuildHost { - verbose(diag: DiagnosticMessage, ...args: string[]): void; - error(diag: DiagnosticMessage, ...args: string[]): void; - errorDiagnostic(diag: Diagnostic): void; - message(diag: DiagnosticMessage, ...args: string[]): void; - } - /** - * A BuildContext tracks what's going on during the course of a build. - * - * Callers may invoke any number of build requests within the same context; - * until the context is reset, each project will only be built at most once. - * - * Example: In a standard setup where project B depends on project A, and both are out of date, - * a failed build of A will result in A remaining out of date. When we try to build - * B, we should immediately bail instead of recomputing A's up-to-date status again. - * - * This also matters for performing fast (i.e. fake) downstream builds of projects - * when their upstream .d.ts files haven't changed content (but have newer timestamps) - */ - interface BuildContext { - options: BuildOptions; - /** - * Map from output file name to its pre-build timestamp - */ - unchangedOutputs: FileMap; - /** - * Map from config file name to up-to-date status - */ - projectStatus: FileMap; - invalidatedProjects: FileMap; - queuedProjects: FileMap; - missingRoots: Map; - } - type Mapper = ReturnType; - interface DependencyGraph { - buildQueue: ResolvedConfigFileName[]; - dependencyMap: Mapper; - } - interface BuildOptions { - dry: boolean; - force: boolean; - verbose: boolean; - } - enum UpToDateStatusType { - Unbuildable = 0, - UpToDate = 1, - /** - * The project appears out of date because its upstream inputs are newer than its outputs, - * but all of its outputs are actually newer than the previous identical outputs of its (.d.ts) inputs. - * This means we can Pseudo-build (just touch timestamps), as if we had actually built this project. - */ - UpToDateWithUpstreamTypes = 2, - OutputMissing = 3, - OutOfDateWithSelf = 4, - OutOfDateWithUpstream = 5, - UpstreamOutOfDate = 6, - UpstreamBlocked = 7, - /** - * Projects with no outputs (i.e. "solution" files) - */ - ContainerOnly = 8 - } - type UpToDateStatus = Status.Unbuildable | Status.UpToDate | Status.OutputMissing | Status.OutOfDateWithSelf | Status.OutOfDateWithUpstream | Status.UpstreamOutOfDate | Status.UpstreamBlocked | Status.ContainerOnly; - namespace Status { - /** - * The project can't be built at all in its current state. For example, - * its config file cannot be parsed, or it has a syntax error or missing file - */ - interface Unbuildable { - type: UpToDateStatusType.Unbuildable; - reason: string; - } - /** - * This project doesn't have any outputs, so "is it up to date" is a meaningless question. - */ - interface ContainerOnly { - type: UpToDateStatusType.ContainerOnly; - } - /** - * The project is up to date with respect to its inputs. - * We track what the newest input file is. - */ - interface UpToDate { - type: UpToDateStatusType.UpToDate | UpToDateStatusType.UpToDateWithUpstreamTypes; - newestInputFileTime?: Date; - newestInputFileName?: string; - newestDeclarationFileContentChangedTime?: Date; - newestOutputFileTime?: Date; - newestOutputFileName?: string; - oldestOutputFileName?: string; - } - /** - * One or more of the outputs of the project does not exist. - */ - interface OutputMissing { - type: UpToDateStatusType.OutputMissing; - /** - * The name of the first output file that didn't exist - */ - missingOutputFileName: string; - } - /** - * One or more of the project's outputs is older than its newest input. - */ - interface OutOfDateWithSelf { - type: UpToDateStatusType.OutOfDateWithSelf; - outOfDateOutputFileName: string; - newerInputFileName: string; - } - /** - * This project depends on an out-of-date project, so shouldn't be built yet - */ - interface UpstreamOutOfDate { - type: UpToDateStatusType.UpstreamOutOfDate; - upstreamProjectName: string; - } - /** - * This project depends an upstream project with build errors - */ - interface UpstreamBlocked { - type: UpToDateStatusType.UpstreamBlocked; - upstreamProjectName: string; - } - /** - * One or more of the project's outputs is older than the newest output of - * an upstream project. - */ - interface OutOfDateWithUpstream { - type: UpToDateStatusType.OutOfDateWithUpstream; - outOfDateOutputFileName: string; - newerProjectName: string; - } - } - interface FileMap { - setValue(fileName: string, value: T): void; - getValue(fileName: string): T | never; - getValueOrUndefined(fileName: string): T | undefined; - hasKey(fileName: string): boolean; - removeKey(fileName: string): void; - getKeys(): string[]; - } - function createDependencyMapper(): { - addReference: (childConfigFileName: ResolvedConfigFileName, parentConfigFileName: ResolvedConfigFileName) => void; - getReferencesTo: (parentConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[]; - getReferencesOf: (childConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[]; - getKeys: () => ReadonlyArray; - }; - function createBuildContext(options: BuildOptions): BuildContext; - function performBuild(args: string[], compilerHost: CompilerHost, buildHost: BuildHost, system?: System): number | undefined; - /** - * A SolutionBuilder has an immutable set of rootNames that are the "entry point" projects, but - * can dynamically add/remove other projects based on changes on the rootNames' references - */ - function createSolutionBuilder(compilerHost: CompilerHost, buildHost: BuildHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions, system?: System): { - buildAllProjects: () => ExitStatus; - getUpToDateStatus: (project: ParsedCommandLine | undefined) => UpToDateStatus; - getUpToDateStatusOfFile: (configFileName: ResolvedConfigFileName) => UpToDateStatus; - cleanAllProjects: () => ExitStatus.Success | ExitStatus.DiagnosticsPresent_OutputsSkipped; - resetBuildContext: (opts?: BuildOptions) => void; - getBuildGraph: (configFileNames: ReadonlyArray) => DependencyGraph | undefined; - invalidateProject: (configFileName: string) => void; - buildInvalidatedProjects: () => void; - buildDependentInvalidatedProjects: () => void; - resolveProjectName: (name: string) => ResolvedConfigFileName | undefined; - startWatching: () => void; - }; - /** - * Gets the UpToDateStatus for a project - */ - function getUpToDateStatus(host: UpToDateHost, project: ParsedCommandLine | undefined): UpToDateStatus; - function getAllProjectOutputs(project: ParsedCommandLine): ReadonlyArray; - function formatUpToDateStatus(configFileName: string, status: UpToDateStatus, relName: (fileName: string) => string, formatMessage: (message: DiagnosticMessage, ...args: string[]) => T): T | undefined; -} declare namespace ts.server { type ActionSet = "action::set"; type ActionInvalidate = "action::invalidate"; diff --git a/lib/typescript.js b/lib/typescript.js index 50814f734ba..262cec45a9d 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -86926,6 +86926,7 @@ var ts; } ts.createWatchProgram = createWatchProgram; })(ts || (ts = {})); +/* @internal */ var ts; (function (ts) { var minimumDate = new Date(-8640000000000000); diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 108c8efb240..1a135690baa 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -2579,14 +2579,6 @@ declare namespace ts { oldProgram?: Program; configFileParsingDiagnostics?: ReadonlyArray; } - interface UpToDateHost { - fileExists(fileName: string): boolean; - getModifiedTime(fileName: string): Date; - getUnchangedTime?(fileName: string): Date | undefined; - getLastStatus?(fileName: string): UpToDateStatus | undefined; - setLastStatus?(fileName: string, status: UpToDateStatus): void; - parseConfigFile?(configFilePath: ResolvedConfigFileName): ParsedCommandLine | undefined; - } interface ModuleResolutionHost { fileExists(fileName: string): boolean; readFile(fileName: string): string | undefined; @@ -4406,180 +4398,6 @@ declare namespace ts { */ function createWatchProgram(host: WatchCompilerHostOfConfigFile): WatchOfConfigFile; } -declare namespace ts { - interface BuildHost { - verbose(diag: DiagnosticMessage, ...args: string[]): void; - error(diag: DiagnosticMessage, ...args: string[]): void; - errorDiagnostic(diag: Diagnostic): void; - message(diag: DiagnosticMessage, ...args: string[]): void; - } - /** - * A BuildContext tracks what's going on during the course of a build. - * - * Callers may invoke any number of build requests within the same context; - * until the context is reset, each project will only be built at most once. - * - * Example: In a standard setup where project B depends on project A, and both are out of date, - * a failed build of A will result in A remaining out of date. When we try to build - * B, we should immediately bail instead of recomputing A's up-to-date status again. - * - * This also matters for performing fast (i.e. fake) downstream builds of projects - * when their upstream .d.ts files haven't changed content (but have newer timestamps) - */ - interface BuildContext { - options: BuildOptions; - /** - * Map from output file name to its pre-build timestamp - */ - unchangedOutputs: FileMap; - /** - * Map from config file name to up-to-date status - */ - projectStatus: FileMap; - invalidatedProjects: FileMap; - queuedProjects: FileMap; - missingRoots: Map; - } - type Mapper = ReturnType; - interface DependencyGraph { - buildQueue: ResolvedConfigFileName[]; - dependencyMap: Mapper; - } - interface BuildOptions { - dry: boolean; - force: boolean; - verbose: boolean; - } - enum UpToDateStatusType { - Unbuildable = 0, - UpToDate = 1, - /** - * The project appears out of date because its upstream inputs are newer than its outputs, - * but all of its outputs are actually newer than the previous identical outputs of its (.d.ts) inputs. - * This means we can Pseudo-build (just touch timestamps), as if we had actually built this project. - */ - UpToDateWithUpstreamTypes = 2, - OutputMissing = 3, - OutOfDateWithSelf = 4, - OutOfDateWithUpstream = 5, - UpstreamOutOfDate = 6, - UpstreamBlocked = 7, - /** - * Projects with no outputs (i.e. "solution" files) - */ - ContainerOnly = 8 - } - type UpToDateStatus = Status.Unbuildable | Status.UpToDate | Status.OutputMissing | Status.OutOfDateWithSelf | Status.OutOfDateWithUpstream | Status.UpstreamOutOfDate | Status.UpstreamBlocked | Status.ContainerOnly; - namespace Status { - /** - * The project can't be built at all in its current state. For example, - * its config file cannot be parsed, or it has a syntax error or missing file - */ - interface Unbuildable { - type: UpToDateStatusType.Unbuildable; - reason: string; - } - /** - * This project doesn't have any outputs, so "is it up to date" is a meaningless question. - */ - interface ContainerOnly { - type: UpToDateStatusType.ContainerOnly; - } - /** - * The project is up to date with respect to its inputs. - * We track what the newest input file is. - */ - interface UpToDate { - type: UpToDateStatusType.UpToDate | UpToDateStatusType.UpToDateWithUpstreamTypes; - newestInputFileTime?: Date; - newestInputFileName?: string; - newestDeclarationFileContentChangedTime?: Date; - newestOutputFileTime?: Date; - newestOutputFileName?: string; - oldestOutputFileName?: string; - } - /** - * One or more of the outputs of the project does not exist. - */ - interface OutputMissing { - type: UpToDateStatusType.OutputMissing; - /** - * The name of the first output file that didn't exist - */ - missingOutputFileName: string; - } - /** - * One or more of the project's outputs is older than its newest input. - */ - interface OutOfDateWithSelf { - type: UpToDateStatusType.OutOfDateWithSelf; - outOfDateOutputFileName: string; - newerInputFileName: string; - } - /** - * This project depends on an out-of-date project, so shouldn't be built yet - */ - interface UpstreamOutOfDate { - type: UpToDateStatusType.UpstreamOutOfDate; - upstreamProjectName: string; - } - /** - * This project depends an upstream project with build errors - */ - interface UpstreamBlocked { - type: UpToDateStatusType.UpstreamBlocked; - upstreamProjectName: string; - } - /** - * One or more of the project's outputs is older than the newest output of - * an upstream project. - */ - interface OutOfDateWithUpstream { - type: UpToDateStatusType.OutOfDateWithUpstream; - outOfDateOutputFileName: string; - newerProjectName: string; - } - } - interface FileMap { - setValue(fileName: string, value: T): void; - getValue(fileName: string): T | never; - getValueOrUndefined(fileName: string): T | undefined; - hasKey(fileName: string): boolean; - removeKey(fileName: string): void; - getKeys(): string[]; - } - function createDependencyMapper(): { - addReference: (childConfigFileName: ResolvedConfigFileName, parentConfigFileName: ResolvedConfigFileName) => void; - getReferencesTo: (parentConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[]; - getReferencesOf: (childConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[]; - getKeys: () => ReadonlyArray; - }; - function createBuildContext(options: BuildOptions): BuildContext; - function performBuild(args: string[], compilerHost: CompilerHost, buildHost: BuildHost, system?: System): number | undefined; - /** - * A SolutionBuilder has an immutable set of rootNames that are the "entry point" projects, but - * can dynamically add/remove other projects based on changes on the rootNames' references - */ - function createSolutionBuilder(compilerHost: CompilerHost, buildHost: BuildHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions, system?: System): { - buildAllProjects: () => ExitStatus; - getUpToDateStatus: (project: ParsedCommandLine | undefined) => UpToDateStatus; - getUpToDateStatusOfFile: (configFileName: ResolvedConfigFileName) => UpToDateStatus; - cleanAllProjects: () => ExitStatus.Success | ExitStatus.DiagnosticsPresent_OutputsSkipped; - resetBuildContext: (opts?: BuildOptions) => void; - getBuildGraph: (configFileNames: ReadonlyArray) => DependencyGraph | undefined; - invalidateProject: (configFileName: string) => void; - buildInvalidatedProjects: () => void; - buildDependentInvalidatedProjects: () => void; - resolveProjectName: (name: string) => ResolvedConfigFileName | undefined; - startWatching: () => void; - }; - /** - * Gets the UpToDateStatus for a project - */ - function getUpToDateStatus(host: UpToDateHost, project: ParsedCommandLine | undefined): UpToDateStatus; - function getAllProjectOutputs(project: ParsedCommandLine): ReadonlyArray; - function formatUpToDateStatus(configFileName: string, status: UpToDateStatus, relName: (fileName: string) => string, formatMessage: (message: DiagnosticMessage, ...args: string[]) => T): T | undefined; -} declare namespace ts.server { type ActionSet = "action::set"; type ActionInvalidate = "action::invalidate"; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 50814f734ba..262cec45a9d 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -86926,6 +86926,7 @@ var ts; } ts.createWatchProgram = createWatchProgram; })(ts || (ts = {})); +/* @internal */ var ts; (function (ts) { var minimumDate = new Date(-8640000000000000); diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index b0374bf2454..12443179a3c 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -86939,6 +86939,7 @@ var ts; } ts.createWatchProgram = createWatchProgram; })(ts || (ts = {})); +/* @internal */ var ts; (function (ts) { var minimumDate = new Date(-8640000000000000); diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 5c9c7086db8..169da87c7db 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -1,3 +1,4 @@ +/* @internal */ namespace ts { const minimumDate = new Date(-8640000000000000); const maximumDate = new Date(8640000000000000); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 9f8dfb6546a..13f94c5546f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4680,6 +4680,7 @@ namespace ts { verticalTab = 0x0B, // \v } + /* @internal */ export interface UpToDateHost { fileExists(fileName: string): boolean; getModifiedTime(fileName: string): Date; From 6cc4b795aaf1a72423ebc883342e51a64c0b8829 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 17 Aug 2018 14:48:05 -0700 Subject: [PATCH 6/8] Update baselines --- .../reference/api/tsserverlibrary.d.ts | 182 ------------------ tests/baselines/reference/api/typescript.d.ts | 182 ------------------ 2 files changed, 364 deletions(-) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 4b9c0307810..b16026b18a8 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2579,14 +2579,6 @@ declare namespace ts { oldProgram?: Program; configFileParsingDiagnostics?: ReadonlyArray; } - interface UpToDateHost { - fileExists(fileName: string): boolean; - getModifiedTime(fileName: string): Date; - getUnchangedTime?(fileName: string): Date | undefined; - getLastStatus?(fileName: string): UpToDateStatus | undefined; - setLastStatus?(fileName: string, status: UpToDateStatus): void; - parseConfigFile?(configFilePath: ResolvedConfigFileName): ParsedCommandLine | undefined; - } interface ModuleResolutionHost { fileExists(fileName: string): boolean; readFile(fileName: string): string | undefined; @@ -4406,180 +4398,6 @@ declare namespace ts { */ function createWatchProgram(host: WatchCompilerHostOfConfigFile): WatchOfConfigFile; } -declare namespace ts { - interface BuildHost { - verbose(diag: DiagnosticMessage, ...args: string[]): void; - error(diag: DiagnosticMessage, ...args: string[]): void; - errorDiagnostic(diag: Diagnostic): void; - message(diag: DiagnosticMessage, ...args: string[]): void; - } - /** - * A BuildContext tracks what's going on during the course of a build. - * - * Callers may invoke any number of build requests within the same context; - * until the context is reset, each project will only be built at most once. - * - * Example: In a standard setup where project B depends on project A, and both are out of date, - * a failed build of A will result in A remaining out of date. When we try to build - * B, we should immediately bail instead of recomputing A's up-to-date status again. - * - * This also matters for performing fast (i.e. fake) downstream builds of projects - * when their upstream .d.ts files haven't changed content (but have newer timestamps) - */ - interface BuildContext { - options: BuildOptions; - /** - * Map from output file name to its pre-build timestamp - */ - unchangedOutputs: FileMap; - /** - * Map from config file name to up-to-date status - */ - projectStatus: FileMap; - invalidatedProjects: FileMap; - queuedProjects: FileMap; - missingRoots: Map; - } - type Mapper = ReturnType; - interface DependencyGraph { - buildQueue: ResolvedConfigFileName[]; - dependencyMap: Mapper; - } - interface BuildOptions { - dry: boolean; - force: boolean; - verbose: boolean; - } - enum UpToDateStatusType { - Unbuildable = 0, - UpToDate = 1, - /** - * The project appears out of date because its upstream inputs are newer than its outputs, - * but all of its outputs are actually newer than the previous identical outputs of its (.d.ts) inputs. - * This means we can Pseudo-build (just touch timestamps), as if we had actually built this project. - */ - UpToDateWithUpstreamTypes = 2, - OutputMissing = 3, - OutOfDateWithSelf = 4, - OutOfDateWithUpstream = 5, - UpstreamOutOfDate = 6, - UpstreamBlocked = 7, - /** - * Projects with no outputs (i.e. "solution" files) - */ - ContainerOnly = 8 - } - type UpToDateStatus = Status.Unbuildable | Status.UpToDate | Status.OutputMissing | Status.OutOfDateWithSelf | Status.OutOfDateWithUpstream | Status.UpstreamOutOfDate | Status.UpstreamBlocked | Status.ContainerOnly; - namespace Status { - /** - * The project can't be built at all in its current state. For example, - * its config file cannot be parsed, or it has a syntax error or missing file - */ - interface Unbuildable { - type: UpToDateStatusType.Unbuildable; - reason: string; - } - /** - * This project doesn't have any outputs, so "is it up to date" is a meaningless question. - */ - interface ContainerOnly { - type: UpToDateStatusType.ContainerOnly; - } - /** - * The project is up to date with respect to its inputs. - * We track what the newest input file is. - */ - interface UpToDate { - type: UpToDateStatusType.UpToDate | UpToDateStatusType.UpToDateWithUpstreamTypes; - newestInputFileTime?: Date; - newestInputFileName?: string; - newestDeclarationFileContentChangedTime?: Date; - newestOutputFileTime?: Date; - newestOutputFileName?: string; - oldestOutputFileName?: string; - } - /** - * One or more of the outputs of the project does not exist. - */ - interface OutputMissing { - type: UpToDateStatusType.OutputMissing; - /** - * The name of the first output file that didn't exist - */ - missingOutputFileName: string; - } - /** - * One or more of the project's outputs is older than its newest input. - */ - interface OutOfDateWithSelf { - type: UpToDateStatusType.OutOfDateWithSelf; - outOfDateOutputFileName: string; - newerInputFileName: string; - } - /** - * This project depends on an out-of-date project, so shouldn't be built yet - */ - interface UpstreamOutOfDate { - type: UpToDateStatusType.UpstreamOutOfDate; - upstreamProjectName: string; - } - /** - * This project depends an upstream project with build errors - */ - interface UpstreamBlocked { - type: UpToDateStatusType.UpstreamBlocked; - upstreamProjectName: string; - } - /** - * One or more of the project's outputs is older than the newest output of - * an upstream project. - */ - interface OutOfDateWithUpstream { - type: UpToDateStatusType.OutOfDateWithUpstream; - outOfDateOutputFileName: string; - newerProjectName: string; - } - } - interface FileMap { - setValue(fileName: string, value: T): void; - getValue(fileName: string): T | never; - getValueOrUndefined(fileName: string): T | undefined; - hasKey(fileName: string): boolean; - removeKey(fileName: string): void; - getKeys(): string[]; - } - function createDependencyMapper(): { - addReference: (childConfigFileName: ResolvedConfigFileName, parentConfigFileName: ResolvedConfigFileName) => void; - getReferencesTo: (parentConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[]; - getReferencesOf: (childConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[]; - getKeys: () => ReadonlyArray; - }; - function createBuildContext(options: BuildOptions): BuildContext; - function performBuild(args: string[], compilerHost: CompilerHost, buildHost: BuildHost, system?: System): number | undefined; - /** - * A SolutionBuilder has an immutable set of rootNames that are the "entry point" projects, but - * can dynamically add/remove other projects based on changes on the rootNames' references - */ - function createSolutionBuilder(compilerHost: CompilerHost, buildHost: BuildHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions, system?: System): { - buildAllProjects: () => ExitStatus; - getUpToDateStatus: (project: ParsedCommandLine | undefined) => UpToDateStatus; - getUpToDateStatusOfFile: (configFileName: ResolvedConfigFileName) => UpToDateStatus; - cleanAllProjects: () => ExitStatus.Success | ExitStatus.DiagnosticsPresent_OutputsSkipped; - resetBuildContext: (opts?: BuildOptions) => void; - getBuildGraph: (configFileNames: ReadonlyArray) => DependencyGraph | undefined; - invalidateProject: (configFileName: string) => void; - buildInvalidatedProjects: () => void; - buildDependentInvalidatedProjects: () => void; - resolveProjectName: (name: string) => ResolvedConfigFileName | undefined; - startWatching: () => void; - }; - /** - * Gets the UpToDateStatus for a project - */ - function getUpToDateStatus(host: UpToDateHost, project: ParsedCommandLine | undefined): UpToDateStatus; - function getAllProjectOutputs(project: ParsedCommandLine): ReadonlyArray; - function formatUpToDateStatus(configFileName: string, status: UpToDateStatus, relName: (fileName: string) => string, formatMessage: (message: DiagnosticMessage, ...args: string[]) => T): T | undefined; -} declare namespace ts.server { type ActionSet = "action::set"; type ActionInvalidate = "action::invalidate"; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 4a792a34763..bb03f59ceb8 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2579,14 +2579,6 @@ declare namespace ts { oldProgram?: Program; configFileParsingDiagnostics?: ReadonlyArray; } - interface UpToDateHost { - fileExists(fileName: string): boolean; - getModifiedTime(fileName: string): Date; - getUnchangedTime?(fileName: string): Date | undefined; - getLastStatus?(fileName: string): UpToDateStatus | undefined; - setLastStatus?(fileName: string, status: UpToDateStatus): void; - parseConfigFile?(configFilePath: ResolvedConfigFileName): ParsedCommandLine | undefined; - } interface ModuleResolutionHost { fileExists(fileName: string): boolean; readFile(fileName: string): string | undefined; @@ -4406,180 +4398,6 @@ declare namespace ts { */ function createWatchProgram(host: WatchCompilerHostOfConfigFile): WatchOfConfigFile; } -declare namespace ts { - interface BuildHost { - verbose(diag: DiagnosticMessage, ...args: string[]): void; - error(diag: DiagnosticMessage, ...args: string[]): void; - errorDiagnostic(diag: Diagnostic): void; - message(diag: DiagnosticMessage, ...args: string[]): void; - } - /** - * A BuildContext tracks what's going on during the course of a build. - * - * Callers may invoke any number of build requests within the same context; - * until the context is reset, each project will only be built at most once. - * - * Example: In a standard setup where project B depends on project A, and both are out of date, - * a failed build of A will result in A remaining out of date. When we try to build - * B, we should immediately bail instead of recomputing A's up-to-date status again. - * - * This also matters for performing fast (i.e. fake) downstream builds of projects - * when their upstream .d.ts files haven't changed content (but have newer timestamps) - */ - interface BuildContext { - options: BuildOptions; - /** - * Map from output file name to its pre-build timestamp - */ - unchangedOutputs: FileMap; - /** - * Map from config file name to up-to-date status - */ - projectStatus: FileMap; - invalidatedProjects: FileMap; - queuedProjects: FileMap; - missingRoots: Map; - } - type Mapper = ReturnType; - interface DependencyGraph { - buildQueue: ResolvedConfigFileName[]; - dependencyMap: Mapper; - } - interface BuildOptions { - dry: boolean; - force: boolean; - verbose: boolean; - } - enum UpToDateStatusType { - Unbuildable = 0, - UpToDate = 1, - /** - * The project appears out of date because its upstream inputs are newer than its outputs, - * but all of its outputs are actually newer than the previous identical outputs of its (.d.ts) inputs. - * This means we can Pseudo-build (just touch timestamps), as if we had actually built this project. - */ - UpToDateWithUpstreamTypes = 2, - OutputMissing = 3, - OutOfDateWithSelf = 4, - OutOfDateWithUpstream = 5, - UpstreamOutOfDate = 6, - UpstreamBlocked = 7, - /** - * Projects with no outputs (i.e. "solution" files) - */ - ContainerOnly = 8 - } - type UpToDateStatus = Status.Unbuildable | Status.UpToDate | Status.OutputMissing | Status.OutOfDateWithSelf | Status.OutOfDateWithUpstream | Status.UpstreamOutOfDate | Status.UpstreamBlocked | Status.ContainerOnly; - namespace Status { - /** - * The project can't be built at all in its current state. For example, - * its config file cannot be parsed, or it has a syntax error or missing file - */ - interface Unbuildable { - type: UpToDateStatusType.Unbuildable; - reason: string; - } - /** - * This project doesn't have any outputs, so "is it up to date" is a meaningless question. - */ - interface ContainerOnly { - type: UpToDateStatusType.ContainerOnly; - } - /** - * The project is up to date with respect to its inputs. - * We track what the newest input file is. - */ - interface UpToDate { - type: UpToDateStatusType.UpToDate | UpToDateStatusType.UpToDateWithUpstreamTypes; - newestInputFileTime?: Date; - newestInputFileName?: string; - newestDeclarationFileContentChangedTime?: Date; - newestOutputFileTime?: Date; - newestOutputFileName?: string; - oldestOutputFileName?: string; - } - /** - * One or more of the outputs of the project does not exist. - */ - interface OutputMissing { - type: UpToDateStatusType.OutputMissing; - /** - * The name of the first output file that didn't exist - */ - missingOutputFileName: string; - } - /** - * One or more of the project's outputs is older than its newest input. - */ - interface OutOfDateWithSelf { - type: UpToDateStatusType.OutOfDateWithSelf; - outOfDateOutputFileName: string; - newerInputFileName: string; - } - /** - * This project depends on an out-of-date project, so shouldn't be built yet - */ - interface UpstreamOutOfDate { - type: UpToDateStatusType.UpstreamOutOfDate; - upstreamProjectName: string; - } - /** - * This project depends an upstream project with build errors - */ - interface UpstreamBlocked { - type: UpToDateStatusType.UpstreamBlocked; - upstreamProjectName: string; - } - /** - * One or more of the project's outputs is older than the newest output of - * an upstream project. - */ - interface OutOfDateWithUpstream { - type: UpToDateStatusType.OutOfDateWithUpstream; - outOfDateOutputFileName: string; - newerProjectName: string; - } - } - interface FileMap { - setValue(fileName: string, value: T): void; - getValue(fileName: string): T | never; - getValueOrUndefined(fileName: string): T | undefined; - hasKey(fileName: string): boolean; - removeKey(fileName: string): void; - getKeys(): string[]; - } - function createDependencyMapper(): { - addReference: (childConfigFileName: ResolvedConfigFileName, parentConfigFileName: ResolvedConfigFileName) => void; - getReferencesTo: (parentConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[]; - getReferencesOf: (childConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[]; - getKeys: () => ReadonlyArray; - }; - function createBuildContext(options: BuildOptions): BuildContext; - function performBuild(args: string[], compilerHost: CompilerHost, buildHost: BuildHost, system?: System): number | undefined; - /** - * A SolutionBuilder has an immutable set of rootNames that are the "entry point" projects, but - * can dynamically add/remove other projects based on changes on the rootNames' references - */ - function createSolutionBuilder(compilerHost: CompilerHost, buildHost: BuildHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions, system?: System): { - buildAllProjects: () => ExitStatus; - getUpToDateStatus: (project: ParsedCommandLine | undefined) => UpToDateStatus; - getUpToDateStatusOfFile: (configFileName: ResolvedConfigFileName) => UpToDateStatus; - cleanAllProjects: () => ExitStatus.Success | ExitStatus.DiagnosticsPresent_OutputsSkipped; - resetBuildContext: (opts?: BuildOptions) => void; - getBuildGraph: (configFileNames: ReadonlyArray) => DependencyGraph | undefined; - invalidateProject: (configFileName: string) => void; - buildInvalidatedProjects: () => void; - buildDependentInvalidatedProjects: () => void; - resolveProjectName: (name: string) => ResolvedConfigFileName | undefined; - startWatching: () => void; - }; - /** - * Gets the UpToDateStatus for a project - */ - function getUpToDateStatus(host: UpToDateHost, project: ParsedCommandLine | undefined): UpToDateStatus; - function getAllProjectOutputs(project: ParsedCommandLine): ReadonlyArray; - function formatUpToDateStatus(configFileName: string, status: UpToDateStatus, relName: (fileName: string) => string, formatMessage: (message: DiagnosticMessage, ...args: string[]) => T): T | undefined; -} declare namespace ts.server { type ActionSet = "action::set"; type ActionInvalidate = "action::invalidate"; From c97a93a772e25f57965485c7ffc097bcf2ca4dd4 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 17 Aug 2018 16:02:13 -0700 Subject: [PATCH 7/8] Fix lint problems (?) --- src/services/jsDoc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index bb90a601a49..0d166459d98 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -360,7 +360,7 @@ namespace ts.JsDoc { const varStatement = commentOwner; const varDeclarations = varStatement.declarationList.declarations; const parameters = varDeclarations.length === 1 && varDeclarations[0].initializer - ? getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer!) + ? getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer) : undefined; return { commentOwner, parameters }; } From dde51ef60ef9770b1c1777f9f41d5fdee1e68d78 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 17 Aug 2018 16:25:09 -0700 Subject: [PATCH 8/8] LINT --- src/compiler/checker.ts | 1 + src/services/jsDoc.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 305fa8844ea..278a189b8d6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -22171,6 +22171,7 @@ namespace ts { for (const decl of indexSymbol.declarations) { const declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { + // tslint:disable-next-line switch (declaration.parameters[0].type!.kind) { case SyntaxKind.StringKeyword: if (!seenStringIndexer) { diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 0d166459d98..813da5ba477 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -360,7 +360,8 @@ namespace ts.JsDoc { const varStatement = commentOwner; const varDeclarations = varStatement.declarationList.declarations; const parameters = varDeclarations.length === 1 && varDeclarations[0].initializer - ? getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer) + // tslint:disable-next-line + ? getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer!) : undefined; return { commentOwner, parameters }; }