How to use the @teleporthq/teleport-uidl-builders.componentDependency function in @teleporthq/teleport-uidl-builders

To help you get started, we’ve selected a few @teleporthq/teleport-uidl-builders 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-import-statements / __tests__ / index.ts View on Github external
it('creates 3 AST chunks from the different types of dependencies', async () => {
    const structure: ComponentStructure = {
      chunks: [],
      uidl: null,
      options: {},
      dependencies: {
        package: componentDependency('package', 'npm-package', '1.0.0'),
        library: componentDependency('library', 'project-lib', '2.0.0'),
        local: componentDependency('local', '../../components/local'),
      },
    }

    const { chunks } = await plugin(structure)
    expect(chunks.length).toBe(3)
    expect(chunks[0].name).toBe('test-lib')
    expect(chunks[1].name).toBe('test-pack')
    expect(chunks[2].name).toBe('test-local')
  })
github teleporthq / teleport-code-generators / packages / teleport-plugin-import-statements / __tests__ / index.ts View on Github external
it('pushes chunks for imports even when no statement is needed', async () => {
    const structure: ComponentStructure = {
      chunks: [],
      options: {},
      uidl: null,
      dependencies: {
        local: componentDependency('local', '../../components/local'),
      },
    }

    const { chunks } = await plugin(structure)
    expect(chunks.length).toBe(3)
  })
})
github teleporthq / teleport-code-generators / packages / teleport-plugin-import-statements / __tests__ / index.ts View on Github external
it('creates 3 AST chunks from the different types of dependencies', async () => {
    const structure: ComponentStructure = {
      chunks: [],
      uidl: null,
      options: {},
      dependencies: {
        package: componentDependency('package', 'npm-package', '1.0.0'),
        library: componentDependency('library', 'project-lib', '2.0.0'),
        local: componentDependency('local', '../../components/local'),
      },
    }

    const { chunks } = await plugin(structure)
    expect(chunks.length).toBe(3)
    expect(chunks[0].name).toBe('test-lib')
    expect(chunks[1].name).toBe('test-pack')
    expect(chunks[2].name).toBe('test-local')
  })
github teleporthq / teleport-code-generators / packages / teleport-component-generator-vue / __tests__ / integration / component-dependency.ts View on Github external
const uidl = (dependency) => {
  return component(
    'Component With Dependencies',
    elementNode(
      dependency.name,
      {},
      [],
      componentDependency(dependency.type, dependency.path, dependency.version, dependency.option)
    ),
    {},
    { title: definition('boolean', true) }
  )
}
github teleporthq / teleport-code-generators / packages / teleport-component-generator-react / __tests__ / integration / component-dependency.ts View on Github external
const uidl = (dependency) => {
  return component(
    'Component with dependencies',
    elementNode(
      dependency.name,
      {},
      [],
      componentDependency(dependency.type, dependency.path, dependency.version, dependency.option)
    ),
    {},
    { title: definition('boolean', true) }
  )
}