brumate 0.4.2 → 0.4.4

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 (36) hide show
  1. package/dist/cli.js +2 -2
  2. package/dist/{client-Cwr2AfP4.js → client-iZ9a1Nut.js} +17 -8
  3. package/dist/client-iZ9a1Nut.js.map +1 -0
  4. package/dist/{defer-CxjvJXD_.js → defer-DP7dMS2y.js} +2 -2
  5. package/dist/{defer-CxjvJXD_.js.map → defer-DP7dMS2y.js.map} +1 -1
  6. package/dist/{devtools-BdB_9WB8.js → devtools-BJB_MMeL.js} +4 -4
  7. package/dist/{devtools-BdB_9WB8.js.map → devtools-BJB_MMeL.js.map} +1 -1
  8. package/dist/{devtools-panel-Bp6LE4nM.js → devtools-panel-CUV6A4ZE.js} +2 -2
  9. package/dist/{devtools-panel-Bp6LE4nM.js.map → devtools-panel-CUV6A4ZE.js.map} +1 -1
  10. package/dist/{files-BzVNgGOL.js → files-BZRjz9Mx.js} +2 -2
  11. package/dist/{files-BzVNgGOL.js.map → files-BZRjz9Mx.js.map} +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/{inspect-DaZtoKgg.js → inspect-BLOdfj7o.js} +17 -6
  14. package/dist/inspect-BLOdfj7o.js.map +1 -0
  15. package/dist/{loader-BX8uIUav.js → loader-CheV6t0N.js} +2 -2
  16. package/dist/{loader-BX8uIUav.js.map → loader-CheV6t0N.js.map} +1 -1
  17. package/dist/{rpc-t5M5dqs9.js → rpc-DvTwGfL_.js} +3 -3
  18. package/dist/{rpc-t5M5dqs9.js.map → rpc-DvTwGfL_.js.map} +1 -1
  19. package/dist/runtime/client.js +1 -1
  20. package/dist/runtime/devtools.js +1 -1
  21. package/dist/runtime/loader.js +2 -2
  22. package/dist/runtime/server.js +1 -1
  23. package/dist/runtime/static-loader.js +1 -1
  24. package/dist/runtime/testing.js +2 -2
  25. package/dist/{server-C6c-GXF4.js → server-O_rC-RRL.js} +2 -2
  26. package/dist/{server-C6c-GXF4.js.map → server-O_rC-RRL.js.map} +1 -1
  27. package/dist/{static-loader-CqQRu-p9.js → static-loader-BLJYvTKc.js} +2 -2
  28. package/dist/{static-loader-CqQRu-p9.js.map → static-loader-BLJYvTKc.js.map} +1 -1
  29. package/dist/{stream-CqhuQJwK.js → stream-JGRPr7u5.js} +27 -3
  30. package/dist/stream-JGRPr7u5.js.map +1 -0
  31. package/dist/vite.js +2 -2
  32. package/package.json +1 -1
  33. package/skills/brumate/references/errors.md +20 -0
  34. package/dist/client-Cwr2AfP4.js.map +0 -1
  35. package/dist/inspect-DaZtoKgg.js.map +0 -1
  36. package/dist/stream-CqhuQJwK.js.map +0 -1
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { B as getLocation, H as findError, j as analyzeProjectProps, o as CompileError, r as inspect, s as compile, w as resolveFromDisk, z as BrumateError } from "./inspect-DaZtoKgg.js";
3
- import { h as findPackages, o as findPackageServerFile, s as findServerImport, t as collectSources, v as resolveComponentPackage } from "./files-BzVNgGOL.js";
2
+ import { B as getLocation, H as findError, j as analyzeProjectProps, o as CompileError, r as inspect, s as compile, w as resolveFromDisk, z as BrumateError } from "./inspect-BLOdfj7o.js";
3
+ import { h as findPackages, o as findPackageServerFile, s as findServerImport, t as collectSources, v as resolveComponentPackage } from "./files-BZRjz9Mx.js";
4
4
  import { createRequire } from "node:module";
5
5
  import { existsSync, readFileSync } from "node:fs";
6
6
  import { cp } from "node:fs/promises";
@@ -967,9 +967,13 @@ function fail(scope, error) {
967
967
  const entry = module?.t?.[current.k];
968
968
  if (!entry) continue;
969
969
  let owner = current.p;
970
- while (owner && owner.k !== entry[0]) owner = owner.p;
970
+ let body = current;
971
+ while (owner && owner.k !== entry[0]) {
972
+ body = owner;
973
+ owner = owner.p;
974
+ }
971
975
  if (owner) {
972
- await catchInto(owner, module, entry, error);
976
+ await catchInto(owner, body, module, entry, error);
973
977
  return;
974
978
  }
975
979
  }
@@ -1006,9 +1010,12 @@ function failBoundary(error) {
1006
1010
  options.onError?.(error, {});
1007
1011
  unhandled(error);
1008
1012
  }
1009
- /** Renders the `#catch` body of a `#try` with an error, in place of what the block shows. */
1010
- async function catchInto(owner, module, [, anchor, , fallback, kinds, holderKind, holderAnchor], error) {
1013
+ /**
1014
+ * Renders the `#catch` body of a `#try` with an error, in place of `body`, the body that failed.
1015
+ */
1016
+ async function catchInto(owner, body, module, [, anchor, , fallback, kinds, holderKind, holderAnchor], error) {
1011
1017
  const updates = await loadPart(module, "update");
1018
+ if (scopes.get(body.id) !== body) return;
1012
1019
  const start = blockStart(owner, anchor);
1013
1020
  if (!start) return;
1014
1021
  const end = rangeEnd(start);
@@ -1548,7 +1555,7 @@ function queue(fn, name, target) {
1548
1555
  if (!failed && scopes.get(target.id) === target) try {
1549
1556
  if (stuck) {
1550
1557
  failed = true;
1551
- throw new Error(DEV ? "The updates of a write did not settle after 10000 rounds. An update writes a value that it reads, such as through ref=$bind." : "Update loop");
1558
+ throw new Error(DEV ? `The ${name[0] === "e" ? "effect" : "update"} ${name} of ${findRoot(target).m} did not settle: it writes a value that it reads, and runs again without end. Wrap the read or the write in $untrack, or write only when the value changes [BRM187]` : `Update loop ${key} [BRM187]`);
1552
1559
  }
1553
1560
  const before = origin;
1554
1561
  origin = from;
@@ -1638,10 +1645,12 @@ function drain() {
1638
1645
  function flushEffects() {
1639
1646
  if (flushing) return;
1640
1647
  flushing = true;
1648
+ let rounds = 0;
1641
1649
  try {
1642
1650
  while (pendingEffects.size > 0) {
1643
1651
  const run = [...pendingEffects.values()];
1644
1652
  pendingEffects.clear();
1653
+ if (stuck = ++rounds > 1e3) rounds = 0;
1645
1654
  pass(() => {
1646
1655
  for (const runEffect of run) runEffect();
1647
1656
  });
@@ -1983,12 +1992,12 @@ function action(name, id, method, result) {
1983
1992
  * call loads, so the core holds only this.
1984
1993
  */
1985
1994
  function submitAction(form, submitter) {
1986
- import("./rpc-t5M5dqs9.js").then((module) => module.sendAction(form, submitter));
1995
+ import("./rpc-DvTwGfL_.js").then((module) => module.sendAction(form, submitter));
1987
1996
  }
1988
1997
  /** Calls a server function. */
1989
1998
  async function rpc(id, args) {
1990
1999
  const signal = memoSignal();
1991
- return track(import("./rpc-t5M5dqs9.js").then((module) => module.call(rpcPrefix, id, args, signal)));
2000
+ return track(import("./rpc-DvTwGfL_.js").then((module) => module.call(rpcPrefix, id, args, signal)));
1992
2001
  }
1993
2002
  /** A function prop rendered on the client calls the parent's exported handler. */
1994
2003
  function handlerProp(value, ref, scope, bound = [], modifiers) {
@@ -3558,4 +3567,4 @@ const loader = {
3558
3567
  //#endregion
3559
3568
  export { dispose as $, scopes as $t, branchNodes as A, timed as At, putText as B, descendants as Bt, dynamicNodes as C, effect as Ct, setItem as D, pending as Dt, place as E, memo as Et, keep as F, children as Ft, setSpread as G, sink as Gt, setAttrText as H, makeId as Ht, keepText as I, insert as It, fill as J, nameComment as Jt, template as K, loadModule as Kt, listNodes as L, title as Lt, fillBranch as M, update as Mt, fillList as N, updated as Nt, setSlots as O, resolve as Ot, fillSettled as P, fail as Pt, retag as Q, rpcPrefix as Qt, markBlock as R, afterInsert as Rt, dynamic as S, cells as St, foreignNodes as T, isBound as Tt, setContent as U, removeScope as Ut, setAttr as V, getScope as Vt, setOn as W, setOwner as Wt, rekey as X, build as Xt, offscreen as Y, DEVTOOLS as Yt, reset as Z, hooks as Zt, writeText as _, updateContext as _t, deferInBrowser as a, removeRoot as at, component as b, binding as bt, toList as c, handlerProp as ct, attr as d, submitAction as dt, skew as en, forget as et, attrs as f, guess as ft, text as g, setGlobal as gt, restRef as h, provideValue as ht, addStyle as i, remount as it, clone as j, unreadMemo as jt, appendText as k, set as kt, windowList as l, rpc as lt, portalTo as m, consumeContext as mt, addHead as n, leavePage as nt, setVar as o, action as ot, content as p, track as pt, branch as q, loadPart as qt, addPortal as r, leaveRoutes as rt, list as s, handle as st, loader as t, init as tt, windowStart as u, spread as ut, prop as v, updateRoute as vt, elementAt as w, get as wt, componentNodes as x, bindings as xt, spreadProps as y, asyncMemo as yt, nodes as z, createScope as zt };
3560
3569
 
3561
- //# sourceMappingURL=client-Cwr2AfP4.js.map
3570
+ //# sourceMappingURL=client-iZ9a1Nut.js.map