astro 4.0.5 → 4.0.6

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.
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.0.5";
1
+ const ASTRO_VERSION = "4.0.6";
2
2
  const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
3
3
  ".markdown",
4
4
  ".mdown",
@@ -1,6 +1,6 @@
1
1
  import nodeFs from "node:fs";
2
2
  import * as vite from "vite";
3
- import { injectImageEndpoint } from "../../assets/internal.js";
3
+ import { injectImageEndpoint } from "../../assets/endpoint/config.js";
4
4
  import {
5
5
  runHookConfigDone,
6
6
  runHookConfigSetup,
@@ -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.5";
24
+ const currentVersion = "4.0.6";
25
25
  if (currentVersion.includes("-")) {
26
26
  logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
27
27
  }
@@ -230,8 +230,8 @@ const ResponseSentError = {
230
230
  };
231
231
  const MiddlewareNoDataOrNextCalled = {
232
232
  name: "MiddlewareNoDataOrNextCalled",
233
- title: "The middleware didn't return a response or call `next`.",
234
- message: "The middleware needs to either return a `Response` object or call the `next` function."
233
+ title: "The middleware didn't return a `Response`.",
234
+ message: "Make sure your middleware returns a `Response` object, either directly or by returning the `Response` from calling the `next` function."
235
235
  };
236
236
  const MiddlewareNotAResponse = {
237
237
  name: "MiddlewareNotAResponse",
@@ -36,7 +36,7 @@ function serverStart({
36
36
  host,
37
37
  base
38
38
  }) {
39
- const version = "4.0.5";
39
+ const version = "4.0.6";
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.5"}`
261
+ `v${"4.0.6"}`
262
262
  )} ${headline}`
263
263
  );
264
264
  }
@@ -318,7 +318,7 @@ This route collides with: "${collision.component}".`
318
318
  if (/^https?:\/\//.test(destination)) {
319
319
  logger.warn(
320
320
  "redirects",
321
- `Redirecting to an external URL is not officially supported: ${from} -> ${to}`
321
+ `Redirecting to an external URL is not officially supported: ${from} -> ${destination}`
322
322
  );
323
323
  }
324
324
  }
@@ -1,11 +1,13 @@
1
1
  import { TRANSITION_AFTER_SWAP, doPreparation, doSwap } from "./events.js";
2
+ const inBrowser = import.meta.env.SSR === false;
3
+ const pushState = inBrowser && history.pushState.bind(history);
4
+ const replaceState = inBrowser && history.replaceState.bind(history);
2
5
  const updateScrollPosition = (positions) => {
3
6
  if (history.state) {
4
7
  history.scrollRestoration = "manual";
5
- history.replaceState({ ...history.state, ...positions }, "");
8
+ replaceState({ ...history.state, ...positions }, "");
6
9
  }
7
10
  };
8
- const inBrowser = import.meta.env.SSR === false;
9
11
  const supportsViewTransitions = inBrowser && !!document.startViewTransition;
10
12
  const transitionEnabledOnThisPage = () => inBrowser && !!document.querySelector('[name="astro-view-transitions-enabled"]');
11
13
  const samePage = (thisLocation, otherLocation) => thisLocation.pathname === otherLocation.pathname && thisLocation.search === otherLocation.search;
@@ -43,7 +45,7 @@ if (inBrowser) {
43
45
  currentHistoryIndex = history.state.index;
44
46
  scrollTo({ left: history.state.scrollX, top: history.state.scrollY });
45
47
  } else if (transitionEnabledOnThisPage()) {
46
- history.replaceState({ index: currentHistoryIndex, scrollX, scrollY }, "");
48
+ replaceState({ index: currentHistoryIndex, scrollX, scrollY }, "");
47
49
  history.scrollRestoration = "manual";
48
50
  }
49
51
  }
@@ -117,7 +119,7 @@ const moveToLocation = (to, from, options, historyState) => {
117
119
  if (to.href !== location.href && !historyState) {
118
120
  if (options.history === "replace") {
119
121
  const current = history.state;
120
- history.replaceState(
122
+ replaceState(
121
123
  {
122
124
  ...options.state,
123
125
  index: current.index,
@@ -128,7 +130,7 @@ const moveToLocation = (to, from, options, historyState) => {
128
130
  to.href
129
131
  );
130
132
  } else {
131
- history.pushState(
133
+ pushState(
132
134
  { ...options.state, index: ++currentHistoryIndex, scrollX: 0, scrollY: 0 },
133
135
  "",
134
136
  to.href
@@ -1,8 +1,4 @@
1
- import { collectErrorMetadata } from "../core/errors/dev/index.js";
2
- import { createSafeError } from "../core/errors/index.js";
3
- import { formatErrorMessage } from "../core/messages.js";
4
1
  import { collapseDuplicateSlashes, removeTrailingForwardSlash } from "../core/path.js";
5
- import { eventError, telemetry } from "../events/index.js";
6
2
  import { isServerLikeOutput } from "../prerender/utils.js";
7
3
  import { runWithErrorHandling } from "./controller.js";
8
4
  import { handle500Response } from "./response.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.0.5",
3
+ "version": "4.0.6",
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",
@@ -99,7 +99,7 @@
99
99
  "vendor"
100
100
  ],
101
101
  "dependencies": {
102
- "@astrojs/compiler": "^2.3.2",
102
+ "@astrojs/compiler": "^2.3.4",
103
103
  "@babel/core": "^7.23.3",
104
104
  "@babel/generator": "^7.23.3",
105
105
  "@babel/parser": "^7.23.3",