From 0d6c9d36a174f7dc6eb1029e459beecc2dfb0026 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 10 Apr 2019 18:49:28 +0200 Subject: [PATCH] refactor(compiler): export static-query detection logic (#29815) The `@angular/compiler` package currently contains the logic for determining whether given queries are used statically or dynamically. This logic would be necessary in order to build a schematic that leverages the Angular compiler API's in order to simulate the query timing based on what ViewEngine computed at compilation-time/runtime. Exporting the logic that is necessary to detect the timing should not affect the public API as the `@angular/compiler` package is denoted as private in `PUBLIC_API.md` PR Close #29815 --- packages/compiler/src/compiler.ts | 2 +- packages/compiler/src/view_compiler/view_compiler.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/compiler/src/compiler.ts b/packages/compiler/src/compiler.ts index c400260081..7c351c3c29 100644 --- a/packages/compiler/src/compiler.ts +++ b/packages/compiler/src/compiler.ts @@ -85,7 +85,7 @@ export * from './schema/dom_element_schema_registry'; export * from './selector'; export * from './style_compiler'; export * from './template_parser/template_parser'; -export {ViewCompiler} from './view_compiler/view_compiler'; +export {ViewCompiler, findStaticQueryIds, staticViewQueryIds} from './view_compiler/view_compiler'; export {getParseErrors, isSyntaxError, syntaxError, Version} from './util'; export {SourceMap} from './output/source_map'; export * from './injectable_compiler_2'; diff --git a/packages/compiler/src/view_compiler/view_compiler.ts b/packages/compiler/src/view_compiler/view_compiler.ts index 5fe530bb04..e97e3291f6 100644 --- a/packages/compiler/src/view_compiler/view_compiler.ts +++ b/packages/compiler/src/view_compiler/view_compiler.ts @@ -1023,7 +1023,7 @@ interface StaticAndDynamicQueryIds { } -function findStaticQueryIds( +export function findStaticQueryIds( nodes: TemplateAst[], result = new Map()): Map { nodes.forEach((node) => { @@ -1056,7 +1056,7 @@ function findStaticQueryIds( return result; } -function staticViewQueryIds(nodeStaticQueryIds: Map): +export function staticViewQueryIds(nodeStaticQueryIds: Map): StaticAndDynamicQueryIds { const staticQueryIds = new Set(); const dynamicQueryIds = new Set();