typescript 4.7.0-dev.20220506 → 4.8.0-dev.20220507
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 +48 -25
- package/lib/tsserver.js +51 -28
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +51 -28
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +51 -28
- package/lib/typescriptServices.d.ts +1 -1
- package/lib/typescriptServices.js +51 -28
- package/lib/typingsInstaller.js +51 -28
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -290,11 +290,11 @@ var ts;
|
|
|
290
290
|
(function (ts) {
|
|
291
291
|
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
|
|
292
292
|
// If changing the text in this section, be sure to test `configurePrerelease` too.
|
|
293
|
-
ts.versionMajorMinor = "4.
|
|
293
|
+
ts.versionMajorMinor = "4.8";
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220507";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -9194,6 +9194,7 @@ var ts;
|
|
|
9194
9194
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
|
|
9195
9195
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
|
|
9196
9196
|
Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, ts.DiagnosticCategory.Error, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
9197
|
+
Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4125, ts.DiagnosticCategory.Error, "Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125", "Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
9197
9198
|
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
9198
9199
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
9199
9200
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
@@ -18200,6 +18201,10 @@ var ts;
|
|
|
18200
18201
|
return indentStrings[1].length;
|
|
18201
18202
|
}
|
|
18202
18203
|
ts.getIndentSize = getIndentSize;
|
|
18204
|
+
function isNightly() {
|
|
18205
|
+
return ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
|
|
18206
|
+
}
|
|
18207
|
+
ts.isNightly = isNightly;
|
|
18203
18208
|
function createTextWriter(newLine) {
|
|
18204
18209
|
var output;
|
|
18205
18210
|
var indent;
|
|
@@ -33047,6 +33052,7 @@ var ts;
|
|
|
33047
33052
|
var startPos = scanner.getStartPos();
|
|
33048
33053
|
var result = parseListElement(kind, parseElement);
|
|
33049
33054
|
if (!result) {
|
|
33055
|
+
parsingContext = saveParsingContext;
|
|
33050
33056
|
return undefined;
|
|
33051
33057
|
}
|
|
33052
33058
|
list.push(result);
|
|
@@ -85189,6 +85195,9 @@ var ts;
|
|
|
85189
85195
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
85190
85196
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
85191
85197
|
if (validForTypeAssertions && override) {
|
|
85198
|
+
if (!ts.isNightly()) {
|
|
85199
|
+
grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next);
|
|
85200
|
+
}
|
|
85192
85201
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85193
85202
|
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85194
85203
|
}
|
|
@@ -108587,34 +108596,44 @@ var ts;
|
|
|
108587
108596
|
if (!decl.importClause) {
|
|
108588
108597
|
// import "mod" - possibly needed for side effects? (global interface patches, module augmentations, etc)
|
|
108589
108598
|
return factory.updateImportDeclaration(decl,
|
|
108590
|
-
/*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108599
|
+
/*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108591
108600
|
}
|
|
108592
108601
|
// The `importClause` visibility corresponds to the default's visibility.
|
|
108593
108602
|
var visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : undefined;
|
|
108594
108603
|
if (!decl.importClause.namedBindings) {
|
|
108595
108604
|
// No named bindings (either namespace or list), meaning the import is just default or should be elided
|
|
108596
108605
|
return visibleDefaultBinding && factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding,
|
|
108597
|
-
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108606
|
+
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108598
108607
|
}
|
|
108599
108608
|
if (decl.importClause.namedBindings.kind === 268 /* NamespaceImport */) {
|
|
108600
108609
|
// Namespace import (optionally with visible default)
|
|
108601
108610
|
var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined;
|
|
108602
|
-
return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108611
|
+
return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined;
|
|
108603
108612
|
}
|
|
108604
108613
|
// Named imports (optionally with visible default)
|
|
108605
108614
|
var bindingList = ts.mapDefined(decl.importClause.namedBindings.elements, function (b) { return resolver.isDeclarationVisible(b) ? b : undefined; });
|
|
108606
108615
|
if ((bindingList && bindingList.length) || visibleDefaultBinding) {
|
|
108607
108616
|
return factory.updateImportDeclaration(decl,
|
|
108608
|
-
/*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108617
|
+
/*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108609
108618
|
}
|
|
108610
108619
|
// Augmentation of export depends on import
|
|
108611
108620
|
if (resolver.isImportRequiredByAugmentation(decl)) {
|
|
108612
108621
|
return factory.updateImportDeclaration(decl,
|
|
108613
108622
|
/*decorators*/ undefined, decl.modifiers,
|
|
108614
|
-
/*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108623
|
+
/*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108615
108624
|
}
|
|
108616
108625
|
// Nothing visible
|
|
108617
108626
|
}
|
|
108627
|
+
function getResolutionModeOverrideForClauseInNightly(assertClause) {
|
|
108628
|
+
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
108629
|
+
if (mode !== undefined) {
|
|
108630
|
+
if (!ts.isNightly()) {
|
|
108631
|
+
context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next));
|
|
108632
|
+
}
|
|
108633
|
+
return assertClause;
|
|
108634
|
+
}
|
|
108635
|
+
return undefined;
|
|
108636
|
+
}
|
|
108618
108637
|
function transformAndReplaceLatePaintedStatements(statements) {
|
|
108619
108638
|
// This is a `while` loop because `handleSymbolAccessibilityError` can see additional import aliases marked as visible during
|
|
108620
108639
|
// error handling which must now be included in the output and themselves checked for errors.
|
|
@@ -121922,14 +121941,14 @@ var ts;
|
|
|
121922
121941
|
if (options === void 0) { options = {}; }
|
|
121923
121942
|
var info = getInfo(importingSourceFile.path, host);
|
|
121924
121943
|
var modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences, options);
|
|
121925
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ true, options.overrideImportMode); });
|
|
121944
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, preferences, /*packageNameOnly*/ true, options.overrideImportMode); });
|
|
121926
121945
|
}
|
|
121927
121946
|
moduleSpecifiers_1.getNodeModulesPackageName = getNodeModulesPackageName;
|
|
121928
121947
|
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, preferences, userPreferences, options) {
|
|
121929
121948
|
if (options === void 0) { options = {}; }
|
|
121930
121949
|
var info = getInfo(importingSourceFileName, host);
|
|
121931
121950
|
var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options);
|
|
121932
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
|
|
121951
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
|
|
121933
121952
|
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
|
|
121934
121953
|
}
|
|
121935
121954
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) {
|
|
@@ -122005,7 +122024,7 @@ var ts;
|
|
|
122005
122024
|
var relativeSpecifiers;
|
|
122006
122025
|
for (var _i = 0, modulePaths_1 = modulePaths; _i < modulePaths_1.length; _i++) {
|
|
122007
122026
|
var modulePath = modulePaths_1[_i];
|
|
122008
|
-
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode);
|
|
122027
|
+
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode);
|
|
122009
122028
|
nodeModulesSpecifiers = ts.append(nodeModulesSpecifiers, specifier);
|
|
122010
122029
|
if (specifier && modulePath.isRedirect) {
|
|
122011
122030
|
// If we got a specifier for a redirect, it was a bare package specifier (e.g. "@foo/bar",
|
|
@@ -122398,7 +122417,7 @@ var ts;
|
|
|
122398
122417
|
? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
|
|
122399
122418
|
: ts.removeFileExtension(relativePath);
|
|
122400
122419
|
}
|
|
122401
|
-
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, packageNameOnly, overrideMode) {
|
|
122420
|
+
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
122402
122421
|
var path = _a.path, isRedirect = _a.isRedirect;
|
|
122403
122422
|
var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory;
|
|
122404
122423
|
if (!host.fileExists || !host.readFile) {
|
|
@@ -122412,8 +122431,9 @@ var ts;
|
|
|
122412
122431
|
var moduleSpecifier = path;
|
|
122413
122432
|
var isPackageRootPath = false;
|
|
122414
122433
|
if (!packageNameOnly) {
|
|
122434
|
+
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
122415
122435
|
var packageRootIndex = parts.packageRootIndex;
|
|
122416
|
-
var
|
|
122436
|
+
var moduleFileName = void 0;
|
|
122417
122437
|
while (true) {
|
|
122418
122438
|
// If the module could be imported by a directory name, use that directory's name
|
|
122419
122439
|
var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath, blockedByExports = _c.blockedByExports, verbatimFromExports = _c.verbatimFromExports;
|
|
@@ -122430,12 +122450,12 @@ var ts;
|
|
|
122430
122450
|
isPackageRootPath = true;
|
|
122431
122451
|
break;
|
|
122432
122452
|
}
|
|
122433
|
-
if (!
|
|
122434
|
-
|
|
122453
|
+
if (!moduleFileName)
|
|
122454
|
+
moduleFileName = moduleFileToTry;
|
|
122435
122455
|
// try with next level of directory
|
|
122436
122456
|
packageRootIndex = path.indexOf(ts.directorySeparator, packageRootIndex + 1);
|
|
122437
122457
|
if (packageRootIndex === -1) {
|
|
122438
|
-
moduleSpecifier =
|
|
122458
|
+
moduleSpecifier = removeExtensionAndIndexPostFix(moduleFileName, preferences.ending, options, host);
|
|
122439
122459
|
break;
|
|
122440
122460
|
}
|
|
122441
122461
|
}
|
|
@@ -122493,7 +122513,7 @@ var ts;
|
|
|
122493
122513
|
}
|
|
122494
122514
|
}
|
|
122495
122515
|
// If the file is the main module, it can be imported by the package name
|
|
122496
|
-
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main;
|
|
122516
|
+
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
|
|
122497
122517
|
if (ts.isString(mainFileRelative)) {
|
|
122498
122518
|
var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
122499
122519
|
if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
|
|
@@ -122501,17 +122521,14 @@ var ts;
|
|
|
122501
122521
|
}
|
|
122502
122522
|
}
|
|
122503
122523
|
}
|
|
122504
|
-
|
|
122505
|
-
|
|
122506
|
-
|
|
122507
|
-
|
|
122508
|
-
|
|
122509
|
-
|
|
122510
|
-
// IFF there is not _also_ a file by the same name
|
|
122511
|
-
if (getCanonicalFileName(fullModulePathWithoutExtension.substring(parts.fileNameIndex)) === "/index" && !tryGetAnyFileFromPath(host, fullModulePathWithoutExtension.substring(0, parts.fileNameIndex))) {
|
|
122512
|
-
return fullModulePathWithoutExtension.substring(0, parts.fileNameIndex);
|
|
122524
|
+
else {
|
|
122525
|
+
// No package.json exists; an index.js will still resolve as the package name
|
|
122526
|
+
var fileName = getCanonicalFileName(moduleFileToTry.substring(parts.packageRootIndex + 1));
|
|
122527
|
+
if (fileName === "index.d.ts" || fileName === "index.js" || fileName === "index.ts" || fileName === "index.tsx") {
|
|
122528
|
+
return { moduleFileToTry: moduleFileToTry, packageRootPath: packageRootPath };
|
|
122529
|
+
}
|
|
122513
122530
|
}
|
|
122514
|
-
return
|
|
122531
|
+
return { moduleFileToTry: moduleFileToTry };
|
|
122515
122532
|
}
|
|
122516
122533
|
}
|
|
122517
122534
|
function tryGetAnyFileFromPath(host, path) {
|
|
@@ -122533,7 +122550,7 @@ var ts;
|
|
|
122533
122550
|
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
122534
122551
|
});
|
|
122535
122552
|
}
|
|
122536
|
-
function removeExtensionAndIndexPostFix(fileName, ending, options) {
|
|
122553
|
+
function removeExtensionAndIndexPostFix(fileName, ending, options, host) {
|
|
122537
122554
|
if (ts.fileExtensionIsOneOf(fileName, [".json" /* Json */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]))
|
|
122538
122555
|
return fileName;
|
|
122539
122556
|
var noExtension = ts.removeFileExtension(fileName);
|
|
@@ -122541,7 +122558,13 @@ var ts;
|
|
|
122541
122558
|
return noExtension + getJSExtensionForFile(fileName, options);
|
|
122542
122559
|
switch (ending) {
|
|
122543
122560
|
case 0 /* Minimal */:
|
|
122544
|
-
|
|
122561
|
+
var withoutIndex = ts.removeSuffix(noExtension, "/index");
|
|
122562
|
+
if (host && withoutIndex !== noExtension && tryGetAnyFileFromPath(host, withoutIndex)) {
|
|
122563
|
+
// Can't remove index if there's a file by the same name as the directory.
|
|
122564
|
+
// Probably more callers should pass `host` so we can determine this?
|
|
122565
|
+
return noExtension;
|
|
122566
|
+
}
|
|
122567
|
+
return withoutIndex;
|
|
122545
122568
|
case 1 /* Index */:
|
|
122546
122569
|
return noExtension;
|
|
122547
122570
|
case 2 /* JsExtension */:
|
package/lib/typescript.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ and limitations under the License.
|
|
|
14
14
|
***************************************************************************** */
|
|
15
15
|
|
|
16
16
|
declare namespace ts {
|
|
17
|
-
const versionMajorMinor = "4.
|
|
17
|
+
const versionMajorMinor = "4.8";
|
|
18
18
|
/** The version of the TypeScript compiler release */
|
|
19
19
|
const version: string;
|
|
20
20
|
/**
|
package/lib/typescript.js
CHANGED
|
@@ -290,11 +290,11 @@ var ts;
|
|
|
290
290
|
(function (ts) {
|
|
291
291
|
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
|
|
292
292
|
// If changing the text in this section, be sure to test `configurePrerelease` too.
|
|
293
|
-
ts.versionMajorMinor = "4.
|
|
293
|
+
ts.versionMajorMinor = "4.8";
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220507";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -9194,6 +9194,7 @@ var ts;
|
|
|
9194
9194
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
|
|
9195
9195
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
|
|
9196
9196
|
Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, ts.DiagnosticCategory.Error, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
9197
|
+
Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4125, ts.DiagnosticCategory.Error, "Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125", "Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
9197
9198
|
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
9198
9199
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
9199
9200
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
@@ -18200,6 +18201,10 @@ var ts;
|
|
|
18200
18201
|
return indentStrings[1].length;
|
|
18201
18202
|
}
|
|
18202
18203
|
ts.getIndentSize = getIndentSize;
|
|
18204
|
+
function isNightly() {
|
|
18205
|
+
return ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
|
|
18206
|
+
}
|
|
18207
|
+
ts.isNightly = isNightly;
|
|
18203
18208
|
function createTextWriter(newLine) {
|
|
18204
18209
|
var output;
|
|
18205
18210
|
var indent;
|
|
@@ -33047,6 +33052,7 @@ var ts;
|
|
|
33047
33052
|
var startPos = scanner.getStartPos();
|
|
33048
33053
|
var result = parseListElement(kind, parseElement);
|
|
33049
33054
|
if (!result) {
|
|
33055
|
+
parsingContext = saveParsingContext;
|
|
33050
33056
|
return undefined;
|
|
33051
33057
|
}
|
|
33052
33058
|
list.push(result);
|
|
@@ -85189,6 +85195,9 @@ var ts;
|
|
|
85189
85195
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
85190
85196
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
85191
85197
|
if (validForTypeAssertions && override) {
|
|
85198
|
+
if (!ts.isNightly()) {
|
|
85199
|
+
grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next);
|
|
85200
|
+
}
|
|
85192
85201
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85193
85202
|
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85194
85203
|
}
|
|
@@ -108587,34 +108596,44 @@ var ts;
|
|
|
108587
108596
|
if (!decl.importClause) {
|
|
108588
108597
|
// import "mod" - possibly needed for side effects? (global interface patches, module augmentations, etc)
|
|
108589
108598
|
return factory.updateImportDeclaration(decl,
|
|
108590
|
-
/*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108599
|
+
/*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108591
108600
|
}
|
|
108592
108601
|
// The `importClause` visibility corresponds to the default's visibility.
|
|
108593
108602
|
var visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : undefined;
|
|
108594
108603
|
if (!decl.importClause.namedBindings) {
|
|
108595
108604
|
// No named bindings (either namespace or list), meaning the import is just default or should be elided
|
|
108596
108605
|
return visibleDefaultBinding && factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding,
|
|
108597
|
-
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108606
|
+
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108598
108607
|
}
|
|
108599
108608
|
if (decl.importClause.namedBindings.kind === 268 /* NamespaceImport */) {
|
|
108600
108609
|
// Namespace import (optionally with visible default)
|
|
108601
108610
|
var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined;
|
|
108602
|
-
return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108611
|
+
return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined;
|
|
108603
108612
|
}
|
|
108604
108613
|
// Named imports (optionally with visible default)
|
|
108605
108614
|
var bindingList = ts.mapDefined(decl.importClause.namedBindings.elements, function (b) { return resolver.isDeclarationVisible(b) ? b : undefined; });
|
|
108606
108615
|
if ((bindingList && bindingList.length) || visibleDefaultBinding) {
|
|
108607
108616
|
return factory.updateImportDeclaration(decl,
|
|
108608
|
-
/*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108617
|
+
/*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108609
108618
|
}
|
|
108610
108619
|
// Augmentation of export depends on import
|
|
108611
108620
|
if (resolver.isImportRequiredByAugmentation(decl)) {
|
|
108612
108621
|
return factory.updateImportDeclaration(decl,
|
|
108613
108622
|
/*decorators*/ undefined, decl.modifiers,
|
|
108614
|
-
/*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108623
|
+
/*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108615
108624
|
}
|
|
108616
108625
|
// Nothing visible
|
|
108617
108626
|
}
|
|
108627
|
+
function getResolutionModeOverrideForClauseInNightly(assertClause) {
|
|
108628
|
+
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
108629
|
+
if (mode !== undefined) {
|
|
108630
|
+
if (!ts.isNightly()) {
|
|
108631
|
+
context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next));
|
|
108632
|
+
}
|
|
108633
|
+
return assertClause;
|
|
108634
|
+
}
|
|
108635
|
+
return undefined;
|
|
108636
|
+
}
|
|
108618
108637
|
function transformAndReplaceLatePaintedStatements(statements) {
|
|
108619
108638
|
// This is a `while` loop because `handleSymbolAccessibilityError` can see additional import aliases marked as visible during
|
|
108620
108639
|
// error handling which must now be included in the output and themselves checked for errors.
|
|
@@ -121922,14 +121941,14 @@ var ts;
|
|
|
121922
121941
|
if (options === void 0) { options = {}; }
|
|
121923
121942
|
var info = getInfo(importingSourceFile.path, host);
|
|
121924
121943
|
var modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences, options);
|
|
121925
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ true, options.overrideImportMode); });
|
|
121944
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, preferences, /*packageNameOnly*/ true, options.overrideImportMode); });
|
|
121926
121945
|
}
|
|
121927
121946
|
moduleSpecifiers_1.getNodeModulesPackageName = getNodeModulesPackageName;
|
|
121928
121947
|
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, preferences, userPreferences, options) {
|
|
121929
121948
|
if (options === void 0) { options = {}; }
|
|
121930
121949
|
var info = getInfo(importingSourceFileName, host);
|
|
121931
121950
|
var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options);
|
|
121932
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
|
|
121951
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
|
|
121933
121952
|
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
|
|
121934
121953
|
}
|
|
121935
121954
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) {
|
|
@@ -122005,7 +122024,7 @@ var ts;
|
|
|
122005
122024
|
var relativeSpecifiers;
|
|
122006
122025
|
for (var _i = 0, modulePaths_1 = modulePaths; _i < modulePaths_1.length; _i++) {
|
|
122007
122026
|
var modulePath = modulePaths_1[_i];
|
|
122008
|
-
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode);
|
|
122027
|
+
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode);
|
|
122009
122028
|
nodeModulesSpecifiers = ts.append(nodeModulesSpecifiers, specifier);
|
|
122010
122029
|
if (specifier && modulePath.isRedirect) {
|
|
122011
122030
|
// If we got a specifier for a redirect, it was a bare package specifier (e.g. "@foo/bar",
|
|
@@ -122398,7 +122417,7 @@ var ts;
|
|
|
122398
122417
|
? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
|
|
122399
122418
|
: ts.removeFileExtension(relativePath);
|
|
122400
122419
|
}
|
|
122401
|
-
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, packageNameOnly, overrideMode) {
|
|
122420
|
+
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
122402
122421
|
var path = _a.path, isRedirect = _a.isRedirect;
|
|
122403
122422
|
var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory;
|
|
122404
122423
|
if (!host.fileExists || !host.readFile) {
|
|
@@ -122412,8 +122431,9 @@ var ts;
|
|
|
122412
122431
|
var moduleSpecifier = path;
|
|
122413
122432
|
var isPackageRootPath = false;
|
|
122414
122433
|
if (!packageNameOnly) {
|
|
122434
|
+
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
122415
122435
|
var packageRootIndex = parts.packageRootIndex;
|
|
122416
|
-
var
|
|
122436
|
+
var moduleFileName = void 0;
|
|
122417
122437
|
while (true) {
|
|
122418
122438
|
// If the module could be imported by a directory name, use that directory's name
|
|
122419
122439
|
var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath, blockedByExports = _c.blockedByExports, verbatimFromExports = _c.verbatimFromExports;
|
|
@@ -122430,12 +122450,12 @@ var ts;
|
|
|
122430
122450
|
isPackageRootPath = true;
|
|
122431
122451
|
break;
|
|
122432
122452
|
}
|
|
122433
|
-
if (!
|
|
122434
|
-
|
|
122453
|
+
if (!moduleFileName)
|
|
122454
|
+
moduleFileName = moduleFileToTry;
|
|
122435
122455
|
// try with next level of directory
|
|
122436
122456
|
packageRootIndex = path.indexOf(ts.directorySeparator, packageRootIndex + 1);
|
|
122437
122457
|
if (packageRootIndex === -1) {
|
|
122438
|
-
moduleSpecifier =
|
|
122458
|
+
moduleSpecifier = removeExtensionAndIndexPostFix(moduleFileName, preferences.ending, options, host);
|
|
122439
122459
|
break;
|
|
122440
122460
|
}
|
|
122441
122461
|
}
|
|
@@ -122493,7 +122513,7 @@ var ts;
|
|
|
122493
122513
|
}
|
|
122494
122514
|
}
|
|
122495
122515
|
// If the file is the main module, it can be imported by the package name
|
|
122496
|
-
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main;
|
|
122516
|
+
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
|
|
122497
122517
|
if (ts.isString(mainFileRelative)) {
|
|
122498
122518
|
var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
122499
122519
|
if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
|
|
@@ -122501,17 +122521,14 @@ var ts;
|
|
|
122501
122521
|
}
|
|
122502
122522
|
}
|
|
122503
122523
|
}
|
|
122504
|
-
|
|
122505
|
-
|
|
122506
|
-
|
|
122507
|
-
|
|
122508
|
-
|
|
122509
|
-
|
|
122510
|
-
// IFF there is not _also_ a file by the same name
|
|
122511
|
-
if (getCanonicalFileName(fullModulePathWithoutExtension.substring(parts.fileNameIndex)) === "/index" && !tryGetAnyFileFromPath(host, fullModulePathWithoutExtension.substring(0, parts.fileNameIndex))) {
|
|
122512
|
-
return fullModulePathWithoutExtension.substring(0, parts.fileNameIndex);
|
|
122524
|
+
else {
|
|
122525
|
+
// No package.json exists; an index.js will still resolve as the package name
|
|
122526
|
+
var fileName = getCanonicalFileName(moduleFileToTry.substring(parts.packageRootIndex + 1));
|
|
122527
|
+
if (fileName === "index.d.ts" || fileName === "index.js" || fileName === "index.ts" || fileName === "index.tsx") {
|
|
122528
|
+
return { moduleFileToTry: moduleFileToTry, packageRootPath: packageRootPath };
|
|
122529
|
+
}
|
|
122513
122530
|
}
|
|
122514
|
-
return
|
|
122531
|
+
return { moduleFileToTry: moduleFileToTry };
|
|
122515
122532
|
}
|
|
122516
122533
|
}
|
|
122517
122534
|
function tryGetAnyFileFromPath(host, path) {
|
|
@@ -122533,7 +122550,7 @@ var ts;
|
|
|
122533
122550
|
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
122534
122551
|
});
|
|
122535
122552
|
}
|
|
122536
|
-
function removeExtensionAndIndexPostFix(fileName, ending, options) {
|
|
122553
|
+
function removeExtensionAndIndexPostFix(fileName, ending, options, host) {
|
|
122537
122554
|
if (ts.fileExtensionIsOneOf(fileName, [".json" /* Json */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]))
|
|
122538
122555
|
return fileName;
|
|
122539
122556
|
var noExtension = ts.removeFileExtension(fileName);
|
|
@@ -122541,7 +122558,13 @@ var ts;
|
|
|
122541
122558
|
return noExtension + getJSExtensionForFile(fileName, options);
|
|
122542
122559
|
switch (ending) {
|
|
122543
122560
|
case 0 /* Minimal */:
|
|
122544
|
-
|
|
122561
|
+
var withoutIndex = ts.removeSuffix(noExtension, "/index");
|
|
122562
|
+
if (host && withoutIndex !== noExtension && tryGetAnyFileFromPath(host, withoutIndex)) {
|
|
122563
|
+
// Can't remove index if there's a file by the same name as the directory.
|
|
122564
|
+
// Probably more callers should pass `host` so we can determine this?
|
|
122565
|
+
return noExtension;
|
|
122566
|
+
}
|
|
122567
|
+
return withoutIndex;
|
|
122545
122568
|
case 1 /* Index */:
|
|
122546
122569
|
return noExtension;
|
|
122547
122570
|
case 2 /* JsExtension */:
|
|
@@ -14,7 +14,7 @@ and limitations under the License.
|
|
|
14
14
|
***************************************************************************** */
|
|
15
15
|
|
|
16
16
|
declare namespace ts {
|
|
17
|
-
const versionMajorMinor = "4.
|
|
17
|
+
const versionMajorMinor = "4.8";
|
|
18
18
|
/** The version of the TypeScript compiler release */
|
|
19
19
|
const version: string;
|
|
20
20
|
/**
|