@vobs/devtools 1.2.1 → 1.2.2

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.
package/dist/index.cjs CHANGED
@@ -1,285 +1,41 @@
1
- 'use strict';
2
-
3
- require('axios');
4
-
1
+ var __VOBS_CJS_FILE_URL = require("url").pathToFileURL(__filename).href;
2
+ "use strict";
5
3
  var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
7
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
-
8
- // packages/reactivity/src/debug.ts
9
- var activeDebugHooks = null;
10
- var signalNames = /* @__PURE__ */ new WeakMap();
11
- function setDebugHooks(hooks) {
12
- const previous = activeDebugHooks;
13
- activeDebugHooks = hooks;
14
- return previous;
15
- }
16
- __name(setDebugHooks, "setDebugHooks");
17
- function getDebugHooks() {
18
- return activeDebugHooks;
19
- }
20
- __name(getDebugHooks, "getDebugHooks");
21
- function hasDebugHooks() {
22
- return activeDebugHooks !== null;
23
- }
24
- __name(hasDebugHooks, "hasDebugHooks");
25
- function getSignalDebugName(signal) {
26
- return signalNames.get(signal);
27
- }
28
- __name(getSignalDebugName, "getSignalDebugName");
29
- function invokeDebug(name, ...args) {
30
- const callback = activeDebugHooks?.[name];
31
- if (!callback) return;
32
- try {
33
- callback(...args);
34
- } catch {
35
- }
36
- }
37
- __name(invokeDebug, "invokeDebug");
38
-
39
- // packages/reactivity/src/owner.ts
40
- var ownerNames = /* @__PURE__ */ new WeakMap();
41
- function getOwnerDebugName(owner) {
42
- return ownerNames.get(owner);
43
- }
44
- __name(getOwnerDebugName, "getOwnerDebugName");
45
- function untrack(fn) {
46
- try {
47
- return fn();
48
- } finally {
49
- }
50
- }
51
- __name(untrack, "untrack");
52
-
53
- // packages/reactivity/src/scheduler.ts
54
- var _Scheduler = class _Scheduler {
55
- constructor() {
56
- this.dirtyEffects = /* @__PURE__ */ new Set();
57
- this.lowPriorityEffects = /* @__PURE__ */ new Set();
58
- // flush 不可重入(flushing 标志保证),缓冲数组可在轮次间安全复用,避免每轮分配。
59
- this.normalBuffer = [];
60
- this.lowBuffer = [];
61
- this.flushing = false;
62
- this.scheduled = false;
63
- this.batchDepth = 0;
64
- }
65
- schedule(effect2) {
66
- if (effect2.disposed) return;
67
- this.dirtyEffects.add(effect2);
68
- this.lowPriorityEffects.delete(effect2);
69
- this.ensureScheduled();
70
- }
71
- /** Queue an effect behind normal updates while preserving deterministic order. */
72
- scheduleLow(effect2) {
73
- if (effect2.disposed) return;
74
- if (!this.dirtyEffects.has(effect2)) this.lowPriorityEffects.add(effect2);
75
- this.ensureScheduled();
76
- }
77
- ensureScheduled() {
78
- if (this.batchDepth === 0 && !this.flushing && !this.scheduled) {
79
- this.scheduled = true;
80
- queueMicrotask(() => {
81
- this.scheduled = false;
82
- this.flush();
83
- });
84
- }
85
- }
86
- remove(effect2) {
87
- this.dirtyEffects.delete(effect2);
88
- this.lowPriorityEffects.delete(effect2);
89
- }
90
- batch(fn) {
91
- this.batchDepth++;
92
- try {
93
- return fn();
94
- } finally {
95
- this.batchDepth--;
96
- if (this.batchDepth === 0) this.flush();
97
- }
98
- }
99
- flush() {
100
- if (this.flushing || this.batchDepth > 0) return;
101
- this.flushing = true;
102
- const debugEnabled = hasDebugHooks();
103
- if (debugEnabled) invokeDebug("flushStart");
104
- let rounds = 0;
105
- let firstError;
106
- let hasError = false;
107
- try {
108
- while (this.dirtyEffects.size > 0 || this.lowPriorityEffects.size > 0) {
109
- if (++rounds > 100) {
110
- this.dirtyEffects.clear();
111
- this.lowPriorityEffects.clear();
112
- throw new Error("Vobs: \u54CD\u5E94\u5F0F\u66F4\u65B0\u8D85\u8FC7 100 \u8F6E\uFF0C\u53EF\u80FD\u5B58\u5728\u5FAA\u73AF\u4F9D\u8D56");
113
- }
114
- this.collectRunnable(this.dirtyEffects, this.normalBuffer);
115
- this.collectRunnable(this.lowPriorityEffects, this.lowBuffer);
116
- sortEffects(this.normalBuffer);
117
- sortEffects(this.lowBuffer);
118
- for (const effect2 of this.normalBuffer) {
119
- try {
120
- effect2.run();
121
- } catch (error) {
122
- if (!hasError) {
123
- firstError = error;
124
- hasError = true;
125
- }
126
- }
127
- }
128
- for (const effect2 of this.lowBuffer) {
129
- try {
130
- effect2.run();
131
- } catch (error) {
132
- if (!hasError) {
133
- firstError = error;
134
- hasError = true;
135
- }
136
- }
137
- }
138
- this.normalBuffer.length = 0;
139
- this.lowBuffer.length = 0;
140
- }
141
- } finally {
142
- this.normalBuffer.length = 0;
143
- this.lowBuffer.length = 0;
144
- this.flushing = false;
145
- if (debugEnabled) invokeDebug("flushEnd");
146
- }
147
- if (hasError) throw firstError;
148
- }
149
- /** 收集未 disposed 的 effect 并清空源集合;run() 期间新调度的 effect 留给下一轮。 */
150
- collectRunnable(source, target) {
151
- for (const effect2 of source) {
152
- if (!effect2.disposed) target.push(effect2);
153
- }
154
- source.clear();
155
- }
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
156
11
  };
157
- __name(_Scheduler, "Scheduler");
158
- function sortEffects(effects) {
159
- if (effects.length > 1) {
160
- effects.sort((a, b) => b.depth - a.depth || a.order - b.order);
161
- }
162
- }
163
- __name(sortEffects, "sortEffects");
164
-
165
- // packages/runtime/src/debug.ts
166
- var activeRuntimeDebugHooks = null;
167
- var activeRuntimeDebugContext = null;
168
- function setRuntimeDebugHooks(hooks) {
169
- const previous = activeRuntimeDebugHooks;
170
- activeRuntimeDebugHooks = hooks;
171
- return previous;
172
- }
173
- __name(setRuntimeDebugHooks, "setRuntimeDebugHooks");
174
- function getRuntimeDebugHooks() {
175
- return activeRuntimeDebugHooks;
176
- }
177
- __name(getRuntimeDebugHooks, "getRuntimeDebugHooks");
178
- function getRuntimeDebugContext() {
179
- return activeRuntimeDebugContext;
180
- }
181
- __name(getRuntimeDebugContext, "getRuntimeDebugContext");
182
-
183
- // packages/runtime/src/hmr.ts
184
- var globalTarget = globalThis;
185
- var hmrGlobal = globalTarget.__VOBS_HMR__ ?? { modules: /* @__PURE__ */ new Map() };
186
- globalTarget.__VOBS_HMR__ = hmrGlobal;
187
-
188
- // packages/runtime/src/error.ts
189
- var _VobsError = class _VobsError extends Error {
190
- constructor(options) {
191
- super(options.message);
192
- this.name = "VobsError";
193
- this.code = options.code;
194
- this.severity = options.severity ?? "error";
195
- this.layer = options.layer ?? "runtime";
196
- this.cause = options.cause;
197
- this.fix = options.fix;
198
- this.location = options.location;
199
- this.trace = options.trace;
200
- this.example = options.example;
201
- this.docs = options.docs;
202
- this.codeFrame = options.codeFrame;
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
203
17
  }
18
+ return to;
204
19
  };
205
- __name(_VobsError, "VobsError");
206
- var VobsError = _VobsError;
207
- function isVobsError(value) {
208
- return value instanceof VobsError || Boolean(value && typeof value === "object" && typeof value.code === "string" && typeof value.message === "string" && typeof value.layer === "string");
209
- }
210
- __name(isVobsError, "isVobsError");
211
- function normalizeVobsError(value, defaults = {}) {
212
- if (value instanceof VobsError) return value;
213
- if (value instanceof Error) {
214
- const metadata = value;
215
- const code = defaults.code ?? (typeof metadata.vobsCode === "string" ? metadata.vobsCode : void 0);
216
- if (code) defineErrorMetadata(value, "code", code);
217
- defineErrorMetadata(value, "severity", defaults.severity ?? "error");
218
- defineErrorMetadata(value, "layer", defaults.layer ?? "runtime");
219
- const fix = defaults.fix ?? (typeof metadata.vobsHint === "string" ? metadata.vobsHint : void 0);
220
- if (fix) defineErrorMetadata(value, "fix", fix);
221
- const source = metadata.vobsSource;
222
- if (source && typeof source === "object" && typeof source.file === "string" && typeof source.line === "number" && typeof source.column === "number") {
223
- defineErrorMetadata(value, "location", source);
224
- }
225
- return value;
226
- }
227
- if (isVobsError(value)) {
228
- const candidate = value;
229
- return new VobsError({
230
- code: candidate.code,
231
- message: candidate.message,
232
- severity: candidate.severity ?? defaults.severity,
233
- layer: candidate.layer ?? defaults.layer,
234
- cause: candidate.cause,
235
- fix: candidate.fix ?? defaults.fix,
236
- location: candidate.location,
237
- trace: candidate.trace,
238
- example: candidate.example,
239
- docs: candidate.docs,
240
- codeFrame: candidate.codeFrame
241
- });
242
- }
243
- const message = String(value);
244
- return new VobsError({
245
- code: defaults.code ?? "VOBS_UNKNOWN",
246
- message,
247
- severity: defaults.severity ?? "error",
248
- layer: defaults.layer ?? "runtime",
249
- cause: void 0,
250
- fix: defaults.fix
251
- });
252
- }
253
- __name(normalizeVobsError, "normalizeVobsError");
254
- function defineErrorMetadata(target, key, value) {
255
- if (key in target) return;
256
- try {
257
- Object.defineProperty(target, key, { configurable: true, enumerable: false, value, writable: true });
258
- } catch {
259
- }
260
- }
261
- __name(defineErrorMetadata, "defineErrorMetadata");
262
-
263
- // packages/vobs/src/app.ts
264
- function createInjectionKey(description) {
265
- return Symbol(description);
266
- }
267
- __name(createInjectionKey, "createInjectionKey");
268
-
269
- // packages/http/src/debug.ts
270
- var activeHTTPDebugHooks = null;
271
- function setHTTPDebugHooks(hooks) {
272
- const previous = activeHTTPDebugHooks;
273
- activeHTTPDebugHooks = hooks;
274
- return previous;
275
- }
276
- __name(setHTTPDebugHooks, "setHTTPDebugHooks");
277
- function getHTTPDebugHooks() {
278
- return activeHTTPDebugHooks;
279
- }
280
- __name(getHTTPDebugHooks, "getHTTPDebugHooks");
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
281
21
 
282
22
  // packages/devtools/src/index.ts
23
+ var src_exports = {};
24
+ __export(src_exports, {
25
+ DEVTOOLS_EVENTS: () => DEVTOOLS_EVENTS,
26
+ DEVTOOLS_REACTIVITY_EVENTS: () => DEVTOOLS_REACTIVITY_EVENTS,
27
+ connectDevTools: () => connectDevTools,
28
+ createDevTools: () => createDevTools,
29
+ devtoolsPlugin: () => devtoolsPlugin,
30
+ disableDevTools: () => disableDevTools,
31
+ enableDevTools: () => enableDevTools,
32
+ getDevTools: () => getDevTools
33
+ });
34
+ module.exports = __toCommonJS(src_exports);
35
+ var import_reactivity = require("@vobs/reactivity");
36
+ var import_runtime = require("@vobs/runtime");
37
+ var import_runtime2 = require("@vobs/runtime");
38
+ var import_http = require("@vobs/http");
283
39
  var DEVTOOLS_REACTIVITY_EVENTS = [
284
40
  "owner-created",
285
41
  "owner-named",
@@ -407,8 +163,8 @@ function createDevTools(options = {}) {
407
163
  const ownerId = context.ownerId ?? readErrorProperty(error, "vobsOwnerId");
408
164
  const component = context.component ?? readErrorProperty(error, "vobsComponent");
409
165
  const source = context.source ?? debugError.source ?? readErrorProperty(error, "vobsSource");
410
- const activeRoute = context.route ?? getRuntimeDebugContext()?.route ?? routerContext?.route;
411
- const activeNavigationId = context.navigationId ?? getRuntimeDebugContext()?.navigationId ?? routerContext?.navigationId;
166
+ const activeRoute = context.route ?? (0, import_runtime.getRuntimeDebugContext)()?.route ?? routerContext?.route;
167
+ const activeNavigationId = context.navigationId ?? (0, import_runtime.getRuntimeDebugContext)()?.navigationId ?? routerContext?.navigationId;
412
168
  const key = diagnosticErrorKey({ origin, code, name: debugError.name, message: debugError.message, source, component });
413
169
  const previous = errors.get(key);
414
170
  const nowValue = Date.now();
@@ -471,7 +227,7 @@ function createDevTools(options = {}) {
471
227
  owner,
472
228
  id: owner.id,
473
229
  parentId: owner.parent?.id ?? null,
474
- name: getOwnerDebugName(owner) ?? (owner.parent ? "Owner" : "App"),
230
+ name: (0, import_reactivity.getOwnerDebugName)(owner) ?? (owner.parent ? "Owner" : "App"),
475
231
  disposed: owner.disposed
476
232
  };
477
233
  ownerIds.set(owner, record.id);
@@ -523,8 +279,8 @@ function createDevTools(options = {}) {
523
279
  if (existing) return existing;
524
280
  }
525
281
  const id = `signal-${nextId++}`;
526
- const explicitName = getSignalDebugName(signal);
527
- const ownerName = owner ? getOwnerDebugName(owner) : void 0;
282
+ const explicitName = (0, import_reactivity.getSignalDebugName)(signal);
283
+ const ownerName = owner ? (0, import_reactivity.getOwnerDebugName)(owner) : void 0;
528
284
  const record = {
529
285
  signal,
530
286
  id,
@@ -540,15 +296,15 @@ function createDevTools(options = {}) {
540
296
  return record;
541
297
  }
542
298
  __name(ensureSignal, "ensureSignal");
543
- function ensureEffect(effect2, owner = null) {
544
- const existingId = effectIds.get(effect2);
299
+ function ensureEffect(effect, owner = null) {
300
+ const existingId = effectIds.get(effect);
545
301
  if (existingId) {
546
302
  const existing = effects.get(existingId);
547
303
  if (existing) return existing;
548
304
  }
549
305
  const id = `effect-${nextId++}`;
550
306
  const record = {
551
- effect: effect2,
307
+ effect,
552
308
  id,
553
309
  ownerId: owner ? ensureOwner(owner).id : null,
554
310
  status: "dirty",
@@ -560,9 +316,9 @@ function createDevTools(options = {}) {
560
316
  lastError: void 0,
561
317
  lastDomUpdates: 0,
562
318
  runningSince: null,
563
- disposed: effect2.disposed
319
+ disposed: effect.disposed
564
320
  };
565
- effectIds.set(effect2, id);
321
+ effectIds.set(effect, id);
566
322
  effects.set(id, record);
567
323
  return record;
568
324
  }
@@ -578,7 +334,7 @@ function createDevTools(options = {}) {
578
334
  return `${from}->${to}`;
579
335
  }
580
336
  __name(edgeKey, "edgeKey");
581
- function trackDependency2(dependency, subscriber) {
337
+ function trackDependency(dependency, subscriber) {
582
338
  const source = ensureDependencySignal(dependency);
583
339
  if (!source) return;
584
340
  const memoId = memoSignalIds.get(subscriber);
@@ -592,7 +348,7 @@ function createDevTools(options = {}) {
592
348
  type
593
349
  });
594
350
  }
595
- __name(trackDependency2, "trackDependency");
351
+ __name(trackDependency, "trackDependency");
596
352
  function collectEffectIds(signalId) {
597
353
  const effectsForSignal = /* @__PURE__ */ new Set();
598
354
  const visited = /* @__PURE__ */ new Set();
@@ -602,8 +358,8 @@ function createDevTools(options = {}) {
602
358
  for (const edge of edges.values()) {
603
359
  if (edge.from !== sourceId) continue;
604
360
  if (effects.has(edge.to)) {
605
- const effect2 = effects.get(edge.to);
606
- if (effect2 && !isInternalEffect(effect2)) effectsForSignal.add(edge.to);
361
+ const effect = effects.get(edge.to);
362
+ if (effect && !isInternalEffect(effect)) effectsForSignal.add(edge.to);
607
363
  } else visit(edge.to);
608
364
  }
609
365
  }, "visit");
@@ -647,7 +403,7 @@ function createDevTools(options = {}) {
647
403
  __name(signalInfo, "signalInfo");
648
404
  function readSignal(signal) {
649
405
  try {
650
- return untrack(() => signal.value);
406
+ return (0, import_reactivity.untrack)(() => signal.value);
651
407
  } catch (error) {
652
408
  return { type: "thrown", message: toErrorMessage(error) };
653
409
  }
@@ -698,8 +454,8 @@ function createDevTools(options = {}) {
698
454
  signals.delete(id);
699
455
  }
700
456
  }
701
- for (const [id, effect2] of effects) {
702
- if (effect2.ownerId === record.id) {
457
+ for (const [id, effect] of effects) {
458
+ if (effect.ownerId === record.id) {
703
459
  removedIds.add(id);
704
460
  effects.delete(id);
705
461
  }
@@ -714,15 +470,15 @@ function createDevTools(options = {}) {
714
470
  }
715
471
  __name(debugComponentName, "debugComponentName");
716
472
  function buildComponentNode(record, activeIds) {
717
- const componentEffects = [...effects.values()].filter((effect2) => !effect2.disposed && effect2.ownerId === record.id);
718
- const componentEffectIds = new Set(componentEffects.map((effect2) => effect2.id));
719
- const componentUpdates = updates.filter((update) => update.effects.some((effect2) => componentEffectIds.has(effect2.effectId)));
473
+ const componentEffects = [...effects.values()].filter((effect) => !effect.disposed && effect.ownerId === record.id);
474
+ const componentEffectIds = new Set(componentEffects.map((effect) => effect.id));
475
+ const componentUpdates = updates.filter((update) => update.effects.some((effect) => componentEffectIds.has(effect.effectId)));
720
476
  return {
721
477
  id: record.id,
722
478
  name: record.name,
723
479
  ownerId: record.id,
724
480
  signals: [...signals.values()].filter((signal) => !signal.disposed && signal.ownerId === record.id).map((signal) => signal.id),
725
- effects: componentEffects.map((effect2) => effect2.id),
481
+ effects: componentEffects.map((effect) => effect.id),
726
482
  recentUpdates: componentUpdates.slice(-10).map((update) => update.id),
727
483
  domUpdates: componentUpdates.reduce((count, update) => count + update.domUpdates.length, 0),
728
484
  children: [...owners.values()].filter((child) => !child.disposed && child.parentId === record.id && activeIds.has(child.id)).map((child) => buildComponentNode(child, activeIds)),
@@ -833,6 +589,10 @@ function createDevTools(options = {}) {
833
589
  let pending = pendingUpdates.find((item) => item.signal.signal === signal);
834
590
  if (pending) {
835
591
  pending.nextValue = nextValue;
592
+ const context = (0, import_runtime.getRuntimeDebugContext)();
593
+ if (context?.route) pending.context = { ...pending.context, route: context.route };
594
+ if (context?.navigationId !== void 0) pending.context = { ...pending.context, navigationId: context.navigationId };
595
+ if (context?.dataRequestId !== void 0) pending.context.requestIds.add(context.dataRequestId);
836
596
  } else {
837
597
  pending = {
838
598
  id: `update-${nextId++}`,
@@ -847,10 +607,10 @@ function createDevTools(options = {}) {
847
607
  status: "completed",
848
608
  error: void 0,
849
609
  context: {
850
- route: getRuntimeDebugContext()?.route,
851
- navigationId: getRuntimeDebugContext()?.navigationId,
610
+ route: (0, import_runtime.getRuntimeDebugContext)()?.route,
611
+ navigationId: (0, import_runtime.getRuntimeDebugContext)()?.navigationId,
852
612
  requestIds: new Set(
853
- []
613
+ (0, import_runtime.getRuntimeDebugContext)()?.dataRequestId === void 0 ? [] : [(0, import_runtime.getRuntimeDebugContext)().dataRequestId]
854
614
  )
855
615
  }
856
616
  };
@@ -876,26 +636,26 @@ function createDevTools(options = {}) {
876
636
  cleanupSignalRecord(record);
877
637
  },
878
638
  dependencyTracked(dependency, subscriber) {
879
- trackDependency2(dependency, subscriber);
639
+ trackDependency(dependency, subscriber);
880
640
  },
881
641
  dependencyUntracked(dependency, subscriber) {
882
642
  untrackDependency(dependency, subscriber);
883
643
  },
884
- effectCreated(effect2, owner) {
885
- const record = ensureEffect(effect2, owner);
644
+ effectCreated(effect, owner) {
645
+ const record = ensureEffect(effect, owner);
886
646
  if (isInternalEffect(record)) return;
887
647
  recordLifecycle("effect-created", record.id, effectInfo(record).name, record.ownerId ?? void 0);
888
648
  emit("effect-created", effectInfo(record));
889
649
  },
890
- effectInvalidated(effect2) {
891
- const record = ensureEffect(effect2);
650
+ effectInvalidated(effect) {
651
+ const record = ensureEffect(effect);
892
652
  if (isInternalEffect(record)) return;
893
653
  record.status = "dirty";
894
654
  recordLifecycle("effect-invalidated", record.id, effectInfo(record).name, record.ownerId ?? void 0);
895
655
  emit("effect-invalidated", effectInfo(record));
896
656
  },
897
- effectRunStart(effect2) {
898
- const record = ensureEffect(effect2);
657
+ effectRunStart(effect) {
658
+ const record = ensureEffect(effect);
899
659
  if (isInternalEffect(record)) return;
900
660
  record.status = "running";
901
661
  record.runningSince = now();
@@ -903,8 +663,8 @@ function createDevTools(options = {}) {
903
663
  recordLifecycle("effect-run-start", record.id, effectInfo(record).name, record.ownerId ?? void 0);
904
664
  emit("effect-run-start", effectInfo(record));
905
665
  },
906
- effectRunEnd(effect2, error, handled = false) {
907
- const record = ensureEffect(effect2);
666
+ effectRunEnd(effect, error, handled = false) {
667
+ const record = ensureEffect(effect);
908
668
  if (isInternalEffect(record)) return;
909
669
  const end = now();
910
670
  const duration = record.runningSince === null ? 0 : Math.max(0, end - record.runningSince);
@@ -955,8 +715,8 @@ function createDevTools(options = {}) {
955
715
  recordLifecycle("effect-run", record.id, effectInfo(record).name, record.ownerId ?? void 0, runStatus);
956
716
  emit("effect-run", execution);
957
717
  },
958
- effectDisposed(effect2) {
959
- const record = ensureEffect(effect2);
718
+ effectDisposed(effect) {
719
+ const record = ensureEffect(effect);
960
720
  const internal = isInternalEffect(record);
961
721
  record.disposed = true;
962
722
  record.status = "idle";
@@ -985,16 +745,16 @@ function createDevTools(options = {}) {
985
745
  const runtimeHooks = {
986
746
  domMutation(mutation) {
987
747
  if (!activeEffectId) return;
988
- const effect2 = effects.get(activeEffectId);
989
- if (!effect2 || isInternalEffect(effect2)) return;
748
+ const effect = effects.get(activeEffectId);
749
+ if (!effect || isInternalEffect(effect)) return;
990
750
  const safeMutation = {
991
751
  ...mutation,
992
752
  previousValue: privacy.redactDomValues ? privacy.replacement : serializeForDevTools(mutation.previousValue, /* @__PURE__ */ new Set(), 0, privacy),
993
753
  nextValue: privacy.redactDomValues ? privacy.replacement : serializeForDevTools(mutation.nextValue, /* @__PURE__ */ new Set(), 0, privacy),
994
754
  effectId: activeEffectId,
995
- route: getRuntimeDebugContext()?.route,
996
- navigationId: getRuntimeDebugContext()?.navigationId,
997
- requestId: getRuntimeDebugContext()?.dataRequestId
755
+ route: (0, import_runtime.getRuntimeDebugContext)()?.route,
756
+ navigationId: (0, import_runtime.getRuntimeDebugContext)()?.navigationId,
757
+ requestId: (0, import_runtime.getRuntimeDebugContext)()?.dataRequestId
998
758
  };
999
759
  for (const pending of pendingUpdates) {
1000
760
  if (pending.effectIds.has(activeEffectId)) {
@@ -1012,8 +772,8 @@ function createDevTools(options = {}) {
1012
772
  vobsCode: "VOBS_HYDRATION_MISMATCH",
1013
773
  vobsHydration: event
1014
774
  }), {
1015
- route: getRuntimeDebugContext()?.route,
1016
- navigationId: getRuntimeDebugContext()?.navigationId
775
+ route: (0, import_runtime.getRuntimeDebugContext)()?.route,
776
+ navigationId: (0, import_runtime.getRuntimeDebugContext)()?.navigationId
1017
777
  });
1018
778
  },
1019
779
  error(event) {
@@ -1111,12 +871,12 @@ function createDevTools(options = {}) {
1111
871
  emit("network-request", { source: "ssr", imported: events.length });
1112
872
  }
1113
873
  __name(importSSRRequests, "importSSRRequests");
1114
- const previousHooks = getDebugHooks();
1115
- const previousRuntimeHooks = getRuntimeDebugHooks();
1116
- const previousHTTPHooks = getHTTPDebugHooks();
1117
- setDebugHooks(hooks);
1118
- setRuntimeDebugHooks(runtimeHooks);
1119
- setHTTPDebugHooks(httpHooks);
874
+ const previousHooks = (0, import_reactivity.getDebugHooks)();
875
+ const previousRuntimeHooks = (0, import_runtime.getRuntimeDebugHooks)();
876
+ const previousHTTPHooks = (0, import_http.getHTTPDebugHooks)();
877
+ (0, import_reactivity.setDebugHooks)(hooks);
878
+ (0, import_runtime.setRuntimeDebugHooks)(runtimeHooks);
879
+ (0, import_http.setHTTPDebugHooks)(httpHooks);
1120
880
  const target = options.target ?? defaultTarget();
1121
881
  const shouldExpose = options.expose ?? Boolean(target);
1122
882
  const previousGlobal = target?.__VOBS_DEVTOOLS__;
@@ -1278,7 +1038,7 @@ function createDevTools(options = {}) {
1278
1038
  return [...edges.values()].filter((edge) => edge.to === subscriberId);
1279
1039
  },
1280
1040
  getEffects() {
1281
- return [...effects.values()].filter((effect2) => !effect2.disposed && !isInternalEffect(effect2)).map(effectInfo);
1041
+ return [...effects.values()].filter((effect) => !effect.disposed && !isInternalEffect(effect)).map(effectInfo);
1282
1042
  },
1283
1043
  getUpdates() {
1284
1044
  return updates.slice();
@@ -1309,15 +1069,15 @@ function createDevTools(options = {}) {
1309
1069
  status: update.status
1310
1070
  });
1311
1071
  }
1312
- for (const effect2 of effects.values()) {
1313
- if (effect2.disposed || isInternalEffect(effect2) || effect2.lastDuration <= 0) continue;
1072
+ for (const effect of effects.values()) {
1073
+ if (effect.disposed || isInternalEffect(effect) || effect.lastDuration <= 0) continue;
1314
1074
  entries.push({
1315
1075
  kind: "effect",
1316
- id: effect2.id,
1317
- label: effectInfo(effect2).name,
1318
- duration: effect2.lastDuration,
1319
- timestamp: effect2.lastExecutionTime,
1320
- status: effect2.lastRunStatus ?? effect2.status
1076
+ id: effect.id,
1077
+ label: effectInfo(effect).name,
1078
+ duration: effect.lastDuration,
1079
+ timestamp: effect.lastExecutionTime,
1080
+ status: effect.lastRunStatus ?? effect.status
1321
1081
  });
1322
1082
  }
1323
1083
  for (const request of networkRequests.values()) {
@@ -1363,7 +1123,7 @@ function createDevTools(options = {}) {
1363
1123
  },
1364
1124
  getPerformanceMetrics() {
1365
1125
  const total = updateDurations.reduce((sum, duration) => sum + duration, 0);
1366
- const effectDurations = [...effects.values()].filter((effect2) => !effect2.disposed).map((effect2) => effect2.lastDuration).filter((duration) => duration > 0);
1126
+ const effectDurations = [...effects.values()].filter((effect) => !effect.disposed).map((effect) => effect.lastDuration).filter((duration) => duration > 0);
1367
1127
  const requestDurations = [...networkRequests.values()].map((request) => request.duration ?? 0).filter((duration) => duration > 0);
1368
1128
  return {
1369
1129
  updateCount,
@@ -1380,7 +1140,7 @@ function createDevTools(options = {}) {
1380
1140
  takeMemorySnapshot() {
1381
1141
  return {
1382
1142
  signalCount: [...signals.values()].filter((signal) => !signal.disposed && !isInternalSignal(signal)).length,
1383
- effectCount: [...effects.values()].filter((effect2) => !effect2.disposed && !isInternalEffect(effect2)).length,
1143
+ effectCount: [...effects.values()].filter((effect) => !effect.disposed && !isInternalEffect(effect)).length,
1384
1144
  ownerCount: [...owners.values()].filter((owner) => !owner.disposed && !isInternalOwnerId(owner.id)).length,
1385
1145
  dependencyEdgeCount: edges.size,
1386
1146
  leakedOwners: [...owners.values()].filter((owner) => owner.disposed).length
@@ -1455,9 +1215,9 @@ function createDevTools(options = {}) {
1455
1215
  dispose() {
1456
1216
  if (disposed) return;
1457
1217
  disposed = true;
1458
- if (getDebugHooks() === hooks) setDebugHooks(previousHooks);
1459
- if (getRuntimeDebugHooks() === runtimeHooks) setRuntimeDebugHooks(previousRuntimeHooks);
1460
- if (getHTTPDebugHooks() === httpHooks) setHTTPDebugHooks(previousHTTPHooks);
1218
+ if ((0, import_reactivity.getDebugHooks)() === hooks) (0, import_reactivity.setDebugHooks)(previousHooks);
1219
+ if ((0, import_runtime.getRuntimeDebugHooks)() === runtimeHooks) (0, import_runtime.setRuntimeDebugHooks)(previousRuntimeHooks);
1220
+ if ((0, import_http.getHTTPDebugHooks)() === httpHooks) (0, import_http.setHTTPDebugHooks)(previousHTTPHooks);
1461
1221
  if (activeDevTools === api) activeDevTools = null;
1462
1222
  if (target && target.__VOBS_DEVTOOLS__ === api) {
1463
1223
  if (previousGlobal) target.__VOBS_DEVTOOLS__ = previousGlobal;
@@ -1655,7 +1415,7 @@ function toErrorMessage(error) {
1655
1415
  }
1656
1416
  __name(toErrorMessage, "toErrorMessage");
1657
1417
  function toDebugError(error, phase) {
1658
- const normalized = normalizeVobsError(error);
1418
+ const normalized = (0, import_runtime2.normalizeVobsError)(error);
1659
1419
  const value = error;
1660
1420
  const source = value?.vobsSource ?? normalized.location;
1661
1421
  return {
@@ -1833,14 +1593,15 @@ function serializeForDevTools(value, seen = /* @__PURE__ */ new Set(), depth = 0
1833
1593
  }
1834
1594
  }
1835
1595
  __name(serializeForDevTools, "serializeForDevTools");
1836
-
1837
- exports.DEVTOOLS_EVENTS = DEVTOOLS_EVENTS;
1838
- exports.DEVTOOLS_REACTIVITY_EVENTS = DEVTOOLS_REACTIVITY_EVENTS;
1839
- exports.connectDevTools = connectDevTools;
1840
- exports.createDevTools = createDevTools;
1841
- exports.devtoolsPlugin = devtoolsPlugin;
1842
- exports.disableDevTools = disableDevTools;
1843
- exports.enableDevTools = enableDevTools;
1844
- exports.getDevTools = getDevTools;
1845
- //# sourceMappingURL=index.cjs.map
1596
+ // Annotate the CommonJS export names for ESM import in node:
1597
+ 0 && (module.exports = {
1598
+ DEVTOOLS_EVENTS,
1599
+ DEVTOOLS_REACTIVITY_EVENTS,
1600
+ connectDevTools,
1601
+ createDevTools,
1602
+ devtoolsPlugin,
1603
+ disableDevTools,
1604
+ enableDevTools,
1605
+ getDevTools
1606
+ });
1846
1607
  //# sourceMappingURL=index.cjs.map