How to use the babel-plugin-macros/package.version function in babel-plugin-macros

To help you get started, weโ€™ve selected a few babel-plugin-macros 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 fkling / astexplorer / website / src / parsers / js / transformers / babel-plugin-macros / index.js View on Github external
import compileModule from '../../../utils/compileModule';
import pkg from 'babel-plugin-macros/package';

const ID = 'babel-plugin-macros';
export default {
  id: ID,
  displayName: ID,
  version: pkg.version,
  homepage: pkg.homepage,

  defaultParserID: 'babylon7',

  loadTransformer(callback) {
    require([
      '../../../transpilers/babel',
      'babel7',
      'recast',
      'babel-plugin-macros',
    ], (transpile, babel, recast, macro) => callback({ transpile: transpile.default, babel, recast, macro}));
  },

  transform({ transpile, babel, recast, macro}, transformCode, code) {
    transformCode = transpile(transformCode);
    let transform = compileModule( // eslint-disable-line no-shadow

babel-plugin-macros

Allows you to build compile-time libraries

MIT
Latest version published 4 years ago

Package Health Score

79 / 100
Full package analysis