@typescript-deploys/pr-build 5.5.0-pr-58183-2 → 5.5.0-pr-49218-53

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
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-insiders.20240415`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240419`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -9175,11 +9175,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9175
9175
  }
9176
9176
  const ch = codePointAt(text, pos);
9177
9177
  if (pos === 0) {
9178
- if (text.slice(0, 256).includes("\uFFFD")) {
9179
- error(Diagnostics.File_appears_to_be_binary);
9180
- pos = end;
9181
- return token = 8 /* NonTextFileMarkerTrivia */;
9182
- }
9183
9178
  if (ch === 35 /* hash */ && isShebangTrivia(text, pos)) {
9184
9179
  pos = scanShebangTrivia(text, pos);
9185
9180
  if (skipTrivia2) {
@@ -9603,6 +9598,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9603
9598
  error(Diagnostics.Invalid_character, pos++, charSize(ch));
9604
9599
  }
9605
9600
  return token = 81 /* PrivateIdentifier */;
9601
+ case 65533 /* replacementCharacter */:
9602
+ error(Diagnostics.File_appears_to_be_binary, 0, 0);
9603
+ pos = end;
9604
+ return token = 8 /* NonTextFileMarkerTrivia */;
9606
9605
  default:
9607
9606
  const identifierKind = scanIdentifier(ch, languageVersion);
9608
9607
  if (identifierKind) {
@@ -14534,7 +14533,7 @@ function isNamedEvaluation(node, cb) {
14534
14533
  function isPushOrUnshiftIdentifier(node) {
14535
14534
  return node.escapedText === "push" || node.escapedText === "unshift";
14536
14535
  }
14537
- function isParameterDeclaration(node) {
14536
+ function isPartOfParameterDeclaration(node) {
14538
14537
  const root = getRootDeclaration(node);
14539
14538
  return root.kind === 169 /* Parameter */;
14540
14539
  }
@@ -16794,8 +16793,15 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
16794
16793
  forEachResolvedTypeReferenceDirective((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
16795
16794
  typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
16796
16795
  },
16797
- hasProcessedResolutions: () => hasProcessedResolutions
16796
+ hasProcessedResolutions: () => hasProcessedResolutions,
16797
+ setSymlinksFromResolution(resolution) {
16798
+ processResolution(this, resolution);
16799
+ },
16800
+ hasAnySymlinks
16798
16801
  };
16802
+ function hasAnySymlinks() {
16803
+ return !!(symlinkedFiles == null ? void 0 : symlinkedFiles.size) || !!symlinkedDirectories && !!forEachEntry(symlinkedDirectories, (value) => !!value);
16804
+ }
16799
16805
  function processResolution(cache, resolution) {
16800
16806
  if (!resolution || !resolution.originalPath || !resolution.resolvedFileName)
16801
16807
  return;
@@ -18119,7 +18125,7 @@ function createNameResolver({
18119
18125
  break;
18120
18126
  case 208 /* BindingElement */:
18121
18127
  if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
18122
- if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
18128
+ if (isPartOfParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
18123
18129
  associatedDeclarationForContainingInitializerOrBindingName = location;
18124
18130
  }
18125
18131
  }
@@ -27337,7 +27343,7 @@ var Parser;
27337
27343
  function currentNode2(position) {
27338
27344
  const node = baseSyntaxCursor.currentNode(position);
27339
27345
  if (topLevel && node && containsPossibleTopLevelAwait(node)) {
27340
- node.intersectsChange = true;
27346
+ markAsIntersectingIncrementalChange(node);
27341
27347
  }
27342
27348
  return node;
27343
27349
  }
@@ -28207,7 +28213,7 @@ var Parser;
28207
28213
  return void 0;
28208
28214
  }
28209
28215
  const node = syntaxCursor.currentNode(pos ?? scanner.getTokenFullStart());
28210
- if (nodeIsMissing(node) || node.intersectsChange || containsParseError(node)) {
28216
+ if (nodeIsMissing(node) || intersectsIncrementalChange(node) || containsParseError(node)) {
28211
28217
  return void 0;
28212
28218
  }
28213
28219
  const nodeContextFlags = node.flags & 101441536 /* ContextFlags */;
@@ -33722,6 +33728,20 @@ var Parser;
33722
33728
  }
33723
33729
  })(JSDocParser = Parser2.JSDocParser || (Parser2.JSDocParser = {}));
33724
33730
  })(Parser || (Parser = {}));
33731
+ var incrementallyParsedFiles = /* @__PURE__ */ new WeakSet();
33732
+ function markAsIncrementallyParsed(sourceFile) {
33733
+ if (incrementallyParsedFiles.has(sourceFile)) {
33734
+ Debug.fail("Source file has already been incrementally parsed");
33735
+ }
33736
+ incrementallyParsedFiles.add(sourceFile);
33737
+ }
33738
+ var intersectingChangeSet = /* @__PURE__ */ new WeakSet();
33739
+ function intersectsIncrementalChange(node) {
33740
+ return intersectingChangeSet.has(node);
33741
+ }
33742
+ function markAsIntersectingIncrementalChange(node) {
33743
+ intersectingChangeSet.add(node);
33744
+ }
33725
33745
  var IncrementalParser;
33726
33746
  ((IncrementalParser2) => {
33727
33747
  function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {
@@ -33744,10 +33764,8 @@ var IncrementalParser;
33744
33764
  sourceFile.jsDocParsingMode
33745
33765
  );
33746
33766
  }
33747
- const incrementalSourceFile = sourceFile;
33748
- Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed);
33749
- incrementalSourceFile.hasBeenIncrementallyParsed = true;
33750
- Parser.fixupParentReferences(incrementalSourceFile);
33767
+ markAsIncrementallyParsed(sourceFile);
33768
+ Parser.fixupParentReferences(sourceFile);
33751
33769
  const oldText = sourceFile.text;
33752
33770
  const syntaxCursor = createSyntaxCursor(sourceFile);
33753
33771
  const changeRange = extendToAffectedRange(sourceFile, textChangeRange);
@@ -33756,7 +33774,7 @@ var IncrementalParser;
33756
33774
  Debug.assert(textSpanEnd(changeRange.span) === textSpanEnd(textChangeRange.span));
33757
33775
  Debug.assert(textSpanEnd(textChangeRangeNewSpan(changeRange)) === textSpanEnd(textChangeRangeNewSpan(textChangeRange)));
33758
33776
  const delta = textChangeRangeNewSpan(changeRange).length - changeRange.span.length;
33759
- updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, textSpanEnd(changeRange.span), textSpanEnd(textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks);
33777
+ updateTokenPositionsAndMarkElements(sourceFile, changeRange.span.start, textSpanEnd(changeRange.span), textSpanEnd(textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks);
33760
33778
  const result = Parser.parseSourceFile(
33761
33779
  sourceFile.fileName,
33762
33780
  newText,
@@ -33872,8 +33890,9 @@ var IncrementalParser;
33872
33890
  );
33873
33891
  Debug.assert(pos <= end);
33874
33892
  if (element.parent) {
33875
- Debug.assertGreaterThanOrEqual(pos, element.parent.pos);
33876
- Debug.assertLessThanOrEqual(end, element.parent.end);
33893
+ const parent = element.parent;
33894
+ Debug.assertGreaterThanOrEqual(pos, parent.pos);
33895
+ Debug.assertLessThanOrEqual(end, parent.end);
33877
33896
  }
33878
33897
  setTextRangePosEnd(element, pos, end);
33879
33898
  }
@@ -33912,7 +33931,7 @@ var IncrementalParser;
33912
33931
  }
33913
33932
  const fullEnd = child.end;
33914
33933
  if (fullEnd >= changeStart) {
33915
- child.intersectsChange = true;
33934
+ markAsIntersectingIncrementalChange(child);
33916
33935
  unsetNodeChildren(child);
33917
33936
  adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
33918
33937
  forEachChild(child, visitNode3, visitArray2);
@@ -33942,7 +33961,7 @@ var IncrementalParser;
33942
33961
  }
33943
33962
  const fullEnd = array.end;
33944
33963
  if (fullEnd >= changeStart) {
33945
- array.intersectsChange = true;
33964
+ markAsIntersectingIncrementalChange(array);
33946
33965
  adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
33947
33966
  for (const node of array) {
33948
33967
  visitNode3(node);
@@ -34483,6 +34502,7 @@ var optionsForWatch = [
34483
34502
  isFilePath: true,
34484
34503
  extraValidation: specToDiagnostic
34485
34504
  },
34505
+ allowConfigDirTemplateSubstitution: true,
34486
34506
  category: Diagnostics.Watch_and_Build_Modes,
34487
34507
  description: Diagnostics.Remove_a_list_of_directories_from_the_watch_process
34488
34508
  },
@@ -34495,6 +34515,7 @@ var optionsForWatch = [
34495
34515
  isFilePath: true,
34496
34516
  extraValidation: specToDiagnostic
34497
34517
  },
34518
+ allowConfigDirTemplateSubstitution: true,
34498
34519
  category: Diagnostics.Watch_and_Build_Modes,
34499
34520
  description: Diagnostics.Remove_a_list_of_files_from_the_watch_mode_s_processing
34500
34521
  }
@@ -35193,6 +35214,7 @@ var commandOptionsWithoutBuild = [
35193
35214
  name: "paths",
35194
35215
  type: "object",
35195
35216
  affectsModuleResolution: true,
35217
+ allowConfigDirTemplateSubstitution: true,
35196
35218
  isTSConfigOnly: true,
35197
35219
  category: Diagnostics.Modules,
35198
35220
  description: Diagnostics.Specify_a_set_of_entries_that_re_map_imports_to_additional_lookup_locations,
@@ -35210,6 +35232,7 @@ var commandOptionsWithoutBuild = [
35210
35232
  isFilePath: true
35211
35233
  },
35212
35234
  affectsModuleResolution: true,
35235
+ allowConfigDirTemplateSubstitution: true,
35213
35236
  category: Diagnostics.Modules,
35214
35237
  description: Diagnostics.Allow_multiple_folders_to_be_treated_as_one_when_resolving_modules,
35215
35238
  transpileOptionValue: void 0,
@@ -35224,6 +35247,7 @@ var commandOptionsWithoutBuild = [
35224
35247
  isFilePath: true
35225
35248
  },
35226
35249
  affectsModuleResolution: true,
35250
+ allowConfigDirTemplateSubstitution: true,
35227
35251
  category: Diagnostics.Modules,
35228
35252
  description: Diagnostics.Specify_multiple_folders_that_act_like_Slashnode_modules_Slash_types
35229
35253
  },
@@ -35738,6 +35762,12 @@ var moduleResolutionOptionDeclarations = optionDeclarations.filter((option) => !
35738
35762
  var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsBindDiagnostics);
35739
35763
  var optionsAffectingProgramStructure = optionDeclarations.filter((option) => !!option.affectsProgramStructure);
35740
35764
  var transpileOptionValueCompilerOptions = optionDeclarations.filter((option) => hasProperty(option, "transpileOptionValue"));
35765
+ var configDirTemplateSubstitutionOptions = optionDeclarations.filter(
35766
+ (option) => option.allowConfigDirTemplateSubstitution || !option.isCommandLineOnly && option.isFilePath
35767
+ );
35768
+ var configDirTemplateSubstitutionWatchOptions = optionsForWatch.filter(
35769
+ (option) => option.allowConfigDirTemplateSubstitution || !option.isCommandLineOnly && option.isFilePath
35770
+ );
35741
35771
  var optionsForBuild = [
35742
35772
  {
35743
35773
  name: "verbose",
@@ -36521,6 +36551,8 @@ function serializeOptionBaseObject(options, { optionsNameMap }, pathOptions) {
36521
36551
  if (!customTypeMap) {
36522
36552
  if (pathOptions && optionDefinition.isFilePath) {
36523
36553
  result.set(name, getRelativePathFromFile(pathOptions.configFilePath, getNormalizedAbsolutePath(value, getDirectoryPath(pathOptions.configFilePath)), getCanonicalFileName));
36554
+ } else if (pathOptions && optionDefinition.type === "list" && optionDefinition.element.isFilePath) {
36555
+ result.set(name, value.map((v) => getRelativePathFromFile(pathOptions.configFilePath, getNormalizedAbsolutePath(v, getDirectoryPath(pathOptions.configFilePath)), getCanonicalFileName)));
36524
36556
  } else {
36525
36557
  result.set(name, value);
36526
36558
  }
@@ -36705,14 +36737,21 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
36705
36737
  const errors = [];
36706
36738
  const parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache);
36707
36739
  const { raw } = parsedConfig;
36708
- const options = extend(existingOptions, parsedConfig.options || {});
36709
- const watchOptions = existingWatchOptions && parsedConfig.watchOptions ? extend(existingWatchOptions, parsedConfig.watchOptions) : parsedConfig.watchOptions || existingWatchOptions;
36740
+ const options = handleOptionConfigDirTemplateSubstitution(
36741
+ extend(existingOptions, parsedConfig.options || {}),
36742
+ configDirTemplateSubstitutionOptions,
36743
+ basePath
36744
+ );
36745
+ const watchOptions = handleWatchOptionsConfigDirTemplateSubstitution(
36746
+ existingWatchOptions && parsedConfig.watchOptions ? extend(existingWatchOptions, parsedConfig.watchOptions) : parsedConfig.watchOptions || existingWatchOptions,
36747
+ basePath
36748
+ );
36710
36749
  options.configFilePath = configFileName && normalizeSlashes(configFileName);
36750
+ const basePathForFileNames = normalizePath(configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath);
36711
36751
  const configFileSpecs = getConfigFileSpecs();
36712
36752
  if (sourceFile)
36713
36753
  sourceFile.configFileSpecs = configFileSpecs;
36714
36754
  setConfigFileInOptions(options, sourceFile);
36715
- const basePathForFileNames = normalizePath(configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath);
36716
36755
  return {
36717
36756
  options,
36718
36757
  watchOptions,
@@ -36761,9 +36800,10 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
36761
36800
  includeSpecs = [defaultIncludeSpec];
36762
36801
  isDefaultIncludeSpec = true;
36763
36802
  }
36803
+ let validatedIncludeSpecsBeforeSubstitution, validatedExcludeSpecsBeforeSubstitution;
36764
36804
  let validatedIncludeSpecs, validatedExcludeSpecs;
36765
36805
  if (includeSpecs) {
36766
- validatedIncludeSpecs = validateSpecs(
36806
+ validatedIncludeSpecsBeforeSubstitution = validateSpecs(
36767
36807
  includeSpecs,
36768
36808
  errors,
36769
36809
  /*disallowTrailingRecursion*/
@@ -36771,9 +36811,13 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
36771
36811
  sourceFile,
36772
36812
  "include"
36773
36813
  );
36814
+ validatedIncludeSpecs = getSubstitutedStringArrayWithConfigDirTemplate(
36815
+ validatedIncludeSpecsBeforeSubstitution,
36816
+ basePathForFileNames
36817
+ ) || validatedIncludeSpecsBeforeSubstitution;
36774
36818
  }
36775
36819
  if (excludeSpecs) {
36776
- validatedExcludeSpecs = validateSpecs(
36820
+ validatedExcludeSpecsBeforeSubstitution = validateSpecs(
36777
36821
  excludeSpecs,
36778
36822
  errors,
36779
36823
  /*disallowTrailingRecursion*/
@@ -36781,14 +36825,26 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
36781
36825
  sourceFile,
36782
36826
  "exclude"
36783
36827
  );
36828
+ validatedExcludeSpecs = getSubstitutedStringArrayWithConfigDirTemplate(
36829
+ validatedExcludeSpecsBeforeSubstitution,
36830
+ basePathForFileNames
36831
+ ) || validatedExcludeSpecsBeforeSubstitution;
36784
36832
  }
36833
+ const validatedFilesSpecBeforeSubstitution = filter(filesSpecs, isString);
36834
+ const validatedFilesSpec = getSubstitutedStringArrayWithConfigDirTemplate(
36835
+ validatedFilesSpecBeforeSubstitution,
36836
+ basePathForFileNames
36837
+ ) || validatedFilesSpecBeforeSubstitution;
36785
36838
  return {
36786
36839
  filesSpecs,
36787
36840
  includeSpecs,
36788
36841
  excludeSpecs,
36789
- validatedFilesSpec: filter(filesSpecs, isString),
36842
+ validatedFilesSpec,
36790
36843
  validatedIncludeSpecs,
36791
36844
  validatedExcludeSpecs,
36845
+ validatedFilesSpecBeforeSubstitution,
36846
+ validatedIncludeSpecsBeforeSubstitution,
36847
+ validatedExcludeSpecsBeforeSubstitution,
36792
36848
  pathPatterns: void 0,
36793
36849
  // Initialized on first use
36794
36850
  isDefaultIncludeSpec
@@ -36847,6 +36903,81 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
36847
36903
  }
36848
36904
  }
36849
36905
  }
36906
+ function handleWatchOptionsConfigDirTemplateSubstitution(watchOptions, basePath) {
36907
+ return handleOptionConfigDirTemplateSubstitution(watchOptions, configDirTemplateSubstitutionWatchOptions, basePath);
36908
+ }
36909
+ function handleOptionConfigDirTemplateSubstitution(options, optionDeclarations2, basePath) {
36910
+ if (!options)
36911
+ return options;
36912
+ let result;
36913
+ for (const option of optionDeclarations2) {
36914
+ if (options[option.name] !== void 0) {
36915
+ const value = options[option.name];
36916
+ switch (option.type) {
36917
+ case "string":
36918
+ Debug.assert(option.isFilePath);
36919
+ if (startsWithConfigDirTemplate(value)) {
36920
+ setOptionValue(option, getSubstitutedPathWithConfigDirTemplate(value, basePath));
36921
+ }
36922
+ break;
36923
+ case "list":
36924
+ Debug.assert(option.element.isFilePath);
36925
+ const listResult = getSubstitutedStringArrayWithConfigDirTemplate(value, basePath);
36926
+ if (listResult)
36927
+ setOptionValue(option, listResult);
36928
+ break;
36929
+ case "object":
36930
+ Debug.assert(option.name === "paths");
36931
+ const objectResult = getSubstitutedMapLikeOfStringArrayWithConfigDirTemplate(value, basePath);
36932
+ if (objectResult)
36933
+ setOptionValue(option, objectResult);
36934
+ break;
36935
+ default:
36936
+ Debug.fail("option type not supported");
36937
+ }
36938
+ }
36939
+ }
36940
+ return result || options;
36941
+ function setOptionValue(option, value) {
36942
+ (result ?? (result = assign({}, options)))[option.name] = value;
36943
+ }
36944
+ }
36945
+ var configDirTemplate = `\${configDir}`;
36946
+ function startsWithConfigDirTemplate(value) {
36947
+ return isString(value) && startsWith(
36948
+ value,
36949
+ configDirTemplate,
36950
+ /*ignoreCase*/
36951
+ true
36952
+ );
36953
+ }
36954
+ function getSubstitutedPathWithConfigDirTemplate(value, basePath) {
36955
+ return getNormalizedAbsolutePath(value.replace(configDirTemplate, "./"), basePath);
36956
+ }
36957
+ function getSubstitutedStringArrayWithConfigDirTemplate(list, basePath) {
36958
+ if (!list)
36959
+ return list;
36960
+ let result;
36961
+ list.forEach((element, index) => {
36962
+ if (!startsWithConfigDirTemplate(element))
36963
+ return;
36964
+ (result ?? (result = list.slice()))[index] = getSubstitutedPathWithConfigDirTemplate(element, basePath);
36965
+ });
36966
+ return result;
36967
+ }
36968
+ function getSubstitutedMapLikeOfStringArrayWithConfigDirTemplate(mapLike, basePath) {
36969
+ let result;
36970
+ const ownKeys = getOwnKeys(mapLike);
36971
+ ownKeys.forEach((key) => {
36972
+ if (!isArray(mapLike[key]))
36973
+ return;
36974
+ const subStitution = getSubstitutedStringArrayWithConfigDirTemplate(mapLike[key], basePath);
36975
+ if (!subStitution)
36976
+ return;
36977
+ (result ?? (result = assign({}, mapLike)))[key] = subStitution;
36978
+ });
36979
+ return result;
36980
+ }
36850
36981
  function isErrorNoInputFiles(error) {
36851
36982
  return error.code === Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code;
36852
36983
  }
@@ -36896,11 +37027,11 @@ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutio
36896
37027
  } else {
36897
37028
  ownConfig.extendedConfigPath.forEach((extendedConfigPath) => applyExtendedConfig(result, extendedConfigPath));
36898
37029
  }
36899
- if (!ownConfig.raw.include && result.include)
37030
+ if (result.include)
36900
37031
  ownConfig.raw.include = result.include;
36901
- if (!ownConfig.raw.exclude && result.exclude)
37032
+ if (result.exclude)
36902
37033
  ownConfig.raw.exclude = result.exclude;
36903
- if (!ownConfig.raw.files && result.files)
37034
+ if (result.files)
36904
37035
  ownConfig.raw.files = result.files;
36905
37036
  if (ownConfig.raw.compileOnSave === void 0 && result.compileOnSave)
36906
37037
  ownConfig.raw.compileOnSave = result.compileOnSave;
@@ -36916,8 +37047,10 @@ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutio
36916
37047
  const extendsRaw = extendedConfig.raw;
36917
37048
  let relativeDifference;
36918
37049
  const setPropertyInResultIfNotUndefined = (propertyName) => {
37050
+ if (ownConfig.raw[propertyName])
37051
+ return;
36919
37052
  if (extendsRaw[propertyName]) {
36920
- result[propertyName] = map(extendsRaw[propertyName], (path) => isRootedDiskPath(path) ? path : combinePaths(
37053
+ result[propertyName] = map(extendsRaw[propertyName], (path) => startsWithConfigDirTemplate(path) || isRootedDiskPath(path) ? path : combinePaths(
36921
37054
  relativeDifference || (relativeDifference = convertToRelativePath(getDirectoryPath(extendedConfigPath), basePath, createGetCanonicalFileName(host.useCaseSensitiveFileNames))),
36922
37055
  path
36923
37056
  ));
@@ -37185,7 +37318,8 @@ function convertJsonOption(opt, value, basePath, errors, propertyAssignment, val
37185
37318
  }
37186
37319
  function normalizeNonListOptionValue(option, basePath, value) {
37187
37320
  if (option.isFilePath) {
37188
- value = getNormalizedAbsolutePath(value, basePath);
37321
+ value = normalizeSlashes(value);
37322
+ value = !startsWithConfigDirTemplate(value) ? getNormalizedAbsolutePath(value, basePath) : value;
37189
37323
  if (value === "") {
37190
37324
  value = ".";
37191
37325
  }
@@ -42677,7 +42811,7 @@ function createBinder() {
42677
42811
  declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
42678
42812
  } else if (isBlockOrCatchScoped(node)) {
42679
42813
  bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
42680
- } else if (isParameterDeclaration(node)) {
42814
+ } else if (isPartOfParameterDeclaration(node)) {
42681
42815
  declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111551 /* ParameterExcludes */);
42682
42816
  } else {
42683
42817
  declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
@@ -43166,7 +43300,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
43166
43300
  if (!moduleSourceFile)
43167
43301
  return { moduleSpecifiers: emptyArray, computedWithoutCache };
43168
43302
  computedWithoutCache = true;
43169
- modulePaths || (modulePaths = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host));
43303
+ modulePaths || (modulePaths = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host, compilerOptions, options));
43170
43304
  const result = computeModuleSpecifiers(
43171
43305
  modulePaths,
43172
43306
  compilerOptions,
@@ -43373,7 +43507,42 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
43373
43507
  });
43374
43508
  return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
43375
43509
  }
43376
- function getAllModulePathsWorker(info, importedFileName, host) {
43510
+ var runtimeDependencyFields = ["dependencies", "peerDependencies", "optionalDependencies"];
43511
+ function getAllRuntimeDependencies(packageJson) {
43512
+ let result;
43513
+ for (const field of runtimeDependencyFields) {
43514
+ const deps = packageJson[field];
43515
+ if (deps && typeof deps === "object") {
43516
+ result = concatenate(result, getOwnKeys(deps));
43517
+ }
43518
+ }
43519
+ return result;
43520
+ }
43521
+ function getAllModulePathsWorker(info, importedFileName, host, compilerOptions, options) {
43522
+ var _a, _b;
43523
+ const cache = (_a = host.getModuleResolutionCache) == null ? void 0 : _a.call(host);
43524
+ const links = (_b = host.getSymlinkCache) == null ? void 0 : _b.call(host);
43525
+ if (cache && links && host.readFile && !pathContainsNodeModules(info.importingSourceFileName)) {
43526
+ Debug.type(host);
43527
+ const state = getTemporaryModuleResolutionState(cache.getPackageJsonInfoCache(), host, {});
43528
+ const packageJson = getPackageScopeForPath(info.importingSourceFileName, state);
43529
+ if (packageJson) {
43530
+ const toResolve = getAllRuntimeDependencies(packageJson.contents.packageJsonContent);
43531
+ for (const depName of toResolve || emptyArray) {
43532
+ const resolved = resolveModuleName(
43533
+ depName,
43534
+ combinePaths(packageJson.packageDirectory, "package.json"),
43535
+ compilerOptions,
43536
+ host,
43537
+ cache,
43538
+ /*redirectedReference*/
43539
+ void 0,
43540
+ options.overrideImportMode
43541
+ );
43542
+ links.setSymlinksFromResolution(resolved.resolvedModule);
43543
+ }
43544
+ }
43545
+ }
43377
43546
  const allFileNames = /* @__PURE__ */ new Map();
43378
43547
  let importedFileFromNodeModules = false;
43379
43548
  forEachFileNameOfModule(
@@ -44909,7 +45078,6 @@ function createTypeChecker(host) {
44909
45078
  };
44910
45079
  var amalgamatedDuplicates;
44911
45080
  var reverseMappedCache = /* @__PURE__ */ new Map();
44912
- var homomorphicMappedTypeInferenceStack = [];
44913
45081
  var ambientModulesCache;
44914
45082
  var patternAmbientModules;
44915
45083
  var patternAmbientModuleAugmentations;
@@ -45010,6 +45178,9 @@ function createTypeChecker(host) {
45010
45178
  var potentialReflectCollisions = [];
45011
45179
  var potentialUnusedRenamedBindingElementsInTypes = [];
45012
45180
  var awaitedTypeStack = [];
45181
+ var reverseMappedSourceStack = [];
45182
+ var reverseMappedTargetStack = [];
45183
+ var reverseExpandingFlags = 0 /* None */;
45013
45184
  var diagnostics = createDiagnosticCollection();
45014
45185
  var suggestionDiagnostics = createDiagnosticCollection();
45015
45186
  var typeofType = createTypeofType();
@@ -50321,7 +50492,7 @@ function createTypeChecker(host) {
50321
50492
  );
50322
50493
  if (sym) {
50323
50494
  if (sym.flags & 1 /* FunctionScopedVariable */ && sym.valueDeclaration) {
50324
- if (isParameterDeclaration(sym.valueDeclaration)) {
50495
+ if (isPartOfParameterDeclaration(sym.valueDeclaration)) {
50325
50496
  return { introducesError, node: attachSymbolToLeftmostIdentifier(node) };
50326
50497
  }
50327
50498
  }
@@ -51027,7 +51198,7 @@ function createTypeChecker(host) {
51027
51198
  }
51028
51199
  }
51029
51200
  function includePrivateSymbol(symbol) {
51030
- if (some(symbol.declarations, isParameterDeclaration))
51201
+ if (some(symbol.declarations, isPartOfParameterDeclaration))
51031
51202
  return;
51032
51203
  Debug.assertIsDefined(deferredPrivatesStack[deferredPrivatesStack.length - 1]);
51033
51204
  getUnusedName(unescapeLeadingUnderscores(symbol.escapedName), symbol);
@@ -51837,7 +52008,7 @@ function createTypeChecker(host) {
51837
52008
  context,
51838
52009
  /*declaration*/
51839
52010
  void 0,
51840
- getTypeOfSymbol(p),
52011
+ getWriteTypeOfSymbol(p),
51841
52012
  p
51842
52013
  )
51843
52014
  )],
@@ -52614,7 +52785,7 @@ function createTypeChecker(host) {
52614
52785
  return parentType;
52615
52786
  }
52616
52787
  const pattern = declaration.parent;
52617
- if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
52788
+ if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isPartOfParameterDeclaration(declaration)) {
52618
52789
  parentType = getNonNullableType(parentType);
52619
52790
  } else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
52620
52791
  parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
@@ -53093,7 +53264,7 @@ function createTypeChecker(host) {
53093
53264
  result.aliasTypeArguments = length(args) ? args : void 0;
53094
53265
  }
53095
53266
  }
53096
- result.objectFlags |= getObjectFlags(type) & 4096 /* JSLiteral */;
53267
+ result.objectFlags |= getPropagatingFlagsOfTypes([type]) | getObjectFlags(type) & (4096 /* JSLiteral */ | 16384 /* ArrayLiteral */ | 128 /* ObjectLiteral */);
53097
53268
  if (result.symbol && result.symbol.flags & 32 /* Class */ && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
53098
53269
  result.objectFlags |= 16777216 /* IsClassInstanceClone */;
53099
53270
  }
@@ -55039,7 +55210,7 @@ function createTypeChecker(host) {
55039
55210
  const modifiers = getMappedTypeModifiers(type.mappedType);
55040
55211
  const readonlyMask = modifiers & 1 /* IncludeReadonly */ ? false : true;
55041
55212
  const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
55042
- const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
55213
+ const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType) || unknownType, readonlyMask && indexInfo.isReadonly)] : emptyArray;
55043
55214
  const members = createSymbolTable();
55044
55215
  const limitedConstraint = getLimitedConstraint(type);
55045
55216
  for (const prop of getPropertiesOfType(type.source)) {
@@ -60009,13 +60180,18 @@ function createTypeChecker(host) {
60009
60180
  const typeArguments = map(typeParameters, (t) => getMappedType(t, combinedMapper));
60010
60181
  const newAliasSymbol = aliasSymbol || type.aliasSymbol;
60011
60182
  const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
60012
- const id = getTypeListId(typeArguments) + getAliasId(newAliasSymbol, newAliasTypeArguments);
60183
+ const id = (type.objectFlags & 134217728 /* SingleSignatureType */ ? "S" : "") + getTypeListId(typeArguments) + getAliasId(newAliasSymbol, newAliasTypeArguments);
60013
60184
  if (!target.instantiations) {
60014
60185
  target.instantiations = /* @__PURE__ */ new Map();
60015
60186
  target.instantiations.set(getTypeListId(typeParameters) + getAliasId(target.aliasSymbol, target.aliasTypeArguments), target);
60016
60187
  }
60017
60188
  let result = target.instantiations.get(id);
60018
60189
  if (!result) {
60190
+ if (type.objectFlags & 134217728 /* SingleSignatureType */) {
60191
+ result = instantiateAnonymousType(type, mapper);
60192
+ target.instantiations.set(id, result);
60193
+ return result;
60194
+ }
60019
60195
  const newMapper = createTypeMapper(typeParameters, typeArguments);
60020
60196
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
60021
60197
  target.instantiations.set(id, result);
@@ -61063,7 +61239,37 @@ function createTypeChecker(host) {
61063
61239
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
61064
61240
  for (let i = 0; i < paramCount; i++) {
61065
61241
  const sourceType = i === restIndex ? getRestOrAnyTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
61066
- const targetType = i === restIndex ? getRestOrAnyTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
61242
+ let targetType = i === restIndex ? getRestOrAnyTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
61243
+ if (i === restIndex && targetType && sourceType && isTupleType(sourceType)) {
61244
+ targetType = mapType(targetType, (t) => {
61245
+ if (!isTupleType(t) || // When both sides are tuples of the same structure, we don't want to "propagate" types from elements of variable positions
61246
+ // to the following positions as that would disallow signatures of the exact same structures when trailing fixed elements are involved:
61247
+ //
61248
+ // let fn: (...rest: [...string[], number]) => void = (...rest: [...string[], number]) => {}; // ok
61249
+ //
61250
+ // Since we want to allow contextual types to flow into paremeters, we don't need to differentiate between rest and variadic elements
61251
+ // as that doesn't affect the contextual type of the parameter
61252
+ isTupleTypeStructureMatching(sourceType, t, 2 /* MatchVariable */)) {
61253
+ return t;
61254
+ }
61255
+ const elementTypes = [];
61256
+ const elementFlags = [];
61257
+ const sourceArity = getTypeReferenceArity(sourceType);
61258
+ const targetArity = getTypeReferenceArity(t);
61259
+ for (let i2 = 0; i2 < sourceArity; i2++) {
61260
+ if (i2 >= targetArity) {
61261
+ if (sourceType.target.elementFlags[i2] & 3 /* Fixed */) {
61262
+ elementTypes.push(undefinedType);
61263
+ elementFlags.push(sourceType.target.elementFlags[i2]);
61264
+ }
61265
+ continue;
61266
+ }
61267
+ elementTypes.push(getTupleElementType(t, i2));
61268
+ elementFlags.push(sourceType.target.elementFlags[i2]);
61269
+ }
61270
+ return createTupleType(elementTypes, elementFlags);
61271
+ });
61272
+ }
61067
61273
  if (sourceType && targetType) {
61068
61274
  const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
61069
61275
  const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
@@ -64334,8 +64540,11 @@ function createTypeChecker(host) {
64334
64540
  }
64335
64541
  return void 0;
64336
64542
  }
64337
- function isTupleTypeStructureMatching(t1, t2) {
64338
- return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f, i) => (f & 12 /* Variable */) === (t2.target.elementFlags[i] & 12 /* Variable */));
64543
+ function isTupleTypeStructureMatching(t1, t2, tupleStructureComparisonKind) {
64544
+ return getTypeReferenceArity(t1) === getTypeReferenceArity(t2) && every(t1.target.elementFlags, (f1, i) => {
64545
+ const f2 = t2.target.elementFlags[i];
64546
+ return f1 === f2 || !!(tupleStructureComparisonKind & 1 /* MatchFixed */ && f1 & 3 /* Fixed */ && f2 & 3 /* Fixed */) || !!(tupleStructureComparisonKind & 2 /* MatchVariable */ && f1 & 12 /* Variable */ && f2 & 12 /* Variable */);
64547
+ });
64339
64548
  }
64340
64549
  function isZeroBigInt({ value }) {
64341
64550
  return value.base10Value === "0";
@@ -64859,13 +65068,7 @@ function createTypeChecker(host) {
64859
65068
  if (reverseMappedCache.has(cacheKey)) {
64860
65069
  return reverseMappedCache.get(cacheKey);
64861
65070
  }
64862
- const recursionKey = source.id + "," + (target.target || target).id;
64863
- if (contains(homomorphicMappedTypeInferenceStack, recursionKey)) {
64864
- return void 0;
64865
- }
64866
- homomorphicMappedTypeInferenceStack.push(recursionKey);
64867
65071
  const type = createReverseMappedType(source, target, constraint);
64868
- homomorphicMappedTypeInferenceStack.pop();
64869
65072
  reverseMappedCache.set(cacheKey, type);
64870
65073
  return type;
64871
65074
  }
@@ -64877,10 +65080,17 @@ function createTypeChecker(host) {
64877
65080
  return void 0;
64878
65081
  }
64879
65082
  if (isArrayType(source)) {
64880
- return createArrayType(inferReverseMappedType(getTypeArguments(source)[0], target, constraint), isReadonlyArrayType(source));
65083
+ const elementType = inferReverseMappedType(getTypeArguments(source)[0], target, constraint);
65084
+ if (!elementType) {
65085
+ return void 0;
65086
+ }
65087
+ return createArrayType(elementType, isReadonlyArrayType(source));
64881
65088
  }
64882
65089
  if (isTupleType(source)) {
64883
65090
  const elementTypes = map(getElementTypes(source), (t) => inferReverseMappedType(t, target, constraint));
65091
+ if (!every(elementTypes, (t) => !!t)) {
65092
+ return void 0;
65093
+ }
64884
65094
  const elementFlags = getMappedTypeModifiers(target) & 4 /* IncludeOptional */ ? sameMap(source.target.elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : source.target.elementFlags;
64885
65095
  return createTupleType(elementTypes, elementFlags, source.target.readonly, source.target.labeledElementDeclarations);
64886
65096
  }
@@ -64897,17 +65107,39 @@ function createTypeChecker(host) {
64897
65107
  function getTypeOfReverseMappedSymbol(symbol) {
64898
65108
  const links = getSymbolLinks(symbol);
64899
65109
  if (!links.type) {
64900
- links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType);
65110
+ links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType) || unknownType;
64901
65111
  }
64902
65112
  return links.type;
64903
65113
  }
64904
- function inferReverseMappedType(sourceType, target, constraint) {
65114
+ function inferReverseMappedTypeWorker(sourceType, target, constraint) {
64905
65115
  const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
64906
65116
  const templateType = getTemplateTypeFromMappedType(target);
64907
65117
  const inference = createInferenceInfo(typeParameter);
64908
65118
  inferTypes([inference], sourceType, templateType);
64909
65119
  return getTypeFromInference(inference) || unknownType;
64910
65120
  }
65121
+ function inferReverseMappedType(source, target, constraint) {
65122
+ const cacheKey = source.id + "," + target.id + "," + constraint.id;
65123
+ if (reverseMappedCache.has(cacheKey)) {
65124
+ return reverseMappedCache.get(cacheKey) || unknownType;
65125
+ }
65126
+ reverseMappedSourceStack.push(source);
65127
+ reverseMappedTargetStack.push(target);
65128
+ const saveExpandingFlags = reverseExpandingFlags;
65129
+ if (isDeeplyNestedType(source, reverseMappedSourceStack, reverseMappedSourceStack.length, 2))
65130
+ reverseExpandingFlags |= 1 /* Source */;
65131
+ if (isDeeplyNestedType(target, reverseMappedTargetStack, reverseMappedTargetStack.length, 2))
65132
+ reverseExpandingFlags |= 2 /* Target */;
65133
+ let type;
65134
+ if (reverseExpandingFlags !== 3 /* Both */) {
65135
+ type = inferReverseMappedTypeWorker(source, target, constraint);
65136
+ }
65137
+ reverseMappedSourceStack.pop();
65138
+ reverseMappedTargetStack.pop();
65139
+ reverseExpandingFlags = saveExpandingFlags;
65140
+ reverseMappedCache.set(cacheKey, type);
65141
+ return type;
65142
+ }
64911
65143
  function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
64912
65144
  const properties = getPropertiesOfType(target);
64913
65145
  for (const targetProp of properties) {
@@ -65553,7 +65785,7 @@ function createTypeChecker(host) {
65553
65785
  const targetArity = getTypeReferenceArity(target);
65554
65786
  const elementTypes = getTypeArguments(target);
65555
65787
  const elementFlags = target.target.elementFlags;
65556
- if (isTupleType(source) && isTupleTypeStructureMatching(source, target)) {
65788
+ if (isTupleType(source) && isTupleTypeStructureMatching(source, target, 1 /* MatchFixed */)) {
65557
65789
  for (let i = 0; i < targetArity; i++) {
65558
65790
  inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
65559
65791
  }
@@ -78886,7 +79118,7 @@ function createTypeChecker(host) {
78886
79118
  for (const node of potentialUnusedRenamedBindingElementsInTypes) {
78887
79119
  if (!((_a = getSymbolOfDeclaration(node)) == null ? void 0 : _a.isReferenced)) {
78888
79120
  const wrappingDeclaration = walkUpBindingElementsAndPatterns(node);
78889
- Debug.assert(isParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here");
79121
+ Debug.assert(isPartOfParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here");
78890
79122
  const diagnostic = createDiagnosticForNode(node.name, Diagnostics._0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation, declarationNameToString(node.name), declarationNameToString(node.propertyName));
78891
79123
  if (!wrappingDeclaration.type) {
78892
79124
  addRelatedInfo(
@@ -79074,7 +79306,7 @@ function createTypeChecker(host) {
79074
79306
  }
79075
79307
  }
79076
79308
  function checkVarDeclaredNamesNotShadowed(node) {
79077
- if ((getCombinedNodeFlagsCached(node) & 7 /* BlockScoped */) !== 0 || isParameterDeclaration(node)) {
79309
+ if ((getCombinedNodeFlagsCached(node) & 7 /* BlockScoped */) !== 0 || isPartOfParameterDeclaration(node)) {
79078
79310
  return;
79079
79311
  }
79080
79312
  const symbol = getSymbolOfDeclaration(node);
@@ -79122,7 +79354,7 @@ function createTypeChecker(host) {
79122
79354
  }
79123
79355
  }
79124
79356
  if (isBindingElement(node)) {
79125
- if (node.propertyName && isIdentifier(node.name) && isParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) {
79357
+ if (node.propertyName && isIdentifier(node.name) && isPartOfParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) {
79126
79358
  potentialUnusedRenamedBindingElementsInTypes.push(node);
79127
79359
  return;
79128
79360
  }
@@ -79167,7 +79399,7 @@ function createTypeChecker(host) {
79167
79399
  }
79168
79400
  forEach(node.name.elements, checkSourceElement);
79169
79401
  }
79170
- if (node.initializer && isParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) {
79402
+ if (node.initializer && isPartOfParameterDeclaration(node) && nodeIsMissing(getContainingFunction(node).body)) {
79171
79403
  error(node, Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
79172
79404
  return;
79173
79405
  }
@@ -117268,6 +117500,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117268
117500
  const supportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
117269
117501
  const hasEmitBlockingDiagnostics = /* @__PURE__ */ new Map();
117270
117502
  let _compilerOptionsObjectLiteralSyntax;
117503
+ let _compilerOptionsPropertySyntax;
117271
117504
  let moduleResolutionCache;
117272
117505
  let actualResolveModuleNamesWorker;
117273
117506
  const hasInvalidatedResolutions = host.hasInvalidatedResolutions || returnFalse;
@@ -118153,6 +118386,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118153
118386
  return false;
118154
118387
  return host.fileExists(f);
118155
118388
  },
118389
+ realpath: maybeBind(host, host.realpath),
118156
118390
  useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
118157
118391
  getBuildInfo: () => {
118158
118392
  var _a2;
@@ -118161,7 +118395,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118161
118395
  getSourceFileFromReference: (file, ref) => program.getSourceFileFromReference(file, ref),
118162
118396
  redirectTargetsMap,
118163
118397
  getFileIncludeReasons: program.getFileIncludeReasons,
118164
- createHash: maybeBind(host, host.createHash)
118398
+ createHash: maybeBind(host, host.createHash),
118399
+ getModuleResolutionCache: () => program.getModuleResolutionCache(),
118400
+ trace: maybeBind(host, host.trace)
118165
118401
  };
118166
118402
  }
118167
118403
  function writeFile2(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119629,7 +119865,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119629
119865
  }
119630
119866
  }
119631
119867
  if (options.checkJs && !getAllowJSCompilerOption(options)) {
119632
- programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs"));
119868
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs");
119633
119869
  }
119634
119870
  if (options.emitDeclarationOnly) {
119635
119871
  if (!getEmitDeclarations(options)) {
@@ -120034,7 +120270,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120034
120270
  }
120035
120271
  });
120036
120272
  if (needCompilerDiagnostic) {
120037
- programDiagnostics.add(createCompilerDiagnostic(message, ...args));
120273
+ createCompilerOptionsDiagnostic(message, ...args);
120038
120274
  }
120039
120275
  }
120040
120276
  function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
@@ -120053,7 +120289,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120053
120289
  }
120054
120290
  });
120055
120291
  if (needCompilerDiagnostic) {
120056
- programDiagnostics.add(createCompilerDiagnostic(message, ...args));
120292
+ createCompilerOptionsDiagnostic(message, ...args);
120057
120293
  }
120058
120294
  }
120059
120295
  function forEachOptionsSyntaxByName(name, callback) {
@@ -120104,22 +120340,39 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120104
120340
  const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
120105
120341
  const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, ...args);
120106
120342
  if (needCompilerDiagnostic) {
120343
+ createCompilerOptionsDiagnostic(message, ...args);
120344
+ }
120345
+ }
120346
+ function createCompilerOptionsDiagnostic(message, ...args) {
120347
+ const compilerOptionsProperty = getCompilerOptionsPropertySyntax();
120348
+ if (compilerOptionsProperty) {
120107
120349
  if ("messageText" in message) {
120108
- programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
120350
+ programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, compilerOptionsProperty.name, message));
120109
120351
  } else {
120110
- programDiagnostics.add(createCompilerDiagnostic(message, ...args));
120352
+ programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, compilerOptionsProperty.name, message, ...args));
120111
120353
  }
120354
+ } else if ("messageText" in message) {
120355
+ programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
120356
+ } else {
120357
+ programDiagnostics.add(createCompilerDiagnostic(message, ...args));
120112
120358
  }
120113
120359
  }
120114
120360
  function getCompilerOptionsObjectLiteralSyntax() {
120115
120361
  if (_compilerOptionsObjectLiteralSyntax === void 0) {
120116
- _compilerOptionsObjectLiteralSyntax = forEachPropertyAssignment(
120362
+ const compilerOptionsProperty = getCompilerOptionsPropertySyntax();
120363
+ _compilerOptionsObjectLiteralSyntax = compilerOptionsProperty ? tryCast(compilerOptionsProperty.initializer, isObjectLiteralExpression) || false : false;
120364
+ }
120365
+ return _compilerOptionsObjectLiteralSyntax || void 0;
120366
+ }
120367
+ function getCompilerOptionsPropertySyntax() {
120368
+ if (_compilerOptionsPropertySyntax === void 0) {
120369
+ _compilerOptionsPropertySyntax = forEachPropertyAssignment(
120117
120370
  getTsConfigObjectLiteralExpression(options.configFile),
120118
120371
  "compilerOptions",
120119
- (prop) => isObjectLiteralExpression(prop.initializer) ? prop.initializer : void 0
120372
+ identity
120120
120373
  ) || false;
120121
120374
  }
120122
- return _compilerOptionsObjectLiteralSyntax || void 0;
120375
+ return _compilerOptionsPropertySyntax || void 0;
120123
120376
  }
120124
120377
  function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
120125
120378
  let needsCompilerDiagnostic = false;
@@ -123525,7 +123778,8 @@ function getMatchedFileSpec(program, fileName) {
123525
123778
  return void 0;
123526
123779
  const filePath = program.getCanonicalFileName(fileName);
123527
123780
  const basePath = getDirectoryPath(getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory()));
123528
- return find(configFile.configFileSpecs.validatedFilesSpec, (fileSpec) => program.getCanonicalFileName(getNormalizedAbsolutePath(fileSpec, basePath)) === filePath);
123781
+ const index = findIndex(configFile.configFileSpecs.validatedFilesSpec, (fileSpec) => program.getCanonicalFileName(getNormalizedAbsolutePath(fileSpec, basePath)) === filePath);
123782
+ return index !== -1 ? configFile.configFileSpecs.validatedFilesSpecBeforeSubstitution[index] : void 0;
123529
123783
  }
123530
123784
  function getMatchedIncludeSpec(program, fileName) {
123531
123785
  var _a, _b;
@@ -123537,12 +123791,13 @@ function getMatchedIncludeSpec(program, fileName) {
123537
123791
  const isJsonFile = fileExtensionIs(fileName, ".json" /* Json */);
123538
123792
  const basePath = getDirectoryPath(getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory()));
123539
123793
  const useCaseSensitiveFileNames2 = program.useCaseSensitiveFileNames();
123540
- return find((_b = configFile == null ? void 0 : configFile.configFileSpecs) == null ? void 0 : _b.validatedIncludeSpecs, (includeSpec) => {
123794
+ const index = findIndex((_b = configFile == null ? void 0 : configFile.configFileSpecs) == null ? void 0 : _b.validatedIncludeSpecs, (includeSpec) => {
123541
123795
  if (isJsonFile && !endsWith(includeSpec, ".json" /* Json */))
123542
123796
  return false;
123543
123797
  const pattern = getPatternFromSpec(includeSpec, basePath, "files");
123544
123798
  return !!pattern && getRegexFromPattern(`(${pattern})$`, useCaseSensitiveFileNames2).test(fileName);
123545
123799
  });
123800
+ return index !== -1 ? configFile.configFileSpecs.validatedIncludeSpecsBeforeSubstitution[index] : void 0;
123546
123801
  }
123547
123802
  function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
123548
123803
  var _a, _b;