mrvn-cli 0.6.0 → 0.6.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.
@@ -23676,21 +23676,22 @@ import { fileURLToPath as fileURLToPath2 } from "url";
23676
23676
  var __dirname = path9.dirname(fileURLToPath2(import.meta.url));
23677
23677
  var cachedStyles = null;
23678
23678
  function renderStyles() {
23679
- if (!cachedStyles) {
23680
- const candidates = [
23681
- path9.join(__dirname, "..", "static", "styles.css"),
23682
- path9.resolve("src/web/static/styles.css"),
23683
- path9.resolve("dist/web/static/styles.css")
23684
- ];
23685
- for (const p of candidates) {
23686
- if (fs9.existsSync(p)) {
23687
- cachedStyles = fs9.readFileSync(p, "utf-8");
23688
- return cachedStyles;
23689
- }
23679
+ if (cachedStyles) return cachedStyles;
23680
+ const candidates = [
23681
+ path9.join(__dirname, "..", "static", "styles.css"),
23682
+ // dev source layout
23683
+ path9.join(__dirname, "web", "static", "styles.css"),
23684
+ // bundled prod layout
23685
+ path9.resolve("src/web/static/styles.css"),
23686
+ path9.resolve("dist/web/static/styles.css")
23687
+ ];
23688
+ for (const p of candidates) {
23689
+ if (fs9.existsSync(p)) {
23690
+ cachedStyles = fs9.readFileSync(p, "utf-8");
23691
+ return cachedStyles;
23690
23692
  }
23691
- throw new Error(`styles.css not found. Searched: ${candidates.join(", ")}`);
23692
23693
  }
23693
- return cachedStyles;
23694
+ throw new Error(`styles.css not found. Searched: ${candidates.join(", ")}`);
23694
23695
  }
23695
23696
 
23696
23697
  // src/web/templates/pages/documents.ts
@@ -27936,11 +27937,12 @@ function handleRequest(req, res, store, projectName, navGroups) {
27936
27937
  const navTypes = store.registeredTypes;
27937
27938
  try {
27938
27939
  if (pathname === "/styles.css") {
27940
+ const css = renderStyles();
27939
27941
  res.writeHead(200, {
27940
27942
  "Content-Type": "text/css",
27941
27943
  "Cache-Control": "public, max-age=300"
27942
27944
  });
27943
- res.end(renderStyles());
27945
+ res.end(css);
27944
27946
  return;
27945
27947
  }
27946
27948
  const oldRootMatch = pathname.match(/^\/([a-z-]+)$/);
@@ -28161,8 +28163,12 @@ function handleRequest(req, res, store, projectName, navGroups) {
28161
28163
  notFound(res, projectName, navGroups, pathname, null);
28162
28164
  } catch (err) {
28163
28165
  console.error("[marvin web] Error handling request:", err);
28164
- res.writeHead(500, { "Content-Type": "text/html" });
28165
- res.end("<h1>500 \u2014 Internal Server Error</h1>");
28166
+ if (!res.headersSent) {
28167
+ res.writeHead(500, { "Content-Type": "text/html" });
28168
+ res.end("<h1>500 \u2014 Internal Server Error</h1>");
28169
+ } else {
28170
+ res.end();
28171
+ }
28166
28172
  }
28167
28173
  }
28168
28174
  function respond(res, html) {