mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Diagnostic when output layout is changed
This commit is contained in:
1 parent
25d86d2723
commit
717cfa81e7
37 files changed
+591
-145
No files matched your search
@@ -1539,7 +1539,6 @@
|
||||
"category": "Error",
|
||||
"code": 1464
|
||||
},
|
||||
|
||||
"The 'import.meta' meta-property is not allowed in files which will build into CommonJS output.": {
|
||||
"category": "Error",
|
||||
"code": 1470
|
||||
@@ -1849,7 +1848,6 @@
|
||||
"category": "Error",
|
||||
"code": 1546
|
||||
},
|
||||
|
||||
"The types of '{0}' are incompatible between these types.": {
|
||||
"category": "Error",
|
||||
"code": 2200
|
||||
@@ -1890,7 +1888,6 @@
|
||||
"category": "Error",
|
||||
"code": 2208
|
||||
},
|
||||
|
||||
"The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate.": {
|
||||
"category": "Error",
|
||||
"code": 2209
|
||||
@@ -1907,7 +1904,6 @@
|
||||
"category": "Message",
|
||||
"code": 2212
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2300
|
||||
@@ -2888,7 +2884,6 @@
|
||||
"category": "Error",
|
||||
"code": 2568
|
||||
},
|
||||
|
||||
"Could not find name '{0}'. Did you mean '{1}'?": {
|
||||
"category": "Error",
|
||||
"code": 2570
|
||||
@@ -3129,7 +3124,6 @@
|
||||
"category": "Error",
|
||||
"code": 2639
|
||||
},
|
||||
|
||||
"Cannot augment module '{0}' with value exports because it resolves to a non-module entity.": {
|
||||
"category": "Error",
|
||||
"code": 2649
|
||||
@@ -4007,7 +4001,6 @@
|
||||
"category": "Error",
|
||||
"code": 2881
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4000
|
||||
@@ -4452,7 +4445,6 @@
|
||||
"category": "Error",
|
||||
"code": 4128
|
||||
},
|
||||
|
||||
"The current host does not support the '{0}' option.": {
|
||||
"category": "Error",
|
||||
"code": 5001
|
||||
@@ -4465,6 +4457,10 @@
|
||||
"category": "Error",
|
||||
"code": 5010
|
||||
},
|
||||
"Inferred common source directory differs from tsconfig directory, output layout will be changed.": {
|
||||
"category": "Error",
|
||||
"code": 5011
|
||||
},
|
||||
"Cannot read file '{0}': {1}.": {
|
||||
"category": "Error",
|
||||
"code": 5012
|
||||
@@ -4717,7 +4713,10 @@
|
||||
"category": "Error",
|
||||
"code": 5110
|
||||
},
|
||||
|
||||
"Visit https://aka.ms/ts6 for migration information.": {
|
||||
"category": "Message",
|
||||
"code": 5111
|
||||
},
|
||||
"Generates a sourcemap for each corresponding '.d.ts' file.": {
|
||||
"category": "Message",
|
||||
"code": 6000
|
||||
@@ -5661,7 +5660,6 @@
|
||||
"category": "Error",
|
||||
"code": 6266
|
||||
},
|
||||
|
||||
"Directory '{0}' has no containing package.json scope. Imports will not resolve.": {
|
||||
"category": "Message",
|
||||
"code": 6270
|
||||
@@ -5754,7 +5752,6 @@
|
||||
"category": "Message",
|
||||
"code": 6294
|
||||
},
|
||||
|
||||
"Enable project compilation": {
|
||||
"category": "Message",
|
||||
"code": 6302
|
||||
@@ -6037,7 +6034,6 @@
|
||||
"category": "Message",
|
||||
"code": 6421
|
||||
},
|
||||
|
||||
"The expected type comes from property '{0}' which is declared here on type '{1}'": {
|
||||
"category": "Message",
|
||||
"code": 6500
|
||||
@@ -6562,7 +6558,6 @@
|
||||
"category": "Message",
|
||||
"code": 6808
|
||||
},
|
||||
|
||||
"one of:": {
|
||||
"category": "Message",
|
||||
"code": 6900
|
||||
@@ -6691,7 +6686,6 @@
|
||||
"category": "Error",
|
||||
"code": 6931
|
||||
},
|
||||
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
"code": 7005
|
||||
@@ -6914,7 +6908,6 @@
|
||||
"category": "Error",
|
||||
"code": 7061
|
||||
},
|
||||
|
||||
"You cannot rename this element.": {
|
||||
"category": "Error",
|
||||
"code": 8000
|
||||
@@ -7059,7 +7052,6 @@
|
||||
"category": "Error",
|
||||
"code": 8039
|
||||
},
|
||||
|
||||
"Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.": {
|
||||
"category": "Error",
|
||||
"code": 9005
|
||||
@@ -7292,7 +7284,6 @@
|
||||
"category": "Error",
|
||||
"code": 18003
|
||||
},
|
||||
|
||||
"File is a CommonJS module; it may be converted to an ES module.": {
|
||||
"category": "Suggestion",
|
||||
"code": 80001
|
||||
@@ -7333,7 +7324,6 @@
|
||||
"category": "Suggestion",
|
||||
"code": 80010
|
||||
},
|
||||
|
||||
"Add missing 'super()' call": {
|
||||
"category": "Message",
|
||||
"code": 90001
|
||||
@@ -7554,7 +7544,6 @@
|
||||
"category": "Message",
|
||||
"code": 90071
|
||||
},
|
||||
|
||||
"Convert function to an ES2015 class": {
|
||||
"category": "Message",
|
||||
"code": 95001
|
||||
@@ -8323,7 +8312,6 @@
|
||||
"category": "Message",
|
||||
"code": 95197
|
||||
},
|
||||
|
||||
"No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer.": {
|
||||
"category": "Error",
|
||||
"code": 18004
|
||||
@@ -8520,4 +8508,4 @@
|
||||
"category": "Error",
|
||||
"code": 18061
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -664,6 +664,23 @@ export function getCommonSourceDirectory(
|
||||
return commonSourceDirectory;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getComputedCommonSourceDirectory(
|
||||
emittedFiles: readonly string[],
|
||||
currentDirectory: string,
|
||||
getCanonicalFileName: GetCanonicalFileName,
|
||||
): string {
|
||||
let commonSourceDirectory = computeCommonSourceDirectoryOfFilenames(emittedFiles, currentDirectory, getCanonicalFileName);
|
||||
|
||||
if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) {
|
||||
// Make sure directory path ends with directory separator so this string can directly
|
||||
// used to replace with "" to get the relative path of the source file and the relative path doesn't
|
||||
// start with / making it rooted path
|
||||
commonSourceDirectory += directorySeparator;
|
||||
}
|
||||
return commonSourceDirectory;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getCommonSourceDirectoryOfConfig({ options, fileNames }: ParsedCommandLine, ignoreCase: boolean): string {
|
||||
return getCommonSourceDirectory(
|
||||
|
||||
@@ -111,6 +111,7 @@ import {
|
||||
GetCanonicalFileName,
|
||||
getCommonSourceDirectory as ts_getCommonSourceDirectory,
|
||||
getCommonSourceDirectoryOfConfig,
|
||||
getComputedCommonSourceDirectory,
|
||||
getDeclarationDiagnostics as ts_getDeclarationDiagnostics,
|
||||
getDefaultLibFileName,
|
||||
getDirectoryPath,
|
||||
@@ -4293,6 +4294,27 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!options.noEmit &&
|
||||
!options.composite &&
|
||||
!options.rootDir &&
|
||||
options.configFilePath &&
|
||||
(options.outDir || // there is --outDir specified
|
||||
(getEmitDeclarations(options) && options.declarationDir)) // there is --declarationDir specified
|
||||
) {
|
||||
// Check if rootDir inferred changed and issue diagnostic
|
||||
const dir = getCommonSourceDirectory();
|
||||
const emittedFiles = mapDefined(files, file => !file.isDeclarationFile && sourceFileMayBeEmitted(file, program) ? file.fileName : undefined);
|
||||
const dir59 = getComputedCommonSourceDirectory(emittedFiles, currentDirectory, getCanonicalFileName);
|
||||
if (dir59 !== "" && getCanonicalFileName(dir) !== getCanonicalFileName(dir59)) {
|
||||
// change in layout
|
||||
programDiagnostics.addConfigDiagnostic(createCompilerDiagnosticFromMessageChain(chainDiagnosticMessages(
|
||||
chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information),
|
||||
Diagnostics.Inferred_common_source_directory_differs_from_tsconfig_directory_output_layout_will_be_changed,
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.checkJs && !getAllowJSCompilerOption(options)) {
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user