typescript 5.6.0-dev.20240724 → 5.6.0-dev.20240726

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.20240724`;
21
+ var version = `${versionMajorMinor}.0-dev.20240726`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -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
@@ -2259,7 +2259,7 @@ module.exports = __toCommonJS(typescript_exports);
2259
2259
 
2260
2260
  // src/compiler/corePublic.ts
2261
2261
  var versionMajorMinor = "5.6";
2262
- var version = `${versionMajorMinor}.0-dev.20240724`;
2262
+ var version = `${versionMajorMinor}.0-dev.20240726`;
2263
2263
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2264
2264
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2265
2265
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -150115,6 +150115,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
150115
150115
  synchronizeHostData();
150116
150116
  Debug.assert(args.type === "file");
150117
150117
  const sourceFile = getValidSourceFile(args.fileName);
150118
+ if (containsParseError(sourceFile)) return emptyArray;
150118
150119
  const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
150119
150120
  const mode = args.mode ?? (args.skipDestructiveCodeActions ? "SortAndCombine" /* SortAndCombine */ : "All" /* All */);
150120
150121
  return ts_OrganizeImports_exports.organizeImports(sourceFile, formatContext, host, program, preferences, mode);
@@ -157350,7 +157351,7 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
157350
157351
  const moduleDeclaration = find(symbol.declarations, isModuleDeclaration);
157351
157352
  const moduleDeclarationSourceFile = moduleDeclaration == null ? void 0 : moduleDeclaration.getSourceFile();
157352
157353
  if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
157353
- return { kind: 2 /* Function */, token, call: parent2.parent, sourceFile, modifierFlags: 32 /* Export */, parentDeclaration: moduleDeclaration };
157354
+ return { kind: 2 /* Function */, token, call: parent2.parent, sourceFile: moduleDeclarationSourceFile, modifierFlags: 32 /* Export */, parentDeclaration: moduleDeclaration };
157354
157355
  }
157355
157356
  const moduleSourceFile = find(symbol.declarations, isSourceFile);
157356
157357
  if (sourceFile.commonJsModuleIndicator) return void 0;
@@ -183069,7 +183070,7 @@ var Project2 = class _Project {
183069
183070
  }
183070
183071
  fileExists(file) {
183071
183072
  const path = this.toPath(file);
183072
- return !this.isWatchedMissingFile(path) && this.directoryStructureHost.fileExists(file);
183073
+ return !!this.projectService.getScriptInfoForPath(path) || !this.isWatchedMissingFile(path) && this.directoryStructureHost.fileExists(file);
183073
183074
  }
183074
183075
  /** @internal */
183075
183076
  resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
@@ -186093,59 +186094,13 @@ var _ProjectService = class _ProjectService {
186093
186094
  watchWildcardDirectory(directory, flags, configFileName, config) {
186094
186095
  let watcher = this.watchFactory.watchDirectory(
186095
186096
  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
- },
186097
+ (fileOrDirectory) => this.onWildCardDirectoryWatcherInvoke(
186098
+ directory,
186099
+ configFileName,
186100
+ config,
186101
+ result,
186102
+ fileOrDirectory
186103
+ ),
186149
186104
  flags,
186150
186105
  this.getWatchOptionsFromProjectWatchOptions(config.parsedCommandLine.watchOptions, getDirectoryPath(configFileName)),
186151
186106
  WatchType.WildcardDirectory,
@@ -186168,6 +186123,59 @@ var _ProjectService = class _ProjectService {
186168
186123
  };
186169
186124
  return result;
186170
186125
  }
186126
+ onWildCardDirectoryWatcherInvoke(directory, configFileName, config, wildCardWatcher, fileOrDirectory) {
186127
+ const fileOrDirectoryPath = this.toPath(fileOrDirectory);
186128
+ const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
186129
+ if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
186130
+ const file = this.getNormalizedAbsolutePath(fileOrDirectory);
186131
+ this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
186132
+ this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
186133
+ this.watchPackageJsonFile(file, fileOrDirectoryPath, wildCardWatcher);
186134
+ }
186135
+ const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
186136
+ if (isIgnoredFileFromWildCardWatching({
186137
+ watchedDirPath: this.toPath(directory),
186138
+ fileOrDirectory,
186139
+ fileOrDirectoryPath,
186140
+ configFileName,
186141
+ extraFileExtensions: this.hostConfiguration.extraFileExtensions,
186142
+ currentDirectory: this.currentDirectory,
186143
+ options: config.parsedCommandLine.options,
186144
+ program: (configuredProjectForConfig == null ? void 0 : configuredProjectForConfig.getCurrentProgram()) || config.parsedCommandLine.fileNames,
186145
+ useCaseSensitiveFileNames: this.host.useCaseSensitiveFileNames,
186146
+ writeLog: (s) => this.logger.info(s),
186147
+ toPath: (s) => this.toPath(s),
186148
+ getScriptKind: configuredProjectForConfig ? (fileName) => configuredProjectForConfig.getScriptKind(fileName) : void 0
186149
+ })) return;
186150
+ if (config.updateLevel !== 2 /* Full */) config.updateLevel = 1 /* RootNamesAndUpdate */;
186151
+ config.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => {
186152
+ var _a;
186153
+ if (!watchWildcardDirectories) return;
186154
+ const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
186155
+ if (!project) return;
186156
+ if (configuredProjectForConfig !== project && this.getHostPreferences().includeCompletionsForModuleExports) {
186157
+ const path = this.toPath(configFileName);
186158
+ if (find((_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) {
186159
+ project.markAutoImportProviderAsDirty();
186160
+ }
186161
+ }
186162
+ const updateLevel = configuredProjectForConfig === project ? 1 /* RootNamesAndUpdate */ : 0 /* Update */;
186163
+ if (project.pendingUpdateLevel > updateLevel) return;
186164
+ if (this.openFiles.has(fileOrDirectoryPath)) {
186165
+ const info = Debug.checkDefined(this.getScriptInfoForPath(fileOrDirectoryPath));
186166
+ if (info.isAttached(project)) {
186167
+ const loadLevelToSet = Math.max(updateLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* Update */);
186168
+ project.openFileWatchTriggered.set(fileOrDirectoryPath, loadLevelToSet);
186169
+ } else {
186170
+ project.pendingUpdateLevel = updateLevel;
186171
+ this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
186172
+ }
186173
+ } else {
186174
+ project.pendingUpdateLevel = updateLevel;
186175
+ this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
186176
+ }
186177
+ });
186178
+ }
186171
186179
  delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
186172
186180
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
186173
186181
  if (!(configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config)) return false;
@@ -188084,8 +188092,38 @@ Dynamic files must always be opened with service's current directory or service
188084
188092
  }
188085
188093
  this.removeOrphanScriptInfos();
188086
188094
  }
188095
+ tryInvokeWildCardDirectories(info) {
188096
+ this.configFileExistenceInfoCache.forEach((configFileExistenceInfo, config) => {
188097
+ var _a, _b;
188098
+ if (!((_a = configFileExistenceInfo.config) == null ? void 0 : _a.parsedCommandLine) || contains(
188099
+ configFileExistenceInfo.config.parsedCommandLine.fileNames,
188100
+ info.fileName,
188101
+ !this.host.useCaseSensitiveFileNames ? equateStringsCaseInsensitive : equateStringsCaseSensitive
188102
+ )) {
188103
+ return;
188104
+ }
188105
+ (_b = configFileExistenceInfo.config.watchedDirectories) == null ? void 0 : _b.forEach((watcher, directory) => {
188106
+ if (containsPath(directory, info.fileName, !this.host.useCaseSensitiveFileNames)) {
188107
+ this.logger.info(`Invoking ${config}:: wildcard for open scriptInfo:: ${info.fileName}`);
188108
+ this.onWildCardDirectoryWatcherInvoke(
188109
+ directory,
188110
+ config,
188111
+ configFileExistenceInfo.config,
188112
+ watcher.watcher,
188113
+ info.fileName
188114
+ );
188115
+ }
188116
+ });
188117
+ });
188118
+ }
188087
188119
  openClientFileWithNormalizedPath(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath) {
188120
+ const existing = this.getScriptInfoForPath(normalizedPathToPath(
188121
+ fileName,
188122
+ projectRootPath ? this.getNormalizedAbsolutePath(projectRootPath) : this.currentDirectory,
188123
+ this.toCanonicalFileName
188124
+ ));
188088
188125
  const info = this.getOrCreateOpenScriptInfo(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath);
188126
+ if (!existing && info && !info.isDynamic) this.tryInvokeWildCardDirectories(info);
188089
188127
  const { retainProjects, ...result } = this.assignProjectToOpenedScriptInfo(info);
188090
188128
  this.cleanupProjectsAndScriptInfos(
188091
188129
  retainProjects,
@@ -188232,10 +188270,16 @@ Dynamic files must always be opened with service's current directory or service
188232
188270
  }
188233
188271
  /** @internal */
188234
188272
  applyChangesInOpenFiles(openFiles, changedFiles, closedFiles) {
188273
+ let existingOpenScriptInfos;
188235
188274
  let openScriptInfos;
188236
188275
  let assignOrphanScriptInfosToInferredProject = false;
188237
188276
  if (openFiles) {
188238
188277
  for (const file of openFiles) {
188278
+ (existingOpenScriptInfos ?? (existingOpenScriptInfos = [])).push(this.getScriptInfoForPath(normalizedPathToPath(
188279
+ toNormalizedPath(file.fileName),
188280
+ file.projectRootPath ? this.getNormalizedAbsolutePath(file.projectRootPath) : this.currentDirectory,
188281
+ this.toCanonicalFileName
188282
+ )));
188239
188283
  const info = this.getOrCreateOpenScriptInfo(
188240
188284
  toNormalizedPath(file.fileName),
188241
188285
  file.content,
@@ -188263,6 +188307,10 @@ Dynamic files must always be opened with service's current directory or service
188263
188307
  }
188264
188308
  }
188265
188309
  let retainProjects;
188310
+ forEach(
188311
+ existingOpenScriptInfos,
188312
+ (existing, index) => !existing && openScriptInfos[index] && !openScriptInfos[index].isDynamic ? this.tryInvokeWildCardDirectories(openScriptInfos[index]) : void 0
188313
+ );
188266
188314
  openScriptInfos == null ? void 0 : openScriptInfos.forEach((info) => {
188267
188315
  var _a;
188268
188316
  return (_a = this.assignProjectToOpenedScriptInfo(info).retainProjects) == null ? void 0 : _a.forEach((p) => (retainProjects ?? (retainProjects = /* @__PURE__ */ new Set())).add(p));
@@ -191367,42 +191415,12 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
191367
191415
  const prefix = args.prefix || "";
191368
191416
  const entries = mapDefined(completions.entries, (entry) => {
191369
191417
  if (completions.isMemberCompletion || startsWith(entry.name.toLowerCase(), prefix.toLowerCase())) {
191370
- const {
191371
- name,
191372
- kind: kind2,
191373
- kindModifiers,
191374
- sortText,
191375
- insertText,
191376
- filterText,
191377
- replacementSpan,
191378
- hasAction,
191379
- source,
191380
- sourceDisplay,
191381
- labelDetails,
191382
- isSnippet,
191383
- isRecommended,
191384
- isPackageJsonImport,
191385
- isImportStatementCompletion,
191386
- data
191387
- } = entry;
191388
- const convertedSpan = replacementSpan ? toProtocolTextSpan(replacementSpan, scriptInfo) : void 0;
191418
+ const convertedSpan = entry.replacementSpan ? toProtocolTextSpan(entry.replacementSpan, scriptInfo) : void 0;
191389
191419
  return {
191390
- name,
191391
- kind: kind2,
191392
- kindModifiers,
191393
- sortText,
191394
- insertText,
191395
- filterText,
191420
+ ...entry,
191396
191421
  replacementSpan: convertedSpan,
191397
- isSnippet,
191398
- hasAction: hasAction || void 0,
191399
- source,
191400
- sourceDisplay,
191401
- labelDetails,
191402
- isRecommended,
191403
- isPackageJsonImport,
191404
- isImportStatementCompletion,
191405
- data
191422
+ hasAction: entry.hasAction || void 0,
191423
+ symbol: void 0
191406
191424
  };
191407
191425
  }
191408
191426
  });
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.20240724",
5
+ "version": "5.6.0-dev.20240726",
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": "3f6f3164d6b8226953490bb43fd1ae5a7aa99fa4"
117
+ "gitHead": "12ae799eda74aca6a4051f1ebee4d2d0c8d817a2"
118
118
  }