tidewave 0.5.1 → 0.5.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.3] - 2025-11-12
4
+
5
+ * Make sure `instrumentation.ts` is compatible with webpack
6
+ * Handle undefined hosts in Vite
7
+
8
+ ## [0.5.2] - 2025-11-12
9
+
10
+ * Make sure chalk and commander are added as dependencies
11
+ * Serve /tidewave and /tidewave/config routes from Vite
12
+
3
13
  ## [0.5.1] - 2025-11-11
4
14
 
5
15
  * Add `npx tidewave install` and trim down dependency list.
package/README.md CHANGED
@@ -24,6 +24,28 @@ Protocol (MCP) server for your editors.
24
24
 
25
25
  If you are using Next.js, install Tidewave with:
26
26
 
27
+ ```sh
28
+ $ npx tidewave install
29
+ # or
30
+ $ yarn dlx tidewave install
31
+ # or
32
+ $ pnpm dlx tidewave install
33
+ # or
34
+ $ bunx tidewave install
35
+ ```
36
+
37
+ And you are almost there! Now make sure
38
+ [Tidewave is installed](https://hexdocs.pm/tidewave/installation.html) and you
39
+ are ready to connect Tidewave to your app.
40
+
41
+ In case the command abovees do not work, you can toggle the manual installation
42
+ instructions below
43
+
44
+ <details>
45
+ <summary>Show manual installation steps</summary><br />
46
+
47
+ **1. Add Tidewave as a dependency**
48
+
27
49
  ```sh
28
50
  $ npm install -D tidewave
29
51
  # or
@@ -34,6 +56,8 @@ $ pnpm add --save-dev tidewave
34
56
  $ bun add --dev tidewave
35
57
  ```
36
58
 
59
+ **2. Create `pages/api/tidewave.ts`**
60
+
37
61
  Then create `pages/api/tidewave.ts` with:
38
62
 
39
63
  ```typescript
@@ -60,8 +84,7 @@ export const config = {
60
84
  };
61
85
  ```
62
86
 
63
- _Note: this uses the **Pages Router**, however it works regardless of the router
64
- type you use in your application._
87
+ **3. Create the proxy.ts or middleware.ts**
65
88
 
66
89
  If you are using Next.js 16+, then create (or modify) `proxy.ts` with:
67
90
 
@@ -97,11 +120,14 @@ export const config = {
97
120
  };
98
121
  ```
99
122
 
123
+ **4. Create instrumentation.ts**
124
+
100
125
  Finally, we expose your application's spans, events, and logs to Tidewave MCP.
101
126
  First install the NodeSDK:
102
127
 
103
128
  ```sh
104
129
  npm install @opentelemetry/sdk-node
130
+ npm install -D @opentelemetry/sdk-trace-base @opentelemetry/sdk-logs
105
131
  ```
106
132
 
107
133
  And then create (or modify) a custom `instrumentation.ts` file in the root
@@ -109,41 +135,38 @@ directory of the project (or inside `src` folder if using one):
109
135
 
110
136
  ```typescript
111
137
  // instrumentation.ts
112
- import { NodeSDK } from '@opentelemetry/sdk-node';
113
138
  import type { SpanProcessor } from '@opentelemetry/sdk-trace-base';
114
139
  import type { LogRecordProcessor } from '@opentelemetry/sdk-logs';
115
140
 
116
141
  export async function register() {
117
- const runtime = process.env.NEXT_RUNTIME;
118
- const env = process.env.NODE_ENV;
119
-
120
- // Add your app own processes here existing configuration
121
- const sdkConfig: {
122
- spanProcessors: SpanProcessor[];
123
- logRecordProcessors: LogRecordProcessor[];
124
- } = {
125
- spanProcessors: [],
126
- logRecordProcessors: [],
127
- };
128
-
129
- // Conditionally add Tidewave processors in development
130
- if (runtime === 'nodejs' && env === 'development') {
131
- const { TidewaveSpanProcessor, TidewaveLogRecordProcessor } = await import(
132
- 'tidewave/next-js/instrumentation'
133
- );
134
-
135
- sdkConfig.spanProcessors.push(new TidewaveSpanProcessor());
136
- sdkConfig.logRecordProcessors.push(new TidewaveLogRecordProcessor());
142
+ if (process.env.NEXT_RUNTIME === 'nodejs') {
143
+ const { NodeSDK } = await import('@opentelemetry/sdk-node');
144
+
145
+ // Add your app own processes here existing configuration
146
+ const sdkConfig: {
147
+ spanProcessors: SpanProcessor[];
148
+ logRecordProcessors: LogRecordProcessor[];
149
+ } = {
150
+ spanProcessors: [],
151
+ logRecordProcessors: [],
152
+ };
153
+
154
+ // Conditionally add Tidewave processors in development
155
+ if (process.env.NODE_ENV === 'development') {
156
+ const { TidewaveSpanProcessor, TidewaveLogRecordProcessor } =
157
+ await import('tidewave/next-js/instrumentation');
158
+
159
+ sdkConfig.spanProcessors.push(new TidewaveSpanProcessor());
160
+ sdkConfig.logRecordProcessors.push(new TidewaveLogRecordProcessor());
161
+ }
162
+
163
+ const sdk = new NodeSDK(sdkConfig);
164
+ sdk.start();
137
165
  }
138
-
139
- const sdk = new NodeSDK(sdkConfig);
140
- sdk.start();
141
166
  }
142
167
  ```
143
168
 
144
- Now make sure
145
- [Tidewave is installed](https://hexdocs.pm/tidewave/installation.html) and you
146
- are ready to connect Tidewave to your app.
169
+ </details>
147
170
 
148
171
  ### React + Vite
149
172