@astrojs/cloudflare 13.0.0-beta.3 → 13.0.0-beta.5
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/entrypoints/preview.js +1 -1
- package/dist/index.d.ts +0 -20
- package/dist/index.js +0 -13
- package/dist/info.d.ts +5 -0
- package/dist/info.js +4 -0
- package/dist/utils/handler.d.ts +1 -1
- package/dist/utils/handler.js +10 -15
- package/package.json +9 -8
- package/types.d.ts +0 -19
|
@@ -83,7 +83,7 @@ function serverStart({
|
|
|
83
83
|
host,
|
|
84
84
|
base
|
|
85
85
|
}) {
|
|
86
|
-
const version = "13.0.0-beta.
|
|
86
|
+
const version = "13.0.0-beta.5";
|
|
87
87
|
const localPrefix = `${colors.dim("\u2503")} Local `;
|
|
88
88
|
const networkPrefix = `${colors.dim("\u2503")} Network `;
|
|
89
89
|
const emptyPrefix = " ".repeat(11);
|
package/dist/index.d.ts
CHANGED
|
@@ -56,25 +56,5 @@ export type Options = {
|
|
|
56
56
|
* See https://developers.cloudflare.com/images/transform-images/bindings/ for more details.
|
|
57
57
|
*/
|
|
58
58
|
imagesBindingName?: string;
|
|
59
|
-
/**
|
|
60
|
-
* This configuration option allows you to specify a custom entryPoint for your Cloudflare Worker.
|
|
61
|
-
* The entry point is the file that will be executed when your Worker is invoked.
|
|
62
|
-
* By default, this is set to `@astrojs/cloudflare/entrypoints/server.js` and `['default']`.
|
|
63
|
-
* @docs https://docs.astro.build/en/guides/integrations-guide/cloudflare/#workerEntryPoint
|
|
64
|
-
*/
|
|
65
|
-
workerEntryPoint?: {
|
|
66
|
-
/**
|
|
67
|
-
* The path to the entry file. This should be a relative path from the root of your Astro project.
|
|
68
|
-
* @example`'src/worker.ts'`
|
|
69
|
-
* @docs https://docs.astro.build/en/guides/integrations-guide/cloudflare/#workerentrypointpath
|
|
70
|
-
*/
|
|
71
|
-
path: string | URL;
|
|
72
|
-
/**
|
|
73
|
-
* Additional named exports to use for the entry file. Astro always includes the default export (`['default']`). If you need to have other top level named exports use this option.
|
|
74
|
-
* @example ['MyDurableObject', 'namedExport']
|
|
75
|
-
* @docs https://docs.astro.build/en/guides/integrations-guide/cloudflare/#workerentrypointnamedexports
|
|
76
|
-
*/
|
|
77
|
-
namedExports?: string[];
|
|
78
|
-
};
|
|
79
59
|
};
|
|
80
60
|
export default function createIntegration(args?: Options): AstroIntegration;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { createReadStream, existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { appendFile, stat } from "node:fs/promises";
|
|
3
|
-
import { createRequire } from "node:module";
|
|
4
3
|
import { createInterface } from "node:readline/promises";
|
|
5
|
-
import { pathToFileURL } from "node:url";
|
|
6
4
|
import { removeLeadingForwardSlash } from "@astrojs/internal-helpers/path";
|
|
7
5
|
import { createRedirectsFromAstroRoutes, printAsRedirects } from "@astrojs/underscore-redirects";
|
|
8
6
|
import { cloudflare as cfVitePlugin } from "@cloudflare/vite-plugin";
|
|
@@ -162,19 +160,8 @@ function createIntegration(args) {
|
|
|
162
160
|
filename: "cloudflare.d.ts",
|
|
163
161
|
content: '/// <reference types="@astrojs/cloudflare/types.d.ts" />'
|
|
164
162
|
});
|
|
165
|
-
let customWorkerEntryPoint;
|
|
166
|
-
if (args?.workerEntryPoint && typeof args.workerEntryPoint.path === "string") {
|
|
167
|
-
const require2 = createRequire(config.root);
|
|
168
|
-
try {
|
|
169
|
-
customWorkerEntryPoint = pathToFileURL(require2.resolve(args.workerEntryPoint.path));
|
|
170
|
-
} catch {
|
|
171
|
-
customWorkerEntryPoint = new URL(args.workerEntryPoint.path, config.root);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
163
|
setAdapter({
|
|
175
164
|
name: "@astrojs/cloudflare",
|
|
176
|
-
serverEntrypoint: customWorkerEntryPoint ?? "@astrojs/cloudflare/entrypoints/server.js",
|
|
177
|
-
exports: [.../* @__PURE__ */ new Set(["default", ...args?.workerEntryPoint?.namedExports ?? []])],
|
|
178
165
|
adapterFeatures: {
|
|
179
166
|
edgeMiddleware: false,
|
|
180
167
|
buildOutput: "server"
|
package/dist/info.d.ts
ADDED
package/dist/info.js
ADDED
package/dist/utils/handler.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ declare global {
|
|
|
5
5
|
var __ASTRO_IMAGES_BINDING_NAME: string;
|
|
6
6
|
}
|
|
7
7
|
type CfResponse = Awaited<ReturnType<Required<ExportedHandler<Env>>['fetch']>>;
|
|
8
|
-
export declare function handle(
|
|
8
|
+
export declare function handle(request: Request, env: Env, context: ExecutionContext): Promise<CfResponse>;
|
|
9
9
|
export {};
|
package/dist/utils/handler.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createApp } from "astro/app/entrypoint";
|
|
|
4
4
|
import { setGetEnv } from "astro/env/setup";
|
|
5
5
|
import { createGetEnv } from "../utils/env.js";
|
|
6
6
|
setGetEnv(createGetEnv(globalEnv));
|
|
7
|
-
async function handle(
|
|
7
|
+
async function handle(request, env, context) {
|
|
8
8
|
const app = createApp(import.meta.env.DEV);
|
|
9
9
|
const { pathname } = new URL(request.url);
|
|
10
10
|
if (env[sessionKVBindingName]) {
|
|
@@ -18,9 +18,7 @@ async function handle(...[request, env, context]) {
|
|
|
18
18
|
}
|
|
19
19
|
let routeData = void 0;
|
|
20
20
|
if (app.isDev()) {
|
|
21
|
-
const result = await app.devMatch(
|
|
22
|
-
app.getPathnameFromRequest(request)
|
|
23
|
-
);
|
|
21
|
+
const result = await app.devMatch(app.getPathnameFromRequest(request));
|
|
24
22
|
if (result) {
|
|
25
23
|
routeData = result.routeData;
|
|
26
24
|
}
|
|
@@ -63,17 +61,14 @@ async function handle(...[request, env, context]) {
|
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
63
|
});
|
|
66
|
-
const response = await app.render(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
clientAddress: request.headers.get("cf-connecting-ip") ?? void 0
|
|
75
|
-
}
|
|
76
|
-
);
|
|
64
|
+
const response = await app.render(request, {
|
|
65
|
+
routeData,
|
|
66
|
+
locals,
|
|
67
|
+
prerenderedErrorPageFetch: async (url) => {
|
|
68
|
+
return env.ASSETS.fetch(url.replace(/\.html$/, ""));
|
|
69
|
+
},
|
|
70
|
+
clientAddress: request.headers.get("cf-connecting-ip") ?? void 0
|
|
71
|
+
});
|
|
77
72
|
if (app.setCookieHeaders) {
|
|
78
73
|
for (const setCookieHeader of app.setCookieHeaders(response)) {
|
|
79
74
|
response.headers.append("Set-Cookie", setCookieHeader);
|
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": "13.0.0-beta.
|
|
4
|
+
"version": "13.0.0-beta.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"homepage": "https://docs.astro.build/en/guides/integrations-guide/cloudflare/",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": "./dist/index.js",
|
|
22
|
+
"./info": "./dist/info.js",
|
|
22
23
|
"./entrypoints/server": "./dist/entrypoints/server.js",
|
|
23
24
|
"./entrypoints/preview": "./dist/entrypoints/preview.js",
|
|
24
25
|
"./entrypoints/server.js": "./dist/entrypoints/server.js",
|
|
@@ -34,24 +35,24 @@
|
|
|
34
35
|
"types.d.ts"
|
|
35
36
|
],
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@cloudflare/vite-plugin": "^1.
|
|
38
|
+
"@cloudflare/vite-plugin": "^1.22.1",
|
|
38
39
|
"dotenv": "^17.2.3",
|
|
39
40
|
"piccolore": "^0.1.3",
|
|
40
41
|
"tinyglobby": "^0.2.15",
|
|
41
42
|
"vite": "^7.3.1",
|
|
42
|
-
"@astrojs/internal-helpers": "0.
|
|
43
|
+
"@astrojs/internal-helpers": "0.8.0-beta.0",
|
|
43
44
|
"@astrojs/underscore-redirects": "1.0.0"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"astro": "^6.0.0-alpha.0",
|
|
47
|
-
"wrangler": "^4.
|
|
48
|
+
"wrangler": "^4.61.1"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
|
-
"@cloudflare/workers-types": "^4.
|
|
51
|
-
"cheerio": "1.
|
|
51
|
+
"@cloudflare/workers-types": "^4.20260131.0",
|
|
52
|
+
"cheerio": "1.2.0",
|
|
52
53
|
"devalue": "^5.6.2",
|
|
53
|
-
"rollup": "^4.
|
|
54
|
-
"astro": "6.0.0-beta.
|
|
54
|
+
"rollup": "^4.57.1",
|
|
55
|
+
"astro": "6.0.0-beta.9",
|
|
55
56
|
"astro-scripts": "0.0.14"
|
|
56
57
|
},
|
|
57
58
|
"publishConfig": {
|
package/types.d.ts
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cloudflare Worker Request types
|
|
3
|
-
* Extends the global Request object with Cloudflare-specific properties
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
declare global {
|
|
7
|
-
interface Request {
|
|
8
|
-
/**
|
|
9
|
-
* Cloudflare-specific properties available on incoming requests
|
|
10
|
-
* Contains metadata about the request such as:
|
|
11
|
-
* - Geographic information (country, colo, timezone)
|
|
12
|
-
* - TLS/Security details (cipher, protocol version)
|
|
13
|
-
* - Bot Management scores
|
|
14
|
-
* - Client information (ASN, TCP metrics)
|
|
15
|
-
*/
|
|
16
|
-
readonly cf?: IncomingRequestCfProperties;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
1
|
type Runtime = import('./dist/index.d.ts').Runtime;
|
|
21
2
|
|
|
22
3
|
declare namespace App {
|