diff --git a/packages/integrations/cloudflare/src/index.ts b/packages/integrations/cloudflare/src/index.ts index f4ee26feaa..298d798fb8 100644 --- a/packages/integrations/cloudflare/src/index.ts +++ b/packages/integrations/cloudflare/src/index.ts @@ -21,15 +21,15 @@ interface BuildConfig { export function getAdapter(isModeDirectory: boolean): AstroAdapter { return isModeDirectory ? { - name: '@astrojs/cloudflare', - serverEntrypoint: '@astrojs/cloudflare/server.directory.js', - exports: ['onRequest', 'manifest'], - } + name: '@astrojs/cloudflare', + serverEntrypoint: '@astrojs/cloudflare/server.directory.js', + exports: ['onRequest', 'manifest'], + } : { - name: '@astrojs/cloudflare', - serverEntrypoint: '@astrojs/cloudflare/server.advanced.js', - exports: ['default'], - }; + name: '@astrojs/cloudflare', + serverEntrypoint: '@astrojs/cloudflare/server.advanced.js', + exports: ['default'], + }; } const SHIM = `globalThis.process = { @@ -104,8 +104,8 @@ export default function createIntegration(args?: Options): AstroIntegration { } if (isModeDirectory && _buildConfig.split) { - const entryPointsRouteData = [..._entryPoints.keys()] - const entryPointsURL = [..._entryPoints.values()] + const entryPointsRouteData = [..._entryPoints.keys()]; + const entryPointsURL = [..._entryPoints.values()]; const entryPaths = entryPointsURL.map((entry) => fileURLToPath(entry)); const outputDir = fileURLToPath(new URL('.astro', _buildConfig.server)); @@ -142,14 +142,13 @@ export default function createIntegration(args?: Options): AstroIntegration { return `[[${p2}]]`; }); - const fileUrl = new URL(fileName, functionsUrl) + const fileUrl = new URL(fileName, functionsUrl); const newFileDir = dirname(fileURLToPath(fileUrl)); if (!fs.existsSync(newFileDir)) { fs.mkdirSync(newFileDir, { recursive: true }); } await fs.promises.writeFile(fileUrl, outputFile.contents); } - } else { const entryPath = fileURLToPath(new URL(_buildConfig.serverEntry, _buildConfig.server)); const entryUrl = new URL(_buildConfig.serverEntry, _config.outDir); @@ -182,7 +181,6 @@ export default function createIntegration(args?: Options): AstroIntegration { const directoryUrl = new URL('[[path]].js', functionsUrl); await fs.promises.rename(finalBuildUrl, directoryUrl); } - } // // // throw the server folder in the bin diff --git a/packages/integrations/cloudflare/test/directory-split.test.js b/packages/integrations/cloudflare/test/directory-split.test.js index 8bb6cd8728..384543a4b8 100644 --- a/packages/integrations/cloudflare/test/directory-split.test.js +++ b/packages/integrations/cloudflare/test/directory-split.test.js @@ -10,10 +10,10 @@ describe('Cloudflare SSR split', () => { fixture = await loadFixture({ root: './fixtures/split/', adapter: cloudflare({ mode: 'directory' }), - output: "server", + output: 'server', build: { split: true, - excludeMiddleware: false + excludeMiddleware: false, }, vite: { build: {