@buoy-gg/route-events 7.0.17 → 7.0.19

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.
@@ -3,12 +3,46 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.routeEventsSyncAdapter = void 0;
6
+ exports.routeEventsSyncAdapter = exports.SNAPSHOT_PARAM_INLINE_LIMIT = void 0;
7
7
  var _sharedUi = require("@buoy-gg/shared-ui");
8
8
  var _routeEventStore = require("../stores/routeEventStore");
9
9
  var _navigationStackStore = require("../stores/navigationStackStore");
10
10
  var _RouteParser = require("../RouteParser");
11
11
  var _expoRouterStore = require("../expoRouterStore");
12
+ /**
13
+ * Navigation params larger than this are NOT streamed in the snapshot.
14
+ * Apps routinely pass whole user objects (or a stringified payload) through
15
+ * `navigate(..., { user })`; 500 of those on every route change exceed the
16
+ * 2MB emit budget and drop the Routes panel. Pathname/segments stay inline.
17
+ */
18
+ const SNAPSHOT_PARAM_INLINE_LIMIT = exports.SNAPSHOT_PARAM_INLINE_LIMIT = 16 * 1024;
19
+ const PARAMS_ON_DEVICE = Object.freeze({
20
+ __buoyOmitted: "route-params",
21
+ note: "Navigation params stay on the device."
22
+ });
23
+ function shouldOmitParams(params) {
24
+ if (params == null) return false;
25
+ return (0, _sharedUi.isOverWireBudget)(params, SNAPSHOT_PARAM_INLINE_LIMIT);
26
+ }
27
+ function toWireParams(params) {
28
+ if (!shouldOmitParams(params)) return params;
29
+ return PARAMS_ON_DEVICE;
30
+ }
31
+ function toWireEvent(event) {
32
+ if (!shouldOmitParams(event.params)) return event;
33
+ return {
34
+ ...event,
35
+ params: toWireParams(event.params)
36
+ };
37
+ }
38
+ function toWireStackItem(item) {
39
+ if (!shouldOmitParams(item.params)) return item;
40
+ return {
41
+ ...item,
42
+ params: toWireParams(item.params)
43
+ };
44
+ }
45
+
12
46
  /**
13
47
  * Serializable snapshot of the device's route tree, sent to the dashboard so
14
48
  * the Routes tab can render a sitemap (the raw expo-router RouteNode itself is
@@ -47,9 +81,9 @@ function getSitemapSnapshot() {
47
81
  const routeEventsSyncAdapter = exports.routeEventsSyncAdapter = {
48
82
  version: 3,
49
83
  getSnapshot: () => ({
50
- events: _routeEventStore.routeEventStore.getEvents(),
84
+ events: _routeEventStore.routeEventStore.getEvents().map(toWireEvent),
51
85
  sitemap: getSitemapSnapshot(),
52
- stack: _navigationStackStore.navigationStackStore.getStack()
86
+ stack: _navigationStackStore.navigationStackStore.getStack().map(toWireStackItem)
53
87
  }),
54
88
  subscribe: onChange => {
55
89
  const unsubscribeEvents = _routeEventStore.routeEventStore.subscribeToEvents(onChange);
@@ -5,6 +5,41 @@ import { routeEventStore } from "../stores/routeEventStore";
5
5
  import { navigationStackStore } from "../stores/navigationStackStore";
6
6
  import { RouteParser } from "../RouteParser";
7
7
  import { loadRouteNode, getRouteNodeMetadata } from "../expoRouterStore";
8
+ import { isOverWireBudget } from "@buoy-gg/shared-ui";
9
+
10
+ /**
11
+ * Navigation params larger than this are NOT streamed in the snapshot.
12
+ * Apps routinely pass whole user objects (or a stringified payload) through
13
+ * `navigate(..., { user })`; 500 of those on every route change exceed the
14
+ * 2MB emit budget and drop the Routes panel. Pathname/segments stay inline.
15
+ */
16
+ export const SNAPSHOT_PARAM_INLINE_LIMIT = 16 * 1024;
17
+ const PARAMS_ON_DEVICE = Object.freeze({
18
+ __buoyOmitted: "route-params",
19
+ note: "Navigation params stay on the device."
20
+ });
21
+ function shouldOmitParams(params) {
22
+ if (params == null) return false;
23
+ return isOverWireBudget(params, SNAPSHOT_PARAM_INLINE_LIMIT);
24
+ }
25
+ function toWireParams(params) {
26
+ if (!shouldOmitParams(params)) return params;
27
+ return PARAMS_ON_DEVICE;
28
+ }
29
+ function toWireEvent(event) {
30
+ if (!shouldOmitParams(event.params)) return event;
31
+ return {
32
+ ...event,
33
+ params: toWireParams(event.params)
34
+ };
35
+ }
36
+ function toWireStackItem(item) {
37
+ if (!shouldOmitParams(item.params)) return item;
38
+ return {
39
+ ...item,
40
+ params: toWireParams(item.params)
41
+ };
42
+ }
8
43
 
9
44
  /**
10
45
  * Serializable snapshot of the device's route tree, sent to the dashboard so
@@ -44,9 +79,9 @@ function getSitemapSnapshot() {
44
79
  export const routeEventsSyncAdapter = {
45
80
  version: 3,
46
81
  getSnapshot: () => ({
47
- events: routeEventStore.getEvents(),
82
+ events: routeEventStore.getEvents().map(toWireEvent),
48
83
  sitemap: getSitemapSnapshot(),
49
- stack: navigationStackStore.getStack()
84
+ stack: navigationStackStore.getStack().map(toWireStackItem)
50
85
  }),
51
86
  subscribe: onChange => {
52
87
  const unsubscribeEvents = routeEventStore.subscribeToEvents(onChange);
@@ -1,6 +1,13 @@
1
1
  import { type RouteInfo } from "../RouteParser";
2
2
  import type { RouteChangeEvent } from "../RouteObserver";
3
3
  import type { StackDisplayItem } from "../useNavigationStack";
4
+ /**
5
+ * Navigation params larger than this are NOT streamed in the snapshot.
6
+ * Apps routinely pass whole user objects (or a stringified payload) through
7
+ * `navigate(..., { user })`; 500 of those on every route change exceed the
8
+ * 2MB emit budget and drop the Routes panel. Pathname/segments stay inline.
9
+ */
10
+ export declare const SNAPSHOT_PARAM_INLINE_LIMIT: number;
4
11
  /**
5
12
  * Serializable snapshot of the device's route tree, sent to the dashboard so
6
13
  * the Routes tab can render a sitemap (the raw expo-router RouteNode itself is
@@ -49,13 +56,13 @@ export declare const routeEventsSyncAdapter: {
49
56
  * Navigate the device to a concrete path. The dashboard resolves any
50
57
  * dynamic params into a concrete path before invoking this.
51
58
  */
52
- navigate: (params: unknown) => {
59
+ navigate: (params?: unknown) => {
53
60
  navigated: string;
54
61
  };
55
- stackNavigateToIndex: (params: unknown) => {
62
+ stackNavigateToIndex: (params?: unknown) => {
56
63
  navigatedToIndex: number;
57
64
  };
58
- stackPopToIndex: (params: unknown) => {
65
+ stackPopToIndex: (params?: unknown) => {
59
66
  poppedToIndex: number;
60
67
  };
61
68
  stackGoBack: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"routeEventsSyncAdapter.d.ts","sourceRoot":"","sources":["../../../src/sync/routeEventsSyncAdapter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,6EAA6E;IAC7E,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,mEAAmE;IACnE,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC;IAC/B,6EAA6E;IAC7E,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,8EAA8E;IAC9E,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAWD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB;;uBAEhB,sBAAsB;0BAKjB,MAAM,IAAI;;;QAkC9B;;;WAGG;2BACgB,OAAO;;;uCAcK,OAAO;;;kCAUZ,OAAO;;;;;;;;;;CAuBpC,CAAC"}
1
+ {"version":3,"file":"routeEventsSyncAdapter.d.ts","sourceRoot":"","sources":["../../../src/sync/routeEventsSyncAdapter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,QAAY,CAAC;AA4BrD;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,6EAA6E;IAC7E,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,mEAAmE;IACnE,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC;IAC/B,6EAA6E;IAC7E,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,8EAA8E;IAC9E,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAWD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB;;uBAEhB,sBAAsB;0BAKjB,MAAM,IAAI;;;QAkC9B;;;WAGG;4BACiB,OAAO;;;wCAcK,OAAO;;;mCAUZ,OAAO;;;;;;;;;;CAuBrC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/route-events",
3
- "version": "7.0.17",
3
+ "version": "7.0.19",
4
4
  "description": "Navigation devtool for React Native — live stack, full sitemap, jump to any screen. Expo Router & React Navigation. Part of Buoy devtools.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -26,11 +26,11 @@
26
26
  ],
27
27
  "sideEffects": false,
28
28
  "dependencies": {
29
- "@buoy-gg/floating-tools-core": "^7.0.17",
30
- "@buoy-gg/shared-ui": "^7.0.17"
29
+ "@buoy-gg/floating-tools-core": "^7.0.19",
30
+ "@buoy-gg/shared-ui": "^7.0.19"
31
31
  },
32
32
  "peerDependencies": {
33
- "@buoy-gg/license": "7.0.17",
33
+ "@buoy-gg/license": "7.0.19",
34
34
  "@react-native-async-storage/async-storage": "^2.0.0 || ^3.1.0",
35
35
  "@react-navigation/native": "*",
36
36
  "expo-router": "*",
@@ -52,7 +52,7 @@
52
52
  "@types/react-native": "^0.73.0",
53
53
  "expo-router": "~5.0.7",
54
54
  "typescript": "~5.8.3",
55
- "@buoy-gg/license": "^7.0.17"
55
+ "@buoy-gg/license": "^7.0.19"
56
56
  },
57
57
  "react-native-builder-bob": {
58
58
  "source": "src",
@@ -70,7 +70,12 @@
70
70
  "sourceMaps": false
71
71
  }
72
72
  ],
73
- "typescript"
73
+ [
74
+ "typescript",
75
+ {
76
+ "project": "tsconfig.build.json"
77
+ }
78
+ ]
74
79
  ]
75
80
  },
76
81
  "repository": {