@ezetgalaxy/titan 25.11.6 → 25.11.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ezetgalaxy/titan",
3
- "version": "25.11.6",
3
+ "version": "25.11.7",
4
4
  "description": "JavaScript backend framework that compiles your JS into a Rust + Axum server.",
5
5
  "license": "ISC",
6
6
  "author": "ezetgalaxy",
@@ -0,0 +1,3 @@
1
+ {
2
+ "POST:/hello": "hello"
3
+ }
@@ -0,0 +1,6 @@
1
+ // app/actions/hello.js
2
+ function hello(req) {
3
+ const name = req.name;
4
+ return { name, msg: `Hello ${name}` };
5
+ }
6
+ globalThis.hello = hello;
@@ -0,0 +1,15 @@
1
+ {
2
+ "__config": {
3
+ "port": 3000
4
+ },
5
+ "routes": {
6
+ "POST:/hello": {
7
+ "type": "action",
8
+ "value": "hello"
9
+ },
10
+ "GET:/": {
11
+ "type": "text",
12
+ "value": "Ready to land on Titan Planet 🚀"
13
+ }
14
+ }
15
+ }
@@ -9,7 +9,7 @@ use axum::{
9
9
  routing::any,
10
10
  Router,
11
11
  };
12
- use boa_engine::{Context, JsValue, Source};
12
+ use boa_engine::{Context, Source};
13
13
  use serde::Deserialize;
14
14
  use serde_json::Value;
15
15
  use tokio::net::TcpListener;
@@ -1,5 +1,6 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
+ import { bundle } from "./bundle.js";
3
4
 
4
5
  const cyan = (t) => `\x1b[36m${t}\x1b[0m`;
5
6
  const green = (t) => `\x1b[32m${t}\x1b[0m`;
@@ -38,8 +39,15 @@ const t = {
38
39
  return addRoute("POST", route);
39
40
  },
40
41
 
41
- start(port = 3000, msg = "") {
42
+ async start(port = 3000, msg = "") {
43
+
44
+
45
+ console.log(cyan("[Titan] Bundling actions..."));
46
+ await bundle();
47
+
42
48
  const base = path.join(process.cwd(), "server");
49
+ fs.mkdirSync(base, { recursive: true });
50
+
43
51
 
44
52
  fs.writeFileSync(
45
53
  path.join(base, "routes.json"),
@@ -52,6 +60,7 @@ const t = {
52
60
  );
53
61
 
54
62
  console.log(green(`Titan: routes.json + action_map.json written -> ${base}`));
63
+
55
64
  if (msg) console.log(cyan(msg));
56
65
  }
57
66
  };