From 79bcb3d547f8afa82edf5ddc71888805d367edea Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 30 Aug 2019 16:33:44 -0700 Subject: [PATCH] Handle seenEmittedFiles which was not being set when emit of a file was complete (#33145) * Add test that fails because file is written multiple times Reported from #33061 * Handle seenEmittedFiles which was not being set when emit of a file was complete. It was issue only when errors are reported before emitting (which puts the files into pendingEmit that needs to check only in seenEmittedFiles) If emit happens before semantic diagnostics query this issue is not repro, because the affected files come into play and those are being set correctly Fixes #31398 * make baselining source map optional * Handle emitDeclarationOnly in --build scenario * Ensure we are using d.ts emit as signature even when --declarationMap is on (map files are emitted before d.ts) * Move module specifiers to verifyTsBuildOutput * implement create Hash to be default hashing plus data so we can verify it easily in baseline * Remove failing baseline * Accept correct baseline name --- src/compiler/builder.ts | 24 +- src/compiler/builderState.ts | 9 +- src/compiler/emitter.ts | 7 +- src/harness/fakes.ts | 13 + src/testRunner/tsconfig.json | 1 + .../unittests/tsbuild/amdModulesWithOut.ts | 4 +- .../unittests/tsbuild/emitDeclarationOnly.ts | 109 ++++++ src/testRunner/unittests/tsbuild/helpers.ts | 64 +++- .../inferredTypeFromTransitiveModule.ts | 3 +- .../unittests/tsbuild/lateBoundSymbol.ts | 3 +- .../unittests/tsbuild/moduleSpecifiers.ts | 38 +- src/testRunner/unittests/tsbuild/outFile.ts | 2 +- src/testRunner/unittests/tsbuild/sample.ts | 18 +- .../unittests/tscWatch/incremental.ts | 167 ++++++++- ...-emitDeclarationOnly-and-declarationMap.js | 103 ++++++ ...import-project-with-emitDeclarationOnly.js | 99 +++++ ...mports-project-with-emitDeclarationOnly.js | 84 +++++ ...mports-project-with-emitDeclarationOnly.js | 75 ++++ ...-emitDeclarationOnly-and-declarationMap.js | 123 +++++++ ...import-project-with-emitDeclarationOnly.js | 132 +++++++ ...mports-project-with-emitDeclarationOnly.js | 104 ++++++ .../inferred-type-from-transitive-module.js | 24 +- .../inferred-type-from-transitive-module.js | 24 +- ...s-merged-and-contains-late-bound-member.js | 16 +- ...s-merged-and-contains-late-bound-member.js | 16 +- ...zed-module-specifiers-resolve-correctly.js | 168 +++++++++ .../initial-build/resolves-correctly.js | 348 ------------------ .../incremental-declaration-changes/sample.js | 52 +-- .../when-declaration-option-changes.js | 16 +- .../when-esModuleInterop-option-changes.js | 20 +- ...en-logic-config-changes-declaration-dir.js | 36 +- .../when-module-option-changes.js | 16 +- .../when-target-option-changes.js | 20 +- .../sample.js | 16 +- .../tsbuild/sample1/initial-Build/sample.js | 52 +-- .../when-declaration-option-changes.js | 16 +- .../when-esModuleInterop-option-changes.js | 52 +-- ...en-logic-config-changes-declaration-dir.js | 52 +-- .../when-logic-specifies-tsBuildInfoFile.js | 52 +-- .../when-module-option-changes.js | 16 +- .../when-target-option-changes.js | 20 +- tests/projects/emitDeclarationOnly/src/a.ts | 5 + tests/projects/emitDeclarationOnly/src/b.ts | 5 + tests/projects/emitDeclarationOnly/src/c.ts | 5 + .../projects/emitDeclarationOnly/src/index.ts | 3 + .../emitDeclarationOnly/tsconfig.json | 19 + 46 files changed, 1573 insertions(+), 678 deletions(-) create mode 100644 src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts create mode 100644 tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js create mode 100644 tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js create mode 100644 tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js create mode 100644 tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-doesnt-change/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js create mode 100644 tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js create mode 100644 tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js create mode 100644 tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js create mode 100644 tests/baselines/reference/tsbuild/moduleSpecifiers/initial-Build/synthesized-module-specifiers-resolve-correctly.js delete mode 100644 tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/resolves-correctly.js create mode 100644 tests/projects/emitDeclarationOnly/src/a.ts create mode 100644 tests/projects/emitDeclarationOnly/src/b.ts create mode 100644 tests/projects/emitDeclarationOnly/src/c.ts create mode 100644 tests/projects/emitDeclarationOnly/src/index.ts create mode 100644 tests/projects/emitDeclarationOnly/tsconfig.json diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 093a75a7c28..d80283ce3cf 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -137,7 +137,7 @@ namespace ts { */ emittedBuildInfo?: boolean; /** - * Already seen affected files + * Already seen emitted files */ seenEmittedFiles: Map | undefined; /** @@ -329,7 +329,6 @@ namespace ts { handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash); return affectedFile; } - seenAffectedFiles.set(affectedFile.path, true); affectedFilesIndex++; } @@ -549,7 +548,7 @@ namespace ts { * This is called after completing operation on the next affected file. * The operations here are postponed to ensure that cancellation during the iteration is handled correctly */ - function doneWithAffectedFile(state: BuilderProgramState, affected: SourceFile | Program, isPendingEmit?: boolean, isBuildInfoEmit?: boolean) { + function doneWithAffectedFile(state: BuilderProgramState, affected: SourceFile | Program, isPendingEmit?: boolean, isBuildInfoEmit?: boolean, isEmitResult?: boolean) { if (isBuildInfoEmit) { state.emittedBuildInfo = true; } @@ -559,6 +558,9 @@ namespace ts { } else { state.seenAffectedFiles!.set((affected as SourceFile).path, true); + if (isEmitResult) { + (state.seenEmittedFiles || (state.seenEmittedFiles = createMap())).set((affected as SourceFile).path, true); + } if (isPendingEmit) { state.affectedFilesPendingEmitIndex!++; } @@ -576,6 +578,14 @@ namespace ts { return { result, affected }; } + /** + * Returns the result with affected file + */ + function toAffectedFileEmitResult(state: BuilderProgramState, result: EmitResult, affected: SourceFile | Program, isPendingEmit?: boolean, isBuildInfoEmit?: boolean): AffectedFileResult { + doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit, /*isEmitResult*/ true); + return { result, affected }; + } + /** * Gets the semantic diagnostics either from cache if present, or otherwise from program and caches it * Note that it is assumed that the when asked about semantic diagnostics, the file has been taken out of affected files/changed file set @@ -849,7 +859,7 @@ namespace ts { } const affected = Debug.assertDefined(state.program); - return toAffectedFileResult( + return toAffectedFileEmitResult( state, // When whole program is affected, do emit only once (eg when --out or --outFile is specified) // Otherwise just affected file @@ -872,14 +882,14 @@ namespace ts { } } - return toAffectedFileResult( + return toAffectedFileEmitResult( state, // When whole program is affected, do emit only once (eg when --out or --outFile is specified) // Otherwise just affected file Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected as SourceFile, writeFile || maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, - isPendingEmitFile - ); + isPendingEmitFile, + ); } /** diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts index 953334321c2..9d2c55b5610 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -345,8 +345,13 @@ namespace ts.BuilderState { } else { const emitOutput = getFileEmitOutput(programOfThisState, sourceFile, /*emitOnlyDtsFiles*/ true, cancellationToken); - if (emitOutput.outputFiles && emitOutput.outputFiles.length > 0) { - latestSignature = computeHash(emitOutput.outputFiles[0].text); + const firstDts = emitOutput.outputFiles && + programOfThisState.getCompilerOptions().declarationMap ? + emitOutput.outputFiles.length > 1 ? emitOutput.outputFiles[1] : undefined : + emitOutput.outputFiles.length > 0 ? emitOutput.outputFiles[0] : undefined; + if (firstDts) { + Debug.assert(fileExtensionIs(firstDts.name, Extension.Dts), "File extension for signature expected to be dts", () => `Found: ${getAnyExtensionFromPath(firstDts.name)} for ${firstDts.name}:: All output files: ${JSON.stringify(emitOutput.outputFiles.map(f => f.name))}`); + latestSignature = computeHash(firstDts.text); if (exportedModulesMapCache && latestSignature !== prevSignature) { updateExportedModules(sourceFile, emitOutput.exportedModulesFromDeclarationEmit, exportedModulesMapCache); } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 2bba50beb42..57cc47cf0e1 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -155,6 +155,7 @@ namespace ts { } function getOutputJSFileName(inputFileName: string, configFile: ParsedCommandLine, ignoreCase: boolean) { + if (configFile.options.emitDeclarationOnly) return undefined; const isJsonFile = fileExtensionIs(inputFileName, Extension.Json); const outputFileName = changeExtension( getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir), @@ -187,7 +188,7 @@ namespace ts { const js = getOutputJSFileName(inputFileName, configFile, ignoreCase); addOutput(js); if (fileExtensionIs(inputFileName, Extension.Json)) continue; - if (configFile.options.sourceMap) { + if (js && configFile.options.sourceMap) { addOutput(`${js}.map`); } if (getEmitDeclarations(configFile.options) && hasTSFileExtension(inputFileName)) { @@ -214,6 +215,10 @@ namespace ts { if (fileExtensionIs(inputFileName, Extension.Dts)) continue; const jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase); if (jsFilePath) return jsFilePath; + if (fileExtensionIs(inputFileName, Extension.Json)) continue; + if (getEmitDeclarations(configFile.options) && hasTSFileExtension(inputFileName)) { + return getOutputDeclarationFileName(inputFileName, configFile, ignoreCase); + } } const buildInfoPath = getOutputPathForBuildInfo(configFile.options); if (buildInfoPath) return buildInfoPath; diff --git a/src/harness/fakes.ts b/src/harness/fakes.ts index 522cac95f30..abcb54fc320 100644 --- a/src/harness/fakes.ts +++ b/src/harness/fakes.ts @@ -545,6 +545,10 @@ ${indentText}${text}`; super.writeFile(fileName, ts.getBuildInfoText(buildInfo), writeByteOrderMark); } + createHash(data: string) { + return `${ts.generateDjb2Hash(data)}-${data}`; + } + now() { return new Date(this.sys.vfs.time()); } @@ -571,6 +575,15 @@ Actual: ${JSON.stringify(actual, /*replacer*/ undefined, " ")} Expected: ${JSON.stringify(expected, /*replacer*/ undefined, " ")}`); } + assertErrors(...expectedDiagnostics: ExpectedErrorDiagnostic[]) { + const actual = this.diagnostics.filter(d => d.kind === DiagnosticKind.Error).map(diagnosticToText); + const expected = expectedDiagnostics.map(expectedDiagnosticToText); + assert.deepEqual(actual, expected, `Diagnostics arrays did not match: +Actual: ${JSON.stringify(actual, /*replacer*/ undefined, " ")} +Expected: ${JSON.stringify(expected, /*replacer*/ undefined, " ")} +Actual All:: ${JSON.stringify(this.diagnostics.slice().map(diagnosticToText), /*replacer*/ undefined, " ")}`); + } + printDiagnostics(header = "== Diagnostics ==") { const out = ts.createDiagnosticReporter(ts.sys); ts.sys.write(header + "\r\n"); diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index c395b05e154..db9e96e1ad2 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -94,6 +94,7 @@ "unittests/tsbuild/amdModulesWithOut.ts", "unittests/tsbuild/containerOnlyReferenced.ts", "unittests/tsbuild/demo.ts", + "unittests/tsbuild/emitDeclarationOnly.ts", "unittests/tsbuild/emptyFiles.ts", "unittests/tsbuild/graphOrdering.ts", "unittests/tsbuild/inferredTypeFromTransitiveModule.ts", diff --git a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts index 3e1cab9b4a0..73e2af33fd9 100644 --- a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts +++ b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts @@ -77,7 +77,7 @@ namespace ts { [outputFiles[project.lib][ext.buildinfo], outputFiles[project.lib][ext.js], outputFiles[project.lib][ext.dts]], [outputFiles[project.app][ext.buildinfo], outputFiles[project.app][ext.js], outputFiles[project.app][ext.dts]] ], - lastProjectOutputJs: outputFiles[project.app][ext.js], + lastProjectOutput: outputFiles[project.app][ext.js], initialBuild: { modifyFs }, @@ -231,7 +231,7 @@ ${internal} export enum internalEnum { a, b, c }`); [libOutputFile[ext.buildinfo], libOutputFile[ext.js], libOutputFile[ext.dts]], [outputFiles[project.app][ext.buildinfo], outputFiles[project.app][ext.js], outputFiles[project.app][ext.dts]] ], - lastProjectOutputJs: outputFiles[project.app][ext.js], + lastProjectOutput: outputFiles[project.app][ext.js], initialBuild: { modifyFs, expectedDiagnostics: [ diff --git a/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts b/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts new file mode 100644 index 00000000000..1999737a50f --- /dev/null +++ b/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts @@ -0,0 +1,109 @@ +namespace ts { + describe("unittests:: tsbuild:: on project with emitDeclarationOnly set to true", () => { + let projFs: vfs.FileSystem; + const { time, tick } = getTime(); + before(() => { + projFs = loadProjectFromDisk("tests/projects/emitDeclarationOnly", time); + }); + after(() => { + projFs = undefined!; + }); + + function verifyEmitDeclarationOnly(disableMap?: true) { + verifyTsbuildOutput({ + scenario: `only dts output in circular import project with emitDeclarationOnly${disableMap ? "" : " and declarationMap"}`, + projFs: () => projFs, + time, + tick, + proj: "emitDeclarationOnly", + rootNames: ["/src"], + lastProjectOutput: `/src/lib/index.d.ts`, + outputFiles: [ + "/src/lib/a.d.ts", + "/src/lib/b.d.ts", + "/src/lib/c.d.ts", + "/src/lib/index.d.ts", + "/src/tsconfig.tsbuildinfo", + ...(disableMap ? emptyArray : [ + "/src/lib/a.d.ts.map", + "/src/lib/b.d.ts.map", + "/src/lib/c.d.ts.map", + "/src/lib/index.d.ts.map" + ]) + ], + initialBuild: { + modifyFs: disableMap ? + (fs => replaceText(fs, "/src/tsconfig.json", `"declarationMap": true,`, "")) : + noop, + expectedDiagnostics: [ + getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), + [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tsconfig.json", "src/lib/a.d.ts"], + [Diagnostics.Building_project_0, "/src/tsconfig.json"] + ] + }, + incrementalDtsChangedBuild: { + modifyFs: fs => replaceText(fs, "/src/src/a.ts", "b: B;", "b: B; foo: any;"), + expectedDiagnostics: [ + getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), + [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tsconfig.json", "src/lib/a.d.ts", "src/src/a.ts"], + [Diagnostics.Building_project_0, "/src/tsconfig.json"] + ] + }, + baselineOnly: true, + verifyDiagnostics: true + }); + } + verifyEmitDeclarationOnly(); + verifyEmitDeclarationOnly(/*disableMap*/ true); + + verifyTsbuildOutput({ + scenario: `only dts output in non circular imports project with emitDeclarationOnly`, + projFs: () => projFs, + time, + tick, + proj: "emitDeclarationOnly", + rootNames: ["/src"], + lastProjectOutput: `/src/lib/a.d.ts`, + outputFiles: [ + "/src/lib/a.d.ts", + "/src/lib/b.d.ts", + "/src/lib/c.d.ts", + "/src/tsconfig.tsbuildinfo", + "/src/lib/a.d.ts.map", + "/src/lib/b.d.ts.map", + "/src/lib/c.d.ts.map", + ], + initialBuild: { + modifyFs: fs => { + fs.rimrafSync("/src/src/index.ts"); + replaceText(fs, "/src/src/a.ts", `import { B } from "./b";`, `export class B { prop = "hello"; }`); + }, + expectedDiagnostics: [ + getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), + [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tsconfig.json", "src/lib/a.d.ts"], + [Diagnostics.Building_project_0, "/src/tsconfig.json"] + ] + }, + incrementalDtsChangedBuild: { + modifyFs: fs => replaceText(fs, "/src/src/a.ts", "b: B;", "b: B; foo: any;"), + expectedDiagnostics: [ + getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), + [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tsconfig.json", "src/lib/a.d.ts", "src/src/a.ts"], + [Diagnostics.Building_project_0, "/src/tsconfig.json"] + ] + }, + incrementalDtsUnchangedBuild: { + modifyFs: fs => replaceText(fs, "/src/src/a.ts", "export interface A {", `class C { } +export interface A {`), + expectedDiagnostics: [ + getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), + [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tsconfig.json", "src/lib/a.d.ts", "src/src/a.ts"], + [Diagnostics.Building_project_0, "/src/tsconfig.json"], + [Diagnostics.Updating_unchanged_output_timestamps_of_project_0, "/src/tsconfig.json"] + ] + }, + baselineOnly: true, + verifyDiagnostics: true + }); + }); +} diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index 165aab84916..4542733d2e6 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -102,7 +102,22 @@ namespace ts { interface ReadonlyArray {} declare const console: { log(msg: any): void; };`; - export function loadProjectFromDisk(root: string, time?: vfs.FileSystemOptions["time"]): vfs.FileSystem { + export const symbolLibContent = ` +interface SymbolConstructor { + readonly species: symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +`; + + export function loadProjectFromDisk( + root: string, + time?: vfs.FileSystemOptions["time"], + libContentToAppend?: string + ): vfs.FileSystem { const resolver = vfs.createResolver(Harness.IO); const fs = new vfs.FileSystem(/*ignoreCase*/ true, { files: { @@ -112,12 +127,31 @@ declare const console: { log(msg: any): void; };`; meta: { defaultLibLocation: "/lib" }, time }); - fs.mkdirSync("/lib"); - fs.writeFileSync("/lib/lib.d.ts", libContent); - fs.makeReadonly(); + addLibAndMakeReadonly(fs, libContentToAppend); return fs; } + export function loadProjectFromFiles( + files: vfs.FileSet, + time?: vfs.FileSystemOptions["time"], + libContentToAppend?: string + ): vfs.FileSystem { + const fs = new vfs.FileSystem(/*ignoreCase*/ true, { + files, + cwd: "/", + meta: { defaultLibLocation: "/lib" }, + time + }); + addLibAndMakeReadonly(fs, libContentToAppend); + return fs; + } + + function addLibAndMakeReadonly(fs: vfs.FileSystem, libContentToAppend?: string) { + fs.mkdirSync("/lib"); + fs.writeFileSync("/lib/lib.d.ts", libContentToAppend ? `${libContent}${libContentToAppend}` : libContent); + fs.makeReadonly(); + } + export function verifyOutputsPresent(fs: vfs.FileSystem, outputs: readonly string[]) { for (const output of outputs) { assert(fs.existsSync(output), `Expect file ${output} to exist`); @@ -199,7 +233,7 @@ declare const console: { log(msg: any): void; };`; fs: vfs.FileSystem; tick: () => void; rootNames: ReadonlyArray; - expectedMapFileNames: ReadonlyArray; + expectedMapFileNames?: ReadonlyArray; expectedBuildInfoFilesForSectionBaselines?: ReadonlyArray; modifyFs: (fs: vfs.FileSystem) => void; } @@ -221,7 +255,7 @@ declare const console: { log(msg: any): void; };`; return originalReadFile.call(host, path); }; builder.build(); - generateSourceMapBaselineFiles(fs, expectedMapFileNames); + if (expectedMapFileNames) generateSourceMapBaselineFiles(fs, expectedMapFileNames); generateBuildInfoSectionBaselineFiles(fs, expectedBuildInfoFilesForSectionBaselines || emptyArray); fs.makeReadonly(); return { fs, actualReadFileMap, host, builder }; @@ -268,9 +302,10 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt tick: () => void; proj: string; rootNames: ReadonlyArray; - expectedMapFileNames: ReadonlyArray; + /** map file names to generate baseline of */ + expectedMapFileNames?: ReadonlyArray; expectedBuildInfoFilesForSectionBaselines?: ReadonlyArray; - lastProjectOutputJs: string; + lastProjectOutput: string; initialBuild: BuildState; outputFiles?: ReadonlyArray; incrementalDtsChangedBuild?: BuildState; @@ -282,7 +317,7 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt export function verifyTsbuildOutput({ scenario, projFs, time, tick, proj, rootNames, outputFiles, baselineOnly, verifyDiagnostics, - expectedMapFileNames, expectedBuildInfoFilesForSectionBaselines, lastProjectOutputJs, + expectedMapFileNames, expectedBuildInfoFilesForSectionBaselines, lastProjectOutput, initialBuild, incrementalDtsChangedBuild, incrementalDtsUnchangedBuild, incrementalHeaderChangedBuild }: VerifyTsBuildInput) { describe(`tsc --b ${proj}:: ${scenario}`, () => { @@ -331,7 +366,7 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt let beforeBuildTime: number; let afterBuildTime: number; before(() => { - beforeBuildTime = fs.statSync(lastProjectOutputJs).mtimeMs; + beforeBuildTime = fs.statSync(lastProjectOutput).mtimeMs; tick(); newFs = fs.shadow(); tick(); @@ -343,7 +378,7 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt expectedBuildInfoFilesForSectionBaselines, modifyFs: incrementalModifyFs, })); - afterBuildTime = newFs.statSync(lastProjectOutputJs).mtimeMs; + afterBuildTime = newFs.statSync(lastProjectOutput).mtimeMs; }); after(() => { newFs = undefined!; @@ -359,6 +394,12 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt host.assertDiagnosticMessages(...(incrementalExpectedDiagnostics || emptyArray)); }); } + else { + // Build should pass without errors if not verifying diagnostics + it(`verify no errors`, () => { + host.assertErrors(/*empty*/); + }); + } it(`Generates files matching the baseline`, () => { generateBaseline(newFs, proj, scenario, subScenario, fs); }); @@ -373,7 +414,6 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt fs: newFs.shadow(), tick, rootNames, - expectedMapFileNames: emptyArray, modifyFs: fs => { // Delete output files for (const outputFile of expectedOutputFiles) { diff --git a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts index 792fefb7ba7..301f9894fde 100644 --- a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts +++ b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts @@ -16,8 +16,7 @@ namespace ts { tick, proj: "inferredTypeFromTransitiveModule", rootNames: ["/src"], - expectedMapFileNames: emptyArray, - lastProjectOutputJs: `/src/obj/index.js`, + lastProjectOutput: `/src/obj/index.js`, outputFiles: [ "/src/obj/bar.js", "/src/obj/bar.d.ts", "/src/obj/bundling.js", "/src/obj/bundling.d.ts", diff --git a/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts b/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts index ff9f1fc7c7a..781dd6938b9 100644 --- a/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts +++ b/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts @@ -16,8 +16,7 @@ namespace ts { tick, proj: "lateBoundSymbol", rootNames: ["/src/tsconfig.json"], - expectedMapFileNames: emptyArray, - lastProjectOutputJs: "/src/src/main.js", + lastProjectOutput: "/src/src/main.js", outputFiles: [ "/src/src/hkt.js", "/src/src/main.js", diff --git a/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts b/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts index ad0a229e876..c6737b9d2f7 100644 --- a/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts +++ b/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts @@ -1,8 +1,10 @@ namespace ts { // https://github.com/microsoft/TypeScript/issues/31696 - it("unittests:: tsbuild:: moduleSpecifiers:: synthesized module specifiers to referenced projects resolve correctly", () => { - const baseFs = vfs.createFromFileSystem(Harness.IO, /*ignoreCase*/ false, { - files: { + describe("unittests:: tsbuild:: moduleSpecifiers:: synthesized module specifiers to referenced projects resolve correctly", () => { + let projFs: vfs.FileSystem; + const { time, tick } = getTime(); + before(() => { + projFs = loadProjectFromFiles({ "/src/common/nominal.ts": utils.dedent` export declare type Nominal = T & { [Symbol.species]: Name; @@ -71,7 +73,6 @@ namespace ts { "skipLibCheck": true, "rootDir": "./", "outDir": "lib", - "lib": ["dom", "es2015", "es2015.symbol.wellknown"] } }`, "/tsconfig.json": utils.dedent`{ @@ -83,16 +84,23 @@ namespace ts { ], "include": [] }` - }, - cwd: "/" + }, time, symbolLibContent); + }); + after(() => { + projFs = undefined!; + }); + verifyTsbuildOutput({ + scenario: `synthesized module specifiers resolve correctly`, + projFs: () => projFs, + time, + tick, + proj: "moduleSpecifiers", + rootNames: ["/"], + lastProjectOutput: `/src/lib/index.d.ts`, + initialBuild: { + modifyFs: noop, + }, + baselineOnly: true }); - const fs = baseFs.makeReadonly().shadow(); - const sys = new fakes.System(fs, { executingFilePath: "/", newLine: "\n" }); - const host = new fakes.SolutionBuilderHost(sys); - const builder = createSolutionBuilder(host, ["/tsconfig.json"], { dry: false, force: false, verbose: false }); - builder.build(); - - // Prior to fixing GH31696 the import in `/lib/src/sub-project-2/index.d.ts` was `import("../../lib/src/common/nonterminal")`, which was invalid. - Harness.Baseline.runBaseline("tsbuild/moduleSpecifiers/initial-build/resolves-correctly.js", vfs.formatPatch(fs.diff(baseFs))); }); -} \ No newline at end of file +} diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index f562d4dc26b..4b81160cc99 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -288,7 +288,7 @@ namespace ts { rootNames: ["/src/third"], expectedMapFileNames, expectedBuildInfoFilesForSectionBaselines: expectedBuildInfoFilesForSectionBaselines || expectedTsbuildInfoFileNames, - lastProjectOutputJs: outputFiles[project.third][ext.js], + lastProjectOutput: outputFiles[project.third][ext.js], initialBuild: { modifyFs, expectedDiagnostics: initialExpectedDiagnostics, diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 8dcc69d06d9..91574c3a920 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -617,7 +617,7 @@ export class cNew {}`); "/src/core/index.d.ts.map", "/src/logic/index.js.map" ], - lastProjectOutputJs: "/src/tests/index.js", + lastProjectOutput: "/src/tests/index.js", initialBuild, incrementalDtsChangedBuild: { modifyFs: fs => appendText(fs, "/src/core/index.ts", ` @@ -727,7 +727,7 @@ class someClass { }`), "/src/core/index.d.ts.map", "/src/logic/index.js.map" ], - lastProjectOutputJs: "/src/tests/index.js", + lastProjectOutput: "/src/tests/index.js", initialBuild, incrementalDtsChangedBuild: { modifyFs: fs => replaceText(fs, "/src/logic/tsconfig.json", `"declaration": true,`, `"declaration": true, @@ -795,7 +795,7 @@ class someClass { }`), "/src/core/index.d.ts.map", "/src/logic/index.js.map" ], - lastProjectOutputJs: "/src/tests/index.js", + lastProjectOutput: "/src/tests/index.js", initialBuild: { modifyFs: fs => replaceText(fs, "/src/logic/tsconfig.json", `"composite": true,`, `"composite": true, "tsBuildInfoFile": "ownFile.tsbuildinfo",`), @@ -851,8 +851,7 @@ class someClass { }`), tick, proj: "sample1", rootNames: ["/src/core"], - expectedMapFileNames: emptyArray, - lastProjectOutputJs: "/src/core/index.js", + lastProjectOutput: "/src/core/index.js", initialBuild: { modifyFs: fs => fs.writeFileSync("/src/core/tsconfig.json", `{ "compilerOptions": { @@ -892,8 +891,7 @@ class someClass { }`), tick, proj: "sample1", rootNames: ["/src/core"], - expectedMapFileNames: emptyArray, - lastProjectOutputJs: "/src/core/index.js", + lastProjectOutput: "/src/core/index.js", initialBuild: { modifyFs: fs => { fs.writeFileSync("/lib/lib.esnext.full.d.ts", `/// @@ -942,8 +940,7 @@ class someClass { }`), tick, proj: "sample1", rootNames: ["/src/core"], - expectedMapFileNames: emptyArray, - lastProjectOutputJs: "/src/core/index.js", + lastProjectOutput: "/src/core/index.js", initialBuild: { modifyFs: fs => fs.writeFileSync("/src/core/tsconfig.json", `{ "compilerOptions": { @@ -981,8 +978,7 @@ class someClass { }`), tick, proj: "sample1", rootNames: ["/src/tests"], - expectedMapFileNames: emptyArray, - lastProjectOutputJs: "/src/tests/index.js", + lastProjectOutput: "/src/tests/index.js", initialBuild: { modifyFs: fs => fs.writeFileSync("/src/tests/tsconfig.json", `{ "references": [ diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index f7e959c5f03..e89c2fa534d 100644 --- a/src/testRunner/unittests/tscWatch/incremental.ts +++ b/src/testRunner/unittests/tscWatch/incremental.ts @@ -16,17 +16,17 @@ namespace ts.tscWatch { expectedIncrementalEmit?: ReadonlyArray; expectedIncrementalErrors?: ReadonlyArray; } - function verifyIncrementalWatchEmit(input: VerifyIncrementalWatchEmitInput) { + function verifyIncrementalWatchEmit(input: () => VerifyIncrementalWatchEmitInput) { it("with tsc --w", () => { verifyIncrementalWatchEmitWorker({ - input, + input: input(), emitAndReportErrors: createWatchOfConfigFile, verifyErrors: checkOutputErrorsInitial }); }); it("with tsc", () => { verifyIncrementalWatchEmitWorker({ - input, + input: input(), emitAndReportErrors: incrementalBuild, verifyErrors: checkNormalBuildErrors }); @@ -122,7 +122,7 @@ namespace ts.tscWatch { function checkFileEmit(actual: Map, expected: ReadonlyArray) { assert.equal(actual.size, expected.length, `Actual: ${JSON.stringify(arrayFrom(actual.entries()), /*replacer*/ undefined, " ")}\nExpected: ${JSON.stringify(expected, /*replacer*/ undefined, " ")}`); - expected.forEach(file => { + for (const file of expected) { let expectedContent = file.content; let actualContent = actual.get(file.path); if (isBuildInfoFile(file.path)) { @@ -130,7 +130,7 @@ namespace ts.tscWatch { expectedContent = sanitizeBuildInfo(expectedContent); } assert.equal(actualContent, expectedContent, `Emit for ${file.path}`); - }); + } } const libFileInfo: BuilderState.FileInfo = { @@ -170,7 +170,7 @@ namespace ts.tscWatch { describe("own file emit without errors", () => { function verify(optionsToExtend?: CompilerOptions, expectedBuildinfoOptions?: CompilerOptions) { const modifiedFile2Content = file2.content.replace("y", "z").replace("20", "10"); - verifyIncrementalWatchEmit({ + verifyIncrementalWatchEmit(() => ({ files: [libFile, file1, file2, configFile], optionsToExtend, expectedInitialEmit: [ @@ -226,7 +226,7 @@ namespace ts.tscWatch { } ], expectedIncrementalErrors: emptyArray, - }); + })); } verify(); describe("with commandline parameters that are not relative", () => { @@ -259,7 +259,7 @@ namespace ts.tscWatch { "file2.ts(1,7): error TS2322: Type '20' is not assignable to type 'string'.\n" ]; const modifiedFile1Content = file1.content.replace("x", "z"); - verifyIncrementalWatchEmit({ + verifyIncrementalWatchEmit(() => ({ files: [libFile, file1, fileModified, configFile], expectedInitialEmit: [ file1Js, @@ -320,7 +320,7 @@ namespace ts.tscWatch { } ], expectedIncrementalErrors: file2Errors, - }); + })); }); describe("with --out", () => { @@ -332,7 +332,7 @@ namespace ts.tscWatch { path: `${project}/out.js`, content: "var x = 10;\nvar y = 20;\n" }; - verifyIncrementalWatchEmit({ + verifyIncrementalWatchEmit(() => ({ files: [libFile, file1, file2, config], expectedInitialEmit: [ outFile, @@ -353,7 +353,7 @@ namespace ts.tscWatch { } ], expectedInitialErrors: emptyArray - }); + })); }); }); @@ -397,7 +397,7 @@ namespace ts.tscWatch { describe("own file emit without errors", () => { const modifiedFile2Content = file2.content.replace("y", "z").replace("20", "10"); - verifyIncrementalWatchEmit({ + verifyIncrementalWatchEmit(() => ({ files: [libFile, file1, file2, config], expectedInitialEmit: [ file1Js, @@ -451,7 +451,7 @@ namespace ts.tscWatch { } ], expectedIncrementalErrors: emptyArray, - }); + })); }); describe("own file emit with errors", () => { @@ -479,7 +479,7 @@ namespace ts.tscWatch { "file2.ts(1,14): error TS2322: Type '20' is not assignable to type 'string'.\n" ]; const modifiedFile1Content = file1.content.replace("x = 10", "z = 10"); - verifyIncrementalWatchEmit({ + verifyIncrementalWatchEmit(() => ({ files: [libFile, file1, fileModified, config], expectedInitialEmit: [ file1Js, @@ -541,7 +541,7 @@ namespace ts.tscWatch { } ], expectedIncrementalErrors: file2Errors, - }); + })); it("verify that state is read correctly", () => { const system = createWatchedSystem([libFile, file1, fileModified, config], { currentDirectory: project }); @@ -604,7 +604,7 @@ namespace ts.tscWatch { }); `; } - verifyIncrementalWatchEmit({ + verifyIncrementalWatchEmit(() => ({ files: [libFile, file1, file2, config], expectedInitialEmit: [ outFile, @@ -625,7 +625,140 @@ namespace ts.tscWatch { } ], expectedInitialErrors: emptyArray - }); + })); + }); + }); + + describe("incremental with circular references", () => { + function getFileInfo(content: string): BuilderState.FileInfo { + const signature = Harness.mockHash(content); + return { version: signature, signature }; + } + const config: File = { + path: configFile.path, + content: JSON.stringify({ + compilerOptions: { + incremental: true, + target: "es5", + module: "commonjs", + declaration: true, + emitDeclarationOnly: true + } + }) + }; + const aTs: File = { + path: `${project}/a.ts`, + content: `import { B } from "./b"; +export interface A { + b: B; +} +` + }; + const bTs: File = { + path: `${project}/b.ts`, + content: `import { C } from "./c"; +export interface B { + b: C; +} +` + }; + const cTs: File = { + path: `${project}/c.ts`, + content: `import { A } from "./a"; +export interface C { + a: A; +} +` + }; + const indexTs: File = { + path: `${project}/index.ts`, + content: `export { A } from "./a"; +export { B } from "./b"; +export { C } from "./c"; +` + }; + + verifyIncrementalWatchEmit(() => { + const referencedMap: MapLike = { + "./a.ts": ["./b.ts"], + "./b.ts": ["./c.ts"], + "./c.ts": ["./a.ts"], + "./index.ts": ["./a.ts", "./b.ts", "./c.ts"], + }; + const initialProgram: ProgramBuildInfo = { + fileInfos: { + [libFilePath]: libFileInfo, + "./c.ts": getFileInfo(cTs.content), + "./b.ts": getFileInfo(bTs.content), + "./a.ts": getFileInfo(aTs.content), + "./index.ts": getFileInfo(indexTs.content) + }, + options: { + incremental: true, + target: ScriptTarget.ES5, + module: ModuleKind.CommonJS, + declaration: true, + emitDeclarationOnly: true, + configFilePath: "./tsconfig.json" + }, + referencedMap, + exportedModulesMap: referencedMap, + semanticDiagnosticsPerFile: [ + libFilePath, + "./a.ts", + "./b.ts", + "./c.ts", + "./index.ts", + ] + }; + const { fileInfos, ...rest } = initialProgram; + const expectedADts: File = { path: `${project}/a.d.ts`, content: aTs.content }; + const expectedBDts: File = { path: `${project}/b.d.ts`, content: bTs.content }; + const expectedCDts: File = { path: `${project}/c.d.ts`, content: cTs.content }; + const expectedIndexDts: File = { path: `${project}/index.d.ts`, content: indexTs.content }; + const modifiedATsContent = aTs.content.replace("b: B;", `b: B; + foo: any;`); + return { + files: [libFile, aTs, bTs, cTs, indexTs, config], + expectedInitialEmit: [ + expectedADts, + expectedBDts, + expectedCDts, + expectedIndexDts, + { + path: `${project}/tsconfig.tsbuildinfo`, + content: getBuildInfoText({ + program: initialProgram, + version + }) + } + ], + expectedInitialErrors: emptyArray, + modifyFs: host => host.writeFile(aTs.path, modifiedATsContent), + expectedIncrementalEmit: [ + { path: expectedADts.path, content: modifiedATsContent }, + expectedBDts, + expectedCDts, + expectedIndexDts, + { + path: `${project}/tsconfig.tsbuildinfo`, + content: getBuildInfoText({ + program: { + fileInfos: { + [libFilePath]: libFileInfo, + "./c.ts": getFileInfo(cTs.content), + "./b.ts": getFileInfo(bTs.content), + "./a.ts": getFileInfo(modifiedATsContent), + "./index.ts": getFileInfo(indexTs.content) + }, + ...rest + }, + version + }) + } + ], + expectedIncrementalErrors: emptyArray + }; }); }); }); diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js new file mode 100644 index 00000000000..9a793388ac0 --- /dev/null +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js @@ -0,0 +1,103 @@ +//// [/src/lib/a.d.ts] +import { B } from "./b"; +export interface A { + b: B; + foo: any; +} +//# sourceMappingURL=a.d.ts.map + +//// [/src/lib/a.d.ts.map] +{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../src/a.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,CAAC;IAChB,CAAC,EAAE,CAAC,CAAC;IAAC,GAAG,EAAE,GAAG,CAAC;CAChB"} + +//// [/src/src/a.ts] +import { B } from "./b"; + +export interface A { + b: B; foo: any; +} + + +//// [/src/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + }, + "./src/c.ts": { + "version": "429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n", + "signature": "-21569163793-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n//# sourceMappingURL=c.d.ts.map" + }, + "./src/b.ts": { + "version": "-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n", + "signature": "25318058868-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n//# sourceMappingURL=b.d.ts.map" + }, + "./src/a.ts": { + "version": "-14761736732-import { B } from \"./b\";\n\nexport interface A {\n b: B; foo: any;\n}\n", + "signature": "-11119001497-import { B } from \"./b\";\r\nexport interface A {\r\n b: B;\r\n foo: any;\r\n}\r\n//# sourceMappingURL=a.d.ts.map" + }, + "./src/index.ts": { + "version": "1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n", + "signature": "14762544269-export { A } from \"./a\";\r\nexport { B } from \"./b\";\r\nexport { C } from \"./c\";\r\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "incremental": true, + "target": 1, + "module": 1, + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "outDir": "./lib", + "composite": true, + "strict": true, + "esModuleInterop": true, + "alwaysStrict": true, + "rootDir": "./src", + "emitDeclarationOnly": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/a.ts": [ + "./src/b.ts" + ], + "./src/b.ts": [ + "./src/c.ts" + ], + "./src/c.ts": [ + "./src/a.ts" + ], + "./src/index.ts": [ + "./src/a.ts", + "./src/b.ts", + "./src/c.ts" + ] + }, + "exportedModulesMap": { + "./src/a.ts": [ + "./src/b.ts" + ], + "./src/b.ts": [ + "./src/c.ts" + ], + "./src/c.ts": [ + "./src/a.ts" + ], + "./src/index.ts": [ + "./src/a.ts", + "./src/b.ts", + "./src/c.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./src/a.ts", + "./src/b.ts", + "./src/c.ts", + "./src/index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js new file mode 100644 index 00000000000..a86656dbed5 --- /dev/null +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js @@ -0,0 +1,99 @@ +//// [/src/lib/a.d.ts] +import { B } from "./b"; +export interface A { + b: B; + foo: any; +} + + +//// [/src/src/a.ts] +import { B } from "./b"; + +export interface A { + b: B; foo: any; +} + + +//// [/src/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + }, + "./src/c.ts": { + "version": "429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n", + "signature": "-2697851509-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n" + }, + "./src/b.ts": { + "version": "-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n", + "signature": "20298635505-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n" + }, + "./src/a.ts": { + "version": "-14761736732-import { B } from \"./b\";\n\nexport interface A {\n b: B; foo: any;\n}\n", + "signature": "-7639584379-import { B } from \"./b\";\r\nexport interface A {\r\n b: B;\r\n foo: any;\r\n}\r\n" + }, + "./src/index.ts": { + "version": "1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n", + "signature": "-6009477228-export { A } from \"./a\";\r\nexport { B } from \"./b\";\r\nexport { C } from \"./c\";\r\n" + } + }, + "options": { + "incremental": true, + "target": 1, + "module": 1, + "declaration": true, + "sourceMap": true, + "outDir": "./lib", + "composite": true, + "strict": true, + "esModuleInterop": true, + "alwaysStrict": true, + "rootDir": "./src", + "emitDeclarationOnly": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/a.ts": [ + "./src/b.ts" + ], + "./src/b.ts": [ + "./src/c.ts" + ], + "./src/c.ts": [ + "./src/a.ts" + ], + "./src/index.ts": [ + "./src/a.ts", + "./src/b.ts", + "./src/c.ts" + ] + }, + "exportedModulesMap": { + "./src/a.ts": [ + "./src/b.ts" + ], + "./src/b.ts": [ + "./src/c.ts" + ], + "./src/c.ts": [ + "./src/a.ts" + ], + "./src/index.ts": [ + "./src/a.ts", + "./src/b.ts", + "./src/c.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./src/a.ts", + "./src/b.ts", + "./src/c.ts", + "./src/index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js new file mode 100644 index 00000000000..8a70278d315 --- /dev/null +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-changes/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js @@ -0,0 +1,84 @@ +//// [/src/lib/a.d.ts] +export declare class B { + prop: string; +} +export interface A { + b: B; + foo: any; +} +//# sourceMappingURL=a.d.ts.map + +//// [/src/lib/a.d.ts.map] +{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../src/a.ts"],"names":[],"mappings":"AAAA,qBAAa,CAAC;IAAG,IAAI,SAAW;CAAE;AAElC,MAAM,WAAW,CAAC;IAChB,CAAC,EAAE,CAAC,CAAC;IAAC,GAAG,EAAE,GAAG,CAAC;CAChB"} + +//// [/src/src/a.ts] +export class B { prop = "hello"; } + +export interface A { + b: B; foo: any; +} + + +//// [/src/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + }, + "./src/a.ts": { + "version": "7973388544-export class B { prop = \"hello\"; }\n\nexport interface A {\n b: B; foo: any;\n}\n", + "signature": "3224647069-export declare class B {\r\n prop: string;\r\n}\r\nexport interface A {\r\n b: B;\r\n foo: any;\r\n}\r\n//# sourceMappingURL=a.d.ts.map" + }, + "./src/c.ts": { + "version": "429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n", + "signature": "-21569163793-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n//# sourceMappingURL=c.d.ts.map" + }, + "./src/b.ts": { + "version": "-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n", + "signature": "25318058868-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n//# sourceMappingURL=b.d.ts.map" + } + }, + "options": { + "incremental": true, + "target": 1, + "module": 1, + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "outDir": "./lib", + "composite": true, + "strict": true, + "esModuleInterop": true, + "alwaysStrict": true, + "rootDir": "./src", + "emitDeclarationOnly": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/b.ts": [ + "./src/c.ts" + ], + "./src/c.ts": [ + "./src/a.ts" + ] + }, + "exportedModulesMap": { + "./src/b.ts": [ + "./src/c.ts" + ], + "./src/c.ts": [ + "./src/a.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./src/a.ts", + "./src/b.ts", + "./src/c.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-doesnt-change/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-doesnt-change/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js new file mode 100644 index 00000000000..7facc60eef5 --- /dev/null +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/incremental-declaration-doesnt-change/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js @@ -0,0 +1,75 @@ +//// [/src/lib/a.d.ts.map] +{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../src/a.ts"],"names":[],"mappings":"AAAA,qBAAa,CAAC;IAAG,IAAI,SAAW;CAAE;AAGlC,MAAM,WAAW,CAAC;IAChB,CAAC,EAAE,CAAC,CAAC;CACN"} + +//// [/src/src/a.ts] +export class B { prop = "hello"; } + +class C { } +export interface A { + b: B; +} + + +//// [/src/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + }, + "./src/a.ts": { + "version": "6651905050-export class B { prop = \"hello\"; }\n\nclass C { }\nexport interface A {\n b: B;\n}\n", + "signature": "-14608980923-export declare class B {\r\n prop: string;\r\n}\r\nexport interface A {\r\n b: B;\r\n}\r\n//# sourceMappingURL=a.d.ts.map" + }, + "./src/c.ts": { + "version": "429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n", + "signature": "-21569163793-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n//# sourceMappingURL=c.d.ts.map" + }, + "./src/b.ts": { + "version": "-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n", + "signature": "25318058868-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n//# sourceMappingURL=b.d.ts.map" + } + }, + "options": { + "incremental": true, + "target": 1, + "module": 1, + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "outDir": "./lib", + "composite": true, + "strict": true, + "esModuleInterop": true, + "alwaysStrict": true, + "rootDir": "./src", + "emitDeclarationOnly": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/b.ts": [ + "./src/c.ts" + ], + "./src/c.ts": [ + "./src/a.ts" + ] + }, + "exportedModulesMap": { + "./src/b.ts": [ + "./src/c.ts" + ], + "./src/c.ts": [ + "./src/a.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./src/a.ts", + "./src/b.ts", + "./src/c.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js new file mode 100644 index 00000000000..838bf28950f --- /dev/null +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly-and-declarationMap.js @@ -0,0 +1,123 @@ +//// [/src/lib/a.d.ts] +import { B } from "./b"; +export interface A { + b: B; +} +//# sourceMappingURL=a.d.ts.map + +//// [/src/lib/a.d.ts.map] +{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../src/a.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,CAAC;IAChB,CAAC,EAAE,CAAC,CAAC;CACN"} + +//// [/src/lib/b.d.ts] +import { C } from "./c"; +export interface B { + b: C; +} +//# sourceMappingURL=b.d.ts.map + +//// [/src/lib/b.d.ts.map] +{"version":3,"file":"b.d.ts","sourceRoot":"","sources":["../src/b.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,CAAC;IAChB,CAAC,EAAE,CAAC,CAAC;CACN"} + +//// [/src/lib/c.d.ts] +import { A } from "./a"; +export interface C { + a: A; +} +//# sourceMappingURL=c.d.ts.map + +//// [/src/lib/c.d.ts.map] +{"version":3,"file":"c.d.ts","sourceRoot":"","sources":["../src/c.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,CAAC;IAChB,CAAC,EAAE,CAAC,CAAC;CACN"} + +//// [/src/lib/index.d.ts] +export { A } from "./a"; +export { B } from "./b"; +export { C } from "./c"; +//# sourceMappingURL=index.d.ts.map + +//// [/src/lib/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC"} + +//// [/src/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + }, + "./src/c.ts": { + "version": "429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n", + "signature": "-21569163793-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n//# sourceMappingURL=c.d.ts.map" + }, + "./src/b.ts": { + "version": "-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n", + "signature": "25318058868-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n//# sourceMappingURL=b.d.ts.map" + }, + "./src/a.ts": { + "version": "-15463561693-import { B } from \"./b\";\n\nexport interface A {\n b: B;\n}\n", + "signature": "-4935617457-import { B } from \"./b\";\r\nexport interface A {\r\n b: B;\r\n}\r\n//# sourceMappingURL=a.d.ts.map" + }, + "./src/index.ts": { + "version": "1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n", + "signature": "14762544269-export { A } from \"./a\";\r\nexport { B } from \"./b\";\r\nexport { C } from \"./c\";\r\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "incremental": true, + "target": 1, + "module": 1, + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "outDir": "./lib", + "composite": true, + "strict": true, + "esModuleInterop": true, + "alwaysStrict": true, + "rootDir": "./src", + "emitDeclarationOnly": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/a.ts": [ + "./src/b.ts" + ], + "./src/b.ts": [ + "./src/c.ts" + ], + "./src/c.ts": [ + "./src/a.ts" + ], + "./src/index.ts": [ + "./src/a.ts", + "./src/b.ts", + "./src/c.ts" + ] + }, + "exportedModulesMap": { + "./src/a.ts": [ + "./src/b.ts" + ], + "./src/b.ts": [ + "./src/c.ts" + ], + "./src/c.ts": [ + "./src/a.ts" + ], + "./src/index.ts": [ + "./src/a.ts", + "./src/b.ts", + "./src/c.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./src/a.ts", + "./src/b.ts", + "./src/c.ts", + "./src/index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js new file mode 100644 index 00000000000..d07b0914c32 --- /dev/null +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-circular-import-project-with-emitDeclarationOnly.js @@ -0,0 +1,132 @@ +//// [/src/lib/a.d.ts] +import { B } from "./b"; +export interface A { + b: B; +} + + +//// [/src/lib/b.d.ts] +import { C } from "./c"; +export interface B { + b: C; +} + + +//// [/src/lib/c.d.ts] +import { A } from "./a"; +export interface C { + a: A; +} + + +//// [/src/lib/index.d.ts] +export { A } from "./a"; +export { B } from "./b"; +export { C } from "./c"; + + +//// [/src/tsconfig.json] +{ + "compilerOptions": { + "incremental": true, /* Enable incremental compilation */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + "declaration": true, /* Generates corresponding '.d.ts' file. */ + /* Generates a sourcemap for each corresponding '.d.ts' file. */ + "sourceMap": true, /* Generates corresponding '.map' file. */ + "outDir": "./lib", /* Redirect output structure to the directory. */ + "composite": true, /* Enable project compilation */ + "strict": true, /* Enable all strict type-checking options. */ + + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + + "alwaysStrict": true, + "rootDir": "src", + "emitDeclarationOnly": true + } +} + + +//// [/src/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + }, + "./src/c.ts": { + "version": "429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n", + "signature": "-2697851509-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n" + }, + "./src/b.ts": { + "version": "-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n", + "signature": "20298635505-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n" + }, + "./src/a.ts": { + "version": "-15463561693-import { B } from \"./b\";\n\nexport interface A {\n b: B;\n}\n", + "signature": "-4206296467-import { B } from \"./b\";\r\nexport interface A {\r\n b: B;\r\n}\r\n" + }, + "./src/index.ts": { + "version": "1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n", + "signature": "-6009477228-export { A } from \"./a\";\r\nexport { B } from \"./b\";\r\nexport { C } from \"./c\";\r\n" + } + }, + "options": { + "incremental": true, + "target": 1, + "module": 1, + "declaration": true, + "sourceMap": true, + "outDir": "./lib", + "composite": true, + "strict": true, + "esModuleInterop": true, + "alwaysStrict": true, + "rootDir": "./src", + "emitDeclarationOnly": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/a.ts": [ + "./src/b.ts" + ], + "./src/b.ts": [ + "./src/c.ts" + ], + "./src/c.ts": [ + "./src/a.ts" + ], + "./src/index.ts": [ + "./src/a.ts", + "./src/b.ts", + "./src/c.ts" + ] + }, + "exportedModulesMap": { + "./src/a.ts": [ + "./src/b.ts" + ], + "./src/b.ts": [ + "./src/c.ts" + ], + "./src/c.ts": [ + "./src/a.ts" + ], + "./src/index.ts": [ + "./src/a.ts", + "./src/b.ts", + "./src/c.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./src/a.ts", + "./src/b.ts", + "./src/c.ts", + "./src/index.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js new file mode 100644 index 00000000000..86f7dc6e8bc --- /dev/null +++ b/tests/baselines/reference/tsbuild/emitDeclarationOnly/initial-Build/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js @@ -0,0 +1,104 @@ +//// [/src/lib/a.d.ts] +export declare class B { + prop: string; +} +export interface A { + b: B; +} +//# sourceMappingURL=a.d.ts.map + +//// [/src/lib/a.d.ts.map] +{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../src/a.ts"],"names":[],"mappings":"AAAA,qBAAa,CAAC;IAAG,IAAI,SAAW;CAAE;AAElC,MAAM,WAAW,CAAC;IAChB,CAAC,EAAE,CAAC,CAAC;CACN"} + +//// [/src/lib/b.d.ts] +import { C } from "./c"; +export interface B { + b: C; +} +//# sourceMappingURL=b.d.ts.map + +//// [/src/lib/b.d.ts.map] +{"version":3,"file":"b.d.ts","sourceRoot":"","sources":["../src/b.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,CAAC;IAChB,CAAC,EAAE,CAAC,CAAC;CACN"} + +//// [/src/lib/c.d.ts] +import { A } from "./a"; +export interface C { + a: A; +} +//# sourceMappingURL=c.d.ts.map + +//// [/src/lib/c.d.ts.map] +{"version":3,"file":"c.d.ts","sourceRoot":"","sources":["../src/c.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,CAAC;IAChB,CAAC,EAAE,CAAC,CAAC;CACN"} + +//// [/src/src/index.ts] unlink +//// [/src/src/a.ts] +export class B { prop = "hello"; } + +export interface A { + b: B; +} + + +//// [/src/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + }, + "./src/a.ts": { + "version": "11179224639-export class B { prop = \"hello\"; }\n\nexport interface A {\n b: B;\n}\n", + "signature": "-14608980923-export declare class B {\r\n prop: string;\r\n}\r\nexport interface A {\r\n b: B;\r\n}\r\n//# sourceMappingURL=a.d.ts.map" + }, + "./src/c.ts": { + "version": "429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n", + "signature": "-21569163793-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n//# sourceMappingURL=c.d.ts.map" + }, + "./src/b.ts": { + "version": "-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n", + "signature": "25318058868-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n//# sourceMappingURL=b.d.ts.map" + } + }, + "options": { + "incremental": true, + "target": 1, + "module": 1, + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "outDir": "./lib", + "composite": true, + "strict": true, + "esModuleInterop": true, + "alwaysStrict": true, + "rootDir": "./src", + "emitDeclarationOnly": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/b.ts": [ + "./src/c.ts" + ], + "./src/c.ts": [ + "./src/a.ts" + ] + }, + "exportedModulesMap": { + "./src/b.ts": [ + "./src/c.ts" + ], + "./src/c.ts": [ + "./src/a.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../lib/lib.d.ts", + "./src/a.ts", + "./src/b.ts", + "./src/c.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module.js index 0c32ba7c167..727875a5d40 100644 --- a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module.js +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module.js @@ -31,28 +31,28 @@ export declare const lazyBar: LazyAction<() => void, typeof import("./lazyIndex" "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../bar.ts": { - "version": "747071916", - "signature": "-9232740537" + "version": "747071916-interface RawAction {\r\n (...args: any[]): Promise | void;\r\n}\r\ninterface ActionFactory {\r\n (target: T): T;\r\n}\r\ndeclare function foo(): ActionFactory;\r\nexport default foo()(function foobar(): void {\r\n});", + "signature": "-9232740537-declare const _default: () => void;\r\nexport default _default;\r\n" }, "../bundling.ts": { - "version": "-21659820217", - "signature": "-40032907372" + "version": "-21659820217-export class LazyModule {\r\n constructor(private importCallback: () => Promise) {}\r\n}\r\n\r\nexport class LazyAction<\r\n TAction extends (...args: any[]) => any,\r\n TModule\r\n> {\r\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction) {\r\n }\r\n}\r\n", + "signature": "-40032907372-export declare class LazyModule {\r\n private importCallback;\r\n constructor(importCallback: () => Promise);\r\n}\r\nexport declare class LazyAction any, TModule> {\r\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction);\r\n}\r\n" }, "../global.d.ts": { - "version": "-9780226215", - "signature": "-9780226215" + "version": "-9780226215-interface PromiseConstructor {\r\n new (): Promise;\r\n}\r\ndeclare var Promise: PromiseConstructor;\r\ninterface Promise {\r\n}", + "signature": "-9780226215-interface PromiseConstructor {\r\n new (): Promise;\r\n}\r\ndeclare var Promise: PromiseConstructor;\r\ninterface Promise {\r\n}" }, "../lazyindex.ts": { - "version": "-6956449754", - "signature": "-6224542381" + "version": "-6956449754-export { default as bar } from './bar';\n", + "signature": "-6224542381-export { default as bar } from './bar';\r\n" }, "../index.ts": { - "version": "-11602502901", - "signature": "6256067474" + "version": "-11602502901-import { LazyAction, LazyModule } from './bundling';\r\nconst lazyModule = new LazyModule(() =>\r\n import('./lazyIndex')\r\n);\r\nexport const lazyBar = new LazyAction(lazyModule, m => m.bar);", + "signature": "6256067474-import { LazyAction } from './bundling';\r\nexport declare const lazyBar: LazyAction<() => void, typeof import(\"./lazyIndex\")>;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-Build/inferred-type-from-transitive-module.js b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-Build/inferred-type-from-transitive-module.js index 2a6aee9c8db..a04669bd971 100644 --- a/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-Build/inferred-type-from-transitive-module.js +++ b/tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-Build/inferred-type-from-transitive-module.js @@ -69,28 +69,28 @@ exports.bar = bar_1.default; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../bar.ts": { - "version": "5936740878", - "signature": "11191036521" + "version": "5936740878-interface RawAction {\r\n (...args: any[]): Promise | void;\r\n}\r\ninterface ActionFactory {\r\n (target: T): T;\r\n}\r\ndeclare function foo(): ActionFactory;\r\nexport default foo()(function foobar(param: string): void {\r\n});", + "signature": "11191036521-declare const _default: (param: string) => void;\r\nexport default _default;\r\n" }, "../bundling.ts": { - "version": "-21659820217", - "signature": "-40032907372" + "version": "-21659820217-export class LazyModule {\r\n constructor(private importCallback: () => Promise) {}\r\n}\r\n\r\nexport class LazyAction<\r\n TAction extends (...args: any[]) => any,\r\n TModule\r\n> {\r\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction) {\r\n }\r\n}\r\n", + "signature": "-40032907372-export declare class LazyModule {\r\n private importCallback;\r\n constructor(importCallback: () => Promise);\r\n}\r\nexport declare class LazyAction any, TModule> {\r\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction);\r\n}\r\n" }, "../global.d.ts": { - "version": "-9780226215", - "signature": "-9780226215" + "version": "-9780226215-interface PromiseConstructor {\r\n new (): Promise;\r\n}\r\ndeclare var Promise: PromiseConstructor;\r\ninterface Promise {\r\n}", + "signature": "-9780226215-interface PromiseConstructor {\r\n new (): Promise;\r\n}\r\ndeclare var Promise: PromiseConstructor;\r\ninterface Promise {\r\n}" }, "../lazyindex.ts": { - "version": "-6956449754", - "signature": "-6224542381" + "version": "-6956449754-export { default as bar } from './bar';\n", + "signature": "-6224542381-export { default as bar } from './bar';\r\n" }, "../index.ts": { - "version": "-11602502901", - "signature": "18468008756" + "version": "-11602502901-import { LazyAction, LazyModule } from './bundling';\r\nconst lazyModule = new LazyModule(() =>\r\n import('./lazyIndex')\r\n);\r\nexport const lazyBar = new LazyAction(lazyModule, m => m.bar);", + "signature": "18468008756-import { LazyAction } from './bundling';\r\nexport declare const lazyBar: LazyAction<(param: string) => void, typeof import(\"./lazyIndex\")>;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/lateBoundSymbol/incremental-declaration-doesnt-change/interface-is-merged-and-contains-late-bound-member.js b/tests/baselines/reference/tsbuild/lateBoundSymbol/incremental-declaration-doesnt-change/interface-is-merged-and-contains-late-bound-member.js index 84fe88219b1..bdd69739968 100644 --- a/tests/baselines/reference/tsbuild/lateBoundSymbol/incremental-declaration-doesnt-change/interface-is-merged-and-contains-late-bound-member.js +++ b/tests/baselines/reference/tsbuild/lateBoundSymbol/incremental-declaration-doesnt-change/interface-is-merged-and-contains-late-bound-member.js @@ -22,20 +22,20 @@ type A = HKT[typeof sym]; "program": { "fileInfos": { "../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "./src/globals.d.ts": { - "version": "-1994196675", - "signature": "-1994196675" + "version": "-1994196675-interface SymbolConstructor {\n (description?: string | number): symbol;\n}\ndeclare var Symbol: SymbolConstructor;", + "signature": "-1994196675-interface SymbolConstructor {\n (description?: string | number): symbol;\n}\ndeclare var Symbol: SymbolConstructor;" }, "./src/hkt.ts": { - "version": "675797797", - "signature": "2373810515" + "version": "675797797-export interface HKT { }", + "signature": "2373810515-export interface HKT {\r\n}\r\n" }, "./src/main.ts": { - "version": "-27494779858", - "signature": "-7779857705" + "version": "-27494779858-import { HKT } from \"./hkt\";\r\n\r\nconst sym = Symbol();\r\n\r\ndeclare module \"./hkt\" {\r\n interface HKT {\r\n [sym]: { a: T }\r\n }\r\n}\r\n\r\ntype A = HKT[typeof sym];", + "signature": "-7779857705-declare const sym: unique symbol;\r\ndeclare module \"./hkt\" {\r\n interface HKT {\r\n [sym]: {\r\n a: T;\r\n };\r\n }\r\n}\r\nexport {};\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/lateBoundSymbol/initial-Build/interface-is-merged-and-contains-late-bound-member.js b/tests/baselines/reference/tsbuild/lateBoundSymbol/initial-Build/interface-is-merged-and-contains-late-bound-member.js index afb887c35f8..949eb773431 100644 --- a/tests/baselines/reference/tsbuild/lateBoundSymbol/initial-Build/interface-is-merged-and-contains-late-bound-member.js +++ b/tests/baselines/reference/tsbuild/lateBoundSymbol/initial-Build/interface-is-merged-and-contains-late-bound-member.js @@ -15,20 +15,20 @@ var x = 10; "program": { "fileInfos": { "../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "./src/globals.d.ts": { - "version": "-1994196675", - "signature": "-1994196675" + "version": "-1994196675-interface SymbolConstructor {\n (description?: string | number): symbol;\n}\ndeclare var Symbol: SymbolConstructor;", + "signature": "-1994196675-interface SymbolConstructor {\n (description?: string | number): symbol;\n}\ndeclare var Symbol: SymbolConstructor;" }, "./src/hkt.ts": { - "version": "675797797", - "signature": "2373810515" + "version": "675797797-export interface HKT { }", + "signature": "2373810515-export interface HKT {\r\n}\r\n" }, "./src/main.ts": { - "version": "-28387946490", - "signature": "-7779857705" + "version": "-28387946490-import { HKT } from \"./hkt\";\r\n\r\nconst sym = Symbol();\r\n\r\ndeclare module \"./hkt\" {\r\n interface HKT {\r\n [sym]: { a: T }\r\n }\r\n}\r\nconst x = 10;\r\ntype A = HKT[typeof sym];", + "signature": "-7779857705-declare const sym: unique symbol;\r\ndeclare module \"./hkt\" {\r\n interface HKT {\r\n [sym]: {\r\n a: T;\r\n };\r\n }\r\n}\r\nexport {};\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-Build/synthesized-module-specifiers-resolve-correctly.js b/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-Build/synthesized-module-specifiers-resolve-correctly.js new file mode 100644 index 00000000000..cd12638d637 --- /dev/null +++ b/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-Build/synthesized-module-specifiers-resolve-correctly.js @@ -0,0 +1,168 @@ +//// [/lib/src/common/nominal.d.ts] +export declare type Nominal = T & { + [Symbol.species]: Name; +}; + + +//// [/lib/src/common/nominal.js] +"use strict"; +exports.__esModule = true; + + +//// [/lib/src/common/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib.d.ts": { + "version": "-32082413277-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };\ninterface SymbolConstructor {\n readonly species: symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\n", + "signature": "-32082413277-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };\ninterface SymbolConstructor {\n readonly species: symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\n" + }, + "../../../src/common/nominal.ts": { + "version": "-24498031910-export declare type Nominal = T & {\n [Symbol.species]: Name;\n};\n", + "signature": "-9513375615-export declare type Nominal = T & {\r\n [Symbol.species]: Name;\r\n};\r\n" + } + }, + "options": { + "skipLibCheck": true, + "rootDir": "../../..", + "outDir": "../..", + "composite": true, + "configFilePath": "../../../src/common/tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../src/common/nominal.ts", + "../../lib.d.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/lib/src/sub-project/index.d.ts] +import { Nominal } from '../common/nominal'; +export declare type MyNominal = Nominal; + + +//// [/lib/src/sub-project/index.js] +"use strict"; +exports.__esModule = true; + + +//// [/lib/src/sub-project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib.d.ts": { + "version": "-32082413277-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };\ninterface SymbolConstructor {\n readonly species: symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\n", + "signature": "-32082413277-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };\ninterface SymbolConstructor {\n readonly species: symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\n" + }, + "../../../src/common/nominal.ts": { + "version": "-9513375615-export declare type Nominal = T & {\r\n [Symbol.species]: Name;\r\n};\r\n", + "signature": "-9513375615-export declare type Nominal = T & {\r\n [Symbol.species]: Name;\r\n};\r\n" + }, + "../../../src/sub-project/index.ts": { + "version": "-22894055505-import { Nominal } from '../common/nominal';\n\nexport type MyNominal = Nominal;\n", + "signature": "-21416888433-import { Nominal } from '../common/nominal';\r\nexport declare type MyNominal = Nominal;\r\n" + } + }, + "options": { + "skipLibCheck": true, + "rootDir": "../../..", + "outDir": "../..", + "composite": true, + "configFilePath": "../../../src/sub-project/tsconfig.json" + }, + "referencedMap": { + "../../../src/sub-project/index.ts": [ + "../common/nominal.d.ts" + ] + }, + "exportedModulesMap": { + "../../../src/sub-project/index.ts": [ + "../common/nominal.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../src/common/nominal.ts", + "../../../src/sub-project/index.ts", + "../../lib.d.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/lib/src/sub-project-2/index.d.ts] +declare const variable: { + key: import("../common/nominal").Nominal; +}; +export declare function getVar(): keyof typeof variable; +export {}; + + +//// [/lib/src/sub-project-2/index.js] +"use strict"; +exports.__esModule = true; +var variable = { + key: 'value' +}; +function getVar() { + return 'key'; +} +exports.getVar = getVar; + + +//// [/lib/src/sub-project-2/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../lib.d.ts": { + "version": "-32082413277-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };\ninterface SymbolConstructor {\n readonly species: symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\n", + "signature": "-32082413277-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };\ninterface SymbolConstructor {\n readonly species: symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\n" + }, + "../../../src/common/nominal.ts": { + "version": "-9513375615-export declare type Nominal = T & {\r\n [Symbol.species]: Name;\r\n};\r\n", + "signature": "-9513375615-export declare type Nominal = T & {\r\n [Symbol.species]: Name;\r\n};\r\n" + }, + "../../../src/sub-project/index.ts": { + "version": "-21416888433-import { Nominal } from '../common/nominal';\r\nexport declare type MyNominal = Nominal;\r\n", + "signature": "-21416888433-import { Nominal } from '../common/nominal';\r\nexport declare type MyNominal = Nominal;\r\n" + }, + "../../../src/sub-project-2/index.ts": { + "version": "-13939373533-import { MyNominal } from '../sub-project/index';\n\nconst variable = {\n key: 'value' as MyNominal,\n};\n\nexport function getVar(): keyof typeof variable {\n return 'key';\n}\n", + "signature": "-17233212183-declare const variable: {\r\n key: import(\"../common/nominal\").Nominal;\r\n};\r\nexport declare function getVar(): keyof typeof variable;\r\nexport {};\r\n" + } + }, + "options": { + "skipLibCheck": true, + "rootDir": "../../..", + "outDir": "../..", + "composite": true, + "configFilePath": "../../../src/sub-project-2/tsconfig.json" + }, + "referencedMap": { + "../../../src/sub-project-2/index.ts": [ + "../sub-project/index.d.ts" + ], + "../../../src/sub-project/index.ts": [ + "../common/nominal.d.ts" + ] + }, + "exportedModulesMap": { + "../../../src/sub-project-2/index.ts": [ + "../common/nominal.d.ts" + ], + "../../../src/sub-project/index.ts": [ + "../common/nominal.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../src/common/nominal.ts", + "../../../src/sub-project-2/index.ts", + "../../../src/sub-project/index.ts", + "../../lib.d.ts" + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/resolves-correctly.js b/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/resolves-correctly.js deleted file mode 100644 index 2ba8fa80817..00000000000 --- a/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/resolves-correctly.js +++ /dev/null @@ -1,348 +0,0 @@ -//// [/lib/src/common/nominal.d.ts] -export declare type Nominal = T & { - [Symbol.species]: Name; -}; - - -//// [/lib/src/common/nominal.js] -"use strict"; -exports.__esModule = true; - - -//// [/lib/src/common/tsconfig.tsbuildinfo] -{ - "program": { - "fileInfos": { - "../../../.ts/lib.es5.d.ts": { - "version": "406734842058", - "signature": "406734842058" - }, - "../../../.ts/lib.es2015.d.ts": { - "version": "57263133672", - "signature": "57263133672" - }, - "../../../.ts/lib.dom.d.ts": { - "version": "-1041975536091", - "signature": "-1041975536091" - }, - "../../../.ts/lib.es2015.core.d.ts": { - "version": "370321249768", - "signature": "370321249768" - }, - "../../../.ts/lib.es2015.collection.d.ts": { - "version": "-95997535017", - "signature": "-95997535017" - }, - "../../../.ts/lib.es2015.generator.d.ts": { - "version": "10837180865", - "signature": "10837180865" - }, - "../../../.ts/lib.es2015.iterable.d.ts": { - "version": "232404497324", - "signature": "232404497324" - }, - "../../../.ts/lib.es2015.promise.d.ts": { - "version": "235321148269", - "signature": "235321148269" - }, - "../../../.ts/lib.es2015.proxy.d.ts": { - "version": "55479865087", - "signature": "55479865087" - }, - "../../../.ts/lib.es2015.reflect.d.ts": { - "version": "30748787093", - "signature": "30748787093" - }, - "../../../.ts/lib.es2015.symbol.d.ts": { - "version": "9409688441", - "signature": "9409688441" - }, - "../../../.ts/lib.es2015.symbol.wellknown.d.ts": { - "version": "-67261006573", - "signature": "-67261006573" - }, - "../../../src/common/nominal.ts": { - "version": "-24498031910", - "signature": "-24498031910" - } - }, - "options": { - "skipLibCheck": true, - "rootDir": "../../..", - "outDir": "../..", - "lib": [ - "lib.dom.d.ts", - "lib.es2015.d.ts", - "lib.es2015.symbol.wellknown.d.ts" - ], - "composite": true, - "configFilePath": "../../../src/common/tsconfig.json" - }, - "referencedMap": {}, - "exportedModulesMap": {}, - "semanticDiagnosticsPerFile": [ - "../../../.ts/lib.dom.d.ts", - "../../../.ts/lib.es2015.collection.d.ts", - "../../../.ts/lib.es2015.core.d.ts", - "../../../.ts/lib.es2015.d.ts", - "../../../.ts/lib.es2015.generator.d.ts", - "../../../.ts/lib.es2015.iterable.d.ts", - "../../../.ts/lib.es2015.promise.d.ts", - "../../../.ts/lib.es2015.proxy.d.ts", - "../../../.ts/lib.es2015.reflect.d.ts", - "../../../.ts/lib.es2015.symbol.d.ts", - "../../../.ts/lib.es2015.symbol.wellknown.d.ts", - "../../../.ts/lib.es5.d.ts", - "../../../src/common/nominal.ts" - ] - }, - "version": "FakeTSVersion" -} - -//// [/lib/src/sub-project/index.d.ts] -import { Nominal } from '../common/nominal'; -export declare type MyNominal = Nominal; - - -//// [/lib/src/sub-project/index.js] -"use strict"; -exports.__esModule = true; - - -//// [/lib/src/sub-project/tsconfig.tsbuildinfo] -{ - "program": { - "fileInfos": { - "../../../.ts/lib.es5.d.ts": { - "version": "406734842058", - "signature": "406734842058" - }, - "../../../.ts/lib.es2015.d.ts": { - "version": "57263133672", - "signature": "57263133672" - }, - "../../../.ts/lib.dom.d.ts": { - "version": "-1041975536091", - "signature": "-1041975536091" - }, - "../../../.ts/lib.es2015.core.d.ts": { - "version": "370321249768", - "signature": "370321249768" - }, - "../../../.ts/lib.es2015.collection.d.ts": { - "version": "-95997535017", - "signature": "-95997535017" - }, - "../../../.ts/lib.es2015.generator.d.ts": { - "version": "10837180865", - "signature": "10837180865" - }, - "../../../.ts/lib.es2015.iterable.d.ts": { - "version": "232404497324", - "signature": "232404497324" - }, - "../../../.ts/lib.es2015.promise.d.ts": { - "version": "235321148269", - "signature": "235321148269" - }, - "../../../.ts/lib.es2015.proxy.d.ts": { - "version": "55479865087", - "signature": "55479865087" - }, - "../../../.ts/lib.es2015.reflect.d.ts": { - "version": "30748787093", - "signature": "30748787093" - }, - "../../../.ts/lib.es2015.symbol.d.ts": { - "version": "9409688441", - "signature": "9409688441" - }, - "../../../.ts/lib.es2015.symbol.wellknown.d.ts": { - "version": "-67261006573", - "signature": "-67261006573" - }, - "../../../src/common/nominal.ts": { - "version": "-24498031910", - "signature": "-24498031910" - }, - "../../../src/sub-project/index.ts": { - "version": "-22894055505", - "signature": "-18559108619" - } - }, - "options": { - "skipLibCheck": true, - "rootDir": "../../..", - "outDir": "../..", - "lib": [ - "lib.dom.d.ts", - "lib.es2015.d.ts", - "lib.es2015.symbol.wellknown.d.ts" - ], - "composite": true, - "configFilePath": "../../../src/sub-project/tsconfig.json" - }, - "referencedMap": { - "../../../src/sub-project/index.ts": [ - "../common/nominal.d.ts" - ] - }, - "exportedModulesMap": { - "../../../src/sub-project/index.ts": [ - "../common/nominal.d.ts" - ] - }, - "semanticDiagnosticsPerFile": [ - "../../../.ts/lib.dom.d.ts", - "../../../.ts/lib.es2015.collection.d.ts", - "../../../.ts/lib.es2015.core.d.ts", - "../../../.ts/lib.es2015.d.ts", - "../../../.ts/lib.es2015.generator.d.ts", - "../../../.ts/lib.es2015.iterable.d.ts", - "../../../.ts/lib.es2015.promise.d.ts", - "../../../.ts/lib.es2015.proxy.d.ts", - "../../../.ts/lib.es2015.reflect.d.ts", - "../../../.ts/lib.es2015.symbol.d.ts", - "../../../.ts/lib.es2015.symbol.wellknown.d.ts", - "../../../.ts/lib.es5.d.ts", - "../../../src/common/nominal.ts", - "../../../src/sub-project/index.ts" - ] - }, - "version": "FakeTSVersion" -} - -//// [/lib/src/sub-project-2/index.d.ts] -declare const variable: { - key: import("../common/nominal").Nominal; -}; -export declare function getVar(): keyof typeof variable; -export {}; - - -//// [/lib/src/sub-project-2/index.js] -"use strict"; -exports.__esModule = true; -var variable = { - key: 'value' -}; -function getVar() { - return 'key'; -} -exports.getVar = getVar; - - -//// [/lib/src/sub-project-2/tsconfig.tsbuildinfo] -{ - "program": { - "fileInfos": { - "../../../.ts/lib.es5.d.ts": { - "version": "406734842058", - "signature": "406734842058" - }, - "../../../.ts/lib.es2015.d.ts": { - "version": "57263133672", - "signature": "57263133672" - }, - "../../../.ts/lib.dom.d.ts": { - "version": "-1041975536091", - "signature": "-1041975536091" - }, - "../../../.ts/lib.es2015.core.d.ts": { - "version": "370321249768", - "signature": "370321249768" - }, - "../../../.ts/lib.es2015.collection.d.ts": { - "version": "-95997535017", - "signature": "-95997535017" - }, - "../../../.ts/lib.es2015.generator.d.ts": { - "version": "10837180865", - "signature": "10837180865" - }, - "../../../.ts/lib.es2015.iterable.d.ts": { - "version": "232404497324", - "signature": "232404497324" - }, - "../../../.ts/lib.es2015.promise.d.ts": { - "version": "235321148269", - "signature": "235321148269" - }, - "../../../.ts/lib.es2015.proxy.d.ts": { - "version": "55479865087", - "signature": "55479865087" - }, - "../../../.ts/lib.es2015.reflect.d.ts": { - "version": "30748787093", - "signature": "30748787093" - }, - "../../../.ts/lib.es2015.symbol.d.ts": { - "version": "9409688441", - "signature": "9409688441" - }, - "../../../.ts/lib.es2015.symbol.wellknown.d.ts": { - "version": "-67261006573", - "signature": "-67261006573" - }, - "../../../src/common/nominal.ts": { - "version": "-24498031910", - "signature": "-24498031910" - }, - "../../../src/sub-project/index.ts": { - "version": "-18559108619", - "signature": "-18559108619" - }, - "../../../src/sub-project-2/index.ts": { - "version": "-13939373533", - "signature": "-33844181688" - } - }, - "options": { - "skipLibCheck": true, - "rootDir": "../../..", - "outDir": "../..", - "lib": [ - "lib.dom.d.ts", - "lib.es2015.d.ts", - "lib.es2015.symbol.wellknown.d.ts" - ], - "composite": true, - "configFilePath": "../../../src/sub-project-2/tsconfig.json" - }, - "referencedMap": { - "../../../src/sub-project-2/index.ts": [ - "../sub-project/index.d.ts" - ], - "../../../src/sub-project/index.ts": [ - "../common/nominal.d.ts" - ] - }, - "exportedModulesMap": { - "../../../src/sub-project-2/index.ts": [ - "../common/nominal.d.ts" - ], - "../../../src/sub-project/index.ts": [ - "../common/nominal.d.ts" - ] - }, - "semanticDiagnosticsPerFile": [ - "../../../.ts/lib.dom.d.ts", - "../../../.ts/lib.es2015.collection.d.ts", - "../../../.ts/lib.es2015.core.d.ts", - "../../../.ts/lib.es2015.d.ts", - "../../../.ts/lib.es2015.generator.d.ts", - "../../../.ts/lib.es2015.iterable.d.ts", - "../../../.ts/lib.es2015.promise.d.ts", - "../../../.ts/lib.es2015.proxy.d.ts", - "../../../.ts/lib.es2015.reflect.d.ts", - "../../../.ts/lib.es2015.symbol.d.ts", - "../../../.ts/lib.es2015.symbol.wellknown.d.ts", - "../../../.ts/lib.es5.d.ts", - "../../../src/common/nominal.ts", - "../../../src/sub-project-2/index.ts", - "../../../src/sub-project/index.ts" - ] - }, - "version": "FakeTSVersion" -} - diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/sample.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/sample.js index be4e09ba5b5..f1124ae44eb 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/sample.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/sample.js @@ -172,20 +172,20 @@ export class someClass { } "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "./anothermodule.ts": { - "version": "-2676574883", - "signature": "25219880154" + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "./index.ts": { - "version": "-13387000654", - "signature": "12514354613" + "version": "-13387000654-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClass { }", + "signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map" }, "./some_decl.d.ts": { - "version": "-9253692965", - "signature": "-9253692965" + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" } }, "options": { @@ -212,20 +212,20 @@ export class someClass { } "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../core/index.ts": { - "version": "-2069755619", - "signature": "-2069755619" + "version": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map" }, "../core/anothermodule.ts": { - "version": "7652028357", - "signature": "7652028357" + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "./index.ts": { - "version": "-5786964698", - "signature": "-6548680073" + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" } }, "options": { @@ -262,24 +262,24 @@ export class someClass { } "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../core/index.ts": { - "version": "-2069755619", - "signature": "-2069755619" + "version": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map" }, "../core/anothermodule.ts": { - "version": "7652028357", - "signature": "7652028357" + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "../logic/index.ts": { - "version": "-6548680073", - "signature": "-6548680073" + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" }, "./index.ts": { - "version": "12336236525", - "signature": "-9209611" + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-declaration-option-changes.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-declaration-option-changes.js index bf28ddcc386..8a87cafe69e 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-declaration-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-declaration-option-changes.js @@ -21,20 +21,20 @@ export declare function multiply(a: number, b: number): number; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "./anothermodule.ts": { - "version": "-2676574883", - "signature": "-8396256275" + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-8396256275-export declare const World = \"hello\";\r\n" }, "./index.ts": { - "version": "-18749805970", - "signature": "1874987148" + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "1874987148-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n" }, "./some_decl.d.ts": { - "version": "-9253692965", - "signature": "-9253692965" + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-esModuleInterop-option-changes.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-esModuleInterop-option-changes.js index e93ed540970..ce9044faa05 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-esModuleInterop-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-esModuleInterop-option-changes.js @@ -37,24 +37,24 @@ exports.m = mod; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../core/index.ts": { - "version": "-13851440507", - "signature": "-13851440507" + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "../core/anothermodule.ts": { - "version": "7652028357", - "signature": "7652028357" + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "../logic/index.ts": { - "version": "-6548680073", - "signature": "-6548680073" + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" }, "./index.ts": { - "version": "12336236525", - "signature": "-9209611" + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-logic-config-changes-declaration-dir.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-logic-config-changes-declaration-dir.js index 13204cdf566..13d6ef5c3ba 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-logic-config-changes-declaration-dir.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-logic-config-changes-declaration-dir.js @@ -25,20 +25,20 @@ export declare const m: typeof mod; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../core/index.ts": { - "version": "-13851440507", - "signature": "-13851440507" + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "../core/anothermodule.ts": { - "version": "7652028357", - "signature": "7652028357" + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "./index.ts": { - "version": "-5786964698", - "signature": "-6548680073" + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" } }, "options": { @@ -76,24 +76,24 @@ export declare const m: typeof mod; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../core/index.ts": { - "version": "-13851440507", - "signature": "-13851440507" + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "../core/anothermodule.ts": { - "version": "7652028357", - "signature": "7652028357" + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "../logic/index.ts": { - "version": "-6548680073", - "signature": "-6548680073" + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" }, "./index.ts": { - "version": "12336236525", - "signature": "-9209611" + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-module-option-changes.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-module-option-changes.js index bda1af5741c..d6c6fb4d877 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-module-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-module-option-changes.js @@ -31,20 +31,20 @@ define(["require", "exports"], function (require, exports) { "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "./anothermodule.ts": { - "version": "-2676574883", - "signature": "-8396256275" + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-8396256275-export declare const World = \"hello\";\r\n" }, "./index.ts": { - "version": "-18749805970", - "signature": "1874987148" + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "1874987148-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n" }, "./some_decl.d.ts": { - "version": "-9253692965", - "signature": "-9253692965" + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-target-option-changes.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-target-option-changes.js index 99721cc54b9..0dc8156158d 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-target-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-target-option-changes.js @@ -29,24 +29,24 @@ exports.multiply = multiply; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "8926001564", - "signature": "8926001564" + "version": "8926001564-/// \n/// ", + "signature": "8926001564-/// \n/// " }, "../../lib/lib.esnext.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "./anothermodule.ts": { - "version": "-2676574883", - "signature": "-8396256275" + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-8396256275-export declare const World = \"hello\";\r\n" }, "./index.ts": { - "version": "-18749805970", - "signature": "1874987148" + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "1874987148-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n" }, "./some_decl.d.ts": { - "version": "-9253692965", - "signature": "-9253692965" + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/sample.js b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/sample.js index 2b4b56abbf8..82e64bc9330 100644 --- a/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/sample.js +++ b/tests/baselines/reference/tsbuild/sample1/incremental-declaration-doesnt-change/sample.js @@ -25,20 +25,20 @@ class someClass { } "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "./anothermodule.ts": { - "version": "-2676574883", - "signature": "25219880154" + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "./index.ts": { - "version": "-16698397488", - "signature": "11051732871" + "version": "-16698397488-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nclass someClass { }", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "./some_decl.d.ts": { - "version": "-9253692965", - "signature": "-9253692965" + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/sample.js b/tests/baselines/reference/tsbuild/sample1/initial-Build/sample.js index 829dbe1718f..7a9f9a2ea95 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/sample.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-Build/sample.js @@ -185,20 +185,20 @@ exports.multiply = multiply; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "./anothermodule.ts": { - "version": "-2676574883", - "signature": "25219880154" + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "./index.ts": { - "version": "-18749805970", - "signature": "11051732871" + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "./some_decl.d.ts": { - "version": "-9253692965", - "signature": "-9253692965" + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" } }, "options": { @@ -370,20 +370,20 @@ sourceFile:index.ts "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../core/index.ts": { - "version": "-13851440507", - "signature": "-13851440507" + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "../core/anothermodule.ts": { - "version": "7652028357", - "signature": "7652028357" + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "./index.ts": { - "version": "-5786964698", - "signature": "-6548680073" + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" } }, "options": { @@ -436,24 +436,24 @@ exports.m = mod; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../core/index.ts": { - "version": "-13851440507", - "signature": "-13851440507" + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "../core/anothermodule.ts": { - "version": "7652028357", - "signature": "7652028357" + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "../logic/index.ts": { - "version": "-6548680073", - "signature": "-6548680073" + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" }, "./index.ts": { - "version": "12336236525", - "signature": "-9209611" + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-declaration-option-changes.js b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-declaration-option-changes.js index 7c05255bfd1..61e87a815aa 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-declaration-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-declaration-option-changes.js @@ -27,20 +27,20 @@ exports.multiply = multiply; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "./anothermodule.ts": { - "version": "-2676574883", - "signature": "-8396256275" + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-8396256275-export declare const World = \"hello\";\r\n" }, "./index.ts": { - "version": "-18749805970", - "signature": "1874987148" + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "1874987148-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n" }, "./some_decl.d.ts": { - "version": "-9253692965", - "signature": "-9253692965" + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-esModuleInterop-option-changes.js b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-esModuleInterop-option-changes.js index 998c09d4710..e24ade14d9d 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-esModuleInterop-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-esModuleInterop-option-changes.js @@ -35,20 +35,20 @@ exports.multiply = multiply; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "./anothermodule.ts": { - "version": "-2676574883", - "signature": "25219880154" + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "./index.ts": { - "version": "-18749805970", - "signature": "11051732871" + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "./some_decl.d.ts": { - "version": "-9253692965", - "signature": "-9253692965" + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" } }, "options": { @@ -96,20 +96,20 @@ exports.m = mod; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../core/index.ts": { - "version": "-13851440507", - "signature": "-13851440507" + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "../core/anothermodule.ts": { - "version": "7652028357", - "signature": "7652028357" + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "./index.ts": { - "version": "-5786964698", - "signature": "-6548680073" + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" } }, "options": { @@ -178,24 +178,24 @@ exports.m = mod; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../core/index.ts": { - "version": "-13851440507", - "signature": "-13851440507" + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "../core/anothermodule.ts": { - "version": "7652028357", - "signature": "7652028357" + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "../logic/index.ts": { - "version": "-6548680073", - "signature": "-6548680073" + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" }, "./index.ts": { - "version": "12336236525", - "signature": "-9209611" + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-logic-config-changes-declaration-dir.js b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-logic-config-changes-declaration-dir.js index 829dbe1718f..7a9f9a2ea95 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-logic-config-changes-declaration-dir.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-logic-config-changes-declaration-dir.js @@ -185,20 +185,20 @@ exports.multiply = multiply; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "./anothermodule.ts": { - "version": "-2676574883", - "signature": "25219880154" + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "./index.ts": { - "version": "-18749805970", - "signature": "11051732871" + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "./some_decl.d.ts": { - "version": "-9253692965", - "signature": "-9253692965" + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" } }, "options": { @@ -370,20 +370,20 @@ sourceFile:index.ts "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../core/index.ts": { - "version": "-13851440507", - "signature": "-13851440507" + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "../core/anothermodule.ts": { - "version": "7652028357", - "signature": "7652028357" + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "./index.ts": { - "version": "-5786964698", - "signature": "-6548680073" + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" } }, "options": { @@ -436,24 +436,24 @@ exports.m = mod; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../core/index.ts": { - "version": "-13851440507", - "signature": "-13851440507" + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "../core/anothermodule.ts": { - "version": "7652028357", - "signature": "7652028357" + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "../logic/index.ts": { - "version": "-6548680073", - "signature": "-6548680073" + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" }, "./index.ts": { - "version": "12336236525", - "signature": "-9209611" + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-logic-specifies-tsBuildInfoFile.js b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-logic-specifies-tsBuildInfoFile.js index 5dab84c64ac..b7623e1af56 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-logic-specifies-tsBuildInfoFile.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-logic-specifies-tsBuildInfoFile.js @@ -185,20 +185,20 @@ exports.multiply = multiply; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "./anothermodule.ts": { - "version": "-2676574883", - "signature": "25219880154" + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "./index.ts": { - "version": "-18749805970", - "signature": "11051732871" + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "./some_decl.d.ts": { - "version": "-9253692965", - "signature": "-9253692965" + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" } }, "options": { @@ -370,20 +370,20 @@ sourceFile:index.ts "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../core/index.ts": { - "version": "-13851440507", - "signature": "-13851440507" + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "../core/anothermodule.ts": { - "version": "7652028357", - "signature": "7652028357" + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "./index.ts": { - "version": "-5786964698", - "signature": "-6548680073" + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" } }, "options": { @@ -453,24 +453,24 @@ exports.m = mod; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../core/index.ts": { - "version": "-13851440507", - "signature": "-13851440507" + "version": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map", + "signature": "-13851440507-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map" }, "../core/anothermodule.ts": { - "version": "7652028357", - "signature": "7652028357" + "version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map" }, "../logic/index.ts": { - "version": "-6548680073", - "signature": "-6548680073" + "version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n", + "signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" }, "./index.ts": { - "version": "12336236525", - "signature": "-9209611" + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-module-option-changes.js b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-module-option-changes.js index abc90d83d09..ad19329a2e0 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-module-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-module-option-changes.js @@ -27,20 +27,20 @@ exports.multiply = multiply; "program": { "fileInfos": { "../../lib/lib.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "./anothermodule.ts": { - "version": "-2676574883", - "signature": "-8396256275" + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-8396256275-export declare const World = \"hello\";\r\n" }, "./index.ts": { - "version": "-18749805970", - "signature": "1874987148" + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "1874987148-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n" }, "./some_decl.d.ts": { - "version": "-9253692965", - "signature": "-9253692965" + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" } }, "options": { diff --git a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-target-option-changes.js b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-target-option-changes.js index 74efec1e633..c8fc2b1fbde 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-Build/when-target-option-changes.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-Build/when-target-option-changes.js @@ -46,24 +46,24 @@ export function multiply(a, b) { return a * b; } "program": { "fileInfos": { "../../lib/lib.esnext.d.ts": { - "version": "3858781397", - "signature": "3858781397" + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" }, "../../lib/lib.esnext.full.d.ts": { - "version": "8926001564", - "signature": "8926001564" + "version": "8926001564-/// \n/// ", + "signature": "8926001564-/// \n/// " }, "./anothermodule.ts": { - "version": "-2676574883", - "signature": "-8396256275" + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-8396256275-export declare const World = \"hello\";\r\n" }, "./index.ts": { - "version": "-18749805970", - "signature": "1874987148" + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "1874987148-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n" }, "./some_decl.d.ts": { - "version": "-9253692965", - "signature": "-9253692965" + "version": "-9253692965-declare const dts: any;\r\n", + "signature": "-9253692965-declare const dts: any;\r\n" } }, "options": { diff --git a/tests/projects/emitDeclarationOnly/src/a.ts b/tests/projects/emitDeclarationOnly/src/a.ts new file mode 100644 index 00000000000..330b4fb38d4 --- /dev/null +++ b/tests/projects/emitDeclarationOnly/src/a.ts @@ -0,0 +1,5 @@ +import { B } from "./b"; + +export interface A { + b: B; +} diff --git a/tests/projects/emitDeclarationOnly/src/b.ts b/tests/projects/emitDeclarationOnly/src/b.ts new file mode 100644 index 00000000000..80f920a0e9d --- /dev/null +++ b/tests/projects/emitDeclarationOnly/src/b.ts @@ -0,0 +1,5 @@ +import { C } from "./c"; + +export interface B { + b: C; +} diff --git a/tests/projects/emitDeclarationOnly/src/c.ts b/tests/projects/emitDeclarationOnly/src/c.ts new file mode 100644 index 00000000000..b6b6e67dada --- /dev/null +++ b/tests/projects/emitDeclarationOnly/src/c.ts @@ -0,0 +1,5 @@ +import { A } from "./a"; + +export interface C { + a: A; +} diff --git a/tests/projects/emitDeclarationOnly/src/index.ts b/tests/projects/emitDeclarationOnly/src/index.ts new file mode 100644 index 00000000000..c6a5229cdb9 --- /dev/null +++ b/tests/projects/emitDeclarationOnly/src/index.ts @@ -0,0 +1,3 @@ +export { A } from "./a"; +export { B } from "./b"; +export { C } from "./c"; diff --git a/tests/projects/emitDeclarationOnly/tsconfig.json b/tests/projects/emitDeclarationOnly/tsconfig.json new file mode 100644 index 00000000000..334d67116d9 --- /dev/null +++ b/tests/projects/emitDeclarationOnly/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "incremental": true, /* Enable incremental compilation */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + "declaration": true, /* Generates corresponding '.d.ts' file. */ + "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + "sourceMap": true, /* Generates corresponding '.map' file. */ + "outDir": "./lib", /* Redirect output structure to the directory. */ + "composite": true, /* Enable project compilation */ + "strict": true, /* Enable all strict type-checking options. */ + + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + + "alwaysStrict": true, + "rootDir": "src", + "emitDeclarationOnly": true + } +}