astro 4.5.13 → 4.5.15
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/services/sharp.js +1 -0
- package/dist/assets/types.d.ts +22 -22
- package/dist/cli/add/index.js +1 -3
- package/dist/core/app/node.js +3 -2
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/runtime/server/render/component.js +38 -13
- package/package.json +1 -1
package/dist/assets/types.d.ts
CHANGED
|
@@ -104,6 +104,28 @@ type ImageSharedProps<T> = T & {
|
|
|
104
104
|
* ```
|
|
105
105
|
*/
|
|
106
106
|
height?: number | `${number}`;
|
|
107
|
+
/**
|
|
108
|
+
* Desired output format for the image. Defaults to `webp`.
|
|
109
|
+
*
|
|
110
|
+
* **Example**:
|
|
111
|
+
* ```astro
|
|
112
|
+
* <Image src={...} format="avif" alt="..." />
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
format?: ImageOutputFormat;
|
|
116
|
+
/**
|
|
117
|
+
* Desired quality for the image. Value can either be a preset such as `low` or `high`, or a numeric value from 0 to 100.
|
|
118
|
+
*
|
|
119
|
+
* The perceptual quality of the output image is service-specific.
|
|
120
|
+
* For instance, a certain service might decide that `high` results in a very beautiful image, but another could choose for it to be at best passable.
|
|
121
|
+
*
|
|
122
|
+
* **Example**:
|
|
123
|
+
* ```astro
|
|
124
|
+
* <Image src={...} quality='high' alt="..." />
|
|
125
|
+
* <Image src={...} quality={300} alt="..." />
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
quality?: ImageQuality;
|
|
107
129
|
} & ({
|
|
108
130
|
/**
|
|
109
131
|
* A list of widths to generate images for. The value of this property will be used to assign the `srcset` property on the final `img` element.
|
|
@@ -137,28 +159,6 @@ export type LocalImageProps<T> = ImageSharedProps<T> & {
|
|
|
137
159
|
src: ImageMetadata | Promise<{
|
|
138
160
|
default: ImageMetadata;
|
|
139
161
|
}>;
|
|
140
|
-
/**
|
|
141
|
-
* Desired output format for the image. Defaults to `webp`.
|
|
142
|
-
*
|
|
143
|
-
* **Example**:
|
|
144
|
-
* ```astro
|
|
145
|
-
* <Image src={...} format="avif" alt="..." />
|
|
146
|
-
* ```
|
|
147
|
-
*/
|
|
148
|
-
format?: ImageOutputFormat;
|
|
149
|
-
/**
|
|
150
|
-
* Desired quality for the image. Value can either be a preset such as `low` or `high`, or a numeric value from 0 to 100.
|
|
151
|
-
*
|
|
152
|
-
* The perceptual quality of the output image is service-specific.
|
|
153
|
-
* For instance, a certain service might decide that `high` results in a very beautiful image, but another could choose for it to be at best passable.
|
|
154
|
-
*
|
|
155
|
-
* **Example**:
|
|
156
|
-
* ```astro
|
|
157
|
-
* <Image src={...} quality='high' alt="..." />
|
|
158
|
-
* <Image src={...} quality={300} alt="..." />
|
|
159
|
-
* ```
|
|
160
|
-
*/
|
|
161
|
-
quality?: ImageQuality;
|
|
162
162
|
};
|
|
163
163
|
export type RemoteImageProps<T> = (ImageSharedProps<T> & {
|
|
164
164
|
/**
|
package/dist/cli/add/index.js
CHANGED
|
@@ -728,9 +728,7 @@ async function validateIntegrations(integrations) {
|
|
|
728
728
|
if (firstPartyPkgCheck.message) {
|
|
729
729
|
spinner.warn(yellow(firstPartyPkgCheck.message));
|
|
730
730
|
}
|
|
731
|
-
spinner.warn(
|
|
732
|
-
yellow(`${bold(integration)} is not an official Astro package. Use at your own risk!`)
|
|
733
|
-
);
|
|
731
|
+
spinner.warn(yellow(`${bold(integration)} is not an official Astro package.`));
|
|
734
732
|
const response = await prompts({
|
|
735
733
|
type: "confirm",
|
|
736
734
|
name: "askToContinue",
|
package/dist/core/app/node.js
CHANGED
|
@@ -34,8 +34,9 @@ class NodeApp extends App {
|
|
|
34
34
|
*/
|
|
35
35
|
static createRequest(req, { skipBody = false } = {}) {
|
|
36
36
|
const protocol = req.headers["x-forwarded-proto"] ?? ("encrypted" in req.socket && req.socket.encrypted ? "https" : "http");
|
|
37
|
-
const hostname = req.headers.host
|
|
38
|
-
const
|
|
37
|
+
const hostname = req.headers["x-forwarded-host"] ?? req.headers.host ?? req.headers[":authority"];
|
|
38
|
+
const port = req.headers["x-forwarded-port"];
|
|
39
|
+
const url = `${protocol}://${hostname}${port ? `:${port}` : ""}${req.url}`;
|
|
39
40
|
const options = {
|
|
40
41
|
method: req.method || "GET",
|
|
41
42
|
headers: makeRequestHeaders(req)
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
|
|
|
23
23
|
base: restart.container.settings.config.base
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
|
-
const currentVersion = "4.5.
|
|
26
|
+
const currentVersion = "4.5.15";
|
|
27
27
|
if (currentVersion.includes("-")) {
|
|
28
28
|
logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
|
|
29
29
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -36,7 +36,7 @@ function serverStart({
|
|
|
36
36
|
host,
|
|
37
37
|
base
|
|
38
38
|
}) {
|
|
39
|
-
const version = "4.5.
|
|
39
|
+
const version = "4.5.15";
|
|
40
40
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
41
41
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
42
42
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -261,7 +261,7 @@ function printHelp({
|
|
|
261
261
|
message.push(
|
|
262
262
|
linebreak(),
|
|
263
263
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
264
|
-
`v${"4.5.
|
|
264
|
+
`v${"4.5.15"}`
|
|
265
265
|
)} ${headline}`
|
|
266
266
|
);
|
|
267
267
|
}
|
|
@@ -20,6 +20,7 @@ import { renderSlotToString, renderSlots } from "./slot.js";
|
|
|
20
20
|
import { formatList, internalSpreadAttributes, renderElement, voidElementNames } from "./util.js";
|
|
21
21
|
const needsHeadRenderingSymbol = Symbol.for("astro.needsHeadRendering");
|
|
22
22
|
const rendererAliases = /* @__PURE__ */ new Map([["solid", "solid-js"]]);
|
|
23
|
+
const clientOnlyValues = /* @__PURE__ */ new Set(["solid-js", "react", "preact", "vue", "svelte", "lit"]);
|
|
23
24
|
function guessRenderers(componentUrl) {
|
|
24
25
|
const extname = componentUrl?.split(".").pop();
|
|
25
26
|
switch (extname) {
|
|
@@ -54,7 +55,7 @@ function removeStaticAstroSlot(html, supportsAstroStaticSlot = true) {
|
|
|
54
55
|
return html.replace(exp, "");
|
|
55
56
|
}
|
|
56
57
|
async function renderFrameworkComponent(result, displayName, Component, _props, slots = {}) {
|
|
57
|
-
if (!Component &&
|
|
58
|
+
if (!Component && "client:only" in _props === false) {
|
|
58
59
|
throw new Error(
|
|
59
60
|
`Unable to render ${displayName} because it is ${Component}!
|
|
60
61
|
Did you forget to import the component or is it possible there is a typo?`
|
|
@@ -122,11 +123,12 @@ Did you forget to import the component or is it possible there is a typo?`
|
|
|
122
123
|
}
|
|
123
124
|
} else {
|
|
124
125
|
if (metadata.hydrateArgs) {
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
const rendererName = rendererAliases.has(metadata.hydrateArgs) ? rendererAliases.get(metadata.hydrateArgs) : metadata.hydrateArgs;
|
|
127
|
+
if (clientOnlyValues.has(rendererName)) {
|
|
128
|
+
renderer = renderers.find(
|
|
129
|
+
({ name }) => name === `@astrojs/${rendererName}` || name === rendererName
|
|
130
|
+
);
|
|
131
|
+
}
|
|
130
132
|
}
|
|
131
133
|
if (!renderer && validRenderers.length === 1) {
|
|
132
134
|
renderer = validRenderers[0];
|
|
@@ -141,13 +143,30 @@ Did you forget to import the component or is it possible there is a typo?`
|
|
|
141
143
|
let componentServerRenderEndTime;
|
|
142
144
|
if (!renderer) {
|
|
143
145
|
if (metadata.hydrate === "only") {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
const rendererName = rendererAliases.has(metadata.hydrateArgs) ? rendererAliases.get(metadata.hydrateArgs) : metadata.hydrateArgs;
|
|
147
|
+
if (clientOnlyValues.has(rendererName)) {
|
|
148
|
+
const plural = validRenderers.length > 1;
|
|
149
|
+
throw new AstroError({
|
|
150
|
+
...AstroErrorData.NoMatchingRenderer,
|
|
151
|
+
message: AstroErrorData.NoMatchingRenderer.message(
|
|
152
|
+
metadata.displayName,
|
|
153
|
+
metadata?.componentUrl?.split(".").pop(),
|
|
154
|
+
plural,
|
|
155
|
+
validRenderers.length
|
|
156
|
+
),
|
|
157
|
+
hint: AstroErrorData.NoMatchingRenderer.hint(
|
|
158
|
+
formatList(probableRendererNames.map((r) => "`" + r + "`"))
|
|
159
|
+
)
|
|
160
|
+
});
|
|
161
|
+
} else {
|
|
162
|
+
throw new AstroError({
|
|
163
|
+
...AstroErrorData.NoClientOnlyHint,
|
|
164
|
+
message: AstroErrorData.NoClientOnlyHint.message(metadata.displayName),
|
|
165
|
+
hint: AstroErrorData.NoClientOnlyHint.hint(
|
|
166
|
+
probableRendererNames.map((r) => r.replace("@astrojs/", "")).join("|")
|
|
167
|
+
)
|
|
168
|
+
});
|
|
169
|
+
}
|
|
151
170
|
} else if (typeof Component !== "string") {
|
|
152
171
|
const matchingRenderers = validRenderers.filter(
|
|
153
172
|
(r) => probableRendererNames.includes(r.name)
|
|
@@ -191,6 +210,12 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
|
|
|
191
210
|
}
|
|
192
211
|
} else {
|
|
193
212
|
if (metadata.hydrate === "only") {
|
|
213
|
+
const rendererName = rendererAliases.has(metadata.hydrateArgs) ? rendererAliases.get(metadata.hydrateArgs) : metadata.hydrateArgs;
|
|
214
|
+
if (!clientOnlyValues.has(rendererName)) {
|
|
215
|
+
console.warn(
|
|
216
|
+
`The client:only directive for ${metadata.displayName} is not recognized. The renderer ${renderer.name} will be used. If you intended to use a different renderer, please provide a valid client:only directive.`
|
|
217
|
+
);
|
|
218
|
+
}
|
|
194
219
|
html = await renderSlotToString(result, slots?.fallback);
|
|
195
220
|
} else {
|
|
196
221
|
const componentRenderStartTime = performance.now();
|