@marimo-team/islands 0.25.3-dev141 → 0.25.3-dev3

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.
@@ -135,7 +135,7 @@ function F(e) {
135
135
  }
136
136
  //#endregion
137
137
  //#region src/components/editor/boundary/ErrorBoundary.tsx
138
- var I = (0, T.lazy)(() => import("./feedback-button-DaPwHIdM.js").then((e) => ({ default: e.FeedbackModal }))), L = (e) => {
138
+ var I = (0, T.lazy)(() => import("./feedback-button-DxXNcC6q.js").then((e) => ({ default: e.FeedbackModal }))), L = (e) => {
139
139
  let t = (0, w.c)(2), n;
140
140
  return t[0] === e.children ? n = t[1] : (n = /* @__PURE__ */ (0, j.jsx)(O, {
141
141
  FallbackComponent: R,
@@ -18,7 +18,7 @@ function x() {
18
18
  return e.warn("Failed to get version from mount config"), null;
19
19
  }
20
20
  }
21
- var S = x() || "0.25.3-dev141", C = u(S), w = u(!0);
21
+ var S = x() || "0.25.3-dev3", C = u(S), w = u(!0);
22
22
  u(null);
23
23
  //#endregion
24
24
  //#region src/core/wasm/state.ts
@@ -12,7 +12,7 @@ import { t as st } from "./check-EDwSwP89.js";
12
12
  import { A as ct, C as lt, M as ut, O as dt, S as ft, _ as pt, b as mt, c as ht, d as gt, g as _t, h as vt, i as yt, l as bt, m as xt, n as St, p as Ct, s as wt, t as Tt, u as Et, v as Dt, y as Ot } from "./select-BButFi-d.js";
13
13
  import { $ as kt, $t as At, A as jt, At as Mt, B as Nt, Bt as Pt, Ct as Ft, D as It, Dt as Lt, E as Rt, Et as zt, F as Bt, Ft as Vt, G as Ht, Gt as Ut, H as Wt, Ht as Gt, I as Kt, It as qt, J as Jt, Jt as Yt, Kt as Xt, L as Zt, Lt as Qt, M as $t, Mt as en, N as tn, Nt as nn, O as rn, Ot as an, P as on, Pt as sn, Q as cn, Qt as ln, R as un, Rt as dn, S as fn, St as pn, T as mn, Tt as hn, U as gn, Ut as _n, V as vn, Vt as yn, W as bn, Wt as xn, X as Sn, Xt as Cn, Y as wn, Yt as Tn, Z as En, Zt as Dn, _ as On, _n as kn, _t as An, a as jn, at as Mn, b as Nn, bt as Pn, cn as Fn, ct as In, d as Ln, dn as Rn, dt as zn, et as Bn, f as Vn, fn as Hn, ft as Un, gn as Wn, gt as Gn, h as Kn, hn as qn, ht as Jn, i as Yn, in as Xn, it as Zn, j as Qn, jt as $n, k as er, kt as tr, l as nr, lt as rr, mn as ir, mt as ar, n as or, nn as sr, nt as cr, o as lr, on as ur, ot as dr, pn as fr, pt as pr, qt as mr, rn as hr, rt as gr, s as _r, sn as vr, st as yr, t as br, tn as xr, tt as Sr, u as Cr, un as wr, vn as Tr, vt as Er, w as Dr, wt as Or, x as kr, xt as Ar, y as jr, yt as Mr, z as Nr, zt as Pr } from "./dropdown-menu-CP_qCYHC.js";
14
14
  import { _ as Fr, a as Ir, b as Lr, c as Rr, i as zr, n as Br, r as Vr, t as Hr, u as Ur, v as Wr } from "./toDate-BNJf01u1.js";
15
- import { n as Gr, t as Kr } from "./ErrorBoundary-Cg59O3xL.js";
15
+ import { n as Gr, t as Kr } from "./ErrorBoundary-iHE9DnZC.js";
16
16
  import { t as qr } from "./clsx-CoeGtWvn.js";
17
17
  import { t as Jr } from "./react-dom-DUmH0GXv.js";
18
18
  import { t as Yr } from "./jsx-runtime-3BD1kT0s.js";
@@ -2,7 +2,7 @@ import { a as e } from "./rolldown-runtime-Cb76FRpK.js";
2
2
  import { t } from "./react-sHtZdjeP.js";
3
3
  import { t as n } from "./react-dom-DUmH0GXv.js";
4
4
  import { c as r, l as i, u as a } from "./data-grid-types-BH_r7g7l.js";
5
- import { a as o, i as s, n as c, r as l } from "./glide-data-editor-Ctz2mH6k.js";
5
+ import { a as o, i as s, n as c, r as l } from "./glide-data-editor-BQ7uKbeo.js";
6
6
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_aca11a353ce3b112922852200b9c160f/node_modules/@glideapps/glide-data-grid/dist/esm/internal/data-grid-overlay-editor/data-grid-overlay-editor-style.js
7
7
  var u = /* @__PURE__ */ e(t(), 1), d = /* @__PURE__ */ e(n(), 1), f = /*#__PURE__*/ o("div")({
8
8
  name: "DataGridOverlayEditorStyle",
@@ -5,12 +5,12 @@ import { t as i } from "./compiler-runtime-CldRdSsv.js";
5
5
  import { t as a } from "./copy-icon-Ft7t9bqz.js";
6
6
  import { Ct as o, Ft as s, H as c, L as l, Lt as u, V as d, d as f, un as p } from "./cells-C8iCYvLU.js";
7
7
  import { b as m } from "./select-BButFi-d.js";
8
- import { n as h, t as ee } from "./globals-EpFoRj_E.js";
8
+ import { n as h, t as ee } from "./globals-DSavh2ZB.js";
9
9
  import { t as g } from "./jsx-runtime-3BD1kT0s.js";
10
10
  import { C as _, _ as te, i as v } from "./useTheme-CRnjkku0.js";
11
11
  import { a as ne, i as re, n as ie, r as ae } from "./dialog-CEBFZNyc.js";
12
12
  import { t as oe } from "./useAsyncData-Deh5kszT.js";
13
- import { t as se } from "./code-visibility-Da3iitn_.js";
13
+ import { t as se } from "./code-visibility-BCpXa0Xh.js";
14
14
  import { i as ce, n as le } from "./error-entries-CzoYkIQZ.js";
15
15
  //#region src/components/ui/skeleton.tsx
16
16
  var y = /* @__PURE__ */ e(r(), 1), b = i(), x = g(), ue = (e) => {
@@ -6,7 +6,7 @@ import { i as s, n as c, r as l } from "./copy-icon-Ft7t9bqz.js";
6
6
  import { C as u, c as d, i as f, n as p, s as m, t as h, x as g } from "./select-BButFi-d.js";
7
7
  import { d as _, h as v, i as y, l as b, n as x, o as S, s as C, t as w, u as T } from "./dropdown-menu-CP_qCYHC.js";
8
8
  import { c as E, d as D, l as O, n as k, o as A, s as ee, t as j, u as te } from "./glide-utils-DJyqh0EM.js";
9
- import { n as ne, t as re } from "./ErrorBoundary-Cg59O3xL.js";
9
+ import { n as ne, t as re } from "./ErrorBoundary-iHE9DnZC.js";
10
10
  import { t as M } from "./react-dom-DUmH0GXv.js";
11
11
  import { t as N } from "./jsx-runtime-3BD1kT0s.js";
12
12
  import { t as ie } from "./label-BDKF3Afc.js";
@@ -7062,7 +7062,7 @@ function rs(e, t, n, r, i) {
7062
7062
  }
7063
7063
  //#endregion
7064
7064
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_aca11a353ce3b112922852200b9c160f/node_modules/@glideapps/glide-data-grid/dist/esm/data-editor/data-editor.js
7065
- var is = /* @__PURE__ */ e(_r(), 1), as = /* @__PURE__ */ e(xr(), 1), os = K.lazy(async () => await import("./data-grid-overlay-editor-mJt3Pg4S.js")), ss = 0;
7065
+ var is = /* @__PURE__ */ e(_r(), 1), as = /* @__PURE__ */ e(xr(), 1), os = K.lazy(async () => await import("./data-grid-overlay-editor-Ch2SgmvG.js")), ss = 0;
7066
7066
  function cs(e) {
7067
7067
  return (0, is.default)((0, as.default)((0, as.default)(e).filter((e) => e.span !== void 0).map((e) => (0, Za.default)((e.span?.[0] ?? 0) + 1, (e.span?.[1] ?? 0) + 1))));
7068
7068
  }
@@ -9293,7 +9293,7 @@ function Vs(e, t, n, r, i) {
9293
9293
  }
9294
9294
  //#endregion
9295
9295
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_aca11a353ce3b112922852200b9c160f/node_modules/@glideapps/glide-data-grid/dist/esm/cells/number-cell.js
9296
- var Hs = K.lazy(async () => await import("./number-overlay-editor-CtxrummL.js")), Us = {
9296
+ var Hs = K.lazy(async () => await import("./number-overlay-editor-D6kYaqh5.js")), Us = {
9297
9297
  getAccessibilityString: (e) => e.data?.toString() ?? "",
9298
9298
  kind: W.Number,
9299
9299
  needsHover: (e) => e.hoverEffect === !0,
@@ -1,6 +1,6 @@
1
1
  import { h as e } from "./tooltip-BO1REbqs.js";
2
2
  import { _ as t } from "./useTheme-CRnjkku0.js";
3
- import { r as n } from "./code-visibility-Da3iitn_.js";
3
+ import { r as n } from "./code-visibility-BCpXa0Xh.js";
4
4
  var r = e("triangle-alert", [
5
5
  ["path", {
6
6
  d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
package/dist/main.js CHANGED
@@ -7,7 +7,7 @@ import { C as w, F as T, G as E, I as D, J as O, K as k, L as A, P as j, R as M,
7
7
  import { a as oe, d as se, f as ce, h as V, i as le, n as ue, o as de, r as fe, t as pe } from "./tooltip-BO1REbqs.js";
8
8
  import { $ as me, $t as he, B as ge, Bt as _e, C as ve, Ct as ye, D as be, Dt as xe, Et as Se, F as Ce, G as we, Gt as Te, Ht as Ee, I as De, J as Oe, Jt as ke, Kt as Ae, L as je, O as Me, Ot as Ne, P as Pe, Pt as Fe, Q as Ie, Qt as Le, Rt as Re, S as ze, St as Be, T as Ve, Tt as He, U as Ue, W as We, Wt as Ge, bt as Ke, c as qe, cn as Je, ct as Ye, d as Xe, dn as Ze, dt as Qe, en as $e, f as et, fn as tt, ft as nt, g as rt, gt as it, h as at, hn as ot, k as st, l as ct, ln as lt, m as ut, mn as dt, n as ft, o as pt, on as mt, ot as ht, p as gt, q as _t, qt as vt, r as yt, rn as bt, rt as xt, sn as St, st as Ct, tn as wt, u as Tt, v as Et, w as Dt, wt as Ot, zt as kt } from "./cells-C8iCYvLU.js";
9
9
  import { D as At, E as jt, O as Mt, S as Nt, T as Pt, _ as Ft, a as It, c as Lt, d as Rt, f as zt, g as Bt, h as Vt, i as Ht, l as Ut, m as Wt, n as Gt, o as Kt, p as qt, r as Jt, s as Yt, t as Xt, u as Zt, v as Qt, w as $t, x as en, y as tn } from "./spec-BwarBpUJ.js";
10
- import { $t as nn, A as rn, At as an, B as on, Bt as sn, C as cn, Ct as ln, D as un, Dt as dn, E as fn, Et as pn, F as mn, Ft as hn, G as gn, Gt as _n, H as vn, Ht as yn, I as bn, It as xn, J as Sn, Jt as Cn, K as wn, Kt as Tn, L as En, Lt as Dn, M as On, Mt as kn, N as An, Nt as jn, O as Mn, Ot as Nn, P as Pn, Pt as Fn, Qt as In, R as Ln, Rt as Rn, S as zn, St as Bn, T as Vn, Tt as Hn, U as Un, Ut as Wn, V as Gn, Vt as Kn, W as qn, Wt as Jn, X as Yn, Xt as Xn, Y as Zn, Yt as Qn, Zt as $n, _ as er, _t as tr, an as nr, at as rr, b as ir, c as ar, cn as or, ct as sr, d as cr, dn as lr, dt as ur, en as dr, et as fr, f as pr, fn as mr, ft as hr, g as gr, gt as _r, h as vr, hn as yr, ht as br, in as xr, it as Sr, j as Cr, jt as wr, k as Tr, kt as Er, ln as Dr, lt as Or, m as kr, mn as Ar, mt as jr, nn as Mr, nt as Nr, ot as Pr, p as Fr, pn as Ir, pt as Lr, q as Rr, qt as zr, r as Br, rn as Vr, rt as Hr, sn as Ur, st as Wr, t as Gr, tn as Kr, tt as qr, u as Jr, un as Yr, ut as Xr, v as Zr, vt as Qr, w as $r, wt as ei, x as ti, y as ni, yt as ri, z as ii, zt as ai } from "./common-C6FHcu5p.js";
10
+ import { $t as nn, A as rn, At as an, B as on, Bt as sn, C as cn, Ct as ln, D as un, Dt as dn, E as fn, Et as pn, F as mn, Ft as hn, G as gn, Gt as _n, H as vn, Ht as yn, I as bn, It as xn, J as Sn, Jt as Cn, K as wn, Kt as Tn, L as En, Lt as Dn, M as On, Mt as kn, N as An, Nt as jn, O as Mn, Ot as Nn, P as Pn, Pt as Fn, Qt as In, R as Ln, Rt as Rn, S as zn, St as Bn, T as Vn, Tt as Hn, U as Un, Ut as Wn, V as Gn, Vt as Kn, W as qn, Wt as Jn, X as Yn, Xt as Xn, Y as Zn, Yt as Qn, Zt as $n, _ as er, _t as tr, an as nr, at as rr, b as ir, c as ar, cn as or, ct as sr, d as cr, dn as lr, dt as ur, en as dr, et as fr, f as pr, fn as mr, ft as hr, g as gr, gt as _r, h as vr, hn as yr, ht as br, in as xr, it as Sr, j as Cr, jt as wr, k as Tr, kt as Er, ln as Dr, lt as Or, m as kr, mn as Ar, mt as jr, nn as Mr, nt as Nr, ot as Pr, p as Fr, pn as Ir, pt as Lr, q as Rr, qt as zr, r as Br, rn as Vr, rt as Hr, sn as Ur, st as Wr, t as Gr, tn as Kr, tt as qr, u as Jr, un as Yr, ut as Xr, v as Zr, vt as Qr, w as $r, wt as ei, x as ti, y as ni, yt as ri, z as ii, zt as ai } from "./common-BrBUdtPy.js";
11
11
  import { c as oi, i as si, n as ci, o as li, t as ui } from "./useLifecycle-j7D9uD1o.js";
12
12
  import { t as di } from "./check-EDwSwP89.js";
13
13
  import { A as fi, C as pi, D as mi, E as hi, M as gi, O as _i, S as vi, T as yi, a as bi, b as xi, c as Si, i as Ci, k as wi, l as Ti, n as Ei, o as Di, r as Oi, s as ki, t as Ai, w as ji, x as Mi } from "./select-BButFi-d.js";
@@ -15,8 +15,8 @@ import { $ as Ni, C as Pi, Et as Fi, J as Ii, K as Li, R as Ri, S as zi, U as Bi
15
15
  import { S as ua, a as da, b as fa, c as pa, d as ma, f as ha, g as ga, l as _a, m as va, p as ya, s as ba, v as xa, y as Sa } from "./toDate-BNJf01u1.js";
16
16
  import { a as Ca, c as wa, d as Ta, f as Ea, i as Da, l as Oa, n as ka, o as Aa, r as ja, s as Ma, t as Na } from "./process-output-e4jj9Ijt.js";
17
17
  import { a as Pa, c as Fa, d as Ia, i as La, l as Ra, r as za, u as Ba } from "./glide-utils-DJyqh0EM.js";
18
- import { n as Va, t as Ha } from "./ErrorBoundary-Cg59O3xL.js";
19
- import { n as Ua, t as Wa } from "./globals-EpFoRj_E.js";
18
+ import { n as Va, t as Ha } from "./ErrorBoundary-iHE9DnZC.js";
19
+ import { n as Ua, t as Wa } from "./globals-DSavh2ZB.js";
20
20
  import { t as Ga } from "./react-dom-DUmH0GXv.js";
21
21
  import { t as Ka } from "./jsx-runtime-3BD1kT0s.js";
22
22
  import { B as qa, C as H, Ct as Ja, D as Ya, E as Xa, F as U, G as Za, H as Qa, I as $a, L as eo, M as W, N as to, O as no, P as ro, Q as io, R as ao, S as G, St as oo, Tt as so, U as co, W as lo, Y as uo, Z as fo, _ as po, _t as mo, a as ho, b as go, bt as _o, c as vo, d as yo, f as bo, g as xo, h as So, ht as Co, i as wo, j as K, k as To, l as Eo, m as Do, n as Oo, o as ko, p as Ao, r as jo, s as Mo, u as No, ut as Po, v as Fo, vt as Io, w as Lo, wt as Ro, x as zo, xt as Bo, y as Vo, yt as Ho } from "./use-restore-focus-BEM7sFWl.js";
@@ -39,7 +39,7 @@ import { t as Ms } from "./useAsyncData-Deh5kszT.js";
39
39
  import { i as Ns, n as Ps, r as Fs } from "./formats-BGh2thRc.js";
40
40
  import { M as Is, N as Ls } from "./vega-loader.browser-DNST6uVf.js";
41
41
  import { a as Rs, n as zs } from "./loader-BQOfjTIJ.js";
42
- import { c as Bs, d as Vs, i as Hs, l as Us, o as Ws, s as Gs, t as Ks, u as qs } from "./code-visibility-Da3iitn_.js";
42
+ import { c as Bs, d as Vs, i as Hs, l as Us, o as Ws, s as Gs, t as Ks, u as qs } from "./code-visibility-BCpXa0Xh.js";
43
43
  import { t as Js } from "./useDeepCompareMemoize-DXwzRINI.js";
44
44
  import { t as Ys } from "./esm-D2gTsXEV.js";
45
45
  //#region ../node_modules/.pnpm/iconify-icon@2.3.0/node_modules/iconify-icon/dist/iconify-icon.mjs
@@ -10533,7 +10533,7 @@ function VC(e, t) {
10533
10533
  }
10534
10534
  //#endregion
10535
10535
  //#region src/plugins/impl/DataEditorPlugin.tsx
10536
- var HC = J.lazy(() => import("./glide-data-editor-Ctz2mH6k.js").then((e) => e.t)), UC = wS("marimo-data-editor", { cssStyles: [qS] }).withData(W({
10536
+ var HC = J.lazy(() => import("./glide-data-editor-BQ7uKbeo.js").then((e) => e.t)), UC = wS("marimo-data-editor", { cssStyles: [qS] }).withData(W({
10537
10537
  initialValue: W({ edits: G(W({
10538
10538
  rowIdx: K(),
10539
10539
  columnId: U(),
@@ -30107,7 +30107,7 @@ function OR(e) {
30107
30107
  }
30108
30108
  //#endregion
30109
30109
  //#region src/components/editor/renderers/slides-layout/slides-layout.tsx
30110
- var kR = J.lazy(() => import("./reveal-component-DrIXvR_7.js")), AR = (e) => {
30110
+ var kR = J.lazy(() => import("./reveal-component-BTBfJ3ju.js")), AR = (e) => {
30111
30111
  let t = (0, X.c)(33), { layout: n, setLayout: r, cells: i, mode: a } = e, o = ns(ga), s = a === "read" || o, c = ns(gt) > 1, [l, u] = (0, J.useState)(null), d;
30112
30112
  t[0] !== i || t[1] !== n ? (d = EP(i, n), t[0] = i, t[1] = n, t[2] = d) : d = t[2];
30113
30113
  let { slideCells: f, skippedIds: p, noOutputIds: m, slideTypes: h, startCellIndex: g } = d, _;
@@ -1,6 +1,6 @@
1
1
  import { a as e } from "./rolldown-runtime-Cb76FRpK.js";
2
2
  import { t } from "./react-sHtZdjeP.js";
3
- import { a as n } from "./glide-data-editor-Ctz2mH6k.js";
3
+ import { a as n } from "./glide-data-editor-BQ7uKbeo.js";
4
4
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_aca11a353ce3b112922852200b9c160f/node_modules/@glideapps/glide-data-grid/dist/esm/internal/data-grid-overlay-editor/private/number-overlay-editor-style.js
5
5
  var r = /* @__PURE__ */ e(t()), i = /*#__PURE__*/ n("div")({
6
6
  name: "NumberOverlayEditorStyle",
@@ -4,14 +4,14 @@ import { t as o } from "./react-sHtZdjeP.js";
4
4
  import { t as s } from "./compiler-runtime-CldRdSsv.js";
5
5
  import { h as c, t as l } from "./tooltip-BO1REbqs.js";
6
6
  import { w as u } from "./cells-C8iCYvLU.js";
7
- import { $ as d, Q as f, Z as p, an as m, i as h, l as g, ln as _, n as v, on as y, r as b, t as x, u as S } from "./common-C6FHcu5p.js";
7
+ import { $ as d, Q as f, Z as p, an as m, i as h, l as g, ln as _, n as v, on as y, r as b, t as x, u as S } from "./common-BrBUdtPy.js";
8
8
  import { M as C } from "./select-BButFi-d.js";
9
9
  import { q as ee } from "./dropdown-menu-CP_qCYHC.js";
10
10
  import { g as w } from "./toDate-BNJf01u1.js";
11
11
  import { t as T } from "./jsx-runtime-3BD1kT0s.js";
12
12
  import { q as E } from "./use-restore-focus-BEM7sFWl.js";
13
13
  import { A as D, C as O, b as k } from "./useTheme-CRnjkku0.js";
14
- import { a as A, n as te, t as ne } from "./code-visibility-Da3iitn_.js";
14
+ import { a as A, n as te, t as ne } from "./code-visibility-BCpXa0Xh.js";
15
15
  /* empty css */
16
16
  var j = c("sticky-note", [["path", {
17
17
  d: "M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.25.3-dev141",
3
+ "version": "0.25.3-dev3",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -183,7 +183,9 @@
183
183
  "preview:islands": "cross-env VITE_MARIMO_VERSION='0.4.6' VITE_MARIMO_ISLANDS=true vite --config islands/vite.config.mts build",
184
184
  "storybook": "storybook dev -p 6006",
185
185
  "build-storybook": "storybook build",
186
- "sync-katex-css": "node --experimental-strip-types scripts/sync-katex-css.ts"
186
+ "sync-katex-css": "node --experimental-strip-types scripts/sync-katex-css.ts",
187
+ "codegen": "node --experimental-strip-types scripts/generate-host-protocol.ts",
188
+ "codegen:check": "node --experimental-strip-types scripts/generate-host-protocol.ts --check"
187
189
  },
188
190
  "peerDependencies": {
189
191
  "react": "^17 || ^18 || ^19",
@@ -212,6 +214,7 @@
212
214
  "jsdom": "^24.1.3",
213
215
  "msw": "^2.15.0",
214
216
  "npm-run-all2": "^6.2.6",
217
+ "orval": "8.40.0",
215
218
  "oxc-transform-react": "0.145.0",
216
219
  "oxfmt": "^0.68.0",
217
220
  "oxlint": "^1.83.0",
@@ -0,0 +1,100 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import NodeChildProcess from "node:child_process";
4
+ import NodeFs from "node:fs";
5
+ import NodeOs from "node:os";
6
+ import NodePath from "node:path";
7
+ import NodeUrl from "node:url";
8
+ import { expect, it } from "vitest";
9
+ import { z } from "zod";
10
+
11
+ it("enforces host dependencies for runtime and type imports", () => {
12
+ const frontend = NodeUrl.fileURLToPath(
13
+ new NodeUrl.URL("../../", import.meta.url),
14
+ );
15
+ const directory = NodeFs.mkdtempSync(
16
+ NodePath.join(NodeOs.tmpdir(), "host-imports-"),
17
+ );
18
+ const files = {
19
+ "src/core/host/allowed.ts": `
20
+ import { atom } from "jotai/vanilla";
21
+ import { z } from "zod";
22
+ import { Logger } from "@/utils/Logger";
23
+ import type { Document } from "./document";
24
+ export * from "@/core/host/events";
25
+ type Event = import("./events").NotebookEvent;
26
+ void import("./protocol");
27
+ `,
28
+ "src/core/host/protocol.ts": `
29
+ import type { NotificationMessage as A } from "../kernel/messages";
30
+ import { type NotificationMessage as B } from "@/core/kernel/messages";
31
+ import { NotificationMessage as C } from "../kernel/messages";
32
+ import type { NotificationPayload } from "../kernel/messages";
33
+ `,
34
+ "src/core/host/forbidden.ts": `
35
+ import { useEffect } from "react";
36
+ import type { NotificationMessage } from "../kernel/messages";
37
+ export * from "../kernel/messages";
38
+ export { Logger } from "@/utils/Logger/../other";
39
+ void import("../kernel/messages");
40
+ type Message = import("../kernel/messages").NotificationMessage;
41
+ const module = require("../kernel/messages");
42
+ void import(module);
43
+ import "./__tests__/allowed";
44
+ import "./allowed.test";
45
+ `,
46
+ "src/core/host/__tests__/allowed.ts": `import { useEffect } from "react";`,
47
+ "src/core/host/allowed.test.ts": `import { useEffect } from "react";`,
48
+ "src/core/host/allowed.spec.ts": `import { useEffect } from "react";`,
49
+ "src/core/websocket/allowed.ts": `import { useEffect } from "react";`,
50
+ };
51
+ try {
52
+ for (const [path, source] of Object.entries(files)) {
53
+ const destination = NodePath.join(directory, path);
54
+ NodeFs.mkdirSync(NodePath.dirname(destination), { recursive: true });
55
+ NodeFs.writeFileSync(destination, source);
56
+ }
57
+ const result = NodeChildProcess.spawnSync(
58
+ NodePath.join(frontend, "node_modules/.bin/oxlint"),
59
+ [
60
+ "--config",
61
+ NodePath.join(frontend, ".oxlintrc.json"),
62
+ "--format",
63
+ "json",
64
+ directory,
65
+ ],
66
+ { cwd: frontend, encoding: "utf8" },
67
+ );
68
+ const report = z
69
+ .object({
70
+ diagnostics: z.array(
71
+ z.object({
72
+ severity: z.string(),
73
+ filename: z.string(),
74
+ labels: z.array(z.object({ span: z.object({ line: z.number() }) })),
75
+ }),
76
+ ),
77
+ })
78
+ .parse(JSON.parse(result.stdout));
79
+ const errors = report.diagnostics.filter(
80
+ (diagnostic) => diagnostic.severity === "error",
81
+ );
82
+ expect(
83
+ errors
84
+ .map((error) => ({
85
+ file: NodePath.basename(error.filename),
86
+ line: error.labels[0].span.line,
87
+ }))
88
+ .toSorted((a, b) => a.file.localeCompare(b.file) || a.line - b.line),
89
+ ).toEqual([
90
+ ...[2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map((line) => ({
91
+ file: "forbidden.ts",
92
+ line,
93
+ })),
94
+ ...[2, 3, 4, 5].map((line) => ({ file: "protocol.ts", line })),
95
+ ]);
96
+ expect(result.status).toBe(1);
97
+ } finally {
98
+ NodeFs.rmSync(directory, { recursive: true, force: true });
99
+ }
100
+ });
@@ -0,0 +1,6 @@
1
+ # Host core
2
+
3
+ Production code may import host modules, `jotai/vanilla`, `zod`, and
4
+ `@/utils/Logger`. Enforced by `marimo/host-imports`. Tests are exempt.
5
+
6
+ Define interfaces here and inject application behavior through adapters.
@@ -0,0 +1,214 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import NodeFs from "node:fs";
4
+ import NodeUrl from "node:url";
5
+ import { describe, expect, expectTypeOf, it } from "vitest";
6
+ import * as Protocol from "../protocol";
7
+
8
+ const fixtures = new NodeUrl.URL(
9
+ "../../../../../protocols/host/fixtures/",
10
+ import.meta.url,
11
+ );
12
+
13
+ function readFixture(name: string): unknown {
14
+ return JSON.parse(
15
+ NodeFs.readFileSync(new NodeUrl.URL(name, fixtures), "utf8"),
16
+ );
17
+ }
18
+
19
+ const records = {
20
+ "record.json": Protocol.HostRecord,
21
+ "cell.json": Protocol.Cell,
22
+ "analysis.json": Protocol.Analysis,
23
+ "diagnostic.json": Protocol.Error,
24
+ "edit.json": Protocol.EditRequest,
25
+ "edit-conflict-request.json": Protocol.EditRequest,
26
+ "edit-response.json": Protocol.EditResponse,
27
+ "execution-restored.json": Protocol.Execution,
28
+ "run-cells-request.json": Protocol.RunRequest,
29
+ };
30
+
31
+ describe("host protocol fixtures", () => {
32
+ it.each(Object.entries(records))("parses %s unchanged", (name, schema) => {
33
+ const input = readFixture(name);
34
+ const original = structuredClone(input);
35
+ expect(schema.parse(input)).toEqual(original);
36
+ expect(input).toEqual(original);
37
+ });
38
+
39
+ it.each(NodeFs.readdirSync(new NodeUrl.URL("problems/", fixtures)))(
40
+ "parses problem %s",
41
+ (name) => {
42
+ const input = readFixture(`problems/${name}`);
43
+ expect(Protocol.Problem.parse(input)).toEqual(input);
44
+ },
45
+ );
46
+
47
+ it.each(NodeFs.readdirSync(fixtures).filter((name) => name.endsWith(".sse")))(
48
+ "parses events in %s unchanged",
49
+ (name) => {
50
+ const stream = NodeFs.readFileSync(
51
+ new NodeUrl.URL(name, fixtures),
52
+ "utf8",
53
+ );
54
+ let count = 0;
55
+ for (const frame of stream.split(/\r?\n\r?\n/)) {
56
+ const event = /^event: (.+)$/m.exec(frame)?.[1];
57
+ if (!event && !/^data:/m.test(frame)) {
58
+ continue;
59
+ }
60
+ const data = frame
61
+ .split(/\r?\n/)
62
+ .filter((line) => line.startsWith("data:"))
63
+ .map((line) => line.slice(5).trimStart())
64
+ .join("\n");
65
+ const id = /^id: (.+)$/m.exec(frame)?.[1];
66
+ const payload: unknown = JSON.parse(data);
67
+ const input = { event, data: payload, ...(id ? { id } : {}) };
68
+ const original = structuredClone(input);
69
+ expect(Protocol.Event.parse(input)).toEqual(original);
70
+ expect(input).toEqual(original);
71
+ count += 1;
72
+ }
73
+ expect(count).toBeGreaterThan(0);
74
+ },
75
+ );
76
+ });
77
+
78
+ describe("host protocol bindings", () => {
79
+ it("preserves native marimo payloads without interpreting them", () => {
80
+ expectTypeOf<Protocol.MarimoEvent["data"]["marimo"]>().toBeUnknown();
81
+ const input = {
82
+ event: "marimo",
83
+ id: "42",
84
+ data: {
85
+ marimo: {
86
+ future_payload: { value: Number.NaN },
87
+ },
88
+ },
89
+ };
90
+ expect(Protocol.Event.parse(input)).toEqual(input);
91
+ });
92
+
93
+ it("accepts additive fields and preserves arbitrary notebook settings", () => {
94
+ const cell = Protocol.Cell.parse(readFixture("cell.json"));
95
+ const input = {
96
+ ...cell,
97
+ future: { enabled: true },
98
+ config: { ...cell.config, future: 42 },
99
+ };
100
+ const original = structuredClone(input);
101
+ expect(Protocol.Cell.parse(input)).toEqual(cell);
102
+ expect(input).toEqual(original);
103
+
104
+ const { document } = Protocol.EditResponse.parse(
105
+ readFixture("edit-response.json"),
106
+ );
107
+ const configured = {
108
+ ...document,
109
+ app_config: { extension: { values: [1, null, false] } },
110
+ };
111
+ expect(Protocol.Document.parse(configured)).toEqual(configured);
112
+ });
113
+
114
+ it("applies the defaults declared for cell inputs", () => {
115
+ expect(
116
+ Protocol.CellInput.parse({ id: "c3", code: "x = 1", config: {} }),
117
+ ).toEqual({
118
+ id: "c3",
119
+ code: "x = 1",
120
+ name: "_",
121
+ config: {
122
+ column: null,
123
+ disabled: false,
124
+ hide_code: false,
125
+ expand_output: false,
126
+ },
127
+ });
128
+ });
129
+
130
+ it.each(["run_id", "runtime_id", "caused_by"] as const)(
131
+ "requires the nullable execution field %s",
132
+ (field) => {
133
+ const execution = Protocol.Execution.parse(
134
+ readFixture("execution-restored.json"),
135
+ );
136
+ const missing = Object.fromEntries(
137
+ Object.entries(execution).filter(([key]) => key !== field),
138
+ );
139
+ expect(Protocol.Execution.safeParse(missing).success).toBe(false);
140
+ expect(
141
+ Protocol.Execution.safeParse({ ...execution, [field]: null }).success,
142
+ ).toBe(true);
143
+ },
144
+ );
145
+
146
+ it("preserves snapshot metadata omissions and validates live timestamps", () => {
147
+ const cell = Protocol.Cell.parse(readFixture("cell.json"));
148
+ expect(Protocol.CellMessage.parse({ cell })).toEqual({ cell });
149
+ const message = { cell, time: "2026-01-01T12:00:00+05:30" };
150
+ expect(Protocol.CellMessage.parse(message)).toEqual(message);
151
+ for (const time of [
152
+ null,
153
+ "yesterday",
154
+ "2026-02-30T12:00:00Z",
155
+ "2026-01-01T12:00:00",
156
+ ]) {
157
+ expect(Protocol.CellMessage.safeParse({ cell, time }).success).toBe(
158
+ false,
159
+ );
160
+ }
161
+ });
162
+
163
+ it("rejects invalid cell fields without coercing their values", () => {
164
+ const cell = Protocol.Cell.parse(readFixture("cell.json"));
165
+ for (const patch of [
166
+ { id: "" },
167
+ { code: 42 },
168
+ { etag: 42 },
169
+ { version: "2" },
170
+ { version: 0 },
171
+ { version: 1.5 },
172
+ { config: { ...cell.config, disabled: "false" } },
173
+ ]) {
174
+ expect(Protocol.Cell.safeParse({ ...cell, ...patch }).success).toBe(
175
+ false,
176
+ );
177
+ }
178
+ const result = Protocol.Cell.safeParse({ ...cell, code: 42 });
179
+ expect(result.success).toBe(false);
180
+ if (result.success) {
181
+ throw new Error("Expected an invalid cell");
182
+ }
183
+ expect(result.error.issues).toEqual([
184
+ expect.objectContaining({ path: ["code"], code: "invalid_type" }),
185
+ ]);
186
+ });
187
+
188
+ it("requires the fields of the selected change kind", () => {
189
+ const change = { kind: "delete_cell", id: "c3", base_etag: "*" };
190
+ expect(Protocol.Change.parse(change)).toEqual(change);
191
+ expect(
192
+ Protocol.Change.safeParse({ kind: "delete_cell", id: "c3" }).success,
193
+ ).toBe(false);
194
+ expect(
195
+ Protocol.Change.safeParse({ ...change, kind: "unknown" }).success,
196
+ ).toBe(false);
197
+ });
198
+
199
+ it("requires custom payloads while allowing any JSON value", () => {
200
+ for (const data of [
201
+ null,
202
+ false,
203
+ 42,
204
+ "text",
205
+ { nested: [1, null, false] },
206
+ ]) {
207
+ const custom = { type: "example.event", data };
208
+ expect(Protocol.Custom.parse(custom)).toEqual(custom);
209
+ }
210
+ expect(Protocol.Custom.safeParse({ type: "example.event" }).success).toBe(
211
+ false,
212
+ );
213
+ });
214
+ });