mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Create prepend text sections in .buildInfo
This commit is contained in:
@@ -556,12 +556,14 @@ namespace ts {
|
||||
emitHelpers(bundle);
|
||||
emitSyntheticTripleSlashReferencesIfNeeded(bundle);
|
||||
|
||||
const pos = getTextPosWithWriteLine();
|
||||
for (const prepend of bundle.prepends) {
|
||||
writeLine();
|
||||
const pos = getTextPosWithWriteLine();
|
||||
print(EmitHint.Unspecified, prepend, /*sourceFile*/ undefined);
|
||||
if (bundleFileInfo) bundleFileInfo.push({ pos, end: writer.getTextPos(), kind: BundleFileSectionKind.Prepend, fileName: (prepend as UnparsedSource).fileName });
|
||||
}
|
||||
|
||||
const pos = getTextPosWithWriteLine();
|
||||
for (const sourceFile of bundle.sourceFiles) {
|
||||
print(EmitHint.SourceFile, sourceFile, sourceFile);
|
||||
}
|
||||
|
||||
@@ -2675,6 +2675,7 @@ namespace ts {
|
||||
|
||||
const sections = textOrInputFiles.buildInfo ? mapPathOrType === "js" ? textOrInputFiles.buildInfo.js : textOrInputFiles.buildInfo.dts : undefined;
|
||||
if (sections) {
|
||||
let setPos = false;
|
||||
for (const section of sections) {
|
||||
switch (section.kind) {
|
||||
case BundleFileSectionKind.Prologue:
|
||||
@@ -2698,9 +2699,13 @@ namespace ts {
|
||||
case BundleFileSectionKind.Lib:
|
||||
(libReferenceDirectives || (libReferenceDirectives = [])).push({ pos: -1, end: -1, fileName: section.fileName });
|
||||
break;
|
||||
case BundleFileSectionKind.Prepend:
|
||||
case BundleFileSectionKind.Text:
|
||||
// For now just set node.pos to this
|
||||
node.pos = section.pos;
|
||||
if (!setPos) {
|
||||
// For now just set node.pos to this
|
||||
node.pos = section.pos;
|
||||
setPos = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Debug.assertNever(section);
|
||||
|
||||
@@ -5440,6 +5440,7 @@ namespace ts {
|
||||
Reference = "reference",
|
||||
Type = "type",
|
||||
Lib = "lib",
|
||||
Prepend = "prepend",
|
||||
Text = "text",
|
||||
// internal comments?
|
||||
}
|
||||
@@ -5472,6 +5473,12 @@ namespace ts {
|
||||
fileName: string;
|
||||
}
|
||||
|
||||
/*@internal*/
|
||||
export interface BundleFilePrepend extends BundleFileSectionBase {
|
||||
kind: BundleFileSectionKind.Prepend;
|
||||
fileName: string;
|
||||
}
|
||||
|
||||
/*@internal*/
|
||||
export interface BundleFileText extends BundleFileSectionBase {
|
||||
kind: BundleFileSectionKind.Text;
|
||||
@@ -5479,7 +5486,7 @@ namespace ts {
|
||||
|
||||
/*@internal*/
|
||||
export type BundleFileSection = BundleFilePrologue | BundleFileEmitHelpers |
|
||||
BundleFileHasNoDefaultLib | BundleFileReference | BundleFileText;
|
||||
BundleFileHasNoDefaultLib | BundleFileReference | BundleFilePrepend | BundleFileText;
|
||||
|
||||
/*@internal*/
|
||||
export type BundleFileInfo = BundleFileSection[];
|
||||
|
||||
@@ -724,6 +724,18 @@ sourceFile:../first_part3.ts
|
||||
"js": [
|
||||
{
|
||||
"pos": 0,
|
||||
"end": 150,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 152,
|
||||
"end": 478,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 480,
|
||||
"end": 516,
|
||||
"kind": "text"
|
||||
}
|
||||
@@ -731,6 +743,18 @@ sourceFile:../first_part3.ts
|
||||
"dts": [
|
||||
{
|
||||
"pos": 0,
|
||||
"end": 199,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 201,
|
||||
"end": 344,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 346,
|
||||
"end": 365,
|
||||
"kind": "text"
|
||||
}
|
||||
|
||||
@@ -1151,6 +1151,18 @@ class second2 extends second1 { }
|
||||
},
|
||||
{
|
||||
"pos": 599,
|
||||
"end": 1043,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 1045,
|
||||
"end": 1673,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 1675,
|
||||
"end": 2005,
|
||||
"kind": "text"
|
||||
}
|
||||
@@ -1158,6 +1170,18 @@ class second2 extends second1 { }
|
||||
"dts": [
|
||||
{
|
||||
"pos": 0,
|
||||
"end": 268,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 270,
|
||||
"end": 485,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 487,
|
||||
"end": 575,
|
||||
"kind": "text"
|
||||
}
|
||||
|
||||
@@ -943,6 +943,18 @@ class second2 extends second1 { }
|
||||
},
|
||||
{
|
||||
"pos": 599,
|
||||
"end": 749,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 751,
|
||||
"end": 1379,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 1381,
|
||||
"end": 1417,
|
||||
"kind": "text"
|
||||
}
|
||||
@@ -950,6 +962,18 @@ class second2 extends second1 { }
|
||||
"dts": [
|
||||
{
|
||||
"pos": 0,
|
||||
"end": 199,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 201,
|
||||
"end": 416,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 418,
|
||||
"end": 437,
|
||||
"kind": "text"
|
||||
}
|
||||
|
||||
@@ -1594,6 +1594,18 @@ secondsecond_part2Spread(...[10, 20, 30]);
|
||||
},
|
||||
{
|
||||
"pos": 1277,
|
||||
"end": 1933,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 1935,
|
||||
"end": 2779,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 2781,
|
||||
"end": 3323,
|
||||
"kind": "text"
|
||||
}
|
||||
@@ -1601,6 +1613,18 @@ secondsecond_part2Spread(...[10, 20, 30]);
|
||||
"dts": [
|
||||
{
|
||||
"pos": 0,
|
||||
"end": 332,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 334,
|
||||
"end": 615,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 617,
|
||||
"end": 769,
|
||||
"kind": "text"
|
||||
}
|
||||
|
||||
@@ -1170,6 +1170,18 @@ class second2 extends second1 { }
|
||||
},
|
||||
{
|
||||
"pos": 1277,
|
||||
"end": 1639,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 1641,
|
||||
"end": 2269,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 2271,
|
||||
"end": 2519,
|
||||
"kind": "text"
|
||||
}
|
||||
@@ -1177,6 +1189,18 @@ class second2 extends second1 { }
|
||||
"dts": [
|
||||
{
|
||||
"pos": 0,
|
||||
"end": 263,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 265,
|
||||
"end": 480,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 482,
|
||||
"end": 565,
|
||||
"kind": "text"
|
||||
}
|
||||
|
||||
@@ -913,6 +913,18 @@ class C {
|
||||
},
|
||||
{
|
||||
"pos": 62,
|
||||
"end": 212,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 214,
|
||||
"end": 540,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 542,
|
||||
"end": 578,
|
||||
"kind": "text"
|
||||
}
|
||||
@@ -920,6 +932,18 @@ class C {
|
||||
"dts": [
|
||||
{
|
||||
"pos": 0,
|
||||
"end": 199,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 201,
|
||||
"end": 344,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 346,
|
||||
"end": 365,
|
||||
"kind": "text"
|
||||
}
|
||||
|
||||
@@ -845,6 +845,18 @@ class C {
|
||||
},
|
||||
{
|
||||
"pos": 46,
|
||||
"end": 196,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 198,
|
||||
"end": 524,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 526,
|
||||
"end": 562,
|
||||
"kind": "text"
|
||||
}
|
||||
@@ -852,6 +864,18 @@ class C {
|
||||
"dts": [
|
||||
{
|
||||
"pos": 0,
|
||||
"end": 199,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 201,
|
||||
"end": 344,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 346,
|
||||
"end": 365,
|
||||
"kind": "text"
|
||||
}
|
||||
|
||||
@@ -772,6 +772,18 @@ namespace N {
|
||||
"js": [
|
||||
{
|
||||
"pos": 33,
|
||||
"end": 183,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 185,
|
||||
"end": 511,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 513,
|
||||
"end": 549,
|
||||
"kind": "text"
|
||||
}
|
||||
@@ -779,6 +791,18 @@ namespace N {
|
||||
"dts": [
|
||||
{
|
||||
"pos": 33,
|
||||
"end": 232,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 234,
|
||||
"end": 377,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 379,
|
||||
"end": 398,
|
||||
"kind": "text"
|
||||
}
|
||||
|
||||
@@ -745,6 +745,18 @@ namespace N {
|
||||
"js": [
|
||||
{
|
||||
"pos": 35,
|
||||
"end": 185,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 187,
|
||||
"end": 513,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 515,
|
||||
"end": 551,
|
||||
"kind": "text"
|
||||
}
|
||||
@@ -752,6 +764,18 @@ namespace N {
|
||||
"dts": [
|
||||
{
|
||||
"pos": 35,
|
||||
"end": 234,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 236,
|
||||
"end": 379,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 381,
|
||||
"end": 400,
|
||||
"kind": "text"
|
||||
}
|
||||
|
||||
@@ -786,6 +786,18 @@ sourceFile:../first_part3.ts
|
||||
},
|
||||
{
|
||||
"pos": 15,
|
||||
"end": 165,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 167,
|
||||
"end": 493,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 495,
|
||||
"end": 531,
|
||||
"kind": "text"
|
||||
}
|
||||
@@ -793,6 +805,18 @@ sourceFile:../first_part3.ts
|
||||
"dts": [
|
||||
{
|
||||
"pos": 0,
|
||||
"end": 199,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 201,
|
||||
"end": 344,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 346,
|
||||
"end": 365,
|
||||
"kind": "text"
|
||||
}
|
||||
|
||||
@@ -756,6 +756,18 @@ sourceFile:../first_part3.ts
|
||||
},
|
||||
{
|
||||
"pos": 15,
|
||||
"end": 165,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 167,
|
||||
"end": 493,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 495,
|
||||
"end": 531,
|
||||
"kind": "text"
|
||||
}
|
||||
@@ -763,6 +775,18 @@ sourceFile:../first_part3.ts
|
||||
"dts": [
|
||||
{
|
||||
"pos": 0,
|
||||
"end": 199,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 201,
|
||||
"end": 344,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 346,
|
||||
"end": 365,
|
||||
"kind": "text"
|
||||
}
|
||||
|
||||
@@ -875,6 +875,18 @@ declare class secondsecond_part1 { }
|
||||
"js": [
|
||||
{
|
||||
"pos": 0,
|
||||
"end": 198,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 200,
|
||||
"end": 577,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 579,
|
||||
"end": 663,
|
||||
"kind": "text"
|
||||
}
|
||||
@@ -900,6 +912,18 @@ declare class secondsecond_part1 { }
|
||||
},
|
||||
{
|
||||
"pos": 160,
|
||||
"end": 410,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 412,
|
||||
"end": 609,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 611,
|
||||
"end": 681,
|
||||
"kind": "text"
|
||||
}
|
||||
|
||||
@@ -803,6 +803,18 @@ declare class secondsecond_part1 { }
|
||||
"js": [
|
||||
{
|
||||
"pos": 0,
|
||||
"end": 150,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 152,
|
||||
"end": 529,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 531,
|
||||
"end": 567,
|
||||
"kind": "text"
|
||||
}
|
||||
@@ -816,6 +828,18 @@ declare class secondsecond_part1 { }
|
||||
},
|
||||
{
|
||||
"pos": 57,
|
||||
"end": 256,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 258,
|
||||
"end": 455,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 457,
|
||||
"end": 476,
|
||||
"kind": "text"
|
||||
}
|
||||
|
||||
+24
@@ -724,6 +724,18 @@ sourceFile:../first_part3.ts
|
||||
"js": [
|
||||
{
|
||||
"pos": 0,
|
||||
"end": 150,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 152,
|
||||
"end": 478,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.js"
|
||||
},
|
||||
{
|
||||
"pos": 480,
|
||||
"end": 516,
|
||||
"kind": "text"
|
||||
}
|
||||
@@ -731,6 +743,18 @@ sourceFile:../first_part3.ts
|
||||
"dts": [
|
||||
{
|
||||
"pos": 0,
|
||||
"end": 199,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/first/bin/first-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 201,
|
||||
"end": 344,
|
||||
"kind": "prepend",
|
||||
"fileName": "/src/2/second-output.d.ts"
|
||||
},
|
||||
{
|
||||
"pos": 346,
|
||||
"end": 365,
|
||||
"kind": "text"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user