@base44-preview/cli 0.0.32-pr.271.5d60e7b → 0.0.33-pr.259.052dce4

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.
@@ -0,0 +1,31 @@
1
+ // deno-runtime/main.ts
2
+ var functionPath = Deno.env.get("FUNCTION_PATH");
3
+ var port = parseInt(Deno.env.get("FUNCTION_PORT") || "8000", 10);
4
+ var functionName = Deno.env.get("FUNCTION_NAME") || "unknown";
5
+ if (!functionPath) {
6
+ console.error("[wrapper] FUNCTION_PATH environment variable is required");
7
+ Deno.exit(1);
8
+ }
9
+ var originalServe = Deno.serve.bind(Deno);
10
+ Deno.serve = (optionsOrHandler, maybeHandler) => {
11
+ const onListen = () => {
12
+ console.log(`[${functionName}] Listening on http://localhost:${port}`);
13
+ };
14
+ if (typeof optionsOrHandler === "function") {
15
+ return originalServe({ port, onListen }, optionsOrHandler);
16
+ }
17
+ if (maybeHandler) {
18
+ return originalServe({ ...optionsOrHandler, port, onListen }, maybeHandler);
19
+ }
20
+ const options = optionsOrHandler;
21
+ return originalServe({ ...options, port, onListen });
22
+ };
23
+ console.log(`[${functionName}] Starting function from ${functionPath}`);
24
+ try {
25
+ await import(functionPath);
26
+ } catch (error) {
27
+ console.error(`[${functionName}] Failed to load function:`, error);
28
+ Deno.exit(1);
29
+ }
30
+
31
+ //# debugId=4C4599C9DDF4C0E464756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../deno-runtime/main.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * Deno Function Wrapper\n *\n * This script is executed by Deno to run user functions.\n * It patches Deno.serve to inject a dynamic port before importing the user's function.\n *\n * Environment variables:\n * - FUNCTION_PATH: Absolute path to the user's function entry file\n * - FUNCTION_PORT: Port number for the function to listen on\n * - FUNCTION_NAME: Name of the function (for logging)\n */\n\n// Make this file a module for top-level await support\nexport {};\n\nconst functionPath = Deno.env.get(\"FUNCTION_PATH\");\nconst port = parseInt(Deno.env.get(\"FUNCTION_PORT\") || \"8000\", 10);\nconst functionName = Deno.env.get(\"FUNCTION_NAME\") || \"unknown\";\n\nif (!functionPath) {\n console.error(\"[wrapper] FUNCTION_PATH environment variable is required\");\n Deno.exit(1);\n}\n\n// Store the original Deno.serve\nconst originalServe = Deno.serve.bind(Deno);\n\n// Patch Deno.serve to inject our port and add onListen callback\n// @ts-expect-error - We're intentionally overriding Deno.serve\nDeno.serve = (\n optionsOrHandler:\n | Deno.ServeOptions\n | Deno.ServeHandler\n | (Deno.ServeOptions & { handler: Deno.ServeHandler }),\n maybeHandler?: Deno.ServeHandler,\n): Deno.HttpServer<Deno.NetAddr> => {\n const onListen = () => {\n // This message is used by FunctionManager to detect when the function is ready\n console.log(`[${functionName}] Listening on http://localhost:${port}`);\n };\n\n // Handle the different Deno.serve signatures:\n // 1. Deno.serve(handler)\n // 2. Deno.serve(options, handler)\n // 3. Deno.serve({ ...options, handler })\n if (typeof optionsOrHandler === \"function\") {\n // Signature: Deno.serve(handler)\n return originalServe({ port, onListen }, optionsOrHandler);\n }\n\n if (maybeHandler) {\n // Signature: Deno.serve(options, handler)\n return originalServe({ ...optionsOrHandler, port, onListen }, maybeHandler);\n }\n\n // Signature: Deno.serve({ ...options, handler })\n const options = optionsOrHandler as Deno.ServeOptions & {\n handler: Deno.ServeHandler;\n };\n return originalServe({ ...options, port, onListen });\n};\n\nconsole.log(`[${functionName}] Starting function from ${functionPath}`);\n\n// Dynamically import the user's function\n// The function will call Deno.serve which is now patched to use our port\ntry {\n await import(functionPath);\n} catch (error) {\n console.error(`[${functionName}] Failed to load function:`, error);\n Deno.exit(1);\n}\n"
6
+ ],
7
+ "mappings": ";AAeA,IAAM,eAAe,KAAK,IAAI,IAAI,eAAe;AACjD,IAAM,OAAO,SAAS,KAAK,IAAI,IAAI,eAAe,KAAK,QAAQ,EAAE;AACjE,IAAM,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK;AAEtD,IAAI,CAAC,cAAc;AAAA,EACjB,QAAQ,MAAM,0DAA0D;AAAA,EACxE,KAAK,KAAK,CAAC;AACb;AAGA,IAAM,gBAAgB,KAAK,MAAM,KAAK,IAAI;AAI1C,KAAK,QAAQ,CACX,kBAIA,iBACkC;AAAA,EAClC,MAAM,WAAW,MAAM;AAAA,IAErB,QAAQ,IAAI,IAAI,+CAA+C,MAAM;AAAA;AAAA,EAOvE,IAAI,OAAO,qBAAqB,YAAY;AAAA,IAE1C,OAAO,cAAc,EAAE,MAAM,SAAS,GAAG,gBAAgB;AAAA,EAC3D;AAAA,EAEA,IAAI,cAAc;AAAA,IAEhB,OAAO,cAAc,KAAK,kBAAkB,MAAM,SAAS,GAAG,YAAY;AAAA,EAC5E;AAAA,EAGA,MAAM,UAAU;AAAA,EAGhB,OAAO,cAAc,KAAK,SAAS,MAAM,SAAS,CAAC;AAAA;AAGrD,QAAQ,IAAI,IAAI,wCAAwC,cAAc;AAItE,IAAI;AAAA,EACF,MAAa;AAAA,EACb,OAAO,OAAO;AAAA,EACd,QAAQ,MAAM,IAAI,0CAA0C,KAAK;AAAA,EACjE,KAAK,KAAK,CAAC;AAAA;",
8
+ "debugId": "4C4599C9DDF4C0E464756E2164756E21",
9
+ "names": []
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/cli",
3
- "version": "0.0.32-pr.271.5d60e7b",
3
+ "version": "0.0.33-pr.259.052dce4",
4
4
  "description": "Base44 CLI - Unified interface for managing Base44 applications",
5
5
  "type": "module",
6
6
  "bin": {
@@ -41,6 +41,7 @@
41
41
  "@types/bun": "^1.2.15",
42
42
  "@types/common-tags": "^1.8.4",
43
43
  "@types/cors": "^2.8.19",
44
+ "@types/deno": "^2.5.0",
44
45
  "@types/ejs": "^3.1.5",
45
46
  "@types/express": "^5.0.6",
46
47
  "@types/json-schema": "^7.0.15",