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

Code before:
	 * By default, the driver looks for the binding named `SESSION`, but you can override this by providing a different name here.
	 *
	 * See https://developers.cloudflare.com/kv/concepts/kv-namespaces/ for more details on using KV namespaces.
	 *
	 */
	sessionKVBindingName?: string;

	/**
	 * This configuration option allows you to specify a custom entryPoint for your Cloudflare Worker.
	 * The entry point is the file that will be executed when your Worker is invoked.
	 * By default, this is set to `@astrojs/cloudflare/entrypoints/server.js` and `['default']`.
	 * @docs https://docs.astro.build/en/guides/integrations-guide/cloudflare/#workerEntryPoint
	 */
	workerEntryPoint?: {
		/**
		 * The path to the entry file. This should be a relative path from the root of your Astro project.
		 * @example`'src/worker.ts'`
		 * @docs https://docs.astro.build/en/reference/adapter-reference/#server-entrypoint
		 */
		path: string | URL;
		/**
		 * The exports to use for the entry file. By default, this is set to `['default']`. If you need to have other top level exports, e.g. DurableObjects you need to provide them here.
		 * @example `['default', 'MyDurableObject']`
		 * @docs https://docs.astro.build/en/reference/adapter-reference/#server-entrypoint
		 */
		exports: string[];
	};
};

function wrapWithSlashes(path: string): string {
	return prependForwardSlash(appendForwardSlash(path));
}

function setProcessEnv(config: AstroConfig, env: Record<string, unknown>) {
	const getEnv = createGetEnv(env);

	if (config.env?.schema) {
		for (const key of Object.keys(config.env.schema)) {
			const value = getEnv(key);
			if (value !== undefined) {
				process.env[key] = value;
			}
		}
	}
}

export default function createIntegration(args?: Options): AstroIntegration {
	let _config: AstroConfig;
	let finalBuildOutput: HookParameters<'astro:config:done'>['buildOutput'];

	const cloudflareModulePlugin: PluginOption & CloudflareModulePluginExtra = cloudflareModuleLoader(

Review comment (suggestion):
Shouldn't this be `exports?:` ? If there's a default, it means that it can be undefined 

Code after:
	 * ```
	 * By default, the driver looks for the binding named `SESSION`, but you can override this by providing a different name here.
	 *
	 * See https://developers.cloudflare.com/kv/concepts/kv-namespaces/ for more details on using KV namespaces.
	 *
	 */
	sessionKVBindingName?: string;

	/**
	 * This configuration option allows you to specify a custom entryPoint for your Cloudflare Worker.
	 * The entry point is the file that will be executed when your Worker is invoked.
	 * By default, this is set to `@astrojs/cloudflare/entrypoints/server.js` and `['default']`.
	 * @docs https://docs.astro.build/en/guides/integrations-guide/cloudflare/#workerEntryPoint
	 */
	workerEntryPoint?: {
		/**
		 * The path to the entry file. This should be a relative path from the root of your Astro project.
		 * @example`'src/worker.ts'`
		 * @docs https://docs.astro.build/en/guides/integrations-guide/cloudflare/#workerentrypointpath
		 */
		path: string | URL;
		/**
		 * Additional named exports to use for the entry file. Astro always includes the default export (`['default']`). If you need to have other top level named exports use this option.
		 * @example ['MyDurableObject', 'namedExport']
		 * @docs https://docs.astro.build/en/guides/integrations-guide/cloudflare/#workerentrypointnamedexports
		 */
		namedExports?: string[];
	};
};

function wrapWithSlashes(path: string): string {
	return prependForwardSlash(appendForwardSlash(path));
}

function setProcessEnv(config: AstroConfig, env: Record<string, unknown>) {
	const getEnv = createGetEnv(env);

	if (config.env?.schema) {
		for (const key of Object.keys(config.env.schema)) {
			const value = getEnv(key);
			if (value !== undefined) {
				process.env[key] = value;
			}
		}
	}
}

export default function createIntegration(args?: Options): AstroIntegration {
	let _config: AstroConfig;
	let finalBuildOutput: HookParameters<'astro:config:done'>['buildOutput'];