@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.
- package/lib/tsc.js +64 -57
- package/lib/tsserver.js +145 -68
- package/lib/tsserverlibrary.d.ts +5 -5
- package/lib/tsserverlibrary.js +145 -68
- package/lib/typescript.d.ts +5 -5
- package/lib/typescript.js +145 -68
- package/lib/typescriptServices.d.ts +5 -5
- package/lib/typescriptServices.js +145 -68
- package/lib/typingsInstaller.js +69 -59
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -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(),
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
68021
|
-
|
|
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
|
-
|
|
68034
|
-
|
|
68035
|
-
|
|
68036
|
-
|
|
68037
|
-
|
|
68038
|
-
|
|
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.
|
|
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.
|
|
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
|
|
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 (
|
|
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
|
-
|
|
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;
|
|
@@ -1373,7 +1373,7 @@ declare namespace ts {
|
|
|
1373
1373
|
readonly kind: SyntaxKind.JsxAttribute;
|
|
1374
1374
|
readonly parent: JsxAttributes;
|
|
1375
1375
|
readonly name: Identifier;
|
|
1376
|
-
readonly initializer?: StringLiteral |
|
|
1376
|
+
readonly initializer?: StringLiteral | JsxExpression;
|
|
1377
1377
|
}
|
|
1378
1378
|
export interface JsxSpreadAttribute extends ObjectLiteralElement {
|
|
1379
1379
|
readonly kind: SyntaxKind.JsxSpreadAttribute;
|
|
@@ -3690,8 +3690,8 @@ declare namespace ts {
|
|
|
3690
3690
|
createJsxOpeningFragment(): JsxOpeningFragment;
|
|
3691
3691
|
createJsxJsxClosingFragment(): JsxClosingFragment;
|
|
3692
3692
|
updateJsxFragment(node: JsxFragment, openingFragment: JsxOpeningFragment, children: readonly JsxChild[], closingFragment: JsxClosingFragment): JsxFragment;
|
|
3693
|
-
createJsxAttribute(name: Identifier, initializer: StringLiteral |
|
|
3694
|
-
updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral |
|
|
3693
|
+
createJsxAttribute(name: Identifier, initializer: StringLiteral | JsxExpression | undefined): JsxAttribute;
|
|
3694
|
+
updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression | undefined): JsxAttribute;
|
|
3695
3695
|
createJsxAttributes(properties: readonly JsxAttributeLike[]): JsxAttributes;
|
|
3696
3696
|
updateJsxAttributes(node: JsxAttributes, properties: readonly JsxAttributeLike[]): JsxAttributes;
|
|
3697
3697
|
createJsxSpreadAttribute(expression: Expression): JsxSpreadAttribute;
|
|
@@ -7372,9 +7372,9 @@ declare namespace ts {
|
|
|
7372
7372
|
/** @deprecated Use `factory.updateJsxFragment` or the factory supplied by your transformation context instead. */
|
|
7373
7373
|
const updateJsxFragment: (node: JsxFragment, openingFragment: JsxOpeningFragment, children: readonly JsxChild[], closingFragment: JsxClosingFragment) => JsxFragment;
|
|
7374
7374
|
/** @deprecated Use `factory.createJsxAttribute` or the factory supplied by your transformation context instead. */
|
|
7375
|
-
const createJsxAttribute: (name: Identifier, initializer: StringLiteral |
|
|
7375
|
+
const createJsxAttribute: (name: Identifier, initializer: StringLiteral | JsxExpression | undefined) => JsxAttribute;
|
|
7376
7376
|
/** @deprecated Use `factory.updateJsxAttribute` or the factory supplied by your transformation context instead. */
|
|
7377
|
-
const updateJsxAttribute: (node: JsxAttribute, name: Identifier, initializer: StringLiteral |
|
|
7377
|
+
const updateJsxAttribute: (node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression | undefined) => JsxAttribute;
|
|
7378
7378
|
/** @deprecated Use `factory.createJsxAttributes` or the factory supplied by your transformation context instead. */
|
|
7379
7379
|
const createJsxAttributes: (properties: readonly JsxAttributeLike[]) => JsxAttributes;
|
|
7380
7380
|
/** @deprecated Use `factory.updateJsxAttributes` or the factory supplied by your transformation context instead. */
|