@astrale-os/adapter-cloudflare 0.5.0-beta.42 → 0.5.0-beta.44
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/dist/build/direct.js
CHANGED
|
@@ -38,7 +38,7 @@ export function admitDirectPlacement(artifact, worker, parameters) {
|
|
|
38
38
|
selfBinding: false,
|
|
39
39
|
}));
|
|
40
40
|
equal(release.compatibility_date, worker.runtime.compatibilityDate);
|
|
41
|
-
|
|
41
|
+
equalStringCollection(release.compatibility_flags, worker.runtime.compatibilityFlags);
|
|
42
42
|
equal(release.services ?? [], worker.bindings.services.map(serviceBinding));
|
|
43
43
|
equal(record(release.assets).html_handling, worker.assets?.htmlHandling);
|
|
44
44
|
equal(gateway, generated({
|
|
@@ -86,6 +86,13 @@ function equal(actual, expected) {
|
|
|
86
86
|
if (!isDeepStrictEqual(actual, expected))
|
|
87
87
|
mismatch();
|
|
88
88
|
}
|
|
89
|
+
function equalStringCollection(actual, expected) {
|
|
90
|
+
if (!Array.isArray(actual) ||
|
|
91
|
+
actual.some((value) => typeof value !== 'string') ||
|
|
92
|
+
!isDeepStrictEqual([...actual].sort(), [...expected].sort())) {
|
|
93
|
+
mismatch();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
89
96
|
function mismatch() {
|
|
90
97
|
throw new TypeError('Direct Cloudflare placement differs from its admitted Worker artifact.');
|
|
91
98
|
}
|
|
@@ -17,6 +17,9 @@ function isInstanceHost(host: string): boolean {
|
|
|
17
17
|
if (env.${router.binding} && isInstanceHost(url.hostname)) return env.${router.binding}
|
|
18
18
|
return null
|
|
19
19
|
},`;
|
|
20
|
+
const frontend = options.material.frontend === undefined
|
|
21
|
+
? ''
|
|
22
|
+
: ` frontend: ${JSON.stringify(options.material.frontend)} as const satisfies NonNullable<BuildMaterial['frontend']>,\n`;
|
|
20
23
|
return `// AUTO-GENERATED by @astrale-os/adapter-cloudflare — do not edit.
|
|
21
24
|
// Domain origin: ${options.origin}
|
|
22
25
|
import type { BuildMaterial } from '@astrale-os/sdk/deployment/build'
|
|
@@ -31,7 +34,7 @@ type WorkerEnv = CloudflareEnv & CloudflareAdapterBindings & {
|
|
|
31
34
|
type RuntimeEnv = Omit<WorkerEnv, 'ASTRALE_SIGNING_IDENTITY'>
|
|
32
35
|
${routerPredicate}
|
|
33
36
|
export default cloudflareWorkerEntry<WorkerEnv, RuntimeEnv>()({
|
|
34
|
-
load: async () => ({
|
|
37
|
+
${frontend} load: async () => ({
|
|
35
38
|
runtime: (await import(${JSON.stringify(options.runtimeSpecifier)})).default,
|
|
36
39
|
material: ${JSON.stringify(options.material)} as const satisfies BuildMaterial,
|
|
37
40
|
}),
|
package/dist/worker/entry.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface CloudflareAdapterBindings {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
export interface CloudflareWorkerConfig<RuntimeValue extends Runtime, Bindings extends CloudflareAdapterBindings, Environment> {
|
|
20
|
+
/** Generated frontend evidence available without restoring the execution Build. */
|
|
21
|
+
readonly frontend?: BuildMaterial['frontend'];
|
|
20
22
|
/** Load the exact Runtime and Build once, after the isolate has accepted a request. */
|
|
21
23
|
readonly load: () => CloudflareWorkerSource<RuntimeValue> | Promise<CloudflareWorkerSource<RuntimeValue>>;
|
|
22
24
|
readonly privateKey: JsonWebKey | ((bindings: Bindings) => JsonWebKey);
|
package/dist/worker/entry.js
CHANGED
|
@@ -73,10 +73,17 @@ export function cloudflareWorkerEntry() {
|
|
|
73
73
|
return new Response('Request origin differs from the current Release.', { status: 421 });
|
|
74
74
|
}
|
|
75
75
|
currentIssuer = issuer;
|
|
76
|
+
if (config.frontend !== undefined) {
|
|
77
|
+
const frontend = await frontendAsset(config.frontend, bindings, url, request);
|
|
78
|
+
if (frontend !== undefined)
|
|
79
|
+
return frontend;
|
|
80
|
+
}
|
|
76
81
|
const { application, build } = await realize();
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
if (config.frontend === undefined) {
|
|
83
|
+
const frontend = await frontendAsset(build.frontend, bindings, url, request);
|
|
84
|
+
if (frontend !== undefined)
|
|
85
|
+
return frontend;
|
|
86
|
+
}
|
|
80
87
|
return application.fetch(request, Object.freeze({ bindings, issuer }), context);
|
|
81
88
|
},
|
|
82
89
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/adapter-cloudflare",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.44",
|
|
4
4
|
"description": "Deploy an Astrale application through Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adapter",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"hono": "^4.6.20",
|
|
46
46
|
"jose": "^6.1.3",
|
|
47
47
|
"wrangler": "4.123.0",
|
|
48
|
-
"@astrale-os/sdk": "^0.5.0-beta.
|
|
48
|
+
"@astrale-os/sdk": "^0.5.0-beta.41"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@astrale-os/ox": ">=0.1.0 <1.0.0",
|