typescript 5.4.0-dev.20231109 → 5.4.0-dev.20231111

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.4";
21
- var version = `${versionMajorMinor}.0-dev.20231109`;
21
+ var version = `${versionMajorMinor}.0-dev.20231111`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
package/lib/tsserver.js CHANGED
@@ -2330,7 +2330,7 @@ module.exports = __toCommonJS(server_exports);
2330
2330
 
2331
2331
  // src/compiler/corePublic.ts
2332
2332
  var versionMajorMinor = "5.4";
2333
- var version = `${versionMajorMinor}.0-dev.20231109`;
2333
+ var version = `${versionMajorMinor}.0-dev.20231111`;
2334
2334
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2335
2335
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2336
2336
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -145046,6 +145046,13 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
145046
145046
  return sourceFile;
145047
145047
  }
145048
145048
  function synchronizeHostData() {
145049
+ if (host.updateFromProject && !host.updateFromProjectInProgress) {
145050
+ host.updateFromProject();
145051
+ } else {
145052
+ synchronizeHostDataWorker();
145053
+ }
145054
+ }
145055
+ function synchronizeHostDataWorker() {
145049
145056
  var _a2, _b, _c;
145050
145057
  Debug.assert(languageServiceMode !== 2 /* Syntactic */);
145051
145058
  if (host.getProjectVersion) {
@@ -175413,6 +175420,35 @@ var TypingsInstaller = class {
175413
175420
  }
175414
175421
  }
175415
175422
  }
175423
+ /** @internal */
175424
+ installPackage(req) {
175425
+ const { fileName, packageName, projectName, projectRootPath } = req;
175426
+ const cwd = forEachAncestorDirectory(getDirectoryPath(fileName), (directory) => {
175427
+ if (this.installTypingHost.fileExists(combinePaths(directory, "package.json"))) {
175428
+ return directory;
175429
+ }
175430
+ }) || projectRootPath;
175431
+ if (cwd) {
175432
+ this.installWorker(-1, [packageName], cwd, (success) => {
175433
+ const message = success ? `Package ${packageName} installed.` : `There was an error installing ${packageName}.`;
175434
+ const response = {
175435
+ kind: ActionPackageInstalled,
175436
+ projectName,
175437
+ success,
175438
+ message
175439
+ };
175440
+ this.sendResponse(response);
175441
+ });
175442
+ } else {
175443
+ const response = {
175444
+ kind: ActionPackageInstalled,
175445
+ projectName,
175446
+ success: false,
175447
+ message: "Could not determine a project root path."
175448
+ };
175449
+ this.sendResponse(response);
175450
+ }
175451
+ }
175416
175452
  initializeSafeList() {
175417
175453
  if (this.typesMapLocation) {
175418
175454
  const safeListFromMap = ts_JsTyping_exports.loadTypesMap(this.installTypingHost, this.typesMapLocation);
@@ -176788,6 +176824,8 @@ var Project3 = class _Project {
176788
176824
  this.createHash = maybeBind(this.projectService.host, this.projectService.host.createHash);
176789
176825
  /** @internal */
176790
176826
  this.globalCacheResolutionModuleName = ts_JsTyping_exports.nonRelativeModuleNameForTypingCache;
176827
+ /** @internal */
176828
+ this.updateFromProjectInProgress = false;
176791
176829
  this.projectName = projectName;
176792
176830
  this.directoryStructureHost = directoryStructureHost;
176793
176831
  this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory);
@@ -177532,6 +177570,10 @@ var Project3 = class _Project {
177532
177570
  onDiscoveredSymlink() {
177533
177571
  this.hasAddedOrRemovedSymlinks = true;
177534
177572
  }
177573
+ /** @internal */
177574
+ updateFromProject() {
177575
+ updateProjectIfDirty(this);
177576
+ }
177535
177577
  /**
177536
177578
  * Updates set of files that contribute to this project
177537
177579
  * @returns: true if set of files in the project stays the same and false - otherwise.
@@ -177549,7 +177591,7 @@ var Project3 = class _Project {
177549
177591
  for (const file of changedFiles) {
177550
177592
  this.cachedUnresolvedImportsPerFile.delete(file);
177551
177593
  }
177552
- if (this.languageServiceEnabled && this.projectService.serverMode === 0 /* Semantic */) {
177594
+ if (this.languageServiceEnabled && this.projectService.serverMode === 0 /* Semantic */ && !this.isOrphan()) {
177553
177595
  if (hasNewProgram || changedFiles.length) {
177554
177596
  this.lastCachedUnresolvedImportsList = getUnresolvedImports(this.program, this.cachedUnresolvedImportsPerFile);
177555
177597
  }
@@ -177690,8 +177732,10 @@ var Project3 = class _Project {
177690
177732
  this.hasInvalidatedResolutions = hasInvalidatedResolutions;
177691
177733
  this.hasInvalidatedLibResolutions = hasInvalidatedLibResolutions;
177692
177734
  this.resolutionCache.startCachingPerDirectoryResolution();
177693
- this.program = this.languageService.getProgram();
177694
177735
  this.dirty = false;
177736
+ this.updateFromProjectInProgress = true;
177737
+ this.program = this.languageService.getProgram();
177738
+ this.updateFromProjectInProgress = false;
177695
177739
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "finishCachingPerDirectoryResolution");
177696
177740
  this.resolutionCache.finishCachingPerDirectoryResolution(this.program, oldProgram);
177697
177741
  (_b = tracing) == null ? void 0 : _b.pop();
@@ -183807,9 +183851,10 @@ var Session3 = class _Session {
183807
183851
  }
183808
183852
  }
183809
183853
  projectsUpdatedInBackgroundEvent(openFiles) {
183810
- this.projectService.logger.info(`got projects updated in background, updating diagnostics for ${openFiles}`);
183854
+ this.projectService.logger.info(`got projects updated in background ${openFiles}`);
183811
183855
  if (openFiles.length) {
183812
183856
  if (!this.suppressDiagnosticEvents && !this.noGetErrOnBackgroundUpdate) {
183857
+ this.projectService.logger.info(`Queueing diagnostics update for ${openFiles}`);
183813
183858
  this.errorCheck.startNew((next) => this.updateErrorCheck(
183814
183859
  next,
183815
183860
  openFiles,
@@ -183880,7 +183925,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
183880
183925
  send(msg) {
183881
183926
  if (msg.type === "event" && !this.canUseEvents) {
183882
183927
  if (this.logger.hasLevel(3 /* verbose */)) {
183883
- this.logger.info(`Session does not support events: ignored event: ${JSON.stringify(msg)}`);
183928
+ this.logger.info(`Session does not support events: ignored event: ${stringifyIndented(msg)}`);
183884
183929
  }
183885
183930
  return;
183886
183931
  }
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.4";
38
- version = `${versionMajorMinor}.0-dev.20231109`;
38
+ version = `${versionMajorMinor}.0-dev.20231111`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -142987,6 +142987,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
142987
142987
  return sourceFile;
142988
142988
  }
142989
142989
  function synchronizeHostData() {
142990
+ if (host.updateFromProject && !host.updateFromProjectInProgress) {
142991
+ host.updateFromProject();
142992
+ } else {
142993
+ synchronizeHostDataWorker();
142994
+ }
142995
+ }
142996
+ function synchronizeHostDataWorker() {
142990
142997
  var _a2, _b, _c;
142991
142998
  Debug.assert(languageServiceMode !== 2 /* Syntactic */);
142992
142999
  if (host.getProjectVersion) {
@@ -172628,6 +172635,35 @@ ${options.prefix}` : "\n" : options.prefix
172628
172635
  }
172629
172636
  }
172630
172637
  }
172638
+ /** @internal */
172639
+ installPackage(req) {
172640
+ const { fileName, packageName, projectName, projectRootPath } = req;
172641
+ const cwd = forEachAncestorDirectory(getDirectoryPath(fileName), (directory) => {
172642
+ if (this.installTypingHost.fileExists(combinePaths(directory, "package.json"))) {
172643
+ return directory;
172644
+ }
172645
+ }) || projectRootPath;
172646
+ if (cwd) {
172647
+ this.installWorker(-1, [packageName], cwd, (success) => {
172648
+ const message = success ? `Package ${packageName} installed.` : `There was an error installing ${packageName}.`;
172649
+ const response = {
172650
+ kind: ActionPackageInstalled,
172651
+ projectName,
172652
+ success,
172653
+ message
172654
+ };
172655
+ this.sendResponse(response);
172656
+ });
172657
+ } else {
172658
+ const response = {
172659
+ kind: ActionPackageInstalled,
172660
+ projectName,
172661
+ success: false,
172662
+ message: "Could not determine a project root path."
172663
+ };
172664
+ this.sendResponse(response);
172665
+ }
172666
+ }
172631
172667
  initializeSafeList() {
172632
172668
  if (this.typesMapLocation) {
172633
172669
  const safeListFromMap = ts_JsTyping_exports.loadTypesMap(this.installTypingHost, this.typesMapLocation);
@@ -174119,6 +174155,8 @@ ${options.prefix}` : "\n" : options.prefix
174119
174155
  this.createHash = maybeBind(this.projectService.host, this.projectService.host.createHash);
174120
174156
  /** @internal */
174121
174157
  this.globalCacheResolutionModuleName = ts_JsTyping_exports.nonRelativeModuleNameForTypingCache;
174158
+ /** @internal */
174159
+ this.updateFromProjectInProgress = false;
174122
174160
  this.projectName = projectName;
174123
174161
  this.directoryStructureHost = directoryStructureHost;
174124
174162
  this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory);
@@ -174863,6 +174901,10 @@ ${options.prefix}` : "\n" : options.prefix
174863
174901
  onDiscoveredSymlink() {
174864
174902
  this.hasAddedOrRemovedSymlinks = true;
174865
174903
  }
174904
+ /** @internal */
174905
+ updateFromProject() {
174906
+ updateProjectIfDirty(this);
174907
+ }
174866
174908
  /**
174867
174909
  * Updates set of files that contribute to this project
174868
174910
  * @returns: true if set of files in the project stays the same and false - otherwise.
@@ -174880,7 +174922,7 @@ ${options.prefix}` : "\n" : options.prefix
174880
174922
  for (const file of changedFiles) {
174881
174923
  this.cachedUnresolvedImportsPerFile.delete(file);
174882
174924
  }
174883
- if (this.languageServiceEnabled && this.projectService.serverMode === 0 /* Semantic */) {
174925
+ if (this.languageServiceEnabled && this.projectService.serverMode === 0 /* Semantic */ && !this.isOrphan()) {
174884
174926
  if (hasNewProgram || changedFiles.length) {
174885
174927
  this.lastCachedUnresolvedImportsList = getUnresolvedImports(this.program, this.cachedUnresolvedImportsPerFile);
174886
174928
  }
@@ -175021,8 +175063,10 @@ ${options.prefix}` : "\n" : options.prefix
175021
175063
  this.hasInvalidatedResolutions = hasInvalidatedResolutions;
175022
175064
  this.hasInvalidatedLibResolutions = hasInvalidatedLibResolutions;
175023
175065
  this.resolutionCache.startCachingPerDirectoryResolution();
175024
- this.program = this.languageService.getProgram();
175025
175066
  this.dirty = false;
175067
+ this.updateFromProjectInProgress = true;
175068
+ this.program = this.languageService.getProgram();
175069
+ this.updateFromProjectInProgress = false;
175026
175070
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "finishCachingPerDirectoryResolution");
175027
175071
  this.resolutionCache.finishCachingPerDirectoryResolution(this.program, oldProgram);
175028
175072
  (_b = tracing) == null ? void 0 : _b.pop();
@@ -181206,9 +181250,10 @@ ${json}${newLine}`;
181206
181250
  }
181207
181251
  }
181208
181252
  projectsUpdatedInBackgroundEvent(openFiles) {
181209
- this.projectService.logger.info(`got projects updated in background, updating diagnostics for ${openFiles}`);
181253
+ this.projectService.logger.info(`got projects updated in background ${openFiles}`);
181210
181254
  if (openFiles.length) {
181211
181255
  if (!this.suppressDiagnosticEvents && !this.noGetErrOnBackgroundUpdate) {
181256
+ this.projectService.logger.info(`Queueing diagnostics update for ${openFiles}`);
181212
181257
  this.errorCheck.startNew((next) => this.updateErrorCheck(
181213
181258
  next,
181214
181259
  openFiles,
@@ -181279,7 +181324,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
181279
181324
  send(msg) {
181280
181325
  if (msg.type === "event" && !this.canUseEvents) {
181281
181326
  if (this.logger.hasLevel(3 /* verbose */)) {
181282
- this.logger.info(`Session does not support events: ignored event: ${JSON.stringify(msg)}`);
181327
+ this.logger.info(`Session does not support events: ignored event: ${stringifyIndented(msg)}`);
181283
181328
  }
181284
181329
  return;
181285
181330
  }
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.4";
57
- var version = `${versionMajorMinor}.0-dev.20231109`;
57
+ var version = `${versionMajorMinor}.0-dev.20231111`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -31902,6 +31902,35 @@ var TypingsInstaller = class {
31902
31902
  }
31903
31903
  }
31904
31904
  }
31905
+ /** @internal */
31906
+ installPackage(req) {
31907
+ const { fileName, packageName, projectName, projectRootPath } = req;
31908
+ const cwd = forEachAncestorDirectory(getDirectoryPath(fileName), (directory) => {
31909
+ if (this.installTypingHost.fileExists(combinePaths(directory, "package.json"))) {
31910
+ return directory;
31911
+ }
31912
+ }) || projectRootPath;
31913
+ if (cwd) {
31914
+ this.installWorker(-1, [packageName], cwd, (success) => {
31915
+ const message = success ? `Package ${packageName} installed.` : `There was an error installing ${packageName}.`;
31916
+ const response = {
31917
+ kind: ActionPackageInstalled,
31918
+ projectName,
31919
+ success,
31920
+ message
31921
+ };
31922
+ this.sendResponse(response);
31923
+ });
31924
+ } else {
31925
+ const response = {
31926
+ kind: ActionPackageInstalled,
31927
+ projectName,
31928
+ success: false,
31929
+ message: "Could not determine a project root path."
31930
+ };
31931
+ this.sendResponse(response);
31932
+ }
31933
+ }
31905
31934
  initializeSafeList() {
31906
31935
  if (this.typesMapLocation) {
31907
31936
  const safeListFromMap = ts_JsTyping_exports.loadTypesMap(this.installTypingHost, this.typesMapLocation);
@@ -32252,18 +32281,7 @@ var NodeTypingsInstaller = class extends TypingsInstaller {
32252
32281
  break;
32253
32282
  }
32254
32283
  case "installPackage": {
32255
- const { fileName, packageName, projectName, projectRootPath } = req;
32256
- const cwd = getDirectoryOfPackageJson(fileName, this.installTypingHost) || projectRootPath;
32257
- if (cwd) {
32258
- this.installWorker(-1, [packageName], cwd, (success) => {
32259
- const message = success ? `Package ${packageName} installed.` : `There was an error installing ${packageName}.`;
32260
- const response = { kind: ActionPackageInstalled, projectName, success, message };
32261
- this.sendResponse(response);
32262
- });
32263
- } else {
32264
- const response = { kind: ActionPackageInstalled, projectName, success: false, message: "Could not determine a project root path." };
32265
- this.sendResponse(response);
32266
- }
32284
+ this.installPackage(req);
32267
32285
  break;
32268
32286
  }
32269
32287
  default:
@@ -32281,7 +32299,7 @@ var NodeTypingsInstaller = class extends TypingsInstaller {
32281
32299
  }
32282
32300
  installWorker(requestId, packageNames, cwd, onRequestCompleted) {
32283
32301
  if (this.log.isEnabled()) {
32284
- this.log.writeLine(`#${requestId} with arguments'${JSON.stringify(packageNames)}'.`);
32302
+ this.log.writeLine(`#${requestId} with cwd: ${cwd} arguments: ${JSON.stringify(packageNames)}`);
32285
32303
  }
32286
32304
  const start = Date.now();
32287
32305
  const hasError = installNpmPackages(this.npmPath, version, packageNames, (command) => this.execSyncAndLog(command, { cwd }));
@@ -32308,13 +32326,6 @@ var NodeTypingsInstaller = class extends TypingsInstaller {
32308
32326
  }
32309
32327
  }
32310
32328
  };
32311
- function getDirectoryOfPackageJson(fileName, host) {
32312
- return forEachAncestorDirectory(getDirectoryPath(fileName), (directory) => {
32313
- if (host.fileExists(combinePaths(directory, "package.json"))) {
32314
- return directory;
32315
- }
32316
- });
32317
- }
32318
32329
  var logFilePath = findArgument(Arguments.LogFile);
32319
32330
  var globalTypingsCacheLocation = findArgument(Arguments.GlobalCacheLocation);
32320
32331
  var typingSafeListLocation = findArgument(Arguments.TypingSafeListLocation);
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.4.0-dev.20231109",
5
+ "version": "5.4.0-dev.20231111",
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": "8e1fb5789abcd93592d8e437df8f7261295613fc"
117
+ "gitHead": "ca7a3af5e607a6c8589f5f600d6c4960a8bc07d4"
118
118
  }