typescript 5.1.0-dev.20230319 → 5.1.0-dev.20230321
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/lib.decorators.legacy.d.ts +1 -1
- package/lib/tsc.js +459 -560
- package/lib/tsserver.js +699 -771
- package/lib/tsserverlibrary.d.ts +6 -6
- package/lib/tsserverlibrary.js +710 -790
- package/lib/typescript.d.ts +6 -6
- package/lib/typescript.js +705 -786
- package/lib/typingsInstaller.js +75 -256
- package/package.json +2 -2
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.1";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230321`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -3117,7 +3117,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3117
3117
|
TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
|
|
3118
3118
|
TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
|
|
3119
3119
|
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
|
|
3120
|
-
TypeFlags2[TypeFlags2["ObjectFlagsType"] =
|
|
3120
|
+
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
|
|
3121
3121
|
TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
|
|
3122
3122
|
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
|
|
3123
3123
|
TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
|
|
@@ -6459,13 +6459,14 @@ var Diagnostics = {
|
|
|
6459
6459
|
Output_Formatting: diag(6256, 3 /* Message */, "Output_Formatting_6256", "Output Formatting"),
|
|
6460
6460
|
Completeness: diag(6257, 3 /* Message */, "Completeness_6257", "Completeness"),
|
|
6461
6461
|
_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file: diag(6258, 1 /* Error */, "_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file_6258", "'{0}' should be set inside the 'compilerOptions' object of the config json file"),
|
|
6462
|
-
|
|
6462
|
+
Found_1_error_in_0: diag(6259, 3 /* Message */, "Found_1_error_in_0_6259", "Found 1 error in {0}"),
|
|
6463
6463
|
Found_0_errors_in_the_same_file_starting_at_Colon_1: diag(6260, 3 /* Message */, "Found_0_errors_in_the_same_file_starting_at_Colon_1_6260", "Found {0} errors in the same file, starting at: {1}"),
|
|
6464
6464
|
Found_0_errors_in_1_files: diag(6261, 3 /* Message */, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
6465
6465
|
File_name_0_has_a_1_extension_looking_up_2_instead: diag(6262, 3 /* Message */, "File_name_0_has_a_1_extension_looking_up_2_instead_6262", "File name '{0}' has a '{1}' extension - looking up '{2}' instead."),
|
|
6466
6466
|
Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set: diag(6263, 1 /* Error */, "Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set_6263", "Module '{0}' was resolved to '{1}', but '--allowArbitraryExtensions' is not set."),
|
|
6467
6467
|
Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present: diag(6264, 3 /* Message */, "Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present_6264", "Enable importing files with any extension, provided a declaration file is present."),
|
|
6468
6468
|
Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder: diag(6265, 3 /* Message */, "Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_no_6265", "Resolving type reference directive for program that specifies custom typeRoots, skipping lookup in 'node_modules' folder."),
|
|
6469
|
+
Option_0_can_only_be_specified_on_command_line: diag(6266, 1 /* Error */, "Option_0_can_only_be_specified_on_command_line_6266", "Option '{0}' can only be specified on command line."),
|
|
6469
6470
|
Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, 3 /* Message */, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
|
|
6470
6471
|
Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, 3 /* Message */, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
6471
6472
|
Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, 3 /* Message */, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
|
|
@@ -10058,9 +10059,9 @@ function tryGetTextOfPropertyName(name) {
|
|
|
10058
10059
|
function getTextOfPropertyName(name) {
|
|
10059
10060
|
return Debug.checkDefined(tryGetTextOfPropertyName(name));
|
|
10060
10061
|
}
|
|
10061
|
-
function createDiagnosticForNodeInSourceFile(sourceFile, node, message,
|
|
10062
|
+
function createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) {
|
|
10062
10063
|
const span = getErrorSpanForNode(sourceFile, node);
|
|
10063
|
-
return createFileDiagnostic(sourceFile, span.start, span.length, message,
|
|
10064
|
+
return createFileDiagnostic(sourceFile, span.start, span.length, message, ...args);
|
|
10064
10065
|
}
|
|
10065
10066
|
function assertDiagnosticLocation(file, start, length2) {
|
|
10066
10067
|
Debug.assertGreaterThanOrEqual(start, 0);
|
|
@@ -10493,6 +10494,12 @@ function skipParentheses(node, excludeJSDocTypeAssertions) {
|
|
|
10493
10494
|
function isKeyword(token) {
|
|
10494
10495
|
return 82 /* FirstKeyword */ <= token && token <= 163 /* LastKeyword */;
|
|
10495
10496
|
}
|
|
10497
|
+
function isPunctuation(token) {
|
|
10498
|
+
return 18 /* FirstPunctuation */ <= token && token <= 78 /* LastPunctuation */;
|
|
10499
|
+
}
|
|
10500
|
+
function isKeywordOrPunctuation(token) {
|
|
10501
|
+
return isKeyword(token) || isPunctuation(token);
|
|
10502
|
+
}
|
|
10496
10503
|
function isStringOrNumericLiteralLike(node) {
|
|
10497
10504
|
return isStringLiteralLike(node) || isNumericLiteral(node);
|
|
10498
10505
|
}
|
|
@@ -18124,14 +18131,12 @@ var Parser;
|
|
|
18124
18131
|
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
|
|
18125
18132
|
if (scriptKind2 === 6 /* JSON */) {
|
|
18126
18133
|
const result2 = parseJsonText2(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes);
|
|
18127
|
-
|
|
18134
|
+
convertToJson(
|
|
18128
18135
|
result2,
|
|
18129
18136
|
(_a2 = result2.statements[0]) == null ? void 0 : _a2.expression,
|
|
18130
18137
|
result2.parseDiagnostics,
|
|
18131
18138
|
/*returnValue*/
|
|
18132
18139
|
false,
|
|
18133
|
-
/*knownRootOptions*/
|
|
18134
|
-
void 0,
|
|
18135
18140
|
/*jsonConversionNotifier*/
|
|
18136
18141
|
void 0
|
|
18137
18142
|
);
|
|
@@ -18563,24 +18568,24 @@ var Parser;
|
|
|
18563
18568
|
function inAwaitContext() {
|
|
18564
18569
|
return inContext(32768 /* AwaitContext */);
|
|
18565
18570
|
}
|
|
18566
|
-
function parseErrorAtCurrentToken(message,
|
|
18567
|
-
return parseErrorAt(scanner.getTokenStart(), scanner.getTokenEnd(), message,
|
|
18571
|
+
function parseErrorAtCurrentToken(message, ...args) {
|
|
18572
|
+
return parseErrorAt(scanner.getTokenStart(), scanner.getTokenEnd(), message, ...args);
|
|
18568
18573
|
}
|
|
18569
|
-
function parseErrorAtPosition(start, length2, message,
|
|
18574
|
+
function parseErrorAtPosition(start, length2, message, ...args) {
|
|
18570
18575
|
const lastError = lastOrUndefined(parseDiagnostics);
|
|
18571
18576
|
let result;
|
|
18572
18577
|
if (!lastError || start !== lastError.start) {
|
|
18573
|
-
result = createDetachedDiagnostic(fileName, start, length2, message,
|
|
18578
|
+
result = createDetachedDiagnostic(fileName, start, length2, message, ...args);
|
|
18574
18579
|
parseDiagnostics.push(result);
|
|
18575
18580
|
}
|
|
18576
18581
|
parseErrorBeforeNextFinishedNode = true;
|
|
18577
18582
|
return result;
|
|
18578
18583
|
}
|
|
18579
|
-
function parseErrorAt(start, end, message,
|
|
18580
|
-
return parseErrorAtPosition(start, end - start, message,
|
|
18584
|
+
function parseErrorAt(start, end, message, ...args) {
|
|
18585
|
+
return parseErrorAtPosition(start, end - start, message, ...args);
|
|
18581
18586
|
}
|
|
18582
|
-
function parseErrorAtRange(range, message,
|
|
18583
|
-
parseErrorAt(range.pos, range.end, message,
|
|
18587
|
+
function parseErrorAtRange(range, message, ...args) {
|
|
18588
|
+
parseErrorAt(range.pos, range.end, message, ...args);
|
|
18584
18589
|
}
|
|
18585
18590
|
function scanError(message, length2) {
|
|
18586
18591
|
parseErrorAtPosition(scanner.getTokenEnd(), length2, message);
|
|
@@ -18786,6 +18791,7 @@ var Parser;
|
|
|
18786
18791
|
nextTokenJSDoc();
|
|
18787
18792
|
return true;
|
|
18788
18793
|
}
|
|
18794
|
+
Debug.assert(isKeywordOrPunctuation(kind));
|
|
18789
18795
|
parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(kind));
|
|
18790
18796
|
return false;
|
|
18791
18797
|
}
|
|
@@ -18834,7 +18840,11 @@ var Parser;
|
|
|
18834
18840
|
);
|
|
18835
18841
|
}
|
|
18836
18842
|
function parseExpectedTokenJSDoc(t) {
|
|
18837
|
-
|
|
18843
|
+
const optional = parseOptionalTokenJSDoc(t);
|
|
18844
|
+
if (optional)
|
|
18845
|
+
return optional;
|
|
18846
|
+
Debug.assert(isKeywordOrPunctuation(t));
|
|
18847
|
+
return createMissingNode(
|
|
18838
18848
|
t,
|
|
18839
18849
|
/*reportAtCurrentPosition*/
|
|
18840
18850
|
false,
|
|
@@ -18888,11 +18898,11 @@ var Parser;
|
|
|
18888
18898
|
}
|
|
18889
18899
|
return node;
|
|
18890
18900
|
}
|
|
18891
|
-
function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage,
|
|
18901
|
+
function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, ...args) {
|
|
18892
18902
|
if (reportAtCurrentPosition) {
|
|
18893
|
-
parseErrorAtPosition(scanner.getTokenFullStart(), 0, diagnosticMessage,
|
|
18903
|
+
parseErrorAtPosition(scanner.getTokenFullStart(), 0, diagnosticMessage, ...args);
|
|
18894
18904
|
} else if (diagnosticMessage) {
|
|
18895
|
-
parseErrorAtCurrentToken(diagnosticMessage,
|
|
18905
|
+
parseErrorAtCurrentToken(diagnosticMessage, ...args);
|
|
18896
18906
|
}
|
|
18897
18907
|
const pos = getNodePos();
|
|
18898
18908
|
const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier(
|
|
@@ -21251,6 +21261,7 @@ var Parser;
|
|
|
21251
21261
|
if (simpleUnaryExpression.kind === 214 /* TypeAssertionExpression */) {
|
|
21252
21262
|
parseErrorAt(pos, end, Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
|
|
21253
21263
|
} else {
|
|
21264
|
+
Debug.assert(isKeywordOrPunctuation(unaryOperator));
|
|
21254
21265
|
parseErrorAt(pos, end, Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, tokenToString(unaryOperator));
|
|
21255
21266
|
}
|
|
21256
21267
|
}
|
|
@@ -24198,14 +24209,14 @@ var Parser;
|
|
|
24198
24209
|
}
|
|
24199
24210
|
function parseReturnTag(start2, tagName, indent2, indentText) {
|
|
24200
24211
|
if (some(tags, isJSDocReturnTag)) {
|
|
24201
|
-
parseErrorAt(tagName.pos, scanner.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
|
|
24212
|
+
parseErrorAt(tagName.pos, scanner.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText));
|
|
24202
24213
|
}
|
|
24203
24214
|
const typeExpression = tryParseTypeExpression();
|
|
24204
24215
|
return finishNode(factory2.createJSDocReturnTag(tagName, typeExpression, parseTrailingTagComments(start2, getNodePos(), indent2, indentText)), start2);
|
|
24205
24216
|
}
|
|
24206
24217
|
function parseTypeTag(start2, tagName, indent2, indentText) {
|
|
24207
24218
|
if (some(tags, isJSDocTypeTag)) {
|
|
24208
|
-
parseErrorAt(tagName.pos, scanner.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
|
|
24219
|
+
parseErrorAt(tagName.pos, scanner.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText));
|
|
24209
24220
|
}
|
|
24210
24221
|
const typeExpression = parseJSDocTypeExpression(
|
|
24211
24222
|
/*mayOmitBraces*/
|
|
@@ -25175,11 +25186,6 @@ function tagNamesAreEquivalent(lhs, rhs) {
|
|
|
25175
25186
|
}
|
|
25176
25187
|
|
|
25177
25188
|
// src/compiler/commandLineParser.ts
|
|
25178
|
-
var compileOnSaveCommandLineOption = {
|
|
25179
|
-
name: "compileOnSave",
|
|
25180
|
-
type: "boolean",
|
|
25181
|
-
defaultValueDescription: false
|
|
25182
|
-
};
|
|
25183
25189
|
var jsxOptionMap = new Map(Object.entries({
|
|
25184
25190
|
"preserve": 1 /* Preserve */,
|
|
25185
25191
|
"react-native": 3 /* ReactNative */,
|
|
@@ -26652,22 +26658,9 @@ var defaultInitCompilerOptions = {
|
|
|
26652
26658
|
forceConsistentCasingInFileNames: true,
|
|
26653
26659
|
skipLibCheck: true
|
|
26654
26660
|
};
|
|
26655
|
-
function createDiagnosticForInvalidCustomType(opt, createDiagnostic) {
|
|
26656
|
-
const namesOfType = arrayFrom(opt.type.keys());
|
|
26657
|
-
const stringNames = (opt.deprecatedKeys ? namesOfType.filter((k) => !opt.deprecatedKeys.has(k)) : namesOfType).map((key) => `'${key}'`).join(", ");
|
|
26658
|
-
return createDiagnostic(Diagnostics.Argument_for_0_option_must_be_Colon_1, `--${opt.name}`, stringNames);
|
|
26659
|
-
}
|
|
26660
26661
|
function getOptionName(option) {
|
|
26661
26662
|
return option.name;
|
|
26662
26663
|
}
|
|
26663
|
-
function createUnknownOptionError(unknownOption, diagnostics, createDiagnostics, unknownOptionErrorText) {
|
|
26664
|
-
var _a2;
|
|
26665
|
-
if ((_a2 = diagnostics.alternateMode) == null ? void 0 : _a2.getOptionsNameMap().optionsNameMap.has(unknownOption.toLowerCase())) {
|
|
26666
|
-
return createDiagnostics(diagnostics.alternateMode.diagnostic, unknownOption);
|
|
26667
|
-
}
|
|
26668
|
-
const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
|
|
26669
|
-
return possibleOption ? createDiagnostics(diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnostics(diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
|
|
26670
|
-
}
|
|
26671
26664
|
var compilerOptionsDidYouMeanDiagnostics = {
|
|
26672
26665
|
alternateMode: compilerOptionsAlternateMode,
|
|
26673
26666
|
getOptionsNameMap,
|
|
@@ -26702,9 +26695,7 @@ function parseConfigFileTextToJson(fileName, jsonText) {
|
|
|
26702
26695
|
config: convertConfigFileToObject(
|
|
26703
26696
|
jsonSourceFile,
|
|
26704
26697
|
jsonSourceFile.parseDiagnostics,
|
|
26705
|
-
/*
|
|
26706
|
-
false,
|
|
26707
|
-
/*optionsIterator*/
|
|
26698
|
+
/*jsonConversionNotifier*/
|
|
26708
26699
|
void 0
|
|
26709
26700
|
),
|
|
26710
26701
|
error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
|
|
@@ -26757,83 +26748,30 @@ var extendsOptionDeclaration = {
|
|
|
26757
26748
|
name: "extends",
|
|
26758
26749
|
type: "string"
|
|
26759
26750
|
},
|
|
26760
|
-
category: Diagnostics.File_Management
|
|
26751
|
+
category: Diagnostics.File_Management,
|
|
26752
|
+
disallowNullOrUndefined: true
|
|
26761
26753
|
};
|
|
26762
|
-
var
|
|
26763
|
-
|
|
26764
|
-
|
|
26765
|
-
|
|
26766
|
-
|
|
26767
|
-
|
|
26768
|
-
|
|
26769
|
-
|
|
26770
|
-
|
|
26771
|
-
|
|
26772
|
-
|
|
26773
|
-
|
|
26774
|
-
|
|
26775
|
-
|
|
26776
|
-
|
|
26777
|
-
|
|
26778
|
-
|
|
26779
|
-
|
|
26780
|
-
|
|
26781
|
-
},
|
|
26782
|
-
{
|
|
26783
|
-
name: "typeAcquisition",
|
|
26784
|
-
type: "object",
|
|
26785
|
-
elementOptions: getCommandLineTypeAcquisitionMap(),
|
|
26786
|
-
extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
|
|
26787
|
-
},
|
|
26788
|
-
extendsOptionDeclaration,
|
|
26789
|
-
{
|
|
26790
|
-
name: "references",
|
|
26791
|
-
type: "list",
|
|
26792
|
-
element: {
|
|
26793
|
-
name: "references",
|
|
26794
|
-
type: "object"
|
|
26795
|
-
},
|
|
26796
|
-
category: Diagnostics.Projects
|
|
26797
|
-
},
|
|
26798
|
-
{
|
|
26799
|
-
name: "files",
|
|
26800
|
-
type: "list",
|
|
26801
|
-
element: {
|
|
26802
|
-
name: "files",
|
|
26803
|
-
type: "string"
|
|
26804
|
-
},
|
|
26805
|
-
category: Diagnostics.File_Management
|
|
26806
|
-
},
|
|
26807
|
-
{
|
|
26808
|
-
name: "include",
|
|
26809
|
-
type: "list",
|
|
26810
|
-
element: {
|
|
26811
|
-
name: "include",
|
|
26812
|
-
type: "string"
|
|
26813
|
-
},
|
|
26814
|
-
category: Diagnostics.File_Management,
|
|
26815
|
-
defaultValueDescription: Diagnostics.if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk
|
|
26816
|
-
},
|
|
26817
|
-
{
|
|
26818
|
-
name: "exclude",
|
|
26819
|
-
type: "list",
|
|
26820
|
-
element: {
|
|
26821
|
-
name: "exclude",
|
|
26822
|
-
type: "string"
|
|
26823
|
-
},
|
|
26824
|
-
category: Diagnostics.File_Management,
|
|
26825
|
-
defaultValueDescription: Diagnostics.node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified
|
|
26826
|
-
},
|
|
26827
|
-
compileOnSaveCommandLineOption
|
|
26828
|
-
])
|
|
26829
|
-
};
|
|
26830
|
-
}
|
|
26831
|
-
return _tsconfigRootOptions;
|
|
26832
|
-
}
|
|
26833
|
-
function convertConfigFileToObject(sourceFile, errors, reportOptionsErrors, optionsIterator) {
|
|
26754
|
+
var compilerOptionsDeclaration = {
|
|
26755
|
+
name: "compilerOptions",
|
|
26756
|
+
type: "object",
|
|
26757
|
+
elementOptions: getCommandLineCompilerOptionsMap(),
|
|
26758
|
+
extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics
|
|
26759
|
+
};
|
|
26760
|
+
var watchOptionsDeclaration = {
|
|
26761
|
+
name: "watchOptions",
|
|
26762
|
+
type: "object",
|
|
26763
|
+
elementOptions: getCommandLineWatchOptionsMap(),
|
|
26764
|
+
extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics
|
|
26765
|
+
};
|
|
26766
|
+
var typeAcquisitionDeclaration = {
|
|
26767
|
+
name: "typeAcquisition",
|
|
26768
|
+
type: "object",
|
|
26769
|
+
elementOptions: getCommandLineTypeAcquisitionMap(),
|
|
26770
|
+
extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
|
|
26771
|
+
};
|
|
26772
|
+
function convertConfigFileToObject(sourceFile, errors, jsonConversionNotifier) {
|
|
26834
26773
|
var _a2;
|
|
26835
26774
|
const rootExpression = (_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression;
|
|
26836
|
-
const knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : void 0;
|
|
26837
26775
|
if (rootExpression && rootExpression.kind !== 208 /* ObjectLiteralExpression */) {
|
|
26838
26776
|
errors.push(createDiagnosticForNodeInSourceFile(
|
|
26839
26777
|
sourceFile,
|
|
@@ -26844,38 +26782,34 @@ function convertConfigFileToObject(sourceFile, errors, reportOptionsErrors, opti
|
|
|
26844
26782
|
if (isArrayLiteralExpression(rootExpression)) {
|
|
26845
26783
|
const firstObject = find(rootExpression.elements, isObjectLiteralExpression);
|
|
26846
26784
|
if (firstObject) {
|
|
26847
|
-
return
|
|
26785
|
+
return convertToJson(
|
|
26848
26786
|
sourceFile,
|
|
26849
26787
|
firstObject,
|
|
26850
26788
|
errors,
|
|
26851
26789
|
/*returnValue*/
|
|
26852
26790
|
true,
|
|
26853
|
-
|
|
26854
|
-
optionsIterator
|
|
26791
|
+
jsonConversionNotifier
|
|
26855
26792
|
);
|
|
26856
26793
|
}
|
|
26857
26794
|
}
|
|
26858
26795
|
return {};
|
|
26859
26796
|
}
|
|
26860
|
-
return
|
|
26797
|
+
return convertToJson(
|
|
26861
26798
|
sourceFile,
|
|
26862
26799
|
rootExpression,
|
|
26863
26800
|
errors,
|
|
26864
26801
|
/*returnValue*/
|
|
26865
26802
|
true,
|
|
26866
|
-
|
|
26867
|
-
optionsIterator
|
|
26803
|
+
jsonConversionNotifier
|
|
26868
26804
|
);
|
|
26869
26805
|
}
|
|
26870
|
-
function
|
|
26806
|
+
function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConversionNotifier) {
|
|
26871
26807
|
if (!rootExpression) {
|
|
26872
26808
|
return returnValue ? {} : void 0;
|
|
26873
26809
|
}
|
|
26874
|
-
return convertPropertyValueToJson(rootExpression,
|
|
26875
|
-
function
|
|
26876
|
-
|
|
26877
|
-
}
|
|
26878
|
-
function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) {
|
|
26810
|
+
return convertPropertyValueToJson(rootExpression, jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.rootOptions);
|
|
26811
|
+
function convertObjectLiteralExpressionToJson(node, objectOption) {
|
|
26812
|
+
var _a2;
|
|
26879
26813
|
const result = returnValue ? {} : void 0;
|
|
26880
26814
|
for (const element of node.properties) {
|
|
26881
26815
|
if (element.kind !== 300 /* PropertyAssignment */) {
|
|
@@ -26890,38 +26824,13 @@ function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue,
|
|
|
26890
26824
|
}
|
|
26891
26825
|
const textOfKey = isComputedNonLiteralName(element.name) ? void 0 : getTextOfPropertyName(element.name);
|
|
26892
26826
|
const keyText = textOfKey && unescapeLeadingUnderscores(textOfKey);
|
|
26893
|
-
const option = keyText
|
|
26894
|
-
if (keyText && extraKeyDiagnostics && !option) {
|
|
26895
|
-
if (knownOptions) {
|
|
26896
|
-
errors.push(createUnknownOptionError(
|
|
26897
|
-
keyText,
|
|
26898
|
-
extraKeyDiagnostics,
|
|
26899
|
-
(message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, element.name, message, arg0, arg1)
|
|
26900
|
-
));
|
|
26901
|
-
} else {
|
|
26902
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
|
|
26903
|
-
}
|
|
26904
|
-
}
|
|
26827
|
+
const option = keyText ? (_a2 = objectOption == null ? void 0 : objectOption.elementOptions) == null ? void 0 : _a2.get(keyText) : void 0;
|
|
26905
26828
|
const value = convertPropertyValueToJson(element.initializer, option);
|
|
26906
26829
|
if (typeof keyText !== "undefined") {
|
|
26907
26830
|
if (returnValue) {
|
|
26908
26831
|
result[keyText] = value;
|
|
26909
26832
|
}
|
|
26910
|
-
|
|
26911
|
-
(parentOption || isRootOptionMap(knownOptions))) {
|
|
26912
|
-
const isValidOptionValue = isCompilerOptionsValue(option, value);
|
|
26913
|
-
if (parentOption) {
|
|
26914
|
-
if (isValidOptionValue) {
|
|
26915
|
-
jsonConversionNotifier.onSetValidOptionKeyValueInParent(parentOption, option, value);
|
|
26916
|
-
}
|
|
26917
|
-
} else if (isRootOptionMap(knownOptions)) {
|
|
26918
|
-
if (isValidOptionValue) {
|
|
26919
|
-
jsonConversionNotifier.onSetValidOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
|
|
26920
|
-
} else if (!option) {
|
|
26921
|
-
jsonConversionNotifier.onSetUnknownOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
|
|
26922
|
-
}
|
|
26923
|
-
}
|
|
26924
|
-
}
|
|
26833
|
+
jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.onPropertySet(keyText, value, element, objectOption, option);
|
|
26925
26834
|
}
|
|
26926
26835
|
}
|
|
26927
26836
|
return result;
|
|
@@ -26934,112 +26843,40 @@ function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue,
|
|
|
26934
26843
|
return filter(elements.map((element) => convertPropertyValueToJson(element, elementOption)), (v) => v !== void 0);
|
|
26935
26844
|
}
|
|
26936
26845
|
function convertPropertyValueToJson(valueExpression, option) {
|
|
26937
|
-
let invalidReported;
|
|
26938
26846
|
switch (valueExpression.kind) {
|
|
26939
26847
|
case 111 /* TrueKeyword */:
|
|
26940
|
-
|
|
26941
|
-
return validateValue(
|
|
26942
|
-
/*value*/
|
|
26943
|
-
true
|
|
26944
|
-
);
|
|
26848
|
+
return true;
|
|
26945
26849
|
case 96 /* FalseKeyword */:
|
|
26946
|
-
|
|
26947
|
-
return validateValue(
|
|
26948
|
-
/*value*/
|
|
26949
|
-
false
|
|
26950
|
-
);
|
|
26850
|
+
return false;
|
|
26951
26851
|
case 105 /* NullKeyword */:
|
|
26952
|
-
|
|
26953
|
-
return validateValue(
|
|
26954
|
-
/*value*/
|
|
26955
|
-
null
|
|
26956
|
-
);
|
|
26852
|
+
return null;
|
|
26957
26853
|
case 10 /* StringLiteral */:
|
|
26958
26854
|
if (!isDoubleQuotedString(valueExpression)) {
|
|
26959
26855
|
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected));
|
|
26960
26856
|
}
|
|
26961
|
-
|
|
26962
|
-
const text = valueExpression.text;
|
|
26963
|
-
if (option) {
|
|
26964
|
-
Debug.assert(option.type !== "listOrElement" || option.element.type === "string", "Only string or array of string is handled for now");
|
|
26965
|
-
}
|
|
26966
|
-
if (option && !isString(option.type)) {
|
|
26967
|
-
const customOption = option;
|
|
26968
|
-
if (!customOption.type.has(text.toLowerCase())) {
|
|
26969
|
-
errors.push(
|
|
26970
|
-
createDiagnosticForInvalidCustomType(
|
|
26971
|
-
customOption,
|
|
26972
|
-
(message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, message, arg0, arg1)
|
|
26973
|
-
)
|
|
26974
|
-
);
|
|
26975
|
-
invalidReported = true;
|
|
26976
|
-
}
|
|
26977
|
-
}
|
|
26978
|
-
return validateValue(text);
|
|
26857
|
+
return valueExpression.text;
|
|
26979
26858
|
case 8 /* NumericLiteral */:
|
|
26980
|
-
|
|
26981
|
-
return validateValue(Number(valueExpression.text));
|
|
26859
|
+
return Number(valueExpression.text);
|
|
26982
26860
|
case 222 /* PrefixUnaryExpression */:
|
|
26983
26861
|
if (valueExpression.operator !== 40 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) {
|
|
26984
26862
|
break;
|
|
26985
26863
|
}
|
|
26986
|
-
|
|
26987
|
-
return validateValue(-Number(valueExpression.operand.text));
|
|
26864
|
+
return -Number(valueExpression.operand.text);
|
|
26988
26865
|
case 208 /* ObjectLiteralExpression */:
|
|
26989
|
-
reportInvalidOptionValue(option && option.type !== "object" && (option.type !== "listOrElement" || option.element.type !== "object"));
|
|
26990
26866
|
const objectLiteralExpression = valueExpression;
|
|
26991
|
-
|
|
26992
|
-
const { elementOptions, extraKeyDiagnostics, name: optionName } = option;
|
|
26993
|
-
return validateValue(convertObjectLiteralExpressionToJson(
|
|
26994
|
-
objectLiteralExpression,
|
|
26995
|
-
elementOptions,
|
|
26996
|
-
extraKeyDiagnostics,
|
|
26997
|
-
optionName
|
|
26998
|
-
));
|
|
26999
|
-
} else {
|
|
27000
|
-
return validateValue(convertObjectLiteralExpressionToJson(
|
|
27001
|
-
objectLiteralExpression,
|
|
27002
|
-
/* knownOptions*/
|
|
27003
|
-
void 0,
|
|
27004
|
-
/*extraKeyDiagnosticMessage */
|
|
27005
|
-
void 0,
|
|
27006
|
-
/*parentOption*/
|
|
27007
|
-
void 0
|
|
27008
|
-
));
|
|
27009
|
-
}
|
|
26867
|
+
return convertObjectLiteralExpressionToJson(objectLiteralExpression, option);
|
|
27010
26868
|
case 207 /* ArrayLiteralExpression */:
|
|
27011
|
-
|
|
27012
|
-
return validateValue(convertArrayLiteralExpressionToJson(
|
|
26869
|
+
return convertArrayLiteralExpressionToJson(
|
|
27013
26870
|
valueExpression.elements,
|
|
27014
26871
|
option && option.element
|
|
27015
|
-
)
|
|
26872
|
+
);
|
|
27016
26873
|
}
|
|
27017
26874
|
if (option) {
|
|
27018
|
-
|
|
27019
|
-
/*isError*/
|
|
27020
|
-
true
|
|
27021
|
-
);
|
|
26875
|
+
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
|
|
27022
26876
|
} else {
|
|
27023
26877
|
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal));
|
|
27024
26878
|
}
|
|
27025
26879
|
return void 0;
|
|
27026
|
-
function validateValue(value) {
|
|
27027
|
-
var _a2;
|
|
27028
|
-
if (!invalidReported) {
|
|
27029
|
-
const diagnostic = (_a2 = option == null ? void 0 : option.extraValidation) == null ? void 0 : _a2.call(option, value);
|
|
27030
|
-
if (diagnostic) {
|
|
27031
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ...diagnostic));
|
|
27032
|
-
return void 0;
|
|
27033
|
-
}
|
|
27034
|
-
}
|
|
27035
|
-
return value;
|
|
27036
|
-
}
|
|
27037
|
-
function reportInvalidOptionValue(isError) {
|
|
27038
|
-
if (isError) {
|
|
27039
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
|
|
27040
|
-
invalidReported = true;
|
|
27041
|
-
}
|
|
27042
|
-
}
|
|
27043
26880
|
}
|
|
27044
26881
|
function isDoubleQuotedString(node) {
|
|
27045
26882
|
return isStringLiteral(node) && isStringDoubleQuoted(node, sourceFile);
|
|
@@ -27048,24 +26885,6 @@ function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue,
|
|
|
27048
26885
|
function getCompilerOptionValueTypeString(option) {
|
|
27049
26886
|
return option.type === "listOrElement" ? `${getCompilerOptionValueTypeString(option.element)} or Array` : option.type === "list" ? "Array" : isString(option.type) ? option.type : "string";
|
|
27050
26887
|
}
|
|
27051
|
-
function isCompilerOptionsValue(option, value) {
|
|
27052
|
-
if (option) {
|
|
27053
|
-
if (isNullOrUndefined(value))
|
|
27054
|
-
return true;
|
|
27055
|
-
if (option.type === "list") {
|
|
27056
|
-
return isArray(value);
|
|
27057
|
-
}
|
|
27058
|
-
if (option.type === "listOrElement") {
|
|
27059
|
-
return isArray(value) || isCompilerOptionsValue(option.element, value);
|
|
27060
|
-
}
|
|
27061
|
-
const expectedType = isString(option.type) ? option.type : "string";
|
|
27062
|
-
return typeof value === expectedType;
|
|
27063
|
-
}
|
|
27064
|
-
return false;
|
|
27065
|
-
}
|
|
27066
|
-
function isNullOrUndefined(x) {
|
|
27067
|
-
return x === void 0 || x === null;
|
|
27068
|
-
}
|
|
27069
26888
|
var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/;
|
|
27070
26889
|
function invalidDotDotAfterRecursiveWildcard(s) {
|
|
27071
26890
|
const wildcardIndex = startsWith(s, "**/") ? 0 : s.indexOf("/**/");
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.1.0-dev.
|
|
5
|
+
"version": "5.1.0-dev.20230321",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "14.21.1",
|
|
114
114
|
"npm": "8.19.3"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "f218a562bfb417ecec263fc96d7a7a71abf96268"
|
|
117
117
|
}
|