astro 4.16.15 → 4.16.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.
@@ -68,7 +68,7 @@ const JPG = {
68
68
  while (input.length) {
69
69
  const i = readUInt16BE(input, 0);
70
70
  if (input[i] !== 255) {
71
- input = input.slice(1);
71
+ input = input.slice(i);
72
72
  continue;
73
73
  }
74
74
  if (isEXIF(input)) {
@@ -121,7 +121,7 @@ class ContentLayer {
121
121
  logger.info("Content config changed");
122
122
  shouldClear = true;
123
123
  }
124
- if (previousAstroVersion !== "4.16.15") {
124
+ if (previousAstroVersion !== "4.16.16") {
125
125
  logger.info("Astro version changed");
126
126
  shouldClear = true;
127
127
  }
@@ -129,8 +129,8 @@ class ContentLayer {
129
129
  logger.info("Clearing content store");
130
130
  this.#store.clearAll();
131
131
  }
132
- if ("4.16.15") {
133
- await this.#store.metaStore().set("astro-version", "4.16.15");
132
+ if ("4.16.16") {
133
+ await this.#store.metaStore().set("astro-version", "4.16.16");
134
134
  }
135
135
  if (currentConfigDigest) {
136
136
  await this.#store.metaStore().set("config-digest", currentConfigDigest);
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.16.15";
1
+ const ASTRO_VERSION = "4.16.16";
2
2
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
3
3
  const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite";
4
4
  const REWRITE_DIRECTIVE_HEADER_VALUE = "yes";
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
22
22
  await telemetry.record([]);
23
23
  const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
24
24
  const logger = restart.container.logger;
25
- const currentVersion = "4.16.15";
25
+ const currentVersion = "4.16.16";
26
26
  const isPrerelease = currentVersion.includes("-");
27
27
  if (!isPrerelease) {
28
28
  try {
@@ -38,7 +38,7 @@ function serverStart({
38
38
  host,
39
39
  base
40
40
  }) {
41
- const version = "4.16.15";
41
+ const version = "4.16.16";
42
42
  const localPrefix = `${dim("\u2503")} Local `;
43
43
  const networkPrefix = `${dim("\u2503")} Network `;
44
44
  const emptyPrefix = " ".repeat(11);
@@ -274,7 +274,7 @@ function printHelp({
274
274
  message.push(
275
275
  linebreak(),
276
276
  ` ${bgGreen(black(` ${commandName} `))} ${green(
277
- `v${"4.16.15"}`
277
+ `v${"4.16.16"}`
278
278
  )} ${headline}`
279
279
  );
280
280
  }
@@ -1,4 +1,4 @@
1
- import { ROUTE_TYPE_HEADER } from "../core/constants.js";
1
+ import { REROUTE_DIRECTIVE_HEADER, ROUTE_TYPE_HEADER } from "../core/constants.js";
2
2
  import {
3
3
  normalizeTheLocale,
4
4
  notFound,
@@ -48,6 +48,10 @@ function createI18nMiddleware(i18n, base, trailingSlash, format) {
48
48
  return async (context, next) => {
49
49
  const response = await next();
50
50
  const type = response.headers.get(ROUTE_TYPE_HEADER);
51
+ const isReroute = response.headers.get(REROUTE_DIRECTIVE_HEADER);
52
+ if (isReroute === "no" && typeof i18n.fallback === "undefined") {
53
+ return response;
54
+ }
51
55
  if (type !== "page" && type !== "fallback") {
52
56
  return response;
53
57
  }
@@ -42,7 +42,6 @@ async function handleRequest({
42
42
  url,
43
43
  pathname: resolvedPathname,
44
44
  body,
45
- origin,
46
45
  pipeline,
47
46
  manifestData,
48
47
  incomingRequest,
@@ -15,11 +15,10 @@ type HandleRoute = {
15
15
  url: URL;
16
16
  pathname: string;
17
17
  body: ArrayBuffer | undefined;
18
- origin: string;
19
18
  manifestData: ManifestData;
20
19
  incomingRequest: http.IncomingMessage;
21
20
  incomingResponse: http.ServerResponse;
22
21
  pipeline: DevPipeline;
23
22
  };
24
- export declare function handleRoute({ matchedRoute, url, pathname, body, origin, pipeline, manifestData, incomingRequest, incomingResponse, }: HandleRoute): Promise<void>;
23
+ export declare function handleRoute({ matchedRoute, url, pathname, body, pipeline, manifestData, incomingRequest, incomingResponse, }: HandleRoute): Promise<void>;
25
24
  export {};
@@ -87,7 +87,6 @@ async function handleRoute({
87
87
  url,
88
88
  pathname,
89
89
  body,
90
- origin,
91
90
  pipeline,
92
91
  manifestData,
93
92
  incomingRequest,
@@ -101,11 +100,9 @@ async function handleRoute({
101
100
  let request;
102
101
  let renderContext;
103
102
  let mod = void 0;
104
- let options = void 0;
105
103
  let route;
106
104
  const middleware = (await loadMiddleware(loader)).onRequest;
107
105
  const locals = Reflect.get(incomingRequest, clientLocalsSymbol);
108
- const filePath = matchedRoute.filePath;
109
106
  const { preloadedComponent } = matchedRoute;
110
107
  route = matchedRoute.route;
111
108
  request = createRequest({
@@ -121,14 +118,6 @@ async function handleRoute({
121
118
  for (const [name, value] of Object.entries(config.server.headers ?? {})) {
122
119
  if (value) incomingResponse.setHeader(name, value);
123
120
  }
124
- options = {
125
- pipeline,
126
- filePath,
127
- preload: preloadedComponent,
128
- pathname,
129
- request,
130
- route
131
- };
132
121
  mod = preloadedComponent;
133
122
  renderContext = await RenderContext.create({
134
123
  locals,
@@ -182,18 +171,17 @@ async function handleRoute({
182
171
  }
183
172
  if (statusCode === 404 && response.headers.get(REROUTE_DIRECTIVE_HEADER) !== "no") {
184
173
  const fourOhFourRoute = await matchRoute("/404", manifestData, pipeline);
185
- if (options && options.route !== fourOhFourRoute?.route)
186
- return handleRoute({
187
- ...options,
188
- matchedRoute: fourOhFourRoute,
189
- url: new URL(pathname, url),
190
- body,
191
- origin,
174
+ if (fourOhFourRoute) {
175
+ renderContext = await RenderContext.create({
176
+ locals,
192
177
  pipeline,
193
- manifestData,
194
- incomingRequest,
195
- incomingResponse
178
+ pathname,
179
+ middleware: isDefaultPrerendered404(fourOhFourRoute.route) ? void 0 : middleware,
180
+ request,
181
+ routeData: fourOhFourRoute.route
196
182
  });
183
+ response = await renderContext.render(fourOhFourRoute.preloadedComponent);
184
+ }
197
185
  }
198
186
  if (isReroute) {
199
187
  response.headers.delete(REROUTE_DIRECTIVE_HEADER);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.16.15",
3
+ "version": "4.16.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",
@@ -120,7 +120,7 @@
120
120
  "aria-query": "^5.3.2",
121
121
  "axobject-query": "^4.1.0",
122
122
  "boxen": "8.0.1",
123
- "ci-info": "^4.0.0",
123
+ "ci-info": "^4.1.0",
124
124
  "clsx": "^2.1.1",
125
125
  "common-ancestor-path": "^1.0.1",
126
126
  "cookie": "^0.7.2",
@@ -142,7 +142,7 @@
142
142
  "http-cache-semantics": "^4.1.1",
143
143
  "js-yaml": "^4.1.0",
144
144
  "kleur": "^4.1.5",
145
- "magic-string": "^0.30.12",
145
+ "magic-string": "^0.30.14",
146
146
  "magicast": "^0.3.5",
147
147
  "micromatch": "^4.0.8",
148
148
  "mrmime": "^2.0.0",
@@ -154,15 +154,15 @@
154
154
  "prompts": "^2.4.2",
155
155
  "rehype": "^13.0.2",
156
156
  "semver": "^7.6.3",
157
- "shiki": "^1.22.2",
157
+ "shiki": "^1.23.1",
158
158
  "tinyexec": "^0.3.1",
159
159
  "tsconfck": "^3.1.4",
160
160
  "unist-util-visit": "^5.0.0",
161
161
  "vfile": "^6.0.3",
162
- "vite": "^5.4.10",
163
- "vitefu": "^1.0.3",
162
+ "vite": "^5.4.11",
163
+ "vitefu": "^1.0.4",
164
164
  "which-pm": "^3.0.0",
165
- "xxhash-wasm": "^1.0.2",
165
+ "xxhash-wasm": "^1.1.0",
166
166
  "yargs-parser": "^21.1.1",
167
167
  "zod": "^3.23.8",
168
168
  "zod-to-json-schema": "^3.23.5",
@@ -176,13 +176,13 @@
176
176
  },
177
177
  "devDependencies": {
178
178
  "@astrojs/check": "^0.9.4",
179
- "@playwright/test": "^1.48.2",
179
+ "@playwright/test": "^1.49.0",
180
180
  "@types/aria-query": "^5.0.4",
181
181
  "@types/common-ancestor-path": "^1.0.2",
182
182
  "@types/cssesc": "^3.0.2",
183
183
  "@types/debug": "^4.1.12",
184
184
  "@types/diff": "^5.2.3",
185
- "@types/dlv": "^1.1.4",
185
+ "@types/dlv": "^1.1.5",
186
186
  "@types/hast": "^3.0.4",
187
187
  "@types/html-escaper": "^3.0.2",
188
188
  "@types/http-cache-semantics": "^4.0.4",
@@ -204,9 +204,9 @@
204
204
  "rehype-slug": "^6.0.0",
205
205
  "rehype-toc": "^3.0.2",
206
206
  "remark-code-titles": "^0.1.2",
207
- "rollup": "^4.24.4",
208
- "sass": "^1.80.6",
209
- "undici": "^6.20.1",
207
+ "rollup": "^4.27.4",
208
+ "sass": "^1.81.0",
209
+ "undici": "^6.21.0",
210
210
  "unified": "^11.0.5",
211
211
  "astro-scripts": "0.0.14"
212
212
  },