@astrojs/cloudflare 12.5.3 → 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.
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?: 'passthrough' | 'cloudflare' | 'compile' | 'custom';
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
- logger.info(
59
- `Enabling sessions with ${isBuild ? "Cloudflare KV" : "filesystem storage"}. Be sure to define a KV binding named "${bindingName}".`
60
- );
61
- logger.info(
62
- `If you see the error "Invalid binding \`${bindingName}\`" in your build output, you need to add the binding to your wrangler config file.`
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: "Cloudflare does not support sharp. You can use the `compile` image service to compile images at build time. It will not work for any on-demand rendered images."
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
  }
@@ -1,6 +1,8 @@
1
1
  import type { AstroConfig, AstroIntegrationLogger, HookParameters } from 'astro';
2
- export declare function setImageConfig(service: string, config: AstroConfig['image'], command: HookParameters<'astro:config:setup'>['command'], logger: AstroIntegrationLogger): {
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?: "none" | "fixed" | "constrained" | "full-width" | undefined;
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?: "none" | "fixed" | "constrained" | "full-width" | undefined;
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 'noop' option. See https://docs.astro.build/en/reference/configuration-reference/#imageservice`
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.3",
4
+ "version": "12.5.4",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -44,8 +44,8 @@
44
44
  "devalue": "^5.1.1",
45
45
  "execa": "^8.0.1",
46
46
  "rollup": "^4.40.2",
47
- "astro": "5.7.13",
48
- "astro-scripts": "0.0.14"
47
+ "astro-scripts": "0.0.14",
48
+ "astro": "5.9.0"
49
49
  },
50
50
  "publishConfig": {
51
51
  "provenance": true