typescript 4.6.0-dev.20220111 → 4.6.0-dev.20220115
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 +341 -118
- package/lib/tsserver.js +553 -224
- package/lib/tsserverlibrary.js +553 -224
- package/lib/typescript.js +499 -203
- package/lib/typescriptServices.js +499 -203
- package/lib/typingsInstaller.js +421 -144
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.6";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220115";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
function tryGetNativeMap() {
|
|
@@ -5502,7 +5502,7 @@ var ts;
|
|
|
5502
5502
|
Parameter_0_cannot_reference_identifier_1_declared_after_it: diag(2373, ts.DiagnosticCategory.Error, "Parameter_0_cannot_reference_identifier_1_declared_after_it_2373", "Parameter '{0}' cannot reference identifier '{1}' declared after it."),
|
|
5503
5503
|
Duplicate_index_signature_for_type_0: diag(2374, ts.DiagnosticCategory.Error, "Duplicate_index_signature_for_type_0_2374", "Duplicate index signature for type '{0}'."),
|
|
5504
5504
|
Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2375, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2375", "Type '{0}' is not assignable to type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),
|
|
5505
|
-
|
|
5505
|
+
A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers: diag(2376, ts.DiagnosticCategory.Error, "A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_2376", "A 'super' call must be the first statement in the constructor to refer to 'super' or 'this' when a derived class contains initialized properties, parameter properties, or private identifiers."),
|
|
5506
5506
|
Constructors_for_derived_classes_must_contain_a_super_call: diag(2377, ts.DiagnosticCategory.Error, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."),
|
|
5507
5507
|
A_get_accessor_must_return_a_value: diag(2378, ts.DiagnosticCategory.Error, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."),
|
|
5508
5508
|
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2379, ts.DiagnosticCategory.Error, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379", "Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),
|
|
@@ -5525,6 +5525,7 @@ var ts;
|
|
|
5525
5525
|
constructor_cannot_be_used_as_a_parameter_property_name: diag(2398, ts.DiagnosticCategory.Error, "constructor_cannot_be_used_as_a_parameter_property_name_2398", "'constructor' cannot be used as a parameter property name."),
|
|
5526
5526
|
Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: diag(2399, ts.DiagnosticCategory.Error, "Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399", "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference."),
|
|
5527
5527
|
Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: diag(2400, ts.DiagnosticCategory.Error, "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400", "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference."),
|
|
5528
|
+
A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers: diag(2401, ts.DiagnosticCategory.Error, "A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_in_2401", "A 'super' call must be a root-level statement within a constructor of a derived class that contains initialized properties, parameter properties, or private identifiers."),
|
|
5528
5529
|
Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: diag(2402, ts.DiagnosticCategory.Error, "Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402", "Expression resolves to '_super' that compiler uses to capture base class reference."),
|
|
5529
5530
|
Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: diag(2403, ts.DiagnosticCategory.Error, "Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403", "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'."),
|
|
5530
5531
|
The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: diag(2404, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", "The left-hand side of a 'for...in' statement cannot use a type annotation."),
|
|
@@ -11924,6 +11925,28 @@ var ts;
|
|
|
11924
11925
|
}
|
|
11925
11926
|
}
|
|
11926
11927
|
ts.getThisContainer = getThisContainer;
|
|
11928
|
+
function isThisContainerOrFunctionBlock(node) {
|
|
11929
|
+
switch (node.kind) {
|
|
11930
|
+
case 213:
|
|
11931
|
+
case 255:
|
|
11932
|
+
case 212:
|
|
11933
|
+
case 166:
|
|
11934
|
+
return true;
|
|
11935
|
+
case 234:
|
|
11936
|
+
switch (node.parent.kind) {
|
|
11937
|
+
case 170:
|
|
11938
|
+
case 168:
|
|
11939
|
+
case 171:
|
|
11940
|
+
case 172:
|
|
11941
|
+
return true;
|
|
11942
|
+
default:
|
|
11943
|
+
return false;
|
|
11944
|
+
}
|
|
11945
|
+
default:
|
|
11946
|
+
return false;
|
|
11947
|
+
}
|
|
11948
|
+
}
|
|
11949
|
+
ts.isThisContainerOrFunctionBlock = isThisContainerOrFunctionBlock;
|
|
11927
11950
|
function isInTopLevelContext(node) {
|
|
11928
11951
|
if (ts.isIdentifier(node) && (ts.isClassDeclaration(node.parent) || ts.isFunctionDeclaration(node.parent)) && node.parent.name === node) {
|
|
11929
11952
|
node = node.parent;
|
|
@@ -15679,16 +15702,6 @@ var ts;
|
|
|
15679
15702
|
(symlinkedDirectories || (symlinkedDirectories = new ts.Map())).set(symlinkPath, real);
|
|
15680
15703
|
}
|
|
15681
15704
|
},
|
|
15682
|
-
setSymlinkedDirectoryFromSymlinkedFile: function (symlink, real) {
|
|
15683
|
-
this.setSymlinkedFile(ts.toPath(symlink, cwd, getCanonicalFileName), real);
|
|
15684
|
-
var _a = guessDirectorySymlink(real, symlink, cwd, getCanonicalFileName) || ts.emptyArray, commonResolved = _a[0], commonOriginal = _a[1];
|
|
15685
|
-
if (commonResolved && commonOriginal) {
|
|
15686
|
-
this.setSymlinkedDirectory(commonOriginal, {
|
|
15687
|
-
real: commonResolved,
|
|
15688
|
-
realPath: ts.toPath(commonResolved, cwd, getCanonicalFileName),
|
|
15689
|
-
});
|
|
15690
|
-
}
|
|
15691
|
-
},
|
|
15692
15705
|
setSymlinksFromResolutions: function (files, typeReferenceDirectives) {
|
|
15693
15706
|
var _this = this;
|
|
15694
15707
|
var _a;
|
|
@@ -20935,7 +20948,7 @@ var ts;
|
|
|
20935
20948
|
return getExportName(node, allowComments, allowSourceMaps);
|
|
20936
20949
|
}
|
|
20937
20950
|
function copyPrologue(source, target, ensureUseStrict, visitor) {
|
|
20938
|
-
var offset = copyStandardPrologue(source, target, ensureUseStrict);
|
|
20951
|
+
var offset = copyStandardPrologue(source, target, 0, ensureUseStrict);
|
|
20939
20952
|
return copyCustomPrologue(source, target, offset, visitor);
|
|
20940
20953
|
}
|
|
20941
20954
|
function isUseStrictPrologue(node) {
|
|
@@ -20944,10 +20957,10 @@ var ts;
|
|
|
20944
20957
|
function createUseStrictPrologue() {
|
|
20945
20958
|
return ts.startOnNewLine(createExpressionStatement(createStringLiteral("use strict")));
|
|
20946
20959
|
}
|
|
20947
|
-
function copyStandardPrologue(source, target, ensureUseStrict) {
|
|
20960
|
+
function copyStandardPrologue(source, target, statementOffset, ensureUseStrict) {
|
|
20961
|
+
if (statementOffset === void 0) { statementOffset = 0; }
|
|
20948
20962
|
ts.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array");
|
|
20949
20963
|
var foundUseStrict = false;
|
|
20950
|
-
var statementOffset = 0;
|
|
20951
20964
|
var numStatements = source.length;
|
|
20952
20965
|
while (statementOffset < numStatements) {
|
|
20953
20966
|
var statement = source[statementOffset];
|
|
@@ -22097,7 +22110,7 @@ var ts;
|
|
|
22097
22110
|
importName: "__createBinding",
|
|
22098
22111
|
scoped: false,
|
|
22099
22112
|
priority: 1,
|
|
22100
|
-
text: "\n var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.
|
|
22113
|
+
text: "\n var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n }) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n }));"
|
|
22101
22114
|
};
|
|
22102
22115
|
ts.setModuleDefaultHelper = {
|
|
22103
22116
|
name: "typescript:commonjscreatevalue",
|
|
@@ -33519,7 +33532,7 @@ var ts;
|
|
|
33519
33532
|
? 1 : 0
|
|
33520
33533
|
};
|
|
33521
33534
|
}
|
|
33522
|
-
if (ts.isImplicitGlob(spec)) {
|
|
33535
|
+
if (ts.isImplicitGlob(spec.substring(spec.lastIndexOf(ts.directorySeparator) + 1))) {
|
|
33523
33536
|
return {
|
|
33524
33537
|
key: useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec),
|
|
33525
33538
|
flags: 1
|
|
@@ -33846,9 +33859,7 @@ var ts;
|
|
|
33846
33859
|
}
|
|
33847
33860
|
}
|
|
33848
33861
|
var failedLookupLocations = [];
|
|
33849
|
-
var features =
|
|
33850
|
-
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
33851
|
-
NodeResolutionFeatures.None;
|
|
33862
|
+
var features = getDefaultNodeResolutionFeatures(options);
|
|
33852
33863
|
var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: features, conditions: ["node", "require", "types"] };
|
|
33853
33864
|
var resolved = primaryLookup();
|
|
33854
33865
|
var primary = true;
|
|
@@ -33931,6 +33942,30 @@ var ts;
|
|
|
33931
33942
|
}
|
|
33932
33943
|
}
|
|
33933
33944
|
ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
|
|
33945
|
+
function getDefaultNodeResolutionFeatures(options) {
|
|
33946
|
+
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 ? NodeResolutionFeatures.Node12Default :
|
|
33947
|
+
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
33948
|
+
NodeResolutionFeatures.None;
|
|
33949
|
+
}
|
|
33950
|
+
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
|
|
33951
|
+
var moduleResolutionState = {
|
|
33952
|
+
compilerOptions: options,
|
|
33953
|
+
host: host,
|
|
33954
|
+
traceEnabled: isTraceEnabled(options, host),
|
|
33955
|
+
failedLookupLocations: [],
|
|
33956
|
+
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
33957
|
+
conditions: ts.emptyArray,
|
|
33958
|
+
features: NodeResolutionFeatures.None,
|
|
33959
|
+
};
|
|
33960
|
+
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
33961
|
+
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
33962
|
+
var nodeModulesFolder = ts.combinePaths(ancestorDirectory, "node_modules");
|
|
33963
|
+
var candidate = ts.combinePaths(nodeModulesFolder, packageName);
|
|
33964
|
+
return getPackageJsonInfo(candidate, false, moduleResolutionState);
|
|
33965
|
+
}
|
|
33966
|
+
});
|
|
33967
|
+
}
|
|
33968
|
+
ts.resolvePackageNameToPackageJson = resolvePackageNameToPackageJson;
|
|
33934
33969
|
function getAutomaticTypeDirectiveNames(options, host) {
|
|
33935
33970
|
if (options.types) {
|
|
33936
33971
|
return options.types;
|
|
@@ -34390,10 +34425,6 @@ var ts;
|
|
|
34390
34425
|
return resolvedModule.resolvedFileName;
|
|
34391
34426
|
}
|
|
34392
34427
|
ts.resolveJSModule = resolveJSModule;
|
|
34393
|
-
function tryResolveJSModule(moduleName, initialDir, host) {
|
|
34394
|
-
return tryResolveJSModuleWorker(moduleName, initialDir, host).resolvedModule;
|
|
34395
|
-
}
|
|
34396
|
-
ts.tryResolveJSModule = tryResolveJSModule;
|
|
34397
34428
|
var NodeResolutionFeatures;
|
|
34398
34429
|
(function (NodeResolutionFeatures) {
|
|
34399
34430
|
NodeResolutionFeatures[NodeResolutionFeatures["None"] = 0] = "None";
|
|
@@ -34667,6 +34698,91 @@ var ts;
|
|
|
34667
34698
|
var versionPaths = packageInfo && packageInfo.versionPaths;
|
|
34668
34699
|
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
|
|
34669
34700
|
}
|
|
34701
|
+
function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) {
|
|
34702
|
+
if (!resolveJs && packageJsonInfo.resolvedEntrypoints !== undefined) {
|
|
34703
|
+
return packageJsonInfo.resolvedEntrypoints;
|
|
34704
|
+
}
|
|
34705
|
+
var entrypoints;
|
|
34706
|
+
var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript;
|
|
34707
|
+
var features = getDefaultNodeResolutionFeatures(options);
|
|
34708
|
+
var requireState = {
|
|
34709
|
+
compilerOptions: options,
|
|
34710
|
+
host: host,
|
|
34711
|
+
traceEnabled: isTraceEnabled(options, host),
|
|
34712
|
+
failedLookupLocations: [],
|
|
34713
|
+
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
34714
|
+
conditions: ["node", "require", "types"],
|
|
34715
|
+
features: features,
|
|
34716
|
+
};
|
|
34717
|
+
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory, false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
34718
|
+
entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
|
|
34719
|
+
if (features & NodeResolutionFeatures.Exports && packageJsonInfo.packageJsonContent.exports) {
|
|
34720
|
+
for (var _i = 0, _a = [["node", "import", "types"], ["node", "require", "types"]]; _i < _a.length; _i++) {
|
|
34721
|
+
var conditions = _a[_i];
|
|
34722
|
+
var exportState = __assign(__assign({}, requireState), { failedLookupLocations: [], conditions: conditions });
|
|
34723
|
+
var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.packageJsonContent.exports, exportState, extensions);
|
|
34724
|
+
if (exportResolutions) {
|
|
34725
|
+
for (var _b = 0, exportResolutions_1 = exportResolutions; _b < exportResolutions_1.length; _b++) {
|
|
34726
|
+
var resolution = exportResolutions_1[_b];
|
|
34727
|
+
entrypoints = ts.appendIfUnique(entrypoints, resolution.path);
|
|
34728
|
+
}
|
|
34729
|
+
}
|
|
34730
|
+
}
|
|
34731
|
+
}
|
|
34732
|
+
return packageJsonInfo.resolvedEntrypoints = entrypoints || false;
|
|
34733
|
+
}
|
|
34734
|
+
ts.getEntrypointsFromPackageJsonInfo = getEntrypointsFromPackageJsonInfo;
|
|
34735
|
+
function loadEntrypointsFromExportMap(scope, exports, state, extensions) {
|
|
34736
|
+
var entrypoints;
|
|
34737
|
+
if (ts.isArray(exports)) {
|
|
34738
|
+
for (var _i = 0, exports_1 = exports; _i < exports_1.length; _i++) {
|
|
34739
|
+
var target = exports_1[_i];
|
|
34740
|
+
loadEntrypointsFromTargetExports(target);
|
|
34741
|
+
}
|
|
34742
|
+
}
|
|
34743
|
+
else if (typeof exports === "object" && exports !== null && allKeysStartWithDot(exports)) {
|
|
34744
|
+
for (var key in exports) {
|
|
34745
|
+
loadEntrypointsFromTargetExports(exports[key]);
|
|
34746
|
+
}
|
|
34747
|
+
}
|
|
34748
|
+
else {
|
|
34749
|
+
loadEntrypointsFromTargetExports(exports);
|
|
34750
|
+
}
|
|
34751
|
+
return entrypoints;
|
|
34752
|
+
function loadEntrypointsFromTargetExports(target) {
|
|
34753
|
+
var _a, _b;
|
|
34754
|
+
if (typeof target === "string" && ts.startsWith(target, "./") && target.indexOf("*") === -1) {
|
|
34755
|
+
var partsAfterFirst = ts.getPathComponents(target).slice(2);
|
|
34756
|
+
if (partsAfterFirst.indexOf("..") >= 0 || partsAfterFirst.indexOf(".") >= 0 || partsAfterFirst.indexOf("node_modules") >= 0) {
|
|
34757
|
+
return false;
|
|
34758
|
+
}
|
|
34759
|
+
var resolvedTarget = ts.combinePaths(scope.packageDirectory, target);
|
|
34760
|
+
var finalPath = ts.getNormalizedAbsolutePath(resolvedTarget, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
34761
|
+
var result = loadJSOrExactTSFileName(extensions, finalPath, false, state);
|
|
34762
|
+
if (result) {
|
|
34763
|
+
entrypoints = ts.appendIfUnique(entrypoints, result, function (a, b) { return a.path === b.path; });
|
|
34764
|
+
return true;
|
|
34765
|
+
}
|
|
34766
|
+
}
|
|
34767
|
+
else if (Array.isArray(target)) {
|
|
34768
|
+
for (var _i = 0, target_1 = target; _i < target_1.length; _i++) {
|
|
34769
|
+
var t = target_1[_i];
|
|
34770
|
+
var success = loadEntrypointsFromTargetExports(t);
|
|
34771
|
+
if (success) {
|
|
34772
|
+
return true;
|
|
34773
|
+
}
|
|
34774
|
+
}
|
|
34775
|
+
}
|
|
34776
|
+
else if (typeof target === "object" && target !== null) {
|
|
34777
|
+
return ts.forEach(ts.getOwnKeys(target), function (key) {
|
|
34778
|
+
if (key === "default" || ts.contains(state.conditions, key) || isApplicableVersionedTypesKey(state.conditions, key)) {
|
|
34779
|
+
loadEntrypointsFromTargetExports(target[key]);
|
|
34780
|
+
return true;
|
|
34781
|
+
}
|
|
34782
|
+
});
|
|
34783
|
+
}
|
|
34784
|
+
}
|
|
34785
|
+
}
|
|
34670
34786
|
function getPackageScopeForPath(fileName, packageJsonInfoCache, host, options) {
|
|
34671
34787
|
var state = {
|
|
34672
34788
|
host: host,
|
|
@@ -34718,7 +34834,7 @@ var ts;
|
|
|
34718
34834
|
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
34719
34835
|
}
|
|
34720
34836
|
var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
|
|
34721
|
-
var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths };
|
|
34837
|
+
var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
|
|
34722
34838
|
(_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
34723
34839
|
return result;
|
|
34724
34840
|
}
|
|
@@ -35000,8 +35116,8 @@ var ts;
|
|
|
35000
35116
|
}
|
|
35001
35117
|
return toSearchResult(undefined);
|
|
35002
35118
|
}
|
|
35003
|
-
for (var _d = 0,
|
|
35004
|
-
var elem =
|
|
35119
|
+
for (var _d = 0, target_2 = target; _d < target_2.length; _d++) {
|
|
35120
|
+
var elem = target_2[_d];
|
|
35005
35121
|
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
|
|
35006
35122
|
if (result) {
|
|
35007
35123
|
return result;
|
|
@@ -42949,8 +43065,8 @@ var ts;
|
|
|
42949
43065
|
}
|
|
42950
43066
|
else {
|
|
42951
43067
|
if (parent && getExportsOfSymbol(parent)) {
|
|
42952
|
-
var
|
|
42953
|
-
ts.forEachEntry(
|
|
43068
|
+
var exports_2 = getExportsOfSymbol(parent);
|
|
43069
|
+
ts.forEachEntry(exports_2, function (ex, name) {
|
|
42954
43070
|
if (getSymbolIfSameReference(ex, symbol) && !isLateBoundName(name) && name !== "export=") {
|
|
42955
43071
|
symbolName = ts.unescapeLeadingUnderscores(name);
|
|
42956
43072
|
return true;
|
|
@@ -47301,6 +47417,9 @@ var ts;
|
|
|
47301
47417
|
return simplified !== type ? simplified : getConstraintOfType(type);
|
|
47302
47418
|
}
|
|
47303
47419
|
function getConstraintFromIndexedAccess(type) {
|
|
47420
|
+
if (isMappedTypeGenericIndexedAccess(type)) {
|
|
47421
|
+
return substituteIndexedMappedType(type.objectType, type.indexType);
|
|
47422
|
+
}
|
|
47304
47423
|
var indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
|
|
47305
47424
|
if (indexConstraint && indexConstraint !== type.indexType) {
|
|
47306
47425
|
var indexedAccess = getIndexedAccessTypeOrUndefined(type.objectType, indexConstraint, type.accessFlags);
|
|
@@ -47469,6 +47588,9 @@ var ts;
|
|
|
47469
47588
|
return constraint ? getStringMappingType(t.symbol, constraint) : stringType;
|
|
47470
47589
|
}
|
|
47471
47590
|
if (t.flags & 8388608) {
|
|
47591
|
+
if (isMappedTypeGenericIndexedAccess(t)) {
|
|
47592
|
+
return getBaseConstraint(substituteIndexedMappedType(t.objectType, t.indexType));
|
|
47593
|
+
}
|
|
47472
47594
|
var baseObjectType = getBaseConstraint(t.objectType);
|
|
47473
47595
|
var baseIndexType = getBaseConstraint(t.indexType);
|
|
47474
47596
|
var baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, t.accessFlags);
|
|
@@ -47535,9 +47657,7 @@ var ts;
|
|
|
47535
47657
|
!isGenericMappedType(type.objectType) && isGenericIndexType(type.indexType);
|
|
47536
47658
|
}
|
|
47537
47659
|
function getApparentType(type) {
|
|
47538
|
-
var t = !(type.flags & 465829888) ? type :
|
|
47539
|
-
isMappedTypeGenericIndexedAccess(type) ? substituteIndexedMappedType(type.objectType, type.indexType) :
|
|
47540
|
-
getBaseConstraintOfType(type) || unknownType;
|
|
47660
|
+
var t = !(type.flags & 465829888) ? type : getBaseConstraintOfType(type) || unknownType;
|
|
47541
47661
|
return ts.getObjectFlags(t) & 32 ? getApparentTypeOfMappedType(t) :
|
|
47542
47662
|
t.flags & 2097152 ? getApparentTypeOfIntersectionType(t) :
|
|
47543
47663
|
t.flags & 402653316 ? globalStringType :
|
|
@@ -53408,6 +53528,15 @@ var ts;
|
|
|
53408
53528
|
resetErrorInfo(saveErrorInfo);
|
|
53409
53529
|
return result;
|
|
53410
53530
|
}
|
|
53531
|
+
if (isMappedTypeGenericIndexedAccess(source)) {
|
|
53532
|
+
var indexConstraint = getConstraintOfType(source.indexType);
|
|
53533
|
+
if (indexConstraint) {
|
|
53534
|
+
if (result = isRelatedTo(getIndexedAccessType(source.objectType, indexConstraint), target, 1, reportErrors)) {
|
|
53535
|
+
resetErrorInfo(saveErrorInfo);
|
|
53536
|
+
return result;
|
|
53537
|
+
}
|
|
53538
|
+
}
|
|
53539
|
+
}
|
|
53411
53540
|
}
|
|
53412
53541
|
}
|
|
53413
53542
|
else if (source.flags & 4194304) {
|
|
@@ -65702,25 +65831,29 @@ var ts;
|
|
|
65702
65831
|
if (classExtendsNull) {
|
|
65703
65832
|
error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
65704
65833
|
}
|
|
65705
|
-
var
|
|
65834
|
+
var superCallShouldBeRootLevel = (ts.getEmitScriptTarget(compilerOptions) !== 99 || !useDefineForClassFields) &&
|
|
65706
65835
|
(ts.some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) ||
|
|
65707
65836
|
ts.some(node.parameters, function (p) { return ts.hasSyntacticModifier(p, 16476); }));
|
|
65708
|
-
if (
|
|
65709
|
-
|
|
65710
|
-
|
|
65711
|
-
|
|
65712
|
-
|
|
65713
|
-
|
|
65714
|
-
|
|
65715
|
-
|
|
65837
|
+
if (superCallShouldBeRootLevel) {
|
|
65838
|
+
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
65839
|
+
error(superCall, ts.Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
65840
|
+
}
|
|
65841
|
+
else {
|
|
65842
|
+
var superCallStatement = void 0;
|
|
65843
|
+
for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) {
|
|
65844
|
+
var statement = _a[_i];
|
|
65845
|
+
if (ts.isExpressionStatement(statement) && ts.isSuperCall(ts.skipOuterExpressions(statement.expression))) {
|
|
65846
|
+
superCallStatement = statement;
|
|
65847
|
+
break;
|
|
65848
|
+
}
|
|
65849
|
+
if (!ts.isPrologueDirective(statement) && nodeImmediatelyReferencesSuperOrThis(statement)) {
|
|
65850
|
+
break;
|
|
65851
|
+
}
|
|
65716
65852
|
}
|
|
65717
|
-
if (
|
|
65718
|
-
|
|
65853
|
+
if (superCallStatement === undefined) {
|
|
65854
|
+
error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
65719
65855
|
}
|
|
65720
65856
|
}
|
|
65721
|
-
if (!superCallStatement) {
|
|
65722
|
-
error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
65723
|
-
}
|
|
65724
65857
|
}
|
|
65725
65858
|
}
|
|
65726
65859
|
else if (!classExtendsNull) {
|
|
@@ -65728,6 +65861,19 @@ var ts;
|
|
|
65728
65861
|
}
|
|
65729
65862
|
}
|
|
65730
65863
|
}
|
|
65864
|
+
function superCallIsRootLevelInConstructor(superCall, body) {
|
|
65865
|
+
var superCallParent = ts.walkUpParenthesizedExpressions(superCall.parent);
|
|
65866
|
+
return ts.isExpressionStatement(superCallParent) && superCallParent.parent === body;
|
|
65867
|
+
}
|
|
65868
|
+
function nodeImmediatelyReferencesSuperOrThis(node) {
|
|
65869
|
+
if (node.kind === 106 || node.kind === 108) {
|
|
65870
|
+
return true;
|
|
65871
|
+
}
|
|
65872
|
+
if (ts.isThisContainerOrFunctionBlock(node)) {
|
|
65873
|
+
return false;
|
|
65874
|
+
}
|
|
65875
|
+
return !!ts.forEachChild(node, nodeImmediatelyReferencesSuperOrThis);
|
|
65876
|
+
}
|
|
65731
65877
|
function checkAccessorDeclaration(node) {
|
|
65732
65878
|
if (produceDiagnostics) {
|
|
65733
65879
|
if (!checkGrammarFunctionLikeDeclaration(node) && !checkGrammarAccessor(node))
|
|
@@ -69762,9 +69908,9 @@ var ts;
|
|
|
69762
69908
|
error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
|
|
69763
69909
|
}
|
|
69764
69910
|
}
|
|
69765
|
-
var
|
|
69766
|
-
if (
|
|
69767
|
-
|
|
69911
|
+
var exports_3 = getExportsOfModule(moduleSymbol);
|
|
69912
|
+
if (exports_3) {
|
|
69913
|
+
exports_3.forEach(function (_a, id) {
|
|
69768
69914
|
var declarations = _a.declarations, flags = _a.flags;
|
|
69769
69915
|
if (id === "__export") {
|
|
69770
69916
|
return;
|
|
@@ -74591,25 +74737,26 @@ var ts;
|
|
|
74591
74737
|
}
|
|
74592
74738
|
}
|
|
74593
74739
|
ts.getNonAssignmentOperatorForCompoundAssignment = getNonAssignmentOperatorForCompoundAssignment;
|
|
74594
|
-
function
|
|
74595
|
-
if (
|
|
74596
|
-
|
|
74597
|
-
|
|
74598
|
-
|
|
74599
|
-
|
|
74600
|
-
|
|
74601
|
-
|
|
74602
|
-
|
|
74603
|
-
|
|
74604
|
-
|
|
74605
|
-
|
|
74606
|
-
|
|
74740
|
+
function getSuperCallFromStatement(statement) {
|
|
74741
|
+
if (!ts.isExpressionStatement(statement)) {
|
|
74742
|
+
return undefined;
|
|
74743
|
+
}
|
|
74744
|
+
var expression = ts.skipParentheses(statement.expression);
|
|
74745
|
+
return ts.isSuperCall(expression)
|
|
74746
|
+
? expression
|
|
74747
|
+
: undefined;
|
|
74748
|
+
}
|
|
74749
|
+
ts.getSuperCallFromStatement = getSuperCallFromStatement;
|
|
74750
|
+
function findSuperStatementIndex(statements, indexAfterLastPrologueStatement) {
|
|
74751
|
+
for (var i = indexAfterLastPrologueStatement; i < statements.length; i += 1) {
|
|
74752
|
+
var statement = statements[i];
|
|
74753
|
+
if (getSuperCallFromStatement(statement)) {
|
|
74754
|
+
return i;
|
|
74607
74755
|
}
|
|
74608
|
-
return index;
|
|
74609
74756
|
}
|
|
74610
|
-
return
|
|
74757
|
+
return -1;
|
|
74611
74758
|
}
|
|
74612
|
-
ts.
|
|
74759
|
+
ts.findSuperStatementIndex = findSuperStatementIndex;
|
|
74613
74760
|
function getProperties(node, requireInitializer, isStatic) {
|
|
74614
74761
|
return ts.filter(node.members, function (m) { return isInitializedOrStaticProperty(m, requireInitializer, isStatic); });
|
|
74615
74762
|
}
|
|
@@ -75812,6 +75959,7 @@ var ts;
|
|
|
75812
75959
|
case 176:
|
|
75813
75960
|
case 133:
|
|
75814
75961
|
return factory.createIdentifier("Boolean");
|
|
75962
|
+
case 197:
|
|
75815
75963
|
case 149:
|
|
75816
75964
|
return factory.createIdentifier("String");
|
|
75817
75965
|
case 147:
|
|
@@ -76049,11 +76197,20 @@ var ts;
|
|
|
76049
76197
|
return ts.visitFunctionBody(body, visitor, context);
|
|
76050
76198
|
}
|
|
76051
76199
|
var statements = [];
|
|
76052
|
-
var indexOfFirstStatement = 0;
|
|
76053
76200
|
resumeLexicalEnvironment();
|
|
76054
|
-
|
|
76055
|
-
ts.
|
|
76056
|
-
|
|
76201
|
+
var indexAfterLastPrologueStatement = factory.copyPrologue(body.statements, statements, false, visitor);
|
|
76202
|
+
var superStatementIndex = ts.findSuperStatementIndex(body.statements, indexAfterLastPrologueStatement);
|
|
76203
|
+
if (superStatementIndex >= 0) {
|
|
76204
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, indexAfterLastPrologueStatement, superStatementIndex + 1 - indexAfterLastPrologueStatement));
|
|
76205
|
+
}
|
|
76206
|
+
var parameterPropertyAssignments = ts.mapDefined(parametersWithPropertyAssignments, transformParameterWithPropertyAssignment);
|
|
76207
|
+
if (superStatementIndex >= 0) {
|
|
76208
|
+
ts.addRange(statements, parameterPropertyAssignments);
|
|
76209
|
+
}
|
|
76210
|
+
else {
|
|
76211
|
+
statements = ts.addRange(parameterPropertyAssignments, statements);
|
|
76212
|
+
}
|
|
76213
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1));
|
|
76057
76214
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
76058
76215
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), true);
|
|
76059
76216
|
ts.setTextRange(block, body);
|
|
@@ -77435,6 +77592,7 @@ var ts;
|
|
|
77435
77592
|
return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration(undefined, undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor));
|
|
77436
77593
|
}
|
|
77437
77594
|
function transformConstructorBody(node, constructor, isDerivedClass) {
|
|
77595
|
+
var _a;
|
|
77438
77596
|
var properties = ts.getProperties(node, false, false);
|
|
77439
77597
|
if (!useDefineForClassFields) {
|
|
77440
77598
|
properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); });
|
|
@@ -77445,34 +77603,65 @@ var ts;
|
|
|
77445
77603
|
return ts.visitFunctionBody(undefined, visitor, context);
|
|
77446
77604
|
}
|
|
77447
77605
|
resumeLexicalEnvironment();
|
|
77448
|
-
var
|
|
77606
|
+
var needsSyntheticConstructor = !constructor && isDerivedClass;
|
|
77607
|
+
var indexOfFirstStatementAfterSuper = 0;
|
|
77608
|
+
var prologueStatementCount = 0;
|
|
77609
|
+
var superStatementIndex = -1;
|
|
77449
77610
|
var statements = [];
|
|
77450
|
-
if (
|
|
77451
|
-
|
|
77611
|
+
if ((_a = constructor === null || constructor === void 0 ? void 0 : constructor.body) === null || _a === void 0 ? void 0 : _a.statements) {
|
|
77612
|
+
prologueStatementCount = factory.copyPrologue(constructor.body.statements, statements, false, visitor);
|
|
77613
|
+
superStatementIndex = ts.findSuperStatementIndex(constructor.body.statements, prologueStatementCount);
|
|
77614
|
+
if (superStatementIndex >= 0) {
|
|
77615
|
+
indexOfFirstStatementAfterSuper = superStatementIndex + 1;
|
|
77616
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount, indexOfFirstStatementAfterSuper - prologueStatementCount), true), statements.slice(prologueStatementCount), true);
|
|
77617
|
+
}
|
|
77452
77618
|
}
|
|
77453
|
-
if (
|
|
77454
|
-
|
|
77619
|
+
if (needsSyntheticConstructor) {
|
|
77620
|
+
statements.push(factory.createExpressionStatement(factory.createCallExpression(factory.createSuper(), undefined, [factory.createSpreadElement(factory.createIdentifier("arguments"))])));
|
|
77455
77621
|
}
|
|
77622
|
+
var parameterPropertyDeclarationCount = 0;
|
|
77456
77623
|
if (constructor === null || constructor === void 0 ? void 0 : constructor.body) {
|
|
77457
|
-
|
|
77458
|
-
|
|
77459
|
-
afterParameterProperties = constructor.body.statements.length;
|
|
77624
|
+
if (useDefineForClassFields) {
|
|
77625
|
+
statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); });
|
|
77460
77626
|
}
|
|
77461
|
-
|
|
77462
|
-
|
|
77463
|
-
|
|
77627
|
+
else {
|
|
77628
|
+
for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) {
|
|
77629
|
+
var statement = _b[_i];
|
|
77630
|
+
if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) {
|
|
77631
|
+
parameterPropertyDeclarationCount++;
|
|
77632
|
+
}
|
|
77633
|
+
}
|
|
77634
|
+
if (parameterPropertyDeclarationCount > 0) {
|
|
77635
|
+
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatementAfterSuper, parameterPropertyDeclarationCount);
|
|
77636
|
+
if (superStatementIndex >= 0) {
|
|
77637
|
+
ts.addRange(statements, parameterProperties);
|
|
77638
|
+
}
|
|
77639
|
+
else if (needsSyntheticConstructor) {
|
|
77640
|
+
statements = __spreadArray(__spreadArray([
|
|
77641
|
+
statements[0]
|
|
77642
|
+
], parameterProperties, true), statements.slice(1), true);
|
|
77643
|
+
}
|
|
77644
|
+
else {
|
|
77645
|
+
statements = __spreadArray(__spreadArray([], parameterProperties, true), statements, true);
|
|
77646
|
+
}
|
|
77647
|
+
indexOfFirstStatementAfterSuper += parameterPropertyDeclarationCount;
|
|
77464
77648
|
}
|
|
77465
|
-
indexOfFirstStatement = afterParameterProperties;
|
|
77466
77649
|
}
|
|
77467
77650
|
}
|
|
77468
77651
|
var receiver = factory.createThis();
|
|
77469
77652
|
addMethodStatements(statements, privateMethodsAndAccessors, receiver);
|
|
77470
77653
|
addPropertyOrClassStaticBlockStatements(statements, properties, receiver);
|
|
77471
77654
|
if (constructor) {
|
|
77472
|
-
ts.addRange(statements, ts.visitNodes(constructor.body.statements,
|
|
77655
|
+
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuper + prologueStatementCount));
|
|
77473
77656
|
}
|
|
77474
77657
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
77475
77658
|
return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), constructor ? constructor.body.statements : node.members), true), constructor ? constructor.body : undefined);
|
|
77659
|
+
function visitBodyStatement(statement) {
|
|
77660
|
+
if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) {
|
|
77661
|
+
return undefined;
|
|
77662
|
+
}
|
|
77663
|
+
return visitor(statement);
|
|
77664
|
+
}
|
|
77476
77665
|
}
|
|
77477
77666
|
function addPropertyOrClassStaticBlockStatements(statements, properties, receiver) {
|
|
77478
77667
|
for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
|
|
@@ -77487,6 +77676,8 @@ var ts;
|
|
|
77487
77676
|
ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));
|
|
77488
77677
|
ts.setCommentRange(statement, property);
|
|
77489
77678
|
ts.setOriginalNode(statement, property);
|
|
77679
|
+
ts.setSyntheticLeadingComments(expression, undefined);
|
|
77680
|
+
ts.setSyntheticTrailingComments(expression, undefined);
|
|
77490
77681
|
statements.push(statement);
|
|
77491
77682
|
}
|
|
77492
77683
|
}
|
|
@@ -80531,40 +80722,47 @@ var ts;
|
|
|
80531
80722
|
var prologue = [];
|
|
80532
80723
|
var statements = [];
|
|
80533
80724
|
resumeLexicalEnvironment();
|
|
80534
|
-
var
|
|
80725
|
+
var existingPrologue = ts.takeWhile(constructor.body.statements, ts.isPrologueDirective);
|
|
80726
|
+
var _a = findSuperCallAndStatementIndex(constructor.body.statements, existingPrologue), superCall = _a.superCall, superStatementIndex = _a.superStatementIndex;
|
|
80727
|
+
var postSuperStatementsStart = superStatementIndex === -1 ? existingPrologue.length : superStatementIndex + 1;
|
|
80728
|
+
var statementOffset = postSuperStatementsStart;
|
|
80535
80729
|
if (!hasSynthesizedSuper)
|
|
80536
|
-
statementOffset = factory.copyStandardPrologue(constructor.body.statements, prologue, false);
|
|
80537
|
-
addDefaultValueAssignmentsIfNeeded(statements, constructor);
|
|
80538
|
-
addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
|
|
80730
|
+
statementOffset = factory.copyStandardPrologue(constructor.body.statements, prologue, statementOffset, false);
|
|
80539
80731
|
if (!hasSynthesizedSuper)
|
|
80540
|
-
statementOffset = factory.copyCustomPrologue(constructor.body.statements, statements, statementOffset, visitor);
|
|
80732
|
+
statementOffset = factory.copyCustomPrologue(constructor.body.statements, statements, statementOffset, visitor, undefined);
|
|
80541
80733
|
var superCallExpression;
|
|
80542
80734
|
if (hasSynthesizedSuper) {
|
|
80543
80735
|
superCallExpression = createDefaultSuperCallOrThis();
|
|
80544
80736
|
}
|
|
80545
|
-
else if (
|
|
80546
|
-
|
|
80547
|
-
if (ts.isExpressionStatement(firstStatement) && ts.isSuperCall(firstStatement.expression)) {
|
|
80548
|
-
superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression);
|
|
80549
|
-
}
|
|
80737
|
+
else if (superCall) {
|
|
80738
|
+
superCallExpression = visitSuperCallInBody(superCall);
|
|
80550
80739
|
}
|
|
80551
80740
|
if (superCallExpression) {
|
|
80552
80741
|
hierarchyFacts |= 8192;
|
|
80553
|
-
statementOffset++;
|
|
80554
80742
|
}
|
|
80743
|
+
addDefaultValueAssignmentsIfNeeded(prologue, constructor);
|
|
80744
|
+
addRestParameterIfNeeded(prologue, constructor, hasSynthesizedSuper);
|
|
80555
80745
|
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset));
|
|
80556
80746
|
factory.mergeLexicalEnvironment(prologue, endLexicalEnvironment());
|
|
80557
80747
|
insertCaptureNewTargetIfNeeded(prologue, constructor, false);
|
|
80558
|
-
if (isDerivedClass) {
|
|
80559
|
-
if (superCallExpression &&
|
|
80560
|
-
var
|
|
80748
|
+
if (isDerivedClass || superCallExpression) {
|
|
80749
|
+
if (superCallExpression && postSuperStatementsStart === constructor.body.statements.length && !(constructor.body.transformFlags & 8192)) {
|
|
80750
|
+
var superCall_1 = ts.cast(ts.cast(superCallExpression, ts.isBinaryExpression).left, ts.isCallExpression);
|
|
80561
80751
|
var returnStatement = factory.createReturnStatement(superCallExpression);
|
|
80562
|
-
ts.setCommentRange(returnStatement, ts.getCommentRange(
|
|
80563
|
-
ts.setEmitFlags(
|
|
80752
|
+
ts.setCommentRange(returnStatement, ts.getCommentRange(superCall_1));
|
|
80753
|
+
ts.setEmitFlags(superCall_1, 1536);
|
|
80564
80754
|
statements.push(returnStatement);
|
|
80565
80755
|
}
|
|
80566
80756
|
else {
|
|
80567
|
-
|
|
80757
|
+
if (superStatementIndex <= existingPrologue.length) {
|
|
80758
|
+
insertCaptureThisForNode(statements, constructor, superCallExpression || createActualThis());
|
|
80759
|
+
}
|
|
80760
|
+
else {
|
|
80761
|
+
insertCaptureThisForNode(prologue, constructor, createActualThis());
|
|
80762
|
+
if (superCallExpression) {
|
|
80763
|
+
insertSuperThisCaptureThisForNode(statements, superCallExpression);
|
|
80764
|
+
}
|
|
80765
|
+
}
|
|
80568
80766
|
if (!isSufficientlyCoveredByReturnStatements(constructor.body)) {
|
|
80569
80767
|
statements.push(factory.createReturnStatement(factory.createUniqueName("_this", 16 | 32)));
|
|
80570
80768
|
}
|
|
@@ -80573,9 +80771,23 @@ var ts;
|
|
|
80573
80771
|
else {
|
|
80574
80772
|
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
80575
80773
|
}
|
|
80576
|
-
var
|
|
80577
|
-
ts.setTextRange(
|
|
80578
|
-
return
|
|
80774
|
+
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex)), true), statements, true)), constructor.body.statements), true);
|
|
80775
|
+
ts.setTextRange(body, constructor.body);
|
|
80776
|
+
return body;
|
|
80777
|
+
}
|
|
80778
|
+
function findSuperCallAndStatementIndex(originalBodyStatements, existingPrologue) {
|
|
80779
|
+
for (var i = existingPrologue.length; i < originalBodyStatements.length; i += 1) {
|
|
80780
|
+
var superCall = ts.getSuperCallFromStatement(originalBodyStatements[i]);
|
|
80781
|
+
if (superCall) {
|
|
80782
|
+
return {
|
|
80783
|
+
superCall: superCall,
|
|
80784
|
+
superStatementIndex: i,
|
|
80785
|
+
};
|
|
80786
|
+
}
|
|
80787
|
+
}
|
|
80788
|
+
return {
|
|
80789
|
+
superStatementIndex: -1,
|
|
80790
|
+
};
|
|
80579
80791
|
}
|
|
80580
80792
|
function isSufficientlyCoveredByReturnStatements(statement) {
|
|
80581
80793
|
if (statement.kind === 246) {
|
|
@@ -80702,6 +80914,12 @@ var ts;
|
|
|
80702
80914
|
}
|
|
80703
80915
|
return false;
|
|
80704
80916
|
}
|
|
80917
|
+
function insertSuperThisCaptureThisForNode(statements, superExpression) {
|
|
80918
|
+
enableSubstitutionsForCapturedThis();
|
|
80919
|
+
var assignSuperExpression = factory.createExpressionStatement(factory.createBinaryExpression(factory.createThis(), 63, superExpression));
|
|
80920
|
+
ts.insertStatementAfterCustomPrologue(statements, assignSuperExpression);
|
|
80921
|
+
ts.setCommentRange(assignSuperExpression, ts.getOriginalNode(superExpression).parent);
|
|
80922
|
+
}
|
|
80705
80923
|
function insertCaptureThisForNode(statements, node, initializer) {
|
|
80706
80924
|
enableSubstitutionsForCapturedThis();
|
|
80707
80925
|
var captureThisStatement = factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
|
|
@@ -80911,7 +81129,7 @@ var ts;
|
|
|
80911
81129
|
var statementOffset;
|
|
80912
81130
|
resumeLexicalEnvironment();
|
|
80913
81131
|
if (ts.isBlock(body)) {
|
|
80914
|
-
statementOffset = factory.copyStandardPrologue(body.statements, prologue, false);
|
|
81132
|
+
statementOffset = factory.copyStandardPrologue(body.statements, prologue, 0, false);
|
|
80915
81133
|
statementOffset = factory.copyCustomPrologue(body.statements, statements, statementOffset, visitor, ts.isHoistedFunction);
|
|
80916
81134
|
statementOffset = factory.copyCustomPrologue(body.statements, statements, statementOffset, visitor, ts.isHoistedVariableStatement);
|
|
80917
81135
|
}
|
|
@@ -81828,7 +82046,7 @@ var ts;
|
|
|
81828
82046
|
ts.addRange(statements, classStatements, 1);
|
|
81829
82047
|
return factory.restoreOuterExpressions(node.expression, factory.restoreOuterExpressions(variable.initializer, factory.restoreOuterExpressions(aliasAssignment && aliasAssignment.right, factory.updateCallExpression(call, factory.restoreOuterExpressions(call.expression, factory.updateFunctionExpression(func, undefined, undefined, undefined, undefined, func.parameters, undefined, factory.updateBlock(func.body, statements))), undefined, call.arguments))));
|
|
81830
82048
|
}
|
|
81831
|
-
function
|
|
82049
|
+
function visitSuperCallInBody(node) {
|
|
81832
82050
|
return visitCallExpressionWithPotentialCapturedThisAssignment(node, false);
|
|
81833
82051
|
}
|
|
81834
82052
|
function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {
|
|
@@ -98433,27 +98651,27 @@ var ts;
|
|
|
98433
98651
|
useCaseSensitiveFileNames: (_a = host.useCaseSensitiveFileNames) === null || _a === void 0 ? void 0 : _a.call(host),
|
|
98434
98652
|
};
|
|
98435
98653
|
}
|
|
98436
|
-
function updateModuleSpecifier(compilerOptions, importingSourceFileName, toFileName, host, oldImportSpecifier) {
|
|
98437
|
-
var res = getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, getPreferencesForUpdate(compilerOptions, oldImportSpecifier, importingSourceFileName, host), {});
|
|
98654
|
+
function updateModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, oldImportSpecifier) {
|
|
98655
|
+
var res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, getPreferencesForUpdate(compilerOptions, oldImportSpecifier, importingSourceFileName, host), {});
|
|
98438
98656
|
if (res === oldImportSpecifier)
|
|
98439
98657
|
return undefined;
|
|
98440
98658
|
return res;
|
|
98441
98659
|
}
|
|
98442
98660
|
moduleSpecifiers_1.updateModuleSpecifier = updateModuleSpecifier;
|
|
98443
98661
|
function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host) {
|
|
98444
|
-
return getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, getPreferences(host, {}, compilerOptions, importingSourceFile), {});
|
|
98662
|
+
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, getPreferences(host, {}, compilerOptions, importingSourceFile), {});
|
|
98445
98663
|
}
|
|
98446
98664
|
moduleSpecifiers_1.getModuleSpecifier = getModuleSpecifier;
|
|
98447
|
-
function getNodeModulesPackageName(compilerOptions,
|
|
98448
|
-
var info = getInfo(
|
|
98449
|
-
var modulePaths = getAllModulePaths(
|
|
98450
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, host, compilerOptions, true); });
|
|
98665
|
+
function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences) {
|
|
98666
|
+
var info = getInfo(importingSourceFile.path, host);
|
|
98667
|
+
var modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences);
|
|
98668
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, true); });
|
|
98451
98669
|
}
|
|
98452
98670
|
moduleSpecifiers_1.getNodeModulesPackageName = getNodeModulesPackageName;
|
|
98453
|
-
function getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, preferences, userPreferences) {
|
|
98671
|
+
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, preferences, userPreferences) {
|
|
98454
98672
|
var info = getInfo(importingSourceFileName, host);
|
|
98455
98673
|
var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences);
|
|
98456
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, host, compilerOptions); }) ||
|
|
98674
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions); }) ||
|
|
98457
98675
|
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
|
|
98458
98676
|
}
|
|
98459
98677
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences) {
|
|
@@ -98512,7 +98730,7 @@ var ts;
|
|
|
98512
98730
|
var relativeSpecifiers;
|
|
98513
98731
|
for (var _i = 0, modulePaths_1 = modulePaths; _i < modulePaths_1.length; _i++) {
|
|
98514
98732
|
var modulePath = modulePaths_1[_i];
|
|
98515
|
-
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, host, compilerOptions);
|
|
98733
|
+
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions);
|
|
98516
98734
|
nodeModulesSpecifiers = ts.append(nodeModulesSpecifiers, specifier);
|
|
98517
98735
|
if (specifier && modulePath.isRedirect) {
|
|
98518
98736
|
return nodeModulesSpecifiers;
|
|
@@ -98842,7 +99060,7 @@ var ts;
|
|
|
98842
99060
|
? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
|
|
98843
99061
|
: ts.removeFileExtension(relativePath);
|
|
98844
99062
|
}
|
|
98845
|
-
function tryGetModuleNameAsNodeModule(_a, _b, host, options, packageNameOnly) {
|
|
99063
|
+
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, packageNameOnly) {
|
|
98846
99064
|
var path = _a.path, isRedirect = _a.isRedirect;
|
|
98847
99065
|
var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory;
|
|
98848
99066
|
if (!host.fileExists || !host.readFile) {
|
|
@@ -98899,9 +99117,14 @@ var ts;
|
|
|
98899
99117
|
if (host.fileExists(packageJsonPath)) {
|
|
98900
99118
|
var packageJsonContent = JSON.parse(host.readFile(packageJsonPath));
|
|
98901
99119
|
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
98902
|
-
var
|
|
99120
|
+
var conditions = ["node", importingSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext ? "import" : "require", "types"];
|
|
99121
|
+
var fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string"
|
|
99122
|
+
? tryGetModuleNameFromExports(options, path, packageRootPath, ts.getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions)
|
|
99123
|
+
: undefined;
|
|
98903
99124
|
if (fromExports) {
|
|
98904
|
-
var withJsExtension = !ts.hasTSFileExtension(fromExports.moduleFileToTry)
|
|
99125
|
+
var withJsExtension = !ts.hasTSFileExtension(fromExports.moduleFileToTry)
|
|
99126
|
+
? fromExports
|
|
99127
|
+
: { moduleFileToTry: ts.removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
|
|
98905
99128
|
return __assign(__assign({}, withJsExtension), { verbatimFromExports: true });
|
|
98906
99129
|
}
|
|
98907
99130
|
if (packageJsonContent.exports) {
|
|
@@ -98993,7 +99216,7 @@ var ts;
|
|
|
98993
99216
|
function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
|
|
98994
99217
|
return ts.firstDefined(rootDirs, function (rootDir) {
|
|
98995
99218
|
var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
|
|
98996
|
-
return isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
99219
|
+
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
98997
99220
|
});
|
|
98998
99221
|
}
|
|
98999
99222
|
function removeExtensionAndIndexPostFix(fileName, ending, options) {
|