@base44-preview/cli 0.1.5-pr.576.7190826 → 0.1.5-pr.577.1701370
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/bin/binary-entry.ts +2 -6
- package/dist/assets/{backend-runtime → deno-runtime}/main.ts +3 -59
- package/dist/cli/index.js +31 -108
- package/dist/cli/index.js.map +6 -7
- package/package.json +1 -1
- package/dist/assets/backend-runtime/base44-runtime.ts +0 -62
- package/dist/assets/backend-runtime/import-map.json +0 -5
- /package/dist/assets/{backend-runtime → deno-runtime}/exec.ts +0 -0
package/package.json
CHANGED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Local implementation of the `base44:runtime` module.
|
|
3
|
-
*
|
|
4
|
-
* Deployed backend functions import this module by its bare specifier
|
|
5
|
-
* (`import { secrets } from "base44:runtime"`). No such module exists on a
|
|
6
|
-
* developer machine, so `deno.json` maps the specifier onto this file and
|
|
7
|
-
* `base44 dev` hands that import map to the Deno subprocess.
|
|
8
|
-
*
|
|
9
|
-
* The surface mirrors production; the deliberate differences are called out on
|
|
10
|
-
* each export below.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
interface Secrets {
|
|
14
|
-
get(name: string): string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Secrets configured for the app.
|
|
19
|
-
*
|
|
20
|
-
* In production these come from the app's environment variables. Locally they
|
|
21
|
-
* come from the environment `base44 dev` was started with — values stored with
|
|
22
|
-
* `base44 secrets set` are deliberately not fetched, so a production secret is
|
|
23
|
-
* never copied onto a developer machine. Export the variable in your shell to
|
|
24
|
-
* exercise a function that reads it.
|
|
25
|
-
*
|
|
26
|
-
* Reading an unset secret throws, matching production, where a missing secret
|
|
27
|
-
* read at module scope crashes boot rather than surfacing as a 500.
|
|
28
|
-
*/
|
|
29
|
-
export const secrets: Secrets = {
|
|
30
|
-
get(name: string): string {
|
|
31
|
-
const value = Deno.env.get(name);
|
|
32
|
-
if (value === undefined) {
|
|
33
|
-
throw new Error(
|
|
34
|
-
`Secret "${name}" is not set. Locally, secrets are read from the environment that \`base44 dev\` was started with, not from \`base44 secrets set\` — export ${name} and restart the dev server.`,
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
return value;
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// Holds a strong reference to in-flight work so a floating promise cannot be
|
|
42
|
-
// collected before it settles.
|
|
43
|
-
const pending = new Set<Promise<unknown>>();
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Continue work after the response has been sent.
|
|
47
|
-
*
|
|
48
|
-
* In production this keeps the Worker alive until the promise settles. Locally
|
|
49
|
-
* the function is a long-lived server process, so there is nothing to hold
|
|
50
|
-
* open; the promise is tracked only so a rejection is reported against the
|
|
51
|
-
* function instead of surfacing as an unhandled rejection.
|
|
52
|
-
*/
|
|
53
|
-
export function waitUntil(promise: Promise<unknown>): void {
|
|
54
|
-
const tracked = Promise.resolve(promise)
|
|
55
|
-
.catch((error: unknown) => {
|
|
56
|
-
console.error("[base44:runtime] waitUntil task failed:", error);
|
|
57
|
-
})
|
|
58
|
-
.finally(() => {
|
|
59
|
-
pending.delete(tracked);
|
|
60
|
-
});
|
|
61
|
-
pending.add(tracked);
|
|
62
|
-
}
|
|
File without changes
|