glashjs 0.5.0 → 0.5.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/build.mjs +9 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glashjs",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "glashjs — a web framework with file-based routing, SSR, API routes, a best-in-class asset optimizer, offline PWA layer, animated favicon, and secure-by-default headers. Zero dependencies.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/build.mjs CHANGED
@@ -63,8 +63,15 @@ export async function build({ root = process.cwd(), log = console.log } = {}) {
63
63
  log(`\nglashjs build — "${cfg.name}"`);
64
64
  log(` public: ${path.relative(root, publicDir)} -> out: ${path.relative(root, outDir)}\n`);
65
65
 
66
- log('Optimizing assets:');
67
- const manifest = await optimizeAssets(publicDir, { log });
66
+ // A routes-only app may have no public/ dir — that's fine, just skip assets.
67
+ let manifest;
68
+ if (existsSync(publicDir)) {
69
+ log('Optimizing assets:');
70
+ manifest = await optimizeAssets(publicDir, { log });
71
+ } else {
72
+ log(`(no ${cfg.publicDir}/ dir — skipping asset optimization)`);
73
+ manifest = { totals: { assets: 0, originalBytes: 0, optimizedBytes: 0, savedPercent: 0 }, assets: {} };
74
+ }
68
75
  const version = deriveVersion(manifest);
69
76
  manifest.version = version;
70
77
  manifest.generatedAt = new Date().toISOString();