Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Only import babel-polyfill once #114

Merged
merged 1 commit into from
Jul 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions packages/react-sprucebot/lib/Sprucebot.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _register = require('babel-core/register');

var _register2 = _interopRequireDefault(_register);

var _babelPolyfill = require('babel-polyfill');

var _babelPolyfill2 = _interopRequireDefault(_babelPolyfill);
require('./require-babel-polyfill');

var _Avatar = require('./components/Avatar/Avatar');

Expand Down
12 changes: 12 additions & 0 deletions packages/react-sprucebot/lib/require-babel-polyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

exports.default = function () {
if (!global || !global._babelPolyfill) {
require('babel-core/register');
require('babel-polyfill');
}
}();
5 changes: 0 additions & 5 deletions packages/react-sprucebot/lib/skillskit/helpers/sharable.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,21 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

exports.default = function (config, Sharable) {

var actionGo = function actionGo(_ref) {
var actions = _ref.actions,
_ref$internal = _ref.internal,
internal = _ref$internal === undefined ? false : _ref$internal;


var newActions = false;

if (!internal && config && config.actionsToEvents) {

newActions = {};

Object.keys(config.actionsToEvents).map(function (namespace) {

//build namespace
newActions[namespace] = {};

Object.keys(config.actionsToEvents[namespace]).map(function (action) {

//save event
var event = config.actionsToEvents[namespace][action];

Expand Down
3 changes: 1 addition & 2 deletions packages/react-sprucebot/src/Sprucebot.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import register from 'babel-core/register'
import polyfill from 'babel-polyfill'
import './require-babel-polyfill'

import Avatar from './components/Avatar/Avatar'
import BotText from './components/BotText/BotText'
Expand Down
6 changes: 6 additions & 0 deletions packages/react-sprucebot/src/require-babel-polyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default (() => {
if (!global || !global._babelPolyfill) {
require('babel-core/register')
require('babel-polyfill')
}
})()