From 5156c4f90e0922f62d25fa0c82bbefae39f4c2b6 Mon Sep 17 00:00:00 2001 From: Thiti Yamsung Date: Thu, 1 Jun 2023 21:34:02 +0700 Subject: [PATCH 01/11] fix: build fail upon have 'process.env' in *.md file. (#7257) --- .changeset/pink-ghosts-end.md | 5 +++++ packages/astro/src/vite-plugin-utils/index.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/pink-ghosts-end.md diff --git a/.changeset/pink-ghosts-end.md b/.changeset/pink-ghosts-end.md new file mode 100644 index 000000000000..7eaa13010f7a --- /dev/null +++ b/.changeset/pink-ghosts-end.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +fix: build fail upon have 'process.env' in \*.md file. diff --git a/packages/astro/src/vite-plugin-utils/index.ts b/packages/astro/src/vite-plugin-utils/index.ts index fb10de1ee934..b9cc6057649d 100644 --- a/packages/astro/src/vite-plugin-utils/index.ts +++ b/packages/astro/src/vite-plugin-utils/index.ts @@ -14,7 +14,9 @@ import { viteID } from '../core/util.js'; * in our JS representation of modules like Markdown */ export function escapeViteEnvReferences(code: string) { - return code.replace(/import\.meta\.env/g, 'import\\u002Emeta.env'); + return code + .replace(/import\.meta\.env/g, 'import\\u002Emeta.env') + .replace(/process\.env/g, 'process\\u002Eenv'); } export function getFileInfo(id: string, config: AstroConfig) { From 408be72d1da76953b8bbd23de680959310e0064f Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Thu, 1 Jun 2023 13:21:55 -0500 Subject: [PATCH 02/11] Fix duplicate `semver minor` blocks (#7269) * chore(action): fix duplicate blocks * chore(action): fix block logic --- .github/workflows/check-merge.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/check-merge.yml b/.github/workflows/check-merge.yml index 990d1f84614c..4800601ba44a 100644 --- a/.github/workflows/check-merge.yml +++ b/.github/workflows/check-merge.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check if there is already a block on this PR - id: set-blocks + id: blocked uses: actions/github-script@v6 env: issue_number: ${{ github.event.number }} @@ -23,31 +23,31 @@ jobs: repo: context.repo.repo, pull_number: process.env.issue_number, }); - console.log(reviews); + for (const review of reviews) { - if (review.user.id === 41898282 && review.state === 'CHANGES_REQUESTED') { - return 'block'; + if (review.user.login === 'github-actions[bot]' && review.state === 'CHANGES_REQUESTED') { + return 'true' } } - return ''; + return 'false' result-encoding: string - uses: actions/checkout@v3 - if: steps.set-blocks.outputs.blocks == '' + if: steps.blocked.outputs.result != 'true' with: fetch-depth: 0 - name: Get changed files in the .changeset folder id: changed-files uses: tj-actions/changed-files@v35 - if: steps.set-blocks.outputs.blocks == '' + if: steps.blocked.outputs.result != 'true' with: files: | .changeset/**/*.md - name: Check if any changesets contain minor changes - id: find-blockers - if: steps.set-blocks.outputs.blocks == '' + id: minor + if: steps.blocked.outputs.result != 'true' run: | echo "Checking for changesets marked as minor" echo '::set-output name=found::false' @@ -60,7 +60,7 @@ jobs: - name: Add label uses: actions/github-script@v6 - if: steps.find-blockers.outputs.found == 'true' + if: steps.minor.outputs.found == 'true' env: issue_number: ${{ github.event.number }} with: @@ -74,7 +74,7 @@ jobs: - name: Change PR Status uses: actions/github-script@v6 - if: steps.find-blockers.outputs.found == 'true' + if: steps.minor.outputs.found == 'true' env: issue_number: ${{ github.event.number }} with: @@ -86,4 +86,3 @@ jobs: event: 'REQUEST_CHANGES', body: 'This PR is blocked because it contains a `minor` changeset. A reviewer will merge this at the next release if approved.' }); - From dff0d0dda2f20c02901594739a654834d3451c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Alves?= <71379045+andremralves@users.noreply.github.com> Date: Fri, 2 Jun 2023 05:07:44 -0300 Subject: [PATCH 03/11] Fix sitemap filter (#7263) --- .changeset/eight-planes-drop.md | 5 ++ packages/integrations/sitemap/src/index.ts | 4 +- .../integrations/sitemap/test/filter.test.js | 46 +++++++++++++++++++ .../sitemap/test/fixtures/static/deps.mjs | 1 + 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 .changeset/eight-planes-drop.md create mode 100644 packages/integrations/sitemap/test/filter.test.js create mode 100644 packages/integrations/sitemap/test/fixtures/static/deps.mjs diff --git a/.changeset/eight-planes-drop.md b/.changeset/eight-planes-drop.md new file mode 100644 index 000000000000..8ebef4be5135 --- /dev/null +++ b/.changeset/eight-planes-drop.md @@ -0,0 +1,5 @@ +--- +'@astrojs/sitemap': patch +--- + +Fix sitemap does not filter pages diff --git a/packages/integrations/sitemap/src/index.ts b/packages/integrations/sitemap/src/index.ts index 46ff694fd619..13df4d1ae981 100644 --- a/packages/integrations/sitemap/src/index.ts +++ b/packages/integrations/sitemap/src/index.ts @@ -118,6 +118,8 @@ const createPlugin = (options?: SitemapOptions): AstroIntegration => { return urls; }, []); + pageUrls = Array.from(new Set([...pageUrls, ...routeUrls, ...(customPages ?? [])])); + try { if (filter) { pageUrls = pageUrls.filter(filter); @@ -127,8 +129,6 @@ const createPlugin = (options?: SitemapOptions): AstroIntegration => { return; } - pageUrls = Array.from(new Set([...pageUrls, ...routeUrls, ...(customPages ?? [])])); - if (pageUrls.length === 0) { logger.warn(`No pages found!\n\`${OUTFILE}\` not created.`); return; diff --git a/packages/integrations/sitemap/test/filter.test.js b/packages/integrations/sitemap/test/filter.test.js new file mode 100644 index 000000000000..65a418e87825 --- /dev/null +++ b/packages/integrations/sitemap/test/filter.test.js @@ -0,0 +1,46 @@ +import { loadFixture, readXML } from './test-utils.js'; +import { expect } from 'chai'; +import { sitemap } from './fixtures/static/deps.mjs'; + +describe('Filter support', () => { + /** @type {import('./test-utils.js').Fixture} */ + let fixture; + + describe('Static', () => { + before(async () => { + fixture = await loadFixture({ + root: './fixtures/static/', + integrations: [sitemap({ + filter: (page) => page !== 'http://example.com/two/' + })], + }); + await fixture.build(); + }); + + it('Just one page is added', async () => { + const data = await readXML(fixture.readFile('/sitemap-0.xml')); + const urls = data.urlset.url; + expect(urls.length).to.equal(1); + }); + }); + + describe('SSR', () => { + before(async () => { + fixture = await loadFixture({ + root: './fixtures/ssr/', + integrations: [sitemap({ + filter: (page) => page !== 'http://example.com/two/' + })], + }); + await fixture.build(); + }); + + it('Just one page is added', async () => { + const data = await readXML(fixture.readFile('/client/sitemap-0.xml')); + const urls = data.urlset.url; + expect(urls.length).to.equal(1); + }); + }); + +}); + diff --git a/packages/integrations/sitemap/test/fixtures/static/deps.mjs b/packages/integrations/sitemap/test/fixtures/static/deps.mjs new file mode 100644 index 000000000000..b24f26189736 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/static/deps.mjs @@ -0,0 +1 @@ +export { default as sitemap } from '@astrojs/sitemap'; From 6b8d55b09665712e10309f0f3ef6d25eb96c6f37 Mon Sep 17 00:00:00 2001 From: bluwy Date: Fri, 2 Jun 2023 08:10:03 +0000 Subject: [PATCH 04/11] [ci] format --- .../integrations/sitemap/test/filter.test.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/integrations/sitemap/test/filter.test.js b/packages/integrations/sitemap/test/filter.test.js index 65a418e87825..50a34007dd5d 100644 --- a/packages/integrations/sitemap/test/filter.test.js +++ b/packages/integrations/sitemap/test/filter.test.js @@ -10,9 +10,11 @@ describe('Filter support', () => { before(async () => { fixture = await loadFixture({ root: './fixtures/static/', - integrations: [sitemap({ - filter: (page) => page !== 'http://example.com/two/' - })], + integrations: [ + sitemap({ + filter: (page) => page !== 'http://example.com/two/', + }), + ], }); await fixture.build(); }); @@ -28,9 +30,11 @@ describe('Filter support', () => { before(async () => { fixture = await loadFixture({ root: './fixtures/ssr/', - integrations: [sitemap({ - filter: (page) => page !== 'http://example.com/two/' - })], + integrations: [ + sitemap({ + filter: (page) => page !== 'http://example.com/two/', + }), + ], }); await fixture.build(); }); @@ -41,6 +45,4 @@ describe('Filter support', () => { expect(urls.length).to.equal(1); }); }); - }); - From fea30693609cc517d8660972151f4d12a0dd4e82 Mon Sep 17 00:00:00 2001 From: Johannes Spohr Date: Fri, 2 Jun 2023 10:46:12 +0200 Subject: [PATCH 05/11] Parallel array rendering (#7136) --- .changeset/olive-gorillas-cheat.md | 5 +++++ .../astro/src/runtime/server/render/any.ts | 6 ++++-- .../server/render/astro/render-template.ts | 18 +++++------------- .../astro/src/runtime/server/render/util.ts | 17 +++++++++++++++++ .../fixtures/parallel/src/pages/index.astro | 3 ++- 5 files changed, 33 insertions(+), 16 deletions(-) create mode 100644 .changeset/olive-gorillas-cheat.md diff --git a/.changeset/olive-gorillas-cheat.md b/.changeset/olive-gorillas-cheat.md new file mode 100644 index 000000000000..0c20121ab365 --- /dev/null +++ b/.changeset/olive-gorillas-cheat.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Render arrays of components in parallel diff --git a/packages/astro/src/runtime/server/render/any.ts b/packages/astro/src/runtime/server/render/any.ts index cded2c49603f..4ee947ee6e89 100644 --- a/packages/astro/src/runtime/server/render/any.ts +++ b/packages/astro/src/runtime/server/render/any.ts @@ -5,6 +5,7 @@ import { renderAstroTemplateResult, } from './astro/index.js'; import { SlotString } from './slot.js'; +import { bufferIterators } from './util.js'; export async function* renderChild(child: any): AsyncIterable { child = await child; @@ -16,8 +17,9 @@ export async function* renderChild(child: any): AsyncIterable { } else if (isHTMLString(child)) { yield child; } else if (Array.isArray(child)) { - for (const value of child) { - yield markHTMLString(await renderChild(value)); + const bufferedIterators = bufferIterators(child.map((c) => renderChild(c))); + for (const value of bufferedIterators) { + yield markHTMLString(await value); } } else if (typeof child === 'function') { // Special: If a child is a function, call it automatically. diff --git a/packages/astro/src/runtime/server/render/astro/render-template.ts b/packages/astro/src/runtime/server/render/astro/render-template.ts index 2433596bdcad..b0dbabdc1910 100644 --- a/packages/astro/src/runtime/server/render/astro/render-template.ts +++ b/packages/astro/src/runtime/server/render/astro/render-template.ts @@ -3,7 +3,7 @@ import type { RenderInstruction } from '../types'; import { HTMLBytes, markHTMLString } from '../../escape.js'; import { isPromise } from '../../util.js'; import { renderChild } from '../any.js'; -import { EagerAsyncIterableIterator } from '../util.js'; +import { bufferIterators } from '../util.js'; const renderTemplateResultSym = Symbol.for('astro.renderTemplateResult'); @@ -36,23 +36,15 @@ export class RenderTemplateResult { async *[Symbol.asyncIterator]() { const { htmlParts, expressions } = this; - let iterables: Array = []; - // all async iterators start running in non-buffered mode to avoid useless caching - for (let i = 0; i < htmlParts.length; i++) { - iterables.push(new EagerAsyncIterableIterator(renderChild(expressions[i]))); - } - // once the execution of the next for loop is suspended due to an async component, - // this timeout triggers and we start buffering the other iterators - setTimeout(() => { - // buffer all iterators that haven't started yet - iterables.forEach((it) => !it.isStarted() && it.buffer()); - }, 0); + let iterables = bufferIterators(expressions.map((e) => renderChild(e))); for (let i = 0; i < htmlParts.length; i++) { const html = htmlParts[i]; const iterable = iterables[i]; yield markHTMLString(html); - yield* iterable; + if (iterable) { + yield* iterable; + } } } } diff --git a/packages/astro/src/runtime/server/render/util.ts b/packages/astro/src/runtime/server/render/util.ts index c2599401dace..1f0aae047b34 100644 --- a/packages/astro/src/runtime/server/render/util.ts +++ b/packages/astro/src/runtime/server/render/util.ts @@ -139,6 +139,23 @@ export function renderElement( return `<${name}${internalSpreadAttributes(props, shouldEscape)}>${children}`; } +/** + * This will take an array of async iterables and start buffering them eagerly. + * To avoid useless buffering, it will only start buffering the next tick, so the + * first sync iterables won't be buffered. + */ +export function bufferIterators(iterators: AsyncIterable[]): AsyncIterable[] { + // all async iterators start running in non-buffered mode to avoid useless caching + const eagerIterators = iterators.map((it) => new EagerAsyncIterableIterator(it)); + // once the execution of the next for loop is suspended due to an async component, + // this timeout triggers and we start buffering the other iterators + setTimeout(() => { + // buffer all iterators that haven't started yet + eagerIterators.forEach((it) => !it.isStarted() && it.buffer()); + }, 0); + return eagerIterators; +} + // This wrapper around an AsyncIterable can eagerly consume its values, so that // its values are ready to yield out ASAP. This is used for list-like usage of // Astro components, so that we don't have to wait on earlier components to run diff --git a/packages/astro/test/fixtures/parallel/src/pages/index.astro b/packages/astro/test/fixtures/parallel/src/pages/index.astro index 952e9efcebc6..b0571103ef43 100644 --- a/packages/astro/test/fixtures/parallel/src/pages/index.astro +++ b/packages/astro/test/fixtures/parallel/src/pages/index.astro @@ -1,8 +1,9 @@ --- -import Delayed from '../components/Delayed.astro' +import Delayed from '../components/Delayed.astro'; --- +{[, , , ]} From 6e27f2f6dbd52f980c487e875faf1b066f65cffd Mon Sep 17 00:00:00 2001 From: Benjamin MENANT Date: Fri, 2 Jun 2023 10:51:09 +0200 Subject: [PATCH 06/11] fix(astro/core/app/node): support http2 requests (#7215) --- .changeset/curvy-pumpkins-remain.md | 5 +++++ packages/astro/src/core/app/node.ts | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .changeset/curvy-pumpkins-remain.md diff --git a/.changeset/curvy-pumpkins-remain.md b/.changeset/curvy-pumpkins-remain.md new file mode 100644 index 000000000000..78849bb4f1ba --- /dev/null +++ b/.changeset/curvy-pumpkins-remain.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Node adapter fallbacks to `:authority` http2 pseudo-header when `host` is nullish. diff --git a/packages/astro/src/core/app/node.ts b/packages/astro/src/core/app/node.ts index 97d7b71d18dd..7097db96762e 100644 --- a/packages/astro/src/core/app/node.ts +++ b/packages/astro/src/core/app/node.ts @@ -14,11 +14,12 @@ function createRequestFromNodeRequest(req: NodeIncomingMessage, body?: Uint8Arra req.socket instanceof TLSSocket || req.headers['x-forwarded-proto'] === 'https' ? 'https' : 'http'; - let url = `${protocol}://${req.headers.host}${req.url}`; - let rawHeaders = req.headers as Record; + const hostname = req.headers.host || req.headers[':authority']; + const url = `${protocol}://${hostname}${req.url}`; + const rawHeaders = req.headers as Record; const entries = Object.entries(rawHeaders); const method = req.method || 'GET'; - let request = new Request(url, { + const request = new Request(url, { method, headers: new Headers(entries), body: ['HEAD', 'GET'].includes(method) ? null : body, From 6533041ce03ff68220afcae470a50b902cc15640 Mon Sep 17 00:00:00 2001 From: bluwy Date: Fri, 2 Jun 2023 08:53:10 +0000 Subject: [PATCH 07/11] [ci] format --- packages/astro/src/core/app/node.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/astro/src/core/app/node.ts b/packages/astro/src/core/app/node.ts index 7097db96762e..6bd2677a79e0 100644 --- a/packages/astro/src/core/app/node.ts +++ b/packages/astro/src/core/app/node.ts @@ -14,7 +14,7 @@ function createRequestFromNodeRequest(req: NodeIncomingMessage, body?: Uint8Arra req.socket instanceof TLSSocket || req.headers['x-forwarded-proto'] === 'https' ? 'https' : 'http'; - const hostname = req.headers.host || req.headers[':authority']; + const hostname = req.headers.host || req.headers[':authority']; const url = `${protocol}://${hostname}${req.url}`; const rawHeaders = req.headers as Record; const entries = Object.entries(rawHeaders); From 9e7366567e2b83d46a46db35e74ad508d1978039 Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Fri, 2 Jun 2023 07:54:50 -0400 Subject: [PATCH 08/11] Content collections: ignored underscore directories in file glob (#7268) * fix: ignored underscore dirs in glob * chore: changeset --- .changeset/rotten-pens-destroy.md | 5 ++++ .../vite-plugin-content-virtual-mod.ts | 24 ++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 .changeset/rotten-pens-destroy.md diff --git a/.changeset/rotten-pens-destroy.md b/.changeset/rotten-pens-destroy.md new file mode 100644 index 000000000000..c8fb408723bc --- /dev/null +++ b/.changeset/rotten-pens-destroy.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix: ignore `.json` files within content collection directories starting with an `_` underscore. diff --git a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts index 838d6b425696..bd516b199c82 100644 --- a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts +++ b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts @@ -44,14 +44,21 @@ export function astroContentVirtualModPlugin({ ) .replace('@@CONTENT_DIR@@', relContentDir) .replace( - '@@CONTENT_ENTRY_GLOB_PATH@@', - // [!_] = ignore files starting with "_" - `${relContentDir}**/[!_]*${getExtGlob(contentEntryExts)}` + "'@@CONTENT_ENTRY_GLOB_PATH@@'", + JSON.stringify(globWithUnderscoresIgnored(relContentDir, contentEntryExts)) ) - .replace('@@DATA_ENTRY_GLOB_PATH@@', `${relContentDir}**/[!_]*${getExtGlob(dataEntryExts)}`) .replace( - '@@RENDER_ENTRY_GLOB_PATH@@', - `${relContentDir}**/*${getExtGlob(/** Note: data collections excluded */ contentEntryExts)}` + "'@@DATA_ENTRY_GLOB_PATH@@'", + JSON.stringify(globWithUnderscoresIgnored(relContentDir, dataEntryExts)) + ) + .replace( + "'@@RENDER_ENTRY_GLOB_PATH@@'", + JSON.stringify( + globWithUnderscoresIgnored( + relContentDir, + /** Note: data collections excluded */ contentEntryExts + ) + ) ); const astroContentVirtualModuleId = '\0' + VIRTUAL_MODULE_ID; @@ -189,3 +196,8 @@ const UnexpectedLookupMapError = new AstroError({ ...AstroErrorData.UnknownContentCollectionError, message: `Unexpected error while parsing content entry IDs and slugs.`, }); + +function globWithUnderscoresIgnored(relContentDir: string, exts: string[]): string[] { + const extGlob = getExtGlob(exts); + return [`${relContentDir}/**/*${extGlob}`, `!**/_*/**${extGlob}`, `!**/_*${extGlob}`]; +} From 96ae37eb09f7406f40fba93e14b2a26ccd46640c Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Fri, 2 Jun 2023 21:05:57 +0800 Subject: [PATCH 09/11] Fix Vitest with content collections (#7233) --- .changeset/fuzzy-papayas-shout.md | 5 +++ packages/astro/src/config/index.ts | 8 ++++ .../src/config/vite-plugin-content-listen.ts | 41 +++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 .changeset/fuzzy-papayas-shout.md create mode 100644 packages/astro/src/config/vite-plugin-content-listen.ts diff --git a/.changeset/fuzzy-papayas-shout.md b/.changeset/fuzzy-papayas-shout.md new file mode 100644 index 000000000000..b10a3cddb6d0 --- /dev/null +++ b/.changeset/fuzzy-papayas-shout.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix `getViteConfig` and Vitest setup with content collections diff --git a/packages/astro/src/config/index.ts b/packages/astro/src/config/index.ts index 6601a7a5acc8..bdd3c492f88d 100644 --- a/packages/astro/src/config/index.ts +++ b/packages/astro/src/config/index.ts @@ -14,17 +14,21 @@ export function getViteConfig(inlineConfig: UserConfig) { // Use dynamic import to avoid pulling in deps unless used const [ + fs, { mergeConfig }, { nodeLogDestination }, { openConfig, createSettings }, { createVite }, { runHookConfigSetup, runHookConfigDone }, + { astroContentListenPlugin }, ] = await Promise.all([ + import('fs'), import('vite'), import('../core/logger/node.js'), import('../core/config/index.js'), import('../core/create-vite.js'), import('../integrations/index.js'), + import('./vite-plugin-content-listen.js'), ]); const logging: LogOptions = { dest: nodeLogDestination, @@ -39,6 +43,10 @@ export function getViteConfig(inlineConfig: UserConfig) { const viteConfig = await createVite( { mode, + plugins: [ + // Initialize the content listener + astroContentListenPlugin({ settings, logging, fs }), + ], }, { settings, logging: logging, mode } ); diff --git a/packages/astro/src/config/vite-plugin-content-listen.ts b/packages/astro/src/config/vite-plugin-content-listen.ts new file mode 100644 index 000000000000..ecd9ea68b768 --- /dev/null +++ b/packages/astro/src/config/vite-plugin-content-listen.ts @@ -0,0 +1,41 @@ +import type fsMod from 'node:fs'; +import type { Plugin, ViteDevServer } from 'vite'; +import type { AstroSettings } from '../@types/astro'; +import { attachContentServerListeners } from '../content/server-listeners.js'; +import type { LogOptions } from '../core/logger/core.js'; + +/** + * Listen for Astro content directory changes and generate types. + * + * This is a separate plugin for `getViteConfig` as the `attachContentServerListeners` API + * needs to be called at different times in `astro dev` and `getViteConfig`. For `astro dev`, + * it needs to be called after the Astro server is started (packages/astro/src/core/dev/dev.ts). + * For `getViteConfig`, it needs to be called after the Vite server is started. + */ +export function astroContentListenPlugin({ + settings, + logging, + fs, +}: { + settings: AstroSettings; + logging: LogOptions; + fs: typeof fsMod; +}): Plugin { + let server: ViteDevServer; + + return { + name: 'astro:content-listen', + apply: 'serve', + configureServer(_server) { + server = _server; + }, + async buildStart() { + await attachContentServerListeners({ + fs: fs, + settings, + logging, + viteServer: server, + }); + }, + }; +} From 6721b1f699b457e83124489b7230cbbf5e8eb560 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Fri, 2 Jun 2023 21:14:44 +0800 Subject: [PATCH 10/11] Run example check in parallel with 5 at most (#7275) --- pnpm-lock.yaml | 3 +++ scripts/package.json | 3 ++- scripts/smoke/check.js | 16 ++++++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dab25439a503..27042e66bfe1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5306,6 +5306,9 @@ importers: kleur: specifier: ^4.1.4 version: 4.1.5 + p-limit: + specifier: ^4.0.0 + version: 4.0.0 svelte: specifier: ^3.48.0 version: 3.58.0 diff --git a/scripts/package.json b/scripts/package.json index 47f65d972c6c..5322af1682f5 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -13,14 +13,15 @@ "esbuild": "^0.17.12", "globby": "^12.2.0", "kleur": "^4.1.4", + "p-limit": "^4.0.0", "svelte": "^3.48.0", "tar": "^6.1.11" }, "devDependencies": { "@octokit/action": "^3.18.1", "del": "^7.0.0", - "execa": "^6.1.0", "esbuild-plugin-copy": "^2.0.2", + "execa": "^6.1.0", "tsconfig-resolver": "^3.0.1" } } diff --git a/scripts/smoke/check.js b/scripts/smoke/check.js index 447a76edc997..aa36a8a5f8a1 100644 --- a/scripts/smoke/check.js +++ b/scripts/smoke/check.js @@ -3,6 +3,7 @@ import { spawn } from 'child_process'; import { readdirSync, readFileSync, writeFileSync } from 'fs'; import * as path from 'path'; +import pLimit from 'p-limit'; import { tsconfigResolverSync } from 'tsconfig-resolver'; function checkExamples() { @@ -11,9 +12,13 @@ function checkExamples() { console.log(`Running astro check on ${examples.length} examples...`); - Promise.all( - examples.map( - (example) => + // Run astro check in parallel with 5 at most + const checkPromises = []; + const limit = pLimit(5); + + for (const example of examples) { + checkPromises.push( + limit(() => new Promise((resolve) => { const originalConfig = prepareExample(example.name); let data = ''; @@ -36,8 +41,11 @@ function checkExamples() { resolve(code); }); }) + ) ) - ).then((codes) => { + } + + Promise.all(checkPromises).then((codes) => { if (codes.some((code) => code !== 0)) { process.exit(1); } From c64dfdd3d83a603449aa2c22765ac0f68193e5d3 Mon Sep 17 00:00:00 2001 From: "Houston (Bot)" <108291165+astrobot-houston@users.noreply.github.com> Date: Fri, 2 Jun 2023 07:51:28 -0700 Subject: [PATCH 11/11] [ci] release (#7254) Co-authored-by: github-actions[bot] --- .changeset/curvy-pumpkins-remain.md | 5 ----- .changeset/eight-planes-drop.md | 5 ----- .changeset/fuzzy-papayas-shout.md | 5 ----- .changeset/many-cats-fry.md | 5 ----- .changeset/olive-gorillas-cheat.md | 5 ----- .changeset/pink-ghosts-end.md | 5 ----- .changeset/rotten-pens-destroy.md | 5 ----- .changeset/smart-moles-double.md | 7 ------- packages/astro/CHANGELOG.md | 16 ++++++++++++++++ packages/astro/package.json | 2 +- packages/integrations/cloudflare/package.json | 2 +- packages/integrations/deno/package.json | 2 +- packages/integrations/image/package.json | 2 +- packages/integrations/markdoc/CHANGELOG.md | 11 +++++++++++ packages/integrations/markdoc/package.json | 4 ++-- packages/integrations/mdx/CHANGELOG.md | 6 ++++++ packages/integrations/mdx/package.json | 2 +- packages/integrations/netlify/package.json | 2 +- packages/integrations/node/package.json | 2 +- packages/integrations/sitemap/CHANGELOG.md | 6 ++++++ packages/integrations/sitemap/package.json | 2 +- packages/integrations/svelte/package.json | 2 +- packages/integrations/tailwind/package.json | 2 +- packages/integrations/vercel/package.json | 2 +- packages/integrations/vue/package.json | 2 +- 25 files changed, 53 insertions(+), 56 deletions(-) delete mode 100644 .changeset/curvy-pumpkins-remain.md delete mode 100644 .changeset/eight-planes-drop.md delete mode 100644 .changeset/fuzzy-papayas-shout.md delete mode 100644 .changeset/many-cats-fry.md delete mode 100644 .changeset/olive-gorillas-cheat.md delete mode 100644 .changeset/pink-ghosts-end.md delete mode 100644 .changeset/rotten-pens-destroy.md delete mode 100644 .changeset/smart-moles-double.md diff --git a/.changeset/curvy-pumpkins-remain.md b/.changeset/curvy-pumpkins-remain.md deleted file mode 100644 index 78849bb4f1ba..000000000000 --- a/.changeset/curvy-pumpkins-remain.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Node adapter fallbacks to `:authority` http2 pseudo-header when `host` is nullish. diff --git a/.changeset/eight-planes-drop.md b/.changeset/eight-planes-drop.md deleted file mode 100644 index 8ebef4be5135..000000000000 --- a/.changeset/eight-planes-drop.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/sitemap': patch ---- - -Fix sitemap does not filter pages diff --git a/.changeset/fuzzy-papayas-shout.md b/.changeset/fuzzy-papayas-shout.md deleted file mode 100644 index b10a3cddb6d0..000000000000 --- a/.changeset/fuzzy-papayas-shout.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fix `getViteConfig` and Vitest setup with content collections diff --git a/.changeset/many-cats-fry.md b/.changeset/many-cats-fry.md deleted file mode 100644 index 75ebfe5014b2..000000000000 --- a/.changeset/many-cats-fry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/markdoc': patch ---- - -Allow HTML comments `` in Markdoc files. diff --git a/.changeset/olive-gorillas-cheat.md b/.changeset/olive-gorillas-cheat.md deleted file mode 100644 index 0c20121ab365..000000000000 --- a/.changeset/olive-gorillas-cheat.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Render arrays of components in parallel diff --git a/.changeset/pink-ghosts-end.md b/.changeset/pink-ghosts-end.md deleted file mode 100644 index 7eaa13010f7a..000000000000 --- a/.changeset/pink-ghosts-end.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -fix: build fail upon have 'process.env' in \*.md file. diff --git a/.changeset/rotten-pens-destroy.md b/.changeset/rotten-pens-destroy.md deleted file mode 100644 index c8fb408723bc..000000000000 --- a/.changeset/rotten-pens-destroy.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fix: ignore `.json` files within content collection directories starting with an `_` underscore. diff --git a/.changeset/smart-moles-double.md b/.changeset/smart-moles-double.md deleted file mode 100644 index 072626ea5160..000000000000 --- a/.changeset/smart-moles-double.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'astro': patch -'@astrojs/markdoc': patch -'@astrojs/mdx': patch ---- - -Bring back improved style and script handling across content collection files. This addresses bugs found in a previous release to `@astrojs/markdoc`. diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 5eefd041584e..64a528e9ac84 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,21 @@ # astro +## 2.5.7 + +### Patch Changes + +- [#7215](https://github.com/withastro/astro/pull/7215) [`6e27f2f6d`](https://github.com/withastro/astro/commit/6e27f2f6dbd52f980c487e875faf1b066f65cffd) Thanks [@bmenant](https://github.com/bmenant)! - Node adapter fallbacks to `:authority` http2 pseudo-header when `host` is nullish. + +- [#7233](https://github.com/withastro/astro/pull/7233) [`96ae37eb0`](https://github.com/withastro/astro/commit/96ae37eb09f7406f40fba93e14b2a26ccd46640c) Thanks [@bluwy](https://github.com/bluwy)! - Fix `getViteConfig` and Vitest setup with content collections + +- [#7136](https://github.com/withastro/astro/pull/7136) [`fea306936`](https://github.com/withastro/astro/commit/fea30693609cc517d8660972151f4d12a0dd4e82) Thanks [@johannesspohr](https://github.com/johannesspohr)! - Render arrays of components in parallel + +- [#7257](https://github.com/withastro/astro/pull/7257) [`5156c4f90`](https://github.com/withastro/astro/commit/5156c4f90e0922f62d25fa0c82bbefae39f4c2b6) Thanks [@thiti-y](https://github.com/thiti-y)! - fix: build fail upon have 'process.env' in \*.md file. + +- [#7268](https://github.com/withastro/astro/pull/7268) [`9e7366567`](https://github.com/withastro/astro/commit/9e7366567e2b83d46a46db35e74ad508d1978039) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Fix: ignore `.json` files within content collection directories starting with an `_` underscore. + +- [#7185](https://github.com/withastro/astro/pull/7185) [`339529fc8`](https://github.com/withastro/astro/commit/339529fc820bac2d514b63198ecf54a1d88c0917) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Bring back improved style and script handling across content collection files. This addresses bugs found in a previous release to `@astrojs/markdoc`. + ## 2.5.6 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index a97848219ab1..9016f86bd5f3 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "2.5.6", + "version": "2.5.7", "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", "type": "module", "author": "withastro", diff --git a/packages/integrations/cloudflare/package.json b/packages/integrations/cloudflare/package.json index ee88d2869bb8..b7add31777d3 100644 --- a/packages/integrations/cloudflare/package.json +++ b/packages/integrations/cloudflare/package.json @@ -42,7 +42,7 @@ "tiny-glob": "^0.2.9" }, "peerDependencies": { - "astro": "workspace:^2.5.6" + "astro": "workspace:^2.5.7" }, "devDependencies": { "astro": "workspace:*", diff --git a/packages/integrations/deno/package.json b/packages/integrations/deno/package.json index 60a8bd0a158d..f3c9a6ec21e3 100644 --- a/packages/integrations/deno/package.json +++ b/packages/integrations/deno/package.json @@ -36,7 +36,7 @@ "esbuild": "^0.15.18" }, "peerDependencies": { - "astro": "workspace:^2.5.6" + "astro": "workspace:^2.5.7" }, "devDependencies": { "astro": "workspace:*", diff --git a/packages/integrations/image/package.json b/packages/integrations/image/package.json index ed7b1cabac05..9cf028390c88 100644 --- a/packages/integrations/image/package.json +++ b/packages/integrations/image/package.json @@ -62,7 +62,7 @@ "vite": "^4.3.1" }, "peerDependencies": { - "astro": "workspace:^2.5.6", + "astro": "workspace:^2.5.7", "sharp": ">=0.31.0" }, "peerDependenciesMeta": { diff --git a/packages/integrations/markdoc/CHANGELOG.md b/packages/integrations/markdoc/CHANGELOG.md index a737acc4c5e3..62693988ca20 100644 --- a/packages/integrations/markdoc/CHANGELOG.md +++ b/packages/integrations/markdoc/CHANGELOG.md @@ -1,5 +1,16 @@ # @astrojs/markdoc +## 0.3.1 + +### Patch Changes + +- [#7224](https://github.com/withastro/astro/pull/7224) [`563293c5d`](https://github.com/withastro/astro/commit/563293c5d67e2bf13b9c735581969a0341861b44) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Allow HTML comments `` in Markdoc files. + +- [#7185](https://github.com/withastro/astro/pull/7185) [`339529fc8`](https://github.com/withastro/astro/commit/339529fc820bac2d514b63198ecf54a1d88c0917) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Bring back improved style and script handling across content collection files. This addresses bugs found in a previous release to `@astrojs/markdoc`. + +- Updated dependencies [[`6e27f2f6d`](https://github.com/withastro/astro/commit/6e27f2f6dbd52f980c487e875faf1b066f65cffd), [`96ae37eb0`](https://github.com/withastro/astro/commit/96ae37eb09f7406f40fba93e14b2a26ccd46640c), [`fea306936`](https://github.com/withastro/astro/commit/fea30693609cc517d8660972151f4d12a0dd4e82), [`5156c4f90`](https://github.com/withastro/astro/commit/5156c4f90e0922f62d25fa0c82bbefae39f4c2b6), [`9e7366567`](https://github.com/withastro/astro/commit/9e7366567e2b83d46a46db35e74ad508d1978039), [`339529fc8`](https://github.com/withastro/astro/commit/339529fc820bac2d514b63198ecf54a1d88c0917)]: + - astro@2.5.7 + ## 0.3.0 ### Minor Changes diff --git a/packages/integrations/markdoc/package.json b/packages/integrations/markdoc/package.json index 369b7163ae05..e4c579e5e6ba 100644 --- a/packages/integrations/markdoc/package.json +++ b/packages/integrations/markdoc/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/markdoc", "description": "Add support for Markdoc in your Astro site", - "version": "0.3.0", + "version": "0.3.1", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", @@ -51,7 +51,7 @@ "zod": "^3.17.3" }, "peerDependencies": { - "astro": "workspace:^2.5.6" + "astro": "workspace:^2.5.7" }, "devDependencies": { "@astrojs/markdown-remark": "^2.2.1", diff --git a/packages/integrations/mdx/CHANGELOG.md b/packages/integrations/mdx/CHANGELOG.md index c5bf908fc17d..7ec9280b692b 100644 --- a/packages/integrations/mdx/CHANGELOG.md +++ b/packages/integrations/mdx/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/mdx +## 0.19.6 + +### Patch Changes + +- [#7185](https://github.com/withastro/astro/pull/7185) [`339529fc8`](https://github.com/withastro/astro/commit/339529fc820bac2d514b63198ecf54a1d88c0917) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Bring back improved style and script handling across content collection files. This addresses bugs found in a previous release to `@astrojs/markdoc`. + ## 0.19.5 ### Patch Changes diff --git a/packages/integrations/mdx/package.json b/packages/integrations/mdx/package.json index 7055444849cc..1c7cd45b3eb3 100644 --- a/packages/integrations/mdx/package.json +++ b/packages/integrations/mdx/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/mdx", "description": "Add support for MDX pages in your Astro site", - "version": "0.19.5", + "version": "0.19.6", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/netlify/package.json b/packages/integrations/netlify/package.json index e1cf6d2caa09..26ba3873fe92 100644 --- a/packages/integrations/netlify/package.json +++ b/packages/integrations/netlify/package.json @@ -42,7 +42,7 @@ "esbuild": "^0.15.18" }, "peerDependencies": { - "astro": "workspace:^2.5.6" + "astro": "workspace:^2.5.7" }, "devDependencies": { "@netlify/edge-functions": "^2.0.0", diff --git a/packages/integrations/node/package.json b/packages/integrations/node/package.json index 25d43d3735e6..74338af4c3e2 100644 --- a/packages/integrations/node/package.json +++ b/packages/integrations/node/package.json @@ -38,7 +38,7 @@ "server-destroy": "^1.0.1" }, "peerDependencies": { - "astro": "workspace:^2.5.6" + "astro": "workspace:^2.5.7" }, "devDependencies": { "@types/send": "^0.17.1", diff --git a/packages/integrations/sitemap/CHANGELOG.md b/packages/integrations/sitemap/CHANGELOG.md index 775431ab2946..32ba79a61a3b 100644 --- a/packages/integrations/sitemap/CHANGELOG.md +++ b/packages/integrations/sitemap/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/sitemap +## 1.3.3 + +### Patch Changes + +- [#7263](https://github.com/withastro/astro/pull/7263) [`dff0d0dda`](https://github.com/withastro/astro/commit/dff0d0dda2f20c02901594739a654834d3451c8e) Thanks [@andremralves](https://github.com/andremralves)! - Fix sitemap does not filter pages + ## 1.3.2 ### Patch Changes diff --git a/packages/integrations/sitemap/package.json b/packages/integrations/sitemap/package.json index 7b42550f6948..1b3bddf5ccc8 100644 --- a/packages/integrations/sitemap/package.json +++ b/packages/integrations/sitemap/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/sitemap", "description": "Generate a sitemap for your Astro site", - "version": "1.3.2", + "version": "1.3.3", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/svelte/package.json b/packages/integrations/svelte/package.json index 2b2b8f1496d3..cae8d7125108 100644 --- a/packages/integrations/svelte/package.json +++ b/packages/integrations/svelte/package.json @@ -48,7 +48,7 @@ "vite": "^4.3.1" }, "peerDependencies": { - "astro": "workspace:^2.5.6", + "astro": "workspace:^2.5.7", "svelte": "^3.54.0" }, "engines": { diff --git a/packages/integrations/tailwind/package.json b/packages/integrations/tailwind/package.json index 9ad9c32f6e71..46345d5cdc99 100644 --- a/packages/integrations/tailwind/package.json +++ b/packages/integrations/tailwind/package.json @@ -44,7 +44,7 @@ "vite": "^4.3.1" }, "peerDependencies": { - "astro": "workspace:^2.5.6", + "astro": "workspace:^2.5.7", "tailwindcss": "^3.0.24" }, "pnpm": { diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index 8b8629ad20a2..d57b882c1cac 100644 --- a/packages/integrations/vercel/package.json +++ b/packages/integrations/vercel/package.json @@ -59,7 +59,7 @@ "web-vitals": "^3.1.1" }, "peerDependencies": { - "astro": "workspace:^2.5.6" + "astro": "workspace:^2.5.7" }, "devDependencies": { "@types/set-cookie-parser": "^2.4.2", diff --git a/packages/integrations/vue/package.json b/packages/integrations/vue/package.json index 49964146269c..55bcddbf03d6 100644 --- a/packages/integrations/vue/package.json +++ b/packages/integrations/vue/package.json @@ -56,7 +56,7 @@ "vue": "^3.2.37" }, "peerDependencies": { - "astro": "workspace:^2.5.6", + "astro": "workspace:^2.5.7", "vue": "^3.2.30" }, "engines": {