@stacksjs/stx 0.2.564 → 0.2.566
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-ezdsaxbb.js → chunk-01s01ten.js} +3 -3
- package/dist/chunk-04qvjcsr.js +2 -0
- package/dist/{chunk-7phshjwf.js → chunk-125rc958.js} +1 -1
- package/dist/{chunk-f1z9ekjh.js → chunk-18270qgd.js} +2 -2
- package/dist/{chunk-a9q8c4pm.js → chunk-1hrj0t0j.js} +8 -8
- package/dist/{chunk-wxkphrnt.js → chunk-2ernwctg.js} +3 -3
- package/dist/chunk-2yypassp.js +2 -0
- package/dist/{chunk-qyq7edq6.js → chunk-325p135t.js} +1 -1
- package/dist/{chunk-f5n26rq9.js → chunk-36aj0yzt.js} +1 -1
- package/dist/{chunk-m6826w3k.js → chunk-375skn32.js} +1 -1
- package/dist/{chunk-rqc62964.js → chunk-3hkv4e7t.js} +1 -1
- package/dist/chunk-4mmdpb46.js +2 -0
- package/dist/{chunk-ec8k75ep.js → chunk-4zb2ga7p.js} +2 -2
- package/dist/{chunk-4bhjt6xn.js → chunk-55hfvmvv.js} +5 -5
- package/dist/{chunk-0897e87r.js → chunk-5grx48s2.js} +1 -1
- package/dist/{chunk-4ct7a53d.js → chunk-5s555c1r.js} +3 -3
- package/dist/chunk-5ytg0wbc.js +2 -0
- package/dist/{chunk-97614ghv.js → chunk-6sf4v894.js} +2 -2
- package/dist/{chunk-zycahp89.js → chunk-6yn90mq9.js} +1 -1
- package/dist/chunk-7d2vyre0.js +2 -0
- package/dist/{chunk-vjx8gtfk.js → chunk-8afnq4qx.js} +2 -2
- package/dist/{chunk-658paz71.js → chunk-8cpqy9ea.js} +1506 -1506
- package/dist/chunk-8d788kvt.js +2 -0
- package/dist/{chunk-m6zmvcq2.js → chunk-8txqk9nq.js} +1 -1
- package/dist/{chunk-hb95ah88.js → chunk-90qywh24.js} +3 -3
- package/dist/chunk-bdhtq3vs.js +2 -0
- package/dist/chunk-brnapchc.js +2 -0
- package/dist/{chunk-7cfpb2n8.js → chunk-c765y72x.js} +2 -2
- package/dist/{chunk-p47kzj6s.js → chunk-d1mqedk0.js} +1 -1
- package/dist/{chunk-0fv4x8fn.js → chunk-da9avgd9.js} +1 -1
- package/dist/{chunk-8b6mp92r.js → chunk-dmf1jmge.js} +2 -2
- package/dist/chunk-e3njkecx.js +2 -0
- package/dist/{chunk-86cnpvf4.js → chunk-efzc1nw8.js} +1 -1
- package/dist/{chunk-ymcsz527.js → chunk-ev3qnr9q.js} +2 -2
- package/dist/{chunk-5zxb7dsf.js → chunk-fm4w1r9e.js} +1 -1
- package/dist/{chunk-m7h6wx3r.js → chunk-g1epk002.js} +1 -1
- package/dist/chunk-hmk7z0z6.js +2 -0
- package/dist/{chunk-q0xcf4zq.js → chunk-hn105xy3.js} +1 -1
- package/dist/chunk-jq079mrx.js +2 -0
- package/dist/{chunk-kj4fpfjj.js → chunk-jr149mmp.js} +1 -1
- package/dist/{chunk-4ga3g8xc.js → chunk-kwxy0e3r.js} +1 -1
- package/dist/chunk-kza3nxr0.js +2 -0
- package/dist/chunk-ma2yh8zc.js +63 -0
- package/dist/chunk-mahv855w.js +2 -0
- package/dist/{chunk-rxvnfge3.js → chunk-mb59b499.js} +4 -4
- package/dist/{chunk-w9157aaz.js → chunk-mm1vvk49.js} +1 -1
- package/dist/{chunk-d7w1n5jm.js → chunk-mt8sew7a.js} +5 -5
- package/dist/chunk-n2g9mj2h.js +2 -0
- package/dist/{chunk-m3drjrkh.js → chunk-n2nha538.js} +1 -1
- package/dist/{chunk-1dfd95ev.js → chunk-n6va14bt.js} +1 -1
- package/dist/chunk-nebw444s.js +2 -0
- package/dist/{chunk-hdswffnj.js → chunk-nm0y4qjg.js} +1 -1
- package/dist/chunk-nmt7kw0e.js +2 -0
- package/dist/{chunk-46195rpy.js → chunk-pzasxhwz.js} +1 -1
- package/dist/chunk-qajc13zq.js +2 -0
- package/dist/chunk-qtnqmw1n.js +2 -0
- package/dist/chunk-r3zdgeah.js +2 -0
- package/dist/chunk-r5htacg5.js +2 -0
- package/dist/{chunk-fh4vpewx.js → chunk-rf2rwddd.js} +1 -1
- package/dist/{chunk-9jvzz9pr.js → chunk-s1xxkzc9.js} +4 -4
- package/dist/chunk-s833fbvf.js +2 -0
- package/dist/chunk-sgvszh9s.js +2 -0
- package/dist/{chunk-et82hw8n.js → chunk-ss78553t.js} +1 -1
- package/dist/chunk-t5r3s1wj.js +2 -0
- package/dist/{chunk-jh9ajakd.js → chunk-tc01jkfc.js} +1 -1
- package/dist/{chunk-8sfv1h98.js → chunk-tfeenp4h.js} +4 -4
- package/dist/chunk-tjprg6kq.js +2 -0
- package/dist/{chunk-30wqqwbn.js → chunk-tsmbstj6.js} +1 -1
- package/dist/{chunk-vc6dn0jf.js → chunk-vtz9empe.js} +1 -1
- package/dist/{chunk-ztfvrpp6.js → chunk-wa6nzq5b.js} +1 -1
- package/dist/{chunk-tq28tg3k.js → chunk-wm11csdm.js} +1 -1
- package/dist/{chunk-pjgzqz07.js → chunk-wwn9dh6p.js} +1 -1
- package/dist/{chunk-4aw3whbc.js → chunk-xw8kzm6b.js} +2104 -2104
- package/dist/chunk-ytdzgctp.js +2 -0
- package/dist/{chunk-yje1skpw.js → chunk-z2n1rtj5.js} +1 -1
- package/dist/cli.js +11 -11
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/database.js +2 -2
- package/dist/native/components/primitives.d.ts +20 -4
- package/dist/native/index.d.ts +3 -0
- package/dist/native/primitives/Map.stx +2 -1
- package/dist/native/prop-names.js +3 -0
- package/dist/native/runtime/craft-bridge.js +31 -12
- package/dist/native/runtime/craft.d.ts +7 -5
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/dist/stx.d.ts +1 -1028
- package/dist/variable-extractor.js +2 -2
- package/package.json +6 -5
- package/src/composables/use-mouse.ts +438 -0
- package/stx.d.ts +2 -0
- package/dist/chunk-1g4t7df6.js +0 -63
- package/dist/chunk-1k38dc96.js +0 -2
- package/dist/chunk-4ss6b94k.js +0 -2
- package/dist/chunk-592xm851.js +0 -2
- package/dist/chunk-5adcz47v.js +0 -2
- package/dist/chunk-7bqkgjxv.js +0 -2
- package/dist/chunk-8218m54a.js +0 -2
- package/dist/chunk-b7yvq1kw.js +0 -2
- package/dist/chunk-bhyrzt2n.js +0 -2
- package/dist/chunk-d80xsgse.js +0 -2
- package/dist/chunk-e7ddshxz.js +0 -2
- package/dist/chunk-eh6n83az.js +0 -2
- package/dist/chunk-enb8dpkt.js +0 -2
- package/dist/chunk-fh8q5rnd.js +0 -2
- package/dist/chunk-fm5tm1b7.js +0 -2
- package/dist/chunk-gkq300a7.js +0 -2
- package/dist/chunk-h5jpbxda.js +0 -2
- package/dist/chunk-jzmtpjns.js +0 -2
- package/dist/chunk-m1bczftm.js +0 -2
- package/dist/chunk-nkarb6fg.js +0 -2
- package/dist/chunk-qc66nfp7.js +0 -2
- package/dist/chunk-sg2bn15n.js +0 -2
- package/dist/chunk-sn98t7ef.js +0 -2
- package/dist/chunk-sz243f3v.js +0 -2
- package/dist/chunk-t2ec3fek.js +0 -2
- package/dist/chunk-xnfjemzj.js +0 -2
- /package/dist/{chunk-nd7vkt4w.js → chunk-m8qgr307.js} +0 -0
|
@@ -14,11 +14,14 @@ function capabilityFlags(capabilities) {
|
|
|
14
14
|
pushNotifications: capabilities.has("push"),
|
|
15
15
|
secureStorage: capabilities.has("secureStorage"),
|
|
16
16
|
storage: capabilities.has("storage"),
|
|
17
|
+
storageCompareAndSet: capabilities.has("storageCompareAndSet"),
|
|
17
18
|
localDatabase: capabilities.has("database"),
|
|
18
19
|
lifecycle: capabilities.has("lifecycle"),
|
|
19
20
|
geolocation: capabilities.has("geolocation"),
|
|
21
|
+
locationRecordingOwnership: capabilities.has("locationRecordingOwnership"),
|
|
20
22
|
music: capabilities.has("music"),
|
|
21
23
|
heartRate: capabilities.has("heartRate"),
|
|
24
|
+
heartRateRecordingOwnership: capabilities.has("heartRateRecordingOwnership"),
|
|
22
25
|
bluetooth: capabilities.has("bluetooth"),
|
|
23
26
|
scheduledWorkouts: capabilities.has("scheduledWorkouts"),
|
|
24
27
|
liveActivities: capabilities.has("liveActivities"),
|
|
@@ -59,7 +62,16 @@ function platformUserAgent(platform) {
|
|
|
59
62
|
return "Craft";
|
|
60
63
|
}
|
|
61
64
|
export function installCraftBridge(protocol, nativeBridge, target = globalThis, options = {}) {
|
|
62
|
-
const craft = target.craft = target.craft || {}, capabilities = new Set(nativeBridge.capabilities || []), request = (module, method, args) => protocol.callNativeAPI(module, method, ...args), ask = (module, method, args) => protocol.callPersonFacingAPI(module, method, ...args)
|
|
65
|
+
const craft = target.craft = target.craft || {}, capabilities = new Set(nativeBridge.capabilities || []), request = (module, method, args) => protocol.callNativeAPI(module, method, ...args), ask = (module, method, args) => protocol.callPersonFacingAPI(module, method, ...args), recordingRequest = (module, method, options) => {
|
|
66
|
+
if (options && Object.prototype.hasOwnProperty.call(options, "expectedId")) {
|
|
67
|
+
if (typeof options.expectedId !== "string" || !options.expectedId.trim())
|
|
68
|
+
return Promise.reject(Object.assign(Error("expectedId must be a nonempty recording ID"), { code: "INVALID_ARGUMENT" }));
|
|
69
|
+
const flag = module === "Location" ? "locationRecordingOwnership" : "heartRateRecordingOwnership";
|
|
70
|
+
if (!capabilities.has(flag))
|
|
71
|
+
return Promise.reject(Object.assign(Error("This app build cannot enforce recording ownership"), { code: "RECORDING_OWNERSHIP_UNSUPPORTED" }));
|
|
72
|
+
}
|
|
73
|
+
return request(module, method, options === void 0 ? [] : [options]);
|
|
74
|
+
};
|
|
63
75
|
let appState = nativeBridge.initialAppState || "active", initialDeepLinkClaimed = !1;
|
|
64
76
|
const appStateHandlers = new Set, deepLinkHandlers = new Set, navButtonHandlers = new Set, navButtonPresses = {
|
|
65
77
|
leftButtons: new Map,
|
|
@@ -113,7 +125,12 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
|
|
|
113
125
|
set: (key, value) => request("Storage", "set", [key, value]),
|
|
114
126
|
remove: (key) => request("Storage", "remove", [key]),
|
|
115
127
|
clear: () => request("Storage", "clear", []),
|
|
116
|
-
keys: () => request("Storage", "keys", [])
|
|
128
|
+
keys: () => request("Storage", "keys", []),
|
|
129
|
+
compareAndSet: (key, expectedValue, nextValue) => {
|
|
130
|
+
if (!capabilities.has("storageCompareAndSet"))
|
|
131
|
+
return Promise.reject(Object.assign(Error("This host cannot atomically checkpoint existing storage"), { code: "STORAGE_COMPARE_AND_SET_UNSUPPORTED" }));
|
|
132
|
+
return request("Storage", "compareAndSet", [key, expectedValue, nextValue]);
|
|
133
|
+
}
|
|
117
134
|
});
|
|
118
135
|
craft.secureStorage = Object.assign({ getSync: () => null }, craft.secureStorage || {}, {
|
|
119
136
|
get: (key) => request("SecureStorage", "get", [key]),
|
|
@@ -300,11 +317,12 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
|
|
|
300
317
|
unwatched();
|
|
301
318
|
},
|
|
302
319
|
startRecording: (options = {}) => ask("Location", "startRecording", [options]),
|
|
303
|
-
pauseRecording: () =>
|
|
304
|
-
resumeRecording: () =>
|
|
305
|
-
stopRecording: () =>
|
|
306
|
-
getRecordingState: () =>
|
|
307
|
-
|
|
320
|
+
pauseRecording: (options) => recordingRequest("Location", "pauseRecording", options),
|
|
321
|
+
resumeRecording: (options) => recordingRequest("Location", "resumeRecording", options),
|
|
322
|
+
stopRecording: (options) => recordingRequest("Location", "stopRecording", options),
|
|
323
|
+
getRecordingState: (options) => recordingRequest("Location", "getRecordingState", options),
|
|
324
|
+
acknowledgeRecording: (options) => recordingRequest("Location", "acknowledgeRecording", options),
|
|
325
|
+
readRecording: (options) => recordingRequest("Location", "readRecording", options)
|
|
308
326
|
};
|
|
309
327
|
target.addEventListener?.("craftLocationUpdate", (event) => {
|
|
310
328
|
watchers.forEach((callback) => callback(event?.detail));
|
|
@@ -353,11 +371,12 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
|
|
|
353
371
|
reconnect: () => strap("reconnect"),
|
|
354
372
|
disconnect: (options = {}) => strap("disconnect", { forget: !!options.forget }),
|
|
355
373
|
startRecording: () => strap("startRecording"),
|
|
356
|
-
pauseRecording: () =>
|
|
357
|
-
resumeRecording: () =>
|
|
358
|
-
stopRecording: () =>
|
|
359
|
-
getRecordingState: () =>
|
|
360
|
-
|
|
374
|
+
pauseRecording: (options) => recordingRequest("HeartRate", "pauseRecording", options),
|
|
375
|
+
resumeRecording: (options) => recordingRequest("HeartRate", "resumeRecording", options),
|
|
376
|
+
stopRecording: (options) => recordingRequest("HeartRate", "stopRecording", options),
|
|
377
|
+
getRecordingState: (options) => recordingRequest("HeartRate", "getRecordingState", options),
|
|
378
|
+
acknowledgeRecording: (options) => recordingRequest("HeartRate", "acknowledgeRecording", options),
|
|
379
|
+
readRecording: (options = {}) => recordingRequest("HeartRate", "readRecording", options)
|
|
361
380
|
};
|
|
362
381
|
}
|
|
363
382
|
if (capabilities.has("scheduledWorkouts")) {
|
|
@@ -99,6 +99,7 @@ export declare interface NativeStorage {
|
|
|
99
99
|
remove: (key: string) => Promise<unknown>
|
|
100
100
|
clear: () => Promise<unknown>
|
|
101
101
|
keys: () => Promise<string[]>
|
|
102
|
+
compareAndSet: (key: string, expectedValue: unknown, nextValue: unknown) => Promise<boolean>
|
|
102
103
|
getSync: <T = unknown>(key: string) => T | null
|
|
103
104
|
setSync: (key: string, value: unknown) => void
|
|
104
105
|
}
|
|
@@ -204,11 +205,12 @@ export declare interface NativeCraft {
|
|
|
204
205
|
watchPosition: (callback: (location: NativeLocation) => unknown, options?: Record<string, unknown>) => number
|
|
205
206
|
clearWatch: (id?: number) => void
|
|
206
207
|
startRecording: (options?: Record<string, unknown>) => Promise<NativeLocationRecordingState>
|
|
207
|
-
pauseRecording: () => Promise<NativeLocationRecordingState>
|
|
208
|
-
resumeRecording: () => Promise<NativeLocationRecordingState>
|
|
209
|
-
stopRecording: () => Promise<NativeLocationRecordingState & { locations: NativeLocation[] }>
|
|
210
|
-
|
|
211
|
-
|
|
208
|
+
pauseRecording: (options?: { expectedId: string }) => Promise<NativeLocationRecordingState>
|
|
209
|
+
resumeRecording: (options?: { expectedId: string }) => Promise<NativeLocationRecordingState>
|
|
210
|
+
stopRecording: (options?: { expectedId: string }) => Promise<NativeLocationRecordingState & { locations: NativeLocation[] }>
|
|
211
|
+
acknowledgeRecording: (options: { expectedId: string }) => Promise<boolean>
|
|
212
|
+
getRecordingState: (options?: { expectedId: string }) => Promise<NativeLocationRecordingState & { sampleCount: number }>
|
|
213
|
+
readRecording: (options?: { expectedId: string }) => Promise<NativeLocation[]>
|
|
212
214
|
}
|
|
213
215
|
setKeepAwake?: (enabled: boolean) => Promise<boolean>
|
|
214
216
|
getBrightness?: () => Promise<number>
|
package/dist/pwa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{Fn,Le,Uo,Ya}from"./chunk-9ya4tdpz.js";import{Bn,Gr,Ka,Xa,Ja}from"./chunk-g8tx0yf8.js";import{Fo,zo,Ho,qa,Ga}from"./chunk-7wyyjdks.js";import{ae,yt,Kr}from"./chunk-8cs45k3f.js";import{Qc,el,tl,nl,yr,xu}from"./chunk-9tcvkbb5.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
|
|
3
|
-
Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-
|
|
3
|
+
Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-7d2vyre0.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
|
|
4
4
|
<html lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
package/dist/ssg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-ffxwsa94.js";import"./chunk-
|
|
2
|
+
import"./chunk-ffxwsa94.js";import"./chunk-m8qgr307.js";import"./chunk-4zb2ga7p.js";import{rt,st,ot,it,at,ct}from"./chunk-ev3qnr9q.js";import"./chunk-7m0r2qs2.js";import"./chunk-d4ybwtqt.js";import{f,He,N,X,n,o}from"./chunk-xw8kzm6b.js";import"./chunk-1hrj0t0j.js";import{or}from"./chunk-mt8sew7a.js";import"./chunk-ghnkphy4.js";import"./chunk-8txqk9nq.js";import"./chunk-rgage0vm.js";import"./chunk-dmf1jmge.js";import"./chunk-01s01ten.js";import{ce,bt,wt}from"./chunk-mm1vvk49.js";import{Lo,jo,Bo}from"./chunk-z06npyzn.js";import{ht,en,tn}from"./chunk-15g5sc0p.js";import"./chunk-8afnq4qx.js";import{a}from"./chunk-203rr1c8.js";import x from"fs";import g from"path";import{createHash as Dt}from"crypto";function Rt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var kt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Ct(t){return Bun.hash(t).toString(16)}function ut(t,i={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,r=t.replace(kt,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(i.minify)h=Rt(h);let S=Ct(h);if(!s.has(S))s.set(S,h);let P=i.integrity?` data-stx-integrity="sha384-${Dt("sha384").update(h).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),c=Array.from(s,([e,l])=>({hash:e,code:l}));return{html:r,chunks:c}}var Et=new Set(["visible","idle"]);function dt(t){if(!t.includes("data-stx-src="))return t;let i=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,r;while((r=s.exec(t))!==null)i.set(r[1],r[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(Et.has(i.get(l[1])||""))c.add(l[2]);let w=t.lastIndexOf("</head>");if(c.size===0||w===-1)return t;let y=Array.from(c).filter((h)=>!t.includes(`rel="prefetch" href="${h}"`)).map((h)=>`<link rel="prefetch" href="${h}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var It=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function q(t){let i=t.trim();if(!i)return null;let s=/^https?:\/\//i.test(i)?i:`https://${i}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function Bt(t){for(let i of It){let s=t[i];if(!s)continue;let r=q(s);if(r)return{url:r,source:"env",via:i}}return null}function gt(t){if(!t||typeof t!=="object")return null;let i=t,s=i.site?.url??i.url??i.app?.url;return typeof s==="string"?q(s):null}async function jt(t){let{existsSync:i}=await import("fs"),s=await import("path");for(let r of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(t,r);if(!i(c))continue;try{let e=await import(c),l=gt(e.default??e);if(l)return l}catch{}}return null}async function pt(t={}){let i=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let l=q(t.explicit);if(l)return{url:l,source:"option"}}let r=gt(t.stxConfig);if(r)return{url:r,source:"stx.config",via:"site.url"};let c=await jt(i);if(c)return{url:c,source:"site.config",via:"url"};let e=Bt(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ft(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
|
|
3
3
|
`)}class mt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,i=""){this.cacheDir=t,this.salt=i}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let i=JSON.parse(await Bun.file(t).text());for(let[s,r]of Object.entries(i))this.cache.set(s,r)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),i={};for(let[s,r]of this.cache)i[s]=r;await Bun.write(t,JSON.stringify(i))}getHash(t,i){let s=x.statSync(t),r=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of i)if(x.existsSync(e)){let l=x.statSync(e);r+=`:${e}:${l.mtimeMs}`}let c=0;for(let e=0;e<r.length;e++){let l=r.charCodeAt(e);c=(c<<5)-c+l,c=c&c}return Math.abs(c).toString(36)}get(t,i){let s=this.cache.get(t);if(!s)return null;let r=this.getHash(i,s.dependencies??[]);if(s.hash!==r)return this.cache.delete(t),null;return s.html}set(t,i,s,r){let c=this.getHash(i,s);this.cache.set(t,{hash:c,html:r,generatedAt:Date.now(),dependencies:s})}}class yt{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let i=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",i)}async get(t){let i=this.getFilePath(t);if(!await Bun.file(i).exists())return null;try{return JSON.parse(await Bun.file(i).text())}catch{return null}}async set(t,i){let s=this.getFilePath(t);await x.promises.mkdir(g.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(i))}async invalidate(t){let i=this.getFilePath(t);if(await Bun.file(i).exists())await x.promises.unlink(i)}async invalidatePattern(t){let i=g.join(this.cacheDir,"isr");if(!x.existsSync(i))return;let s=await x.promises.readdir(i);for(let r of s){let c=r.replace(/_/g,"/").replace(".json","");if(t.test(c))await x.promises.unlink(g.join(i,r))}}async needsRevalidation(t){let i=await this.get(t);if(!i)return!0;return Date.now()>i.revalidateAfter}}async function Ft(t){try{let s=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!s)return null;let r=s[1];if(!r.includes("getStaticPaths"))return null;let c=r.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!c)return null;return await Function(`
|
|
4
4
|
return (async function getStaticPaths() {
|
|
5
5
|
${c[1]}
|
|
@@ -41,7 +41,7 @@ ${t.map((r)=>{let c=new URL(r.loc,i).href,e=` <url>
|
|
|
41
41
|
${s.join(`
|
|
42
42
|
`)}
|
|
43
43
|
</channel>
|
|
44
|
-
</rss>`}async function zt(t={}){let i=Date.now();wt();let s=await o(process.cwd()),r=s.build||{},c=await pt({explicit:t.domain||r.domain,stxConfig:s});if(c.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(ft());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||r.pagesDir||"pages",outputDir:t.outputDir||r.outputDir||"dist",baseUrl:t.baseUrl||r.baseUrl||"/",domain:c.url,revalidate:t.revalidate??r.revalidate??!1,sitemap:t.sitemap??r.sitemap??!0,sitemapExclude:t.sitemapExclude||r.sitemapExclude||[],robots:t.robots??r.robots??!0,rss:t.rss??r.rss??!1,concurrency:t.concurrency||r.concurrency||10,cache:t.cache??r.cache??!0,cacheDir:t.cacheDir||r.cacheDir||a(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??r.minify??!0,generate404:t.generate404??r.generate404??!0,publicDir:t.publicDir||r.publicDir||"public",trailingSlash:t.trailingSlash??r.trailingSlash??!1,cleanOutput:t.cleanOutput??r.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,h={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-
|
|
44
|
+
</rss>`}async function zt(t={}){let i=Date.now();wt();let s=await o(process.cwd()),r=s.build||{},c=await pt({explicit:t.domain||r.domain,stxConfig:s});if(c.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(ft());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||r.pagesDir||"pages",outputDir:t.outputDir||r.outputDir||"dist",baseUrl:t.baseUrl||r.baseUrl||"/",domain:c.url,revalidate:t.revalidate??r.revalidate??!1,sitemap:t.sitemap??r.sitemap??!0,sitemapExclude:t.sitemapExclude||r.sitemapExclude||[],robots:t.robots??r.robots??!0,rss:t.rss??r.rss??!1,concurrency:t.concurrency||r.concurrency||10,cache:t.cache??r.cache??!0,cacheDir:t.cacheDir||r.cacheDir||a(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??r.minify??!0,generate404:t.generate404??r.generate404??!0,publicDir:t.publicDir||r.publicDir||"public",trailingSlash:t.trailingSlash??r.trailingSlash??!1,cleanOutput:t.cleanOutput??r.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,h={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-t5r3s1wj.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-da9avgd9.js"),b=await p(e.publicDir,e.outputDir);if(b.count>0)console.log(`Optimized ${b.count} image(s) for responsive delivery`),D=[D,b.fingerprint].filter(Boolean).join(":");let B=new mt(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-t5r3s1wj.js");await u('<div class="bg-black"></div>')}catch{}rt();let xt=s?.routeMiddleware?.dir||"middleware";await ot(process.cwd(),xt);let H=st();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let vt=s?.routeMiddleware?.global||[];Bo(s?.layoutsDir,a(process.cwd()));let V=N(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${V.length} routes`);let _=[];for(let u of V){let m=await Ot(u);for(let v of m)_.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=_.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],K=[];for(let u=0;u<_.length;u+=e.concurrency)K.push(_.slice(u,u+e.concurrency));for(let u of K)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:L,props:Pt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Jt(j),$t=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],tt=[...vt,...$t];if(tt.length>0){let C=it(d,L,F||{}),O=at(C,null,void 0,{isServer:!0}),E=await ct(tt,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,U=Vt(String(R),d),T=Kt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,U),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(U),cached:!1}),A.push({loc:d,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${d} \u2192 redirect to ${R}`);return}if(E.abort){let R=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${d} \u2014 middleware aborted: ${R}`);return}}let et=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(et)try{if(!await Function("route",`
|
|
45
45
|
const validate = ${et[1]};
|
|
46
46
|
return validate(route);
|
|
47
47
|
`)({params:L})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,nt=!1;if(e.cache){if(k=B.get(d,v.filePath),k)nt=!0,l.cachedCount++}if(!k){let C=await St(v,L,Pt,e,s);if(k=C.html,e.failOnIncludeError&&C.includeFailures.length>0)throw Error(`${C.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
|