@astrojs/cloudflare 13.1.0 → 13.1.2
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.js +28 -2
- package/dist/prerenderer.js +8 -2
- package/dist/utils/image-config.js +7 -0
- package/package.json +4 -4
|
@@ -87,7 +87,7 @@ function serverStart({
|
|
|
87
87
|
host,
|
|
88
88
|
base
|
|
89
89
|
}) {
|
|
90
|
-
const version = "13.1.
|
|
90
|
+
const version = "13.1.2";
|
|
91
91
|
const localPrefix = `${colors.dim("\u2503")} Local `;
|
|
92
92
|
const networkPrefix = `${colors.dim("\u2503")} Network `;
|
|
93
93
|
const emptyPrefix = " ".repeat(11);
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,23 @@ function usesCloudflareKVSessionDriver(session) {
|
|
|
32
32
|
const entrypoint = typeof driver.entrypoint === "string" ? driver.entrypoint : driver.entrypoint.toString();
|
|
33
33
|
return entrypoint === CLOUDFLARE_KV_SESSION_DRIVER_ENTRYPOINT || entrypoint.endsWith("cloudflare-kv-binding");
|
|
34
34
|
}
|
|
35
|
+
function hasContentCollectionsConfig(srcDir) {
|
|
36
|
+
const contentConfigPaths = [
|
|
37
|
+
"content.config.mjs",
|
|
38
|
+
"content.config.js",
|
|
39
|
+
"content.config.mts",
|
|
40
|
+
"content.config.ts",
|
|
41
|
+
"content/config.mjs",
|
|
42
|
+
"content/config.js",
|
|
43
|
+
"content/config.mts",
|
|
44
|
+
"content/config.ts",
|
|
45
|
+
"live.config.mjs",
|
|
46
|
+
"live.config.js",
|
|
47
|
+
"live.config.mts",
|
|
48
|
+
"live.config.ts"
|
|
49
|
+
];
|
|
50
|
+
return contentConfigPaths.some((configPath) => existsSync(new URL(`./${configPath}`, srcDir)));
|
|
51
|
+
}
|
|
35
52
|
function createIntegration({
|
|
36
53
|
imageService,
|
|
37
54
|
sessionKVBindingName = DEFAULT_SESSION_KV_BINDING_NAME,
|
|
@@ -77,6 +94,8 @@ function createIntegration({
|
|
|
77
94
|
}
|
|
78
95
|
const needsSessionKVBinding = usesCloudflareKVSessionDriver(session);
|
|
79
96
|
const needsImagesBindingForDev = isCompile && command === "dev";
|
|
97
|
+
const usesContentCollections = hasContentCollectionsConfig(config.srcDir);
|
|
98
|
+
const prebundleContentRuntime = command === "dev" && usesContentCollections;
|
|
80
99
|
cfPluginConfig = {
|
|
81
100
|
config: cloudflareConfigCustomizer({
|
|
82
101
|
needsSessionKVBinding,
|
|
@@ -137,6 +156,7 @@ function createIntegration({
|
|
|
137
156
|
return {
|
|
138
157
|
optimizeDeps: {
|
|
139
158
|
include: [
|
|
159
|
+
"@astrojs/cloudflare/image-service-workerd",
|
|
140
160
|
"astro",
|
|
141
161
|
"astro/runtime/**",
|
|
142
162
|
"astro > html-escaper",
|
|
@@ -154,8 +174,14 @@ function createIntegration({
|
|
|
154
174
|
"astro > picomatch",
|
|
155
175
|
"astro/app",
|
|
156
176
|
"astro/assets",
|
|
177
|
+
"astro/assets/runtime",
|
|
178
|
+
"astro/assets/utils/inferRemoteSize.js",
|
|
179
|
+
"astro/assets/fonts/runtime.js",
|
|
180
|
+
...prebundleContentRuntime ? ["astro/content/runtime"] : [],
|
|
157
181
|
"astro/compiler-runtime",
|
|
158
|
-
"astro/
|
|
182
|
+
"astro/jsx-runtime",
|
|
183
|
+
"astro/app/entrypoint/dev",
|
|
184
|
+
"astro/virtual-modules/middleware.js"
|
|
159
185
|
],
|
|
160
186
|
exclude: [
|
|
161
187
|
"unstorage/drivers/cloudflare-kv-binding",
|
|
@@ -186,7 +212,7 @@ function createIntegration({
|
|
|
186
212
|
{
|
|
187
213
|
enforce: "post",
|
|
188
214
|
name: "@astrojs/cloudflare:cf-externals",
|
|
189
|
-
applyToEnvironment: (environment) => environment.name === "ssr",
|
|
215
|
+
applyToEnvironment: (environment) => environment.name === "ssr" || environment.name === "prerender",
|
|
190
216
|
config(conf) {
|
|
191
217
|
if (conf.ssr) {
|
|
192
218
|
conf.ssr.external = void 0;
|
package/dist/prerenderer.js
CHANGED
|
@@ -55,8 +55,11 @@ function createCloudflarePrerenderer({
|
|
|
55
55
|
headers: { "Content-Type": "application/json" }
|
|
56
56
|
});
|
|
57
57
|
if (!response.ok) {
|
|
58
|
+
const body = await response.text();
|
|
59
|
+
const details = body ? `
|
|
60
|
+
${body}` : "";
|
|
58
61
|
throw new Error(
|
|
59
|
-
`Failed to get static paths from the Cloudflare prerender server (${response.status}: ${response.statusText})
|
|
62
|
+
`Failed to get static paths from the Cloudflare prerender server (${response.status}: ${response.statusText}).${details}`
|
|
60
63
|
);
|
|
61
64
|
}
|
|
62
65
|
const data = await response.json();
|
|
@@ -83,8 +86,11 @@ function createCloudflarePrerenderer({
|
|
|
83
86
|
headers: { "Content-Type": "application/json" }
|
|
84
87
|
});
|
|
85
88
|
if (!response.ok) {
|
|
89
|
+
const body = await response.text();
|
|
90
|
+
const details = body ? `
|
|
91
|
+
${body}` : "";
|
|
86
92
|
throw new Error(
|
|
87
|
-
`Failed to get static images from the Cloudflare prerender server (${response.status}: ${response.statusText})
|
|
93
|
+
`Failed to get static images from the Cloudflare prerender server (${response.status}: ${response.statusText}).${details}`
|
|
88
94
|
);
|
|
89
95
|
}
|
|
90
96
|
const entries = await response.json();
|
|
@@ -27,6 +27,13 @@ function setImageConfig(service, config, command, logger) {
|
|
|
27
27
|
endpoint: command === "dev" ? GENERIC_ENDPOINT : CLOUDFLARE_PASSTHROUGH_ENDPOINT
|
|
28
28
|
};
|
|
29
29
|
case "cloudflare":
|
|
30
|
+
if (command === "dev") {
|
|
31
|
+
return {
|
|
32
|
+
...config,
|
|
33
|
+
service: passthroughImageService(),
|
|
34
|
+
endpoint: GENERIC_ENDPOINT
|
|
35
|
+
};
|
|
36
|
+
}
|
|
30
37
|
return {
|
|
31
38
|
...config,
|
|
32
39
|
service: { entrypoint: "@astrojs/cloudflare/image-service" }
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/cloudflare",
|
|
3
3
|
"description": "Deploy your site to Cloudflare Workers",
|
|
4
|
-
"version": "13.1.
|
|
4
|
+
"version": "13.1.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@astrojs/underscore-redirects": "1.0.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"astro": "^6.0.0
|
|
47
|
+
"astro": "^6.0.0",
|
|
48
48
|
"wrangler": "^4.61.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"@types/node": "^25.2.2",
|
|
53
53
|
"cheerio": "1.2.0",
|
|
54
54
|
"devalue": "^5.6.3",
|
|
55
|
-
"astro
|
|
56
|
-
"astro": "
|
|
55
|
+
"astro": "6.0.5",
|
|
56
|
+
"astro-scripts": "0.0.14"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"provenance": true
|