astro 4.0.6 → 4.0.7

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.
@@ -94,7 +94,7 @@ const { fallback = 'animate' } = Astro.props;
94
94
 
95
95
  document.addEventListener('submit', (ev) => {
96
96
  let el = ev.target as HTMLElement;
97
- if (el.tagName !== 'FORM' || isReloadEl(el)) {
97
+ if (el.tagName !== 'FORM' || ev.defaultPrevented || isReloadEl(el)) {
98
98
  return;
99
99
  }
100
100
  const form = el as HTMLFormElement;
@@ -589,7 +589,7 @@ export interface AstroUserConfig {
589
589
  * [See our Server-side Rendering guide](https://docs.astro.build/en/guides/server-side-rendering/) for more on SSR, and [our deployment guides](https://docs.astro.build/en/guides/deploy/) for a complete list of hosts.
590
590
  *
591
591
  * ```js
592
- * import netlify from '@astrojs/netlify/functions';
592
+ * import netlify from '@astrojs/netlify';
593
593
  * {
594
594
  * // Example: Build for Netlify serverless deployment
595
595
  * adapter: netlify(),
@@ -3,6 +3,8 @@ import fs, { readFileSync } from "node:fs";
3
3
  import { basename, join } from "node:path/posix";
4
4
  import { getOutDirWithinCwd } from "../../core/build/common.js";
5
5
  import { getTimeStat } from "../../core/build/util.js";
6
+ import { AstroError } from "../../core/errors/errors.js";
7
+ import { AstroErrorData } from "../../core/errors/index.js";
6
8
  import { isRemotePath, prependForwardSlash } from "../../core/path.js";
7
9
  import { isServerLikeOutput } from "../../prerender/utils.js";
8
10
  import { getConfiguredImageService } from "../internal.js";
@@ -52,9 +54,9 @@ function getFullImagePath(originalFilePath, env) {
52
54
  async function generateImagesForPath(originalFilePath, transformsAndPath, env, queue) {
53
55
  const originalImageData = await loadImage(originalFilePath, env);
54
56
  for (const [_, transform] of transformsAndPath.transforms) {
55
- queue.add(
56
- async () => generateImage(originalImageData, transform.finalPath, transform.transform)
57
- );
57
+ await queue.add(async () => generateImage(originalImageData, transform.finalPath, transform.transform)).catch((e) => {
58
+ throw e;
59
+ });
58
60
  }
59
61
  if (!env.isSSR && !isRemotePath(originalFilePath) && !globalThis.astroAsset.referencedImages?.has(transformsAndPath.originalSrcPath)) {
60
62
  try {
@@ -117,11 +119,23 @@ async function generateImagesForPath(originalFilePath, transformsAndPath, env, q
117
119
  expires: originalImage.expires
118
120
  };
119
121
  const imageService = await getConfiguredImageService();
120
- resultData.data = (await imageService.transform(
121
- originalImage.data,
122
- { ...options, src: originalImagePath },
123
- env.imageConfig
124
- )).data;
122
+ try {
123
+ resultData.data = (await imageService.transform(
124
+ originalImage.data,
125
+ { ...options, src: originalImagePath },
126
+ env.imageConfig
127
+ )).data;
128
+ } catch (e) {
129
+ const error = new AstroError(
130
+ {
131
+ ...AstroErrorData.CouldNotTransformImage,
132
+ message: AstroErrorData.CouldNotTransformImage.message(originalFilePath)
133
+ },
134
+ void 0,
135
+ { cause: e }
136
+ );
137
+ throw error;
138
+ }
125
139
  try {
126
140
  if (env.useCache) {
127
141
  if (isLocalImage) {
@@ -50,6 +50,7 @@ const GET = async ({ request }) => {
50
50
  }
51
51
  });
52
52
  } catch (err) {
53
+ console.error("Could not process image request:", err);
53
54
  return new Response(`Server Error: ${err}`, { status: 500 });
54
55
  }
55
56
  };
@@ -65,6 +65,7 @@ const GET = async ({ request }) => {
65
65
  }
66
66
  });
67
67
  } catch (err) {
68
+ console.error("Could not process image request:", err);
68
69
  return new Response(`Server Error: ${err}`, { status: 500 });
69
70
  }
70
71
  };
@@ -56,7 +56,7 @@ const LIT_NPMRC_STUB = `# Lit libraries are required to be hoisted due to depend
56
56
  public-hoist-pattern[]=*lit*
57
57
  `;
58
58
  const OFFICIAL_ADAPTER_TO_IMPORT_MAP = {
59
- netlify: "@astrojs/netlify/functions",
59
+ netlify: "@astrojs/netlify",
60
60
  vercel: "@astrojs/vercel/serverless",
61
61
  cloudflare: "@astrojs/cloudflare",
62
62
  node: "@astrojs/node"
@@ -168,7 +168,7 @@ ${bgGreen(black(` ${verb} static routes `))}`);
168
168
  const totalCount = Array.from(staticImageList.values()).map((x) => x.transforms.size).reduce((a, b) => a + b, 0);
169
169
  const cpuCount = os.cpus().length;
170
170
  const assetsCreationEnvironment = await prepareAssetsGenerationEnv(pipeline, totalCount);
171
- const queue = new PQueue({ concurrency: cpuCount });
171
+ const queue = new PQueue({ concurrency: Math.max(cpuCount, 1) });
172
172
  const assetsTimer = performance.now();
173
173
  for (const [originalPath, transforms] of staticImageList) {
174
174
  await generateImagesForPath(originalPath, transforms, assetsCreationEnvironment, queue);
@@ -230,13 +230,14 @@ async function generatePage(pageData, ssrEntry, builtPaths, pipeline) {
230
230
  for (let i = 0; i < paths.length; i++) {
231
231
  const path = paths[i];
232
232
  pipeline.getEnvironment().logger.debug("build", `Generating: ${path}`);
233
+ const filePath = getOutputFilename(pipeline.getConfig(), path, pageData.route.type);
234
+ const lineIcon = i === paths.length - 1 ? "\u2514\u2500" : "\u251C\u2500";
235
+ logger.info(null, ` ${blue(lineIcon)} ${dim(filePath)}`, false);
233
236
  await generatePath(path, pipeline, generationOptions, route);
234
237
  const timeEnd = performance.now();
235
238
  const timeChange = getTimeStat(prevTimeEnd, timeEnd);
236
239
  const timeIncrease = `(+${timeChange})`;
237
- const filePath = getOutputFilename(pipeline.getConfig(), path, pageData.route.type);
238
- const lineIcon = i === paths.length - 1 ? "\u2514\u2500" : "\u251C\u2500";
239
- logger.info(null, ` ${blue(lineIcon)} ${dim(filePath)} ${dim(timeIncrease)}`);
240
+ logger.info("SKIP_FORMAT", ` ${dim(timeIncrease)}`);
240
241
  prevTimeEnd = timeEnd;
241
242
  }
242
243
  }
@@ -148,8 +148,9 @@ function buildManifest(opts, internals, staticFiles) {
148
148
  continue;
149
149
  const scripts = [];
150
150
  if (pageData.hoistedScript) {
151
+ const shouldPrefixAssetPath = pageData.hoistedScript.type === "external";
151
152
  const hoistedValue = pageData.hoistedScript.value;
152
- const value = hoistedValue.endsWith(".js") ? prefixAssetPath(hoistedValue) : hoistedValue;
153
+ const value = shouldPrefixAssetPath ? prefixAssetPath(hoistedValue) : hoistedValue;
153
154
  scripts.unshift(
154
155
  Object.assign({}, pageData.hoistedScript, {
155
156
  value
@@ -94,7 +94,7 @@ async function staticBuild(opts, internals, ssrOutputChunkNames) {
94
94
  case settings.config.output === "static": {
95
95
  settings.timer.start("Static generate");
96
96
  await generatePages(opts, internals);
97
- await cleanServerOutput(opts, ssrOutputChunkNames);
97
+ await cleanServerOutput(opts, ssrOutputChunkNames, internals);
98
98
  settings.timer.end("Static generate");
99
99
  return;
100
100
  }
@@ -314,9 +314,12 @@ export const ${e.n} = noop;`;
314
314
  removeEmptyDirs(out);
315
315
  }
316
316
  }
317
- async function cleanServerOutput(opts, ssrOutputChunkNames) {
317
+ async function cleanServerOutput(opts, ssrOutputChunkNames, internals) {
318
318
  const out = getOutDirWithinCwd(opts.settings.config.outDir);
319
319
  const files = ssrOutputChunkNames.filter((f) => f.endsWith(".mjs"));
320
+ if (internals.manifestFileName) {
321
+ files.push(internals.manifestFileName);
322
+ }
320
323
  if (files.length) {
321
324
  await Promise.all(
322
325
  files.map(async (filename) => {
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.0.6";
1
+ const ASTRO_VERSION = "4.0.7";
2
2
  const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
3
3
  ".markdown",
4
4
  ".mdown",
@@ -21,7 +21,7 @@ async function dev(inlineConfig) {
21
21
  base: restart.container.settings.config.base
22
22
  })
23
23
  );
24
- const currentVersion = "4.0.6";
24
+ const currentVersion = "4.0.7";
25
25
  if (currentVersion.includes("-")) {
26
26
  logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
27
27
  }
@@ -622,6 +622,21 @@ export declare const MarkdownImageNotFound: {
622
622
  message: (imagePath: string, fullImagePath: string | undefined) => string;
623
623
  hint: string;
624
624
  };
625
+ /**
626
+ * @docs
627
+ * @see
628
+ * - [Images](https://docs.astro.build/en/guides/images/)
629
+ * @description
630
+ * Astro could not transform one of your images. Often, this is caused by a corrupted or malformed image. Re-exporting the image from your image editor may fix this issue.
631
+ *
632
+ * Depending on the image service you are using, the stack trace may contain more information on the specific error encountered.
633
+ */
634
+ export declare const CouldNotTransformImage: {
635
+ name: string;
636
+ title: string;
637
+ message: (imagePath: string) => string;
638
+ hint: string;
639
+ };
625
640
  /**
626
641
  * @docs
627
642
  * @description
@@ -690,6 +705,25 @@ export declare const LocalsNotAnObject: {
690
705
  message: string;
691
706
  hint: string;
692
707
  };
708
+ /**
709
+ * @docs
710
+ * @description
711
+ * Thrown in development mode when middleware throws an error while attempting to loading it.
712
+ *
713
+ * For example:
714
+ * ```ts
715
+ * import {defineMiddleware} from "astro:middleware";
716
+ * throw new Error("Error thrown while loading the middleware.")
717
+ * export const onRequest = defineMiddleware(() => {
718
+ * return "string"
719
+ * });
720
+ * ```
721
+ */
722
+ export declare const MiddlewareCantBeLoaded: {
723
+ name: string;
724
+ title: string;
725
+ message: string;
726
+ };
693
727
  /**
694
728
  * @docs
695
729
  * @see
@@ -223,6 +223,12 @@ const MarkdownImageNotFound = {
223
223
  message: (imagePath, fullImagePath) => `Could not find requested image \`${imagePath}\`${fullImagePath ? ` at \`${fullImagePath}\`.` : "."}`,
224
224
  hint: "This is often caused by a typo in the image path. Please make sure the file exists, and is spelled correctly."
225
225
  };
226
+ const CouldNotTransformImage = {
227
+ name: "CouldNotTransformImage",
228
+ title: "Could not transform image.",
229
+ message: (imagePath) => `Could not transform image \`${imagePath}\`. See the stack trace for more information.`,
230
+ hint: "This is often caused by a corrupted or malformed image. Re-exporting the image from your image editor may fix this issue."
231
+ };
226
232
  const ResponseSentError = {
227
233
  name: "ResponseSentError",
228
234
  title: "Unable to set response.",
@@ -244,6 +250,11 @@ const LocalsNotAnObject = {
244
250
  message: "`locals` can only be assigned to an object. Other values like numbers, strings, etc. are not accepted.",
245
251
  hint: "If you tried to remove some information from the `locals` object, try to use `delete` or set the property to `undefined`."
246
252
  };
253
+ const MiddlewareCantBeLoaded = {
254
+ name: "MiddlewareCantBeLoaded",
255
+ title: "Can't load the middleware.",
256
+ message: "The middleware threw an error while Astro was trying to loading it."
257
+ };
247
258
  const LocalImageUsedWrongly = {
248
259
  name: "LocalImageUsedWrongly",
249
260
  title: "Local images must be imported.",
@@ -460,6 +471,7 @@ export {
460
471
  ConfigNotFound,
461
472
  ContentCollectionTypeMismatchError,
462
473
  ContentSchemaContainsSlugError,
474
+ CouldNotTransformImage,
463
475
  DataCollectionEntryParseError,
464
476
  DuplicateContentEntrySlugError,
465
477
  ExpectedImage,
@@ -490,6 +502,7 @@ export {
490
502
  MarkdownFrontmatterParseError,
491
503
  MarkdownImageNotFound,
492
504
  MdxIntegrationMissingError,
505
+ MiddlewareCantBeLoaded,
493
506
  MiddlewareNoDataOrNextCalled,
494
507
  MiddlewareNotAResponse,
495
508
  MissingImageDimension,
@@ -17,17 +17,18 @@ export interface LogMessage {
17
17
  label: string | null;
18
18
  level: LoggerLevel;
19
19
  message: string;
20
+ newLine: boolean;
20
21
  }
21
22
  export declare const levels: Record<LoggerLevel, number>;
22
23
  /** Full logging API */
23
- export declare function log(opts: LogOptions, level: LoggerLevel, label: string | null, message: string): void;
24
+ export declare function log(opts: LogOptions, level: LoggerLevel, label: string | null, message: string, newLine?: boolean): void;
24
25
  export declare function isLogLevelEnabled(configuredLogLevel: LoggerLevel, level: LoggerLevel): boolean;
25
26
  /** Emit a user-facing message. Useful for UI and other console messages. */
26
- export declare function info(opts: LogOptions, label: string | null, message: string): void;
27
+ export declare function info(opts: LogOptions, label: string | null, message: string, newLine?: boolean): void;
27
28
  /** Emit a warning message. Useful for high-priority messages that aren't necessarily errors. */
28
- export declare function warn(opts: LogOptions, label: string | null, message: string): void;
29
+ export declare function warn(opts: LogOptions, label: string | null, message: string, newLine?: boolean): void;
29
30
  /** Emit a error message, Useful when Astro can't recover from some error. */
30
- export declare function error(opts: LogOptions, label: string | null, message: string): void;
31
+ export declare function error(opts: LogOptions, label: string | null, message: string, newLine?: boolean): void;
31
32
  type LogFn = typeof info | typeof warn | typeof error;
32
33
  export declare function table(opts: LogOptions, columns: number[]): (logFn: LogFn, ...input: Array<any>) => void;
33
34
  export declare function debug(...args: any[]): void;
@@ -43,9 +44,9 @@ export declare function timerMessage(message: string, startTime?: number): strin
43
44
  export declare class Logger {
44
45
  options: LogOptions;
45
46
  constructor(options: LogOptions);
46
- info(label: LoggerLabel | null, message: string): void;
47
- warn(label: LoggerLabel | null, message: string): void;
48
- error(label: LoggerLabel | null, message: string): void;
47
+ info(label: LoggerLabel | null, message: string, newLine?: boolean): void;
48
+ warn(label: LoggerLabel | null, message: string, newLine?: boolean): void;
49
+ error(label: LoggerLabel | null, message: string, newLine?: boolean): void;
49
50
  debug(label: LoggerLabel, ...messages: any[]): void;
50
51
  level(): LoggerLevel;
51
52
  forkIntegrationLogger(label: string): AstroIntegrationLogger;
@@ -13,13 +13,14 @@ const levels = {
13
13
  error: 50,
14
14
  silent: 90
15
15
  };
16
- function log(opts, level, label, message) {
16
+ function log(opts, level, label, message, newLine = true) {
17
17
  const logLevel = opts.level;
18
18
  const dest = opts.dest;
19
19
  const event = {
20
20
  label,
21
21
  level,
22
- message
22
+ message,
23
+ newLine
23
24
  };
24
25
  if (!isLogLevelEnabled(logLevel, level)) {
25
26
  return;
@@ -29,14 +30,14 @@ function log(opts, level, label, message) {
29
30
  function isLogLevelEnabled(configuredLogLevel, level) {
30
31
  return levels[configuredLogLevel] <= levels[level];
31
32
  }
32
- function info(opts, label, message) {
33
- return log(opts, "info", label, message);
33
+ function info(opts, label, message, newLine = true) {
34
+ return log(opts, "info", label, message, newLine);
34
35
  }
35
- function warn(opts, label, message) {
36
- return log(opts, "warn", label, message);
36
+ function warn(opts, label, message, newLine = true) {
37
+ return log(opts, "warn", label, message, newLine);
37
38
  }
38
- function error(opts, label, message) {
39
- return log(opts, "error", label, message);
39
+ function error(opts, label, message, newLine = true) {
40
+ return log(opts, "error", label, message, newLine);
40
41
  }
41
42
  function table(opts, columns) {
42
43
  return function logTable(logFn, ...input) {
@@ -107,14 +108,14 @@ class Logger {
107
108
  constructor(options) {
108
109
  this.options = options;
109
110
  }
110
- info(label, message) {
111
- info(this.options, label, message);
111
+ info(label, message, newLine = true) {
112
+ info(this.options, label, message, newLine);
112
113
  }
113
- warn(label, message) {
114
- warn(this.options, label, message);
114
+ warn(label, message, newLine = true) {
115
+ warn(this.options, label, message, newLine);
115
116
  }
116
- error(label, message) {
117
- error(this.options, label, message);
117
+ error(label, message, newLine = true) {
118
+ error(this.options, label, message, newLine);
118
119
  }
119
120
  debug(label, ...messages) {
120
121
  debug(label, ...messages);
@@ -1,15 +1,16 @@
1
1
  import debugPackage from "debug";
2
2
  import { getEventPrefix, levels } from "./core.js";
3
3
  const nodeLogDestination = {
4
- write(event) {
4
+ write(event, newLine = true) {
5
5
  let dest = process.stderr;
6
6
  if (levels[event.level] < levels["error"]) {
7
7
  dest = process.stdout;
8
8
  }
9
+ let trailingLine = event.newLine ? "\n" : "";
9
10
  if (event.label === "SKIP_FORMAT") {
10
- dest.write(event.message + "\n");
11
+ dest.write(event.message + trailingLine);
11
12
  } else {
12
- dest.write(getEventPrefix(event) + " " + event.message + "\n");
13
+ dest.write(getEventPrefix(event) + " " + event.message + trailingLine);
13
14
  }
14
15
  return true;
15
16
  }
@@ -36,7 +36,7 @@ function serverStart({
36
36
  host,
37
37
  base
38
38
  }) {
39
- const version = "4.0.6";
39
+ const version = "4.0.7";
40
40
  const localPrefix = `${dim("\u2503")} Local `;
41
41
  const networkPrefix = `${dim("\u2503")} Network `;
42
42
  const emptyPrefix = " ".repeat(11);
@@ -258,7 +258,7 @@ function printHelp({
258
258
  message.push(
259
259
  linebreak(),
260
260
  ` ${bgGreen(black(` ${commandName} `))} ${green(
261
- `v${"4.0.6"}`
261
+ `v${"4.0.7"}`
262
262
  )} ${headline}`
263
263
  );
264
264
  }
@@ -4,4 +4,4 @@ import type { ModuleLoader } from '../module-loader/index.js';
4
4
  *
5
5
  * If not middlewares were not set, the function returns an empty array.
6
6
  */
7
- export declare function loadMiddleware(moduleLoader: ModuleLoader): Promise<Record<string, any> | undefined>;
7
+ export declare function loadMiddleware(moduleLoader: ModuleLoader): Promise<Record<string, any>>;
@@ -1,10 +1,12 @@
1
1
  import { MIDDLEWARE_MODULE_ID } from "./vite-plugin.js";
2
+ import { MiddlewareCantBeLoaded } from "../errors/errors-data.js";
3
+ import { AstroError } from "../errors/index.js";
2
4
  async function loadMiddleware(moduleLoader) {
3
5
  try {
4
- const module = await moduleLoader.import(MIDDLEWARE_MODULE_ID);
5
- return module;
6
- } catch {
7
- return void 0;
6
+ return await moduleLoader.import(MIDDLEWARE_MODULE_ID);
7
+ } catch (error) {
8
+ const astroError = new AstroError(MiddlewareCantBeLoaded, void 0, { cause: error });
9
+ throw astroError;
8
10
  }
9
11
  }
10
12
  export {
@@ -10,7 +10,13 @@ function redirectRouteGenerate(redirectRoute, data) {
10
10
  if (typeof routeData !== "undefined") {
11
11
  return routeData?.generate(data) || routeData?.pathname || "/";
12
12
  } else if (typeof route === "string") {
13
- return route;
13
+ let target = route;
14
+ for (const param of Object.keys(data)) {
15
+ const paramValue = data[param];
16
+ target = target.replace(`[${param}]`, paramValue);
17
+ target = target.replace(`[...${param}]`, paramValue);
18
+ }
19
+ return target;
14
20
  } else if (typeof route === "undefined") {
15
21
  return "/";
16
22
  }
@@ -33,6 +33,7 @@ const a11y_required_attributes = {
33
33
  object: ["title", "aria-label", "aria-labelledby"]
34
34
  };
35
35
  const interactiveElements = ["button", "details", "embed", "iframe", "label", "select", "textarea"];
36
+ const labellableElements = ["input", "meter", "output", "progress", "select", "textarea"];
36
37
  const aria_non_interactive_roles = [
37
38
  "alert",
38
39
  "alertdialog",
@@ -204,7 +205,7 @@ const a11y = [
204
205
  {
205
206
  code: "a11y-aria-activedescendant-has-tabindex",
206
207
  title: "Elements with attribute `aria-activedescendant` must be tabbable",
207
- message: "This element must either have an inherent `tabindex` or declare `tabindex` as an attribute.",
208
+ message: "Element with the `aria-activedescendant` attribute must either have an inherent `tabindex` or declare `tabindex` as an attribute.",
208
209
  selector: "[aria-activedescendant]",
209
210
  match(element) {
210
211
  if (!element.tabIndex && !element.hasAttribute("tabindex"))
@@ -268,13 +269,17 @@ const a11y = [
268
269
  selector: 'a[href]:is([href=""], [href="#"], [href^="javascript:" i])'
269
270
  },
270
271
  {
271
- code: "a11y-label-has-associated-control",
272
- title: "`label` tag should have an associated control and a text content.",
273
- message: "The `label` tag must be associated with a control using either `for` or having a nested input. Additionally, the `label` tag must have text content.",
274
- selector: "label:not([for])",
272
+ code: "a11y-invalid-label",
273
+ title: "`label` element should have an associated control and a text content.",
274
+ message: "The `label` element must be associated with a control either by using the `for` attribute or by containing a nested form element. Additionally, the `label` element must have text content.",
275
+ selector: "label",
275
276
  match(element) {
276
- const inputChild = element.querySelector("input");
277
- if (!inputChild?.textContent)
277
+ const hasFor = element.hasAttribute("for");
278
+ const nestedLabellableElement = element.querySelector(`${labellableElements.join(", ")}`);
279
+ if (!hasFor && !nestedLabellableElement)
280
+ return true;
281
+ const innerText = element.innerText.trim();
282
+ if (innerText === "")
278
283
  return true;
279
284
  }
280
285
  },
@@ -327,7 +332,8 @@ const a11y = [
327
332
  message: "Headings and anchors must have content to be accessible.",
328
333
  selector: a11y_required_content.join(","),
329
334
  match(element) {
330
- if (!element.textContent)
335
+ const innerText = element.innerText.trim();
336
+ if (innerText === "")
331
337
  return true;
332
338
  }
333
339
  },
@@ -71,7 +71,8 @@ const throttle = (cb, delay) => {
71
71
  async function fetchHTML(href, init) {
72
72
  try {
73
73
  const res = await fetch(href, init);
74
- const mediaType = res.headers.get("content-type")?.replace(/;.*$/, "");
74
+ const contentType = res.headers.get("content-type") ?? "";
75
+ const mediaType = contentType.split(";", 1)[0].trim();
75
76
  if (mediaType !== "text/html" && mediaType !== "application/xhtml+xml") {
76
77
  return null;
77
78
  }
@@ -317,7 +318,8 @@ async function transition(direction, from, to, options, historyState) {
317
318
  const init = {};
318
319
  if (preparationEvent.formData) {
319
320
  init.method = "POST";
320
- init.body = preparationEvent.formData;
321
+ const form = preparationEvent.sourceElement instanceof HTMLFormElement ? preparationEvent.sourceElement : preparationEvent.sourceElement instanceof HTMLElement && "form" in preparationEvent.sourceElement ? preparationEvent.sourceElement.form : preparationEvent.sourceElement?.closest("form");
322
+ init.body = form?.attributes.getNamedItem("enctype")?.value === "application/x-www-form-urlencoded" ? new URLSearchParams(preparationEvent.formData) : preparationEvent.formData;
321
323
  }
322
324
  const response = await fetchHTML(href, init);
323
325
  if (response === null) {
@@ -12,7 +12,7 @@ function astroDevOverlay({ settings }) {
12
12
  if (id === resolvedVirtualModuleId) {
13
13
  return `
14
14
  export const loadDevOverlayPlugins = async () => {
15
- return [${settings.devToolbarApps.map((plugin) => `(await import('${plugin}')).default`).join(",")}];
15
+ return [${settings.devToolbarApps.map((plugin) => `(await import(${JSON.stringify(plugin)})).default`).join(",")}];
16
16
  };
17
17
  `;
18
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.0.6",
3
+ "version": "4.0.7",
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",
@@ -137,7 +137,7 @@
137
137
  "mime": "^3.0.0",
138
138
  "ora": "^7.0.1",
139
139
  "p-limit": "^5.0.0",
140
- "p-queue": "^7.4.1",
140
+ "p-queue": "^8.0.1",
141
141
  "path-to-regexp": "^6.2.1",
142
142
  "preferred-pm": "^3.1.2",
143
143
  "probe-image-size": "^7.2.3",
@@ -152,7 +152,7 @@
152
152
  "tsconfck": "^3.0.0",
153
153
  "unist-util-visit": "^5.0.0",
154
154
  "vfile": "^6.0.1",
155
- "vite": "^5.0.0",
155
+ "vite": "^5.0.10",
156
156
  "vitefu": "^0.2.5",
157
157
  "which-pm": "^2.1.1",
158
158
  "yargs-parser": "^21.1.1",