@astrojs/cloudflare 12.0.0 → 12.0.1

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 +6 -16
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import { appendForwardSlash, prependForwardSlash, removeLeadingForwardSlash, } f
5
5
  import { createRedirectsFromAstroRoutes } from '@astrojs/underscore-redirects';
6
6
  import astroWhen from '@inox-tools/astro-when';
7
7
  import { AstroError } from 'astro/errors';
8
+ import { defaultServerConditions } from 'vite';
8
9
  import { getPlatformProxy } from 'wrangler';
9
10
  import { cloudflareModuleLoader, } from './utils/cloudflare-module-loader.js';
10
11
  import { createGetEnv } from './utils/env.js';
@@ -130,11 +131,12 @@ export default function createIntegration(args) {
130
131
  vite.resolve.alias[alias.find] = alias.replacement;
131
132
  }
132
133
  }
133
- vite.resolve.conditions ||= [];
134
- // We need those conditions, previous these conditions where applied at the esbuild step which we removed
135
- // https://github.com/withastro/astro/pull/7092
136
- vite.resolve.conditions.push('workerd', 'worker');
134
+ // Support `workerd` and `worker` conditions for the ssr environment
135
+ // (previously supported in esbuild instead: https://github.com/withastro/astro/pull/7092)
137
136
  vite.ssr ||= {};
137
+ vite.ssr.resolve ||= {};
138
+ vite.ssr.resolve.conditions ||= [...defaultServerConditions];
139
+ vite.ssr.resolve.conditions.push('workerd', 'worker');
138
140
  vite.ssr.target = 'webworker';
139
141
  vite.ssr.noExternal = true;
140
142
  if (typeof _config.vite.ssr?.external === 'undefined')
@@ -161,18 +163,6 @@ export default function createIntegration(args) {
161
163
  ...vite.define,
162
164
  };
163
165
  }
164
- // we thought that vite config inside `if (target === 'server')` would not apply for client
165
- // but it seems like the same `vite` reference is used for both
166
- // so we need to reset the previous conflicting setting
167
- // in the future we should look into a more robust solution
168
- if (target === 'client') {
169
- vite.resolve ||= {};
170
- vite.resolve.conditions ||= [];
171
- vite.resolve.conditions = vite.resolve.conditions.filter((c) => c !== 'workerd' && c !== 'worker');
172
- vite.build ||= {};
173
- vite.build.rollupOptions ||= {};
174
- vite.build.rollupOptions.output ||= {};
175
- }
176
166
  },
177
167
  'astro:build:done': async ({ pages, routes, dir, logger }) => {
178
168
  await cloudflareModulePlugin.afterBuildCompleted(_config);
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.0.0",
4
+ "version": "12.0.1",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -38,19 +38,19 @@
38
38
  "magic-string": "^0.30.14",
39
39
  "miniflare": "^3.20241106.1",
40
40
  "tiny-glob": "^0.2.9",
41
+ "vite": "^6.0.2",
41
42
  "wrangler": "^3.91.0"
42
43
  },
43
44
  "peerDependencies": {
44
45
  "astro": "^5.0.0"
45
46
  },
46
47
  "devDependencies": {
47
- "astro": "^5.0.0-alpha.15",
48
+ "astro": "^5.0.0",
48
49
  "cheerio": "1.0.0",
49
50
  "execa": "^8.0.1",
50
51
  "fast-glob": "^3.3.2",
51
52
  "rollup": "^4.27.4",
52
53
  "strip-ansi": "^7.1.0",
53
- "vite": "6.0.1",
54
54
  "@astrojs/test-utils": "0.0.1",
55
55
  "astro-scripts": "0.0.14"
56
56
  },