Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function preprocess(
template: string,
meta?: AnnotatedModuleLocator
): Template {
let wrapper = JSON.parse(rawPrecompile(template));
let factory = templateFactory(wrapper);
return factory.create(meta || DEFAULT_TEST_META);
}
export function createTemplate(
templateSource: string,
options?: PrecompileOptions
): TemplateFactory {
let wrapper: SerializedTemplateWithLazyBlock = JSON.parse(
rawPrecompile(templateSource, options)
);
return templateFactory(wrapper);
}
export function createTemplate(
templateSource: string,
options?: PrecompileOptions
): TemplateFactory {
let wrapper: SerializedTemplateWithLazyBlock = JSON.parse(
precompile(templateSource, options)
);
return templateFactory(wrapper);
}
export function createJitComponentDefinition(
name: string,
serializedTemplate: SerializedTemplateWithLazyBlock,
componentFactory: ComponentFactory,
owner?: Owner
): ComponentDefinition {
const template = templateFactory(serializedTemplate).create();
if (!componentFactory) {
return new TemplateOnlyComponentDefinition(name, template);
}
const ComponentClass = componentFactory.class;
const { factory } = getManager(ComponentClass);
return new CustomComponentDefinition(
name,
componentFactory,
factory(owner) as ManagerDelegate,
template
);
}
lookupComponent(name: string, referrer: Specifier): Option {
const component = this.lookupComponentDefinition(name, referrer);
const definition: ComponentDefinition = this.resolver.resolve(component);
let template;
if (isAotComponentDefinition(definition)) {
template = templateFactory(
this.resolver.resolve>(definition.handle)
).create();
} else {
template = definition.template;
}
return {
handle: component,
capabilities: definition.manager.getCapabilities(definition.state),
compilable: template.asLayout(),
};
}