diff --git a/examples/portfolio/src/components/MainHead.astro b/examples/portfolio/src/components/MainHead.astro
index 1a55794ab9..1408dd163b 100644
--- a/examples/portfolio/src/components/MainHead.astro
+++ b/examples/portfolio/src/components/MainHead.astro
@@ -7,6 +7,6 @@ const { title = 'Jeanine White: Personal Site' } = Astro.props;
{title}
-
+
diff --git a/examples/portfolio/src/pages/index.astro b/examples/portfolio/src/pages/index.astro
index 84bc0af231..4b56211abd 100644
--- a/examples/portfolio/src/pages/index.astro
+++ b/examples/portfolio/src/pages/index.astro
@@ -7,7 +7,7 @@ import Footer from '../components/Footer/index.jsx';
import PortfolioPreview from '../components/PortfolioPreview/index.jsx';
// Data Fetching: List all Markdown posts in the repo.
-const projects = Astro.fetchContent('./project/**/*.md');
+const projects = Astro.fetchContent("./project/**/*.md");
const featuredProject = projects[0];
// Full Astro Component Syntax:
diff --git a/packages/astro/components/index.js b/packages/astro/components/index.js
index bfa1d82060..6254482496 100644
--- a/packages/astro/components/index.js
+++ b/packages/astro/components/index.js
@@ -1,4 +1,4 @@
-// export { default as Code } from './Code.astro';
-// export { default as Debug } from './Debug.astro';
+//export { default as Code } from './Code.astro';
+//export { default as Debug } from './Debug.astro';
export { default as Markdown } from './Markdown.astro';
-// export { default as Prism } from './Prism.astro';
\ No newline at end of file
+export { default as Prism } from './Prism.astro';
\ No newline at end of file
diff --git a/packages/astro/src/runtime/server/index.ts b/packages/astro/src/runtime/server/index.ts
index a68143ca4f..c5654587c1 100644
--- a/packages/astro/src/runtime/server/index.ts
+++ b/packages/astro/src/runtime/server/index.ts
@@ -258,10 +258,10 @@ function createFetchContentFn(url: URL) {
}
const urlSpec = new URL(spec, url).pathname.replace(/[\\/\\\\]/, '/');
return {
+ ...mod.frontmatter,
content: mod.metadata,
- metadata: mod.frontmatter,
file: new URL(spec, url),
- url: urlSpec.includes('/pages/') && urlSpec.replace(/^.*\/pages\//, '/').replace(/\.md$/, ''),
+ url: urlSpec.includes('/pages/') && urlSpec.replace(/^.*\/pages\//, '/').replace(/\.md$/, '')
};
})
.filter(Boolean);
diff --git a/packages/astro/src/vite-plugin-astro-postprocess/index.ts b/packages/astro/src/vite-plugin-astro-postprocess/index.ts
index 938eb93636..c4f4f1ab5b 100644
--- a/packages/astro/src/vite-plugin-astro-postprocess/index.ts
+++ b/packages/astro/src/vite-plugin-astro-postprocess/index.ts
@@ -11,6 +11,9 @@ interface AstroPluginOptions {
devServer?: AstroDevServer;
}
+// esbuild transforms the component-scoped Astro into Astro2, so need to check both.
+const validAstroGlobalNames = new Set(['Astro', 'Astro2']);
+
export default function astro({ config, devServer }: AstroPluginOptions): Plugin {
return {
name: '@astrojs/vite-plugin-astro-postprocess',
@@ -38,7 +41,7 @@ export default function astro({ config, devServer }: AstroPluginOptions): Plugin
if (
path.parent.type !== 'CallExpression' ||
path.parent.callee.type !== 'MemberExpression' ||
- (path.parent.callee.object as any).name !== 'Astro' ||
+ !validAstroGlobalNames.has((path.parent.callee.object as any).name) ||
(path.parent.callee.property as any).name !== 'fetchContent'
) {
return;
@@ -68,6 +71,7 @@ export default function astro({ config, devServer }: AstroPluginOptions): Plugin
if (!result || !result.code) {
return null;
}
+
return { code: result.code, map: result.map };
},
};
diff --git a/packages/astro/test/astro-sitemap-rss.test.js b/packages/astro/test/astro-sitemap-rss.test.js
index ed600d14f9..55634c4f14 100644
--- a/packages/astro/test/astro-sitemap-rss.test.js
+++ b/packages/astro/test/astro-sitemap-rss.test.js
@@ -18,7 +18,7 @@ describe('RSS Generation', () => {
it('generates RSS correctly', async () => {
const rss = await fixture.readFile('/custom/feed.xml');
expect(rss).to.equal(
- `https://astro.build/custom/feed.xmlen-usMF Doom- https://astro.build/episode/fazers/Thu, 03 Jul 2003 00:00:00 GMTmusic197true
- https://astro.build/episode/rap-snitch-knishes/Tue, 16 Nov 2004 00:00:00 GMTmusic172true
- https://astro.build/episode/rhymes-like-dimes/https://astro.build/custom/feed.xmlen-usMF Doom
- https://astro.build/episode/rap-snitch-knishes/Tue, 16 Nov 2004 00:00:00 GMTmusic172true
- https://astro.build/episode/fazers/Thu, 03 Jul 2003 00:00:00 GMTmusic197true
- https://astro.build/episode/rhymes-like-dimes/Tue, 19 Oct 1999 00:00:00 GMTmusic259true
`
);
});
@@ -31,4 +31,4 @@ describe('Sitemap Generation', () => {
`https://astro.build/404/index.htmlhttps://astro.build/episode/fazers/index.htmlhttps://astro.build/episode/rap-snitch-knishes/index.htmlhttps://astro.build/episode/rhymes-like-dimes/index.htmlhttps://astro.build/episodes/index.html\n`
);
});
-});
+});
\ No newline at end of file
diff --git a/packages/astro/test/fixtures/astro-sitemap-rss/src/pages/episodes/[...page].astro b/packages/astro/test/fixtures/astro-sitemap-rss/src/pages/episodes/[...page].astro
index 1e8d2e58c2..5cb25e3ded 100644
--- a/packages/astro/test/fixtures/astro-sitemap-rss/src/pages/episodes/[...page].astro
+++ b/packages/astro/test/fixtures/astro-sitemap-rss/src/pages/episodes/[...page].astro
@@ -10,14 +10,14 @@ export function getStaticPaths({paginate, rss}) {
},
customData: `en-us` +
`MF Doom`,
- items: episodes.map(({ metadata, url }) => ({
- title: metadata.title,
- link: url,
- description: metadata.description,
- pubDate: metadata.pubDate + 'Z',
- customData: `${metadata.type}` +
- `${metadata.duration}` +
- `${metadata.explicit || false}`,
+ items: episodes.map((episode) => ({
+ title: episode.title,
+ link: episode.url,
+ description: episode.description,
+ pubDate: episode.pubDate + 'Z',
+ customData: `${episode.type}` +
+ `${episode.duration}` +
+ `${episode.explicit || false}`,
})),
dest: '/custom/feed.xml',
});