Repository: withastro/astro
File: packages/integrations/cloudflare/src/index.ts (TypeScript)

Code before:
				});
			},
			'astro:routes:resolved': ({ routes }) => {
				_routes = routes;
			},
			'astro:config:done': ({ setAdapter, config, buildOutput, logger }) => {
				if (buildOutput === 'static') {
					logger.warn(
						'[@astrojs/cloudflare] This adapter is intended to be used with server rendered pages, which this project does not contain any of. As such, this adapter is unnecessary.',
					);
				}

				_config = config;
				finalBuildOutput = buildOutput;

				let customWorkerEntryPoint: URL | undefined;
				if (args?.workerEntryPoint?.path && typeof args.workerEntryPoint.path === 'string') {
					customWorkerEntryPoint = new URL(args.workerEntryPoint.path, config.root);
				}

				setAdapter({
					name: '@astrojs/cloudflare',
					serverEntrypoint: customWorkerEntryPoint
						? customWorkerEntryPoint
						: '@astrojs/cloudflare/entrypoints/server.js',
					exports: args?.workerEntryPoint?.exports ? args.workerEntryPoint.exports : ['default'],
					adapterFeatures: {
						edgeMiddleware: false,
						buildOutput: 'server',
					},
					supportedAstroFeatures: {
						serverOutput: 'stable',
						hybridOutput: 'stable',
						staticOutput: 'unsupported',
						i18nDomains: 'experimental',
						sharpImageService: {
							support: 'limited',
							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.',
							// For explicitly set image services, we suppress the warning about sharp not being supported at runtime,
							// inferring the user is aware of the limitations.
							suppress: args?.imageService ? 'all' : 'default',
						},
						envGetSecret: 'stable',
					},
				});
			},
			'astro:server:setup': async ({ server }) => {
				if ((args?.platformProxy?.enabled ?? true) === true) {
					const platformProxy = await getPlatformProxy(args?.platformProxy);


Review comment (suggestion):
Maybe I missed a comment but didn't we say `'default'` should always be included even when `args.workerEntryPoint.exports` is provided?

```suggestion
					exports: args?.workerEntryPoint?.exports ? [...new Set(['default', ...args.workerEntryPoint.exports])] : ['default'],
```

Code after:
					order: 'pre',
				});
			},
			'astro:routes:resolved': ({ routes }) => {
				_routes = routes;
			},
			'astro:config:done': ({ setAdapter, config, buildOutput, logger }) => {
				if (buildOutput === 'static') {
					logger.warn(
						'[@astrojs/cloudflare] This adapter is intended to be used with server rendered pages, which this project does not contain any of. As such, this adapter is unnecessary.',
					);
				}

				_config = config;
				finalBuildOutput = buildOutput;

				let customWorkerEntryPoint: URL | undefined;
				if (args?.workerEntryPoint && typeof args.workerEntryPoint.path === 'string') {
					const require = createRequire(config.root);
					try {
						customWorkerEntryPoint = pathToFileURL(require.resolve(args.workerEntryPoint.path));
					} catch {
						customWorkerEntryPoint = new URL(args.workerEntryPoint.path, config.root);
					}
				}

				setAdapter({
					name: '@astrojs/cloudflare',
					serverEntrypoint: customWorkerEntryPoint ?? '@astrojs/cloudflare/entrypoints/server.js',
					exports: args?.workerEntryPoint?.namedExports
						? ['default', ...args.workerEntryPoint.namedExports]
						: ['default'],
					adapterFeatures: {
						edgeMiddleware: false,
						buildOutput: 'server',
					},
					supportedAstroFeatures: {
						serverOutput: 'stable',
						hybridOutput: 'stable',
						staticOutput: 'unsupported',
						i18nDomains: 'experimental',
						sharpImageService: {
							support: 'limited',
							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.',
							// For explicitly set image services, we suppress the warning about sharp not being supported at runtime,
							// inferring the user is aware of the limitations.
							suppress: args?.imageService ? 'all' : 'default',
						},
						envGetSecret: 'stable',
					},