Skip to content

Commit

Permalink
feat: remove layouts from config, Vite plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate Moore committed Feb 25, 2022
1 parent 07399a6 commit 5dca443
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 14 deletions.
9 changes: 0 additions & 9 deletions packages/astro/src/core/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -101,10 +96,6 @@ export async function validateConfig(userConfig: any, root: string): Promise<Ast
.string()
.default('./src/pages')
.transform((val) => new URL(addTrailingSlash(val), fileProtocolRoot)),
layouts: z
.string()
.default('./src/layouts')
.transform((val) => new URL(addTrailingSlash(val), fileProtocolRoot)),
public: z
.string()
.default('./public')
Expand Down
1 change: 0 additions & 1 deletion packages/astro/src/runtime/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
4 changes: 0 additions & 4 deletions packages/astro/src/vite-plugin-astro/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ function safelyReplaceImportPlaceholder(code: string) {
const configCache = new WeakMap<AstroConfig, CompilationCache>();

async function compile(config: AstroConfig, filename: string, source: string, viteTransform: TransformHook, opts: { ssr: boolean }): Promise<CompileResult> {
// pages and layouts should be transformed as full documents (implicit <head> <body> 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<string>();
Expand All @@ -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,
Expand Down

0 comments on commit 5dca443

Please sign in to comment.