tidewave 0.5.3 → 0.5.5
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 +5 -0
- package/dist/cli/index.js +31 -32
- package/dist/evaluation/eval_worker.js +21 -17
- package/dist/next-js/handler.js +23 -20
- package/dist/tools.d.ts +3 -3
- package/dist/vite-plugin.js +23 -20
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.5.5] - 2025-11-25
|
|
4
|
+
|
|
5
|
+
* Fix missing items element on `project_eval`
|
|
6
|
+
* Allow install to continue even if dependencies cannot be installed
|
|
7
|
+
|
|
8
|
+
## [0.5.4] - 2025-11-13
|
|
9
|
+
|
|
10
|
+
* Fix async messages on `project_eval`
|
|
11
|
+
|
|
3
12
|
## [0.5.3] - 2025-11-12
|
|
4
13
|
|
|
5
14
|
* Make sure `instrumentation.ts` is compatible with webpack
|
package/README.md
CHANGED
|
@@ -283,6 +283,11 @@ bun run format:check # Check Prettier formatting
|
|
|
283
283
|
bun run clean # Clean dist directory
|
|
284
284
|
```
|
|
285
285
|
|
|
286
|
+
## Acknowledgements
|
|
287
|
+
|
|
288
|
+
A thank you to [Zoey](https://github.com/zoedsoupe/) for implementing both Next.js and
|
|
289
|
+
Vite integrations as well as the CLI interface.
|
|
290
|
+
|
|
286
291
|
## License
|
|
287
292
|
|
|
288
293
|
Copyright (c) 2025 Dashbit
|
package/dist/cli/index.js
CHANGED
|
@@ -5865,8 +5865,8 @@ Imports are allowed only as the form of dynamic imports with async/await, e.g.:
|
|
|
5865
5865
|
const path = await import('node:path');
|
|
5866
5866
|
`;
|
|
5867
5867
|
projectEvalInputSchema = exports_external.object({
|
|
5868
|
-
code: exports_external.string().describe("The JavaScript
|
|
5869
|
-
arguments: exports_external.array(exports_external.
|
|
5868
|
+
code: exports_external.string().describe("The JavaScript code to evaluate."),
|
|
5869
|
+
arguments: exports_external.array(exports_external.unknown()).optional().default([]).describe("The arguments to pass to evaluation. They are available inside the evaluated code as `arguments`."),
|
|
5870
5870
|
timeout: exports_external.number().optional().default(30000).describe(`Optional. A timeout in milliseconds after which the execution stops if it did not finish yet.
|
|
5871
5871
|
Defaults to 30000 (30 seconds).`),
|
|
5872
5872
|
json: exports_external.boolean().optional().default(false).describe("Whether to return the result as JSON or not (string)")
|
|
@@ -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.5", package_default;
|
|
6788
6791
|
var init_package = __esm(() => {
|
|
6789
6792
|
package_default = {
|
|
6790
6793
|
name,
|
|
@@ -17014,11 +17017,6 @@ The installer only works for Next.js projects
|
|
|
17014
17017
|
process.exit(1);
|
|
17015
17018
|
}
|
|
17016
17019
|
console.log(source_default.green(`✅ Detected Next.js ${nextVersion.raw} (v${nextVersion.major})`));
|
|
17017
|
-
if (!skipDeps) {
|
|
17018
|
-
await installDependencies(targetDir, dryRun);
|
|
17019
|
-
} else {
|
|
17020
|
-
console.log(source_default.gray("⏭️ Skipping dependency installation"));
|
|
17021
|
-
}
|
|
17022
17020
|
const steps = [
|
|
17023
17021
|
() => createApiHandler(targetDir, dryRun),
|
|
17024
17022
|
() => createMiddleware(targetDir, nextVersion, dryRun),
|
|
@@ -17027,6 +17025,9 @@ The installer only works for Next.js projects
|
|
|
17027
17025
|
for (const step of steps) {
|
|
17028
17026
|
await step();
|
|
17029
17027
|
}
|
|
17028
|
+
if (!skipDeps) {
|
|
17029
|
+
await installDependencies(targetDir, dryRun);
|
|
17030
|
+
}
|
|
17030
17031
|
console.log(source_default.green(`
|
|
17031
17032
|
✅ Tidewave setup complete!
|
|
17032
17033
|
`));
|
|
@@ -17129,9 +17130,7 @@ async function installDependencies(dir, dryRun) {
|
|
|
17129
17130
|
console.log(source_default.gray(`
|
|
17130
17131
|
Please install manually:
|
|
17131
17132
|
${pm} ${devCmds.join(" ")}
|
|
17132
|
-
${pm} ${depCmds.join(" ")}
|
|
17133
|
-
`));
|
|
17134
|
-
process.exit(1);
|
|
17133
|
+
${pm} ${depCmds.join(" ")}`));
|
|
17135
17134
|
}
|
|
17136
17135
|
}
|
|
17137
17136
|
async function createApiHandler(dir, dryRun) {
|
|
@@ -17165,9 +17164,9 @@ export const config = {
|
|
|
17165
17164
|
return;
|
|
17166
17165
|
}
|
|
17167
17166
|
const shouldOverwrite = await promptUser(source_default.yellow(`
|
|
17168
|
-
⚠️
|
|
17167
|
+
⚠️ ${path5.relative(dir, handlerPath)} already exists. Overwrite? (Y/n): `));
|
|
17169
17168
|
if (!shouldOverwrite) {
|
|
17170
|
-
console.log(source_default.gray(`⏭️
|
|
17169
|
+
console.log(source_default.gray(`⏭️ Skipping: ${path5.relative(dir, handlerPath)}`));
|
|
17171
17170
|
return;
|
|
17172
17171
|
}
|
|
17173
17172
|
}
|
|
@@ -17184,7 +17183,7 @@ async function createMiddleware(dir, nextVersion, dryRun) {
|
|
|
17184
17183
|
const fileName = isNext16Plus ? "proxy.ts" : "middleware.ts";
|
|
17185
17184
|
const filePath = path5.join(dir, fileName);
|
|
17186
17185
|
if (fs2.existsSync(filePath)) {
|
|
17187
|
-
console.log(source_default.yellow(`⏭️
|
|
17186
|
+
console.log(source_default.yellow(`⏭️ ${fileName} already exists`));
|
|
17188
17187
|
const content = fs2.readFileSync(filePath, "utf-8");
|
|
17189
17188
|
if (content.includes("/tidewave") && content.includes("/api/tidewave")) {
|
|
17190
17189
|
console.log(source_default.green(`✅ ${fileName} already configured for Tidewave`));
|
|
@@ -17253,7 +17252,7 @@ async function createInstrumentation(dir, dryRun) {
|
|
|
17253
17252
|
if (fs2.existsSync(rootPath) || fs2.existsSync(srcPath)) {
|
|
17254
17253
|
const existingPath = fs2.existsSync(rootPath) ? rootPath : srcPath;
|
|
17255
17254
|
const existingFile = fs2.existsSync(rootPath) ? "instrumentation.ts" : "src/instrumentation.ts";
|
|
17256
|
-
console.log(source_default.yellow(`⏭️
|
|
17255
|
+
console.log(source_default.yellow(`⏭️ ${existingFile} already exists`));
|
|
17257
17256
|
const content = fs2.readFileSync(existingPath, "utf-8");
|
|
17258
17257
|
if (content.includes("TidewaveSpanProcessor") && content.includes("TidewaveLogRecordProcessor")) {
|
|
17259
17258
|
console.log(source_default.green(`✅ ${existingFile} already configured for Tidewave`));
|
|
@@ -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
|
@@ -20058,8 +20058,8 @@ Imports are allowed only as the form of dynamic imports with async/await, e.g.:
|
|
|
20058
20058
|
const path = await import('node:path');
|
|
20059
20059
|
`;
|
|
20060
20060
|
projectEvalInputSchema = exports_external.object({
|
|
20061
|
-
code: exports_external.string().describe("The JavaScript
|
|
20062
|
-
arguments: exports_external.array(exports_external.
|
|
20061
|
+
code: exports_external.string().describe("The JavaScript code to evaluate."),
|
|
20062
|
+
arguments: exports_external.array(exports_external.unknown()).optional().default([]).describe("The arguments to pass to evaluation. They are available inside the evaluated code as `arguments`."),
|
|
20063
20063
|
timeout: exports_external.number().optional().default(30000).describe(`Optional. A timeout in milliseconds after which the execution stops if it did not finish yet.
|
|
20064
20064
|
Defaults to 30000 (30 seconds).`),
|
|
20065
20065
|
json: exports_external.boolean().optional().default(false).describe("Whether to return the result as JSON or not (string)")
|
|
@@ -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.5", 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/tools.d.ts
CHANGED
|
@@ -28,18 +28,18 @@ export interface Tools {
|
|
|
28
28
|
}
|
|
29
29
|
export declare const projectEvalInputSchema: z.ZodObject<{
|
|
30
30
|
code: z.ZodString;
|
|
31
|
-
arguments: z.ZodDefault<z.ZodOptional<z.ZodArray<z.
|
|
31
|
+
arguments: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>>;
|
|
32
32
|
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
33
33
|
json: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
34
34
|
}, "strip", z.ZodTypeAny, {
|
|
35
35
|
code: string;
|
|
36
36
|
timeout: number;
|
|
37
|
-
arguments:
|
|
37
|
+
arguments: unknown[];
|
|
38
38
|
json: boolean;
|
|
39
39
|
}, {
|
|
40
40
|
code: string;
|
|
41
41
|
timeout?: number | undefined;
|
|
42
|
-
arguments?:
|
|
42
|
+
arguments?: unknown[] | undefined;
|
|
43
43
|
json?: boolean | undefined;
|
|
44
44
|
}>;
|
|
45
45
|
export declare const docsInputSchema: z.ZodObject<{
|
package/dist/vite-plugin.js
CHANGED
|
@@ -20058,8 +20058,8 @@ Imports are allowed only as the form of dynamic imports with async/await, e.g.:
|
|
|
20058
20058
|
const path = await import('node:path');
|
|
20059
20059
|
`;
|
|
20060
20060
|
projectEvalInputSchema = exports_external.object({
|
|
20061
|
-
code: exports_external.string().describe("The JavaScript
|
|
20062
|
-
arguments: exports_external.array(exports_external.
|
|
20061
|
+
code: exports_external.string().describe("The JavaScript code to evaluate."),
|
|
20062
|
+
arguments: exports_external.array(exports_external.unknown()).optional().default([]).describe("The arguments to pass to evaluation. They are available inside the evaluated code as `arguments`."),
|
|
20063
20063
|
timeout: exports_external.number().optional().default(30000).describe(`Optional. A timeout in milliseconds after which the execution stops if it did not finish yet.
|
|
20064
20064
|
Defaults to 30000 (30 seconds).`),
|
|
20065
20065
|
json: exports_external.boolean().optional().default(false).describe("Whether to return the result as JSON or not (string)")
|
|
@@ -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.5", 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 = () => {};
|