@typescript-deploys/pr-build 4.6.0-pr-47590-5 → 4.6.0-pr-45974-9

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.
@@ -7830,18 +7830,6 @@ var ts;
7830
7830
  return getCanonicalFileName(nonCanonicalizedPath);
7831
7831
  }
7832
7832
  ts.toPath = toPath;
7833
- function normalizePathAndParts(path) {
7834
- path = normalizeSlashes(path);
7835
- var _a = reducePathComponents(getPathComponents(path)), root = _a[0], parts = _a.slice(1);
7836
- if (parts.length) {
7837
- var joinedParts = root + parts.join(ts.directorySeparator);
7838
- return { path: hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(joinedParts) : joinedParts, parts: parts };
7839
- }
7840
- else {
7841
- return { path: root, parts: parts };
7842
- }
7843
- }
7844
- ts.normalizePathAndParts = normalizePathAndParts;
7845
7833
  function removeTrailingDirectorySeparator(path) {
7846
7834
  if (hasTrailingDirectorySeparator(path)) {
7847
7835
  return path.substr(0, path.length - 1);
@@ -11945,8 +11933,6 @@ var ts;
11945
11933
  case 39 /* singleQuote */:
11946
11934
  tokenValue = scanString(/*jsxAttributeString*/ true);
11947
11935
  return token = 10 /* StringLiteral */;
11948
- case 96 /* backtick */:
11949
- return token = scanTemplateAndSetTokenValue(/*isTaggedTemplate*/ false);
11950
11936
  default:
11951
11937
  // If this scans anything other than `{`, it's a parse error.
11952
11938
  return scan();
@@ -13954,11 +13940,6 @@ var ts;
13954
13940
  || kind === 287 /* JsxExpression */;
13955
13941
  }
13956
13942
  ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;
13957
- /* @internal */
13958
- function isStringLiteralOrTemplateExpressionOrJsxExpression(node) {
13959
- return node.kind === 222 /* TemplateExpression */ || isStringLiteralOrJsxExpression(node);
13960
- }
13961
- ts.isStringLiteralOrTemplateExpressionOrJsxExpression = isStringLiteralOrTemplateExpressionOrJsxExpression;
13962
13943
  function isJsxOpeningLikeElement(node) {
13963
13944
  var kind = node.kind;
13964
13945
  return kind === 279 /* JsxOpeningElement */
@@ -34656,26 +34637,15 @@ var ts;
34656
34637
  }
34657
34638
  return finishNode(factory.createJsxExpression(dotDotDotToken, expression), pos);
34658
34639
  }
34659
- function parseJsxAttributeValue() {
34660
- if (token() !== 63 /* EqualsToken */) {
34661
- return undefined;
34662
- }
34663
- var jsxAttributeValueToken = scanJsxAttributeValue();
34664
- if (jsxAttributeValueToken === 10 /* StringLiteral */ || jsxAttributeValueToken === 14 /* NoSubstitutionTemplateLiteral */) {
34665
- return parseLiteralNode();
34666
- }
34667
- if (jsxAttributeValueToken === 15 /* TemplateHead */) {
34668
- return parseTemplateExpression(/*isTaggedTemplate*/ false);
34669
- }
34670
- return parseJsxExpression(/*inExpressionContext*/ true);
34671
- }
34672
34640
  function parseJsxAttribute() {
34673
34641
  if (token() === 18 /* OpenBraceToken */) {
34674
34642
  return parseJsxSpreadAttribute();
34675
34643
  }
34676
34644
  scanJsxIdentifier();
34677
34645
  var pos = getNodePos();
34678
- return finishNode(factory.createJsxAttribute(parseIdentifierName(), parseJsxAttributeValue()), pos);
34646
+ return finishNode(factory.createJsxAttribute(parseIdentifierName(), token() !== 63 /* EqualsToken */ ? undefined :
34647
+ scanJsxAttributeValue() === 10 /* StringLiteral */ ? parseLiteralNode() :
34648
+ parseJsxExpression(/*inExpressionContext*/ true)), pos);
34679
34649
  }
34680
34650
  function parseJsxSpreadAttribute() {
34681
34651
  var pos = getNodePos();
@@ -41933,7 +41903,7 @@ var ts;
41933
41903
  result_4 = searchResult && searchResult.value;
41934
41904
  }
41935
41905
  else {
41936
- var candidate = ts.normalizePathAndParts(ts.combinePaths(initialLocationForSecondaryLookup, typeReferenceDirectiveName)).path;
41906
+ var candidate = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName).path;
41937
41907
  result_4 = nodeLoadModuleByRelativeName(Extensions.DtsOnly, candidate, /*onlyRecordFailures*/ false, moduleResolutionState, /*considerPackageJson*/ true);
41938
41908
  }
41939
41909
  return resolvedTypeScriptOnly(result_4);
@@ -42636,13 +42606,25 @@ var ts;
42636
42606
  return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
42637
42607
  }
42638
42608
  else {
42639
- var _a = ts.normalizePathAndParts(ts.combinePaths(containingDirectory, moduleName)), candidate = _a.path, parts = _a.parts;
42609
+ var _a = normalizePathForCJSResolution(containingDirectory, moduleName), candidate = _a.path, parts = _a.parts;
42640
42610
  var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, /*onlyRecordFailures*/ false, state, /*considerPackageJson*/ true);
42641
42611
  // Treat explicit "node_modules" import as an external library import.
42642
42612
  return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: ts.contains(parts, "node_modules") });
42643
42613
  }
42644
42614
  }
42645
42615
  }
42616
+ // If you import from "." inside a containing directory "/foo", the result of `normalizePath`
42617
+ // would be "/foo", but this loses the information that `foo` is a directory and we intended
42618
+ // to look inside of it. The Node CommonJS resolution algorithm doesn't call this out
42619
+ // (https://nodejs.org/api/modules.html#all-together), but it seems that module paths ending
42620
+ // in `.` are actually normalized to `./` before proceeding with the resolution algorithm.
42621
+ function normalizePathForCJSResolution(containingDirectory, moduleName) {
42622
+ var combined = ts.combinePaths(containingDirectory, moduleName);
42623
+ var parts = ts.getPathComponents(combined);
42624
+ var lastPart = ts.lastOrUndefined(parts);
42625
+ var path = lastPart === "." || lastPart === ".." ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(combined)) : ts.normalizePath(combined);
42626
+ return { path: path, parts: parts };
42627
+ }
42646
42628
  function realPath(path, host, traceEnabled) {
42647
42629
  if (!host.realpath) {
42648
42630
  return path;
@@ -44390,7 +44372,7 @@ var ts;
44390
44372
  return ts.isDottedName(expr)
44391
44373
  || (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression)
44392
44374
  || ts.isBinaryExpression(expr) && expr.operatorToken.kind === 27 /* CommaToken */ && isNarrowableReference(expr.right)
44393
- || ts.isElementAccessExpression(expr) && ts.isStringOrNumericLiteralLike(expr.argumentExpression) && isNarrowableReference(expr.expression)
44375
+ || ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isIdentifier(expr.argumentExpression)) && isNarrowableReference(expr.expression)
44394
44376
  || ts.isAssignmentExpression(expr) && isNarrowableReference(expr.left);
44395
44377
  }
44396
44378
  function containsNarrowableReference(expr) {
@@ -68017,8 +67999,9 @@ var ts;
68017
67999
  return isMatchingReference(source.expression, target);
68018
68000
  case 205 /* PropertyAccessExpression */:
68019
68001
  case 206 /* ElementAccessExpression */:
68020
- return ts.isAccessExpression(target) &&
68021
- getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
68002
+ var sourcePropertyName = getAccessedPropertyName(source);
68003
+ var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined;
68004
+ return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName &&
68022
68005
  isMatchingReference(source.expression, target.expression);
68023
68006
  case 160 /* QualifiedName */:
68024
68007
  return ts.isAccessExpression(target) &&
@@ -68030,12 +68013,49 @@ var ts;
68030
68013
  return false;
68031
68014
  }
68032
68015
  function getAccessedPropertyName(access) {
68033
- var propertyName;
68034
- return access.kind === 205 /* PropertyAccessExpression */ ? access.name.escapedText :
68035
- access.kind === 206 /* ElementAccessExpression */ && ts.isStringOrNumericLiteralLike(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
68036
- access.kind === 202 /* BindingElement */ && (propertyName = getDestructuringPropertyName(access)) ? ts.escapeLeadingUnderscores(propertyName) :
68037
- access.kind === 163 /* Parameter */ ? ("" + access.parent.parameters.indexOf(access)) :
68038
- undefined;
68016
+ if (ts.isPropertyAccessExpression(access)) {
68017
+ return access.name.escapedText;
68018
+ }
68019
+ if (ts.isElementAccessExpression(access)) {
68020
+ return tryGetElementAccessExpressionName(access);
68021
+ }
68022
+ if (ts.isBindingElement(access)) {
68023
+ var name = getDestructuringPropertyName(access);
68024
+ return name ? ts.escapeLeadingUnderscores(name) : undefined;
68025
+ }
68026
+ if (ts.isParameter(access)) {
68027
+ return ("" + access.parent.parameters.indexOf(access));
68028
+ }
68029
+ return undefined;
68030
+ }
68031
+ function tryGetNameFromType(type) {
68032
+ return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName :
68033
+ type.flags & 384 /* StringOrNumberLiteral */ ? ts.escapeLeadingUnderscores("" + type.value) : undefined;
68034
+ }
68035
+ function tryGetElementAccessExpressionName(node) {
68036
+ if (ts.isStringOrNumericLiteralLike(node.argumentExpression)) {
68037
+ return ts.escapeLeadingUnderscores(node.argumentExpression.text);
68038
+ }
68039
+ if (ts.isIdentifier(node.argumentExpression)) {
68040
+ var symbol = getResolvedSymbol(node.argumentExpression);
68041
+ if (!isConstVariable(symbol))
68042
+ return undefined;
68043
+ var declaration = symbol.valueDeclaration;
68044
+ if (declaration === undefined)
68045
+ return undefined;
68046
+ var type = tryGetTypeFromEffectiveTypeNode(declaration);
68047
+ if (type) {
68048
+ var name = tryGetNameFromType(type);
68049
+ if (name !== undefined) {
68050
+ return name;
68051
+ }
68052
+ }
68053
+ if (ts.hasOnlyExpressionInitializer(declaration)) {
68054
+ var initializer = ts.getEffectiveInitializer(declaration);
68055
+ return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
68056
+ }
68057
+ }
68058
+ return undefined;
68039
68059
  }
68040
68060
  function containsMatchingReference(source, target) {
68041
68061
  while (ts.isAccessExpression(source)) {
@@ -82953,7 +82973,7 @@ var ts;
82953
82973
  }
82954
82974
  if (!ts.isStatic(member) && isPropertyWithoutInitializer(member)) {
82955
82975
  var propName = member.name;
82956
- if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName)) {
82976
+ if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
82957
82977
  var type = getTypeOfSymbol(getSymbolOfNode(member));
82958
82978
  if (!(type.flags & 3 /* AnyOrUnknown */ || getFalsyFlags(type) & 32768 /* Undefined */)) {
82959
82979
  if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
@@ -82988,7 +83008,9 @@ var ts;
82988
83008
  return false;
82989
83009
  }
82990
83010
  function isPropertyInitializedInConstructor(propName, propType, constructor) {
82991
- var reference = ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
83011
+ var reference = ts.isComputedPropertyName(propName)
83012
+ ? ts.factory.createElementAccessExpression(ts.factory.createThis(), propName.expression)
83013
+ : ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
82992
83014
  ts.setParent(reference.expression, reference);
82993
83015
  ts.setParent(reference, constructor);
82994
83016
  reference.flowNode = constructor.returnFlowNode;
@@ -88215,7 +88237,7 @@ var ts;
88215
88237
  return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment));
88216
88238
  case 284 /* JsxAttribute */:
88217
88239
  ts.Debug.type(node);
88218
- return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrTemplateExpressionOrJsxExpression));
88240
+ return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression));
88219
88241
  case 285 /* JsxAttributes */:
88220
88242
  ts.Debug.type(node);
88221
88243
  return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike));
@@ -96277,9 +96299,6 @@ var ts;
96277
96299
  var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote);
96278
96300
  return ts.setTextRange(literal, node);
96279
96301
  }
96280
- else if (node.kind === 14 /* NoSubstitutionTemplateLiteral */ || node.kind === 222 /* TemplateExpression */) {
96281
- return node;
96282
- }
96283
96302
  else if (node.kind === 287 /* JsxExpression */) {
96284
96303
  if (node.expression === undefined) {
96285
96304
  return factory.createTrue();
@@ -97054,8 +97073,6 @@ var ts;
97054
97073
  return visitReturnStatement(node);
97055
97074
  case 216 /* VoidExpression */:
97056
97075
  return visitVoidExpression(node);
97057
- case 284 /* JsxAttribute */:
97058
- return visitJsxAttribute(node);
97059
97076
  default:
97060
97077
  return ts.visitEachChild(node, visitor, context);
97061
97078
  }
@@ -97086,13 +97103,6 @@ var ts;
97086
97103
  }
97087
97104
  return ts.visitEachChild(node, visitor, context);
97088
97105
  }
97089
- function visitJsxAttribute(node) {
97090
- if (node.initializer && ts.isTemplateExpression(node.initializer)) {
97091
- return factory.createJsxAttribute(ts.visitNode(node.name, visitor, ts.isIdentifier), factory.createJsxExpression(
97092
- /* dotDotDotToken */ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)));
97093
- }
97094
- return ts.visitEachChild(node, visitor, context);
97095
- }
97096
97106
  function visitCaseBlock(node) {
97097
97107
  var ancestorFacts = enterSubtree(7104 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
97098
97108
  var updated = ts.visitEachChild(node, visitor, context);
@@ -127575,6 +127585,10 @@ var ts;
127575
127585
  return __assign(__assign({}, options), { semicolons: shouldRemoveSemicolons ? ts.SemicolonPreference.Remove : ts.SemicolonPreference.Ignore });
127576
127586
  }
127577
127587
  ts.getFormatCodeSettingsForWriting = getFormatCodeSettingsForWriting;
127588
+ function jsxModeNeedsExplicitImport(jsx) {
127589
+ return jsx === 2 /* React */ || jsx === 3 /* ReactNative */;
127590
+ }
127591
+ ts.jsxModeNeedsExplicitImport = jsxModeNeedsExplicitImport;
127578
127592
  // #endregion
127579
127593
  })(ts || (ts = {}));
127580
127594
  /*@internal*/
@@ -129519,9 +129533,18 @@ var ts;
129519
129533
  return getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, extensionOptions, host, scriptPath);
129520
129534
  }
129521
129535
  }
129536
+ function isEmitResolutionKindUsingNodeModules(compilerOptions) {
129537
+ return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ||
129538
+ ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 ||
129539
+ ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
129540
+ }
129541
+ function isEmitModuleResolutionRespectingExportMaps(compilerOptions) {
129542
+ return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 ||
129543
+ ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
129544
+ }
129522
129545
  function getSupportedExtensionsForModuleResolution(compilerOptions) {
129523
129546
  var extensions = ts.getSupportedExtensions(compilerOptions);
129524
- return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ?
129547
+ return isEmitResolutionKindUsingNodeModules(compilerOptions) ?
129525
129548
  ts.getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) :
129526
129549
  extensions;
129527
129550
  }
@@ -129684,7 +129707,7 @@ var ts;
129684
129707
  result.push(nameAndKind(ambientName, "external module name" /* externalModuleName */, /*extension*/ undefined));
129685
129708
  }
129686
129709
  getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, fragmentDirectory, extensionOptions, result);
129687
- if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs) {
129710
+ if (isEmitResolutionKindUsingNodeModules(compilerOptions)) {
129688
129711
  // If looking for a global package name, don't just include everything in `node_modules` because that includes dependencies' own dependencies.
129689
129712
  // (But do if we didn't find anything, e.g. 'package.json' missing.)
129690
129713
  var foundGlobal = false;
@@ -129701,12 +129724,68 @@ var ts;
129701
129724
  }
129702
129725
  }
129703
129726
  if (!foundGlobal) {
129704
- ts.forEachAncestorDirectory(scriptPath, function (ancestor) {
129727
+ var ancestorLookup = function (ancestor) {
129705
129728
  var nodeModules = ts.combinePaths(ancestor, "node_modules");
129706
129729
  if (ts.tryDirectoryExists(host, nodeModules)) {
129707
129730
  getCompletionEntriesForDirectoryFragment(fragment, nodeModules, extensionOptions, host, /*exclude*/ undefined, result);
129708
129731
  }
129709
- });
129732
+ };
129733
+ if (fragmentDirectory && isEmitModuleResolutionRespectingExportMaps(compilerOptions)) {
129734
+ var nodeModulesDirectoryLookup_1 = ancestorLookup;
129735
+ ancestorLookup = function (ancestor) {
129736
+ var components = ts.getPathComponents(fragment);
129737
+ components.shift(); // shift off empty root
129738
+ var packagePath = components.shift();
129739
+ if (!packagePath) {
129740
+ return nodeModulesDirectoryLookup_1(ancestor);
129741
+ }
129742
+ if (ts.startsWith(packagePath, "@")) {
129743
+ var subName = components.shift();
129744
+ if (!subName) {
129745
+ return nodeModulesDirectoryLookup_1(ancestor);
129746
+ }
129747
+ packagePath = ts.combinePaths(packagePath, subName);
129748
+ }
129749
+ var packageFile = ts.combinePaths(ancestor, "node_modules", packagePath, "package.json");
129750
+ if (ts.tryFileExists(host, packageFile)) {
129751
+ var packageJson = ts.readJson(packageFile, host);
129752
+ var exports = packageJson.exports;
129753
+ if (exports) {
129754
+ if (typeof exports !== "object" || exports === null) { // eslint-disable-line no-null/no-null
129755
+ return; // null exports or entrypoint only, no sub-modules available
129756
+ }
129757
+ var keys = ts.getOwnKeys(exports);
129758
+ var fragmentSubpath_1 = components.join("/");
129759
+ var processedKeys = ts.mapDefined(keys, function (k) {
129760
+ if (k === ".")
129761
+ return undefined;
129762
+ if (!ts.startsWith(k, "./"))
129763
+ return undefined;
129764
+ var subpath = k.substring(2);
129765
+ if (!ts.startsWith(subpath, fragmentSubpath_1))
129766
+ return undefined;
129767
+ // subpath is a valid export (barring conditions, which we don't currently check here)
129768
+ if (!ts.stringContains(subpath, "*")) {
129769
+ return subpath;
129770
+ }
129771
+ // pattern export - only return everything up to the `*`, so the user can autocomplete, then
129772
+ // keep filling in the pattern (we could speculatively return a list of options by hitting disk,
129773
+ // but conditions will make that somewhat awkward, as each condition may have a different set of possible
129774
+ // options for the `*`.
129775
+ return subpath.slice(0, subpath.indexOf("*"));
129776
+ });
129777
+ ts.forEach(processedKeys, function (k) {
129778
+ if (k) {
129779
+ result.push(nameAndKind(k, "external module name" /* externalModuleName */, /*extension*/ undefined));
129780
+ }
129781
+ });
129782
+ return;
129783
+ }
129784
+ }
129785
+ return nodeModulesDirectoryLookup_1(ancestor);
129786
+ };
129787
+ }
129788
+ ts.forEachAncestorDirectory(scriptPath, ancestorLookup);
129710
129789
  }
129711
129790
  }
129712
129791
  return result;
@@ -139199,6 +139278,7 @@ var ts;
139199
139278
  return oldImports;
139200
139279
  }
139201
139280
  var typeChecker = program.getTypeChecker();
139281
+ var compilerOptions = program.getCompilerOptions();
139202
139282
  var jsxNamespace = typeChecker.getJsxNamespace(sourceFile);
139203
139283
  var jsxFragmentFactory = typeChecker.getJsxFragmentFactory(sourceFile);
139204
139284
  var jsxElementsPresent = !!(sourceFile.transformFlags & 2 /* ContainsJsx */);
@@ -139255,7 +139335,7 @@ var ts;
139255
139335
  return usedImports;
139256
139336
  function isDeclarationUsed(identifier) {
139257
139337
  // The JSX factory symbol is always used if JSX elements are present - even if they are not allowed.
139258
- return jsxElementsPresent && (identifier.text === jsxNamespace || jsxFragmentFactory && identifier.text === jsxFragmentFactory) ||
139338
+ return jsxElementsPresent && (identifier.text === jsxNamespace || jsxFragmentFactory && identifier.text === jsxFragmentFactory) && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx) ||
139259
139339
  ts.FindAllReferences.Core.isSymbolReferencedInFile(identifier, typeChecker, sourceFile);
139260
139340
  }
139261
139341
  }
@@ -150946,12 +151026,9 @@ var ts;
150946
151026
  return undefined;
150947
151027
  return { kind: 4 /* PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration };
150948
151028
  }
150949
- function jsxModeNeedsExplicitImport(jsx) {
150950
- return jsx === 2 /* React */ || jsx === 3 /* ReactNative */;
150951
- }
150952
151029
  function getSymbolName(sourceFile, checker, symbolToken, compilerOptions) {
150953
151030
  var parent = symbolToken.parent;
150954
- if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && jsxModeNeedsExplicitImport(compilerOptions.jsx)) {
151031
+ if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) {
150955
151032
  var jsxNamespace = checker.getJsxNamespace(sourceFile);
150956
151033
  if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) {
150957
151034
  return jsxNamespace;
@@ -7625,18 +7625,6 @@ var ts;
7625
7625
  return getCanonicalFileName(nonCanonicalizedPath);
7626
7626
  }
7627
7627
  ts.toPath = toPath;
7628
- function normalizePathAndParts(path) {
7629
- path = normalizeSlashes(path);
7630
- var _a = reducePathComponents(getPathComponents(path)), root = _a[0], parts = _a.slice(1);
7631
- if (parts.length) {
7632
- var joinedParts = root + parts.join(ts.directorySeparator);
7633
- return { path: hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(joinedParts) : joinedParts, parts: parts };
7634
- }
7635
- else {
7636
- return { path: root, parts: parts };
7637
- }
7638
- }
7639
- ts.normalizePathAndParts = normalizePathAndParts;
7640
7628
  function removeTrailingDirectorySeparator(path) {
7641
7629
  if (hasTrailingDirectorySeparator(path)) {
7642
7630
  return path.substr(0, path.length - 1);
@@ -11740,8 +11728,6 @@ var ts;
11740
11728
  case 39 /* singleQuote */:
11741
11729
  tokenValue = scanString(/*jsxAttributeString*/ true);
11742
11730
  return token = 10 /* StringLiteral */;
11743
- case 96 /* backtick */:
11744
- return token = scanTemplateAndSetTokenValue(/*isTaggedTemplate*/ false);
11745
11731
  default:
11746
11732
  // If this scans anything other than `{`, it's a parse error.
11747
11733
  return scan();
@@ -13749,11 +13735,6 @@ var ts;
13749
13735
  || kind === 287 /* JsxExpression */;
13750
13736
  }
13751
13737
  ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;
13752
- /* @internal */
13753
- function isStringLiteralOrTemplateExpressionOrJsxExpression(node) {
13754
- return node.kind === 222 /* TemplateExpression */ || isStringLiteralOrJsxExpression(node);
13755
- }
13756
- ts.isStringLiteralOrTemplateExpressionOrJsxExpression = isStringLiteralOrTemplateExpressionOrJsxExpression;
13757
13738
  function isJsxOpeningLikeElement(node) {
13758
13739
  var kind = node.kind;
13759
13740
  return kind === 279 /* JsxOpeningElement */
@@ -34451,26 +34432,15 @@ var ts;
34451
34432
  }
34452
34433
  return finishNode(factory.createJsxExpression(dotDotDotToken, expression), pos);
34453
34434
  }
34454
- function parseJsxAttributeValue() {
34455
- if (token() !== 63 /* EqualsToken */) {
34456
- return undefined;
34457
- }
34458
- var jsxAttributeValueToken = scanJsxAttributeValue();
34459
- if (jsxAttributeValueToken === 10 /* StringLiteral */ || jsxAttributeValueToken === 14 /* NoSubstitutionTemplateLiteral */) {
34460
- return parseLiteralNode();
34461
- }
34462
- if (jsxAttributeValueToken === 15 /* TemplateHead */) {
34463
- return parseTemplateExpression(/*isTaggedTemplate*/ false);
34464
- }
34465
- return parseJsxExpression(/*inExpressionContext*/ true);
34466
- }
34467
34435
  function parseJsxAttribute() {
34468
34436
  if (token() === 18 /* OpenBraceToken */) {
34469
34437
  return parseJsxSpreadAttribute();
34470
34438
  }
34471
34439
  scanJsxIdentifier();
34472
34440
  var pos = getNodePos();
34473
- return finishNode(factory.createJsxAttribute(parseIdentifierName(), parseJsxAttributeValue()), pos);
34441
+ return finishNode(factory.createJsxAttribute(parseIdentifierName(), token() !== 63 /* EqualsToken */ ? undefined :
34442
+ scanJsxAttributeValue() === 10 /* StringLiteral */ ? parseLiteralNode() :
34443
+ parseJsxExpression(/*inExpressionContext*/ true)), pos);
34474
34444
  }
34475
34445
  function parseJsxSpreadAttribute() {
34476
34446
  var pos = getNodePos();
@@ -41728,7 +41698,7 @@ var ts;
41728
41698
  result_4 = searchResult && searchResult.value;
41729
41699
  }
41730
41700
  else {
41731
- var candidate = ts.normalizePathAndParts(ts.combinePaths(initialLocationForSecondaryLookup, typeReferenceDirectiveName)).path;
41701
+ var candidate = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName).path;
41732
41702
  result_4 = nodeLoadModuleByRelativeName(Extensions.DtsOnly, candidate, /*onlyRecordFailures*/ false, moduleResolutionState, /*considerPackageJson*/ true);
41733
41703
  }
41734
41704
  return resolvedTypeScriptOnly(result_4);
@@ -42431,13 +42401,25 @@ var ts;
42431
42401
  return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
42432
42402
  }
42433
42403
  else {
42434
- var _a = ts.normalizePathAndParts(ts.combinePaths(containingDirectory, moduleName)), candidate = _a.path, parts = _a.parts;
42404
+ var _a = normalizePathForCJSResolution(containingDirectory, moduleName), candidate = _a.path, parts = _a.parts;
42435
42405
  var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, /*onlyRecordFailures*/ false, state, /*considerPackageJson*/ true);
42436
42406
  // Treat explicit "node_modules" import as an external library import.
42437
42407
  return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: ts.contains(parts, "node_modules") });
42438
42408
  }
42439
42409
  }
42440
42410
  }
42411
+ // If you import from "." inside a containing directory "/foo", the result of `normalizePath`
42412
+ // would be "/foo", but this loses the information that `foo` is a directory and we intended
42413
+ // to look inside of it. The Node CommonJS resolution algorithm doesn't call this out
42414
+ // (https://nodejs.org/api/modules.html#all-together), but it seems that module paths ending
42415
+ // in `.` are actually normalized to `./` before proceeding with the resolution algorithm.
42416
+ function normalizePathForCJSResolution(containingDirectory, moduleName) {
42417
+ var combined = ts.combinePaths(containingDirectory, moduleName);
42418
+ var parts = ts.getPathComponents(combined);
42419
+ var lastPart = ts.lastOrUndefined(parts);
42420
+ var path = lastPart === "." || lastPart === ".." ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(combined)) : ts.normalizePath(combined);
42421
+ return { path: path, parts: parts };
42422
+ }
42441
42423
  function realPath(path, host, traceEnabled) {
42442
42424
  if (!host.realpath) {
42443
42425
  return path;
@@ -44185,7 +44167,7 @@ var ts;
44185
44167
  return ts.isDottedName(expr)
44186
44168
  || (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression)
44187
44169
  || ts.isBinaryExpression(expr) && expr.operatorToken.kind === 27 /* CommaToken */ && isNarrowableReference(expr.right)
44188
- || ts.isElementAccessExpression(expr) && ts.isStringOrNumericLiteralLike(expr.argumentExpression) && isNarrowableReference(expr.expression)
44170
+ || ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isIdentifier(expr.argumentExpression)) && isNarrowableReference(expr.expression)
44189
44171
  || ts.isAssignmentExpression(expr) && isNarrowableReference(expr.left);
44190
44172
  }
44191
44173
  function containsNarrowableReference(expr) {
@@ -67812,8 +67794,9 @@ var ts;
67812
67794
  return isMatchingReference(source.expression, target);
67813
67795
  case 205 /* PropertyAccessExpression */:
67814
67796
  case 206 /* ElementAccessExpression */:
67815
- return ts.isAccessExpression(target) &&
67816
- getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
67797
+ var sourcePropertyName = getAccessedPropertyName(source);
67798
+ var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined;
67799
+ return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName &&
67817
67800
  isMatchingReference(source.expression, target.expression);
67818
67801
  case 160 /* QualifiedName */:
67819
67802
  return ts.isAccessExpression(target) &&
@@ -67825,12 +67808,49 @@ var ts;
67825
67808
  return false;
67826
67809
  }
67827
67810
  function getAccessedPropertyName(access) {
67828
- var propertyName;
67829
- return access.kind === 205 /* PropertyAccessExpression */ ? access.name.escapedText :
67830
- access.kind === 206 /* ElementAccessExpression */ && ts.isStringOrNumericLiteralLike(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
67831
- access.kind === 202 /* BindingElement */ && (propertyName = getDestructuringPropertyName(access)) ? ts.escapeLeadingUnderscores(propertyName) :
67832
- access.kind === 163 /* Parameter */ ? ("" + access.parent.parameters.indexOf(access)) :
67833
- undefined;
67811
+ if (ts.isPropertyAccessExpression(access)) {
67812
+ return access.name.escapedText;
67813
+ }
67814
+ if (ts.isElementAccessExpression(access)) {
67815
+ return tryGetElementAccessExpressionName(access);
67816
+ }
67817
+ if (ts.isBindingElement(access)) {
67818
+ var name = getDestructuringPropertyName(access);
67819
+ return name ? ts.escapeLeadingUnderscores(name) : undefined;
67820
+ }
67821
+ if (ts.isParameter(access)) {
67822
+ return ("" + access.parent.parameters.indexOf(access));
67823
+ }
67824
+ return undefined;
67825
+ }
67826
+ function tryGetNameFromType(type) {
67827
+ return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName :
67828
+ type.flags & 384 /* StringOrNumberLiteral */ ? ts.escapeLeadingUnderscores("" + type.value) : undefined;
67829
+ }
67830
+ function tryGetElementAccessExpressionName(node) {
67831
+ if (ts.isStringOrNumericLiteralLike(node.argumentExpression)) {
67832
+ return ts.escapeLeadingUnderscores(node.argumentExpression.text);
67833
+ }
67834
+ if (ts.isIdentifier(node.argumentExpression)) {
67835
+ var symbol = getResolvedSymbol(node.argumentExpression);
67836
+ if (!isConstVariable(symbol))
67837
+ return undefined;
67838
+ var declaration = symbol.valueDeclaration;
67839
+ if (declaration === undefined)
67840
+ return undefined;
67841
+ var type = tryGetTypeFromEffectiveTypeNode(declaration);
67842
+ if (type) {
67843
+ var name = tryGetNameFromType(type);
67844
+ if (name !== undefined) {
67845
+ return name;
67846
+ }
67847
+ }
67848
+ if (ts.hasOnlyExpressionInitializer(declaration)) {
67849
+ var initializer = ts.getEffectiveInitializer(declaration);
67850
+ return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
67851
+ }
67852
+ }
67853
+ return undefined;
67834
67854
  }
67835
67855
  function containsMatchingReference(source, target) {
67836
67856
  while (ts.isAccessExpression(source)) {
@@ -82748,7 +82768,7 @@ var ts;
82748
82768
  }
82749
82769
  if (!ts.isStatic(member) && isPropertyWithoutInitializer(member)) {
82750
82770
  var propName = member.name;
82751
- if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName)) {
82771
+ if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
82752
82772
  var type = getTypeOfSymbol(getSymbolOfNode(member));
82753
82773
  if (!(type.flags & 3 /* AnyOrUnknown */ || getFalsyFlags(type) & 32768 /* Undefined */)) {
82754
82774
  if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
@@ -82783,7 +82803,9 @@ var ts;
82783
82803
  return false;
82784
82804
  }
82785
82805
  function isPropertyInitializedInConstructor(propName, propType, constructor) {
82786
- var reference = ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
82806
+ var reference = ts.isComputedPropertyName(propName)
82807
+ ? ts.factory.createElementAccessExpression(ts.factory.createThis(), propName.expression)
82808
+ : ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
82787
82809
  ts.setParent(reference.expression, reference);
82788
82810
  ts.setParent(reference, constructor);
82789
82811
  reference.flowNode = constructor.returnFlowNode;
@@ -88010,7 +88032,7 @@ var ts;
88010
88032
  return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment));
88011
88033
  case 284 /* JsxAttribute */:
88012
88034
  ts.Debug.type(node);
88013
- return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrTemplateExpressionOrJsxExpression));
88035
+ return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression));
88014
88036
  case 285 /* JsxAttributes */:
88015
88037
  ts.Debug.type(node);
88016
88038
  return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike));
@@ -96072,9 +96094,6 @@ var ts;
96072
96094
  var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote);
96073
96095
  return ts.setTextRange(literal, node);
96074
96096
  }
96075
- else if (node.kind === 14 /* NoSubstitutionTemplateLiteral */ || node.kind === 222 /* TemplateExpression */) {
96076
- return node;
96077
- }
96078
96097
  else if (node.kind === 287 /* JsxExpression */) {
96079
96098
  if (node.expression === undefined) {
96080
96099
  return factory.createTrue();
@@ -96849,8 +96868,6 @@ var ts;
96849
96868
  return visitReturnStatement(node);
96850
96869
  case 216 /* VoidExpression */:
96851
96870
  return visitVoidExpression(node);
96852
- case 284 /* JsxAttribute */:
96853
- return visitJsxAttribute(node);
96854
96871
  default:
96855
96872
  return ts.visitEachChild(node, visitor, context);
96856
96873
  }
@@ -96881,13 +96898,6 @@ var ts;
96881
96898
  }
96882
96899
  return ts.visitEachChild(node, visitor, context);
96883
96900
  }
96884
- function visitJsxAttribute(node) {
96885
- if (node.initializer && ts.isTemplateExpression(node.initializer)) {
96886
- return factory.createJsxAttribute(ts.visitNode(node.name, visitor, ts.isIdentifier), factory.createJsxExpression(
96887
- /* dotDotDotToken */ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)));
96888
- }
96889
- return ts.visitEachChild(node, visitor, context);
96890
- }
96891
96901
  function visitCaseBlock(node) {
96892
96902
  var ancestorFacts = enterSubtree(7104 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
96893
96903
  var updated = ts.visitEachChild(node, visitor, context);
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.6.0-pr-47590-5",
5
+ "version": "4.6.0-pr-45974-9",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [