@buntui/cli 0.1.0-alpha.3 → 0.1.0-alpha.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/dist/buntui.js +12 -5
- package/dist/config.d.ts +1 -0
- package/dist/config.js +2 -0
- package/dist/lib/config.d.ts +14 -0
- package/dist/package.json +47 -0
- package/package.json +46 -30
- package/dist/buntui-backend.log +0 -8
- package/dist/buntui-frontend.log +0 -7
- package/dist/buntui.dll +0 -0
package/dist/buntui.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
var _=import.meta.require;import yt from"process";import K from"path";import bt from"fs";import{Command as wt}from"commander";import"@buntui/compiler/vue-plugin";import R from"path";import Z from"fs";import{createDevServer as tt}from"@buntui/compiler";import{createApp as nt}from"@buntui/core";import{mountHmrErrorOverlay as ot}from"@buntui/extensions/hmr-error-overlay";import b from"path";import x from"fs";import P from"process";import{CORE_REGISTRY as H}from"@buntui/compiler";var k="src/apps",I={logLevel:"debug",clearLog:!0,debugMode:!0,tickRate:60,renderRate:48},S={registry:H,codegen:{coreModuleId:"@buntui/core",reactivityModuleId:"@vue/reactivity"}};function f(){return P.cwd()}function Q(t){return b.join(t??f(),k)}function h(t){let n=Q(t);if(!x.existsSync(n))return[];let o=[];for(let c of x.readdirSync(n)){let r=b.join(n,c);if(!x.statSync(r).isDirectory())continue;let e=b.join(r,"main.ts"),s=b.join(r,"App.vue");if(!x.existsSync(e)&&!x.existsSync(s))continue;o.push({name:c,dir:r,mainPath:e,entryVue:s,hasCustomMain:x.existsSync(e)})}return o}function j(t,n){let o=h(n);if(o.length===0)console.error("No apps found in src/apps/"),console.error("Create an app at src/apps/<name>/App.vue"),P.exit(1);if(t){let r=o.find((e)=>e.name===t);if(!r){console.error(`App not found: ${t}`),console.error("Available apps:");for(let e of o)console.error(` - ${e.name}`);P.exit(1)}return r}if(o.length===1)return o[0];let c=o.find((r)=>r.name==="main");if(c)return c;console.error('Default app "main" not found. Specify an app name:');for(let r of o)console.error(` - ${r.name}`);P.exit(1)}function L(t){return b.join(t??f(),"public")}function $(t){return b.join(t??f(),"dist")}function F(t){return b.join(t??f(),"src",".dev")}import Y from"path";import X from"fs";async function N(t){let n=Y.join(t,"buntui.config.ts");if(!X.existsSync(n))return{};try{return(await import(n)).default??{}}catch{return console.warn("Failed to load buntui.config.ts"),{}}}async function E(t){let n=f(),o=j(t),c=F(),r=R.join(c,o.name);Z.mkdirSync(r,{recursive:!0});let e,s;if(o.hasCustomMain){let a=await import(o.mainPath),g=a.ENTRY??"App.vue";e=R.join(o.dir,g),s=a.run({logFilePath:r}).scene}else{e=o.entryVue;let a=await N(n),g=nt({...I,...a.app,logFilePath:r}),u=await import(o.entryVue);s=g.createScene(u,{visible:!0}),g.start()}let i;tt({file:e,tempDir:r,compileOptions:S,onClear(){i?.dismiss(),i=void 0,s.clearWidgets()},onReload(a){i?.dismiss(),i=void 0,a(s)},onError(a){i?.dismiss(),i=ot(s,a)}}),console.log(` Dev server started for "${o.name}"`),console.log(` Watching: ${e}`)}import W from"process";import m from"path";import p from"fs";import{compile as it}from"@buntui/compiler";function C(){return{name:"buntui-vue",setup(t){t.onLoad({filter:/\.vue$/v},async(n)=>{let o=await Bun.file(n.path).text();return{contents:it(o,{filename:n.path,...S}).code,loader:"ts"}})}}}import B from"process";import A from"path";import T from"fs";import{getBinaryPath as et}from"@buntui/native";function rt(){if(B.platform==="win32")return"dll";if(B.platform==="darwin")return"dylib";return"so"}function st(){return B.platform==="win32"?"":"lib"}function V(t,n){let o=rt(),c=`${st()}buntui.${o}`,r=et(),e=[...r?[r]:[],A.join(n,"node_modules","@buntui","core",c),A.join(n,"node_modules","@buntui","core","src","utils",`buntui.${o}`),A.join(n,c)];for(let s of e)if(T.existsSync(s)){let i=A.join(t,`buntui.${o}`);T.copyFileSync(s,i),console.log(` ${`buntui.${o}`} (copied)`);return}console.warn(" Warning: native binary not found")}function ct(t,n,o){let c=m.dirname(n);for(let[r,e]of o){if(r===n)continue;let i=m.relative(c,r).replaceAll("\\","/").replaceAll(/[.*+?^${}()|[\]\\]/gu,String.raw`\$&`);t=t.replaceAll(new RegExp(String.raw`from\s*(["'])${i}\1`,"gu"),`from $1./${e}$1`),t=t.replaceAll(new RegExp(String.raw`import\s*\(\s*(["'])${i}\1\s*\)`,"gu"),`import("./${e}")`)}return t}function at(t,n){let o=L(n);if(!p.existsSync(o))return;let c=m.join(t,"public");p.mkdirSync(c,{recursive:!0});for(let r of p.readdirSync(o)){let e=m.join(o,r);if(p.statSync(e).isFile())p.copyFileSync(e,m.join(c,r)),console.log(` public/${r}`)}}async function O(){let t=f(),n=$(t),o=h(t);if(o.length===0)console.error("No apps found in src/apps/"),W.exit(1);console.log(`Building ${o.length} app(s): ${o.map((i)=>i.name).join(", ")}
|
|
4
|
+
`),p.mkdirSync(n,{recursive:!0});let c=o.map((i)=>i.hasCustomMain?i.mainPath:i.entryVue),r=C(),e=await Bun.build({entrypoints:c,outdir:n,target:"bun",minify:!0,splitting:o.length>1,naming:"[dir]/[name].[ext]",plugins:[r]});if(!e.success){for(let i of e.logs)console.error(i);W.exit(1)}let s=new Set;if(o.length>1){let i=new Map,a=0;for(let u of e.outputs){let l=m.relative(n,u.path).replaceAll("\\","/"),w=/^(.+?)[\\/][^.]+\.js$/u.exec(l);if(w)i.set(u.path,`${w[1]}.js`);else if(l.endsWith(".js"))i.set(u.path,a===0?"__common.js":`__common-${a}.js`),a++}for(let[u,l]of i){let w=ct(p.readFileSync(u,"utf-8"),u,i);p.writeFileSync(m.join(n,l),w),s.add(l)}for(let u of p.readdirSync(n)){let l=m.join(n,u);if(p.statSync(l).isDirectory())p.rmSync(l,{recursive:!0,force:!0})}let g=[...i.keys()].filter((u)=>!m.relative(n,u).replaceAll("\\","/").includes("/"));for(let u of g){let l=i.get(u);if(m.basename(u)!==l&&p.existsSync(u))p.unlinkSync(u)}for(let[,u]of i)console.log(` ${u} (${(p.statSync(m.join(n,u)).size/1024).toFixed(1)} KB)`)}else for(let i of e.outputs){let a=m.relative(n,i.path).replaceAll("\\","/");s.add(a.split("/")[0]),console.log(` ${a} (${(i.size/1024).toFixed(1)} KB)`)}s.add("public"),at(n,t),V(n,t);for(let i of p.readdirSync(n)){if(s.has(i))continue;let a=m.join(n,i);if(p.statSync(a).isDirectory())p.rmSync(a,{recursive:!0,force:!0});else p.unlinkSync(a)}console.log(`
|
|
5
|
+
Build complete!`)}import pt from"process";import M from"path";import D from"fs";import{binaryPath as lt}from"@buntui/native-wasm32-wasi";import{compile as ut}from"@buntui/compiler";async function U(){return await import("vite"),{name:"buntui-sfc",enforce:"pre",async load(t){if(!t.endsWith(".vue"))return;let n=await Bun.file(t).text(),o=ut(n,{filename:t,...S,sourceMap:!0});return{code:o.code,map:o.sourceMap??null}}}}async function z(t){let n=f(),o=j(t,n),c=M.join(n,"public"),r=M.join(c,"buntui.wasm");D.mkdirSync(c,{recursive:!0}),D.copyFileSync(lt,r),console.log(" Copied buntui.wasm to public/");let e=M.join(n,"index.html");if(!D.existsSync(e))console.error("index.html not found in project root."),pt.exit(1);let s=await import("vite"),i=await U();console.log(`
|
|
6
|
+
Starting WASM dev server for "${o.name}"...
|
|
7
|
+
`);let a=await s.createServer({configFile:!1,root:n,plugins:[i],define:{BUNTUI_APP_NAME:JSON.stringify(o.name)},server:{fs:{allow:[".."]},open:!0},optimizeDeps:{exclude:["@buntui/core"]}});await a.listen(),a.printUrls()}import mt from"process";import y from"path";import d from"fs";import{binaryPath as ft}from"@buntui/native-wasm32-wasi";async function dt(t,n,o){let c=y.join(o,"src","apps"),r=y.join(c,t,"App.vue"),e=y.join(n,`_entry_${t}.ts`),s=`export {default as App} from ${JSON.stringify(r)};
|
|
8
|
+
`;d.writeFileSync(e,s);let i=await Bun.build({entrypoints:[e],outdir:n,naming:"[name].js",target:"browser",minify:!0,plugins:[C()],external:["@buntui/core","@vue/reactivity"]});if(d.unlinkSync(e),!i.success){for(let G of i.logs)console.error(G);throw Error(`Build failed for app "${t}"`)}let a=`_entry_${t}.js`,g=`${t}.js`,u=y.join(n,a),l=y.join(n,g);if(d.existsSync(u))d.renameSync(u,l);let w=(d.statSync(l).size/1024).toFixed(1);console.log(` ${g} (${w} KB)`)}function gt(t,n){d.writeFileSync(y.join(n,`${t}.d.ts`),`import type {TuiSFCModule} from '@buntui/core';
|
|
9
|
+
|
|
10
|
+
declare const App: TuiSFCModule;
|
|
11
|
+
export {App};
|
|
12
|
+
`)}async function J(){let t=f(),n=$(t),o=h(t);if(o.length===0)console.error("No apps found in src/apps/"),console.error("Create an app at src/apps/<name>/App.vue"),mt.exit(1);d.mkdirSync(n,{recursive:!0});for(let s of d.readdirSync(n))if(s.endsWith(".js")||s.endsWith(".d.ts"))d.unlinkSync(y.join(n,s));console.log(`Building ${o.length} app(s): ${o.map((s)=>s.name).join(", ")}
|
|
13
|
+
`);let c=y.join(t,"public"),r=y.join(c,"buntui.wasm");d.mkdirSync(c,{recursive:!0}),d.copyFileSync(ft,r),console.log(" Copied buntui.wasm to public/");let e=Promise.resolve();for(let s of o)e=e.then(async()=>{await dt(s.name,n,t),gt(s.name,n)});await e,console.log(`
|
|
14
|
+
Build complete!`)}var{version:St}=JSON.parse(bt.readFileSync(K.join(import.meta.dir,"..","package.json"),"utf-8")),v=new wt;v.name("buntui").description("BunTUI framework CLI").version(St).option("--cwd <dir>","set working directory",(t)=>{yt.chdir(K.resolve(t))});v.command("dev").description("start dev server with HMR").argument("[app]","app name (auto-detected if only one exists)").action(async(t)=>{await E(t)});v.command("build").description("production build").action(async()=>{await O()});var q=v.command("wasm").description("WASM/browser target commands");q.command("dev").description("start WASM dev server (requires vite)").argument("[app]","app name (auto-detected if only one exists)").action(async(t)=>{await z(t)});q.command("build").description("production build for browser target").action(async()=>{await J()});v.parse();
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineConfig, type BuntuiConfig } from './lib/config.ts';
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LogLevel } from '@buntui/core';
|
|
2
|
+
export type { LogLevel } from '@buntui/core';
|
|
3
|
+
export type BuntuiConfig = {
|
|
4
|
+
app?: {
|
|
5
|
+
logLevel?: LogLevel;
|
|
6
|
+
clearLog?: boolean;
|
|
7
|
+
debugMode?: boolean;
|
|
8
|
+
quitOnQ?: boolean;
|
|
9
|
+
tickRate?: number;
|
|
10
|
+
renderRate?: number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare function defineConfig(config: BuntuiConfig): BuntuiConfig;
|
|
14
|
+
export declare function loadConfig(cwd: string): Promise<BuntuiConfig>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@buntui/cli",
|
|
3
|
+
"version": "0.1.0-alpha.5",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/AlphaFoxz/buntui.git",
|
|
7
|
+
"directory": "packages/cli"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"buntui": "./dist/buntui.js"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/config.d.ts",
|
|
15
|
+
"default": "./dist/config.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "bun run ./scripts/build.ts"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@buntui/compiler": "workspace:*",
|
|
26
|
+
"@buntui/core": "workspace:*",
|
|
27
|
+
"@buntui/extensions": "workspace:*",
|
|
28
|
+
"@vue/reactivity": "^3.5.35",
|
|
29
|
+
"commander": "^15.0.0"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"vite": ">=5"
|
|
33
|
+
},
|
|
34
|
+
"peerDependenciesMeta": {
|
|
35
|
+
"vite": {
|
|
36
|
+
"optional": true
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@buntui/native": "workspace:*",
|
|
41
|
+
"@buntui/native-wasm32-wasi": "workspace:*",
|
|
42
|
+
"@types/bun": "1.3.14",
|
|
43
|
+
"vite": "^8.0.16",
|
|
44
|
+
"vue": "^3.5.35",
|
|
45
|
+
"vue-tsc": "^3.3.3"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,31 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
"name": "@buntui/cli",
|
|
3
|
+
"version": "0.1.0-alpha.5",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/AlphaFoxz/buntui.git",
|
|
7
|
+
"directory": "packages/cli"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"buntui": "./dist/buntui.js"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/config.d.ts",
|
|
15
|
+
"default": "./dist/config.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "bun run ./scripts/build.ts"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@buntui/compiler": "^0.1.0-alpha.5",
|
|
26
|
+
"@buntui/core": "^0.1.0-alpha.5",
|
|
27
|
+
"@buntui/extensions": "^0.1.0-alpha.5",
|
|
28
|
+
"@vue/reactivity": "^3.5.35",
|
|
29
|
+
"commander": "^15.0.0"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"vite": ">=5"
|
|
33
|
+
},
|
|
34
|
+
"peerDependenciesMeta": {
|
|
35
|
+
"vite": {
|
|
36
|
+
"optional": true
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@buntui/native": "^0.1.0-alpha.5",
|
|
41
|
+
"@buntui/native-wasm32-wasi": "^0.1.0-alpha.5",
|
|
42
|
+
"@types/bun": "1.3.14",
|
|
43
|
+
"vite": "^8.0.16",
|
|
44
|
+
"vue": "^3.5.35",
|
|
45
|
+
"vue-tsc": "^3.3.3"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/dist/buntui-backend.log
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
[2026-06-03 10:37:39] info: Console switched to mouse mode
|
|
2
|
-
[2026-06-03 10:37:39] info: TuiApp created
|
|
3
|
-
[2026-06-03 10:37:39] info: input listener starting...
|
|
4
|
-
[2026-06-03 10:37:39] info: Console switched to mouse mode
|
|
5
|
-
[2026-06-03 10:37:39] info: detected console dwSize info [X: 104 Y: 46]
|
|
6
|
-
[2026-06-03 10:37:39] info: detected console srWindow info [Top: 0 Right: 103 Bottom: 45 Left: 0]
|
|
7
|
-
[2026-06-03 10:37:39] info: detected console dwSize info [X: 104 Y: 46]
|
|
8
|
-
[2026-06-03 10:37:40] warning: TuiApp destroyed
|
package/dist/buntui-frontend.log
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
[2026-06-03 18:37:39] info: TUI_CONTEXT_INSTANCE.scale: 46 104
|
|
2
|
-
[2026-06-03 18:37:39] info: Watching: F:\vscode_projects\buntui\packages\create-buntui\src\apps\main\App.vue
|
|
3
|
-
|
|
4
|
-
[2026-06-03 18:37:39] info:
|
|
5
|
-
Dev server started for "main"
|
|
6
|
-
[2026-06-03 18:37:39] info: Terminal resized: 46x104
|
|
7
|
-
[2026-06-03 18:37:40] info: TUI application stopped
|
package/dist/buntui.dll
DELETED
|
Binary file
|