okno 1.0.0-beta.43 → 1.0.0-beta.44

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.
@@ -1,4 +1,4 @@
1
- import { o as i } from "../plugin-DgYy2aTI.js";
1
+ import { o as i } from "../plugin-DCxkXmmG.js";
2
2
  import { join as d } from "node:path";
3
3
  import { readFileSync as p } from "node:fs";
4
4
  function c(o) {
@@ -16,7 +16,7 @@ function k(o = {}) {
16
16
  const t = s === "build" && c(o.dir ?? "okno");
17
17
  t && !n.adapter && console.warn(
18
18
  "[okno] instant is on in okno/project.json, but this Astro project has no adapter — falling back to the baked build. Add one (e.g. `npx astro add cloudflare`) and set `export const prerender = false` on okno-driven pages. See docs/instant.md."
19
- ), process.env.OKNO_INSTANT = t && n.adapter ? "1" : "0", e({ vite: { plugins: [i(o)] } }), r("page", 'import "okno/boot"'), t && n.adapter && a({ entrypoint: "okno:instant-middleware", order: "pre" });
19
+ ), process.env.OKNO_INSTANT = t && n.adapter ? "1" : "0", e({ vite: { plugins: [i(o)] } }), r("page", 'import "okno/boot"'), t && n.adapter && a({ entrypoint: "okno/instant-middleware", order: "pre" });
20
20
  }
21
21
  }
22
22
  };
@@ -3,7 +3,7 @@
3
3
  * - modules.d.ts (type declarations for okno:* virtual modules)
4
4
  *
5
5
  * `root` is the project root (parent of the okno dir) — we scan it for
6
- * `import { x } from "okno:<kind>"` so names referenced before scaffolding
6
+ * `import { x } from "okno/<kind>"` so names referenced before scaffolding
7
7
  * still get a (placeholder) type, mirroring the runtime virtual modules.
8
8
  */
9
9
  export declare function generateTypes(oknoDir: string, root: string): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/codegen/generate.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAqNhE"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/codegen/generate.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBA8MhE"}
@@ -6,7 +6,7 @@ export declare function getRuntimeSource(): string | null;
6
6
  * same resolution dance as the wrap runtime above. */
7
7
  export declare function getInstantRuntimeSource(): string | null;
8
8
  /** The umbrella `okno:content` module: one import, all kinds namespaced
9
- * (`import * as okno from "okno:content"` → okno.pages / .globals /
9
+ * (`import * as okno from "okno/content"` → okno.pages / .globals /
10
10
  * .collections) + the UI-strings store (okno.strings). Pure re-export — the
11
11
  * per-kind modules still work. */
12
12
  export declare function buildContentModule(): string;
@@ -1,12 +1,10 @@
1
1
  /**
2
- * Walk the project root looking for `import { foo, bar } from "okno:<kind>"`
3
- * (or the colon-free `okno/<kind>` token) statements and return the union of
4
- * imported names. Used by both the runtime virtual modules and the type codegen
5
- * to emit placeholder exports for content that doesn't exist yet, so a project
6
- * can refer to `home.title` (and get types for it) before any schema is
7
- * scaffolded — including for an optional/unscaffolded name (e.g. a `theme`
8
- * global). Matches BOTH the `okno:` (Vite virtual) and `okno/` (Next/tsconfig
9
- * paths) forms so the placeholder emits regardless of which token a page uses.
2
+ * Walk the project root looking for `import { foo, bar } from "okno/<kind>"`
3
+ * statements and return the union of imported names. Used by both the runtime
4
+ * virtual modules and the type codegen to emit placeholder exports for content
5
+ * that doesn't exist yet, so a project can refer to `home.title` (and get
6
+ * types for it) before any schema is scaffolded — including for an
7
+ * optional/unscaffolded name (e.g. a `theme` global).
10
8
  */
11
9
  export declare function scanImports(root: string, kind: "pages" | "collections" | "globals"): Promise<Set<string>>;
12
10
  //# sourceMappingURL=scan-imports.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scan-imports.d.ts","sourceRoot":"","sources":["../../src/codegen/scan-imports.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,GACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CA0CtB"}
1
+ {"version":3,"file":"scan-imports.d.ts","sourceRoot":"","sources":["../../src/codegen/scan-imports.ts"],"names":[],"mappings":"AAiBA;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,GACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CA0CtB"}
@@ -21,7 +21,7 @@ const Qe = /* @__PURE__ */ new Set([".astro", ".svelte", ".ts", ".tsx", ".js", "
21
21
  ".turbo"
22
22
  ]);
23
23
  async function ne(e, n) {
24
- const s = new RegExp(`import\\s*\\{([^}]+)\\}\\s*from\\s*["']okno[:/]${n}["']`, "g"), a = /* @__PURE__ */ new Set();
24
+ const s = new RegExp(`import\\s*\\{([^}]+)\\}\\s*from\\s*["']okno/${n}["']`, "g"), a = /* @__PURE__ */ new Set();
25
25
  async function u(l) {
26
26
  let m;
27
27
  try {
@@ -46,12 +46,12 @@ async function ne(e, n) {
46
46
  } catch {
47
47
  continue;
48
48
  }
49
- if (!(!r.includes(`okno:${n}`) && !r.includes(`okno/${n}`)))
49
+ if (r.includes(`okno/${n}`))
50
50
  for (const c of r.matchAll(s)) {
51
51
  const h = c[1] ?? "";
52
52
  for (const p of h.split(",")) {
53
- const _ = p.trim().split(/\s+as\s+/)[0]?.trim();
54
- _ && /^[A-Za-z_$][\w$]*$/.test(_) && a.add(_);
53
+ const g = p.trim().split(/\s+as\s+/)[0]?.trim();
54
+ g && /^[A-Za-z_$][\w$]*$/.test(g) && a.add(g);
55
55
  }
56
56
  }
57
57
  }
@@ -59,7 +59,7 @@ async function ne(e, n) {
59
59
  return await u(e), a;
60
60
  }
61
61
  async function Rt(e, n) {
62
- const s = await it(e), a = new Map(s.map((g) => [g.name, g.first])), u = rt(e), l = [
62
+ const s = await it(e), a = new Map(s.map((_) => [_.name, _.first])), u = rt(e), l = [
63
63
  "// Auto-generated by okno. Do not edit.",
64
64
  "",
65
65
  "/** A wrapped content value that can be spread onto elements and rendered as text. */",
@@ -120,31 +120,31 @@ async function Rt(e, n) {
120
120
  " readonly updated: OknoWrapped<OknoStamp>",
121
121
  "}",
122
122
  ""
123
- ], m = ([, g]) => g?.type === "reference" && typeof g.collection == "string" && a.has(g.collection), f = ([, g]) => g?.type === "enum", i = ([, g]) => g?.type === "string" && !g.multiple && g.slots && typeof g.slots == "object" && !Array.isArray(g.slots) && Object.keys(g.slots).length > 0, t = (g) => g === "number" || g === "count" ? "number" : "string", o = ([g, b]) => {
123
+ ], m = ([, _]) => _?.type === "reference" && typeof _.collection == "string" && a.has(_.collection), f = ([, _]) => _?.type === "enum", i = ([, _]) => _?.type === "string" && !_.multiple && _.slots && typeof _.slots == "object" && !Array.isArray(_.slots) && Object.keys(_.slots).length > 0, t = (_) => _ === "number" || _ === "count" ? "number" : "string", o = ([_, b]) => {
124
124
  const j = Object.entries(b.slots).map(([S, O]) => `${JSON.stringify(S)}: ${t(O)}`).join("; ");
125
- return `${g}: (p: { ${j} }) => OknoValue<string>`;
126
- }, r = ([g, b]) => {
125
+ return `${_}: (p: { ${j} }) => OknoValue<string>`;
126
+ }, r = ([_, b]) => {
127
127
  const j = (Array.isArray(b?.options) ? b.options : []).map((v) => typeof v == "string" ? v : v?.value).filter((v) => typeof v == "string"), O = `{ name: string; value: ${j.length ? j.map((v) => JSON.stringify(v)).join(" | ") : "string"} }`;
128
- return `${g}: ${b.multiple ? `${O}[]` : O}`;
129
- }, c = (g) => `typeof import("./collections/${g}/${a.get(g)}").default`, h = (g) => {
130
- const b = u?.collections?.[g]?.url;
128
+ return `${_}: ${b.multiple ? `${O}[]` : O}`;
129
+ }, c = (_) => `typeof import("./collections/${_}/${a.get(_)}").default`, h = (_) => {
130
+ const b = u?.collections?.[_]?.url;
131
131
  return typeof b == "string" && b.trim() ? " & { href: string }" : "";
132
- }, p = (g, b) => {
133
- const j = c(g), S = u?.collections?.[g]?.fields, O = S ? Object.entries(S) : [], v = O.filter(m), P = O.filter(f);
134
- if (v.length === 0 && P.length === 0) return `${j}${h(g)}`;
135
- const M = [...v, ...P].map(([x]) => `"${x}"`).join(" | "), E = new Set(b).add(g), W = [
132
+ }, p = (_, b) => {
133
+ const j = c(_), S = u?.collections?.[_]?.fields, O = S ? Object.entries(S) : [], v = O.filter(m), P = O.filter(f);
134
+ if (v.length === 0 && P.length === 0) return `${j}${h(_)}`;
135
+ const M = [...v, ...P].map(([x]) => `"${x}"`).join(" | "), E = new Set(b).add(_), W = [
136
136
  ...v.map(([x, F]) => {
137
137
  const I = F.collection, B = b.has(I) ? c(I) : p(I, E);
138
138
  return `${x}: ${F.multiple ? `(${B})[]` : B}`;
139
139
  }),
140
140
  ...P.map(r)
141
141
  ].join("; ");
142
- return `Omit<${j}, ${M}> & { ${W} }${h(g)}`;
143
- }, _ = (g, b, j) => {
144
- const S = `typeof import("${j}").default`, O = u?.[g]?.[b]?.fields, v = O ? Object.entries(O) : [], P = v.filter(m), M = v.filter(f), E = v.filter(i), W = '"created" | "updated"', x = g === "collections" ? h(b) : "", F = E.length ? ` & { ${E.map(o).join("; ")} }` : "";
142
+ return `Omit<${j}, ${M}> & { ${W} }${h(_)}`;
143
+ }, g = (_, b, j) => {
144
+ const S = `typeof import("${j}").default`, O = u?.[_]?.[b]?.fields, v = O ? Object.entries(O) : [], P = v.filter(m), M = v.filter(f), E = v.filter(i), W = '"created" | "updated"', x = _ === "collections" ? h(b) : "", F = E.length ? ` & { ${E.map(o).join("; ")} }` : "";
145
145
  if (P.length === 0 && M.length === 0 && E.length === 0)
146
146
  return `OknoWrapped<Omit<${S}, ${W}>${x}> & OknoMeta`;
147
- const I = g === "collections" ? /* @__PURE__ */ new Set([b]) : /* @__PURE__ */ new Set(), B = `${[...P, ...M, ...E].map(([ee]) => `"${ee}"`).join(" | ")} | ${W}`, me = [
147
+ const I = _ === "collections" ? /* @__PURE__ */ new Set([b]) : /* @__PURE__ */ new Set(), B = `${[...P, ...M, ...E].map(([ee]) => `"${ee}"`).join(" | ")} | ${W}`, me = [
148
148
  ...P.map(([ee, pe]) => {
149
149
  const te = pe.collection, he = I.has(te) ? c(te) : p(te, I);
150
150
  return `${ee}: ${pe.multiple ? `(${he})[]` : he}`;
@@ -158,13 +158,10 @@ async function Rt(e, n) {
158
158
  ne(n, "collections")
159
159
  ]);
160
160
  l.push(
161
- ...$e("okno:pages", "pages", await re(y(e, "pages")), d, _)
162
- ), l.push(...ot(s, w, _)), l.push(
163
- ...$e("okno:globals", "globals", await re(y(e, "globals")), $, _)
164
- ), l.push(...tt(at(e), st(u))), l.push(...De()), l.push(...et());
165
- for (const g of ["pages", "collections", "globals", "locales", "strings", "content"])
166
- l.push(`declare module "okno/${g}" {`, ` export * from "okno:${g}";`, "}", "");
167
- await xe(y(e, "modules.d.ts"), l.join(`
161
+ ...$e("okno/pages", "pages", await re(y(e, "pages")), d, g)
162
+ ), l.push(...ot(s, w, g)), l.push(
163
+ ...$e("okno/globals", "globals", await re(y(e, "globals")), $, g)
164
+ ), l.push(...tt(at(e), st(u))), l.push(...De()), l.push(...et()), await xe(y(e, "modules.d.ts"), l.join(`
168
165
  `));
169
166
  }
170
167
  function $e(e, n, s, a, u) {
@@ -177,7 +174,7 @@ function $e(e, n, s, a, u) {
177
174
  }
178
175
  function De() {
179
176
  return [
180
- 'declare module "okno:locales" {',
177
+ 'declare module "okno/locales" {',
181
178
  ' /** A configured language. `id` is the BCP-47 tag (e.g. "zh-Hant"), `name` the display label, `slug` the URL segment you map into routing. `link(url)` returns this page\'s hreflang <link> descriptor — spread onto a <link> (pass Astro.url for an absolute href). Okno owns no routing; you map these. */',
182
179
  " export interface OknoLocale {",
183
180
  " id: string",
@@ -193,12 +190,12 @@ function De() {
193
190
  }
194
191
  function et() {
195
192
  return [
196
- 'declare module "okno:content" {',
197
- ' /** Unified content namespace — `import * as okno from "okno:content"` then `okno.pages.home`, `okno.globals.nav`, `okno.collections.articles`, `okno.strings.nav.home`. */',
198
- ' export * as pages from "okno:pages"',
199
- ' export * as globals from "okno:globals"',
200
- ' export * as collections from "okno:collections"',
201
- ' export { strings } from "okno:strings"',
193
+ 'declare module "okno/content" {',
194
+ ' /** Unified content namespace — `import * as okno from "okno/content"` then `okno.pages.home`, `okno.globals.nav`, `okno.collections.articles`, `okno.strings.nav.home`. */',
195
+ ' export * as pages from "okno/pages"',
196
+ ' export * as globals from "okno/globals"',
197
+ ' export * as collections from "okno/collections"',
198
+ ' export { strings } from "okno/strings"',
202
199
  "}",
203
200
  ""
204
201
  ];
@@ -207,7 +204,7 @@ function tt(e, n) {
207
204
  const s = e.length ? `${nt(e, n)}` : "any", a = e.length ? `
208
205
  locale(code?: string | null): ${s}` : "";
209
206
  return [
210
- 'declare module "okno:strings" {',
207
+ 'declare module "okno/strings" {',
211
208
  " /** The UI-strings store. A plain leaf is string-like (spread `{...s.nav.home}` for the edit hook, render `{s.nav.home}` for the text); a SLOTTED leaf is a `(params) => …` function — call it, then spread/render the result (`{...s.cart.items({count})}`). `.locale(code)` re-roots the whole tree at a language. */",
212
209
  ` export const strings: ${e.length ? `${s} & {${a}
213
210
  }` : "any"}`,
@@ -253,7 +250,7 @@ function ot(e, n, s) {
253
250
  }
254
251
  for (const l of n)
255
252
  a.has(l) || u.push(` export const ${l}: OknoUnscaffolded[]`);
256
- return ['declare module "okno:collections" {', ...u, "}", ""];
253
+ return ['declare module "okno/collections" {', ...u, "}", ""];
257
254
  }
258
255
  function rt(e) {
259
256
  const n = y(e, "schema.ts");
@@ -350,10 +347,10 @@ function Nt() {
350
347
  }
351
348
  function Mt() {
352
349
  return [
353
- 'export * as pages from "okno:pages"',
354
- 'export * as globals from "okno:globals"',
355
- 'export * as collections from "okno:collections"',
356
- 'export { strings } from "okno:strings"'
350
+ 'export * as pages from "okno/pages"',
351
+ 'export * as globals from "okno/globals"',
352
+ 'export * as collections from "okno/collections"',
353
+ 'export { strings } from "okno/strings"'
357
354
  ].join(`
358
355
  `);
359
356
  }
@@ -451,7 +448,7 @@ async function Wt(e) {
451
448
  const n = y(e, "strings.ts");
452
449
  if (!k(n))
453
450
  return [
454
- 'import { __oknoMakeStrings } from "okno:runtime"',
451
+ 'import { __oknoMakeStrings } from "okno/runtime"',
455
452
  'export const strings = __oknoMakeStrings({}, {}, "")'
456
453
  ].join(`
457
454
  `);
@@ -465,7 +462,7 @@ async function Wt(e) {
465
462
  }
466
463
  }
467
464
  const f = [
468
- 'import { __oknoMakeStrings, __oknoLocalize, __oknoExpandStrings } from "okno:runtime"',
465
+ 'import { __oknoMakeStrings, __oknoLocalize, __oknoExpandStrings } from "okno/runtime"',
469
466
  `import _strings_default from "${n}"`
470
467
  ];
471
468
  a && f.push(`import __schema from "${s}"`);
@@ -483,10 +480,10 @@ async function Wt(e) {
483
480
  }
484
481
  async function Ft(e, n = /* @__PURE__ */ new Set()) {
485
482
  const s = y(e, "pages"), a = y(e, "schema.ts"), u = k(a), l = [
486
- 'import { __oknoWrap, __oknoLocalize, __oknoResolveRefs, __oknoResolveEnums, __oknoLiftSlots, __oknoSetImages, __oknoSetRoutes } from "okno:runtime"',
483
+ 'import { __oknoWrap, __oknoLocalize, __oknoResolveRefs, __oknoResolveEnums, __oknoLiftSlots, __oknoSetImages, __oknoSetRoutes } from "okno/runtime"',
487
484
  ue
488
485
  ];
489
- u && (l.push('import * as __collections from "okno:collections"'), l.push(`import __schema from "${a}"`), l.push("__oknoSetRoutes(__schema)"));
486
+ u && (l.push('import * as __collections from "okno/collections"'), l.push(`import __schema from "${a}"`), l.push("__oknoSetRoutes(__schema)"));
490
487
  let m = "[]";
491
488
  const f = (o, r) => {
492
489
  if (!u) return `_${o}`;
@@ -498,20 +495,20 @@ async function Ft(e, n = /* @__PURE__ */ new Set()) {
498
495
  m = JSON.stringify(c);
499
496
  const h = await fe(s);
500
497
  for (const p of h) {
501
- const _ = de(p), d = ve(p), $ = Q(p), w = y(s, p);
498
+ const g = de(p), d = ve(p), $ = Q(p), w = y(s, p);
502
499
  if (c.length === 0) {
503
- l.push(`import _${_} from "${w}"`), l.push(`export const ${d} = __oknoWrap(${f(_, $)}, "${$}"${i($)})`), t.add(d);
500
+ l.push(`import _${g} from "${w}"`), l.push(`export const ${d} = __oknoWrap(${f(g, $)}, "${$}"${i($)})`), t.add(d);
504
501
  continue;
505
502
  }
506
- const g = [`import _${_}_default from "${w}"`], b = [];
503
+ const _ = [`import _${g}_default from "${w}"`], b = [];
507
504
  for (const j of c) {
508
505
  const S = y(s, j, p);
509
506
  if (k(S)) {
510
507
  const O = D(j);
511
- g.push(`import _${_}_${O} from "${S}"`), b.push(`"${j}": _${_}_${O}`);
508
+ _.push(`import _${g}_${O} from "${S}"`), b.push(`"${j}": _${g}_${O}`);
512
509
  }
513
510
  }
514
- l.push(...g), l.push(`const _${_} = __oknoLocalize(_${_}_default, { ${b.join(", ")} })`), l.push(`export const ${d} = __oknoWrap(${f(_, $)}, "${$}"${i($)})`), t.add(d);
511
+ l.push(..._), l.push(`const _${g} = __oknoLocalize(_${g}_default, { ${b.join(", ")} })`), l.push(`export const ${d} = __oknoWrap(${f(g, $)}, "${$}"${i($)})`), t.add(d);
515
512
  }
516
513
  }
517
514
  for (const o of n)
@@ -539,15 +536,15 @@ async function Ut(e, n = /* @__PURE__ */ new Set(), s = !1) {
539
536
  );
540
537
  }
541
538
  const { orders: t, draftsOff: o, schedulingOff: r } = ft(e), c = y(e, "schema.ts"), h = k(c), p = [
542
- 'import { __oknoWrap, __oknoLocalize, __oknoResolveRefs, __oknoResolveEnums, __oknoLiftSlots, __oknoSetImages, __oknoSetRoutes, __oknoVisible } from "okno:runtime"',
539
+ 'import { __oknoWrap, __oknoLocalize, __oknoResolveRefs, __oknoResolveEnums, __oknoLiftSlots, __oknoSetImages, __oknoSetRoutes, __oknoVisible } from "okno/runtime"',
543
540
  ue
544
541
  ];
545
542
  h && (p.push(`import __schema from "${c}"`), p.push("__oknoSetRoutes(__schema)"));
546
- const _ = [];
543
+ const g = [];
547
544
  for (const d of f) {
548
- const $ = y(a, d), w = Ne(await fe($), Q, t[d]), g = d.replace(/-/g, "_"), b = s && !o.has(d), j = s && !r.has(d), S = [];
545
+ const $ = y(a, d), w = Ne(await fe($), Q, t[d]), _ = d.replace(/-/g, "_"), b = s && !o.has(d), j = s && !r.has(d), S = [];
549
546
  for (const O of w) {
550
- const v = `_${g}_${de(O)}`, P = Q(O), M = y($, O);
547
+ const v = `_${_}_${de(O)}`, P = Q(O), M = y($, O);
551
548
  if (m.length === 0)
552
549
  p.push(`import ${v} from "${M}"`);
553
550
  else {
@@ -563,16 +560,16 @@ async function Ut(e, n = /* @__PURE__ */ new Set(), s = !1) {
563
560
  }
564
561
  S.push({ varName: v, itemName: P });
565
562
  }
566
- p.push(`const __oknoRaw_${g} = [${S.map((O) => O.varName).join(", ")}]`), _.push({ name: d, safe: g, draftsOn: b, schedulingOn: j, items: S });
563
+ p.push(`const __oknoRaw_${_} = [${S.map((O) => O.varName).join(", ")}]`), g.push({ name: d, safe: _, draftsOn: b, schedulingOn: j, items: S });
567
564
  }
568
- h && p.push(`const __oknoNs = { ${_.map((d) => `${d.safe}: __oknoRaw_${d.safe}`).join(", ")} }`);
569
- for (const d of _) {
565
+ h && p.push(`const __oknoNs = { ${g.map((d) => `${d.safe}: __oknoRaw_${d.safe}`).join(", ")} }`);
566
+ for (const d of g) {
570
567
  const $ = `__schema?.collections?.["${d.name}"]?.fields`, w = (S) => h ? `__oknoResolveEnums(__oknoResolveRefs(${S.varName}, ${$}, __oknoNs, ${i}), ${$}, ${i})` : S.varName;
571
- let g = "";
572
- h && (p.push(`const __oknoSlots_${d.safe} = __oknoLiftSlots(${$})`), g = `, { slots: __oknoSlots_${d.safe}, defaultLocale: __schema?.locales?.default }`);
568
+ let _ = "";
569
+ h && (p.push(`const __oknoSlots_${d.safe} = __oknoLiftSlots(${$})`), _ = `, { slots: __oknoSlots_${d.safe}, defaultLocale: __schema?.locales?.default }`);
573
570
  const b = [];
574
571
  d.draftsOn && b.push('e[0]?.status !== "draft"'), d.schedulingOn && b.push("__oknoVisible(e[0])");
575
- const j = b.length ? `[${d.items.map((S) => `[${S.varName}, ${w(S)}, ${JSON.stringify(S.itemName)}]`).join(", ")}].filter((e) => ${b.join(" && ")}).map((e, __i) => __oknoWrap(e[1], "${d.name}." + e[2], "${d.name}." + __i${g}))` : `[${d.items.map((S, O) => `__oknoWrap(${w(S)}, "${d.name}.${S.itemName}", "${d.name}.${O}"${g})`).join(", ")}]`;
572
+ const j = b.length ? `[${d.items.map((S) => `[${S.varName}, ${w(S)}, ${JSON.stringify(S.itemName)}]`).join(", ")}].filter((e) => ${b.join(" && ")}).map((e, __i) => __oknoWrap(e[1], "${d.name}." + e[2], "${d.name}." + __i${_}))` : `[${d.items.map((S, O) => `__oknoWrap(${w(S)}, "${d.name}.${S.itemName}", "${d.name}.${O}"${_})`).join(", ")}]`;
576
573
  p.push(`export const ${d.safe} = ${j}`);
577
574
  }
578
575
  return p.join(`
@@ -580,10 +577,10 @@ async function Ut(e, n = /* @__PURE__ */ new Set(), s = !1) {
580
577
  }
581
578
  async function Ct(e, n = /* @__PURE__ */ new Set()) {
582
579
  const s = y(e, "globals"), a = y(e, "schema.ts"), u = k(a), l = [
583
- 'import { __oknoWrap, __oknoLocalize, __oknoResolveRefs, __oknoResolveEnums, __oknoLiftSlots, __oknoSetImages, __oknoSetRoutes } from "okno:runtime"',
580
+ 'import { __oknoWrap, __oknoLocalize, __oknoResolveRefs, __oknoResolveEnums, __oknoLiftSlots, __oknoSetImages, __oknoSetRoutes } from "okno/runtime"',
584
581
  ue
585
582
  ];
586
- u && (l.push('import * as __collections from "okno:collections"'), l.push(`import __schema from "${a}"`), l.push("__oknoSetRoutes(__schema)"));
583
+ u && (l.push('import * as __collections from "okno/collections"'), l.push(`import __schema from "${a}"`), l.push("__oknoSetRoutes(__schema)"));
587
584
  let m = "[]";
588
585
  const f = (o, r) => {
589
586
  if (!u) return `_${o}`;
@@ -595,20 +592,20 @@ async function Ct(e, n = /* @__PURE__ */ new Set()) {
595
592
  m = JSON.stringify(c);
596
593
  const h = await fe(s);
597
594
  for (const p of h) {
598
- const _ = de(p), d = ve(p), $ = Q(p), w = y(s, p);
595
+ const g = de(p), d = ve(p), $ = Q(p), w = y(s, p);
599
596
  if (c.length === 0) {
600
- l.push(`import _${_} from "${w}"`), l.push(`export const ${d} = __oknoWrap(${f(_, $)}, "${$}"${i($)})`), t.add(d);
597
+ l.push(`import _${g} from "${w}"`), l.push(`export const ${d} = __oknoWrap(${f(g, $)}, "${$}"${i($)})`), t.add(d);
601
598
  continue;
602
599
  }
603
- const g = [`import _${_}_default from "${w}"`], b = [];
600
+ const _ = [`import _${g}_default from "${w}"`], b = [];
604
601
  for (const j of c) {
605
602
  const S = y(s, j, p);
606
603
  if (k(S)) {
607
604
  const O = D(j);
608
- g.push(`import _${_}_${O} from "${S}"`), b.push(`"${j}": _${_}_${O}`);
605
+ _.push(`import _${g}_${O} from "${S}"`), b.push(`"${j}": _${g}_${O}`);
609
606
  }
610
607
  }
611
- l.push(...g), l.push(`const _${_} = __oknoLocalize(_${_}_default, { ${b.join(", ")} })`), l.push(`export const ${d} = __oknoWrap(${f(_, $)}, "${$}"${i($)})`), t.add(d);
608
+ l.push(..._), l.push(`const _${g} = __oknoLocalize(_${g}_default, { ${b.join(", ")} })`), l.push(`export const ${d} = __oknoWrap(${f(g, $)}, "${$}"${i($)})`), t.add(d);
612
609
  }
613
610
  }
614
611
  for (const o of n)
@@ -714,16 +711,16 @@ function _t(e, n, s, a, u) {
714
711
  }
715
712
  let c, h = !1;
716
713
  if (Array.isArray(r))
717
- c = r.map((_) => {
718
- if (_ && typeof _ == "object" && !Array.isArray(_)) {
719
- const d = ye(_, a, m);
714
+ c = r.map((g) => {
715
+ if (g && typeof g == "object" && !Array.isArray(g)) {
716
+ const d = ye(g, a, m);
720
717
  return d.changed && (h = !0), d.out;
721
718
  }
722
- return _;
719
+ return g;
723
720
  });
724
721
  else if (r && typeof r == "object") {
725
- const _ = ye(r, a, m);
726
- c = _.out, h = _.changed;
722
+ const g = ye(r, a, m);
723
+ c = g.out, h = g.changed;
727
724
  } else
728
725
  continue;
729
726
  if (!h) continue;
@@ -799,8 +796,8 @@ async function Jt(e, n) {
799
796
  `).map(($) => $.trim()).filter(Boolean);
800
797
  } catch {
801
798
  }
802
- const _ = Array.from(/* @__PURE__ */ new Set([...h, ...p]));
803
- return i(200, { pendingPublish: h.length > 0 || o.ahead > 0, changed: _ });
799
+ const g = Array.from(/* @__PURE__ */ new Set([...h, ...p]));
800
+ return i(200, { pendingPublish: h.length > 0 || o.ahead > 0, changed: g });
804
801
  } catch {
805
802
  return i(200, { pendingPublish: !1 });
806
803
  }
@@ -810,23 +807,23 @@ async function Jt(e, n) {
810
807
  const r = await t.status(), c = r.staged.length > 0;
811
808
  let h = !1;
812
809
  c && (await t.commit("okno: publish content"), h = !0);
813
- let p = !1, _ = null;
810
+ let p = !1, g = null;
814
811
  try {
815
812
  (h || r.ahead > 0) && (await t.push(), p = !0);
816
813
  } catch (d) {
817
- _ = d instanceof Error ? d.message.split(`
814
+ g = d instanceof Error ? d.message.split(`
818
815
  `)[0] : String(d);
819
816
  }
820
- return i(200, { ok: !0, alreadyUpToDate: !h && r.ahead === 0, committed: h, pushed: p, pushError: _ });
817
+ return i(200, { ok: !0, alreadyUpToDate: !h && r.ahead === 0, committed: h, pushed: p, pushError: g });
821
818
  }
822
819
  if (s === "POST" && a === "schema/save-fields") {
823
820
  const { kind: t, name: o, fields: r, renames: c, deletes: h } = await n.json();
824
821
  if (!t || !o || !r) return i(400, { error: "Missing kind, name or fields" });
825
- const { schema: p, header: _ } = T(e);
826
- Fe(p, t, o, r), f(p, _);
822
+ const { schema: p, header: g } = T(e);
823
+ Fe(p, t, o, r), f(p, g);
827
824
  const d = c && typeof c == "object" ? c : {}, $ = Array.isArray(h) ? h : [];
828
825
  if (Object.keys(d).length > 0 || $.length > 0)
829
- for (const { rel: w, abs: g } of _t(e, t, o, d, $)) l(w, g);
826
+ for (const { rel: w, abs: _ } of _t(e, t, o, d, $)) l(w, _);
830
827
  return i(200, { ok: !0, commit: { fileSha: "" }, schema: p });
831
828
  }
832
829
  if (s === "POST" && a === "schema/set-locales") {
@@ -851,8 +848,8 @@ async function Jt(e, n) {
851
848
  const { schema: c, header: h } = T(e), { unchanged: p } = Je(c, t, o, r);
852
849
  if (p) return i(200, { ok: !0, unchanged: !0 });
853
850
  f(c, h);
854
- const _ = `${t}/${o}.ts`, d = `${t}/${r}.ts`, $ = C(e, _), w = C(e, d);
855
- return $ && w && k($) && (U(L(w), { recursive: !0 }), z($), z(w), R(w, A($)), G($), l(_, $), l(d, w)), i(200, { ok: !0, commit: { fileSha: "" }, schema: c, from: o, to: r, kind: t });
851
+ const g = `${t}/${o}.ts`, d = `${t}/${r}.ts`, $ = C(e, g), w = C(e, d);
852
+ return $ && w && k($) && (U(L(w), { recursive: !0 }), z($), z(w), R(w, A($)), G($), l(g, $), l(d, w)), i(200, { ok: !0, commit: { fileSha: "" }, schema: c, from: o, to: r, kind: t });
856
853
  }
857
854
  if (s === "POST" && a === "schema/reorder") {
858
855
  const { kind: t, order: o } = await n.json();
@@ -889,8 +886,8 @@ async function Jt(e, n) {
889
886
  if (s === "POST" && a === "setup/scaffold-page") {
890
887
  const { name: t, kind: o, fields: r, label: c } = await n.json();
891
888
  if (!t || !o) return i(400, { error: "Missing name or kind" });
892
- const h = r ?? [], { schema: p, header: _ } = T(e);
893
- if (Ze(p, t, o, h, c), f(p, _), o !== "blocks") {
889
+ const h = r ?? [], { schema: p, header: g } = T(e);
890
+ if (Ze(p, t, o, h, c), f(p, g), o !== "blocks") {
894
891
  const d = `${o}/${t}.ts`, $ = C(e, d);
895
892
  if ($) {
896
893
  const w = o === "collections" ? `export default []
@@ -921,8 +918,8 @@ async function Jt(e, n) {
921
918
  if (!t || o == null) return i(400, { error: "Missing filename or content" });
922
919
  const c = we(t);
923
920
  if (!c || c === "-") return i(400, { error: "Invalid filename" });
924
- const h = Se(r ?? ""), p = h ? `${h}/${c}` : c, _ = V(e, `files/${p}`);
925
- return _ ? (U(L(_), { recursive: !0 }), R(_, Buffer.from(o, "base64")), i(200, { ok: !0, path: `files/${p}`, filename: c, commit: { fileSha: "" } })) : i(400, { error: "Invalid path" });
921
+ const h = Se(r ?? ""), p = h ? `${h}/${c}` : c, g = V(e, `files/${p}`);
922
+ return g ? (U(L(g), { recursive: !0 }), R(g, Buffer.from(o, "base64")), i(200, { ok: !0, path: `files/${p}`, filename: c, commit: { fileSha: "" } })) : i(400, { error: "Invalid path" });
926
923
  }
927
924
  if (s === "POST" && a === "files/delete") {
928
925
  const t = (await n.json())?.path;