typescript 4.8.0-dev.20220627 → 4.8.0-dev.20220628

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
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.8";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220627";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220628";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -26618,11 +26618,11 @@ var ts;
26618
26618
  }
26619
26619
  return parseElement();
26620
26620
  }
26621
- function currentNode(parsingContext) {
26621
+ function currentNode(parsingContext, pos) {
26622
26622
  if (!syntaxCursor || !isReusableParsingContext(parsingContext) || parseErrorBeforeNextFinishedNode) {
26623
26623
  return undefined;
26624
26624
  }
26625
- var node = syntaxCursor.currentNode(scanner.getStartPos());
26625
+ var node = syntaxCursor.currentNode(pos !== null && pos !== void 0 ? pos : scanner.getStartPos());
26626
26626
  if (ts.nodeIsMissing(node) || node.intersectsChange || ts.containsParseError(node)) {
26627
26627
  return undefined;
26628
26628
  }
@@ -29480,18 +29480,16 @@ var ts;
29480
29480
  return modifier.kind === 135;
29481
29481
  }
29482
29482
  function parseDeclaration() {
29483
- var isAmbient = ts.some(lookAhead(function () { return (parseDecorators(), parseModifiers()); }), isDeclareModifier);
29484
- if (isAmbient) {
29485
- var node = tryReuseAmbientDeclaration();
29486
- if (node) {
29487
- return node;
29488
- }
29489
- }
29490
29483
  var pos = getNodePos();
29491
29484
  var hasJSDoc = hasPrecedingJSDocComment();
29492
29485
  var decorators = parseDecorators();
29493
29486
  var modifiers = parseModifiers();
29487
+ var isAmbient = ts.some(modifiers, isDeclareModifier);
29494
29488
  if (isAmbient) {
29489
+ var node = tryReuseAmbientDeclaration(pos);
29490
+ if (node) {
29491
+ return node;
29492
+ }
29495
29493
  for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
29496
29494
  var m = _a[_i];
29497
29495
  m.flags |= 16777216;
@@ -29502,9 +29500,9 @@ var ts;
29502
29500
  return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers);
29503
29501
  }
29504
29502
  }
29505
- function tryReuseAmbientDeclaration() {
29503
+ function tryReuseAmbientDeclaration(pos) {
29506
29504
  return doInsideOfContext(16777216, function () {
29507
- var node = currentNode(parsingContext);
29505
+ var node = currentNode(parsingContext, pos);
29508
29506
  if (node) {
29509
29507
  return consumeNode(node);
29510
29508
  }
@@ -73993,10 +73991,16 @@ var ts;
73993
73991
  if (!fileToDirective) {
73994
73992
  return undefined;
73995
73993
  }
73996
- var meaning = 788968 | 1920;
73997
- if ((node.kind === 79 && isInTypeQuery(node)) || (node.kind === 206 && !isInHeritageClause(node))) {
73994
+ var meaning;
73995
+ if (node.parent.kind === 162) {
73998
73996
  meaning = 111551 | 1048576;
73999
73997
  }
73998
+ else {
73999
+ meaning = 788968 | 1920;
74000
+ if ((node.kind === 79 && isInTypeQuery(node)) || (node.kind === 206 && !isInHeritageClause(node))) {
74001
+ meaning = 111551 | 1048576;
74002
+ }
74003
+ }
74000
74004
  var symbol = resolveEntityName(node, meaning, true);
74001
74005
  return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;
74002
74006
  }
@@ -91407,7 +91411,6 @@ var ts;
91407
91411
  var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
91408
91412
  var bundleBuildInfo;
91409
91413
  var emitSkipped = false;
91410
- var exportedModulesFromDeclarationEmit;
91411
91414
  enter();
91412
91415
  forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit), forceDtsEmit, onlyBuildInfo, !targetSourceFile);
91413
91416
  exit();
@@ -91416,7 +91419,6 @@ var ts;
91416
91419
  diagnostics: emitterDiagnostics.getDiagnostics(),
91417
91420
  emittedFiles: emittedFilesList,
91418
91421
  sourceMaps: sourceMapDataList,
91419
- exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit
91420
91422
  };
91421
91423
  function emitSourceFileOrBundle(_a, sourceFileOrBundle) {
91422
91424
  var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
@@ -91501,7 +91503,7 @@ var ts;
91501
91503
  substituteNode: transform.substituteNode,
91502
91504
  });
91503
91505
  ts.Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform");
91504
- printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform.transformed[0], printer, compilerOptions);
91506
+ printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, compilerOptions);
91505
91507
  transform.dispose();
91506
91508
  if (bundleBuildInfo)
91507
91509
  bundleBuildInfo.js = printer.bundleFileInfo;
@@ -91533,7 +91535,7 @@ var ts;
91533
91535
  noEmitHelpers: true,
91534
91536
  module: compilerOptions.module,
91535
91537
  target: compilerOptions.target,
91536
- sourceMap: compilerOptions.sourceMap,
91538
+ sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
91537
91539
  inlineSourceMap: compilerOptions.inlineSourceMap,
91538
91540
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
91539
91541
  onlyPrintJsDocStyle: true,
@@ -91551,16 +91553,12 @@ var ts;
91551
91553
  emitSkipped = emitSkipped || declBlocked;
91552
91554
  if (!declBlocked || forceDtsEmit) {
91553
91555
  ts.Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
91554
- printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], declarationPrinter, {
91555
- sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
91556
+ printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform, declarationPrinter, {
91557
+ sourceMap: printerOptions.sourceMap,
91556
91558
  sourceRoot: compilerOptions.sourceRoot,
91557
91559
  mapRoot: compilerOptions.mapRoot,
91558
91560
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
91559
91561
  });
91560
- if (forceDtsEmit && declarationTransform.transformed[0].kind === 305) {
91561
- var sourceFile = declarationTransform.transformed[0];
91562
- exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
91563
- }
91564
91562
  }
91565
91563
  declarationTransform.dispose();
91566
91564
  if (bundleBuildInfo)
@@ -91579,7 +91577,8 @@ var ts;
91579
91577
  }
91580
91578
  ts.forEachChild(node, collectLinkedAliases);
91581
91579
  }
91582
- function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapOptions) {
91580
+ function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) {
91581
+ var sourceFileOrBundle = transform.transformed[0];
91583
91582
  var bundle = sourceFileOrBundle.kind === 306 ? sourceFileOrBundle : undefined;
91584
91583
  var sourceFile = sourceFileOrBundle.kind === 305 ? sourceFileOrBundle : undefined;
91585
91584
  var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
@@ -91612,16 +91611,16 @@ var ts;
91612
91611
  var sourceMap = sourceMapGenerator.toString();
91613
91612
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
91614
91613
  if (printer.bundleFileInfo)
91615
- printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
91614
+ printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
91616
91615
  }
91617
91616
  }
91618
91617
  else {
91619
91618
  writer.writeLine();
91620
91619
  }
91621
91620
  var text = writer.getText();
91622
- ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
91621
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos, diagnostics: transform.diagnostics });
91623
91622
  if (printer.bundleFileInfo)
91624
- printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
91623
+ printer.bundleFileInfo.hash = ts.computeSignature(text, ts.maybeBind(host, host.createHash));
91625
91624
  writer.clear();
91626
91625
  }
91627
91626
  function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
@@ -91766,22 +91765,22 @@ var ts;
91766
91765
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
91767
91766
  if (!jsFileText)
91768
91767
  return jsFilePath;
91769
- if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
91768
+ if (ts.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
91770
91769
  return jsFilePath;
91771
91770
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
91772
91771
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
91773
91772
  return sourceMapFilePath || "inline sourcemap decoding";
91774
- if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
91773
+ if (sourceMapFilePath && ts.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
91775
91774
  return sourceMapFilePath;
91776
91775
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
91777
91776
  if (declarationFilePath && !declarationText)
91778
91777
  return declarationFilePath;
91779
- if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
91778
+ if (declarationFilePath && ts.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
91780
91779
  return declarationFilePath;
91781
91780
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
91782
91781
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
91783
91782
  return declarationMapPath || "inline sourcemap decoding";
91784
- if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
91783
+ if (declarationMapPath && ts.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
91785
91784
  return declarationMapPath;
91786
91785
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
91787
91786
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo, true);
@@ -91819,7 +91818,7 @@ var ts;
91819
91818
  var newBuildInfo = data.buildInfo;
91820
91819
  newBuildInfo.program = buildInfo.program;
91821
91820
  if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
91822
- newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
91821
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
91823
91822
  newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
91824
91823
  }
91825
91824
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
@@ -99793,8 +99792,8 @@ var ts;
99793
99792
  (function (ts) {
99794
99793
  function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit) {
99795
99794
  var outputFiles = [];
99796
- var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics, exportedModulesFromDeclarationEmit = _a.exportedModulesFromDeclarationEmit;
99797
- return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics, exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit };
99795
+ var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics;
99796
+ return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics };
99798
99797
  function writeFile(fileName, text, writeByteOrderMark) {
99799
99798
  outputFiles.push({ name: fileName, writeByteOrderMark: writeByteOrderMark, text: text });
99800
99799
  }
@@ -99985,23 +99984,23 @@ var ts;
99985
99984
  state.allFileNames = undefined;
99986
99985
  }
99987
99986
  BuilderState.releaseCache = releaseCache;
99988
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
99987
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
99989
99988
  var _a, _b;
99990
- var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
99989
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName);
99991
99990
  (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
99992
99991
  (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
99993
99992
  return result;
99994
99993
  }
99995
99994
  BuilderState.getFilesAffectedBy = getFilesAffectedBy;
99996
- function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
99995
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
99997
99996
  var sourceFile = programOfThisState.getSourceFileByPath(path);
99998
99997
  if (!sourceFile) {
99999
99998
  return ts.emptyArray;
100000
99999
  }
100001
- if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
100000
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
100002
100001
  return [sourceFile];
100003
100002
  }
100004
- return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
100003
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName);
100005
100004
  }
100006
100005
  BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
100007
100006
  function updateSignatureOfFile(state, signature, path) {
@@ -100009,7 +100008,7 @@ var ts;
100009
100008
  (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
100010
100009
  }
100011
100010
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
100012
- function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
100011
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName, useFileVersionAsSignature) {
100013
100012
  var _a;
100014
100013
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
100015
100014
  if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
@@ -100018,15 +100017,13 @@ var ts;
100018
100017
  var prevSignature = info.signature;
100019
100018
  var latestSignature;
100020
100019
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
100021
- var emitOutput_1 = getFileEmitOutput(programOfThisState, sourceFile, true, cancellationToken, undefined, true);
100022
- var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
100023
- if (firstDts_1) {
100024
- 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; })); });
100025
- latestSignature = computeSignature(firstDts_1.text, computeHash);
100020
+ programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) {
100021
+ ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts: Got:: " + fileName);
100022
+ latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data);
100026
100023
  if (latestSignature !== prevSignature) {
100027
- updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
100024
+ updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
100028
100025
  }
100029
- }
100026
+ }, cancellationToken, true, undefined, true);
100030
100027
  }
100031
100028
  if (latestSignature === undefined) {
100032
100029
  latestSignature = sourceFile.version;
@@ -100047,10 +100044,6 @@ var ts;
100047
100044
  return latestSignature !== prevSignature;
100048
100045
  }
100049
100046
  BuilderState.updateShapeSignature = updateShapeSignature;
100050
- function computeSignature(text, computeHash) {
100051
- return (computeHash || ts.generateDjb2Hash)(text);
100052
- }
100053
- BuilderState.computeSignature = computeSignature;
100054
100047
  function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
100055
100048
  if (!state.exportedModulesMap)
100056
100049
  return;
@@ -100160,7 +100153,7 @@ var ts;
100160
100153
  }
100161
100154
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
100162
100155
  }
100163
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
100156
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash, getCanonicalFileName) {
100164
100157
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
100165
100158
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
100166
100159
  }
@@ -100176,7 +100169,7 @@ var ts;
100176
100169
  if (!seenFileNamesMap.has(currentPath)) {
100177
100170
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
100178
100171
  seenFileNamesMap.set(currentPath, currentSourceFile);
100179
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
100172
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
100180
100173
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
100181
100174
  }
100182
100175
  }
@@ -100332,7 +100325,7 @@ var ts;
100332
100325
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
100333
100326
  ts.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
100334
100327
  }
100335
- function getNextAffectedFile(state, cancellationToken, computeHash, host) {
100328
+ function getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host) {
100336
100329
  var _a, _b;
100337
100330
  while (true) {
100338
100331
  var affectedFiles = state.affectedFiles;
@@ -100343,7 +100336,7 @@ var ts;
100343
100336
  var affectedFile = affectedFiles[affectedFilesIndex];
100344
100337
  if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
100345
100338
  state.affectedFilesIndex = affectedFilesIndex;
100346
- handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
100339
+ handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
100347
100340
  return affectedFile;
100348
100341
  }
100349
100342
  affectedFilesIndex++;
@@ -100364,7 +100357,7 @@ var ts;
100364
100357
  ts.Debug.assert(!state.semanticDiagnosticsPerFile);
100365
100358
  return program;
100366
100359
  }
100367
- state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
100360
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash, getCanonicalFileName);
100368
100361
  state.currentChangedFilePath = nextKey.value;
100369
100362
  state.affectedFilesIndex = 0;
100370
100363
  if (!state.seenAffectedFiles)
@@ -100407,24 +100400,24 @@ var ts;
100407
100400
  });
100408
100401
  }
100409
100402
  }
100410
- function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
100403
+ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
100411
100404
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
100412
100405
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
100413
100406
  removeDiagnosticsOfLibraryFiles(state);
100414
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
100407
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash, getCanonicalFileName);
100415
100408
  return;
100416
100409
  }
100417
100410
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
100418
100411
  return;
100419
- handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
100412
+ handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
100420
100413
  }
100421
- function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
100414
+ function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, getCanonicalFileName, host) {
100422
100415
  removeSemanticDiagnosticsOf(state, path);
100423
100416
  if (!state.changedFilesSet.has(path)) {
100424
100417
  var program = ts.Debug.checkDefined(state.program);
100425
100418
  var sourceFile = program.getSourceFileByPath(path);
100426
100419
  if (sourceFile) {
100427
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
100420
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, getCanonicalFileName, !host.disableUseFileVersionAsSignature);
100428
100421
  if (ts.getEmitDeclarations(state.compilerOptions)) {
100429
100422
  addToAffectedFilesPendingEmit(state, path, 0);
100430
100423
  }
@@ -100444,16 +100437,16 @@ var ts;
100444
100437
  var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
100445
100438
  return newSignature !== oldSignature;
100446
100439
  }
100447
- function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
100440
+ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host) {
100448
100441
  var _a;
100449
100442
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
100450
100443
  return false;
100451
100444
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, undefined)
100452
- .forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
100445
+ .forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, getCanonicalFileName, host); });
100453
100446
  removeDiagnosticsOfLibraryFiles(state);
100454
100447
  return true;
100455
100448
  }
100456
- function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
100449
+ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
100457
100450
  var _a;
100458
100451
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
100459
100452
  return;
@@ -100467,9 +100460,9 @@ var ts;
100467
100460
  var currentPath = queue.pop();
100468
100461
  if (!seenFileNamesMap.has(currentPath)) {
100469
100462
  seenFileNamesMap.set(currentPath, true);
100470
- if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
100463
+ if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host))
100471
100464
  return;
100472
- handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
100465
+ handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host);
100473
100466
  if (isChangedSignature(state, currentPath)) {
100474
100467
  var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
100475
100468
  queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
@@ -100479,27 +100472,27 @@ var ts;
100479
100472
  }
100480
100473
  var seenFileAndExportsOfFile = new ts.Set();
100481
100474
  (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
100482
- if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
100475
+ if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, getCanonicalFileName, host))
100483
100476
  return true;
100484
100477
  var references = state.referencedMap.getKeys(exportedFromPath);
100485
100478
  return references && ts.forEachKey(references, function (filePath) {
100486
- return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
100479
+ return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
100487
100480
  });
100488
100481
  });
100489
100482
  }
100490
- function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
100483
+ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host) {
100491
100484
  var _a, _b;
100492
100485
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
100493
100486
  return undefined;
100494
- if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
100487
+ if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host))
100495
100488
  return true;
100496
- handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
100489
+ handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host);
100497
100490
  (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
100498
- return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
100491
+ return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
100499
100492
  });
100500
100493
  (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
100501
100494
  return !seenFileAndExportsOfFile.has(referencingFilePath) &&
100502
- handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, computeHash, host);
100495
+ handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, computeHash, getCanonicalFileName, host);
100503
100496
  });
100504
100497
  return undefined;
100505
100498
  }
@@ -100783,8 +100776,39 @@ var ts;
100783
100776
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
100784
100777
  }
100785
100778
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
100786
- function computeSignature(text, data, computeHash) {
100787
- return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
100779
+ function getTextHandlingSourceMapForSignature(text, data) {
100780
+ return (data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text;
100781
+ }
100782
+ function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data) {
100783
+ var _a;
100784
+ text = getTextHandlingSourceMapForSignature(text, data);
100785
+ var sourceFileDirectory;
100786
+ if ((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
100787
+ text += data.diagnostics.map(function (diagnostic) {
100788
+ return "" + locationInfo(diagnostic) + ts.DiagnosticCategory[diagnostic.category] + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText);
100789
+ }).join("\n");
100790
+ }
100791
+ return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(text);
100792
+ function flattenDiagnosticMessageText(diagnostic) {
100793
+ return ts.isString(diagnostic) ?
100794
+ diagnostic :
100795
+ diagnostic === undefined ?
100796
+ "" :
100797
+ !diagnostic.next ?
100798
+ diagnostic.messageText :
100799
+ diagnostic.messageText + diagnostic.next.map(flattenDiagnosticMessageText).join("\n");
100800
+ }
100801
+ function locationInfo(diagnostic) {
100802
+ if (diagnostic.file.resolvedPath === sourceFile.resolvedPath)
100803
+ return "(" + diagnostic.start + "," + diagnostic.length + ")";
100804
+ if (sourceFileDirectory === undefined)
100805
+ sourceFileDirectory = ts.getDirectoryPath(sourceFile.resolvedPath);
100806
+ return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceFileDirectory, diagnostic.file.resolvedPath, getCanonicalFileName)) + "(" + diagnostic.start + "," + diagnostic.length + ")";
100807
+ }
100808
+ }
100809
+ ts.computeSignatureWithDiagnostics = computeSignatureWithDiagnostics;
100810
+ function computeSignature(text, computeHash, data) {
100811
+ return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
100788
100812
  }
100789
100813
  ts.computeSignature = computeSignature;
100790
100814
  function createBuilderProgram(kind, _a) {
@@ -100832,7 +100856,7 @@ var ts;
100832
100856
  return ts.emitSkippedWithNoDiagnostics;
100833
100857
  }
100834
100858
  function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
100835
- var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
100859
+ var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
100836
100860
  var emitKind = 1;
100837
100861
  var isPendingEmitFile = false;
100838
100862
  if (!affected) {
@@ -100861,46 +100885,48 @@ var ts;
100861
100885
  }
100862
100886
  function getWriteFileCallback(writeFile, customTransformers) {
100863
100887
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
100864
- var _a, _b, _c;
100888
+ var _a, _b, _c, _d, _e, _f, _g;
100865
100889
  if (ts.isDeclarationFileName(fileName)) {
100866
100890
  if (!ts.outFile(state.compilerOptions)) {
100867
100891
  ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
100868
- var newSignature = void 0;
100892
+ var emitSignature = void 0;
100869
100893
  if (!customTransformers) {
100870
100894
  var file = sourceFiles[0];
100871
100895
  var info = state.fileInfos.get(file.resolvedPath);
100872
100896
  if (info.signature === file.version) {
100873
- newSignature = computeSignature(text, data, computeHash);
100874
- if (newSignature !== file.version) {
100897
+ var signature = computeSignatureWithDiagnostics(file, text, computeHash, getCanonicalFileName, data);
100898
+ if (!((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length))
100899
+ emitSignature = signature;
100900
+ if (signature !== file.version) {
100875
100901
  if (host.storeFilesChangingSignatureDuringEmit)
100876
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
100902
+ ((_b = state.filesChangingSignature) !== null && _b !== void 0 ? _b : (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
100877
100903
  if (state.exportedModulesMap)
100878
100904
  ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
100879
100905
  if (state.affectedFiles) {
100880
- var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
100906
+ var existing = (_c = state.oldSignatures) === null || _c === void 0 ? void 0 : _c.get(file.resolvedPath);
100881
100907
  if (existing === undefined)
100882
- (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
100883
- info.signature = newSignature;
100908
+ ((_d = state.oldSignatures) !== null && _d !== void 0 ? _d : (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
100909
+ info.signature = signature;
100884
100910
  }
100885
100911
  else {
100886
- info.signature = newSignature;
100887
- (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
100912
+ info.signature = signature;
100913
+ (_e = state.oldExportedModulesMap) === null || _e === void 0 ? void 0 : _e.clear();
100888
100914
  }
100889
100915
  }
100890
100916
  }
100891
100917
  }
100892
100918
  if (state.compilerOptions.composite) {
100893
100919
  var filePath = sourceFiles[0].resolvedPath;
100894
- var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
100895
- newSignature || (newSignature = computeSignature(text, data, computeHash));
100896
- if (newSignature !== oldSignature) {
100897
- (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
100920
+ var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
100921
+ emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
100922
+ if (emitSignature !== oldSignature) {
100923
+ ((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
100898
100924
  state.hasChangedEmitSignature = true;
100899
100925
  }
100900
100926
  }
100901
100927
  }
100902
100928
  else if (state.compilerOptions.composite) {
100903
- var newSignature = computeSignature(text, data, computeHash);
100929
+ var newSignature = computeSignature(text, computeHash, data);
100904
100930
  if (newSignature !== state.outSignature) {
100905
100931
  state.outSignature = newSignature;
100906
100932
  state.hasChangedEmitSignature = true;
@@ -100960,7 +100986,7 @@ var ts;
100960
100986
  }
100961
100987
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
100962
100988
  while (true) {
100963
- var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
100989
+ var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
100964
100990
  if (!affected) {
100965
100991
  return undefined;
100966
100992
  }