diff --git a/.changeset/funny-waves-worry.md b/.changeset/funny-waves-worry.md deleted file mode 100644 index 361fac880a932..0000000000000 --- a/.changeset/funny-waves-worry.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -'astro': minor -'@astrojs/netlify': minor ---- - -Introduces the **experimental** Prerender API. - -> **Note** -> This API is not yet stable and is subject to possible breaking changes! - -- Deploy an Astro server without sacrificing the speed or cacheability of static HTML. -- The Prerender API allows you to statically prerender specific `pages/` at build time. - -**Usage** - -- First, run `astro build --experimental-prerender` or enable `experimental: { prerender: true }` in your `astro.config.mjs` file. -- Then, include `export const prerender = true` in any file in the `pages/` directory that you wish to prerender. diff --git a/.changeset/happy-chefs-ring.md b/.changeset/happy-chefs-ring.md deleted file mode 100644 index c8ac61ddbdd77..0000000000000 --- a/.changeset/happy-chefs-ring.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': minor ---- - -Add a new error overlay designed by @doodlemarks! This new overlay should be much more informative, clearer, astro-y, and prettier than the previous one. diff --git a/.changeset/hip-scissors-live.md b/.changeset/hip-scissors-live.md deleted file mode 100644 index aab0826b86be3..0000000000000 --- a/.changeset/hip-scissors-live.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'create-astro': patch ---- - -Upgrade giget to support env proxy config diff --git a/.changeset/light-moose-attend.md b/.changeset/light-moose-attend.md deleted file mode 100644 index 0b32eba8f26b7..0000000000000 --- a/.changeset/light-moose-attend.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': minor ---- - -Add `server.headers` option diff --git a/.changeset/small-ravens-cover.md b/.changeset/small-ravens-cover.md deleted file mode 100644 index 67b8e31f03e13..0000000000000 --- a/.changeset/small-ravens-cover.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': minor ---- - -Allow setting domain when deleting cookies diff --git a/examples/basics/package.json b/examples/basics/package.json index c0480966783c2..cc325487a97ff 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15" + "astro": "^1.7.0" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index 4401e830fe46c..3144cd0668cdb 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15", + "astro": "^1.7.0", "@astrojs/mdx": "^0.12.2", "@astrojs/rss": "^1.2.1", "@astrojs/sitemap": "^1.0.0" diff --git a/examples/component/package.json b/examples/component/package.json index 593c35a2b3846..45075e11dd0d6 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,9 +15,9 @@ ], "scripts": {}, "devDependencies": { - "astro": "^1.6.15" + "astro": "^1.7.0" }, "peerDependencies": { - "astro": "^1.6.15" + "astro": "^1.7.0" } } diff --git a/examples/deno/package.json b/examples/deno/package.json index 7e02cc90522f5..7ce52ebf669b8 100644 --- a/examples/deno/package.json +++ b/examples/deno/package.json @@ -10,9 +10,9 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15" + "astro": "^1.7.0" }, "devDependencies": { - "@astrojs/deno": "^2.0.1" + "@astrojs/deno": "^3.0.0" } } diff --git a/examples/docs/package.json b/examples/docs/package.json index d95f6a744244e..4f6379875a354 100644 --- a/examples/docs/package.json +++ b/examples/docs/package.json @@ -12,7 +12,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15", + "astro": "^1.7.0", "preact": "^10.7.3", "react": "^18.1.0", "react-dom": "^18.1.0", diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index 209a60d2015bd..999d4667ac38a 100644 --- a/examples/framework-alpine/package.json +++ b/examples/framework-alpine/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15", + "astro": "^1.7.0", "alpinejs": "^3.10.2", "@astrojs/alpinejs": "^0.1.2", "@types/alpinejs": "^3.7.0" diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index ca74bbb791eb8..d6ba06dc67e0c 100644 --- a/examples/framework-lit/package.json +++ b/examples/framework-lit/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15", + "astro": "^1.7.0", "lit": "^2.2.5", "@astrojs/lit": "^1.0.0", "@webcomponents/template-shadowroot": "^0.1.0" diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 8fe271f240135..d9bac0eb856f7 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15", + "astro": "^1.7.0", "preact": "^10.7.3", "react": "^18.1.0", "react-dom": "^18.1.0", diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index 576706975810b..8692cd6073c07 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15", + "astro": "^1.7.0", "preact": "^10.7.3", "@astrojs/preact": "^1.2.0", "@preact/signals": "^1.1.0" diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index 796a27690d919..863f1404e77b7 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15", + "astro": "^1.7.0", "react": "^18.1.0", "react-dom": "^18.1.0", "@astrojs/react": "^1.2.2", diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index bc31abeeec721..58ab897f4deb2 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15", + "astro": "^1.7.0", "solid-js": "^1.4.3", "@astrojs/solid-js": "^1.2.3" } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index 821c64f97ea3c..9ffc11cfd42da 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -13,6 +13,6 @@ "dependencies": { "svelte": "^3.48.0", "@astrojs/svelte": "^1.0.2", - "astro": "^1.6.15" + "astro": "^1.7.0" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index bc42f1c8bbd42..e4f6521d3f737 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15", + "astro": "^1.7.0", "vue": "^3.2.37", "@astrojs/vue": "^1.2.2" } diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index 54b9e1bd5c2ea..89b16927be42e 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -12,7 +12,7 @@ "astro": "astro" }, "dependencies": { - "@astrojs/node": "^3.1.1", - "astro": "^1.6.15" + "@astrojs/node": "^4.0.0", + "astro": "^1.7.0" } } diff --git a/examples/integration/package.json b/examples/integration/package.json index 494da065b1797..bf131943ea6f9 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -15,9 +15,9 @@ ], "scripts": {}, "devDependencies": { - "astro": "^1.6.15" + "astro": "^1.7.0" }, "peerDependencies": { - "astro": "^1.6.15" + "astro": "^1.7.0" } } diff --git a/examples/minimal/package.json b/examples/minimal/package.json index a0bfc8bef5f7c..e3ddd3c1ee7dc 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15" + "astro": "^1.7.0" } } diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json index 9f170abae41f1..066a4e79593f8 100644 --- a/examples/non-html-pages/package.json +++ b/examples/non-html-pages/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15" + "astro": "^1.7.0" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index 35863af90d2b7..13b56d3719793 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15" + "astro": "^1.7.0" } } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index 93bed77b0a8e3..b68944fc86809 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -12,10 +12,10 @@ "server": "node dist/server/entry.mjs" }, "dependencies": { - "astro": "^1.6.15", + "astro": "^1.7.0", "svelte": "^3.48.0", "@astrojs/svelte": "^1.0.2", - "@astrojs/node": "^3.1.1", + "@astrojs/node": "^4.0.0", "concurrently": "^7.2.1", "unocss": "^0.15.6", "vite-imagetools": "^4.0.4" diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index 3603bc5fdcb29..408d926c0cf58 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15", + "astro": "^1.7.0", "@astrojs/markdown-remark": "^1.1.3", "hast-util-select": "5.0.1", "rehype-autolink-headings": "^6.1.1", diff --git a/examples/with-markdown-shiki/package.json b/examples/with-markdown-shiki/package.json index 470d0ac1ff8fd..71c6ffbed3040 100644 --- a/examples/with-markdown-shiki/package.json +++ b/examples/with-markdown-shiki/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15" + "astro": "^1.7.0" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index d698636e37d07..71533373a3a41 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15", + "astro": "^1.7.0", "preact": "^10.6.5", "@astrojs/preact": "^1.2.0", "@astrojs/mdx": "^0.12.2" diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 4ebb307034798..97694a43c11a9 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.6.15", + "astro": "^1.7.0", "preact": "^10.7.3", "@astrojs/preact": "^1.2.0", "nanostores": "^0.5.12", diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index 9fc2bc642a62a..95603ae267c4a 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -14,7 +14,7 @@ "@astrojs/mdx": "^0.12.2", "@astrojs/tailwind": "^2.1.3", "@types/canvas-confetti": "^1.4.3", - "astro": "^1.6.15", + "astro": "^1.7.0", "autoprefixer": "^10.4.7", "canvas-confetti": "^1.5.1", "postcss": "^8.4.14", diff --git a/examples/with-vite-plugin-pwa/package.json b/examples/with-vite-plugin-pwa/package.json index 0adfba875103a..ec74826672250 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": "^1.6.15", + "astro": "^1.7.0", "vite-plugin-pwa": "0.11.11", "workbox-window": "^6.5.3" } diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index 86bc1b068bc91..e38e9305ff102 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^1.6.15", + "astro": "^1.7.0", "vitest": "^0.20.3" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 6a79f24b46a6e..2c5ff59bae3a5 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,28 @@ # astro +## 1.7.0 + +### Minor Changes + +- [#5297](https://github.com/withastro/astro/pull/5297) [`d2960984c`](https://github.com/withastro/astro/commit/d2960984c59af7b60a3ea472c6c58fb00534a8e6) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Introduces the **experimental** Prerender API. + + > **Note** + > This API is not yet stable and is subject to possible breaking changes! + + - Deploy an Astro server without sacrificing the speed or cacheability of static HTML. + - The Prerender API allows you to statically prerender specific `pages/` at build time. + + **Usage** + + - First, run `astro build --experimental-prerender` or enable `experimental: { prerender: true }` in your `astro.config.mjs` file. + - Then, include `export const prerender = true` in any file in the `pages/` directory that you wish to prerender. + +- [#5495](https://github.com/withastro/astro/pull/5495) [`31ec84797`](https://github.com/withastro/astro/commit/31ec8479721a1cd65538ec041458c5ffe8f50ee9) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Add a new error overlay designed by @doodlemarks! This new overlay should be much more informative, clearer, astro-y, and prettier than the previous one. + +- [#5564](https://github.com/withastro/astro/pull/5564) [`dced4a8a2`](https://github.com/withastro/astro/commit/dced4a8a2657887ec569860d9862d20f695dc23a) Thanks [@riywo](https://github.com/riywo)! - Add `server.headers` option + +- [#5341](https://github.com/withastro/astro/pull/5341) [`6b156dd3b`](https://github.com/withastro/astro/commit/6b156dd3b467884839a571c53114aadf26fa4b0b) Thanks [@alexpdraper](https://github.com/alexpdraper)! - Allow setting domain when deleting cookies + ## 1.6.15 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index 4e9e9dc912821..6c2a98e686a72 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "1.6.15", + "version": "1.7.0", "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/@types/astro.ts b/packages/astro/src/@types/astro.ts index d5ff981d721f5..0a1eee62a99df 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -896,7 +896,7 @@ export interface AstroUserConfig { astroFlavoredMarkdown?: boolean; }; - /** + /** * @docs * @kind heading * @name Experimental Flags @@ -906,9 +906,9 @@ export interface AstroUserConfig { */ experimental?: { /** - * @hidden - * Turn on experimental support for the new error overlay component. - */ + * @hidden + * Turn on experimental support for the new error overlay component. + */ errorOverlay?: boolean; /** * @docs diff --git a/packages/astro/src/core/build/common.ts b/packages/astro/src/core/build/common.ts index 642db2fe5e262..308f245c41e1b 100644 --- a/packages/astro/src/core/build/common.ts +++ b/packages/astro/src/core/build/common.ts @@ -1,5 +1,5 @@ import npath from 'path'; -import { createHash } from 'crypto' +import { createHash } from 'crypto'; import { fileURLToPath, pathToFileURL } from 'url'; import type { AstroConfig, RouteType } from '../../@types/astro'; import { appendForwardSlash } from '../../core/path.js'; @@ -46,7 +46,7 @@ export function getOutFile( astroConfig: AstroConfig, outFolder: URL, pathname: string, - routeType: RouteType, + routeType: RouteType ): URL { switch (routeType) { case 'endpoint': diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index ba95faadc4153..d6ee96791baff 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -79,7 +79,12 @@ export async function generatePages(opts: StaticBuildOptions, internals: BuildIn const serverEntry = opts.buildConfig.serverEntry; const outFolder = ssr ? opts.buildConfig.server : getOutDirWithinCwd(opts.settings.config.outDir); - if (opts.settings.config.experimental.prerender && opts.settings.config.output === 'server' && !hasPrerenderedPages(internals)) return; + if ( + opts.settings.config.experimental.prerender && + opts.settings.config.output === 'server' && + !hasPrerenderedPages(internals) + ) + return; const verb = ssr ? 'prerendering' : 'generating'; info(opts.logging, null, `\n${bgGreen(black(` ${verb} static routes `))}`); diff --git a/packages/astro/src/core/build/internal.ts b/packages/astro/src/core/build/internal.ts index 9a7f973268d37..fad6de35d9e1a 100644 --- a/packages/astro/src/core/build/internal.ts +++ b/packages/astro/src/core/build/internal.ts @@ -205,10 +205,10 @@ export function* eachPageData(internals: BuildInternals) { export function hasPrerenderedPages(internals: BuildInternals) { for (const id of internals.pagesByViteID.keys()) { if (internals.pageOptionsByPage.get(id)?.prerender) { - return true + return true; } } - return false + return false; } export function* eachPrerenderedPageData(internals: BuildInternals) { diff --git a/packages/astro/src/core/build/types.ts b/packages/astro/src/core/build/types.ts index fb586001534b6..57518fb42ff37 100644 --- a/packages/astro/src/core/build/types.ts +++ b/packages/astro/src/core/build/types.ts @@ -14,7 +14,7 @@ import type { RouteCache } from '../render/route-cache'; export type ComponentPath = string; export type ViteID = string; -export type PageOutput = AstroConfig['output'] +export type PageOutput = AstroConfig['output']; export interface PageBuildData { component: ComponentPath; diff --git a/packages/astro/src/core/build/vite-plugin-internals.ts b/packages/astro/src/core/build/vite-plugin-internals.ts index 6e6b1e90cb033..dfd346e77388b 100644 --- a/packages/astro/src/core/build/vite-plugin-internals.ts +++ b/packages/astro/src/core/build/vite-plugin-internals.ts @@ -52,7 +52,7 @@ export function vitePluginInternals(input: Set, internals: BuildInternal for (const id of Object.keys(chunk.modules)) { const pageData = internals.pagesByViteID.get(id); if (pageData) { - internals.pageToBundleMap.set(pageData.moduleSpecifier, chunk.fileName) + internals.pageToBundleMap.set(pageData.moduleSpecifier, chunk.fileName); } } } diff --git a/packages/astro/src/core/build/vite-plugin-prerender.ts b/packages/astro/src/core/build/vite-plugin-prerender.ts index 974bdf41f65c1..4ad343200d671 100644 --- a/packages/astro/src/core/build/vite-plugin-prerender.ts +++ b/packages/astro/src/core/build/vite-plugin-prerender.ts @@ -2,7 +2,10 @@ import type { Plugin as VitePlugin } from 'vite'; import type { BuildInternals } from './internal.js'; import type { StaticBuildOptions } from './types'; -export function vitePluginPrerender(opts: StaticBuildOptions, internals: BuildInternals): VitePlugin { +export function vitePluginPrerender( + opts: StaticBuildOptions, + internals: BuildInternals +): VitePlugin { return { name: 'astro:rollup-plugin-prerender', @@ -39,5 +42,5 @@ export function vitePluginPrerender(opts: StaticBuildOptions, internals: BuildIn } }; }, - } + }; } diff --git a/packages/astro/src/core/build/vite-plugin-ssr.ts b/packages/astro/src/core/build/vite-plugin-ssr.ts index 03a66e126b61c..56277d804bf00 100644 --- a/packages/astro/src/core/build/vite-plugin-ssr.ts +++ b/packages/astro/src/core/build/vite-plugin-ssr.ts @@ -140,8 +140,17 @@ function buildManifest( const joinBase = (pth: string) => (bareBase ? bareBase + '/' + pth : pth); for (const pageData of eachPrerenderedPageData(internals)) { - const outFolder = getOutFolder(opts.settings.config, pageData.route.pathname!, pageData.route.type); - const outFile = getOutFile(opts.settings.config, outFolder, pageData.route.pathname!, pageData.route.type); + const outFolder = getOutFolder( + opts.settings.config, + pageData.route.pathname!, + pageData.route.type + ); + const outFile = getOutFile( + opts.settings.config, + outFolder, + pageData.route.pathname!, + pageData.route.type + ); const file = outFile.toString().replace(opts.settings.config.build.client.toString(), ''); routes.push({ file, diff --git a/packages/astro/src/core/config/config.ts b/packages/astro/src/core/config/config.ts index 3524455f6c385..6616a8213231c 100644 --- a/packages/astro/src/core/config/config.ts +++ b/packages/astro/src/core/config/config.ts @@ -105,9 +105,7 @@ export function resolveFlags(flags: Partial): CLIFlags { ? flags.experimentalErrorOverlay : undefined, experimentalPrerender: - typeof flags.experimentalPrerender === 'boolean' - ? flags.experimentalPrerender - : undefined, + typeof flags.experimentalPrerender === 'boolean' ? flags.experimentalPrerender : undefined, }; } diff --git a/packages/astro/src/core/errors/errors-data.ts b/packages/astro/src/core/errors/errors-data.ts index fb219d876bd22..959bdde287a57 100644 --- a/packages/astro/src/core/errors/errors-data.ts +++ b/packages/astro/src/core/errors/errors-data.ts @@ -403,8 +403,8 @@ See https://docs.astro.build/en/guides/server-side-rendering/ for more informati code: 3019, message: (prefix: string, suffix: string) => { let msg = `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`; - if (prefix !== 'const') msg += `\nExpected \`const\` declaration but got \`${prefix}\`.` - if (suffix !== 'true') msg += `\nExpected \`true\` value but got \`${suffix}\`.` + if (prefix !== 'const') msg += `\nExpected \`const\` declaration but got \`${prefix}\`.`; + if (suffix !== 'true') msg += `\nExpected \`true\` value but got \`${suffix}\`.`; return msg; }, hint: 'Mutable values declared at runtime are not supported. Please make sure to use exactly `export const prerender = true`.', diff --git a/packages/astro/src/vite-plugin-scanner/index.ts b/packages/astro/src/vite-plugin-scanner/index.ts index 1213652a17a3e..3efdba054310e 100644 --- a/packages/astro/src/vite-plugin-scanner/index.ts +++ b/packages/astro/src/vite-plugin-scanner/index.ts @@ -6,7 +6,13 @@ import { normalizeFilename } from '../vite-plugin-utils/index.js'; import { scan } from './scan.js'; -export default function astroScannerPlugin({ settings, logging }: { settings: AstroSettings, logging: LogOptions }): VitePlugin { +export default function astroScannerPlugin({ + settings, + logging, +}: { + settings: AstroSettings; + logging: LogOptions; +}): VitePlugin { return { name: 'astro:scanner', enforce: 'post', @@ -26,7 +32,7 @@ export default function astroScannerPlugin({ settings, logging }: { settings: As const fileIsPage = isPage(fileURL, settings); const fileIsEndpoint = isEndpoint(fileURL, settings); if (!(fileIsPage || fileIsEndpoint)) return; - const pageOptions = await scan(code, id) + const pageOptions = await scan(code, id); const { meta = {} } = this.getModuleInfo(id) ?? {}; return { diff --git a/packages/astro/src/vite-plugin-scanner/scan.ts b/packages/astro/src/vite-plugin-scanner/scan.ts index 51529e90445a3..74fe77dc66f40 100644 --- a/packages/astro/src/vite-plugin-scanner/scan.ts +++ b/packages/astro/src/vite-plugin-scanner/scan.ts @@ -1,6 +1,6 @@ import * as eslexer from 'es-module-lexer'; import { PageOptions } from '../vite-plugin-astro/types.js'; -import { AstroError, AstroErrorCodes, AstroErrorData } from '../core/errors/index.js' +import { AstroError, AstroErrorCodes, AstroErrorData } from '../core/errors/index.js'; const BOOLEAN_EXPORTS = new Set(['prerender']); @@ -29,15 +29,21 @@ export async function scan(code: string, id: string): Promise { if (BOOLEAN_EXPORTS.has(name)) { // For a given export, check the value of the local declaration // Basically extract the `const` from the statement `export const prerender = true` - const prefix = code.slice(0, endOfLocalName).split('export').pop()!.trim().replace('prerender', '').trim(); - // For a given export, check the value of the first non-whitespace token. + const prefix = code + .slice(0, endOfLocalName) + .split('export') + .pop()! + .trim() + .replace('prerender', '') + .trim(); + // For a given export, check the value of the first non-whitespace token. // Basically extract the `true` from the statement `export const prerender = true` const suffix = code.slice(endOfLocalName).trim().replace(/\=/, '').trim().split(/[;\n]/)[0]; if (prefix !== 'const' || !(suffix === 'true' || suffix === 'false')) { throw new AstroError({ ...AstroErrorData.InvalidPrerenderExport, message: AstroErrorData.InvalidPrerenderExport.message(prefix, suffix), - location: { file: id } + location: { file: id }, }); } else { pageOptions[name as keyof PageOptions] = suffix === 'true'; diff --git a/packages/astro/test/units/vite-plugin-astro/compile.test.js b/packages/astro/test/units/vite-plugin-astro/compile.test.js index db3f4d666bbc4..7f3eb20d7edbe 100644 --- a/packages/astro/test/units/vite-plugin-astro/compile.test.js +++ b/packages/astro/test/units/vite-plugin-astro/compile.test.js @@ -70,7 +70,7 @@ const name = 'world const result = await compile(`

Hello World

`, '/src/components/index.astro'); await init; const [, exports] = parse(result.code); - const names = exports.map(e => e.n); + const names = exports.map((e) => e.n); expect(names).to.include('default'); expect(names).to.include('file'); expect(names).to.include('url'); diff --git a/packages/astro/test/units/vite-plugin-scanner/scan.test.js b/packages/astro/test/units/vite-plugin-scanner/scan.test.js index f27286da43eeb..8bd1f08573f37 100644 --- a/packages/astro/test/units/vite-plugin-scanner/scan.test.js +++ b/packages/astro/test/units/vite-plugin-scanner/scan.test.js @@ -23,7 +23,9 @@ describe('astro scan', () => { expect(false).to.be.true; } catch (e) { expect(e.errorCode).to.equal(3019); - expect(e.message).to.contain(`A \`prerender\` export has been detected, but its value cannot be statically analyzed.`); + expect(e.message).to.contain( + `A \`prerender\` export has been detected, but its value cannot be statically analyzed.` + ); } }); @@ -33,7 +35,9 @@ describe('astro scan', () => { expect(false).to.be.true; } catch (e) { expect(e.errorCode).to.equal(3019); - expect(e.message).to.contain(`A \`prerender\` export has been detected, but its value cannot be statically analyzed.`); + expect(e.message).to.contain( + `A \`prerender\` export has been detected, but its value cannot be statically analyzed.` + ); } }); @@ -43,7 +47,9 @@ describe('astro scan', () => { expect(false).to.be.true; } catch (e) { expect(e.errorCode).to.equal(3019); - expect(e.message).to.contain(`A \`prerender\` export has been detected, but its value cannot be statically analyzed.`); + expect(e.message).to.contain( + `A \`prerender\` export has been detected, but its value cannot be statically analyzed.` + ); } }); @@ -53,27 +59,39 @@ describe('astro scan', () => { expect(false).to.be.true; } catch (e) { expect(e.errorCode).to.equal(3019); - expect(e.message).to.contain(`A \`prerender\` export has been detected, but its value cannot be statically analyzed.`); + expect(e.message).to.contain( + `A \`prerender\` export has been detected, but its value cannot be statically analyzed.` + ); } }); it('throws on unknown values III', async () => { try { - const result = await scan(`export let prerender = undefined; prerender = true;`, '/src/components/index.astro'); + const result = await scan( + `export let prerender = undefined; prerender = true;`, + '/src/components/index.astro' + ); expect(false).to.be.true; } catch (e) { expect(e.errorCode).to.equal(3019); - expect(e.message).to.contain(`A \`prerender\` export has been detected, but its value cannot be statically analyzed.`); + expect(e.message).to.contain( + `A \`prerender\` export has been detected, but its value cannot be statically analyzed.` + ); } }); it('throws on unknown values IV', async () => { try { - const result = await scan(`let prerender = true; export { prerender }`, '/src/components/index.astro'); + const result = await scan( + `let prerender = true; export { prerender }`, + '/src/components/index.astro' + ); expect(false).to.be.true; } catch (e) { expect(e.errorCode).to.equal(3019); - expect(e.message).to.contain(`A \`prerender\` export has been detected, but its value cannot be statically analyzed.`); + expect(e.message).to.contain( + `A \`prerender\` export has been detected, but its value cannot be statically analyzed.` + ); } }); }); diff --git a/packages/create-astro/CHANGELOG.md b/packages/create-astro/CHANGELOG.md index c9cbcda01592a..5a89654778cd1 100644 --- a/packages/create-astro/CHANGELOG.md +++ b/packages/create-astro/CHANGELOG.md @@ -1,5 +1,11 @@ # create-astro +## 1.2.4 + +### Patch Changes + +- [#5579](https://github.com/withastro/astro/pull/5579) [`2c2c65297`](https://github.com/withastro/astro/commit/2c2c65297a18c52691f09621ead55144efd601d4) Thanks [@yuhang-dong](https://github.com/yuhang-dong)! - Upgrade giget to support env proxy config + ## 1.2.3 ### Patch Changes diff --git a/packages/create-astro/package.json b/packages/create-astro/package.json index 6a6fa06643737..49628a937dc1e 100644 --- a/packages/create-astro/package.json +++ b/packages/create-astro/package.json @@ -1,6 +1,6 @@ { "name": "create-astro", - "version": "1.2.3", + "version": "1.2.4", "type": "module", "author": "withastro", "license": "MIT", diff --git a/packages/integrations/cloudflare/CHANGELOG.md b/packages/integrations/cloudflare/CHANGELOG.md index f17fef36e7934..3d425008913ef 100644 --- a/packages/integrations/cloudflare/CHANGELOG.md +++ b/packages/integrations/cloudflare/CHANGELOG.md @@ -1,5 +1,12 @@ # @astrojs/cloudflare +## 5.0.0 + +### Patch Changes + +- Updated dependencies [[`d2960984c`](https://github.com/withastro/astro/commit/d2960984c59af7b60a3ea472c6c58fb00534a8e6), [`31ec84797`](https://github.com/withastro/astro/commit/31ec8479721a1cd65538ec041458c5ffe8f50ee9), [`dced4a8a2`](https://github.com/withastro/astro/commit/dced4a8a2657887ec569860d9862d20f695dc23a), [`6b156dd3b`](https://github.com/withastro/astro/commit/6b156dd3b467884839a571c53114aadf26fa4b0b)]: + - astro@1.7.0 + ## 4.1.1 ### Patch Changes diff --git a/packages/integrations/cloudflare/package.json b/packages/integrations/cloudflare/package.json index 3601f790fa000..aa760516ba5d5 100644 --- a/packages/integrations/cloudflare/package.json +++ b/packages/integrations/cloudflare/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/cloudflare", "description": "Deploy your site to cloudflare workers or cloudflare pages", - "version": "4.1.1", + "version": "5.0.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", @@ -38,7 +38,7 @@ "tiny-glob": "^0.2.9" }, "peerDependencies": { - "astro": "^1.6.15" + "astro": "^1.7.0" }, "devDependencies": { "astro": "workspace:*", diff --git a/packages/integrations/deno/CHANGELOG.md b/packages/integrations/deno/CHANGELOG.md index 5b0fc99d5146e..82e20140a0407 100644 --- a/packages/integrations/deno/CHANGELOG.md +++ b/packages/integrations/deno/CHANGELOG.md @@ -1,5 +1,12 @@ # @astrojs/deno +## 3.0.0 + +### Patch Changes + +- Updated dependencies [[`d2960984c`](https://github.com/withastro/astro/commit/d2960984c59af7b60a3ea472c6c58fb00534a8e6), [`31ec84797`](https://github.com/withastro/astro/commit/31ec8479721a1cd65538ec041458c5ffe8f50ee9), [`dced4a8a2`](https://github.com/withastro/astro/commit/dced4a8a2657887ec569860d9862d20f695dc23a), [`6b156dd3b`](https://github.com/withastro/astro/commit/6b156dd3b467884839a571c53114aadf26fa4b0b)]: + - astro@1.7.0 + ## 2.0.1 ### Patch Changes diff --git a/packages/integrations/deno/package.json b/packages/integrations/deno/package.json index 252583ec0cae3..aa9e73b508058 100644 --- a/packages/integrations/deno/package.json +++ b/packages/integrations/deno/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/deno", "description": "Deploy your site to a Deno server", - "version": "2.0.1", + "version": "3.0.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", @@ -32,7 +32,7 @@ "esbuild": "^0.15.18" }, "peerDependencies": { - "astro": "^1.6.15" + "astro": "^1.7.0" }, "devDependencies": { "astro": "workspace:*", diff --git a/packages/integrations/netlify/CHANGELOG.md b/packages/integrations/netlify/CHANGELOG.md index fc7e33f4af2f9..e75586d11c1d0 100644 --- a/packages/integrations/netlify/CHANGELOG.md +++ b/packages/integrations/netlify/CHANGELOG.md @@ -1,5 +1,22 @@ # @astrojs/netlify +## 1.3.0 + +### Minor Changes + +- [#5297](https://github.com/withastro/astro/pull/5297) [`d2960984c`](https://github.com/withastro/astro/commit/d2960984c59af7b60a3ea472c6c58fb00534a8e6) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Introduces the **experimental** Prerender API. + + > **Note** + > This API is not yet stable and is subject to possible breaking changes! + + - Deploy an Astro server without sacrificing the speed or cacheability of static HTML. + - The Prerender API allows you to statically prerender specific `pages/` at build time. + + **Usage** + + - First, run `astro build --experimental-prerender` or enable `experimental: { prerender: true }` in your `astro.config.mjs` file. + - Then, include `export const prerender = true` in any file in the `pages/` directory that you wish to prerender. + ## 1.2.2 ### Patch Changes diff --git a/packages/integrations/netlify/package.json b/packages/integrations/netlify/package.json index 43413247fd5cb..eec8cdd5a8c5b 100644 --- a/packages/integrations/netlify/package.json +++ b/packages/integrations/netlify/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/netlify", "description": "Deploy your site to Netlify", - "version": "1.2.2", + "version": "1.3.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/node/CHANGELOG.md b/packages/integrations/node/CHANGELOG.md index f4c50f502a4ed..490d87ff2b089 100644 --- a/packages/integrations/node/CHANGELOG.md +++ b/packages/integrations/node/CHANGELOG.md @@ -1,5 +1,12 @@ # @astrojs/node +## 4.0.0 + +### Patch Changes + +- Updated dependencies [[`d2960984c`](https://github.com/withastro/astro/commit/d2960984c59af7b60a3ea472c6c58fb00534a8e6), [`31ec84797`](https://github.com/withastro/astro/commit/31ec8479721a1cd65538ec041458c5ffe8f50ee9), [`dced4a8a2`](https://github.com/withastro/astro/commit/dced4a8a2657887ec569860d9862d20f695dc23a), [`6b156dd3b`](https://github.com/withastro/astro/commit/6b156dd3b467884839a571c53114aadf26fa4b0b)]: + - astro@1.7.0 + ## 3.1.1 ### Patch Changes diff --git a/packages/integrations/node/package.json b/packages/integrations/node/package.json index c35ff25668006..d93e06066a09a 100644 --- a/packages/integrations/node/package.json +++ b/packages/integrations/node/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/node", "description": "Deploy your site to a Node.js server", - "version": "3.1.1", + "version": "4.0.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", @@ -34,7 +34,7 @@ "send": "^0.18.0" }, "peerDependencies": { - "astro": "^1.6.15" + "astro": "^1.7.0" }, "devDependencies": { "@types/node-fetch": "^2.6.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8e3446dc0aa6b..2a153d23ffea3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -61,7 +61,7 @@ importers: examples/basics: specifiers: - astro: ^1.6.15 + astro: ^1.7.0 dependencies: astro: link:../../packages/astro @@ -70,7 +70,7 @@ importers: '@astrojs/mdx': ^0.12.2 '@astrojs/rss': ^1.2.1 '@astrojs/sitemap': ^1.0.0 - astro: ^1.6.15 + astro: ^1.7.0 dependencies: '@astrojs/mdx': link:../../packages/integrations/mdx '@astrojs/rss': link:../../packages/astro-rss @@ -79,14 +79,14 @@ importers: examples/component: specifiers: - astro: ^1.6.15 + astro: ^1.7.0 devDependencies: astro: link:../../packages/astro examples/deno: specifiers: - '@astrojs/deno': ^2.0.1 - astro: ^1.6.15 + '@astrojs/deno': ^3.0.0 + astro: ^1.7.0 dependencies: astro: link:../../packages/astro devDependencies: @@ -102,7 +102,7 @@ importers: '@types/node': ^18.0.0 '@types/react': ^17.0.45 '@types/react-dom': ^18.0.0 - astro: ^1.6.15 + astro: ^1.7.0 html-escaper: ^3.0.3 preact: ^10.7.3 react: ^18.1.0 @@ -128,7 +128,7 @@ importers: '@astrojs/alpinejs': ^0.1.2 '@types/alpinejs': ^3.7.0 alpinejs: ^3.10.2 - astro: ^1.6.15 + astro: ^1.7.0 dependencies: '@astrojs/alpinejs': link:../../packages/integrations/alpinejs '@types/alpinejs': 3.7.1 @@ -139,7 +139,7 @@ importers: specifiers: '@astrojs/lit': ^1.0.0 '@webcomponents/template-shadowroot': ^0.1.0 - astro: ^1.6.15 + astro: ^1.7.0 lit: ^2.2.5 dependencies: '@astrojs/lit': link:../../packages/integrations/lit @@ -154,7 +154,7 @@ importers: '@astrojs/solid-js': ^1.2.3 '@astrojs/svelte': ^1.0.2 '@astrojs/vue': ^1.2.2 - astro: ^1.6.15 + astro: ^1.7.0 preact: ^10.7.3 react: ^18.1.0 react-dom: ^18.1.0 @@ -179,7 +179,7 @@ importers: specifiers: '@astrojs/preact': ^1.2.0 '@preact/signals': ^1.1.0 - astro: ^1.6.15 + astro: ^1.7.0 preact: ^10.7.3 dependencies: '@astrojs/preact': link:../../packages/integrations/preact @@ -192,7 +192,7 @@ importers: '@astrojs/react': ^1.2.2 '@types/react': ^18.0.10 '@types/react-dom': ^18.0.5 - astro: ^1.6.15 + astro: ^1.7.0 react: ^18.1.0 react-dom: ^18.1.0 dependencies: @@ -206,7 +206,7 @@ importers: examples/framework-solid: specifiers: '@astrojs/solid-js': ^1.2.3 - astro: ^1.6.15 + astro: ^1.7.0 solid-js: ^1.4.3 dependencies: '@astrojs/solid-js': link:../../packages/integrations/solid @@ -216,7 +216,7 @@ importers: examples/framework-svelte: specifiers: '@astrojs/svelte': ^1.0.2 - astro: ^1.6.15 + astro: ^1.7.0 svelte: ^3.48.0 dependencies: '@astrojs/svelte': link:../../packages/integrations/svelte @@ -226,7 +226,7 @@ importers: examples/framework-vue: specifiers: '@astrojs/vue': ^1.2.2 - astro: ^1.6.15 + astro: ^1.7.0 vue: ^3.2.37 dependencies: '@astrojs/vue': link:../../packages/integrations/vue @@ -235,41 +235,41 @@ importers: examples/hackernews: specifiers: - '@astrojs/node': ^3.1.1 - astro: ^1.6.15 + '@astrojs/node': ^4.0.0 + astro: ^1.7.0 dependencies: '@astrojs/node': link:../../packages/integrations/node astro: link:../../packages/astro examples/integration: specifiers: - astro: ^1.6.15 + astro: ^1.7.0 devDependencies: astro: link:../../packages/astro examples/minimal: specifiers: - astro: ^1.6.15 + astro: ^1.7.0 dependencies: astro: link:../../packages/astro examples/non-html-pages: specifiers: - astro: ^1.6.15 + astro: ^1.7.0 dependencies: astro: link:../../packages/astro examples/portfolio: specifiers: - astro: ^1.6.15 + astro: ^1.7.0 dependencies: astro: link:../../packages/astro examples/ssr: specifiers: - '@astrojs/node': ^3.1.1 + '@astrojs/node': ^4.0.0 '@astrojs/svelte': ^1.0.2 - astro: ^1.6.15 + astro: ^1.7.0 concurrently: ^7.2.1 svelte: ^3.48.0 unocss: ^0.15.6 @@ -286,7 +286,7 @@ importers: examples/with-markdown-plugins: specifiers: '@astrojs/markdown-remark': ^1.1.3 - astro: ^1.6.15 + astro: ^1.7.0 hast-util-select: 5.0.1 rehype-autolink-headings: ^6.1.1 rehype-slug: ^5.0.1 @@ -303,7 +303,7 @@ importers: examples/with-markdown-shiki: specifiers: - astro: ^1.6.15 + astro: ^1.7.0 dependencies: astro: link:../../packages/astro @@ -311,7 +311,7 @@ importers: specifiers: '@astrojs/mdx': ^0.12.2 '@astrojs/preact': ^1.2.0 - astro: ^1.6.15 + astro: ^1.7.0 preact: ^10.6.5 dependencies: '@astrojs/mdx': link:../../packages/integrations/mdx @@ -323,7 +323,7 @@ importers: specifiers: '@astrojs/preact': ^1.2.0 '@nanostores/preact': ^0.1.3 - astro: ^1.6.15 + astro: ^1.7.0 nanostores: ^0.5.12 preact: ^10.7.3 dependencies: @@ -338,7 +338,7 @@ importers: '@astrojs/mdx': ^0.12.2 '@astrojs/tailwind': ^2.1.3 '@types/canvas-confetti': ^1.4.3 - astro: ^1.6.15 + astro: ^1.7.0 autoprefixer: ^10.4.7 canvas-confetti: ^1.5.1 postcss: ^8.4.14 @@ -355,7 +355,7 @@ importers: examples/with-vite-plugin-pwa: specifiers: - astro: ^1.6.15 + astro: ^1.7.0 vite-plugin-pwa: 0.11.11 workbox-window: ^6.5.3 dependencies: @@ -365,7 +365,7 @@ importers: examples/with-vitest: specifiers: - astro: ^1.6.15 + astro: ^1.7.0 vitest: ^0.20.3 dependencies: astro: link:../../packages/astro @@ -1115,9 +1115,6 @@ importers: '@astrojs/node': link:../../../../integrations/node astro: link:../../.. - packages/astro/test/benchmark/simple/dist/server: - specifiers: {} - packages/astro/test/fixtures/0-css: specifiers: '@astrojs/react': workspace:* @@ -1658,9 +1655,6 @@ importers: dependencies: astro: link:../../.. - packages/astro/test/fixtures/config-vite/dist: - specifiers: {} - packages/astro/test/fixtures/css-assets: specifiers: '@astrojs/test-font-awesome-package': file:packages/font-awesome