@@ -94,7 +94,7 @@ var ts;
94
94
// If changing the text in this section, be sure to test `configureNightly` too.
95
95
ts.versionMajorMinor = "3.7";
96
96
/** The version of the TypeScript compiler release */
97
- ts.version = ts.versionMajorMinor + ".4 ";
97
+ ts.version = ts.versionMajorMinor + ".5 ";
98
98
})(ts || (ts = {}));
99
99
(function (ts) {
100
100
/* @internal */
@@ -11324,6 +11324,10 @@ var ts;
11324
11324
return !!node && !!(node.flags & 33554432 /* JsonFile */);
11325
11325
}
11326
11326
ts.isInJsonFile = isInJsonFile;
11327
+ function isSourceFileNotJson(file) {
11328
+ return !isJsonSourceFile(file);
11329
+ }
11330
+ ts.isSourceFileNotJson = isSourceFileNotJson;
11327
11331
function isInJSDoc(node) {
11328
11332
return !!node && !!(node.flags & 4194304 /* JSDoc */);
11329
11333
}
@@ -87719,8 +87723,11 @@ var ts;
87719
87723
var ts;
87720
87724
(function (ts) {
87721
87725
function getDeclarationDiagnostics(host, resolver, file) {
87726
+ if (file && ts.isJsonSourceFile(file)) {
87727
+ return []; // No declaration diagnostics for json for now
87728
+ }
87722
87729
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);
87724
87731
return result.diagnostics;
87725
87732
}
87726
87733
ts.getDeclarationDiagnostics = getDeclarationDiagnostics;
@@ -89467,12 +89474,13 @@ var ts;
89467
89474
}
89468
89475
else {
89469
89476
var ownOutputFilePath = ts.getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile, options));
89477
+ var isJsonFile = ts.isJsonSourceFile(sourceFile);
89470
89478
// 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 &&
89472
89480
ts.comparePaths(sourceFile.fileName, ownOutputFilePath, host.getCurrentDirectory(), !host.useCaseSensitiveFileNames()) === 0 /* EqualTo */;
89473
89481
var jsFilePath = options.emitDeclarationOnly || isJsonEmittedToSameLocation ? undefined : ownOutputFilePath;
89474
89482
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;
89476
89484
var declarationMapPath = declarationFilePath && ts.getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : undefined;
89477
89485
return { jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath, declarationMapPath: declarationMapPath, buildInfoPath: undefined };
89478
89486
}
@@ -89513,7 +89521,7 @@ var ts;
89513
89521
}
89514
89522
/* @internal */
89515
89523
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 */) );
89517
89525
return ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir), ".d.ts" /* Dts */);
89518
89526
}
89519
89527
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
@@ -89742,12 +89750,13 @@ var ts;
89742
89750
return;
89743
89751
}
89744
89752
var sourceFiles = ts.isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
89753
+ var filesForEmit = forceDtsEmit ? sourceFiles : ts.filter(sourceFiles, ts.isSourceFileNotJson);
89745
89754
// 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 ;
89747
89756
if (emitOnlyDtsFiles && !ts.getEmitDeclarations(compilerOptions)) {
89748
89757
// Checker wont collect the linked aliases since thats only done when declaration is enabled.
89749
89758
// Do that here when emitting only dts files
89750
- sourceFiles .forEach(collectLinkedAliases);
89759
+ filesForEmit .forEach(collectLinkedAliases);
89751
89760
}
89752
89761
var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false);
89753
89762
if (ts.length(declarationTransform.diagnostics)) {
@@ -95003,7 +95012,7 @@ var ts;
95003
95012
else if (ts.getEmitModuleKind(parsedRef.commandLine.options) === ts.ModuleKind.None) {
95004
95013
for (var _c = 0, _d = parsedRef.commandLine.fileNames; _c < _d.length; _c++) {
95005
95014
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 */) ) {
95007
95016
processSourceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames()), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
95008
95017
}
95009
95018
}
@@ -96383,8 +96392,8 @@ var ts;
96383
96392
return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
96384
96393
}
96385
96394
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 */) ) {
96388
96397
return undefined;
96389
96398
}
96390
96399
// If this file is produced by a referenced project, we need to rewrite it to
@@ -96438,7 +96447,7 @@ var ts;
96438
96447
}
96439
96448
else {
96440
96449
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 */) ) {
96442
96451
var outputDts = ts.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, host.useCaseSensitiveFileNames());
96443
96452
mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), fileName);
96444
96453
}
@@ -99398,7 +99407,7 @@ var ts;
99398
99407
var match = str.match(/\//g);
99399
99408
return match ? match.length : 0;
99400
99409
}
99401
- function comparePathsByNumberOfDirectrorySeparators (a, b) {
99410
+ function comparePathsByNumberOfDirectorySeparators (a, b) {
99402
99411
return ts.compareValues(numberOfDirectorySeparators(a), numberOfDirectorySeparators(b));
99403
99412
}
99404
99413
/**
@@ -99445,13 +99454,28 @@ var ts;
99445
99454
});
99446
99455
if (pathsInDirectory) {
99447
99456
if (pathsInDirectory.length > 1) {
99448
- pathsInDirectory.sort(comparePathsByNumberOfDirectrorySeparators );
99457
+ pathsInDirectory.sort(comparePathsByNumberOfDirectorySeparators );
99449
99458
}
99450
99459
sortedPaths.push.apply(sortedPaths, pathsInDirectory);
99451
99460
}
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);
99455
99479
}
99456
99480
return sortedPaths;
99457
99481
}
0 commit comments