@tochii/build 2.6.2 → 2.6.3
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.
- package/dist/cli.mjs +1 -1
- package/package.json +8 -4
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as r,b as V,c as N,d as Y,e as T,f as Z,g as ee,h as D}from"./chunk-S6QAP2TG.mjs";import Ce from"node:fs";import ve from"node:path";import I from"chalk";import{Command as Le}from"commander";import{build as Be}from"tsup";var J={name:"tochibuild",version:"2.6.2",description:"An extremely fast JavaScript/Typescript and CSS bundler with minimal configuration.",repository:"https://github.com/tochiResources/project/tree/main/packages/build/tochibuild.git",license:"MIT",keywords:["bundler","build","typescript","javascript","tsup","esbuild","glob","cli","node","tochi","tochiResources"],bin:"./dist/cli.mjs",scripts:{dev:"tsx cli.ts"},dependencies:{"@npmcli/arborist":"^9.1.1","bundle-require":"5.1.0",chalk:"^5.4.1",commander:"^13.1.0","cross-spawn":"^7.0.6",deepmerge:"^4.3.1","fast-glob":"^3.3.3",joycon:"3.1.1","npm-packlist":"^10.0.0","strip-json-comments":"5.0.1",tar:"^7.4.3",tsup:"8.4.0"},devDependencies:{"@types/cross-spawn":"^6.0.6","@types/node":"^22.15.17",tsx:"^4.19.4",typescript:"^5.8.3"},engines:{node:">=18.17.0"},files:["dist","types"]};function A(e,n){return n.command("[files...]","Bundle files").option("--entry <file>","Use a key-value pair as entry files").option("-d, --out-dir <dir>","Output directory").option("--format <format...>",'Bundle format, "cjs", "iife", "esm"').option("--minify [terser]","Minify bundle").option("--minify-whitespace","Minify whitespace").option("--minify-identifiers","Minify identifiers").option("--minify-syntax","Minify syntax").option("--keep-names","Keep original function and class names in minified code").option("--target <target...>",'Bundle target, "es20XX" or "esnext"').option("--legacy-output","Output different formats to different folder instead of using different extensions").option("--dts [entry]","Generate declaration file").option("--dts-resolve","Resolve externals types used for d.ts files").option("--dts-only","Emit declaration files only").option("--experimental-dts [entry]","Generate declaration file (experimental)").option("--sourcemap [inline]","Generate external sourcemap, or inline source: --sourcemap inline").option("--watch [path...]",'Watch mode, if path is not specified, it watches the current folder ".". Repeat "--watch" for more than one path').option("--ignore-watch <path...>","Ignore custom paths in watch mode").option("--onSuccess <command>","Execute command after successful build, specially useful for watch mode").option("--env.* <value>","Define compile-time env variables").option("--inject <file>","Replace a global variable with an import from another file").option("--define.* <value>","Define compile-time constants").option("--external <name>","Mark specific packages / package.json (dependencies and peerDependencies) as external").option("--global-name <name>","Global variable name for iife format").option("--jsxFactory <jsxFactory>","Name of JSX factory function").option("--jsxFragment <jsxFragment>","Name of JSX fragment function").option("--replaceNodeEnv","Replace process.env.NODE_ENV").option("--no-splitting","Disable code splitting").option("--clean","Clean output directory").option("--silent",'Suppress non-error logs (excluding "onSuccess" process output)').option("--pure <express...>","Mark specific expressions as pure").option("--metafile","Emit esbuild metafile (a JSON file)").option("--platform <platform>","Target platform").option("--loader <ext=loader>","Specify the loader for a file extension").option("--tsconfig <filename>","Use a custom tsconfig").option("--config <filename>","Use a custom config file").option("--no-config","Disable config file").option("--shims","Enable cjs and esm shims").option("--inject-style","Inject style tag to document head").option("--treeshake [strategy]",'Using Rollup for treeshaking instead, "recommended" or "smallest" or "safest"').option("--publicDir [dir]","Copy public directory to output directory").option("--killSignal <signal>",'Signal to kill child process, "SIGTERM" or "SIGKILL"').option("--cjsInterop","Enable cjs interop")}function H(e,n){n.command("config").description("Generate config files").option("--ext <string>","the file extension to use excluding the file extension (defaults to .ts)",".ts").option("-f, --filename <string>","the file name to use (defaults to tochibuild.config)","tochibuild.config").option("-o, --overwrite","whether or not to overwrite the config file if it already exists (defaults to false)",!1).option("--outDir <string...>","the absolute/relative output directory paths to create the config files in (defaults to the working directory)").action(s=>D.generateConfig(e,s,!1,!0))}import we from"node:path";import E from"chalk";import W from"node:fs";import C from"node:path";import w from"chalk";import oe from"joycon";import{bundleRequire as ge}from"bundle-require";import me from"strip-json-comments";import M from"chalk";var te={"--format":"esm","--minify":!1,"--sourcemap":!1,"--watch":!1,"--clean":!1,"--silent":!1,"--shims":!0,"--no-splitting":!1,"--treeshake":!0,"--cjsInterop":!0,"--platform":"neutral","--target":"esnext"};async function ie(e,n,s,o){let t={},i=[...n],f=a=>Array.isArray(a)?a:a.split(","),l=a=>a==="true"?!0:a==="false"?!1:isNaN(Number(a))?a:Number(a),p=a=>{let d=i.findIndex(L=>L===a||L.startsWith(`${a}=`));if(d===-1)return;let x=i[d];if(x.includes("="))return x.split("=").slice(1).join("=");let $=i[d+1];return!$||$.startsWith("-")?!0:$},g=a=>{let d=i.findIndex(x=>x===a||x.startsWith(`${a}=`));d!==-1&&(i[d].includes("=")?i.splice(d,1):i.splice(d,2))},h={"-d":"outDir","--out-dir":"outDir","--format":"format","--minify":"minify","--minify-whitespace":"minifyWhitespace","--minify-identifiers":"minifyIdentifiers","--minify-syntax":"minifySyntax","--keep-names":"keepNames","--target":"target","--legacy-output":"legacyOutput","--sourcemap":"sourcemap","--watch":"watch","--onSuccess":"onSuccess","--inject":"inject","--external":"external","--global-name":"globalName","--jsxFactory":"jsxFactory","--jsxFragment":"jsxFragment","--replaceNodeEnv":"replaceNodeEnv","--no-splitting":"splitting","--clean":"clean","--silent":"silent","--pure":"pure","--metafile":"metafile","--platform":"platform","--loader":"loader","--tsconfig":"tsconfig","--config":"config","--shims":"shims","--inject-style":"injectStyle","--treeshake":"treeshake","--publicDir":"publicDir","--killSignal":"killSignal","--cjsInterop":"cjsInterop"};for(let a of n)if(!(a in h)&&a!=="--no-config"&&!a.startsWith("--define."))return r.error(void 0,`Unknown CLI option: ${a}`),o&&process.exit(1),[];i.includes("--no-config")&&(t.config=!1,i.splice(i.indexOf("--no-config"),1));for(let[a,d]of Object.entries(h)){let x=a.startsWith("--")?a.replace(/^--/,"--no-"):null;if(x&&i.includes(x)){t[d]=!1,i.splice(i.indexOf(x),1);continue}let $=p(a);if($!==void 0){if(typeof $=="string"){let L=f($),ue=L.length>1?L.map(l):l(L[0]);t[d]=ue}else t[d]=$;g(a)}else a in te}let m=p("--dts"),c=i.includes("--dts-only"),b=i.includes("--dts-resolve");(m||c||b)&&(t.dts={},typeof m=="string"&&(t.dts.entry=m),c&&(t.dts.only=!0),b&&(t.dts.resolve=!0));let k=i.filter(a=>a.startsWith("--define."));if(k.length>0){t.define={};for(let a of k){let[,d]=a.split("--define."),[x,$]=d.split("=");t.define[x]=$}}let u=i.filter(a=>!a.startsWith("-"));u.length>0&&(t.entry=u);let y=s?await ee.mergeBuildOptionsAsync(s,{execute:!0,overrideOptions:t},!1,o):t,v=a=>Array.isArray(a)?a.length>0:Object.keys(a||{}).length>0;return(Array.isArray(y)?!y.some(a=>v(a.entry)):!v(y.entry))?(r.custom("error",`${M.red("No input files, try")} '${M.magenta(e)} ${M.gray("[...files]")}' ${M.red("instead")}`),o&&process.exit(1),[]):y}var O=process.cwd(),U=new oe,ne=async e=>{try{return he(await W.promises.readFile(e,"utf8"))}catch(n){throw n instanceof Error?new Error(`Failed to parse ${C.relative(O,e)}: ${n.message}`):n}};function he(e){try{return new Function(`return ${me(e).trim()}`)()}catch{return{}}}var ye={test:/\.json$/,load(e){return ne(e)}};U.addLoader(ye);async function be(e){let n=new oe,s=await n.resolve({files:e?[e]:["tochibuild.config.ts","tochibuild.config.cts","tochibuild.config.mts","tochibuild.config.js","tochibuild.config.cjs","tochibuild.config.mjs","tochibuild.config.json","package.json"],cwd:O,stopDir:C.parse(O).root,packageKey:"tochibuild"}),o=await n.resolve({files:e?[e]:["tsup.config.ts","tsup.config.cts","tsup.config.mts","tsup.config.js","tsup.config.cjs","tsup.config.mjs","tsup.config.json","package.json"],cwd:O,stopDir:C.parse(O).root,packageKey:"tsup"}),t=s||o;if(t){if(t.endsWith(".json")){let p=await ne(t);return t.endsWith("package.json")&&(p=p.tochibuild||p.tsup),p?{path:t,data:p}:{}}let i=await ge({filepath:t}),f=i.mod.tochibuild||i.mod.tsup||i.mod.default||i.mod,l=typeof f=="function"?await f():await f;return{path:t,data:l}}return{}}async function R(e=!1){return await B(["package.json"],e)}async function B(e,n=!1){n&&U.clearCache();let s=await U.load(e,O,C.dirname(O));return{...s,data:s.data||{}}}async function ke(e,n,s){let o=n?process.argv.slice(2):[],t=n?o.includes("--config"):!1,i=n?o.includes("--no-config"):!1,f=[...[".ts",".js",".cjs",".json"].map(d=>C.join(O,`tochibuild.config${d}`)),...[".ts",".js",".cjs",".json"].map(d=>C.join(O,`tsup.config${d}`))],l=s??await R(!0),p=l.data?.tochibuild,g=l.data?.tsup,h=p||g,m=!!Object.keys(h||{}).length,c=f.find(d=>W.existsSync(d)),b=m||!!c,k=c?C.relative(O,c).replace(/\\/g,"/"):void 0,u;if(!i&&c&&!t)u=c,r.log(`using existing configuration file: ${w.gray(k)}`);else if(!i&&!c&&t){if(u=o[o.indexOf("--config")+1],!W.existsSync(u)){r.error(void 0,`config file '${u}' does not exist`),r.info(`try running '${w.magenta(e)} ${w.blue("config")} ${w.gray("-h")}' to get help on how to generate a config file`);return}r.log(`using configuration file: ${w.gray(u)}`)}else if(!i&&!b&&!t){if(!n){r.error(void 0,"no configuration file found"),r.info(`try running '${w.magenta(e)} ${w.blue("config")} ${w.gray("-h")}' to get help on how to generate a config file`);return}if(o[0]==null||o[0]?.startsWith("-")){r.custom("error",`${w.red("No input files, try")} '${w.magenta(e)} ${w.gray("[...files]")}' ${w.red("instead")}`);return}}let v=await(async()=>{if(h)return h;if(!i&&(c||u))return(await be(c||u)).data})(),a=await ie(e,o,v,n).catch(d=>r.error(void 0,d?.message));if(a)return Array.isArray(a)?a:[a]}var re=ke,ae=async(e,n)=>{let s=n||(await R(!0)).data;if(!e)return s;if(typeof e=="string")return(await B([e],!0)).data;if(typeof e=="function")return e(s);if(typeof e=="object"){let o=e,t=s;return o.path&&(t=(await B([o.path],!0)).data),typeof o.data=="function"?o.data(t):typeof o.data=="object"&&o.data!==null?{...t,...o.data}:{...t,...e}}return s};function G(e,n){n.command("pack").description("Create a tarball (.tgz file) of the package").option("--dir <string>","path to the original package directory (relative/absolute) (defaults to the current working directory)").option("-p, --pkg <string>","the custom path to the package.json file (relative/absolute)","package.json").option("-o, --out <string>","the output tarball path (relative/absolute)","tochibuild.package.tgz").action(async s=>{let o={...s,dir:s.dir||we.relative(process.cwd(),".")||"."};r.info(`creating tarball with options:
|
|
2
|
+
import{a as r,b as V,c as N,d as Y,e as T,f as Z,g as ee,h as D}from"./chunk-S6QAP2TG.mjs";import Ce from"node:fs";import ve from"node:path";import I from"chalk";import{Command as Le}from"commander";import{build as Be}from"tsup";var J={name:"tochibuild",version:"2.6.3",description:"An extremely fast JavaScript/Typescript and CSS bundler with minimal configuration.",repository:"https://github.com/tochiResources/project/tree/main/packages/build/tochibuild.git",license:"MIT",keywords:["bundler","build","typescript","javascript","tsup","esbuild","glob","publish","lifecycle","hooks","cli","node","tochi","tochiResources"],bin:"./dist/cli.mjs",scripts:{dev:"tsx cli.ts"},dependencies:{"@npmcli/arborist":"^9.1.1","bundle-require":"5.1.0",chalk:"^5.4.1",commander:"^13.1.0","cross-spawn":"^7.0.6",deepmerge:"^4.3.1","fast-glob":"^3.3.3",joycon:"3.1.1","npm-packlist":"^10.0.0","strip-json-comments":"5.0.1",tar:"^7.4.3",tsup:"8.4.0"},devDependencies:{"@types/cross-spawn":"^6.0.6","@types/node":"^22.15.17",tsx:"^4.19.4",typescript:"^5.8.3"},files:["dist"],engines:{node:">=18.17.0"}};function A(e,n){return n.argument("[files...]","Bundle files").option("--entry <file>","Use a key-value pair as entry files").option("-d, --out-dir <dir>","Output directory").option("--format <format...>",'Bundle format, "cjs", "iife", "esm"').option("--minify [terser]","Minify bundle").option("--minify-whitespace","Minify whitespace").option("--minify-identifiers","Minify identifiers").option("--minify-syntax","Minify syntax").option("--keep-names","Keep original function and class names in minified code").option("--target <target...>",'Bundle target, "es20XX" or "esnext"').option("--legacy-output","Output different formats to different folder instead of using different extensions").option("--dts [entry]","Generate declaration file").option("--dts-resolve","Resolve externals types used for d.ts files").option("--dts-only","Emit declaration files only").option("--experimental-dts [entry]","Generate declaration file (experimental)").option("--sourcemap [inline]","Generate external sourcemap, or inline source: --sourcemap inline").option("--watch [path...]",'Watch mode, if path is not specified, it watches the current folder ".". Repeat "--watch" for more than one path').option("--ignore-watch <path...>","Ignore custom paths in watch mode").option("--onSuccess <command>","Execute command after successful build, specially useful for watch mode").option("--env.* <value>","Define compile-time env variables").option("--inject <file>","Replace a global variable with an import from another file").option("--define.* <value>","Define compile-time constants").option("--external <name>","Mark specific packages / package.json (dependencies and peerDependencies) as external").option("--global-name <name>","Global variable name for iife format").option("--jsxFactory <jsxFactory>","Name of JSX factory function").option("--jsxFragment <jsxFragment>","Name of JSX fragment function").option("--replaceNodeEnv","Replace process.env.NODE_ENV").option("--no-splitting","Disable code splitting").option("--clean","Clean output directory").option("--silent",'Suppress non-error logs (excluding "onSuccess" process output)').option("--pure <express...>","Mark specific expressions as pure").option("--metafile","Emit esbuild metafile (a JSON file)").option("--platform <platform>","Target platform").option("--loader <ext=loader>","Specify the loader for a file extension").option("--tsconfig <filename>","Use a custom tsconfig").option("--config <filename>","Use a custom config file").option("--no-config","Disable config file").option("--shims","Enable cjs and esm shims").option("--inject-style","Inject style tag to document head").option("--treeshake [strategy]",'Using Rollup for treeshaking instead, "recommended" or "smallest" or "safest"').option("--publicDir [dir]","Copy public directory to output directory").option("--killSignal <signal>",'Signal to kill child process, "SIGTERM" or "SIGKILL"').option("--cjsInterop","Enable cjs interop")}function H(e,n){n.command("config").description("Generate config files").option("--ext <string>","the file extension to use excluding the file extension (defaults to .ts)",".ts").option("-f, --filename <string>","the file name to use (defaults to tochibuild.config)","tochibuild.config").option("-o, --overwrite","whether or not to overwrite the config file if it already exists (defaults to false)",!1).option("--outDir <string...>","the absolute/relative output directory paths to create the config files in (defaults to the working directory)").action(s=>D.generateConfig(e,s,!1,!0))}import we from"node:path";import E from"chalk";import W from"node:fs";import C from"node:path";import w from"chalk";import oe from"joycon";import{bundleRequire as ge}from"bundle-require";import me from"strip-json-comments";import M from"chalk";var te={"--format":"esm","--minify":!1,"--sourcemap":!1,"--watch":!1,"--clean":!1,"--silent":!1,"--shims":!0,"--no-splitting":!1,"--treeshake":!0,"--cjsInterop":!0,"--platform":"neutral","--target":"esnext"};async function ie(e,n,s,o){let t={},i=[...n],f=a=>Array.isArray(a)?a:a.split(","),l=a=>a==="true"?!0:a==="false"?!1:isNaN(Number(a))?a:Number(a),p=a=>{let d=i.findIndex(L=>L===a||L.startsWith(`${a}=`));if(d===-1)return;let x=i[d];if(x.includes("="))return x.split("=").slice(1).join("=");let $=i[d+1];return!$||$.startsWith("-")?!0:$},g=a=>{let d=i.findIndex(x=>x===a||x.startsWith(`${a}=`));d!==-1&&(i[d].includes("=")?i.splice(d,1):i.splice(d,2))},h={"-d":"outDir","--out-dir":"outDir","--format":"format","--minify":"minify","--minify-whitespace":"minifyWhitespace","--minify-identifiers":"minifyIdentifiers","--minify-syntax":"minifySyntax","--keep-names":"keepNames","--target":"target","--legacy-output":"legacyOutput","--sourcemap":"sourcemap","--watch":"watch","--onSuccess":"onSuccess","--inject":"inject","--external":"external","--global-name":"globalName","--jsxFactory":"jsxFactory","--jsxFragment":"jsxFragment","--replaceNodeEnv":"replaceNodeEnv","--no-splitting":"splitting","--clean":"clean","--silent":"silent","--pure":"pure","--metafile":"metafile","--platform":"platform","--loader":"loader","--tsconfig":"tsconfig","--config":"config","--shims":"shims","--inject-style":"injectStyle","--treeshake":"treeshake","--publicDir":"publicDir","--killSignal":"killSignal","--cjsInterop":"cjsInterop"};for(let a of n)if(!(a in h)&&a!=="--no-config"&&!a.startsWith("--define."))return r.error(void 0,`Unknown CLI option: ${a}`),o&&process.exit(1),[];i.includes("--no-config")&&(t.config=!1,i.splice(i.indexOf("--no-config"),1));for(let[a,d]of Object.entries(h)){let x=a.startsWith("--")?a.replace(/^--/,"--no-"):null;if(x&&i.includes(x)){t[d]=!1,i.splice(i.indexOf(x),1);continue}let $=p(a);if($!==void 0){if(typeof $=="string"){let L=f($),ue=L.length>1?L.map(l):l(L[0]);t[d]=ue}else t[d]=$;g(a)}else a in te}let m=p("--dts"),c=i.includes("--dts-only"),b=i.includes("--dts-resolve");(m||c||b)&&(t.dts={},typeof m=="string"&&(t.dts.entry=m),c&&(t.dts.only=!0),b&&(t.dts.resolve=!0));let k=i.filter(a=>a.startsWith("--define."));if(k.length>0){t.define={};for(let a of k){let[,d]=a.split("--define."),[x,$]=d.split("=");t.define[x]=$}}let u=i.filter(a=>!a.startsWith("-"));u.length>0&&(t.entry=u);let y=s?await ee.mergeBuildOptionsAsync(s,{execute:!0,overrideOptions:t},!1,o):t,v=a=>Array.isArray(a)?a.length>0:Object.keys(a||{}).length>0;return(Array.isArray(y)?!y.some(a=>v(a.entry)):!v(y.entry))?(r.custom("error",`${M.red("No input files, try")} '${M.magenta(e)} ${M.gray("[...files]")}' ${M.red("instead")}`),o&&process.exit(1),[]):y}var O=process.cwd(),U=new oe,ne=async e=>{try{return he(await W.promises.readFile(e,"utf8"))}catch(n){throw n instanceof Error?new Error(`Failed to parse ${C.relative(O,e)}: ${n.message}`):n}};function he(e){try{return new Function(`return ${me(e).trim()}`)()}catch{return{}}}var ye={test:/\.json$/,load(e){return ne(e)}};U.addLoader(ye);async function be(e){let n=new oe,s=await n.resolve({files:e?[e]:["tochibuild.config.ts","tochibuild.config.cts","tochibuild.config.mts","tochibuild.config.js","tochibuild.config.cjs","tochibuild.config.mjs","tochibuild.config.json","package.json"],cwd:O,stopDir:C.parse(O).root,packageKey:"tochibuild"}),o=await n.resolve({files:e?[e]:["tsup.config.ts","tsup.config.cts","tsup.config.mts","tsup.config.js","tsup.config.cjs","tsup.config.mjs","tsup.config.json","package.json"],cwd:O,stopDir:C.parse(O).root,packageKey:"tsup"}),t=s||o;if(t){if(t.endsWith(".json")){let p=await ne(t);return t.endsWith("package.json")&&(p=p.tochibuild||p.tsup),p?{path:t,data:p}:{}}let i=await ge({filepath:t}),f=i.mod.tochibuild||i.mod.tsup||i.mod.default||i.mod,l=typeof f=="function"?await f():await f;return{path:t,data:l}}return{}}async function R(e=!1){return await B(["package.json"],e)}async function B(e,n=!1){n&&U.clearCache();let s=await U.load(e,O,C.dirname(O));return{...s,data:s.data||{}}}async function ke(e,n,s){let o=n?process.argv.slice(2):[],t=n?o.includes("--config"):!1,i=n?o.includes("--no-config"):!1,f=[...[".ts",".js",".cjs",".json"].map(d=>C.join(O,`tochibuild.config${d}`)),...[".ts",".js",".cjs",".json"].map(d=>C.join(O,`tsup.config${d}`))],l=s??await R(!0),p=l.data?.tochibuild,g=l.data?.tsup,h=p||g,m=!!Object.keys(h||{}).length,c=f.find(d=>W.existsSync(d)),b=m||!!c,k=c?C.relative(O,c).replace(/\\/g,"/"):void 0,u;if(!i&&c&&!t)u=c,r.log(`using existing configuration file: ${w.gray(k)}`);else if(!i&&!c&&t){if(u=o[o.indexOf("--config")+1],!W.existsSync(u)){r.error(void 0,`config file '${u}' does not exist`),r.info(`try running '${w.magenta(e)} ${w.blue("config")} ${w.gray("-h")}' to get help on how to generate a config file`);return}r.log(`using configuration file: ${w.gray(u)}`)}else if(!i&&!b&&!t){if(!n){r.error(void 0,"no configuration file found"),r.info(`try running '${w.magenta(e)} ${w.blue("config")} ${w.gray("-h")}' to get help on how to generate a config file`);return}if(o[0]==null||o[0]?.startsWith("-")){r.custom("error",`${w.red("No input files, try")} '${w.magenta(e)} ${w.gray("[...files]")}' ${w.red("instead")}`);return}}let v=await(async()=>{if(h)return h;if(!i&&(c||u))return(await be(c||u)).data})(),a=await ie(e,o,v,n).catch(d=>r.error(void 0,d?.message));if(a)return Array.isArray(a)?a:[a]}var re=ke,ae=async(e,n)=>{let s=n||(await R(!0)).data;if(!e)return s;if(typeof e=="string")return(await B([e],!0)).data;if(typeof e=="function")return e(s);if(typeof e=="object"){let o=e,t=s;return o.path&&(t=(await B([o.path],!0)).data),typeof o.data=="function"?o.data(t):typeof o.data=="object"&&o.data!==null?{...t,...o.data}:{...t,...e}}return s};function G(e,n){n.command("pack").description("Create a tarball (.tgz file) of the package").option("--dir <string>","path to the original package directory (relative/absolute) (defaults to the current working directory)").option("-p, --pkg <string>","the custom path to the package.json file (relative/absolute)","package.json").option("-o, --out <string>","the output tarball path (relative/absolute)","tochibuild.package.tgz").action(async s=>{let o={...s,dir:s.dir||we.relative(process.cwd(),".")||"."};r.info(`creating tarball with options:
|
|
3
3
|
${Object.entries(o).map(([l,p])=>`- ${l}: ${E.gray(p)}`).join(`
|
|
4
4
|
`)}`);let t;o.pkg&&o.pkg!=="package.json"&&(r.info(`loading custom package.json from ${E.gray(o.pkg)}`),t=await B([o.pkg],!0).then(l=>l.data));let i=await T({packageDir:process.cwd(),packageJsonData:t}),f=i.fileList.map(l=>`- ${E.gray(l)}`).join(`
|
|
5
5
|
`);r.success(`successfully created tarball from ${i.fileList.length} files:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tochii/build",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3",
|
|
4
4
|
"description": "An extremely fast JavaScript/Typescript and CSS bundler with minimal configuration.",
|
|
5
5
|
"repository": "https://github.com/tochiResources/project/tree/main/packages/build.git",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
"tsup",
|
|
13
13
|
"esbuild",
|
|
14
14
|
"glob",
|
|
15
|
+
"publish",
|
|
16
|
+
"lifecycle",
|
|
17
|
+
"hooks",
|
|
15
18
|
"cli",
|
|
16
19
|
"node",
|
|
17
20
|
"tochi",
|
|
@@ -37,15 +40,16 @@
|
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
39
42
|
"@types/node": "^22.15.17",
|
|
43
|
+
"esbuild": "^0.25.5",
|
|
40
44
|
"tsx": "^4.19.4",
|
|
41
45
|
"typescript": "^5.8.3"
|
|
42
46
|
},
|
|
43
|
-
"engines": {
|
|
44
|
-
"node": ">=18.17.0"
|
|
45
|
-
},
|
|
46
47
|
"files": [
|
|
47
48
|
"dist"
|
|
48
49
|
],
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=18.17.0"
|
|
52
|
+
},
|
|
49
53
|
"main": "dist/index.mjs",
|
|
50
54
|
"types": "dist/index.d.mts",
|
|
51
55
|
"exports": {
|