@stacksjs/stx 0.2.668 → 0.2.670
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-9edksf8x.js → chunk-0dxkj53f.js} +1 -1
- package/dist/{chunk-41cvkdcm.js → chunk-0gxxknfy.js} +1 -1
- package/dist/{chunk-61n06wra.js → chunk-0zqzn3hr.js} +1 -1
- package/dist/{chunk-wesafj4a.js → chunk-1a7k07b8.js} +1 -1
- package/dist/{chunk-fpz59dhz.js → chunk-28qn219e.js} +4 -4
- package/dist/{chunk-w6x8m0tz.js → chunk-2f2q31yc.js} +1 -1
- package/dist/{chunk-dtjybwtz.js → chunk-2q8maj3k.js} +1 -1
- package/dist/{chunk-rcefnd1g.js → chunk-38th7z7d.js} +5 -5
- package/dist/{chunk-2hxwds8c.js → chunk-3cr5yths.js} +1 -1
- package/dist/{chunk-avph47dc.js → chunk-3m0cebvd.js} +1 -1
- package/dist/{chunk-cyq1jcg2.js → chunk-3ttr743b.js} +5 -5
- package/dist/chunk-4ef70h09.js +2 -0
- package/dist/{chunk-0hemydnd.js → chunk-4v1582qk.js} +1 -1
- package/dist/{chunk-cba7953e.js → chunk-54gq98a2.js} +1 -1
- package/dist/{chunk-hm9jt1p9.js → chunk-57vwx6nv.js} +1 -1
- package/dist/chunk-5r6jbxyk.js +2 -0
- package/dist/chunk-6vk1jvx5.js +130 -0
- package/dist/{chunk-fb93n9ts.js → chunk-77dewvn4.js} +1 -1
- package/dist/{chunk-zcz97ber.js → chunk-7hm5asnb.js} +1 -1
- package/dist/{chunk-6z2sdfac.js → chunk-7hzjnzex.js} +1 -1
- package/dist/{chunk-fmkcc7g1.js → chunk-82w7h48a.js} +1 -1
- package/dist/{chunk-s5w3t7xw.js → chunk-8p14rew3.js} +1 -1
- package/dist/{chunk-ca6vx6vg.js → chunk-8yry75vs.js} +1 -1
- package/dist/{chunk-65b6cy92.js → chunk-beccrqdy.js} +1 -1
- package/dist/chunk-ccwattyw.js +2 -0
- package/dist/{chunk-060298px.js → chunk-cxc3zdhn.js} +2 -2
- package/dist/{chunk-3641xvaw.js → chunk-cxmdbhwb.js} +1 -1
- package/dist/{chunk-heh151bn.js → chunk-dxc782vg.js} +1 -1
- package/dist/{chunk-6tngeb4b.js → chunk-e7avmdqn.js} +1 -1
- package/dist/{chunk-vg9bz5zs.js → chunk-egt49kgq.js} +1 -1
- package/dist/chunk-f87ycgnc.js +2 -0
- package/dist/chunk-ffd48ere.js +2 -0
- package/dist/{chunk-3n9vaxnt.js → chunk-h1gjww3q.js} +1 -1
- package/dist/{chunk-k5mez1vx.js → chunk-h1qz5xd6.js} +1 -1
- package/dist/{chunk-hkqhpckf.js → chunk-hjccqjt4.js} +1 -1
- package/dist/{chunk-9k2wz3k1.js → chunk-hvsv59f5.js} +2 -2
- package/dist/{chunk-t7jxkrbx.js → chunk-jy89bcma.js} +1 -1
- package/dist/{chunk-e8gcqp8w.js → chunk-kjhbchxn.js} +2 -2
- package/dist/{chunk-4m1hye28.js → chunk-m2znv53p.js} +1 -1
- package/dist/{chunk-02gn092e.js → chunk-mrs4sw7d.js} +1 -1
- package/dist/chunk-ng1mgtph.js +2 -0
- package/dist/{chunk-kpeep7gq.js → chunk-p450pdx3.js} +1 -1
- package/dist/{chunk-zdgsj39g.js → chunk-pgs6p767.js} +1 -1
- package/dist/{chunk-x986xz7h.js → chunk-pjdsvqzc.js} +1 -1
- package/dist/chunk-q19vdv8m.js +2 -0
- package/dist/chunk-qmtpvrz4.js +2 -0
- package/dist/{chunk-c4qebqmk.js → chunk-qqzmmnga.js} +1 -1
- package/dist/{chunk-sme31jbj.js → chunk-rmdc1bqn.js} +1 -1
- package/dist/{chunk-ynh1ppa6.js → chunk-rt2v4sy2.js} +1 -1
- package/dist/{chunk-vdjj4vrp.js → chunk-rwyexk13.js} +6 -6
- package/dist/{chunk-dy5j389v.js → chunk-sbvmcwqg.js} +2 -2
- package/dist/{chunk-8kskjg62.js → chunk-skwjbhfh.js} +1 -1
- package/dist/{chunk-4teqcbw0.js → chunk-tm6z49c5.js} +2 -2
- package/dist/{chunk-6by8f7n9.js → chunk-tnfbx8he.js} +4 -4
- package/dist/{chunk-t01c62y5.js → chunk-v2yjapag.js} +1 -1
- package/dist/{chunk-9vaz5f9j.js → chunk-wf7wxa9h.js} +1 -1
- package/dist/chunk-x4t3mjg0.js +2 -0
- package/dist/{chunk-c3dk9pkf.js → chunk-xsbacs9w.js} +1 -1
- package/dist/chunk-y4n984em.js +2 -0
- package/dist/{chunk-493x6e71.js → chunk-zgg6w9pt.js} +2 -2
- package/dist/{chunk-tq0bgaae.js → chunk-zrged04y.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/compiler/component-mapping.js +2 -0
- package/dist/native/compiler/html-to-ir.js +35 -2
- package/dist/native/compiler/ir.d.ts +1 -0
- package/dist/native/compiler/layout-chrome.js +51 -4
- package/dist/native/components/primitives.d.ts +18 -0
- package/dist/native/components/primitives.js +1 -0
- package/dist/native/index.d.ts +2 -0
- package/dist/native/primitives/NativeSegmentedControl.stx +5 -0
- package/dist/native/prop-names.js +8 -1
- package/dist/native/runtime/browser-renderer.js +23 -1
- package/dist/native/runtime/craft-bridge.js +2 -1
- package/dist/native/runtime/native-host.js +46 -3
- package/dist/native/runtime/web-storage.js +41 -8
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-2ecgyqam.js +0 -2
- package/dist/chunk-gkmpr64n.js +0 -2
- package/dist/chunk-hj0raner.js +0 -2
- package/dist/chunk-hx9cn2s4.js +0 -2
- package/dist/chunk-n7a33e3v.js +0 -2
- package/dist/chunk-r7cenpxp.js +0 -2
- package/dist/chunk-sz6xdz4h.js +0 -2
- package/dist/chunk-tw0wc95k.js +0 -2
- package/dist/chunk-v0091n1g.js +0 -2
- package/dist/chunk-vfba7nz5.js +0 -129
- package/dist/chunk-vryzt0p0.js +0 -2
|
@@ -60,7 +60,7 @@ export const HOST_METHODS = [
|
|
|
60
60
|
];
|
|
61
61
|
function followsHref() {}
|
|
62
62
|
export function createNativeHost(options) {
|
|
63
|
-
const records = new Map, attributeObservers = new WeakMap, childObservers = new WeakMap, handlers = new Map, eventRegistrations = new WeakMap, componentListeners = new WeakMap, controlsWithDefaultListeners = new WeakSet, formResetCallbacks = new WeakMap;
|
|
63
|
+
const records = new Map, attributeObservers = new WeakMap, childObservers = new WeakMap, handlers = new Map, eventRegistrations = new WeakMap, componentListeners = new WeakMap, controlsWithDefaultListeners = new WeakSet, implicitSubmitListeners = new WeakMap, formResetCallbacks = new WeakMap;
|
|
64
64
|
let queue = [], scheduled = !1, counter = 0, colorScheme = options.colorScheme ?? "light", viewportWidth = Number.isFinite(options.viewportWidth) ? Math.max(0, options.viewportWidth) : 0, stylesheetVariables = createStyleVariables(options.stylesheetTheme?.[colorScheme] ?? []).computed(), disposed = !1;
|
|
65
65
|
const schedule = options.schedule ?? ((flush) => queueMicrotask(flush)), { followLink, linkState } = options, nextId = (prefix) => `${prefix}${++counter}`;
|
|
66
66
|
function notifyAttributes(node, name) {
|
|
@@ -283,6 +283,7 @@ export function createNativeHost(options) {
|
|
|
283
283
|
}
|
|
284
284
|
function installControlListeners(node) {
|
|
285
285
|
const record = descriptorOf(node);
|
|
286
|
+
syncImplicitSubmit(node);
|
|
286
287
|
if (record?.type === "TextInput" && !record.focusListenersInstalled) {
|
|
287
288
|
record.focusListenersInstalled = !0;
|
|
288
289
|
host.listen(node, "focus", () => {});
|
|
@@ -308,6 +309,28 @@ export function createNativeHost(options) {
|
|
|
308
309
|
if (record.type === "Button" || record.type === "Pressable")
|
|
309
310
|
host.listen(node, "click", () => {});
|
|
310
311
|
}
|
|
312
|
+
function syncImplicitSubmit(node) {
|
|
313
|
+
const record = descriptorOf(node);
|
|
314
|
+
if (record?.type !== "TextInput")
|
|
315
|
+
return;
|
|
316
|
+
const eligible = !!formOwner(node) && !record.props.multiline && hostProps(record).returnKeyType !== "next", previous = implicitSubmitListeners.get(node);
|
|
317
|
+
if (eligible && !previous) {
|
|
318
|
+
const listener = () => {};
|
|
319
|
+
implicitSubmitListeners.set(node, { listener, stop: host.listen(node, "submit-editing", listener) });
|
|
320
|
+
} else if (!eligible && previous) {
|
|
321
|
+
previous.stop();
|
|
322
|
+
implicitSubmitListeners.delete(node);
|
|
323
|
+
if (!componentListeners.get(node)?.some((listener) => (NATIVE_EVENT_NAMES[listener.event.toLowerCase()] ?? listener.event) === "onSubmitEditing")) {
|
|
324
|
+
const id = record.events.onSubmitEditing;
|
|
325
|
+
if (id)
|
|
326
|
+
handlers.delete(id);
|
|
327
|
+
eventRegistrations.get(node)?.delete("onSubmitEditing");
|
|
328
|
+
delete record.events.onSubmitEditing;
|
|
329
|
+
if (record.materialized)
|
|
330
|
+
emit({ op: "updateNode", id: node.__stxId, patch: { events: { onSubmitEditing: "" } } });
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
311
334
|
function materialize(node) {
|
|
312
335
|
const record = recordOf(node);
|
|
313
336
|
if (record.materialized || node.__stxAnchor !== void 0)
|
|
@@ -743,6 +766,8 @@ export function createNativeHost(options) {
|
|
|
743
766
|
}
|
|
744
767
|
const record = recordOf(node), prop = nativePropName(name, record.type), accessibilityBefore = prop === "role" || prop.startsWith("aria-") || prop.startsWith("accessibility") ? projectAccessibility(record.props) : void 0, textEntryBefore = TEXT_ENTRY_SOURCES.has(prop) ? projectTextEntry(record.type, record.props) : void 0, wasDisabled = disabled(record);
|
|
745
768
|
record.props[prop] = value;
|
|
769
|
+
if (TEXT_ENTRY_SOURCES.has(prop) || prop === "multiline")
|
|
770
|
+
syncImplicitSubmit(node);
|
|
746
771
|
if (record.focused && disabled(record)) {
|
|
747
772
|
record.focused = !1;
|
|
748
773
|
refreshFocusChain(node);
|
|
@@ -926,10 +951,13 @@ export function createNativeHost(options) {
|
|
|
926
951
|
const data = payload && typeof payload === "object" ? payload : {}, value = data.text ?? data.value ?? data.nativeEvent?.text ?? data.nativeEvent?.value, record = recordOf(node);
|
|
927
952
|
if (record.type === "Checkbox" && value !== void 0)
|
|
928
953
|
node.checked = Boolean(value);
|
|
929
|
-
|
|
954
|
+
const eventCount = data.eventCount ?? data.nativeEvent?.eventCount, acknowledgesEdit = record.type === "TextInput" && Number.isSafeInteger(eventCount) && eventCount >= 0;
|
|
955
|
+
if (acknowledgesEdit)
|
|
956
|
+
record.props.mostRecentEventCount = eventCount;
|
|
957
|
+
if (value !== void 0 && (acknowledgesEdit || !Object.is(record.props.value, value)) && (record.type === "TextInput" || record.type === "Picker" || record.type === "SegmentedControl" || record.type === "Switch")) {
|
|
930
958
|
record.props.value = value;
|
|
931
959
|
if (record.materialized)
|
|
932
|
-
emit({ op: "updateNode", id: node.__stxId, patch: { props: { value } } });
|
|
960
|
+
emit({ op: "updateNode", id: node.__stxId, patch: { props: acknowledgesEdit ? { value, mostRecentEventCount: eventCount } : { value } } });
|
|
933
961
|
}
|
|
934
962
|
}
|
|
935
963
|
const delivered = eventAt(payload, node, event), physical = delivered && typeof delivered === "object" ? delivered : null, ancestors = [node];
|
|
@@ -983,6 +1011,21 @@ export function createNativeHost(options) {
|
|
|
983
1011
|
break;
|
|
984
1012
|
}
|
|
985
1013
|
const form = formOwner(node);
|
|
1014
|
+
if (form && nativeEvent === "onSubmitEditing" && !physical?.defaultPrevented && !record.props.multiline && hostProps(record).returnKeyType !== "next") {
|
|
1015
|
+
const implicit = implicitSubmitListeners.get(node), authored = componentListeners.get(node)?.some((listener) => (NATIVE_EVENT_NAMES[listener.event.toLowerCase()] ?? listener.event) === "onSubmitEditing" && listener.handler !== implicit?.listener);
|
|
1016
|
+
if (implicit && !authored) {
|
|
1017
|
+
const submitter = collectDescendants(form).find((control) => {
|
|
1018
|
+
const candidate = descriptorOf(control);
|
|
1019
|
+
return candidate?.materialized && ["Button", "Pressable"].includes(candidate.type) && candidate.props.type === "submit" && formOwner(control) === form;
|
|
1020
|
+
});
|
|
1021
|
+
if (submitter) {
|
|
1022
|
+
const candidate = descriptorOf(submitter);
|
|
1023
|
+
if (!disabled(candidate) && candidate.events.onPress)
|
|
1024
|
+
host.dispatch(candidate.events.onPress, {});
|
|
1025
|
+
} else
|
|
1026
|
+
host.emitComponentEvent(form, eventAt({}, form, "submit"));
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
986
1029
|
if (form && nativeEvent === "onPress" && !physical?.defaultPrevented && !disabled(record)) {
|
|
987
1030
|
if (record.props.type === "submit")
|
|
988
1031
|
host.emitComponentEvent(form, eventAt({ submitter: node }, form, "submit"));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const NATIVE_WEB_STORAGE_PREFIX = { local: "stx.localStorage:", session: "stx.sessionStorage:" }, NATIVE_SESSION_RUN_KEY = "stx.sessionStorage.run";
|
|
2
|
-
const INDEX = "\x00keys", RAW = Symbol("stx.nativeWebStorage.raw");
|
|
2
|
+
const INDEX = "\x00keys", METADATA_PREFIX = "stx.webStorage.metadata:", RAW = Symbol("stx.nativeWebStorage.raw");
|
|
3
3
|
|
|
4
4
|
export class NativeWebStorage {
|
|
5
5
|
#read;
|
|
@@ -23,12 +23,45 @@ export class NativeWebStorage {
|
|
|
23
23
|
throw Object.assign(Error("This app keeps no storage for native screens"), { name: "SecurityError" });
|
|
24
24
|
return store;
|
|
25
25
|
}
|
|
26
|
+
#metadata() {
|
|
27
|
+
const value = this.#store().getSync(METADATA_PREFIX + this.#prefix);
|
|
28
|
+
if (value && Array.isArray(value.keys))
|
|
29
|
+
return { keys: value.keys.filter((key) => typeof key === "string"), escaped: value.escaped ?? {} };
|
|
30
|
+
let legacy;
|
|
31
|
+
try {
|
|
32
|
+
legacy = this.#store().getSync(this.#prefix + INDEX);
|
|
33
|
+
} catch {
|
|
34
|
+
legacy = null;
|
|
35
|
+
}
|
|
36
|
+
return { keys: Array.isArray(legacy) ? legacy.filter((key) => typeof key === "string") : [], escaped: {} };
|
|
37
|
+
}
|
|
26
38
|
#keys() {
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
return this.#metadata().keys;
|
|
40
|
+
}
|
|
41
|
+
#saveMetadata(metadata) {
|
|
42
|
+
this.#store().setSync(METADATA_PREFIX + this.#prefix, metadata.keys.length || Object.keys(metadata.escaped).length ? metadata : null);
|
|
43
|
+
try {
|
|
44
|
+
if (this.#store().getSync(this.#prefix + INDEX) !== null)
|
|
45
|
+
this.#store().setSync(this.#prefix + INDEX, null);
|
|
46
|
+
} catch {}
|
|
29
47
|
}
|
|
30
48
|
#writeKeys(keys) {
|
|
31
|
-
this.#
|
|
49
|
+
this.#saveMetadata({ ...this.#metadata(), keys });
|
|
50
|
+
}
|
|
51
|
+
#escaped(key) {
|
|
52
|
+
return key.includes("\x00") || (this.#prefix + key).length > 512;
|
|
53
|
+
}
|
|
54
|
+
#writeValue(key, value) {
|
|
55
|
+
if (!this.#escaped(key))
|
|
56
|
+
this.#store().setSync(this.#prefix + key, value);
|
|
57
|
+
else {
|
|
58
|
+
const metadata = this.#metadata(), escaped = { ...metadata.escaped };
|
|
59
|
+
if (value === null)
|
|
60
|
+
delete escaped[key];
|
|
61
|
+
else
|
|
62
|
+
Object.defineProperty(escaped, key, { value, enumerable: !0, configurable: !0, writable: !0 });
|
|
63
|
+
this.#saveMetadata({ ...metadata, escaped });
|
|
64
|
+
}
|
|
32
65
|
}
|
|
33
66
|
#liveKeys() {
|
|
34
67
|
this.#hooks?.readAll();
|
|
@@ -59,13 +92,13 @@ export class NativeWebStorage {
|
|
|
59
92
|
clear() {
|
|
60
93
|
const keys = this.#keys();
|
|
61
94
|
for (const key of keys)
|
|
62
|
-
this.#
|
|
95
|
+
this.#writeValue(key, null);
|
|
63
96
|
this.#writeKeys([]);
|
|
64
97
|
for (const key of keys)
|
|
65
98
|
this.#hooks?.wrote(key);
|
|
66
99
|
}
|
|
67
100
|
#get(key) {
|
|
68
|
-
const value = this.#store().getSync(this.#prefix + key);
|
|
101
|
+
const escaped = this.#escaped(key) ? this.#metadata().escaped : null, value = escaped ? Object.hasOwn(escaped, key) ? escaped[key] : null : this.#store().getSync(this.#prefix + key);
|
|
69
102
|
if (this.#run) {
|
|
70
103
|
if (!value || typeof value !== "object" || value.run !== this.#run())
|
|
71
104
|
return null;
|
|
@@ -75,13 +108,13 @@ export class NativeWebStorage {
|
|
|
75
108
|
return typeof value === "string" ? value : null;
|
|
76
109
|
}
|
|
77
110
|
#set(key, text) {
|
|
78
|
-
this.#
|
|
111
|
+
this.#writeValue(key, this.#run ? { run: this.#run(), value: text } : text);
|
|
79
112
|
const keys = this.#keys();
|
|
80
113
|
if (!keys.includes(key))
|
|
81
114
|
this.#writeKeys([...keys, key]);
|
|
82
115
|
}
|
|
83
116
|
#remove(key) {
|
|
84
|
-
this.#
|
|
117
|
+
this.#writeValue(key, null);
|
|
85
118
|
const keys = this.#keys();
|
|
86
119
|
if (keys.includes(key))
|
|
87
120
|
this.#writeKeys(keys.filter((other) => other !== key));
|
package/dist/pwa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{Es,jt,bc,gu}from"./chunk-ecqrkyg8.js";import{Cs,Xo,du,pu,fu}from"./chunk-xqp4hstk.js";import{mc,hc,yc,lu,uu}from"./chunk-wpmrz872.js";import{ze,wn,Jo}from"./chunk-30nes8ne.js";import{mu,hu,yu,bu,Ts,qp}from"./chunk-qv6axke4.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-ng1mgtph.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-md2jn67b.js";import"./chunk-2dp7hyv7.js";import"./chunk-pxdww4rb.js";import"./chunk-ce6zddpf.js";import"./chunk-
|
|
2
|
+
import"./chunk-md2jn67b.js";import"./chunk-2dp7hyv7.js";import"./chunk-pxdww4rb.js";import"./chunk-ce6zddpf.js";import"./chunk-rwyexk13.js";import"./chunk-1sr6c0nk.js";import"./chunk-p450pdx3.js";import"./chunk-a3d0g4mr.js";import{wt,xt,St,kt,_t,Ct}from"./chunk-365vg0eg.js";import{o}from"./chunk-hvsv59f5.js";import{Yr}from"./chunk-fzqj1mjz.js";import"./chunk-04kg16qs.js";import"./chunk-rmdc1bqn.js";import{Ce,Gt,Kt}from"./chunk-7hm5asnb.js";import"./chunk-7hzjnzex.js";import{h}from"./chunk-sbvmcwqg.js";import{gt,s}from"./chunk-38th7z7d.js";import"./chunk-57vwx6nv.js";import"./chunk-tnfbx8he.js";import"./chunk-2q8maj3k.js";import"./chunk-cxc3zdhn.js";import"./chunk-prf164ct.js";import{Ji,Yi,Zi}from"./chunk-6ajahb2x.js";import{qt,jn,Bn}from"./chunk-xaa36b0x.js";import"./chunk-ka8befem.js";import{V,me}from"./chunk-28qn219e.js";import"./chunk-p472crv1.js";import"./chunk-0dxkj53f.js";import{c}from"./chunk-zhf01af3.js";import x from"fs";import g from"path";import{createHash as mt}from"crypto";function yt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var vt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function bt(t){return Bun.hash(t).toString(16)}function nt(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let i=new Map,r=t.replace(vt,(e,l,w,y)=>{let f=y.trim();if(!f)return e;if(/\bdata-stx-src=/.test(w))return e;if(n.minify)f=yt(f);let S=bt(f);if(!i.has(S))i.set(S,f);let P=n.integrity?` data-stx-integrity="sha384-${mt("sha384").update(f).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),a=Array.from(i,([e,l])=>({hash:e,code:l}));return{html:r,chunks:a}}var Pt=new Set(["visible","idle"]);function it(t){if(!t.includes("data-stx-src="))return t;let n=new Map,i=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,r;while((r=i.exec(t))!==null)n.set(r[1],r[2]);let a=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(Pt.has(n.get(l[1])||""))a.add(l[2]);let w=t.lastIndexOf("</head>");if(a.size===0||w===-1)return t;let y=Array.from(a).filter((f)=>!t.includes(`rel="prefetch" href="${f}"`)).map((f)=>`<link rel="prefetch" href="${f}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var $t=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function W(t){let n=t.trim();if(!n)return null;let i=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(i).origin+new URL(i).pathname.replace(/\/$/,"")}catch{return null}}function Dt(t){for(let n of $t){let i=t[n];if(!i)continue;let r=W(i);if(r)return{url:r,source:"env",via:n}}return null}function st(t){if(!t||typeof t!=="object")return null;let n=t,i=n.site?.url??n.url??n.app?.url;return typeof i==="string"?W(i):null}async function Rt(t){let{existsSync:n}=await import("fs"),i=await import("path");for(let r of["site.config.ts","site.config.js",".config/site.config.ts"]){let a=i.resolve(t,r);if(!n(a))continue;try{let e=await import(a),l=st(e.default??e);if(l)return l}catch{}}return null}async function at(t={}){let n=t.cwd??process.cwd(),i=t.env??process.env;if(t.explicit){let l=W(t.explicit);if(l)return{url:l,source:"option"}}let r=st(t.stxConfig);if(r)return{url:r,source:"stx.config",via:"site.url"};let a=await Rt(n);if(a)return{url:a,source:"site.config",via:"url"};let e=Dt(i);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ot(){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 ct{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,n=""){this.cacheDir=t,this.salt=n}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let n=JSON.parse(await Bun.file(t).text());for(let[i,r]of Object.entries(n))this.cache.set(i,r)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),n={};for(let[i,r]of this.cache)n[i]=r;await Bun.write(t,JSON.stringify(n))}getHash(t,n){let i=x.statSync(t),r=`${this.salt}|${t}:${i.mtimeMs}`;for(let e of n)if(x.existsSync(e)){let l=x.statSync(e);r+=`:${e}:${l.mtimeMs}`}let a=0;for(let e=0;e<r.length;e++){let l=r.charCodeAt(e);a=(a<<5)-a+l,a=a&a}return Math.abs(a).toString(36)}get(t,n){let i=this.cache.get(t);if(!i)return null;let r=this.getHash(n,i.dependencies??[]);if(i.hash!==r)return this.cache.delete(t),null;return i.html}set(t,n,i,r){let a=this.getHash(n,i);this.cache.set(t,{hash:a,html:r,generatedAt:Date.now(),dependencies:i})}}class lt{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let n=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",n)}async get(t){let n=this.getFilePath(t);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(t,n){let i=this.getFilePath(t);await x.promises.mkdir(g.dirname(i),{recursive:!0}),await Bun.write(i,JSON.stringify(n))}async invalidate(t){let n=this.getFilePath(t);if(await Bun.file(n).exists())await x.promises.unlink(n)}async invalidatePattern(t){let n=g.join(this.cacheDir,"isr");if(!x.existsSync(n))return;let i=await x.promises.readdir(n);for(let r of i){let a=r.replace(/_/g,"/").replace(".json","");if(t.test(a))await x.promises.unlink(g.join(n,r))}}async needsRevalidation(t){let n=await this.get(t);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function Et(t){try{let i=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!i)return null;let r=i[1];if(!r.includes("getStaticPaths"))return null;let a=r.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!a)return null;return await Function(`
|
|
4
4
|
return (async function getStaticPaths() {
|
|
5
5
|
${a[1]}
|
|
@@ -41,7 +41,7 @@ ${t.map((r)=>{let a=new URL(r.loc,n).href,e=` <url>
|
|
|
41
41
|
${i.join(`
|
|
42
42
|
`)}
|
|
43
43
|
</channel>
|
|
44
|
-
</rss>`}async function Ut(t={}){let n=Date.now();Kt();let i=await o(process.cwd()),r=i.build||{},a=await at({explicit:t.domain||r.domain,stxConfig:i});if(a.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(ot());let e={router:t.router??i?.router??{},pagesDir:t.pagesDir||r.pagesDir||"pages",outputDir:t.outputDir||r.outputDir||"dist",baseUrl:t.baseUrl||r.baseUrl||"/",domain:a.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||c(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||i?.partialsDir||"",componentsDir:t.componentsDir||i?.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,f={},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 Ut(t={}){let n=Date.now();Kt();let i=await o(process.cwd()),r=i.build||{},a=await at({explicit:t.domain||r.domain,stxConfig:i});if(a.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(ot());let e={router:t.router??i?.router??{},pagesDir:t.pagesDir||r.pagesDir||"pages",outputDir:t.outputDir||r.outputDir||"dist",baseUrl:t.baseUrl||r.baseUrl||"/",domain:a.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||c(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||i?.partialsDir||"",componentsDir:t.componentsDir||i?.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,f={},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-skwjbhfh.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-e7avmdqn.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 ct(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-skwjbhfh.js");await u('<div class="bg-black"></div>')}catch{}wt();let dt=i?.routeMiddleware?.dir||"middleware";await St(process.cwd(),dt);let z=xt();if(z.length>0)console.log(`Loaded ${z.length} middleware: ${z.join(", ")}`);let pt=i?.routeMiddleware?.global||[];Zi(i?.layoutsDir,c(process.cwd()));let J=V(".",{pagesDir:e.pagesDir,pagesDirs:i?._layerPageDirs});console.log(`Found ${J.length} routes`);let _=[];for(let u of J){let m=await It(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:ht,revalidate:Z}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Wt(j),ft=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],Q=[...pt,...ft];if(Q.length>0){let C=kt(d,L,F||{}),O=_t(C,null,void 0,{isServer:!0}),E=await Ct(Q,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,U=Jt(String(R),d),T=Vt(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 tt=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(tt)try{if(!await Function("route",`
|
|
45
45
|
const validate = ${tt[1]};
|
|
46
46
|
return validate(route);
|
|
47
47
|
`)({params:L})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,et=!1;if(e.cache){if(k=B.get(d,v.filePath),k)et=!0,l.cachedCount++}if(!k){let C=await ut(v,L,ht,e,i);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.670",
|
|
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.669",
|
|
132
|
+
"@stacksjs/sanitizer": "0.2.669",
|
|
133
133
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
134
|
-
"bun-plugin-stx": "0.2.
|
|
134
|
+
"bun-plugin-stx": "0.2.670",
|
|
135
135
|
"bunfig": "^0.15.21",
|
|
136
|
-
"stx-router": "0.2.
|
|
136
|
+
"stx-router": "0.2.669",
|
|
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-2ecgyqam.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Tu}from"./chunk-vg9bz5zs.js";import"./chunk-rcefnd1g.js";import"./chunk-dy5j389v.js";import"./chunk-prf164ct.js";import"./chunk-dtjybwtz.js";import"./chunk-6by8f7n9.js";import"./chunk-hm9jt1p9.js";import"./chunk-ka8befem.js";import"./chunk-060298px.js";import"./chunk-fpz59dhz.js";import"./chunk-p472crv1.js";import"./chunk-6z2sdfac.js";import"./chunk-9k2wz3k1.js";import"./chunk-9edksf8x.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{Tu as startInteractive};
|
package/dist/chunk-gkmpr64n.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Pc,ki,Iu,Ic,Oc,Ou,Nu}from"./chunk-3641xvaw.js";import"./chunk-65b6cy92.js";import"./chunk-zcz97ber.js";import"./chunk-sme31jbj.js";import"./chunk-md2jn67b.js";import"./chunk-060298px.js";import"./chunk-fpz59dhz.js";import"./chunk-p472crv1.js";import"./chunk-9k2wz3k1.js";import"./chunk-9edksf8x.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import{$t,Fl}from"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{Pc as buildVirtualSource,$t as extractScriptBlocks,Fl as extractTemplateExpressions,Ic as findRuntimeTypeDeclarations,Oc as findStxModuleDeclarations,Nu as formatTypecheckDiagnostics,Iu as sourcePathFor,Ou as typecheckStxFiles,ki as virtualPathFor};
|
package/dist/chunk-hj0raner.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Bd,Fd}from"./chunk-t01c62y5.js";import"./chunk-zcz97ber.js";import"./chunk-sme31jbj.js";import"./chunk-md2jn67b.js";import"./chunk-060298px.js";import"./chunk-fpz59dhz.js";import"./chunk-p472crv1.js";import"./chunk-9k2wz3k1.js";import"./chunk-9edksf8x.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{Fd as clearStoreCache,Bd as getStoreScript};
|
package/dist/chunk-hx9cn2s4.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Mu}from"./chunk-2hxwds8c.js";import"./chunk-4teqcbw0.js";import"./chunk-3y41efsf.js";import"./chunk-sme31jbj.js";import"./chunk-rcefnd1g.js";import"./chunk-dy5j389v.js";import"./chunk-prf164ct.js";import"./chunk-dtjybwtz.js";import"./chunk-6by8f7n9.js";import"./chunk-hm9jt1p9.js";import"./chunk-ka8befem.js";import"./chunk-060298px.js";import"./chunk-fpz59dhz.js";import"./chunk-p472crv1.js";import"./chunk-6z2sdfac.js";import"./chunk-9k2wz3k1.js";import"./chunk-9edksf8x.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{Mu as buildForProduction};
|
package/dist/chunk-n7a33e3v.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{rd,Li,il,sd,od,id,ad,cd,al,cl,ld,ud,dd,pd}from"./chunk-61n06wra.js";import"./chunk-rcefnd1g.js";import"./chunk-dy5j389v.js";import"./chunk-prf164ct.js";import"./chunk-dtjybwtz.js";import"./chunk-6by8f7n9.js";import"./chunk-hm9jt1p9.js";import"./chunk-ka8befem.js";import"./chunk-060298px.js";import"./chunk-fpz59dhz.js";import"./chunk-p472crv1.js";import"./chunk-6z2sdfac.js";import"./chunk-9k2wz3k1.js";import"./chunk-9edksf8x.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{il as SUSPENSE_RESOLVER_RUNTIME,Li as buildSuspenseResolveScript,cd as createStreamRenderer,id as extractStreamBoundaries,pd as generateHydrationRuntime,cl as islandDirective,ud as processSectionDirectives,od as processStreamDirectives,ld as registerStreamingDirectives,sd as renderStreamingPage,rd as streamTemplate,ad as streamTemplateSimple,dd as streamToResponse,al as streamingSuspenseDirective};
|
package/dist/chunk-r7cenpxp.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Hn,s}from"./chunk-rcefnd1g.js";import"./chunk-dy5j389v.js";import"./chunk-prf164ct.js";import"./chunk-dtjybwtz.js";import"./chunk-6by8f7n9.js";import"./chunk-hm9jt1p9.js";import"./chunk-ka8befem.js";import"./chunk-060298px.js";import{me}from"./chunk-fpz59dhz.js";import"./chunk-p472crv1.js";import"./chunk-6z2sdfac.js";import"./chunk-9k2wz3k1.js";import"./chunk-9edksf8x.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import{Ae,ps,gs}from"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{Hn as buildModulesTag,me as injectRouterScript,s as processDirectives,ps as processJsonDirective,gs as processOnceDirective,Ae as validateClientScript};
|
package/dist/chunk-sz6xdz4h.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{xc,Sc}from"./chunk-cyq1jcg2.js";import"./chunk-vg9bz5zs.js";import"./chunk-t7jxkrbx.js";import"./chunk-7met6yva.js";import"./chunk-7d4z944r.js";import"./chunk-3641xvaw.js";import"./chunk-zqtbtqbq.js";import"./chunk-2hxwds8c.js";import{_i}from"./chunk-4teqcbw0.js";import"./chunk-jxda11cg.js";import"./chunk-89jbdtgw.js";import"./chunk-4m1hye28.js";import"./chunk-rcadtv3x.js";import"./chunk-41cvkdcm.js";import"./chunk-b823zxq6.js";import"./chunk-ym41ybz2.js";import"./chunk-n38yb274.js";import"./chunk-k5mez1vx.js";import"./chunk-tre98h62.js";import"./chunk-61n06wra.js";import"./chunk-dgb4z4kw.js";import"./chunk-r3e6x87d.js";import"./chunk-mmwedr93.js";import"./chunk-aprhqxky.js";import"./chunk-kgfgb971.js";import"./chunk-nrvwejdw.js";import"./chunk-t01c62y5.js";import"./chunk-65b6cy92.js";import"./chunk-3y41efsf.js";import"./chunk-493x6e71.js";import"./chunk-yfvm7q6t.js";import"./chunk-6ajahb2x.js";import"./chunk-zcz97ber.js";import"./chunk-sme31jbj.js";import"./chunk-md2jn67b.js";import{Te,s}from"./chunk-rcefnd1g.js";import"./chunk-dy5j389v.js";import"./chunk-prf164ct.js";import"./chunk-dtjybwtz.js";import"./chunk-6by8f7n9.js";import"./chunk-hm9jt1p9.js";import"./chunk-ka8befem.js";import"./chunk-060298px.js";import{me}from"./chunk-fpz59dhz.js";import"./chunk-p472crv1.js";import{Xn,Jn}from"./chunk-6z2sdfac.js";import{qr,N,o}from"./chunk-9k2wz3k1.js";import"./chunk-9edksf8x.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import{g,Ne}from"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";import"./chunk-9p6efb17.js";import"./chunk-t2pzy3x1.js";export{qr as buildWebComponents,Jn as cacheTemplate,Xn as checkCache,_i as classifyAllScripts,xc as createMiddleware,Sc as createRoute,N as defaultConfig,g as extractVariables,me as injectRouterScript,o as loadStxConfig,Ne as processClientScript,s as processDirectives,Te as readMarkdownFile};
|
package/dist/chunk-tw0wc95k.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{zs,zd,Hd}from"./chunk-65b6cy92.js";import"./chunk-zcz97ber.js";import"./chunk-sme31jbj.js";import"./chunk-md2jn67b.js";import"./chunk-060298px.js";import"./chunk-fpz59dhz.js";import"./chunk-p472crv1.js";import"./chunk-9k2wz3k1.js";import"./chunk-9edksf8x.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{Hd as clearComposableCache,zd as getComposableScript,zs as listComposableModules};
|
package/dist/chunk-v0091n1g.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Hi,Vi,Ui,Wi,tp}from"./chunk-cba7953e.js";import"./chunk-493x6e71.js";import"./chunk-yfvm7q6t.js";import"./chunk-rcefnd1g.js";import"./chunk-dy5j389v.js";import"./chunk-prf164ct.js";import"./chunk-dtjybwtz.js";import"./chunk-6by8f7n9.js";import"./chunk-hm9jt1p9.js";import"./chunk-ka8befem.js";import"./chunk-060298px.js";import"./chunk-fpz59dhz.js";import"./chunk-p472crv1.js";import"./chunk-6z2sdfac.js";import"./chunk-9k2wz3k1.js";import"./chunk-9edksf8x.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import"./chunk-vdjj4vrp.js";import"./chunk-kpeep7gq.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{Hi as buildNative,tp as default,Vi as findCraftBinary,Wi as getAvailableFormats,Ui as getAvailableTargets};
|