@tochii/build 1.0.0 → 1.0.1
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/chunk-3XJZVPOC.mjs +1 -0
- package/dist/chunk-OBDH5LJC.mjs +1 -0
- package/dist/cli.mjs +2 -2
- package/dist/index.d.mts +16 -0
- package/dist/index.mjs +1 -0
- package/dist/node/index.d.mts +38 -0
- package/dist/node/index.mjs +1 -0
- package/dist/node/utils.mjs +1 -1
- package/package.json +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
var t=class t{};t.ignoredEntries=["!node_modules","!**/*/node_modules","!*.d.ts","!**/*/*.d.ts","!tsup.config*","!**/*/tsup.config*"],t.entriesCommon=["*.ts","**/*/*.ts"],t.entriesIndex=["index.ts","**/*/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 i=t,a=i;function r(s,n){if(Array.isArray(s)){let e=[...s,...i[n]];return console.log("entries:",e),e}let o={};return i[n].forEach(e=>o[e]=e),{...s,...o}}export{i as a,a as b};
|
@@ -0,0 +1 @@
|
|
1
|
+
import{b as t}from"./chunk-3XJZVPOC.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,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
-
import s from"chalk";import f from"fs";import m from"path";import{Command as h}from"commander";import{spawn as b}from"child_process";var a={name:"@tochii/build",version:"1.0.0",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"},devDependencies:{"@types/node":"^22.15.17",tsup:"^8.4.0",tsx:"^4.19.4",typescript:"^5.8.3"},engines:{node:">=18.17.0"},files:["dist"]};var u={node:"tsup-node"},d=s.cyan("tochibuild"),p=new h("tochibuild").name("tochibuild <command>").description("Tools for bundling your projects in Node.js").allowUnknownOption(!0).version(a.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").action(async e=>y("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 (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,n)=>w(e,n));p.parseAsync(process.argv);async function y(e,n){return new Promise((r,i)=>{try{console.log(d,`running ${s.magenta(e)}...`),setTimeout(()=>{let o=b(u[e],n,{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 w(e,n){switch(u[e]){case"tsup-node":x(n);break}}function x(e){let n=process.cwd(),r=e.ext||".ts",i=e.file||"tsup.config",o=m.join(n,`${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=" ",t="";t+=`import build from '@tochii/build
|
2
|
+
import s from"chalk";import f from"fs";import m from"path";import{Command as h}from"commander";import{spawn as b}from"child_process";var a={name:"@tochii/build",version:"1.0.0",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"},devDependencies:{"@types/node":"^22.15.17",tsup:"^8.4.0",tsx:"^4.19.4",typescript:"^5.8.3"},engines:{node:">=18.17.0"},files:["dist"]};var u={node:"tsup-node"},d=s.cyan("tochibuild"),p=new h("tochibuild").name("tochibuild <command>").description("Tools for bundling your projects in Node.js").allowUnknownOption(!0).version(a.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").action(async e=>y("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 (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,n)=>w(e,n));p.parseAsync(process.argv);async function y(e,n){return new Promise((r,i)=>{try{console.log(d,`running ${s.magenta(e)}...`),setTimeout(()=>{let o=b(u[e],n,{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 w(e,n){switch(u[e]){case"tsup-node":x(n);break}}function x(e){let n=process.cwd(),r=e.ext||".ts",i=e.file||"tsup.config",o=m.join(n,`${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=" ",t="";t+=`import build from '@tochii/build';
|
3
3
|
|
4
|
-
`,t+=`export default build.defineConfig({
|
4
|
+
`,t+=`export default build.node.defineConfig({
|
5
5
|
`,t+=`${l}entry: ['index.ts'],
|
6
6
|
`,t+=`${l}clean: false,
|
7
7
|
`,t+=`${l}splitting: false,
|
package/dist/index.d.mts
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
import * as tsup from 'tsup';
|
2
|
+
import { defineConfig, defineConfigIndexEntries, defineConfigCommonEntrie } from './node/index.mjs';
|
3
|
+
export { default as node } from './node/index.mjs';
|
4
|
+
import NodeBundlerUtils from './node/utils.mjs';
|
5
|
+
|
6
|
+
declare const _default: {
|
7
|
+
node: {
|
8
|
+
Utils: typeof NodeBundlerUtils;
|
9
|
+
defineConfigTsup: (options: tsup.Options | tsup.Options[] | ((overrideOptions: tsup.Options) => tsup.Options | tsup.Options[] | Promise<tsup.Options | tsup.Options[]>)) => tsup.Options | tsup.Options[] | ((overrideOptions: tsup.Options) => tsup.Options | tsup.Options[] | Promise<tsup.Options | tsup.Options[]>);
|
10
|
+
defineConfig: typeof defineConfig;
|
11
|
+
defineConfigIndexEntries: typeof defineConfigIndexEntries;
|
12
|
+
defineConfigCommonEntrie: typeof defineConfigCommonEntrie;
|
13
|
+
};
|
14
|
+
};
|
15
|
+
|
16
|
+
export { _default as default };
|
package/dist/index.mjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
import{b as o}from"./chunk-OBDH5LJC.mjs";import"./chunk-3XJZVPOC.mjs";var r={node:o};export{r as default,o as node};
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import * as tsup from 'tsup';
|
2
|
+
export { defineConfig as defineConfigTsup } from 'tsup';
|
3
|
+
import NodeBundlerUtils from './utils.mjs';
|
4
|
+
|
5
|
+
declare const _default: {
|
6
|
+
Utils: typeof NodeBundlerUtils;
|
7
|
+
defineConfigTsup: (options: tsup.Options | tsup.Options[] | ((overrideOptions: tsup.Options) => tsup.Options | tsup.Options[] | Promise<tsup.Options | tsup.Options[]>)) => tsup.Options | tsup.Options[] | ((overrideOptions: tsup.Options) => tsup.Options | tsup.Options[] | Promise<tsup.Options | tsup.Options[]>);
|
8
|
+
defineConfig: typeof defineConfig;
|
9
|
+
defineConfigIndexEntries: typeof defineConfigIndexEntries;
|
10
|
+
defineConfigCommonEntrie: typeof defineConfigCommonEntrie;
|
11
|
+
};
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Define tsup configuration
|
15
|
+
*
|
16
|
+
* @default '{ tsconfig: "tsconfig.json", dts: true, format: ["esm"], minify: true, ...options }'
|
17
|
+
* @param options configuration for tsup with clean and splitting as required to avoid unintended behaviour
|
18
|
+
* @returns tsup configuration
|
19
|
+
*/
|
20
|
+
declare function defineConfig(...options: Parameters<(typeof NodeBundlerUtils)['defaultOptions']>): tsup.Options | tsup.Options[] | ((overrideOptions: tsup.Options) => tsup.Options | tsup.Options[] | Promise<tsup.Options | tsup.Options[]>);
|
21
|
+
/**
|
22
|
+
* Define tsup configuration with index files as entry
|
23
|
+
*
|
24
|
+
* @default '{ entry: Utils.defaultEntriesCommon, tsconfig: "tsconfig.json", dts: true, format: ["esm"], minify: true, ...options }'
|
25
|
+
* @param options configuration for tsup with clean and splitting as required to avoid unintended behaviour
|
26
|
+
* @returns tsup configuration
|
27
|
+
*/
|
28
|
+
declare function defineConfigIndexEntries(...options: Parameters<(typeof NodeBundlerUtils)['defaultOptionsIndexEntries']>): tsup.Options | tsup.Options[] | ((overrideOptions: tsup.Options) => tsup.Options | tsup.Options[] | Promise<tsup.Options | tsup.Options[]>);
|
29
|
+
/**
|
30
|
+
* Define tsup configuration with common files as entry
|
31
|
+
*
|
32
|
+
* @default '{ entry: Utils.defaultEntriesCommon, tsconfig: "tsconfig.json", dts: true, format: ["esm"], minify: true, ...options }'
|
33
|
+
* @param options configuration for tsup with clean and splitting as required to avoid unintended behaviour
|
34
|
+
* @returns tsup `Options`
|
35
|
+
*/
|
36
|
+
declare function defineConfigCommonEntrie(...options: Parameters<(typeof NodeBundlerUtils)['defaultOptionsCommonEntries']>): tsup.Options | tsup.Options[] | ((overrideOptions: tsup.Options) => tsup.Options | tsup.Options[] | Promise<tsup.Options | tsup.Options[]>);
|
37
|
+
|
38
|
+
export { NodeBundlerUtils as Utils, _default as default, defineConfig, defineConfigCommonEntrie, defineConfigIndexEntries };
|
@@ -0,0 +1 @@
|
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f}from"../chunk-OBDH5LJC.mjs";import{b as a}from"../chunk-3XJZVPOC.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
|
-
|
1
|
+
import{a,b}from"../chunk-3XJZVPOC.mjs";export{a as NodeBundlerUtils,b as default};
|