From 00917a46493affa55f3c17443a548d94f08dc365 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 4 Feb 2019 14:49:24 -0800 Subject: [PATCH] Store pologue information in bundle info --- src/compiler/emitter.ts | 34 +++++- src/compiler/types.ts | 18 +++ .../multiple-prologues-in-all-projects.js | 67 ++++++++++- ...ultiple-prologues-in-different-projects.js | 40 ++++++- .../buildInfo/strict-in-all-projects.js | 40 ++++++- .../multiple-prologues-in-all-projects.js | 67 ++++++++++- ...ultiple-prologues-in-different-projects.js | 40 ++++++- .../buildInfo/strict-in-all-projects.js | 40 ++++++- .../multiple-prologues-in-all-projects.js | 76 +++++++++++- ...ultiple-prologues-in-different-projects.js | 49 +++++++- .../buildInfo/strict-in-all-projects.js | 49 +++++++- .../buildInfo/strict-in-one-dependency.js | 20 +++- .../multiple-prologues-in-all-projects.js | 111 +++++++++++++++++- ...ultiple-prologues-in-different-projects.js | 75 +++++++++++- .../buildInfo/strict-in-all-projects.js | 60 +++++++++- .../buildInfo/strict-in-one-dependency.js | 20 +++- 16 files changed, 773 insertions(+), 33 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 4746257fb82..2a89c8a4740 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -571,13 +571,13 @@ namespace ts { } if (bundleFileInfo) { bundleFileInfo.sections.push({ pos, end: writer.getTextPos(), kind: BundleFileSectionKind.Text }); - // Source file metadata if needed later on + // Store prologues + const prologues = getPrologueDirectivesFromBundledSourceFiles(bundle); + if (prologues) bundleFileInfo.sources.prologues = prologues; // Store helpes const helpers = getHelpersFromBundledSourceFiles(bundle); - if (helpers) { - bundleFileInfo.sources.helpers = helpers; - } + if (helpers) bundleFileInfo.sources.helpers = helpers; } reset(); @@ -3105,6 +3105,32 @@ namespace ts { } } + function getPrologueDirectivesFromBundledSourceFiles(bundle: Bundle): SourceFilePrologueInfo[] | undefined { + const seenPrologueDirectives = createMap(); + let prologues: SourceFilePrologueInfo[] | undefined; + for (const sourceFile of bundle.sourceFiles) { + let directives: SourceFilePrologueDirective[] | undefined; + let end = 0; + for (const statement of sourceFile.statements) { + if (!isPrologueDirective(statement)) break; + if (seenPrologueDirectives.has(statement.expression.text)) continue; + seenPrologueDirectives.set(statement.expression.text, true); + (directives || (directives = [])).push({ + pos: statement.pos, + end: statement.end, + expression: { + pos: statement.expression.pos, + end: statement.expression.end, + text: statement.expression.text + } + }); + end = end < statement.end ? statement.end : end; + } + if (directives) (prologues || (prologues = [])).push({ file: sourceFile.fileName, text: sourceFile.text.substring(0, end), directives }); + } + return prologues; + } + function emitShebangIfNeeded(sourceFileOrBundle: Bundle | SourceFile | UnparsedSource) { if (isSourceFile(sourceFileOrBundle) || isUnparsedSource(sourceFileOrBundle)) { const shebang = getShebang(sourceFileOrBundle.text); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index e44e424da96..9dbd948b6cd 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5527,10 +5527,28 @@ namespace ts { BundleFileHasNoDefaultLib | BundleFileReference | BundleFilePrepend | BundleFileText | BundleFileSourceMapUrl; + /*@internal*/ + export interface SourceFilePrologueDirectiveExpression extends TextRange { + text: string; + } + + /*@internal*/ + export interface SourceFilePrologueDirective extends TextRange { + expression: SourceFilePrologueDirectiveExpression; + } + + /*@internal*/ + export interface SourceFilePrologueInfo { + file: string; + text: string; + directives: SourceFilePrologueDirective[]; + } + /*@internal*/ export interface SourceFileInfo { // List of helpers in own source files emitted if no prepend is present helpers?: string[]; + prologues?: SourceFilePrologueInfo[]; } /*@internal*/ diff --git a/tests/baselines/reference/tsbuild/outFile/incremental-declaration-changes/buildInfo/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/outFile/incremental-declaration-changes/buildInfo/multiple-prologues-in-all-projects.js index 807eae172aa..7d6596fac7f 100644 --- a/tests/baselines/reference/tsbuild/outFile/incremental-declaration-changes/buildInfo/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outFile/incremental-declaration-changes/buildInfo/multiple-prologues-in-all-projects.js @@ -37,7 +37,34 @@ } ], "commonSourceDirectory": "/src/first/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/first/first_PART1.ts", + "text": "\"myPrologue\"", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + }, + { + "pos": 0, + "end": 12, + "expression": { + "pos": 0, + "end": 12, + "text": "myPrologue" + } + } + ] + } + ] + } } //// [/src/first/bin/first-output.d.ts] @@ -447,7 +474,43 @@ console.log(s); } ], "commonSourceDirectory": "/src/third/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/third/third_part1.ts", + "text": "\"myPrologue3\";\n\"myPrologue\";", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + }, + { + "pos": 0, + "end": 14, + "expression": { + "pos": 0, + "end": 13, + "text": "myPrologue3" + } + }, + { + "pos": 14, + "end": 28, + "expression": { + "pos": 14, + "end": 27, + "text": "myPrologue" + } + } + ] + } + ] + } } //// [/src/third/thirdjs/output/third-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outFile/incremental-declaration-changes/buildInfo/multiple-prologues-in-different-projects.js b/tests/baselines/reference/tsbuild/outFile/incremental-declaration-changes/buildInfo/multiple-prologues-in-different-projects.js index 617b0a507bd..82bd995d935 100644 --- a/tests/baselines/reference/tsbuild/outFile/incremental-declaration-changes/buildInfo/multiple-prologues-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outFile/incremental-declaration-changes/buildInfo/multiple-prologues-in-different-projects.js @@ -31,7 +31,25 @@ } ], "commonSourceDirectory": "/src/first/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/first/first_PART1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/first/bin/first-output.d.ts] @@ -419,7 +437,25 @@ console.log(s); } ], "commonSourceDirectory": "/src/third/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/third/third_part1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/third/thirdjs/output/third-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outFile/incremental-declaration-changes/buildInfo/strict-in-all-projects.js b/tests/baselines/reference/tsbuild/outFile/incremental-declaration-changes/buildInfo/strict-in-all-projects.js index 61f679fda22..f58135b0aaf 100644 --- a/tests/baselines/reference/tsbuild/outFile/incremental-declaration-changes/buildInfo/strict-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outFile/incremental-declaration-changes/buildInfo/strict-in-all-projects.js @@ -31,7 +31,25 @@ } ], "commonSourceDirectory": "/src/first/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/first/first_PART1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/first/bin/first-output.d.ts] @@ -407,7 +425,25 @@ console.log(s); } ], "commonSourceDirectory": "/src/third/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/third/third_part1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/third/thirdjs/output/third-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outFile/incremental-declaration-doesnt-change/buildInfo/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/outFile/incremental-declaration-doesnt-change/buildInfo/multiple-prologues-in-all-projects.js index 6faff30b988..21d67b6e9d9 100644 --- a/tests/baselines/reference/tsbuild/outFile/incremental-declaration-doesnt-change/buildInfo/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outFile/incremental-declaration-doesnt-change/buildInfo/multiple-prologues-in-all-projects.js @@ -37,7 +37,34 @@ } ], "commonSourceDirectory": "/src/first/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/first/first_PART1.ts", + "text": "\"myPrologue\"", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + }, + { + "pos": 0, + "end": 12, + "expression": { + "pos": 0, + "end": 12, + "text": "myPrologue" + } + } + ] + } + ] + } } //// [/src/first/bin/first-output.js] @@ -331,7 +358,43 @@ console.log(s); } ], "commonSourceDirectory": "/src/third/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/third/third_part1.ts", + "text": "\"myPrologue3\";\n\"myPrologue\";", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + }, + { + "pos": 0, + "end": 14, + "expression": { + "pos": 0, + "end": 13, + "text": "myPrologue3" + } + }, + { + "pos": 14, + "end": 28, + "expression": { + "pos": 14, + "end": 27, + "text": "myPrologue" + } + } + ] + } + ] + } } //// [/src/third/thirdjs/output/third-output.js] diff --git a/tests/baselines/reference/tsbuild/outFile/incremental-declaration-doesnt-change/buildInfo/multiple-prologues-in-different-projects.js b/tests/baselines/reference/tsbuild/outFile/incremental-declaration-doesnt-change/buildInfo/multiple-prologues-in-different-projects.js index 3db458c9bf5..a8d28d5ac83 100644 --- a/tests/baselines/reference/tsbuild/outFile/incremental-declaration-doesnt-change/buildInfo/multiple-prologues-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outFile/incremental-declaration-doesnt-change/buildInfo/multiple-prologues-in-different-projects.js @@ -31,7 +31,25 @@ } ], "commonSourceDirectory": "/src/first/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/first/first_PART1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/first/bin/first-output.js] @@ -304,7 +322,25 @@ console.log(s); } ], "commonSourceDirectory": "/src/third/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/third/third_part1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/third/thirdjs/output/third-output.js] diff --git a/tests/baselines/reference/tsbuild/outFile/incremental-declaration-doesnt-change/buildInfo/strict-in-all-projects.js b/tests/baselines/reference/tsbuild/outFile/incremental-declaration-doesnt-change/buildInfo/strict-in-all-projects.js index b772bfc075e..e4753c16a71 100644 --- a/tests/baselines/reference/tsbuild/outFile/incremental-declaration-doesnt-change/buildInfo/strict-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outFile/incremental-declaration-doesnt-change/buildInfo/strict-in-all-projects.js @@ -31,7 +31,25 @@ } ], "commonSourceDirectory": "/src/first/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/first/first_PART1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/first/bin/first-output.js] @@ -292,7 +310,25 @@ console.log(s); } ], "commonSourceDirectory": "/src/third/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/third/third_part1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/third/thirdjs/output/third-output.js] diff --git a/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/multiple-prologues-in-all-projects.js index af1a302d59b..9f71331603e 100644 --- a/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/multiple-prologues-in-all-projects.js @@ -43,7 +43,43 @@ } ], "commonSourceDirectory": "/src/first/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/first/first_PART1.ts", + "text": "\"myPrologue5\"\n\"myPrologue\"", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + }, + { + "pos": 0, + "end": 13, + "expression": { + "pos": 0, + "end": 13, + "text": "myPrologue5" + } + }, + { + "pos": 13, + "end": 26, + "expression": { + "pos": 13, + "end": 26, + "text": "myPrologue" + } + } + ] + } + ] + } } //// [/src/first/bin/first-output.d.ts.map] @@ -463,7 +499,43 @@ console.log(s); } ], "commonSourceDirectory": "/src/third/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/third/third_part1.ts", + "text": "\"myPrologue3\";\n\"myPrologue\";", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + }, + { + "pos": 0, + "end": 14, + "expression": { + "pos": 0, + "end": 13, + "text": "myPrologue3" + } + }, + { + "pos": 14, + "end": 28, + "expression": { + "pos": 14, + "end": 27, + "text": "myPrologue" + } + } + ] + } + ] + } } //// [/src/third/thirdjs/output/third-output.d.ts.map] diff --git a/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/multiple-prologues-in-different-projects.js b/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/multiple-prologues-in-different-projects.js index b5407cc7e5d..9f623ec5a96 100644 --- a/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/multiple-prologues-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/multiple-prologues-in-different-projects.js @@ -37,7 +37,34 @@ } ], "commonSourceDirectory": "/src/first/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/first/first_PART1.ts", + "text": "\"myPrologue5\"", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + }, + { + "pos": 0, + "end": 13, + "expression": { + "pos": 0, + "end": 13, + "text": "myPrologue5" + } + } + ] + } + ] + } } //// [/src/first/bin/first-output.d.ts.map] @@ -436,7 +463,25 @@ console.log(s); } ], "commonSourceDirectory": "/src/third/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/third/third_part1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/third/thirdjs/output/third-output.d.ts.map] diff --git a/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/strict-in-all-projects.js b/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/strict-in-all-projects.js index 6306cb82962..441b7aeb739 100644 --- a/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/strict-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/strict-in-all-projects.js @@ -37,7 +37,34 @@ } ], "commonSourceDirectory": "/src/first/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/first/first_PART1.ts", + "text": "\"myPrologue\"", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + }, + { + "pos": 0, + "end": 12, + "expression": { + "pos": 0, + "end": 12, + "text": "myPrologue" + } + } + ] + } + ] + } } //// [/src/first/bin/first-output.d.ts.map] @@ -424,7 +451,25 @@ console.log(s); } ], "commonSourceDirectory": "/src/third/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/third/third_part1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/third/thirdjs/output/third-output.d.ts.map] diff --git a/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/strict-in-one-dependency.js b/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/strict-in-one-dependency.js index 8c9150862dd..2edd4891c1c 100644 --- a/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/strict-in-one-dependency.js +++ b/tests/baselines/reference/tsbuild/outFile/incremental-headers-change/buildInfo/strict-in-one-dependency.js @@ -31,7 +31,25 @@ } ], "commonSourceDirectory": "/src/first/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/first/first_PART1.ts", + "text": "\"myPrologue\"", + "directives": [ + { + "pos": 0, + "end": 12, + "expression": { + "pos": 0, + "end": 12, + "text": "myPrologue" + } + } + ] + } + ] + } } //// [/src/first/bin/first-output.d.ts.map] diff --git a/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/multiple-prologues-in-all-projects.js b/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/multiple-prologues-in-all-projects.js index c867790361a..cb609538dac 100644 --- a/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/multiple-prologues-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/multiple-prologues-in-all-projects.js @@ -43,7 +43,49 @@ } ], "commonSourceDirectory": "/src/second/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/second/second_part1.ts", + "text": "\"myPrologue\"", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + }, + { + "pos": 0, + "end": 12, + "expression": { + "pos": 0, + "end": 12, + "text": "myPrologue" + } + } + ] + }, + { + "file": "/src/second/second_part2.ts", + "text": "\"myPrologue2\";", + "directives": [ + { + "pos": 0, + "end": 14, + "expression": { + "pos": 0, + "end": 13, + "text": "myPrologue2" + } + } + ] + } + ] + } } //// [/src/2/second-output.d.ts] @@ -509,7 +551,34 @@ sourceFile:../second/second_part2.ts } ], "commonSourceDirectory": "/src/first/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/first/first_PART1.ts", + "text": "\"myPrologue\"", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + }, + { + "pos": 0, + "end": 12, + "expression": { + "pos": 0, + "end": 12, + "text": "myPrologue" + } + } + ] + } + ] + } } //// [/src/first/bin/first-output.d.ts] @@ -983,7 +1052,43 @@ class C { } ], "commonSourceDirectory": "/src/third/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/third/third_part1.ts", + "text": "\"myPrologue3\";\n\"myPrologue\";", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + }, + { + "pos": 0, + "end": 14, + "expression": { + "pos": 0, + "end": 13, + "text": "myPrologue3" + } + }, + { + "pos": 14, + "end": 28, + "expression": { + "pos": 14, + "end": 27, + "text": "myPrologue" + } + } + ] + } + ] + } } //// [/src/third/thirdjs/output/third-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/multiple-prologues-in-different-projects.js b/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/multiple-prologues-in-different-projects.js index 408eb6c98c4..aa8cea40844 100644 --- a/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/multiple-prologues-in-different-projects.js +++ b/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/multiple-prologues-in-different-projects.js @@ -37,7 +37,40 @@ } ], "commonSourceDirectory": "/src/second/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/second/second_part1.ts", + "text": "\"myPrologue\"", + "directives": [ + { + "pos": 0, + "end": 12, + "expression": { + "pos": 0, + "end": 12, + "text": "myPrologue" + } + } + ] + }, + { + "file": "/src/second/second_part2.ts", + "text": "\"myPrologue2\";", + "directives": [ + { + "pos": 0, + "end": 14, + "expression": { + "pos": 0, + "end": 13, + "text": "myPrologue2" + } + } + ] + } + ] + } } //// [/src/2/second-output.d.ts] @@ -495,7 +528,25 @@ sourceFile:../second/second_part2.ts } ], "commonSourceDirectory": "/src/first/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/first/first_PART1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/first/bin/first-output.d.ts] @@ -915,7 +966,25 @@ class C { } ], "commonSourceDirectory": "/src/third/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/third/third_part1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/third/thirdjs/output/third-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/strict-in-all-projects.js b/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/strict-in-all-projects.js index 1cbf24781f2..132518f3a36 100644 --- a/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/strict-in-all-projects.js +++ b/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/strict-in-all-projects.js @@ -31,7 +31,25 @@ } ], "commonSourceDirectory": "/src/second/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/second/second_part1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/2/second-output.d.ts] @@ -454,7 +472,25 @@ sourceFile:../second/second_part2.ts } ], "commonSourceDirectory": "/src/first/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/first/first_PART1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/first/bin/first-output.d.ts] @@ -856,7 +892,25 @@ sourceFile:../first_part3.ts } ], "commonSourceDirectory": "/src/third/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/third/third_part1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/third/thirdjs/output/third-output.d.ts] diff --git a/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/strict-in-one-dependency.js b/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/strict-in-one-dependency.js index 1249aab723c..8dbd5077d2c 100644 --- a/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/strict-in-one-dependency.js +++ b/tests/baselines/reference/tsbuild/outFile/initial-Build/buildInfo/strict-in-one-dependency.js @@ -31,7 +31,25 @@ } ], "commonSourceDirectory": "/src/second/", - "sources": {} + "sources": { + "prologues": [ + { + "file": "/src/second/second_part1.ts", + "text": "", + "directives": [ + { + "pos": -1, + "end": -1, + "expression": { + "pos": -1, + "end": -1, + "text": "use strict" + } + } + ] + } + ] + } } //// [/src/2/second-output.d.ts]