Merge pull request #30721 from Microsoft/amdOut

Do not create multiple sourceFile to single outputFile with project redirect as the output file is included by default
This commit is contained in:
Sheetal Nandi
2019-04-03 10:39:28 -07:00
committed by GitHub
8 changed files with 684 additions and 27 deletions

View File

@@ -2266,8 +2266,13 @@ namespace ts {
let redirectedPath: Path | undefined;
if (refFile) {
const redirect = getProjectReferenceRedirect(fileName);
if (redirect) {
const redirectProject = getProjectReferenceRedirectProject(fileName);
if (redirectProject) {
if (redirectProject.commandLine.options.outFile || redirectProject.commandLine.options.out) {
// Shouldnt create many to 1 mapping file in --out scenario
return undefined;
}
const redirect = getProjectReferenceOutputName(redirectProject, fileName);
fileName = redirect;
// Once we start redirecting to a file, we can potentially come back to it
// via a back-reference from another file in the .d.ts folder. If that happens we'll
@@ -2364,6 +2369,11 @@ namespace ts {
}
function getProjectReferenceRedirect(fileName: string): string | undefined {
const referencedProject = getProjectReferenceRedirectProject(fileName);
return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
}
function getProjectReferenceRedirectProject(fileName: string) {
// Ignore dts or any of the non ts files
if (!resolvedProjectReferences || !resolvedProjectReferences.length || fileExtensionIs(fileName, Extension.Dts) || !fileExtensionIsOneOf(fileName, supportedTSExtensions)) {
return undefined;
@@ -2371,10 +2381,11 @@ namespace ts {
// If this file is produced by a referenced project, we need to rewrite it to
// look in the output folder of the referenced project rather than the input
const referencedProject = getResolvedProjectReferenceToRedirect(fileName);
if (!referencedProject) {
return undefined;
}
return getResolvedProjectReferenceToRedirect(fileName);
}
function getProjectReferenceOutputName(referencedProject: ResolvedProjectReference, fileName: string) {
const out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out;
return out ?
changeExtension(out, Extension.Dts) :

View File

@@ -394,7 +394,7 @@ namespace ts {
const projectStatus = createFileMap<UpToDateStatus>(toPath);
const missingRoots = createMap<true>();
let globalDependencyGraph: DependencyGraph | undefined;
const writeFileName = (s: string) => host.trace && host.trace(s);
const writeFileName = host.trace ? (s: string) => host.trace!(s) : undefined;
let readFileWithCache = (f: string) => host.readFile(f);
let projectCompilerOptions = baseCompilerOptions;
const compilerHost = createCompilerHostFromProgramHost(host, () => projectCompilerOptions);
@@ -1129,7 +1129,7 @@ namespace ts {
let declDiagnostics: Diagnostic[] | undefined;
const reportDeclarationDiagnostics = (d: Diagnostic) => (declDiagnostics || (declDiagnostics = [])).push(d);
const outputFiles: OutputFile[] = [];
emitFilesAndReportErrors(program, reportDeclarationDiagnostics, writeFileName, /*reportSummary*/ undefined, (name, text, writeByteOrderMark) => outputFiles.push({ name, text, writeByteOrderMark }));
emitFilesAndReportErrors(program, reportDeclarationDiagnostics, /*writeFileName*/ undefined, /*reportSummary*/ undefined, (name, text, writeByteOrderMark) => outputFiles.push({ name, text, writeByteOrderMark }));
// Don't emit .d.ts if there are decl file errors
if (declDiagnostics) {
program.restoreState();
@@ -1138,7 +1138,7 @@ namespace ts {
// Actual Emit
const emitterDiagnostics = createDiagnosticCollection();
const emittedOutputs = createFileMap<true>(toPath as ToPath);
const emittedOutputs = createFileMap<string>(toPath as ToPath);
outputFiles.forEach(({ name, text, writeByteOrderMark }) => {
let priorChangeTime: Date | undefined;
if (!anyDtsChanged && isDeclarationFile(name)) {
@@ -1152,7 +1152,7 @@ namespace ts {
}
}
emittedOutputs.setValue(name, true);
emittedOutputs.setValue(name, name);
writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
if (priorChangeTime !== undefined) {
newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
@@ -1165,6 +1165,11 @@ namespace ts {
return buildErrors(emitDiagnostics, BuildResultFlags.EmitErrors, "Emit");
}
if (writeFileName) {
emittedOutputs.forEach(name => listEmittedFile(configFile, name));
listFiles(program, writeFileName);
}
// Update time stamps for rest of the outputs
newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(configFile, newestDeclarationFileContentChangedTime, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
@@ -1182,6 +1187,8 @@ namespace ts {
function buildErrors(diagnostics: ReadonlyArray<Diagnostic>, errorFlags: BuildResultFlags, errorType: string) {
resultFlags |= errorFlags;
reportAndStoreErrors(proj, diagnostics);
// List files if any other build error using program (emit errors already report files)
if (writeFileName) listFiles(program, writeFileName);
projectStatus.setValue(proj, { type: UpToDateStatusType.Unbuildable, reason: `${errorType} errors` });
afterProgramCreate(proj, program);
projectCompilerOptions = baseCompilerOptions;
@@ -1189,6 +1196,12 @@ namespace ts {
}
}
function listEmittedFile(proj: ParsedCommandLine, file: string) {
if (writeFileName && proj.options.listEmittedFiles) {
writeFileName(`TSFILE: ${file}`);
}
}
function afterProgramCreate(proj: ResolvedConfigFileName, program: T) {
if (host.afterProgramEmitAndDiagnostics) {
host.afterProgramEmitAndDiagnostics(program);
@@ -1229,9 +1242,9 @@ namespace ts {
// Actual Emit
Debug.assert(!!outputFiles.length);
const emitterDiagnostics = createDiagnosticCollection();
const emittedOutputs = createFileMap<true>(toPath as ToPath);
const emittedOutputs = createFileMap<string>(toPath as ToPath);
outputFiles.forEach(({ name, text, writeByteOrderMark }) => {
emittedOutputs.setValue(name, true);
emittedOutputs.setValue(name, name);
writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
});
const emitDiagnostics = emitterDiagnostics.getDiagnostics();
@@ -1242,6 +1255,10 @@ namespace ts {
return BuildResultFlags.DeclarationOutputUnchanged | BuildResultFlags.EmitErrors;
}
if (writeFileName) {
emittedOutputs.forEach(name => listEmittedFile(config, name));
}
// Update timestamps for dts
const newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(config, minimumDate, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
@@ -1270,7 +1287,7 @@ namespace ts {
projectStatus.setValue(proj.options.configFilePath as ResolvedConfigFilePath, status);
}
function updateOutputTimestampsWorker(proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: FileMap<true>) {
function updateOutputTimestampsWorker(proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: FileMap<string>) {
const outputs = getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
if (!skipOutputs || outputs.length !== skipOutputs.getSize()) {
if (options.verbose) {
@@ -1287,9 +1304,7 @@ namespace ts {
}
host.setModifiedTime(file, now);
if (proj.options.listEmittedFiles) {
writeFileName(`TSFILE: ${file}`);
}
listEmittedFile(proj, file);
}
}

View File

@@ -121,6 +121,14 @@ namespace ts {
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
}
export function listFiles(program: ProgramToEmitFilesAndReportErrors, writeFileName: (s: string) => void) {
if (program.getCompilerOptions().listFiles) {
forEach(program.getSourceFiles(), file => {
writeFileName(file.fileName);
});
}
}
/**
* Helper that emit files, report diagnostics and lists emitted and/or source files depending on compiler options
*/
@@ -152,12 +160,7 @@ namespace ts {
const filepath = getNormalizedAbsolutePath(file, currentDir);
writeFileName(`TSFILE: ${filepath}`);
});
if (program.getCompilerOptions().listFiles) {
forEach(program.getSourceFiles(), file => {
writeFileName(file.fileName);
});
}
listFiles(program, writeFileName);
}
if (reportSummary) {

View File

@@ -198,6 +198,58 @@ ${internal} export enum internalEnum { a, b, c }`);
modifyAgainFs: fs => replaceText(fs, sources[project.lib][source.ts][1], `export const`, `/*@internal*/ export const`),
});
});
describe("when the module resolution finds original source file", () => {
function modifyFs(fs: vfs.FileSystem) {
// Make lib to output to parent dir
replaceText(fs, sources[project.lib][source.config], `"outFile": "module.js"`, `"outFile": "../module.js", "rootDir": "../"`);
// Change reference to file1 module to resolve to lib/file1
replaceText(fs, sources[project.app][source.ts][0], "file1", "lib/file1");
}
const libOutputFile: OutputFile = [
"/src/lib/module.js",
"/src/lib/module.js.map",
"/src/lib/module.d.ts",
"/src/lib/module.d.ts.map",
"/src/lib/module.tsbuildinfo"
];
verifyTsbuildOutput({
scenario: "when the module resolution finds original source file",
projFs: () => outFileFs,
time,
tick,
proj: "amdModulesWithOut",
rootNames: ["/src/app"],
expectedMapFileNames: [
libOutputFile[ext.jsmap],
libOutputFile[ext.dtsmap],
outputFiles[project.app][ext.jsmap],
outputFiles[project.app][ext.dtsmap],
],
expectedBuildInfoFilesForSectionBaselines: [
[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],
initialBuild: {
modifyFs,
expectedDiagnostics: [
getExpectedDiagnosticForProjectsInBuild("src/lib/tsconfig.json", "src/app/tsconfig.json"),
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/lib/tsconfig.json", "src/module.js"],
[Diagnostics.Building_project_0, sources[project.lib][source.config]],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/app/tsconfig.json", "src/app/module.js"],
[Diagnostics.Building_project_0, sources[project.app][source.config]],
]
},
outputFiles: [
...libOutputFile,
...outputFiles[project.app]
],
baselineOnly: true,
verifyDiagnostics: true
});
});
});
});
}

View File

@@ -234,10 +234,11 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt
incrementalDtsUnchangedBuild?: BuildState;
incrementalHeaderChangedBuild?: BuildState;
baselineOnly?: true;
verifyDiagnostics?: true;
}
export function verifyTsbuildOutput({
scenario, projFs, time, tick, proj, rootNames, outputFiles, baselineOnly,
scenario, projFs, time, tick, proj, rootNames, outputFiles, baselineOnly, verifyDiagnostics,
expectedMapFileNames, expectedBuildInfoFilesForSectionBaselines, lastProjectOutputJs,
initialBuild, incrementalDtsChangedBuild, incrementalDtsUnchangedBuild, incrementalHeaderChangedBuild
}: VerifyTsBuildInput) {
@@ -264,7 +265,7 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt
host = undefined!;
});
describe("initialBuild", () => {
if (!baselineOnly) {
if (!baselineOnly || verifyDiagnostics) {
it(`verify diagnostics`, () => {
host.assertDiagnosticMessages(...(initialBuild.expectedDiagnostics || emptyArray));
});

View File

@@ -427,14 +427,14 @@ export class cNew {}`);
builder.buildAllProjects();
assert.deepEqual(host.traces, [
"TSFILE: /src/core/anotherModule.js",
"TSFILE: /src/core/anotherModule.d.ts",
"TSFILE: /src/core/anotherModule.d.ts.map",
"TSFILE: /src/core/anotherModule.d.ts",
"TSFILE: /src/core/index.js",
"TSFILE: /src/core/index.d.ts",
"TSFILE: /src/core/index.d.ts.map",
"TSFILE: /src/core/index.d.ts",
"TSFILE: /src/core/tsconfig.tsbuildinfo",
"TSFILE: /src/logic/index.js",
"TSFILE: /src/logic/index.js.map",
"TSFILE: /src/logic/index.js",
"TSFILE: /src/logic/index.d.ts",
"TSFILE: /src/logic/tsconfig.tsbuildinfo",
"TSFILE: /src/tests/index.js",

View File

@@ -65,6 +65,8 @@ export const b = new A();`);
const expectedFileTraces = [
...getLibs(),
"/src/a.ts",
...getLibs(),
"/src/b.ts"
];
verifyBuild(fs => modifyFsBTsToNonRelativeImport(fs, "node"),
allExpectedOutputs,

View File

@@ -0,0 +1,573 @@
//// [/src/app/file3.ts]
export const z = 30;
import { x } from "lib/file1";
//// [/src/app/module.d.ts]
declare const myGlob = 20;
declare module "lib/file1" {
export const x = 10;
}
declare module "lib/file2" {
export const y = 20;
}
declare const globalConst = 10;
declare module "file3" {
export const z = 30;
}
declare const myVar = 30;
//# sourceMappingURL=module.d.ts.map
//// [/src/app/module.d.ts.map]
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../lib/file0.ts","../lib/file1.ts","../lib/file2.ts","../lib/global.ts","file3.ts","file4.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,KAAK,CAAC;;ICAlB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;;ICApB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,WAAW,KAAK,CAAC;;ICAvB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,KAAK,KAAK,CAAC"}
//// [/src/app/module.d.ts.map.baseline.txt]
===================================================================
JsFile: module.d.ts
mapUrl: module.d.ts.map
sourceRoot:
sources: ../lib/file0.ts,../lib/file1.ts,../lib/file2.ts,../lib/global.ts,file3.ts,file4.ts
===================================================================
-------------------------------------------------------------------
emittedFile:/src/app/module.d.ts
sourceFile:../lib/file0.ts
-------------------------------------------------------------------
>>>declare const myGlob = 20;
1 >
2 >^^^^^^^^
3 > ^^^^^^
4 > ^^^^^^
5 > ^^^^^
6 > ^
7 > ^^^->
1 >
2 >
3 > const
4 > myGlob
5 > = 20
6 > ;
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 9) Source(1, 1) + SourceIndex(0)
3 >Emitted(1, 15) Source(1, 7) + SourceIndex(0)
4 >Emitted(1, 21) Source(1, 13) + SourceIndex(0)
5 >Emitted(1, 26) Source(1, 18) + SourceIndex(0)
6 >Emitted(1, 27) Source(1, 19) + SourceIndex(0)
---
-------------------------------------------------------------------
emittedFile:/src/app/module.d.ts
sourceFile:../lib/file1.ts
-------------------------------------------------------------------
>>>declare module "lib/file1" {
>>> export const x = 10;
1->^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^
5 > ^
6 > ^^^^^
7 > ^
1->
2 > export
3 >
4 > const
5 > x
6 > = 10
7 > ;
1->Emitted(3, 5) Source(1, 1) + SourceIndex(1)
2 >Emitted(3, 11) Source(1, 7) + SourceIndex(1)
3 >Emitted(3, 12) Source(1, 8) + SourceIndex(1)
4 >Emitted(3, 18) Source(1, 14) + SourceIndex(1)
5 >Emitted(3, 19) Source(1, 15) + SourceIndex(1)
6 >Emitted(3, 24) Source(1, 20) + SourceIndex(1)
7 >Emitted(3, 25) Source(1, 21) + SourceIndex(1)
---
-------------------------------------------------------------------
emittedFile:/src/app/module.d.ts
sourceFile:../lib/file2.ts
-------------------------------------------------------------------
>>>}
>>>declare module "lib/file2" {
>>> export const y = 20;
1 >^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^
5 > ^
6 > ^^^^^
7 > ^
1 >
2 > export
3 >
4 > const
5 > y
6 > = 20
7 > ;
1 >Emitted(6, 5) Source(1, 1) + SourceIndex(2)
2 >Emitted(6, 11) Source(1, 7) + SourceIndex(2)
3 >Emitted(6, 12) Source(1, 8) + SourceIndex(2)
4 >Emitted(6, 18) Source(1, 14) + SourceIndex(2)
5 >Emitted(6, 19) Source(1, 15) + SourceIndex(2)
6 >Emitted(6, 24) Source(1, 20) + SourceIndex(2)
7 >Emitted(6, 25) Source(1, 21) + SourceIndex(2)
---
-------------------------------------------------------------------
emittedFile:/src/app/module.d.ts
sourceFile:../lib/global.ts
-------------------------------------------------------------------
>>>}
>>>declare const globalConst = 10;
1 >
2 >^^^^^^^^
3 > ^^^^^^
4 > ^^^^^^^^^^^
5 > ^^^^^
6 > ^
1 >
2 >
3 > const
4 > globalConst
5 > = 10
6 > ;
1 >Emitted(8, 1) Source(1, 1) + SourceIndex(3)
2 >Emitted(8, 9) Source(1, 1) + SourceIndex(3)
3 >Emitted(8, 15) Source(1, 7) + SourceIndex(3)
4 >Emitted(8, 26) Source(1, 18) + SourceIndex(3)
5 >Emitted(8, 31) Source(1, 23) + SourceIndex(3)
6 >Emitted(8, 32) Source(1, 24) + SourceIndex(3)
---
-------------------------------------------------------------------
emittedFile:/src/app/module.d.ts
sourceFile:file3.ts
-------------------------------------------------------------------
>>>declare module "file3" {
>>> export const z = 30;
1 >^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^
5 > ^
6 > ^^^^^
7 > ^
1 >
2 > export
3 >
4 > const
5 > z
6 > = 30
7 > ;
1 >Emitted(10, 5) Source(1, 1) + SourceIndex(4)
2 >Emitted(10, 11) Source(1, 7) + SourceIndex(4)
3 >Emitted(10, 12) Source(1, 8) + SourceIndex(4)
4 >Emitted(10, 18) Source(1, 14) + SourceIndex(4)
5 >Emitted(10, 19) Source(1, 15) + SourceIndex(4)
6 >Emitted(10, 24) Source(1, 20) + SourceIndex(4)
7 >Emitted(10, 25) Source(1, 21) + SourceIndex(4)
---
-------------------------------------------------------------------
emittedFile:/src/app/module.d.ts
sourceFile:file4.ts
-------------------------------------------------------------------
>>>}
>>>declare const myVar = 30;
1 >
2 >^^^^^^^^
3 > ^^^^^^
4 > ^^^^^
5 > ^^^^^
6 > ^
7 > ^^^^^^^^^^->
1 >
2 >
3 > const
4 > myVar
5 > = 30
6 > ;
1 >Emitted(12, 1) Source(1, 1) + SourceIndex(5)
2 >Emitted(12, 9) Source(1, 1) + SourceIndex(5)
3 >Emitted(12, 15) Source(1, 7) + SourceIndex(5)
4 >Emitted(12, 20) Source(1, 12) + SourceIndex(5)
5 >Emitted(12, 25) Source(1, 17) + SourceIndex(5)
6 >Emitted(12, 26) Source(1, 18) + SourceIndex(5)
---
>>>//# sourceMappingURL=module.d.ts.map
//// [/src/app/module.js]
var myGlob = 20;
define("lib/file1", ["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.x = 10;
});
define("lib/file2", ["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.y = 20;
});
var globalConst = 10;
define("file3", ["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.z = 30;
});
var myVar = 30;
//# sourceMappingURL=module.js.map
//// [/src/app/module.js.map]
{"version":3,"file":"module.js","sourceRoot":"","sources":["../lib/file0.ts","../lib/file1.ts","../lib/file2.ts","../lib/global.ts","file3.ts","file4.ts"],"names":[],"mappings":"AAAA,IAAM,MAAM,GAAG,EAAE,CAAC;;;;ICAL,QAAA,CAAC,GAAG,EAAE,CAAC;;;;;ICAP,QAAA,CAAC,GAAG,EAAE,CAAC;;ACApB,IAAM,WAAW,GAAG,EAAE,CAAC;;;;ICAV,QAAA,CAAC,GAAG,EAAE,CAAC;;ACApB,IAAM,KAAK,GAAG,EAAE,CAAC"}
//// [/src/app/module.js.map.baseline.txt]
===================================================================
JsFile: module.js
mapUrl: module.js.map
sourceRoot:
sources: ../lib/file0.ts,../lib/file1.ts,../lib/file2.ts,../lib/global.ts,file3.ts,file4.ts
===================================================================
-------------------------------------------------------------------
emittedFile:/src/app/module.js
sourceFile:../lib/file0.ts
-------------------------------------------------------------------
>>>var myGlob = 20;
1 >
2 >^^^^
3 > ^^^^^^
4 > ^^^
5 > ^^
6 > ^
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >const
3 > myGlob
4 > =
5 > 20
6 > ;
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 5) Source(1, 7) + SourceIndex(0)
3 >Emitted(1, 11) Source(1, 13) + SourceIndex(0)
4 >Emitted(1, 14) Source(1, 16) + SourceIndex(0)
5 >Emitted(1, 16) Source(1, 18) + SourceIndex(0)
6 >Emitted(1, 17) Source(1, 19) + SourceIndex(0)
---
-------------------------------------------------------------------
emittedFile:/src/app/module.js
sourceFile:../lib/file1.ts
-------------------------------------------------------------------
>>>define("lib/file1", ["require", "exports"], function (require, exports) {
>>> "use strict";
>>> Object.defineProperty(exports, "__esModule", { value: true });
>>> exports.x = 10;
1->^^^^
2 > ^^^^^^^^
3 > ^
4 > ^^^
5 > ^^
6 > ^
1->export const
2 >
3 > x
4 > =
5 > 10
6 > ;
1->Emitted(5, 5) Source(1, 14) + SourceIndex(1)
2 >Emitted(5, 13) Source(1, 14) + SourceIndex(1)
3 >Emitted(5, 14) Source(1, 15) + SourceIndex(1)
4 >Emitted(5, 17) Source(1, 18) + SourceIndex(1)
5 >Emitted(5, 19) Source(1, 20) + SourceIndex(1)
6 >Emitted(5, 20) Source(1, 21) + SourceIndex(1)
---
-------------------------------------------------------------------
emittedFile:/src/app/module.js
sourceFile:../lib/file2.ts
-------------------------------------------------------------------
>>>});
>>>define("lib/file2", ["require", "exports"], function (require, exports) {
>>> "use strict";
>>> Object.defineProperty(exports, "__esModule", { value: true });
>>> exports.y = 20;
1 >^^^^
2 > ^^^^^^^^
3 > ^
4 > ^^^
5 > ^^
6 > ^
1 >export const
2 >
3 > y
4 > =
5 > 20
6 > ;
1 >Emitted(10, 5) Source(1, 14) + SourceIndex(2)
2 >Emitted(10, 13) Source(1, 14) + SourceIndex(2)
3 >Emitted(10, 14) Source(1, 15) + SourceIndex(2)
4 >Emitted(10, 17) Source(1, 18) + SourceIndex(2)
5 >Emitted(10, 19) Source(1, 20) + SourceIndex(2)
6 >Emitted(10, 20) Source(1, 21) + SourceIndex(2)
---
-------------------------------------------------------------------
emittedFile:/src/app/module.js
sourceFile:../lib/global.ts
-------------------------------------------------------------------
>>>});
>>>var globalConst = 10;
1 >
2 >^^^^
3 > ^^^^^^^^^^^
4 > ^^^
5 > ^^
6 > ^
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >const
3 > globalConst
4 > =
5 > 10
6 > ;
1 >Emitted(12, 1) Source(1, 1) + SourceIndex(3)
2 >Emitted(12, 5) Source(1, 7) + SourceIndex(3)
3 >Emitted(12, 16) Source(1, 18) + SourceIndex(3)
4 >Emitted(12, 19) Source(1, 21) + SourceIndex(3)
5 >Emitted(12, 21) Source(1, 23) + SourceIndex(3)
6 >Emitted(12, 22) Source(1, 24) + SourceIndex(3)
---
-------------------------------------------------------------------
emittedFile:/src/app/module.js
sourceFile:file3.ts
-------------------------------------------------------------------
>>>define("file3", ["require", "exports"], function (require, exports) {
>>> "use strict";
>>> Object.defineProperty(exports, "__esModule", { value: true });
>>> exports.z = 30;
1->^^^^
2 > ^^^^^^^^
3 > ^
4 > ^^^
5 > ^^
6 > ^
1->export const
2 >
3 > z
4 > =
5 > 30
6 > ;
1->Emitted(16, 5) Source(1, 14) + SourceIndex(4)
2 >Emitted(16, 13) Source(1, 14) + SourceIndex(4)
3 >Emitted(16, 14) Source(1, 15) + SourceIndex(4)
4 >Emitted(16, 17) Source(1, 18) + SourceIndex(4)
5 >Emitted(16, 19) Source(1, 20) + SourceIndex(4)
6 >Emitted(16, 20) Source(1, 21) + SourceIndex(4)
---
-------------------------------------------------------------------
emittedFile:/src/app/module.js
sourceFile:file4.ts
-------------------------------------------------------------------
>>>});
>>>var myVar = 30;
1 >
2 >^^^^
3 > ^^^^^
4 > ^^^
5 > ^^
6 > ^
7 > ^^^^^^^^^^^^^^^^^^->
1 >
2 >const
3 > myVar
4 > =
5 > 30
6 > ;
1 >Emitted(18, 1) Source(1, 1) + SourceIndex(5)
2 >Emitted(18, 5) Source(1, 7) + SourceIndex(5)
3 >Emitted(18, 10) Source(1, 12) + SourceIndex(5)
4 >Emitted(18, 13) Source(1, 15) + SourceIndex(5)
5 >Emitted(18, 15) Source(1, 17) + SourceIndex(5)
6 >Emitted(18, 16) Source(1, 18) + SourceIndex(5)
---
>>>//# sourceMappingURL=module.js.map
//// [/src/app/module.tsbuildinfo]
{
"bundle": {
"commonSourceDirectory": "/src/app/",
"sourceFiles": [
"/src/app/file3.ts",
"/src/app/file4.ts"
],
"js": {
"sections": [
{
"pos": 0,
"end": 417,
"kind": "prepend",
"data": "/src/module.js",
"texts": [
{
"pos": 0,
"end": 417,
"kind": "text"
}
]
},
{
"pos": 417,
"end": 618,
"kind": "text"
}
]
},
"dts": {
"sections": [
{
"pos": 0,
"end": 179,
"kind": "prepend",
"data": "/src/module.d.ts",
"texts": [
{
"pos": 0,
"end": 179,
"kind": "text"
}
]
},
{
"pos": 179,
"end": 261,
"kind": "text"
}
]
}
},
"version": "FakeTSVersion"
}
//// [/src/app/module.tsbuildinfo.baseline.txt]
======================================================================
File:: /src/app/module.js
----------------------------------------------------------------------
prepend: (0-417):: /src/module.js texts:: 1
>>--------------------------------------------------------------------
text: (0-417)
var myGlob = 20;
define("lib/file1", ["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.x = 10;
});
define("lib/file2", ["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.y = 20;
});
var globalConst = 10;
----------------------------------------------------------------------
text: (417-618)
define("file3", ["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.z = 30;
});
var myVar = 30;
======================================================================
======================================================================
File:: /src/app/module.d.ts
----------------------------------------------------------------------
prepend: (0-179):: /src/module.d.ts texts:: 1
>>--------------------------------------------------------------------
text: (0-179)
declare const myGlob = 20;
declare module "lib/file1" {
export const x = 10;
}
declare module "lib/file2" {
export const y = 20;
}
declare const globalConst = 10;
----------------------------------------------------------------------
text: (179-261)
declare module "file3" {
export const z = 30;
}
declare const myVar = 30;
======================================================================
//// [/src/lib/tsconfig.json]
{
"compilerOptions": {
"target": "es5",
"module": "amd",
"composite": true,
"sourceMap": true,
"declarationMap": true,
"strict": false,
"outFile": "../module.js", "rootDir": "../"
},
"exclude": ["module.d.ts"]
}
//// [/src/module.d.ts]
declare const myGlob = 20;
declare module "lib/file1" {
export const x = 10;
}
declare module "lib/file2" {
export const y = 20;
}
declare const globalConst = 10;
//# sourceMappingURL=module.d.ts.map
//// [/src/module.d.ts.map]
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["lib/file0.ts","lib/file1.ts","lib/file2.ts","lib/global.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,KAAK,CAAC;;ICAlB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;;ICApB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,WAAW,KAAK,CAAC"}
//// [/src/module.js]
var myGlob = 20;
define("lib/file1", ["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.x = 10;
});
define("lib/file2", ["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.y = 20;
});
var globalConst = 10;
//# sourceMappingURL=module.js.map
//// [/src/module.js.map]
{"version":3,"file":"module.js","sourceRoot":"","sources":["lib/file0.ts","lib/file1.ts","lib/file2.ts","lib/global.ts"],"names":[],"mappings":"AAAA,IAAM,MAAM,GAAG,EAAE,CAAC;;;;ICAL,QAAA,CAAC,GAAG,EAAE,CAAC;;;;;ICAP,QAAA,CAAC,GAAG,EAAE,CAAC;;ACApB,IAAM,WAAW,GAAG,EAAE,CAAC"}
//// [/src/module.tsbuildinfo]
{
"bundle": {
"commonSourceDirectory": "/src/",
"sourceFiles": [
"/src/lib/file0.ts",
"/src/lib/file1.ts",
"/src/lib/file2.ts",
"/src/lib/global.ts"
],
"js": {
"sections": [
{
"pos": 0,
"end": 417,
"kind": "text"
}
]
},
"dts": {
"sections": [
{
"pos": 0,
"end": 179,
"kind": "text"
}
]
}
},
"version": "FakeTSVersion"
}