typescript 5.6.0-dev.20240624 → 5.6.0-dev.20240626

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.20240624`;
21
+ var version = `${versionMajorMinor}.0-dev.20240626`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -5924,7 +5924,7 @@ var Diagnostics = {
5924
5924
  Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, 1 /* Error */, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
5925
5925
  Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, 1 /* Error */, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
5926
5926
  Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext: diag(1323, 1 /* Error */, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'."),
5927
- Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext: diag(1324, 1 /* Error */, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nod_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'."),
5927
+ Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodenext_or_preserve: diag(1324, 1 /* Error */, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodene_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'."),
5928
5928
  Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, 1 /* Error */, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
5929
5929
  This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, 1 /* Error */, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),
5930
5930
  String_literal_with_double_quotes_expected: diag(1327, 1 /* Error */, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
@@ -25642,17 +25642,22 @@ var disposeResourcesHelper = {
25642
25642
  env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
25643
25643
  env.hasError = true;
25644
25644
  }
25645
+ var r, s = 0;
25645
25646
  function next() {
25646
- while (env.stack.length) {
25647
- var rec = env.stack.pop();
25647
+ while (r = env.stack.pop()) {
25648
25648
  try {
25649
- var result = rec.dispose && rec.dispose.call(rec.value);
25650
- if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
25649
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
25650
+ if (r.dispose) {
25651
+ var result = r.dispose.call(r.value);
25652
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
25653
+ }
25654
+ else s |= 1;
25651
25655
  }
25652
25656
  catch (e) {
25653
25657
  fail(e);
25654
25658
  }
25655
25659
  }
25660
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
25656
25661
  if (env.hasError) throw env.error;
25657
25662
  }
25658
25663
  return next();
@@ -46524,6 +46529,8 @@ function createTypeChecker(host) {
46524
46529
  moduleName,
46525
46530
  moduleName,
46526
46531
  moduleNotFoundError,
46532
+ /*ignoreErrors*/
46533
+ false,
46527
46534
  /*isForAugmentation*/
46528
46535
  true
46529
46536
  );
@@ -48085,14 +48092,14 @@ function createTypeChecker(host) {
48085
48092
  function resolveExternalModuleName(location, moduleReferenceExpression, ignoreErrors) {
48086
48093
  const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
48087
48094
  const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
48088
- return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage);
48095
+ return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage, ignoreErrors);
48089
48096
  }
48090
- function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation = false) {
48091
- return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
48097
+ function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, ignoreErrors = false, isForAugmentation = false) {
48098
+ return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
48092
48099
  }
48093
48100
  function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
48094
48101
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
48095
- if (startsWith(moduleReference, "@types/")) {
48102
+ if (errorNode && startsWith(moduleReference, "@types/")) {
48096
48103
  const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
48097
48104
  const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
48098
48105
  error(errorNode, diag2, withoutAtTypePrefix, moduleReference);
@@ -48114,7 +48121,7 @@ function createTypeChecker(host) {
48114
48121
  const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
48115
48122
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
48116
48123
  const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
48117
- const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
48124
+ const resolutionDiagnostic = errorNode && resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
48118
48125
  const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
48119
48126
  if (sourceFile) {
48120
48127
  if (resolutionDiagnostic) {
@@ -48122,7 +48129,7 @@ function createTypeChecker(host) {
48122
48129
  }
48123
48130
  if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
48124
48131
  const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
48125
- if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
48132
+ if (errorNode && importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
48126
48133
  error(
48127
48134
  errorNode,
48128
48135
  Diagnostics.A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead,
@@ -48131,13 +48138,13 @@ function createTypeChecker(host) {
48131
48138
  }
48132
48139
  } else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
48133
48140
  const importOrExport = ((_i = findAncestor(location, isImportDeclaration)) == null ? void 0 : _i.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
48134
- if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
48141
+ if (errorNode && !((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
48135
48142
  const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
48136
48143
  error(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
48137
48144
  }
48138
48145
  }
48139
48146
  if (sourceFile.symbol) {
48140
- if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
48147
+ if (errorNode && resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
48141
48148
  errorOnImplicitAnyModule(
48142
48149
  /*isError*/
48143
48150
  false,
@@ -48148,9 +48155,9 @@ function createTypeChecker(host) {
48148
48155
  moduleReference
48149
48156
  );
48150
48157
  }
48151
- if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
48158
+ if (errorNode && (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */)) {
48152
48159
  const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
48153
- const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
48160
+ const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l) || isJSDocImportTag(l));
48154
48161
  if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
48155
48162
  if (findAncestor(location, isImportEqualsDeclaration)) {
48156
48163
  error(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
@@ -48208,7 +48215,7 @@ function createTypeChecker(host) {
48208
48215
  }
48209
48216
  return getMergedSymbol(sourceFile.symbol);
48210
48217
  }
48211
- if (moduleNotFoundError) {
48218
+ if (errorNode && moduleNotFoundError) {
48212
48219
  error(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
48213
48220
  }
48214
48221
  return void 0;
@@ -48223,6 +48230,9 @@ function createTypeChecker(host) {
48223
48230
  return getMergedSymbol(pattern.symbol);
48224
48231
  }
48225
48232
  }
48233
+ if (!errorNode) {
48234
+ return void 0;
48235
+ }
48226
48236
  if (resolvedModule && !resolutionExtensionIsTSOrJson(resolvedModule.extension) && resolutionDiagnostic === void 0 || resolutionDiagnostic === Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type) {
48227
48237
  if (isForAugmentation) {
48228
48238
  const diag2 = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
@@ -65195,7 +65205,7 @@ function createTypeChecker(host) {
65195
65205
  for (let i = 0; i < types.length; i++) {
65196
65206
  if (include[i]) {
65197
65207
  const targetType = getTypeOfPropertyOrIndexSignatureOfType(types[i], propertyName);
65198
- if (targetType && related(getDiscriminatingType(), targetType)) {
65208
+ if (targetType && someType(getDiscriminatingType(), (t) => !!related(t, targetType))) {
65199
65209
  matched = true;
65200
65210
  } else {
65201
65211
  include[i] = 3 /* Maybe */;
@@ -87499,11 +87509,11 @@ function createTypeChecker(host) {
87499
87509
  return grammarErrorOnNode(node, Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
87500
87510
  }
87501
87511
  const nodeArguments = node.arguments;
87502
- if (moduleKind !== 99 /* ESNext */ && moduleKind !== 199 /* NodeNext */ && moduleKind !== 100 /* Node16 */) {
87512
+ if (moduleKind !== 99 /* ESNext */ && moduleKind !== 199 /* NodeNext */ && moduleKind !== 100 /* Node16 */ && moduleKind !== 200 /* Preserve */) {
87503
87513
  checkGrammarForDisallowedTrailingComma(nodeArguments);
87504
87514
  if (nodeArguments.length > 1) {
87505
87515
  const importAttributesArgument = nodeArguments[1];
87506
- return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
87516
+ return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodenext_or_preserve);
87507
87517
  }
87508
87518
  }
87509
87519
  if (nodeArguments.length === 0 || nodeArguments.length > 2) {
@@ -92611,8 +92621,6 @@ function transformClassFields(context) {
92611
92621
  return node;
92612
92622
  }
92613
92623
  switch (node.kind) {
92614
- case 129 /* AccessorKeyword */:
92615
- return Debug.fail("Use `modifierVisitor` instead.");
92616
92624
  case 263 /* ClassDeclaration */:
92617
92625
  return visitClassDeclaration(node);
92618
92626
  case 231 /* ClassExpression */:
@@ -118788,7 +118796,7 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
118788
118796
  }
118789
118797
  function getModeForUsageLocationWorker(file, usage, compilerOptions) {
118790
118798
  var _a;
118791
- if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
118799
+ if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent) || isJSDocImportTag(usage.parent)) {
118792
118800
  const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
118793
118801
  if (isTypeOnly) {
118794
118802
  const override = getResolutionModeOverride(usage.parent.attributes);
package/lib/tsserver.js CHANGED
@@ -15,9 +15,11 @@ and limitations under the License.
15
15
 
16
16
 
17
17
  "use strict";
18
+ var __create = Object.create;
18
19
  var __defProp = Object.defineProperty;
19
20
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
20
21
  var __getOwnPropNames = Object.getOwnPropertyNames;
22
+ var __getProtoOf = Object.getPrototypeOf;
21
23
  var __hasOwnProp = Object.prototype.hasOwnProperty;
22
24
  var __copyProps = (to, from, except, desc) => {
23
25
  if (from && typeof from === "object" || typeof from === "function") {
@@ -28,11 +30,29 @@ var __copyProps = (to, from, except, desc) => {
28
30
  return to;
29
31
  };
30
32
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
33
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
34
+ // If the importer is in node compatibility mode or this is not an ESM
35
+ // file that has been converted to a CommonJS file using a Babel-
36
+ // compatible transform (i.e. "__esModule" has not been set), then set
37
+ // "default" to the CommonJS "module.exports" for node compatibility.
38
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
39
+ mod
40
+ ));
41
+
42
+ // src/tsserver/server.ts
43
+ var import_os2 = __toESM(require("os"));
31
44
 
32
45
  // src/typescript/typescript.ts
33
46
  var typescript_exports = {};
34
47
  __reExport(typescript_exports, require("./typescript.js"));
35
48
 
49
+ // src/tsserver/nodeServer.ts
50
+ var import_child_process = __toESM(require("child_process"));
51
+ var import_fs = __toESM(require("fs"));
52
+ var import_net = __toESM(require("net"));
53
+ var import_os = __toESM(require("os"));
54
+ var import_readline = __toESM(require("readline"));
55
+
36
56
  // src/tsserver/common.ts
37
57
  function getLogLevel(level) {
38
58
  if (level) {
@@ -107,8 +127,6 @@ function parseServerMode() {
107
127
  }
108
128
  function initializeNodeSystem() {
109
129
  const sys4 = typescript_exports.Debug.checkDefined(typescript_exports.sys);
110
- const childProcess = require("child_process");
111
- const fs = require("fs");
112
130
  class Logger {
113
131
  constructor(logFilename, traceToConsole, level) {
114
132
  this.logFilename = logFilename;
@@ -120,7 +138,7 @@ function initializeNodeSystem() {
120
138
  this.fd = -1;
121
139
  if (this.logFilename) {
122
140
  try {
123
- this.fd = fs.openSync(this.logFilename, "w");
141
+ this.fd = import_fs.default.openSync(this.logFilename, "w");
124
142
  } catch (_) {
125
143
  }
126
144
  }
@@ -130,7 +148,7 @@ function initializeNodeSystem() {
130
148
  }
131
149
  close() {
132
150
  if (this.fd >= 0) {
133
- fs.close(this.fd, typescript_exports.noop);
151
+ import_fs.default.close(this.fd, typescript_exports.noop);
134
152
  }
135
153
  }
136
154
  getLogFileName() {
@@ -177,7 +195,7 @@ function initializeNodeSystem() {
177
195
  write(s, _type) {
178
196
  if (this.fd >= 0) {
179
197
  const buf = Buffer.from(s);
180
- fs.writeSync(
198
+ import_fs.default.writeSync(
181
199
  this.fd,
182
200
  buf,
183
201
  0,
@@ -228,7 +246,7 @@ function initializeNodeSystem() {
228
246
  if (logger.hasLevel(typescript_exports.server.LogLevel.verbose)) {
229
247
  logger.info(`Starting ${process.execPath} with args:${typescript_exports.server.stringifyIndented(args)}`);
230
248
  }
231
- childProcess.execFileSync(process.execPath, args, { stdio: "ignore", env: { ELECTRON_RUN_AS_NODE: "1" } });
249
+ import_child_process.default.execFileSync(process.execPath, args, { stdio: "ignore", env: { ELECTRON_RUN_AS_NODE: "1" } });
232
250
  status = true;
233
251
  if (logger.hasLevel(typescript_exports.server.LogLevel.verbose)) {
234
252
  logger.info(`WatchGuard for path ${path} returned: OK`);
@@ -267,7 +285,7 @@ function initializeNodeSystem() {
267
285
  }
268
286
  let cancellationToken;
269
287
  try {
270
- const factory = require("./cancellationToken");
288
+ const factory = require("./cancellationToken.js");
271
289
  cancellationToken = factory(sys4.args);
272
290
  } catch (e) {
273
291
  cancellationToken = typescript_exports.server.nullCancellationToken;
@@ -349,11 +367,7 @@ function parseEventPort(eventPortStr) {
349
367
  return eventPort !== void 0 && !isNaN(eventPort) ? eventPort : void 0;
350
368
  }
351
369
  function startNodeSession(options, logger, cancellationToken) {
352
- const childProcess = require("child_process");
353
- const os = require("os");
354
- const net = require("net");
355
- const readline = require("readline");
356
- const rl = readline.createInterface({
370
+ const rl = import_readline.default.createInterface({
357
371
  input: process.stdin,
358
372
  output: process.stdout,
359
373
  terminal: false
@@ -406,7 +420,7 @@ function startNodeSession(options, logger, cancellationToken) {
406
420
  }
407
421
  }
408
422
  const typingsInstaller = (0, typescript_exports.combinePaths)((0, typescript_exports.getDirectoryPath)(typescript_exports.sys.getExecutingFilePath()), "typingsInstaller.js");
409
- this.installer = childProcess.fork(typingsInstaller, args, { execArgv });
423
+ this.installer = import_child_process.default.fork(typingsInstaller, args, { execArgv });
410
424
  this.installer.on("message", (m) => this.handleMessage(m));
411
425
  this.host.setImmediate(() => this.event({ pid: this.installer.pid }, "typingsInstallerPid"));
412
426
  process.on("exit", () => {
@@ -442,7 +456,7 @@ function startNodeSession(options, logger, cancellationToken) {
442
456
  });
443
457
  this.eventPort = eventPort;
444
458
  if (this.canUseEvents && this.eventPort) {
445
- const s = net.connect({ port: this.eventPort }, () => {
459
+ const s = import_net.default.connect({ port: this.eventPort }, () => {
446
460
  this.eventSocket = s;
447
461
  if (this.socketEventQueue) {
448
462
  for (const event2 of this.socketEventQueue) {
@@ -537,7 +551,7 @@ function startNodeSession(options, logger, cancellationToken) {
537
551
  function getGlobalTypingsCacheLocation() {
538
552
  switch (process.platform) {
539
553
  case "win32": {
540
- const basePath = process.env.LOCALAPPDATA || process.env.APPDATA || os.homedir && os.homedir() || process.env.USERPROFILE || process.env.HOMEDRIVE && process.env.HOMEPATH && (0, typescript_exports.normalizeSlashes)(process.env.HOMEDRIVE + process.env.HOMEPATH) || os.tmpdir();
554
+ const basePath = process.env.LOCALAPPDATA || process.env.APPDATA || import_os.default.homedir && import_os.default.homedir() || process.env.USERPROFILE || process.env.HOMEDRIVE && process.env.HOMEPATH && (0, typescript_exports.normalizeSlashes)(process.env.HOMEDRIVE + process.env.HOMEPATH) || import_os.default.tmpdir();
541
555
  return (0, typescript_exports.combinePaths)((0, typescript_exports.combinePaths)((0, typescript_exports.normalizeSlashes)(basePath), "Microsoft/TypeScript"), typescript_exports.versionMajorMinor);
542
556
  }
543
557
  case "openbsd":
@@ -558,7 +572,7 @@ function startNodeSession(options, logger, cancellationToken) {
558
572
  return process.env.XDG_CACHE_HOME;
559
573
  }
560
574
  const usersDir = platformIsDarwin ? "Users" : "home";
561
- const homePath = os.homedir && os.homedir() || process.env.HOME || (process.env.LOGNAME || process.env.USER) && `/${usersDir}/${process.env.LOGNAME || process.env.USER}` || os.tmpdir();
575
+ const homePath = import_os.default.homedir && import_os.default.homedir() || process.env.HOME || (process.env.LOGNAME || process.env.USER) && `/${usersDir}/${process.env.LOGNAME || process.env.USER}` || import_os.default.tmpdir();
562
576
  const cacheFolder = platformIsDarwin ? "Library/Caches" : ".cache";
563
577
  return (0, typescript_exports.combinePaths)((0, typescript_exports.normalizeSlashes)(homePath), cacheFolder);
564
578
  }
@@ -605,5 +619,5 @@ function start({ args, logger, cancellationToken, serverMode, unknownServerMode,
605
619
  );
606
620
  }
607
621
  typescript_exports.setStackTraceLimit();
608
- start(initializeNodeSystem(), require("os").platform());
622
+ start(initializeNodeSystem(), import_os2.default.platform());
609
623
  //# sourceMappingURL=tsserver.js.map
package/lib/typescript.js CHANGED
@@ -2377,7 +2377,7 @@ module.exports = __toCommonJS(typescript_exports);
2377
2377
 
2378
2378
  // src/compiler/corePublic.ts
2379
2379
  var versionMajorMinor = "5.6";
2380
- var version = `${versionMajorMinor}.0-dev.20240624`;
2380
+ var version = `${versionMajorMinor}.0-dev.20240626`;
2381
2381
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2382
2382
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2383
2383
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -9493,7 +9493,7 @@ var Diagnostics = {
9493
9493
  Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, 1 /* Error */, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
9494
9494
  Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, 1 /* Error */, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
9495
9495
  Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext: diag(1323, 1 /* Error */, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'."),
9496
- Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext: diag(1324, 1 /* Error */, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nod_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'."),
9496
+ Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodenext_or_preserve: diag(1324, 1 /* Error */, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodene_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'."),
9497
9497
  Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, 1 /* Error */, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
9498
9498
  This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, 1 /* Error */, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),
9499
9499
  String_literal_with_double_quotes_expected: diag(1327, 1 /* Error */, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
@@ -30045,17 +30045,22 @@ var disposeResourcesHelper = {
30045
30045
  env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
30046
30046
  env.hasError = true;
30047
30047
  }
30048
+ var r, s = 0;
30048
30049
  function next() {
30049
- while (env.stack.length) {
30050
- var rec = env.stack.pop();
30050
+ while (r = env.stack.pop()) {
30051
30051
  try {
30052
- var result = rec.dispose && rec.dispose.call(rec.value);
30053
- if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
30052
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
30053
+ if (r.dispose) {
30054
+ var result = r.dispose.call(r.value);
30055
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
30056
+ }
30057
+ else s |= 1;
30054
30058
  }
30055
30059
  catch (e) {
30056
30060
  fail(e);
30057
30061
  }
30058
30062
  }
30063
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
30059
30064
  if (env.hasError) throw env.error;
30060
30065
  }
30061
30066
  return next();
@@ -51407,6 +51412,8 @@ function createTypeChecker(host) {
51407
51412
  moduleName,
51408
51413
  moduleName,
51409
51414
  moduleNotFoundError,
51415
+ /*ignoreErrors*/
51416
+ false,
51410
51417
  /*isForAugmentation*/
51411
51418
  true
51412
51419
  );
@@ -52968,14 +52975,14 @@ function createTypeChecker(host) {
52968
52975
  function resolveExternalModuleName(location, moduleReferenceExpression, ignoreErrors) {
52969
52976
  const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
52970
52977
  const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
52971
- return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage);
52978
+ return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage, ignoreErrors);
52972
52979
  }
52973
- function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation = false) {
52974
- return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
52980
+ function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, ignoreErrors = false, isForAugmentation = false) {
52981
+ return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
52975
52982
  }
52976
52983
  function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
52977
52984
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
52978
- if (startsWith(moduleReference, "@types/")) {
52985
+ if (errorNode && startsWith(moduleReference, "@types/")) {
52979
52986
  const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
52980
52987
  const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
52981
52988
  error2(errorNode, diag2, withoutAtTypePrefix, moduleReference);
@@ -52997,7 +53004,7 @@ function createTypeChecker(host) {
52997
53004
  const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
52998
53005
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
52999
53006
  const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
53000
- const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
53007
+ const resolutionDiagnostic = errorNode && resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
53001
53008
  const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
53002
53009
  if (sourceFile) {
53003
53010
  if (resolutionDiagnostic) {
@@ -53005,7 +53012,7 @@ function createTypeChecker(host) {
53005
53012
  }
53006
53013
  if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
53007
53014
  const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
53008
- if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
53015
+ if (errorNode && importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
53009
53016
  error2(
53010
53017
  errorNode,
53011
53018
  Diagnostics.A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead,
@@ -53014,13 +53021,13 @@ function createTypeChecker(host) {
53014
53021
  }
53015
53022
  } else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
53016
53023
  const importOrExport = ((_i = findAncestor(location, isImportDeclaration)) == null ? void 0 : _i.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
53017
- if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
53024
+ if (errorNode && !((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
53018
53025
  const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
53019
53026
  error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
53020
53027
  }
53021
53028
  }
53022
53029
  if (sourceFile.symbol) {
53023
- if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
53030
+ if (errorNode && resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
53024
53031
  errorOnImplicitAnyModule(
53025
53032
  /*isError*/
53026
53033
  false,
@@ -53031,9 +53038,9 @@ function createTypeChecker(host) {
53031
53038
  moduleReference
53032
53039
  );
53033
53040
  }
53034
- if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
53041
+ if (errorNode && (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */)) {
53035
53042
  const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
53036
- const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
53043
+ const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l) || isJSDocImportTag(l));
53037
53044
  if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
53038
53045
  if (findAncestor(location, isImportEqualsDeclaration)) {
53039
53046
  error2(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
@@ -53091,7 +53098,7 @@ function createTypeChecker(host) {
53091
53098
  }
53092
53099
  return getMergedSymbol(sourceFile.symbol);
53093
53100
  }
53094
- if (moduleNotFoundError) {
53101
+ if (errorNode && moduleNotFoundError) {
53095
53102
  error2(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
53096
53103
  }
53097
53104
  return void 0;
@@ -53106,6 +53113,9 @@ function createTypeChecker(host) {
53106
53113
  return getMergedSymbol(pattern.symbol);
53107
53114
  }
53108
53115
  }
53116
+ if (!errorNode) {
53117
+ return void 0;
53118
+ }
53109
53119
  if (resolvedModule && !resolutionExtensionIsTSOrJson(resolvedModule.extension) && resolutionDiagnostic === void 0 || resolutionDiagnostic === Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type) {
53110
53120
  if (isForAugmentation) {
53111
53121
  const diag2 = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
@@ -70078,7 +70088,7 @@ function createTypeChecker(host) {
70078
70088
  for (let i = 0; i < types.length; i++) {
70079
70089
  if (include[i]) {
70080
70090
  const targetType = getTypeOfPropertyOrIndexSignatureOfType(types[i], propertyName);
70081
- if (targetType && related(getDiscriminatingType(), targetType)) {
70091
+ if (targetType && someType(getDiscriminatingType(), (t) => !!related(t, targetType))) {
70082
70092
  matched = true;
70083
70093
  } else {
70084
70094
  include[i] = 3 /* Maybe */;
@@ -92382,11 +92392,11 @@ function createTypeChecker(host) {
92382
92392
  return grammarErrorOnNode(node, Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
92383
92393
  }
92384
92394
  const nodeArguments = node.arguments;
92385
- if (moduleKind !== 99 /* ESNext */ && moduleKind !== 199 /* NodeNext */ && moduleKind !== 100 /* Node16 */) {
92395
+ if (moduleKind !== 99 /* ESNext */ && moduleKind !== 199 /* NodeNext */ && moduleKind !== 100 /* Node16 */ && moduleKind !== 200 /* Preserve */) {
92386
92396
  checkGrammarForDisallowedTrailingComma(nodeArguments);
92387
92397
  if (nodeArguments.length > 1) {
92388
92398
  const importAttributesArgument = nodeArguments[1];
92389
- return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
92399
+ return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodenext_or_preserve);
92390
92400
  }
92391
92401
  }
92392
92402
  if (nodeArguments.length === 0 || nodeArguments.length > 2) {
@@ -97676,8 +97686,6 @@ function transformClassFields(context) {
97676
97686
  return node;
97677
97687
  }
97678
97688
  switch (node.kind) {
97679
- case 129 /* AccessorKeyword */:
97680
- return Debug.fail("Use `modifierVisitor` instead.");
97681
97689
  case 263 /* ClassDeclaration */:
97682
97690
  return visitClassDeclaration(node);
97683
97691
  case 231 /* ClassExpression */:
@@ -123903,7 +123911,7 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
123903
123911
  }
123904
123912
  function getModeForUsageLocationWorker(file, usage, compilerOptions) {
123905
123913
  var _a;
123906
- if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
123914
+ if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent) || isJSDocImportTag(usage.parent)) {
123907
123915
  const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
123908
123916
  if (isTypeOnly) {
123909
123917
  const override = getResolutionModeOverride(usage.parent.attributes);
@@ -188826,11 +188834,12 @@ var MultistepOperation = class {
188826
188834
  }
188827
188835
  complete() {
188828
188836
  if (this.requestId !== void 0) {
188829
- this.operationHost.sendRequestCompletedEvent(this.requestId);
188837
+ this.operationHost.sendRequestCompletedEvent(this.requestId, this.performanceData);
188830
188838
  this.requestId = void 0;
188831
188839
  }
188832
188840
  this.setTimerHandle(void 0);
188833
188841
  this.setImmediateId(void 0);
188842
+ this.performanceData = void 0;
188834
188843
  }
188835
188844
  immediate(actionType, action) {
188836
188845
  const requestId = this.requestId;
@@ -188838,7 +188847,7 @@ var MultistepOperation = class {
188838
188847
  this.setImmediateId(
188839
188848
  this.operationHost.getServerHost().setImmediate(() => {
188840
188849
  this.immediateId = void 0;
188841
- this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action));
188850
+ this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action), this.performanceData);
188842
188851
  }, actionType)
188843
188852
  );
188844
188853
  }
@@ -188849,7 +188858,7 @@ var MultistepOperation = class {
188849
188858
  this.operationHost.getServerHost().setTimeout(
188850
188859
  () => {
188851
188860
  this.timerHandle = void 0;
188852
- this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action));
188861
+ this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action), this.performanceData);
188853
188862
  },
188854
188863
  ms,
188855
188864
  actionType
@@ -188878,6 +188887,7 @@ var MultistepOperation = class {
188878
188887
  this.operationHost.logError(e, `delayed processing of request ${this.requestId}`);
188879
188888
  }
188880
188889
  }
188890
+ this.performanceData = this.operationHost.getPerformanceData();
188881
188891
  if (stop || !this.hasPendingWork()) {
188882
188892
  this.complete();
188883
188893
  }
@@ -189334,7 +189344,10 @@ var Session3 = class _Session {
189334
189344
  },
189335
189345
  ["exit" /* Exit */]: () => {
189336
189346
  this.exit();
189337
- return this.notRequired();
189347
+ return this.notRequired(
189348
+ /*request*/
189349
+ void 0
189350
+ );
189338
189351
  },
189339
189352
  ["definition" /* Definition */]: (request) => {
189340
189353
  return this.requiredResponse(this.getDefinition(
@@ -189426,7 +189439,7 @@ var Session3 = class _Session {
189426
189439
  // TODO: GH#18217
189427
189440
  request.arguments.projectRootPath ? toNormalizedPath(request.arguments.projectRootPath) : void 0
189428
189441
  );
189429
- return this.notRequired();
189442
+ return this.notRequired(request);
189430
189443
  },
189431
189444
  ["quickinfo" /* Quickinfo */]: (request) => {
189432
189445
  return this.requiredResponse(this.getQuickInfoWorker(
@@ -189576,41 +189589,39 @@ var Session3 = class _Session {
189576
189589
  },
189577
189590
  ["geterr" /* Geterr */]: (request) => {
189578
189591
  this.errorCheck.startNew((next) => this.getDiagnostics(next, request.arguments.delay, request.arguments.files));
189579
- return this.notRequired();
189592
+ return this.notRequired(
189593
+ /*request*/
189594
+ void 0
189595
+ );
189580
189596
  },
189581
189597
  ["geterrForProject" /* GeterrForProject */]: (request) => {
189582
189598
  this.errorCheck.startNew((next) => this.getDiagnosticsForProject(next, request.arguments.delay, request.arguments.file));
189583
- return this.notRequired();
189599
+ return this.notRequired(
189600
+ /*request*/
189601
+ void 0
189602
+ );
189584
189603
  },
189585
189604
  ["change" /* Change */]: (request) => {
189586
189605
  this.change(request.arguments);
189587
- return this.notRequired();
189606
+ return this.notRequired(request);
189588
189607
  },
189589
189608
  ["configure" /* Configure */]: (request) => {
189590
189609
  this.projectService.setHostConfiguration(request.arguments);
189591
- this.doOutput(
189592
- /*info*/
189593
- void 0,
189594
- "configure" /* Configure */,
189595
- request.seq,
189596
- /*success*/
189597
- true
189598
- );
189599
- return this.notRequired();
189610
+ return this.notRequired(request);
189600
189611
  },
189601
189612
  ["reload" /* Reload */]: (request) => {
189602
- this.reload(request.arguments, request.seq);
189613
+ this.reload(request.arguments);
189603
189614
  return this.requiredResponse({ reloadFinished: true });
189604
189615
  },
189605
189616
  ["saveto" /* Saveto */]: (request) => {
189606
189617
  const savetoArgs = request.arguments;
189607
189618
  this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile);
189608
- return this.notRequired();
189619
+ return this.notRequired(request);
189609
189620
  },
189610
189621
  ["close" /* Close */]: (request) => {
189611
189622
  const closeArgs = request.arguments;
189612
189623
  this.closeClientFile(closeArgs.file);
189613
- return this.notRequired();
189624
+ return this.notRequired(request);
189614
189625
  },
189615
189626
  ["navto" /* Navto */]: (request) => {
189616
189627
  return this.requiredResponse(this.getNavigateToItems(
@@ -189692,9 +189703,9 @@ var Session3 = class _Session {
189692
189703
  ["projectInfo" /* ProjectInfo */]: (request) => {
189693
189704
  return this.requiredResponse(this.getProjectInfo(request.arguments));
189694
189705
  },
189695
- ["reloadProjects" /* ReloadProjects */]: () => {
189706
+ ["reloadProjects" /* ReloadProjects */]: (request) => {
189696
189707
  this.projectService.reloadProjects();
189697
- return this.notRequired();
189708
+ return this.notRequired(request);
189698
189709
  },
189699
189710
  ["jsxClosingTag" /* JsxClosingTag */]: (request) => {
189700
189711
  return this.requiredResponse(this.getJsxClosingTag(request.arguments));
@@ -189789,15 +189800,7 @@ var Session3 = class _Session {
189789
189800
  },
189790
189801
  ["configurePlugin" /* ConfigurePlugin */]: (request) => {
189791
189802
  this.configurePlugin(request.arguments);
189792
- this.doOutput(
189793
- /*info*/
189794
- void 0,
189795
- "configurePlugin" /* ConfigurePlugin */,
189796
- request.seq,
189797
- /*success*/
189798
- true
189799
- );
189800
- return this.notRequired();
189803
+ return this.notRequired(request);
189801
189804
  },
189802
189805
  ["selectionRange" /* SelectionRange */]: (request) => {
189803
189806
  return this.requiredResponse(this.getSmartSelectionRange(
@@ -189897,11 +189900,12 @@ var Session3 = class _Session {
189897
189900
  const { throttleWaitMilliseconds } = opts;
189898
189901
  this.eventHandler = this.canUseEvents ? opts.eventHandler || ((event) => this.defaultEventHandler(event)) : void 0;
189899
189902
  const multistepOperationHost = {
189900
- executeWithRequestId: (requestId, action) => this.executeWithRequestId(requestId, action),
189903
+ executeWithRequestId: (requestId, action, performanceData) => this.executeWithRequestId(requestId, action, performanceData),
189901
189904
  getCurrentRequestId: () => this.currentRequestId,
189905
+ getPerformanceData: () => this.performanceData,
189902
189906
  getServerHost: () => this.host,
189903
189907
  logError: (err, cmd) => this.logError(err, cmd),
189904
- sendRequestCompletedEvent: (requestId) => this.sendRequestCompletedEvent(requestId),
189908
+ sendRequestCompletedEvent: (requestId, performanceData) => this.sendRequestCompletedEvent(requestId, performanceData),
189905
189909
  isCancellationRequested: () => this.cancellationToken.isCancellationRequested()
189906
189910
  };
189907
189911
  this.errorCheck = new MultistepOperation(multistepOperationHost);
@@ -189953,8 +189957,8 @@ var Session3 = class _Session {
189953
189957
  Debug.assertNever(this.projectService.serverMode);
189954
189958
  }
189955
189959
  }
189956
- sendRequestCompletedEvent(requestId) {
189957
- this.event({ request_seq: requestId, performanceData: this.performanceData }, "requestCompleted");
189960
+ sendRequestCompletedEvent(requestId, performanceData) {
189961
+ this.event({ request_seq: requestId, performanceData }, "requestCompleted");
189958
189962
  }
189959
189963
  addPerformanceData(key, value) {
189960
189964
  if (!this.performanceData) {
@@ -190111,14 +190115,14 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
190111
190115
  this.send(toEvent(eventName, body));
190112
190116
  }
190113
190117
  /** @internal */
190114
- doOutput(info, cmdName, reqSeq, success, message) {
190118
+ doOutput(info, cmdName, reqSeq, success, performanceData, message) {
190115
190119
  const res = {
190116
190120
  seq: 0,
190117
190121
  type: "response",
190118
190122
  command: cmdName,
190119
190123
  request_seq: reqSeq,
190120
190124
  success,
190121
- performanceData: this.performanceData
190125
+ performanceData
190122
190126
  };
190123
190127
  if (success) {
190124
190128
  let metadata;
@@ -190148,7 +190152,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
190148
190152
  }
190149
190153
  semanticCheck(file, project) {
190150
190154
  var _a, _b;
190151
- const diagnosticsStartTime = this.hrtime();
190155
+ const diagnosticsStartTime = timestamp();
190152
190156
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "semanticCheck", { file, configFilePath: project.canonicalConfigFilePath });
190153
190157
  const diags = isDeclarationFileInJSOnlyNonConfiguredProject(project, file) ? emptyArray2 : project.getLanguageService().getSemanticDiagnostics(file).filter((d) => !!d.file);
190154
190158
  this.sendDiagnosticsEvent(file, project, diags, "semanticDiag", diagnosticsStartTime);
@@ -190156,21 +190160,21 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
190156
190160
  }
190157
190161
  syntacticCheck(file, project) {
190158
190162
  var _a, _b;
190159
- const diagnosticsStartTime = this.hrtime();
190163
+ const diagnosticsStartTime = timestamp();
190160
190164
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "syntacticCheck", { file, configFilePath: project.canonicalConfigFilePath });
190161
190165
  this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSyntacticDiagnostics(file), "syntaxDiag", diagnosticsStartTime);
190162
190166
  (_b = tracing) == null ? void 0 : _b.pop();
190163
190167
  }
190164
190168
  suggestionCheck(file, project) {
190165
190169
  var _a, _b;
190166
- const diagnosticsStartTime = this.hrtime();
190170
+ const diagnosticsStartTime = timestamp();
190167
190171
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "suggestionCheck", { file, configFilePath: project.canonicalConfigFilePath });
190168
190172
  this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSuggestionDiagnostics(file), "suggestionDiag", diagnosticsStartTime);
190169
190173
  (_b = tracing) == null ? void 0 : _b.pop();
190170
190174
  }
190171
190175
  regionSemanticCheck(file, project, ranges) {
190172
190176
  var _a, _b, _c;
190173
- const diagnosticsStartTime = this.hrtime();
190177
+ const diagnosticsStartTime = timestamp();
190174
190178
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "regionSemanticCheck", { file, configFilePath: project.canonicalConfigFilePath });
190175
190179
  let diagnosticsResult;
190176
190180
  if (!this.shouldDoRegionCheck(file) || !(diagnosticsResult = project.getLanguageService().getRegionSemanticDiagnostics(file, ranges))) {
@@ -190192,7 +190196,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
190192
190196
  sendDiagnosticsEvent(file, project, diagnostics, kind, diagnosticsStartTime, spans) {
190193
190197
  try {
190194
190198
  const scriptInfo = Debug.checkDefined(project.getScriptInfo(file));
190195
- const duration = hrTimeToMilliseconds(this.hrtime(diagnosticsStartTime));
190199
+ const duration = timestamp() - diagnosticsStartTime;
190196
190200
  const body = {
190197
190201
  file,
190198
190202
  diagnostics: diagnostics.map((diag2) => formatDiag(file, project, diag2)),
@@ -191379,22 +191383,13 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
191379
191383
  );
191380
191384
  }
191381
191385
  }
191382
- reload(args, reqSeq) {
191386
+ reload(args) {
191383
191387
  const file = toNormalizedPath(args.file);
191384
191388
  const tempFileName = args.tmpfile === void 0 ? void 0 : toNormalizedPath(args.tmpfile);
191385
191389
  const info = this.projectService.getScriptInfoForNormalizedPath(file);
191386
191390
  if (info) {
191387
191391
  this.changeSeq++;
191388
- if (info.reloadFromFile(tempFileName)) {
191389
- this.doOutput(
191390
- /*info*/
191391
- void 0,
191392
- "reload" /* Reload */,
191393
- reqSeq,
191394
- /*success*/
191395
- true
191396
- );
191397
- }
191392
+ info.reloadFromFile(tempFileName);
191398
191393
  }
191399
191394
  }
191400
191395
  saveToTmp(fileName, tempFileName) {
@@ -191943,11 +191938,20 @@ ${e.message}`;
191943
191938
  }
191944
191939
  exit() {
191945
191940
  }
191946
- notRequired() {
191947
- return { responseRequired: false };
191941
+ notRequired(request) {
191942
+ if (request) this.doOutput(
191943
+ /*info*/
191944
+ void 0,
191945
+ request.command,
191946
+ request.seq,
191947
+ /*success*/
191948
+ true,
191949
+ this.performanceData
191950
+ );
191951
+ return { responseRequired: false, performanceData: this.performanceData };
191948
191952
  }
191949
191953
  requiredResponse(response) {
191950
- return { response, responseRequired: true };
191954
+ return { response, responseRequired: true, performanceData: this.performanceData };
191951
191955
  }
191952
191956
  addProtocolHandler(command, handler) {
191953
191957
  if (this.handlers.has(command)) {
@@ -191965,18 +191969,27 @@ ${e.message}`;
191965
191969
  this.currentRequestId = void 0;
191966
191970
  this.cancellationToken.resetRequest(requestId);
191967
191971
  }
191968
- executeWithRequestId(requestId, f) {
191972
+ // eslint-disable-line @typescript-eslint/unified-signatures
191973
+ executeWithRequestId(requestId, f, perfomanceData) {
191974
+ const currentPerformanceData = this.performanceData;
191969
191975
  try {
191976
+ this.performanceData = perfomanceData;
191970
191977
  this.setCurrentRequest(requestId);
191971
191978
  return f();
191972
191979
  } finally {
191973
191980
  this.resetCurrentRequest(requestId);
191981
+ this.performanceData = currentPerformanceData;
191974
191982
  }
191975
191983
  }
191976
191984
  executeCommand(request) {
191977
191985
  const handler = this.handlers.get(request.command);
191978
191986
  if (handler) {
191979
- const response = this.executeWithRequestId(request.seq, () => handler(request));
191987
+ const response = this.executeWithRequestId(
191988
+ request.seq,
191989
+ () => handler(request),
191990
+ /*perfomanceData*/
191991
+ void 0
191992
+ );
191980
191993
  this.projectService.enableRequestedPlugins();
191981
191994
  return response;
191982
191995
  } else {
@@ -191988,6 +192001,8 @@ ${e.message}`;
191988
192001
  request.seq,
191989
192002
  /*success*/
191990
192003
  false,
192004
+ /*performanceData*/
192005
+ void 0,
191991
192006
  `Unrecognized JSON command: ${request.command}`
191992
192007
  );
191993
192008
  return { responseRequired: false };
@@ -191996,8 +192011,8 @@ ${e.message}`;
191996
192011
  onMessage(message) {
191997
192012
  var _a, _b, _c, _d, _e, _f, _g;
191998
192013
  this.gcTimer.scheduleCollect();
191999
- this.performanceData = void 0;
192000
192014
  let start;
192015
+ const currentPerformanceData = this.performanceData;
192001
192016
  if (this.logger.hasLevel(2 /* requestTime */)) {
192002
192017
  start = this.hrtime();
192003
192018
  if (this.logger.hasLevel(3 /* verbose */)) {
@@ -192017,7 +192032,7 @@ ${e.message}`;
192017
192032
  /*separateBeginAndEnd*/
192018
192033
  true
192019
192034
  );
192020
- const { response, responseRequired } = this.executeCommand(request);
192035
+ const { response, responseRequired, performanceData } = this.executeCommand(request);
192021
192036
  (_c = tracing) == null ? void 0 : _c.pop();
192022
192037
  if (this.logger.hasLevel(2 /* requestTime */)) {
192023
192038
  const elapsedTime = hrTimeToMilliseconds(this.hrtime(start)).toFixed(4);
@@ -192034,7 +192049,8 @@ ${e.message}`;
192034
192049
  request.command,
192035
192050
  request.seq,
192036
192051
  /*success*/
192037
- true
192052
+ true,
192053
+ performanceData
192038
192054
  );
192039
192055
  } else if (responseRequired) {
192040
192056
  this.doOutput(
@@ -192044,6 +192060,7 @@ ${e.message}`;
192044
192060
  request.seq,
192045
192061
  /*success*/
192046
192062
  false,
192063
+ performanceData,
192047
192064
  "No content available."
192048
192065
  );
192049
192066
  }
@@ -192056,7 +192073,8 @@ ${e.message}`;
192056
192073
  request.command,
192057
192074
  request.seq,
192058
192075
  /*success*/
192059
- true
192076
+ true,
192077
+ this.performanceData
192060
192078
  );
192061
192079
  return;
192062
192080
  }
@@ -192069,8 +192087,11 @@ ${e.message}`;
192069
192087
  request ? request.seq : 0,
192070
192088
  /*success*/
192071
192089
  false,
192090
+ this.performanceData,
192072
192091
  "Error processing request. " + err.message + "\n" + err.stack
192073
192092
  );
192093
+ } finally {
192094
+ this.performanceData = currentPerformanceData;
192074
192095
  }
192075
192096
  }
192076
192097
  parseMessage(message) {
@@ -50,6 +50,7 @@ __export(nodeTypingsInstaller_exports, {
50
50
  NodeTypingsInstaller: () => NodeTypingsInstaller
51
51
  });
52
52
  module.exports = __toCommonJS(nodeTypingsInstaller_exports);
53
+ var import_child_process = require("child_process");
53
54
  var fs = __toESM(require("fs"));
54
55
  var path = __toESM(require("path"));
55
56
 
@@ -127,7 +128,6 @@ var NodeTypingsInstaller = class extends typescript_exports.server.typingsInstal
127
128
  this.log.writeLine(`NPM location: ${this.npmPath} (explicit '${typescript_exports.server.Arguments.NpmLocation}' ${npmLocation2 === void 0 ? "not " : ""} provided)`);
128
129
  this.log.writeLine(`validateDefaultNpmLocation: ${validateDefaultNpmLocation2}`);
129
130
  }
130
- ({ execSync: this.nodeExecSync } = require("child_process"));
131
131
  this.ensurePackageDirectoryExists(globalTypingsCacheLocation2);
132
132
  try {
133
133
  if (this.log.isEnabled()) {
@@ -182,7 +182,7 @@ var NodeTypingsInstaller = class extends typescript_exports.server.typingsInstal
182
182
  this.log.writeLine(`Exec: ${command}`);
183
183
  }
184
184
  try {
185
- const stdout = this.nodeExecSync(command, { ...options, encoding: "utf-8" });
185
+ const stdout = (0, import_child_process.execFileSync)(command, { ...options, encoding: "utf-8" });
186
186
  if (this.log.isEnabled()) {
187
187
  this.log.writeLine(` Succeeded. stdout:${indent(typescript_exports.sys.newLine, stdout)}`);
188
188
  }
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.20240624",
5
+ "version": "5.6.0-dev.20240626",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -13,11 +13,11 @@
13
13
  "javascript"
14
14
  ],
15
15
  "bugs": {
16
- "url": "https://github.com/Microsoft/TypeScript/issues"
16
+ "url": "https://github.com/microsoft/TypeScript/issues"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "https://github.com/Microsoft/TypeScript.git"
20
+ "url": "https://github.com/microsoft/TypeScript.git"
21
21
  },
22
22
  "main": "./lib/typescript.js",
23
23
  "typings": "./lib/typescript.d.ts",
@@ -44,6 +44,7 @@
44
44
  "@esfx/canceltoken": "^1.0.0",
45
45
  "@octokit/rest": "^20.1.1",
46
46
  "@types/chai": "^4.3.16",
47
+ "@types/diff": "^5.2.1",
47
48
  "@types/minimist": "^1.2.5",
48
49
  "@types/mocha": "^10.0.6",
49
50
  "@types/ms": "^0.7.34",
@@ -110,5 +111,5 @@
110
111
  "node": "20.1.0",
111
112
  "npm": "8.19.4"
112
113
  },
113
- "gitHead": "5d70bf894efe9014d24d4ba439807311e5b33fb8"
114
+ "gitHead": "ef339af12801c1f88ff4e01d4d4e602addfcca98"
114
115
  }