@getlimelight/sdk 0.3.0 → 0.4.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 CHANGED
@@ -6,8 +6,13 @@
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue)](https://www.typescriptlang.org/)
8
8
 
9
+ ## Official documentation
10
+
11
+ Read the full docs at **[docs.getlimelight.io](https://docs.getlimelight.io)**.
12
+
9
13
  ## Features
10
14
 
15
+ - 🙂 **Find why things re-render** - Get detailed information on what is causing your app to render
11
16
  - 🔍 **Network Inspection** - Capture and analyze all network requests (fetch & XMLHttpRequest)
12
17
  - 🎯 **GraphQL-First** - Automatic GraphQL operation detection, complexity analysis, and query parsing
13
18
  - 📊 **Console Streaming** - Real-time console logs with source detection and stack traces
@@ -32,16 +37,16 @@ pnpm add @getlimelight/sdk
32
37
 
33
38
  ## Quick Start
34
39
 
35
- ### Basic Usage
40
+ ### Basic Usage for the desktop app
36
41
 
37
42
  ```typescript
38
43
  import { Limelight } from "@getlimelight/sdk";
39
44
 
40
45
  // That's it! One line to start debugging
41
- Limelight.connect({ projectKey: "project-123" });
46
+ Limelight.connect();
42
47
  ```
43
48
 
44
- ### React Native
49
+ ### Provide your projectKey to use the web Limelight app
45
50
 
46
51
  ```typescript
47
52
  import { Limelight } from "@getlimelight/sdk";
@@ -49,19 +54,6 @@ import { Limelight } from "@getlimelight/sdk";
49
54
  Limelight.connect({ projectKey: "project-123" });
50
55
  ```
51
56
 
52
- ### Expo
53
-
54
- ```typescript
55
- import { Limelight } from "@getlimelight/sdk";
56
- import Constants from "expo-constants";
57
-
58
- Limelight.connect({
59
- projectKey: "project-123",
60
- enabled: __DEV__,
61
- appName: Constants.expoConfig?.name,
62
- });
63
- ```
64
-
65
57
  ## Configuration
66
58
 
67
59
  ### Configuration Options
@@ -70,8 +62,8 @@ Limelight.connect({
70
62
  import { Limelight } from '@getlimelight/sdk';
71
63
 
72
64
  Limelight.connect({
73
- // The only required field: project Id:
74
- projectKey: string;
65
+ // Required to connect to the Limelight web app. Your project key can be found in organization settings.
66
+ projectKey?: string;
75
67
 
76
68
  // Optional: Platform identifier (auto-detected)
77
69
  platform?: string;
@@ -120,7 +112,6 @@ Limelight.connect({
120
112
  import { Limelight } from "@getlimelight/sdk";
121
113
 
122
114
  Limelight.connect({
123
- projectKey: "project-123",
124
115
  serverUrl: "ws://192.168.1.100:8080", // Your computer's IP
125
116
  appName: "MyApp",
126
117
  });
package/dist/index.d.mts CHANGED
@@ -286,6 +286,70 @@ interface ComponentProfileSnapshot {
286
286
  propChanges?: PropChangeSnapshot;
287
287
  }
288
288
 
289
+ /**
290
+ * Supported state management libraries
291
+ */
292
+ declare enum StateLibrary {
293
+ ZUSTAND = "zustand",
294
+ REDUX = "redux"
295
+ }
296
+ /**
297
+ * State event phases
298
+ */
299
+ declare enum StatePhase {
300
+ INIT = "STATE:INIT",
301
+ UPDATE = "STATE:UPDATE"
302
+ }
303
+ /**
304
+ * Action info captured during state updates
305
+ */
306
+ interface StateAction {
307
+ /**
308
+ * Action type/name
309
+ * - Redux: action.type
310
+ * - Zustand: inferred from stack trace or 'set'
311
+ */
312
+ type: string;
313
+ /**
314
+ * Action payload
315
+ * - Redux: action.payload
316
+ * - Zustand: partial state passed to set()
317
+ */
318
+ payload?: unknown;
319
+ }
320
+ /**
321
+ * Base shape for state events
322
+ */
323
+ interface BaseStateEvent {
324
+ phase: StatePhase;
325
+ sessionId: string;
326
+ timestamp: number;
327
+ }
328
+ /**
329
+ * Initial state snapshot sent when store is registered
330
+ */
331
+ interface StateInitEvent extends BaseStateEvent {
332
+ phase: StatePhase.INIT;
333
+ data: {
334
+ storeId: string;
335
+ library: StateLibrary;
336
+ state: unknown;
337
+ };
338
+ }
339
+ /**
340
+ * State update event sent on every state change
341
+ */
342
+ interface StateUpdateEvent extends BaseStateEvent {
343
+ phase: StatePhase.UPDATE;
344
+ data: {
345
+ storeId: string;
346
+ library: StateLibrary;
347
+ state: unknown;
348
+ action: StateAction;
349
+ stackTrace?: string;
350
+ };
351
+ }
352
+
289
353
  /**
290
354
  * Configuration options for Limelight SDK.
291
355
  *
@@ -349,6 +413,20 @@ interface LimelightConfig {
349
413
  * Flag to enable or disable render inspection.
350
414
  */
351
415
  enableRenderInspector?: boolean;
416
+ /**
417
+ * Zustand store hooks or Redux stores, keyed by display name
418
+ * @example { user: useUserStore, cart: useCartStore }
419
+ */
420
+ stores?: Record<string, unknown>;
421
+ /**
422
+ * Flag to enable or disable state inspection
423
+ * @default true (if stores are provided)
424
+ */
425
+ enableStateInspector?: boolean;
426
+ /**
427
+ * Flag to enable or disable internal logging for the Limelight SDK
428
+ */
429
+ internalLoggingEnabled?: boolean;
352
430
  /**
353
431
  * A callback function to modify or filter events before they are sent to the server
354
432
  */
@@ -372,7 +450,7 @@ interface ConnectionEvent {
372
450
  /**
373
451
  * Union type representing all possible Limelight messages.
374
452
  */
375
- type LimelightMessage = NetworkRequest | NetworkResponse | NetworkErrorEvent | ConsoleEvent | ConnectionEvent | RenderSnapshot | TransactionEvent;
453
+ type LimelightMessage = NetworkRequest | NetworkResponse | NetworkErrorEvent | ConsoleEvent | ConnectionEvent | RenderSnapshot | TransactionEvent | StateInitEvent | StateUpdateEvent;
376
454
 
377
455
  /**
378
456
  * Represents a single frame in a stack trace.
@@ -406,6 +484,7 @@ declare class LimelightClient {
406
484
  private xhrInterceptor;
407
485
  private consoleInterceptor;
408
486
  private renderInterceptor;
487
+ private stateInterceptor;
409
488
  constructor();
410
489
  /**
411
490
  * Configures the Limelight client with the provided settings.
package/dist/index.d.ts CHANGED
@@ -286,6 +286,70 @@ interface ComponentProfileSnapshot {
286
286
  propChanges?: PropChangeSnapshot;
287
287
  }
288
288
 
289
+ /**
290
+ * Supported state management libraries
291
+ */
292
+ declare enum StateLibrary {
293
+ ZUSTAND = "zustand",
294
+ REDUX = "redux"
295
+ }
296
+ /**
297
+ * State event phases
298
+ */
299
+ declare enum StatePhase {
300
+ INIT = "STATE:INIT",
301
+ UPDATE = "STATE:UPDATE"
302
+ }
303
+ /**
304
+ * Action info captured during state updates
305
+ */
306
+ interface StateAction {
307
+ /**
308
+ * Action type/name
309
+ * - Redux: action.type
310
+ * - Zustand: inferred from stack trace or 'set'
311
+ */
312
+ type: string;
313
+ /**
314
+ * Action payload
315
+ * - Redux: action.payload
316
+ * - Zustand: partial state passed to set()
317
+ */
318
+ payload?: unknown;
319
+ }
320
+ /**
321
+ * Base shape for state events
322
+ */
323
+ interface BaseStateEvent {
324
+ phase: StatePhase;
325
+ sessionId: string;
326
+ timestamp: number;
327
+ }
328
+ /**
329
+ * Initial state snapshot sent when store is registered
330
+ */
331
+ interface StateInitEvent extends BaseStateEvent {
332
+ phase: StatePhase.INIT;
333
+ data: {
334
+ storeId: string;
335
+ library: StateLibrary;
336
+ state: unknown;
337
+ };
338
+ }
339
+ /**
340
+ * State update event sent on every state change
341
+ */
342
+ interface StateUpdateEvent extends BaseStateEvent {
343
+ phase: StatePhase.UPDATE;
344
+ data: {
345
+ storeId: string;
346
+ library: StateLibrary;
347
+ state: unknown;
348
+ action: StateAction;
349
+ stackTrace?: string;
350
+ };
351
+ }
352
+
289
353
  /**
290
354
  * Configuration options for Limelight SDK.
291
355
  *
@@ -349,6 +413,20 @@ interface LimelightConfig {
349
413
  * Flag to enable or disable render inspection.
350
414
  */
351
415
  enableRenderInspector?: boolean;
416
+ /**
417
+ * Zustand store hooks or Redux stores, keyed by display name
418
+ * @example { user: useUserStore, cart: useCartStore }
419
+ */
420
+ stores?: Record<string, unknown>;
421
+ /**
422
+ * Flag to enable or disable state inspection
423
+ * @default true (if stores are provided)
424
+ */
425
+ enableStateInspector?: boolean;
426
+ /**
427
+ * Flag to enable or disable internal logging for the Limelight SDK
428
+ */
429
+ internalLoggingEnabled?: boolean;
352
430
  /**
353
431
  * A callback function to modify or filter events before they are sent to the server
354
432
  */
@@ -372,7 +450,7 @@ interface ConnectionEvent {
372
450
  /**
373
451
  * Union type representing all possible Limelight messages.
374
452
  */
375
- type LimelightMessage = NetworkRequest | NetworkResponse | NetworkErrorEvent | ConsoleEvent | ConnectionEvent | RenderSnapshot | TransactionEvent;
453
+ type LimelightMessage = NetworkRequest | NetworkResponse | NetworkErrorEvent | ConsoleEvent | ConnectionEvent | RenderSnapshot | TransactionEvent | StateInitEvent | StateUpdateEvent;
376
454
 
377
455
  /**
378
456
  * Represents a single frame in a stack trace.
@@ -406,6 +484,7 @@ declare class LimelightClient {
406
484
  private xhrInterceptor;
407
485
  private consoleInterceptor;
408
486
  private renderInterceptor;
487
+ private stateInterceptor;
409
488
  constructor();
410
489
  /**
411
490
  * Configures the Limelight client with the provided settings.