( target: TcbTargetInput, typeCheckId: TypeCheckId, filePath: string, config: NgpTypeCheckingConfig, requiresInline: boolean = false, content?: string, tracer: Tracer = NOOP_TRACER, )
| 211 | } |
| 212 | |
| 213 | export function adaptTcbInput( |
| 214 | target: TcbTargetInput, |
| 215 | typeCheckId: TypeCheckId, |
| 216 | filePath: string, |
| 217 | config: NgpTypeCheckingConfig, |
| 218 | requiresInline: boolean = false, |
| 219 | content?: string, |
| 220 | tracer: Tracer = NOOP_TRACER, |
| 221 | ): { |
| 222 | tcbMeta: TcbTypeCheckBlockMetadata; |
| 223 | targetMeta: TcbComponentMetadata; |
| 224 | hostElement: TmplAstHostElement | null; |
| 225 | } { |
| 226 | const isStandalone = target.isStandalone ?? target.ownDeclaration.isStandalone ?? false; |
| 227 | const declarations = |
| 228 | isStandalone && target.ownDeclaration |
| 229 | ? [ |
| 230 | target.ownDeclaration, |
| 231 | ...target.declarations.filter( |
| 232 | (d) => |
| 233 | !( |
| 234 | d.name === target.ownDeclaration.name && |
| 235 | d.ref.localAlias === target.ownDeclaration.name && |
| 236 | d.ref.consumerImport == null |
| 237 | ), |
| 238 | ), |
| 239 | ] |
| 240 | : target.declarations; |
| 241 | |
| 242 | const matcher = new SelectorMatcher<TcbDirectiveMetadata[]>(); |
| 243 | for (const decl of declarations) { |
| 244 | if (decl.declarationType !== 'directive' && decl.declarationType !== 'component') { |
| 245 | continue; |
| 246 | } |
| 247 | if (decl.selector) { |
| 248 | const declPath = decl.filePath || filePath; |
| 249 | const hostDirectives = resolveHostDirectives( |
| 250 | decl.resolvedHostDirectives, |
| 251 | declPath, |
| 252 | requiresInline, |
| 253 | content, |
| 254 | filePath, |
| 255 | ); |
| 256 | matcher.addSelectables(CssSelector.parse(decl.selector), [ |
| 257 | ...hostDirectives, |
| 258 | declarationToMetadata(decl, declPath, requiresInline, content, filePath), |
| 259 | ]); |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | const hostDirectivesOnTarget = target.ownDeclaration |
| 264 | ? resolveHostDirectives( |
| 265 | target.ownDeclaration.resolvedHostDirectives, |
| 266 | filePath, |
| 267 | requiresInline, |
| 268 | content, |
| 269 | filePath, |
| 270 | ) |
no test coverage detected