mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Correctly set sourceFileInfo for bundle when generating output without creating program
This commit is contained in:
@@ -537,7 +537,7 @@ namespace ts {
|
||||
if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap) return declarationMapPath || "inline sourcemap decoding";
|
||||
|
||||
const buildInfo = JSON.parse(buildInfoText) as BuildInfo;
|
||||
if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationMapText && !buildInfo.bundle.dts)) return buildInfoPath!;
|
||||
if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts)) return buildInfoPath!;
|
||||
const ownPrependInput = createInputFiles(
|
||||
jsFileText,
|
||||
declarationText!,
|
||||
@@ -578,7 +578,13 @@ namespace ts {
|
||||
case buildInfoPath:
|
||||
const newBuildInfo = JSON.parse(text) as BuildInfo;
|
||||
newBuildInfo.program = buildInfo.program;
|
||||
outputFiles.push({ name, text: getBuildInfoText({ program: buildInfo.program, bundle: newBuildInfo.bundle }), writeByteOrderMark });
|
||||
// Update sourceFileInfo
|
||||
const { js, dts } = buildInfo.bundle!;
|
||||
newBuildInfo.bundle!.js!.sources = js!.sources;
|
||||
if (dts) {
|
||||
newBuildInfo.bundle!.dts!.sources = dts.sources;
|
||||
}
|
||||
outputFiles.push({ name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark });
|
||||
return;
|
||||
case declarationFilePath:
|
||||
if (declarationText === text) return;
|
||||
|
||||
+6
-1
@@ -423,7 +423,12 @@ const { b, ...rest } = { a: 10, b: 30, yy: 30 };
|
||||
"end": 1343,
|
||||
"kind": "sourceMapUrl"
|
||||
}
|
||||
]
|
||||
],
|
||||
"sources": {
|
||||
"helpers": [
|
||||
"typescript:rest"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dts": {
|
||||
"sections": [
|
||||
|
||||
+8
-1
@@ -623,7 +623,14 @@ const { b, ...rest } = { a: 10, b: 30, yy: 30 };
|
||||
"end": 2661,
|
||||
"kind": "sourceMapUrl"
|
||||
}
|
||||
]
|
||||
],
|
||||
"sources": {
|
||||
"helpers": [
|
||||
"typescript:rest",
|
||||
"typescript:read",
|
||||
"typescript:spread"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dts": {
|
||||
"sections": [
|
||||
|
||||
+6
-1
@@ -435,7 +435,12 @@ const { b, ...rest } = { a: 10, b: 30, yy: 30 };
|
||||
"end": 2118,
|
||||
"kind": "sourceMapUrl"
|
||||
}
|
||||
]
|
||||
],
|
||||
"sources": {
|
||||
"helpers": [
|
||||
"typescript:rest"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dts": {
|
||||
"sections": [
|
||||
|
||||
+38
-1
@@ -406,7 +406,44 @@ console.log(s);
|
||||
"end": 635,
|
||||
"kind": "sourceMapUrl"
|
||||
}
|
||||
]
|
||||
],
|
||||
"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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"dts": {
|
||||
"sections": [
|
||||
|
||||
+20
-1
@@ -367,7 +367,26 @@ console.log(s);
|
||||
"end": 619,
|
||||
"kind": "sourceMapUrl"
|
||||
}
|
||||
]
|
||||
],
|
||||
"sources": {
|
||||
"prologues": [
|
||||
{
|
||||
"file": "/src/third/third_part1.ts",
|
||||
"text": "",
|
||||
"directives": [
|
||||
{
|
||||
"pos": -1,
|
||||
"end": -1,
|
||||
"expression": {
|
||||
"pos": -1,
|
||||
"end": -1,
|
||||
"text": "use strict"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"dts": {
|
||||
"sections": [
|
||||
|
||||
+20
-1
@@ -355,7 +355,26 @@ console.log(s);
|
||||
"end": 588,
|
||||
"kind": "sourceMapUrl"
|
||||
}
|
||||
]
|
||||
],
|
||||
"sources": {
|
||||
"prologues": [
|
||||
{
|
||||
"file": "/src/third/third_part1.ts",
|
||||
"text": "",
|
||||
"directives": [
|
||||
{
|
||||
"pos": -1,
|
||||
"end": -1,
|
||||
"expression": {
|
||||
"pos": -1,
|
||||
"end": -1,
|
||||
"text": "use strict"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"dts": {
|
||||
"sections": [
|
||||
|
||||
+6
-1
@@ -466,7 +466,12 @@ function forfirstfirst_PART1Rest() { }
|
||||
"end": 1249,
|
||||
"kind": "sourceMapUrl"
|
||||
}
|
||||
]
|
||||
],
|
||||
"sources": {
|
||||
"helpers": [
|
||||
"typescript:rest"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dts": {
|
||||
"sections": [
|
||||
|
||||
+8
-1
@@ -700,7 +700,14 @@ function forfirstfirst_PART1Rest() { }
|
||||
"end": 2567,
|
||||
"kind": "sourceMapUrl"
|
||||
}
|
||||
]
|
||||
],
|
||||
"sources": {
|
||||
"helpers": [
|
||||
"typescript:rest",
|
||||
"typescript:read",
|
||||
"typescript:spread"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dts": {
|
||||
"sections": [
|
||||
|
||||
+6
-1
@@ -478,7 +478,12 @@ function forfirstfirst_PART1Rest() { }
|
||||
"end": 2024,
|
||||
"kind": "sourceMapUrl"
|
||||
}
|
||||
]
|
||||
],
|
||||
"sources": {
|
||||
"helpers": [
|
||||
"typescript:rest"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dts": {
|
||||
"sections": [
|
||||
|
||||
+38
-1
@@ -549,7 +549,44 @@ console.log(s);
|
||||
"end": 634,
|
||||
"kind": "sourceMapUrl"
|
||||
}
|
||||
]
|
||||
],
|
||||
"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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"dts": {
|
||||
"sections": [
|
||||
|
||||
+20
-1
@@ -510,7 +510,26 @@ console.log(s);
|
||||
"end": 618,
|
||||
"kind": "sourceMapUrl"
|
||||
}
|
||||
]
|
||||
],
|
||||
"sources": {
|
||||
"prologues": [
|
||||
{
|
||||
"file": "/src/third/third_part1.ts",
|
||||
"text": "",
|
||||
"directives": [
|
||||
{
|
||||
"pos": -1,
|
||||
"end": -1,
|
||||
"expression": {
|
||||
"pos": -1,
|
||||
"end": -1,
|
||||
"text": "use strict"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"dts": {
|
||||
"sections": [
|
||||
|
||||
+20
-1
@@ -498,7 +498,26 @@ console.log(s);
|
||||
"end": 586,
|
||||
"kind": "sourceMapUrl"
|
||||
}
|
||||
]
|
||||
],
|
||||
"sources": {
|
||||
"prologues": [
|
||||
{
|
||||
"file": "/src/third/third_part1.ts",
|
||||
"text": "",
|
||||
"directives": [
|
||||
{
|
||||
"pos": -1,
|
||||
"end": -1,
|
||||
"expression": {
|
||||
"pos": -1,
|
||||
"end": -1,
|
||||
"text": "use strict"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"dts": {
|
||||
"sections": [
|
||||
|
||||
Reference in New Issue
Block a user