diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2018-11-04 10:45:06 +1100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-11-04 05:56:49 -0800 |
commit | 765f229357587fb66dfe04d3c48d62c6aae9ce71 (patch) | |
tree | e309a1c918cf416d7e8c3de2cb16c14f737e6c20 /tools/ts_library_builder/build_library.ts | |
parent | 2cf3a89f63c7bc7cfd9404f779b796c29c8e9598 (diff) |
Improve robustness of lib builder.
Diffstat (limited to 'tools/ts_library_builder/build_library.ts')
-rw-r--r-- | tools/ts_library_builder/build_library.ts | 11 |
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 e4111fe21..05cd4013b 100644 --- a/tools/ts_library_builder/build_library.ts +++ b/tools/ts_library_builder/build_library.ts @@ -18,6 +18,7 @@ import { getSourceComment, loadDtsFiles, loadFiles, + logDiagnostics, namespaceSourceFile, normalizeSlashes } from "./ast_util"; @@ -222,6 +223,7 @@ export function mergeGlobal({ // declaration source file into a namespace that exists within the merged // namespace const importDeclarations = sourceFile.getImportDeclarations(); + const namespaces = new Set<string>(); for (const declaration of importDeclarations) { const declarationSourceFile = declaration.getModuleSpecifierSourceFile(); if ( @@ -241,6 +243,7 @@ export function mergeGlobal({ namespaceSourceFile(dtsSourceFile, { debug, namespace: declaration.getNamespaceImportOrThrow().getText(), + namespaces, rootPath: basePath, sourceFileMap }) @@ -308,6 +311,14 @@ export function main({ // emit the project, which will be only the declaration files const inputEmitResult = inputProject.emitToMemory(); + const inputDiagnostics = inputEmitResult + .getDiagnostics() + .map(d => d.compilerObject); + logDiagnostics(inputDiagnostics); + if (inputDiagnostics.length) { + process.exit(1); + } + // the declaration project will be the target for the emitted files from // the input project, these will be used to transfer information over to // the final library file |