[ci] format
This commit is contained in:
parent
5ec0f6ed55
commit
04feb4b882
29 changed files with 170 additions and 166 deletions
|
@ -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.
|
||||
|
|
|
@ -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 `<h1>`—`<h6>` elements represent six levels of section headings. `<h1>` is the highest section level while `<h6>` 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
|
||||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Example HTML5 Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test</p>
|
||||
</body>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Example HTML5 Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test</p>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
---
|
||||
|
||||
<html lang="en">
|
||||
|
|
|
@ -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.
|
||||
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.
|
||||
|
|
|
@ -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,
|
||||
}));
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
);
|
||||
---
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
@ -37,18 +37,20 @@ const posts = (await getCollection('blog')).sort(
|
|||
<main>
|
||||
<section>
|
||||
<ul>
|
||||
{posts.map((post) => (
|
||||
<li>
|
||||
<time datetime={post.data.pubDate.toISOString()}>
|
||||
{post.data.pubDate.toLocaleDateString('en-us', {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
})}
|
||||
</time>
|
||||
<a href={'/blog/' + post.slug}>{post.data.title}</a>
|
||||
</li>
|
||||
))}
|
||||
{
|
||||
posts.map((post) => (
|
||||
<li>
|
||||
<time datetime={post.data.pubDate.toISOString()}>
|
||||
{post.data.pubDate.toLocaleDateString('en-us', {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
})}
|
||||
</time>
|
||||
<a href={'/blog/' + post.slug}>{post.data.title}</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</section>
|
||||
</main>
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -4,9 +4,9 @@ import {
|
|||
createComponent,
|
||||
createHeadAndContent,
|
||||
renderComponent,
|
||||
renderStyleElement,
|
||||
renderTemplate,
|
||||
renderUniqueStylesheet,
|
||||
renderStyleElement,
|
||||
unescapeHTML,
|
||||
} from '../runtime/server/index.js';
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// astro-head-inject
|
||||
import {
|
||||
createCollectionToGlobResultMap,
|
||||
createGetCollection,
|
||||
createGetEntry,
|
||||
createCollectionToGlobResultMap,
|
||||
} from 'astro/content/internal';
|
||||
|
||||
export { z } from 'astro/zod';
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import type fsMod from 'node:fs';
|
||||
import matter from 'gray-matter';
|
||||
import { z } from 'zod';
|
||||
import { createServer, ErrorPayload as ViteErrorPayload, ViteDevServer } from 'vite';
|
||||
import { AstroSettings } from '../@types/astro.js';
|
||||
import { astroContentVirtualModPlugin } from './vite-plugin-content-virtual-mod.js';
|
||||
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 { 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(),
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 { 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 {
|
||||
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;
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -17,11 +17,11 @@ export {
|
|||
renderHTMLElement,
|
||||
renderPage,
|
||||
renderSlot,
|
||||
renderStyleElement,
|
||||
renderTemplate as render,
|
||||
renderTemplate,
|
||||
renderToString,
|
||||
renderUniqueStylesheet,
|
||||
renderStyleElement,
|
||||
stringifyChunk,
|
||||
voidElementNames,
|
||||
} from './render/index.js';
|
||||
|
|
|
@ -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]();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ const stylesheetRel = 'stylesheet';
|
|||
export function renderStyleElement(children: string) {
|
||||
return renderElement('style', {
|
||||
props: {},
|
||||
children
|
||||
})
|
||||
children,
|
||||
});
|
||||
}
|
||||
|
||||
export function renderStylesheet({ href }: { href: string }) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue