summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Arsh <lilnasy@users.noreply.github.com> 2024-01-25 19:39:17 +0000
committerGravatar astrobot-houston <fred+astrobot@astro.build> 2024-01-25 19:39:17 +0000
commit00e6adb033c882c92fdbb3989b2fc1b78acb3bd7 (patch)
tree31016edfeaa6d6cae304c747dd93b292370241c4
parentdc75180aa698b298264362bab7f00391af427798 (diff)
downloadastro-00e6adb033c882c92fdbb3989b2fc1b78acb3bd7.tar.gz
astro-00e6adb033c882c92fdbb3989b2fc1b78acb3bd7.tar.zst
astro-00e6adb033c882c92fdbb3989b2fc1b78acb3bd7.zip
[ci] format
-rw-r--r--packages/astro/src/core/app/common.ts4
-rw-r--r--packages/astro/src/core/build/generate.ts6
-rw-r--r--packages/astro/src/core/build/plugins/plugin-manifest.ts8
-rw-r--r--packages/astro/src/core/build/plugins/plugin-ssr.ts8
-rw-r--r--packages/astro/src/core/middleware/vite-plugin.ts2
-rw-r--r--packages/astro/src/vite-plugin-astro-server/plugin.ts4
-rw-r--r--packages/astro/src/vite-plugin-astro-server/route.ts2
7 files changed, 19 insertions, 15 deletions
diff --git a/packages/astro/src/core/app/common.ts b/packages/astro/src/core/app/common.ts
index c1b445b52..188a8b599 100644
--- a/packages/astro/src/core/app/common.ts
+++ b/packages/astro/src/core/app/common.ts
@@ -19,7 +19,9 @@ export function deserializeManifest(serializedManifest: SerializedSSRManifest):
return {
// in case user middleware exists, this no-op middleware will be reassigned (see plugin-ssr.ts)
- middleware(_, next) { return next() },
+ middleware(_, next) {
+ return next();
+ },
...serializedManifest,
assets,
componentMetadata,
diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts
index 747f8554e..966d7ad84 100644
--- a/packages/astro/src/core/build/generate.ts
+++ b/packages/astro/src/core/build/generate.ts
@@ -150,7 +150,9 @@ export async function generatePages(opts: StaticBuildOptions, internals: BuildIn
try {
// middleware.mjs is not emitted if there is no user middleware
// in which case the import fails with ERR_MODULE_NOT_FOUND, and we fall back to a no-op middleware
- middleware = await import(new URL('middleware.mjs', baseDirectory).toString()).then(mod => mod.onRequest);
+ middleware = await import(new URL('middleware.mjs', baseDirectory).toString()).then(
+ (mod) => mod.onRequest
+ );
} catch {}
manifest = createBuildManifest(
opts.settings,
@@ -666,6 +668,6 @@ function createBuildManifest(
componentMetadata: internals.componentMetadata,
i18n: i18nManifest,
buildFormat: settings.config.build.format,
- middleware
+ middleware,
};
}
diff --git a/packages/astro/src/core/build/plugins/plugin-manifest.ts b/packages/astro/src/core/build/plugins/plugin-manifest.ts
index 292a9c962..d57eb76f3 100644
--- a/packages/astro/src/core/build/plugins/plugin-manifest.ts
+++ b/packages/astro/src/core/build/plugins/plugin-manifest.ts
@@ -44,15 +44,13 @@ function vitePluginManifest(options: StaticBuildOptions, internals: BuildInterna
if (id === RESOLVED_SSR_MANIFEST_VIRTUAL_MODULE_ID) {
const imports = [
`import { deserializeManifest as _deserializeManifest } from 'astro/app'`,
- `import { _privateSetManifestDontUseThis } from 'astro:ssr-manifest'`
+ `import { _privateSetManifestDontUseThis } from 'astro:ssr-manifest'`,
];
const contents = [
`const manifest = _deserializeManifest('${manifestReplace}');`,
- `_privateSetManifestDontUseThis(manifest);`
- ];
- const exports = [
- `export { manifest }`
+ `_privateSetManifestDontUseThis(manifest);`,
];
+ const exports = [`export { manifest }`];
return [...imports, ...contents, ...exports].join('\n');
}
},
diff --git a/packages/astro/src/core/build/plugins/plugin-ssr.ts b/packages/astro/src/core/build/plugins/plugin-ssr.ts
index 81485d18c..79bfd1ece 100644
--- a/packages/astro/src/core/build/plugins/plugin-ssr.ts
+++ b/packages/astro/src/core/build/plugins/plugin-ssr.ts
@@ -253,14 +253,16 @@ function generateSSRCode(adapter: AstroAdapter, middlewareId: string) {
` middleware`,
`});`,
`const _args = ${adapter.args ? JSON.stringify(adapter.args, null, 4) : 'undefined'};`,
- adapter.exports ? `const _exports = serverEntrypointModule.createExports(_manifest, _args);` : '',
- ...adapter.exports?.map((name) => {
+ adapter.exports
+ ? `const _exports = serverEntrypointModule.createExports(_manifest, _args);`
+ : '',
+ ...(adapter.exports?.map((name) => {
if (name === 'default') {
return `export default _exports.default;`;
} else {
return `export const ${name} = _exports['${name}'];`;
}
- }) ?? [],
+ }) ?? []),
`serverEntrypointModule.start?.(_manifest, _args);`,
];
diff --git a/packages/astro/src/core/middleware/vite-plugin.ts b/packages/astro/src/core/middleware/vite-plugin.ts
index 38f66783f..64c039db7 100644
--- a/packages/astro/src/core/middleware/vite-plugin.ts
+++ b/packages/astro/src/core/middleware/vite-plugin.ts
@@ -53,7 +53,7 @@ export function vitePluginMiddleware({ settings }: { settings: AstroSettings }):
preserveSignature: 'strict',
fileName: 'middleware.mjs',
id,
- })
+ });
}
const preMiddleware = createMiddlewareImports(settings.middlewares.pre, 'pre');
diff --git a/packages/astro/src/vite-plugin-astro-server/plugin.ts b/packages/astro/src/vite-plugin-astro-server/plugin.ts
index 714ca3aac..f1162b7bc 100644
--- a/packages/astro/src/vite-plugin-astro-server/plugin.ts
+++ b/packages/astro/src/vite-plugin-astro-server/plugin.ts
@@ -141,7 +141,7 @@ export function createDevelopmentManifest(settings: AstroSettings): SSRManifest
componentMetadata: new Map(),
i18n: i18nManifest,
middleware(_, next) {
- return next()
- }
+ return next();
+ },
};
}
diff --git a/packages/astro/src/vite-plugin-astro-server/route.ts b/packages/astro/src/vite-plugin-astro-server/route.ts
index f79234a9d..b4b181124 100644
--- a/packages/astro/src/vite-plugin-astro-server/route.ts
+++ b/packages/astro/src/vite-plugin-astro-server/route.ts
@@ -277,7 +277,7 @@ export async function handleRoute({
pathname,
request,
route,
- middleware
+ middleware,
};
mod = options.preload;