aboutsummaryrefslogtreecommitdiff
path: root/packages/integrations/node/src/preview.ts
diff options
context:
space:
mode:
authorGravatar matthewp <matthewp@users.noreply.github.com> 2022-11-07 15:06:51 +0000
committerGravatar fredkbot <fred+astrobot@astro.build> 2022-11-07 15:06:51 +0000
commitcb47d036f95a37b09292d3adcf97ef7ffea6170f (patch)
tree626644ff33a8601cad3bd097d727d94cbbc785b2 /packages/integrations/node/src/preview.ts
parentc939dea252a1b0dbefcf8cec5568dd12729f130a (diff)
downloadastro-cb47d036f95a37b09292d3adcf97ef7ffea6170f.tar.gz
astro-cb47d036f95a37b09292d3adcf97ef7ffea6170f.tar.zst
astro-cb47d036f95a37b09292d3adcf97ef7ffea6170f.zip
[ci] format
Diffstat (limited to 'packages/integrations/node/src/preview.ts')
-rw-r--r--packages/integrations/node/src/preview.ts16
1 files changed, 12 insertions, 4 deletions
diff --git a/packages/integrations/node/src/preview.ts b/packages/integrations/node/src/preview.ts
index 3b896cc72..b35d30204 100644
--- a/packages/integrations/node/src/preview.ts
+++ b/packages/integrations/node/src/preview.ts
@@ -4,7 +4,13 @@ import { fileURLToPath } from 'url';
import { createServer } from './http-server.js';
import type { createExports } from './server';
-const preview: CreatePreviewServer = async function ({ client, serverEntrypoint, host, port, base }) {
+const preview: CreatePreviewServer = async function ({
+ client,
+ serverEntrypoint,
+ host,
+ port,
+ base,
+}) {
type ServerModule = ReturnType<typeof createExports>;
type MaybeServerModule = Partial<ServerModule>;
let ssrHandler: ServerModule['handler'];
@@ -36,9 +42,11 @@ const preview: CreatePreviewServer = async function ({ client, serverEntrypoint,
});
};
- const baseWithoutTrailingSlash: string = base.endsWith('/') ? base.slice(0, base.length - 1) : base;
+ const baseWithoutTrailingSlash: string = base.endsWith('/')
+ ? base.slice(0, base.length - 1)
+ : base;
function removeBase(pathname: string): string {
- if(pathname.startsWith(base)) {
+ if (pathname.startsWith(base)) {
return pathname.slice(baseWithoutTrailingSlash.length);
}
return pathname;
@@ -49,7 +57,7 @@ const preview: CreatePreviewServer = async function ({ client, serverEntrypoint,
client,
port,
host,
- removeBase
+ removeBase,
},
handler
);