typescript 5.7.0-dev.20241105 → 5.8.0-dev.20241107

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/_tsserver.js CHANGED
@@ -283,13 +283,7 @@ function initializeNodeSystem() {
283
283
  return (_a = global.gc) == null ? void 0 : _a.call(global);
284
284
  };
285
285
  }
286
- let cancellationToken;
287
- try {
288
- const factory = require("./cancellationToken.js");
289
- cancellationToken = factory(sys4.args);
290
- } catch {
291
- cancellationToken = typescript_exports.server.nullCancellationToken;
292
- }
286
+ const cancellationToken = createCancellationToken(sys4.args);
293
287
  const localeStr = typescript_exports.server.findArgument("--locale");
294
288
  if (localeStr) {
295
289
  (0, typescript_exports.validateLocaleAndSetLanguage)(localeStr, sys4);
@@ -577,6 +571,48 @@ function startNodeSession(options, logger, cancellationToken) {
577
571
  return (0, typescript_exports.combinePaths)((0, typescript_exports.normalizeSlashes)(homePath), cacheFolder);
578
572
  }
579
573
  }
574
+ function pipeExists(name) {
575
+ return import_fs.default.existsSync(name);
576
+ }
577
+ function createCancellationToken(args) {
578
+ let cancellationPipeName;
579
+ for (let i = 0; i < args.length - 1; i++) {
580
+ if (args[i] === "--cancellationPipeName") {
581
+ cancellationPipeName = args[i + 1];
582
+ break;
583
+ }
584
+ }
585
+ if (!cancellationPipeName) {
586
+ return typescript_exports.server.nullCancellationToken;
587
+ }
588
+ if (cancellationPipeName.charAt(cancellationPipeName.length - 1) === "*") {
589
+ const namePrefix = cancellationPipeName.slice(0, -1);
590
+ if (namePrefix.length === 0 || namePrefix.includes("*")) {
591
+ throw new Error("Invalid name for template cancellation pipe: it should have length greater than 2 characters and contain only one '*'.");
592
+ }
593
+ let perRequestPipeName;
594
+ let currentRequestId;
595
+ return {
596
+ isCancellationRequested: () => perRequestPipeName !== void 0 && pipeExists(perRequestPipeName),
597
+ setRequest(requestId) {
598
+ currentRequestId = requestId;
599
+ perRequestPipeName = namePrefix + requestId;
600
+ },
601
+ resetRequest(requestId) {
602
+ if (currentRequestId !== requestId) {
603
+ throw new Error(`Mismatched request id, expected ${currentRequestId}, actual ${requestId}`);
604
+ }
605
+ perRequestPipeName = void 0;
606
+ }
607
+ };
608
+ } else {
609
+ return {
610
+ isCancellationRequested: () => pipeExists(cancellationPipeName),
611
+ setRequest: (_requestId) => void 0,
612
+ resetRequest: (_requestId) => void 0
613
+ };
614
+ }
615
+ }
580
616
 
581
617
  // src/tsserver/server.ts
582
618
  function findArgumentStringArray(argName) {
@@ -23,3 +23,4 @@ and limitations under the License.
23
23
  /// <reference lib="esnext.collection" />
24
24
  /// <reference lib="esnext.array" />
25
25
  /// <reference lib="esnext.iterator" />
26
+ /// <reference lib="esnext.promise" />
@@ -0,0 +1,34 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+
17
+ /// <reference no-default-lib="true"/>
18
+
19
+ interface PromiseConstructor {
20
+ /**
21
+ * Takes a callback of any kind (returns or throws, synchronously or asynchronously) and wraps its result
22
+ * in a Promise.
23
+ *
24
+ * @param callbackFn A function that is called synchronously. It can do anything: either return
25
+ * a value, throw an error, or return a promise.
26
+ * @param args Additional arguments, that will be passed to the callback.
27
+ *
28
+ * @returns A Promise that is:
29
+ * - Already fulfilled, if the callback synchronously returns a value.
30
+ * - Already rejected, if the callback synchronously throws an error.
31
+ * - Asynchronously fulfilled or rejected, if the callback returns a promise.
32
+ */
33
+ try<T, U extends unknown[]>(callbackFn: (...args: U) => T | PromiseLike<T>, ...args: U): Promise<Awaited<T>>;
34
+ }
@@ -1487,6 +1487,10 @@ declare namespace ts {
1487
1487
  command: CommandTypes.Quickinfo;
1488
1488
  arguments: FileLocationRequestArgs;
1489
1489
  }
1490
+ export interface QuickInfoRequestArgs extends FileLocationRequestArgs {
1491
+ /** TODO */
1492
+ verbosityLevel?: number;
1493
+ }
1490
1494
  /**
1491
1495
  * Body of QuickInfoResponse.
1492
1496
  */
@@ -1520,6 +1524,10 @@ declare namespace ts {
1520
1524
  * JSDoc tags associated with symbol.
1521
1525
  */
1522
1526
  tags: JSDocTagInfo[];
1527
+ /**
1528
+ * TODO
1529
+ */
1530
+ canIncreaseVerbosityLevel?: boolean;
1523
1531
  }
1524
1532
  /**
1525
1533
  * Quickinfo response message.
@@ -3644,7 +3652,7 @@ declare namespace ts {
3644
3652
  readDirectory(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[] | undefined, depth?: number): string[];
3645
3653
  }
3646
3654
  }
3647
- const versionMajorMinor = "5.7";
3655
+ const versionMajorMinor = "5.8";
3648
3656
  /** The version of the TypeScript compiler release */
3649
3657
  const version: string;
3650
3658
  /**
@@ -7426,8 +7434,9 @@ declare namespace ts {
7426
7434
  NonNullAssertions = 4,
7427
7435
  PartiallyEmittedExpressions = 8,
7428
7436
  ExpressionsWithTypeArguments = 16,
7429
- Assertions = 6,
7430
- All = 31,
7437
+ Satisfies = 32,
7438
+ Assertions = 38,
7439
+ All = 63,
7431
7440
  ExcludeJSDocTypeAssertion = -2147483648,
7432
7441
  }
7433
7442
  type ImmediatelyInvokedFunctionExpression = CallExpression & {
@@ -10757,6 +10766,7 @@ declare namespace ts {
10757
10766
  displayParts?: SymbolDisplayPart[];
10758
10767
  documentation?: SymbolDisplayPart[];
10759
10768
  tags?: JSDocTagInfo[];
10769
+ canIncreaseVerbosityLevel?: boolean;
10760
10770
  }
10761
10771
  type RenameInfo = RenameInfoSuccess | RenameInfoFailure;
10762
10772
  interface RenameInfoSuccess {