How to use the @babel/preset-flow.default function in @babel/preset-flow

To help you get started, we’ve selected a few @babel/preset-flow 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 facebook / jscodeshift / src / Worker.js View on Github external
function setup(tr, babel) {
  if (babel === 'babel') {
    require('@babel/register')({
      babelrc: false,
      presets: [
        [
          require('@babel/preset-env').default,
          {targets: {node: true}},
        ],
        /\.tsx?$/.test(tr) ?
          require('@babel/preset-typescript').default :
          require('@babel/preset-flow').default,
      ],
      plugins: [
        require('@babel/plugin-proposal-class-properties').default,
      ],
      extensions: [...DEFAULT_EXTENSIONS, '.ts', '.tsx'],
      // By default, babel register only compiles things inside the current working directory.
      // https://github.com/babel/babel/blob/2a4f16236656178e84b05b8915aab9261c55782c/packages/babel-register/src/node.js#L140-L157
      ignore: [
        // Ignore parser related files
        /@babel\/parser/,
        /\/flow-parser\//,
        /\/recast\//,
        /\/ast-types\//,
      ],
    });
  }
github kriasoft / react-app / packages / react-app-tools / config / babel.js View on Github external
// Do not transform modules to CJS
            modules: false,
          },
        ],
      [
        require('@babel/preset-react').default,
        {
          // Adds component stack to warning messages
          // Adds __self attribute to JSX which React will use for some warnings
          development: isEnvDevelopment || isEnvTest,
          // Will use the native built-in instead of trying to polyfill
          // behavior for any plugins that require one.
          useBuiltIns: true,
        },
      ],
      isFlowEnabled && [require('@babel/preset-flow').default],
    ].filter(Boolean),
    plugins: [
      // Experimental macros support. Will be documented after it's had some time
      // in the wild.
      require('babel-plugin-macros'),
      // Necessary to include regardless of the environment because
      // in practice some other transforms (such as object-rest-spread)
      // don't work without it: https://github.com/babel/babel/issues/7215
      require('@babel/plugin-transform-destructuring').default,
      // class { handleClick = () => { } }
      // Enable loose mode to use assignment instead of defineProperty
      // See discussion in https://github.com/facebook/create-react-app/issues/4263
      [
        require('@babel/plugin-proposal-class-properties').default,
        {
          loose: true,
github wilsson / papyrum / packages / babel-preset-papyrum / src / index.ts View on Github external
export default (api: any, opts: Config = DEFAULT_OPTS) => {
  console.log('BABEL opts', [
    require('@babel/preset-env').default,
    opts.flow && [require('@babel/preset-flow').default],
    opts.typescript && [require('@babel/preset-typescript').default],
    require('@babel/preset-react').default
  ].filter(Boolean));
  return {
    presets: [
      require('@babel/preset-env').default,
      opts.flow && [require('@babel/preset-flow').default],
      opts.typescript && [require('@babel/preset-typescript').default],
      require('@babel/preset-react').default
    ].filter(Boolean),
    plugins: [
      require.resolve('babel-plugin-export-metadata'),
      require('@babel/plugin-syntax-dynamic-import').default
    ]
  };
};
github wilsson / papyrum / packages / babel-preset-papyrum / dist / index.js View on Github external
exports.default = (function (api, opts) {
    if (opts === void 0) { opts = DEFAULT_OPTS; }
    return {
        presets: [
            require('@babel/preset-env').default,
            opts.flow && [require('@babel/preset-flow').default],
            opts.typescript && [require('@babel/preset-typescript').default],
            require('@babel/preset-react').default
        ].filter(Boolean),
        plugins: [
            require('@babel/plugin-syntax-dynamic-import').default
        ]
    };
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFLQSxJQUFNLFlBQVksR0FBVztJQUN6QixJQUFJLEVBQUUsS0FBSztJQUNYLFVBQVUsRUFBRSxLQUFLO0NBQ3BCLENBQUE7QUFFRCxtQkFBZSxVQUFDLEdBQVEsRUFBRSxJQUEyQjtJQUEzQixxQkFBQSxFQUFBLG1CQUEyQjtJQUNqRCxPQUFPO1FBQ0gsT0FBTyxFQUFFO1lBQ0wsT0FBTyxDQUFDLG1CQUFtQixDQUFDLENBQUMsT0FBTztZQUNwQyxJQUFJLENBQUMsSUFBSSxJQUFJLENBQUMsT0FBTyxDQUFDLG9CQUFvQixDQUFDLENBQUMsT0FBTyxDQUFDO1lBQ3BELElBQUksQ0FBQyxVQUFVLElBQUksQ0FBQyxPQUFPLENBQUMsMEJBQTBCLENBQUMsQ0FBQyxPQUFPLENBQUM7WUFDaEUsT0FBTyxDQUFDLHFCQUFxQixDQUFDLENBQUMsT0FBTztTQUN6QyxDQUFDLE1BQU0sQ0FBQyxPQUFPLENBQUM7UUFDakIsT0FBTyxFQUFFO1lBQ0wsT0FBTyxDQUFDLHFDQUFxQyxDQUFDLENBQUMsT0FBTztTQUN6RDtLQUNKLENBQUE7QUFDTCxDQUFDLEVBQUEifQ==
github doczjs / docz / packages / babel-preset-docz / src / config.ts View on Github external
],
    (opts.env.prod || opts.env.dev) && [
      require('@babel/preset-env').default,
      {
        useBuiltIns: 'entry',
        modules: false,
      },
    ],
    [
      require('@babel/preset-react').default,
      {
        development: opts.env.dev,
        useBuiltIns: true,
      },
    ],
    opts.flow && [require('@babel/preset-flow').default],
    opts.typescript && [require('@babel/preset-typescript').default],
  ].filter(Boolean)

  const plugins: any[] = [
    require('babel-plugin-macros'),
    require('@babel/plugin-transform-destructuring').default,
    [
      require('@babel/plugin-proposal-class-properties').default,
      { loose: true },
    ],
    [
      require('@babel/plugin-proposal-object-rest-spread').default,
      { useBuiltIns: true },
    ],
    [
      require('@babel/plugin-transform-runtime').default,
github ikatun / nnode / config.js View on Github external
function getBabelConfiguration(nodeVersion, entryPointPath, omitExtensions) {
  var language = entryPointPath.endsWith('.ts') || entryPointPath.endsWith('.tsx') ? 'ts' : 'js';

  var presets = [];
  if (language === 'js') {
    presets.push([require('@babel/preset-flow').default]);
  }

  if (language === 'ts') {
    presets.push([
      require('./build/babel-preset-typescript').default
    ]);
  }

  presets.push([
    require('@babel/preset-env').default,
    {
      targets: {node: nodeVersion || 'current'}
    }
  ]);

  var plugins = [];

@babel/preset-flow

Babel preset for all Flow plugins.

MIT
Latest version published 1 month ago

Package Health Score

95 / 100
Full package analysis

Popular @babel/preset-flow functions