diff --git a/.npmignore b/.npmignore index 489a35333..2ddc195c5 100644 --- a/.npmignore +++ b/.npmignore @@ -4,3 +4,4 @@ CODE_OF_CONDUCT.md CONTRIBUTING.md docs/ Source/ +Configuration/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 91ea3113b..417a807cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +## 2.3.5 + +### Added + +- New Configuration folder with ESBuild.js and ESBuild.ts files +- Added browserslist as a development dependency + +### Changed + +- Updated .npmignore to exclude the Configuration/ directory +- Modified package.json scripts to use the new ESBuild configuration +- Updated version to 0.1.6 +- Enhanced error handling in CSS compression in Source/Function/Integration.ts +- Updated Source/Interface/CSS/lightningcss.ts to set default value for + unusedSymbols +- Added targets to Source/Variable/CSS/lightningcss.ts + ## 2.3.4 ### Changed diff --git a/Configuration/ESBuild.js b/Configuration/ESBuild.js new file mode 100644 index 000000000..c05a97b59 --- /dev/null +++ b/Configuration/ESBuild.js @@ -0,0 +1,41 @@ +/** + * @module ESBuild + * + */ +export default { + color: true, + format: "esm", + logLevel: "debug", + metafile: true, + minify: true, + outdir: "Target", + platform: "node", + target: "esnext", + tsconfig: "tsconfig.json", + write: true, + plugins: [ + { + name: "Target", + setup({ onStart, initialOptions: { outdir } }) { + onStart(async () => { + try { + outdir + ? await (await import("fs/promises")).rm(outdir, { + recursive: true, + }) + : {}; + } + catch (_Error) { + console.log(_Error); + } + }); + }, + }, + ], + define: { + "process.env.VERSION_PACKAGE": `'${(await (await import("@playform/build/Target/Function/JSON.js")).default("package.json"))?.version}'`, + "process.env.TARGETS": JSON.stringify((await import("lightningcss")).browserslistToTargets( + // @ts-expect-error + (await import("browserslist")).default("defaults"))), + }, +}; diff --git a/Configuration/ESBuild.ts b/Configuration/ESBuild.ts new file mode 100644 index 000000000..3d0036f71 --- /dev/null +++ b/Configuration/ESBuild.ts @@ -0,0 +1,53 @@ +import type { BuildOptions } from "esbuild"; + +/** + * @module ESBuild + * + */ +export default { + color: true, + format: "esm", + logLevel: "debug", + metafile: true, + minify: true, + outdir: "Target", + platform: "node", + target: "esnext", + tsconfig: "tsconfig.json", + write: true, + plugins: [ + { + name: "Target", + setup({ onStart, initialOptions: { outdir } }) { + onStart(async () => { + try { + outdir + ? await ( + await import("fs/promises") + ).rm(outdir, { + recursive: true, + }) + : {}; + } catch (_Error) { + console.log(_Error); + } + }); + }, + }, + ], + define: { + "process.env.VERSION_PACKAGE": `'${ + ( + await ( + await import("@playform/build/Target/Function/JSON.js") + ).default("package.json") + )?.version + }'`, + "process.env.TARGETS": JSON.stringify( + (await import("lightningcss")).browserslistToTargets( + // @ts-expect-error + (await import("browserslist")).default("defaults"), + ), + ), + }, +} satisfies BuildOptions as BuildOptions; diff --git a/Source/Function/Integration.ts b/Source/Function/Integration.ts index 280de1354..f70fa43ed 100644 --- a/Source/Function/Integration.ts +++ b/Source/Function/Integration.ts @@ -107,33 +107,45 @@ export default ((...[_Option = {}]) => { case "CSS": { let CSS = Buffer.toString(); - // @ts-expect-error - if (Setting["lightningcss"]) { - CSS = (await import("lightningcss")) - .transform( - Merge( - { - code: ( - await import( - "buffer" - ) - ).Buffer.from(CSS), - filename: Input, - }, - // @ts-expect-error - Setting["lightningcss"], - ), + try { + // @ts-expect-error + if (Setting["lightningcss"]) { + CSS = ( + await import("lightningcss") ) - .code.toString(); - } + .transform( + Merge( + { + code: ( + await import( + "buffer" + ) + ).Buffer.from( + CSS, + ), + filename: Input, + }, + // @ts-expect-error + Setting[ + "lightningcss" + ], + ), + ) + .code.toString(); + } - // @ts-expect-error - if (Setting["csso"]) { - CSS = (await import("csso")).minify( - CSS, - // @ts-expect-error - Setting["csso"], - ).css; + // @ts-expect-error + if (Setting["csso"]) { + CSS = ( + await import("csso") + ).minify( + CSS, + // @ts-expect-error + Setting["csso"], + ).css; + } + } catch (_Error) { + console.log(_Error); } return CSS; @@ -207,8 +219,8 @@ export default ((...[_Option = {}]) => { Fulfilled: async ({ File, Info: { Total } }) => File > 0 ? `${(await import("kleur/colors")).green( - `✓ Successfully compressed a total of ${File} ${Type} ${ - File === 1 ? "file" : "files" + `✓ Successfully compressed a total of ${File} ${Type} file${ + File !== 1 ? "s" : "" } for ${( await import( "@playform/pipe/Target/Function/Bytes.js" diff --git a/Source/Interface/CSS/lightningcss.ts b/Source/Interface/CSS/lightningcss.ts index 3a68de9cc..e7eea8b47 100644 --- a/Source/Interface/CSS/lightningcss.ts +++ b/Source/Interface/CSS/lightningcss.ts @@ -19,8 +19,8 @@ export default interface Interface /** * Whether to remove unused selectors or keywords. * - * @default Compress false + * @default Compress [] * @default lightningcss undefined */ - unusedSymbols?: string[] | boolean; + unusedSymbols?: string[]; } diff --git a/Source/Variable/CSS/lightningcss.ts b/Source/Variable/CSS/lightningcss.ts index fb5139082..1e4bd3c66 100644 --- a/Source/Variable/CSS/lightningcss.ts +++ b/Source/Variable/CSS/lightningcss.ts @@ -1,3 +1,5 @@ +import type { Targets } from "lightningcss"; + import type Interface from "../../Interface/CSS/lightningcss.js"; /** @@ -8,4 +10,5 @@ export default { minify: true, sourceMap: false, unusedSymbols: [], + targets: process.env["TARGETS"] as Targets, } satisfies Interface as Interface; diff --git a/Target/Function/Directory.js b/Target/Function/Directory.js index 21b0bd209..a80935812 100644 --- a/Target/Function/Directory.js +++ b/Target/Function/Directory.js @@ -1 +1 @@ -var t=async(...[r])=>{let e=(await import("path")).normalize((await import("path")).parse(r).dir).replace(/\\/g,"/").replace((await import("./Integration.js")).System,"");return e.endsWith("/")||(e+="/"),e};export{t as default}; +var a=async(...[r])=>{let e=(await import("path")).normalize((await import("path")).parse(r).dir).replace(/\\/g,"/").replace((await import("./Integration.js")).System,"");return e.endsWith("/")||(e+="/"),e};export{a as default}; diff --git a/Target/Function/Image/Writesharp.js b/Target/Function/Image/Writesharp.js index 771b08719..fcd5e6be9 100644 --- a/Target/Function/Image/Writesharp.js +++ b/Target/Function/Image/Writesharp.js @@ -1 +1 @@ -var p=async(...[t,{Buffer:f,Input:r}])=>{const a=r.split(".").pop();if(!a)return;const e=typeof i[a]<"u"?i[a]:typeof t[a]<"u"?a:!1;if(e&&["avif","gif","heif","jpeg","png","raw","tiff","webp"].includes(e)&&typeof t[e]<"u"&&t[e]!==!1)return e in f&&await f[e](t[e]!==!0?t[e]:(await import("../../Variable/Image/sharp.js")).default).toBuffer()};const{default:i}=await import("../../Variable/Image/Mapsharp.js");export{i as _Map,p as default}; +var s=async(...[t,{Buffer:f,Input:r}])=>{const a=r.split(".").pop();if(!a)return;const e=typeof i[a]<"u"?i[a]:typeof t[a]<"u"?a:!1;if(e&&["avif","gif","heif","jpeg","png","raw","tiff","webp"].includes(e)&&typeof t[e]<"u"&&t[e]!==!1)return e in f&&await f[e](t[e]!==!0?t[e]:(await import("../../Variable/Image/sharp.js")).default).toBuffer()};const{default:i}=await import("../../Variable/Image/Mapsharp.js");export{i as _Map,s as default}; diff --git a/Target/Function/Integration.js b/Target/Function/Integration.js index 583c043d5..44588b602 100644 --- a/Target/Function/Integration.js +++ b/Target/Function/Integration.js @@ -1 +1 @@ -let l;var E=(...[p={}])=>{Object.entries(p).forEach(([a,r])=>Object.defineProperty(p,a,{value:r===!0?u[a]:p[a]}));const{Path:o,Cache:m,Logger:S,Map:y,Exclude:j,Action:g,CSS:b,HTML:A,Image:c,JavaScript:I,SVG:P,Parser:h}=n(u,p),f=new Set;return typeof o<"u"&&((Array.isArray(o)||o instanceof Set)&&o.forEach(a=>f.add(a)),o instanceof Map&&f.add(o)),typeof h=="object"&&Object.entries(h).forEach(([a,r])=>Object.defineProperty(h,a,{value:Array.isArray(r)?r:[r]})),{name:"astro-compress",hooks:{"astro:config:done":async({config:{outDir:{pathname:a}}})=>{l=(await import("path")).parse(a).dir.replace(/\\/g,"/"),l.startsWith("/")&&(l=l.substring(1))},"astro:build:done":async({dir:a})=>{if(typeof y=="object"){f.size===0&&f.add(a),typeof m=="object"&&m.Search===x&&(m.Search=a);for(const[r,i]of Object.entries({CSS:b,HTML:A,Image:c,JavaScript:I,SVG:P}))if(!(!(i&&y[r])||typeof i!="object")){d=n(g,n(g,{Wrote:async({Buffer:t,Input:s})=>{switch(r){case"CSS":{let e=t.toString();return i.lightningcss&&(e=(await import("lightningcss")).transform(n({code:(await import("buffer")).Buffer.from(e),filename:s},i.lightningcss)).code.toString()),i.csso&&(e=(await import("csso")).minify(e,i.csso).css),e}case"HTML":return await(await import("html-minifier-terser")).minify(t.toString(),i["html-minifier-terser"]);case"JavaScript":return(await(await import("terser")).minify(t.toString(),i.terser)).code??t;case"Image":try{return t instanceof(await import("sharp")).default?await(await import("./Image/Writesharp.js")).default(i.sharp,{Buffer:t,Input:s}):t}catch(e){return console.log(e),t}case"SVG":return(await import("svgo")).optimize(t.toString(),i.svgo).data??t;default:return t}},Fulfilled:async({File:t,Info:{Total:s}})=>t>0?`${(await import("kleur/colors")).green(`\u2713\u2001Successfully compressed a total of ${t} ${r} ${t===1?"file":"files"} for ${(await import("@playform/pipe/Target/Function/Bytes.js")).default(s)}.`)}`:!1})),r==="Image"&&(d=n(d,{Read:async({Input:t,Buffer:s})=>{try{(await import("sharp")).default.cache(!1);const{format:e}=await(await import("sharp")).default(t).metadata(),w={animated:e==="webp"||e==="gif"};return(await import("sharp")).default(t,typeof c=="object"&&typeof c.sharp=="object"&&typeof c.sharp.sharp=="object"?n(w,c.sharp?.sharp):w)}catch(e){return console.log(e),s}}}));for(const t of f)await(await(await(await new(await import("@playform/pipe")).default(m,S).In(t)).By(y[r]??"**/*")).Not(j)).Pipe(d)}}}}}};const{default:u}=await import("../Variable/Option.js"),{default:{Cache:{Search:x}}}=await import("@playform/pipe/Target/Variable/Option.js"),{default:n}=await import("./Merge.js");let d;export{u as Default,n as Merge,x as Search,l as System,d as _Action,E as default}; +let d;var M=(...[p={}])=>{Object.entries(p).forEach(([a,r])=>Object.defineProperty(p,a,{value:r===!0?u[a]:p[a]}));const{Path:i,Cache:m,Logger:S,Map:h,Exclude:j,Action:w,CSS:b,HTML:A,Image:c,JavaScript:I,SVG:P,Parser:g}=n(u,p),f=new Set;return typeof i<"u"&&((Array.isArray(i)||i instanceof Set)&&i.forEach(a=>f.add(a)),i instanceof Map&&f.add(i)),typeof g=="object"&&Object.entries(g).forEach(([a,r])=>Object.defineProperty(g,a,{value:Array.isArray(r)?r:[r]})),{name:"astro-compress",hooks:{"astro:config:done":async({config:{outDir:{pathname:a}}})=>{d=(await import("path")).parse(a).dir.replace(/\\/g,"/"),d.startsWith("/")&&(d=d.substring(1))},"astro:build:done":async({dir:a})=>{if(typeof h=="object"){f.size===0&&f.add(a),typeof m=="object"&&m.Search===x&&(m.Search=a);for(const[r,o]of Object.entries({CSS:b,HTML:A,Image:c,JavaScript:I,SVG:P}))if(!(!(o&&h[r])||typeof o!="object")){y=n(w,n(w,{Wrote:async({Buffer:t,Input:s})=>{switch(r){case"CSS":{let e=t.toString();try{o.lightningcss&&(e=(await import("lightningcss")).transform(n({code:(await import("buffer")).Buffer.from(e),filename:s},o.lightningcss)).code.toString()),o.csso&&(e=(await import("csso")).minify(e,o.csso).css)}catch(l){console.log(l)}return e}case"HTML":return await(await import("html-minifier-terser")).minify(t.toString(),o["html-minifier-terser"]);case"JavaScript":return(await(await import("terser")).minify(t.toString(),o.terser)).code??t;case"Image":try{return t instanceof(await import("sharp")).default?await(await import("./Image/Writesharp.js")).default(o.sharp,{Buffer:t,Input:s}):t}catch(e){return console.log(e),t}case"SVG":return(await import("svgo")).optimize(t.toString(),o.svgo).data??t;default:return t}},Fulfilled:async({File:t,Info:{Total:s}})=>t>0?`${(await import("kleur/colors")).green(`\u2713\u2001Successfully compressed a total of ${t} ${r} file${t!==1?"s":""} for ${(await import("@playform/pipe/Target/Function/Bytes.js")).default(s)}.`)}`:!1})),r==="Image"&&(y=n(y,{Read:async({Input:t,Buffer:s})=>{try{(await import("sharp")).default.cache(!1);const{format:e}=await(await import("sharp")).default(t).metadata(),l={animated:e==="webp"||e==="gif"};return(await import("sharp")).default(t,typeof c=="object"&&typeof c.sharp=="object"&&typeof c.sharp.sharp=="object"?n(l,c.sharp?.sharp):l)}catch(e){return console.log(e),s}}}));for(const t of f)await(await(await(await new(await import("@playform/pipe")).default(m,S).In(t)).By(h[r]??"**/*")).Not(j)).Pipe(y)}}}}}};const{default:u}=await import("../Variable/Option.js"),{default:{Cache:{Search:x}}}=await import("@playform/pipe/Target/Variable/Option.js"),{default:n}=await import("./Merge.js");let y;export{u as Default,n as Merge,x as Search,d as System,y as _Action,M as default}; diff --git a/Target/Function/Merge.js b/Target/Function/Merge.js index e898449a9..73286f248 100644 --- a/Target/Function/Merge.js +++ b/Target/Function/Merge.js @@ -1 +1 @@ -var e=(await import("deepmerge-ts")).deepmergeCustom({mergeArrays:!1});export{e as default}; +var r=(await import("deepmerge-ts")).deepmergeCustom({mergeArrays:!1});export{r as default}; diff --git a/Target/Interface/CSS/lightningcss.d.ts b/Target/Interface/CSS/lightningcss.d.ts index c41397331..2f8cc0833 100644 --- a/Target/Interface/CSS/lightningcss.d.ts +++ b/Target/Interface/CSS/lightningcss.d.ts @@ -14,8 +14,8 @@ export default interface Interface extends Omit, /** * Whether to remove unused selectors or keywords. * - * @default Compress false + * @default Compress [] * @default lightningcss undefined */ - unusedSymbols?: string[] | boolean; + unusedSymbols?: string[]; } diff --git a/Target/Type/Image/Filesharp.js b/Target/Type/Image/Filesharp.js index b3505d34d..fbf373277 100644 --- a/Target/Type/Image/Filesharp.js +++ b/Target/Type/Image/Filesharp.js @@ -1 +1 @@ -const{default:e}=await import("../../Variable/Image/Mapsharp.js");export{e as _Map}; +const{default:p}=await import("../../Variable/Image/Mapsharp.js");export{p as _Map}; diff --git a/Target/Variable/CSS/csso.js b/Target/Variable/CSS/csso.js index 2d79820b6..34f0fce33 100644 --- a/Target/Variable/CSS/csso.js +++ b/Target/Variable/CSS/csso.js @@ -1 +1 @@ -var e={comments:!1,forceMediaMerge:!0,restructure:!1};export{e as default}; +var r={comments:!1,forceMediaMerge:!0,restructure:!1};export{r as default}; diff --git a/Target/Variable/CSS/lightningcss.js b/Target/Variable/CSS/lightningcss.js index 4fcff83a0..f5a193cb7 100644 --- a/Target/Variable/CSS/lightningcss.js +++ b/Target/Variable/CSS/lightningcss.js @@ -1 +1 @@ -var e={minify:!0,sourceMap:!1,unusedSymbols:[]};export{e as default}; +var e={and_chr:8454144,and_ff:8519680,android:8454144,chrome:7143424,edge:8323072,firefox:7536640,ios_saf:984576,op_mob:5242880,opera:7405568,safari:1115392,samsung:1572864};var r={minify:!0,sourceMap:!1,unusedSymbols:[],targets:e};export{r as default}; diff --git a/Target/Variable/HTML/html-minifier-terser.js b/Target/Variable/HTML/html-minifier-terser.js index c082d0fe5..7230a8037 100644 --- a/Target/Variable/HTML/html-minifier-terser.js +++ b/Target/Variable/HTML/html-minifier-terser.js @@ -1 +1 @@ -var t={caseSensitive:!0,collapseInlineTagWhitespace:!1,collapseWhitespace:!0,continueOnParseError:!0,html5:!0,ignoreCustomComments:[/^\s*#/,/.*\$.*/,/^\s*\[/,/^\s*\]/,/^\s*!/,/^\s*\//,/^\s*astro:.*/,/^\s*astro:end/],ignoreCustomFragments:[],includeAutoGeneratedTags:!0,keepClosingSlash:!0,minifyCSS:!0,minifyJS:!0,minifyURLs:!1,noNewlinesBeforeTagClose:!0,preventAttributesEscaping:!1,processConditionalComments:!1,processScripts:["application/ecmascript","application/javascript","application/json","application/ld+json","application/manifest+json","application/schema+json","application/vnd.geo+json","application/x-web-app-manifest+json","application/xhtml+xml","application/xml","image/svg+xml","template-worker","template","text/css","text/ecmascript","text/html","text/javascript","text/markdown","text/ng-template","text/plain","text/template","text/x-dust","text/x-dustjs","text/x-eco-template","text/x-eco","text/x-handlebars-template","text/x-handlebars","text/x-jade-template","text/x-jade","text/x-less","text/x-lodash-template","text/x-lodash","text/x-markdown","text/x-mustache-template","text/x-mustache","text/x-pug-template","text/x-pug","text/x-sass","text/x-scss","text/x-stylus","text/x-template","text/x-underscore-template","text/x-underscore","text/x-yaml","text/xml"],quoteCharacter:'"',removeAttributeQuotes:!0,removeComments:!0,removeScriptTypeAttributes:!0,removeStyleLinkTypeAttributes:!0,removeTagWhitespace:!1,sortAttributes:!0,sortClassName:!0,trimCustomFragments:!0,useShortDoctype:!1};export{t as default}; +var e={caseSensitive:!0,collapseInlineTagWhitespace:!1,collapseWhitespace:!0,continueOnParseError:!0,html5:!0,ignoreCustomComments:[/^\s*#/,/.*\$.*/,/^\s*\[/,/^\s*\]/,/^\s*!/,/^\s*\//,/^\s*astro:.*/,/^\s*astro:end/],ignoreCustomFragments:[],includeAutoGeneratedTags:!0,keepClosingSlash:!0,minifyCSS:!0,minifyJS:!0,minifyURLs:!1,noNewlinesBeforeTagClose:!0,preventAttributesEscaping:!1,processConditionalComments:!1,processScripts:["application/ecmascript","application/javascript","application/json","application/ld+json","application/manifest+json","application/schema+json","application/vnd.geo+json","application/x-web-app-manifest+json","application/xhtml+xml","application/xml","image/svg+xml","template-worker","template","text/css","text/ecmascript","text/html","text/javascript","text/markdown","text/ng-template","text/plain","text/template","text/x-dust","text/x-dustjs","text/x-eco-template","text/x-eco","text/x-handlebars-template","text/x-handlebars","text/x-jade-template","text/x-jade","text/x-less","text/x-lodash-template","text/x-lodash","text/x-markdown","text/x-mustache-template","text/x-mustache","text/x-pug-template","text/x-pug","text/x-sass","text/x-scss","text/x-stylus","text/x-template","text/x-underscore-template","text/x-underscore","text/x-yaml","text/xml"],quoteCharacter:'"',removeAttributeQuotes:!0,removeComments:!0,removeScriptTypeAttributes:!0,removeStyleLinkTypeAttributes:!0,removeTagWhitespace:!1,sortAttributes:!0,sortClassName:!0,trimCustomFragments:!0,useShortDoctype:!1};export{e as default}; diff --git a/Target/Variable/Image/Mapsharp.js b/Target/Variable/Image/Mapsharp.js index 2a4777e58..377f62612 100644 --- a/Target/Variable/Image/Mapsharp.js +++ b/Target/Variable/Image/Mapsharp.js @@ -1 +1 @@ -var e={avci:"avif",avcs:"avif",avifs:"avif",heic:"heif",heics:"heif",heifs:"heif",jfif:"jpeg",jif:"jpeg",jpe:"jpeg",apng:"png",jpg:"jpeg"};export{e as default}; +var f={avci:"avif",avcs:"avif",avifs:"avif",heic:"heif",heics:"heif",heifs:"heif",jfif:"jpeg",jif:"jpeg",jpe:"jpeg",apng:"png",jpg:"jpeg"};export{f as default}; diff --git a/Target/Variable/Image/sharp.js b/Target/Variable/Image/sharp.js index 7ace63328..0f1486c4d 100644 --- a/Target/Variable/Image/sharp.js +++ b/Target/Variable/Image/sharp.js @@ -1 +1 @@ -var e={avif:{chromaSubsampling:"4:4:4",effort:9,lossless:!0},gif:{effort:10},jpeg:{chromaSubsampling:"4:4:4",mozjpeg:!0,trellisQuantisation:!0,overshootDeringing:!0,optimiseScans:!0},png:{compressionLevel:9,palette:!0},tiff:{compression:"lzw"},webp:{effort:6,lossless:!0},heif:{effort:9,lossless:!0},sharp:{failOn:"error",sequentialRead:!0,unlimited:!0}};export{e as default}; +var r={avif:{chromaSubsampling:"4:4:4",effort:9,lossless:!0},gif:{effort:10},jpeg:{chromaSubsampling:"4:4:4",mozjpeg:!0,trellisQuantisation:!0,overshootDeringing:!0,optimiseScans:!0},png:{compressionLevel:9,palette:!0},tiff:{compression:"lzw"},webp:{effort:6,lossless:!0},heif:{effort:9,lossless:!0},sharp:{failOn:"error",sequentialRead:!0,unlimited:!0}};export{r as default}; diff --git a/Target/Variable/JavaScript/terser.js b/Target/Variable/JavaScript/terser.js index aaf215a8d..93491467f 100644 --- a/Target/Variable/JavaScript/terser.js +++ b/Target/Variable/JavaScript/terser.js @@ -1 +1 @@ -var e={ecma:5,enclose:!1,keep_classnames:!1,keep_fnames:!1,ie8:!1,module:!1,safari10:!1,toplevel:!1,format:{comments:!1}};export{e as default}; +var s={ecma:5,enclose:!1,keep_classnames:!1,keep_fnames:!1,ie8:!1,module:!1,safari10:!1,toplevel:!1,format:{comments:!1}};export{s as default}; diff --git a/Target/Variable/Map.js b/Target/Variable/Map.js index a61c86a10..0402cf64c 100644 --- a/Target/Variable/Map.js +++ b/Target/Variable/Map.js @@ -1 +1 @@ -var e={CSS:"**/*.css",HTML:"**/*.html",Image:"**/*.{apng,avci,avcs,avif,avifs,gif,heic,heics,heif,heifs,jfif,jif,jpe,jpeg,jpg,png,raw,tiff,webp}",JavaScript:"**/*.{js,mjs,cjs,jsm,mts,tsx,ts}",SVG:"**/*.svg"};export{e as default}; +var s={CSS:"**/*.css",HTML:"**/*.html",Image:"**/*.{apng,avci,avcs,avif,avifs,gif,heic,heics,heif,heifs,jfif,jif,jpe,jpeg,jpg,png,raw,tiff,webp}",JavaScript:"**/*.{js,mjs,cjs,jsm,mts,tsx,ts}",SVG:"**/*.svg"};export{s as default}; diff --git a/Target/Variable/Option.js b/Target/Variable/Option.js index 9f87111cd..e0849e705 100644 --- a/Target/Variable/Option.js +++ b/Target/Variable/Option.js @@ -1 +1 @@ -var p=(await import("../Function/Merge.js")).default((await import("@playform/pipe/Target/Variable/Option.js")).default,{CSS:{csso:(await import("./CSS/csso.js")).default,lightningcss:(await import("./CSS/lightningcss.js")).default},HTML:{"html-minifier-terser":(await import("./HTML/html-minifier-terser.js")).default},JavaScript:{terser:(await import("./JavaScript/terser.js")).default},Image:{sharp:(await import("./Image/sharp.js")).default},SVG:{svgo:(await import("./SVG/svgo.js")).default},Map:(await import("./Map.js")).default,Parser:(await import("./Parser.js")).default,Action:{Failed:async({Input:t})=>`${r("Error:")} Cannot compress file ${e(await o(t))}${r((await import("path")).parse(t).base)}`,Passed:async({Before:t,Buffer:a})=>t>s.byteLength(a.toString()),Accomplished:async({Input:t,Before:a,After:f})=>{const i=a-f;return`${e(`(-${(await import("@playform/pipe/Target/Function/Bytes.js")).default(i)})`)} ${(await import("kleur/colors")).green(`${(i/a*100).toFixed(2)}%`)} reduction in ${e(await o(t))}${(await import("kleur/colors")).cyan((await import("path")).parse(t).base)}`},Changed:async t=>Object.defineProperty(t.Info,"Total",{value:(t.Info.Total?t.Info.Total:0)+(t.On.Before-t.On.After),configurable:!0,writable:!0})&&t}});const{gray:e,red:r}=await import("kleur/colors"),{default:o}=await import("../Function/Directory.js"),{Buffer:s}=await import("buffer");export{p as default}; +var n=(await import("../Function/Merge.js")).default((await import("@playform/pipe/Target/Variable/Option.js")).default,{CSS:{csso:(await import("./CSS/csso.js")).default,lightningcss:(await import("./CSS/lightningcss.js")).default},HTML:{"html-minifier-terser":(await import("./HTML/html-minifier-terser.js")).default},JavaScript:{terser:(await import("./JavaScript/terser.js")).default},Image:{sharp:(await import("./Image/sharp.js")).default},SVG:{svgo:(await import("./SVG/svgo.js")).default},Map:(await import("./Map.js")).default,Parser:(await import("./Parser.js")).default,Action:{Failed:async({Input:t})=>`${r("Error:")} Cannot compress file ${e(await o(t))}${r((await import("path")).parse(t).base)}`,Passed:async({Before:t,Buffer:a})=>t>s.byteLength(a.toString()),Accomplished:async({Input:t,Before:a,After:f})=>{const i=a-f;return`${e(`(-${(await import("@playform/pipe/Target/Function/Bytes.js")).default(i)})`)} ${(await import("kleur/colors")).green(`${(i/a*100).toFixed(2)}%`)} reduction in ${e(await o(t))}${(await import("kleur/colors")).cyan((await import("path")).parse(t).base)}`},Changed:async t=>Object.defineProperty(t.Info,"Total",{value:(t.Info.Total?t.Info.Total:0)+(t.On.Before-t.On.After),configurable:!0,writable:!0})&&t}});const{gray:e,red:r}=await import("kleur/colors"),{default:o}=await import("../Function/Directory.js"),{Buffer:s}=await import("buffer");export{n as default}; diff --git a/Target/Variable/Parser.js b/Target/Variable/Parser.js index 4f94890fe..d264982af 100644 --- a/Target/Variable/Parser.js +++ b/Target/Variable/Parser.js @@ -1 +1 @@ -var e={CSS:["csso","lightningcss"],HTML:"html-minifier-terser",Image:"sharp",JavaScript:"terser",SVG:"svgo"};export{e as default}; +var r={CSS:["csso","lightningcss"],HTML:"html-minifier-terser",Image:"sharp",JavaScript:"terser",SVG:"svgo"};export{r as default}; diff --git a/Target/Variable/SVG/svgo.js b/Target/Variable/SVG/svgo.js index ae1973b7a..abd22e2b8 100644 --- a/Target/Variable/SVG/svgo.js +++ b/Target/Variable/SVG/svgo.js @@ -1 +1 @@ -var e={multipass:!0,js2svg:{indent:0,pretty:!1},plugins:["preset-default"]};export{e as default}; +var s={multipass:!0,js2svg:{indent:0,pretty:!1},plugins:["preset-default"]};export{s as default}; diff --git a/package.json b/package.json index 86a694166..91b336261 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "astro-compress", - "version": "2.3.4", + "version": "2.3.5", "private": false, "description": "🗜️ Compress —", "keywords": [ @@ -37,8 +37,8 @@ "main": "./Target/Function/Integration.js", "types": "./Target/Function/Integration.d.ts", "scripts": { - "Run": "Build 'Source/**/*.ts' --Watch", - "prepublishOnly": "Build 'Source/**/*.ts'" + "Run": "Build 'Source/**/*.ts' --Watch --ESBuild Configuration/ESBuild.ts", + "prepublishOnly": "Build 'Source/**/*.ts' --ESBuild Configuration/ESBuild.ts" }, "dependencies": { "@playform/pipe": "0.1.1", @@ -57,7 +57,8 @@ "terser": "5.36.0" }, "devDependencies": { - "@playform/build": "0.1.8" + "@playform/build": "0.1.8", + "browserslist": "4.24.2" }, "publishConfig": { "access": "public",