react-native-mcp-kit 3.0.1 → 4.0.0
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/README.md +22 -10
- package/dist/bin/ios-hid +0 -0
- package/dist/client/contexts/McpContext/McpProvider.d.ts.map +1 -1
- package/dist/client/contexts/McpContext/McpProvider.js +5 -5
- package/dist/client/contexts/McpContext/McpProvider.js.map +1 -1
- package/dist/client/core/McpClient.d.ts.map +1 -1
- package/dist/client/core/McpClient.js +26 -32
- package/dist/client/core/McpClient.js.map +1 -1
- package/dist/modules/alert/alert.d.ts.map +1 -1
- package/dist/modules/alert/alert.js +2 -5
- package/dist/modules/alert/alert.js.map +1 -1
- package/dist/modules/console/console.d.ts.map +1 -1
- package/dist/modules/console/console.js +32 -107
- package/dist/modules/console/console.js.map +1 -1
- package/dist/modules/console/types.d.ts +1 -0
- package/dist/modules/console/types.d.ts.map +1 -1
- package/dist/modules/device/device.d.ts.map +1 -1
- package/dist/modules/device/device.js +224 -133
- package/dist/modules/device/device.js.map +1 -1
- package/dist/modules/errors/errors.d.ts.map +1 -1
- package/dist/modules/errors/errors.js +19 -36
- package/dist/modules/errors/errors.js.map +1 -1
- package/dist/modules/fiberTree/children.d.ts +49 -0
- package/dist/modules/fiberTree/children.d.ts.map +1 -0
- package/dist/modules/fiberTree/children.js +182 -0
- package/dist/modules/fiberTree/children.js.map +1 -0
- package/dist/modules/fiberTree/constants.d.ts +13 -0
- package/dist/modules/fiberTree/constants.d.ts.map +1 -0
- package/dist/modules/fiberTree/constants.js +24 -0
- package/dist/modules/fiberTree/constants.js.map +1 -0
- package/dist/modules/fiberTree/fiberTree.d.ts +3 -6
- package/dist/modules/fiberTree/fiberTree.d.ts.map +1 -1
- package/dist/modules/fiberTree/fiberTree.js +219 -1080
- package/dist/modules/fiberTree/fiberTree.js.map +1 -1
- package/dist/modules/fiberTree/finder.d.ts +60 -0
- package/dist/modules/fiberTree/finder.d.ts.map +1 -0
- package/dist/modules/fiberTree/finder.js +107 -0
- package/dist/modules/fiberTree/finder.js.map +1 -0
- package/dist/modules/fiberTree/hooks.d.ts +103 -0
- package/dist/modules/fiberTree/hooks.d.ts.map +1 -0
- package/dist/modules/fiberTree/hooks.js +532 -0
- package/dist/modules/fiberTree/hooks.js.map +1 -0
- package/dist/modules/fiberTree/projection.d.ts +49 -0
- package/dist/modules/fiberTree/projection.d.ts.map +1 -0
- package/dist/modules/fiberTree/projection.js +82 -0
- package/dist/modules/fiberTree/projection.js.map +1 -0
- package/dist/modules/fiberTree/query.d.ts +56 -0
- package/dist/modules/fiberTree/query.d.ts.map +1 -0
- package/dist/modules/fiberTree/query.js +151 -0
- package/dist/modules/fiberTree/query.js.map +1 -0
- package/dist/modules/fiberTree/redact.d.ts +24 -0
- package/dist/modules/fiberTree/redact.d.ts.map +1 -0
- package/dist/modules/fiberTree/redact.js +51 -0
- package/dist/modules/fiberTree/redact.js.map +1 -0
- package/dist/modules/fiberTree/types.d.ts +7 -0
- package/dist/modules/fiberTree/types.d.ts.map +1 -1
- package/dist/modules/fiberTree/utils.d.ts +8 -2
- package/dist/modules/fiberTree/utils.d.ts.map +1 -1
- package/dist/modules/fiberTree/utils.js +79 -78
- package/dist/modules/fiberTree/utils.js.map +1 -1
- package/dist/modules/fiberTree/viewport.d.ts +28 -0
- package/dist/modules/fiberTree/viewport.d.ts.map +1 -0
- package/dist/modules/fiberTree/viewport.js +50 -0
- package/dist/modules/fiberTree/viewport.js.map +1 -0
- package/dist/modules/fiberTree/waitFor.d.ts +52 -0
- package/dist/modules/fiberTree/waitFor.d.ts.map +1 -0
- package/dist/modules/fiberTree/waitFor.js +98 -0
- package/dist/modules/fiberTree/waitFor.js.map +1 -0
- package/dist/modules/logBox/logBox.d.ts.map +1 -1
- package/dist/modules/logBox/logBox.js +59 -66
- package/dist/modules/logBox/logBox.js.map +1 -1
- package/dist/modules/navigation/navigation.d.ts.map +1 -1
- package/dist/modules/navigation/navigation.js +115 -114
- package/dist/modules/navigation/navigation.js.map +1 -1
- package/dist/modules/network/network.d.ts.map +1 -1
- package/dist/modules/network/network.js +78 -197
- package/dist/modules/network/network.js.map +1 -1
- package/dist/modules/network/types.d.ts +23 -27
- package/dist/modules/network/types.d.ts.map +1 -1
- package/dist/modules/reactQuery/reactQuery.d.ts.map +1 -1
- package/dist/modules/reactQuery/reactQuery.js +46 -52
- package/dist/modules/reactQuery/reactQuery.js.map +1 -1
- package/dist/modules/storage/storage.d.ts.map +1 -1
- package/dist/modules/storage/storage.js +20 -3
- package/dist/modules/storage/storage.js.map +1 -1
- package/dist/server/host/tools/input.js +2 -2
- package/dist/server/host/tools/input.js.map +1 -1
- package/dist/server/mcpServer.d.ts.map +1 -1
- package/dist/server/mcpServer.js +43 -3
- package/dist/server/mcpServer.js.map +1 -1
- package/dist/server/metro/eventCapture.d.ts +0 -2
- package/dist/server/metro/eventCapture.d.ts.map +1 -1
- package/dist/server/metro/eventCapture.js +1 -2
- package/dist/server/metro/eventCapture.js.map +1 -1
- package/dist/server/metro/tools/events.d.ts.map +1 -1
- package/dist/server/metro/tools/events.js +11 -11
- package/dist/server/metro/tools/events.js.map +1 -1
- package/dist/shared/projection/projectValue.d.ts +90 -0
- package/dist/shared/projection/projectValue.d.ts.map +1 -0
- package/dist/shared/projection/projectValue.js +322 -0
- package/dist/shared/projection/projectValue.js.map +1 -0
- package/dist/shared/projection/redact.d.ts +31 -0
- package/dist/shared/projection/redact.d.ts.map +1 -0
- package/dist/shared/projection/redact.js +78 -0
- package/dist/shared/projection/redact.js.map +1 -0
- package/dist/shared/projection/resolvePath.d.ts +45 -0
- package/dist/shared/projection/resolvePath.d.ts.map +1 -0
- package/dist/shared/projection/resolvePath.js +211 -0
- package/dist/shared/projection/resolvePath.js.map +1 -0
- package/dist/shared/rn/core.d.ts +48 -0
- package/dist/shared/rn/core.d.ts.map +1 -0
- package/dist/shared/rn/core.js +100 -0
- package/dist/shared/rn/core.js.map +1 -0
- package/dist/shared/rn/deviceInfo.d.ts +40 -0
- package/dist/shared/rn/deviceInfo.d.ts.map +1 -0
- package/dist/shared/rn/deviceInfo.js +78 -0
- package/dist/shared/rn/deviceInfo.js.map +1 -0
- package/package.json +2 -2
- package/dist/client/hooks/useMcpState.d.ts +0 -3
- package/dist/client/hooks/useMcpState.d.ts.map +0 -1
- package/dist/client/hooks/useMcpState.js +0 -20
- package/dist/client/hooks/useMcpState.js.map +0 -1
- package/dist/server/canonicalize.d.ts +0 -8
- package/dist/server/canonicalize.d.ts.map +0 -1
- package/dist/server/canonicalize.js +0 -23
- package/dist/server/canonicalize.js.map +0 -1
- package/dist/server/host/modules/screenshot.d.ts +0 -4
- package/dist/server/host/modules/screenshot.d.ts.map +0 -1
- package/dist/server/host/modules/screenshot.js +0 -615
- package/dist/server/host/modules/screenshot.js.map +0 -1
- package/dist/server/host/tools/connectionStatus.d.ts +0 -9
- package/dist/server/host/tools/connectionStatus.d.ts.map +0 -1
- package/dist/server/host/tools/connectionStatus.js +0 -39
- package/dist/server/host/tools/connectionStatus.js.map +0 -1
- package/dist/server/host/tools/symbolicate.d.ts +0 -3
- package/dist/server/host/tools/symbolicate.d.ts.map +0 -1
- package/dist/server/host/tools/symbolicate.js +0 -209
- package/dist/server/host/tools/symbolicate.js.map +0 -1
- package/dist/server/host/wda.d.ts +0 -15
- package/dist/server/host/wda.d.ts.map +0 -1
- package/dist/server/host/wda.js +0 -100
- package/dist/server/host/wda.js.map +0 -1
- package/dist/server/inputSchemaToZod.d.ts +0 -19
- package/dist/server/inputSchemaToZod.d.ts.map +0 -1
- package/dist/server/inputSchemaToZod.js +0 -89
- package/dist/server/inputSchemaToZod.js.map +0 -1
- package/dist/server/metro/tools/openUrl.d.ts +0 -3
- package/dist/server/metro/tools/openUrl.d.ts.map +0 -1
- package/dist/server/metro/tools/openUrl.js +0 -71
- package/dist/server/metro/tools/openUrl.js.map +0 -1
- package/dist/shared/slice.d.ts +0 -16
- package/dist/shared/slice.d.ts.map +0 -1
- package/dist/shared/slice.js +0 -29
- package/dist/shared/slice.js.map +0 -1
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Hook introspection — pairs a fiber's `memoizedState` chain with the
|
|
4
|
+
* `__mcp_hooks` metadata array emitted by the test-id-plugin. The metadata
|
|
5
|
+
* holds the source-level identity of each hook call (`kind` + variable
|
|
6
|
+
* name); React itself only stores the runtime slot. Walking both in
|
|
7
|
+
* lockstep recovers names like `useState count` instead of `State[0]`.
|
|
8
|
+
*
|
|
9
|
+
* Two cross-cutting concerns live alongside the walker:
|
|
10
|
+
* - Slot-count estimation for unannotated library hooks (`countHookSlots`)
|
|
11
|
+
* so a custom hook that internally consumes 3 slots advances the walker
|
|
12
|
+
* by 3, not 1 — keeps trailing metadata aligned.
|
|
13
|
+
* - Custom-hook recursion (`flattenHookMeta`) so nested `__mcp_hooks` on
|
|
14
|
+
* a custom hook's `fn` get inlined into the metadata stream, with the
|
|
15
|
+
* parent emitted as an `expanded: true` synthetic record.
|
|
16
|
+
*
|
|
17
|
+
* Inputs come through `extractHooks` as a single `filter` bag — kinds /
|
|
18
|
+
* names / withValues / projection knobs / compiled redact patterns. The
|
|
19
|
+
* walker emits a flat array of `{ kind, name, hook?, via?, expanded?,
|
|
20
|
+
* value? }`; `format: "tree"` post-processes into a nested shape by
|
|
21
|
+
* tracking the `expanded` parents on a small stack.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.buildHooksOptions = exports.extractHooks = exports.parseNamePattern = void 0;
|
|
25
|
+
const redact_1 = require("./redact");
|
|
26
|
+
const utils_1 = require("./utils");
|
|
27
|
+
// Parse a name pattern: `/regex/flags` → RegExp matcher; anything else →
|
|
28
|
+
// exact-string matcher. Same convention as log_box__ignore.
|
|
29
|
+
const parseNamePattern = (raw) => {
|
|
30
|
+
const m = raw.match(/^\/(.+)\/([gimsuy]*)$/);
|
|
31
|
+
if (m && m[1] !== undefined) {
|
|
32
|
+
try {
|
|
33
|
+
const rx = new RegExp(m[1], m[2] ?? '');
|
|
34
|
+
return (n) => {
|
|
35
|
+
return rx.test(n);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return (n) => {
|
|
40
|
+
return n === raw;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return (n) => {
|
|
45
|
+
return n === raw;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
exports.parseNamePattern = parseNamePattern;
|
|
49
|
+
// Try to treat `current` as a React component / native view instance and
|
|
50
|
+
// collapse it to a compact identifier. Native views expose
|
|
51
|
+
// `_internalFiberInstanceHandleDEV` / `_reactInternals`; class instances
|
|
52
|
+
// expose `_reactInternals`. If we find a fiber, we surface its mcpId /
|
|
53
|
+
// testID / component name so the agent can follow up via `query` if needed.
|
|
54
|
+
// If it doesn't look like a component, return null to signal "serialize
|
|
55
|
+
// normally".
|
|
56
|
+
const resolveComponentRef = (current) => {
|
|
57
|
+
if (current === null || current === undefined)
|
|
58
|
+
return null;
|
|
59
|
+
if (typeof current !== 'object')
|
|
60
|
+
return null;
|
|
61
|
+
const obj = current;
|
|
62
|
+
// Pick up a fiber from the typical internal fields used by RN / React.
|
|
63
|
+
const fiber = obj._reactInternals ??
|
|
64
|
+
obj._reactInternalFiber ??
|
|
65
|
+
obj._internalFiberInstanceHandleDEV ??
|
|
66
|
+
obj._internalInstanceHandle;
|
|
67
|
+
const hasNativeTag = '_nativeTag' in obj;
|
|
68
|
+
if (!fiber && !hasNativeTag)
|
|
69
|
+
return null;
|
|
70
|
+
const out = { __componentRef: true };
|
|
71
|
+
if (fiber) {
|
|
72
|
+
const props = fiber.memoizedProps;
|
|
73
|
+
const mcpId = props?.['data-mcp-id'];
|
|
74
|
+
const testID = props?.testID;
|
|
75
|
+
if (mcpId)
|
|
76
|
+
out.mcpId = mcpId;
|
|
77
|
+
if (testID)
|
|
78
|
+
out.testID = testID;
|
|
79
|
+
const typeName = fiber.type?.displayName ??
|
|
80
|
+
fiber.type?.name;
|
|
81
|
+
if (typeName)
|
|
82
|
+
out.componentName = typeName;
|
|
83
|
+
}
|
|
84
|
+
if (hasNativeTag) {
|
|
85
|
+
out.nativeTag = obj._nativeTag;
|
|
86
|
+
const viewConfig = obj.viewConfig;
|
|
87
|
+
if (viewConfig?.uiViewClassName)
|
|
88
|
+
out.viewClass = viewConfig.uiViewClassName;
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
};
|
|
92
|
+
// Recognise React's effect-record shape: `{ tag: number, create: function,
|
|
93
|
+
// deps: null | unknown[] }` with optional `inst` / `destroy` / `next`.
|
|
94
|
+
// useState / useReducer / useContext memoizedState values of this exact
|
|
95
|
+
// shape in real user code are astronomically unlikely, so we treat this as
|
|
96
|
+
// a reliable "definitely not a state slot" signal.
|
|
97
|
+
const looksLikeEffectRecord = (raw) => {
|
|
98
|
+
if (!raw || typeof raw !== 'object')
|
|
99
|
+
return false;
|
|
100
|
+
const r = raw;
|
|
101
|
+
return (typeof r.tag === 'number' &&
|
|
102
|
+
typeof r.create === 'function' &&
|
|
103
|
+
(r.deps === null || r.deps === undefined || Array.isArray(r.deps)));
|
|
104
|
+
};
|
|
105
|
+
// Recognise the useRef shape: `{ current: X }` with NO other keys. A useState
|
|
106
|
+
// value that is literally an object whose sole own-key is "current" is so
|
|
107
|
+
// improbable in real code that we treat it as a reliable "this slot is a
|
|
108
|
+
// ref, not a state" signal — lets State/Custom skip ref slots that leaked in
|
|
109
|
+
// through custom-hook internals.
|
|
110
|
+
const looksLikeRefShape = (raw) => {
|
|
111
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
112
|
+
return false;
|
|
113
|
+
const keys = Object.keys(raw);
|
|
114
|
+
return keys.length === 1 && keys[0] === 'current';
|
|
115
|
+
};
|
|
116
|
+
// Shape-verify a hook slot's memoizedState against its expected kind. When
|
|
117
|
+
// a custom hook internally uses multiple built-in hooks, our static metadata
|
|
118
|
+
// understates the number of slots — every subsequent pairing drifts. By
|
|
119
|
+
// requiring a structural match before consuming a metadata entry we can
|
|
120
|
+
// swallow "internal" slots and keep the rest aligned. Permissive kinds
|
|
121
|
+
// (State / Reducer / Context / Custom) reject only obvious mis-matches
|
|
122
|
+
// (currently: the effect-record shape).
|
|
123
|
+
const shapeMatchesKind = (raw, kind) => {
|
|
124
|
+
switch (kind) {
|
|
125
|
+
case 'Ref':
|
|
126
|
+
return !!raw && typeof raw === 'object' && 'current' in raw;
|
|
127
|
+
case 'Memo':
|
|
128
|
+
case 'Callback':
|
|
129
|
+
return Array.isArray(raw) && raw.length === 2 && (raw[1] === null || Array.isArray(raw[1]));
|
|
130
|
+
case 'Effect':
|
|
131
|
+
case 'LayoutEffect':
|
|
132
|
+
case 'InsertionEffect':
|
|
133
|
+
return looksLikeEffectRecord(raw);
|
|
134
|
+
case 'Transition':
|
|
135
|
+
return Array.isArray(raw) && raw.length === 2;
|
|
136
|
+
case 'State':
|
|
137
|
+
case 'Reducer':
|
|
138
|
+
case 'Context':
|
|
139
|
+
case 'Custom':
|
|
140
|
+
// Permissive but not blind — drop obvious effect-node and ref-shape
|
|
141
|
+
// slots so State/Custom metadata doesn't swallow internals of
|
|
142
|
+
// preceding custom hooks.
|
|
143
|
+
return !looksLikeEffectRecord(raw) && !looksLikeRefShape(raw);
|
|
144
|
+
default:
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
// Pull a "useful" raw value out of a hook's memoizedState by kind. Does NOT
|
|
149
|
+
// project — leaves the result raw so the final `applyProjection` sees the
|
|
150
|
+
// real value tree (so `path` drill into hook values works). The shape here
|
|
151
|
+
// is purely about *which slot field* to expose for each kind (e.g. Ref's
|
|
152
|
+
// `.current`, Memo/Callback's first element of `[value, deps]`).
|
|
153
|
+
const serializeHookValue = (raw, kind) => {
|
|
154
|
+
const walk = (v) => {
|
|
155
|
+
return v;
|
|
156
|
+
};
|
|
157
|
+
switch (kind) {
|
|
158
|
+
case 'Ref': {
|
|
159
|
+
if (!raw || typeof raw !== 'object' || !('current' in raw)) {
|
|
160
|
+
return walk(raw);
|
|
161
|
+
}
|
|
162
|
+
const current = raw.current;
|
|
163
|
+
const componentRef = resolveComponentRef(current);
|
|
164
|
+
if (componentRef) {
|
|
165
|
+
return { current: componentRef };
|
|
166
|
+
}
|
|
167
|
+
return { current: walk(current) };
|
|
168
|
+
}
|
|
169
|
+
case 'Memo':
|
|
170
|
+
case 'Callback':
|
|
171
|
+
if (Array.isArray(raw) && raw.length === 2) {
|
|
172
|
+
return { deps: raw[1], value: walk(raw[0]) };
|
|
173
|
+
}
|
|
174
|
+
return walk(raw);
|
|
175
|
+
case 'Effect':
|
|
176
|
+
case 'LayoutEffect':
|
|
177
|
+
case 'InsertionEffect': {
|
|
178
|
+
// React's hook slot for effects holds { tag, create, destroy, deps, next }.
|
|
179
|
+
// Only `deps` is safe and useful to surface.
|
|
180
|
+
const effect = raw;
|
|
181
|
+
return effect && typeof effect === 'object' && 'deps' in effect
|
|
182
|
+
? { deps: effect.deps ?? null }
|
|
183
|
+
: null;
|
|
184
|
+
}
|
|
185
|
+
default:
|
|
186
|
+
return walk(raw);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
// Estimate how many slots in fiber.memoizedState a hook function consumes.
|
|
190
|
+
// Used by the slot-walker to advance past unannotated black-box library
|
|
191
|
+
// hooks (e.g. `useSelector` from react-redux) which our babel plugin couldn't
|
|
192
|
+
// expand statically — without this they'd consume only one fiber slot during
|
|
193
|
+
// alignment, drifting the rest of the metadata out of sync.
|
|
194
|
+
//
|
|
195
|
+
// Three cascading strategies, falling through on miss:
|
|
196
|
+
// 1. `fn.__mcp_hooks` recursive — accurate for any hook our plugin saw.
|
|
197
|
+
// Custom sub-entries recurse; built-in entries count as 1.
|
|
198
|
+
// 2. `fn.toString()` regex — counts `useXxx(` calls in the source. Works
|
|
199
|
+
// even after Metro bundling because hook references survive as
|
|
200
|
+
// property accesses (`(0, _react.useState)(...)`) — property names
|
|
201
|
+
// aren't mangled. Underestimates when nested customs themselves expand
|
|
202
|
+
// to multiple slots, but better than 1.
|
|
203
|
+
// 3. Default 1 — native functions, bound functions, or sources we can't
|
|
204
|
+
// parse. Same as the original behavior.
|
|
205
|
+
//
|
|
206
|
+
// Cached per-function via WeakMap so cost is paid once per hook fn per
|
|
207
|
+
// session.
|
|
208
|
+
const HOOK_SLOTS_CACHE = new WeakMap();
|
|
209
|
+
const HOOK_NAME_RE = /\buse[A-Z]\w*\s*\(/g;
|
|
210
|
+
const STRING_LITERAL_RE = /(['"`])(?:\\.|(?!\1).)*\1/g;
|
|
211
|
+
const BLOCK_COMMENT_RE = /\/\*[\s\S]*?\*\//g;
|
|
212
|
+
const LINE_COMMENT_RE = /\/\/[^\n]*/g;
|
|
213
|
+
const countHookSlots = (fn, depth = 0, seen) => {
|
|
214
|
+
if (depth > 8)
|
|
215
|
+
return 1;
|
|
216
|
+
if (typeof fn !== 'function')
|
|
217
|
+
return 1;
|
|
218
|
+
const fnObj = fn;
|
|
219
|
+
const cached = HOOK_SLOTS_CACHE.get(fnObj);
|
|
220
|
+
if (cached !== undefined)
|
|
221
|
+
return cached;
|
|
222
|
+
const localSeen = seen ?? new WeakSet();
|
|
223
|
+
if (localSeen.has(fnObj))
|
|
224
|
+
return 1;
|
|
225
|
+
localSeen.add(fnObj);
|
|
226
|
+
// (1) Annotated metadata: recurse into sub-entries, summing their slot
|
|
227
|
+
// counts. Each built-in entry contributes 1; each Custom contributes
|
|
228
|
+
// however many its own fn does (recurse).
|
|
229
|
+
const annotated = fn.__mcp_hooks;
|
|
230
|
+
if (Array.isArray(annotated)) {
|
|
231
|
+
let total = 0;
|
|
232
|
+
for (const entry of annotated) {
|
|
233
|
+
if (entry && entry.kind === 'Custom' && typeof entry.fn === 'function') {
|
|
234
|
+
total += countHookSlots(entry.fn, depth + 1, localSeen);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
total += 1;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const result = Math.max(total, 1);
|
|
241
|
+
HOOK_SLOTS_CACHE.set(fnObj, result);
|
|
242
|
+
return result;
|
|
243
|
+
}
|
|
244
|
+
// (2) toString-based parsing. Strip strings/comments first to avoid
|
|
245
|
+
// matching `'useState'` inside literals. Each `useXxx(` occurrence in
|
|
246
|
+
// remaining source counts as one hook call (≥ 1 slot). Custom hook calls
|
|
247
|
+
// we encounter here can't be resolved further (no scope binding from the
|
|
248
|
+
// outer function), so we bottom out at 1 slot per occurrence — still
|
|
249
|
+
// beats the original constant-1 fallback when the source has multiple
|
|
250
|
+
// hook calls (e.g. `useSyncExternalStoreWithSelector` internals).
|
|
251
|
+
let src;
|
|
252
|
+
try {
|
|
253
|
+
src = Function.prototype.toString.call(fn);
|
|
254
|
+
}
|
|
255
|
+
catch {
|
|
256
|
+
HOOK_SLOTS_CACHE.set(fnObj, 1);
|
|
257
|
+
return 1;
|
|
258
|
+
}
|
|
259
|
+
if (!src || src.includes('[native code]')) {
|
|
260
|
+
HOOK_SLOTS_CACHE.set(fnObj, 1);
|
|
261
|
+
return 1;
|
|
262
|
+
}
|
|
263
|
+
const stripped = src
|
|
264
|
+
.replace(STRING_LITERAL_RE, '""')
|
|
265
|
+
.replace(BLOCK_COMMENT_RE, '')
|
|
266
|
+
.replace(LINE_COMMENT_RE, '');
|
|
267
|
+
HOOK_NAME_RE.lastIndex = 0;
|
|
268
|
+
const matches = stripped.match(HOOK_NAME_RE);
|
|
269
|
+
const result = matches ? matches.length : 1;
|
|
270
|
+
HOOK_SLOTS_CACHE.set(fnObj, result);
|
|
271
|
+
return result;
|
|
272
|
+
};
|
|
273
|
+
// Flatten a metadata array by recursively inlining custom-hook sub-metadata.
|
|
274
|
+
// Stops on cycles (hook references itself) and on Custom entries whose `fn`
|
|
275
|
+
// isn't annotated (library hooks that bypassed the babel plugin — usually
|
|
276
|
+
// pre-compiled node_modules). Such unannotated entries stay as single
|
|
277
|
+
// records and rely on shape-check for alignment.
|
|
278
|
+
//
|
|
279
|
+
// Custom entries with annotated `fn` produce TWO records: a parent (marked
|
|
280
|
+
// `expanded: true`, no slot consumption) followed by all flattened
|
|
281
|
+
// children. This keeps the call-site visible in the output — without it
|
|
282
|
+
// the agent would see e.g. `wrapperAnimStyle.areAnimationsActive` deep
|
|
283
|
+
// in `via:` but never the `wrapperAnimStyle = useAnimatedStyle(...)`
|
|
284
|
+
// invocation that owns those slots.
|
|
285
|
+
const flattenHookMeta = (meta, via = [], seen = new WeakSet(), maxDepth = Infinity) => {
|
|
286
|
+
const out = [];
|
|
287
|
+
for (const entry of meta) {
|
|
288
|
+
const fn = entry.fn;
|
|
289
|
+
const sub = fn && typeof fn === 'function' && Array.isArray(fn.__mcp_hooks) ? fn.__mcp_hooks : undefined;
|
|
290
|
+
// Stop expanding once `via.length` would reach the cap — at that point
|
|
291
|
+
// the current entry is treated as a leaf (Custom record without
|
|
292
|
+
// children). The slot-walker still pairs it with one slot, so output
|
|
293
|
+
// stays internally consistent.
|
|
294
|
+
if (sub && !seen.has(fn) && via.length < maxDepth) {
|
|
295
|
+
seen.add(fn);
|
|
296
|
+
out.push({ ...entry, expanded: true, via });
|
|
297
|
+
out.push(...flattenHookMeta(sub, [...via, entry.name], seen, maxDepth));
|
|
298
|
+
seen.delete(fn);
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
out.push({ ...entry, via });
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return out;
|
|
305
|
+
};
|
|
306
|
+
const flatHooksToTree = (flat) => {
|
|
307
|
+
const root = [];
|
|
308
|
+
// Stack of currently-open parents, indexed by their depth (= via.length
|
|
309
|
+
// of THEIR own entry, since their children sit at via.length + 1).
|
|
310
|
+
const parents = [];
|
|
311
|
+
for (const entry of flat) {
|
|
312
|
+
const depth = entry.via?.length ?? 0;
|
|
313
|
+
while (parents.length > depth)
|
|
314
|
+
parents.pop();
|
|
315
|
+
const node = { kind: entry.kind, name: entry.name };
|
|
316
|
+
if (entry.hook !== undefined)
|
|
317
|
+
node.hook = entry.hook;
|
|
318
|
+
if (entry.value !== undefined)
|
|
319
|
+
node.value = entry.value;
|
|
320
|
+
if (parents.length === 0) {
|
|
321
|
+
root.push(node);
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
const parent = parents[parents.length - 1];
|
|
325
|
+
if (parent) {
|
|
326
|
+
parent.children = parent.children ?? [];
|
|
327
|
+
parent.children.push(node);
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
root.push(node);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (entry.expanded) {
|
|
334
|
+
// Push as the new active parent at this depth. Subsequent entries
|
|
335
|
+
// with via.length > depth become this node's descendants.
|
|
336
|
+
parents.push(node);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return root;
|
|
340
|
+
};
|
|
341
|
+
const extractHooks = (fiber, filter) => {
|
|
342
|
+
// React's wrapper machinery makes "where does metadata live" depend on
|
|
343
|
+
// the exact HOC chain. We try the most likely homes in order:
|
|
344
|
+
//
|
|
345
|
+
// 1. `fiber.type.__mcp_hooks` — bare components, FunctionDeclarations,
|
|
346
|
+
// and the outer memo fiber when the chain is just memo(fn).
|
|
347
|
+
// 2. `fiber.elementType.__mcp_hooks` — memo(fn) without compare.
|
|
348
|
+
// React converts the fiber to SimpleMemoComponent and rewrites
|
|
349
|
+
// `fiber.type` to the inner function (see `updateMemoComponent` in
|
|
350
|
+
// ReactFabric); our metadata sits on the outer memo wrapper, which
|
|
351
|
+
// survives only on `elementType`.
|
|
352
|
+
// 3. `fiber.type.render.__mcp_hooks` — forwardRef wrapper. React lays
|
|
353
|
+
// out memo(forwardRef(fn)) as three fibers (memo → forwardRef →
|
|
354
|
+
// function). When the user queries by displayName they tend to
|
|
355
|
+
// match the middle ForwardRef fiber (whose displayName resolves
|
|
356
|
+
// via `render.displayName`); fiber.type there is the forwardRef
|
|
357
|
+
// wrapper, which holds the inner fn at `.render`. The babel plugin
|
|
358
|
+
// put plain metadata on that fn via the FunctionDecl visitor.
|
|
359
|
+
// 4. `fiber.type.type.__mcp_hooks` — memo wrapper around forwardRef
|
|
360
|
+
// (or any non-function inner). Not the SimpleMemoComponent path,
|
|
361
|
+
// so `fiber.type` stays as the memo wrapper and `.type` is the
|
|
362
|
+
// inner forwardRef / class / etc. This catches getter installations
|
|
363
|
+
// on the wrapper layer too.
|
|
364
|
+
const candidates = [
|
|
365
|
+
fiber.type,
|
|
366
|
+
fiber.elementType,
|
|
367
|
+
fiber.type?.render,
|
|
368
|
+
fiber.type?.type,
|
|
369
|
+
];
|
|
370
|
+
let rawMeta;
|
|
371
|
+
for (const c of candidates) {
|
|
372
|
+
const m = c?.__mcp_hooks;
|
|
373
|
+
if (Array.isArray(m)) {
|
|
374
|
+
rawMeta = m;
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (!Array.isArray(rawMeta))
|
|
379
|
+
return null;
|
|
380
|
+
const meta = flattenHookMeta(rawMeta, [], new WeakSet(), filter.expansionDepth);
|
|
381
|
+
const out = [];
|
|
382
|
+
let state = fiber.memoizedState;
|
|
383
|
+
let metaIdx = 0;
|
|
384
|
+
// Walk the fiber's hook chain and pair each slot with the next metadata
|
|
385
|
+
// entry whose `kind` is shape-compatible with the slot. Strongly-shaped
|
|
386
|
+
// kinds (Ref / Memo / Callback / Effect) match only the corresponding
|
|
387
|
+
// React hook shape. Permissive kinds (State / Reducer / Context / Custom)
|
|
388
|
+
// reject obvious mismatches (effect-record, ref-shape) so they don't
|
|
389
|
+
// swallow slots belonging to preceding custom hooks.
|
|
390
|
+
//
|
|
391
|
+
// For Custom-leaf entries — typically black-box library hooks
|
|
392
|
+
// (`useSelector`, `useQuery`, etc.) where flattenHookMeta couldn't expand
|
|
393
|
+
// because `fn.__mcp_hooks` was missing — we estimate slot count via
|
|
394
|
+
// `countHookSlots` and advance the fiber chain by that many slots in one
|
|
395
|
+
// step. Without this, a hook that consumes 3 internal slots only
|
|
396
|
+
// advances by 1 in the walker, drifting all trailing entries off the end
|
|
397
|
+
// of the chain.
|
|
398
|
+
const emitEntry = (entry, rawValueSlot) => {
|
|
399
|
+
const { hook, kind, name, via } = entry;
|
|
400
|
+
const passesKind = !filter.kindsSet || filter.kindsSet.has(kind);
|
|
401
|
+
const passesName = !filter.nameMatchers ||
|
|
402
|
+
filter.nameMatchers.some((m) => {
|
|
403
|
+
return m(name);
|
|
404
|
+
});
|
|
405
|
+
if (!(passesKind && passesName))
|
|
406
|
+
return;
|
|
407
|
+
const record = { kind, name };
|
|
408
|
+
// Prefer the babel-emitted hook name; fall back to fn.name for entries
|
|
409
|
+
// produced by older bundles that predate the `hook` field.
|
|
410
|
+
const resolvedHook = hook ?? (typeof entry.fn === 'function' ? entry.fn.name : undefined);
|
|
411
|
+
if (resolvedHook)
|
|
412
|
+
record.hook = resolvedHook;
|
|
413
|
+
if (filter.withValues && rawValueSlot !== undefined) {
|
|
414
|
+
// Redaction guard: mask the value (but keep kind/name/hook visible)
|
|
415
|
+
// when the entry's name OR any ancestor in `via` matches a redact
|
|
416
|
+
// pattern. Catches both direct sensitive hooks (`password` State)
|
|
417
|
+
// and leaves nested under sensitive customs (a `value` field of
|
|
418
|
+
// `useCredentials()` won't slip through).
|
|
419
|
+
const isRedacted = (0, redact_1.matchesAnyRedactPattern)(name, filter.redactPatterns) ||
|
|
420
|
+
(via?.some((v) => {
|
|
421
|
+
return (0, redact_1.matchesAnyRedactPattern)(v, filter.redactPatterns);
|
|
422
|
+
}) ??
|
|
423
|
+
false);
|
|
424
|
+
if (isRedacted) {
|
|
425
|
+
record.value = redact_1.REDACTED_VALUE;
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
let value;
|
|
429
|
+
try {
|
|
430
|
+
// Kind-aware extraction (Ref's .current, Memo's first slot, ...)
|
|
431
|
+
// returns RAW. Then project with the user-given hook-value options
|
|
432
|
+
// (path / depth / maxBytes from select.hooks). Default depth=1 so
|
|
433
|
+
// each hook value stays compact even when withValues:true.
|
|
434
|
+
const extracted = serializeHookValue(rawValueSlot, kind);
|
|
435
|
+
value = (0, utils_1.projectFiberValue)(extracted, {
|
|
436
|
+
depth: filter.valueDepth ?? 1,
|
|
437
|
+
maxBytes: filter.valueMaxBytes,
|
|
438
|
+
path: filter.valuePath,
|
|
439
|
+
});
|
|
440
|
+
// Final cycle / non-serialisable check — the MCP bridge will
|
|
441
|
+
// stringify this for transport, so bail now rather than killing
|
|
442
|
+
// the whole response if one stray value carries a cycle past our
|
|
443
|
+
// WeakSet (e.g. Proxy, lazy getter, native-bridged object).
|
|
444
|
+
JSON.stringify(value);
|
|
445
|
+
}
|
|
446
|
+
catch {
|
|
447
|
+
value = '[Unserialisable value]';
|
|
448
|
+
}
|
|
449
|
+
record.value = value;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
if (via && via.length > 0)
|
|
453
|
+
record.via = via;
|
|
454
|
+
if (entry.expanded)
|
|
455
|
+
record.expanded = true;
|
|
456
|
+
out.push(record);
|
|
457
|
+
};
|
|
458
|
+
const advanceState = (steps) => {
|
|
459
|
+
for (let i = 0; i < steps && state; i++)
|
|
460
|
+
state = state.next;
|
|
461
|
+
};
|
|
462
|
+
while (state && metaIdx < meta.length) {
|
|
463
|
+
const entry = meta[metaIdx];
|
|
464
|
+
if (!entry) {
|
|
465
|
+
metaIdx++;
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
// Expanded parent (synthetic, marks the call-site of a recursively
|
|
469
|
+
// expanded custom hook). Emit without consuming any fiber slot — the
|
|
470
|
+
// children that follow are the real slot-bearing entries.
|
|
471
|
+
if (entry.expanded) {
|
|
472
|
+
emitEntry(entry, undefined);
|
|
473
|
+
metaIdx++;
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
// Custom-leaf with a known fn → recurse into source to estimate slot
|
|
477
|
+
// count, then consume that many slots at once. The first slot's value
|
|
478
|
+
// is exposed (best approximation of "this hook's value"); the rest are
|
|
479
|
+
// skipped silently as internals of the library hook.
|
|
480
|
+
if (entry.kind === 'Custom' && typeof entry.fn === 'function') {
|
|
481
|
+
const slots = countHookSlots(entry.fn);
|
|
482
|
+
if (slots > 1) {
|
|
483
|
+
emitEntry(entry, state.memoizedState);
|
|
484
|
+
advanceState(slots);
|
|
485
|
+
metaIdx++;
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
if (!shapeMatchesKind(state.memoizedState, entry.kind)) {
|
|
490
|
+
state = state.next;
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
emitEntry(entry, state.memoizedState);
|
|
494
|
+
metaIdx++;
|
|
495
|
+
state = state.next;
|
|
496
|
+
}
|
|
497
|
+
// Any metadata entries left after the fiber chain ran dry didn't get a
|
|
498
|
+
// slot match. Emit them anyway (without value) so the agent at least
|
|
499
|
+
// sees the hook exists — this is strictly better than silently dropping,
|
|
500
|
+
// and helps debug alignment issues. Common cause: a preceding Custom
|
|
501
|
+
// hook consumed more slots than countHookSlots estimated.
|
|
502
|
+
while (metaIdx < meta.length) {
|
|
503
|
+
const entry = meta[metaIdx];
|
|
504
|
+
if (entry)
|
|
505
|
+
emitEntry(entry, undefined);
|
|
506
|
+
metaIdx++;
|
|
507
|
+
}
|
|
508
|
+
return filter.format === 'tree' ? flatHooksToTree(out) : out;
|
|
509
|
+
};
|
|
510
|
+
exports.extractHooks = extractHooks;
|
|
511
|
+
/**
|
|
512
|
+
* Normalise a raw `select.hooks` object into the strict `HooksOptions`
|
|
513
|
+
* shape the extractor walks against. Splits ambiguous fields (`depth` →
|
|
514
|
+
* `valueDepth`, etc.) and compiles name-pattern strings via
|
|
515
|
+
* `parseNamePattern`. Used by `parseProjection`.
|
|
516
|
+
*/
|
|
517
|
+
const buildHooksOptions = (raw) => {
|
|
518
|
+
return {
|
|
519
|
+
expansionDepth: typeof raw?.expansionDepth === 'number' && raw.expansionDepth >= 0
|
|
520
|
+
? Math.floor(raw.expansionDepth)
|
|
521
|
+
: Infinity,
|
|
522
|
+
format: raw?.format === 'tree' ? 'tree' : 'flat',
|
|
523
|
+
kindsSet: Array.isArray(raw?.kinds) ? new Set(raw.kinds) : null,
|
|
524
|
+
nameMatchers: Array.isArray(raw?.names) ? raw.names.map(exports.parseNamePattern) : null,
|
|
525
|
+
valueDepth: typeof raw?.depth === 'number' && raw.depth >= 0 ? raw.depth : undefined,
|
|
526
|
+
valueMaxBytes: typeof raw?.maxBytes === 'number' && raw.maxBytes >= 0 ? raw.maxBytes : undefined,
|
|
527
|
+
valuePath: typeof raw?.path === 'string' ? raw.path : undefined,
|
|
528
|
+
withValues: raw?.withValues === true,
|
|
529
|
+
};
|
|
530
|
+
};
|
|
531
|
+
exports.buildHooksOptions = buildHooksOptions;
|
|
532
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/modules/fiberTree/hooks.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,qCAAmE;AAEnE,mCAA4C;AAqE5C,yEAAyE;AACzE,4DAA4D;AACrD,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAA4B,EAAE;IACxE,MAAM,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC7C,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;QAC5B,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YACxC,OAAO,CAAC,CAAC,EAAE,EAAE;gBACX,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,CAAC,CAAC;QACJ,CAAC;QAAC,MAAM,CA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AAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;QAChD,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI;QAC/D,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,wBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI;QAChF,UAAU,EAAE,OAAO,GAAG,EAAE,KAAK,KAAK,QAAQ,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;QACpF,aAAa,EACX,OAAO,GAAG,EAAE,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;QACnF,SAAS,EAAE,OAAO,GAAG,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;QAC/D,UAAU,EAAE,GAAG,EAAE,UAAU,KAAK,IAAI;KACrC,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,iBAAiB,qBAe5B"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `select` parser — converts the agent's raw select array into a strict
|
|
3
|
+
* `Projection` object the query handler can read against. Recognises three
|
|
4
|
+
* shapes per entry:
|
|
5
|
+
* - bare string → include the named field with defaults
|
|
6
|
+
* - { field: true } → same
|
|
7
|
+
* - { field: options } → include with per-field options
|
|
8
|
+
*
|
|
9
|
+
* Heavy fields (`props`, `hooks`, `children`) take per-field option
|
|
10
|
+
* objects; light fields (mcpId / name / testID / bounds / refMethods) just
|
|
11
|
+
* toggle on. Validation of children's nested select happens inside
|
|
12
|
+
* `parseChildrenOptions` so the error surfaces with the offending field
|
|
13
|
+
* name.
|
|
14
|
+
*/
|
|
15
|
+
import { type ChildrenOptions } from './children';
|
|
16
|
+
import { type HooksOptions } from './hooks';
|
|
17
|
+
export interface PropsOptions {
|
|
18
|
+
depth?: number;
|
|
19
|
+
maxBytes?: number;
|
|
20
|
+
path?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface Projection {
|
|
23
|
+
children: ChildrenOptions | null;
|
|
24
|
+
fields: Set<string>;
|
|
25
|
+
hooks: HooksOptions;
|
|
26
|
+
props: PropsOptions;
|
|
27
|
+
}
|
|
28
|
+
export declare const QUERY_DEFAULT_FIELDS: readonly ["mcpId", "name", "testID"];
|
|
29
|
+
/**
|
|
30
|
+
* Parse the `select` arg into a flat Projection. Each element of `select`
|
|
31
|
+
* may be either a string (include the named field with default options)
|
|
32
|
+
* or an object whose keys are field names and whose values are
|
|
33
|
+
* `true` / `false` / per-field projection options.
|
|
34
|
+
*
|
|
35
|
+
* Per-field options:
|
|
36
|
+
* props: { path?, depth?, maxBytes? } — projection of the props object
|
|
37
|
+
* hooks: HooksRawOptions — kinds/names filters + withValues
|
|
38
|
+
* + path/depth/maxBytes for hook
|
|
39
|
+
* values
|
|
40
|
+
* children: number | { treeDepth?, select?, itemsCap? }
|
|
41
|
+
* — recursive light-only walker; see
|
|
42
|
+
* parseChildrenSelect for limits.
|
|
43
|
+
*
|
|
44
|
+
* Heavy fields (props, hooks) are projected handler-side with these
|
|
45
|
+
* per-field options so the rest of the response (mcpId, name, total, ...)
|
|
46
|
+
* stays raw and always visible.
|
|
47
|
+
*/
|
|
48
|
+
export declare const parseProjection: (selectArg: unknown) => Projection;
|
|
49
|
+
//# sourceMappingURL=projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../../src/modules/fiberTree/projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,YAAY,CAAC;AACxE,OAAO,EAAqB,KAAK,YAAY,EAAwB,MAAM,SAAS,CAAC;AAErF,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IACjC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,YAAY,CAAC;CACrB;AAED,eAAO,MAAM,oBAAoB,sCAAuC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,eAAe,cAAe,OAAO,KAAG,UAwCpD,CAAC"}
|