How to use the idyll-ast.convertV1ToV2 function in idyll-ast

To help you get started, we’ve selected a few idyll-ast 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 idyll-lang / idyll / packages / idyll-compiler / src / index.js View on Github external
);
  } catch (err) {
    console.warn(`\nError parsing Idyll markup:\n${err.message}`);
    return new Promise((resolve, reject) => reject(err));
  }

  let astTransform = Processor(output, options)
    .pipe(hoistVariables)
    .pipe(flattenChildren)
    .pipe(makeFullWidth)
    .pipe(wrapText)
    .pipe(cleanResults)
    .pipe(autoLinkify)
    .end();

  astTransform = convertV1ToV2(astTransform);

  if (options.postProcessors) {
    // Turn them all into promises
    const promises = options.postProcessors.map(f => {
      return ast => {
        return new Promise((resolve, reject) => {
          if (f.length === 2) {
            f(ast, (err, value) => {
              if (err) {
                return reject(err);
              }
              resolve(value);
            });
          } else {
            resolve(f(ast));
          }