mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #34525 from microsoft/testChanges
Converted more tsc and tsbuild tests to baseline
This commit is contained in:
@@ -1227,7 +1227,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
/*@internal*/
|
||||
export function parseBuildCommand(args: string[]): ParsedBuildCommand {
|
||||
export function parseBuildCommand(args: readonly string[]): ParsedBuildCommand {
|
||||
let buildOptionNameMap: OptionNameMap | undefined;
|
||||
const returnBuildOptionNameMap = () => (buildOptionNameMap || (buildOptionNameMap = createOptionNameMap(buildOpts)));
|
||||
const { options, fileNames: projects, errors } = parseCommandLineWorker(returnBuildOptionNameMap, [
|
||||
@@ -1258,125 +1258,12 @@ namespace ts {
|
||||
return { buildOptions, projects, errors };
|
||||
}
|
||||
|
||||
function getDiagnosticText(_message: DiagnosticMessage, ..._args: any[]): string {
|
||||
/* @internal */
|
||||
export function getDiagnosticText(_message: DiagnosticMessage, ..._args: any[]): string {
|
||||
const diagnostic = createCompilerDiagnostic.apply(undefined, arguments);
|
||||
return <string>diagnostic.messageText;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function printVersion() {
|
||||
sys.write(getDiagnosticText(Diagnostics.Version_0, version) + sys.newLine);
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function printHelp(optionsList: readonly CommandLineOption[], syntaxPrefix = "") {
|
||||
const output: string[] = [];
|
||||
|
||||
// We want to align our "syntax" and "examples" commands to a certain margin.
|
||||
const syntaxLength = getDiagnosticText(Diagnostics.Syntax_Colon_0, "").length;
|
||||
const examplesLength = getDiagnosticText(Diagnostics.Examples_Colon_0, "").length;
|
||||
let marginLength = Math.max(syntaxLength, examplesLength);
|
||||
|
||||
// Build up the syntactic skeleton.
|
||||
let syntax = makePadding(marginLength - syntaxLength);
|
||||
syntax += `tsc ${syntaxPrefix}[${getDiagnosticText(Diagnostics.options)}] [${getDiagnosticText(Diagnostics.file)}...]`;
|
||||
|
||||
output.push(getDiagnosticText(Diagnostics.Syntax_Colon_0, syntax));
|
||||
output.push(sys.newLine + sys.newLine);
|
||||
|
||||
// Build up the list of examples.
|
||||
const padding = makePadding(marginLength);
|
||||
output.push(getDiagnosticText(Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + sys.newLine);
|
||||
output.push(padding + "tsc --outFile file.js file.ts" + sys.newLine);
|
||||
output.push(padding + "tsc @args.txt" + sys.newLine);
|
||||
output.push(padding + "tsc --build tsconfig.json" + sys.newLine);
|
||||
output.push(sys.newLine);
|
||||
|
||||
output.push(getDiagnosticText(Diagnostics.Options_Colon) + sys.newLine);
|
||||
|
||||
// We want our descriptions to align at the same column in our output,
|
||||
// so we keep track of the longest option usage string.
|
||||
marginLength = 0;
|
||||
const usageColumn: string[] = []; // Things like "-d, --declaration" go in here.
|
||||
const descriptionColumn: string[] = [];
|
||||
|
||||
const optionsDescriptionMap = createMap<string[]>(); // Map between option.description and list of option.type if it is a kind
|
||||
|
||||
for (const option of optionsList) {
|
||||
// If an option lacks a description,
|
||||
// it is not officially supported.
|
||||
if (!option.description) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let usageText = " ";
|
||||
if (option.shortName) {
|
||||
usageText += "-" + option.shortName;
|
||||
usageText += getParamType(option);
|
||||
usageText += ", ";
|
||||
}
|
||||
|
||||
usageText += "--" + option.name;
|
||||
usageText += getParamType(option);
|
||||
|
||||
usageColumn.push(usageText);
|
||||
let description: string;
|
||||
|
||||
if (option.name === "lib") {
|
||||
description = getDiagnosticText(option.description);
|
||||
const element = (<CommandLineOptionOfListType>option).element;
|
||||
const typeMap = <Map<number | string>>element.type;
|
||||
optionsDescriptionMap.set(description, arrayFrom(typeMap.keys()).map(key => `'${key}'`));
|
||||
}
|
||||
else {
|
||||
description = getDiagnosticText(option.description);
|
||||
}
|
||||
|
||||
descriptionColumn.push(description);
|
||||
|
||||
// Set the new margin for the description column if necessary.
|
||||
marginLength = Math.max(usageText.length, marginLength);
|
||||
}
|
||||
|
||||
// Special case that can't fit in the loop.
|
||||
const usageText = " @<" + getDiagnosticText(Diagnostics.file) + ">";
|
||||
usageColumn.push(usageText);
|
||||
descriptionColumn.push(getDiagnosticText(Diagnostics.Insert_command_line_options_and_files_from_a_file));
|
||||
marginLength = Math.max(usageText.length, marginLength);
|
||||
|
||||
// Print out each row, aligning all the descriptions on the same column.
|
||||
for (let i = 0; i < usageColumn.length; i++) {
|
||||
const usage = usageColumn[i];
|
||||
const description = descriptionColumn[i];
|
||||
const kindsList = optionsDescriptionMap.get(description);
|
||||
output.push(usage + makePadding(marginLength - usage.length + 2) + description + sys.newLine);
|
||||
|
||||
if (kindsList) {
|
||||
output.push(makePadding(marginLength + 4));
|
||||
for (const kind of kindsList) {
|
||||
output.push(kind + " ");
|
||||
}
|
||||
output.push(sys.newLine);
|
||||
}
|
||||
}
|
||||
|
||||
for (const line of output) {
|
||||
sys.write(line);
|
||||
}
|
||||
return;
|
||||
|
||||
function getParamType(option: CommandLineOption) {
|
||||
if (option.paramType !== undefined) {
|
||||
return " " + getDiagnosticText(option.paramType);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function makePadding(paddingLength: number): string {
|
||||
return Array(paddingLength + 1).join(" ");
|
||||
}
|
||||
}
|
||||
|
||||
export type DiagnosticReporter = (diagnostic: Diagnostic) => void;
|
||||
/**
|
||||
* Reports config file diagnostics
|
||||
@@ -1801,6 +1688,12 @@ namespace ts {
|
||||
references: readonly ProjectReference[] | undefined;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export interface ConvertToTSConfigHost {
|
||||
getCurrentDirectory(): string;
|
||||
useCaseSensitiveFileNames: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an uncommented, complete tsconfig for use with "--showConfig"
|
||||
* @param configParseResult options to be generated into tsconfig.json
|
||||
@@ -1808,7 +1701,7 @@ namespace ts {
|
||||
* @param host provides current directory and case sensitivity services
|
||||
*/
|
||||
/** @internal */
|
||||
export function convertToTSConfig(configParseResult: ParsedCommandLine, configFileName: string, host: { getCurrentDirectory(): string, useCaseSensitiveFileNames: boolean }): TSConfig {
|
||||
export function convertToTSConfig(configParseResult: ParsedCommandLine, configFileName: string, host: ConvertToTSConfigHost): TSConfig {
|
||||
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames);
|
||||
const files = map(
|
||||
filter(
|
||||
@@ -1816,7 +1709,8 @@ namespace ts {
|
||||
(!configParseResult.configFileSpecs || !configParseResult.configFileSpecs.validatedIncludeSpecs) ? _ => true : matchesSpecs(
|
||||
configFileName,
|
||||
configParseResult.configFileSpecs.validatedIncludeSpecs,
|
||||
configParseResult.configFileSpecs.validatedExcludeSpecs
|
||||
configParseResult.configFileSpecs.validatedExcludeSpecs,
|
||||
host,
|
||||
)
|
||||
),
|
||||
f => getRelativePathFromFile(getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), getNormalizedAbsolutePath(f, host.getCurrentDirectory()), getCanonicalFileName)
|
||||
@@ -1854,11 +1748,11 @@ namespace ts {
|
||||
return specs;
|
||||
}
|
||||
|
||||
function matchesSpecs(path: string, includeSpecs: readonly string[] | undefined, excludeSpecs: readonly string[] | undefined): (path: string) => boolean {
|
||||
function matchesSpecs(path: string, includeSpecs: readonly string[] | undefined, excludeSpecs: readonly string[] | undefined, host: ConvertToTSConfigHost): (path: string) => boolean {
|
||||
if (!includeSpecs) return _ => true;
|
||||
const patterns = getFileMatcherPatterns(path, excludeSpecs, includeSpecs, sys.useCaseSensitiveFileNames, sys.getCurrentDirectory());
|
||||
const excludeRe = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, sys.useCaseSensitiveFileNames);
|
||||
const includeRe = patterns.includeFilePattern && getRegexFromPattern(patterns.includeFilePattern, sys.useCaseSensitiveFileNames);
|
||||
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);
|
||||
if (includeRe) {
|
||||
if (excludeRe) {
|
||||
return path => !(includeRe.test(path) && !excludeRe.test(path));
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace ts {
|
||||
/** Parses config file using System interface */
|
||||
export function parseConfigFileWithSystem(configFileName: string, optionsToExtend: CompilerOptions, system: System, reportDiagnostic: DiagnosticReporter) {
|
||||
const host: ParseConfigFileHost = <any>system;
|
||||
host.onUnRecoverableConfigFileDiagnostic = diagnostic => reportUnrecoverableDiagnostic(sys, reportDiagnostic, diagnostic);
|
||||
host.onUnRecoverableConfigFileDiagnostic = diagnostic => reportUnrecoverableDiagnostic(system, reportDiagnostic, diagnostic);
|
||||
const result = getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host);
|
||||
host.onUnRecoverableConfigFileDiagnostic = undefined!; // TODO: GH#18217
|
||||
return result;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
"unittests/services/extract/helpers.ts",
|
||||
"unittests/tsbuild/helpers.ts",
|
||||
"../tsc/executeCommandLine.ts",
|
||||
"unittests/tsc/helpers.ts",
|
||||
"unittests/tscWatch/helpers.ts",
|
||||
"unittests/tsserver/helpers.ts",
|
||||
|
||||
@@ -9,40 +9,12 @@ namespace ts {
|
||||
projFs = undefined!; // Release the contents
|
||||
});
|
||||
|
||||
function outputs(folder: string) {
|
||||
return [
|
||||
`${folder}/index.js`,
|
||||
`${folder}/index.d.ts`,
|
||||
`${folder}/tsconfig.tsbuildinfo`
|
||||
];
|
||||
}
|
||||
|
||||
it("verify that subsequent builds after initial build doesnt build anything", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
createSolutionBuilder(host, ["/src"], { verbose: true }).build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/src/folder/tsconfig.json", "src/src/folder2/tsconfig.json", "src/src/tsconfig.json", "src/tests/tsconfig.json", "src/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/folder/tsconfig.json", "src/src/folder/index.js"],
|
||||
[Diagnostics.Building_project_0, "/src/src/folder/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/folder2/tsconfig.json", "src/src/folder2/index.js"],
|
||||
[Diagnostics.Building_project_0, "/src/src/folder2/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tests/tsconfig.json", "src/tests/index.js"],
|
||||
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"],
|
||||
);
|
||||
verifyOutputsPresent(fs, [
|
||||
...outputs("/src/src/folder"),
|
||||
...outputs("/src/src/folder2"),
|
||||
...outputs("/src/tests"),
|
||||
]);
|
||||
host.clearDiagnostics();
|
||||
createSolutionBuilder(host, ["/src"], { verbose: true }).build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/src/folder/tsconfig.json", "src/src/folder2/tsconfig.json", "src/src/tsconfig.json", "src/tests/tsconfig.json", "src/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/src/folder/tsconfig.json", "src/src/folder/index.ts", "src/src/folder/index.js"],
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/src/folder2/tsconfig.json", "src/src/folder2/index.ts", "src/src/folder2/index.js"],
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/tests/tsconfig.json", "src/tests/index.ts", "src/tests/index.js"],
|
||||
);
|
||||
verifyTscIncrementalEdits({
|
||||
scenario: "containerOnlyReferenced",
|
||||
subScenario: "verify that subsequent builds after initial build doesnt build anything",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src", "--verbose"],
|
||||
incrementalScenarios: [noChangeRun]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,152 +9,41 @@ namespace ts {
|
||||
projFs = undefined!; // Release the contents
|
||||
});
|
||||
|
||||
function coreOutputs(): string[] {
|
||||
return [
|
||||
"/src/lib/core/utilities.js",
|
||||
"/src/lib/core/utilities.d.ts",
|
||||
"/src/lib/core/tsconfig.tsbuildinfo"
|
||||
];
|
||||
}
|
||||
|
||||
function animalOutputs(): string[] {
|
||||
return [
|
||||
"/src/lib/animals/animal.js",
|
||||
"/src/lib/animals/animal.d.ts",
|
||||
"/src/lib/animals/index.js",
|
||||
"/src/lib/animals/index.d.ts",
|
||||
"/src/lib/animals/dog.js",
|
||||
"/src/lib/animals/dog.d.ts",
|
||||
"/src/lib/animals/tsconfig.tsbuildinfo"
|
||||
];
|
||||
}
|
||||
|
||||
function zooOutputs(): string[] {
|
||||
return [
|
||||
"/src/lib/zoo/zoo.js",
|
||||
"/src/lib/zoo/zoo.d.ts",
|
||||
"/src/lib/zoo/tsconfig.tsbuildinfo"
|
||||
];
|
||||
}
|
||||
|
||||
interface VerifyBuild {
|
||||
modifyDiskLayout: (fs: vfs.FileSystem) => void;
|
||||
expectedExitStatus: ExitStatus;
|
||||
expectedDiagnostics: (fs: vfs.FileSystem) => fakes.ExpectedDiagnostic[];
|
||||
expectedOutputs: readonly string[];
|
||||
notExpectedOutputs: readonly string[];
|
||||
}
|
||||
|
||||
function verifyBuild({ modifyDiskLayout, expectedExitStatus, expectedDiagnostics, expectedOutputs, notExpectedOutputs }: VerifyBuild) {
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
modifyDiskLayout(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tsconfig.json"], { verbose: true });
|
||||
const exitStatus = builder.build();
|
||||
assert.equal(exitStatus, expectedExitStatus);
|
||||
host.assertDiagnosticMessages(...expectedDiagnostics(fs));
|
||||
verifyOutputsPresent(fs, expectedOutputs);
|
||||
verifyOutputsAbsent(fs, notExpectedOutputs);
|
||||
}
|
||||
|
||||
it("in master branch with everything setup correctly, reports no error", () => {
|
||||
verifyBuild({
|
||||
modifyDiskLayout: noop,
|
||||
expectedExitStatus: ExitStatus.Success,
|
||||
expectedDiagnostics: () => [
|
||||
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/animals/tsconfig.json", "src/zoo/tsconfig.json", "src/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/lib/core/utilities.js"],
|
||||
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/animals/tsconfig.json", "src/lib/animals/animal.js"],
|
||||
[Diagnostics.Building_project_0, "/src/animals/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/zoo/tsconfig.json", "src/lib/zoo/zoo.js"],
|
||||
[Diagnostics.Building_project_0, "/src/zoo/tsconfig.json"]
|
||||
],
|
||||
expectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()],
|
||||
notExpectedOutputs: emptyArray
|
||||
});
|
||||
verifyTsc({
|
||||
scenario: "demo",
|
||||
subScenario: "in master branch with everything setup correctly and reports no error",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tsconfig.json", "--verbose"]
|
||||
});
|
||||
|
||||
it("in circular branch reports the error about it by stopping build", () => {
|
||||
verifyBuild({
|
||||
modifyDiskLayout: fs => replaceText(
|
||||
fs,
|
||||
"/src/core/tsconfig.json",
|
||||
"}",
|
||||
`},
|
||||
verifyTsc({
|
||||
scenario: "demo",
|
||||
subScenario: "in circular branch reports the error about it by stopping build",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tsconfig.json", "--verbose"],
|
||||
modifyFs: fs => replaceText(
|
||||
fs,
|
||||
"/src/core/tsconfig.json",
|
||||
"}",
|
||||
`},
|
||||
"references": [
|
||||
{
|
||||
"path": "../zoo"
|
||||
}
|
||||
]`
|
||||
),
|
||||
expectedExitStatus: ExitStatus.ProjectReferenceCycle_OutputsSkipped,
|
||||
expectedDiagnostics: () => [
|
||||
getExpectedDiagnosticForProjectsInBuild("src/animals/tsconfig.json", "src/zoo/tsconfig.json", "src/core/tsconfig.json", "src/tsconfig.json"),
|
||||
errorDiagnostic([
|
||||
Diagnostics.Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0,
|
||||
[
|
||||
"/src/tsconfig.json",
|
||||
"/src/core/tsconfig.json",
|
||||
"/src/zoo/tsconfig.json",
|
||||
"/src/animals/tsconfig.json"
|
||||
].join("\r\n")
|
||||
])
|
||||
],
|
||||
expectedOutputs: emptyArray,
|
||||
notExpectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()]
|
||||
});
|
||||
)
|
||||
});
|
||||
|
||||
it("in bad-ref branch reports the error about files not in rootDir at the import location", () => {
|
||||
verifyBuild({
|
||||
modifyDiskLayout: fs => prependText(
|
||||
fs,
|
||||
"/src/core/utilities.ts",
|
||||
`import * as A from '../animals';
|
||||
verifyTsc({
|
||||
scenario: "demo",
|
||||
subScenario: "in bad-ref branch reports the error about files not in rootDir at the import location",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tsconfig.json", "--verbose"],
|
||||
modifyFs: fs => prependText(
|
||||
fs,
|
||||
"/src/core/utilities.ts",
|
||||
`import * as A from '../animals';
|
||||
`
|
||||
),
|
||||
expectedExitStatus: ExitStatus.DiagnosticsPresent_OutputsSkipped,
|
||||
expectedDiagnostics: fs => [
|
||||
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/animals/tsconfig.json", "src/zoo/tsconfig.json", "src/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/lib/core/utilities.js"],
|
||||
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
|
||||
{
|
||||
message: [Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/animal.ts", "/src/core"],
|
||||
location: expectedLocationIndexOf(fs, "/src/animals/index.ts", `'./animal'`),
|
||||
},
|
||||
{
|
||||
message: [Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, "/src/animals/animal.ts", "/src/core/tsconfig.json"],
|
||||
location: expectedLocationIndexOf(fs, "/src/animals/index.ts", `'./animal'`),
|
||||
},
|
||||
{
|
||||
message: [Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/dog.ts", "/src/core"],
|
||||
location: expectedLocationIndexOf(fs, "/src/animals/index.ts", `'./dog'`),
|
||||
},
|
||||
{
|
||||
message: [Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, "/src/animals/dog.ts", "/src/core/tsconfig.json"],
|
||||
location: expectedLocationIndexOf(fs, "/src/animals/index.ts", `'./dog'`),
|
||||
},
|
||||
{
|
||||
message: [Diagnostics._0_is_declared_but_its_value_is_never_read, "A"],
|
||||
location: expectedLocationIndexOf(fs, "/src/core/utilities.ts", `import * as A from '../animals';`),
|
||||
},
|
||||
{
|
||||
message: [Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/index.ts", "/src/core"],
|
||||
location: expectedLocationIndexOf(fs, "/src/core/utilities.ts", `'../animals'`),
|
||||
},
|
||||
{
|
||||
message: [Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, "/src/animals/index.ts", "/src/core/tsconfig.json"],
|
||||
location: expectedLocationIndexOf(fs, "/src/core/utilities.ts", `'../animals'`),
|
||||
},
|
||||
[Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, "src/animals/tsconfig.json", "src/core"],
|
||||
[Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, "/src/animals/tsconfig.json", "/src/core"],
|
||||
[Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built, "src/zoo/tsconfig.json", "src/animals"],
|
||||
[Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_was_not_built, "/src/zoo/tsconfig.json", "/src/animals"],
|
||||
],
|
||||
expectedOutputs: emptyArray,
|
||||
notExpectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()]
|
||||
});
|
||||
)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,40 +1,25 @@
|
||||
namespace ts {
|
||||
const projFs = loadProjectFromDisk("tests/projects/empty-files");
|
||||
|
||||
const allExpectedOutputs = [
|
||||
"/src/core/index.js",
|
||||
"/src/core/index.d.ts",
|
||||
"/src/core/index.d.ts.map",
|
||||
];
|
||||
|
||||
describe("unittests:: tsbuild - empty files option in tsconfig", () => {
|
||||
it("has empty files diagnostic when files is empty and no references are provided", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/no-references"], { dry: false, force: false, verbose: false });
|
||||
|
||||
host.clearDiagnostics();
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages({
|
||||
message: [Diagnostics.The_files_list_in_config_file_0_is_empty, "/src/no-references/tsconfig.json"],
|
||||
location: expectedLocationLastIndexOf(fs, "/src/no-references/tsconfig.json", "[]"),
|
||||
});
|
||||
|
||||
// Check for outputs to not be written.
|
||||
verifyOutputsAbsent(fs, allExpectedOutputs);
|
||||
let projFs: vfs.FileSystem;
|
||||
before(() => {
|
||||
projFs = loadProjectFromDisk("tests/projects/empty-files");
|
||||
});
|
||||
after(() => {
|
||||
projFs = undefined!;
|
||||
});
|
||||
|
||||
it("does not have empty files diagnostic when files is empty and references are provided", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/with-references"], { dry: false, force: false, verbose: false });
|
||||
verifyTsc({
|
||||
scenario: "emptyFiles",
|
||||
subScenario: "has empty files diagnostic when files is empty and no references are provided",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/no-references"],
|
||||
});
|
||||
|
||||
host.clearDiagnostics();
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(/*empty*/);
|
||||
|
||||
// Check for outputs to be written.
|
||||
verifyOutputsPresent(fs, allExpectedOutputs);
|
||||
verifyTsc({
|
||||
scenario: "emptyFiles",
|
||||
subScenario: "does not have empty files diagnostic when files is empty and references are provided",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/with-references"],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -279,6 +279,7 @@ interface Symbol {
|
||||
buildKind: BuildKind;
|
||||
modifyFs: (fs: vfs.FileSystem) => void;
|
||||
subScenario?: string;
|
||||
commandLineArgs?: readonly string[];
|
||||
}
|
||||
|
||||
export interface VerifyTsBuildInput extends TscCompile {
|
||||
@@ -318,7 +319,12 @@ interface Symbol {
|
||||
verifyTscBaseline(() => sys);
|
||||
});
|
||||
|
||||
for (const { buildKind, modifyFs, subScenario: incrementalSubScenario } of incrementalScenarios) {
|
||||
for (const {
|
||||
buildKind,
|
||||
modifyFs,
|
||||
subScenario: incrementalSubScenario,
|
||||
commandLineArgs: incrementalCommandLineArgs
|
||||
} of incrementalScenarios) {
|
||||
describe(incrementalSubScenario || buildKind, () => {
|
||||
let newSys: TscCompileSystem;
|
||||
before(() => {
|
||||
@@ -329,7 +335,7 @@ interface Symbol {
|
||||
subScenario: incrementalSubScenario || subScenario,
|
||||
buildKind,
|
||||
fs: () => sys.vfs,
|
||||
commandLineArgs,
|
||||
commandLineArgs: incrementalCommandLineArgs || commandLineArgs,
|
||||
modifyFs: fs => {
|
||||
tick();
|
||||
modifyFs(fs);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
namespace ts {
|
||||
describe("unittests:: tsbuild:: when tsconfig extends the missing file", () => {
|
||||
it("unittests:: tsbuild - when tsconfig extends the missing file", () => {
|
||||
const projFs = loadProjectFromDisk("tests/projects/missingExtendedConfig");
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tsconfig.json"], {});
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
errorDiagnostic([Diagnostics.The_specified_path_does_not_exist_Colon_0, "/src/foobar.json"]),
|
||||
errorDiagnostic([Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, "/src/tsconfig.first.json", "[\"**/*\"]", "[]"]),
|
||||
errorDiagnostic([Diagnostics.The_specified_path_does_not_exist_Colon_0, "/src/foobar.json"]),
|
||||
errorDiagnostic([Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, "/src/tsconfig.second.json", "[\"**/*\"]", "[]"])
|
||||
);
|
||||
let projFs: vfs.FileSystem;
|
||||
before(() => {
|
||||
projFs = loadProjectFromDisk("tests/projects/missingExtendedConfig");
|
||||
});
|
||||
after(() => {
|
||||
projFs = undefined!;
|
||||
});
|
||||
verifyTsc({
|
||||
scenario: "missingExtendedConfig",
|
||||
subScenario: "when tsconfig extends the missing file",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tsconfig.json"],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -56,11 +56,6 @@ namespace ts {
|
||||
]
|
||||
];
|
||||
const relSources = sources.map(([config, sources]) => [relName(config), sources.map(relName)]) as any as [Sources, Sources, Sources];
|
||||
let expectedOutputFiles = [
|
||||
...outputFiles[project.first],
|
||||
...outputFiles[project.second],
|
||||
...outputFiles[project.third]
|
||||
];
|
||||
let initialExpectedDiagnostics: readonly fakes.ExpectedDiagnostic[] = [
|
||||
getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relSources[project.first][source.config], relOutputFiles[project.first][ext.js]],
|
||||
@@ -75,7 +70,6 @@ namespace ts {
|
||||
});
|
||||
after(() => {
|
||||
outFileFs = undefined!;
|
||||
expectedOutputFiles = undefined!;
|
||||
initialExpectedDiagnostics = undefined!;
|
||||
});
|
||||
|
||||
@@ -166,71 +160,37 @@ namespace ts {
|
||||
baselineOnly: true
|
||||
});
|
||||
|
||||
it("clean projects", () => {
|
||||
function getOutFileFsAfterBuild() {
|
||||
const fs = outFileFs.shadow();
|
||||
const expectedOutputs = [
|
||||
...outputFiles[project.first],
|
||||
...outputFiles[project.second],
|
||||
...outputFiles[project.third]
|
||||
];
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host);
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(...initialExpectedDiagnostics);
|
||||
// Verify they exist
|
||||
verifyOutputsPresent(fs, expectedOutputs);
|
||||
host.clearDiagnostics();
|
||||
builder.clean();
|
||||
host.assertDiagnosticMessages(/*none*/);
|
||||
// Verify they are gone
|
||||
verifyOutputsAbsent(fs, expectedOutputs);
|
||||
// Subsequent clean shouldn't throw / etc
|
||||
builder.clean();
|
||||
fs.makeReadonly();
|
||||
return fs;
|
||||
}
|
||||
|
||||
verifyTscIncrementalEdits({
|
||||
scenario: "outFile",
|
||||
subScenario: "clean projects",
|
||||
fs: getOutFileFsAfterBuild,
|
||||
commandLineArgs: ["--b", "/src/third", "--clean"],
|
||||
incrementalScenarios: [noChangeRun]
|
||||
});
|
||||
|
||||
it("verify buildInfo absence results in new build", () => {
|
||||
const { fs, tick } = getFsWithTime(outFileFs);
|
||||
const expectedOutputs = [
|
||||
...outputFiles[project.first],
|
||||
...outputFiles[project.second],
|
||||
...outputFiles[project.third]
|
||||
];
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
let builder = createSolutionBuilder(host);
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(...initialExpectedDiagnostics);
|
||||
// Verify they exist
|
||||
verifyOutputsPresent(fs, expectedOutputs);
|
||||
// Delete bundle info
|
||||
host.clearDiagnostics();
|
||||
|
||||
tick();
|
||||
host.deleteFile(outputFiles[project.first][ext.buildinfo]);
|
||||
tick();
|
||||
|
||||
builder = createSolutionBuilder(host);
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relSources[project.first][source.config], relOutputFiles[project.first][ext.buildinfo]],
|
||||
[Diagnostics.Building_project_0, sources[project.first][source.config]],
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, relSources[project.second][source.config], relSources[project.second][source.ts][part.one], relOutputFiles[project.second][ext.js]],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, relSources[project.third][source.config], "src/first"],
|
||||
[Diagnostics.Updating_output_of_project_0, sources[project.third][source.config]],
|
||||
[Diagnostics.Updating_unchanged_output_timestamps_of_project_0, sources[project.third][source.config]],
|
||||
);
|
||||
verifyTsc({
|
||||
scenario: "outFile",
|
||||
subScenario: "verify buildInfo absence results in new build",
|
||||
fs: getOutFileFsAfterBuild,
|
||||
commandLineArgs: ["--b", "/src/third", "--verbose"],
|
||||
modifyFs: fs => fs.unlinkSync(outputFiles[project.first][ext.buildinfo]),
|
||||
});
|
||||
|
||||
it("verify that if incremental is set to false, tsbuildinfo is not generated", () => {
|
||||
const fs = outFileFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
replaceText(fs, sources[project.third][source.config], `"composite": true,`, "");
|
||||
const builder = createSolutionBuilder(host);
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(...initialExpectedDiagnostics);
|
||||
// Verify they exist - without tsbuildinfo for third project
|
||||
verifyOutputsPresent(fs, expectedOutputFiles.slice(0, expectedOutputFiles.length - 2));
|
||||
verifyOutputsAbsent(fs, [outputFiles[project.third][ext.buildinfo]]);
|
||||
verifyTsc({
|
||||
scenario: "outFile",
|
||||
subScenario: "tsbuildinfo is not generated when incremental is set to false",
|
||||
fs: () => outFileFs,
|
||||
commandLineArgs: ["--b", "/src/third", "--verbose"],
|
||||
modifyFs: fs => replaceText(fs, sources[project.third][source.config], `"composite": true,`, ""),
|
||||
});
|
||||
|
||||
it("rebuilds completely when version in tsbuildinfo doesnt match ts version", () => {
|
||||
@@ -747,44 +707,26 @@ ${internal} enum internalEnum { a, b, c }`);
|
||||
});
|
||||
});
|
||||
|
||||
it("non module projects without prepend", () => {
|
||||
const fs = outFileFs.shadow();
|
||||
// No prepend
|
||||
replaceText(fs, sources[project.third][source.config], `{ "path": "../first", "prepend": true }`, `{ "path": "../first" }`);
|
||||
replaceText(fs, sources[project.third][source.config], `{ "path": "../second", "prepend": true }`, `{ "path": "../second" }`);
|
||||
verifyTsc({
|
||||
scenario: "outFile",
|
||||
subScenario: "non module projects without prepend",
|
||||
fs: () => outFileFs,
|
||||
commandLineArgs: ["--b", "/src/third", "--verbose"],
|
||||
modifyFs: fs => {
|
||||
// No prepend
|
||||
replaceText(fs, sources[project.third][source.config], `{ "path": "../first", "prepend": true }`, `{ "path": "../first" }`);
|
||||
replaceText(fs, sources[project.third][source.config], `{ "path": "../second", "prepend": true }`, `{ "path": "../second" }`);
|
||||
|
||||
// Non Modules
|
||||
replaceText(fs, sources[project.first][source.config], `"composite": true,`, `"composite": true, "module": "none",`);
|
||||
replaceText(fs, sources[project.second][source.config], `"composite": true,`, `"composite": true, "module": "none",`);
|
||||
replaceText(fs, sources[project.third][source.config], `"composite": true,`, `"composite": true, "module": "none",`);
|
||||
// Non Modules
|
||||
replaceText(fs, sources[project.first][source.config], `"composite": true,`, `"composite": true, "module": "none",`);
|
||||
replaceText(fs, sources[project.second][source.config], `"composite": true,`, `"composite": true, "module": "none",`);
|
||||
replaceText(fs, sources[project.third][source.config], `"composite": true,`, `"composite": true, "module": "none",`);
|
||||
|
||||
// Own file emit
|
||||
replaceText(fs, sources[project.first][source.config], `"outFile": "./bin/first-output.js",`, "");
|
||||
replaceText(fs, sources[project.second][source.config], `"outFile": "../2/second-output.js",`, "");
|
||||
replaceText(fs, sources[project.third][source.config], `"outFile": "./thirdjs/output/third-output.js",`, "");
|
||||
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host);
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relSources[project.first][source.config], "src/first/first_PART1.js"],
|
||||
[Diagnostics.Building_project_0, sources[project.first][source.config]],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relSources[project.second][source.config], "src/second/second_part1.js"],
|
||||
[Diagnostics.Building_project_0, sources[project.second][source.config]],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relSources[project.third][source.config], "src/third/third_part1.js"],
|
||||
[Diagnostics.Building_project_0, sources[project.third][source.config]]
|
||||
);
|
||||
const expectedOutputFiles = flatMap(sources, ([config, ts]) => [
|
||||
removeFileExtension(config) + Extension.TsBuildInfo,
|
||||
...flatMap(ts, f => [
|
||||
removeFileExtension(f) + Extension.Js,
|
||||
removeFileExtension(f) + Extension.Js + ".map",
|
||||
removeFileExtension(f) + Extension.Dts,
|
||||
removeFileExtension(f) + Extension.Dts + ".map",
|
||||
])
|
||||
]);
|
||||
verifyOutputsPresent(fs, expectedOutputFiles);
|
||||
// Own file emit
|
||||
replaceText(fs, sources[project.first][source.config], `"outFile": "./bin/first-output.js",`, "");
|
||||
replaceText(fs, sources[project.second][source.config], `"outFile": "../2/second-output.js",`, "");
|
||||
replaceText(fs, sources[project.third][source.config], `"outFile": "./thirdjs/output/third-output.js",`, "");
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,113 +9,53 @@ namespace ts {
|
||||
projFs = undefined!; // Release the contents
|
||||
});
|
||||
|
||||
it("verify that it builds correctly", () => {
|
||||
const allExpectedOutputs = [
|
||||
"/src/dist/other/other.js", "/src/dist/other/other.d.ts",
|
||||
"/src/dist/main/a.js", "/src/dist/main/a.d.ts",
|
||||
"/src/dist/main/b.js", "/src/dist/main/b.d.ts"
|
||||
];
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/src/main", "/src/src/other"], {});
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(/*empty*/);
|
||||
verifyOutputsPresent(fs, allExpectedOutputs);
|
||||
verifyTsc({
|
||||
scenario: "projectReferenceWithRootDirInParent",
|
||||
subScenario: "builds correctly",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/src/main", "/src/src/other"],
|
||||
});
|
||||
|
||||
it("verify that it reports error for same .tsbuildinfo file because no rootDir in the base", () => {
|
||||
const allExpectedOutputs = [
|
||||
"/src/dist/other.js", "/src/dist/other.d.ts",
|
||||
"/src/dist/tsconfig.tsbuildinfo"
|
||||
];
|
||||
const missingOutputs = [
|
||||
"/src/dist/a.js", "/src/dist/a.d.ts",
|
||||
"/src/dist/b.js", "/src/dist/b.d.ts"
|
||||
];
|
||||
const fs = projFs.shadow();
|
||||
replaceText(fs, "/src/tsconfig.base.json", `"rootDir": "./src/",`, "");
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/src/main"], { verbose: true });
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/src/other/tsconfig.json", "src/src/main/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/other/tsconfig.json", "src/dist/other.js"],
|
||||
[Diagnostics.Building_project_0, "/src/src/other/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/main/tsconfig.json", "src/dist/a.js"],
|
||||
[Diagnostics.Building_project_0, "/src/src/main/tsconfig.json"],
|
||||
{
|
||||
message: [Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, "/src/dist/tsconfig.tsbuildinfo", "/src/src/other"],
|
||||
location: expectedLocationIndexOf(fs, "/src/src/main/tsconfig.json", `{ "path": "../other" }`),
|
||||
}
|
||||
);
|
||||
verifyOutputsPresent(fs, allExpectedOutputs);
|
||||
verifyOutputsAbsent(fs, missingOutputs);
|
||||
verifyTsc({
|
||||
scenario: "projectReferenceWithRootDirInParent",
|
||||
subScenario: "reports error for same tsbuildinfo file because no rootDir in the base",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/src/main", "--verbose"],
|
||||
modifyFs: fs => replaceText(fs, "/src/tsconfig.base.json", `"rootDir": "./src/",`, ""),
|
||||
});
|
||||
|
||||
it("verify that it reports error for same .tsbuildinfo file", () => {
|
||||
const allExpectedOutputs = [
|
||||
"/src/dist/other.js", "/src/dist/other.d.ts",
|
||||
"/src/dist/tsconfig.tsbuildinfo"
|
||||
];
|
||||
const missingOutputs = [
|
||||
"/src/dist/a.js", "/src/dist/a.d.ts",
|
||||
"/src/dist/b.js", "/src/dist/b.d.ts"
|
||||
];
|
||||
const fs = projFs.shadow();
|
||||
fs.writeFileSync("/src/src/main/tsconfig.json", JSON.stringify({
|
||||
compilerOptions: { composite: true, outDir: "../../dist/" },
|
||||
references: [{ path: "../other" }]
|
||||
}));
|
||||
fs.writeFileSync("/src/src/other/tsconfig.json", JSON.stringify({
|
||||
compilerOptions: { composite: true, outDir: "../../dist/" },
|
||||
}));
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/src/main"], { verbose: true });
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/src/other/tsconfig.json", "src/src/main/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/other/tsconfig.json", "src/dist/other.js"],
|
||||
[Diagnostics.Building_project_0, "/src/src/other/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/main/tsconfig.json", "src/dist/a.js"],
|
||||
[Diagnostics.Building_project_0, "/src/src/main/tsconfig.json"],
|
||||
{
|
||||
message: [Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, "/src/dist/tsconfig.tsbuildinfo", "/src/src/other"],
|
||||
location: expectedLocationIndexOf(fs, "/src/src/main/tsconfig.json", `{"path":"../other"}`),
|
||||
}
|
||||
);
|
||||
verifyOutputsPresent(fs, allExpectedOutputs);
|
||||
verifyOutputsAbsent(fs, missingOutputs);
|
||||
verifyTsc({
|
||||
scenario: "projectReferenceWithRootDirInParent",
|
||||
subScenario: "reports error for same tsbuildinfo file",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/src/main", "--verbose"],
|
||||
modifyFs: fs => {
|
||||
fs.writeFileSync("/src/src/main/tsconfig.json", JSON.stringify({
|
||||
compilerOptions: { composite: true, outDir: "../../dist/" },
|
||||
references: [{ path: "../other" }]
|
||||
}));
|
||||
fs.writeFileSync("/src/src/other/tsconfig.json", JSON.stringify({
|
||||
compilerOptions: { composite: true, outDir: "../../dist/" },
|
||||
}));
|
||||
},
|
||||
});
|
||||
|
||||
it("verify that it reports no error when .tsbuildinfo differ", () => {
|
||||
const allExpectedOutputs = [
|
||||
"/src/dist/other.js", "/src/dist/other.d.ts",
|
||||
"/src/dist/tsconfig.main.tsbuildinfo",
|
||||
"/src/dist/a.js", "/src/dist/a.d.ts",
|
||||
"/src/dist/b.js", "/src/dist/b.d.ts",
|
||||
"/src/dist/tsconfig.other.tsbuildinfo"
|
||||
];
|
||||
const fs = projFs.shadow();
|
||||
fs.renameSync("/src/src/main/tsconfig.json", "/src/src/main/tsconfig.main.json");
|
||||
fs.renameSync("/src/src/other/tsconfig.json", "/src/src/other/tsconfig.other.json");
|
||||
fs.writeFileSync("/src/src/main/tsconfig.main.json", JSON.stringify({
|
||||
compilerOptions: { composite: true, outDir: "../../dist/" },
|
||||
references: [{ path: "../other/tsconfig.other.json" }]
|
||||
}));
|
||||
fs.writeFileSync("/src/src/other/tsconfig.other.json", JSON.stringify({
|
||||
compilerOptions: { composite: true, outDir: "../../dist/" },
|
||||
}));
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/src/main/tsconfig.main.json"], { verbose: true });
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/src/other/tsconfig.other.json", "src/src/main/tsconfig.main.json"),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/other/tsconfig.other.json", "src/dist/other.js"],
|
||||
[Diagnostics.Building_project_0, "/src/src/other/tsconfig.other.json"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/main/tsconfig.main.json", "src/dist/a.js"],
|
||||
[Diagnostics.Building_project_0, "/src/src/main/tsconfig.main.json"]
|
||||
);
|
||||
verifyOutputsPresent(fs, allExpectedOutputs);
|
||||
verifyTsc({
|
||||
scenario: "projectReferenceWithRootDirInParent",
|
||||
subScenario: "reports no error when tsbuildinfo differ",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/src/main/tsconfig.main.json", "--verbose"],
|
||||
modifyFs: fs => {
|
||||
fs.renameSync("/src/src/main/tsconfig.json", "/src/src/main/tsconfig.main.json");
|
||||
fs.renameSync("/src/src/other/tsconfig.json", "/src/src/other/tsconfig.other.json");
|
||||
fs.writeFileSync("/src/src/main/tsconfig.main.json", JSON.stringify({
|
||||
compilerOptions: { composite: true, outDir: "../../dist/" },
|
||||
references: [{ path: "../other/tsconfig.other.json" }]
|
||||
}));
|
||||
fs.writeFileSync("/src/src/other/tsconfig.other.json", JSON.stringify({
|
||||
compilerOptions: { composite: true, outDir: "../../dist/" },
|
||||
}));
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace ts {
|
||||
describe("unittests:: tsbuild:: with resolveJsonModule option on project resolveJsonModuleAndComposite", () => {
|
||||
let projFs: vfs.FileSystem;
|
||||
const allExpectedOutputs = ["/src/dist/src/index.js", "/src/dist/src/index.d.ts", "/src/dist/src/hello.json"];
|
||||
before(() => {
|
||||
projFs = loadProjectFromDisk("tests/projects/resolveJsonModuleAndComposite");
|
||||
});
|
||||
@@ -10,108 +9,64 @@ namespace ts {
|
||||
projFs = undefined!; // Release the contents
|
||||
});
|
||||
|
||||
function verifyProjectWithResolveJsonModule(configFile: string, ...expectedDiagnosticMessages: fakes.ExpectedDiagnostic[]) {
|
||||
const fs = projFs.shadow();
|
||||
verifyProjectWithResolveJsonModuleWithFs(fs, configFile, allExpectedOutputs, ...expectedDiagnosticMessages);
|
||||
}
|
||||
|
||||
function verifyProjectWithResolveJsonModuleWithFs(fs: vfs.FileSystem, configFile: string, allExpectedOutputs: readonly string[], ...expectedDiagnosticMessages: fakes.ExpectedDiagnostic[]) {
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, [configFile], { dry: false, force: false, verbose: false });
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(...expectedDiagnosticMessages);
|
||||
if (!expectedDiagnosticMessages.length) {
|
||||
// Check for outputs. Not an exhaustive list
|
||||
verifyOutputsPresent(fs, allExpectedOutputs);
|
||||
}
|
||||
}
|
||||
|
||||
it("with resolveJsonModule and include only", () => {
|
||||
verifyProjectWithResolveJsonModule(
|
||||
"/src/tsconfig_withInclude.json",
|
||||
{
|
||||
message: [
|
||||
Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern,
|
||||
"/src/src/hello.json",
|
||||
"/src/tsconfig_withInclude.json"
|
||||
],
|
||||
location: expectedLocationIndexOf(projFs, "/src/src/index.ts", `"./hello.json"`)
|
||||
}
|
||||
);
|
||||
verifyTsc({
|
||||
scenario: "resolveJsonModule",
|
||||
subScenario: "include only",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tsconfig_withInclude.json"],
|
||||
});
|
||||
|
||||
it("with resolveJsonModule and include of *.json along with other include", () => {
|
||||
verifyProjectWithResolveJsonModule("/src/tsconfig_withIncludeOfJson.json");
|
||||
verifyTsc({
|
||||
scenario: "resolveJsonModule",
|
||||
subScenario: "include of json along with other include",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tsconfig_withIncludeOfJson.json"],
|
||||
});
|
||||
|
||||
it("with resolveJsonModule and include of *.json along with other include and file name matches ts file", () => {
|
||||
const fs = projFs.shadow();
|
||||
fs.rimrafSync("/src/src/hello.json");
|
||||
fs.writeFileSync("/src/src/index.json", JSON.stringify({ hello: "world" }));
|
||||
fs.writeFileSync("/src/src/index.ts", `import hello from "./index.json"
|
||||
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"],
|
||||
modifyFs: fs => {
|
||||
fs.rimrafSync("/src/src/hello.json");
|
||||
fs.writeFileSync("/src/src/index.json", JSON.stringify({ hello: "world" }));
|
||||
fs.writeFileSync("/src/src/index.ts", `import hello from "./index.json"
|
||||
|
||||
export default hello.hello`);
|
||||
const allExpectedOutputs = ["/src/dist/src/index.js", "/src/dist/src/index.d.ts", "/src/dist/src/index.json"];
|
||||
verifyProjectWithResolveJsonModuleWithFs(
|
||||
fs,
|
||||
"/src/tsconfig_withIncludeOfJson.json",
|
||||
allExpectedOutputs,
|
||||
errorDiagnostic([Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files, "/src/dist/src/index.d.ts"])
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
it("with resolveJsonModule and files containing json file", () => {
|
||||
verifyProjectWithResolveJsonModule("/src/tsconfig_withFiles.json");
|
||||
verifyTsc({
|
||||
scenario: "resolveJsonModule",
|
||||
subScenario: "files containing json file",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tsconfig_withFiles.json"],
|
||||
});
|
||||
|
||||
it("with resolveJsonModule and include and files", () => {
|
||||
verifyProjectWithResolveJsonModule("/src/tsconfig_withIncludeAndFiles.json");
|
||||
verifyTsc({
|
||||
scenario: "resolveJsonModule",
|
||||
subScenario: "include and files",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tsconfig_withIncludeAndFiles.json"],
|
||||
});
|
||||
|
||||
it("with resolveJsonModule and sourceMap", () => {
|
||||
const { fs, tick } = getFsWithTime(projFs);
|
||||
const configFile = "src/tsconfig_withFiles.json";
|
||||
replaceText(fs, configFile, `"composite": true,`, `"composite": true, "sourceMap": true,`);
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
let builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild(configFile),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, configFile, "src/dist/src/index.js"],
|
||||
[Diagnostics.Building_project_0, `/${configFile}`]
|
||||
);
|
||||
verifyOutputsPresent(fs, [...allExpectedOutputs, "/src/dist/src/index.js.map"]);
|
||||
host.clearDiagnostics();
|
||||
builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
tick();
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild(configFile),
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, configFile, "src/src/index.ts", "src/dist/src/index.js"]
|
||||
);
|
||||
verifyTscIncrementalEdits({
|
||||
scenario: "resolveJsonModule",
|
||||
subScenario: "sourcemap",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "src/tsconfig_withFiles.json", "--verbose"],
|
||||
modifyFs: fs => replaceText(fs, "src/tsconfig_withFiles.json", `"composite": true,`, `"composite": true, "sourceMap": true,`),
|
||||
incrementalScenarios: [noChangeRun]
|
||||
});
|
||||
|
||||
it("with resolveJsonModule and without outDir", () => {
|
||||
const { fs, tick } = getFsWithTime(projFs);
|
||||
const configFile = "src/tsconfig_withFiles.json";
|
||||
replaceText(fs, configFile, `"outDir": "dist",`, "");
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
let builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild(configFile),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, configFile, "src/src/index.js"],
|
||||
[Diagnostics.Building_project_0, `/${configFile}`]
|
||||
);
|
||||
verifyOutputsPresent(fs, ["/src/src/index.js", "/src/src/index.d.ts"]);
|
||||
host.clearDiagnostics();
|
||||
builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
tick();
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild(configFile),
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, configFile, "src/src/index.ts", "src/src/index.js"]
|
||||
);
|
||||
verifyTscIncrementalEdits({
|
||||
scenario: "resolveJsonModule",
|
||||
subScenario: "without outDir",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "src/tsconfig_withFiles.json", "--verbose"],
|
||||
modifyFs: fs => replaceText(fs, "src/tsconfig_withFiles.json", `"outDir": "dist",`, ""),
|
||||
incrementalScenarios: [noChangeRun]
|
||||
});
|
||||
});
|
||||
|
||||
@@ -125,32 +80,12 @@ export default hello.hello`);
|
||||
projFs = undefined!; // Release the contents
|
||||
});
|
||||
|
||||
it("when importing json module from project reference", () => {
|
||||
const expectedOutput = "/src/main/index.js";
|
||||
const { fs, tick } = getFsWithTime(projFs);
|
||||
const configFile = "src/tsconfig.json";
|
||||
const stringsConfigFile = "src/strings/tsconfig.json";
|
||||
const mainConfigFile = "src/main/tsconfig.json";
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
let builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild(stringsConfigFile, mainConfigFile, configFile),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, stringsConfigFile, "src/strings/tsconfig.tsbuildinfo"],
|
||||
[Diagnostics.Building_project_0, `/${stringsConfigFile}`],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, mainConfigFile, "src/main/index.js"],
|
||||
[Diagnostics.Building_project_0, `/${mainConfigFile}`],
|
||||
);
|
||||
verifyOutputsPresent(fs, [expectedOutput]);
|
||||
host.clearDiagnostics();
|
||||
builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
tick();
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild(stringsConfigFile, mainConfigFile, configFile),
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, stringsConfigFile, "src/strings/foo.json", "src/strings/tsconfig.tsbuildinfo"],
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, mainConfigFile, "src/main/index.ts", "src/main/index.js"],
|
||||
);
|
||||
verifyTscIncrementalEdits({
|
||||
scenario: "resolveJsonModule",
|
||||
subScenario: "importing json module from project reference",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "src/tsconfig.json", "--verbose"],
|
||||
incrementalScenarios: [noChangeRun]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -14,123 +14,63 @@ namespace ts {
|
||||
projFs = undefined!; // Release the contents
|
||||
});
|
||||
|
||||
function getSampleFsAfterBuild() {
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], {});
|
||||
builder.build();
|
||||
fs.makeReadonly();
|
||||
return fs;
|
||||
}
|
||||
|
||||
describe("sanity check of clean build of 'sample1' project", () => {
|
||||
it("can build the sample project 'sample1' without error", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false });
|
||||
|
||||
host.clearDiagnostics();
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(/*empty*/);
|
||||
|
||||
// Check for outputs. Not an exhaustive list
|
||||
verifyOutputsPresent(fs, allExpectedOutputs);
|
||||
});
|
||||
|
||||
it("builds correctly when outDir is specified", () => {
|
||||
const fs = projFs.shadow();
|
||||
fs.writeFileSync("/src/logic/tsconfig.json", JSON.stringify({
|
||||
verifyTsc({
|
||||
scenario: "sample1",
|
||||
subScenario: "builds correctly when outDir is specified",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tests"],
|
||||
modifyFs: fs => fs.writeFileSync("/src/logic/tsconfig.json", JSON.stringify({
|
||||
compilerOptions: { composite: true, declaration: true, sourceMap: true, outDir: "outDir" },
|
||||
references: [{ path: "../core" }]
|
||||
}));
|
||||
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], {});
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(/*empty*/);
|
||||
const expectedOutputs = allExpectedOutputs.map(f => f.replace("/logic/", "/logic/outDir/"));
|
||||
// Check for outputs. Not an exhaustive list
|
||||
verifyOutputsPresent(fs, expectedOutputs);
|
||||
})),
|
||||
});
|
||||
|
||||
it("builds correctly when declarationDir is specified", () => {
|
||||
const fs = projFs.shadow();
|
||||
fs.writeFileSync("/src/logic/tsconfig.json", JSON.stringify({
|
||||
verifyTsc({
|
||||
scenario: "sample1",
|
||||
subScenario: "builds correctly when declarationDir is specified",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tests"],
|
||||
modifyFs: fs => fs.writeFileSync("/src/logic/tsconfig.json", JSON.stringify({
|
||||
compilerOptions: { composite: true, declaration: true, sourceMap: true, declarationDir: "out/decls" },
|
||||
references: [{ path: "../core" }]
|
||||
}));
|
||||
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], {});
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(/*empty*/);
|
||||
const expectedOutputs = allExpectedOutputs.map(f => f.replace("/logic/index.d.ts", "/logic/out/decls/index.d.ts"));
|
||||
// Check for outputs. Not an exhaustive list
|
||||
verifyOutputsPresent(fs, expectedOutputs);
|
||||
})),
|
||||
});
|
||||
|
||||
it("builds correctly when project is not composite or doesnt have any references", () => {
|
||||
const fs = projFs.shadow();
|
||||
replaceText(fs, "/src/core/tsconfig.json", `"composite": true,`, "");
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/core"], { verbose: true });
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"],
|
||||
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"]
|
||||
);
|
||||
verifyOutputsPresent(fs, ["/src/core/index.js", "/src/core/index.d.ts", "/src/core/index.d.ts.map"]);
|
||||
verifyTsc({
|
||||
scenario: "sample1",
|
||||
subScenario: "builds correctly when project is not composite or doesnt have any references",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/core", "--verbose"],
|
||||
modifyFs: fs => replaceText(fs, "/src/core/tsconfig.json", `"composite": true,`, ""),
|
||||
});
|
||||
});
|
||||
|
||||
describe("dry builds", () => {
|
||||
it("doesn't write any files in a dry build", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], { dry: true, force: false, verbose: false });
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
[Diagnostics.A_non_dry_build_would_build_project_0, "/src/core/tsconfig.json"],
|
||||
[Diagnostics.A_non_dry_build_would_build_project_0, "/src/logic/tsconfig.json"],
|
||||
[Diagnostics.A_non_dry_build_would_build_project_0, "/src/tests/tsconfig.json"]
|
||||
);
|
||||
|
||||
// Check for outputs to not be written. Not an exhaustive list
|
||||
verifyOutputsAbsent(fs, allExpectedOutputs);
|
||||
});
|
||||
|
||||
it("indicates that it would skip builds during a dry build", () => {
|
||||
const { fs, tick } = getFsWithTime(projFs);
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
|
||||
let builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false });
|
||||
builder.build();
|
||||
tick();
|
||||
|
||||
host.clearDiagnostics();
|
||||
builder = createSolutionBuilder(host, ["/src/tests"], { dry: true, force: false, verbose: false });
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
[Diagnostics.Project_0_is_up_to_date, "/src/core/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_up_to_date, "/src/logic/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_up_to_date, "/src/tests/tsconfig.json"]
|
||||
);
|
||||
verifyTsc({
|
||||
scenario: "sample1",
|
||||
subScenario: "does not write any files in a dry build",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tests", "--dry"],
|
||||
});
|
||||
});
|
||||
|
||||
describe("clean builds", () => {
|
||||
it("removes all files it built", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false });
|
||||
builder.build();
|
||||
// Verify they exist
|
||||
verifyOutputsPresent(fs, allExpectedOutputs);
|
||||
|
||||
builder.clean();
|
||||
// Verify they are gone
|
||||
verifyOutputsAbsent(fs, allExpectedOutputs);
|
||||
|
||||
// Subsequent clean shouldn't throw / etc
|
||||
builder.clean();
|
||||
verifyOutputsAbsent(fs, allExpectedOutputs);
|
||||
|
||||
builder.build();
|
||||
// Verify they exist
|
||||
verifyOutputsPresent(fs, allExpectedOutputs);
|
||||
verifyTscIncrementalEdits({
|
||||
scenario: "sample1",
|
||||
subScenario: "removes all files it built",
|
||||
fs: getSampleFsAfterBuild,
|
||||
commandLineArgs: ["--b", "/src/tests", "--clean"],
|
||||
incrementalScenarios: [noChangeRun]
|
||||
});
|
||||
|
||||
it("cleans till project specified", () => {
|
||||
@@ -158,29 +98,12 @@ namespace ts {
|
||||
});
|
||||
|
||||
describe("force builds", () => {
|
||||
it("always builds under --force", () => {
|
||||
const { fs, time, tick } = getFsWithTime(projFs);
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
|
||||
let builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: true, verbose: false });
|
||||
builder.build();
|
||||
let currentTime = time();
|
||||
checkOutputTimestamps(currentTime);
|
||||
|
||||
tick();
|
||||
Debug.assert(time() !== currentTime, "Time moves on");
|
||||
currentTime = time();
|
||||
builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: true, verbose: false });
|
||||
builder.build();
|
||||
checkOutputTimestamps(currentTime);
|
||||
|
||||
function checkOutputTimestamps(expected: number) {
|
||||
// Check timestamps
|
||||
for (const output of allExpectedOutputs) {
|
||||
const actual = fs.statSync(output).mtimeMs;
|
||||
assert(actual === expected, `File ${output} has timestamp ${actual}, expected ${expected}`);
|
||||
}
|
||||
}
|
||||
verifyTscIncrementalEdits({
|
||||
scenario: "sample1",
|
||||
subScenario: "always builds under with force option",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tests", "--force"],
|
||||
incrementalScenarios: [noChangeRun]
|
||||
});
|
||||
});
|
||||
|
||||
@@ -196,64 +119,42 @@ namespace ts {
|
||||
return { fs, host, builder };
|
||||
}
|
||||
|
||||
it("Builds the project", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true });
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"],
|
||||
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/index.js"],
|
||||
[Diagnostics.Building_project_0, "/src/logic/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tests/tsconfig.json", "src/tests/index.js"],
|
||||
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"]
|
||||
);
|
||||
});
|
||||
|
||||
// All three projects are up to date
|
||||
it("Detects that all projects are up to date", () => {
|
||||
const { host, builder } = initializeWithBuild();
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"],
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/logic/tsconfig.json", "src/logic/index.ts", "src/logic/index.js"],
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/tests/tsconfig.json", "src/tests/index.ts", "src/tests/index.js"]
|
||||
);
|
||||
});
|
||||
|
||||
// Update a file in the leaf node (tests), only it should rebuild the last one
|
||||
it("Only builds the leaf node project", () => {
|
||||
const { fs, host, builder } = initializeWithBuild();
|
||||
fs.writeFileSync("/src/tests/index.ts", "const m = 10;");
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"],
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/logic/tsconfig.json", "src/logic/index.ts", "src/logic/index.js"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tests/tsconfig.json", "src/tests/index.js", "src/tests/index.ts"],
|
||||
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"]
|
||||
);
|
||||
});
|
||||
|
||||
// Update a file in the parent (without affecting types), should get fast downstream builds
|
||||
it("Detects type-only changes in upstream projects", () => {
|
||||
const { fs, host, builder } = initializeWithBuild();
|
||||
replaceText(fs, "/src/core/index.ts", "HELLO WORLD", "WELCOME PLANET");
|
||||
builder.build();
|
||||
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/core/tsconfig.json", "src/core/anotherModule.js", "src/core/index.ts"],
|
||||
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
|
||||
[Diagnostics.Updating_unchanged_output_timestamps_of_project_0, "/src/core/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/logic/tsconfig.json"],
|
||||
[Diagnostics.Updating_output_timestamps_of_project_0, "/src/logic/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/tests/tsconfig.json"],
|
||||
[Diagnostics.Updating_output_timestamps_of_project_0, "/src/tests/tsconfig.json"]
|
||||
);
|
||||
verifyTscIncrementalEdits({
|
||||
scenario: "sample1",
|
||||
subScenario: "can detect when and what to rebuild",
|
||||
fs: getSampleFsAfterBuild,
|
||||
commandLineArgs: ["--b", "/src/tests", "--verbose"],
|
||||
incrementalScenarios: [
|
||||
// Update a file in the leaf node (tests), only it should rebuild the last one
|
||||
{
|
||||
subScenario: "Only builds the leaf node project",
|
||||
buildKind: BuildKind.IncrementalDtsUnchanged,
|
||||
modifyFs: fs => fs.writeFileSync("/src/tests/index.ts", "const m = 10;"),
|
||||
},
|
||||
// Update a file in the parent (without affecting types), should get fast downstream builds
|
||||
{
|
||||
subScenario: "Detects type-only changes in upstream projects",
|
||||
buildKind: BuildKind.IncrementalDtsChange,
|
||||
modifyFs: fs => replaceText(fs, "/src/core/index.ts", "HELLO WORLD", "WELCOME PLANET"),
|
||||
},
|
||||
{
|
||||
subScenario: "indicates that it would skip builds during a dry build",
|
||||
buildKind: BuildKind.IncrementalDtsUnchanged,
|
||||
modifyFs: noop,
|
||||
commandLineArgs: ["--b", "/src/tests", "--dry"],
|
||||
},
|
||||
{
|
||||
subScenario: "rebuilds from start if force option is set",
|
||||
buildKind: BuildKind.IncrementalDtsChange,
|
||||
modifyFs: noop,
|
||||
commandLineArgs: ["--b", "/src/tests", "--verbose", "--force"],
|
||||
},
|
||||
{
|
||||
subScenario: "rebuilds when tsconfig changes",
|
||||
buildKind: BuildKind.IncrementalDtsChange,
|
||||
modifyFs: fs => replaceText(fs, "/src/tests/tsconfig.json", `"composite": true`, `"composite": true, "target": "es3"`),
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
it("rebuilds completely when version in tsbuildinfo doesnt match ts version", () => {
|
||||
@@ -300,61 +201,19 @@ namespace ts {
|
||||
);
|
||||
});
|
||||
|
||||
it("rebuilds from start if --f is passed", () => {
|
||||
const { host, builder } = initializeWithBuild({ force: true });
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"],
|
||||
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/logic/tsconfig.json"],
|
||||
[Diagnostics.Building_project_0, "/src/logic/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/tests/tsconfig.json"],
|
||||
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"]
|
||||
);
|
||||
});
|
||||
|
||||
it("rebuilds when tsconfig changes", () => {
|
||||
const { fs, host, builder } = initializeWithBuild();
|
||||
replaceText(fs, "/src/tests/tsconfig.json", `"composite": true`, `"composite": true, "target": "es3"`);
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"],
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/logic/tsconfig.json", "src/logic/index.ts", "src/logic/index.js"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tests/tsconfig.json", "src/tests/index.js", "src/tests/tsconfig.json"],
|
||||
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"],
|
||||
);
|
||||
});
|
||||
|
||||
it("rebuilds when extended config file changes", () => {
|
||||
const { fs, tick } = getFsWithTime(projFs);
|
||||
fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: { target: "es3" } }));
|
||||
replaceText(fs, "/src/tests/tsconfig.json", `"references": [`, `"extends": "./tsconfig.base.json", "references": [`);
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
let builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true });
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"],
|
||||
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/index.js"],
|
||||
[Diagnostics.Building_project_0, "/src/logic/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tests/tsconfig.json", "src/tests/index.js"],
|
||||
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"]
|
||||
);
|
||||
host.clearDiagnostics();
|
||||
tick();
|
||||
builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true });
|
||||
fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: {} }));
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"],
|
||||
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/logic/tsconfig.json", "src/logic/index.ts", "src/logic/index.js"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tests/tsconfig.json", "src/tests/index.js", "src/tests/tsconfig.base.json"],
|
||||
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"]
|
||||
);
|
||||
verifyTscIncrementalEdits({
|
||||
scenario: "sample1",
|
||||
subScenario: "rebuilds when extended config file changes",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tests", "--verbose"],
|
||||
modifyFs: fs => {
|
||||
fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: { target: "es3" } }));
|
||||
replaceText(fs, "/src/tests/tsconfig.json", `"references": [`, `"extends": "./tsconfig.base.json", "references": [`);
|
||||
},
|
||||
incrementalScenarios: [{
|
||||
buildKind: BuildKind.IncrementalDtsChange,
|
||||
modifyFs: fs => fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: {} }))
|
||||
}]
|
||||
});
|
||||
|
||||
it("builds till project specified", () => {
|
||||
@@ -435,27 +294,12 @@ namespace ts {
|
||||
});
|
||||
|
||||
describe("downstream-blocked compilations", () => {
|
||||
it("won't build downstream projects if upstream projects have errors", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: true });
|
||||
|
||||
// Induce an error in the middle project
|
||||
replaceText(fs, "/src/logic/index.ts", "c.multiply(10, 15)", `c.muitply()`);
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"],
|
||||
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
|
||||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/index.js"],
|
||||
[Diagnostics.Building_project_0, "/src/logic/tsconfig.json"],
|
||||
{
|
||||
message: [Diagnostics.Property_0_does_not_exist_on_type_1, "muitply", `typeof import("/src/core/index")`],
|
||||
location: expectedLocationIndexOf(fs, "/src/logic/index.ts", "muitply"),
|
||||
},
|
||||
[Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, "src/tests/tsconfig.json", "src/logic"],
|
||||
[Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, "/src/tests/tsconfig.json", "/src/logic"]
|
||||
);
|
||||
verifyTsc({
|
||||
scenario: "sample1",
|
||||
subScenario: "does not build downstream projects if upstream projects have errors",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tests", "--verbose"],
|
||||
modifyFs: fs => replaceText(fs, "/src/logic/index.ts", "c.multiply(10, 15)", `c.muitply()`)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -515,54 +359,17 @@ export class cNew {}`);
|
||||
});
|
||||
|
||||
describe("lists files", () => {
|
||||
it("listFiles", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], { listFiles: true });
|
||||
builder.build();
|
||||
assert.deepEqual(host.traces, [
|
||||
"/lib/lib.d.ts",
|
||||
"/src/core/anotherModule.ts",
|
||||
"/src/core/index.ts",
|
||||
"/src/core/some_decl.d.ts",
|
||||
"/lib/lib.d.ts",
|
||||
...getCoreOutputs(),
|
||||
"/src/logic/index.ts",
|
||||
"/lib/lib.d.ts",
|
||||
...getCoreOutputs(),
|
||||
"/src/logic/index.d.ts",
|
||||
"/src/tests/index.ts"
|
||||
]);
|
||||
|
||||
function getCoreOutputs() {
|
||||
return [
|
||||
"/src/core/index.d.ts",
|
||||
"/src/core/anotherModule.d.ts"
|
||||
];
|
||||
}
|
||||
verifyTsc({
|
||||
scenario: "sample1",
|
||||
subScenario: "listFiles",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tests", "--listFiles"],
|
||||
});
|
||||
|
||||
it("listEmittedFiles", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], { listEmittedFiles: true });
|
||||
builder.build();
|
||||
assert.deepEqual(host.traces, [
|
||||
"TSFILE: /src/core/anotherModule.js",
|
||||
"TSFILE: /src/core/anotherModule.d.ts.map",
|
||||
"TSFILE: /src/core/anotherModule.d.ts",
|
||||
"TSFILE: /src/core/index.js",
|
||||
"TSFILE: /src/core/index.d.ts.map",
|
||||
"TSFILE: /src/core/index.d.ts",
|
||||
"TSFILE: /src/core/tsconfig.tsbuildinfo",
|
||||
"TSFILE: /src/logic/index.js.map",
|
||||
"TSFILE: /src/logic/index.js",
|
||||
"TSFILE: /src/logic/index.d.ts",
|
||||
"TSFILE: /src/logic/tsconfig.tsbuildinfo",
|
||||
"TSFILE: /src/tests/index.js",
|
||||
"TSFILE: /src/tests/index.d.ts",
|
||||
"TSFILE: /src/tests/tsconfig.tsbuildinfo",
|
||||
]);
|
||||
verifyTsc({
|
||||
scenario: "sample1",
|
||||
subScenario: "listEmittedFiles",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tests", "--listEmittedFiles"],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -590,7 +397,8 @@ class someClass { }`),
|
||||
buildKind: BuildKind.IncrementalDtsChange,
|
||||
modifyFs: fs => replaceText(fs, "/src/logic/tsconfig.json", `"declaration": true,`, `"declaration": true,
|
||||
"declarationDir": "decls",`),
|
||||
}
|
||||
},
|
||||
noChangeRun,
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
@@ -1,23 +1,6 @@
|
||||
namespace ts {
|
||||
describe("unittests:: tsbuild:: when project reference is referenced transitively", () => {
|
||||
let projFs: vfs.FileSystem;
|
||||
const allExpectedOutputs = [
|
||||
"/src/a.js", "/src/a.d.ts",
|
||||
"/src/b.js", "/src/b.d.ts",
|
||||
"/src/c.js"
|
||||
];
|
||||
const expectedFileTraces = [
|
||||
"/lib/lib.d.ts",
|
||||
"/src/a.ts",
|
||||
"/lib/lib.d.ts",
|
||||
"/src/a.d.ts",
|
||||
"/src/b.ts",
|
||||
"/lib/lib.d.ts",
|
||||
"/src/a.d.ts",
|
||||
"/src/b.d.ts",
|
||||
"/src/refs/a.d.ts",
|
||||
"/src/c.ts"
|
||||
];
|
||||
before(() => {
|
||||
projFs = loadProjectFromDisk("tests/projects/transitiveReferences");
|
||||
});
|
||||
@@ -25,17 +8,6 @@ namespace ts {
|
||||
projFs = undefined!; // Release the contents
|
||||
});
|
||||
|
||||
function verifyBuild(modifyDiskLayout: (fs: vfs.FileSystem) => void, allExpectedOutputs: readonly string[], expectedFileTraces: readonly string[], ...expectedDiagnostics: fakes.ExpectedDiagnostic[]) {
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
modifyDiskLayout(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tsconfig.c.json"], { listFiles: true });
|
||||
builder.build();
|
||||
host.assertDiagnosticMessages(...expectedDiagnostics);
|
||||
verifyOutputsPresent(fs, allExpectedOutputs);
|
||||
assert.deepEqual(host.traces, expectedFileTraces);
|
||||
}
|
||||
|
||||
function modifyFsBTsToNonRelativeImport(fs: vfs.FileSystem, moduleResolution: "node" | "classic") {
|
||||
fs.writeFileSync("/src/b.ts", `import {A} from 'a';
|
||||
export const b = new A();`);
|
||||
@@ -49,35 +21,27 @@ export const b = new A();`);
|
||||
}));
|
||||
}
|
||||
|
||||
it("verify that it builds correctly", () => {
|
||||
verifyBuild(noop, allExpectedOutputs, expectedFileTraces);
|
||||
verifyTsc({
|
||||
scenario: "transitiveReferences",
|
||||
subScenario: "builds correctly",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tsconfig.c.json", "--listFiles"],
|
||||
});
|
||||
|
||||
it("verify that it builds correctly when the referenced project uses different module resolution", () => {
|
||||
verifyBuild(fs => modifyFsBTsToNonRelativeImport(fs, "classic"), allExpectedOutputs, expectedFileTraces);
|
||||
verifyTsc({
|
||||
scenario: "transitiveReferences",
|
||||
subScenario: "builds correctly when the referenced project uses different module resolution",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tsconfig.c.json", "--listFiles"],
|
||||
modifyFs: fs => modifyFsBTsToNonRelativeImport(fs, "classic"),
|
||||
});
|
||||
|
||||
it("verify that it build reports error about module not found with node resolution with external module name", () => {
|
||||
// Error in b build only a
|
||||
const allExpectedOutputs = ["/src/a.js", "/src/a.d.ts"];
|
||||
const expectedFileTraces = [
|
||||
"/lib/lib.d.ts",
|
||||
"/src/a.ts",
|
||||
"/lib/lib.d.ts",
|
||||
"/src/b.ts"
|
||||
];
|
||||
verifyBuild(fs => modifyFsBTsToNonRelativeImport(fs, "node"),
|
||||
allExpectedOutputs,
|
||||
expectedFileTraces,
|
||||
{
|
||||
message: [Diagnostics.Cannot_find_module_0, "a"],
|
||||
location: {
|
||||
file: "/src/b.ts",
|
||||
start: `import {A} from 'a';`.indexOf(`'a'`),
|
||||
length: `'a'`.length
|
||||
}
|
||||
},
|
||||
);
|
||||
verifyTsc({
|
||||
scenario: "transitiveReferences",
|
||||
subScenario: "reports error about module not found with node resolution with external module name",
|
||||
fs: () => projFs,
|
||||
commandLineArgs: ["--b", "/src/tsconfig.c.json", "--listFiles"],
|
||||
modifyFs: fs => modifyFsBTsToNonRelativeImport(fs, "node"),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,167 +3,6 @@ namespace ts {
|
||||
writtenFiles: Map<true>;
|
||||
baseLine(): void;
|
||||
};
|
||||
function executeCommandLine(sys: TscCompileSystem, commandLineArgs: readonly string[]) {
|
||||
if (isBuild(commandLineArgs)) {
|
||||
return performBuild(sys, commandLineArgs.slice(1));
|
||||
}
|
||||
|
||||
const reportDiagnostic = createDiagnosticReporter(sys);
|
||||
const commandLine = parseCommandLine(commandLineArgs, path => sys.readFile(path));
|
||||
if (commandLine.options.build) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_build_must_be_the_first_command_line_argument));
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
if (commandLine.errors.length > 0) {
|
||||
commandLine.errors.forEach(reportDiagnostic);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
let configFileName: string | undefined;
|
||||
if (commandLine.options.project) {
|
||||
if (commandLine.fileNames.length !== 0) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line));
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
const fileOrDirectory = normalizePath(commandLine.options.project);
|
||||
if (!fileOrDirectory /* current directory "." */ || sys.directoryExists(fileOrDirectory)) {
|
||||
configFileName = combinePaths(fileOrDirectory, "tsconfig.json");
|
||||
if (!sys.fileExists(configFileName)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project));
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
}
|
||||
else {
|
||||
configFileName = fileOrDirectory;
|
||||
if (!sys.fileExists(configFileName)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project));
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (commandLine.fileNames.length === 0) {
|
||||
const searchPath = normalizePath(sys.getCurrentDirectory());
|
||||
configFileName = findConfigFile(searchPath, sys.fileExists);
|
||||
}
|
||||
|
||||
Debug.assert(commandLine.fileNames.length !== 0 || !!configFileName);
|
||||
|
||||
const currentDirectory = sys.getCurrentDirectory();
|
||||
const getCanonicalFileName = createGetCanonicalFileName(sys.useCaseSensitiveFileNames);
|
||||
const commandLineOptions = convertToOptionsWithAbsolutePaths(
|
||||
commandLine.options,
|
||||
fileName => toPath(fileName, currentDirectory, getCanonicalFileName)
|
||||
);
|
||||
|
||||
if (configFileName) {
|
||||
const configParseResult = Debug.assertDefined(parseConfigFileWithSystem(configFileName, commandLineOptions, sys, reportDiagnostic));
|
||||
if (isIncrementalCompilation(configParseResult.options)) {
|
||||
performIncrementalCompilation(sys, configParseResult);
|
||||
}
|
||||
else {
|
||||
performCompilation(sys, configParseResult);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isIncrementalCompilation(commandLine.options)) {
|
||||
performIncrementalCompilation(sys, {
|
||||
...commandLine,
|
||||
options: commandLineOptions
|
||||
});
|
||||
}
|
||||
else {
|
||||
performCompilation(sys, {
|
||||
...commandLine,
|
||||
options: commandLineOptions
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createReportErrorSummary(sys: TscCompileSystem, options: CompilerOptions): ReportEmitErrorSummary | undefined {
|
||||
return options.pretty ?
|
||||
errorCount => sys.write(getErrorSummaryText(errorCount, sys.newLine)) :
|
||||
undefined;
|
||||
}
|
||||
|
||||
function performCompilation(sys: TscCompileSystem, config: ParsedCommandLine) {
|
||||
const { fileNames, options, projectReferences } = config;
|
||||
const reportDiagnostic = createDiagnosticReporter(sys, options.pretty);
|
||||
const host = createCompilerHostWorker(options, /*setParentPos*/ undefined, sys);
|
||||
fakes.patchHostForBuildInfoReadWrite(host);
|
||||
const currentDirectory = host.getCurrentDirectory();
|
||||
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
||||
changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, currentDirectory, getCanonicalFileName));
|
||||
const program = createProgram({
|
||||
rootNames: fileNames,
|
||||
options,
|
||||
projectReferences,
|
||||
host,
|
||||
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config)
|
||||
});
|
||||
const exitStatus = emitFilesAndReportErrorsAndGetExitStatus(
|
||||
program,
|
||||
reportDiagnostic,
|
||||
s => sys.write(s + sys.newLine),
|
||||
createReportErrorSummary(sys, options)
|
||||
);
|
||||
baselineBuildInfo([config], sys.vfs, sys.writtenFiles);
|
||||
return sys.exit(exitStatus);
|
||||
}
|
||||
|
||||
function performIncrementalCompilation(sys: TscCompileSystem, config: ParsedCommandLine) {
|
||||
const reportDiagnostic = createDiagnosticReporter(sys, config.options.pretty);
|
||||
const { options, fileNames, projectReferences } = config;
|
||||
const host = createIncrementalCompilerHost(options, sys);
|
||||
fakes.patchHostForBuildInfoReadWrite(host);
|
||||
const exitCode = ts.performIncrementalCompilation({
|
||||
host,
|
||||
system: sys,
|
||||
rootNames: fileNames,
|
||||
options,
|
||||
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config),
|
||||
projectReferences,
|
||||
reportDiagnostic,
|
||||
reportErrorSummary: createReportErrorSummary(sys, options),
|
||||
});
|
||||
baselineBuildInfo([config], sys.vfs, sys.writtenFiles);
|
||||
return sys.exit(exitCode);
|
||||
}
|
||||
|
||||
function performBuild(sys: TscCompileSystem, args: string[]) {
|
||||
const { buildOptions, projects, errors } = parseBuildCommand(args);
|
||||
const reportDiagnostic = createDiagnosticReporter(sys, buildOptions.pretty);
|
||||
|
||||
if (errors.length > 0) {
|
||||
errors.forEach(reportDiagnostic);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
Debug.assert(projects.length !== 0);
|
||||
|
||||
const buildHost = createSolutionBuilderHost(
|
||||
sys,
|
||||
/*createProgram*/ undefined,
|
||||
reportDiagnostic,
|
||||
createBuilderStatusReporter(sys, buildOptions.pretty),
|
||||
createReportErrorSummary(sys, buildOptions)
|
||||
);
|
||||
fakes.patchSolutionBuilderHost(buildHost, sys);
|
||||
const builder = createSolutionBuilder(buildHost, projects, buildOptions);
|
||||
const exitCode = buildOptions.clean ? builder.clean() : builder.build();
|
||||
baselineBuildInfo(builder.getAllParsedConfigs(), sys.vfs, sys.writtenFiles);
|
||||
return sys.exit(exitCode);
|
||||
}
|
||||
|
||||
function isBuild(commandLineArgs: readonly string[]) {
|
||||
if (commandLineArgs.length > 0 && commandLineArgs[0].charCodeAt(0) === CharacterCodes.minus) {
|
||||
const firstOption = commandLineArgs[0].slice(commandLineArgs[0].charCodeAt(1) === CharacterCodes.minus ? 2 : 1).toLowerCase();
|
||||
return firstOption === "build" || firstOption === "b";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export enum BuildKind {
|
||||
Initial = "initial-build",
|
||||
@@ -221,8 +60,17 @@ namespace ts {
|
||||
|
||||
sys.write(`${sys.getExecutingFilePath()} ${commandLineArgs.join(" ")}\n`);
|
||||
sys.exit = exitCode => sys.exitCode = exitCode;
|
||||
executeCommandLine(sys, commandLineArgs);
|
||||
sys.write(`exitCode:: ${sys.exitCode}\n`);
|
||||
executeCommandLine(
|
||||
sys,
|
||||
{
|
||||
onCompilerHostCreate: host => fakes.patchHostForBuildInfoReadWrite(host),
|
||||
onCompilationComplete: config => baselineBuildInfo([config], sys.vfs, sys.writtenFiles),
|
||||
onSolutionBuilderHostCreate: host => fakes.patchSolutionBuilderHost(host, sys),
|
||||
onSolutionBuildComplete: configs => baselineBuildInfo(configs, sys.vfs, sys.writtenFiles),
|
||||
},
|
||||
commandLineArgs,
|
||||
);
|
||||
sys.write(`exitCode:: ExitStatus.${ExitStatus[sys.exitCode as ExitStatus]}\n`);
|
||||
if (baselineReadFileCalls) {
|
||||
sys.write(`readFiles:: ${JSON.stringify(actualReadFileMap, /*replacer*/ undefined, " ")} `);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,725 @@
|
||||
namespace ts {
|
||||
interface Statistic {
|
||||
name: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
function countLines(program: Program): number {
|
||||
let count = 0;
|
||||
forEach(program.getSourceFiles(), file => {
|
||||
count += getLineStarts(file).length;
|
||||
});
|
||||
return count;
|
||||
}
|
||||
|
||||
function updateReportDiagnostic(
|
||||
sys: System,
|
||||
existing: DiagnosticReporter,
|
||||
options: CompilerOptions | BuildOptions
|
||||
): DiagnosticReporter {
|
||||
return shouldBePretty(sys, options) ?
|
||||
createDiagnosticReporter(sys, /*pretty*/ true) :
|
||||
existing;
|
||||
}
|
||||
|
||||
function defaultIsPretty(sys: System) {
|
||||
return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY();
|
||||
}
|
||||
|
||||
function shouldBePretty(sys: System, options: CompilerOptions | BuildOptions) {
|
||||
if (!options || typeof options.pretty === "undefined") {
|
||||
return defaultIsPretty(sys);
|
||||
}
|
||||
return options.pretty;
|
||||
}
|
||||
|
||||
function padLeft(s: string, length: number) {
|
||||
while (s.length < length) {
|
||||
s = " " + s;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
function padRight(s: string, length: number) {
|
||||
while (s.length < length) {
|
||||
s = s + " ";
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function getOptionsForHelp(commandLine: ParsedCommandLine) {
|
||||
// Sort our options by their names, (e.g. "--noImplicitAny" comes before "--watch")
|
||||
return !!commandLine.options.all ?
|
||||
sort(optionDeclarations, (a, b) => compareStringsCaseInsensitive(a.name, b.name)) :
|
||||
filter(optionDeclarations.slice(), v => !!v.showInSimplifiedHelpView);
|
||||
}
|
||||
|
||||
function printVersion(sys: System) {
|
||||
sys.write(getDiagnosticText(Diagnostics.Version_0, version) + sys.newLine);
|
||||
}
|
||||
|
||||
function printHelp(sys: System, optionsList: readonly CommandLineOption[], syntaxPrefix = "") {
|
||||
const output: string[] = [];
|
||||
|
||||
// We want to align our "syntax" and "examples" commands to a certain margin.
|
||||
const syntaxLength = getDiagnosticText(Diagnostics.Syntax_Colon_0, "").length;
|
||||
const examplesLength = getDiagnosticText(Diagnostics.Examples_Colon_0, "").length;
|
||||
let marginLength = Math.max(syntaxLength, examplesLength);
|
||||
|
||||
// Build up the syntactic skeleton.
|
||||
let syntax = makePadding(marginLength - syntaxLength);
|
||||
syntax += `tsc ${syntaxPrefix}[${getDiagnosticText(Diagnostics.options)}] [${getDiagnosticText(Diagnostics.file)}...]`;
|
||||
|
||||
output.push(getDiagnosticText(Diagnostics.Syntax_Colon_0, syntax));
|
||||
output.push(sys.newLine + sys.newLine);
|
||||
|
||||
// Build up the list of examples.
|
||||
const padding = makePadding(marginLength);
|
||||
output.push(getDiagnosticText(Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + sys.newLine);
|
||||
output.push(padding + "tsc --outFile file.js file.ts" + sys.newLine);
|
||||
output.push(padding + "tsc @args.txt" + sys.newLine);
|
||||
output.push(padding + "tsc --build tsconfig.json" + sys.newLine);
|
||||
output.push(sys.newLine);
|
||||
|
||||
output.push(getDiagnosticText(Diagnostics.Options_Colon) + sys.newLine);
|
||||
|
||||
// We want our descriptions to align at the same column in our output,
|
||||
// so we keep track of the longest option usage string.
|
||||
marginLength = 0;
|
||||
const usageColumn: string[] = []; // Things like "-d, --declaration" go in here.
|
||||
const descriptionColumn: string[] = [];
|
||||
|
||||
const optionsDescriptionMap = createMap<string[]>(); // Map between option.description and list of option.type if it is a kind
|
||||
|
||||
for (const option of optionsList) {
|
||||
// If an option lacks a description,
|
||||
// it is not officially supported.
|
||||
if (!option.description) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let usageText = " ";
|
||||
if (option.shortName) {
|
||||
usageText += "-" + option.shortName;
|
||||
usageText += getParamType(option);
|
||||
usageText += ", ";
|
||||
}
|
||||
|
||||
usageText += "--" + option.name;
|
||||
usageText += getParamType(option);
|
||||
|
||||
usageColumn.push(usageText);
|
||||
let description: string;
|
||||
|
||||
if (option.name === "lib") {
|
||||
description = getDiagnosticText(option.description);
|
||||
const element = (<CommandLineOptionOfListType>option).element;
|
||||
const typeMap = <Map<number | string>>element.type;
|
||||
optionsDescriptionMap.set(description, arrayFrom(typeMap.keys()).map(key => `'${key}'`));
|
||||
}
|
||||
else {
|
||||
description = getDiagnosticText(option.description);
|
||||
}
|
||||
|
||||
descriptionColumn.push(description);
|
||||
|
||||
// Set the new margin for the description column if necessary.
|
||||
marginLength = Math.max(usageText.length, marginLength);
|
||||
}
|
||||
|
||||
// Special case that can't fit in the loop.
|
||||
const usageText = " @<" + getDiagnosticText(Diagnostics.file) + ">";
|
||||
usageColumn.push(usageText);
|
||||
descriptionColumn.push(getDiagnosticText(Diagnostics.Insert_command_line_options_and_files_from_a_file));
|
||||
marginLength = Math.max(usageText.length, marginLength);
|
||||
|
||||
// Print out each row, aligning all the descriptions on the same column.
|
||||
for (let i = 0; i < usageColumn.length; i++) {
|
||||
const usage = usageColumn[i];
|
||||
const description = descriptionColumn[i];
|
||||
const kindsList = optionsDescriptionMap.get(description);
|
||||
output.push(usage + makePadding(marginLength - usage.length + 2) + description + sys.newLine);
|
||||
|
||||
if (kindsList) {
|
||||
output.push(makePadding(marginLength + 4));
|
||||
for (const kind of kindsList) {
|
||||
output.push(kind + " ");
|
||||
}
|
||||
output.push(sys.newLine);
|
||||
}
|
||||
}
|
||||
|
||||
for (const line of output) {
|
||||
sys.write(line);
|
||||
}
|
||||
return;
|
||||
|
||||
function getParamType(option: CommandLineOption) {
|
||||
if (option.paramType !== undefined) {
|
||||
return " " + getDiagnosticText(option.paramType);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function makePadding(paddingLength: number): string {
|
||||
return Array(paddingLength + 1).join(" ");
|
||||
}
|
||||
}
|
||||
|
||||
function executeCommandLineWorker(
|
||||
sys: System,
|
||||
cb: ExecuteCommandLineCallbacks | undefined,
|
||||
commandLine: ParsedCommandLine,
|
||||
) {
|
||||
let reportDiagnostic = createDiagnosticReporter(sys);
|
||||
if (commandLine.options.build) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_build_must_be_the_first_command_line_argument));
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
// Configuration file name (if any)
|
||||
let configFileName: string | undefined;
|
||||
if (commandLine.options.locale) {
|
||||
validateLocaleAndSetLanguage(commandLine.options.locale, sys, commandLine.errors);
|
||||
}
|
||||
|
||||
// If there are any errors due to command line parsing and/or
|
||||
// setting up localization, report them and quit.
|
||||
if (commandLine.errors.length > 0) {
|
||||
commandLine.errors.forEach(reportDiagnostic);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
if (commandLine.options.init) {
|
||||
writeConfigFile(sys, reportDiagnostic, commandLine.options, commandLine.fileNames);
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
|
||||
if (commandLine.options.version) {
|
||||
printVersion(sys);
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
|
||||
if (commandLine.options.help || commandLine.options.all) {
|
||||
printVersion(sys);
|
||||
printHelp(sys, getOptionsForHelp(commandLine));
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
|
||||
if (commandLine.options.project) {
|
||||
if (commandLine.fileNames.length !== 0) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line));
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
const fileOrDirectory = normalizePath(commandLine.options.project);
|
||||
if (!fileOrDirectory /* current directory "." */ || sys.directoryExists(fileOrDirectory)) {
|
||||
configFileName = combinePaths(fileOrDirectory, "tsconfig.json");
|
||||
if (!sys.fileExists(configFileName)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project));
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
}
|
||||
else {
|
||||
configFileName = fileOrDirectory;
|
||||
if (!sys.fileExists(configFileName)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project));
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (commandLine.fileNames.length === 0) {
|
||||
const searchPath = normalizePath(sys.getCurrentDirectory());
|
||||
configFileName = findConfigFile(searchPath, sys.fileExists);
|
||||
}
|
||||
|
||||
if (commandLine.fileNames.length === 0 && !configFileName) {
|
||||
printVersion(sys);
|
||||
printHelp(sys, getOptionsForHelp(commandLine));
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
|
||||
const currentDirectory = sys.getCurrentDirectory();
|
||||
const getCanonicalFileName = createGetCanonicalFileName(sys.useCaseSensitiveFileNames);
|
||||
const commandLineOptions = convertToOptionsWithAbsolutePaths(
|
||||
commandLine.options,
|
||||
fileName => toPath(fileName, currentDirectory, getCanonicalFileName)
|
||||
);
|
||||
if (configFileName) {
|
||||
const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, sys, reportDiagnostic)!; // TODO: GH#18217
|
||||
if (commandLineOptions.showConfig) {
|
||||
if (configParseResult.errors.length !== 0) {
|
||||
reportDiagnostic = updateReportDiagnostic(
|
||||
sys,
|
||||
reportDiagnostic,
|
||||
configParseResult.options
|
||||
);
|
||||
configParseResult.errors.forEach(reportDiagnostic);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
// eslint-disable-next-line no-null/no-null
|
||||
sys.write(JSON.stringify(convertToTSConfig(configParseResult, configFileName, sys), null, 4) + sys.newLine);
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
reportDiagnostic = updateReportDiagnostic(
|
||||
sys,
|
||||
reportDiagnostic,
|
||||
configParseResult.options
|
||||
);
|
||||
if (isWatchSet(configParseResult.options)) {
|
||||
if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic)) return;
|
||||
createWatchOfConfigFile(
|
||||
sys,
|
||||
reportDiagnostic,
|
||||
configParseResult,
|
||||
commandLineOptions
|
||||
);
|
||||
}
|
||||
else if (isIncrementalCompilation(configParseResult.options)) {
|
||||
performIncrementalCompilation(
|
||||
sys,
|
||||
reportDiagnostic,
|
||||
cb,
|
||||
configParseResult
|
||||
);
|
||||
}
|
||||
else {
|
||||
performCompilation(
|
||||
sys,
|
||||
reportDiagnostic,
|
||||
cb,
|
||||
configParseResult
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (commandLineOptions.showConfig) {
|
||||
// eslint-disable-next-line no-null/no-null
|
||||
sys.write(JSON.stringify(convertToTSConfig(commandLine, combinePaths(currentDirectory, "tsconfig.json"), sys), null, 4) + sys.newLine);
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
reportDiagnostic = updateReportDiagnostic(
|
||||
sys,
|
||||
reportDiagnostic,
|
||||
commandLineOptions
|
||||
);
|
||||
if (isWatchSet(commandLineOptions)) {
|
||||
if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic)) return;
|
||||
createWatchOfFilesAndCompilerOptions(
|
||||
sys,
|
||||
reportDiagnostic,
|
||||
commandLine.fileNames,
|
||||
commandLineOptions
|
||||
);
|
||||
}
|
||||
else if (isIncrementalCompilation(commandLineOptions)) {
|
||||
performIncrementalCompilation(
|
||||
sys,
|
||||
reportDiagnostic,
|
||||
cb,
|
||||
{ ...commandLine, options: commandLineOptions }
|
||||
);
|
||||
}
|
||||
else {
|
||||
performCompilation(
|
||||
sys,
|
||||
reportDiagnostic,
|
||||
cb,
|
||||
{ ...commandLine, options: commandLineOptions }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function isBuild(commandLineArgs: readonly string[]) {
|
||||
if (commandLineArgs.length > 0 && commandLineArgs[0].charCodeAt(0) === CharacterCodes.minus) {
|
||||
const firstOption = commandLineArgs[0].slice(commandLineArgs[0].charCodeAt(1) === CharacterCodes.minus ? 2 : 1).toLowerCase();
|
||||
return firstOption === "build" || firstOption === "b";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export interface ExecuteCommandLineCallbacks {
|
||||
onCompilerHostCreate: (host: CompilerHost) => void;
|
||||
onCompilationComplete: (config: ParsedCommandLine) => void;
|
||||
onSolutionBuilderHostCreate: (host: SolutionBuilderHost<BuilderProgram> | SolutionBuilderWithWatchHost<BuilderProgram>) => void;
|
||||
onSolutionBuildComplete: (configs: readonly ParsedCommandLine[]) => void;
|
||||
}
|
||||
export function executeCommandLine(
|
||||
system: System,
|
||||
cb: ExecuteCommandLineCallbacks,
|
||||
commandLineArgs: readonly string[],
|
||||
): void {
|
||||
if (isBuild(commandLineArgs)) {
|
||||
return performBuild(
|
||||
system,
|
||||
cb,
|
||||
commandLineArgs.slice(1)
|
||||
);
|
||||
}
|
||||
|
||||
const commandLine = parseCommandLine(commandLineArgs, path => system.readFile(path));
|
||||
if (commandLine.options.generateCpuProfile && system.enableCPUProfiler) {
|
||||
system.enableCPUProfiler(commandLine.options.generateCpuProfile, () => executeCommandLineWorker(
|
||||
system,
|
||||
cb,
|
||||
commandLine
|
||||
));
|
||||
}
|
||||
else {
|
||||
executeCommandLineWorker(system, cb, commandLine);
|
||||
}
|
||||
}
|
||||
|
||||
function reportWatchModeWithoutSysSupport(sys: System, reportDiagnostic: DiagnosticReporter) {
|
||||
if (!sys.watchFile || !sys.watchDirectory) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"));
|
||||
sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function performBuildWorker(
|
||||
sys: System,
|
||||
cb: ExecuteCommandLineCallbacks | undefined,
|
||||
buildOptions: BuildOptions,
|
||||
projects: string[],
|
||||
errors: Diagnostic[]
|
||||
) {
|
||||
// Update to pretty if host supports it
|
||||
const reportDiagnostic = updateReportDiagnostic(
|
||||
sys,
|
||||
createDiagnosticReporter(sys),
|
||||
buildOptions
|
||||
);
|
||||
|
||||
if (buildOptions.locale) {
|
||||
validateLocaleAndSetLanguage(buildOptions.locale, sys, errors);
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
errors.forEach(reportDiagnostic);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
if (buildOptions.help) {
|
||||
printVersion(sys);
|
||||
printHelp(sys, buildOpts, "--build ");
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
|
||||
if (projects.length === 0) {
|
||||
printVersion(sys);
|
||||
printHelp(sys, buildOpts, "--build ");
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
|
||||
if (!sys.getModifiedTime || !sys.setModifiedTime || (buildOptions.clean && !sys.deleteFile)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--build"));
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
if (buildOptions.watch) {
|
||||
if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic)) return;
|
||||
const buildHost = createSolutionBuilderWithWatchHost(
|
||||
sys,
|
||||
/*createProgram*/ undefined,
|
||||
reportDiagnostic,
|
||||
createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)),
|
||||
createWatchStatusReporter(sys, buildOptions)
|
||||
);
|
||||
if (cb && cb.onSolutionBuilderHostCreate) cb.onSolutionBuilderHostCreate(buildHost);
|
||||
updateCreateProgram(sys, buildHost);
|
||||
buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(sys, program.getProgram());
|
||||
const builder = createSolutionBuilderWithWatch(buildHost, projects, buildOptions);
|
||||
builder.build();
|
||||
return;
|
||||
}
|
||||
|
||||
const buildHost = createSolutionBuilderHost(
|
||||
sys,
|
||||
/*createProgram*/ undefined,
|
||||
reportDiagnostic,
|
||||
createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)),
|
||||
createReportErrorSummary(sys, buildOptions)
|
||||
);
|
||||
if (cb && cb.onSolutionBuilderHostCreate) cb.onSolutionBuilderHostCreate(buildHost);
|
||||
updateCreateProgram(sys, buildHost);
|
||||
buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(sys, program.getProgram());
|
||||
const builder = createSolutionBuilder(buildHost, projects, buildOptions);
|
||||
const exitStatus = buildOptions.clean ? builder.clean() : builder.build();
|
||||
if (cb && cb.onSolutionBuildComplete) cb.onSolutionBuildComplete(builder.getAllParsedConfigs());
|
||||
return sys.exit(exitStatus);
|
||||
}
|
||||
|
||||
function performBuild(
|
||||
sys: System,
|
||||
cb: ExecuteCommandLineCallbacks | undefined,
|
||||
args: readonly string[]
|
||||
) {
|
||||
const { buildOptions, projects, errors } = parseBuildCommand(args);
|
||||
if (buildOptions.generateCpuProfile && sys.enableCPUProfiler) {
|
||||
sys.enableCPUProfiler(buildOptions.generateCpuProfile, () => performBuildWorker(
|
||||
sys,
|
||||
cb,
|
||||
buildOptions,
|
||||
projects,
|
||||
errors
|
||||
));
|
||||
}
|
||||
else {
|
||||
performBuildWorker(
|
||||
sys,
|
||||
cb,
|
||||
buildOptions,
|
||||
projects,
|
||||
errors
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function createReportErrorSummary(sys: System, options: CompilerOptions | BuildOptions): ReportEmitErrorSummary | undefined {
|
||||
return shouldBePretty(sys, options) ?
|
||||
errorCount => sys.write(getErrorSummaryText(errorCount, sys.newLine)) :
|
||||
undefined;
|
||||
}
|
||||
|
||||
function performCompilation(
|
||||
sys: System,
|
||||
reportDiagnostic: DiagnosticReporter,
|
||||
cb: ExecuteCommandLineCallbacks | undefined,
|
||||
config: ParsedCommandLine
|
||||
) {
|
||||
const { fileNames, options, projectReferences } = config;
|
||||
const host = createCompilerHostWorker(options, /*setParentPos*/ undefined, sys);
|
||||
if (cb && cb.onCompilerHostCreate) cb.onCompilerHostCreate(host);
|
||||
const currentDirectory = host.getCurrentDirectory();
|
||||
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
||||
changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, currentDirectory, getCanonicalFileName));
|
||||
enableStatistics(sys, options);
|
||||
|
||||
const programOptions: CreateProgramOptions = {
|
||||
rootNames: fileNames,
|
||||
options,
|
||||
projectReferences,
|
||||
host,
|
||||
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config)
|
||||
};
|
||||
const program = createProgram(programOptions);
|
||||
const exitStatus = emitFilesAndReportErrorsAndGetExitStatus(
|
||||
program,
|
||||
reportDiagnostic,
|
||||
s => sys.write(s + sys.newLine),
|
||||
createReportErrorSummary(sys, options)
|
||||
);
|
||||
reportStatistics(sys, program);
|
||||
if (cb && cb.onCompilationComplete) cb.onCompilationComplete(config);
|
||||
return sys.exit(exitStatus);
|
||||
}
|
||||
|
||||
function performIncrementalCompilation(
|
||||
sys: System,
|
||||
reportDiagnostic: DiagnosticReporter,
|
||||
cb: ExecuteCommandLineCallbacks | undefined,
|
||||
config: ParsedCommandLine
|
||||
) {
|
||||
const { options, fileNames, projectReferences } = config;
|
||||
enableStatistics(sys, options);
|
||||
const host = createIncrementalCompilerHost(options, sys);
|
||||
if (cb && cb.onCompilerHostCreate) cb.onCompilerHostCreate(host);
|
||||
const exitStatus = ts.performIncrementalCompilation({
|
||||
host,
|
||||
system: sys,
|
||||
rootNames: fileNames,
|
||||
options,
|
||||
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config),
|
||||
projectReferences,
|
||||
reportDiagnostic,
|
||||
reportErrorSummary: createReportErrorSummary(sys, options),
|
||||
afterProgramEmitAndDiagnostics: builderProgram => reportStatistics(sys, builderProgram.getProgram())
|
||||
});
|
||||
if (cb && cb.onCompilationComplete) cb.onCompilationComplete(config);
|
||||
return sys.exit(exitStatus);
|
||||
}
|
||||
|
||||
function updateCreateProgram<T extends BuilderProgram>(sys: System, host: { createProgram: CreateProgram<T>; }) {
|
||||
const compileUsingBuilder = host.createProgram;
|
||||
host.createProgram = (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) => {
|
||||
Debug.assert(rootNames !== undefined || (options === undefined && !!oldProgram));
|
||||
if (options !== undefined) {
|
||||
enableStatistics(sys, options);
|
||||
}
|
||||
return compileUsingBuilder(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences);
|
||||
};
|
||||
}
|
||||
|
||||
function updateWatchCompilationHost(sys: System, watchCompilerHost: WatchCompilerHost<EmitAndSemanticDiagnosticsBuilderProgram>) {
|
||||
updateCreateProgram(sys, watchCompilerHost);
|
||||
const emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate!; // TODO: GH#18217
|
||||
watchCompilerHost.afterProgramCreate = builderProgram => {
|
||||
emitFilesUsingBuilder(builderProgram);
|
||||
reportStatistics(sys, builderProgram.getProgram());
|
||||
};
|
||||
}
|
||||
|
||||
function createWatchStatusReporter(sys: System, options: CompilerOptions | BuildOptions) {
|
||||
return ts.createWatchStatusReporter(sys, shouldBePretty(sys, options));
|
||||
}
|
||||
|
||||
function createWatchOfConfigFile(
|
||||
sys: System,
|
||||
reportDiagnostic: DiagnosticReporter,
|
||||
configParseResult: ParsedCommandLine,
|
||||
optionsToExtend: CompilerOptions
|
||||
) {
|
||||
const watchCompilerHost = createWatchCompilerHostOfConfigFile(
|
||||
configParseResult.options.configFilePath!,
|
||||
optionsToExtend,
|
||||
sys,
|
||||
/*createProgram*/ undefined,
|
||||
reportDiagnostic,
|
||||
createWatchStatusReporter(sys, configParseResult.options)
|
||||
); // TODO: GH#18217
|
||||
updateWatchCompilationHost(sys, watchCompilerHost);
|
||||
watchCompilerHost.configFileParsingResult = configParseResult;
|
||||
createWatchProgram(watchCompilerHost);
|
||||
}
|
||||
|
||||
function createWatchOfFilesAndCompilerOptions(
|
||||
sys: System,
|
||||
reportDiagnostic: DiagnosticReporter,
|
||||
rootFiles: string[],
|
||||
options: CompilerOptions
|
||||
) {
|
||||
const watchCompilerHost = createWatchCompilerHostOfFilesAndCompilerOptions(
|
||||
rootFiles,
|
||||
options,
|
||||
sys,
|
||||
/*createProgram*/ undefined,
|
||||
reportDiagnostic,
|
||||
createWatchStatusReporter(sys, options)
|
||||
);
|
||||
updateWatchCompilationHost(sys, watchCompilerHost);
|
||||
createWatchProgram(watchCompilerHost);
|
||||
}
|
||||
|
||||
function canReportDiagnostics(system: System, compilerOptions: CompilerOptions) {
|
||||
return system === sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics);
|
||||
}
|
||||
|
||||
function enableStatistics(sys: System, compilerOptions: CompilerOptions) {
|
||||
if (canReportDiagnostics(sys, compilerOptions)) {
|
||||
performance.enable();
|
||||
}
|
||||
}
|
||||
|
||||
function reportStatistics(sys: System, program: Program) {
|
||||
let statistics: Statistic[];
|
||||
const compilerOptions = program.getCompilerOptions();
|
||||
if (canReportDiagnostics(sys, compilerOptions)) {
|
||||
statistics = [];
|
||||
const memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
|
||||
reportCountStatistic("Files", program.getSourceFiles().length);
|
||||
reportCountStatistic("Lines", countLines(program));
|
||||
reportCountStatistic("Nodes", program.getNodeCount());
|
||||
reportCountStatistic("Identifiers", program.getIdentifierCount());
|
||||
reportCountStatistic("Symbols", program.getSymbolCount());
|
||||
reportCountStatistic("Types", program.getTypeCount());
|
||||
|
||||
if (memoryUsed >= 0) {
|
||||
reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K");
|
||||
}
|
||||
|
||||
const programTime = performance.getDuration("Program");
|
||||
const bindTime = performance.getDuration("Bind");
|
||||
const checkTime = performance.getDuration("Check");
|
||||
const emitTime = performance.getDuration("Emit");
|
||||
if (compilerOptions.extendedDiagnostics) {
|
||||
const caches = program.getRelationCacheSizes();
|
||||
reportCountStatistic("Assignability cache size", caches.assignable);
|
||||
reportCountStatistic("Identity cache size", caches.identity);
|
||||
reportCountStatistic("Subtype cache size", caches.subtype);
|
||||
performance.forEachMeasure((name, duration) => reportTimeStatistic(`${name} time`, duration));
|
||||
}
|
||||
else {
|
||||
// Individual component times.
|
||||
// Note: To match the behavior of previous versions of the compiler, the reported parse time includes
|
||||
// I/O read time and processing time for triple-slash references and module imports, and the reported
|
||||
// emit time includes I/O write time. We preserve this behavior so we can accurately compare times.
|
||||
reportTimeStatistic("I/O read", performance.getDuration("I/O Read"));
|
||||
reportTimeStatistic("I/O write", performance.getDuration("I/O Write"));
|
||||
reportTimeStatistic("Parse time", programTime);
|
||||
reportTimeStatistic("Bind time", bindTime);
|
||||
reportTimeStatistic("Check time", checkTime);
|
||||
reportTimeStatistic("Emit time", emitTime);
|
||||
}
|
||||
reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
|
||||
reportStatistics();
|
||||
|
||||
performance.disable();
|
||||
}
|
||||
|
||||
function reportStatistics() {
|
||||
let nameSize = 0;
|
||||
let valueSize = 0;
|
||||
for (const { name, value } of statistics) {
|
||||
if (name.length > nameSize) {
|
||||
nameSize = name.length;
|
||||
}
|
||||
|
||||
if (value.length > valueSize) {
|
||||
valueSize = value.length;
|
||||
}
|
||||
}
|
||||
|
||||
for (const { name, value } of statistics) {
|
||||
sys.write(padRight(name + ":", nameSize + 2) + padLeft(value.toString(), valueSize) + sys.newLine);
|
||||
}
|
||||
}
|
||||
|
||||
function reportStatisticalValue(name: string, value: string) {
|
||||
statistics.push({ name, value });
|
||||
}
|
||||
|
||||
function reportCountStatistic(name: string, count: number) {
|
||||
reportStatisticalValue(name, "" + count);
|
||||
}
|
||||
|
||||
function reportTimeStatistic(name: string, time: number) {
|
||||
reportStatisticalValue(name, (time / 1000).toFixed(2) + "s");
|
||||
}
|
||||
}
|
||||
|
||||
function writeConfigFile(
|
||||
sys: System,
|
||||
reportDiagnostic: DiagnosticReporter,
|
||||
options: CompilerOptions,
|
||||
fileNames: string[]
|
||||
) {
|
||||
const currentDirectory = sys.getCurrentDirectory();
|
||||
const file = normalizePath(combinePaths(currentDirectory, "tsconfig.json"));
|
||||
if (sys.fileExists(file)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file));
|
||||
}
|
||||
else {
|
||||
sys.writeFile(file, generateTSConfig(options, fileNames, sys.newLine));
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Successfully_created_a_tsconfig_json_file));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ts.Debug.isDebugging) {
|
||||
ts.Debug.enableDebugInfo();
|
||||
}
|
||||
|
||||
if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))) {
|
||||
ts.sys.tryEnableSourceMapsForHost();
|
||||
}
|
||||
|
||||
if (ts.sys.setBlocking) {
|
||||
ts.sys.setBlocking();
|
||||
}
|
||||
+11
-450
@@ -1,450 +1,11 @@
|
||||
namespace ts {
|
||||
interface Statistic {
|
||||
name: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
function countLines(program: Program): number {
|
||||
let count = 0;
|
||||
forEach(program.getSourceFiles(), file => {
|
||||
count += getLineStarts(file).length;
|
||||
});
|
||||
return count;
|
||||
}
|
||||
|
||||
let reportDiagnostic = createDiagnosticReporter(sys);
|
||||
function updateReportDiagnostic(options: CompilerOptions | BuildOptions) {
|
||||
if (shouldBePretty(options)) {
|
||||
reportDiagnostic = createDiagnosticReporter(sys, /*pretty*/ true);
|
||||
}
|
||||
}
|
||||
|
||||
function defaultIsPretty() {
|
||||
return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY();
|
||||
}
|
||||
|
||||
function shouldBePretty(options: CompilerOptions | BuildOptions) {
|
||||
if (!options || typeof options.pretty === "undefined") {
|
||||
return defaultIsPretty();
|
||||
}
|
||||
return options.pretty;
|
||||
}
|
||||
|
||||
function padLeft(s: string, length: number) {
|
||||
while (s.length < length) {
|
||||
s = " " + s;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
function padRight(s: string, length: number) {
|
||||
while (s.length < length) {
|
||||
s = s + " ";
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function getOptionsForHelp(commandLine: ParsedCommandLine) {
|
||||
// Sort our options by their names, (e.g. "--noImplicitAny" comes before "--watch")
|
||||
return !!commandLine.options.all ?
|
||||
sort(optionDeclarations, (a, b) => compareStringsCaseInsensitive(a.name, b.name)) :
|
||||
filter(optionDeclarations.slice(), v => !!v.showInSimplifiedHelpView);
|
||||
}
|
||||
|
||||
function executeCommandLineWorker(commandLine: ParsedCommandLine) {
|
||||
if (commandLine.options.build) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_build_must_be_the_first_command_line_argument));
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
// Configuration file name (if any)
|
||||
let configFileName: string | undefined;
|
||||
if (commandLine.options.locale) {
|
||||
validateLocaleAndSetLanguage(commandLine.options.locale, sys, commandLine.errors);
|
||||
}
|
||||
|
||||
// If there are any errors due to command line parsing and/or
|
||||
// setting up localization, report them and quit.
|
||||
if (commandLine.errors.length > 0) {
|
||||
commandLine.errors.forEach(reportDiagnostic);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
if (commandLine.options.init) {
|
||||
writeConfigFile(commandLine.options, commandLine.fileNames);
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
|
||||
if (commandLine.options.version) {
|
||||
printVersion();
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
|
||||
if (commandLine.options.help || commandLine.options.all) {
|
||||
printVersion();
|
||||
printHelp(getOptionsForHelp(commandLine));
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
|
||||
if (commandLine.options.project) {
|
||||
if (commandLine.fileNames.length !== 0) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line));
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
const fileOrDirectory = normalizePath(commandLine.options.project);
|
||||
if (!fileOrDirectory /* current directory "." */ || sys.directoryExists(fileOrDirectory)) {
|
||||
configFileName = combinePaths(fileOrDirectory, "tsconfig.json");
|
||||
if (!sys.fileExists(configFileName)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project));
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
}
|
||||
else {
|
||||
configFileName = fileOrDirectory;
|
||||
if (!sys.fileExists(configFileName)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project));
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (commandLine.fileNames.length === 0) {
|
||||
const searchPath = normalizePath(sys.getCurrentDirectory());
|
||||
configFileName = findConfigFile(searchPath, sys.fileExists);
|
||||
}
|
||||
|
||||
if (commandLine.fileNames.length === 0 && !configFileName) {
|
||||
printVersion();
|
||||
printHelp(getOptionsForHelp(commandLine));
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
|
||||
const currentDirectory = sys.getCurrentDirectory();
|
||||
const getCanonicalFileName = createGetCanonicalFileName(sys.useCaseSensitiveFileNames);
|
||||
const commandLineOptions = convertToOptionsWithAbsolutePaths(
|
||||
commandLine.options,
|
||||
fileName => toPath(fileName, currentDirectory, getCanonicalFileName)
|
||||
);
|
||||
if (configFileName) {
|
||||
const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, sys, reportDiagnostic)!; // TODO: GH#18217
|
||||
if (commandLineOptions.showConfig) {
|
||||
if (configParseResult.errors.length !== 0) {
|
||||
updateReportDiagnostic(configParseResult.options);
|
||||
configParseResult.errors.forEach(reportDiagnostic);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
// eslint-disable-next-line no-null/no-null
|
||||
sys.write(JSON.stringify(convertToTSConfig(configParseResult, configFileName, sys), null, 4) + sys.newLine);
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
updateReportDiagnostic(configParseResult.options);
|
||||
if (isWatchSet(configParseResult.options)) {
|
||||
reportWatchModeWithoutSysSupport();
|
||||
createWatchOfConfigFile(configParseResult, commandLineOptions);
|
||||
}
|
||||
else if (isIncrementalCompilation(configParseResult.options)) {
|
||||
performIncrementalCompilation(configParseResult);
|
||||
}
|
||||
else {
|
||||
performCompilation(configParseResult.fileNames, configParseResult.projectReferences, configParseResult.options, getConfigFileParsingDiagnostics(configParseResult));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (commandLineOptions.showConfig) {
|
||||
// eslint-disable-next-line no-null/no-null
|
||||
sys.write(JSON.stringify(convertToTSConfig(commandLine, combinePaths(currentDirectory, "tsconfig.json"), sys), null, 4) + sys.newLine);
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
updateReportDiagnostic(commandLineOptions);
|
||||
if (isWatchSet(commandLineOptions)) {
|
||||
reportWatchModeWithoutSysSupport();
|
||||
createWatchOfFilesAndCompilerOptions(commandLine.fileNames, commandLineOptions);
|
||||
}
|
||||
else if (isIncrementalCompilation(commandLineOptions)) {
|
||||
performIncrementalCompilation({
|
||||
...commandLine,
|
||||
options: commandLineOptions
|
||||
});
|
||||
}
|
||||
else {
|
||||
performCompilation(commandLine.fileNames, /*references*/ undefined, commandLineOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function executeCommandLine(args: string[]): void {
|
||||
if (args.length > 0 && args[0].charCodeAt(0) === CharacterCodes.minus) {
|
||||
const firstOption = args[0].slice(args[0].charCodeAt(1) === CharacterCodes.minus ? 2 : 1).toLowerCase();
|
||||
if (firstOption === "build" || firstOption === "b") {
|
||||
return performBuild(args.slice(1));
|
||||
}
|
||||
}
|
||||
|
||||
const commandLine = parseCommandLine(args);
|
||||
|
||||
if (commandLine.options.generateCpuProfile && sys.enableCPUProfiler) {
|
||||
sys.enableCPUProfiler(commandLine.options.generateCpuProfile, () => executeCommandLineWorker(commandLine));
|
||||
}
|
||||
else {
|
||||
executeCommandLineWorker(commandLine);
|
||||
}
|
||||
}
|
||||
|
||||
function reportWatchModeWithoutSysSupport() {
|
||||
if (!sys.watchFile || !sys.watchDirectory) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"));
|
||||
sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
}
|
||||
|
||||
function performBuildWorker(buildOptions: BuildOptions, projects: string[], errors: Diagnostic[]) {
|
||||
// Update to pretty if host supports it
|
||||
updateReportDiagnostic(buildOptions);
|
||||
|
||||
if (buildOptions.locale) {
|
||||
validateLocaleAndSetLanguage(buildOptions.locale, sys, errors);
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
errors.forEach(reportDiagnostic);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
if (buildOptions.help) {
|
||||
printVersion();
|
||||
printHelp(buildOpts, "--build ");
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
|
||||
if (projects.length === 0) {
|
||||
printVersion();
|
||||
printHelp(buildOpts, "--build ");
|
||||
return sys.exit(ExitStatus.Success);
|
||||
}
|
||||
|
||||
if (!sys.getModifiedTime || !sys.setModifiedTime || (buildOptions.clean && !sys.deleteFile)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--build"));
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
if (buildOptions.watch) {
|
||||
reportWatchModeWithoutSysSupport();
|
||||
const buildHost = createSolutionBuilderWithWatchHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createWatchStatusReporter(buildOptions));
|
||||
updateCreateProgram(buildHost);
|
||||
buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(program.getProgram());
|
||||
const builder = createSolutionBuilderWithWatch(buildHost, projects, buildOptions);
|
||||
builder.build();
|
||||
return;
|
||||
}
|
||||
|
||||
const buildHost = createSolutionBuilderHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createReportErrorSummary(buildOptions));
|
||||
updateCreateProgram(buildHost);
|
||||
buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(program.getProgram());
|
||||
const builder = createSolutionBuilder(buildHost, projects, buildOptions);
|
||||
return sys.exit(buildOptions.clean ? builder.clean() : builder.build());
|
||||
}
|
||||
|
||||
function performBuild(args: string[]) {
|
||||
const { buildOptions, projects, errors } = parseBuildCommand(args);
|
||||
if (buildOptions.generateCpuProfile && sys.enableCPUProfiler) {
|
||||
sys.enableCPUProfiler(buildOptions.generateCpuProfile, () => performBuildWorker(buildOptions, projects, errors));
|
||||
}
|
||||
else {
|
||||
performBuildWorker(buildOptions, projects, errors);
|
||||
}
|
||||
}
|
||||
|
||||
function createReportErrorSummary(options: CompilerOptions | BuildOptions): ReportEmitErrorSummary | undefined {
|
||||
return shouldBePretty(options) ?
|
||||
errorCount => sys.write(getErrorSummaryText(errorCount, sys.newLine)) :
|
||||
undefined;
|
||||
}
|
||||
|
||||
function performCompilation(rootNames: string[], projectReferences: readonly ProjectReference[] | undefined, options: CompilerOptions, configFileParsingDiagnostics?: readonly Diagnostic[]) {
|
||||
const host = createCompilerHost(options);
|
||||
const currentDirectory = host.getCurrentDirectory();
|
||||
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
||||
changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, currentDirectory, getCanonicalFileName));
|
||||
enableStatistics(options);
|
||||
|
||||
const programOptions: CreateProgramOptions = {
|
||||
rootNames,
|
||||
options,
|
||||
projectReferences,
|
||||
host,
|
||||
configFileParsingDiagnostics
|
||||
};
|
||||
const program = createProgram(programOptions);
|
||||
const exitStatus = emitFilesAndReportErrorsAndGetExitStatus(
|
||||
program,
|
||||
reportDiagnostic,
|
||||
s => sys.write(s + sys.newLine),
|
||||
createReportErrorSummary(options)
|
||||
);
|
||||
reportStatistics(program);
|
||||
return sys.exit(exitStatus);
|
||||
}
|
||||
|
||||
function performIncrementalCompilation(config: ParsedCommandLine) {
|
||||
const { options, fileNames, projectReferences } = config;
|
||||
enableStatistics(options);
|
||||
return sys.exit(ts.performIncrementalCompilation({
|
||||
rootNames: fileNames,
|
||||
options,
|
||||
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config),
|
||||
projectReferences,
|
||||
reportDiagnostic,
|
||||
reportErrorSummary: createReportErrorSummary(options),
|
||||
afterProgramEmitAndDiagnostics: builderProgram => reportStatistics(builderProgram.getProgram())
|
||||
}));
|
||||
}
|
||||
|
||||
function updateCreateProgram<T extends BuilderProgram>(host: { createProgram: CreateProgram<T>; }) {
|
||||
const compileUsingBuilder = host.createProgram;
|
||||
host.createProgram = (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) => {
|
||||
Debug.assert(rootNames !== undefined || (options === undefined && !!oldProgram));
|
||||
if (options !== undefined) {
|
||||
enableStatistics(options);
|
||||
}
|
||||
return compileUsingBuilder(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences);
|
||||
};
|
||||
}
|
||||
|
||||
function updateWatchCompilationHost(watchCompilerHost: WatchCompilerHost<EmitAndSemanticDiagnosticsBuilderProgram>) {
|
||||
updateCreateProgram(watchCompilerHost);
|
||||
const emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate!; // TODO: GH#18217
|
||||
watchCompilerHost.afterProgramCreate = builderProgram => {
|
||||
emitFilesUsingBuilder(builderProgram);
|
||||
reportStatistics(builderProgram.getProgram());
|
||||
};
|
||||
}
|
||||
|
||||
function createWatchStatusReporter(options: CompilerOptions | BuildOptions) {
|
||||
return ts.createWatchStatusReporter(sys, shouldBePretty(options));
|
||||
}
|
||||
|
||||
function createWatchOfConfigFile(configParseResult: ParsedCommandLine, optionsToExtend: CompilerOptions) {
|
||||
const watchCompilerHost = createWatchCompilerHostOfConfigFile(configParseResult.options.configFilePath!, optionsToExtend, sys, /*createProgram*/ undefined, reportDiagnostic, createWatchStatusReporter(configParseResult.options)); // TODO: GH#18217
|
||||
updateWatchCompilationHost(watchCompilerHost);
|
||||
watchCompilerHost.configFileParsingResult = configParseResult;
|
||||
createWatchProgram(watchCompilerHost);
|
||||
}
|
||||
|
||||
function createWatchOfFilesAndCompilerOptions(rootFiles: string[], options: CompilerOptions) {
|
||||
const watchCompilerHost = createWatchCompilerHostOfFilesAndCompilerOptions(rootFiles, options, sys, /*createProgram*/ undefined, reportDiagnostic, createWatchStatusReporter(options));
|
||||
updateWatchCompilationHost(watchCompilerHost);
|
||||
createWatchProgram(watchCompilerHost);
|
||||
}
|
||||
|
||||
function enableStatistics(compilerOptions: CompilerOptions) {
|
||||
if (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics) {
|
||||
performance.enable();
|
||||
}
|
||||
}
|
||||
|
||||
function reportStatistics(program: Program) {
|
||||
let statistics: Statistic[];
|
||||
const compilerOptions = program.getCompilerOptions();
|
||||
if (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics) {
|
||||
statistics = [];
|
||||
const memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
|
||||
reportCountStatistic("Files", program.getSourceFiles().length);
|
||||
reportCountStatistic("Lines", countLines(program));
|
||||
reportCountStatistic("Nodes", program.getNodeCount());
|
||||
reportCountStatistic("Identifiers", program.getIdentifierCount());
|
||||
reportCountStatistic("Symbols", program.getSymbolCount());
|
||||
reportCountStatistic("Types", program.getTypeCount());
|
||||
|
||||
if (memoryUsed >= 0) {
|
||||
reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K");
|
||||
}
|
||||
|
||||
const programTime = performance.getDuration("Program");
|
||||
const bindTime = performance.getDuration("Bind");
|
||||
const checkTime = performance.getDuration("Check");
|
||||
const emitTime = performance.getDuration("Emit");
|
||||
if (compilerOptions.extendedDiagnostics) {
|
||||
const caches = program.getRelationCacheSizes();
|
||||
reportCountStatistic("Assignability cache size", caches.assignable);
|
||||
reportCountStatistic("Identity cache size", caches.identity);
|
||||
reportCountStatistic("Subtype cache size", caches.subtype);
|
||||
performance.forEachMeasure((name, duration) => reportTimeStatistic(`${name} time`, duration));
|
||||
}
|
||||
else {
|
||||
// Individual component times.
|
||||
// Note: To match the behavior of previous versions of the compiler, the reported parse time includes
|
||||
// I/O read time and processing time for triple-slash references and module imports, and the reported
|
||||
// emit time includes I/O write time. We preserve this behavior so we can accurately compare times.
|
||||
reportTimeStatistic("I/O read", performance.getDuration("I/O Read"));
|
||||
reportTimeStatistic("I/O write", performance.getDuration("I/O Write"));
|
||||
reportTimeStatistic("Parse time", programTime);
|
||||
reportTimeStatistic("Bind time", bindTime);
|
||||
reportTimeStatistic("Check time", checkTime);
|
||||
reportTimeStatistic("Emit time", emitTime);
|
||||
}
|
||||
reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
|
||||
reportStatistics();
|
||||
|
||||
performance.disable();
|
||||
}
|
||||
|
||||
function reportStatistics() {
|
||||
let nameSize = 0;
|
||||
let valueSize = 0;
|
||||
for (const { name, value } of statistics) {
|
||||
if (name.length > nameSize) {
|
||||
nameSize = name.length;
|
||||
}
|
||||
|
||||
if (value.length > valueSize) {
|
||||
valueSize = value.length;
|
||||
}
|
||||
}
|
||||
|
||||
for (const { name, value } of statistics) {
|
||||
sys.write(padRight(name + ":", nameSize + 2) + padLeft(value.toString(), valueSize) + sys.newLine);
|
||||
}
|
||||
}
|
||||
|
||||
function reportStatisticalValue(name: string, value: string) {
|
||||
statistics.push({ name, value });
|
||||
}
|
||||
|
||||
function reportCountStatistic(name: string, count: number) {
|
||||
reportStatisticalValue(name, "" + count);
|
||||
}
|
||||
|
||||
function reportTimeStatistic(name: string, time: number) {
|
||||
reportStatisticalValue(name, (time / 1000).toFixed(2) + "s");
|
||||
}
|
||||
}
|
||||
|
||||
function writeConfigFile(options: CompilerOptions, fileNames: string[]) {
|
||||
const currentDirectory = sys.getCurrentDirectory();
|
||||
const file = normalizePath(combinePaths(currentDirectory, "tsconfig.json"));
|
||||
if (sys.fileExists(file)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file));
|
||||
}
|
||||
else {
|
||||
sys.writeFile(file, generateTSConfig(options, fileNames, sys.newLine));
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Successfully_created_a_tsconfig_json_file));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ts.Debug.isDebugging) {
|
||||
ts.Debug.enableDebugInfo();
|
||||
}
|
||||
|
||||
if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))) {
|
||||
ts.sys.tryEnableSourceMapsForHost();
|
||||
}
|
||||
|
||||
if (ts.sys.setBlocking) {
|
||||
ts.sys.setBlocking();
|
||||
}
|
||||
|
||||
ts.executeCommandLine(ts.sys.args);
|
||||
// This file actually uses arguments passed on commandline and executes it
|
||||
ts.executeCommandLine(
|
||||
ts.sys,
|
||||
{
|
||||
onCompilerHostCreate: ts.noop,
|
||||
onCompilationComplete: ts.noop,
|
||||
onSolutionBuilderHostCreate: ts.noop,
|
||||
onSolutionBuildComplete: ts.noop
|
||||
},
|
||||
ts.sys.args
|
||||
);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"outFile": "../../built/local/tsc.js"
|
||||
},
|
||||
"files": [
|
||||
"executeCommandLine.ts",
|
||||
"tsc.ts"
|
||||
],
|
||||
"references": [
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/module.js]
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/module.js]
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/module.js]
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/module.js]
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/module.js]
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/module.js]
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
12:08:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/module.js]
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
12:08:00 AM - Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/module.d.ts.map]
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
12:08:00 AM - Updating output of project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/module.d.ts]
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
12:01:00 AM - Building project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/module.d.ts]
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
12:01:00 AM - Building project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/file3.ts]
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
12:01:00 AM - Building project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/file3.ts]
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
12:01:00 AM - Building project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/file3.ts]
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
12:01:00 AM - Building project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/module.d.ts]
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
12:01:00 AM - Building project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/file4.ts]
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
12:00:00 AM - Building project '/src/app/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/app/file3.ts]
|
||||
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --b /src --verbose
|
||||
12:01:00 AM - Projects in this build:
|
||||
* src/src/folder/tsconfig.json
|
||||
* src/src/folder2/tsconfig.json
|
||||
* src/src/tsconfig.json
|
||||
* src/tests/tsconfig.json
|
||||
* src/tsconfig.json
|
||||
|
||||
12:01:00 AM - Project 'src/src/folder/tsconfig.json' is out of date because output file 'src/src/folder/index.js' does not exist
|
||||
|
||||
12:01:00 AM - Building project '/src/src/folder/tsconfig.json'...
|
||||
|
||||
12:01:00 AM - Project 'src/src/folder2/tsconfig.json' is out of date because output file 'src/src/folder2/index.js' does not exist
|
||||
|
||||
12:01:00 AM - Building project '/src/src/folder2/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'...
|
||||
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/src/folder/index.d.ts]
|
||||
export declare const x = 10;
|
||||
|
||||
|
||||
//// [/src/src/folder/index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = 10;
|
||||
|
||||
|
||||
//// [/src/src/folder/tsconfig.tsbuildinfo]
|
||||
{
|
||||
"program": {
|
||||
"fileInfos": {
|
||||
"../../../lib/lib.d.ts": {
|
||||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
|
||||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
|
||||
},
|
||||
"./index.ts": {
|
||||
"version": "-10726455937-export const x = 10;",
|
||||
"signature": "-6057683066-export declare const x = 10;\r\n"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"composite": true,
|
||||
"configFilePath": "./tsconfig.json"
|
||||
},
|
||||
"referencedMap": {},
|
||||
"exportedModulesMap": {},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../../lib/lib.d.ts",
|
||||
"./index.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
//// [/src/src/folder2/index.d.ts]
|
||||
export declare const x = 10;
|
||||
|
||||
|
||||
//// [/src/src/folder2/index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = 10;
|
||||
|
||||
|
||||
//// [/src/src/folder2/tsconfig.tsbuildinfo]
|
||||
{
|
||||
"program": {
|
||||
"fileInfos": {
|
||||
"../../../lib/lib.d.ts": {
|
||||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
|
||||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
|
||||
},
|
||||
"./index.ts": {
|
||||
"version": "-10726455937-export const x = 10;",
|
||||
"signature": "-6057683066-export declare const x = 10;\r\n"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"composite": true,
|
||||
"configFilePath": "./tsconfig.json"
|
||||
},
|
||||
"referencedMap": {},
|
||||
"exportedModulesMap": {},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../../lib/lib.d.ts",
|
||||
"./index.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
//// [/src/tests/index.d.ts]
|
||||
export declare const x = 10;
|
||||
|
||||
|
||||
//// [/src/tests/index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = 10;
|
||||
|
||||
|
||||
//// [/src/tests/tsconfig.tsbuildinfo]
|
||||
{
|
||||
"program": {
|
||||
"fileInfos": {
|
||||
"../../lib/lib.d.ts": {
|
||||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
|
||||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
|
||||
},
|
||||
"./index.ts": {
|
||||
"version": "-10726455937-export const x = 10;",
|
||||
"signature": "-6057683066-export declare const x = 10;\r\n"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"composite": true,
|
||||
"configFilePath": "./tsconfig.json"
|
||||
},
|
||||
"referencedMap": {},
|
||||
"exportedModulesMap": {},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../lib/lib.d.ts",
|
||||
"./index.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
//// [/lib/no-change-runOutput.txt]
|
||||
/lib/tsc --b /src --verbose
|
||||
12:04:00 AM - Projects in this build:
|
||||
* src/src/folder/tsconfig.json
|
||||
* src/src/folder2/tsconfig.json
|
||||
* src/src/tsconfig.json
|
||||
* src/tests/tsconfig.json
|
||||
* src/tsconfig.json
|
||||
|
||||
12:04:00 AM - Project 'src/src/folder/tsconfig.json' is up to date because newest input 'src/src/folder/index.ts' is older than oldest output 'src/src/folder/index.js'
|
||||
|
||||
12:04:00 AM - Project 'src/src/folder2/tsconfig.json' is up to date because newest input 'src/src/folder2/index.ts' is older than oldest output 'src/src/folder2/index.js'
|
||||
|
||||
12:04:00 AM - Project 'src/tests/tsconfig.json' is up to date because newest input 'src/tests/index.ts' is older than oldest output 'src/tests/index.js'
|
||||
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --b /src/tsconfig.json --verbose
|
||||
12:00:00 AM - Projects in this build:
|
||||
* src/core/tsconfig.json
|
||||
* src/animals/tsconfig.json
|
||||
* src/zoo/tsconfig.json
|
||||
* src/tsconfig.json
|
||||
|
||||
12:00:00 AM - Project 'src/core/tsconfig.json' is out of date because output file 'src/lib/core/utilities.js' does not exist
|
||||
|
||||
12:00:00 AM - Building project '/src/core/tsconfig.json'...
|
||||
|
||||
src/animals/index.ts(1,20): error TS6059: File '/src/animals/animal.ts' is not under 'rootDir' '/src/core'. 'rootDir' is expected to contain all source files.
|
||||
src/animals/index.ts(1,20): error TS6307: File '/src/animals/animal.ts' is not listed within the file list of project '/src/core/tsconfig.json'. Projects must list all files or use an 'include' pattern.
|
||||
src/animals/index.ts(4,32): error TS6059: File '/src/animals/dog.ts' is not under 'rootDir' '/src/core'. 'rootDir' is expected to contain all source files.
|
||||
src/animals/index.ts(4,32): error TS6307: File '/src/animals/dog.ts' is not listed within the file list of project '/src/core/tsconfig.json'. Projects must list all files or use an 'include' pattern.
|
||||
src/core/utilities.ts(1,1): error TS6133: 'A' is declared but its value is never read.
|
||||
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.
|
||||
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.
|
||||
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
|
||||
|
||||
12:00:00 AM - Project 'src/zoo/tsconfig.json' can't be built because its dependency 'src/animals' was not built
|
||||
|
||||
12:00:00 AM - Skipping build of project '/src/zoo/tsconfig.json' because its dependency '/src/animals' was not built
|
||||
|
||||
exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped
|
||||
|
||||
|
||||
//// [/src/core/utilities.ts]
|
||||
import * as A from '../animals';
|
||||
|
||||
export function makeRandomName() {
|
||||
return "Bob!?! ";
|
||||
}
|
||||
|
||||
export function lastElementOf<T>(arr: T[]): T | undefined {
|
||||
if (arr.length === 0) return undefined;
|
||||
return arr[arr.length - 1];
|
||||
}
|
||||
|
||||
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --b /src/tsconfig.json --verbose
|
||||
12:00:00 AM - Projects in this build:
|
||||
* src/animals/tsconfig.json
|
||||
* src/zoo/tsconfig.json
|
||||
* src/core/tsconfig.json
|
||||
* src/tsconfig.json
|
||||
|
||||
error TS6202: Project references may not form a circular graph. Cycle detected: /src/tsconfig.json
|
||||
/src/core/tsconfig.json
|
||||
/src/zoo/tsconfig.json
|
||||
/src/animals/tsconfig.json
|
||||
exitCode:: ExitStatus.ProjectReferenceCycle_OutputsSkupped
|
||||
|
||||
|
||||
//// [/src/core/tsconfig.json]
|
||||
{
|
||||
"extends": "../tsconfig-base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../lib/core",
|
||||
"rootDir": "."
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"path": "../zoo"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+292
@@ -0,0 +1,292 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --b /src/tsconfig.json --verbose
|
||||
12:00:00 AM - Projects in this build:
|
||||
* src/core/tsconfig.json
|
||||
* src/animals/tsconfig.json
|
||||
* src/zoo/tsconfig.json
|
||||
* src/tsconfig.json
|
||||
|
||||
12:00:00 AM - Project 'src/core/tsconfig.json' is out of date because output file 'src/lib/core/utilities.js' does not exist
|
||||
|
||||
12:00:00 AM - Building project '/src/core/tsconfig.json'...
|
||||
|
||||
12:00:00 AM - Project 'src/animals/tsconfig.json' is out of date because output file 'src/lib/animals/animal.js' does not exist
|
||||
|
||||
12:00:00 AM - Building project '/src/animals/tsconfig.json'...
|
||||
|
||||
12:00:00 AM - Project 'src/zoo/tsconfig.json' is out of date because output file 'src/lib/zoo/zoo.js' does not exist
|
||||
|
||||
12:00:00 AM - Building project '/src/zoo/tsconfig.json'...
|
||||
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/lib/animals/animal.d.ts]
|
||||
export declare type Size = "small" | "medium" | "large";
|
||||
export default interface Animal {
|
||||
size: Size;
|
||||
}
|
||||
|
||||
|
||||
//// [/src/lib/animals/animal.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
||||
|
||||
//// [/src/lib/animals/dog.d.ts]
|
||||
import Animal from '.';
|
||||
export interface Dog extends Animal {
|
||||
woof(): void;
|
||||
name: string;
|
||||
}
|
||||
export declare function createDog(): Dog;
|
||||
|
||||
|
||||
//// [/src/lib/animals/dog.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var utilities_1 = require("../core/utilities");
|
||||
function createDog() {
|
||||
return ({
|
||||
size: "medium",
|
||||
woof: function () {
|
||||
console.log(this.name + " says \"Woof\"!");
|
||||
},
|
||||
name: utilities_1.makeRandomName()
|
||||
});
|
||||
}
|
||||
exports.createDog = createDog;
|
||||
|
||||
|
||||
//// [/src/lib/animals/index.d.ts]
|
||||
import Animal from './animal';
|
||||
export default Animal;
|
||||
import { createDog, Dog } from './dog';
|
||||
export { createDog, Dog };
|
||||
|
||||
|
||||
//// [/src/lib/animals/index.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var animal_1 = require("./animal");
|
||||
var dog_1 = require("./dog");
|
||||
exports.createDog = dog_1.createDog;
|
||||
|
||||
|
||||
//// [/src/lib/animals/tsconfig.tsbuildinfo]
|
||||
{
|
||||
"program": {
|
||||
"fileInfos": {
|
||||
"../../../lib/lib.d.ts": {
|
||||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
|
||||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
|
||||
},
|
||||
"../../animals/animal.ts": {
|
||||
"version": "-14984181202-export type Size = \"small\" | \"medium\" | \"large\";\r\nexport default interface Animal {\r\n size: Size;\r\n}\r\n",
|
||||
"signature": "13427676350-export declare type Size = \"small\" | \"medium\" | \"large\";\r\nexport default interface Animal {\r\n size: Size;\r\n}\r\n"
|
||||
},
|
||||
"../../animals/index.ts": {
|
||||
"version": "-5382672599-import Animal from './animal';\r\n\r\nexport default Animal;\r\nimport { createDog, Dog } from './dog';\r\nexport { createDog, Dog };\r\n",
|
||||
"signature": "4477582546-import Animal from './animal';\r\nexport default Animal;\r\nimport { createDog, Dog } from './dog';\r\nexport { createDog, Dog };\r\n"
|
||||
},
|
||||
"../../core/utilities.ts": {
|
||||
"version": "-8177343116-export declare function makeRandomName(): string;\r\nexport declare function lastElementOf<T>(arr: T[]): T | undefined;\r\n",
|
||||
"signature": "-8177343116-export declare function makeRandomName(): string;\r\nexport declare function lastElementOf<T>(arr: T[]): T | undefined;\r\n"
|
||||
},
|
||||
"../../animals/dog.ts": {
|
||||
"version": "-10991948013-import Animal from '.';\r\nimport { makeRandomName } from '../core/utilities';\r\n\r\nexport interface Dog extends Animal {\r\n woof(): void;\r\n name: string;\r\n}\r\n\r\nexport function createDog(): Dog {\r\n return ({\r\n size: \"medium\",\r\n woof: function(this: Dog) {\r\n console.log(`${this.name} says \"Woof\"!`);\r\n },\r\n name: makeRandomName()\r\n });\r\n}\r\n\r\n",
|
||||
"signature": "10854678623-import Animal from '.';\r\nexport interface Dog extends Animal {\r\n woof(): void;\r\n name: string;\r\n}\r\nexport declare function createDog(): Dog;\r\n"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"declaration": true,
|
||||
"target": 1,
|
||||
"module": 1,
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"composite": true,
|
||||
"outDir": "./",
|
||||
"rootDir": "../../animals",
|
||||
"configFilePath": "../../animals/tsconfig.json"
|
||||
},
|
||||
"referencedMap": {
|
||||
"../../animals/dog.ts": [
|
||||
"../../animals/index.ts",
|
||||
"../core/utilities.d.ts"
|
||||
],
|
||||
"../../animals/index.ts": [
|
||||
"../../animals/animal.ts",
|
||||
"../../animals/dog.ts"
|
||||
]
|
||||
},
|
||||
"exportedModulesMap": {
|
||||
"../../animals/dog.ts": [
|
||||
"../../animals/index.ts"
|
||||
],
|
||||
"../../animals/index.ts": [
|
||||
"../../animals/animal.ts",
|
||||
"../../animals/dog.ts"
|
||||
]
|
||||
},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../../lib/lib.d.ts",
|
||||
"../../animals/animal.ts",
|
||||
"../../animals/dog.ts",
|
||||
"../../animals/index.ts",
|
||||
"../../core/utilities.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
//// [/src/lib/core/tsconfig.tsbuildinfo]
|
||||
{
|
||||
"program": {
|
||||
"fileInfos": {
|
||||
"../../../lib/lib.d.ts": {
|
||||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
|
||||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
|
||||
},
|
||||
"../../core/utilities.ts": {
|
||||
"version": "25274411612-\r\nexport function makeRandomName() {\r\n return \"Bob!?! \";\r\n}\r\n\r\nexport function lastElementOf<T>(arr: T[]): T | undefined {\r\n if (arr.length === 0) return undefined;\r\n return arr[arr.length - 1];\r\n}\r\n\r\n",
|
||||
"signature": "-8177343116-export declare function makeRandomName(): string;\r\nexport declare function lastElementOf<T>(arr: T[]): T | undefined;\r\n"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"declaration": true,
|
||||
"target": 1,
|
||||
"module": 1,
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"composite": true,
|
||||
"outDir": "./",
|
||||
"rootDir": "../../core",
|
||||
"configFilePath": "../../core/tsconfig.json"
|
||||
},
|
||||
"referencedMap": {},
|
||||
"exportedModulesMap": {},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../../lib/lib.d.ts",
|
||||
"../../core/utilities.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
//// [/src/lib/core/utilities.d.ts]
|
||||
export declare function makeRandomName(): string;
|
||||
export declare function lastElementOf<T>(arr: T[]): T | undefined;
|
||||
|
||||
|
||||
//// [/src/lib/core/utilities.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function makeRandomName() {
|
||||
return "Bob!?! ";
|
||||
}
|
||||
exports.makeRandomName = makeRandomName;
|
||||
function lastElementOf(arr) {
|
||||
if (arr.length === 0)
|
||||
return undefined;
|
||||
return arr[arr.length - 1];
|
||||
}
|
||||
exports.lastElementOf = lastElementOf;
|
||||
|
||||
|
||||
//// [/src/lib/zoo/tsconfig.tsbuildinfo]
|
||||
{
|
||||
"program": {
|
||||
"fileInfos": {
|
||||
"../../../lib/lib.d.ts": {
|
||||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
|
||||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
|
||||
},
|
||||
"../../animals/animal.ts": {
|
||||
"version": "13427676350-export declare type Size = \"small\" | \"medium\" | \"large\";\r\nexport default interface Animal {\r\n size: Size;\r\n}\r\n",
|
||||
"signature": "13427676350-export declare type Size = \"small\" | \"medium\" | \"large\";\r\nexport default interface Animal {\r\n size: Size;\r\n}\r\n"
|
||||
},
|
||||
"../../animals/dog.ts": {
|
||||
"version": "10854678623-import Animal from '.';\r\nexport interface Dog extends Animal {\r\n woof(): void;\r\n name: string;\r\n}\r\nexport declare function createDog(): Dog;\r\n",
|
||||
"signature": "10854678623-import Animal from '.';\r\nexport interface Dog extends Animal {\r\n woof(): void;\r\n name: string;\r\n}\r\nexport declare function createDog(): Dog;\r\n"
|
||||
},
|
||||
"../../animals/index.ts": {
|
||||
"version": "4477582546-import Animal from './animal';\r\nexport default Animal;\r\nimport { createDog, Dog } from './dog';\r\nexport { createDog, Dog };\r\n",
|
||||
"signature": "4477582546-import Animal from './animal';\r\nexport default Animal;\r\nimport { createDog, Dog } from './dog';\r\nexport { createDog, Dog };\r\n"
|
||||
},
|
||||
"../../zoo/zoo.ts": {
|
||||
"version": "8797123924-import { Dog, createDog } from '../animals/index';\r\n\r\nexport function createZoo(): Array<Dog> {\r\n return [\r\n createDog()\r\n ];\r\n}\r\n\r\n",
|
||||
"signature": "-17433436879-import { Dog } from '../animals/index';\r\nexport declare function createZoo(): Array<Dog>;\r\n"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"declaration": true,
|
||||
"target": 1,
|
||||
"module": 1,
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"composite": true,
|
||||
"outDir": "./",
|
||||
"rootDir": "../../zoo",
|
||||
"configFilePath": "../../zoo/tsconfig.json"
|
||||
},
|
||||
"referencedMap": {
|
||||
"../../animals/dog.ts": [
|
||||
"../animals/index.d.ts"
|
||||
],
|
||||
"../../animals/index.ts": [
|
||||
"../animals/animal.d.ts",
|
||||
"../animals/dog.d.ts"
|
||||
],
|
||||
"../../zoo/zoo.ts": [
|
||||
"../animals/index.d.ts"
|
||||
]
|
||||
},
|
||||
"exportedModulesMap": {
|
||||
"../../animals/dog.ts": [
|
||||
"../animals/index.d.ts"
|
||||
],
|
||||
"../../animals/index.ts": [
|
||||
"../animals/animal.d.ts",
|
||||
"../animals/dog.d.ts"
|
||||
],
|
||||
"../../zoo/zoo.ts": [
|
||||
"../animals/index.d.ts"
|
||||
]
|
||||
},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../../lib/lib.d.ts",
|
||||
"../../animals/animal.ts",
|
||||
"../../animals/dog.ts",
|
||||
"../../animals/index.ts",
|
||||
"../../zoo/zoo.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
//// [/src/lib/zoo/zoo.d.ts]
|
||||
import { Dog } from '../animals/index';
|
||||
export declare function createZoo(): Array<Dog>;
|
||||
|
||||
|
||||
//// [/src/lib/zoo/zoo.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var index_1 = require("../animals/index");
|
||||
function createZoo() {
|
||||
return [
|
||||
index_1.createDog()
|
||||
];
|
||||
}
|
||||
exports.createZoo = createZoo;
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
12:04:00 AM - Building project '/src/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/lib/a.d.ts]
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
12:04:00 AM - Building project '/src/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/lib/a.d.ts]
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
12:04:00 AM - Building project '/src/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/lib/a.d.ts]
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
12:08:00 AM - Updating unchanged output timestamps of project '/src/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/lib/a.d.ts] file written with same contents
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
12:01:00 AM - Building project '/src/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/lib/a.d.ts]
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
12:01:00 AM - Building project '/src/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/lib/a.d.ts]
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
12:01:00 AM - Building project '/src/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/lib/a.d.ts]
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --b /src/with-references
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/core/index.d.ts]
|
||||
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,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"}
|
||||
|
||||
//// [/src/core/index.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
function multiply(a, b) { return a * b; }
|
||||
exports.multiply = multiply;
|
||||
|
||||
|
||||
//// [/src/core/tsconfig.tsbuildinfo]
|
||||
{
|
||||
"program": {
|
||||
"fileInfos": {
|
||||
"../../lib/lib.d.ts": {
|
||||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
|
||||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
|
||||
},
|
||||
"./index.ts": {
|
||||
"version": "5112841898-export function multiply(a: number, b: number) { return a * b; }\r\n",
|
||||
"signature": "3361149553-export declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"composite": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"skipDefaultLibCheck": true,
|
||||
"configFilePath": "./tsconfig.json"
|
||||
},
|
||||
"referencedMap": {},
|
||||
"exportedModulesMap": {},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../lib/lib.d.ts",
|
||||
"./index.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --b /src/no-references
|
||||
src/no-references/tsconfig.json(3,14): error TS18002: The 'files' list in config file '/src/no-references/tsconfig.json' is empty.
|
||||
exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc -b bogus.json
|
||||
error TS6053: File '/bogus.json' not found.
|
||||
exitCode:: 1
|
||||
exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/bar.ts]
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/bar.ts]
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
12:04:00 AM - Building project '/src/tsconfig.json'...
|
||||
|
||||
src/lazyIndex.ts(4,5): error TS2554: Expected 0 arguments, but got 1.
|
||||
exitCode:: 1
|
||||
exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped
|
||||
|
||||
|
||||
//// [/src/bar.ts]
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
12:01:00 AM - Building project '/src/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/obj/bar.d.ts]
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
12:01:00 AM - Building project '/src/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/obj/bar.d.ts]
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
12:01:00 AM - Building project '/src/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/lazyIndex.ts]
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//// [/lib/incremental-declaration-doesnt-changeOutput.txt]
|
||||
/lib/tsc -b /src
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/sub-project/index.js]
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ module.exports = {};
|
||||
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc -b /src
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/lib/sub-project/index.d.ts]
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc -b /src
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/out/sub-project/index.d.ts]
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc -b /src
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/common/common.d.ts]
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc -b /src
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/common/common.d.ts]
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/src/main.js]
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
12:01:00 AM - Building project '/src/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/src/hkt.js]
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --b /src/tsconfig.json
|
||||
error TS5058: The specified path does not exist: '/src/foobar.json'.
|
||||
error TS18003: No inputs were found in config file '/src/tsconfig.first.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '[]'.
|
||||
error TS5058: The specified path does not exist: '/src/foobar.json'.
|
||||
error TS18003: No inputs were found in config file '/src/tsconfig.second.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '[]'.
|
||||
exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
12:00:00 AM - Building project '/src/solution/sub-project-2/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/lib/solution/common/nominal.d.ts]
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --b /src/third --clean
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/2/second-output.d.ts] unlink
|
||||
//// [/src/2/second-output.d.ts.map] unlink
|
||||
//// [/src/2/second-output.js] unlink
|
||||
//// [/src/2/second-output.js.map] unlink
|
||||
//// [/src/2/second-output.tsbuildinfo] unlink
|
||||
//// [/src/first/bin/first-output.d.ts] unlink
|
||||
//// [/src/first/bin/first-output.d.ts.map] unlink
|
||||
//// [/src/first/bin/first-output.js] unlink
|
||||
//// [/src/first/bin/first-output.js.map] unlink
|
||||
//// [/src/first/bin/first-output.tsbuildinfo] unlink
|
||||
//// [/src/third/thirdjs/output/third-output.d.ts] unlink
|
||||
//// [/src/third/thirdjs/output/third-output.d.ts.map] unlink
|
||||
//// [/src/third/thirdjs/output/third-output.js] unlink
|
||||
//// [/src/third/thirdjs/output/third-output.js.map] unlink
|
||||
//// [/src/third/thirdjs/output/third-output.tsbuildinfo] unlink
|
||||
+334
@@ -0,0 +1,334 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --b /src/third --verbose
|
||||
12:00:00 AM - Projects in this build:
|
||||
* src/first/tsconfig.json
|
||||
* src/second/tsconfig.json
|
||||
* src/third/tsconfig.json
|
||||
|
||||
12:00:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/first_PART1.js' does not exist
|
||||
|
||||
12:00:00 AM - Building project '/src/first/tsconfig.json'...
|
||||
|
||||
12:00:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/second/second_part1.js' does not exist
|
||||
|
||||
12:00:00 AM - Building project '/src/second/tsconfig.json'...
|
||||
|
||||
12:00:00 AM - Project 'src/third/tsconfig.json' is out of date because output file 'src/third/third_part1.js' does not exist
|
||||
|
||||
12:00:00 AM - Building project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/first/first_PART1.d.ts]
|
||||
interface TheFirst {
|
||||
none: any;
|
||||
}
|
||||
declare const s = "Hello, world";
|
||||
interface NoJsForHereEither {
|
||||
none: any;
|
||||
}
|
||||
//# sourceMappingURL=first_PART1.d.ts.map
|
||||
|
||||
//// [/src/first/first_PART1.d.ts.map]
|
||||
{"version":3,"file":"first_PART1.d.ts","sourceRoot":"","sources":["first_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"}
|
||||
|
||||
//// [/src/first/first_PART1.js]
|
||||
var s = "Hello, world";
|
||||
console.log(s);
|
||||
//# sourceMappingURL=first_PART1.js.map
|
||||
|
||||
//// [/src/first/first_PART1.js.map]
|
||||
{"version":3,"file":"first_PART1.js","sourceRoot":"","sources":["first_PART1.ts"],"names":[],"mappings":"AAIA,IAAM,CAAC,GAAG,cAAc,CAAC;AAMzB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC"}
|
||||
|
||||
//// [/src/first/first_part2.d.ts]
|
||||
//# sourceMappingURL=first_part2.d.ts.map
|
||||
|
||||
//// [/src/first/first_part2.d.ts.map]
|
||||
{"version":3,"file":"first_part2.d.ts","sourceRoot":"","sources":["first_part2.ts"],"names":[],"mappings":""}
|
||||
|
||||
//// [/src/first/first_part2.js]
|
||||
console.log(f());
|
||||
//# sourceMappingURL=first_part2.js.map
|
||||
|
||||
//// [/src/first/first_part2.js.map]
|
||||
{"version":3,"file":"first_part2.js","sourceRoot":"","sources":["first_part2.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC"}
|
||||
|
||||
//// [/src/first/first_part3.d.ts]
|
||||
declare function f(): string;
|
||||
//# sourceMappingURL=first_part3.d.ts.map
|
||||
|
||||
//// [/src/first/first_part3.d.ts.map]
|
||||
{"version":3,"file":"first_part3.d.ts","sourceRoot":"","sources":["first_part3.ts"],"names":[],"mappings":"AAAA,iBAAS,CAAC,WAET"}
|
||||
|
||||
//// [/src/first/first_part3.js]
|
||||
function f() {
|
||||
return "JS does hoists";
|
||||
}
|
||||
//# sourceMappingURL=first_part3.js.map
|
||||
|
||||
//// [/src/first/first_part3.js.map]
|
||||
{"version":3,"file":"first_part3.js","sourceRoot":"","sources":["first_part3.ts"],"names":[],"mappings":"AAAA,SAAS,CAAC;IACN,OAAO,gBAAgB,CAAC;AAC5B,CAAC"}
|
||||
|
||||
//// [/src/first/tsconfig.json]
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"composite": true, "module": "none",
|
||||
"removeComments": true,
|
||||
"strict": false,
|
||||
"sourceMap": true,
|
||||
"declarationMap": true,
|
||||
|
||||
"skipDefaultLibCheck": true
|
||||
},
|
||||
"files": [
|
||||
"first_PART1.ts",
|
||||
"first_part2.ts",
|
||||
"first_part3.ts"
|
||||
],
|
||||
"references": [
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
//// [/src/first/tsconfig.tsbuildinfo]
|
||||
{
|
||||
"program": {
|
||||
"fileInfos": {
|
||||
"../../lib/lib.d.ts": {
|
||||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
|
||||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
|
||||
},
|
||||
"./first_part1.ts": {
|
||||
"version": "-17207381411-interface TheFirst {\r\n none: any;\r\n}\r\n\r\nconst s = \"Hello, world\";\r\n\r\ninterface NoJsForHereEither {\r\n none: any;\r\n}\r\n\r\nconsole.log(s);\r\n",
|
||||
"signature": "-17939996161-interface TheFirst {\r\n none: any;\r\n}\r\ndeclare const s = \"Hello, world\";\r\ninterface NoJsForHereEither {\r\n none: any;\r\n}\r\n//# sourceMappingURL=first_PART1.d.ts.map"
|
||||
},
|
||||
"./first_part2.ts": {
|
||||
"version": "4973778178-console.log(f());\r\n",
|
||||
"signature": "-2054710634-//# sourceMappingURL=first_part2.d.ts.map"
|
||||
},
|
||||
"./first_part3.ts": {
|
||||
"version": "6202806249-function f() {\r\n return \"JS does hoists\";\r\n}",
|
||||
"signature": "-4577888121-declare function f(): string;\r\n//# sourceMappingURL=first_part3.d.ts.map"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"target": 1,
|
||||
"composite": true,
|
||||
"module": 0,
|
||||
"removeComments": true,
|
||||
"strict": false,
|
||||
"sourceMap": true,
|
||||
"declarationMap": true,
|
||||
"skipDefaultLibCheck": true,
|
||||
"configFilePath": "./tsconfig.json"
|
||||
},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../lib/lib.d.ts",
|
||||
"./first_part1.ts",
|
||||
"./first_part2.ts",
|
||||
"./first_part3.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
//// [/src/second/second_part1.d.ts]
|
||||
declare namespace N {
|
||||
}
|
||||
declare namespace N {
|
||||
}
|
||||
//# sourceMappingURL=second_part1.d.ts.map
|
||||
|
||||
//// [/src/second/second_part1.d.ts.map]
|
||||
{"version":3,"file":"second_part1.d.ts","sourceRoot":"","sources":["second_part1.ts"],"names":[],"mappings":"AAAA,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX"}
|
||||
|
||||
//// [/src/second/second_part1.js]
|
||||
var N;
|
||||
(function (N) {
|
||||
function f() {
|
||||
console.log('testing');
|
||||
}
|
||||
f();
|
||||
})(N || (N = {}));
|
||||
//# sourceMappingURL=second_part1.js.map
|
||||
|
||||
//// [/src/second/second_part1.js.map]
|
||||
{"version":3,"file":"second_part1.js","sourceRoot":"","sources":["second_part1.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"}
|
||||
|
||||
//// [/src/second/second_part2.d.ts]
|
||||
declare class C {
|
||||
doSomething(): void;
|
||||
}
|
||||
//# sourceMappingURL=second_part2.d.ts.map
|
||||
|
||||
//// [/src/second/second_part2.d.ts.map]
|
||||
{"version":3,"file":"second_part2.d.ts","sourceRoot":"","sources":["second_part2.ts"],"names":[],"mappings":"AAAA,cAAM,CAAC;IACH,WAAW;CAGd"}
|
||||
|
||||
//// [/src/second/second_part2.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.doSomething = function () {
|
||||
console.log("something got done");
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
//# sourceMappingURL=second_part2.js.map
|
||||
|
||||
//// [/src/second/second_part2.js.map]
|
||||
{"version":3,"file":"second_part2.js","sourceRoot":"","sources":["second_part2.ts"],"names":[],"mappings":"AAAA;IAAA;IAIA,CAAC;IAHG,uBAAW,GAAX;QACI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC;IACL,QAAC;AAAD,CAAC,AAJD,IAIC"}
|
||||
|
||||
//// [/src/second/tsconfig.json]
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"composite": true, "module": "none",
|
||||
"removeComments": true,
|
||||
"strict": false,
|
||||
"sourceMap": true,
|
||||
"declarationMap": true,
|
||||
"declaration": true,
|
||||
|
||||
"skipDefaultLibCheck": true
|
||||
},
|
||||
"references": [
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
//// [/src/second/tsconfig.tsbuildinfo]
|
||||
{
|
||||
"program": {
|
||||
"fileInfos": {
|
||||
"../../lib/lib.d.ts": {
|
||||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
|
||||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
|
||||
},
|
||||
"./second_part1.ts": {
|
||||
"version": "-21603042336-namespace N {\r\n // Comment text\r\n}\r\n\r\nnamespace N {\r\n function f() {\r\n console.log('testing');\r\n }\r\n\r\n f();\r\n}\r\n",
|
||||
"signature": "-3134340341-declare namespace N {\r\n}\r\ndeclare namespace N {\r\n}\r\n//# sourceMappingURL=second_part1.d.ts.map"
|
||||
},
|
||||
"./second_part2.ts": {
|
||||
"version": "9339262372-class C {\r\n doSomething() {\r\n console.log(\"something got done\");\r\n }\r\n}\r\n",
|
||||
"signature": "6579734441-declare class C {\r\n doSomething(): void;\r\n}\r\n//# sourceMappingURL=second_part2.d.ts.map"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"target": 1,
|
||||
"composite": true,
|
||||
"module": 0,
|
||||
"removeComments": true,
|
||||
"strict": false,
|
||||
"sourceMap": true,
|
||||
"declarationMap": true,
|
||||
"declaration": true,
|
||||
"skipDefaultLibCheck": true,
|
||||
"configFilePath": "./tsconfig.json"
|
||||
},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../lib/lib.d.ts",
|
||||
"./second_part1.ts",
|
||||
"./second_part2.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
//// [/src/third/third_part1.d.ts]
|
||||
declare var c: C;
|
||||
//# sourceMappingURL=third_part1.d.ts.map
|
||||
|
||||
//// [/src/third/third_part1.d.ts.map]
|
||||
{"version":3,"file":"third_part1.d.ts","sourceRoot":"","sources":["third_part1.ts"],"names":[],"mappings":"AAAA,QAAA,IAAI,CAAC,GAAU,CAAC"}
|
||||
|
||||
//// [/src/third/third_part1.js]
|
||||
var c = new C();
|
||||
c.doSomething();
|
||||
//# sourceMappingURL=third_part1.js.map
|
||||
|
||||
//// [/src/third/third_part1.js.map]
|
||||
{"version":3,"file":"third_part1.js","sourceRoot":"","sources":["third_part1.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AAChB,CAAC,CAAC,WAAW,EAAE,CAAC"}
|
||||
|
||||
//// [/src/third/tsconfig.json]
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"composite": true, "module": "none",
|
||||
"removeComments": true,
|
||||
"strict": false,
|
||||
"sourceMap": true,
|
||||
"declarationMap": true,
|
||||
"declaration": true,
|
||||
|
||||
"skipDefaultLibCheck": true
|
||||
},
|
||||
"files": [
|
||||
"third_part1.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../first" },
|
||||
{ "path": "../second" },
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
//// [/src/third/tsconfig.tsbuildinfo]
|
||||
{
|
||||
"program": {
|
||||
"fileInfos": {
|
||||
"../../lib/lib.d.ts": {
|
||||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
|
||||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
|
||||
},
|
||||
"../first/first_part1.d.ts": {
|
||||
"version": "-17939996161-interface TheFirst {\r\n none: any;\r\n}\r\ndeclare const s = \"Hello, world\";\r\ninterface NoJsForHereEither {\r\n none: any;\r\n}\r\n//# sourceMappingURL=first_PART1.d.ts.map",
|
||||
"signature": "-17939996161-interface TheFirst {\r\n none: any;\r\n}\r\ndeclare const s = \"Hello, world\";\r\ninterface NoJsForHereEither {\r\n none: any;\r\n}\r\n//# sourceMappingURL=first_PART1.d.ts.map"
|
||||
},
|
||||
"../first/first_part2.d.ts": {
|
||||
"version": "-2054710634-//# sourceMappingURL=first_part2.d.ts.map",
|
||||
"signature": "-2054710634-//# sourceMappingURL=first_part2.d.ts.map"
|
||||
},
|
||||
"../first/first_part3.d.ts": {
|
||||
"version": "-4577888121-declare function f(): string;\r\n//# sourceMappingURL=first_part3.d.ts.map",
|
||||
"signature": "-4577888121-declare function f(): string;\r\n//# sourceMappingURL=first_part3.d.ts.map"
|
||||
},
|
||||
"../second/second_part1.d.ts": {
|
||||
"version": "-3134340341-declare namespace N {\r\n}\r\ndeclare namespace N {\r\n}\r\n//# sourceMappingURL=second_part1.d.ts.map",
|
||||
"signature": "-3134340341-declare namespace N {\r\n}\r\ndeclare namespace N {\r\n}\r\n//# sourceMappingURL=second_part1.d.ts.map"
|
||||
},
|
||||
"../second/second_part2.d.ts": {
|
||||
"version": "6579734441-declare class C {\r\n doSomething(): void;\r\n}\r\n//# sourceMappingURL=second_part2.d.ts.map",
|
||||
"signature": "6579734441-declare class C {\r\n doSomething(): void;\r\n}\r\n//# sourceMappingURL=second_part2.d.ts.map"
|
||||
},
|
||||
"./third_part1.ts": {
|
||||
"version": "10470273651-var c = new C();\r\nc.doSomething();\r\n",
|
||||
"signature": "2019699827-declare var c: C;\r\n//# sourceMappingURL=third_part1.d.ts.map"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"target": 1,
|
||||
"composite": true,
|
||||
"module": 0,
|
||||
"removeComments": true,
|
||||
"strict": false,
|
||||
"sourceMap": true,
|
||||
"declarationMap": true,
|
||||
"declaration": true,
|
||||
"skipDefaultLibCheck": true,
|
||||
"configFilePath": "./tsconfig.json"
|
||||
},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../lib/lib.d.ts",
|
||||
"../first/first_part1.d.ts",
|
||||
"../first/first_part2.d.ts",
|
||||
"../first/first_part3.d.ts",
|
||||
"../second/second_part1.d.ts",
|
||||
"../second/second_part2.d.ts",
|
||||
"./third_part1.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
+281
@@ -0,0 +1,281 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --b /src/third --verbose
|
||||
12:00:00 AM - Projects in this build:
|
||||
* src/first/tsconfig.json
|
||||
* src/second/tsconfig.json
|
||||
* src/third/tsconfig.json
|
||||
|
||||
12:00:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.js' does not exist
|
||||
|
||||
12:00:00 AM - Building project '/src/first/tsconfig.json'...
|
||||
|
||||
12:00:00 AM - Project 'src/second/tsconfig.json' is out of date because output file 'src/2/second-output.js' does not exist
|
||||
|
||||
12:00:00 AM - Building project '/src/second/tsconfig.json'...
|
||||
|
||||
12:00: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:00:00 AM - Building project '/src/third/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.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.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.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.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.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/tsconfig.json]
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
|
||||
"removeComments": true,
|
||||
"strict": false,
|
||||
"sourceMap": true,
|
||||
"declarationMap": true,
|
||||
"declaration": true,
|
||||
"outFile": "./thirdjs/output/third-output.js",
|
||||
"skipDefaultLibCheck": true
|
||||
},
|
||||
"files": [
|
||||
"third_part1.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../first", "prepend": true },
|
||||
{ "path": "../second", "prepend": true },
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --b /src/third --verbose
|
||||
12:00:00 AM - Projects in this build:
|
||||
* src/first/tsconfig.json
|
||||
* src/second/tsconfig.json
|
||||
* src/third/tsconfig.json
|
||||
|
||||
12:00:00 AM - Project 'src/first/tsconfig.json' is out of date because output file 'src/first/bin/first-output.tsbuildinfo' does not exist
|
||||
|
||||
12:00:00 AM - Building project '/src/first/tsconfig.json'...
|
||||
|
||||
12:00: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:00:00 AM - Project 'src/third/tsconfig.json' is out of date because output of its dependency 'src/first' has changed
|
||||
|
||||
12:00:00 AM - Updating output of project '/src/third/tsconfig.json'...
|
||||
|
||||
12:00: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.js] file written with same contents
|
||||
//// [/src/first/bin/first-output.js.map] file written with same contents
|
||||
//// [/src/first/bin/first-output.tsbuildinfo] file written with same contents
|
||||
//// [/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.tsbuildinfo] file written with same contents
|
||||
//// [/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;
|
||||
|
||||
======================================================================
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [/lib/no-change-runOutput.txt]
|
||||
/lib/tsc --b /src/third --clean
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
|
||||
12:04:00 AM - Building project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
|
||||
12:04:00 AM - Building project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
|
||||
12:04:00 AM - Building project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
|
||||
12:04:00 AM - Building project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
|
||||
12:04:00 AM - Building project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:04:00 AM - Building project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/second/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
|
||||
12:04:00 AM - Building project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
|
||||
12:04:00 AM - Building project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/first/bin/first-output.d.ts] file written with same contents
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/first/bin/first-output.d.ts] file written with same contents
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/first/bin/first-output.d.ts] file written with same contents
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/first/bin/first-output.d.ts] file written with same contents
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/first/bin/first-output.d.ts] file written with same contents
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/first/bin/first-output.d.ts] file written with same contents
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/2/second-output.js]
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/first/bin/first-output.d.ts] file written with same contents
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/2/second-output.js]
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/first/bin/first-output.d.ts] file written with same contents
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
|
||||
12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/second/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/2/second-output.js]
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/first/bin/first-output.d.ts] file written with same contents
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:08:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/first/bin/first-output.d.ts] file written with same contents
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
|
||||
12:04:00 AM - Building project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/first/bin/first-output.d.ts] file written with same contents
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:04:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/first/bin/first-output.d.ts] file written with same contents
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
12:12:00 AM - Updating unchanged output timestamps of project '/src/third/tsconfig.json'...
|
||||
|
||||
exitCode:: 0
|
||||
exitCode:: ExitStatus.Success
|
||||
readFiles:: {
|
||||
"/src/third/tsconfig.json": 1,
|
||||
"/src/first/tsconfig.json": 1,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user