@astrojs/cloudflare 7.6.0 → 7.6.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.
Files changed (2) hide show
  1. package/dist/index.js +11 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { createRedirectsFromAstroRoutes } from '@astrojs/underscore-redirects';
2
+ import { passthroughImageService } from 'astro/config';
2
3
  import { AstroError } from 'astro/errors';
3
4
  import esbuild from 'esbuild';
4
5
  import { Miniflare } from 'miniflare';
@@ -41,13 +42,19 @@ export default function createIntegration(args) {
41
42
  args.runtime.persistTo === undefined) {
42
43
  runtimeMode = { mode: 'local', persistTo: '.wrangler/state/v3' };
43
44
  }
44
- else {
45
+ else if (args?.runtime) {
45
46
  runtimeMode = args?.runtime;
46
47
  }
47
48
  return {
48
49
  name: '@astrojs/cloudflare',
49
50
  hooks: {
50
- 'astro:config:setup': ({ config, updateConfig }) => {
51
+ 'astro:config:setup': ({ config, updateConfig, logger }) => {
52
+ let imageConfigOverwrite = false;
53
+ if (config.image.service.entrypoint === 'astro/assets/services/sharp' ||
54
+ config.image.service.entrypoint === 'astro/assets/services/squoosh') {
55
+ logger.warn(`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`);
56
+ imageConfigOverwrite = true;
57
+ }
51
58
  updateConfig({
52
59
  build: {
53
60
  client: new URL(`.${config.base}`, config.outDir),
@@ -64,6 +71,7 @@ export default function createIntegration(args) {
64
71
  }),
65
72
  ],
66
73
  },
74
+ image: imageConfigOverwrite ? passthroughImageService() : config.image,
67
75
  });
68
76
  },
69
77
  'astro:config:done': ({ setAdapter, config, logger }) => {
@@ -100,7 +108,7 @@ export default function createIntegration(args) {
100
108
  modules: true,
101
109
  script: '',
102
110
  cache: true,
103
- cachePersist: true,
111
+ cachePersist: `${typedRuntimeMode.persistTo}/cache`,
104
112
  cacheWarnUsage: true,
105
113
  d1Databases: D1Bindings,
106
114
  d1Persist: `${typedRuntimeMode.persistTo}/d1`,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "//comment": "test changeset-bot",
3
3
  "name": "@astrojs/cloudflare",
4
4
  "description": "Deploy your site to Cloudflare Workers/Pages",
5
- "version": "7.6.0",
5
+ "version": "7.6.2",
6
6
  "type": "module",
7
7
  "types": "./dist/index.d.ts",
8
8
  "author": "withastro",