astro 4.5.13 → 4.5.14

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.
@@ -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",
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.5.13";
1
+ const ASTRO_VERSION = "4.5.14";
2
2
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
3
3
  const ROUTE_TYPE_HEADER = "X-Astro-Route-Type";
4
4
  const DEFAULT_404_COMPONENT = "astro-default-404";
@@ -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.13";
26
+ const currentVersion = "4.5.14";
27
27
  if (currentVersion.includes("-")) {
28
28
  logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
29
29
  }
@@ -36,7 +36,7 @@ function serverStart({
36
36
  host,
37
37
  base
38
38
  }) {
39
- const version = "4.5.13";
39
+ const version = "4.5.14";
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.13"}`
264
+ `v${"4.5.14"}`
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 && !_props["client:only"]) {
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 passedName = metadata.hydrateArgs;
126
- const rendererName = rendererAliases.has(passedName) ? rendererAliases.get(passedName) : passedName;
127
- renderer = renderers.find(
128
- ({ name }) => name === `@astrojs/${rendererName}` || name === rendererName
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
- throw new AstroError({
145
- ...AstroErrorData.NoClientOnlyHint,
146
- message: AstroErrorData.NoClientOnlyHint.message(metadata.displayName),
147
- hint: AstroErrorData.NoClientOnlyHint.hint(
148
- probableRendererNames.map((r) => r.replace("@astrojs/", "")).join("|")
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.5.13",
3
+ "version": "4.5.14",
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",