MCPcopy Create free account
hub / github.com/angular/angular / adaptTcbInput

Function adaptTcbInput

packages/compiler-cli/preprocessor/src/tcb_adapter.ts:213–362  ·  view source on GitHub ↗
(
  target: TcbTargetInput,
  typeCheckId: TypeCheckId,
  filePath: string,
  config: NgpTypeCheckingConfig,
  requiresInline: boolean = false,
  content?: string,
  tracer: Tracer = NOOP_TRACER,
)

Source from the content-addressed store, hash-verified

211}
212
213export 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 )

Callers 1

prepareTcbTargetsFunction · 0.85

Calls 13

addSelectablesMethod · 0.95
bindMethod · 0.95
declarationToMetadataFunction · 0.85
adaptHostElementFunction · 0.85
mapTypeParametersFunction · 0.85
mapMethod · 0.80
resolveHostDirectivesFunction · 0.70
parseMethod · 0.65
sliceMethod · 0.65
getUsedDirectivesMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected