@tochii/build 1.0.4 → 1.0.5
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/README.md +2 -2
- package/dist/chunk-SOF474NV.mjs +1 -0
- package/dist/{chunk-LTYPVCKJ.mjs → chunk-VMOULNHQ.mjs} +1 -1
- package/dist/cli.mjs +7 -7
- package/dist/index.mjs +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/node/utils.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-QFYOHOZF.mjs +0 -1
package/README.md
CHANGED
@@ -84,5 +84,5 @@ tochibuild config -o node
|
|
84
84
|
These are the only available bundlers for now.
|
85
85
|
|
86
86
|
**node**
|
87
|
-
- Uses tsup under the hood (https://tsup.egoist.dev) which is powered by esbuild
|
88
|
-
- Supports both javascript and typescript eg. `.js`, `.json`, `.mjs`, `.ts` and
|
87
|
+
- Uses `tsup` under the hood (https://tsup.egoist.dev) which is powered by `esbuild`.
|
88
|
+
- Supports both javascript and typescript eg. `.js`, `.json`, `.mjs`, `.ts` and `.tsx`. CSS support is experimental.
|
@@ -0,0 +1 @@
|
|
1
|
+
var e=class n{static{this.ignoredEntries=["!node_modules","!**/*/node_modules","!*.d.ts","!**/*/*.d.ts","!tsup.config*","!**/*/tsup.config*"]}static{this.entriesCommon=["*.js","*.ts","**/*/*.js","**/*/*.ts"]}static{this.entriesIndex=["index.js","index.ts","**/*/index.js","**/*/index.ts"]}static{this.defaultEntriesIndex=[...n.entriesIndex,...n.ignoredEntries]}static{this.defaultEntriesCommon=[...n.entriesCommon,...n.ignoredEntries]}static{this.defaultOptions=t=>({tsconfig:"tsconfig.json",dts:!0,format:["esm"],minify:!0,...t,entry:s(t.entry,"ignoredEntries")})}static{this.defaultOptionsIndexEntries=t=>({entry:s(t.entry,"defaultEntriesIndex"),tsconfig:"tsconfig.json",dts:!0,format:["esm"],minify:!0,...t})}static{this.defaultOptionsCommonEntries=t=>({entry:s(t.entry,"defaultEntriesCommon"),tsconfig:"tsconfig.json",dts:!0,format:["esm"],minify:!0,...t})}},o=e;function s(n,t){if(Array.isArray(n))return[...n,...e[t]];let r={};return e[t].forEach(i=>r[i]=i),{...n,...r}}export{e as a,o as b};
|
@@ -1 +1 @@
|
|
1
|
-
import{b as t}from"./chunk-
|
1
|
+
import{b as t}from"./chunk-SOF474NV.mjs";import{defineConfig as n}from"tsup";var p={Utils:t,defineConfigTsup:n,defineConfig:o,defineConfigIndexEntries:i,defineConfigCommonEntrie:r};function o(...e){return n(t.defaultOptions(...e))}function i(...e){return n(t.defaultOptionsIndexEntries(...e))}function r(...e){return n(t.defaultOptionsCommonEntries(...e))}export{n as a,p as b,o as c,i as d,r as e};
|
package/dist/cli.mjs
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
-
import s from"chalk";import
|
2
|
+
import s from"chalk";import f from"fs";import y from"path";import{Command as w}from"commander";import{spawn as x}from"child_process";import{dirname as m,resolve as g}from"path";import{fileURLToPath as h}from"url";var a=g(m(h(import.meta.url)),"../node_modules/.bin/tsup");var u={name:"@tochii/build",version:"1.0.5",description:"Tools for bundling your projects in Node.js",repository:"https://github.com/tochiResources/project/packages/build.git",license:"MIT",bin:{tochibuild:"./dist/cli.mjs"},scripts:{build:"tsup-node",dev:"tsx cli.ts"},dependencies:{chalk:"^5.4.1",commander:"^13.1.0",tsup:"^8.4.0"},devDependencies:{"@tochii/build":"^1.0.1","@types/node":"^22.15.17",tsx:"^4.19.4",typescript:"^5.8.3"},engines:{node:">=18.17.0"},files:["dist"]};var v={node:"tsup-node"},k={node:a},d=s.cyan("tochibuild"),p=new w("tochibuild").name("tochibuild <command>").description("Tools for bundling your projects in Node.js").allowUnknownOption(!0).version(u.version);p.command("node").description("bundle a Node.js project using tsup (https://tsup.egoist.dev)").allowUnknownOption(!0).argument("[...args]","arguments to pass to tsup").option("-l, --local","whether to use the local tsup instead of the temporary one (defaults to false)",!1).action(async e=>T("node",e));p.command("config").description("generate config files for the selected bundler").argument("<bundler>","bundler to generate config for").option("--ext <string>","the file extension to use excluding the file extension (defaults to the common one for the bundler)","").option("-f, --file <string>","the file name to use (defaults to the common one for the bundler)","").option("-o, --overwrite","whether to overwrite the config file if it already exists (defaults to false)",!1).action((e,t)=>j(e,t));p.parseAsync(process.argv);async function T(e,t){return new Promise((r,i)=>{try{console.log(d,`running ${s.magenta(e)}...`),setTimeout(()=>{let o=x(`${k[e]}`,t,{stdio:"inherit",shell:!0,cwd:process.cwd(),env:process.env});o.on("exit",c=>{process.exit(c??1)}),process.on("SIGINT",()=>{i(),o.kill("SIGINT")}),process.on("SIGTERM",()=>{i(),o.kill("SIGTERM")}),r()},3e3)}catch(o){i(o)}})}function j(e,t){switch(v[e]){case"tsup-node":C(t);break}}function C(e){let t=process.cwd(),r=e.ext||".ts",i=e.file||"tsup.config",o=y.join(t,`${i}${r}`),c=f.existsSync(o);!e?.overwrite&&c&&(console.warn(d,s.yellow("the tsup config file already exists for this project.")),process.exit(1));let l=" ",n="";n+=`import build from '@tochii/build';
|
3
3
|
|
4
|
-
`,
|
5
|
-
`,
|
6
|
-
`,
|
7
|
-
`,
|
8
|
-
`,
|
9
|
-
`,
|
4
|
+
`,n+=`export default build.node.defineConfig({
|
5
|
+
`,n+=`${l}entry: ['index.ts'],
|
6
|
+
`,n+=`${l}clean: false,
|
7
|
+
`,n+=`${l}splitting: false,
|
8
|
+
`,n+=`});
|
9
|
+
`,f.writeFileSync(o,n),console.log(s.green(d,"the tsup config file has been created at:"),s.gray(o))}
|
package/dist/index.mjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import{b as o}from"./chunk-
|
1
|
+
import{b as o}from"./chunk-VMOULNHQ.mjs";import"./chunk-SOF474NV.mjs";var r={node:o};export{r as default,o as node};
|
package/dist/node/index.mjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import{a as b,b as c,c as d,d as e,e as f}from"../chunk-
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f}from"../chunk-VMOULNHQ.mjs";import{b as a}from"../chunk-SOF474NV.mjs";export{a as Utils,c as default,d as defineConfig,f as defineConfigCommonEntrie,e as defineConfigIndexEntries,b as defineConfigTsup};
|
package/dist/node/utils.mjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import{a,b}from"../chunk-
|
1
|
+
import{a,b}from"../chunk-SOF474NV.mjs";export{a as NodeBundlerUtils,b as default};
|
package/package.json
CHANGED
package/dist/chunk-QFYOHOZF.mjs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
var t=class t{};t.ignoredEntries=["!node_modules","!**/*/node_modules","!*.d.ts","!**/*/*.d.ts","!tsup.config*","!**/*/tsup.config*"],t.entriesCommon=["*.js","*.ts","**/*/*.js","**/*/*.ts"],t.entriesIndex=["index.js","index.ts","**/*/index.js","**/*/index.ts"],t.defaultEntriesIndex=[...t.entriesIndex,...t.ignoredEntries],t.defaultEntriesCommon=[...t.entriesCommon,...t.ignoredEntries],t.defaultOptions=n=>({tsconfig:"tsconfig.json",dts:!0,format:["esm"],minify:!0,...n,entry:r(n.entry,"ignoredEntries")}),t.defaultOptionsIndexEntries=n=>({entry:r(n.entry,"defaultEntriesIndex"),tsconfig:"tsconfig.json",dts:!0,format:["esm"],minify:!0,...n}),t.defaultOptionsCommonEntries=n=>({entry:r(n.entry,"defaultEntriesCommon"),tsconfig:"tsconfig.json",dts:!0,format:["esm"],minify:!0,...n});var e=t,a=e;function r(i,n){if(Array.isArray(i))return[...i,...e[n]];let o={};return e[n].forEach(s=>o[s]=s),{...i,...o}}export{e as a,a as b};
|