Richard Macklin e24f07dfda Extract resolvePreset method to babel-core public API
This encapsulates the logic for turning an acceptable preset name into
the absolute path for that preset. It can be used to preprocess a
presets list to map each preset to its absolute path, which is necessary
if `babel.transform` is going to be executed on a file outside the
directory subtree where the presets are installed.

This adds a getPossiblePresetNames helper encapsulating the logic for
what preset names we should try to resolve, and the resolvePreset method
just calls this helper and actually resolves them.
2016-10-16 11:06:47 -07:00
..
2016-10-05 09:50:11 -04:00

babel-core

Babel compiler core.

Install

$ npm install babel-core

Usage

import * as babel from 'babel-core';

const code = `class Example {}`;
const result = babel.transform(code, { /* options */ });

result.code; // Generated code
result.map; // Sourcemap
result.ast; // AST

For more in depth documentation see: http://babeljs.io/docs/usage/api/