inula/packages/transpiler/babel-api
Hoikan f32da0e9c7 refactor(proposal): use bitmap instead of dependency map 2024-04-28 21:02:37 +08:00
..
src refactor(proposal): use bitmap instead of dependency map 2024-04-28 21:02:37 +08:00
README.md refactor(proposal): use bitmap instead of dependency map 2024-04-28 21:02:37 +08:00
package.json refactor(proposal): use bitmap instead of dependency map 2024-04-28 21:02:37 +08:00

README.md

@openinlua/babel-api

A package that encapsulates the babel API for use in the transpiler.

To implement the dependency injection pattern, the package exports a function that registers the babel API in the transpiler.

import { registerBabelAPI } from '@openinlua/babel-api';

function plugin(api: typeof babel) {
  registerBabelAPI(api);

  // Your babel plugin code here.
}

And then you can import to use it.

types can use as a type or as a namespace for the babel API.

import { types as t } from '@openinlua/babel-api';

t.isIdentifier(node as t.Node);