How to use @babel/plugin-proposal-object-rest-spread - 10 common examples

To help you get started, we’ve selected a few @babel/plugin-proposal-object-rest-spread 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 / docusaurus / packages / docusaurus-1.x / lib / build-files.js View on Github external
/**
 * Copyright (c) 2017-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

require('@babel/polyfill');
require('@babel/register')({
  babelrc: false,
  only: [__dirname, `${process.cwd()}/core`],
  plugins: [
    require('./server/translate-plugin.js'),
    require('@babel/plugin-proposal-class-properties').default,
    require('@babel/plugin-proposal-object-rest-spread').default,
  ],
  presets: [
    require('@babel/preset-react').default,
    require('@babel/preset-env').default,
  ],
});

// initial check that required files are present
const chalk = require('chalk');
const fs = require('fs');

const CWD = process.cwd();

if (!fs.existsSync(`${CWD}/siteConfig.js`)) {
  console.error(
    chalk.red('Error: No siteConfig.js file found in website folder!'),
github facebook / metro / packages / metro-babel-register / src / babel-register.js View on Github external
* This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @format
 */
'use strict';

const escapeRegExp = require('escape-string-regexp');
const path = require('path');
require('./node-polyfills');

var _only = [];

const PLUGINS = [
  [require('@babel/plugin-transform-flow-strip-types').default],
  [require('@babel/plugin-proposal-object-rest-spread').default],
  [require('@babel/plugin-proposal-class-properties').default],
  [require('@babel/plugin-transform-modules-commonjs').default],
  [require('@babel/plugin-proposal-nullish-coalescing-operator').default],
  [require('@babel/plugin-proposal-optional-catch-binding').default],
  [require('@babel/plugin-proposal-optional-chaining').default],
];

if (/^v[0-7]\./.test(process.version)) {
  PLUGINS.push([require('@babel/plugin-transform-async-to-generator').default]);
}

function registerOnly(onlyList) {
  // This prevents `babel-register` from transforming the code of the
  // plugins/presets that we are require-ing themselves before setting up the
  // actual config.
  require('@babel/register')({only: [], babelrc: false});
github polakowo / datadocs / website / node_modules / docusaurus / lib / write-translations.js View on Github external
/**
 * Copyright (c) 2017-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

/* generate the i18n/en.json file */

require('@babel/register')({
  babelrc: false,
  only: [__dirname, `${process.cwd()}/core`],
  plugins: [
    require('./server/translate-plugin.js'),
    require('@babel/plugin-proposal-class-properties').default,
    require('@babel/plugin-proposal-object-rest-spread').default,
  ],
  presets: [
    require('@babel/preset-react').default,
    require('@babel/preset-env').default,
  ],
});

const traverse = require('@babel/traverse').default;
const babylon = require('babylon');
const fs = require('fs-extra');
const glob = require('glob');
const mkdirp = require('mkdirp');
const nodePath = require('path');
const _ = require('lodash');

const readMetadata = require('./server/readMetadata.js');
github SUI-Components / sui / packages / babel-preset-sui / src / index.js View on Github external
return cleanList([
    require('@babel/plugin-syntax-dynamic-import').default,
    require('@babel/plugin-syntax-export-default-from').default,
    require('@babel/plugin-syntax-export-namespace-from').default,
    require('@babel/plugin-proposal-optional-chaining').default,
    require('@babel/plugin-proposal-nullish-coalescing-operator').default,
    [require('@babel/plugin-proposal-decorators').default, {legacy: true}],
    [require('@babel/plugin-proposal-class-properties').default, {loose: true}],
    [
      require('babel-plugin-transform-react-remove-prop-types').default,
      {
        wrap: true
      }
    ],
    [
      require('@babel/plugin-proposal-object-rest-spread').default,
      {useBuiltIns: true} // asume Object.assign is available by browser or polyfill
    ],
    [
      require('@babel/plugin-transform-runtime').default,
      {
        corejs: false,
        useESModules: true,
        regenerator: true
      }
    ]
  ])
}
github kriasoft / react-app / packages / react-app-tools / config / babel.js View on Github external
// 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,
        },
      ],
      // The following two plugins use Object.assign directly, instead of Babel's
      // extends helper. Note that this assumes `Object.assign` is available.
      // { ...todo, completed: true }
      [
        require('@babel/plugin-proposal-object-rest-spread').default,
        {
          useBuiltIns: true,
        },
      ],
      // Polyfills the runtime needed for async/await and generators
      !isEnvNode && [
        require('@babel/plugin-transform-runtime').default,
        {
          helpers: false,
          polyfill: false,
          regenerator: true,
        },
      ],
      isEnvProduction && [
        // Remove PropTypes from production build
        require('babel-plugin-transform-react-remove-prop-types').default,
github awto / effectfuljs / packages / debugger / config / babel / preset-zero-config.js View on Github external
exclude: [
          // already done or not needed
          "transform-regenerator",
          "transform-shorthand-properties",
          "transform-classes",
          "transform-typeof-symbol",
          "transform-async-to-generator",
          ...((opts.env && opts.env.exclude) || [])
        ]
      }
    ],
    {
      plugins: [
        require("@babel/plugin-syntax-dynamic-import").default,
        [
          require("@babel/plugin-proposal-object-rest-spread").default,
          {
            useBuiltIns: true
          }
        ],
        process.env.EFFECTFUL_DEBUGGER_NODE &&
          require("babel-plugin-dynamic-import-node")
      ].filter(Boolean)
    }
  );
  const tsOpts = { allowNamespaces: opts.tsAllowNamespaces };
  if (opts.jsxPragma) tsOpts.jsxPragma = opts.jsxPragma;
  if (opts.typescript !== false) {
    /*
    result.presets.unshift({
      plugins: [
        require("./ts-no-consts"),
github polakowo / datadocs / website / node_modules / docusaurus / lib / version.js View on Github external
#!/usr/bin/env node

/**
 * Copyright (c) 2017-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

require('@babel/register')({
  babelrc: false,
  only: [__dirname, `${process.cwd()}/core`],
  plugins: [
    require('./server/translate-plugin.js'),
    require('@babel/plugin-proposal-class-properties').default,
    require('@babel/plugin-proposal-object-rest-spread').default,
  ],
  presets: [
    require('@babel/preset-react').default,
    require('@babel/preset-env').default,
  ],
});

const program = require('commander');
const chalk = require('chalk');
const glob = require('glob');
const fs = require('fs-extra');
const mkdirp = require('mkdirp');
const path = require('path');

const readMetadata = require('./server/readMetadata.js');
const utils = require('./server/utils.js');
github welovekpop / munar / packages / babel-preset-munar / index.js View on Github external
module.exports = {
  presets: [
    [require('@babel/preset-env').default, {
      targets: { node: 8 },
    }]
  ],
  plugins: [
    [require('@babel/plugin-proposal-decorators').default, {
      legacy: true
    }],
    [require('@babel/plugin-proposal-class-properties').default, {
      loose: true
    }],
    require('@babel/plugin-proposal-object-rest-spread').default,
    require('@babel/plugin-proposal-export-default-from').default,
    require('@babel/plugin-proposal-export-namespace-from').default
  ]
}
github rails / webpacker / lib / install / examples / react / babel.config.js View on Github external
}
      ]
    ].filter(Boolean),
    plugins: [
      require('babel-plugin-macros'),
      require('@babel/plugin-syntax-dynamic-import').default,
      isTestEnv && require('babel-plugin-dynamic-import-node'),
      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,
        {
          helpers: false,
          regenerator: true,
          corejs: false
        }
      ],
      [
        require('@babel/plugin-transform-regenerator').default,
        {
          async: false
github broadinstitute / single_cell_portal_core / babel.config.js View on Github external
isTestEnv && require('babel-plugin-dynamic-import-node'),
      require('@babel/plugin-transform-destructuring').default,
      [
        require('@babel/plugin-proposal-class-properties').default,
        {
          loose: true
        }
      ],
      [
        require("@babel/plugin-proposal-private-methods").default,
        {
          loose: true
        }
      ],
      [
        require('@babel/plugin-proposal-object-rest-spread').default,
        {
          useBuiltIns: true
        }
      ],
      [
        require('@babel/plugin-transform-runtime').default,
        {
          helpers: false,
          regenerator: true,
          corejs: false
        }
      ],
      [
        require('@babel/plugin-transform-regenerator').default,
        {
          async: false

@babel/plugin-proposal-object-rest-spread

Compile object rest and spread to ES5

MIT
Latest version published 2 years ago

Package Health Score

72 / 100
Full package analysis

Popular @babel/plugin-proposal-object-rest-spread functions