@@ -288,7 +288,7 @@ var ts;
288
288
// If changing the text in this section, be sure to test `configurePrerelease` too.
289
289
ts.versionMajorMinor = "4.1";
290
290
/** The version of the TypeScript compiler release */
291
- ts.version = "4.1.1-rc ";
291
+ ts.version = "4.1.2 ";
292
292
/* @internal */
293
293
var Comparison;
294
294
(function (Comparison) {
@@ -7991,8 +7991,6 @@ var ts;
7991
7991
Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, ts.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
7992
7992
Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1388, ts.DiagnosticCategory.Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1388", "Constructor type notation must be parenthesized when used in an intersection type."),
7993
7993
_0_is_not_allowed_as_a_variable_declaration_name: diag(1389, ts.DiagnosticCategory.Error, "_0_is_not_allowed_as_a_variable_declaration_name_1389", "'{0}' is not allowed as a variable declaration name."),
7994
- Provides_a_root_package_name_when_using_outFile_with_declarations: diag(1390, ts.DiagnosticCategory.Message, "Provides_a_root_package_name_when_using_outFile_with_declarations_1390", "Provides a root package name when using outFile with declarations."),
7995
- The_bundledPackageName_option_must_be_provided_when_using_outFile_and_node_module_resolution_with_declaration_emit: diag(1391, ts.DiagnosticCategory.Error, "The_bundledPackageName_option_must_be_provided_when_using_outFile_and_node_module_resolution_with_de_1391", "The `bundledPackageName` option must be provided when using outFile and node module resolution with declaration emit."),
7996
7994
The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
7997
7995
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
7998
7996
Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
@@ -14241,6 +14239,18 @@ var ts;
14241
14239
};
14242
14240
}
14243
14241
ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain;
14242
+ function createDiagnosticForFileFromMessageChain(sourceFile, messageChain, relatedInformation) {
14243
+ return {
14244
+ file: sourceFile,
14245
+ start: 0,
14246
+ length: 0,
14247
+ code: messageChain.code,
14248
+ category: messageChain.category,
14249
+ messageText: messageChain.next ? messageChain : messageChain.messageText,
14250
+ relatedInformation: relatedInformation
14251
+ };
14252
+ }
14253
+ ts.createDiagnosticForFileFromMessageChain = createDiagnosticForFileFromMessageChain;
14244
14254
function createDiagnosticForRange(sourceFile, range, message) {
14245
14255
return {
14246
14256
file: sourceFile,
@@ -17150,16 +17160,7 @@ var ts;
17150
17160
var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
17151
17161
var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
17152
17162
var extensionless = removeFileExtension(relativePath);
17153
- if (referencePath) {
17154
- return ts.ensurePathIsNonModuleName(extensionless);
17155
- }
17156
- var options = host.getCompilerOptions();
17157
- var rootPkgName = options.bundledPackageName || "";
17158
- var newPath = ts.combinePaths(rootPkgName, extensionless);
17159
- if (rootPkgName && getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeJs && ts.endsWith(newPath, "/index")) {
17160
- return newPath.slice(0, newPath.length - "/index".length);
17161
- }
17162
- return newPath;
17163
+ return referencePath ? ts.ensurePathIsNonModuleName(extensionless) : extensionless;
17163
17164
}
17164
17165
ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath;
17165
17166
function getOwnEmitOutputFilePath(fileName, host, extension) {
@@ -36741,13 +36742,6 @@ var ts;
36741
36742
category: ts.Diagnostics.Advanced_Options,
36742
36743
description: ts.Diagnostics.Emit_class_fields_with_Define_instead_of_Set,
36743
36744
},
36744
- {
36745
- name: "bundledPackageName",
36746
- type: "string",
36747
- affectsEmit: true,
36748
- category: ts.Diagnostics.Advanced_Options,
36749
- description: ts.Diagnostics.Provides_a_root_package_name_when_using_outFile_with_declarations,
36750
- },
36751
36745
{
36752
36746
name: "keyofStringsOnly",
36753
36747
type: "boolean",
@@ -44309,6 +44303,16 @@ var ts;
44309
44303
}
44310
44304
}
44311
44305
function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) {
44306
+ // Pseudo-synthesized input node
44307
+ if (location.pos < 0 || location.end < 0) {
44308
+ if (!isError) {
44309
+ return; // Drop suggestions (we have no span to suggest on)
44310
+ }
44311
+ // Issue errors globally
44312
+ var file = ts.getSourceFileOfNode(location);
44313
+ addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line no-in-operator
44314
+ return;
44315
+ }
44312
44316
addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator
44313
44317
}
44314
44318
function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) {
@@ -47311,7 +47315,6 @@ var ts;
47311
47315
getProjectReferenceRedirect: function (fileName) { return host.getProjectReferenceRedirect(fileName); },
47312
47316
isSourceOfProjectReferenceRedirect: function (fileName) { return host.isSourceOfProjectReferenceRedirect(fileName); },
47313
47317
fileExists: function (fileName) { return host.fileExists(fileName); },
47314
- getCompilerOptions: function () { return host.getCompilerOptions(); }
47315
47318
} : undefined },
47316
47319
encounteredError: false,
47317
47320
visitedTypes: undefined,
@@ -48790,8 +48793,7 @@ var ts;
48790
48793
var resolverHost = {
48791
48794
getCanonicalFileName: getCanonicalFileName,
48792
48795
getCurrentDirectory: function () { return context.tracker.moduleResolverHost.getCurrentDirectory(); },
48793
- getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); },
48794
- getCompilerOptions: function () { return context.tracker.moduleResolverHost.getCompilerOptions(); }
48796
+ getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); }
48795
48797
};
48796
48798
var newName = ts.getResolvedExternalModuleName(resolverHost, targetFile);
48797
48799
return ts.factory.createStringLiteral(newName);
@@ -66520,10 +66522,10 @@ var ts;
66520
66522
return links.jsxNamespace;
66521
66523
}
66522
66524
if (!links || links.jsxNamespace !== false) {
66523
- var namespaceName = getJsxNamespace(location);
66524
- var resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66525
+ var resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66525
66526
if (!resolvedNamespace || resolvedNamespace === unknownSymbol) {
66526
- resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66527
+ var namespaceName = getJsxNamespace(location);
66528
+ resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66527
66529
}
66528
66530
if (resolvedNamespace) {
66529
66531
var candidate = resolveSymbol(getSymbol(getExportsOfSymbol(resolveSymbol(resolvedNamespace)), JsxNames.JSX, 1920 /* Namespace */));
@@ -66730,23 +66732,25 @@ var ts;
66730
66732
checkGrammarJsxElement(node);
66731
66733
}
66732
66734
checkJsxPreconditions(node);
66733
- // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
66734
- // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
66735
- var jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
66736
- var jsxFactoryNamespace = getJsxNamespace(node);
66737
- var jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
66738
- // allow null as jsxFragmentFactory
66739
- var jsxFactorySym;
66740
- if (!(ts.isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
66741
- jsxFactorySym = resolveName(jsxFactoryLocation, jsxFactoryNamespace, 111551 /* Value */, jsxFactoryRefErr, jsxFactoryNamespace, /*isUse*/ true);
66742
- }
66743
- if (jsxFactorySym) {
66744
- // Mark local symbol as referenced here because it might not have been marked
66745
- // if jsx emit was not jsxFactory as there wont be error being emitted
66746
- jsxFactorySym.isReferenced = 67108863 /* All */;
66747
- // If react/jsxFactory symbol is alias, mark it as refereced
66748
- if (jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
66749
- markAliasSymbolAsReferenced(jsxFactorySym);
66735
+ if (!getJsxNamespaceContainerForImplicitImport(node)) {
66736
+ // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
66737
+ // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
66738
+ var jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
66739
+ var jsxFactoryNamespace = getJsxNamespace(node);
66740
+ var jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
66741
+ // allow null as jsxFragmentFactory
66742
+ var jsxFactorySym = void 0;
66743
+ if (!(ts.isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
66744
+ jsxFactorySym = resolveName(jsxFactoryLocation, jsxFactoryNamespace, 111551 /* Value */, jsxFactoryRefErr, jsxFactoryNamespace, /*isUse*/ true);
66745
+ }
66746
+ if (jsxFactorySym) {
66747
+ // Mark local symbol as referenced here because it might not have been marked
66748
+ // if jsx emit was not jsxFactory as there wont be error being emitted
66749
+ jsxFactorySym.isReferenced = 67108863 /* All */;
66750
+ // If react/jsxFactory symbol is alias, mark it as refereced
66751
+ if (jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
66752
+ markAliasSymbolAsReferenced(jsxFactorySym);
66753
+ }
66750
66754
}
66751
66755
}
66752
66756
if (isNodeOpeningLikeElement) {
@@ -107394,10 +107398,6 @@ var ts;
107394
107398
programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? "out" : "outFile"));
107395
107399
}
107396
107400
}
107397
- // Without a package name, for multiple files being bundled into a .d.ts file you basically get a file which doesn't wrk
107398
- if (outputFile && ts.getEmitDeclarations(options) && ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeJs && !options.bundledPackageName) {
107399
- createDiagnosticForOptionName(ts.Diagnostics.The_bundledPackageName_option_must_be_provided_when_using_outFile_and_node_module_resolution_with_declaration_emit, options.out ? "out" : "outFile");
107400
- }
107401
107401
if (options.resolveJsonModule) {
107402
107402
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) {
107403
107403
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
@@ -110254,7 +110254,7 @@ var ts;
110254
110254
function getLocalModuleSpecifier(moduleFileName, _a, compilerOptions, host, _b) {
110255
110255
var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
110256
110256
var ending = _b.ending, relativePreference = _b.relativePreference;
110257
- var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs, bundledPackageName = compilerOptions.bundledPackageName ;
110257
+ var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
110258
110258
var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
110259
110259
removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
110260
110260
if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
@@ -110265,9 +110265,8 @@ var ts;
110265
110265
if (!relativeToBaseUrl) {
110266
110266
return relativePath;
110267
110267
}
110268
- var bundledPkgReference = bundledPackageName ? ts.combinePaths(bundledPackageName, relativeToBaseUrl) : relativeToBaseUrl;
110269
- var importRelativeToBaseUrl = removeExtensionAndIndexPostFix(bundledPkgReference, ending, compilerOptions);
110270
- var fromPaths = paths && tryGetModuleNameFromPaths(ts.removeFileExtension(bundledPkgReference), importRelativeToBaseUrl, paths);
110268
+ var importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions);
110269
+ var fromPaths = paths && tryGetModuleNameFromPaths(ts.removeFileExtension(relativeToBaseUrl), importRelativeToBaseUrl, paths);
110271
110270
var nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
110272
110271
if (!nonRelative) {
110273
110272
return relativePath;
@@ -115417,8 +115416,7 @@ var ts;
115417
115416
getSourceFiles: function () { return program.getSourceFiles(); },
115418
115417
redirectTargetsMap: program.redirectTargetsMap,
115419
115418
getProjectReferenceRedirect: function (fileName) { return program.getProjectReferenceRedirect(fileName); },
115420
- isSourceOfProjectReferenceRedirect: function (fileName) { return program.isSourceOfProjectReferenceRedirect(fileName); },
115421
- getCompilerOptions: function () { return program.getCompilerOptions(); }
115419
+ isSourceOfProjectReferenceRedirect: function (fileName) { return program.isSourceOfProjectReferenceRedirect(fileName); }
115422
115420
};
115423
115421
}
115424
115422
ts.createModuleSpecifierResolutionHost = createModuleSpecifierResolutionHost;
@@ -147433,7 +147431,7 @@ var ts;
147433
147431
* This is a semantic operation.
147434
147432
*/
147435
147433
function getSignatureHelpItems(fileName, position, _a) {
147436
- var triggerReason = ( _a === void 0 ? ts.emptyOptions : _a) .triggerReason;
147434
+ var _b = _a === void 0 ? ts.emptyOptions : _a, triggerReason = _b .triggerReason;
147437
147435
synchronizeHostData();
147438
147436
var sourceFile = getValidSourceFile(fileName);
147439
147437
return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, triggerReason, cancellationToken);
0 commit comments