diff --git a/examples/with-content/src/content/blog/first-post.md b/examples/with-content/src/content/blog/first-post.md index 33b844032f78..eb5e250f8263 100644 --- a/examples/with-content/src/content/blog/first-post.md +++ b/examples/with-content/src/content/blog/first-post.md @@ -1,8 +1,8 @@ --- -title: "First post" -description: "Lorem ipsum dolor sit amet" -pubDate: "Jul 08 2022" -heroImage: "/placeholder-hero.jpg" +title: 'First post' +description: 'Lorem ipsum dolor sit amet' +pubDate: 'Jul 08 2022' +heroImage: '/placeholder-hero.jpg' --- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. diff --git a/examples/with-content/src/content/blog/markdown-style-guide.md b/examples/with-content/src/content/blog/markdown-style-guide.md index 1f221fb91dba..bb7bb2daabd6 100644 --- a/examples/with-content/src/content/blog/markdown-style-guide.md +++ b/examples/with-content/src/content/blog/markdown-style-guide.md @@ -1,8 +1,8 @@ --- -title: "Markdown Style Guide" -description: "Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro." -pubDate: "Jul 01 2022" -heroImage: "/placeholder-hero.jpg" +title: 'Markdown Style Guide' +description: 'Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro.' +pubDate: 'Jul 01 2022' +heroImage: '/placeholder-hero.jpg' --- Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro. @@ -12,10 +12,15 @@ Here is a sample of some basic Markdown syntax that can be used when writing Mar The following HTML `

`—`

` elements represent six levels of section headings. `

` is the highest section level while `

` is the lowest. # H1 + ## H2 + ### H3 + #### H4 + ##### H5 + ###### H6 ## Paragraph @@ -35,7 +40,7 @@ The blockquote element represents content that is quoted from another source, op #### Blockquote without attribution > Tiam, ad mint andaepu dandae nostion secatur sequo quae. -> **Note** that you can use *Markdown syntax* within a blockquote. +> **Note** that you can use _Markdown syntax_ within a blockquote. #### Blockquote with attribution @@ -47,21 +52,21 @@ The blockquote element represents content that is quoted from another source, op ## Tables | Italics | Bold | Code | -| -------- | -------- | ------ | -| *italics* | **bold** | `code` | +| --------- | -------- | ------ | +| _italics_ | **bold** | `code` | ## Code Blocks ```html - + - - - Example HTML5 Document - - -

Test

- + + + Example HTML5 Document + + +

Test

+ ``` @@ -75,19 +80,19 @@ The blockquote element represents content that is quoted from another source, op #### Unordered List -* List item -* Another item -* And another item +- List item +- Another item +- And another item #### Nested list -* Fruit - * Apple - * Orange - * Banana -* Dairy - * Milk - * Cheese +- Fruit + - Apple + - Orange + - Banana +- Dairy + - Milk + - Cheese ## Other Elements — abbr, sub, sup, kbd, mark diff --git a/examples/with-content/src/content/blog/second-post.md b/examples/with-content/src/content/blog/second-post.md index 1bd5ee4658a4..b5a0679383c4 100644 --- a/examples/with-content/src/content/blog/second-post.md +++ b/examples/with-content/src/content/blog/second-post.md @@ -1,8 +1,8 @@ --- -title: "Second post" -description: "Lorem ipsum dolor sit amet" -pubDate: "Jul 22 2022" -heroImage: "/placeholder-hero.jpg" +title: 'Second post' +description: 'Lorem ipsum dolor sit amet' +pubDate: 'Jul 22 2022' +heroImage: '/placeholder-hero.jpg' --- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. diff --git a/examples/with-content/src/content/blog/third-post.md b/examples/with-content/src/content/blog/third-post.md index d7f1f24b0408..a2bc343bd7de 100644 --- a/examples/with-content/src/content/blog/third-post.md +++ b/examples/with-content/src/content/blog/third-post.md @@ -1,8 +1,8 @@ --- -title: "Third post" -description: "Lorem ipsum dolor sit amet" -pubDate: "Jul 15 2022" -heroImage: "/placeholder-hero.jpg" +title: 'Third post' +description: 'Lorem ipsum dolor sit amet' +pubDate: 'Jul 15 2022' +heroImage: '/placeholder-hero.jpg' --- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. diff --git a/examples/with-content/src/content/types.generated.d.ts b/examples/with-content/src/content/types.generated.d.ts index af803d2cf722..7f0f0df84968 100644 --- a/examples/with-content/src/content/types.generated.d.ts +++ b/examples/with-content/src/content/types.generated.d.ts @@ -42,45 +42,44 @@ declare module 'astro:content' { }; const entryMap: { - "blog": { -"first-post.md": { - id: "first-post.md", - slug: "first-post", - body: string, - collection: "blog", - data: InferEntrySchema<"blog"> -}, -"markdown-style-guide.md": { - id: "markdown-style-guide.md", - slug: "markdown-style-guide", - body: string, - collection: "blog", - data: InferEntrySchema<"blog"> -}, -"second-post.md": { - id: "second-post.md", - slug: "second-post", - body: string, - collection: "blog", - data: InferEntrySchema<"blog"> -}, -"third-post.md": { - id: "third-post.md", - slug: "third-post", - body: string, - collection: "blog", - data: InferEntrySchema<"blog"> -}, -"using-mdx.mdx": { - id: "using-mdx.mdx", - slug: "using-mdx", - body: string, - collection: "blog", - data: InferEntrySchema<"blog"> -}, -}, - + blog: { + 'first-post.md': { + id: 'first-post.md'; + slug: 'first-post'; + body: string; + collection: 'blog'; + data: InferEntrySchema<'blog'>; + }; + 'markdown-style-guide.md': { + id: 'markdown-style-guide.md'; + slug: 'markdown-style-guide'; + body: string; + collection: 'blog'; + data: InferEntrySchema<'blog'>; + }; + 'second-post.md': { + id: 'second-post.md'; + slug: 'second-post'; + body: string; + collection: 'blog'; + data: InferEntrySchema<'blog'>; + }; + 'third-post.md': { + id: 'third-post.md'; + slug: 'third-post'; + body: string; + collection: 'blog'; + data: InferEntrySchema<'blog'>; + }; + 'using-mdx.mdx': { + id: 'using-mdx.mdx'; + slug: 'using-mdx'; + body: string; + collection: 'blog'; + data: InferEntrySchema<'blog'>; + }; + }; }; - type ContentConfig = typeof import("./config"); + type ContentConfig = typeof import('./config'); } diff --git a/examples/with-content/src/layouts/BlogPost.astro b/examples/with-content/src/layouts/BlogPost.astro index c2527082af0d..ba3ea70182c9 100644 --- a/examples/with-content/src/layouts/BlogPost.astro +++ b/examples/with-content/src/layouts/BlogPost.astro @@ -6,9 +6,7 @@ import type { CollectionEntry } from 'astro:content'; type Props = CollectionEntry<'blog'>['data']; -const { - title, description, pubDate, updatedDate, heroImage, -} = Astro.props; +const { title, description, pubDate, updatedDate, heroImage } = Astro.props; --- diff --git a/examples/with-content/src/pages/about.md b/examples/with-content/src/pages/about.md index 2aeb6562ede6..f8d52b862b1a 100644 --- a/examples/with-content/src/pages/about.md +++ b/examples/with-content/src/pages/about.md @@ -1,9 +1,9 @@ --- -layout: "../layouts/BlogPost.astro" -title: "About Me" -description: "Lorem ipsum dolor sit amet" -updatedDate: "August 08 2022" -heroImage: "/placeholder-about.jpg" +layout: '../layouts/BlogPost.astro' +title: 'About Me' +description: 'Lorem ipsum dolor sit amet' +updatedDate: 'August 08 2022' +heroImage: '/placeholder-about.jpg' --- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. @@ -14,4 +14,4 @@ Mollis nunc sed id semper risus in. Convallis a cras semper auctor neque. Diam s Mattis ullamcorper velit sed ullamcorper morbi tincidunt. Tortor posuere ac ut consequat semper viverra. Tellus mauris a diam maecenas sed enim ut sem viverra. Venenatis urna cursus eget nunc scelerisque viverra mauris in. Arcu ac tortor dignissim convallis aenean et tortor at. Curabitur gravida arcu ac tortor dignissim convallis aenean et tortor. Egestas tellus rutrum tellus pellentesque eu. Fusce ut placerat orci nulla pellentesque dignissim enim sit amet. Ut enim blandit volutpat maecenas volutpat blandit aliquam etiam. Id donec ultrices tincidunt arcu. Id cursus metus aliquam eleifend mi. -Tempus quam pellentesque nec nam aliquam sem. Risus at ultrices mi tempus imperdiet. Id porta nibh venenatis cras sed felis eget velit. Ipsum a arcu cursus vitae. Facilisis magna etiam tempor orci eu lobortis elementum. Tincidunt dui ut ornare lectus sit. Quisque non tellus orci ac. Blandit libero volutpat sed cras. Nec tincidunt praesent semper feugiat nibh sed pulvinar proin gravida. Egestas integer eget aliquet nibh praesent tristique magna. \ No newline at end of file +Tempus quam pellentesque nec nam aliquam sem. Risus at ultrices mi tempus imperdiet. Id porta nibh venenatis cras sed felis eget velit. Ipsum a arcu cursus vitae. Facilisis magna etiam tempor orci eu lobortis elementum. Tincidunt dui ut ornare lectus sit. Quisque non tellus orci ac. Blandit libero volutpat sed cras. Nec tincidunt praesent semper feugiat nibh sed pulvinar proin gravida. Egestas integer eget aliquet nibh praesent tristique magna. diff --git a/examples/with-content/src/pages/blog/[...slug].astro b/examples/with-content/src/pages/blog/[...slug].astro index c8e86c487c79..0d656a1534f0 100644 --- a/examples/with-content/src/pages/blog/[...slug].astro +++ b/examples/with-content/src/pages/blog/[...slug].astro @@ -1,10 +1,10 @@ --- -import { CollectionEntry, getCollection } from "astro:content"; -import BlogPost from "../../layouts/BlogPost.astro"; +import { CollectionEntry, getCollection } from 'astro:content'; +import BlogPost from '../../layouts/BlogPost.astro'; export async function getStaticPaths() { const posts = await getCollection('blog'); - return posts.map(post => ({ + return posts.map((post) => ({ params: { slug: post.slug }, props: post, })); diff --git a/examples/with-content/src/pages/blog/index.astro b/examples/with-content/src/pages/blog/index.astro index e4f769f8a242..c46f23dea0eb 100644 --- a/examples/with-content/src/pages/blog/index.astro +++ b/examples/with-content/src/pages/blog/index.astro @@ -7,7 +7,7 @@ import { getCollection } from 'astro:content'; const posts = (await getCollection('blog')).sort( (a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf() -) +); --- @@ -37,18 +37,20 @@ const posts = (await getCollection('blog')).sort(
    - {posts.map((post) => ( -
  • - - {post.data.title} -
  • - ))} + { + posts.map((post) => ( +
  • + + {post.data.title} +
  • + )) + }
diff --git a/packages/astro/src/content/index.ts b/packages/astro/src/content/index.ts index 81c8b2d70870..7fc96be290e6 100644 --- a/packages/astro/src/content/index.ts +++ b/packages/astro/src/content/index.ts @@ -1,6 +1,6 @@ export { - astroDelayedAssetPlugin, astroBundleDelayedAssetPlugin, + astroDelayedAssetPlugin, } from './vite-plugin-content-assets.js'; export { astroContentServerPlugin } from './vite-plugin-content-server.js'; export { astroContentVirtualModPlugin } from './vite-plugin-content-virtual-mod.js'; diff --git a/packages/astro/src/content/internal.ts b/packages/astro/src/content/internal.ts index f35307bd6767..64c5bbd828dd 100644 --- a/packages/astro/src/content/internal.ts +++ b/packages/astro/src/content/internal.ts @@ -4,9 +4,9 @@ import { createComponent, createHeadAndContent, renderComponent, + renderStyleElement, renderTemplate, renderUniqueStylesheet, - renderStyleElement, unescapeHTML, } from '../runtime/server/index.js'; diff --git a/packages/astro/src/content/template/types.generated.mjs b/packages/astro/src/content/template/types.generated.mjs index b8715d81188a..799e780b4dfe 100644 --- a/packages/astro/src/content/template/types.generated.mjs +++ b/packages/astro/src/content/template/types.generated.mjs @@ -1,8 +1,8 @@ // astro-head-inject import { + createCollectionToGlobResultMap, createGetCollection, createGetEntry, - createCollectionToGlobResultMap, } from 'astro/content/internal'; export { z } from 'astro/zod'; diff --git a/packages/astro/src/content/types-generator.ts b/packages/astro/src/content/types-generator.ts index ffe3caefddf8..5162cbcd5a03 100644 --- a/packages/astro/src/content/types-generator.ts +++ b/packages/astro/src/content/types-generator.ts @@ -1,14 +1,14 @@ -import { normalizePath } from 'vite'; import glob from 'fast-glob'; +import { cyan } from 'kleur/colors'; import fsMod from 'node:fs'; import * as path from 'node:path'; -import { cyan } from 'kleur/colors'; -import { info, LogOptions, warn } from '../core/logger/core.js'; +import { fileURLToPath, pathToFileURL } from 'node:url'; +import { normalizePath } from 'vite'; import type { AstroSettings } from '../@types/astro.js'; +import { info, LogOptions, warn } from '../core/logger/core.js'; import { appendForwardSlash, isRelativePath } from '../core/path.js'; import { contentFileExts, CONTENT_TYPES_FILE } from './consts.js'; -import { fileURLToPath, pathToFileURL } from 'node:url'; -import { ContentConfig, loadContentConfig, ContentPaths, ContentObservable } from './utils.js'; +import { ContentConfig, ContentObservable, ContentPaths, loadContentConfig } from './utils.js'; type ChokidarEvent = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir'; type RawContentEvent = { name: ChokidarEvent; entry: string }; diff --git a/packages/astro/src/content/utils.ts b/packages/astro/src/content/utils.ts index 15458c912b04..dcb0a63ca497 100644 --- a/packages/astro/src/content/utils.ts +++ b/packages/astro/src/content/utils.ts @@ -1,11 +1,11 @@ -import type fsMod from 'node:fs'; import matter from 'gray-matter'; -import { z } from 'zod'; +import type fsMod from 'node:fs'; +import { fileURLToPath } from 'node:url'; import { createServer, ErrorPayload as ViteErrorPayload, ViteDevServer } from 'vite'; +import { z } from 'zod'; import { AstroSettings } from '../@types/astro.js'; -import { astroContentVirtualModPlugin } from './vite-plugin-content-virtual-mod.js'; -import { fileURLToPath } from 'node:url'; import { AstroError, AstroErrorData } from '../core/errors/index.js'; +import { astroContentVirtualModPlugin } from './vite-plugin-content-virtual-mod.js'; export const collectionConfigParser = z.object({ schema: z.any().optional(), diff --git a/packages/astro/src/content/vite-plugin-content-assets.ts b/packages/astro/src/content/vite-plugin-content-assets.ts index 482edae99e3e..71a220c86b54 100644 --- a/packages/astro/src/content/vite-plugin-content-assets.ts +++ b/packages/astro/src/content/vite-plugin-content-assets.ts @@ -1,10 +1,10 @@ +import { pathToFileURL } from 'url'; import type { Plugin } from 'vite'; -import type { ModuleLoader } from '../core/module-loader/loader.js'; import { moduleIsTopLevelPage, walkParentInfos } from '../core/build/graph.js'; import { BuildInternals, getPageDataByViteID } from '../core/build/internal.js'; -import { getStylesForURL } from '../core/render/dev/css.js'; -import { pathToFileURL } from 'url'; +import type { ModuleLoader } from '../core/module-loader/loader.js'; import { createViteLoader } from '../core/module-loader/vite.js'; +import { getStylesForURL } from '../core/render/dev/css.js'; import { contentFileExts, DELAYED_ASSET_FLAG, diff --git a/packages/astro/src/content/vite-plugin-content-server.ts b/packages/astro/src/content/vite-plugin-content-server.ts index e347c807a363..5df38b742a95 100644 --- a/packages/astro/src/content/vite-plugin-content-server.ts +++ b/packages/astro/src/content/vite-plugin-content-server.ts @@ -1,28 +1,28 @@ -import type { Plugin } from 'vite'; -import fsMod from 'node:fs'; +import * as devalue from 'devalue'; import { cyan } from 'kleur/colors'; -import { info, LogOptions } from '../core/logger/core.js'; +import fsMod from 'node:fs'; +import { pathToFileURL } from 'node:url'; +import type { Plugin } from 'vite'; import type { AstroSettings } from '../@types/astro.js'; -import { contentFileExts, CONTENT_FLAG } from './consts.js'; +import { info, LogOptions } from '../core/logger/core.js'; +import { prependForwardSlash } from '../core/path.js'; import { escapeViteEnvReferences } from '../vite-plugin-utils/index.js'; -import { - getEntryData, - getEntrySlug, - getContentPaths, - contentObservable, - parseFrontmatter, - ContentPaths, - ContentConfig, -} from './utils.js'; -import * as devalue from 'devalue'; +import { contentFileExts, CONTENT_FLAG } from './consts.js'; import { createContentTypesGenerator, GenerateContentTypes, getEntryInfo, getEntryType, } from './types-generator.js'; -import { pathToFileURL } from 'node:url'; -import { prependForwardSlash } from '../core/path.js'; +import { + ContentConfig, + contentObservable, + ContentPaths, + getContentPaths, + getEntryData, + getEntrySlug, + parseFrontmatter, +} from './utils.js'; interface AstroContentServerPluginParams { fs: typeof fsMod; diff --git a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts index 8c8bc5441883..b2f38bee5228 100644 --- a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts +++ b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts @@ -1,7 +1,7 @@ -import type { Plugin } from 'vite'; -import { normalizePath } from 'vite'; import fsMod from 'node:fs'; import * as path from 'node:path'; +import type { Plugin } from 'vite'; +import { normalizePath } from 'vite'; import type { AstroSettings } from '../@types/astro.js'; import { appendForwardSlash, prependForwardSlash } from '../core/path.js'; import { contentFileExts, CONTENT_FILE, VIRTUAL_MODULE_ID } from './consts.js'; diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index 22d1ee0284f0..337730747ea3 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -5,6 +5,7 @@ import { bgGreen, bgMagenta, black, dim } from 'kleur/colors'; import path from 'path'; import { fileURLToPath } from 'url'; import * as vite from 'vite'; +import { astroBundleDelayedAssetPlugin } from '../../content/index.js'; import { BuildInternals, createBuildInternals, @@ -14,7 +15,6 @@ import { emptyDir, removeDir } from '../../core/fs/index.js'; import { prependForwardSlash } from '../../core/path.js'; import { isModeServerWithNoAdapter } from '../../core/util.js'; import { runHookBuildSetup } from '../../integrations/index.js'; -import { astroBundleDelayedAssetPlugin } from '../../content/index.js'; import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js'; import { AstroError, AstroErrorData } from '../errors/index.js'; import { info } from '../logger/core.js'; diff --git a/packages/astro/src/core/build/vite-plugin-css.ts b/packages/astro/src/core/build/vite-plugin-css.ts index d4ddbaf16f75..68012948aadf 100644 --- a/packages/astro/src/core/build/vite-plugin-css.ts +++ b/packages/astro/src/core/build/vite-plugin-css.ts @@ -1,13 +1,14 @@ -import type { GetModuleInfo } from 'rollup'; -import type { BuildInternals } from './internal'; -import type { PageBuildData, StaticBuildOptions } from './types'; import * as crypto from 'node:crypto'; import * as npath from 'node:path'; +import type { GetModuleInfo } from 'rollup'; import { Plugin as VitePlugin, ResolvedConfig, transformWithEsbuild } from 'vite'; import { isCSSRequest } from '../render/util.js'; +import type { BuildInternals } from './internal'; +import type { PageBuildData, StaticBuildOptions } from './types'; +import { DELAYED_ASSET_FLAG } from '../../content/consts.js'; import * as assetName from './css-asset-name.js'; -import { getTopLevelPages, moduleIsTopLevelPage, walkParentInfos } from './graph.js'; +import { moduleIsTopLevelPage, walkParentInfos } from './graph.js'; import { eachPageData, getPageDataByViteID, @@ -15,7 +16,6 @@ import { getPageDatasByHoistedScriptId, isHoistedScript, } from './internal.js'; -import { DELAYED_ASSET_FLAG } from '../../content/consts.js'; interface PluginOptions { internals: BuildInternals; diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts index 57130fa4f193..efa1251e5221 100644 --- a/packages/astro/src/core/create-vite.ts +++ b/packages/astro/src/core/create-vite.ts @@ -5,6 +5,11 @@ import nodeFs from 'fs'; import { fileURLToPath } from 'url'; import * as vite from 'vite'; import { crawlFrameworkPkgs } from 'vitefu'; +import { + astroContentServerPlugin, + astroContentVirtualModPlugin, + astroDelayedAssetPlugin, +} from '../content/index.js'; import astroPostprocessVitePlugin from '../vite-plugin-astro-postprocess/index.js'; import { vitePluginAstroServer } from '../vite-plugin-astro-server/index.js'; import astroVitePlugin from '../vite-plugin-astro/index.js'; @@ -22,11 +27,6 @@ import astroScriptsPlugin from '../vite-plugin-scripts/index.js'; import astroScriptsPageSSRPlugin from '../vite-plugin-scripts/page-ssr.js'; import { createCustomViteLogger } from './errors/dev/index.js'; import { resolveDependency } from './util.js'; -import { - astroContentServerPlugin, - astroContentVirtualModPlugin, - astroDelayedAssetPlugin, -} from '../content/index.js'; interface CreateViteOptions { settings: AstroSettings; diff --git a/packages/astro/src/core/render/dev/vite.ts b/packages/astro/src/core/render/dev/vite.ts index 86659f85aa58..159f7db99819 100644 --- a/packages/astro/src/core/render/dev/vite.ts +++ b/packages/astro/src/core/render/dev/vite.ts @@ -1,8 +1,8 @@ import type { ModuleLoader, ModuleNode } from '../../module-loader/index'; import npath from 'path'; -import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from '../../constants.js'; import { DELAYED_ASSET_FLAG } from '../../../content/consts.js'; +import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from '../../constants.js'; import { unwrapId } from '../../util.js'; import { STYLE_EXTENSIONS } from '../util.js'; diff --git a/packages/astro/src/core/render/result.ts b/packages/astro/src/core/render/result.ts index 2a40990740da..1524051643e7 100644 --- a/packages/astro/src/core/render/result.ts +++ b/packages/astro/src/core/render/result.ts @@ -100,9 +100,7 @@ class Slots { ); } else if (args.length > 0) { const slotValue = this.#slots[name]; - const component = typeof slotValue === 'function' ? - await slotValue() : - await slotValue; + const component = typeof slotValue === 'function' ? await slotValue() : await slotValue; // Astro const expression = getFunctionExpression(component); diff --git a/packages/astro/src/runtime/server/astro-component.ts b/packages/astro/src/runtime/server/astro-component.ts index bda81ba3f279..933a69a9a67a 100644 --- a/packages/astro/src/runtime/server/astro-component.ts +++ b/packages/astro/src/runtime/server/astro-component.ts @@ -20,7 +20,10 @@ function createComponentWithOptions(opts: CreateComponentOptions) { return cb; } // Used in creating the component. aka the main export. -export function createComponent(arg1: AstroComponentFactory | CreateComponentOptions, moduleId?: string) { +export function createComponent( + arg1: AstroComponentFactory | CreateComponentOptions, + moduleId?: string +) { if (typeof arg1 === 'function') { return baseCreateComponent(arg1, moduleId); } else { diff --git a/packages/astro/src/runtime/server/index.ts b/packages/astro/src/runtime/server/index.ts index b4f402638c5f..07b79675895e 100644 --- a/packages/astro/src/runtime/server/index.ts +++ b/packages/astro/src/runtime/server/index.ts @@ -17,11 +17,11 @@ export { renderHTMLElement, renderPage, renderSlot, + renderStyleElement, renderTemplate as render, renderTemplate, renderToString, renderUniqueStylesheet, - renderStyleElement, stringifyChunk, voidElementNames, } from './render/index.js'; diff --git a/packages/astro/src/runtime/server/render/astro/instance.ts b/packages/astro/src/runtime/server/render/astro/instance.ts index dfe855475297..d290abcc1640 100644 --- a/packages/astro/src/runtime/server/render/astro/instance.ts +++ b/packages/astro/src/runtime/server/render/astro/instance.ts @@ -33,7 +33,7 @@ export class AstroComponentInstance { this.props = props; this.factory = factory; this.slotValues = {}; - for(const name in slots) { + for (const name in slots) { this.slotValues[name] = slots[name](); } } diff --git a/packages/astro/src/runtime/server/render/index.ts b/packages/astro/src/runtime/server/render/index.ts index 946d6d2415fa..31882c52ae76 100644 --- a/packages/astro/src/runtime/server/render/index.ts +++ b/packages/astro/src/runtime/server/render/index.ts @@ -2,7 +2,7 @@ export type { AstroComponentFactory, AstroComponentInstance, ComponentSlots as AstroComponentSlots, - ComponentSlotsWithValues as AstroComponentSlotsWithValues + ComponentSlotsWithValues as AstroComponentSlotsWithValues, } from './astro/index'; export { createHeadAndContent, @@ -16,7 +16,6 @@ export { renderHTMLElement } from './dom.js'; export { maybeRenderHead, renderHead } from './head.js'; export { renderPage } from './page.js'; export { renderSlot } from './slot.js'; -export { renderUniqueStylesheet, renderStyleElement } from './tags.js'; +export { renderStyleElement, renderUniqueStylesheet } from './tags.js'; export type { RenderInstruction } from './types'; export { addAttribute, defineScriptVars, voidElementNames } from './util.js'; - diff --git a/packages/astro/src/runtime/server/render/tags.ts b/packages/astro/src/runtime/server/render/tags.ts index 61b31237d198..a29886ca5e35 100644 --- a/packages/astro/src/runtime/server/render/tags.ts +++ b/packages/astro/src/runtime/server/render/tags.ts @@ -6,8 +6,8 @@ const stylesheetRel = 'stylesheet'; export function renderStyleElement(children: string) { return renderElement('style', { props: {}, - children - }) + children, + }); } export function renderStylesheet({ href }: { href: string }) { diff --git a/packages/astro/src/vite-plugin-scripts/page-ssr.ts b/packages/astro/src/vite-plugin-scripts/page-ssr.ts index cb976cb96424..b6bb0456e81e 100644 --- a/packages/astro/src/vite-plugin-scripts/page-ssr.ts +++ b/packages/astro/src/vite-plugin-scripts/page-ssr.ts @@ -1,9 +1,9 @@ +import MagicString from 'magic-string'; import { Plugin as VitePlugin } from 'vite'; import { AstroSettings } from '../@types/astro.js'; -import { PAGE_SSR_SCRIPT_ID } from './index.js'; -import MagicString from 'magic-string'; import { isPage } from '../core/util.js'; import { normalizeFilename } from '../vite-plugin-utils/index.js'; +import { PAGE_SSR_SCRIPT_ID } from './index.js'; export default function astroScriptsPostPlugin({ settings, diff --git a/packages/astro/test/units/test-utils.js b/packages/astro/test/units/test-utils.js index c2f5204994a5..38c25d16ce06 100644 --- a/packages/astro/test/units/test-utils.js +++ b/packages/astro/test/units/test-utils.js @@ -40,10 +40,10 @@ class VirtualVolumeWithFallback extends VirtualVolume { readFile(p, ...args) { const cb = args[args.length - 1]; const argsMinusCallback = args.slice(0, args.length - 1); - return super.readFile(p, ...argsMinusCallback, function(err, data) { - if(err) { - realFS.readFile(p, ...argsMinusCallback, function(err2, data2) { - if(err2) { + return super.readFile(p, ...argsMinusCallback, function (err, data) { + if (err) { + realFS.readFile(p, ...argsMinusCallback, function (err2, data2) { + if (err2) { cb(err); } else { cb(null, data2);