Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored and astrobot-houston committed Dec 16, 2022
1 parent 5ec0f6e commit 04feb4b
Show file tree
Hide file tree
Showing 29 changed files with 167 additions and 163 deletions.
8 changes: 4 additions & 4 deletions examples/with-content/src/content/blog/first-post.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
55 changes: 30 additions & 25 deletions examples/with-content/src/content/blog/markdown-style-guide.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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>
```

Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions examples/with-content/src/content/blog/second-post.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 4 additions & 4 deletions examples/with-content/src/content/blog/third-post.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
77 changes: 38 additions & 39 deletions examples/with-content/src/content/types.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
4 changes: 1 addition & 3 deletions examples/with-content/src/layouts/BlogPost.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
12 changes: 6 additions & 6 deletions examples/with-content/src/pages/about.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
6 changes: 3 additions & 3 deletions examples/with-content/src/pages/blog/[...slug].astro
Original file line number Diff line number Diff line change
@@ -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,
}));
Expand Down
28 changes: 15 additions & 13 deletions examples/with-content/src/pages/blog/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/content/index.ts
Original file line number Diff line number Diff line change
@@ -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';
2 changes: 1 addition & 1 deletion packages/astro/src/content/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {
createComponent,
createHeadAndContent,
renderComponent,
renderStyleElement,
renderTemplate,
renderUniqueStylesheet,
renderStyleElement,
unescapeHTML,
} from '../runtime/server/index.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/content/template/types.generated.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// astro-head-inject
import {
createCollectionToGlobResultMap,
createGetCollection,
createGetEntry,
createCollectionToGlobResultMap,
} from 'astro/content/internal';

export { z } from 'astro/zod';
Expand Down
10 changes: 5 additions & 5 deletions packages/astro/src/content/types-generator.ts
Original file line number Diff line number Diff line change
@@ -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 };
Expand Down
8 changes: 4 additions & 4 deletions packages/astro/src/content/utils.ts
Original file line number Diff line number Diff line change
@@ -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(),
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/content/vite-plugin-content-assets.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Loading

0 comments on commit 04feb4b

Please sign in to comment.