@coreframe/dashboard 0.1.1 → 0.1.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/README.md CHANGED
@@ -2,22 +2,19 @@
2
2
 
3
3
  Local and deployed dashboard runtime for Coreframe projects.
4
4
 
5
- The package starts a local Node.js backend through Portless at
6
- `https://coreframe.localhost/__dashboard`. The backend serves the compiled React client,
7
- production-readiness diagnostics, and controls for one dashboard-owned development process.
5
+ The shared Vite preset serves the local dashboard at `/__dashboard`. The Node.js request handler
6
+ serves the compiled React client, production-readiness diagnostics, and controls for one
7
+ dashboard-owned development process.
8
8
 
9
9
  ```bash
10
- coreframe-dashboard
10
+ pnpm dev
11
11
  ```
12
12
 
13
- The command fails before launch when `https://coreframe.localhost` already
14
- responds.
15
-
16
13
  ## Architecture
17
14
 
18
- `coreframe-dashboard` is the only launch command. It checks that the Portless
19
- URL is free, starts Portless, and passes the assigned `PORT` to the Node.js
20
- backend.
15
+ The `@coreframe/vite/dashboard` plugin mounts the Node.js request handler in the application Vite
16
+ server. This keeps the dashboard on the same local origin as the application and avoids a separate
17
+ dashboard process.
21
18
 
22
19
  The browser setup intentionally mirrors the generated Coreframe web app where that contract is
23
20
  useful: React Router owns the client-only route tree and hydration, TanStack Query owns server
@@ -27,8 +24,8 @@ does not import files from `template/`.
27
24
 
28
25
  The runtime boundary remains dashboard-specific. A small Node adapter converts
29
26
  `IncomingMessage`/`ServerResponse` to the Fetch API so Rouzer remains the single typed API
30
- contract. Node still owns Portless startup, static files, process signals, and development-process
31
- cleanup. A separate Worker-safe entry point owns the reduced deployed runtime.
27
+ contract. Node owns local static files and development-process cleanup. A separate Worker-safe
28
+ entry point owns the reduced deployed runtime.
32
29
 
33
30
  The backend exposes these routes:
34
31
 
@@ -70,10 +67,10 @@ Regenerate the committed Panda runtime after changing `panda.config.ts` or style
70
67
  pnpm --dir dashboard codegen
71
68
  ```
72
69
 
73
- Run the full local flow through Portless:
70
+ Run the application development server, then open `/__dashboard`:
74
71
 
75
72
  ```bash
76
- pnpm --dir dashboard dev
73
+ pnpm --dir template dev
77
74
  ```
78
75
 
79
76
  Useful package checks:
@@ -1 +1 @@
1
- import{spawn as e}from"node:child_process";import{access as t}from"node:fs/promises";import{join as n}from"node:path";import{createServer as r}from"node:net";import{readProjectConfig as i}from"@coreframe/scripts/config";import{resolveDevPlatforms as a}from"@coreframe/scripts/dev";var o=class extends Error{status;constructor(e,t){super(e),this.status=t}};const s={web:`Web`,desktop:`Desktop`,ios:`iOS`,android:`Android`},c=process.platform===`win32`?`pnpm.cmd`:`pnpm`,l=RegExp(`\x1B\\][^\\x07]*(?:\\x07|\x1B\\\\)`,`g`),u=RegExp(`\x1B\\[[0-?]*[ -/]*[@-~]`,`g`);function d({env:e=process.env,getAvailablePort:t=_,hostPlatform:r=process.platform,killProcess:l=b,probeWebUrl:u=v,projectRoot:d,readConfig:S=i,spawnProcess:C=m}){let w,T=0,E=[],D=1,O;async function k(){let e=a(await S({cwd:d})),t=await x(n(d,`tauri/src-tauri/tauri.conf.json`));return e.map(e=>{let n=f(e,{hasTauri:t,hostPlatform:r});return{platform:e,label:s[e],available:n===void 0,...n?{unavailableReason:n}:{}}})}async function A(){let e=await k();return O&&!e.some(e=>e.platform===O?.platform)&&e.push({platform:O.platform,label:s[O.platform],available:!0}),{targets:e,logs:[...E],...O?{session:O}:{}}}async function j(n){if(p(O))throw new o(`${s[O.platform]} development is already ${O.status}. Stop it before starting another target.`,409);let r=await k(),i=r.find(e=>e.platform===n);if(!i)throw new o(`Select a configured development target.`,400);if(!i.available)throw new o(i.unavailableReason??`${i.label} development is unavailable.`,400);let a=i.platform===`web`?await t():void 0,l=a===void 0?void 0:`http://localhost:${a}`;E=[],T=0,D=1,O={platform:i.platform,status:`starting`,startedAt:new Date().toISOString(),...l?{url:l}:{}};try{let t=C({args:i.platform===`web`?[`dev`]:[`dev`,i.platform],command:c,cwd:d,env:{...e,FORCE_COLOR:`0`,...a===void 0?{}:{COREFRAME_WEB_PORT:String(a)}}});w=t,h(t,P),t.once(`spawn`,()=>{w===t&&O?.status===`starting`&&(O={...O,status:`running`},l&&F(t,l))}),t.once(`error`,()=>{w===t&&(w=void 0,O={...O,status:`failed`,message:`The development process could not be started.`})}),t.once(`exit`,e=>{if(w!==t)return;w=void 0;let n=O?.status===`stopping`;O={...O,status:n||e===0?`stopped`:`failed`,...typeof e==`number`?{exitCode:e}:{},...!n&&e!==0?{message:`The development process exited before it was stopped.`}:{}}})}catch{let e=`The development process could not be started.`;throw w=void 0,O={...O,status:`failed`,message:e},new o(e,500)}return{targets:r,logs:[...E],session:O}}async function M(){if(!w||!p(O))throw new o(`No dashboard-owned development process is running.`,409);O={...O,status:`stopping`};try{await l(w)}catch{let e=`The development process could not be stopped.`;throw O={...O,status:`failed`,message:e},new o(e,500)}return A()}async function N(){if(w&&p(O))try{O={...O,status:`stopping`},await l(w)}catch{}}function P(e,t){let n=g(String(t)).slice(-16e3);if(n)for(E.push({sequence:D++,stream:e,text:n}),T+=n.length;T>2e5&&E.length>1;)T-=E.shift()?.text.length??0}async function F(e,t){for(;w===e&&p(O)&&!O.readyAt;){if(await u(t)){w===e&&p(O)&&(O={...O,readyAt:new Date().toISOString()});return}await y(250)}}return{dispose:N,getState:A,start:j,stop:M}}function f(e,t){if(e!==`web`){if(!t.hasTauri)return`Tauri is not configured for this project.`;if(e===`ios`&&t.hostPlatform!==`darwin`)return`iOS development requires macOS.`}}function p(e){return[`running`,`starting`,`stopping`].includes(e?.status??``)}function m(t){return e(t.command,t.args,{cwd:t.cwd,detached:process.platform!==`win32`,env:t.env,shell:!1,stdio:[`ignore`,`pipe`,`pipe`]})}function h(e,t){e.stdout?.on(`data`,e=>t(`stdout`,e)),e.stderr?.on(`data`,e=>t(`stderr`,e))}function g(e){return e.replace(l,``).replace(u,``)}async function _(){let e=r();try{await new Promise((t,n)=>{e.once(`error`,n),e.listen(0,`127.0.0.1`,t)});let t=e.address();if(!t||typeof t==`string`)throw Error(`Could not allocate a web development port.`);return t.port}finally{e.listening&&await new Promise((t,n)=>{e.close(e=>e?n(e):t())})}}async function v(e){try{return await fetch(e,{method:`HEAD`,signal:AbortSignal.timeout(750)}),!0}catch{return!1}}function y(e){return new Promise(t=>setTimeout(t,e))}async function b(t){if(!t.pid){t.kill(`SIGTERM`);return}if(process.platform===`win32`){await new Promise((n,r)=>{let i=e(`taskkill`,[`/pid`,String(t.pid),`/t`,`/f`],{shell:!1,stdio:`ignore`});i.once(`error`,r),i.once(`exit`,e=>{e===0?n():r(Error(`taskkill exited with code ${String(e)}`))})});return}try{process.kill(-t.pid,`SIGTERM`)}catch(e){if(!S(e)||e.code!==`ESRCH`)throw e}}async function x(e){try{return await t(e),!0}catch(e){if(S(e)&&e.code===`ENOENT`)return!1;throw e}}function S(e){return e instanceof Error&&`code`in e}export{o as DevelopmentRequestError,d as createDevelopmentManager};
1
+ import{access as e}from"node:fs/promises";import{join as t}from"node:path";import{spawn as n}from"node:child_process";import{createServer as r}from"node:net";import{readProjectConfig as i}from"@coreframe/scripts/config";import{resolveDevPlatforms as a}from"@coreframe/scripts/dev";var o=class extends Error{status;constructor(e,t){super(e),this.status=t}};const s={web:`Web`,desktop:`Desktop`,ios:`iOS`,android:`Android`},c=process.platform===`win32`?`pnpm.cmd`:`pnpm`,l=RegExp(`\x1B\\][^\\x07]*(?:\\x07|\x1B\\\\)`,`g`),u=RegExp(`\x1B\\[[0-?]*[ -/]*[@-~]`,`g`);function d({env:e=process.env,getAvailablePort:n=_,hostPlatform:r=process.platform,killProcess:l=b,probeWebUrl:u=v,projectRoot:d,readConfig:S=i,spawnProcess:C=m}){let w,T=0,E=[],D=1,O;async function k(){let e=a(await S({cwd:d})),n=await x(t(d,`tauri/src-tauri/tauri.conf.json`));return e.map(e=>{let t=f(e,{hasTauri:n,hostPlatform:r});return{platform:e,label:s[e],available:t===void 0,...t?{unavailableReason:t}:{}}})}async function A(){let e=await k();return O&&!e.some(e=>e.platform===O?.platform)&&e.push({platform:O.platform,label:s[O.platform],available:!0}),{targets:e,logs:[...E],...O?{session:O}:{}}}async function j(t){if(p(O))throw new o(`${s[O.platform]} development is already ${O.status}. Stop it before starting another target.`,409);let r=await k(),i=r.find(e=>e.platform===t);if(!i)throw new o(`Select a configured development target.`,400);if(!i.available)throw new o(i.unavailableReason??`${i.label} development is unavailable.`,400);let a=i.platform===`web`?await n():void 0,l=a===void 0?void 0:`http://localhost:${a}`;E=[],T=0,D=1,O={platform:i.platform,status:`starting`,startedAt:new Date().toISOString(),...l?{url:l}:{}};try{let t=C({args:i.platform===`web`?[`dev`]:[`dev`,i.platform],command:c,cwd:d,env:{...e,FORCE_COLOR:`0`,...a===void 0?{}:{COREFRAME_WEB_PORT:String(a)}}});w=t,h(t,P),t.once(`spawn`,()=>{w===t&&O?.status===`starting`&&(O={...O,status:`running`},l&&F(t,l))}),t.once(`error`,()=>{w===t&&(w=void 0,O={...O,status:`failed`,message:`The development process could not be started.`})}),t.once(`exit`,e=>{if(w!==t)return;w=void 0;let n=O?.status===`stopping`;O={...O,status:n||e===0?`stopped`:`failed`,...typeof e==`number`?{exitCode:e}:{},...!n&&e!==0?{message:`The development process exited before it was stopped.`}:{}}})}catch{let e=`The development process could not be started.`;throw w=void 0,O={...O,status:`failed`,message:e},new o(e,500)}return{targets:r,logs:[...E],session:O}}async function M(){if(!w||!p(O))throw new o(`No dashboard-owned development process is running.`,409);O={...O,status:`stopping`};try{await l(w)}catch{let e=`The development process could not be stopped.`;throw O={...O,status:`failed`,message:e},new o(e,500)}return A()}async function N(){if(w&&p(O))try{O={...O,status:`stopping`},await l(w)}catch{}}function P(e,t){let n=g(String(t)).slice(-16e3);if(n)for(E.push({sequence:D++,stream:e,text:n}),T+=n.length;T>2e5&&E.length>1;)T-=E.shift()?.text.length??0}async function F(e,t){for(;w===e&&p(O)&&!O.readyAt;){if(await u(t)){w===e&&p(O)&&(O={...O,readyAt:new Date().toISOString()});return}await y(250)}}return{dispose:N,getState:A,start:j,stop:M}}function f(e,t){if(e!==`web`){if(!t.hasTauri)return`Tauri is not configured for this project.`;if(e===`ios`&&t.hostPlatform!==`darwin`)return`iOS development requires macOS.`}}function p(e){return[`running`,`starting`,`stopping`].includes(e?.status??``)}function m(e){return n(e.command,e.args,{cwd:e.cwd,detached:process.platform!==`win32`,env:e.env,shell:!1,stdio:[`ignore`,`pipe`,`pipe`]})}function h(e,t){e.stdout?.on(`data`,e=>t(`stdout`,e)),e.stderr?.on(`data`,e=>t(`stderr`,e))}function g(e){return e.replace(l,``).replace(u,``)}async function _(){let e=r();try{await new Promise((t,n)=>{e.once(`error`,n),e.listen(0,`127.0.0.1`,t)});let t=e.address();if(!t||typeof t==`string`)throw Error(`Could not allocate a web development port.`);return t.port}finally{e.listening&&await new Promise((t,n)=>{e.close(e=>e?n(e):t())})}}async function v(e){try{return await fetch(e,{method:`HEAD`,signal:AbortSignal.timeout(750)}),!0}catch{return!1}}function y(e){return new Promise(t=>setTimeout(t,e))}async function b(e){if(!e.pid){e.kill(`SIGTERM`);return}if(process.platform===`win32`){await new Promise((t,r)=>{let i=n(`taskkill`,[`/pid`,String(e.pid),`/t`,`/f`],{shell:!1,stdio:`ignore`});i.once(`error`,r),i.once(`exit`,e=>{e===0?t():r(Error(`taskkill exited with code ${String(e)}`))})});return}try{process.kill(-e.pid,`SIGTERM`)}catch(e){if(!S(e)||e.code!==`ESRCH`)throw e}}async function x(t){try{return await e(t),!0}catch(e){if(S(e)&&e.code===`ENOENT`)return!1;throw e}}function S(e){return e instanceof Error&&`code`in e}export{o as DevelopmentRequestError,d as createDevelopmentManager};
@@ -1,3 +1,3 @@
1
1
  import { DashboardPayload, DeployedDashboardPayload, DevelopmentSession, DevelopmentSessionStatus, DevelopmentState, DevelopmentTarget } from "./types.js";
2
- import { DashboardRequestHandler, DashboardServerOptions, StartedDashboardServer, createDashboardRequestHandler, createDashboardServer, resolveDashboardClientDist, startDashboardServer } from "./server.js";
3
- export { type DashboardPayload, type DashboardRequestHandler, type DashboardServerOptions, type DeployedDashboardPayload, type DevelopmentSession, type DevelopmentSessionStatus, type DevelopmentState, type DevelopmentTarget, type StartedDashboardServer, createDashboardRequestHandler, createDashboardServer, resolveDashboardClientDist, startDashboardServer };
2
+ import { DashboardRequestHandler, DashboardServerOptions, createDashboardRequestHandler, createDashboardServer, resolveDashboardClientDist } from "./server.js";
3
+ export { type DashboardPayload, type DashboardRequestHandler, type DashboardServerOptions, type DeployedDashboardPayload, type DevelopmentSession, type DevelopmentSessionStatus, type DevelopmentState, type DevelopmentTarget, createDashboardRequestHandler, createDashboardServer, resolveDashboardClientDist };
package/dist/src/index.js CHANGED
@@ -1 +1 @@
1
- import{createDashboardRequestHandler as e,createDashboardServer as t,resolveDashboardClientDist as n,startDashboardServer as r}from"./server.js";export{e as createDashboardRequestHandler,t as createDashboardServer,n as resolveDashboardClientDist,r as startDashboardServer};
1
+ import{createDashboardRequestHandler as e,createDashboardServer as t,resolveDashboardClientDist as n}from"./server.js";export{e as createDashboardRequestHandler,t as createDashboardServer,n as resolveDashboardClientDist};
@@ -8,17 +8,12 @@ type DashboardServerOptions = {
8
8
  mutationToken?: string;
9
9
  projectRoot: string;
10
10
  };
11
- type StartedDashboardServer = {
12
- server: Server;
13
- url: string;
14
- };
15
11
  type DashboardRequestHandler = {
16
12
  dispose(): Promise<void>;
17
13
  handle(request: IncomingMessage, response: ServerResponse): Promise<void>;
18
14
  };
19
15
  declare function createDashboardServer(options: DashboardServerOptions): Server;
20
16
  declare function createDashboardRequestHandler(options: DashboardServerOptions): DashboardRequestHandler;
21
- declare function startDashboardServer(options: DashboardServerOptions): Promise<StartedDashboardServer>;
22
17
  declare function resolveDashboardClientDist(): string;
23
18
  //#endregion
24
- export { DashboardRequestHandler, DashboardServerOptions, StartedDashboardServer, createDashboardRequestHandler, createDashboardServer, resolveDashboardClientDist, startDashboardServer };
19
+ export { DashboardRequestHandler, DashboardServerOptions, createDashboardRequestHandler, createDashboardServer, resolveDashboardClientDist };
@@ -1 +1 @@
1
- import{DevelopmentRequestError as e,createDevelopmentManager as t}from"./development.js";import{createDashboardApiRouter as n}from"./api/router.js";import{handleFetchRequest as r}from"./node-fetch-adapter.js";import{readFile as i,stat as a}from"node:fs/promises";import{dirname as o,extname as s,join as c,relative as l,resolve as u,sep as d}from"node:path";import{fileURLToPath as f,pathToFileURL as p}from"node:url";import{randomBytes as m}from"node:crypto";import{createServer as h}from"node:http";import{toFetchHandler as g}from"rouzer";function _(e){let t=v(e),n=h(async(e,n)=>{await t.handle(e,n)});return n.on(`close`,()=>{t.dispose()}),n}function v(r){let i=r.developmentManager??t({projectRoot:r.projectRoot}),a=r.mutationToken??m(32).toString(`base64url`),o=g(n({developmentManager:i,env:process.env,mutationToken:a,projectRoot:r.projectRoot}));return{dispose:()=>i.dispose(),async handle(t,n){try{await b(t,n,r,o)}catch(t){w(n,t instanceof e?t.status:500,{error:t instanceof Error?t.message:String(t)})}}}}async function y(e){let t=S(),n=_(e);return await new Promise((e,r)=>{n.once(`error`,r),n.listen(t,`127.0.0.1`,()=>{n.off(`error`,r),e()})}),{server:n,url:process.env.PORTLESS_URL??`http://127.0.0.1:${t}`}}async function b(e,t,n,i){x(e);let a=new URL(e.url??`/`,`http://127.0.0.1`);if(a.pathname===`/`){t.writeHead(302,{location:`/__dashboard`}),t.end();return}if(a.pathname.startsWith(`/__dashboard/api/`)){await r(e,t,i);return}if(a.pathname===`/__dashboard`){t.writeHead(302,{location:`/__dashboard/`}),t.end();return}if(a.pathname.startsWith(`/__dashboard/`)&&(e.method===`GET`||e.method===`HEAD`)){await C(t,a.pathname.slice(12)||`/`,n.clientDist);return}w(t,405,{error:`Method not allowed`})}function x(t){let n=t.headers.host;if(!n)throw new e(`Dashboard request host is missing.`,403);let r;try{r=new URL(`http://${n}`).hostname}catch{throw new e(`Dashboard request host was not authorized.`,403)}if(r!==`127.0.0.1`&&r!==`::1`&&r!==`localhost`&&!r.endsWith(`.localhost`))throw new e(`Dashboard request host was not authorized.`,403)}function S(){let e=Number(process.env.PORT);if(!Number.isInteger(e)||e<=0)throw Error(`PORT must be set by portless`);return e}async function C(e,t,n=D()){let r=T(n,t),i=r?await E(r):void 0,a=r===void 0||s(t)===``,o=c(n,`index.html`),l=a?await E(o):void 0,u=i&&r?r:o,d=i??l;if(!d){w(e,404,{error:`Client asset not found`});return}e.writeHead(200,{"content-type":O(u),"cache-control":u.endsWith(`index.html`)?`no-store`:`public, max-age=31536000, immutable`}),e.end(e.req.method===`HEAD`?void 0:d)}function w(e,t,n){e.writeHead(t,{"content-type":`application/json; charset=utf-8`,"cache-control":`no-store`}),e.end(JSON.stringify(n))}function T(e,t){let n=decodeURIComponent(t),r=u(e,n===`/`?`index.html`:n.slice(1)),i=l(e,r);if(!(i.startsWith(`..`)||i===``||i.startsWith(d)))return r}async function E(e){try{return(await a(e)).isFile()?await i(e):void 0}catch(e){if(k(e)&&e.code===`ENOENT`)return;throw e}}function D(){let e=o(f(import.meta.url));return c(e.endsWith(`${d}dist${d}src`)?u(e,`../..`):e.endsWith(`${d}src`)?u(e,`..`):u(e,`../..`),`dist`,`client`)}function O(e){switch(s(e)){case`.css`:return`text/css; charset=utf-8`;case`.html`:return`text/html; charset=utf-8`;case`.js`:return`text/javascript; charset=utf-8`;case`.json`:return`application/json; charset=utf-8`;case`.svg`:return`image/svg+xml`;default:return`application/octet-stream`}}function k(e){return e instanceof Error&&`code`in e}process.argv[1]&&import.meta.url===p(process.argv[1]).href&&y({projectRoot:process.env.COREFRAME_DASHBOARD_PROJECT_ROOT??process.cwd()}).then(e=>{console.log(`Coreframe dashboard listening at ${e.url}`);let t=()=>e.server.close();process.once(`SIGINT`,t),process.once(`SIGTERM`,t)}).catch(e=>{console.error(e instanceof Error?e.message:String(e)),process.exit(1)});export{v as createDashboardRequestHandler,_ as createDashboardServer,D as resolveDashboardClientDist,y as startDashboardServer};
1
+ import{DevelopmentRequestError as e,createDevelopmentManager as t}from"./development.js";import{createDashboardApiRouter as n}from"./api/router.js";import{handleFetchRequest as r}from"./node-fetch-adapter.js";import{randomBytes as i}from"node:crypto";import{readFile as a,stat as o}from"node:fs/promises";import{createServer as s}from"node:http";import{dirname as c,extname as l,join as u,relative as d,resolve as f,sep as p}from"node:path";import{fileURLToPath as m}from"node:url";import{toFetchHandler as h}from"rouzer";function g(e){let t=_(e),n=s(async(e,n)=>{await t.handle(e,n)});return n.on(`close`,()=>{t.dispose()}),n}function _(r){let a=r.developmentManager??t({projectRoot:r.projectRoot}),o=r.mutationToken??i(32).toString(`base64url`),s=h(n({developmentManager:a,env:process.env,mutationToken:o,projectRoot:r.projectRoot}));return{dispose:()=>a.dispose(),async handle(t,n){try{await v(t,n,r,s)}catch(t){x(n,t instanceof e?t.status:500,{error:t instanceof Error?t.message:String(t)})}}}}async function v(e,t,n,i){y(e);let a=new URL(e.url??`/`,`http://127.0.0.1`);if(a.pathname===`/`){t.writeHead(302,{location:`/__dashboard`}),t.end();return}if(a.pathname.startsWith(`/__dashboard/api/`)){await r(e,t,i);return}if(a.pathname===`/__dashboard`){t.writeHead(302,{location:`/__dashboard/`}),t.end();return}if(a.pathname.startsWith(`/__dashboard/`)&&(e.method===`GET`||e.method===`HEAD`)){await b(t,a.pathname.slice(12)||`/`,n.clientDist);return}x(t,405,{error:`Method not allowed`})}function y(t){let n=t.headers.host;if(!n)throw new e(`Dashboard request host is missing.`,403);let r;try{r=new URL(`http://${n}`).hostname}catch{throw new e(`Dashboard request host was not authorized.`,403)}if(r!==`127.0.0.1`&&r!==`::1`&&r!==`localhost`&&!r.endsWith(`.localhost`))throw new e(`Dashboard request host was not authorized.`,403)}async function b(e,t,n=w()){let r=S(n,t),i=r?await C(r):void 0,a=r===void 0||l(t)===``,o=u(n,`index.html`),s=a?await C(o):void 0,c=i&&r?r:o,d=i??s;if(!d){x(e,404,{error:`Client asset not found`});return}e.writeHead(200,{"content-type":T(c),"cache-control":c.endsWith(`index.html`)?`no-store`:`public, max-age=31536000, immutable`}),e.end(e.req.method===`HEAD`?void 0:d)}function x(e,t,n){e.writeHead(t,{"content-type":`application/json; charset=utf-8`,"cache-control":`no-store`}),e.end(JSON.stringify(n))}function S(e,t){let n=decodeURIComponent(t),r=f(e,n===`/`?`index.html`:n.slice(1)),i=d(e,r);if(!(i.startsWith(`..`)||i===``||i.startsWith(p)))return r}async function C(e){try{return(await o(e)).isFile()?await a(e):void 0}catch(e){if(E(e)&&e.code===`ENOENT`)return;throw e}}function w(){let e=c(m(import.meta.url));return u(e.endsWith(`${p}dist${p}src`)?f(e,`../..`):e.endsWith(`${p}src`)?f(e,`..`):f(e,`../..`),`dist`,`client`)}function T(e){switch(l(e)){case`.css`:return`text/css; charset=utf-8`;case`.html`:return`text/html; charset=utf-8`;case`.js`:return`text/javascript; charset=utf-8`;case`.json`:return`application/json; charset=utf-8`;case`.svg`:return`image/svg+xml`;default:return`application/octet-stream`}}function E(e){return e instanceof Error&&`code`in e}export{_ as createDashboardRequestHandler,g as createDashboardServer,w as resolveDashboardClientDist};
package/package.json CHANGED
@@ -1,14 +1,11 @@
1
1
  {
2
2
  "name": "@coreframe/dashboard",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/airlock-labs/coreframe.git",
7
7
  "directory": "dashboard"
8
8
  },
9
- "bin": {
10
- "coreframe-dashboard": "./dist/src/cli.js"
11
- },
12
9
  "files": [
13
10
  "dist/"
14
11
  ],
@@ -31,14 +28,13 @@
31
28
  "@fontsource-variable/inter": "^5.2.8",
32
29
  "@tanstack/react-query": "^5.101.2",
33
30
  "nanoreset": "^7.0.0",
34
- "portless": "^0.15.1",
35
31
  "react": "^19.2.7",
36
32
  "react-dom": "^19.2.7",
37
33
  "react-router": "^8.2.0",
38
34
  "rouzer": "^6.0.1",
39
35
  "zod": "^4.4.3",
40
36
  "@coreframe/diagnostics": "0.1.0",
41
- "@coreframe/scripts": "0.1.19"
37
+ "@coreframe/scripts": "0.1.20"
42
38
  },
43
39
  "devDependencies": {
44
40
  "@pandacss/dev": "2.0.0-beta.8",
@@ -65,7 +61,6 @@
65
61
  "build:client": "react-router build",
66
62
  "codegen": "panda codegen",
67
63
  "build:server": "tsdown",
68
- "dev": "pnpm build && node dist/src/cli.js",
69
64
  "test": "vitest run",
70
65
  "typecheck": "react-router typegen && tsc --noEmit -p tsconfig.json",
71
66
  "format": "oxfmt",
package/dist/src/cli.d.ts DELETED
@@ -1 +0,0 @@
1
- export { };
package/dist/src/cli.js DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import{spawn as e}from"node:child_process";import{access as t}from"node:fs/promises";import{dirname as n,join as r}from"node:path";import{fileURLToPath as i}from"node:url";const a=`https://coreframe.localhost/__dashboard`;async function o(){let t=process.argv.slice(2);if(t.includes(`--help`)||t.includes(`-h`)){s();return}let o=r(n(i(import.meta.url)),`server.js`),l=e(await c(),[`coreframe`,process.execPath,o],{stdio:`inherit`,shell:process.platform===`win32`,env:{...process.env,COREFRAME_DASHBOARD_PROJECT_ROOT:process.cwd(),COREFRAME_DASHBOARD_URL:a}});l.on(`exit`,(e,t)=>{if(t){process.kill(process.pid,t);return}process.exit(e??0)}),l.on(`error`,e=>{console.error(e.message),process.exit(1)})}function s(){console.log(`Coreframe Dashboard
3
-
4
- Usage:
5
- coreframe-dashboard
6
-
7
- Starts the local dashboard at ${a}.
8
- `)}async function c(){let e=r(r(n(i(import.meta.url)),`..`,`..`),`node_modules`,`.bin`,process.platform===`win32`?`portless.cmd`:`portless`);return await t(e),e}o().catch(e=>{console.error(e instanceof Error?e.message:String(e)),process.exit(1)});export{};