typescript 4.5.0-dev.20211001 → 4.5.0-dev.20211002
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/de/diagnosticMessages.generated.json +4 -4
- package/lib/es/diagnosticMessages.generated.json +4 -4
- package/lib/it/diagnosticMessages.generated.json +4 -4
- package/lib/ja/diagnosticMessages.generated.json +4 -4
- package/lib/ko/diagnosticMessages.generated.json +4 -4
- package/lib/pl/diagnosticMessages.generated.json +4 -4
- package/lib/pt-br/diagnosticMessages.generated.json +4 -4
- package/lib/tsc.js +183 -54
- package/lib/tsserver.js +201 -48
- package/lib/tsserverlibrary.js +201 -48
- package/lib/typescript.js +196 -45
- package/lib/typescriptServices.js +196 -45
- package/lib/typingsInstaller.js +193 -45
- package/lib/zh-cn/diagnosticMessages.generated.json +4 -4
- package/lib/zh-tw/diagnosticMessages.generated.json +4 -4
- 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.5";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211002";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
function tryGetNativeMap() {
|
|
@@ -25297,7 +25297,6 @@ var ts;
|
|
|
25297
25297
|
case 88:
|
|
25298
25298
|
return nextTokenCanFollowDefaultKeyword();
|
|
25299
25299
|
case 124:
|
|
25300
|
-
return nextTokenIsOnSameLineAndCanFollowModifier();
|
|
25301
25300
|
case 136:
|
|
25302
25301
|
case 148:
|
|
25303
25302
|
nextToken();
|
|
@@ -28690,7 +28689,7 @@ var ts;
|
|
|
28690
28689
|
}
|
|
28691
28690
|
return list && createNodeArray(list, pos);
|
|
28692
28691
|
}
|
|
28693
|
-
function tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock) {
|
|
28692
|
+
function tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStaticModifier) {
|
|
28694
28693
|
var pos = getNodePos();
|
|
28695
28694
|
var kind = token();
|
|
28696
28695
|
if (token() === 85 && permitInvalidConstAsModifier) {
|
|
@@ -28701,6 +28700,9 @@ var ts;
|
|
|
28701
28700
|
else if (stopOnStartOfClassStaticBlock && token() === 124 && lookAhead(nextTokenIsOpenBrace)) {
|
|
28702
28701
|
return undefined;
|
|
28703
28702
|
}
|
|
28703
|
+
else if (hasSeenStaticModifier && token() === 124) {
|
|
28704
|
+
return undefined;
|
|
28705
|
+
}
|
|
28704
28706
|
else {
|
|
28705
28707
|
if (!parseAnyContextualModifier()) {
|
|
28706
28708
|
return undefined;
|
|
@@ -28710,8 +28712,10 @@ var ts;
|
|
|
28710
28712
|
}
|
|
28711
28713
|
function parseModifiers(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock) {
|
|
28712
28714
|
var pos = getNodePos();
|
|
28713
|
-
var list, modifier;
|
|
28714
|
-
while (modifier = tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock)) {
|
|
28715
|
+
var list, modifier, hasSeenStatic = false;
|
|
28716
|
+
while (modifier = tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStatic)) {
|
|
28717
|
+
if (modifier.kind === 124)
|
|
28718
|
+
hasSeenStatic = true;
|
|
28715
28719
|
list = ts.append(list, modifier);
|
|
28716
28720
|
}
|
|
28717
28721
|
return list && createNodeArray(list, pos);
|
|
@@ -32609,29 +32613,39 @@ var ts;
|
|
|
32609
32613
|
}
|
|
32610
32614
|
return result;
|
|
32611
32615
|
}
|
|
32612
|
-
function
|
|
32616
|
+
function getCompilerOptionsDiffValue(options, newLine) {
|
|
32617
|
+
var compilerOptionsMap = getSerializedCompilerOption(options);
|
|
32618
|
+
return getOverwrittenDefaultOptions();
|
|
32619
|
+
function makePadding(paddingLength) {
|
|
32620
|
+
return Array(paddingLength + 1).join(" ");
|
|
32621
|
+
}
|
|
32622
|
+
function getOverwrittenDefaultOptions() {
|
|
32623
|
+
var result = [];
|
|
32624
|
+
var tab = makePadding(2);
|
|
32625
|
+
commandOptionsWithoutBuild.forEach(function (cmd) {
|
|
32626
|
+
if (!compilerOptionsMap.has(cmd.name)) {
|
|
32627
|
+
return;
|
|
32628
|
+
}
|
|
32629
|
+
var newValue = compilerOptionsMap.get(cmd.name);
|
|
32630
|
+
var defaultValue = getDefaultValueForOption(cmd);
|
|
32631
|
+
if (newValue !== defaultValue) {
|
|
32632
|
+
result.push("" + tab + cmd.name + ": " + newValue);
|
|
32633
|
+
}
|
|
32634
|
+
else if (ts.hasProperty(ts.defaultInitCompilerOptions, cmd.name)) {
|
|
32635
|
+
result.push("" + tab + cmd.name + ": " + defaultValue);
|
|
32636
|
+
}
|
|
32637
|
+
});
|
|
32638
|
+
return result.join(newLine) + newLine;
|
|
32639
|
+
}
|
|
32640
|
+
}
|
|
32641
|
+
ts.getCompilerOptionsDiffValue = getCompilerOptionsDiffValue;
|
|
32642
|
+
function getSerializedCompilerOption(options) {
|
|
32613
32643
|
var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions);
|
|
32614
|
-
|
|
32644
|
+
return serializeCompilerOptions(compilerOptions);
|
|
32645
|
+
}
|
|
32646
|
+
function generateTSConfig(options, fileNames, newLine) {
|
|
32647
|
+
var compilerOptionsMap = getSerializedCompilerOption(options);
|
|
32615
32648
|
return writeConfigurations();
|
|
32616
|
-
function getDefaultValueForOption(option) {
|
|
32617
|
-
switch (option.type) {
|
|
32618
|
-
case "number":
|
|
32619
|
-
return 1;
|
|
32620
|
-
case "boolean":
|
|
32621
|
-
return true;
|
|
32622
|
-
case "string":
|
|
32623
|
-
return option.isFilePath ? "./" : "";
|
|
32624
|
-
case "list":
|
|
32625
|
-
return [];
|
|
32626
|
-
case "object":
|
|
32627
|
-
return {};
|
|
32628
|
-
default:
|
|
32629
|
-
var iterResult = option.type.keys().next();
|
|
32630
|
-
if (!iterResult.done)
|
|
32631
|
-
return iterResult.value;
|
|
32632
|
-
return ts.Debug.fail("Expected 'option.type' to have entries.");
|
|
32633
|
-
}
|
|
32634
|
-
}
|
|
32635
32649
|
function makePadding(paddingLength) {
|
|
32636
32650
|
return Array(paddingLength + 1).join(" ");
|
|
32637
32651
|
}
|
|
@@ -33459,6 +33473,25 @@ var ts;
|
|
|
33459
33473
|
});
|
|
33460
33474
|
}
|
|
33461
33475
|
}
|
|
33476
|
+
function getDefaultValueForOption(option) {
|
|
33477
|
+
switch (option.type) {
|
|
33478
|
+
case "number":
|
|
33479
|
+
return 1;
|
|
33480
|
+
case "boolean":
|
|
33481
|
+
return true;
|
|
33482
|
+
case "string":
|
|
33483
|
+
return option.isFilePath ? "./" : "";
|
|
33484
|
+
case "list":
|
|
33485
|
+
return [];
|
|
33486
|
+
case "object":
|
|
33487
|
+
return {};
|
|
33488
|
+
default:
|
|
33489
|
+
var iterResult = option.type.keys().next();
|
|
33490
|
+
if (!iterResult.done)
|
|
33491
|
+
return iterResult.value;
|
|
33492
|
+
return ts.Debug.fail("Expected 'option.type' to have entries.");
|
|
33493
|
+
}
|
|
33494
|
+
}
|
|
33462
33495
|
})(ts || (ts = {}));
|
|
33463
33496
|
var ts;
|
|
33464
33497
|
(function (ts) {
|
|
@@ -34654,6 +34687,7 @@ var ts;
|
|
|
34654
34687
|
function allKeysStartWithDot(obj) {
|
|
34655
34688
|
return ts.every(ts.getOwnKeys(obj), function (k) { return ts.startsWith(k, "."); });
|
|
34656
34689
|
}
|
|
34690
|
+
ts.allKeysStartWithDot = allKeysStartWithDot;
|
|
34657
34691
|
function noKeyStartsWithDot(obj) {
|
|
34658
34692
|
return !ts.some(ts.getOwnKeys(obj), function (k) { return ts.startsWith(k, "."); });
|
|
34659
34693
|
}
|
|
@@ -34855,17 +34889,18 @@ var ts;
|
|
|
34855
34889
|
}
|
|
34856
34890
|
return toSearchResult(undefined);
|
|
34857
34891
|
}
|
|
34858
|
-
function isApplicableVersionedTypesKey(conditions, key) {
|
|
34859
|
-
if (conditions.indexOf("types") === -1)
|
|
34860
|
-
return false;
|
|
34861
|
-
if (!ts.startsWith(key, "types@"))
|
|
34862
|
-
return false;
|
|
34863
|
-
var range = ts.VersionRange.tryParse(key.substring("types@".length));
|
|
34864
|
-
if (!range)
|
|
34865
|
-
return false;
|
|
34866
|
-
return range.test(ts.version);
|
|
34867
|
-
}
|
|
34868
34892
|
}
|
|
34893
|
+
function isApplicableVersionedTypesKey(conditions, key) {
|
|
34894
|
+
if (conditions.indexOf("types") === -1)
|
|
34895
|
+
return false;
|
|
34896
|
+
if (!ts.startsWith(key, "types@"))
|
|
34897
|
+
return false;
|
|
34898
|
+
var range = ts.VersionRange.tryParse(key.substring("types@".length));
|
|
34899
|
+
if (!range)
|
|
34900
|
+
return false;
|
|
34901
|
+
return range.test(ts.version);
|
|
34902
|
+
}
|
|
34903
|
+
ts.isApplicableVersionedTypesKey = isApplicableVersionedTypesKey;
|
|
34869
34904
|
function loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
34870
34905
|
return loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, false, cache, redirectedReference);
|
|
34871
34906
|
}
|
|
@@ -39955,7 +39990,20 @@ var ts;
|
|
|
39955
39990
|
function isSyntacticDefault(node) {
|
|
39956
39991
|
return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512) || ts.isExportSpecifier(node));
|
|
39957
39992
|
}
|
|
39958
|
-
function
|
|
39993
|
+
function getUsageModeForExpression(usage) {
|
|
39994
|
+
return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined;
|
|
39995
|
+
}
|
|
39996
|
+
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
39997
|
+
return usageMode === ts.ModuleKind.ESNext && targetMode === ts.ModuleKind.CommonJS;
|
|
39998
|
+
}
|
|
39999
|
+
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
40000
|
+
var usageMode = file && getUsageModeForExpression(usage);
|
|
40001
|
+
if (file && usageMode !== undefined) {
|
|
40002
|
+
var result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
|
|
40003
|
+
if (usageMode === ts.ModuleKind.ESNext || result) {
|
|
40004
|
+
return result;
|
|
40005
|
+
}
|
|
40006
|
+
}
|
|
39959
40007
|
if (!allowSyntheticDefaultImports) {
|
|
39960
40008
|
return false;
|
|
39961
40009
|
}
|
|
@@ -39986,7 +40034,7 @@ var ts;
|
|
|
39986
40034
|
exportDefaultSymbol = resolveExportByName(moduleSymbol, "default", node, dontResolveAlias);
|
|
39987
40035
|
}
|
|
39988
40036
|
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
39989
|
-
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias);
|
|
40037
|
+
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, node.parent.moduleSpecifier);
|
|
39990
40038
|
if (!exportDefaultSymbol && !hasSyntheticDefault) {
|
|
39991
40039
|
if (hasExportAssignmentSymbol(moduleSymbol)) {
|
|
39992
40040
|
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
@@ -40105,7 +40153,7 @@ var ts;
|
|
|
40105
40153
|
var symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
|
|
40106
40154
|
if (symbolFromModule === undefined && name.escapedText === "default") {
|
|
40107
40155
|
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
40108
|
-
if (canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias)) {
|
|
40156
|
+
if (canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
40109
40157
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
40110
40158
|
}
|
|
40111
40159
|
}
|
|
@@ -40714,7 +40762,7 @@ var ts;
|
|
|
40714
40762
|
sigs = getSignaturesOfStructuredType(type, 1);
|
|
40715
40763
|
}
|
|
40716
40764
|
if (sigs && sigs.length) {
|
|
40717
|
-
var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol);
|
|
40765
|
+
var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, ts.isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier);
|
|
40718
40766
|
var result = createSymbol(symbol.flags, symbol.escapedName);
|
|
40719
40767
|
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
|
40720
40768
|
result.parent = symbol.parent;
|
|
@@ -62490,18 +62538,18 @@ var ts;
|
|
|
62490
62538
|
if (moduleSymbol) {
|
|
62491
62539
|
var esModuleSymbol = resolveESModuleSymbol(moduleSymbol, specifier, true, false);
|
|
62492
62540
|
if (esModuleSymbol) {
|
|
62493
|
-
return createPromiseReturnType(node, getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol));
|
|
62541
|
+
return createPromiseReturnType(node, getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier));
|
|
62494
62542
|
}
|
|
62495
62543
|
}
|
|
62496
62544
|
return createPromiseReturnType(node, anyType);
|
|
62497
62545
|
}
|
|
62498
|
-
function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol) {
|
|
62546
|
+
function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) {
|
|
62499
62547
|
var _a;
|
|
62500
62548
|
if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
|
|
62501
62549
|
var synthType = type;
|
|
62502
62550
|
if (!synthType.syntheticType) {
|
|
62503
62551
|
var file = (_a = originalSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
62504
|
-
var hasSyntheticDefault = canHaveSyntheticDefault(file, originalSymbol, false);
|
|
62552
|
+
var hasSyntheticDefault = canHaveSyntheticDefault(file, originalSymbol, false, moduleSpecifier);
|
|
62505
62553
|
if (hasSyntheticDefault) {
|
|
62506
62554
|
var memberTable = ts.createSymbolTable();
|
|
62507
62555
|
var newSymbol = createSymbol(2097152, "default");
|
|
@@ -73576,7 +73624,7 @@ var ts;
|
|
|
73576
73624
|
}
|
|
73577
73625
|
}
|
|
73578
73626
|
ts.createSourceMapGenerator = createSourceMapGenerator;
|
|
73579
|
-
var sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)
|
|
73627
|
+
var sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)\r?\n?$/;
|
|
73580
73628
|
var whitespaceOrMapCommentRegExp = /^\s*(\/\/[@#] .*)?$/;
|
|
73581
73629
|
function getLineInfo(text, lineStarts) {
|
|
73582
73630
|
return {
|
|
@@ -98181,6 +98229,66 @@ var ts;
|
|
|
98181
98229
|
}
|
|
98182
98230
|
}
|
|
98183
98231
|
}
|
|
98232
|
+
function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports, conditions, mode) {
|
|
98233
|
+
if (mode === void 0) { mode = 0; }
|
|
98234
|
+
if (typeof exports === "string") {
|
|
98235
|
+
var pathOrPattern = ts.getNormalizedAbsolutePath(ts.combinePaths(packageDirectory, exports), undefined);
|
|
98236
|
+
var extensionSwappedTarget = ts.hasTSFileExtension(targetFilePath) ? ts.removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : undefined;
|
|
98237
|
+
switch (mode) {
|
|
98238
|
+
case 0:
|
|
98239
|
+
if (ts.comparePaths(targetFilePath, pathOrPattern) === 0 || (extensionSwappedTarget && ts.comparePaths(extensionSwappedTarget, pathOrPattern) === 0)) {
|
|
98240
|
+
return { moduleFileToTry: packageName };
|
|
98241
|
+
}
|
|
98242
|
+
break;
|
|
98243
|
+
case 1:
|
|
98244
|
+
if (ts.containsPath(pathOrPattern, targetFilePath)) {
|
|
98245
|
+
var fragment = ts.getRelativePathFromDirectory(pathOrPattern, targetFilePath, false);
|
|
98246
|
+
return { moduleFileToTry: ts.getNormalizedAbsolutePath(ts.combinePaths(ts.combinePaths(packageName, exports), fragment), undefined) };
|
|
98247
|
+
}
|
|
98248
|
+
break;
|
|
98249
|
+
case 2:
|
|
98250
|
+
var starPos = pathOrPattern.indexOf("*");
|
|
98251
|
+
var leadingSlice = pathOrPattern.slice(0, starPos);
|
|
98252
|
+
var trailingSlice = pathOrPattern.slice(starPos + 1);
|
|
98253
|
+
if (ts.startsWith(targetFilePath, leadingSlice) && ts.endsWith(targetFilePath, trailingSlice)) {
|
|
98254
|
+
var starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
|
|
98255
|
+
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
98256
|
+
}
|
|
98257
|
+
if (extensionSwappedTarget && ts.startsWith(extensionSwappedTarget, leadingSlice) && ts.endsWith(extensionSwappedTarget, trailingSlice)) {
|
|
98258
|
+
var starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
|
|
98259
|
+
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
98260
|
+
}
|
|
98261
|
+
break;
|
|
98262
|
+
}
|
|
98263
|
+
}
|
|
98264
|
+
else if (Array.isArray(exports)) {
|
|
98265
|
+
return ts.forEach(exports, function (e) { return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, e, conditions); });
|
|
98266
|
+
}
|
|
98267
|
+
else if (typeof exports === "object" && exports !== null) {
|
|
98268
|
+
if (ts.allKeysStartWithDot(exports)) {
|
|
98269
|
+
return ts.forEach(ts.getOwnKeys(exports), function (k) {
|
|
98270
|
+
var subPackageName = ts.getNormalizedAbsolutePath(ts.combinePaths(packageName, k), undefined);
|
|
98271
|
+
var mode = ts.endsWith(k, "/") ? 1
|
|
98272
|
+
: ts.stringContains(k, "*") ? 2
|
|
98273
|
+
: 0;
|
|
98274
|
+
return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports[k], conditions, mode);
|
|
98275
|
+
});
|
|
98276
|
+
}
|
|
98277
|
+
else {
|
|
98278
|
+
for (var _i = 0, _a = ts.getOwnKeys(exports); _i < _a.length; _i++) {
|
|
98279
|
+
var key = _a[_i];
|
|
98280
|
+
if (key === "default" || conditions.indexOf(key) >= 0 || ts.isApplicableVersionedTypesKey(conditions, key)) {
|
|
98281
|
+
var subTarget = exports[key];
|
|
98282
|
+
var result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions);
|
|
98283
|
+
if (result) {
|
|
98284
|
+
return result;
|
|
98285
|
+
}
|
|
98286
|
+
}
|
|
98287
|
+
}
|
|
98288
|
+
}
|
|
98289
|
+
}
|
|
98290
|
+
return undefined;
|
|
98291
|
+
}
|
|
98184
98292
|
function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
|
|
98185
98293
|
var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
|
|
98186
98294
|
if (normalizedTargetPath === undefined) {
|
|
@@ -98208,7 +98316,15 @@ var ts;
|
|
|
98208
98316
|
var packageRootIndex = parts.packageRootIndex;
|
|
98209
98317
|
var moduleFileNameForExtensionless = void 0;
|
|
98210
98318
|
while (true) {
|
|
98211
|
-
var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath;
|
|
98319
|
+
var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath, blockedByExports = _c.blockedByExports, verbatimFromExports = _c.verbatimFromExports;
|
|
98320
|
+
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Classic) {
|
|
98321
|
+
if (blockedByExports) {
|
|
98322
|
+
return undefined;
|
|
98323
|
+
}
|
|
98324
|
+
if (verbatimFromExports) {
|
|
98325
|
+
return moduleFileToTry;
|
|
98326
|
+
}
|
|
98327
|
+
}
|
|
98212
98328
|
if (packageRootPath) {
|
|
98213
98329
|
moduleSpecifier = packageRootPath;
|
|
98214
98330
|
isPackageRootPath = true;
|
|
@@ -98240,6 +98356,14 @@ var ts;
|
|
|
98240
98356
|
var moduleFileToTry = path;
|
|
98241
98357
|
if (host.fileExists(packageJsonPath)) {
|
|
98242
98358
|
var packageJsonContent = JSON.parse(host.readFile(packageJsonPath));
|
|
98359
|
+
var fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, packageJsonContent.name, packageJsonContent.exports, ["node", "types"]) : undefined;
|
|
98360
|
+
if (fromExports) {
|
|
98361
|
+
var withJsExtension = !ts.hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: ts.removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
|
|
98362
|
+
return __assign(__assign({}, withJsExtension), { verbatimFromExports: true });
|
|
98363
|
+
}
|
|
98364
|
+
if (packageJsonContent.exports) {
|
|
98365
|
+
return { moduleFileToTry: path, blockedByExports: true };
|
|
98366
|
+
}
|
|
98243
98367
|
var versionPaths = packageJsonContent.typesVersions
|
|
98244
98368
|
? ts.getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions)
|
|
98245
98369
|
: undefined;
|
|
@@ -101274,7 +101398,7 @@ var ts;
|
|
|
101274
101398
|
}
|
|
101275
101399
|
function printEasyHelp(sys, simpleOptions) {
|
|
101276
101400
|
var colors = createColors(sys);
|
|
101277
|
-
var output = __spreadArray([],
|
|
101401
|
+
var output = __spreadArray([], getHeader(sys, ts.getDiagnosticText(ts.Diagnostics.tsc_Colon_The_TypeScript_Compiler) + " - " + ts.getDiagnosticText(ts.Diagnostics.Version_0, ts.version)), true);
|
|
101278
101402
|
output.push(colors.bold(ts.getDiagnosticText(ts.Diagnostics.COMMON_COMMANDS)) + sys.newLine + sys.newLine);
|
|
101279
101403
|
example("tsc", ts.Diagnostics.Compiles_the_current_project_tsconfig_json_in_the_working_directory);
|
|
101280
101404
|
example("tsc app.ts util.ts", ts.Diagnostics.Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options);
|
|
@@ -101300,7 +101424,7 @@ var ts;
|
|
|
101300
101424
|
}
|
|
101301
101425
|
}
|
|
101302
101426
|
function printAllHelp(sys, compilerOptions, buildOptions, watchOptions) {
|
|
101303
|
-
var output = __spreadArray([],
|
|
101427
|
+
var output = __spreadArray([], getHeader(sys, ts.getDiagnosticText(ts.Diagnostics.tsc_Colon_The_TypeScript_Compiler) + " - " + ts.getDiagnosticText(ts.Diagnostics.Version_0, ts.version)), true);
|
|
101304
101428
|
output = __spreadArray(__spreadArray([], output, true), generateSectionOptionsOutput(sys, ts.getDiagnosticText(ts.Diagnostics.ALL_COMPILER_OPTIONS), compilerOptions, true, undefined, ts.formatMessage(undefined, ts.Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference")), true);
|
|
101305
101429
|
output = __spreadArray(__spreadArray([], output, true), generateSectionOptionsOutput(sys, ts.getDiagnosticText(ts.Diagnostics.WATCH_OPTIONS), watchOptions, false, ts.getDiagnosticText(ts.Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon)), true);
|
|
101306
101430
|
output = __spreadArray(__spreadArray([], output, true), generateSectionOptionsOutput(sys, ts.getDiagnosticText(ts.Diagnostics.BUILD_OPTIONS), buildOptions, false, ts.formatMessage(undefined, ts.Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds")), true);
|
|
@@ -101310,31 +101434,30 @@ var ts;
|
|
|
101310
101434
|
}
|
|
101311
101435
|
}
|
|
101312
101436
|
function printBuildHelp(sys, buildOptions) {
|
|
101313
|
-
var output = __spreadArray([],
|
|
101437
|
+
var output = __spreadArray([], getHeader(sys, ts.getDiagnosticText(ts.Diagnostics.tsc_Colon_The_TypeScript_Compiler) + " - " + ts.getDiagnosticText(ts.Diagnostics.Version_0, ts.version)), true);
|
|
101314
101438
|
output = __spreadArray(__spreadArray([], output, true), generateSectionOptionsOutput(sys, ts.getDiagnosticText(ts.Diagnostics.BUILD_OPTIONS), buildOptions, false, ts.formatMessage(undefined, ts.Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds")), true);
|
|
101315
101439
|
for (var _i = 0, output_3 = output; _i < output_3.length; _i++) {
|
|
101316
101440
|
var line = output_3[_i];
|
|
101317
101441
|
sys.write(line);
|
|
101318
101442
|
}
|
|
101319
101443
|
}
|
|
101320
|
-
function
|
|
101444
|
+
function getHeader(sys, message) {
|
|
101321
101445
|
var _a, _b;
|
|
101322
101446
|
var colors = createColors(sys);
|
|
101323
101447
|
var header = [];
|
|
101324
|
-
var tscExplanation = ts.getDiagnosticText(ts.Diagnostics.tsc_Colon_The_TypeScript_Compiler) + " - " + ts.getDiagnosticText(ts.Diagnostics.Version_0, ts.version);
|
|
101325
101448
|
var terminalWidth = (_b = (_a = sys.getWidthOfTerminal) === null || _a === void 0 ? void 0 : _a.call(sys)) !== null && _b !== void 0 ? _b : 0;
|
|
101326
101449
|
;
|
|
101327
101450
|
var tsIconLength = 5;
|
|
101328
101451
|
var tsIconFirstLine = colors.blueBackground(ts.padLeft("", tsIconLength));
|
|
101329
101452
|
var tsIconSecondLine = colors.blueBackground(colors.brightWhite(ts.padLeft("TS ", tsIconLength)));
|
|
101330
|
-
if (terminalWidth >=
|
|
101453
|
+
if (terminalWidth >= message.length + tsIconLength) {
|
|
101331
101454
|
var rightAlign = terminalWidth > 120 ? 120 : terminalWidth;
|
|
101332
101455
|
var leftAlign = rightAlign - tsIconLength;
|
|
101333
|
-
header.push(ts.padRight(
|
|
101456
|
+
header.push(ts.padRight(message, leftAlign) + tsIconFirstLine + sys.newLine);
|
|
101334
101457
|
header.push(ts.padLeft("", leftAlign) + tsIconSecondLine + sys.newLine);
|
|
101335
101458
|
}
|
|
101336
101459
|
else {
|
|
101337
|
-
header.push(
|
|
101460
|
+
header.push(message + sys.newLine);
|
|
101338
101461
|
header.push(sys.newLine);
|
|
101339
101462
|
}
|
|
101340
101463
|
return header;
|
|
@@ -101749,7 +101872,13 @@ var ts;
|
|
|
101749
101872
|
}
|
|
101750
101873
|
else {
|
|
101751
101874
|
sys.writeFile(file, ts.generateTSConfig(options, fileNames, sys.newLine));
|
|
101752
|
-
|
|
101875
|
+
var output = __spreadArray([sys.newLine], getHeader(sys, "Created a new tsconfig.json with:"), true);
|
|
101876
|
+
output.push(ts.getCompilerOptionsDiffValue(options, sys.newLine) + sys.newLine + sys.newLine);
|
|
101877
|
+
output.push("You can learn more at https://aka.ms/tsconfig.json" + sys.newLine);
|
|
101878
|
+
for (var _i = 0, output_4 = output; _i < output_4.length; _i++) {
|
|
101879
|
+
var line = output_4[_i];
|
|
101880
|
+
sys.write(line);
|
|
101881
|
+
}
|
|
101753
101882
|
}
|
|
101754
101883
|
return;
|
|
101755
101884
|
}
|