@astrale-os/adapter-cloudflare 0.5.0-beta.43 → 0.5.0-beta.45
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 +8 -1
- package/dist/worker/entry.js +9 -4
- package/package.json +2 -2
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
|
}
|
package/dist/worker/entry.js
CHANGED
|
@@ -122,13 +122,18 @@ async function frontendAsset(frontend, environment, url, request) {
|
|
|
122
122
|
frontend.source.spa &&
|
|
123
123
|
(candidate.path === '/' || url.pathname.startsWith(`${candidate.path}/`))))
|
|
124
124
|
.sort((left, right) => right.path.length - left.path.length)[0];
|
|
125
|
-
if (route === undefined && !assetPath)
|
|
126
|
-
return undefined;
|
|
127
125
|
const assets = environment.ASSETS;
|
|
128
126
|
if (assets === undefined)
|
|
129
127
|
return undefined;
|
|
130
|
-
if (route === undefined)
|
|
131
|
-
|
|
128
|
+
if (route === undefined) {
|
|
129
|
+
const response = await assets.fetch(request);
|
|
130
|
+
return assetPath || response.status !== 404 ? response : undefined;
|
|
131
|
+
}
|
|
132
|
+
if (route.path !== url.pathname) {
|
|
133
|
+
const response = await assets.fetch(request);
|
|
134
|
+
if (response.status !== 404)
|
|
135
|
+
return response;
|
|
136
|
+
}
|
|
132
137
|
return assets.fetch(new Request(new URL(`/${route.document}${url.search}`, url.origin), request));
|
|
133
138
|
}
|
|
134
139
|
function reserved(path) {
|
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.45",
|
|
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.42"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@astrale-os/ox": ">=0.1.0 <1.0.0",
|