astro 4.3.6 → 4.3.7

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.3.6";
1
+ const ASTRO_VERSION = "4.3.7";
2
2
  const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
3
3
  ".markdown",
4
4
  ".mdown",
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
23
23
  base: restart.container.settings.config.base
24
24
  })
25
25
  );
26
- const currentVersion = "4.3.6";
26
+ const currentVersion = "4.3.7";
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.3.6";
39
+ const version = "4.3.7";
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.3.6"}`
264
+ `v${"4.3.7"}`
265
265
  )} ${headline}`
266
266
  );
267
267
  }
@@ -24,6 +24,7 @@
24
24
  */
25
25
  import { aria, roles } from "aria-query";
26
26
  import { AXObjectRoles, elementAXObjects } from "axobject-query";
27
+ const WHITESPACE_REGEX = /\s+/;
27
28
  const a11y_required_attributes = {
28
29
  a: ["href"],
29
30
  area: ["alt", "aria-label", "aria-labelledby"],
@@ -450,13 +451,16 @@ const a11y = [
450
451
  if (is_semantic_role_element(role, element.localName, getAttributeObject(element))) {
451
452
  return;
452
453
  }
453
- const { requiredProps } = roles.get(role);
454
- const required_role_props = Object.keys(requiredProps);
455
- const missingProps = required_role_props.filter((prop) => !element.hasAttribute(prop));
456
- if (missingProps.length > 0) {
457
- element.__astro_role = role;
458
- element.__astro_missing_attributes = missingProps;
459
- return true;
454
+ const elementRoles = role.split(WHITESPACE_REGEX);
455
+ for (const elementRole of elementRoles) {
456
+ const { requiredProps } = roles.get(elementRole);
457
+ const required_role_props = Object.keys(requiredProps);
458
+ const missingProps = required_role_props.filter((prop) => !element.hasAttribute(prop));
459
+ if (missingProps.length > 0) {
460
+ element.__astro_role = elementRole;
461
+ element.__astro_missing_attributes = missingProps;
462
+ return true;
463
+ }
460
464
  }
461
465
  }
462
466
  },
@@ -474,16 +478,19 @@ const a11y = [
474
478
  const role = getRole(element);
475
479
  if (!role)
476
480
  return false;
477
- const { props } = roles.get(role);
478
- const attributes = getAttributeObject(element);
479
- const unsupportedAttributes = aria.keys().filter((attribute) => !(attribute in props));
480
- const invalidAttributes = Object.keys(attributes).filter(
481
- (key) => key.startsWith("aria-") && unsupportedAttributes.includes(key)
482
- );
483
- if (invalidAttributes.length > 0) {
484
- element.__astro_role = role;
485
- element.__astro_unsupported_attributes = invalidAttributes;
486
- return true;
481
+ const elementRoles = role.split(WHITESPACE_REGEX);
482
+ for (const elementRole of elementRoles) {
483
+ const { props } = roles.get(elementRole);
484
+ const attributes = getAttributeObject(element);
485
+ const unsupportedAttributes = aria.keys().filter((attribute) => !(attribute in props));
486
+ const invalidAttributes = Object.keys(attributes).filter(
487
+ (key) => key.startsWith("aria-") && unsupportedAttributes.includes(key)
488
+ );
489
+ if (invalidAttributes.length > 0) {
490
+ element.__astro_role = elementRole;
491
+ element.__astro_unsupported_attributes = invalidAttributes;
492
+ return true;
493
+ }
487
494
  }
488
495
  }
489
496
  },
@@ -59,36 +59,43 @@
59
59
  }
60
60
  this.start();
61
61
  }
62
- start() {
62
+ async start() {
63
63
  const opts = JSON.parse(this.getAttribute("opts"));
64
64
  const directive = this.getAttribute("client");
65
65
  if (Astro[directive] === void 0) {
66
66
  window.addEventListener(`astro:${directive}`, () => this.start(), { once: true });
67
67
  return;
68
68
  }
69
- Astro[directive](
70
- async () => {
71
- const rendererUrl = this.getAttribute("renderer-url");
72
- const [componentModule, { default: hydrator }] = await Promise.all([
73
- import(this.getAttribute("component-url")),
74
- rendererUrl ? import(rendererUrl) : () => () => {
75
- }
76
- ]);
77
- const componentExport = this.getAttribute("component-export") || "default";
78
- if (!componentExport.includes(".")) {
79
- this.Component = componentModule[componentExport];
80
- } else {
81
- this.Component = componentModule;
82
- for (const part of componentExport.split(".")) {
83
- this.Component = this.Component[part];
69
+ try {
70
+ await Astro[directive](
71
+ async () => {
72
+ const rendererUrl = this.getAttribute("renderer-url");
73
+ const [componentModule, { default: hydrator }] = await Promise.all([
74
+ import(this.getAttribute("component-url")),
75
+ rendererUrl ? import(rendererUrl) : () => () => {
76
+ }
77
+ ]);
78
+ const componentExport = this.getAttribute("component-export") || "default";
79
+ if (!componentExport.includes(".")) {
80
+ this.Component = componentModule[componentExport];
81
+ } else {
82
+ this.Component = componentModule;
83
+ for (const part of componentExport.split(".")) {
84
+ this.Component = this.Component[part];
85
+ }
84
86
  }
85
- }
86
- this.hydrator = hydrator;
87
- return this.hydrate;
88
- },
89
- opts,
90
- this
91
- );
87
+ this.hydrator = hydrator;
88
+ return this.hydrate;
89
+ },
90
+ opts,
91
+ this
92
+ );
93
+ } catch (e) {
94
+ console.error(
95
+ `[astro-island] Error hydrating ${this.getAttribute("component-url")}`,
96
+ e
97
+ );
98
+ }
92
99
  }
93
100
  hydrate = async () => {
94
101
  if (!this.hydrator)
@@ -3,5 +3,5 @@
3
3
  * Do not edit this directly, but instead edit that file and rerun the prebuild
4
4
  * to generate this file.
5
5
  */
6
- declare const _default: "(()=>{var b=Object.defineProperty;var f=(c,o,i)=>o in c?b(c,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[o]=i;var l=(c,o,i)=>(f(c,typeof o!=\"symbol\"?o+\"\":o,i),i);var p;{let c={0:t=>m(t),1:t=>i(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(i(t)),5:t=>new Set(i(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t)},o=t=>{let[e,r]=t;return e in c?c[e](r):void 0},i=t=>t.map(o),m=t=>typeof t!=\"object\"||t===null?t:Object.fromEntries(Object.entries(t).map(([e,r])=>[e,o(r)]));customElements.get(\"astro-island\")||customElements.define(\"astro-island\",(p=class extends HTMLElement{constructor(){super(...arguments);l(this,\"Component\");l(this,\"hydrator\");l(this,\"hydrate\",async()=>{var d;if(!this.hydrator||!this.isConnected)return;let e=(d=this.parentElement)==null?void 0:d.closest(\"astro-island[ssr]\");if(e){e.addEventListener(\"astro:hydrate\",this.hydrate,{once:!0});return}let r=this.querySelectorAll(\"astro-slot\"),a={},h=this.querySelectorAll(\"template[data-astro-template]\");for(let n of h){let s=n.closest(this.tagName);s!=null&&s.isSameNode(this)&&(a[n.getAttribute(\"data-astro-template\")||\"default\"]=n.innerHTML,n.remove())}for(let n of r){let s=n.closest(this.tagName);s!=null&&s.isSameNode(this)&&(a[n.getAttribute(\"name\")||\"default\"]=n.innerHTML)}let u;try{u=this.hasAttribute(\"props\")?m(JSON.parse(this.getAttribute(\"props\"))):{}}catch(n){let s=this.getAttribute(\"component-url\")||\"<unknown>\",y=this.getAttribute(\"component-export\");throw y&&(s+=` (export ${y})`),console.error(`[hydrate] Error parsing props for component ${s}`,this.getAttribute(\"props\"),n),n}await this.hydrator(this)(this.Component,u,a,{client:this.getAttribute(\"client\")}),this.removeAttribute(\"ssr\"),this.dispatchEvent(new CustomEvent(\"astro:hydrate\"))});l(this,\"unmount\",()=>{this.isConnected||this.dispatchEvent(new CustomEvent(\"astro:unmount\"))})}disconnectedCallback(){document.removeEventListener(\"astro:after-swap\",this.unmount),document.addEventListener(\"astro:after-swap\",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute(\"await-children\")||document.readyState===\"interactive\"||document.readyState===\"complete\")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener(\"DOMContentLoaded\",e),r.disconnect(),this.childrenConnectedCallback()},r=new MutationObserver(()=>{var a;((a=this.lastChild)==null?void 0:a.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===\"astro:end\"&&(this.lastChild.remove(),e())});r.observe(this,{childList:!0}),document.addEventListener(\"DOMContentLoaded\",e)}}async childrenConnectedCallback(){let e=this.getAttribute(\"before-hydration-url\");e&&await import(e),this.start()}start(){let e=JSON.parse(this.getAttribute(\"opts\")),r=this.getAttribute(\"client\");if(Astro[r]===void 0){window.addEventListener(`astro:${r}`,()=>this.start(),{once:!0});return}Astro[r](async()=>{let a=this.getAttribute(\"renderer-url\"),[h,{default:u}]=await Promise.all([import(this.getAttribute(\"component-url\")),a?import(a):()=>()=>{}]),d=this.getAttribute(\"component-export\")||\"default\";if(!d.includes(\".\"))this.Component=h[d];else{this.Component=h;for(let n of d.split(\".\"))this.Component=this.Component[n]}return this.hydrator=u,this.hydrate},e,this)}attributeChangedCallback(){this.hydrate()}},l(p,\"observedAttributes\",[\"props\"]),p))}})();";
6
+ declare const _default: "(()=>{var b=Object.defineProperty;var f=(c,s,a)=>s in c?b(c,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):c[s]=a;var l=(c,s,a)=>(f(c,typeof s!=\"symbol\"?s+\"\":s,a),a);var p;{let c={0:t=>m(t),1:t=>a(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(a(t)),5:t=>new Set(a(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t)},s=t=>{let[e,r]=t;return e in c?c[e](r):void 0},a=t=>t.map(s),m=t=>typeof t!=\"object\"||t===null?t:Object.fromEntries(Object.entries(t).map(([e,r])=>[e,s(r)]));customElements.get(\"astro-island\")||customElements.define(\"astro-island\",(p=class extends HTMLElement{constructor(){super(...arguments);l(this,\"Component\");l(this,\"hydrator\");l(this,\"hydrate\",async()=>{var d;if(!this.hydrator||!this.isConnected)return;let e=(d=this.parentElement)==null?void 0:d.closest(\"astro-island[ssr]\");if(e){e.addEventListener(\"astro:hydrate\",this.hydrate,{once:!0});return}let r=this.querySelectorAll(\"astro-slot\"),o={},h=this.querySelectorAll(\"template[data-astro-template]\");for(let n of h){let i=n.closest(this.tagName);i!=null&&i.isSameNode(this)&&(o[n.getAttribute(\"data-astro-template\")||\"default\"]=n.innerHTML,n.remove())}for(let n of r){let i=n.closest(this.tagName);i!=null&&i.isSameNode(this)&&(o[n.getAttribute(\"name\")||\"default\"]=n.innerHTML)}let u;try{u=this.hasAttribute(\"props\")?m(JSON.parse(this.getAttribute(\"props\"))):{}}catch(n){let i=this.getAttribute(\"component-url\")||\"<unknown>\",y=this.getAttribute(\"component-export\");throw y&&(i+=` (export ${y})`),console.error(`[hydrate] Error parsing props for component ${i}`,this.getAttribute(\"props\"),n),n}await this.hydrator(this)(this.Component,u,o,{client:this.getAttribute(\"client\")}),this.removeAttribute(\"ssr\"),this.dispatchEvent(new CustomEvent(\"astro:hydrate\"))});l(this,\"unmount\",()=>{this.isConnected||this.dispatchEvent(new CustomEvent(\"astro:unmount\"))})}disconnectedCallback(){document.removeEventListener(\"astro:after-swap\",this.unmount),document.addEventListener(\"astro:after-swap\",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute(\"await-children\")||document.readyState===\"interactive\"||document.readyState===\"complete\")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener(\"DOMContentLoaded\",e),r.disconnect(),this.childrenConnectedCallback()},r=new MutationObserver(()=>{var o;((o=this.lastChild)==null?void 0:o.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===\"astro:end\"&&(this.lastChild.remove(),e())});r.observe(this,{childList:!0}),document.addEventListener(\"DOMContentLoaded\",e)}}async childrenConnectedCallback(){let e=this.getAttribute(\"before-hydration-url\");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute(\"opts\")),r=this.getAttribute(\"client\");if(Astro[r]===void 0){window.addEventListener(`astro:${r}`,()=>this.start(),{once:!0});return}try{await Astro[r](async()=>{let o=this.getAttribute(\"renderer-url\"),[h,{default:u}]=await Promise.all([import(this.getAttribute(\"component-url\")),o?import(o):()=>()=>{}]),d=this.getAttribute(\"component-export\")||\"default\";if(!d.includes(\".\"))this.Component=h[d];else{this.Component=h;for(let n of d.split(\".\"))this.Component=this.Component[n]}return this.hydrator=u,this.hydrate},e,this)}catch(o){console.error(`[astro-island] Error hydrating ${this.getAttribute(\"component-url\")}`,o)}}attributeChangedCallback(){this.hydrate()}},l(p,\"observedAttributes\",[\"props\"]),p))}})();";
7
7
  export default _default;
@@ -1,4 +1,4 @@
1
- var astro_island_prebuilt_default = `(()=>{var b=Object.defineProperty;var f=(c,o,i)=>o in c?b(c,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[o]=i;var l=(c,o,i)=>(f(c,typeof o!="symbol"?o+"":o,i),i);var p;{let c={0:t=>m(t),1:t=>i(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(i(t)),5:t=>new Set(i(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t)},o=t=>{let[e,r]=t;return e in c?c[e](r):void 0},i=t=>t.map(o),m=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([e,r])=>[e,o(r)]));customElements.get("astro-island")||customElements.define("astro-island",(p=class extends HTMLElement{constructor(){super(...arguments);l(this,"Component");l(this,"hydrator");l(this,"hydrate",async()=>{var d;if(!this.hydrator||!this.isConnected)return;let e=(d=this.parentElement)==null?void 0:d.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let r=this.querySelectorAll("astro-slot"),a={},h=this.querySelectorAll("template[data-astro-template]");for(let n of h){let s=n.closest(this.tagName);s!=null&&s.isSameNode(this)&&(a[n.getAttribute("data-astro-template")||"default"]=n.innerHTML,n.remove())}for(let n of r){let s=n.closest(this.tagName);s!=null&&s.isSameNode(this)&&(a[n.getAttribute("name")||"default"]=n.innerHTML)}let u;try{u=this.hasAttribute("props")?m(JSON.parse(this.getAttribute("props"))):{}}catch(n){let s=this.getAttribute("component-url")||"<unknown>",y=this.getAttribute("component-export");throw y&&(s+=\` (export \${y})\`),console.error(\`[hydrate] Error parsing props for component \${s}\`,this.getAttribute("props"),n),n}await this.hydrator(this)(this.Component,u,a,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});l(this,"unmount",()=>{this.isConnected||this.dispatchEvent(new CustomEvent("astro:unmount"))})}disconnectedCallback(){document.removeEventListener("astro:after-swap",this.unmount),document.addEventListener("astro:after-swap",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute("await-children")||document.readyState==="interactive"||document.readyState==="complete")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener("DOMContentLoaded",e),r.disconnect(),this.childrenConnectedCallback()},r=new MutationObserver(()=>{var a;((a=this.lastChild)==null?void 0:a.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});r.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}start(){let e=JSON.parse(this.getAttribute("opts")),r=this.getAttribute("client");if(Astro[r]===void 0){window.addEventListener(\`astro:\${r}\`,()=>this.start(),{once:!0});return}Astro[r](async()=>{let a=this.getAttribute("renderer-url"),[h,{default:u}]=await Promise.all([import(this.getAttribute("component-url")),a?import(a):()=>()=>{}]),d=this.getAttribute("component-export")||"default";if(!d.includes("."))this.Component=h[d];else{this.Component=h;for(let n of d.split("."))this.Component=this.Component[n]}return this.hydrator=u,this.hydrate},e,this)}attributeChangedCallback(){this.hydrate()}},l(p,"observedAttributes",["props"]),p))}})();`;
1
+ var astro_island_prebuilt_default = `(()=>{var b=Object.defineProperty;var f=(c,s,a)=>s in c?b(c,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):c[s]=a;var l=(c,s,a)=>(f(c,typeof s!="symbol"?s+"":s,a),a);var p;{let c={0:t=>m(t),1:t=>a(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(a(t)),5:t=>new Set(a(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t)},s=t=>{let[e,r]=t;return e in c?c[e](r):void 0},a=t=>t.map(s),m=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([e,r])=>[e,s(r)]));customElements.get("astro-island")||customElements.define("astro-island",(p=class extends HTMLElement{constructor(){super(...arguments);l(this,"Component");l(this,"hydrator");l(this,"hydrate",async()=>{var d;if(!this.hydrator||!this.isConnected)return;let e=(d=this.parentElement)==null?void 0:d.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let r=this.querySelectorAll("astro-slot"),o={},h=this.querySelectorAll("template[data-astro-template]");for(let n of h){let i=n.closest(this.tagName);i!=null&&i.isSameNode(this)&&(o[n.getAttribute("data-astro-template")||"default"]=n.innerHTML,n.remove())}for(let n of r){let i=n.closest(this.tagName);i!=null&&i.isSameNode(this)&&(o[n.getAttribute("name")||"default"]=n.innerHTML)}let u;try{u=this.hasAttribute("props")?m(JSON.parse(this.getAttribute("props"))):{}}catch(n){let i=this.getAttribute("component-url")||"<unknown>",y=this.getAttribute("component-export");throw y&&(i+=\` (export \${y})\`),console.error(\`[hydrate] Error parsing props for component \${i}\`,this.getAttribute("props"),n),n}await this.hydrator(this)(this.Component,u,o,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});l(this,"unmount",()=>{this.isConnected||this.dispatchEvent(new CustomEvent("astro:unmount"))})}disconnectedCallback(){document.removeEventListener("astro:after-swap",this.unmount),document.addEventListener("astro:after-swap",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute("await-children")||document.readyState==="interactive"||document.readyState==="complete")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener("DOMContentLoaded",e),r.disconnect(),this.childrenConnectedCallback()},r=new MutationObserver(()=>{var o;((o=this.lastChild)==null?void 0:o.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});r.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute("opts")),r=this.getAttribute("client");if(Astro[r]===void 0){window.addEventListener(\`astro:\${r}\`,()=>this.start(),{once:!0});return}try{await Astro[r](async()=>{let o=this.getAttribute("renderer-url"),[h,{default:u}]=await Promise.all([import(this.getAttribute("component-url")),o?import(o):()=>()=>{}]),d=this.getAttribute("component-export")||"default";if(!d.includes("."))this.Component=h[d];else{this.Component=h;for(let n of d.split("."))this.Component=this.Component[n]}return this.hydrator=u,this.hydrate},e,this)}catch(o){console.error(\`[astro-island] Error hydrating \${this.getAttribute("component-url")}\`,o)}}attributeChangedCallback(){this.hydrate()}},l(p,"observedAttributes",["props"]),p))}})();`;
2
2
  export {
3
3
  astro_island_prebuilt_default as default
4
4
  };
@@ -12,16 +12,23 @@ async function renderEndpoint(mod, context, ssr, logger) {
12
12
  )} requests are not available for a static site. Update your config to \`output: 'server'\` or \`output: 'hybrid'\` to enable.`
13
13
  );
14
14
  }
15
- if (typeof handler !== "function") {
15
+ if (handler === void 0) {
16
16
  logger.warn(
17
17
  "router",
18
- `No API Route handler exists for the method "${method}" for the route ${url.pathname}.
18
+ `No API Route handler exists for the method "${method}" for the route "${url.pathname}".
19
19
  Found handlers: ${Object.keys(mod).map((exp) => JSON.stringify(exp)).join(", ")}
20
20
  ` + ("all" in mod ? `One of the exported handlers is "all" (lowercase), did you mean to export 'ALL'?
21
21
  ` : "")
22
22
  );
23
23
  return new Response(null, { status: 404 });
24
24
  }
25
+ if (typeof handler !== "function") {
26
+ logger.error(
27
+ "router",
28
+ `The route "${url.pathname}" exports a value for the method "${method}", but it is of the type ${typeof handler} instead of a function.`
29
+ );
30
+ return new Response(null, { status: 500 });
31
+ }
25
32
  const response = await handler.call(mod, context);
26
33
  if (response.status === 404 || response.status === 500) {
27
34
  response.headers.set(REROUTE_DIRECTIVE_HEADER, "no");
@@ -60,6 +60,11 @@ async function writeWebResponse(res, webResponse) {
60
60
  res.write(body);
61
61
  } else {
62
62
  const reader = body.getReader();
63
+ res.on("close", () => {
64
+ reader.cancel().catch((error) => {
65
+ console.error("An unexpected error occurred in the middle of the stream.", error);
66
+ });
67
+ });
63
68
  while (true) {
64
69
  const { done, value } = await reader.read();
65
70
  if (done)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.3.6",
3
+ "version": "4.3.7",
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",
@@ -165,8 +165,8 @@
165
165
  "yargs-parser": "^21.1.1",
166
166
  "zod": "^3.22.4",
167
167
  "@astrojs/internal-helpers": "0.2.1",
168
- "@astrojs/markdown-remark": "4.2.1",
169
- "@astrojs/telemetry": "3.0.4"
168
+ "@astrojs/telemetry": "3.0.4",
169
+ "@astrojs/markdown-remark": "4.2.1"
170
170
  },
171
171
  "optionalDependencies": {
172
172
  "sharp": "^0.32.6"
@@ -231,10 +231,8 @@
231
231
  "build:ci": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" && pnpm run postbuild",
232
232
  "dev": "astro-scripts dev --copy-wasm --prebuild \"src/runtime/server/astro-island.ts\" --prebuild \"src/runtime/client/{idle,load,media,only,visible}.ts\" \"src/**/*.{ts,js}\"",
233
233
  "postbuild": "astro-scripts copy \"src/**/*.astro\" && astro-scripts copy \"src/**/*.wasm\"",
234
- "test:unit": "mocha --exit --timeout 30000 ./test/units/**/*.test.js",
235
- "test:unit:match": "mocha --exit --timeout 30000 ./test/units/**/*.test.js -g --ignore **/*.nodetest.js",
236
- "test": "pnpm run test:node && pnpm run test:unit && mocha --exit --timeout 30000 --ignore **/*.nodetest.js --ignore **/lit-element.test.js && mocha --timeout 30000 **/lit-element.test.js --ignore **/*.nodetest.js",
237
- "test:match": "mocha --timeout 30000 -g",
234
+ "test": "pnpm run test:node && mocha ./test/*.test.js --exit --timeout 30000 --ignore ./test/lit-element.test.js && mocha ./test/lit-element.test.js --timeout 30000",
235
+ "test:match": "mocha ./test/*.test.js --timeout 30000 -g",
238
236
  "test:e2e": "playwright test",
239
237
  "test:e2e:match": "playwright test -g",
240
238
  "test:node": "astro-scripts test \"test/**/*.nodetest.js\""