mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Ensure prepend texts are set when skipping internals (#33694)
This commit is contained in:
@@ -2974,7 +2974,10 @@ namespace ts {
|
||||
(texts || (texts = [])).push(prependNode);
|
||||
break;
|
||||
case BundleFileSectionKind.Internal:
|
||||
if (stripInternal) break;
|
||||
if (stripInternal) {
|
||||
if (!texts) texts = [];
|
||||
break;
|
||||
}
|
||||
// falls through
|
||||
|
||||
case BundleFileSectionKind.Text:
|
||||
|
||||
@@ -228,7 +228,7 @@ interface Symbol {
|
||||
if (section.kind !== BundleFileSectionKind.Prepend) {
|
||||
writeTextOfSection(section.pos, section.end);
|
||||
}
|
||||
else {
|
||||
else if (section.texts.length > 0) {
|
||||
Debug.assert(section.pos === first(section.texts).pos);
|
||||
Debug.assert(section.end === last(section.texts).end);
|
||||
for (const text of section.texts) {
|
||||
@@ -237,6 +237,9 @@ interface Symbol {
|
||||
writeTextOfSection(text.pos, text.end);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Debug.assert(section.pos === section.end);
|
||||
}
|
||||
}
|
||||
baselineRecorder.WriteLine("======================================================================");
|
||||
|
||||
|
||||
@@ -682,6 +682,40 @@ ${internal} enum internalEnum { a, b, c }`);
|
||||
ignoreDtsUnchanged: true,
|
||||
baselineOnly: true
|
||||
});
|
||||
|
||||
verifyOutFileScenario({
|
||||
subScenario: "stripInternal when prepend is completely internal",
|
||||
baselineOnly: true,
|
||||
ignoreDtsChanged: true,
|
||||
ignoreDtsUnchanged: true,
|
||||
modifyFs: fs => {
|
||||
fs.writeFileSync(sources[project.first][source.ts][part.one], "/* @internal */ const A = 1;");
|
||||
fs.writeFileSync(sources[project.third][source.ts][part.one], "const B = 2;");
|
||||
fs.writeFileSync(sources[project.first][source.config], JSON.stringify({
|
||||
compilerOptions: {
|
||||
composite: true,
|
||||
declaration: true,
|
||||
declarationMap: true,
|
||||
skipDefaultLibCheck: true,
|
||||
sourceMap: true,
|
||||
outFile: "./bin/first-output.js"
|
||||
},
|
||||
files: [sources[project.first][source.ts][part.one]]
|
||||
}));
|
||||
fs.writeFileSync(sources[project.third][source.config], JSON.stringify({
|
||||
compilerOptions: {
|
||||
composite: true,
|
||||
declaration: true,
|
||||
declarationMap: false,
|
||||
stripInternal: true,
|
||||
sourceMap: true,
|
||||
outFile: "./thirdjs/output/third-output.js"
|
||||
},
|
||||
references: [{ path: "../first", prepend: true }],
|
||||
files: [sources[project.third][source.ts][part.one]]
|
||||
}));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("empty source files", () => {
|
||||
|
||||
Reference in New Issue
Block a user