@getlimelight/sdk 0.2.1 → 0.3.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.
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
@@ -312,13 +312,13 @@ interface LimelightConfig {
312
312
  /**
313
313
  * The unique project key for authenticating with the Limelight server.
314
314
  */
315
- projectKey: string;
315
+ projectKey?: string;
316
316
  /**
317
317
  * The platform of the application (e.g., "ios", "android").
318
318
  */
319
319
  platform?: string;
320
320
  /**
321
- * The URL of the Limelight server to connect to.
321
+ * The URL of the Limelight server to connect to. If not provided, it falls back to the local wss server url if there is no project key, or the web wss url if there is a project key.
322
322
  */
323
323
  serverUrl?: string;
324
324
  /**
@@ -427,7 +427,7 @@ declare class LimelightClient {
427
427
  * @param {LimelightConfig} [config] - Optional configuration object.
428
428
  * @returns {void}
429
429
  */
430
- connect(config: LimelightConfig): void;
430
+ connect(config?: LimelightConfig): void;
431
431
  /**
432
432
  * Attempts to reconnect to the Limelight server using exponential backoff.
433
433
  * Will retry up to maxReconnectAttempts times with increasing delays.
package/dist/index.d.ts CHANGED
@@ -312,13 +312,13 @@ interface LimelightConfig {
312
312
  /**
313
313
  * The unique project key for authenticating with the Limelight server.
314
314
  */
315
- projectKey: string;
315
+ projectKey?: string;
316
316
  /**
317
317
  * The platform of the application (e.g., "ios", "android").
318
318
  */
319
319
  platform?: string;
320
320
  /**
321
- * The URL of the Limelight server to connect to.
321
+ * The URL of the Limelight server to connect to. If not provided, it falls back to the local wss server url if there is no project key, or the web wss url if there is a project key.
322
322
  */
323
323
  serverUrl?: string;
324
324
  /**
@@ -427,7 +427,7 @@ declare class LimelightClient {
427
427
  * @param {LimelightConfig} [config] - Optional configuration object.
428
428
  * @returns {void}
429
429
  */
430
- connect(config: LimelightConfig): void;
430
+ connect(config?: LimelightConfig): void;
431
431
  /**
432
432
  * Attempts to reconnect to the Limelight server using exponential backoff.
433
433
  * Will retry up to maxReconnectAttempts times with increasing delays.
package/dist/index.js CHANGED
@@ -255,7 +255,10 @@ var SENSITIVE_HEADERS = [
255
255
  "x-secret",
256
256
  "bearer"
257
257
  ];
258
- var SDK_VERSION = true ? "0.2.1" : "test-version";
258
+ var LIMELIGHT_WEB_WSS_URL = "wss://api.getlimelight.io";
259
+ var LIMELIGHT_DESKTOP_WSS_URL = "ws://localhost:8484";
260
+ var WS_PATH = "/limelight";
261
+ var SDK_VERSION = true ? "0.3.1" : "test-version";
259
262
  var RENDER_THRESHOLDS = {
260
263
  HOT_VELOCITY: 5,
261
264
  HIGH_RENDER_COUNT: 50,
@@ -1633,18 +1636,19 @@ var LimelightClient = class {
1633
1636
  * @returns {void}
1634
1637
  */
1635
1638
  configure(config) {
1636
- const isEnabled = config.enabled ?? isDevelopment();
1639
+ const isEnabled = config?.enabled ?? isDevelopment();
1640
+ const configServerUrl = config?.serverUrl ? config.serverUrl : config?.projectKey ? `${LIMELIGHT_WEB_WSS_URL}${WS_PATH}` : `${LIMELIGHT_DESKTOP_WSS_URL}${WS_PATH}`;
1637
1641
  this.config = {
1638
- appName: "Limelight App",
1639
- serverUrl: "wss://api.getlimelight.io/limelight",
1642
+ ...config,
1643
+ appName: config?.appName ?? "Limelight App",
1644
+ serverUrl: configServerUrl,
1640
1645
  enabled: isEnabled,
1641
- enableNetworkInspector: true,
1642
- enableConsole: true,
1643
- enableGraphQL: true,
1644
- enableRenderInspector: true,
1645
- ...config
1646
+ enableNetworkInspector: config?.enableNetworkInspector ?? true,
1647
+ enableConsole: config?.enableConsole ?? true,
1648
+ enableGraphQL: config?.enableGraphQL ?? true,
1649
+ enableRenderInspector: config?.enableRenderInspector ?? true
1646
1650
  };
1647
- if (!this.config.enabled) {
1651
+ if (!this.config?.enabled) {
1648
1652
  return;
1649
1653
  }
1650
1654
  this.sessionId = createSessionId();
@@ -1675,13 +1679,7 @@ var LimelightClient = class {
1675
1679
  * @returns {void}
1676
1680
  */
1677
1681
  connect(config) {
1678
- if (config) {
1679
- this.configure(config);
1680
- } else if (!this.config) {
1681
- throw new Error(
1682
- "[Limelight] Limelight not configured. Please provide a configuration object when calling connect(). Project id is the only required field."
1683
- );
1684
- }
1682
+ this.configure(config);
1685
1683
  if (!this.config?.enabled) {
1686
1684
  return;
1687
1685
  }
@@ -1713,7 +1711,7 @@ var LimelightClient = class {
1713
1711
  data: {
1714
1712
  appName,
1715
1713
  platform: platform || (typeof window !== "undefined" ? "web" : "react-native"),
1716
- projectKey: this.config.projectKey,
1714
+ projectKey: this.config.projectKey || "",
1717
1715
  sdkVersion: SDK_VERSION
1718
1716
  }
1719
1717
  };
@@ -1755,13 +1753,7 @@ var LimelightClient = class {
1755
1753
  );
1756
1754
  this.reconnectTimer = setTimeout(() => {
1757
1755
  this.reconnectTimer = null;
1758
- if (this.config) {
1759
- this.configure(this.config);
1760
- } else if (!this.config) {
1761
- throw new Error(
1762
- "[Limelight] Limelight not configured. Please provide a configuration object when calling connect(). Project id is the only required field."
1763
- );
1764
- }
1756
+ this.connect(this.config || void 0);
1765
1757
  }, delay);
1766
1758
  }
1767
1759
  /**