diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index b4b8831a24..390362055a 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -97,7 +97,7 @@ class AstroBuilder { route, routeCache: this.routeCache, viteServer, - }) + }), }; return; } @@ -123,7 +123,7 @@ class AstroBuilder { route, routeCache: this.routeCache, viteServer, - }) + }), }; }) ); @@ -171,13 +171,13 @@ class AstroBuilder { allPages, pageNames, routeCache: this.routeCache, - viteServer + viteServer, }), rollupPluginAstroBuildCSS({ astroPageStyleMap, astroStyleMap, chunkToReferenceIdMap, - pureCSSChunks + pureCSSChunks, }), ...(viteConfig.plugins || []), ], @@ -202,7 +202,7 @@ class AstroBuilder { timer.sitemapStart = performance.now(); if (this.config.buildOptions.sitemap && this.config.buildOptions.site) { const sitemapStart = performance.now(); - const sitemap = generateSitemap(pageNames.map(pageName => new URL(`/${pageName}`, this.config.buildOptions.site).href)); + const sitemap = generateSitemap(pageNames.map((pageName) => new URL(`/${pageName}`, this.config.buildOptions.site).href)); const sitemapPath = new URL('./sitemap.xml', this.config.dist); await fs.promises.mkdir(new URL('./', sitemapPath), { recursive: true }); await fs.promises.writeFile(sitemapPath, sitemap, 'utf8'); diff --git a/packages/astro/src/core/build/types.d.ts b/packages/astro/src/core/build/types.d.ts index c165f9ce3d..e1b317859e 100644 --- a/packages/astro/src/core/build/types.d.ts +++ b/packages/astro/src/core/build/types.d.ts @@ -7,4 +7,3 @@ export interface PageBuildData { route: RouteData; } export type AllPagesData = Record; - diff --git a/packages/astro/src/core/ssr/index.ts b/packages/astro/src/core/ssr/index.ts index 1a472b8089..4a634367c3 100644 --- a/packages/astro/src/core/ssr/index.ts +++ b/packages/astro/src/core/ssr/index.ts @@ -73,7 +73,7 @@ async function resolveRenderers(viteServer: vite.ViteDevServer, astroConfig: Ast } async function errorHandler(e: unknown, viteServer: vite.ViteDevServer, filePath: URL) { - if(e instanceof Error) { + if (e instanceof Error) { viteServer.ssrFixStacktrace(e); } @@ -191,7 +191,7 @@ export async function render(renderers: Renderer[], mod: ComponentInstance, ssrO }, _metadata: { renderers, - pathname + pathname, }, }; @@ -217,7 +217,7 @@ export async function render(renderers: Renderer[], mod: ComponentInstance, ssrO attrs: { rel: 'stylesheet', href, - 'data-astro-injected': true + 'data-astro-injected': true, }, injectTo: 'head', }); @@ -237,9 +237,9 @@ export async function render(renderers: Renderer[], mod: ComponentInstance, ssrO export async function ssr(ssrOpts: SSROptions): Promise { try { const [renderers, mod] = await preload(ssrOpts); - return render(renderers, mod, ssrOpts); + return render(renderers, mod, ssrOpts); } catch (e: unknown) { await errorHandler(e, ssrOpts.viteServer, ssrOpts.filePath); throw e; } -} \ No newline at end of file +} diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index b43a04700c..3f29a32ba7 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -74,4 +74,4 @@ export function resolveDependency(dep: string, astroConfig: AstroConfig) { export function viteifyPath(pathname: string): string { return `/@fs${pathname}`; -} \ No newline at end of file +} diff --git a/packages/astro/src/runtime/server/index.ts b/packages/astro/src/runtime/server/index.ts index dd90430973..5e191d4068 100644 --- a/packages/astro/src/runtime/server/index.ts +++ b/packages/astro/src/runtime/server/index.ts @@ -272,16 +272,20 @@ export async function renderPage(result: SSRResult, Component: AstroComponentFac const template = await renderToString(result, Component, props, children); const styles = Array.from(result.styles) .filter(uniqueElements) - .map((style) => renderElement('style', { - ...style, - props: { ...style.props, 'astro-style': true } - })); + .map((style) => + renderElement('style', { + ...style, + props: { ...style.props, 'astro-style': true }, + }) + ); const scripts = Array.from(result.scripts) .filter(uniqueElements) - .map((script, i) => renderElement('script', { - ...script, - props: { ...script.props, 'astro-script': result._metadata.pathname + '/script-' + i } - })); + .map((script, i) => + renderElement('script', { + ...script, + props: { ...script.props, 'astro-script': result._metadata.pathname + '/script-' + i }, + }) + ); return template.replace('', styles.join('\n') + scripts.join('\n') + ''); } diff --git a/packages/astro/src/runtime/server/metadata.ts b/packages/astro/src/runtime/server/metadata.ts index 4dcfc73c99..96a99ab223 100644 --- a/packages/astro/src/runtime/server/metadata.ts +++ b/packages/astro/src/runtime/server/metadata.ts @@ -29,16 +29,16 @@ export class Metadata { // Recursively collect all of the hydrated components' paths. getAllHydratedComponentPaths(): Set { const paths = new Set(); - for(const component of this.hydratedComponents) { + for (const component of this.hydratedComponents) { const path = this.getPath(component); - if(path) { + if (path) { paths.add(path); } } - for(const {module: mod} of this.modules) { - if(typeof mod.$$metadata !== 'undefined') { - for(const path of mod.$$metadata.getAllHydratedComponentPaths()) { + for (const { module: mod } of this.modules) { + if (typeof mod.$$metadata !== 'undefined') { + for (const path of mod.$$metadata.getAllHydratedComponentPaths()) { paths.add(path); } } diff --git a/packages/astro/src/vite-plugin-build-css/index.ts b/packages/astro/src/vite-plugin-build-css/index.ts index e54c04bedb..192ec01946 100644 --- a/packages/astro/src/vite-plugin-build-css/index.ts +++ b/packages/astro/src/vite-plugin-build-css/index.ts @@ -1,4 +1,3 @@ - import type { ResolveIdHook, LoadHook, RenderedChunk } from 'rollup'; import type { Plugin as VitePlugin } from 'vite'; @@ -7,7 +6,6 @@ import { getViteResolve, getViteLoad } from './resolve.js'; import { getViteTransform, TransformHook } from '../vite-plugin-astro/styles.js'; import * as path from 'path'; - const PLUGIN_NAME = '@astrojs/rollup-plugin-build-css'; // This is a virtual module that represents the .astro