Skip to content

Commit 9d42982

Browse files
Update LKG.
1 parent c81b9a7 commit 9d42982

File tree

6 files changed

+235
-91
lines changed

6 files changed

+235
-91
lines changed

lib/tsc.js

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
6767
var ts;
6868
(function (ts) {
6969
ts.versionMajorMinor = "3.7";
70-
ts.version = ts.versionMajorMinor + ".4";
70+
ts.version = ts.versionMajorMinor + ".5";
7171
})(ts || (ts = {}));
7272
(function (ts) {
7373
function tryGetNativeMap() {
@@ -8565,6 +8565,10 @@ var ts;
85658565
return !!node && !!(node.flags & 33554432);
85668566
}
85678567
ts.isInJsonFile = isInJsonFile;
8568+
function isSourceFileNotJson(file) {
8569+
return !isJsonSourceFile(file);
8570+
}
8571+
ts.isSourceFileNotJson = isSourceFileNotJson;
85688572
function isInJSDoc(node) {
85698573
return !!node && !!(node.flags & 4194304);
85708574
}
@@ -71440,8 +71444,11 @@ var ts;
7144071444
var ts;
7144171445
(function (ts) {
7144271446
function getDeclarationDiagnostics(host, resolver, file) {
71447+
if (file && ts.isJsonSourceFile(file)) {
71448+
return [];
71449+
}
7144371450
var compilerOptions = host.getCompilerOptions();
71444-
var result = ts.transformNodes(resolver, host, compilerOptions, file ? [file] : host.getSourceFiles(), [transformDeclarations], false);
71451+
var result = ts.transformNodes(resolver, host, compilerOptions, file ? [file] : ts.filter(host.getSourceFiles(), ts.isSourceFileNotJson), [transformDeclarations], false);
7144571452
return result.diagnostics;
7144671453
}
7144771454
ts.getDeclarationDiagnostics = getDeclarationDiagnostics;
@@ -72961,11 +72968,12 @@ var ts;
7296172968
}
7296272969
else {
7296372970
var ownOutputFilePath = ts.getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile, options));
72964-
var isJsonEmittedToSameLocation = ts.isJsonSourceFile(sourceFile) &&
72971+
var isJsonFile = ts.isJsonSourceFile(sourceFile);
72972+
var isJsonEmittedToSameLocation = isJsonFile &&
7296572973
ts.comparePaths(sourceFile.fileName, ownOutputFilePath, host.getCurrentDirectory(), !host.useCaseSensitiveFileNames()) === 0;
7296672974
var jsFilePath = options.emitDeclarationOnly || isJsonEmittedToSameLocation ? undefined : ownOutputFilePath;
7296772975
var sourceMapFilePath = !jsFilePath || ts.isJsonSourceFile(sourceFile) ? undefined : getSourceMapFilePath(jsFilePath, options);
72968-
var declarationFilePath = (forceDtsPaths || ts.getEmitDeclarations(options)) ? ts.getDeclarationEmitOutputFilePath(sourceFile.fileName, host) : undefined;
72976+
var declarationFilePath = (forceDtsPaths || (ts.getEmitDeclarations(options) && !isJsonFile)) ? ts.getDeclarationEmitOutputFilePath(sourceFile.fileName, host) : undefined;
7296972977
var declarationMapPath = declarationFilePath && ts.getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : undefined;
7297072978
return { jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath, declarationMapPath: declarationMapPath, buildInfoPath: undefined };
7297172979
}
@@ -73000,7 +73008,7 @@ var ts;
7300073008
inputFileName;
7300173009
}
7300273010
function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase) {
73003-
ts.Debug.assert(!ts.fileExtensionIs(inputFileName, ".d.ts"));
73011+
ts.Debug.assert(!ts.fileExtensionIs(inputFileName, ".d.ts") && !ts.fileExtensionIs(inputFileName, ".json"));
7300473012
return ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir), ".d.ts");
7300573013
}
7300673014
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
@@ -73217,9 +73225,10 @@ var ts;
7321773225
return;
7321873226
}
7321973227
var sourceFiles = ts.isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
73220-
var inputListOrBundle = (compilerOptions.outFile || compilerOptions.out) ? [ts.createBundle(sourceFiles, !ts.isSourceFile(sourceFileOrBundle) ? sourceFileOrBundle.prepends : undefined)] : sourceFiles;
73228+
var filesForEmit = forceDtsEmit ? sourceFiles : ts.filter(sourceFiles, ts.isSourceFileNotJson);
73229+
var inputListOrBundle = (compilerOptions.outFile || compilerOptions.out) ? [ts.createBundle(filesForEmit, !ts.isSourceFile(sourceFileOrBundle) ? sourceFileOrBundle.prepends : undefined)] : filesForEmit;
7322173230
if (emitOnlyDtsFiles && !ts.getEmitDeclarations(compilerOptions)) {
73222-
sourceFiles.forEach(collectLinkedAliases);
73231+
filesForEmit.forEach(collectLinkedAliases);
7322373232
}
7322473233
var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, declarationTransformers, false);
7322573234
if (ts.length(declarationTransform.diagnostics)) {
@@ -78007,7 +78016,7 @@ var ts;
7800778016
else if (ts.getEmitModuleKind(parsedRef.commandLine.options) === ts.ModuleKind.None) {
7800878017
for (var _c = 0, _d = parsedRef.commandLine.fileNames; _c < _d.length; _c++) {
7800978018
var fileName = _d[_c];
78010-
if (!ts.fileExtensionIs(fileName, ".d.ts")) {
78019+
if (!ts.fileExtensionIs(fileName, ".d.ts") && !ts.fileExtensionIs(fileName, ".json")) {
7801178020
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames()), false, false, undefined);
7801278021
}
7801378022
}
@@ -79186,7 +79195,7 @@ var ts;
7918679195
return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
7918779196
}
7918879197
function getProjectReferenceRedirectProject(fileName) {
79189-
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.fileExtensionIs(fileName, ".d.ts")) {
79198+
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.fileExtensionIs(fileName, ".d.ts") || ts.fileExtensionIs(fileName, ".json")) {
7919079199
return undefined;
7919179200
}
7919279201
return getResolvedProjectReferenceToRedirect(fileName);
@@ -79233,7 +79242,7 @@ var ts;
7923379242
}
7923479243
else {
7923579244
ts.forEach(resolvedRef.commandLine.fileNames, function (fileName) {
79236-
if (!ts.fileExtensionIs(fileName, ".d.ts")) {
79245+
if (!ts.fileExtensionIs(fileName, ".d.ts") && !ts.fileExtensionIs(fileName, ".json")) {
7923779246
var outputDts = ts.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, host.useCaseSensitiveFileNames());
7923879247
mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), fileName);
7923979248
}
@@ -81740,7 +81749,7 @@ var ts;
8174081749
var match = str.match(/\//g);
8174181750
return match ? match.length : 0;
8174281751
}
81743-
function comparePathsByNumberOfDirectrorySeparators(a, b) {
81752+
function comparePathsByNumberOfDirectorySeparators(a, b) {
8174481753
return ts.compareValues(numberOfDirectorySeparators(a), numberOfDirectorySeparators(b));
8174581754
}
8174681755
function getAllModulePaths(files, importingFileName, importedFileName, getCanonicalFileName, host, redirectTargetsMap) {
@@ -81782,13 +81791,28 @@ var ts;
8178281791
});
8178381792
if (pathsInDirectory) {
8178481793
if (pathsInDirectory.length > 1) {
81785-
pathsInDirectory.sort(comparePathsByNumberOfDirectrorySeparators);
81794+
pathsInDirectory.sort(comparePathsByNumberOfDirectorySeparators);
8178681795
}
8178781796
sortedPaths.push.apply(sortedPaths, pathsInDirectory);
8178881797
}
81798+
var newDirectory = ts.getDirectoryPath(directory);
81799+
if (newDirectory === directory)
81800+
return out_directory_1 = directory, "break";
81801+
directory = newDirectory;
81802+
out_directory_1 = directory;
8178981803
};
81790-
for (var directory = ts.getDirectoryPath(ts.toPath(importingFileName, cwd, getCanonicalFileName)); allFileNames.size !== 0; directory = ts.getDirectoryPath(directory)) {
81791-
_loop_17(directory);
81804+
var out_directory_1;
81805+
for (var directory = ts.getDirectoryPath(ts.toPath(importingFileName, cwd, getCanonicalFileName)); allFileNames.size !== 0;) {
81806+
var state_7 = _loop_17(directory);
81807+
directory = out_directory_1;
81808+
if (state_7 === "break")
81809+
break;
81810+
}
81811+
if (allFileNames.size) {
81812+
var remainingPaths = ts.arrayFrom(allFileNames.values());
81813+
if (remainingPaths.length > 1)
81814+
remainingPaths.sort(comparePathsByNumberOfDirectorySeparators);
81815+
sortedPaths.push.apply(sortedPaths, remainingPaths);
8179281816
}
8179381817
return sortedPaths;
8179481818
}

lib/tsserver.js

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ var ts;
9494
// If changing the text in this section, be sure to test `configureNightly` too.
9595
ts.versionMajorMinor = "3.7";
9696
/** The version of the TypeScript compiler release */
97-
ts.version = ts.versionMajorMinor + ".4";
97+
ts.version = ts.versionMajorMinor + ".5";
9898
})(ts || (ts = {}));
9999
(function (ts) {
100100
/* @internal */
@@ -11324,6 +11324,10 @@ var ts;
1132411324
return !!node && !!(node.flags & 33554432 /* JsonFile */);
1132511325
}
1132611326
ts.isInJsonFile = isInJsonFile;
11327+
function isSourceFileNotJson(file) {
11328+
return !isJsonSourceFile(file);
11329+
}
11330+
ts.isSourceFileNotJson = isSourceFileNotJson;
1132711331
function isInJSDoc(node) {
1132811332
return !!node && !!(node.flags & 4194304 /* JSDoc */);
1132911333
}
@@ -87719,8 +87723,11 @@ var ts;
8771987723
var ts;
8772087724
(function (ts) {
8772187725
function getDeclarationDiagnostics(host, resolver, file) {
87726+
if (file && ts.isJsonSourceFile(file)) {
87727+
return []; // No declaration diagnostics for json for now
87728+
}
8772287729
var compilerOptions = host.getCompilerOptions();
87723-
var result = ts.transformNodes(resolver, host, compilerOptions, file ? [file] : host.getSourceFiles(), [transformDeclarations], /*allowDtsFiles*/ false);
87730+
var result = ts.transformNodes(resolver, host, compilerOptions, file ? [file] : ts.filter(host.getSourceFiles(), ts.isSourceFileNotJson), [transformDeclarations], /*allowDtsFiles*/ false);
8772487731
return result.diagnostics;
8772587732
}
8772687733
ts.getDeclarationDiagnostics = getDeclarationDiagnostics;
@@ -89467,12 +89474,13 @@ var ts;
8946789474
}
8946889475
else {
8946989476
var ownOutputFilePath = ts.getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile, options));
89477+
var isJsonFile = ts.isJsonSourceFile(sourceFile);
8947089478
// If json file emits to the same location skip writing it, if emitDeclarationOnly skip writing it
89471-
var isJsonEmittedToSameLocation = ts.isJsonSourceFile(sourceFile) &&
89479+
var isJsonEmittedToSameLocation = isJsonFile &&
8947289480
ts.comparePaths(sourceFile.fileName, ownOutputFilePath, host.getCurrentDirectory(), !host.useCaseSensitiveFileNames()) === 0 /* EqualTo */;
8947389481
var jsFilePath = options.emitDeclarationOnly || isJsonEmittedToSameLocation ? undefined : ownOutputFilePath;
8947489482
var sourceMapFilePath = !jsFilePath || ts.isJsonSourceFile(sourceFile) ? undefined : getSourceMapFilePath(jsFilePath, options);
89475-
var declarationFilePath = (forceDtsPaths || ts.getEmitDeclarations(options)) ? ts.getDeclarationEmitOutputFilePath(sourceFile.fileName, host) : undefined;
89483+
var declarationFilePath = (forceDtsPaths || (ts.getEmitDeclarations(options) && !isJsonFile)) ? ts.getDeclarationEmitOutputFilePath(sourceFile.fileName, host) : undefined;
8947689484
var declarationMapPath = declarationFilePath && ts.getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : undefined;
8947789485
return { jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath, declarationMapPath: declarationMapPath, buildInfoPath: undefined };
8947889486
}
@@ -89513,7 +89521,7 @@ var ts;
8951389521
}
8951489522
/* @internal */
8951589523
function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase) {
89516-
ts.Debug.assert(!ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */));
89524+
ts.Debug.assert(!ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */) && !ts.fileExtensionIs(inputFileName, ".json" /* Json */));
8951789525
return ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir), ".d.ts" /* Dts */);
8951889526
}
8951989527
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
@@ -89742,12 +89750,13 @@ var ts;
8974289750
return;
8974389751
}
8974489752
var sourceFiles = ts.isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
89753+
var filesForEmit = forceDtsEmit ? sourceFiles : ts.filter(sourceFiles, ts.isSourceFileNotJson);
8974589754
// Setup and perform the transformation to retrieve declarations from the input files
89746-
var inputListOrBundle = (compilerOptions.outFile || compilerOptions.out) ? [ts.createBundle(sourceFiles, !ts.isSourceFile(sourceFileOrBundle) ? sourceFileOrBundle.prepends : undefined)] : sourceFiles;
89755+
var inputListOrBundle = (compilerOptions.outFile || compilerOptions.out) ? [ts.createBundle(filesForEmit, !ts.isSourceFile(sourceFileOrBundle) ? sourceFileOrBundle.prepends : undefined)] : filesForEmit;
8974789756
if (emitOnlyDtsFiles && !ts.getEmitDeclarations(compilerOptions)) {
8974889757
// Checker wont collect the linked aliases since thats only done when declaration is enabled.
8974989758
// Do that here when emitting only dts files
89750-
sourceFiles.forEach(collectLinkedAliases);
89759+
filesForEmit.forEach(collectLinkedAliases);
8975189760
}
8975289761
var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false);
8975389762
if (ts.length(declarationTransform.diagnostics)) {
@@ -95003,7 +95012,7 @@ var ts;
9500395012
else if (ts.getEmitModuleKind(parsedRef.commandLine.options) === ts.ModuleKind.None) {
9500495013
for (var _c = 0, _d = parsedRef.commandLine.fileNames; _c < _d.length; _c++) {
9500595014
var fileName = _d[_c];
95006-
if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */)) {
95015+
if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
9500795016
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames()), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
9500895017
}
9500995018
}
@@ -96383,8 +96392,8 @@ var ts;
9638396392
return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
9638496393
}
9638596394
function getProjectReferenceRedirectProject(fileName) {
96386-
// Ignore dts
96387-
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.fileExtensionIs(fileName, ".d.ts" /* Dts */)) {
96395+
// Ignore dts or any json files
96396+
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) || ts.fileExtensionIs(fileName, ".json" /* Json */)) {
9638896397
return undefined;
9638996398
}
9639096399
// If this file is produced by a referenced project, we need to rewrite it to
@@ -96438,7 +96447,7 @@ var ts;
9643896447
}
9643996448
else {
9644096449
ts.forEach(resolvedRef.commandLine.fileNames, function (fileName) {
96441-
if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */)) {
96450+
if (!ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
9644296451
var outputDts = ts.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, host.useCaseSensitiveFileNames());
9644396452
mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), fileName);
9644496453
}
@@ -99398,7 +99407,7 @@ var ts;
9939899407
var match = str.match(/\//g);
9939999408
return match ? match.length : 0;
9940099409
}
99401-
function comparePathsByNumberOfDirectrorySeparators(a, b) {
99410+
function comparePathsByNumberOfDirectorySeparators(a, b) {
9940299411
return ts.compareValues(numberOfDirectorySeparators(a), numberOfDirectorySeparators(b));
9940399412
}
9940499413
/**
@@ -99445,13 +99454,28 @@ var ts;
9944599454
});
9944699455
if (pathsInDirectory) {
9944799456
if (pathsInDirectory.length > 1) {
99448-
pathsInDirectory.sort(comparePathsByNumberOfDirectrorySeparators);
99457+
pathsInDirectory.sort(comparePathsByNumberOfDirectorySeparators);
9944999458
}
9945099459
sortedPaths.push.apply(sortedPaths, pathsInDirectory);
9945199460
}
99452-
};
99453-
for (var directory = ts.getDirectoryPath(ts.toPath(importingFileName, cwd, getCanonicalFileName)); allFileNames.size !== 0; directory = ts.getDirectoryPath(directory)) {
99454-
_loop_17(directory);
99461+
var newDirectory = ts.getDirectoryPath(directory);
99462+
if (newDirectory === directory)
99463+
return out_directory_1 = directory, "break";
99464+
directory = newDirectory;
99465+
out_directory_1 = directory;
99466+
};
99467+
var out_directory_1;
99468+
for (var directory = ts.getDirectoryPath(ts.toPath(importingFileName, cwd, getCanonicalFileName)); allFileNames.size !== 0;) {
99469+
var state_7 = _loop_17(directory);
99470+
directory = out_directory_1;
99471+
if (state_7 === "break")
99472+
break;
99473+
}
99474+
if (allFileNames.size) {
99475+
var remainingPaths = ts.arrayFrom(allFileNames.values());
99476+
if (remainingPaths.length > 1)
99477+
remainingPaths.sort(comparePathsByNumberOfDirectorySeparators);
99478+
sortedPaths.push.apply(sortedPaths, remainingPaths);
9945599479
}
9945699480
return sortedPaths;
9945799481
}

0 commit comments

Comments
 (0)