summaryrefslogtreecommitdiff
path: root/tools/ts_library_builder/build_library.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tools/ts_library_builder/build_library.ts')
-rw-r--r--tools/ts_library_builder/build_library.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/ts_library_builder/build_library.ts b/tools/ts_library_builder/build_library.ts
index 05cd4013b..af3fb599d 100644
--- a/tools/ts_library_builder/build_library.ts
+++ b/tools/ts_library_builder/build_library.ts
@@ -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);