chore: upgrade to babel v7
parent
99eae3605d
commit
0bd369144b
66
.babelrc
66
.babelrc
|
@ -1,66 +0,0 @@
|
|||
{
|
||||
"presets": ["react"],
|
||||
"plugins": [
|
||||
"check-es2015-constants",
|
||||
"transform-object-rest-spread",
|
||||
"transform-runtime",
|
||||
[
|
||||
"module-resolver",
|
||||
{
|
||||
"alias": {
|
||||
"babel-runtime/core-js/object/get-prototype-of": "./src/polyfills/objectGetPrototypeOf",
|
||||
"babel-runtime/helpers/extends": "./src/polyfills/extends",
|
||||
"babel-runtime/helpers/inherits": "./src/polyfills/inherits",
|
||||
"babel-runtime/helpers/createClass": "./src/polyfills/createClass",
|
||||
"babel-runtime/helpers/possibleConstructorReturn": "./src/polyfills/possibleConstructorReturn",
|
||||
"babel-runtime/helpers/classCallCheck": "./src/polyfills/classCallCheck",
|
||||
"babel-runtime/core-js/object/keys": "./src/polyfills/keys"
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
"transform-define", "scripts/define.js"
|
||||
]
|
||||
],
|
||||
"env": {
|
||||
"legacy-es": {
|
||||
"plugins": [
|
||||
"transform-es2015-arrow-functions",
|
||||
"transform-es2015-block-scoped-functions",
|
||||
"transform-es2015-block-scoping",
|
||||
"transform-es2015-classes",
|
||||
"transform-es2015-computed-properties",
|
||||
"transform-es2015-destructuring",
|
||||
"transform-es2015-duplicate-keys",
|
||||
"transform-es2015-for-of",
|
||||
"transform-es2015-function-name",
|
||||
"transform-es2015-literals",
|
||||
"transform-es2015-object-super",
|
||||
"transform-es2015-parameters",
|
||||
"transform-es2015-shorthand-properties",
|
||||
"transform-es2015-spread",
|
||||
"transform-es2015-sticky-regex",
|
||||
"transform-es2015-template-literals",
|
||||
"transform-es2015-unicode-regex",
|
||||
"transform-regenerator"
|
||||
]
|
||||
},
|
||||
"legacy-cjs": {
|
||||
"plugins": [
|
||||
"transform-es2015-modules-commonjs"
|
||||
]
|
||||
},
|
||||
"test": {
|
||||
"presets": [
|
||||
[
|
||||
"env",
|
||||
{
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
const { devDependencies } = require('./package.json')
|
||||
|
||||
module.exports = {
|
||||
presets: ['@babel/preset-react'],
|
||||
plugins: [
|
||||
'@babel/plugin-transform-runtime',
|
||||
[
|
||||
'babel-plugin-transform-define',
|
||||
{
|
||||
'process.env.NODE_ENV': 'production',
|
||||
EMOJI_DATASOURCE_VERSION: devDependencies['emoji-datasource'],
|
||||
},
|
||||
],
|
||||
],
|
||||
env: {
|
||||
'legacy-es': {
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
modules: false,
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
'legacy-cjs': {
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
modules: 'cjs',
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
modern: {
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: {
|
||||
chrome: '77',
|
||||
edge: '18',
|
||||
firefox: '71',
|
||||
safari: '13',
|
||||
},
|
||||
modules: false,
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
test: {
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: {
|
||||
node: 'current',
|
||||
}
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
32
package.json
32
package.json
|
@ -20,37 +20,33 @@
|
|||
},
|
||||
"homepage": "https://github.com/missive/emoji-mart",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0",
|
||||
"prop-types": "^15.6.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^0.14.0 || ^15.0.0-0 || ^16.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0",
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/plugin-transform-runtime": "^7.7.6",
|
||||
"@babel/preset-env": "^7.0.0",
|
||||
"@babel/preset-react": "7.0.0",
|
||||
"@storybook/addon-actions": "^3.2.11",
|
||||
"@storybook/addon-knobs": "^3.2.10",
|
||||
"@storybook/addon-links": "^3.2.10",
|
||||
"@storybook/addon-options": "3.2.10",
|
||||
"@storybook/react": "^3.2.11",
|
||||
"auto-changelog": "1.12.0",
|
||||
"babel-cli": "^6.0.0",
|
||||
"babel-core": "^6.0.0",
|
||||
"babel-jest": "^23.6.0",
|
||||
"babel-loader": "^7.0.0",
|
||||
"babel-plugin-module-resolver": "2.7.1",
|
||||
"babel-plugin-transform-define": "^1.3.0",
|
||||
"babel-plugin-transform-es2015-destructuring": "6.9.0",
|
||||
"babel-plugin-transform-object-rest-spread": "6.8.0",
|
||||
"babel-plugin-transform-runtime": "^6.23.0",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-preset-es2015": "6.6.0",
|
||||
"babel-preset-react": "6.5.0",
|
||||
"babel-runtime": "^6.26.0",
|
||||
"babel-jest": "^24.9.0",
|
||||
"babel-loader": "^8.0.0",
|
||||
"babel-plugin-transform-define": "^2.0.0",
|
||||
"emoji-datasource": "4.0.4",
|
||||
"emojilib": "^2.2.1",
|
||||
"enzyme": "^3.9.0",
|
||||
"enzyme-adapter-react-16": "^1.11.2",
|
||||
"inflection": "1.10.0",
|
||||
"jest": "^23.0.0",
|
||||
"jest": "^24.9.0",
|
||||
"mkdirp": "0.5.1",
|
||||
"prettier": "^1.16.4",
|
||||
"react": "^16.0.0",
|
||||
|
@ -65,12 +61,12 @@
|
|||
"clean": "rm -rf dist/ dist-es/ dist-modern/",
|
||||
"build:data": "node scripts/build-data",
|
||||
"build:dist": "npm run build:cjs && npm run build:es && npm run build:modern",
|
||||
"build:cjs": "BABEL_ENV=legacy-cjs babel src --out-dir dist --copy-files --ignore '**/*.test.js'",
|
||||
"build:es": "BABEL_ENV=legacy-es babel src --out-dir dist-es --copy-files --ignore '**/*.test.js'",
|
||||
"build:modern": "babel src --out-dir dist-modern --copy-files --ignore '**/*.test.js'",
|
||||
"build:cjs": "BABEL_ENV=legacy-cjs babel src --out-dir dist --ignore '**/__tests__/*'",
|
||||
"build:es": "BABEL_ENV=legacy-es babel src --out-dir dist-es --ignore '**/__tests__/*'",
|
||||
"build:modern": "BABEL_ENV=modern babel src --out-dir dist-modern --ignore '**/__tests__/*'",
|
||||
"build:docs": "cp css/emoji-mart.css docs && webpack --config ./docs/webpack.config.js",
|
||||
"build": "npm run clean && npm run build:dist",
|
||||
"watch": "BABEL_ENV=cjs babel src --watch --out-dir dist --copy-files --ignore '**/*.test.js'",
|
||||
"watch": "BABEL_ENV=legacy-cjs babel src --watch --out-dir dist --ignore '**/__tests__/*'",
|
||||
"start": "npm run watch",
|
||||
"react:clean": "rimraf node_modules/{react,react-dom,react-addons-test-utils}",
|
||||
"react:14": "npm run react:clean && npm i react@^0.14 react-dom@^0.14 react-addons-test-utils@^0.14 --save-dev",
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
var pack = require('../package.json')
|
||||
|
||||
module.exports = {
|
||||
'process.env.NODE_ENV': 'production',
|
||||
EMOJI_DATASOURCE_VERSION: pack.devDependencies['emoji-datasource'],
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
export default function(instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
throw new TypeError('Cannot call a class as a function')
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
const _Object = Object
|
||||
|
||||
export default (function createClass() {
|
||||
function defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var descriptor = props[i]
|
||||
descriptor.enumerable = descriptor.enumerable || false
|
||||
descriptor.configurable = true
|
||||
if ('value' in descriptor) descriptor.writable = true
|
||||
_Object.defineProperty(target, descriptor.key, descriptor)
|
||||
}
|
||||
}
|
||||
|
||||
return function(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) defineProperties(Constructor.prototype, protoProps)
|
||||
if (staticProps) defineProperties(Constructor, staticProps)
|
||||
return Constructor
|
||||
}
|
||||
})()
|
|
@ -1,16 +0,0 @@
|
|||
const _Object = Object
|
||||
|
||||
export default _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
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
const _Object = Object
|
||||
|
||||
export default function inherits(subClass, superClass) {
|
||||
if (typeof superClass !== 'function' && superClass !== null) {
|
||||
throw new TypeError(
|
||||
'Super expression must either be null or a function, not ' +
|
||||
typeof superClass,
|
||||
)
|
||||
}
|
||||
|
||||
subClass.prototype = _Object.create(superClass && superClass.prototype, {
|
||||
constructor: {
|
||||
value: subClass,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
},
|
||||
})
|
||||
if (superClass) {
|
||||
_Object.setPrototypeOf
|
||||
? _Object.setPrototypeOf(subClass, superClass)
|
||||
: (subClass.__proto__ = superClass)
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty,
|
||||
hasDontEnumBug = !{ toString: null }.propertyIsEnumerable('toString'),
|
||||
dontEnums = [
|
||||
'toString',
|
||||
'toLocaleString',
|
||||
'valueOf',
|
||||
'hasOwnProperty',
|
||||
'isPrototypeOf',
|
||||
'propertyIsEnumerable',
|
||||
'constructor',
|
||||
],
|
||||
dontEnumsLength = dontEnums.length
|
||||
|
||||
export default function(obj) {
|
||||
if (typeof obj !== 'function' && (typeof obj !== 'object' || obj === null)) {
|
||||
throw new TypeError('Object.keys called on non-object')
|
||||
}
|
||||
|
||||
var result = [],
|
||||
prop,
|
||||
i
|
||||
|
||||
for (prop in obj) {
|
||||
if (hasOwnProperty.call(obj, prop)) {
|
||||
result.push(prop)
|
||||
}
|
||||
}
|
||||
|
||||
if (hasDontEnumBug) {
|
||||
for (i = 0; i < dontEnumsLength; i++) {
|
||||
if (hasOwnProperty.call(obj, dontEnums[i])) {
|
||||
result.push(dontEnums[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
const _Object = Object
|
||||
|
||||
export default _Object.getPrototypeOf ||
|
||||
function(O) {
|
||||
O = Object(O)
|
||||
|
||||
if (typeof O.constructor === 'function' && O instanceof O.constructor) {
|
||||
return O.constructor.prototype
|
||||
}
|
||||
|
||||
return O instanceof Object ? Object.prototype : null
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
export default function possibleConstructorReturn(self, call) {
|
||||
if (!self) {
|
||||
throw new ReferenceError(
|
||||
"this hasn't been initialised - super() hasn't been called",
|
||||
)
|
||||
}
|
||||
|
||||
return call && (typeof call === 'object' || typeof call === 'function')
|
||||
? call
|
||||
: self
|
||||
}
|
Loading…
Reference in New Issue