@stacksjs/stx 0.2.656 → 0.2.661
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-qc5wyxvc.js → chunk-0961mx93.js} +1 -1
- package/dist/{chunk-3p7xp7de.js → chunk-09a8tn6e.js} +1 -1
- package/dist/{chunk-zfeq5h13.js → chunk-2cb9r3r9.js} +11 -11
- package/dist/{chunk-zyv28182.js → chunk-2jv7g2fs.js} +1 -1
- package/dist/{chunk-5cyznacz.js → chunk-2x9h3whx.js} +1 -1
- package/dist/{chunk-jfmjw734.js → chunk-2yvqydak.js} +3 -3
- package/dist/{chunk-s2qv0y4x.js → chunk-3fyj98v9.js} +1 -1
- package/dist/{chunk-27v1ehy0.js → chunk-3p8p8sfw.js} +1 -1
- package/dist/{chunk-31yb0253.js → chunk-57nbg2f9.js} +2 -2
- package/dist/{chunk-2qf9vt7y.js → chunk-5em9ak8r.js} +1 -1
- package/dist/{chunk-80fkh83p.js → chunk-5n6sej6b.js} +1 -1
- package/dist/{chunk-hzjvpcmj.js → chunk-5nfc2tw2.js} +71 -71
- package/dist/{chunk-v5r6abrq.js → chunk-6qd27t9k.js} +1 -1
- package/dist/{chunk-qkasqamj.js → chunk-714gdfj9.js} +1 -1
- package/dist/{chunk-a2dnv6n9.js → chunk-7ek9yvwk.js} +1 -1
- package/dist/chunk-7j486x8f.js +2 -0
- package/dist/{chunk-1z1fmda6.js → chunk-7rjm58gn.js} +1 -1
- package/dist/chunk-8xypmt6s.js +2 -0
- package/dist/{chunk-k9amsnfj.js → chunk-9rh5anvd.js} +2 -2
- package/dist/{chunk-cjj9b9wf.js → chunk-9zy4kzqk.js} +1 -1
- package/dist/{chunk-yr34z9ey.js → chunk-afavkkkq.js} +1 -1
- package/dist/chunk-avmqg5t6.js +2 -0
- package/dist/{chunk-v3kc2anv.js → chunk-bt4bd4f5.js} +1 -1
- package/dist/{chunk-vm26nak1.js → chunk-d5k8gx93.js} +1 -1
- package/dist/{chunk-zaj65qc1.js → chunk-d5vz53t1.js} +2 -2
- package/dist/{chunk-y4waj1p4.js → chunk-dah90qrm.js} +1 -1
- package/dist/{chunk-yb89cj9s.js → chunk-dn2h9g79.js} +1 -1
- package/dist/{chunk-p314pg80.js → chunk-dr1vedj2.js} +1 -1
- package/dist/{chunk-6c2pvrw8.js → chunk-dv709hnm.js} +1 -1
- package/dist/{chunk-rccpf74y.js → chunk-dyzgrvg3.js} +8 -8
- package/dist/{chunk-vmwdt8fr.js → chunk-een2wqah.js} +6 -6
- package/dist/chunk-eqrkhc18.js +12 -0
- package/dist/{chunk-jvv9p6v6.js → chunk-eyvex6fk.js} +39 -39
- package/dist/{chunk-26qc9v36.js → chunk-f9fty8ty.js} +1 -1
- package/dist/{chunk-nn138y2w.js → chunk-ghge79wv.js} +1 -1
- package/dist/chunk-j02834qv.js +2 -0
- package/dist/{chunk-889evdcy.js → chunk-jtheqwp2.js} +5 -5
- package/dist/{chunk-vmzkbdmp.js → chunk-k99f2njc.js} +1 -1
- package/dist/chunk-mdk323pn.js +2 -0
- package/dist/{chunk-mz1npbyk.js → chunk-mmern3j1.js} +1 -1
- package/dist/{chunk-p7096wfv.js → chunk-mvv5cpen.js} +1 -1
- package/dist/{chunk-dv7dm5z1.js → chunk-n4x9hytk.js} +56 -56
- package/dist/{chunk-ds3qn1ty.js → chunk-nw9x9gsb.js} +1 -1
- package/dist/chunk-p6p29613.js +2 -0
- package/dist/chunk-pnnqftq6.js +2 -0
- package/dist/{chunk-wp0jtntj.js → chunk-pp4pyeg4.js} +4 -4
- package/dist/{chunk-x2wgczak.js → chunk-px8e8qgp.js} +1 -1
- package/dist/{chunk-jf17b7y9.js → chunk-qzv0mqw5.js} +1 -1
- package/dist/{chunk-2h92dm3t.js → chunk-r1y1k2ky.js} +38 -38
- package/dist/{chunk-qkq8at1r.js → chunk-rzxhdmz9.js} +1 -1
- package/dist/{chunk-sdknbvh8.js → chunk-sk82mf97.js} +1 -1
- package/dist/chunk-snwps673.js +129 -0
- package/dist/{chunk-x5777qkq.js → chunk-t1fxzg0m.js} +2 -2
- package/dist/{chunk-28jtt8hn.js → chunk-vp9hse5k.js} +48 -48
- package/dist/chunk-w7dcy972.js +2 -0
- package/dist/{chunk-p7bqzhe1.js → chunk-w82nvp7r.js} +1 -1
- package/dist/{chunk-0gqmp9sa.js → chunk-wc3e138p.js} +2 -2
- package/dist/{chunk-g96m1a69.js → chunk-wcmzr1sk.js} +1 -1
- package/dist/{chunk-kpycf9tz.js → chunk-xt9t5wvx.js} +1 -1
- package/dist/chunk-yharrk8v.js +2 -0
- package/dist/{chunk-teahew39.js → chunk-z4fa7nsm.js} +5 -5
- package/dist/{chunk-kg54zsda.js → chunk-z5qj7enn.js} +1 -1
- package/dist/chunk-zdfja1ap.js +2 -0
- package/dist/{chunk-e7z85137.js → chunk-zjnh64wm.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/expressions.js +9 -0
- package/dist/native/bridge/protocol.d.ts +1 -0
- package/dist/native/compiler/bundle.d.ts +1 -0
- package/dist/native/compiler/bundle.js +3 -2
- package/dist/native/compiler/headwind-to-style.d.ts +5 -1
- package/dist/native/compiler/headwind-to-style.js +54 -15
- package/dist/native/compiler/html-to-ir.d.ts +12 -0
- package/dist/native/compiler/html-to-ir.js +63 -8
- package/dist/native/compiler/ir.d.ts +2 -0
- package/dist/native/compiler/render-screen.js +31 -5
- package/dist/native/compiler/stylesheet-rules.d.ts +2 -2
- package/dist/native/compiler/stylesheet-rules.js +20 -16
- package/dist/native/runtime/binding-tree.js +2 -1
- package/dist/native/runtime/craft-bridge.d.ts +2 -0
- package/dist/native/runtime/craft-bridge.js +13 -3
- package/dist/native/runtime/native-host.d.ts +1 -0
- package/dist/native/runtime/native-host.js +83 -13
- package/dist/native/runtime/shared-screen.js +4 -3
- package/dist/native/runtime/web-navigation.d.ts +18 -0
- package/dist/native/runtime/web-navigation.js +59 -0
- package/dist/native/runtime/web-storage.d.ts +40 -1
- package/dist/native/runtime/web-storage.js +123 -26
- package/dist/native/testing.d.ts +1 -0
- package/dist/native/testing.js +1 -0
- package/dist/native/text-entry.d.ts +51 -0
- package/dist/native/text-entry.js +101 -0
- package/dist/native-build.js +3 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +25 -25
- package/dist/stx-virtual-ts.d.ts +1 -1
- package/dist/stx-virtual-ts.js +3 -1
- package/dist/utils.js +2 -0
- package/package.json +5 -5
- package/dist/chunk-67rvd6qy.js +0 -2
- package/dist/chunk-9c3cq8ks.js +0 -2
- package/dist/chunk-9q23eed0.js +0 -2
- package/dist/chunk-ajjcp56c.js +0 -128
- package/dist/chunk-bpm8tyvc.js +0 -2
- package/dist/chunk-da6qbwqs.js +0 -2
- package/dist/chunk-dknd9nhz.js +0 -2
- package/dist/chunk-egg54kd0.js +0 -12
- package/dist/chunk-fjqphdvp.js +0 -2
- package/dist/chunk-j2hkxwjy.js +0 -2
- package/dist/chunk-ne72vxmc.js +0 -2
- package/dist/chunk-xesyd9nx.js +0 -2
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The native text-field props HTML's attributes imply, for a `TextInput`.
|
|
3
|
+
* Fields the node already carries are left out: an authored native prop wins.
|
|
4
|
+
*/
|
|
5
|
+
export declare function projectTextEntry(type: string, props: Record<string, unknown>): Record<string, unknown>;
|
|
6
|
+
/**
|
|
7
|
+
* What a write to `changed` does to the projection: the fields that changed,
|
|
8
|
+
* with `null` for one no longer derived (a patch merges on the host side, so
|
|
9
|
+
* an absent key would leave the old value in place). `secureTextEntry`
|
|
10
|
+
* clears to false rather than null, so a revealed password is plainly not
|
|
11
|
+
* secure on both hosts.
|
|
12
|
+
*/
|
|
13
|
+
export declare function textEntryChanges(type: string, props: Record<string, unknown>, before: Record<string, unknown>): Record<string, unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* Project a compiled node in place, keeping its authored values of the
|
|
16
|
+
* projected fields aside (`_textEntrySource`) so the runtime can tell them
|
|
17
|
+
* from derived ones, as `_accessibilitySource` does for ARIA.
|
|
18
|
+
*/
|
|
19
|
+
export declare function applyStaticTextEntry(node: { type: string, props: Record<string, unknown>, _textEntrySource?: Record<string, unknown> }): void;
|
|
20
|
+
/** A compiled node's props as authored: derived text-field props removed, authored ones restored. */
|
|
21
|
+
export declare function authoredTextEntryProps(props: Record<string, unknown>, source?: Record<string, unknown>): Record<string, unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* HTML's text-field vocabulary, spelled the way a native host reads it.
|
|
24
|
+
*
|
|
25
|
+
* A web view describes a field the web's way: `type="email"`,
|
|
26
|
+
* `autocomplete="current-password"`, `inputmode="numeric"`,
|
|
27
|
+
* `enterkeyhint="go"`, `readonly`. Craft's iOS and Android renderers read
|
|
28
|
+
* none of those for a text field: they take `keyboardType`,
|
|
29
|
+
* `secureTextEntry`, `returnKeyType`, `autoCapitalize`, `autoCorrect` and
|
|
30
|
+
* `editable`. So the same shared EmailInput that brought up the email
|
|
31
|
+
* keyboard in a phone's browser brought up the plain one in the app, and a
|
|
32
|
+
* PasswordInput showed the password it was given as clear text.
|
|
33
|
+
*
|
|
34
|
+
* The projection is computed from the node's own props wherever the runtime
|
|
35
|
+
* describes a node to the host, as the ARIA projection is
|
|
36
|
+
* (accessibility.ts), and recomputed when one of the attributes it reads is
|
|
37
|
+
* written - so a password field's reveal button, which flips `:type`
|
|
38
|
+
* between password and text, turns secure entry off and on in place. A
|
|
39
|
+
* native prop written on the node (`keyboardType="number-pad"`) wins over
|
|
40
|
+
* anything derived here; the derived values are never stored on the node,
|
|
41
|
+
* so they cannot later be mistaken for authored ones.
|
|
42
|
+
*
|
|
43
|
+
* `autocomplete` needs nothing: the hosts read HTML's names for it
|
|
44
|
+
* (`autoComplete`, prop-names.ts) as the platform's autofill hint.
|
|
45
|
+
*
|
|
46
|
+
* @module native/text-entry
|
|
47
|
+
*/
|
|
48
|
+
/** The native props this projection may set. */
|
|
49
|
+
export declare const TEXT_ENTRY_FIELDS: readonly ['keyboardType', 'secureTextEntry', 'returnKeyType', 'autoCapitalize', 'autoCorrect', 'editable', 'autoComplete'];
|
|
50
|
+
/** The authored props it reads: a write to one of these re-projects the field. */
|
|
51
|
+
export declare const TEXT_ENTRY_SOURCES: Set<any>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export const TEXT_ENTRY_FIELDS = ["keyboardType", "secureTextEntry", "returnKeyType", "autoCapitalize", "autoCorrect", "editable", "autoComplete"], TEXT_ENTRY_SOURCES = new Set(["type", "inputmode", "inputMode", "enterkeyhint", "enterKeyHint", "autoCapitalize", "autoCorrect", "spellcheck", "readonly", "readOnly", "disabled", ...TEXT_ENTRY_FIELDS]);
|
|
2
|
+
const INPUT_MODE_KEYBOARDS = {
|
|
3
|
+
numeric: "number-pad",
|
|
4
|
+
decimal: "decimal-pad",
|
|
5
|
+
tel: "phone-pad",
|
|
6
|
+
email: "email-address",
|
|
7
|
+
url: "url",
|
|
8
|
+
search: "web-search",
|
|
9
|
+
text: "default"
|
|
10
|
+
}, TYPE_TRAITS = {
|
|
11
|
+
email: { keyboardType: "email-address", verbatim: !0, autoComplete: "email" },
|
|
12
|
+
tel: { keyboardType: "phone-pad", autoComplete: "tel" },
|
|
13
|
+
url: { keyboardType: "url", verbatim: !0, autoComplete: "url" },
|
|
14
|
+
number: { keyboardType: "decimal-pad" },
|
|
15
|
+
search: { keyboardType: "web-search", returnKeyType: "search" },
|
|
16
|
+
password: { secure: !0, verbatim: !0 }
|
|
17
|
+
}, RETURN_KEYS = {
|
|
18
|
+
enter: "default",
|
|
19
|
+
done: "done",
|
|
20
|
+
go: "go",
|
|
21
|
+
next: "next",
|
|
22
|
+
previous: "default",
|
|
23
|
+
search: "search",
|
|
24
|
+
send: "send"
|
|
25
|
+
};
|
|
26
|
+
function text(value) {
|
|
27
|
+
return value === void 0 || value === null ? "" : String(value).trim().toLowerCase();
|
|
28
|
+
}
|
|
29
|
+
function present(value) {
|
|
30
|
+
if (value === void 0 || value === null || value === !1)
|
|
31
|
+
return !1;
|
|
32
|
+
return text(value) !== "false";
|
|
33
|
+
}
|
|
34
|
+
function given(props, ...names) {
|
|
35
|
+
for (const name of names)
|
|
36
|
+
if (props[name] !== void 0 && props[name] !== null)
|
|
37
|
+
return props[name];
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
export function projectTextEntry(type, props) {
|
|
41
|
+
if (type !== "TextInput")
|
|
42
|
+
return {};
|
|
43
|
+
const derived = {}, fieldType = text(props.type), traits = TYPE_TRAITS[fieldType] ?? {}, mode = text(given(props, "inputmode", "inputMode")), keyboard = INPUT_MODE_KEYBOARDS[mode] ?? traits.keyboardType;
|
|
44
|
+
if (keyboard && keyboard !== "default")
|
|
45
|
+
derived.keyboardType = keyboard;
|
|
46
|
+
if (traits.secure)
|
|
47
|
+
derived.secureTextEntry = !0;
|
|
48
|
+
const hint = text(given(props, "enterkeyhint", "enterKeyHint")), returnKey = RETURN_KEYS[hint] ?? traits.returnKeyType;
|
|
49
|
+
if (returnKey && returnKey !== "default")
|
|
50
|
+
derived.returnKeyType = returnKey;
|
|
51
|
+
const capitalize = text(props.autoCapitalize);
|
|
52
|
+
if (capitalize === "off" || capitalize === "none")
|
|
53
|
+
derived.autoCapitalize = "none";
|
|
54
|
+
else if (capitalize === "on")
|
|
55
|
+
derived.autoCapitalize = "sentences";
|
|
56
|
+
else if (!capitalize && traits.verbatim)
|
|
57
|
+
derived.autoCapitalize = "none";
|
|
58
|
+
const correct = props.autoCorrect;
|
|
59
|
+
if (correct === "off" || correct === "false" || text(props.spellcheck) === "false" || correct === void 0 && traits.verbatim)
|
|
60
|
+
derived.autoCorrect = !1;
|
|
61
|
+
else if (correct === "on" || correct === "true")
|
|
62
|
+
derived.autoCorrect = !0;
|
|
63
|
+
if (present(given(props, "readonly", "readOnly")) || present(props.disabled))
|
|
64
|
+
derived.editable = !1;
|
|
65
|
+
if (traits.autoComplete)
|
|
66
|
+
derived.autoComplete = traits.autoComplete;
|
|
67
|
+
return Object.fromEntries(Object.entries(derived).filter(([name]) => props[name] === void 0 || htmlSpelling(name, props[name])));
|
|
68
|
+
}
|
|
69
|
+
function htmlSpelling(name, value) {
|
|
70
|
+
if (name === "autoCapitalize")
|
|
71
|
+
return value === "off" || value === "on";
|
|
72
|
+
if (name === "autoCorrect")
|
|
73
|
+
return typeof value === "string";
|
|
74
|
+
return !1;
|
|
75
|
+
}
|
|
76
|
+
export function textEntryChanges(type, props, before) {
|
|
77
|
+
const after = projectTextEntry(type, props), patch = {};
|
|
78
|
+
for (const name of TEXT_ENTRY_FIELDS) {
|
|
79
|
+
if (props[name] !== void 0 && !htmlSpelling(name, props[name]))
|
|
80
|
+
continue;
|
|
81
|
+
if (JSON.stringify(before[name]) === JSON.stringify(after[name]))
|
|
82
|
+
continue;
|
|
83
|
+
patch[name] = after[name] ?? (name === "secureTextEntry" ? !1 : name === "editable" ? !0 : null);
|
|
84
|
+
}
|
|
85
|
+
return patch;
|
|
86
|
+
}
|
|
87
|
+
export function applyStaticTextEntry(node) {
|
|
88
|
+
const projected = projectTextEntry(node.type, node.props);
|
|
89
|
+
if (!Object.keys(projected).length)
|
|
90
|
+
return;
|
|
91
|
+
node._textEntrySource = Object.fromEntries(TEXT_ENTRY_FIELDS.filter((name) => (name in node.props)).map((name) => [name, node.props[name]]));
|
|
92
|
+
Object.assign(node.props, projected);
|
|
93
|
+
}
|
|
94
|
+
export function authoredTextEntryProps(props, source) {
|
|
95
|
+
if (!source)
|
|
96
|
+
return props;
|
|
97
|
+
const result = { ...props };
|
|
98
|
+
for (const name of TEXT_ENTRY_FIELDS)
|
|
99
|
+
delete result[name];
|
|
100
|
+
return Object.assign(result, source);
|
|
101
|
+
}
|
package/dist/native-build.js
CHANGED
|
@@ -5,6 +5,7 @@ import { platform as osPlatform } from "node:os";
|
|
|
5
5
|
import { injectCraftBridge } from "./craft-bridge.js";
|
|
6
6
|
import { processCraftComponents, CRAFT_COMPONENT_STYLES } from "./craft-components.js";
|
|
7
7
|
import { renderTemplate } from "./render.js";
|
|
8
|
+
import { loadStxConfig } from "./config.js";
|
|
8
9
|
import { createTempDir, removeTempDir } from "./temp-dir.js";
|
|
9
10
|
import { signMacOSBundle } from "./native-signing.js";
|
|
10
11
|
export async function buildNative(config) {
|
|
@@ -25,9 +26,10 @@ export async function buildNative(config) {
|
|
|
25
26
|
const outputDir = config.output || join(process.cwd(), "dist", "native");
|
|
26
27
|
if (!existsSync(outputDir))
|
|
27
28
|
mkdirSync(outputDir, { recursive: !0 });
|
|
29
|
+
const projectConfig = await loadStxConfig(process.cwd());
|
|
28
30
|
let html = await renderTemplate(config.input, {
|
|
29
31
|
context: config.context,
|
|
30
|
-
options: { isDev: !1 }
|
|
32
|
+
options: { ...projectConfig, isDev: !1 }
|
|
31
33
|
});
|
|
32
34
|
html = injectCraftBridge(html, { debug: config.verbose });
|
|
33
35
|
html = processCraftComponents(html);
|
package/dist/pwa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{Es,jt,bc,gu}from"./chunk-yh0wb4n1.js";import{Cs,Xo,du,pu,fu}from"./chunk-xv43szx0.js";import{mc,hc,yc,lu,uu}from"./chunk-wpmrz872.js";import{Fe,wn,Jo}from"./chunk-wpm58d6p.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-mdk323pn.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,34 +1,34 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-v2x9vzgw.js";import"./chunk-hb08vrbb.js";import"./chunk-7rta163c.js";import"./chunk-ce6zddpf.js";import"./chunk-
|
|
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[
|
|
2
|
+
import"./chunk-v2x9vzgw.js";import"./chunk-hb08vrbb.js";import"./chunk-7rta163c.js";import"./chunk-ce6zddpf.js";import"./chunk-5nfc2tw2.js";import"./chunk-2h8ea0we.js";import"./chunk-qzv0mqw5.js";import"./chunk-a3d0g4mr.js";import{vt,wt,xt,St,kt,_t}from"./chunk-zaaeneq6.js";import{o}from"./chunk-r1y1k2ky.js";import{Yr}from"./chunk-t9mfztcs.js";import"./chunk-04kg16qs.js";import"./chunk-9zy4kzqk.js";import{_e,Gt,Kt}from"./chunk-ghge79wv.js";import"./chunk-bt4bd4f5.js";import{h}from"./chunk-wc3e138p.js";import{ft,s}from"./chunk-jtheqwp2.js";import"./chunk-dyzgrvg3.js";import"./chunk-pp4pyeg4.js";import"./chunk-sk82mf97.js";import"./chunk-57nbg2f9.js";import"./chunk-prf164ct.js";import{Ji,Yi,Zi}from"./chunk-6ajahb2x.js";import{qt,jn,Bn}from"./chunk-xaa36b0x.js";import"./chunk-r7kmsq3n.js";import{V,me}from"./chunk-z4fa7nsm.js";import"./chunk-8nryyqb5.js";import"./chunk-zjnh64wm.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 bt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Pt(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(bt,(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=Pt(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 $t=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($t.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 Dt=["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 Rt(t){for(let n of Dt){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 Ct(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 Ct(n);if(a)return{url:a,source:"site.config",via:"url"};let e=Rt(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
|
+
`)}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]}
|
|
6
6
|
})()
|
|
7
|
-
`)()}catch(n){return console.error(`Error extracting static paths from ${t}:`,n),null}}async function It(t){let n=[];if(!t.isDynamic)n.push({url:t.pattern,params:{}});else{let
|
|
7
|
+
`)()}catch(n){return console.error(`Error extracting static paths from ${t}:`,n),null}}async function It(t){let n=[];if(!t.isDynamic)n.push({url:t.pattern,params:{}});else{let i=await Et(t.filePath);if(!i||i.paths.length===0)return console.warn(`Warning: Dynamic route ${t.pattern} has no getStaticPaths or returned empty paths`),n;for(let r of i.paths){let a=t.pattern;for(let[e,l]of Object.entries(r.params))a=a.replace(`:${e}`,l).replace(`:${e}*`,l);n.push({url:a,params:r.params,props:r.props,revalidate:r.revalidate})}}return n}async function Bt(t){let n=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let i of n)if(await Bun.file(i).exists())try{let r=await import(i);if(typeof r.default==="function")return await r.default();else if(typeof r.default==="object")return r.default;else if(typeof r.getData==="function")return await r.getData();else{let{default:a,...e}=r;return e}}catch(r){console.error(`Error loading data file ${i}:`,r)}return null}async function jt(t,n,i){let r=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!r)return null;let a=r[1];if(!a.includes("getStaticProps"))return null;try{let e=a.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
|
|
8
8
|
return (async function getStaticProps() {
|
|
9
9
|
${e[1]}
|
|
10
10
|
})()
|
|
11
|
-
`)(n)}catch(e){return console.error(`Error executing getStaticProps in ${
|
|
11
|
+
`)(n)}catch(e){return console.error(`Error executing getStaticProps in ${i}:`,e),null}}function Ft(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function ut(t,n,i={},r,a){let e=await Bun.file(t.filePath).text(),l=await Bt(t.filePath),w=await jt(e,n,t.filePath),y={...l||{},...w||{},...i,params:n,$route:{path:t.pattern,params:n}},f=new Set,S=[],P=[],D={...a,...r.partialsDir?{partialsDir:r.partialsDir}:{},...r.componentsDir?{componentsDir:r.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(b)=>{S.push(`${g.relative(process.cwd(),b.templatePath)}: ${b.message}
|
|
12
12
|
resolved against partialsDir: ${b.partialsDir}`)},onServerScriptError:(b)=>{P.push(`${g.relative(process.cwd(),b.sourcePath)} (${b.kind}): ${b.message}`)}};if(Ft(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let p=await s(e,y,t.filePath,D,f);for(let b of[t.filePath,...f])for(let B of _e(b))f.add(B);if(Object.keys(n).length>0){let b=`<script>if(window.stx)window.stx._rp=${JSON.stringify(n)};else window.__stx_rp=${JSON.stringify(n)};</script>`;if(p.includes("</head>"))p=p.replace("</head>",`${b}
|
|
13
13
|
</head>`);else p=`${b}
|
|
14
|
-
${p}`}if(p=await me(p,{router:r.router}),p=await h(p),r.minify!==!1)return{html:Ot(p),dependencies:Array.from(f),includeFailures:S,serverScriptFailures:P};return{html:p,dependencies:Array.from(f),includeFailures:S,serverScriptFailures:P}}function Ot(t){let n=[],
|
|
14
|
+
${p}`}if(p=await me(p,{router:r.router}),p=await h(p),r.minify!==!1)return{html:Ot(p),dependencies:Array.from(f),includeFailures:S,serverScriptFailures:P};return{html:p,dependencies:Array.from(f),includeFailures:S,serverScriptFailures:P}}function Ot(t){let n=[],i=0,r=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,a;while((a=r.exec(t))!==null){let l=t.slice(i,a.index);n.push(l.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let w=a[1],y=a[2],f=a[3];y=y.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),n.push(w+y+f),i=a.index+a[0].length}let e=t.slice(i);return n.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),n.join("").trim()}function Tt(t){let n=0;for(let i=0;i<t.length;i++){let r=t.charCodeAt(i);n=(n<<5)-n+r,n=n&n}return`"${Math.abs(n).toString(36)}"`}function At(t,n,i,r){if(i?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(n))return!0;return r.some((a)=>{if(a instanceof RegExp)return a.test(t);return a.endsWith("/")?t===a.slice(0,-1)||t.startsWith(a):t===a})}function Lt(t,n){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
15
15
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
16
|
-
${t.map((r)=>{let
|
|
17
|
-
<loc>${I(
|
|
16
|
+
${t.map((r)=>{let a=new URL(r.loc,n).href,e=` <url>
|
|
17
|
+
<loc>${I(a)}</loc>`;if(r.lastmod)e+=`
|
|
18
18
|
<lastmod>${r.lastmod}</lastmod>`;if(r.changefreq)e+=`
|
|
19
19
|
<changefreq>${r.changefreq}</changefreq>`;if(r.priority!==void 0)e+=`
|
|
20
20
|
<priority>${r.priority}</priority>`;return e+=`
|
|
21
21
|
</url>`,e}).join(`
|
|
22
22
|
`)}
|
|
23
|
-
</urlset>`}function I(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Mt(t,n){let
|
|
24
|
-
<title>${I(r.title)}</title>`,
|
|
25
|
-
<link>${I(r.link)}</link>`,r.description)
|
|
26
|
-
<description>${I(r.description)}</description>`;if(r.pubDate)
|
|
27
|
-
<pubDate>${r.pubDate.toUTCString()}</pubDate>`;if(r.author)
|
|
28
|
-
<author>${I(r.author)}</author>`;if(r.categories)for(let e of r.categories)
|
|
29
|
-
<category>${I(e)}</category>`;if(r.guid)
|
|
30
|
-
<guid>${I(r.guid)}</guid>`;return
|
|
31
|
-
</item>`,
|
|
23
|
+
</urlset>`}function I(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Mt(t,n){let i=n.map((r)=>{let a=" <item>";if(a+=`
|
|
24
|
+
<title>${I(r.title)}</title>`,a+=`
|
|
25
|
+
<link>${I(r.link)}</link>`,r.description)a+=`
|
|
26
|
+
<description>${I(r.description)}</description>`;if(r.pubDate)a+=`
|
|
27
|
+
<pubDate>${r.pubDate.toUTCString()}</pubDate>`;if(r.author)a+=`
|
|
28
|
+
<author>${I(r.author)}</author>`;if(r.categories)for(let e of r.categories)a+=`
|
|
29
|
+
<category>${I(e)}</category>`;if(r.guid)a+=`
|
|
30
|
+
<guid>${I(r.guid)}</guid>`;return a+=`
|
|
31
|
+
</item>`,a});return`<?xml version="1.0" encoding="UTF-8"?>
|
|
32
32
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
|
33
33
|
<channel>
|
|
34
34
|
<title>${I(t.title)}</title>
|
|
@@ -38,13 +38,13 @@ ${t.map((r)=>{let o=new URL(r.loc,n).href,e=` <url>
|
|
|
38
38
|
${t.copyright?`<copyright>${I(t.copyright)}</copyright>`:""}
|
|
39
39
|
<lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
|
|
40
40
|
<atom:link href="${t.link}/rss.xml" rel="self" type="application/rss+xml"/>
|
|
41
|
-
${
|
|
41
|
+
${i.join(`
|
|
42
42
|
`)}
|
|
43
43
|
</channel>
|
|
44
|
-
</rss>`}async function Ut(t={}){let n=Date.now();Kt();let
|
|
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-f9fty8ty.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-px8e8qgp.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-f9fty8ty.js");await u('<div class="bg-black"></div>')}catch{}vt();let dt=i?.routeMiddleware?.dir||"middleware";await xt(process.cwd(),dt);let z=wt();if(z.length>0)console.log(`Loaded ${z.length} middleware: ${z.join(", ")}`);let gt=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:pt,revalidate:Z}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Wt(j),ht=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],Q=[...gt,...ht];if(Q.length>0){let C=St(d,L,F||{}),O=kt(C,null,void 0,{isServer:!0}),E=await _t(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
|
-
`)({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,pt,e,
|
|
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,pt,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:
|
|
48
48
|
${C.includeFailures.join(`
|
|
49
49
|
`)}
|
|
50
50
|
Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&C.serverScriptFailures.length>0)throw Error(`${C.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
|
|
@@ -52,7 +52,7 @@ Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptEr
|
|
|
52
52
|
`)}
|
|
53
53
|
Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)B.set(d,v.filePath,C.dependencies,k)}let M;if(e.trailingSlash)M=g.join(e.outputDir,d,"index.html");else M=d==="/"?g.join(e.outputDir,"index.html"):g.join(e.outputDir,`${d}.html`);if(e.chunkIslands){let{html:C,chunks:O}=nt(k,{integrity:e.integrityIslands,minify:e.minify});if(O.length>0){let E=g.join(e.outputDir,"_stx","islands");await x.promises.mkdir(E,{recursive:!0});for(let R of O){let U=g.join(E,`${R.hash}.js`);if(!await Bun.file(U).exists())await Bun.write(U,R.code);if(!w.has(R.hash)){w.add(R.hash);let T=Buffer.byteLength(R.code,"utf8");y+=T,f[R.hash]={bytes:T,file:`/_stx/islands/${R.hash}.js`}}}if(S[d]=O.map((R)=>R.hash),k=C,e.prefetchIslands)k=it(k)}}if(await x.promises.mkdir(g.dirname(M),{recursive:!0}),await Bun.write(M,k),!At(d,k,F,e.sitemapExclude))A.push({loc:d,lastmod:new Date().toISOString().split("T")[0],priority:d==="/"?1:0.8});let rt={route:d,outputPath:M,size:Buffer.byteLength(k,"utf8"),cached:et};if(Z!==!1)rt.revalidateAt=Date.now()+Z*1000;l.pages.push(rt),l.successCount++,await e.hooks.onPageEnd?.(d,k)}catch(j){l.failedCount++,l.errors.push({route:d,error:j}),await e.hooks.onError?.(j,d),console.error(`Error generating ${d}:`,j)}}));let X=Gt();if(X.length>0){let u=X.map((m)=>`${m.filePath}: ${m.message}`).join(`
|
|
54
54
|
`);throw Error(`Client script bundling failed:
|
|
55
|
-
${u}`)}if(e.cache)await B.save();if(e.generate404){let u=g.join(e.pagesDir,"404.stx");if(await Bun.file(u).exists()){let m=new Set,v={...
|
|
55
|
+
${u}`)}if(e.cache)await B.save();if(e.generate404){let u=g.join(e.pagesDir,"404.stx");if(await Bun.file(u).exists()){let m=new Set,v={...i,debug:!1,cache:!1},d=await s(await Bun.file(u).text(),{},u,v,m);await Bun.write(g.join(e.outputDir,"404.html"),d)}else await Bun.write(g.join(e.outputDir,"404.html"),`<!DOCTYPE html>
|
|
56
56
|
<html lang="en">
|
|
57
57
|
<head>
|
|
58
58
|
<meta charset="UTF-8">
|
|
@@ -73,7 +73,7 @@ ${u}`)}if(e.cache)await B.save();if(e.generate404){let u=g.join(e.pagesDir,"404.
|
|
|
73
73
|
<a href="/">Go home</a>
|
|
74
74
|
</div>
|
|
75
75
|
</body>
|
|
76
|
-
</html>`)}for(let u of[500]){let m=g.join(e.pagesDir,`${u}.stx`);if(await Bun.file(m).exists()){let v=new Set,d={...
|
|
76
|
+
</html>`)}for(let u of[500]){let m=g.join(e.pagesDir,`${u}.stx`);if(await Bun.file(m).exists()){let v=new Set,d={...i,debug:!1,cache:!1},L=await s(await Bun.file(m).text(),{},m,d,v);await Bun.write(g.join(e.outputDir,`${u}.html`),L)}}let H=g.join(e.pagesDir,"error.stx");if(await Bun.file(H).exists()){let u=new Set,m={...i,debug:!1,cache:!1},v=await s(await Bun.file(H).text(),{},H,m,u);await Bun.write(g.join(e.outputDir,"error.html"),v)}if(e.sitemap&&A.length>0){let u=Lt(A,e.domain),m=g.join(e.outputDir,"sitemap.xml");await Bun.write(m,u),l.sitemapPath=m,console.log(`Generated sitemap.xml with ${A.length} URLs`)}if(e.robots!==!1){let u=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((d)=>typeof d==="string"),...u.disallow||[]],v=Yr({rules:[{userAgent:u.userAgent||"*",allow:u.allow||["/"],...m.length>0?{disallow:m}:{}}],...u.sitemap!==!1&&l.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(g.join(e.outputDir,"robots.txt"),v),console.log("Generated robots.txt")}if(e.rss){let u=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(u.getItems)m=await u.getItems();let v=Mt(u,m),d=g.join(e.outputDir,"rss.xml");await Bun.write(d,v),l.rssPath=d,console.log(`Generated rss.xml with ${m.length} items`)}let G=Ji(e.outputDir);if(G.assets>0)console.log(`Externalized ${G.assets} asset(s) from ${G.pages} page(s) (${(G.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let N=Yi(e.outputDir);if(N.assets>0)console.log(`Externalized ${N.assets} repeated asset(s) from ${N.pages} page(s) (${(N.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&x.existsSync(e.publicDir))await q(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let Y=Bn();if(Y)await q(Y,g.join(e.outputDir,jn)),console.log(`Copied assets from ${qt}`)}catch(D){throw await e.hooks.onError?.(D),D}if(l.buildTime=Date.now()-n,w.size>0){l.islandChunks={count:w.size,totalBytes:y};let D={generatedChunks:w.size,totalBytes:y,chunks:f,pages:S};await Bun.write(g.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(D,null,2))}await e.hooks.onBuildEnd?.(l);let P=l.islandChunks?`
|
|
77
77
|
Island chunks: ${l.islandChunks.count} (${(l.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
|
|
78
78
|
Build complete!
|
|
79
79
|
Total: ${l.totalPages} pages
|
|
@@ -81,8 +81,8 @@ Build complete!
|
|
|
81
81
|
Cached: ${l.cachedCount}
|
|
82
82
|
Failed: ${l.failedCount}
|
|
83
83
|
Time: ${l.buildTime}ms${P}
|
|
84
|
-
`),l}async function q(t,n){await x.promises.mkdir(n,{recursive:!0});let
|
|
85
|
-
`)){let P=S.indexOf(":");if(P>0){let D=S.slice(0,P).trim(),p=S.slice(P+1).trim();if(p==="true")p=!0;else if(p==="false")p=!1;else if(/^\d+$/.test(p))p=parseInt(p,10);else if(/^\d+\.\d+$/.test(p))p=parseFloat(p);else if(p.startsWith("[")&&p.endsWith("]"))p=p.slice(1,-1).split(",").map((b)=>b.trim().replace(/^['"]|['"]$/g,""));r[D]=p}}}let e=
|
|
84
|
+
`),l}async function q(t,n){await x.promises.mkdir(n,{recursive:!0});let i=await x.promises.readdir(t,{withFileTypes:!0});for(let r of i){let a=g.join(t,r.name),e=g.join(n,r.name);if(r.isDirectory())await x.promises.mkdir(e,{recursive:!0}),await q(a,e);else await x.promises.copyFile(a,e)}}function Nt(t={}){let n=t.cacheDir||c(process.cwd(),"ssg-cache"),i=new lt(n),r=t.revalidate||3600;return{async get(a){let e=await i.get(a);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(a).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${r}, stale-while-revalidate=${r*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(a){let l=V(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>a.match(P.regex)!==null);if(!l){console.warn(`Route not found for revalidation: ${a}`);return}let w=a.match(l.regex),y={};if(w)l.params.forEach((P,D)=>{y[P]=w[D+1]});let f=await o(),{html:S}=await ut(l,y,{},t,f);await i.set(a,{html:S,generatedAt:Date.now(),revalidateAfter:Date.now()+r*1000,etag:Tt(S)}),console.log(`Revalidated: ${a}`)},async invalidate(a){if(typeof a==="string")await i.invalidate(a);else await i.invalidatePattern(a)}}}function zt(t){return async()=>({paths:await t(),fallback:!1})}function Ht(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let n=await Bun.file(t).text(),i=n.match(/^---\n([\s\S]*?)\n---/),r={},a=n;if(i){let f=i[1];a=n.slice(i[0].length).trim();for(let S of f.split(`
|
|
85
|
+
`)){let P=S.indexOf(":");if(P>0){let D=S.slice(0,P).trim(),p=S.slice(P+1).trim();if(p==="true")p=!0;else if(p==="false")p=!1;else if(/^\d+$/.test(p))p=parseInt(p,10);else if(/^\d+\.\d+$/.test(p))p=parseFloat(p);else if(p.startsWith("[")&&p.endsWith("]"))p=p.slice(1,-1).split(",").map((b)=>b.trim().replace(/^['"]|['"]$/g,""));r[D]=p}}}let e=a.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),l=[],w=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,y;while((y=w.exec(e))!==null){let f=parseInt(y[1],10),S=y[2],P=S.toLowerCase().replace(/[^a-z0-9]+/g,"-");l.push({id:P,text:S,level:f})}return{content:e,data:r,toc:l}}}}function Wt(t){return ft(t)}function Jt(t,n){return`<!DOCTYPE html>
|
|
86
86
|
<html>
|
|
87
87
|
<head>
|
|
88
88
|
<meta charset="utf-8">
|
|
@@ -94,4 +94,4 @@ Build complete!
|
|
|
94
94
|
<p>Redirecting to <a href="${t}">${t}</a>...</p>
|
|
95
95
|
<script>window.location.replace('${t}')</script>
|
|
96
96
|
</body>
|
|
97
|
-
</html>`}function Vt(t,n){if(t==="/"||t==="")return g.join(n.outputDir,"index.html");let
|
|
97
|
+
</html>`}function Vt(t,n){if(t==="/"||t==="")return g.join(n.outputDir,"index.html");let i=t.replace(/^\/|\/$/g,"");if(n.trailingSlash)return g.join(n.outputDir,i,"index.html");return g.join(n.outputDir,`${i}.html`)}var ye={generateStaticSite:Ut,createISRHandler:Nt,defineStaticPaths:zt,createMarkdownLoader:Ht};export{Nt as createISRHandler,Ht as createMarkdownLoader,Ft as declaresPageAction,ye as default,zt as defineStaticPaths,Ut as generateStaticSite,At as isExcludedFromSitemap};
|
package/dist/stx-virtual-ts.d.ts
CHANGED
|
@@ -370,7 +370,7 @@ export declare const SCRAPED_COMMENT: 'stx: untyped bridge names — declare a d
|
|
|
370
370
|
* also dropped genuine typos; giving the names a declaration means an
|
|
371
371
|
* unrecognised one is still an error (#1852 ask 3).
|
|
372
372
|
*/
|
|
373
|
-
export declare const STX_TEMPLATE_GLOBALS: readonly ['$env', '$user', '$slot', '$slots', '$attrs', '$props', '$page', '$route', '$loop', unknown, unknown, '$errors', '$csrf',
|
|
373
|
+
export declare const STX_TEMPLATE_GLOBALS: readonly ['$env', '$user', '$slot', '$slots', '$attrs', '$props', '$page', '$route', '$loop', unknown, unknown, '$errors', '$csrf', unknown];
|
|
374
374
|
export declare interface ScriptBlock {
|
|
375
375
|
kind: ScriptKind
|
|
376
376
|
code: string
|
package/dist/stx-virtual-ts.js
CHANGED
|
@@ -349,7 +349,8 @@ export const STX_SERVER_CONTEXT = [
|
|
|
349
349
|
const TYPED_SERVER_CONTEXT = {
|
|
350
350
|
$bool: "declare function $bool(value: unknown, fallback?: boolean): boolean",
|
|
351
351
|
$num: "declare function $num(value: unknown, fallback?: number): number",
|
|
352
|
-
$uid: "declare var $uid: string"
|
|
352
|
+
$uid: "declare var $uid: string",
|
|
353
|
+
$native: "declare var $native: boolean"
|
|
353
354
|
};
|
|
354
355
|
export function serverContextDeclarations(typed = new Set) {
|
|
355
356
|
return [
|
|
@@ -534,6 +535,7 @@ export const STX_TEMPLATE_GLOBALS = [
|
|
|
534
535
|
"loop",
|
|
535
536
|
"$errors",
|
|
536
537
|
"$csrf",
|
|
538
|
+
"$native",
|
|
537
539
|
"props",
|
|
538
540
|
"slot"
|
|
539
541
|
];
|
package/dist/utils.js
CHANGED
|
@@ -835,6 +835,7 @@ export async function renderComponentWithSlot(componentPath, props, slotContent,
|
|
|
835
835
|
}, componentName = projectRelative(componentPath, process.cwd()), componentUid = `stx_${(componentName.endsWith(".stx") ? componentName.slice(0, -4) : componentName).replace(/[^a-zA-Z0-9]/g, "_")}_${++scopeSeq.n}_${scopeSeq.key}`, componentContext = {
|
|
836
836
|
...filteredParentContext,
|
|
837
837
|
$uid: componentUid,
|
|
838
|
+
$native: options._nativeHostAttrs === !0,
|
|
838
839
|
...props,
|
|
839
840
|
props,
|
|
840
841
|
slot: componentSlotContent,
|
|
@@ -868,6 +869,7 @@ export async function renderComponentWithSlot(componentPath, props, slotContent,
|
|
|
868
869
|
slotContext: slotContent.trim() ? componentSlotCacheContext(filteredParentContext) : void 0,
|
|
869
870
|
buildMode: options.buildMode ?? "",
|
|
870
871
|
skipEventDirectives: options.skipEventDirectives === !0,
|
|
872
|
+
native: options._nativeHostAttrs === !0,
|
|
871
873
|
clientLoopNames: [...clientLoopNames].sort(),
|
|
872
874
|
layers: options._layerGraph?.layers.map((layer) => layer.configFile),
|
|
873
875
|
uid: componentUid
|
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.661",
|
|
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.661",
|
|
132
|
+
"@stacksjs/sanitizer": "0.2.661",
|
|
133
133
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
134
|
-
"bun-plugin-stx": "0.2.
|
|
134
|
+
"bun-plugin-stx": "0.2.661",
|
|
135
135
|
"bunfig": "^0.15.21",
|
|
136
|
-
"stx-router": "0.2.
|
|
136
|
+
"stx-router": "0.2.661",
|
|
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-67rvd6qy.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{zs,zd,Hd}from"./chunk-jfmjw734.js";import"./chunk-nn138y2w.js";import"./chunk-cjj9b9wf.js";import"./chunk-v2x9vzgw.js";import"./chunk-31yb0253.js";import"./chunk-teahew39.js";import"./chunk-8nryyqb5.js";import"./chunk-2h92dm3t.js";import"./chunk-e7z85137.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-t9mfztcs.js";import"./chunk-zaaeneq6.js";import"./chunk-hzjvpcmj.js";import"./chunk-jf17b7y9.js";import"./chunk-2h8ea0we.js";import"./chunk-hb08vrbb.js";import"./chunk-ce6zddpf.js";import"./chunk-7rta163c.js";export{Hd as clearComposableCache,zd as getComposableScript,zs as listComposableModules};
|
package/dist/chunk-9c3cq8ks.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-zyv28182.js";import"./chunk-889evdcy.js";import"./chunk-0gqmp9sa.js";import"./chunk-prf164ct.js";import"./chunk-sdknbvh8.js";import"./chunk-wp0jtntj.js";import"./chunk-rccpf74y.js";import"./chunk-r7kmsq3n.js";import"./chunk-31yb0253.js";import"./chunk-teahew39.js";import"./chunk-8nryyqb5.js";import"./chunk-v3kc2anv.js";import"./chunk-2h92dm3t.js";import"./chunk-e7z85137.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-t9mfztcs.js";import"./chunk-zaaeneq6.js";import"./chunk-hzjvpcmj.js";import"./chunk-jf17b7y9.js";import"./chunk-2h8ea0we.js";import"./chunk-hb08vrbb.js";import"./chunk-ce6zddpf.js";import"./chunk-7rta163c.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-9q23eed0.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{$u}from"./chunk-6c2pvrw8.js";import"./chunk-k9amsnfj.js";import"./chunk-cjj9b9wf.js";import"./chunk-teahew39.js";import"./chunk-2h92dm3t.js";import"./chunk-e7z85137.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-t9mfztcs.js";import"./chunk-zaaeneq6.js";import"./chunk-hzjvpcmj.js";import"./chunk-jf17b7y9.js";import"./chunk-2h8ea0we.js";import"./chunk-hb08vrbb.js";import"./chunk-ce6zddpf.js";import"./chunk-7rta163c.js";export{$u as startProductionServer};
|