Function transpile

Transpile a JavaScript program to an Aran program.

AranInputError If conf is invalid or if the top level properties of file are invalid.

AranSyntaxError If there is problem with the AST at file.root either because there is an early syntax error or because it is not a valid ESTree program.

  • Type Parameters

    • hash extends string | number = string | number

      The branded type for the result of conf.digest

    • atom extends Atom & {
          Tag: hash;
      } = Atom & {
          Tag: hash;
      }

      The branded types for the leafs of the output program.

    • path = unknown

      The type of file.path.

    Parameters

    • file: Partial<File<{
          FilePath: path;
      }>>

      The parsed JavaScript program to transpile.

    • Optionalconf: null | Partial<Config<{
          FilePath: path;
          NodeHash: hash;
      }>>

      Transpilation options.

    Returns Program<atom> & {
        warnings: Warning[];
    }

    The transpiled aran program along with warnings.