From a5c6f922fa743c55c74882bda5d2d68cc3674600 Mon Sep 17 00:00:00 2001 From: natemoo-re Date: Fri, 29 Oct 2021 19:47:01 +0000 Subject: [PATCH] [ci] yarn format --- examples/blog/src/pages/posts/index.md | 2 +- examples/docs/src/languages.ts | 2 +- .../with-markdown-plugins/astro.config.mjs | 19 +++++++------ packages/astro-prism/index.d.ts | 2 +- packages/astro/src/core/util.ts | 2 +- packages/astro/src/core/vite.ts | 2 +- packages/astro/src/runtime/server/index.ts | 12 ++++++--- packages/astro/src/runtime/server/metadata.ts | 2 +- .../vite-plugin-astro-postprocess/index.ts | 2 +- packages/astro/test/astro-basic.test.js | 2 +- packages/astro/test/astro-dynamic.test.js | 4 +-- .../astro/test/astro-markdown-plugins.test.js | 20 +++++++------- packages/astro/test/astro-markdown.test.js | 6 ++--- packages/astro/test/astro-sitemap-rss.test.js | 4 +-- packages/astro/test/astro-slots.test.js | 2 +- packages/astro/test/config.test.js | 2 +- packages/markdown/remark/src/index.ts | 21 +++++++-------- .../markdown/remark/src/rehype-islands.ts | 10 +++---- packages/markdown/remark/src/rehype-jsx.ts | 10 +++---- packages/markdown/remark/src/remark-prism.ts | 27 +++++++++---------- packages/markdown/remark/src/remark-slug.ts | 24 ++++++++--------- packages/markdown/remark/src/remark-unwrap.ts | 20 ++++++-------- packages/markdown/remark/src/types.ts | 2 +- .../renderer-lit/hydration-support.js | 2 +- packages/renderers/renderer-lit/index.js | 2 +- .../renderers/renderer-preact/compat/index.js | 2 +- 26 files changed, 101 insertions(+), 104 deletions(-) diff --git a/examples/blog/src/pages/posts/index.md b/examples/blog/src/pages/posts/index.md index 949dfb866..40d329e3a 100644 --- a/examples/blog/src/pages/posts/index.md +++ b/examples/blog/src/pages/posts/index.md @@ -13,4 +13,4 @@ description: Just a Hello World Post! This is so cool! -Do variables work {frontmatter.value * 2}? +Do variables work {frontmatter.value \* 2}? diff --git a/examples/docs/src/languages.ts b/examples/docs/src/languages.ts index 5cdea0456..069413fd2 100644 --- a/examples/docs/src/languages.ts +++ b/examples/docs/src/languages.ts @@ -1,6 +1,6 @@ import { KNOWN_LANGUAGES } from './config'; -export { KNOWN_LANGUAGES } +export { KNOWN_LANGUAGES }; export const KNOWN_LANGUAGE_CODES = Object.values(KNOWN_LANGUAGES); export const langPathRegex = /\/([a-z]{2}-?[A-Z]{0,2})\//; diff --git a/examples/with-markdown-plugins/astro.config.mjs b/examples/with-markdown-plugins/astro.config.mjs index a7a644944..8e70603a3 100644 --- a/examples/with-markdown-plugins/astro.config.mjs +++ b/examples/with-markdown-plugins/astro.config.mjs @@ -11,13 +11,16 @@ import astroRemark from '@astrojs/markdown-remark'; export default /** @type {import('astro').AstroUserConfig} */ ({ // Enable Custom Markdown options, plugins, etc. markdownOptions: { - render: [astroRemark, { - remarkPlugins: ['remark-code-titles', 'remark-slug'], - rehypePlugins: [ - ['rehype-autolink-headings', { behavior: 'prepend' }], - ['rehype-toc', { headings: ['h2', 'h3'] }], - ['rehype-add-classes', { 'h1,h2,h3': 'title' }], - ] - }] + render: [ + astroRemark, + { + remarkPlugins: ['remark-code-titles', 'remark-slug'], + rehypePlugins: [ + ['rehype-autolink-headings', { behavior: 'prepend' }], + ['rehype-toc', { headings: ['h2', 'h3'] }], + ['rehype-add-classes', { 'h1,h2,h3': 'title' }], + ], + }, + ], }, }); diff --git a/packages/astro-prism/index.d.ts b/packages/astro-prism/index.d.ts index eb260d9b9..058e91da7 100644 --- a/packages/astro-prism/index.d.ts +++ b/packages/astro-prism/index.d.ts @@ -1 +1 @@ -export function addAstro(Prism: any): void; \ No newline at end of file +export function addAstro(Prism: any): void; diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index 1abc6d1c6..4fb32634c 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -66,7 +66,7 @@ export function codeFrame(src: string, loc: ErrorPayload['err']['loc']): string export function resolveDependency(dep: string, astroConfig: AstroConfig) { const resolved = resolve.sync(dep, { - basedir: fileURLToPath(astroConfig.projectRoot) + basedir: fileURLToPath(astroConfig.projectRoot), }); // For Windows compat, we need a fully resolved `file://` URL string return pathToFileURL(resolved).toString(); diff --git a/packages/astro/src/core/vite.ts b/packages/astro/src/core/vite.ts index 24b350b89..7ceb4d8a0 100644 --- a/packages/astro/src/core/vite.ts +++ b/packages/astro/src/core/vite.ts @@ -1,2 +1,2 @@ export * from '../../vendor/vite/dist/node/index.js'; -export { default } from '../../vendor/vite/dist/node/index.js'; \ No newline at end of file +export { default } from '../../vendor/vite/dist/node/index.js'; diff --git a/packages/astro/src/runtime/server/index.ts b/packages/astro/src/runtime/server/index.ts index 7a41ef7ab..6e56a336e 100644 --- a/packages/astro/src/runtime/server/index.ts +++ b/packages/astro/src/runtime/server/index.ts @@ -365,13 +365,17 @@ export async function renderToString(result: SSRResult, componentFactory: AstroC const uniqueElements = (item: any, index: number, all: any[]) => { const props = JSON.stringify(item.props); const children = item.children; - return index === all.findIndex(i => JSON.stringify(i.props) === props && i.children == children) -} + return index === all.findIndex((i) => JSON.stringify(i.props) === props && i.children == children); +}; export async function renderPage(result: SSRResult, Component: AstroComponentFactory, props: any, children: any) { const template = await renderToString(result, Component, props, children); - const styles = Array.from(result.styles).filter(uniqueElements).map((style) => renderElement('style', style)); - const scripts = Array.from(result.scripts).filter(uniqueElements).map((script) => renderElement('script', script)); + const styles = Array.from(result.styles) + .filter(uniqueElements) + .map((style) => renderElement('style', style)); + const scripts = Array.from(result.scripts) + .filter(uniqueElements) + .map((script) => renderElement('script', script)); return template.replace('', styles.join('\n') + scripts.join('\n') + ''); } diff --git a/packages/astro/src/runtime/server/metadata.ts b/packages/astro/src/runtime/server/metadata.ts index 904afd8b5..2b318ad80 100644 --- a/packages/astro/src/runtime/server/metadata.ts +++ b/packages/astro/src/runtime/server/metadata.ts @@ -60,7 +60,7 @@ class Metadata { } interface CreateMetadataOptions { - modules: ModuleInfo[]; + modules: ModuleInfo[]; hydratedComponents: any[]; hoisted: any[]; } diff --git a/packages/astro/src/vite-plugin-astro-postprocess/index.ts b/packages/astro/src/vite-plugin-astro-postprocess/index.ts index c4f4f1ab5..2d4e2776c 100644 --- a/packages/astro/src/vite-plugin-astro-postprocess/index.ts +++ b/packages/astro/src/vite-plugin-astro-postprocess/index.ts @@ -11,7 +11,7 @@ interface AstroPluginOptions { devServer?: AstroDevServer; } -// esbuild transforms the component-scoped Astro into Astro2, so need to check both. +// 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 { diff --git a/packages/astro/test/astro-basic.test.js b/packages/astro/test/astro-basic.test.js index 8be22d617..e1991634b 100644 --- a/packages/astro/test/astro-basic.test.js +++ b/packages/astro/test/astro-basic.test.js @@ -94,4 +94,4 @@ describe('Astro basics', () => { expect(result.status).to.equal(404); }); }); -}); \ No newline at end of file +}); diff --git a/packages/astro/test/astro-dynamic.test.js b/packages/astro/test/astro-dynamic.test.js index 78f35a45d..82fdc3818 100644 --- a/packages/astro/test/astro-dynamic.test.js +++ b/packages/astro/test/astro-dynamic.test.js @@ -13,8 +13,8 @@ describe('Dynamic components', () => { it('Loads packages that only run code in client', async () => { const html = await fixture.readFile('/index.html'); - const $ = cheerio.load(html) - expect($('script').length).to.eq(2) + const $ = cheerio.load(html); + expect($('script').length).to.eq(2); }); it('Loads pages using client:media hydrator', async () => { diff --git a/packages/astro/test/astro-markdown-plugins.test.js b/packages/astro/test/astro-markdown-plugins.test.js index a094b54be..4aed4c295 100644 --- a/packages/astro/test/astro-markdown-plugins.test.js +++ b/packages/astro/test/astro-markdown-plugins.test.js @@ -3,7 +3,6 @@ import cheerio from 'cheerio'; import { loadFixture } from './test-utils.js'; import markdownRemark from '@astrojs/markdown-remark'; - describe('Astro Markdown plugins', () => { let fixture; @@ -12,13 +11,16 @@ describe('Astro Markdown plugins', () => { projectRoot: './fixtures/astro-markdown-plugins/', renderers: ['@astrojs/renderer-preact'], markdownOptions: { - render: [markdownRemark, { - remarkPlugins: ['remark-code-titles', 'remark-slug', ['rehype-autolink-headings', { behavior: 'prepend' }]], - rehypePlugins: [ - ['rehype-toc', { headings: ['h2', 'h3'] }], - ['rehype-add-classes', { 'h1,h2,h3': 'title' }], - ], - }], + render: [ + markdownRemark, + { + remarkPlugins: ['remark-code-titles', 'remark-slug', ['rehype-autolink-headings', { behavior: 'prepend' }]], + rehypePlugins: [ + ['rehype-toc', { headings: ['h2', 'h3'] }], + ['rehype-add-classes', { 'h1,h2,h3': 'title' }], + ], + }, + ], }, buildOptions: { sitemap: false, @@ -48,4 +50,4 @@ describe('Astro Markdown plugins', () => { // teste 2: Added .title to h1 expect($('#hello-world').hasClass('title')).to.equal(true); }); -}); \ No newline at end of file +}); diff --git a/packages/astro/test/astro-markdown.test.js b/packages/astro/test/astro-markdown.test.js index a12625429..de3a1f996 100644 --- a/packages/astro/test/astro-markdown.test.js +++ b/packages/astro/test/astro-markdown.test.js @@ -59,7 +59,7 @@ describe('Astro Markdown', () => { // test 1:
 tag has scopedStyle class passed down
     expect($('pre').is('[class]')).to.equal(true);
-    expect($('pre').attr('class').split(' ').length).to.equal(2)
+    expect($('pre').attr('class').split(' ').length).to.equal(2);
 
     // test 2: 
 tag has correct language
     expect($('pre').hasClass('language-js')).to.equal(true);
@@ -117,7 +117,7 @@ describe('Astro Markdown', () => {
     expect($('code:nth-child(2)').text()).to.equal('{...props}');
 
     // test 4: Rendered curly braces markdown content
-    expect($('code:last-child').text()).to.equal('{/* JavaScript *\/}');
+    expect($('code:last-child').text()).to.equal('{/* JavaScript */}');
   });
 
   it('Does not close parent early when using content attribute (#494)', async () => {
@@ -140,4 +140,4 @@ describe('Astro Markdown', () => {
     // test Markdown rendered correctly via content prop
     expect($('h1').text()).to.equal('Foo');
   });
-});
\ No newline at end of file
+});
diff --git a/packages/astro/test/astro-sitemap-rss.test.js b/packages/astro/test/astro-sitemap-rss.test.js
index f8736ee10..33a6621eb 100644
--- a/packages/astro/test/astro-sitemap-rss.test.js
+++ b/packages/astro/test/astro-sitemap-rss.test.js
@@ -24,7 +24,7 @@ describe('Sitemaps', () => {
       );
     });
   });
-  
+
   describe('Sitemap Generation', () => {
     it('Generates Sitemap correctly', async () => {
       let sitemap = await fixture.readFile('/sitemap.xml');
@@ -33,4 +33,4 @@ describe('Sitemaps', () => {
       );
     });
   });
-});
\ No newline at end of file
+});
diff --git a/packages/astro/test/astro-slots.test.js b/packages/astro/test/astro-slots.test.js
index 9401dc7f3..1e65ce737 100644
--- a/packages/astro/test/astro-slots.test.js
+++ b/packages/astro/test/astro-slots.test.js
@@ -112,4 +112,4 @@ describe('Slots', () => {
       expect($('#default')).to.have.lengthOf(1); // the default slot is filled
     }
   });
-});
\ No newline at end of file
+});
diff --git a/packages/astro/test/config.test.js b/packages/astro/test/config.test.js
index b36065945..693a74ab7 100644
--- a/packages/astro/test/config.test.js
+++ b/packages/astro/test/config.test.js
@@ -4,7 +4,7 @@ import { devCLI, loadFixture } from './test-utils.js';
 describe('config', () => {
   let hostnameFixture;
   let portFixture;
-  
+
   before(async () => {
     [hostnameFixture, portFixture] = await Promise.all([loadFixture({ projectRoot: './fixtures/config-hostname/' }), loadFixture({ projectRoot: './fixtures/config-port/' })]);
   });
diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts
index a5fb403d4..5c707a4db 100644
--- a/packages/markdown/remark/src/index.ts
+++ b/packages/markdown/remark/src/index.ts
@@ -32,17 +32,17 @@ export const DEFAULT_REMARK_PLUGINS = [
   'remark-footnotes',
   // TODO: reenable smartypants!
   // '@silvenon/remark-smartypants'
-]
+];
 
 export const DEFAULT_REHYPE_PLUGINS = [
   // empty
-]
+];
 
 /** Shared utility for rendering markdown */
 export async function renderMarkdown(content: string, opts?: MarkdownRenderingOptions | null) {
   const { remarkPlugins = DEFAULT_REMARK_PLUGINS, rehypePlugins = DEFAULT_REHYPE_PLUGINS } = opts ?? {};
   const scopedClassName = opts?.$?.scopedClassName;
-  const mode = opts?.mode ?? "mdx";
+  const mode = opts?.mode ?? 'mdx';
   const isMDX = mode === 'mdx';
   const { headers, rehypeCollectHeaders } = createCollectHeaders();
 
@@ -52,7 +52,7 @@ export async function renderMarkdown(content: string, opts?: MarkdownRenderingOp
     .use(markdown)
     .use(isMDX ? [remarkJsx] : [])
     .use(isMDX ? [remarkExpressions] : [])
-    .use([remarkUnwrap])
+    .use([remarkUnwrap]);
 
   const loadedRemarkPlugins = await Promise.all(loadPlugins(remarkPlugins));
   const loadedRehypePlugins = await Promise.all(loadPlugins(rehypePlugins));
@@ -62,28 +62,25 @@ export async function renderMarkdown(content: string, opts?: MarkdownRenderingOp
   });
 
   if (scopedClassName) {
-     parser.use([scopedStyles(scopedClassName)]);
+    parser.use([scopedStyles(scopedClassName)]);
   }
 
   parser.use([remarkPrism(scopedClassName)]);
-  parser.use([[markdownToHtml as any, { allowDangerousHtml: true, passThrough: ['raw', 'mdxTextExpression', 'mdxJsxTextElement', 'mdxJsxFlowElement']}]]);
+  parser.use([[markdownToHtml as any, { allowDangerousHtml: true, passThrough: ['raw', 'mdxTextExpression', 'mdxJsxTextElement', 'mdxJsxFlowElement'] }]]);
 
   loadedRehypePlugins.forEach(([plugin, opts]) => {
     parser.use([[plugin, opts]]);
   });
-  
+
   parser
     .use(isMDX ? [rehypeJsx] : [])
     .use(isMDX ? [rehypeExpressions] : [])
     .use(isMDX ? [] : [rehypeRaw])
-    .use(rehypeIslands)
+    .use(rehypeIslands);
 
   let result: string;
   try {
-    const vfile = await parser
-    .use([rehypeCollectHeaders])
-      .use(rehypeStringify, { allowDangerousHtml: true })
-      .process(content);
+    const vfile = await parser.use([rehypeCollectHeaders]).use(rehypeStringify, { allowDangerousHtml: true }).process(content);
     result = vfile.toString();
   } catch (err) {
     console.error(err);
diff --git a/packages/markdown/remark/src/rehype-islands.ts b/packages/markdown/remark/src/rehype-islands.ts
index 099dc4d75..b98419cd4 100644
--- a/packages/markdown/remark/src/rehype-islands.ts
+++ b/packages/markdown/remark/src/rehype-islands.ts
@@ -1,4 +1,4 @@
-import {SKIP, visit} from 'unist-util-visit';
+import { SKIP, visit } from 'unist-util-visit';
 
 // This fixes some confusing bugs coming from somewhere inside of our Markdown pipeline.
 // `unist`/`remark`/`rehype` (not sure) often generate malformed HTML inside of 
@@ -11,11 +11,11 @@ export default function rehypeIslands(): any {
       if (el.tagName == 'astro-root') {
         visit(el, 'text', (child, index, parent) => {
           if (child.type === 'text') {
-            // Sometimes comments can be trapped as text, which causes them to be escaped 
+            // Sometimes comments can be trapped as text, which causes them to be escaped
             // This casts them back to real HTML comments
             if (parent && child.value.indexOf('', '').trim()});
-              return [SKIP, index]
+              parent.children.splice(index, 1, { ...child, type: 'comment', value: child.value.replace('', '').trim() });
+              return [SKIP, index];
             }
             // For some reason `rehype` likes to inject extra linebreaks,
             // but React and Vue throw hydration errors when they see these!
@@ -24,7 +24,7 @@ export default function rehypeIslands(): any {
             child.value = child.value.replace(/\n+/g, '');
             return child;
           }
-        })
+        });
       }
     });
   };
diff --git a/packages/markdown/remark/src/rehype-jsx.ts b/packages/markdown/remark/src/rehype-jsx.ts
index c5270e2af..94632efed 100644
--- a/packages/markdown/remark/src/rehype-jsx.ts
+++ b/packages/markdown/remark/src/rehype-jsx.ts
@@ -5,22 +5,22 @@ export default function rehypeJsx(): any {
   return function (node: any): any {
     return map(node, (child: any) => {
       if (child.type === 'element') {
-        return { ...child, tagName: `${child.tagName}` }
+        return { ...child, tagName: `${child.tagName}` };
       }
       if (MDX_ELEMENTS.has(child.type)) {
-        return { 
+        return {
           ...child,
           type: 'element',
           tagName: `${child.name}`,
           properties: child.attributes.reduce((acc: any[], entry: any) => {
             let attr = entry.value;
             if (attr && typeof attr === 'object') {
-              attr = `{${attr.value}}`
+              attr = `{${attr.value}}`;
             } else if (attr === null) {
-              attr = `{true}`
+              attr = `{true}`;
             }
             return Object.assign(acc, { [entry.name]: attr });
-          }, {})
+          }, {}),
         };
       }
       return child;
diff --git a/packages/markdown/remark/src/remark-prism.ts b/packages/markdown/remark/src/remark-prism.ts
index d8dd8d922..d7a4ff996 100644
--- a/packages/markdown/remark/src/remark-prism.ts
+++ b/packages/markdown/remark/src/remark-prism.ts
@@ -4,26 +4,24 @@ import { addAstro } from '@astrojs/prism';
 import loadLanguages from 'prismjs/components/index.js';
 const noVisit = new Set(['root', 'html', 'text']);
 
-const languageMap = new Map([
-  ['ts', 'typescript']
-]);
+const languageMap = new Map([['ts', 'typescript']]);
 
 function runHighlighter(lang: string, code: string) {
-  let classLanguage = `language-${lang}`
+  let classLanguage = `language-${lang}`;
 
   if (lang == null) {
     lang = 'plaintext';
   }
 
   const ensureLoaded = (lang: string) => {
-    if(lang && !Prism.languages[lang]) {
+    if (lang && !Prism.languages[lang]) {
       loadLanguages([lang]);
     }
   };
 
-  if(languageMap.has(lang)) {
+  if (languageMap.has(lang)) {
     ensureLoaded(languageMap.get(lang)!);
-  } else if(lang === 'astro') {
+  } else if (lang === 'astro') {
     ensureLoaded('typescript');
     addAstro(Prism);
   } else {
@@ -31,7 +29,7 @@ function runHighlighter(lang: string, code: string) {
     ensureLoaded(lang);
   }
 
-  if(lang && !Prism.languages[lang]) {
+  if (lang && !Prism.languages[lang]) {
     console.warn(`Unable to load the language: ${lang}`);
   }
 
@@ -48,26 +46,25 @@ type MaybeString = string | null | undefined;
 
 /**  */
 function transformer(className: MaybeString) {
-  return function(tree: any) {
+  return function (tree: any) {
     const visitor = (node: any) => {
-      let {lang, value} = node;
+      let { lang, value } = node;
       node.type = 'html';
 
       let { html, classLanguage } = runHighlighter(lang, value);
       let classes = [classLanguage];
-      if(className) {
+      if (className) {
         classes.push(className);
       }
       node.value = `
${html}
`; return node; }; - return visit(tree, 'code', visitor) - } + return visit(tree, 'code', visitor); + }; } - function plugin(className: MaybeString) { return transformer.bind(null, className); } -export default plugin; \ No newline at end of file +export default plugin; diff --git a/packages/markdown/remark/src/remark-slug.ts b/packages/markdown/remark/src/remark-slug.ts index b7c9c29de..4454d1087 100644 --- a/packages/markdown/remark/src/remark-slug.ts +++ b/packages/markdown/remark/src/remark-slug.ts @@ -3,11 +3,11 @@ * @typedef {import('hast').Properties} Properties */ -import {toString} from 'mdast-util-to-string' -import {visit} from 'unist-util-visit' -import BananaSlug from 'github-slugger' +import { toString } from 'mdast-util-to-string'; +import { visit } from 'unist-util-visit'; +import BananaSlug from 'github-slugger'; -const slugs = new BananaSlug() +const slugs = new BananaSlug(); /** * Plugin to add anchors headings using GitHub’s algorithm. @@ -16,19 +16,17 @@ const slugs = new BananaSlug() */ export default function remarkSlug() { return (tree: any) => { - slugs.reset() + slugs.reset(); visit(tree, (node) => { console.log(node); }); visit(tree, 'heading', (node) => { - const data = node.data || (node.data = {}) - const props = /** @type {Properties} */ ( - data.hProperties || (data.hProperties = {}) - ) - let id = props.id - id = id ? slugs.slug(String(id), true) : slugs.slug(toString(node)) + const data = node.data || (node.data = {}); + const props = /** @type {Properties} */ data.hProperties || (data.hProperties = {}); + let id = props.id; + id = id ? slugs.slug(String(id), true) : slugs.slug(toString(node)); data.id = id; props.id = id; - }) - } + }); + }; } diff --git a/packages/markdown/remark/src/remark-unwrap.ts b/packages/markdown/remark/src/remark-unwrap.ts index e43a57a0c..d6f3275ab 100644 --- a/packages/markdown/remark/src/remark-unwrap.ts +++ b/packages/markdown/remark/src/remark-unwrap.ts @@ -1,4 +1,4 @@ -import {visit, SKIP} from 'unist-util-visit' +import { visit, SKIP } from 'unist-util-visit'; // Remove the wrapping paragraph for islands export default function remarkUnwrap() { @@ -18,21 +18,17 @@ export default function remarkUnwrap() { insideAstroRoot = false; } astroRootNodes.add(node); - }) + }); visit(tree, 'paragraph', (node, index, parent) => { - if ( - parent && - typeof index === 'number' && - containsAstroRootNode(node) - ) { - parent.children.splice(index, 1, ...node.children) - return [SKIP, index] + if (parent && typeof index === 'number' && containsAstroRootNode(node)) { + parent.children.splice(index, 1, ...node.children); + return [SKIP, index]; } - }) - } + }); + }; function containsAstroRootNode(node: any) { - return node.children.map((child: any) => astroRootNodes.has(child)).reduce((all: boolean, v: boolean) => all ? all : v, false) + return node.children.map((child: any) => astroRootNodes.has(child)).reduce((all: boolean, v: boolean) => (all ? all : v), false); } } diff --git a/packages/markdown/remark/src/types.ts b/packages/markdown/remark/src/types.ts index 201e50931..8ae7795d0 100644 --- a/packages/markdown/remark/src/types.ts +++ b/packages/markdown/remark/src/types.ts @@ -4,7 +4,7 @@ export type UnifiedPluginImport = Promise<{ default: unified.Plugin }>; export type Plugin = string | [string, any] | UnifiedPluginImport | [UnifiedPluginImport, any]; export interface AstroMarkdownOptions { - mode?: 'md'|'mdx'; + mode?: 'md' | 'mdx'; remarkPlugins?: Plugin[]; rehypePlugins?: Plugin[]; } diff --git a/packages/renderers/renderer-lit/hydration-support.js b/packages/renderers/renderer-lit/hydration-support.js index a7508a6c1..0c21646fb 100644 --- a/packages/renderers/renderer-lit/hydration-support.js +++ b/packages/renderers/renderer-lit/hydration-support.js @@ -1 +1 @@ -import 'lit/experimental-hydrate-support.js'; \ No newline at end of file +import 'lit/experimental-hydrate-support.js'; diff --git a/packages/renderers/renderer-lit/index.js b/packages/renderers/renderer-lit/index.js index 5050618fd..f08c2fef8 100644 --- a/packages/renderers/renderer-lit/index.js +++ b/packages/renderers/renderer-lit/index.js @@ -20,7 +20,7 @@ export default { '@webcomponents/template-shadowroot/template-shadowroot.js', 'lit/experimental-hydrate-support.js', ], - exclude: ['@astrojs/renderer-lit/server.js'] + exclude: ['@astrojs/renderer-lit/server.js'], }, ssr: { external: [ diff --git a/packages/renderers/renderer-preact/compat/index.js b/packages/renderers/renderer-preact/compat/index.js index f79998fa4..d88b598a7 100644 --- a/packages/renderers/renderer-preact/compat/index.js +++ b/packages/renderers/renderer-preact/compat/index.js @@ -15,7 +15,7 @@ export default { return { alias: { react: 'preact/compat', - 'react-dom': 'preact/compat' + 'react-dom': 'preact/compat', }, resolve: { dedupe: ['react', 'react-dom'],