@logbrew/react-native 0.1.39 → 0.1.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +3 -3
  2. package/android-native-diagnostics.d.ts +15 -5
  3. package/android-native-diagnostics.js +170 -94
  4. package/apollo.cjs +435 -226
  5. package/apollo.d.cts +2 -70
  6. package/apollo.d.ts +24 -12
  7. package/apollo.js +438 -221
  8. package/apple-native-diagnostics-config.js +176 -0
  9. package/apple-native-diagnostics-context.js +232 -0
  10. package/apple-native-diagnostics-module.js +229 -0
  11. package/apple-native-diagnostics.d.ts +42 -11
  12. package/apple-native-diagnostics.js +60 -389
  13. package/expo.cjs +29 -16
  14. package/expo.d.ts +10 -9
  15. package/expo.js +4 -3
  16. package/fatal-admission.cjs +113 -0
  17. package/fatal-record.cjs +317 -0
  18. package/fatal-replay.cjs +297 -508
  19. package/global-errors-capture.cjs +369 -0
  20. package/global-errors-event.cjs +174 -0
  21. package/global-errors-support.cjs +128 -0
  22. package/global-errors.cjs +75 -351
  23. package/global-errors.d.cts +29 -278
  24. package/global-errors.d.ts +57 -27
  25. package/global-errors.js +7 -2
  26. package/global-errors.native.js +83 -48
  27. package/index-breadcrumbs.cjs +139 -0
  28. package/index-errors.cjs +167 -0
  29. package/index-events.cjs +365 -0
  30. package/index-navigation.cjs +327 -0
  31. package/index-random.cjs +120 -0
  32. package/index-react.cjs +189 -0
  33. package/index-spans.cjs +190 -0
  34. package/index-trace-fetch.cjs +322 -0
  35. package/index-trace.cjs +335 -0
  36. package/index-transport.cjs +201 -0
  37. package/index-values.cjs +232 -0
  38. package/index.cjs +97 -1245
  39. package/index.d.cts +2 -505
  40. package/index.d.ts +130 -469
  41. package/index.native.d.ts +146 -22
  42. package/index.native.js +184 -159
  43. package/instrumentation-fetch.cjs +113 -0
  44. package/instrumentation-install.cjs +241 -0
  45. package/instrumentation-runtime.cjs +65 -0
  46. package/instrumentation-teardown.cjs +93 -0
  47. package/instrumentation-values.cjs +282 -0
  48. package/instrumentation-xhr-request.cjs +298 -0
  49. package/instrumentation-xhr.cjs +233 -0
  50. package/instrumentation.cjs +110 -599
  51. package/instrumentation.d.cts +2 -84
  52. package/instrumentation.d.ts +22 -8
  53. package/ios/AppleDiagnostics/LBRNAppleNativeDiagnostics.swift +1 -1
  54. package/ios/GeneratedAppleDiagnostics/LogBrew/DeliveryLifecycle.swift +1 -1
  55. package/ios/GeneratedAppleDiagnostics/SOURCE-MANIFEST.json +1 -1
  56. package/lifecycle.cjs +181 -78
  57. package/lifecycle.d.cts +1 -50
  58. package/lifecycle.d.ts +17 -6
  59. package/metadata.cjs +279 -114
  60. package/metro-debug-id.cjs +296 -0
  61. package/metro-serializer.cjs +219 -0
  62. package/metro.cjs +153 -297
  63. package/metro.d.cts +2 -57
  64. package/metro.d.ts +27 -13
  65. package/metro.js +2 -3
  66. package/native-bridge-async.cjs +165 -0
  67. package/native-bridge-scope.cjs +148 -0
  68. package/native-bridge.cjs +83 -186
  69. package/native-bridge.d.cts +2 -94
  70. package/native-bridge.d.ts +28 -15
  71. package/native-client-bindings.js +230 -0
  72. package/native-diagnostics-values.js +120 -0
  73. package/native-module-lookup.js +31 -0
  74. package/native-null.js +3 -0
  75. package/null-value.cjs +4 -0
  76. package/package.json +43 -1
  77. package/persistent-delivery-store.js +247 -0
  78. package/persistent-delivery.native.js +183 -261
  79. package/promise-rejection-handlers.cjs +368 -0
  80. package/promise-rejections.cjs +169 -361
  81. package/react-native.config.js +3 -1
  82. package/release-artifacts-files.cjs +94 -0
  83. package/release-artifacts-options.cjs +182 -0
  84. package/release-artifacts.cjs +278 -207
  85. package/release-artifacts.d.cts +2 -55
  86. package/release-artifacts.d.ts +18 -7
  87. package/release-artifacts.js +2 -4
  88. package/resource-fetch-graphql.cjs +265 -0
  89. package/resource-fetch-size.cjs +156 -0
  90. package/resource-fetch.cjs +227 -428
  91. package/resource-fetch.d.cts +1 -60
  92. package/resource-fetch.d.ts +17 -6
  93. package/scripts/sync-apple-native-sources.mjs +101 -53
  94. package/types/capture.d.ts +95 -0
  95. package/types/config.d.ts +85 -0
  96. package/types/defaults.d.ts +55 -0
  97. package/types/events.d.ts +203 -0
  98. package/types/provider.d.ts +81 -0
  99. package/types/trace.d.ts +104 -0
package/metadata.cjs CHANGED
@@ -1,5 +1,12 @@
1
1
  "use strict";
2
2
 
3
+ const { NULL_VALUE } = require("./null-value.cjs");
4
+
5
+ /**
6
+ * @import { IssueExceptionChain, IssueExceptionChainEntry, IssueStackFrame, Metadata, MetadataValue } from "@logbrew/sdk"
7
+ * @typedef {(metadata: Readonly<Record<string, unknown>>) => Metadata} CompactMetadata
8
+ */
9
+
3
10
  const SENSITIVE_METADATA_FACTORY_KEY_RE = new RegExp([
4
11
  "body",
5
12
  "payload",
@@ -7,187 +14,345 @@ const SENSITIVE_METADATA_FACTORY_KEY_RE = new RegExp([
7
14
  "header",
8
15
  "authorization",
9
16
  "cookie",
10
- "to\u006ben",
11
- "sec\u0072et",
12
- "pass\u0077ord"
17
+ "token",
18
+ "secret",
19
+ "password"
13
20
  ].join("|"), "u");
14
21
  const REACT_NATIVE_DEBUG_ID_REGISTRY = Symbol.for("@logbrew/react-native/debug-ids");
15
22
  const SAFE_RELEASE_ARTIFACT_DEBUG_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;
16
23
  const MAX_REACT_NATIVE_DEBUG_ID_REGISTRY_ENTRIES = 64;
17
24
  const MAX_REACT_NATIVE_DEBUG_ID_REGISTRY_FRAMES = 128;
18
25
  const GENERIC_REACT_NATIVE_FRAME_FUNCTION = /^(?:<anonymous>|anonymous|apply|call|eval|global code|native|next)$/iu;
26
+ const GROUPING_KEY_RE = /^(?<kind>[^:]+):(?<scope>[^:]+):(?<location>.+)$/u;
27
+ const POSITIVE_INTEGER_RE = /^[1-9]\d*$/u;
28
+ const NO_ITEMS = 0;
29
+ const FIRST = 0;
30
+ const STEP = 1;
31
+ const AT_PREFIX_LENGTH = 3;
32
+ const MIN_LOCATION_PARTS = 3;
33
+ const NOT_FOUND = -1;
34
+ /** @type {readonly Readonly<IssueStackFrame>[]} */
35
+ const DEFAULT_STACK_FRAMES = Object.freeze([]);
19
36
 
20
- function createSafeReactNativeMetadata(metadata, metadataFactory, context) {
21
- if (typeof metadataFactory !== "function") {
22
- return metadata;
23
- }
24
- return {
25
- ...metadata,
26
- ...safeReactNativeMetadataFactoryResult(metadataFactory(context))
27
- };
37
+ /**
38
+ * @param {unknown} value
39
+ * @returns {value is Readonly<Record<string, unknown>>}
40
+ */
41
+ function isRecord(value) {
42
+ return typeof value === "object" && value !== null;
43
+ }
44
+
45
+ /**
46
+ * @param {unknown} value
47
+ * @returns {value is (context: unknown) => unknown}
48
+ */
49
+ function isMetadataFactory(value) {
50
+ return typeof value === "function";
51
+ }
52
+
53
+ /**
54
+ * @param {readonly Readonly<IssueStackFrame>[] | undefined} value
55
+ * @returns {value is readonly Readonly<IssueStackFrame>[]}
56
+ */
57
+ function isFrameList(value) {
58
+ return Array.isArray(value);
59
+ }
60
+
61
+ /**
62
+ * @param {unknown} value
63
+ * @returns {value is MetadataValue}
64
+ */
65
+ function isMetadataValue(value) {
66
+ return value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
28
67
  }
29
68
 
69
+ /**
70
+ * @param {unknown} key
71
+ * @returns {boolean}
72
+ */
73
+ function isSensitiveMetadataKey(key) {
74
+ return SENSITIVE_METADATA_FACTORY_KEY_RE.test(String(key).toLowerCase());
75
+ }
76
+
77
+ /**
78
+ * @param {unknown} candidate
79
+ * @returns {Metadata}
80
+ */
30
81
  function safeReactNativeMetadataFactoryResult(candidate) {
31
- if (!candidate || typeof candidate !== "object" || Array.isArray(candidate)) {
82
+ if (!isRecord(candidate) || Array.isArray(candidate)) {
32
83
  return {};
33
84
  }
85
+ /** @type {Metadata} */
34
86
  const metadata = {};
35
87
  for (const [key, value] of Object.entries(candidate)) {
36
- if (isSensitiveMetadataKey(key)) {
37
- continue;
38
- }
39
- if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
88
+ if (!isSensitiveMetadataKey(key) && isMetadataValue(value)) {
40
89
  metadata[key] = value;
41
90
  }
42
91
  }
43
92
  return metadata;
44
93
  }
45
94
 
95
+ /**
96
+ * @param {Readonly<Metadata> | undefined} metadata
97
+ * @param {unknown} metadataFactory
98
+ * @param {unknown} context
99
+ * @returns {Readonly<Metadata> | undefined}
100
+ */
101
+ function createSafeReactNativeMetadata(metadata, metadataFactory, context) {
102
+ if (!isMetadataFactory(metadataFactory)) {
103
+ return metadata;
104
+ }
105
+ return {
106
+ ...metadata,
107
+ ...safeReactNativeMetadataFactoryResult(metadataFactory(context))
108
+ };
109
+ }
110
+
111
+ /**
112
+ * @param {string} path
113
+ * @returns {string}
114
+ */
115
+ function stripQueryAndHash(path) {
116
+ return (path.split(/[?#]/u, STEP)[FIRST] ?? "").replaceAll("\\", "/");
117
+ }
118
+
119
+ /**
120
+ * @param {string} value
121
+ * @returns {string}
122
+ */
123
+ function urlPathname(value) {
124
+ const URLConstructor = globalThis.URL;
125
+ if (typeof URLConstructor !== "function") {
126
+ return stripQueryAndHash(value);
127
+ }
128
+ try {
129
+ return new URLConstructor(value).pathname || value;
130
+ } catch {
131
+ return stripQueryAndHash(value);
132
+ }
133
+ }
134
+
135
+ /**
136
+ * @param {unknown} value
137
+ * @returns {string | undefined}
138
+ */
139
+ function reactNativeCodePath(value) {
140
+ if (typeof value !== "string" || value.trim() === "") {
141
+ return undefined;
142
+ }
143
+ const path = urlPathname(value.trim());
144
+ if (/^[A-Za-z]:\//u.test(path) || /^\/(?:Users|home|private|tmp|var)\//u.test(path)) {
145
+ const trimmed = path.replace(/\/+$/u, "");
146
+ return trimmed.slice(trimmed.lastIndexOf("/") + STEP) || undefined;
147
+ }
148
+ return path || undefined;
149
+ }
150
+
151
+ /**
152
+ * @param {string | undefined} path
153
+ * @param {readonly Readonly<IssueStackFrame>[]} [stackFrames]
154
+ * @returns {string | undefined}
155
+ */
156
+ function reactNativeGroupingIdentity(path, stackFrames = DEFAULT_STACK_FRAMES) {
157
+ if (path !== "/" || stackFrames.length === NO_ITEMS) {
158
+ return path;
159
+ }
160
+ const named = stackFrames.find(({ function: name }) => name !== undefined && name !== "" && !GENERIC_REACT_NATIVE_FRAME_FUNCTION.test(name));
161
+ if (named) {
162
+ return `function=${String(named.function)}`;
163
+ }
164
+ const frame = stackFrames[FIRST];
165
+ return `position=${String(frame?.line)}:${String(frame?.column)}`;
166
+ }
167
+
168
+ /**
169
+ * @param {Readonly<Metadata> | undefined} metadata
170
+ * @param {CompactMetadata} compactMetadata
171
+ * @param {readonly Readonly<IssueStackFrame>[] | undefined} stackFrames
172
+ * @returns {Metadata}
173
+ */
46
174
  function sanitizeReactNativeIssueMetadata(metadata, compactMetadata, stackFrames) {
175
+ /** @type {Record<string, unknown>} */
47
176
  const next = { ...metadata };
48
177
  for (const key of ["errorFrameFile", "releaseArtifactCodeFile"]) {
49
178
  next[key] = reactNativeCodePath(next[key]) ?? next[key];
50
179
  }
51
- const match = typeof next.issueGroupingKey === "string" ? next.issueGroupingKey.match(/^([^:]+):([^:]+):(.+)$/u) : null;
52
- const identity = match ? reactNativeGroupingIdentity(reactNativeCodePath(match[3]), stackFrames) : undefined;
53
- if (identity) {
54
- next.issueGroupingKey = `${match[1]}:${match[2]}:${identity}`;
180
+ const groupingKey = next["issueGroupingKey"];
181
+ const groups = typeof groupingKey === "string" ? GROUPING_KEY_RE.exec(groupingKey)?.groups : undefined;
182
+ const identity = groups ? reactNativeGroupingIdentity(reactNativeCodePath(groups["location"]), stackFrames) : undefined;
183
+ if (groups && identity !== undefined && identity !== "") {
184
+ next["issueGroupingKey"] = `${String(groups["kind"])}:${String(groups["scope"])}:${identity}`;
55
185
  }
56
186
  return compactMetadata(next);
57
187
  }
58
188
 
59
- function reactNativeGroupingIdentity(path, stackFrames = []) {
60
- if (path !== "/" || stackFrames.length === 0) {
61
- return path;
62
- }
63
- const named = stackFrames.find(({ function: name }) => name && !GENERIC_REACT_NATIVE_FRAME_FUNCTION.test(name));
64
- const frame = named ?? stackFrames[0];
65
- return named ? `function=${named.function}`
66
- : `position=${frame.line}:${frame.column}`;
67
- }
68
-
189
+ /**
190
+ * @param {readonly Readonly<IssueStackFrame>[] | undefined} stackFrames
191
+ * @returns {IssueStackFrame[] | undefined}
192
+ */
69
193
  function sanitizeReactNativeIssueStackFrames(stackFrames) {
70
- if (!Array.isArray(stackFrames)) {
194
+ if (!isFrameList(stackFrames)) {
71
195
  return undefined;
72
196
  }
73
- return stackFrames.map((frame) => ({
197
+ return stackFrames.map(frame => ({
74
198
  ...frame,
75
199
  filename: reactNativeCodePath(frame.filename) ?? frame.filename
76
200
  }));
77
201
  }
78
202
 
203
+ /**
204
+ * @param {IssueExceptionChain | undefined} exceptionChain
205
+ * @returns {IssueExceptionChain | undefined}
206
+ */
79
207
  function sanitizeReactNativeIssueExceptionChain(exceptionChain) {
80
208
  if (!exceptionChain || !Array.isArray(exceptionChain.entries)) {
81
209
  return undefined;
82
210
  }
83
211
  return {
84
212
  ...exceptionChain,
85
- entries: exceptionChain.entries.map((entry) => {
213
+ entries: exceptionChain.entries.map(entry => {
86
214
  const stackFrames = sanitizeReactNativeIssueStackFrames(entry.stackFrames);
87
- return {
215
+ /** @type {IssueExceptionChainEntry} */
216
+ const sanitized = {
88
217
  ...entry,
89
218
  ...(stackFrames ? { stackFrames } : {})
90
219
  };
220
+ return sanitized;
91
221
  })
92
222
  };
93
223
  }
94
224
 
95
- function runtimeReactNativeDebugIdMap() {
96
- try {
97
- const registry = globalThis?.[REACT_NATIVE_DEBUG_ID_REGISTRY];
98
- if (!registry || Array.isArray(registry) || typeof registry !== "object") {
99
- return undefined;
100
- }
101
- const entries = Object.entries(registry);
102
- if (entries.length === 0 || entries.length > MAX_REACT_NATIVE_DEBUG_ID_REGISTRY_ENTRIES) {
103
- return undefined;
104
- }
105
- const debugIdMap = Object.create(null);
106
- let frameCount = 0;
107
- for (const [stack, debugId] of entries) {
108
- if (typeof debugId !== "string" || !SAFE_RELEASE_ARTIFACT_DEBUG_ID.test(debugId)) {
109
- return undefined;
110
- }
111
- const normalizedDebugId = debugId.toLowerCase();
112
- let stackFrameCount = 0;
113
- for (const line of stack.split(/\r?\n/u)) {
114
- const filename = runtimeStackFrameFilename(line);
115
- if (!filename) {
116
- continue;
117
- }
118
- frameCount += 1;
119
- stackFrameCount += 1;
120
- if (frameCount > MAX_REACT_NATIVE_DEBUG_ID_REGISTRY_FRAMES) {
121
- return undefined;
122
- }
123
- const existingDebugId = debugIdMap[filename];
124
- if (existingDebugId && existingDebugId !== normalizedDebugId) {
125
- return undefined;
126
- }
127
- debugIdMap[filename] = normalizedDebugId;
128
- }
129
- if (stackFrameCount === 0) {
130
- return undefined;
131
- }
132
- }
133
- return frameCount > 0 ? debugIdMap : undefined;
134
- } catch {
135
- return undefined;
225
+ /**
226
+ * @param {string} rawLine
227
+ * @returns {string}
228
+ */
229
+ function stackFrameLocation(rawLine) {
230
+ const location = rawLine.trim();
231
+ if (location.startsWith("at ")) {
232
+ const inner = location.slice(AT_PREFIX_LENGTH).trim();
233
+ return inner.endsWith(")") && inner.includes("(") ? inner.slice(inner.lastIndexOf("(") + STEP, NOT_FOUND) : inner;
136
234
  }
235
+ return location.includes("@") ? location.slice(location.lastIndexOf("@") + STEP) : location;
137
236
  }
138
237
 
139
- function isSensitiveMetadataKey(key) {
140
- return SENSITIVE_METADATA_FACTORY_KEY_RE.test(String(key).toLowerCase());
141
- }
142
-
143
- function runtimeStackFrameFilename(rawLine) {
144
- let location = typeof rawLine === "string" ? rawLine.trim() : "";
145
- if (!location) {
146
- return undefined;
147
- }
148
- if (location.startsWith("at ")) {
149
- location = location.slice(3).trim();
150
- if (location.endsWith(")") && location.includes("(")) {
151
- location = location.slice(location.lastIndexOf("(") + 1, -1);
152
- }
153
- } else if (location.includes("@")) {
154
- location = location.slice(location.lastIndexOf("@") + 1);
155
- }
238
+ /**
239
+ * @param {string} location
240
+ * @returns {string | undefined}
241
+ */
242
+ function locationFilename(location) {
156
243
  const parts = location.replace(/^address at /u, "").split(":");
157
- if (parts.length < 3) {
244
+ if (parts.length < MIN_LOCATION_PARTS) {
158
245
  return undefined;
159
246
  }
160
- const columnText = parts.pop();
161
- const lineText = parts.pop();
247
+ const columnText = parts.pop() ?? "";
248
+ const lineText = parts.pop() ?? "";
162
249
  const filename = parts.join(":").trim();
163
- if (!/^[1-9]\d*$/u.test(lineText) || !/^[1-9]\d*$/u.test(columnText)) {
250
+ if (!POSITIVE_INTEGER_RE.test(lineText) || !POSITIVE_INTEGER_RE.test(columnText)) {
164
251
  return undefined;
165
252
  }
166
- const line = Number(lineText);
167
- const column = Number(columnText);
168
- return Number.isSafeInteger(line) && Number.isSafeInteger(column) && filename ? filename : undefined;
253
+ return Number.isSafeInteger(Number(lineText)) && Number.isSafeInteger(Number(columnText)) && filename ? filename : undefined;
169
254
  }
170
255
 
171
- function reactNativeCodePath(value) {
172
- if (typeof value !== "string" || value.trim() === "") {
256
+ /**
257
+ * @param {unknown} rawLine
258
+ * @returns {string | undefined}
259
+ */
260
+ function runtimeStackFrameFilename(rawLine) {
261
+ const trimmed = typeof rawLine === "string" ? rawLine.trim() : "";
262
+ return trimmed ? locationFilename(stackFrameLocation(trimmed)) : undefined;
263
+ }
264
+
265
+ /**
266
+ * @param {string} stack
267
+ * @returns {string[]}
268
+ */
269
+ function stackFilenames(stack) {
270
+ /** @type {string[]} */
271
+ const filenames = [];
272
+ for (const line of stack.split(/\r?\n/u)) {
273
+ const filename = runtimeStackFrameFilename(line);
274
+ if (filename !== undefined) {
275
+ filenames.push(filename);
276
+ }
277
+ }
278
+ return filenames;
279
+ }
280
+
281
+ /**
282
+ * @param {unknown} debugId
283
+ * @returns {debugId is string}
284
+ */
285
+ function isSafeDebugId(debugId) {
286
+ return typeof debugId === "string" && SAFE_RELEASE_ARTIFACT_DEBUG_ID.test(debugId);
287
+ }
288
+
289
+ /**
290
+ * @param {string} stack
291
+ * @param {unknown} debugId
292
+ * @returns {{ debugId: string, filenames: string[] } | undefined}
293
+ */
294
+ function stackDebugIds(stack, debugId) {
295
+ if (!isSafeDebugId(debugId)) {
173
296
  return undefined;
174
297
  }
175
- let path = value.trim();
176
- const URLConstructor = globalThis.URL;
177
- if (typeof URLConstructor === "function") {
178
- try {
179
- path = new URLConstructor(path).pathname || path;
180
- } catch {
181
- path = path.split(/[?#]/u, 1)[0].replace(/\\/g, "/");
298
+ const filenames = stackFilenames(stack);
299
+ return filenames.length === NO_ITEMS ? undefined : { debugId: debugId.toLowerCase(), filenames };
300
+ }
301
+
302
+ /**
303
+ * @param {readonly (readonly [string, string])[]} debugIds
304
+ * @returns {Record<string, string>}
305
+ */
306
+ function nullPrototypeRecord(debugIds) {
307
+ /** @type {Record<string, string>} */
308
+ const record = {};
309
+ Object.setPrototypeOf(record, NULL_VALUE);
310
+ for (const [filename, debugId] of debugIds) {
311
+ record[filename] = debugId;
312
+ }
313
+ return record;
314
+ }
315
+
316
+ /**
317
+ * @param {readonly (readonly [string, unknown])[]} entries
318
+ * @returns {Record<string, string> | undefined}
319
+ */
320
+ function debugIdMapFromEntries(entries) {
321
+ /** @type {Map<string, string>} */
322
+ const debugIds = new Map();
323
+ let frameCount = NO_ITEMS;
324
+ for (const [stack, debugId] of entries) {
325
+ const stackIds = stackDebugIds(stack, debugId);
326
+ frameCount += stackIds?.filenames.length ?? NO_ITEMS;
327
+ if (stackIds === undefined || frameCount > MAX_REACT_NATIVE_DEBUG_ID_REGISTRY_FRAMES
328
+ || stackIds.filenames.some(filename => (debugIds.get(filename) ?? stackIds.debugId) !== stackIds.debugId)) {
329
+ return undefined;
330
+ }
331
+ for (const filename of stackIds.filenames) {
332
+ debugIds.set(filename, stackIds.debugId);
182
333
  }
183
- } else {
184
- path = path.split(/[?#]/u, 1)[0].replace(/\\/g, "/");
185
334
  }
186
- if (/^[A-Za-z]:\//u.test(path) || /^\/(?:Users|home|private|tmp|var)\//u.test(path)) {
187
- path = path.replace(/\/+$/u, "");
188
- return path.slice(path.lastIndexOf("/") + 1) || undefined;
335
+ return frameCount > NO_ITEMS ? nullPrototypeRecord([...debugIds]) : undefined;
336
+ }
337
+
338
+ /**
339
+ * @returns {Record<string, string> | undefined}
340
+ */
341
+ function runtimeReactNativeDebugIdMap() {
342
+ try {
343
+ /** @type {unknown} */
344
+ const registry = Reflect.get(globalThis, REACT_NATIVE_DEBUG_ID_REGISTRY);
345
+ if (!isRecord(registry) || Array.isArray(registry)) {
346
+ return undefined;
347
+ }
348
+ const entries = Object.entries(registry);
349
+ if (entries.length === NO_ITEMS || entries.length > MAX_REACT_NATIVE_DEBUG_ID_REGISTRY_ENTRIES) {
350
+ return undefined;
351
+ }
352
+ return debugIdMapFromEntries(entries);
353
+ } catch {
354
+ return undefined;
189
355
  }
190
- return path || undefined;
191
356
  }
192
357
 
193
358
  module.exports = {