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

Code before:
					entrypoint: '@astrojs/cloudflare/entrypoints/middleware.js',
					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 | string | 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
						? 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',

Review comment (suggestion):
```suggestion
				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);
					}
				}
```

Code after:
					entrypoint: '@astrojs/cloudflare/entrypoints/middleware.js',
					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',