How to use @teleporthq/teleport-uidl-resolver - 1 common examples

To help you get started, we’ve selected a few @teleporthq/teleport-uidl-resolver 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-component-generator / src / index.ts View on Github external
const createComponentGenerator = ({
  mappings = [],
  plugins = [],
  postprocessors = [],
}: GeneratorFactoryParams = {}): ComponentGenerator => {
  const validator = new Validator()
  const resolver = new Resolver([HTMLMapping as Mapping, ...mappings])
  const assemblyLine = new AssemblyLine(plugins)
  const chunksLinker = new Builder()
  const processors: PostProcessor[] = postprocessors

  const generateComponent = async (
    input: Record,
    options: GeneratorOptions = {}
  ): Promise => {
    if (!options.skipValidation) {
      const schemaValidationResult = validator.validateComponentSchema(input)
      if (!schemaValidationResult.valid) {
        throw new Error(schemaValidationResult.errorMsg)
      }
    }

    const uidl = Parser.parseComponentJSON(input)

@teleporthq/teleport-uidl-resolver

A small package that handles the transition from UIDL to HTML elements and has support for custom mappings.

MIT
Latest version published 1 month ago

Package Health Score

82 / 100
Full package analysis

Popular @teleporthq/teleport-uidl-resolver functions

Similar packages