From 5ee542d7bf6bbb6007c716182dfdac4d35a60e98 Mon Sep 17 00:00:00 2001 From: Jack Moore Date: Fri, 23 Mar 2018 15:23:31 -0400 Subject: [PATCH] updated build dependencies --- build.js | 12 +++++++++--- dist/autosize.js | 39 ++++++++++++++++++++------------------- dist/autosize.min.js | 4 ++-- package.json | 9 ++++++--- src/autosize.js | 6 +++--- 5 files changed, 40 insertions(+), 30 deletions(-) diff --git a/build.js b/build.js index 4bb2c52..3c52f4c 100644 --- a/build.js +++ b/build.js @@ -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) { @@ -14,6 +14,7 @@ function lint(full) { eqeqeq: true, eqnull: true, noarg: true, + immed: false, predef: ['define', 'module', 'exports', 'Map'] }); @@ -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}`, @@ -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 { diff --git a/dist/autosize.js b/dist/autosize.js index e0a21c7..f251c36 100644 --- a/dist/autosize.js +++ b/dist/autosize.js @@ -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 = []; @@ -35,7 +35,7 @@ values.push(value); } }, - 'delete': function _delete(key) { + delete: function _delete(key) { var index = keys.indexOf(key); if (index > -1) { keys.splice(index, 1); @@ -43,7 +43,7 @@ } } }; - })(); + }(); var createEvent = function createEvent(name) { return new Event(name, { bubbles: true }); @@ -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; @@ -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() { @@ -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') { @@ -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); @@ -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, @@ -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) { @@ -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); @@ -288,5 +288,6 @@ }; } - module.exports = autosize; + exports.default = autosize; + module.exports = exports['default']; }); \ No newline at end of file diff --git a/dist/autosize.min.js b/dist/autosize.min.js index 2a162d3..4e93616 100644 --- a/dist/autosize.min.js +++ b/dist/autosize.min.js @@ -1,6 +1,6 @@ /*! - Autosize 4.0.0 + autosize 4.0.0 license: MIT http://www.jacklmoore.com/autosize */ -!function(e,t){if("function"==typeof define&&define.amd)define(["exports","module"],t);else if("undefined"!=typeof exports&&"undefined"!=typeof module)t(exports,module);else{var n={exports:{}};t(n.exports,n),e.autosize=n.exports}}(this,function(e,t){"use strict";function n(e){function t(){var t=window.getComputedStyle(e,null);"vertical"===t.resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),s="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(s)&&(s=0),l()}function n(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function o(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function r(){var t=e.style.height,n=o(e),r=document.documentElement&&document.documentElement.scrollTop;e.style.height="";var i=e.scrollHeight+s;return 0===e.scrollHeight?void(e.style.height=t):(e.style.height=i+"px",u=e.clientWidth,n.forEach(function(e){e.node.scrollTop=e.scrollTop}),void(r&&(document.documentElement.scrollTop=r)))}function l(){r();var t=Math.round(parseFloat(e.style.height)),o=window.getComputedStyle(e,null),i="content-box"===o.boxSizing?Math.round(parseFloat(o.height)):e.offsetHeight;if(i!==t?"hidden"===o.overflowY&&(n("scroll"),r(),i="content-box"===o.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==o.overflowY&&(n("hidden"),r(),i="content-box"===o.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),a!==i){a=i;var l=d("autosize:resized");try{e.dispatchEvent(l)}catch(e){}}}if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!i.has(e)){var s=null,u=e.clientWidth,a=null,c=function(){e.clientWidth!==u&&l()},p=function(t){window.removeEventListener("resize",c,!1),e.removeEventListener("input",l,!1),e.removeEventListener("keyup",l,!1),e.removeEventListener("autosize:destroy",p,!1),e.removeEventListener("autosize:update",l,!1),Object.keys(t).forEach(function(n){e.style[n]=t[n]}),i.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",p,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",l,!1),window.addEventListener("resize",c,!1),e.addEventListener("input",l,!1),e.addEventListener("autosize:update",l,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",i.set(e,{destroy:p,update:l}),t()}}function o(e){var t=i.get(e);t&&t.destroy()}function r(e){var t=i.get(e);t&&t.update()}var i="function"==typeof Map?new Map:function(){var e=[],t=[];return{has:function(t){return e.indexOf(t)>-1},get:function(n){return t[e.indexOf(n)]},set:function(n,o){e.indexOf(n)===-1&&(e.push(n),t.push(o))},delete:function(n){var o=e.indexOf(n);o>-1&&(e.splice(o,1),t.splice(o,1))}}}(),d=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){d=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}var l=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?(l=function(e){return e},l.destroy=function(e){return e},l.update=function(e){return e}):(l=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return n(e,t)}),e},l.destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e},l.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],r),e}),t.exports=l}); \ No newline at end of file +!function(e,t){if("function"==typeof define&&define.amd)define(["module","exports"],t);else if("undefined"!=typeof exports)t(module,exports);else{var n={exports:{}};t(n,n.exports),e.autosize=n.exports}}(this,function(e,t){"use strict";var n,o,p="function"==typeof Map?new Map:(n=[],o=[],{has:function(e){return-1 { + const destroy = (style => { window.removeEventListener('resize', pageResize, false); ta.removeEventListener('input', update, false); ta.removeEventListener('keyup', update, false); @@ -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,