@astrojs/cloudflare 6.4.0 → 6.5.1
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/runtime.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import type { Cache, CacheStorage, IncomingRequestCfProperties } from '@cloudflare/workers-types';
|
|
1
2
|
export type WorkerRuntime<T = unknown> = {
|
|
2
3
|
name: 'cloudflare';
|
|
3
4
|
env: T;
|
|
4
5
|
waitUntil(promise: Promise<any>): void;
|
|
5
6
|
passThroughOnException(): void;
|
|
7
|
+
caches?: CacheStorage & {
|
|
8
|
+
default: Cache;
|
|
9
|
+
};
|
|
10
|
+
cf?: IncomingRequestCfProperties;
|
|
6
11
|
};
|
|
7
12
|
export type PagesRuntime<T = unknown, U = unknown> = {
|
|
8
13
|
name: 'cloudflare';
|
|
@@ -12,5 +17,9 @@ export type PagesRuntime<T = unknown, U = unknown> = {
|
|
|
12
17
|
data: U;
|
|
13
18
|
waitUntil(promise: Promise<any>): void;
|
|
14
19
|
next(request: Request): void;
|
|
20
|
+
caches?: CacheStorage & {
|
|
21
|
+
default: Cache;
|
|
22
|
+
};
|
|
23
|
+
cf?: IncomingRequestCfProperties;
|
|
15
24
|
};
|
|
16
25
|
export declare function getRuntime<T = unknown, U = unknown>(request: Request): WorkerRuntime<T> | PagesRuntime<T, U>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ExecutionContext, Request as CFRequest } from '@cloudflare/workers-types';
|
|
1
2
|
import type { SSRManifest } from 'astro';
|
|
2
3
|
type Env = {
|
|
3
4
|
ASSETS: {
|
|
@@ -7,7 +8,7 @@ type Env = {
|
|
|
7
8
|
};
|
|
8
9
|
export declare function createExports(manifest: SSRManifest): {
|
|
9
10
|
default: {
|
|
10
|
-
fetch: (request: Request, env: Env, context:
|
|
11
|
+
fetch: (request: Request & CFRequest, env: Env, context: ExecutionContext) => Promise<Response>;
|
|
11
12
|
};
|
|
12
13
|
};
|
|
13
14
|
export {};
|
package/dist/server.advanced.js
CHANGED
|
@@ -18,7 +18,16 @@ function createExports(manifest) {
|
|
|
18
18
|
Symbol.for("astro.clientAddress"),
|
|
19
19
|
request.headers.get("cf-connecting-ip")
|
|
20
20
|
);
|
|
21
|
-
Reflect.set(request, Symbol.for("runtime"), {
|
|
21
|
+
Reflect.set(request, Symbol.for("runtime"), {
|
|
22
|
+
env,
|
|
23
|
+
name: "cloudflare",
|
|
24
|
+
caches,
|
|
25
|
+
cf: request.cf,
|
|
26
|
+
...context,
|
|
27
|
+
waitUntil: (promise) => {
|
|
28
|
+
context.waitUntil(promise);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
22
31
|
let response = await app.render(request, routeData);
|
|
23
32
|
if (app.setCookieHeaders) {
|
|
24
33
|
for (const setCookieHeader of app.setCookieHeaders(response)) {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { EventContext, Request as CFRequest } from '@cloudflare/workers-types';
|
|
1
2
|
import type { SSRManifest } from 'astro';
|
|
2
3
|
export declare function createExports(manifest: SSRManifest): {
|
|
3
4
|
onRequest: ({ request, next, ...runtimeEnv }: {
|
|
4
|
-
request: Request;
|
|
5
|
+
request: Request & CFRequest;
|
|
5
6
|
next: (request: Request) => void;
|
|
7
|
+
waitUntil: EventContext<unknown, any, unknown>['waitUntil'];
|
|
6
8
|
} & Record<string, unknown>) => Promise<void | Response>;
|
|
7
9
|
};
|
package/dist/server.directory.js
CHANGED
|
@@ -24,8 +24,13 @@ function createExports(manifest) {
|
|
|
24
24
|
);
|
|
25
25
|
Reflect.set(request, Symbol.for("runtime"), {
|
|
26
26
|
...runtimeEnv,
|
|
27
|
+
waitUntil: (promise) => {
|
|
28
|
+
runtimeEnv.waitUntil(promise);
|
|
29
|
+
},
|
|
27
30
|
name: "cloudflare",
|
|
28
|
-
next
|
|
31
|
+
next,
|
|
32
|
+
caches,
|
|
33
|
+
cf: request.cf
|
|
29
34
|
});
|
|
30
35
|
let response = await app.render(request, routeData);
|
|
31
36
|
if (app.setCookieHeaders) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/cloudflare",
|
|
3
3
|
"description": "Deploy your site to Cloudflare Workers/Pages",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.5.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -33,11 +33,12 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@astrojs/underscore-redirects": "^0.1.0",
|
|
36
|
+
"@cloudflare/workers-types": "^4.20230518.0",
|
|
36
37
|
"esbuild": "^0.17.12",
|
|
37
38
|
"tiny-glob": "^0.2.9"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
|
-
"astro": "^2.6.
|
|
41
|
+
"astro": "^2.6.6"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"chai": "^4.3.6",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"mocha": "^9.2.2",
|
|
46
47
|
"slash": "^4.0.0",
|
|
47
48
|
"wrangler": "^2.0.23",
|
|
48
|
-
"astro": "2.6.
|
|
49
|
+
"astro": "2.6.6",
|
|
49
50
|
"astro-scripts": "0.0.14"
|
|
50
51
|
},
|
|
51
52
|
"scripts": {
|