astro 4.11.4 → 4.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.11.4";
1
+ const ASTRO_VERSION = "4.11.5";
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.astro";
@@ -19,7 +19,7 @@ async function dev(inlineConfig) {
19
19
  await telemetry.record([]);
20
20
  const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
21
21
  const logger = restart.container.logger;
22
- const currentVersion = "4.11.4";
22
+ const currentVersion = "4.11.5";
23
23
  const isPrerelease = currentVersion.includes("-");
24
24
  if (!isPrerelease) {
25
25
  try {
@@ -37,7 +37,7 @@ function serverStart({
37
37
  host,
38
38
  base
39
39
  }) {
40
- const version = "4.11.4";
40
+ const version = "4.11.5";
41
41
  const localPrefix = `${dim("\u2503")} Local `;
42
42
  const networkPrefix = `${dim("\u2503")} Network `;
43
43
  const emptyPrefix = " ".repeat(11);
@@ -269,7 +269,7 @@ function printHelp({
269
269
  message.push(
270
270
  linebreak(),
271
271
  ` ${bgGreen(black(` ${commandName} `))} ${green(
272
- `v${"4.11.4"}`
272
+ `v${"4.11.5"}`
273
273
  )} ${headline}`
274
274
  );
275
275
  }
@@ -2,6 +2,8 @@ import { clsx } from "clsx";
2
2
  import { HTMLString, markHTMLString } from "../escape.js";
3
3
  const voidElementNames = /^(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/i;
4
4
  const htmlBooleanAttributes = /^(?:allowfullscreen|async|autofocus|autoplay|controls|default|defer|disabled|disablepictureinpicture|disableremoteplayback|formnovalidate|hidden|loop|nomodule|novalidate|open|playsinline|readonly|required|reversed|scoped|seamless|itemscope)$/i;
5
+ const htmlEnumAttributes = /^(?:contenteditable|draggable|spellcheck|value)$/i;
6
+ const svgEnumAttributes = /^(?:autoReverse|externalResourcesRequired|focusable|preserveAlpha)$/i;
5
7
  const AMPERSAND_REGEX = /&/g;
6
8
  const DOUBLE_QUOTE_REGEX = /"/g;
7
9
  const STATIC_DIRECTIVES = /* @__PURE__ */ new Set(["set:html", "set:text"]);
@@ -36,6 +38,12 @@ function addAttribute(value, key, shouldEscape = true) {
36
38
  if (value == null) {
37
39
  return "";
38
40
  }
41
+ if (value === false) {
42
+ if (htmlEnumAttributes.test(key) || svgEnumAttributes.test(key)) {
43
+ return markHTMLString(` ${key}="false"`);
44
+ }
45
+ return "";
46
+ }
39
47
  if (STATIC_DIRECTIVES.has(key)) {
40
48
  console.warn(`[astro] The "${key}" directive cannot be applied dynamically at runtime. It will not be rendered as an attribute.
41
49
 
@@ -65,13 +73,11 @@ Make sure to use the static attribute syntax (\`${key}={value}\`) instead of the
65
73
  if (typeof value === "string" && value.includes("&") && isHttpUrl(value)) {
66
74
  return markHTMLString(` ${key}="${toAttributeString(value, false)}"`);
67
75
  }
68
- if (htmlBooleanAttributes.test(key)) {
69
- return markHTMLString(value ? ` ${key}` : "");
70
- }
71
- if (value === "") {
76
+ if (value === true && (key.startsWith("data-") || htmlBooleanAttributes.test(key))) {
72
77
  return markHTMLString(` ${key}`);
78
+ } else {
79
+ return markHTMLString(` ${key}="${toAttributeString(value, shouldEscape)}"`);
73
80
  }
74
- return markHTMLString(` ${key}="${toAttributeString(value, shouldEscape)}"`);
75
81
  }
76
82
  function internalSpreadAttributes(values, shouldEscape = true) {
77
83
  let output = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.11.4",
3
+ "version": "4.11.5",
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",
@@ -168,8 +168,8 @@
168
168
  "yargs-parser": "^21.1.1",
169
169
  "zod": "^3.23.8",
170
170
  "zod-to-json-schema": "^3.23.1",
171
- "@astrojs/internal-helpers": "0.4.1",
172
171
  "@astrojs/markdown-remark": "5.1.1",
172
+ "@astrojs/internal-helpers": "0.4.1",
173
173
  "@astrojs/telemetry": "3.1.0"
174
174
  },
175
175
  "optionalDependencies": {