[ci] format
This commit is contained in:
parent
80034c6cbc
commit
4edccae534
6 changed files with 26 additions and 26 deletions
|
@ -82,7 +82,7 @@ class AstroBuilder {
|
|||
client: new URL('./client/', this.config.dist),
|
||||
server: new URL('./server/', this.config.dist),
|
||||
serverEntry: 'entry.mjs',
|
||||
staticMode: undefined
|
||||
staticMode: undefined,
|
||||
};
|
||||
await runHookBuildStart({ config: this.config, buildConfig });
|
||||
|
||||
|
@ -173,7 +173,7 @@ class AstroBuilder {
|
|||
|
||||
// You're done! Time to clean up.
|
||||
await viteServer.close();
|
||||
await runHookBuildDone({ config: this.config, pages: pageNames, routes: Object.values(allPages).map(pd => pd.route) });
|
||||
await runHookBuildDone({ config: this.config, pages: pageNames, routes: Object.values(allPages).map((pd) => pd.route) });
|
||||
|
||||
if (logging.level && levels[logging.level] <= levels['info']) {
|
||||
const buildMode = this.config.buildOptions.experimentalSsr ? 'ssr' : 'static';
|
||||
|
|
|
@ -219,6 +219,11 @@ export function timerMessage(message: string, startTime: number = performance.no
|
|||
*/
|
||||
export function warnIfUsingExperimentalSSR(opts: LogOptions, config: AstroConfig) {
|
||||
if (isBuildingToSSR(config)) {
|
||||
warn(opts, 'warning', bold(`Warning:`), ` SSR support is still experimental and subject to API changes. If using in production pin your dependencies to prevent accidental breakage.`);
|
||||
warn(
|
||||
opts,
|
||||
'warning',
|
||||
bold(`Warning:`),
|
||||
` SSR support is still experimental and subject to API changes. If using in production pin your dependencies to prevent accidental breakage.`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ export async function runHookBuildStart({ config, buildConfig }: { config: Astro
|
|||
}
|
||||
}
|
||||
|
||||
export async function runHookBuildDone({ config, pages, routes }: { config: AstroConfig; pages: string[], routes: RouteData[] }) {
|
||||
export async function runHookBuildDone({ config, pages, routes }: { config: AstroConfig; pages: string[]; routes: RouteData[] }) {
|
||||
for (const integration of config.integrations) {
|
||||
if (integration.hooks['astro:build:done']) {
|
||||
await integration.hooks['astro:build:done']({ pages: pages.map((p) => ({ pathname: p })), dir: config.dist, routes });
|
||||
|
|
|
@ -6,7 +6,7 @@ export function getAdapter(site: string | undefined): AstroAdapter {
|
|||
name: '@astrojs/netlify',
|
||||
serverEntrypoint: '@astrojs/netlify/netlify-functions.js',
|
||||
exports: ['handler'],
|
||||
args: { site }
|
||||
args: { site },
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ function netlifyFunctions({ dist }: NetlifyFunctionsOptions = {}): AstroIntegrat
|
|||
for (const route of routes) {
|
||||
if (route.pathname) {
|
||||
_redirects += `
|
||||
${route.pathname} /.netlify/functions/${entryFile} 200`
|
||||
${route.pathname} /.netlify/functions/${entryFile} 200`;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,12 +53,9 @@ ${route.pathname} /.netlify/functions/${entryFile} 200`
|
|||
} else {
|
||||
await fs.promises.writeFile(_redirectsURL, _redirects, 'utf-8');
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export {
|
||||
netlifyFunctions,
|
||||
netlifyFunctions as default
|
||||
};
|
||||
export { netlifyFunctions, netlifyFunctions as default };
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
export {
|
||||
netlifyFunctions as default
|
||||
} from './index.js';
|
||||
export { netlifyFunctions as default } from './index.js';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { SSRManifest } from 'astro';
|
||||
import type { Handler } from "@netlify/functions";
|
||||
import type { Handler } from '@netlify/functions';
|
||||
import { App } from 'astro/app';
|
||||
import { polyfill } from '@astrojs/webapi';
|
||||
|
||||
|
@ -19,13 +19,13 @@ export const createExports = (manifest: SSRManifest, args: Args) => {
|
|||
const headers = new Headers(event.headers as any);
|
||||
const request = new Request(new URL(event.path, site).toString(), {
|
||||
method: event.httpMethod,
|
||||
headers
|
||||
headers,
|
||||
});
|
||||
|
||||
if (!app.match(request)) {
|
||||
return {
|
||||
statusCode: 404,
|
||||
body: 'Not found'
|
||||
body: 'Not found',
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -35,9 +35,9 @@ export const createExports = (manifest: SSRManifest, args: Args) => {
|
|||
return {
|
||||
statusCode: 200,
|
||||
headers: Object.fromEntries(response.headers.entries()),
|
||||
body
|
||||
body,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
return { handler };
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue