@tdk-landscape/tdk-cli-core 1.3.145 → 1.3.146
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/CHANGELOG.md +1 -0
- package/README.md +2 -2
- package/Tiltfile +2 -0
- package/cli/dist/commands/doctor.js +49 -2
- package/cli/dist/utils/doctor-runtime.js +60 -0
- package/cli/dist/utils/host-port-config.js +11 -2
- package/cli/dist/utils/host-port-plan.js +25 -3
- package/cli/dist/utils/service-urls.js +16 -2
- package/cli/dist/utils/smoke.js +28 -0
- package/cli/dist-bundle/chunk-SWAGCVPQ.js +321 -0
- package/cli/dist-bundle/cli.js +3 -3
- package/cli/dist-bundle/{cold-preflight-F2FM46HK.js → cold-preflight-2ZV2PDU2.js} +1 -1
- package/cli/package.json +1 -1
- package/cli/templates/Tiltfile.hbs +12 -0
- package/engine/Tiltfile +2 -0
- package/engine/assets/scripts/cleanup-tilt-images.sh +2 -2
- package/engine/topologies/platform/docker/build/frontend_build_plan.star +65 -0
- package/engine/topologies/platform/docker/build/golden_image_build.star +104 -48
- package/engine/topologies/platform/docker/layers/l3_builder_layers.star +3 -1
- package/engine/topologies/tilt/resources/build_concurrency.star +56 -0
- package/engine/topologies/tilt/resources/infra-loader.star +4 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star +24 -2
- package/engine/topologies/tilt/resources/orchestrator/generators/manifest_resource.star +5 -1
- package/engine/topologies/tilt/resources/watchers.star +7 -4
- package/package.json +1 -1
- package/cli/dist-bundle/chunk-47CDYJ5E.js +0 -316
package/cli/dist-bundle/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
|
|
3
|
-
import{$ as k1,$a as cB,A as R1,Aa as $m,B as b1,Ba as V1,C as fA,Ca as X1,D as Xm,Da as AB,E as T1,Ea as qA,F as N1,Fa as Z1,G as w1,Ga as P1,H as x1,Ha as W1,I as is,Ia as As,J as _1,Ja as Dg,K as Zm,Ka as $1,L as dA,La as eD,M as xl,Ma as tD,N as Ig,Na as lB,O as U1,Oa as nQ,P as M1,Pa as nD,Q as O1,Qa as aD,R as Ku,Ra as oD,S as di,Sa as iD,T as gn,Ta as AD,U as on,Ua as lD,V as Za,Va as rD,W as wn,Wa as sD,X as $C,Xa as cD,Y as Uo,Ya as rB,Z as eB,Za as sB,_ as Jn,_a as ls,a as b,aa as H1,ab as uB,b as XC,ba as Pm,bb as uD,c as YA,ca as yg,cb as eE,d as Tl,da as G1,db as aQ,e as fr,ea as Wm,eb as fD,f as Ju,fa as Qg,fb as dD,g as Q1,ga as Yu,gb as gD,h as dr,ha as tB,hb as pD,i as qm,ia as nB,ib as mD,j as Vm,ja as tQ,jb as fB,k as sc,ka as L1,kb as ED,l as Nl,la as Sg,lb as hD,m as wl,ma as Zo,mb as oQ,n as Wy,na as Po,nb as iQ,o as Pn,oa as nt,ob as CD,p as ki,pa as j1,pb as BD,q as S1,qa as z1,qb as ID,r as $y,ra as F1,rb as yD,s as v1,sa as J1,t as cc,ta as aB,u as vn,ua as vg,ub as QD,v as gr,va as K1,vb as SD,w as PC,wa as oB,x as eQ,xa as iB,y as WC,ya as Y1,z as D1,za as q1}from"./chunk-47CDYJ5E.js";import{a as B1,c as ZC,d as I1,e as y1}from"./chunk-42IVF3YT.js";import{a as Bg,b as Ha,c as lx,d as st}from"./chunk-6EA4DGCY.js";var g2=Ha(TB=>{"use strict";var dM=Symbol.for("react.transitional.element"),gM=Symbol.for("react.fragment");function d2(n,o,l){var s=null;if(l!==void 0&&(s=""+l),o.key!==void 0&&(s=""+o.key),"key"in o){l={};for(var u in o)u!=="key"&&(l[u]=o[u])}else l=o;return o=l.ref,{$$typeof:dM,type:n,key:s,ref:o!==void 0?o:null,props:l}}TB.Fragment=gM;TB.jsx=d2;TB.jsxs=d2});var R2=Ha(Rt=>{"use strict";var jQ=Symbol.for("react.transitional.element"),pM=Symbol.for("react.portal"),mM=Symbol.for("react.fragment"),EM=Symbol.for("react.strict_mode"),hM=Symbol.for("react.profiler"),CM=Symbol.for("react.consumer"),BM=Symbol.for("react.context"),IM=Symbol.for("react.forward_ref"),yM=Symbol.for("react.suspense"),QM=Symbol.for("react.memo"),C2=Symbol.for("react.lazy"),SM=Symbol.for("react.activity"),vM=Symbol.for("react.view_transition"),p2=Symbol.iterator;function DM(n){return n===null||typeof n!="object"?null:(n=p2&&n[p2]||n["@@iterator"],typeof n=="function"?n:null)}var B2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},I2=Object.assign,y2={};function kg(n,o,l){this.props=n,this.context=o,this.refs=y2,this.updater=l||B2}kg.prototype.isReactComponent={};kg.prototype.setState=function(n,o){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,o,"setState")};kg.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function Q2(){}Q2.prototype=kg.prototype;function zQ(n,o,l){this.props=n,this.context=o,this.refs=y2,this.updater=l||B2}var FQ=zQ.prototype=new Q2;FQ.constructor=zQ;I2(FQ,kg.prototype);FQ.isPureReactComponent=!0;var m2=Array.isArray;function LQ(){}var Kn={H:null,A:null,T:null,S:null},S2=Object.prototype.hasOwnProperty;function JQ(n,o,l){var s=l.ref;return{$$typeof:jQ,type:n,key:o,ref:s!==void 0?s:null,props:l}}function RM(n,o){return JQ(n.type,o,n.props)}function KQ(n){return typeof n=="object"&&n!==null&&n.$$typeof===jQ}function bM(n){var o={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(l){return o[l]})}var E2=/\/+/g;function GQ(n,o){return typeof n=="object"&&n!==null&&n.key!=null?bM(""+n.key):o.toString(36)}function TM(n){switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:switch(typeof n.status=="string"?n.then(LQ,LQ):(n.status="pending",n.then(function(o){n.status==="pending"&&(n.status="fulfilled",n.value=o)},function(o){n.status==="pending"&&(n.status="rejected",n.reason=o)})),n.status){case"fulfilled":return n.value;case"rejected":throw n.reason}}throw n}function Og(n,o,l,s,u){var p=typeof n;(p==="undefined"||p==="boolean")&&(n=null);var E=!1;if(n===null)E=!0;else switch(p){case"bigint":case"string":case"number":E=!0;break;case"object":switch(n.$$typeof){case jQ:case pM:E=!0;break;case C2:return E=n._init,Og(E(n._payload),o,l,s,u)}}if(E)return u=u(n),E=s===""?"."+GQ(n,0):s,m2(u)?(l="",E!=null&&(l=E.replace(E2,"$&/")+"/"),Og(u,o,l,"",function(S){return S})):u!=null&&(KQ(u)&&(u=RM(u,l+(u.key==null||n&&n.key===u.key?"":(""+u.key).replace(E2,"$&/")+"/")+E)),o.push(u)),1;E=0;var B=s===""?".":s+":";if(m2(n))for(var I=0;I<n.length;I++)s=n[I],p=B+GQ(s,I),E+=Og(s,o,l,p,u);else if(I=DM(n),typeof I=="function")for(n=I.call(n),I=0;!(s=n.next()).done;)s=s.value,p=B+GQ(s,I++),E+=Og(s,o,l,p,u);else if(p==="object"){if(typeof n.then=="function")return Og(TM(n),o,l,s,u);throw o=String(n),Error("Objects are not valid as a React child (found: "+(o==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":o)+"). If you meant to render a collection of children, use an array instead.")}return E}function NB(n,o,l){if(n==null)return n;var s=[],u=0;return Og(n,s,"","",function(p){return o.call(l,p,u++)}),s}function NM(n){if(n._status===-1){var o=n._result,l=o();l.then(function(s){(n._status===0||n._status===-1)&&(n._status=1,n._result=s,l.status===void 0&&(l.status="fulfilled",l.value=s))},function(s){(n._status===0||n._status===-1)&&(n._status=2,n._result=s,l.status===void 0&&(l.status="rejected",l.reason=s))}),n._status===-1&&(n._status=0,n._result=l)}if(n._status===1)return n._result.default;throw n._result}var h2=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)};function v2(n){var o=Kn.T,l={};l.types=o!==null?o.types:null,Kn.T=l;try{var s=n(),u=Kn.S;u!==null&&u(l,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(LQ,h2)}catch(p){h2(p)}finally{o!==null&&l.types!==null&&(o.types=l.types),Kn.T=o}}function D2(n){var o=Kn.T;if(o!==null){var l=o.types;l===null?o.types=[n]:l.indexOf(n)===-1&&l.push(n)}else v2(D2.bind(null,n))}var wM={map:NB,forEach:function(n,o,l){NB(n,function(){o.apply(this,arguments)},l)},count:function(n){var o=0;return NB(n,function(){o++}),o},toArray:function(n){return NB(n,function(o){return o})||[]},only:function(n){if(!KQ(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};Rt.Activity=SM;Rt.Children=wM;Rt.Component=kg;Rt.Fragment=mM;Rt.Profiler=hM;Rt.PureComponent=zQ;Rt.StrictMode=EM;Rt.Suspense=yM;Rt.ViewTransition=vM;Rt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Kn;Rt.__COMPILER_RUNTIME={__proto__:null,c:function(n){return Kn.H.useMemoCache(n)}};Rt.addTransitionType=D2;Rt.cache=function(n){return function(){return n.apply(null,arguments)}};Rt.cacheSignal=function(){return null};Rt.cloneElement=function(n,o,l){if(n==null)throw Error("The argument must be a React element, but you passed "+n+".");var s=I2({},n.props),u=n.key;if(o!=null)for(p in o.key!==void 0&&(u=""+o.key),o)!S2.call(o,p)||p==="key"||p==="__self"||p==="__source"||p==="ref"&&o.ref===void 0||(s[p]=o[p]);var p=arguments.length-2;if(p===1)s.children=l;else if(1<p){for(var E=Array(p),B=0;B<p;B++)E[B]=arguments[B+2];s.children=E}return JQ(n.type,u,s)};Rt.createContext=function(n){return n={$$typeof:BM,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null},n.Provider=n,n.Consumer={$$typeof:CM,_context:n},n};Rt.createElement=function(n,o,l){var s,u={},p=null;if(o!=null)for(s in o.key!==void 0&&(p=""+o.key),o)S2.call(o,s)&&s!=="key"&&s!=="__self"&&s!=="__source"&&(u[s]=o[s]);var E=arguments.length-2;if(E===1)u.children=l;else if(1<E){for(var B=Array(E),I=0;I<E;I++)B[I]=arguments[I+2];u.children=B}if(n&&n.defaultProps)for(s in E=n.defaultProps,E)u[s]===void 0&&(u[s]=E[s]);return JQ(n,p,u)};Rt.createRef=function(){return{current:null}};Rt.forwardRef=function(n){return{$$typeof:IM,render:n}};Rt.isValidElement=KQ;Rt.lazy=function(n){return{$$typeof:C2,_payload:{_status:-1,_result:n},_init:NM}};Rt.memo=function(n,o){return{$$typeof:QM,type:n,compare:o===void 0?null:o}};Rt.startTransition=v2;Rt.unstable_useCacheRefresh=function(){return Kn.H.useCacheRefresh()};Rt.use=function(n){return Kn.H.use(n)};Rt.useActionState=function(n,o,l){return Kn.H.useActionState(n,o,l)};Rt.useCallback=function(n,o){return Kn.H.useCallback(n,o)};Rt.useContext=function(n){return Kn.H.useContext(n)};Rt.useDebugValue=function(){};Rt.useDeferredValue=function(n,o){return Kn.H.useDeferredValue(n,o)};Rt.useEffect=function(n,o){return Kn.H.useEffect(n,o)};Rt.useEffectEvent=function(n){return Kn.H.useEffectEvent(n)};Rt.useId=function(){return Kn.H.useId()};Rt.useImperativeHandle=function(n,o,l){return Kn.H.useImperativeHandle(n,o,l)};Rt.useInsertionEffect=function(n,o){return Kn.H.useInsertionEffect(n,o)};Rt.useLayoutEffect=function(n,o){return Kn.H.useLayoutEffect(n,o)};Rt.useMemo=function(n,o){return Kn.H.useMemo(n,o)};Rt.useOptimistic=function(n,o){return Kn.H.useOptimistic(n,o)};Rt.useReducer=function(n,o,l){return Kn.H.useReducer(n,o,l)};Rt.useRef=function(n){return Kn.H.useRef(n)};Rt.useState=function(n){return Kn.H.useState(n)};Rt.useSyncExternalStore=function(n,o,l){return Kn.H.useSyncExternalStore(n,o,l)};Rt.useTransition=function(){return Kn.H.useTransition()};Rt.version="19.3.0"});var b2=Ha((yt,wB)=>{"use strict";process.env.NODE_ENV!=="production"&&(function(){function n(y,U){Object.defineProperty(s.prototype,y,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",U[0],U[1])}})}function o(y){return y===null||typeof y!="object"?null:(y=$a&&y[$a]||y["@@iterator"],typeof y=="function"?y:null)}function l(y,U){y=(y=y.constructor)&&(y.displayName||y.name)||"ReactClass";var ue=y+"."+U;St[ue]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",U,y),St[ue]=!0)}function s(y,U,ue){this.props=y,this.context=U,this.refs=en,this.updater=ue||Ft}function u(){}function p(y,U,ue){this.props=y,this.context=U,this.refs=en,this.updater=ue||Ft}function E(){}function B(y){return""+y}function I(y){try{B(y);var U=!1}catch{U=!0}if(U){U=console;var ue=U.error,re=typeof Symbol=="function"&&Symbol.toStringTag&&y[Symbol.toStringTag]||y.constructor.name||"Object";return ue.call(U,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",re),B(y)}}function S(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===Wn?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case Qt:return"Fragment";case Te:return"Profiler";case J:return"StrictMode";case ut:return"Suspense";case qe:return"SuspenseList";case mn:return"Activity";case Ga:return"ViewTransition"}if(typeof y=="object")switch(typeof y.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),y.$$typeof){case Tt:return"Portal";case Pe:return y.displayName||"Context";case Ge:return(y._context.displayName||"Context")+".Consumer";case We:var U=y.render;return y=y.displayName,y||(y=U.displayName||U.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case He:return U=y.displayName||null,U!==null?U:S(y.type)||"Memo";case $e:U=y._payload,y=y._init;try{return S(y(U))}catch{}}return null}function N(y){if(y===Qt)return"<>";if(typeof y=="object"&&y!==null&&y.$$typeof===$e)return"<...>";try{var U=S(y);return U?"<"+U+">":"<...>"}catch{return"<...>"}}function x(){var y=Ve.A;return y===null?null:y.getOwner()}function v(){return Error("react-stack-top-frame")}function w(y){if(Wt.call(y,"key")){var U=Object.getOwnPropertyDescriptor(y,"key").get;if(U&&U.isReactWarning)return!1}return y.key!==void 0}function z(y,U){function ue(){On||(On=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",U))}ue.isReactWarning=!0,Object.defineProperty(y,"key",{get:ue,configurable:!0})}function F(){var y=S(this.type);return Na[y]||(Na[y]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),y=this.props.ref,y!==void 0?y:null}function M(y,U,ue,re,ce,ct){var xe=ue.ref;return y={$$typeof:Me,type:y,key:U,props:ue,_owner:re},(xe!==void 0?xe:null)!==null?Object.defineProperty(y,"ref",{enumerable:!1,get:F}):Object.defineProperty(y,"ref",{enumerable:!1,value:null}),y._store={},Object.defineProperty(y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(y,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(y,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ce}),Object.defineProperty(y,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ct}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y}function ae(y,U){return U=M(y.type,U,y.props,y._owner,y._debugStack,y._debugTask),y._store&&(U._store.validated=y._store.validated),U}function he(y){Re(y)?y._store&&(y._store.validated=1):typeof y=="object"&&y!==null&&y.$$typeof===$e&&(y._payload.status==="fulfilled"?Re(y._payload.value)&&y._payload.value._store&&(y._payload.value._store.validated=1):y._store&&(y._store.validated=1))}function Re(y){return typeof y=="object"&&y!==null&&y.$$typeof===Me}function Ie(y){var U={"=":"=0",":":"=2"};return"$"+y.replace(/[=:]/g,function(ue){return U[ue]})}function je(y,U){return typeof y=="object"&&y!==null&&y.key!=null?(I(y.key),Ie(""+y.key)):U.toString(36)}function Oe(y){switch(y.status){case"fulfilled":return y.value;case"rejected":throw y.reason;default:switch(typeof y.status=="string"?y.then(E,E):(y.status="pending",y.then(function(U){y.status==="pending"&&(y.status="fulfilled",y.value=U)},function(U){y.status==="pending"&&(y.status="rejected",y.reason=U)})),y.status){case"fulfilled":return y.value;case"rejected":throw y.reason}}throw y}function be(y,U,ue,re,ce){var ct=typeof y;(ct==="undefined"||ct==="boolean")&&(y=null);var xe=!1;if(y===null)xe=!0;else switch(ct){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(y.$$typeof){case Me:case Tt:xe=!0;break;case $e:return xe=y._init,be(xe(y._payload),U,ue,re,ce)}}if(xe){xe=y,ce=ce(xe);var Xe=re===""?"."+je(xe,0):re;return ua(ce)?(ue="",Xe!=null&&(ue=Xe.replace(Qo,"$&/")+"/"),be(ce,U,ue,"",function($n){return $n})):ce!=null&&(Re(ce)&&(ce.key!=null&&(xe&&xe.key===ce.key||I(ce.key)),ue=ae(ce,ue+(ce.key==null||xe&&xe.key===ce.key?"":(""+ce.key).replace(Qo,"$&/")+"/")+Xe),re!==""&&xe!=null&&Re(xe)&&xe.key==null&&xe._store&&!xe._store.validated&&(ue._store.validated=2),ce=ue),U.push(ce)),1}if(xe=0,Xe=re===""?".":re+":",ua(y))for(var Dt=0;Dt<y.length;Dt++)re=y[Dt],ct=Xe+je(re,Dt),xe+=be(re,U,ue,ct,ce);else if(Dt=o(y),typeof Dt=="function")for(Dt===y.entries&&(qt||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),qt=!0),y=Dt.call(y),Dt=0;!(re=y.next()).done;)re=re.value,ct=Xe+je(re,Dt++),xe+=be(re,U,ue,ct,ce);else if(ct==="object"){if(typeof y.then=="function")return be(Oe(y),U,ue,re,ce);throw U=String(y),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(y).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return xe}function ze(y,U,ue){if(y==null)return y;var re=[],ce=0;return be(y,re,"","",function(ct){return U.call(ue,ct,ce++)}),re}function Qe(y){if(y._status===-1){var U=null,ue=null,re=y._ioInfo;re!=null&&(re.start=re.end=performance.now(),re.value=new Promise(function(xe,Xe){U=xe,ue=Xe})),re=y._result;var ce=re();if(ce.then(function(xe){if(y._status===0||y._status===-1){y._status=1,y._result=xe;var Xe=y._ioInfo;if(Xe!=null){Xe.end=performance.now();var Dt=xe?.default;U(Dt),Xe.value.status="fulfilled",Xe.value.value=Dt}ce.status===void 0&&(ce.status="fulfilled",ce.value=xe)}},function(xe){if(y._status===0||y._status===-1){y._status=2,y._result=xe;var Xe=y._ioInfo;Xe!=null&&(Xe.end=performance.now(),Xe.value.then(E,E),ue(xe),Xe.value.status="rejected",Xe.value.reason=xe),ce.status===void 0&&(ce.status="rejected",ce.reason=xe)}}),re=y._ioInfo,re!=null){var ct=ce.displayName;typeof ct=="string"&&(re.name=ct)}y._status===-1&&(y._status=0,y._result=ce)}if(y._status===1)return re=y._result,re===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
3
|
+
import{$ as k1,$a as cB,A as R1,Aa as $m,B as b1,Ba as V1,C as fA,Ca as X1,D as Xm,Da as AB,E as T1,Ea as qA,F as N1,Fa as Z1,G as w1,Ga as P1,H as x1,Ha as W1,I as is,Ia as As,J as _1,Ja as Dg,K as Zm,Ka as $1,L as dA,La as eD,M as xl,Ma as tD,N as Ig,Na as lB,O as U1,Oa as nQ,P as M1,Pa as nD,Q as O1,Qa as aD,R as Ku,Ra as oD,S as di,Sa as iD,T as gn,Ta as AD,U as on,Ua as lD,V as Za,Va as rD,W as wn,Wa as sD,X as $C,Xa as cD,Y as Uo,Ya as rB,Z as eB,Za as sB,_ as Jn,_a as ls,a as b,aa as H1,ab as uB,b as XC,ba as Pm,bb as uD,c as YA,ca as yg,cb as eE,d as Tl,da as G1,db as aQ,e as fr,ea as Wm,eb as fD,f as Ju,fa as Qg,fb as dD,g as Q1,ga as Yu,gb as gD,h as dr,ha as tB,hb as pD,i as qm,ia as nB,ib as mD,j as Vm,ja as tQ,jb as fB,k as sc,ka as L1,kb as ED,l as Nl,la as Sg,lb as hD,m as wl,ma as Zo,mb as oQ,n as Wy,na as Po,nb as iQ,o as Pn,oa as nt,ob as CD,p as ki,pa as j1,pb as BD,q as S1,qa as z1,qb as ID,r as $y,ra as F1,rb as yD,s as v1,sa as J1,t as cc,ta as aB,u as vn,ua as vg,ub as QD,v as gr,va as K1,vb as SD,w as PC,wa as oB,x as eQ,xa as iB,y as WC,ya as Y1,z as D1,za as q1}from"./chunk-SWAGCVPQ.js";import{a as B1,c as ZC,d as I1,e as y1}from"./chunk-42IVF3YT.js";import{a as Bg,b as Ha,c as lx,d as st}from"./chunk-6EA4DGCY.js";var g2=Ha(TB=>{"use strict";var dM=Symbol.for("react.transitional.element"),gM=Symbol.for("react.fragment");function d2(n,o,l){var s=null;if(l!==void 0&&(s=""+l),o.key!==void 0&&(s=""+o.key),"key"in o){l={};for(var u in o)u!=="key"&&(l[u]=o[u])}else l=o;return o=l.ref,{$$typeof:dM,type:n,key:s,ref:o!==void 0?o:null,props:l}}TB.Fragment=gM;TB.jsx=d2;TB.jsxs=d2});var R2=Ha(Rt=>{"use strict";var jQ=Symbol.for("react.transitional.element"),pM=Symbol.for("react.portal"),mM=Symbol.for("react.fragment"),EM=Symbol.for("react.strict_mode"),hM=Symbol.for("react.profiler"),CM=Symbol.for("react.consumer"),BM=Symbol.for("react.context"),IM=Symbol.for("react.forward_ref"),yM=Symbol.for("react.suspense"),QM=Symbol.for("react.memo"),C2=Symbol.for("react.lazy"),SM=Symbol.for("react.activity"),vM=Symbol.for("react.view_transition"),p2=Symbol.iterator;function DM(n){return n===null||typeof n!="object"?null:(n=p2&&n[p2]||n["@@iterator"],typeof n=="function"?n:null)}var B2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},I2=Object.assign,y2={};function kg(n,o,l){this.props=n,this.context=o,this.refs=y2,this.updater=l||B2}kg.prototype.isReactComponent={};kg.prototype.setState=function(n,o){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,o,"setState")};kg.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function Q2(){}Q2.prototype=kg.prototype;function zQ(n,o,l){this.props=n,this.context=o,this.refs=y2,this.updater=l||B2}var FQ=zQ.prototype=new Q2;FQ.constructor=zQ;I2(FQ,kg.prototype);FQ.isPureReactComponent=!0;var m2=Array.isArray;function LQ(){}var Kn={H:null,A:null,T:null,S:null},S2=Object.prototype.hasOwnProperty;function JQ(n,o,l){var s=l.ref;return{$$typeof:jQ,type:n,key:o,ref:s!==void 0?s:null,props:l}}function RM(n,o){return JQ(n.type,o,n.props)}function KQ(n){return typeof n=="object"&&n!==null&&n.$$typeof===jQ}function bM(n){var o={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(l){return o[l]})}var E2=/\/+/g;function GQ(n,o){return typeof n=="object"&&n!==null&&n.key!=null?bM(""+n.key):o.toString(36)}function TM(n){switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:switch(typeof n.status=="string"?n.then(LQ,LQ):(n.status="pending",n.then(function(o){n.status==="pending"&&(n.status="fulfilled",n.value=o)},function(o){n.status==="pending"&&(n.status="rejected",n.reason=o)})),n.status){case"fulfilled":return n.value;case"rejected":throw n.reason}}throw n}function Og(n,o,l,s,u){var p=typeof n;(p==="undefined"||p==="boolean")&&(n=null);var E=!1;if(n===null)E=!0;else switch(p){case"bigint":case"string":case"number":E=!0;break;case"object":switch(n.$$typeof){case jQ:case pM:E=!0;break;case C2:return E=n._init,Og(E(n._payload),o,l,s,u)}}if(E)return u=u(n),E=s===""?"."+GQ(n,0):s,m2(u)?(l="",E!=null&&(l=E.replace(E2,"$&/")+"/"),Og(u,o,l,"",function(S){return S})):u!=null&&(KQ(u)&&(u=RM(u,l+(u.key==null||n&&n.key===u.key?"":(""+u.key).replace(E2,"$&/")+"/")+E)),o.push(u)),1;E=0;var B=s===""?".":s+":";if(m2(n))for(var I=0;I<n.length;I++)s=n[I],p=B+GQ(s,I),E+=Og(s,o,l,p,u);else if(I=DM(n),typeof I=="function")for(n=I.call(n),I=0;!(s=n.next()).done;)s=s.value,p=B+GQ(s,I++),E+=Og(s,o,l,p,u);else if(p==="object"){if(typeof n.then=="function")return Og(TM(n),o,l,s,u);throw o=String(n),Error("Objects are not valid as a React child (found: "+(o==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":o)+"). If you meant to render a collection of children, use an array instead.")}return E}function NB(n,o,l){if(n==null)return n;var s=[],u=0;return Og(n,s,"","",function(p){return o.call(l,p,u++)}),s}function NM(n){if(n._status===-1){var o=n._result,l=o();l.then(function(s){(n._status===0||n._status===-1)&&(n._status=1,n._result=s,l.status===void 0&&(l.status="fulfilled",l.value=s))},function(s){(n._status===0||n._status===-1)&&(n._status=2,n._result=s,l.status===void 0&&(l.status="rejected",l.reason=s))}),n._status===-1&&(n._status=0,n._result=l)}if(n._status===1)return n._result.default;throw n._result}var h2=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)};function v2(n){var o=Kn.T,l={};l.types=o!==null?o.types:null,Kn.T=l;try{var s=n(),u=Kn.S;u!==null&&u(l,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(LQ,h2)}catch(p){h2(p)}finally{o!==null&&l.types!==null&&(o.types=l.types),Kn.T=o}}function D2(n){var o=Kn.T;if(o!==null){var l=o.types;l===null?o.types=[n]:l.indexOf(n)===-1&&l.push(n)}else v2(D2.bind(null,n))}var wM={map:NB,forEach:function(n,o,l){NB(n,function(){o.apply(this,arguments)},l)},count:function(n){var o=0;return NB(n,function(){o++}),o},toArray:function(n){return NB(n,function(o){return o})||[]},only:function(n){if(!KQ(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};Rt.Activity=SM;Rt.Children=wM;Rt.Component=kg;Rt.Fragment=mM;Rt.Profiler=hM;Rt.PureComponent=zQ;Rt.StrictMode=EM;Rt.Suspense=yM;Rt.ViewTransition=vM;Rt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Kn;Rt.__COMPILER_RUNTIME={__proto__:null,c:function(n){return Kn.H.useMemoCache(n)}};Rt.addTransitionType=D2;Rt.cache=function(n){return function(){return n.apply(null,arguments)}};Rt.cacheSignal=function(){return null};Rt.cloneElement=function(n,o,l){if(n==null)throw Error("The argument must be a React element, but you passed "+n+".");var s=I2({},n.props),u=n.key;if(o!=null)for(p in o.key!==void 0&&(u=""+o.key),o)!S2.call(o,p)||p==="key"||p==="__self"||p==="__source"||p==="ref"&&o.ref===void 0||(s[p]=o[p]);var p=arguments.length-2;if(p===1)s.children=l;else if(1<p){for(var E=Array(p),B=0;B<p;B++)E[B]=arguments[B+2];s.children=E}return JQ(n.type,u,s)};Rt.createContext=function(n){return n={$$typeof:BM,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null},n.Provider=n,n.Consumer={$$typeof:CM,_context:n},n};Rt.createElement=function(n,o,l){var s,u={},p=null;if(o!=null)for(s in o.key!==void 0&&(p=""+o.key),o)S2.call(o,s)&&s!=="key"&&s!=="__self"&&s!=="__source"&&(u[s]=o[s]);var E=arguments.length-2;if(E===1)u.children=l;else if(1<E){for(var B=Array(E),I=0;I<E;I++)B[I]=arguments[I+2];u.children=B}if(n&&n.defaultProps)for(s in E=n.defaultProps,E)u[s]===void 0&&(u[s]=E[s]);return JQ(n,p,u)};Rt.createRef=function(){return{current:null}};Rt.forwardRef=function(n){return{$$typeof:IM,render:n}};Rt.isValidElement=KQ;Rt.lazy=function(n){return{$$typeof:C2,_payload:{_status:-1,_result:n},_init:NM}};Rt.memo=function(n,o){return{$$typeof:QM,type:n,compare:o===void 0?null:o}};Rt.startTransition=v2;Rt.unstable_useCacheRefresh=function(){return Kn.H.useCacheRefresh()};Rt.use=function(n){return Kn.H.use(n)};Rt.useActionState=function(n,o,l){return Kn.H.useActionState(n,o,l)};Rt.useCallback=function(n,o){return Kn.H.useCallback(n,o)};Rt.useContext=function(n){return Kn.H.useContext(n)};Rt.useDebugValue=function(){};Rt.useDeferredValue=function(n,o){return Kn.H.useDeferredValue(n,o)};Rt.useEffect=function(n,o){return Kn.H.useEffect(n,o)};Rt.useEffectEvent=function(n){return Kn.H.useEffectEvent(n)};Rt.useId=function(){return Kn.H.useId()};Rt.useImperativeHandle=function(n,o,l){return Kn.H.useImperativeHandle(n,o,l)};Rt.useInsertionEffect=function(n,o){return Kn.H.useInsertionEffect(n,o)};Rt.useLayoutEffect=function(n,o){return Kn.H.useLayoutEffect(n,o)};Rt.useMemo=function(n,o){return Kn.H.useMemo(n,o)};Rt.useOptimistic=function(n,o){return Kn.H.useOptimistic(n,o)};Rt.useReducer=function(n,o,l){return Kn.H.useReducer(n,o,l)};Rt.useRef=function(n){return Kn.H.useRef(n)};Rt.useState=function(n){return Kn.H.useState(n)};Rt.useSyncExternalStore=function(n,o,l){return Kn.H.useSyncExternalStore(n,o,l)};Rt.useTransition=function(){return Kn.H.useTransition()};Rt.version="19.3.0"});var b2=Ha((yt,wB)=>{"use strict";process.env.NODE_ENV!=="production"&&(function(){function n(y,U){Object.defineProperty(s.prototype,y,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",U[0],U[1])}})}function o(y){return y===null||typeof y!="object"?null:(y=$a&&y[$a]||y["@@iterator"],typeof y=="function"?y:null)}function l(y,U){y=(y=y.constructor)&&(y.displayName||y.name)||"ReactClass";var ue=y+"."+U;St[ue]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",U,y),St[ue]=!0)}function s(y,U,ue){this.props=y,this.context=U,this.refs=en,this.updater=ue||Ft}function u(){}function p(y,U,ue){this.props=y,this.context=U,this.refs=en,this.updater=ue||Ft}function E(){}function B(y){return""+y}function I(y){try{B(y);var U=!1}catch{U=!0}if(U){U=console;var ue=U.error,re=typeof Symbol=="function"&&Symbol.toStringTag&&y[Symbol.toStringTag]||y.constructor.name||"Object";return ue.call(U,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",re),B(y)}}function S(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===Wn?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case Qt:return"Fragment";case Te:return"Profiler";case J:return"StrictMode";case ut:return"Suspense";case qe:return"SuspenseList";case mn:return"Activity";case Ga:return"ViewTransition"}if(typeof y=="object")switch(typeof y.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),y.$$typeof){case Tt:return"Portal";case Pe:return y.displayName||"Context";case Ge:return(y._context.displayName||"Context")+".Consumer";case We:var U=y.render;return y=y.displayName,y||(y=U.displayName||U.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case He:return U=y.displayName||null,U!==null?U:S(y.type)||"Memo";case $e:U=y._payload,y=y._init;try{return S(y(U))}catch{}}return null}function N(y){if(y===Qt)return"<>";if(typeof y=="object"&&y!==null&&y.$$typeof===$e)return"<...>";try{var U=S(y);return U?"<"+U+">":"<...>"}catch{return"<...>"}}function x(){var y=Ve.A;return y===null?null:y.getOwner()}function v(){return Error("react-stack-top-frame")}function w(y){if(Wt.call(y,"key")){var U=Object.getOwnPropertyDescriptor(y,"key").get;if(U&&U.isReactWarning)return!1}return y.key!==void 0}function z(y,U){function ue(){On||(On=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",U))}ue.isReactWarning=!0,Object.defineProperty(y,"key",{get:ue,configurable:!0})}function F(){var y=S(this.type);return Na[y]||(Na[y]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),y=this.props.ref,y!==void 0?y:null}function M(y,U,ue,re,ce,ct){var xe=ue.ref;return y={$$typeof:Me,type:y,key:U,props:ue,_owner:re},(xe!==void 0?xe:null)!==null?Object.defineProperty(y,"ref",{enumerable:!1,get:F}):Object.defineProperty(y,"ref",{enumerable:!1,value:null}),y._store={},Object.defineProperty(y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(y,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(y,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ce}),Object.defineProperty(y,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ct}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y}function ae(y,U){return U=M(y.type,U,y.props,y._owner,y._debugStack,y._debugTask),y._store&&(U._store.validated=y._store.validated),U}function he(y){Re(y)?y._store&&(y._store.validated=1):typeof y=="object"&&y!==null&&y.$$typeof===$e&&(y._payload.status==="fulfilled"?Re(y._payload.value)&&y._payload.value._store&&(y._payload.value._store.validated=1):y._store&&(y._store.validated=1))}function Re(y){return typeof y=="object"&&y!==null&&y.$$typeof===Me}function Ie(y){var U={"=":"=0",":":"=2"};return"$"+y.replace(/[=:]/g,function(ue){return U[ue]})}function je(y,U){return typeof y=="object"&&y!==null&&y.key!=null?(I(y.key),Ie(""+y.key)):U.toString(36)}function Oe(y){switch(y.status){case"fulfilled":return y.value;case"rejected":throw y.reason;default:switch(typeof y.status=="string"?y.then(E,E):(y.status="pending",y.then(function(U){y.status==="pending"&&(y.status="fulfilled",y.value=U)},function(U){y.status==="pending"&&(y.status="rejected",y.reason=U)})),y.status){case"fulfilled":return y.value;case"rejected":throw y.reason}}throw y}function be(y,U,ue,re,ce){var ct=typeof y;(ct==="undefined"||ct==="boolean")&&(y=null);var xe=!1;if(y===null)xe=!0;else switch(ct){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(y.$$typeof){case Me:case Tt:xe=!0;break;case $e:return xe=y._init,be(xe(y._payload),U,ue,re,ce)}}if(xe){xe=y,ce=ce(xe);var Xe=re===""?"."+je(xe,0):re;return ua(ce)?(ue="",Xe!=null&&(ue=Xe.replace(Qo,"$&/")+"/"),be(ce,U,ue,"",function($n){return $n})):ce!=null&&(Re(ce)&&(ce.key!=null&&(xe&&xe.key===ce.key||I(ce.key)),ue=ae(ce,ue+(ce.key==null||xe&&xe.key===ce.key?"":(""+ce.key).replace(Qo,"$&/")+"/")+Xe),re!==""&&xe!=null&&Re(xe)&&xe.key==null&&xe._store&&!xe._store.validated&&(ue._store.validated=2),ce=ue),U.push(ce)),1}if(xe=0,Xe=re===""?".":re+":",ua(y))for(var Dt=0;Dt<y.length;Dt++)re=y[Dt],ct=Xe+je(re,Dt),xe+=be(re,U,ue,ct,ce);else if(Dt=o(y),typeof Dt=="function")for(Dt===y.entries&&(qt||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),qt=!0),y=Dt.call(y),Dt=0;!(re=y.next()).done;)re=re.value,ct=Xe+je(re,Dt++),xe+=be(re,U,ue,ct,ce);else if(ct==="object"){if(typeof y.then=="function")return be(Oe(y),U,ue,re,ce);throw U=String(y),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(y).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return xe}function ze(y,U,ue){if(y==null)return y;var re=[],ce=0;return be(y,re,"","",function(ct){return U.call(ue,ct,ce++)}),re}function Qe(y){if(y._status===-1){var U=null,ue=null,re=y._ioInfo;re!=null&&(re.start=re.end=performance.now(),re.value=new Promise(function(xe,Xe){U=xe,ue=Xe})),re=y._result;var ce=re();if(ce.then(function(xe){if(y._status===0||y._status===-1){y._status=1,y._result=xe;var Xe=y._ioInfo;if(Xe!=null){Xe.end=performance.now();var Dt=xe?.default;U(Dt),Xe.value.status="fulfilled",Xe.value.value=Dt}ce.status===void 0&&(ce.status="fulfilled",ce.value=xe)}},function(xe){if(y._status===0||y._status===-1){y._status=2,y._result=xe;var Xe=y._ioInfo;Xe!=null&&(Xe.end=performance.now(),Xe.value.then(E,E),ue(xe),Xe.value.status="rejected",Xe.value.reason=xe),ce.status===void 0&&(ce.status="rejected",ce.reason=xe)}}),re=y._ioInfo,re!=null){var ct=ce.displayName;typeof ct=="string"&&(re.name=ct)}y._status===-1&&(y._status=0,y._result=ce)}if(y._status===1)return re=y._result,re===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
4
4
|
|
|
5
5
|
Your code should look like:
|
|
6
6
|
const MyComponent = lazy(() => import('./MyComponent'))
|
|
@@ -607,7 +607,7 @@ Available templates:`));for(let[p,E]of Object.entries(QB))console.log(` ${b.cya
|
|
|
607
607
|
`,0),nt(`Source: ${l.bundledPath?"bundled TDK example":l.repo}`,0),nt(`Destination: ${u}
|
|
608
608
|
`,0);try{if(l.bundledPath){let p=SB(yU(QU(new URL("../dist/commands/project.js",import.meta.url).href)),"../../../");hU(SB(p,l.bundledPath),u,{recursive:!0});let E=IU(u).replace(/-/g,"_");for(let B of["services/platform/messaging/docker-compose.yml","services/shop/orders-api/service.json","services/shop/orders-api/src/index.ts","services/shop/orders-worker/service.json","services/shop/orders-worker/src/index.ts"]){let I=Mg(u,B),S=QQ(I,"utf-8");BU(I,S.replaceAll("tdk_example",E))}}else EU("git",["clone",l.repo,u],{stdio:"inherit"})}catch{Uo(l.bundledPath?"Bundled example copy failed. Reinstall the TDK CLI package and try again.":"git clone failed. Check you have git installed and network access.")}console.log(b.green(`
|
|
609
609
|
\u2705 Cloned "${n}" into ${s}/`)),nt(`
|
|
610
|
-
Next steps:`,0),nt(`1. cd ${s}`),nt("2. tdk doctor # check Docker/Tilt are ready"),nt("3. tdk up # start the stack")}var AE={version:"1.0",project:{name:"",version:"1.0.0"},phases:{pre_alpha:{name:"Pre-Alpha",description:"Core infrastructure and MVP services",enabledStacks:DU()},alpha:{name:"Alpha",description:"Essential business services",enabledStacks:[]},beta:{name:"Beta",description:"Extended features",enabledStacks:[]},out_of_scope:{name:"Out of Scope",description:"Future releases",enabledStacks:[]}},optional_infra:{monitoring:!1,elk:!1,debezium:!1,golden_image:!0,verdaccio:!1},discovery:{paths:["services/*/*"]},overrides:{}},vR=new SU("project").description("Initialize or validate project-level master configuration").argument("[template]",`Clone a starter example instead of a blank project (${Object.keys(QB).join(", ")})`).option("--path <dir>","Directory to clone the template into (default: the template's repo name)").option("--check","Check if master configs exist and are in sync").option("--force","Overwrite existing configuration (dangerous)").option("--yes","Non-interactive mode (use defaults)").option("--config-file <path>","Load project config from existing JSON file").action(async(n,o)=>{let{assertMachineReadyOrExit:l}=await import("./cold-preflight-
|
|
610
|
+
Next steps:`,0),nt(`1. cd ${s}`),nt("2. tdk doctor # check Docker/Tilt are ready"),nt("3. tdk up # start the stack")}var AE={version:"1.0",project:{name:"",version:"1.0.0"},phases:{pre_alpha:{name:"Pre-Alpha",description:"Core infrastructure and MVP services",enabledStacks:DU()},alpha:{name:"Alpha",description:"Essential business services",enabledStacks:[]},beta:{name:"Beta",description:"Extended features",enabledStacks:[]},out_of_scope:{name:"Out of Scope",description:"Future releases",enabledStacks:[]}},optional_infra:{monitoring:!1,elk:!1,debezium:!1,golden_image:!0,verdaccio:!1},discovery:{paths:["services/*/*"]},overrides:{}},vR=new SU("project").description("Initialize or validate project-level master configuration").argument("[template]",`Clone a starter example instead of a blank project (${Object.keys(QB).join(", ")})`).option("--path <dir>","Directory to clone the template into (default: the template's repo name)").option("--check","Check if master configs exist and are in sync").option("--force","Overwrite existing configuration (dangerous)").option("--yes","Non-interactive mode (use defaults)").option("--config-file <path>","Load project config from existing JSON file").action(async(n,o)=>{let{assertMachineReadyOrExit:l}=await import("./cold-preflight-2ZV2PDU2.js");if(await l(),n){await wn(async()=>RU(n,o.path));return}await wn(async()=>{let s=vn();s||(s=QR(),Po(`\u{1F680} Initializing new TDK project...
|
|
611
611
|
`),nt(`Location: ${s}
|
|
612
612
|
`,0));let u=Mg(s,".tdk"),p=Mg(u,sc);if(o.check){let w=wl.every(F=>uc(Mg(s,".tdk",".tdk-out",F))),z=uc(p);if(w&&z){let F=Gi(s);Zo("Project configuration is valid"),nt(`Project: ${F.project.name}`,3),nt(`Phases: ${Object.keys(F.phases).join(", ")}`,3),process.exit(0)}else{if(console.log(b.yellow("\u26A0\uFE0F Project configuration incomplete:")),z||nt(".tdk/project.json (not found)",3),!w)for(let F of wl.filter(M=>!uc(Mg(s,".tdk/.tdk-out",M))))nt(`.tdk/.tdk-out/${F} (not found)`,3);nt("Run `tdk project` to create them."),process.exit(1)}}Yu("Project Configuration"),nt(`Project root: ${s}
|
|
613
613
|
`,0),uc(u)||(TD(u),Zo("Created: .tdk/ directory"));let E=uc(p);if(E&&!o.force){Zo(".tdk/project.json exists");let w=JSON.parse(QQ(p,"utf-8")),z=Gi(s),F=SQ(s),M=vQ(z,F);if((M.length>0||!w.phases)&&rs(p,z),M.length>0&&nt(`Auto-enabled discovered service stacks: ${M.join(", ")}`,0),Po(`
|
|
@@ -1416,7 +1416,7 @@ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#isr
|
|
|
1416
1416
|
`)}`,B="Upgrade tdk to a version that supports these files. Changing schemaVersion by hand is not a fix";o.onInvalid?.(`${E}
|
|
1417
1417
|
Fix: ${B}`),console.error(b.red(`\u2717 ${E}`)),console.error(b.gray(` Fix: ${B}`)),l(1)}import{execFileSync as u3}from"node:child_process";var yw=(n,o)=>u3(n,o,{encoding:"utf-8",stdio:"pipe",windowsHide:!0});function f3(n,o=process.platform,l=yw){if(!Number.isInteger(n)||n<1||n>65535)return[];if(o==="win32"){let u=`$port=${n}; Get-NetTCPConnection -LocalPort $port -State Listen -ErrorAction SilentlyContinue | ForEach-Object { $p=Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue; if ($p -and $p.ProcessName -eq 'tilt') { $_.OwningProcess } } | Sort-Object -Unique`;try{return l("powershell.exe",["-NoProfile","-Command",u]).split(/\s+/).map(Number).filter(p=>Number.isInteger(p)&&p>0)}catch{throw new Error(`Unable to inspect Tilt listeners on port ${n} with PowerShell.`)}}let s;try{s=l("lsof",["-nP","-t",`-iTCP:${n}`,"-sTCP:LISTEN"]).split(/\s+/).map(Number).filter(u=>Number.isInteger(u)&&u>0)}catch(u){let p=u,E=p.stderr?.toString().trim();if(p?.status===1&&!E)return[];throw new Error(`Unable to inspect listeners on port ${n}. Install lsof or resolve the lsof error before using --force.`,{cause:p})}return s.filter(u=>{try{return l("ps",["-p",String(u),"-o","comm="]).trim().split(/[\\/]/).at(-1)==="tilt"}catch(p){throw new Error(`Unable to identify the process listening on port ${n}.`,{cause:p})}})}function LI(n,o=process.platform,l=yw){let s=f3(n,o,l);for(let u of s)o==="win32"?l("taskkill.exe",["/PID",String(u),"/F"]):l("kill",["-TERM",String(u)]);return s}function Qw(n,o){let l=new Set(o.map(s=>s.name));return n.filter(s=>!l.has(s))}function Sw(n,o){let l=new Map(o.map(p=>[p.name,p])),s=new Set,u=p=>{if(!(s.has(p)||!l.has(p))){s.add(p);for(let E of l.get(p)?.config?.dependsOn??[])u(E)}};for(let p of n)u(p);return{selected:o.filter(p=>s.has(p.name)),dependencies:o.map(p=>p.name).filter(p=>s.has(p)&&!n.includes(p))}}function Dw(n,o=[]){return["TDK is up.",`Tilt UI: http://localhost:${n}`,"App URLs:",...o.length>0?o.slice(0,5).map(l=>` ${l}`):[" run: tdk networks"],"Stop: tdk down"]}function m3(n,o){return n!=="win32"||o==="1"?null:"Landscape startup needs Ubuntu on WSL2. Native Windows is inspect-only."}async function E3(n=AD(),o=h3){return n.kind==="webcontainer"?oD:lD(n.kind)&&!await o()?iD:null}async function h3(){let{execFile:n}=await import("node:child_process");return new Promise(o=>{n("docker",["ps"],{timeout:1e4},l=>o(!l))})}var C3=2;function B3(n){let o;try{({handEdited:o}=EB(n))}catch(l){if(l instanceof tE)return null;throw l}return o.length===0?null:["Generated files were edited by hand and no longer match service.json:",...o.map(l=>` ${l}`),"Run `tdk config regenerate` to discard the edits, or bypass with `tdk up --ignore-drift`."]}function I3(n,o,l=process.exit){if(o.ignoreDrift){console.warn(b.yellow("Warning: --ignore-drift set; generated files were not checked."));return}let s=B3(n);if(s){o.onDrift?.(s.join(`
|
|
1418
1418
|
`));for(let u of s)console.error(b.red(u));l(C3)}}function y3(n,o,l=gr(),s=process.exit){if(o.ignoreVersion){console.warn(b.yellow("Warning: --ignore-version set; minTdkVersion was not checked."));return}let u=ID(n,l);u.status==="none"||u.status==="ok"||(o.onFail?.(`${u.message}
|
|
1419
|
-
${u.fix}`),console.error(b.red(u.message)),console.error(b.red(u.fix)),s(1))}function Q3(n,o=3e4){return new Promise(l=>{let s=Date.now()+o,u=()=>{let p=g3({host:"127.0.0.1",port:n}),E=!1,B=I=>{E||(E=!0,p.destroy(),I||Date.now()>=s?l(I):setTimeout(u,250))};p.once("connect",()=>B(!0)),p.once("error",()=>B(!1))};u()})}var Rw=new p3("up").description("Start all services (optionally filtered by stack)").alias("deploy").argument("[stack-name]","Name of the stack to start (optional - runs all if omitted)").option("-v, --verbose","Enable verbose output",!1).option("-q, --quiet","Suppress non-essential output",!1).option("--dry-run","Show what would be started without starting",!1).option("-f, --force","Kill existing Tilt process before starting",!1).option("--ignore-drift","Start even if generated files differ from service.json",!1).option("--ignore-version","Start even if this tdk is older than minTdkVersion in .tdk/project.json",!1).option("--only <services...>","Start only these services plus what the Tiltfile enables for them (their dependsOn services and shared infrastructure). With a stack, names must belong to that stack; dependencies may cross stacks").option("--json","Print one JSON object on stdout when the stack is ready or the command fails; implies --quiet",!1).action(async(n,o)=>{let l=o.json?yB("UP_FAILED","tdk up"):void 0;o.json&&(o.quiet=!0);let s=HQ(process.env.TILT_PORT);s.ok||(l?.({ok:!1},[{code:"INVALID_TILT_PORT",message:s.message}]),Uo(s.message));let u=s.port,p=vn();p&&y3(p,{ignoreVersion:o.ignoreVersion,onFail:N=>l?.({ok:!1},[{code:"TDK_VERSION_TOO_OLD",message:N}])});let E=o.dryRun?null:await E3();E&&(l?.({ok:!1},[{code:"HOST_UNSUPPORTED",message:E}]),Uo(E));let B=m3(process.platform,process.env.TDK_ALLOW_NATIVE_WINDOWS);B&&Uo(B);let I=vn();if(I&&Iw(I,{onInvalid:N=>l?.({ok:!1},[{code:"INVALID_SCHEMA_VERSION",message:N}])}),!o.dryRun){let{assertMachineReadyOrExit:N}=await import("./cold-preflight-
|
|
1419
|
+
${u.fix}`),console.error(b.red(u.message)),console.error(b.red(u.fix)),s(1))}function Q3(n,o=3e4){return new Promise(l=>{let s=Date.now()+o,u=()=>{let p=g3({host:"127.0.0.1",port:n}),E=!1,B=I=>{E||(E=!0,p.destroy(),I||Date.now()>=s?l(I):setTimeout(u,250))};p.once("connect",()=>B(!0)),p.once("error",()=>B(!1))};u()})}var Rw=new p3("up").description("Start all services (optionally filtered by stack)").alias("deploy").argument("[stack-name]","Name of the stack to start (optional - runs all if omitted)").option("-v, --verbose","Enable verbose output",!1).option("-q, --quiet","Suppress non-essential output",!1).option("--dry-run","Show what would be started without starting",!1).option("-f, --force","Kill existing Tilt process before starting",!1).option("--ignore-drift","Start even if generated files differ from service.json",!1).option("--ignore-version","Start even if this tdk is older than minTdkVersion in .tdk/project.json",!1).option("--only <services...>","Start only these services plus what the Tiltfile enables for them (their dependsOn services and shared infrastructure). With a stack, names must belong to that stack; dependencies may cross stacks").option("--json","Print one JSON object on stdout when the stack is ready or the command fails; implies --quiet",!1).action(async(n,o)=>{let l=o.json?yB("UP_FAILED","tdk up"):void 0;o.json&&(o.quiet=!0);let s=HQ(process.env.TILT_PORT);s.ok||(l?.({ok:!1},[{code:"INVALID_TILT_PORT",message:s.message}]),Uo(s.message));let u=s.port,p=vn();p&&y3(p,{ignoreVersion:o.ignoreVersion,onFail:N=>l?.({ok:!1},[{code:"TDK_VERSION_TOO_OLD",message:N}])});let E=o.dryRun?null:await E3();E&&(l?.({ok:!1},[{code:"HOST_UNSUPPORTED",message:E}]),Uo(E));let B=m3(process.platform,process.env.TDK_ALLOW_NATIVE_WINDOWS);B&&Uo(B);let I=vn();if(I&&Iw(I,{onInvalid:N=>l?.({ok:!1},[{code:"INVALID_SCHEMA_VERSION",message:N}])}),!o.dryRun){let{assertMachineReadyOrExit:N}=await import("./cold-preflight-2ZV2PDU2.js");await N()}let S=async()=>{let N=o.dryRun?Za():vn(),x=N??process.cwd(),v=Z1(),w,z=[];if((!o.only||n)&&(w=As(v),z=w.map(J=>J.name)),o.only){if(n&&!Dg(n)){let Ge=on.stackNotFound(n,z);l?.({ok:!1},[BB(Ge).error]),Ge.exit()}let J=n?v.filter(Ge=>Ge.stack===n):v,Te=Qw(o.only,J);if(Te.length>0){let Ge=J.map(We=>We.name),Pe=on.unknownServices(Te,Ge);l?.({ok:!1},[{code:"UNKNOWN_SERVICE",message:Pe.message,...Pe.suggestions.length>0?{suggestions:Pe.suggestions}:{}}]),Pe.exit()}}N&&I3(N,{ignoreDrift:o.ignoreDrift,onDrift:J=>l?.({ok:!1},[{code:"DRIFT_DETECTED",message:J}])}),N&&BD(N,{onInvalid:J=>l?.({ok:!1},[{code:"INVALID_SERVICE_CONFIG",message:J}])}),N&&!l&&!o.quiet&&CD(N);let F=await fB(x,{inspectDocker:!o.dryRun});if(!o.dryRun){if(N){let Ge=eE(x);Ge.length>0&&!o.quiet&&console.log(b.gray(`Added ${Ge.join(", ")} to .env (generated; existing values unchanged)`))}N&&!d3(vw(x,".tdk",".tdk-out","Tiltfile"))&&(o.quiet||console.log(b.gray("No generated Tiltfile yet; generating .tdk/.tdk-out/ ...")),await Zu(x,{quiet:o.quiet}));let J=pQ(x);J.length>0&&o.verbose&&!o.quiet&&console.log(b.gray(`Refreshed runtime assets: ${J.join(", ")}`));let Te=SR(x);Te.length>0&&!o.quiet&&console.log(b.gray(`Added ${Te.join(", ")} to the pre_alpha phase in .tdk/project.json`))}let M,ae,he=[];if(n){if(M=v.filter(J=>J.stack===n),M.length===0){let J=on.stackNotFound(n,z);l?.({ok:!1},[BB(J).error]),J.exit()}he=M.map(J=>J.name),ae=`stack "${n}"`}else{M=v;let J=w??As(v);ae=`all stacks (${Jn(J.length,"stack")}, ${Jn(M.length,"service")})`}let Re=[];if(o.only){let J=Sw(o.only,qA());M=J.selected,Re=J.dependencies,he=M.map(Te=>Te.name),ae=`${Jn(o.only.length,"requested service")}${Re.length>0?` plus ${Re.join(", ")}`:""}`}o.verbose&&!o.quiet&&console.log(b.gray(`Found ${Jn(M.length,"service")} in ${ae}`));let Ie=M.map(J=>J.name);if(!o.quiet){console.log(b.blue(`${o.dryRun?"Would start":"Starting"} ${Jn(Ie.length,"service")} from ${ae}...`));for(let We of Ie)console.log(b.gray(` - ${We}`));let{appBase:J,apiBase:Te}=PC(F.ingressHttp),Ge=M.filter(We=>We.config?.appType==="frontend"),Pe=M.filter(We=>cc(We.config?.appType));if(Ge.length>0){console.log(b.blue(`
|
|
1420
1420
|
\u{1F30D} Frontend URLs:`));for(let We of Ge){let ut=We.config?.basePath??`/${We.name}`;console.log(b.gray(` - ${We.name}: ${J}${b.cyan(eQ(ut))}`))}}if(Pe.length>0){console.log(b.blue(`
|
|
1421
1421
|
\u{1F527} Backend API URLs:`));for(let We of Pe){let ut=We.name.replace(/-api$/,""),qe=We.config?.apiPath??`/api/${ut}`,He=We.config?.sablier,$e=He?.enable&&He?.deferStart?b.dim(" (deferred \u2014 starts on first request)"):"";console.log(b.gray(` - ${We.name}: ${Te}${b.cyan(eQ(qe))}${$e}`))}}}let je=o.only??(n?[n]:void 0),Oe=M1(he,{verbose:o.verbose,quiet:o.quiet,force:o.force,focusTargets:je}),be=je?`tilt up ${Oe.join(" ")}`:"tilt up";if(!o.quiet){console.log(b.blue(dD(F)));for(let J of Bw(F))console.log(b.yellow(J));console.log(b.gray("Override with TDK_HTTP_PORT, TDK_HTTPS_PORT, or TDK_POSTGRES_PORT."))}if(l&&o.dryRun){l({ok:!0,dryRun:!0,stack:n??null,services:Ie,...o.only?{requested:o.only,declaredDependencies:Re}:{},command:be});return}if(CB(o,"not starting services",be))return;mD(F),pD(x,F);let ze=ki.tiltUi,Qe=u??ze,Ye=o.only?[...new Set([ze,Qe])]:[Qe],At=[];for(let J of Ye)await fc(J)!==null&&At.push(J);let ke=s2({runningPorts:At,force:o.force,only:!!o.only});if(ke.action==="already-running"){let J=`Environment is already running on port ${ke.ports.join(", ")}.`;l?.({ok:!0,alreadyRunning:!0,tiltUrl:`http://localhost:${ke.ports[0]}`}),o.quiet||console.log(b.green(J));return}if(ke.action==="only-blocked"){let J=`A Tilt is already running on port ${ke.ports.join(", ")}. --only cannot change a running stack's services: run \`tdk down\` first, or pass --force to replace it.`;l?.({ok:!1},[{code:"TILT_ALREADY_RUNNING",message:J}]),Uo(J)}if(o.only)for(let J of At)LI(J);let kt=await c2({configuredPort:u,force:o.force,basePort:ze,findAvailablePort:CR}),at=kt.port;kt.autoSwitched&&!o.quiet&&(console.log(b.yellow(`\u26A0\uFE0F Port ${ze} is already in use`)),console.log(b.blue(`\u{1F504} Auto-switching to port ${at}
|
|
1422
1422
|
`))),process.env.TILT_PORT=at.toString(),await u2({force:o.force,quiet:o.quiet,port:at},{stop:LI,log:J=>console.log(b.yellow(J)),wait:J=>new Promise(Te=>setTimeout(Te,J))}),o.quiet||(console.log(b.gray(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{createRequire as __tdkRequire}from'node:module';const require=__tdkRequire(import.meta.url);
|
|
2
|
-
import{sb as a,tb as b,ub as c,vb as d,wb as e}from"./chunk-
|
|
2
|
+
import{sb as a,tb as b,ub as c,vb as d,wb as e}from"./chunk-SWAGCVPQ.js";import"./chunk-42IVF3YT.js";import"./chunk-6EA4DGCY.js";export{e as assertMachineReadyOrExit,d as formatColdPreflight,a as nodeTooOld,b as requireVerifiedDockerVersions,c as runColdPreflight};
|
package/cli/package.json
CHANGED
|
@@ -85,6 +85,7 @@ load('ext://tdk-cli',
|
|
|
85
85
|
'Watchers',
|
|
86
86
|
'Infra',
|
|
87
87
|
'Docker',
|
|
88
|
+
'FrontendBuildPlan',
|
|
88
89
|
'load_ui_enhancements',
|
|
89
90
|
'APP_RESOURCES',
|
|
90
91
|
'GLOBAL_CONFIG_EXPORT',
|
|
@@ -266,6 +267,13 @@ for _KNOWN_SVC in _app_resources_list:
|
|
|
266
267
|
_KNOWN_TILT_RESOURCES.add(_KNOWN_RES_NAME)
|
|
267
268
|
_KNOWN_TILT_RESOURCES.add(_KNOWN_RES_NAME + '-run-only')
|
|
268
269
|
_KNOWN_TILT_RESOURCES.add(_KNOWN_RES_NAME + '-config-gen')
|
|
270
|
+
# A frontend whose build script is the standard `tsc && vite build` gets a
|
|
271
|
+
# non-blocking <service>-typecheck resource (see Docker frontend registration).
|
|
272
|
+
# Name it here, from the same plan and path, so focus mode can enable it.
|
|
273
|
+
if _KNOWN_RES.get('frontend', False) and not should_enable('backends-only'):
|
|
274
|
+
_KNOWN_RES_DIR = PROJECT_ROOT + '/' + _KNOWN_RES.get('_resource_path', _KNOWN_SVC.get('path', '') + '/' + _KNOWN_RES_NAME)
|
|
275
|
+
if FrontendBuildPlan(_KNOWN_RES_DIR + '/package.json')['typecheck']:
|
|
276
|
+
_KNOWN_TILT_RESOURCES.add(_KNOWN_RES_NAME + '-typecheck')
|
|
269
277
|
_KNOWN_RES_MANIFEST = _KNOWN_RES.get('_manifest', {})
|
|
270
278
|
_KNOWN_RES_SABLIER = _KNOWN_RES_MANIFEST.get('sablier', {})
|
|
271
279
|
# Mirrors _register_single_resource: the prebuild only exists for
|
|
@@ -280,6 +288,8 @@ if FOCUS_MODE and FOCUS_ENABLED_RESOURCES:
|
|
|
280
288
|
for _R in FOCUS_ENABLED_RESOURCES:
|
|
281
289
|
if _R in _KNOWN_TILT_RESOURCES:
|
|
282
290
|
_FILTERED_RESOURCES.append(_R)
|
|
291
|
+
if _R + '-typecheck' in _KNOWN_TILT_RESOURCES:
|
|
292
|
+
_FILTERED_RESOURCES.append(_R + '-typecheck')
|
|
283
293
|
# Focus expansion normally resolves stack names to concrete
|
|
284
294
|
# resources before this loop, so the stack branch below is not
|
|
285
295
|
# reached for the common `tdk up <stack>` path. Keep a deferred
|
|
@@ -301,6 +311,8 @@ if FOCUS_MODE and FOCUS_ENABLED_RESOURCES:
|
|
|
301
311
|
# enabled name it cannot find.
|
|
302
312
|
if _STACK_RES_NAME + '-image' in _DEFERRED_IMAGE_RESOURCES:
|
|
303
313
|
_FILTERED_RESOURCES.append(_STACK_RES_NAME + '-image')
|
|
314
|
+
if _STACK_RES_NAME + '-typecheck' in _KNOWN_TILT_RESOURCES:
|
|
315
|
+
_FILTERED_RESOURCES.append(_STACK_RES_NAME + '-typecheck')
|
|
304
316
|
else:
|
|
305
317
|
_MATCHED = [kr for kr in _KNOWN_TILT_RESOURCES if kr != 'service-discovery-daemon' and kr.startswith(_R + '-')]
|
|
306
318
|
_FILTERED_RESOURCES.extend(_MATCHED)
|
package/engine/Tiltfile
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
load('./topologies/tilt/common/utils.star', _Utils='Utils')
|
|
14
14
|
load('./topologies/tilt/discovery/loading.star', _Manifest='Manifest')
|
|
15
15
|
load('./topologies/tilt/config/global.star', _Config='Config')
|
|
16
|
+
load('./topologies/platform/docker/build/frontend_build_plan.star', _frontend_build_plan='frontend_build_plan')
|
|
16
17
|
|
|
17
18
|
# Registry
|
|
18
19
|
load('./topologies/tilt/discovery/registry.star',
|
|
@@ -49,6 +50,7 @@ load('./topologies/tilt/resources/orchestrator/apply_compose_resource_registrati
|
|
|
49
50
|
Utils = _Utils
|
|
50
51
|
Manifest = _Manifest
|
|
51
52
|
Config = _Config
|
|
53
|
+
FrontendBuildPlan = _frontend_build_plan
|
|
52
54
|
|
|
53
55
|
# Registry Data
|
|
54
56
|
GLOBAL_CONFIG_EXPORT = _GLOBAL_CONFIG_EXPORT
|
|
@@ -81,13 +81,13 @@ for repo in $REPOS; do
|
|
|
81
81
|
while IFS= read -r row; do
|
|
82
82
|
[[ -z "$row" ]] && continue
|
|
83
83
|
if (( i < KEEP_COUNT )); then
|
|
84
|
-
((i
|
|
84
|
+
((++i))
|
|
85
85
|
continue
|
|
86
86
|
fi
|
|
87
87
|
image_id="$(awk '{print $3}' <<< "$row")"
|
|
88
88
|
tag="$(awk '{print $2}' <<< "$row")"
|
|
89
89
|
TO_DELETE+=("$image_id|$repo:$tag")
|
|
90
|
-
((i
|
|
90
|
+
((++i))
|
|
91
91
|
done <<< "$repo_blob"
|
|
92
92
|
done
|
|
93
93
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# 🏗️ TILT SDK - FRONTEND BUILD PLAN
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Decides how a frontend image runs its production build.
|
|
5
|
+
#
|
|
6
|
+
# A `"build": "tsc --noEmit && vite build"` script (the restaurant example uses it). Running that script
|
|
7
|
+
# inside the image build makes the type-check block the image and compete for
|
|
8
|
+
# CPU with other builds. When the script has exactly that standard shape, the
|
|
9
|
+
# image runs `vite build` directly and the type-check becomes a separate,
|
|
10
|
+
# non-blocking Tilt resource. Any other script runs unchanged.
|
|
11
|
+
# =============================================================================
|
|
12
|
+
|
|
13
|
+
DEFAULT_FRONTEND_BUILD_CMD = 'bun run build'
|
|
14
|
+
|
|
15
|
+
# Only a non-emitting type-check is moved out of the image. A plain `tsc` writes output that the build may
|
|
16
|
+
# use (the CLI scaffold's tsconfig emits to ./dist), so that script keeps running unchanged in the image.
|
|
17
|
+
_TSC_FORMS = ['tsc --noEmit']
|
|
18
|
+
# The generated config is copied into the image; any other config file is not, so a script that selects one is not used.
|
|
19
|
+
_IMAGE_CONFIG_DIR = '.autogenerated/'
|
|
20
|
+
_VITE_BUILD = 'vite build'
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _default_plan():
|
|
24
|
+
return {'build_cmd': DEFAULT_FRONTEND_BUILD_CMD, 'typecheck': False, 'typecheck_cmd': ''}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def frontend_build_plan(package_json_path):
|
|
28
|
+
"""Returns {'build_cmd', 'typecheck', 'typecheck_cmd'} for the package.json at package_json_path.
|
|
29
|
+
|
|
30
|
+
build_cmd is the command the image runs; the generated Vite config is appended to it.
|
|
31
|
+
typecheck is True only when the standard `tsc --noEmit && vite build` form was recognised;
|
|
32
|
+
typecheck_cmd is then the host command for the non-blocking type-check resource.
|
|
33
|
+
A missing or unreadable package.json, or any other script, gets the default plan.
|
|
34
|
+
"""
|
|
35
|
+
if not os.path.exists(package_json_path):
|
|
36
|
+
return _default_plan()
|
|
37
|
+
|
|
38
|
+
scripts = read_json(package_json_path).get('scripts', {})
|
|
39
|
+
script = scripts.get('build', '').strip()
|
|
40
|
+
steps = script.split(' && ')
|
|
41
|
+
if len(steps) != 2:
|
|
42
|
+
return _default_plan()
|
|
43
|
+
|
|
44
|
+
typecheck_step = steps[0].strip()
|
|
45
|
+
vite_step = steps[1].strip()
|
|
46
|
+
if typecheck_step not in _TSC_FORMS:
|
|
47
|
+
return _default_plan()
|
|
48
|
+
if vite_step != _VITE_BUILD and not vite_step.startswith(_VITE_BUILD + ' '):
|
|
49
|
+
return _default_plan()
|
|
50
|
+
|
|
51
|
+
# Flags after `vite build` are kept. A --config must name the generated config, which the image copies.
|
|
52
|
+
extra_args = vite_step[len(_VITE_BUILD):]
|
|
53
|
+
tokens = extra_args.split()
|
|
54
|
+
for i, token in enumerate(tokens):
|
|
55
|
+
value = ''
|
|
56
|
+
if token == '--config' and i + 1 < len(tokens):
|
|
57
|
+
value = tokens[i + 1]
|
|
58
|
+
elif token.startswith('--config='):
|
|
59
|
+
value = token[len('--config='):]
|
|
60
|
+
else:
|
|
61
|
+
continue
|
|
62
|
+
if not value.startswith(_IMAGE_CONFIG_DIR):
|
|
63
|
+
return _default_plan()
|
|
64
|
+
|
|
65
|
+
return {'build_cmd': 'bunx vite build' + extra_args, 'typecheck': True, 'typecheck_cmd': 'bunx tsc --noEmit'}
|
|
@@ -2,7 +2,64 @@
|
|
|
2
2
|
# 🏗️ TILT SDK - GOLDEN IMAGE BUILDERS
|
|
3
3
|
# =============================================================================
|
|
4
4
|
|
|
5
|
-
load('./golden_image_constants.star', 'GOLDEN_DOCKERFILE', 'GOLDEN_IMAGE_PREFIX')
|
|
5
|
+
load('./golden_image_constants.star', 'GOLDEN_DOCKERFILE', 'GOLDEN_IMAGE_PREFIX', 'GOLDEN_LAYERS')
|
|
6
|
+
|
|
7
|
+
# Label that records which golden Dockerfile an image was built from.
|
|
8
|
+
GOLDEN_HASH_LABEL = 'tdk.golden.hash'
|
|
9
|
+
|
|
10
|
+
# Shell template for the golden build. Placeholders (@@...@@) are replaced in
|
|
11
|
+
# build_golden_layers(); plain `$VAR` references are expanded by the shell.
|
|
12
|
+
_GOLDEN_BUILD_TEMPLATE = '''
|
|
13
|
+
DF_REL=@@DF_REL@@
|
|
14
|
+
ROOT_REL=@@ROOT_REL@@
|
|
15
|
+
DF="$(cd "$(dirname "$DF_REL")" && pwd)/$(basename "$DF_REL")"
|
|
16
|
+
ROOT="$(cd "$ROOT_REL" && pwd)"
|
|
17
|
+
HASH="$(cat "$DF" | (sha256sum 2>/dev/null || shasum -a 256) | cut -c1-64)"
|
|
18
|
+
IMAGES="@@IMAGES@@"
|
|
19
|
+
|
|
20
|
+
if [ -z "$TDK_GOLDEN_REBUILD" ]; then
|
|
21
|
+
fresh=1
|
|
22
|
+
for img in $IMAGES; do
|
|
23
|
+
[ "$(docker image inspect -f '{{index .Config.Labels "@@HASH_LABEL@@"}}' "$img" 2>/dev/null)" = "$HASH" ] || fresh=0
|
|
24
|
+
done
|
|
25
|
+
if [ "$fresh" = 1 ]; then
|
|
26
|
+
echo "✅ Golden images are up to date (hash $HASH) - skipping build"
|
|
27
|
+
exit 0
|
|
28
|
+
fi
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
echo "🏗️ Building golden layered images (@@COUNT@@ total)..."
|
|
32
|
+
if docker buildx version >/dev/null 2>&1; then
|
|
33
|
+
echo " 🧩 Building all golden targets with one docker buildx bake (independent stages run in parallel)"
|
|
34
|
+
cat > golden-layers.bake.hcl <<HCL
|
|
35
|
+
variable "HASH" {
|
|
36
|
+
default = ""
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
group "default" {
|
|
40
|
+
targets = [@@TARGET_NAMES@@]
|
|
41
|
+
}
|
|
42
|
+
@@BAKE_TARGETS@@
|
|
43
|
+
HCL
|
|
44
|
+
# Buildx 0.19 and later ask for read access outside the bake file's directory; older releases do not know the flag.
|
|
45
|
+
BUILDX_VER="$(docker buildx version 2>/dev/null | sed -n 's/.* v\\([0-9]*\\)\\.\\([0-9]*\\).*/\\1 \\2/p')"
|
|
46
|
+
BUILDX_MAJOR="${BUILDX_VER%% *}"
|
|
47
|
+
BUILDX_MINOR="${BUILDX_VER##* }"
|
|
48
|
+
BAKE_ALLOW=""
|
|
49
|
+
if [ "${BUILDX_MAJOR:-0}" -gt 0 ] || [ "${BUILDX_MINOR:-0}" -ge 19 ]; then BAKE_ALLOW="--allow fs.read=$ROOT"; fi
|
|
50
|
+
HASH="$HASH" docker buildx bake $BAKE_ALLOW -f golden-layers.bake.hcl --load
|
|
51
|
+
else
|
|
52
|
+
echo " ⚠️ docker buildx is not available - building golden targets one at a time"
|
|
53
|
+
@@SERIAL_BUILDS@@
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
echo "✅ Golden layers built (@@COUNT@@ images):"
|
|
57
|
+
@@SUMMARY@@
|
|
58
|
+
'''
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _sh_quote(text):
|
|
62
|
+
return "'" + text.replace("'", "'\\''") + "'"
|
|
6
63
|
|
|
7
64
|
|
|
8
65
|
def build_golden_layers(project_root='.'):
|
|
@@ -16,63 +73,62 @@ def build_golden_layers(project_root='.'):
|
|
|
16
73
|
is itself project-root-relative, so it must be prefixed with this to
|
|
17
74
|
resolve correctly - passing project_root='.' (the default) only works
|
|
18
75
|
when the Tiltfile happens to live at the project root.
|
|
76
|
+
|
|
77
|
+
The build is skipped when every golden image already exists with a
|
|
78
|
+
`tdk.golden.hash` label matching the current Dockerfile. Set
|
|
79
|
+
TDK_GOLDEN_REBUILD=1 to force a rebuild. Otherwise all targets are built
|
|
80
|
+
with one `docker buildx bake`, falling back to serial `docker build` when
|
|
81
|
+
buildx is not installed.
|
|
19
82
|
"""
|
|
20
83
|
resource_name = 'golden-layers-build'
|
|
21
84
|
dockerfile_from_tiltfile = (
|
|
22
85
|
GOLDEN_DOCKERFILE if project_root in (None, '.', '')
|
|
23
86
|
else project_root.rstrip('/') + '/' + GOLDEN_DOCKERFILE
|
|
24
87
|
)
|
|
88
|
+
context = project_root or '.'
|
|
25
89
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
echo "
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
echo " ✓ {prefix}-l4-frontend:{tag}"
|
|
65
|
-
echo " ✓ {prefix}-l4-migrator:{tag}"
|
|
66
|
-
""".format(
|
|
67
|
-
dockerfile=dockerfile_from_tiltfile,
|
|
68
|
-
prefix=GOLDEN_IMAGE_PREFIX,
|
|
69
|
-
tag='latest',
|
|
70
|
-
context=project_root,
|
|
71
|
-
).strip()
|
|
90
|
+
images = []
|
|
91
|
+
summary = []
|
|
92
|
+
bake_targets = []
|
|
93
|
+
serial_builds = []
|
|
94
|
+
target_names = []
|
|
95
|
+
for key in GOLDEN_LAYERS:
|
|
96
|
+
layer = GOLDEN_LAYERS[key]
|
|
97
|
+
ref = layer['name'] + ':' + layer['tag']
|
|
98
|
+
images.append(ref)
|
|
99
|
+
summary.append('echo " ✓ ' + ref + '"')
|
|
100
|
+
target_names.append('"' + key + '"')
|
|
101
|
+
bake_targets.append('''target "{key}" {{
|
|
102
|
+
dockerfile = "$DF"
|
|
103
|
+
context = "$ROOT"
|
|
104
|
+
target = "{target}"
|
|
105
|
+
tags = ["{ref}"]
|
|
106
|
+
labels = {{
|
|
107
|
+
"{label}" = HASH
|
|
108
|
+
}}
|
|
109
|
+
}}
|
|
110
|
+
'''.format(key=key, target=layer['target'], ref=ref, label=GOLDEN_HASH_LABEL))
|
|
111
|
+
serial_builds.append(
|
|
112
|
+
'docker build --label "{label}=$HASH" -f "$DF" --target {target} -t {ref} "$ROOT" || exit 1'.format(
|
|
113
|
+
label=GOLDEN_HASH_LABEL, target=layer['target'], ref=ref,
|
|
114
|
+
)
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
cmd = (_GOLDEN_BUILD_TEMPLATE
|
|
118
|
+
.replace('@@DF_REL@@', _sh_quote(dockerfile_from_tiltfile))
|
|
119
|
+
.replace('@@ROOT_REL@@', _sh_quote(context))
|
|
120
|
+
.replace('@@IMAGES@@', ' '.join(images))
|
|
121
|
+
.replace('@@HASH_LABEL@@', GOLDEN_HASH_LABEL)
|
|
122
|
+
.replace('@@COUNT@@', str(len(images)))
|
|
123
|
+
.replace('@@TARGET_NAMES@@', ', '.join(target_names))
|
|
124
|
+
.replace('@@BAKE_TARGETS@@', '\n'.join(bake_targets))
|
|
125
|
+
.replace('@@SERIAL_BUILDS@@', '\n '.join(serial_builds))
|
|
126
|
+
.replace('@@SUMMARY@@', '\n'.join(summary))
|
|
127
|
+
)
|
|
72
128
|
|
|
73
129
|
local_resource(
|
|
74
130
|
resource_name,
|
|
75
|
-
cmd=
|
|
131
|
+
cmd=cmd,
|
|
76
132
|
labels=['infra.docker', 'golden-layers'],
|
|
77
133
|
deps=[dockerfile_from_tiltfile],
|
|
78
134
|
allow_parallel=True,
|
|
@@ -172,8 +172,10 @@ def L3_generate_frontend_builder(res_path, build_cmd = RUNTIME_CONFIG["bun"]["ba
|
|
|
172
172
|
# Args passed after the script name are appended to the end of the script
|
|
173
173
|
# command, so they reach `vite build` while any preceding steps in the
|
|
174
174
|
# script (e.g. `tsc --noEmit &&`) still run.
|
|
175
|
+
# A build script that already names a config (the CLI scaffold does) keeps its own; a second --config is not added.
|
|
176
|
+
config_flag = "" if "--config" in build_cmd else " --config " + AUTOGENERATED_CONFIG_PATHS['vite_build']
|
|
175
177
|
parts.append(
|
|
176
|
-
"RUN " + build_cmd +
|
|
178
|
+
"RUN " + build_cmd + config_flag + "\n"
|
|
177
179
|
)
|
|
178
180
|
return "".join(parts)
|
|
179
181
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# 🏗️ TILT SDK - BUILD CONCURRENCY
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Sets Tilt's maximum parallel updates from the Docker engine's CPU count and
|
|
5
|
+
# memory, instead of Tilt's default, so a warm `tdk up` on a machine with spare
|
|
6
|
+
# capacity builds more than three images at once.
|
|
7
|
+
#
|
|
8
|
+
# Override with TDK_MAX_PARALLEL_BUILDS=<positive integer>.
|
|
9
|
+
# =============================================================================
|
|
10
|
+
|
|
11
|
+
MIN_PARALLEL_BUILDS = 3
|
|
12
|
+
MAX_PARALLEL_BUILDS = 8
|
|
13
|
+
# CPUs kept free for Tilt, the Traefik/Postgres containers and the host.
|
|
14
|
+
RESERVED_CPUS = 2
|
|
15
|
+
# Rough peak memory per concurrent image build (Vite and tsc dominate).
|
|
16
|
+
BUILD_MEMORY_BUDGET_BYTES = 1610612736 # 1.5 GiB
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _is_positive_int(text):
|
|
20
|
+
return len(text) > 0 and text.isdigit() and int(text) > 0
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _engine_resources():
|
|
24
|
+
"""Returns (cpus, memory_bytes) from `docker info`, or None when unavailable."""
|
|
25
|
+
out = str(local(
|
|
26
|
+
"docker info --format '{{.NCPU}} {{.MemTotal}}' 2>/dev/null || true",
|
|
27
|
+
quiet=True,
|
|
28
|
+
echo_off=True,
|
|
29
|
+
)).strip()
|
|
30
|
+
parts = out.split(' ')
|
|
31
|
+
if len(parts) != 2 or not parts[0].isdigit() or not parts[1].isdigit():
|
|
32
|
+
return None
|
|
33
|
+
return (int(parts[0]), int(parts[1]))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def compute_max_parallel_builds(cpus, memory_bytes):
|
|
37
|
+
"""The concurrency for an engine with `cpus` CPUs and `memory_bytes` of memory."""
|
|
38
|
+
by_cpu = cpus - RESERVED_CPUS
|
|
39
|
+
by_memory = memory_bytes // BUILD_MEMORY_BUDGET_BYTES
|
|
40
|
+
return max(MIN_PARALLEL_BUILDS, min(MAX_PARALLEL_BUILDS, min(by_cpu, by_memory)))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def configure_build_concurrency():
|
|
44
|
+
"""Calls update_settings once with the chosen max_parallel_updates. Call at Tiltfile load."""
|
|
45
|
+
override = os.environ.get('TDK_MAX_PARALLEL_BUILDS', '').strip()
|
|
46
|
+
if _is_positive_int(override):
|
|
47
|
+
value = int(override)
|
|
48
|
+
print("🧮 Parallel builds: " + str(value) + " (TDK_MAX_PARALLEL_BUILDS)")
|
|
49
|
+
else:
|
|
50
|
+
resources = _engine_resources()
|
|
51
|
+
if resources == None:
|
|
52
|
+
print("🧮 Parallel builds: Tilt default (docker info unavailable, so the engine's CPU and memory could not be read)")
|
|
53
|
+
return
|
|
54
|
+
value = compute_max_parallel_builds(resources[0], resources[1])
|
|
55
|
+
print("🧮 Parallel builds: " + str(value) + " (from Docker engine: " + str(resources[0]) + " CPUs)")
|
|
56
|
+
update_settings(max_parallel_updates=value)
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
# =============================================================================
|
|
22
22
|
|
|
23
23
|
load("../common/utils_debug.star", "debug_log")
|
|
24
|
+
load("./build_concurrency.star", "configure_build_concurrency")
|
|
24
25
|
load("../../platform/docker/constants.star", "PlatformDockerConstants")
|
|
25
26
|
load("../../platform/docker/compose/traefik_standalone.star", "generate_standalone_traefik_compose")
|
|
26
27
|
load("../../platform/docker/networking/sablier_container_cycle.star", "sablier_middleware_suffix")
|
|
@@ -442,6 +443,9 @@ def load_all_infrastructure(should_enable, fix_docker_networks_fn=None, docker_p
|
|
|
442
443
|
if should_enable('monitoring') and should_enable('elk'):
|
|
443
444
|
fail("Incompatible flags: 'monitoring' and 'elk' cannot both be enabled at the same time. Disable one of them.")
|
|
444
445
|
|
|
446
|
+
# Size Tilt's parallel image builds to the Docker engine before any build is queued
|
|
447
|
+
configure_build_concurrency()
|
|
448
|
+
|
|
445
449
|
# Build golden image before other infrastructure (if enabled)
|
|
446
450
|
golden_image_resource = None
|
|
447
451
|
if docker_provider and write_fn:
|