diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 76d806fa13c39..1f4657bcbcea3 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -77,6 +77,14 @@ namespace ts { shortName: "?", type: "boolean" }, + { + name: "watch", + shortName: "w", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Command_line_Options, + description: Diagnostics.Watch_input_files, + }, { name: "preserveWatchOutput", type: "boolean", @@ -96,13 +104,12 @@ namespace ts { category: Diagnostics.Advanced_Options, description: Diagnostics.Print_names_of_generated_files_part_of_the_compilation }, + { - name: "watch", - shortName: "w", + name: "traceResolution", type: "boolean", - showInSimplifiedHelpView: true, - category: Diagnostics.Command_line_Options, - description: Diagnostics.Watch_input_files, + category: Diagnostics.Advanced_Options, + description: Diagnostics.Enable_tracing_of_the_name_resolution_process }, ]; @@ -581,12 +588,6 @@ namespace ts { category: Diagnostics.Advanced_Options, description: Diagnostics.Show_verbose_diagnostic_information }, - { - name: "traceResolution", - type: "boolean", - category: Diagnostics.Advanced_Options, - description: Diagnostics.Enable_tracing_of_the_name_resolution_process - }, { name: "resolveJsonModule", type: "boolean", diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 5312efb5aac03..9d9da9a93f4e4 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -530,6 +530,17 @@ namespace ts { if (symbol) { (exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol); } + if ((options.outDir || options.declarationDir) && pathIsRelative(input.text) && currentSourceFile.redirectedReferences) { + const normalizedTargetPath = getNormalizedAbsolutePath(input.text, getDirectoryPath(currentSourceFile.fileName)); + for (const ext of [Extension.Ts, Extension.Tsx]) { + const probePath = normalizedTargetPath + ext; + if (currentSourceFile.redirectedReferences.indexOf(probePath) >= 0) { + const outputDir = getDirectoryPath(getOutputPathsFor(currentSourceFile, host, /*forceDtsPaths*/ true).declarationFilePath!); + const relativePath = getRelativePathFromDirectory(outputDir, normalizedTargetPath, host.getCanonicalFileName); + return createLiteral(relativePath); + } + } + } } } return input; diff --git a/src/testRunner/unittests/tsbuild.ts b/src/testRunner/unittests/tsbuild.ts index f54e3c93215f9..f173f2fb85eca 100644 --- a/src/testRunner/unittests/tsbuild.ts +++ b/src/testRunner/unittests/tsbuild.ts @@ -3,7 +3,7 @@ namespace ts { export namespace Sample1 { tick(); const projFs = loadProjectFromDisk("tests/projects/sample1"); - + const sample1ProjectOutput = loadOutputProjectFromDisk("sample1"); const allExpectedOutputs = ["/src/tests/index.js", "/src/core/index.js", "/src/core/index.d.ts", "/src/core/index.d.ts.map", "/src/logic/index.js", "/src/logic/index.js.map", "/src/logic/index.d.ts"]; @@ -17,11 +17,34 @@ namespace ts { host.clearDiagnostics(); builder.buildAllProjects(); host.assertDiagnosticMessages(/*empty*/); + // Check for outputs + verifyOutputsFs(fs, sample1ProjectOutput, "/src"); + }); - // Check for outputs. Not an exhaustive list - for (const output of allExpectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + it("builds correctly when outDir is specified", () => { + const fs = projFs.shadow(); + fs.writeFileSync("/src/logic/tsconfig.json", JSON.stringify({ + compilerOptions: { composite: true, declaration: true, outDir: "outDir" }, + references: [{ path: "../core" }] + })); + const host = new fakes.SolutionBuilderHost(fs); + const builder = createSolutionBuilder(host, ["/src/tests"], { }); + builder.buildAllProjects(); + host.assertDiagnosticMessages(/*empty*/); + verifyOutputs(fs, "sample1WithLogicOutDir"); + }); + + it("builds correctly when declarationDir is specified", () => { + const fs = projFs.shadow(); + fs.writeFileSync("/src/logic/tsconfig.json", JSON.stringify({ + compilerOptions: { composite: true, declaration: true, declarationDir: "out/decls" }, + references: [{ path: "../core" }] + })); + const host = new fakes.SolutionBuilderHost(fs); + const builder = createSolutionBuilder(host, ["/src/tests"], {}); + builder.buildAllProjects(); + host.assertDiagnosticMessages(/*empty*/); + verifyOutputs(fs, "sample1WithLogicDeclarationDir"); }); }); @@ -34,9 +57,7 @@ namespace ts { host.assertDiagnosticMessages(Diagnostics.A_non_dry_build_would_build_project_0, Diagnostics.A_non_dry_build_would_build_project_0, Diagnostics.A_non_dry_build_would_build_project_0); // Check for outputs to not be written. Not an exhaustive list - for (const output of allExpectedOutputs) { - assert(!fs.existsSync(output), `Expect file ${output} to not exist`); - } + verifyOutputsNotExistOnFs(fs, sample1ProjectOutput, "/src"); }); it("indicates that it would skip builds during a dry build", () => { @@ -62,14 +83,10 @@ namespace ts { const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); builder.buildAllProjects(); // Verify they exist - for (const output of allExpectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsFs(fs, sample1ProjectOutput, "/src"); builder.cleanAllProjects(); // Verify they are gone - for (const output of allExpectedOutputs) { - assert(!fs.existsSync(output), `Expect file ${output} to not exist`); - } + verifyOutputsNotExistOnFs(fs, sample1ProjectOutput, "/src"); // Subsequent clean shouldn't throw / etc builder.cleanAllProjects(); }); @@ -529,4 +546,50 @@ export class cNew {}`); fs.makeReadonly(); return fs; } + + function loadOutputProjectFromDisk(project: string): vfs.FileSystem { + const resolver = vfs.createResolver(Harness.IO); + const fs = new vfs.FileSystem(/*ignoreCase*/ true, { + files: { + ["/src"]: new vfs.Mount(vpath.resolve(Harness.IO.getWorkspaceRoot(), `tests/baselines/reference/projects/${project}`), resolver) + }, + cwd: "/", + time, + }); + fs.makeReadonly(); + return fs; + } + + function verifyOutputs(buildFs: vfs.FileSystem, expectedOutputProject: string) { + const fs = loadOutputProjectFromDisk(expectedOutputProject); + verifyOutputsFs(buildFs, fs, "/src"); + } + + function verifyOutputsFs(buildFs: vfs.FileSystem, expectedOutputFs: vfs.FileSystem, directory: string) { + withOutputFs(expectedOutputFs, directory, outputFile => { + const actual = buildFs.readFileSync(outputFile, "utf8"); + const expected = expectedOutputFs.readFileSync(outputFile, "utf8"); + assert.equal(actual, expected, `File contents of ${outputFile} expected to be: +actual: ${actual} +expected: ${expected}`); + }); + } + + function verifyOutputsNotExistOnFs(buildFs: vfs.FileSystem, expectedOutputFs: vfs.FileSystem, directory: string) { + withOutputFs(expectedOutputFs, directory, outputFile => + assert(!buildFs.existsSync(outputFile), `Expect file ${outputFile} to not exist`)); + } + + function withOutputFs(expectedOutputFs: vfs.FileSystem, directory: string, actionOnFile: (outputFile: string) => void) { + const children = expectedOutputFs.readdirSync(directory); + for (const child of children) { + const fullName = `${directory}/${child}`; + if (expectedOutputFs.statSync(fullName).isFile()) { + actionOnFile(fullName); + } + else { + withOutputFs(expectedOutputFs, fullName, actionOnFile); + } + } + } } diff --git a/src/testRunner/unittests/tsbuildWatchMode.ts b/src/testRunner/unittests/tsbuildWatchMode.ts index f0745a373a023..2ffe51189d86a 100644 --- a/src/testRunner/unittests/tsbuildWatchMode.ts +++ b/src/testRunner/unittests/tsbuildWatchMode.ts @@ -486,11 +486,7 @@ export function gfoo() { solutionBuilder.buildInvalidatedProject(); host.checkTimeoutQueueLengthAndRun(1); - checkOutputErrorsIncremental(host, [ - // TODO: #26036 - // The error is reported in d.ts file because it isnt resolved from ts file path, but is resolved from .d.ts file - "sample1/logic/decls/index.d.ts(2,22): error TS2307: Cannot find module '../core/anotherModule'.\n" - ]); + checkOutputErrorsIncremental(host, emptyArray); checkProgramActualFiles(watch().getProgram(), [tests[1].path, libFile.path, coreIndexDts, coreAnotherModuleDts, projectFilePath(SubProject.logic, "decls/index.d.ts")]); }); }); diff --git a/tests/baselines/reference/projects/sample1/core/anotherModule.d.ts b/tests/baselines/reference/projects/sample1/core/anotherModule.d.ts new file mode 100644 index 0000000000000..e1ec3b8a29727 --- /dev/null +++ b/tests/baselines/reference/projects/sample1/core/anotherModule.d.ts @@ -0,0 +1,2 @@ +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map \ No newline at end of file diff --git a/tests/baselines/reference/projects/sample1/core/anotherModule.d.ts.map b/tests/baselines/reference/projects/sample1/core/anotherModule.d.ts.map new file mode 100644 index 0000000000000..a38c4e2d4e132 --- /dev/null +++ b/tests/baselines/reference/projects/sample1/core/anotherModule.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/projects/sample1/core/anotherModule.js b/tests/baselines/reference/projects/sample1/core/anotherModule.js new file mode 100644 index 0000000000000..45ee93feef700 --- /dev/null +++ b/tests/baselines/reference/projects/sample1/core/anotherModule.js @@ -0,0 +1,3 @@ +"use strict"; +exports.__esModule = true; +exports.World = "hello"; diff --git a/tests/baselines/reference/projects/sample1/core/index.d.ts b/tests/baselines/reference/projects/sample1/core/index.d.ts new file mode 100644 index 0000000000000..de0ac08cd4480 --- /dev/null +++ b/tests/baselines/reference/projects/sample1/core/index.d.ts @@ -0,0 +1,4 @@ +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tests/baselines/reference/projects/sample1/core/index.d.ts.map b/tests/baselines/reference/projects/sample1/core/index.d.ts.map new file mode 100644 index 0000000000000..d697036103cd3 --- /dev/null +++ b/tests/baselines/reference/projects/sample1/core/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} \ No newline at end of file diff --git a/tests/baselines/reference/projects/sample1/core/index.js b/tests/baselines/reference/projects/sample1/core/index.js new file mode 100644 index 0000000000000..0487b226026fe --- /dev/null +++ b/tests/baselines/reference/projects/sample1/core/index.js @@ -0,0 +1,7 @@ +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; diff --git a/tests/baselines/reference/projects/sample1/logic/index.d.ts b/tests/baselines/reference/projects/sample1/logic/index.d.ts new file mode 100644 index 0000000000000..cbb6b701ca36f --- /dev/null +++ b/tests/baselines/reference/projects/sample1/logic/index.d.ts @@ -0,0 +1,3 @@ +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; diff --git a/tests/baselines/reference/projects/sample1/logic/index.js b/tests/baselines/reference/projects/sample1/logic/index.js new file mode 100644 index 0000000000000..d3bee3b2ed1e1 --- /dev/null +++ b/tests/baselines/reference/projects/sample1/logic/index.js @@ -0,0 +1,10 @@ +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tests/baselines/reference/projects/sample1/logic/index.js.map b/tests/baselines/reference/projects/sample1/logic/index.js.map new file mode 100644 index 0000000000000..5184eb9408bc3 --- /dev/null +++ b/tests/baselines/reference/projects/sample1/logic/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/projects/sample1/tests/index.d.ts b/tests/baselines/reference/projects/sample1/tests/index.d.ts new file mode 100644 index 0000000000000..8c17a434e8a59 --- /dev/null +++ b/tests/baselines/reference/projects/sample1/tests/index.d.ts @@ -0,0 +1,2 @@ +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; diff --git a/tests/baselines/reference/projects/sample1/tests/index.js b/tests/baselines/reference/projects/sample1/tests/index.js new file mode 100644 index 0000000000000..ab35590f144b6 --- /dev/null +++ b/tests/baselines/reference/projects/sample1/tests/index.js @@ -0,0 +1,8 @@ +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; diff --git a/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/anotherModule.d.ts b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/anotherModule.d.ts new file mode 100644 index 0000000000000..e1ec3b8a29727 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/anotherModule.d.ts @@ -0,0 +1,2 @@ +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map \ No newline at end of file diff --git a/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/anotherModule.d.ts.map b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/anotherModule.d.ts.map new file mode 100644 index 0000000000000..a38c4e2d4e132 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/anotherModule.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/anotherModule.js b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/anotherModule.js new file mode 100644 index 0000000000000..45ee93feef700 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/anotherModule.js @@ -0,0 +1,3 @@ +"use strict"; +exports.__esModule = true; +exports.World = "hello"; diff --git a/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/index.d.ts b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/index.d.ts new file mode 100644 index 0000000000000..de0ac08cd4480 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/index.d.ts @@ -0,0 +1,4 @@ +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/index.d.ts.map b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/index.d.ts.map new file mode 100644 index 0000000000000..d697036103cd3 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} \ No newline at end of file diff --git a/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/index.js b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/index.js new file mode 100644 index 0000000000000..0487b226026fe --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/core/index.js @@ -0,0 +1,7 @@ +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; diff --git a/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/logic/index.js b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/logic/index.js new file mode 100644 index 0000000000000..0cada8039fddf --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/logic/index.js @@ -0,0 +1,9 @@ +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; diff --git a/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/logic/out/decls/index.d.ts b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/logic/out/decls/index.d.ts new file mode 100644 index 0000000000000..18a34aaa2fc39 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/logic/out/decls/index.d.ts @@ -0,0 +1,3 @@ +export declare function getSecondsInDay(): number; +import * as mod from "../../../core/anotherModule"; +export declare const m: typeof mod; diff --git a/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/tests/index.d.ts b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/tests/index.d.ts new file mode 100644 index 0000000000000..8c17a434e8a59 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/tests/index.d.ts @@ -0,0 +1,2 @@ +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; diff --git a/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/tests/index.js b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/tests/index.js new file mode 100644 index 0000000000000..ab35590f144b6 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicDeclarationDir/tests/index.js @@ -0,0 +1,8 @@ +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; diff --git a/tests/baselines/reference/projects/sample1WithLogicOutDir/core/anotherModule.d.ts b/tests/baselines/reference/projects/sample1WithLogicOutDir/core/anotherModule.d.ts new file mode 100644 index 0000000000000..e1ec3b8a29727 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicOutDir/core/anotherModule.d.ts @@ -0,0 +1,2 @@ +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map \ No newline at end of file diff --git a/tests/baselines/reference/projects/sample1WithLogicOutDir/core/anotherModule.d.ts.map b/tests/baselines/reference/projects/sample1WithLogicOutDir/core/anotherModule.d.ts.map new file mode 100644 index 0000000000000..a38c4e2d4e132 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicOutDir/core/anotherModule.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/projects/sample1WithLogicOutDir/core/anotherModule.js b/tests/baselines/reference/projects/sample1WithLogicOutDir/core/anotherModule.js new file mode 100644 index 0000000000000..45ee93feef700 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicOutDir/core/anotherModule.js @@ -0,0 +1,3 @@ +"use strict"; +exports.__esModule = true; +exports.World = "hello"; diff --git a/tests/baselines/reference/projects/sample1WithLogicOutDir/core/index.d.ts b/tests/baselines/reference/projects/sample1WithLogicOutDir/core/index.d.ts new file mode 100644 index 0000000000000..de0ac08cd4480 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicOutDir/core/index.d.ts @@ -0,0 +1,4 @@ +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tests/baselines/reference/projects/sample1WithLogicOutDir/core/index.d.ts.map b/tests/baselines/reference/projects/sample1WithLogicOutDir/core/index.d.ts.map new file mode 100644 index 0000000000000..d697036103cd3 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicOutDir/core/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} \ No newline at end of file diff --git a/tests/baselines/reference/projects/sample1WithLogicOutDir/core/index.js b/tests/baselines/reference/projects/sample1WithLogicOutDir/core/index.js new file mode 100644 index 0000000000000..0487b226026fe --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicOutDir/core/index.js @@ -0,0 +1,7 @@ +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; diff --git a/tests/baselines/reference/projects/sample1WithLogicOutDir/logic/outDir/index.d.ts b/tests/baselines/reference/projects/sample1WithLogicOutDir/logic/outDir/index.d.ts new file mode 100644 index 0000000000000..8b8a2684b71a7 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicOutDir/logic/outDir/index.d.ts @@ -0,0 +1,3 @@ +export declare function getSecondsInDay(): number; +import * as mod from "../../core/anotherModule"; +export declare const m: typeof mod; diff --git a/tests/baselines/reference/projects/sample1WithLogicOutDir/logic/outDir/index.js b/tests/baselines/reference/projects/sample1WithLogicOutDir/logic/outDir/index.js new file mode 100644 index 0000000000000..0cada8039fddf --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicOutDir/logic/outDir/index.js @@ -0,0 +1,9 @@ +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; diff --git a/tests/baselines/reference/projects/sample1WithLogicOutDir/tests/index.d.ts b/tests/baselines/reference/projects/sample1WithLogicOutDir/tests/index.d.ts new file mode 100644 index 0000000000000..8c17a434e8a59 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicOutDir/tests/index.d.ts @@ -0,0 +1,2 @@ +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; diff --git a/tests/baselines/reference/projects/sample1WithLogicOutDir/tests/index.js b/tests/baselines/reference/projects/sample1WithLogicOutDir/tests/index.js new file mode 100644 index 0000000000000..ab35590f144b6 --- /dev/null +++ b/tests/baselines/reference/projects/sample1WithLogicOutDir/tests/index.js @@ -0,0 +1,8 @@ +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod;