Skip to content

Commit 3b15594

Browse files
drops official cloudflare pages support
1 parent 30a9e54 commit 3b15594

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+6
-887
lines changed

packages/integrations/cloudflare/src/index.ts

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type {
1414
} from 'astro';
1515
import type { PluginOption } from 'vite';
1616
import { cloudflareModuleLoader } from './utils/cloudflare-module-loader.js';
17-
import { createRoutesFile, getParts } from './utils/generate-routes-json.js';
17+
import { getParts } from './utils/generate-routes-json.js';
1818
import { type ImageService, setImageConfig } from './utils/image-config.js';
1919
import { createConfigPlugin } from './vite-plugin-config.js';
2020
import { hasWranglerConfig, defaultCloudflareConfig } from './wrangler.js';
@@ -26,30 +26,6 @@ export type { Runtime } from './utils/handler.js';
2626
export type Options = {
2727
/** Options for handling images. */
2828
imageService?: ImageService;
29-
/** Configuration for `_routes.json` generation. A _routes.json file controls when your Function is invoked. This file will include three different properties:
30-
*
31-
* - 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.
32-
* - include: Defines routes that will be invoked by Functions. Accepts wildcard behavior.
33-
* - exclude: Defines routes that will not be invoked by Functions. Accepts wildcard behavior. `exclude` always take priority over `include`.
34-
*
35-
* Wildcards match any number of path segments (slashes). For example, `/users/*` will match everything after the `/users/` path.
36-
*
37-
*/
38-
routes?: {
39-
/** Extend `_routes.json` */
40-
extend: {
41-
/** Paths which should be routed to the SSR function */
42-
include?: {
43-
/** Generally this is in pathname format, but does support wildcards, e.g. `/users`, `/products/*` */
44-
pattern: string;
45-
}[];
46-
/** Paths which should be routed as static assets */
47-
exclude?: {
48-
/** Generally this is in pathname format, but does support wildcards, e.g. `/static`, `/assets/*`, `/images/avatar.jpg` */
49-
pattern: string;
50-
}[];
51-
};
52-
};
5329

5430
/**
5531
* Allow bundling cloudflare worker specific file types as importable modules. Defaults to true.
@@ -172,8 +148,6 @@ export default function createIntegration(args?: Options): AstroIntegration {
172148

173149
updateConfig({
174150
build: {
175-
client: new URL(`./client/`, config.outDir),
176-
server: new URL('./_worker.js/', config.outDir),
177151
serverEntry: 'index.js',
178152
redirects: false,
179153
},
@@ -256,7 +230,7 @@ export default function createIntegration(args?: Options): AstroIntegration {
256230
}),
257231
],
258232
},
259-
image: setImageConfig(args?.imageService ?? 'compile', config.image, command, logger),
233+
image: setImageConfig(args?.imageService ?? 'cloudflare-binding', config.image, command, logger),
260234
});
261235

262236
addWatchFile(new URL('./wrangler.toml', config.root));
@@ -352,7 +326,7 @@ export default function createIntegration(args?: Options): AstroIntegration {
352326
};
353327
}
354328
},
355-
'astro:build:done': async ({ pages, dir, logger, assets }) => {
329+
'astro:build:done': async ({ dir, logger, assets }) => {
356330
let redirectsExists = false;
357331
try {
358332
const redirectsStat = await stat(new URL('./_redirects', _config.build.client));
@@ -388,28 +362,6 @@ export default function createIntegration(args?: Options): AstroIntegration {
388362
}
389363
}
390364

391-
let routesExists = false;
392-
try {
393-
const routesStat = await stat(new URL('./_routes.json', _config.build.client));
394-
if (routesStat.isFile()) {
395-
routesExists = true;
396-
}
397-
} catch (_error) {
398-
routesExists = false;
399-
}
400-
401-
if (!routesExists) {
402-
await createRoutesFile(
403-
_config,
404-
logger,
405-
_routes,
406-
pages,
407-
redirects,
408-
args?.routes?.extend?.include,
409-
args?.routes?.extend?.exclude,
410-
);
411-
}
412-
413365
const trueRedirects = createRedirectsFromAstroRoutes({
414366
config: _config,
415367
routeToDynamicTargetMap: new Map(

0 commit comments

Comments
 (0)