refactor: Move Astro to root, use PORT env (default 80), allow all hosts

- Move Astro files from dealplustech-astro/ to project root
- Update Dockerfile: PORT environment variable (default 80)
- Add vite.config.ts with allowedHosts: true
- Matches nixpacks behavior for Easypanel deployment
- No hardcoded ports or domains
This commit is contained in:
Kunthawat Greethong
2026-03-03 11:40:50 +07:00
parent f972f68875
commit 443c3377e2
10383 changed files with 4019 additions and 19183 deletions

View File

@@ -0,0 +1,66 @@
import nodeFs from "node:fs";
import npath from "node:path";
import { slash } from "../core/path.js";
import { cleanUrl } from "../vite-plugin-utils/index.js";
function loadFallbackPlugin({
fs,
root
}) {
if (!fs || fs === nodeFs || fs.default === nodeFs) {
return false;
}
const tryLoadModule = async (id) => {
try {
return await fs.promises.readFile(cleanUrl(id), "utf-8");
} catch {
try {
return await fs.promises.readFile(id, "utf-8");
} catch {
try {
const fullpath = new URL("." + id, root);
return await fs.promises.readFile(fullpath, "utf-8");
} catch {
}
}
}
};
return [
{
name: "astro:load-fallback",
enforce: "post",
async resolveId(id, parent) {
if (parent) {
const candidateId = npath.posix.join(npath.posix.dirname(slash(parent)), id);
try {
const stats = await fs.promises.stat(candidateId);
if (!stats.isDirectory()) {
return candidateId;
}
} catch {
}
}
},
async load(id) {
const code = await tryLoadModule(id);
if (code) {
return { code };
}
}
},
{
name: "astro:load-fallback-hmr",
enforce: "pre",
handleHotUpdate(context) {
const read = context.read;
context.read = async () => {
const source = await tryLoadModule(context.file);
if (source) return source;
return read.call(context);
};
}
}
];
}
export {
loadFallbackPlugin as default
};