glashjs 0.13.1 → 0.13.2
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.
- package/package.json +1 -1
- package/src/server/server.mjs +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glashjs",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"description": "glashjs — The Postgres-native full-stack framework for builders who want to ship without DevOps. Framework, hosting, database, auth, and deploy in one GlashDB-native runtime.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/server/server.mjs
CHANGED
|
@@ -34,6 +34,7 @@ export async function createGlashServer({ root = process.cwd(), dev = false } =
|
|
|
34
34
|
const cfg = await loadConfig(root);
|
|
35
35
|
const routesDir = path.resolve(root, cfg.routesDir || 'routes');
|
|
36
36
|
const outDir = path.resolve(root, cfg.outDir);
|
|
37
|
+
const publicDir = path.resolve(root, cfg.publicDir || 'public');
|
|
37
38
|
const secHeaders = securityHeaders(cfg.security);
|
|
38
39
|
let routes = await discoverRoutes(routesDir);
|
|
39
40
|
|
|
@@ -72,6 +73,7 @@ export async function createGlashServer({ root = process.cwd(), dev = false } =
|
|
|
72
73
|
// Static first: in production this serves prebuilt /_glash/<id>.js bundles
|
|
73
74
|
// (written by `glash build`) — no runtime esbuild needed.
|
|
74
75
|
if (await serveStatic(res, outDir, pathname, req, secHeaders)) return;
|
|
76
|
+
if (dev && publicDir !== outDir && await serveStatic(res, publicDir, pathname, req, secHeaders)) return;
|
|
75
77
|
// Dynamic hydration bundles (dev, or when not prebuilt): /_glash/<routeId>.js
|
|
76
78
|
if (pathname.startsWith('/_glash/')) {
|
|
77
79
|
const id = pathname.slice('/_glash/'.length).replace(/\.js$/, '');
|
|
@@ -134,7 +136,7 @@ export async function createGlashServer({ root = process.cwd(), dev = false } =
|
|
|
134
136
|
server.listen(port, host);
|
|
135
137
|
});
|
|
136
138
|
|
|
137
|
-
return { server, listen, cfg, routes, routesDir, outDir };
|
|
139
|
+
return { server, listen, cfg, routes, routesDir, outDir, publicDir };
|
|
138
140
|
}
|
|
139
141
|
|
|
140
142
|
async function handleApi(res, mod, req, ctx, secHeaders) {
|