@flisk-sh/flisk 1.3.198 → 1.3.199

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.
@@ -1,2 +1,2 @@
1
1
  import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
2
- import{J as a,K as b,L as c,M as d,N as e,O as f,P as g,Q as h,R as i,S as j}from"./chunk-DWHA5YKT.js";import"./chunk-SB5WAMSU.js";import"./chunk-KBGQ4NJE.js";import"./chunk-42IVF3YT.js";import"./chunk-US4D5GJJ.js";import"./chunk-CF46CD6R.js";import"./chunk-6EA4DGCY.js";export{c as MACHINE_CHECK_IDS,a as RUNTIME_CHECK_IDS,b as SCAFFOLD_CHECK_IDS,h as assertMachineReadyOrExit,i as detectRuntimePrerequisites,g as formatColdPreflight,j as formatRuntimeNextSteps,d as nodeTooOld,e as requireVerifiedDockerVersions,f as runColdPreflight};
2
+ import{J as a,K as b,L as c,M as d,N as e,O as f,P as g,Q as h,R as i,S as j}from"./chunk-HSNRMF4B.js";import"./chunk-7IWOM6M2.js";import"./chunk-3SPYAO2E.js";import"./chunk-42IVF3YT.js";import"./chunk-GW7N23FV.js";import"./chunk-CF46CD6R.js";import"./chunk-6EA4DGCY.js";export{c as MACHINE_CHECK_IDS,a as RUNTIME_CHECK_IDS,b as SCAFFOLD_CHECK_IDS,h as assertMachineReadyOrExit,i as detectRuntimePrerequisites,g as formatColdPreflight,j as formatRuntimeNextSteps,d as nodeTooOld,e as requireVerifiedDockerVersions,f as runColdPreflight};
@@ -0,0 +1,4 @@
1
+ import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
2
+ import"./chunk-6EA4DGCY.js";import{spawn as l}from"node:child_process";import{readdirSync as d}from"node:fs";import{join as p}from"node:path";var m="Frontend URLs";function g(n){let r=n.split(`
3
+ `),t=r.findIndex(e=>e.includes(m));if(t!==-1)for(let e of r.slice(t+1)){let o=e.match(/^\s*-\s+\S+:\s+(https?:\/\/\S+)/);if(o)return o[1];if(e.trim()===""||e.includes("URLs:"))break}}function h(n){for(let r of n.split(`
4
+ `)){let t=r.trim();if(t.startsWith("{"))try{let e=JSON.parse(t),s=(e.data??{}).ok===!0;return{ok:s,error:s?void 0:e.errors?.[0]?.message??"the stack did not come up",raw:n}}catch{}}}function R(n,r,t=process.env,e=l){return new Promise(o=>{let s=e(process.execPath,[n,"up","--json"],{cwd:r,env:t,stdio:["inherit","pipe","pipe"]}),a="",i=!1,u=c=>{i||(i=!0,s.unref?.(),o(c))};s.stdout?.on("data",c=>{a+=String(c);let f=h(a);f&&u(f)}),s.stderr?.on("data",c=>{a+=String(c)}),s.on("error",c=>u({ok:!1,error:c.message,raw:a})),s.on("close",c=>u({ok:!1,error:`the stack stopped before it was ready (code ${c})`,raw:a}))})}function v(n,r){if(!r(n))return n;for(let t=2;t<1e3;t+=1){let e=`${n}-${t}`;if(!r(e))return e}return n}function k(n,r=4){let t=[],e=(o,s)=>{if(s>r)return;let a;try{a=d(o,{withFileTypes:!0}).map(i=>i.name)}catch{return}a.includes("package.json")&&t.push(o);for(let i of d(o,{withFileTypes:!0}))!i.isDirectory()||i.name==="node_modules"||i.name.startsWith(".")||e(p(o,i.name),s+1)};return e(n,0),t}async function D(n,r=w){let t=[];for(let e of k(n)){let o=await r("bun",["install"],e);t.push({dir:e,ok:o===0})}return t}function w(n,r,t){return new Promise(e=>{let o=l(n,r,{cwd:t,stdio:"ignore"});o.on("error",()=>e(1)),o.on("close",s=>e(s??1))})}export{g as findFrontendUrl,k as findServiceDirs,D as installServiceDependencies,v as nextAvailableProjectDir,h as parseStackEnvelope,R as runStackQuiet};
@@ -0,0 +1,2 @@
1
+ import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
2
+ import{e as a,f as b,g as c,h as d,i as e,j as f}from"./chunk-6357RMGA.js";import"./chunk-DTIHDMED.js";import"./chunk-7IWOM6M2.js";import"./chunk-GW7N23FV.js";import"./chunk-CF46CD6R.js";import"./chunk-6EA4DGCY.js";export{d as findReadyFrontend,b as isFrontendReady,a as listFrontendTargets,f as openCommand,e as openFirstFrontend,c as pickReadyFrontend};
@@ -1,2 +1,2 @@
1
1
  import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
2
- import{g as a,h as b,i as c,j as d}from"./chunk-YUARXGF4.js";import"./chunk-KGKKDD4K.js";import"./chunk-KBGQ4NJE.js";import"./chunk-42IVF3YT.js";import"./chunk-US4D5GJJ.js";import"./chunk-CF46CD6R.js";import"./chunk-6EA4DGCY.js";export{c as cloneProjectTemplate,a as enableDiscoveredStacks,d as projectCommand,b as templateTargetDir};
2
+ import{g as a,h as b,i as c,j as d}from"./chunk-WMK2PS63.js";import"./chunk-KGKKDD4K.js";import"./chunk-3SPYAO2E.js";import"./chunk-42IVF3YT.js";import"./chunk-GW7N23FV.js";import"./chunk-CF46CD6R.js";import"./chunk-6EA4DGCY.js";export{c as cloneProjectTemplate,a as enableDiscoveredStacks,d as projectCommand,b as templateTargetDir};
package/cli/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tdk-cli-internal",
3
3
  "private": true,
4
- "version": "1.3.198",
4
+ "version": "1.3.199",
5
5
  "description": "Flisk CLI — start services on your machine.",
6
6
  "keywords": [
7
7
  "flisk",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flisk-sh/flisk",
3
- "version": "1.3.198",
3
+ "version": "1.3.199",
4
4
  "description": "Flisk CLI — start services on your machine.",
5
5
  "homepage": "https://flisk.sh",
6
6
  "repository": {
@@ -1,4 +0,0 @@
1
- import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
2
- import{a as k}from"./chunk-DTIHDMED.js";import{g as w,h as y}from"./chunk-SB5WAMSU.js";import{Ra as h,ba as d,ca as u,d as l,k as f,ra as m,s as p,ta as g}from"./chunk-US4D5GJJ.js";import{b as a}from"./chunk-CF46CD6R.js";import{Command as A}from"commander";import{readFileSync as E}from"node:fs";import{join as T}from"node:path";function $(n){let e=n.config;return e?Array.isArray(e.featuresEnabled)&&e.featuresEnabled.includes(l)?!0:(Array.isArray(e.dependsOn)?e.dependsOn:[]).some(o=>y.includes(o)):!1}function H(n,e){let i=n.replace(/-/g,"_"),o=[];for(let t of[...e].sort((r,s)=>r.name.localeCompare(s.name))){let r=t.resources.filter($).map(s=>s.name);r.length!==0&&o.push({name:`${i}_${t.name.replace(/-/g,"_")}`,stack:t.name,services:r.sort()})}return o.length===0?null:{name:"postgres",databases:o}}function x(n){try{let e=JSON.parse(E(T(n,".tdk",f),"utf-8"));return typeof e?.project?.name=="string"?e.project.name:null}catch{return null}}import{spawn as P}from"node:child_process";function j(n){try{let e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function S(n,e=process.platform,i=P){if(!j(n))return Promise.resolve(!1);let o,t;return e==="darwin"?(o="open",t=[n]):e==="win32"?(o="rundll32.exe",t=["url.dll,FileProtocolHandler",n]):(o="xdg-open",t=[n]),new Promise(r=>{try{let s=i(o,t,{stdio:"ignore",detached:!0,windowsHide:!0});s.once("error",()=>r(!1)),s.once("spawn",()=>{typeof s.unref=="function"&&s.unref(),r(!0)})}catch{r(!1)}})}function B(n,e=process.platform,i=P){return new Promise(o=>{let t,r;e==="darwin"?(t="pbcopy",r=[]):e==="win32"?(t="clip",r=[]):(t="xclip",r=["-selection","clipboard"]);try{let s=i(t,r,{stdio:["pipe","ignore","ignore"],windowsHide:!0});s.on("error",()=>{o(!1)}),s.on("close",c=>{o(c===0)}),s.stdin?(s.stdin.on("error",()=>{o(!1)}),s.stdin.write(n,"utf-8"),s.stdin.end()):o(!1)}catch{o(!1)}})}async function N(n){let{resources:e}=h(n),i=await w(n,{inspectDocker:!1}),{appBase:o}=m(i?.ingressHttp,n);return e.filter(t=>t.config?.appType==="frontend").map(t=>({name:t.name,url:`${o}${g(t)}`}))}async function O(n,e=2e3){try{return(await fetch(n,{signal:AbortSignal.timeout(e)})).status<500}catch{return!1}}async function b(n,e=3e4,i){if(n.length===0)return;let o=Date.now(),t=o+e;for(;;){for(let s of n)if(await O(s.url))return s;let r=Date.now()-o;if(r>=e)return;i?.(r),await new Promise(s=>setTimeout(s,2e3))}}async function F(n){let e=n??p();if(!e)return console.log(a.yellow("Not in a Flisk project, so there is no frontend to open.")),console.log(a.gray("Run `flisk project --yes` first, or `flisk open` inside a project.")),null;let i=await N(e);if(i.length===0)return console.log(a.yellow("This project has no frontend service to open.")),console.log(a.gray("Start the stack with `flisk up` and add a frontend with `flisk resource`.")),null;let o=x(e);d(`Opening the first frontend of ${o??"this project"}`);for(let c of i)console.log(a.gray(` - ${c.name}: ${c.url}`));let t=k("Waiting for the frontend to answer..."),r=await b(i,12e4,c=>{t.text=`Waiting for the frontend to answer... ${Math.round(c/1e3)}s`});if(!r){t.fail("No frontend answered yet."),console.log(a.yellow("The stack is not serving the frontend yet.")),console.log(a.gray(" - Start the stack in another terminal: flisk up")),console.log(a.gray(" - Then run this again: flisk open"));for(let c of i)console.log(a.gray(` - ${c.name}: ${c.url}`));return null}t.succeed(`The frontend is up: ${r.name}`);let s=await S(r.url);return console.log(s?a.green(`
3
- Opened ${r.url}`):a.yellow(`
4
- Could not open a browser. Open ${r.url} yourself.`)),u("Run `flisk open` again to open the next frontend."),r.url}var Q=new A("open").description("Open the first frontend of the project in your browser").action(async()=>{await F()});export{H as a,x as b,S as c,B as d,N as e,O as f,b as g,F as h,Q as i};
@@ -1,4 +0,0 @@
1
- import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
2
- import"./chunk-6EA4DGCY.js";import{spawn as u}from"node:child_process";var p="Frontend URLs";function h(t){let n=t.split(`
3
- `),r=n.findIndex(e=>e.includes(p));if(r!==-1)for(let e of n.slice(r+1)){let i=e.match(/^\s*-\s+\S+:\s+(https?:\/\/\S+)/);if(i)return i[1];if(e.trim()===""||e.includes("URLs:"))break}}function l(t){for(let n of t.split(`
4
- `)){let r=n.trim();if(r.startsWith("{"))try{let e=JSON.parse(r),s=(e.data??{}).ok===!0;return{ok:s,error:s?void 0:e.errors?.[0]?.message??"the stack did not come up",raw:t}}catch{}}}function k(t,n,r=process.env,e=u){return new Promise(i=>{let s=e(process.execPath,[t,"up","--json"],{cwd:n,env:r,stdio:["inherit","pipe","pipe"]}),c="",d=!1,a=o=>{d||(d=!0,s.unref?.(),i(o))};s.stdout?.on("data",o=>{c+=String(o);let f=l(c);f&&a(f)}),s.stderr?.on("data",o=>{c+=String(o)}),s.on("error",o=>a({ok:!1,error:o.message,raw:c})),s.on("close",o=>a({ok:!1,error:`the stack stopped before it was ready (code ${o})`,raw:c}))})}function x(t,n){if(!n(t))return t;for(let r=2;r<1e3;r+=1){let e=`${t}-${r}`;if(!n(e))return e}return t}export{h as findFrontendUrl,x as nextAvailableProjectDir,l as parseStackEnvelope,k as runStackQuiet};
@@ -1,2 +0,0 @@
1
- import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
2
- import{e as a,f as b,g as c,h as d,i as e}from"./chunk-WPQOTHB5.js";import"./chunk-DTIHDMED.js";import"./chunk-SB5WAMSU.js";import"./chunk-US4D5GJJ.js";import"./chunk-CF46CD6R.js";import"./chunk-6EA4DGCY.js";export{b as isFrontendReady,a as listFrontendTargets,e as openCommand,d as openFirstFrontend,c as pickReadyFrontend};