Skip to content

Commit

Permalink
updated build dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jackmoore committed Mar 23, 2018
1 parent c025a27 commit 5ee542d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 30 deletions.
12 changes: 9 additions & 3 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var pkg = require('./package.json');
var fs = require('fs');
var ugly = require('uglify-js');
var jshint = require('jshint').JSHINT;
var babel = require('babel');
var babel = require('babel-core');
var gaze = require('gaze');

function lint(full) {
Expand All @@ -14,6 +14,7 @@ function lint(full) {
eqeqeq: true,
eqnull: true,
noarg: true,
immed: false,
predef: ['define', 'module', 'exports', 'Map']
});

Expand All @@ -29,7 +30,7 @@ function lint(full) {
}

function build(code) {
var minified = ugly.minify(code, {fromString: true}).code;
var minified = ugly.minify(code).code;
var header = [
`/*!`,
` ${pkg.name} ${pkg.version}`,
Expand All @@ -45,7 +46,12 @@ function build(code) {
}

function transform(filepath) {
babel.transformFile(filepath, {modules: 'umd'}, function (err,res) {
babel.transformFile(filepath, {
plugins: [
"add-module-exports", ["transform-es2015-modules-umd", {"strict": true, "noInterop": true}]
],
presets: ["env"],
}, function (err,res) {
if (err) {
return console.log(err);
} else {
Expand Down
39 changes: 20 additions & 19 deletions dist/autosize.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/*!
Autosize 4.0.0
autosize 4.0.0
license: MIT
http://www.jacklmoore.com/autosize
*/
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'module'], factory);
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module);
if (typeof define === "function" && define.amd) {
define(['module', 'exports'], factory);
} else if (typeof exports !== "undefined") {
factory(module, exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod);
factory(mod, mod.exports);
global.autosize = mod.exports;
}
})(this, function (exports, module) {
})(this, function (module, exports) {
'use strict';

var map = typeof Map === "function" ? new Map() : (function () {
var map = typeof Map === "function" ? new Map() : function () {
var keys = [];
var values = [];

Expand All @@ -35,15 +35,15 @@
values.push(value);
}
},
'delete': function _delete(key) {
delete: function _delete(key) {
var index = keys.indexOf(key);
if (index > -1) {
keys.splice(index, 1);
values.splice(index, 1);
}
}
};
})();
}();

var createEvent = function createEvent(name) {
return new Event(name, { bubbles: true });
Expand All @@ -52,7 +52,7 @@
new Event('test');
} catch (e) {
// IE does not support `new Event()`
createEvent = function (name) {
createEvent = function createEvent(name) {
var evt = document.createEvent('Event');
evt.initEvent(name, true, false);
return evt;
Expand All @@ -63,7 +63,7 @@
if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;

var heightOffset = null;
var clientWidth = ta.clientWidth;
var clientWidth = null;
var cachedHeight = null;

function init() {
Expand Down Expand Up @@ -160,7 +160,7 @@
// Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;

// The actual height not matching the style height (set via the resize method) indicates that
// The actual height not matching the style height (set via the resize method) indicates that
// the max-height has been exceeded, in which case the overflow should be allowed.
if (actualHeight !== styleHeight) {
if (computed.overflowY === 'hidden') {
Expand Down Expand Up @@ -195,7 +195,7 @@
}
};

var destroy = (function (style) {
var destroy = function (style) {
window.removeEventListener('resize', pageResize, false);
ta.removeEventListener('input', update, false);
ta.removeEventListener('keyup', update, false);
Expand All @@ -206,8 +206,8 @@
ta.style[key] = style[key];
});

map['delete'](ta);
}).bind(ta, {
map.delete(ta);
}.bind(ta, {
height: ta.style.height,
resize: ta.style.resize,
overflowY: ta.style.overflowY,
Expand Down Expand Up @@ -256,7 +256,7 @@

// Do nothing in Node.js environment and IE8 (or lower)
if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
autosize = function (el) {
autosize = function autosize(el) {
return el;
};
autosize.destroy = function (el) {
Expand All @@ -266,7 +266,7 @@
return el;
};
} else {
autosize = function (el, options) {
autosize = function autosize(el, options) {
if (el) {
Array.prototype.forEach.call(el.length ? el : [el], function (x) {
return assign(x, options);
Expand All @@ -288,5 +288,6 @@
};
}

module.exports = autosize;
exports.default = autosize;
module.exports = exports['default'];
});
4 changes: 2 additions & 2 deletions dist/autosize.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@
},
"dependencies": {},
"devDependencies": {
"babel": "^5.4.3",
"babel-core": "^6.26.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-es2015-modules-umd": "^6.24.1",
"babel-preset-env": "^1.6.1",
"gaze": "^1.1.2",
"jshint": "^2.9.4",
"uglify-js": "^2.7.4"
"jshint": "^2.9.5",
"uglify-js": "^3.3.16"
},
"scripts": {
"build": "node build"
Expand Down
6 changes: 3 additions & 3 deletions src/autosize.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function assign(ta) {
if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;

let heightOffset = null;
let clientWidth = ta.clientWidth;
let clientWidth = null;
let cachedHeight = null;

function init() {
Expand Down Expand Up @@ -173,7 +173,7 @@ function assign(ta) {
}
};

const destroy = style => {
const destroy = (style => {
window.removeEventListener('resize', pageResize, false);
ta.removeEventListener('input', update, false);
ta.removeEventListener('keyup', update, false);
Expand All @@ -185,7 +185,7 @@ function assign(ta) {
});

map.delete(ta);
}.bind(ta, {
}).bind(ta, {
height: ta.style.height,
resize: ta.style.resize,
overflowY: ta.style.overflowY,
Expand Down

0 comments on commit 5ee542d

Please sign in to comment.