sproutboat 0.11.11 → 0.11.13
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/CHANGELOG.md +35 -2
- package/SURFACE.md +2 -2
- package/THIRD_PARTY_NOTICES.md +3 -5
- package/package.json +9 -10
- package/scripts/build-cli.ts +2 -44
- package/src/bearssl.ts +2 -1
- package/src/build.ts +208 -118
- package/src/bundle.ts +31 -3
- package/src/compile-cache.ts +98 -0
- package/src/compile.ts +28 -37
- package/src/dev.ts +10 -0
- package/src/main.ts +1 -0
- package/src/node-shims.ts +378 -0
- package/src/standalone-build.ts +4 -14
- package/src/toolchain.ts +3 -8
package/src/standalone-build.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* embedded transport already produces exactly the binary we want, so this
|
|
8
8
|
* copies it out and enforces the one thing a standalone binary cannot do.
|
|
9
9
|
*/
|
|
10
|
-
import { chmod, cp, mkdir
|
|
10
|
+
import { chmod, cp, mkdir } from "node:fs/promises";
|
|
11
11
|
import { resolve } from "node:path";
|
|
12
12
|
import { buildArtifact, type BuildInput } from "./build";
|
|
13
13
|
import type { Bindings } from "./wrap";
|
|
@@ -29,7 +29,7 @@ export type StandaloneBuildResult = { outPath: string; bytes: number };
|
|
|
29
29
|
* Outbound `fetch` is absent from this list: http and https both work, with
|
|
30
30
|
* BearSSL and the Mozilla root set compiled in.
|
|
31
31
|
*/
|
|
32
|
-
export function unsupportedBindings(bindings: Partial<Bindings>): string[] {
|
|
32
|
+
export function unsupportedBindings(bindings: Pick<Partial<Bindings>, "services" | "outbound">): string[] {
|
|
33
33
|
const reasons: string[] = [];
|
|
34
34
|
if ((bindings.services ?? []).length > 0) {
|
|
35
35
|
reasons.push("service bindings call another deployment through an edge, which a standalone binary has none of");
|
|
@@ -38,21 +38,11 @@ export function unsupportedBindings(bindings: Partial<Bindings>): string[] {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export async function buildStandalone(input: StandaloneBuildInput): Promise<StandaloneBuildResult> {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
let bindings: Partial<Bindings> = {};
|
|
44
|
-
try {
|
|
45
|
-
// SAFETY: bindings.json is written by buildArtifact from the validated
|
|
46
|
-
// config in this same call — our own output, not user input.
|
|
47
|
-
bindings = JSON.parse(await readFile(resolve(artifact.artifactDir, "bindings.json"), "utf8")) as Partial<Bindings>;
|
|
48
|
-
} catch {
|
|
49
|
-
bindings = {}; // a project with no bindings at all
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const blocked = unsupportedBindings(bindings);
|
|
41
|
+
const blocked = unsupportedBindings(input.config);
|
|
53
42
|
if (blocked.length > 0) {
|
|
54
43
|
throw new Error(`cannot build a standalone binary for this project:\n - ${blocked.join("\n - ")}`);
|
|
55
44
|
}
|
|
45
|
+
const artifact = await buildArtifact({ ...input, transport: "embedded" });
|
|
56
46
|
|
|
57
47
|
// The sprout *is* the binary: assets and bindings are compiled into it, and
|
|
58
48
|
// everything else it needs (port, data dir, secrets) arrives at run time.
|
package/src/toolchain.ts
CHANGED
|
@@ -677,14 +677,9 @@ export function porfforVersion(): string {
|
|
|
677
677
|
}
|
|
678
678
|
|
|
679
679
|
export function esbuildVersion(): string {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
const parsed = JSON.parse(readFileSync(pkg, "utf8")) as { version?: string };
|
|
684
|
-
return parsed.version || "unknown";
|
|
685
|
-
} catch {
|
|
686
|
-
return "unknown";
|
|
687
|
-
}
|
|
680
|
+
// Legacy artifact field, retained so older control planes can read manifests.
|
|
681
|
+
// Handler bundling uses Bun.build and Porffor alpha 9 needs no esbuild binary.
|
|
682
|
+
return "unused";
|
|
688
683
|
}
|
|
689
684
|
|
|
690
685
|
function uwsCommit(): string {
|