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.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-dev.20220627";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220628";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -32939,7 +32939,7 @@ var ts;
32939
32939
  }
32940
32940
  return parseElement();
32941
32941
  }
32942
- function currentNode(parsingContext) {
32942
+ function currentNode(parsingContext, pos) {
32943
32943
  // If we don't have a cursor or the parsing context isn't reusable, there's nothing to reuse.
32944
32944
  //
32945
32945
  // If there is an outstanding parse error that we've encountered, but not attached to
@@ -32952,7 +32952,7 @@ var ts;
32952
32952
  if (!syntaxCursor || !isReusableParsingContext(parsingContext) || parseErrorBeforeNextFinishedNode) {
32953
32953
  return undefined;
32954
32954
  }
32955
- var node = syntaxCursor.currentNode(scanner.getStartPos());
32955
+ var node = syntaxCursor.currentNode(pos !== null && pos !== void 0 ? pos : scanner.getStartPos());
32956
32956
  // Can't reuse a missing node.
32957
32957
  // Can't reuse a node that intersected the change range.
32958
32958
  // Can't reuse a node that contains a parse error. This is necessary so that we
@@ -36574,24 +36574,19 @@ var ts;
36574
36574
  return modifier.kind === 135 /* DeclareKeyword */;
36575
36575
  }
36576
36576
  function parseDeclaration() {
36577
- // TODO: Can we hold onto the parsed decorators/modifiers and advance the scanner
36578
- // if we can't reuse the declaration, so that we don't do this work twice?
36579
- //
36580
36577
  // `parseListElement` attempted to get the reused node at this position,
36581
36578
  // but the ambient context flag was not yet set, so the node appeared
36582
36579
  // not reusable in that context.
36583
- var isAmbient = ts.some(lookAhead(function () { return (parseDecorators(), parseModifiers()); }), isDeclareModifier);
36584
- if (isAmbient) {
36585
- var node = tryReuseAmbientDeclaration();
36586
- if (node) {
36587
- return node;
36588
- }
36589
- }
36590
36580
  var pos = getNodePos();
36591
36581
  var hasJSDoc = hasPrecedingJSDocComment();
36592
36582
  var decorators = parseDecorators();
36593
36583
  var modifiers = parseModifiers();
36584
+ var isAmbient = ts.some(modifiers, isDeclareModifier);
36594
36585
  if (isAmbient) {
36586
+ var node = tryReuseAmbientDeclaration(pos);
36587
+ if (node) {
36588
+ return node;
36589
+ }
36595
36590
  for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
36596
36591
  var m = _a[_i];
36597
36592
  m.flags |= 16777216 /* Ambient */;
@@ -36602,9 +36597,9 @@ var ts;
36602
36597
  return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers);
36603
36598
  }
36604
36599
  }
36605
- function tryReuseAmbientDeclaration() {
36600
+ function tryReuseAmbientDeclaration(pos) {
36606
36601
  return doInsideOfContext(16777216 /* Ambient */, function () {
36607
- var node = currentNode(parsingContext);
36602
+ var node = currentNode(parsingContext, pos);
36608
36603
  if (node) {
36609
36604
  return consumeNode(node);
36610
36605
  }
@@ -88040,13 +88035,20 @@ var ts;
88040
88035
  if (!fileToDirective) {
88041
88036
  return undefined;
88042
88037
  }
88038
+ // computed property name should use node as value
88043
88039
  // property access can only be used as values, or types when within an expression with type arguments inside a heritage clause
88044
88040
  // qualified names can only be used as types\namespaces
88045
88041
  // identifiers are treated as values only if they appear in type queries
88046
- var meaning = 788968 /* Type */ | 1920 /* Namespace */;
88047
- if ((node.kind === 79 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
88042
+ var meaning;
88043
+ if (node.parent.kind === 162 /* ComputedPropertyName */) {
88048
88044
  meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
88049
88045
  }
88046
+ else {
88047
+ meaning = 788968 /* Type */ | 1920 /* Namespace */;
88048
+ if ((node.kind === 79 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
88049
+ meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
88050
+ }
88051
+ }
88050
88052
  var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);
88051
88053
  return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;
88052
88054
  }
@@ -111158,7 +111160,6 @@ var ts;
111158
111160
  var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
111159
111161
  var bundleBuildInfo;
111160
111162
  var emitSkipped = false;
111161
- var exportedModulesFromDeclarationEmit;
111162
111163
  // Emit each output file
111163
111164
  enter();
111164
111165
  forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit), forceDtsEmit, onlyBuildInfo, !targetSourceFile);
@@ -111168,7 +111169,6 @@ var ts;
111168
111169
  diagnostics: emitterDiagnostics.getDiagnostics(),
111169
111170
  emittedFiles: emittedFilesList,
111170
111171
  sourceMaps: sourceMapDataList,
111171
- exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit
111172
111172
  };
111173
111173
  function emitSourceFileOrBundle(_a, sourceFileOrBundle) {
111174
111174
  var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
@@ -111260,7 +111260,7 @@ var ts;
111260
111260
  substituteNode: transform.substituteNode,
111261
111261
  });
111262
111262
  ts.Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform");
111263
- printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform.transformed[0], printer, compilerOptions);
111263
+ printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, compilerOptions);
111264
111264
  // Clean up emit nodes on parse tree
111265
111265
  transform.dispose();
111266
111266
  if (bundleBuildInfo)
@@ -111296,7 +111296,7 @@ var ts;
111296
111296
  noEmitHelpers: true,
111297
111297
  module: compilerOptions.module,
111298
111298
  target: compilerOptions.target,
111299
- sourceMap: compilerOptions.sourceMap,
111299
+ sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
111300
111300
  inlineSourceMap: compilerOptions.inlineSourceMap,
111301
111301
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
111302
111302
  onlyPrintJsDocStyle: true,
@@ -111316,17 +111316,13 @@ var ts;
111316
111316
  emitSkipped = emitSkipped || declBlocked;
111317
111317
  if (!declBlocked || forceDtsEmit) {
111318
111318
  ts.Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
111319
- printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], declarationPrinter, {
111320
- sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
111319
+ printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform, declarationPrinter, {
111320
+ sourceMap: printerOptions.sourceMap,
111321
111321
  sourceRoot: compilerOptions.sourceRoot,
111322
111322
  mapRoot: compilerOptions.mapRoot,
111323
111323
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
111324
111324
  // Explicitly do not passthru either `inline` option
111325
111325
  });
111326
- if (forceDtsEmit && declarationTransform.transformed[0].kind === 305 /* SourceFile */) {
111327
- var sourceFile = declarationTransform.transformed[0];
111328
- exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
111329
- }
111330
111326
  }
111331
111327
  declarationTransform.dispose();
111332
111328
  if (bundleBuildInfo)
@@ -111345,7 +111341,8 @@ var ts;
111345
111341
  }
111346
111342
  ts.forEachChild(node, collectLinkedAliases);
111347
111343
  }
111348
- function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapOptions) {
111344
+ function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) {
111345
+ var sourceFileOrBundle = transform.transformed[0];
111349
111346
  var bundle = sourceFileOrBundle.kind === 306 /* Bundle */ ? sourceFileOrBundle : undefined;
111350
111347
  var sourceFile = sourceFileOrBundle.kind === 305 /* SourceFile */ ? sourceFileOrBundle : undefined;
111351
111348
  var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
@@ -111379,7 +111376,7 @@ var ts;
111379
111376
  var sourceMap = sourceMapGenerator.toString();
111380
111377
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
111381
111378
  if (printer.bundleFileInfo)
111382
- printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
111379
+ printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
111383
111380
  }
111384
111381
  }
111385
111382
  else {
@@ -111387,11 +111384,11 @@ var ts;
111387
111384
  }
111388
111385
  // Write the output file
111389
111386
  var text = writer.getText();
111390
- ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
111387
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos, diagnostics: transform.diagnostics });
111391
111388
  // We store the hash of the text written in the buildinfo to ensure that text of the referenced d.ts file is same as whats in the buildinfo
111392
111389
  // This is needed because incremental can be toggled between two runs and we might use stale file text to do text manipulation in prepend mode
111393
111390
  if (printer.bundleFileInfo)
111394
- printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
111391
+ printer.bundleFileInfo.hash = ts.computeSignature(text, ts.maybeBind(host, host.createHash));
111395
111392
  // Reset state
111396
111393
  writer.clear();
111397
111394
  }
@@ -111556,25 +111553,25 @@ var ts;
111556
111553
  if (!jsFileText)
111557
111554
  return jsFilePath;
111558
111555
  // If the jsFileText is not same has what it was created with, tsbuildinfo is stale so dont use it
111559
- if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
111556
+ if (ts.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
111560
111557
  return jsFilePath;
111561
111558
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
111562
111559
  // error if no source map or for now if inline sourcemap
111563
111560
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
111564
111561
  return sourceMapFilePath || "inline sourcemap decoding";
111565
- if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
111562
+ if (sourceMapFilePath && ts.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
111566
111563
  return sourceMapFilePath;
111567
111564
  // read declaration text
111568
111565
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
111569
111566
  if (declarationFilePath && !declarationText)
111570
111567
  return declarationFilePath;
111571
- if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
111568
+ if (declarationFilePath && ts.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
111572
111569
  return declarationFilePath;
111573
111570
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
111574
111571
  // error if no source map or for now if inline sourcemap
111575
111572
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
111576
111573
  return declarationMapPath || "inline sourcemap decoding";
111577
- if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
111574
+ if (declarationMapPath && ts.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
111578
111575
  return declarationMapPath;
111579
111576
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
111580
111577
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
@@ -111614,7 +111611,7 @@ var ts;
111614
111611
  newBuildInfo.program = buildInfo.program;
111615
111612
  if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
111616
111613
  // Update the output signature
111617
- newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
111614
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
111618
111615
  newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
111619
111616
  }
111620
111617
  // Update sourceFileInfo
@@ -120499,8 +120496,8 @@ var ts;
120499
120496
  (function (ts) {
120500
120497
  function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit) {
120501
120498
  var outputFiles = [];
120502
- var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics, exportedModulesFromDeclarationEmit = _a.exportedModulesFromDeclarationEmit;
120503
- return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics, exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit };
120499
+ var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics;
120500
+ return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics };
120504
120501
  function writeFile(fileName, text, writeByteOrderMark) {
120505
120502
  outputFiles.push({ name: fileName, writeByteOrderMark: writeByteOrderMark, text: text });
120506
120503
  }
@@ -120724,23 +120721,23 @@ var ts;
120724
120721
  /**
120725
120722
  * Gets the files affected by the path from the program
120726
120723
  */
120727
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
120724
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
120728
120725
  var _a, _b;
120729
- var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
120726
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName);
120730
120727
  (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
120731
120728
  (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120732
120729
  return result;
120733
120730
  }
120734
120731
  BuilderState.getFilesAffectedBy = getFilesAffectedBy;
120735
- function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
120732
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
120736
120733
  var sourceFile = programOfThisState.getSourceFileByPath(path);
120737
120734
  if (!sourceFile) {
120738
120735
  return ts.emptyArray;
120739
120736
  }
120740
- if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
120737
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
120741
120738
  return [sourceFile];
120742
120739
  }
120743
- return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
120740
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName);
120744
120741
  }
120745
120742
  BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
120746
120743
  function updateSignatureOfFile(state, signature, path) {
@@ -120751,7 +120748,7 @@ var ts;
120751
120748
  /**
120752
120749
  * Returns if the shape of the signature has changed since last emit
120753
120750
  */
120754
- function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
120751
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName, useFileVersionAsSignature) {
120755
120752
  var _a;
120756
120753
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
120757
120754
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
@@ -120761,18 +120758,16 @@ var ts;
120761
120758
  var prevSignature = info.signature;
120762
120759
  var latestSignature;
120763
120760
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
120764
- var emitOutput_1 = getFileEmitOutput(programOfThisState, sourceFile,
120765
- /*emitOnlyDtsFiles*/ true, cancellationToken,
120766
- /*customTransformers*/ undefined,
120767
- /*forceDtsEmit*/ true);
120768
- var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
120769
- if (firstDts_1) {
120770
- 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; })); });
120771
- latestSignature = computeSignature(firstDts_1.text, computeHash);
120761
+ programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) {
120762
+ ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts: Got:: " + fileName);
120763
+ latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data);
120772
120764
  if (latestSignature !== prevSignature) {
120773
- updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
120765
+ updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
120774
120766
  }
120775
- }
120767
+ }, cancellationToken,
120768
+ /*emitOnlyDtsFiles*/ true,
120769
+ /*customTransformers*/ undefined,
120770
+ /*forceDtsEmit*/ true);
120776
120771
  }
120777
120772
  // Default is to use file version as signature
120778
120773
  if (latestSignature === undefined) {
@@ -120795,10 +120790,6 @@ var ts;
120795
120790
  return latestSignature !== prevSignature;
120796
120791
  }
120797
120792
  BuilderState.updateShapeSignature = updateShapeSignature;
120798
- function computeSignature(text, computeHash) {
120799
- return (computeHash || ts.generateDjb2Hash)(text);
120800
- }
120801
- BuilderState.computeSignature = computeSignature;
120802
120793
  /**
120803
120794
  * Coverts the declaration emit result into exported modules map
120804
120795
  */
@@ -120948,7 +120939,7 @@ var ts;
120948
120939
  /**
120949
120940
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
120950
120941
  */
120951
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
120942
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash, getCanonicalFileName) {
120952
120943
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
120953
120944
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
120954
120945
  }
@@ -120968,7 +120959,7 @@ var ts;
120968
120959
  if (!seenFileNamesMap.has(currentPath)) {
120969
120960
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
120970
120961
  seenFileNamesMap.set(currentPath, currentSourceFile);
120971
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
120962
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
120972
120963
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
120973
120964
  }
120974
120965
  }
@@ -121162,7 +121153,7 @@ var ts;
121162
121153
  * This is to allow the callers to be able to actually remove affected file only when the operation is complete
121163
121154
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
121164
121155
  */
121165
- function getNextAffectedFile(state, cancellationToken, computeHash, host) {
121156
+ function getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host) {
121166
121157
  var _a, _b;
121167
121158
  while (true) {
121168
121159
  var affectedFiles = state.affectedFiles;
@@ -121174,7 +121165,7 @@ var ts;
121174
121165
  if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
121175
121166
  // Set the next affected file as seen and remove the cached semantic diagnostics
121176
121167
  state.affectedFilesIndex = affectedFilesIndex;
121177
- handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
121168
+ handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
121178
121169
  return affectedFile;
121179
121170
  }
121180
121171
  affectedFilesIndex++;
@@ -121202,7 +121193,7 @@ var ts;
121202
121193
  return program;
121203
121194
  }
121204
121195
  // Get next batch of affected files
121205
- state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
121196
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash, getCanonicalFileName);
121206
121197
  state.currentChangedFilePath = nextKey.value;
121207
121198
  state.affectedFilesIndex = 0;
121208
121199
  if (!state.seenAffectedFiles)
@@ -121253,7 +121244,7 @@ var ts;
121253
121244
  * Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
121254
121245
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
121255
121246
  */
121256
- function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
121247
+ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
121257
121248
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
121258
121249
  // If affected files is everything except default library, then nothing more to do
121259
121250
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -121261,18 +121252,18 @@ var ts;
121261
121252
  // When a change affects the global scope, all files are considered to be affected without updating their signature
121262
121253
  // That means when affected file is handled, its signature can be out of date
121263
121254
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
121264
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
121255
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash, getCanonicalFileName);
121265
121256
  return;
121266
121257
  }
121267
121258
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
121268
121259
  return;
121269
- handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
121260
+ handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
121270
121261
  }
121271
121262
  /**
121272
121263
  * Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
121273
121264
  * Also we need to make sure signature is updated for these files
121274
121265
  */
121275
- function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
121266
+ function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, getCanonicalFileName, host) {
121276
121267
  removeSemanticDiagnosticsOf(state, path);
121277
121268
  if (!state.changedFilesSet.has(path)) {
121278
121269
  var program = ts.Debug.checkDefined(state.program);
@@ -121283,7 +121274,7 @@ var ts;
121283
121274
  // This ensures that we dont later during incremental builds considering wrong signature.
121284
121275
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
121285
121276
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
121286
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
121277
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, getCanonicalFileName, !host.disableUseFileVersionAsSignature);
121287
121278
  // If not dts emit, nothing more to do
121288
121279
  if (ts.getEmitDeclarations(state.compilerOptions)) {
121289
121280
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -121308,20 +121299,20 @@ var ts;
121308
121299
  var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
121309
121300
  return newSignature !== oldSignature;
121310
121301
  }
121311
- function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
121302
+ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host) {
121312
121303
  var _a;
121313
121304
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
121314
121305
  return false;
121315
121306
  // Every file needs to be handled
121316
121307
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
121317
- .forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
121308
+ .forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, getCanonicalFileName, host); });
121318
121309
  removeDiagnosticsOfLibraryFiles(state);
121319
121310
  return true;
121320
121311
  }
121321
121312
  /**
121322
121313
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
121323
121314
  */
121324
- function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
121315
+ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
121325
121316
  var _a;
121326
121317
  // If there was change in signature (dts output) for the changed file,
121327
121318
  // then only we need to handle pending file emit
@@ -121339,9 +121330,9 @@ var ts;
121339
121330
  var currentPath = queue.pop();
121340
121331
  if (!seenFileNamesMap.has(currentPath)) {
121341
121332
  seenFileNamesMap.set(currentPath, true);
121342
- if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
121333
+ if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host))
121343
121334
  return;
121344
- handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
121335
+ handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host);
121345
121336
  if (isChangedSignature(state, currentPath)) {
121346
121337
  var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
121347
121338
  queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
@@ -121353,11 +121344,11 @@ var ts;
121353
121344
  // Go through exported modules from cache first
121354
121345
  // If exported modules has path, all files referencing file exported from are affected
121355
121346
  (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
121356
- if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
121347
+ if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, getCanonicalFileName, host))
121357
121348
  return true;
121358
121349
  var references = state.referencedMap.getKeys(exportedFromPath);
121359
121350
  return references && ts.forEachKey(references, function (filePath) {
121360
- return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
121351
+ return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
121361
121352
  });
121362
121353
  });
121363
121354
  }
@@ -121365,22 +121356,22 @@ var ts;
121365
121356
  * handle dts and semantic diagnostics on file and iterate on anything that exports this file
121366
121357
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
121367
121358
  */
121368
- function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
121359
+ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host) {
121369
121360
  var _a, _b;
121370
121361
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
121371
121362
  return undefined;
121372
- if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
121363
+ if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host))
121373
121364
  return true;
121374
- handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
121365
+ handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host);
121375
121366
  // If exported modules has path, all files referencing file exported from are affected
121376
121367
  (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
121377
- return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
121368
+ return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
121378
121369
  });
121379
121370
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
121380
121371
  (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
121381
121372
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
121382
121373
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
121383
- state, referencingFilePath, cancellationToken, computeHash, host);
121374
+ state, referencingFilePath, cancellationToken, computeHash, getCanonicalFileName, host);
121384
121375
  });
121385
121376
  return undefined;
121386
121377
  }
@@ -121699,8 +121690,39 @@ var ts;
121699
121690
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
121700
121691
  }
121701
121692
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
121702
- function computeSignature(text, data, computeHash) {
121703
- return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
121693
+ function getTextHandlingSourceMapForSignature(text, data) {
121694
+ return (data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text;
121695
+ }
121696
+ function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data) {
121697
+ var _a;
121698
+ text = getTextHandlingSourceMapForSignature(text, data);
121699
+ var sourceFileDirectory;
121700
+ if ((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
121701
+ text += data.diagnostics.map(function (diagnostic) {
121702
+ return "" + locationInfo(diagnostic) + ts.DiagnosticCategory[diagnostic.category] + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText);
121703
+ }).join("\n");
121704
+ }
121705
+ return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(text);
121706
+ function flattenDiagnosticMessageText(diagnostic) {
121707
+ return ts.isString(diagnostic) ?
121708
+ diagnostic :
121709
+ diagnostic === undefined ?
121710
+ "" :
121711
+ !diagnostic.next ?
121712
+ diagnostic.messageText :
121713
+ diagnostic.messageText + diagnostic.next.map(flattenDiagnosticMessageText).join("\n");
121714
+ }
121715
+ function locationInfo(diagnostic) {
121716
+ if (diagnostic.file.resolvedPath === sourceFile.resolvedPath)
121717
+ return "(" + diagnostic.start + "," + diagnostic.length + ")";
121718
+ if (sourceFileDirectory === undefined)
121719
+ sourceFileDirectory = ts.getDirectoryPath(sourceFile.resolvedPath);
121720
+ return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceFileDirectory, diagnostic.file.resolvedPath, getCanonicalFileName)) + "(" + diagnostic.start + "," + diagnostic.length + ")";
121721
+ }
121722
+ }
121723
+ ts.computeSignatureWithDiagnostics = computeSignatureWithDiagnostics;
121724
+ function computeSignature(text, computeHash, data) {
121725
+ return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
121704
121726
  }
121705
121727
  ts.computeSignature = computeSignature;
121706
121728
  function createBuilderProgram(kind, _a) {
@@ -121761,7 +121783,7 @@ var ts;
121761
121783
  * in that order would be used to write the files
121762
121784
  */
121763
121785
  function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
121764
- var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
121786
+ var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
121765
121787
  var emitKind = 1 /* Full */;
121766
121788
  var isPendingEmitFile = false;
121767
121789
  if (!affected) {
@@ -121798,32 +121820,35 @@ var ts;
121798
121820
  }
121799
121821
  function getWriteFileCallback(writeFile, customTransformers) {
121800
121822
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
121801
- var _a, _b, _c;
121823
+ var _a, _b, _c, _d, _e, _f, _g;
121802
121824
  if (ts.isDeclarationFileName(fileName)) {
121803
121825
  if (!ts.outFile(state.compilerOptions)) {
121804
121826
  ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
121805
- var newSignature = void 0;
121827
+ var emitSignature = void 0;
121806
121828
  if (!customTransformers) {
121807
121829
  var file = sourceFiles[0];
121808
121830
  var info = state.fileInfos.get(file.resolvedPath);
121809
121831
  if (info.signature === file.version) {
121810
- newSignature = computeSignature(text, data, computeHash);
121811
- if (newSignature !== file.version) { // Update it
121832
+ var signature = computeSignatureWithDiagnostics(file, text, computeHash, getCanonicalFileName, data);
121833
+ // With d.ts diagnostics they are also part of the signature so emitSignature will be different from it since its just hash of d.ts
121834
+ if (!((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length))
121835
+ emitSignature = signature;
121836
+ if (signature !== file.version) { // Update it
121812
121837
  if (host.storeFilesChangingSignatureDuringEmit)
121813
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
121838
+ ((_b = state.filesChangingSignature) !== null && _b !== void 0 ? _b : (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
121814
121839
  if (state.exportedModulesMap)
121815
121840
  ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
121816
121841
  if (state.affectedFiles) {
121817
121842
  // Keep old signature so we know what to undo if cancellation happens
121818
- var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
121843
+ var existing = (_c = state.oldSignatures) === null || _c === void 0 ? void 0 : _c.get(file.resolvedPath);
121819
121844
  if (existing === undefined)
121820
- (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
121821
- info.signature = newSignature;
121845
+ ((_d = state.oldSignatures) !== null && _d !== void 0 ? _d : (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
121846
+ info.signature = signature;
121822
121847
  }
121823
121848
  else {
121824
121849
  // These are directly commited
121825
- info.signature = newSignature;
121826
- (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
121850
+ info.signature = signature;
121851
+ (_e = state.oldExportedModulesMap) === null || _e === void 0 ? void 0 : _e.clear();
121827
121852
  }
121828
121853
  }
121829
121854
  }
@@ -121833,16 +121858,16 @@ var ts;
121833
121858
  // and would need their d.ts change time in --build mode
121834
121859
  if (state.compilerOptions.composite) {
121835
121860
  var filePath = sourceFiles[0].resolvedPath;
121836
- var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
121837
- newSignature || (newSignature = computeSignature(text, data, computeHash));
121838
- if (newSignature !== oldSignature) {
121839
- (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
121861
+ var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
121862
+ emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
121863
+ if (emitSignature !== oldSignature) {
121864
+ ((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
121840
121865
  state.hasChangedEmitSignature = true;
121841
121866
  }
121842
121867
  }
121843
121868
  }
121844
121869
  else if (state.compilerOptions.composite) {
121845
- var newSignature = computeSignature(text, data, computeHash);
121870
+ var newSignature = computeSignature(text, computeHash, data);
121846
121871
  if (newSignature !== state.outSignature) {
121847
121872
  state.outSignature = newSignature;
121848
121873
  state.hasChangedEmitSignature = true;
@@ -121922,7 +121947,7 @@ var ts;
121922
121947
  */
121923
121948
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
121924
121949
  while (true) {
121925
- var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
121950
+ var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
121926
121951
  if (!affected) {
121927
121952
  // Done
121928
121953
  return undefined;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.8.0-dev.20220627",
5
+ "version": "4.8.0-dev.20220628",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [