[ci] format

This commit is contained in:
matthewp 2022-12-16 19:22:01 +00:00 committed by fredkbot
parent 5ec0f6ed55
commit 04feb4b882
29 changed files with 170 additions and 166 deletions

View file

@ -1,8 +1,8 @@
--- ---
title: "First post" title: 'First post'
description: "Lorem ipsum dolor sit amet" description: 'Lorem ipsum dolor sit amet'
pubDate: "Jul 08 2022" pubDate: 'Jul 08 2022'
heroImage: "/placeholder-hero.jpg" 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. 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.

View file

@ -1,8 +1,8 @@
--- ---
title: "Markdown Style Guide" title: 'Markdown Style Guide'
description: "Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro." description: 'Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro.'
pubDate: "Jul 01 2022" pubDate: 'Jul 01 2022'
heroImage: "/placeholder-hero.jpg" heroImage: '/placeholder-hero.jpg'
--- ---
Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro. 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 `<h1>`—`<h6>` elements represent six levels of section headings. `<h1>` is the highest section level while `<h6>` is the lowest. The following HTML `<h1>`—`<h6>` elements represent six levels of section headings. `<h1>` is the highest section level while `<h6>` is the lowest.
# H1 # H1
## H2 ## H2
### H3 ### H3
#### H4 #### H4
##### H5 ##### H5
###### H6 ###### H6
## Paragraph ## Paragraph
@ -35,7 +40,7 @@ The blockquote element represents content that is quoted from another source, op
#### Blockquote without attribution #### Blockquote without attribution
> Tiam, ad mint andaepu dandae nostion secatur sequo quae. > 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 #### Blockquote with attribution
@ -47,21 +52,21 @@ The blockquote element represents content that is quoted from another source, op
## Tables ## Tables
| Italics | Bold | Code | | Italics | Bold | Code |
| -------- | -------- | ------ | | --------- | -------- | ------ |
| *italics* | **bold** | `code` | | _italics_ | **bold** | `code` |
## Code Blocks ## Code Blocks
```html ```html
<!doctype html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<title>Example HTML5 Document</title> <title>Example HTML5 Document</title>
</head> </head>
<body> <body>
<p>Test</p> <p>Test</p>
</body> </body>
</html> </html>
``` ```
@ -75,19 +80,19 @@ The blockquote element represents content that is quoted from another source, op
#### Unordered List #### Unordered List
* List item - List item
* Another item - Another item
* And another item - And another item
#### Nested list #### Nested list
* Fruit - Fruit
* Apple - Apple
* Orange - Orange
* Banana - Banana
* Dairy - Dairy
* Milk - Milk
* Cheese - Cheese
## Other Elements — abbr, sub, sup, kbd, mark ## Other Elements — abbr, sub, sup, kbd, mark

View file

@ -1,8 +1,8 @@
--- ---
title: "Second post" title: 'Second post'
description: "Lorem ipsum dolor sit amet" description: 'Lorem ipsum dolor sit amet'
pubDate: "Jul 22 2022" pubDate: 'Jul 22 2022'
heroImage: "/placeholder-hero.jpg" 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. 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.

View file

@ -1,8 +1,8 @@
--- ---
title: "Third post" title: 'Third post'
description: "Lorem ipsum dolor sit amet" description: 'Lorem ipsum dolor sit amet'
pubDate: "Jul 15 2022" pubDate: 'Jul 15 2022'
heroImage: "/placeholder-hero.jpg" 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. 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.

View file

@ -42,45 +42,44 @@ declare module 'astro:content' {
}; };
const entryMap: { const entryMap: {
"blog": { blog: {
"first-post.md": { 'first-post.md': {
id: "first-post.md", id: 'first-post.md';
slug: "first-post", slug: 'first-post';
body: string, body: string;
collection: "blog", collection: 'blog';
data: InferEntrySchema<"blog"> data: InferEntrySchema<'blog'>;
}, };
"markdown-style-guide.md": { 'markdown-style-guide.md': {
id: "markdown-style-guide.md", id: 'markdown-style-guide.md';
slug: "markdown-style-guide", slug: 'markdown-style-guide';
body: string, body: string;
collection: "blog", collection: 'blog';
data: InferEntrySchema<"blog"> data: InferEntrySchema<'blog'>;
}, };
"second-post.md": { 'second-post.md': {
id: "second-post.md", id: 'second-post.md';
slug: "second-post", slug: 'second-post';
body: string, body: string;
collection: "blog", collection: 'blog';
data: InferEntrySchema<"blog"> data: InferEntrySchema<'blog'>;
}, };
"third-post.md": { 'third-post.md': {
id: "third-post.md", id: 'third-post.md';
slug: "third-post", slug: 'third-post';
body: string, body: string;
collection: "blog", collection: 'blog';
data: InferEntrySchema<"blog"> data: InferEntrySchema<'blog'>;
}, };
"using-mdx.mdx": { 'using-mdx.mdx': {
id: "using-mdx.mdx", id: 'using-mdx.mdx';
slug: "using-mdx", slug: 'using-mdx';
body: string, body: string;
collection: "blog", collection: 'blog';
data: InferEntrySchema<"blog"> data: InferEntrySchema<'blog'>;
}, };
}, };
}; };
type ContentConfig = typeof import("./config"); type ContentConfig = typeof import('./config');
} }

View file

@ -6,9 +6,7 @@ import type { CollectionEntry } from 'astro:content';
type Props = CollectionEntry<'blog'>['data']; type Props = CollectionEntry<'blog'>['data'];
const { const { title, description, pubDate, updatedDate, heroImage } = Astro.props;
title, description, pubDate, updatedDate, heroImage,
} = Astro.props;
--- ---
<html lang="en"> <html lang="en">

View file

@ -1,9 +1,9 @@
--- ---
layout: "../layouts/BlogPost.astro" layout: '../layouts/BlogPost.astro'
title: "About Me" title: 'About Me'
description: "Lorem ipsum dolor sit amet" description: 'Lorem ipsum dolor sit amet'
updatedDate: "August 08 2022" updatedDate: 'August 08 2022'
heroImage: "/placeholder-about.jpg" 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. 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. 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. 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.

View file

@ -1,10 +1,10 @@
--- ---
import { CollectionEntry, getCollection } from "astro:content"; import { CollectionEntry, getCollection } from 'astro:content';
import BlogPost from "../../layouts/BlogPost.astro"; import BlogPost from '../../layouts/BlogPost.astro';
export async function getStaticPaths() { export async function getStaticPaths() {
const posts = await getCollection('blog'); const posts = await getCollection('blog');
return posts.map(post => ({ return posts.map((post) => ({
params: { slug: post.slug }, params: { slug: post.slug },
props: post, props: post,
})); }));

View file

@ -7,7 +7,7 @@ import { getCollection } from 'astro:content';
const posts = (await getCollection('blog')).sort( const posts = (await getCollection('blog')).sort(
(a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf() (a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf()
) );
--- ---
<!DOCTYPE html> <!DOCTYPE html>
@ -37,18 +37,20 @@ const posts = (await getCollection('blog')).sort(
<main> <main>
<section> <section>
<ul> <ul>
{posts.map((post) => ( {
<li> posts.map((post) => (
<time datetime={post.data.pubDate.toISOString()}> <li>
{post.data.pubDate.toLocaleDateString('en-us', { <time datetime={post.data.pubDate.toISOString()}>
year: 'numeric', {post.data.pubDate.toLocaleDateString('en-us', {
month: 'short', year: 'numeric',
day: 'numeric', month: 'short',
})} day: 'numeric',
</time> })}
<a href={'/blog/' + post.slug}>{post.data.title}</a> </time>
</li> <a href={'/blog/' + post.slug}>{post.data.title}</a>
))} </li>
))
}
</ul> </ul>
</section> </section>
</main> </main>

View file

@ -1,6 +1,6 @@
export { export {
astroDelayedAssetPlugin,
astroBundleDelayedAssetPlugin, astroBundleDelayedAssetPlugin,
astroDelayedAssetPlugin,
} from './vite-plugin-content-assets.js'; } from './vite-plugin-content-assets.js';
export { astroContentServerPlugin } from './vite-plugin-content-server.js'; export { astroContentServerPlugin } from './vite-plugin-content-server.js';
export { astroContentVirtualModPlugin } from './vite-plugin-content-virtual-mod.js'; export { astroContentVirtualModPlugin } from './vite-plugin-content-virtual-mod.js';

View file

@ -4,9 +4,9 @@ import {
createComponent, createComponent,
createHeadAndContent, createHeadAndContent,
renderComponent, renderComponent,
renderStyleElement,
renderTemplate, renderTemplate,
renderUniqueStylesheet, renderUniqueStylesheet,
renderStyleElement,
unescapeHTML, unescapeHTML,
} from '../runtime/server/index.js'; } from '../runtime/server/index.js';

View file

@ -1,8 +1,8 @@
// astro-head-inject // astro-head-inject
import { import {
createCollectionToGlobResultMap,
createGetCollection, createGetCollection,
createGetEntry, createGetEntry,
createCollectionToGlobResultMap,
} from 'astro/content/internal'; } from 'astro/content/internal';
export { z } from 'astro/zod'; export { z } from 'astro/zod';

View file

@ -1,14 +1,14 @@
import { normalizePath } from 'vite';
import glob from 'fast-glob'; import glob from 'fast-glob';
import { cyan } from 'kleur/colors';
import fsMod from 'node:fs'; import fsMod from 'node:fs';
import * as path from 'node:path'; import * as path from 'node:path';
import { cyan } from 'kleur/colors'; import { fileURLToPath, pathToFileURL } from 'node:url';
import { info, LogOptions, warn } from '../core/logger/core.js'; import { normalizePath } from 'vite';
import type { AstroSettings } from '../@types/astro.js'; import type { AstroSettings } from '../@types/astro.js';
import { info, LogOptions, warn } from '../core/logger/core.js';
import { appendForwardSlash, isRelativePath } from '../core/path.js'; import { appendForwardSlash, isRelativePath } from '../core/path.js';
import { contentFileExts, CONTENT_TYPES_FILE } from './consts.js'; import { contentFileExts, CONTENT_TYPES_FILE } from './consts.js';
import { fileURLToPath, pathToFileURL } from 'node:url'; import { ContentConfig, ContentObservable, ContentPaths, loadContentConfig } from './utils.js';
import { ContentConfig, loadContentConfig, ContentPaths, ContentObservable } from './utils.js';
type ChokidarEvent = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir'; type ChokidarEvent = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir';
type RawContentEvent = { name: ChokidarEvent; entry: string }; type RawContentEvent = { name: ChokidarEvent; entry: string };

View file

@ -1,11 +1,11 @@
import type fsMod from 'node:fs';
import matter from 'gray-matter'; import matter from 'gray-matter';
import { z } from 'zod'; import type fsMod from 'node:fs';
import { createServer, ErrorPayload as ViteErrorPayload, ViteDevServer } from 'vite';
import { AstroSettings } from '../@types/astro.js';
import { astroContentVirtualModPlugin } from './vite-plugin-content-virtual-mod.js';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { createServer, ErrorPayload as ViteErrorPayload, ViteDevServer } from 'vite';
import { z } from 'zod';
import { AstroSettings } from '../@types/astro.js';
import { AstroError, AstroErrorData } from '../core/errors/index.js'; import { AstroError, AstroErrorData } from '../core/errors/index.js';
import { astroContentVirtualModPlugin } from './vite-plugin-content-virtual-mod.js';
export const collectionConfigParser = z.object({ export const collectionConfigParser = z.object({
schema: z.any().optional(), schema: z.any().optional(),

View file

@ -1,10 +1,10 @@
import { pathToFileURL } from 'url';
import type { Plugin } from 'vite'; import type { Plugin } from 'vite';
import type { ModuleLoader } from '../core/module-loader/loader.js';
import { moduleIsTopLevelPage, walkParentInfos } from '../core/build/graph.js'; import { moduleIsTopLevelPage, walkParentInfos } from '../core/build/graph.js';
import { BuildInternals, getPageDataByViteID } from '../core/build/internal.js'; import { BuildInternals, getPageDataByViteID } from '../core/build/internal.js';
import { getStylesForURL } from '../core/render/dev/css.js'; import type { ModuleLoader } from '../core/module-loader/loader.js';
import { pathToFileURL } from 'url';
import { createViteLoader } from '../core/module-loader/vite.js'; import { createViteLoader } from '../core/module-loader/vite.js';
import { getStylesForURL } from '../core/render/dev/css.js';
import { import {
contentFileExts, contentFileExts,
DELAYED_ASSET_FLAG, DELAYED_ASSET_FLAG,

View file

@ -1,28 +1,28 @@
import type { Plugin } from 'vite';
import fsMod from 'node:fs';
import { cyan } from 'kleur/colors';
import { info, LogOptions } from '../core/logger/core.js';
import type { AstroSettings } from '../@types/astro.js';
import { contentFileExts, CONTENT_FLAG } from './consts.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 * as devalue from 'devalue';
import { cyan } from 'kleur/colors';
import fsMod from 'node:fs';
import { pathToFileURL } from 'node:url';
import type { Plugin } from 'vite';
import type { AstroSettings } from '../@types/astro.js';
import { info, LogOptions } from '../core/logger/core.js';
import { prependForwardSlash } from '../core/path.js';
import { escapeViteEnvReferences } from '../vite-plugin-utils/index.js';
import { contentFileExts, CONTENT_FLAG } from './consts.js';
import { import {
createContentTypesGenerator, createContentTypesGenerator,
GenerateContentTypes, GenerateContentTypes,
getEntryInfo, getEntryInfo,
getEntryType, getEntryType,
} from './types-generator.js'; } from './types-generator.js';
import { pathToFileURL } from 'node:url'; import {
import { prependForwardSlash } from '../core/path.js'; ContentConfig,
contentObservable,
ContentPaths,
getContentPaths,
getEntryData,
getEntrySlug,
parseFrontmatter,
} from './utils.js';
interface AstroContentServerPluginParams { interface AstroContentServerPluginParams {
fs: typeof fsMod; fs: typeof fsMod;

View file

@ -1,7 +1,7 @@
import type { Plugin } from 'vite';
import { normalizePath } from 'vite';
import fsMod from 'node:fs'; import fsMod from 'node:fs';
import * as path from 'node:path'; import * as path from 'node:path';
import type { Plugin } from 'vite';
import { normalizePath } from 'vite';
import type { AstroSettings } from '../@types/astro.js'; import type { AstroSettings } from '../@types/astro.js';
import { appendForwardSlash, prependForwardSlash } from '../core/path.js'; import { appendForwardSlash, prependForwardSlash } from '../core/path.js';
import { contentFileExts, CONTENT_FILE, VIRTUAL_MODULE_ID } from './consts.js'; import { contentFileExts, CONTENT_FILE, VIRTUAL_MODULE_ID } from './consts.js';

View file

@ -5,6 +5,7 @@ import { bgGreen, bgMagenta, black, dim } from 'kleur/colors';
import path from 'path'; import path from 'path';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
import * as vite from 'vite'; import * as vite from 'vite';
import { astroBundleDelayedAssetPlugin } from '../../content/index.js';
import { import {
BuildInternals, BuildInternals,
createBuildInternals, createBuildInternals,
@ -14,7 +15,6 @@ import { emptyDir, removeDir } from '../../core/fs/index.js';
import { prependForwardSlash } from '../../core/path.js'; import { prependForwardSlash } from '../../core/path.js';
import { isModeServerWithNoAdapter } from '../../core/util.js'; import { isModeServerWithNoAdapter } from '../../core/util.js';
import { runHookBuildSetup } from '../../integrations/index.js'; import { runHookBuildSetup } from '../../integrations/index.js';
import { astroBundleDelayedAssetPlugin } from '../../content/index.js';
import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js'; import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
import { AstroError, AstroErrorData } from '../errors/index.js'; import { AstroError, AstroErrorData } from '../errors/index.js';
import { info } from '../logger/core.js'; import { info } from '../logger/core.js';

View file

@ -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 crypto from 'node:crypto';
import * as npath from 'node:path'; import * as npath from 'node:path';
import type { GetModuleInfo } from 'rollup';
import { Plugin as VitePlugin, ResolvedConfig, transformWithEsbuild } from 'vite'; import { Plugin as VitePlugin, ResolvedConfig, transformWithEsbuild } from 'vite';
import { isCSSRequest } from '../render/util.js'; 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 * as assetName from './css-asset-name.js';
import { getTopLevelPages, moduleIsTopLevelPage, walkParentInfos } from './graph.js'; import { moduleIsTopLevelPage, walkParentInfos } from './graph.js';
import { import {
eachPageData, eachPageData,
getPageDataByViteID, getPageDataByViteID,
@ -15,7 +16,6 @@ import {
getPageDatasByHoistedScriptId, getPageDatasByHoistedScriptId,
isHoistedScript, isHoistedScript,
} from './internal.js'; } from './internal.js';
import { DELAYED_ASSET_FLAG } from '../../content/consts.js';
interface PluginOptions { interface PluginOptions {
internals: BuildInternals; internals: BuildInternals;

View file

@ -5,6 +5,11 @@ import nodeFs from 'fs';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
import * as vite from 'vite'; import * as vite from 'vite';
import { crawlFrameworkPkgs } from 'vitefu'; import { crawlFrameworkPkgs } from 'vitefu';
import {
astroContentServerPlugin,
astroContentVirtualModPlugin,
astroDelayedAssetPlugin,
} from '../content/index.js';
import astroPostprocessVitePlugin from '../vite-plugin-astro-postprocess/index.js'; import astroPostprocessVitePlugin from '../vite-plugin-astro-postprocess/index.js';
import { vitePluginAstroServer } from '../vite-plugin-astro-server/index.js'; import { vitePluginAstroServer } from '../vite-plugin-astro-server/index.js';
import astroVitePlugin from '../vite-plugin-astro/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 astroScriptsPageSSRPlugin from '../vite-plugin-scripts/page-ssr.js';
import { createCustomViteLogger } from './errors/dev/index.js'; import { createCustomViteLogger } from './errors/dev/index.js';
import { resolveDependency } from './util.js'; import { resolveDependency } from './util.js';
import {
astroContentServerPlugin,
astroContentVirtualModPlugin,
astroDelayedAssetPlugin,
} from '../content/index.js';
interface CreateViteOptions { interface CreateViteOptions {
settings: AstroSettings; settings: AstroSettings;

View file

@ -1,8 +1,8 @@
import type { ModuleLoader, ModuleNode } from '../../module-loader/index'; import type { ModuleLoader, ModuleNode } from '../../module-loader/index';
import npath from 'path'; import npath from 'path';
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from '../../constants.js';
import { DELAYED_ASSET_FLAG } from '../../../content/consts.js'; import { DELAYED_ASSET_FLAG } from '../../../content/consts.js';
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from '../../constants.js';
import { unwrapId } from '../../util.js'; import { unwrapId } from '../../util.js';
import { STYLE_EXTENSIONS } from '../util.js'; import { STYLE_EXTENSIONS } from '../util.js';

View file

@ -100,9 +100,7 @@ class Slots {
); );
} else if (args.length > 0) { } else if (args.length > 0) {
const slotValue = this.#slots[name]; const slotValue = this.#slots[name];
const component = typeof slotValue === 'function' ? const component = typeof slotValue === 'function' ? await slotValue() : await slotValue;
await slotValue() :
await slotValue;
// Astro // Astro
const expression = getFunctionExpression(component); const expression = getFunctionExpression(component);

View file

@ -20,7 +20,10 @@ function createComponentWithOptions(opts: CreateComponentOptions) {
return cb; return cb;
} }
// Used in creating the component. aka the main export. // 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') { if (typeof arg1 === 'function') {
return baseCreateComponent(arg1, moduleId); return baseCreateComponent(arg1, moduleId);
} else { } else {

View file

@ -17,11 +17,11 @@ export {
renderHTMLElement, renderHTMLElement,
renderPage, renderPage,
renderSlot, renderSlot,
renderStyleElement,
renderTemplate as render, renderTemplate as render,
renderTemplate, renderTemplate,
renderToString, renderToString,
renderUniqueStylesheet, renderUniqueStylesheet,
renderStyleElement,
stringifyChunk, stringifyChunk,
voidElementNames, voidElementNames,
} from './render/index.js'; } from './render/index.js';

View file

@ -33,7 +33,7 @@ export class AstroComponentInstance {
this.props = props; this.props = props;
this.factory = factory; this.factory = factory;
this.slotValues = {}; this.slotValues = {};
for(const name in slots) { for (const name in slots) {
this.slotValues[name] = slots[name](); this.slotValues[name] = slots[name]();
} }
} }

View file

@ -2,7 +2,7 @@ export type {
AstroComponentFactory, AstroComponentFactory,
AstroComponentInstance, AstroComponentInstance,
ComponentSlots as AstroComponentSlots, ComponentSlots as AstroComponentSlots,
ComponentSlotsWithValues as AstroComponentSlotsWithValues ComponentSlotsWithValues as AstroComponentSlotsWithValues,
} from './astro/index'; } from './astro/index';
export { export {
createHeadAndContent, createHeadAndContent,
@ -16,7 +16,6 @@ export { renderHTMLElement } from './dom.js';
export { maybeRenderHead, renderHead } from './head.js'; export { maybeRenderHead, renderHead } from './head.js';
export { renderPage } from './page.js'; export { renderPage } from './page.js';
export { renderSlot } from './slot.js'; export { renderSlot } from './slot.js';
export { renderUniqueStylesheet, renderStyleElement } from './tags.js'; export { renderStyleElement, renderUniqueStylesheet } from './tags.js';
export type { RenderInstruction } from './types'; export type { RenderInstruction } from './types';
export { addAttribute, defineScriptVars, voidElementNames } from './util.js'; export { addAttribute, defineScriptVars, voidElementNames } from './util.js';

View file

@ -6,8 +6,8 @@ const stylesheetRel = 'stylesheet';
export function renderStyleElement(children: string) { export function renderStyleElement(children: string) {
return renderElement('style', { return renderElement('style', {
props: {}, props: {},
children children,
}) });
} }
export function renderStylesheet({ href }: { href: string }) { export function renderStylesheet({ href }: { href: string }) {

View file

@ -1,9 +1,9 @@
import MagicString from 'magic-string';
import { Plugin as VitePlugin } from 'vite'; import { Plugin as VitePlugin } from 'vite';
import { AstroSettings } from '../@types/astro.js'; 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 { isPage } from '../core/util.js';
import { normalizeFilename } from '../vite-plugin-utils/index.js'; import { normalizeFilename } from '../vite-plugin-utils/index.js';
import { PAGE_SSR_SCRIPT_ID } from './index.js';
export default function astroScriptsPostPlugin({ export default function astroScriptsPostPlugin({
settings, settings,

View file

@ -40,10 +40,10 @@ class VirtualVolumeWithFallback extends VirtualVolume {
readFile(p, ...args) { readFile(p, ...args) {
const cb = args[args.length - 1]; const cb = args[args.length - 1];
const argsMinusCallback = args.slice(0, args.length - 1); const argsMinusCallback = args.slice(0, args.length - 1);
return super.readFile(p, ...argsMinusCallback, function(err, data) { return super.readFile(p, ...argsMinusCallback, function (err, data) {
if(err) { if (err) {
realFS.readFile(p, ...argsMinusCallback, function(err2, data2) { realFS.readFile(p, ...argsMinusCallback, function (err2, data2) {
if(err2) { if (err2) {
cb(err); cb(err);
} else { } else {
cb(null, data2); cb(null, data2);