astro 4.5.14 → 4.5.16

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.
@@ -17,6 +17,7 @@ async function loadSharp() {
17
17
  } catch (e) {
18
18
  throw new AstroError(AstroErrorData.MissingSharp);
19
19
  }
20
+ sharpImport.cache(false);
20
21
  return sharpImport;
21
22
  }
22
23
  const sharpService = {
@@ -104,6 +104,28 @@ type ImageSharedProps<T> = T & {
104
104
  * ```
105
105
  */
106
106
  height?: number | `${number}`;
107
+ /**
108
+ * Desired output format for the image. Defaults to `webp`.
109
+ *
110
+ * **Example**:
111
+ * ```astro
112
+ * <Image src={...} format="avif" alt="..." />
113
+ * ```
114
+ */
115
+ format?: ImageOutputFormat;
116
+ /**
117
+ * Desired quality for the image. Value can either be a preset such as `low` or `high`, or a numeric value from 0 to 100.
118
+ *
119
+ * The perceptual quality of the output image is service-specific.
120
+ * For instance, a certain service might decide that `high` results in a very beautiful image, but another could choose for it to be at best passable.
121
+ *
122
+ * **Example**:
123
+ * ```astro
124
+ * <Image src={...} quality='high' alt="..." />
125
+ * <Image src={...} quality={300} alt="..." />
126
+ * ```
127
+ */
128
+ quality?: ImageQuality;
107
129
  } & ({
108
130
  /**
109
131
  * A list of widths to generate images for. The value of this property will be used to assign the `srcset` property on the final `img` element.
@@ -137,28 +159,6 @@ export type LocalImageProps<T> = ImageSharedProps<T> & {
137
159
  src: ImageMetadata | Promise<{
138
160
  default: ImageMetadata;
139
161
  }>;
140
- /**
141
- * Desired output format for the image. Defaults to `webp`.
142
- *
143
- * **Example**:
144
- * ```astro
145
- * <Image src={...} format="avif" alt="..." />
146
- * ```
147
- */
148
- format?: ImageOutputFormat;
149
- /**
150
- * Desired quality for the image. Value can either be a preset such as `low` or `high`, or a numeric value from 0 to 100.
151
- *
152
- * The perceptual quality of the output image is service-specific.
153
- * For instance, a certain service might decide that `high` results in a very beautiful image, but another could choose for it to be at best passable.
154
- *
155
- * **Example**:
156
- * ```astro
157
- * <Image src={...} quality='high' alt="..." />
158
- * <Image src={...} quality={300} alt="..." />
159
- * ```
160
- */
161
- quality?: ImageQuality;
162
162
  };
163
163
  export type RemoteImageProps<T> = (ImageSharedProps<T> & {
164
164
  /**
@@ -1,6 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { pathToFileURL } from "node:url";
3
3
  import boxen from "boxen";
4
+ import ci from "ci-info";
4
5
  import { execa } from "execa";
5
6
  import { bold, cyan, dim, magenta } from "kleur/colors";
6
7
  import ora from "ora";
@@ -25,10 +26,14 @@ async function getPackage(packageName, logger, options, otherDeps = []) {
25
26
  } catch (e) {
26
27
  if (options.optional)
27
28
  return void 0;
28
- logger.info(
29
- "SKIP_FORMAT",
30
- `To continue, Astro requires the following dependency to be installed: ${bold(packageName)}.`
31
- );
29
+ let message = `To continue, Astro requires the following dependency to be installed: ${bold(packageName)}.`;
30
+ if (ci.isCI) {
31
+ message += ` Packages cannot be installed automatically in CI environments.`;
32
+ }
33
+ logger.info("SKIP_FORMAT", message);
34
+ if (ci.isCI) {
35
+ return void 0;
36
+ }
32
37
  const result = await installPackage([packageName, ...otherDeps], options, logger);
33
38
  if (result) {
34
39
  const packageImport = await import(packageName);
@@ -34,8 +34,9 @@ class NodeApp extends App {
34
34
  */
35
35
  static createRequest(req, { skipBody = false } = {}) {
36
36
  const protocol = req.headers["x-forwarded-proto"] ?? ("encrypted" in req.socket && req.socket.encrypted ? "https" : "http");
37
- const hostname = req.headers.host || req.headers[":authority"];
38
- const url = `${protocol}://${hostname}${req.url}`;
37
+ const hostname = req.headers["x-forwarded-host"] ?? req.headers.host ?? req.headers[":authority"];
38
+ const port = req.headers["x-forwarded-port"];
39
+ const url = `${protocol}://${hostname}${port ? `:${port}` : ""}${req.url}`;
39
40
  const options = {
40
41
  method: req.method || "GET",
41
42
  headers: makeRequestHeaders(req)
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.5.14";
1
+ const ASTRO_VERSION = "4.5.16";
2
2
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
3
3
  const ROUTE_TYPE_HEADER = "X-Astro-Route-Type";
4
4
  const DEFAULT_404_COMPONENT = "astro-default-404";
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
23
23
  base: restart.container.settings.config.base
24
24
  })
25
25
  );
26
- const currentVersion = "4.5.14";
26
+ const currentVersion = "4.5.16";
27
27
  if (currentVersion.includes("-")) {
28
28
  logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
29
29
  }
@@ -36,7 +36,7 @@ function serverStart({
36
36
  host,
37
37
  base
38
38
  }) {
39
- const version = "4.5.14";
39
+ const version = "4.5.16";
40
40
  const localPrefix = `${dim("\u2503")} Local `;
41
41
  const networkPrefix = `${dim("\u2503")} Network `;
42
42
  const emptyPrefix = " ".repeat(11);
@@ -261,7 +261,7 @@ function printHelp({
261
261
  message.push(
262
262
  linebreak(),
263
263
  ` ${bgGreen(black(` ${commandName} `))} ${green(
264
- `v${"4.5.14"}`
264
+ `v${"4.5.16"}`
265
265
  )} ${headline}`
266
266
  );
267
267
  }
@@ -137,7 +137,12 @@ const moveToLocation = (to, from, options, pageTitleForBrowserHistory, historySt
137
137
  history.scrollRestoration = "auto";
138
138
  const savedState = history.state;
139
139
  location.href = to.href;
140
- history.state || replaceState(savedState, "");
140
+ if (!history.state) {
141
+ replaceState(savedState, "");
142
+ if (intraPage) {
143
+ window.dispatchEvent(new PopStateEvent("popstate"));
144
+ }
145
+ }
141
146
  } else {
142
147
  if (!scrolledToTop) {
143
148
  scrollTo({ left: 0, top: 0, behavior: "instant" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.5.14",
3
+ "version": "4.5.16",
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",