How to use the @teleporthq/teleport-plugin-common.ASTBuilders.createDefaultExport function in @teleporthq/teleport-plugin-common

To help you get started, we’ve selected a few @teleporthq/teleport-plugin-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github teleporthq / teleport-code-generators / packages / teleport-plugin-react-base-component / src / index.ts View on Github external
type: ChunkType.AST,
      fileType: FileType.JS,
      name: componentChunkName,
      meta: {
        nodesLookup,
        dynamicRefPrefix: jsxOptions.dynamicReferencePrefixMap,
      },
      content: pureComponent,
      linkAfter: [importChunkName],
    })

    structure.chunks.push({
      type: ChunkType.AST,
      fileType: FileType.JS,
      name: exportChunkName,
      content: ASTBuilders.createDefaultExport(componentName),
      linkAfter: [componentChunkName],
    })

    return structure
  }
github teleporthq / teleport-code-generators / packages / teleport-plugin-preact-base-component / src / index.ts View on Github external
type: ChunkType.AST,
      fileType: FileType.JS,
      name: componentChunkName,
      meta: {
        nodesLookup,
        dynamicRefPrefix: jsxOptions.dynamicReferencePrefixMap,
      },
      content: preactComponent,
      linkAfter: [importChunkName],
    })

    structure.chunks.push({
      type: ChunkType.AST,
      fileType: FileType.JS,
      name: exportChunkName,
      content: ASTBuilders.createDefaultExport(componentName),
      linkAfter: [componentChunkName],
    })

    return structure
  }
github teleporthq / teleport-code-generators / packages / teleport-plugin-react-app-routing / src / index.ts View on Github external
})

    const rootRouterTag = createRouteRouterTag(flavor, routeJSXDefinitions)

    const pureComponent = ASTBuilders.createFunctionalComponent(uidl.name, rootRouterTag)

    structure.chunks.push({
      type: ChunkType.AST,
      fileType: FileType.JS,
      name: componentChunkName,
      content: pureComponent,
      linkAfter: [importChunkName],
    })

    if (flavor === 'preact') {
      const exportJSXApp = ASTBuilders.createDefaultExport('App')

      structure.chunks.push({
        type: ChunkType.AST,
        fileType: FileType.JS,
        name: domRenderChunkName,
        content: exportJSXApp,
        linkAfter: [componentChunkName],
      })
    } else {
      const reactDomBind = ASTBuilders.createFunctionCall('ReactDOM.render', [
        ASTBuilders.createSelfClosingJSXTag(uidl.name),
        ASTBuilders.createFunctionCall('document.getElementById', ['app']),
      ])

      structure.chunks.push({
        type: ChunkType.AST,

@teleporthq/teleport-plugin-common

Common building and modelating functions for ASTs and HASTs

MIT
Latest version published 2 days ago

Package Health Score

82 / 100
Full package analysis

Similar packages