diff --git a/examples/basics/package.json b/examples/basics/package.json
index 1fc38a49e3fa..4530fc132bbc 100644
--- a/examples/basics/package.json
+++ b/examples/basics/package.json
@@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
- "astro": "^3.5.0"
+ "astro": "^3.5.2"
}
}
diff --git a/examples/blog/package.json b/examples/blog/package.json
index 07a1b1509f64..9d8327e5f76a 100644
--- a/examples/blog/package.json
+++ b/examples/blog/package.json
@@ -14,6 +14,6 @@
"@astrojs/mdx": "^1.1.4",
"@astrojs/rss": "^3.0.0",
"@astrojs/sitemap": "^3.0.3",
- "astro": "^3.5.0"
+ "astro": "^3.5.2"
}
}
diff --git a/examples/component/package.json b/examples/component/package.json
index 2be4b426cac6..4efe10b8e382 100644
--- a/examples/component/package.json
+++ b/examples/component/package.json
@@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
- "astro": "^3.5.0"
+ "astro": "^3.5.2"
},
"peerDependencies": {
"astro": "^3.0.0"
diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json
index fab8686dbe8d..dbb12bb26b85 100644
--- a/examples/framework-alpine/package.json
+++ b/examples/framework-alpine/package.json
@@ -14,6 +14,6 @@
"@astrojs/alpinejs": "^0.3.1",
"@types/alpinejs": "^3.7.2",
"alpinejs": "^3.12.3",
- "astro": "^3.5.0"
+ "astro": "^3.5.2"
}
}
diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json
index e68969e5eab8..3100831735ff 100644
--- a/examples/framework-lit/package.json
+++ b/examples/framework-lit/package.json
@@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/lit": "^3.0.3",
"@webcomponents/template-shadowroot": "^0.2.1",
- "astro": "^3.5.0",
+ "astro": "^3.5.2",
"lit": "^2.8.0"
}
}
diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json
index 86ba2390eedc..09fda9806bc0 100644
--- a/examples/framework-multiple/package.json
+++ b/examples/framework-multiple/package.json
@@ -16,7 +16,7 @@
"@astrojs/solid-js": "^3.0.2",
"@astrojs/svelte": "^4.0.3",
"@astrojs/vue": "^3.0.4",
- "astro": "^3.5.0",
+ "astro": "^3.5.2",
"preact": "^10.17.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 5f2267ef1564..6a7a91d7185a 100644
--- a/examples/framework-preact/package.json
+++ b/examples/framework-preact/package.json
@@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/preact": "^3.0.1",
"@preact/signals": "^1.2.1",
- "astro": "^3.5.0",
+ "astro": "^3.5.2",
"preact": "^10.17.1"
}
}
diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json
index 8e6789dd828e..544c00c7d021 100644
--- a/examples/framework-react/package.json
+++ b/examples/framework-react/package.json
@@ -14,7 +14,7 @@
"@astrojs/react": "^3.0.4",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
- "astro": "^3.5.0",
+ "astro": "^3.5.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 21733e70d624..68ee1e826214 100644
--- a/examples/framework-solid/package.json
+++ b/examples/framework-solid/package.json
@@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/solid-js": "^3.0.2",
- "astro": "^3.5.0",
+ "astro": "^3.5.2",
"solid-js": "^1.7.11"
}
}
diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json
index c2b8f03f57ba..9566e4a1e3be 100644
--- a/examples/framework-svelte/package.json
+++ b/examples/framework-svelte/package.json
@@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/svelte": "^4.0.3",
- "astro": "^3.5.0",
+ "astro": "^3.5.2",
"svelte": "^4.2.0"
}
}
diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json
index 6ea13d7762cb..f8e7b5f697af 100644
--- a/examples/framework-vue/package.json
+++ b/examples/framework-vue/package.json
@@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/vue": "^3.0.4",
- "astro": "^3.5.0",
+ "astro": "^3.5.2",
"vue": "^3.3.4"
}
}
diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json
index 3421fa9ba8ca..28f72b89ed7f 100644
--- a/examples/hackernews/package.json
+++ b/examples/hackernews/package.json
@@ -12,6 +12,6 @@
},
"dependencies": {
"@astrojs/node": "^6.0.3",
- "astro": "^3.5.0"
+ "astro": "^3.5.2"
}
}
diff --git a/examples/integration/package.json b/examples/integration/package.json
index 3f9eb2a8c1a9..6b1e413e8b21 100644
--- a/examples/integration/package.json
+++ b/examples/integration/package.json
@@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
- "astro": "^3.5.0"
+ "astro": "^3.5.2"
},
"peerDependencies": {
"astro": "^3.0.0"
diff --git a/examples/middleware/package.json b/examples/middleware/package.json
index 1f6853f9f857..8c451548ab92 100644
--- a/examples/middleware/package.json
+++ b/examples/middleware/package.json
@@ -13,7 +13,7 @@
},
"dependencies": {
"@astrojs/node": "^6.0.3",
- "astro": "^3.5.0",
+ "astro": "^3.5.2",
"html-minifier": "^4.0.0"
}
}
diff --git a/examples/minimal/package.json b/examples/minimal/package.json
index 630cb77f3c2c..f874b175bae1 100644
--- a/examples/minimal/package.json
+++ b/examples/minimal/package.json
@@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
- "astro": "^3.5.0"
+ "astro": "^3.5.2"
}
}
diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json
index 56015e204fcd..96fc3b77cc76 100644
--- a/examples/non-html-pages/package.json
+++ b/examples/non-html-pages/package.json
@@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
- "astro": "^3.5.0"
+ "astro": "^3.5.2"
}
}
diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json
index 662e23e451c9..9f2868591838 100644
--- a/examples/portfolio/package.json
+++ b/examples/portfolio/package.json
@@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
- "astro": "^3.5.0"
+ "astro": "^3.5.2"
}
}
diff --git a/examples/ssr/package.json b/examples/ssr/package.json
index 73229d970fd0..e8526bd4c135 100644
--- a/examples/ssr/package.json
+++ b/examples/ssr/package.json
@@ -14,7 +14,7 @@
"dependencies": {
"@astrojs/node": "^6.0.3",
"@astrojs/svelte": "^4.0.3",
- "astro": "^3.5.0",
+ "astro": "^3.5.2",
"svelte": "^4.2.0"
}
}
diff --git a/examples/view-transitions/package.json b/examples/view-transitions/package.json
index 37daaaad4026..10f0c0f8881a 100644
--- a/examples/view-transitions/package.json
+++ b/examples/view-transitions/package.json
@@ -12,6 +12,6 @@
"devDependencies": {
"@astrojs/tailwind": "^5.0.2",
"@astrojs/node": "^6.0.3",
- "astro": "^3.5.0"
+ "astro": "^3.5.2"
}
}
diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json
index 9406bb758f28..561ee91b8ea2 100644
--- a/examples/with-markdoc/package.json
+++ b/examples/with-markdoc/package.json
@@ -12,6 +12,6 @@
},
"dependencies": {
"@astrojs/markdoc": "^0.7.1",
- "astro": "^3.5.0"
+ "astro": "^3.5.2"
}
}
diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json
index 8d1bfeea8e64..1209c236846c 100644
--- a/examples/with-markdown-plugins/package.json
+++ b/examples/with-markdown-plugins/package.json
@@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/markdown-remark": "^3.4.0",
- "astro": "^3.5.0",
+ "astro": "^3.5.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 f261984637c1..7e0a946f1575 100644
--- a/examples/with-markdown-shiki/package.json
+++ b/examples/with-markdown-shiki/package.json
@@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
- "astro": "^3.5.0"
+ "astro": "^3.5.2"
}
}
diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json
index 483ae826d493..baaf61bb32ba 100644
--- a/examples/with-mdx/package.json
+++ b/examples/with-mdx/package.json
@@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/mdx": "^1.1.4",
"@astrojs/preact": "^3.0.1",
- "astro": "^3.5.0",
+ "astro": "^3.5.2",
"preact": "^10.17.1"
}
}
diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json
index 4b140e196508..c854b95fc638 100644
--- a/examples/with-nanostores/package.json
+++ b/examples/with-nanostores/package.json
@@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/preact": "^3.0.1",
"@nanostores/preact": "^0.5.0",
- "astro": "^3.5.0",
+ "astro": "^3.5.2",
"nanostores": "^0.9.3",
"preact": "^10.17.1"
}
diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json
index e98b53af16ea..65c50399d766 100644
--- a/examples/with-tailwindcss/package.json
+++ b/examples/with-tailwindcss/package.json
@@ -14,7 +14,7 @@
"@astrojs/mdx": "^1.1.4",
"@astrojs/tailwind": "^5.0.2",
"@types/canvas-confetti": "^1.6.0",
- "astro": "^3.5.0",
+ "astro": "^3.5.2",
"autoprefixer": "^10.4.15",
"canvas-confetti": "^1.6.0",
"postcss": "^8.4.28",
diff --git a/examples/with-vite-plugin-pwa/package.json b/examples/with-vite-plugin-pwa/package.json
index 731761e4bdf6..96e9cb278d16 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": "^3.5.0",
+ "astro": "^3.5.2",
"vite-plugin-pwa": "0.16.4",
"workbox-window": "^7.0.0"
}
diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json
index 00d87fe8eb80..395079783966 100644
--- a/examples/with-vitest/package.json
+++ b/examples/with-vitest/package.json
@@ -12,7 +12,7 @@
"test": "vitest"
},
"dependencies": {
- "astro": "^3.5.0",
+ "astro": "^3.5.2",
"vitest": "^0.34.2"
}
}
diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md
index 86793a28fc13..2fda17388997 100644
--- a/packages/astro/CHANGELOG.md
+++ b/packages/astro/CHANGELOG.md
@@ -1,5 +1,25 @@
# astro
+## 3.5.2
+
+### Patch Changes
+
+- [#9057](https://github.com/withastro/astro/pull/9057) [`1bc331968`](https://github.com/withastro/astro/commit/1bc3319686808292322ea3f7e5df3b4a37357111) Thanks [@ematipico](https://github.com/ematipico)! - Correctly infer the presence of an user middleware
+
+## 3.5.1
+
+### Patch Changes
+
+- [#9037](https://github.com/withastro/astro/pull/9037) [`ea71975ec`](https://github.com/withastro/astro/commit/ea71975ec0c99f407f0e2fd0c248a959284d2068) Thanks [@sarah11918](https://github.com/sarah11918)! - Updates i18n configuration reference
+
+- [#9051](https://github.com/withastro/astro/pull/9051) [`15b84ccb9`](https://github.com/withastro/astro/commit/15b84ccb9859b070e30030015fca0de090a7b079) Thanks [@ematipico](https://github.com/ematipico)! - Fix a regression where endpoints were incorrectly processed during SSG build when `trailingSlash: "always"`
+
+- [#9042](https://github.com/withastro/astro/pull/9042) [`7dedd17fc`](https://github.com/withastro/astro/commit/7dedd17fc4c48aba31d9d39a10a94cd271b19746) Thanks [@rishi-raj-jain](https://github.com/rishi-raj-jain)! - Safely bail when the `xclip` command does not exist on Linux when trying to copy to clipboard with `astro info`
+
+- [#9050](https://github.com/withastro/astro/pull/9050) [`bf0286e50`](https://github.com/withastro/astro/commit/bf0286e50c09f8b5a08af63d7837add69af9b7e4) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Fix --verbose flag not working
+
+- [#9049](https://github.com/withastro/astro/pull/9049) [`49b82edb2`](https://github.com/withastro/astro/commit/49b82edb2c0d5058ec1adaed33d8b027220091c1) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Fix image errors when images were used on the client
+
## 3.5.0
### Minor Changes
diff --git a/packages/astro/components/ViewTransitions.astro b/packages/astro/components/ViewTransitions.astro
index 908b35595460..2e8b93c2f100 100644
--- a/packages/astro/components/ViewTransitions.astro
+++ b/packages/astro/components/ViewTransitions.astro
@@ -89,7 +89,8 @@ const { fallback = 'animate', handleForms } = Astro.props;
const form = el as HTMLFormElement;
const formData = new FormData(form);
- let action = form.action;
+ // Use the form action, if defined, otherwise fallback to current path.
+ let action = form.action ?? location.pathname;
const options: Options = {};
if (form.method === 'get') {
const params = new URLSearchParams(formData as any);
diff --git a/packages/astro/e2e/fixtures/view-transitions/src/pages/form-two.astro b/packages/astro/e2e/fixtures/view-transitions/src/pages/form-two.astro
new file mode 100644
index 000000000000..01131ee84c4d
--- /dev/null
+++ b/packages/astro/e2e/fixtures/view-transitions/src/pages/form-two.astro
@@ -0,0 +1,17 @@
+---
+import Layout from '../components/Layout.astro';
+
+if(Astro.request.method === 'POST') {
+ const formData = await Astro.request.formData();
+ const name = formData.get('name');
+ return Astro.redirect(`/form-response?name=${name}`);
+}
+---
+
+ Contact Form
+ This form does not have an `action` defined
+
+
diff --git a/packages/astro/e2e/view-transitions.test.js b/packages/astro/e2e/view-transitions.test.js
index 41f10a3aa0c5..ac0af3be2332 100644
--- a/packages/astro/e2e/view-transitions.test.js
+++ b/packages/astro/e2e/view-transitions.test.js
@@ -982,4 +982,26 @@ test.describe('View Transitions', () => {
]);
expect(reqUrls).toContainEqual('/one');
});
+
+ test('form POST with no action handler', async ({ page, astro }) => {
+ const loads = [];
+ page.addListener('load', async (p) => {
+ loads.push(p);
+ });
+
+ await page.goto(astro.resolveUrl('/form-two'));
+
+ let locator = page.locator('h2');
+ await expect(locator, 'should have content').toHaveText('Contact Form');
+
+ // Submit the form
+ await page.click('#submit');
+ const span = page.locator('#contact-name');
+ await expect(span, 'should have content').toHaveText('Testing');
+
+ expect(
+ loads.length,
+ 'There should be only 1 page load. No additional loads for the form submission'
+ ).toEqual(1);
+ });
});
diff --git a/packages/astro/package.json b/packages/astro/package.json
index 92f55bc0e29f..9ba98b4fc12a 100644
--- a/packages/astro/package.json
+++ b/packages/astro/package.json
@@ -1,6 +1,6 @@
{
"name": "astro",
- "version": "3.5.0",
+ "version": "3.5.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/@types/astro.ts b/packages/astro/src/@types/astro.ts
index 9aa7dc89b6e0..faa2df03ebb9 100644
--- a/packages/astro/src/@types/astro.ts
+++ b/packages/astro/src/@types/astro.ts
@@ -536,71 +536,6 @@ export interface AstroUserConfig {
*/
redirects?: Record;
- /**
- * @docs
- * @name prefetch
- * @type {boolean | object}
- * @description
- * Enable prefetching for links on your site to provide faster page transitions.
- * (Enabled by default on pages using the `` router. Set `prefetch: false` to opt out of this behaviour.)
- *
- * This configuration automatically adds a prefetch script to every page in the project
- * giving you access to the `data-astro-prefetch` attribute.
- * Add this attribute to any `` link on your page to enable prefetching for that page.
- *
- * ```html
- * About
- * ```
- * Further customize the default prefetching behavior using the [`prefetch.defaultStrategy`](#prefetchdefaultstrategy) and [`prefetch.prefetchAll`](#prefetchprefetchall) options.
- *
- * See the [Prefetch guide](https://docs.astro.build/en/guides/prefetch/) for more information.
- */
- prefetch?:
- | boolean
- | {
- /**
- * @docs
- * @name prefetch.prefetchAll
- * @type {boolean}
- * @description
- * Enable prefetching for all links, including those without the `data-astro-prefetch` attribute.
- * This value defaults to `true` when using the `` router. Otherwise, the default value is `false`.
- *
- * ```js
- * prefetch: {
- * prefetchAll: true
- * }
- * ```
- *
- * When set to `true`, you can disable prefetching individually by setting `data-astro-prefetch="false"` on any individual links.
- *
- * ```html
- * About
- *```
- */
- prefetchAll?: boolean;
-
- /**
- * @docs
- * @name prefetch.defaultStrategy
- * @type {'tap' | 'hover' | 'viewport'}
- * @default `'hover'`
- * @description
- * The default prefetch strategy to use when the `data-astro-prefetch` attribute is set on a link with no value.
- *
- * - `'tap'`: Prefetch just before you click on the link.
- * - `'hover'`: Prefetch when you hover over or focus on the link. (default)
- * - `'viewport'`: Prefetch as the links enter the viewport.
- *
- * You can override this default value and select a different strategy for any individual link by setting a value on the attribute.
- *
- * ```html
- * About
- * ```
- */
- defaultStrategy?: 'tap' | 'hover' | 'viewport';
- };
-
/**
* @docs
* @name site
@@ -979,6 +914,72 @@ export interface AstroUserConfig {
excludeMiddleware?: boolean;
};
+ /**
+ * @docs
+ * @kind heading
+ * @name Prefetch Options
+ * @type {boolean | object}
+ * @description
+ * Enable prefetching for links on your site to provide faster page transitions.
+ * (Enabled by default on pages using the `` router. Set `prefetch: false` to opt out of this behaviour.)
+ *
+ * This configuration automatically adds a prefetch script to every page in the project
+ * giving you access to the `data-astro-prefetch` attribute.
+ * Add this attribute to any `` link on your page to enable prefetching for that page.
+ *
+ * ```html
+ * About
+ * ```
+ * Further customize the default prefetching behavior using the [`prefetch.defaultStrategy`](#prefetchdefaultstrategy) and [`prefetch.prefetchAll`](#prefetchprefetchall) options.
+ *
+ * See the [Prefetch guide](https://docs.astro.build/en/guides/prefetch/) for more information.
+ */
+ prefetch?:
+ | boolean
+ | {
+ /**
+ * @docs
+ * @name prefetch.prefetchAll
+ * @type {boolean}
+ * @description
+ * Enable prefetching for all links, including those without the `data-astro-prefetch` attribute.
+ * This value defaults to `true` when using the `` router. Otherwise, the default value is `false`.
+ *
+ * ```js
+ * prefetch: {
+ * prefetchAll: true
+ * }
+ * ```
+ *
+ * When set to `true`, you can disable prefetching individually by setting `data-astro-prefetch="false"` on any individual links.
+ *
+ * ```html
+ * About
+ *```
+ */
+ prefetchAll?: boolean;
+
+ /**
+ * @docs
+ * @name prefetch.defaultStrategy
+ * @type {'tap' | 'hover' | 'viewport'}
+ * @default `'hover'`
+ * @description
+ * The default prefetch strategy to use when the `data-astro-prefetch` attribute is set on a link with no value.
+ *
+ * - `'tap'`: Prefetch just before you click on the link.
+ * - `'hover'`: Prefetch when you hover over or focus on the link. (default)
+ * - `'viewport'`: Prefetch as the links enter the viewport.
+ *
+ * You can override this default value and select a different strategy for any individual link by setting a value on the attribute.
+ *
+ * ```html
+ * About
+ * ```
+ */
+ defaultStrategy?: 'tap' | 'hover' | 'viewport';
+ };
+
/**
* @docs
* @kind heading
@@ -1441,7 +1442,6 @@ export interface AstroUserConfig {
*/
devOverlay?: boolean;
- // TODO review with docs team before merging to `main`
/**
* @docs
* @name experimental.i18n
@@ -1451,26 +1451,32 @@ export interface AstroUserConfig {
* @description
*
* Configures experimental i18n routing and allows you to specify some customization options.
+ *
+ * See our guide for more information on [internationalization in Astro](/en/guides/internationalization/)
*/
i18n?: {
/**
* @docs
+ * @kind h4
* @name experimental.i18n.defaultLocale
* @type {string}
* @version 3.5.0
* @description
*
* The default locale of your website/application. This is a required field.
+ *
+ * No particular language format or syntax is enforced, but we suggest using lower-case and hyphens as needed (e.g. "es", "pt-br") for greatest compatibility.
*/
defaultLocale: string;
/**
* @docs
+ * @kind h4
* @name experimental.i18n.locales
* @type {string[]}
* @version 3.5.0
* @description
*
- * A list of all locales supported by the website (e.g. `['en', 'es', 'pt_BR']`). This list should also include the `defaultLocale`. This is a required field.
+ * A list of all locales supported by the website (e.g. `['en', 'es', 'pt-br']`). This list should also include the `defaultLocale`. This is a required field.
*
* No particular language format or syntax is enforced, but your folder structure must match exactly the locales in the list.
*/
@@ -1478,6 +1484,7 @@ export interface AstroUserConfig {
/**
* @docs
+ * @kind h4
* @name experimental.i18n.fallback
* @type {Record}
* @version 3.5.0
@@ -1487,16 +1494,16 @@ export interface AstroUserConfig {
*
* Use this object to declare a fallback `locale` route for each language you support. If no fallback is specified, then unavailable pages will return a 404.
*
- * #### Example
+ * ##### Example
*
- * The following example configures your content fallback strategy to redirect unavailable pages in `/pt/` to their `es` version, and unavailable pages in `/fr/` to their `en` version. Unavailable `/es/` pages will return a 404.
+ * The following example configures your content fallback strategy to redirect unavailable pages in `/pt-br/` to their `es` version, and unavailable pages in `/fr/` to their `en` version. Unavailable `/es/` pages will return a 404.
*
* ```js
* export defualt defineConfig({
* experimental: {
* i18n: {
* defaultLocale: "en",
- * locales: ["en", "fr", "pt", "es"],
+ * locales: ["en", "fr", "pt-br", "es"],
* fallback: {
* pt: "es",
* fr: "en"
@@ -1510,20 +1517,22 @@ export interface AstroUserConfig {
/**
* @docs
+ * @kind h4
* @name experimental.i18n.routingStrategy
* @type {'prefix-always' | 'prefix-other-locales'}
* @default 'prefix-other-locales'
* @version 3.5.0
* @description
*
- * Controls the routing strategy to determine your site URLs.
+ * Controls the routing strategy to determine your site URLs. Set this based on your folder/URL path configuration for your default language:
*
- * - `prefix-other-locales`(default): Only non-default languages will display a language prefix. The `defaultLocale` will not show a language prefix.
- * URLs will be of the form `example.com/[lang]/content/` for all non-default languages, but `example.com/content/` for the default locale.
+ * - `prefix-other-locales`(default): Only non-default languages will display a language prefix.
+ * The `defaultLocale` will not show a language prefix and content files do not exist in a localized folder.
+ * URLs will be of the form `example.com/[locale]/content/` for all non-default languages, but `example.com/content/` for the default locale.
* - `prefix-always`: All URLs will display a language prefix.
- * URLs will be of the form `example.com/[lang]/content/` for every route, including the default language.
+ * URLs will be of the form `example.com/[locale]/content/` for every route, including the default language.
+ * Localized folders are used for every language, including the default.
*
- * Note: Astro requires all content to exist within a `/[lang]/` folder, even for the default language.
*/
routingStrategy?: 'prefix-always' | 'prefix-other-locales';
};
diff --git a/packages/astro/src/assets/vite-plugin-assets.ts b/packages/astro/src/assets/vite-plugin-assets.ts
index 02e3a3bb31f9..ff6d0034e550 100644
--- a/packages/astro/src/assets/vite-plugin-assets.ts
+++ b/packages/astro/src/assets/vite-plugin-assets.ts
@@ -175,7 +175,7 @@ export default function assets({
configResolved(viteConfig) {
resolvedConfig = viteConfig;
},
- async load(id) {
+ async load(id, options) {
// If our import has any query params, we'll let Vite handle it
// See https://github.com/withastro/astro/issues/8333
if (id !== removeQueryString(id)) {
@@ -191,8 +191,18 @@ export default function assets({
});
}
- return `
- export default ${getProxyCode(meta, isServerLikeOutput(settings.config))}`;
+ // We can only reliably determine if an image is used on the server, as we need to track its usage throughout the entire build.
+ // Since you cannot use image optimization on the client anyway, it's safe to assume that if the user imported
+ // an image on the client, it should be present in the final build.
+ if (options?.ssr) {
+ return `export default ${getProxyCode(meta, isServerLikeOutput(settings.config))}`;
+ } else {
+ if (!globalThis.astroAsset.referencedImages)
+ globalThis.astroAsset.referencedImages = new Set();
+
+ globalThis.astroAsset.referencedImages.add(meta.fsPath);
+ return `export default ${JSON.stringify(meta)}`;
+ }
}
},
},
diff --git a/packages/astro/src/cli/info/index.ts b/packages/astro/src/cli/info/index.ts
index cfa9aca8f636..46e7d3c6978c 100644
--- a/packages/astro/src/cli/info/index.ts
+++ b/packages/astro/src/cli/info/index.ts
@@ -49,13 +49,18 @@ async function copyToClipboard(text: string) {
} else if (system === 'win32') {
command = 'clip';
} else {
- // Unix: check if `xclip` is installed
- const output = execSync('which xclip', { encoding: 'utf8' });
- if (output[0] !== '/') {
- // Did not find a path for xclip, bail out!
+ try {
+ // Unix: check if `xclip` is installed
+ const output = execSync('which xclip', { encoding: 'utf8' });
+ if (output[0] !== '/') {
+ // Did not find a path for xclip, bail out!
+ return;
+ }
+ command = 'xclip -sel clipboard -l 1';
+ } catch (e) {
+ // Did not find xclip, bail out!
return;
}
- command = 'xclip -sel clipboard -l 1';
}
console.log();
diff --git a/packages/astro/src/core/logger/node.ts b/packages/astro/src/core/logger/node.ts
index aeef4bd84219..57aa59ed02d4 100644
--- a/packages/astro/src/core/logger/node.ts
+++ b/packages/astro/src/core/logger/node.ts
@@ -124,6 +124,7 @@ export const logger = {
};
export function enableVerboseLogging() {
+ debugPackage.enable('*,-babel');
debug('cli', '--verbose flag enabled! Enabling: DEBUG="*,-babel"');
debug(
'cli',
diff --git a/packages/astro/src/core/middleware/vite-plugin.ts b/packages/astro/src/core/middleware/vite-plugin.ts
index 790c76129cf3..0447134910f0 100644
--- a/packages/astro/src/core/middleware/vite-plugin.ts
+++ b/packages/astro/src/core/middleware/vite-plugin.ts
@@ -15,6 +15,7 @@ export function vitePluginMiddleware({ settings }: { settings: AstroSettings }):
let resolvedMiddlewareId: string | undefined = undefined;
const hasIntegrationMiddleware =
settings.middlewares.pre.length > 0 || settings.middlewares.post.length > 0;
+ let userMiddlewareIsPresent = false;
return {
name: '@astro/plugin-middleware',
@@ -29,6 +30,7 @@ export function vitePluginMiddleware({ settings }: { settings: AstroSettings }):
const middlewareId = await this.resolve(
`${decodeURI(settings.config.srcDir.pathname)}${MIDDLEWARE_PATH_SEGMENT_NAME}`
);
+ userMiddlewareIsPresent = !!middlewareId;
if (middlewareId) {
resolvedMiddlewareId = middlewareId.id;
return MIDDLEWARE_MODULE_ID;
@@ -61,13 +63,17 @@ export function vitePluginMiddleware({ settings }: { settings: AstroSettings }):
const postMiddleware = createMiddlewareImports(settings.middlewares.post, 'post');
const source = `
-import { onRequest as userOnRequest } from '${resolvedMiddlewareId}';
+ ${
+ userMiddlewareIsPresent
+ ? `import { onRequest as userOnRequest } from '${resolvedMiddlewareId}';`
+ : ''
+ }
import { sequence } from 'astro:middleware';
${preMiddleware.importsCode}${postMiddleware.importsCode}
export const onRequest = sequence(
${preMiddleware.sequenceCode}${preMiddleware.sequenceCode ? ',' : ''}
- userOnRequest${postMiddleware.sequenceCode ? ',' : ''}
+ ${userMiddlewareIsPresent ? `userOnRequest${postMiddleware.sequenceCode ? ',' : ''}` : ''}
${postMiddleware.sequenceCode}
);
`.trim();
diff --git a/packages/astro/src/core/render/route-cache.ts b/packages/astro/src/core/render/route-cache.ts
index 5b22518deeb9..c318b8c44308 100644
--- a/packages/astro/src/core/render/route-cache.ts
+++ b/packages/astro/src/core/render/route-cache.ts
@@ -31,12 +31,15 @@ export async function callGetStaticPaths({
ssr,
}: CallGetStaticPathsOptions): Promise {
const cached = routeCache.get(route);
- if (cached?.staticPaths) return cached.staticPaths;
-
- if (mod) {
- validateDynamicRouteModule(mod, { ssr, route });
+ if (!mod) {
+ throw new Error('This is an error caused by Astro and not your code. Please file an issue.');
+ }
+ if (cached?.staticPaths) {
+ return cached.staticPaths;
}
+ validateDynamicRouteModule(mod, { ssr, route });
+
// No static paths in SSR mode. Return an empty RouteCacheEntry.
if (ssr && !route.prerender) {
const entry: GetStaticPathsResultKeyed = Object.assign([], { keyed: new Map() });
@@ -47,24 +50,20 @@ export async function callGetStaticPaths({
let staticPaths: GetStaticPathsResult = [];
// Add a check here to make TypeScript happy.
// This is already checked in validateDynamicRouteModule().
- if (mod) {
- if (!mod.getStaticPaths) {
- throw new Error('Unexpected Error.');
- }
-
- if (mod) {
- // Calculate your static paths.
- staticPaths = await mod.getStaticPaths({
- // Q: Why the cast?
- // A: So users downstream can have nicer typings, we have to make some sacrifice in our internal typings, which necessitate a cast here
- paginate: generatePaginateFunction(route) as PaginateFunction,
- rss() {
- throw new AstroError(AstroErrorData.GetStaticPathsRemovedRSSHelper);
- },
- });
- }
+ if (!mod.getStaticPaths) {
+ throw new Error('Unexpected Error.');
}
+ // Calculate your static paths.
+ staticPaths = await mod.getStaticPaths({
+ // Q: Why the cast?
+ // A: So users downstream can have nicer typings, we have to make some sacrifice in our internal typings, which necessitate a cast here
+ paginate: generatePaginateFunction(route) as PaginateFunction,
+ rss() {
+ throw new AstroError(AstroErrorData.GetStaticPathsRemovedRSSHelper);
+ },
+ });
+
validateGetStaticPathsResult(staticPaths, logger, route);
const keyedStaticPaths = staticPaths as GetStaticPathsResultKeyed;
diff --git a/packages/astro/src/core/routing/manifest/create.ts b/packages/astro/src/core/routing/manifest/create.ts
index f5b6e0ccdda3..6a57972e0712 100644
--- a/packages/astro/src/core/routing/manifest/create.ts
+++ b/packages/astro/src/core/routing/manifest/create.ts
@@ -60,9 +60,12 @@ function getParts(part: string, file: string) {
return result;
}
-function getPattern(segments: RoutePart[][], config: AstroConfig) {
+function getPattern(
+ segments: RoutePart[][],
+ config: AstroConfig,
+ addTrailingSlash: AstroConfig['trailingSlash']
+) {
const base = config.base;
- const addTrailingSlash = config.trailingSlash;
const pathname = segments
.map((segment) => {
if (segment.length === 1 && segment[0].spread) {
@@ -325,7 +328,7 @@ export function createRouteManifest(
components.push(item.file);
const component = item.file;
const trailingSlash = item.isPage ? settings.config.trailingSlash : 'never';
- const pattern = getPattern(segments, settings.config);
+ const pattern = getPattern(segments, settings.config, trailingSlash);
const generate = getRouteGenerator(segments, trailingSlash);
const pathname = segments.every((segment) => segment.length === 1 && !segment[0].dynamic)
? `/${segments.map((segment) => segment[0].content).join('/')}`
@@ -386,7 +389,7 @@ export function createRouteManifest(
const isPage = type === 'page';
const trailingSlash = isPage ? config.trailingSlash : 'never';
- const pattern = getPattern(segments, settings.config);
+ const pattern = getPattern(segments, settings.config, trailingSlash);
const generate = getRouteGenerator(segments, trailingSlash);
const pathname = segments.every((segment) => segment.length === 1 && !segment[0].dynamic)
? `/${segments.map((segment) => segment[0].content).join('/')}`
@@ -433,7 +436,7 @@ export function createRouteManifest(
return getParts(s, from);
});
- const pattern = getPattern(segments, settings.config);
+ const pattern = getPattern(segments, settings.config, trailingSlash);
const generate = getRouteGenerator(segments, trailingSlash);
const pathname = segments.every((segment) => segment.length === 1 && !segment[0].dynamic)
? `/${segments.map((segment) => segment[0].content).join('/')}`
@@ -551,7 +554,7 @@ export function createRouteManifest(
pathname,
route,
segments,
- pattern: getPattern(segments, config),
+ pattern: getPattern(segments, config, config.trailingSlash),
type: 'fallback',
});
}
@@ -624,7 +627,7 @@ export function createRouteManifest(
pathname,
route,
segments,
- pattern: getPattern(segments, config),
+ pattern: getPattern(segments, config, config.trailingSlash),
type: 'fallback',
});
}
diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts
index b5f198653076..8c008e209176 100644
--- a/packages/astro/src/transitions/router.ts
+++ b/packages/astro/src/transitions/router.ts
@@ -463,9 +463,10 @@ export function navigate(href: string, options?: Options) {
}
const toLocation = new URL(href, location.href);
// We do not have page transitions on navigations to the same page (intra-page navigation)
+ // *unless* they are form posts which have side-effects and so need to happen
// but we want to handle prevent reload on navigation to the same page
// Same page means same origin, path and query params (but maybe different hash)
- if (location.origin === toLocation.origin && samePage(toLocation)) {
+ if (location.origin === toLocation.origin && samePage(toLocation) && !options?.formData) {
moveToLocation(toLocation, options?.history === 'replace', true);
} else {
// different origin will be detected by fetch
diff --git a/packages/astro/test/core-image.test.js b/packages/astro/test/core-image.test.js
index bd2efc466915..0583ed376657 100644
--- a/packages/astro/test/core-image.test.js
+++ b/packages/astro/test/core-image.test.js
@@ -935,6 +935,18 @@ describe('astro:image', () => {
expect(isReusingCache).to.be.true;
});
+ it('client images are written to build', async () => {
+ const html = await fixture.readFile('/client/index.html');
+ const $ = cheerio.load(html);
+ let $script = $('script');
+
+ // Find image
+ const regex = /src:"([^"]*)/gm;
+ const imageSrc = regex.exec($script.html())[1];
+ const data = await fixture.readFile(imageSrc, null);
+ expect(data).to.be.an.instanceOf(Buffer);
+ });
+
describe('custom service in build', () => {
it('uses configured hashes properties', async () => {
await fixture.build();
diff --git a/packages/astro/test/fixtures/core-image-ssg/src/assets/light_walrus.avif b/packages/astro/test/fixtures/core-image-ssg/src/assets/light_walrus.avif
new file mode 100644
index 000000000000..89e1c3a14311
Binary files /dev/null and b/packages/astro/test/fixtures/core-image-ssg/src/assets/light_walrus.avif differ
diff --git a/packages/astro/test/fixtures/core-image-ssg/src/client/client-image.ts b/packages/astro/test/fixtures/core-image-ssg/src/client/client-image.ts
new file mode 100644
index 000000000000..796f037fa158
--- /dev/null
+++ b/packages/astro/test/fixtures/core-image-ssg/src/client/client-image.ts
@@ -0,0 +1,2 @@
+import light_walrus from "../assets/light_walrus.avif";
+console.log(light_walrus);
diff --git a/packages/astro/test/fixtures/core-image-ssg/src/pages/client.astro b/packages/astro/test/fixtures/core-image-ssg/src/pages/client.astro
new file mode 100644
index 000000000000..d496bad4931f
--- /dev/null
+++ b/packages/astro/test/fixtures/core-image-ssg/src/pages/client.astro
@@ -0,0 +1,2 @@
+
+
diff --git a/packages/astro/test/fixtures/middleware space/integration-middleware-post.js b/packages/astro/test/fixtures/middleware space/integration-middleware-post.js
index 4cc63c6b7c49..a4e0c90ad9b6 100644
--- a/packages/astro/test/fixtures/middleware space/integration-middleware-post.js
+++ b/packages/astro/test/fixtures/middleware space/integration-middleware-post.js
@@ -1,11 +1,11 @@
-import { sequence, defineMiddleware } from 'astro:middleware';
+import { defineMiddleware } from 'astro:middleware';
export const onRequest = defineMiddleware((context, next) => {
- if(context.url.pathname === '/integration-post') {
+ if (context.url.pathname === '/integration-post') {
return new Response(JSON.stringify({ post: 'works' }), {
headers: {
- 'content-type': 'application/json'
- }
+ 'content-type': 'application/json',
+ },
});
}
diff --git a/packages/astro/test/fixtures/middleware space/integration-middleware-pre.js b/packages/astro/test/fixtures/middleware space/integration-middleware-pre.js
index 3bf484b2becb..1ebf28066350 100644
--- a/packages/astro/test/fixtures/middleware space/integration-middleware-pre.js
+++ b/packages/astro/test/fixtures/middleware space/integration-middleware-pre.js
@@ -1,11 +1,11 @@
-import { sequence, defineMiddleware } from 'astro:middleware';
+import { defineMiddleware } from 'astro:middleware';
export const onRequest = defineMiddleware((context, next) => {
- if(context.url.pathname === '/integration-pre') {
+ if (context.url.pathname === '/integration-pre') {
return new Response(JSON.stringify({ pre: 'works' }), {
headers: {
- 'content-type': 'application/json'
- }
+ 'content-type': 'application/json',
+ },
});
}
diff --git a/packages/astro/test/fixtures/middleware-no-user-middleware/astro.config.mjs b/packages/astro/test/fixtures/middleware-no-user-middleware/astro.config.mjs
new file mode 100644
index 000000000000..ffae133bebc1
--- /dev/null
+++ b/packages/astro/test/fixtures/middleware-no-user-middleware/astro.config.mjs
@@ -0,0 +1,23 @@
+import {defineConfig} from "astro/config";
+import {fileURLToPath} from "node:url";
+
+export default defineConfig({
+ integrations: [
+ {
+ name: 'my-middleware',
+ hooks: {
+ 'astro:config:setup':({ addMiddleware }) => {
+ addMiddleware({
+ entrypoint: fileURLToPath(new URL('./integration-middleware-pre.js', import.meta.url)),
+ order: 'pre'
+ });
+
+ addMiddleware({
+ entrypoint: fileURLToPath(new URL('./integration-middleware-post.js', import.meta.url)),
+ order: 'post'
+ });
+ }
+ }
+ }
+ ]
+});
diff --git a/packages/astro/test/fixtures/middleware-no-user-middleware/integration-middleware-post.js b/packages/astro/test/fixtures/middleware-no-user-middleware/integration-middleware-post.js
new file mode 100644
index 000000000000..18c8969c308b
--- /dev/null
+++ b/packages/astro/test/fixtures/middleware-no-user-middleware/integration-middleware-post.js
@@ -0,0 +1,13 @@
+import { defineMiddleware } from 'astro:middleware';
+
+export const onRequest = defineMiddleware((context, next) => {
+ if (context.url.pathname === '/post') {
+ return new Response(JSON.stringify({ post: 'works' }), {
+ headers: {
+ 'content-type': 'application/json',
+ },
+ });
+ }
+
+ return next();
+});
diff --git a/packages/astro/test/fixtures/middleware-no-user-middleware/integration-middleware-pre.js b/packages/astro/test/fixtures/middleware-no-user-middleware/integration-middleware-pre.js
new file mode 100644
index 000000000000..07bb16b4600b
--- /dev/null
+++ b/packages/astro/test/fixtures/middleware-no-user-middleware/integration-middleware-pre.js
@@ -0,0 +1,13 @@
+import { defineMiddleware } from 'astro:middleware';
+
+export const onRequest = defineMiddleware((context, next) => {
+ if (context.url.pathname === '/pre') {
+ return new Response(JSON.stringify({ pre: 'works' }), {
+ headers: {
+ 'content-type': 'application/json',
+ },
+ });
+ }
+
+ return next();
+});
diff --git a/packages/astro/test/fixtures/middleware-no-user-middleware/package.json b/packages/astro/test/fixtures/middleware-no-user-middleware/package.json
new file mode 100644
index 000000000000..9a2a378ed116
--- /dev/null
+++ b/packages/astro/test/fixtures/middleware-no-user-middleware/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "@test/middleware-no-user-middlewaqre",
+ "version": "0.0.0",
+ "private": true,
+ "dependencies": {
+ "astro": "workspace:*"
+ }
+}
diff --git a/packages/astro/test/fixtures/middleware-no-user-middleware/src/pages/index.astro b/packages/astro/test/fixtures/middleware-no-user-middleware/src/pages/index.astro
new file mode 100644
index 000000000000..822b15cd318c
--- /dev/null
+++ b/packages/astro/test/fixtures/middleware-no-user-middleware/src/pages/index.astro
@@ -0,0 +1,14 @@
+---
+const data = Astro.locals;
+---
+
+
+
+ Testing
+
+
+
+Index
+{data?.name}
+
+
diff --git a/packages/astro/test/fixtures/middleware-no-user-middleware/src/pages/post.astro b/packages/astro/test/fixtures/middleware-no-user-middleware/src/pages/post.astro
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/packages/astro/test/fixtures/middleware-no-user-middleware/src/pages/pre.astro b/packages/astro/test/fixtures/middleware-no-user-middleware/src/pages/pre.astro
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/packages/astro/test/middleware.test.js b/packages/astro/test/middleware.test.js
index a9487950eb65..8332dfe41949 100644
--- a/packages/astro/test/middleware.test.js
+++ b/packages/astro/test/middleware.test.js
@@ -99,6 +99,31 @@ describe('Middleware in DEV mode', () => {
expect(json.post).to.equal('works');
});
});
+
+ describe('Integration hooks with no user middleware', () => {
+ before(async () => {
+ fixture = await loadFixture({
+ root: './fixtures/middleware-no-user-middleware/',
+ });
+ devServer = await fixture.startDevServer();
+ });
+
+ after(async () => {
+ await devServer.stop();
+ });
+
+ it('Integration middleware marked as "pre" runs', async () => {
+ let res = await fixture.fetch('/pre');
+ let json = await res.json();
+ expect(json.pre).to.equal('works');
+ });
+
+ it('Integration middleware marked as "post" runs', async () => {
+ let res = await fixture.fetch('/post');
+ let json = await res.json();
+ expect(json.post).to.equal('works');
+ });
+ });
});
describe('Middleware in PROD mode, SSG', () => {
diff --git a/packages/create-astro/CHANGELOG.md b/packages/create-astro/CHANGELOG.md
index 3b270b3bd352..d50bb1c7f8b1 100644
--- a/packages/create-astro/CHANGELOG.md
+++ b/packages/create-astro/CHANGELOG.md
@@ -1,5 +1,11 @@
# create-astro
+## 4.5.1
+
+### Patch Changes
+
+- [#9048](https://github.com/withastro/astro/pull/9048) [`1e97708cd`](https://github.com/withastro/astro/commit/1e97708cda779510d638abaefdb4abf707b697e3) Thanks [@skirianov](https://github.com/skirianov)! - Fixes an issue where a successful "Dependencies installed" message is displayed even when installing dependencies fails.
+
## 4.5.0
### Minor Changes
diff --git a/packages/create-astro/package.json b/packages/create-astro/package.json
index 4f78989fbc84..7aa1b62f6e2e 100644
--- a/packages/create-astro/package.json
+++ b/packages/create-astro/package.json
@@ -1,6 +1,6 @@
{
"name": "create-astro",
- "version": "4.5.0",
+ "version": "4.5.1",
"type": "module",
"author": "withastro",
"license": "MIT",
@@ -31,7 +31,7 @@
"//a": "MOST PACKAGES SHOULD GO IN DEV_DEPENDENCIES! THEY WILL BE BUNDLED.",
"//b": "DEPENDENCIES IS FOR UNBUNDLED PACKAGES",
"dependencies": {
- "@astrojs/cli-kit": "^0.3.0",
+ "@astrojs/cli-kit": "^0.3.1",
"giget": "1.1.2"
},
"devDependencies": {
diff --git a/packages/create-astro/src/actions/dependencies.ts b/packages/create-astro/src/actions/dependencies.ts
index 1e731099c010..e920fcf8e482 100644
--- a/packages/create-astro/src/actions/dependencies.ts
+++ b/packages/create-astro/src/actions/dependencies.ts
@@ -27,17 +27,16 @@ export async function dependencies(
await spinner({
start: `Installing dependencies with ${ctx.packageManager}...`,
end: 'Dependencies installed',
- while: () => {
- return install({ packageManager: ctx.packageManager, cwd: ctx.cwd }).catch((e) => {
- error('error', e);
- error(
- 'error',
- `Dependencies failed to install, please run ${color.bold(
- ctx.packageManager + ' install'
- )} to install them manually after setup.`
- );
- });
+ onError: (e) => {
+ error('error', e);
+ error(
+ 'error',
+ `Dependencies failed to install, please run ${color.bold(
+ ctx.packageManager + ' install'
+ )} to install them manually after setup.`
+ );
},
+ while: () => install({ packageManager: ctx.packageManager, cwd: ctx.cwd }),
});
} else {
await info(
diff --git a/packages/create-astro/src/messages.ts b/packages/create-astro/src/messages.ts
index 29c551883a74..09675740a1f9 100644
--- a/packages/create-astro/src/messages.ts
+++ b/packages/create-astro/src/messages.ts
@@ -31,6 +31,7 @@ export async function say(messages: string | string[], { clear = false, hat = ''
export async function spinner(args: {
start: string;
end: string;
+ onError?: (error: any) => void;
while: (...args: any) => Promise;
}) {
await load(args, { stdout });
diff --git a/packages/integrations/sitemap/test/fixtures/static/astro.config.mjs b/packages/integrations/sitemap/test/fixtures/static/astro.config.mjs
index 1b53c53a8ca1..f0288b6dd7a3 100644
--- a/packages/integrations/sitemap/test/fixtures/static/astro.config.mjs
+++ b/packages/integrations/sitemap/test/fixtures/static/astro.config.mjs
@@ -4,7 +4,7 @@ import sitemap from '@astrojs/sitemap';
export default defineConfig({
integrations: [sitemap()],
site: 'http://example.com',
- redirects: {
- '/redirect': '/'
- },
+ redirects: {
+ '/redirect': '/'
+ },
})
diff --git a/packages/integrations/sitemap/test/fixtures/static/src/pages/[lang]/manifest.ts b/packages/integrations/sitemap/test/fixtures/static/src/pages/[lang]/manifest.ts
new file mode 100644
index 000000000000..907b94a21795
--- /dev/null
+++ b/packages/integrations/sitemap/test/fixtures/static/src/pages/[lang]/manifest.ts
@@ -0,0 +1,15 @@
+export const GET: APIRoute = async ({ params }) => {
+ const { lang } = params;
+
+ return new Response(`I'm a route in the "${lang}" language.`);
+};
+
+export async function getStaticPaths() {
+ return ['it', 'en'].map((language) => {
+ return {
+ params: {
+ lang: language,
+ },
+ };
+ });
+}
diff --git a/packages/integrations/sitemap/test/staticPaths.test.js b/packages/integrations/sitemap/test/staticPaths.test.js
index d5d95b2d3afd..603af163d10b 100644
--- a/packages/integrations/sitemap/test/staticPaths.test.js
+++ b/packages/integrations/sitemap/test/staticPaths.test.js
@@ -10,6 +10,7 @@ describe('getStaticPaths support', () => {
before(async () => {
fixture = await loadFixture({
root: './fixtures/static/',
+ trailingSlash: 'always',
});
await fixture.build();
@@ -33,4 +34,9 @@ describe('getStaticPaths support', () => {
it('includes numerical pages', () => {
expect(urls).to.include('http://example.com/123/');
});
+
+ it('should render the endpoint', async () => {
+ const page = await fixture.readFile('./it/manifest');
+ expect(page).to.contain('I\'m a route in the "it" language.');
+ });
});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index cf80efc75923..e76e5350f7be 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -125,7 +125,7 @@ importers:
examples/basics:
dependencies:
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
examples/blog:
@@ -140,13 +140,13 @@ importers:
specifier: ^3.0.3
version: link:../../packages/integrations/sitemap
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
examples/component:
devDependencies:
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
examples/framework-alpine:
@@ -161,7 +161,7 @@ importers:
specifier: ^3.12.3
version: 3.13.2
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
examples/framework-lit:
@@ -173,7 +173,7 @@ importers:
specifier: ^0.2.1
version: 0.2.1
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
lit:
specifier: ^2.8.0
@@ -197,7 +197,7 @@ importers:
specifier: ^3.0.4
version: link:../../packages/integrations/vue
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
preact:
specifier: ^10.17.1
@@ -227,7 +227,7 @@ importers:
specifier: ^1.2.1
version: 1.2.1(preact@10.18.1)
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
preact:
specifier: ^10.17.1
@@ -245,7 +245,7 @@ importers:
specifier: ^18.2.7
version: 18.2.14
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
react:
specifier: ^18.2.0
@@ -260,7 +260,7 @@ importers:
specifier: ^3.0.2
version: link:../../packages/integrations/solid
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
solid-js:
specifier: ^1.7.11
@@ -272,7 +272,7 @@ importers:
specifier: ^4.0.3
version: link:../../packages/integrations/svelte
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
svelte:
specifier: ^4.2.0
@@ -284,7 +284,7 @@ importers:
specifier: ^3.0.4
version: link:../../packages/integrations/vue
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
vue:
specifier: ^3.3.4
@@ -296,13 +296,13 @@ importers:
specifier: ^6.0.3
version: link:../../packages/integrations/node
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
examples/integration:
devDependencies:
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
examples/middleware:
@@ -311,7 +311,7 @@ importers:
specifier: ^6.0.3
version: link:../../packages/integrations/node
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
html-minifier:
specifier: ^4.0.0
@@ -320,19 +320,19 @@ importers:
examples/minimal:
dependencies:
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
examples/non-html-pages:
dependencies:
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
examples/portfolio:
dependencies:
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
examples/ssr:
@@ -344,7 +344,7 @@ importers:
specifier: ^4.0.3
version: link:../../packages/integrations/svelte
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
svelte:
specifier: ^4.2.0
@@ -359,7 +359,7 @@ importers:
specifier: ^5.0.2
version: link:../../packages/integrations/tailwind
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
examples/with-markdoc:
@@ -368,7 +368,7 @@ importers:
specifier: ^0.7.1
version: link:../../packages/integrations/markdoc
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
examples/with-markdown-plugins:
@@ -377,7 +377,7 @@ importers:
specifier: ^3.4.0
version: link:../../packages/markdown/remark
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
hast-util-select:
specifier: ^5.0.5
@@ -398,7 +398,7 @@ importers:
examples/with-markdown-shiki:
dependencies:
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
examples/with-mdx:
@@ -410,7 +410,7 @@ importers:
specifier: ^3.0.1
version: link:../../packages/integrations/preact
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
preact:
specifier: ^10.17.1
@@ -425,7 +425,7 @@ importers:
specifier: ^0.5.0
version: 0.5.0(nanostores@0.9.4)(preact@10.18.1)
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
nanostores:
specifier: ^0.9.3
@@ -446,7 +446,7 @@ importers:
specifier: ^1.6.0
version: 1.6.2
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
autoprefixer:
specifier: ^10.4.15
@@ -464,7 +464,7 @@ importers:
examples/with-vite-plugin-pwa:
dependencies:
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
vite-plugin-pwa:
specifier: 0.16.4
@@ -476,7 +476,7 @@ importers:
examples/with-vitest:
dependencies:
astro:
- specifier: ^3.5.0
+ specifier: ^3.5.2
version: link:../../packages/astro
vitest:
specifier: ^0.34.2
@@ -2957,6 +2957,12 @@ importers:
specifier: workspace:*
version: link:../../..
+ packages/astro/test/fixtures/middleware-no-user-middleware:
+ dependencies:
+ astro:
+ specifier: workspace:*
+ version: link:../../..
+
packages/astro/test/fixtures/middleware-ssg:
dependencies:
astro:
@@ -3700,8 +3706,8 @@ importers:
packages/create-astro:
dependencies:
'@astrojs/cli-kit':
- specifier: ^0.3.0
- version: 0.3.0
+ specifier: ^0.3.1
+ version: 0.3.1
giget:
specifier: 1.1.2
version: 1.1.2
@@ -5166,8 +5172,8 @@ packages:
- prettier-plugin-astro
dev: true
- /@astrojs/cli-kit@0.3.0:
- resolution: {integrity: sha512-nil0Kz2xuzR3xQX+FVHg2W8g+FvbeUeoCeU53duQjAFuHRJrbqWRmgfjYeM6f2780dsSuGiYMXmY+IaJqaqiaw==}
+ /@astrojs/cli-kit@0.3.1:
+ resolution: {integrity: sha512-BEzf3gudr4XrrrInJKD+GSS5O+GXRTukLUpOfgqdTSq6d48EWVhigNHobmlQGbpa9FEAw+sZmvmHmhS29QhnwA==}
engines: {node: '>=18.14.1'}
dependencies:
chalk: 5.3.0