From 5dca44391343ef34bc8d1b1c4a3463964930a7c7 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Fri, 25 Feb 2022 17:55:59 -0600 Subject: [PATCH] feat: remove `layouts` from config, Vite plugin --- packages/astro/src/core/config.ts | 9 --------- packages/astro/src/runtime/server/index.ts | 1 - packages/astro/src/vite-plugin-astro/compile.ts | 4 ---- 3 files changed, 14 deletions(-) diff --git a/packages/astro/src/core/config.ts b/packages/astro/src/core/config.ts index 41898fe281d2..05728527f672 100644 --- a/packages/astro/src/core/config.ts +++ b/packages/astro/src/core/config.ts @@ -26,11 +26,6 @@ export const AstroConfigSchema = z.object({ .optional() .default('./src/pages') .transform((val) => new URL(val)), - layouts: z - .string() - .optional() - .default('./src/layouts') - .transform((val) => new URL(val)), public: z .string() .optional() @@ -101,10 +96,6 @@ export async function validateConfig(userConfig: any, root: string): Promise new URL(addTrailingSlash(val), fileProtocolRoot)), - layouts: z - .string() - .default('./src/layouts') - .transform((val) => new URL(addTrailingSlash(val), fileProtocolRoot)), public: z .string() .default('./public') diff --git a/packages/astro/src/runtime/server/index.ts b/packages/astro/src/runtime/server/index.ts index bd0d3d20885b..1a246baa5fda 100644 --- a/packages/astro/src/runtime/server/index.ts +++ b/packages/astro/src/runtime/server/index.ts @@ -436,7 +436,6 @@ export async function renderHead(result: SSRResult) { .filter(uniqueElements) .map((style) => { const styleChildren = !result._metadata.legacyBuild ? '' : style.children; - return renderElement('style', { children: styleChildren, props: { ...style.props, 'astro-style': true }, diff --git a/packages/astro/src/vite-plugin-astro/compile.ts b/packages/astro/src/vite-plugin-astro/compile.ts index d584dc296c5d..7fd4ebe00a67 100644 --- a/packages/astro/src/vite-plugin-astro/compile.ts +++ b/packages/astro/src/vite-plugin-astro/compile.ts @@ -33,11 +33,8 @@ function safelyReplaceImportPlaceholder(code: string) { const configCache = new WeakMap(); async function compile(config: AstroConfig, filename: string, source: string, viteTransform: TransformHook, opts: { ssr: boolean }): Promise { - // pages and layouts should be transformed as full documents (implicit etc) - // everything else is treated as a fragment const filenameURL = new URL(`file://${filename}`); const normalizedID = fileURLToPath(filenameURL); - const isPage = normalizedID.startsWith(fileURLToPath(config.pages)) || normalizedID.startsWith(fileURLToPath(config.layouts)); const pathname = filenameURL.pathname.substr(config.projectRoot.pathname.length - 1); let rawCSSDeps = new Set(); @@ -47,7 +44,6 @@ async function compile(config: AstroConfig, filename: string, source: string, vi // use `sourcemap: "both"` so that sourcemap is included in the code // result passed to esbuild, but also available in the catch handler. const transformResult = await transform(source, { - as: isPage ? 'document' : 'fragment', pathname, projectRoot: config.projectRoot.toString(), site: config.buildOptions.site,