tidewave 0.5.2 → 0.5.4
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 +9 -0
- package/README.md +23 -24
- package/dist/cli/index.js +44 -42
- package/dist/evaluation/eval_worker.js +21 -17
- package/dist/next-js/handler.js +21 -18
- package/dist/vite-plugin.js +23 -18
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.5.4] - 2025-11-13
|
|
4
|
+
|
|
5
|
+
* Fix async messages on `project_eval`
|
|
6
|
+
|
|
7
|
+
## [0.5.3] - 2025-11-12
|
|
8
|
+
|
|
9
|
+
* Make sure `instrumentation.ts` is compatible with webpack
|
|
10
|
+
* Handle undefined hosts in Vite
|
|
11
|
+
|
|
3
12
|
## [0.5.2] - 2025-11-12
|
|
4
13
|
|
|
5
14
|
* Make sure chalk and commander are added as dependencies
|
package/README.md
CHANGED
|
@@ -135,35 +135,34 @@ directory of the project (or inside `src` folder if using one):
|
|
|
135
135
|
|
|
136
136
|
```typescript
|
|
137
137
|
// instrumentation.ts
|
|
138
|
-
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
139
138
|
import type { SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
140
139
|
import type { LogRecordProcessor } from '@opentelemetry/sdk-logs';
|
|
141
140
|
|
|
142
141
|
export async function register() {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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();
|
|
163
165
|
}
|
|
164
|
-
|
|
165
|
-
const sdk = new NodeSDK(sdkConfig);
|
|
166
|
-
sdk.start();
|
|
167
166
|
}
|
|
168
167
|
```
|
|
169
168
|
|
package/dist/cli/index.js
CHANGED
|
@@ -6725,31 +6725,34 @@ async function executeIsolated(request) {
|
|
|
6725
6725
|
const packageRoot = dirname(require2.resolve("tidewave/package.json"));
|
|
6726
6726
|
const workerPath = join(packageRoot, "dist/evaluation/eval_worker.js");
|
|
6727
6727
|
const child = fork(workerPath, { silent: true });
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
stdout: "",
|
|
6732
|
-
stderr: ""
|
|
6733
|
-
};
|
|
6728
|
+
let result = null;
|
|
6729
|
+
const stdoutChunks = [];
|
|
6730
|
+
const stderrChunks = [];
|
|
6734
6731
|
child.stdout?.on("data", (data) => {
|
|
6735
|
-
|
|
6732
|
+
stdoutChunks.push(data.toString());
|
|
6736
6733
|
});
|
|
6737
6734
|
child.stderr?.on("data", (data) => {
|
|
6738
|
-
|
|
6735
|
+
stderrChunks.push(data.toString());
|
|
6739
6736
|
});
|
|
6740
6737
|
child.on("message", (msg) => {
|
|
6741
6738
|
if (msg.type === "result") {
|
|
6742
6739
|
const { data, success } = msg;
|
|
6743
|
-
|
|
6744
|
-
|
|
6740
|
+
result = { success, result: data };
|
|
6741
|
+
child.send({ type: "finish" });
|
|
6745
6742
|
}
|
|
6746
6743
|
});
|
|
6747
6744
|
child.on("exit", (code) => {
|
|
6745
|
+
if (result === null) {
|
|
6746
|
+
result = {
|
|
6747
|
+
success: false,
|
|
6748
|
+
result: `Evaluation process terminated unexpectedly with code ${code}`
|
|
6749
|
+
};
|
|
6750
|
+
}
|
|
6748
6751
|
resolve({
|
|
6749
|
-
success:
|
|
6750
|
-
result:
|
|
6751
|
-
stdout:
|
|
6752
|
-
stderr:
|
|
6752
|
+
success: result.success,
|
|
6753
|
+
result: result.result,
|
|
6754
|
+
stdout: stdoutChunks.join(""),
|
|
6755
|
+
stderr: stderrChunks.join("")
|
|
6753
6756
|
});
|
|
6754
6757
|
});
|
|
6755
6758
|
const { timeout } = request;
|
|
@@ -6758,12 +6761,12 @@ async function executeIsolated(request) {
|
|
|
6758
6761
|
resolve({
|
|
6759
6762
|
success: false,
|
|
6760
6763
|
result: `Evaluation timed out after ${timeout} milliseconds`,
|
|
6761
|
-
stdout:
|
|
6762
|
-
stderr:
|
|
6764
|
+
stdout: stdoutChunks.join(""),
|
|
6765
|
+
stderr: stderrChunks.join("")
|
|
6763
6766
|
});
|
|
6764
6767
|
}, timeout);
|
|
6765
6768
|
child.on("exit", () => clearTimeout(timeoutId));
|
|
6766
|
-
child.send(request);
|
|
6769
|
+
child.send({ type: "evaluate", request });
|
|
6767
6770
|
});
|
|
6768
6771
|
}
|
|
6769
6772
|
var init_code_executor = () => {};
|
|
@@ -6784,7 +6787,7 @@ var init_src = __esm(() => {
|
|
|
6784
6787
|
});
|
|
6785
6788
|
|
|
6786
6789
|
// package.json
|
|
6787
|
-
var name = "tidewave", version = "0.5.
|
|
6790
|
+
var name = "tidewave", version = "0.5.4", package_default;
|
|
6788
6791
|
var init_package = __esm(() => {
|
|
6789
6792
|
package_default = {
|
|
6790
6793
|
name,
|
|
@@ -17265,36 +17268,35 @@ async function createInstrumentation(dir, dryRun) {
|
|
|
17265
17268
|
printInstrumentationInstructions();
|
|
17266
17269
|
return;
|
|
17267
17270
|
}
|
|
17268
|
-
const instrumentationContent =
|
|
17269
|
-
import {
|
|
17270
|
-
import type { SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
17271
|
-
import type { LogRecordProcessor } from '@opentelemetry/sdk-logs';
|
|
17271
|
+
const instrumentationContent = `import type { SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
17272
|
+
import type { LogRecordProcessor } from "@opentelemetry/sdk-logs";
|
|
17272
17273
|
|
|
17273
17274
|
export async function register() {
|
|
17274
|
-
|
|
17275
|
-
|
|
17275
|
+
if (process.env.NEXT_RUNTIME === "nodejs") {
|
|
17276
|
+
const { NodeSDK } = await import("@opentelemetry/sdk-node");
|
|
17276
17277
|
|
|
17277
|
-
|
|
17278
|
-
|
|
17279
|
-
|
|
17280
|
-
|
|
17281
|
-
|
|
17282
|
-
|
|
17283
|
-
|
|
17284
|
-
|
|
17278
|
+
// Add your app own processes here existing configuration
|
|
17279
|
+
const sdkConfig: {
|
|
17280
|
+
spanProcessors: SpanProcessor[];
|
|
17281
|
+
logRecordProcessors: LogRecordProcessor[];
|
|
17282
|
+
} = {
|
|
17283
|
+
spanProcessors: [],
|
|
17284
|
+
logRecordProcessors: [],
|
|
17285
|
+
};
|
|
17285
17286
|
|
|
17286
|
-
|
|
17287
|
-
|
|
17288
|
-
|
|
17289
|
-
|
|
17290
|
-
|
|
17287
|
+
// Conditionally add Tidewave processors in development
|
|
17288
|
+
if (process.env.NODE_ENV === "development") {
|
|
17289
|
+
const { TidewaveSpanProcessor, TidewaveLogRecordProcessor } = await import(
|
|
17290
|
+
"tidewave/next-js/instrumentation"
|
|
17291
|
+
);
|
|
17291
17292
|
|
|
17292
|
-
|
|
17293
|
-
|
|
17294
|
-
|
|
17293
|
+
sdkConfig.spanProcessors.push(new TidewaveSpanProcessor());
|
|
17294
|
+
sdkConfig.logRecordProcessors.push(new TidewaveLogRecordProcessor());
|
|
17295
|
+
}
|
|
17295
17296
|
|
|
17296
|
-
|
|
17297
|
-
|
|
17297
|
+
const sdk = new NodeSDK(sdkConfig);
|
|
17298
|
+
sdk.start();
|
|
17299
|
+
}
|
|
17298
17300
|
}
|
|
17299
17301
|
`;
|
|
17300
17302
|
if (dryRun) {
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
// src/evaluation/eval_worker.ts
|
|
2
|
-
process.on("message", async (
|
|
2
|
+
process.on("message", async (message) => {
|
|
3
3
|
if (!process.send) {
|
|
4
4
|
console.error("[Tidewave] Unable to establish communication channel with code-executor.");
|
|
5
5
|
process.exit(1);
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
if (message.type === "evaluate") {
|
|
8
|
+
const { code, args } = message.request;
|
|
9
|
+
try {
|
|
10
|
+
const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;
|
|
11
|
+
const fn = new AsyncFunction(code);
|
|
12
|
+
const result = await fn(...args);
|
|
13
|
+
process.send({
|
|
14
|
+
type: "result",
|
|
15
|
+
success: true,
|
|
16
|
+
data: (result ?? null) && result
|
|
17
|
+
});
|
|
18
|
+
} catch (error) {
|
|
19
|
+
process.send({
|
|
20
|
+
type: "result",
|
|
21
|
+
success: false,
|
|
22
|
+
data: new String(error)
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
} else if (message.type === "finish") {
|
|
26
|
+
process.exit(0);
|
|
22
27
|
}
|
|
23
|
-
process.exit(0);
|
|
24
28
|
});
|
package/dist/next-js/handler.js
CHANGED
|
@@ -20137,7 +20137,7 @@ Defaults to 30000 (30 seconds).`),
|
|
|
20137
20137
|
});
|
|
20138
20138
|
|
|
20139
20139
|
// package.json
|
|
20140
|
-
var name = "tidewave", version = "0.5.
|
|
20140
|
+
var name = "tidewave", version = "0.5.4", package_default;
|
|
20141
20141
|
var init_package = __esm(() => {
|
|
20142
20142
|
package_default = {
|
|
20143
20143
|
name,
|
|
@@ -21031,31 +21031,34 @@ async function executeIsolated(request) {
|
|
|
21031
21031
|
const packageRoot = dirname(require2.resolve("tidewave/package.json"));
|
|
21032
21032
|
const workerPath = join(packageRoot, "dist/evaluation/eval_worker.js");
|
|
21033
21033
|
const child = fork(workerPath, { silent: true });
|
|
21034
|
-
|
|
21035
|
-
|
|
21036
|
-
|
|
21037
|
-
stdout: "",
|
|
21038
|
-
stderr: ""
|
|
21039
|
-
};
|
|
21034
|
+
let result = null;
|
|
21035
|
+
const stdoutChunks = [];
|
|
21036
|
+
const stderrChunks = [];
|
|
21040
21037
|
child.stdout?.on("data", (data) => {
|
|
21041
|
-
|
|
21038
|
+
stdoutChunks.push(data.toString());
|
|
21042
21039
|
});
|
|
21043
21040
|
child.stderr?.on("data", (data) => {
|
|
21044
|
-
|
|
21041
|
+
stderrChunks.push(data.toString());
|
|
21045
21042
|
});
|
|
21046
21043
|
child.on("message", (msg) => {
|
|
21047
21044
|
if (msg.type === "result") {
|
|
21048
21045
|
const { data, success } = msg;
|
|
21049
|
-
|
|
21050
|
-
|
|
21046
|
+
result = { success, result: data };
|
|
21047
|
+
child.send({ type: "finish" });
|
|
21051
21048
|
}
|
|
21052
21049
|
});
|
|
21053
21050
|
child.on("exit", (code) => {
|
|
21051
|
+
if (result === null) {
|
|
21052
|
+
result = {
|
|
21053
|
+
success: false,
|
|
21054
|
+
result: `Evaluation process terminated unexpectedly with code ${code}`
|
|
21055
|
+
};
|
|
21056
|
+
}
|
|
21054
21057
|
resolve({
|
|
21055
|
-
success:
|
|
21056
|
-
result:
|
|
21057
|
-
stdout:
|
|
21058
|
-
stderr:
|
|
21058
|
+
success: result.success,
|
|
21059
|
+
result: result.result,
|
|
21060
|
+
stdout: stdoutChunks.join(""),
|
|
21061
|
+
stderr: stderrChunks.join("")
|
|
21059
21062
|
});
|
|
21060
21063
|
});
|
|
21061
21064
|
const { timeout } = request;
|
|
@@ -21064,12 +21067,12 @@ async function executeIsolated(request) {
|
|
|
21064
21067
|
resolve({
|
|
21065
21068
|
success: false,
|
|
21066
21069
|
result: `Evaluation timed out after ${timeout} milliseconds`,
|
|
21067
|
-
stdout:
|
|
21068
|
-
stderr:
|
|
21070
|
+
stdout: stdoutChunks.join(""),
|
|
21071
|
+
stderr: stderrChunks.join("")
|
|
21069
21072
|
});
|
|
21070
21073
|
}, timeout);
|
|
21071
21074
|
child.on("exit", () => clearTimeout(timeoutId));
|
|
21072
|
-
child.send(request);
|
|
21075
|
+
child.send({ type: "evaluate", request });
|
|
21073
21076
|
});
|
|
21074
21077
|
}
|
|
21075
21078
|
var init_code_executor = () => {};
|
package/dist/vite-plugin.js
CHANGED
|
@@ -20137,7 +20137,7 @@ Defaults to 30000 (30 seconds).`),
|
|
|
20137
20137
|
});
|
|
20138
20138
|
|
|
20139
20139
|
// package.json
|
|
20140
|
-
var name = "tidewave", version = "0.5.
|
|
20140
|
+
var name = "tidewave", version = "0.5.4", package_default;
|
|
20141
20141
|
var init_package = __esm(() => {
|
|
20142
20142
|
package_default = {
|
|
20143
20143
|
name,
|
|
@@ -21031,31 +21031,34 @@ async function executeIsolated(request) {
|
|
|
21031
21031
|
const packageRoot = dirname(require2.resolve("tidewave/package.json"));
|
|
21032
21032
|
const workerPath = join(packageRoot, "dist/evaluation/eval_worker.js");
|
|
21033
21033
|
const child = fork(workerPath, { silent: true });
|
|
21034
|
-
|
|
21035
|
-
|
|
21036
|
-
|
|
21037
|
-
stdout: "",
|
|
21038
|
-
stderr: ""
|
|
21039
|
-
};
|
|
21034
|
+
let result = null;
|
|
21035
|
+
const stdoutChunks = [];
|
|
21036
|
+
const stderrChunks = [];
|
|
21040
21037
|
child.stdout?.on("data", (data) => {
|
|
21041
|
-
|
|
21038
|
+
stdoutChunks.push(data.toString());
|
|
21042
21039
|
});
|
|
21043
21040
|
child.stderr?.on("data", (data) => {
|
|
21044
|
-
|
|
21041
|
+
stderrChunks.push(data.toString());
|
|
21045
21042
|
});
|
|
21046
21043
|
child.on("message", (msg) => {
|
|
21047
21044
|
if (msg.type === "result") {
|
|
21048
21045
|
const { data, success } = msg;
|
|
21049
|
-
|
|
21050
|
-
|
|
21046
|
+
result = { success, result: data };
|
|
21047
|
+
child.send({ type: "finish" });
|
|
21051
21048
|
}
|
|
21052
21049
|
});
|
|
21053
21050
|
child.on("exit", (code) => {
|
|
21051
|
+
if (result === null) {
|
|
21052
|
+
result = {
|
|
21053
|
+
success: false,
|
|
21054
|
+
result: `Evaluation process terminated unexpectedly with code ${code}`
|
|
21055
|
+
};
|
|
21056
|
+
}
|
|
21054
21057
|
resolve({
|
|
21055
|
-
success:
|
|
21056
|
-
result:
|
|
21057
|
-
stdout:
|
|
21058
|
-
stderr:
|
|
21058
|
+
success: result.success,
|
|
21059
|
+
result: result.result,
|
|
21060
|
+
stdout: stdoutChunks.join(""),
|
|
21061
|
+
stderr: stderrChunks.join("")
|
|
21059
21062
|
});
|
|
21060
21063
|
});
|
|
21061
21064
|
const { timeout } = request;
|
|
@@ -21064,12 +21067,12 @@ async function executeIsolated(request) {
|
|
|
21064
21067
|
resolve({
|
|
21065
21068
|
success: false,
|
|
21066
21069
|
result: `Evaluation timed out after ${timeout} milliseconds`,
|
|
21067
|
-
stdout:
|
|
21068
|
-
stderr:
|
|
21070
|
+
stdout: stdoutChunks.join(""),
|
|
21071
|
+
stderr: stderrChunks.join("")
|
|
21069
21072
|
});
|
|
21070
21073
|
}, timeout);
|
|
21071
21074
|
child.on("exit", () => clearTimeout(timeoutId));
|
|
21072
|
-
child.send(request);
|
|
21075
|
+
child.send({ type: "evaluate", request });
|
|
21073
21076
|
});
|
|
21074
21077
|
}
|
|
21075
21078
|
var init_code_executor = () => {};
|
|
@@ -35014,6 +35017,8 @@ async function tidewaveServer(server, config = DEFAULT_CONFIG) {
|
|
|
35014
35017
|
}
|
|
35015
35018
|
if (typeof host === "string") {
|
|
35016
35019
|
config.host = host;
|
|
35020
|
+
} else if (host === undefined) {
|
|
35021
|
+
config.host = "localhost";
|
|
35017
35022
|
}
|
|
35018
35023
|
if (!(config.host || config.port)) {
|
|
35019
35024
|
console.error(`[Tidewave] should have both host and port configured, got: host: ${host} port: ${port}`);
|