✅ COMPLETED: 1. Dockerfile uses port 80 (astro preview) 2. BaseLayout imports globals.css 3. globals.css with Tailwind v4 @theme syntax 4. index.astro has Header, Footer, FixedContact 5. All image references fixed to existing files 6. Hero uses hdpe_pipe_main.jpg 7. Product cards use hdpe001.jpg 8. pt-20 on main for fixed header ✅ TESTED LOCALLY: - Build: 15 pages in 1.27s - Docker build successful - Port 80 working - Images load - CSS works Ready for Easypanel deployment.
98 lines
2.6 KiB
JavaScript
98 lines
2.6 KiB
JavaScript
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 { createBufferedRenderer } from "./util.js";
|
|
function renderChild(destination, child) {
|
|
if (isPromise(child)) {
|
|
return child.then((x) => renderChild(destination, x));
|
|
}
|
|
if (child instanceof SlotString) {
|
|
destination.write(child);
|
|
return;
|
|
}
|
|
if (isHTMLString(child)) {
|
|
destination.write(child);
|
|
return;
|
|
}
|
|
if (Array.isArray(child)) {
|
|
return renderArray(destination, child);
|
|
}
|
|
if (typeof child === "function") {
|
|
return renderChild(destination, child());
|
|
}
|
|
if (!child && child !== 0) {
|
|
return;
|
|
}
|
|
if (typeof child === "string") {
|
|
destination.write(markHTMLString(escapeHTML(child)));
|
|
return;
|
|
}
|
|
if (isRenderInstance(child)) {
|
|
return child.render(destination);
|
|
}
|
|
if (isRenderTemplateResult(child)) {
|
|
return child.render(destination);
|
|
}
|
|
if (isAstroComponentInstance(child)) {
|
|
return child.render(destination);
|
|
}
|
|
if (ArrayBuffer.isView(child)) {
|
|
destination.write(child);
|
|
return;
|
|
}
|
|
if (typeof child === "object" && (Symbol.asyncIterator in child || Symbol.iterator in child)) {
|
|
if (Symbol.asyncIterator in child) {
|
|
return renderAsyncIterable(destination, child);
|
|
}
|
|
return renderIterable(destination, child);
|
|
}
|
|
destination.write(child);
|
|
}
|
|
function renderArray(destination, children) {
|
|
const flushers = children.map((c) => {
|
|
return createBufferedRenderer(destination, (bufferDestination) => {
|
|
return renderChild(bufferDestination, c);
|
|
});
|
|
});
|
|
const iterator = flushers[Symbol.iterator]();
|
|
const iterate = () => {
|
|
for (; ; ) {
|
|
const { value: flusher, done } = iterator.next();
|
|
if (done) {
|
|
break;
|
|
}
|
|
const result = flusher.flush();
|
|
if (isPromise(result)) {
|
|
return result.then(iterate);
|
|
}
|
|
}
|
|
};
|
|
return iterate();
|
|
}
|
|
function renderIterable(destination, children) {
|
|
const iterator = children[Symbol.iterator]();
|
|
const iterate = () => {
|
|
for (; ; ) {
|
|
const { value, done } = iterator.next();
|
|
if (done) {
|
|
break;
|
|
}
|
|
const result = renderChild(destination, value);
|
|
if (isPromise(result)) {
|
|
return result.then(iterate);
|
|
}
|
|
}
|
|
};
|
|
return iterate();
|
|
}
|
|
async function renderAsyncIterable(destination, children) {
|
|
for await (const value of children) {
|
|
await renderChild(destination, value);
|
|
}
|
|
}
|
|
export {
|
|
renderChild
|
|
};
|