astro 6.3.4 → 6.3.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.
- package/dist/assets/internal.js +20 -16
- package/dist/assets/services/service.d.ts +1 -1
- package/dist/assets/services/service.js +9 -9
- package/dist/assets/services/sharp.js +48 -28
- package/dist/assets/utils/generateImageStylesCSS.js +26 -6
- package/dist/assets/utils/inferSourceFormat.d.ts +8 -3
- package/dist/assets/utils/inferSourceFormat.js +15 -4
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/content/runtime.js +1 -1
- package/dist/content/types-generator.js +5 -1
- package/dist/core/build/util.js +8 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/errors-data.d.ts +29 -29
- package/dist/core/errors/errors-data.js +71 -71
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/render/route-cache.d.ts +1 -0
- package/dist/core/render/route-cache.js +2 -2
- package/dist/vite-plugin-hmr-reload/index.d.ts +1 -1
- package/dist/vite-plugin-hmr-reload/index.js +20 -1
- package/package.json +1 -1
package/dist/assets/internal.js
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
isImageMetadata
|
|
14
14
|
} from "./types.js";
|
|
15
15
|
import { isESMImportedImage, isRemoteImage, resolveSrc } from "./utils/imageKind.js";
|
|
16
|
+
import { resolveDefaultOutputFormat } from "./utils/inferSourceFormat.js";
|
|
16
17
|
import { inferRemoteSize } from "./utils/remoteProbe.js";
|
|
17
18
|
import { createPlaceholderURL, stringifyPlaceholderURL } from "./utils/url.js";
|
|
18
19
|
import { verifyOptions } from "./services/service.js";
|
|
@@ -73,6 +74,9 @@ async function getImage(options, imageConfig) {
|
|
|
73
74
|
const result = await getRemoteSize(resolvedOptions.src);
|
|
74
75
|
resolvedOptions.width ??= result.width;
|
|
75
76
|
resolvedOptions.height ??= result.height;
|
|
77
|
+
if (result.format) {
|
|
78
|
+
resolvedOptions.format ??= resolveDefaultOutputFormat(result.format);
|
|
79
|
+
}
|
|
76
80
|
originalWidth = result.width;
|
|
77
81
|
originalHeight = result.height;
|
|
78
82
|
}
|
|
@@ -124,24 +128,13 @@ async function getImage(options, imageConfig) {
|
|
|
124
128
|
}
|
|
125
129
|
const currentPosition = resolvedOptions.position || "center";
|
|
126
130
|
resolvedOptions["data-astro-image-pos"] = currentPosition.replace(/\s+/g, "-");
|
|
127
|
-
if (resolvedOptions.position) {
|
|
128
|
-
if (typeof resolvedOptions.style === "object" && resolvedOptions.style !== null) {
|
|
129
|
-
if (!("objectPosition" in resolvedOptions.style)) {
|
|
130
|
-
resolvedOptions.style = {
|
|
131
|
-
...resolvedOptions.style,
|
|
132
|
-
objectPosition: resolvedOptions.position
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
} else {
|
|
136
|
-
const existingStyle = typeof resolvedOptions.style === "string" ? resolvedOptions.style : "";
|
|
137
|
-
if (!existingStyle.includes("object-position")) {
|
|
138
|
-
const positionStyle = `object-position: ${resolvedOptions.position}`;
|
|
139
|
-
resolvedOptions.style = existingStyle ? existingStyle.replace(/;?\s*$/, "; ") + positionStyle : positionStyle;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
131
|
}
|
|
144
132
|
const validatedOptions = service.validateOptions ? await service.validateOptions(resolvedOptions, imageConfig) : resolvedOptions;
|
|
133
|
+
validatedOptions.format ??= await peekRemoteFormatForStaticEmit(
|
|
134
|
+
validatedOptions,
|
|
135
|
+
imageConfig,
|
|
136
|
+
service
|
|
137
|
+
);
|
|
145
138
|
const srcSetTransforms = service.getSrcSet ? await service.getSrcSet(validatedOptions, imageConfig) : [];
|
|
146
139
|
const lazyImageURLFactory = (getValue) => {
|
|
147
140
|
let cached = null;
|
|
@@ -203,6 +196,17 @@ async function getImage(options, imageConfig) {
|
|
|
203
196
|
attributes: service.getHTMLAttributes !== void 0 ? await service.getHTMLAttributes(validatedOptions, imageConfig) : {}
|
|
204
197
|
};
|
|
205
198
|
}
|
|
199
|
+
async function peekRemoteFormatForStaticEmit(options, imageConfig, service) {
|
|
200
|
+
if (!isRemoteImage(options.src) || !isRemoteAllowed(options.src, imageConfig) || !globalThis.astroAsset?.addStaticImage || !isLocalService(service) || !service.getRemoteSize) {
|
|
201
|
+
return void 0;
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
const probed = await service.getRemoteSize(options.src, imageConfig);
|
|
205
|
+
return resolveDefaultOutputFormat(probed.format);
|
|
206
|
+
} catch {
|
|
207
|
+
return void 0;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
206
210
|
export {
|
|
207
211
|
cssFitValues,
|
|
208
212
|
getConfiguredImageService,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { isRemoteAllowed } from "@astrojs/internal-helpers/remote";
|
|
2
2
|
import { AstroError, AstroErrorData } from "../../core/errors/index.js";
|
|
3
3
|
import { isRemotePath, joinPaths } from "../../core/path.js";
|
|
4
|
-
import { DEFAULT_HASH_PROPS,
|
|
4
|
+
import { DEFAULT_HASH_PROPS, VALID_SUPPORTED_FORMATS } from "../consts.js";
|
|
5
5
|
import { isESMImportedImage, isRemoteImage } from "../utils/imageKind.js";
|
|
6
|
+
import { inferSourceFormat, resolveDefaultOutputFormat } from "../utils/inferSourceFormat.js";
|
|
6
7
|
import { inferRemoteSize } from "../utils/remoteProbe.js";
|
|
7
8
|
function isLocalService(service) {
|
|
8
9
|
if (!service) {
|
|
@@ -74,10 +75,11 @@ const baseService = {
|
|
|
74
75
|
validateOptions(options) {
|
|
75
76
|
verifyOptions(options);
|
|
76
77
|
if (!options.format) {
|
|
77
|
-
if (isESMImportedImage(options.src)
|
|
78
|
-
options.format =
|
|
78
|
+
if (isESMImportedImage(options.src)) {
|
|
79
|
+
options.format = resolveDefaultOutputFormat(options.src.format);
|
|
79
80
|
} else {
|
|
80
|
-
|
|
81
|
+
const inferred = inferSourceFormat(options.src);
|
|
82
|
+
if (inferred) options.format = resolveDefaultOutputFormat(inferred);
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
if (options.width) options.width = Math.round(options.width);
|
|
@@ -120,7 +122,7 @@ const baseService = {
|
|
|
120
122
|
const { targetWidth, targetHeight } = getTargetDimensions(options);
|
|
121
123
|
const aspectRatio = targetWidth / targetHeight;
|
|
122
124
|
const { widths, densities } = options;
|
|
123
|
-
const targetFormat = options.format
|
|
125
|
+
const targetFormat = options.format;
|
|
124
126
|
let transformedWidths = (widths ?? []).sort(sortNumeric);
|
|
125
127
|
let imageWidth = options.width;
|
|
126
128
|
let maxWidth = Number.POSITIVE_INFINITY;
|
|
@@ -164,9 +166,7 @@ const baseService = {
|
|
|
164
166
|
return {
|
|
165
167
|
transform,
|
|
166
168
|
descriptor,
|
|
167
|
-
attributes: {
|
|
168
|
-
type: `image/${targetFormat}`
|
|
169
|
-
}
|
|
169
|
+
attributes: targetFormat ? { type: `image/${targetFormat}` } : {}
|
|
170
170
|
};
|
|
171
171
|
});
|
|
172
172
|
},
|
|
@@ -210,7 +210,7 @@ const baseService = {
|
|
|
210
210
|
src: params.get("href"),
|
|
211
211
|
width: params.has("w") ? Number.parseInt(params.get("w")) : void 0,
|
|
212
212
|
height: params.has("h") ? Number.parseInt(params.get("h")) : void 0,
|
|
213
|
-
format: params.get("f"),
|
|
213
|
+
format: params.has("f") ? params.get("f") : void 0,
|
|
214
214
|
quality: params.get("q"),
|
|
215
215
|
fit: params.get("fit"),
|
|
216
216
|
position: params.get("position") ?? void 0,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AstroError, AstroErrorData } from "../../core/errors/index.js";
|
|
2
|
+
import { resolveDefaultOutputFormat } from "../utils/inferSourceFormat.js";
|
|
2
3
|
import { detector } from "../utils/vendor/image-size/detector.js";
|
|
3
4
|
import {
|
|
4
5
|
baseService,
|
|
@@ -21,6 +22,9 @@ function resolveSharpQuality(quality) {
|
|
|
21
22
|
}
|
|
22
23
|
function resolveSharpEncoderOptions(transform, inputFormat, serviceConfig = {}) {
|
|
23
24
|
const quality = resolveSharpQuality(transform.quality);
|
|
25
|
+
if (transform.format === void 0) {
|
|
26
|
+
return quality === void 0 ? void 0 : { quality };
|
|
27
|
+
}
|
|
24
28
|
switch (transform.format) {
|
|
25
29
|
case "jpg":
|
|
26
30
|
case "jpeg":
|
|
@@ -82,11 +86,27 @@ const sharpService = {
|
|
|
82
86
|
if (!sharp) sharp = await loadSharp();
|
|
83
87
|
const transform = transformOptions;
|
|
84
88
|
const kernel = config.service.config.kernel;
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
const bufferFormat = detector(inputBuffer);
|
|
90
|
+
const outputFormat = transform.format ?? resolveDefaultOutputFormat(bufferFormat);
|
|
91
|
+
if (outputFormat === "svg") {
|
|
92
|
+
if (bufferFormat && bufferFormat !== "svg") {
|
|
93
|
+
console.warn(
|
|
94
|
+
`\u26A0\uFE0F Astro expected an SVG for "${transform.src}" but the source is ${bufferFormat}. Passing it through as ${bufferFormat} instead.`
|
|
95
|
+
);
|
|
96
|
+
return { data: inputBuffer, format: bufferFormat };
|
|
97
|
+
}
|
|
98
|
+
return { data: inputBuffer, format: "svg" };
|
|
99
|
+
}
|
|
100
|
+
if (!bufferFormat) {
|
|
101
|
+
throw new AstroError({
|
|
102
|
+
...AstroErrorData.NoImageMetadata,
|
|
103
|
+
message: AstroErrorData.NoImageMetadata.message(transform.src)
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (bufferFormat === "svg" && !config.dangerouslyProcessSVG) {
|
|
87
107
|
throw new AstroError({
|
|
88
108
|
...AstroErrorData.UnsupportedImageFormat,
|
|
89
|
-
message:
|
|
109
|
+
message: `SVG image processing is disabled, but the source for "${transform.src}" is an SVG. Pass it through unchanged by setting \`format="svg"\` on the component, or set \`image.dangerouslyProcessSVG: true\` to rasterize SVG sources.`
|
|
90
110
|
});
|
|
91
111
|
}
|
|
92
112
|
const result = sharp(inputBuffer, {
|
|
@@ -95,15 +115,6 @@ const sharpService = {
|
|
|
95
115
|
limitInputPixels: config.service.config.limitInputPixels
|
|
96
116
|
});
|
|
97
117
|
result.rotate();
|
|
98
|
-
let format;
|
|
99
|
-
try {
|
|
100
|
-
({ format } = await result.metadata());
|
|
101
|
-
} catch {
|
|
102
|
-
console.warn(
|
|
103
|
-
`\u26A0\uFE0F Astro could not optimize image "${transform.src}". Sharp doesn't support this format. The image will be used unoptimized. Consider converting to WebP or placing in the public/ folder.`
|
|
104
|
-
);
|
|
105
|
-
return { data: inputBuffer, format: transform.format };
|
|
106
|
-
}
|
|
107
118
|
if (transform.width && transform.height) {
|
|
108
119
|
const fit = transform.fit ? fitMap[transform.fit] ?? "inside" : void 0;
|
|
109
120
|
result.resize({
|
|
@@ -130,23 +141,32 @@ const sharpService = {
|
|
|
130
141
|
if (transform.background) {
|
|
131
142
|
result.flatten({ background: transform.background });
|
|
132
143
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
const encoderOptions = resolveSharpEncoderOptions(
|
|
145
|
+
{ format: outputFormat, quality: transform.quality },
|
|
146
|
+
bufferFormat,
|
|
147
|
+
config.service.config
|
|
148
|
+
);
|
|
149
|
+
if (outputFormat === "webp") {
|
|
150
|
+
result.webp(encoderOptions);
|
|
151
|
+
} else if (outputFormat === "png") {
|
|
152
|
+
result.png(encoderOptions);
|
|
153
|
+
} else if (outputFormat === "avif") {
|
|
154
|
+
result.avif(encoderOptions);
|
|
155
|
+
} else if (outputFormat === "jpeg" || outputFormat === "jpg") {
|
|
156
|
+
result.jpeg(encoderOptions);
|
|
157
|
+
} else {
|
|
158
|
+
result.toFormat(outputFormat, encoderOptions);
|
|
159
|
+
}
|
|
160
|
+
let data;
|
|
161
|
+
let info;
|
|
162
|
+
try {
|
|
163
|
+
({ data, info } = await result.toBuffer({ resolveWithObject: true }));
|
|
164
|
+
} catch {
|
|
165
|
+
console.warn(
|
|
166
|
+
`\u26A0\uFE0F Astro could not optimize image "${transform.src}". Sharp doesn't support this format. The image will be used unoptimized. Consider converting to WebP or placing in the public/ folder.`
|
|
167
|
+
);
|
|
168
|
+
return { data: inputBuffer, format: bufferFormat };
|
|
148
169
|
}
|
|
149
|
-
const { data, info } = await result.toBuffer({ resolveWithObject: true });
|
|
150
170
|
const needsCopy = "buffer" in data && data.buffer instanceof SharedArrayBuffer;
|
|
151
171
|
return {
|
|
152
172
|
data: needsCopy ? new Uint8Array(data) : data,
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { cssFitValues } from "../internal.js";
|
|
2
|
+
const POSITION_KEYWORDS = ["top", "bottom", "left", "right", "center"];
|
|
3
|
+
function getPositionEntries() {
|
|
4
|
+
const entries = [];
|
|
5
|
+
for (const kw of POSITION_KEYWORDS) {
|
|
6
|
+
entries.push([kw, kw]);
|
|
7
|
+
}
|
|
8
|
+
for (const a of POSITION_KEYWORDS) {
|
|
9
|
+
for (const b of POSITION_KEYWORDS) {
|
|
10
|
+
if (a === b) continue;
|
|
11
|
+
const cssValue = `${a} ${b}`;
|
|
12
|
+
const dataAttr = `${a}-${b}`;
|
|
13
|
+
entries.push([dataAttr, cssValue]);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return entries;
|
|
17
|
+
}
|
|
2
18
|
function generateImageStylesCSS(defaultObjectFit, defaultObjectPosition) {
|
|
3
19
|
const fitStyles = cssFitValues.map(
|
|
4
20
|
(fit) => `
|
|
@@ -10,11 +26,14 @@ function generateImageStylesCSS(defaultObjectFit, defaultObjectPosition) {
|
|
|
10
26
|
:where([data-astro-image]:not([data-astro-image-fit])) {
|
|
11
27
|
object-fit: ${defaultObjectFit};
|
|
12
28
|
}` : "";
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
29
|
+
const positionEntries = getPositionEntries();
|
|
30
|
+
const positionStyles = positionEntries.map(
|
|
31
|
+
([dataAttr, cssValue]) => `
|
|
32
|
+
[data-astro-image-pos="${dataAttr}"] {
|
|
33
|
+
object-position: ${cssValue};
|
|
34
|
+
}`
|
|
35
|
+
).join("\n");
|
|
36
|
+
const defaultPositionStyle = defaultObjectPosition ? `
|
|
18
37
|
:where([data-astro-image]:not([data-astro-image-pos])) {
|
|
19
38
|
object-position: ${defaultObjectPosition};
|
|
20
39
|
}` : "";
|
|
@@ -30,7 +49,8 @@ function generateImageStylesCSS(defaultObjectFit, defaultObjectPosition) {
|
|
|
30
49
|
}
|
|
31
50
|
${fitStyles}
|
|
32
51
|
${defaultFitStyle}
|
|
33
|
-
${
|
|
52
|
+
${positionStyles}
|
|
53
|
+
${defaultPositionStyle}
|
|
34
54
|
`.trim();
|
|
35
55
|
}
|
|
36
56
|
export {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Infer the image format from a source path or URL
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Infer the image format from a source path or URL.
|
|
3
|
+
*
|
|
4
|
+
* For `data:` URIs the MIME is read up to the first `;` or `,` (whichever comes first),
|
|
5
|
+
* so both `data:image/svg+xml;base64,...` and `data:image/svg+xml,<svg>...` work.
|
|
6
|
+
* `image/svg+xml` normalizes to `svg`; otherwise the subtype after the slash is returned.
|
|
7
|
+
*
|
|
8
|
+
* Returns undefined when the format cannot be determined.
|
|
5
9
|
*/
|
|
6
10
|
export declare function inferSourceFormat(src: string): string | undefined;
|
|
11
|
+
export declare function resolveDefaultOutputFormat(sourceFormat: string | undefined): string;
|
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
import { removeQueryString } from "@astrojs/internal-helpers/path";
|
|
2
|
+
import { DEFAULT_OUTPUT_FORMAT } from "../consts.js";
|
|
2
3
|
const DATA_PREFIX = "data:";
|
|
3
4
|
function inferSourceFormat(src) {
|
|
4
5
|
if (src.startsWith(DATA_PREFIX)) {
|
|
5
|
-
const
|
|
6
|
+
const sepIndex = src.indexOf(";");
|
|
7
|
+
const commaIndex = src.indexOf(",");
|
|
8
|
+
const mimeEnd = sepIndex === -1 ? commaIndex : commaIndex === -1 ? sepIndex : Math.min(sepIndex, commaIndex);
|
|
9
|
+
if (mimeEnd === -1) return void 0;
|
|
10
|
+
const mime = src.slice(DATA_PREFIX.length, mimeEnd);
|
|
6
11
|
if (mime === "image/svg+xml") return "svg";
|
|
7
12
|
const sub = mime.split("/")[1];
|
|
8
13
|
return sub || void 0;
|
|
9
14
|
}
|
|
10
15
|
try {
|
|
11
16
|
const cleanSrc = removeQueryString(src).split("#")[0];
|
|
12
|
-
const
|
|
17
|
+
const lastSlash = cleanSrc.lastIndexOf("/");
|
|
18
|
+
const basename = lastSlash === -1 ? cleanSrc : cleanSrc.slice(lastSlash + 1);
|
|
19
|
+
const lastDot = basename.lastIndexOf(".");
|
|
13
20
|
if (lastDot === -1) return void 0;
|
|
14
|
-
return
|
|
21
|
+
return basename.slice(lastDot + 1).toLowerCase();
|
|
15
22
|
} catch {
|
|
16
23
|
return void 0;
|
|
17
24
|
}
|
|
18
25
|
}
|
|
26
|
+
function resolveDefaultOutputFormat(sourceFormat) {
|
|
27
|
+
return sourceFormat === "svg" ? "svg" : DEFAULT_OUTPUT_FORMAT;
|
|
28
|
+
}
|
|
19
29
|
export {
|
|
20
|
-
inferSourceFormat
|
|
30
|
+
inferSourceFormat,
|
|
31
|
+
resolveDefaultOutputFormat
|
|
21
32
|
};
|
|
@@ -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.
|
|
194
|
+
if (previousAstroVersion && previousAstroVersion !== "6.3.6") {
|
|
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.
|
|
203
|
-
this.#store.metaStore().set("astro-version", "6.3.
|
|
202
|
+
if ("6.3.6") {
|
|
203
|
+
this.#store.metaStore().set("astro-version", "6.3.6");
|
|
204
204
|
}
|
|
205
205
|
if (currentConfigDigest) {
|
|
206
206
|
this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
package/dist/content/runtime.js
CHANGED
|
@@ -351,7 +351,7 @@ async function updateImageReferencesInBody(html, fileName) {
|
|
|
351
351
|
srcset: image.srcSet.attribute,
|
|
352
352
|
// This attribute is used by the toolbar audit
|
|
353
353
|
...import.meta.env.DEV ? { "data-image-component": "true" } : {}
|
|
354
|
-
}).map(([key, value]) => value ? `${key}="${escape(value)}"`
|
|
354
|
+
}).filter(([, value]) => value != null).map(([key, value]) => value === "" ? `${key}=""` : `${key}="${escape(String(value))}"`).join(" ");
|
|
355
355
|
});
|
|
356
356
|
}
|
|
357
357
|
function updateImageReferencesInData(data, fileName, imageAssetMap) {
|
|
@@ -447,7 +447,11 @@ async function generateJSONSchema(fsMod, collectionConfig, collectionKey, collec
|
|
|
447
447
|
zodSchemaForJson = await getContentLayerSchema(collectionConfig, collectionKey);
|
|
448
448
|
}
|
|
449
449
|
if (collectionConfig.type === CONTENT_LAYER_TYPE && collectionConfig.loader.name === "file-loader") {
|
|
450
|
-
|
|
450
|
+
const itemSchema = zodSchemaForJson;
|
|
451
|
+
zodSchemaForJson = z.union([
|
|
452
|
+
z.array(itemSchema),
|
|
453
|
+
z.object({ $schema: z.string().optional() }).catchall(itemSchema)
|
|
454
|
+
]);
|
|
451
455
|
}
|
|
452
456
|
if (zodSchemaForJson instanceof z.ZodObject) {
|
|
453
457
|
const existingMeta = z.globalRegistry.get(zodSchemaForJson);
|
package/dist/core/build/util.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
function getTimeStat(timeStart, timeEnd) {
|
|
2
2
|
const buildTime = timeEnd - timeStart;
|
|
3
|
-
|
|
3
|
+
if (buildTime < 1e3) {
|
|
4
|
+
return `${Math.round(buildTime)}ms`;
|
|
5
|
+
} else if (buildTime < 6e4) {
|
|
6
|
+
return `${(buildTime / 1e3).toFixed(2)}s`;
|
|
7
|
+
}
|
|
8
|
+
const mins = Math.floor(buildTime / 6e4);
|
|
9
|
+
const secs = Math.round(buildTime % 6e4 / 1e3);
|
|
10
|
+
return `${mins}m ${secs}s`;
|
|
4
11
|
}
|
|
5
12
|
function shouldAppendForwardSlash(trailingSlash, buildFormat) {
|
|
6
13
|
switch (trailingSlash) {
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -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.
|
|
40
|
+
const currentVersion = "6.3.6";
|
|
41
41
|
const isPrerelease = currentVersion.includes("-");
|
|
42
42
|
if (!isPrerelease) {
|
|
43
43
|
try {
|
|
@@ -30,7 +30,7 @@ export declare const UnknownCompilerError: {
|
|
|
30
30
|
* @docs
|
|
31
31
|
* @see
|
|
32
32
|
* - [Official integrations](https://docs.astro.build/en/guides/integrations/#official-integrations)
|
|
33
|
-
* - [Astro.clientAddress](https://docs.astro.build/en/reference/api-reference/#clientaddress)
|
|
33
|
+
* - [`Astro.clientAddress`](https://docs.astro.build/en/reference/api-reference/#clientaddress)
|
|
34
34
|
* @description
|
|
35
35
|
* The adapter you're using unfortunately does not support `Astro.clientAddress`.
|
|
36
36
|
*/
|
|
@@ -43,7 +43,7 @@ export declare const ClientAddressNotAvailable: {
|
|
|
43
43
|
* @docs
|
|
44
44
|
* @see
|
|
45
45
|
* - [On-demand rendering](https://docs.astro.build/en/guides/on-demand-rendering/)
|
|
46
|
-
* - [Astro.clientAddress](https://docs.astro.build/en/reference/api-reference/#clientaddress)
|
|
46
|
+
* - [`Astro.clientAddress`](https://docs.astro.build/en/reference/api-reference/#clientaddress)
|
|
47
47
|
* @description
|
|
48
48
|
* The `Astro.clientAddress` property cannot be used inside prerendered routes.
|
|
49
49
|
*/
|
|
@@ -56,7 +56,7 @@ export declare const PrerenderClientAddressNotAvailable: {
|
|
|
56
56
|
* @docs
|
|
57
57
|
* @see
|
|
58
58
|
* - [Enabling SSR in Your Project](https://docs.astro.build/en/guides/on-demand-rendering/)
|
|
59
|
-
* - [Astro.clientAddress](https://docs.astro.build/en/reference/api-reference/#clientaddress)
|
|
59
|
+
* - [`Astro.clientAddress`](https://docs.astro.build/en/reference/api-reference/#clientaddress)
|
|
60
60
|
* @description
|
|
61
61
|
* The `Astro.clientAddress` property is only available when [Server-side rendering](https://docs.astro.build/en/guides/on-demand-rendering/) is enabled.
|
|
62
62
|
*
|
|
@@ -71,7 +71,7 @@ export declare const StaticClientAddressNotAvailable: {
|
|
|
71
71
|
/**
|
|
72
72
|
* @docs
|
|
73
73
|
* @see
|
|
74
|
-
* - [getStaticPaths()](https://docs.astro.build/en/reference/routing-reference/#getstaticpaths)
|
|
74
|
+
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/routing-reference/#getstaticpaths)
|
|
75
75
|
* @description
|
|
76
76
|
* A [dynamic route](https://docs.astro.build/en/guides/routing/#dynamic-routes) was matched, but no corresponding path was found for the requested parameters. This is often caused by a typo in either the generated or the requested path.
|
|
77
77
|
*/
|
|
@@ -95,7 +95,7 @@ export declare const NoMatchingStaticPathFound: {
|
|
|
95
95
|
* statusText: 'Not found'
|
|
96
96
|
* });
|
|
97
97
|
*
|
|
98
|
-
* // Alternatively, for redirects, Astro.redirect also returns an instance of Response
|
|
98
|
+
* // Alternatively, for redirects, `Astro.redirect()` also returns an instance of `Response`
|
|
99
99
|
* return Astro.redirect('/login');
|
|
100
100
|
* ---
|
|
101
101
|
* ```
|
|
@@ -179,7 +179,7 @@ export declare const NoClientOnlyHint: {
|
|
|
179
179
|
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/routing-reference/#getstaticpaths)
|
|
180
180
|
* - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
|
|
181
181
|
* @description
|
|
182
|
-
* The `params` property in `getStaticPaths`'s return value (an array of objects) should also be an object.
|
|
182
|
+
* The `params` property in `getStaticPaths()`'s return value (an array of objects) should also be an object.
|
|
183
183
|
*
|
|
184
184
|
* ```astro title="pages/blog/[id].astro"
|
|
185
185
|
* ---
|
|
@@ -203,7 +203,7 @@ export declare const InvalidGetStaticPathParam: {
|
|
|
203
203
|
* @see
|
|
204
204
|
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/routing-reference/#getstaticpaths)
|
|
205
205
|
* @description
|
|
206
|
-
* `getStaticPaths`'s return value must be an array of objects. In most cases, this error happens because an array of
|
|
206
|
+
* `getStaticPaths()`'s return value must be an array of objects. In most cases, this error happens because an array of arrays was returned. Using [`.flatMap()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap) or a [`.flat()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat) call may be useful.
|
|
207
207
|
*
|
|
208
208
|
* ```ts title="pages/blog/[id].astro"
|
|
209
209
|
* export async function getStaticPaths() {
|
|
@@ -226,7 +226,7 @@ export declare const InvalidGetStaticPathsEntry: {
|
|
|
226
226
|
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/routing-reference/#getstaticpaths)
|
|
227
227
|
* - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
|
|
228
228
|
* @description
|
|
229
|
-
* `getStaticPaths`'s return value must be an array of objects.
|
|
229
|
+
* `getStaticPaths()`'s return value must be an array of objects.
|
|
230
230
|
*
|
|
231
231
|
* ```ts title="pages/blog/[id].astro"
|
|
232
232
|
* export async function getStaticPaths() {
|
|
@@ -249,7 +249,7 @@ export declare const InvalidGetStaticPathsReturn: {
|
|
|
249
249
|
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/routing-reference/#getstaticpaths)
|
|
250
250
|
* - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
|
|
251
251
|
* @description
|
|
252
|
-
* Every route specified by `getStaticPaths`
|
|
252
|
+
* Every route specified by `getStaticPaths()` requires a `params` property specifying the path parameters needed to match the route.
|
|
253
253
|
*
|
|
254
254
|
* For instance, the following code:
|
|
255
255
|
* ```astro title="pages/blog/[id].astro"
|
|
@@ -315,9 +315,9 @@ export declare const GetStaticPathsInvalidRouteParam: {
|
|
|
315
315
|
* @see
|
|
316
316
|
* - [Dynamic Routes](https://docs.astro.build/en/guides/routing/#dynamic-routes)
|
|
317
317
|
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/routing-reference/#getstaticpaths)
|
|
318
|
-
* - [Server-side
|
|
318
|
+
* - [Server-side rendering](https://docs.astro.build/en/guides/on-demand-rendering/)
|
|
319
319
|
* @description
|
|
320
|
-
* In [Static Mode](https://docs.astro.build/en/guides/routing/#static-ssg-mode), all routes must be determined at build time. As such, dynamic routes must `export` a `getStaticPaths` function returning the different paths to generate.
|
|
320
|
+
* In [Static Mode](https://docs.astro.build/en/guides/routing/#static-ssg-mode), all routes must be determined at build time. As such, dynamic routes must `export` a `getStaticPaths()` function returning the different paths to generate.
|
|
321
321
|
*/
|
|
322
322
|
export declare const GetStaticPathsRequired: {
|
|
323
323
|
name: string;
|
|
@@ -340,7 +340,7 @@ export declare const ReservedSlotName: {
|
|
|
340
340
|
/**
|
|
341
341
|
* @docs
|
|
342
342
|
* @see
|
|
343
|
-
* - [Server-side
|
|
343
|
+
* - [Server-side rendering](https://docs.astro.build/en/guides/on-demand-rendering/)
|
|
344
344
|
* @description
|
|
345
345
|
* To use server-side rendering, an adapter needs to be installed so Astro knows how to generate the proper output for your targeted deployment platform.
|
|
346
346
|
*/
|
|
@@ -353,7 +353,7 @@ export declare const NoAdapterInstalled: {
|
|
|
353
353
|
/**
|
|
354
354
|
* @docs
|
|
355
355
|
* @see
|
|
356
|
-
* - [Server-side
|
|
356
|
+
* - [Server-side rendering](https://docs.astro.build/en/guides/on-demand-rendering/)
|
|
357
357
|
* @description
|
|
358
358
|
* The currently configured adapter does not support server-side rendering, which is required for the current project setup.
|
|
359
359
|
*
|
|
@@ -370,7 +370,7 @@ export declare const AdapterSupportOutputMismatch: {
|
|
|
370
370
|
* @see
|
|
371
371
|
* - [On-demand Rendering](https://docs.astro.build/en/guides/on-demand-rendering/)
|
|
372
372
|
* @description
|
|
373
|
-
* To use server islands, the same constraints exist as for
|
|
373
|
+
* To use server islands, the same constraints exist as for server-side rendering, so an adapter is needed.
|
|
374
374
|
*/
|
|
375
375
|
export declare const NoAdapterInstalledServerIslands: {
|
|
376
376
|
name: string;
|
|
@@ -400,7 +400,7 @@ export declare const NoMatchingImport: {
|
|
|
400
400
|
export declare const InvalidPrerenderExport: {
|
|
401
401
|
name: string;
|
|
402
402
|
title: string;
|
|
403
|
-
message(prefix: string, suffix: string,
|
|
403
|
+
message(prefix: string, suffix: string, isHybridOutput: boolean): string;
|
|
404
404
|
hint: string;
|
|
405
405
|
};
|
|
406
406
|
/**
|
|
@@ -648,7 +648,7 @@ export declare const ExpectedNotESMImage: {
|
|
|
648
648
|
* @docs
|
|
649
649
|
* @see
|
|
650
650
|
* - [Images](https://docs.astro.build/en/guides/images/)
|
|
651
|
-
* - [getImage()](https://docs.astro.build/en/reference/modules/astro-assets/#getimage)
|
|
651
|
+
* - [`getImage()`](https://docs.astro.build/en/reference/modules/astro-assets/#getimage)
|
|
652
652
|
* @description
|
|
653
653
|
* The `getImage()` function is only available on the server. To use images on the client, either render the `src` from `getImage()` during the server render so it can be used in client-side scripts, or use a standard `<img>` tag.
|
|
654
654
|
*
|
|
@@ -867,7 +867,7 @@ export declare const MiddlewareCantBeLoaded: {
|
|
|
867
867
|
* @see
|
|
868
868
|
* - [Images](https://docs.astro.build/en/guides/images/)
|
|
869
869
|
* @description
|
|
870
|
-
* When using the default image services, `Image`'s and `getImage`'s `src` parameter must be either an imported image or
|
|
870
|
+
* When using the default image services, `Image`'s and `getImage`'s `src` parameter must be either an imported image or a URL, it cannot be a string of a filepath.
|
|
871
871
|
*
|
|
872
872
|
* For local images from content collections, you can use the [image() schema helper](https://docs.astro.build/en/guides/images/#images-in-content-collections) to resolve the images.
|
|
873
873
|
*
|
|
@@ -923,7 +923,7 @@ export declare const AstroGlobNoMatch: {
|
|
|
923
923
|
/**
|
|
924
924
|
* @docs
|
|
925
925
|
* @see
|
|
926
|
-
* - [Astro.redirect](https://docs.astro.build/en/reference/api-reference/#redirect)
|
|
926
|
+
* - [`Astro.redirect()`](https://docs.astro.build/en/reference/api-reference/#redirect)
|
|
927
927
|
* @description
|
|
928
928
|
* A redirect must be given a location with the `Location` header.
|
|
929
929
|
*/
|
|
@@ -934,7 +934,7 @@ export declare const RedirectWithNoLocation: {
|
|
|
934
934
|
/**
|
|
935
935
|
* @docs
|
|
936
936
|
* @see
|
|
937
|
-
* - [Astro.redirect](https://docs.astro.build/en/reference/api-reference/#redirect)
|
|
937
|
+
* - [`Astro.redirect()`](https://docs.astro.build/en/reference/api-reference/#redirect)
|
|
938
938
|
* @description
|
|
939
939
|
* An external redirect must start with http or https, and must be a valid URL.
|
|
940
940
|
*/
|
|
@@ -1051,7 +1051,7 @@ export declare const FailedToFindPageMapSSR: {
|
|
|
1051
1051
|
/**
|
|
1052
1052
|
* @docs
|
|
1053
1053
|
* @description
|
|
1054
|
-
* Astro can't find the requested locale. All supported locales must be configured in [i18n.locales](/en/reference/configuration-reference/#i18nlocales) and have corresponding directories within `src/pages/`.
|
|
1054
|
+
* Astro can't find the requested locale. All supported locales must be configured in [`i18n.locales`](https://docs.astro.build/en/reference/configuration-reference/#i18nlocales) and have corresponding directories within `src/pages/`.
|
|
1055
1055
|
*/
|
|
1056
1056
|
export declare const MissingLocale: {
|
|
1057
1057
|
name: string;
|
|
@@ -1108,7 +1108,7 @@ export declare const MissingMiddlewareForInternationalization: {
|
|
|
1108
1108
|
/**
|
|
1109
1109
|
* @docs
|
|
1110
1110
|
* @description
|
|
1111
|
-
* An invalid i18n middleware configuration
|
|
1111
|
+
* An invalid i18n middleware configuration was detected.
|
|
1112
1112
|
*/
|
|
1113
1113
|
export declare const InvalidI18nMiddlewareConfiguration: {
|
|
1114
1114
|
name: string;
|
|
@@ -1165,7 +1165,7 @@ export declare const i18nNotEnabled: {
|
|
|
1165
1165
|
/**
|
|
1166
1166
|
* @docs
|
|
1167
1167
|
* @description
|
|
1168
|
-
* An i18n utility tried to use the locale from a URL path that does not contain one. You can prevent this error by using pathHasLocale to check URLs for a locale first before using i18n utilities.
|
|
1168
|
+
* An i18n utility tried to use the locale from a URL path that does not contain one. You can prevent this error by using `pathHasLocale` to check URLs for a locale first before using i18n utilities.
|
|
1169
1169
|
*
|
|
1170
1170
|
*/
|
|
1171
1171
|
export declare const i18nNoLocaleFoundInPath: {
|
|
@@ -1176,7 +1176,7 @@ export declare const i18nNoLocaleFoundInPath: {
|
|
|
1176
1176
|
/**
|
|
1177
1177
|
* @docs
|
|
1178
1178
|
* @description
|
|
1179
|
-
* Astro couldn't find a route matching the one provided by the user
|
|
1179
|
+
* Astro couldn't find a route matching the one provided by the user.
|
|
1180
1180
|
*/
|
|
1181
1181
|
export declare const RouteNotFound: {
|
|
1182
1182
|
name: string;
|
|
@@ -1291,7 +1291,7 @@ export declare const CannotDetermineWeightAndStyleFromFontFile: {
|
|
|
1291
1291
|
/**
|
|
1292
1292
|
* @docs
|
|
1293
1293
|
* @description
|
|
1294
|
-
* Cannot fetch the given font file
|
|
1294
|
+
* Cannot fetch the given font file.
|
|
1295
1295
|
* @message
|
|
1296
1296
|
* An error occurred while fetching font file from the given URL.
|
|
1297
1297
|
*/
|
|
@@ -1304,7 +1304,7 @@ export declare const CannotFetchFontFile: {
|
|
|
1304
1304
|
/**
|
|
1305
1305
|
* @docs
|
|
1306
1306
|
* @description
|
|
1307
|
-
* Font family not found
|
|
1307
|
+
* Font family not found.
|
|
1308
1308
|
* @message
|
|
1309
1309
|
* No data was found for the `cssVariable` passed to the `<Font />` component.
|
|
1310
1310
|
*/
|
|
@@ -1317,7 +1317,7 @@ export declare const FontFamilyNotFound: {
|
|
|
1317
1317
|
/**
|
|
1318
1318
|
* @docs
|
|
1319
1319
|
* @description
|
|
1320
|
-
* Font file URL not found
|
|
1320
|
+
* Font file URL not found.
|
|
1321
1321
|
* @message
|
|
1322
1322
|
* The URL passed to the `experimental_getFontFileURL()` function is invalid.
|
|
1323
1323
|
*/
|
|
@@ -1340,9 +1340,9 @@ export declare const MissingGetFontFileRequestUrl: {
|
|
|
1340
1340
|
/**
|
|
1341
1341
|
* @docs
|
|
1342
1342
|
* @description
|
|
1343
|
-
* Unavailable Astro global in getStaticPaths
|
|
1343
|
+
* Unavailable Astro global in `getStaticPaths()`.
|
|
1344
1344
|
* @message
|
|
1345
|
-
* The Astro global is not available in getStaticPaths()
|
|
1345
|
+
* The Astro global is not available in `getStaticPaths()`.
|
|
1346
1346
|
*/
|
|
1347
1347
|
export declare const UnavailableAstroGlobal: {
|
|
1348
1348
|
name: string;
|
|
@@ -1475,7 +1475,7 @@ export declare const UnknownConfigError: {
|
|
|
1475
1475
|
* @see
|
|
1476
1476
|
* - [--config](https://docs.astro.build/en/reference/cli-reference/#--config-path)
|
|
1477
1477
|
* @description
|
|
1478
|
-
* The specified configuration file using `--config` could not be found. Make sure that it exists or that the path is correct
|
|
1478
|
+
* The specified configuration file using `--config` could not be found. Make sure that it exists or that the path is correct.
|
|
1479
1479
|
*/
|
|
1480
1480
|
export declare const ConfigNotFound: {
|
|
1481
1481
|
name: string;
|
|
@@ -11,7 +11,7 @@ const ClientAddressNotAvailable = {
|
|
|
11
11
|
const PrerenderClientAddressNotAvailable = {
|
|
12
12
|
name: "PrerenderClientAddressNotAvailable",
|
|
13
13
|
title: "`Astro.clientAddress` cannot be used inside prerendered routes.",
|
|
14
|
-
message: (name) => `\`Astro.clientAddress\` cannot be used inside prerendered route ${name}
|
|
14
|
+
message: (name) => `\`Astro.clientAddress\` cannot be used inside prerendered route ${name}.`
|
|
15
15
|
};
|
|
16
16
|
const StaticClientAddressNotAvailable = {
|
|
17
17
|
name: "StaticClientAddressNotAvailable",
|
|
@@ -34,7 +34,7 @@ const OnlyResponseCanBeReturned = {
|
|
|
34
34
|
const MissingMediaQueryDirective = {
|
|
35
35
|
name: "MissingMediaQueryDirective",
|
|
36
36
|
title: "Missing value for `client:media` directive.",
|
|
37
|
-
message: 'Media query not provided for `client:media` directive. A media query similar to `client:media="(max-width: 600px)"` must be provided'
|
|
37
|
+
message: 'Media query not provided for `client:media` directive. A media query similar to `client:media="(max-width: 600px)"` must be provided.'
|
|
38
38
|
};
|
|
39
39
|
const NoMatchingRenderer = {
|
|
40
40
|
name: "NoMatchingRenderer",
|
|
@@ -57,42 +57,42 @@ const NoClientOnlyHint = {
|
|
|
57
57
|
name: "NoClientOnlyHint",
|
|
58
58
|
title: "Missing hint on client:only directive.",
|
|
59
59
|
message: (componentName) => `Unable to render \`${componentName}\`. When using the \`client:only\` hydration strategy, Astro needs a hint to use the correct renderer.`,
|
|
60
|
-
hint: (probableRenderers) => `Did you mean to pass \`client:only="${probableRenderers}"\`? See https://docs.astro.build/en/reference/directives-reference/#clientonly for more information on client:only
|
|
60
|
+
hint: (probableRenderers) => `Did you mean to pass \`client:only="${probableRenderers}"\`? See https://docs.astro.build/en/reference/directives-reference/#clientonly for more information on \`client:only\`.`
|
|
61
61
|
};
|
|
62
62
|
const InvalidGetStaticPathParam = {
|
|
63
63
|
name: "InvalidGetStaticPathParam",
|
|
64
|
-
title: "Invalid value returned by a `getStaticPaths
|
|
65
|
-
message: (paramType) => `Invalid params
|
|
66
|
-
hint: "See https://docs.astro.build/en/reference/routing-reference/#getstaticpaths for more information on getStaticPaths
|
|
64
|
+
title: "Invalid value returned by a route from `getStaticPaths()`.",
|
|
65
|
+
message: (paramType) => `Invalid \`params\` value returned by a route from \`getStaticPaths()\`. Expected an \`object\`, got \`${paramType}\`.`,
|
|
66
|
+
hint: "See https://docs.astro.build/en/reference/routing-reference/#getstaticpaths for more information on `getStaticPaths()`."
|
|
67
67
|
};
|
|
68
68
|
const InvalidGetStaticPathsEntry = {
|
|
69
69
|
name: "InvalidGetStaticPathsEntry",
|
|
70
|
-
title: "Invalid entry inside
|
|
71
|
-
message: (entryType) => `Invalid entry returned by getStaticPaths
|
|
72
|
-
hint: "If you're using a `.map` call, you might be looking for `.flatMap()` instead. See https://docs.astro.build/en/reference/routing-reference/#getstaticpaths for more information on getStaticPaths
|
|
70
|
+
title: "Invalid entry inside `getStaticPaths()`'s return value.",
|
|
71
|
+
message: (entryType) => `Invalid entry returned by \`getStaticPaths()\`. Expected an object, got \`${entryType}\`.`,
|
|
72
|
+
hint: "If you're using a `.map` call, you might be looking for `.flatMap()` instead. See https://docs.astro.build/en/reference/routing-reference/#getstaticpaths for more information on `getStaticPaths()`."
|
|
73
73
|
};
|
|
74
74
|
const InvalidGetStaticPathsReturn = {
|
|
75
75
|
name: "InvalidGetStaticPathsReturn",
|
|
76
|
-
title: "Invalid value returned by getStaticPaths
|
|
77
|
-
message: (returnType) => `Invalid type returned by \`getStaticPaths\`. Expected an \`array\`, got \`${returnType}
|
|
78
|
-
hint: "See https://docs.astro.build/en/reference/routing-reference/#getstaticpaths for more information on getStaticPaths
|
|
76
|
+
title: "Invalid value returned by `getStaticPaths()`.",
|
|
77
|
+
message: (returnType) => `Invalid type returned by \`getStaticPaths()\`. Expected an \`array\`, got \`${returnType}\`.`,
|
|
78
|
+
hint: "See https://docs.astro.build/en/reference/routing-reference/#getstaticpaths for more information on `getStaticPaths()`."
|
|
79
79
|
};
|
|
80
80
|
const GetStaticPathsExpectedParams = {
|
|
81
81
|
name: "GetStaticPathsExpectedParams",
|
|
82
|
-
title: "Missing params property on `getStaticPaths` route.",
|
|
83
|
-
message: "Missing or empty required `params` property on `getStaticPaths` route.",
|
|
84
|
-
hint: "See https://docs.astro.build/en/reference/routing-reference/#getstaticpaths for more information on getStaticPaths
|
|
82
|
+
title: "Missing params property on `getStaticPaths()` route.",
|
|
83
|
+
message: "Missing or empty required `params` property on `getStaticPaths()` route.",
|
|
84
|
+
hint: "See https://docs.astro.build/en/reference/routing-reference/#getstaticpaths for more information on `getStaticPaths()`."
|
|
85
85
|
};
|
|
86
86
|
const GetStaticPathsInvalidRouteParam = {
|
|
87
87
|
name: "GetStaticPathsInvalidRouteParam",
|
|
88
88
|
title: "Invalid route parameter returned by `getStaticPaths()`.",
|
|
89
|
-
message: (key, value, valueType) => `Invalid \`getStaticPaths()\` route parameter for \`${key}\`. Expected a string or undefined, received \`${valueType}\` (\`${value}\`)
|
|
90
|
-
hint: "See https://docs.astro.build/en/reference/routing-reference/#getstaticpaths for more information on getStaticPaths
|
|
89
|
+
message: (key, value, valueType) => `Invalid \`getStaticPaths()\` route parameter for \`${key}\`. Expected a string or undefined, received \`${valueType}\` (\`${value}\`).`,
|
|
90
|
+
hint: "See https://docs.astro.build/en/reference/routing-reference/#getstaticpaths for more information on `getStaticPaths()`."
|
|
91
91
|
};
|
|
92
92
|
const GetStaticPathsRequired = {
|
|
93
93
|
name: "GetStaticPathsRequired",
|
|
94
94
|
title: "`getStaticPaths()` function required for dynamic routes.",
|
|
95
|
-
message: "`getStaticPaths()` function is required for dynamic routes. Make sure that you `export` a `getStaticPaths` function from your dynamic route.",
|
|
95
|
+
message: "`getStaticPaths()` function is required for dynamic routes. Make sure that you `export` a `getStaticPaths()` function from your dynamic route.",
|
|
96
96
|
hint: `See https://docs.astro.build/en/guides/routing/#dynamic-routes for more information on dynamic routes.
|
|
97
97
|
|
|
98
98
|
If you meant for this route to be server-rendered, set \`export const prerender = false;\` in the page.`
|
|
@@ -104,7 +104,7 @@ const ReservedSlotName = {
|
|
|
104
104
|
};
|
|
105
105
|
const NoAdapterInstalled = {
|
|
106
106
|
name: "NoAdapterInstalled",
|
|
107
|
-
title: "Cannot use
|
|
107
|
+
title: "Cannot use server-side rendering without an adapter.",
|
|
108
108
|
message: `Cannot use server-rendered pages without an adapter. Please install and configure the appropriate server adapter for your final deployment.`,
|
|
109
109
|
hint: "See https://docs.astro.build/en/guides/on-demand-rendering/ for more information."
|
|
110
110
|
};
|
|
@@ -115,7 +115,7 @@ const AdapterSupportOutputMismatch = {
|
|
|
115
115
|
};
|
|
116
116
|
const NoAdapterInstalledServerIslands = {
|
|
117
117
|
name: "NoAdapterInstalledServerIslands",
|
|
118
|
-
title: "Cannot use
|
|
118
|
+
title: "Cannot use server islands without an adapter.",
|
|
119
119
|
message: `Cannot use server islands without an adapter. Please install and configure the appropriate server adapter for your final deployment.`,
|
|
120
120
|
hint: "See https://docs.astro.build/en/guides/on-demand-rendering/ for more information."
|
|
121
121
|
};
|
|
@@ -128,8 +128,8 @@ const NoMatchingImport = {
|
|
|
128
128
|
const InvalidPrerenderExport = {
|
|
129
129
|
name: "InvalidPrerenderExport",
|
|
130
130
|
title: "Invalid prerender export.",
|
|
131
|
-
message(prefix, suffix,
|
|
132
|
-
const defaultExpectedValue =
|
|
131
|
+
message(prefix, suffix, isHybridOutput) {
|
|
132
|
+
const defaultExpectedValue = isHybridOutput ? "false" : "true";
|
|
133
133
|
let msg = `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`;
|
|
134
134
|
if (prefix !== "const") msg += `
|
|
135
135
|
Expected \`const\` declaration but got \`${prefix}\`.`;
|
|
@@ -165,25 +165,25 @@ const InvalidImageService = {
|
|
|
165
165
|
};
|
|
166
166
|
const MissingImageDimension = {
|
|
167
167
|
name: "MissingImageDimension",
|
|
168
|
-
title: "Missing image dimensions",
|
|
168
|
+
title: "Missing image dimensions.",
|
|
169
169
|
message: (missingDimension, imageURL) => `Missing ${missingDimension === "both" ? "width and height attributes" : `${missingDimension} attribute`} for ${imageURL}. When using remote images, both dimensions are required in order to avoid CLS.`,
|
|
170
170
|
hint: "If your image is inside your `src` folder, you probably meant to import it instead. See [the Imports guide for more information](https://docs.astro.build/en/guides/imports/#other-assets). You can also use `inferSize={true}` for remote images to get the original dimensions."
|
|
171
171
|
};
|
|
172
172
|
const FailedToFetchRemoteImageDimensions = {
|
|
173
173
|
name: "FailedToFetchRemoteImageDimensions",
|
|
174
|
-
title: "Failed to retrieve remote image dimensions",
|
|
174
|
+
title: "Failed to retrieve remote image dimensions.",
|
|
175
175
|
message: (imageURL) => `Failed to get the dimensions for ${imageURL}.`,
|
|
176
176
|
hint: "Verify your remote image URL is accurate, and that you are not using `inferSize` with a file located in your `public/` folder."
|
|
177
177
|
};
|
|
178
178
|
const RemoteImageNotAllowed = {
|
|
179
179
|
name: "RemoteImageNotAllowed",
|
|
180
|
-
title: "Remote image is not allowed",
|
|
180
|
+
title: "Remote image is not allowed.",
|
|
181
181
|
message: (imageURL) => `Remote image ${imageURL} is not allowed by your image configuration.`,
|
|
182
182
|
hint: "Update `image.domains` or `image.remotePatterns`, or remove `inferSize` for this image."
|
|
183
183
|
};
|
|
184
184
|
const UnsupportedImageFormat = {
|
|
185
185
|
name: "UnsupportedImageFormat",
|
|
186
|
-
title: "Unsupported image format",
|
|
186
|
+
title: "Unsupported image format.",
|
|
187
187
|
message: (format, imagePath, supportedFormats) => `Received unsupported format \`${format}\` from \`${imagePath}\`. Currently only ${supportedFormats.join(
|
|
188
188
|
", "
|
|
189
189
|
)} are supported by our image services.`,
|
|
@@ -191,12 +191,12 @@ const UnsupportedImageFormat = {
|
|
|
191
191
|
};
|
|
192
192
|
const UnsupportedImageConversion = {
|
|
193
193
|
name: "UnsupportedImageConversion",
|
|
194
|
-
title: "Unsupported image conversion",
|
|
194
|
+
title: "Unsupported image conversion.",
|
|
195
195
|
message: "Converting between vector (such as SVGs) and raster (such as PNGs and JPEGs) images is not currently supported."
|
|
196
196
|
};
|
|
197
197
|
const CannotOptimizeSvg = {
|
|
198
198
|
name: "CannotOptimizeSvg",
|
|
199
|
-
title: "Cannot optimize SVG",
|
|
199
|
+
title: "Cannot optimize SVG.",
|
|
200
200
|
message: (path, name) => `An error occurred while optimizing SVG file "${path}" with the "${name}" optimizer.`,
|
|
201
201
|
hint: "Review the included error message provided for guidance."
|
|
202
202
|
};
|
|
@@ -223,7 +223,7 @@ Full serialized options received: \`${fullOptions}\`.`,
|
|
|
223
223
|
const ExpectedImageOptions = {
|
|
224
224
|
name: "ExpectedImageOptions",
|
|
225
225
|
title: "Expected image options.",
|
|
226
|
-
message: (options) => `Expected getImage() parameter to be an object. Received \`${options}\`.`
|
|
226
|
+
message: (options) => `Expected \`getImage()\` parameter to be an object. Received \`${options}\`.`
|
|
227
227
|
};
|
|
228
228
|
const ExpectedNotESMImage = {
|
|
229
229
|
name: "ExpectedNotESMImage",
|
|
@@ -235,11 +235,11 @@ const GetImageNotUsedOnServer = {
|
|
|
235
235
|
name: "GetImageNotUsedOnServer",
|
|
236
236
|
title: "`getImage()` must be used on the server.",
|
|
237
237
|
message: "`getImage()` should only be used on the server. To use images on the client, render the `src` from `getImage()` during the server render, then pass it to the client for usage.",
|
|
238
|
-
hint: "See https://docs.astro.build/en/reference/modules/astro-assets/#getimage for more information on getImage()
|
|
238
|
+
hint: "See https://docs.astro.build/en/reference/modules/astro-assets/#getimage for more information on `getImage()`."
|
|
239
239
|
};
|
|
240
240
|
const IncompatibleDescriptorOptions = {
|
|
241
241
|
name: "IncompatibleDescriptorOptions",
|
|
242
|
-
title: "Cannot set both `densities` and `widths
|
|
242
|
+
title: "Cannot set both `densities` and `widths`.",
|
|
243
243
|
message: "Only one of `densities` or `widths` can be specified. In most cases, you'll probably want to use only `widths` if you require specific widths.",
|
|
244
244
|
hint: "Those attributes are used to construct a `srcset` attribute, which cannot have both `x` and `w` descriptors."
|
|
245
245
|
};
|
|
@@ -307,8 +307,8 @@ const MiddlewareCantBeLoaded = {
|
|
|
307
307
|
const LocalImageUsedWrongly = {
|
|
308
308
|
name: "LocalImageUsedWrongly",
|
|
309
309
|
title: "Local images must be imported.",
|
|
310
|
-
message: (imageFilePath) => `\`Image\`'s and \`getImage\`'s \`src\` parameter must be an imported image or
|
|
311
|
-
hint: "If you want to use an image from your `src` folder, you need to either import it or if the image is coming from a content collection, use the [image() schema helper](https://docs.astro.build/en/guides/images/#images-in-content-collections). See https://docs.astro.build/en/
|
|
310
|
+
message: (imageFilePath) => `\`Image\`'s and \`getImage\`'s \`src\` parameter must be an imported image or a URL, it cannot be a string filepath. Received \`${imageFilePath}\`.`,
|
|
311
|
+
hint: "If you want to use an image from your `src` folder, you need to either import it or if the image is coming from a content collection, use the [image() schema helper](https://docs.astro.build/en/guides/images/#images-in-content-collections). See https://docs.astro.build/en/reference/modules/astro-assets/#src-required for more information on the `src` property."
|
|
312
312
|
};
|
|
313
313
|
const AstroGlobUsedOutside = {
|
|
314
314
|
name: "AstroGlobUsedOutside",
|
|
@@ -351,7 +351,7 @@ const MissingSharp = {
|
|
|
351
351
|
};
|
|
352
352
|
const UnknownViteError = {
|
|
353
353
|
name: "UnknownViteError",
|
|
354
|
-
title: "Unknown Vite
|
|
354
|
+
title: "Unknown Vite error."
|
|
355
355
|
};
|
|
356
356
|
const FailedToLoadModuleSSR = {
|
|
357
357
|
name: "FailedToLoadModuleSSR",
|
|
@@ -367,7 +367,7 @@ const InvalidGlob = {
|
|
|
367
367
|
};
|
|
368
368
|
const FailedToFindPageMapSSR = {
|
|
369
369
|
name: "FailedToFindPageMapSSR",
|
|
370
|
-
title: "Astro couldn't find the correct page to render",
|
|
370
|
+
title: "Astro couldn't find the correct page to render.",
|
|
371
371
|
message: "Astro couldn't find the correct page to render, probably because it wasn't correctly mapped for SSR usage. This is an internal error. Please file an issue."
|
|
372
372
|
};
|
|
373
373
|
const MissingLocale = {
|
|
@@ -383,13 +383,13 @@ const MissingIndexForInternationalization = {
|
|
|
383
383
|
};
|
|
384
384
|
const IncorrectStrategyForI18n = {
|
|
385
385
|
name: "IncorrectStrategyForI18n",
|
|
386
|
-
title: "
|
|
386
|
+
title: "Function incompatible with the current strategy.",
|
|
387
387
|
message: (functionName) => `The function \`${functionName}\` can only be used when the \`i18n.routing.strategy\` is set to \`"manual"\`.`
|
|
388
388
|
};
|
|
389
389
|
const NoPrerenderedRoutesWithDomains = {
|
|
390
390
|
name: "NoPrerenderedRoutesWithDomains",
|
|
391
391
|
title: "Prerendered routes aren't supported when internationalization domains are enabled.",
|
|
392
|
-
message: (component) => `Static pages aren't yet supported with multiple domains. To enable this feature, you must disable prerendering for the page ${component}
|
|
392
|
+
message: (component) => `Static pages aren't yet supported with multiple domains. To enable this feature, you must disable prerendering for the page ${component}.`
|
|
393
393
|
};
|
|
394
394
|
const MissingMiddlewareForInternationalization = {
|
|
395
395
|
name: "MissingMiddlewareForInternationalization",
|
|
@@ -398,31 +398,31 @@ const MissingMiddlewareForInternationalization = {
|
|
|
398
398
|
};
|
|
399
399
|
const InvalidI18nMiddlewareConfiguration = {
|
|
400
400
|
name: "InvalidI18nMiddlewareConfiguration",
|
|
401
|
-
title: "Invalid internationalization middleware configuration",
|
|
401
|
+
title: "Invalid internationalization middleware configuration.",
|
|
402
402
|
message: "The option `redirectToDefaultLocale` can be enabled only when `prefixDefaultLocale` is also set to `true`; otherwise, redirects might cause infinite loops. Enable the option `prefixDefaultLocale` to continue to use `redirectToDefaultLocale`, or ensure both are set to `false`."
|
|
403
403
|
};
|
|
404
404
|
const CantRenderPage = {
|
|
405
405
|
name: "CantRenderPage",
|
|
406
406
|
title: "Astro can't render the route.",
|
|
407
407
|
message: "Astro cannot find any content to render for this route. There is no file or redirect associated with this route.",
|
|
408
|
-
hint: "If you expect to find a route here, this may be an Astro bug. Please file an issue/restart the dev server"
|
|
408
|
+
hint: "If you expect to find a route here, this may be an Astro bug. Please file an issue/restart the dev server."
|
|
409
409
|
};
|
|
410
410
|
const UnhandledRejection = {
|
|
411
411
|
name: "UnhandledRejection",
|
|
412
|
-
title: "Unhandled rejection",
|
|
412
|
+
title: "Unhandled rejection.",
|
|
413
413
|
message: (stack) => `Astro detected an unhandled rejection. Here's the stack trace:
|
|
414
414
|
${stack}`,
|
|
415
415
|
hint: "Make sure your promises all have an `await` or a `.catch()` handler."
|
|
416
416
|
};
|
|
417
417
|
const i18nNotEnabled = {
|
|
418
418
|
name: "i18nNotEnabled",
|
|
419
|
-
title: "
|
|
420
|
-
message: "The `astro:i18n` module cannot be used without enabling i18n in your Astro config.",
|
|
419
|
+
title: "Internationalization routing is not enabled.",
|
|
420
|
+
message: "The `astro:i18n` module cannot be used without enabling `i18n` in your Astro config.",
|
|
421
421
|
hint: "See https://docs.astro.build/en/guides/internationalization for a guide on setting up i18n."
|
|
422
422
|
};
|
|
423
423
|
const i18nNoLocaleFoundInPath = {
|
|
424
424
|
name: "i18nNoLocaleFoundInPath",
|
|
425
|
-
title: "The path doesn't contain any locale",
|
|
425
|
+
title: "The path doesn't contain any locale.",
|
|
426
426
|
message: "You tried to use an i18n utility on a path that doesn't contain any locale. You can use `pathHasLocale` first to determine if the path has a locale."
|
|
427
427
|
};
|
|
428
428
|
const RouteNotFound = {
|
|
@@ -432,7 +432,7 @@ const RouteNotFound = {
|
|
|
432
432
|
};
|
|
433
433
|
const EnvInvalidVariables = {
|
|
434
434
|
name: "EnvInvalidVariables",
|
|
435
|
-
title: "Invalid
|
|
435
|
+
title: "Invalid environment variables.",
|
|
436
436
|
message: (errors) => `The following environment variables defined in \`env.schema\` are invalid:
|
|
437
437
|
|
|
438
438
|
${errors.map((err) => `- ${err}`).join("\n")}
|
|
@@ -440,7 +440,7 @@ ${errors.map((err) => `- ${err}`).join("\n")}
|
|
|
440
440
|
};
|
|
441
441
|
const EnvPrefixConflictsWithSecret = {
|
|
442
442
|
name: "EnvPrefixConflictsWithSecret",
|
|
443
|
-
title: "envPrefix conflicts with secret environment variables",
|
|
443
|
+
title: "`envPrefix` conflicts with secret environment variables.",
|
|
444
444
|
message: (conflicts) => `The following environment variables are declared with \`access: "secret"\` in \`env.schema\`, but their names match a prefix in \`vite.envPrefix\`, which would expose them in client-side bundles:
|
|
445
445
|
|
|
446
446
|
${conflicts.map((c) => `- ${c}`).join("\n")}
|
|
@@ -449,13 +449,13 @@ Either remove the conflicting prefixes from \`vite.envPrefix\`, or rename these
|
|
|
449
449
|
};
|
|
450
450
|
const ServerOnlyModule = {
|
|
451
451
|
name: "ServerOnlyModule",
|
|
452
|
-
title: "Module is only available server-side",
|
|
452
|
+
title: "Module is only available server-side.",
|
|
453
453
|
message: (name) => `The "${name}" module is only available server-side.`
|
|
454
454
|
};
|
|
455
455
|
const RewriteWithBodyUsed = {
|
|
456
456
|
name: "RewriteWithBodyUsed",
|
|
457
|
-
title: "Cannot use Astro.rewrite after the request body has been read",
|
|
458
|
-
message: "Astro.rewrite() cannot be used if the request body has already been read. If you need to read the body, first clone the request."
|
|
457
|
+
title: "Cannot use `Astro.rewrite()` after the request body has been read.",
|
|
458
|
+
message: "`Astro.rewrite()` cannot be used if the request body has already been read. If you need to read the body, first clone the request."
|
|
459
459
|
};
|
|
460
460
|
const ForbiddenRewrite = {
|
|
461
461
|
name: "ForbiddenRewrite",
|
|
@@ -465,7 +465,7 @@ const ForbiddenRewrite = {
|
|
|
465
465
|
The static route '${to}' is rendered by the component
|
|
466
466
|
'${component}', which is marked as prerendered. This is a forbidden operation because during the build, the component '${component}' is compiled to an
|
|
467
467
|
HTML file, which can't be retrieved at runtime by Astro.`,
|
|
468
|
-
hint: (component) => `Add \`export const prerender = false\` to the component '${component}', or use
|
|
468
|
+
hint: (component) => `Add \`export const prerender = false\` to the component '${component}', or use \`Astro.redirect()\`.`
|
|
469
469
|
};
|
|
470
470
|
const UnknownFilesystemError = {
|
|
471
471
|
name: "UnknownFilesystemError",
|
|
@@ -475,30 +475,30 @@ const UnknownFilesystemError = {
|
|
|
475
475
|
const CannotExtractFontType = {
|
|
476
476
|
name: "CannotExtractFontType",
|
|
477
477
|
title: "Cannot extract the font type from the given URL.",
|
|
478
|
-
message: (url) => `An error occurred while trying to extract the font type from ${url}
|
|
478
|
+
message: (url) => `An error occurred while trying to extract the font type from ${url}.`,
|
|
479
479
|
hint: "Open an issue at https://github.com/withastro/astro/issues."
|
|
480
480
|
};
|
|
481
481
|
const CannotDetermineWeightAndStyleFromFontFile = {
|
|
482
482
|
name: "CannotDetermineWeightAndStyleFromFontFile",
|
|
483
483
|
title: "Cannot determine weight and style from font file.",
|
|
484
|
-
message: (family, url) => `An error occurred while determining the \`weight\` and \`style\` from local family "${family}" font file: ${url}
|
|
484
|
+
message: (family, url) => `An error occurred while determining the \`weight\` and \`style\` from local family "${family}" font file: ${url}.`,
|
|
485
485
|
hint: "Update your family config and set `weight` and `style` manually instead."
|
|
486
486
|
};
|
|
487
487
|
const CannotFetchFontFile = {
|
|
488
488
|
name: "CannotFetchFontFile",
|
|
489
489
|
title: "Cannot fetch the given font file.",
|
|
490
|
-
message: (url) => `An error occurred while fetching the font file from ${url}
|
|
490
|
+
message: (url) => `An error occurred while fetching the font file from ${url}.`,
|
|
491
491
|
hint: "This is often caused by connectivity issues. If the error persists, open an issue at https://github.com/withastro/astro/issues."
|
|
492
492
|
};
|
|
493
493
|
const FontFamilyNotFound = {
|
|
494
494
|
name: "FontFamilyNotFound",
|
|
495
|
-
title: "Font family not found",
|
|
495
|
+
title: "Font family not found.",
|
|
496
496
|
message: (family) => `No data was found for the \`"${family}"\` family passed to the \`<Font>\` component.`,
|
|
497
497
|
hint: "This is often caused by a typo. Check that the `<Font />` component is using a `cssVariable` specified in your config."
|
|
498
498
|
};
|
|
499
499
|
const FontFileUrlNotFound = {
|
|
500
500
|
name: "FontFileUrlNotFound",
|
|
501
|
-
title: "Font file URL not found",
|
|
501
|
+
title: "Font file URL not found.",
|
|
502
502
|
message: (url) => `The \`"${url}"\` URL passed to the \`experimental_getFontFileURL()\` function is invalid.`,
|
|
503
503
|
hint: "Make sure you pass a valid URL, obtained via the `fontData` object."
|
|
504
504
|
};
|
|
@@ -509,8 +509,8 @@ const MissingGetFontFileRequestUrl = {
|
|
|
509
509
|
};
|
|
510
510
|
const UnavailableAstroGlobal = {
|
|
511
511
|
name: "UnavailableAstroGlobal",
|
|
512
|
-
title: "Unavailable Astro global in getStaticPaths()",
|
|
513
|
-
message: (name) => `The Astro global is not available in this scope. Please remove
|
|
512
|
+
title: "Unavailable Astro global in `getStaticPaths()`.",
|
|
513
|
+
message: (name) => `The Astro global is not available in this scope. Please remove \`Astro.${name}\` from your \`getStaticPaths()\` function.`
|
|
514
514
|
};
|
|
515
515
|
const UnableToLoadLogger = {
|
|
516
516
|
name: "UnableToLoadLogger",
|
|
@@ -519,19 +519,19 @@ const UnableToLoadLogger = {
|
|
|
519
519
|
};
|
|
520
520
|
const LoggerConfigurationNotSerializable = {
|
|
521
521
|
name: "LoggerConfigurationNotSerializable",
|
|
522
|
-
title: "The configuration of the logger is not serializable"
|
|
522
|
+
title: "The configuration of the logger is not serializable."
|
|
523
523
|
};
|
|
524
524
|
const UnknownCSSError = {
|
|
525
525
|
name: "UnknownCSSError",
|
|
526
|
-
title: "Unknown CSS
|
|
526
|
+
title: "Unknown CSS error."
|
|
527
527
|
};
|
|
528
528
|
const CSSSyntaxError = {
|
|
529
529
|
name: "CSSSyntaxError",
|
|
530
|
-
title: "CSS
|
|
530
|
+
title: "CSS syntax error."
|
|
531
531
|
};
|
|
532
532
|
const UnknownMarkdownError = {
|
|
533
533
|
name: "UnknownMarkdownError",
|
|
534
|
-
title: "Unknown Markdown
|
|
534
|
+
title: "Unknown Markdown error."
|
|
535
535
|
};
|
|
536
536
|
const MarkdownFrontmatterParseError = {
|
|
537
537
|
name: "MarkdownFrontmatterParseError",
|
|
@@ -566,22 +566,22 @@ const ConfigLegacyKey = {
|
|
|
566
566
|
};
|
|
567
567
|
const UnknownCLIError = {
|
|
568
568
|
name: "UnknownCLIError",
|
|
569
|
-
title: "Unknown CLI
|
|
569
|
+
title: "Unknown CLI error."
|
|
570
570
|
};
|
|
571
571
|
const GenerateContentTypesError = {
|
|
572
572
|
name: "GenerateContentTypesError",
|
|
573
573
|
title: "Failed to generate content types.",
|
|
574
|
-
message: (errorMessage) => `\`astro sync\` command failed to generate content collection types: ${errorMessage}
|
|
574
|
+
message: (errorMessage) => `\`astro sync\` command failed to generate content collection types: ${errorMessage}.`,
|
|
575
575
|
hint: (fileName) => `This error is often caused by a syntax error inside your content, or your content configuration file. Check your ${fileName ?? "content config"} file for typos.`
|
|
576
576
|
};
|
|
577
577
|
const UnknownContentCollectionError = {
|
|
578
578
|
name: "UnknownContentCollectionError",
|
|
579
|
-
title: "Unknown
|
|
579
|
+
title: "Unknown content collection error."
|
|
580
580
|
};
|
|
581
581
|
const RenderUndefinedEntryError = {
|
|
582
582
|
name: "RenderUndefinedEntryError",
|
|
583
583
|
title: "Attempted to render an undefined content collection entry.",
|
|
584
|
-
hint: "Check if the entry is undefined before passing it to `render()
|
|
584
|
+
hint: "Check if the entry is undefined before passing it to `render()`."
|
|
585
585
|
};
|
|
586
586
|
const GetEntryDeprecationError = {
|
|
587
587
|
name: "GetEntryDeprecationError",
|
|
@@ -665,7 +665,7 @@ const LiveContentConfigError = {
|
|
|
665
665
|
};
|
|
666
666
|
const ContentLoaderInvalidDataError = {
|
|
667
667
|
name: "ContentLoaderInvalidDataError",
|
|
668
|
-
title: "Content entry is missing an ID",
|
|
668
|
+
title: "Content entry is missing an ID.",
|
|
669
669
|
message(collection, extra) {
|
|
670
670
|
return `**${String(collection)}** entry is missing an ID.
|
|
671
671
|
${extra}`;
|
|
@@ -684,7 +684,7 @@ const InvalidContentEntrySlugError = {
|
|
|
684
684
|
};
|
|
685
685
|
const ContentSchemaContainsSlugError = {
|
|
686
686
|
name: "ContentSchemaContainsSlugError",
|
|
687
|
-
title: "Content
|
|
687
|
+
title: "Content schema should not contain `slug`.",
|
|
688
688
|
message: (collectionName) => `A content collection schema should not contain \`slug\` since it is reserved for slug generation. Remove this from your ${collectionName} collection schema.`,
|
|
689
689
|
hint: "See https://docs.astro.build/en/guides/content-collections/ for more on the `slug` field."
|
|
690
690
|
};
|
|
@@ -727,19 +727,19 @@ Full error: ${parseError}`,
|
|
|
727
727
|
};
|
|
728
728
|
const FileParserNotFound = {
|
|
729
729
|
name: "FileParserNotFound",
|
|
730
|
-
title: "File parser not found",
|
|
730
|
+
title: "File parser not found.",
|
|
731
731
|
message: (fileName) => `No parser was found for '${fileName}'. Pass a parser function (e.g. \`parser: csv\`) to the \`file\` loader.`
|
|
732
732
|
};
|
|
733
733
|
const FileGlobNotSupported = {
|
|
734
734
|
name: "FileGlobNotSupported",
|
|
735
|
-
title: "Glob patterns are not supported in the file loader",
|
|
735
|
+
title: "Glob patterns are not supported in the file loader.",
|
|
736
736
|
message: "Glob patterns are not supported in the `file` loader. Use the `glob` loader instead.",
|
|
737
737
|
hint: `See Astro's file loader https://docs.astro.build/en/reference/content-loader-reference/#file-loader for supported usage.`
|
|
738
738
|
};
|
|
739
739
|
const ActionsWithoutServerOutputError = {
|
|
740
740
|
name: "ActionsWithoutServerOutputError",
|
|
741
741
|
title: "Actions must be used with server output.",
|
|
742
|
-
message: "A server is required to create callable backend functions. To deploy routes to a server, add an adapter to your Astro config and configure your route for on-demand rendering",
|
|
742
|
+
message: "A server is required to create callable backend functions. To deploy routes to a server, add an adapter to your Astro config and configure your route for on-demand rendering.",
|
|
743
743
|
hint: "Add an adapter and enable on-demand rendering: https://docs.astro.build/en/guides/on-demand-rendering/"
|
|
744
744
|
};
|
|
745
745
|
const ActionsReturnedInvalidDataError = {
|
|
@@ -756,8 +756,8 @@ const ActionNotFoundError = {
|
|
|
756
756
|
};
|
|
757
757
|
const ActionCalledFromServerError = {
|
|
758
758
|
name: "ActionCalledFromServerError",
|
|
759
|
-
title: "Action
|
|
760
|
-
message: "Action called from a server page or endpoint without using `Astro.callAction()`. This wrapper must be used to call actions from server code.",
|
|
759
|
+
title: "Action called from the server without `Astro.callAction()`.",
|
|
760
|
+
message: "Action called from a server-rendered page or endpoint without using `Astro.callAction()`. This wrapper must be used to call actions from server code.",
|
|
761
761
|
hint: "See the `Astro.callAction()` reference for usage examples: https://docs.astro.build/en/reference/api-reference/#callaction"
|
|
762
762
|
};
|
|
763
763
|
const UnknownError = { name: "UnknownError", title: "Unknown Error." };
|
|
@@ -13,6 +13,7 @@ interface CallGetStaticPathsOptions {
|
|
|
13
13
|
}
|
|
14
14
|
export declare function callGetStaticPaths({ mod, route, routeCache, ssr, base, trailingSlash, }: CallGetStaticPathsOptions): Promise<GetStaticPathsResultKeyed>;
|
|
15
15
|
interface RouteCacheEntry {
|
|
16
|
+
mod?: ComponentInstance;
|
|
16
17
|
staticPaths: GetStaticPathsResultKeyed;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
@@ -13,7 +13,7 @@ async function callGetStaticPaths({
|
|
|
13
13
|
if (!mod) {
|
|
14
14
|
throw new Error("This is an error caused by Astro and not your code. Please file an issue.");
|
|
15
15
|
}
|
|
16
|
-
if (cached?.staticPaths) {
|
|
16
|
+
if (cached?.staticPaths && cached.mod === mod) {
|
|
17
17
|
return cached.staticPaths;
|
|
18
18
|
}
|
|
19
19
|
validateDynamicRouteModule(mod, { ssr, route });
|
|
@@ -39,7 +39,7 @@ async function callGetStaticPaths({
|
|
|
39
39
|
const paramsKey = stringifyParams(sp.params, route, trailingSlash);
|
|
40
40
|
keyedStaticPaths.keyed.set(paramsKey, sp);
|
|
41
41
|
}
|
|
42
|
-
routeCache.set(route, { ...cached, staticPaths: keyedStaticPaths });
|
|
42
|
+
routeCache.set(route, { ...cached, mod, staticPaths: keyedStaticPaths });
|
|
43
43
|
return keyedStaticPaths;
|
|
44
44
|
}
|
|
45
45
|
class RouteCache {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRunnableDevEnvironment } from "vite";
|
|
1
2
|
import { VIRTUAL_PAGE_RESOLVED_MODULE_ID } from "../vite-plugin-pages/const.js";
|
|
2
3
|
import { getDevCssModuleNameFromPageVirtualModuleName } from "../vite-plugin-css/util.js";
|
|
3
4
|
import { isAstroServerEnvironment } from "../environments.js";
|
|
@@ -16,7 +17,7 @@ function hmrReload() {
|
|
|
16
17
|
enforce: "post",
|
|
17
18
|
hotUpdate: {
|
|
18
19
|
order: "post",
|
|
19
|
-
handler({ modules, server, timestamp }) {
|
|
20
|
+
handler({ modules, server, timestamp, file }) {
|
|
20
21
|
if (!isAstroServerEnvironment(this.environment)) return;
|
|
21
22
|
let hasSsrOnlyModules = false;
|
|
22
23
|
let hasSkippedStyleModules = false;
|
|
@@ -42,7 +43,25 @@ function hmrReload() {
|
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
if (hasSsrOnlyModules) {
|
|
46
|
+
if (isRunnableDevEnvironment(this.environment)) {
|
|
47
|
+
for (const invalidated of invalidatedModules) {
|
|
48
|
+
if (invalidated.id == null) continue;
|
|
49
|
+
const runnerModule = this.environment.runner.evaluatedModules.getModuleById(
|
|
50
|
+
invalidated.id
|
|
51
|
+
);
|
|
52
|
+
if (runnerModule) {
|
|
53
|
+
this.environment.runner.evaluatedModules.invalidateModule(runnerModule);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
45
57
|
server.ws.send({ type: "full-reload" });
|
|
58
|
+
if (!isRunnableDevEnvironment(this.environment)) {
|
|
59
|
+
this.environment.hot.send({
|
|
60
|
+
type: "full-reload",
|
|
61
|
+
triggeredBy: file,
|
|
62
|
+
path: "*"
|
|
63
|
+
});
|
|
64
|
+
}
|
|
46
65
|
return [];
|
|
47
66
|
}
|
|
48
67
|
if (hasSkippedStyleModules) {
|