diff --git a/.changeset/breezy-onions-scream.md b/.changeset/breezy-onions-scream.md deleted file mode 100644 index 706a09c22b21..000000000000 --- a/.changeset/breezy-onions-scream.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fix error stacktrace from Vite SSR runtime diff --git a/.changeset/gorgeous-tables-sparkle.md b/.changeset/gorgeous-tables-sparkle.md deleted file mode 100644 index 0613fac562ec..000000000000 --- a/.changeset/gorgeous-tables-sparkle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Simplify nested hydration flow diff --git a/.changeset/perfect-moose-end.md b/.changeset/perfect-moose-end.md deleted file mode 100644 index c5aebb980817..000000000000 --- a/.changeset/perfect-moose-end.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fix CSS error line offset diff --git a/.changeset/sixty-tips-play.md b/.changeset/sixty-tips-play.md deleted file mode 100644 index 31ebef4dac2a..000000000000 --- a/.changeset/sixty-tips-play.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"astro": patch ---- - -Replaces the instance of `setTimeout()` in the runtime to use `queueMicrotask()`, to resolve limitations on Cloudflare Workers. diff --git a/.changeset/sour-starfishes-behave.md b/.changeset/sour-starfishes-behave.md deleted file mode 100644 index f5843dfd8e66..000000000000 --- a/.changeset/sour-starfishes-behave.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -'@astrojs/markdoc': minor ---- - -Updates the Markdoc config object for rendering Astro components as tags or nodes. Rather than importing components directly, Astro includes a new `component()` function to specify your component path. This unlocks using Astro components from npm packages and `.ts` files. - -### Migration - -Update all component imports to instead import the new `component()` function and use it to render your Astro components: - -```diff -// markdoc.config.mjs -import { - defineMarkdocConfig, -+ component, -} from '@astrojs/markdoc/config'; -- import Aside from './src/components/Aside.astro'; - -export default defineMarkdocConfig({ - tags: { - aside: { - render: Aside, -+ render: component('./src/components/Aside.astro'), - } - } -}); -``` diff --git a/.changeset/wet-apples-smoke.md b/.changeset/wet-apples-smoke.md deleted file mode 100644 index f13bb957d525..000000000000 --- a/.changeset/wet-apples-smoke.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/markdoc': patch ---- - -Restart the dev server whenever your markdoc config changes. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c54ee2061e9..cf9e8fcbe1f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -243,6 +243,24 @@ jobs: - name: Remove docs translations except for English and Korean run: find smoke/docs/src/content/docs ! -name 'en' ! -name 'ko' -type d -mindepth 1 -maxdepth 1 -exec rm -rf {} + + - name: Check if docs changed + id: changes + uses: dorny/paths-filter@v2 + with: + filters: | + docs: + - 'packages/integrations/*/README.md' + - 'packages/astro/src/@types/astro.ts' + - 'packages/astro/src/core/errors/errors-data.ts' + + - name: Build autogenerated docs pages from current astro branch + if: ${{ steps.changes.outputs.docs == 'true' }} + run: cd smoke/docs && pnpm docgen && pnpm docgen:errors && pnpm docgen:integrations + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SOURCE_REPO: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }} + SOURCE_BRANCH: ${{ github.head_ref || github.ref_name }} + - name: Test run: pnpm run test:smoke env: diff --git a/examples/basics/package.json b/examples/basics/package.json index dd231847347b..f63cb986d087 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^2.7.1" + "astro": "^2.7.2" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index 9fae926b4f95..4d61bf2861de 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -14,6 +14,6 @@ "@astrojs/mdx": "^0.19.7", "@astrojs/rss": "^2.4.3", "@astrojs/sitemap": "^1.3.3", - "astro": "^2.7.1" + "astro": "^2.7.2" } } diff --git a/examples/component/package.json b/examples/component/package.json index 2dd4ff49c430..3a3cf67db1d6 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^2.7.1" + "astro": "^2.7.2" }, "peerDependencies": { "astro": "^2.0.0-beta.0" diff --git a/examples/deno/package.json b/examples/deno/package.json index bef6163a0d36..f85ad5732a86 100644 --- a/examples/deno/package.json +++ b/examples/deno/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^2.7.1" + "astro": "^2.7.2" }, "devDependencies": { "@astrojs/deno": "^4.2.0" diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index 9cf1590ca1a1..50fbdcc81e51 100644 --- a/examples/framework-alpine/package.json +++ b/examples/framework-alpine/package.json @@ -14,6 +14,6 @@ "@astrojs/alpinejs": "^0.2.2", "@types/alpinejs": "^3.7.1", "alpinejs": "^3.12.2", - "astro": "^2.7.1" + "astro": "^2.7.2" } } diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index f5dd15f1ec07..a89fbcb0a6f2 100644 --- a/examples/framework-lit/package.json +++ b/examples/framework-lit/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/lit": "^2.1.0", "@webcomponents/template-shadowroot": "^0.2.1", - "astro": "^2.7.1", + "astro": "^2.7.2", "lit": "^2.7.5" } } diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 50fef0c3d9b1..ce0b0c3e1155 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -16,7 +16,7 @@ "@astrojs/solid-js": "^2.2.0", "@astrojs/svelte": "^3.1.0", "@astrojs/vue": "^2.2.1", - "astro": "^2.7.1", + "astro": "^2.7.2", "preact": "^10.15.1", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index 35adca0036fb..b75fb61d0f57 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^2.2.1", "@preact/signals": "^1.1.3", - "astro": "^2.7.1", + "astro": "^2.7.2", "preact": "^10.15.1" } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index 7a02655d8931..6a488900e703 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -14,7 +14,7 @@ "@astrojs/react": "^2.2.1", "@types/react": "^18.2.13", "@types/react-dom": "^18.2.6", - "astro": "^2.7.1", + "astro": "^2.7.2", "react": "^18.2.0", "react-dom": "^18.2.0" } diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index 23993bfde43d..a9a6fb733d2b 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/solid-js": "^2.2.0", - "astro": "^2.7.1", + "astro": "^2.7.2", "solid-js": "^1.7.6" } } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index 6c287199ebe7..b62cd67fb4c5 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/svelte": "^3.1.0", - "astro": "^2.7.1", + "astro": "^2.7.2", "svelte": "^3.59.1" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index 1f14fa34b4df..1c1537aee33d 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/vue": "^2.2.1", - "astro": "^2.7.1", + "astro": "^2.7.2", "vue": "^3.3.4" } } diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index 72b9db099980..3a75bb41050a 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -12,6 +12,6 @@ }, "dependencies": { "@astrojs/node": "^5.3.0", - "astro": "^2.7.1" + "astro": "^2.7.2" } } diff --git a/examples/integration/package.json b/examples/integration/package.json index c65421200ee5..6514c0e1d680 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^2.7.1" + "astro": "^2.7.2" }, "peerDependencies": { "astro": "^2.0.0-beta.0" diff --git a/examples/middleware/package.json b/examples/middleware/package.json index 00c741543049..0247e30f547e 100644 --- a/examples/middleware/package.json +++ b/examples/middleware/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "@astrojs/node": "^5.3.0", - "astro": "^2.7.1", + "astro": "^2.7.2", "html-minifier": "^4.0.0" } } diff --git a/examples/minimal/package.json b/examples/minimal/package.json index 6679b2fe88e4..01ca52b1db95 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^2.7.1" + "astro": "^2.7.2" } } diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json index 5cd3a9262152..7391e2da5582 100644 --- a/examples/non-html-pages/package.json +++ b/examples/non-html-pages/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^2.7.1" + "astro": "^2.7.2" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index 030f76336b04..26aeb84114a5 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^2.7.1" + "astro": "^2.7.2" } } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index 819f832bd7e0..0869984525a1 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -14,7 +14,7 @@ "dependencies": { "@astrojs/node": "^5.3.0", "@astrojs/svelte": "^3.1.0", - "astro": "^2.7.1", + "astro": "^2.7.2", "svelte": "^3.59.1" } } diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json index 5e6501e69c83..a192e97f2c08 100644 --- a/examples/with-markdoc/package.json +++ b/examples/with-markdoc/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "@astrojs/markdoc": "^0.3.3", - "astro": "^2.7.1" + "@astrojs/markdoc": "^0.4.0", + "astro": "^2.7.2" } } diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index 96d5c37f3c2b..5d3856fee3f1 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/markdown-remark": "^2.2.1", - "astro": "^2.7.1", + "astro": "^2.7.2", "hast-util-select": "^5.0.5", "rehype-autolink-headings": "^6.1.1", "rehype-slug": "^5.1.0", diff --git a/examples/with-markdown-shiki/package.json b/examples/with-markdown-shiki/package.json index 34bcb494c565..a0e8ab206c96 100644 --- a/examples/with-markdown-shiki/package.json +++ b/examples/with-markdown-shiki/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^2.7.1" + "astro": "^2.7.2" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index 0ebd04c804c7..8c8e853f17f0 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/mdx": "^0.19.7", "@astrojs/preact": "^2.2.1", - "astro": "^2.7.1", + "astro": "^2.7.2", "preact": "^10.15.1" } } diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 77858de0adcf..f658d439fabb 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^2.2.1", "@nanostores/preact": "^0.4.1", - "astro": "^2.7.1", + "astro": "^2.7.2", "nanostores": "^0.8.1", "preact": "^10.15.1" } diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index c0a7ebcc75fa..a60dbc712fe6 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -14,7 +14,7 @@ "@astrojs/mdx": "^0.19.7", "@astrojs/tailwind": "^4.0.0", "@types/canvas-confetti": "^1.6.0", - "astro": "^2.7.1", + "astro": "^2.7.2", "autoprefixer": "^10.4.14", "canvas-confetti": "^1.6.0", "postcss": "^8.4.24", diff --git a/examples/with-vite-plugin-pwa/package.json b/examples/with-vite-plugin-pwa/package.json index 595142258da6..48d5bc573e1f 100644 --- a/examples/with-vite-plugin-pwa/package.json +++ b/examples/with-vite-plugin-pwa/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^2.7.1", + "astro": "^2.7.2", "vite-plugin-pwa": "0.14.7", "workbox-window": "^6.6.0" } diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index 8e8350286011..dbc177385a79 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^2.7.1", + "astro": "^2.7.2", "vitest": "^0.31.4" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 2adff1bd7b68..9fcca133b1d8 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,21 @@ # astro +## 2.7.2 + +### Patch Changes + +- [#7273](https://github.com/withastro/astro/pull/7273) [`6dfd7081b`](https://github.com/withastro/astro/commit/6dfd7081b7a1532ab0fe3af8bcf079b10a5640a9) Thanks [@bluwy](https://github.com/bluwy)! - Fix error stacktrace from Vite SSR runtime + +- [#7370](https://github.com/withastro/astro/pull/7370) [`83016795e`](https://github.com/withastro/astro/commit/83016795e9e149bc64e2441d477cf8c65ef5a117) Thanks [@bluwy](https://github.com/bluwy)! - Simplify nested hydration flow + +- [#7488](https://github.com/withastro/astro/pull/7488) [`d3247851f`](https://github.com/withastro/astro/commit/d3247851f04e911c134cfedc22db17b7d61c53d9) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Pass `compressHTML` setting to server adapters + +- [#7491](https://github.com/withastro/astro/pull/7491) [`a3928016c`](https://github.com/withastro/astro/commit/a3928016cc375842cf47e7a227835cd17e48a409) Thanks [@bluwy](https://github.com/bluwy)! - Fix CSS error line offset + +- [#7494](https://github.com/withastro/astro/pull/7494) [`2726098bc`](https://github.com/withastro/astro/commit/2726098bc82f910edda4198b9fb94f2bfd048976) Thanks [@itsmatteomanf](https://github.com/itsmatteomanf)! - Replaces the instance of `setTimeout()` in the runtime to use `queueMicrotask()`, to resolve limitations on Cloudflare Workers. + +- [#7509](https://github.com/withastro/astro/pull/7509) [`f4fea3b02`](https://github.com/withastro/astro/commit/f4fea3b02b0737053c7c7521a7d4dd235648918a) Thanks [@ematipico](https://github.com/ematipico)! - Correctly emit pre-rendered pages when `build.split` is set to `true` + ## 2.7.1 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index 583eec87c291..6e4ccdd2d453 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "2.7.1", + "version": "2.7.2", "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/astro/src/core/app/index.ts b/packages/astro/src/core/app/index.ts index ae0c3fb00e78..69f8f73c40ae 100644 --- a/packages/astro/src/core/app/index.ts +++ b/packages/astro/src/core/app/index.ts @@ -204,6 +204,7 @@ export class App { const url = new URL(request.url); const pathname = prependForwardSlash(this.removeBase(url.pathname)); const info = this.#routeDataToRouteInfo.get(routeData!)!; + const isCompressHTML = this.#manifest.compressHTML ?? false; // may be used in the future for handling rel=modulepreload, rel=icon, rel=manifest etc. const links = new Set(); const styles = createStylesheetElementSet(info.styles); @@ -252,7 +253,13 @@ export class App { page.onRequest as MiddlewareResponseHandler, apiContext, () => { - return renderPage({ mod, renderContext, env: this.#env, cookies: apiContext.cookies }); + return renderPage({ + mod, + renderContext, + env: this.#env, + cookies: apiContext.cookies, + isCompressHTML, + }); } ); } else { @@ -261,6 +268,7 @@ export class App { renderContext, env: this.#env, cookies: apiContext.cookies, + isCompressHTML, }); } Reflect.set(request, responseSentSymbol, true); diff --git a/packages/astro/src/core/app/types.ts b/packages/astro/src/core/app/types.ts index 9af15bf50252..927da06d9771 100644 --- a/packages/astro/src/core/app/types.ts +++ b/packages/astro/src/core/app/types.ts @@ -38,6 +38,7 @@ export type SSRManifest = { routes: RouteInfo[]; site?: string; base?: string; + compressHTML?: boolean; assetsPrefix?: string; markdown: MarkdownRenderingOptions; renderers: SSRLoadedRenderer[]; diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index b53360d125a5..1ab28ecc0854 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -17,6 +17,7 @@ import type { RouteType, SSRError, SSRLoadedRenderer, + SSRManifest, } from '../../@types/astro'; import { generateImage as generateImageInternal, @@ -148,9 +149,27 @@ export async function generatePages(opts: StaticBuildOptions, internals: BuildIn for (const [pageData, filePath] of eachPageDataFromEntryPoint(internals)) { if (pageData.route.prerender) { const ssrEntryURLPage = createEntryURL(filePath, outFolder); - const ssrEntryPage: SinglePageBuiltModule = await import(ssrEntryURLPage.toString()); - - await generatePage(opts, internals, pageData, ssrEntryPage, builtPaths); + const ssrEntryPage = await import(ssrEntryURLPage.toString()); + if (opts.settings.config.build.split) { + // forcing to use undefined, so we fail in an expected way if the module is not even there. + const manifest: SSRManifest | undefined = ssrEntryPage.manifest; + const ssrEntry = manifest?.pageModule; + if (ssrEntry) { + await generatePage(opts, internals, pageData, ssrEntry, builtPaths); + } else { + throw new Error( + `Unable to find the manifest for the module ${ssrEntryURLPage.toString()}. This is unexpected and likely a bug in Astro, please report.` + ); + } + } else { + await generatePage( + opts, + internals, + pageData, + ssrEntryPage as SinglePageBuiltModule, + builtPaths + ); + } } } for (const pageData of eachRedirectPageData(internals)) { diff --git a/packages/astro/src/core/build/internal.ts b/packages/astro/src/core/build/internal.ts index 8c7da07d4319..28d15d874ddf 100644 --- a/packages/astro/src/core/build/internal.ts +++ b/packages/astro/src/core/build/internal.ts @@ -3,7 +3,11 @@ import type { RouteData, SSRResult } from '../../@types/astro'; import type { PageOptions } from '../../vite-plugin-astro/types'; import { prependForwardSlash, removeFileExtension } from '../path.js'; import { viteID } from '../util.js'; -import { ASTRO_PAGE_MODULE_ID, getVirtualModulePageIdFromPath } from './plugins/plugin-pages.js'; +import { + ASTRO_PAGE_RESOLVED_MODULE_ID, + getVirtualModulePageIdFromPath, +} from './plugins/plugin-pages.js'; +import { RESOLVED_SPLIT_MODULE_ID } from './plugins/plugin-ssr.js'; import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js'; import type { PageBuildData, StylesheetAsset, ViteID } from './types'; @@ -234,7 +238,13 @@ export function* eachPageDataFromEntryPoint( internals: BuildInternals ): Generator<[PageBuildData, string]> { for (const [entryPoint, filePath] of internals.entrySpecifierToBundleMap) { - if (entryPoint.includes(ASTRO_PAGE_MODULE_ID)) { + // virtual pages can be emitted with different prefixes: + // - the classic way are pages emitted with prefix ASTRO_PAGE_RESOLVED_MODULE_ID -> plugin-pages + // - pages emitted using `build.split`, in this case pages are emitted with prefix RESOLVED_SPLIT_MODULE_ID + if ( + entryPoint.includes(ASTRO_PAGE_RESOLVED_MODULE_ID) || + entryPoint.includes(RESOLVED_SPLIT_MODULE_ID) + ) { const [, pageName] = entryPoint.split(':'); const pageData = internals.pagesByComponent.get( `${pageName.replace(ASTRO_PAGE_EXTENSION_POST_PATTERN, '.')}` diff --git a/packages/astro/src/core/build/plugins/plugin-ssr.ts b/packages/astro/src/core/build/plugins/plugin-ssr.ts index ebda7fb3e650..254037e59509 100644 --- a/packages/astro/src/core/build/plugins/plugin-ssr.ts +++ b/packages/astro/src/core/build/plugins/plugin-ssr.ts @@ -482,6 +482,7 @@ function buildManifest( routes, site: settings.config.site, base: settings.config.base, + compressHTML: settings.config.compressHTML, assetsPrefix: settings.config.build.assetsPrefix, markdown: settings.config.markdown, componentMetadata: Array.from(internals.componentMetadata), diff --git a/packages/astro/test/fixtures/ssr-split-manifest/src/pages/prerender.astro b/packages/astro/test/fixtures/ssr-split-manifest/src/pages/prerender.astro new file mode 100644 index 000000000000..2eec6dbf13c9 --- /dev/null +++ b/packages/astro/test/fixtures/ssr-split-manifest/src/pages/prerender.astro @@ -0,0 +1,12 @@ +--- +export const prerender = true +--- + + + + Pre render me + + + + + diff --git a/packages/astro/test/ssr-manifest.test.js b/packages/astro/test/ssr-manifest.test.js index cb876bde9889..4e5521220903 100644 --- a/packages/astro/test/ssr-manifest.test.js +++ b/packages/astro/test/ssr-manifest.test.js @@ -11,6 +11,7 @@ describe('astro:ssr-manifest', () => { fixture = await loadFixture({ root: './fixtures/ssr-manifest/', output: 'server', + compressHTML: true, adapter: testAdapter(), }); await fixture.build(); @@ -25,4 +26,10 @@ describe('astro:ssr-manifest', () => { const $ = cheerio.load(html); expect($('#assets').text()).to.equal('["/_astro/index.a8a337e4.css"]'); }); + + it('includes compressHTML', async () => { + const app = await fixture.loadTestAdapterApp(); + expect(app.manifest).to.haveOwnProperty('compressHTML'); + expect(app.manifest.compressHTML).to.be.true; + }); }); diff --git a/packages/astro/test/ssr-split-manifest.test.js b/packages/astro/test/ssr-split-manifest.test.js index 6d3167bec120..9e8a0981ed5a 100644 --- a/packages/astro/test/ssr-split-manifest.test.js +++ b/packages/astro/test/ssr-split-manifest.test.js @@ -3,7 +3,8 @@ import { loadFixture } from './test-utils.js'; import testAdapter from './test-adapter.js'; import * as cheerio from 'cheerio'; import { fileURLToPath } from 'node:url'; -import { existsSync } from 'node:fs'; +import { existsSync, readFileSync } from 'node:fs'; +import { resolve } from 'node:path'; describe('astro:ssr-manifest, split', () => { /** @type {import('./test-utils').Fixture} */ @@ -35,15 +36,34 @@ describe('astro:ssr-manifest, split', () => { const html = await response.text(); const $ = cheerio.load(html); - expect($('#assets').text()).to.equal('["/_astro/index.a8a337e4.css"]'); + expect($('#assets').text()).to.equal('["/_astro/index.a8a337e4.css","/prerender/index.html"]'); }); it('should give access to entry points that exists on file system', async () => { // number of the pages inside src/ - expect(entryPoints.size).to.equal(4); + expect(entryPoints.size).to.equal(5); for (const fileUrl of entryPoints.values()) { let filePath = fileURLToPath(fileUrl); expect(existsSync(filePath)).to.be.true; } }); + + it('should correctly emit the the pre render page', async () => { + const text = readFileSync( + resolve('./test/fixtures/ssr-split-manifest/dist/client/prerender/index.html'), + { + encoding: 'utf8', + } + ); + expect(text.includes('Pre render me')).to.be.true; + }); + + it('should emit an entry point to request the pre-rendered page', async () => { + const pagePath = 'src/pages/prerender.astro'; + const app = await fixture.loadEntryPoint(pagePath, currentRoutes); + const request = new Request('http://example.com/'); + const response = await app.render(request); + const html = await response.text(); + expect(html.includes('Pre render me')).to.be.true; + }); }); diff --git a/packages/astro/test/test-utils.js b/packages/astro/test/test-utils.js index 11b181779bbc..583a6c61e4d9 100644 --- a/packages/astro/test/test-utils.js +++ b/packages/astro/test/test-utils.js @@ -252,7 +252,7 @@ export async function loadFixture(inlineConfig) { const virtualModule = getVirtualModulePageNameFromPath(RESOLVED_SPLIT_MODULE_ID, pagePath); const filePath = makeSplitEntryPointFileName(virtualModule, routes); const url = new URL(`./server/${filePath}?id=${fixtureId}`, config.outDir); - const { createApp, manifest, middleware } = await import(url); + const { createApp, manifest } = await import(url); const app = createApp(streaming); app.manifest = manifest; return app; diff --git a/packages/integrations/cloudflare/package.json b/packages/integrations/cloudflare/package.json index 03ded87cefc0..fe64ee166eb6 100644 --- a/packages/integrations/cloudflare/package.json +++ b/packages/integrations/cloudflare/package.json @@ -44,7 +44,7 @@ "tiny-glob": "^0.2.9" }, "peerDependencies": { - "astro": "workspace:^2.7.1" + "astro": "workspace:^2.7.2" }, "devDependencies": { "astro": "workspace:*", diff --git a/packages/integrations/deno/package.json b/packages/integrations/deno/package.json index b51c905fa2d6..a77d8f716666 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.7.1" + "astro": "workspace:^2.7.2" }, "devDependencies": { "astro": "workspace:*", diff --git a/packages/integrations/image/package.json b/packages/integrations/image/package.json index 40bda08ba8e6..cebe962027b5 100644 --- a/packages/integrations/image/package.json +++ b/packages/integrations/image/package.json @@ -63,7 +63,7 @@ "vite": "^4.3.9" }, "peerDependencies": { - "astro": "workspace:^2.7.1", + "astro": "workspace:^2.7.2", "sharp": ">=0.31.0" }, "peerDependenciesMeta": { diff --git a/packages/integrations/markdoc/CHANGELOG.md b/packages/integrations/markdoc/CHANGELOG.md index 0a484dd4b207..9cdb6e9c1f47 100644 --- a/packages/integrations/markdoc/CHANGELOG.md +++ b/packages/integrations/markdoc/CHANGELOG.md @@ -1,5 +1,40 @@ # @astrojs/markdoc +## 0.4.0 + +### Minor Changes + +- [#7468](https://github.com/withastro/astro/pull/7468) [`fb7af5511`](https://github.com/withastro/astro/commit/fb7af551148f5ca6c4f98a4e556c8948c5690919) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Updates the Markdoc config object for rendering Astro components as tags or nodes. Rather than importing components directly, Astro includes a new `component()` function to specify your component path. This unlocks using Astro components from npm packages and `.ts` files. + + ### Migration + + Update all component imports to instead import the new `component()` function and use it to render your Astro components: + + ```diff + // markdoc.config.mjs + import { + defineMarkdocConfig, + + component, + } from '@astrojs/markdoc/config'; + - import Aside from './src/components/Aside.astro'; + + export default defineMarkdocConfig({ + tags: { + aside: { + render: Aside, + + render: component('./src/components/Aside.astro'), + } + } + }); + ``` + +### Patch Changes + +- [#7467](https://github.com/withastro/astro/pull/7467) [`f6feff7a2`](https://github.com/withastro/astro/commit/f6feff7a2991fb94e11ee1b70ac606e4c053062b) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Restart the dev server whenever your markdoc config changes. + +- Updated dependencies [[`6dfd7081b`](https://github.com/withastro/astro/commit/6dfd7081b7a1532ab0fe3af8bcf079b10a5640a9), [`83016795e`](https://github.com/withastro/astro/commit/83016795e9e149bc64e2441d477cf8c65ef5a117), [`d3247851f`](https://github.com/withastro/astro/commit/d3247851f04e911c134cfedc22db17b7d61c53d9), [`a3928016c`](https://github.com/withastro/astro/commit/a3928016cc375842cf47e7a227835cd17e48a409), [`2726098bc`](https://github.com/withastro/astro/commit/2726098bc82f910edda4198b9fb94f2bfd048976), [`f4fea3b02`](https://github.com/withastro/astro/commit/f4fea3b02b0737053c7c7521a7d4dd235648918a)]: + - astro@2.7.2 + ## 0.3.3 ### Patch Changes diff --git a/packages/integrations/markdoc/package.json b/packages/integrations/markdoc/package.json index 98a02a96a2f9..ca42c0014e37 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.3", + "version": "0.4.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", @@ -74,7 +74,7 @@ "zod": "^3.17.3" }, "peerDependencies": { - "astro": "workspace:^2.7.1" + "astro": "workspace:^2.7.2" }, "devDependencies": { "@astrojs/markdown-remark": "^2.2.1", diff --git a/packages/integrations/netlify/package.json b/packages/integrations/netlify/package.json index 0a7d68a6f1ad..6e00a216eb60 100644 --- a/packages/integrations/netlify/package.json +++ b/packages/integrations/netlify/package.json @@ -43,7 +43,7 @@ "esbuild": "^0.15.18" }, "peerDependencies": { - "astro": "workspace:^2.7.1" + "astro": "workspace:^2.7.2" }, "devDependencies": { "@netlify/edge-functions": "^2.0.0", diff --git a/packages/integrations/node/package.json b/packages/integrations/node/package.json index 303891762b26..c4b2e0189052 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.7.1" + "astro": "workspace:^2.7.2" }, "devDependencies": { "@types/node": "^18.16.18", diff --git a/packages/integrations/node/test/prerender.test.js b/packages/integrations/node/test/prerender.test.js index a018f0649e46..f895a6458c4e 100644 --- a/packages/integrations/node/test/prerender.test.js +++ b/packages/integrations/node/test/prerender.test.js @@ -29,7 +29,7 @@ describe('Prerendering', () => { adapter: nodejs({ mode: 'standalone' }), }); await fixture.build(); - const { startServer } = await await load(); + const { startServer } = await load(); let res = startServer(); server = res.server; }); diff --git a/packages/integrations/svelte/package.json b/packages/integrations/svelte/package.json index 6a2b274b893b..12a480fc1f33 100644 --- a/packages/integrations/svelte/package.json +++ b/packages/integrations/svelte/package.json @@ -48,7 +48,7 @@ "vite": "^4.3.9" }, "peerDependencies": { - "astro": "workspace:^2.7.1", + "astro": "workspace:^2.7.2", "svelte": "^3.55.0 || ^4.0.0" }, "engines": { diff --git a/packages/integrations/tailwind/package.json b/packages/integrations/tailwind/package.json index f7ef9dd1b5f4..024df1a48e90 100644 --- a/packages/integrations/tailwind/package.json +++ b/packages/integrations/tailwind/package.json @@ -43,7 +43,7 @@ "vite": "^4.3.9" }, "peerDependencies": { - "astro": "workspace:^2.7.1", + "astro": "workspace:^2.7.2", "tailwindcss": "^3.0.24" } } diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index dd896a8af353..17f01c66938d 100644 --- a/packages/integrations/vercel/package.json +++ b/packages/integrations/vercel/package.json @@ -60,7 +60,7 @@ "web-vitals": "^3.3.2" }, "peerDependencies": { - "astro": "workspace:^2.7.1" + "astro": "workspace:^2.7.2" }, "devDependencies": { "@types/set-cookie-parser": "^2.4.2", diff --git a/packages/integrations/vue/package.json b/packages/integrations/vue/package.json index a902d955665c..30da20bb00f4 100644 --- a/packages/integrations/vue/package.json +++ b/packages/integrations/vue/package.json @@ -56,7 +56,7 @@ "vue": "^3.3.4" }, "peerDependencies": { - "astro": "workspace:^2.7.1", + "astro": "workspace:^2.7.2", "vue": "^3.2.30" }, "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 84f0c51bbee2..76aae821fcb3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -127,7 +127,7 @@ importers: examples/basics: dependencies: astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro examples/blog: @@ -142,19 +142,19 @@ importers: specifier: ^1.3.3 version: link:../../packages/integrations/sitemap astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro examples/component: devDependencies: astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro examples/deno: dependencies: astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro devDependencies: '@astrojs/deno': @@ -173,7 +173,7 @@ importers: specifier: ^3.12.2 version: 3.12.2 astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro examples/framework-lit: @@ -185,7 +185,7 @@ importers: specifier: ^0.2.1 version: 0.2.1 astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro lit: specifier: ^2.7.5 @@ -209,7 +209,7 @@ importers: specifier: ^2.2.1 version: link:../../packages/integrations/vue astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro preact: specifier: ^10.15.1 @@ -239,7 +239,7 @@ importers: specifier: ^1.1.3 version: 1.1.3(preact@10.15.1) astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro preact: specifier: ^10.15.1 @@ -257,7 +257,7 @@ importers: specifier: ^18.2.6 version: 18.2.6 astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro react: specifier: ^18.2.0 @@ -272,7 +272,7 @@ importers: specifier: ^2.2.0 version: link:../../packages/integrations/solid astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro solid-js: specifier: ^1.7.6 @@ -284,7 +284,7 @@ importers: specifier: ^3.1.0 version: link:../../packages/integrations/svelte astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro svelte: specifier: ^3.59.1 @@ -296,7 +296,7 @@ importers: specifier: ^2.2.1 version: link:../../packages/integrations/vue astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro vue: specifier: ^3.3.4 @@ -308,13 +308,13 @@ importers: specifier: ^5.3.0 version: link:../../packages/integrations/node astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro examples/integration: devDependencies: astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro examples/middleware: @@ -323,7 +323,7 @@ importers: specifier: ^5.3.0 version: link:../../packages/integrations/node astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro html-minifier: specifier: ^4.0.0 @@ -332,19 +332,19 @@ importers: examples/minimal: dependencies: astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro examples/non-html-pages: dependencies: astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro examples/portfolio: dependencies: astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro examples/ssr: @@ -356,7 +356,7 @@ importers: specifier: ^3.1.0 version: link:../../packages/integrations/svelte astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro svelte: specifier: ^3.59.1 @@ -365,10 +365,10 @@ importers: examples/with-markdoc: dependencies: '@astrojs/markdoc': - specifier: ^0.3.3 + specifier: ^0.4.0 version: link:../../packages/integrations/markdoc astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro examples/with-markdown-plugins: @@ -377,7 +377,7 @@ importers: specifier: ^2.2.1 version: link:../../packages/markdown/remark astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro hast-util-select: specifier: ^5.0.5 @@ -398,7 +398,7 @@ importers: examples/with-markdown-shiki: dependencies: astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro examples/with-mdx: @@ -410,7 +410,7 @@ importers: specifier: ^2.2.1 version: link:../../packages/integrations/preact astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro preact: specifier: ^10.15.1 @@ -425,7 +425,7 @@ importers: specifier: ^0.4.1 version: 0.4.1(nanostores@0.8.1)(preact@10.15.1) astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro nanostores: specifier: ^0.8.1 @@ -446,7 +446,7 @@ importers: specifier: ^1.6.0 version: 1.6.0 astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro autoprefixer: specifier: ^10.4.14 @@ -464,7 +464,7 @@ importers: examples/with-vite-plugin-pwa: dependencies: astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro vite-plugin-pwa: specifier: 0.14.7 @@ -476,7 +476,7 @@ importers: examples/with-vitest: dependencies: astro: - specifier: ^2.7.1 + specifier: ^2.7.2 version: link:../../packages/astro vitest: specifier: ^0.31.4 @@ -18118,21 +18118,25 @@ packages: file:packages/astro/test/fixtures/css-assets/packages/font-awesome: resolution: {directory: packages/astro/test/fixtures/css-assets/packages/font-awesome, type: directory} name: '@test/astro-font-awesome-package' + version: 0.0.1 dev: false file:packages/astro/test/fixtures/multiple-renderers/renderers/one: resolution: {directory: packages/astro/test/fixtures/multiple-renderers/renderers/one, type: directory} name: '@test/astro-renderer-one' + version: 1.0.0 dev: false file:packages/astro/test/fixtures/multiple-renderers/renderers/two: resolution: {directory: packages/astro/test/fixtures/multiple-renderers/renderers/two, type: directory} name: '@test/astro-renderer-two' + version: 1.0.0 dev: false file:packages/astro/test/fixtures/solid-component/deps/solid-jsx-component: resolution: {directory: packages/astro/test/fixtures/solid-component/deps/solid-jsx-component, type: directory} name: '@test/solid-jsx-component' + version: 0.0.0 dependencies: solid-js: 1.7.6 dev: false