mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
Fix [Object AsyncGenerator] logging for Markdoc components (#7307)
* Revert "Bug 6672 (#7062)"
This reverts commit cf621340b0
.
* chore: remove unused test
* chore: changeset
This commit is contained in:
parent
2a4bb23b2f
commit
8034edd9ec
10 changed files with 6 additions and 136 deletions
6
.changeset/nice-falcons-flash.md
Normal file
6
.changeset/nice-falcons-flash.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
'astro': patch
|
||||
'@astrojs/mdx': patch
|
||||
---
|
||||
|
||||
Fix [Object AsyncGenerator] appearing in markup for Markdoc documents
|
|
@ -50,9 +50,6 @@ export class AstroComponentInstance {
|
|||
value = await value;
|
||||
}
|
||||
if (isHeadAndContent(value)) {
|
||||
if (this.result.extraHead.length === 0 && value.head) {
|
||||
yield renderChild(value.head);
|
||||
}
|
||||
yield* value.content;
|
||||
} else {
|
||||
yield* renderChild(value);
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
import { expect } from 'chai';
|
||||
import * as cheerio from 'cheerio';
|
||||
import { loadFixture } from '../../../astro/test/test-utils.js';
|
||||
import mdx from '@astrojs/mdx';
|
||||
|
||||
describe('build css from the component', async () => {
|
||||
let fixture;
|
||||
|
||||
before(async () => {
|
||||
fixture = await loadFixture({
|
||||
root: new URL('./fixtures/astro-content-css/', import.meta.url),
|
||||
integrations: [mdx()],
|
||||
});
|
||||
await fixture.build();
|
||||
});
|
||||
|
||||
describe('Build', () => {
|
||||
before(async () => {
|
||||
await fixture.build();
|
||||
});
|
||||
|
||||
it('including css and js from the component in pro', async () => {
|
||||
const html = await fixture.readFile('/index.html');
|
||||
const $ = cheerio.load(html);
|
||||
expect($('link[href$=".css"]').attr('href')).to.match(/^\/_astro\//);
|
||||
expect($('script[src$=".js"]').attr('src')).to.match(/^\/_astro\//);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Dev', () => {
|
||||
let devServer;
|
||||
before(async () => {
|
||||
devServer = await fixture.startDevServer();
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
devServer.stop();
|
||||
});
|
||||
|
||||
it('ncluding css and js from the component in Dev', async () => {
|
||||
let res = await fixture.fetch(`/`);
|
||||
expect(res.status).to.equal(200);
|
||||
const html = await res.text();
|
||||
const $ = cheerio.load(html);
|
||||
expect($.html()).to.include('CornflowerBlue');
|
||||
expect($('script[src$=".js"]').attr('src')).to.include('astro');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
import { defineConfig } from 'astro/config';
|
||||
|
||||
import mdx from "@astrojs/mdx";
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
build: {
|
||||
format: 'file'
|
||||
},
|
||||
integrations: [mdx()]
|
||||
});
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"name": "@test/astro-content-css",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"astro": "workspace:*",
|
||||
"@astrojs/mdx": "workspace:*"
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
// 1. Import utilities from `astro:content`
|
||||
import { z, defineCollection } from 'astro:content';
|
||||
// 2. Define a schema for each collection you'd like to validate.
|
||||
const dynamicCollection = defineCollection({
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
}),
|
||||
});
|
||||
// 3. Export a single `collections` object to register your collection(s)
|
||||
export const collections = {
|
||||
dynamic: dynamicCollection,
|
||||
};
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
const { text } = Astro.props;
|
||||
---
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head><meta charset="utf-8" /></head>
|
||||
<body>
|
||||
<div id="first">1st components with js. Props: {text}. <span>Styles</span>. JS: </div>
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
document.querySelector('#first').innerHTML += 'works';
|
||||
</script>
|
||||
<style>
|
||||
#first > span {
|
||||
color: CornflowerBlue;
|
||||
}
|
||||
</style>
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
title: 'First component'
|
||||
---
|
||||
|
||||
import FirstDynamicComponentWithJS from './FirstComponentWithJS.astro';
|
||||
|
||||
<FirstDynamicComponentWithJS text={props.mdProps} />
|
||||
|
||||
Additional text from mdx 'first-component-with-js'
|
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
const entries = await getCollection('dynamic');
|
||||
---
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head><meta charset="utf-8" /></head>
|
||||
<body>
|
||||
{entries.map(async entry => {
|
||||
const { Content } = await entry.render();
|
||||
return <Content mdProps="work" />;
|
||||
})}
|
||||
</body>
|
||||
</html>
|
|
@ -4259,15 +4259,6 @@ importers:
|
|||
specifier: ^4.3.1
|
||||
version: 4.3.1(@types/node@18.16.3)(sass@1.52.2)
|
||||
|
||||
packages/integrations/mdx/test/fixtures/astro-content-css:
|
||||
dependencies:
|
||||
'@astrojs/mdx':
|
||||
specifier: workspace:*
|
||||
version: link:../../..
|
||||
astro:
|
||||
specifier: workspace:*
|
||||
version: link:../../../../../astro
|
||||
|
||||
packages/integrations/mdx/test/fixtures/css-head-mdx:
|
||||
dependencies:
|
||||
'@astrojs/mdx':
|
||||
|
|
Loading…
Reference in a new issue