typescript 5.5.0-dev.20240325 → 5.5.0-dev.20240327
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 +275 -115
- package/lib/tsserver.js +2 -2
- package/lib/typescript.d.ts +20 -9
- package/lib/typescript.js +336 -159
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -1466,6 +1466,7 @@ __export(typescript_exports, {
|
|
|
1466
1466
|
isJSDocEnumTag: () => isJSDocEnumTag,
|
|
1467
1467
|
isJSDocFunctionType: () => isJSDocFunctionType,
|
|
1468
1468
|
isJSDocImplementsTag: () => isJSDocImplementsTag,
|
|
1469
|
+
isJSDocImportTag: () => isJSDocImportTag,
|
|
1469
1470
|
isJSDocIndexSignature: () => isJSDocIndexSignature,
|
|
1470
1471
|
isJSDocLikeText: () => isJSDocLikeText,
|
|
1471
1472
|
isJSDocLink: () => isJSDocLink,
|
|
@@ -2326,7 +2327,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2326
2327
|
|
|
2327
2328
|
// src/compiler/corePublic.ts
|
|
2328
2329
|
var versionMajorMinor = "5.5";
|
|
2329
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2330
|
+
var version = `${versionMajorMinor}.0-dev.20240327`;
|
|
2330
2331
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2331
2332
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2332
2333
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6071,12 +6072,13 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind5) => {
|
|
|
6071
6072
|
SyntaxKind5[SyntaxKind5["JSDocPropertyTag"] = 348] = "JSDocPropertyTag";
|
|
6072
6073
|
SyntaxKind5[SyntaxKind5["JSDocThrowsTag"] = 349] = "JSDocThrowsTag";
|
|
6073
6074
|
SyntaxKind5[SyntaxKind5["JSDocSatisfiesTag"] = 350] = "JSDocSatisfiesTag";
|
|
6074
|
-
SyntaxKind5[SyntaxKind5["
|
|
6075
|
-
SyntaxKind5[SyntaxKind5["
|
|
6076
|
-
SyntaxKind5[SyntaxKind5["
|
|
6077
|
-
SyntaxKind5[SyntaxKind5["
|
|
6078
|
-
SyntaxKind5[SyntaxKind5["
|
|
6079
|
-
SyntaxKind5[SyntaxKind5["
|
|
6075
|
+
SyntaxKind5[SyntaxKind5["JSDocImportTag"] = 351] = "JSDocImportTag";
|
|
6076
|
+
SyntaxKind5[SyntaxKind5["SyntaxList"] = 352] = "SyntaxList";
|
|
6077
|
+
SyntaxKind5[SyntaxKind5["NotEmittedStatement"] = 353] = "NotEmittedStatement";
|
|
6078
|
+
SyntaxKind5[SyntaxKind5["PartiallyEmittedExpression"] = 354] = "PartiallyEmittedExpression";
|
|
6079
|
+
SyntaxKind5[SyntaxKind5["CommaListExpression"] = 355] = "CommaListExpression";
|
|
6080
|
+
SyntaxKind5[SyntaxKind5["SyntheticReferenceExpression"] = 356] = "SyntheticReferenceExpression";
|
|
6081
|
+
SyntaxKind5[SyntaxKind5["Count"] = 357] = "Count";
|
|
6080
6082
|
SyntaxKind5[SyntaxKind5["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment";
|
|
6081
6083
|
SyntaxKind5[SyntaxKind5["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment";
|
|
6082
6084
|
SyntaxKind5[SyntaxKind5["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment";
|
|
@@ -6105,9 +6107,9 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind5) => {
|
|
|
6105
6107
|
SyntaxKind5[SyntaxKind5["LastStatement"] = 259 /* DebuggerStatement */] = "LastStatement";
|
|
6106
6108
|
SyntaxKind5[SyntaxKind5["FirstNode"] = 166 /* QualifiedName */] = "FirstNode";
|
|
6107
6109
|
SyntaxKind5[SyntaxKind5["FirstJSDocNode"] = 309 /* JSDocTypeExpression */] = "FirstJSDocNode";
|
|
6108
|
-
SyntaxKind5[SyntaxKind5["LastJSDocNode"] =
|
|
6110
|
+
SyntaxKind5[SyntaxKind5["LastJSDocNode"] = 351 /* JSDocImportTag */] = "LastJSDocNode";
|
|
6109
6111
|
SyntaxKind5[SyntaxKind5["FirstJSDocTagNode"] = 327 /* JSDocTag */] = "FirstJSDocTagNode";
|
|
6110
|
-
SyntaxKind5[SyntaxKind5["LastJSDocTagNode"] =
|
|
6112
|
+
SyntaxKind5[SyntaxKind5["LastJSDocTagNode"] = 351 /* JSDocImportTag */] = "LastJSDocTagNode";
|
|
6111
6113
|
SyntaxKind5[SyntaxKind5["FirstContextualKeyword"] = 128 /* AbstractKeyword */] = "FirstContextualKeyword";
|
|
6112
6114
|
SyntaxKind5[SyntaxKind5["LastContextualKeyword"] = 165 /* OfKeyword */] = "LastContextualKeyword";
|
|
6113
6115
|
return SyntaxKind5;
|
|
@@ -7667,14 +7669,17 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
7667
7669
|
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
|
|
7668
7670
|
}
|
|
7669
7671
|
}
|
|
7670
|
-
function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2) {
|
|
7672
|
+
function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp) {
|
|
7671
7673
|
const fileWatcherCallbacks = createMultiMap();
|
|
7674
|
+
const fileTimestamps = fsWatchWithTimestamp ? /* @__PURE__ */ new Map() : void 0;
|
|
7672
7675
|
const dirWatchers = /* @__PURE__ */ new Map();
|
|
7673
7676
|
const toCanonicalName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
|
|
7674
7677
|
return nonPollingWatchFile;
|
|
7675
7678
|
function nonPollingWatchFile(fileName, callback, _pollingInterval, fallbackOptions) {
|
|
7676
7679
|
const filePath = toCanonicalName(fileName);
|
|
7677
|
-
fileWatcherCallbacks.add(filePath, callback)
|
|
7680
|
+
if (fileWatcherCallbacks.add(filePath, callback).length === 1 && fileTimestamps) {
|
|
7681
|
+
fileTimestamps.set(filePath, getModifiedTime3(fileName) || missingFileModifiedTime);
|
|
7682
|
+
}
|
|
7678
7683
|
const dirPath = getDirectoryPath(filePath) || ".";
|
|
7679
7684
|
const watcher = dirWatchers.get(dirPath) || createDirectoryWatcher(getDirectoryPath(fileName) || ".", dirPath, fallbackOptions);
|
|
7680
7685
|
watcher.referenceCount++;
|
|
@@ -7694,14 +7699,31 @@ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFi
|
|
|
7694
7699
|
const watcher = fsWatch(
|
|
7695
7700
|
dirName,
|
|
7696
7701
|
1 /* Directory */,
|
|
7697
|
-
(
|
|
7702
|
+
(eventName, relativeFileName) => {
|
|
7698
7703
|
if (!isString(relativeFileName))
|
|
7699
7704
|
return;
|
|
7700
7705
|
const fileName = getNormalizedAbsolutePath(relativeFileName, dirName);
|
|
7701
|
-
const
|
|
7706
|
+
const filePath = toCanonicalName(fileName);
|
|
7707
|
+
const callbacks = fileName && fileWatcherCallbacks.get(filePath);
|
|
7702
7708
|
if (callbacks) {
|
|
7709
|
+
let currentModifiedTime;
|
|
7710
|
+
let eventKind = 1 /* Changed */;
|
|
7711
|
+
if (fileTimestamps) {
|
|
7712
|
+
const existingTime = fileTimestamps.get(filePath);
|
|
7713
|
+
if (eventName === "change") {
|
|
7714
|
+
currentModifiedTime = getModifiedTime3(fileName) || missingFileModifiedTime;
|
|
7715
|
+
if (currentModifiedTime.getTime() === existingTime.getTime())
|
|
7716
|
+
return;
|
|
7717
|
+
}
|
|
7718
|
+
currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileName) || missingFileModifiedTime);
|
|
7719
|
+
fileTimestamps.set(filePath, currentModifiedTime);
|
|
7720
|
+
if (existingTime === missingFileModifiedTime)
|
|
7721
|
+
eventKind = 0 /* Created */;
|
|
7722
|
+
else if (currentModifiedTime === missingFileModifiedTime)
|
|
7723
|
+
eventKind = 2 /* Deleted */;
|
|
7724
|
+
}
|
|
7703
7725
|
for (const fileCallback of callbacks) {
|
|
7704
|
-
fileCallback(fileName,
|
|
7726
|
+
fileCallback(fileName, eventKind, currentModifiedTime);
|
|
7705
7727
|
}
|
|
7706
7728
|
}
|
|
7707
7729
|
},
|
|
@@ -8100,7 +8122,7 @@ function createSystemWatchFunctions({
|
|
|
8100
8122
|
);
|
|
8101
8123
|
case 5 /* UseFsEventsOnParentDirectory */:
|
|
8102
8124
|
if (!nonPollingWatchFile) {
|
|
8103
|
-
nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2);
|
|
8125
|
+
nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp);
|
|
8104
8126
|
}
|
|
8105
8127
|
return nonPollingWatchFile(fileName, callback, pollingInterval, getFallbackOptions(options));
|
|
8106
8128
|
default:
|
|
@@ -8275,7 +8297,7 @@ function createSystemWatchFunctions({
|
|
|
8275
8297
|
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
8276
8298
|
}
|
|
8277
8299
|
try {
|
|
8278
|
-
const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
|
|
8300
|
+
const presentWatcher = (entryKind === 1 /* Directory */ || !fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
|
|
8279
8301
|
fileOrDirectory,
|
|
8280
8302
|
recursive,
|
|
8281
8303
|
inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
|
|
@@ -8377,7 +8399,6 @@ var sys = (() => {
|
|
|
8377
8399
|
}
|
|
8378
8400
|
let activeSession;
|
|
8379
8401
|
let profilePath = "./profile.cpuprofile";
|
|
8380
|
-
const Buffer2 = require("buffer").Buffer;
|
|
8381
8402
|
const isMacOs = process.platform === "darwin";
|
|
8382
8403
|
const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
|
|
8383
8404
|
const platform = _os.platform();
|
|
@@ -8495,9 +8516,8 @@ var sys = (() => {
|
|
|
8495
8516
|
handle.setBlocking(true);
|
|
8496
8517
|
}
|
|
8497
8518
|
},
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
base64encode: (input) => bufferFrom(input).toString("base64"),
|
|
8519
|
+
base64decode: (input) => Buffer.from(input, "base64").toString("utf8"),
|
|
8520
|
+
base64encode: (input) => Buffer.from(input).toString("base64"),
|
|
8501
8521
|
require: (baseDir, moduleName) => {
|
|
8502
8522
|
try {
|
|
8503
8523
|
const modulePath = resolveJSModule(moduleName, baseDir, nodeSystem);
|
|
@@ -8586,9 +8606,6 @@ var sys = (() => {
|
|
|
8586
8606
|
return false;
|
|
8587
8607
|
}
|
|
8588
8608
|
}
|
|
8589
|
-
function bufferFrom(input, encoding) {
|
|
8590
|
-
return Buffer2.from && Buffer2.from !== Int8Array.from ? Buffer2.from(input, encoding) : new Buffer2(input, encoding);
|
|
8591
|
-
}
|
|
8592
8609
|
function isFileSystemCaseSensitive() {
|
|
8593
8610
|
if (platform === "win32" || platform === "win64") {
|
|
8594
8611
|
return false;
|
|
@@ -9742,7 +9759,6 @@ var Diagnostics = {
|
|
|
9742
9759
|
_0_and_1_index_signatures_are_incompatible: diag(2330, 1 /* Error */, "_0_and_1_index_signatures_are_incompatible_2330", "'{0}' and '{1}' index signatures are incompatible."),
|
|
9743
9760
|
this_cannot_be_referenced_in_a_module_or_namespace_body: diag(2331, 1 /* Error */, "this_cannot_be_referenced_in_a_module_or_namespace_body_2331", "'this' cannot be referenced in a module or namespace body."),
|
|
9744
9761
|
this_cannot_be_referenced_in_current_location: diag(2332, 1 /* Error */, "this_cannot_be_referenced_in_current_location_2332", "'this' cannot be referenced in current location."),
|
|
9745
|
-
this_cannot_be_referenced_in_constructor_arguments: diag(2333, 1 /* Error */, "this_cannot_be_referenced_in_constructor_arguments_2333", "'this' cannot be referenced in constructor arguments."),
|
|
9746
9762
|
this_cannot_be_referenced_in_a_static_property_initializer: diag(2334, 1 /* Error */, "this_cannot_be_referenced_in_a_static_property_initializer_2334", "'this' cannot be referenced in a static property initializer."),
|
|
9747
9763
|
super_can_only_be_referenced_in_a_derived_class: diag(2335, 1 /* Error */, "super_can_only_be_referenced_in_a_derived_class_2335", "'super' can only be referenced in a derived class."),
|
|
9748
9764
|
super_cannot_be_referenced_in_constructor_arguments: diag(2336, 1 /* Error */, "super_cannot_be_referenced_in_constructor_arguments_2336", "'super' cannot be referenced in constructor arguments."),
|
|
@@ -12028,7 +12044,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12028
12044
|
var tokenValue;
|
|
12029
12045
|
var tokenFlags;
|
|
12030
12046
|
var commentDirectives;
|
|
12031
|
-
var
|
|
12047
|
+
var skipJsDocLeadingAsterisks = 0;
|
|
12032
12048
|
var scriptKind = 0 /* Unknown */;
|
|
12033
12049
|
var jsDocParsingMode = 0 /* ParseAll */;
|
|
12034
12050
|
setText(text, start, length2);
|
|
@@ -12079,7 +12095,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12079
12095
|
setOnError,
|
|
12080
12096
|
resetTokenState,
|
|
12081
12097
|
setTextPos: resetTokenState,
|
|
12082
|
-
|
|
12098
|
+
setSkipJsDocLeadingAsterisks,
|
|
12083
12099
|
tryScan,
|
|
12084
12100
|
lookAhead,
|
|
12085
12101
|
scanRange
|
|
@@ -12795,7 +12811,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12795
12811
|
return pos += 2, token = 43 /* AsteriskAsteriskToken */;
|
|
12796
12812
|
}
|
|
12797
12813
|
pos++;
|
|
12798
|
-
if (
|
|
12814
|
+
if (skipJsDocLeadingAsterisks && !asteriskSeen && tokenFlags & 1 /* PrecedingLineBreak */) {
|
|
12799
12815
|
asteriskSeen = true;
|
|
12800
12816
|
continue;
|
|
12801
12817
|
}
|
|
@@ -13573,8 +13589,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13573
13589
|
tokenValue = void 0;
|
|
13574
13590
|
tokenFlags = 0 /* None */;
|
|
13575
13591
|
}
|
|
13576
|
-
function
|
|
13577
|
-
|
|
13592
|
+
function setSkipJsDocLeadingAsterisks(skip) {
|
|
13593
|
+
skipJsDocLeadingAsterisks += skip ? 1 : -1;
|
|
13578
13594
|
}
|
|
13579
13595
|
}
|
|
13580
13596
|
function codePointAt(s, i) {
|
|
@@ -14777,8 +14793,8 @@ function isExpressionKind(kind) {
|
|
|
14777
14793
|
case 230 /* SpreadElement */:
|
|
14778
14794
|
case 234 /* AsExpression */:
|
|
14779
14795
|
case 232 /* OmittedExpression */:
|
|
14780
|
-
case
|
|
14781
|
-
case
|
|
14796
|
+
case 355 /* CommaListExpression */:
|
|
14797
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
14782
14798
|
case 238 /* SatisfiesExpression */:
|
|
14783
14799
|
return true;
|
|
14784
14800
|
default:
|
|
@@ -14963,7 +14979,7 @@ function isDeclarationStatementKind(kind) {
|
|
|
14963
14979
|
return kind === 262 /* FunctionDeclaration */ || kind === 282 /* MissingDeclaration */ || kind === 263 /* ClassDeclaration */ || kind === 264 /* InterfaceDeclaration */ || kind === 265 /* TypeAliasDeclaration */ || kind === 266 /* EnumDeclaration */ || kind === 267 /* ModuleDeclaration */ || kind === 272 /* ImportDeclaration */ || kind === 271 /* ImportEqualsDeclaration */ || kind === 278 /* ExportDeclaration */ || kind === 277 /* ExportAssignment */ || kind === 270 /* NamespaceExportDeclaration */;
|
|
14964
14980
|
}
|
|
14965
14981
|
function isStatementKindButNotDeclarationKind(kind) {
|
|
14966
|
-
return kind === 252 /* BreakStatement */ || kind === 251 /* ContinueStatement */ || kind === 259 /* DebuggerStatement */ || kind === 246 /* DoStatement */ || kind === 244 /* ExpressionStatement */ || kind === 242 /* EmptyStatement */ || kind === 249 /* ForInStatement */ || kind === 250 /* ForOfStatement */ || kind === 248 /* ForStatement */ || kind === 245 /* IfStatement */ || kind === 256 /* LabeledStatement */ || kind === 253 /* ReturnStatement */ || kind === 255 /* SwitchStatement */ || kind === 257 /* ThrowStatement */ || kind === 258 /* TryStatement */ || kind === 243 /* VariableStatement */ || kind === 247 /* WhileStatement */ || kind === 254 /* WithStatement */ || kind ===
|
|
14982
|
+
return kind === 252 /* BreakStatement */ || kind === 251 /* ContinueStatement */ || kind === 259 /* DebuggerStatement */ || kind === 246 /* DoStatement */ || kind === 244 /* ExpressionStatement */ || kind === 242 /* EmptyStatement */ || kind === 249 /* ForInStatement */ || kind === 250 /* ForOfStatement */ || kind === 248 /* ForStatement */ || kind === 245 /* IfStatement */ || kind === 256 /* LabeledStatement */ || kind === 253 /* ReturnStatement */ || kind === 255 /* SwitchStatement */ || kind === 257 /* ThrowStatement */ || kind === 258 /* TryStatement */ || kind === 243 /* VariableStatement */ || kind === 247 /* WhileStatement */ || kind === 254 /* WithStatement */ || kind === 353 /* NotEmittedStatement */;
|
|
14967
14983
|
}
|
|
14968
14984
|
function isDeclaration(node) {
|
|
14969
14985
|
if (node.kind === 168 /* TypeParameter */) {
|
|
@@ -15024,13 +15040,13 @@ function isCaseOrDefaultClause(node) {
|
|
|
15024
15040
|
return kind === 296 /* CaseClause */ || kind === 297 /* DefaultClause */;
|
|
15025
15041
|
}
|
|
15026
15042
|
function isJSDocNode(node) {
|
|
15027
|
-
return node.kind >= 309 /* FirstJSDocNode */ && node.kind <=
|
|
15043
|
+
return node.kind >= 309 /* FirstJSDocNode */ && node.kind <= 351 /* LastJSDocNode */;
|
|
15028
15044
|
}
|
|
15029
15045
|
function isJSDocCommentContainingNode(node) {
|
|
15030
15046
|
return node.kind === 320 /* JSDoc */ || node.kind === 319 /* JSDocNamepathType */ || node.kind === 321 /* JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || isJSDocTypeLiteral(node) || isJSDocSignature(node);
|
|
15031
15047
|
}
|
|
15032
15048
|
function isJSDocTag(node) {
|
|
15033
|
-
return node.kind >= 327 /* FirstJSDocTagNode */ && node.kind <=
|
|
15049
|
+
return node.kind >= 327 /* FirstJSDocTagNode */ && node.kind <= 351 /* LastJSDocTagNode */;
|
|
15034
15050
|
}
|
|
15035
15051
|
function isSetAccessor(node) {
|
|
15036
15052
|
return node.kind === 178 /* SetAccessor */;
|
|
@@ -15528,7 +15544,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
|
|
|
15528
15544
|
if (includeJsDoc && hasJSDocNodes(node)) {
|
|
15529
15545
|
return getTokenPosOfNode(node.jsDoc[0], sourceFile);
|
|
15530
15546
|
}
|
|
15531
|
-
if (node.kind ===
|
|
15547
|
+
if (node.kind === 352 /* SyntaxList */ && node._children.length > 0) {
|
|
15532
15548
|
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
|
|
15533
15549
|
}
|
|
15534
15550
|
return skipTrivia(
|
|
@@ -17564,6 +17580,7 @@ function tryGetModuleSpecifierFromDeclaration(node) {
|
|
|
17564
17580
|
))) == null ? void 0 : _a.arguments[0];
|
|
17565
17581
|
case 272 /* ImportDeclaration */:
|
|
17566
17582
|
case 278 /* ExportDeclaration */:
|
|
17583
|
+
case 351 /* JSDocImportTag */:
|
|
17567
17584
|
return tryCast(node.moduleSpecifier, isStringLiteralLike);
|
|
17568
17585
|
case 271 /* ImportEqualsDeclaration */:
|
|
17569
17586
|
return tryCast((_b = tryCast(node.moduleReference, isExternalModuleReference)) == null ? void 0 : _b.expression, isStringLiteralLike);
|
|
@@ -17588,6 +17605,7 @@ function tryGetImportFromModuleSpecifier(node) {
|
|
|
17588
17605
|
switch (node.parent.kind) {
|
|
17589
17606
|
case 272 /* ImportDeclaration */:
|
|
17590
17607
|
case 278 /* ExportDeclaration */:
|
|
17608
|
+
case 351 /* JSDocImportTag */:
|
|
17591
17609
|
return node.parent;
|
|
17592
17610
|
case 283 /* ExternalModuleReference */:
|
|
17593
17611
|
return node.parent.parent;
|
|
@@ -17608,6 +17626,7 @@ function getExternalModuleName(node) {
|
|
|
17608
17626
|
switch (node.kind) {
|
|
17609
17627
|
case 272 /* ImportDeclaration */:
|
|
17610
17628
|
case 278 /* ExportDeclaration */:
|
|
17629
|
+
case 351 /* JSDocImportTag */:
|
|
17611
17630
|
return node.moduleSpecifier;
|
|
17612
17631
|
case 271 /* ImportEqualsDeclaration */:
|
|
17613
17632
|
return node.moduleReference.kind === 283 /* ExternalModuleReference */ ? node.moduleReference.expression : void 0;
|
|
@@ -17634,7 +17653,7 @@ function getNamespaceDeclarationNode(node) {
|
|
|
17634
17653
|
}
|
|
17635
17654
|
}
|
|
17636
17655
|
function isDefaultImport(node) {
|
|
17637
|
-
return node.kind === 272 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
|
|
17656
|
+
return (node.kind === 272 /* ImportDeclaration */ || node.kind === 351 /* JSDocImportTag */) && !!node.importClause && !!node.importClause.name;
|
|
17638
17657
|
}
|
|
17639
17658
|
function forEachImportClauseDeclaration(node, action) {
|
|
17640
17659
|
if (node.name) {
|
|
@@ -18524,7 +18543,7 @@ var OperatorPrecedence = /* @__PURE__ */ ((OperatorPrecedence2) => {
|
|
|
18524
18543
|
})(OperatorPrecedence || {});
|
|
18525
18544
|
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
|
|
18526
18545
|
switch (nodeKind) {
|
|
18527
|
-
case
|
|
18546
|
+
case 355 /* CommaListExpression */:
|
|
18528
18547
|
return 0 /* Comma */;
|
|
18529
18548
|
case 230 /* SpreadElement */:
|
|
18530
18549
|
return 1 /* Spread */;
|
|
@@ -20221,7 +20240,7 @@ function getLeftmostExpression(node, stopAtCallExpressions) {
|
|
|
20221
20240
|
case 212 /* ElementAccessExpression */:
|
|
20222
20241
|
case 211 /* PropertyAccessExpression */:
|
|
20223
20242
|
case 235 /* NonNullExpression */:
|
|
20224
|
-
case
|
|
20243
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
20225
20244
|
case 238 /* SatisfiesExpression */:
|
|
20226
20245
|
node = node.expression;
|
|
20227
20246
|
continue;
|
|
@@ -21663,7 +21682,7 @@ function getContainingNodeArray(node) {
|
|
|
21663
21682
|
return parent2.types;
|
|
21664
21683
|
case 189 /* TupleType */:
|
|
21665
21684
|
case 209 /* ArrayLiteralExpression */:
|
|
21666
|
-
case
|
|
21685
|
+
case 355 /* CommaListExpression */:
|
|
21667
21686
|
case 275 /* NamedImports */:
|
|
21668
21687
|
case 279 /* NamedExports */:
|
|
21669
21688
|
return parent2.elements;
|
|
@@ -22790,7 +22809,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
22790
22809
|
updateImportEqualsDeclaration,
|
|
22791
22810
|
createImportDeclaration,
|
|
22792
22811
|
updateImportDeclaration,
|
|
22793
|
-
createImportClause,
|
|
22812
|
+
createImportClause: createImportClause2,
|
|
22794
22813
|
updateImportClause,
|
|
22795
22814
|
createAssertClause,
|
|
22796
22815
|
updateAssertClause,
|
|
@@ -22884,6 +22903,8 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
22884
22903
|
updateJSDocImplementsTag,
|
|
22885
22904
|
createJSDocSeeTag,
|
|
22886
22905
|
updateJSDocSeeTag,
|
|
22906
|
+
createJSDocImportTag,
|
|
22907
|
+
updateJSDocImportTag,
|
|
22887
22908
|
createJSDocNameReference,
|
|
22888
22909
|
updateJSDocNameReference,
|
|
22889
22910
|
createJSDocMemberName,
|
|
@@ -25223,7 +25244,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
25223
25244
|
function updateImportDeclaration(node, modifiers, importClause, moduleSpecifier, attributes) {
|
|
25224
25245
|
return node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.attributes !== attributes ? update(createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes), node) : node;
|
|
25225
25246
|
}
|
|
25226
|
-
function
|
|
25247
|
+
function createImportClause2(isTypeOnly, name, namedBindings) {
|
|
25227
25248
|
const node = createBaseDeclaration(273 /* ImportClause */);
|
|
25228
25249
|
node.isTypeOnly = isTypeOnly;
|
|
25229
25250
|
node.name = name;
|
|
@@ -25236,7 +25257,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
25236
25257
|
return node;
|
|
25237
25258
|
}
|
|
25238
25259
|
function updateImportClause(node, isTypeOnly, name, namedBindings) {
|
|
25239
|
-
return node.isTypeOnly !== isTypeOnly || node.name !== name || node.namedBindings !== namedBindings ? update(
|
|
25260
|
+
return node.isTypeOnly !== isTypeOnly || node.name !== name || node.namedBindings !== namedBindings ? update(createImportClause2(isTypeOnly, name, namedBindings), node) : node;
|
|
25240
25261
|
}
|
|
25241
25262
|
function createAssertClause(elements, multiLine) {
|
|
25242
25263
|
const node = createBaseNode(300 /* AssertClause */);
|
|
@@ -25656,6 +25677,17 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
25656
25677
|
function updateJSDocEnumTag(node, tagName = getDefaultTagName(node), typeExpression, comment) {
|
|
25657
25678
|
return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment ? update(createJSDocEnumTag(tagName, typeExpression, comment), node) : node;
|
|
25658
25679
|
}
|
|
25680
|
+
function createJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comment) {
|
|
25681
|
+
const node = createBaseJSDocTag(351 /* JSDocImportTag */, tagName ?? createIdentifier("import"), comment);
|
|
25682
|
+
node.importClause = importClause;
|
|
25683
|
+
node.moduleSpecifier = moduleSpecifier;
|
|
25684
|
+
node.attributes = attributes;
|
|
25685
|
+
node.comment = comment;
|
|
25686
|
+
return node;
|
|
25687
|
+
}
|
|
25688
|
+
function updateJSDocImportTag(node, tagName, importClause, moduleSpecifier, attributes, comment) {
|
|
25689
|
+
return node.tagName !== tagName || node.comment !== comment || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.attributes !== attributes ? update(createJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comment), node) : node;
|
|
25690
|
+
}
|
|
25659
25691
|
function createJSDocText(text) {
|
|
25660
25692
|
const node = createBaseNode(321 /* JSDocText */);
|
|
25661
25693
|
node.text = text;
|
|
@@ -26053,18 +26085,18 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
26053
26085
|
return node;
|
|
26054
26086
|
}
|
|
26055
26087
|
function createSyntaxList3(children) {
|
|
26056
|
-
const node = createBaseNode(
|
|
26088
|
+
const node = createBaseNode(352 /* SyntaxList */);
|
|
26057
26089
|
node._children = children;
|
|
26058
26090
|
return node;
|
|
26059
26091
|
}
|
|
26060
26092
|
function createNotEmittedStatement(original) {
|
|
26061
|
-
const node = createBaseNode(
|
|
26093
|
+
const node = createBaseNode(353 /* NotEmittedStatement */);
|
|
26062
26094
|
node.original = original;
|
|
26063
26095
|
setTextRange(node, original);
|
|
26064
26096
|
return node;
|
|
26065
26097
|
}
|
|
26066
26098
|
function createPartiallyEmittedExpression(expression, original) {
|
|
26067
|
-
const node = createBaseNode(
|
|
26099
|
+
const node = createBaseNode(354 /* PartiallyEmittedExpression */);
|
|
26068
26100
|
node.expression = expression;
|
|
26069
26101
|
node.original = original;
|
|
26070
26102
|
node.transformFlags |= propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */;
|
|
@@ -26086,7 +26118,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
26086
26118
|
return node;
|
|
26087
26119
|
}
|
|
26088
26120
|
function createCommaListExpression(elements) {
|
|
26089
|
-
const node = createBaseNode(
|
|
26121
|
+
const node = createBaseNode(355 /* CommaListExpression */);
|
|
26090
26122
|
node.elements = createNodeArray(sameFlatMap(elements, flattenCommaElements));
|
|
26091
26123
|
node.transformFlags |= propagateChildrenFlags(node.elements);
|
|
26092
26124
|
return node;
|
|
@@ -26095,7 +26127,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
26095
26127
|
return node.elements !== elements ? update(createCommaListExpression(elements), node) : node;
|
|
26096
26128
|
}
|
|
26097
26129
|
function createSyntheticReferenceExpression(expression, thisArg) {
|
|
26098
|
-
const node = createBaseNode(
|
|
26130
|
+
const node = createBaseNode(356 /* SyntheticReferenceExpression */);
|
|
26099
26131
|
node.expression = expression;
|
|
26100
26132
|
node.thisArg = thisArg;
|
|
26101
26133
|
node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg);
|
|
@@ -26341,7 +26373,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
26341
26373
|
return updateSatisfiesExpression(outerExpression, expression, outerExpression.type);
|
|
26342
26374
|
case 235 /* NonNullExpression */:
|
|
26343
26375
|
return updateNonNullExpression(outerExpression, expression);
|
|
26344
|
-
case
|
|
26376
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
26345
26377
|
return updatePartiallyEmittedExpression(outerExpression, expression);
|
|
26346
26378
|
}
|
|
26347
26379
|
}
|
|
@@ -26751,6 +26783,8 @@ function getDefaultTagNameForKind(kind) {
|
|
|
26751
26783
|
return "augments";
|
|
26752
26784
|
case 329 /* JSDocImplementsTag */:
|
|
26753
26785
|
return "implements";
|
|
26786
|
+
case 351 /* JSDocImportTag */:
|
|
26787
|
+
return "import";
|
|
26754
26788
|
default:
|
|
26755
26789
|
return Debug.fail(`Unsupported kind: ${Debug.formatSyntaxKind(kind)}`);
|
|
26756
26790
|
}
|
|
@@ -26891,7 +26925,7 @@ function getTransformFlagsSubtreeExclusions(kind) {
|
|
|
26891
26925
|
case 216 /* TypeAssertionExpression */:
|
|
26892
26926
|
case 238 /* SatisfiesExpression */:
|
|
26893
26927
|
case 234 /* AsExpression */:
|
|
26894
|
-
case
|
|
26928
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
26895
26929
|
case 217 /* ParenthesizedExpression */:
|
|
26896
26930
|
case 108 /* SuperKeyword */:
|
|
26897
26931
|
return -2147483648 /* OuterExpressionExcludes */;
|
|
@@ -28603,10 +28637,10 @@ function isSyntheticExpression(node) {
|
|
|
28603
28637
|
return node.kind === 237 /* SyntheticExpression */;
|
|
28604
28638
|
}
|
|
28605
28639
|
function isPartiallyEmittedExpression(node) {
|
|
28606
|
-
return node.kind ===
|
|
28640
|
+
return node.kind === 354 /* PartiallyEmittedExpression */;
|
|
28607
28641
|
}
|
|
28608
28642
|
function isCommaListExpression(node) {
|
|
28609
|
-
return node.kind ===
|
|
28643
|
+
return node.kind === 355 /* CommaListExpression */;
|
|
28610
28644
|
}
|
|
28611
28645
|
function isTemplateSpan(node) {
|
|
28612
28646
|
return node.kind === 239 /* TemplateSpan */;
|
|
@@ -28756,10 +28790,10 @@ function isMissingDeclaration(node) {
|
|
|
28756
28790
|
return node.kind === 282 /* MissingDeclaration */;
|
|
28757
28791
|
}
|
|
28758
28792
|
function isNotEmittedStatement(node) {
|
|
28759
|
-
return node.kind ===
|
|
28793
|
+
return node.kind === 353 /* NotEmittedStatement */;
|
|
28760
28794
|
}
|
|
28761
28795
|
function isSyntheticReference(node) {
|
|
28762
|
-
return node.kind ===
|
|
28796
|
+
return node.kind === 356 /* SyntheticReferenceExpression */;
|
|
28763
28797
|
}
|
|
28764
28798
|
function isExternalModuleReference(node) {
|
|
28765
28799
|
return node.kind === 283 /* ExternalModuleReference */;
|
|
@@ -28953,8 +28987,11 @@ function isJSDocSatisfiesTag(node) {
|
|
|
28953
28987
|
function isJSDocThrowsTag(node) {
|
|
28954
28988
|
return node.kind === 349 /* JSDocThrowsTag */;
|
|
28955
28989
|
}
|
|
28990
|
+
function isJSDocImportTag(node) {
|
|
28991
|
+
return node.kind === 351 /* JSDocImportTag */;
|
|
28992
|
+
}
|
|
28956
28993
|
function isSyntaxList(n) {
|
|
28957
|
-
return n.kind ===
|
|
28994
|
+
return n.kind === 352 /* SyntaxList */;
|
|
28958
28995
|
}
|
|
28959
28996
|
|
|
28960
28997
|
// src/compiler/factory/utilities.ts
|
|
@@ -29349,7 +29386,7 @@ function isOuterExpression(node, kinds = 15 /* All */) {
|
|
|
29349
29386
|
return (kinds & 2 /* TypeAssertions */) !== 0;
|
|
29350
29387
|
case 235 /* NonNullExpression */:
|
|
29351
29388
|
return (kinds & 4 /* NonNullAssertions */) !== 0;
|
|
29352
|
-
case
|
|
29389
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
29353
29390
|
return (kinds & 8 /* PartiallyEmittedExpressions */) !== 0;
|
|
29354
29391
|
}
|
|
29355
29392
|
return false;
|
|
@@ -30440,7 +30477,7 @@ var forEachChildTable = {
|
|
|
30440
30477
|
[282 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) {
|
|
30441
30478
|
return visitNodes(cbNode, cbNodes, node.modifiers);
|
|
30442
30479
|
},
|
|
30443
|
-
[
|
|
30480
|
+
[355 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
|
|
30444
30481
|
return visitNodes(cbNode, cbNodes, node.elements);
|
|
30445
30482
|
},
|
|
30446
30483
|
[284 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) {
|
|
@@ -30535,7 +30572,8 @@ var forEachChildTable = {
|
|
|
30535
30572
|
[336 /* JSDocReadonlyTag */]: forEachChildInJSDocTag,
|
|
30536
30573
|
[331 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag,
|
|
30537
30574
|
[337 /* JSDocOverrideTag */]: forEachChildInJSDocTag,
|
|
30538
|
-
[
|
|
30575
|
+
[351 /* JSDocImportTag */]: forEachChildInJSDocImportTag,
|
|
30576
|
+
[354 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
|
|
30539
30577
|
};
|
|
30540
30578
|
function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) {
|
|
30541
30579
|
return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type);
|
|
@@ -30586,6 +30624,9 @@ function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) {
|
|
|
30586
30624
|
function forEachChildInJSDocTag(node, cbNode, cbNodes) {
|
|
30587
30625
|
return visitNode2(cbNode, node.tagName) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment));
|
|
30588
30626
|
}
|
|
30627
|
+
function forEachChildInJSDocImportTag(node, cbNode, cbNodes) {
|
|
30628
|
+
return visitNode2(cbNode, node.tagName) || visitNode2(cbNode, node.importClause) || visitNode2(cbNode, node.moduleSpecifier) || visitNode2(cbNode, node.attributes) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment));
|
|
30629
|
+
}
|
|
30589
30630
|
function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) {
|
|
30590
30631
|
return visitNode2(cbNode, node.expression);
|
|
30591
30632
|
}
|
|
@@ -32593,7 +32634,7 @@ var Parser;
|
|
|
32593
32634
|
);
|
|
32594
32635
|
}
|
|
32595
32636
|
function parseJSDocType() {
|
|
32596
|
-
scanner2.
|
|
32637
|
+
scanner2.setSkipJsDocLeadingAsterisks(true);
|
|
32597
32638
|
const pos = getNodePos();
|
|
32598
32639
|
if (parseOptional(144 /* ModuleKeyword */)) {
|
|
32599
32640
|
const moduleTag = factory2.createJSDocNamepathType(
|
|
@@ -32612,12 +32653,12 @@ var Parser;
|
|
|
32612
32653
|
nextTokenJSDoc();
|
|
32613
32654
|
}
|
|
32614
32655
|
}
|
|
32615
|
-
scanner2.
|
|
32656
|
+
scanner2.setSkipJsDocLeadingAsterisks(false);
|
|
32616
32657
|
return finishNode(moduleTag, pos);
|
|
32617
32658
|
}
|
|
32618
32659
|
const hasDotDotDot = parseOptional(26 /* DotDotDotToken */);
|
|
32619
32660
|
let type = parseTypeOrTypePredicate();
|
|
32620
|
-
scanner2.
|
|
32661
|
+
scanner2.setSkipJsDocLeadingAsterisks(false);
|
|
32621
32662
|
if (hasDotDotDot) {
|
|
32622
32663
|
type = finishNode(factory2.createJSDocVariadicType(type), pos);
|
|
32623
32664
|
}
|
|
@@ -36180,22 +36221,28 @@ var Parser;
|
|
|
36180
36221
|
if (identifier && !tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration()) {
|
|
36181
36222
|
return parseImportEqualsDeclaration(pos, hasJSDoc, modifiers, identifier, isTypeOnly);
|
|
36182
36223
|
}
|
|
36224
|
+
const importClause = tryParseImportClause(identifier, afterImportPos, isTypeOnly);
|
|
36225
|
+
const moduleSpecifier = parseModuleSpecifier();
|
|
36226
|
+
const attributes = tryParseImportAttributes();
|
|
36227
|
+
parseSemicolon();
|
|
36228
|
+
const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes);
|
|
36229
|
+
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
36230
|
+
}
|
|
36231
|
+
function tryParseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks = false) {
|
|
36183
36232
|
let importClause;
|
|
36184
36233
|
if (identifier || // import id
|
|
36185
36234
|
token() === 42 /* AsteriskToken */ || // import *
|
|
36186
36235
|
token() === 19 /* OpenBraceToken */) {
|
|
36187
|
-
importClause = parseImportClause(identifier,
|
|
36236
|
+
importClause = parseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks);
|
|
36188
36237
|
parseExpected(161 /* FromKeyword */);
|
|
36189
36238
|
}
|
|
36190
|
-
|
|
36239
|
+
return importClause;
|
|
36240
|
+
}
|
|
36241
|
+
function tryParseImportAttributes() {
|
|
36191
36242
|
const currentToken2 = token();
|
|
36192
|
-
let attributes;
|
|
36193
36243
|
if ((currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */) && !scanner2.hasPrecedingLineBreak()) {
|
|
36194
|
-
|
|
36244
|
+
return parseImportAttributes(currentToken2);
|
|
36195
36245
|
}
|
|
36196
|
-
parseSemicolon();
|
|
36197
|
-
const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes);
|
|
36198
|
-
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
36199
36246
|
}
|
|
36200
36247
|
function parseImportAttribute() {
|
|
36201
36248
|
const pos = getNodePos();
|
|
@@ -36262,10 +36309,14 @@ var Parser;
|
|
|
36262
36309
|
const finished = withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
36263
36310
|
return finished;
|
|
36264
36311
|
}
|
|
36265
|
-
function parseImportClause(identifier, pos, isTypeOnly) {
|
|
36312
|
+
function parseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks) {
|
|
36266
36313
|
let namedBindings;
|
|
36267
36314
|
if (!identifier || parseOptional(28 /* CommaToken */)) {
|
|
36315
|
+
if (skipJsDocLeadingAsterisks)
|
|
36316
|
+
scanner2.setSkipJsDocLeadingAsterisks(true);
|
|
36268
36317
|
namedBindings = token() === 42 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(275 /* NamedImports */);
|
|
36318
|
+
if (skipJsDocLeadingAsterisks)
|
|
36319
|
+
scanner2.setSkipJsDocLeadingAsterisks(false);
|
|
36269
36320
|
}
|
|
36270
36321
|
return finishNode(factory2.createImportClause(isTypeOnly, identifier, namedBindings), pos);
|
|
36271
36322
|
}
|
|
@@ -36836,6 +36887,9 @@ var Parser;
|
|
|
36836
36887
|
case "throws":
|
|
36837
36888
|
tag = parseThrowsTag(start2, tagName, margin, indentText);
|
|
36838
36889
|
break;
|
|
36890
|
+
case "import":
|
|
36891
|
+
tag = parseImportTag(start2, tagName, margin, indentText);
|
|
36892
|
+
break;
|
|
36839
36893
|
default:
|
|
36840
36894
|
tag = parseUnknownTag(start2, tagName, margin, indentText);
|
|
36841
36895
|
break;
|
|
@@ -37155,13 +37209,32 @@ var Parser;
|
|
|
37155
37209
|
const comments2 = margin !== void 0 && indentText !== void 0 ? parseTrailingTagComments(start2, getNodePos(), margin, indentText) : void 0;
|
|
37156
37210
|
return finishNode(factory2.createJSDocSatisfiesTag(tagName, typeExpression, comments2), start2);
|
|
37157
37211
|
}
|
|
37212
|
+
function parseImportTag(start2, tagName, margin, indentText) {
|
|
37213
|
+
const afterImportTagPos = scanner2.getTokenFullStart();
|
|
37214
|
+
let identifier;
|
|
37215
|
+
if (isIdentifier2()) {
|
|
37216
|
+
identifier = parseIdentifier();
|
|
37217
|
+
}
|
|
37218
|
+
const importClause = tryParseImportClause(
|
|
37219
|
+
identifier,
|
|
37220
|
+
afterImportTagPos,
|
|
37221
|
+
/*isTypeOnly*/
|
|
37222
|
+
true,
|
|
37223
|
+
/*skipJsDocLeadingAsterisks*/
|
|
37224
|
+
true
|
|
37225
|
+
);
|
|
37226
|
+
const moduleSpecifier = parseModuleSpecifier();
|
|
37227
|
+
const attributes = tryParseImportAttributes();
|
|
37228
|
+
const comments2 = margin !== void 0 && indentText !== void 0 ? parseTrailingTagComments(start2, getNodePos(), margin, indentText) : void 0;
|
|
37229
|
+
return finishNode(factory2.createJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comments2), start2);
|
|
37230
|
+
}
|
|
37158
37231
|
function parseExpressionWithTypeArgumentsForAugments() {
|
|
37159
37232
|
const usedBrace = parseOptional(19 /* OpenBraceToken */);
|
|
37160
37233
|
const pos = getNodePos();
|
|
37161
37234
|
const expression = parsePropertyAccessEntityNameExpression();
|
|
37162
|
-
scanner2.
|
|
37235
|
+
scanner2.setSkipJsDocLeadingAsterisks(true);
|
|
37163
37236
|
const typeArguments = tryParseTypeArguments();
|
|
37164
|
-
scanner2.
|
|
37237
|
+
scanner2.setSkipJsDocLeadingAsterisks(false);
|
|
37165
37238
|
const node = factory2.createExpressionWithTypeArguments(expression, typeArguments);
|
|
37166
37239
|
const res = finishNode(node, pos);
|
|
37167
37240
|
if (usedBrace) {
|
|
@@ -44095,6 +44168,7 @@ function createBinder() {
|
|
|
44095
44168
|
var lastContainer;
|
|
44096
44169
|
var delayedTypeAliases;
|
|
44097
44170
|
var seenThisKeyword;
|
|
44171
|
+
var jsDocImports;
|
|
44098
44172
|
var currentFlow;
|
|
44099
44173
|
var currentBreakTarget;
|
|
44100
44174
|
var currentContinueTarget;
|
|
@@ -44142,6 +44216,7 @@ function createBinder() {
|
|
|
44142
44216
|
file.symbolCount = symbolCount;
|
|
44143
44217
|
file.classifiableNames = classifiableNames;
|
|
44144
44218
|
delayedBindJSDocTypedefTag();
|
|
44219
|
+
bindJSDocImports();
|
|
44145
44220
|
}
|
|
44146
44221
|
file = void 0;
|
|
44147
44222
|
options = void 0;
|
|
@@ -44152,6 +44227,7 @@ function createBinder() {
|
|
|
44152
44227
|
blockScopeContainer = void 0;
|
|
44153
44228
|
lastContainer = void 0;
|
|
44154
44229
|
delayedTypeAliases = void 0;
|
|
44230
|
+
jsDocImports = void 0;
|
|
44155
44231
|
seenThisKeyword = false;
|
|
44156
44232
|
currentFlow = void 0;
|
|
44157
44233
|
currentBreakTarget = void 0;
|
|
@@ -44586,6 +44662,9 @@ function createBinder() {
|
|
|
44586
44662
|
case 340 /* JSDocEnumTag */:
|
|
44587
44663
|
bindJSDocTypeAlias(node);
|
|
44588
44664
|
break;
|
|
44665
|
+
case 351 /* JSDocImportTag */:
|
|
44666
|
+
bindJSDocImportTag(node);
|
|
44667
|
+
break;
|
|
44589
44668
|
case 307 /* SourceFile */: {
|
|
44590
44669
|
bindEachFunctionsFirst(node.statements);
|
|
44591
44670
|
bind(node.endOfFileToken);
|
|
@@ -45318,6 +45397,12 @@ function createBinder() {
|
|
|
45318
45397
|
addDeclarationToSymbol(host.symbol, host, 32 /* Class */);
|
|
45319
45398
|
}
|
|
45320
45399
|
}
|
|
45400
|
+
function bindJSDocImportTag(node) {
|
|
45401
|
+
bind(node.tagName);
|
|
45402
|
+
if (typeof node.comment !== "string") {
|
|
45403
|
+
bindEach(node.comment);
|
|
45404
|
+
}
|
|
45405
|
+
}
|
|
45321
45406
|
function bindOptionalExpression(node, trueTarget, falseTarget) {
|
|
45322
45407
|
doWithConditionalBranches(bind, node, trueTarget, falseTarget);
|
|
45323
45408
|
if (!isOptionalChain(node) || isOutermostOptionalChain(node)) {
|
|
@@ -45634,6 +45719,31 @@ function createBinder() {
|
|
|
45634
45719
|
parent2 = saveParent;
|
|
45635
45720
|
currentFlow = saveCurrentFlow;
|
|
45636
45721
|
}
|
|
45722
|
+
function bindJSDocImports() {
|
|
45723
|
+
if (jsDocImports === void 0) {
|
|
45724
|
+
return;
|
|
45725
|
+
}
|
|
45726
|
+
const saveContainer = container;
|
|
45727
|
+
const saveLastContainer = lastContainer;
|
|
45728
|
+
const saveBlockScopeContainer = blockScopeContainer;
|
|
45729
|
+
const saveParent = parent2;
|
|
45730
|
+
const saveCurrentFlow = currentFlow;
|
|
45731
|
+
for (const jsDocImportTag of jsDocImports) {
|
|
45732
|
+
const host = getJSDocHost(jsDocImportTag);
|
|
45733
|
+
const enclosingContainer = host ? getEnclosingContainer(host) : void 0;
|
|
45734
|
+
const enclosingBlockScopeContainer = host ? getEnclosingBlockScopeContainer(host) : void 0;
|
|
45735
|
+
container = enclosingContainer || file;
|
|
45736
|
+
blockScopeContainer = enclosingBlockScopeContainer || file;
|
|
45737
|
+
currentFlow = initFlowNode({ flags: 2 /* Start */ });
|
|
45738
|
+
parent2 = jsDocImportTag;
|
|
45739
|
+
bind(jsDocImportTag.importClause);
|
|
45740
|
+
}
|
|
45741
|
+
container = saveContainer;
|
|
45742
|
+
lastContainer = saveLastContainer;
|
|
45743
|
+
blockScopeContainer = saveBlockScopeContainer;
|
|
45744
|
+
parent2 = saveParent;
|
|
45745
|
+
currentFlow = saveCurrentFlow;
|
|
45746
|
+
}
|
|
45637
45747
|
function checkContextualIdentifier(node) {
|
|
45638
45748
|
if (!file.parseDiagnostics.length && !(node.flags & 33554432 /* Ambient */) && !(node.flags & 16777216 /* JSDoc */) && !isIdentifierName(node)) {
|
|
45639
45749
|
const originalKeywordKind = identifierToKeywordKind(node);
|
|
@@ -46058,6 +46168,8 @@ function createBinder() {
|
|
|
46058
46168
|
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
|
|
46059
46169
|
case 339 /* JSDocOverloadTag */:
|
|
46060
46170
|
return bind(node.typeExpression);
|
|
46171
|
+
case 351 /* JSDocImportTag */:
|
|
46172
|
+
return (jsDocImports || (jsDocImports = [])).push(node);
|
|
46061
46173
|
}
|
|
46062
46174
|
}
|
|
46063
46175
|
function bindPropertyWorker(node) {
|
|
@@ -49430,11 +49542,11 @@ function createTypeChecker(host) {
|
|
|
49430
49542
|
} else if (declaration.kind === 260 /* VariableDeclaration */) {
|
|
49431
49543
|
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
|
|
49432
49544
|
} else if (isClassLike(declaration)) {
|
|
49433
|
-
const container = findAncestor(usage, (n) => n === declaration ? "quit" : isComputedPropertyName(n) ? n.parent.parent === declaration : isDecorator(n) && (n.parent === declaration || isMethodDeclaration(n.parent) && n.parent.parent === declaration || isGetOrSetAccessorDeclaration(n.parent) && n.parent.parent === declaration || isPropertyDeclaration(n.parent) && n.parent.parent === declaration || isParameter(n.parent) && n.parent.parent.parent === declaration));
|
|
49545
|
+
const container = findAncestor(usage, (n) => n === declaration ? "quit" : isComputedPropertyName(n) ? n.parent.parent === declaration : !legacyDecorators && isDecorator(n) && (n.parent === declaration || isMethodDeclaration(n.parent) && n.parent.parent === declaration || isGetOrSetAccessorDeclaration(n.parent) && n.parent.parent === declaration || isPropertyDeclaration(n.parent) && n.parent.parent === declaration || isParameter(n.parent) && n.parent.parent.parent === declaration));
|
|
49434
49546
|
if (!container) {
|
|
49435
49547
|
return true;
|
|
49436
49548
|
}
|
|
49437
|
-
if (isDecorator(container)) {
|
|
49549
|
+
if (!legacyDecorators && isDecorator(container)) {
|
|
49438
49550
|
return !!findAncestor(usage, (n) => n === container ? "quit" : isFunctionLike(n) && !getImmediatelyInvokedFunctionExpression(n));
|
|
49439
49551
|
}
|
|
49440
49552
|
return false;
|
|
@@ -49786,6 +49898,7 @@ function createTypeChecker(host) {
|
|
|
49786
49898
|
case 346 /* JSDocTypedefTag */:
|
|
49787
49899
|
case 338 /* JSDocCallbackTag */:
|
|
49788
49900
|
case 340 /* JSDocEnumTag */:
|
|
49901
|
+
case 351 /* JSDocImportTag */:
|
|
49789
49902
|
const root = getJSDocRoot(location);
|
|
49790
49903
|
if (root) {
|
|
49791
49904
|
location = root.parent;
|
|
@@ -51278,7 +51391,7 @@ function createTypeChecker(host) {
|
|
|
51278
51391
|
return ambientModule;
|
|
51279
51392
|
}
|
|
51280
51393
|
const currentSourceFile = getSourceFileOfNode(location);
|
|
51281
|
-
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isVariableDeclaration(location) && location.initializer && isRequireCall(
|
|
51394
|
+
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isInJSFile(location) && isJSDocImportTag(location) ? location.moduleSpecifier : void 0) || (isVariableDeclaration(location) && location.initializer && isRequireCall(
|
|
51282
51395
|
location.initializer,
|
|
51283
51396
|
/*requireStringLiteralLikeArgument*/
|
|
51284
51397
|
true
|
|
@@ -55654,19 +55767,20 @@ function createTypeChecker(host) {
|
|
|
55654
55767
|
case 273 /* ImportClause */: {
|
|
55655
55768
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
55656
55769
|
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
55770
|
+
const attributes = isImportDeclaration(node.parent) ? node.parent.attributes : void 0;
|
|
55771
|
+
const isTypeOnly = isJSDocImportTag(node.parent);
|
|
55657
55772
|
addResult(
|
|
55658
55773
|
factory.createImportDeclaration(
|
|
55659
55774
|
/*modifiers*/
|
|
55660
55775
|
void 0,
|
|
55661
55776
|
factory.createImportClause(
|
|
55662
|
-
|
|
55663
|
-
false,
|
|
55777
|
+
isTypeOnly,
|
|
55664
55778
|
factory.createIdentifier(localName),
|
|
55665
55779
|
/*namedBindings*/
|
|
55666
55780
|
void 0
|
|
55667
55781
|
),
|
|
55668
55782
|
specifier2,
|
|
55669
|
-
|
|
55783
|
+
attributes
|
|
55670
55784
|
),
|
|
55671
55785
|
0 /* None */
|
|
55672
55786
|
);
|
|
@@ -55675,13 +55789,13 @@ function createTypeChecker(host) {
|
|
|
55675
55789
|
case 274 /* NamespaceImport */: {
|
|
55676
55790
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
55677
55791
|
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
55792
|
+
const isTypeOnly = isJSDocImportTag(node.parent.parent);
|
|
55678
55793
|
addResult(
|
|
55679
55794
|
factory.createImportDeclaration(
|
|
55680
55795
|
/*modifiers*/
|
|
55681
55796
|
void 0,
|
|
55682
55797
|
factory.createImportClause(
|
|
55683
|
-
|
|
55684
|
-
false,
|
|
55798
|
+
isTypeOnly,
|
|
55685
55799
|
/*name*/
|
|
55686
55800
|
void 0,
|
|
55687
55801
|
factory.createNamespaceImport(factory.createIdentifier(localName))
|
|
@@ -55709,13 +55823,13 @@ function createTypeChecker(host) {
|
|
|
55709
55823
|
case 276 /* ImportSpecifier */: {
|
|
55710
55824
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
55711
55825
|
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
55826
|
+
const isTypeOnly = isJSDocImportTag(node.parent.parent.parent);
|
|
55712
55827
|
addResult(
|
|
55713
55828
|
factory.createImportDeclaration(
|
|
55714
55829
|
/*modifiers*/
|
|
55715
55830
|
void 0,
|
|
55716
55831
|
factory.createImportClause(
|
|
55717
|
-
|
|
55718
|
-
false,
|
|
55832
|
+
isTypeOnly,
|
|
55719
55833
|
/*name*/
|
|
55720
55834
|
void 0,
|
|
55721
55835
|
factory.createNamedImports([
|
|
@@ -58395,7 +58509,7 @@ function createTypeChecker(host) {
|
|
|
58395
58509
|
if (!lateSymbol)
|
|
58396
58510
|
lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */));
|
|
58397
58511
|
const earlySymbol = earlySymbols && earlySymbols.get(memberName);
|
|
58398
|
-
if (!(parent2.flags & 32 /* Class */) &&
|
|
58512
|
+
if (!(parent2.flags & 32 /* Class */) && lateSymbol.flags & getExcludedSymbolFlags(symbolFlags)) {
|
|
58399
58513
|
const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations;
|
|
58400
58514
|
const name = !(type.flags & 8192 /* UniqueESSymbol */) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName);
|
|
58401
58515
|
forEach(declarations, (declaration) => error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name));
|
|
@@ -69921,13 +70035,20 @@ function createTypeChecker(host) {
|
|
|
69921
70035
|
return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
|
|
69922
70036
|
case 166 /* QualifiedName */:
|
|
69923
70037
|
const left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer);
|
|
69924
|
-
return left && left
|
|
70038
|
+
return left && `${left}.${node.right.escapedText}`;
|
|
69925
70039
|
case 211 /* PropertyAccessExpression */:
|
|
69926
70040
|
case 212 /* ElementAccessExpression */:
|
|
69927
70041
|
const propName = getAccessedPropertyName(node);
|
|
69928
70042
|
if (propName !== void 0) {
|
|
69929
70043
|
const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
|
|
69930
|
-
return key && key
|
|
70044
|
+
return key && `${key}.${propName}`;
|
|
70045
|
+
}
|
|
70046
|
+
if (isElementAccessExpression(node) && isIdentifier(node.argumentExpression)) {
|
|
70047
|
+
const symbol = getResolvedSymbol(node.argumentExpression);
|
|
70048
|
+
if (isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol)) {
|
|
70049
|
+
const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
|
|
70050
|
+
return key && `${key}.@${getSymbolId(symbol)}`;
|
|
70051
|
+
}
|
|
69931
70052
|
}
|
|
69932
70053
|
break;
|
|
69933
70054
|
case 206 /* ObjectBindingPattern */:
|
|
@@ -69964,8 +70085,19 @@ function createTypeChecker(host) {
|
|
|
69964
70085
|
case 211 /* PropertyAccessExpression */:
|
|
69965
70086
|
case 212 /* ElementAccessExpression */:
|
|
69966
70087
|
const sourcePropertyName = getAccessedPropertyName(source);
|
|
69967
|
-
|
|
69968
|
-
|
|
70088
|
+
if (sourcePropertyName !== void 0) {
|
|
70089
|
+
const targetPropertyName = isAccessExpression(target) ? getAccessedPropertyName(target) : void 0;
|
|
70090
|
+
if (targetPropertyName !== void 0) {
|
|
70091
|
+
return targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression);
|
|
70092
|
+
}
|
|
70093
|
+
}
|
|
70094
|
+
if (isElementAccessExpression(source) && isElementAccessExpression(target) && isIdentifier(source.argumentExpression) && isIdentifier(target.argumentExpression)) {
|
|
70095
|
+
const symbol = getResolvedSymbol(source.argumentExpression);
|
|
70096
|
+
if (symbol === getResolvedSymbol(target.argumentExpression) && (isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol))) {
|
|
70097
|
+
return isMatchingReference(source.expression, target.expression);
|
|
70098
|
+
}
|
|
70099
|
+
}
|
|
70100
|
+
break;
|
|
69969
70101
|
case 166 /* QualifiedName */:
|
|
69970
70102
|
return isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression);
|
|
69971
70103
|
case 226 /* BinaryExpression */:
|
|
@@ -72509,11 +72641,6 @@ function createTypeChecker(host) {
|
|
|
72509
72641
|
case 266 /* EnumDeclaration */:
|
|
72510
72642
|
error2(node, Diagnostics.this_cannot_be_referenced_in_current_location);
|
|
72511
72643
|
break;
|
|
72512
|
-
case 176 /* Constructor */:
|
|
72513
|
-
if (isInConstructorArgumentInitializer(node, container)) {
|
|
72514
|
-
error2(node, Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
|
|
72515
|
-
}
|
|
72516
|
-
break;
|
|
72517
72644
|
}
|
|
72518
72645
|
}
|
|
72519
72646
|
if (!isNodeInTypeQuery && capturedByArrowFunction && languageVersion < 2 /* ES2015 */) {
|
|
@@ -82601,6 +82728,9 @@ function createTypeChecker(host) {
|
|
|
82601
82728
|
error2(node.tagName, Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
|
|
82602
82729
|
}
|
|
82603
82730
|
}
|
|
82731
|
+
function checkJSDocImportTag(node) {
|
|
82732
|
+
checkImportAttributes(node);
|
|
82733
|
+
}
|
|
82604
82734
|
function checkJSDocImplementsTag(node) {
|
|
82605
82735
|
const classLike = getEffectiveJSDocHost(node);
|
|
82606
82736
|
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
|
@@ -85868,7 +85998,8 @@ function createTypeChecker(host) {
|
|
|
85868
85998
|
const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
|
|
85869
85999
|
return grammarErrorOnNode(node, message);
|
|
85870
86000
|
}
|
|
85871
|
-
|
|
86001
|
+
const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly);
|
|
86002
|
+
if (isTypeOnly) {
|
|
85872
86003
|
return grammarErrorOnNode(node, isImportAttributes2 ? Diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports : Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports);
|
|
85873
86004
|
}
|
|
85874
86005
|
if (override) {
|
|
@@ -86319,6 +86450,8 @@ function createTypeChecker(host) {
|
|
|
86319
86450
|
return checkJSDocSatisfiesTag(node);
|
|
86320
86451
|
case 343 /* JSDocThisTag */:
|
|
86321
86452
|
return checkJSDocThisTag(node);
|
|
86453
|
+
case 351 /* JSDocImportTag */:
|
|
86454
|
+
return checkJSDocImportTag(node);
|
|
86322
86455
|
case 199 /* IndexedAccessType */:
|
|
86323
86456
|
return checkIndexedAccessType(node);
|
|
86324
86457
|
case 200 /* MappedType */:
|
|
@@ -87122,7 +87255,7 @@ function createTypeChecker(host) {
|
|
|
87122
87255
|
return void 0;
|
|
87123
87256
|
case 11 /* StringLiteral */:
|
|
87124
87257
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
87125
|
-
if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 272 /* ImportDeclaration */ || node.parent.kind === 278 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || (isInJSFile(node) && isRequireCall(
|
|
87258
|
+
if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 272 /* ImportDeclaration */ || node.parent.kind === 278 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || isInJSFile(node) && isJSDocImportTag(node.parent) && node.parent.moduleSpecifier === node || (isInJSFile(node) && isRequireCall(
|
|
87126
87259
|
node.parent,
|
|
87127
87260
|
/*requireStringLiteralLikeArgument*/
|
|
87128
87261
|
false
|
|
@@ -91263,13 +91396,13 @@ var visitEachChildTable = {
|
|
|
91263
91396
|
);
|
|
91264
91397
|
},
|
|
91265
91398
|
// Transformation nodes
|
|
91266
|
-
[
|
|
91399
|
+
[354 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
|
|
91267
91400
|
return context.factory.updatePartiallyEmittedExpression(
|
|
91268
91401
|
node,
|
|
91269
91402
|
Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
|
|
91270
91403
|
);
|
|
91271
91404
|
},
|
|
91272
|
-
[
|
|
91405
|
+
[355 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
|
|
91273
91406
|
return context.factory.updateCommaListExpression(
|
|
91274
91407
|
node,
|
|
91275
91408
|
nodesVisitor(node.elements, visitor, isExpression)
|
|
@@ -95113,7 +95246,7 @@ function transformClassFields(context) {
|
|
|
95113
95246
|
/*discarded*/
|
|
95114
95247
|
true
|
|
95115
95248
|
);
|
|
95116
|
-
case
|
|
95249
|
+
case 355 /* CommaListExpression */:
|
|
95117
95250
|
return visitCommaListExpression(
|
|
95118
95251
|
node,
|
|
95119
95252
|
/*discarded*/
|
|
@@ -98206,7 +98339,7 @@ function transformESDecorators(context) {
|
|
|
98206
98339
|
return visitForStatement(node);
|
|
98207
98340
|
case 244 /* ExpressionStatement */:
|
|
98208
98341
|
return visitExpressionStatement(node);
|
|
98209
|
-
case
|
|
98342
|
+
case 355 /* CommaListExpression */:
|
|
98210
98343
|
return visitCommaListExpression(
|
|
98211
98344
|
node,
|
|
98212
98345
|
/*discarded*/
|
|
@@ -98218,7 +98351,7 @@ function transformESDecorators(context) {
|
|
|
98218
98351
|
/*discarded*/
|
|
98219
98352
|
false
|
|
98220
98353
|
);
|
|
98221
|
-
case
|
|
98354
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
98222
98355
|
return visitPartiallyEmittedExpression(
|
|
98223
98356
|
node,
|
|
98224
98357
|
/*discarded*/
|
|
@@ -98304,7 +98437,7 @@ function transformESDecorators(context) {
|
|
|
98304
98437
|
/*discarded*/
|
|
98305
98438
|
true
|
|
98306
98439
|
);
|
|
98307
|
-
case
|
|
98440
|
+
case 355 /* CommaListExpression */:
|
|
98308
98441
|
return visitCommaListExpression(
|
|
98309
98442
|
node,
|
|
98310
98443
|
/*discarded*/
|
|
@@ -100895,7 +101028,7 @@ function transformES2018(context) {
|
|
|
100895
101028
|
return visitObjectLiteralExpression(node);
|
|
100896
101029
|
case 226 /* BinaryExpression */:
|
|
100897
101030
|
return visitBinaryExpression(node, expressionResultIsUnused2);
|
|
100898
|
-
case
|
|
101031
|
+
case 355 /* CommaListExpression */:
|
|
100899
101032
|
return visitCommaListExpression(node, expressionResultIsUnused2);
|
|
100900
101033
|
case 299 /* CatchClause */:
|
|
100901
101034
|
return visitCatchClause(node);
|
|
@@ -104118,7 +104251,7 @@ function transformES2015(context) {
|
|
|
104118
104251
|
return visitParenthesizedExpression(node, expressionResultIsUnused2);
|
|
104119
104252
|
case 226 /* BinaryExpression */:
|
|
104120
104253
|
return visitBinaryExpression(node, expressionResultIsUnused2);
|
|
104121
|
-
case
|
|
104254
|
+
case 355 /* CommaListExpression */:
|
|
104122
104255
|
return visitCommaListExpression(node, expressionResultIsUnused2);
|
|
104123
104256
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
104124
104257
|
case 16 /* TemplateHead */:
|
|
@@ -107413,7 +107546,7 @@ function transformGenerators(context) {
|
|
|
107413
107546
|
switch (node.kind) {
|
|
107414
107547
|
case 226 /* BinaryExpression */:
|
|
107415
107548
|
return visitBinaryExpression(node);
|
|
107416
|
-
case
|
|
107549
|
+
case 355 /* CommaListExpression */:
|
|
107417
107550
|
return visitCommaListExpression(node);
|
|
107418
107551
|
case 227 /* ConditionalExpression */:
|
|
107419
107552
|
return visitConditionalExpression(node);
|
|
@@ -109803,7 +109936,7 @@ function transformModule(context) {
|
|
|
109803
109936
|
return visitExpressionStatement(node);
|
|
109804
109937
|
case 217 /* ParenthesizedExpression */:
|
|
109805
109938
|
return visitParenthesizedExpression(node, valueIsDiscarded);
|
|
109806
|
-
case
|
|
109939
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
109807
109940
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
109808
109941
|
case 213 /* CallExpression */:
|
|
109809
109942
|
if (isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) {
|
|
@@ -112196,7 +112329,7 @@ function transformSystemModule(context) {
|
|
|
112196
112329
|
return visitExpressionStatement(node);
|
|
112197
112330
|
case 217 /* ParenthesizedExpression */:
|
|
112198
112331
|
return visitParenthesizedExpression(node, valueIsDiscarded);
|
|
112199
|
-
case
|
|
112332
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
112200
112333
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
112201
112334
|
case 226 /* BinaryExpression */:
|
|
112202
112335
|
if (isDestructuringAssignment(node)) {
|
|
@@ -114209,6 +114342,8 @@ function transformDeclarations(context) {
|
|
|
114209
114342
|
}
|
|
114210
114343
|
if (isDeclaration(input) && isDeclarationAndNotVisible(input))
|
|
114211
114344
|
return;
|
|
114345
|
+
if (isJSDocImportTag(input))
|
|
114346
|
+
return;
|
|
114212
114347
|
if (isFunctionLike(input) && resolver.isImplementationOfOverload(input))
|
|
114213
114348
|
return;
|
|
114214
114349
|
let previousEnclosingDeclaration;
|
|
@@ -114856,7 +114991,7 @@ function noEmitNotification(hint, node, callback) {
|
|
|
114856
114991
|
}
|
|
114857
114992
|
function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) {
|
|
114858
114993
|
var _a, _b;
|
|
114859
|
-
const enabledSyntaxKindFeatures = new Array(
|
|
114994
|
+
const enabledSyntaxKindFeatures = new Array(357 /* Count */);
|
|
114860
114995
|
let lexicalEnvironmentVariableDeclarations;
|
|
114861
114996
|
let lexicalEnvironmentFunctionDeclarations;
|
|
114862
114997
|
let lexicalEnvironmentStatements;
|
|
@@ -116435,7 +116570,9 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
116435
116570
|
return emitJSDocTypedefTag(node);
|
|
116436
116571
|
case 347 /* JSDocSeeTag */:
|
|
116437
116572
|
return emitJSDocSeeTag(node);
|
|
116438
|
-
case
|
|
116573
|
+
case 351 /* JSDocImportTag */:
|
|
116574
|
+
return emitJSDocImportTag(node);
|
|
116575
|
+
case 353 /* NotEmittedStatement */:
|
|
116439
116576
|
return;
|
|
116440
116577
|
}
|
|
116441
116578
|
if (isExpression(node)) {
|
|
@@ -116536,15 +116673,15 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
116536
116673
|
return emitJsxSelfClosingElement(node);
|
|
116537
116674
|
case 288 /* JsxFragment */:
|
|
116538
116675
|
return emitJsxFragment(node);
|
|
116539
|
-
case
|
|
116676
|
+
case 352 /* SyntaxList */:
|
|
116540
116677
|
return Debug.fail("SyntaxList should not be printed");
|
|
116541
|
-
case
|
|
116678
|
+
case 353 /* NotEmittedStatement */:
|
|
116542
116679
|
return;
|
|
116543
|
-
case
|
|
116680
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
116544
116681
|
return emitPartiallyEmittedExpression(node);
|
|
116545
|
-
case
|
|
116682
|
+
case 355 /* CommaListExpression */:
|
|
116546
116683
|
return emitCommaList(node);
|
|
116547
|
-
case
|
|
116684
|
+
case 356 /* SyntheticReferenceExpression */:
|
|
116548
116685
|
return Debug.fail("SyntheticReferenceExpression should not be printed");
|
|
116549
116686
|
}
|
|
116550
116687
|
}
|
|
@@ -118388,6 +118525,21 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
118388
118525
|
emit(tag.name);
|
|
118389
118526
|
emitJSDocComment(tag.comment);
|
|
118390
118527
|
}
|
|
118528
|
+
function emitJSDocImportTag(tag) {
|
|
118529
|
+
emitJSDocTagName(tag.tagName);
|
|
118530
|
+
writeSpace();
|
|
118531
|
+
if (tag.importClause) {
|
|
118532
|
+
emit(tag.importClause);
|
|
118533
|
+
writeSpace();
|
|
118534
|
+
emitTokenWithComment(161 /* FromKeyword */, tag.importClause.end, writeKeyword, tag);
|
|
118535
|
+
writeSpace();
|
|
118536
|
+
}
|
|
118537
|
+
emitExpression(tag.moduleSpecifier);
|
|
118538
|
+
if (tag.attributes) {
|
|
118539
|
+
emitWithLeadingSpace(tag.attributes);
|
|
118540
|
+
}
|
|
118541
|
+
emitJSDocComment(tag.comment);
|
|
118542
|
+
}
|
|
118391
118543
|
function emitJSDocNameReference(node) {
|
|
118392
118544
|
writeSpace();
|
|
118393
118545
|
writePunctuation("{");
|
|
@@ -119800,7 +119952,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119800
119952
|
emitLeadingComments(
|
|
119801
119953
|
pos,
|
|
119802
119954
|
/*isEmittedNode*/
|
|
119803
|
-
node.kind !==
|
|
119955
|
+
node.kind !== 353 /* NotEmittedStatement */
|
|
119804
119956
|
);
|
|
119805
119957
|
}
|
|
119806
119958
|
if (!skipLeadingComments || pos >= 0 && (emitFlags & 1024 /* NoLeadingComments */) !== 0) {
|
|
@@ -119824,7 +119976,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
119824
119976
|
containerPos = savedContainerPos;
|
|
119825
119977
|
containerEnd = savedContainerEnd;
|
|
119826
119978
|
declarationListContainerEnd = savedDeclarationListContainerEnd;
|
|
119827
|
-
if (!skipTrailingComments && node.kind !==
|
|
119979
|
+
if (!skipTrailingComments && node.kind !== 353 /* NotEmittedStatement */) {
|
|
119828
119980
|
emitTrailingComments(end);
|
|
119829
119981
|
}
|
|
119830
119982
|
}
|
|
@@ -120076,7 +120228,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
120076
120228
|
const emitFlags = getEmitFlags(node);
|
|
120077
120229
|
const sourceMapRange = getSourceMapRange(node);
|
|
120078
120230
|
const source = sourceMapRange.source || sourceMapSource;
|
|
120079
|
-
if (node.kind !==
|
|
120231
|
+
if (node.kind !== 353 /* NotEmittedStatement */ && (emitFlags & 32 /* NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) {
|
|
120080
120232
|
emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos));
|
|
120081
120233
|
}
|
|
120082
120234
|
if (emitFlags & 128 /* NoNestedSourceMaps */) {
|
|
@@ -120089,7 +120241,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
120089
120241
|
if (emitFlags & 128 /* NoNestedSourceMaps */) {
|
|
120090
120242
|
sourceMapsDisabled = false;
|
|
120091
120243
|
}
|
|
120092
|
-
if (node.kind !==
|
|
120244
|
+
if (node.kind !== 353 /* NotEmittedStatement */ && (emitFlags & 64 /* NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) {
|
|
120093
120245
|
emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end);
|
|
120094
120246
|
}
|
|
120095
120247
|
}
|
|
@@ -123013,7 +123165,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123013
123165
|
);
|
|
123014
123166
|
}
|
|
123015
123167
|
if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || isJavaScriptFile) {
|
|
123016
|
-
|
|
123168
|
+
collectDynamicImportOrRequireOrJsDocImportCalls(file);
|
|
123017
123169
|
}
|
|
123018
123170
|
file.imports = imports || emptyArray;
|
|
123019
123171
|
file.moduleAugmentations = moduleAugmentations || emptyArray;
|
|
@@ -123057,7 +123209,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123057
123209
|
}
|
|
123058
123210
|
}
|
|
123059
123211
|
}
|
|
123060
|
-
function
|
|
123212
|
+
function collectDynamicImportOrRequireOrJsDocImportCalls(file2) {
|
|
123061
123213
|
const r = /import|require/g;
|
|
123062
123214
|
while (r.exec(file2.text) !== null) {
|
|
123063
123215
|
const node = getNodeAtPosition(file2, r.lastIndex);
|
|
@@ -123086,6 +123238,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123086
123238
|
false
|
|
123087
123239
|
);
|
|
123088
123240
|
imports = append(imports, node.argument.literal);
|
|
123241
|
+
} else if (isJavaScriptFile && isJSDocImportTag(node)) {
|
|
123242
|
+
const moduleNameExpr = getExternalModuleName(node);
|
|
123243
|
+
if (moduleNameExpr && isStringLiteral(moduleNameExpr) && moduleNameExpr.text) {
|
|
123244
|
+
setParentRecursive(
|
|
123245
|
+
node,
|
|
123246
|
+
/*incremental*/
|
|
123247
|
+
false
|
|
123248
|
+
);
|
|
123249
|
+
imports = append(imports, moduleNameExpr);
|
|
123250
|
+
}
|
|
123089
123251
|
}
|
|
123090
123252
|
}
|
|
123091
123253
|
}
|
|
@@ -126758,7 +126920,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126758
126920
|
newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
|
|
126759
126921
|
var _a;
|
|
126760
126922
|
const expected = isExternalOrCommonJsModule(newFile) ? ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0 : 0;
|
|
126761
|
-
const existing = impliedFormatPackageJsons.get(newFile.
|
|
126923
|
+
const existing = impliedFormatPackageJsons.get(newFile.resolvedPath) ?? emptyArray;
|
|
126762
126924
|
for (let i = existing.length; i < expected; i++) {
|
|
126763
126925
|
createFileWatcherOfAffectingLocation(
|
|
126764
126926
|
newFile.packageJsonLocations[i],
|
|
@@ -126772,9 +126934,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126772
126934
|
}
|
|
126773
126935
|
}
|
|
126774
126936
|
if (expected)
|
|
126775
|
-
impliedFormatPackageJsons.set(newFile.
|
|
126937
|
+
impliedFormatPackageJsons.set(newFile.resolvedPath, newFile.packageJsonLocations);
|
|
126776
126938
|
else
|
|
126777
|
-
impliedFormatPackageJsons.delete(newFile.
|
|
126939
|
+
impliedFormatPackageJsons.delete(newFile.resolvedPath);
|
|
126778
126940
|
});
|
|
126779
126941
|
impliedFormatPackageJsons.forEach((existing, path) => {
|
|
126780
126942
|
if (!(newProgram == null ? void 0 : newProgram.getSourceFileByPath(path))) {
|
|
@@ -132973,7 +133135,7 @@ function symbolEscapedNameNoDefault(symbol) {
|
|
|
132973
133135
|
});
|
|
132974
133136
|
}
|
|
132975
133137
|
function isModuleSpecifierLike(node) {
|
|
132976
|
-
return isStringLiteralLike(node) && (isExternalModuleReference(node.parent) || isImportDeclaration(node.parent) || isRequireCall(
|
|
133138
|
+
return isStringLiteralLike(node) && (isExternalModuleReference(node.parent) || isImportDeclaration(node.parent) || isJSDocImportTag(node.parent) || isRequireCall(
|
|
132977
133139
|
node.parent,
|
|
132978
133140
|
/*requireStringLiteralLikeArgument*/
|
|
132979
133141
|
false
|
|
@@ -136350,14 +136512,14 @@ function getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, so
|
|
|
136350
136512
|
return newFileName && { newFileName, updated: true };
|
|
136351
136513
|
}
|
|
136352
136514
|
}
|
|
136353
|
-
function updateImportsWorker(sourceFile, changeTracker, updateRef,
|
|
136515
|
+
function updateImportsWorker(sourceFile, changeTracker, updateRef, updateImport) {
|
|
136354
136516
|
for (const ref of sourceFile.referencedFiles || emptyArray) {
|
|
136355
136517
|
const updated = updateRef(ref.fileName);
|
|
136356
136518
|
if (updated !== void 0 && updated !== sourceFile.text.slice(ref.pos, ref.end))
|
|
136357
136519
|
changeTracker.replaceRangeWithText(sourceFile, ref, updated);
|
|
136358
136520
|
}
|
|
136359
136521
|
for (const importStringLiteral of sourceFile.imports) {
|
|
136360
|
-
const updated =
|
|
136522
|
+
const updated = updateImport(importStringLiteral);
|
|
136361
136523
|
if (updated !== void 0 && updated !== importStringLiteral.text)
|
|
136362
136524
|
changeTracker.replaceRangeWithText(sourceFile, createStringRange(importStringLiteral, sourceFile), updated);
|
|
136363
136525
|
}
|
|
@@ -138781,8 +138943,8 @@ function getImportConversionInfo(context, considerPartialSpans = true) {
|
|
|
138781
138943
|
const { file } = context;
|
|
138782
138944
|
const span = getRefactorContextSpan(context);
|
|
138783
138945
|
const token = getTokenAtPosition(file, span.start);
|
|
138784
|
-
const importDecl = considerPartialSpans ? findAncestor(token, isImportDeclaration) : getParentNodeInSpan(token, file, span);
|
|
138785
|
-
if (
|
|
138946
|
+
const importDecl = considerPartialSpans ? findAncestor(token, or(isImportDeclaration, isJSDocImportTag)) : getParentNodeInSpan(token, file, span);
|
|
138947
|
+
if (importDecl === void 0 || !(isImportDeclaration(importDecl) || isJSDocImportTag(importDecl)))
|
|
138786
138948
|
return { error: "Selection is not an import declaration." };
|
|
138787
138949
|
const end = span.start + span.length;
|
|
138788
138950
|
const nextToken = findNextToken(importDecl, importDecl.parent, file);
|
|
@@ -138853,15 +139015,16 @@ function doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, allow
|
|
|
138853
139015
|
));
|
|
138854
139016
|
});
|
|
138855
139017
|
const importDecl = toConvert.parent.parent;
|
|
138856
|
-
if (usedAsNamespaceOrDefault && !allowSyntheticDefaultImports) {
|
|
138857
|
-
changes.insertNodeAfter(sourceFile, importDecl,
|
|
139018
|
+
if (usedAsNamespaceOrDefault && !allowSyntheticDefaultImports && isImportDeclaration(importDecl)) {
|
|
139019
|
+
changes.insertNodeAfter(sourceFile, importDecl, createImport(
|
|
138858
139020
|
importDecl,
|
|
138859
139021
|
/*defaultImportName*/
|
|
138860
139022
|
void 0,
|
|
138861
139023
|
importSpecifiers
|
|
138862
139024
|
));
|
|
138863
139025
|
} else {
|
|
138864
|
-
|
|
139026
|
+
const defaultImportName = usedAsNamespaceOrDefault ? factory.createIdentifier(toConvert.name.text) : void 0;
|
|
139027
|
+
changes.replaceNode(sourceFile, toConvert.parent, createImportClause(defaultImportName, importSpecifiers));
|
|
138865
139028
|
}
|
|
138866
139029
|
}
|
|
138867
139030
|
function getRightOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) {
|
|
@@ -138921,9 +139084,9 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
|
|
|
138921
139084
|
toConvert,
|
|
138922
139085
|
shouldUseDefault ? factory.createIdentifier(namespaceImportName) : factory.createNamespaceImport(factory.createIdentifier(namespaceImportName))
|
|
138923
139086
|
);
|
|
138924
|
-
if (neededNamedImports.size) {
|
|
139087
|
+
if (neededNamedImports.size && isImportDeclaration(importDecl)) {
|
|
138925
139088
|
const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.createIdentifier(element.propertyName.text), factory.createIdentifier(element.name.text)));
|
|
138926
|
-
changes.insertNodeAfter(sourceFile, toConvert.parent.parent,
|
|
139089
|
+
changes.insertNodeAfter(sourceFile, toConvert.parent.parent, createImport(
|
|
138927
139090
|
importDecl,
|
|
138928
139091
|
/*defaultImportName*/
|
|
138929
139092
|
void 0,
|
|
@@ -138938,21 +139101,24 @@ function isExportEqualsModule(moduleSpecifier, checker) {
|
|
|
138938
139101
|
const exportEquals = checker.resolveExternalModuleSymbol(externalModule);
|
|
138939
139102
|
return externalModule !== exportEquals;
|
|
138940
139103
|
}
|
|
138941
|
-
function
|
|
139104
|
+
function createImport(node, defaultImportName, elements) {
|
|
138942
139105
|
return factory.createImportDeclaration(
|
|
138943
139106
|
/*modifiers*/
|
|
138944
139107
|
void 0,
|
|
138945
|
-
|
|
138946
|
-
|
|
138947
|
-
false,
|
|
138948
|
-
defaultImportName,
|
|
138949
|
-
elements && elements.length ? factory.createNamedImports(elements) : void 0
|
|
138950
|
-
),
|
|
138951
|
-
old.moduleSpecifier,
|
|
139108
|
+
createImportClause(defaultImportName, elements),
|
|
139109
|
+
node.moduleSpecifier,
|
|
138952
139110
|
/*attributes*/
|
|
138953
139111
|
void 0
|
|
138954
139112
|
);
|
|
138955
139113
|
}
|
|
139114
|
+
function createImportClause(defaultImportName, elements) {
|
|
139115
|
+
return factory.createImportClause(
|
|
139116
|
+
/*isTypeOnly*/
|
|
139117
|
+
false,
|
|
139118
|
+
defaultImportName,
|
|
139119
|
+
elements && elements.length ? factory.createNamedImports(elements) : void 0
|
|
139120
|
+
);
|
|
139121
|
+
}
|
|
138956
139122
|
|
|
138957
139123
|
// src/services/refactors/extractType.ts
|
|
138958
139124
|
var refactorName3 = "Extract type";
|
|
@@ -144175,7 +144341,7 @@ var NodeObject = class {
|
|
|
144175
144341
|
if (!children.length) {
|
|
144176
144342
|
return void 0;
|
|
144177
144343
|
}
|
|
144178
|
-
const child = find(children, (kid) => kid.kind < 309 /* FirstJSDocNode */ || kid.kind >
|
|
144344
|
+
const child = find(children, (kid) => kid.kind < 309 /* FirstJSDocNode */ || kid.kind > 351 /* LastJSDocNode */);
|
|
144179
144345
|
return child.kind < 166 /* FirstNode */ ? child : child.getFirstToken(sourceFile);
|
|
144180
144346
|
}
|
|
144181
144347
|
getLastToken(sourceFile) {
|
|
@@ -144242,7 +144408,7 @@ function addSyntheticNodes(nodes, pos, end, parent2) {
|
|
|
144242
144408
|
}
|
|
144243
144409
|
}
|
|
144244
144410
|
function createSyntaxList(nodes, parent2) {
|
|
144245
|
-
const list = createNode(
|
|
144411
|
+
const list = createNode(352 /* SyntaxList */, nodes.pos, nodes.end, parent2);
|
|
144246
144412
|
list._children = [];
|
|
144247
144413
|
let pos = nodes.pos;
|
|
144248
144414
|
for (const node of nodes) {
|
|
@@ -149847,7 +150013,7 @@ registerCodeFix({
|
|
|
149847
150013
|
const declaration = getDeclaration2(context.sourceFile, context.span.start);
|
|
149848
150014
|
if (declaration) {
|
|
149849
150015
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration));
|
|
149850
|
-
const importDeclarationChanges = declaration.kind === 276 /* ImportSpecifier */ && canConvertImportDeclarationForSpecifier(declaration, context.sourceFile, context.program) ? ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration.parent.parent.parent)) : void 0;
|
|
150016
|
+
const importDeclarationChanges = declaration.kind === 276 /* ImportSpecifier */ && isImportDeclaration(declaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(declaration, context.sourceFile, context.program) ? ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration.parent.parent.parent)) : void 0;
|
|
149851
150017
|
const mainAction = createCodeFixAction(
|
|
149852
150018
|
fixId13,
|
|
149853
150019
|
changes,
|
|
@@ -149873,7 +150039,7 @@ registerCodeFix({
|
|
|
149873
150039
|
if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 272 /* ImportDeclaration */ && !fixedImportDeclarations.has(errorDeclaration)) {
|
|
149874
150040
|
doChange11(changes, diag2.file, errorDeclaration);
|
|
149875
150041
|
fixedImportDeclarations.add(errorDeclaration);
|
|
149876
|
-
} else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 276 /* ImportSpecifier */ && !fixedImportDeclarations.has(errorDeclaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(errorDeclaration, diag2.file, context.program)) {
|
|
150042
|
+
} else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 276 /* ImportSpecifier */ && isImportDeclaration(errorDeclaration.parent.parent.parent) && !fixedImportDeclarations.has(errorDeclaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(errorDeclaration, diag2.file, context.program)) {
|
|
149877
150043
|
doChange11(changes, diag2.file, errorDeclaration.parent.parent.parent);
|
|
149878
150044
|
fixedImportDeclarations.add(errorDeclaration.parent.parent.parent);
|
|
149879
150045
|
} else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 276 /* ImportSpecifier */) {
|
|
@@ -150745,6 +150911,7 @@ function getNamespaceLikeImportText(declaration) {
|
|
|
150745
150911
|
return (_a = tryCast(declaration.name, isIdentifier)) == null ? void 0 : _a.text;
|
|
150746
150912
|
case 271 /* ImportEqualsDeclaration */:
|
|
150747
150913
|
return declaration.name.text;
|
|
150914
|
+
case 351 /* JSDocImportTag */:
|
|
150748
150915
|
case 272 /* ImportDeclaration */:
|
|
150749
150916
|
return (_c = tryCast((_b = declaration.importClause) == null ? void 0 : _b.namedBindings, isNamespaceImport)) == null ? void 0 : _c.name.text;
|
|
150750
150917
|
default:
|
|
@@ -150822,7 +150989,7 @@ function createExistingImportMap(checker, importingFile, compilerOptions) {
|
|
|
150822
150989
|
if (moduleSymbol) {
|
|
150823
150990
|
(importMap || (importMap = createMultiMap())).add(getSymbolId(moduleSymbol), i.parent);
|
|
150824
150991
|
}
|
|
150825
|
-
} else if (i.kind === 272 /* ImportDeclaration */ || i.kind === 271 /* ImportEqualsDeclaration */) {
|
|
150992
|
+
} else if (i.kind === 272 /* ImportDeclaration */ || i.kind === 271 /* ImportEqualsDeclaration */ || i.kind === 351 /* JSDocImportTag */) {
|
|
150826
150993
|
const moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier);
|
|
150827
150994
|
if (moduleSymbol) {
|
|
150828
150995
|
(importMap || (importMap = createMultiMap())).add(getSymbolId(moduleSymbol), i);
|
|
@@ -150831,11 +150998,11 @@ function createExistingImportMap(checker, importingFile, compilerOptions) {
|
|
|
150831
150998
|
}
|
|
150832
150999
|
return {
|
|
150833
151000
|
getImportsForExportInfo: ({ moduleSymbol, exportKind, targetFlags, symbol }) => {
|
|
150834
|
-
if (!(targetFlags & 111551 /* Value */) && isSourceFileJS(importingFile))
|
|
150835
|
-
return emptyArray;
|
|
150836
151001
|
const matchingDeclarations = importMap == null ? void 0 : importMap.get(getSymbolId(moduleSymbol));
|
|
150837
151002
|
if (!matchingDeclarations)
|
|
150838
151003
|
return emptyArray;
|
|
151004
|
+
if (isSourceFileJS(importingFile) && !(targetFlags & 111551 /* Value */) && !every(matchingDeclarations, isJSDocImportTag))
|
|
151005
|
+
return emptyArray;
|
|
150839
151006
|
const importKind = getImportKind(importingFile, exportKind, compilerOptions);
|
|
150840
151007
|
return matchingDeclarations.map((declaration) => ({ declaration, importKind, symbol, targetFlags }));
|
|
150841
151008
|
}
|
|
@@ -157095,7 +157262,7 @@ function getInfo19(sourceFile, pos) {
|
|
|
157095
157262
|
const { parent: parent2 } = name;
|
|
157096
157263
|
if (isImportEqualsDeclaration(parent2) && isExternalModuleReference(parent2.moduleReference)) {
|
|
157097
157264
|
return { importNode: parent2, name, moduleSpecifier: parent2.moduleReference.expression };
|
|
157098
|
-
} else if (isNamespaceImport(parent2)) {
|
|
157265
|
+
} else if (isNamespaceImport(parent2) && isImportDeclaration(parent2.parent.parent)) {
|
|
157099
157266
|
const importNode = parent2.parent.parent;
|
|
157100
157267
|
return { importNode, name, moduleSpecifier: importNode.moduleSpecifier };
|
|
157101
157268
|
}
|
|
@@ -159605,6 +159772,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
159605
159772
|
const insideComment = isInComment(sourceFile, position, currentToken);
|
|
159606
159773
|
log("getCompletionData: Is inside comment: " + (timestamp() - start));
|
|
159607
159774
|
let insideJsDocTagTypeExpression = false;
|
|
159775
|
+
let insideJsDocImportTag = false;
|
|
159608
159776
|
let isInSnippetScope = false;
|
|
159609
159777
|
if (insideComment) {
|
|
159610
159778
|
if (hasDocComment(sourceFile, position)) {
|
|
@@ -159622,24 +159790,28 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
159622
159790
|
if (tag.tagName.pos <= position && position <= tag.tagName.end) {
|
|
159623
159791
|
return { kind: 1 /* JsDocTagName */ };
|
|
159624
159792
|
}
|
|
159625
|
-
|
|
159626
|
-
|
|
159627
|
-
|
|
159628
|
-
|
|
159629
|
-
|
|
159793
|
+
if (isJSDocImportTag(tag)) {
|
|
159794
|
+
insideJsDocImportTag = true;
|
|
159795
|
+
} else {
|
|
159796
|
+
const typeExpression = tryGetTypeExpressionFromTag(tag);
|
|
159797
|
+
if (typeExpression) {
|
|
159798
|
+
currentToken = getTokenAtPosition(sourceFile, position);
|
|
159799
|
+
if (!currentToken || !isDeclarationName(currentToken) && (currentToken.parent.kind !== 348 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken)) {
|
|
159800
|
+
insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression);
|
|
159801
|
+
}
|
|
159802
|
+
}
|
|
159803
|
+
if (!insideJsDocTagTypeExpression && isJSDocParameterTag(tag) && (nodeIsMissing(tag.name) || tag.name.pos <= position && position <= tag.name.end)) {
|
|
159804
|
+
return { kind: 3 /* JsDocParameterName */, tag };
|
|
159630
159805
|
}
|
|
159631
|
-
}
|
|
159632
|
-
if (!insideJsDocTagTypeExpression && isJSDocParameterTag(tag) && (nodeIsMissing(tag.name) || tag.name.pos <= position && position <= tag.name.end)) {
|
|
159633
|
-
return { kind: 3 /* JsDocParameterName */, tag };
|
|
159634
159806
|
}
|
|
159635
159807
|
}
|
|
159636
|
-
if (!insideJsDocTagTypeExpression) {
|
|
159808
|
+
if (!insideJsDocTagTypeExpression && !insideJsDocImportTag) {
|
|
159637
159809
|
log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.");
|
|
159638
159810
|
return void 0;
|
|
159639
159811
|
}
|
|
159640
159812
|
}
|
|
159641
159813
|
start = timestamp();
|
|
159642
|
-
const isJsOnlyLocation = !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile);
|
|
159814
|
+
const isJsOnlyLocation = !insideJsDocTagTypeExpression && !insideJsDocImportTag && isSourceFileJS(sourceFile);
|
|
159643
159815
|
const tokens = getRelevantTokens(position, sourceFile);
|
|
159644
159816
|
const previousToken = tokens.previousToken;
|
|
159645
159817
|
let contextToken = tokens.contextToken;
|
|
@@ -160152,7 +160324,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
160152
160324
|
}
|
|
160153
160325
|
}
|
|
160154
160326
|
function isTypeOnlyCompletion() {
|
|
160155
|
-
return insideJsDocTagTypeExpression || !!importStatementCompletion && isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken));
|
|
160327
|
+
return insideJsDocTagTypeExpression || insideJsDocImportTag || !!importStatementCompletion && isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken));
|
|
160156
160328
|
}
|
|
160157
160329
|
function isContextTokenValueLocation(contextToken2) {
|
|
160158
160330
|
return contextToken2 && (contextToken2.kind === 114 /* TypeOfKeyword */ && (contextToken2.parent.kind === 186 /* TypeQuery */ || isTypeOfExpression(contextToken2.parent)) || contextToken2.kind === 131 /* AssertsKeyword */ && contextToken2.parent.kind === 182 /* TypePredicate */);
|
|
@@ -161176,7 +161348,7 @@ function getPropertiesForCompletion(type, checker) {
|
|
|
161176
161348
|
}
|
|
161177
161349
|
function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) {
|
|
161178
161350
|
switch (location.kind) {
|
|
161179
|
-
case
|
|
161351
|
+
case 352 /* SyntaxList */:
|
|
161180
161352
|
return tryCast(location.parent, isObjectTypeDeclaration);
|
|
161181
161353
|
case 1 /* EndOfFileToken */:
|
|
161182
161354
|
const cls = tryCast(lastOrUndefined(cast(location.parent, isSourceFile).statements), isObjectTypeDeclaration);
|
|
@@ -161407,13 +161579,13 @@ function getSingleLineReplacementSpanForImportCompletionNode(node) {
|
|
|
161407
161579
|
var _a;
|
|
161408
161580
|
if (!node)
|
|
161409
161581
|
return void 0;
|
|
161410
|
-
const top = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration)) ?? node;
|
|
161582
|
+
const top = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration, isJSDocImportTag)) ?? node;
|
|
161411
161583
|
const sourceFile = top.getSourceFile();
|
|
161412
161584
|
if (rangeIsOnSingleLine(top, sourceFile)) {
|
|
161413
161585
|
return createTextSpanFromNode(top, sourceFile);
|
|
161414
161586
|
}
|
|
161415
161587
|
Debug.assert(top.kind !== 102 /* ImportKeyword */ && top.kind !== 276 /* ImportSpecifier */);
|
|
161416
|
-
const potentialSplitPoint = top.kind === 272 /* ImportDeclaration */ ? getPotentiallyInvalidImportSpecifier((_a = top.importClause) == null ? void 0 : _a.namedBindings) ?? top.moduleSpecifier : top.moduleReference;
|
|
161588
|
+
const potentialSplitPoint = top.kind === 272 /* ImportDeclaration */ || top.kind === 351 /* JSDocImportTag */ ? getPotentiallyInvalidImportSpecifier((_a = top.importClause) == null ? void 0 : _a.namedBindings) ?? top.moduleSpecifier : top.moduleReference;
|
|
161417
161589
|
const withoutModuleSpecifier = {
|
|
161418
161590
|
pos: top.getFirstToken().getStart(),
|
|
161419
161591
|
end: potentialSplitPoint.pos
|
|
@@ -161709,6 +161881,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
|
|
|
161709
161881
|
case 272 /* ImportDeclaration */:
|
|
161710
161882
|
case 278 /* ExportDeclaration */:
|
|
161711
161883
|
case 283 /* ExternalModuleReference */:
|
|
161884
|
+
case 351 /* JSDocImportTag */:
|
|
161712
161885
|
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, program, host, preferences) };
|
|
161713
161886
|
case 296 /* CaseClause */:
|
|
161714
161887
|
const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
|
|
@@ -162505,6 +162678,7 @@ function getImportersForExport(sourceFiles, sourceFilesSet, allDirectImports, {
|
|
|
162505
162678
|
);
|
|
162506
162679
|
break;
|
|
162507
162680
|
case 272 /* ImportDeclaration */:
|
|
162681
|
+
case 351 /* JSDocImportTag */:
|
|
162508
162682
|
directImports.push(direct);
|
|
162509
162683
|
const namedBindings = direct.importClause && direct.importClause.namedBindings;
|
|
162510
162684
|
if (namedBindings && namedBindings.kind === 274 /* NamespaceImport */) {
|
|
@@ -166238,6 +166412,7 @@ var jsDocTagNames = [
|
|
|
166238
166412
|
"host",
|
|
166239
166413
|
"ignore",
|
|
166240
166414
|
"implements",
|
|
166415
|
+
"import",
|
|
166241
166416
|
"inheritdoc",
|
|
166242
166417
|
"inner",
|
|
166243
166418
|
"instance",
|
|
@@ -174740,6 +174915,7 @@ __export(ts_exports2, {
|
|
|
174740
174915
|
isJSDocEnumTag: () => isJSDocEnumTag,
|
|
174741
174916
|
isJSDocFunctionType: () => isJSDocFunctionType,
|
|
174742
174917
|
isJSDocImplementsTag: () => isJSDocImplementsTag,
|
|
174918
|
+
isJSDocImportTag: () => isJSDocImportTag,
|
|
174743
174919
|
isJSDocIndexSignature: () => isJSDocIndexSignature,
|
|
174744
174920
|
isJSDocLikeText: () => isJSDocLikeText,
|
|
174745
174921
|
isJSDocLink: () => isJSDocLink,
|
|
@@ -188942,6 +189118,7 @@ if (typeof console !== "undefined") {
|
|
|
188942
189118
|
isJSDocEnumTag,
|
|
188943
189119
|
isJSDocFunctionType,
|
|
188944
189120
|
isJSDocImplementsTag,
|
|
189121
|
+
isJSDocImportTag,
|
|
188945
189122
|
isJSDocIndexSignature,
|
|
188946
189123
|
isJSDocLikeText,
|
|
188947
189124
|
isJSDocLink,
|