@absolutejs/absolute 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/core/build.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -142,6 +142,6 @@ d;a.rel="stylesheet";for(a.dataset.precedence=l=e[m++];f=e[m++];)a.setAttribute(
|
|
|
142
142
|
t,u,""),w.bind(null,t,u,"Resource failed to load"))};$RR("`),kN=P(`$RM=new Map;
|
|
143
143
|
$RR=function(t,u,y){function v(n){this._p=null;n()}for(var w=$RC,p=$RM,q=new Map,r=document,g,b,h=r.querySelectorAll("link[data-precedence],style[data-precedence]"),x=[],k=0;b=h[k++];)"not all"===b.getAttribute("media")?x.push(b):("LINK"===b.tagName&&p.set(b.getAttribute("href"),b),q.set(b.dataset.precedence,g=b));b=0;h=[];var l,a;for(k=!0;;){if(k){var e=y[b++];if(!e){k=!1;b=0;continue}var c=!1,m=0;var d=e[m++];if(a=p.get(d)){var f=a._p;c=!0}else{a=r.createElement("link");a.href=
|
|
144
144
|
d;a.rel="stylesheet";for(a.dataset.precedence=l=e[m++];f=e[m++];)a.setAttribute(f,e[m++]);f=a._p=new Promise(function(n,z){a.onload=v.bind(a,n);a.onerror=v.bind(a,z)});p.set(d,a)}d=a.getAttribute("media");!f||d&&!matchMedia(d).matches||h.push(f);if(c)continue}else{a=x[b++];if(!a)break;l=a.getAttribute("data-precedence");a.removeAttribute("media")}c=q.get(l)||g;c===g&&(g=a);q.set(l,a);c?c.parentNode.insertBefore(a,c.nextSibling):(c=r.head,c.insertBefore(a,c.firstChild))}Promise.all(h).then(w.bind(null,
|
|
145
|
-
t,u,""),w.bind(null,t,u,"Resource failed to load"))};$RR("`),p$=P('$RR("'),H2=P('","'),w2=P('",'),W2=P('"'),D2=P(")</script>");P('<template data-rci="" data-bid="'),P('<template data-rri="" data-bid="'),P('" data-sid="'),P('" data-sty="');var z2=P('$RX=function(b,c,d,e,f){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),f&&(a.cstck=f),b._reactRetry&&b._reactRetry())};;$RX("'),GL=P('$RX("'),iG=P('"'),NL=P(","),l$=P(")</script>");P('<template data-rxi="" data-bid="'),P('" data-dgst="'),P('" data-msg="'),P('" data-stck="'),P('" data-cstck="');var i$=/[<\u2028\u2029]/g,n$=/[&><\u2028\u2029]/g,s$=P('<style media="not all" data-precedence="'),o$=P('" data-href="'),a$=P('">'),r$=P("</style>"),MG=!1,nG=!0,VL=[],t$=P('<style data-precedence="'),e$=P('" data-href="'),MY=P(" "),sG=P('">'),A2=P("</style>"),UY=P("["),MB=P(",["),E0=P(","),yN=P("]"),pI=0,UG=1,IG=2,oG=3,aG=/[<>\r\n]/g,JM=/["';,\r\n]/g,LG=Function.prototype.bind,rG=Symbol.for("react.client.reference"),UI={};Object.freeze(UI);var UB={},lI=null,BG={},qB={},vL=new Set,GG=new Set,iI=new Set,H0=new Set,fN=new Set,NG=new Set,VI=new Set,IY=new Set,w0=new Set,bN={enqueueSetState:function(M,I,G){var N=M._reactInternals;N.queue===null?LN(M,"setState"):(N.queue.push(I),G!==void 0&&G!==null&&uI(G))},enqueueReplaceState:function(M,I,G){M=M._reactInternals,M.replace=!0,M.queue=[I],G!==void 0&&G!==null&&uI(G)},enqueueForceUpdate:function(M,I){M._reactInternals.queue===null?LN(M,"forceUpdate"):I!==void 0&&I!==null&&uI(I)}},LY={id:1,overflow:""},$G=Math.clz32?Math.clz32:pB,BY=Math.log,GY=Math.LN2,IB=Error("Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`."),YG=null,hN=typeof Object.is==="function"?Object.is:G$,$L=null,XG=null,ZG=null,tG=null,eG=null,jM=null,RG=!1,EG=!1,W0=0,D0=0,HG=-1,wG=0,z0=null,eM=null,vI=0,gM=!1,A0,WG={readContext:GN,use:function(M){if(M!==null&&typeof M==="object"){if(typeof M.then==="function")return YN(M);if(M.$$typeof===c0)return GN(M)}throw Error("An unsupported type was passed to use(): "+String(M))},useContext:function(M){return A0="useContext",IL(),M._currentValue},useMemo:$N,useReducer:sB,useRef:function(M){$L=IL(),jM=BN();var I=jM.memoizedState;return I===null?(M={current:M},Object.seal(M),jM.memoizedState=M):I},useState:function(M){return A0="useState",sB(NN,M)},useInsertionEffect:g0,useLayoutEffect:g0,useCallback:function(M,I){return $N(function(){return M},I)},useImperativeHandle:g0,useEffect:g0,useDebugValue:g0,useDeferredValue:function(M,I){return IL(),I!==void 0?I:M},useTransition:function(){return IL(),[!1,AY]},useId:function(){var M=XG.treeContext,I=M.overflow;M=M.id,M=(M&~(1<<32-$G(M)-1)).toString(32)+I;var G=CL;if(G===null)throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component.");return I=W0++,M="\xAB"+G.idPrefix+"R"+M,0<I&&(M+="H"+I.toString(32)),M+"\xBB"},useSyncExternalStore:function(M,I,G){if(G===void 0)throw Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.");return G()},useOptimistic:function(M){return IL(),[M,pL]},useActionState:q0,useFormState:q0,useHostTransitionStatus:function(){return IL(),fG},useMemoCache:function(M){for(var I=Array(M),G=0;G<M;G++)I[G]=QM;return I},useCacheRefresh:function(){return XN}},CL=null,_M=null,NY={getCacheForType:function(){throw Error("Not implemented.")},getOwner:function(){return _M===null?null:_M.componentStack}},K0=0,mN,dN,SN,uN,cN,U,L;HB.__reactDisabledLog=!0;var B,$,X=!1,E=new(typeof WeakMap==="function"?WeakMap:Map),D={"react-stack-bottom-frame":function(M,I,G){return M(I,G)}},A=D["react-stack-bottom-frame"].bind(D),T={"react-stack-bottom-frame":function(M){return M.render()}},K=T["react-stack-bottom-frame"].bind(T),g={"react-stack-bottom-frame":function(M){var I=M._init;return I(M._payload)}},v=g["react-stack-bottom-frame"].bind(g),y=0;if(typeof performance==="object"&&typeof performance.now==="function")var b=performance,J=function(){return b.now()};else{var LM=Date;J=function(){return LM.now()}}var t=4,p=0,l=1,XU=2,S=5,GM=14,OM=null,_U={},MU={},UU={},dM={},AI=!1,cU=!1,WM=!1;Y0(),Y0(),P6.prerender=function(M,I){return new Promise(function(G,N){var Y=I?I.onHeaders:void 0,Z;Y&&(Z=function(V){Y(new Headers(V))});var H=ML(I?I.identifierPrefix:void 0,I?I.unstable_externalRuntimeSrc:void 0,I?I.bootstrapScriptContent:void 0,I?I.bootstrapScripts:void 0,I?I.bootstrapModules:void 0),w=WB(M,H,PI(H,void 0,I?I.unstable_externalRuntimeSrc:void 0,I?I.importMap:void 0,Z,I?I.maxHeadersLength:void 0),xU(I?I.namespaceURI:void 0),I?I.progressiveChunkSize:void 0,I?I.onError:void 0,function(){var V={prelude:new ReadableStream({type:"bytes",pull:function(_){$$(w,_)},cancel:function(_){w.destination=null,oL(w,_)}},{highWaterMark:0})};G(V)},void 0,void 0,N,I?I.onPostpone:void 0);if(I&&I.signal){var O=I.signal;if(O.aborted)oL(w,O.reason);else{var z=function(){oL(w,O.reason),O.removeEventListener("abort",z)};O.addEventListener("abort",z)}}DN(w)})},P6.renderToReadableStream=function(M,I){return new Promise(function(G,N){var Y,Z,H=new Promise(function(C,j){Z=C,Y=j}),w=I?I.onHeaders:void 0,O;w&&(O=function(C){w(new Headers(C))});var z=ML(I?I.identifierPrefix:void 0,I?I.unstable_externalRuntimeSrc:void 0,I?I.bootstrapScriptContent:void 0,I?I.bootstrapScripts:void 0,I?I.bootstrapModules:void 0),V=wB(M,z,PI(z,I?I.nonce:void 0,I?I.unstable_externalRuntimeSrc:void 0,I?I.importMap:void 0,O,I?I.maxHeadersLength:void 0),xU(I?I.namespaceURI:void 0),I?I.progressiveChunkSize:void 0,I?I.onError:void 0,Z,function(){var C=new ReadableStream({type:"bytes",pull:function(j){$$(V,j)},cancel:function(j){V.destination=null,oL(V,j)}},{highWaterMark:0});C.allReady=H,G(C)},function(C){H.catch(function(){}),N(C)},Y,I?I.onPostpone:void 0,I?I.formState:void 0);if(I&&I.signal){var _=I.signal;if(_.aborted)oL(V,_.reason);else{var q=function(){oL(V,_.reason),_.removeEventListener("abort",q)};_.addEventListener("abort",q)}}DN(V)})},P6.version="19.1.0"})()});var t2=IN((T6)=>{var j6=YB(a2(),1),_6=YB(r2(),1),WY,wY;WY=j6,wY=_6;T6.version=WY.version;T6.renderToString=WY.renderToString;T6.renderToStaticMarkup=WY.renderToStaticMarkup;T6.renderToReadableStream=wY.renderToReadableStream;if(wY.resume)T6.resume=wY.resume});var y6=60,F2=1000,J2=60000,f6=60,b6=24,h6=86400000,XY=2,p2=3000;import{rm as i2,mkdir as RY,writeFile as E6}from"fs/promises";import{join as bI,basename as H6}from"path";import{cwd as w6,exit as W6}from"process";var{$:V2,build:D6,Glob:ZY}=globalThis.Bun;import{readFile as X6,writeFile as Z6}from"fs/promises";var{Glob:R6}=globalThis.Bun;var l2=async(IM,zM)=>{let KM=new R6("*.html"),NM=[];for await(let BM of KM.scan({cwd:zM,absolute:!0}))NM.push(BM);for(let BM of NM){let $M=await X6(BM,"utf8");for(let[bM,RM]of Object.entries(IM)){let FM=bM.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),iM=new RegExp(`(<script[^>]+src=["'])(/?(?:.*\\/)?${FM})(?:\\.[^."'/]+)?(\\.js)(["'][^>]*>)`,"g");$M=$M.replace(iM,(W,x,u,F,P)=>{return`${x}${RM}${P}`})}await Z6(BM,$M,"utf8")}};var n2=async({buildDir:IM="build",assetsDir:zM="src/backend/assets",reactIndexDir:KM,javascriptDir:NM,typeScriptDir:BM,reactPagesDir:$M,htmlDir:bM}={})=>{let RM=performance.now();console.log("Building start"),console.log("Creating build directory");let FM=w6(),iM=bI(FM,IM),W=bI(FM,zM),x=KM&&bI(FM,KM),u=NM&&bI(FM,NM),F=BM&&bI(FM,BM),P=$M&&bI(FM,$M),bU=bM&&bI(FM,bM);console.log("Cleaning build directory"),await i2(iM,{force:!0,recursive:!0}),await RY(iM),
|
|
145
|
+
t,u,""),w.bind(null,t,u,"Resource failed to load"))};$RR("`),p$=P('$RR("'),H2=P('","'),w2=P('",'),W2=P('"'),D2=P(")</script>");P('<template data-rci="" data-bid="'),P('<template data-rri="" data-bid="'),P('" data-sid="'),P('" data-sty="');var z2=P('$RX=function(b,c,d,e,f){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),f&&(a.cstck=f),b._reactRetry&&b._reactRetry())};;$RX("'),GL=P('$RX("'),iG=P('"'),NL=P(","),l$=P(")</script>");P('<template data-rxi="" data-bid="'),P('" data-dgst="'),P('" data-msg="'),P('" data-stck="'),P('" data-cstck="');var i$=/[<\u2028\u2029]/g,n$=/[&><\u2028\u2029]/g,s$=P('<style media="not all" data-precedence="'),o$=P('" data-href="'),a$=P('">'),r$=P("</style>"),MG=!1,nG=!0,VL=[],t$=P('<style data-precedence="'),e$=P('" data-href="'),MY=P(" "),sG=P('">'),A2=P("</style>"),UY=P("["),MB=P(",["),E0=P(","),yN=P("]"),pI=0,UG=1,IG=2,oG=3,aG=/[<>\r\n]/g,JM=/["';,\r\n]/g,LG=Function.prototype.bind,rG=Symbol.for("react.client.reference"),UI={};Object.freeze(UI);var UB={},lI=null,BG={},qB={},vL=new Set,GG=new Set,iI=new Set,H0=new Set,fN=new Set,NG=new Set,VI=new Set,IY=new Set,w0=new Set,bN={enqueueSetState:function(M,I,G){var N=M._reactInternals;N.queue===null?LN(M,"setState"):(N.queue.push(I),G!==void 0&&G!==null&&uI(G))},enqueueReplaceState:function(M,I,G){M=M._reactInternals,M.replace=!0,M.queue=[I],G!==void 0&&G!==null&&uI(G)},enqueueForceUpdate:function(M,I){M._reactInternals.queue===null?LN(M,"forceUpdate"):I!==void 0&&I!==null&&uI(I)}},LY={id:1,overflow:""},$G=Math.clz32?Math.clz32:pB,BY=Math.log,GY=Math.LN2,IB=Error("Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`."),YG=null,hN=typeof Object.is==="function"?Object.is:G$,$L=null,XG=null,ZG=null,tG=null,eG=null,jM=null,RG=!1,EG=!1,W0=0,D0=0,HG=-1,wG=0,z0=null,eM=null,vI=0,gM=!1,A0,WG={readContext:GN,use:function(M){if(M!==null&&typeof M==="object"){if(typeof M.then==="function")return YN(M);if(M.$$typeof===c0)return GN(M)}throw Error("An unsupported type was passed to use(): "+String(M))},useContext:function(M){return A0="useContext",IL(),M._currentValue},useMemo:$N,useReducer:sB,useRef:function(M){$L=IL(),jM=BN();var I=jM.memoizedState;return I===null?(M={current:M},Object.seal(M),jM.memoizedState=M):I},useState:function(M){return A0="useState",sB(NN,M)},useInsertionEffect:g0,useLayoutEffect:g0,useCallback:function(M,I){return $N(function(){return M},I)},useImperativeHandle:g0,useEffect:g0,useDebugValue:g0,useDeferredValue:function(M,I){return IL(),I!==void 0?I:M},useTransition:function(){return IL(),[!1,AY]},useId:function(){var M=XG.treeContext,I=M.overflow;M=M.id,M=(M&~(1<<32-$G(M)-1)).toString(32)+I;var G=CL;if(G===null)throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component.");return I=W0++,M="\xAB"+G.idPrefix+"R"+M,0<I&&(M+="H"+I.toString(32)),M+"\xBB"},useSyncExternalStore:function(M,I,G){if(G===void 0)throw Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.");return G()},useOptimistic:function(M){return IL(),[M,pL]},useActionState:q0,useFormState:q0,useHostTransitionStatus:function(){return IL(),fG},useMemoCache:function(M){for(var I=Array(M),G=0;G<M;G++)I[G]=QM;return I},useCacheRefresh:function(){return XN}},CL=null,_M=null,NY={getCacheForType:function(){throw Error("Not implemented.")},getOwner:function(){return _M===null?null:_M.componentStack}},K0=0,mN,dN,SN,uN,cN,U,L;HB.__reactDisabledLog=!0;var B,$,X=!1,E=new(typeof WeakMap==="function"?WeakMap:Map),D={"react-stack-bottom-frame":function(M,I,G){return M(I,G)}},A=D["react-stack-bottom-frame"].bind(D),T={"react-stack-bottom-frame":function(M){return M.render()}},K=T["react-stack-bottom-frame"].bind(T),g={"react-stack-bottom-frame":function(M){var I=M._init;return I(M._payload)}},v=g["react-stack-bottom-frame"].bind(g),y=0;if(typeof performance==="object"&&typeof performance.now==="function")var b=performance,J=function(){return b.now()};else{var LM=Date;J=function(){return LM.now()}}var t=4,p=0,l=1,XU=2,S=5,GM=14,OM=null,_U={},MU={},UU={},dM={},AI=!1,cU=!1,WM=!1;Y0(),Y0(),P6.prerender=function(M,I){return new Promise(function(G,N){var Y=I?I.onHeaders:void 0,Z;Y&&(Z=function(V){Y(new Headers(V))});var H=ML(I?I.identifierPrefix:void 0,I?I.unstable_externalRuntimeSrc:void 0,I?I.bootstrapScriptContent:void 0,I?I.bootstrapScripts:void 0,I?I.bootstrapModules:void 0),w=WB(M,H,PI(H,void 0,I?I.unstable_externalRuntimeSrc:void 0,I?I.importMap:void 0,Z,I?I.maxHeadersLength:void 0),xU(I?I.namespaceURI:void 0),I?I.progressiveChunkSize:void 0,I?I.onError:void 0,function(){var V={prelude:new ReadableStream({type:"bytes",pull:function(_){$$(w,_)},cancel:function(_){w.destination=null,oL(w,_)}},{highWaterMark:0})};G(V)},void 0,void 0,N,I?I.onPostpone:void 0);if(I&&I.signal){var O=I.signal;if(O.aborted)oL(w,O.reason);else{var z=function(){oL(w,O.reason),O.removeEventListener("abort",z)};O.addEventListener("abort",z)}}DN(w)})},P6.renderToReadableStream=function(M,I){return new Promise(function(G,N){var Y,Z,H=new Promise(function(C,j){Z=C,Y=j}),w=I?I.onHeaders:void 0,O;w&&(O=function(C){w(new Headers(C))});var z=ML(I?I.identifierPrefix:void 0,I?I.unstable_externalRuntimeSrc:void 0,I?I.bootstrapScriptContent:void 0,I?I.bootstrapScripts:void 0,I?I.bootstrapModules:void 0),V=wB(M,z,PI(z,I?I.nonce:void 0,I?I.unstable_externalRuntimeSrc:void 0,I?I.importMap:void 0,O,I?I.maxHeadersLength:void 0),xU(I?I.namespaceURI:void 0),I?I.progressiveChunkSize:void 0,I?I.onError:void 0,Z,function(){var C=new ReadableStream({type:"bytes",pull:function(j){$$(V,j)},cancel:function(j){V.destination=null,oL(V,j)}},{highWaterMark:0});C.allReady=H,G(C)},function(C){H.catch(function(){}),N(C)},Y,I?I.onPostpone:void 0,I?I.formState:void 0);if(I&&I.signal){var _=I.signal;if(_.aborted)oL(V,_.reason);else{var q=function(){oL(V,_.reason),_.removeEventListener("abort",q)};_.addEventListener("abort",q)}}DN(V)})},P6.version="19.1.0"})()});var t2=IN((T6)=>{var j6=YB(a2(),1),_6=YB(r2(),1),WY,wY;WY=j6,wY=_6;T6.version=WY.version;T6.renderToString=WY.renderToString;T6.renderToStaticMarkup=WY.renderToStaticMarkup;T6.renderToReadableStream=wY.renderToReadableStream;if(wY.resume)T6.resume=wY.resume});var y6=60,F2=1000,J2=60000,f6=60,b6=24,h6=86400000,XY=2,p2=3000;import{rm as i2,mkdir as RY,writeFile as E6}from"fs/promises";import{join as bI,basename as H6}from"path";import{cwd as w6,exit as W6}from"process";var{$:V2,build:D6,Glob:ZY}=globalThis.Bun;import{readFile as X6,writeFile as Z6}from"fs/promises";var{Glob:R6}=globalThis.Bun;var l2=async(IM,zM)=>{let KM=new R6("*.html"),NM=[];for await(let BM of KM.scan({cwd:zM,absolute:!0}))NM.push(BM);for(let BM of NM){let $M=await X6(BM,"utf8");for(let[bM,RM]of Object.entries(IM)){let FM=bM.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),iM=new RegExp(`(<script[^>]+src=["'])(/?(?:.*\\/)?${FM})(?:\\.[^."'/]+)?(\\.js)(["'][^>]*>)`,"g");$M=$M.replace(iM,(W,x,u,F,P)=>{return`${x}${RM}${P}`})}await Z6(BM,$M,"utf8")}};var n2=async({buildDir:IM="build",assetsDir:zM="src/backend/assets",reactIndexDir:KM,javascriptDir:NM,typeScriptDir:BM,reactPagesDir:$M,htmlDir:bM}={})=>{let RM=performance.now();console.log("Building start"),console.log("Creating build directory");let FM=w6(),iM=bI(FM,IM),W=bI(FM,zM),x=KM&&bI(FM,KM),u=NM&&bI(FM,NM),F=BM&&bI(FM,BM),P=$M&&bI(FM,$M),bU=bM&&bI(FM,bM);console.log("Cleaning build directory"),await i2(iM,{force:!0,recursive:!0}),await RY(iM),P&&x&&await A6(P,x);let mL=new ZY("*.{tsx,jsx}"),nU=[];for await(let h of mL.scan({absolute:!0,cwd:x}))nU.push(h);let AL=new ZY("*.js"),nM=[];for await(let h of AL.scan({absolute:!0,cwd:u}))nM.push(h);let XB=new ZY("*.ts"),c=[];for await(let h of XB.scan({absolute:!0,cwd:F}))c.push(h);let AU=nU.concat(nM).concat(c);console.log("Entry points",AU),console.log("Building entry points");let{logs:hI,outputs:P0}=await D6({entrypoints:AU,format:"esm",naming:"[dir]/[name].[hash].[ext]",outdir:iM}).catch((h)=>{console.error("Build failed:",h),W6(1)});hI.forEach((h)=>{if(h.level==="error")console.error(h);else if(h.level==="warning")console.warn(h);else if(h.level==="info"||h.level==="debug")console.info(h)}),console.log("Copying assets to build directory"),await z6(W,iM,FM),console.log("Generating manifest");let AM=P0.reduce((h,TM)=>{let QU=TM.path;if(QU.startsWith(iM))QU=QU.slice(iM.length);QU=QU.replace(/^\/+/,"");let PI=QU.split("/").pop();if(!PI)return h;let ML=`.${TM.hash}.`;if(!PI.includes(ML))throw new Error(`Expected hash delimiter ${ML} in ${PI}`);let[TI]=PI.split(ML);return h[TI]="/"+QU,h},{});bU&&await l2(AM,bU);let RI=performance.now()-RM,EI;if(RI<F2)EI=`${RI.toFixed(XY)}ms`;else if(RI<J2)EI=`${(RI/F2).toFixed(XY)}s`;else EI=`${(RI/J2).toFixed(XY)}m`;return console.log(`Build completed in ${EI}`),AM},z6=async(IM,zM,KM)=>{await V2`cp -R ${IM} ${zM}`,await RY(bI(zM,"html")),await RY(bI(zM,"htmx")),await V2`cp -R ${bI(KM,"example/html")} ${bI(zM)}`,await V2`cp -R ${bI(KM,"example/htmx")} ${bI(zM)}`},A6=async(IM,zM)=>{console.log("Generating React index files"),await i2(zM,{force:!0,recursive:!0}),await RY(zM);let KM=new ZY("*.*"),NM=[];for await(let $M of KM.scan({cwd:IM}))NM.push($M);let BM=NM.map(async($M)=>{let bM=H6($M),[RM]=bM.split("."),FM=["import { hydrateRoot } from 'react-dom/client';",`import { ${RM} } from '../pages/${RM}';
|
|
146
146
|
`,`hydrateRoot(document, <${RM} />);`].join(`
|
|
147
147
|
`);return E6(bI(zM,`${RM}Index.tsx`),FM)});await Promise.all(BM)};var e2=YB(tN(),1),M6=YB(t2(),1),W4=async(IM,zM)=>{let KM=e2.createElement(IM),NM=await M6.renderToReadableStream(KM,{bootstrapModules:[zM]});return new Response(NM,{headers:{"Content-Type":"text/html"}})},D4=(IM)=>Bun.file(IM);import{argv as q6}from"process";var{env:I6}=globalThis.Bun;import C6 from"os";var U6=()=>{let IM=C6.networkInterfaces(),KM=Object.values(IM).flat().filter((NM)=>NM!==void 0).find((NM)=>NM.family==="IPv4"&&!NM.internal);if(KM)return KM.address;return console.warn("No IP address found, falling back to localhost"),"localhost"};var k2=I6.HOST??"localhost",DY=I6.PORT??p2,L6,g6=q6,B6=g6.includes("--host");if(B6)L6=U6(),k2="0.0.0.0";var F4=(IM)=>IM.listen({hostname:k2,port:DY},()=>{if(B6)console.log(`Server started on http://localhost:${DY}`),console.log(`Server started on network: http://${L6}:${DY}`);else console.log(`Server started on http://${k2}:${DY}`)});var v4=await n2();export{l2 as updateScriptTags,F4 as networkingPlugin,W4 as handleReactPageRequest,D4 as handleHTMLPageRequest,U6 as getLocalIPAddress,n2 as build,XY as TIME_PRECISION,y6 as SECONDS_IN_A_MINUTE,f6 as MINUTES_IN_AN_HOUR,F2 as MILLISECONDS_IN_A_SECOND,J2 as MILLISECONDS_IN_A_MINUTE,h6 as MILLISECONDS_IN_A_DAY,b6 as HOURS_IN_A_DAY,p2 as DEFAULT_PORT};
|
package/package.json
CHANGED
package/src/core/build.ts
CHANGED
|
@@ -49,7 +49,6 @@ export const build = async ({
|
|
|
49
49
|
await rm(buildDirAbsolute, { force: true, recursive: true });
|
|
50
50
|
await mkdir(buildDirAbsolute);
|
|
51
51
|
|
|
52
|
-
console.log("Generating React index files");
|
|
53
52
|
reactPagesDirAbsolute &&
|
|
54
53
|
reactIndexDirAbsolute &&
|
|
55
54
|
(await generateReactIndexFiles(
|
|
@@ -173,6 +172,8 @@ const generateReactIndexFiles = async (
|
|
|
173
172
|
reactPagesDirAbsolute: string,
|
|
174
173
|
reactIndexDirAbsolute: string
|
|
175
174
|
) => {
|
|
175
|
+
console.log("Generating React index files");
|
|
176
|
+
|
|
176
177
|
await rm(reactIndexDirAbsolute, { force: true, recursive: true });
|
|
177
178
|
await mkdir(reactIndexDirAbsolute);
|
|
178
179
|
|