astro 2.6.3 → 2.6.4

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.
@@ -399,7 +399,7 @@ export interface AstroUserConfig {
399
399
  /**
400
400
  * @docs
401
401
  * @name redirects (Experimental)
402
- * @type {RedirectConfig}
402
+ * @type {Record<string, RedirectConfig>}
403
403
  * @default `{}`
404
404
  * @version 2.6.0
405
405
  * @description Specify a mapping of redirects where the key is the route to match
@@ -439,7 +439,7 @@ export interface AstroUserConfig {
439
439
  * }
440
440
  * ```
441
441
  */
442
- redirects?: RedirectConfig;
442
+ redirects?: Record<string, RedirectConfig>;
443
443
  /**
444
444
  * @docs
445
445
  * @name site
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "2.6.3";
1
+ const ASTRO_VERSION = "2.6.4";
2
2
  const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
3
3
  ".markdown",
4
4
  ".mdown",
@@ -53,7 +53,7 @@ async function dev(settings, options) {
53
53
  isRestart: options.isRestart
54
54
  })
55
55
  );
56
- const currentVersion = "2.6.3";
56
+ const currentVersion = "2.6.4";
57
57
  if (currentVersion.includes("-")) {
58
58
  warn(options.logging, null, msg.prerelease({ currentVersion }));
59
59
  }
@@ -11,10 +11,14 @@ import { codeFrame } from "../printer.js";
11
11
  import { normalizeLF } from "../utils.js";
12
12
  function collectErrorMetadata(e, rootFolder) {
13
13
  const err = AggregateError.is(e) || Array.isArray(e.errors) ? e.errors : [e];
14
- err.forEach((error) => {
14
+ err.forEach((error, idx) => {
15
15
  var _a, _b;
16
- if (error.stack) {
17
- error = collectInfoFromStacktrace(e);
16
+ if (e.stack) {
17
+ const stackInfo = collectInfoFromStacktrace(e);
18
+ error.stack = stackInfo.stack;
19
+ error.loc = stackInfo.loc;
20
+ error.plugin = stackInfo.plugin;
21
+ error.pluginCode = stackInfo.pluginCode;
18
22
  }
19
23
  const normalizedFile = normalizePath(((_a = error.loc) == null ? void 0 : _a.file) || "");
20
24
  const normalizedRootFolder = removeLeadingForwardSlashWindows((rootFolder == null ? void 0 : rootFolder.pathname) || "");
@@ -91,11 +95,15 @@ See https://docs.astro.build/en/guides/troubleshooting/#document-or-window-is-no
91
95
  }
92
96
  function collectInfoFromStacktrace(error) {
93
97
  var _a, _b, _c;
94
- if (!error.stack)
95
- return error;
96
- error.stack = normalizeLF(error.stack);
98
+ let stackInfo = {
99
+ stack: error.stack,
100
+ plugin: error.plugin,
101
+ pluginCode: error.pluginCode,
102
+ loc: error.loc
103
+ };
104
+ stackInfo.stack = normalizeLF(error.stack);
97
105
  const stackText = stripAnsi(error.stack);
98
- if (!error.loc || !error.loc.column && !error.loc.line) {
106
+ if (!stackInfo.loc || !stackInfo.loc.column && !stackInfo.loc.line) {
99
107
  const possibleFilePath = ((_a = error.loc) == null ? void 0 : _a.file) || error.pluginCode || error.id || // TODO: this could be better, `src` might be something else
100
108
  stackText.split("\n").find((ln) => ln.includes("src") || ln.includes("node_modules"));
101
109
  const source = possibleFilePath == null ? void 0 : possibleFilePath.replace(/^[^(]+\(([^)]+).*$/, "$1").replace(/^\s+at\s+/, "");
@@ -108,18 +116,18 @@ function collectInfoFromStacktrace(error) {
108
116
  file = fileURLToPath(file);
109
117
  } catch {
110
118
  }
111
- error.loc = {
119
+ stackInfo.loc = {
112
120
  file,
113
121
  line: Number.parseInt(line),
114
122
  column: Number.parseInt(column)
115
123
  };
116
124
  }
117
125
  }
118
- if (!error.plugin) {
119
- error.plugin = ((_b = /withastro\/astro\/packages\/integrations\/([\w-]+)/gim.exec(stackText)) == null ? void 0 : _b.at(1)) || ((_c = /(@astrojs\/[\w-]+)\/(server|client|index)/gim.exec(stackText)) == null ? void 0 : _c.at(1)) || void 0;
126
+ if (!stackInfo.plugin) {
127
+ stackInfo.plugin = ((_b = /withastro\/astro\/packages\/integrations\/([\w-]+)/gim.exec(stackText)) == null ? void 0 : _b.at(1)) || ((_c = /(@astrojs\/[\w-]+)\/(server|client|index)/gim.exec(stackText)) == null ? void 0 : _c.at(1)) || void 0;
120
128
  }
121
- error.stack = cleanErrorStack(error.stack);
122
- return error;
129
+ stackInfo.stack = cleanErrorStack(error.stack);
130
+ return stackInfo;
123
131
  }
124
132
  function cleanErrorStack(stack) {
125
133
  return stack.split(/\n/g).map((l) => l.replace(/\/@fs\//g, "/")).join("\n");
@@ -976,6 +976,7 @@ export declare const AstroErrorData: {
976
976
  };
977
977
  /**
978
978
  * @docs
979
+ * @message `COLLECTION_NAME` contains multiple entries with the same slug: `SLUG`. Slugs must be unique.
979
980
  * @description
980
981
  * Content collection entries must have unique slugs. Duplicates are often caused by the `slug` frontmatter property.
981
982
  */
@@ -1034,6 +1034,7 @@ Expected \`${defaultExpectedValue}\` value but got \`${suffix}\`.`;
1034
1034
  },
1035
1035
  /**
1036
1036
  * @docs
1037
+ * @message `COLLECTION_NAME` contains multiple entries with the same slug: `SLUG`. Slugs must be unique.
1037
1038
  * @description
1038
1039
  * Content collection entries must have unique slugs. Duplicates are often caused by the `slug` frontmatter property.
1039
1040
  */
@@ -47,7 +47,7 @@ function serverStart({
47
47
  base,
48
48
  isRestart = false
49
49
  }) {
50
- const version = "2.6.3";
50
+ const version = "2.6.4";
51
51
  const localPrefix = `${dim("\u2503")} Local `;
52
52
  const networkPrefix = `${dim("\u2503")} Network `;
53
53
  const emptyPrefix = " ".repeat(11);
@@ -233,7 +233,7 @@ function printHelp({
233
233
  message.push(
234
234
  linebreak(),
235
235
  ` ${bgGreen(black(` ${commandName} `))} ${green(
236
- `v${"2.6.3"}`
236
+ `v${"2.6.4"}`
237
237
  )} ${headline}`
238
238
  );
239
239
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "2.6.3",
3
+ "version": "2.6.4",
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",