[ci] format
This commit is contained in:
parent
1a59185ddd
commit
5b1745bf31
2 changed files with 13 additions and 15 deletions
|
@ -21,15 +21,15 @@ interface BuildConfig {
|
||||||
export function getAdapter(isModeDirectory: boolean): AstroAdapter {
|
export function getAdapter(isModeDirectory: boolean): AstroAdapter {
|
||||||
return isModeDirectory
|
return isModeDirectory
|
||||||
? {
|
? {
|
||||||
name: '@astrojs/cloudflare',
|
name: '@astrojs/cloudflare',
|
||||||
serverEntrypoint: '@astrojs/cloudflare/server.directory.js',
|
serverEntrypoint: '@astrojs/cloudflare/server.directory.js',
|
||||||
exports: ['onRequest', 'manifest'],
|
exports: ['onRequest', 'manifest'],
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
name: '@astrojs/cloudflare',
|
name: '@astrojs/cloudflare',
|
||||||
serverEntrypoint: '@astrojs/cloudflare/server.advanced.js',
|
serverEntrypoint: '@astrojs/cloudflare/server.advanced.js',
|
||||||
exports: ['default'],
|
exports: ['default'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const SHIM = `globalThis.process = {
|
const SHIM = `globalThis.process = {
|
||||||
|
@ -104,8 +104,8 @@ export default function createIntegration(args?: Options): AstroIntegration {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isModeDirectory && _buildConfig.split) {
|
if (isModeDirectory && _buildConfig.split) {
|
||||||
const entryPointsRouteData = [..._entryPoints.keys()]
|
const entryPointsRouteData = [..._entryPoints.keys()];
|
||||||
const entryPointsURL = [..._entryPoints.values()]
|
const entryPointsURL = [..._entryPoints.values()];
|
||||||
const entryPaths = entryPointsURL.map((entry) => fileURLToPath(entry));
|
const entryPaths = entryPointsURL.map((entry) => fileURLToPath(entry));
|
||||||
const outputDir = fileURLToPath(new URL('.astro', _buildConfig.server));
|
const outputDir = fileURLToPath(new URL('.astro', _buildConfig.server));
|
||||||
|
|
||||||
|
@ -142,14 +142,13 @@ export default function createIntegration(args?: Options): AstroIntegration {
|
||||||
return `[[${p2}]]`;
|
return `[[${p2}]]`;
|
||||||
});
|
});
|
||||||
|
|
||||||
const fileUrl = new URL(fileName, functionsUrl)
|
const fileUrl = new URL(fileName, functionsUrl);
|
||||||
const newFileDir = dirname(fileURLToPath(fileUrl));
|
const newFileDir = dirname(fileURLToPath(fileUrl));
|
||||||
if (!fs.existsSync(newFileDir)) {
|
if (!fs.existsSync(newFileDir)) {
|
||||||
fs.mkdirSync(newFileDir, { recursive: true });
|
fs.mkdirSync(newFileDir, { recursive: true });
|
||||||
}
|
}
|
||||||
await fs.promises.writeFile(fileUrl, outputFile.contents);
|
await fs.promises.writeFile(fileUrl, outputFile.contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const entryPath = fileURLToPath(new URL(_buildConfig.serverEntry, _buildConfig.server));
|
const entryPath = fileURLToPath(new URL(_buildConfig.serverEntry, _buildConfig.server));
|
||||||
const entryUrl = new URL(_buildConfig.serverEntry, _config.outDir);
|
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);
|
const directoryUrl = new URL('[[path]].js', functionsUrl);
|
||||||
await fs.promises.rename(finalBuildUrl, directoryUrl);
|
await fs.promises.rename(finalBuildUrl, directoryUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// // // throw the server folder in the bin
|
// // // throw the server folder in the bin
|
||||||
|
|
|
@ -10,10 +10,10 @@ describe('Cloudflare SSR split', () => {
|
||||||
fixture = await loadFixture({
|
fixture = await loadFixture({
|
||||||
root: './fixtures/split/',
|
root: './fixtures/split/',
|
||||||
adapter: cloudflare({ mode: 'directory' }),
|
adapter: cloudflare({ mode: 'directory' }),
|
||||||
output: "server",
|
output: 'server',
|
||||||
build: {
|
build: {
|
||||||
split: true,
|
split: true,
|
||||||
excludeMiddleware: false
|
excludeMiddleware: false,
|
||||||
},
|
},
|
||||||
vite: {
|
vite: {
|
||||||
build: {
|
build: {
|
||||||
|
|
Loading…
Reference in a new issue