react-native-network-lens 0.0.0-stage → 0.1.1

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 (180) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +208 -2
  3. package/lib/module/backHandler.js +31 -0
  4. package/lib/module/backHandler.js.map +1 -0
  5. package/lib/module/components/BodyViewer.js +213 -0
  6. package/lib/module/components/BodyViewer.js.map +1 -0
  7. package/lib/module/components/CodeList.js +104 -0
  8. package/lib/module/components/CodeList.js.map +1 -0
  9. package/lib/module/components/JsonTree/JsonTreeView.js +206 -0
  10. package/lib/module/components/JsonTree/JsonTreeView.js.map +1 -0
  11. package/lib/module/components/JsonTree/model.js +196 -0
  12. package/lib/module/components/JsonTree/model.js.map +1 -0
  13. package/lib/module/components/NetworkLens.js +110 -0
  14. package/lib/module/components/NetworkLens.js.map +1 -0
  15. package/lib/module/components/NetworkLensOverlay.js +158 -0
  16. package/lib/module/components/NetworkLensOverlay.js.map +1 -0
  17. package/lib/module/components/RawTextView.js +119 -0
  18. package/lib/module/components/RawTextView.js.map +1 -0
  19. package/lib/module/components/RequestDetails/RequestDetails.js +256 -0
  20. package/lib/module/components/RequestDetails/RequestDetails.js.map +1 -0
  21. package/lib/module/components/RequestList/FilterBar.js +138 -0
  22. package/lib/module/components/RequestList/FilterBar.js.map +1 -0
  23. package/lib/module/components/RequestList/RequestList.js +163 -0
  24. package/lib/module/components/RequestList/RequestList.js.map +1 -0
  25. package/lib/module/components/RequestList/RequestRow.js +161 -0
  26. package/lib/module/components/RequestList/RequestRow.js.map +1 -0
  27. package/lib/module/components/RequestList/filters.js +57 -0
  28. package/lib/module/components/RequestList/filters.js.map +1 -0
  29. package/lib/module/components/ui/ActionSheet.js +94 -0
  30. package/lib/module/components/ui/ActionSheet.js.map +1 -0
  31. package/lib/module/components/ui/Button.js +104 -0
  32. package/lib/module/components/ui/Button.js.map +1 -0
  33. package/lib/module/components/ui/Pill.js +53 -0
  34. package/lib/module/components/ui/Pill.js.map +1 -0
  35. package/lib/module/components/ui/SearchInput.js +77 -0
  36. package/lib/module/components/ui/SearchInput.js.map +1 -0
  37. package/lib/module/components/ui/Section.js +147 -0
  38. package/lib/module/components/ui/Section.js.map +1 -0
  39. package/lib/module/components/ui/SegmentedControl.js +65 -0
  40. package/lib/module/components/ui/SegmentedControl.js.map +1 -0
  41. package/lib/module/components/ui/index.js +9 -0
  42. package/lib/module/components/ui/index.js.map +1 -0
  43. package/lib/module/core/Logger.js +230 -0
  44. package/lib/module/core/Logger.js.map +1 -0
  45. package/lib/module/core/NetworkRequest.js +155 -0
  46. package/lib/module/core/NetworkRequest.js.map +1 -0
  47. package/lib/module/core/XHRInterceptor.js +104 -0
  48. package/lib/module/core/XHRInterceptor.js.map +1 -0
  49. package/lib/module/core/har.js +72 -0
  50. package/lib/module/core/har.js.map +1 -0
  51. package/lib/module/core/loggerSingleton.js +12 -0
  52. package/lib/module/core/loggerSingleton.js.map +1 -0
  53. package/lib/module/hooks.js +42 -0
  54. package/lib/module/hooks.js.map +1 -0
  55. package/lib/module/index.js +34 -0
  56. package/lib/module/index.js.map +1 -0
  57. package/lib/module/package.json +1 -0
  58. package/lib/module/theme.js +136 -0
  59. package/lib/module/theme.js.map +1 -0
  60. package/lib/module/types.js +2 -0
  61. package/lib/module/types.js.map +1 -0
  62. package/lib/module/utils/body.js +179 -0
  63. package/lib/module/utils/body.js.map +1 -0
  64. package/lib/module/utils/debounce.js +18 -0
  65. package/lib/module/utils/debounce.js.map +1 -0
  66. package/lib/module/utils/format.js +45 -0
  67. package/lib/module/utils/format.js.map +1 -0
  68. package/lib/module/utils/logger.js +6 -0
  69. package/lib/module/utils/logger.js.map +1 -0
  70. package/lib/module/utils/search.js +70 -0
  71. package/lib/module/utils/search.js.map +1 -0
  72. package/lib/module/utils/url.js +50 -0
  73. package/lib/module/utils/url.js.map +1 -0
  74. package/lib/typescript/package.json +1 -0
  75. package/lib/typescript/src/backHandler.d.ts +15 -0
  76. package/lib/typescript/src/backHandler.d.ts.map +1 -0
  77. package/lib/typescript/src/components/BodyViewer.d.ts +16 -0
  78. package/lib/typescript/src/components/BodyViewer.d.ts.map +1 -0
  79. package/lib/typescript/src/components/CodeList.d.ts +21 -0
  80. package/lib/typescript/src/components/CodeList.d.ts.map +1 -0
  81. package/lib/typescript/src/components/JsonTree/JsonTreeView.d.ts +21 -0
  82. package/lib/typescript/src/components/JsonTree/JsonTreeView.d.ts.map +1 -0
  83. package/lib/typescript/src/components/JsonTree/model.d.ts +53 -0
  84. package/lib/typescript/src/components/JsonTree/model.d.ts.map +1 -0
  85. package/lib/typescript/src/components/NetworkLens.d.ts +31 -0
  86. package/lib/typescript/src/components/NetworkLens.d.ts.map +1 -0
  87. package/lib/typescript/src/components/NetworkLensOverlay.d.ts +32 -0
  88. package/lib/typescript/src/components/NetworkLensOverlay.d.ts.map +1 -0
  89. package/lib/typescript/src/components/RawTextView.d.ts +14 -0
  90. package/lib/typescript/src/components/RawTextView.d.ts.map +1 -0
  91. package/lib/typescript/src/components/RequestDetails/RequestDetails.d.ts +9 -0
  92. package/lib/typescript/src/components/RequestDetails/RequestDetails.d.ts.map +1 -0
  93. package/lib/typescript/src/components/RequestList/FilterBar.d.ts +12 -0
  94. package/lib/typescript/src/components/RequestList/FilterBar.d.ts.map +1 -0
  95. package/lib/typescript/src/components/RequestList/RequestList.d.ts +18 -0
  96. package/lib/typescript/src/components/RequestList/RequestList.d.ts.map +1 -0
  97. package/lib/typescript/src/components/RequestList/RequestRow.d.ts +11 -0
  98. package/lib/typescript/src/components/RequestList/RequestRow.d.ts.map +1 -0
  99. package/lib/typescript/src/components/RequestList/filters.d.ts +17 -0
  100. package/lib/typescript/src/components/RequestList/filters.d.ts.map +1 -0
  101. package/lib/typescript/src/components/ui/ActionSheet.d.ts +15 -0
  102. package/lib/typescript/src/components/ui/ActionSheet.d.ts.map +1 -0
  103. package/lib/typescript/src/components/ui/Button.d.ts +21 -0
  104. package/lib/typescript/src/components/ui/Button.d.ts.map +1 -0
  105. package/lib/typescript/src/components/ui/Pill.d.ts +11 -0
  106. package/lib/typescript/src/components/ui/Pill.d.ts.map +1 -0
  107. package/lib/typescript/src/components/ui/SearchInput.d.ts +17 -0
  108. package/lib/typescript/src/components/ui/SearchInput.d.ts.map +1 -0
  109. package/lib/typescript/src/components/ui/Section.d.ts +16 -0
  110. package/lib/typescript/src/components/ui/Section.d.ts.map +1 -0
  111. package/lib/typescript/src/components/ui/SegmentedControl.d.ts +14 -0
  112. package/lib/typescript/src/components/ui/SegmentedControl.d.ts.map +1 -0
  113. package/lib/typescript/src/components/ui/index.d.ts +7 -0
  114. package/lib/typescript/src/components/ui/index.d.ts.map +1 -0
  115. package/lib/typescript/src/core/Logger.d.ts +48 -0
  116. package/lib/typescript/src/core/Logger.d.ts.map +1 -0
  117. package/lib/typescript/src/core/NetworkRequest.d.ts +48 -0
  118. package/lib/typescript/src/core/NetworkRequest.d.ts.map +1 -0
  119. package/lib/typescript/src/core/XHRInterceptor.d.ts +29 -0
  120. package/lib/typescript/src/core/XHRInterceptor.d.ts.map +1 -0
  121. package/lib/typescript/src/core/har.d.ts +65 -0
  122. package/lib/typescript/src/core/har.d.ts.map +1 -0
  123. package/lib/typescript/src/core/loggerSingleton.d.ts +9 -0
  124. package/lib/typescript/src/core/loggerSingleton.d.ts.map +1 -0
  125. package/lib/typescript/src/hooks.d.ts +11 -0
  126. package/lib/typescript/src/hooks.d.ts.map +1 -0
  127. package/lib/typescript/src/index.d.ts +33 -0
  128. package/lib/typescript/src/index.d.ts.map +1 -0
  129. package/lib/typescript/src/theme.d.ts +49 -0
  130. package/lib/typescript/src/theme.d.ts.map +1 -0
  131. package/lib/typescript/src/types.d.ts +80 -0
  132. package/lib/typescript/src/types.d.ts.map +1 -0
  133. package/lib/typescript/src/utils/body.d.ts +19 -0
  134. package/lib/typescript/src/utils/body.d.ts.map +1 -0
  135. package/lib/typescript/src/utils/debounce.d.ts +4 -0
  136. package/lib/typescript/src/utils/debounce.d.ts.map +1 -0
  137. package/lib/typescript/src/utils/format.d.ts +7 -0
  138. package/lib/typescript/src/utils/format.d.ts.map +1 -0
  139. package/lib/typescript/src/utils/logger.d.ts +2 -0
  140. package/lib/typescript/src/utils/logger.d.ts.map +1 -0
  141. package/lib/typescript/src/utils/search.d.ts +17 -0
  142. package/lib/typescript/src/utils/search.d.ts.map +1 -0
  143. package/lib/typescript/src/utils/url.d.ts +15 -0
  144. package/lib/typescript/src/utils/url.d.ts.map +1 -0
  145. package/package.json +186 -4
  146. package/src/backHandler.ts +29 -0
  147. package/src/components/BodyViewer.tsx +250 -0
  148. package/src/components/CodeList.tsx +120 -0
  149. package/src/components/JsonTree/JsonTreeView.tsx +304 -0
  150. package/src/components/JsonTree/model.ts +266 -0
  151. package/src/components/NetworkLens.tsx +176 -0
  152. package/src/components/NetworkLensOverlay.tsx +187 -0
  153. package/src/components/RawTextView.tsx +163 -0
  154. package/src/components/RequestDetails/RequestDetails.tsx +315 -0
  155. package/src/components/RequestList/FilterBar.tsx +168 -0
  156. package/src/components/RequestList/RequestList.tsx +226 -0
  157. package/src/components/RequestList/RequestRow.tsx +150 -0
  158. package/src/components/RequestList/filters.ts +98 -0
  159. package/src/components/ui/ActionSheet.tsx +109 -0
  160. package/src/components/ui/Button.tsx +124 -0
  161. package/src/components/ui/Pill.tsx +53 -0
  162. package/src/components/ui/SearchInput.tsx +97 -0
  163. package/src/components/ui/Section.tsx +133 -0
  164. package/src/components/ui/SegmentedControl.tsx +79 -0
  165. package/src/components/ui/index.ts +6 -0
  166. package/src/core/Logger.ts +293 -0
  167. package/src/core/NetworkRequest.ts +216 -0
  168. package/src/core/XHRInterceptor.ts +179 -0
  169. package/src/core/har.ts +71 -0
  170. package/src/core/loggerSingleton.ts +14 -0
  171. package/src/hooks.ts +51 -0
  172. package/src/index.tsx +56 -0
  173. package/src/theme.ts +174 -0
  174. package/src/types.ts +83 -0
  175. package/src/utils/body.ts +194 -0
  176. package/src/utils/debounce.ts +18 -0
  177. package/src/utils/format.ts +50 -0
  178. package/src/utils/logger.ts +3 -0
  179. package/src/utils/search.ts +72 -0
  180. package/src/utils/url.ts +59 -0
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Patches the global XMLHttpRequest so every request made from JavaScript can
3
+ * be observed. `fetch` in React Native is built on XMLHttpRequest, so this also
4
+ * covers fetch, axios, Apollo and friends.
5
+ *
6
+ * Every callback is wrapped in try/catch: the inspector must never break the
7
+ * app's networking.
8
+ */
9
+ export interface InterceptedXHR {
10
+ __lensId?: number;
11
+ __lensSeenHeaders?: boolean;
12
+ __lensSeenDone?: boolean;
13
+ }
14
+ type XHRInstance = XMLHttpRequest & InterceptedXHR;
15
+ export interface InterceptorCallbacks {
16
+ onOpen: (method: string, url: string, xhr: XHRInstance) => void;
17
+ onRequestHeader: (header: string, value: string, xhr: XHRInstance) => void;
18
+ onSend: (body: unknown, xhr: XHRInstance) => void;
19
+ onHeadersReceived: (status: number, contentType: string, contentLength: number, headers: Record<string, string>, xhr: XHRInstance) => void;
20
+ onResponse: (status: number, timeout: number, response: unknown, responseURL: string, responseType: string, xhr: XHRInstance) => void;
21
+ onFailure: (reason: 'error' | 'timeout' | 'abort', xhr: XHRInstance) => void;
22
+ }
23
+ export declare const parseResponseHeaders: (raw: string) => Record<string, string>;
24
+ export declare const isInterceptorEnabled: () => boolean;
25
+ export declare const setCallbacks: (next: InterceptorCallbacks) => void;
26
+ export declare const enableInterception: () => void;
27
+ export declare const disableInterception: () => void;
28
+ export {};
29
+ //# sourceMappingURL=XHRInterceptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XHRInterceptor.d.ts","sourceRoot":"","sources":["../../../../src/core/XHRInterceptor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,OAA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1.2 document that Chrome/Charles/Proxyman can import. */
3
+ export declare const createHar: (requests: NetworkRequest[]) => Promise<{
4
+ log: {
5
+ version: string;
6
+ creator: {
7
+ name: string;
8
+ version: string;
9
+ };
10
+ pages: never[];
11
+ entries: {
12
+ startedDateTime: string;
13
+ time: number;
14
+ request: {
15
+ postData?: {
16
+ mimeType: string;
17
+ text: string;
18
+ } | undefined;
19
+ method: import("../index.js").RequestMethod;
20
+ url: string;
21
+ httpVersion: string;
22
+ headers: {
23
+ name: string;
24
+ value: string;
25
+ }[];
26
+ queryString: {
27
+ name: string;
28
+ value: string;
29
+ }[];
30
+ cookies: never[];
31
+ headersSize: number;
32
+ bodySize: number;
33
+ };
34
+ response: {
35
+ status: number;
36
+ statusText: string;
37
+ httpVersion: string;
38
+ headers: {
39
+ name: string;
40
+ value: string;
41
+ }[];
42
+ cookies: never[];
43
+ content: {
44
+ size: number;
45
+ mimeType: string;
46
+ text: string;
47
+ };
48
+ redirectURL: string;
49
+ headersSize: number;
50
+ bodySize: number;
51
+ };
52
+ cache: {};
53
+ timings: {
54
+ blocked: number;
55
+ dns: number;
56
+ ssl: number;
57
+ connect: number;
58
+ send: number;
59
+ wait: number;
60
+ receive: number;
61
+ };
62
+ }[];
63
+ };
64
+ }>;
65
+ //# sourceMappingURL=har.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"har.d.ts","sourceRoot":"","sources":["../../../../src/core/har.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,qBAAkB,CAAC;AA8DnD,wEAAwE;AACxE,eAAO,MAAM,SAAS,GAAU,UAAU,cAAc,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOxD,CAAC"}
@@ -0,0 +1,9 @@
1
+ import Logger from './Logger.js';
2
+ /**
3
+ * One logger per JS runtime. It lives on `globalThis` so that Fast Refresh
4
+ * (which re-evaluates modules) keeps the same instance and the same patched
5
+ * XMLHttpRequest instead of silently creating a fresh, disabled one.
6
+ */
7
+ declare const logger: Logger;
8
+ export default logger;
9
+ //# sourceMappingURL=loggerSingleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loggerSingleton.d.ts","sourceRoot":"","sources":["../../../../src/core/loggerSingleton.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAU,CAAC;AAM9B;;;;GAIG;AACH,QAAA,MAAM,MAAM,EAAE,MAAiE,CAAC;AAEhF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type NetworkRequest from './core/NetworkRequest.js';
2
+ /** Live list of captured requests, newest first. */
3
+ export declare const useNetworkRequests: () => NetworkRequest[];
4
+ export declare const useLoggerEnabled: () => boolean;
5
+ export declare const useLoggerPaused: () => boolean;
6
+ /** Resolves a promise factory, re-running whenever `deps` change. */
7
+ export declare const useAsyncValue: <T>(factory: () => Promise<T>, deps: readonly unknown[]) => {
8
+ value: T | undefined;
9
+ loading: boolean;
10
+ };
11
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc,MAAM,0BAAuB,CAAC;AAExD,oDAAoD;AACpD,eAAO,MAAM,kBAAkB,QAAO,cAAc,EAKjD,CAAC;AAKJ,eAAO,MAAM,gBAAgB,QAAO,OAC4B,CAAC;AAEjE,eAAO,MAAM,eAAe,QAAO,OAC2B,CAAC;AAE/D,qEAAqE;AACrE,eAAO,MAAM,aAAa,GAAI,CAAC,EAC7B,SAAS,MAAM,OAAO,CAAC,CAAC,CAAC,EACzB,MAAM,SAAS,OAAO,EAAE,KACvB;IAAE,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAyB1C,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { NetworkLensOptions } from './types.js';
2
+ export { default as NetworkLens, default } from './components/NetworkLens.js';
3
+ export type { NetworkLensProps, NetworkLensHandle, } from './components/NetworkLens.js';
4
+ export { default as NetworkLensOverlay } from './components/NetworkLensOverlay.js';
5
+ export type { NetworkLensOverlayProps } from './components/NetworkLensOverlay.js';
6
+ export { default as JsonTreeView } from './components/JsonTree/JsonTreeView.js';
7
+ export type { JsonTreeHandle } from './components/JsonTree/JsonTreeView.js';
8
+ export { default as NetworkRequest } from './core/NetworkRequest.js';
9
+ export { createHar } from './core/har.js';
10
+ export { getBackHandler } from './backHandler.js';
11
+ export { useNetworkRequests, useLoggerEnabled, useLoggerPaused } from './hooks.js';
12
+ export { lightTheme, darkTheme } from './theme.js';
13
+ export type { Theme, ThemeName, ThemeInput } from './theme.js';
14
+ export type { NetworkLensOptions, StartNetworkLoggingOptions, NetworkRequestRow, ParsedBody, RequestMethod, RequestState, FailureReason, StatusGroup, Headers, } from './types.js';
15
+ /**
16
+ * Start capturing requests. Call it once, as early as possible (e.g. in your
17
+ * `index.js`). Pass `enabled: false` to turn the whole thing into a no-op.
18
+ *
19
+ * ```ts
20
+ * startNetworkLogging({ enabled: __DEV__, maxRequests: 500 });
21
+ * ```
22
+ */
23
+ export declare const startNetworkLogging: (options?: NetworkLensOptions) => void;
24
+ /** Stop capturing, restore XMLHttpRequest and drop every captured request. */
25
+ export declare const stopNetworkLogging: () => void;
26
+ /** Whether requests are currently being captured. */
27
+ export declare const isNetworkLoggingEnabled: () => boolean;
28
+ /** Snapshot of captured requests, newest first. */
29
+ export declare const getRequests: () => import("./index.js").NetworkRequest[];
30
+ export declare const clearRequests: () => void;
31
+ /** Pause or resume publishing new requests to the UI. Capturing continues while paused. */
32
+ export declare const setNetworkLoggingPaused: (paused: boolean) => void;
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,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,eAAO,MAAM,uBAAuB,GAAI,QAAQ,OAAO,KAAG,IAChC,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { DeepPartial } from './types.js';
2
+ export type ThemeName = 'light' | 'dark' | 'auto';
3
+ export type Theme = {
4
+ colors: {
5
+ background: string;
6
+ surface: string;
7
+ surfaceAlt: string;
8
+ border: string;
9
+ text: string;
10
+ textMuted: string;
11
+ primary: string;
12
+ onPrimary: string;
13
+ statusGood: string;
14
+ statusRedirect: string;
15
+ statusWarning: string;
16
+ statusBad: string;
17
+ statusPending: string;
18
+ methodGet: string;
19
+ methodPost: string;
20
+ methodPut: string;
21
+ methodPatch: string;
22
+ methodDelete: string;
23
+ methodOther: string;
24
+ jsonKey: string;
25
+ jsonString: string;
26
+ jsonNumber: string;
27
+ jsonBoolean: string;
28
+ jsonNull: string;
29
+ highlight: string;
30
+ highlightActive: string;
31
+ onHighlight: string;
32
+ };
33
+ fonts: {
34
+ mono: string;
35
+ };
36
+ sizes: {
37
+ codeFontSize: number;
38
+ codeLineHeight: number;
39
+ };
40
+ };
41
+ export declare const lightTheme: Theme;
42
+ export declare const darkTheme: Theme;
43
+ export type ThemeInput = ThemeName | DeepPartial<Theme>;
44
+ export declare const ThemeContext: import("react").Context<ThemeInput>;
45
+ export declare const resolveTheme: (input: ThemeInput, systemScheme: "light" | "dark") => Theme;
46
+ export declare const useTheme: () => Theme;
47
+ export declare const methodColor: (theme: Theme, method: string) => string;
48
+ export declare const statusColor: (theme: Theme, status: number, failed?: boolean) => string;
49
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/theme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAS,CAAC;AAE3C,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAElD,MAAM,MAAM,KAAK,GAAG;IAClB,MAAM,EAAE;QACN,U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,GAAG,MAAM,KAC7B,KAKF,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAO,KAI3B,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,OAAO,KAAK,EAAE,QAAQ,MAAM,KAAG,MAe1D,CAAC;AAEF,eAAO,MAAM,WAAW,GACtB,OAAO,KAAK,EACZ,QAAQ,MAAM,EACd,gBAAc,KACb,MAOF,CAAC"}
@@ -0,0 +1,80 @@
1
+ export type Headers = Record<string, string>;
2
+ export type RequestMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | (string & {});
3
+ /** Lifecycle of a captured request. */
4
+ export type RequestState = 'pending' | 'done' | 'failed';
5
+ export type FailureReason = 'error' | 'timeout' | 'abort';
6
+ export type StatusGroup = '1xx' | '2xx' | '3xx' | '4xx' | '5xx' | 'pending' | 'failed';
7
+ export interface NetworkLensOptions {
8
+ /**
9
+ * Master switch. When `false` nothing is intercepted and every UI component
10
+ * renders nothing, so you can wire it to `__DEV__` or a remote feature flag.
11
+ * @default true
12
+ */
13
+ enabled?: boolean;
14
+ /**
15
+ * Max number of requests to keep before the oldest ones are dropped.
16
+ * @default 500
17
+ */
18
+ maxRequests?: number;
19
+ /** Hosts to ignore, e.g. `services.test.com` */
20
+ ignoredHosts?: string[];
21
+ /** Exact urls to ignore, e.g. `https://services.test.com/test` */
22
+ ignoredUrls?: string[];
23
+ /**
24
+ * Patterns to ignore. They are tested against `${method} ${url}`,
25
+ * e.g. `/^GET https:\/\/test\.com\/pages\/.*$/`
26
+ */
27
+ ignoredPatterns?: RegExp[];
28
+ /**
29
+ * How often (ms) the UI is notified about new data.
30
+ * @default 50
31
+ */
32
+ refreshRate?: number;
33
+ }
34
+ /** @deprecated use `NetworkLensOptions` */
35
+ export type StartNetworkLoggingOptions = NetworkLensOptions;
36
+ /**
37
+ * A body after we tried to understand it.
38
+ * `text` is always the raw textual representation used by the "Raw" view.
39
+ */
40
+ export type ParsedBody = {
41
+ kind: 'empty';
42
+ text: '';
43
+ } | {
44
+ kind: 'json';
45
+ value: unknown;
46
+ text: string;
47
+ } | {
48
+ kind: 'form';
49
+ value: Record<string, string>;
50
+ text: string;
51
+ } | {
52
+ kind: 'text';
53
+ text: string;
54
+ } | {
55
+ kind: 'binary';
56
+ text: string;
57
+ size: number;
58
+ mimeType?: string;
59
+ };
60
+ /** Light-weight projection of a request used by list rows. */
61
+ export interface NetworkRequestRow {
62
+ id: string;
63
+ method: RequestMethod;
64
+ url: string;
65
+ host: string;
66
+ path: string;
67
+ status: number;
68
+ state: RequestState;
69
+ statusGroup: StatusGroup;
70
+ failureReason?: FailureReason;
71
+ duration: number;
72
+ startTime: number;
73
+ responseSize: number;
74
+ gqlOperation?: string;
75
+ updatedAt: number;
76
+ }
77
+ export type DeepPartial<T> = {
78
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
79
+ };
80
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7C,MAAM,MAAM,aAAa,GACrB,KAAK,GACL,MAAM,GACN,KAAK,GACL,OAAO,GACP,QAAQ,GACR,MAAM,GACN,SAAS,GACT,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,uCAAuC;AACvC,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEzD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAE1D,MAAM,MAAM,WAAW,GACrB,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CA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AAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAChE,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { ParsedBody } from '../types.js';
2
+ export declare const stringifyJson: (value: unknown) => string;
3
+ export declare const tryParseJson: (text: string) => {
4
+ ok: true;
5
+ value: unknown;
6
+ } | {
7
+ ok: false;
8
+ };
9
+ export declare const parseTextBody: (text: string, contentType?: string) => ParsedBody;
10
+ /**
11
+ * Normalises whatever was passed to `xhr.send()`.
12
+ */
13
+ export declare const parseRequestBody: (data: unknown, contentType?: string) => ParsedBody;
14
+ /**
15
+ * Normalises an XHR response. Blob responses are only decoded when they look textual.
16
+ */
17
+ export declare const parseResponseBody: (response: unknown, responseType: string, contentType?: string) => Promise<ParsedBody>;
18
+ export declare const bodySize: (body: ParsedBody) => number;
19
+ //# sourceMappingURL=body.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"body.d.ts","sourceRoot":"","sources":["../../../../src/utils/body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAU,CAAC;AAsC3C,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,MAM9C,CAAC;AAEF,eAAO,MAAM,YAAY,GACvB,MAAM,MAAM,KACX;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAA;CAiB5C,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,MAAM,MAAM,EACZ,cAAc,MAAM,KACnB,UAcF,CAAC;AAoBF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,MAAM,OAAO,EACb,cAAc,MAAM,KACnB,UAoBF,CAAC;AAgCF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,OAAO,EACjB,cAAc,MAAM,EACpB,cAAc,MAAM,KACnB,OAAO,CAAC,UAAU,CAqBpB,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,MAAM,UAAU,KAAG,MACgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export default function debounce<T extends (...args: never[]) => void>(fn: T, wait: number): T & {
2
+ cancel: () => void;
3
+ };
4
+ //# sourceMappingURL=debounce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../../../src/utils/debounce.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,EACnE,EAAE,EAAE,CAAC,EACL,IAAI,EAAE,MAAM,GACX,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CAc5B"}
@@ -0,0 +1,7 @@
1
+ export declare const formatBytes: (bytes: number) => string;
2
+ export declare const formatDuration: (ms: number) => string;
3
+ export declare const formatTime: (time: number, withMillis?: boolean) => string;
4
+ export declare const formatDateTime: (time: number) => string;
5
+ /** Approximate size of a string in bytes (UTF-8). */
6
+ export declare const byteLength: (text: string) => number;
7
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/utils/format.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,MAW3C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,IAAI,MAAM,KAAG,MAI3C,CAAC;AAIF,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,EAAE,oBAAkB,KAAG,MAQ7D,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,KAAG,MAG7C,CAAC;AAEF,qDAAqD;AACrD,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,MAYzC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const warn: (message: string) => void;
2
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,GAAI,SAAS,MAAM,KAAG,IAEtC,CAAC"}
@@ -0,0 +1,17 @@
1
+ export interface LineMatch {
2
+ line: number;
3
+ start: number;
4
+ end: number;
5
+ }
6
+ /** Finds every (case-insensitive) occurrence of `query` in `lines`. */
7
+ export declare const findLineMatches: (lines: readonly string[], query: string) => LineMatch[];
8
+ export interface TextSegment {
9
+ text: string;
10
+ highlighted: boolean;
11
+ }
12
+ /** Splits `text` into highlighted / plain segments for the given query. */
13
+ export declare const splitHighlights: (text: string, query: string) => TextSegment[];
14
+ export declare const MAX_LINE_CHARS = 2000;
15
+ /** Splits text into lines, hard-wrapping absurdly long ones so layout stays sane. */
16
+ export declare const toLines: (text: string) => string[];
17
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../../src/utils/search.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,uEAAuE;AACvE,eAAO,MAAM,eAAe,GAC1B,OAAO,SAAS,MAAM,EAAE,EACxB,OAAO,MAAM,KACZ,SAAS,EAeX,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,2EAA2E;AAC3E,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,WAAW,EAoBxE,CAAC;AAEF,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,qFAAqF;AACrF,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,MAAM,EAa5C,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Tiny URL helpers that do not rely on the `URL` global, because React Native's
3
+ * implementation is incomplete (no `searchParams`, throws on relative urls).
4
+ */
5
+ export interface UrlParts {
6
+ host: string;
7
+ path: string;
8
+ query: Record<string, string>;
9
+ hasQuery: boolean;
10
+ }
11
+ export declare const extractHost: (url: string) => string;
12
+ export declare const parseQueryString: (search: string) => Record<string, string>;
13
+ export declare const safeDecode: (value: string) => string;
14
+ export declare const parseUrl: (url: string) => UrlParts;
15
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../src/utils/url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,KAAG,MAGzC,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAetE,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,MAM1C,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,KAAG,QAgBtC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,188 @@
1
1
  {
2
2
  "name": "react-native-network-lens",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "In-app HTTP network inspector for React Native with a tabbed request viewer, collapsible JSON tree, search and zero dependencies",
5
+ "main": "./lib/module/index.js",
6
+ "types": "./lib/typescript/src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "react-native-network-lens-source": "./src/index.tsx",
10
+ "types": "./lib/typescript/src/index.d.ts",
11
+ "default": "./lib/module/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "files": [
16
+ "src",
17
+ "lib",
18
+ "!lib/typescript/example",
19
+ "!**/__tests__",
20
+ "!**/__fixtures__",
21
+ "!**/__mocks__",
22
+ "!**/.*"
23
+ ],
24
+ "scripts": {
25
+ "example": "yarn workspace react-native-network-lens-example",
26
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
27
+ "prepare": "bob build",
28
+ "typecheck": "tsc",
29
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
30
+ "test": "jest",
31
+ "release": "release-it --only-version"
32
+ },
33
+ "keywords": [
34
+ "react-native",
35
+ "network",
36
+ "logger",
37
+ "inspector",
38
+ "http",
39
+ "xhr",
40
+ "fetch",
41
+ "axios",
42
+ "debug",
43
+ "devtools",
44
+ "json-viewer",
45
+ "ios",
46
+ "android",
47
+ "network-logger",
48
+ "network-lens"
49
+ ],
50
+ "repository": {
51
+ "type": "git",
52
+ "url": "git+https://github.com/stainsmjohnson/react-native-network-lens.git"
53
+ },
54
+ "author": "Stains M Johnson <grahamstains1999@gmail.com> (https://github.com/stainsmjohnson)",
55
+ "license": "MIT",
56
+ "bugs": {
57
+ "url": "https://github.com/stainsmjohnson/react-native-network-lens/issues"
58
+ },
59
+ "homepage": "https://github.com/stainsmjohnson/react-native-network-lens#readme",
60
+ "publishConfig": {
61
+ "registry": "https://registry.npmjs.org/"
62
+ },
63
+ "devDependencies": {
64
+ "@commitlint/config-conventional": "^21.2.4",
65
+ "@eslint/compat": "^2.1.1",
66
+ "@eslint/eslintrc": "^3.3.7",
67
+ "@eslint/js": "^9.39.5",
68
+ "@jest/globals": "^29.7.0",
69
+ "@react-native/babel-preset": "0.88.0",
70
+ "@react-native/eslint-config": "0.88.0",
71
+ "@react-native/jest-preset": "0.88.0",
72
+ "@release-it/conventional-changelog": "^12.0.2",
73
+ "@types/react": "^19.2.0",
74
+ "commitlint": "^21.2.4",
75
+ "del-cli": "^8.0.1",
76
+ "eslint": "^9.39.5",
77
+ "eslint-config-prettier": "^10.1.8",
78
+ "eslint-plugin-ft-flow": "^3.0.11",
79
+ "eslint-plugin-prettier": "^5.5.7",
80
+ "jest": "^29.7.0",
81
+ "lefthook": "^2.2.2",
82
+ "prettier": "^3.9.10",
83
+ "react": "19.3.0",
84
+ "react-native": "0.88.0",
85
+ "react-native-builder-bob": "^0.43.2",
86
+ "release-it": "^21.1.1",
87
+ "turbo": "^2.11.10",
88
+ "typescript": "^6.0.3"
89
+ },
90
+ "peerDependencies": {
91
+ "react": ">=18.0.0",
92
+ "react-native": ">=0.69.0"
93
+ },
94
+ "workspaces": [
95
+ "example"
96
+ ],
97
+ "packageManager": "yarn@4.18.1",
98
+ "react-native-builder-bob": {
99
+ "source": "src",
100
+ "output": "lib",
101
+ "targets": [
102
+ [
103
+ "module",
104
+ {
105
+ "esm": true
106
+ }
107
+ ],
108
+ [
109
+ "typescript",
110
+ {
111
+ "project": "tsconfig.build.json"
112
+ }
113
+ ]
114
+ ]
115
+ },
116
+ "prettier": {
117
+ "quoteProps": "consistent",
118
+ "singleQuote": true,
119
+ "tabWidth": 2,
120
+ "trailingComma": "es5",
121
+ "useTabs": false
122
+ },
123
+ "jest": {
124
+ "preset": "@react-native/jest-preset",
125
+ "testEnvironmentOptions": {
126
+ "customExportConditions": [
127
+ "require",
128
+ "react-native",
129
+ "react-native-network-lens-source"
130
+ ]
131
+ },
132
+ "modulePathIgnorePatterns": [
133
+ "<rootDir>/example/node_modules",
134
+ "<rootDir>/lib/"
135
+ ]
136
+ },
137
+ "commitlint": {
138
+ "extends": [
139
+ "@commitlint/config-conventional"
140
+ ]
141
+ },
142
+ "dependenciesMeta": {
143
+ "lefthook": {
144
+ "built": true
145
+ }
146
+ },
147
+ "release-it": {
148
+ "git": {
149
+ "commitMessage": "chore: release ${version}",
150
+ "tagName": "v${version}",
151
+ "requireCleanWorkingDir": true,
152
+ "requireBranch": "main"
153
+ },
154
+ "npm": {
155
+ "publish": true
156
+ },
157
+ "github": {
158
+ "release": true
159
+ },
160
+ "plugins": {
161
+ "@release-it/conventional-changelog": {
162
+ "preset": {
163
+ "name": "angular"
164
+ },
165
+ "infile": "CHANGELOG.md"
166
+ }
167
+ },
168
+ "hooks": {
169
+ "before:init": [
170
+ "yarn lint",
171
+ "yarn typecheck",
172
+ "yarn test"
173
+ ]
174
+ }
175
+ },
176
+ "create-react-native-library": {
177
+ "type": "library",
178
+ "languages": "js",
179
+ "tools": [
180
+ "eslint",
181
+ "jest",
182
+ "lefthook",
183
+ "release-it"
184
+ ],
185
+ "version": "0.64.0"
186
+ },
187
+ "sideEffects": false
188
+ }
@@ -0,0 +1,29 @@
1
+ let appBackHandler: (() => unknown) | undefined;
2
+ let lensBackHandler: (() => boolean) | undefined;
3
+
4
+ /** @internal */
5
+ export const setLensBackHandler = (handler?: () => boolean) => {
6
+ lensBackHandler = handler;
7
+ };
8
+
9
+ /** @internal */
10
+ export const hasAppBackHandler = () => !!appBackHandler;
11
+
12
+ const goBack = () => {
13
+ if (lensBackHandler?.()) return;
14
+ appBackHandler?.();
15
+ };
16
+
17
+ /**
18
+ * Wrap your screen's back action so the back button first navigates inside the
19
+ * inspector (details -> list) and only then falls back to your own navigation.
20
+ *
21
+ * ```tsx
22
+ * const onBack = getBackHandler(navigation.goBack);
23
+ * <Button title="Back" onPress={onBack} />
24
+ * ```
25
+ */
26
+ export const getBackHandler = (backHandler: () => unknown) => {
27
+ appBackHandler = backHandler;
28
+ return goBack;
29
+ };