@astrojs/cloudflare 12.5.2 → 12.5.4
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { joinPaths } from "@astrojs/internal-helpers/path";
|
|
2
2
|
import { baseService } from "astro/assets";
|
|
3
|
-
import { isESMImportedImage
|
|
3
|
+
import { isESMImportedImage } from "astro/assets/utils";
|
|
4
|
+
import { isRemoteAllowed } from "../utils/assets.js";
|
|
4
5
|
const service = {
|
|
5
6
|
...baseService,
|
|
6
7
|
getURL: (options, imageConfig) => {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { AstroIntegration } from 'astro';
|
|
2
2
|
import { type GetPlatformProxyOptions } from 'wrangler';
|
|
3
|
+
import { type ImageService } from './utils/image-config.js';
|
|
3
4
|
export type { Runtime } from './entrypoints/server.js';
|
|
4
5
|
export type Options = {
|
|
5
6
|
/** Options for handling images. */
|
|
6
|
-
imageService?:
|
|
7
|
+
imageService?: ImageService;
|
|
7
8
|
/** Configuration for `_routes.json` generation. A _routes.json file controls when your Function is invoked. This file will include three different properties:
|
|
8
9
|
*
|
|
9
10
|
* - version: Defines the version of the schema. Currently there is only one version of the schema (version 1), however, we may add more in the future and aim to be backwards compatible.
|
package/dist/index.js
CHANGED
|
@@ -55,12 +55,14 @@ function createIntegration(args) {
|
|
|
55
55
|
if (!session?.driver) {
|
|
56
56
|
const sessionDir = isBuild ? void 0 : createCodegenDir();
|
|
57
57
|
const bindingName = args?.sessionKVBindingName ?? "SESSION";
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
if (isBuild) {
|
|
59
|
+
logger.info(
|
|
60
|
+
`Enabling sessions with Cloudflare KV for production with the "${bindingName}" KV binding.`
|
|
61
|
+
);
|
|
62
|
+
logger.info(
|
|
63
|
+
`If you see the error "Invalid binding \`${bindingName}\`" in your build output, you need to add the binding to your wrangler config file.`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
64
66
|
session = isBuild ? {
|
|
65
67
|
...session,
|
|
66
68
|
driver: "cloudflare-kv-binding",
|
|
@@ -142,7 +144,10 @@ function createIntegration(args) {
|
|
|
142
144
|
i18nDomains: "experimental",
|
|
143
145
|
sharpImageService: {
|
|
144
146
|
support: "limited",
|
|
145
|
-
message:
|
|
147
|
+
message: 'Cloudflare does not support sharp at runtime. However, you can configure `imageService: "compile"` to optimize images with sharp on prerendered pages during build time.',
|
|
148
|
+
// For explicitly set image services, we suppress the warning about sharp not being supported at runtime,
|
|
149
|
+
// inferring the user is aware of the limitations.
|
|
150
|
+
suppress: args?.imageService ? "all" : "default"
|
|
146
151
|
},
|
|
147
152
|
envGetSecret: "stable"
|
|
148
153
|
}
|
package/dist/utils/assets.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { AstroConfig
|
|
2
|
-
export declare function isESMImportedImage(src: ImageMetadata | string): src is ImageMetadata;
|
|
1
|
+
import type { AstroConfig } from 'astro';
|
|
3
2
|
export declare function isRemoteAllowed(src: string, { domains, remotePatterns, }: Partial<Pick<AstroConfig['image'], 'domains' | 'remotePatterns'>>): boolean;
|
package/dist/utils/assets.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { isRemotePath } from "@astrojs/internal-helpers/path";
|
|
2
|
-
function isESMImportedImage(src) {
|
|
3
|
-
return typeof src === "object";
|
|
4
|
-
}
|
|
5
2
|
function matchHostname(url, hostname, allowWildcard) {
|
|
6
3
|
if (!hostname) {
|
|
7
4
|
return true;
|
|
@@ -56,6 +53,5 @@ function isRemoteAllowed(src, {
|
|
|
56
53
|
return domains.some((domain) => matchHostname(url, domain)) || remotePatterns.some((remotePattern) => matchPattern(url, remotePattern));
|
|
57
54
|
}
|
|
58
55
|
export {
|
|
59
|
-
isESMImportedImage,
|
|
60
56
|
isRemoteAllowed
|
|
61
57
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { AstroConfig, AstroIntegrationLogger, HookParameters } from 'astro';
|
|
2
|
-
export
|
|
2
|
+
export type ImageService = 'passthrough' | 'cloudflare' | 'compile' | 'custom';
|
|
3
|
+
export declare function setImageConfig(service: ImageService, config: AstroConfig['image'], command: HookParameters<'astro:config:setup'>['command'], logger: AstroIntegrationLogger): {
|
|
3
4
|
service: import("astro").ImageServiceConfig<Record<string, any>>;
|
|
5
|
+
experimentalDefaultStyles: boolean;
|
|
4
6
|
endpoint: {
|
|
5
7
|
route: string;
|
|
6
8
|
entrypoint?: string | undefined;
|
|
@@ -12,7 +14,7 @@ export declare function setImageConfig(service: string, config: AstroConfig['ima
|
|
|
12
14
|
hostname?: string | undefined;
|
|
13
15
|
pathname?: string | undefined;
|
|
14
16
|
}[];
|
|
15
|
-
experimentalLayout?: "
|
|
17
|
+
experimentalLayout?: "fixed" | "constrained" | "full-width" | "none" | undefined;
|
|
16
18
|
experimentalObjectFit?: string | undefined;
|
|
17
19
|
experimentalObjectPosition?: string | undefined;
|
|
18
20
|
experimentalBreakpoints?: number[] | undefined;
|
|
@@ -21,6 +23,7 @@ export declare function setImageConfig(service: string, config: AstroConfig['ima
|
|
|
21
23
|
endpoint: {
|
|
22
24
|
entrypoint: string | undefined;
|
|
23
25
|
};
|
|
26
|
+
experimentalDefaultStyles: boolean;
|
|
24
27
|
domains: string[];
|
|
25
28
|
remotePatterns: {
|
|
26
29
|
port?: string | undefined;
|
|
@@ -28,7 +31,7 @@ export declare function setImageConfig(service: string, config: AstroConfig['ima
|
|
|
28
31
|
hostname?: string | undefined;
|
|
29
32
|
pathname?: string | undefined;
|
|
30
33
|
}[];
|
|
31
|
-
experimentalLayout?: "
|
|
34
|
+
experimentalLayout?: "fixed" | "constrained" | "full-width" | "none" | undefined;
|
|
32
35
|
experimentalObjectFit?: string | undefined;
|
|
33
36
|
experimentalObjectPosition?: string | undefined;
|
|
34
37
|
experimentalBreakpoints?: number[] | undefined;
|
|
@@ -21,7 +21,7 @@ function setImageConfig(service, config, command, logger) {
|
|
|
21
21
|
default:
|
|
22
22
|
if (config.service.entrypoint === "astro/assets/services/sharp") {
|
|
23
23
|
logger.warn(
|
|
24
|
-
`The current configuration does not support image optimization. To allow your project to build with the original, unoptimized images, the image service has been automatically switched to the '
|
|
24
|
+
`The current configuration does not support image optimization. To allow your project to build with the original, unoptimized images, the image service has been automatically switched to the 'passthrough' option. See https://docs.astro.build/en/reference/configuration-reference/#imageservice`
|
|
25
25
|
);
|
|
26
26
|
return { ...config, service: passthroughImageService() };
|
|
27
27
|
}
|
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": "12.5.
|
|
4
|
+
"version": "12.5.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cloudflare/workers-types": "^4.
|
|
33
|
-
"tinyglobby": "^0.2.
|
|
34
|
-
"vite": "^6.3.
|
|
35
|
-
"wrangler": "^4.
|
|
32
|
+
"@cloudflare/workers-types": "^4.20250507.0",
|
|
33
|
+
"tinyglobby": "^0.2.13",
|
|
34
|
+
"vite": "^6.3.5",
|
|
35
|
+
"wrangler": "^4.14.1",
|
|
36
36
|
"@astrojs/internal-helpers": "0.6.1",
|
|
37
37
|
"@astrojs/underscore-redirects": "0.6.1"
|
|
38
38
|
},
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"cheerio": "1.0.0",
|
|
44
44
|
"devalue": "^5.1.1",
|
|
45
45
|
"execa": "^8.0.1",
|
|
46
|
-
"rollup": "^4.
|
|
47
|
-
"astro": "
|
|
48
|
-
"astro
|
|
46
|
+
"rollup": "^4.40.2",
|
|
47
|
+
"astro-scripts": "0.0.14",
|
|
48
|
+
"astro": "5.9.0"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"provenance": true
|