@stacksjs/stx 0.2.577 → 0.2.580

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.
Files changed (211) hide show
  1. package/dist/chunk-0047meje.js +2 -0
  2. package/dist/chunk-00p22wzr.js +3 -0
  3. package/dist/{chunk-z33z3rr4.js → chunk-0k5faspy.js} +6 -6
  4. package/dist/{chunk-wwhxgvr8.js → chunk-0vnngvy1.js} +4 -4
  5. package/dist/{chunk-7a0ewpz0.js → chunk-101ekf6y.js} +2 -2
  6. package/dist/{chunk-t79xnvzr.js → chunk-117xss52.js} +2 -2
  7. package/dist/chunk-1cat8kdj.js +2 -0
  8. package/dist/chunk-1dwnp35v.js +2 -0
  9. package/dist/{chunk-5vw8493b.js → chunk-1r1maqep.js} +3 -3
  10. package/dist/{chunk-zak5xare.js → chunk-1v1mew46.js} +1 -1
  11. package/dist/chunk-2dnr5qfk.js +2 -0
  12. package/dist/{chunk-1swmxkdt.js → chunk-2rx9d75e.js} +2 -2
  13. package/dist/chunk-2v73cjbc.js +2 -0
  14. package/dist/chunk-30rf7k4n.js +122 -0
  15. package/dist/chunk-3akgppsy.js +2 -0
  16. package/dist/{chunk-8efe5vpm.js → chunk-3e3dpp7w.js} +3 -3
  17. package/dist/{chunk-vnsby98n.js → chunk-3qrrv6af.js} +1 -1
  18. package/dist/{chunk-fkbthywg.js → chunk-3wy8q3aq.js} +5 -5
  19. package/dist/chunk-3x6p9me0.js +2 -0
  20. package/dist/{chunk-tybk9hw9.js → chunk-43h8q2cm.js} +9 -9
  21. package/dist/{chunk-pqkb1m5x.js → chunk-4rkvwm6v.js} +5 -5
  22. package/dist/{chunk-bks1fe5e.js → chunk-4srg0qbv.js} +1 -1
  23. package/dist/chunk-4t67wmcg.js +2 -0
  24. package/dist/chunk-51zn42jy.js +2 -0
  25. package/dist/chunk-5702x95v.js +2 -0
  26. package/dist/{chunk-4z21afpp.js → chunk-5db5sxy3.js} +2 -2
  27. package/dist/{chunk-r4w1cye7.js → chunk-5kh5ehfh.js} +2 -2
  28. package/dist/chunk-5pgbsc3a.js +2 -0
  29. package/dist/chunk-60c2bsh9.js +2 -0
  30. package/dist/{chunk-vw1rmevt.js → chunk-620szfcp.js} +3 -3
  31. package/dist/{chunk-6rfm6b1c.js → chunk-6w2yqtrd.js} +2 -2
  32. package/dist/{chunk-37d52q0d.js → chunk-6z3e1tyz.js} +1 -1
  33. package/dist/{chunk-nskvepjv.js → chunk-71sdgv7e.js} +5 -5
  34. package/dist/chunk-79v4d9qh.js +2 -0
  35. package/dist/{chunk-qfb34r6k.js → chunk-7hkc96de.js} +6 -6
  36. package/dist/chunk-7pp2vx1g.js +2 -0
  37. package/dist/chunk-84f9dnq5.js +2 -0
  38. package/dist/chunk-8tq5x4z8.js +2 -0
  39. package/dist/{chunk-gjp2jxrp.js → chunk-8v19753h.js} +1 -1
  40. package/dist/chunk-8zm6tkqb.js +2 -0
  41. package/dist/{chunk-1dg5qxg9.js → chunk-9jh2ake5.js} +5 -5
  42. package/dist/chunk-a1z36dt5.js +2 -0
  43. package/dist/{chunk-7hr63cp5.js → chunk-ah9xyss2.js} +2 -2
  44. package/dist/chunk-atsf1fe0.js +2 -0
  45. package/dist/{chunk-x5xwe5nr.js → chunk-ayy9mmrw.js} +7 -7
  46. package/dist/chunk-b8qd6h1q.js +2 -0
  47. package/dist/{chunk-vde4mtfr.js → chunk-be2ba3hj.js} +2 -2
  48. package/dist/{chunk-pxk0tpw2.js → chunk-bj29pwm0.js} +3 -3
  49. package/dist/{chunk-gpb22a8n.js → chunk-c0h2eqe0.js} +2 -2
  50. package/dist/{chunk-agk478t4.js → chunk-c0s3k64c.js} +2 -2
  51. package/dist/{chunk-bctjmaxg.js → chunk-c1r7zq0q.js} +41 -41
  52. package/dist/{chunk-32gycb72.js → chunk-cb2pyg5t.js} +2 -2
  53. package/dist/chunk-ccxs40xy.js +2 -0
  54. package/dist/{chunk-7j9m4d7x.js → chunk-cdgwkzms.js} +3 -3
  55. package/dist/{chunk-6c2y9h5h.js → chunk-cnknvvwm.js} +1 -1
  56. package/dist/chunk-cp442y7a.js +2 -0
  57. package/dist/chunk-d4en5d3s.js +2 -0
  58. package/dist/chunk-dh80d57p.js +2 -0
  59. package/dist/{chunk-je0cttam.js → chunk-djft0m5h.js} +2 -2
  60. package/dist/chunk-dpn1pmxj.js +2 -0
  61. package/dist/chunk-dtcc09x1.js +2 -0
  62. package/dist/{chunk-sf7z2ar9.js → chunk-dvgvvy5b.js} +3 -3
  63. package/dist/chunk-dyqte1xq.js +2 -0
  64. package/dist/chunk-e4n4v022.js +2 -0
  65. package/dist/chunk-efgk2xv1.js +2 -0
  66. package/dist/{chunk-h1n43e5n.js → chunk-ev5f79mg.js} +5 -5
  67. package/dist/{chunk-1wkpxa58.js → chunk-eww6sdzz.js} +2 -2
  68. package/dist/{chunk-34fajf1n.js → chunk-faghmmrs.js} +139 -139
  69. package/dist/chunk-fj70wq7k.js +2 -0
  70. package/dist/chunk-g2fw68zm.js +2 -0
  71. package/dist/{chunk-szfkkbve.js → chunk-g4crr86j.js} +3 -3
  72. package/dist/{chunk-xh0808cd.js → chunk-h0a2s340.js} +2 -2
  73. package/dist/chunk-hcgm37dy.js +2 -0
  74. package/dist/chunk-hd2bn5q7.js +2 -0
  75. package/dist/{chunk-5dm4k229.js → chunk-hzfhn2vr.js} +2 -2
  76. package/dist/{chunk-6wz6f8d5.js → chunk-j1nqnmcd.js} +4 -4
  77. package/dist/{chunk-1c8sdf9a.js → chunk-jpqkm8tm.js} +2 -2
  78. package/dist/{chunk-550q827h.js → chunk-jtbzmbzz.js} +4 -4
  79. package/dist/chunk-k7jqkt93.js +2 -0
  80. package/dist/{chunk-wvk932dp.js → chunk-k9th7hc4.js} +4 -4
  81. package/dist/chunk-kp0hg06s.js +15 -0
  82. package/dist/{chunk-kskyfss0.js → chunk-ktyctev3.js} +2 -2
  83. package/dist/{chunk-xk2v20xe.js → chunk-m8tm44rq.js} +2 -2
  84. package/dist/chunk-mhjwtkx9.js +2 -0
  85. package/dist/chunk-mqy7g74k.js +2 -0
  86. package/dist/chunk-mxe21m6q.js +2 -0
  87. package/dist/chunk-ne03tfje.js +2 -0
  88. package/dist/{chunk-3gqrv02t.js → chunk-nrfh7gaa.js} +3 -3
  89. package/dist/chunk-p2sns0bn.js +2 -0
  90. package/dist/{chunk-jgrtvs81.js → chunk-pmpb34md.js} +5 -5
  91. package/dist/chunk-q2a58n2a.js +2 -0
  92. package/dist/{chunk-5xwmkxkk.js → chunk-qazn64pm.js} +1 -1
  93. package/dist/{chunk-7bwkeake.js → chunk-qccgncp2.js} +6 -6
  94. package/dist/{chunk-1edvsndv.js → chunk-qdyp2zqf.js} +2 -2
  95. package/dist/chunk-rr8a7d4q.js +11 -0
  96. package/dist/{chunk-mr9c2ej6.js → chunk-s12bnv32.js} +2 -2
  97. package/dist/chunk-s1sycp43.js +2 -0
  98. package/dist/chunk-s932zfjz.js +2 -0
  99. package/dist/chunk-sp46w7z9.js +2 -0
  100. package/dist/{chunk-tasjpnbf.js → chunk-sv5nvfmb.js} +2 -2
  101. package/dist/chunk-sy1bk1ry.js +2 -0
  102. package/dist/chunk-t48ws5j0.js +2 -0
  103. package/dist/{chunk-sn3htx1z.js → chunk-t4g2fptt.js} +6 -6
  104. package/dist/{chunk-d8ek63nc.js → chunk-t8wpzqs4.js} +1 -1
  105. package/dist/{chunk-bpdsdbvg.js → chunk-ta3wn842.js} +2 -2
  106. package/dist/chunk-thbc9gtj.js +2 -0
  107. package/dist/chunk-tn9v10q2.js +2 -0
  108. package/dist/chunk-tpd5nwa3.js +2 -0
  109. package/dist/chunk-tpt4bgs5.js +2 -0
  110. package/dist/{chunk-n829xbbq.js → chunk-tszkg6sj.js} +2 -2
  111. package/dist/chunk-v8p5p2kp.js +2 -0
  112. package/dist/chunk-v9jd283e.js +2 -0
  113. package/dist/{chunk-4xvbc0mb.js → chunk-vpdx7qr3.js} +2 -2
  114. package/dist/chunk-vq0cb1m9.js +2 -0
  115. package/dist/chunk-vx75fb0d.js +33 -0
  116. package/dist/{chunk-pveafhzg.js → chunk-w3rmepwy.js} +2 -2
  117. package/dist/{chunk-xsxh7h8z.js → chunk-wg2w7zmt.js} +2 -2
  118. package/dist/chunk-wgkxgsqx.js +2 -0
  119. package/dist/{chunk-707n4pbz.js → chunk-wwj8zbzc.js} +5 -5
  120. package/dist/{chunk-p3xkj7pm.js → chunk-xpnpg967.js} +2 -2
  121. package/dist/chunk-y1bppxgw.js +2 -0
  122. package/dist/{chunk-1w9ngqpv.js → chunk-y8q1n7hx.js} +10 -10
  123. package/dist/{chunk-vmetcczm.js → chunk-yfq2v7x5.js} +6 -6
  124. package/dist/{chunk-h72befy4.js → chunk-yhpyqsbr.js} +4 -4
  125. package/dist/{chunk-n0kw3q6p.js → chunk-yk3fbzx5.js} +4 -4
  126. package/dist/chunk-yv5rwthv.js +2 -0
  127. package/dist/{chunk-mp99h8wh.js → chunk-yy3ser06.js} +5 -5
  128. package/dist/chunk-yygze2s0.js +2 -0
  129. package/dist/chunk-z1r4tdqy.js +2 -0
  130. package/dist/chunk-z732tf98.js +2 -0
  131. package/dist/{chunk-haeb904b.js → chunk-zk2xk0wd.js} +2 -2
  132. package/dist/chunk-zv288w4e.js +2 -0
  133. package/dist/{chunk-j4zyq2ap.js → chunk-zz02hwec.js} +11 -11
  134. package/dist/cli.js +19 -19
  135. package/dist/client-script-bundler.d.ts +12 -0
  136. package/dist/client-script-bundler.js +19 -5
  137. package/dist/composable-loader.js +2 -2
  138. package/dist/craft-entry.js +2 -2
  139. package/dist/craft.js +2 -2
  140. package/dist/native/bridge/protocol.d.ts +2 -0
  141. package/dist/native/compiler/bundle.d.ts +22 -0
  142. package/dist/native/compiler/bundle.js +164 -20
  143. package/dist/native/runtime/craft-bridge.js +16 -0
  144. package/dist/pwa.js +3 -3
  145. package/dist/ssg.js +3 -3
  146. package/dist/store-loader.js +7 -7
  147. package/package.json +5 -5
  148. package/dist/chunk-08a98yqt.js +0 -2
  149. package/dist/chunk-0q5s55km.js +0 -2
  150. package/dist/chunk-181m21rg.js +0 -2
  151. package/dist/chunk-194qgkc9.js +0 -2
  152. package/dist/chunk-1nbn56jw.js +0 -2
  153. package/dist/chunk-2ry2pfpe.js +0 -2
  154. package/dist/chunk-3bj1w990.js +0 -2
  155. package/dist/chunk-4a12azrb.js +0 -2
  156. package/dist/chunk-6aq3sm83.js +0 -2
  157. package/dist/chunk-6fpynp8q.js +0 -2
  158. package/dist/chunk-6q3yszw9.js +0 -74
  159. package/dist/chunk-6ryab0yy.js +0 -2
  160. package/dist/chunk-6sasxbv9.js +0 -2
  161. package/dist/chunk-6w9km7qb.js +0 -2
  162. package/dist/chunk-7kh4p06d.js +0 -2
  163. package/dist/chunk-7xrrzqh7.js +0 -2
  164. package/dist/chunk-7y73q42g.js +0 -11
  165. package/dist/chunk-8jaw6exk.js +0 -2
  166. package/dist/chunk-98r9jk2b.js +0 -2
  167. package/dist/chunk-9dgygz8d.js +0 -2
  168. package/dist/chunk-a51f04an.js +0 -2
  169. package/dist/chunk-aa52jhak.js +0 -2
  170. package/dist/chunk-ambynnzb.js +0 -2
  171. package/dist/chunk-ampr3fpv.js +0 -2
  172. package/dist/chunk-asbq9cgs.js +0 -2
  173. package/dist/chunk-bbdg3sqq.js +0 -33
  174. package/dist/chunk-bmtsb5mr.js +0 -2
  175. package/dist/chunk-c8rd3573.js +0 -2
  176. package/dist/chunk-d4b8cgvt.js +0 -2
  177. package/dist/chunk-d7skqhrc.js +0 -2
  178. package/dist/chunk-ensp20xk.js +0 -2
  179. package/dist/chunk-f1zyc84x.js +0 -2
  180. package/dist/chunk-f2y8bwdd.js +0 -2
  181. package/dist/chunk-g9vtny6q.js +0 -2
  182. package/dist/chunk-hcsrj8z6.js +0 -3
  183. package/dist/chunk-hj1bntaa.js +0 -2
  184. package/dist/chunk-hwy3aw5v.js +0 -2
  185. package/dist/chunk-hyafyqy6.js +0 -2
  186. package/dist/chunk-j75hqvgt.js +0 -2
  187. package/dist/chunk-j83ax407.js +0 -2
  188. package/dist/chunk-k3hfwve1.js +0 -2
  189. package/dist/chunk-ktc1ecsm.js +0 -2
  190. package/dist/chunk-mbmbaj0m.js +0 -2
  191. package/dist/chunk-nd3qttxh.js +0 -2
  192. package/dist/chunk-ndc1bmj7.js +0 -2
  193. package/dist/chunk-nn462qm9.js +0 -2
  194. package/dist/chunk-nr07vxm2.js +0 -2
  195. package/dist/chunk-q7a5pwaz.js +0 -2
  196. package/dist/chunk-qx6tr8mr.js +0 -2
  197. package/dist/chunk-r51vyhms.js +0 -2
  198. package/dist/chunk-s68bqf62.js +0 -2
  199. package/dist/chunk-s6sf70ty.js +0 -2
  200. package/dist/chunk-svavrmxb.js +0 -2
  201. package/dist/chunk-sw7mvg9p.js +0 -2
  202. package/dist/chunk-tz40t18m.js +0 -2
  203. package/dist/chunk-v1k0bdsg.js +0 -2
  204. package/dist/chunk-vd10tty0.js +0 -2
  205. package/dist/chunk-vqkzhd19.js +0 -2
  206. package/dist/chunk-w1yft5gg.js +0 -2
  207. package/dist/chunk-w6sa921x.js +0 -2
  208. package/dist/chunk-y120qq1a.js +0 -15
  209. package/dist/chunk-zcw74jmk.js +0 -2
  210. package/dist/chunk-zxvndwaz.js +0 -2
  211. package/dist/chunk-zzr0p4bb.js +0 -2
@@ -21,6 +21,16 @@ export declare function compileNativeBundle(options: CompileNativeBundleOptions)
21
21
  export declare function compileSharedScreenBundle(file: string, options?: Pick<CompileNativeBundleOptions, 'minify' | 'outFile' | 'root'>): Promise<NativeBundleResult>;
22
22
  /** One `.stx` file, as the public single-screen native compiler writes it. */
23
23
  export declare function compileScreenBundle(file: string, options?: Pick<CompileNativeBundleOptions, 'minify' | 'outFile' | 'root'>): Promise<NativeBundleResult>;
24
+ /**
25
+ * The runtime prelude's name in a `routesDir`: `__runtime.js`, which a host
26
+ * evaluates in each screen's context before that screen's own route file.
27
+ */
28
+ export declare const NATIVE_RUNTIME_ROUTE: '__runtime';
29
+ /**
30
+ * Where a `routesDir` keeps the messages: `__messages/<language>/<area>.json`,
31
+ * and `__messages/routes.json`, each route's areas.
32
+ */
33
+ export declare const NATIVE_MESSAGES_DIR: '__messages';
24
34
  export declare interface CompileNativeBundleOptions {
25
35
  screens: Record<string, string>
26
36
  initialScreen?: string
@@ -31,6 +41,12 @@ export declare interface CompileNativeBundleOptions {
31
41
  app?: string
32
42
  browser?: BrowserScreenOptions & { platformModule: string, platformOptions?: Record<string, unknown> }
33
43
  routesDir?: string
44
+ sharedRuntime?: boolean
45
+ messages?: NativeMessagesOptions
46
+ }
47
+ export declare interface NativeMessagesOptions {
48
+ dir: string
49
+ languages: string[]
34
50
  }
35
51
  /** Something the compiler could not translate exactly: an unknown icon or class. */
36
52
  export declare interface NativeDiagnostic {
@@ -42,6 +58,12 @@ export declare interface NativeBundleResult {
42
58
  code: string
43
59
  outFile?: string
44
60
  routes?: Record<string, string>
61
+ runtime?: string
62
+ messages?: {
63
+ dir: string
64
+ languages: string[]
65
+ routes: Record<string, string[]>
66
+ }
45
67
  diagnostics: NativeDiagnostic[]
46
68
  }
47
69
  /** @deprecated Use `CompileNativeBundleOptions`. */
@@ -1,8 +1,10 @@
1
- import { existsSync, mkdirSync } from "node:fs";
1
+ import { existsSync, mkdirSync, realpathSync, rmSync } from "node:fs";
2
2
  import path from "node:path";
3
3
  import { compileScreenFile } from "./render-screen.js";
4
4
  import { NATIVE_APP_ROUTE } from "../runtime/shared-screen.js";
5
5
  import { generateSignalsRuntime } from "../../signals.js";
6
+ import { withModuleSubstitutes } from "../../client-script-bundler.js";
7
+ export const NATIVE_RUNTIME_ROUTE = "__runtime", NATIVE_MESSAGES_DIR = "__messages";
6
8
  function nativeRuntimeModule(name) {
7
9
  const resolved = [
8
10
  path.join(import.meta.dir, "..", "runtime", `${name}.ts`),
@@ -13,11 +15,12 @@ function nativeRuntimeModule(name) {
13
15
  throw Error(`Native runtime module ${name} is missing`);
14
16
  return resolved;
15
17
  }
16
- async function build(entry, plugins, minify, dependencies) {
18
+ async function build(entry, plugins, minify, dependencies, substitutes) {
17
19
  const track = { name: "stx-screen-inputs", setup(builder) {
18
20
  builder.onLoad({ filter: /.*/, namespace: "file" }, ({ path: file }) => {
19
21
  dependencies.add(file);
20
- return;
22
+ const contents = substitutes?.get(file);
23
+ return contents === void 0 ? void 0 : { contents, loader: "js" };
21
24
  });
22
25
  } }, result = await Bun.build({
23
26
  entrypoints: [entry],
@@ -35,6 +38,58 @@ ${messages}`);
35
38
  }
36
39
  return (await result.outputs[0].text()).trim();
37
40
  }
41
+ const MESSAGE_AREA = /^[\w-]+(?:\/[\w-]+)*$/, MESSAGE_LANGUAGE = /^[\w-]+$/;
42
+ async function collectMessages(root, options) {
43
+ const dir = path.resolve(root, options.dir);
44
+ if (!options.languages?.length)
45
+ throw Error("messages.languages must name at least one language");
46
+ const files = new Map, data = new Map;
47
+ for (const language of options.languages) {
48
+ if (!MESSAGE_LANGUAGE.test(language))
49
+ throw Error(`messages: "${language}" is not a language directory name`);
50
+ const base = path.join(dir, language);
51
+ if (!existsSync(base))
52
+ throw Error(`messages: ${path.relative(root, base)} does not exist`);
53
+ const areas = new Map;
54
+ for (const relative of [...new Bun.Glob("**/*.{ts,js,mjs,json}").scanSync({ cwd: base })].sort()) {
55
+ if (/\.(?:test|spec|d)\.[^.]+$/.test(relative))
56
+ continue;
57
+ const area = relative.replace(/\.[^./]+$/, "").split(path.sep).join("/");
58
+ if (!MESSAGE_AREA.test(area))
59
+ throw Error(`messages: ${language}/${relative} is not an area name`);
60
+ if (areas.has(area))
61
+ throw Error(`messages: ${language}/${area} is defined twice`);
62
+ const file = path.join(base, relative), module = await import(file), others = Object.keys(module).filter((name) => name !== "default");
63
+ if (others.length)
64
+ throw Error(`messages: ${language}/${relative} exports ${others.join(", ")}; a message module exports its messages as default, and nothing else`);
65
+ const value = module.default, json = value !== null && typeof value === "object" && !Array.isArray(value) ? JSON.stringify(value) : void 0;
66
+ if (json === void 0 || !Bun.deepEquals(JSON.parse(json), value, !0))
67
+ throw Error(`messages: ${language}/${relative} must export plain data (an object JSON can hold) as default`);
68
+ areas.set(area, json);
69
+ files.set(file, { language, area });
70
+ }
71
+ data.set(language, areas);
72
+ }
73
+ return { files, data };
74
+ }
75
+ function messagesStub(language, area) {
76
+ return `export default globalThis.__stxNativeRuntime.messages(${JSON.stringify(language)}, ${JSON.stringify(area)});`;
77
+ }
78
+ function messageStubs(messages) {
79
+ const stubs = new Map;
80
+ for (const [file, { language, area }] of messages.files) {
81
+ const stub = messagesStub(language, area);
82
+ stubs.set(file, stub);
83
+ stubs.set(realpathSync(file), stub);
84
+ }
85
+ return stubs;
86
+ }
87
+ function areasRead(code) {
88
+ const areas = new Set;
89
+ for (const match of code.matchAll(/__stxNativeRuntime\.messages\(\s*"[\w-]+"\s*,\s*"([\w/-]+)"\s*\)/g))
90
+ areas.add(match[1]);
91
+ return [...areas].sort();
92
+ }
38
93
  function runtimeDocument(document) {
39
94
  return { ...document, script: { exports: document.script.exports, functions: [], code: "" } };
40
95
  }
@@ -45,13 +100,27 @@ export async function compileNativeBundle(options) {
45
100
  const routed = options.routed ?? !0, initialScreen = options.initialScreen ?? names[0];
46
101
  if (!options.screens[initialScreen])
47
102
  throw Error(`Initial screen ${initialScreen} is not in screens`);
48
- const root = path.resolve(options.root ?? process.cwd()), compiledScreens = [];
49
- for (const name of names) {
50
- const file = path.resolve(root, options.screens[name]);
51
- if (!file.endsWith(".stx"))
52
- throw Error(`Screen ${name} must name a .stx file`);
53
- compiledScreens.push({ name, file, compiled: await compileScreenFile(file, { root }) });
54
- }
103
+ const root = path.resolve(options.root ?? process.cwd());
104
+ if (options.messages && !options.routesDir)
105
+ throw Error("messages ship a language at a time beside route files: they need routesDir");
106
+ if (options.sharedRuntime && !options.routesDir)
107
+ throw Error("sharedRuntime is the route files' runtime: it needs routesDir");
108
+ if (options.messages && !options.sharedRuntime)
109
+ throw Error("messages are read by the shared runtime: they need sharedRuntime");
110
+ if (options.messages && options.outFile)
111
+ throw Error("messages leave the languages out of the screens' code, which the one-file bundle cannot read: build it without messages");
112
+ const messages = options.messages ? await collectMessages(root, options.messages) : null, stubs = messages ? messageStubs(messages) : null, compiledScreens = [], compileScreens = async () => {
113
+ for (const name of names) {
114
+ const file = path.resolve(root, options.screens[name]);
115
+ if (!file.endsWith(".stx"))
116
+ throw Error(`Screen ${name} must name a .stx file`);
117
+ compiledScreens.push({ name, file, compiled: await compileScreenFile(file, { root }) });
118
+ }
119
+ };
120
+ if (stubs)
121
+ await withModuleSubstitutes(stubs, compileScreens);
122
+ else
123
+ await compileScreens();
55
124
  const runtimeGlobals = nativeRuntimeModule("jsc-globals"), sharedScreen = nativeRuntimeModule("shared-screen"), appFile = options.app ? path.resolve(root, options.app) : null;
56
125
  if (appFile && !existsSync(appFile))
57
126
  throw Error(`The app script ${options.app} does not exist`);
@@ -60,9 +129,12 @@ export async function compileNativeBundle(options) {
60
129
  if (appFile && options.screens[NATIVE_APP_ROUTE])
61
130
  throw Error(`${NATIVE_APP_ROUTE} is the app script's route, not a screen name`);
62
131
  const browser = options.browser;
132
+ if (options.screens[NATIVE_RUNTIME_ROUTE])
133
+ throw Error(`${NATIVE_RUNTIME_ROUTE} is the runtime prelude's file, not a screen name`);
134
+ const signalsRuntime = generateSignalsRuntime();
63
135
  if (browser && options.routesDir)
64
136
  throw Error("A browser screen is one route; routesDir is for device hosts");
65
- const entry = (bundled, withApp) => {
137
+ const entry = (bundled, withApp, runtimeVersion) => {
66
138
  const route = routed ? `var routeName = g.__stxNativeRoute || ${JSON.stringify(initialScreen)};
67
139
  var isApp = ${appFile ? `routeName === ${JSON.stringify(NATIVE_APP_ROUTE)}` : "false"};
68
140
  if (!isApp && routeNames.indexOf(routeName) === -1) throw new Error(['Unknown native screen:', routeName].join(' '));
@@ -82,8 +154,12 @@ ${script.code}
82
154
  }`).join(`
83
155
  `), app = withApp && appFile, browserRuntime = browser ? nativeRuntimeModule("browser-screen") : null, platformModule = browser ? Bun.resolveSync(browser.platformModule, root) : null;
84
156
  return `
85
- import { installJSCGlobals } from ${JSON.stringify(runtimeGlobals)};
86
- import { prepareNativeApp, prepareSharedNativeScreen } from ${JSON.stringify(sharedScreen)};
157
+ ${runtimeVersion ? `var runtime = globalThis.__stxNativeRuntime;
158
+ if (!runtime || runtime.version !== ${JSON.stringify(runtimeVersion)}) throw new Error('This screen needs the stx native runtime it was built with: evaluate ${NATIVE_RUNTIME_ROUTE}.js from the same build first');
159
+ var installJSCGlobals = runtime.installJSCGlobals;
160
+ var prepareNativeApp = runtime.prepareNativeApp;
161
+ var prepareSharedNativeScreen = runtime.prepareSharedNativeScreen;` : `import { installJSCGlobals } from ${JSON.stringify(runtimeGlobals)};
162
+ import { prepareNativeApp, prepareSharedNativeScreen } from ${JSON.stringify(sharedScreen)};`}
87
163
  ${browser ? `import { createBrowserScreenBridge } from ${JSON.stringify(browserRuntime)};
88
164
  import { createBrowserPlatform } from ${JSON.stringify(platformModule)};` : ""}
89
165
  ${app ? `import * as nativeAppModule from ${JSON.stringify(appFile)};` : "var nativeAppModule = null;"}
@@ -112,7 +188,7 @@ else {
112
188
  g.__stx_host = screen.host;
113
189
  g.__stxNativeUnmount = function() { screen.unmount(); };
114
190
  }
115
- ${generateSignalsRuntime()}
191
+ ${runtimeVersion ? "runtime.startSignals();" : signalsRuntime}
116
192
  var pageSetup = g.__stx_latestSetup;
117
193
  var pageRuntimeSetup = g.stx && g.stx._latestSetup;
118
194
  ${setups}
@@ -143,23 +219,91 @@ g.addEventListener('pagehide', function(event) { if (!event.persisted) g.__stxNa
143
219
  level: "warning",
144
220
  message: [diagnostic.kind, diagnostic.tag, diagnostic.name].filter(Boolean).join(": ")
145
221
  })), minify = options.minify ?? !1;
146
- let routes;
222
+ let routes, runtime, written;
147
223
  if (options.routesDir) {
148
224
  const dir = path.resolve(root, options.routesDir);
149
225
  mkdirSync(dir, { recursive: !0 });
150
- const targets = [
226
+ const prelude = `
227
+ import { installJSCGlobals } from ${JSON.stringify(runtimeGlobals)};
228
+ import { prepareNativeApp, prepareSharedNativeScreen } from ${JSON.stringify(sharedScreen)};
229
+ globalThis.__stxNativeRuntime = {
230
+ version: '__STX_NATIVE_RUNTIME_VERSION__',
231
+ installJSCGlobals: installJSCGlobals,
232
+ prepareNativeApp: prepareNativeApp,
233
+ prepareSharedNativeScreen: prepareSharedNativeScreen,
234
+ // Each screen starts its own signals runtime, after its host is in place.
235
+ startSignals: function() {
236
+ ${signalsRuntime}
237
+ },
238
+ // A language's messages for an area (the compile's \`messages\`), read the
239
+ // first time they are looked into: a screen never parses a language it
240
+ // is not shown in, nor an area it does not use.
241
+ messages: function(language, area) {
242
+ var g = globalThis;
243
+ var loaded = g.__stxNativeMessages || (g.__stxNativeMessages = {});
244
+ function table() {
245
+ var forLanguage = loaded[language] || (loaded[language] = {});
246
+ if (Object.prototype.hasOwnProperty.call(forLanguage, area)) return forLanguage[area];
247
+ var value = null;
248
+ if (typeof g.__stxNativeReadMessages === 'function') {
249
+ try {
250
+ var text = g.__stxNativeReadMessages(language, area);
251
+ if (typeof text === 'string') value = JSON.parse(text);
252
+ }
253
+ catch (error) { console.error('[stx native] could not read the ' + language + ' messages for ' + area, error); }
254
+ }
255
+ forLanguage[area] = value;
256
+ return value;
257
+ }
258
+ var own = Object.prototype.hasOwnProperty;
259
+ return new Proxy({}, {
260
+ get: function(target, name) { var messages = table(); return messages && own.call(messages, name) ? messages[name] : undefined; },
261
+ has: function(target, name) { var messages = table(); return !!messages && own.call(messages, name); },
262
+ ownKeys: function() { var messages = table(); return messages ? Object.keys(messages) : []; },
263
+ getOwnPropertyDescriptor: function(target, name) {
264
+ var messages = table();
265
+ return messages && own.call(messages, name) ? { value: messages[name], writable: false, enumerable: true, configurable: true } : undefined;
266
+ },
267
+ });
268
+ },
269
+ };
270
+ `;
271
+ let runtimeVersion;
272
+ const runtimeFile = path.join(dir, `${NATIVE_RUNTIME_ROUTE}.js`);
273
+ if (options.sharedRuntime) {
274
+ const preludeCode = await build("stx:native-shared-screens", [plugin(prelude)], minify, dependencies);
275
+ runtimeVersion = Bun.hash(preludeCode).toString(36);
276
+ runtime = runtimeFile;
277
+ await Bun.write(runtime, preludeCode.replace("__STX_NATIVE_RUNTIME_VERSION__", runtimeVersion));
278
+ } else
279
+ rmSync(runtimeFile, { force: !0 });
280
+ const messagesDir = path.join(dir, NATIVE_MESSAGES_DIR);
281
+ rmSync(messagesDir, { recursive: !0, force: !0 });
282
+ const routeAreas = {}, targets = [
151
283
  ...compiledScreens.map((screen) => ({ name: screen.name, screens: [screen], app: !1 })),
152
284
  ...appFile ? [{ name: NATIVE_APP_ROUTE, screens: [], app: !0 }] : []
153
285
  ];
154
286
  routes = {};
155
287
  for (let next = 0;next < targets.length; next += 6)
156
288
  await Promise.all(targets.slice(next, next + 6).map(async (target) => {
157
- const file = path.join(dir, `${target.name}.js`);
158
- await Bun.write(file, await build("stx:native-shared-screens", [plugin(entry(target.screens, target.app))], minify, dependencies));
289
+ const file = path.join(dir, `${target.name}.js`), code = await build("stx:native-shared-screens", [plugin(entry(target.screens, target.app, runtimeVersion))], minify, dependencies, stubs ?? void 0);
290
+ await Bun.write(file, code);
159
291
  routes[target.name] = file;
292
+ if (messages)
293
+ routeAreas[target.name] = areasRead(code);
160
294
  }));
295
+ if (messages) {
296
+ for (const [language, areas] of messages.data)
297
+ for (const [area, json] of areas)
298
+ await Bun.write(path.join(messagesDir, language, `${area}.json`), json);
299
+ const sorted = Object.fromEntries(Object.keys(routeAreas).sort().map((name) => [name, routeAreas[name]]));
300
+ await Bun.write(path.join(messagesDir, "routes.json"), JSON.stringify(sorted));
301
+ for (const file of messages.files.keys())
302
+ dependencies.add(file);
303
+ written = { dir: messagesDir, languages: [...messages.data.keys()], routes: sorted };
304
+ }
161
305
  if (!options.outFile)
162
- return { code: "", routes, diagnostics, dependencies: [...dependencies] };
306
+ return { code: "", routes, runtime, ...written ? { messages: written } : {}, diagnostics, dependencies: [...dependencies] };
163
307
  }
164
308
  const code = await build("stx:native-shared-screens", [plugin(entry(compiledScreens, !0))], minify, dependencies);
165
309
  if (!options.outFile)
@@ -167,7 +311,7 @@ g.addEventListener('pagehide', function(event) { if (!event.persisted) g.__stxNa
167
311
  const outFile = path.resolve(root, options.outFile);
168
312
  mkdirSync(path.dirname(outFile), { recursive: !0 });
169
313
  await Bun.write(outFile, code);
170
- return { code, outFile, ...routes ? { routes } : {}, diagnostics, dependencies: [...dependencies] };
314
+ return { code, outFile, ...routes ? { routes, runtime } : {}, ...written ? { messages: written } : {}, diagnostics, dependencies: [...dependencies] };
171
315
  }
172
316
  export async function compileSharedScreenBundle(file, options = {}) {
173
317
  return compileNativeBundle({ ...options, screens: { main: file }, routed: !1 });
@@ -184,6 +184,22 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
184
184
  delete: (key) => request("SecureStorage", "remove", [key]),
185
185
  clear: () => request("SecureStorage", "clear", [])
186
186
  });
187
+ const sessionKey = String(craft.session?.key || nativeBridge.sessionTokenKey || "auth.token");
188
+ craft.session = Object.assign({
189
+ token: () => {
190
+ const value = craft.secureStorage.getSync(sessionKey);
191
+ return typeof value === "string" && value ? value : null;
192
+ }
193
+ }, craft.session || {}, {
194
+ key: sessionKey,
195
+ onChange: (callback) => protocol.on("SESSION_CHANGED", ({ payload }) => {
196
+ if (payload?.key && payload.key !== sessionKey)
197
+ return;
198
+ const token = typeof payload?.token === "string" && payload.token ? payload.token : null, previous = typeof payload?.previous === "string" && payload.previous ? payload.previous : null;
199
+ if (token !== previous)
200
+ callback(token, previous);
201
+ })
202
+ });
187
203
  craft.snapshots = Object.assign({ get: () => null, set: () => Promise.resolve(!1) }, craft.snapshots || {}, {
188
204
  onChange: (callback) => protocol.on("SNAPSHOT_CHANGED", (message) => {
189
205
  if (typeof message.payload?.name === "string")
package/dist/pwa.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{Un,je,Go,ec}from"./chunk-n0kw3q6p.js";import{Hn,Jr,Ya,Za,Qa}from"./chunk-sn3htx1z.js";import{Vo,Wo,qo,Xa,Ja}from"./chunk-gpb22a8n.js";import{ae,yt,Yr}from"./chunk-1c8sdf9a.js";import{nl,rl,sl,ol,vr,_u}from"./chunk-5dm4k229.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-6ryab0yy.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>
2
+ import{Vn,je,Xo,nc}from"./chunk-yk3fbzx5.js";import{Un,Yr,Qa,ec,tc}from"./chunk-t4g2fptt.js";import{qo,Go,Ko,Ya,Za}from"./chunk-c0h2eqe0.js";import{ae,yt,Zr}from"./chunk-jpqkm8tm.js";import{sl,ol,il,al,xr,Tu}from"./chunk-hzfhn2vr.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-sy1bk1ry.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">
@@ -233,4 +233,4 @@ Icon generation requires the sharp package for image processing.`),e.success=!1,
233
233
  }, 5000);
234
234
  </script>
235
235
  </body>
236
- </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=ae(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Un(n,t);if(a){let s=je(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function se(n,t){return Jr(n,t)}function oe(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,Wo as auditBuildOutput,Vo as auditConfig,re as buildPwaAssets,qo as calculateAuditResult,Ja as formatAuditResult,Yr as formatSize,j as generateManifest,_ as generateManifestJson,Za as generateManifestLink,F as generateOfflinePage,ae as generatePrecacheManifest,yt as generatePrecacheManifestJs,M as generatePwaIcons,Hn as generatePwaTags,Un as generateServiceWorker,ec as generateServiceWorkerAuto,Ya as generateSwRegistrationScript,Qa as generateThemeColorMeta,N as getExpectedIconPaths,je as getServiceWorkerFileName,Jr as injectPwaTags,oe as isPwaEnabled,I as isSharpAvailable,Go as isWorkboxEnabled,q as mergeManifestConfig,se as processPwaHtml,vr as pwaDirectives,nl as pwaInstallDirective,sl as pwaOfflineDirective,ol as pwaPushDirective,rl as pwaUpdateDirective,_u as registerPwaDirectives,Xa as runPwaAudit,D as validateManifest};
236
+ </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=ae(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Vn(n,t);if(a){let s=je(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function se(n,t){return Yr(n,t)}function oe(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,Go as auditBuildOutput,qo as auditConfig,re as buildPwaAssets,Ko as calculateAuditResult,Za as formatAuditResult,Zr as formatSize,j as generateManifest,_ as generateManifestJson,ec as generateManifestLink,F as generateOfflinePage,ae as generatePrecacheManifest,yt as generatePrecacheManifestJs,M as generatePwaIcons,Un as generatePwaTags,Vn as generateServiceWorker,nc as generateServiceWorkerAuto,Qa as generateSwRegistrationScript,tc as generateThemeColorMeta,N as getExpectedIconPaths,je as getServiceWorkerFileName,Yr as injectPwaTags,oe as isPwaEnabled,I as isSharpAvailable,Xo as isWorkboxEnabled,q as mergeManifestConfig,se as processPwaHtml,xr as pwaDirectives,sl as pwaInstallDirective,il as pwaOfflineDirective,al as pwaPushDirective,ol as pwaUpdateDirective,Tu as registerPwaDirectives,Ya as runPwaAudit,D as validateManifest};
package/dist/ssg.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-kskyfss0.js";import"./chunk-qfb34r6k.js";import"./chunk-7hr63cp5.js";import{rt,st,ot,it,at,ct}from"./chunk-h72befy4.js";import"./chunk-haeb904b.js";import"./chunk-4xvbc0mb.js";import{f,He,L,J,n,o}from"./chunk-34fajf1n.js";import"./chunk-tybk9hw9.js";import{cr}from"./chunk-x5xwe5nr.js";import"./chunk-vde4mtfr.js";import"./chunk-1wkpxa58.js";import"./chunk-1edvsndv.js";import"./chunk-550q827h.js";import"./chunk-mp99h8wh.js";import{ce,bt,wt}from"./chunk-y120qq1a.js";import{zo,Ho,Uo}from"./chunk-pxk0tpw2.js";import{ht,nn,rn}from"./chunk-xsxh7h8z.js";import"./chunk-7j9m4d7x.js";import{a}from"./chunk-hcsrj8z6.js";import x from"fs";import g from"path";import{createHash as Dt}from"crypto";function Rt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var kt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Ct(t){return Bun.hash(t).toString(16)}function ut(t,i={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,r=t.replace(kt,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(i.minify)h=Rt(h);let S=Ct(h);if(!s.has(S))s.set(S,h);let P=i.integrity?` data-stx-integrity="sha384-${Dt("sha384").update(h).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),c=Array.from(s,([e,l])=>({hash:e,code:l}));return{html:r,chunks:c}}var Et=new Set(["visible","idle"]);function dt(t){if(!t.includes("data-stx-src="))return t;let i=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,r;while((r=s.exec(t))!==null)i.set(r[1],r[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(Et.has(i.get(l[1])||""))c.add(l[2]);let w=t.lastIndexOf("</head>");if(c.size===0||w===-1)return t;let y=Array.from(c).filter((h)=>!t.includes(`rel="prefetch" href="${h}"`)).map((h)=>`<link rel="prefetch" href="${h}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var It=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function q(t){let i=t.trim();if(!i)return null;let s=/^https?:\/\//i.test(i)?i:`https://${i}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function Bt(t){for(let i of It){let s=t[i];if(!s)continue;let r=q(s);if(r)return{url:r,source:"env",via:i}}return null}function gt(t){if(!t||typeof t!=="object")return null;let i=t,s=i.site?.url??i.url??i.app?.url;return typeof s==="string"?q(s):null}async function jt(t){let{existsSync:i}=await import("fs"),s=await import("path");for(let r of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(t,r);if(!i(c))continue;try{let e=await import(c),l=gt(e.default??e);if(l)return l}catch{}}return null}async function pt(t={}){let i=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let l=q(t.explicit);if(l)return{url:l,source:"option"}}let r=gt(t.stxConfig);if(r)return{url:r,source:"stx.config",via:"site.url"};let c=await jt(i);if(c)return{url:c,source:"site.config",via:"url"};let e=Bt(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ft(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
2
+ import"./chunk-ktyctev3.js";import"./chunk-7hkc96de.js";import"./chunk-ah9xyss2.js";import{rt,st,ot,it,at,ct}from"./chunk-yhpyqsbr.js";import"./chunk-zk2xk0wd.js";import"./chunk-vpdx7qr3.js";import{f,He,L,J,n,o}from"./chunk-faghmmrs.js";import"./chunk-43h8q2cm.js";import{lr}from"./chunk-ayy9mmrw.js";import"./chunk-be2ba3hj.js";import"./chunk-eww6sdzz.js";import"./chunk-qdyp2zqf.js";import"./chunk-jtbzmbzz.js";import"./chunk-yy3ser06.js";import{ce,bt,wt}from"./chunk-kp0hg06s.js";import{Uo,Vo,Wo}from"./chunk-bj29pwm0.js";import{ht,rn,sn}from"./chunk-wg2w7zmt.js";import"./chunk-cdgwkzms.js";import{a}from"./chunk-00p22wzr.js";import x from"fs";import g from"path";import{createHash as Dt}from"crypto";function Rt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var kt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Ct(t){return Bun.hash(t).toString(16)}function ut(t,i={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,r=t.replace(kt,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(i.minify)h=Rt(h);let S=Ct(h);if(!s.has(S))s.set(S,h);let P=i.integrity?` data-stx-integrity="sha384-${Dt("sha384").update(h).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),c=Array.from(s,([e,l])=>({hash:e,code:l}));return{html:r,chunks:c}}var Et=new Set(["visible","idle"]);function dt(t){if(!t.includes("data-stx-src="))return t;let i=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,r;while((r=s.exec(t))!==null)i.set(r[1],r[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(Et.has(i.get(l[1])||""))c.add(l[2]);let w=t.lastIndexOf("</head>");if(c.size===0||w===-1)return t;let y=Array.from(c).filter((h)=>!t.includes(`rel="prefetch" href="${h}"`)).map((h)=>`<link rel="prefetch" href="${h}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var It=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function q(t){let i=t.trim();if(!i)return null;let s=/^https?:\/\//i.test(i)?i:`https://${i}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function Bt(t){for(let i of It){let s=t[i];if(!s)continue;let r=q(s);if(r)return{url:r,source:"env",via:i}}return null}function gt(t){if(!t||typeof t!=="object")return null;let i=t,s=i.site?.url??i.url??i.app?.url;return typeof s==="string"?q(s):null}async function jt(t){let{existsSync:i}=await import("fs"),s=await import("path");for(let r of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(t,r);if(!i(c))continue;try{let e=await import(c),l=gt(e.default??e);if(l)return l}catch{}}return null}async function pt(t={}){let i=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let l=q(t.explicit);if(l)return{url:l,source:"option"}}let r=gt(t.stxConfig);if(r)return{url:r,source:"stx.config",via:"site.url"};let c=await jt(i);if(c)return{url:c,source:"site.config",via:"url"};let e=Bt(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ft(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
3
3
  `)}class mt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,i=""){this.cacheDir=t,this.salt=i}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let i=JSON.parse(await Bun.file(t).text());for(let[s,r]of Object.entries(i))this.cache.set(s,r)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),i={};for(let[s,r]of this.cache)i[s]=r;await Bun.write(t,JSON.stringify(i))}getHash(t,i){let s=x.statSync(t),r=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of i)if(x.existsSync(e)){let l=x.statSync(e);r+=`:${e}:${l.mtimeMs}`}let c=0;for(let e=0;e<r.length;e++){let l=r.charCodeAt(e);c=(c<<5)-c+l,c=c&c}return Math.abs(c).toString(36)}get(t,i){let s=this.cache.get(t);if(!s)return null;let r=this.getHash(i,s.dependencies??[]);if(s.hash!==r)return this.cache.delete(t),null;return s.html}set(t,i,s,r){let c=this.getHash(i,s);this.cache.set(t,{hash:c,html:r,generatedAt:Date.now(),dependencies:s})}}class yt{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let i=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",i)}async get(t){let i=this.getFilePath(t);if(!await Bun.file(i).exists())return null;try{return JSON.parse(await Bun.file(i).text())}catch{return null}}async set(t,i){let s=this.getFilePath(t);await x.promises.mkdir(g.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(i))}async invalidate(t){let i=this.getFilePath(t);if(await Bun.file(i).exists())await x.promises.unlink(i)}async invalidatePattern(t){let i=g.join(this.cacheDir,"isr");if(!x.existsSync(i))return;let s=await x.promises.readdir(i);for(let r of s){let c=r.replace(/_/g,"/").replace(".json","");if(t.test(c))await x.promises.unlink(g.join(i,r))}}async needsRevalidation(t){let i=await this.get(t);if(!i)return!0;return Date.now()>i.revalidateAfter}}async function Ft(t){try{let s=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!s)return null;let r=s[1];if(!r.includes("getStaticPaths"))return null;let c=r.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!c)return null;return await Function(`
4
4
  return (async function getStaticPaths() {
5
5
  ${c[1]}
@@ -41,7 +41,7 @@ ${t.map((r)=>{let c=new URL(r.loc,i).href,e=` <url>
41
41
  ${s.join(`
42
42
  `)}
43
43
  </channel>
44
- </rss>`}async function zt(t={}){let i=Date.now();wt();let s=await o(process.cwd()),r=s.build||{},c=await pt({explicit:t.domain||r.domain,stxConfig:s});if(c.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(ft());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||r.pagesDir||"pages",outputDir:t.outputDir||r.outputDir||"dist",baseUrl:t.baseUrl||r.baseUrl||"/",domain:c.url,revalidate:t.revalidate??r.revalidate??!1,sitemap:t.sitemap??r.sitemap??!0,sitemapExclude:t.sitemapExclude||r.sitemapExclude||[],robots:t.robots??r.robots??!0,rss:t.rss??r.rss??!1,concurrency:t.concurrency||r.concurrency||10,cache:t.cache??r.cache??!0,cacheDir:t.cacheDir||r.cacheDir||a(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??r.minify??!0,generate404:t.generate404??r.generate404??!0,publicDir:t.publicDir||r.publicDir||"public",trailingSlash:t.trailingSlash??r.trailingSlash??!1,cleanOutput:t.cleanOutput??r.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,h={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-sw7mvg9p.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-zxvndwaz.js"),b=await p(e.publicDir,e.outputDir);if(b.count>0)console.log(`Optimized ${b.count} image(s) for responsive delivery`),D=[D,b.fingerprint].filter(Boolean).join(":");let B=new mt(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-sw7mvg9p.js");await u('<div class="bg-black"></div>')}catch{}rt();let xt=s?.routeMiddleware?.dir||"middleware";await ot(process.cwd(),xt);let H=st();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let vt=s?.routeMiddleware?.global||[];Uo(s?.layoutsDir,a(process.cwd()));let K=L(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${K.length} routes`);let G=[];for(let u of K){let m=await Ot(u);for(let v of m)G.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=G.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],X=[];for(let u=0;u<G.length;u+=e.concurrency)X.push(G.slice(u,u+e.concurrency));for(let u of X)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:M,props:Pt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Jt(j),$t=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],tt=[...vt,...$t];if(tt.length>0){let C=it(d,M,F||{}),O=at(C,null,void 0,{isServer:!0}),E=await ct(tt,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,_=Vt(String(R),d),T=Kt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,_),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(_),cached:!1}),A.push({loc:d,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${d} \u2192 redirect to ${R}`);return}if(E.abort){let R=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${d} \u2014 middleware aborted: ${R}`);return}}let et=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(et)try{if(!await Function("route",`
44
+ </rss>`}async function zt(t={}){let i=Date.now();wt();let s=await o(process.cwd()),r=s.build||{},c=await pt({explicit:t.domain||r.domain,stxConfig:s});if(c.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(ft());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||r.pagesDir||"pages",outputDir:t.outputDir||r.outputDir||"dist",baseUrl:t.baseUrl||r.baseUrl||"/",domain:c.url,revalidate:t.revalidate??r.revalidate??!1,sitemap:t.sitemap??r.sitemap??!0,sitemapExclude:t.sitemapExclude||r.sitemapExclude||[],robots:t.robots??r.robots??!0,rss:t.rss??r.rss??!1,concurrency:t.concurrency||r.concurrency||10,cache:t.cache??r.cache??!0,cacheDir:t.cacheDir||r.cacheDir||a(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??r.minify??!0,generate404:t.generate404??r.generate404??!0,publicDir:t.publicDir||r.publicDir||"public",trailingSlash:t.trailingSlash??r.trailingSlash??!1,cleanOutput:t.cleanOutput??r.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,h={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-dyqte1xq.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-tpd5nwa3.js"),b=await p(e.publicDir,e.outputDir);if(b.count>0)console.log(`Optimized ${b.count} image(s) for responsive delivery`),D=[D,b.fingerprint].filter(Boolean).join(":");let B=new mt(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-dyqte1xq.js");await u('<div class="bg-black"></div>')}catch{}rt();let xt=s?.routeMiddleware?.dir||"middleware";await ot(process.cwd(),xt);let H=st();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let vt=s?.routeMiddleware?.global||[];Wo(s?.layoutsDir,a(process.cwd()));let K=L(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${K.length} routes`);let G=[];for(let u of K){let m=await Ot(u);for(let v of m)G.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=G.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],X=[];for(let u=0;u<G.length;u+=e.concurrency)X.push(G.slice(u,u+e.concurrency));for(let u of X)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:M,props:Pt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Jt(j),$t=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],tt=[...vt,...$t];if(tt.length>0){let C=it(d,M,F||{}),O=at(C,null,void 0,{isServer:!0}),E=await ct(tt,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,_=Vt(String(R),d),T=Kt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,_),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(_),cached:!1}),A.push({loc:d,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${d} \u2192 redirect to ${R}`);return}if(E.abort){let R=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${d} \u2014 middleware aborted: ${R}`);return}}let et=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(et)try{if(!await Function("route",`
45
45
  const validate = ${et[1]};
46
46
  return validate(route);
47
47
  `)({params:M})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,nt=!1;if(e.cache){if(k=B.get(d,v.filePath),k)nt=!0,l.cachedCount++}if(!k){let C=await St(v,M,Pt,e,s);if(k=C.html,e.failOnIncludeError&&C.includeFailures.length>0)throw Error(`${C.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
@@ -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={...s,debug:!1,cache:!1},M=await n(await Bun.file(m).text(),{},m,d,v);await Bun.write(g.join(e.outputDir,`${u}.html`),M)}}let W=g.join(e.pagesDir,"error.stx");if(await Bun.file(W).exists()){let u=new Set,m={...s,debug:!1,cache:!1},v=await n(await Bun.file(W).text(),{},W,m,u);await Bun.write(g.join(e.outputDir,"error.html"),v)}if(e.sitemap&&A.length>0){let u=Gt(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=cr({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=Nt(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 N=zo(e.outputDir);if(N.assets>0)console.log(`Externalized ${N.assets} asset(s) from ${N.pages} page(s) (${(N.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let z=Ho(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} repeated asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&x.existsSync(e.publicDir))await V(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let Z=rn();if(Z)await V(Z,g.join(e.outputDir,nn)),console.log(`Copied assets from ${ht}`)}catch(D){throw await e.hooks.onError?.(D),D}if(l.buildTime=Date.now()-i,w.size>0){l.islandChunks={count:w.size,totalBytes:y};let D={generatedChunks:w.size,totalBytes:y,chunks:h,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?`
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={...s,debug:!1,cache:!1},M=await n(await Bun.file(m).text(),{},m,d,v);await Bun.write(g.join(e.outputDir,`${u}.html`),M)}}let W=g.join(e.pagesDir,"error.stx");if(await Bun.file(W).exists()){let u=new Set,m={...s,debug:!1,cache:!1},v=await n(await Bun.file(W).text(),{},W,m,u);await Bun.write(g.join(e.outputDir,"error.html"),v)}if(e.sitemap&&A.length>0){let u=Gt(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=lr({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=Nt(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 N=Uo(e.outputDir);if(N.assets>0)console.log(`Externalized ${N.assets} asset(s) from ${N.pages} page(s) (${(N.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let z=Vo(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} repeated asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&x.existsSync(e.publicDir))await V(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let Z=sn();if(Z)await V(Z,g.join(e.outputDir,rn)),console.log(`Copied assets from ${ht}`)}catch(D){throw await e.hooks.onError?.(D),D}if(l.buildTime=Date.now()-i,w.size>0){l.islandChunks={count:w.size,totalBytes:y};let D={generatedChunks:w.size,totalBytes:y,chunks:h,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
@@ -1,5 +1,5 @@
1
1
  import path from "node:path";
2
- import { bundleClientScript, clientBundleDependencies, hasUserImports } from "./client-script-bundler.js";
2
+ import { bundleClientScript, clientBundleDependencies, hasUserImports, moduleSubstitutionKey } from "./client-script-bundler.js";
3
3
  import { loadStxConfig } from "./config.js";
4
4
  import { isProduction, minifyClassicScript } from "./env.js";
5
5
  import { getPublicEnvDefine } from "./public-env.js";
@@ -34,7 +34,7 @@ export async function getStoreScript(storesDir) {
34
34
  const config = await loadStxConfig();
35
35
  resolvedDir = path.resolve(config.root || process.cwd(), config.storesDir || "stores");
36
36
  }
37
- const glob = new Bun.Glob("*.ts"), storeFiles = [];
37
+ const cacheKey = `${resolvedDir}\x00${moduleSubstitutionKey()}`, glob = new Bun.Glob("*.ts"), storeFiles = [];
38
38
  try {
39
39
  for await (const file of glob.scan({ cwd: resolvedDir, absolute: !0 })) {
40
40
  const name = path.basename(file, ".ts");
@@ -45,7 +45,7 @@ export async function getStoreScript(storesDir) {
45
45
  storeFiles.push(file);
46
46
  }
47
47
  } catch {
48
- writeSigned(_cachedStoreScripts, resolvedDir, "", "");
48
+ writeSigned(_cachedStoreScripts, cacheKey, "", "");
49
49
  return null;
50
50
  }
51
51
  const storeInputs = () => [...new Set([
@@ -53,11 +53,11 @@ export async function getStoreScript(storesDir) {
53
53
  ...storeFiles.flatMap((file) => clientBundleDependencies(file))
54
54
  ])];
55
55
  let signature = sourceSignature(storeInputs());
56
- const cached = readSigned(_cachedStoreScripts, resolvedDir, signature);
56
+ const cached = readSigned(_cachedStoreScripts, cacheKey, signature);
57
57
  if (cached !== void 0)
58
58
  return cached || null;
59
59
  if (storeFiles.length === 0) {
60
- writeSigned(_cachedStoreScripts, resolvedDir, signature, "");
60
+ writeSigned(_cachedStoreScripts, cacheKey, signature, "");
61
61
  return null;
62
62
  }
63
63
  const filesWithDeps = [];
@@ -92,7 +92,7 @@ ${code.trim()}`);
92
92
  console.warn(`[stx] Failed to load store ${file}:`, e);
93
93
  }
94
94
  if (chunks.length === 0) {
95
- writeSigned(_cachedStoreScripts, resolvedDir, signature, "");
95
+ writeSigned(_cachedStoreScripts, cacheKey, signature, "");
96
96
  return null;
97
97
  }
98
98
  const joinedChunks = chunks.join(`
@@ -104,7 +104,7 @@ ${STX_RUNTIME_GLOBALS.filter((name) => !declaredNames.has(name) && new RegExp(`\
104
104
  ${joinedChunks}
105
105
  })();`, code = isProduction() ? minifyClassicScript(assembled) : assembled;
106
106
  signature = sourceSignature(storeInputs());
107
- writeSigned(_cachedStoreScripts, resolvedDir, signature, code);
107
+ writeSigned(_cachedStoreScripts, cacheKey, signature, code);
108
108
  return code;
109
109
  }
110
110
  export function clearStoreCache() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.577",
4
+ "version": "0.2.580",
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.577",
132
- "@stacksjs/sanitizer": "0.2.577",
131
+ "@stacksjs/desktop": "0.2.580",
132
+ "@stacksjs/sanitizer": "0.2.580",
133
133
  "@stacksjs/ts-i18n": "^0.1.11",
134
- "bun-plugin-stx": "0.2.577",
134
+ "bun-plugin-stx": "0.2.580",
135
135
  "bunfig": "^0.15.21",
136
- "stx-router": "0.2.577",
136
+ "stx-router": "0.2.580",
137
137
  "ts-broadcasting": "^0.0.11",
138
138
  "ts-images": "^0.2.22",
139
139
  "ts-syntax-highlighter": "^0.2.1"
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Ne,Yt,pd}from"./chunk-nskvepjv.js";import{W,Zt,fd,Qt,Wr,qr,Fn,gd,md,hd,en,tn,Gr,zn,yd}from"./chunk-agk478t4.js";import"./chunk-haeb904b.js";export{Wr as batch,pd as default,Zt as derived,Qt as effect,Ne as generateSignalsRuntime,Yt as generateSignalsRuntimeDev,tn as isDerived,en as isSignal,fd as memo,Fn as onDestroy,qr as onMount,zn as peek,hd as pendingLifecycleCounts,md as runDestroyCallbacks,gd as runMountCallbacks,W as state,Gr as untrack,yd as useOptimistic};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ko,$l}from"./chunk-37d52q0d.js";export{ko as definePlugin,$l as pluginManager};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{K,ns,rs,ac,Ct,Jo,ss,Yo,jd,be,cn,we}from"./chunk-34fajf1n.js";import"./chunk-7j9m4d7x.js";import"./chunk-7hr63cp5.js";import{$i,s}from"./chunk-8efe5vpm.js";import"./chunk-550q827h.js";import"./chunk-1wkpxa58.js";import"./chunk-vde4mtfr.js";import"./chunk-x5xwe5nr.js";import"./chunk-tybk9hw9.js";import"./chunk-qfb34r6k.js";import"./chunk-4xvbc0mb.js";import"./chunk-haeb904b.js";import"./chunk-h72befy4.js";import"./chunk-1edvsndv.js";export{K as BROWSER_CORE_IMPORTS,ac as STX_AUTO_IMPORTS,ns as extractAndStripCssImports,be as extractBridgeData,$i as findInterpolationEnd,Yo as generateAutoImportDestructuring,jd as generateBrowserAutoImportDestructuring,cn as generateServerDataBridge,Ct as injectBrowserCoreAutoImports,we as processClientScript,ss as referencesName,rs as renderVendorStyleTags,s as stripCommentsAndLiterals,Jo as transformAutoImports};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Pa,Ia,Oa,Da,Ma,Na,La,ja,Ba,Fa,Fl}from"./chunk-7bwkeake.js";export{Pa as createIslandRegistry,Fl as default,Fa as generateIslandManifest,Oa as generatePartialHydrationCSS,Na as hydrateAll,Ma as hydrateByStrategy,Da as hydrateIsland,La as isHydrated,ja as onHydrated,Ia as processPartialHydrationDirectives,Ba as processStaticDirectives};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{pn,Sc,gs}from"./chunk-34fajf1n.js";import"./chunk-7j9m4d7x.js";import"./chunk-7hr63cp5.js";import"./chunk-550q827h.js";import"./chunk-1wkpxa58.js";import"./chunk-vde4mtfr.js";import"./chunk-x5xwe5nr.js";import"./chunk-tybk9hw9.js";import{_e}from"./chunk-qfb34r6k.js";import"./chunk-4xvbc0mb.js";import"./chunk-haeb904b.js";import"./chunk-h72befy4.js";import"./chunk-1edvsndv.js";export{_e as freeIdentifiers,gs as processComponents,Sc as processESImports,pn as rendersAsElement};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{$o,za,Xt,zl,Ha,Ua,Va,Hl}from"./chunk-3gqrv02t.js";export{Xt as Validator,za as defineForm,Ha as processErrorDirective,Ua as processErrorsDirective,Hl as processFormValidationDirectives,Va as processHasErrorsDirective,$o as useForm,zl as v};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Qi,ea}from"./chunk-bctjmaxg.js";import"./chunk-sf7z2ar9.js";import"./chunk-je0cttam.js";import"./chunk-fkbthywg.js";import"./chunk-wvk932dp.js";import"./chunk-1w9ngqpv.js";import"./chunk-r4w1cye7.js";import"./chunk-6rfm6b1c.js";import{go}from"./chunk-pqkb1m5x.js";import"./chunk-bpdsdbvg.js";import"./chunk-xh0808cd.js";import"./chunk-n829xbbq.js";import"./chunk-37d52q0d.js";import"./chunk-tasjpnbf.js";import"./chunk-32gycb72.js";import"./chunk-d8ek63nc.js";import"./chunk-szfkkbve.js";import"./chunk-707n4pbz.js";import"./chunk-z33z3rr4.js";import"./chunk-7bwkeake.js";import"./chunk-3gqrv02t.js";import"./chunk-pveafhzg.js";import"./chunk-bbdg3sqq.js";import"./chunk-mr9c2ej6.js";import"./chunk-5vw8493b.js";import"./chunk-h1n43e5n.js";import"./chunk-1dg5qxg9.js";import"./chunk-wwhxgvr8.js";import"./chunk-7y73q42g.js";import"./chunk-nskvepjv.js";import"./chunk-vmetcczm.js";import"./chunk-6wz6f8d5.js";import"./chunk-t79xnvzr.js";import"./chunk-pxk0tpw2.js";import"./chunk-y120qq1a.js";import"./chunk-mp99h8wh.js";import"./chunk-kskyfss0.js";import{we,ln,dn,J,d,n,nr,A,o,pe}from"./chunk-34fajf1n.js";import"./chunk-7j9m4d7x.js";import"./chunk-7hr63cp5.js";import"./chunk-550q827h.js";import"./chunk-1wkpxa58.js";import"./chunk-vde4mtfr.js";import"./chunk-x5xwe5nr.js";import"./chunk-tybk9hw9.js";import"./chunk-qfb34r6k.js";import"./chunk-4xvbc0mb.js";import"./chunk-haeb904b.js";import"./chunk-h72befy4.js";import"./chunk-1edvsndv.js";export{nr as buildWebComponents,dn as cacheTemplate,ln as checkCache,go as classifyAllScripts,Qi as createMiddleware,ea as createRoute,A as defaultConfig,d as extractVariables,J as injectRouterScript,o as loadStxConfig,we as processClientScript,n as processDirectives,pe as readMarkdownFile};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Er,ao,Dn,Tr,$r,Lt,ft,co,Mn,Nn,Rr,Ar,cl,ll,Ie}from"./chunk-fkbthywg.js";export{Ie as DeployError,ao as calculateSha1,Dn as collectDeployFiles,Nn as createDefaultNetlifyConfig,Tr as createFileManifest,Er as createNetlifyClient,cl as deploy,Mn as detectProjectConfig,$r as filterRequiredFiles,Lt as formatSize,co as generateNetlifyToml,ft as getTotalSize,Ar as hasNetlifyConfig,ll as initNetlify,Rr as writeNetlifyConfig};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ed,td,nd,rd,sd}from"./chunk-1dg5qxg9.js";export{td as createSSRSuspense,rd as generateSuspenseCSS,sd as generateSuspenseRuntime,ed as processSuspenseDirectives,nd as renderSSRSuspense};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{B,F,z,Ft,Q,ie,jn,ma,De,gt,zt,Ht,Ut,H,Vt,Wt,Bn}from"./chunk-tasjpnbf.js";import"./chunk-t79xnvzr.js";export{F as DEFAULT_FORMATS,z as DEFAULT_QUALITY,B as DEFAULT_WIDTHS,Bn as ImageProcessingError,Wt as formatSize,gt as generateSizes,De as generateSrcSet,zt as getFallbackVariant,jn as getImageMetadata,H as getMimeType,Vt as getTotalSize,Ht as groupVariantsByFormat,Q as isImageBackendAvailable,Ut as isImageFile,Ft as isSharpAvailable,ie as processImage,ma as resizeAndConvert};