@typescript-deploys/pr-build 4.7.0-pr-48094-5 → 4.7.0-pr-48264-3

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/protocol.d.ts CHANGED
@@ -42,6 +42,7 @@ declare namespace ts.server.protocol {
42
42
  Rename = "rename",
43
43
  Saveto = "saveto",
44
44
  SignatureHelp = "signatureHelp",
45
+ SourceDefinitionAndBoundSpan = "sourceDefinitionAndBoundSpan",
45
46
  Status = "status",
46
47
  TypeDefinition = "typeDefinition",
47
48
  ProjectInfo = "projectInfo",
@@ -661,6 +662,9 @@ declare namespace ts.server.protocol {
661
662
  interface DefinitionAndBoundSpanRequest extends FileLocationRequest {
662
663
  readonly command: CommandTypes.DefinitionAndBoundSpan;
663
664
  }
665
+ interface SourceDefinitionAndBoundSpanRequest extends FileLocationRequest {
666
+ readonly command: CommandTypes.SourceDefinitionAndBoundSpan;
667
+ }
664
668
  interface DefinitionAndBoundSpanResponse extends Response {
665
669
  readonly body: DefinitionInfoAndBoundSpan;
666
670
  }
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.7";
72
- ts.version = ts.versionMajorMinor + ".0-insiders.20220314";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220315";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -11431,6 +11431,10 @@ var ts;
11431
11431
  }
11432
11432
  }
11433
11433
  ts.isAnyImportSyntax = isAnyImportSyntax;
11434
+ function isAnyImportOrBareOrAccessedRequire(node) {
11435
+ return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
11436
+ }
11437
+ ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
11434
11438
  function isLateVisibilityPaintedStatement(node) {
11435
11439
  switch (node.kind) {
11436
11440
  case 265:
@@ -12861,14 +12865,14 @@ var ts;
12861
12865
  }
12862
12866
  ts.isFunctionSymbol = isFunctionSymbol;
12863
12867
  function tryGetModuleSpecifierFromDeclaration(node) {
12864
- var _a, _b, _c;
12868
+ var _a, _b;
12865
12869
  switch (node.kind) {
12866
12870
  case 253:
12867
- return node.initializer.arguments[0].text;
12871
+ return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, true); })) === null || _a === void 0 ? void 0 : _a.arguments[0];
12868
12872
  case 265:
12869
- return (_a = ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike)) === null || _a === void 0 ? void 0 : _a.text;
12873
+ return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
12870
12874
  case 264:
12871
- return (_c = ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike)) === null || _c === void 0 ? void 0 : _c.text;
12875
+ return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
12872
12876
  default:
12873
12877
  ts.Debug.assertNever(node);
12874
12878
  }
@@ -13343,18 +13347,22 @@ var ts;
13343
13347
  }
13344
13348
  ts.isIdentifierName = isIdentifierName;
13345
13349
  function isAliasSymbolDeclaration(node) {
13346
- return node.kind === 264 ||
13350
+ if (node.kind === 264 ||
13347
13351
  node.kind === 263 ||
13348
13352
  node.kind === 266 && !!node.name ||
13349
13353
  node.kind === 267 ||
13350
13354
  node.kind === 273 ||
13351
13355
  node.kind === 269 ||
13352
13356
  node.kind === 274 ||
13353
- node.kind === 270 && exportAssignmentIsAlias(node) ||
13354
- ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 && exportAssignmentIsAlias(node) ||
13355
- ts.isPropertyAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 && isAliasableExpression(node.parent.right) ||
13356
- node.kind === 296 ||
13357
- node.kind === 295 && isAliasableExpression(node.initializer);
13357
+ node.kind === 270 && exportAssignmentIsAlias(node)) {
13358
+ return true;
13359
+ }
13360
+ return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 && exportAssignmentIsAlias(node) ||
13361
+ ts.isPropertyAccessExpression(node)
13362
+ && ts.isBinaryExpression(node.parent)
13363
+ && node.parent.left === node
13364
+ && node.parent.operatorToken.kind === 63
13365
+ && isAliasableExpression(node.parent.right));
13358
13366
  }
13359
13367
  ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
13360
13368
  function getAliasDeclarationFromName(node) {
@@ -13365,6 +13373,7 @@ var ts;
13365
13373
  case 274:
13366
13374
  case 270:
13367
13375
  case 264:
13376
+ case 273:
13368
13377
  return node.parent;
13369
13378
  case 160:
13370
13379
  do {
@@ -31993,6 +32002,13 @@ var ts;
31993
32002
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
31994
32003
  defaultValueDescription: false,
31995
32004
  },
32005
+ {
32006
+ name: "noDtsResolution",
32007
+ type: "boolean",
32008
+ affectsModuleResolution: true,
32009
+ category: ts.Diagnostics.Modules,
32010
+ defaultValueDescription: false,
32011
+ },
31996
32012
  {
31997
32013
  name: "sourceRoot",
31998
32014
  type: "string",
@@ -34093,6 +34109,7 @@ var ts;
34093
34109
  Extensions[Extensions["Json"] = 2] = "Json";
34094
34110
  Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
34095
34111
  Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
34112
+ Extensions[Extensions["TypeScriptButNotDts"] = 5] = "TypeScriptButNotDts";
34096
34113
  })(Extensions || (Extensions = {}));
34097
34114
  function resolvedTypeScriptOnly(resolved) {
34098
34115
  if (!resolved) {
@@ -34889,13 +34906,31 @@ var ts;
34889
34906
  return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, undefined, jsOnlyExtensions, undefined);
34890
34907
  }
34891
34908
  function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
34892
- return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
34909
+ var extensions;
34910
+ if (lookupConfig) {
34911
+ extensions = tsconfigExtensions;
34912
+ }
34913
+ else if (compilerOptions.noDtsResolution) {
34914
+ extensions = [Extensions.TypeScriptButNotDts];
34915
+ if (compilerOptions.allowJs)
34916
+ extensions.push(Extensions.JavaScript);
34917
+ if (compilerOptions.resolveJsonModule)
34918
+ extensions.push(Extensions.Json);
34919
+ }
34920
+ else {
34921
+ extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
34922
+ }
34923
+ return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
34893
34924
  }
34894
34925
  ts.nodeModuleNameResolver = nodeModuleNameResolver;
34895
34926
  function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
34896
34927
  var _a, _b;
34897
34928
  var traceEnabled = isTraceEnabled(compilerOptions, host);
34898
34929
  var failedLookupLocations = [];
34930
+ var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
34931
+ if (compilerOptions.noDtsResolution) {
34932
+ conditions.pop();
34933
+ }
34899
34934
  var state = {
34900
34935
  compilerOptions: compilerOptions,
34901
34936
  host: host,
@@ -34903,7 +34938,7 @@ var ts;
34903
34938
  failedLookupLocations: failedLookupLocations,
34904
34939
  packageJsonInfoCache: cache,
34905
34940
  features: features,
34906
- conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]
34941
+ conditions: conditions,
34907
34942
  };
34908
34943
  var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
34909
34944
  return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, state.resultFromCache);
@@ -35078,20 +35113,22 @@ var ts;
35078
35113
  default: return tryExtension(".d.ts");
35079
35114
  }
35080
35115
  case Extensions.TypeScript:
35116
+ case Extensions.TypeScriptButNotDts:
35117
+ var useDts = extensions === Extensions.TypeScript;
35081
35118
  switch (originalExtension) {
35082
35119
  case ".mjs":
35083
35120
  case ".mts":
35084
35121
  case ".d.mts":
35085
- return tryExtension(".mts") || tryExtension(".d.mts");
35122
+ return tryExtension(".mts") || (useDts ? tryExtension(".d.mts") : undefined);
35086
35123
  case ".cjs":
35087
35124
  case ".cts":
35088
35125
  case ".d.cts":
35089
- return tryExtension(".cts") || tryExtension(".d.cts");
35126
+ return tryExtension(".cts") || (useDts ? tryExtension(".d.cts") : undefined);
35090
35127
  case ".json":
35091
35128
  candidate += ".json";
35092
- return tryExtension(".d.ts");
35129
+ return useDts ? tryExtension(".d.ts") : undefined;
35093
35130
  default:
35094
- return tryExtension(".ts") || tryExtension(".tsx") || tryExtension(".d.ts");
35131
+ return tryExtension(".ts") || tryExtension(".tsx") || (useDts ? tryExtension(".d.ts") : undefined);
35095
35132
  }
35096
35133
  case Extensions.JavaScript:
35097
35134
  switch (originalExtension) {
@@ -35296,6 +35333,7 @@ var ts;
35296
35333
  switch (extensions) {
35297
35334
  case Extensions.JavaScript:
35298
35335
  case Extensions.Json:
35336
+ case Extensions.TypeScriptButNotDts:
35299
35337
  packageFile = readPackageJsonMainField(jsonContent, candidate, state);
35300
35338
  break;
35301
35339
  case Extensions.TypeScript:
@@ -35364,6 +35402,8 @@ var ts;
35364
35402
  return extension === ".json";
35365
35403
  case Extensions.TypeScript:
35366
35404
  return extension === ".ts" || extension === ".tsx" || extension === ".d.ts";
35405
+ case Extensions.TypeScriptButNotDts:
35406
+ return extension === ".ts" || extension === ".tsx";
35367
35407
  case Extensions.DtsOnly:
35368
35408
  return extension === ".d.ts";
35369
35409
  }
@@ -45682,7 +45722,7 @@ var ts;
45682
45722
  }
45683
45723
  }
45684
45724
  var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304); }) ? constructorTypes : types;
45685
- type = getUnionType(sourceTypes, 2);
45725
+ type = getUnionType(sourceTypes);
45686
45726
  }
45687
45727
  }
45688
45728
  var widened = getWidenedType(addOptionality(type, false, definedInMethod && !definedInConstructor));
@@ -56221,27 +56261,17 @@ var ts;
56221
56261
  return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) ||
56222
56262
  sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen);
56223
56263
  }
56224
- function isValidNumberString(s, roundTripOnly) {
56225
- if (s === "")
56226
- return false;
56227
- var n = +s;
56228
- return isFinite(n) && (!roundTripOnly || "" + n === s);
56229
- }
56230
- function isValidBigIntString(s, roundTripOnly) {
56231
- if (s === "")
56232
- return false;
56264
+ function isValidBigIntString(s) {
56233
56265
  var scanner = ts.createScanner(99, false);
56234
56266
  var success = true;
56235
56267
  scanner.setOnError(function () { return success = false; });
56236
56268
  scanner.setText(s + "n");
56237
56269
  var result = scanner.scan();
56238
- var negative = result === 40;
56239
- if (negative) {
56270
+ if (result === 40) {
56240
56271
  result = scanner.scan();
56241
56272
  }
56242
56273
  var flags = scanner.getTokenFlags();
56243
- return success && result === 9 && scanner.getTextPos() === (s.length + 1) && !(flags & 512)
56244
- && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
56274
+ return success && result === 9 && scanner.getTextPos() === (s.length + 1) && !(flags & 512);
56245
56275
  }
56246
56276
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
56247
56277
  if (source === target || target.flags & (1 | 4)) {
@@ -56249,8 +56279,8 @@ var ts;
56249
56279
  }
56250
56280
  if (source.flags & 128) {
56251
56281
  var value = source.value;
56252
- return !!(target.flags & 8 && isValidNumberString(value, false) ||
56253
- target.flags & 64 && isValidBigIntString(value, false) ||
56282
+ return !!(target.flags & 8 && value !== "" && isFinite(+value) ||
56283
+ target.flags & 64 && value !== "" && isValidBigIntString(value) ||
56254
56284
  target.flags & (512 | 98304) && value === target.intrinsicName);
56255
56285
  }
56256
56286
  if (source.flags & 134217728) {
@@ -56716,61 +56746,7 @@ var ts;
56716
56746
  var types = target.types;
56717
56747
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
56718
56748
  for (var i = 0; i < types.length; i++) {
56719
- var source_1 = matches ? matches[i] : neverType;
56720
- var target_3 = types[i];
56721
- var sourceTypes = void 0;
56722
- if (source_1.flags & 128 && target_3.flags & 8650752) {
56723
- var inferenceContext = getInferenceInfoForType(target_3);
56724
- var constraint = inferenceContext ? getConstraintOfTypeParameter(inferenceContext.typeParameter) : undefined;
56725
- if (inferenceContext && constraint) {
56726
- var str = source_1.value;
56727
- var constraintTypes = constraint.flags & 1048576 ? constraint.types : [constraint];
56728
- for (var _i = 0, constraintTypes_1 = constraintTypes; _i < constraintTypes_1.length; _i++) {
56729
- var constraintType = constraintTypes_1[_i];
56730
- if (constraintType.flags & 402653316) {
56731
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
56732
- sourceTypes.push(source_1);
56733
- }
56734
- if (constraintType.flags & 296 && isValidNumberString(str, true)) {
56735
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
56736
- sourceTypes.push(getNumberLiteralType(+str));
56737
- }
56738
- if (constraintType.flags & 2112 && isValidBigIntString(str, true)) {
56739
- var negative = str.startsWith("-");
56740
- var base10Value = ts.parsePseudoBigInt((negative ? str.slice(1) : str) + "n");
56741
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
56742
- sourceTypes.push(getBigIntLiteralType({ negative: negative, base10Value: base10Value }));
56743
- }
56744
- if (constraintType.flags & 528) {
56745
- if (str === trueType.intrinsicName) {
56746
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
56747
- sourceTypes.push(trueType);
56748
- }
56749
- else if (str === falseType.intrinsicName) {
56750
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
56751
- sourceTypes.push(falseType);
56752
- }
56753
- }
56754
- if (constraintType.flags & 65536 && str === nullType.intrinsicName) {
56755
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
56756
- sourceTypes.push(nullType);
56757
- }
56758
- if (constraintType.flags & 32768 && str === undefinedType.intrinsicName) {
56759
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
56760
- sourceTypes.push(undefinedType);
56761
- }
56762
- }
56763
- }
56764
- }
56765
- if (sourceTypes) {
56766
- for (var _a = 0, sourceTypes_3 = sourceTypes; _a < sourceTypes_3.length; _a++) {
56767
- var source_2 = sourceTypes_3[_a];
56768
- inferFromTypes(source_2, target_3);
56769
- }
56770
- }
56771
- else {
56772
- inferFromTypes(source_1, target_3);
56773
- }
56749
+ inferFromTypes(matches ? matches[i] : neverType, types[i]);
56774
56750
  }
56775
56751
  }
56776
56752
  }