okno 1.0.0-beta.21 → 1.0.0-beta.23

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.
@@ -0,0 +1,20 @@
1
+ function r(e, t) {
2
+ const n = { date: t.now, author: t.author }, a = { ...e, created: t.created ?? n, updated: n };
3
+ return `export default ${JSON.stringify(a, null, " ")}
4
+ `;
5
+ }
6
+ function o(e, t = `import type { Schema } from "okno"
7
+
8
+ `) {
9
+ return `${t}export default ${JSON.stringify(e, null, " ")} satisfies Schema
10
+ `;
11
+ }
12
+ function u(e) {
13
+ return `export default ${JSON.stringify(e, null, " ")}
14
+ `;
15
+ }
16
+ export {
17
+ o as a,
18
+ u as b,
19
+ r as e
20
+ };
@@ -1,5 +1,6 @@
1
- import { e as D, b as I, a as R, p as U } from "../encode-DoojdsVU.js";
2
- import { o as K, a as N, b as T } from "../order-bAkdncZC.js";
1
+ import { p as D } from "../parse-tlTHgSSs.js";
2
+ import { e as R, b as U, a as F } from "../encode-BfJY0Xy5.js";
3
+ import { o as N, a as T, b as W } from "../order-bAkdncZC.js";
3
4
  function a(s) {
4
5
  switch (s) {
5
6
  case "number":
@@ -75,13 +76,13 @@ function b(s, t, e, o) {
75
76
  const r = { ...i, name: o };
76
77
  delete r.label, n[e] = r;
77
78
  }
78
- function $(s, t, e, o) {
79
+ function m(s, t, e, o) {
79
80
  const n = s[t] ??= {}, i = n[e];
80
81
  if (!i) throw new l(404, `${t}/${e} does not exist in schema`);
81
82
  const r = { ...i };
82
83
  typeof o == "string" && o.trim() ? r.url = o.trim() : delete r.url, n[e] = r;
83
84
  }
84
- function m(s, t, e, o) {
85
+ function $(s, t, e, o) {
85
86
  if (!d.test(o)) throw new l(400, "Invalid target slug");
86
87
  if (e === o) return { unchanged: !0 };
87
88
  const n = s[t] ??= {};
@@ -160,16 +161,16 @@ export {
160
161
  g as applyKeyChanges,
161
162
  S as deleteSchemaEntry,
162
163
  a as emptyValueFor,
163
- D as encodeEntry,
164
- I as encodeRaw,
165
- R as encodeSchema,
164
+ R as encodeEntry,
165
+ U as encodeRaw,
166
+ F as encodeSchema,
166
167
  y as fieldsToContent,
167
168
  u as fieldsToSchema,
168
- K as orderBySlugs,
169
- N as orderWithInsert,
170
- T as orderWithout,
171
- U as parseExportDefault,
172
- m as renameSlug,
169
+ N as orderBySlugs,
170
+ T as orderWithInsert,
171
+ W as orderWithout,
172
+ D as parseExportDefault,
173
+ $ as renameSlug,
173
174
  x as reorderKind,
174
175
  w as saveFields,
175
176
  A as scaffoldEntry,
@@ -179,5 +180,5 @@ export {
179
180
  j as setLocales,
180
181
  b as setName,
181
182
  O as setStringsSchema,
182
- $ as setUrl
183
+ m as setUrl
183
184
  };
@@ -9,9 +9,11 @@
9
9
  * with acorn and walk the AST, accepting ONLY literal data; anything that would
10
10
  * *evaluate* is rejected.
11
11
  *
12
- * PARITY / SYNC: byte-for-byte (parsing logic) with the editor's
13
- * `editor/lib/parse-export-default.ts` and the backend's `lib/parse.ts` — THREE
14
- * copies of the parser (local vs hosted), keep all in step. See docs/engine-parity.md.
12
+ * PARITY / SYNC: this is the canonical copy. The editor imports it directly
13
+ * (`editor/lib/parse-export-default.ts` re-exports this). The backend keeps a
14
+ * byte-for-byte copy (`backend/src/lib/parse.ts`) because it's a separate
15
+ * deployable with no cross-package source imports — keep the two in step (local
16
+ * vs hosted). See docs/engine-parity.md.
15
17
  */
16
18
  export declare function parseExportDefault(raw: string): Record<string, unknown>;
17
19
  //# sourceMappingURL=parse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/engine/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAqDH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAyBvE"}
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/engine/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAqDH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAyBvE"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { o as a } from "./plugin-DcdYJY8n.js";
1
+ import { o as a } from "./plugin-TY1948ID.js";
2
2
  export {
3
3
  a as okno
4
4
  };
package/dist/mcp.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { existsSync as l, readdirSync as j, readFileSync as y, mkdirSync as D, writeFileSync as S, unlinkSync as C, realpathSync as N } from "node:fs";
2
2
  import { join as i, dirname as O, relative as L, sep as E, resolve as T } from "node:path";
3
3
  import { execFileSync as F } from "node:child_process";
4
- import { p as b, e as M, a as $ } from "./encode-DoojdsVU.js";
4
+ import { e as M, a as $ } from "./encode-BfJY0Xy5.js";
5
+ import { p as b } from "./parse-tlTHgSSs.js";
5
6
  function I() {
6
7
  const f = process.env.OKNO_DIR;
7
8
  if (f) {
@@ -17,7 +18,7 @@ function I() {
17
18
  }
18
19
  console.error("okno mcp: could not find an okno/ directory. Set OKNO_DIR to your project's okno/ path."), process.exit(1);
19
20
  }
20
- async function A() {
21
+ async function G() {
21
22
  const { McpServer: f } = await import("@modelcontextprotocol/sdk/server/mcp.js"), { StdioServerTransport: h } = await import("@modelcontextprotocol/sdk/server/stdio.js"), { z: o } = await import("zod"), s = I();
22
23
  function g(e) {
23
24
  if (!e || e.includes("..") || e.includes("\0") || e.startsWith("/")) throw new Error(`Invalid path: ${e}`);
@@ -27,15 +28,15 @@ async function A() {
27
28
  return t;
28
29
  }
29
30
  const m = (e, t = s) => F("git", e, { cwd: t, encoding: "utf-8" }).trim();
30
- let u;
31
+ let p;
31
32
  const _ = () => {
32
- if (u !== void 0) return u;
33
+ if (p !== void 0) return p;
33
34
  try {
34
- u = m(["config", "user.name"]) || "local";
35
+ p = m(["config", "user.name"]) || "local";
35
36
  } catch {
36
- u = "local";
37
+ p = "local";
37
38
  }
38
- return u;
39
+ return p;
39
40
  };
40
41
  function w() {
41
42
  const e = i(s, "schema.ts");
@@ -89,8 +90,8 @@ async function A() {
89
90
  const r = g(e);
90
91
  let n;
91
92
  if (l(r)) {
92
- const p = b(y(r, "utf-8"));
93
- p.created?.date && (n = p.created);
93
+ const u = b(y(r, "utf-8"));
94
+ u.created?.date && (n = u.created);
94
95
  }
95
96
  const d = M(t, { now: (/* @__PURE__ */ new Date()).toISOString(), author: _(), created: n });
96
97
  return D(O(r), { recursive: !0 }), S(r, d), c({ ok: !0, path: e });
@@ -121,14 +122,14 @@ async function A() {
121
122
  const n = m(["diff", "--cached", "--name-only"], t);
122
123
  let d = !1;
123
124
  n && (m(["commit", "-m", e?.trim() || "okno: content"], t), d = !0);
124
- let p = !1, v = null;
125
+ let u = !1, v = null;
125
126
  try {
126
- m(["push"], t), p = !0;
127
+ m(["push"], t), u = !0;
127
128
  } catch (k) {
128
129
  v = k instanceof Error ? k.message.split(`
129
130
  `)[0] : String(k);
130
131
  }
131
- return c({ ok: !0, committed: d, pushed: p, pushError: v, files: n ? n.split(`
132
+ return c({ ok: !0, committed: d, pushed: u, pushError: v, files: n ? n.split(`
132
133
  `) : [] });
133
134
  }
134
135
  );
@@ -136,5 +137,5 @@ async function A() {
136
137
  await a.connect(x), console.error(`okno mcp connected → ${s} (local filesystem)`);
137
138
  }
138
139
  export {
139
- A as runMcp
140
+ G as runMcp
140
141
  };
@@ -1,7 +1,7 @@
1
1
  import { join as c, relative as v, sep as O, resolve as g, dirname as R } from "node:path";
2
2
  import { existsSync as w, watch as E, readFileSync as M, mkdirSync as P, cpSync as A } from "node:fs";
3
3
  import { fileURLToPath as C } from "node:url";
4
- import { s as m, b as J, a as I, c as D, d as U, e as K, g as L, I as T, f as F, h as V, i as $, j as B, k as G } from "../dispatch-CmTJLIKc.js";
4
+ import { s as m, b as J, a as I, c as D, d as U, e as K, g as L, I as T, f as F, h as V, i as $, j as B, k as G } from "../dispatch-Ce0p8-Vu.js";
5
5
  import { mkdir as z, writeFile as f } from "node:fs/promises";
6
6
  const H = (n) => n.replaceAll(T, "__oknoSetImages(undefined)"), W = (n) => {
7
7
  let t = n;