typescript 5.6.0-dev.20240725 → 5.6.0-dev.20240727

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.6";
21
- var version = `${versionMajorMinor}.0-dev.20240725`;
21
+ var version = `${versionMajorMinor}.0-dev.20240727`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -45471,6 +45471,7 @@ function createTypeChecker(host) {
45471
45471
  getNonOptionalType: removeOptionalTypeMarker,
45472
45472
  getTypeArguments,
45473
45473
  typeToTypeNode: nodeBuilder.typeToTypeNode,
45474
+ typePredicateToTypePredicateNode: nodeBuilder.typePredicateToTypePredicateNode,
45474
45475
  indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration,
45475
45476
  signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration,
45476
45477
  symbolToEntityName: nodeBuilder.symbolToEntityName,
@@ -67789,6 +67790,9 @@ function createTypeChecker(host) {
67789
67790
  return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType;
67790
67791
  }
67791
67792
  function isFunctionObjectType(type) {
67793
+ if (getObjectFlags(type) & 256 /* EvolvingArray */) {
67794
+ return false;
67795
+ }
67792
67796
  const resolved = resolveStructuredTypeMembers(type);
67793
67797
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
67794
67798
  }
@@ -103607,7 +103611,7 @@ function transformES2015(context) {
103607
103611
  statement,
103608
103612
  /*outermostLabeledStatement*/
103609
103613
  node
103610
- ) : factory2.restoreEnclosingLabel(Debug.checkDefined(visitNode(statement, visitor, isStatement, factory2.liftToBlock)), node, convertedLoopState && resetLabel);
103614
+ ) : factory2.restoreEnclosingLabel(visitNode(statement, visitor, isStatement, factory2.liftToBlock) ?? setTextRange(factory2.createEmptyStatement(), statement), node, convertedLoopState && resetLabel);
103611
103615
  }
103612
103616
  function visitIterationStatement(node, outermostLabeledStatement) {
103613
103617
  switch (node.kind) {
@@ -107913,7 +107917,7 @@ function transformModule(context) {
107913
107917
  return factory2.updateLabeledStatement(
107914
107918
  node,
107915
107919
  node.label,
107916
- visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) ?? factory2.createExpressionStatement(factory2.createIdentifier(""))
107920
+ visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) ?? setTextRange(factory2.createEmptyStatement(), node.statement)
107917
107921
  );
107918
107922
  }
107919
107923
  function visitWithStatement(node) {
@@ -3268,6 +3268,7 @@ declare namespace ts {
3268
3268
  private delayUpdateProjectsOfScriptInfoPath;
3269
3269
  private handleDeletedFile;
3270
3270
  private watchWildcardDirectory;
3271
+ private onWildCardDirectoryWatcherInvoke;
3271
3272
  private delayUpdateProjectsFromParsedConfigOnConfigFileChange;
3272
3273
  private onConfigFileChanged;
3273
3274
  private removeProject;
@@ -3338,6 +3339,7 @@ declare namespace ts {
3338
3339
  private ensureProjectChildren;
3339
3340
  private cleanupConfiguredProjects;
3340
3341
  private cleanupProjectsAndScriptInfos;
3342
+ private tryInvokeWildCardDirectories;
3341
3343
  openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult;
3342
3344
  private removeOrphanScriptInfos;
3343
3345
  private telemetryOnOpenFile;
package/lib/typescript.js CHANGED
@@ -484,6 +484,7 @@ __export(typescript_exports, {
484
484
  decodeMappings: () => decodeMappings,
485
485
  decodedTextSpanIntersectsWith: () => decodedTextSpanIntersectsWith,
486
486
  deduplicate: () => deduplicate,
487
+ defaultInitCompilerOptions: () => defaultInitCompilerOptions,
487
488
  defaultMaximumTruncationLength: () => defaultMaximumTruncationLength,
488
489
  diagnosticCategoryName: () => diagnosticCategoryName,
489
490
  diagnosticToString: () => diagnosticToString,
@@ -2259,7 +2260,7 @@ module.exports = __toCommonJS(typescript_exports);
2259
2260
 
2260
2261
  // src/compiler/corePublic.ts
2261
2262
  var versionMajorMinor = "5.6";
2262
- var version = `${versionMajorMinor}.0-dev.20240725`;
2263
+ var version = `${versionMajorMinor}.0-dev.20240727`;
2263
2264
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2264
2265
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2265
2266
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -50089,6 +50090,7 @@ function createTypeChecker(host) {
50089
50090
  getNonOptionalType: removeOptionalTypeMarker,
50090
50091
  getTypeArguments,
50091
50092
  typeToTypeNode: nodeBuilder.typeToTypeNode,
50093
+ typePredicateToTypePredicateNode: nodeBuilder.typePredicateToTypePredicateNode,
50092
50094
  indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration,
50093
50095
  signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration,
50094
50096
  symbolToEntityName: nodeBuilder.symbolToEntityName,
@@ -72407,6 +72409,9 @@ function createTypeChecker(host) {
72407
72409
  return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType;
72408
72410
  }
72409
72411
  function isFunctionObjectType(type) {
72412
+ if (getObjectFlags(type) & 256 /* EvolvingArray */) {
72413
+ return false;
72414
+ }
72410
72415
  const resolved = resolveStructuredTypeMembers(type);
72411
72416
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
72412
72417
  }
@@ -108407,7 +108412,7 @@ function transformES2015(context) {
108407
108412
  statement,
108408
108413
  /*outermostLabeledStatement*/
108409
108414
  node
108410
- ) : factory2.restoreEnclosingLabel(Debug.checkDefined(visitNode(statement, visitor, isStatement, factory2.liftToBlock)), node, convertedLoopState && resetLabel);
108415
+ ) : factory2.restoreEnclosingLabel(visitNode(statement, visitor, isStatement, factory2.liftToBlock) ?? setTextRange(factory2.createEmptyStatement(), statement), node, convertedLoopState && resetLabel);
108411
108416
  }
108412
108417
  function visitIterationStatement(node, outermostLabeledStatement) {
108413
108418
  switch (node.kind) {
@@ -112713,7 +112718,7 @@ function transformModule(context) {
112713
112718
  return factory2.updateLabeledStatement(
112714
112719
  node,
112715
112720
  node.label,
112716
- visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) ?? factory2.createExpressionStatement(factory2.createIdentifier(""))
112721
+ visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) ?? setTextRange(factory2.createEmptyStatement(), node.statement)
112717
112722
  );
112718
112723
  }
112719
112724
  function visitWithStatement(node) {
@@ -148186,7 +148191,27 @@ function getInfo4(context) {
148186
148191
  return { error: getLocaleSpecificMessage(Diagnostics.Return_type_must_be_inferred_from_a_function) };
148187
148192
  }
148188
148193
  const typeChecker = context.program.getTypeChecker();
148189
- const returnType = tryGetReturnType(typeChecker, declaration);
148194
+ let returnType;
148195
+ if (typeChecker.isImplementationOfOverload(declaration)) {
148196
+ const signatures = typeChecker.getTypeAtLocation(declaration).getCallSignatures();
148197
+ if (signatures.length > 1) {
148198
+ returnType = typeChecker.getUnionType(mapDefined(signatures, (s) => s.getReturnType()));
148199
+ }
148200
+ }
148201
+ if (!returnType) {
148202
+ const signature = typeChecker.getSignatureFromDeclaration(declaration);
148203
+ if (signature) {
148204
+ const typePredicate = typeChecker.getTypePredicateOfSignature(signature);
148205
+ if (typePredicate && typePredicate.type) {
148206
+ const typePredicateTypeNode = typeChecker.typePredicateToTypePredicateNode(typePredicate, declaration, 1 /* NoTruncation */);
148207
+ if (typePredicateTypeNode) {
148208
+ return { declaration, returnTypeNode: typePredicateTypeNode };
148209
+ }
148210
+ } else {
148211
+ returnType = typeChecker.getReturnTypeOfSignature(signature);
148212
+ }
148213
+ }
148214
+ }
148190
148215
  if (!returnType) {
148191
148216
  return { error: getLocaleSpecificMessage(Diagnostics.Could_not_determine_function_return_type) };
148192
148217
  }
@@ -148206,18 +148231,6 @@ function isConvertibleDeclaration(node) {
148206
148231
  return false;
148207
148232
  }
148208
148233
  }
148209
- function tryGetReturnType(typeChecker, node) {
148210
- if (typeChecker.isImplementationOfOverload(node)) {
148211
- const signatures = typeChecker.getTypeAtLocation(node).getCallSignatures();
148212
- if (signatures.length > 1) {
148213
- return typeChecker.getUnionType(mapDefined(signatures, (s) => s.getReturnType()));
148214
- }
148215
- }
148216
- const signature = typeChecker.getSignatureFromDeclaration(node);
148217
- if (signature) {
148218
- return typeChecker.getReturnTypeOfSignature(signature);
148219
- }
148220
- }
148221
148234
 
148222
148235
  // src/services/classifier2020.ts
148223
148236
  var TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => {
@@ -150115,6 +150128,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
150115
150128
  synchronizeHostData();
150116
150129
  Debug.assert(args.type === "file");
150117
150130
  const sourceFile = getValidSourceFile(args.fileName);
150131
+ if (containsParseError(sourceFile)) return emptyArray;
150118
150132
  const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
150119
150133
  const mode = args.mode ?? (args.skipDestructiveCodeActions ? "SortAndCombine" /* SortAndCombine */ : "All" /* All */);
150120
150134
  return ts_OrganizeImports_exports.organizeImports(sourceFile, formatContext, host, program, preferences, mode);
@@ -151762,6 +151776,7 @@ __export(ts_codefix_exports, {
151762
151776
  setJsonCompilerOptionValue: () => setJsonCompilerOptionValue,
151763
151777
  setJsonCompilerOptionValues: () => setJsonCompilerOptionValues,
151764
151778
  tryGetAutoImportableReferenceFromTypeNode: () => tryGetAutoImportableReferenceFromTypeNode,
151779
+ typePredicateToAutoImportableTypeNode: () => typePredicateToAutoImportableTypeNode,
151765
151780
  typeToAutoImportableTypeNode: () => typeToAutoImportableTypeNode
151766
151781
  });
151767
151782
 
@@ -159848,7 +159863,25 @@ function withContext(context, typePrintMode, cb) {
159848
159863
  if (typePrintMode === 1 /* Relative */) {
159849
159864
  return relativeType(node);
159850
159865
  }
159851
- let type = isValueSignatureDeclaration(node) ? tryGetReturnType2(node) : typeChecker.getTypeAtLocation(node);
159866
+ let type;
159867
+ if (isValueSignatureDeclaration(node)) {
159868
+ const signature = typeChecker.getSignatureFromDeclaration(node);
159869
+ if (signature) {
159870
+ const typePredicate = typeChecker.getTypePredicateOfSignature(signature);
159871
+ if (typePredicate) {
159872
+ if (!typePredicate.type) {
159873
+ return emptyInferenceResult;
159874
+ }
159875
+ return {
159876
+ typeNode: typePredicateToTypeNode(typePredicate, findAncestor(node, isDeclaration) ?? sourceFile, getFlags(typePredicate.type)),
159877
+ mutatedTarget: false
159878
+ };
159879
+ }
159880
+ type = typeChecker.getReturnTypeOfSignature(signature);
159881
+ }
159882
+ } else {
159883
+ type = typeChecker.getTypeAtLocation(node);
159884
+ }
159852
159885
  if (!type) {
159853
159886
  return emptyInferenceResult;
159854
159887
  }
@@ -159865,11 +159898,13 @@ function withContext(context, typePrintMode, cb) {
159865
159898
  if (isParameter(node) && typeChecker.requiresAddingImplicitUndefined(node)) {
159866
159899
  type = typeChecker.getUnionType([typeChecker.getUndefinedType(), type], 0 /* None */);
159867
159900
  }
159868
- const flags = (isVariableDeclaration(node) || isPropertyDeclaration(node) && hasSyntacticModifier(node, 256 /* Static */ | 8 /* Readonly */)) && type.flags & 8192 /* UniqueESSymbol */ ? 1048576 /* AllowUniqueESSymbolType */ : 0 /* None */;
159869
159901
  return {
159870
- typeNode: typeToTypeNode2(type, findAncestor(node, isDeclaration) ?? sourceFile, flags),
159902
+ typeNode: typeToTypeNode2(type, findAncestor(node, isDeclaration) ?? sourceFile, getFlags(type)),
159871
159903
  mutatedTarget: false
159872
159904
  };
159905
+ function getFlags(type2) {
159906
+ return (isVariableDeclaration(node) || isPropertyDeclaration(node) && hasSyntacticModifier(node, 256 /* Static */ | 8 /* Readonly */)) && type2.flags & 8192 /* UniqueESSymbol */ ? 1048576 /* AllowUniqueESSymbolType */ : 0 /* None */;
159907
+ }
159873
159908
  }
159874
159909
  function createTypeOfFromEntityNameExpression(node) {
159875
159910
  return factory.createTypeQueryNode(getSynthesizedDeepClone(node));
@@ -160032,11 +160067,18 @@ function withContext(context, typePrintMode, cb) {
160032
160067
  });
160033
160068
  return isTruncated ? factory.createKeywordTypeNode(133 /* AnyKeyword */) : result2;
160034
160069
  }
160035
- function tryGetReturnType2(node) {
160036
- const signature = typeChecker.getSignatureFromDeclaration(node);
160037
- if (signature) {
160038
- return typeChecker.getReturnTypeOfSignature(signature);
160039
- }
160070
+ function typePredicateToTypeNode(typePredicate, enclosingDeclaration, flags = 0 /* None */) {
160071
+ let isTruncated = false;
160072
+ const result2 = typePredicateToAutoImportableTypeNode(typeChecker, importAdder, typePredicate, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, {
160073
+ moduleResolverHost: program,
160074
+ trackSymbol() {
160075
+ return true;
160076
+ },
160077
+ reportTruncationError() {
160078
+ isTruncated = true;
160079
+ }
160080
+ });
160081
+ return isTruncated ? factory.createKeywordTypeNode(133 /* AnyKeyword */) : result2;
160040
160082
  }
160041
160083
  function addTypeToVariableLike(decl) {
160042
160084
  const { typeNode } = inferType(decl);
@@ -161707,6 +161749,17 @@ function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, s
161707
161749
  }
161708
161750
  return getSynthesizedDeepClone(typeNode);
161709
161751
  }
161752
+ function typePredicateToAutoImportableTypeNode(checker, importAdder, typePredicate, contextNode, scriptTarget, flags, tracker) {
161753
+ let typePredicateNode = checker.typePredicateToTypePredicateNode(typePredicate, contextNode, flags, tracker);
161754
+ if ((typePredicateNode == null ? void 0 : typePredicateNode.type) && isImportTypeNode(typePredicateNode.type)) {
161755
+ const importableReference = tryGetAutoImportableReferenceFromTypeNode(typePredicateNode.type, scriptTarget);
161756
+ if (importableReference) {
161757
+ importSymbols(importAdder, importableReference.symbols);
161758
+ typePredicateNode = factory.updateTypePredicateNode(typePredicateNode, typePredicateNode.assertsModifier, typePredicateNode.parameterName, importableReference.typeNode);
161759
+ }
161760
+ }
161761
+ return getSynthesizedDeepClone(typePredicateNode);
161762
+ }
161710
161763
  function typeContainsTypeParameter(type) {
161711
161764
  if (type.isUnionOrIntersection()) {
161712
161765
  return type.types.some(typeContainsTypeParameter);
@@ -179429,6 +179482,7 @@ __export(ts_exports2, {
179429
179482
  decodeMappings: () => decodeMappings,
179430
179483
  decodedTextSpanIntersectsWith: () => decodedTextSpanIntersectsWith,
179431
179484
  deduplicate: () => deduplicate,
179485
+ defaultInitCompilerOptions: () => defaultInitCompilerOptions,
179432
179486
  defaultMaximumTruncationLength: () => defaultMaximumTruncationLength,
179433
179487
  diagnosticCategoryName: () => diagnosticCategoryName,
179434
179488
  diagnosticToString: () => diagnosticToString,
@@ -183069,7 +183123,7 @@ var Project2 = class _Project {
183069
183123
  }
183070
183124
  fileExists(file) {
183071
183125
  const path = this.toPath(file);
183072
- return !this.isWatchedMissingFile(path) && this.directoryStructureHost.fileExists(file);
183126
+ return !!this.projectService.getScriptInfoForPath(path) || !this.isWatchedMissingFile(path) && this.directoryStructureHost.fileExists(file);
183073
183127
  }
183074
183128
  /** @internal */
183075
183129
  resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
@@ -186093,59 +186147,13 @@ var _ProjectService = class _ProjectService {
186093
186147
  watchWildcardDirectory(directory, flags, configFileName, config) {
186094
186148
  let watcher = this.watchFactory.watchDirectory(
186095
186149
  directory,
186096
- (fileOrDirectory) => {
186097
- const fileOrDirectoryPath = this.toPath(fileOrDirectory);
186098
- const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
186099
- if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
186100
- const file = this.getNormalizedAbsolutePath(fileOrDirectory);
186101
- this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
186102
- this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
186103
- this.watchPackageJsonFile(file, fileOrDirectoryPath, result);
186104
- }
186105
- const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
186106
- if (isIgnoredFileFromWildCardWatching({
186107
- watchedDirPath: this.toPath(directory),
186108
- fileOrDirectory,
186109
- fileOrDirectoryPath,
186110
- configFileName,
186111
- extraFileExtensions: this.hostConfiguration.extraFileExtensions,
186112
- currentDirectory: this.currentDirectory,
186113
- options: config.parsedCommandLine.options,
186114
- program: (configuredProjectForConfig == null ? void 0 : configuredProjectForConfig.getCurrentProgram()) || config.parsedCommandLine.fileNames,
186115
- useCaseSensitiveFileNames: this.host.useCaseSensitiveFileNames,
186116
- writeLog: (s) => this.logger.info(s),
186117
- toPath: (s) => this.toPath(s),
186118
- getScriptKind: configuredProjectForConfig ? (fileName) => configuredProjectForConfig.getScriptKind(fileName) : void 0
186119
- })) return;
186120
- if (config.updateLevel !== 2 /* Full */) config.updateLevel = 1 /* RootNamesAndUpdate */;
186121
- config.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => {
186122
- var _a;
186123
- if (!watchWildcardDirectories) return;
186124
- const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
186125
- if (!project) return;
186126
- if (configuredProjectForConfig !== project && this.getHostPreferences().includeCompletionsForModuleExports) {
186127
- const path = this.toPath(configFileName);
186128
- if (find((_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) {
186129
- project.markAutoImportProviderAsDirty();
186130
- }
186131
- }
186132
- const updateLevel = configuredProjectForConfig === project ? 1 /* RootNamesAndUpdate */ : 0 /* Update */;
186133
- if (project.pendingUpdateLevel > updateLevel) return;
186134
- if (this.openFiles.has(fileOrDirectoryPath)) {
186135
- const info = Debug.checkDefined(this.getScriptInfoForPath(fileOrDirectoryPath));
186136
- if (info.isAttached(project)) {
186137
- const loadLevelToSet = Math.max(updateLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* Update */);
186138
- project.openFileWatchTriggered.set(fileOrDirectoryPath, loadLevelToSet);
186139
- } else {
186140
- project.pendingUpdateLevel = updateLevel;
186141
- this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
186142
- }
186143
- } else {
186144
- project.pendingUpdateLevel = updateLevel;
186145
- this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
186146
- }
186147
- });
186148
- },
186150
+ (fileOrDirectory) => this.onWildCardDirectoryWatcherInvoke(
186151
+ directory,
186152
+ configFileName,
186153
+ config,
186154
+ result,
186155
+ fileOrDirectory
186156
+ ),
186149
186157
  flags,
186150
186158
  this.getWatchOptionsFromProjectWatchOptions(config.parsedCommandLine.watchOptions, getDirectoryPath(configFileName)),
186151
186159
  WatchType.WildcardDirectory,
@@ -186168,6 +186176,59 @@ var _ProjectService = class _ProjectService {
186168
186176
  };
186169
186177
  return result;
186170
186178
  }
186179
+ onWildCardDirectoryWatcherInvoke(directory, configFileName, config, wildCardWatcher, fileOrDirectory) {
186180
+ const fileOrDirectoryPath = this.toPath(fileOrDirectory);
186181
+ const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
186182
+ if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
186183
+ const file = this.getNormalizedAbsolutePath(fileOrDirectory);
186184
+ this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
186185
+ this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
186186
+ this.watchPackageJsonFile(file, fileOrDirectoryPath, wildCardWatcher);
186187
+ }
186188
+ const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
186189
+ if (isIgnoredFileFromWildCardWatching({
186190
+ watchedDirPath: this.toPath(directory),
186191
+ fileOrDirectory,
186192
+ fileOrDirectoryPath,
186193
+ configFileName,
186194
+ extraFileExtensions: this.hostConfiguration.extraFileExtensions,
186195
+ currentDirectory: this.currentDirectory,
186196
+ options: config.parsedCommandLine.options,
186197
+ program: (configuredProjectForConfig == null ? void 0 : configuredProjectForConfig.getCurrentProgram()) || config.parsedCommandLine.fileNames,
186198
+ useCaseSensitiveFileNames: this.host.useCaseSensitiveFileNames,
186199
+ writeLog: (s) => this.logger.info(s),
186200
+ toPath: (s) => this.toPath(s),
186201
+ getScriptKind: configuredProjectForConfig ? (fileName) => configuredProjectForConfig.getScriptKind(fileName) : void 0
186202
+ })) return;
186203
+ if (config.updateLevel !== 2 /* Full */) config.updateLevel = 1 /* RootNamesAndUpdate */;
186204
+ config.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => {
186205
+ var _a;
186206
+ if (!watchWildcardDirectories) return;
186207
+ const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
186208
+ if (!project) return;
186209
+ if (configuredProjectForConfig !== project && this.getHostPreferences().includeCompletionsForModuleExports) {
186210
+ const path = this.toPath(configFileName);
186211
+ if (find((_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) {
186212
+ project.markAutoImportProviderAsDirty();
186213
+ }
186214
+ }
186215
+ const updateLevel = configuredProjectForConfig === project ? 1 /* RootNamesAndUpdate */ : 0 /* Update */;
186216
+ if (project.pendingUpdateLevel > updateLevel) return;
186217
+ if (this.openFiles.has(fileOrDirectoryPath)) {
186218
+ const info = Debug.checkDefined(this.getScriptInfoForPath(fileOrDirectoryPath));
186219
+ if (info.isAttached(project)) {
186220
+ const loadLevelToSet = Math.max(updateLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* Update */);
186221
+ project.openFileWatchTriggered.set(fileOrDirectoryPath, loadLevelToSet);
186222
+ } else {
186223
+ project.pendingUpdateLevel = updateLevel;
186224
+ this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
186225
+ }
186226
+ } else {
186227
+ project.pendingUpdateLevel = updateLevel;
186228
+ this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
186229
+ }
186230
+ });
186231
+ }
186171
186232
  delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
186172
186233
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
186173
186234
  if (!(configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config)) return false;
@@ -188084,8 +188145,38 @@ Dynamic files must always be opened with service's current directory or service
188084
188145
  }
188085
188146
  this.removeOrphanScriptInfos();
188086
188147
  }
188148
+ tryInvokeWildCardDirectories(info) {
188149
+ this.configFileExistenceInfoCache.forEach((configFileExistenceInfo, config) => {
188150
+ var _a, _b;
188151
+ if (!((_a = configFileExistenceInfo.config) == null ? void 0 : _a.parsedCommandLine) || contains(
188152
+ configFileExistenceInfo.config.parsedCommandLine.fileNames,
188153
+ info.fileName,
188154
+ !this.host.useCaseSensitiveFileNames ? equateStringsCaseInsensitive : equateStringsCaseSensitive
188155
+ )) {
188156
+ return;
188157
+ }
188158
+ (_b = configFileExistenceInfo.config.watchedDirectories) == null ? void 0 : _b.forEach((watcher, directory) => {
188159
+ if (containsPath(directory, info.fileName, !this.host.useCaseSensitiveFileNames)) {
188160
+ this.logger.info(`Invoking ${config}:: wildcard for open scriptInfo:: ${info.fileName}`);
188161
+ this.onWildCardDirectoryWatcherInvoke(
188162
+ directory,
188163
+ config,
188164
+ configFileExistenceInfo.config,
188165
+ watcher.watcher,
188166
+ info.fileName
188167
+ );
188168
+ }
188169
+ });
188170
+ });
188171
+ }
188087
188172
  openClientFileWithNormalizedPath(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath) {
188173
+ const existing = this.getScriptInfoForPath(normalizedPathToPath(
188174
+ fileName,
188175
+ projectRootPath ? this.getNormalizedAbsolutePath(projectRootPath) : this.currentDirectory,
188176
+ this.toCanonicalFileName
188177
+ ));
188088
188178
  const info = this.getOrCreateOpenScriptInfo(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath);
188179
+ if (!existing && info && !info.isDynamic) this.tryInvokeWildCardDirectories(info);
188089
188180
  const { retainProjects, ...result } = this.assignProjectToOpenedScriptInfo(info);
188090
188181
  this.cleanupProjectsAndScriptInfos(
188091
188182
  retainProjects,
@@ -188232,10 +188323,16 @@ Dynamic files must always be opened with service's current directory or service
188232
188323
  }
188233
188324
  /** @internal */
188234
188325
  applyChangesInOpenFiles(openFiles, changedFiles, closedFiles) {
188326
+ let existingOpenScriptInfos;
188235
188327
  let openScriptInfos;
188236
188328
  let assignOrphanScriptInfosToInferredProject = false;
188237
188329
  if (openFiles) {
188238
188330
  for (const file of openFiles) {
188331
+ (existingOpenScriptInfos ?? (existingOpenScriptInfos = [])).push(this.getScriptInfoForPath(normalizedPathToPath(
188332
+ toNormalizedPath(file.fileName),
188333
+ file.projectRootPath ? this.getNormalizedAbsolutePath(file.projectRootPath) : this.currentDirectory,
188334
+ this.toCanonicalFileName
188335
+ )));
188239
188336
  const info = this.getOrCreateOpenScriptInfo(
188240
188337
  toNormalizedPath(file.fileName),
188241
188338
  file.content,
@@ -188263,6 +188360,10 @@ Dynamic files must always be opened with service's current directory or service
188263
188360
  }
188264
188361
  }
188265
188362
  let retainProjects;
188363
+ forEach(
188364
+ existingOpenScriptInfos,
188365
+ (existing, index) => !existing && openScriptInfos[index] && !openScriptInfos[index].isDynamic ? this.tryInvokeWildCardDirectories(openScriptInfos[index]) : void 0
188366
+ );
188266
188367
  openScriptInfos == null ? void 0 : openScriptInfos.forEach((info) => {
188267
188368
  var _a;
188268
188369
  return (_a = this.assignProjectToOpenedScriptInfo(info).retainProjects) == null ? void 0 : _a.forEach((p) => (retainProjects ?? (retainProjects = /* @__PURE__ */ new Set())).add(p));
@@ -193766,6 +193867,7 @@ if (typeof console !== "undefined") {
193766
193867
  decodeMappings,
193767
193868
  decodedTextSpanIntersectsWith,
193768
193869
  deduplicate,
193870
+ defaultInitCompilerOptions,
193769
193871
  defaultMaximumTruncationLength,
193770
193872
  diagnosticCategoryName,
193771
193873
  diagnosticToString,
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": "5.6.0-dev.20240725",
5
+ "version": "5.6.0-dev.20240727",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -114,5 +114,5 @@
114
114
  "node": "20.1.0",
115
115
  "npm": "8.19.4"
116
116
  },
117
- "gitHead": "7319968e90600102892a79142fb804bcbe384160"
117
+ "gitHead": "9757109cafcb771a35ad9fe09855373cdd82005a"
118
118
  }