@stacksjs/stx 0.2.669 → 0.2.671
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-144yp2bw.js → chunk-10np2c03.js} +1 -1
- package/dist/{chunk-nytb5e4v.js → chunk-11c5q4h7.js} +2 -2
- package/dist/{chunk-nzj3a6mj.js → chunk-1pw1nvta.js} +1 -1
- package/dist/{chunk-9hngzqp5.js → chunk-1s6j0k3c.js} +1 -1
- package/dist/{chunk-5pe26hxm.js → chunk-1yf17fzh.js} +1 -1
- package/dist/{chunk-1mz8fw0m.js → chunk-1zeerj7e.js} +4 -4
- package/dist/{chunk-p23sz4rr.js → chunk-2j996te9.js} +6 -6
- package/dist/{chunk-8rx1bves.js → chunk-2jqthnya.js} +1 -1
- package/dist/{chunk-jsqh5fyn.js → chunk-3gcpv242.js} +1 -1
- package/dist/{chunk-hesyghn7.js → chunk-435ww2a2.js} +1 -1
- package/dist/{chunk-jf1vs526.js → chunk-48cx52vd.js} +2 -2
- package/dist/{chunk-xrdrwrfe.js → chunk-6z3d3t00.js} +1 -1
- package/dist/{chunk-4b1ed4qv.js → chunk-7fk5ygvh.js} +1 -1
- package/dist/{chunk-679tc0c4.js → chunk-7k3v1qv8.js} +1 -1
- package/dist/chunk-7s44ew85.js +2 -0
- package/dist/{chunk-5j970c0z.js → chunk-9ah1zsch.js} +1 -1
- package/dist/chunk-a92b91a7.js +2 -0
- package/dist/chunk-av3qvakg.js +130 -0
- package/dist/{chunk-ys3tmk8w.js → chunk-bjrx38kf.js} +1 -1
- package/dist/{chunk-d5d1b6w0.js → chunk-c836tm9c.js} +1 -1
- package/dist/{chunk-bmd035rk.js → chunk-d21ag28g.js} +1 -1
- package/dist/chunk-dnszn1xb.js +2 -0
- package/dist/chunk-e5dvqb47.js +2 -0
- package/dist/{chunk-fpbff6s1.js → chunk-eky3cdcg.js} +1 -1
- package/dist/{chunk-e7wxt37f.js → chunk-erpjegf6.js} +1 -1
- package/dist/{chunk-604yfrmq.js → chunk-ey3wv3qq.js} +1 -1
- package/dist/{chunk-b7vz9m5q.js → chunk-gfa140m0.js} +1 -1
- package/dist/chunk-ggxkpxfm.js +2 -0
- package/dist/{chunk-87bs5f18.js → chunk-j2318qfk.js} +1 -1
- package/dist/{chunk-kd6qactf.js → chunk-jcrk8xn6.js} +2 -2
- package/dist/{chunk-ea7ekakt.js → chunk-k35fd0mn.js} +4 -4
- package/dist/{chunk-ndhkwfyq.js → chunk-k5wpdg44.js} +1 -1
- package/dist/{chunk-ynyssmdy.js → chunk-kezhxaye.js} +2 -2
- package/dist/{chunk-j10smv8e.js → chunk-kjfnym5y.js} +1 -1
- package/dist/{chunk-ev0t17cq.js → chunk-kjrrxwj0.js} +1 -1
- package/dist/chunk-m0e0n317.js +2 -0
- package/dist/{chunk-nt7jxmpy.js → chunk-m6zpcyhm.js} +1 -1
- package/dist/{chunk-b5ktzth7.js → chunk-mehp1sma.js} +5 -5
- package/dist/{chunk-mezzmwc5.js → chunk-mnyf1jq8.js} +1 -1
- package/dist/{chunk-0q0tpmr5.js → chunk-nhh8b7xj.js} +1 -1
- package/dist/{chunk-gmgdmsdz.js → chunk-nm7h30yt.js} +1 -1
- package/dist/{chunk-cca86043.js → chunk-pe470p36.js} +1 -1
- package/dist/{chunk-ackk8wq5.js → chunk-pjgnvpks.js} +1 -1
- package/dist/chunk-qzfcy37r.js +2 -0
- package/dist/{chunk-ywqs7x8g.js → chunk-r3e1avhs.js} +1 -1
- package/dist/{chunk-ztp2rgpp.js → chunk-s45a5axx.js} +2 -2
- package/dist/chunk-t8w6h94x.js +2 -0
- package/dist/{chunk-nx6d1hj7.js → chunk-ttszb0qr.js} +1 -1
- package/dist/{chunk-43r0hjne.js → chunk-v0v2xnk7.js} +1 -1
- package/dist/chunk-vy35p3qj.js +2 -0
- package/dist/{chunk-ken0q08p.js → chunk-w63hh78w.js} +5 -5
- package/dist/{chunk-1cnwcn01.js → chunk-wj9njs0n.js} +1 -1
- package/dist/{chunk-jz6t1nes.js → chunk-wmkmj8d3.js} +1 -1
- package/dist/chunk-wqgz7vqp.js +2 -0
- package/dist/{chunk-8w9z30yx.js → chunk-wytkp0ss.js} +1 -1
- package/dist/{chunk-03wssg2z.js → chunk-x3s7wxm6.js} +1 -1
- package/dist/{chunk-7n7078xp.js → chunk-x5tgasp8.js} +1 -1
- package/dist/{chunk-d2zzqfgq.js → chunk-ym09kjfr.js} +2 -2
- package/dist/{chunk-p5sjezzx.js → chunk-z7t0ds1f.js} +1 -1
- package/dist/{chunk-gea2ty3e.js → chunk-zcv5vjq3.js} +1 -1
- package/dist/{chunk-zshhn7nz.js → chunk-zg08y45x.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/headwind-to-style.d.ts +3 -1
- package/dist/native/compiler/headwind-to-style.js +11 -8
- package/dist/native/compiler/html-to-ir.js +2 -1
- package/dist/native/compiler/ir.d.ts +1 -0
- 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 +54 -7
- package/dist/native/runtime/web-storage.js +41 -8
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-0zrskbkk.js +0 -2
- package/dist/chunk-21jz51jg.js +0 -2
- package/dist/chunk-2bspyg11.js +0 -2
- package/dist/chunk-5hqrw558.js +0 -2
- package/dist/chunk-7nsb5pxp.js +0 -2
- package/dist/chunk-7tp1j22e.js +0 -2
- package/dist/chunk-hnx88y3p.js +0 -130
- package/dist/chunk-kff0hgg5.js +0 -2
- package/dist/chunk-m1ggzh60.js +0 -2
- package/dist/chunk-msm3gqay.js +0 -2
- package/dist/chunk-y1kaq1cd.js +0 -2
|
@@ -62,7 +62,8 @@ function capabilityFlags(capabilities) {
|
|
|
62
62
|
animation: capabilities.has("animation"),
|
|
63
63
|
viewFocus: capabilities.has("viewFocus"),
|
|
64
64
|
viewMeasure: capabilities.has("viewMeasure"),
|
|
65
|
-
viewNonModalPresentation: capabilities.has("viewNonModalPresentation")
|
|
65
|
+
viewNonModalPresentation: capabilities.has("viewNonModalPresentation"),
|
|
66
|
+
nativePlatformControls: capabilities.has("nativePlatformControls")
|
|
66
67
|
};
|
|
67
68
|
}
|
|
68
69
|
function platformUserAgent(platform) {
|
|
@@ -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)
|
|
@@ -344,10 +367,14 @@ export function createNativeHost(options) {
|
|
|
344
367
|
inherited = parseNativeStyleLayers([source], inherited, report).variables;
|
|
345
368
|
const resolved = parseNativeStyleLayers([record.styleSource, record.boundStyle, record.forwardedStyle], inherited, report);
|
|
346
369
|
record.variables = resolved.variables;
|
|
347
|
-
const classes = compileClassStyles(`${record.classes} ${record.forwardedClasses ?? ""}`, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules }), classStyle = { ...classes.style,
|
|
348
|
-
for (const layer of
|
|
349
|
-
|
|
350
|
-
|
|
370
|
+
const classes = compileClassStyles(`${record.classes} ${record.forwardedClasses ?? ""}`, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules, appearance: colorScheme }), classStyle = { ...classes.style }, responsive = (classes.responsive ?? []).filter((layer) => viewportWidth >= layer.min && (layer.max === void 0 || viewportWidth <= layer.max));
|
|
371
|
+
for (const layer of responsive)
|
|
372
|
+
Object.assign(classStyle, layer.style);
|
|
373
|
+
if (colorScheme === "dark") {
|
|
374
|
+
Object.assign(classStyle, classes.dark);
|
|
375
|
+
for (const layer of responsive)
|
|
376
|
+
Object.assign(classStyle, layer.dark);
|
|
377
|
+
}
|
|
351
378
|
for (const [attribute, layer] of Object.entries(classes.states ?? {}))
|
|
352
379
|
if (ariaState(record.props[attribute]))
|
|
353
380
|
Object.assign(classStyle, layer.style, colorScheme === "dark" ? layer.dark : {});
|
|
@@ -743,6 +770,8 @@ export function createNativeHost(options) {
|
|
|
743
770
|
}
|
|
744
771
|
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
772
|
record.props[prop] = value;
|
|
773
|
+
if (TEXT_ENTRY_SOURCES.has(prop) || prop === "multiline")
|
|
774
|
+
syncImplicitSubmit(node);
|
|
746
775
|
if (record.focused && disabled(record)) {
|
|
747
776
|
record.focused = !1;
|
|
748
777
|
refreshFocusChain(node);
|
|
@@ -926,10 +955,13 @@ export function createNativeHost(options) {
|
|
|
926
955
|
const data = payload && typeof payload === "object" ? payload : {}, value = data.text ?? data.value ?? data.nativeEvent?.text ?? data.nativeEvent?.value, record = recordOf(node);
|
|
927
956
|
if (record.type === "Checkbox" && value !== void 0)
|
|
928
957
|
node.checked = Boolean(value);
|
|
929
|
-
|
|
958
|
+
const eventCount = data.eventCount ?? data.nativeEvent?.eventCount, acknowledgesEdit = record.type === "TextInput" && Number.isSafeInteger(eventCount) && eventCount >= 0;
|
|
959
|
+
if (acknowledgesEdit)
|
|
960
|
+
record.props.mostRecentEventCount = eventCount;
|
|
961
|
+
if (value !== void 0 && (acknowledgesEdit || !Object.is(record.props.value, value)) && (record.type === "TextInput" || record.type === "Picker" || record.type === "SegmentedControl" || record.type === "Switch")) {
|
|
930
962
|
record.props.value = value;
|
|
931
963
|
if (record.materialized)
|
|
932
|
-
emit({ op: "updateNode", id: node.__stxId, patch: { props: { value } } });
|
|
964
|
+
emit({ op: "updateNode", id: node.__stxId, patch: { props: acknowledgesEdit ? { value, mostRecentEventCount: eventCount } : { value } } });
|
|
933
965
|
}
|
|
934
966
|
}
|
|
935
967
|
const delivered = eventAt(payload, node, event), physical = delivered && typeof delivered === "object" ? delivered : null, ancestors = [node];
|
|
@@ -983,6 +1015,21 @@ export function createNativeHost(options) {
|
|
|
983
1015
|
break;
|
|
984
1016
|
}
|
|
985
1017
|
const form = formOwner(node);
|
|
1018
|
+
if (form && nativeEvent === "onSubmitEditing" && !physical?.defaultPrevented && !record.props.multiline && hostProps(record).returnKeyType !== "next") {
|
|
1019
|
+
const implicit = implicitSubmitListeners.get(node), authored = componentListeners.get(node)?.some((listener) => (NATIVE_EVENT_NAMES[listener.event.toLowerCase()] ?? listener.event) === "onSubmitEditing" && listener.handler !== implicit?.listener);
|
|
1020
|
+
if (implicit && !authored) {
|
|
1021
|
+
const submitter = collectDescendants(form).find((control) => {
|
|
1022
|
+
const candidate = descriptorOf(control);
|
|
1023
|
+
return candidate?.materialized && ["Button", "Pressable"].includes(candidate.type) && candidate.props.type === "submit" && formOwner(control) === form;
|
|
1024
|
+
});
|
|
1025
|
+
if (submitter) {
|
|
1026
|
+
const candidate = descriptorOf(submitter);
|
|
1027
|
+
if (!disabled(candidate) && candidate.events.onPress)
|
|
1028
|
+
host.dispatch(candidate.events.onPress, {});
|
|
1029
|
+
} else
|
|
1030
|
+
host.emitComponentEvent(form, eventAt({}, form, "submit"));
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
986
1033
|
if (form && nativeEvent === "onPress" && !physical?.defaultPrevented && !disabled(record)) {
|
|
987
1034
|
if (record.props.type === "submit")
|
|
988
1035
|
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-a92b91a7.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-2j996te9.js";import"./chunk-1sr6c0nk.js";import"./chunk-10np2c03.js";import"./chunk-a3d0g4mr.js";import{wt,xt,St,kt,_t,Ct}from"./chunk-365vg0eg.js";import{o}from"./chunk-11c5q4h7.js";import{Yr}from"./chunk-fzqj1mjz.js";import"./chunk-04kg16qs.js";import"./chunk-x3s7wxm6.js";import{Ce,Gt,Kt}from"./chunk-7fk5ygvh.js";import"./chunk-j2318qfk.js";import{h}from"./chunk-s45a5axx.js";import{gt,s}from"./chunk-w63hh78w.js";import"./chunk-ttszb0qr.js";import"./chunk-1zeerj7e.js";import"./chunk-1pw1nvta.js";import"./chunk-kezhxaye.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-k35fd0mn.js";import"./chunk-p472crv1.js";import"./chunk-m6zpcyhm.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-nhh8b7xj.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-eky3cdcg.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-nhh8b7xj.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.671",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
"@stacksjs/desktop": "0.2.669",
|
|
132
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.671",
|
|
135
135
|
"bunfig": "^0.15.21",
|
|
136
136
|
"stx-router": "0.2.669",
|
|
137
137
|
"ts-broadcasting": "^0.0.11",
|
package/dist/chunk-0zrskbkk.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{zs,zd,Hd}from"./chunk-679tc0c4.js";import"./chunk-4b1ed4qv.js";import"./chunk-03wssg2z.js";import"./chunk-md2jn67b.js";import"./chunk-ynyssmdy.js";import"./chunk-ea7ekakt.js";import"./chunk-p472crv1.js";import"./chunk-nytb5e4v.js";import"./chunk-nt7jxmpy.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import"./chunk-p23sz4rr.js";import"./chunk-144yp2bw.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-21jz51jg.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{$u}from"./chunk-7n7078xp.js";import"./chunk-jf1vs526.js";import"./chunk-03wssg2z.js";import"./chunk-ea7ekakt.js";import"./chunk-nytb5e4v.js";import"./chunk-nt7jxmpy.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import"./chunk-p23sz4rr.js";import"./chunk-144yp2bw.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{$u as startProductionServer};
|
package/dist/chunk-2bspyg11.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Mu}from"./chunk-d5d1b6w0.js";import"./chunk-jf1vs526.js";import"./chunk-3y41efsf.js";import"./chunk-03wssg2z.js";import"./chunk-ken0q08p.js";import"./chunk-ztp2rgpp.js";import"./chunk-prf164ct.js";import"./chunk-nzj3a6mj.js";import"./chunk-1mz8fw0m.js";import"./chunk-nx6d1hj7.js";import"./chunk-ka8befem.js";import"./chunk-ynyssmdy.js";import"./chunk-ea7ekakt.js";import"./chunk-p472crv1.js";import"./chunk-87bs5f18.js";import"./chunk-nytb5e4v.js";import"./chunk-nt7jxmpy.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import"./chunk-p23sz4rr.js";import"./chunk-144yp2bw.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{Mu as buildForProduction};
|
package/dist/chunk-5hqrw558.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-ev0t17cq.js";import"./chunk-ken0q08p.js";import"./chunk-ztp2rgpp.js";import"./chunk-prf164ct.js";import"./chunk-nzj3a6mj.js";import"./chunk-1mz8fw0m.js";import"./chunk-nx6d1hj7.js";import"./chunk-ka8befem.js";import"./chunk-ynyssmdy.js";import"./chunk-ea7ekakt.js";import"./chunk-p472crv1.js";import"./chunk-87bs5f18.js";import"./chunk-nytb5e4v.js";import"./chunk-nt7jxmpy.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import"./chunk-p23sz4rr.js";import"./chunk-144yp2bw.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-7nsb5pxp.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Tu}from"./chunk-mezzmwc5.js";import"./chunk-ken0q08p.js";import"./chunk-ztp2rgpp.js";import"./chunk-prf164ct.js";import"./chunk-nzj3a6mj.js";import"./chunk-1mz8fw0m.js";import"./chunk-nx6d1hj7.js";import"./chunk-ka8befem.js";import"./chunk-ynyssmdy.js";import"./chunk-ea7ekakt.js";import"./chunk-p472crv1.js";import"./chunk-87bs5f18.js";import"./chunk-nytb5e4v.js";import"./chunk-nt7jxmpy.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import"./chunk-p23sz4rr.js";import"./chunk-144yp2bw.js";import"./chunk-1sr6c0nk.js";import"./chunk-2dp7hyv7.js";import"./chunk-ce6zddpf.js";import"./chunk-pxdww4rb.js";export{Tu as startInteractive};
|
package/dist/chunk-7tp1j22e.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{xc,Sc}from"./chunk-b5ktzth7.js";import"./chunk-mezzmwc5.js";import"./chunk-7n7078xp.js";import"./chunk-7met6yva.js";import"./chunk-7d4z944r.js";import"./chunk-bmd035rk.js";import"./chunk-zqtbtqbq.js";import"./chunk-d5d1b6w0.js";import{_i}from"./chunk-jf1vs526.js";import"./chunk-jxda11cg.js";import"./chunk-89jbdtgw.js";import"./chunk-43r0hjne.js";import"./chunk-rcadtv3x.js";import"./chunk-gmgdmsdz.js";import"./chunk-b823zxq6.js";import"./chunk-ym41ybz2.js";import"./chunk-n38yb274.js";import"./chunk-8rx1bves.js";import"./chunk-tre98h62.js";import"./chunk-ev0t17cq.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-ndhkwfyq.js";import"./chunk-679tc0c4.js";import"./chunk-3y41efsf.js";import"./chunk-d2zzqfgq.js";import"./chunk-yfvm7q6t.js";import"./chunk-6ajahb2x.js";import"./chunk-4b1ed4qv.js";import"./chunk-03wssg2z.js";import"./chunk-md2jn67b.js";import{Te,s}from"./chunk-ken0q08p.js";import"./chunk-ztp2rgpp.js";import"./chunk-prf164ct.js";import"./chunk-nzj3a6mj.js";import"./chunk-1mz8fw0m.js";import"./chunk-nx6d1hj7.js";import"./chunk-ka8befem.js";import"./chunk-ynyssmdy.js";import{me}from"./chunk-ea7ekakt.js";import"./chunk-p472crv1.js";import{Xn,Jn}from"./chunk-87bs5f18.js";import{qr,N,o}from"./chunk-nytb5e4v.js";import"./chunk-nt7jxmpy.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-fzqj1mjz.js";import"./chunk-365vg0eg.js";import{g,Ne}from"./chunk-p23sz4rr.js";import"./chunk-144yp2bw.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};
|