react-native-ai-debugger 1.5.2 → 1.6.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/build/__tests__/unit/toolDescriptions.test.d.ts +2 -0
- package/build/__tests__/unit/toolDescriptions.test.d.ts.map +1 -0
- package/build/__tests__/unit/toolDescriptions.test.js +145 -0
- package/build/__tests__/unit/toolDescriptions.test.js.map +1 -0
- package/build/core/guides.d.ts +7 -0
- package/build/core/guides.d.ts.map +1 -1
- package/build/core/guides.js +35 -12
- package/build/core/guides.js.map +1 -1
- package/build/core/nativeOnlyHints.js +2 -2
- package/build/core/nativeOnlyHints.js.map +1 -1
- package/build/index.d.ts +4 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1377 -1509
- package/build/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolDescriptions.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/toolDescriptions.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// Commit 6 of the MCP Tool Discoverability Rework — regression test that keeps
|
|
2
|
+
// every registered tool description above the bar set by Commits 2–5. Guards
|
|
3
|
+
// against silent regressions back to one-liners and against typos in WORKFLOW /
|
|
4
|
+
// SEE ALSO / PRIMARY / HELPER cross-references that would silently mislead
|
|
5
|
+
// agents to call tools that don't exist.
|
|
6
|
+
//
|
|
7
|
+
// See: docs/improvements/mcp-tool-discoverability-rework.md
|
|
8
|
+
// IMPORTANT: set test mode BEFORE importing src/index.ts so main() is skipped
|
|
9
|
+
// (no license check, no transport, no HTTP listener, no CDP sockets).
|
|
10
|
+
process.env.RN_AI_DEVTOOLS_TEST_MODE = "1";
|
|
11
|
+
import { describe, it, expect } from "@jest/globals";
|
|
12
|
+
import { toolRegistry } from "../../index.js";
|
|
13
|
+
// Tools exempt from the "must contain PURPOSE or WHEN TO USE" and minimum-length
|
|
14
|
+
// checks. These are meta/account/admin tools where a short description reads
|
|
15
|
+
// naturally and adding a PURPOSE line would be boilerplate. execute_in_app uses
|
|
16
|
+
// semantically equivalent headings (RECOMMENDED WORKFLOW / LIMITATIONS / GOOD
|
|
17
|
+
// examples / BAD examples) instead of PURPOSE / WHEN TO USE — see plan.
|
|
18
|
+
const SEMANTIC_ALLOWLIST = new Set([
|
|
19
|
+
"get_usage_guide",
|
|
20
|
+
"activate_license",
|
|
21
|
+
"get_license_status",
|
|
22
|
+
"delete_account",
|
|
23
|
+
"send_feedback",
|
|
24
|
+
"reset_telemetry",
|
|
25
|
+
"execute_in_app",
|
|
26
|
+
"dev",
|
|
27
|
+
]);
|
|
28
|
+
// Non-tool identifiers that appear in descriptions (prop names, JS globals,
|
|
29
|
+
// schema keys, natural-language nouns that happen to match the tool-name
|
|
30
|
+
// regex). If the cross-reference scan hits one of these it's a false positive,
|
|
31
|
+
// not a broken link. Keep this list conservative — every addition weakens the
|
|
32
|
+
// guarantee, so prefer tightening the extractor over growing this set.
|
|
33
|
+
const NON_TOOL_TOKENS = new Set([
|
|
34
|
+
// JS built-ins and common API shapes
|
|
35
|
+
"true", "false", "null", "undefined", "console", "log", "error", "warn",
|
|
36
|
+
"fetch", "require", "async", "await", "function", "return", "new",
|
|
37
|
+
"typeof", "instanceof", "string", "number", "boolean", "object", "array",
|
|
38
|
+
"map", "set", "promise", "date", "json", "regexp", "math",
|
|
39
|
+
// Common param / prop names used in example tool calls
|
|
40
|
+
"text", "query", "component", "pattern", "componentname", "testid",
|
|
41
|
+
"x", "y", "verbose", "device", "deviceid", "udid", "packagename",
|
|
42
|
+
"bundleid", "url", "uri", "method", "status", "level", "limit",
|
|
43
|
+
"offset", "depth", "maxdepth", "timeout", "force", "forcerefresh",
|
|
44
|
+
"healthcheck", "native", "strategy", "burst", "screenshot", "verify",
|
|
45
|
+
"frameindex", "groupid", "id", "structureonly", "extended", "topic",
|
|
46
|
+
"action", "tool", "args", "mode", "format", "type", "name", "value",
|
|
47
|
+
"key", "keycode", "buttons", "headers", "body", "response", "request",
|
|
48
|
+
"params", "args", "input", "output", "result", "data", "payload",
|
|
49
|
+
// DSL / English verbs that match the regex in practice
|
|
50
|
+
"e", "i", "s", "n", "t", "b", "a", "it", "is", "to", "of", "in", "on",
|
|
51
|
+
"at", "by", "or", "and", "not", "use", "see", "call", "get", "set",
|
|
52
|
+
"for", "via", "the", "its", "has", "all", "any", "ids", "file",
|
|
53
|
+
// Schema / MCP things
|
|
54
|
+
"isolated_vm", "isolated", "vm", "hermes", "jsc", "metro", "rn",
|
|
55
|
+
"ios", "android", "cdp", "sdk", "ui", "ocr",
|
|
56
|
+
// Verb-ish tokens used before "(" in English prose
|
|
57
|
+
"returns", "includes", "uses", "uses_", "works", "tries", "prefers",
|
|
58
|
+
"matches", "triggers", "scans", "parses", "reads", "writes", "sends",
|
|
59
|
+
"sets", "gets", "checks", "detects", "enables", "disables", "skips",
|
|
60
|
+
"supports", "handles", "captures", "adds", "removes", "runs", "is",
|
|
61
|
+
"becomes", "executes", "fires", "emits", "wakes",
|
|
62
|
+
"e.g", "i.e", "eg", "ie",
|
|
63
|
+
// Connector words used in "prefer <word>" matches that aren't tool names
|
|
64
|
+
"the", "this", "that", "these", "those",
|
|
65
|
+
// Method-style identifiers appearing as examples
|
|
66
|
+
"measureinwindow", "onpress", "onchangetext", "onfocus",
|
|
67
|
+
]);
|
|
68
|
+
describe("Tool descriptions (registration enforcement)", () => {
|
|
69
|
+
const tools = Array.from(toolRegistry.entries()).map(([name, { config }]) => ({
|
|
70
|
+
name,
|
|
71
|
+
description: String(config?.description ?? ""),
|
|
72
|
+
}));
|
|
73
|
+
it("registers a non-trivial number of tools", () => {
|
|
74
|
+
// Current count is ~60-70; a big drop would almost certainly be a bug.
|
|
75
|
+
expect(tools.length).toBeGreaterThan(30);
|
|
76
|
+
});
|
|
77
|
+
describe("each tool has a rich description", () => {
|
|
78
|
+
it.each(tools.map((t) => [t.name, t]))("%s", (_name, tool) => {
|
|
79
|
+
const { name, description } = tool;
|
|
80
|
+
expect(description.length).toBeGreaterThan(0);
|
|
81
|
+
expect(description.length).toBeLessThanOrEqual(1500);
|
|
82
|
+
if (!SEMANTIC_ALLOWLIST.has(name)) {
|
|
83
|
+
// Minimum length protects against regressions to one-liners.
|
|
84
|
+
expect(description.length).toBeGreaterThanOrEqual(120);
|
|
85
|
+
// Must contain a PURPOSE or WHEN TO USE anchor so the agent
|
|
86
|
+
// can scan for intent before reading the whole description.
|
|
87
|
+
const hasPurposeAnchor = description.includes("PURPOSE") || description.includes("WHEN TO USE");
|
|
88
|
+
expect(hasPurposeAnchor).toBe(true);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
it("cross-references only point to registered tool names", () => {
|
|
93
|
+
const registered = new Set(tools.map((t) => t.name));
|
|
94
|
+
// Lines whose trailing content is a comma/space separated list of tool
|
|
95
|
+
// names. These are the high-signal structured lines from the template.
|
|
96
|
+
const ANCHOR_RE = /^(WORKFLOW|SEE ALSO|PRIMARY|HELPER|PLATFORM FALLBACK|PREFER|PREFERRED)\s*[:=-]/i;
|
|
97
|
+
const unknown = [];
|
|
98
|
+
for (const { name, description } of tools) {
|
|
99
|
+
for (const rawLine of description.split(/\r?\n/)) {
|
|
100
|
+
const line = rawLine.trim();
|
|
101
|
+
if (!ANCHOR_RE.test(line))
|
|
102
|
+
continue;
|
|
103
|
+
// Extract backtick-quoted identifiers and bare `name(` forms.
|
|
104
|
+
const tokens = new Set();
|
|
105
|
+
for (const m of line.matchAll(/`([a-z_][a-z0-9_]+)`/gi))
|
|
106
|
+
tokens.add(m[1]);
|
|
107
|
+
for (const m of line.matchAll(/([a-z_][a-z0-9_]+)\s*\(/gi))
|
|
108
|
+
tokens.add(m[1]);
|
|
109
|
+
for (const token of tokens) {
|
|
110
|
+
const lower = token.toLowerCase();
|
|
111
|
+
if (registered.has(token))
|
|
112
|
+
continue;
|
|
113
|
+
if (NON_TOOL_TOKENS.has(lower))
|
|
114
|
+
continue;
|
|
115
|
+
// Heuristic: must look like a tool name (snake_case with an
|
|
116
|
+
// underscore or a known cross-platform primary). Single
|
|
117
|
+
// words like "prefer" are filtered out here.
|
|
118
|
+
if (!token.includes("_") && !registered.has(token)) {
|
|
119
|
+
// Could still be "tap" / "logbox" etc — only flag if
|
|
120
|
+
// it's also not a registered name.
|
|
121
|
+
if (!registered.has(token))
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
unknown.push({ tool: name, token, line });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (unknown.length > 0) {
|
|
129
|
+
const msg = unknown
|
|
130
|
+
.map((u) => ` ${u.tool}: unknown "${u.token}" in "${u.line}"`)
|
|
131
|
+
.join("\n");
|
|
132
|
+
throw new Error(`Cross-reference check failed — the following tokens look like tool names in structured lines but are not registered:\n${msg}`);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
it("logs total tools/list payload size (informational)", () => {
|
|
136
|
+
const totalBytes = tools
|
|
137
|
+
.map((t) => JSON.stringify({ name: t.name, description: t.description }).length)
|
|
138
|
+
.reduce((a, b) => a + b, 0);
|
|
139
|
+
// eslint-disable-next-line no-console
|
|
140
|
+
console.log(`[tool-descriptions] total tools/list payload: ${totalBytes} bytes across ${tools.length} tools`);
|
|
141
|
+
// Sanity upper bound — not a strict cap, just to catch runaway growth.
|
|
142
|
+
expect(totalBytes).toBeLessThan(500_000);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
//# sourceMappingURL=toolDescriptions.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolDescriptions.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/toolDescriptions.test.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6EAA6E;AAC7E,gFAAgF;AAChF,2EAA2E;AAC3E,yCAAyC;AACzC,EAAE;AACF,4DAA4D;AAE5D,8EAA8E;AAC9E,sEAAsE;A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,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC1D,MAAM,UAAU,GAAG,KAAK;aACnB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;aAC/E,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAChC,sCAAsC;QACtC,OAAO,CAAC,GAAG,CACP,iDAAiD,UAAU,iBAAiB,KAAK,CAAC,MAAM,QAAQ,CACnG,CAAC;QACF,uEAAuE;QACvE,MAAM,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/build/core/guides.d.ts
CHANGED
|
@@ -8,6 +8,13 @@ export interface Guide {
|
|
|
8
8
|
summary: string;
|
|
9
9
|
content: string;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Shared quick decision tree body — embedded into the MCP server-level
|
|
13
|
+
* `instructions` field (src/index.ts) AND into `getGuideOverview()` so agents
|
|
14
|
+
* see identical guidance regardless of whether their client surfaces
|
|
15
|
+
* `instructions`. Keep this as the single source of truth.
|
|
16
|
+
*/
|
|
17
|
+
export declare const DECISION_TREE: string;
|
|
11
18
|
export declare function getGuideOverview(): string;
|
|
12
19
|
export declare function getGuideByTopic(topic: string): string | null;
|
|
13
20
|
export declare function getAvailableTopics(): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guides.d.ts","sourceRoot":"","sources":["../../src/core/guides.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,KAAK;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"guides.d.ts","sourceRoot":"","sources":["../../src/core/guides.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,KAAK;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACnB;AA+SD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,MAchB,CAAC;AAEb,wBAAgB,gBAAgB,IAAI,MAAM,CAWzC;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI5D;AAED,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CAE7C"}
|
package/build/core/guides.js
CHANGED
|
@@ -10,7 +10,7 @@ const guides = [
|
|
|
10
10
|
content: `# Session Setup
|
|
11
11
|
|
|
12
12
|
## Prerequisites (CRITICAL — install BEFORE using device tools)
|
|
13
|
-
- **iOS UI driver (required for tap,
|
|
13
|
+
- **iOS UI driver (required for tap, ios_button, and all iOS interaction tools):**
|
|
14
14
|
- Recommended: AXe — brew install cameroncooke/axe/axe (then set IOS_DRIVER=axe in MCP server env)
|
|
15
15
|
- Alternative: IDB — brew install idb-companion (used by default)
|
|
16
16
|
- Without a UI driver, most iOS tools will fail with "not installed" errors
|
|
@@ -105,7 +105,7 @@ const guides = [
|
|
|
105
105
|
content: `# Device Interaction
|
|
106
106
|
|
|
107
107
|
## Prerequisites
|
|
108
|
-
iOS interaction tools (tap,
|
|
108
|
+
iOS interaction tools (tap, ios_button) require a UI driver:
|
|
109
109
|
- Recommended: AXe — brew install cameroncooke/axe/axe (set IOS_DRIVER=axe in MCP server env)
|
|
110
110
|
- Alternative: IDB — brew install idb-companion (default)
|
|
111
111
|
Without a UI driver installed, these tools will fail.
|
|
@@ -140,13 +140,12 @@ For buttons that contain only an icon (no text):
|
|
|
140
140
|
tap(text=...) skips fiber for non-ASCII (Hermes limitation) and uses accessibility/OCR instead. For best results, use testID or coordinates.
|
|
141
141
|
|
|
142
142
|
## Other Interactions
|
|
143
|
-
-
|
|
144
|
-
-
|
|
143
|
+
- android_swipe: swipe/scroll with start/end coordinates
|
|
144
|
+
- android_input_text: type text (tap input field first; on iOS use tap(testID=...) to focus, then native keyboard)
|
|
145
145
|
- ios_button / android_key_event: hardware buttons (HOME, BACK, etc.)
|
|
146
146
|
- ios_open_url: deep links and universal links
|
|
147
147
|
|
|
148
148
|
## After Interactions
|
|
149
|
-
- ios_wait_for_element / android_wait_for_element: wait for UI to update
|
|
150
149
|
- Take a screenshot to verify the result`
|
|
151
150
|
},
|
|
152
151
|
{
|
|
@@ -303,14 +302,38 @@ If the user wants to share feedback, request a feature, or report a problem with
|
|
|
303
302
|
- No GitHub account setup or CLI tools needed — just a browser`
|
|
304
303
|
}
|
|
305
304
|
];
|
|
305
|
+
/**
|
|
306
|
+
* Shared quick decision tree body — embedded into the MCP server-level
|
|
307
|
+
* `instructions` field (src/index.ts) AND into `getGuideOverview()` so agents
|
|
308
|
+
* see identical guidance regardless of whether their client surfaces
|
|
309
|
+
* `instructions`. Keep this as the single source of truth.
|
|
310
|
+
*/
|
|
311
|
+
export const DECISION_TREE = [
|
|
312
|
+
"Primary tools: scan_metro, get_logs / search_logs, ios_screenshot / android_screenshot, tap, get_pressable_elements, get_screen_layout.",
|
|
313
|
+
"Platform-specific ios_* / android_* tools (ios_button, android_swipe, android_input_text, android_key_event, android_long_press, ios_open_url, etc.) are FALLBACKS for non-React or native-only flows — prefer the cross-platform primary tools above whenever possible.",
|
|
314
|
+
"",
|
|
315
|
+
"Call get_usage_guide(topic=...) for end-to-end workflows. Available topics:",
|
|
316
|
+
" setup — session setup (scan_metro, connect_metro, ensure_connection)",
|
|
317
|
+
" logs — console debugging (get_logs, search_logs)",
|
|
318
|
+
" interact — device interaction (tap, android_swipe, screenshots, android_input_text)",
|
|
319
|
+
" layout — on-screen layout check (get_screen_layout, get_pressable_elements)",
|
|
320
|
+
" inspect — component inspection (find_components, inspect_component, get_inspector_selection)",
|
|
321
|
+
" network — network request inspection (get_network_requests, search_network)",
|
|
322
|
+
" state — app state & JS execution (execute_in_app, list_debug_globals)",
|
|
323
|
+
" bundle — bundle / Metro error checks (get_bundle_status, get_bundle_errors)",
|
|
324
|
+
" feedback — share feedback, feature requests, or bug reports (send_feedback)"
|
|
325
|
+
].join("\n");
|
|
306
326
|
export function getGuideOverview() {
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
327
|
+
const guideList = guides.map((g) => ` ${g.id} — ${g.summary}`).join("\n");
|
|
328
|
+
return `Quick decision tree
|
|
329
|
+
-------------------
|
|
330
|
+
${DECISION_TREE}
|
|
331
|
+
|
|
332
|
+
Available usage guides:
|
|
333
|
+
|
|
334
|
+
${guideList}
|
|
335
|
+
|
|
336
|
+
Call get_usage_guide with a topic parameter for the full guide.`;
|
|
314
337
|
}
|
|
315
338
|
export function getGuideByTopic(topic) {
|
|
316
339
|
const guide = guides.find((g) => g.id === topic.toLowerCase());
|
package/build/core/guides.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guides.js","sourceRoot":"","sources":["../../src/core/guides.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,MAAM,MAAM,GAAY;IACpB;QACI,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,eAAe;QACtB,OAAO,EAAE,yDAAyD;QAClE,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CA8B8B;KAC1C;IACD;QACI,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,sBAAsB;QAC7B,OAAO,EAAE,mFAAmF;QAC5F,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;iGAoBgF;KAC5F;IACD;QACI,EAAE,EAAE,QAAQ;QACZ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CAAC;AAED,MAAM,UAAU,kBAAkB;IAC9B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -23,8 +23,8 @@ const NATIVE_FALLBACKS = {
|
|
|
23
23
|
search_network: [],
|
|
24
24
|
get_network_stats: [],
|
|
25
25
|
get_request_details: [],
|
|
26
|
-
get_screen_layout: [
|
|
27
|
-
get_inspector_selection: [
|
|
26
|
+
get_screen_layout: [],
|
|
27
|
+
get_inspector_selection: [],
|
|
28
28
|
};
|
|
29
29
|
export function buildMetroMissingHint({ toolName, devices }) {
|
|
30
30
|
const fallbacks = NATIVE_FALLBACKS[toolName] ?? [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeOnlyHints.js","sourceRoot":"","sources":["../../src/core/nativeOnlyHints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,UAAU,QAAQ;IACpB,OAAO,aAAa,CAAC,IAAI,GAAG,CAAC,CAAC;AAClC,CAAC;AAQD,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACrC,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC/C,8BAA8B,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;QAClD,uBAAuB,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;KAC9C,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC;IACtB,MAAM,OAAO,GAAG,CAAC,CAAC,aAAa,CAAC;IAChC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,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,GAAG,MAAM,mBAAmB,EAAE,CAAC;IAC5C,OAAO,MAAM,GAAG,qBAAqB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;AACjE,CAAC"}
|
package/build/index.d.ts
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAmUA,eAAO,MAAM,YAAY;YAA6B,GAAG;aAAW,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC;EAAK,CAAC"}
|