Files
dealplustech/node_modules/astro/dist/container/pipeline.js
Kunthawat 5171a789e9 fix: Final restoration with port 80
 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.
2026-03-12 08:58:56 +07:00

86 lines
2.4 KiB
JavaScript

import { Pipeline } from "../core/base-pipeline.js";
import {
createModuleScriptElement,
createStylesheetElementSet
} from "../core/render/ssr-element.js";
import { findRouteToRewrite } from "../core/routing/rewrite.js";
class ContainerPipeline extends Pipeline {
/**
* Internal cache to store components instances by `RouteData`.
* @private
*/
#componentsInterner = /* @__PURE__ */ new WeakMap();
static create({
logger,
manifest,
renderers,
resolve,
serverLike,
streaming
}) {
return new ContainerPipeline(
logger,
manifest,
"development",
renderers,
resolve,
serverLike,
streaming
);
}
componentMetadata(_routeData) {
}
headElements(routeData) {
const routeInfo = this.manifest.routes.find((route) => route.routeData === routeData);
const links = /* @__PURE__ */ new Set();
const scripts = /* @__PURE__ */ new Set();
const styles = createStylesheetElementSet(routeInfo?.styles ?? []);
for (const script of routeInfo?.scripts ?? []) {
if ("stage" in script) {
if (script.stage === "head-inline") {
scripts.add({
props: {},
children: script.children
});
}
} else {
scripts.add(createModuleScriptElement(script));
}
}
return { links, styles, scripts };
}
async tryRewrite(payload, request) {
const { newUrl, pathname, routeData } = findRouteToRewrite({
payload,
request,
routes: this.manifest?.routes.map((r) => r.routeData),
trailingSlash: this.manifest.trailingSlash,
buildFormat: this.manifest.buildFormat,
base: this.manifest.base,
outDir: this.manifest.outDir
});
const componentInstance = await this.getComponentByRoute(routeData);
return { componentInstance, routeData, newUrl, pathname };
}
insertRoute(route, componentInstance) {
this.#componentsInterner.set(route, {
page() {
return Promise.resolve(componentInstance);
},
renderers: this.manifest.renderers,
onRequest: this.resolvedMiddleware
});
}
// At the moment it's not used by the container via any public API
async getComponentByRoute(routeData) {
const page = this.#componentsInterner.get(routeData);
if (page) {
return page.page();
}
throw new Error("Couldn't find component for route " + routeData.pathname);
}
}
export {
ContainerPipeline
};