diff --git a/CHANGELOG.md b/CHANGELOG.md index aa0f369c..9e7911a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.10 + +- Cleanup + ## 0.0.9 - Cleanup diff --git a/Source/Configuration/esbuild.ts b/Source/Configuration/esbuild.ts index efb38c5f..bc08a36b 100644 --- a/Source/Configuration/esbuild.ts +++ b/Source/Configuration/esbuild.ts @@ -6,7 +6,7 @@ const Out = "Target"; export default { format: "esm", - minify: true, + minify: false, outdir: Out, platform: "node", target: "esnext", diff --git a/Target/Bin.js b/Target/Bin.js index 3918ca8d..56821e48 100644 --- a/Target/Bin.js +++ b/Target/Bin.js @@ -1,3 +1,3 @@ #!/usr/bin/env node -import"./Index.js"; +import "./Index.js"; //# sourceMappingURL=Bin.js.map diff --git a/Target/Bin.js.map b/Target/Bin.js.map index ee545b7c..9392778e 100644 --- a/Target/Bin.js.map +++ b/Target/Bin.js.map @@ -2,6 +2,6 @@ "version": 3, "sources": ["../Source/Bin.ts"], "sourcesContent": ["#!/usr/bin/env node\n\nimport \"./Index.js\";\n"], - "mappings": ";AAEA,MAAO", + "mappings": ";AAEA,OAAO;", "names": [] } diff --git a/Target/Command/Build.js b/Target/Command/Build.js index 89eedecb..86c780b8 100644 --- a/Target/Command/Build.js +++ b/Target/Command/Build.js @@ -1,2 +1,35 @@ -import{exec as i}from"child_process";import{deepmerge as s}from"deepmerge-ts";import{build as l}from"esbuild";import a from"fast-glob";import c from"../Configuration/esbuild.js";var y=async(o,r)=>{const t=[];for(const e of o)for(const p of await a(e.replaceAll("'","").replaceAll('"',"")))t.push(p);t.reverse(),await l(s(c,{entryPoints:Object.fromEntries(t.map(e=>[e.replace("Source/","").split(".").slice(0,-1).join("."),e]))})),r?.TypeScript?i(`tsc -p ${r?.TypeScript}`):i("tsc")};export{y as default}; +import { exec as Exec } from "child_process"; +import { deepmerge as Merge } from "deepmerge-ts"; +import { build as Build } from "esbuild"; +import Glob from "fast-glob"; +import esbuild from "../Configuration/esbuild.js"; +var Build_default = async (Files, Options) => { + const Pipe = []; + for (const File of Files) { + for (const _File of await Glob( + File.replaceAll("'", "").replaceAll('"', "") + )) { + Pipe.push(_File); + } + } + Pipe.reverse(); + await Build( + Merge(esbuild, { + entryPoints: Object.fromEntries( + Pipe.map((File) => [ + File.replace("Source/", "").split(".").slice(0, -1).join("."), + File + ]) + ) + }) + ); + if (Options?.TypeScript) { + Exec(`tsc -p ${Options?.TypeScript}`); + } else { + Exec("tsc"); + } +}; +export { + Build_default as default +}; //# sourceMappingURL=Build.js.map diff --git a/Target/Command/Build.js.map b/Target/Command/Build.js.map index 71d6000c..6d0f6557 100644 --- a/Target/Command/Build.js.map +++ b/Target/Command/Build.js.map @@ -2,6 +2,6 @@ "version": 3, "sources": ["../../Source/Command/Build.ts"], "sourcesContent": ["import { exec as Exec } from \"child_process\";\nimport { deepmerge as Merge } from \"deepmerge-ts\";\nimport type { BuildOptions } from \"esbuild\";\nimport { build as Build } from \"esbuild\";\nimport type { Pattern } from \"fast-glob\";\nimport Glob from \"fast-glob\";\nimport esbuild from \"../Configuration/esbuild.js\";\n\nexport type Pipe = string[];\n\nexport default async (Files: Pattern[], Options?: { TypeScript?: string }) => {\n\tconst Pipe: Pipe = [];\n\n\tfor (const File of Files) {\n\t\tfor (const _File of await Glob(\n\t\t\tFile.replaceAll(\"'\", \"\").replaceAll('\"', \"\")\n\t\t)) {\n\t\t\tPipe.push(_File);\n\t\t}\n\t}\n\n\tPipe.reverse();\n\n\tawait Build(\n\t\tMerge(esbuild, {\n\t\t\tentryPoints: Object.fromEntries(\n\t\t\t\tPipe.map((File) => [\n\t\t\t\t\tFile.replace(\"Source/\", \"\")\n\t\t\t\t\t\t.split(\".\")\n\t\t\t\t\t\t.slice(0, -1.0)\n\t\t\t\t\t\t.join(\".\"),\n\t\t\t\t\tFile,\n\t\t\t\t])\n\t\t\t),\n\t\t} satisfies BuildOptions)\n\t);\n\n\tif (Options?.TypeScript) {\n\t\tExec(`tsc -p ${Options?.TypeScript}`);\n\t} else {\n\t\tExec(\"tsc\");\n\t}\n};\n"], - "mappings": "AAAA,OAAS,QAAQA,MAAY,gBAC7B,OAAS,aAAaC,MAAa,eAEnC,OAAS,SAASC,MAAa,UAE/B,OAAOC,MAAU,YACjB,OAAOC,MAAa,8BAIpB,IAAOC,EAAQ,MAAOC,EAAkBC,IAAsC,CAC7E,MAAMC,EAAa,CAAC,EAEpB,UAAWC,KAAQH,EAClB,UAAWI,KAAS,MAAMP,EACzBM,EAAK,WAAW,IAAK,EAAE,EAAE,WAAW,IAAK,EAAE,CAC5C,EACCD,EAAK,KAAKE,CAAK,EAIjBF,EAAK,QAAQ,EAEb,MAAMN,EACLD,EAAMG,EAAS,CACd,YAAa,OAAO,YACnBI,EAAK,IAAKC,GAAS,CAClBA,EAAK,QAAQ,UAAW,EAAE,EACxB,MAAM,GAAG,EACT,MAAM,EAAG,EAAI,EACb,KAAK,GAAG,EACVA,CACD,CAAC,CACF,CACD,CAAwB,CACzB,EAEIF,GAAS,WACZP,EAAK,UAAUO,GAAS,UAAU,EAAE,EAEpCP,EAAK,KAAK,CAEZ", - "names": ["Exec", "Merge", "Build", "Glob", "esbuild", "Build_default", "Files", "Options", "Pipe", "File", "_File"] + "mappings": "AAAA,SAAS,QAAQ,YAAY;AAC7B,SAAS,aAAa,aAAa;AAEnC,SAAS,SAAS,aAAa;AAE/B,OAAO,UAAU;AACjB,OAAO,aAAa;AAIpB,IAAO,gBAAQ,OAAO,OAAkB,YAAsC;AAC7E,QAAM,OAAa,CAAC;AAEpB,aAAW,QAAQ,OAAO;AACzB,eAAW,SAAS,MAAM;AAAA,MACzB,KAAK,WAAW,KAAK,EAAE,EAAE,WAAW,KAAK,EAAE;AAAA,IAC5C,GAAG;AACF,WAAK,KAAK,KAAK;AAAA,IAChB;AAAA,EACD;AAEA,OAAK,QAAQ;AAEb,QAAM;AAAA,IACL,MAAM,SAAS;AAAA,MACd,aAAa,OAAO;AAAA,QACnB,KAAK,IAAI,CAAC,SAAS;AAAA,UAClB,KAAK,QAAQ,WAAW,EAAE,EACxB,MAAM,GAAG,EACT,MAAM,GAAG,EAAI,EACb,KAAK,GAAG;AAAA,UACV;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD,CAAwB;AAAA,EACzB;AAEA,MAAI,SAAS,YAAY;AACxB,SAAK,UAAU,SAAS,UAAU,EAAE;AAAA,EACrC,OAAO;AACN,SAAK,KAAK;AAAA,EACX;AACD;", + "names": [] } diff --git a/Target/Configuration/esbuild.d.ts b/Target/Configuration/esbuild.d.ts index c1c01317..636aa8fa 100644 --- a/Target/Configuration/esbuild.d.ts +++ b/Target/Configuration/esbuild.d.ts @@ -1,6 +1,6 @@ declare const _default: { format: "esm"; - minify: true; + minify: false; outdir: string; platform: "node"; target: string; diff --git a/Target/Configuration/esbuild.js b/Target/Configuration/esbuild.js index 8ebb70de..1a44e1e2 100644 --- a/Target/Configuration/esbuild.js +++ b/Target/Configuration/esbuild.js @@ -1,2 +1,41 @@ -import{copy as e}from"esbuild-plugin-copy";import{rm as i}from"fs/promises";const t="Target";var a={format:"esm",minify:!0,outdir:t,platform:"node",target:"esnext",write:!0,sourcemap:!0,plugins:[{name:"Target",setup(o){o.onStart(async()=>{try{await i(t,{recursive:!0})}catch(r){console.log(r)}})}},e({resolveFrom:"out",assets:[{from:"./Source/Configuration/TypeScript.json",to:"./Configuration/"}]})]};export{a as default}; +import { copy as Copy } from "esbuild-plugin-copy"; +import { rm as Remove } from "fs/promises"; +const Out = "Target"; +var esbuild_default = { + format: "esm", + minify: false, + outdir: Out, + platform: "node", + target: "esnext", + write: true, + sourcemap: true, + plugins: [ + { + name: "Target", + setup(build) { + build.onStart(async () => { + try { + await Remove(Out, { + recursive: true + }); + } catch (_Error) { + console.log(_Error); + } + }); + } + }, + Copy({ + resolveFrom: "out", + assets: [ + { + from: "./Source/Configuration/TypeScript.json", + to: "./Configuration/" + } + ] + }) + ] +}; +export { + esbuild_default as default +}; //# sourceMappingURL=esbuild.js.map diff --git a/Target/Configuration/esbuild.js.map b/Target/Configuration/esbuild.js.map index 8f220d05..2871665c 100644 --- a/Target/Configuration/esbuild.js.map +++ b/Target/Configuration/esbuild.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../../Source/Configuration/esbuild.ts"], - "sourcesContent": ["import type { BuildOptions, PluginBuild } from \"esbuild\";\nimport { copy as Copy } from \"esbuild-plugin-copy\";\nimport { rm as Remove } from \"fs/promises\";\n\nconst Out = \"Target\";\n\nexport default {\n\tformat: \"esm\",\n\tminify: true,\n\toutdir: Out,\n\tplatform: \"node\",\n\ttarget: \"esnext\",\n\twrite: true,\n\tsourcemap: true,\n\tplugins: [\n\t\t{\n\t\t\tname: \"Target\",\n\t\t\tsetup(build: PluginBuild) {\n\t\t\t\tbuild.onStart(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait Remove(Out, {\n\t\t\t\t\t\t\trecursive: true,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (_Error) {\n\t\t\t\t\t\tconsole.log(_Error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t\tCopy({\n\t\t\tresolveFrom: \"out\",\n\t\t\tassets: [\n\t\t\t\t{\n\t\t\t\t\tfrom: \"./Source/Configuration/TypeScript.json\",\n\t\t\t\t\tto: \"./Configuration/\",\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t],\n} satisfies BuildOptions;\n"], - "mappings": "AACA,OAAS,QAAQA,MAAY,sBAC7B,OAAS,MAAMC,MAAc,cAE7B,MAAMC,EAAM,SAEZ,IAAOC,EAAQ,CACd,OAAQ,MACR,OAAQ,GACR,OAAQD,EACR,SAAU,OACV,OAAQ,SACR,MAAO,GACP,UAAW,GACX,QAAS,CACR,CACC,KAAM,SACN,MAAME,EAAoB,CACzBA,EAAM,QAAQ,SAAY,CACzB,GAAI,CACH,MAAMH,EAAOC,EAAK,CACjB,UAAW,EACZ,CAAC,CACF,OAASG,EAAQ,CAChB,QAAQ,IAAIA,CAAM,CACnB,CACD,CAAC,CACF,CACD,EACAL,EAAK,CACJ,YAAa,MACb,OAAQ,CACP,CACC,KAAM,yCACN,GAAI,kBACL,CACD,CACD,CAAC,CACF,CACD", - "names": ["Copy", "Remove", "Out", "esbuild_default", "build", "_Error"] + "sourcesContent": ["import type { BuildOptions, PluginBuild } from \"esbuild\";\nimport { copy as Copy } from \"esbuild-plugin-copy\";\nimport { rm as Remove } from \"fs/promises\";\n\nconst Out = \"Target\";\n\nexport default {\n\tformat: \"esm\",\n\tminify: false,\n\toutdir: Out,\n\tplatform: \"node\",\n\ttarget: \"esnext\",\n\twrite: true,\n\tsourcemap: true,\n\tplugins: [\n\t\t{\n\t\t\tname: \"Target\",\n\t\t\tsetup(build: PluginBuild) {\n\t\t\t\tbuild.onStart(async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait Remove(Out, {\n\t\t\t\t\t\t\trecursive: true,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (_Error) {\n\t\t\t\t\t\tconsole.log(_Error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t\tCopy({\n\t\t\tresolveFrom: \"out\",\n\t\t\tassets: [\n\t\t\t\t{\n\t\t\t\t\tfrom: \"./Source/Configuration/TypeScript.json\",\n\t\t\t\t\tto: \"./Configuration/\",\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t],\n} satisfies BuildOptions;\n"], + "mappings": "AACA,SAAS,QAAQ,YAAY;AAC7B,SAAS,MAAM,cAAc;AAE7B,MAAM,MAAM;AAEZ,IAAO,kBAAQ;AAAA,EACd,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,WAAW;AAAA,EACX,SAAS;AAAA,IACR;AAAA,MACC,MAAM;AAAA,MACN,MAAM,OAAoB;AACzB,cAAM,QAAQ,YAAY;AACzB,cAAI;AACH,kBAAM,OAAO,KAAK;AAAA,cACjB,WAAW;AAAA,YACZ,CAAC;AAAA,UACF,SAAS,QAAQ;AAChB,oBAAQ,IAAI,MAAM;AAAA,UACnB;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD;AAAA,IACA,KAAK;AAAA,MACJ,aAAa;AAAA,MACb,QAAQ;AAAA,QACP;AAAA,UACC,MAAM;AAAA,UACN,IAAI;AAAA,QACL;AAAA,MACD;AAAA,IACD,CAAC;AAAA,EACF;AACD;", + "names": [] } diff --git a/Target/Index.js b/Target/Index.js index 0e66f1c3..5d5498ac 100644 --- a/Target/Index.js +++ b/Target/Index.js @@ -1,2 +1,10 @@ -import{Command as o}from"commander";import r from"./Command/Build.js";import t from"./Library/JSON.js";try{const{version:i}=await t("../package.json",import.meta.url);new o().name("baxast").version(i).description("Builds files").argument("","Files to build").option("-ts, --TypeScript ","TypeScript configuration file").action(r).parse()}catch(i){console.log(i)} +import { Command } from "commander"; +import Build from "./Command/Build.js"; +import _JSON from "./Library/JSON.js"; +try { + const { version } = await _JSON("../package.json", import.meta.url); + new Command().name("baxast").version(version).description("Builds files").argument("", "Files to build").option("-ts, --TypeScript ", "TypeScript configuration file").action(Build).parse(); +} catch (_Error) { + console.log(_Error); +} //# sourceMappingURL=Index.js.map diff --git a/Target/Index.js.map b/Target/Index.js.map index 11a75683..e07a203d 100644 --- a/Target/Index.js.map +++ b/Target/Index.js.map @@ -2,6 +2,6 @@ "version": 3, "sources": ["../Source/Index.ts"], "sourcesContent": ["import { Command } from \"commander\";\nimport Build from \"./Command/Build.js\";\nimport _JSON from \"./Library/JSON.js\";\n\ntry {\n\tconst { version } = await _JSON(\"../package.json\", import.meta.url);\n\n\tnew Command()\n\t\t.name(\"baxast\")\n\t\t.version(version)\n\t\t.description(\"Builds files\")\n\t\t.argument(\"\", \"Files to build\")\n\t\t.option(\"-ts, --TypeScript \", \"TypeScript configuration file\")\n\t\t.action(Build)\n\t\t.parse();\n} catch (_Error) {\n\tconsole.log(_Error);\n}\n"], - "mappings": "AAAA,OAAS,WAAAA,MAAe,YACxB,OAAOC,MAAW,qBAClB,OAAOC,MAAW,oBAElB,GAAI,CACH,KAAM,CAAE,QAAAC,CAAQ,EAAI,MAAMD,EAAM,kBAAmB,YAAY,GAAG,EAElE,IAAIF,EAAQ,EACV,KAAK,QAAQ,EACb,QAAQG,CAAO,EACf,YAAY,cAAc,EAC1B,SAAS,aAAc,gBAAgB,EACvC,OAAO,2BAA4B,+BAA+B,EAClE,OAAOF,CAAK,EACZ,MAAM,CACT,OAASG,EAAQ,CAChB,QAAQ,IAAIA,CAAM,CACnB", - "names": ["Command", "Build", "_JSON", "version", "_Error"] + "mappings": "AAAA,SAAS,eAAe;AACxB,OAAO,WAAW;AAClB,OAAO,WAAW;AAElB,IAAI;AACH,QAAM,EAAE,QAAQ,IAAI,MAAM,MAAM,mBAAmB,YAAY,GAAG;AAElE,MAAI,QAAQ,EACV,KAAK,QAAQ,EACb,QAAQ,OAAO,EACf,YAAY,cAAc,EAC1B,SAAS,cAAc,gBAAgB,EACvC,OAAO,4BAA4B,+BAA+B,EAClE,OAAO,KAAK,EACZ,MAAM;AACT,SAAS,QAAQ;AAChB,UAAQ,IAAI,MAAM;AACnB;", + "names": [] } diff --git a/Target/Library/JSON.js b/Target/Library/JSON.js index ebc497ec..4960c657 100644 --- a/Target/Library/JSON.js +++ b/Target/Library/JSON.js @@ -1,2 +1,13 @@ -import{readFile as a}from"fs/promises";import{dirname as i}from"path";import{fileURLToPath as m}from"url";var s=async(r,t=import.meta.url)=>JSON.parse((await a(`${i(m(t??import.meta.url))}/${r}`,"utf-8")).toString());export{s as default}; +import { readFile as _File } from "fs/promises"; +import { dirname as Dir } from "path"; +import { fileURLToPath as Path } from "url"; +var JSON_default = async (File, From = import.meta.url) => JSON.parse( + (await _File( + `${Dir(Path(From ?? import.meta.url))}/${File}`, + "utf-8" + )).toString() +); +export { + JSON_default as default +}; //# sourceMappingURL=JSON.js.map diff --git a/Target/Library/JSON.js.map b/Target/Library/JSON.js.map index 7688bcbb..9459b5cb 100644 --- a/Target/Library/JSON.js.map +++ b/Target/Library/JSON.js.map @@ -2,6 +2,6 @@ "version": 3, "sources": ["../../Source/Library/JSON.ts"], "sourcesContent": ["import { readFile as _File } from \"fs/promises\";\nimport { dirname as Dir } from \"path\";\nimport { fileURLToPath as Path } from \"url\";\n\nexport default async (File: string, From: string = import.meta.url) =>\n\tJSON.parse(\n\t\t(\n\t\t\tawait _File(\n\t\t\t\t`${Dir(Path(From ?? import.meta.url))}/${File}`,\n\t\t\t\t\"utf-8\"\n\t\t\t)\n\t\t).toString()\n\t);\n"], - "mappings": "AAAA,OAAS,YAAYA,MAAa,cAClC,OAAS,WAAWC,MAAW,OAC/B,OAAS,iBAAiBC,MAAY,MAEtC,IAAOC,EAAQ,MAAOC,EAAcC,EAAe,YAAY,MAC9D,KAAK,OAEH,MAAML,EACL,GAAGC,EAAIC,EAAKG,GAAQ,YAAY,GAAG,CAAC,CAAC,IAAID,CAAI,GAC7C,OACD,GACC,SAAS,CACZ", - "names": ["_File", "Dir", "Path", "JSON_default", "File", "From"] + "mappings": "AAAA,SAAS,YAAY,aAAa;AAClC,SAAS,WAAW,WAAW;AAC/B,SAAS,iBAAiB,YAAY;AAEtC,IAAO,eAAQ,OAAO,MAAc,OAAe,YAAY,QAC9D,KAAK;AAAA,GAEH,MAAM;AAAA,IACL,GAAG,IAAI,KAAK,QAAQ,YAAY,GAAG,CAAC,CAAC,IAAI,IAAI;AAAA,IAC7C;AAAA,EACD,GACC,SAAS;AACZ;", + "names": [] } diff --git a/package.json b/package.json index 2af036b3..c180f0b4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "baxast", - "version": "0.0.9", + "version": "0.0.10", "homepage": "https://github.com/baxast/baxast#readme", "bugs": { "url": "https://github.com/baxast/baxast/issues"