Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
type: ChunkType.HAST,
name: angularTemplateChunkName,
fileType: FileType.HTML,
meta: {
nodesLookup: templateLookup,
},
content: templateContent,
linkAfter: [],
})
const componentName = UIDLUtils.getComponentClassName(uidl)
const params = {
selector: UIDLUtils.createWebComponentFriendlyName(componentName),
templateUrl: `${UIDLUtils.getComponentFileName(uidl)}.${FileType.HTML}`,
}
const componentDecoratorAST = ASTBuilders.createComponentDecorator(params)
chunks.push({
type: ChunkType.AST,
name: componentDecoratorChunkName,
fileType: FileType.TS,
linkAfter: tsChunkAfter,
content: componentDecoratorAST,
})
/* We need to import EventEmitter and Output in Angular to temit events to the parent
So, to make sure if we need to import them we need to loop through all the methods and
check if any of them are referring to the function that is passed as prop*/
if (Object.keys(methodsObject).length > 0) {
const shouldImportEventEmitter = Object.keys(methodsObject).some((method) => {
const statements = methodsObject[method]
if (statements.length > 0) {
const stencilAppRoutingtPlugin: ComponentPlugin = async (structure) => {
const { chunks, uidl, dependencies } = structure
dependencies.Component = STENCIL_CORE_DEPENDENCY
dependencies.h = STENCIL_CORE_DEPENDENCY
const routes = UIDLUtils.extractRoutes(uidl)
const routeDefinitions = uidl.stateDefinitions.route
/* The name should be injected only with AppRoot only then it acts as entry point,
Sending only Root because app is appended while generation of decorators*/
const params = {
tag: 'app-root',
shadow: true,
}
const decoratorAST = ASTBuilders.createComponentDecorator(params)
chunks.push({
name: componentDecoratorChunkName,
type: ChunkType.AST,
fileType: FileType.TSX,
content: [decoratorAST],
linkAfter: [importChunkName],
})
const classDeclarationAST = createClassDeclaration(routes, routeDefinitions)
chunks.push({
name: componentChunkName,
type: ChunkType.AST,
fileType: FileType.TSX,
content: classDeclarationAST,
}
const componentName = UIDLUtils.getComponentClassName(uidl)
const exportAST = createClassDeclaration(
componentName,
propDefinitions,
stateDefinitions,
jsxTagStructure
)
const params = {
tag: UIDLUtils.createWebComponentFriendlyName(componentName),
shadow: true,
}
const decoratorAST = ASTBuilders.createComponentDecorator(params)
structure.chunks.push({
type: ChunkType.AST,
fileType: FileType.TSX,
name: componentDecoratorChunkName,
meta: {
nodesLookup,
},
content: decoratorAST,
linkAfter: [importChunkName],
})
structure.chunks.push({
type: ChunkType.AST,
fileType: FileType.TSX,
name: componentChunkName,