typescript 4.6.0-dev.20220110 → 4.6.0-dev.20220114
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 +342 -119
- package/lib/tsserver.js +540 -216
- package/lib/tsserverlibrary.js +540 -216
- package/lib/typescript.js +486 -195
- package/lib/typescriptServices.js +486 -195
- package/lib/typingsInstaller.js +422 -145
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220114";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -8277,7 +8277,7 @@ var ts;
|
|
|
8277
8277
|
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."),
|
|
8278
8278
|
Duplicate_index_signature_for_type_0: diag(2374, ts.DiagnosticCategory.Error, "Duplicate_index_signature_for_type_0_2374", "Duplicate index signature for type '{0}'."),
|
|
8279
8279
|
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."),
|
|
8280
|
-
|
|
8280
|
+
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."),
|
|
8281
8281
|
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."),
|
|
8282
8282
|
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."),
|
|
8283
8283
|
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."),
|
|
@@ -8300,6 +8300,7 @@ var ts;
|
|
|
8300
8300
|
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."),
|
|
8301
8301
|
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."),
|
|
8302
8302
|
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."),
|
|
8303
|
+
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."),
|
|
8303
8304
|
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."),
|
|
8304
8305
|
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}'."),
|
|
8305
8306
|
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."),
|
|
@@ -15460,6 +15461,34 @@ var ts;
|
|
|
15460
15461
|
}
|
|
15461
15462
|
}
|
|
15462
15463
|
ts.getThisContainer = getThisContainer;
|
|
15464
|
+
/**
|
|
15465
|
+
* @returns Whether the node creates a new 'this' scope for its children.
|
|
15466
|
+
*/
|
|
15467
|
+
function isThisContainerOrFunctionBlock(node) {
|
|
15468
|
+
switch (node.kind) {
|
|
15469
|
+
// Arrow functions use the same scope, but may do so in a "delayed" manner
|
|
15470
|
+
// For example, `const getThis = () => this` may be before a super() call in a derived constructor
|
|
15471
|
+
case 213 /* ArrowFunction */:
|
|
15472
|
+
case 255 /* FunctionDeclaration */:
|
|
15473
|
+
case 212 /* FunctionExpression */:
|
|
15474
|
+
case 166 /* PropertyDeclaration */:
|
|
15475
|
+
return true;
|
|
15476
|
+
case 234 /* Block */:
|
|
15477
|
+
switch (node.parent.kind) {
|
|
15478
|
+
case 170 /* Constructor */:
|
|
15479
|
+
case 168 /* MethodDeclaration */:
|
|
15480
|
+
case 171 /* GetAccessor */:
|
|
15481
|
+
case 172 /* SetAccessor */:
|
|
15482
|
+
// Object properties can have computed names; only method-like bodies start a new scope
|
|
15483
|
+
return true;
|
|
15484
|
+
default:
|
|
15485
|
+
return false;
|
|
15486
|
+
}
|
|
15487
|
+
default:
|
|
15488
|
+
return false;
|
|
15489
|
+
}
|
|
15490
|
+
}
|
|
15491
|
+
ts.isThisContainerOrFunctionBlock = isThisContainerOrFunctionBlock;
|
|
15463
15492
|
function isInTopLevelContext(node) {
|
|
15464
15493
|
// The name of a class or function declaration is a BindingIdentifier in its surrounding scope.
|
|
15465
15494
|
if (ts.isIdentifier(node) && (ts.isClassDeclaration(node.parent) || ts.isFunctionDeclaration(node.parent)) && node.parent.name === node) {
|
|
@@ -19780,16 +19809,6 @@ var ts;
|
|
|
19780
19809
|
(symlinkedDirectories || (symlinkedDirectories = new ts.Map())).set(symlinkPath, real);
|
|
19781
19810
|
}
|
|
19782
19811
|
},
|
|
19783
|
-
setSymlinkedDirectoryFromSymlinkedFile: function (symlink, real) {
|
|
19784
|
-
this.setSymlinkedFile(ts.toPath(symlink, cwd, getCanonicalFileName), real);
|
|
19785
|
-
var _a = guessDirectorySymlink(real, symlink, cwd, getCanonicalFileName) || ts.emptyArray, commonResolved = _a[0], commonOriginal = _a[1];
|
|
19786
|
-
if (commonResolved && commonOriginal) {
|
|
19787
|
-
this.setSymlinkedDirectory(commonOriginal, {
|
|
19788
|
-
real: commonResolved,
|
|
19789
|
-
realPath: ts.toPath(commonResolved, cwd, getCanonicalFileName),
|
|
19790
|
-
});
|
|
19791
|
-
}
|
|
19792
|
-
},
|
|
19793
19812
|
setSymlinksFromResolutions: function (files, typeReferenceDirectives) {
|
|
19794
19813
|
var _this = this;
|
|
19795
19814
|
var _a;
|
|
@@ -26056,7 +26075,7 @@ var ts;
|
|
|
26056
26075
|
* @param visitor Optional callback used to visit any custom prologue directives.
|
|
26057
26076
|
*/
|
|
26058
26077
|
function copyPrologue(source, target, ensureUseStrict, visitor) {
|
|
26059
|
-
var offset = copyStandardPrologue(source, target, ensureUseStrict);
|
|
26078
|
+
var offset = copyStandardPrologue(source, target, 0, ensureUseStrict);
|
|
26060
26079
|
return copyCustomPrologue(source, target, offset, visitor);
|
|
26061
26080
|
}
|
|
26062
26081
|
function isUseStrictPrologue(node) {
|
|
@@ -26069,12 +26088,14 @@ var ts;
|
|
|
26069
26088
|
* Copies only the standard (string-expression) prologue-directives into the target statement-array.
|
|
26070
26089
|
* @param source origin statements array
|
|
26071
26090
|
* @param target result statements array
|
|
26091
|
+
* @param statementOffset The offset at which to begin the copy.
|
|
26072
26092
|
* @param ensureUseStrict boolean determining whether the function need to add prologue-directives
|
|
26093
|
+
* @returns Count of how many directive statements were copied.
|
|
26073
26094
|
*/
|
|
26074
|
-
function copyStandardPrologue(source, target, ensureUseStrict) {
|
|
26095
|
+
function copyStandardPrologue(source, target, statementOffset, ensureUseStrict) {
|
|
26096
|
+
if (statementOffset === void 0) { statementOffset = 0; }
|
|
26075
26097
|
ts.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array");
|
|
26076
26098
|
var foundUseStrict = false;
|
|
26077
|
-
var statementOffset = 0;
|
|
26078
26099
|
var numStatements = source.length;
|
|
26079
26100
|
while (statementOffset < numStatements) {
|
|
26080
26101
|
var statement = source[statementOffset];
|
|
@@ -27497,7 +27518,7 @@ var ts;
|
|
|
27497
27518
|
importName: "__createBinding",
|
|
27498
27519
|
scoped: false,
|
|
27499
27520
|
priority: 1,
|
|
27500
|
-
text: "\n var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.
|
|
27521
|
+
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 }));"
|
|
27501
27522
|
};
|
|
27502
27523
|
ts.setModuleDefaultHelper = {
|
|
27503
27524
|
name: "typescript:commonjscreatevalue",
|
|
@@ -41132,7 +41153,7 @@ var ts;
|
|
|
41132
41153
|
? 1 /* Recursive */ : 0 /* None */
|
|
41133
41154
|
};
|
|
41134
41155
|
}
|
|
41135
|
-
if (ts.isImplicitGlob(spec)) {
|
|
41156
|
+
if (ts.isImplicitGlob(spec.substring(spec.lastIndexOf(ts.directorySeparator) + 1))) {
|
|
41136
41157
|
return {
|
|
41137
41158
|
key: useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec),
|
|
41138
41159
|
flags: 1 /* Recursive */
|
|
@@ -41498,9 +41519,7 @@ var ts;
|
|
|
41498
41519
|
}
|
|
41499
41520
|
}
|
|
41500
41521
|
var failedLookupLocations = [];
|
|
41501
|
-
var features =
|
|
41502
|
-
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
41503
|
-
NodeResolutionFeatures.None;
|
|
41522
|
+
var features = getDefaultNodeResolutionFeatures(options);
|
|
41504
41523
|
var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: features, conditions: ["node", "require", "types"] };
|
|
41505
41524
|
var resolved = primaryLookup();
|
|
41506
41525
|
var primary = true;
|
|
@@ -41585,6 +41604,34 @@ var ts;
|
|
|
41585
41604
|
}
|
|
41586
41605
|
}
|
|
41587
41606
|
ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
|
|
41607
|
+
function getDefaultNodeResolutionFeatures(options) {
|
|
41608
|
+
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 ? NodeResolutionFeatures.Node12Default :
|
|
41609
|
+
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
41610
|
+
NodeResolutionFeatures.None;
|
|
41611
|
+
}
|
|
41612
|
+
/**
|
|
41613
|
+
* @internal
|
|
41614
|
+
* Does not try `@types/${packageName}` - use a second pass if needed.
|
|
41615
|
+
*/
|
|
41616
|
+
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
|
|
41617
|
+
var moduleResolutionState = {
|
|
41618
|
+
compilerOptions: options,
|
|
41619
|
+
host: host,
|
|
41620
|
+
traceEnabled: isTraceEnabled(options, host),
|
|
41621
|
+
failedLookupLocations: [],
|
|
41622
|
+
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
41623
|
+
conditions: ts.emptyArray,
|
|
41624
|
+
features: NodeResolutionFeatures.None,
|
|
41625
|
+
};
|
|
41626
|
+
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
41627
|
+
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
41628
|
+
var nodeModulesFolder = ts.combinePaths(ancestorDirectory, "node_modules");
|
|
41629
|
+
var candidate = ts.combinePaths(nodeModulesFolder, packageName);
|
|
41630
|
+
return getPackageJsonInfo(candidate, /*onlyRecordFailures*/ false, moduleResolutionState);
|
|
41631
|
+
}
|
|
41632
|
+
});
|
|
41633
|
+
}
|
|
41634
|
+
ts.resolvePackageNameToPackageJson = resolvePackageNameToPackageJson;
|
|
41588
41635
|
/**
|
|
41589
41636
|
* Given a set of options, returns the set of type directive names
|
|
41590
41637
|
* that should be included for this program automatically.
|
|
@@ -42158,11 +42205,6 @@ var ts;
|
|
|
42158
42205
|
}
|
|
42159
42206
|
ts.resolveJSModule = resolveJSModule;
|
|
42160
42207
|
/* @internal */
|
|
42161
|
-
function tryResolveJSModule(moduleName, initialDir, host) {
|
|
42162
|
-
return tryResolveJSModuleWorker(moduleName, initialDir, host).resolvedModule;
|
|
42163
|
-
}
|
|
42164
|
-
ts.tryResolveJSModule = tryResolveJSModule;
|
|
42165
|
-
/* @internal */
|
|
42166
42208
|
var NodeResolutionFeatures;
|
|
42167
42209
|
(function (NodeResolutionFeatures) {
|
|
42168
42210
|
NodeResolutionFeatures[NodeResolutionFeatures["None"] = 0] = "None";
|
|
@@ -42470,6 +42512,97 @@ var ts;
|
|
|
42470
42512
|
var versionPaths = packageInfo && packageInfo.versionPaths;
|
|
42471
42513
|
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
|
|
42472
42514
|
}
|
|
42515
|
+
/* @internal */
|
|
42516
|
+
function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) {
|
|
42517
|
+
if (!resolveJs && packageJsonInfo.resolvedEntrypoints !== undefined) {
|
|
42518
|
+
// Cached value excludes resolutions to JS files - those could be
|
|
42519
|
+
// cached separately, but they're used rarely.
|
|
42520
|
+
return packageJsonInfo.resolvedEntrypoints;
|
|
42521
|
+
}
|
|
42522
|
+
var entrypoints;
|
|
42523
|
+
var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript;
|
|
42524
|
+
var features = getDefaultNodeResolutionFeatures(options);
|
|
42525
|
+
var requireState = {
|
|
42526
|
+
compilerOptions: options,
|
|
42527
|
+
host: host,
|
|
42528
|
+
traceEnabled: isTraceEnabled(options, host),
|
|
42529
|
+
failedLookupLocations: [],
|
|
42530
|
+
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
42531
|
+
conditions: ["node", "require", "types"],
|
|
42532
|
+
features: features,
|
|
42533
|
+
};
|
|
42534
|
+
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
|
|
42535
|
+
/*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
42536
|
+
entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
|
|
42537
|
+
if (features & NodeResolutionFeatures.Exports && packageJsonInfo.packageJsonContent.exports) {
|
|
42538
|
+
for (var _i = 0, _a = [["node", "import", "types"], ["node", "require", "types"]]; _i < _a.length; _i++) {
|
|
42539
|
+
var conditions = _a[_i];
|
|
42540
|
+
var exportState = __assign(__assign({}, requireState), { failedLookupLocations: [], conditions: conditions });
|
|
42541
|
+
var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.packageJsonContent.exports, exportState, extensions);
|
|
42542
|
+
if (exportResolutions) {
|
|
42543
|
+
for (var _b = 0, exportResolutions_1 = exportResolutions; _b < exportResolutions_1.length; _b++) {
|
|
42544
|
+
var resolution = exportResolutions_1[_b];
|
|
42545
|
+
entrypoints = ts.appendIfUnique(entrypoints, resolution.path);
|
|
42546
|
+
}
|
|
42547
|
+
}
|
|
42548
|
+
}
|
|
42549
|
+
}
|
|
42550
|
+
return packageJsonInfo.resolvedEntrypoints = entrypoints || false;
|
|
42551
|
+
}
|
|
42552
|
+
ts.getEntrypointsFromPackageJsonInfo = getEntrypointsFromPackageJsonInfo;
|
|
42553
|
+
function loadEntrypointsFromExportMap(scope, exports, state, extensions) {
|
|
42554
|
+
var entrypoints;
|
|
42555
|
+
if (ts.isArray(exports)) {
|
|
42556
|
+
for (var _i = 0, exports_1 = exports; _i < exports_1.length; _i++) {
|
|
42557
|
+
var target = exports_1[_i];
|
|
42558
|
+
loadEntrypointsFromTargetExports(target);
|
|
42559
|
+
}
|
|
42560
|
+
}
|
|
42561
|
+
// eslint-disable-next-line no-null/no-null
|
|
42562
|
+
else if (typeof exports === "object" && exports !== null && allKeysStartWithDot(exports)) {
|
|
42563
|
+
for (var key in exports) {
|
|
42564
|
+
loadEntrypointsFromTargetExports(exports[key]);
|
|
42565
|
+
}
|
|
42566
|
+
}
|
|
42567
|
+
else {
|
|
42568
|
+
loadEntrypointsFromTargetExports(exports);
|
|
42569
|
+
}
|
|
42570
|
+
return entrypoints;
|
|
42571
|
+
function loadEntrypointsFromTargetExports(target) {
|
|
42572
|
+
var _a, _b;
|
|
42573
|
+
if (typeof target === "string" && ts.startsWith(target, "./") && target.indexOf("*") === -1) {
|
|
42574
|
+
var partsAfterFirst = ts.getPathComponents(target).slice(2);
|
|
42575
|
+
if (partsAfterFirst.indexOf("..") >= 0 || partsAfterFirst.indexOf(".") >= 0 || partsAfterFirst.indexOf("node_modules") >= 0) {
|
|
42576
|
+
return false;
|
|
42577
|
+
}
|
|
42578
|
+
var resolvedTarget = ts.combinePaths(scope.packageDirectory, target);
|
|
42579
|
+
var finalPath = ts.getNormalizedAbsolutePath(resolvedTarget, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
42580
|
+
var result = loadJSOrExactTSFileName(extensions, finalPath, /*recordOnlyFailures*/ false, state);
|
|
42581
|
+
if (result) {
|
|
42582
|
+
entrypoints = ts.appendIfUnique(entrypoints, result, function (a, b) { return a.path === b.path; });
|
|
42583
|
+
return true;
|
|
42584
|
+
}
|
|
42585
|
+
}
|
|
42586
|
+
else if (Array.isArray(target)) {
|
|
42587
|
+
for (var _i = 0, target_1 = target; _i < target_1.length; _i++) {
|
|
42588
|
+
var t = target_1[_i];
|
|
42589
|
+
var success = loadEntrypointsFromTargetExports(t);
|
|
42590
|
+
if (success) {
|
|
42591
|
+
return true;
|
|
42592
|
+
}
|
|
42593
|
+
}
|
|
42594
|
+
}
|
|
42595
|
+
// eslint-disable-next-line no-null/no-null
|
|
42596
|
+
else if (typeof target === "object" && target !== null) {
|
|
42597
|
+
return ts.forEach(ts.getOwnKeys(target), function (key) {
|
|
42598
|
+
if (key === "default" || ts.contains(state.conditions, key) || isApplicableVersionedTypesKey(state.conditions, key)) {
|
|
42599
|
+
loadEntrypointsFromTargetExports(target[key]);
|
|
42600
|
+
return true;
|
|
42601
|
+
}
|
|
42602
|
+
});
|
|
42603
|
+
}
|
|
42604
|
+
}
|
|
42605
|
+
}
|
|
42473
42606
|
/**
|
|
42474
42607
|
* A function for locating the package.json scope for a given path
|
|
42475
42608
|
*/
|
|
@@ -42526,7 +42659,7 @@ var ts;
|
|
|
42526
42659
|
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
42527
42660
|
}
|
|
42528
42661
|
var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
|
|
42529
|
-
var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths };
|
|
42662
|
+
var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
|
|
42530
42663
|
(_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
42531
42664
|
return result;
|
|
42532
42665
|
}
|
|
@@ -42823,8 +42956,8 @@ var ts;
|
|
|
42823
42956
|
}
|
|
42824
42957
|
return toSearchResult(/*value*/ undefined);
|
|
42825
42958
|
}
|
|
42826
|
-
for (var _d = 0,
|
|
42827
|
-
var elem =
|
|
42959
|
+
for (var _d = 0, target_2 = target; _d < target_2.length; _d++) {
|
|
42960
|
+
var elem = target_2[_d];
|
|
42828
42961
|
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
|
|
42829
42962
|
if (result) {
|
|
42830
42963
|
return result;
|
|
@@ -49853,7 +49986,7 @@ var ts;
|
|
|
49853
49986
|
if (!sigs || !sigs.length) {
|
|
49854
49987
|
sigs = getSignaturesOfStructuredType(type, 1 /* Construct */);
|
|
49855
49988
|
}
|
|
49856
|
-
if ((sigs && sigs.length) || getPropertyOfType(type, "default" /* Default */)) {
|
|
49989
|
+
if ((sigs && sigs.length) || getPropertyOfType(type, "default" /* Default */, /*skipObjectFunctionPropertyAugment*/ true)) {
|
|
49857
49990
|
var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference);
|
|
49858
49991
|
return cloneTypeAsModuleType(symbol, moduleType, referenceParent);
|
|
49859
49992
|
}
|
|
@@ -52057,8 +52190,8 @@ var ts;
|
|
|
52057
52190
|
}
|
|
52058
52191
|
else {
|
|
52059
52192
|
if (parent && getExportsOfSymbol(parent)) {
|
|
52060
|
-
var
|
|
52061
|
-
ts.forEachEntry(
|
|
52193
|
+
var exports_2 = getExportsOfSymbol(parent);
|
|
52194
|
+
ts.forEachEntry(exports_2, function (ex, name) {
|
|
52062
52195
|
if (getSymbolIfSameReference(ex, symbol) && !isLateBoundName(name) && name !== "export=" /* ExportEquals */) {
|
|
52063
52196
|
symbolName = ts.unescapeLeadingUnderscores(name);
|
|
52064
52197
|
return true;
|
|
@@ -57169,6 +57302,11 @@ var ts;
|
|
|
57169
57302
|
return simplified !== type ? simplified : getConstraintOfType(type);
|
|
57170
57303
|
}
|
|
57171
57304
|
function getConstraintFromIndexedAccess(type) {
|
|
57305
|
+
if (isMappedTypeGenericIndexedAccess(type)) {
|
|
57306
|
+
// For indexed access types of the form { [P in K]: E }[X], where K is non-generic and X is generic,
|
|
57307
|
+
// we substitute an instantiation of E where P is replaced with X.
|
|
57308
|
+
return substituteIndexedMappedType(type.objectType, type.indexType);
|
|
57309
|
+
}
|
|
57172
57310
|
var indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
|
|
57173
57311
|
if (indexConstraint && indexConstraint !== type.indexType) {
|
|
57174
57312
|
var indexedAccess = getIndexedAccessTypeOrUndefined(type.objectType, indexConstraint, type.accessFlags);
|
|
@@ -57373,6 +57511,11 @@ var ts;
|
|
|
57373
57511
|
return constraint ? getStringMappingType(t.symbol, constraint) : stringType;
|
|
57374
57512
|
}
|
|
57375
57513
|
if (t.flags & 8388608 /* IndexedAccess */) {
|
|
57514
|
+
if (isMappedTypeGenericIndexedAccess(t)) {
|
|
57515
|
+
// For indexed access types of the form { [P in K]: E }[X], where K is non-generic and X is generic,
|
|
57516
|
+
// we substitute an instantiation of E where P is replaced with X.
|
|
57517
|
+
return getBaseConstraint(substituteIndexedMappedType(t.objectType, t.indexType));
|
|
57518
|
+
}
|
|
57376
57519
|
var baseObjectType = getBaseConstraint(t.objectType);
|
|
57377
57520
|
var baseIndexType = getBaseConstraint(t.indexType);
|
|
57378
57521
|
var baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, t.accessFlags);
|
|
@@ -57457,13 +57600,7 @@ var ts;
|
|
|
57457
57600
|
* type itself.
|
|
57458
57601
|
*/
|
|
57459
57602
|
function getApparentType(type) {
|
|
57460
|
-
|
|
57461
|
-
// { [P in K]: E }[X], where K is non-generic and X is generic. For those types, we instead substitute an
|
|
57462
|
-
// instantiation of E where P is replaced with X. We do this because getBaseConstraintOfType directly
|
|
57463
|
-
// lowers to an instantiation where X's constraint is substituted for X, which isn't always desirable.
|
|
57464
|
-
var t = !(type.flags & 465829888 /* Instantiable */) ? type :
|
|
57465
|
-
isMappedTypeGenericIndexedAccess(type) ? substituteIndexedMappedType(type.objectType, type.indexType) :
|
|
57466
|
-
getBaseConstraintOfType(type) || unknownType;
|
|
57603
|
+
var t = !(type.flags & 465829888 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
|
|
57467
57604
|
return ts.getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) :
|
|
57468
57605
|
t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
|
|
57469
57606
|
t.flags & 402653316 /* StringLike */ ? globalStringType :
|
|
@@ -64127,6 +64264,17 @@ var ts;
|
|
|
64127
64264
|
resetErrorInfo(saveErrorInfo);
|
|
64128
64265
|
return result;
|
|
64129
64266
|
}
|
|
64267
|
+
if (isMappedTypeGenericIndexedAccess(source)) {
|
|
64268
|
+
// For an indexed access type { [P in K]: E}[X], above we have already explored an instantiation of E with X
|
|
64269
|
+
// substituted for P. We also want to explore type { [P in K]: E }[C], where C is the constraint of X.
|
|
64270
|
+
var indexConstraint = getConstraintOfType(source.indexType);
|
|
64271
|
+
if (indexConstraint) {
|
|
64272
|
+
if (result = isRelatedTo(getIndexedAccessType(source.objectType, indexConstraint), target, 1 /* Source */, reportErrors)) {
|
|
64273
|
+
resetErrorInfo(saveErrorInfo);
|
|
64274
|
+
return result;
|
|
64275
|
+
}
|
|
64276
|
+
}
|
|
64277
|
+
}
|
|
64130
64278
|
}
|
|
64131
64279
|
}
|
|
64132
64280
|
else if (source.flags & 4194304 /* Index */) {
|
|
@@ -78390,32 +78538,38 @@ var ts;
|
|
|
78390
78538
|
if (classExtendsNull) {
|
|
78391
78539
|
error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
78392
78540
|
}
|
|
78393
|
-
//
|
|
78394
|
-
// if both of the following are true:
|
|
78541
|
+
// A super call must be root-level in a constructor if both of the following are true:
|
|
78395
78542
|
// - The containing class is a derived class.
|
|
78396
78543
|
// - The constructor declares parameter properties
|
|
78397
78544
|
// or the containing class declares instance member variables with initializers.
|
|
78398
|
-
var
|
|
78545
|
+
var superCallShouldBeRootLevel = (ts.getEmitScriptTarget(compilerOptions) !== 99 /* ESNext */ || !useDefineForClassFields) &&
|
|
78399
78546
|
(ts.some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) ||
|
|
78400
78547
|
ts.some(node.parameters, function (p) { return ts.hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */); }));
|
|
78401
|
-
|
|
78402
|
-
|
|
78403
|
-
|
|
78404
|
-
|
|
78405
|
-
|
|
78406
|
-
|
|
78407
|
-
|
|
78408
|
-
|
|
78409
|
-
|
|
78410
|
-
|
|
78548
|
+
if (superCallShouldBeRootLevel) {
|
|
78549
|
+
// Until we have better flow analysis, it is an error to place the super call within any kind of block or conditional
|
|
78550
|
+
// See GH #8277
|
|
78551
|
+
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
78552
|
+
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);
|
|
78553
|
+
}
|
|
78554
|
+
// Skip past any prologue directives to check statements for referring to 'super' or 'this' before a super call
|
|
78555
|
+
else {
|
|
78556
|
+
var superCallStatement = void 0;
|
|
78557
|
+
for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) {
|
|
78558
|
+
var statement = _a[_i];
|
|
78559
|
+
if (ts.isExpressionStatement(statement) && ts.isSuperCall(ts.skipOuterExpressions(statement.expression))) {
|
|
78560
|
+
superCallStatement = statement;
|
|
78561
|
+
break;
|
|
78562
|
+
}
|
|
78563
|
+
if (!ts.isPrologueDirective(statement) && nodeImmediatelyReferencesSuperOrThis(statement)) {
|
|
78564
|
+
break;
|
|
78565
|
+
}
|
|
78411
78566
|
}
|
|
78412
|
-
|
|
78413
|
-
|
|
78567
|
+
// Until we have better flow analysis, it is an error to place the super call within any kind of block or conditional
|
|
78568
|
+
// See GH #8277
|
|
78569
|
+
if (superCallStatement === undefined) {
|
|
78570
|
+
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);
|
|
78414
78571
|
}
|
|
78415
78572
|
}
|
|
78416
|
-
if (!superCallStatement) {
|
|
78417
|
-
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);
|
|
78418
|
-
}
|
|
78419
78573
|
}
|
|
78420
78574
|
}
|
|
78421
78575
|
else if (!classExtendsNull) {
|
|
@@ -78423,6 +78577,19 @@ var ts;
|
|
|
78423
78577
|
}
|
|
78424
78578
|
}
|
|
78425
78579
|
}
|
|
78580
|
+
function superCallIsRootLevelInConstructor(superCall, body) {
|
|
78581
|
+
var superCallParent = ts.walkUpParenthesizedExpressions(superCall.parent);
|
|
78582
|
+
return ts.isExpressionStatement(superCallParent) && superCallParent.parent === body;
|
|
78583
|
+
}
|
|
78584
|
+
function nodeImmediatelyReferencesSuperOrThis(node) {
|
|
78585
|
+
if (node.kind === 106 /* SuperKeyword */ || node.kind === 108 /* ThisKeyword */) {
|
|
78586
|
+
return true;
|
|
78587
|
+
}
|
|
78588
|
+
if (ts.isThisContainerOrFunctionBlock(node)) {
|
|
78589
|
+
return false;
|
|
78590
|
+
}
|
|
78591
|
+
return !!ts.forEachChild(node, nodeImmediatelyReferencesSuperOrThis);
|
|
78592
|
+
}
|
|
78426
78593
|
function checkAccessorDeclaration(node) {
|
|
78427
78594
|
if (produceDiagnostics) {
|
|
78428
78595
|
// Grammar checking accessors
|
|
@@ -83245,9 +83412,9 @@ var ts;
|
|
|
83245
83412
|
}
|
|
83246
83413
|
}
|
|
83247
83414
|
// Checks for export * conflicts
|
|
83248
|
-
var
|
|
83249
|
-
if (
|
|
83250
|
-
|
|
83415
|
+
var exports_3 = getExportsOfModule(moduleSymbol);
|
|
83416
|
+
if (exports_3) {
|
|
83417
|
+
exports_3.forEach(function (_a, id) {
|
|
83251
83418
|
var declarations = _a.declarations, flags = _a.flags;
|
|
83252
83419
|
if (id === "__export") {
|
|
83253
83420
|
return;
|
|
@@ -88545,34 +88712,31 @@ var ts;
|
|
|
88545
88712
|
}
|
|
88546
88713
|
ts.getNonAssignmentOperatorForCompoundAssignment = getNonAssignmentOperatorForCompoundAssignment;
|
|
88547
88714
|
/**
|
|
88548
|
-
*
|
|
88549
|
-
|
|
88550
|
-
|
|
88551
|
-
|
|
88552
|
-
|
|
88553
|
-
|
|
88715
|
+
* @returns Contained super() call from descending into the statement ignoring parentheses, if that call exists.
|
|
88716
|
+
*/
|
|
88717
|
+
function getSuperCallFromStatement(statement) {
|
|
88718
|
+
if (!ts.isExpressionStatement(statement)) {
|
|
88719
|
+
return undefined;
|
|
88720
|
+
}
|
|
88721
|
+
var expression = ts.skipParentheses(statement.expression);
|
|
88722
|
+
return ts.isSuperCall(expression)
|
|
88723
|
+
? expression
|
|
88724
|
+
: undefined;
|
|
88725
|
+
}
|
|
88726
|
+
ts.getSuperCallFromStatement = getSuperCallFromStatement;
|
|
88727
|
+
/**
|
|
88728
|
+
* @returns The index (after prologue statements) of a super call, or -1 if not found.
|
|
88554
88729
|
*/
|
|
88555
|
-
function
|
|
88556
|
-
|
|
88557
|
-
var
|
|
88558
|
-
|
|
88559
|
-
|
|
88560
|
-
if (index === statements.length) {
|
|
88561
|
-
// list contains nothing but prologue directives (or empty) - exit
|
|
88562
|
-
return index;
|
|
88563
|
-
}
|
|
88564
|
-
var superIndex = ts.findIndex(statements, function (s) { return ts.isExpressionStatement(s) && ts.isSuperCall(s.expression); }, index);
|
|
88565
|
-
if (superIndex > -1) {
|
|
88566
|
-
for (var i = index; i <= superIndex; i++) {
|
|
88567
|
-
result.push(ts.visitNode(statements[i], visitor, ts.isStatement));
|
|
88568
|
-
}
|
|
88569
|
-
return superIndex + 1;
|
|
88730
|
+
function findSuperStatementIndex(statements, indexAfterLastPrologueStatement) {
|
|
88731
|
+
for (var i = indexAfterLastPrologueStatement; i < statements.length; i += 1) {
|
|
88732
|
+
var statement = statements[i];
|
|
88733
|
+
if (getSuperCallFromStatement(statement)) {
|
|
88734
|
+
return i;
|
|
88570
88735
|
}
|
|
88571
|
-
return index;
|
|
88572
88736
|
}
|
|
88573
|
-
return
|
|
88737
|
+
return -1;
|
|
88574
88738
|
}
|
|
88575
|
-
ts.
|
|
88739
|
+
ts.findSuperStatementIndex = findSuperStatementIndex;
|
|
88576
88740
|
function getProperties(node, requireInitializer, isStatic) {
|
|
88577
88741
|
return ts.filter(node.members, function (m) { return isInitializedOrStaticProperty(m, requireInitializer, isStatic); });
|
|
88578
88742
|
}
|
|
@@ -90471,6 +90635,7 @@ var ts;
|
|
|
90471
90635
|
case 176 /* TypePredicate */:
|
|
90472
90636
|
case 133 /* BooleanKeyword */:
|
|
90473
90637
|
return factory.createIdentifier("Boolean");
|
|
90638
|
+
case 197 /* TemplateLiteralType */:
|
|
90474
90639
|
case 149 /* StringKeyword */:
|
|
90475
90640
|
return factory.createIdentifier("String");
|
|
90476
90641
|
case 147 /* ObjectKeyword */:
|
|
@@ -90809,10 +90974,14 @@ var ts;
|
|
|
90809
90974
|
return ts.visitFunctionBody(body, visitor, context);
|
|
90810
90975
|
}
|
|
90811
90976
|
var statements = [];
|
|
90812
|
-
var indexOfFirstStatement = 0;
|
|
90813
90977
|
resumeLexicalEnvironment();
|
|
90814
|
-
|
|
90815
|
-
|
|
90978
|
+
var indexAfterLastPrologueStatement = factory.copyPrologue(body.statements, statements, /*ensureUseStrict*/ false, visitor);
|
|
90979
|
+
var superStatementIndex = ts.findSuperStatementIndex(body.statements, indexAfterLastPrologueStatement);
|
|
90980
|
+
// If there was a super call, visit existing statements up to and including it
|
|
90981
|
+
if (superStatementIndex >= 0) {
|
|
90982
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, indexAfterLastPrologueStatement, superStatementIndex + 1 - indexAfterLastPrologueStatement));
|
|
90983
|
+
}
|
|
90984
|
+
// Transform parameters into property assignments. Transforms this:
|
|
90816
90985
|
//
|
|
90817
90986
|
// constructor (public x, public y) {
|
|
90818
90987
|
// }
|
|
@@ -90824,9 +90993,17 @@ var ts;
|
|
|
90824
90993
|
// this.y = y;
|
|
90825
90994
|
// }
|
|
90826
90995
|
//
|
|
90827
|
-
|
|
90828
|
-
//
|
|
90829
|
-
|
|
90996
|
+
var parameterPropertyAssignments = ts.mapDefined(parametersWithPropertyAssignments, transformParameterWithPropertyAssignment);
|
|
90997
|
+
// If there is a super() call, the parameter properties go immediately after it
|
|
90998
|
+
if (superStatementIndex >= 0) {
|
|
90999
|
+
ts.addRange(statements, parameterPropertyAssignments);
|
|
91000
|
+
}
|
|
91001
|
+
// Since there was no super() call, parameter properties are the first statements in the constructor
|
|
91002
|
+
else {
|
|
91003
|
+
statements = ts.addRange(parameterPropertyAssignments, statements);
|
|
91004
|
+
}
|
|
91005
|
+
// Add remaining statements from the body, skipping the super() call if it was found
|
|
91006
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1));
|
|
90830
91007
|
// End the lexical environment.
|
|
90831
91008
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
90832
91009
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
|
|
@@ -92724,6 +92901,7 @@ var ts;
|
|
|
92724
92901
|
/*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor));
|
|
92725
92902
|
}
|
|
92726
92903
|
function transformConstructorBody(node, constructor, isDerivedClass) {
|
|
92904
|
+
var _a;
|
|
92727
92905
|
var properties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false);
|
|
92728
92906
|
if (!useDefineForClassFields) {
|
|
92729
92907
|
properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); });
|
|
@@ -92735,9 +92913,21 @@ var ts;
|
|
|
92735
92913
|
return ts.visitFunctionBody(/*node*/ undefined, visitor, context);
|
|
92736
92914
|
}
|
|
92737
92915
|
resumeLexicalEnvironment();
|
|
92738
|
-
var
|
|
92916
|
+
var needsSyntheticConstructor = !constructor && isDerivedClass;
|
|
92917
|
+
var indexOfFirstStatementAfterSuper = 0;
|
|
92918
|
+
var prologueStatementCount = 0;
|
|
92919
|
+
var superStatementIndex = -1;
|
|
92739
92920
|
var statements = [];
|
|
92740
|
-
if (
|
|
92921
|
+
if ((_a = constructor === null || constructor === void 0 ? void 0 : constructor.body) === null || _a === void 0 ? void 0 : _a.statements) {
|
|
92922
|
+
prologueStatementCount = factory.copyPrologue(constructor.body.statements, statements, /*ensureUseStrict*/ false, visitor);
|
|
92923
|
+
superStatementIndex = ts.findSuperStatementIndex(constructor.body.statements, prologueStatementCount);
|
|
92924
|
+
// If there was a super call, visit existing statements up to and including it
|
|
92925
|
+
if (superStatementIndex >= 0) {
|
|
92926
|
+
indexOfFirstStatementAfterSuper = superStatementIndex + 1;
|
|
92927
|
+
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);
|
|
92928
|
+
}
|
|
92929
|
+
}
|
|
92930
|
+
if (needsSyntheticConstructor) {
|
|
92741
92931
|
// Add a synthetic `super` call:
|
|
92742
92932
|
//
|
|
92743
92933
|
// super(...arguments);
|
|
@@ -92745,9 +92935,6 @@ var ts;
|
|
|
92745
92935
|
statements.push(factory.createExpressionStatement(factory.createCallExpression(factory.createSuper(),
|
|
92746
92936
|
/*typeArguments*/ undefined, [factory.createSpreadElement(factory.createIdentifier("arguments"))])));
|
|
92747
92937
|
}
|
|
92748
|
-
if (constructor) {
|
|
92749
|
-
indexOfFirstStatement = ts.addPrologueDirectivesAndInitialSuperCall(factory, constructor, statements, visitor);
|
|
92750
|
-
}
|
|
92751
92938
|
// Add the property initializers. Transforms this:
|
|
92752
92939
|
//
|
|
92753
92940
|
// public x = 1;
|
|
@@ -92758,31 +92945,59 @@ var ts;
|
|
|
92758
92945
|
// this.x = 1;
|
|
92759
92946
|
// }
|
|
92760
92947
|
//
|
|
92948
|
+
// If we do useDefineForClassFields, they'll be converted elsewhere.
|
|
92949
|
+
// We instead *remove* them from the transformed output at this stage.
|
|
92950
|
+
var parameterPropertyDeclarationCount = 0;
|
|
92761
92951
|
if (constructor === null || constructor === void 0 ? void 0 : constructor.body) {
|
|
92762
|
-
|
|
92763
|
-
|
|
92764
|
-
afterParameterProperties = constructor.body.statements.length;
|
|
92952
|
+
if (useDefineForClassFields) {
|
|
92953
|
+
statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); });
|
|
92765
92954
|
}
|
|
92766
|
-
|
|
92767
|
-
|
|
92768
|
-
|
|
92955
|
+
else {
|
|
92956
|
+
for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) {
|
|
92957
|
+
var statement = _b[_i];
|
|
92958
|
+
if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) {
|
|
92959
|
+
parameterPropertyDeclarationCount++;
|
|
92960
|
+
}
|
|
92961
|
+
}
|
|
92962
|
+
if (parameterPropertyDeclarationCount > 0) {
|
|
92963
|
+
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatementAfterSuper, parameterPropertyDeclarationCount);
|
|
92964
|
+
// If there was a super() call found, add parameter properties immediately after it
|
|
92965
|
+
if (superStatementIndex >= 0) {
|
|
92966
|
+
ts.addRange(statements, parameterProperties);
|
|
92967
|
+
}
|
|
92968
|
+
// If a synthetic super() call was added, add them just after it
|
|
92969
|
+
else if (needsSyntheticConstructor) {
|
|
92970
|
+
statements = __spreadArray(__spreadArray([
|
|
92971
|
+
statements[0]
|
|
92972
|
+
], parameterProperties, true), statements.slice(1), true);
|
|
92973
|
+
}
|
|
92974
|
+
// Since there wasn't a super() call, add them to the top of the constructor
|
|
92975
|
+
else {
|
|
92976
|
+
statements = __spreadArray(__spreadArray([], parameterProperties, true), statements, true);
|
|
92977
|
+
}
|
|
92978
|
+
indexOfFirstStatementAfterSuper += parameterPropertyDeclarationCount;
|
|
92769
92979
|
}
|
|
92770
|
-
indexOfFirstStatement = afterParameterProperties;
|
|
92771
92980
|
}
|
|
92772
92981
|
}
|
|
92773
92982
|
var receiver = factory.createThis();
|
|
92774
92983
|
// private methods can be called in property initializers, they should execute first.
|
|
92775
92984
|
addMethodStatements(statements, privateMethodsAndAccessors, receiver);
|
|
92776
92985
|
addPropertyOrClassStaticBlockStatements(statements, properties, receiver);
|
|
92777
|
-
// Add existing statements
|
|
92986
|
+
// Add existing statements after the initial prologues and super call
|
|
92778
92987
|
if (constructor) {
|
|
92779
|
-
ts.addRange(statements, ts.visitNodes(constructor.body.statements,
|
|
92988
|
+
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuper + prologueStatementCount));
|
|
92780
92989
|
}
|
|
92781
92990
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
92782
92991
|
return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements),
|
|
92783
92992
|
/*location*/ constructor ? constructor.body.statements : node.members),
|
|
92784
92993
|
/*multiLine*/ true),
|
|
92785
92994
|
/*location*/ constructor ? constructor.body : undefined);
|
|
92995
|
+
function visitBodyStatement(statement) {
|
|
92996
|
+
if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) {
|
|
92997
|
+
return undefined;
|
|
92998
|
+
}
|
|
92999
|
+
return visitor(statement);
|
|
93000
|
+
}
|
|
92786
93001
|
}
|
|
92787
93002
|
/**
|
|
92788
93003
|
* Generates assignment statements for property initializers.
|
|
@@ -92803,6 +93018,11 @@ var ts;
|
|
|
92803
93018
|
ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));
|
|
92804
93019
|
ts.setCommentRange(statement, property);
|
|
92805
93020
|
ts.setOriginalNode(statement, property);
|
|
93021
|
+
// `setOriginalNode` *copies* the `emitNode` from `property`, so now both
|
|
93022
|
+
// `statement` and `expression` have a copy of the synthesized comments.
|
|
93023
|
+
// Drop the comments from expression to avoid printing them twice.
|
|
93024
|
+
ts.setSyntheticLeadingComments(expression, undefined);
|
|
93025
|
+
ts.setSyntheticTrailingComments(expression, undefined);
|
|
92806
93026
|
statements.push(statement);
|
|
92807
93027
|
}
|
|
92808
93028
|
}
|
|
@@ -96569,37 +96789,39 @@ var ts;
|
|
|
96569
96789
|
var prologue = [];
|
|
96570
96790
|
var statements = [];
|
|
96571
96791
|
resumeLexicalEnvironment();
|
|
96792
|
+
// In derived classes, there may be code before the necessary super() call
|
|
96793
|
+
// We'll remove pre-super statements to be tacked on after the rest of the body
|
|
96794
|
+
var existingPrologue = ts.takeWhile(constructor.body.statements, ts.isPrologueDirective);
|
|
96795
|
+
var _a = findSuperCallAndStatementIndex(constructor.body.statements, existingPrologue), superCall = _a.superCall, superStatementIndex = _a.superStatementIndex;
|
|
96796
|
+
var postSuperStatementsStart = superStatementIndex === -1 ? existingPrologue.length : superStatementIndex + 1;
|
|
96572
96797
|
// If a super call has already been synthesized,
|
|
96573
96798
|
// we're going to assume that we should just transform everything after that.
|
|
96574
96799
|
// The assumption is that no prior step in the pipeline has added any prologue directives.
|
|
96575
|
-
var statementOffset =
|
|
96800
|
+
var statementOffset = postSuperStatementsStart;
|
|
96576
96801
|
if (!hasSynthesizedSuper)
|
|
96577
|
-
statementOffset = factory.copyStandardPrologue(constructor.body.statements, prologue, /*ensureUseStrict*/ false);
|
|
96578
|
-
addDefaultValueAssignmentsIfNeeded(statements, constructor);
|
|
96579
|
-
addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
|
|
96802
|
+
statementOffset = factory.copyStandardPrologue(constructor.body.statements, prologue, statementOffset, /*ensureUseStrict*/ false);
|
|
96580
96803
|
if (!hasSynthesizedSuper)
|
|
96581
|
-
statementOffset = factory.copyCustomPrologue(constructor.body.statements, statements, statementOffset, visitor);
|
|
96582
|
-
// If
|
|
96804
|
+
statementOffset = factory.copyCustomPrologue(constructor.body.statements, statements, statementOffset, visitor, /*filter*/ undefined);
|
|
96805
|
+
// If there already exists a call to `super()`, visit the statement directly
|
|
96583
96806
|
var superCallExpression;
|
|
96584
96807
|
if (hasSynthesizedSuper) {
|
|
96585
96808
|
superCallExpression = createDefaultSuperCallOrThis();
|
|
96586
96809
|
}
|
|
96587
|
-
else if (
|
|
96588
|
-
|
|
96589
|
-
if (ts.isExpressionStatement(firstStatement) && ts.isSuperCall(firstStatement.expression)) {
|
|
96590
|
-
superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression);
|
|
96591
|
-
}
|
|
96810
|
+
else if (superCall) {
|
|
96811
|
+
superCallExpression = visitSuperCallInBody(superCall);
|
|
96592
96812
|
}
|
|
96593
96813
|
if (superCallExpression) {
|
|
96594
96814
|
hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
|
|
96595
|
-
statementOffset++; // skip this statement, we will add it after visiting the rest of the body.
|
|
96596
96815
|
}
|
|
96816
|
+
// Add parameter defaults at the beginning of the output, with prologue statements
|
|
96817
|
+
addDefaultValueAssignmentsIfNeeded(prologue, constructor);
|
|
96818
|
+
addRestParameterIfNeeded(prologue, constructor, hasSynthesizedSuper);
|
|
96597
96819
|
// visit the remaining statements
|
|
96598
96820
|
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, /*start*/ statementOffset));
|
|
96599
96821
|
factory.mergeLexicalEnvironment(prologue, endLexicalEnvironment());
|
|
96600
96822
|
insertCaptureNewTargetIfNeeded(prologue, constructor, /*copyOnWrite*/ false);
|
|
96601
|
-
if (isDerivedClass) {
|
|
96602
|
-
if (superCallExpression &&
|
|
96823
|
+
if (isDerivedClass || superCallExpression) {
|
|
96824
|
+
if (superCallExpression && postSuperStatementsStart === constructor.body.statements.length && !(constructor.body.transformFlags & 8192 /* ContainsLexicalThis */)) {
|
|
96603
96825
|
// If the subclass constructor does *not* contain `this` and *ends* with a `super()` call, we will use the
|
|
96604
96826
|
// following representation:
|
|
96605
96827
|
//
|
|
@@ -96619,10 +96841,10 @@ var ts;
|
|
|
96619
96841
|
// return C;
|
|
96620
96842
|
// })(Base);
|
|
96621
96843
|
// ```
|
|
96622
|
-
var
|
|
96844
|
+
var superCall_1 = ts.cast(ts.cast(superCallExpression, ts.isBinaryExpression).left, ts.isCallExpression);
|
|
96623
96845
|
var returnStatement = factory.createReturnStatement(superCallExpression);
|
|
96624
|
-
ts.setCommentRange(returnStatement, ts.getCommentRange(
|
|
96625
|
-
ts.setEmitFlags(
|
|
96846
|
+
ts.setCommentRange(returnStatement, ts.getCommentRange(superCall_1));
|
|
96847
|
+
ts.setEmitFlags(superCall_1, 1536 /* NoComments */);
|
|
96626
96848
|
statements.push(returnStatement);
|
|
96627
96849
|
}
|
|
96628
96850
|
else {
|
|
@@ -96647,9 +96869,19 @@ var ts;
|
|
|
96647
96869
|
// return C;
|
|
96648
96870
|
// })(Base);
|
|
96649
96871
|
// ```
|
|
96650
|
-
//
|
|
96651
|
-
|
|
96652
|
-
|
|
96872
|
+
// If the super() call is the first statement, we can directly create and assign its result to `_this`
|
|
96873
|
+
if (superStatementIndex <= existingPrologue.length) {
|
|
96874
|
+
insertCaptureThisForNode(statements, constructor, superCallExpression || createActualThis());
|
|
96875
|
+
}
|
|
96876
|
+
// Since the `super()` call isn't the first statement, it's split across 1-2 statements:
|
|
96877
|
+
// * A prologue `var _this = this;`, in case the constructor accesses this before super()
|
|
96878
|
+
// * If it exists, a reassignment to that `_this` of the super() call
|
|
96879
|
+
else {
|
|
96880
|
+
insertCaptureThisForNode(prologue, constructor, createActualThis());
|
|
96881
|
+
if (superCallExpression) {
|
|
96882
|
+
insertSuperThisCaptureThisForNode(statements, superCallExpression);
|
|
96883
|
+
}
|
|
96884
|
+
}
|
|
96653
96885
|
if (!isSufficientlyCoveredByReturnStatements(constructor.body)) {
|
|
96654
96886
|
statements.push(factory.createReturnStatement(factory.createUniqueName("_this", 16 /* Optimistic */ | 32 /* FileLevel */)));
|
|
96655
96887
|
}
|
|
@@ -96672,11 +96904,27 @@ var ts;
|
|
|
96672
96904
|
// ```
|
|
96673
96905
|
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
96674
96906
|
}
|
|
96675
|
-
var
|
|
96907
|
+
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)),
|
|
96676
96908
|
/*location*/ constructor.body.statements),
|
|
96677
96909
|
/*multiLine*/ true);
|
|
96678
|
-
ts.setTextRange(
|
|
96679
|
-
return
|
|
96910
|
+
ts.setTextRange(body, constructor.body);
|
|
96911
|
+
return body;
|
|
96912
|
+
}
|
|
96913
|
+
function findSuperCallAndStatementIndex(originalBodyStatements, existingPrologue) {
|
|
96914
|
+
for (var i = existingPrologue.length; i < originalBodyStatements.length; i += 1) {
|
|
96915
|
+
var superCall = ts.getSuperCallFromStatement(originalBodyStatements[i]);
|
|
96916
|
+
if (superCall) {
|
|
96917
|
+
// With a super() call, split the statements into pre-super() and 'body' (post-super())
|
|
96918
|
+
return {
|
|
96919
|
+
superCall: superCall,
|
|
96920
|
+
superStatementIndex: i,
|
|
96921
|
+
};
|
|
96922
|
+
}
|
|
96923
|
+
}
|
|
96924
|
+
// Since there was no super() call found, consider all statements to be in the main 'body' (post-super())
|
|
96925
|
+
return {
|
|
96926
|
+
superStatementIndex: -1,
|
|
96927
|
+
};
|
|
96680
96928
|
}
|
|
96681
96929
|
/**
|
|
96682
96930
|
* We want to try to avoid emitting a return statement in certain cases if a user already returned something.
|
|
@@ -96905,6 +97153,18 @@ var ts;
|
|
|
96905
97153
|
}
|
|
96906
97154
|
return false;
|
|
96907
97155
|
}
|
|
97156
|
+
/**
|
|
97157
|
+
* Assigns the `this` in a constructor to the result of its `super()` call.
|
|
97158
|
+
*
|
|
97159
|
+
* @param statements Statements in the constructor body.
|
|
97160
|
+
* @param superExpression Existing `super()` call for the constructor.
|
|
97161
|
+
*/
|
|
97162
|
+
function insertSuperThisCaptureThisForNode(statements, superExpression) {
|
|
97163
|
+
enableSubstitutionsForCapturedThis();
|
|
97164
|
+
var assignSuperExpression = factory.createExpressionStatement(factory.createBinaryExpression(factory.createThis(), 63 /* EqualsToken */, superExpression));
|
|
97165
|
+
ts.insertStatementAfterCustomPrologue(statements, assignSuperExpression);
|
|
97166
|
+
ts.setCommentRange(assignSuperExpression, ts.getOriginalNode(superExpression).parent);
|
|
97167
|
+
}
|
|
96908
97168
|
function insertCaptureThisForNode(statements, node, initializer) {
|
|
96909
97169
|
enableSubstitutionsForCapturedThis();
|
|
96910
97170
|
var captureThisStatement = factory.createVariableStatement(
|
|
@@ -97214,7 +97474,7 @@ var ts;
|
|
|
97214
97474
|
if (ts.isBlock(body)) {
|
|
97215
97475
|
// ensureUseStrict is false because no new prologue-directive should be added.
|
|
97216
97476
|
// addStandardPrologue will put already-existing directives at the beginning of the target statement-array
|
|
97217
|
-
statementOffset = factory.copyStandardPrologue(body.statements, prologue, /*ensureUseStrict*/ false);
|
|
97477
|
+
statementOffset = factory.copyStandardPrologue(body.statements, prologue, 0, /*ensureUseStrict*/ false);
|
|
97218
97478
|
statementOffset = factory.copyCustomPrologue(body.statements, statements, statementOffset, visitor, ts.isHoistedFunction);
|
|
97219
97479
|
statementOffset = factory.copyCustomPrologue(body.statements, statements, statementOffset, visitor, ts.isHoistedVariableStatement);
|
|
97220
97480
|
}
|
|
@@ -98585,7 +98845,7 @@ var ts;
|
|
|
98585
98845
|
/*type*/ undefined, factory.updateBlock(func.body, statements))),
|
|
98586
98846
|
/*typeArguments*/ undefined, call.arguments))));
|
|
98587
98847
|
}
|
|
98588
|
-
function
|
|
98848
|
+
function visitSuperCallInBody(node) {
|
|
98589
98849
|
return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ false);
|
|
98590
98850
|
}
|
|
98591
98851
|
function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {
|
|
@@ -119143,28 +119403,37 @@ var ts;
|
|
|
119143
119403
|
useCaseSensitiveFileNames: (_a = host.useCaseSensitiveFileNames) === null || _a === void 0 ? void 0 : _a.call(host),
|
|
119144
119404
|
};
|
|
119145
119405
|
}
|
|
119146
|
-
|
|
119147
|
-
|
|
119406
|
+
// `importingSourceFile` and `importingSourceFileName`? Why not just use `importingSourceFile.path`?
|
|
119407
|
+
// Because when this is called by the file renamer, `importingSourceFile` is the file being renamed,
|
|
119408
|
+
// while `importingSourceFileName` its *new* name. We need a source file just to get its
|
|
119409
|
+
// `impliedNodeFormat` and to detect certain preferences from existing import module specifiers.
|
|
119410
|
+
function updateModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, oldImportSpecifier) {
|
|
119411
|
+
var res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, getPreferencesForUpdate(compilerOptions, oldImportSpecifier, importingSourceFileName, host), {});
|
|
119148
119412
|
if (res === oldImportSpecifier)
|
|
119149
119413
|
return undefined;
|
|
119150
119414
|
return res;
|
|
119151
119415
|
}
|
|
119152
119416
|
moduleSpecifiers_1.updateModuleSpecifier = updateModuleSpecifier;
|
|
119153
|
-
//
|
|
119417
|
+
// `importingSourceFile` and `importingSourceFileName`? Why not just use `importingSourceFile.path`?
|
|
119418
|
+
// Because when this is called by the declaration emitter, `importingSourceFile` is the implementation
|
|
119419
|
+
// file, but `importingSourceFileName` and `toFileName` refer to declaration files (the former to the
|
|
119420
|
+
// one currently being produced; the latter to the one being imported). We need an implementation file
|
|
119421
|
+
// just to get its `impliedNodeFormat` and to detect certain preferences from existing import module
|
|
119422
|
+
// specifiers.
|
|
119154
119423
|
function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host) {
|
|
119155
|
-
return getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, getPreferences(host, {}, compilerOptions, importingSourceFile), {});
|
|
119424
|
+
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, getPreferences(host, {}, compilerOptions, importingSourceFile), {});
|
|
119156
119425
|
}
|
|
119157
119426
|
moduleSpecifiers_1.getModuleSpecifier = getModuleSpecifier;
|
|
119158
|
-
function getNodeModulesPackageName(compilerOptions,
|
|
119159
|
-
var info = getInfo(
|
|
119160
|
-
var modulePaths = getAllModulePaths(
|
|
119161
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, host, compilerOptions, /*packageNameOnly*/ true); });
|
|
119427
|
+
function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences) {
|
|
119428
|
+
var info = getInfo(importingSourceFile.path, host);
|
|
119429
|
+
var modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences);
|
|
119430
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ true); });
|
|
119162
119431
|
}
|
|
119163
119432
|
moduleSpecifiers_1.getNodeModulesPackageName = getNodeModulesPackageName;
|
|
119164
|
-
function getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, preferences, userPreferences) {
|
|
119433
|
+
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, preferences, userPreferences) {
|
|
119165
119434
|
var info = getInfo(importingSourceFileName, host);
|
|
119166
119435
|
var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences);
|
|
119167
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, host, compilerOptions); }) ||
|
|
119436
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions); }) ||
|
|
119168
119437
|
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
|
|
119169
119438
|
}
|
|
119170
119439
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences) {
|
|
@@ -119231,7 +119500,7 @@ var ts;
|
|
|
119231
119500
|
var relativeSpecifiers;
|
|
119232
119501
|
for (var _i = 0, modulePaths_1 = modulePaths; _i < modulePaths_1.length; _i++) {
|
|
119233
119502
|
var modulePath = modulePaths_1[_i];
|
|
119234
|
-
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, host, compilerOptions);
|
|
119503
|
+
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions);
|
|
119235
119504
|
nodeModulesSpecifiers = ts.append(nodeModulesSpecifiers, specifier);
|
|
119236
119505
|
if (specifier && modulePath.isRedirect) {
|
|
119237
119506
|
// If we got a specifier for a redirect, it was a bare package specifier (e.g. "@foo/bar",
|
|
@@ -119623,7 +119892,7 @@ var ts;
|
|
|
119623
119892
|
? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
|
|
119624
119893
|
: ts.removeFileExtension(relativePath);
|
|
119625
119894
|
}
|
|
119626
|
-
function tryGetModuleNameAsNodeModule(_a, _b, host, options, packageNameOnly) {
|
|
119895
|
+
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, packageNameOnly) {
|
|
119627
119896
|
var path = _a.path, isRedirect = _a.isRedirect;
|
|
119628
119897
|
var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory;
|
|
119629
119898
|
if (!host.fileExists || !host.readFile) {
|
|
@@ -119686,11 +119955,19 @@ var ts;
|
|
|
119686
119955
|
var moduleFileToTry = path;
|
|
119687
119956
|
if (host.fileExists(packageJsonPath)) {
|
|
119688
119957
|
var packageJsonContent = JSON.parse(host.readFile(packageJsonPath));
|
|
119689
|
-
// TODO: Inject `require` or `import` condition based on the intended import mode
|
|
119690
119958
|
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
119691
|
-
|
|
119959
|
+
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
|
|
119960
|
+
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
119961
|
+
// usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
|
|
119962
|
+
// with, so for now we just stick with the mode of the file.
|
|
119963
|
+
var conditions = ["node", importingSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext ? "import" : "require", "types"];
|
|
119964
|
+
var fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string"
|
|
119965
|
+
? tryGetModuleNameFromExports(options, path, packageRootPath, ts.getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions)
|
|
119966
|
+
: undefined;
|
|
119692
119967
|
if (fromExports) {
|
|
119693
|
-
var withJsExtension = !ts.hasTSFileExtension(fromExports.moduleFileToTry)
|
|
119968
|
+
var withJsExtension = !ts.hasTSFileExtension(fromExports.moduleFileToTry)
|
|
119969
|
+
? fromExports
|
|
119970
|
+
: { moduleFileToTry: ts.removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
|
|
119694
119971
|
return __assign(__assign({}, withJsExtension), { verbatimFromExports: true });
|
|
119695
119972
|
}
|
|
119696
119973
|
if (packageJsonContent.exports) {
|
|
@@ -119796,8 +120073,8 @@ var ts;
|
|
|
119796
120073
|
}
|
|
119797
120074
|
function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
|
|
119798
120075
|
return ts.firstDefined(rootDirs, function (rootDir) {
|
|
119799
|
-
var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
|
|
119800
|
-
return isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
120076
|
+
var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
|
|
120077
|
+
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
119801
120078
|
});
|
|
119802
120079
|
}
|
|
119803
120080
|
function removeExtensionAndIndexPostFix(fileName, ending, options) {
|