@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.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-insiders.20220314";
92
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220315";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -14939,6 +14939,10 @@ var ts;
14939
14939
  }
14940
14940
  }
14941
14941
  ts.isAnyImportSyntax = isAnyImportSyntax;
14942
+ function isAnyImportOrBareOrAccessedRequire(node) {
14943
+ return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
14944
+ }
14945
+ ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
14942
14946
  function isLateVisibilityPaintedStatement(node) {
14943
14947
  switch (node.kind) {
14944
14948
  case 265 /* ImportDeclaration */:
@@ -16517,14 +16521,14 @@ var ts;
16517
16521
  }
16518
16522
  ts.isFunctionSymbol = isFunctionSymbol;
16519
16523
  function tryGetModuleSpecifierFromDeclaration(node) {
16520
- var _a, _b, _c;
16524
+ var _a, _b;
16521
16525
  switch (node.kind) {
16522
16526
  case 253 /* VariableDeclaration */:
16523
- return node.initializer.arguments[0].text;
16527
+ return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0];
16524
16528
  case 265 /* ImportDeclaration */:
16525
- return (_a = ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike)) === null || _a === void 0 ? void 0 : _a.text;
16529
+ return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
16526
16530
  case 264 /* ImportEqualsDeclaration */:
16527
- 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;
16531
+ return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
16528
16532
  default:
16529
16533
  ts.Debug.assertNever(node);
16530
16534
  }
@@ -17051,21 +17055,28 @@ var ts;
17051
17055
  // export = <EntityNameExpression>
17052
17056
  // export default <EntityNameExpression>
17053
17057
  // module.exports = <EntityNameExpression>
17054
- // {<Identifier>}
17055
- // {name: <EntityNameExpression>}
17058
+ // module.exports.x = <EntityNameExpression>
17059
+ // const x = require("...")
17060
+ // const { x } = require("...")
17061
+ // const x = require("...").y
17062
+ // const { x } = require("...").y
17056
17063
  function isAliasSymbolDeclaration(node) {
17057
- return node.kind === 264 /* ImportEqualsDeclaration */ ||
17064
+ if (node.kind === 264 /* ImportEqualsDeclaration */ ||
17058
17065
  node.kind === 263 /* NamespaceExportDeclaration */ ||
17059
17066
  node.kind === 266 /* ImportClause */ && !!node.name ||
17060
17067
  node.kind === 267 /* NamespaceImport */ ||
17061
17068
  node.kind === 273 /* NamespaceExport */ ||
17062
17069
  node.kind === 269 /* ImportSpecifier */ ||
17063
17070
  node.kind === 274 /* ExportSpecifier */ ||
17064
- node.kind === 270 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
17065
- ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
17066
- ts.isPropertyAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* EqualsToken */ && isAliasableExpression(node.parent.right) ||
17067
- node.kind === 296 /* ShorthandPropertyAssignment */ ||
17068
- node.kind === 295 /* PropertyAssignment */ && isAliasableExpression(node.initializer);
17071
+ node.kind === 270 /* ExportAssignment */ && exportAssignmentIsAlias(node)) {
17072
+ return true;
17073
+ }
17074
+ return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
17075
+ ts.isPropertyAccessExpression(node)
17076
+ && ts.isBinaryExpression(node.parent)
17077
+ && node.parent.left === node
17078
+ && node.parent.operatorToken.kind === 63 /* EqualsToken */
17079
+ && isAliasableExpression(node.parent.right));
17069
17080
  }
17070
17081
  ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
17071
17082
  function getAliasDeclarationFromName(node) {
@@ -17076,6 +17087,7 @@ var ts;
17076
17087
  case 274 /* ExportSpecifier */:
17077
17088
  case 270 /* ExportAssignment */:
17078
17089
  case 264 /* ImportEqualsDeclaration */:
17090
+ case 273 /* NamespaceExport */:
17079
17091
  return node.parent;
17080
17092
  case 160 /* QualifiedName */:
17081
17093
  do {
@@ -39423,6 +39435,13 @@ var ts;
39423
39435
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39424
39436
  defaultValueDescription: false,
39425
39437
  },
39438
+ {
39439
+ name: "noDtsResolution",
39440
+ type: "boolean",
39441
+ affectsModuleResolution: true,
39442
+ category: ts.Diagnostics.Modules,
39443
+ defaultValueDescription: false,
39444
+ },
39426
39445
  // Source Maps
39427
39446
  {
39428
39447
  name: "sourceRoot",
@@ -41802,7 +41821,8 @@ var ts;
41802
41821
  Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
41803
41822
  Extensions[Extensions["Json"] = 2] = "Json";
41804
41823
  Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
41805
- Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly"; /** Only '.d.ts' */
41824
+ Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
41825
+ Extensions[Extensions["TypeScriptButNotDts"] = 5] = "TypeScriptButNotDts";
41806
41826
  })(Extensions || (Extensions = {}));
41807
41827
  /** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
41808
41828
  function resolvedTypeScriptOnly(resolved) {
@@ -42747,7 +42767,21 @@ var ts;
42747
42767
  return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
42748
42768
  }
42749
42769
  function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
42750
- return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
42770
+ var extensions;
42771
+ if (lookupConfig) {
42772
+ extensions = tsconfigExtensions;
42773
+ }
42774
+ else if (compilerOptions.noDtsResolution) {
42775
+ extensions = [Extensions.TypeScriptButNotDts];
42776
+ if (compilerOptions.allowJs)
42777
+ extensions.push(Extensions.JavaScript);
42778
+ if (compilerOptions.resolveJsonModule)
42779
+ extensions.push(Extensions.Json);
42780
+ }
42781
+ else {
42782
+ extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
42783
+ }
42784
+ return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
42751
42785
  }
42752
42786
  ts.nodeModuleNameResolver = nodeModuleNameResolver;
42753
42787
  function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
@@ -42756,6 +42790,10 @@ var ts;
42756
42790
  var failedLookupLocations = [];
42757
42791
  // conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
42758
42792
  //it's essentially a set (priority is determined by object insertion order in the object we look at).
42793
+ var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
42794
+ if (compilerOptions.noDtsResolution) {
42795
+ conditions.pop();
42796
+ }
42759
42797
  var state = {
42760
42798
  compilerOptions: compilerOptions,
42761
42799
  host: host,
@@ -42763,7 +42801,7 @@ var ts;
42763
42801
  failedLookupLocations: failedLookupLocations,
42764
42802
  packageJsonInfoCache: cache,
42765
42803
  features: features,
42766
- conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]
42804
+ conditions: conditions,
42767
42805
  };
42768
42806
  var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
42769
42807
  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);
@@ -42971,20 +43009,22 @@ var ts;
42971
43009
  default: return tryExtension(".d.ts" /* Dts */);
42972
43010
  }
42973
43011
  case Extensions.TypeScript:
43012
+ case Extensions.TypeScriptButNotDts:
43013
+ var useDts = extensions === Extensions.TypeScript;
42974
43014
  switch (originalExtension) {
42975
43015
  case ".mjs" /* Mjs */:
42976
43016
  case ".mts" /* Mts */:
42977
43017
  case ".d.mts" /* Dmts */:
42978
- return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
43018
+ return tryExtension(".mts" /* Mts */) || (useDts ? tryExtension(".d.mts" /* Dmts */) : undefined);
42979
43019
  case ".cjs" /* Cjs */:
42980
43020
  case ".cts" /* Cts */:
42981
43021
  case ".d.cts" /* Dcts */:
42982
- return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
43022
+ return tryExtension(".cts" /* Cts */) || (useDts ? tryExtension(".d.cts" /* Dcts */) : undefined);
42983
43023
  case ".json" /* Json */:
42984
43024
  candidate += ".json" /* Json */;
42985
- return tryExtension(".d.ts" /* Dts */);
43025
+ return useDts ? tryExtension(".d.ts" /* Dts */) : undefined;
42986
43026
  default:
42987
- return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
43027
+ return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || (useDts ? tryExtension(".d.ts" /* Dts */) : undefined);
42988
43028
  }
42989
43029
  case Extensions.JavaScript:
42990
43030
  switch (originalExtension) {
@@ -43202,6 +43242,7 @@ var ts;
43202
43242
  switch (extensions) {
43203
43243
  case Extensions.JavaScript:
43204
43244
  case Extensions.Json:
43245
+ case Extensions.TypeScriptButNotDts:
43205
43246
  packageFile = readPackageJsonMainField(jsonContent, candidate, state);
43206
43247
  break;
43207
43248
  case Extensions.TypeScript:
@@ -43280,6 +43321,8 @@ var ts;
43280
43321
  return extension === ".json" /* Json */;
43281
43322
  case Extensions.TypeScript:
43282
43323
  return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".d.ts" /* Dts */;
43324
+ case Extensions.TypeScriptButNotDts:
43325
+ return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */;
43283
43326
  case Extensions.DtsOnly:
43284
43327
  return extension === ".d.ts" /* Dts */;
43285
43328
  }
@@ -55348,7 +55391,7 @@ var ts;
55348
55391
  }
55349
55392
  }
55350
55393
  var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304 /* Nullable */); }) ? constructorTypes : types; // TODO: GH#18217
55351
- type = getUnionType(sourceTypes, 2 /* Subtype */);
55394
+ type = getUnionType(sourceTypes);
55352
55395
  }
55353
55396
  }
55354
55397
  var widened = getWidenedType(addOptionality(type, /*isProperty*/ false, definedInMethod && !definedInConstructor));
@@ -67401,32 +67444,13 @@ var ts;
67401
67444
  return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) ||
67402
67445
  sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen);
67403
67446
  }
67404
- /**
67405
- * Tests whether the provided string can be parsed as a number.
67406
- * @param s The string to test.
67407
- * @param roundTripOnly Indicates the resulting number matches the input when converted back to a string.
67408
- */
67409
- function isValidNumberString(s, roundTripOnly) {
67410
- if (s === "")
67411
- return false;
67412
- var n = +s;
67413
- return isFinite(n) && (!roundTripOnly || "" + n === s);
67414
- }
67415
- /**
67416
- * Tests whether the provided string can be parsed as a bigint.
67417
- * @param s The string to test.
67418
- * @param roundTripOnly Indicates the resulting bigint matches the input when converted back to a string.
67419
- */
67420
- function isValidBigIntString(s, roundTripOnly) {
67421
- if (s === "")
67422
- return false;
67447
+ function isValidBigIntString(s) {
67423
67448
  var scanner = ts.createScanner(99 /* ESNext */, /*skipTrivia*/ false);
67424
67449
  var success = true;
67425
67450
  scanner.setOnError(function () { return success = false; });
67426
67451
  scanner.setText(s + "n");
67427
67452
  var result = scanner.scan();
67428
- var negative = result === 40 /* MinusToken */;
67429
- if (negative) {
67453
+ if (result === 40 /* MinusToken */) {
67430
67454
  result = scanner.scan();
67431
67455
  }
67432
67456
  var flags = scanner.getTokenFlags();
@@ -67435,8 +67459,7 @@ var ts;
67435
67459
  // * a bigint can be scanned, and that when it is scanned, it is
67436
67460
  // * the full length of the input string (so the scanner is one character beyond the augmented input length)
67437
67461
  // * it does not contain a numeric seperator (the `BigInt` constructor does not accept a numeric seperator in its input)
67438
- return success && result === 9 /* BigIntLiteral */ && scanner.getTextPos() === (s.length + 1) && !(flags & 512 /* ContainsSeparator */)
67439
- && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
67462
+ return success && result === 9 /* BigIntLiteral */ && scanner.getTextPos() === (s.length + 1) && !(flags & 512 /* ContainsSeparator */);
67440
67463
  }
67441
67464
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
67442
67465
  if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
@@ -67444,8 +67467,8 @@ var ts;
67444
67467
  }
67445
67468
  if (source.flags & 128 /* StringLiteral */) {
67446
67469
  var value = source.value;
67447
- return !!(target.flags & 8 /* Number */ && isValidNumberString(value, /*roundTripOnly*/ false) ||
67448
- target.flags & 64 /* BigInt */ && isValidBigIntString(value, /*roundTripOnly*/ false) ||
67470
+ return !!(target.flags & 8 /* Number */ && value !== "" && isFinite(+value) ||
67471
+ target.flags & 64 /* BigInt */ && value !== "" && isValidBigIntString(value) ||
67449
67472
  target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName);
67450
67473
  }
67451
67474
  if (source.flags & 134217728 /* TemplateLiteral */) {
@@ -68019,63 +68042,7 @@ var ts;
68019
68042
  // succeed. That would be a pointless and confusing outcome.
68020
68043
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
68021
68044
  for (var i = 0; i < types.length; i++) {
68022
- var source_1 = matches ? matches[i] : neverType;
68023
- var target_3 = types[i];
68024
- // If we are inferring from a string literal type to a type variable whose constraint includes one of the
68025
- // allowed template literal placeholder types, infer from a literal type corresponding to the constraint.
68026
- var sourceTypes = void 0;
68027
- if (source_1.flags & 128 /* StringLiteral */ && target_3.flags & 8650752 /* TypeVariable */) {
68028
- var inferenceContext = getInferenceInfoForType(target_3);
68029
- var constraint = inferenceContext ? getConstraintOfTypeParameter(inferenceContext.typeParameter) : undefined;
68030
- if (inferenceContext && constraint) {
68031
- var str = source_1.value;
68032
- var constraintTypes = constraint.flags & 1048576 /* Union */ ? constraint.types : [constraint];
68033
- for (var _i = 0, constraintTypes_1 = constraintTypes; _i < constraintTypes_1.length; _i++) {
68034
- var constraintType = constraintTypes_1[_i];
68035
- if (constraintType.flags & 402653316 /* StringLike */) {
68036
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
68037
- sourceTypes.push(source_1);
68038
- }
68039
- if (constraintType.flags & 296 /* NumberLike */ && isValidNumberString(str, /*roundTripOnly*/ true)) {
68040
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
68041
- sourceTypes.push(getNumberLiteralType(+str));
68042
- }
68043
- if (constraintType.flags & 2112 /* BigIntLike */ && isValidBigIntString(str, /*roundTripOnly*/ true)) {
68044
- var negative = str.startsWith("-");
68045
- var base10Value = ts.parsePseudoBigInt((negative ? str.slice(1) : str) + "n");
68046
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
68047
- sourceTypes.push(getBigIntLiteralType({ negative: negative, base10Value: base10Value }));
68048
- }
68049
- if (constraintType.flags & 528 /* BooleanLike */) {
68050
- if (str === trueType.intrinsicName) {
68051
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
68052
- sourceTypes.push(trueType);
68053
- }
68054
- else if (str === falseType.intrinsicName) {
68055
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
68056
- sourceTypes.push(falseType);
68057
- }
68058
- }
68059
- if (constraintType.flags & 65536 /* Null */ && str === nullType.intrinsicName) {
68060
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
68061
- sourceTypes.push(nullType);
68062
- }
68063
- if (constraintType.flags & 32768 /* Undefined */ && str === undefinedType.intrinsicName) {
68064
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
68065
- sourceTypes.push(undefinedType);
68066
- }
68067
- }
68068
- }
68069
- }
68070
- if (sourceTypes) {
68071
- for (var _a = 0, sourceTypes_3 = sourceTypes; _a < sourceTypes_3.length; _a++) {
68072
- var source_2 = sourceTypes_3[_a];
68073
- inferFromTypes(source_2, target_3);
68074
- }
68075
- }
68076
- else {
68077
- inferFromTypes(source_1, target_3);
68078
- }
68045
+ inferFromTypes(matches ? matches[i] : neverType, types[i]);
68079
68046
  }
68080
68047
  }
68081
68048
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.7.0-pr-48094-5",
5
+ "version": "4.7.0-pr-48264-3",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [