Skip to content

Commit

Permalink
chore: switch to babel 'env' preset in favor of 'es2015'
Browse files Browse the repository at this point in the history
Es2015 preset is deprecated now: https://babeljs.io/docs/en/env.html.
This also switches off {modules: false} babelrc option which makes the
bundle compatible with Jest and some other env configurations.

Fixes niksmr#52
Fixes niksmr#25
  • Loading branch information
artemv committed Jul 4, 2018
1 parent 3d9d8b5 commit e163017
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"presets": [
["es2015", { "modules": false }]
"env"
]
}
14 changes: 4 additions & 10 deletions dist/demo.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/demo.js.map

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions dist/ff-polyfill.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// Copy paste from https://gist.github.com/nuxodin/9250e56a3ce6c0446efa
export default function () {
'use strict';

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

exports.default = function () {
var w = window,
d = w.document;

Expand Down Expand Up @@ -34,3 +39,5 @@ export default function () {
});
}
};

; // Copy paste from https://gist.github.com/nuxodin/9250e56a3ce6c0446efa
28 changes: 22 additions & 6 deletions dist/maskedInput.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
'use strict';

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

var _inputmaskCore = require('inputmask-core');

var _inputmaskCore2 = _interopRequireDefault(_inputmaskCore);

var _ffPolyfill = require('./ff-polyfill');

var _ffPolyfill2 = _interopRequireDefault(_ffPolyfill);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

import InputMask from 'inputmask-core';
import ffpoly from './ff-polyfill'; // Firefox Polyfill for focus events
// Firefox Polyfill for focus events

ffpoly();
(0, _ffPolyfill2.default)();

export default {
exports.default = {
name: 'MaskedInput',
render: function render(h) {
return h('input', {
Expand Down Expand Up @@ -84,9 +99,9 @@ export default {

try {
if (this.mask instanceof Object) {
this.maskCore = new InputMask(this.mask);
this.maskCore = new _inputmaskCore2.default(this.mask);
} else {
this.maskCore = new InputMask({
this.maskCore = new _inputmaskCore2.default({
pattern: this.mask,
value: '',
placeholderChar: this.placeholderChar,
Expand Down Expand Up @@ -128,6 +143,7 @@ export default {
}
}
}
/* eslint-enable */
});
}
[].concat(_toConsumableArray(this.$refs.input.value)).reduce(function (memo, item) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"babel-core": "^6.0.0",
"babel-loader": "^7.0.0",
"babel-polyfill": "^6.22.0",
"babel-preset-es2015": "^6.0.0",
"babel-preset-env": "^1.7.0",
"cross-env": "^4.0.0",
"css-loader": "^0.28.0",
"eslint": "^3.19.0",
Expand Down

0 comments on commit e163017

Please sign in to comment.