@base44-preview/cli 0.0.45-pr.420.9de65ab → 0.0.45-pr.420.b567bca
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,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deno Function Wrapper
|
|
3
|
+
*
|
|
4
|
+
* This script is executed by Deno to run user functions.
|
|
5
|
+
* It patches Deno.serve to inject a dynamic port before importing the user's function.
|
|
6
|
+
*
|
|
7
|
+
* Environment variables:
|
|
8
|
+
* - FUNCTION_PATH: Absolute path to the user's function entry file
|
|
9
|
+
* - FUNCTION_PORT: Port number for the function to listen on
|
|
10
|
+
* - FUNCTION_NAME: Name of the function (for logging)
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// Make this file a module for top-level await support
|
|
14
|
+
export {};
|
|
15
|
+
|
|
16
|
+
const functionPath = Deno.env.get("FUNCTION_PATH");
|
|
17
|
+
const port = parseInt(Deno.env.get("FUNCTION_PORT") || "8000", 10);
|
|
18
|
+
const functionName = Deno.env.get("FUNCTION_NAME") || "unknown";
|
|
19
|
+
|
|
20
|
+
if (!functionPath) {
|
|
21
|
+
console.error("[wrapper] FUNCTION_PATH environment variable is required");
|
|
22
|
+
Deno.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Store the original Deno.serve
|
|
26
|
+
const originalServe = Deno.serve.bind(Deno);
|
|
27
|
+
|
|
28
|
+
// Patch Deno.serve to inject our port and add onListen callback
|
|
29
|
+
// @ts-expect-error - We're intentionally overriding Deno.serve
|
|
30
|
+
Deno.serve = (
|
|
31
|
+
optionsOrHandler:
|
|
32
|
+
| Deno.ServeOptions
|
|
33
|
+
| Deno.ServeHandler
|
|
34
|
+
| (Deno.ServeOptions & { handler: Deno.ServeHandler }),
|
|
35
|
+
maybeHandler?: Deno.ServeHandler,
|
|
36
|
+
): Deno.HttpServer<Deno.NetAddr> => {
|
|
37
|
+
const onListen = () => {
|
|
38
|
+
// This message is used by FunctionManager to detect when the function is ready
|
|
39
|
+
console.log(`[${functionName}] Listening on http://localhost:${port}`);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Handle the different Deno.serve signatures:
|
|
43
|
+
// 1. Deno.serve(handler)
|
|
44
|
+
// 2. Deno.serve(options, handler)
|
|
45
|
+
// 3. Deno.serve({ ...options, handler })
|
|
46
|
+
if (typeof optionsOrHandler === "function") {
|
|
47
|
+
// Signature: Deno.serve(handler)
|
|
48
|
+
return originalServe({ port, onListen }, optionsOrHandler);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (maybeHandler) {
|
|
52
|
+
// Signature: Deno.serve(options, handler)
|
|
53
|
+
return originalServe({ ...optionsOrHandler, port, onListen }, maybeHandler);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Signature: Deno.serve({ ...options, handler })
|
|
57
|
+
const options = optionsOrHandler as Deno.ServeOptions & {
|
|
58
|
+
handler: Deno.ServeHandler;
|
|
59
|
+
};
|
|
60
|
+
return originalServe({ ...options, port, onListen });
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
console.log(`[${functionName}] Starting function from ${functionPath}`);
|
|
64
|
+
|
|
65
|
+
// Dynamically import the user's function
|
|
66
|
+
// The function will call Deno.serve which is now patched to use our port
|
|
67
|
+
try {
|
|
68
|
+
await import(functionPath);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error(`[${functionName}] Failed to load function:`, error);
|
|
71
|
+
Deno.exit(1);
|
|
72
|
+
}
|
package/dist/cli/index.js
CHANGED
|
@@ -167116,8 +167116,8 @@ var require_factory = __commonJS((exports) => {
|
|
|
167116
167116
|
exports.createProxyMiddleware = createProxyMiddleware;
|
|
167117
167117
|
var http_proxy_middleware_1 = require_http_proxy_middleware();
|
|
167118
167118
|
function createProxyMiddleware(options8) {
|
|
167119
|
-
const { middleware
|
|
167120
|
-
return
|
|
167119
|
+
const { middleware } = new http_proxy_middleware_1.HttpProxyMiddleware(options8);
|
|
167120
|
+
return middleware;
|
|
167121
167121
|
}
|
|
167122
167122
|
});
|
|
167123
167123
|
|
|
@@ -246140,7 +246140,7 @@ function getTemplatesIndexPath() {
|
|
|
246140
246140
|
return join8(ASSETS_DIR, "templates", "templates.json");
|
|
246141
246141
|
}
|
|
246142
246142
|
function getDenoWrapperPath() {
|
|
246143
|
-
return join8(ASSETS_DIR, "deno-runtime", "main.
|
|
246143
|
+
return join8(ASSETS_DIR, "deno-runtime", "main.ts");
|
|
246144
246144
|
}
|
|
246145
246145
|
function ensureNpmAssets(sourceDir) {
|
|
246146
246146
|
if (existsSync(ASSETS_DIR))
|
|
@@ -246901,7 +246901,10 @@ async function logout() {
|
|
|
246901
246901
|
return { outroMessage: "Logged out successfully" };
|
|
246902
246902
|
}
|
|
246903
246903
|
function getLogoutCommand() {
|
|
246904
|
-
return new Base44Command("logout", {
|
|
246904
|
+
return new Base44Command("logout", {
|
|
246905
|
+
requireAuth: false,
|
|
246906
|
+
requireAppConfig: false
|
|
246907
|
+
}).description("Logout from current device").action(logout);
|
|
246905
246908
|
}
|
|
246906
246909
|
|
|
246907
246910
|
// src/cli/commands/auth/whoami.ts
|
|
@@ -248304,6 +248307,9 @@ ${summaryLines.join(`
|
|
|
248304
248307
|
}
|
|
248305
248308
|
function getDeployCommand2() {
|
|
248306
248309
|
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options, command2) => {
|
|
248310
|
+
if (command2.isNonInteractive && !options.yes) {
|
|
248311
|
+
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
248312
|
+
}
|
|
248307
248313
|
return await deployAction({
|
|
248308
248314
|
...options,
|
|
248309
248315
|
isNonInteractive: command2.isNonInteractive
|
|
@@ -248737,6 +248743,9 @@ async function deployAction2(options) {
|
|
|
248737
248743
|
}
|
|
248738
248744
|
function getSiteDeployCommand() {
|
|
248739
248745
|
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(async (options, command2) => {
|
|
248746
|
+
if (command2.isNonInteractive && !options.yes) {
|
|
248747
|
+
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
248748
|
+
}
|
|
248740
248749
|
return await deployAction2({
|
|
248741
248750
|
...options,
|
|
248742
248751
|
isNonInteractive: command2.isNonInteractive
|
|
@@ -256050,4 +256059,4 @@ export {
|
|
|
256050
256059
|
CLIExitError
|
|
256051
256060
|
};
|
|
256052
256061
|
|
|
256053
|
-
//# debugId=
|
|
256062
|
+
//# debugId=C720DFBF6A5E10BF64756E2164756E21
|