@typescript-deploys/pr-build 4.8.0-pr-49156-5 → 4.8.0-pr-49157-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -69223,7 +69223,7 @@ var ts;
69223
69223
  if (ts.isIdentifier(childNode)) {
69224
69224
  var childSymbol = getSymbolAtLocation(childNode);
69225
69225
  if (childSymbol && childSymbol === testedSymbol) {
69226
- if (ts.isIdentifier(expr)) {
69226
+ if (ts.isIdentifier(expr) || ts.isIdentifier(testedNode) && ts.isBinaryExpression(testedNode.parent)) {
69227
69227
  return true;
69228
69228
  }
69229
69229
  var testedExpression = testedNode.parent;
@@ -88406,6 +88406,12 @@ var ts;
88406
88406
  })(ts || (ts = {}));
88407
88407
  var ts;
88408
88408
  (function (ts) {
88409
+ function getDeclarationDiagnostics(host, resolver, file) {
88410
+ var compilerOptions = host.getCompilerOptions();
88411
+ var result = ts.transformNodes(resolver, host, ts.factory, compilerOptions, file ? [file] : ts.filter(host.getSourceFiles(), ts.isSourceFileNotJson), [transformDeclarations], false);
88412
+ return result.diagnostics;
88413
+ }
88414
+ ts.getDeclarationDiagnostics = getDeclarationDiagnostics;
88409
88415
  function hasInternalAnnotation(range, currentSourceFile) {
88410
88416
  var comment = currentSourceFile.text.substring(range.pos, range.end);
88411
88417
  return ts.stringContains(comment, "@internal");
@@ -90319,13 +90325,6 @@ var ts;
90319
90325
  return ts.Debug.fail("project " + configFile.options.configFilePath + " expected to have at least one output");
90320
90326
  }
90321
90327
  ts.getFirstProjectOutput = getFirstProjectOutput;
90322
- function getCacheDtsEmitResultKey(sourceFileOrBundle, options) {
90323
- return ts.isSourceFile(sourceFileOrBundle) ? sourceFileOrBundle.resolvedPath : ts.outFile(options);
90324
- }
90325
- ts.getCacheDtsEmitResultKey = getCacheDtsEmitResultKey;
90326
- function isForceDtsEmitResult(result) {
90327
- return !!result && !result.transformed;
90328
- }
90329
90328
  function emitFiles(resolver, host, targetSourceFile, _a, emitOnlyDtsFiles, onlyBuildInfo, forceDtsEmit) {
90330
90329
  var scriptTransformers = _a.scriptTransformers, declarationTransformers = _a.declarationTransformers;
90331
90330
  var compilerOptions = host.getCompilerOptions();
@@ -90337,6 +90336,7 @@ var ts;
90337
90336
  var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
90338
90337
  var bundleBuildInfo;
90339
90338
  var emitSkipped = false;
90339
+ var exportedModulesFromDeclarationEmit;
90340
90340
  enter();
90341
90341
  forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit), forceDtsEmit, onlyBuildInfo, !targetSourceFile);
90342
90342
  exit();
@@ -90345,6 +90345,7 @@ var ts;
90345
90345
  diagnostics: emitterDiagnostics.getDiagnostics(),
90346
90346
  emittedFiles: emittedFilesList,
90347
90347
  sourceMaps: sourceMapDataList,
90348
+ exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit
90348
90349
  };
90349
90350
  function emitSourceFileOrBundle(_a, sourceFileOrBundle) {
90350
90351
  var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
@@ -90427,13 +90428,13 @@ var ts;
90427
90428
  isEmitNotificationEnabled: transform.isEmitNotificationEnabled,
90428
90429
  substituteNode: transform.substituteNode,
90429
90430
  });
90430
- printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, compilerOptions);
90431
+ ts.Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform");
90432
+ printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform.transformed[0], printer, compilerOptions);
90431
90433
  transform.dispose();
90432
90434
  if (bundleBuildInfo)
90433
90435
  bundleBuildInfo.js = printer.bundleFileInfo;
90434
90436
  }
90435
90437
  function emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo) {
90436
- var _a, _b;
90437
90438
  if (!sourceFileOrBundle)
90438
90439
  return;
90439
90440
  if (!declarationFilePath) {
@@ -90444,39 +90445,13 @@ var ts;
90444
90445
  var sourceFiles = ts.isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
90445
90446
  var filesForEmit = forceDtsEmit ? sourceFiles : ts.filter(sourceFiles, ts.isSourceFileNotJson);
90446
90447
  var inputListOrBundle = ts.outFile(compilerOptions) ? [ts.factory.createBundle(filesForEmit, !ts.isSourceFile(sourceFileOrBundle) ? sourceFileOrBundle.prepends : undefined)] : filesForEmit;
90447
- var key = getCacheDtsEmitResultKey(sourceFileOrBundle, compilerOptions);
90448
- var cache = host.getDtsEmitResultCache();
90449
- var existing = declarationTransformers.length === 1 ? cache.get(key) : undefined;
90450
- if (isForceDtsEmitResult(existing)) {
90451
- if ((_a = existing.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
90452
- for (var _c = 0, _d = existing.diagnostics; _c < _d.length; _c++) {
90453
- var diagnostic = _d[_c];
90454
- emitterDiagnostics.add(diagnostic);
90455
- }
90456
- }
90457
- var declBlocked_1 = !!((_b = existing.diagnostics) === null || _b === void 0 ? void 0 : _b.length) || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit;
90458
- emitSkipped = emitSkipped || declBlocked_1;
90459
- if (!declBlocked_1 || forceDtsEmit) {
90460
- if (declarationMapPath && !forceDtsEmit) {
90461
- if (sourceMapDataList && existing.sourceMapData) {
90462
- sourceMapDataList.push(existing.sourceMapData);
90463
- }
90464
- ts.writeFile(host, emitterDiagnostics, declarationMapPath, existing.sourceMap, false, sourceFiles);
90465
- }
90466
- ts.writeFile(host, emitterDiagnostics, declarationFilePath, existing.text, !!compilerOptions.emitBOM, filesForEmit, {
90467
- sourceMapUrlPos: existing.sourceMapUrlPos,
90468
- exportedModulesFromDeclarationEmit: existing.exportedModulesFromDeclarationEmit,
90469
- });
90470
- }
90471
- return;
90472
- }
90473
- if (!existing && emitOnlyDtsFiles && !ts.getEmitDeclarations(compilerOptions)) {
90448
+ if (emitOnlyDtsFiles && !ts.getEmitDeclarations(compilerOptions)) {
90474
90449
  filesForEmit.forEach(collectLinkedAliases);
90475
90450
  }
90476
- var declarationTransform = existing || ts.transformNodes(resolver, host, ts.factory, compilerOptions, inputListOrBundle, declarationTransformers, false);
90451
+ var declarationTransform = ts.transformNodes(resolver, host, ts.factory, compilerOptions, inputListOrBundle, declarationTransformers, false);
90477
90452
  if (ts.length(declarationTransform.diagnostics)) {
90478
- for (var _e = 0, _f = declarationTransform.diagnostics; _e < _f.length; _e++) {
90479
- var diagnostic = _f[_e];
90453
+ for (var _a = 0, _b = declarationTransform.diagnostics; _a < _b.length; _a++) {
90454
+ var diagnostic = _b[_a];
90480
90455
  emitterDiagnostics.add(diagnostic);
90481
90456
  }
90482
90457
  }
@@ -90486,7 +90461,8 @@ var ts;
90486
90461
  noEmitHelpers: true,
90487
90462
  module: compilerOptions.module,
90488
90463
  target: compilerOptions.target,
90489
- sourceMap: (!forceDtsEmit || !compilerOptions.noEmit) && compilerOptions.declarationMap,
90464
+ sourceMap: compilerOptions.sourceMap,
90465
+ inlineSourceMap: compilerOptions.inlineSourceMap,
90490
90466
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
90491
90467
  onlyPrintJsDocStyle: true,
90492
90468
  writeBundleFileInfo: !!bundleBuildInfo,
@@ -90502,12 +90478,17 @@ var ts;
90502
90478
  var declBlocked = (!!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length) || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit;
90503
90479
  emitSkipped = emitSkipped || declBlocked;
90504
90480
  if (!declBlocked || forceDtsEmit) {
90505
- printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform, declarationPrinter, {
90506
- sourceMap: printerOptions.sourceMap,
90481
+ ts.Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
90482
+ printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], declarationPrinter, {
90483
+ sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
90507
90484
  sourceRoot: compilerOptions.sourceRoot,
90508
90485
  mapRoot: compilerOptions.mapRoot,
90509
90486
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
90510
90487
  });
90488
+ if (forceDtsEmit && declarationTransform.transformed[0].kind === 305) {
90489
+ var sourceFile = declarationTransform.transformed[0];
90490
+ exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
90491
+ }
90511
90492
  }
90512
90493
  declarationTransform.dispose();
90513
90494
  if (bundleBuildInfo)
@@ -90526,9 +90507,7 @@ var ts;
90526
90507
  }
90527
90508
  ts.forEachChild(node, collectLinkedAliases);
90528
90509
  }
90529
- function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) {
90530
- ts.Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform");
90531
- var sourceFileOrBundle = transform.transformed[0];
90510
+ function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapOptions) {
90532
90511
  var bundle = sourceFileOrBundle.kind === 306 ? sourceFileOrBundle : undefined;
90533
90512
  var sourceFile = sourceFileOrBundle.kind === 305 ? sourceFileOrBundle : undefined;
90534
90513
  var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
@@ -90543,11 +90522,9 @@ var ts;
90543
90522
  printer.writeFile(sourceFile, writer, sourceMapGenerator);
90544
90523
  }
90545
90524
  var sourceMapUrlPos;
90546
- var sourceMap;
90547
- var sourceMapData;
90548
90525
  if (sourceMapGenerator) {
90549
90526
  if (sourceMapDataList) {
90550
- sourceMapDataList.push(sourceMapData = {
90527
+ sourceMapDataList.push({
90551
90528
  inputSourceFileNames: sourceMapGenerator.getSources(),
90552
90529
  sourceMap: sourceMapGenerator.toJSON()
90553
90530
  });
@@ -90560,29 +90537,14 @@ var ts;
90560
90537
  writer.writeComment("//# " + "sourceMappingURL" + "=" + sourceMappingURL);
90561
90538
  }
90562
90539
  if (sourceMapFilePath) {
90563
- sourceMap = sourceMapGenerator.toString();
90564
- if (!forceDtsEmit)
90565
- ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
90540
+ var sourceMap = sourceMapGenerator.toString();
90541
+ ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
90566
90542
  }
90567
90543
  }
90568
90544
  else {
90569
90545
  writer.writeLine();
90570
90546
  }
90571
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, {
90572
- sourceMapUrlPos: sourceMapUrlPos,
90573
- exportedModulesFromDeclarationEmit: sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.exportedModulesFromDeclarationEmit,
90574
- });
90575
- if (forceDtsEmit) {
90576
- var key = getCacheDtsEmitResultKey(sourceFileOrBundle, compilerOptions);
90577
- host.getDtsEmitResultCache().set(key, {
90578
- diagnostics: transform.diagnostics,
90579
- text: writer.getText(),
90580
- sourceMap: sourceMap,
90581
- sourceMapData: sourceMapData,
90582
- sourceMapUrlPos: sourceMapUrlPos,
90583
- exportedModulesFromDeclarationEmit: sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.exportedModulesFromDeclarationEmit,
90584
- });
90585
- }
90547
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
90586
90548
  writer.clear();
90587
90549
  }
90588
90550
  function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
@@ -90788,7 +90750,6 @@ var ts;
90788
90750
  getSourceFileFromReference: ts.returnUndefined,
90789
90751
  redirectTargetsMap: ts.createMultiMap(),
90790
90752
  getFileIncludeReasons: ts.notImplemented,
90791
- getDtsEmitResultCache: function () { return new ts.Map(); },
90792
90753
  };
90793
90754
  emitFiles(ts.notImplementedResolver, emitHost, undefined, ts.getTransformers(config.options, customTransformers));
90794
90755
  return outputFiles;
@@ -96220,7 +96181,6 @@ var ts;
96220
96181
  var sourceFileToPackageName = new ts.Map();
96221
96182
  var redirectTargetsMap = ts.createMultiMap();
96222
96183
  var usesUriStyleNodeCoreModules = false;
96223
- var cacheDtsEmitResult;
96224
96184
  var filesByName = new ts.Map();
96225
96185
  var missingFilePaths;
96226
96186
  var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? new ts.Map() : undefined;
@@ -96853,7 +96813,6 @@ var ts;
96853
96813
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
96854
96814
  redirectTargetsMap: redirectTargetsMap,
96855
96815
  getFileIncludeReasons: program.getFileIncludeReasons,
96856
- getDtsEmitResultCache: function () { return cacheDtsEmitResult || (cacheDtsEmitResult = new ts.Map()); },
96857
96816
  };
96858
96817
  }
96859
96818
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -97259,30 +97218,7 @@ var ts;
97259
97218
  function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
97260
97219
  return runWithCancellationToken(function () {
97261
97220
  var resolver = getTypeChecker().getEmitResolver(sourceFile, cancellationToken);
97262
- var emitHost = getEmitHost(ts.noop);
97263
- if (sourceFile) {
97264
- if (!ts.outFile(options)) {
97265
- var existing = cacheDtsEmitResult === null || cacheDtsEmitResult === void 0 ? void 0 : cacheDtsEmitResult.get(sourceFile.resolvedPath);
97266
- if (existing)
97267
- return existing.diagnostics || ts.emptyArray;
97268
- }
97269
- var result = ts.transformNodes(resolver, emitHost, ts.factory, options, [sourceFile], [ts.transformDeclarations], false);
97270
- if (!ts.outFile(options)) {
97271
- (cacheDtsEmitResult || (cacheDtsEmitResult = new ts.Map())).set(sourceFile.resolvedPath, result);
97272
- }
97273
- return result.diagnostics || ts.emptyArray;
97274
- }
97275
- var diagnostics;
97276
- ts.forEachEmittedFile(emitHost, function (_emitFileNames, sourceFileOrBundle) {
97277
- var key = ts.getCacheDtsEmitResultKey(sourceFileOrBundle, options);
97278
- var existing = cacheDtsEmitResult === null || cacheDtsEmitResult === void 0 ? void 0 : cacheDtsEmitResult.get(key);
97279
- if (existing)
97280
- return existing.diagnostics || ts.emptyArray;
97281
- var result = ts.transformNodes(resolver, emitHost, ts.factory, options, [sourceFileOrBundle], [ts.transformDeclarations], false);
97282
- diagnostics = ts.addRange(diagnostics, result.diagnostics);
97283
- (cacheDtsEmitResult || (cacheDtsEmitResult = new ts.Map())).set(key, result);
97284
- });
97285
- return diagnostics || ts.emptyArray;
97221
+ return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile) || ts.emptyArray;
97286
97222
  });
97287
97223
  }
97288
97224
  function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics) {
@@ -98771,8 +98707,8 @@ var ts;
98771
98707
  (function (ts) {
98772
98708
  function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit) {
98773
98709
  var outputFiles = [];
98774
- var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics;
98775
- return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics };
98710
+ var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics, exportedModulesFromDeclarationEmit = _a.exportedModulesFromDeclarationEmit;
98711
+ return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics, exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit };
98776
98712
  function writeFile(fileName, text, writeByteOrderMark) {
98777
98713
  outputFiles.push({ name: fileName, writeByteOrderMark: writeByteOrderMark, text: text });
98778
98714
  }
@@ -98998,10 +98934,6 @@ var ts;
98998
98934
  state.hasCalledUpdateShapeSignature.add(path);
98999
98935
  }
99000
98936
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
99001
- function getSignatureFromWriteFileText(text, data, computeHash) {
99002
- return (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
99003
- }
99004
- BuilderState.getSignatureFromWriteFileText = getSignatureFromWriteFileText;
99005
98937
  function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
99006
98938
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
99007
98939
  ts.Debug.assert(!!sourceFile);
@@ -99015,14 +98947,15 @@ var ts;
99015
98947
  var prevSignature = info.signature;
99016
98948
  var latestSignature;
99017
98949
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
99018
- programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, _sourceFiles, data) {
99019
- ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts");
99020
- ts.Debug.assert(latestSignature === undefined, "Only one file should be set");
99021
- latestSignature = getSignatureFromWriteFileText(text, data, computeHash);
98950
+ var emitOutput_1 = getFileEmitOutput(programOfThisState, sourceFile, true, cancellationToken, undefined, true);
98951
+ var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
98952
+ if (firstDts_1) {
98953
+ ts.Debug.assert(ts.isDeclarationFileName(firstDts_1.name), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
98954
+ latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
99022
98955
  if (exportedModulesMapCache && latestSignature !== prevSignature) {
99023
- updateExportedModules(sourceFile, data === null || data === void 0 ? void 0 : data.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
98956
+ updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
99024
98957
  }
99025
- }, cancellationToken, true, undefined, true);
98958
+ }
99026
98959
  }
99027
98960
  if (latestSignature === undefined) {
99028
98961
  latestSignature = sourceFile.version;
@@ -99847,7 +99780,7 @@ var ts;
99847
99780
  var info = state.fileInfos.get(file.resolvedPath);
99848
99781
  var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
99849
99782
  if (signature === file.version) {
99850
- var newSignature = ts.BuilderState.getSignatureFromWriteFileText(text, data, computeHash);
99783
+ var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
99851
99784
  if (newSignature !== file.version) {
99852
99785
  if (host.storeFilesChangingSignatureDuringEmit)
99853
99786
  (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
package/lib/tsserver.js CHANGED
@@ -82616,7 +82616,7 @@ var ts;
82616
82616
  var childSymbol = getSymbolAtLocation(childNode);
82617
82617
  if (childSymbol && childSymbol === testedSymbol) {
82618
82618
  // If the test was a simple identifier, the above check is sufficient
82619
- if (ts.isIdentifier(expr)) {
82619
+ if (ts.isIdentifier(expr) || ts.isIdentifier(testedNode) && ts.isBinaryExpression(testedNode.parent)) {
82620
82620
  return true;
82621
82621
  }
82622
82622
  // Otherwise we need to ensure the symbol is called on the same target
@@ -107909,6 +107909,12 @@ var ts;
107909
107909
  /*@internal*/
107910
107910
  var ts;
107911
107911
  (function (ts) {
107912
+ function getDeclarationDiagnostics(host, resolver, file) {
107913
+ var compilerOptions = host.getCompilerOptions();
107914
+ var result = ts.transformNodes(resolver, host, ts.factory, compilerOptions, file ? [file] : ts.filter(host.getSourceFiles(), ts.isSourceFileNotJson), [transformDeclarations], /*allowDtsFiles*/ false);
107915
+ return result.diagnostics;
107916
+ }
107917
+ ts.getDeclarationDiagnostics = getDeclarationDiagnostics;
107912
107918
  function hasInternalAnnotation(range, currentSourceFile) {
107913
107919
  var comment = currentSourceFile.text.substring(range.pos, range.end);
107914
107920
  return ts.stringContains(comment, "@internal");
@@ -110092,14 +110098,6 @@ var ts;
110092
110098
  }
110093
110099
  ts.getFirstProjectOutput = getFirstProjectOutput;
110094
110100
  /*@internal*/
110095
- function getCacheDtsEmitResultKey(sourceFileOrBundle, options) {
110096
- return ts.isSourceFile(sourceFileOrBundle) ? sourceFileOrBundle.resolvedPath : ts.outFile(options);
110097
- }
110098
- ts.getCacheDtsEmitResultKey = getCacheDtsEmitResultKey;
110099
- function isForceDtsEmitResult(result) {
110100
- return !!result && !result.transformed;
110101
- }
110102
- /*@internal*/
110103
110101
  // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
110104
110102
  function emitFiles(resolver, host, targetSourceFile, _a, emitOnlyDtsFiles, onlyBuildInfo, forceDtsEmit) {
110105
110103
  var scriptTransformers = _a.scriptTransformers, declarationTransformers = _a.declarationTransformers;
@@ -110112,6 +110110,7 @@ var ts;
110112
110110
  var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
110113
110111
  var bundleBuildInfo;
110114
110112
  var emitSkipped = false;
110113
+ var exportedModulesFromDeclarationEmit;
110115
110114
  // Emit each output file
110116
110115
  enter();
110117
110116
  forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit), forceDtsEmit, onlyBuildInfo, !targetSourceFile);
@@ -110121,6 +110120,7 @@ var ts;
110121
110120
  diagnostics: emitterDiagnostics.getDiagnostics(),
110122
110121
  emittedFiles: emittedFilesList,
110123
110122
  sourceMaps: sourceMapDataList,
110123
+ exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit
110124
110124
  };
110125
110125
  function emitSourceFileOrBundle(_a, sourceFileOrBundle) {
110126
110126
  var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
@@ -110209,14 +110209,14 @@ var ts;
110209
110209
  isEmitNotificationEnabled: transform.isEmitNotificationEnabled,
110210
110210
  substituteNode: transform.substituteNode,
110211
110211
  });
110212
- printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, compilerOptions);
110212
+ ts.Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform");
110213
+ printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform.transformed[0], printer, compilerOptions);
110213
110214
  // Clean up emit nodes on parse tree
110214
110215
  transform.dispose();
110215
110216
  if (bundleBuildInfo)
110216
110217
  bundleBuildInfo.js = printer.bundleFileInfo;
110217
110218
  }
110218
110219
  function emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo) {
110219
- var _a, _b;
110220
110220
  if (!sourceFileOrBundle)
110221
110221
  return;
110222
110222
  if (!declarationFilePath) {
@@ -110228,43 +110228,15 @@ var ts;
110228
110228
  var filesForEmit = forceDtsEmit ? sourceFiles : ts.filter(sourceFiles, ts.isSourceFileNotJson);
110229
110229
  // Setup and perform the transformation to retrieve declarations from the input files
110230
110230
  var inputListOrBundle = ts.outFile(compilerOptions) ? [ts.factory.createBundle(filesForEmit, !ts.isSourceFile(sourceFileOrBundle) ? sourceFileOrBundle.prepends : undefined)] : filesForEmit;
110231
- // Use existing result:
110232
- var key = getCacheDtsEmitResultKey(sourceFileOrBundle, compilerOptions);
110233
- var cache = host.getDtsEmitResultCache();
110234
- var existing = declarationTransformers.length === 1 ? cache.get(key) : undefined;
110235
- if (isForceDtsEmitResult(existing)) {
110236
- if ((_a = existing.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
110237
- for (var _c = 0, _d = existing.diagnostics; _c < _d.length; _c++) {
110238
- var diagnostic = _d[_c];
110239
- emitterDiagnostics.add(diagnostic);
110240
- }
110241
- }
110242
- var declBlocked_1 = !!((_b = existing.diagnostics) === null || _b === void 0 ? void 0 : _b.length) || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit;
110243
- emitSkipped = emitSkipped || declBlocked_1;
110244
- if (!declBlocked_1 || forceDtsEmit) {
110245
- // Write the output file
110246
- if (declarationMapPath && !forceDtsEmit) {
110247
- if (sourceMapDataList && existing.sourceMapData) {
110248
- sourceMapDataList.push(existing.sourceMapData);
110249
- }
110250
- ts.writeFile(host, emitterDiagnostics, declarationMapPath, existing.sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110251
- }
110252
- ts.writeFile(host, emitterDiagnostics, declarationFilePath, existing.text, !!compilerOptions.emitBOM, filesForEmit, {
110253
- sourceMapUrlPos: existing.sourceMapUrlPos,
110254
- exportedModulesFromDeclarationEmit: existing.exportedModulesFromDeclarationEmit,
110255
- });
110256
- }
110257
- return;
110258
- }
110259
- if (!existing && emitOnlyDtsFiles && !ts.getEmitDeclarations(compilerOptions)) {
110231
+ if (emitOnlyDtsFiles && !ts.getEmitDeclarations(compilerOptions)) {
110260
110232
  // Checker wont collect the linked aliases since thats only done when declaration is enabled.
110261
110233
  // Do that here when emitting only dts files
110262
110234
  filesForEmit.forEach(collectLinkedAliases);
110263
110235
  }
110264
- var declarationTransform = existing || ts.transformNodes(resolver, host, ts.factory, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false);
110236
+ var declarationTransform = ts.transformNodes(resolver, host, ts.factory, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false);
110265
110237
  if (ts.length(declarationTransform.diagnostics)) {
110266
- for (var _e = 0, _f = declarationTransform.diagnostics; _e < _f.length; _e++) {
110267
- var diagnostic = _f[_e];
110238
+ for (var _a = 0, _b = declarationTransform.diagnostics; _a < _b.length; _a++) {
110239
+ var diagnostic = _b[_a];
110268
110240
  emitterDiagnostics.add(diagnostic);
110269
110241
  }
110270
110242
  }
@@ -110274,8 +110246,8 @@ var ts;
110274
110246
  noEmitHelpers: true,
110275
110247
  module: compilerOptions.module,
110276
110248
  target: compilerOptions.target,
110277
- // Emit maps when there is noEmit not set with forceDtsEmit
110278
- sourceMap: (!forceDtsEmit || !compilerOptions.noEmit) && compilerOptions.declarationMap,
110249
+ sourceMap: compilerOptions.sourceMap,
110250
+ inlineSourceMap: compilerOptions.inlineSourceMap,
110279
110251
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
110280
110252
  onlyPrintJsDocStyle: true,
110281
110253
  writeBundleFileInfo: !!bundleBuildInfo,
@@ -110293,13 +110265,18 @@ var ts;
110293
110265
  var declBlocked = (!!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length) || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit;
110294
110266
  emitSkipped = emitSkipped || declBlocked;
110295
110267
  if (!declBlocked || forceDtsEmit) {
110296
- printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform, declarationPrinter, {
110297
- sourceMap: printerOptions.sourceMap,
110268
+ ts.Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
110269
+ printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], declarationPrinter, {
110270
+ sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
110298
110271
  sourceRoot: compilerOptions.sourceRoot,
110299
110272
  mapRoot: compilerOptions.mapRoot,
110300
110273
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
110301
110274
  // Explicitly do not passthru either `inline` option
110302
110275
  });
110276
+ if (forceDtsEmit && declarationTransform.transformed[0].kind === 305 /* SourceFile */) {
110277
+ var sourceFile = declarationTransform.transformed[0];
110278
+ exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
110279
+ }
110303
110280
  }
110304
110281
  declarationTransform.dispose();
110305
110282
  if (bundleBuildInfo)
@@ -110318,9 +110295,7 @@ var ts;
110318
110295
  }
110319
110296
  ts.forEachChild(node, collectLinkedAliases);
110320
110297
  }
110321
- function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) {
110322
- ts.Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform");
110323
- var sourceFileOrBundle = transform.transformed[0];
110298
+ function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapOptions) {
110324
110299
  var bundle = sourceFileOrBundle.kind === 306 /* Bundle */ ? sourceFileOrBundle : undefined;
110325
110300
  var sourceFile = sourceFileOrBundle.kind === 305 /* SourceFile */ ? sourceFileOrBundle : undefined;
110326
110301
  var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
@@ -110335,11 +110310,9 @@ var ts;
110335
110310
  printer.writeFile(sourceFile, writer, sourceMapGenerator);
110336
110311
  }
110337
110312
  var sourceMapUrlPos;
110338
- var sourceMap;
110339
- var sourceMapData;
110340
110313
  if (sourceMapGenerator) {
110341
110314
  if (sourceMapDataList) {
110342
- sourceMapDataList.push(sourceMapData = {
110315
+ sourceMapDataList.push({
110343
110316
  inputSourceFileNames: sourceMapGenerator.getSources(),
110344
110317
  sourceMap: sourceMapGenerator.toJSON()
110345
110318
  });
@@ -110353,31 +110326,15 @@ var ts;
110353
110326
  }
110354
110327
  // Write the source map
110355
110328
  if (sourceMapFilePath) {
110356
- sourceMap = sourceMapGenerator.toString();
110357
- if (!forceDtsEmit)
110358
- ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110329
+ var sourceMap = sourceMapGenerator.toString();
110330
+ ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110359
110331
  }
110360
110332
  }
110361
110333
  else {
110362
110334
  writer.writeLine();
110363
110335
  }
110364
110336
  // Write the output file
110365
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, {
110366
- sourceMapUrlPos: sourceMapUrlPos,
110367
- exportedModulesFromDeclarationEmit: sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.exportedModulesFromDeclarationEmit,
110368
- });
110369
- if (forceDtsEmit) {
110370
- // Store the result
110371
- var key = getCacheDtsEmitResultKey(sourceFileOrBundle, compilerOptions);
110372
- host.getDtsEmitResultCache().set(key, {
110373
- diagnostics: transform.diagnostics,
110374
- text: writer.getText(),
110375
- sourceMap: sourceMap,
110376
- sourceMapData: sourceMapData,
110377
- sourceMapUrlPos: sourceMapUrlPos,
110378
- exportedModulesFromDeclarationEmit: sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.exportedModulesFromDeclarationEmit,
110379
- });
110380
- }
110337
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110381
110338
  // Reset state
110382
110339
  writer.clear();
110383
110340
  }
@@ -110606,7 +110563,6 @@ var ts;
110606
110563
  getSourceFileFromReference: ts.returnUndefined,
110607
110564
  redirectTargetsMap: ts.createMultiMap(),
110608
110565
  getFileIncludeReasons: ts.notImplemented,
110609
- getDtsEmitResultCache: function () { return new ts.Map(); },
110610
110566
  };
110611
110567
  emitFiles(ts.notImplementedResolver, emitHost,
110612
110568
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -116596,7 +116552,6 @@ var ts;
116596
116552
  // Key is a file name. Value is the (non-empty, or undefined) list of files that redirect to it.
116597
116553
  var redirectTargetsMap = ts.createMultiMap();
116598
116554
  var usesUriStyleNodeCoreModules = false;
116599
- var cacheDtsEmitResult;
116600
116555
  /**
116601
116556
  * map with
116602
116557
  * - SourceFile if present
@@ -117356,7 +117311,6 @@ var ts;
117356
117311
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
117357
117312
  redirectTargetsMap: redirectTargetsMap,
117358
117313
  getFileIncludeReasons: program.getFileIncludeReasons,
117359
- getDtsEmitResultCache: function () { return cacheDtsEmitResult || (cacheDtsEmitResult = new ts.Map()); },
117360
117314
  };
117361
117315
  }
117362
117316
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -117815,31 +117769,7 @@ var ts;
117815
117769
  return runWithCancellationToken(function () {
117816
117770
  var resolver = getTypeChecker().getEmitResolver(sourceFile, cancellationToken);
117817
117771
  // Don't actually write any files since we're just getting diagnostics.
117818
- var emitHost = getEmitHost(ts.noop);
117819
- if (sourceFile) {
117820
- if (!ts.outFile(options)) {
117821
- // Check from cache
117822
- var existing = cacheDtsEmitResult === null || cacheDtsEmitResult === void 0 ? void 0 : cacheDtsEmitResult.get(sourceFile.resolvedPath);
117823
- if (existing)
117824
- return existing.diagnostics || ts.emptyArray;
117825
- }
117826
- var result = ts.transformNodes(resolver, emitHost, ts.factory, options, [sourceFile], [ts.transformDeclarations], /*allowDtsFiles*/ false);
117827
- if (!ts.outFile(options)) {
117828
- (cacheDtsEmitResult || (cacheDtsEmitResult = new ts.Map())).set(sourceFile.resolvedPath, result);
117829
- }
117830
- return result.diagnostics || ts.emptyArray;
117831
- }
117832
- var diagnostics;
117833
- ts.forEachEmittedFile(emitHost, function (_emitFileNames, sourceFileOrBundle) {
117834
- var key = ts.getCacheDtsEmitResultKey(sourceFileOrBundle, options);
117835
- var existing = cacheDtsEmitResult === null || cacheDtsEmitResult === void 0 ? void 0 : cacheDtsEmitResult.get(key);
117836
- if (existing)
117837
- return existing.diagnostics || ts.emptyArray;
117838
- var result = ts.transformNodes(resolver, emitHost, ts.factory, options, [sourceFileOrBundle], [ts.transformDeclarations], /*allowDtsFiles*/ false);
117839
- diagnostics = ts.addRange(diagnostics, result.diagnostics);
117840
- (cacheDtsEmitResult || (cacheDtsEmitResult = new ts.Map())).set(key, result);
117841
- });
117842
- return diagnostics || ts.emptyArray;
117772
+ return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile) || ts.emptyArray;
117843
117773
  });
117844
117774
  }
117845
117775
  function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics) {
@@ -119482,8 +119412,8 @@ var ts;
119482
119412
  (function (ts) {
119483
119413
  function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit) {
119484
119414
  var outputFiles = [];
119485
- var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics;
119486
- return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics };
119415
+ var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics, exportedModulesFromDeclarationEmit = _a.exportedModulesFromDeclarationEmit;
119416
+ return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics, exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit };
119487
119417
  function writeFile(fileName, text, writeByteOrderMark) {
119488
119418
  outputFiles.push({ name: fileName, writeByteOrderMark: writeByteOrderMark, text: text });
119489
119419
  }
@@ -119755,10 +119685,6 @@ var ts;
119755
119685
  state.hasCalledUpdateShapeSignature.add(path);
119756
119686
  }
119757
119687
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119758
- function getSignatureFromWriteFileText(text, data, computeHash) {
119759
- return (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
119760
- }
119761
- BuilderState.getSignatureFromWriteFileText = getSignatureFromWriteFileText;
119762
119688
  /**
119763
119689
  * Returns if the shape of the signature has changed since last emit
119764
119690
  */
@@ -119776,17 +119702,18 @@ var ts;
119776
119702
  var prevSignature = info.signature;
119777
119703
  var latestSignature;
119778
119704
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
119779
- programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, _sourceFiles, data) {
119780
- ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts");
119781
- ts.Debug.assert(latestSignature === undefined, "Only one file should be set");
119782
- latestSignature = getSignatureFromWriteFileText(text, data, computeHash);
119783
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119784
- updateExportedModules(sourceFile, data === null || data === void 0 ? void 0 : data.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119785
- }
119786
- }, cancellationToken,
119787
- /*emitOnlyDtsFiles*/ true,
119705
+ var emitOutput_1 = getFileEmitOutput(programOfThisState, sourceFile,
119706
+ /*emitOnlyDtsFiles*/ true, cancellationToken,
119788
119707
  /*customTransformers*/ undefined,
119789
119708
  /*forceDtsEmit*/ true);
119709
+ var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119710
+ if (firstDts_1) {
119711
+ ts.Debug.assert(ts.isDeclarationFileName(firstDts_1.name), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
119712
+ latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119713
+ if (exportedModulesMapCache && latestSignature !== prevSignature) {
119714
+ updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119715
+ }
119716
+ }
119790
119717
  }
119791
119718
  // Default is to use file version as signature
119792
119719
  if (latestSignature === undefined) {
@@ -120809,7 +120736,7 @@ var ts;
120809
120736
  var info = state.fileInfos.get(file.resolvedPath);
120810
120737
  var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120811
120738
  if (signature === file.version) {
120812
- var newSignature = ts.BuilderState.getSignatureFromWriteFileText(text, data, computeHash);
120739
+ var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120813
120740
  if (newSignature !== file.version) { // Update it
120814
120741
  if (host.storeFilesChangingSignatureDuringEmit)
120815
120742
  (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);