@fluixi/devtools 1.0.0-alpha.108 → 1.0.0-alpha.110

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 (83) hide show
  1. package/dist/callsite.mjs +4 -63
  2. package/dist/change-view.mjs +6 -106
  3. package/dist/chunk-235BSS43.mjs +185 -0
  4. package/dist/chunk-2ACSNLS6.mjs +87 -0
  5. package/dist/chunk-2VDMQ3VF.mjs +520 -0
  6. package/dist/chunk-33U2S43X.mjs +121 -0
  7. package/dist/chunk-B3SAJ7QG.mjs +72 -0
  8. package/dist/chunk-BTCWJTXR.mjs +216 -0
  9. package/dist/chunk-CPZWLBCQ.mjs +35 -0
  10. package/dist/chunk-D25KZZBZ.mjs +212 -0
  11. package/dist/chunk-EBSROPWJ.mjs +314 -0
  12. package/dist/chunk-F664XLZL.mjs +743 -0
  13. package/dist/chunk-FY5K3QVT.mjs +35 -0
  14. package/dist/chunk-GDQXCOQB.mjs +43 -0
  15. package/dist/chunk-JLNWT36I.mjs +118 -0
  16. package/dist/chunk-JTHAZJJZ.mjs +780 -0
  17. package/dist/chunk-L6XQGNMW.mjs +106 -0
  18. package/dist/chunk-MN6O673L.mjs +90 -0
  19. package/dist/chunk-NDUBBBNL.mjs +70 -0
  20. package/dist/chunk-NT7YMK77.mjs +157 -0
  21. package/dist/chunk-NVULLJDH.mjs +120 -0
  22. package/dist/chunk-NWLSDERQ.mjs +68 -0
  23. package/dist/chunk-OPIGF5XB.mjs +184 -0
  24. package/dist/chunk-P5I7DWFX.mjs +292 -0
  25. package/dist/chunk-PSSBFXBD.mjs +155 -0
  26. package/dist/chunk-PTQ5VCYE.mjs +103 -0
  27. package/dist/chunk-UAEJ3N7F.mjs +76 -0
  28. package/dist/chunk-V6DKWEYD.mjs +67 -0
  29. package/dist/chunk-VO2V7AC5.mjs +80 -0
  30. package/dist/chunk-WGQH7RUW.mjs +25 -0
  31. package/dist/chunk-Z6KYHEKY.mjs +64 -0
  32. package/dist/copy.mjs +3 -39
  33. package/dist/describe.mjs +3 -31
  34. package/dist/detail-panel.cjs +2 -1
  35. package/dist/detail-panel.d.ts.map +1 -1
  36. package/dist/detail-panel.js +1 -0
  37. package/dist/detail-panel.mjs +6 -280
  38. package/dist/diff.mjs +4 -201
  39. package/dist/dom.mjs +7 -176
  40. package/dist/export.mjs +6 -207
  41. package/dist/float.mjs +5 -206
  42. package/dist/format.mjs +5 -151
  43. package/dist/graph-view.mjs +9 -875
  44. package/dist/highlight.mjs +6 -113
  45. package/dist/history.cjs +14 -2
  46. package/dist/history.d.ts +8 -1
  47. package/dist/history.d.ts.map +1 -1
  48. package/dist/history.js +15 -2
  49. package/dist/history.mjs +4 -70
  50. package/dist/hook.cjs +26 -1
  51. package/dist/hook.d.ts +4 -0
  52. package/dist/hook.d.ts.map +1 -1
  53. package/dist/hook.js +13 -0
  54. package/dist/hook.mjs +16 -1719
  55. package/dist/index.cjs +34 -5
  56. package/dist/index.mjs +106 -4673
  57. package/dist/inspector.mjs +11 -677
  58. package/dist/instrument.mjs +9 -486
  59. package/dist/kind-filter.mjs +6 -148
  60. package/dist/menu.mjs +4 -116
  61. package/dist/observe.cjs +15 -1
  62. package/dist/observe.d.ts +2 -0
  63. package/dist/observe.d.ts.map +1 -1
  64. package/dist/observe.js +3 -0
  65. package/dist/observe.mjs +14 -1510
  66. package/dist/palette.mjs +6 -28
  67. package/dist/path.mjs +3 -21
  68. package/dist/plugin.mjs +9 -57
  69. package/dist/plugins/context.mjs +6 -71
  70. package/dist/plugins/directives.mjs +8 -68
  71. package/dist/plugins/index.cjs +1 -1
  72. package/dist/plugins/index.mjs +13 -136
  73. package/dist/source.mjs +12 -93
  74. package/dist/timeline.cjs +5 -2
  75. package/dist/timeline.d.ts.map +1 -1
  76. package/dist/timeline.js +5 -1
  77. package/dist/timeline.mjs +7 -323
  78. package/dist/tree.mjs +11 -558
  79. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  80. package/dist/value-pane.mjs +6 -196
  81. package/dist/wire.cjs +1 -1
  82. package/dist/wire.mjs +6 -86
  83. package/package.json +3 -3
package/dist/export.mjs CHANGED
@@ -1,211 +1,10 @@
1
- // src/instrument.ts
2
1
  import {
3
- createSignal,
4
- createMemo,
5
- createEffect,
6
- createResource,
7
- createRoot,
8
- untrack,
9
- onCleanup,
10
- getOwner,
11
- runWithOwner,
12
- Signal
13
- } from "@fluixi/reactive/signal";
14
- import { createStore } from "@fluixi/reactive/store";
15
-
16
- // src/source.ts
17
- var MARKS = "__FLUIXI_DEVTOOLS_MARKS__";
18
- var host = globalThis;
19
- var shared = host[MARKS] ?? {
20
- pending: null,
21
- expiring: false,
22
- components: /* @__PURE__ */ new Map()
23
- };
24
- host[MARKS] = shared;
25
- shared.classes ??= /* @__PURE__ */ new WeakMap();
26
-
27
- // src/format.ts
28
- var MAX_DEPTH = 3;
29
- var MAX_ENTRIES = 8;
30
- function domName(v) {
31
- if (typeof v?.nodeType !== "number" || typeof v.nodeName !== "string") return null;
32
- return v.tagName ? `<${v.tagName.toLowerCase()}>` : `#${v.nodeName.toLowerCase()}`;
33
- }
34
- function fnName(v) {
35
- return v.name ? `ƒ ${v.name}()` : "ƒ";
36
- }
37
- function className(v) {
38
- const name = v.constructor?.name;
39
- return name && name !== "Object" ? `${name} ` : "";
40
- }
41
- function primitive(v) {
42
- if (v === null) return "null";
43
- switch (typeof v) {
44
- case "undefined":
45
- return "undefined";
46
- case "string":
47
- return JSON.stringify(v);
48
- case "number":
49
- case "boolean":
50
- return String(v);
51
- case "bigint":
52
- return `${v}n`;
53
- case "symbol":
54
- return v.toString();
55
- case "function":
56
- return fnName(v);
57
- default:
58
- return null;
59
- }
60
- }
61
- function walk(value, depth, seen) {
62
- const simple = primitive(value);
63
- if (simple !== null) return simple;
64
- const object = value;
65
- if (seen.has(object)) return "[circular]";
66
- const dom = domName(object);
67
- if (dom) return dom;
68
- if (object instanceof Date) return Number.isNaN(object.getTime()) ? "Invalid Date" : object.toISOString();
69
- if (object instanceof RegExp) return String(object);
70
- if (object instanceof Error) return `${object.name}: ${object.message}`;
71
- if (object instanceof Promise) return "Promise";
72
- if (ArrayBuffer.isView(object)) {
73
- return `${className(object).trim()}(${object.length ?? ""})`;
74
- }
75
- if (depth >= MAX_DEPTH) return Array.isArray(object) ? "[…]" : "{…}";
76
- seen.add(object);
77
- try {
78
- if (Array.isArray(object)) {
79
- const shown2 = object.slice(0, MAX_ENTRIES).map((item) => walk(item, depth + 1, seen));
80
- if (object.length > MAX_ENTRIES) shown2.push("…");
81
- return `[${shown2.join(", ")}]`;
82
- }
83
- if (object instanceof Map) {
84
- const shown2 = [];
85
- for (const [k, v] of object) {
86
- if (shown2.length === MAX_ENTRIES) {
87
- shown2.push("…");
88
- break;
89
- }
90
- shown2.push(`${walk(k, depth + 1, seen)} => ${walk(v, depth + 1, seen)}`);
91
- }
92
- return `Map(${object.size}) {${shown2.join(", ")}}`;
93
- }
94
- if (object instanceof Set) {
95
- const shown2 = [];
96
- for (const item of object) {
97
- if (shown2.length === MAX_ENTRIES) {
98
- shown2.push("…");
99
- break;
100
- }
101
- shown2.push(walk(item, depth + 1, seen));
102
- }
103
- return `Set(${object.size}) {${shown2.join(", ")}}`;
104
- }
105
- const keys = Object.keys(object);
106
- const shown = keys.slice(0, MAX_ENTRIES).map((key) => {
107
- let read;
108
- try {
109
- const descriptor = Object.getOwnPropertyDescriptor(object, key);
110
- if (descriptor?.get) return `${key}: [getter]`;
111
- read = walk(object[key], depth + 1, seen);
112
- } catch {
113
- read = "[unreadable]";
114
- }
115
- return `${key}: ${read}`;
116
- });
117
- if (keys.length > MAX_ENTRIES) shown.push("…");
118
- return `${className(object)}{${shown.join(", ")}}`;
119
- } finally {
120
- seen.delete(object);
121
- }
122
- }
123
- function formatValue(value, limit = 240) {
124
- let text;
125
- try {
126
- text = walk(value, 0, /* @__PURE__ */ new Set());
127
- } catch {
128
- text = "[unreadable]";
129
- }
130
- return text.length > limit ? `${text.slice(0, limit - 1)}…` : text;
131
- }
132
-
133
- // src/instrument.ts
134
- var CORE_STATE = { 0: "clean", 1: "check", 2: "dirty" };
135
- function nodeVersion(n) {
136
- return n.core && typeof n.core.version === "number" ? n.core.version : n.runs;
137
- }
138
- function nodeState(n) {
139
- return n.core && typeof n.core.state === "number" ? CORE_STATE[n.core.state] : void 0;
140
- }
141
-
142
- // src/export.ts
143
- var at = (source) => {
144
- if (!source) return void 0;
145
- const where = `${source.file ?? ""}:${source.line ?? ""}:${source.column ?? ""}`;
146
- const out = source.compiled;
147
- const same = out?.line === source.line && out?.column === source.column;
148
- return out && !same ? `${where} (out ${out.line ?? ""}:${out.column ?? ""})` : where;
149
- };
150
- function naming(graph) {
151
- const seen = /* @__PURE__ */ new Map();
152
- for (const node of graph.values()) seen.set(node.label, (seen.get(node.label) ?? 0) + 1);
153
- return (id) => {
154
- const node = graph.get(id);
155
- if (!node) return `#${id}`;
156
- return (seen.get(node.label) ?? 0) > 1 ? `${node.label}#${node.id}` : node.label;
157
- };
158
- }
159
- function exportGraph(graph, options = {}) {
160
- const limit = options.limit ?? 400;
161
- const name = naming(graph);
162
- const nodes = [...graph.values()].map((node) => {
163
- let value = node.detail ?? node.value;
164
- if (node.read) {
165
- try {
166
- value = formatValue(node.read(), limit);
167
- } catch {
168
- }
169
- }
170
- const feeds = [...node.deps].map(name);
171
- const wrote = [...node.writes].map(name);
172
- const state = nodeState(node);
173
- return {
174
- id: node.id,
175
- label: node.label,
176
- kind: node.kind,
177
- ...node.authored === false ? { authored: false } : {},
178
- ...value ? { value } : {},
179
- ...node.runs ? { runs: node.runs } : {},
180
- // Only a node with a core has one; a static node would report a version of 0.
181
- ...node.core?.version !== void 0 ? { version: nodeVersion(node) } : {},
182
- ...state ? { state } : {},
183
- ...feeds.length ? { reads: feeds } : {},
184
- ...wrote.length ? { writes: wrote } : {},
185
- ...node.createdIn !== void 0 ? { madeIn: name(node.createdIn) } : {},
186
- ...at(node.source) ? { source: at(node.source) } : {},
187
- ...at(node.declaredAt) ? { declaredAt: at(node.declaredAt) } : {},
188
- ...at(node.usedAt) ? { usedAt: at(node.usedAt) } : {},
189
- ...node.targets?.length ? {
190
- updates: node.targets.map((target) => {
191
- const what = target.name ? `${target.name} of ${target.element}` : target.element;
192
- const where = at(target.source);
193
- return where ? `${what} — ${where}` : what;
194
- })
195
- } : {},
196
- ...node.setAt?.length ? { setAt: node.setAt.map((s) => at(s)).filter(Boolean) } : {}
197
- };
198
- });
199
- return {
200
- t: Date.now(),
201
- from: options.fromSource ? "source" : "running application",
202
- nodes,
203
- ...options.events?.length ? { events: [...options.events] } : {}
204
- };
205
- }
206
- function graphToJson(graph, options = {}) {
207
- return JSON.stringify(exportGraph(graph, options), null, 2);
208
- }
2
+ exportGraph,
3
+ graphToJson
4
+ } from "./chunk-VO2V7AC5.mjs";
5
+ import "./chunk-EBSROPWJ.mjs";
6
+ import "./chunk-L6XQGNMW.mjs";
7
+ import "./chunk-NT7YMK77.mjs";
209
8
  export {
210
9
  exportGraph,
211
10
  graphToJson
package/dist/float.mjs CHANGED
@@ -1,209 +1,8 @@
1
- // src/float.ts
2
- var MIN_W = 240;
3
- var MIN_H = 160;
4
- function draggable(handle, onMove, onStart) {
5
- handle.addEventListener("pointerdown", (event) => {
6
- if (event.button !== 0) return;
7
- if (event.target.closest("button")) return;
8
- event.preventDefault();
9
- handle.setPointerCapture(event.pointerId);
10
- const fromX = event.clientX;
11
- const fromY = event.clientY;
12
- onStart?.();
13
- const move = (e) => onMove(e.clientX - fromX, e.clientY - fromY);
14
- const stop = () => {
15
- handle.removeEventListener("pointermove", move);
16
- handle.removeEventListener("pointerup", stop);
17
- handle.removeEventListener("pointercancel", stop);
18
- handle.removeEventListener("lostpointercapture", stop);
19
- if (handle.hasPointerCapture(event.pointerId)) handle.releasePointerCapture(event.pointerId);
20
- };
21
- handle.addEventListener("pointermove", move);
22
- handle.addEventListener("pointerup", stop);
23
- handle.addEventListener("pointercancel", stop);
24
- handle.addEventListener("lostpointercapture", stop);
25
- });
26
- }
27
- var opened = 0;
28
- function floatCard(doc, title, at) {
29
- const card = doc.createElement("div");
30
- card.className = "fx-float";
31
- const spot = at ?? {
32
- x: 60 + opened % 4 * 28,
33
- y: 60 + opened % 4 * 28,
34
- width: 360,
35
- height: 280
36
- };
37
- opened += 1;
38
- const bar = doc.createElement("div");
39
- bar.className = "fx-float-bar";
40
- const name = doc.createElement("span");
41
- name.textContent = title;
42
- bar.append(name);
43
- card.append(bar);
44
- let x = spot.x;
45
- let y = spot.y;
46
- let w = spot.width;
47
- let h = spot.height;
48
- const apply = () => {
49
- const view = doc.defaultView;
50
- const vw = view?.innerWidth ?? w;
51
- const vh = view?.innerHeight ?? h;
52
- w = Math.min(Math.max(MIN_W, w), vw);
53
- h = Math.min(Math.max(MIN_H, h), vh);
54
- x = Math.min(Math.max(0, x), Math.max(0, vw - w));
55
- y = Math.min(Math.max(0, y), Math.max(0, vh - h));
56
- card.style.left = `${x}px`;
57
- card.style.top = `${y}px`;
58
- card.style.width = `${w}px`;
59
- card.style.height = `${h}px`;
60
- };
61
- let from = { x, y, w, h };
62
- const remember = () => {
63
- from = { x, y, w, h };
64
- };
65
- for (const edge of ["n", "s", "e", "w", "ne", "nw", "se", "sw"]) {
66
- const handle = doc.createElement("div");
67
- handle.className = `fx-float-h fx-float-${edge}`;
68
- card.append(handle);
69
- draggable(
70
- handle,
71
- (dx, dy) => {
72
- if (edge.includes("e")) w = from.w + dx;
73
- if (edge.includes("s")) h = from.h + dy;
74
- if (edge.includes("w")) {
75
- w = Math.max(MIN_W, from.w - dx);
76
- x = from.x + from.w - w;
77
- }
78
- if (edge.includes("n")) {
79
- h = Math.max(MIN_H, from.h - dy);
80
- y = from.y + from.h - h;
81
- }
82
- apply();
83
- },
84
- remember
85
- );
86
- }
87
- draggable(
88
- bar,
89
- (dx, dy) => {
90
- x = from.x + dx;
91
- y = from.y + dy;
92
- apply();
93
- },
94
- remember
95
- );
96
- apply();
97
- return { card, bar, remove: () => card.remove() };
98
- }
99
- function makeFloatable(pane, options) {
100
- const doc = pane.ownerDocument;
101
- let card = null;
102
- let home = null;
103
- const button = doc.createElement("button");
104
- button.type = "button";
105
- button.className = "fx-float-btn";
106
- button.textContent = "⇱";
107
- button.title = `Float ${options.title}`;
108
- pane.classList.add("fx-floatable");
109
- pane.append(button);
110
- const keep = new MutationObserver(() => {
111
- if (button.parentNode !== pane) pane.append(button);
112
- });
113
- keep.observe(pane, { childList: true });
114
- function dock() {
115
- if (!card || !home) return;
116
- home.parent.insertBefore(pane, home.before);
117
- card.remove();
118
- card = null;
119
- home = null;
120
- pane.classList.remove("fx-floated");
121
- button.textContent = "⇱";
122
- button.title = `Float ${options.title}`;
123
- options.onChange?.(false);
124
- }
125
- function float() {
126
- if (card || !pane.parentNode) return;
127
- home = { parent: pane.parentNode, before: pane.nextSibling };
128
- const built = floatCard(doc, options.title, options.at);
129
- card = built.card;
130
- card.append(pane);
131
- doc.body.appendChild(card);
132
- pane.classList.add("fx-floated");
133
- button.textContent = "⇲";
134
- button.title = `Put ${options.title} back`;
135
- options.onChange?.(true);
136
- }
137
- button.addEventListener("click", (event) => {
138
- event.stopPropagation();
139
- if (card) dock();
140
- else float();
141
- });
142
- return {
143
- get floating() {
144
- return card !== null;
145
- },
146
- toggle() {
147
- if (card) dock();
148
- else float();
149
- return card !== null;
150
- },
151
- dock,
152
- destroy() {
153
- keep.disconnect();
154
- dock();
155
- button.remove();
156
- pane.classList.remove("fx-floatable");
157
- }
158
- };
159
- }
160
- var FLOAT_CSS = `
161
- .fx-floatable { position: relative; }
162
- .fx-float-btn {
163
- position: absolute; top: 2px; right: 2px; z-index: 5;
164
- width: 18px; height: 18px; padding: 0; line-height: 1;
165
- font-size: 11px; color: var(--fx-muted, #8a90a2);
166
- background: var(--fx-panel, #14161c);
167
- border: 1px solid var(--fx-line, #262a35); border-radius: 4px;
168
- cursor: pointer; opacity: 0; transition: opacity .12s;
169
- }
170
- .fx-floatable:hover .fx-float-btn, .fx-float-btn:focus-visible { opacity: 1; }
171
- .fx-float-btn:hover { color: var(--fx-accent, #5eead4); border-color: var(--fx-accent, #5eead4); }
172
-
173
- .fx-float {
174
- position: fixed; z-index: 60; display: flex; flex-direction: column;
175
- background: var(--fx-panel, #14161c);
176
- border: 1px solid var(--fx-line, #262a35); border-radius: 8px;
177
- box-shadow: 0 12px 34px rgba(0, 0, 0, .5); overflow: hidden;
178
- }
179
- .fx-float-bar {
180
- display: flex; align-items: center; padding: 4px 8px; cursor: move;
181
- font-size: 11px; color: var(--fx-muted, #8a90a2);
182
- background: var(--fx-bg, #0f1115); border-bottom: 1px solid var(--fx-line, #262a35);
183
- user-select: none;
184
- }
185
- /* The pane fills the card, whatever it was sized to in the layout it came from. */
186
- .fx-float > .fx-floated {
187
- flex: 1; min-height: 0; width: auto; height: auto; overflow: auto;
188
- }
189
- /* Edges and corners. Thin, and over everything, so a card can be resized from whichever
190
- side is reachable. */
191
- .fx-float-h { position: absolute; z-index: 1; }
192
- .fx-float-n, .fx-float-s { left: 8px; right: 8px; height: 6px; cursor: ns-resize; }
193
- .fx-float-e, .fx-float-w { top: 8px; bottom: 8px; width: 6px; cursor: ew-resize; }
194
- .fx-float-n { top: -3px; }
195
- .fx-float-s { bottom: -3px; }
196
- .fx-float-e { right: -3px; }
197
- .fx-float-w { left: -3px; }
198
- .fx-float-ne, .fx-float-nw, .fx-float-se, .fx-float-sw { width: 14px; height: 14px; }
199
- .fx-float-nw { top: -3px; left: -3px; cursor: nwse-resize; }
200
- .fx-float-ne { top: -3px; right: -3px; cursor: nesw-resize; }
201
- .fx-float-sw { bottom: -3px; left: -3px; cursor: nesw-resize; }
202
- .fx-float-se {
203
- bottom: 0; right: 0; cursor: nwse-resize;
204
- background: linear-gradient(135deg, transparent 50%, var(--fx-line, #262a35) 50%);
205
- }
206
- `;
1
+ import {
2
+ FLOAT_CSS,
3
+ floatCard,
4
+ makeFloatable
5
+ } from "./chunk-D25KZZBZ.mjs";
207
6
  export {
208
7
  FLOAT_CSS,
209
8
  floatCard,
package/dist/format.mjs CHANGED
@@ -1,154 +1,8 @@
1
- // src/format.ts
2
- var MAX_DEPTH = 3;
3
- var MAX_ENTRIES = 8;
4
- function domName(v) {
5
- if (typeof v?.nodeType !== "number" || typeof v.nodeName !== "string") return null;
6
- return v.tagName ? `<${v.tagName.toLowerCase()}>` : `#${v.nodeName.toLowerCase()}`;
7
- }
8
- function fnName(v) {
9
- return v.name ? `ƒ ${v.name}()` : "ƒ";
10
- }
11
- function className(v) {
12
- const name = v.constructor?.name;
13
- return name && name !== "Object" ? `${name} ` : "";
14
- }
15
- function primitive(v) {
16
- if (v === null) return "null";
17
- switch (typeof v) {
18
- case "undefined":
19
- return "undefined";
20
- case "string":
21
- return JSON.stringify(v);
22
- case "number":
23
- case "boolean":
24
- return String(v);
25
- case "bigint":
26
- return `${v}n`;
27
- case "symbol":
28
- return v.toString();
29
- case "function":
30
- return fnName(v);
31
- default:
32
- return null;
33
- }
34
- }
35
- function walk(value, depth, seen) {
36
- const simple = primitive(value);
37
- if (simple !== null) return simple;
38
- const object = value;
39
- if (seen.has(object)) return "[circular]";
40
- const dom = domName(object);
41
- if (dom) return dom;
42
- if (object instanceof Date) return Number.isNaN(object.getTime()) ? "Invalid Date" : object.toISOString();
43
- if (object instanceof RegExp) return String(object);
44
- if (object instanceof Error) return `${object.name}: ${object.message}`;
45
- if (object instanceof Promise) return "Promise";
46
- if (ArrayBuffer.isView(object)) {
47
- return `${className(object).trim()}(${object.length ?? ""})`;
48
- }
49
- if (depth >= MAX_DEPTH) return Array.isArray(object) ? "[…]" : "{…}";
50
- seen.add(object);
51
- try {
52
- if (Array.isArray(object)) {
53
- const shown2 = object.slice(0, MAX_ENTRIES).map((item) => walk(item, depth + 1, seen));
54
- if (object.length > MAX_ENTRIES) shown2.push("…");
55
- return `[${shown2.join(", ")}]`;
56
- }
57
- if (object instanceof Map) {
58
- const shown2 = [];
59
- for (const [k, v] of object) {
60
- if (shown2.length === MAX_ENTRIES) {
61
- shown2.push("…");
62
- break;
63
- }
64
- shown2.push(`${walk(k, depth + 1, seen)} => ${walk(v, depth + 1, seen)}`);
65
- }
66
- return `Map(${object.size}) {${shown2.join(", ")}}`;
67
- }
68
- if (object instanceof Set) {
69
- const shown2 = [];
70
- for (const item of object) {
71
- if (shown2.length === MAX_ENTRIES) {
72
- shown2.push("…");
73
- break;
74
- }
75
- shown2.push(walk(item, depth + 1, seen));
76
- }
77
- return `Set(${object.size}) {${shown2.join(", ")}}`;
78
- }
79
- const keys = Object.keys(object);
80
- const shown = keys.slice(0, MAX_ENTRIES).map((key) => {
81
- let read;
82
- try {
83
- const descriptor = Object.getOwnPropertyDescriptor(object, key);
84
- if (descriptor?.get) return `${key}: [getter]`;
85
- read = walk(object[key], depth + 1, seen);
86
- } catch {
87
- read = "[unreadable]";
88
- }
89
- return `${key}: ${read}`;
90
- });
91
- if (keys.length > MAX_ENTRIES) shown.push("…");
92
- return `${className(object)}{${shown.join(", ")}}`;
93
- } finally {
94
- seen.delete(object);
95
- }
96
- }
97
- function formatValue(value, limit = 240) {
98
- let text;
99
- try {
100
- text = walk(value, 0, /* @__PURE__ */ new Set());
101
- } catch {
102
- text = "[unreadable]";
103
- }
104
- return text.length > limit ? `${text.slice(0, limit - 1)}…` : text;
105
- }
106
- function shorten(text, limit = 18) {
107
- return text.length > limit ? `${text.slice(0, limit - 1)}…` : text;
108
- }
109
- function indentValue(text, pad = " ") {
110
- const out = [];
111
- let depth = 0;
112
- let quote = null;
113
- let line = "";
114
- const flush = () => {
115
- if (line.trim()) out.push(pad.repeat(depth) + line.trim());
116
- line = "";
117
- };
118
- for (let i = 0; i < text.length; i++) {
119
- const c = text[i];
120
- if (quote) {
121
- line += c;
122
- if (c === quote && text[i - 1] !== "\\") quote = null;
123
- continue;
124
- }
125
- if (c === '"' || c === "'") {
126
- quote = c;
127
- line += c;
128
- continue;
129
- }
130
- if (c === "{" || c === "[") {
131
- line += c;
132
- flush();
133
- depth++;
134
- continue;
135
- }
136
- if (c === "}" || c === "]") {
137
- flush();
138
- depth = Math.max(0, depth - 1);
139
- line = c;
140
- continue;
141
- }
142
- if (c === ",") {
143
- line += c;
144
- flush();
145
- continue;
146
- }
147
- line += c;
148
- }
149
- flush();
150
- return out.join("\n");
151
- }
1
+ import {
2
+ formatValue,
3
+ indentValue,
4
+ shorten
5
+ } from "./chunk-NT7YMK77.mjs";
152
6
  export {
153
7
  formatValue,
154
8
  indentValue,