Refactor routing in App component to enhance navigation and improve error handling by integrating dynamic routes and updating the NotFound route.
This commit is contained in:
48
node_modules/astro/dist/runtime/server/render/any.js
generated
vendored
Normal file
48
node_modules/astro/dist/runtime/server/render/any.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { escapeHTML, isHTMLString, markHTMLString } from "../escape.js";
|
||||
import { isPromise } from "../util.js";
|
||||
import { isAstroComponentInstance, isRenderTemplateResult } from "./astro/index.js";
|
||||
import { isRenderInstance } from "./common.js";
|
||||
import { SlotString } from "./slot.js";
|
||||
import { renderToBufferDestination } from "./util.js";
|
||||
async function renderChild(destination, child) {
|
||||
if (isPromise(child)) {
|
||||
child = await child;
|
||||
}
|
||||
if (child instanceof SlotString) {
|
||||
destination.write(child);
|
||||
} else if (isHTMLString(child)) {
|
||||
destination.write(child);
|
||||
} else if (Array.isArray(child)) {
|
||||
const childRenders = child.map((c) => {
|
||||
return renderToBufferDestination((bufferDestination) => {
|
||||
return renderChild(bufferDestination, c);
|
||||
});
|
||||
});
|
||||
for (const childRender of childRenders) {
|
||||
if (!childRender) continue;
|
||||
await childRender.renderToFinalDestination(destination);
|
||||
}
|
||||
} else if (typeof child === "function") {
|
||||
await renderChild(destination, child());
|
||||
} else if (typeof child === "string") {
|
||||
destination.write(markHTMLString(escapeHTML(child)));
|
||||
} else if (!child && child !== 0) {
|
||||
} else if (isRenderInstance(child)) {
|
||||
await child.render(destination);
|
||||
} else if (isRenderTemplateResult(child)) {
|
||||
await child.render(destination);
|
||||
} else if (isAstroComponentInstance(child)) {
|
||||
await child.render(destination);
|
||||
} else if (ArrayBuffer.isView(child)) {
|
||||
destination.write(child);
|
||||
} else if (typeof child === "object" && (Symbol.asyncIterator in child || Symbol.iterator in child)) {
|
||||
for await (const value of child) {
|
||||
await renderChild(destination, value);
|
||||
}
|
||||
} else {
|
||||
destination.write(child);
|
||||
}
|
||||
}
|
||||
export {
|
||||
renderChild
|
||||
};
|
Reference in New Issue
Block a user