astro 6.3.0 → 6.3.1

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.
@@ -4,21 +4,7 @@ import { isRemoteAllowed } from "@astrojs/internal-helpers/remote";
4
4
  import * as mime from "mrmime";
5
5
  import { getConfiguredImageService } from "../internal.js";
6
6
  import { etag } from "../utils/etag.js";
7
- import { fetchWithRedirects } from "../utils/redirectValidation.js";
8
- async function loadRemoteImage(src, headers) {
9
- try {
10
- const res = await fetchWithRedirects({ url: src, headers, imageConfig });
11
- if (!isRemoteAllowed(res.url, imageConfig)) {
12
- return void 0;
13
- }
14
- if (!res.ok) {
15
- return void 0;
16
- }
17
- return await res.arrayBuffer();
18
- } catch {
19
- return void 0;
20
- }
21
- }
7
+ import { loadImage } from "./loadImage.js";
22
8
  const GET = async ({ request }) => {
23
9
  try {
24
10
  const imageService = await getConfiguredImageService();
@@ -39,7 +25,12 @@ const GET = async ({ request }) => {
39
25
  if (!isRemoteImage && sourceUrl.origin !== url.origin) {
40
26
  return new Response("Forbidden", { status: 403 });
41
27
  }
42
- inputBuffer = await loadRemoteImage(sourceUrl, isRemoteImage ? new Headers() : request.headers);
28
+ inputBuffer = await loadImage(
29
+ sourceUrl,
30
+ isRemoteImage ? new Headers() : request.headers,
31
+ imageConfig,
32
+ isRemoteImage
33
+ );
43
34
  if (!inputBuffer) {
44
35
  return new Response("Not Found", { status: 404 });
45
36
  }
@@ -0,0 +1,11 @@
1
+ import type { RemoteImageConfig } from '../utils/redirectValidation.js';
2
+ /**
3
+ * Fetches an image by URL. Used by the generic image endpoint for both
4
+ * remote images and local images (self-fetched from the same origin).
5
+ *
6
+ * For remote images, the final URL (after any redirects) is validated
7
+ * against `imageConfig.domains` and `imageConfig.remotePatterns`.
8
+ * Local images skip this check — they are already guarded by the
9
+ * same-origin check in the caller.
10
+ */
11
+ export declare function loadImage(src: URL, headers: Headers, imageConfig: RemoteImageConfig, isRemote: boolean, fetchFn?: typeof globalThis.fetch): Promise<ArrayBuffer | undefined>;
@@ -0,0 +1,19 @@
1
+ import { isRemoteAllowed } from "@astrojs/internal-helpers/remote";
2
+ import { fetchWithRedirects } from "../utils/redirectValidation.js";
3
+ async function loadImage(src, headers, imageConfig, isRemote, fetchFn) {
4
+ try {
5
+ const res = await fetchWithRedirects({ url: src, headers, imageConfig, fetchFn });
6
+ if (isRemote && !isRemoteAllowed(res.url, imageConfig)) {
7
+ return void 0;
8
+ }
9
+ if (!res.ok) {
10
+ return void 0;
11
+ }
12
+ return await res.arrayBuffer();
13
+ } catch {
14
+ return void 0;
15
+ }
16
+ }
17
+ export {
18
+ loadImage
19
+ };
@@ -1,6 +1,6 @@
1
1
  class BuildTimeAstroVersionProvider {
2
2
  // Injected during the build through esbuild define
3
- version = "6.3.0";
3
+ version = "6.3.1";
4
4
  }
5
5
  export {
6
6
  BuildTimeAstroVersionProvider
@@ -191,7 +191,7 @@ ${contentConfig.error.message}`
191
191
  logger.info("Content config changed");
192
192
  shouldClear = true;
193
193
  }
194
- if (previousAstroVersion && previousAstroVersion !== "6.3.0") {
194
+ if (previousAstroVersion && previousAstroVersion !== "6.3.1") {
195
195
  logger.info("Astro version changed");
196
196
  shouldClear = true;
197
197
  }
@@ -199,8 +199,8 @@ ${contentConfig.error.message}`
199
199
  logger.info("Clearing content store");
200
200
  this.#store.clearAll();
201
201
  }
202
- if ("6.3.0") {
203
- this.#store.metaStore().set("astro-version", "6.3.0");
202
+ if ("6.3.1") {
203
+ this.#store.metaStore().set("astro-version", "6.3.1");
204
204
  }
205
205
  if (currentConfigDigest) {
206
206
  this.#store.metaStore().set("content-config-digest", currentConfigDigest);
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "6.3.0";
1
+ const ASTRO_VERSION = "6.3.1";
2
2
  const ASTRO_GENERATOR = `Astro v${ASTRO_VERSION}`;
3
3
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
4
4
  const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite";
@@ -37,7 +37,7 @@ async function dev(inlineConfig) {
37
37
  await telemetry.record([]);
38
38
  const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
39
39
  const logger = restart.container.logger;
40
- const currentVersion = "6.3.0";
40
+ const currentVersion = "6.3.1";
41
41
  const isPrerelease = currentVersion.includes("-");
42
42
  if (!isPrerelease) {
43
43
  try {
@@ -276,7 +276,7 @@ function printHelp({
276
276
  message.push(
277
277
  linebreak(),
278
278
  ` ${bgGreen(black(` ${commandName} `))} ${green(
279
- `v${"6.3.0"}`
279
+ `v${"6.3.1"}`
280
280
  )} ${headline}`
281
281
  );
282
282
  }
@@ -67,9 +67,11 @@ async function createStaticPreviewServer(settings, logger) {
67
67
  previewServer.httpServer.addListener("error", reject);
68
68
  });
69
69
  }
70
+ const address = previewServer.httpServer.address();
71
+ const actualPort = address && typeof address === "object" ? address.port : settings.config.server.port;
70
72
  return {
71
73
  host: getResolvedHostForHttpServer(settings.config.server.host),
72
- port: settings.config.server.port,
74
+ port: actualPort,
73
75
  closed,
74
76
  server: previewServer.httpServer,
75
77
  stop: previewServer.close.bind(previewServer)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "6.3.0",
3
+ "version": "6.3.1",
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",
@@ -164,9 +164,9 @@
164
164
  "xxhash-wasm": "^1.1.0",
165
165
  "yargs-parser": "^22.0.0",
166
166
  "zod": "^4.3.6",
167
- "@astrojs/telemetry": "3.3.2",
168
167
  "@astrojs/internal-helpers": "0.9.0",
169
- "@astrojs/markdown-remark": "7.1.1"
168
+ "@astrojs/markdown-remark": "7.1.1",
169
+ "@astrojs/telemetry": "3.3.2"
170
170
  },
171
171
  "optionalDependencies": {
172
172
  "sharp": "^0.34.0"
@@ -231,8 +231,6 @@
231
231
  "test:e2e:firefox": "playwright test --config playwright.firefox.config.js",
232
232
  "test:types": "tsc --build test/types/tsconfig.json",
233
233
  "test:unit": "astro-scripts test \"test/units/**/*.test.ts\" --strip-types --teardown ./test/units/teardown.ts",
234
- "test:integration": "pnpm run test:integration:js && pnpm run test:integration:ts",
235
- "test:integration:js": "astro-scripts test \"test/*.test.js\"",
236
- "test:integration:ts": "astro-scripts test \"test/*.test.ts\" --strip-types"
234
+ "test:integration": "astro-scripts test \"test/*.test.ts\" --parallel --strip-types"
237
235
  }
238
236
  }