diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 61a3a43a81e11..3fb9c1b1cbfb3 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -196,6 +196,11 @@ namespace ts { description: Diagnostics.Print_names_of_files_part_of_the_compilation }, { + name: "explainFiles", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Print_names_of_files_and_the_reason_they_are_part_of_the_compilation + }, { name: "listEmittedFiles", type: "boolean", category: Diagnostics.Advanced_Options, @@ -268,6 +273,31 @@ namespace ts { }, ]; + /* @internal */ + export const targetOptionDeclaration: CommandLineOptionOfCustomType = { + name: "target", + shortName: "t", + type: new Map(getEntries({ + es3: ScriptTarget.ES3, + es5: ScriptTarget.ES5, + es6: ScriptTarget.ES2015, + es2015: ScriptTarget.ES2015, + es2016: ScriptTarget.ES2016, + es2017: ScriptTarget.ES2017, + es2018: ScriptTarget.ES2018, + es2019: ScriptTarget.ES2019, + es2020: ScriptTarget.ES2020, + esnext: ScriptTarget.ESNext, + })), + affectsSourceFile: true, + affectsModuleResolution: true, + affectsEmit: true, + paramType: Diagnostics.VERSION, + showInSimplifiedHelpView: true, + category: Diagnostics.Basic_Options, + description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_ES2018_ES2019_ES2020_or_ESNEXT, + }; + /* @internal */ export const optionDeclarations: CommandLineOption[] = [ // CommandLine only options @@ -330,29 +360,7 @@ namespace ts { }, // Basic - { - name: "target", - shortName: "t", - type: new Map(getEntries({ - es3: ScriptTarget.ES3, - es5: ScriptTarget.ES5, - es6: ScriptTarget.ES2015, - es2015: ScriptTarget.ES2015, - es2016: ScriptTarget.ES2016, - es2017: ScriptTarget.ES2017, - es2018: ScriptTarget.ES2018, - es2019: ScriptTarget.ES2019, - es2020: ScriptTarget.ES2020, - esnext: ScriptTarget.ESNext, - })), - affectsSourceFile: true, - affectsModuleResolution: true, - affectsEmit: true, - paramType: Diagnostics.VERSION, - showInSimplifiedHelpView: true, - category: Diagnostics.Basic_Options, - description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_ES2018_ES2019_ES2020_or_ESNEXT, - }, + targetOptionDeclaration, { name: "module", shortName: "m", @@ -2030,10 +2038,10 @@ namespace ts { const files = map( filter( configParseResult.fileNames, - (!configParseResult.configFileSpecs || !configParseResult.configFileSpecs.validatedIncludeSpecs) ? _ => true : matchesSpecs( + !configParseResult.options.configFile?.configFileSpecs?.validatedIncludeSpecs ? returnTrue : matchesSpecs( configFileName, - configParseResult.configFileSpecs.validatedIncludeSpecs, - configParseResult.configFileSpecs.validatedExcludeSpecs, + configParseResult.options.configFile.configFileSpecs.validatedIncludeSpecs, + configParseResult.options.configFile.configFileSpecs.validatedExcludeSpecs, host, ) ), @@ -2058,9 +2066,9 @@ namespace ts { watchOptions: watchOptionMap && optionMapToObject(watchOptionMap), references: map(configParseResult.projectReferences, r => ({ ...r, path: r.originalPath ? r.originalPath : "", originalPath: undefined })), files: length(files) ? files : undefined, - ...(configParseResult.configFileSpecs ? { - include: filterSameAsDefaultInclude(configParseResult.configFileSpecs.validatedIncludeSpecs), - exclude: configParseResult.configFileSpecs.validatedExcludeSpecs + ...(configParseResult.options.configFile?.configFileSpecs ? { + include: filterSameAsDefaultInclude(configParseResult.options.configFile.configFileSpecs.validatedIncludeSpecs), + exclude: configParseResult.options.configFile.configFileSpecs.validatedExcludeSpecs } : {}), compileOnSave: !!configParseResult.compileOnSave ? true : undefined }; @@ -2081,7 +2089,7 @@ namespace ts { } function matchesSpecs(path: string, includeSpecs: readonly string[] | undefined, excludeSpecs: readonly string[] | undefined, host: ConvertToTSConfigHost): (path: string) => boolean { - if (!includeSpecs) return _ => true; + if (!includeSpecs) return returnTrue; const patterns = getFileMatcherPatterns(path, excludeSpecs, includeSpecs, host.useCaseSensitiveFileNames, host.getCurrentDirectory()); const excludeRe = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, host.useCaseSensitiveFileNames); const includeRe = patterns.includeFilePattern && getRegexFromPattern(patterns.includeFilePattern, host.useCaseSensitiveFileNames); @@ -2094,7 +2102,7 @@ namespace ts { if (excludeRe) { return path => excludeRe.test(path); } - return _ => true; + return returnTrue; } function getCustomTypeMapOfCommandLineOption(optionDefinition: CommandLineOption): ESMap | undefined { @@ -2387,40 +2395,29 @@ namespace ts { parsedConfig.watchOptions || existingWatchOptions; options.configFilePath = configFileName && normalizeSlashes(configFileName); + const configFileSpecs = getConfigFileSpecs(); + if (sourceFile) sourceFile.configFileSpecs = configFileSpecs; setConfigFileInOptions(options, sourceFile); - let projectReferences: ProjectReference[] | undefined; - const { fileNames, wildcardDirectories, spec } = getFileNames(); + + const basePathForFileNames = normalizePath(configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath); return { options, watchOptions, - fileNames, - projectReferences, + fileNames: getFileNames(basePathForFileNames), + projectReferences: getProjectReferences(basePathForFileNames), typeAcquisition: parsedConfig.typeAcquisition || getDefaultTypeAcquisition(), raw, errors, - wildcardDirectories, + // Wildcard directories (provided as part of a wildcard path) are stored in a + // file map that marks whether it was a regular wildcard match (with a `*` or `?` token), + // or a recursive directory. This information is used by filesystem watchers to monitor for + // new entries in these paths. + wildcardDirectories: getWildcardDirectories(configFileSpecs, basePathForFileNames, host.useCaseSensitiveFileNames), compileOnSave: !!raw.compileOnSave, - configFileSpecs: spec }; - function getFileNames(): ExpandResult { + function getConfigFileSpecs(): ConfigFileSpecs { const referencesOfRaw = getPropFromRaw("references", element => typeof element === "object", "object"); - if (isArray(referencesOfRaw)) { - for (const ref of referencesOfRaw) { - if (typeof ref.path !== "string") { - createCompilerDiagnosticOnlyIfJson(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "reference.path", "string"); - } - else { - (projectReferences || (projectReferences = [])).push({ - path: getNormalizedAbsolutePath(ref.path, basePath), - originalPath: ref.path, - prepend: ref.prepend, - circular: ref.circular - }); - } - } - } - const filesSpecs = toPropValue(getSpecsFromRaw("files")); if (filesSpecs) { const hasZeroOrNoReferences = referencesOfRaw === "no-prop" || isArray(referencesOfRaw) && referencesOfRaw.length === 0; @@ -2457,13 +2454,57 @@ namespace ts { if (filesSpecs === undefined && includeSpecs === undefined) { includeSpecs = ["**/*"]; } + let validatedIncludeSpecs: readonly string[] | undefined, validatedExcludeSpecs: readonly string[] | undefined; - const result = matchFileNames(filesSpecs, includeSpecs, excludeSpecs, configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath, options, host, errors, extraFileExtensions, sourceFile); - if (shouldReportNoInputFiles(result, canJsonReportNoInputFiles(raw), resolutionStack)) { - errors.push(getErrorForNoInputFiles(result.spec, configFileName)); + // The exclude spec list is converted into a regular expression, which allows us to quickly + // test whether a file or directory should be excluded before recursively traversing the + // file system. + + if (includeSpecs) { + validatedIncludeSpecs = validateSpecs(includeSpecs, errors, /*disallowTrailingRecursion*/ true, sourceFile, "include"); } - return result; + if (excludeSpecs) { + validatedExcludeSpecs = validateSpecs(excludeSpecs, errors, /*disallowTrailingRecursion*/ false, sourceFile, "exclude"); + } + + return { + filesSpecs, + includeSpecs, + excludeSpecs, + validatedFilesSpec: filter(filesSpecs, isString), + validatedIncludeSpecs, + validatedExcludeSpecs, + }; + } + + function getFileNames(basePath: string): string[] { + const fileNames = getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions); + if (shouldReportNoInputFiles(fileNames, canJsonReportNoInputFiles(raw), resolutionStack)) { + errors.push(getErrorForNoInputFiles(configFileSpecs, configFileName)); + } + return fileNames; + } + + function getProjectReferences(basePath: string): readonly ProjectReference[] | undefined { + let projectReferences: ProjectReference[] | undefined; + const referencesOfRaw = getPropFromRaw("references", element => typeof element === "object", "object"); + if (isArray(referencesOfRaw)) { + for (const ref of referencesOfRaw) { + if (typeof ref.path !== "string") { + createCompilerDiagnosticOnlyIfJson(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "reference.path", "string"); + } + else { + (projectReferences || (projectReferences = [])).push({ + path: getNormalizedAbsolutePath(ref.path, basePath), + originalPath: ref.path, + prepend: ref.prepend, + circular: ref.circular + }); + } + } + } + return projectReferences; } type PropOfRaw = readonly T[] | "not-array" | "no-prop"; @@ -2511,8 +2552,8 @@ namespace ts { JSON.stringify(excludeSpecs || [])); } - function shouldReportNoInputFiles(result: ExpandResult, canJsonReportNoInutFiles: boolean, resolutionStack?: Path[]) { - return result.fileNames.length === 0 && canJsonReportNoInutFiles && (!resolutionStack || resolutionStack.length === 0); + function shouldReportNoInputFiles(fileNames: string[], canJsonReportNoInutFiles: boolean, resolutionStack?: Path[]) { + return fileNames.length === 0 && canJsonReportNoInutFiles && (!resolutionStack || resolutionStack.length === 0); } /*@internal*/ @@ -2521,9 +2562,9 @@ namespace ts { } /*@internal*/ - export function updateErrorForNoInputFiles(result: ExpandResult, configFileName: string, configFileSpecs: ConfigFileSpecs, configParseDiagnostics: Diagnostic[], canJsonReportNoInutFiles: boolean) { + export function updateErrorForNoInputFiles(fileNames: string[], configFileName: string, configFileSpecs: ConfigFileSpecs, configParseDiagnostics: Diagnostic[], canJsonReportNoInutFiles: boolean) { const existingErrors = configParseDiagnostics.length; - if (shouldReportNoInputFiles(result, canJsonReportNoInutFiles)) { + if (shouldReportNoInputFiles(fileNames, canJsonReportNoInutFiles)) { configParseDiagnostics.push(getErrorForNoInputFiles(configFileSpecs, configFileName)); } else { @@ -3011,65 +3052,10 @@ namespace ts { */ const wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/; - /** - * Expands an array of file specifications. - * - * @param filesSpecs The literal file names to include. - * @param includeSpecs The wildcard file specifications to include. - * @param excludeSpecs The wildcard file specifications to exclude. - * @param basePath The base path for any relative file specifications. - * @param options Compiler options. - * @param host The host used to resolve files and directories. - * @param errors An array for diagnostic reporting. - */ - function matchFileNames( - filesSpecs: readonly string[] | undefined, - includeSpecs: readonly string[] | undefined, - excludeSpecs: readonly string[] | undefined, - basePath: string, - options: CompilerOptions, - host: ParseConfigHost, - errors: Push, - extraFileExtensions: readonly FileExtensionInfo[], - jsonSourceFile: TsConfigSourceFile | undefined - ): ExpandResult { - basePath = normalizePath(basePath); - let validatedIncludeSpecs: readonly string[] | undefined, validatedExcludeSpecs: readonly string[] | undefined; - - // The exclude spec list is converted into a regular expression, which allows us to quickly - // test whether a file or directory should be excluded before recursively traversing the - // file system. - - if (includeSpecs) { - validatedIncludeSpecs = validateSpecs(includeSpecs, errors, /*disallowTrailingRecursion*/ true, jsonSourceFile, "include"); - } - - if (excludeSpecs) { - validatedExcludeSpecs = validateSpecs(excludeSpecs, errors, /*disallowTrailingRecursion*/ false, jsonSourceFile, "exclude"); - } - - // Wildcard directories (provided as part of a wildcard path) are stored in a - // file map that marks whether it was a regular wildcard match (with a `*` or `?` token), - // or a recursive directory. This information is used by filesystem watchers to monitor for - // new entries in these paths. - const wildcardDirectories = getWildcardDirectories(validatedIncludeSpecs, validatedExcludeSpecs, basePath, host.useCaseSensitiveFileNames); - - const spec: ConfigFileSpecs = { - filesSpecs, - includeSpecs, - excludeSpecs, - validatedFilesSpec: filter(filesSpecs, isString), - validatedIncludeSpecs, - validatedExcludeSpecs, - wildcardDirectories - }; - return getFileNamesFromConfigSpecs(spec, basePath, options, host, extraFileExtensions); - } - /** * Gets the file names from the provided config file specs that contain, files, include, exclude and * other properties needed to resolve the file names - * @param spec The config file specs extracted with file names to include, wildcards to include/exclude and other details + * @param configFileSpecs The config file specs extracted with file names to include, wildcards to include/exclude and other details * @param basePath The base path for any relative file specifications. * @param options Compiler options. * @param host The host used to resolve files and directories. @@ -3077,12 +3063,12 @@ namespace ts { */ /* @internal */ export function getFileNamesFromConfigSpecs( - spec: ConfigFileSpecs, + configFileSpecs: ConfigFileSpecs, basePath: string, options: CompilerOptions, host: ParseConfigHost, extraFileExtensions: readonly FileExtensionInfo[] = emptyArray - ): ExpandResult { + ): string[] { basePath = normalizePath(basePath); const keyMapper = createGetCanonicalFileName(host.useCaseSensitiveFileNames); @@ -3101,7 +3087,7 @@ namespace ts { // file map with a possibly case insensitive key. We use this map to store paths matched // via wildcard of *.json kind const wildCardJsonFileMap = new Map(); - const { validatedFilesSpec, validatedIncludeSpecs, validatedExcludeSpecs, wildcardDirectories } = spec; + const { validatedFilesSpec, validatedIncludeSpecs, validatedExcludeSpecs } = configFileSpecs; // Rather than requery this for each file and filespec, we query the supported extensions // once and store it on the expansion context. @@ -3162,11 +3148,7 @@ namespace ts { const literalFiles = arrayFrom(literalFileMap.values()); const wildcardFiles = arrayFrom(wildcardFileMap.values()); - return { - fileNames: literalFiles.concat(wildcardFiles, arrayFrom(wildCardJsonFileMap.values())), - wildcardDirectories, - spec - }; + return literalFiles.concat(wildcardFiles, arrayFrom(wildCardJsonFileMap.values())); } /* @internal */ @@ -3251,7 +3233,7 @@ namespace ts { /** * Gets directories in a set of include patterns that should be watched for changes. */ - function getWildcardDirectories(include: readonly string[] | undefined, exclude: readonly string[] | undefined, path: string, useCaseSensitiveFileNames: boolean): MapLike { + function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }: ConfigFileSpecs, path: string, useCaseSensitiveFileNames: boolean): MapLike { // We watch a directory recursively if it contains a wildcard anywhere in a directory segment // of the pattern: // diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index cabacfaa01202..cb51e10c31c8f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1196,6 +1196,158 @@ "category": "Error", "code": 1392 }, + "Imported via {0} from file '{1}'": { + "category": "Message", + "code": 1393 + }, + "Imported via {0} from file '{1}' with packageId '{2}'": { + "category": "Message", + "code": 1394 + }, + "Imported via {0} from file '{1}' to import 'importHelpers' as specified in compilerOptions": { + "category": "Message", + "code": 1395 + }, + "Imported via {0} from file '{1}' with packageId '{2}' to import 'importHelpers' as specified in compilerOptions": { + "category": "Message", + "code": 1396 + }, + "Imported via {0} from file '{1}' to import 'jsx' and 'jsxs' factory functions": { + "category": "Message", + "code": 1397 + }, + "Imported via {0} from file '{1}' with packageId '{2}' to import 'jsx' and 'jsxs' factory functions": { + "category": "Message", + "code": 1398 + }, + "File is included via import here.": { + "category": "Message", + "code": 1399 + }, + "Referenced via '{0}' from file '{1}'": { + "category": "Message", + "code": 1400 + }, + "File is included via reference here.": { + "category": "Message", + "code": 1401 + }, + "Type library referenced via '{0}' from file '{1}'": { + "category": "Message", + "code": 1402 + }, + "Type library referenced via '{0}' from file '{1}' with packageId '{2}'": { + "category": "Message", + "code": 1403 + }, + "File is included via type library reference here.": { + "category": "Message", + "code": 1404 + }, + "Library referenced via '{0}' from file '{1}'": { + "category": "Message", + "code": 1405 + }, + "File is included via library reference here.": { + "category": "Message", + "code": 1406 + }, + "Matched by include pattern '{0}' in '{1}'": { + "category": "Message", + "code": 1407 + }, + "File is matched by include pattern specified here.": { + "category": "Message", + "code": 1408 + }, + "Part of 'files' list in tsconfig.json": { + "category": "Message", + "code": 1409 + }, + "File is matched by 'files' list specified here.": { + "category": "Message", + "code": 1410 + }, + "Output from referenced project '{0}' included because '{1}' specified": { + "category": "Message", + "code": 1411 + }, + "Output from referenced project '{0}' included because '--module' is specified as 'none'": { + "category": "Message", + "code": 1412 + }, + "File is output from referenced project specified here.": { + "category": "Message", + "code": 1413 + }, + "Source from referenced project '{0}' included because '{1}' specified": { + "category": "Message", + "code": 1414 + }, + "Source from referenced project '{0}' included because '--module' is specified as 'none'": { + "category": "Message", + "code": 1415 + }, + "File is source from referenced project specified here.": { + "category": "Message", + "code": 1416 + }, + "Entry point of type library '{0}' specified in compilerOptions": { + "category": "Message", + "code": 1417 + }, + "Entry point of type library '{0}' specified in compilerOptions with packageId '{1}'": { + "category": "Message", + "code": 1418 + }, + "File is entry point of type library specified here.": { + "category": "Message", + "code": 1419 + }, + "Entry point for implicit type library '{0}'": { + "category": "Message", + "code": 1420 + }, + "Entry point for implicit type library '{0}' with packageId '{1}'": { + "category": "Message", + "code": 1421 + }, + "Library '{0}' specified in compilerOptions": { + "category": "Message", + "code": 1422 + }, + "File is library specified here.": { + "category": "Message", + "code": 1423 + }, + "Default library": { + "category": "Message", + "code": 1424 + }, + "Default library for target '{0}'": { + "category": "Message", + "code": 1425 + }, + "File is default library for target specified here.": { + "category": "Message", + "code": 1426 + }, + "Root file specified for compilation": { + "category": "Message", + "code": 1427 + }, + "File is output of project reference source '{0}'": { + "category": "Message", + "code": 1428 + }, + "File redirects to file '{0}'": { + "category": "Message", + "code": 1429 + }, + "The file is in the program because:": { + "category": "Message", + "code": 1430 + }, "The types of '{0}' are incompatible between these types.": { "category": "Error", "code": 2200 @@ -4748,6 +4900,10 @@ "category": "Error", "code": 6504 }, + "Print names of files and the reason they are part of the compilation.": { + "category": "Message", + "code": 6505 + }, "Require undeclared properties from index signatures to use element accesses.": { "category": "Error", "code": 6803 diff --git a/src/compiler/program.ts b/src/compiler/program.ts index bd668768ca25a..7b71f011700c1 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -466,20 +466,19 @@ namespace ts { if (diagnostic.file) { output += host.getNewLine(); output += formatCodeSpan(diagnostic.file, diagnostic.start!, diagnostic.length!, "", getCategoryFormat(diagnostic.category), host); // TODO: GH#18217 - if (diagnostic.relatedInformation) { - output += host.getNewLine(); - for (const { file, start, length, messageText } of diagnostic.relatedInformation) { - if (file) { - output += host.getNewLine(); - output += halfIndent + formatLocation(file, start!, host); // TODO: GH#18217 - output += formatCodeSpan(file, start!, length!, indent, ForegroundColorEscapeSequences.Cyan, host); // TODO: GH#18217 - } + } + if (diagnostic.relatedInformation) { + output += host.getNewLine(); + for (const { file, start, length, messageText } of diagnostic.relatedInformation) { + if (file) { output += host.getNewLine(); - output += indent + flattenDiagnosticMessageText(messageText, host.getNewLine()); + output += halfIndent + formatLocation(file, start!, host); // TODO: GH#18217 + output += formatCodeSpan(file, start!, length!, indent, ForegroundColorEscapeSequences.Cyan, host); // TODO: GH#18217 } + output += host.getNewLine(); + output += indent + flattenDiagnosticMessageText(messageText, host.getNewLine()); } } - output += host.getNewLine(); } return output; @@ -583,10 +582,66 @@ namespace ts { allDiagnostics?: readonly T[]; } - interface RefFile extends TextRange { - kind: RefFileKind; - index: number; + /*@internal*/ + export function isReferencedFile(reason: FileIncludeReason | undefined): reason is ReferencedFile { + switch (reason?.kind) { + case FileIncludeKind.Import: + case FileIncludeKind.ReferenceFile: + case FileIncludeKind.TypeReferenceDirective: + case FileIncludeKind.LibReferenceDirective: + return true; + default: + return false; + } + } + + /*@internal*/ + export interface ReferenceFileLocation { + file: SourceFile; + pos: number; + end: number; + packageId: PackageId | undefined; + } + + /*@internal*/ + export interface SyntheticReferenceFileLocation { file: SourceFile; + packageId: PackageId | undefined; + text: string; + } + + /*@internal*/ + export function isReferenceFileLocation(location: ReferenceFileLocation | SyntheticReferenceFileLocation): location is ReferenceFileLocation { + return (location as ReferenceFileLocation).pos !== undefined; + } + + /*@internal*/ + export function getReferencedFileLocation(getSourceFileByPath: (path: Path) => SourceFile | undefined, ref: ReferencedFile): ReferenceFileLocation | SyntheticReferenceFileLocation { + const file = Debug.checkDefined(getSourceFileByPath(ref.file)); + const { kind, index } = ref; + let pos: number | undefined, end: number | undefined, packageId: PackageId | undefined; + switch (kind) { + case FileIncludeKind.Import: + const importLiteral = getModuleNameStringLiteralAt(file, index); + packageId = file.resolvedModules?.get(importLiteral.text)?.packageId; + if (importLiteral.pos === -1) return { file, packageId, text: importLiteral.text }; + pos = skipTrivia(file.text, importLiteral.pos); + end = importLiteral.end; + break; + case FileIncludeKind.ReferenceFile: + ({ pos, end } = file.referencedFiles[index]); + break; + case FileIncludeKind.TypeReferenceDirective: + ({ pos, end } = file.typeReferenceDirectives[index]); + packageId = file.resolvedTypeReferenceDirectiveNames?.get(toFileNameLowerCase(file.typeReferenceDirectives[index].fileName))?.packageId; + break; + case FileIncludeKind.LibReferenceDirective: + ({ pos, end } = file.libReferenceDirectives[index]); + break; + default: + return Debug.assertNever(kind); + } + return { file, pos, end, packageId }; } /** @@ -754,14 +809,12 @@ namespace ts { let noDiagnosticsTypeChecker: TypeChecker; let classifiableNames: Set<__String>; const ambientModuleNameToUnmodifiedFileName = new Map(); - // Todo:: Use this to report why file was included in --extendedDiagnostics - let refFileMap: MultiMap | undefined; - + let fileReasons = createMultiMap(); const cachedBindAndCheckDiagnosticsForFile: DiagnosticCache = {}; const cachedDeclarationDiagnosticsForFile: DiagnosticCache = {}; let resolvedTypeReferenceDirectives = new Map(); - let fileProcessingDiagnostics = createDiagnosticCollection(); + let fileProcessingDiagnostics: FilePreprocessingDiagnostics[] | undefined; // The below settings are to track if a .js file should be add to the program if loaded via searching under node_modules. // This works as imported modules are discovered recursively in a depth first manner, specifically: @@ -796,7 +849,7 @@ namespace ts { // Map storing if there is emit blocking diagnostics for given input const hasEmitBlockingDiagnostics = new Map(); - let _compilerOptionsObjectLiteralSyntax: ObjectLiteralExpression | null | undefined; + let _compilerOptionsObjectLiteralSyntax: ObjectLiteralExpression | false | undefined; let moduleResolutionCache: ModuleResolutionCache | undefined; let actualResolveModuleNamesWorker: (moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference) => ResolvedModuleFull[]; @@ -884,40 +937,35 @@ namespace ts { resolvedProjectReferences = projectReferences.map(parseProjectReferenceConfigFile); } if (rootNames.length) { - for (const parsedRef of resolvedProjectReferences) { - if (!parsedRef) continue; + resolvedProjectReferences?.forEach((parsedRef, index) => { + if (!parsedRef) return; const out = outFile(parsedRef.commandLine.options); if (useSourceOfProjectReferenceRedirect) { if (out || getEmitModuleKind(parsedRef.commandLine.options) === ModuleKind.None) { for (const fileName of parsedRef.commandLine.fileNames) { - processSourceFile(fileName, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined); + processProjectReferenceFile(fileName, { kind: FileIncludeKind.SourceFromProjectReference, index }); } } } else { if (out) { - processSourceFile(changeExtension(out, ".d.ts"), /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined); + processProjectReferenceFile(changeExtension(out, ".d.ts"), { kind: FileIncludeKind.OutputFromProjectReference, index }); } else if (getEmitModuleKind(parsedRef.commandLine.options) === ModuleKind.None) { const getCommonSourceDirectory = memoize(() => getCommonSourceDirectoryOfConfig(parsedRef.commandLine, !host.useCaseSensitiveFileNames())); for (const fileName of parsedRef.commandLine.fileNames) { if (!fileExtensionIs(fileName, Extension.Dts) && !fileExtensionIs(fileName, Extension.Json)) { - processSourceFile( - getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory), - /*isDefaultLib*/ false, - /*ignoreNoDefaultLib*/ false, - /*packageId*/ undefined - ); + processProjectReferenceFile(getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory), { kind: FileIncludeKind.OutputFromProjectReference, index }); } } } } - } + }); } } tracing.push(tracing.Phase.Program, "processRootFiles", { count: rootNames.length }); - forEach(rootNames, name => processRootFile(name, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false)); + forEach(rootNames, (name, index) => processRootFile(name, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, { kind: FileIncludeKind.RootFile, index })); tracing.pop(); // load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders @@ -930,7 +978,7 @@ namespace ts { const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile); const resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename); for (let i = 0; i < typeReferences.length; i++) { - processTypeReferenceDirective(typeReferences[i], resolutions[i]); + processTypeReferenceDirective(typeReferences[i], resolutions[i], { kind: FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: resolutions[i]?.packageId }); } tracing.pop(); } @@ -944,11 +992,11 @@ namespace ts { // otherwise, using options specified in '--lib' instead of '--target' default library file const defaultLibraryFileName = getDefaultLibraryFileName(); if (!options.lib && defaultLibraryFileName) { - processRootFile(defaultLibraryFileName, /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ false); + processRootFile(defaultLibraryFileName, /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ false, { kind: FileIncludeKind.LibFile }); } else { - forEach(options.lib, libFileName => { - processRootFile(combinePaths(defaultLibraryPath, libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ false); + forEach(options.lib, (libFileName, index) => { + processRootFile(combinePaths(defaultLibraryPath, libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ false, { kind: FileIncludeKind.LibFile, index }); }); } } @@ -989,7 +1037,6 @@ namespace ts { getSourceFileByPath, getSourceFiles: () => files, getMissingFilePaths: () => missingFilePaths!, // TODO: GH#18217 - getRefFileMap: () => refFileMap, getFilesByNameMap: () => filesByName, getCompilerOptions: () => options, getSyntacticDiagnostics, @@ -1039,10 +1086,25 @@ namespace ts { getSymlinkCache, realpath: host.realpath?.bind(host), useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(), + getFileIncludeReasons: () => fileReasons, structureIsReused, }; onProgramCreateComplete(); + + // Add file processingDiagnostics + fileProcessingDiagnostics?.forEach(diagnostic => { + switch (diagnostic.kind) { + case FilePreprocessingDiagnosticsKind.FilePreprocessingFileExplainingDiagnostic: + return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || emptyArray)); + case FilePreprocessingDiagnosticsKind.FilePreprocessingReferencedDiagnostic: + const { file, pos, end } = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason) as ReferenceFileLocation; + return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray)); + default: + Debug.assertNever(diagnostic); + } + }); + verifyCompilerOptions(); performance.mark("afterProgram"); performance.measure("Program", "beforeProgram", "afterProgram"); @@ -1521,7 +1583,6 @@ namespace ts { } missingFilePaths = oldProgram.getMissingFilePaths(); - refFileMap = oldProgram.getRefFileMap(); // update fileName -> file mapping Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length); @@ -1545,11 +1606,8 @@ namespace ts { }); files = newSourceFiles; + fileReasons = oldProgram.getFileIncludeReasons(); fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); - - for (const modifiedFile of modifiedSourceFiles) { - fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile.newFile); - } resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives(); sourceFileToPackageName = oldProgram.sourceFileToPackageName; @@ -1759,19 +1817,12 @@ namespace ts { return emptyArray; } - const fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); const programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); - - return getMergedProgramDiagnostics(sourceFile, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); - } - - function getMergedProgramDiagnostics(sourceFile: SourceFile, ...allDiagnostics: (readonly Diagnostic[] | undefined)[]) { - const flatDiagnostics = flatten(allDiagnostics); if (!sourceFile.commentDirectives?.length) { - return flatDiagnostics; + return programDiagnosticsInFile; } - return getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics).diagnostics; + return getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, programDiagnosticsInFile).diagnostics; } function getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[] { @@ -2153,11 +2204,8 @@ namespace ts { function getOptionsDiagnostics(): SortedReadonlyArray { return sortAndDeduplicateDiagnostics(concatenate( - fileProcessingDiagnostics.getGlobalDiagnostics(), - concatenate( - programDiagnostics.getGlobalDiagnostics(), - getOptionsDiagnosticsOfConfigFile() - ) + programDiagnostics.getGlobalDiagnostics(), + getOptionsDiagnosticsOfConfigFile() )); } @@ -2178,8 +2226,8 @@ namespace ts { return configFileParsingDiagnostics || emptyArray; } - function processRootFile(fileName: string, isDefaultLib: boolean, ignoreNoDefaultLib: boolean) { - processSourceFile(normalizePath(fileName), isDefaultLib, ignoreNoDefaultLib, /*packageId*/ undefined); + function processRootFile(fileName: string, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, reason: FileIncludeReason) { + processSourceFile(normalizePath(fileName), isDefaultLib, ignoreNoDefaultLib, /*packageId*/ undefined, reason); } function fileReferenceIsEqualTo(a: FileReference, b: FileReference): boolean { @@ -2334,14 +2382,14 @@ namespace ts { /** This should have similar behavior to 'processSourceFile' without diagnostics or mutation. */ function getSourceFileFromReference(referencingFile: SourceFile | UnparsedSource, ref: FileReference): SourceFile | undefined { - return getSourceFileFromReferenceWorker(resolveTripleslashReference(ref.fileName, referencingFile.fileName), fileName => filesByName.get(toPath(fileName)) || undefined); + return getSourceFileFromReferenceWorker(resolveTripleslashReference(ref.fileName, referencingFile.fileName), getSourceFile); } function getSourceFileFromReferenceWorker( fileName: string, getSourceFile: (fileName: string) => SourceFile | undefined, fail?: (diagnostic: DiagnosticMessage, ...argument: string[]) => void, - refFile?: SourceFile): SourceFile | undefined { + reason?: FileIncludeReason): SourceFile | undefined { if (hasExtension(fileName)) { const canonicalFileName = host.getCanonicalFileName(fileName); @@ -2368,7 +2416,7 @@ namespace ts { fail(Diagnostics.File_0_not_found, fileName); } } - else if (refFile && canonicalFileName === host.getCanonicalFileName(refFile.fileName)) { + else if (isReferencedFile(reason) && canonicalFileName === host.getCanonicalFileName(getSourceFileByPath(reason.file)!.fileName)) { fail(Diagnostics.A_file_cannot_have_a_reference_to_itself); } } @@ -2390,34 +2438,27 @@ namespace ts { } /** This has side effects through `findSourceFile`. */ - function processSourceFile(fileName: string, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, packageId: PackageId | undefined, refFile?: RefFile): void { + function processSourceFile(fileName: string, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, packageId: PackageId | undefined, reason: FileIncludeReason): void { getSourceFileFromReferenceWorker( fileName, - fileName => findSourceFile(fileName, toPath(fileName), isDefaultLib, ignoreNoDefaultLib, refFile, packageId), // TODO: GH#18217 - (diagnostic, ...args) => fileProcessingDiagnostics.add( - createRefFileDiagnostic(refFile, diagnostic, ...args) - ), - refFile && refFile.file + fileName => findSourceFile(fileName, toPath(fileName), isDefaultLib, ignoreNoDefaultLib, reason, packageId), // TODO: GH#18217 + (diagnostic, ...args) => addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, diagnostic, args), + reason ); } - function reportFileNamesDifferOnlyInCasingError(fileName: string, existingFile: SourceFile, refFile: RefFile | undefined): void { - const refs = !refFile ? refFileMap && refFileMap.get(existingFile.path) : undefined; - const refToReportErrorOn = refs && find(refs, ref => ref.referencedFileName === existingFile.fileName); - fileProcessingDiagnostics.add(refToReportErrorOn ? - createFileDiagnosticAtReference( - refToReportErrorOn, - Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, - existingFile.fileName, - fileName, - ) : - createRefFileDiagnostic( - refFile, - Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, - fileName, - existingFile.fileName - ) - ); + function processProjectReferenceFile(fileName: string, reason: ProjectReferenceFile) { + return processSourceFile(fileName, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined, reason); + } + + function reportFileNamesDifferOnlyInCasingError(fileName: string, existingFile: SourceFile, reason: FileIncludeReason): void { + const hasExistingReasonToReportErrorOn = !isReferencedFile(reason) && some(fileReasons.get(existingFile.path), isReferencedFile); + if (hasExistingReasonToReportErrorOn) { + addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, [existingFile.fileName, fileName]); + } + else { + addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, [fileName, existingFile.fileName]); + } } function createRedirectSourceFile(redirectTarget: SourceFile, unredirected: SourceFile, fileName: string, path: Path, resolvedPath: Path, originalFileName: string): SourceFile { @@ -2442,18 +2483,18 @@ namespace ts { } // Get source file from normalized fileName - function findSourceFile(fileName: string, path: Path, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, refFile: RefFile | undefined, packageId: PackageId | undefined): SourceFile | undefined { + function findSourceFile(fileName: string, path: Path, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, reason: FileIncludeReason, packageId: PackageId | undefined): SourceFile | undefined { tracing.push(tracing.Phase.Program, "findSourceFile", { fileName, isDefaultLib: isDefaultLib || undefined, - refKind: refFile ? (RefFileKind as any)[refFile.kind] : undefined, + fileIncludeKind: (FileIncludeKind as any)[reason.kind], }); - const result = findSourceFileWorker(fileName, path, isDefaultLib, ignoreNoDefaultLib, refFile, packageId); + const result = findSourceFileWorker(fileName, path, isDefaultLib, ignoreNoDefaultLib, reason, packageId); tracing.pop(); return result; } - function findSourceFileWorker(fileName: string, path: Path, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, refFile: RefFile | undefined, packageId: PackageId | undefined): SourceFile | undefined { + function findSourceFileWorker(fileName: string, path: Path, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, reason: FileIncludeReason, packageId: PackageId | undefined): SourceFile | undefined { if (useSourceOfProjectReferenceRedirect) { let source = getSourceOfProjectReferenceRedirect(fileName); // If preserveSymlinks is true, module resolution wont jump the symlink @@ -2470,7 +2511,7 @@ namespace ts { } if (source) { const file = isString(source) ? - findSourceFile(source, toPath(source), isDefaultLib, ignoreNoDefaultLib, refFile, packageId) : + findSourceFile(source, toPath(source), isDefaultLib, ignoreNoDefaultLib, reason, packageId) : undefined; if (file) addFileToFilesByName(file, path, /*redirectedPath*/ undefined); return file; @@ -2479,7 +2520,7 @@ namespace ts { const originalFileName = fileName; if (filesByName.has(path)) { const file = filesByName.get(path); - addFileToRefFileMap(fileName, file || undefined, refFile); + addFileIncludeReason(file || undefined, reason); // try to check if we've already seen this file but with a different casing in path // NOTE: this only makes sense for case-insensitive file systems, and only on files which are not redirected if (file && options.forceConsistentCasingInFileNames) { @@ -2492,7 +2533,7 @@ namespace ts { const checkedAbsolutePath = getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory); const inputAbsolutePath = getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory); if (checkedAbsolutePath !== inputAbsolutePath) { - reportFileNamesDifferOnlyInCasingError(fileName, file, refFile); + reportFileNamesDifferOnlyInCasingError(fileName, file, reason); } } @@ -2523,7 +2564,7 @@ namespace ts { } let redirectedPath: Path | undefined; - if (refFile && !useSourceOfProjectReferenceRedirect) { + if (isReferencedFile(reason) && !useSourceOfProjectReferenceRedirect) { const redirectProject = getProjectReferenceRedirectProject(fileName); if (redirectProject) { if (outFile(redirectProject.commandLine.options)) { @@ -2545,12 +2586,7 @@ namespace ts { const file = host.getSourceFile( fileName, options.target!, - hostErrorMessage => fileProcessingDiagnostics.add(createRefFileDiagnostic( - refFile, - Diagnostics.Cannot_read_file_0_Colon_1, - fileName, - hostErrorMessage - )), + hostErrorMessage => addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]), shouldCreateNewSourceFile ); @@ -2563,6 +2599,7 @@ namespace ts { const dupFile = createRedirectSourceFile(fileFromPackageId, file!, fileName, path, toPath(fileName), originalFileName); // TODO: GH#18217 redirectTargetsMap.add(fileFromPackageId.path, fileName); addFileToFilesByName(dupFile, path, redirectedPath); + addFileIncludeReason(dupFile, reason); sourceFileToPackageName.set(path, packageId.name); processingOtherFiles!.push(dupFile); return dupFile; @@ -2581,14 +2618,14 @@ namespace ts { file.path = path; file.resolvedPath = toPath(fileName); file.originalFileName = originalFileName; - addFileToRefFileMap(fileName, file, refFile); + addFileIncludeReason(file, reason); if (host.useCaseSensitiveFileNames()) { const pathLowerCase = toFileNameLowerCase(path); // for case-sensitive file systems check if we've already seen some file with similar filename ignoring case const existingFile = filesByNameIgnoreCase!.get(pathLowerCase); if (existingFile) { - reportFileNamesDifferOnlyInCasingError(fileName, existingFile, refFile); + reportFileNamesDifferOnlyInCasingError(fileName, existingFile, reason); } else { filesByNameIgnoreCase!.set(pathLowerCase, file); @@ -2619,15 +2656,8 @@ namespace ts { return file; } - function addFileToRefFileMap(referencedFileName: string, file: SourceFile | undefined, refFile: RefFile | undefined) { - if (refFile && file) { - (refFileMap || (refFileMap = createMultiMap())).add(file.path, { - referencedFileName, - kind: refFile.kind, - index: refFile.index, - file: refFile.file.path - }); - } + function addFileIncludeReason(file: SourceFile | undefined, reason: FileIncludeReason) { + if (file) fileReasons.add(file.path, reason); } function addFileToFilesByName(file: SourceFile | undefined, path: Path, redirectedPath: Path | undefined) { @@ -2728,19 +2758,12 @@ namespace ts { function processReferencedFiles(file: SourceFile, isDefaultLib: boolean) { forEach(file.referencedFiles, (ref, index) => { - const referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); processSourceFile( - referencedFileName, + resolveTripleslashReference(ref.fileName, file.fileName), isDefaultLib, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined, - { - kind: RefFileKind.ReferenceFile, - index, - file, - pos: ref.pos, - end: ref.end - } + { kind: FileIncludeKind.ReferenceFile, file: file.path, index, } ); }); } @@ -2753,41 +2776,30 @@ namespace ts { } const resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file); - - for (let i = 0; i < typeDirectives.length; i++) { - const ref = file.typeReferenceDirectives[i]; - const resolvedTypeReferenceDirective = resolutions[i]; + for (let index = 0; index < typeDirectives.length; index++) { + const ref = file.typeReferenceDirectives[index]; + const resolvedTypeReferenceDirective = resolutions[index]; // store resolved type directive on the file const fileName = toFileNameLowerCase(ref.fileName); setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective); - processTypeReferenceDirective( - fileName, - resolvedTypeReferenceDirective, - { - kind: RefFileKind.TypeReferenceDirective, - index: i, - file, - pos: ref.pos, - end: ref.end - } - ); + processTypeReferenceDirective(fileName, resolvedTypeReferenceDirective, { kind: FileIncludeKind.TypeReferenceDirective, file: file.path, index, }); } } function processTypeReferenceDirective( typeReferenceDirective: string, - resolvedTypeReferenceDirective?: ResolvedTypeReferenceDirective, - refFile?: RefFile + resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective | undefined, + reason: FileIncludeReason ): void { - tracing.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolveModuleNamesReusingOldState, refKind: refFile?.kind, refPath: refFile?.file.path }); - processTypeReferenceDirectiveWorker(typeReferenceDirective, resolvedTypeReferenceDirective, refFile); + tracing.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolveModuleNamesReusingOldState, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined }); + processTypeReferenceDirectiveWorker(typeReferenceDirective, resolvedTypeReferenceDirective, reason); tracing.pop(); } function processTypeReferenceDirectiveWorker( typeReferenceDirective: string, - resolvedTypeReferenceDirective?: ResolvedTypeReferenceDirective, - refFile?: RefFile + resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective | undefined, + reason: FileIncludeReason ): void { // If we already found this library as a primary reference - nothing to do @@ -2801,7 +2813,7 @@ namespace ts { if (resolvedTypeReferenceDirective.primary) { // resolved from the primary path - processSourceFile(resolvedTypeReferenceDirective.resolvedFileName!, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, refFile); // TODO: GH#18217 + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName!, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, reason); // TODO: GH#18217 } else { // If we already resolved to this file, it must have been a secondary reference. Check file contents @@ -2812,25 +2824,11 @@ namespace ts { const otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName!); const existingFile = getSourceFile(previousResolution.resolvedFileName!)!; if (otherFileText !== existingFile.text) { - // Try looking up ref for original file - const refs = !refFile ? refFileMap && refFileMap.get(existingFile.path) : undefined; - const refToReportErrorOn = refs && find(refs, ref => ref.referencedFileName === existingFile.fileName); - fileProcessingDiagnostics.add( - refToReportErrorOn ? - createFileDiagnosticAtReference( - refToReportErrorOn, - Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict, - typeReferenceDirective, - resolvedTypeReferenceDirective.resolvedFileName, - previousResolution.resolvedFileName - ) : - createRefFileDiagnostic( - refFile, - Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict, - typeReferenceDirective, - resolvedTypeReferenceDirective.resolvedFileName, - previousResolution.resolvedFileName - ) + addFilePreprocessingFileExplainingDiagnostic( + existingFile, + reason, + Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict, + [typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName] ); } } @@ -2839,18 +2837,14 @@ namespace ts { } else { // First resolution of this library - processSourceFile(resolvedTypeReferenceDirective.resolvedFileName!, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, refFile); + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName!, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, reason); } } if (resolvedTypeReferenceDirective.isExternalLibraryImport) currentNodeModulesDepth--; } else { - fileProcessingDiagnostics.add(createRefFileDiagnostic( - refFile, - Diagnostics.Cannot_find_type_definition_file_for_0, - typeReferenceDirective - )); + addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]); } if (saveResolution) { @@ -2859,38 +2853,27 @@ namespace ts { } function processLibReferenceDirectives(file: SourceFile) { - forEach(file.libReferenceDirectives, libReference => { + forEach(file.libReferenceDirectives, (libReference, index) => { const libName = toFileNameLowerCase(libReference.fileName); const libFileName = libMap.get(libName); if (libFileName) { // we ignore any 'no-default-lib' reference set on this file. - processRootFile(combinePaths(defaultLibraryPath, libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ true); + processRootFile(combinePaths(defaultLibraryPath, libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ true, { kind: FileIncludeKind.LibReferenceDirective, file: file.path, index, }); } else { const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts"); const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity); - const message = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0; - fileProcessingDiagnostics.add(createFileDiagnostic( - file, - libReference.pos, - libReference.end - libReference.pos, - message, - libName, - suggestion - )); + const diagnostic = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0; + (fileProcessingDiagnostics ||= []).push({ + kind: FilePreprocessingDiagnosticsKind.FilePreprocessingReferencedDiagnostic, + reason: { kind: FileIncludeKind.LibReferenceDirective, file: file.path, index, }, + diagnostic, + args: [libName, suggestion] + }); } }); } - function createRefFileDiagnostic(refFile: RefFile | undefined, message: DiagnosticMessage, ...args: any[]): Diagnostic { - if (!refFile) { - return createCompilerDiagnostic(message, ...args); - } - else { - return createFileDiagnostic(refFile.file, refFile.pos, refFile.end - refFile.pos, message, ...args); - } - } - function getCanonicalFileName(fileName: string): string { return host.getCanonicalFileName(fileName); } @@ -2902,9 +2885,9 @@ namespace ts { const moduleNames = getModuleNames(file); const resolutions = resolveModuleNamesReusingOldState(moduleNames, file); Debug.assert(resolutions.length === moduleNames.length); - for (let i = 0; i < moduleNames.length; i++) { - const resolution = resolutions[i]; - setResolvedModule(file, moduleNames[i], resolution); + for (let index = 0; index < moduleNames.length; index++) { + const resolution = resolutions[index]; + setResolvedModule(file, moduleNames[index], resolution); if (!resolution) { continue; @@ -2930,30 +2913,23 @@ namespace ts { const shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve - && i < file.imports.length + && index < file.imports.length && !elideImport && !(isJsFile && !getAllowJSCompilerOption(options)) - && (isInJSFile(file.imports[i]) || !(file.imports[i].flags & NodeFlags.JSDoc)); + && (isInJSFile(file.imports[index]) || !(file.imports[index].flags & NodeFlags.JSDoc)); if (elideImport) { modulesWithElidedImports.set(file.path, true); } else if (shouldAddFile) { const path = toPath(resolvedFileName); - const pos = skipTrivia(file.text, file.imports[i].pos); findSourceFile( resolvedFileName, path, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, - { - kind: RefFileKind.Import, - index: i, - file, - pos, - end: file.imports[i].end - }, - resolution.packageId + { kind: FileIncludeKind.Import, file: file.path, index, }, + resolution.packageId, ); } @@ -2971,19 +2947,14 @@ namespace ts { function checkSourceFilesBelongToPath(sourceFiles: readonly SourceFile[], rootDirectory: string): boolean { let allFilesBelongToPath = true; const absoluteRootDirectoryPath = host.getCanonicalFileName(getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - let rootPaths: Set | undefined; - for (const sourceFile of sourceFiles) { if (!sourceFile.isDeclarationFile) { const absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { - if (!rootPaths) rootPaths = new Set(rootNames.map(toPath)); - addProgramDiagnosticAtRefPath( + addProgramDiagnosticExplainingFile( sourceFile, - rootPaths, Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, - sourceFile.fileName, - rootDirectory + [sourceFile.fileName, rootDirectory] ); allFilesBelongToPath = false; } @@ -3094,12 +3065,10 @@ namespace ts { for (const file of files) { // Ignore file that is not emitted if (sourceFileMayBeEmitted(file, program) && !rootPaths.has(file.path)) { - addProgramDiagnosticAtRefPath( + addProgramDiagnosticExplainingFile( file, - rootPaths, Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, - file.fileName, - options.configFilePath || "" + [file.fileName, options.configFilePath || ""] ); } } @@ -3343,35 +3312,138 @@ namespace ts { } } - function createFileDiagnosticAtReference(refPathToReportErrorOn: ts.RefFile, message: DiagnosticMessage, ...args: (string | number | undefined)[]) { - const refFile = Debug.checkDefined(getSourceFileByPath(refPathToReportErrorOn.file)); - const { kind, index } = refPathToReportErrorOn; - let pos: number, end: number; - switch (kind) { - case RefFileKind.Import: - pos = skipTrivia(refFile.text, refFile.imports[index].pos); - end = refFile.imports[index].end; + function createDiagnosticExplainingFile(file: SourceFile | undefined, fileProcessingReason: FileIncludeReason | undefined, diagnostic: DiagnosticMessage, args: (string | number | undefined)[] | undefined): Diagnostic { + let fileIncludeReasons: DiagnosticMessageChain[] | undefined; + let relatedInfo: Diagnostic[] | undefined; + let locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : undefined; + if (file) fileReasons.get(file.path)?.forEach(processReason); + if (fileProcessingReason) processReason(fileProcessingReason); + // If we have location and there is only one reason file is in which is the location, dont add details for file include + if (locationReason && fileIncludeReasons?.length === 1) fileIncludeReasons = undefined; + const location = locationReason && getReferencedFileLocation(getSourceFileByPath, locationReason); + const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon); + const redirectInfo = file && explainIfFileIsRedirect(file); + const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray); + return location && isReferenceFileLocation(location) ? + createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : + createCompilerDiagnosticFromMessageChain(chain, relatedInfo); + + function processReason(reason: FileIncludeReason) { + (fileIncludeReasons ||= []).push(fileIncludeReasonToDiagnostics(program, reason)); + if (!locationReason && isReferencedFile(reason)) { + // Report error at first reference file or file currently in processing and dont report in related information + locationReason = reason; + } + else if (locationReason !== reason) { + relatedInfo = append(relatedInfo, fileIncludeReasonToRelatedInformation(reason)); + } + // Remove fileProcessingReason if its already included in fileReasons of the program + if (reason === fileProcessingReason) fileProcessingReason = undefined; + } + } + + function addFilePreprocessingFileExplainingDiagnostic(file: SourceFile | undefined, fileProcessingReason: FileIncludeReason, diagnostic: DiagnosticMessage, args?: (string | number | undefined)[]) { + (fileProcessingDiagnostics ||= []).push({ + kind: FilePreprocessingDiagnosticsKind.FilePreprocessingFileExplainingDiagnostic, + file: file && file.path, + fileProcessingReason, + diagnostic, + args + }); + } + + function addProgramDiagnosticExplainingFile(file: SourceFile, diagnostic: DiagnosticMessage, args?: (string | number | undefined)[]) { + programDiagnostics.add(createDiagnosticExplainingFile(file, /*fileProcessingReason*/ undefined, diagnostic, args)); + } + + function fileIncludeReasonToRelatedInformation(reason: FileIncludeReason): DiagnosticWithLocation | undefined { + if (isReferencedFile(reason)) { + const referenceLocation = getReferencedFileLocation(getSourceFileByPath, reason); + let message: DiagnosticMessage; + switch (reason.kind) { + case FileIncludeKind.Import: + message = Diagnostics.File_is_included_via_import_here; + break; + case FileIncludeKind.ReferenceFile: + message = Diagnostics.File_is_included_via_reference_here; + break; + case FileIncludeKind.TypeReferenceDirective: + message = Diagnostics.File_is_included_via_type_library_reference_here; + break; + case FileIncludeKind.LibReferenceDirective: + message = Diagnostics.File_is_included_via_library_reference_here; + break; + default: + Debug.assertNever(reason); + } + return isReferenceFileLocation(referenceLocation) ? createFileDiagnostic( + referenceLocation.file, + referenceLocation.pos, + referenceLocation.end - referenceLocation.pos, + message, + ) : undefined; + } + + if (!options.configFile) return undefined; + let configFileNode: Node | undefined; + let message: DiagnosticMessage; + switch (reason.kind) { + case FileIncludeKind.RootFile: + if (!options.configFile.configFileSpecs) return undefined; + const fileName = getNormalizedAbsolutePath(rootNames[reason.index], currentDirectory); + const matchedByFiles = getMatchedFileSpec(program, fileName); + if (matchedByFiles) { + configFileNode = getTsConfigPropArrayElementValue(options.configFile, "files", matchedByFiles); + message = Diagnostics.File_is_matched_by_files_list_specified_here; + break; + } + const matchedByInclude = getMatchedIncludeSpec(program, fileName); + // Could be additional files specified as roots + if (!matchedByInclude) return undefined; + configFileNode = getTsConfigPropArrayElementValue(options.configFile, "include", matchedByInclude); + message = Diagnostics.File_is_matched_by_include_pattern_specified_here; break; - case RefFileKind.ReferenceFile: - ({ pos, end } = refFile.referencedFiles[index]); + case FileIncludeKind.SourceFromProjectReference: + case FileIncludeKind.OutputFromProjectReference: + const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences?.[reason.index]); + const referenceInfo = forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, parent, index) => + resolvedRef === referencedResolvedRef ? { sourceFile: parent?.sourceFile || options.configFile!, index } : undefined + ); + if (!referenceInfo) return undefined; + const { sourceFile, index } = referenceInfo; + const referencesSyntax = firstDefined(getTsConfigPropArray(sourceFile as TsConfigSourceFile, "references"), + property => isArrayLiteralExpression(property.initializer) ? property.initializer : undefined); + return referencesSyntax && referencesSyntax.elements.length > index ? + createDiagnosticForNodeInSourceFile( + sourceFile, + referencesSyntax.elements[index], + reason.kind === FileIncludeKind.OutputFromProjectReference ? + Diagnostics.File_is_output_from_referenced_project_specified_here : + Diagnostics.File_is_source_from_referenced_project_specified_here, + ) : + undefined; + case FileIncludeKind.AutomaticTypeDirectiveFile: + if (!options.types) return undefined; + configFileNode = getOptionsSyntaxByArrayElementValue("types", reason.typeReference); + message = Diagnostics.File_is_entry_point_of_type_library_specified_here; break; - case RefFileKind.TypeReferenceDirective: - ({ pos, end } = refFile.typeReferenceDirectives[index]); + case FileIncludeKind.LibFile: + if (reason.index !== undefined) { + configFileNode = getOptionsSyntaxByArrayElementValue("lib", options.lib![reason.index]); + message = Diagnostics.File_is_library_specified_here; + break; + } + const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === options.target ? key : undefined); + configFileNode = target ? getOptionsSyntaxByValue("target", target) : undefined; + message = Diagnostics.File_is_default_library_for_target_specified_here; break; default: - return Debug.assertNever(kind); + Debug.assertNever(reason); } - return createFileDiagnostic(refFile, pos, end - pos, message, ...args); - } - - function addProgramDiagnosticAtRefPath(file: SourceFile, rootPaths: Set, message: DiagnosticMessage, ...args: (string | number | undefined)[]) { - const refPaths = refFileMap?.get(file.path); - const refPathToReportErrorOn = forEach(refPaths, refPath => rootPaths.has(refPath.file) ? refPath : undefined) || - elementAt(refPaths, 0); - programDiagnostics.add( - refPathToReportErrorOn ? - createFileDiagnosticAtReference(refPathToReportErrorOn, message, ...args) : - createCompilerDiagnostic(message, ...args) + return configFileNode && createDiagnosticForNodeInSourceFile( + options.configFile, + configFileNode, + message, ); } @@ -3447,16 +3519,23 @@ namespace ts { } } - function getOptionsSyntaxByName(name: string): object | undefined { + function getOptionsSyntaxByName(name: string) { const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); - if (compilerOptionsObjectLiteralSyntax) { - return getPropertyAssignment(compilerOptionsObjectLiteralSyntax, name); - } - return undefined; + return compilerOptionsObjectLiteralSyntax && getPropertyAssignment(compilerOptionsObjectLiteralSyntax, name); + } + + function getOptionPathsSyntax() { + return getOptionsSyntaxByName("paths") || emptyArray; } - function getOptionPathsSyntax(): PropertyAssignment[] { - return getOptionsSyntaxByName("paths") as PropertyAssignment[] || emptyArray; + function getOptionsSyntaxByValue(name: string, value: string) { + const syntaxByName = getOptionsSyntaxByName(name); + return syntaxByName && firstDefined(syntaxByName, property => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : undefined); + } + + function getOptionsSyntaxByArrayElementValue(name: string, value: string) { + const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); + return compilerOptionsObjectLiteralSyntax && getPropertyArrayElementValue(compilerOptionsObjectLiteralSyntax, name, value); } function createDiagnosticForOptionName(message: DiagnosticMessage, option1: string, option2?: string, option3?: string) { @@ -3490,7 +3569,7 @@ namespace ts { function getCompilerOptionsObjectLiteralSyntax() { if (_compilerOptionsObjectLiteralSyntax === undefined) { - _compilerOptionsObjectLiteralSyntax = null; // eslint-disable-line no-null/no-null + _compilerOptionsObjectLiteralSyntax = false; const jsonObjectLiteral = getTsConfigObjectLiteralExpression(options.configFile); if (jsonObjectLiteral) { for (const prop of getPropertyAssignment(jsonObjectLiteral, "compilerOptions")) { @@ -3501,7 +3580,7 @@ namespace ts { } } } - return _compilerOptionsObjectLiteralSyntax; + return _compilerOptionsObjectLiteralSyntax || undefined; } function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral: ObjectLiteralExpression, onKey: boolean, key1: string, key2: string | undefined, message: DiagnosticMessage, arg0: string | number, arg1?: string | number, arg2?: string | number): boolean { @@ -3743,8 +3822,8 @@ namespace ts { export const emitSkippedWithNoDiagnostics: EmitResult = { diagnostics: emptyArray, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; /*@internal*/ - export function handleNoEmitOptions( - program: ProgramToEmitFilesAndReportErrors, + export function handleNoEmitOptions( + program: Program | T, sourceFile: SourceFile | undefined, writeFile: WriteFileCallback | undefined, cancellationToken: CancellationToken | undefined @@ -3893,4 +3972,17 @@ namespace ts { } return res; } + + function getModuleNameStringLiteralAt({ imports, moduleAugmentations }: SourceFile, index: number): StringLiteralLike { + if (index < imports.length) return imports[index]; + let augIndex = imports.length; + for (const aug of moduleAugmentations) { + if (aug.kind === SyntaxKind.StringLiteral) { + if (index === augIndex) return aug; + augIndex++; + } + // Do nothing if it's an Identifier; we don't need to do module resolution for `declare global`. + } + Debug.fail("should never ask for module name at index higher than possible module name"); + } } diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index f74b016093a1e..f624ed9098f68 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -14,6 +14,7 @@ namespace ts { /*@internal*/ preserveWatchOutput?: boolean; /*@internal*/ listEmittedFiles?: boolean; /*@internal*/ listFiles?: boolean; + /*@internal*/ explainFiles?: boolean; /*@internal*/ pretty?: boolean; incremental?: boolean; assumeChangesOnlyAffectDirectDependencies?: boolean; @@ -215,7 +216,7 @@ namespace ts { readonly currentDirectory: string; readonly getCanonicalFileName: GetCanonicalFileName; readonly parseConfigFileHost: ParseConfigFileHost; - readonly writeFileName: ((s: string) => void) | undefined; + readonly write: ((s: string) => void) | undefined; // State of solution readonly options: BuildOptions; @@ -287,7 +288,7 @@ namespace ts { currentDirectory, getCanonicalFileName, parseConfigFileHost: parseConfigHostFromCompilerHostLike(host), - writeFileName: host.trace ? (s: string) => host.trace!(s) : undefined, + write: maybeBind(host, host.trace), // State of solution options, @@ -892,7 +893,7 @@ namespace ts { const { emitResult } = emitFilesAndReportErrors( program, reportDeclarationDiagnostics, - /*writeFileName*/ undefined, + /*write*/ undefined, /*reportSummary*/ undefined, (name, text, writeByteOrderMark) => outputFiles.push({ name, text, writeByteOrderMark }), cancellationToken, @@ -965,7 +966,7 @@ namespace ts { buildResult = BuildResultFlags.EmitErrors & buildResult!; } - if (emitResult.emittedFiles && state.writeFileName) { + if (emitResult.emittedFiles && state.write) { emitResult.emittedFiles.forEach(name => listEmittedFile(state, config, name)); } afterProgramDone(state, program, config); @@ -995,7 +996,7 @@ namespace ts { return emitDiagnostics; } - if (state.writeFileName) { + if (state.write) { emittedOutputs.forEach(name => listEmittedFile(state, config, name)); } @@ -1169,9 +1170,8 @@ namespace ts { } else if (reloadLevel === ConfigFileProgramReloadLevel.Partial) { // Update file names - const result = getFileNamesFromConfigSpecs(config.configFileSpecs!, getDirectoryPath(project), config.options, state.parseConfigFileHost); - updateErrorForNoInputFiles(result, project, config.configFileSpecs!, config.errors, canJsonReportNoInputFiles(config.raw)); - config.fileNames = result.fileNames; + config.fileNames = getFileNamesFromConfigSpecs(config.options.configFile!.configFileSpecs!, getDirectoryPath(project), config.options, state.parseConfigFileHost); + updateErrorForNoInputFiles(config.fileNames, project, config.options.configFile!.configFileSpecs!, config.errors, canJsonReportNoInputFiles(config.raw)); watchInputFiles(state, project, projectPath, config); } @@ -1240,9 +1240,9 @@ namespace ts { return undefined; } - function listEmittedFile({ writeFileName }: SolutionBuilderState, proj: ParsedCommandLine, file: string) { - if (writeFileName && proj.options.listEmittedFiles) { - writeFileName(`TSFILE: ${file}`); + function listEmittedFile({ write }: SolutionBuilderState, proj: ParsedCommandLine, file: string) { + if (write && proj.options.listEmittedFiles) { + write(`TSFILE: ${file}`); } } @@ -1259,7 +1259,7 @@ namespace ts { config: ParsedCommandLine ) { if (program) { - if (program && state.writeFileName) listFiles(program, state.writeFileName); + if (program && state.write) listFiles(program, state.write); if (state.host.afterProgramEmitAndDiagnostics) { state.host.afterProgramEmitAndDiagnostics(program); } @@ -1283,7 +1283,6 @@ namespace ts { const canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !outFile(program.getCompilerOptions()); reportAndStoreErrors(state, resolvedPath, diagnostics); - // List files if any other build error using program (emit errors already report files) state.projectStatus.set(resolvedPath, { type: UpToDateStatusType.Unbuildable, reason: `${errorType} errors` }); if (canEmitBuildInfo) return { buildResult, step: BuildStep.EmitBuildInfo }; afterProgramDone(state, program, config); @@ -1794,7 +1793,7 @@ namespace ts { if (!state.watch) return; updateWatchingWildcardDirectories( getOrCreateValueMapFromConfigFileMap(state.allWatchedWildcardDirectories, resolvedPath), - new Map(getEntries(parsed.configFileSpecs!.wildcardDirectories)), + new Map(getEntries(parsed.wildcardDirectories!)), (dir, flags) => state.watchDirectory( dir, fileOrDirectory => { @@ -1803,7 +1802,6 @@ namespace ts { fileOrDirectory, fileOrDirectoryPath: toPath(state, fileOrDirectory), configFileName: resolved, - configFileSpecs: parsed.configFileSpecs!, currentDirectory: state.currentDirectory, options: parsed.options, program: state.builderPrograms.get(resolvedPath), diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 34245a5e404a7..3628a39532095 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3620,6 +3620,7 @@ namespace ts { export interface TsConfigSourceFile extends JsonSourceFile { extendedSourceFiles?: string[]; + /*@internal*/ configFileSpecs?: ConfigFileSpecs; } export interface JsonMinusNumericLiteral extends PrefixUnaryExpression { @@ -3689,20 +3690,94 @@ namespace ts { } /*@internal*/ - export enum RefFileKind { + export enum FileIncludeKind { + RootFile, + SourceFromProjectReference, + OutputFromProjectReference, Import, ReferenceFile, - TypeReferenceDirective + TypeReferenceDirective, + LibFile, + LibReferenceDirective, + AutomaticTypeDirectiveFile } /*@internal*/ - export interface RefFile { - referencedFileName: string; - kind: RefFileKind; + export interface RootFile { + kind: FileIncludeKind.RootFile, index: number; + } + + /*@internal*/ + export interface LibFile { + kind: FileIncludeKind.LibFile; + index?: number; + } + + /*@internal*/ + export type ProjectReferenceFileKind = FileIncludeKind.SourceFromProjectReference | + FileIncludeKind.OutputFromProjectReference; + + /*@internal*/ + export interface ProjectReferenceFile { + kind: ProjectReferenceFileKind; + index: number; + } + + /*@internal*/ + export type ReferencedFileKind = FileIncludeKind.Import | + FileIncludeKind.ReferenceFile | + FileIncludeKind.TypeReferenceDirective | + FileIncludeKind.LibReferenceDirective; + + /*@internal*/ + export interface ReferencedFile { + kind: ReferencedFileKind; file: Path; + index: number; + } + + /*@internal*/ + export interface AutomaticTypeDirectiveFile { + kind: FileIncludeKind.AutomaticTypeDirectiveFile; + typeReference: string; + packageId: PackageId | undefined; } + /*@internal*/ + export type FileIncludeReason = + RootFile | + LibFile | + ProjectReferenceFile | + ReferencedFile | + AutomaticTypeDirectiveFile; + + /*@internal*/ + export const enum FilePreprocessingDiagnosticsKind { + FilePreprocessingReferencedDiagnostic, + FilePreprocessingFileExplainingDiagnostic + } + + /*@internal*/ + export interface FilePreprocessingReferencedDiagnostic { + kind: FilePreprocessingDiagnosticsKind.FilePreprocessingReferencedDiagnostic; + reason: ReferencedFile; + diagnostic: DiagnosticMessage; + args?: (string | number | undefined)[]; + } + + /*@internal*/ + export interface FilePreprocessingFileExplainingDiagnostic { + kind: FilePreprocessingDiagnosticsKind.FilePreprocessingFileExplainingDiagnostic; + file?: Path; + fileProcessingReason: FileIncludeReason; + diagnostic: DiagnosticMessage; + args?: (string | number | undefined)[]; + } + + /*@internal*/ + export type FilePreprocessingDiagnostics = FilePreprocessingReferencedDiagnostic | FilePreprocessingFileExplainingDiagnostic; + export interface Program extends ScriptReferenceHost { getCurrentDirectory(): string; /** @@ -3722,8 +3797,6 @@ namespace ts { /* @internal */ getMissingFilePaths(): readonly Path[]; /* @internal */ - getRefFileMap(): MultiMap | undefined; - /* @internal */ getFilesByNameMap(): ESMap; /** @@ -3777,7 +3850,7 @@ namespace ts { getInstantiationCount(): number; getRelationCacheSizes(): { assignable: number, identity: number, subtype: number, strictSubtype: number }; - /* @internal */ getFileProcessingDiagnostics(): DiagnosticCollection; + /* @internal */ getFileProcessingDiagnostics(): FilePreprocessingDiagnostics[] | undefined; /* @internal */ getResolvedTypeReferenceDirectives(): ESMap; isSourceFileFromExternalLibrary(file: SourceFile): boolean; isSourceFileDefaultLibrary(file: SourceFile): boolean; @@ -3795,6 +3868,8 @@ namespace ts { /* @internal */ redirectTargetsMap: MultiMap; /** Is the file emitted file */ /* @internal */ isEmittedFile(file: string): boolean; + /* @internal */ getFileIncludeReasons(): MultiMap; + /* @internal */ useCaseSensitiveFileNames(): boolean; /* @internal */ getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined; @@ -5769,6 +5844,7 @@ namespace ts { lib?: string[]; /*@internal*/listEmittedFiles?: boolean; /*@internal*/listFiles?: boolean; + /*@internal*/explainFiles?: boolean; /*@internal*/listFilesOnly?: boolean; locale?: string; mapRoot?: string; @@ -5957,7 +6033,6 @@ namespace ts { errors: Diagnostic[]; wildcardDirectories?: MapLike; compileOnSave?: boolean; - /* @internal */ configFileSpecs?: ConfigFileSpecs; } export const enum WatchDirectoryFlags { @@ -5979,13 +6054,6 @@ namespace ts { validatedFilesSpec: readonly string[] | undefined; validatedIncludeSpecs: readonly string[] | undefined; validatedExcludeSpecs: readonly string[] | undefined; - wildcardDirectories: MapLike; - } - - export interface ExpandResult { - fileNames: string[]; - wildcardDirectories: MapLike; - /* @internal */ spec: ConfigFileSpecs; } /* @internal */ @@ -7914,8 +7982,6 @@ namespace ts { // Otherwise, returns all the diagnostics (global and file associated) in this collection. getDiagnostics(): Diagnostic[]; getDiagnostics(fileName: string): DiagnosticWithLocation[]; - - reattachFileDiagnostics(newFile: SourceFile): void; } // SyntaxKind.SyntaxList diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 43f5e4aa8eaae..ee9db727dd4f7 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -988,10 +988,25 @@ namespace ts { export function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain, relatedInformation?: DiagnosticRelatedInformation[]): DiagnosticWithLocation { const sourceFile = getSourceFileOfNode(node); const span = getErrorSpanForNode(sourceFile, node); + return createFileDiagnosticFromMessageChain(sourceFile, span.start, span.length, messageChain, relatedInformation); + } + + function assertDiagnosticLocation(file: SourceFile | undefined, start: number, length: number) { + Debug.assertGreaterThanOrEqual(start, 0); + Debug.assertGreaterThanOrEqual(length, 0); + + if (file) { + Debug.assertLessThanOrEqual(start, file.text.length); + Debug.assertLessThanOrEqual(start + length, file.text.length); + } + } + + export function createFileDiagnosticFromMessageChain(file: SourceFile, start: number, length: number, messageChain: DiagnosticMessageChain, relatedInformation?: DiagnosticRelatedInformation[]): DiagnosticWithLocation { + assertDiagnosticLocation(file, start, length); return { - file: sourceFile, - start: span.start, - length: span.length, + file, + start, + length, code: messageChain.code, category: messageChain.category, messageText: messageChain.next ? messageChain : messageChain.messageText, @@ -1496,6 +1511,13 @@ namespace ts { }); } + export function getPropertyArrayElementValue(objectLiteral: ObjectLiteralExpression, propKey: string, elementValue: string): StringLiteral | undefined { + return firstDefined(getPropertyAssignment(objectLiteral, propKey), property => + isArrayLiteralExpression(property.initializer) ? + find(property.initializer.elements, (element): element is StringLiteral => isStringLiteral(element) && element.text === elementValue) : + undefined); + } + export function getTsConfigObjectLiteralExpression(tsConfigSourceFile: TsConfigSourceFile | undefined): ObjectLiteralExpression | undefined { if (tsConfigSourceFile && tsConfigSourceFile.statements.length) { const expression = tsConfigSourceFile.statements[0].expression; @@ -3667,13 +3689,8 @@ namespace ts { lookup, getGlobalDiagnostics, getDiagnostics, - reattachFileDiagnostics }; - function reattachFileDiagnostics(newFile: SourceFile): void { - forEach(fileDiagnostics.get(newFile.fileName), diagnostic => diagnostic.file = newFile); - } - function lookup(diagnostic: Diagnostic): Diagnostic | undefined { let diagnostics: SortedArray | undefined; if (diagnostic.file) { @@ -5693,9 +5710,7 @@ namespace ts { export function createDetachedDiagnostic(fileName: string, start: number, length: number, message: DiagnosticMessage, ...args: (string | number | undefined)[]): DiagnosticWithDetachedLocation; export function createDetachedDiagnostic(fileName: string, start: number, length: number, message: DiagnosticMessage): DiagnosticWithDetachedLocation { - Debug.assertGreaterThanOrEqual(start, 0); - Debug.assertGreaterThanOrEqual(length, 0); - + assertDiagnosticLocation(/*file*/ undefined, start, length); let text = getLocaleSpecificMessage(message); if (arguments.length > 4) { @@ -5763,13 +5778,7 @@ namespace ts { export function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: (string | number | undefined)[]): DiagnosticWithLocation; export function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage): DiagnosticWithLocation { - Debug.assertGreaterThanOrEqual(start, 0); - Debug.assertGreaterThanOrEqual(length, 0); - - if (file) { - Debug.assertLessThanOrEqual(start, file.text.length); - Debug.assertLessThanOrEqual(start + length, file.text.length); - } + assertDiagnosticLocation(file, start, length); let text = getLocaleSpecificMessage(message); @@ -5822,7 +5831,7 @@ namespace ts { }; } - export function createCompilerDiagnosticFromMessageChain(chain: DiagnosticMessageChain): Diagnostic { + export function createCompilerDiagnosticFromMessageChain(chain: DiagnosticMessageChain, relatedInformation?: DiagnosticRelatedInformation[]): Diagnostic { return { file: undefined, start: undefined, @@ -5831,6 +5840,7 @@ namespace ts { code: chain.code, category: chain.category, messageText: chain.next ? chain : chain.messageText, + relatedInformation }; } @@ -6222,6 +6232,11 @@ namespace ts { return !/[.*?]/.test(lastPathComponent); } + export function getPatternFromSpec(spec: string, basePath: string, usage: "files" | "directories" | "exclude") { + const pattern = spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]); + return pattern && `^(${pattern})${usage === "exclude" ? "($|/)" : "$"}`; + } + function getSubPatternFromSpec(spec: string, basePath: string, usage: "files" | "directories" | "exclude", { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter }: WildcardMatcher): string | undefined { let subpattern = ""; let hasWrittenComponent = false; diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index ab7c06ee482df..ea9d20da84ee6 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -113,38 +113,197 @@ namespace ts { return `${newLine}${flattenDiagnosticMessageText(d.messageText, newLine)}${newLine}${newLine}`; } - /** - * Program structure needed to emit the files and report diagnostics - */ - export interface ProgramToEmitFilesAndReportErrors { - getCurrentDirectory(): string; - getCompilerOptions(): CompilerOptions; - getSourceFiles(): readonly SourceFile[]; - getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[]; - getOptionsDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; - getGlobalDiagnostics(cancellationToken?: CancellationToken): readonly Diagnostic[]; - getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[]; - getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[]; - getConfigFileParsingDiagnostics(): readonly Diagnostic[]; - emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult; - emitBuildInfo(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult; - } - - export function listFiles(program: ProgramToEmitFilesAndReportErrors, writeFileName: (s: string) => void) { - if (program.getCompilerOptions().listFiles || program.getCompilerOptions().listFilesOnly) { + export function isBuilderProgram(program: Program | T): program is T { + return !!(program as T).getState; + } + + export function listFiles(program: Program | T, write: (s: string) => void) { + const options = program.getCompilerOptions(); + if (options.explainFiles) { + explainFiles(isBuilderProgram(program) ? program.getProgram() : program, write); + } + else if (options.listFiles || options.listFilesOnly) { forEach(program.getSourceFiles(), file => { - writeFileName(file.fileName); + write(file.fileName); }); } } + export function explainFiles(program: Program, write: (s: string) => void) { + const reasons = program.getFileIncludeReasons(); + const getCanonicalFileName = createGetCanonicalFileName(program.useCaseSensitiveFileNames()); + const relativeFileName = (fileName: string) => convertToRelativePath(fileName, program.getCurrentDirectory(), getCanonicalFileName); + for (const file of program.getSourceFiles()) { + write(`${toFileName(file, relativeFileName)}`); + reasons.get(file.path)?.forEach(reason => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`)); + explainIfFileIsRedirect(file, relativeFileName)?.forEach(d => write(` ${d.messageText}`)); + } + } + + export function explainIfFileIsRedirect(file: SourceFile, fileNameConvertor?: (fileName: string) => string): DiagnosticMessageChain[] | undefined { + let result: DiagnosticMessageChain[] | undefined; + if (file.path !== file.resolvedPath) { + (result ||= []).push(chainDiagnosticMessages( + /*details*/ undefined, + Diagnostics.File_is_output_of_project_reference_source_0, + toFileName(file.originalFileName, fileNameConvertor) + )); + } + if (file.redirectInfo) { + (result ||= []).push(chainDiagnosticMessages( + /*details*/ undefined, + Diagnostics.File_redirects_to_file_0, + toFileName(file.redirectInfo.redirectTarget, fileNameConvertor) + )); + } + return result; + } + + export function getMatchedFileSpec(program: Program, fileName: string) { + const configFile = program.getCompilerOptions().configFile; + if (!configFile?.configFileSpecs?.validatedFilesSpec) return undefined; + + const getCanonicalFileName = createGetCanonicalFileName(program.useCaseSensitiveFileNames()); + const filePath = getCanonicalFileName(fileName); + const basePath = getDirectoryPath(getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory())); + return find(configFile.configFileSpecs.validatedFilesSpec, fileSpec => getCanonicalFileName(getNormalizedAbsolutePath(fileSpec, basePath)) === filePath); + } + + export function getMatchedIncludeSpec(program: Program, fileName: string) { + const configFile = program.getCompilerOptions().configFile; + if (!configFile?.configFileSpecs?.validatedIncludeSpecs) return undefined; + + const isJsonFile = fileExtensionIs(fileName, Extension.Json); + const basePath = getDirectoryPath(getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory())); + const useCaseSensitiveFileNames = program.useCaseSensitiveFileNames(); + return find(configFile?.configFileSpecs?.validatedIncludeSpecs, includeSpec => { + if (isJsonFile && !endsWith(includeSpec, Extension.Json)) return false; + const pattern = getPatternFromSpec(includeSpec, basePath, "files"); + return !!pattern && getRegexFromPattern(`(${pattern})$`, useCaseSensitiveFileNames).test(fileName); + }); + } + + export function fileIncludeReasonToDiagnostics(program: Program, reason: FileIncludeReason, fileNameConvertor?: (fileName: string) => string,): DiagnosticMessageChain { + const options = program.getCompilerOptions(); + if (isReferencedFile(reason)) { + const referenceLocation = getReferencedFileLocation(path => program.getSourceFileByPath(path), reason); + const referenceText = isReferenceFileLocation(referenceLocation) ? referenceLocation.file.text.substring(referenceLocation.pos, referenceLocation.end) : `"${referenceLocation.text}"`; + let message: DiagnosticMessage; + Debug.assert(isReferenceFileLocation(referenceLocation) || reason.kind === FileIncludeKind.Import, "Only synthetic references are imports"); + switch (reason.kind) { + case FileIncludeKind.Import: + if (isReferenceFileLocation(referenceLocation)) { + message = referenceLocation.packageId ? + Diagnostics.Imported_via_0_from_file_1_with_packageId_2 : + Diagnostics.Imported_via_0_from_file_1; + } + else if (referenceLocation.text === externalHelpersModuleNameText) { + message = referenceLocation.packageId ? + Diagnostics.Imported_via_0_from_file_1_with_packageId_2_to_import_importHelpers_as_specified_in_compilerOptions : + Diagnostics.Imported_via_0_from_file_1_to_import_importHelpers_as_specified_in_compilerOptions; + } + else { + message = referenceLocation.packageId ? + Diagnostics.Imported_via_0_from_file_1_with_packageId_2_to_import_jsx_and_jsxs_factory_functions : + Diagnostics.Imported_via_0_from_file_1_to_import_jsx_and_jsxs_factory_functions; + } + break; + case FileIncludeKind.ReferenceFile: + Debug.assert(!referenceLocation.packageId); + message = Diagnostics.Referenced_via_0_from_file_1; + break; + case FileIncludeKind.TypeReferenceDirective: + message = referenceLocation.packageId ? + Diagnostics.Type_library_referenced_via_0_from_file_1_with_packageId_2 : + Diagnostics.Type_library_referenced_via_0_from_file_1; + break; + case FileIncludeKind.LibReferenceDirective: + Debug.assert(!referenceLocation.packageId); + message = Diagnostics.Library_referenced_via_0_from_file_1; + break; + default: + Debug.assertNever(reason); + } + return chainDiagnosticMessages( + /*details*/ undefined, + message, + referenceText, + toFileName(referenceLocation.file, fileNameConvertor), + referenceLocation.packageId && packageIdToString(referenceLocation.packageId) + ); + } + switch (reason.kind) { + case FileIncludeKind.RootFile: + if (!options.configFile?.configFileSpecs) return chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Root_file_specified_for_compilation); + const fileName = getNormalizedAbsolutePath(program.getRootFileNames()[reason.index], program.getCurrentDirectory()); + const matchedByFiles = getMatchedFileSpec(program, fileName); + if (matchedByFiles) return chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Part_of_files_list_in_tsconfig_json); + const matchedByInclude = getMatchedIncludeSpec(program, fileName); + return matchedByInclude ? + chainDiagnosticMessages( + /*details*/ undefined, + Diagnostics.Matched_by_include_pattern_0_in_1, + matchedByInclude, + toFileName(options.configFile, fileNameConvertor) + ) : + // Could be additional files specified as roots + chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Root_file_specified_for_compilation); + case FileIncludeKind.SourceFromProjectReference: + case FileIncludeKind.OutputFromProjectReference: + const isOutput = reason.kind === FileIncludeKind.OutputFromProjectReference; + const referencedResolvedRef = Debug.checkDefined(program.getResolvedProjectReferences()?.[reason.index]); + return chainDiagnosticMessages( + /*details*/ undefined, + outFile(options) ? + isOutput ? + Diagnostics.Output_from_referenced_project_0_included_because_1_specified : + Diagnostics.Source_from_referenced_project_0_included_because_1_specified : + isOutput ? + Diagnostics.Output_from_referenced_project_0_included_because_module_is_specified_as_none : + Diagnostics.Source_from_referenced_project_0_included_because_module_is_specified_as_none, + toFileName(referencedResolvedRef.sourceFile.fileName, fileNameConvertor), + options.outFile ? "--outFile" : "--out", + ); + case FileIncludeKind.AutomaticTypeDirectiveFile: + return chainDiagnosticMessages( + /*details*/ undefined, + options.types ? + reason.packageId ? + Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1 : + Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions : + reason.packageId ? + Diagnostics.Entry_point_for_implicit_type_library_0_with_packageId_1 : + Diagnostics.Entry_point_for_implicit_type_library_0, + reason.typeReference, + reason.packageId && packageIdToString(reason.packageId), + ); + case FileIncludeKind.LibFile: + if (reason.index !== undefined) return chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Library_0_specified_in_compilerOptions, options.lib![reason.index]); + const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === options.target ? key : undefined); + return chainDiagnosticMessages( + /*details*/ undefined, + target ? + Diagnostics.Default_library_for_target_0 : + Diagnostics.Default_library, + target, + ); + default: + Debug.assertNever(reason); + } + } + + function toFileName(file: SourceFile | string, fileNameConvertor?: (fileName: string) => string) { + const fileName = isString(file) ? file : file.fileName; + return fileNameConvertor ? fileNameConvertor(fileName) : fileName; + } + /** * Helper that emit files, report diagnostics and lists emitted and/or source files depending on compiler options */ - export function emitFilesAndReportErrors( - program: ProgramToEmitFilesAndReportErrors, + export function emitFilesAndReportErrors( + program: Program | T, reportDiagnostic: DiagnosticReporter, - writeFileName?: (s: string) => void, + write?: (s: string) => void, reportSummary?: ReportEmitErrorSummary, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, @@ -181,13 +340,13 @@ namespace ts { const diagnostics = sortAndDeduplicateDiagnostics(allDiagnostics); diagnostics.forEach(reportDiagnostic); - if (writeFileName) { + if (write) { const currentDir = program.getCurrentDirectory(); forEach(emittedFiles, file => { const filepath = getNormalizedAbsolutePath(file, currentDir); - writeFileName(`TSFILE: ${filepath}`); + write(`TSFILE: ${filepath}`); }); - listFiles(program, writeFileName); + listFiles(program, write); } if (reportSummary) { @@ -200,10 +359,10 @@ namespace ts { }; } - export function emitFilesAndReportErrorsAndGetExitStatus( - program: ProgramToEmitFilesAndReportErrors, + export function emitFilesAndReportErrorsAndGetExitStatus( + program: Program | T, reportDiagnostic: DiagnosticReporter, - writeFileName?: (s: string) => void, + write?: (s: string) => void, reportSummary?: ReportEmitErrorSummary, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, @@ -213,7 +372,7 @@ namespace ts { const { emitResult, diagnostics } = emitFilesAndReportErrors( program, reportDiagnostic, - writeFileName, + write, reportSummary, writeFile, cancellationToken, @@ -385,7 +544,7 @@ namespace ts { * Creates the watch compiler host that can be extended with config file or root file names and options host */ function createWatchCompilerHost(system = sys, createProgram: CreateProgram | undefined, reportDiagnostic: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): WatchCompilerHost { - const writeFileName = (s: string) => system.write(s + system.newLine); + const write = (s: string) => system.write(s + system.newLine); const result = createProgramHost(system, createProgram) as WatchCompilerHost; copyProperties(result, createWatchHost(system, reportWatchStatus)); result.afterProgramCreate = builderProgram => { @@ -395,7 +554,7 @@ namespace ts { emitFilesAndReportErrors( builderProgram, reportDiagnostic, - writeFileName, + write, errorCount => result.onWatchStatusChange!( createCompilerDiagnostic(getWatchErrorSummaryDiagnosticMessage(errorCount), errorCount), newLine, diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts index 713925308077f..8face54ee3a4b 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -260,7 +260,7 @@ namespace ts { const currentDirectory = host.getCurrentDirectory(); const { configFileName, optionsToExtend: optionsToExtendForConfigFile = {}, watchOptionsToExtend, extraFileExtensions, createProgram } = host; let { rootFiles: rootFileNames, options: compilerOptions, watchOptions, projectReferences } = host; - let configFileSpecs: ConfigFileSpecs; + let wildcardDirectories: MapLike | undefined; let configFileParsingDiagnostics: Diagnostic[] | undefined; let canConfigFileJsonReportNoInputFiles = false; let hasChangedConfigFileParsingErrors = false; @@ -635,11 +635,10 @@ namespace ts { function reloadFileNamesFromConfigFile() { writeLog("Reloading new file names and options"); - const result = getFileNamesFromConfigSpecs(configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions); - if (updateErrorForNoInputFiles(result, getNormalizedAbsolutePath(configFileName, currentDirectory), configFileSpecs, configFileParsingDiagnostics!, canConfigFileJsonReportNoInputFiles)) { + rootFileNames = getFileNamesFromConfigSpecs(compilerOptions.configFile!.configFileSpecs!, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions); + if (updateErrorForNoInputFiles(rootFileNames, getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile!.configFileSpecs!, configFileParsingDiagnostics!, canConfigFileJsonReportNoInputFiles)) { hasChangedConfigFileParsingErrors = true; } - rootFileNames = result.fileNames; // Update the program synchronizeProgram(); @@ -668,8 +667,8 @@ namespace ts { rootFileNames = configFileParseResult.fileNames; compilerOptions = configFileParseResult.options; watchOptions = configFileParseResult.watchOptions; - configFileSpecs = configFileParseResult.configFileSpecs!; // TODO: GH#18217 projectReferences = configFileParseResult.projectReferences; + wildcardDirectories = configFileParseResult.wildcardDirectories; configFileParsingDiagnostics = getConfigFileParsingDiagnostics(configFileParseResult).slice(); canConfigFileJsonReportNoInputFiles = canJsonReportNoInputFiles(configFileParseResult.raw); hasChangedConfigFileParsingErrors = true; @@ -726,10 +725,10 @@ namespace ts { } function watchConfigFileWildCardDirectories() { - if (configFileSpecs) { + if (wildcardDirectories) { updateWatchingWildcardDirectories( watchedWildcardDirectories || (watchedWildcardDirectories = new Map()), - new Map(getEntries(configFileSpecs.wildcardDirectories)), + new Map(getEntries(wildcardDirectories)), watchWildcardDirectory ); } @@ -757,7 +756,6 @@ namespace ts { fileOrDirectory, fileOrDirectoryPath, configFileName, - configFileSpecs, extraFileExtensions, options: compilerOptions, program: getCurrentBuilderProgram(), diff --git a/src/compiler/watchUtilities.ts b/src/compiler/watchUtilities.ts index c088e2876d7fe..861c64c1eb3ec 100644 --- a/src/compiler/watchUtilities.ts +++ b/src/compiler/watchUtilities.ts @@ -336,7 +336,6 @@ namespace ts { fileOrDirectoryPath: Path; configFileName: string; options: CompilerOptions; - configFileSpecs: ConfigFileSpecs; program: BuilderProgram | Program | undefined; extraFileExtensions?: readonly FileExtensionInfo[]; currentDirectory: string; @@ -346,7 +345,7 @@ namespace ts { /* @internal */ export function isIgnoredFileFromWildCardWatching({ watchedDirPath, fileOrDirectory, fileOrDirectoryPath, - configFileName, options, configFileSpecs, program, extraFileExtensions, + configFileName, options, program, extraFileExtensions, currentDirectory, useCaseSensitiveFileNames, writeLog, }: IsIgnoredFileFromWildCardWatchingInput): boolean { @@ -366,7 +365,7 @@ namespace ts { return true; } - if (isExcludedFile(fileOrDirectory, configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), useCaseSensitiveFileNames, currentDirectory)) { + if (isExcludedFile(fileOrDirectory, options.configFile!.configFileSpecs!, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), useCaseSensitiveFileNames, currentDirectory)) { writeLog(`Project: ${configFileName} Detected excluded file: ${fileOrDirectory}`); return true; } diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index 6af8cea9d039b..4b285a749aa74 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -271,6 +271,7 @@ namespace FourSlash { } } + let configParseResult: ts.ParsedCommandLine | undefined; if (configFileName) { const baseDir = ts.normalizePath(ts.getDirectoryPath(configFileName)); const files: vfs.FileSet = { [baseDir]: {} }; @@ -281,7 +282,8 @@ namespace FourSlash { const fs = new vfs.FileSystem(/*ignoreCase*/ true, { cwd: baseDir, files }); const host = new fakes.ParseConfigHost(fs); const jsonSourceFile = ts.parseJsonText(configFileName, this.inputFiles.get(configFileName)!); - compilationOptions = ts.parseJsonSourceFileConfigFileContent(jsonSourceFile, host, baseDir, compilationOptions, configFileName).options; + configParseResult = ts.parseJsonSourceFileConfigFileContent(jsonSourceFile, host, baseDir, compilationOptions, configFileName); + compilationOptions = configParseResult.options; } if (compilationOptions.typeRoots) { @@ -336,7 +338,11 @@ namespace FourSlash { // resolveReference file-option is not specified then do not resolve any files and include all inputFiles this.inputFiles.forEach((file, fileName) => { if (!Harness.isDefaultLibraryFile(fileName)) { - this.languageServiceAdapterHost.addScript(fileName, file, /*isRootFile*/ true); + // all files if config file not specified, otherwise root files from the config and typings cache files are root files + const isRootFile = !configParseResult || + ts.contains(configParseResult.fileNames, fileName) || + (ts.isDeclarationFileName(fileName) && ts.containsPath("/Library/Caches/typescript", fileName)); + this.languageServiceAdapterHost.addScript(fileName, file, isRootFile); } }); diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index a702be25549a1..e01f52c11868d 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -1012,6 +1012,10 @@ interface Array { length: number; [n: number]: T; }` } } + prependFile(path: string, content: string, options?: Partial): void { + this.modifyFile(path, content + this.readFile(path), options); + } + appendFile(path: string, content: string, options?: Partial): void { this.modifyFile(path, this.readFile(path) + content, options); } diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index c46f3374ecc03..368a3c03bce7d 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1279,7 +1279,6 @@ namespace ts.server { fileOrDirectory, fileOrDirectoryPath, configFileName, - configFileSpecs: project.configFileSpecs!, extraFileExtensions: this.hostConfiguration.extraFileExtensions, currentDirectory: this.currentDirectory, options: project.getCompilationSettings(), @@ -2128,7 +2127,6 @@ namespace ts.server { configHasExcludeProperty: parsedCommandLine.raw.exclude !== undefined }; } - project.configFileSpecs = parsedCommandLine.configFileSpecs; project.canConfigFileJsonReportNoInputFiles = canJsonReportNoInputFiles(parsedCommandLine.raw); project.setProjectErrors(configFileErrors); project.updateReferences(parsedCommandLine.projectReferences); @@ -2237,11 +2235,11 @@ namespace ts.server { */ /*@internal*/ reloadFileNamesOfConfiguredProject(project: ConfiguredProject) { - const configFileSpecs = project.configFileSpecs!; // TODO: GH#18217 + const configFileSpecs = project.getCompilerOptions().configFile!.configFileSpecs!; const configFileName = project.getConfigFilePath(); - const fileNamesResult = getFileNamesFromConfigSpecs(configFileSpecs, getDirectoryPath(configFileName), project.getCompilationSettings(), project.getCachedDirectoryStructureHost(), this.hostConfiguration.extraFileExtensions); - project.updateErrorOnNoInputFiles(fileNamesResult); - this.updateNonInferredProjectFiles(project, fileNamesResult.fileNames.concat(project.getExternalFiles()), fileNamePropertyReader); + const fileNames = getFileNamesFromConfigSpecs(configFileSpecs, getDirectoryPath(configFileName), project.getCompilationSettings(), project.getCachedDirectoryStructureHost(), this.hostConfiguration.extraFileExtensions); + project.updateErrorOnNoInputFiles(fileNames); + this.updateNonInferredProjectFiles(project, fileNames.concat(project.getExternalFiles()), fileNamePropertyReader); return project.updateGraph(); } diff --git a/src/server/project.ts b/src/server/project.ts index b067d454f2d77..3f41ef9de5050 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1375,6 +1375,8 @@ namespace ts.server { for (const file of sourceFiles) { strBuilder += `\t${file.fileName}\n`; } + strBuilder += "\n\n"; + explainFiles(this.program, s => strBuilder += `\t${s}\n`); } return strBuilder; } @@ -2066,9 +2068,6 @@ namespace ts.server { /* @internal */ openFileWatchTriggered = new Map(); - /*@internal*/ - configFileSpecs: ConfigFileSpecs | undefined; - /*@internal*/ canConfigFileJsonReportNoInputFiles = false; @@ -2293,7 +2292,7 @@ namespace ts.server { } this.stopWatchingWildCards(); - this.configFileSpecs = undefined; + this.projectErrors = undefined; this.openFileWatchTriggered.clear(); this.compilerHost = undefined; super.close(); @@ -2376,8 +2375,8 @@ namespace ts.server { } /*@internal*/ - updateErrorOnNoInputFiles(fileNameResult: ExpandResult) { - updateErrorForNoInputFiles(fileNameResult, this.getConfigFilePath(), this.configFileSpecs!, this.projectErrors!, this.canConfigFileJsonReportNoInputFiles); + updateErrorOnNoInputFiles(fileNames: string[]) { + updateErrorForNoInputFiles(fileNames, this.getConfigFilePath(), this.getCompilerOptions().configFile!.configFileSpecs!, this.projectErrors!, this.canConfigFileJsonReportNoInputFiles); } } diff --git a/src/testRunner/unittests/moduleResolution.ts b/src/testRunner/unittests/moduleResolution.ts index 746074b3ec93b..e9f44a9e6bb77 100644 --- a/src/testRunner/unittests/moduleResolution.ts +++ b/src/testRunner/unittests/moduleResolution.ts @@ -611,12 +611,22 @@ export = C; "c.ts", `/// `.indexOf(`D.ts`), "D.ts".length, - Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, - "D.ts", - "d.ts", + tscWatch.getDiagnosticMessageChain( + Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, + ["D.ts", "d.ts"], + [ + tscWatch.getDiagnosticMessageChain( + Diagnostics.The_file_is_in_the_program_because_Colon, + emptyArray, + [ + tscWatch.getDiagnosticMessageChain(Diagnostics.Referenced_via_0_from_file_1, ["D.ts", "c.ts"]), + tscWatch.getDiagnosticMessageChain(Diagnostics.Root_file_specified_for_compilation) + ] + ) + ], + ) ), - reportsUnnecessary: undefined, - reportsDeprecated: undefined + relatedInformation: undefined, }] ); }); @@ -638,12 +648,22 @@ export = C; "c.ts", `import {x} from "D"`.indexOf(`"D"`), `"D"`.length, - Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, - "/a/b/D.ts", - "d.ts", + tscWatch.getDiagnosticMessageChain( + Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, + ["/a/b/D.ts", "d.ts"], + [ + tscWatch.getDiagnosticMessageChain( + Diagnostics.The_file_is_in_the_program_because_Colon, + emptyArray, + [ + tscWatch.getDiagnosticMessageChain(Diagnostics.Imported_via_0_from_file_1, [`"D"`, "c.ts"]), + tscWatch.getDiagnosticMessageChain(Diagnostics.Root_file_specified_for_compilation) + ] + ) + ], + ) ), - reportsUnnecessary: undefined, - reportsDeprecated: undefined + relatedInformation: undefined, }] ); }); @@ -665,12 +685,22 @@ export = C; "moduleA.ts", `import {x} from "./ModuleB"`.indexOf(`"./ModuleB"`), `"./ModuleB"`.length, - Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, - "ModuleB.ts", - "moduleB.ts", + tscWatch.getDiagnosticMessageChain( + Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, + ["ModuleB.ts", "moduleB.ts"], + [ + tscWatch.getDiagnosticMessageChain( + Diagnostics.The_file_is_in_the_program_because_Colon, + emptyArray, + [ + tscWatch.getDiagnosticMessageChain(Diagnostics.Imported_via_0_from_file_1, [`"./ModuleB"`, "moduleA.ts"]), + tscWatch.getDiagnosticMessageChain(Diagnostics.Root_file_specified_for_compilation) + ] + ) + ], + ) ), - reportsUnnecessary: undefined, - reportsDeprecated: undefined + relatedInformation: undefined }] ); }); @@ -693,12 +723,22 @@ export = C; "c.ts", `import {x} from "D"`.indexOf(`"D"`), `"D"`.length, - Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, - "/a/b/D.ts", - "d.ts", + tscWatch.getDiagnosticMessageChain( + Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, + ["/a/b/D.ts", "d.ts"], + [ + tscWatch.getDiagnosticMessageChain( + Diagnostics.The_file_is_in_the_program_because_Colon, + emptyArray, + [ + tscWatch.getDiagnosticMessageChain(Diagnostics.Imported_via_0_from_file_1, [`"D"`, "c.ts"]), + tscWatch.getDiagnosticMessageChain(Diagnostics.Root_file_specified_for_compilation) + ] + ) + ], + ) ), - reportsUnnecessary: undefined, - reportsDeprecated: undefined + relatedInformation: undefined }] ); }); @@ -715,34 +755,65 @@ export = C; "", /*useCaseSensitiveFileNames*/ false, ["moduleA.ts", "moduleB.ts", "moduleC.ts"], - program => [ - { + program => { + const importInA = { ...tscWatch.getDiagnosticOfFileFromProgram( program, "moduleA.ts", `import a = require("./ModuleC")`.indexOf(`"./ModuleC"`), `"./ModuleC"`.length, - Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, - "ModuleC.ts", - "moduleC.ts", + Diagnostics.File_is_included_via_import_here, ), reportsUnnecessary: undefined, reportsDeprecated: undefined - }, - { + }; + const importInB = { ...tscWatch.getDiagnosticOfFileFromProgram( program, "moduleB.ts", `import a = require("./moduleC")`.indexOf(`"./moduleC"`), `"./moduleC"`.length, - Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, - "moduleC.ts", - "ModuleC.ts" + Diagnostics.File_is_included_via_import_here, ), reportsUnnecessary: undefined, reportsDeprecated: undefined - } - ] + }; + const importHereInA = tscWatch.getDiagnosticMessageChain(Diagnostics.Imported_via_0_from_file_1, [`"./ModuleC"`, "moduleA.ts"]); + const importHereInB = tscWatch.getDiagnosticMessageChain(Diagnostics.Imported_via_0_from_file_1, [`"./moduleC"`, "moduleB.ts"]); + const details = [tscWatch.getDiagnosticMessageChain( + Diagnostics.The_file_is_in_the_program_because_Colon, + emptyArray, + [importHereInA, importHereInB, tscWatch.getDiagnosticMessageChain(Diagnostics.Root_file_specified_for_compilation)] + )]; + return [ + { + ...tscWatch.getDiagnosticOfFileFrom( + importInA.file, + importInA.start, + importInA.length, + tscWatch.getDiagnosticMessageChain( + Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, + ["ModuleC.ts", "moduleC.ts" ], + details, + ) + ), + relatedInformation: [importInB] + }, + { + ...tscWatch.getDiagnosticOfFileFrom( + importInB.file, + importInB.start, + importInB.length, + tscWatch.getDiagnosticMessageChain( + Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, + ["moduleC.ts", "ModuleC.ts"], + details, + ) + ), + relatedInformation: [importInA] + } + ]; + } ); }); @@ -768,12 +839,34 @@ import b = require("./moduleB"); "moduleB.ts", `import a = require("./moduleC")`.indexOf(`"./moduleC"`), `"./moduleC"`.length, - Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, - "/a/B/c/moduleC.ts", - "/a/B/c/ModuleC.ts" + tscWatch.getDiagnosticMessageChain( + Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, + ["/a/B/c/moduleC.ts", "/a/B/c/ModuleC.ts"], + [ + tscWatch.getDiagnosticMessageChain( + Diagnostics.The_file_is_in_the_program_because_Colon, + emptyArray, + [ + tscWatch.getDiagnosticMessageChain(Diagnostics.Imported_via_0_from_file_1, [`"./ModuleC"`, "/a/B/c/moduleA.ts"]), + tscWatch.getDiagnosticMessageChain(Diagnostics.Imported_via_0_from_file_1, [`"./moduleC"`, "/a/B/c/moduleB.ts"]) + ] + ) + ], + ) ), - reportsUnnecessary: undefined, - reportsDeprecated: undefined + relatedInformation: [ + { + ...tscWatch.getDiagnosticOfFileFromProgram( + program, + "moduleA.ts", + `import a = require("./ModuleC")`.indexOf(`"./ModuleC"`), + `"./ModuleC"`.length, + Diagnostics.File_is_included_via_import_here, + ), + reportsUnnecessary: undefined, + reportsDeprecated: undefined + } + ] }] ); }); @@ -1384,14 +1477,14 @@ import b = require("./moduleB"); }, }; const program1 = createProgram(names, {}, compilerHost); - const diagnostics1 = program1.getFileProcessingDiagnostics().getDiagnostics(); + const diagnostics1 = program1.getOptionsDiagnostics(); assert.equal(diagnostics1.length, 1, "expected one diagnostic"); const program2 = createProgram(names, {}, compilerHost, program1); assert.isTrue(program2.structureIsReused === StructureIsReused.Completely); - const diagnostics2 = program1.getFileProcessingDiagnostics().getDiagnostics(); + const diagnostics2 = program2.getOptionsDiagnostics(); assert.equal(diagnostics2.length, 1, "expected one diagnostic"); - assert.equal(diagnostics1[0].messageText, diagnostics2[0].messageText, "expected one diagnostic"); + assert.deepEqual(diagnostics1[0].messageText, diagnostics2[0].messageText, "expected one diagnostic"); }); it("Modules in the same .d.ts file are preferred to external files", () => { diff --git a/src/testRunner/unittests/programApi.ts b/src/testRunner/unittests/programApi.ts index f78d7e9b39e31..b71d13e54cd7e 100644 --- a/src/testRunner/unittests/programApi.ts +++ b/src/testRunner/unittests/programApi.ts @@ -123,7 +123,7 @@ namespace ts { const program = createProgram(["test.ts"], { module: ModuleKind.ES2015 }, host); assert(program.getSourceFiles().length === 1, "expected 'getSourceFiles' length to be 1"); assert(program.getMissingFilePaths().length === 0, "expected 'getMissingFilePaths' length to be 0"); - assert(program.getFileProcessingDiagnostics().getDiagnostics().length === 0, "expected 'getFileProcessingDiagnostics' length to be 0"); + assert((program.getFileProcessingDiagnostics()?.length || 0) === 0, "expected 'getFileProcessingDiagnostics' length to be 0"); }); }); diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index 1f6685c873e2b..a4eb4feeab945 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -84,6 +84,7 @@ namespace ts { ignoreDtsChanged?: true; ignoreDtsUnchanged?: true; baselineOnly?: true; + additionalCommandLineArgs?: string[]; } function verifyOutFileScenario({ @@ -92,7 +93,8 @@ namespace ts { modifyAgainFs, ignoreDtsChanged, ignoreDtsUnchanged, - baselineOnly + baselineOnly, + additionalCommandLineArgs, }: VerifyOutFileScenarioInput) { const incrementalScenarios: TscIncremental[] = []; if (!ignoreDtsChanged) { @@ -117,7 +119,7 @@ namespace ts { subScenario, fs: () => outFileFs, scenario: "outfile-concat", - commandLineArgs: ["--b", "/src/third", "--verbose"], + commandLineArgs: ["--b", "/src/third", "--verbose", ...(additionalCommandLineArgs || [])], baselineSourceMap: true, modifyFs, baselineReadFileCalls: !baselineOnly, @@ -133,6 +135,12 @@ namespace ts { subScenario: "baseline sectioned sourcemaps", }); + verifyOutFileScenario({ + subScenario: "explainFiles", + additionalCommandLineArgs: ["--explainFiles"], + baselineOnly: true + }); + // Verify baseline with build info + dts unChanged verifyOutFileScenario({ subScenario: "when final project is not composite but uses project references", diff --git a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts index 4b8c999f46cc3..733f61efe3f3f 100644 --- a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts +++ b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts @@ -13,21 +13,21 @@ namespace ts { scenario: "resolveJsonModule", subScenario: "include only", fs: () => projFs, - commandLineArgs: ["--b", "/src/tsconfig_withInclude.json"], + commandLineArgs: ["--b", "/src/tsconfig_withInclude.json", "--v", "--explainFiles"], }); verifyTsc({ scenario: "resolveJsonModule", subScenario: "include of json along with other include", fs: () => projFs, - commandLineArgs: ["--b", "/src/tsconfig_withIncludeOfJson.json"], + commandLineArgs: ["--b", "/src/tsconfig_withIncludeOfJson.json", "--v", "--explainFiles"], }); verifyTsc({ scenario: "resolveJsonModule", subScenario: "include of json along with other include and file name matches ts file", fs: () => projFs, - commandLineArgs: ["--b", "/src/tsconfig_withIncludeOfJson.json"], + commandLineArgs: ["--b", "/src/tsconfig_withIncludeOfJson.json", "--v", "--explainFiles"], modifyFs: fs => { fs.rimrafSync("/src/src/hello.json"); fs.writeFileSync("/src/src/index.json", JSON.stringify({ hello: "world" })); @@ -41,21 +41,21 @@ export default hello.hello`); scenario: "resolveJsonModule", subScenario: "files containing json file", fs: () => projFs, - commandLineArgs: ["--b", "/src/tsconfig_withFiles.json"], + commandLineArgs: ["--b", "/src/tsconfig_withFiles.json", "--v", "--explainFiles"], }); verifyTsc({ scenario: "resolveJsonModule", subScenario: "include and files", fs: () => projFs, - commandLineArgs: ["--b", "/src/tsconfig_withIncludeAndFiles.json"], + commandLineArgs: ["--b", "/src/tsconfig_withIncludeAndFiles.json", "--v", "--explainFiles"], }); verifyTscSerializedIncrementalEdits({ scenario: "resolveJsonModule", subScenario: "sourcemap", fs: () => projFs, - commandLineArgs: ["--b", "src/tsconfig_withFiles.json", "--verbose"], + commandLineArgs: ["--b", "src/tsconfig_withFiles.json", "--verbose", "--explainFiles"], modifyFs: fs => replaceText(fs, "src/tsconfig_withFiles.json", `"composite": true,`, `"composite": true, "sourceMap": true,`), incrementalScenarios: noChangeOnlyRuns }); @@ -75,7 +75,7 @@ export default hello.hello`); scenario: "resolveJsonModule", subScenario: "importing json module from project reference", fs: () => loadProjectFromDisk("tests/projects/importJsonFromProjectReference"), - commandLineArgs: ["--b", "src/tsconfig.json", "--verbose"], + commandLineArgs: ["--b", "src/tsconfig.json", "--verbose", "--explainFiles"], incrementalScenarios: noChangeOnlyRuns }); }); diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 42dc6eaef6d45..d666370d156f6 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -386,6 +386,13 @@ class someClass2 { }`), commandLineArgs: ["--b", "/src/tests", "--listEmittedFiles"], incrementalScenarios: coreChanges }); + verifyTscSerializedIncrementalEdits({ + scenario: "sample1", + subScenario: "explainFiles", + fs: () => projFs, + commandLineArgs: ["--b", "/src/tests", "--explainFiles", "--v"], + incrementalScenarios: coreChanges + }); }); describe("emit output", () => { diff --git a/src/testRunner/unittests/tsc/declarationEmit.ts b/src/testRunner/unittests/tsc/declarationEmit.ts index 5258b0eb01a5b..f345d4a3c8f61 100644 --- a/src/testRunner/unittests/tsc/declarationEmit.ts +++ b/src/testRunner/unittests/tsc/declarationEmit.ts @@ -19,7 +19,7 @@ namespace ts { scenario: "declarationEmit", subScenario, sys: () => tscWatch.createWatchedSystem(files, { currentDirectory: tscWatch.projectRoot }), - commandLineArgs: ["-p", rootProject, "--listFiles"], + commandLineArgs: ["-p", rootProject, "--explainFiles"], changes: emptyArray }); }); @@ -33,7 +33,7 @@ namespace ts { files.map(f => changeCaseFile(f, changeCaseFileTestPath, str => str.replace("myproject", "myProject"))), { currentDirectory: tscWatch.projectRoot } ), - commandLineArgs: ["-p", rootProject, "--listFiles"], + commandLineArgs: ["-p", rootProject, "--explainFiles"], changes: emptyArray }); }); diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts index d2698e0b42b1e..53d0748b09d9d 100644 --- a/src/testRunner/unittests/tsc/helpers.ts +++ b/src/testRunner/unittests/tsc/helpers.ts @@ -37,9 +37,6 @@ namespace ts { getPrograms: () => readonly CommandLineProgram[]; } - function isBuilderProgram(program: Program | T): program is T { - return !!(program as T).getState; - } function isAnyProgram(program: Program | EmitAndSemanticDiagnosticsBuilderProgram | ParsedCommandLine): program is Program | EmitAndSemanticDiagnosticsBuilderProgram { return !!(program as Program | EmitAndSemanticDiagnosticsBuilderProgram).getCompilerOptions; } diff --git a/src/testRunner/unittests/tsc/incremental.ts b/src/testRunner/unittests/tsc/incremental.ts index 36ea38edd0155..bc728cd32aa2d 100644 --- a/src/testRunner/unittests/tsc/incremental.ts +++ b/src/testRunner/unittests/tsc/incremental.ts @@ -16,7 +16,7 @@ namespace ts { ] }`, }), - commandLineArgs: ["--incremental", "--p", "src/project", "--tsBuildInfoFile", "src/project/.tsbuildinfo"], + commandLineArgs: ["--incremental", "--p", "src/project", "--tsBuildInfoFile", "src/project/.tsbuildinfo", "--explainFiles"], incrementalScenarios: noChangeOnlyRuns }); diff --git a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts index 5d0741eba30ce..529c39dce6044 100644 --- a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts @@ -46,5 +46,78 @@ namespace ts.tscWatch { } ] }); + + verifyTscWatch({ + scenario: "forceConsistentCasingInFileNames", + subScenario: "when relative information file location changes", + commandLineArgs: ["--w", "--p", ".", "--explainFiles"], + sys: () => { + const moduleA: File = { + path: `${projectRoot}/moduleA.ts`, + content: `import a = require("./ModuleC")` + }; + const moduleB: File = { + path: `${projectRoot}/moduleB.ts`, + content: `import a = require("./moduleC")` + }; + const moduleC: File = { + path: `${projectRoot}/moduleC.ts`, + content: `export const x = 10;` + }; + const tsconfig: File = { + path: `${projectRoot}/tsconfig.json`, + content: JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: true } }) + }; + return createWatchedSystem([moduleA, moduleB, moduleC, libFile, tsconfig], { currentDirectory: projectRoot }); + }, + changes: [ + { + caption: "Prepend a line to moduleA", + change: sys => sys.prependFile(`${projectRoot}/moduleA.ts`, `// some comment + `), + timeouts: runQueuedTimeoutCallbacks, + } + ], + }); + + verifyTscWatch({ + scenario: "forceConsistentCasingInFileNames", + subScenario: "jsxImportSource option changed", + commandLineArgs: ["--w", "--p", ".", "--explainFiles"], + sys: () => createWatchedSystem([ + libFile, + { + path: `${projectRoot}/node_modules/react/Jsx-runtime/index.d.ts`, + content: `export namespace JSX { + interface Element {} + interface IntrinsicElements { + div: { + propA?: boolean; + }; + } +} +export function jsx(...args: any[]): void; +export function jsxs(...args: any[]): void; +export const Fragment: unique symbol; +`, + }, + { + path: `${projectRoot}/node_modules/react/package.json`, + content: JSON.stringify({ name: "react", version: "0.0.1" }) + }, + { + path: `${projectRoot}/index.tsx`, + content: `export const App = () =>
;` + }, + { + path: `${projectRoot}/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { jsx: "react-jsx", jsxImportSource: "react", forceConsistentCasingInFileNames: true }, + files: ["node_modules/react/Jsx-runtime/index.d.ts", "index.tsx"] + }) + } + ], { currentDirectory: projectRoot }), + changes: emptyArray, + }); }); } diff --git a/src/testRunner/unittests/tscWatch/helpers.ts b/src/testRunner/unittests/tscWatch/helpers.ts index 5201cda4f3779..982475010a2fe 100644 --- a/src/testRunner/unittests/tscWatch/helpers.ts +++ b/src/testRunner/unittests/tscWatch/helpers.ts @@ -216,27 +216,32 @@ namespace ts.tscWatch { ); } + export function getDiagnosticMessageChain(message: DiagnosticMessage, args?: (string | number)[], next?: DiagnosticMessageChain[]): DiagnosticMessageChain { + let text = getLocaleSpecificMessage(message); + if (args?.length) { + text = formatStringFromArgs(text, args); + } + return { + messageText: text, + category: message.category, + code: message.code, + next + }; + } + function isDiagnosticMessageChain(message: DiagnosticMessage | DiagnosticMessageChain): message is DiagnosticMessageChain { return !!(message as DiagnosticMessageChain).messageText; } - export function getDiagnosticOfFileFrom(file: SourceFile | undefined, start: number | undefined, length: number | undefined, message: DiagnosticMessage | DiagnosticMessageChain, ..._args: (string | number)[]): Diagnostic { - let text: DiagnosticMessageChain | string; - if (isDiagnosticMessageChain(message)) { - text = message; - } - else { - text = getLocaleSpecificMessage(message); - if (arguments.length > 4) { - text = formatStringFromArgs(text, arguments, 4); - } - } + export function getDiagnosticOfFileFrom(file: SourceFile | undefined, start: number | undefined, length: number | undefined, message: DiagnosticMessage | DiagnosticMessageChain, ...args: (string | number)[]): Diagnostic { return { file, start, length, - messageText: text, + messageText: isDiagnosticMessageChain(message) ? + message : + getDiagnosticMessageChain(message, args).messageText, category: message.category, code: message.code, }; diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index d9b7d0585d500..d54b7c7f18728 100644 --- a/src/testRunner/unittests/tscWatch/incremental.ts +++ b/src/testRunner/unittests/tscWatch/incremental.ts @@ -277,8 +277,9 @@ export interface A { modifyFs: host => host.deleteFile(`${project}/globals.d.ts`) }); - const jsxImportSourceOptions = { module: "commonjs", jsx: "react-jsx", incremental: true, jsxImportSource: "react" }; - const jsxLibraryContent = `export namespace JSX { + describe("with option jsxImportSource", () => { + const jsxImportSourceOptions = { module: "commonjs", jsx: "react-jsx", incremental: true, jsxImportSource: "react" }; + const jsxLibraryContent = `export namespace JSX { interface Element {} interface IntrinsicElements { div: { @@ -291,64 +292,66 @@ export function jsxs(...args: any[]): void; export const Fragment: unique symbol; `; - verifyIncrementalWatchEmit({ - subScenario: "jsxImportSource option changed", - files: () => [ - { path: libFile.path, content: libContent }, - { path: `${project}/node_modules/react/jsx-runtime/index.d.ts`, content: jsxLibraryContent }, - { path: `${project}/node_modules/react/package.json`, content: JSON.stringify({ name: "react", version: "0.0.1" }) }, - { path: `${project}/node_modules/preact/jsx-runtime/index.d.ts`, content: jsxLibraryContent.replace("propA", "propB") }, - { path: `${project}/node_modules/preact/package.json`, content: JSON.stringify({ name: "preact", version: "0.0.1" }) }, - { path: `${project}/index.tsx`, content: `export const App = () =>
;` }, - { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) } - ], - modifyFs: host => host.writeFile(configFile.path, JSON.stringify({ compilerOptions: { ...jsxImportSourceOptions, jsxImportSource: "preact" } })) - }); + verifyIncrementalWatchEmit({ + subScenario: "jsxImportSource option changed", + files: () => [ + { path: libFile.path, content: libContent }, + { path: `${project}/node_modules/react/jsx-runtime/index.d.ts`, content: jsxLibraryContent }, + { path: `${project}/node_modules/react/package.json`, content: JSON.stringify({ name: "react", version: "0.0.1" }) }, + { path: `${project}/node_modules/preact/jsx-runtime/index.d.ts`, content: jsxLibraryContent.replace("propA", "propB") }, + { path: `${project}/node_modules/preact/package.json`, content: JSON.stringify({ name: "preact", version: "0.0.1" }) }, + { path: `${project}/index.tsx`, content: `export const App = () =>
;` }, + { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) } + ], + modifyFs: host => host.writeFile(configFile.path, JSON.stringify({ compilerOptions: { ...jsxImportSourceOptions, jsxImportSource: "preact" } })), + optionsToExtend: ["--explainFiles"] + }); - verifyIncrementalWatchEmit({ - subScenario: "jsxImportSource backing types added", - files: () => [ - { path: libFile.path, content: libContent }, - { path: `${project}/index.tsx`, content: `export const App = () =>
;` }, - { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) } - ], - modifyFs: host => { - host.createDirectory(`${project}/node_modules`); - host.createDirectory(`${project}/node_modules/react`); - host.createDirectory(`${project}/node_modules/react/jsx-runtime`); - host.writeFile(`${project}/node_modules/react/jsx-runtime/index.d.ts`, jsxLibraryContent); - host.writeFile(`${project}/node_modules/react/package.json`, JSON.stringify({ name: "react", version: "0.0.1" })); - } - }); + verifyIncrementalWatchEmit({ + subScenario: "jsxImportSource backing types added", + files: () => [ + { path: libFile.path, content: libContent }, + { path: `${project}/index.tsx`, content: `export const App = () =>
;` }, + { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) } + ], + modifyFs: host => { + host.createDirectory(`${project}/node_modules`); + host.createDirectory(`${project}/node_modules/react`); + host.createDirectory(`${project}/node_modules/react/jsx-runtime`); + host.writeFile(`${project}/node_modules/react/jsx-runtime/index.d.ts`, jsxLibraryContent); + host.writeFile(`${project}/node_modules/react/package.json`, JSON.stringify({ name: "react", version: "0.0.1" })); + } + }); - verifyIncrementalWatchEmit({ - subScenario: "jsxImportSource backing types removed", - files: () => [ - { path: libFile.path, content: libContent }, - { path: `${project}/node_modules/react/jsx-runtime/index.d.ts`, content: jsxLibraryContent }, - { path: `${project}/node_modules/react/package.json`, content: JSON.stringify({ name: "react", version: "0.0.1" }) }, - { path: `${project}/index.tsx`, content: `export const App = () =>
;` }, - { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) } - ], - modifyFs: host => { - host.deleteFile(`${project}/node_modules/react/jsx-runtime/index.d.ts`); - host.deleteFile(`${project}/node_modules/react/package.json`); - } - }); + verifyIncrementalWatchEmit({ + subScenario: "jsxImportSource backing types removed", + files: () => [ + { path: libFile.path, content: libContent }, + { path: `${project}/node_modules/react/jsx-runtime/index.d.ts`, content: jsxLibraryContent }, + { path: `${project}/node_modules/react/package.json`, content: JSON.stringify({ name: "react", version: "0.0.1" }) }, + { path: `${project}/index.tsx`, content: `export const App = () =>
;` }, + { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) } + ], + modifyFs: host => { + host.deleteFile(`${project}/node_modules/react/jsx-runtime/index.d.ts`); + host.deleteFile(`${project}/node_modules/react/package.json`); + } + }); - verifyIncrementalWatchEmit({ - subScenario: "importHelpers backing types removed", - files: () => [ - { path: libFile.path, content: libContent }, - { path: `${project}/node_modules/tslib/index.d.ts`, content: "export function __assign(...args: any[]): any;" }, - { path: `${project}/node_modules/tslib/package.json`, content: JSON.stringify({ name: "tslib", version: "0.0.1" }) }, - { path: `${project}/index.tsx`, content: `export const x = {...{}};` }, - { path: configFile.path, content: JSON.stringify({ compilerOptions: { importHelpers: true } }) } - ], - modifyFs: host => { - host.deleteFile(`${project}/node_modules/tslib/index.d.ts`); - host.deleteFile(`${project}/node_modules/tslib/package.json`); - } + verifyIncrementalWatchEmit({ + subScenario: "importHelpers backing types removed", + files: () => [ + { path: libFile.path, content: libContent }, + { path: `${project}/node_modules/tslib/index.d.ts`, content: "export function __assign(...args: any[]): any;" }, + { path: `${project}/node_modules/tslib/package.json`, content: JSON.stringify({ name: "tslib", version: "0.0.1" }) }, + { path: `${project}/index.tsx`, content: `export const x = {...{}};` }, + { path: configFile.path, content: JSON.stringify({ compilerOptions: { importHelpers: true } }) } + ], + modifyFs: host => { + host.deleteFile(`${project}/node_modules/tslib/index.d.ts`); + host.deleteFile(`${project}/node_modules/tslib/package.json`); + } + }); }); }); } diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts index 805f9f955b477..63f2cdcd1d8a9 100644 --- a/src/testRunner/unittests/tscWatch/programUpdates.ts +++ b/src/testRunner/unittests/tscWatch/programUpdates.ts @@ -117,7 +117,7 @@ namespace ts.tscWatch { verifyTscWatch({ scenario, subScenario: "handle recreated files correctly", - commandLineArgs: ["-w", "-p", configFilePath], + commandLineArgs: ["-w", "-p", configFilePath, "--explainFiles"], sys: () => { return createWatchedSystem([libFile, commonFile1, commonFile2, configFile]); }, @@ -159,7 +159,7 @@ namespace ts.tscWatch { verifyTscWatch({ scenario, subScenario: "should reflect change in config file", - commandLineArgs: ["-w", "-p", configFilePath], + commandLineArgs: ["-w", "-p", configFilePath, "--explainFiles"], sys: () => { const configFile: File = { path: configFilePath, @@ -373,7 +373,7 @@ export class A { verifyTscWatch({ scenario, subScenario: "changes in files are reflected in project structure", - commandLineArgs: ["-w", "/a/b/f1.ts"], + commandLineArgs: ["-w", "/a/b/f1.ts", "--explainFiles"], sys: () => { const file1 = { path: "/a/b/f1.ts", diff --git a/src/testRunner/unittests/tsserver/configFileSearch.ts b/src/testRunner/unittests/tsserver/configFileSearch.ts index 9da005e19e52e..152184e9ae5d3 100644 --- a/src/testRunner/unittests/tsserver/configFileSearch.ts +++ b/src/testRunner/unittests/tsserver/configFileSearch.ts @@ -72,7 +72,7 @@ namespace ts.projectSystem { content: "{}" }; const host = createServerHost([f1, libFile, configFile, configFile2]); - const service = createProjectService(host, { useSingleInferredProject: true }, { useInferredProjectPerProjectRoot: true }); + const service = createProjectService(host, { useSingleInferredProject: true, useInferredProjectPerProjectRoot: true }); service.openClientFile(f1.path, /*fileContent*/ undefined, /*scriptKind*/ undefined, projectDir); checkNumberOfProjects(service, { configuredProjects: 1 }); assert.isDefined(service.configuredProjects.get(configFile.path)); diff --git a/src/testRunner/unittests/tsserver/dynamicFiles.ts b/src/testRunner/unittests/tsserver/dynamicFiles.ts index 6b551a6453d78..95976bffa1f9f 100644 --- a/src/testRunner/unittests/tsserver/dynamicFiles.ts +++ b/src/testRunner/unittests/tsserver/dynamicFiles.ts @@ -108,7 +108,7 @@ var x = 10;` content: "const y = 10" }; const host = createServerHost([config, file, libFile], { useCaseSensitiveFileNames: true }); - const service = createProjectService(host, /*parameters*/ undefined, { useInferredProjectPerProjectRoot: true }); + const service = createProjectService(host, { useInferredProjectPerProjectRoot: true }); service.openClientFile(untitledFile, "const x = 10;", /*scriptKind*/ undefined, tscWatch.projectRoot); checkNumberOfProjects(service, { inferredProjects: 1 }); checkProjectActualFiles(service.inferredProjects[0], [untitledFile, libFile.path]); diff --git a/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts index 1440b9cd38bdb..6b00ed945bd36 100644 --- a/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts @@ -146,8 +146,17 @@ namespace ts.projectSystem { semantic: [createDiagnostic( location.start, location.end, - Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, - [loggerFile.path.toLowerCase(), loggerFile.path] + { + message: Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, + args: [loggerFile.path.toLowerCase(), loggerFile.path], + next: [{ + message: Diagnostics.The_file_is_in_the_program_because_Colon, + next: [ + { message: Diagnostics.Matched_by_include_pattern_0_in_1, args: ["**/*", tsconfig.path] }, + { message: Diagnostics.Imported_via_0_from_file_1, args: [`"./logger"`, anotherFile.path] } + ] + }] + } )], suggestion: [] }] diff --git a/src/testRunner/unittests/tsserver/helpers.ts b/src/testRunner/unittests/tsserver/helpers.ts index 5ce4ed734fd68..f20efe386c013 100644 --- a/src/testRunner/unittests/tsserver/helpers.ts +++ b/src/testRunner/unittests/tsserver/helpers.ts @@ -383,17 +383,9 @@ namespace ts.projectSystem { } } - export interface CreateProjectServiceParameters { - cancellationToken?: HostCancellationToken; - logger?: server.Logger; - useSingleInferredProject?: boolean; - typingsInstaller?: server.ITypingsInstaller; - eventHandler?: server.ProjectServiceEventHandler; - } - export class TestProjectService extends server.ProjectService { constructor(host: server.ServerHost, logger: server.Logger, cancellationToken: HostCancellationToken, useSingleInferredProject: boolean, - typingsInstaller: server.ITypingsInstaller, eventHandler: server.ProjectServiceEventHandler, opts: Partial = {}) { + typingsInstaller: server.ITypingsInstaller, opts: Partial = {}) { super({ host, logger, @@ -402,7 +394,6 @@ namespace ts.projectSystem { useInferredProjectPerProjectRoot: false, typingsInstaller, typesMapLocation: customTypesMap.path, - eventHandler, ...opts }); } @@ -411,11 +402,12 @@ namespace ts.projectSystem { checkNumberOfProjects(this, count); } } - export function createProjectService(host: server.ServerHost, parameters: CreateProjectServiceParameters = {}, options?: Partial) { - const cancellationToken = parameters.cancellationToken || server.nullCancellationToken; - const logger = parameters.logger || createHasErrorMessageLogger().logger; - const useSingleInferredProject = parameters.useSingleInferredProject !== undefined ? parameters.useSingleInferredProject : false; - return new TestProjectService(host, logger, cancellationToken, useSingleInferredProject, parameters.typingsInstaller!, parameters.eventHandler!, options); // TODO: GH#18217 + + export function createProjectService(host: server.ServerHost, options?: Partial) { + const cancellationToken = options?.cancellationToken || server.nullCancellationToken; + const logger = options?.logger || createHasErrorMessageLogger().logger; + const useSingleInferredProject = options?.useSingleInferredProject !== undefined ? options.useSingleInferredProject : false; + return new TestProjectService(host, logger, cancellationToken, useSingleInferredProject, options?.typingsInstaller || server.nullTypingsInstaller, options); } export function checkNumberOfConfiguredProjects(projectService: server.ProjectService, expected: number) { @@ -700,8 +692,39 @@ namespace ts.projectSystem { checkNthEvent(session, server.toEvent(eventName, diagnostics), 0, isMostRecent); } - export function createDiagnostic(start: protocol.Location, end: protocol.Location, message: DiagnosticMessage, args: readonly string[] = [], category = diagnosticCategoryName(message), reportsUnnecessary?: {}, relatedInformation?: protocol.DiagnosticRelatedInformation[], reportsDeprecated?: {}): protocol.Diagnostic { - return { start, end, text: formatStringFromArgs(message.message, args), code: message.code, category, reportsUnnecessary, reportsDeprecated, relatedInformation, source: undefined }; + interface DiagnosticChainText { + message: DiagnosticMessage; + args?: readonly string[]; + next?: DiagnosticChainText[]; + } + + function isDiagnosticMessage(diagnostic: DiagnosticMessage | DiagnosticChainText): diagnostic is DiagnosticMessage { + return !!diagnostic && isString((diagnostic as DiagnosticMessage).message); + } + function getTextForDiagnostic(diag: DiagnosticMessage | DiagnosticChainText | undefined, args?: readonly string[], indent = 0) { + if (diag === undefined) return ""; + if (isDiagnosticMessage(diag)) return formatStringFromArgs(diag.message, args || emptyArray); + let result = ""; + if (indent) { + result += "\n"; + + for (let i = 0; i < indent; i++) { + result += " "; + } + } + result += formatStringFromArgs(diag.message.message, diag.args || emptyArray); + indent++; + if (diag.next) { + for (const kid of diag.next) { + result += getTextForDiagnostic(kid, /*args*/ undefined, indent); + } + } + return result; + } + + export function createDiagnostic(start: protocol.Location, end: protocol.Location, message: DiagnosticMessage | DiagnosticChainText, args?: readonly string[], category?: string, reportsUnnecessary?: {}, relatedInformation?: protocol.DiagnosticRelatedInformation[], reportsDeprecated?: {}): protocol.Diagnostic { + const diag = isDiagnosticMessage(message) ? message : message.message; + return { start, end, text: getTextForDiagnostic(message, args), code: diag.code, category: category || diagnosticCategoryName(diag), reportsUnnecessary, reportsDeprecated, relatedInformation, source: undefined }; } export function checkCompleteEvent(session: TestSession, numberOfCurrentEvents: number, expectedSequenceId: number, isMostRecent = true): void { diff --git a/src/testRunner/unittests/tsserver/inferredProjects.ts b/src/testRunner/unittests/tsserver/inferredProjects.ts index a75a6d0bc6c35..a4a5cf5898fa3 100644 --- a/src/testRunner/unittests/tsserver/inferredProjects.ts +++ b/src/testRunner/unittests/tsserver/inferredProjects.ts @@ -78,7 +78,7 @@ namespace ts.projectSystem { }; const host = createServerHost([file1]); - const projectService = createProjectService(host, { useSingleInferredProject: true }, { syntaxOnly: true }); + const projectService = createProjectService(host, { useSingleInferredProject: true, syntaxOnly: true }); projectService.openClientFile(file1.path, file1.content); @@ -250,7 +250,7 @@ namespace ts.projectSystem { { path: "/c/file3.ts", content: "let z = 4;" } ]; const host = createServerHost(files, { useCaseSensitiveFileNames }); - const projectService = createProjectService(host, { useSingleInferredProject: true, }, { useInferredProjectPerProjectRoot: true }); + const projectService = createProjectService(host, { useSingleInferredProject: true, useInferredProjectPerProjectRoot: true }); projectService.setCompilerOptionsForInferredProjects({ allowJs: true, target: ScriptTarget.ESNext diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index f4e56ae71b989..65938314f115a 100644 --- a/src/testRunner/unittests/tsserver/projects.ts +++ b/src/testRunner/unittests/tsserver/projects.ts @@ -118,7 +118,7 @@ namespace ts.projectSystem { const projName = "proj1"; const host = createServerHost([file1, file2]); - const projectService = createProjectService(host, { useSingleInferredProject: true }, { eventHandler: noop }); + const projectService = createProjectService(host, { useSingleInferredProject: true, eventHandler: noop }); projectService.openExternalProject({ rootFiles: toExternalFiles([file1.path, file2.path]), options: {}, projectFileName: projName }); const proj1 = projectService.findProject(projName)!; @@ -145,7 +145,7 @@ namespace ts.projectSystem { const externalProjectName = "externalproject"; const host = createServerHost([file1, config1]); - const projectService = createProjectService(host, { useSingleInferredProject: true }, { syntaxOnly: true }); + const projectService = createProjectService(host, { useSingleInferredProject: true, syntaxOnly: true }); projectService.openExternalProject({ rootFiles: toExternalFiles([file1.path, config1.path]), options: {}, @@ -175,7 +175,7 @@ namespace ts.projectSystem { }; const host = createServerHost([file1, config1]); - const projectService = createProjectService(host, { useSingleInferredProject: true }, { syntaxOnly: true }); + const projectService = createProjectService(host, { useSingleInferredProject: true, syntaxOnly: true }); projectService.openClientFile(file1.path, file1.content); checkNumberOfProjects(projectService, { inferredProjects: 1 }); @@ -201,7 +201,7 @@ namespace ts.projectSystem { }; const host = createServerHost([file1, config1]); - const projectService = createProjectService(host, { useSingleInferredProject: true }, { syntaxOnly: true }); + const projectService = createProjectService(host, { useSingleInferredProject: true, syntaxOnly: true }); projectService.applyChangesInOpenFiles(singleIterator({ fileName: file1.path, content: file1.content })); checkNumberOfProjects(projectService, { inferredProjects: 1 }); diff --git a/src/testRunner/unittests/tsserver/reloadProjects.ts b/src/testRunner/unittests/tsserver/reloadProjects.ts index 970a9b2995eba..472d0f18567ac 100644 --- a/src/testRunner/unittests/tsserver/reloadProjects.ts +++ b/src/testRunner/unittests/tsserver/reloadProjects.ts @@ -62,7 +62,7 @@ namespace ts.projectSystem { it("inferred project", () => { const host = createServerHost([libFile, file1, file2]); - const service = createProjectService(host, /*parameters*/ undefined, { useInferredProjectPerProjectRoot: true, }); + const service = createProjectService(host, { useInferredProjectPerProjectRoot: true, }); service.setHostConfiguration({ watchOptions: { excludeFiles: [file2.path] } }); const timeoutId = host.getNextTimeoutId(); service.setCompilerOptionsForInferredProjects({ excludeDirectories: ["node_modules"] }, tscWatch.projectRoot); diff --git a/src/testRunner/unittests/tsserver/watchEnvironment.ts b/src/testRunner/unittests/tsserver/watchEnvironment.ts index 854ac0d375c5e..0a4149a625d0e 100644 --- a/src/testRunner/unittests/tsserver/watchEnvironment.ts +++ b/src/testRunner/unittests/tsserver/watchEnvironment.ts @@ -700,7 +700,7 @@ namespace ts.projectSystem { const { main, bar, foo } = setupFiles(); const files = [libFile, main, bar, foo]; const host = createServerHost(files, { currentDirectory: tscWatch.projectRoot }); - const service = createProjectService(host, {}, { useInferredProjectPerProjectRoot: true }); + const service = createProjectService(host, { useInferredProjectPerProjectRoot: true }); setupConfigureHost(service, configureHost); service.setCompilerOptionsForInferredProjects({ excludeDirectories: ["node_modules"] }, tscWatch.projectRoot); service.openClientFile(main.path, main.content, ScriptKind.TS, tscWatch.projectRoot); @@ -743,7 +743,7 @@ namespace ts.projectSystem { const { main, bar, foo } = setupFiles(); const files = [libFile, main, bar, foo]; const host = createServerHost(files, { currentDirectory: tscWatch.projectRoot }); - const service = createProjectService(host, {}, { useInferredProjectPerProjectRoot: true }); + const service = createProjectService(host, { useInferredProjectPerProjectRoot: true }); service.setCompilerOptionsForInferredProjects({ excludeDirectories: ["**/../*"] }, tscWatch.projectRoot); service.openClientFile(main.path, main.content, ScriptKind.TS, tscWatch.projectRoot); const project = service.inferredProjects[0]; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index ccc5d1fa1fc44..c5cdb37822aea 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2977,10 +2977,6 @@ declare namespace ts { None = 0, Recursive = 1 } - export interface ExpandResult { - fileNames: string[]; - wildcardDirectories: MapLike; - } export interface CreateProgramOptions { rootNames: readonly string[]; options: CompilerOptions; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 440cebf6b0de6..141feee127961 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2977,10 +2977,6 @@ declare namespace ts { None = 0, Recursive = 1 } - export interface ExpandResult { - fileNames: string[]; - wildcardDirectories: MapLike; - } export interface CreateProgramOptions { rootNames: readonly string[]; options: CompilerOptions; diff --git a/tests/baselines/reference/checkJsFiles6.errors.txt b/tests/baselines/reference/checkJsFiles6.errors.txt index 3c8d0f582157b..d0c5d9c933844 100644 --- a/tests/baselines/reference/checkJsFiles6.errors.txt +++ b/tests/baselines/reference/checkJsFiles6.errors.txt @@ -1,8 +1,12 @@ error TS5052: Option 'checkJs' cannot be specified without specifying option 'allowJs'. error TS6504: File 'tests/cases/compiler/a.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? + The file is in the program because: + Root file specified for compilation !!! error TS5052: Option 'checkJs' cannot be specified without specifying option 'allowJs'. !!! error TS6504: File 'tests/cases/compiler/a.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? +!!! error TS6504: The file is in the program because: +!!! error TS6504: Root file specified for compilation ==== tests/cases/compiler/a.js (0 errors) ==== var x; \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationWithMapFileAsJs.errors.txt b/tests/baselines/reference/jsFileCompilationWithMapFileAsJs.errors.txt index 4dced529edf10..1f078b80a0002 100644 --- a/tests/baselines/reference/jsFileCompilationWithMapFileAsJs.errors.txt +++ b/tests/baselines/reference/jsFileCompilationWithMapFileAsJs.errors.txt @@ -1,11 +1,15 @@ error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file. Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. + The file is in the program because: + Root file specified for compilation !!! error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file. !!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. +!!! error TS6054: The file is in the program because: +!!! error TS6054: Root file specified for compilation ==== tests/cases/compiler/a.ts (0 errors) ==== class c { } diff --git a/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithInlineSourceMap.errors.txt b/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithInlineSourceMap.errors.txt index 4dced529edf10..1f078b80a0002 100644 --- a/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithInlineSourceMap.errors.txt +++ b/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithInlineSourceMap.errors.txt @@ -1,11 +1,15 @@ error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file. Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. + The file is in the program because: + Root file specified for compilation !!! error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file. !!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. +!!! error TS6054: The file is in the program because: +!!! error TS6054: Root file specified for compilation ==== tests/cases/compiler/a.ts (0 errors) ==== class c { } diff --git a/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithOutDir.errors.txt b/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithOutDir.errors.txt index 65d6170603b4a..5b421bbfc8642 100644 --- a/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithOutDir.errors.txt +++ b/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithOutDir.errors.txt @@ -1,9 +1,17 @@ error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. + The file is in the program because: + Root file specified for compilation error TS6504: File 'tests/cases/compiler/b.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? + The file is in the program because: + Root file specified for compilation !!! error TS6054: File 'tests/cases/compiler/b.js.map' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. +!!! error TS6054: The file is in the program because: +!!! error TS6054: Root file specified for compilation !!! error TS6504: File 'tests/cases/compiler/b.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? +!!! error TS6504: The file is in the program because: +!!! error TS6504: Root file specified for compilation ==== tests/cases/compiler/a.ts (0 errors) ==== class c { } diff --git a/tests/baselines/reference/jsFileCompilationWithoutJsExtensions.errors.txt b/tests/baselines/reference/jsFileCompilationWithoutJsExtensions.errors.txt index af173329957b4..dc5761873adb0 100644 --- a/tests/baselines/reference/jsFileCompilationWithoutJsExtensions.errors.txt +++ b/tests/baselines/reference/jsFileCompilationWithoutJsExtensions.errors.txt @@ -1,6 +1,10 @@ error TS6504: File 'tests/cases/compiler/a.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? + The file is in the program because: + Root file specified for compilation !!! error TS6504: File 'tests/cases/compiler/a.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? +!!! error TS6504: The file is in the program because: +!!! error TS6504: Root file specified for compilation ==== tests/cases/compiler/a.js (0 errors) ==== declare var v; \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-5.errors.txt b/tests/baselines/reference/library-reference-5.errors.txt index 8aead70ff0b9b..04e4953704ae7 100644 --- a/tests/baselines/reference/library-reference-5.errors.txt +++ b/tests/baselines/reference/library-reference-5.errors.txt @@ -1,4 +1,7 @@ /node_modules/bar/index.d.ts(1,23): error TS4090: Conflicting definitions for 'alpha' found at '/node_modules/bar/node_modules/alpha/index.d.ts' and '/node_modules/foo/node_modules/alpha/index.d.ts'. Consider installing a specific version of this library to resolve the conflict. + The file is in the program because: + Type library referenced via 'alpha' from file '/node_modules/foo/index.d.ts' + Type library referenced via 'alpha' from file '/node_modules/bar/index.d.ts' ==== /src/root.ts (0 errors) ==== @@ -18,6 +21,10 @@ /// ~~~~~ !!! error TS4090: Conflicting definitions for 'alpha' found at '/node_modules/bar/node_modules/alpha/index.d.ts' and '/node_modules/foo/node_modules/alpha/index.d.ts'. Consider installing a specific version of this library to resolve the conflict. +!!! error TS4090: The file is in the program because: +!!! error TS4090: Type library referenced via 'alpha' from file '/node_modules/foo/index.d.ts' +!!! error TS4090: Type library referenced via 'alpha' from file '/node_modules/bar/index.d.ts' +!!! related TS1404 /node_modules/foo/index.d.ts:3:23: File is included via type library reference here. declare var bar: any; ==== /node_modules/bar/node_modules/alpha/index.d.ts (0 errors) ==== diff --git a/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt b/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt index d7128936cb6e0..071a8c6b528bc 100644 --- a/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt +++ b/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt @@ -1,8 +1,20 @@ error TS6053: File 'a.ts' not found. + The file is in the program because: + Root file specified for compilation error TS6054: File 'a.t' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. + The file is in the program because: + Root file specified for compilation error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx', '.d.ts'. + The file is in the program because: + Root file specified for compilation !!! error TS6053: File 'a.ts' not found. +!!! error TS6053: The file is in the program because: +!!! error TS6053: Root file specified for compilation !!! error TS6054: File 'a.t' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. -!!! error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx', '.d.ts'. \ No newline at end of file +!!! error TS6054: The file is in the program because: +!!! error TS6054: Root file specified for compilation +!!! error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx', '.d.ts'. +!!! error TS6231: The file is in the program because: +!!! error TS6231: Root file specified for compilation \ No newline at end of file diff --git a/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt b/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt index d7128936cb6e0..071a8c6b528bc 100644 --- a/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt +++ b/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt @@ -1,8 +1,20 @@ error TS6053: File 'a.ts' not found. + The file is in the program because: + Root file specified for compilation error TS6054: File 'a.t' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. + The file is in the program because: + Root file specified for compilation error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx', '.d.ts'. + The file is in the program because: + Root file specified for compilation !!! error TS6053: File 'a.ts' not found. +!!! error TS6053: The file is in the program because: +!!! error TS6053: Root file specified for compilation !!! error TS6054: File 'a.t' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. -!!! error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx', '.d.ts'. \ No newline at end of file +!!! error TS6054: The file is in the program because: +!!! error TS6054: Root file specified for compilation +!!! error TS6231: Could not resolve the path 'a' with the extensions: '.ts', '.tsx', '.d.ts'. +!!! error TS6231: The file is in the program because: +!!! error TS6231: Root file specified for compilation \ No newline at end of file diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/amd/jsFileCompilationDifferentNamesSpecified.errors.txt b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/amd/jsFileCompilationDifferentNamesSpecified.errors.txt index 41fc714fce61a..51cdc70cb7b8c 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/amd/jsFileCompilationDifferentNamesSpecified.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/amd/jsFileCompilationDifferentNamesSpecified.errors.txt @@ -1,7 +1,12 @@ error TS6504: File 'DifferentNamesSpecified/b.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? + The file is in the program because: + Part of 'files' list in tsconfig.json !!! error TS6504: File 'DifferentNamesSpecified/b.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? +!!! error TS6504: The file is in the program because: +!!! error TS6504: Part of 'files' list in tsconfig.json +!!! related TS1410 DifferentNamesSpecified/tsconfig.json:3:22: File is matched by 'files' list specified here. ==== DifferentNamesSpecified/tsconfig.json (0 errors) ==== { "compilerOptions": { "out": "test.js" }, diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/node/jsFileCompilationDifferentNamesSpecified.errors.txt b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/node/jsFileCompilationDifferentNamesSpecified.errors.txt index 614fa5c1526c1..fda1830d912c6 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/node/jsFileCompilationDifferentNamesSpecified.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/node/jsFileCompilationDifferentNamesSpecified.errors.txt @@ -1,8 +1,13 @@ error TS6504: File 'DifferentNamesSpecified/b.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? + The file is in the program because: + Part of 'files' list in tsconfig.json DifferentNamesSpecified/tsconfig.json(2,24): error TS6082: Only 'amd' and 'system' modules are supported alongside --out. !!! error TS6504: File 'DifferentNamesSpecified/b.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? +!!! error TS6504: The file is in the program because: +!!! error TS6504: Part of 'files' list in tsconfig.json +!!! related TS1410 DifferentNamesSpecified/tsconfig.json:3:22: File is matched by 'files' list specified here. ==== DifferentNamesSpecified/tsconfig.json (1 errors) ==== { "compilerOptions": { "out": "test.js" }, diff --git a/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.errors.txt b/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.errors.txt index f0809b38f27ae..4e3492c206fdb 100644 --- a/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.errors.txt +++ b/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.errors.txt @@ -1,7 +1,11 @@ error TS6059: File 'FolderA/FolderB/fileB.ts' is not under 'rootDir' 'FolderA/FolderB/FolderC'. 'rootDir' is expected to contain all source files. + The file is in the program because: + Root file specified for compilation !!! error TS6059: File 'FolderA/FolderB/fileB.ts' is not under 'rootDir' 'FolderA/FolderB/FolderC'. 'rootDir' is expected to contain all source files. +!!! error TS6059: The file is in the program because: +!!! error TS6059: Root file specified for compilation ==== FolderA/FolderB/FolderC/fileC.ts (0 errors) ==== class C { } diff --git a/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.errors.txt b/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.errors.txt index f0809b38f27ae..4e3492c206fdb 100644 --- a/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.errors.txt +++ b/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.errors.txt @@ -1,7 +1,11 @@ error TS6059: File 'FolderA/FolderB/fileB.ts' is not under 'rootDir' 'FolderA/FolderB/FolderC'. 'rootDir' is expected to contain all source files. + The file is in the program because: + Root file specified for compilation !!! error TS6059: File 'FolderA/FolderB/fileB.ts' is not under 'rootDir' 'FolderA/FolderB/FolderC'. 'rootDir' is expected to contain all source files. +!!! error TS6059: The file is in the program because: +!!! error TS6059: Root file specified for compilation ==== FolderA/FolderB/FolderC/fileC.ts (0 errors) ==== class C { } diff --git a/tests/baselines/reference/showConfig/Shows tsconfig for single option/explainFiles/tsconfig.json b/tests/baselines/reference/showConfig/Shows tsconfig for single option/explainFiles/tsconfig.json new file mode 100644 index 0000000000000..da247f5fac954 --- /dev/null +++ b/tests/baselines/reference/showConfig/Shows tsconfig for single option/explainFiles/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "explainFiles": true + } +} diff --git a/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js b/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js index 1efc8bd513b74..77c6ff28be5fb 100644 --- a/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js +++ b/tests/baselines/reference/tsbuild/demo/initial-build/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js @@ -174,15 +174,31 @@ Output::   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/core/utilities.ts:1:20 - error TS6059: File '/src/animals/index.ts' is not under 'rootDir' '/src/core'. 'rootDir' is expected to contain all source files. + The file is in the program because: + Imported via '../animals' from file '/src/core/utilities.ts' + Imported via '.' from file '/src/animals/dog.ts' 1 import * as A from '../animals';    ~~~~~~~~~~~~ + src/animals/dog.ts:1:20 + 1 import Animal from '.'; +    ~~~ + File is included via import here. + src/core/utilities.ts:1:20 - error TS6307: File '/src/animals/index.ts' is not listed within the file list of project '/src/core/tsconfig.json'. Projects must list all files or use an 'include' pattern. + The file is in the program because: + Imported via '../animals' from file '/src/core/utilities.ts' + Imported via '.' from file '/src/animals/dog.ts' 1 import * as A from '../animals';    ~~~~~~~~~~~~ + src/animals/dog.ts:1:20 + 1 import Animal from '.'; +    ~~~ + File is included via import here. + [12:00:00 AM] Project 'src/animals/tsconfig.json' can't be built because its dependency 'src/core' has errors [12:00:00 AM] Skipping build of project '/src/animals/tsconfig.json' because its dependency '/src/core' has errors diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/explainFiles.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/explainFiles.js new file mode 100644 index 0000000000000..91cbd8412244b --- /dev/null +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-changes/explainFiles.js @@ -0,0 +1,1301 @@ +Input:: +//// [/src/first/first_PART1.ts] +interface TheFirst { + none: any; +} + +const s = "Hola, world"; + +interface NoJsForHereEither { + none: any; +} + +console.log(s); + + + + +Output:: +/lib/tsc --b /src/third --verbose --explainFiles +[12:04:00 AM] Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +[12:04:00 AM] Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +[12:04:00 AM] Building project '/src/first/tsconfig.json'... + +lib/lib.d.ts + Default library for target 'es5' +src/first/first_PART1.ts + Part of 'files' list in tsconfig.json +src/first/first_part2.ts + Part of 'files' list in tsconfig.json +src/first/first_part3.ts + Part of 'files' list in tsconfig.json +[12:04:00 AM] Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +[12:04:00 AM] Project 'src/third/tsconfig.json' is out of date because oldest output 'src/third/thirdjs/output/third-output.js' is older than newest input 'src/first' + +[12:04:00 AM] Building project '/src/third/tsconfig.json'... + +lib/lib.d.ts + Default library for target 'es5' +src/first/bin/first-output.d.ts + Output from referenced project 'src/first/tsconfig.json' included because '--outFile' specified +src/2/second-output.d.ts + Output from referenced project 'src/second/tsconfig.json' included because '--outFile' specified +src/third/third_part1.ts + Part of 'files' list in tsconfig.json +exitCode:: ExitStatus.Success + + +//// [/src/first/bin/first-output.d.ts] +interface TheFirst { + none: any; +} +declare const s = "Hola, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; +//# sourceMappingURL=first-output.d.ts.map + +//// [/src/first/bin/first-output.d.ts.map] +{"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,gBAAgB,CAAC;AAExB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AERD,iBAAS,CAAC,WAET"} + +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] +=================================================================== +JsFile: first-output.d.ts +mapUrl: first-output.d.ts.map +sourceRoot: +sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.d.ts +sourceFile:../first_PART1.ts +------------------------------------------------------------------- +>>>interface TheFirst { +1 > +2 >^^^^^^^^^^ +3 > ^^^^^^^^ +1 > +2 >interface +3 > TheFirst +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) +--- +>>> none: any; +1 >^^^^ +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) +--- +>>>declare const s = "Hola, world"; +1-> +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^ +6 > ^ +1-> + > + > +2 > +3 > const +4 > s +5 > = "Hola, world" +6 > ; +1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) +3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) +4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) +5 >Emitted(4, 32) Source(5, 24) + SourceIndex(0) +6 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) +--- +>>>interface NoJsForHereEither { +1 > +2 >^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^ +1 > + > + > +2 >interface +3 > NoJsForHereEither +1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) +3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) +--- +>>> none: any; +1 >^^^^ +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) +3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) +5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.d.ts +sourceFile:../first_part3.ts +------------------------------------------------------------------- +>>>declare function f(): string; +1-> +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^^^^^^^^^^^^-> +1-> +2 >function +3 > f +4 > () { + > return "JS does hoists"; + > } +1->Emitted(8, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(8, 18) Source(1, 10) + SourceIndex(2) +3 >Emitted(8, 19) Source(1, 11) + SourceIndex(2) +4 >Emitted(8, 30) Source(3, 2) + SourceIndex(2) +--- +>>>//# sourceMappingURL=first-output.d.ts.map + +//// [/src/first/bin/first-output.js] +var s = "Hola, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} +//# sourceMappingURL=first-output.js.map + +//// [/src/first/bin/first-output.js.map] +{"version":3,"file":"first-output.js","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAIA,IAAM,CAAC,GAAG,aAAa,CAAC;AAMxB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACVf,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;ACAjB,SAAS,CAAC;IACN,OAAO,gBAAgB,CAAC;AAC5B,CAAC"} + +//// [/src/first/bin/first-output.js.map.baseline.txt] +=================================================================== +JsFile: first-output.js +mapUrl: first-output.js.map +sourceRoot: +sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_PART1.ts +------------------------------------------------------------------- +>>>var s = "Hola, world"; +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^^^^^^^^^ +6 > ^ +1 >interface TheFirst { + > none: any; + >} + > + > +2 >const +3 > s +4 > = +5 > "Hola, world" +6 > ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) +3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) +4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) +5 >Emitted(1, 22) Source(5, 24) + SourceIndex(0) +6 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) +--- +>>>console.log(s); +1 > +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^^^-> +1 > + > + >interface NoJsForHereEither { + > none: any; + >} + > + > +2 >console +3 > . +4 > log +5 > ( +6 > s +7 > ) +8 > ; +1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) +3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) +4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) +5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) +6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) +7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) +8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_part2.ts +------------------------------------------------------------------- +>>>console.log(f()); +1-> +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^ +9 > ^ +1-> +2 >console +3 > . +4 > log +5 > ( +6 > f +7 > () +8 > ) +9 > ; +1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) +3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) +4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) +5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) +6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) +7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) +8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) +9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_part3.ts +------------------------------------------------------------------- +>>>function f() { +1 > +2 >^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^-> +1 > +2 >function +3 > f +1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) +3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) +--- +>>> return "JS does hoists"; +1->^^^^ +2 > ^^^^^^^ +3 > ^^^^^^^^^^^^^^^^ +4 > ^ +1->() { + > +2 > return +3 > "JS does hoists" +4 > ; +1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) +2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) +3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) +4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) +--- +>>>//# sourceMappingURL=first-output.js.map + +//// [/src/first/bin/first-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "..", + "sourceFiles": [ + "../first_PART1.ts", + "../first_part2.ts", + "../first_part3.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 109, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 156, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/first/bin/first-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/first/bin/first-output.js +---------------------------------------------------------------------- +text: (0-109) +var s = "Hola, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} + +====================================================================== +====================================================================== +File:: /src/first/bin/first-output.d.ts +---------------------------------------------------------------------- +text: (0-156) +interface TheFirst { + none: any; +} +declare const s = "Hola, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +====================================================================== + +//// [/src/third/thirdjs/output/third-output.d.ts] +interface TheFirst { + none: any; +} +declare const s = "Hola, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; +declare namespace N { +} +declare namespace N { +} +declare class C { + doSomething(): void; +} +declare var c: C; +//# sourceMappingURL=third-output.d.ts.map + +//// [/src/third/thirdjs/output/third-output.d.ts.map] +{"version":3,"file":"third-output.d.ts","sourceRoot":"","sources":["../../../first/first_PART1.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts","../../third_part1.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,gBAAgB,CAAC;AAExB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACRD,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;ACVD,cAAM,CAAC;IACH,WAAW;CAGd;ACJD,QAAA,IAAI,CAAC,GAAU,CAAC"} + +//// [/src/third/thirdjs/output/third-output.d.ts.map.baseline.txt] +=================================================================== +JsFile: third-output.d.ts +mapUrl: third-output.d.ts.map +sourceRoot: +sources: ../../../first/first_PART1.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../first/first_PART1.ts +------------------------------------------------------------------- +>>>interface TheFirst { +1 > +2 >^^^^^^^^^^ +3 > ^^^^^^^^ +1 > +2 >interface +3 > TheFirst +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) +--- +>>> none: any; +1 >^^^^ +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) +--- +>>>declare const s = "Hola, world"; +1-> +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^ +6 > ^ +1-> + > + > +2 > +3 > const +4 > s +5 > = "Hola, world" +6 > ; +1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) +3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) +4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) +5 >Emitted(4, 32) Source(5, 24) + SourceIndex(0) +6 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) +--- +>>>interface NoJsForHereEither { +1 > +2 >^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^ +1 > + > + > +2 >interface +3 > NoJsForHereEither +1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) +3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) +--- +>>> none: any; +1 >^^^^ +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) +3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) +5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../first/first_part3.ts +------------------------------------------------------------------- +>>>declare function f(): string; +1-> +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +1-> +2 >function +3 > f +4 > () { + > return "JS does hoists"; + > } +1->Emitted(8, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(8, 18) Source(1, 10) + SourceIndex(1) +3 >Emitted(8, 19) Source(1, 11) + SourceIndex(1) +4 >Emitted(8, 30) Source(3, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../second/second_part1.ts +------------------------------------------------------------------- +>>>declare namespace N { +1 > +2 >^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^ +1 > +2 >namespace +3 > N +4 > +1 >Emitted(9, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(9, 19) Source(1, 11) + SourceIndex(2) +3 >Emitted(9, 20) Source(1, 12) + SourceIndex(2) +4 >Emitted(9, 21) Source(1, 13) + SourceIndex(2) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^-> +1 >{ + > // Comment text + >} +1 >Emitted(10, 2) Source(3, 2) + SourceIndex(2) +--- +>>>declare namespace N { +1-> +2 >^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^ +1-> + > + > +2 >namespace +3 > N +4 > +1->Emitted(11, 1) Source(5, 1) + SourceIndex(2) +2 >Emitted(11, 19) Source(5, 11) + SourceIndex(2) +3 >Emitted(11, 20) Source(5, 12) + SourceIndex(2) +4 >Emitted(11, 21) Source(5, 13) + SourceIndex(2) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^-> +1 >{ + > function f() { + > console.log('testing'); + > } + > + > f(); + >} +1 >Emitted(12, 2) Source(11, 2) + SourceIndex(2) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../second/second_part2.ts +------------------------------------------------------------------- +>>>declare class C { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^-> +1-> +2 >class +3 > C +1->Emitted(13, 1) Source(1, 1) + SourceIndex(3) +2 >Emitted(13, 15) Source(1, 7) + SourceIndex(3) +3 >Emitted(13, 16) Source(1, 8) + SourceIndex(3) +--- +>>> doSomething(): void; +1->^^^^ +2 > ^^^^^^^^^^^ +1-> { + > +2 > doSomething +1->Emitted(14, 5) Source(2, 5) + SourceIndex(3) +2 >Emitted(14, 16) Source(2, 16) + SourceIndex(3) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^-> +1 >() { + > console.log("something got done"); + > } + >} +1 >Emitted(15, 2) Source(5, 2) + SourceIndex(3) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../third_part1.ts +------------------------------------------------------------------- +>>>declare var c: C; +1-> +2 >^^^^^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 > +3 > var +4 > c +5 > = new C() +6 > ; +1->Emitted(16, 1) Source(1, 1) + SourceIndex(4) +2 >Emitted(16, 9) Source(1, 1) + SourceIndex(4) +3 >Emitted(16, 13) Source(1, 5) + SourceIndex(4) +4 >Emitted(16, 14) Source(1, 6) + SourceIndex(4) +5 >Emitted(16, 17) Source(1, 16) + SourceIndex(4) +6 >Emitted(16, 18) Source(1, 17) + SourceIndex(4) +--- +>>>//# sourceMappingURL=third-output.d.ts.map + +//// [/src/third/thirdjs/output/third-output.js] +var s = "Hola, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); +var c = new C(); +c.doSomething(); +//# sourceMappingURL=third-output.js.map + +//// [/src/third/thirdjs/output/third-output.js.map] +{"version":3,"file":"third-output.js","sourceRoot":"","sources":["../../../first/first_PART1.ts","../../../first/first_part2.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts","../../third_part1.ts"],"names":[],"mappings":"AAIA,IAAM,CAAC,GAAG,aAAa,CAAC;AAMxB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACVf,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;ACAjB,SAAS,CAAC;IACN,OAAO,gBAAgB,CAAC;AAC5B,CAAC;ACED,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;IACP,SAAS,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,CAAC,EAAE,CAAC;AACR,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;ACVD;IAAA;IAIA,CAAC;IAHG,uBAAW,GAAX;QACI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC;IACL,QAAC;AAAD,CAAC,AAJD,IAIC;ACJD,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AAChB,CAAC,CAAC,WAAW,EAAE,CAAC"} + +//// [/src/third/thirdjs/output/third-output.js.map.baseline.txt] +=================================================================== +JsFile: third-output.js +mapUrl: third-output.js.map +sourceRoot: +sources: ../../../first/first_PART1.ts,../../../first/first_part2.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../first/first_PART1.ts +------------------------------------------------------------------- +>>>var s = "Hola, world"; +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^^^^^^^^^ +6 > ^ +1 >interface TheFirst { + > none: any; + >} + > + > +2 >const +3 > s +4 > = +5 > "Hola, world" +6 > ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) +3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) +4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) +5 >Emitted(1, 22) Source(5, 24) + SourceIndex(0) +6 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) +--- +>>>console.log(s); +1 > +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^^^-> +1 > + > + >interface NoJsForHereEither { + > none: any; + >} + > + > +2 >console +3 > . +4 > log +5 > ( +6 > s +7 > ) +8 > ; +1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) +3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) +4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) +5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) +6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) +7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) +8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../first/first_part2.ts +------------------------------------------------------------------- +>>>console.log(f()); +1-> +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^ +9 > ^ +1-> +2 >console +3 > . +4 > log +5 > ( +6 > f +7 > () +8 > ) +9 > ; +1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) +3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) +4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) +5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) +6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) +7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) +8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) +9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../first/first_part3.ts +------------------------------------------------------------------- +>>>function f() { +1 > +2 >^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^-> +1 > +2 >function +3 > f +1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) +3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) +--- +>>> return "JS does hoists"; +1->^^^^ +2 > ^^^^^^^ +3 > ^^^^^^^^^^^^^^^^ +4 > ^ +1->() { + > +2 > return +3 > "JS does hoists" +4 > ; +1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) +2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) +3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) +4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../second/second_part1.ts +------------------------------------------------------------------- +>>>var N; +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^-> +1->namespace N { + > // Comment text + >} + > + > +2 >namespace +3 > N +4 > { + > function f() { + > console.log('testing'); + > } + > + > f(); + > } +1->Emitted(7, 1) Source(5, 1) + SourceIndex(3) +2 >Emitted(7, 5) Source(5, 11) + SourceIndex(3) +3 >Emitted(7, 6) Source(5, 12) + SourceIndex(3) +4 >Emitted(7, 7) Source(11, 2) + SourceIndex(3) +--- +>>>(function (N) { +1-> +2 >^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^-> +1-> +2 >namespace +3 > N +1->Emitted(8, 1) Source(5, 1) + SourceIndex(3) +2 >Emitted(8, 12) Source(5, 11) + SourceIndex(3) +3 >Emitted(8, 13) Source(5, 12) + SourceIndex(3) +--- +>>> function f() { +1->^^^^ +2 > ^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^-> +1-> { + > +2 > function +3 > f +1->Emitted(9, 5) Source(6, 5) + SourceIndex(3) +2 >Emitted(9, 14) Source(6, 14) + SourceIndex(3) +3 >Emitted(9, 15) Source(6, 15) + SourceIndex(3) +--- +>>> console.log('testing'); +1->^^^^^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^ +8 > ^ +1->() { + > +2 > console +3 > . +4 > log +5 > ( +6 > 'testing' +7 > ) +8 > ; +1->Emitted(10, 9) Source(7, 9) + SourceIndex(3) +2 >Emitted(10, 16) Source(7, 16) + SourceIndex(3) +3 >Emitted(10, 17) Source(7, 17) + SourceIndex(3) +4 >Emitted(10, 20) Source(7, 20) + SourceIndex(3) +5 >Emitted(10, 21) Source(7, 21) + SourceIndex(3) +6 >Emitted(10, 30) Source(7, 30) + SourceIndex(3) +7 >Emitted(10, 31) Source(7, 31) + SourceIndex(3) +8 >Emitted(10, 32) Source(7, 32) + SourceIndex(3) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^-> +1 > + > +2 > } +1 >Emitted(11, 5) Source(8, 5) + SourceIndex(3) +2 >Emitted(11, 6) Source(8, 6) + SourceIndex(3) +--- +>>> f(); +1->^^^^ +2 > ^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^^-> +1-> + > + > +2 > f +3 > () +4 > ; +1->Emitted(12, 5) Source(10, 5) + SourceIndex(3) +2 >Emitted(12, 6) Source(10, 6) + SourceIndex(3) +3 >Emitted(12, 8) Source(10, 8) + SourceIndex(3) +4 >Emitted(12, 9) Source(10, 9) + SourceIndex(3) +--- +>>>})(N || (N = {})); +1-> +2 >^ +3 > ^^ +4 > ^ +5 > ^^^^^ +6 > ^ +7 > ^^^^^^^^ +8 > ^^^^^-> +1-> + > +2 >} +3 > +4 > N +5 > +6 > N +7 > { + > function f() { + > console.log('testing'); + > } + > + > f(); + > } +1->Emitted(13, 1) Source(11, 1) + SourceIndex(3) +2 >Emitted(13, 2) Source(11, 2) + SourceIndex(3) +3 >Emitted(13, 4) Source(5, 11) + SourceIndex(3) +4 >Emitted(13, 5) Source(5, 12) + SourceIndex(3) +5 >Emitted(13, 10) Source(5, 11) + SourceIndex(3) +6 >Emitted(13, 11) Source(5, 12) + SourceIndex(3) +7 >Emitted(13, 19) Source(11, 2) + SourceIndex(3) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../second/second_part2.ts +------------------------------------------------------------------- +>>>var C = (function () { +1-> +2 >^^^^^^^^^^^^^^^^^^^-> +1-> +1->Emitted(14, 1) Source(1, 1) + SourceIndex(4) +--- +>>> function C() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(15, 5) Source(1, 1) + SourceIndex(4) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->class C { + > doSomething() { + > console.log("something got done"); + > } + > +2 > } +1->Emitted(16, 5) Source(5, 1) + SourceIndex(4) +2 >Emitted(16, 6) Source(5, 2) + SourceIndex(4) +--- +>>> C.prototype.doSomething = function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^^^^^^^^^^-> +1-> +2 > doSomething +3 > +1->Emitted(17, 5) Source(2, 5) + SourceIndex(4) +2 >Emitted(17, 28) Source(2, 16) + SourceIndex(4) +3 >Emitted(17, 31) Source(2, 5) + SourceIndex(4) +--- +>>> console.log("something got done"); +1->^^^^^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1->doSomething() { + > +2 > console +3 > . +4 > log +5 > ( +6 > "something got done" +7 > ) +8 > ; +1->Emitted(18, 9) Source(3, 9) + SourceIndex(4) +2 >Emitted(18, 16) Source(3, 16) + SourceIndex(4) +3 >Emitted(18, 17) Source(3, 17) + SourceIndex(4) +4 >Emitted(18, 20) Source(3, 20) + SourceIndex(4) +5 >Emitted(18, 21) Source(3, 21) + SourceIndex(4) +6 >Emitted(18, 41) Source(3, 41) + SourceIndex(4) +7 >Emitted(18, 42) Source(3, 42) + SourceIndex(4) +8 >Emitted(18, 43) Source(3, 43) + SourceIndex(4) +--- +>>> }; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(19, 5) Source(4, 5) + SourceIndex(4) +2 >Emitted(19, 6) Source(4, 6) + SourceIndex(4) +--- +>>> return C; +1->^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(20, 5) Source(5, 1) + SourceIndex(4) +2 >Emitted(20, 13) Source(5, 2) + SourceIndex(4) +--- +>>>}()); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > doSomething() { + > console.log("something got done"); + > } + > } +1 >Emitted(21, 1) Source(5, 1) + SourceIndex(4) +2 >Emitted(21, 2) Source(5, 2) + SourceIndex(4) +3 >Emitted(21, 2) Source(1, 1) + SourceIndex(4) +4 >Emitted(21, 6) Source(5, 2) + SourceIndex(4) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../third_part1.ts +------------------------------------------------------------------- +>>>var c = new C(); +1-> +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^ +6 > ^ +7 > ^^ +8 > ^ +9 > ^-> +1-> +2 >var +3 > c +4 > = +5 > new +6 > C +7 > () +8 > ; +1->Emitted(22, 1) Source(1, 1) + SourceIndex(5) +2 >Emitted(22, 5) Source(1, 5) + SourceIndex(5) +3 >Emitted(22, 6) Source(1, 6) + SourceIndex(5) +4 >Emitted(22, 9) Source(1, 9) + SourceIndex(5) +5 >Emitted(22, 13) Source(1, 13) + SourceIndex(5) +6 >Emitted(22, 14) Source(1, 14) + SourceIndex(5) +7 >Emitted(22, 16) Source(1, 16) + SourceIndex(5) +8 >Emitted(22, 17) Source(1, 17) + SourceIndex(5) +--- +>>>c.doSomething(); +1-> +2 >^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >c +3 > . +4 > doSomething +5 > () +6 > ; +1->Emitted(23, 1) Source(2, 1) + SourceIndex(5) +2 >Emitted(23, 2) Source(2, 2) + SourceIndex(5) +3 >Emitted(23, 3) Source(2, 3) + SourceIndex(5) +4 >Emitted(23, 14) Source(2, 14) + SourceIndex(5) +5 >Emitted(23, 16) Source(2, 16) + SourceIndex(5) +6 >Emitted(23, 17) Source(2, 17) + SourceIndex(5) +--- +>>>//# sourceMappingURL=third-output.js.map + +//// [/src/third/thirdjs/output/third-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "../..", + "sourceFiles": [ + "../../third_part1.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 109, + "kind": "prepend", + "data": "../../../first/bin/first-output.js", + "texts": [ + { + "pos": 0, + "end": 109, + "kind": "text" + } + ] + }, + { + "pos": 109, + "end": 394, + "kind": "prepend", + "data": "../../../2/second-output.js", + "texts": [ + { + "pos": 109, + "end": 394, + "kind": "text" + } + ] + }, + { + "pos": 394, + "end": 430, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 156, + "kind": "prepend", + "data": "../../../first/bin/first-output.d.ts", + "texts": [ + { + "pos": 0, + "end": 156, + "kind": "text" + } + ] + }, + { + "pos": 156, + "end": 256, + "kind": "prepend", + "data": "../../../2/second-output.d.ts", + "texts": [ + { + "pos": 156, + "end": 256, + "kind": "text" + } + ] + }, + { + "pos": 256, + "end": 275, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/third/thirdjs/output/third-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/third/thirdjs/output/third-output.js +---------------------------------------------------------------------- +prepend: (0-109):: ../../../first/bin/first-output.js texts:: 1 +>>-------------------------------------------------------------------- +text: (0-109) +var s = "Hola, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} + +---------------------------------------------------------------------- +prepend: (109-394):: ../../../2/second-output.js texts:: 1 +>>-------------------------------------------------------------------- +text: (109-394) +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); + +---------------------------------------------------------------------- +text: (394-430) +var c = new C(); +c.doSomething(); + +====================================================================== +====================================================================== +File:: /src/third/thirdjs/output/third-output.d.ts +---------------------------------------------------------------------- +prepend: (0-156):: ../../../first/bin/first-output.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (0-156) +interface TheFirst { + none: any; +} +declare const s = "Hola, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +---------------------------------------------------------------------- +prepend: (156-256):: ../../../2/second-output.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (156-256) +declare namespace N { +} +declare namespace N { +} +declare class C { + doSomething(): void; +} + +---------------------------------------------------------------------- +text: (256-275) +declare var c: C; + +====================================================================== + diff --git a/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/explainFiles.js b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/explainFiles.js new file mode 100644 index 0000000000000..fd6a7d2ee7ae8 --- /dev/null +++ b/tests/baselines/reference/tsbuild/outfile-concat/incremental-declaration-doesnt-change/explainFiles.js @@ -0,0 +1,950 @@ +Input:: +//// [/src/first/first_PART1.ts] +interface TheFirst { + none: any; +} + +const s = "Hello, world"; + +interface NoJsForHereEither { + none: any; +} + +console.log(s); +console.log(s); + + + +Output:: +/lib/tsc --b /src/third --verbose --explainFiles +[12:08:00 AM] Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +[12:08:00 AM] Project 'src/first/tsconfig.json' is out of date because oldest output 'src/first/bin/first-output.js' is older than newest input 'src/first/first_PART1.ts' + +[12:08:00 AM] Building project '/src/first/tsconfig.json'... + +lib/lib.d.ts + Default library for target 'es5' +src/first/first_PART1.ts + Part of 'files' list in tsconfig.json +src/first/first_part2.ts + Part of 'files' list in tsconfig.json +src/first/first_part3.ts + Part of 'files' list in tsconfig.json +[12:08:00 AM] Project 'src/second/tsconfig.json' is up to date because newest input 'src/second/second_part1.ts' is older than oldest output 'src/2/second-output.js' + +[12:08:00 AM] Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed + +[12:08:00 AM] Updating output of project '/src/third/tsconfig.json'... + +[12:08:00 AM] Updating unchanged output timestamps of project '/src/third/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/first/bin/first-output.d.ts] file written with same contents +//// [/src/first/bin/first-output.d.ts.map] file written with same contents +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] file written with same contents +//// [/src/first/bin/first-output.js] +var s = "Hello, world"; +console.log(s); +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} +//# sourceMappingURL=first-output.js.map + +//// [/src/first/bin/first-output.js.map] +{"version":3,"file":"first-output.js","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAIA,IAAM,CAAC,GAAG,cAAc,CAAC;AAMzB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACf,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACXf,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;ACAjB,SAAS,CAAC;IACN,OAAO,gBAAgB,CAAC;AAC5B,CAAC"} + +//// [/src/first/bin/first-output.js.map.baseline.txt] +=================================================================== +JsFile: first-output.js +mapUrl: first-output.js.map +sourceRoot: +sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_PART1.ts +------------------------------------------------------------------- +>>>var s = "Hello, world"; +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^^^^^^^^^^ +6 > ^ +1 >interface TheFirst { + > none: any; + >} + > + > +2 >const +3 > s +4 > = +5 > "Hello, world" +6 > ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) +3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) +4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) +5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) +6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) +--- +>>>console.log(s); +1 > +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^-> +1 > + > + >interface NoJsForHereEither { + > none: any; + >} + > + > +2 >console +3 > . +4 > log +5 > ( +6 > s +7 > ) +8 > ; +1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) +3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) +4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) +5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) +6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) +7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) +8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) +--- +>>>console.log(s); +1-> +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^^^-> +1-> + > +2 >console +3 > . +4 > log +5 > ( +6 > s +7 > ) +8 > ; +1->Emitted(3, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(3, 8) Source(12, 8) + SourceIndex(0) +3 >Emitted(3, 9) Source(12, 9) + SourceIndex(0) +4 >Emitted(3, 12) Source(12, 12) + SourceIndex(0) +5 >Emitted(3, 13) Source(12, 13) + SourceIndex(0) +6 >Emitted(3, 14) Source(12, 14) + SourceIndex(0) +7 >Emitted(3, 15) Source(12, 15) + SourceIndex(0) +8 >Emitted(3, 16) Source(12, 16) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_part2.ts +------------------------------------------------------------------- +>>>console.log(f()); +1-> +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^ +9 > ^ +1-> +2 >console +3 > . +4 > log +5 > ( +6 > f +7 > () +8 > ) +9 > ; +1->Emitted(4, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(4, 8) Source(1, 8) + SourceIndex(1) +3 >Emitted(4, 9) Source(1, 9) + SourceIndex(1) +4 >Emitted(4, 12) Source(1, 12) + SourceIndex(1) +5 >Emitted(4, 13) Source(1, 13) + SourceIndex(1) +6 >Emitted(4, 14) Source(1, 14) + SourceIndex(1) +7 >Emitted(4, 16) Source(1, 16) + SourceIndex(1) +8 >Emitted(4, 17) Source(1, 17) + SourceIndex(1) +9 >Emitted(4, 18) Source(1, 18) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_part3.ts +------------------------------------------------------------------- +>>>function f() { +1 > +2 >^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^-> +1 > +2 >function +3 > f +1 >Emitted(5, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(5, 10) Source(1, 10) + SourceIndex(2) +3 >Emitted(5, 11) Source(1, 11) + SourceIndex(2) +--- +>>> return "JS does hoists"; +1->^^^^ +2 > ^^^^^^^ +3 > ^^^^^^^^^^^^^^^^ +4 > ^ +1->() { + > +2 > return +3 > "JS does hoists" +4 > ; +1->Emitted(6, 5) Source(2, 5) + SourceIndex(2) +2 >Emitted(6, 12) Source(2, 12) + SourceIndex(2) +3 >Emitted(6, 28) Source(2, 28) + SourceIndex(2) +4 >Emitted(6, 29) Source(2, 29) + SourceIndex(2) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(7, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(7, 2) Source(3, 2) + SourceIndex(2) +--- +>>>//# sourceMappingURL=first-output.js.map + +//// [/src/first/bin/first-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "..", + "sourceFiles": [ + "../first_PART1.ts", + "../first_part2.ts", + "../first_part3.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 127, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/first/bin/first-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/first/bin/first-output.js +---------------------------------------------------------------------- +text: (0-127) +var s = "Hello, world"; +console.log(s); +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} + +====================================================================== +====================================================================== +File:: /src/first/bin/first-output.d.ts +---------------------------------------------------------------------- +text: (0-157) +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +====================================================================== + +//// [/src/third/thirdjs/output/third-output.js] +var s = "Hello, world"; +console.log(s); +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); +var c = new C(); +c.doSomething(); +//# sourceMappingURL=third-output.js.map + +//// [/src/third/thirdjs/output/third-output.js.map] +{"version":3,"file":"third-output.js","sourceRoot":"","sources":["../../../first/first_PART1.ts","../../../first/first_part2.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts","../../third_part1.ts"],"names":[],"mappings":"AAIA,IAAM,CAAC,GAAG,cAAc,CAAC;AAMzB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACf,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACXf,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;ACAjB,SAAS,CAAC;IACN,OAAO,gBAAgB,CAAC;AAC5B,CAAC;ACED,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;IACP,SAAS,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,CAAC,EAAE,CAAC;AACR,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;ACVD;IAAA;IAIA,CAAC;IAHG,uBAAW,GAAX;QACI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC;IACL,QAAC;AAAD,CAAC,AAJD,IAIC;ACJD,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AAChB,CAAC,CAAC,WAAW,EAAE,CAAC"} + +//// [/src/third/thirdjs/output/third-output.js.map.baseline.txt] +=================================================================== +JsFile: third-output.js +mapUrl: third-output.js.map +sourceRoot: +sources: ../../../first/first_PART1.ts,../../../first/first_part2.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../first/first_PART1.ts +------------------------------------------------------------------- +>>>var s = "Hello, world"; +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^^^^^^^^^^ +6 > ^ +1 >interface TheFirst { + > none: any; + >} + > + > +2 >const +3 > s +4 > = +5 > "Hello, world" +6 > ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) +3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) +4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) +5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) +6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) +--- +>>>console.log(s); +1 > +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^-> +1 > + > + >interface NoJsForHereEither { + > none: any; + >} + > + > +2 >console +3 > . +4 > log +5 > ( +6 > s +7 > ) +8 > ; +1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) +3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) +4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) +5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) +6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) +7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) +8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) +--- +>>>console.log(s); +1-> +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^^^-> +1-> + > +2 >console +3 > . +4 > log +5 > ( +6 > s +7 > ) +8 > ; +1->Emitted(3, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(3, 8) Source(12, 8) + SourceIndex(0) +3 >Emitted(3, 9) Source(12, 9) + SourceIndex(0) +4 >Emitted(3, 12) Source(12, 12) + SourceIndex(0) +5 >Emitted(3, 13) Source(12, 13) + SourceIndex(0) +6 >Emitted(3, 14) Source(12, 14) + SourceIndex(0) +7 >Emitted(3, 15) Source(12, 15) + SourceIndex(0) +8 >Emitted(3, 16) Source(12, 16) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../first/first_part2.ts +------------------------------------------------------------------- +>>>console.log(f()); +1-> +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^ +9 > ^ +1-> +2 >console +3 > . +4 > log +5 > ( +6 > f +7 > () +8 > ) +9 > ; +1->Emitted(4, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(4, 8) Source(1, 8) + SourceIndex(1) +3 >Emitted(4, 9) Source(1, 9) + SourceIndex(1) +4 >Emitted(4, 12) Source(1, 12) + SourceIndex(1) +5 >Emitted(4, 13) Source(1, 13) + SourceIndex(1) +6 >Emitted(4, 14) Source(1, 14) + SourceIndex(1) +7 >Emitted(4, 16) Source(1, 16) + SourceIndex(1) +8 >Emitted(4, 17) Source(1, 17) + SourceIndex(1) +9 >Emitted(4, 18) Source(1, 18) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../first/first_part3.ts +------------------------------------------------------------------- +>>>function f() { +1 > +2 >^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^-> +1 > +2 >function +3 > f +1 >Emitted(5, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(5, 10) Source(1, 10) + SourceIndex(2) +3 >Emitted(5, 11) Source(1, 11) + SourceIndex(2) +--- +>>> return "JS does hoists"; +1->^^^^ +2 > ^^^^^^^ +3 > ^^^^^^^^^^^^^^^^ +4 > ^ +1->() { + > +2 > return +3 > "JS does hoists" +4 > ; +1->Emitted(6, 5) Source(2, 5) + SourceIndex(2) +2 >Emitted(6, 12) Source(2, 12) + SourceIndex(2) +3 >Emitted(6, 28) Source(2, 28) + SourceIndex(2) +4 >Emitted(6, 29) Source(2, 29) + SourceIndex(2) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^-> +1 > + > +2 >} +1 >Emitted(7, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(7, 2) Source(3, 2) + SourceIndex(2) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../second/second_part1.ts +------------------------------------------------------------------- +>>>var N; +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^-> +1->namespace N { + > // Comment text + >} + > + > +2 >namespace +3 > N +4 > { + > function f() { + > console.log('testing'); + > } + > + > f(); + > } +1->Emitted(8, 1) Source(5, 1) + SourceIndex(3) +2 >Emitted(8, 5) Source(5, 11) + SourceIndex(3) +3 >Emitted(8, 6) Source(5, 12) + SourceIndex(3) +4 >Emitted(8, 7) Source(11, 2) + SourceIndex(3) +--- +>>>(function (N) { +1-> +2 >^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^-> +1-> +2 >namespace +3 > N +1->Emitted(9, 1) Source(5, 1) + SourceIndex(3) +2 >Emitted(9, 12) Source(5, 11) + SourceIndex(3) +3 >Emitted(9, 13) Source(5, 12) + SourceIndex(3) +--- +>>> function f() { +1->^^^^ +2 > ^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^-> +1-> { + > +2 > function +3 > f +1->Emitted(10, 5) Source(6, 5) + SourceIndex(3) +2 >Emitted(10, 14) Source(6, 14) + SourceIndex(3) +3 >Emitted(10, 15) Source(6, 15) + SourceIndex(3) +--- +>>> console.log('testing'); +1->^^^^^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^ +8 > ^ +1->() { + > +2 > console +3 > . +4 > log +5 > ( +6 > 'testing' +7 > ) +8 > ; +1->Emitted(11, 9) Source(7, 9) + SourceIndex(3) +2 >Emitted(11, 16) Source(7, 16) + SourceIndex(3) +3 >Emitted(11, 17) Source(7, 17) + SourceIndex(3) +4 >Emitted(11, 20) Source(7, 20) + SourceIndex(3) +5 >Emitted(11, 21) Source(7, 21) + SourceIndex(3) +6 >Emitted(11, 30) Source(7, 30) + SourceIndex(3) +7 >Emitted(11, 31) Source(7, 31) + SourceIndex(3) +8 >Emitted(11, 32) Source(7, 32) + SourceIndex(3) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^-> +1 > + > +2 > } +1 >Emitted(12, 5) Source(8, 5) + SourceIndex(3) +2 >Emitted(12, 6) Source(8, 6) + SourceIndex(3) +--- +>>> f(); +1->^^^^ +2 > ^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^^-> +1-> + > + > +2 > f +3 > () +4 > ; +1->Emitted(13, 5) Source(10, 5) + SourceIndex(3) +2 >Emitted(13, 6) Source(10, 6) + SourceIndex(3) +3 >Emitted(13, 8) Source(10, 8) + SourceIndex(3) +4 >Emitted(13, 9) Source(10, 9) + SourceIndex(3) +--- +>>>})(N || (N = {})); +1-> +2 >^ +3 > ^^ +4 > ^ +5 > ^^^^^ +6 > ^ +7 > ^^^^^^^^ +8 > ^^^^^-> +1-> + > +2 >} +3 > +4 > N +5 > +6 > N +7 > { + > function f() { + > console.log('testing'); + > } + > + > f(); + > } +1->Emitted(14, 1) Source(11, 1) + SourceIndex(3) +2 >Emitted(14, 2) Source(11, 2) + SourceIndex(3) +3 >Emitted(14, 4) Source(5, 11) + SourceIndex(3) +4 >Emitted(14, 5) Source(5, 12) + SourceIndex(3) +5 >Emitted(14, 10) Source(5, 11) + SourceIndex(3) +6 >Emitted(14, 11) Source(5, 12) + SourceIndex(3) +7 >Emitted(14, 19) Source(11, 2) + SourceIndex(3) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../second/second_part2.ts +------------------------------------------------------------------- +>>>var C = (function () { +1-> +2 >^^^^^^^^^^^^^^^^^^^-> +1-> +1->Emitted(15, 1) Source(1, 1) + SourceIndex(4) +--- +>>> function C() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(16, 5) Source(1, 1) + SourceIndex(4) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->class C { + > doSomething() { + > console.log("something got done"); + > } + > +2 > } +1->Emitted(17, 5) Source(5, 1) + SourceIndex(4) +2 >Emitted(17, 6) Source(5, 2) + SourceIndex(4) +--- +>>> C.prototype.doSomething = function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^^^^^^^^^^-> +1-> +2 > doSomething +3 > +1->Emitted(18, 5) Source(2, 5) + SourceIndex(4) +2 >Emitted(18, 28) Source(2, 16) + SourceIndex(4) +3 >Emitted(18, 31) Source(2, 5) + SourceIndex(4) +--- +>>> console.log("something got done"); +1->^^^^^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1->doSomething() { + > +2 > console +3 > . +4 > log +5 > ( +6 > "something got done" +7 > ) +8 > ; +1->Emitted(19, 9) Source(3, 9) + SourceIndex(4) +2 >Emitted(19, 16) Source(3, 16) + SourceIndex(4) +3 >Emitted(19, 17) Source(3, 17) + SourceIndex(4) +4 >Emitted(19, 20) Source(3, 20) + SourceIndex(4) +5 >Emitted(19, 21) Source(3, 21) + SourceIndex(4) +6 >Emitted(19, 41) Source(3, 41) + SourceIndex(4) +7 >Emitted(19, 42) Source(3, 42) + SourceIndex(4) +8 >Emitted(19, 43) Source(3, 43) + SourceIndex(4) +--- +>>> }; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(20, 5) Source(4, 5) + SourceIndex(4) +2 >Emitted(20, 6) Source(4, 6) + SourceIndex(4) +--- +>>> return C; +1->^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(21, 5) Source(5, 1) + SourceIndex(4) +2 >Emitted(21, 13) Source(5, 2) + SourceIndex(4) +--- +>>>}()); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > doSomething() { + > console.log("something got done"); + > } + > } +1 >Emitted(22, 1) Source(5, 1) + SourceIndex(4) +2 >Emitted(22, 2) Source(5, 2) + SourceIndex(4) +3 >Emitted(22, 2) Source(1, 1) + SourceIndex(4) +4 >Emitted(22, 6) Source(5, 2) + SourceIndex(4) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../third_part1.ts +------------------------------------------------------------------- +>>>var c = new C(); +1-> +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^ +6 > ^ +7 > ^^ +8 > ^ +9 > ^-> +1-> +2 >var +3 > c +4 > = +5 > new +6 > C +7 > () +8 > ; +1->Emitted(23, 1) Source(1, 1) + SourceIndex(5) +2 >Emitted(23, 5) Source(1, 5) + SourceIndex(5) +3 >Emitted(23, 6) Source(1, 6) + SourceIndex(5) +4 >Emitted(23, 9) Source(1, 9) + SourceIndex(5) +5 >Emitted(23, 13) Source(1, 13) + SourceIndex(5) +6 >Emitted(23, 14) Source(1, 14) + SourceIndex(5) +7 >Emitted(23, 16) Source(1, 16) + SourceIndex(5) +8 >Emitted(23, 17) Source(1, 17) + SourceIndex(5) +--- +>>>c.doSomething(); +1-> +2 >^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >c +3 > . +4 > doSomething +5 > () +6 > ; +1->Emitted(24, 1) Source(2, 1) + SourceIndex(5) +2 >Emitted(24, 2) Source(2, 2) + SourceIndex(5) +3 >Emitted(24, 3) Source(2, 3) + SourceIndex(5) +4 >Emitted(24, 14) Source(2, 14) + SourceIndex(5) +5 >Emitted(24, 16) Source(2, 16) + SourceIndex(5) +6 >Emitted(24, 17) Source(2, 17) + SourceIndex(5) +--- +>>>//# sourceMappingURL=third-output.js.map + +//// [/src/third/thirdjs/output/third-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "../..", + "sourceFiles": [ + "../../third_part1.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 127, + "kind": "prepend", + "data": "../../../first/bin/first-output.js", + "texts": [ + { + "pos": 0, + "end": 127, + "kind": "text" + } + ] + }, + { + "pos": 127, + "end": 412, + "kind": "prepend", + "data": "../../../2/second-output.js", + "texts": [ + { + "pos": 127, + "end": 412, + "kind": "text" + } + ] + }, + { + "pos": 412, + "end": 448, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "prepend", + "data": "../../../first/bin/first-output.d.ts", + "texts": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + }, + { + "pos": 157, + "end": 257, + "kind": "prepend", + "data": "../../../2/second-output.d.ts", + "texts": [ + { + "pos": 157, + "end": 257, + "kind": "text" + } + ] + }, + { + "pos": 257, + "end": 276, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/third/thirdjs/output/third-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/third/thirdjs/output/third-output.js +---------------------------------------------------------------------- +prepend: (0-127):: ../../../first/bin/first-output.js texts:: 1 +>>-------------------------------------------------------------------- +text: (0-127) +var s = "Hello, world"; +console.log(s); +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} + +---------------------------------------------------------------------- +prepend: (127-412):: ../../../2/second-output.js texts:: 1 +>>-------------------------------------------------------------------- +text: (127-412) +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); + +---------------------------------------------------------------------- +text: (412-448) +var c = new C(); +c.doSomething(); + +====================================================================== +====================================================================== +File:: /src/third/thirdjs/output/third-output.d.ts +---------------------------------------------------------------------- +prepend: (0-157):: ../../../first/bin/first-output.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (0-157) +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +---------------------------------------------------------------------- +prepend: (157-257):: ../../../2/second-output.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (157-257) +declare namespace N { +} +declare namespace N { +} +declare class C { + doSomething(): void; +} + +---------------------------------------------------------------------- +text: (257-276) +declare var c: C; + +====================================================================== + diff --git a/tests/baselines/reference/tsbuild/outfile-concat/initial-build/explainFiles.js b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/explainFiles.js new file mode 100644 index 0000000000000..e73d56a0a44f7 --- /dev/null +++ b/tests/baselines/reference/tsbuild/outfile-concat/initial-build/explainFiles.js @@ -0,0 +1,1877 @@ +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/first/first_PART1.ts] +interface TheFirst { + none: any; +} + +const s = "Hello, world"; + +interface NoJsForHereEither { + none: any; +} + +console.log(s); + + +//// [/src/first/first_part2.ts] +console.log(f()); + + +//// [/src/first/first_part3.ts] +function f() { + return "JS does hoists"; +} + +//// [/src/first/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "outFile": "./bin/first-output.js", + "skipDefaultLibCheck": true, + "bundledPackageName": "first", + }, + "files": [ + "first_PART1.ts", + "first_part2.ts", + "first_part3.ts" + ], + "references": [ + ] +} + + +//// [/src/second/second_part1.ts] +namespace N { + // Comment text +} + +namespace N { + function f() { + console.log('testing'); + } + + f(); +} + + +//// [/src/second/second_part2.ts] +class C { + doSomething() { + console.log("something got done"); + } +} + + +//// [/src/second/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "declaration": true, + "bundledPackageName": "second", + "outFile": "../2/second-output.js", + "skipDefaultLibCheck": true + }, + "references": [ + ] +} + + +//// [/src/third/third_part1.ts] +var c = new C(); +c.doSomething(); + + +//// [/src/third/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "composite": true, + "removeComments": true, + "strict": false, + "sourceMap": true, + "declarationMap": true, + "declaration": true, + "outFile": "./thirdjs/output/third-output.js", + "skipDefaultLibCheck": true, + "bundledPackageName": "third", + }, + "files": [ + "third_part1.ts" + ], + "references": [ + { "path": "../first", "prepend": true }, + { "path": "../second", "prepend": true }, + ] +} + + + + +Output:: +/lib/tsc --b /src/third --verbose --explainFiles +[12:01:00 AM] Projects in this build: + * src/first/tsconfig.json + * src/second/tsconfig.json + * src/third/tsconfig.json + +[12:01:00 AM] Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist + +[12:01:00 AM] Building project '/src/first/tsconfig.json'... + +lib/lib.d.ts + Default library for target 'es5' +src/first/first_PART1.ts + Part of 'files' list in tsconfig.json +src/first/first_part2.ts + Part of 'files' list in tsconfig.json +src/first/first_part3.ts + Part of 'files' list in tsconfig.json +[12:01:00 AM] Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist + +[12:01:00 AM] Building project '/src/second/tsconfig.json'... + +lib/lib.d.ts + Default library for target 'es5' +src/second/second_part1.ts + Matched by include pattern '**/*' in 'src/second/tsconfig.json' +src/second/second_part2.ts + Matched by include pattern '**/*' in 'src/second/tsconfig.json' +[12:01:00 AM] Project 'src/third/tsconfig.json' is out of date because output file 'src/third/thirdjs/output/third-output.js' does not exist + +[12:01:00 AM] Building project '/src/third/tsconfig.json'... + +lib/lib.d.ts + Default library for target 'es5' +src/first/bin/first-output.d.ts + Output from referenced project 'src/first/tsconfig.json' included because '--outFile' specified +src/2/second-output.d.ts + Output from referenced project 'src/second/tsconfig.json' included because '--outFile' specified +src/third/third_part1.ts + Part of 'files' list in tsconfig.json +exitCode:: ExitStatus.Success + + +//// [/src/2/second-output.d.ts] +declare namespace N { +} +declare namespace N { +} +declare class C { + doSomething(): void; +} +//# sourceMappingURL=second-output.d.ts.map + +//// [/src/2/second-output.d.ts.map] +{"version":3,"file":"second-output.d.ts","sourceRoot":"","sources":["../second/second_part1.ts","../second/second_part2.ts"],"names":[],"mappings":"AAAA,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;ACVD,cAAM,CAAC;IACH,WAAW;CAGd"} + +//// [/src/2/second-output.d.ts.map.baseline.txt] +=================================================================== +JsFile: second-output.d.ts +mapUrl: second-output.d.ts.map +sourceRoot: +sources: ../second/second_part1.ts,../second/second_part2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/2/second-output.d.ts +sourceFile:../second/second_part1.ts +------------------------------------------------------------------- +>>>declare namespace N { +1 > +2 >^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^ +1 > +2 >namespace +3 > N +4 > +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 19) Source(1, 11) + SourceIndex(0) +3 >Emitted(1, 20) Source(1, 12) + SourceIndex(0) +4 >Emitted(1, 21) Source(1, 13) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^-> +1 >{ + > // Comment text + >} +1 >Emitted(2, 2) Source(3, 2) + SourceIndex(0) +--- +>>>declare namespace N { +1-> +2 >^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^ +1-> + > + > +2 >namespace +3 > N +4 > +1->Emitted(3, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(3, 19) Source(5, 11) + SourceIndex(0) +3 >Emitted(3, 20) Source(5, 12) + SourceIndex(0) +4 >Emitted(3, 21) Source(5, 13) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^-> +1 >{ + > function f() { + > console.log('testing'); + > } + > + > f(); + >} +1 >Emitted(4, 2) Source(11, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/2/second-output.d.ts +sourceFile:../second/second_part2.ts +------------------------------------------------------------------- +>>>declare class C { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^-> +1-> +2 >class +3 > C +1->Emitted(5, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(5, 15) Source(1, 7) + SourceIndex(1) +3 >Emitted(5, 16) Source(1, 8) + SourceIndex(1) +--- +>>> doSomething(): void; +1->^^^^ +2 > ^^^^^^^^^^^ +1-> { + > +2 > doSomething +1->Emitted(6, 5) Source(2, 5) + SourceIndex(1) +2 >Emitted(6, 16) Source(2, 16) + SourceIndex(1) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >() { + > console.log("something got done"); + > } + >} +1 >Emitted(7, 2) Source(5, 2) + SourceIndex(1) +--- +>>>//# sourceMappingURL=second-output.d.ts.map + +//// [/src/2/second-output.js] +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); +//# sourceMappingURL=second-output.js.map + +//// [/src/2/second-output.js.map] +{"version":3,"file":"second-output.js","sourceRoot":"","sources":["../second/second_part1.ts","../second/second_part2.ts"],"names":[],"mappings":"AAIA,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;IACP,SAAS,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,CAAC,EAAE,CAAC;AACR,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;ACVD;IAAA;IAIA,CAAC;IAHG,uBAAW,GAAX;QACI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC;IACL,QAAC;AAAD,CAAC,AAJD,IAIC"} + +//// [/src/2/second-output.js.map.baseline.txt] +=================================================================== +JsFile: second-output.js +mapUrl: second-output.js.map +sourceRoot: +sources: ../second/second_part1.ts,../second/second_part2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/2/second-output.js +sourceFile:../second/second_part1.ts +------------------------------------------------------------------- +>>>var N; +1 > +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^-> +1 >namespace N { + > // Comment text + >} + > + > +2 >namespace +3 > N +4 > { + > function f() { + > console.log('testing'); + > } + > + > f(); + > } +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 11) + SourceIndex(0) +3 >Emitted(1, 6) Source(5, 12) + SourceIndex(0) +4 >Emitted(1, 7) Source(11, 2) + SourceIndex(0) +--- +>>>(function (N) { +1-> +2 >^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^-> +1-> +2 >namespace +3 > N +1->Emitted(2, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(2, 12) Source(5, 11) + SourceIndex(0) +3 >Emitted(2, 13) Source(5, 12) + SourceIndex(0) +--- +>>> function f() { +1->^^^^ +2 > ^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^-> +1-> { + > +2 > function +3 > f +1->Emitted(3, 5) Source(6, 5) + SourceIndex(0) +2 >Emitted(3, 14) Source(6, 14) + SourceIndex(0) +3 >Emitted(3, 15) Source(6, 15) + SourceIndex(0) +--- +>>> console.log('testing'); +1->^^^^^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^ +8 > ^ +1->() { + > +2 > console +3 > . +4 > log +5 > ( +6 > 'testing' +7 > ) +8 > ; +1->Emitted(4, 9) Source(7, 9) + SourceIndex(0) +2 >Emitted(4, 16) Source(7, 16) + SourceIndex(0) +3 >Emitted(4, 17) Source(7, 17) + SourceIndex(0) +4 >Emitted(4, 20) Source(7, 20) + SourceIndex(0) +5 >Emitted(4, 21) Source(7, 21) + SourceIndex(0) +6 >Emitted(4, 30) Source(7, 30) + SourceIndex(0) +7 >Emitted(4, 31) Source(7, 31) + SourceIndex(0) +8 >Emitted(4, 32) Source(7, 32) + SourceIndex(0) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^-> +1 > + > +2 > } +1 >Emitted(5, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(5, 6) Source(8, 6) + SourceIndex(0) +--- +>>> f(); +1->^^^^ +2 > ^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^^-> +1-> + > + > +2 > f +3 > () +4 > ; +1->Emitted(6, 5) Source(10, 5) + SourceIndex(0) +2 >Emitted(6, 6) Source(10, 6) + SourceIndex(0) +3 >Emitted(6, 8) Source(10, 8) + SourceIndex(0) +4 >Emitted(6, 9) Source(10, 9) + SourceIndex(0) +--- +>>>})(N || (N = {})); +1-> +2 >^ +3 > ^^ +4 > ^ +5 > ^^^^^ +6 > ^ +7 > ^^^^^^^^ +8 > ^^^^^-> +1-> + > +2 >} +3 > +4 > N +5 > +6 > N +7 > { + > function f() { + > console.log('testing'); + > } + > + > f(); + > } +1->Emitted(7, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(7, 2) Source(11, 2) + SourceIndex(0) +3 >Emitted(7, 4) Source(5, 11) + SourceIndex(0) +4 >Emitted(7, 5) Source(5, 12) + SourceIndex(0) +5 >Emitted(7, 10) Source(5, 11) + SourceIndex(0) +6 >Emitted(7, 11) Source(5, 12) + SourceIndex(0) +7 >Emitted(7, 19) Source(11, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/2/second-output.js +sourceFile:../second/second_part2.ts +------------------------------------------------------------------- +>>>var C = (function () { +1-> +2 >^^^^^^^^^^^^^^^^^^^-> +1-> +1->Emitted(8, 1) Source(1, 1) + SourceIndex(1) +--- +>>> function C() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(9, 5) Source(1, 1) + SourceIndex(1) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->class C { + > doSomething() { + > console.log("something got done"); + > } + > +2 > } +1->Emitted(10, 5) Source(5, 1) + SourceIndex(1) +2 >Emitted(10, 6) Source(5, 2) + SourceIndex(1) +--- +>>> C.prototype.doSomething = function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^^^^^^^^^^-> +1-> +2 > doSomething +3 > +1->Emitted(11, 5) Source(2, 5) + SourceIndex(1) +2 >Emitted(11, 28) Source(2, 16) + SourceIndex(1) +3 >Emitted(11, 31) Source(2, 5) + SourceIndex(1) +--- +>>> console.log("something got done"); +1->^^^^^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1->doSomething() { + > +2 > console +3 > . +4 > log +5 > ( +6 > "something got done" +7 > ) +8 > ; +1->Emitted(12, 9) Source(3, 9) + SourceIndex(1) +2 >Emitted(12, 16) Source(3, 16) + SourceIndex(1) +3 >Emitted(12, 17) Source(3, 17) + SourceIndex(1) +4 >Emitted(12, 20) Source(3, 20) + SourceIndex(1) +5 >Emitted(12, 21) Source(3, 21) + SourceIndex(1) +6 >Emitted(12, 41) Source(3, 41) + SourceIndex(1) +7 >Emitted(12, 42) Source(3, 42) + SourceIndex(1) +8 >Emitted(12, 43) Source(3, 43) + SourceIndex(1) +--- +>>> }; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(13, 5) Source(4, 5) + SourceIndex(1) +2 >Emitted(13, 6) Source(4, 6) + SourceIndex(1) +--- +>>> return C; +1->^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(14, 5) Source(5, 1) + SourceIndex(1) +2 >Emitted(14, 13) Source(5, 2) + SourceIndex(1) +--- +>>>}()); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > doSomething() { + > console.log("something got done"); + > } + > } +1 >Emitted(15, 1) Source(5, 1) + SourceIndex(1) +2 >Emitted(15, 2) Source(5, 2) + SourceIndex(1) +3 >Emitted(15, 2) Source(1, 1) + SourceIndex(1) +4 >Emitted(15, 6) Source(5, 2) + SourceIndex(1) +--- +>>>//# sourceMappingURL=second-output.js.map + +//// [/src/2/second-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "../second", + "sourceFiles": [ + "../second/second_part1.ts", + "../second/second_part2.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 285, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 100, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/2/second-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/2/second-output.js +---------------------------------------------------------------------- +text: (0-285) +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); + +====================================================================== +====================================================================== +File:: /src/2/second-output.d.ts +---------------------------------------------------------------------- +text: (0-100) +declare namespace N { +} +declare namespace N { +} +declare class C { + doSomething(): void; +} + +====================================================================== + +//// [/src/first/bin/first-output.d.ts] +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; +//# sourceMappingURL=first-output.d.ts.map + +//// [/src/first/bin/first-output.d.ts.map] +{"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AERD,iBAAS,CAAC,WAET"} + +//// [/src/first/bin/first-output.d.ts.map.baseline.txt] +=================================================================== +JsFile: first-output.d.ts +mapUrl: first-output.d.ts.map +sourceRoot: +sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.d.ts +sourceFile:../first_PART1.ts +------------------------------------------------------------------- +>>>interface TheFirst { +1 > +2 >^^^^^^^^^^ +3 > ^^^^^^^^ +1 > +2 >interface +3 > TheFirst +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) +--- +>>> none: any; +1 >^^^^ +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) +--- +>>>declare const s = "Hello, world"; +1-> +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^ +6 > ^ +1-> + > + > +2 > +3 > const +4 > s +5 > = "Hello, world" +6 > ; +1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) +3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) +4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) +5 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) +6 >Emitted(4, 34) Source(5, 26) + SourceIndex(0) +--- +>>>interface NoJsForHereEither { +1 > +2 >^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^ +1 > + > + > +2 >interface +3 > NoJsForHereEither +1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) +3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) +--- +>>> none: any; +1 >^^^^ +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) +3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) +5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.d.ts +sourceFile:../first_part3.ts +------------------------------------------------------------------- +>>>declare function f(): string; +1-> +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^^^^^^^^^^^^-> +1-> +2 >function +3 > f +4 > () { + > return "JS does hoists"; + > } +1->Emitted(8, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(8, 18) Source(1, 10) + SourceIndex(2) +3 >Emitted(8, 19) Source(1, 11) + SourceIndex(2) +4 >Emitted(8, 30) Source(3, 2) + SourceIndex(2) +--- +>>>//# sourceMappingURL=first-output.d.ts.map + +//// [/src/first/bin/first-output.js] +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} +//# sourceMappingURL=first-output.js.map + +//// [/src/first/bin/first-output.js.map] +{"version":3,"file":"first-output.js","sourceRoot":"","sources":["../first_PART1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAIA,IAAM,CAAC,GAAG,cAAc,CAAC;AAMzB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACVf,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;ACAjB,SAAS,CAAC;IACN,OAAO,gBAAgB,CAAC;AAC5B,CAAC"} + +//// [/src/first/bin/first-output.js.map.baseline.txt] +=================================================================== +JsFile: first-output.js +mapUrl: first-output.js.map +sourceRoot: +sources: ../first_PART1.ts,../first_part2.ts,../first_part3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_PART1.ts +------------------------------------------------------------------- +>>>var s = "Hello, world"; +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^^^^^^^^^^ +6 > ^ +1 >interface TheFirst { + > none: any; + >} + > + > +2 >const +3 > s +4 > = +5 > "Hello, world" +6 > ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) +3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) +4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) +5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) +6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) +--- +>>>console.log(s); +1 > +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^^^-> +1 > + > + >interface NoJsForHereEither { + > none: any; + >} + > + > +2 >console +3 > . +4 > log +5 > ( +6 > s +7 > ) +8 > ; +1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) +3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) +4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) +5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) +6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) +7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) +8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_part2.ts +------------------------------------------------------------------- +>>>console.log(f()); +1-> +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^ +9 > ^ +1-> +2 >console +3 > . +4 > log +5 > ( +6 > f +7 > () +8 > ) +9 > ; +1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) +3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) +4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) +5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) +6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) +7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) +8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) +9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:/src/first/bin/first-output.js +sourceFile:../first_part3.ts +------------------------------------------------------------------- +>>>function f() { +1 > +2 >^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^-> +1 > +2 >function +3 > f +1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) +3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) +--- +>>> return "JS does hoists"; +1->^^^^ +2 > ^^^^^^^ +3 > ^^^^^^^^^^^^^^^^ +4 > ^ +1->() { + > +2 > return +3 > "JS does hoists" +4 > ; +1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) +2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) +3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) +4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) +--- +>>>//# sourceMappingURL=first-output.js.map + +//// [/src/first/bin/first-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "..", + "sourceFiles": [ + "../first_PART1.ts", + "../first_part2.ts", + "../first_part3.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 110, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/first/bin/first-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/first/bin/first-output.js +---------------------------------------------------------------------- +text: (0-110) +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} + +====================================================================== +====================================================================== +File:: /src/first/bin/first-output.d.ts +---------------------------------------------------------------------- +text: (0-157) +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +====================================================================== + +//// [/src/third/thirdjs/output/third-output.d.ts] +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; +declare namespace N { +} +declare namespace N { +} +declare class C { + doSomething(): void; +} +declare var c: C; +//# sourceMappingURL=third-output.d.ts.map + +//// [/src/third/thirdjs/output/third-output.d.ts.map] +{"version":3,"file":"third-output.d.ts","sourceRoot":"","sources":["../../../first/first_PART1.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts","../../third_part1.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;ACRD,iBAAS,CAAC,WAET;ACFD,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;ACVD,cAAM,CAAC;IACH,WAAW;CAGd;ACJD,QAAA,IAAI,CAAC,GAAU,CAAC"} + +//// [/src/third/thirdjs/output/third-output.d.ts.map.baseline.txt] +=================================================================== +JsFile: third-output.d.ts +mapUrl: third-output.d.ts.map +sourceRoot: +sources: ../../../first/first_PART1.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../first/first_PART1.ts +------------------------------------------------------------------- +>>>interface TheFirst { +1 > +2 >^^^^^^^^^^ +3 > ^^^^^^^^ +1 > +2 >interface +3 > TheFirst +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +3 >Emitted(1, 19) Source(1, 19) + SourceIndex(0) +--- +>>> none: any; +1 >^^^^ +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) +--- +>>>declare const s = "Hello, world"; +1-> +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^ +6 > ^ +1-> + > + > +2 > +3 > const +4 > s +5 > = "Hello, world" +6 > ; +1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(4, 9) Source(5, 1) + SourceIndex(0) +3 >Emitted(4, 15) Source(5, 7) + SourceIndex(0) +4 >Emitted(4, 16) Source(5, 8) + SourceIndex(0) +5 >Emitted(4, 33) Source(5, 25) + SourceIndex(0) +6 >Emitted(4, 34) Source(5, 26) + SourceIndex(0) +--- +>>>interface NoJsForHereEither { +1 > +2 >^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^ +1 > + > + > +2 >interface +3 > NoJsForHereEither +1 >Emitted(5, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(5, 11) Source(7, 11) + SourceIndex(0) +3 >Emitted(5, 28) Source(7, 28) + SourceIndex(0) +--- +>>> none: any; +1 >^^^^ +2 > ^^^^ +3 > ^^ +4 > ^^^ +5 > ^ +1 > { + > +2 > none +3 > : +4 > any +5 > ; +1 >Emitted(6, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(6, 9) Source(8, 9) + SourceIndex(0) +3 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) +4 >Emitted(6, 14) Source(8, 14) + SourceIndex(0) +5 >Emitted(6, 15) Source(8, 15) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(7, 2) Source(9, 2) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../first/first_part3.ts +------------------------------------------------------------------- +>>>declare function f(): string; +1-> +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +1-> +2 >function +3 > f +4 > () { + > return "JS does hoists"; + > } +1->Emitted(8, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(8, 18) Source(1, 10) + SourceIndex(1) +3 >Emitted(8, 19) Source(1, 11) + SourceIndex(1) +4 >Emitted(8, 30) Source(3, 2) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../second/second_part1.ts +------------------------------------------------------------------- +>>>declare namespace N { +1 > +2 >^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^ +1 > +2 >namespace +3 > N +4 > +1 >Emitted(9, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(9, 19) Source(1, 11) + SourceIndex(2) +3 >Emitted(9, 20) Source(1, 12) + SourceIndex(2) +4 >Emitted(9, 21) Source(1, 13) + SourceIndex(2) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^-> +1 >{ + > // Comment text + >} +1 >Emitted(10, 2) Source(3, 2) + SourceIndex(2) +--- +>>>declare namespace N { +1-> +2 >^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^ +1-> + > + > +2 >namespace +3 > N +4 > +1->Emitted(11, 1) Source(5, 1) + SourceIndex(2) +2 >Emitted(11, 19) Source(5, 11) + SourceIndex(2) +3 >Emitted(11, 20) Source(5, 12) + SourceIndex(2) +4 >Emitted(11, 21) Source(5, 13) + SourceIndex(2) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^-> +1 >{ + > function f() { + > console.log('testing'); + > } + > + > f(); + >} +1 >Emitted(12, 2) Source(11, 2) + SourceIndex(2) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../../second/second_part2.ts +------------------------------------------------------------------- +>>>declare class C { +1-> +2 >^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^-> +1-> +2 >class +3 > C +1->Emitted(13, 1) Source(1, 1) + SourceIndex(3) +2 >Emitted(13, 15) Source(1, 7) + SourceIndex(3) +3 >Emitted(13, 16) Source(1, 8) + SourceIndex(3) +--- +>>> doSomething(): void; +1->^^^^ +2 > ^^^^^^^^^^^ +1-> { + > +2 > doSomething +1->Emitted(14, 5) Source(2, 5) + SourceIndex(3) +2 >Emitted(14, 16) Source(2, 16) + SourceIndex(3) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^-> +1 >() { + > console.log("something got done"); + > } + >} +1 >Emitted(15, 2) Source(5, 2) + SourceIndex(3) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.d.ts +sourceFile:../../third_part1.ts +------------------------------------------------------------------- +>>>declare var c: C; +1-> +2 >^^^^^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 > +3 > var +4 > c +5 > = new C() +6 > ; +1->Emitted(16, 1) Source(1, 1) + SourceIndex(4) +2 >Emitted(16, 9) Source(1, 1) + SourceIndex(4) +3 >Emitted(16, 13) Source(1, 5) + SourceIndex(4) +4 >Emitted(16, 14) Source(1, 6) + SourceIndex(4) +5 >Emitted(16, 17) Source(1, 16) + SourceIndex(4) +6 >Emitted(16, 18) Source(1, 17) + SourceIndex(4) +--- +>>>//# sourceMappingURL=third-output.d.ts.map + +//// [/src/third/thirdjs/output/third-output.js] +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); +var c = new C(); +c.doSomething(); +//# sourceMappingURL=third-output.js.map + +//// [/src/third/thirdjs/output/third-output.js.map] +{"version":3,"file":"third-output.js","sourceRoot":"","sources":["../../../first/first_PART1.ts","../../../first/first_part2.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts","../../third_part1.ts"],"names":[],"mappings":"AAIA,IAAM,CAAC,GAAG,cAAc,CAAC;AAMzB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACVf,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;ACAjB,SAAS,CAAC;IACN,OAAO,gBAAgB,CAAC;AAC5B,CAAC;ACED,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;IACP,SAAS,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,CAAC,EAAE,CAAC;AACR,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;ACVD;IAAA;IAIA,CAAC;IAHG,uBAAW,GAAX;QACI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC;IACL,QAAC;AAAD,CAAC,AAJD,IAIC;ACJD,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AAChB,CAAC,CAAC,WAAW,EAAE,CAAC"} + +//// [/src/third/thirdjs/output/third-output.js.map.baseline.txt] +=================================================================== +JsFile: third-output.js +mapUrl: third-output.js.map +sourceRoot: +sources: ../../../first/first_PART1.ts,../../../first/first_part2.ts,../../../first/first_part3.ts,../../../second/second_part1.ts,../../../second/second_part2.ts,../../third_part1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../first/first_PART1.ts +------------------------------------------------------------------- +>>>var s = "Hello, world"; +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^^^^^^^^^^ +6 > ^ +1 >interface TheFirst { + > none: any; + >} + > + > +2 >const +3 > s +4 > = +5 > "Hello, world" +6 > ; +1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(5, 7) + SourceIndex(0) +3 >Emitted(1, 6) Source(5, 8) + SourceIndex(0) +4 >Emitted(1, 9) Source(5, 11) + SourceIndex(0) +5 >Emitted(1, 23) Source(5, 25) + SourceIndex(0) +6 >Emitted(1, 24) Source(5, 26) + SourceIndex(0) +--- +>>>console.log(s); +1 > +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^^^-> +1 > + > + >interface NoJsForHereEither { + > none: any; + >} + > + > +2 >console +3 > . +4 > log +5 > ( +6 > s +7 > ) +8 > ; +1 >Emitted(2, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(2, 8) Source(11, 8) + SourceIndex(0) +3 >Emitted(2, 9) Source(11, 9) + SourceIndex(0) +4 >Emitted(2, 12) Source(11, 12) + SourceIndex(0) +5 >Emitted(2, 13) Source(11, 13) + SourceIndex(0) +6 >Emitted(2, 14) Source(11, 14) + SourceIndex(0) +7 >Emitted(2, 15) Source(11, 15) + SourceIndex(0) +8 >Emitted(2, 16) Source(11, 16) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../first/first_part2.ts +------------------------------------------------------------------- +>>>console.log(f()); +1-> +2 >^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^ +9 > ^ +1-> +2 >console +3 > . +4 > log +5 > ( +6 > f +7 > () +8 > ) +9 > ; +1->Emitted(3, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(3, 8) Source(1, 8) + SourceIndex(1) +3 >Emitted(3, 9) Source(1, 9) + SourceIndex(1) +4 >Emitted(3, 12) Source(1, 12) + SourceIndex(1) +5 >Emitted(3, 13) Source(1, 13) + SourceIndex(1) +6 >Emitted(3, 14) Source(1, 14) + SourceIndex(1) +7 >Emitted(3, 16) Source(1, 16) + SourceIndex(1) +8 >Emitted(3, 17) Source(1, 17) + SourceIndex(1) +9 >Emitted(3, 18) Source(1, 18) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../first/first_part3.ts +------------------------------------------------------------------- +>>>function f() { +1 > +2 >^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^-> +1 > +2 >function +3 > f +1 >Emitted(4, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(4, 10) Source(1, 10) + SourceIndex(2) +3 >Emitted(4, 11) Source(1, 11) + SourceIndex(2) +--- +>>> return "JS does hoists"; +1->^^^^ +2 > ^^^^^^^ +3 > ^^^^^^^^^^^^^^^^ +4 > ^ +1->() { + > +2 > return +3 > "JS does hoists" +4 > ; +1->Emitted(5, 5) Source(2, 5) + SourceIndex(2) +2 >Emitted(5, 12) Source(2, 12) + SourceIndex(2) +3 >Emitted(5, 28) Source(2, 28) + SourceIndex(2) +4 >Emitted(5, 29) Source(2, 29) + SourceIndex(2) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^-> +1 > + > +2 >} +1 >Emitted(6, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(6, 2) Source(3, 2) + SourceIndex(2) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../second/second_part1.ts +------------------------------------------------------------------- +>>>var N; +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^-> +1->namespace N { + > // Comment text + >} + > + > +2 >namespace +3 > N +4 > { + > function f() { + > console.log('testing'); + > } + > + > f(); + > } +1->Emitted(7, 1) Source(5, 1) + SourceIndex(3) +2 >Emitted(7, 5) Source(5, 11) + SourceIndex(3) +3 >Emitted(7, 6) Source(5, 12) + SourceIndex(3) +4 >Emitted(7, 7) Source(11, 2) + SourceIndex(3) +--- +>>>(function (N) { +1-> +2 >^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^-> +1-> +2 >namespace +3 > N +1->Emitted(8, 1) Source(5, 1) + SourceIndex(3) +2 >Emitted(8, 12) Source(5, 11) + SourceIndex(3) +3 >Emitted(8, 13) Source(5, 12) + SourceIndex(3) +--- +>>> function f() { +1->^^^^ +2 > ^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^-> +1-> { + > +2 > function +3 > f +1->Emitted(9, 5) Source(6, 5) + SourceIndex(3) +2 >Emitted(9, 14) Source(6, 14) + SourceIndex(3) +3 >Emitted(9, 15) Source(6, 15) + SourceIndex(3) +--- +>>> console.log('testing'); +1->^^^^^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^ +8 > ^ +1->() { + > +2 > console +3 > . +4 > log +5 > ( +6 > 'testing' +7 > ) +8 > ; +1->Emitted(10, 9) Source(7, 9) + SourceIndex(3) +2 >Emitted(10, 16) Source(7, 16) + SourceIndex(3) +3 >Emitted(10, 17) Source(7, 17) + SourceIndex(3) +4 >Emitted(10, 20) Source(7, 20) + SourceIndex(3) +5 >Emitted(10, 21) Source(7, 21) + SourceIndex(3) +6 >Emitted(10, 30) Source(7, 30) + SourceIndex(3) +7 >Emitted(10, 31) Source(7, 31) + SourceIndex(3) +8 >Emitted(10, 32) Source(7, 32) + SourceIndex(3) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^-> +1 > + > +2 > } +1 >Emitted(11, 5) Source(8, 5) + SourceIndex(3) +2 >Emitted(11, 6) Source(8, 6) + SourceIndex(3) +--- +>>> f(); +1->^^^^ +2 > ^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^^-> +1-> + > + > +2 > f +3 > () +4 > ; +1->Emitted(12, 5) Source(10, 5) + SourceIndex(3) +2 >Emitted(12, 6) Source(10, 6) + SourceIndex(3) +3 >Emitted(12, 8) Source(10, 8) + SourceIndex(3) +4 >Emitted(12, 9) Source(10, 9) + SourceIndex(3) +--- +>>>})(N || (N = {})); +1-> +2 >^ +3 > ^^ +4 > ^ +5 > ^^^^^ +6 > ^ +7 > ^^^^^^^^ +8 > ^^^^^-> +1-> + > +2 >} +3 > +4 > N +5 > +6 > N +7 > { + > function f() { + > console.log('testing'); + > } + > + > f(); + > } +1->Emitted(13, 1) Source(11, 1) + SourceIndex(3) +2 >Emitted(13, 2) Source(11, 2) + SourceIndex(3) +3 >Emitted(13, 4) Source(5, 11) + SourceIndex(3) +4 >Emitted(13, 5) Source(5, 12) + SourceIndex(3) +5 >Emitted(13, 10) Source(5, 11) + SourceIndex(3) +6 >Emitted(13, 11) Source(5, 12) + SourceIndex(3) +7 >Emitted(13, 19) Source(11, 2) + SourceIndex(3) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../../second/second_part2.ts +------------------------------------------------------------------- +>>>var C = (function () { +1-> +2 >^^^^^^^^^^^^^^^^^^^-> +1-> +1->Emitted(14, 1) Source(1, 1) + SourceIndex(4) +--- +>>> function C() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(15, 5) Source(1, 1) + SourceIndex(4) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->class C { + > doSomething() { + > console.log("something got done"); + > } + > +2 > } +1->Emitted(16, 5) Source(5, 1) + SourceIndex(4) +2 >Emitted(16, 6) Source(5, 2) + SourceIndex(4) +--- +>>> C.prototype.doSomething = function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^^^^^^^^^^^^-> +1-> +2 > doSomething +3 > +1->Emitted(17, 5) Source(2, 5) + SourceIndex(4) +2 >Emitted(17, 28) Source(2, 16) + SourceIndex(4) +3 >Emitted(17, 31) Source(2, 5) + SourceIndex(4) +--- +>>> console.log("something got done"); +1->^^^^^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^ +7 > ^ +8 > ^ +1->doSomething() { + > +2 > console +3 > . +4 > log +5 > ( +6 > "something got done" +7 > ) +8 > ; +1->Emitted(18, 9) Source(3, 9) + SourceIndex(4) +2 >Emitted(18, 16) Source(3, 16) + SourceIndex(4) +3 >Emitted(18, 17) Source(3, 17) + SourceIndex(4) +4 >Emitted(18, 20) Source(3, 20) + SourceIndex(4) +5 >Emitted(18, 21) Source(3, 21) + SourceIndex(4) +6 >Emitted(18, 41) Source(3, 41) + SourceIndex(4) +7 >Emitted(18, 42) Source(3, 42) + SourceIndex(4) +8 >Emitted(18, 43) Source(3, 43) + SourceIndex(4) +--- +>>> }; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(19, 5) Source(4, 5) + SourceIndex(4) +2 >Emitted(19, 6) Source(4, 6) + SourceIndex(4) +--- +>>> return C; +1->^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(20, 5) Source(5, 1) + SourceIndex(4) +2 >Emitted(20, 13) Source(5, 2) + SourceIndex(4) +--- +>>>}()); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > doSomething() { + > console.log("something got done"); + > } + > } +1 >Emitted(21, 1) Source(5, 1) + SourceIndex(4) +2 >Emitted(21, 2) Source(5, 2) + SourceIndex(4) +3 >Emitted(21, 2) Source(1, 1) + SourceIndex(4) +4 >Emitted(21, 6) Source(5, 2) + SourceIndex(4) +--- +------------------------------------------------------------------- +emittedFile:/src/third/thirdjs/output/third-output.js +sourceFile:../../third_part1.ts +------------------------------------------------------------------- +>>>var c = new C(); +1-> +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^ +6 > ^ +7 > ^^ +8 > ^ +9 > ^-> +1-> +2 >var +3 > c +4 > = +5 > new +6 > C +7 > () +8 > ; +1->Emitted(22, 1) Source(1, 1) + SourceIndex(5) +2 >Emitted(22, 5) Source(1, 5) + SourceIndex(5) +3 >Emitted(22, 6) Source(1, 6) + SourceIndex(5) +4 >Emitted(22, 9) Source(1, 9) + SourceIndex(5) +5 >Emitted(22, 13) Source(1, 13) + SourceIndex(5) +6 >Emitted(22, 14) Source(1, 14) + SourceIndex(5) +7 >Emitted(22, 16) Source(1, 16) + SourceIndex(5) +8 >Emitted(22, 17) Source(1, 17) + SourceIndex(5) +--- +>>>c.doSomething(); +1-> +2 >^ +3 > ^ +4 > ^^^^^^^^^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >c +3 > . +4 > doSomething +5 > () +6 > ; +1->Emitted(23, 1) Source(2, 1) + SourceIndex(5) +2 >Emitted(23, 2) Source(2, 2) + SourceIndex(5) +3 >Emitted(23, 3) Source(2, 3) + SourceIndex(5) +4 >Emitted(23, 14) Source(2, 14) + SourceIndex(5) +5 >Emitted(23, 16) Source(2, 16) + SourceIndex(5) +6 >Emitted(23, 17) Source(2, 17) + SourceIndex(5) +--- +>>>//# sourceMappingURL=third-output.js.map + +//// [/src/third/thirdjs/output/third-output.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "../..", + "sourceFiles": [ + "../../third_part1.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 110, + "kind": "prepend", + "data": "../../../first/bin/first-output.js", + "texts": [ + { + "pos": 0, + "end": 110, + "kind": "text" + } + ] + }, + { + "pos": 110, + "end": 395, + "kind": "prepend", + "data": "../../../2/second-output.js", + "texts": [ + { + "pos": 110, + "end": 395, + "kind": "text" + } + ] + }, + { + "pos": 395, + "end": 431, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 157, + "kind": "prepend", + "data": "../../../first/bin/first-output.d.ts", + "texts": [ + { + "pos": 0, + "end": 157, + "kind": "text" + } + ] + }, + { + "pos": 157, + "end": 257, + "kind": "prepend", + "data": "../../../2/second-output.d.ts", + "texts": [ + { + "pos": 157, + "end": 257, + "kind": "text" + } + ] + }, + { + "pos": 257, + "end": 276, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/third/thirdjs/output/third-output.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/third/thirdjs/output/third-output.js +---------------------------------------------------------------------- +prepend: (0-110):: ../../../first/bin/first-output.js texts:: 1 +>>-------------------------------------------------------------------- +text: (0-110) +var s = "Hello, world"; +console.log(s); +console.log(f()); +function f() { + return "JS does hoists"; +} + +---------------------------------------------------------------------- +prepend: (110-395):: ../../../2/second-output.js texts:: 1 +>>-------------------------------------------------------------------- +text: (110-395) +var N; +(function (N) { + function f() { + console.log('testing'); + } + f(); +})(N || (N = {})); +var C = (function () { + function C() { + } + C.prototype.doSomething = function () { + console.log("something got done"); + }; + return C; +}()); + +---------------------------------------------------------------------- +text: (395-431) +var c = new C(); +c.doSomething(); + +====================================================================== +====================================================================== +File:: /src/third/thirdjs/output/third-output.d.ts +---------------------------------------------------------------------- +prepend: (0-157):: ../../../first/bin/first-output.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (0-157) +interface TheFirst { + none: any; +} +declare const s = "Hello, world"; +interface NoJsForHereEither { + none: any; +} +declare function f(): string; + +---------------------------------------------------------------------- +prepend: (157-257):: ../../../2/second-output.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (157-257) +declare namespace N { +} +declare namespace N { +} +declare class C { + doSomething(): void; +} + +---------------------------------------------------------------------- +text: (257-276) +declare var c: C; + +====================================================================== + diff --git a/tests/baselines/reference/tsbuild/outputPaths/initial-build/when-rootDir-is-specified-but-not-all-files-belong-to-rootDir-and-is-composite.js b/tests/baselines/reference/tsbuild/outputPaths/initial-build/when-rootDir-is-specified-but-not-all-files-belong-to-rootDir-and-is-composite.js index 0b529ae90fb92..0693041b16c59 100644 --- a/tests/baselines/reference/tsbuild/outputPaths/initial-build/when-rootDir-is-specified-but-not-all-files-belong-to-rootDir-and-is-composite.js +++ b/tests/baselines/reference/tsbuild/outputPaths/initial-build/when-rootDir-is-specified-but-not-all-files-belong-to-rootDir-and-is-composite.js @@ -35,6 +35,8 @@ Output:: [12:01:00 AM] Building project '/src/tsconfig.json'... error TS6059: File '/src/types/type.ts' is not under 'rootDir' '/src/src'. 'rootDir' is expected to contain all source files. + The file is in the program because: + Matched by include pattern '**/*' in '/src/tsconfig.json' Found 1 error. @@ -58,6 +60,8 @@ Output:: [12:04:00 AM] Building project '/src/tsconfig.json'... error TS6059: File '/src/types/type.ts' is not under 'rootDir' '/src/src'. 'rootDir' is expected to contain all source files. + The file is in the program because: + Matched by include pattern '**/*' in '/src/tsconfig.json' Found 1 error. @@ -74,6 +78,8 @@ Input:: Output:: /lib/tsc -p /src/tsconfig.json error TS6059: File '/src/types/type.ts' is not under 'rootDir' '/src/src'. 'rootDir' is expected to contain all source files. + The file is in the program because: + Matched by include pattern '**/*' in '/src/tsconfig.json' Found 1 error. diff --git a/tests/baselines/reference/tsbuild/outputPaths/initial-build/when-rootDir-is-specified-but-not-all-files-belong-to-rootDir.js b/tests/baselines/reference/tsbuild/outputPaths/initial-build/when-rootDir-is-specified-but-not-all-files-belong-to-rootDir.js index 159c43724d83d..b8a88cf7d28c1 100644 --- a/tests/baselines/reference/tsbuild/outputPaths/initial-build/when-rootDir-is-specified-but-not-all-files-belong-to-rootDir.js +++ b/tests/baselines/reference/tsbuild/outputPaths/initial-build/when-rootDir-is-specified-but-not-all-files-belong-to-rootDir.js @@ -35,6 +35,8 @@ Output:: [12:01:00 AM] Building project '/src/tsconfig.json'... error TS6059: File '/src/types/type.ts' is not under 'rootDir' '/src/src'. 'rootDir' is expected to contain all source files. + The file is in the program because: + Matched by include pattern '**/*' in '/src/tsconfig.json' Found 1 error. @@ -58,6 +60,8 @@ Output:: [12:04:00 AM] Building project '/src/tsconfig.json'... error TS6059: File '/src/types/type.ts' is not under 'rootDir' '/src/src'. 'rootDir' is expected to contain all source files. + The file is in the program because: + Matched by include pattern '**/*' in '/src/tsconfig.json' Found 1 error. @@ -74,6 +78,8 @@ Input:: Output:: /lib/tsc -p /src/tsconfig.json error TS6059: File '/src/types/type.ts' is not under 'rootDir' '/src/src'. 'rootDir' is expected to contain all source files. + The file is in the program because: + Matched by include pattern '**/*' in '/src/tsconfig.json' Found 1 error. diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js index 05a2b06a00a52..283cc0c5343bb 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js @@ -53,7 +53,21 @@ export default hello.hello Output:: -/lib/tsc --b /src/tsconfig_withFiles.json +/lib/tsc --b /src/tsconfig_withFiles.json --v --explainFiles +[12:00:00 AM] Projects in this build: + * src/tsconfig_withFiles.json + +[12:00:00 AM] Project 'src/tsconfig_withFiles.json' is out of date because output file 'src/dist/src/index.js' does not exist + +[12:00:00 AM] Building project '/src/tsconfig_withFiles.json'... + +lib/lib.d.ts + Default library +src/src/hello.json + Imported via "./hello.json" from file 'src/src/index.ts' + Part of 'files' list in tsconfig.json +src/src/index.ts + Part of 'files' list in tsconfig.json exitCode:: ExitStatus.Success @@ -107,6 +121,7 @@ exports["default"] = hello_json_1["default"].hello; "allowSyntheticDefaultImports": true, "outDir": "./", "skipDefaultLibCheck": true, + "explainFiles": true, "configFilePath": "../tsconfig_withFiles.json" }, "referencedMap": { diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/importing-json-module-from-project-reference.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/importing-json-module-from-project-reference.js index 07b823a44f064..eb949a9feb21e 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/importing-json-module-from-project-reference.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/importing-json-module-from-project-reference.js @@ -70,7 +70,7 @@ console.log(foo); Output:: -/lib/tsc --b src/tsconfig.json --verbose +/lib/tsc --b src/tsconfig.json --verbose --explainFiles [12:01:00 AM] Projects in this build: * src/strings/tsconfig.json * src/main/tsconfig.json @@ -80,10 +80,20 @@ Output:: [12:01:00 AM] Building project '/src/strings/tsconfig.json'... +lib/lib.d.ts + Default library for target 'es5' +src/strings/foo.json + Matched by include pattern 'foo.json' in 'src/strings/tsconfig.json' [12:01:00 AM] Project 'src/main/tsconfig.json' is out of date because output file 'src/main/index.js' does not exist [12:01:00 AM] Building project '/src/main/tsconfig.json'... +lib/lib.d.ts + Default library for target 'es5' +src/strings/foo.json + Imported via '../strings/foo.json' from file 'src/main/index.ts' +src/main/index.ts + Matched by include pattern './**/*.ts' in 'src/main/tsconfig.json' exitCode:: ExitStatus.Success @@ -125,6 +135,7 @@ console.log(foo_json_1.foo); "resolveJsonModule": true, "strict": true, "esModuleInterop": true, + "explainFiles": true, "configFilePath": "./tsconfig.json" }, "referencedMap": { @@ -165,6 +176,7 @@ console.log(foo_json_1.foo); "resolveJsonModule": true, "strict": true, "esModuleInterop": true, + "explainFiles": true, "configFilePath": "./tsconfig.json" }, "referencedMap": {}, @@ -184,7 +196,7 @@ Input:: Output:: -/lib/tsc --b src/tsconfig.json --verbose +/lib/tsc --b src/tsconfig.json --verbose --explainFiles [12:04:00 AM] Projects in this build: * src/strings/tsconfig.json * src/main/tsconfig.json diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js index 5c11ac3c8bad3..dc76441b8802c 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js @@ -56,7 +56,21 @@ export default hello.hello Output:: -/lib/tsc --b /src/tsconfig_withIncludeAndFiles.json +/lib/tsc --b /src/tsconfig_withIncludeAndFiles.json --v --explainFiles +[12:00:00 AM] Projects in this build: + * src/tsconfig_withIncludeAndFiles.json + +[12:00:00 AM] Project 'src/tsconfig_withIncludeAndFiles.json' is out of date because output file 'src/dist/src/hello.json' does not exist + +[12:00:00 AM] Building project '/src/tsconfig_withIncludeAndFiles.json'... + +lib/lib.d.ts + Default library +src/src/hello.json + Part of 'files' list in tsconfig.json + Imported via "./hello.json" from file 'src/src/index.ts' +src/src/index.ts + Matched by include pattern 'src/**/*' in 'src/tsconfig_withIncludeAndFiles.json' exitCode:: ExitStatus.Success @@ -110,6 +124,7 @@ exports["default"] = hello_json_1["default"].hello; "allowSyntheticDefaultImports": true, "outDir": "./", "skipDefaultLibCheck": true, + "explainFiles": true, "configFilePath": "../tsconfig_withIncludeAndFiles.json" }, "referencedMap": { diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js index 9286ef881d046..60ef47772f50c 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js @@ -51,7 +51,21 @@ export default hello.hello Output:: -/lib/tsc --b /src/tsconfig_withIncludeOfJson.json +/lib/tsc --b /src/tsconfig_withIncludeOfJson.json --v --explainFiles +[12:00:00 AM] Projects in this build: + * src/tsconfig_withIncludeOfJson.json + +[12:00:00 AM] Project 'src/tsconfig_withIncludeOfJson.json' is out of date because output file 'src/dist/src/index.js' does not exist + +[12:00:00 AM] Building project '/src/tsconfig_withIncludeOfJson.json'... + +lib/lib.d.ts + Default library +src/src/index.json + Imported via "./index.json" from file 'src/src/index.ts' + Matched by include pattern 'src/**/*.json' in 'src/tsconfig_withIncludeOfJson.json' +src/src/index.ts + Matched by include pattern 'src/**/*' in 'src/tsconfig_withIncludeOfJson.json' exitCode:: ExitStatus.Success @@ -103,6 +117,7 @@ exports["default"] = index_json_1["default"].hello; "allowSyntheticDefaultImports": true, "outDir": "./", "skipDefaultLibCheck": true, + "explainFiles": true, "configFilePath": "../tsconfig_withIncludeOfJson.json" }, "referencedMap": { diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js index ae07e6404cb10..9889112de7449 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js @@ -53,7 +53,21 @@ export default hello.hello Output:: -/lib/tsc --b /src/tsconfig_withIncludeOfJson.json +/lib/tsc --b /src/tsconfig_withIncludeOfJson.json --v --explainFiles +[12:00:00 AM] Projects in this build: + * src/tsconfig_withIncludeOfJson.json + +[12:00:00 AM] Project 'src/tsconfig_withIncludeOfJson.json' is out of date because output file 'src/dist/src/index.js' does not exist + +[12:00:00 AM] Building project '/src/tsconfig_withIncludeOfJson.json'... + +lib/lib.d.ts + Default library +src/src/hello.json + Imported via "./hello.json" from file 'src/src/index.ts' + Matched by include pattern 'src/**/*.json' in 'src/tsconfig_withIncludeOfJson.json' +src/src/index.ts + Matched by include pattern 'src/**/*' in 'src/tsconfig_withIncludeOfJson.json' exitCode:: ExitStatus.Success @@ -107,6 +121,7 @@ exports["default"] = hello_json_1["default"].hello; "allowSyntheticDefaultImports": true, "outDir": "./", "skipDefaultLibCheck": true, + "explainFiles": true, "configFilePath": "../tsconfig_withIncludeOfJson.json" }, "referencedMap": { diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js index f479d2ac0bc9b..b9ee9836ce594 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js @@ -53,12 +53,25 @@ export default hello.hello Output:: -/lib/tsc --b /src/tsconfig_withInclude.json +/lib/tsc --b /src/tsconfig_withInclude.json --v --explainFiles +[12:00:00 AM] Projects in this build: + * src/tsconfig_withInclude.json + +[12:00:00 AM] Project 'src/tsconfig_withInclude.json' is out of date because output file 'src/dist/src/index.js' does not exist + +[12:00:00 AM] Building project '/src/tsconfig_withInclude.json'... + src/src/index.ts:1:19 - error TS6307: File '/src/src/hello.json' is not listed within the file list of project '/src/tsconfig_withInclude.json'. Projects must list all files or use an 'include' pattern. 1 import hello from "./hello.json"    ~~~~~~~~~~~~~~ +lib/lib.d.ts + Default library +src/src/hello.json + Imported via "./hello.json" from file 'src/src/index.ts' +src/src/index.ts + Matched by include pattern 'src/**/*' in 'src/tsconfig_withInclude.json' Found 1 error. @@ -94,6 +107,7 @@ exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped "allowSyntheticDefaultImports": true, "outDir": "./", "skipDefaultLibCheck": true, + "explainFiles": true, "configFilePath": "../tsconfig_withInclude.json" }, "referencedMap": { diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js index e1ef669806e12..8f7f375bc486d 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js @@ -53,7 +53,7 @@ export default hello.hello Output:: -/lib/tsc --b src/tsconfig_withFiles.json --verbose +/lib/tsc --b src/tsconfig_withFiles.json --verbose --explainFiles [12:01:00 AM] Projects in this build: * src/tsconfig_withFiles.json @@ -61,6 +61,13 @@ Output:: [12:01:00 AM] Building project '/src/tsconfig_withFiles.json'... +lib/lib.d.ts + Default library +src/src/hello.json + Imported via "./hello.json" from file 'src/src/index.ts' + Part of 'files' list in tsconfig.json +src/src/index.ts + Part of 'files' list in tsconfig.json exitCode:: ExitStatus.Success @@ -118,6 +125,7 @@ exports["default"] = hello_json_1["default"].hello; "allowSyntheticDefaultImports": true, "outDir": "./", "skipDefaultLibCheck": true, + "explainFiles": true, "configFilePath": "../tsconfig_withFiles.json" }, "referencedMap": { @@ -142,7 +150,7 @@ Input:: Output:: -/lib/tsc --b src/tsconfig_withFiles.json --verbose +/lib/tsc --b src/tsconfig_withFiles.json --verbose --explainFiles [12:04:00 AM] Projects in this build: * src/tsconfig_withFiles.json diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/explainFiles.js b/tests/baselines/reference/tsbuild/sample1/initial-build/explainFiles.js new file mode 100644 index 0000000000000..0607672a2bc0f --- /dev/null +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/explainFiles.js @@ -0,0 +1,776 @@ +Input:: +//// [/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/core/anotherModule.ts] +export const World = "hello"; + + +//// [/src/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/src/core/some_decl.d.ts] +declare const dts: any; + + +//// [/src/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/src/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/src/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/src/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/src/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/src/ui/index.ts] + + +//// [/src/ui/tsconfig.json] + + + + +Output:: +/lib/tsc --b /src/tests --explainFiles --v +[12:01:00 AM] Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +[12:01:00 AM] Project 'src/core/tsconfig.json' is out of date because output file 'src/core/anotherModule.js' does not exist + +[12:01:00 AM] Building project '/src/core/tsconfig.json'... + +lib/lib.d.ts + Default library +src/core/anotherModule.ts + Matched by include pattern '**/*' in 'src/core/tsconfig.json' +src/core/index.ts + Matched by include pattern '**/*' in 'src/core/tsconfig.json' +src/core/some_decl.d.ts + Matched by include pattern '**/*' in 'src/core/tsconfig.json' +[12:01:00 AM] Project 'src/logic/tsconfig.json' is out of date because output file 'src/logic/index.js' does not exist + +[12:01:00 AM] Building project '/src/logic/tsconfig.json'... + +lib/lib.d.ts + Default library +src/core/index.d.ts + Imported via '../core/index' from file 'src/logic/index.ts' + File is output of project reference source 'src/core/index.ts' +src/core/anotherModule.d.ts + Imported via '../core/anotherModule' from file 'src/logic/index.ts' + File is output of project reference source 'src/core/anotherModule.ts' +src/logic/index.ts + Matched by include pattern '**/*' in 'src/logic/tsconfig.json' +[12:01:00 AM] Project 'src/tests/tsconfig.json' is out of date because output file 'src/tests/index.js' does not exist + +[12:01:00 AM] Building project '/src/tests/tsconfig.json'... + +lib/lib.d.ts + Default library +src/core/index.d.ts + Imported via '../core/index' from file 'src/tests/index.ts' + File is output of project reference source 'src/core/index.ts' +src/core/anotherModule.d.ts + Imported via '../core/anotherModule' from file 'src/logic/index.d.ts' + Imported via '../core/anotherModule' from file 'src/tests/index.ts' + File is output of project reference source 'src/core/anotherModule.ts' +src/logic/index.d.ts + Imported via '../logic/index' from file 'src/tests/index.ts' + File is output of project reference source 'src/logic/index.ts' +src/tests/index.ts + Part of 'files' list in tsconfig.json +exitCode:: ExitStatus.Success + + +//// [/src/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/src/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/src/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = void 0; +exports.World = "hello"; + + +//// [/src/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/src/core/index.js] +"use strict"; +exports.__esModule = true; +exports.multiply = exports.leftPad = exports.someString = void 0; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/src/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "affectsGlobalScope": false + }, + "./some_decl.d.ts": { + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "explainFiles": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/logic/index.js] +"use strict"; +exports.__esModule = true; +exports.m = exports.getSecondsInDay = void 0; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/src/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/src/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "../core/index.d.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "affectsGlobalScope": false + }, + "../core/anothermodule.d.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "explainFiles": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/src/tests/index.js] +"use strict"; +exports.__esModule = true; +exports.m = void 0; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/src/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "../core/index.d.ts": { + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "affectsGlobalScope": false + }, + "../core/anothermodule.d.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "affectsGlobalScope": false + }, + "../logic/index.d.ts": { + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "explainFiles": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.d.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.d.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: incremental-declaration-changes +Input:: +//// [/src/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + +export class someClass { } + + + +Output:: +/lib/tsc --b /src/tests --explainFiles --v +[12:04:00 AM] Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +[12:04:00 AM] Project 'src/core/tsconfig.json' is out of date because oldest output 'src/core/anotherModule.js' is older than newest input 'src/core/index.ts' + +[12:04:00 AM] Building project '/src/core/tsconfig.json'... + +[12:04:00 AM] Updating unchanged output timestamps of project '/src/core/tsconfig.json'... + +lib/lib.d.ts + Default library +src/core/anotherModule.ts + Matched by include pattern '**/*' in 'src/core/tsconfig.json' +src/core/index.ts + Matched by include pattern '**/*' in 'src/core/tsconfig.json' +src/core/some_decl.d.ts + Matched by include pattern '**/*' in 'src/core/tsconfig.json' +[12:04:00 AM] Project 'src/logic/tsconfig.json' is out of date because oldest output 'src/logic/index.js' is older than newest input 'src/core' + +[12:04:00 AM] Building project '/src/logic/tsconfig.json'... + +lib/lib.d.ts + Default library +src/core/index.d.ts + Imported via '../core/index' from file 'src/logic/index.ts' + File is output of project reference source 'src/core/index.ts' +src/core/anotherModule.d.ts + Imported via '../core/anotherModule' from file 'src/logic/index.ts' + File is output of project reference source 'src/core/anotherModule.ts' +src/logic/index.ts + Matched by include pattern '**/*' in 'src/logic/tsconfig.json' +[12:04:00 AM] Project 'src/tests/tsconfig.json' is out of date because oldest output 'src/tests/index.js' is older than newest input 'src/core' + +[12:04:00 AM] Building project '/src/tests/tsconfig.json'... + +lib/lib.d.ts + Default library +src/core/index.d.ts + Imported via '../core/index' from file 'src/tests/index.ts' + File is output of project reference source 'src/core/index.ts' +src/core/anotherModule.d.ts + Imported via '../core/anotherModule' from file 'src/logic/index.d.ts' + Imported via '../core/anotherModule' from file 'src/tests/index.ts' + File is output of project reference source 'src/core/anotherModule.ts' +src/logic/index.d.ts + Imported via '../logic/index' from file 'src/tests/index.ts' + File is output of project reference source 'src/logic/index.ts' +src/tests/index.ts + Part of 'files' list in tsconfig.json +exitCode:: ExitStatus.Success + + +//// [/src/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +export declare class someClass { +} +//# sourceMappingURL=index.d.ts.map + +//// [/src/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAEhE,qBAAa,SAAS;CAAI"} + +//// [/src/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someClass = exports.multiply = exports.leftPad = exports.someString = void 0; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; +var someClass = /** @class */ (function () { + function someClass() { + } + return someClass; +}()); +exports.someClass = someClass; + + +//// [/src/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "-13387000654-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClass { }", + "signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "affectsGlobalScope": false + }, + "./some_decl.d.ts": { + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "explainFiles": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/logic/index.d.ts] file written with same contents +//// [/src/logic/index.js] file written with same contents +//// [/src/logic/index.js.map] file written with same contents +//// [/src/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "../core/index.d.ts": { + "version": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "affectsGlobalScope": false + }, + "../core/anothermodule.d.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "explainFiles": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/src/tests/index.d.ts] file written with same contents +//// [/src/tests/index.js] file written with same contents +//// [/src/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "../core/index.d.ts": { + "version": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "affectsGlobalScope": false + }, + "../core/anothermodule.d.ts": { + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "affectsGlobalScope": false + }, + "../logic/index.d.ts": { + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "affectsGlobalScope": false + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "explainFiles": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.d.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.d.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: incremental-declaration-doesnt-change +Input:: +//// [/src/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + +export class someClass { } +class someClass2 { } + + + +Output:: +/lib/tsc --b /src/tests --explainFiles --v +[12:07:00 AM] Projects in this build: + * src/core/tsconfig.json + * src/logic/tsconfig.json + * src/tests/tsconfig.json + +[12:07:00 AM] Project 'src/core/tsconfig.json' is out of date because oldest output 'src/core/anotherModule.js' is older than newest input 'src/core/index.ts' + +[12:07:00 AM] Building project '/src/core/tsconfig.json'... + +[12:07:00 AM] Updating unchanged output timestamps of project '/src/core/tsconfig.json'... + +lib/lib.d.ts + Default library +src/core/anotherModule.ts + Matched by include pattern '**/*' in 'src/core/tsconfig.json' +src/core/index.ts + Matched by include pattern '**/*' in 'src/core/tsconfig.json' +src/core/some_decl.d.ts + Matched by include pattern '**/*' in 'src/core/tsconfig.json' +[12:07:00 AM] Project 'src/logic/tsconfig.json' is up to date with .d.ts files from its dependencies + +[12:07:00 AM] Updating output timestamps of project '/src/logic/tsconfig.json'... + +[12:07:00 AM] Project 'src/tests/tsconfig.json' is up to date with .d.ts files from its dependencies + +[12:07:00 AM] Updating output timestamps of project '/src/tests/tsconfig.json'... + +exitCode:: ExitStatus.Success + + +//// [/src/core/index.d.ts] file written with same contents +//// [/src/core/index.d.ts.map] file written with same contents +//// [/src/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someClass = exports.multiply = exports.leftPad = exports.someString = void 0; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; +var someClass = /** @class */ (function () { + function someClass() { + } + return someClass; +}()); +exports.someClass = someClass; +var someClass2 = /** @class */ (function () { + function someClass2() { + } + return someClass2; +}()); + + +//// [/src/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "affectsGlobalScope": false + }, + "./index.ts": { + "version": "-11293323834-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClass { }\nclass someClass2 { }", + "signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "affectsGlobalScope": false + }, + "./some_decl.d.ts": { + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "explainFiles": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/watchMode/demo/updates-with-bad-reference.js b/tests/baselines/reference/tsbuild/watchMode/demo/updates-with-bad-reference.js index c15390100b44e..fee6acfb28316 100644 --- a/tests/baselines/reference/tsbuild/watchMode/demo/updates-with-bad-reference.js +++ b/tests/baselines/reference/tsbuild/watchMode/demo/updates-with-bad-reference.js @@ -184,15 +184,31 @@ Output::   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ core/utilities.ts:1:20 - error TS6059: File '/user/username/projects/demo/animals/index.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files. + The file is in the program because: + Imported via '../animals' from file '/user/username/projects/demo/core/utilities.ts' + Imported via '.' from file '/user/username/projects/demo/animals/dog.ts' 1 import * as A from '../animals';    ~~~~~~~~~~~~ + animals/dog.ts:1:20 + 1 import Animal from '.'; +    ~~~ + File is included via import here. + core/utilities.ts:1:20 - error TS6307: File '/user/username/projects/demo/animals/index.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern. + The file is in the program because: + Imported via '../animals' from file '/user/username/projects/demo/core/utilities.ts' + Imported via '.' from file '/user/username/projects/demo/animals/dog.ts' 1 import * as A from '../animals';    ~~~~~~~~~~~~ + animals/dog.ts:1:20 + 1 import Animal from '.'; +    ~~~ + File is included via import here. + [12:00:57 AM] Project 'animals/tsconfig.json' can't be built because its dependency 'core' has errors [12:00:58 AM] Skipping build of project '/user/username/projects/demo/animals/tsconfig.json' because its dependency '/user/username/projects/demo/core' has errors @@ -417,15 +433,31 @@ Output::   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ core/utilities.ts:2:20 - error TS6059: File '/user/username/projects/demo/animals/index.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files. + The file is in the program because: + Imported via '../animals' from file '/user/username/projects/demo/core/utilities.ts' + Imported via '.' from file '/user/username/projects/demo/animals/dog.ts' 2 import * as A from '../animals';    ~~~~~~~~~~~~ + animals/dog.ts:1:20 + 1 import Animal from '.'; +    ~~~ + File is included via import here. + core/utilities.ts:2:20 - error TS6307: File '/user/username/projects/demo/animals/index.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern. + The file is in the program because: + Imported via '../animals' from file '/user/username/projects/demo/core/utilities.ts' + Imported via '.' from file '/user/username/projects/demo/animals/dog.ts' 2 import * as A from '../animals';    ~~~~~~~~~~~~ + animals/dog.ts:1:20 + 1 import Animal from '.'; +    ~~~ + File is included via import here. + [12:01:11 AM] Found 7 errors. Watching for file changes. diff --git a/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink-moduleCaseChange.js b/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink-moduleCaseChange.js index e6002ba6134b7..c190744661c2d 100644 --- a/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink-moduleCaseChange.js +++ b/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink-moduleCaseChange.js @@ -55,27 +55,35 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -p pkg3 --listFiles +/a/lib/tsc.js -p pkg3 --explainFiles Output:: pkg3/src/keys.ts:2:14 - error TS2742: The inferred type of 'ADMIN' cannot be named without a reference to '../../pkg2/node_modules/@raymondfeng/pkg1/dist'. This is likely not portable. A type annotation is necessary. 2 export const ADMIN = MetadataAccessor.create('1');    ~~~~~ -/a/lib/lib.d.ts -/user/username/projects/myProject/pkg1/dist/types.d.ts -/user/username/projects/myProject/pkg1/dist/index.d.ts -/user/username/projects/myproject/pkg2/dist/types.d.ts -/user/username/projects/myproject/pkg2/dist/index.d.ts -/user/username/projects/myproject/pkg3/src/keys.ts -/user/username/projects/myproject/pkg3/src/index.ts +../../../../a/lib/lib.d.ts + Default library for target 'es5' +pkg1/dist/types.d.ts + Imported via './types' from file 'pkg1/dist/index.d.ts' +pkg1/dist/index.d.ts + Imported via '@raymondfeng/pkg1' from file 'pkg2/dist/types.d.ts' with packageId '@raymondfeng/pkg1/dist/index.d.ts@1.0.0' +pkg2/dist/types.d.ts + Imported via './types' from file 'pkg2/dist/index.d.ts' +pkg2/dist/index.d.ts + Imported via "@raymondfeng/pkg2" from file 'pkg3/src/keys.ts' with packageId '@raymondfeng/pkg2/dist/index.d.ts@1.0.0' +pkg3/src/keys.ts + Imported via './keys' from file 'pkg3/src/index.ts' + Matched by include pattern '**/*' in 'pkg3/tsconfig.json' +pkg3/src/index.ts + Matched by include pattern '**/*' in 'pkg3/tsconfig.json' Found 1 error. Program root files: ["/user/username/projects/myproject/pkg3/src/index.ts","/user/username/projects/myproject/pkg3/src/keys.ts"] -Program options: {"outDir":"/user/username/projects/myproject/pkg3/dist","rootDir":"/user/username/projects/myproject/pkg3/src","target":1,"module":1,"strict":true,"esModuleInterop":true,"declaration":true,"project":"/user/username/projects/myproject/pkg3","listFiles":true,"configFilePath":"/user/username/projects/myproject/pkg3/tsconfig.json"} +Program options: {"outDir":"/user/username/projects/myproject/pkg3/dist","rootDir":"/user/username/projects/myproject/pkg3/src","target":1,"module":1,"strict":true,"esModuleInterop":true,"declaration":true,"project":"/user/username/projects/myproject/pkg3","explainFiles":true,"configFilePath":"/user/username/projects/myproject/pkg3/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink.js b/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink.js index a0105fb97dae7..14407ff2b68e4 100644 --- a/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink.js +++ b/tests/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink.js @@ -55,27 +55,35 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -p pkg3 --listFiles +/a/lib/tsc.js -p pkg3 --explainFiles Output:: pkg3/src/keys.ts:2:14 - error TS2742: The inferred type of 'ADMIN' cannot be named without a reference to '../../pkg2/node_modules/@raymondfeng/pkg1/dist'. This is likely not portable. A type annotation is necessary. 2 export const ADMIN = MetadataAccessor.create('1');    ~~~~~ -/a/lib/lib.d.ts -/user/username/projects/myproject/pkg1/dist/types.d.ts -/user/username/projects/myproject/pkg1/dist/index.d.ts -/user/username/projects/myproject/pkg2/dist/types.d.ts -/user/username/projects/myproject/pkg2/dist/index.d.ts -/user/username/projects/myproject/pkg3/src/keys.ts -/user/username/projects/myproject/pkg3/src/index.ts +../../../../a/lib/lib.d.ts + Default library for target 'es5' +pkg1/dist/types.d.ts + Imported via './types' from file 'pkg1/dist/index.d.ts' +pkg1/dist/index.d.ts + Imported via '@raymondfeng/pkg1' from file 'pkg2/dist/types.d.ts' with packageId '@raymondfeng/pkg1/dist/index.d.ts@1.0.0' +pkg2/dist/types.d.ts + Imported via './types' from file 'pkg2/dist/index.d.ts' +pkg2/dist/index.d.ts + Imported via "@raymondfeng/pkg2" from file 'pkg3/src/keys.ts' with packageId '@raymondfeng/pkg2/dist/index.d.ts@1.0.0' +pkg3/src/keys.ts + Imported via './keys' from file 'pkg3/src/index.ts' + Matched by include pattern '**/*' in 'pkg3/tsconfig.json' +pkg3/src/index.ts + Matched by include pattern '**/*' in 'pkg3/tsconfig.json' Found 1 error. Program root files: ["/user/username/projects/myproject/pkg3/src/index.ts","/user/username/projects/myproject/pkg3/src/keys.ts"] -Program options: {"outDir":"/user/username/projects/myproject/pkg3/dist","rootDir":"/user/username/projects/myproject/pkg3/src","target":1,"module":1,"strict":true,"esModuleInterop":true,"declaration":true,"project":"/user/username/projects/myproject/pkg3","listFiles":true,"configFilePath":"/user/username/projects/myproject/pkg3/tsconfig.json"} +Program options: {"outDir":"/user/username/projects/myproject/pkg3/dist","rootDir":"/user/username/projects/myproject/pkg3/src","target":1,"module":1,"strict":true,"esModuleInterop":true,"declaration":true,"project":"/user/username/projects/myproject/pkg3","explainFiles":true,"configFilePath":"/user/username/projects/myproject/pkg3/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-moduleCaseChange.js b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-moduleCaseChange.js index 09a878dacd609..894a7c71e7b1b 100644 --- a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-moduleCaseChange.js +++ b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-moduleCaseChange.js @@ -85,7 +85,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -p plugin-one --listFiles +/a/lib/tsc.js -p plugin-one --explainFiles Output:: ======== Resolving module 'typescript-fsa' from '/user/username/projects/myproject/plugin-one/action.ts'. ======== Module resolution kind is not specified, using 'NodeJs'. @@ -131,16 +131,23 @@ File '/user/username/projects/myProject/plugin-two/node_modules/typescript-fsa/i File '/user/username/projects/myProject/plugin-two/node_modules/typescript-fsa/index.d.ts' exist - use it as a name resolution result. Resolving real path for '/user/username/projects/myProject/plugin-two/node_modules/typescript-fsa/index.d.ts', result '/user/username/projects/myProject/plugin-two/node_modules/typescript-fsa/index.d.ts'. ======== Module name 'typescript-fsa' was successfully resolved to '/user/username/projects/myProject/plugin-two/node_modules/typescript-fsa/index.d.ts' with Package ID 'typescript-fsa/index.d.ts@3.0.0-beta-2'. ======== -/a/lib/lib.d.ts -/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts -/user/username/projects/myproject/plugin-one/action.ts -/user/username/projects/myProject/plugin-two/node_modules/typescript-fsa/index.d.ts -/user/username/projects/myProject/plugin-two/index.d.ts -/user/username/projects/myproject/plugin-one/index.ts +../../../../a/lib/lib.d.ts + Default library for target 'es5' +plugin-one/node_modules/typescript-fsa/index.d.ts + Imported via "typescript-fsa" from file 'plugin-one/action.ts' with packageId 'typescript-fsa/index.d.ts@3.0.0-beta-2' +plugin-one/action.ts + Matched by include pattern '**/*' in 'plugin-one/tsconfig.json' +plugin-two/node_modules/typescript-fsa/index.d.ts + Imported via "typescript-fsa" from file 'plugin-two/index.d.ts' with packageId 'typescript-fsa/index.d.ts@3.0.0-beta-2' + File redirects to file 'plugin-one/node_modules/typescript-fsa/index.d.ts' +plugin-two/index.d.ts + Imported via "plugin-two" from file 'plugin-one/index.ts' +plugin-one/index.ts + Matched by include pattern '**/*' in 'plugin-one/tsconfig.json' Program root files: ["/user/username/projects/myproject/plugin-one/action.ts","/user/username/projects/myproject/plugin-one/index.ts"] -Program options: {"target":1,"declaration":true,"traceResolution":true,"project":"/user/username/projects/myproject/plugin-one","listFiles":true,"configFilePath":"/user/username/projects/myproject/plugin-one/tsconfig.json"} +Program options: {"target":1,"declaration":true,"traceResolution":true,"project":"/user/username/projects/myproject/plugin-one","explainFiles":true,"configFilePath":"/user/username/projects/myproject/plugin-one/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link-moduleCaseChange.js b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link-moduleCaseChange.js index 05f8553a3ca52..f659972f6555f 100644 --- a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link-moduleCaseChange.js +++ b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link-moduleCaseChange.js @@ -87,7 +87,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -p plugin-one --listFiles +/a/lib/tsc.js -p plugin-one --explainFiles Output:: ======== Resolving module 'plugin-two' from '/user/username/projects/myproject/plugin-one/index.ts'. ======== Module resolution kind is not specified, using 'NodeJs'. @@ -145,15 +145,21 @@ File '/user/username/projects/myProject/plugin-two/node_modules/typescript-fsa/i File '/user/username/projects/myProject/plugin-two/node_modules/typescript-fsa/index.d.ts' exist - use it as a name resolution result. Resolving real path for '/user/username/projects/myProject/plugin-two/node_modules/typescript-fsa/index.d.ts', result '/user/username/projects/myProject/plugin-two/node_modules/typescript-fsa/index.d.ts'. ======== Module name 'typescript-fsa' was successfully resolved to '/user/username/projects/myProject/plugin-two/node_modules/typescript-fsa/index.d.ts' with Package ID 'typescript-fsa/index.d.ts@3.0.0-beta-2'. ======== -/a/lib/lib.d.ts -/user/username/projects/myProject/plugin-two/node_modules/typescript-fsa/index.d.ts -/user/username/projects/myProject/plugin-two/dist/commonjs/index.d.ts -/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts -/user/username/projects/myproject/plugin-one/index.ts +../../../../a/lib/lib.d.ts + Default library for target 'es5' +plugin-two/node_modules/typescript-fsa/index.d.ts + Imported via "typescript-fsa" from file 'plugin-two/dist/commonjs/index.d.ts' with packageId 'typescript-fsa/index.d.ts@3.0.0-beta-2' +plugin-two/dist/commonjs/index.d.ts + Imported via "plugin-two" from file 'plugin-one/index.ts' with packageId 'plugin-two/dist/commonjs/index.d.ts@0.1.3' +plugin-one/node_modules/typescript-fsa/index.d.ts + Imported via "typescript-fsa" from file 'plugin-one/index.ts' with packageId 'typescript-fsa/index.d.ts@3.0.0-beta-2' + File redirects to file 'plugin-two/node_modules/typescript-fsa/index.d.ts' +plugin-one/index.ts + Matched by include pattern '**/*' in 'plugin-one/tsconfig.json' Program root files: ["/user/username/projects/myproject/plugin-one/index.ts"] -Program options: {"target":1,"declaration":true,"traceResolution":true,"project":"/user/username/projects/myproject/plugin-one","listFiles":true,"configFilePath":"/user/username/projects/myproject/plugin-one/tsconfig.json"} +Program options: {"target":1,"declaration":true,"traceResolution":true,"project":"/user/username/projects/myproject/plugin-one","explainFiles":true,"configFilePath":"/user/username/projects/myproject/plugin-one/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js index 180a722409148..2568b26f610bf 100644 --- a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js +++ b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js @@ -87,7 +87,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -p plugin-one --listFiles +/a/lib/tsc.js -p plugin-one --explainFiles Output:: ======== Resolving module 'plugin-two' from '/user/username/projects/myproject/plugin-one/index.ts'. ======== Module resolution kind is not specified, using 'NodeJs'. @@ -145,15 +145,21 @@ File '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/i File '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts' exist - use it as a name resolution result. Resolving real path for '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts', result '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts'. ======== Module name 'typescript-fsa' was successfully resolved to '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts' with Package ID 'typescript-fsa/index.d.ts@3.0.0-beta-2'. ======== -/a/lib/lib.d.ts -/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts -/user/username/projects/myproject/plugin-two/dist/commonjs/index.d.ts -/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts -/user/username/projects/myproject/plugin-one/index.ts +../../../../a/lib/lib.d.ts + Default library for target 'es5' +plugin-two/node_modules/typescript-fsa/index.d.ts + Imported via "typescript-fsa" from file 'plugin-two/dist/commonjs/index.d.ts' with packageId 'typescript-fsa/index.d.ts@3.0.0-beta-2' +plugin-two/dist/commonjs/index.d.ts + Imported via "plugin-two" from file 'plugin-one/index.ts' with packageId 'plugin-two/dist/commonjs/index.d.ts@0.1.3' +plugin-one/node_modules/typescript-fsa/index.d.ts + Imported via "typescript-fsa" from file 'plugin-one/index.ts' with packageId 'typescript-fsa/index.d.ts@3.0.0-beta-2' + File redirects to file 'plugin-two/node_modules/typescript-fsa/index.d.ts' +plugin-one/index.ts + Matched by include pattern '**/*' in 'plugin-one/tsconfig.json' Program root files: ["/user/username/projects/myproject/plugin-one/index.ts"] -Program options: {"target":1,"declaration":true,"traceResolution":true,"project":"/user/username/projects/myproject/plugin-one","listFiles":true,"configFilePath":"/user/username/projects/myproject/plugin-one/tsconfig.json"} +Program options: {"target":1,"declaration":true,"traceResolution":true,"project":"/user/username/projects/myproject/plugin-one","explainFiles":true,"configFilePath":"/user/username/projects/myproject/plugin-one/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package.js b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package.js index 74e65dc17d2ef..c14025b0fc02c 100644 --- a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package.js +++ b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package.js @@ -85,7 +85,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -p plugin-one --listFiles +/a/lib/tsc.js -p plugin-one --explainFiles Output:: ======== Resolving module 'typescript-fsa' from '/user/username/projects/myproject/plugin-one/action.ts'. ======== Module resolution kind is not specified, using 'NodeJs'. @@ -131,16 +131,23 @@ File '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/i File '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts' exist - use it as a name resolution result. Resolving real path for '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts', result '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts'. ======== Module name 'typescript-fsa' was successfully resolved to '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts' with Package ID 'typescript-fsa/index.d.ts@3.0.0-beta-2'. ======== -/a/lib/lib.d.ts -/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts -/user/username/projects/myproject/plugin-one/action.ts -/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts -/user/username/projects/myproject/plugin-two/index.d.ts -/user/username/projects/myproject/plugin-one/index.ts +../../../../a/lib/lib.d.ts + Default library for target 'es5' +plugin-one/node_modules/typescript-fsa/index.d.ts + Imported via "typescript-fsa" from file 'plugin-one/action.ts' with packageId 'typescript-fsa/index.d.ts@3.0.0-beta-2' +plugin-one/action.ts + Matched by include pattern '**/*' in 'plugin-one/tsconfig.json' +plugin-two/node_modules/typescript-fsa/index.d.ts + Imported via "typescript-fsa" from file 'plugin-two/index.d.ts' with packageId 'typescript-fsa/index.d.ts@3.0.0-beta-2' + File redirects to file 'plugin-one/node_modules/typescript-fsa/index.d.ts' +plugin-two/index.d.ts + Imported via "plugin-two" from file 'plugin-one/index.ts' +plugin-one/index.ts + Matched by include pattern '**/*' in 'plugin-one/tsconfig.json' Program root files: ["/user/username/projects/myproject/plugin-one/action.ts","/user/username/projects/myproject/plugin-one/index.ts"] -Program options: {"target":1,"declaration":true,"traceResolution":true,"project":"/user/username/projects/myproject/plugin-one","listFiles":true,"configFilePath":"/user/username/projects/myproject/plugin-one/tsconfig.json"} +Program options: {"target":1,"declaration":true,"traceResolution":true,"project":"/user/username/projects/myproject/plugin-one","explainFiles":true,"configFilePath":"/user/username/projects/myproject/plugin-one/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsc/incremental/initial-build/when-passing-filename-for-buildinfo-on-commandline.js b/tests/baselines/reference/tsc/incremental/initial-build/when-passing-filename-for-buildinfo-on-commandline.js index cff14598d83c1..e3b7fcd8c52e3 100644 --- a/tests/baselines/reference/tsc/incremental/initial-build/when-passing-filename-for-buildinfo-on-commandline.js +++ b/tests/baselines/reference/tsc/incremental/initial-build/when-passing-filename-for-buildinfo-on-commandline.js @@ -31,7 +31,11 @@ export const x = 10; Output:: -/lib/tsc --incremental --p src/project --tsBuildInfoFile src/project/.tsbuildinfo +/lib/tsc --incremental --p src/project --tsBuildInfoFile src/project/.tsbuildinfo --explainFiles +lib/lib.d.ts + Default library for target 'es5' +src/project/src/main.ts + Matched by include pattern 'src/**/*.ts' in 'src/project/tsconfig.json' exitCode:: ExitStatus.Success @@ -56,6 +60,7 @@ exitCode:: ExitStatus.Success "incremental": true, "project": "./", "tsBuildInfoFile": "./.tsbuildinfo", + "explainFiles": true, "configFilePath": "./tsconfig.json" }, "referencedMap": {}, @@ -82,7 +87,11 @@ Input:: Output:: -/lib/tsc --incremental --p src/project --tsBuildInfoFile src/project/.tsbuildinfo +/lib/tsc --incremental --p src/project --tsBuildInfoFile src/project/.tsbuildinfo --explainFiles +lib/lib.d.ts + Default library for target 'es5' +src/project/src/main.ts + Matched by include pattern 'src/**/*.ts' in 'src/project/tsconfig.json' exitCode:: ExitStatus.Success diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/jsxImportSource-option-changed.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/jsxImportSource-option-changed.js new file mode 100644 index 0000000000000..87e836285298e --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/jsxImportSource-option-changed.js @@ -0,0 +1,103 @@ +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/node_modules/react/Jsx-runtime/index.d.ts] +export namespace JSX { + interface Element {} + interface IntrinsicElements { + div: { + propA?: boolean; + }; + } +} +export function jsx(...args: any[]): void; +export function jsxs(...args: any[]): void; +export const Fragment: unique symbol; + + +//// [/user/username/projects/myproject/node_modules/react/package.json] +{"name":"react","version":"0.0.1"} + +//// [/user/username/projects/myproject/index.tsx] +export const App = () =>
; + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"jsx":"react-jsx","jsxImportSource":"react","forceConsistentCasingInFileNames":true},"files":["node_modules/react/Jsx-runtime/index.d.ts","index.tsx"]} + + +/a/lib/tsc.js --w --p . --explainFiles +Output:: +>> Screen clear +[12:00:31 AM] Starting compilation in watch mode... + +error TS1149: File name '/user/username/projects/myproject/node_modules/react/jsx-runtime/index.d.ts' differs from already included file name '/user/username/projects/myproject/node_modules/react/Jsx-runtime/index.d.ts' only in casing. + The file is in the program because: + Part of 'files' list in tsconfig.json + Imported via "react/jsx-runtime" from file '/user/username/projects/myproject/index.tsx' with packageId 'react/jsx-runtime/index.d.ts@0.0.1' to import 'jsx' and 'jsxs' factory functions + + tsconfig.json:1:115 + 1 {"compilerOptions":{"jsx":"react-jsx","jsxImportSource":"react","forceConsistentCasingInFileNames":true},"files":["node_modules/react/Jsx-runtime/index.d.ts","index.tsx"]} +    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + File is matched by 'files' list specified here. + +../../../../a/lib/lib.d.ts + Default library +node_modules/react/Jsx-runtime/index.d.ts + Part of 'files' list in tsconfig.json + Imported via "react/jsx-runtime" from file 'index.tsx' with packageId 'react/jsx-runtime/index.d.ts@0.0.1' to import 'jsx' and 'jsxs' factory functions +index.tsx + Part of 'files' list in tsconfig.json +[12:00:34 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/node_modules/react/Jsx-runtime/index.d.ts","/user/username/projects/myproject/index.tsx"] +Program options: {"jsx":4,"jsxImportSource":"react","forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/node_modules/react/Jsx-runtime/index.d.ts +/user/username/projects/myproject/index.tsx + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/node_modules/react/jsx-runtime/index.d.ts: + {"fileName":"/user/username/projects/myproject/node_modules/react/Jsx-runtime/index.d.ts","pollingInterval":250} +/user/username/projects/myproject/index.tsx: + {"fileName":"/user/username/projects/myproject/index.tsx","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules: + {"directoryName":"/user/username/projects/myproject/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/index.js] +"use strict"; +exports.__esModule = true; +exports.App = void 0; +var jsx_runtime_1 = require("react/jsx-runtime"); +var App = function () { return jsx_runtime_1.jsx("div", { propA: true }, void 0); }; +exports.App = App; + + diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js index 57377994bdffd..d56f497a9a0db 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js @@ -96,6 +96,9 @@ Output:: [12:00:32 AM] File change detected. Starting incremental compilation... user/username/projects/myproject/another.ts:1:24 - error TS1261: Already included file name '/user/username/projects/myproject/Logger.ts' differs from file name '/user/username/projects/myproject/logger.ts' only in casing. + The file is in the program because: + Imported via "./Logger" from file '/user/username/projects/myproject/another.ts' + Matched by include pattern '**/*' in '/user/username/projects/myproject/tsconfig.json' 1 import { logger } from "./Logger"; new logger();    ~~~~~~~~~~ diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-relative-information-file-location-changes.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-relative-information-file-location-changes.js new file mode 100644 index 0000000000000..165657371ce24 --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-relative-information-file-location-changes.js @@ -0,0 +1,218 @@ +Input:: +//// [/user/username/projects/myproject/moduleA.ts] +import a = require("./ModuleC") + +//// [/user/username/projects/myproject/moduleB.ts] +import a = require("./moduleC") + +//// [/user/username/projects/myproject/moduleC.ts] +export const x = 10; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true}} + + +/a/lib/tsc.js --w --p . --explainFiles +Output:: +>> Screen clear +[12:00:25 AM] Starting compilation in watch mode... + +moduleA.ts:1:20 - error TS1261: Already included file name '/user/username/projects/myproject/ModuleC.ts' differs from file name '/user/username/projects/myproject/moduleC.ts' only in casing. + The file is in the program because: + Imported via "./ModuleC" from file '/user/username/projects/myproject/moduleA.ts' + Imported via "./moduleC" from file '/user/username/projects/myproject/moduleB.ts' + Matched by include pattern '**/*' in 'tsconfig.json' + +1 import a = require("./ModuleC") +   ~~~~~~~~~~~ + + moduleB.ts:1:20 + 1 import a = require("./moduleC") +    ~~~~~~~~~~~ + File is included via import here. + +moduleB.ts:1:20 - error TS1149: File name '/user/username/projects/myproject/moduleC.ts' differs from already included file name '/user/username/projects/myproject/ModuleC.ts' only in casing. + The file is in the program because: + Imported via "./ModuleC" from file '/user/username/projects/myproject/moduleA.ts' + Imported via "./moduleC" from file '/user/username/projects/myproject/moduleB.ts' + Matched by include pattern '**/*' in 'tsconfig.json' + +1 import a = require("./moduleC") +   ~~~~~~~~~~~ + + moduleA.ts:1:20 + 1 import a = require("./ModuleC") +    ~~~~~~~~~~~ + File is included via import here. + +../../../../a/lib/lib.d.ts + Default library +ModuleC.ts + Imported via "./ModuleC" from file 'moduleA.ts' + Imported via "./moduleC" from file 'moduleB.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +moduleA.ts + Matched by include pattern '**/*' in 'tsconfig.json' +moduleB.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:32 AM] Found 2 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/moduleA.ts","/user/username/projects/myproject/moduleB.ts","/user/username/projects/myproject/moduleC.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/ModuleC.ts +/user/username/projects/myproject/moduleA.ts +/user/username/projects/myproject/moduleB.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/ModuleC.ts +/user/username/projects/myproject/moduleA.ts +/user/username/projects/myproject/moduleB.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/modulea.ts: + {"fileName":"/user/username/projects/myproject/moduleA.ts","pollingInterval":250} +/user/username/projects/myproject/modulec.ts: + {"fileName":"/user/username/projects/myproject/ModuleC.ts","pollingInterval":250} +/user/username/projects/myproject/moduleb.ts: + {"fileName":"/user/username/projects/myproject/moduleB.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/ModuleC.js] +"use strict"; +exports.__esModule = true; +exports.x = void 0; +exports.x = 10; + + +//// [/user/username/projects/myproject/moduleA.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/moduleB.js] +"use strict"; +exports.__esModule = true; + + + +Change:: Prepend a line to moduleA + +Input:: +//// [/user/username/projects/myproject/moduleA.ts] +// some comment + import a = require("./ModuleC") + + +Output:: +>> Screen clear +[12:00:35 AM] File change detected. Starting incremental compilation... + +moduleA.ts:2:40 - error TS1261: Already included file name '/user/username/projects/myproject/ModuleC.ts' differs from file name '/user/username/projects/myproject/moduleC.ts' only in casing. + The file is in the program because: + Imported via "./ModuleC" from file '/user/username/projects/myproject/moduleA.ts' + Imported via "./moduleC" from file '/user/username/projects/myproject/moduleB.ts' + Matched by include pattern '**/*' in 'tsconfig.json' + +2 import a = require("./ModuleC") +   ~~~~~~~~~~~ + + moduleB.ts:1:20 + 1 import a = require("./moduleC") +    ~~~~~~~~~~~ + File is included via import here. + +moduleB.ts:1:20 - error TS1149: File name '/user/username/projects/myproject/moduleC.ts' differs from already included file name '/user/username/projects/myproject/ModuleC.ts' only in casing. + The file is in the program because: + Imported via "./ModuleC" from file '/user/username/projects/myproject/moduleA.ts' + Imported via "./moduleC" from file '/user/username/projects/myproject/moduleB.ts' + Matched by include pattern '**/*' in 'tsconfig.json' + +1 import a = require("./moduleC") +   ~~~~~~~~~~~ + + moduleA.ts:2:40 + 2 import a = require("./ModuleC") +    ~~~~~~~~~~~ + File is included via import here. + +../../../../a/lib/lib.d.ts + Default library +ModuleC.ts + Imported via "./ModuleC" from file 'moduleA.ts' + Imported via "./moduleC" from file 'moduleB.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +moduleA.ts + Matched by include pattern '**/*' in 'tsconfig.json' +moduleB.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:39 AM] Found 2 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/moduleA.ts","/user/username/projects/myproject/moduleB.ts","/user/username/projects/myproject/moduleC.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/ModuleC.ts +/user/username/projects/myproject/moduleA.ts +/user/username/projects/myproject/moduleB.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/moduleA.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/modulea.ts: + {"fileName":"/user/username/projects/myproject/moduleA.ts","pollingInterval":250} +/user/username/projects/myproject/modulec.ts: + {"fileName":"/user/username/projects/myproject/ModuleC.ts","pollingInterval":250} +/user/username/projects/myproject/moduleb.ts: + {"fileName":"/user/username/projects/myproject/moduleB.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/moduleA.js] file written with same contents diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-renaming-file-with-different-casing.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-renaming-file-with-different-casing.js index 79d15bc113904..74a3abb50d63e 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-renaming-file-with-different-casing.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-renaming-file-with-different-casing.js @@ -94,6 +94,9 @@ Output:: [12:00:32 AM] File change detected. Starting incremental compilation... user/username/projects/myproject/another.ts:1:24 - error TS1149: File name '/user/username/projects/myproject/logger.ts' differs from already included file name '/user/username/projects/myproject/Logger.ts' only in casing. + The file is in the program because: + Matched by include pattern '**/*' in '/user/username/projects/myproject/tsconfig.json' + Imported via "./logger" from file '/user/username/projects/myproject/another.ts' 1 import { logger } from "./logger"; new logger();    ~~~~~~~~~~ diff --git a/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-incremental.js b/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-incremental.js index 205227d3155f7..bba0093600c9b 100644 --- a/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-incremental.js +++ b/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-incremental.js @@ -55,12 +55,18 @@ export const App = () =>
; {"compilerOptions":{"module":"commonjs","jsx":"react-jsx","incremental":true,"jsxImportSource":"react"}} -/a/lib/tsc.js -i +/a/lib/tsc.js -i --explainFiles Output:: +../../../../a/lib/lib.d.ts + Default library +node_modules/react/jsx-runtime/index.d.ts + Imported via "react/jsx-runtime" from file 'index.tsx' with packageId 'react/jsx-runtime/index.d.ts@0.0.1' to import 'jsx' and 'jsxs' factory functions +index.tsx + Matched by include pattern '**/*' in 'tsconfig.json' Program root files: ["/users/username/projects/project/index.tsx"] -Program options: {"module":1,"jsx":4,"incremental":true,"jsxImportSource":"react","configFilePath":"/users/username/projects/project/tsconfig.json"} +Program options: {"module":1,"jsx":4,"incremental":true,"jsxImportSource":"react","explainFiles":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -114,6 +120,7 @@ exports.App = App; "jsx": 4, "incremental": true, "jsxImportSource": "react", + "explainFiles": true, "configFilePath": "./tsconfig.json" }, "referencedMap": { @@ -150,13 +157,19 @@ Output:: 1 export const App = () =>
;    ~~~~~ +../../../../a/lib/lib.d.ts + Default library +node_modules/preact/jsx-runtime/index.d.ts + Imported via "preact/jsx-runtime" from file 'index.tsx' with packageId 'preact/jsx-runtime/index.d.ts@0.0.1' to import 'jsx' and 'jsxs' factory functions +index.tsx + Matched by include pattern '**/*' in 'tsconfig.json' Found 1 error. Program root files: ["/users/username/projects/project/index.tsx"] -Program options: {"module":1,"jsx":4,"incremental":true,"jsxImportSource":"preact","configFilePath":"/users/username/projects/project/tsconfig.json"} +Program options: {"module":1,"jsx":4,"incremental":true,"jsxImportSource":"preact","explainFiles":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -210,6 +223,7 @@ exports.App = App; "jsx": 4, "incremental": true, "jsxImportSource": "preact", + "explainFiles": true, "configFilePath": "./tsconfig.json" }, "referencedMap": { diff --git a/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-watch.js b/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-watch.js index 8b1551931b504..c92a51ac14b7b 100644 --- a/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-watch.js +++ b/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-watch.js @@ -55,17 +55,23 @@ export const App = () =>
; {"compilerOptions":{"module":"commonjs","jsx":"react-jsx","incremental":true,"jsxImportSource":"react"}} -/a/lib/tsc.js -w +/a/lib/tsc.js -w --explainFiles Output:: >> Screen clear [12:00:39 AM] Starting compilation in watch mode... +../../../../a/lib/lib.d.ts + Default library +node_modules/react/jsx-runtime/index.d.ts + Imported via "react/jsx-runtime" from file 'index.tsx' with packageId 'react/jsx-runtime/index.d.ts@0.0.1' to import 'jsx' and 'jsxs' factory functions +index.tsx + Matched by include pattern '**/*' in 'tsconfig.json' [12:00:44 AM] Found 0 errors. Watching for file changes. Program root files: ["/users/username/projects/project/index.tsx"] -Program options: {"module":1,"jsx":4,"incremental":true,"jsxImportSource":"react","watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program options: {"module":1,"jsx":4,"incremental":true,"jsxImportSource":"react","watch":true,"explainFiles":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -134,6 +140,7 @@ exports.App = App; "incremental": true, "jsxImportSource": "react", "watch": true, + "explainFiles": true, "configFilePath": "./tsconfig.json" }, "referencedMap": { @@ -173,12 +180,18 @@ Output:: 1 export const App = () =>
;    ~~~~~ +../../../../a/lib/lib.d.ts + Default library +node_modules/preact/jsx-runtime/index.d.ts + Imported via "preact/jsx-runtime" from file 'index.tsx' with packageId 'preact/jsx-runtime/index.d.ts@0.0.1' to import 'jsx' and 'jsxs' factory functions +index.tsx + Matched by include pattern '**/*' in 'tsconfig.json' [12:00:55 AM] Found 1 error. Watching for file changes. Program root files: ["/users/username/projects/project/index.tsx"] -Program options: {"module":1,"jsx":4,"incremental":true,"jsxImportSource":"preact","watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program options: {"module":1,"jsx":4,"incremental":true,"jsxImportSource":"preact","watch":true,"explainFiles":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -247,6 +260,7 @@ exports.App = App; "incremental": true, "jsxImportSource": "preact", "watch": true, + "explainFiles": true, "configFilePath": "./tsconfig.json" }, "referencedMap": { diff --git a/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js b/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js index 20c5e6b051fda..af5a1e98a1b21 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js +++ b/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js @@ -22,17 +22,23 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w /a/b/f1.ts +/a/lib/tsc.js -w /a/b/f1.ts --explainFiles Output:: >> Screen clear [12:00:19 AM] Starting compilation in watch mode... +a/lib/lib.d.ts + Default library +a/b/f2.ts + Imported via "./f2" from file 'a/b/f1.ts' +a/b/f1.ts + Root file specified for compilation [12:00:24 AM] Found 0 errors. Watching for file changes. Program root files: ["/a/b/f1.ts"] -Program options: {"watch":true} +Program options: {"watch":true,"explainFiles":true} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -93,12 +99,20 @@ Output:: >> Screen clear [12:00:27 AM] File change detected. Starting incremental compilation... +a/lib/lib.d.ts + Default library +a/c/f3.ts + Imported via "../c/f3" from file 'a/b/f2.ts' +a/b/f2.ts + Imported via "./f2" from file 'a/b/f1.ts' +a/b/f1.ts + Root file specified for compilation [12:00:36 AM] Found 0 errors. Watching for file changes. Program root files: ["/a/b/f1.ts"] -Program options: {"watch":true} +Program options: {"watch":true,"explainFiles":true} Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/programUpdates/handle-recreated-files-correctly.js b/tests/baselines/reference/tscWatch/programUpdates/handle-recreated-files-correctly.js index eb5885870a322..3588abbe1c500 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/handle-recreated-files-correctly.js +++ b/tests/baselines/reference/tscWatch/programUpdates/handle-recreated-files-correctly.js @@ -22,17 +22,23 @@ let y = 1 {} -/a/lib/tsc.js -w -p /a/b/tsconfig.json +/a/lib/tsc.js -w -p /a/b/tsconfig.json --explainFiles Output:: >> Screen clear [12:00:17 AM] Starting compilation in watch mode... +a/lib/lib.d.ts + Default library +a/b/commonFile1.ts + Matched by include pattern '**/*' in 'a/b/tsconfig.json' +a/b/commonFile2.ts + Matched by include pattern '**/*' in 'a/b/tsconfig.json' [12:00:22 AM] Found 0 errors. Watching for file changes. Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] -Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program options: {"watch":true,"project":"/a/b/tsconfig.json","explainFiles":true,"configFilePath":"/a/b/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -82,12 +88,16 @@ Output:: >> Screen clear [12:00:24 AM] File change detected. Starting incremental compilation... +a/lib/lib.d.ts + Default library +a/b/commonFile1.ts + Matched by include pattern '**/*' in 'a/b/tsconfig.json' [12:00:28 AM] Found 0 errors. Watching for file changes. Program root files: ["/a/b/commonFile1.ts"] -Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program options: {"watch":true,"project":"/a/b/tsconfig.json","explainFiles":true,"configFilePath":"/a/b/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -127,12 +137,18 @@ Output:: >> Screen clear [12:00:31 AM] File change detected. Starting incremental compilation... +a/lib/lib.d.ts + Default library +a/b/commonFile1.ts + Matched by include pattern '**/*' in 'a/b/tsconfig.json' +a/b/commonFile2.ts + Matched by include pattern '**/*' in 'a/b/tsconfig.json' [12:00:38 AM] Found 0 errors. Watching for file changes. Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] -Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program options: {"watch":true,"project":"/a/b/tsconfig.json","explainFiles":true,"configFilePath":"/a/b/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-ignore-non-existing-files-specified-in-the-config-file.js b/tests/baselines/reference/tscWatch/programUpdates/should-ignore-non-existing-files-specified-in-the-config-file.js index e2a8cdce9e378..43bceddc3f800 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-ignore-non-existing-files-specified-in-the-config-file.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-ignore-non-existing-files-specified-in-the-config-file.js @@ -34,6 +34,13 @@ Output:: [12:00:17 AM] Starting compilation in watch mode... error TS6053: File '/a/b/commonFile3.ts' not found. + The file is in the program because: + Part of 'files' list in tsconfig.json + + a/b/tsconfig.json:5:25 + 5 "commonFile3.ts" +    ~~~~~~~~~~~~~~~~ + File is matched by 'files' list specified here. [12:00:20 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-reflect-change-in-config-file.js b/tests/baselines/reference/tscWatch/programUpdates/should-reflect-change-in-config-file.js index d41065c03ece6..88f484eeffa98 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-reflect-change-in-config-file.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-reflect-change-in-config-file.js @@ -25,17 +25,23 @@ let y = 1 } -/a/lib/tsc.js -w -p /a/b/tsconfig.json +/a/lib/tsc.js -w -p /a/b/tsconfig.json --explainFiles Output:: >> Screen clear [12:00:17 AM] Starting compilation in watch mode... +a/lib/lib.d.ts + Default library +a/b/commonFile1.ts + Part of 'files' list in tsconfig.json +a/b/commonFile2.ts + Part of 'files' list in tsconfig.json [12:00:22 AM] Found 0 errors. Watching for file changes. Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] -Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program options: {"watch":true,"project":"/a/b/tsconfig.json","explainFiles":true,"configFilePath":"/a/b/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -88,12 +94,16 @@ Output:: >> Screen clear [12:00:26 AM] File change detected. Starting incremental compilation... +a/lib/lib.d.ts + Default library +a/b/commonFile1.ts + Part of 'files' list in tsconfig.json [12:00:30 AM] Found 0 errors. Watching for file changes. Program root files: ["/a/b/commonFile1.ts"] -Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program options: {"watch":true,"project":"/a/b/tsconfig.json","explainFiles":true,"configFilePath":"/a/b/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-forceConsistentCasingInFileNames-changes.js b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-forceConsistentCasingInFileNames-changes.js index 5eae4da6c82d4..e8ca6a37de01e 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-forceConsistentCasingInFileNames-changes.js +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-forceConsistentCasingInFileNames-changes.js @@ -92,10 +92,19 @@ Output:: [12:00:24 AM] File change detected. Starting incremental compilation... b.ts:1:43 - error TS1149: File name '/A.ts' differs from already included file name '/a.ts' only in casing. + The file is in the program because: + Matched by include pattern '**/*' in '/tsconfig.json' + Imported via './a' from file '/b.ts' + Imported via './A' from file '/b.ts' 1 import {C} from './a'; import * as A from './A';    ~~~~~ + b.ts:1:17 + 1 import {C} from './a'; import * as A from './A'; +    ~~~~~ + File is included via import here. + [12:00:25 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/resolutionCache/when-types-in-compiler-option-are-global-and-installed-at-later-point.js b/tests/baselines/reference/tscWatch/resolutionCache/when-types-in-compiler-option-are-global-and-installed-at-later-point.js index 304530fabeca1..689fe588be1ec 100644 --- a/tests/baselines/reference/tscWatch/resolutionCache/when-types-in-compiler-option-are-global-and-installed-at-later-point.js +++ b/tests/baselines/reference/tscWatch/resolutionCache/when-types-in-compiler-option-are-global-and-installed-at-later-point.js @@ -25,6 +25,13 @@ Output:: [12:00:23 AM] Starting compilation in watch mode... error TS2688: Cannot find type definition file for '@myapp/ts-types'. + The file is in the program because: + Entry point of type library '@myapp/ts-types' specified in compilerOptions + + user/username/projects/myproject/tsconfig.json:1:46 + 1 {"compilerOptions":{"module":"none","types":["@myapp/ts-types"]}} +    ~~~~~~~~~~~~~~~~~ + File is entry point of type library specified here. [12:00:26 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/with-non-synchronous-watch-directory-renaming-a-file.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/with-non-synchronous-watch-directory-renaming-a-file.js index 8dda5d677a7b0..a8f3fa8b5cdc4 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/with-non-synchronous-watch-directory-renaming-a-file.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/with-non-synchronous-watch-directory-renaming-a-file.js @@ -125,6 +125,8 @@ Output:: [12:00:37 AM] File change detected. Starting incremental compilation... error TS6053: File '/user/username/projects/myproject/src/file2.ts' not found. + The file is in the program because: + Matched by include pattern '**/*' in '/user/username/projects/myproject/tsconfig.json' [12:00:41 AM] Found 1 error. Watching for file changes. diff --git a/tests/cases/fourslash/codeFixTopLevelAwait_notAModule.ts b/tests/cases/fourslash/codeFixTopLevelAwait_notAModule.ts index 453571cb87592..338b3c83fd2ef 100644 --- a/tests/cases/fourslash/codeFixTopLevelAwait_notAModule.ts +++ b/tests/cases/fourslash/codeFixTopLevelAwait_notAModule.ts @@ -1,4 +1,5 @@ /// +// @filename: /dir/a.ts ////declare const p: Promise; ////await p; // @filename: /dir/tsconfig.json