@loftyshaky/shared 2.7.0 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,4 +45,4 @@ Input files:
45
45
  `,``}).replace(/[ \n\r\t\f]*?[\n\r][ \n\r\t\f]*$/,function(){return o=`
46
46
  `,``})),n&&(e=e.replace(/^[ \n\r\t\f\xA0]+/,function(e){let n=!a&&t.conservativeCollapse;return n&&e===` `?` `:e.replace(/^[^\xA0]+/,``).replace(/(\xA0+)[^\xA0]+/g,`$1 `)||(n?` `:``)})),r&&(e=e.replace(/[ \n\r\t\f\xA0]+$/,function(e){let n=!o&&t.conservativeCollapse;return n&&e===` `?` `:e.replace(/[^\xA0]+(\xA0+)/g,` $1`).replace(/[^\xA0]+$/,``)||(n?` `:``)})),i&&(e=au(e)),a+e+o}var su=new Set(`a.abbr.acronym.b.bdi.bdo.big.button.cite.code.del.dfn.em.font.i.ins.kbd.label.mark.math.nobr.object.q.rp.rt.rtc.ruby.s.samp.select.small.span.strike.strong.sub.sup.svg.textarea.time.tt.u.var`.split(`.`)),cu=new Set(`a.abbr.acronym.b.big.del.em.font.i.ins.kbd.mark.nobr.rp.s.samp.small.span.strike.strong.sub.sup.time.tt.u.var`.split(`.`)),lu=new Set([`comment`,`img`,`input`,`wbr`]);function uu(e,t,n,r){let i=t&&!lu.has(t);i&&!r.collapseInlineTagWhitespace&&(i=t.charAt(0)===`/`?!su.has(t.slice(1)):!cu.has(t));let a=n&&!lu.has(n);return a&&!r.collapseInlineTagWhitespace&&(a=n.charAt(0)===`/`?!cu.has(n.slice(1)):!su.has(n)),ou(e,r,i,a,t&&n)}function du(e){return/^\[if\s[^\]]+]|\[endif]$/.test(e)}function fu(e,t){for(let n=0,r=t.ignoreCustomComments.length;n<r;n++)if(t.ignoreCustomComments[n].test(e))return!0;return!1}function pu(e,t){let n=t.customEventAttributes;if(n){for(let t=n.length;t--;)if(n[t].test(e))return!0;return!1}return/^on[a-z]{3,}$/.test(e)}function mu(e){return/^[^ \t\n\f\r"'`=<>]+$/.test(e)}function hu(e,t){for(let n=e.length;n--;)if(e[n].name.toLowerCase()===t)return!0;return!1}function gu(e,t,n,r){return n=n?iu(n.toLowerCase()):``,e===`script`&&t===`language`&&n===`javascript`||e===`form`&&t===`method`&&n===`get`||e===`input`&&t===`type`&&n===`text`||e===`script`&&t===`charset`&&!hu(r,`src`)||e===`a`&&t===`name`&&hu(r,`id`)||e===`area`&&t===`shape`&&n===`rect`}var _u=new Set([`text/javascript`,`text/ecmascript`,`text/jscript`,`application/javascript`,`application/x-javascript`,`application/ecmascript`,`module`]),vu=new Set([`module`]);function yu(e=``){return e=iu(e.split(/;/,2)[0]).toLowerCase(),e===``||_u.has(e)}function bu(e=``){return e=iu(e.split(/;/,2)[0]).toLowerCase(),vu.has(e)}function xu(e,t){if(e!==`script`)return!1;for(let e=0,n=t.length;e<n;e++)if(t[e].name.toLowerCase()===`type`)return yu(t[e].value);return!0}function Su(e=``){return e=iu(e).toLowerCase(),e===``||e===`text/css`}function Cu(e,t){if(e!==`style`)return!1;for(let e=0,n=t.length;e<n;e++)if(t[e].name.toLowerCase()===`type`)return Su(t[e].value);return!0}var wu=new Set(`allowfullscreen.async.autofocus.autoplay.checked.compact.controls.declare.default.defaultchecked.defaultmuted.defaultselected.defer.disabled.enabled.formnovalidate.hidden.indeterminate.inert.ismap.itemscope.loop.multiple.muted.nohref.noresize.noshade.novalidate.nowrap.open.pauseonexit.readonly.required.reversed.scoped.seamless.selected.sortable.truespeed.typemustmatch.visible`.split(`.`)),Tu=new Set([`true`,`false`]);function Eu(e,t){return wu.has(e)||e===`draggable`&&!Tu.has(t)}function Du(e,t){return/^(?:a|area|link|base)$/.test(t)&&e===`href`||t===`img`&&/^(?:src|longdesc|usemap)$/.test(e)||t===`object`&&/^(?:classid|codebase|data|usemap)$/.test(e)||t===`q`&&e===`cite`||t===`blockquote`&&e===`cite`||(t===`ins`||t===`del`)&&e===`cite`||t===`form`&&e===`action`||t===`input`&&(e===`src`||e===`usemap`)||t===`head`&&e===`profile`||t===`script`&&(e===`src`||e===`for`)}function Ou(e,t){return/^(?:a|area|object|button)$/.test(t)&&e===`tabindex`||t===`input`&&(e===`maxlength`||e===`tabindex`)||t===`select`&&(e===`size`||e===`tabindex`)||t===`textarea`&&/^(?:rows|cols|tabindex)$/.test(e)||t===`colgroup`&&e===`span`||t===`col`&&e===`span`||(t===`th`||t===`td`)&&(e===`rowspan`||e===`colspan`)}function ku(e,t,n){if(e!==`link`)return!1;for(let e=0,r=t.length;e<r;e++)if(t[e].name===`rel`&&t[e].value===n)return!0}function Au(e,t,n){return n===`media`&&(ku(e,t,`stylesheet`)||Cu(e,t))}var ju=new Set([`img`,`source`]);function Mu(e,t){return e===`srcset`&&ju.has(t)}async function Nu(e,t,n,r,i){if(pu(t,r))return n=iu(n).replace(/^javascript:\s*/i,``),r.minifyJS(n,!0);if(t===`class`)return n=iu(n),n=r.sortClassName?r.sortClassName(n):au(n),n;if(Du(t,e))return n=iu(n),ku(e,i,`canonical`)?n:r.minifyURLs(n);if(Ou(t,e))return iu(n);if(t===`style`)return n=iu(n),n&&=(/;$/.test(n)&&!/&#?[0-9a-zA-Z]+;$/.test(n)&&(n=n.replace(/\s*;$/,`;`)),await r.minifyCSS(n,`inline`)),n;if(Mu(t,e))n=iu(n).split(/\s+,\s*|\s*,\s+/).map(function(e){let t=e,n=``,i=e.match(/\s+([1-9][0-9]*w|[0-9]+(?:\.[0-9]+)?x)$/);if(i){t=t.slice(0,-i[0].length);let e=+i[1].slice(0,-1),r=i[1].slice(-1);(e!==1||r!==`x`)&&(n=` `+e+r)}return r.minifyURLs(t)+n}).join(`, `);else if(Pu(e,i)&&t===`content`)n=n.replace(/\s+/g,``).replace(/[0-9]+\.[0-9]+/g,function(e){return(+e).toString()});else if(Fu(e,i)&&t.toLowerCase()===`content`)return au(n);else if(r.customAttrCollapse&&r.customAttrCollapse.test(t))n=iu(n.replace(/ ?[\n\r]+ ?/g,``).replace(/\s{2,}/g,r.conservativeCollapse?` `:``));else if(e===`script`&&t===`type`)n=iu(n.replace(/\s*;\s*/g,`;`));else if(Au(e,i,t))return n=iu(n),r.minifyCSS(n,`media`);return n}function Pu(e,t){if(e!==`meta`)return!1;for(let e=0,n=t.length;e<n;e++)if(t[e].name===`name`&&t[e].value===`viewport`)return!0}function Fu(e,t){if(e!==`meta`)return!1;for(let e=0,n=t.length;e<n;e++)if(t[e].name.toLowerCase()===`http-equiv`&&t[e].value.toLowerCase()===`content-security-policy`)return!0}function Iu(e){return`/* clean-css ignore:start */`+e+`/* clean-css ignore:end */`}function Lu(e,t){switch(t){case`inline`:return`*{`+e+`}`;case`media`:return`@media `+e+`{a{top:0}}`;default:return e}}function Ru(e,t){let n;switch(t){case`inline`:n=e.match(/^\*\{([\s\S]*)\}$/);break;case`media`:n=e.match(/^@media ([\s\S]*?)\s*{[\s\S]*}$/);break}return n?n[1]:e}async function zu(e,t){return t.processConditionalComments?await Fl(e,/^(\[if\s[^\]]+]>)([\s\S]*?)(<!\[endif])$/,async function(e,n,r,i){return n+await xd(r,t,!0)+i}):e}async function Bu(e,t,n){for(let r=0,i=n.length;r<i;r++)if(n[r].name.toLowerCase()===`type`&&t.processScripts.indexOf(n[r].value)>-1)return await xd(e,t);return e}var Vu=new Set([`html`,`head`,`body`,`colgroup`,`tbody`]),Hu=new Set([`html`,`head`,`body`,`li`,`dt`,`dd`,`p`,`rb`,`rt`,`rtc`,`rp`,`optgroup`,`option`,`colgroup`,`caption`,`thead`,`tbody`,`tfoot`,`tr`,`td`,`th`]),Uu=new Set([`meta`,`link`,`script`,`style`,`template`,`noscript`]),Wu=new Set([`dt`,`dd`]),Gu=new Set(`address.article.aside.blockquote.details.div.dl.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.hr.main.menu.nav.ol.p.pre.section.table.ul`.split(`.`)),Ku=new Set([`a`,`audio`,`del`,`ins`,`map`,`noscript`,`video`]),qu=new Set([`rb`,`rt`,`rtc`,`rp`]),Ju=new Set([`rb`,`rtc`,`rp`]),Yu=new Set([`option`,`optgroup`]),Xu=new Set([`tbody`,`tfoot`]),Zu=new Set([`thead`,`tbody`,`tfoot`]),Qu=new Set([`td`,`th`]),$u=new Set([`html`,`head`,`body`]),ed=new Set([`html`,`body`]),td=new Set([`head`,`colgroup`,`caption`]),nd=new Set([`dt`,`thead`]),rd=new Set(`a.abbr.acronym.address.applet.area.article.aside.audio.b.base.basefont.bdi.bdo.bgsound.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.command.content.data.datalist.dd.del.details.dfn.dialog.dir.div.dl.dt.element.em.embed.fieldset.figcaption.figure.font.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.iframe.image.img.input.ins.isindex.kbd.keygen.label.legend.li.link.listing.main.map.mark.marquee.menu.menuitem.meta.meter.multicol.nav.nobr.noembed.noframes.noscript.object.ol.optgroup.option.output.p.param.picture.plaintext.pre.progress.q.rb.rp.rt.rtc.ruby.s.samp.script.section.select.shadow.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.title.tr.track.tt.u.ul.var.video.wbr.xmp`.split(`.`));function id(e,t){switch(e){case`html`:case`head`:return!0;case`body`:return!Uu.has(t);case`colgroup`:return t===`col`;case`tbody`:return t===`tr`}return!1}function ad(e,t){switch(t){case`colgroup`:return e===`colgroup`;case`tbody`:return Zu.has(e)}return!1}function od(e,t){switch(e){case`html`:case`head`:case`body`:case`colgroup`:case`caption`:return!0;case`li`:case`optgroup`:case`tr`:return t===e;case`dt`:case`dd`:return Wu.has(t);case`p`:return Gu.has(t);case`rb`:case`rt`:case`rp`:return qu.has(t);case`rtc`:return Ju.has(t);case`option`:return Yu.has(t);case`thead`:case`tbody`:return Xu.has(t);case`tfoot`:return t===`tbody`;case`td`:case`th`:return Qu.has(t)}return!1}var sd=RegExp(`^(?:class|id|style|title|lang|dir|on(?:focus|blur|change|click|dblclick|mouse(?:down|up|over|move|out)|key(?:press|down|up)))$`);function cd(e,t,n,r){return!n||/^\s*$/.test(n)?typeof r.removeEmptyAttributes==`function`?r.removeEmptyAttributes(t,e):e===`input`&&t===`value`||sd.test(t):!1}function ld(e,t){for(let n=t.length-1;n>=0;n--)if(t[n].name===e)return!0;return!1}function ud(e,t){switch(e){case`textarea`:return!1;case`audio`:case`script`:case`video`:if(ld(`src`,t))return!1;break;case`iframe`:if(ld(`src`,t)||ld(`srcdoc`,t))return!1;break;case`object`:if(ld(`data`,t))return!1;break;case`applet`:if(ld(`code`,t))return!1;break}return!0}function dd(e){return!/^(?:script|style|pre|textarea)$/.test(e)}function fd(e){return!/^(?:pre|textarea)$/.test(e)}async function pd(e,t,n,r){let i=r.name(e.name),a=e.value;if(r.decodeEntities&&a&&(a=vn(a)),!(r.removeRedundantAttributes&&gu(n,i,a,t)||r.removeScriptTypeAttributes&&n===`script`&&i===`type`&&yu(a)&&!bu(a)||r.removeStyleLinkTypeAttributes&&(n===`style`||n===`link`)&&i===`type`&&Su(a))&&(a&&=await Nu(n,i,a,r,t),!(r.removeEmptyAttributes&&cd(n,i,a,r))))return r.decodeEntities&&a&&(a=a.replace(/&(#?[0-9a-zA-Z]+;)/g,`&amp;$1`)),{attr:e,name:i,value:a}}function md(e,t,n,r,i){let a=e.name,o=e.value,s=e.attr,c=s.quote,l,u;return o!==void 0&&(!n.removeAttributeQuotes||~o.indexOf(i)||!mu(o))?(n.preventAttributesEscaping||(c=n.quoteCharacter===void 0?(o.match(/'/g)||[]).length<(o.match(/"/g)||[]).length?`'`:`"`:n.quoteCharacter===`'`?`'`:`"`,o=c===`"`?o.replace(/"/g,`&#34;`):o.replace(/'/g,`&#39;`)),u=c+o+c,!r&&!n.removeTagWhitespace&&(u+=` `)):u=r&&!t&&!/\/$/.test(o)?o:o+` `,o===void 0||n.collapseBooleanAttributes&&Eu(a.toLowerCase(),o.toLowerCase())?(l=a,r||(l+=` `)):l=a+s.customAssign+u,s.customOpen+l+s.customClose}function hd(e){return e}function gd(e){return Promise.resolve(e)}var _d=e=>{let t={name:function(e){return e.toLowerCase()},canCollapseWhitespace:dd,canTrimWhitespace:fd,html5:!0,ignoreCustomComments:[/^!/,/^\s*#/],ignoreCustomFragments:[/<%[\s\S]*?%>/,/<\?[\s\S]*?\?>/],includeAutoGeneratedTags:!0,log:hd,minifyCSS:gd,minifyJS:hd,minifyURLs:hd};return Object.keys(e).forEach(function(n){let r=e[n];if(n===`caseSensitive`)r&&(t.name=hd);else if(n===`log`)typeof r==`function`&&(t.log=r);else if(n===`minifyCSS`&&typeof r!=`function`){if(!r)return;let e=typeof r==`object`?r:{};t.minifyCSS=async function(n,r){n=n.replace(/(url\s*\(\s*)("|'|)(.*?)\2(\s*\))/gi,function(e,n,r,i,a){return n+r+t.minifyURLs(i)+r+a});let i=Lu(n,r);return new Promise(a=>{new In.default(e).minify(i,(e,i)=>{i.errors.length>0&&(i.errors.forEach(t.log),a(n)),a(Ru(i.styles,r))})})}}else if(n===`minifyJS`&&typeof r!=`function`){if(!r)return;let e=typeof r==`object`?r:{};e.parse={...e.parse,bare_returns:!1},t.minifyJS=async function(n,r){let i=n.match(/^\s*<!--.*/),a=i?n.slice(i[0].length).replace(/\n\s*-->\s*$/,``):n;e.parse.bare_returns=r;try{return(await Pl(a,e)).code.replace(/;$/,``)}catch(e){return t.log(e),n}}}else if(n===`minifyURLs`&&typeof r!=`function`){if(!r)return;let e=r;typeof r==`string`?e={site:r}:typeof r!=`object`&&(e={}),t.minifyURLs=function(n){try{return Ln.default.relate(n,e)}catch(e){return t.log(e),n}}}else t[n]=r}),t};function vd(e){let t;do t=Math.random().toString(36).replace(/^0\.[0-9]*/,``);while(~e.indexOf(t));return t}var yd=new Set([`script`,`style`]);async function bd(e,t,n,r){let i=t.sortAttributes&&Object.create(null),a=t.sortClassName&&new ru;function o(e){return e.map(function(e){return t.name(e.name)})}function s(e,t){return!t||e.indexOf(t)===-1}function c(e){return s(e,n)&&s(e,r)}async function l(e){let n,r;await new tu(e,{start:function(e,s){i&&(i[e]||(i[e]=new ru),i[e].add(o(s).filter(c)));for(let i=0,o=s.length;i<o;i++){let o=s[i];a&&o.value&&t.name(o.name)===`class`?a.add(iu(o.value).split(/[ \t\n\f\r]+/).filter(c)):t.processScripts&&o.name.toLowerCase()===`type`&&(n=e,r=o.value)}},end:function(){n=``},chars:async function(e){t.processScripts&&yd.has(n)&&t.processScripts.indexOf(r)>-1&&await l(e)}}).parse()}let u=t.log;if(t.log=hd,t.sortAttributes=!1,t.sortClassName=!1,await l(await xd(e,t)),t.log=u,i){let e=Object.create(null);for(let t in i)e[t]=i[t].createSorter();t.sortAttributes=function(t,n){let r=e[t];if(r){let e=Object.create(null),t=o(n);t.forEach(function(t,r){(e[t]||(e[t]=[])).push(n[r])}),r.sort(t).forEach(function(t,r){n[r]=e[t].shift()})}}}if(a){let e=a.createSorter();t.sortClassName=function(t){return e.sort(t.split(/[ \n\f\r]+/)).join(` `)}}}async function xd(e,t,n){t.collapseWhitespace&&(e=ou(e,t,!0,!0));let r=[],i,a=``,o,s=``,c=[],l=[],u=[],d=``,f=``,p=[],m=[],h,g,_;e=e.replace(/<!-- htmlmin:ignore -->([\s\S]*?)<!-- htmlmin:ignore -->/g,function(n,r){if(!h){h=vd(e);let n=RegExp(`^`+h+`([0-9]+)$`);t.ignoreCustomComments?t.ignoreCustomComments=t.ignoreCustomComments.slice():t.ignoreCustomComments=[],t.ignoreCustomComments.push(n)}let i=`<!--`+h+p.length+`-->`;return p.push(r),i});let v=t.ignoreCustomFragments.map(function(e){return e.source});if(v.length){let n=RegExp(`\\s*(?:`+v.join(`|`)+`)+\\s*`,`g`);e=e.replace(n,function(n){g||(g=vd(e),_=RegExp(`(\\s*)`+g+`([0-9]+)`+g+`(\\s*)`,`g`),t.minifyCSS&&=(function(e){return function(t,n){t=t.replace(_,function(e,t,n){let r=m[+n];return r[1]+g+n+g+r[2]});let r=[];return new In.default().minify(Lu(t,n)).warnings.forEach(function(e){let n=_.exec(e);if(n){let e=g+n[2]+g;t=t.replace(e,Iu(e)),r.push(e)}}),e(t,n).then(e=>(r.forEach(function(t){e=e.replace(Iu(t),t)}),e))}})(t.minifyCSS),t.minifyJS&&=(function(e){return function(t,n){return e(t.replace(_,function(e,t,n){let r=m[+n];return r[1]+g+n+g+r[2]}),n)}})(t.minifyJS));let r=g+m.length+g;return m.push(/^(\s*)[\s\S]*?(\s*)$/.exec(n)),` `+r+` `})}(t.sortAttributes&&typeof t.sortAttributes!=`function`||t.sortClassName&&typeof t.sortClassName!=`function`)&&await bd(e,t,h,g);function y(e,n){return t.canCollapseWhitespace(e,n,dd)}function b(e,n){return t.canTrimWhitespace(e,n,fd)}function x(){let e=r.length-1;for(;e>0&&!/^<[^/!]/.test(r[e]);)e--;r.length=Math.max(0,e)}function S(){let e=r.length-1;for(;e>0&&!/^<\//.test(r[e]);)e--;r.length=Math.max(0,e)}function C(e,n){for(let i=null;e>=0&&b(i);e--){let a=r[e],o=a.match(/^<\/([\w:-]+)>$/);if(o)i=o[1];else if(/>$/.test(a)||(r[e]=uu(a,null,n,t)))break}}function w(e){let t=r.length-1;if(r.length>1){let e=r[r.length-1];/^(?:<!|$)/.test(e)&&e.indexOf(h)===-1&&t--}C(t,e)}return await new tu(e,{partialMarkup:n,continueOnParseError:t.continueOnParseError,customAttrAssign:t.customAttrAssign,customAttrSurround:t.customAttrSurround,html5:t.html5,start:async function(e,n,p,m,h){e.toLowerCase()===`svg`&&(t=Object.create(t),t.caseSensitive=!0,t.keepClosingSlash=!0,t.name=hd),e=t.name(e),s=e,i=e,cu.has(e)||(a=``),o=!1,c=n;let _=t.removeOptionalTags;if(_){let t=rd.has(e);t&&id(d,e)&&x(),d=``,t&&od(f,e)&&(S(),_=!ad(f,e)),f=``}t.collapseWhitespace&&(l.length||w(e),p||((!b(e,n)||l.length)&&l.push(e),(!y(e,n)||u.length)&&u.push(e)));let v=`<`+e,C=m&&t.keepClosingSlash;r.push(v),t.sortAttributes&&t.sortAttributes(e,n);let T=[];for(let r=n.length,i=!0;--r>=0;){let a=await pd(n[r],n,e,t);a&&(T.unshift(md(a,C,t,i,g)),i=!1)}T.length>0?(r.push(` `),r.push.apply(r,T)):_&&Vu.has(e)&&(d=e),r.push(r.pop()+(C?`/`:``)+`>`),h&&!t.includeAutoGeneratedTags&&(x(),d=``)},end:function(e,n,c){e.toLowerCase()===`svg`&&(t=Object.getPrototypeOf(t)),e=t.name(e),t.collapseWhitespace&&(l.length?e===l[l.length-1]&&l.pop():w(`/`+e),u.length&&e===u[u.length-1]&&u.pop());let p=!1;e===s&&(s=``,p=!o),t.removeOptionalTags&&(p&&$u.has(d)&&x(),d=``,rd.has(e)&&f&&!nd.has(f)&&(f!==`p`||!Ku.has(e))&&S(),f=Hu.has(e)?e:``),t.removeEmptyElements&&p&&ud(e,n)?(x(),d=``,f=``):(c&&!t.includeAutoGeneratedTags?f=``:r.push(`</`+e+`>`),i=`/`+e,su.has(e)?p&&(a+=`|`):a=``)},chars:async function(e,n,p){if(n=n===``?`comment`:n,p=p===``?`comment`:p,t.decodeEntities&&e&&!yd.has(s)&&(e=_n(e)),t.collapseWhitespace){if(!l.length){if(n===`comment`){let o=r[r.length-1];if(o.indexOf(h)===-1&&(o||(n=i),r.length>1&&(!o||!t.conservativeCollapse&&/ $/.test(a)))){let t=r.length-2;r[t]=r[t].replace(/\s+$/,function(t){return e=t+e,``})}}if(n)if(n===`/nobr`||n===`wbr`){if(/^\s/.test(e)){let e=r.length-1;for(;e>0&&r[e].lastIndexOf(`<`+n)!==0;)e--;C(e-1,`br`)}}else cu.has(n.charAt(0)===`/`?n.slice(1):n)&&(e=ou(e,t,/(?:^|\s)$/.test(a)));e=n||p?uu(e,n,p,t):ou(e,t,!0,!0),!e&&/\s$/.test(a)&&n&&n.charAt(0)===`/`&&C(r.length-1,p)}!u.length&&p!==`html`&&!(n&&p)&&(e=ou(e,t,!1,!1,!0))}t.processScripts&&yd.has(s)&&(e=await Bu(e,t,c)),xu(s,c)&&(e=await t.minifyJS(e)),Cu(s,c)&&(e=await t.minifyCSS(e)),t.removeOptionalTags&&e&&((d===`html`||d===`body`&&!/^\s/.test(e))&&x(),d=``,(ed.has(f)||td.has(f)&&!/^\s/.test(e))&&S(),f=``),i=/^\s*$/.test(e)?n:`comment`,t.decodeEntities&&e&&!yd.has(s)&&(e=e.replace(/&((?:Iacute|aacute|uacute|plusmn|Otilde|otilde|agrave|Agrave|Yacute|yacute|Oslash|oslash|atilde|Atilde|brvbar|ccedil|Ccedil|Ograve|curren|divide|eacute|Eacute|ograve|Oacute|egrave|Egrave|Ugrave|frac12|frac14|frac34|ugrave|oacute|iacute|Ntilde|ntilde|Uacute|middot|igrave|Igrave|iquest|Aacute|cedil|laquo|micro|iexcl|Icirc|icirc|acirc|Ucirc|Ecirc|ocirc|Ocirc|ecirc|ucirc|Aring|aring|AElig|aelig|acute|pound|raquo|Acirc|times|THORN|szlig|thorn|COPY|auml|ordf|ordm|Uuml|macr|uuml|Auml|ouml|Ouml|para|nbsp|euml|quot|QUOT|Euml|yuml|cent|sect|copy|sup1|sup2|sup3|iuml|Iuml|ETH|shy|reg|not|yen|amp|AMP|REG|uml|eth|deg|gt|GT|LT|lt)(?!;)|(?:#?[0-9a-zA-Z]+;))/g,`&amp$1`).replace(/</g,`&lt;`)),_&&t.collapseWhitespace&&l.length&&(e=e.replace(_,function(e,t,n){return m[+n][0]})),a+=e,e&&(o=!0),r.push(e)},comment:async function(e,n){let i=n?`<!`:`<!--`,a=n?`>`:`-->`;e=du(e)?i+await zu(e,t)+a:t.removeComments?fu(e,t)?`<!--`+e+`-->`:``:i+e+a,t.removeOptionalTags&&e&&(d=``,f=``),r.push(e)},doctype:function(e){r.push(t.useShortDoctype?`<!doctype`+(t.removeTagWhitespace?``:` `)+`html>`:au(e))}}).parse(),t.removeOptionalTags&&($u.has(d)&&x(),f&&!nd.has(f)&&S()),t.collapseWhitespace&&w(`br`),Sd(r,t,_?function(e){return e.replace(_,function(e,n,r,i){let a=m[+r][0];return t.collapseWhitespace?(n!==` `&&(a=n+a),i!==` `&&(a+=i),ou(a,{preserveLineBreaks:t.preserveLineBreaks,conservativeCollapse:!t.trimCustomFragments},/^[ \n\r\t\f]/.test(a),/[ \n\r\t\f]$/.test(a))):a})}:hd,h?function(e){return e.replace(RegExp(`<!--`+h+`([0-9]+)-->`,`g`),function(e,t){return p[+t]})}:hd)}function Sd(e,t,n,r){let i,a=t.maxLineLength,o=t.noNewlinesBeforeTagClose;if(a){let t=``,s=[];for(;e.length;){let i=t.length,c=e[0].indexOf(`
47
47
  `),l=!!e[0].match(Ul),u=o&&l;c<0?t+=r(n(e.shift())):(t+=r(n(e[0].slice(0,c))),e[0]=e[0].slice(c+1)),i>0&&t.length>a&&!u?(s.push(t.slice(0,i)),t=t.slice(i)):c>=0&&(s.push(t),t=``)}t&&s.push(t),i=s.join(`
48
- `)}else i=r(n(e.join(``)));return t.collapseWhitespace?ou(i,t,!0,!0):i}var Cd=async function(e,t){let n=Date.now();t=_d(t||{});let r=await xd(e,t);return t.log(`minified in: `+(Date.now()-n)+`ms`),r},wd=async({mode:e,contents:t})=>e===`development`?t:await Cd(t,{collapseWhitespace:!0,removeComments:!0,minifyCSS:!0,minifyJS:!0}),Td=({replacements:e,include:t})=>({name:`custom-replace`,transform(n,r){if(t.some(e=>r.includes(e))){let t=n;for(let[n,r]of Object.entries(e)){let e=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);t=t.replace(new RegExp(e,`g`),r)}return{code:t,map:null}}else return null}}),Ed=()=>Td({replacements:{"var root = freeGlobal || freeSelf || Function('return this')();":`var root = freeGlobal || freeSelf || globalThis`},include:[`node_modules/lodash/_root.js`]}),Dd=({copy_paths:e})=>e.flatMap(e=>{try{return o.lstatSync(e.src).isDirectory()&&u(e.src),[e]}catch{return[]}}),Od=({mode:e,env:t,app_root:i,dest_path:o,copy_paths:u,callback_build_start:d,callback_close_bundle:f})=>{let p=!1,m=`shared${n()?``:`-app`}`,h=a.join(i,`node_modules`,`@loftyshaky`,m,`scss`,`shared`),g={ts:a.join(i,`src`,`ts`),embed:a.join(h,`embed`),themes:a.join(h,`themes`,`general`)},_=[...u,{src:a.posix.join(i,`node_modules`,`@loftyshaky`,`shared`,`html`),dest:o,rename:{stripBase:!0}},{src:a.posix.join(i,`node_modules`,`@loftyshaky`,`shared`,`imgs`),dest:o,rename:{stripBase:!0}},{src:a.posix.join(i,`src`,`html`),dest:o,rename:{stripBase:!0},transform:t=>wd({mode:e,contents:t})}];t.env===`app`&&_.push({src:a.posix.join(i,`package.json`),dest:o,rename:{stripBase:!0}}),[`ext`,`app`].includes(t.env)&&_.push({src:a.posix.join(i,`src`,`icons`),dest:o,rename:{stripBase:!0}});let v=t.content_script===`true`?[]:Dd({copy_paths:_});return{define:{"process.env.NODE_ENV":JSON.stringify(e),env:r({env:t,mode:e})},resolve:{preserveSymlinks:!0},build:{emptyOutDir:!1,cssCodeSplit:!0,target:`esnext`,lib:{entry:t.content_script===`true`?{}:{announcement:a.join(g.ts,`announcement`,`announcement.ts`),dependencies:a.join(g.ts,`dependencies`,`dependencies.ts`),font_face:a.join(g.embed,`font_face.scss`),no_tr:a.join(g.embed,`no_tr.scss`),hidden_roots:a.join(g.embed,`hidden_roots.scss`),error:a.join(g.embed,`error.scss`),loading_screen:a.join(g.embed,`loading_screen.scss`),announcement_css:a.join(i,`node_modules`,`@loftyshaky`,m,`scss`,`announcement`,`index.scss`),dependencies_css:a.join(i,`node_modules`,`@loftyshaky`,m,`scss`,`dependencies`,`index.scss`),light_theme:a.join(g.themes,`light_theme.scss`),dark_theme:a.join(g.themes,`dark_theme.scss`),very_dark_theme:a.join(g.themes,`very_dark_theme.scss`),clover_theme:a.join(g.themes,`clover_theme.scss`),aqua_theme:a.join(g.themes,`aqua_theme.scss`),lavender_theme:a.join(g.themes,`lavender_theme.scss`),blaze_theme:a.join(g.themes,`blaze_theme.scss`),ruby_theme:a.join(g.themes,`ruby_theme.scss`)}},watch:{},sourcemap:e===`development`,license:{fileName:t.content_script===`true`?`dependencies_content_script.json`:`dependencies.json`},rolldownOptions:{output:[{format:t.content_script===`true`?`iife`:`es`,entryFileNames:`[name].${t.content_script===`true`?``:`m`}js`,...t.content_script===`true`?{name:`content_script_u6Pgzb39sN1`}:{chunkFileNames:`chunks/[name].mjs`},minify:e===`production`}]}},plugins:[s(),l({include:`**/*.svg`}),Ed(),c({targets:v}),{name:`build_event`,buildStart(){d&&d()},buildEnd(e){e&&(p=!0)},closeBundle(){f&&setTimeout(()=>{f({build_error:p}),t.exit_build===`true`&&process.exit(1)},200),p=!1}}]}};export{Od as generate_shared_config};
48
+ `)}else i=r(n(e.join(``)));return t.collapseWhitespace?ou(i,t,!0,!0):i}var Cd=async function(e,t){let n=Date.now();t=_d(t||{});let r=await xd(e,t);return t.log(`minified in: `+(Date.now()-n)+`ms`),r},wd=async({mode:e,contents:t})=>e===`development`?t:await Cd(t,{collapseWhitespace:!0,removeComments:!0,minifyCSS:!0,minifyJS:!0}),Td=({replacements:e,include:t})=>({name:`custom-replace`,transform(n,r){if(t.some(e=>r.includes(e))){let t=n;for(let[n,r]of Object.entries(e)){let e=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);t=t.replace(new RegExp(e,`g`),r)}return{code:t,map:null}}else return null}}),Ed=()=>Td({replacements:{"var root = freeGlobal || freeSelf || Function('return this')();":`var root = freeGlobal || freeSelf || globalThis`},include:[`node_modules/lodash/_root.js`]}),Dd=({copy_paths:e})=>e.flatMap(e=>{try{return o.lstatSync(e.src).isDirectory()&&u(e.src),[e]}catch{return[]}}),Od=({mode:e,env:t,app_root:i,dest_path:o,copy_paths:u,callback_build_start:d,callback_close_bundle:f})=>{let p=!1,m=`shared${n()?``:`-app`}`,h=a.join(i,`node_modules`,`@loftyshaky`,m,`scss`,`shared`),g={ts:a.join(i,`src`,`ts`),embed:a.join(h,`embed`),themes:a.join(h,`themes`,`general`)},_=[...u,{src:a.posix.join(i,`node_modules`,`@loftyshaky`,`shared`,`html`),dest:o,rename:{stripBase:!0}},{src:a.posix.join(i,`node_modules`,`@loftyshaky`,`shared`,`imgs`),dest:o,rename:{stripBase:!0}},{src:a.posix.join(i,`src`,`html`),dest:o,rename:{stripBase:!0},transform:t=>wd({mode:e,contents:t})}];t.env===`app`&&_.push({src:a.posix.join(i,`package.json`),dest:o,rename:{stripBase:!0}}),[`ext`,`app`].includes(t.env)&&_.push({src:a.posix.join(i,`src`,`icons`),dest:o,rename:{stripBase:!0}},{src:a.posix.join(i,`node_modules`,`@loftyshaky`,`shared`,`fonts`),dest:o,rename:{stripBase:!0}});let v=t.content_script===`true`?[]:Dd({copy_paths:_});return{define:{"process.env.NODE_ENV":JSON.stringify(e),env:r({env:t,mode:e})},resolve:{preserveSymlinks:!0},build:{emptyOutDir:!1,cssCodeSplit:!0,target:`esnext`,lib:{entry:t.content_script===`true`?{}:{announcement:a.join(g.ts,`announcement`,`announcement.ts`),dependencies:a.join(g.ts,`dependencies`,`dependencies.ts`),font_face:a.join(g.embed,`font_face.scss`),no_tr:a.join(g.embed,`no_tr.scss`),hidden_roots:a.join(g.embed,`hidden_roots.scss`),error:a.join(g.embed,`error.scss`),loading_screen:a.join(g.embed,`loading_screen.scss`),announcement_css:a.join(i,`node_modules`,`@loftyshaky`,m,`scss`,`announcement`,`index.scss`),dependencies_css:a.join(i,`node_modules`,`@loftyshaky`,m,`scss`,`dependencies`,`index.scss`),light_theme:a.join(g.themes,`light_theme.scss`),dark_theme:a.join(g.themes,`dark_theme.scss`),very_dark_theme:a.join(g.themes,`very_dark_theme.scss`),clover_theme:a.join(g.themes,`clover_theme.scss`),aqua_theme:a.join(g.themes,`aqua_theme.scss`),lavender_theme:a.join(g.themes,`lavender_theme.scss`),blaze_theme:a.join(g.themes,`blaze_theme.scss`),ruby_theme:a.join(g.themes,`ruby_theme.scss`)}},watch:{},sourcemap:e===`development`,license:{fileName:t.content_script===`true`?`dependencies_content_script.json`:`dependencies.json`},rolldownOptions:{output:[{format:t.content_script===`true`?`iife`:`es`,entryFileNames:`[name].${t.content_script===`true`?``:`m`}js`,...t.content_script===`true`?{name:`content_script_u6Pgzb39sN1`}:{chunkFileNames:`chunks/[name].mjs`},minify:e===`production`}]}},plugins:[s(),l({include:`**/*.svg`}),Ed(),c({targets:v}),{name:`build_event`,buildStart(){d&&d()},buildEnd(e){e&&(p=!0)},closeBundle(){f&&setTimeout(()=>{f({build_error:p}),t.exit_build===`true`&&process.exit(1)},200),p=!1}}]}};export{Od as generate_shared_config};
package/package.json CHANGED
@@ -1,56 +1,56 @@
1
- {
2
- "name": "@loftyshaky/shared",
3
- "version": "2.7.0",
4
- "description": "-",
5
- "license": "MIT",
6
- "author": "loftyshaky",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/loftyshaky/shared.git"
10
- },
11
- "exports": {
12
- "./build/*": {
13
- "import": "./build/*.mjs",
14
- "require": "./build/*.mjs",
15
- "types": "./build/*.d.ts"
16
- },
17
- "./shared": {
18
- "import": "./shared.mjs",
19
- "require": "./shared.mjs",
20
- "types": "./src/ts/shared.d.ts"
21
- },
22
- "./shared_clean": {
23
- "import": "./shared_clean.mjs",
24
- "require": "./shared_clean.mjs",
25
- "types": "./src/ts/shared_clean.d.ts"
26
- },
27
- "./inputs": {
28
- "import": "./inputs.mjs",
29
- "require": "./inputs.mjs",
30
- "types": "./src/ts/inputs.d.ts"
31
- },
32
- "./settings": {
33
- "import": "./settings.mjs",
34
- "require": "./settings.mjs",
35
- "types": "./src/ts/settings.d.ts"
36
- },
37
- "./announcement": {
38
- "import": "./announcement.mjs",
39
- "require": "./announcement.mjs",
40
- "types": "./src/ts/announcement.d.ts"
41
- },
42
- "./dependencies": {
43
- "import": "./dependencies.mjs",
44
- "require": "./dependencies.mjs",
45
- "types": "./src/ts/dependencies.d.ts"
46
- },
47
- "./ext": {
48
- "import": "./ext.mjs",
49
- "require": "./ext.mjs",
50
- "types": "./src/ts/ext.d.ts"
51
- }
52
- },
53
- "scripts": {
54
- "pub": "npm publish --access public"
55
- }
56
- }
1
+ {
2
+ "name": "@loftyshaky/shared",
3
+ "version": "2.7.1",
4
+ "description": "-",
5
+ "license": "MIT",
6
+ "author": "loftyshaky",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/loftyshaky/shared.git"
10
+ },
11
+ "exports": {
12
+ "./build/*": {
13
+ "import": "./build/*.mjs",
14
+ "require": "./build/*.mjs",
15
+ "types": "./build/*.d.ts"
16
+ },
17
+ "./shared": {
18
+ "import": "./shared.mjs",
19
+ "require": "./shared.mjs",
20
+ "types": "./src/ts/shared.d.ts"
21
+ },
22
+ "./shared_clean": {
23
+ "import": "./shared_clean.mjs",
24
+ "require": "./shared_clean.mjs",
25
+ "types": "./src/ts/shared_clean.d.ts"
26
+ },
27
+ "./inputs": {
28
+ "import": "./inputs.mjs",
29
+ "require": "./inputs.mjs",
30
+ "types": "./src/ts/inputs.d.ts"
31
+ },
32
+ "./settings": {
33
+ "import": "./settings.mjs",
34
+ "require": "./settings.mjs",
35
+ "types": "./src/ts/settings.d.ts"
36
+ },
37
+ "./announcement": {
38
+ "import": "./announcement.mjs",
39
+ "require": "./announcement.mjs",
40
+ "types": "./src/ts/announcement.d.ts"
41
+ },
42
+ "./dependencies": {
43
+ "import": "./dependencies.mjs",
44
+ "require": "./dependencies.mjs",
45
+ "types": "./src/ts/dependencies.d.ts"
46
+ },
47
+ "./ext": {
48
+ "import": "./ext.mjs",
49
+ "require": "./ext.mjs",
50
+ "types": "./src/ts/ext.d.ts"
51
+ }
52
+ },
53
+ "scripts": {
54
+ "pub": "npm publish --access public"
55
+ }
56
+ }