@tochii/build 2.1.0 → 2.2.0

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/utils.mjs CHANGED
@@ -1 +1 @@
1
- import{b as r,c as o}from"./chunk-U7SHXASE.mjs";var e=o;export{r as BuildUtils,e as default};
1
+ import{b as r,c as o}from"./chunk-EOPXFG45.mjs";var e=o;export{r as BuildUtils,e as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tochii/build",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
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",
@@ -21,7 +21,8 @@
21
21
  "scripts": {
22
22
  "dev": "tsx cli.ts",
23
23
  "build": "bun run build:root && bun run build:tochibuild",
24
- "build:root": "tsx cli.ts --config ./tochibuild/tochibuild.config.ts --entry index.ts --entry cli.ts --entry utils.ts",
24
+ "copybundler": "copyfiles -u 1 ./tochibuild/tsup@8.4.0/* ./dist",
25
+ "build:root": "tsx cli.ts && bun run copybundler",
25
26
  "build:tochibuild": "cd ./tochibuild && bun run build",
26
27
  "build:release": "bun run build:release:root && bun run build:release:tochibuild",
27
28
  "build:release:root": "bun run build:root && bun run release:root",
@@ -38,7 +39,9 @@
38
39
  "tsup": "8.4.0"
39
40
  },
40
41
  "devDependencies": {
42
+ "@types/copyfiles": "^2",
41
43
  "@types/node": "^22.15.17",
44
+ "copyfiles": "^2.4.1",
42
45
  "tsx": "^4.19.4",
43
46
  "typescript": "^5.8.3"
44
47
  },
@@ -1,11 +0,0 @@
1
- import B from"chalk";import y from"node:fs";import E from"node:path";import K from"deepmerge";import d from"chalk";var g="tochibuild",l=d.cyan(g),a=class{};a.custom=(e,...t)=>{console[e](l,...t)},a.log=(...e)=>{console.log(l,...e)},a.debug=(...e)=>{console.debug(l,...e)},a.info=(...e)=>{console.info(l,...e)},a.warn=(...e)=>{console.warn(l,...[...e].map(t=>d.yellow(t)))},a.error=(e,...t)=>{console.error(d.red(g),d.bgRed(...t),e?.stack?`
2
- ${d.gray(e.stack)}`:"")},a.success=(...e)=>{console.log(d.green(g),...e)};var f=a;var n=class n{};n.defaultConfigOptions={tsconfig:"tsconfig.json",dts:!0,format:["esm"],minify:!0},n.ignoredEntries=["!build/**","!dist/**","!node_modules/**","!**/build/**","!**/dist/**","!**/node_modules/**","!**/*.d.ts","!**/{tochibuild,tsup}.*"],n.entriesCommon=["**/*.{js,ts}"],n.entriesIndex=["**/index.{js,ts}"],n.defaultEntriesIndex=[...n.ignoredEntries,...n.entriesIndex],n.defaultEntriesCommon=[...n.ignoredEntries,...n.entriesCommon],n.defaultOptions=e=>x(e,t=>{let r=h(t.entry,"ignoredEntries");return{...n.defaultConfigOptions,...t,entry:r}}),n.defaultOptionsWithIndexEntries=e=>x(e,t=>{let r=h(t.entry,"defaultEntriesIndex");return{...n.defaultConfigOptions,...t,entry:r}}),n.defaultOptionsWithCommonEntries=e=>x(e,t=>{let r=h(t.entry,"defaultEntriesCommon");return{...n.defaultConfigOptions,...t,entry:r}}),n.generateConfig=I;var u=n,G=u;function x(i,e){let t=s=>Array.isArray(s)?s.map(o=>K(e(o),s)):K(e(s),s);if(typeof i=="function"){let s=i;async function o(b){let p=await s(b);return t(p)}return o}return t(i)}function h(i,e){if(Array.isArray(i))return[...u[e],...i];let t={};return u[e].forEach(r=>t[r]=r),{...i,...t}}function w(i){return E.isAbsolute(i||".")?i:E.resolve(process.cwd(),i)}function I(i,e,t,r){let s="";try{let o=e?.ext||".ts",p=`${e?.filename||"tochibuild.config"}${o}`;(e?.outDir?.length?e.outDir:["."]).forEach(m=>{s=w(m),y.existsSync(m)||y.mkdirSync(m,{recursive:!0});let O=E.join(s,p),k=y.existsSync(O);!e?.overwrite&&k&&(f.warn(`the config '${p}' file already exists for this project.`),r&&process.exit(1));let q=" ",c="",C={clean:!1,splitting:!0},P=R=>{c+=R==="esm"?`import build from '${i}';
3
-
4
- `:`const build = require('${i}');
5
-
6
- `,c+=R==="esm"?`export default build.defineConfigWithIndexEntries({
7
- `:`module.exports = build.defineConfigWithIndexEntries({
8
- `,Object.entries(C).forEach(([$,j])=>{c+=`${q}${$}: ${JSON.stringify(j)},
9
- `}),c+=`});
10
- `};switch(o){case".ts":case".js":P("esm");break;case".cjs":P("cjs");break;case".json":c+=`${JSON.stringify({...C,entry:u.defaultEntriesIndex},null,2)}
11
- `;break;default:f.error(void 0,`unsupported extension: ${o}`),process.exit(1)}y.writeFileSync(O,c),f.success(B.cyan("the config file has been created at:"),B.gray(O))})}catch(o){if(t)throw o;f.error(o,o.message?`failed to generate config file in ${s}: ${o.message}`:`failed to generate config file in ${s}`),r&&process.exit(1)}}export{f as a,u as b,G as c};