tidewave 0.5.3 → 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 +4 -0
- package/dist/cli/index.js +21 -18
- package/dist/evaluation/eval_worker.js +21 -17
- package/dist/next-js/handler.js +21 -18
- package/dist/vite-plugin.js +21 -18
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
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,
|
|
@@ -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 = () => {};
|