How to use the @babel/standalone.registerPreset function in @babel/standalone

To help you get started, we’ve selected a few @babel/standalone 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 babel / babel / packages / babel-preset-env-standalone / src / index.js View on Github external
/* global VERSION */

import { registerPreset } from "@babel/standalone";
import babelPresetEnv from "@babel/preset-env";

registerPreset("env", babelPresetEnv);

export const version = VERSION;
github neo-one-suite / neo-one / packages / neo-one-editor / src / engine / main / transpile / transpile.ts View on Github external
const initialize = () => {
  if (initialized) {
    return;
  }
  initialized = true;

  Babel.registerPreset('@babel/preset-react', babelPresetReact);
  Babel.registerPlugin('@babel/plugin-proposal-class-properties', babelPluginProposalClassProperties);
  Babel.registerPlugin('@babel/plugin-proposal-object-rest-spread', babelPluginProposalObjectRestSprerad);
  Babel.registerPlugin('@babel/plugin-proposal-optional-catch-binding', babelPluginProposalOptionalCatchBinding);
  Babel.registerPlugin('@babel/plugin-proposal-async-generator-functions', babelPluginProposalAsyncGeneratorFunctions);
  Babel.registerPlugin('@babel/plugin-proposal-numeric-separator', babelPluginProposalNumericSeparator);
  Babel.registerPlugin('@babel/plugin-transform-typescript', babelPluginTransformTypeScript);
  Babel.registerPlugin('@babel/plugin-transform-modules-commonjs', babelPluginTransformModulesCommonJS);
};
github react-bootstrap / react-overlays / www / src / components / Playground.js View on Github external
import getOffset from 'dom-helpers/offset';
import PropTypes from 'prop-types';
import React, { useEffect, useReducer, useRef, useState } from 'react';
import ReactDOM, { findDOMNode } from 'react-dom';
import { LiveEditor, LiveError, LivePreview, LiveProvider } from 'react-live';
import * as ReactOverlays from 'react-overlays';
import Transition, {
  ENTERED,
  ENTERING,
} from 'react-transition-group/Transition';
import * as Babel from '@babel/standalone';
import { css as emotionCss } from '@emotion/core';
import emotionStyled from '@emotion/styled';
import injectCss from '../injectCss';

Babel.registerPreset('env', require('@babel/preset-env'));
Babel.registerPlugin(
  'class-properties',
  require('@babel/plugin-proposal-class-properties'),
);

const scope = {
  useState,
  useReducer,
  useRef,
  useEffect,

  ReactDOM,
  findDOMNode,
  injectCss,
  ...ReactOverlays,
  getOffset,