@stacksjs/stx 0.2.230 → 0.2.231
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/{chunk-wbegam4r.js → chunk-18e804vq.js} +1 -1
- package/dist/{chunk-0939bnyw.js → chunk-39hy7f4g.js} +2 -2
- package/dist/{chunk-8m0p3v0e.js → chunk-3h7exkbb.js} +1 -1
- package/dist/{chunk-x7rf15d3.js → chunk-4j0fwfej.js} +1 -1
- package/dist/{chunk-9ny96ccv.js → chunk-4xzmg2xk.js} +1 -1
- package/dist/{chunk-apk45qqk.js → chunk-58at6vf3.js} +1 -1
- package/dist/{chunk-rfpg019d.js → chunk-5n44cxqv.js} +1 -1
- package/dist/{chunk-x8w319bf.js → chunk-6k9e6vfx.js} +2 -2
- package/dist/{chunk-paz6f4m5.js → chunk-7hdjf2d8.js} +1 -1
- package/dist/chunk-7qx5ebq7.js +3 -0
- package/dist/{chunk-en8ajb6b.js → chunk-7vj34efv.js} +1 -1
- package/dist/{chunk-vy3brhf3.js → chunk-8hdb7abn.js} +1 -1
- package/dist/{chunk-1tmhht43.js → chunk-8tekg302.js} +1 -1
- package/dist/{chunk-cddj2p27.js → chunk-8tth46zf.js} +1 -1
- package/dist/{chunk-t7zk4x6s.js → chunk-8ybja3e1.js} +1 -1
- package/dist/{chunk-40rqwfqt.js → chunk-ayv6vby2.js} +1 -1
- package/dist/{chunk-p13ggd30.js → chunk-b72rxkbf.js} +1 -1
- package/dist/{chunk-8309r1ea.js → chunk-d729yxzx.js} +1 -1
- package/dist/{chunk-h1jzzy6t.js → chunk-dn8x6vf7.js} +268 -268
- package/dist/{chunk-n4ecxe8x.js → chunk-e63m9jhd.js} +2 -2
- package/dist/{chunk-7918r5qc.js → chunk-f0yhv8yr.js} +1 -1
- package/dist/{chunk-zd7bn188.js → chunk-fk4waw6p.js} +1 -1
- package/dist/{chunk-s3x1p8ff.js → chunk-h2fq4ksg.js} +1 -1
- package/dist/{chunk-jrcm4vzs.js → chunk-h9z3rfk8.js} +1 -1
- package/dist/{chunk-y8g3d192.js → chunk-ht4wqwr6.js} +1 -1
- package/dist/{chunk-764km47e.js → chunk-hwvzkhbe.js} +1 -1
- package/dist/{chunk-4bbyk43z.js → chunk-jewcmcaf.js} +1 -1
- package/dist/{chunk-hkn78n7a.js → chunk-k4ejba6b.js} +1 -1
- package/dist/{chunk-5fy1k8m0.js → chunk-kf2w2xxb.js} +1 -1
- package/dist/{chunk-rfky5t3a.js → chunk-pq6rgbbw.js} +1 -1
- package/dist/{chunk-dedefnzd.js → chunk-pw21r03f.js} +1 -1
- package/dist/{chunk-akh7aqh0.js → chunk-q9v240z7.js} +1 -1
- package/dist/{chunk-a0a7vmgm.js → chunk-r1ym4dxv.js} +1 -1
- package/dist/{chunk-p58b19t0.js → chunk-sc3bz0z7.js} +1 -1
- package/dist/{chunk-cges9wnq.js → chunk-smr28g8g.js} +1 -1
- package/dist/{chunk-dk06jv4n.js → chunk-t13jx2p3.js} +1 -1
- package/dist/{chunk-g3qcyeb1.js → chunk-t7had6e0.js} +1 -1
- package/dist/{chunk-c4a2kfj0.js → chunk-tgcbjer0.js} +1 -1
- package/dist/{chunk-4j8vpk72.js → chunk-ty6pj7b5.js} +72 -72
- package/dist/{chunk-zbsnkmne.js → chunk-v4rgwxs1.js} +1 -1
- package/dist/{chunk-erwwmzym.js → chunk-vmx4f37f.js} +1 -1
- package/dist/{chunk-v7fsv3wn.js → chunk-x7v6xqz9.js} +1 -1
- package/dist/{chunk-n2fhxh9a.js → chunk-zs9j4xyx.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/misc-directives.d.ts +8 -3
- package/dist/misc-directives.js +71 -2
- package/dist/page-action.d.ts +1 -1
- package/dist/page-action.js +4 -1
- package/dist/process.js +1 -1
- package/dist/production-server.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/signal-processing.js +1 -1
- package/dist/ssg.js +2 -2
- package/dist/ssr.js +15 -15
- package/dist/utils.js +6 -2
- package/package.json +5 -5
- package/dist/chunk-nwxd1jee.js +0 -3
package/dist/ssr.js
CHANGED
|
@@ -92,6 +92,14 @@ function parseCookies(cookieHeader) {
|
|
|
92
92
|
function serializeCookie(name, value, options = {}) {
|
|
93
93
|
return serializeSetCookie(name, value, options);
|
|
94
94
|
}
|
|
95
|
+
function copyContextHeaders(from, into) {
|
|
96
|
+
for (const cookie of from.getSetCookie())
|
|
97
|
+
into.append("Set-Cookie", cookie);
|
|
98
|
+
from.forEach((value, key) => {
|
|
99
|
+
if (key.toLowerCase() !== "set-cookie")
|
|
100
|
+
into.set(key, value);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
95
103
|
function generateCsrfToken() {
|
|
96
104
|
return crypto.randomBytes(32).toString("hex");
|
|
97
105
|
}
|
|
@@ -146,9 +154,7 @@ export async function render(template, data = {}, options = {}) {
|
|
|
146
154
|
"Content-Type": "text/html; charset=utf-8"
|
|
147
155
|
});
|
|
148
156
|
if (options.ctx)
|
|
149
|
-
options.ctx.responseHeaders
|
|
150
|
-
headers.set(key, value);
|
|
151
|
-
});
|
|
157
|
+
copyContextHeaders(options.ctx.responseHeaders, headers);
|
|
152
158
|
return new Response(html, { headers });
|
|
153
159
|
}
|
|
154
160
|
export function createApp(config = {}) {
|
|
@@ -179,11 +185,11 @@ export function createApp(config = {}) {
|
|
|
179
185
|
return null;
|
|
180
186
|
}
|
|
181
187
|
async function createContext(request, params) {
|
|
182
|
-
const url = new URL(request.url), cookies = parseCookies(request.headers.get("Cookie")), responseHeaders = new Headers
|
|
188
|
+
const url = new URL(request.url), cookies = parseCookies(request.headers.get("Cookie")), responseHeaders = new Headers;
|
|
183
189
|
let sessionId = cookies[sessionCookieName];
|
|
184
190
|
if (!sessionId) {
|
|
185
191
|
sessionId = generateSessionId();
|
|
186
|
-
|
|
192
|
+
responseHeaders.append("Set-Cookie", serializeCookie(sessionCookieName, sessionId, {
|
|
187
193
|
httpOnly: !0,
|
|
188
194
|
secure: url.protocol === "https:",
|
|
189
195
|
sameSite: "Lax",
|
|
@@ -201,7 +207,8 @@ export function createApp(config = {}) {
|
|
|
201
207
|
url.searchParams.forEach((value, key) => {
|
|
202
208
|
query[key] = value;
|
|
203
209
|
});
|
|
204
|
-
const errors = session.flash("_errors") || {}, oldInput = session.flash("_old_input") || {}
|
|
210
|
+
const errors = session.flash("_errors") || {}, oldInput = session.flash("_old_input") || {};
|
|
211
|
+
return {
|
|
205
212
|
request,
|
|
206
213
|
url,
|
|
207
214
|
params,
|
|
@@ -222,7 +229,7 @@ export function createApp(config = {}) {
|
|
|
222
229
|
return await request.json();
|
|
223
230
|
},
|
|
224
231
|
setCookie(name, value, options = {}) {
|
|
225
|
-
|
|
232
|
+
responseHeaders.append("Set-Cookie", serializeCookie(name, value, options));
|
|
226
233
|
},
|
|
227
234
|
flash(key, value) {
|
|
228
235
|
session.flash(key, value);
|
|
@@ -240,11 +247,6 @@ export function createApp(config = {}) {
|
|
|
240
247
|
return session.get("user");
|
|
241
248
|
}
|
|
242
249
|
};
|
|
243
|
-
if (cookiesToSet.length > 0)
|
|
244
|
-
cookiesToSet.forEach((cookie) => {
|
|
245
|
-
responseHeaders.append("Set-Cookie", cookie);
|
|
246
|
-
});
|
|
247
|
-
return ctx;
|
|
248
250
|
}
|
|
249
251
|
const csrfMiddleware = async (ctx, next) => {
|
|
250
252
|
if (["GET", "HEAD", "OPTIONS"].includes(ctx.request.method))
|
|
@@ -271,9 +273,7 @@ export function createApp(config = {}) {
|
|
|
271
273
|
};
|
|
272
274
|
try {
|
|
273
275
|
const response = await next();
|
|
274
|
-
ctx.responseHeaders
|
|
275
|
-
response.headers.set(key, value);
|
|
276
|
-
});
|
|
276
|
+
copyContextHeaders(ctx.responseHeaders, response.headers);
|
|
277
277
|
return response;
|
|
278
278
|
} catch (error) {
|
|
279
279
|
errorLogger.log(error instanceof Error ? error : Error(String(error)), { handler: "request" }, "error");
|
package/dist/utils.js
CHANGED
|
@@ -581,7 +581,8 @@ ${triedPaths.map((p) => ` - ${p}`).join(`
|
|
|
581
581
|
"__importedComponents",
|
|
582
582
|
COMPONENT_CLIENT_FACTORIES_CONTEXT_KEY,
|
|
583
583
|
"__stx_client_signal_names",
|
|
584
|
-
"__stxServeContext"
|
|
584
|
+
"__stxServeContext",
|
|
585
|
+
"__stx_scope_seq"
|
|
585
586
|
]), filteredParentContext = {};
|
|
586
587
|
for (const [key, val] of Object.entries(parentContext))
|
|
587
588
|
if (!key.startsWith("__") || internalKeysToPreserve.has(key))
|
|
@@ -700,7 +701,10 @@ ${triedPaths.map((p) => ` - ${p}`).join(`
|
|
|
700
701
|
preservedExpressions.add(match[1].trim());
|
|
701
702
|
if (preservedExpressions.size > 0)
|
|
702
703
|
parentContext.__stx_preserved_client_expressions = [...preservedExpressions];
|
|
703
|
-
const
|
|
704
|
+
const scopeSeq = parentContext.__stx_scope_seq ??= {
|
|
705
|
+
n: 0,
|
|
706
|
+
key: Bun.hash(String(parentContext.__filename ?? parentFilePath)).toString(36).slice(0, 6)
|
|
707
|
+
}, scopeId = `stx_${baseName.replace(/[^a-zA-Z0-9]/g, "_")}_${++scopeSeq.n}_${scopeSeq.key}`;
|
|
704
708
|
let output = result;
|
|
705
709
|
if (hasSignalScripts) {
|
|
706
710
|
let propsJson = "";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.231",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,12 +117,12 @@
|
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@cwcss/crosswind": "^0.2.14",
|
|
119
119
|
"@stacksjs/clapp": "^0.2.0",
|
|
120
|
-
"@stacksjs/desktop": "0.2.
|
|
121
|
-
"@stacksjs/sanitizer": "0.2.
|
|
120
|
+
"@stacksjs/desktop": "0.2.231",
|
|
121
|
+
"@stacksjs/sanitizer": "0.2.231",
|
|
122
122
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
123
|
-
"bun-plugin-stx": "0.2.
|
|
123
|
+
"bun-plugin-stx": "0.2.231",
|
|
124
124
|
"bunfig": "^0.15.17",
|
|
125
|
-
"stx-router": "0.2.
|
|
125
|
+
"stx-router": "0.2.231",
|
|
126
126
|
"ts-broadcasting": "^0.0.9",
|
|
127
127
|
"ts-images": "^0.2.11",
|
|
128
128
|
"ts-syntax-highlighter": "^0.2.1"
|
package/dist/chunk-nwxd1jee.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Bg as b,Kg as JJ,yg as o,zg as e}from"./chunk-c4a2kfj0.js";import{Nm as m,Om as l,ap as g,fm as y,gm as P,lq as t,pm as v,wm as x}from"./chunk-h1jzzy6t.js";import{Pt as a,qu as s,uu as OJ}from"./chunk-bqdbf8k2.js";import{Eu as R}from"./chunk-q891e1vj.js";import r from"fs";import B from"path";var{serve:IJ}=globalThis.Bun;function q(J,K,Q={}){let X=`${encodeURIComponent(J)}=${encodeURIComponent(K)}`;if(Q.maxAge!==void 0)X+=`; Max-Age=${Q.maxAge}`;if(Q.expires)X+=`; Expires=${Q.expires.toUTCString()}`;if(Q.path)X+=`; Path=${Q.path}`;if(Q.domain)X+=`; Domain=${Q.domain}`;if(Q.secure)X+="; Secure";if(Q.httpOnly)X+="; HttpOnly";if(Q.sameSite)X+=`; SameSite=${Q.sameSite}`;return X}async function KJ(J){let K=J.headers.get("content-type")||"",Q={},X=(Z,G)=>{let $=Q[Z];if($===void 0)Q[Z]=G;else if(Array.isArray($))$.push(G);else Q[Z]=[$,G]};if(K.includes("multipart/form-data")){let Z=await J.formData();for(let[G,$]of Z.entries())if(typeof $==="string")X(G,$);return Q}if(K.includes("application/x-www-form-urlencoded")){for(let[Z,G]of new URLSearchParams(await J.text()).entries())X(Z,G);return Q}return Q}function f(J){if(!J)return!1;let K=J.toUpperCase();return K!=="GET"&&K!=="HEAD"}async function h(J,K={}){let Q=K.request,X=K.method??Q?.method;if(!Q||!f(X))return{ran:!1};if(typeof J.action!=="function")return{ran:!1};let Z={};try{Z=await KJ(Q)}catch{}let G=await J.action({request:Q,form:Z,params:K.params??{},query:J.query??{},cookies:K.cookies??{}});if(G&&typeof G==="object"){let $=G,W=QJ($.cookies),I=$.redirect;if(typeof I==="string"&&I)return{redirect:I,ran:!0,...W.length>0?{cookies:W}:{}};let{cookies:_,redirect:w,...U}=$;if(Object.assign(J,U),W.length>0)return{ran:!0,cookies:W}}return{ran:!0}}function QJ(J){if(!J||typeof J!=="object"||Array.isArray(J))return[];let K=[];for(let[Q,X]of Object.entries(J)){if(!Q)continue;if(typeof X==="string"){K.push(q(Q,X));continue}if(X&&typeof X==="object"){let Z=X;if(typeof Z.value!=="string")continue;K.push(q(Q,Z.value,Z))}}return K}function u(J,K=[]){let Q=new Headers({Location:J,"Cache-Control":"no-store"});for(let X of K)Q.append("Set-Cookie",X);return new Response(null,{status:303,headers:Q})}async function HJ(J,K={}){return(await c(J,K)).html}async function d(J,K={}){let{html:Q,context:X,redirect:Z,cookies:G}=await c(J,K),$=m(X),W=l(X);if(Z)return{html:Q,redirect:Z,cookies:G,status:$,headers:W};let{extractStreamBoundaries:I}=await import("./chunk-hkn78n7a.js"),_=I(X),w=J.streamTemplates;if(w&&Object.keys(w).length>0){let{processDirectives:U}=await import("./chunk-rfpg019d.js"),{defaultConfig:z}=await import("./chunk-erwwmzym.js"),O=X.streamBoundaries||{},N={...z,autoShell:!1},L=Object.keys(w).map((V)=>({id:V,render:async()=>{let D=typeof O[V]==="function"?await O[V]():void 0;return U(w[V],{...X,$boundary:D},J.sourceFile,N,new Set)}})),E=new Set(L.map((V)=>V.id));_=[...(_||[]).filter((V)=>!E.has(V.id)),...L]}return{html:Q,boundaries:_&&_.length>0?_:void 0,cookies:G,status:$,headers:W}}async function c(J,K){let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...K};if(!J.hasServerScripts&&!P(J.html))return{html:J.html,context:Q};for(let G of J.serverScriptContent)try{await g(G,Q,J.sourceFile)}catch($){console.warn(`[stx] Server script error in ${J.sourceFile}:`,$)}let X=await h(Q,{request:K.request,method:K.method,params:K.params??{},cookies:K.cookies??{}});if(X.redirect)return{html:J.html,context:Q,redirect:X.redirect,cookies:X.cookies};if(!P(J.html))return{html:J.html,context:Q,cookies:X.cookies};let Z=new Map;for(let[G,$]of Object.entries(J.placeholders))if($.expression)try{let W=x($.expression,Q);if($.type==="raw")Z.set(G,W!==void 0&&W!==null?String(W):"");else Z.set(G,W!==void 0&&W!==null?v(String(W)):"")}catch{Z.set(G,"")}return{html:y(J.html,Z),context:Q,cookies:X.cookies}}async function SJ(J,K={}){if(!J.hasServerScripts&&!P(J.fragment))return J.fragment;let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...K};for(let Z of J.serverScriptContent)try{await g(Z,Q,J.sourceFile)}catch(G){console.warn(`[stx] Server script error in ${J.sourceFile}:`,G)}if(!P(J.fragment))return J.fragment;let X=new Map;for(let[Z,G]of Object.entries(J.placeholders))if(G.expression)try{let $=x(G.expression,Q);if(G.type==="raw")X.set(Z,$!==void 0&&$!==null?String($):"");else X.set(Z,$!==void 0&&$!==null?v(String($)):"")}catch{X.set(Z,"")}return y(J.fragment,X)}OJ();import C from"zlib";import{promisify as n}from"util";var XJ=n(C.brotliCompress),ZJ=n(C.gzip),$J=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],GJ=["text/event-stream","multipart/x-mixed-replace"],UJ=1024;function WJ(J){if(!J)return!1;let K=J.toLowerCase();if(GJ.some((Q)=>K.startsWith(Q)))return!1;return $J.some((Q)=>K.startsWith(Q))}function YJ(J){let K=new Map;for(let Q of J.split(",")){let[X,...Z]=Q.trim().split(";"),G=X.trim().toLowerCase();if(!G)continue;let $=1;for(let W of Z){let I=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(W);if(!I)continue;let _=Number.parseFloat(I[1]);if(Number.isFinite(_))$=_}K.set(G,$)}return K}function jJ(J){if(!J)return null;let K=YJ(J),Q=K.get("*"),X=(Z)=>K.get(Z)??Q??0;if(X("br")>0)return"br";if(X("gzip")>0)return"gzip";return null}async function i(J,K,Q={}){if(K.headers.get("content-encoding"))return K;if(K.status===204||K.status===304||!K.body)return K;if(!WJ(K.headers.get("content-type")))return K;let X=jJ(J.headers.get("accept-encoding"));if(!X)return K;let Z;try{Z=new Uint8Array(await K.arrayBuffer())}catch{return K}let G=()=>new Response(Z,{status:K.status,statusText:K.statusText,headers:p(K.headers)});if(Z.length<(Q.threshold??UJ))return G();try{let $=X==="br"?await XJ(Z,{params:{[C.constants.BROTLI_PARAM_QUALITY]:Q.quality??5,[C.constants.BROTLI_PARAM_SIZE_HINT]:Z.length}}):await ZJ(Z);if($.length>=Z.length)return G();let W=p(K.headers);return W.set("Content-Encoding",X),W.set("Content-Length",String($.length)),new Response($,{status:K.status,statusText:K.statusText,headers:W})}catch{return G()}}function p(J){let K=new Headers(J),Q=K.get("Vary");if(!Q)return K.set("Vary","Accept-Encoding"),K;if(!Q.split(",").some((Z)=>Z.trim().toLowerCase()==="accept-encoding"))K.set("Vary",`${Q}, Accept-Encoding`);return K}var _J={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function uJ(J={}){let K=B.resolve(J.outputDir||".output"),Q=J.port||3000,X=JJ(K);if(!X)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${X.routes.length} routes...`);let Z=new Map,G=new Map,$=new Map,W=new Map;for(let U of X.routes)try{let z=B.join(K,U.compiledPath),O=JSON.parse(await Bun.file(z).text());Z.set(U.pattern,O),$.set(U.pattern,s(O.html)),W.set(U.pattern,t(O.html));let N=B.join(K,U.fragmentPath);if(await Bun.file(N).exists())G.set(U.pattern,await Bun.file(N).text())}catch(z){console.warn(`[stx] Failed to load route ${U.pattern}:`,z)}let I=new Map,_=[];for(let U of X.routes)if(U.hasParams){let{regex:z,params:O}=a(U.pattern);_.push({regex:z,route:U,paramNames:O})}else I.set(U.pattern,U);let w=IJ({port:Q,async fetch(U){return i(U,await(async()=>{let O=new URL(U.url).pathname;if(J.onRequest){let Y=await J.onRequest(U);if(Y)return Y}if(J.apiRoutes?.[O])return J.apiRoutes[O](U);if((U.method==="GET"||U.method==="HEAD")&&O!=="/"){let Y=B.resolve(K,"public"),j;try{j=decodeURIComponent(O)}catch{j=O}if(!j.includes("\x00")){let F=B.resolve(Y,`.${j}`);if(F===Y||F.startsWith(`${Y}${B.sep}`))try{if(r.existsSync(F)&&r.statSync(F).isFile()){let S=B.extname(F).toLowerCase(),A=_J[S]||"application/octet-stream",M=O.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(O);return new Response(Bun.file(F),{headers:{"Content-Type":A,"Cache-Control":M?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let N=e(U),L=null,E={};if(L=I.get(O)||null,!L)for(let{regex:Y,route:j,paramNames:F}of _){let H=O.match(Y);if(H){L=j,F.forEach((S,A)=>{E[S]=H[A+1]});break}}if(!L){let Y=I.get("/404")||null;if(Y){let j=Z.get(Y.pattern);if(j)return new Response(j.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}if(N){let Y=G.get(L.pattern);if(Y){let j=$.get(L.pattern);return new Response(Y,{headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...W.has(L.pattern)?{"X-STX-Runtime":W.get(L.pattern)?"true":"false"}:{},...j?{"X-STX-Layout":j.layout,"X-STX-Layout-Group":j.group}:{},...b(),"Cache-Control":o}})}}let V=f(U.method),D=Z.get(L.pattern);if(!D){let Y=I.get("/500")||null;if(Y){let j=Z.get(Y.pattern);if(j)return new Response(j.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(!V&&!D.hasServerScripts&&Object.keys(D.placeholders).length===0)return new Response(D.html,{status:D.status??200,headers:{"Content-Type":"text/html",...b(),"Cache-Control":"public, max-age=60"}});try{let{html:Y,boundaries:j,redirect:F,cookies:H,status:S,headers:A}=await d(D,{params:E,request:U,method:U.method});if(F)return u(F,H);if(j&&j.length>0){let{renderStreamingPage:T,streamToResponse:k}=await import("./chunk-hkn78n7a.js");return k(T(Y,j,{timeoutMs:30000}),{status:S??D.status??200,headers:{"Cache-Control":"no-cache",...A}})}let M=new Headers({"Content-Type":"text/html",...b(),"Cache-Control":"no-cache"});for(let T of H??[])M.append("Set-Cookie",T);for(let[T,k]of Object.entries(A??{}))M.set(T,k);return new Response(Y,{status:S??D.status??200,headers:M})}catch(Y){return console.error(`[stx] Hydration error for ${O}:`,Y),new Response(D.html,{headers:{"Content-Type":"text/html"}})}})())}});return console.log(`[stx] Production server running at http://localhost:${Q}`),console.log(`[stx] Serving ${X.routes.length} routes (${Z.size} pre-loaded)`),{port:Q,stop:()=>w.stop()}}
|
|
3
|
-
export{WJ as jg,jJ as kg,i as lg,q as mg,KJ as ng,f as og,h as pg,u as qg,HJ as rg,d as sg,SJ as tg,uJ as ug};
|