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.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/ts_library_builder/build_library.ts b/tools/ts_library_builder/build_library.ts
index 286d13d11..93d2da661 100644
--- a/tools/ts_library_builder/build_library.ts
+++ b/tools/ts_library_builder/build_library.ts
@@ -16,6 +16,7 @@ import {
checkDiagnostics,
flattenNamespace,
getSourceComment,
+ inlineFiles,
loadDtsFiles,
loadFiles,
logDiagnostics,
@@ -42,6 +43,11 @@ export interface BuildLibraryOptions {
debug?: boolean;
/**
+ * An array of files that should be inlined into the library
+ */
+ inline?: string[];
+
+ /**
* The path to the output library
*/
outFile: string;
@@ -278,6 +284,7 @@ export function mergeGlobal({
export function main({
basePath,
buildPath,
+ inline,
debug,
outFile,
silent
@@ -288,6 +295,12 @@ export function main({
console.log();
console.log(`basePath: "${basePath}"`);
console.log(`buildPath: "${buildPath}"`);
+ if (inline && inline.length) {
+ console.log(`inline:`);
+ for (const filename of inline) {
+ console.log(` "${filename}"`);
+ }
+ }
console.log(`debug: ${!!debug}`);
console.log(`outFile: "${outFile}"`);
console.log();
@@ -431,6 +444,17 @@ export function main({
console.log(`Merged "globals" into global scope.`);
}
+ // Inline any files that were passed in, to be used to add additional libs
+ // which are not part of TypeScript.
+ if (inline && inline.length) {
+ inlineFiles({
+ basePath,
+ debug,
+ inline,
+ targetSourceFile: libDTs
+ });
+ }
+
// Add the preamble
libDTs.insertStatements(0, libPreamble);