From defd069cb67edd53a0d7798af951b93e55423313 Mon Sep 17 00:00:00 2001 From: tunnckoCore Date: Sat, 11 Feb 2017 23:18:49 +0200 Subject: [PATCH] fix(rollup): fix bundles --- dist/mich-to-html.min.js | 2 +- dist/mich-to-html.min.js.gz | Bin 503 -> 513 bytes dist/mich-to-html.min.js.map | 2 +- package.json | 2 ++ rollup.config.js | 4 +++ yarn.lock | 59 +++++++++++++++++++++++++++++++++-- 6 files changed, 64 insertions(+), 5 deletions(-) diff --git a/dist/mich-to-html.min.js b/dist/mich-to-html.min.js index a47ddd0..489da36 100644 --- a/dist/mich-to-html.min.js +++ b/dist/mich-to-html.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(this,function(){function e(t,n){return t&&t.map(function(t){e(n(t),n)}),t}function t(e){var t="";for(var i in e){var r=e[i];i=i in n?n[i]:i,r="class"===i?r.join(" "):r;var a=typeof r;if(r===!0)t+=" "+i;else if(r===!1)t+=" "+i+'="false"';else if("string"===a||"number"===a)t+=" "+i+'="'+r+'"';else if("style"===i){var f="";for(var o in r)f+=o+": "+r[o]+";";t+=" "+i+'="'+f+'"'}else if("dataset"===i)for(var s in r)t+=" data-"+s+'="'+r[s]+'"'}return t}var n={className:"class",htmlFor:"for",httpEquiv:"http-equiv"};module.exports=function n(i){var r="";return e([].concat(i),function(e){e&&"text"===e.type&&(r+=e.value),e&&"element"===e.type&&(r+="<"+e.tagName+t(e.properties)+">",r+=n(e.children)+"")}),r}}); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.michToHtml=t()}(this,function(){function e(t,n){return t&&t.map(function(t){e(n(t),n)}),t}function t(e){var t="";for(var i in e){var r=e[i];i=i in n?n[i]:i,r="class"===i?r.join(" "):r;var a=typeof r;if(r===!0)t+=" "+i;else if(r===!1)t+=" "+i+'="false"';else if("string"===a||"number"===a)t+=" "+i+'="'+r+'"';else if("style"===i){var f="";for(var o in r)f+=o+": "+r[o]+";";t+=" "+i+'="'+f+'"'}else if("dataset"===i)for(var u in r)t+=" data-"+u+'="'+r[u]+'"'}return t}var n={className:"class",htmlFor:"for",httpEquiv:"http-equiv"},i=function n(i){var r="";return e([].concat(i),function(e){e&&"text"===e.type&&(r+=e.value),e&&"element"===e.type&&(r+="<"+e.tagName+t(e.properties)+">",r+=n(e.children)+"")}),r};return i}); //# sourceMappingURL=mich-to-html.min.js.map diff --git a/dist/mich-to-html.min.js.gz b/dist/mich-to-html.min.js.gz index d65dfde5ff755b0e257d4362ee8aa06e79b1c921..4fb386e1a003e3dd8e91e98399117d2bc04469cf 100644 GIT binary patch literal 513 zcmV+c0{;CUiwFP!0000217%XjlAJIQz3*4B?J7npG3g2`&&4^%i?fz#cC-Z&7R_e< z-4e;^B6WEEIvy9T$w^zoFd=>m_VgTc0x9XbMq5O9Ra-|*97AjNSZITLIG&u9-M1y~ zhHo`OB{81DMEjd*h>qjoU#V)p8$?Dt#Z{&A!w36>sxlCCj1Ia<=HmG6Bt{;e7=G)J zT4y4PV_H?JW;4`xfh>F;)$xS7Ig%Li+Y99)k^os@9Se$%w24NCllWPG&9v-|W@o&X z>cmONOVu&sVI6d@H{Mn!ly*OS7X$7R7!+o}21!R!@ z%~=G_Zsy!8QVr6;I&rlFS05MvOAzf?(dYJSPcSW}3wR@M`^mjh6{h15lLJ-dBkNM| ztU;st;m=lIq!7d<1{u0U%Xx8z>1jUz*_Z&?=dY{Wnp}~0&!-Z0jByNvSAFfc3cHD8 z=7g6oRM{d=0su>_(ENvi6A)fkXQ5<43|FP`9YU^hsGOE)_=qV zOgKE(O_l17XGiPxy{NIR%kibEYro`=?_S7o^h>hKFp*WI&FZ`f$9(h)xox8LmID9) Drrq~q literal 503 zcmVi>IzmAKtRk@Q|5lkGt1$}nJ+yUqAxLbOY3-xF&mN}zt*`{xp3Zne>Z-w{>s4NRo@7%{i3{q80O^*QME{u z0Kf`sRL?MQ3e4-`Jk-zp{j3|K8#GR$r3_v|;z7!r^MkAkgUTCEHxFYxCS0NEI+~qq tHZLNpTa)8E(KLS1-#)+PwagDIr&nPr>sqSy(T0OQ`41)z*t&iL003B@@3#N| diff --git a/dist/mich-to-html.min.js.map b/dist/mich-to-html.min.js.map index 9b675c7..650c08f 100644 --- a/dist/mich-to-html.min.js.map +++ b/dist/mich-to-html.min.js.map @@ -1 +1 @@ -{"version":3,"file":"mich-to-html.min.js","sources":["../index.js"],"sourcesContent":["/*!\n * mich-to-html \n *\n * Copyright (c) Charlike Mike Reagent <@tunnckoCore> (https://i.am.charlike.online)\n * Released under the MIT license.\n */\n\n'use strict'\n\nvar transform = {\n 'className': 'class',\n 'htmlFor': 'for',\n 'httpEquiv': 'http-equiv'\n}\n\nmodule.exports = function michToHtml (ast) {\n var buf = ''\n traverse([].concat(ast), function (node) {\n if (node && node.type === 'text') {\n buf += node.value\n }\n if (node && node.type === 'element') {\n buf += '<' + node.tagName + toAttrs(node.properties) + '>'\n buf += michToHtml(node.children) + ''\n }\n })\n\n return buf\n}\n\nfunction traverse (ast, cb) {\n ast && ast.map(function (node) {\n traverse(cb(node), cb)\n })\n return ast\n}\n\nfunction toAttrs (props) {\n var attr = ''\n\n for (var prop in props) {\n var value = props[prop]\n prop = prop in transform ? transform[prop] : prop\n value = prop === 'class' ? value.join(' ') : value\n var type = typeof value\n\n if (value === true) {\n attr += ' ' + prop\n } else if (value === false) {\n attr += ' ' + prop + '=\"false\"'\n } else if (type === 'string' || type === 'number') {\n attr += ' ' + prop + '=\"' + value + '\"'\n } else if (prop === 'style') {\n var css = ''\n for (var key in value) {\n css += key + ': ' + value[key] + ';'\n }\n attr += ' ' + prop + '=\"' + css + '\"'\n } else if (prop === 'dataset') {\n for (var k in value) {\n attr += ' data-' + k + '=\"' + value[k] + '\"'\n }\n }\n }\n\n return attr\n}\n"],"names":["traverse","ast","cb","map","node","toAttrs","props","attr","prop","value","transform","join","type","css","key","k","className","htmlFor","httpEquiv","module","exports","michToHtml","buf","concat","tagName","properties","children"],"mappings":"6IA8BA,QAASA,GAAUC,EAAKC,GAItB,MAHAD,IAAOA,EAAIE,IAAI,SAAUC,GACvBJ,EAASE,EAAGE,GAAOF,KAEdD,EAGT,QAASI,GAASC,GAChB,GAAIC,GAAO,EAEX,KAAK,GAAIC,KAAQF,GAAO,CACtB,GAAIG,GAAQH,EAAME,EAClBA,GAAOA,IAAQE,GAAYA,EAAUF,GAAQA,EAC7CC,EAAiB,UAATD,EAAmBC,EAAME,KAAK,KAAOF,CAC7C,IAAIG,SAAcH,EAElB,IAAIA,KAAU,EACZF,GAAQ,IAAMC,MACT,IAAIC,KAAU,EACnBF,GAAQ,IAAMC,EAAO,eAChB,IAAa,WAATI,GAA8B,WAATA,EAC9BL,GAAQ,IAAMC,EAAO,KAAOC,EAAQ,QAC/B,IAAa,UAATD,EAAkB,CAC3B,GAAIK,GAAM,EACV,KAAK,GAAIC,KAAOL,GACdI,GAAOC,EAAM,KAAOL,EAAMK,GAAO,GAEnCP,IAAQ,IAAMC,EAAO,KAAOK,EAAM,QAC7B,IAAa,YAATL,EACT,IAAK,GAAIO,KAAKN,GACZF,GAAQ,SAAWQ,EAAI,KAAON,EAAMM,GAAK,IAK/C,MAAOR,GA1DT,GAEIG,IACFM,UAAa,QACbC,QAAW,MACXC,UAAa,aAGfC,QAAOC,QAAU,QAASC,GAAYpB,GACpC,GAAIqB,GAAM,EAWV,OAVAtB,MAAYuB,OAAOtB,GAAM,SAAUG,GAC7BA,GAAsB,SAAdA,EAAKQ,OACfU,GAAOlB,EAAKK,OAEVL,GAAsB,YAAdA,EAAKQ,OACfU,GAAO,IAAMlB,EAAKoB,QAAUnB,EAAQD,EAAKqB,YAAc,IACvDH,GAAOD,EAAWjB,EAAKsB,UAAY,KAAOtB,EAAKoB,QAAU,OAItDF"} \ No newline at end of file +{"version":3,"file":"mich-to-html.min.js","sources":["../index.js"],"sourcesContent":["/*!\n * mich-to-html \n *\n * Copyright (c) Charlike Mike Reagent <@tunnckoCore> (https://i.am.charlike.online)\n * Released under the MIT license.\n */\n\n'use strict'\n\nvar transform = {\n 'className': 'class',\n 'htmlFor': 'for',\n 'httpEquiv': 'http-equiv'\n}\n\nmodule.exports = function michToHtml (ast) {\n var buf = ''\n traverse([].concat(ast), function (node) {\n if (node && node.type === 'text') {\n buf += node.value\n }\n if (node && node.type === 'element') {\n buf += '<' + node.tagName + toAttrs(node.properties) + '>'\n buf += michToHtml(node.children) + ''\n }\n })\n\n return buf\n}\n\nfunction traverse (ast, cb) {\n ast && ast.map(function (node) {\n traverse(cb(node), cb)\n })\n return ast\n}\n\nfunction toAttrs (props) {\n var attr = ''\n\n for (var prop in props) {\n var value = props[prop]\n prop = prop in transform ? transform[prop] : prop\n value = prop === 'class' ? value.join(' ') : value\n var type = typeof value\n\n if (value === true) {\n attr += ' ' + prop\n } else if (value === false) {\n attr += ' ' + prop + '=\"false\"'\n } else if (type === 'string' || type === 'number') {\n attr += ' ' + prop + '=\"' + value + '\"'\n } else if (prop === 'style') {\n var css = ''\n for (var key in value) {\n css += key + ': ' + value[key] + ';'\n }\n attr += ' ' + prop + '=\"' + css + '\"'\n } else if (prop === 'dataset') {\n for (var k in value) {\n attr += ' data-' + k + '=\"' + value[k] + '\"'\n }\n }\n }\n\n return attr\n}\n"],"names":["traverse","ast","cb","map","node","toAttrs","props","attr","prop","value","transform","join","type","css","key","k","className","htmlFor","httpEquiv","michToHtml","buf","concat","tagName","properties","children"],"mappings":"yKA8BA,QAASA,GAAUC,EAAKC,GAItB,MAHAD,IAAOA,EAAIE,IAAI,SAAUC,GACvBJ,EAASE,EAAGE,GAAOF,KAEdD,EAGT,QAASI,GAASC,GAChB,GAAIC,GAAO,EAEX,KAAK,GAAIC,KAAQF,GAAO,CACtB,GAAIG,GAAQH,EAAME,EAClBA,GAAOA,IAAQE,GAAYA,EAAUF,GAAQA,EAC7CC,EAAiB,UAATD,EAAmBC,EAAME,KAAK,KAAOF,CAC7C,IAAIG,SAAcH,EAElB,IAAIA,KAAU,EACZF,GAAQ,IAAMC,MACT,IAAIC,KAAU,EACnBF,GAAQ,IAAMC,EAAO,eAChB,IAAa,WAATI,GAA8B,WAATA,EAC9BL,GAAQ,IAAMC,EAAO,KAAOC,EAAQ,QAC/B,IAAa,UAATD,EAAkB,CAC3B,GAAIK,GAAM,EACV,KAAK,GAAIC,KAAOL,GACdI,GAAOC,EAAM,KAAOL,EAAMK,GAAO,GAEnCP,IAAQ,IAAMC,EAAO,KAAOK,EAAM,QAC7B,IAAa,YAATL,EACT,IAAK,GAAIO,KAAKN,GACZF,GAAQ,SAAWQ,EAAI,KAAON,EAAMM,GAAK,IAK/C,MAAOR,GA1DT,GAEIG,IACFM,UAAa,QACbC,QAAW,MACXC,UAAa,gBAGE,QAASC,GAAYlB,GACpC,GAAImB,GAAM,EAWV,OAVApB,MAAYqB,OAAOpB,GAAM,SAAUG,GAC7BA,GAAsB,SAAdA,EAAKQ,OACfQ,GAAOhB,EAAKK,OAEVL,GAAsB,YAAdA,EAAKQ,OACfQ,GAAO,IAAMhB,EAAKkB,QAAUjB,EAAQD,EAAKmB,YAAc,IACvDH,GAAOD,EAAWf,EAAKoB,UAAY,KAAOpB,EAAKkB,QAAU,OAItDF"} \ No newline at end of file diff --git a/package.json b/package.json index 76b7b1f..9b0793a 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,8 @@ "pre-commit": "^1.2.2", "rimraf": "^2.5.4", "rollup": "^0.41.4", + "rollup-plugin-commonjs": "^7.0.0", + "rollup-plugin-node-resolve": "^2.0.0", "rollup-plugin-uglify": "^1.0.1", "rollup-plugin-zopfli": "^1.0.2", "standard": "^8.6.0", diff --git a/rollup.config.js b/rollup.config.js index 80aa12e..654ef15 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,5 +1,7 @@ const zopfli = require('rollup-plugin-zopfli') const uglify = require('rollup-plugin-uglify') +const resolve = require('rollup-plugin-node-resolve') +const commonjs = require('rollup-plugin-commonjs') module.exports = { entry: 'index.js', @@ -7,6 +9,8 @@ module.exports = { sourceMap: true, useStrict: false, plugins: [ + commonjs(), + resolve(), uglify({ compress: { warnings: false } }), zopfli({ options: { numiterations: 1000 } }) ], diff --git a/yarn.lock b/yarn.lock index 7a8ac1c..5787a94 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19,7 +19,7 @@ acorn-jsx@^3.0.0: dependencies: acorn "^3.0.4" -acorn@4.0.4: +acorn@4.0.4, acorn@^4.0.1: version "4.0.4" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" @@ -300,6 +300,12 @@ braces@^1.8.2: preserve "^0.2.0" repeat-element "^1.1.2" +browser-resolve@^1.11.0: + version "1.11.2" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce" + dependencies: + resolve "1.1.7" + buf-compare@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/buf-compare/-/buf-compare-1.0.1.tgz#fef28da8b8113a0a0db4430b0b6467b69730b34a" @@ -308,7 +314,7 @@ buffer-shims@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" -builtin-modules@^1.0.0: +builtin-modules@^1.0.0, builtin-modules@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -1011,6 +1017,14 @@ estraverse@~4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" +estree-walker@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.2.1.tgz#bdafe8095383d8414d5dc2ecf4c9173b6db9412e" + +estree-walker@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.3.0.tgz#f67ca8f57b9ed66d886af816c099c779b315d4db" + esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" @@ -2009,6 +2023,12 @@ lru-cache@^4.0.1: pseudomap "^1.0.1" yallist "^2.0.0" +magic-string@^0.19.0: + version "0.19.0" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.19.0.tgz#198948217254e3e0b93080e01146b7c73b2a06b2" + dependencies: + vlq "^0.2.1" + map-obj@^1.0.0, map-obj@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" @@ -2639,7 +2659,11 @@ resolve-from@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57" -resolve@^1.1.6: +resolve@1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + +resolve@^1.1.6, resolve@^1.1.7: version "1.2.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c" @@ -2666,6 +2690,24 @@ rimraf@2, rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.4.3, rimraf@^2.4.4, rimraf@^2. dependencies: glob "^7.0.5" +rollup-plugin-commonjs@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-7.0.0.tgz#510762d5c423c761cd16d8e8451715b39f0ceb08" + dependencies: + acorn "^4.0.1" + estree-walker "^0.3.0" + magic-string "^0.19.0" + resolve "^1.1.7" + rollup-pluginutils "^1.5.1" + +rollup-plugin-node-resolve@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-2.0.0.tgz#07e0ae94ac002a3ea36e8f33ca121d9f836b1309" + dependencies: + browser-resolve "^1.11.0" + builtin-modules "^1.1.0" + resolve "^1.1.6" + rollup-plugin-uglify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-1.0.1.tgz#11d0b0c8bcd2d07e6908f74fd16b0152390b922a" @@ -2678,6 +2720,13 @@ rollup-plugin-zopfli@^1.0.2: dependencies: node-zopfli "^2.0.2" +rollup-pluginutils@^1.5.1: + version "1.5.2" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408" + dependencies: + estree-walker "^0.2.1" + minimatch "^3.0.2" + rollup@^0.41.4: version "0.41.4" resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.41.4.tgz#a970580176329f9ead86854d7fd4c46de752aef8" @@ -3152,6 +3201,10 @@ verror@1.3.6: dependencies: extsprintf "1.0.2" +vlq@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.1.tgz#14439d711891e682535467f8587c5630e4222a6c" + which-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f"