mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
Fix issue with runtime lib generation.
This commit is contained in:
parent
bd88e56cbc
commit
5e48a681c4
2 changed files with 19 additions and 0 deletions
|
@ -58,6 +58,14 @@ export function addVariableDeclaration(
|
|||
});
|
||||
}
|
||||
|
||||
/** Copy one source file to the end of another source file. */
|
||||
export function appendSourceFile(
|
||||
sourceFile: SourceFile,
|
||||
targetSourceFile: SourceFile
|
||||
): void {
|
||||
targetSourceFile.addStatements(`\n${sourceFile.print()}`);
|
||||
}
|
||||
|
||||
/** Check diagnostics, and if any exist, exit the process */
|
||||
export function checkDiagnostics(project: Project, onlyFor?: string[]) {
|
||||
const program = project.getProgram();
|
||||
|
|
|
@ -13,6 +13,7 @@ import {
|
|||
addInterfaceProperty,
|
||||
addSourceComment,
|
||||
addVariableDeclaration,
|
||||
appendSourceFile,
|
||||
checkDiagnostics,
|
||||
flattenNamespace,
|
||||
getSourceComment,
|
||||
|
@ -421,6 +422,16 @@ export function main({
|
|||
console.log(`Merged "globals" into global scope.`);
|
||||
}
|
||||
|
||||
// Since we flatten the namespaces, we don't attempt to import `text-encoding`
|
||||
// so we then need to concatenate that onto the `libDts` so it can stand on
|
||||
// its own.
|
||||
const textEncodingSourceFile = outputProject.getSourceFileOrThrow(
|
||||
textEncodingFilePath
|
||||
);
|
||||
appendSourceFile(textEncodingSourceFile, libDTs);
|
||||
// Removing it from the project so we know the libDTs can stand on its own.
|
||||
outputProject.removeSourceFile(textEncodingSourceFile);
|
||||
|
||||
// Add the preamble
|
||||
libDTs.insertStatements(0, libPreamble);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue