@stacksjs/stx 0.2.617 → 0.2.619
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-3vbv4gxx.js → chunk-06pc67a6.js} +2 -2
- package/dist/{chunk-cjm2d6w1.js → chunk-0v4zcm3s.js} +1 -1
- package/dist/{chunk-m85kmqbn.js → chunk-0vfqp662.js} +1 -1
- package/dist/{chunk-araay35m.js → chunk-1a59snwg.js} +4 -4
- package/dist/{chunk-temrpzxj.js → chunk-1g257jhn.js} +1 -1
- package/dist/chunk-1zq9pht7.js +2 -0
- package/dist/chunk-2a0wr0dm.js +2 -0
- package/dist/chunk-2pvt0edy.js +2 -0
- package/dist/{chunk-h74p4zay.js → chunk-2t49cfd3.js} +33 -33
- package/dist/{chunk-dq58tn5x.js → chunk-35qyy4fx.js} +1 -1
- package/dist/{chunk-twmq5m6r.js → chunk-3jdfzq61.js} +2 -2
- package/dist/{chunk-06bwys2z.js → chunk-3x88c989.js} +1 -1
- package/dist/{chunk-k1hpxgzq.js → chunk-47csgccw.js} +5 -5
- package/dist/{chunk-ekd11w9t.js → chunk-5ek9k7hh.js} +1 -1
- package/dist/{chunk-jpe8pt9m.js → chunk-5md6ejrq.js} +1 -1
- package/dist/{chunk-wq6b8qgz.js → chunk-65b3f0e9.js} +1 -1
- package/dist/{chunk-mqky9h29.js → chunk-6rjm087c.js} +1 -1
- package/dist/{chunk-ywxg3f9s.js → chunk-6tsenq5p.js} +1 -1
- package/dist/chunk-70gchk6z.js +2 -0
- package/dist/{chunk-rw3kgv2q.js → chunk-78jnrn1f.js} +1 -1
- package/dist/{chunk-xeqysa9z.js → chunk-7f0gh0kg.js} +38 -38
- package/dist/{chunk-s9jgsp0a.js → chunk-7fg1hzad.js} +3 -3
- package/dist/chunk-7y4ff3se.js +2 -0
- package/dist/{chunk-e5t4xhfk.js → chunk-86xx6pre.js} +1 -1
- package/dist/chunk-8gy3vz25.js +2 -0
- package/dist/{chunk-kt9ksp8w.js → chunk-8jcrtb7k.js} +1 -1
- package/dist/{chunk-4h62y8dn.js → chunk-8w9w1vv4.js} +1 -1
- package/dist/{chunk-pw0b0an6.js → chunk-8xwgz6jf.js} +1 -1
- package/dist/{chunk-27h4ndsg.js → chunk-93whjefr.js} +1 -1
- package/dist/chunk-9985eshw.js +2 -0
- package/dist/chunk-9k34a7bd.js +2 -0
- package/dist/{chunk-hx2fc5dt.js → chunk-9r4m465q.js} +1 -1
- package/dist/{chunk-q3a13hvc.js → chunk-a0xkvdjr.js} +2 -2
- package/dist/{chunk-k0kajwdw.js → chunk-a3j5sb7g.js} +1 -1
- package/dist/{chunk-97ht3bw3.js → chunk-at430s7q.js} +1 -1
- package/dist/chunk-axt96apz.js +2 -0
- package/dist/chunk-b2shw48x.js +2 -0
- package/dist/{chunk-q4t49t6z.js → chunk-b3v077t7.js} +3 -3
- package/dist/chunk-bah51zv3.js +2 -0
- package/dist/{chunk-jrsvbztw.js → chunk-bbbdfd8q.js} +1 -1
- package/dist/chunk-c091xff6.js +2 -0
- package/dist/chunk-ckts3t2h.js +2 -0
- package/dist/{chunk-71wntraa.js → chunk-cv2t12cc.js} +1 -1
- package/dist/{chunk-tkw5mr0k.js → chunk-d8v0amcr.js} +1 -1
- package/dist/{chunk-th9t5vks.js → chunk-ddx52kk5.js} +1 -1
- package/dist/{chunk-zde9mef4.js → chunk-dz3wh7x0.js} +1 -1
- package/dist/{chunk-qzfq8342.js → chunk-effx3f2n.js} +1 -1
- package/dist/{chunk-trhr4gzz.js → chunk-epbhzaca.js} +1 -1
- package/dist/{chunk-t4rxr1zj.js → chunk-etyjfmza.js} +1 -1
- package/dist/chunk-evqpzzns.js +2 -0
- package/dist/chunk-ey6rjjec.js +2 -0
- package/dist/{chunk-tq5nzr99.js → chunk-gg38as5t.js} +1 -1
- package/dist/chunk-hmdettqm.js +2 -0
- package/dist/{chunk-m0x9gfx5.js → chunk-k1j2aw54.js} +1 -1
- package/dist/{chunk-jwxppaj3.js → chunk-m2c4rx9x.js} +1 -1
- package/dist/{chunk-4rtxkqwh.js → chunk-mktk70gq.js} +2 -2
- package/dist/chunk-mzvggfjn.js +2 -0
- package/dist/chunk-ptgn563n.js +2 -0
- package/dist/{chunk-faq9x5kw.js → chunk-r4n2fve8.js} +17 -17
- package/dist/{chunk-wn3d4gd6.js → chunk-s2n7exsm.js} +2 -2
- package/dist/{chunk-j6nn0c5r.js → chunk-safstptd.js} +1 -1
- package/dist/{chunk-3hzr66vn.js → chunk-samsjcqt.js} +3 -3
- package/dist/chunk-sgnez07y.js +2 -0
- package/dist/{chunk-t8akfx99.js → chunk-sy2nm0z7.js} +1 -1
- package/dist/{chunk-bm632aaj.js → chunk-tk1bkmdq.js} +1 -1
- package/dist/{chunk-wr42shpx.js → chunk-tx1mq72q.js} +1 -1
- package/dist/{chunk-zb191qdx.js → chunk-tyhw0ndz.js} +1 -1
- package/dist/{chunk-3cg5mrtq.js → chunk-vqwszvzt.js} +4 -4
- package/dist/{chunk-b3g8zzc6.js → chunk-x6bh13w3.js} +1 -1
- package/dist/{chunk-gv3se08t.js → chunk-xs01xryj.js} +1 -1
- package/dist/{chunk-792sscsk.js → chunk-xvt6vvg4.js} +1 -1
- package/dist/{chunk-5fxh7fc3.js → chunk-y039e06c.js} +2 -2
- package/dist/chunk-yzpr0fh3.js +2 -0
- package/dist/{chunk-spkwmfbm.js → chunk-z04480ar.js} +1 -1
- package/dist/cli.js +9 -9
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/runtime/craft-bridge.js +44 -10
- package/dist/native/runtime/craft.d.ts +19 -0
- package/dist/native/runtime/navigation-chrome.d.ts +24 -0
- package/dist/native/runtime/navigation-chrome.js +49 -0
- package/dist/pwa.js +2 -2
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-1gyrk0qv.js +0 -2
- package/dist/chunk-1xzxmnsd.js +0 -2
- package/dist/chunk-2a1sgnxf.js +0 -2
- package/dist/chunk-3fb3m640.js +0 -2
- package/dist/chunk-awvbp2t4.js +0 -2
- package/dist/chunk-bdn21f8c.js +0 -2
- package/dist/chunk-c6vb28zd.js +0 -2
- package/dist/chunk-dcdmr6cp.js +0 -2
- package/dist/chunk-fq4xjy4k.js +0 -2
- package/dist/chunk-h476qqq9.js +0 -2
- package/dist/chunk-mf6mqs9k.js +0 -2
- package/dist/chunk-n5acpvq3.js +0 -2
- package/dist/chunk-nvewemvh.js +0 -2
- package/dist/chunk-p1t8mm9b.js +0 -2
- package/dist/chunk-pv73vnyj.js +0 -2
- package/dist/chunk-t7h714ne.js +0 -2
- package/dist/chunk-x81g1v5x.js +0 -2
- package/dist/chunk-ywf6pa29.js +0 -2
- package/dist/chunk-yxksngda.js +0 -2
- package/dist/chunk-yytfje8a.js +0 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { STXBridge } from "../bridge/protocol.js";
|
|
2
2
|
import { createEventSourceClass, createStreamingBody } from "./event-stream.js";
|
|
3
3
|
import { abortError, NativeFormData, nativeFormParts } from "./jsc-globals.js";
|
|
4
|
+
import { buttonsKey, changedTabItems, hostButton, mergeChromeButtons } from "./navigation-chrome.js";
|
|
4
5
|
function capabilityFlags(capabilities) {
|
|
5
6
|
return {
|
|
6
7
|
desktop: capabilities.has("desktop"),
|
|
@@ -603,7 +604,23 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
|
|
|
603
604
|
if (pathReplacement && params && Object.keys(params).length)
|
|
604
605
|
throw TypeError("Replacement paths carry parameters in their query string");
|
|
605
606
|
return protocol.send(type, { screen, params: params || {} });
|
|
606
|
-
}, hostSetOptions = craft.navigation && typeof craft.navigation.setOptions === "function" ? craft.navigation.setOptions.bind(craft.navigation) : null;
|
|
607
|
+
}, hostSetOptions = craft.navigation && typeof craft.navigation.setOptions === "function" ? craft.navigation.setOptions.bind(craft.navigation) : null, ownButtons = { leftButtons: [], rightButtons: [] }, sentButtons = { leftButtons: "[]", rightButtons: "[]" }, sentTabItems = new Map;
|
|
608
|
+
let sentAccessory, chrome = null;
|
|
609
|
+
const barButtons = (side) => {
|
|
610
|
+
const merged = mergeChromeButtons(ownButtons[side], chrome, side, { name: craft.route?.name ?? "", path: craft.route?.path }), presses = navButtonPresses[side];
|
|
611
|
+
presses.clear();
|
|
612
|
+
for (const button of merged) {
|
|
613
|
+
const id = String(button.id);
|
|
614
|
+
if (typeof button.onPress === "function")
|
|
615
|
+
presses.set(id, button.onPress);
|
|
616
|
+
else if (button.open) {
|
|
617
|
+
const path = button.open;
|
|
618
|
+
presses.set(id, () => craft.navigation.open(path));
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
sentButtons[side] = buttonsKey(merged);
|
|
622
|
+
return merged.map(hostButton);
|
|
623
|
+
}, sendOptions = (payload) => hostSetOptions ? hostSetOptions(payload) : protocol.send("NAVIGATION_SET_OPTIONS", payload);
|
|
607
624
|
craft.navigation = Object.assign(craft.navigation || {}, {
|
|
608
625
|
push: (screen, params) => navigate("NAVIGATE", screen, params),
|
|
609
626
|
replace: (screen, params) => navigate("NAVIGATE_REPLACE", screen, params),
|
|
@@ -620,17 +637,34 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
|
|
|
620
637
|
const payload = {};
|
|
621
638
|
for (const key of Object.keys(navigationOptions))
|
|
622
639
|
if ((key === "leftButtons" || key === "rightButtons") && Array.isArray(navigationOptions[key])) {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
payload[key] = navigationOptions[key].map((button) => {
|
|
626
|
-
const { onPress, ...rest } = button || {};
|
|
627
|
-
if (typeof onPress === "function" && rest.id != null)
|
|
628
|
-
presses.set(String(rest.id), onPress);
|
|
629
|
-
return rest;
|
|
630
|
-
});
|
|
640
|
+
ownButtons[key] = navigationOptions[key].filter(Boolean);
|
|
641
|
+
payload[key] = barButtons(key);
|
|
631
642
|
} else if (typeof navigationOptions[key] !== "function")
|
|
632
643
|
payload[key] = navigationOptions[key];
|
|
633
|
-
return
|
|
644
|
+
return sendOptions(payload);
|
|
645
|
+
},
|
|
646
|
+
setChrome: (next) => {
|
|
647
|
+
if (next !== null && (typeof next !== "object" || Array.isArray(next)))
|
|
648
|
+
throw TypeError("navigation.setChrome needs an object, or null");
|
|
649
|
+
chrome = next;
|
|
650
|
+
const payload = {};
|
|
651
|
+
for (const side of ["leftButtons", "rightButtons"]) {
|
|
652
|
+
const before = sentButtons[side], buttons = barButtons(side);
|
|
653
|
+
if (sentButtons[side] !== before)
|
|
654
|
+
payload[side] = buttons;
|
|
655
|
+
}
|
|
656
|
+
const items = changedTabItems(chrome, sentTabItems);
|
|
657
|
+
if (items.length)
|
|
658
|
+
payload.tabItem = items[0];
|
|
659
|
+
const accessory = chrome && "tabAccessory" in chrome ? JSON.stringify(chrome.tabAccessory ?? null) : void 0;
|
|
660
|
+
if (accessory !== void 0 && accessory !== sentAccessory) {
|
|
661
|
+
sentAccessory = accessory;
|
|
662
|
+
payload.tabAccessory = chrome.tabAccessory ?? null;
|
|
663
|
+
}
|
|
664
|
+
if (Object.keys(payload).length)
|
|
665
|
+
sendOptions(payload);
|
|
666
|
+
for (const item of items.slice(1))
|
|
667
|
+
sendOptions({ tabItem: item });
|
|
634
668
|
},
|
|
635
669
|
onButton: (callback) => {
|
|
636
670
|
if (typeof callback !== "function")
|
|
@@ -50,7 +50,26 @@ export declare interface NativeNavigationOptions {
|
|
|
50
50
|
tabAccessory?: { path: string, title: string, symbol: string, badge?: string | null, accessibilityLabel?: string } | null
|
|
51
51
|
tabItem?: NativeTabItemOptions
|
|
52
52
|
}
|
|
53
|
+
/** A button every screen of the app carries, unless the screen is where it goes. */
|
|
54
|
+
export declare interface NativeChromeButton extends NativeNavigationButton {
|
|
55
|
+
open?: string
|
|
56
|
+
hideOn?: string[]
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The app's chrome: the bar buttons and tab updates every screen shares.
|
|
60
|
+
*
|
|
61
|
+
* A screen's own `leftButtons`/`rightButtons` come first and the chrome's
|
|
62
|
+
* follow; a screen button with a chrome button's id gives way to it.
|
|
63
|
+
*/
|
|
64
|
+
export declare interface NativeNavigationChrome {
|
|
65
|
+
leftButtons?: NativeChromeButton[]
|
|
66
|
+
rightButtons?: NativeChromeButton[]
|
|
67
|
+
bare?: string[]
|
|
68
|
+
tabItems?: NativeTabItemOptions[]
|
|
69
|
+
tabAccessory?: NativeNavigationOptions['tabAccessory']
|
|
70
|
+
}
|
|
53
71
|
export declare interface NativeNavigation {
|
|
72
|
+
setChrome: (chrome: NativeNavigationChrome | null) => void
|
|
54
73
|
push: (screen: string, params?: Record<string, unknown>) => string
|
|
55
74
|
replace: (screen: string, params?: Record<string, unknown>) => string
|
|
56
75
|
back: () => string
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { NativeChromeButton, NativeNavigationButton, NativeNavigationChrome, NativeTabItemOptions } from './craft';
|
|
2
|
+
/** `/m/calendar?week=2` and `https://app.test/m/calendar` are both `/m/calendar`. */
|
|
3
|
+
export declare function chromePath(value: string | undefined): string;
|
|
4
|
+
/** Whether a chrome button belongs on this screen. */
|
|
5
|
+
export declare function showsChromeButton(button: NativeChromeButton, route: ChromeRoute): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* The buttons one side of the bar shows: the screen's own, then the chrome's.
|
|
8
|
+
*
|
|
9
|
+
* A screen button with a chrome button's id gives way to it, so a screen that
|
|
10
|
+
* still draws its own account button does not end up with two.
|
|
11
|
+
*/
|
|
12
|
+
export declare function mergeChromeButtons(own: readonly NativeNavigationButton[], chrome: NativeNavigationChrome | null, side: ButtonSide, route: ChromeRoute): NativeChromeButton[];
|
|
13
|
+
/** What the host is shown for a button: no callbacks, and nothing chrome-only. */
|
|
14
|
+
export declare function hostButton(button: NativeChromeButton): NativeNavigationButton;
|
|
15
|
+
/** The key two sends compare by, so an unchanged bar is not sent again. */
|
|
16
|
+
export declare function buttonsKey(buttons: readonly NativeChromeButton[]): string;
|
|
17
|
+
/** The tab items of `chrome` that differ from what was last sent for each tab. */
|
|
18
|
+
export declare function changedTabItems(chrome: NativeNavigationChrome | null, sent: Map<string, string>): NativeTabItemOptions[];
|
|
19
|
+
/** Where the screen is, as `craft.route` says. */
|
|
20
|
+
export declare interface ChromeRoute {
|
|
21
|
+
name: string
|
|
22
|
+
path?: string
|
|
23
|
+
}
|
|
24
|
+
export type ButtonSide = 'leftButtons' | 'rightButtons';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export function chromePath(value) {
|
|
2
|
+
if (!value)
|
|
3
|
+
return "";
|
|
4
|
+
let path = value.trim();
|
|
5
|
+
const scheme = path.indexOf("://");
|
|
6
|
+
if (scheme >= 0) {
|
|
7
|
+
const slash = path.indexOf("/", scheme + 3);
|
|
8
|
+
path = slash >= 0 ? path.slice(slash) : "/";
|
|
9
|
+
}
|
|
10
|
+
const end = path.search(/[?#]/);
|
|
11
|
+
if (end >= 0)
|
|
12
|
+
path = path.slice(0, end);
|
|
13
|
+
if (path.length > 1 && path.endsWith("/"))
|
|
14
|
+
path = path.slice(0, -1);
|
|
15
|
+
return path;
|
|
16
|
+
}
|
|
17
|
+
export function showsChromeButton(button, route) {
|
|
18
|
+
if (button.hideOn?.includes(route.name))
|
|
19
|
+
return !1;
|
|
20
|
+
if (button.open && route.path && chromePath(button.open) === chromePath(route.path))
|
|
21
|
+
return !1;
|
|
22
|
+
return !0;
|
|
23
|
+
}
|
|
24
|
+
export function mergeChromeButtons(own, chrome, side, route) {
|
|
25
|
+
if (!chrome || chrome.bare?.includes(route.name))
|
|
26
|
+
return [...own];
|
|
27
|
+
const shared = (chrome[side] ?? []).filter((button) => button && button.id != null && showsChromeButton(button, route)), taken = new Set((chrome.leftButtons ?? []).concat(chrome.rightButtons ?? []).map((button) => String(button?.id)));
|
|
28
|
+
return [...own.filter((button) => !taken.has(String(button?.id))), ...shared];
|
|
29
|
+
}
|
|
30
|
+
export function hostButton(button) {
|
|
31
|
+
const { onPress, open, hideOn, ...rest } = button;
|
|
32
|
+
return rest;
|
|
33
|
+
}
|
|
34
|
+
export function buttonsKey(buttons) {
|
|
35
|
+
return JSON.stringify(buttons.map(hostButton));
|
|
36
|
+
}
|
|
37
|
+
export function changedTabItems(chrome, sent) {
|
|
38
|
+
const changed = [];
|
|
39
|
+
for (const item of chrome?.tabItems ?? []) {
|
|
40
|
+
if (!item?.id)
|
|
41
|
+
continue;
|
|
42
|
+
const key = JSON.stringify(item);
|
|
43
|
+
if (sent.get(item.id) === key)
|
|
44
|
+
continue;
|
|
45
|
+
sent.set(item.id, key);
|
|
46
|
+
changed.push(item);
|
|
47
|
+
}
|
|
48
|
+
return changed;
|
|
49
|
+
}
|
package/dist/pwa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{nr,Ue,oi,pc}from"./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-
|
|
2
|
+
import{nr,Ue,oi,pc}from"./chunk-8xwgz6jf.js";import{tr,as,lc,uc,dc}from"./chunk-tyhw0ndz.js";import{ni,ri,si,ac,cc}from"./chunk-34tbh570.js";import{ue,_t,cs}from"./chunk-ctf9gd40.js";import{fl,gl,ml,hl,Ir,Md}from"./chunk-5pa5bbzv.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-9k34a7bd.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-5rtatjwq.js";import"./chunk-
|
|
2
|
+
import"./chunk-5rtatjwq.js";import"./chunk-47csgccw.js";import"./chunk-99rfdydy.js";import{dt,pt,ft,gt,mt,ht}from"./chunk-5hqkfqne.js";import"./chunk-2bcp699b.js";import"./chunk-66e4ga0z.js";import{f,Xe,L,Z,n,o}from"./chunk-7f0gh0kg.js";import"./chunk-7fg1hzad.js";import{wr}from"./chunk-sy2nm0z7.js";import"./chunk-nmh4pn44.js";import"./chunk-8jcrtb7k.js";import"./chunk-mm8jdb4p.js";import"./chunk-0zx1400y.js";import"./chunk-epbhzaca.js";import{de,Et,Tt}from"./chunk-m2c4rx9x.js";import{Qo,ei,ti}from"./chunk-d16jgsyv.js";import{Ct,fn,gn}from"./chunk-hjp38m0w.js";import"./chunk-b3v077t7.js";import{a}from"./chunk-6ta850w8.js";import x from"fs";import g from"path";import{createHash as bt}from"crypto";function Pt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var $t=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Dt(t){return Bun.hash(t).toString(16)}function it(t,i={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,r=t.replace($t,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(i.minify)h=Pt(h);let S=Dt(h);if(!s.has(S))s.set(S,h);let P=i.integrity?` data-stx-integrity="sha384-${bt("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 Rt=new Set(["visible","idle"]);function st(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(Rt.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 kt=["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 It(t){for(let i of kt){let s=t[i];if(!s)continue;let r=q(s);if(r)return{url:r,source:"env",via:i}}return null}function at(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 Bt(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=at(e.default??e);if(l)return l}catch{}}return null}async function ot(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=at(t.stxConfig);if(r)return{url:r,source:"stx.config",via:"site.url"};let c=await Bt(i);if(c)return{url:c,source:"site.config",via:"url"};let e=It(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ct(){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 lt{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 ut{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 jt(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();Tt();let s=await o(process.cwd()),r=s.build||{},c=await ot({explicit:t.domain||r.domain,stxConfig:s});if(c.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(ct());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();Tt();let s=await o(process.cwd()),r=s.build||{},c=await ot({explicit:t.domain||r.domain,stxConfig:s});if(c.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(ct());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-0v4zcm3s.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-xs01xryj.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 lt(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-0v4zcm3s.js");await u('<div class="bg-black"></div>')}catch{}dt();let yt=s?.routeMiddleware?.dir||"middleware";await ft(process.cwd(),yt);let H=pt();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let St=s?.routeMiddleware?.global||[];ti(s?.layoutsDir,a(process.cwd()));let V=L(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${V.length} routes`);let G=[];for(let u of V){let m=await Ft(u);for(let v of m)G.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=G.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],K=[];for(let u=0;u<G.length;u+=e.concurrency)K.push(G.slice(u,u+e.concurrency));for(let u of K)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:M,props:xt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Jt(j),vt=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],tt=[...St,...vt];if(tt.length>0){let C=gt(d,M,F||{}),O=mt(C,null,void 0,{isServer:!0}),E=await ht(tt,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,_=Vt(String(R),d),T=Kt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,_),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(_),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:M})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,rt=!1;if(e.cache){if(k=B.get(d,v.filePath),k)rt=!0,l.cachedCount++}if(!k){let C=await wt(v,M,xt,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:
|
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.619",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -128,12 +128,12 @@
|
|
|
128
128
|
"dependencies": {
|
|
129
129
|
"@stacksjs/ts-css": "^0.3.11",
|
|
130
130
|
"@stacksjs/clapp": "^0.2.16",
|
|
131
|
-
"@stacksjs/desktop": "0.2.
|
|
132
|
-
"@stacksjs/sanitizer": "0.2.
|
|
131
|
+
"@stacksjs/desktop": "0.2.619",
|
|
132
|
+
"@stacksjs/sanitizer": "0.2.619",
|
|
133
133
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
134
|
-
"bun-plugin-stx": "0.2.
|
|
134
|
+
"bun-plugin-stx": "0.2.619",
|
|
135
135
|
"bunfig": "^0.15.21",
|
|
136
|
-
"stx-router": "0.2.
|
|
136
|
+
"stx-router": "0.2.619",
|
|
137
137
|
"ts-broadcasting": "^0.0.11",
|
|
138
138
|
"ts-images": "^0.2.22",
|
|
139
139
|
"ts-syntax-highlighter": "^0.2.1"
|
package/dist/chunk-1gyrk0qv.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Dt,Is,Ai,Wc}from"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{Wc as declareBareLoopHead,Dt as parseLoopBinding,Ai as processLoops,Is as reportDeferredLoopWarnings};
|
package/dist/chunk-1xzxmnsd.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ns,eu,tu}from"./chunk-zde9mef4.js";import"./chunk-jwxppaj3.js";import"./chunk-trhr4gzz.js";import"./chunk-5rtatjwq.js";import"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{tu as clearComposableCache,eu as getComposableScript,ns as listComposableModules};
|
package/dist/chunk-2a1sgnxf.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{xa,_o,Sl,Sa,ka,kl,Cl}from"./chunk-71wntraa.js";import"./chunk-zde9mef4.js";import"./chunk-jwxppaj3.js";import"./chunk-trhr4gzz.js";import"./chunk-5rtatjwq.js";import{Qe,Oc}from"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{xa as buildVirtualSource,Qe as extractScriptBlocks,Oc as extractTemplateExpressions,Sa as findRuntimeTypeDeclarations,ka as findStxModuleDeclarations,Cl as formatTypecheckDiagnostics,Sl as sourcePathFor,kl as typecheckStxFiles,_o as virtualPathFor};
|
package/dist/chunk-3fb3m640.js
DELETED
package/dist/chunk-awvbp2t4.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ru,zo,sc,Au,Pu,Iu,Ou,Du,oc,ic,Nu,Mu,Lu,ju}from"./chunk-3cg5mrtq.js";import"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{sc as SUSPENSE_RESOLVER_RUNTIME,zo as buildSuspenseResolveScript,Du as createStreamRenderer,Iu as extractStreamBoundaries,ju as generateHydrationRuntime,ic as islandDirective,Mu as processSectionDirectives,Pu as processStreamDirectives,Nu as registerStreamingDirectives,Au as renderStreamingPage,Ru as streamTemplate,Ou as streamTemplateSimple,Lu as streamToResponse,oc as streamingSuspenseDirective};
|
package/dist/chunk-bdn21f8c.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{da,pa}from"./chunk-h74p4zay.js";import"./chunk-dq58tn5x.js";import"./chunk-mqky9h29.js";import"./chunk-x7jmchd5.js";import"./chunk-8vdsewsa.js";import"./chunk-71wntraa.js";import"./chunk-qxr7e0y2.js";import"./chunk-ywxg3f9s.js";import{Eo}from"./chunk-3hzr66vn.js";import"./chunk-q3a13hvc.js";import"./chunk-5fxh7fc3.js";import"./chunk-jpe8pt9m.js";import"./chunk-4h62y8dn.js";import"./chunk-34a1jdhq.js";import"./chunk-k0kajwdw.js";import"./chunk-qzfq8342.js";import"./chunk-83h5ydvw.js";import"./chunk-45gz1yff.js";import"./chunk-8jqdb1qr.js";import"./chunk-5vs12p6m.js";import"./chunk-1bqtsjry.js";import"./chunk-azj2cj8h.js";import"./chunk-zde9mef4.js";import"./chunk-ehq5j4tb.js";import"./chunk-1q3e1w2y.js";import"./chunk-r9z467kx.js";import"./chunk-mkss8wbh.js";import"./chunk-vxa0h3yy.js";import"./chunk-t4rxr1zj.js";import"./chunk-t1cbac58.js";import"./chunk-3cg5mrtq.js";import"./chunk-3vbv4gxx.js";import"./chunk-dcs87qta.js";import"./chunk-d16jgsyv.js";import"./chunk-jwxppaj3.js";import"./chunk-trhr4gzz.js";import"./chunk-5rtatjwq.js";import{ke,vn,wn,Z,u,n,gr,A,o,he}from"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{gr as buildWebComponents,wn as cacheTemplate,vn as checkCache,Eo as classifyAllScripts,da as createMiddleware,pa as createRoute,A as defaultConfig,u as extractVariables,Z as injectRouterScript,o as loadStxConfig,ke as processClientScript,n as processDirectives,he as readMarkdownFile};
|
package/dist/chunk-c6vb28zd.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{yl}from"./chunk-dq58tn5x.js";import"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{yl as startInteractive};
|
package/dist/chunk-dcdmr6cp.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Zs,_d,Ed,Ji,we,rl,kr,Td,$d,Rd,Ad,Pd,Id,Od,Dd,Nd}from"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";export{Id as applyHead,Td as definePageMeta,Zs as getHead,_d as getPageMeta,we as mergeHeadConfigs,Od as processHeadDirective,Nd as processMetaDirective,Dd as processTitleDirective,Pd as renderBodyAttrs,Rd as renderHead,Ad as renderHtmlAttrs,Ed as resetHead,kr as seoMetaToHeadConfig,Ji as useHead,$d as usePageTitle,rl as useSeoMeta,$d as useTitle};
|
package/dist/chunk-fq4xjy4k.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{$a,Fl,Ra,Aa,zl,Hl}from"./chunk-k0kajwdw.js";import"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{Hl as applySlots,zl as extractSlotContent,Fl as parseSlotElement,$a as parseSlots,Aa as processSlots,Ra as renderSlot};
|
package/dist/chunk-h476qqq9.js
DELETED
package/dist/chunk-mf6mqs9k.js
DELETED
package/dist/chunk-n5acpvq3.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{jl}from"./chunk-jpe8pt9m.js";import"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{jl as buildApp};
|
package/dist/chunk-nvewemvh.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{bl}from"./chunk-mqky9h29.js";import"./chunk-3hzr66vn.js";import"./chunk-trhr4gzz.js";import"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{bl as startProductionServer};
|
package/dist/chunk-p1t8mm9b.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{El}from"./chunk-ywxg3f9s.js";import"./chunk-3hzr66vn.js";import"./chunk-t1cbac58.js";import"./chunk-trhr4gzz.js";import"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{El as buildForProduction};
|
package/dist/chunk-pv73vnyj.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ze,Z,Ls,js,n}from"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{Z as injectRouterScript,n as processDirectives,Ls as processJsonDirective,js as processOnceDirective,Ze as validateClientScript};
|
package/dist/chunk-t7h714ne.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Cn,Dc,Es}from"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import{Pe}from"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{Pe as freeIdentifiers,Es as processComponents,Dc as processESImports,Cn as rendersAsElement};
|
package/dist/chunk-x81g1v5x.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{md,qc,Te,Pi,hd,Os,Ds,Ns}from"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{hd as clearOnceStore,Pi as onceStore,Te as partialsCache,Os as processIncludes,Ds as processStackPushDirectives,Ns as processStackReplacements,md as resetUnscopedSignalWarnings,qc as topLevelElements};
|
package/dist/chunk-ywf6pa29.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{xu,Su}from"./chunk-t4rxr1zj.js";import"./chunk-jwxppaj3.js";import"./chunk-trhr4gzz.js";import"./chunk-5rtatjwq.js";import"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{Su as clearStoreCache,xu as getStoreScript};
|
package/dist/chunk-yxksngda.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{qo,Go,Ko,Wu}from"./chunk-temrpzxj.js";import"./chunk-3vbv4gxx.js";import"./chunk-dcs87qta.js";import"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{qo as buildNative,Wu as default,Ko as getAvailableFormats,Go as getAvailableTargets};
|
package/dist/chunk-yytfje8a.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{A,tl,Fs,o,P,bd,vd}from"./chunk-xeqysa9z.js";import"./chunk-q4t49t6z.js";import"./chunk-99rfdydy.js";import"./chunk-0zx1400y.js";import"./chunk-kt9ksp8w.js";import"./chunk-nmh4pn44.js";import"./chunk-t8akfx99.js";import"./chunk-s9jgsp0a.js";import"./chunk-k1hpxgzq.js";import"./chunk-66e4ga0z.js";import"./chunk-2bcp699b.js";import"./chunk-5hqkfqne.js";import"./chunk-mm8jdb4p.js";export{P as config,A as defaultConfig,bd as defineStxConfig,Fs as discoverConfig,o as loadStxConfig,tl as resolveStxDirectories,vd as validateConfig};
|