@astrojs/cloudflare 13.0.1 → 13.0.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.
|
@@ -80,7 +80,7 @@ function serverStart({
|
|
|
80
80
|
host,
|
|
81
81
|
base
|
|
82
82
|
}) {
|
|
83
|
-
const version = "13.0.
|
|
83
|
+
const version = "13.0.2";
|
|
84
84
|
const localPrefix = `${colors.dim("\u2503")} Local `;
|
|
85
85
|
const networkPrefix = `${colors.dim("\u2503")} Network `;
|
|
86
86
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -9,7 +9,7 @@ function astroFrontmatterScanPlugin() {
|
|
|
9
9
|
const code = await readFile(args.path, "utf-8");
|
|
10
10
|
const frontmatterMatch = FRONTMATTER_RE.exec(code);
|
|
11
11
|
if (frontmatterMatch) {
|
|
12
|
-
const contents = frontmatterMatch[1].replace(/\breturn\b/g, "throw ");
|
|
12
|
+
const contents = frontmatterMatch[1].replace(/\breturn\s*;/g, "throw 0;").replace(/\breturn\b/g, "throw ");
|
|
13
13
|
return {
|
|
14
14
|
contents,
|
|
15
15
|
loader: "ts"
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,18 @@ import { parseEnv } from "node:util";
|
|
|
20
20
|
import { sessionDrivers } from "astro/config";
|
|
21
21
|
import { createCloudflarePrerenderer } from "./prerenderer.js";
|
|
22
22
|
import { createRequire } from "node:module";
|
|
23
|
+
const CLOUDFLARE_KV_SESSION_DRIVER_ENTRYPOINT = sessionDrivers.cloudflareKVBinding().entrypoint;
|
|
24
|
+
function usesCloudflareKVSessionDriver(session) {
|
|
25
|
+
const driver = session?.driver;
|
|
26
|
+
if (!driver) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if (typeof driver === "string") {
|
|
30
|
+
return driver === "cloudflareKVBinding" || driver === "cloudflare-kv-binding";
|
|
31
|
+
}
|
|
32
|
+
const entrypoint = typeof driver.entrypoint === "string" ? driver.entrypoint : driver.entrypoint.toString();
|
|
33
|
+
return entrypoint === CLOUDFLARE_KV_SESSION_DRIVER_ENTRYPOINT || entrypoint.endsWith("cloudflare-kv-binding");
|
|
34
|
+
}
|
|
23
35
|
function createIntegration({
|
|
24
36
|
imageService,
|
|
25
37
|
sessionKVBindingName = DEFAULT_SESSION_KV_BINDING_NAME,
|
|
@@ -62,9 +74,11 @@ function createIntegration({
|
|
|
62
74
|
ttl: session?.ttl
|
|
63
75
|
};
|
|
64
76
|
}
|
|
77
|
+
const needsSessionKVBinding = usesCloudflareKVSessionDriver(session);
|
|
65
78
|
const needsImagesBindingForDev = isCompile && command === "dev";
|
|
66
79
|
cfPluginConfig = {
|
|
67
80
|
config: cloudflareConfigCustomizer({
|
|
81
|
+
needsSessionKVBinding,
|
|
68
82
|
sessionKVBindingName,
|
|
69
83
|
imagesBindingName: needsImagesBinding || needsImagesBindingForDev ? imagesBindingName : false
|
|
70
84
|
}),
|
package/dist/wrangler.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const DEFAULT_IMAGES_BINDING_NAME = "IMAGES";
|
|
|
4
4
|
export declare const DEFAULT_ASSETS_BINDING_NAME = "ASSETS";
|
|
5
5
|
interface CloudflareConfigOptions {
|
|
6
6
|
sessionKVBindingName: string | undefined;
|
|
7
|
+
needsSessionKVBinding?: boolean;
|
|
7
8
|
imagesBindingName: string | false | undefined;
|
|
8
9
|
}
|
|
9
10
|
/**
|
package/dist/wrangler.js
CHANGED
|
@@ -3,6 +3,7 @@ const DEFAULT_IMAGES_BINDING_NAME = "IMAGES";
|
|
|
3
3
|
const DEFAULT_ASSETS_BINDING_NAME = "ASSETS";
|
|
4
4
|
function cloudflareConfigCustomizer(options) {
|
|
5
5
|
const sessionKVBindingName = options?.sessionKVBindingName ?? DEFAULT_SESSION_KV_BINDING_NAME;
|
|
6
|
+
const needsSessionKVBinding = options?.needsSessionKVBinding ?? true;
|
|
6
7
|
const imagesBindingName = options?.imagesBindingName === false ? void 0 : options?.imagesBindingName ?? DEFAULT_IMAGES_BINDING_NAME;
|
|
7
8
|
return (config) => {
|
|
8
9
|
const hasSessionBinding = config.kv_namespaces?.some(
|
|
@@ -12,7 +13,7 @@ function cloudflareConfigCustomizer(options) {
|
|
|
12
13
|
const hasAssetsBinding = config.assets?.binding !== void 0;
|
|
13
14
|
return {
|
|
14
15
|
main: config.main ?? "@astrojs/cloudflare/entrypoints/server",
|
|
15
|
-
kv_namespaces: hasSessionBinding ? void 0 : [
|
|
16
|
+
kv_namespaces: !needsSessionKVBinding || hasSessionBinding ? void 0 : [
|
|
16
17
|
{
|
|
17
18
|
binding: sessionKVBindingName
|
|
18
19
|
}
|
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.0.
|
|
4
|
+
"version": "13.0.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"piccolore": "^0.1.3",
|
|
40
40
|
"tinyglobby": "^0.2.15",
|
|
41
41
|
"vite": "^7.3.1",
|
|
42
|
-
"@astrojs/
|
|
43
|
-
"@astrojs/
|
|
42
|
+
"@astrojs/underscore-redirects": "1.0.1",
|
|
43
|
+
"@astrojs/internal-helpers": "0.8.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"astro": "^6.0.0-alpha.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@types/node": "^25.2.2",
|
|
52
52
|
"cheerio": "1.2.0",
|
|
53
53
|
"devalue": "^5.6.3",
|
|
54
|
-
"astro": "6.0.
|
|
54
|
+
"astro": "6.0.2",
|
|
55
55
|
"astro-scripts": "0.0.14"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|