How to use the @babel/traverse/lib/path function in @babel/traverse

To help you get started, we’ve selected a few @babel/traverse 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 DubstepJS / core / src / utils / parse-js.js View on Github external
'importMeta',
            'bigInt',
            'optionalCatchBinding',
            'throwExpressions',
            ['pipelineOperator', {proposal: 'minimal'}],
            'nullishCoalescingOperator',
          ],
          tokens: true,
        });
      },
    },
  });

  // ensure `path` has correct type to keep flow.js happy
  // we always override the dummy BabelPath with the `enter` visitor
  let path = new NodePath();
  traverse(ast, {
    enter(p) {
      if (p.isProgram()) path = p;
    },
  });

  return path;
};

@babel/traverse

The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes

MIT
Latest version published 20 days ago

Package Health Score

95 / 100
Full package analysis

Similar packages