( declarations: TestDeclaration[], config: TypeCheckingConfig, foreignComponentNames: string[], )
| 417 | } |
| 418 | |
| 419 | function prepareDeclarations( |
| 420 | declarations: TestDeclaration[], |
| 421 | config: TypeCheckingConfig, |
| 422 | foreignComponentNames: string[], |
| 423 | ) { |
| 424 | const directives: TcbDirectiveMetadata[] = []; |
| 425 | const hostDirectives = new Map<TcbDirectiveMetadata, TcbDirectiveMetadata[]>(); |
| 426 | const pipes = new Map<string, TcbPipeMetadata>(); |
| 427 | |
| 428 | for (const decl of declarations) { |
| 429 | if (decl.type === 'directive') { |
| 430 | const meta = toDirectiveMetadata(decl); |
| 431 | directives.push(meta); |
| 432 | hostDirectives.set(meta, resolveHostDirectives(decl)); |
| 433 | } else { |
| 434 | pipes.set(decl.pipeName, { |
| 435 | name: decl.pipeName, |
| 436 | ref: createReference(decl.name), |
| 437 | isExplicitlyDeferred: false, |
| 438 | deferredBlocks: null, |
| 439 | }); |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | const foreignRegistry = new Map<string, ForeignComponentMeta[]>(); |
| 444 | for (const name of foreignComponentNames) { |
| 445 | foreignRegistry.set(name, [{name}]); |
| 446 | } |
| 447 | const foreignMatcher = new SelectorlessMatcher<ForeignComponentMeta>(foreignRegistry); |
| 448 | |
| 449 | const matcher = new SelectorMatcher<TcbDirectiveMetadata[]>(); |
| 450 | for (const meta of directives) { |
| 451 | matcher.addSelectables(CssSelector.parse(meta.selector || ''), [ |
| 452 | ...hostDirectives.get(meta)!, |
| 453 | meta, |
| 454 | ]); |
| 455 | } |
| 456 | return {matcher, pipes, foreignMatcher}; |
| 457 | } |
| 458 | |
| 459 | function toDirectiveMetadata( |
| 460 | decl: TestDirective, |
no test coverage detected