astro 3.5.1 → 3.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -89,7 +89,8 @@ const { fallback = 'animate', handleForms } = Astro.props;
89
89
 
90
90
  const form = el as HTMLFormElement;
91
91
  const formData = new FormData(form);
92
- let action = form.action;
92
+ // Use the form action, if defined, otherwise fallback to current path.
93
+ let action = form.action ?? location.pathname;
93
94
  const options: Options = {};
94
95
  if (form.method === 'get') {
95
96
  const params = new URLSearchParams(formData as any);
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "3.5.1";
1
+ const ASTRO_VERSION = "3.5.2";
2
2
  const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
3
3
  ".markdown",
4
4
  ".mdown",
@@ -20,7 +20,7 @@ async function dev(inlineConfig) {
20
20
  base: restart.container.settings.config.base
21
21
  })
22
22
  );
23
- const currentVersion = "3.5.1";
23
+ const currentVersion = "3.5.2";
24
24
  if (currentVersion.includes("-")) {
25
25
  logger.warn(null, msg.prerelease({ currentVersion }));
26
26
  }
@@ -50,7 +50,7 @@ function serverStart({
50
50
  base,
51
51
  isRestart = false
52
52
  }) {
53
- const version = "3.5.1";
53
+ const version = "3.5.2";
54
54
  const localPrefix = `${dim("\u2503")} Local `;
55
55
  const networkPrefix = `${dim("\u2503")} Network `;
56
56
  const emptyPrefix = " ".repeat(11);
@@ -235,7 +235,7 @@ function printHelp({
235
235
  message.push(
236
236
  linebreak(),
237
237
  ` ${bgGreen(black(` ${commandName} `))} ${green(
238
- `v${"3.5.1"}`
238
+ `v${"3.5.2"}`
239
239
  )} ${headline}`
240
240
  );
241
241
  }
@@ -8,6 +8,7 @@ function vitePluginMiddleware({ settings }) {
8
8
  let isCommandBuild = false;
9
9
  let resolvedMiddlewareId = void 0;
10
10
  const hasIntegrationMiddleware = settings.middlewares.pre.length > 0 || settings.middlewares.post.length > 0;
11
+ let userMiddlewareIsPresent = false;
11
12
  return {
12
13
  name: "@astro/plugin-middleware",
13
14
  config(opts, { command }) {
@@ -19,6 +20,7 @@ function vitePluginMiddleware({ settings }) {
19
20
  const middlewareId = await this.resolve(
20
21
  `${decodeURI(settings.config.srcDir.pathname)}${MIDDLEWARE_PATH_SEGMENT_NAME}`
21
22
  );
23
+ userMiddlewareIsPresent = !!middlewareId;
22
24
  if (middlewareId) {
23
25
  resolvedMiddlewareId = middlewareId.id;
24
26
  return MIDDLEWARE_MODULE_ID;
@@ -47,13 +49,13 @@ function vitePluginMiddleware({ settings }) {
47
49
  const preMiddleware = createMiddlewareImports(settings.middlewares.pre, "pre");
48
50
  const postMiddleware = createMiddlewareImports(settings.middlewares.post, "post");
49
51
  const source = `
50
- import { onRequest as userOnRequest } from '${resolvedMiddlewareId}';
52
+ ${userMiddlewareIsPresent ? `import { onRequest as userOnRequest } from '${resolvedMiddlewareId}';` : ""}
51
53
  import { sequence } from 'astro:middleware';
52
54
  ${preMiddleware.importsCode}${postMiddleware.importsCode}
53
55
 
54
56
  export const onRequest = sequence(
55
57
  ${preMiddleware.sequenceCode}${preMiddleware.sequenceCode ? "," : ""}
56
- userOnRequest${postMiddleware.sequenceCode ? "," : ""}
58
+ ${userMiddlewareIsPresent ? `userOnRequest${postMiddleware.sequenceCode ? "," : ""}` : ""}
57
59
  ${postMiddleware.sequenceCode}
58
60
  );
59
61
  `.trim();
@@ -312,7 +312,7 @@ function navigate(href, options) {
312
312
  return;
313
313
  }
314
314
  const toLocation = new URL(href, location.href);
315
- if (location.origin === toLocation.origin && samePage(toLocation)) {
315
+ if (location.origin === toLocation.origin && samePage(toLocation) && !options?.formData) {
316
316
  moveToLocation(toLocation, options?.history === "replace", true);
317
317
  } else {
318
318
  transition("forward", toLocation, options ?? {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "3.5.1",
3
+ "version": "3.5.2",
4
4
  "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
5
5
  "type": "module",
6
6
  "author": "withastro",
@@ -165,8 +165,8 @@
165
165
  "yargs-parser": "^21.1.1",
166
166
  "zod": "^3.22.4",
167
167
  "@astrojs/internal-helpers": "0.2.1",
168
- "@astrojs/telemetry": "3.0.4",
169
- "@astrojs/markdown-remark": "3.4.0"
168
+ "@astrojs/markdown-remark": "3.4.0",
169
+ "@astrojs/telemetry": "3.0.4"
170
170
  },
171
171
  "optionalDependencies": {
172
172
  "sharp": "^0.32.5"