@ezetgalaxy/titan 26.8.2 → 26.8.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/README.md +2 -11
- package/package.json +2 -2
- package/templates/js/titan/dev.js +26 -2
- package/templates/rust/titan/dev.js +27 -11
package/README.md
CHANGED
|
@@ -131,17 +131,8 @@ Both JS and Rust actions have access to the powerful `t` namespace:
|
|
|
131
131
|
* `t.log(msg)` — Sandboxed, structured logging
|
|
132
132
|
* `t.jwt.sign / verify` — Fast JWT operations
|
|
133
133
|
* `t.password.hash / verify` — Secure password handling
|
|
134
|
-
* `t.db` — Database access
|
|
135
|
-
|
|
136
|
-
### 🛣 Intelligent Routing
|
|
137
|
-
Define your routes in `routes.json`. Titan maps them to the correct action, regardless of language.
|
|
138
|
-
|
|
139
|
-
```json
|
|
140
|
-
{
|
|
141
|
-
"/hello": "hello", // variable name matches filename (hello.js)
|
|
142
|
-
"/compute": "compute" // variable name matches filename (compute.rs)
|
|
143
|
-
}
|
|
144
|
-
```
|
|
134
|
+
* `t.db` — Database access
|
|
135
|
+
---
|
|
145
136
|
|
|
146
137
|
### 🧩 Extensions System
|
|
147
138
|
Extend the runtime with custom Rust engines using **Titan Extensions**.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ezetgalaxy/titan",
|
|
3
|
-
"version": "26.8.
|
|
3
|
+
"version": "26.8.3",
|
|
4
4
|
"description": "Titan Planet is a JavaScript-first backend framework that embeds JS actions into a Rust + Axum server and ships as a single native binary. Routes are compiled to static metadata; only actions run in the embedded JS runtime. No Node.js. No event loop in production.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "ezetgalaxy",
|
|
@@ -52,4 +52,4 @@
|
|
|
52
52
|
"esbuild": "^0.27.2",
|
|
53
53
|
"prompts": "^2.4.2"
|
|
54
54
|
}
|
|
55
|
-
}
|
|
55
|
+
}
|
|
@@ -3,7 +3,6 @@ import { spawn, execSync } from "child_process";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
import fs from "fs";
|
|
6
|
-
import { bundle } from "./bundle.js";
|
|
7
6
|
|
|
8
7
|
// Required for __dirname in ES modules
|
|
9
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -39,12 +38,20 @@ function getTitanVersion() {
|
|
|
39
38
|
cur = path.join(cur, "..");
|
|
40
39
|
}
|
|
41
40
|
} catch (e2) { }
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
// Fallback to calling tit --version
|
|
44
|
+
const output = execSync("tit --version", { encoding: "utf-8" }).trim();
|
|
45
|
+
const match = output.match(/v(\d+\.\d+\.\d+)/);
|
|
46
|
+
if (match) return match[1];
|
|
47
|
+
} catch (e3) { }
|
|
42
48
|
}
|
|
43
49
|
return "0.1.0";
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
let serverProcess = null;
|
|
47
53
|
let isKilling = false;
|
|
54
|
+
let isFirstBoot = true;
|
|
48
55
|
|
|
49
56
|
// ... (killServer same as before)
|
|
50
57
|
async function killServer() {
|
|
@@ -156,7 +163,24 @@ async function startRustServer(retryCount = 0) {
|
|
|
156
163
|
isReady = true;
|
|
157
164
|
clearTimeout(slowTimer);
|
|
158
165
|
stopSpinner(true, "Your app is now orbiting Titan Planet");
|
|
159
|
-
|
|
166
|
+
|
|
167
|
+
if (isFirstBoot) {
|
|
168
|
+
process.stdout.write(stdoutBuffer);
|
|
169
|
+
isFirstBoot = false;
|
|
170
|
+
} else {
|
|
171
|
+
// On subsequent reloads, only print non-banner lines from the buffer
|
|
172
|
+
const lines = stdoutBuffer.split("\n");
|
|
173
|
+
for (const line of lines) {
|
|
174
|
+
const isBanner = line.includes("Titan server running") ||
|
|
175
|
+
line.includes("████████╗") ||
|
|
176
|
+
line.includes("╚══") ||
|
|
177
|
+
line.includes(" ██║") ||
|
|
178
|
+
line.includes(" ╚═╝");
|
|
179
|
+
if (!isBanner && line.trim()) {
|
|
180
|
+
process.stdout.write(line + "\n");
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
160
184
|
stdoutBuffer = "";
|
|
161
185
|
}
|
|
162
186
|
} else {
|
|
@@ -3,7 +3,6 @@ import { spawn, execSync } from "child_process";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
import fs from "fs";
|
|
6
|
-
import { bundle } from "./bundle.js";
|
|
7
6
|
|
|
8
7
|
// Required for __dirname in ES modules
|
|
9
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -39,12 +38,20 @@ function getTitanVersion() {
|
|
|
39
38
|
cur = path.join(cur, "..");
|
|
40
39
|
}
|
|
41
40
|
} catch (e2) { }
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
// Fallback to calling tit --version
|
|
44
|
+
const output = execSync("tit --version", { encoding: "utf-8" }).trim();
|
|
45
|
+
const match = output.match(/v(\d+\.\d+\.\d+)/);
|
|
46
|
+
if (match) return match[1];
|
|
47
|
+
} catch (e3) { }
|
|
42
48
|
}
|
|
43
49
|
return "0.1.0";
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
let serverProcess = null;
|
|
47
53
|
let isKilling = false;
|
|
54
|
+
let isFirstBoot = true;
|
|
48
55
|
|
|
49
56
|
// ... (killServer same as before)
|
|
50
57
|
async function killServer() {
|
|
@@ -156,7 +163,24 @@ async function startRustServer(retryCount = 0) {
|
|
|
156
163
|
isReady = true;
|
|
157
164
|
clearTimeout(slowTimer);
|
|
158
165
|
stopSpinner(true, "Your app is now orbiting Titan Planet");
|
|
159
|
-
|
|
166
|
+
|
|
167
|
+
if (isFirstBoot) {
|
|
168
|
+
process.stdout.write(stdoutBuffer);
|
|
169
|
+
isFirstBoot = false;
|
|
170
|
+
} else {
|
|
171
|
+
// On subsequent reloads, only print non-banner lines from the buffer
|
|
172
|
+
const lines = stdoutBuffer.split("\n");
|
|
173
|
+
for (const line of lines) {
|
|
174
|
+
const isBanner = line.includes("Titan server running") ||
|
|
175
|
+
line.includes("████████╗") ||
|
|
176
|
+
line.includes("╚══") ||
|
|
177
|
+
line.includes(" ██║") ||
|
|
178
|
+
line.includes(" ╚═╝");
|
|
179
|
+
if (!isBanner && line.trim()) {
|
|
180
|
+
process.stdout.write(line + "\n");
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
160
184
|
stdoutBuffer = "";
|
|
161
185
|
}
|
|
162
186
|
} else {
|
|
@@ -188,7 +212,7 @@ async function startRustServer(retryCount = 0) {
|
|
|
188
212
|
async function rebuild() {
|
|
189
213
|
try {
|
|
190
214
|
execSync("node app/app.js", { stdio: "ignore" });
|
|
191
|
-
|
|
215
|
+
// bundle is called inside app.js (t.start)
|
|
192
216
|
} catch (e) {
|
|
193
217
|
stopSpinner(false, "Failed to prepare runtime");
|
|
194
218
|
console.log(red(`[Titan] Error: ${e.message}`));
|
|
@@ -234,14 +258,6 @@ async function startDev() {
|
|
|
234
258
|
watcher.on("all", async (event, file) => {
|
|
235
259
|
if (timer) clearTimeout(timer);
|
|
236
260
|
timer = setTimeout(async () => {
|
|
237
|
-
// console.log("");
|
|
238
|
-
/*
|
|
239
|
-
if (file.includes(".env")) {
|
|
240
|
-
console.log(yellow("[Titan] Env Refreshed"));
|
|
241
|
-
} else {
|
|
242
|
-
console.log(cyan(`[Titan] Change: ${path.basename(file)}`));
|
|
243
|
-
}
|
|
244
|
-
*/
|
|
245
261
|
try {
|
|
246
262
|
await killServer();
|
|
247
263
|
await rebuild();
|