@fierst/c7t 1.0.0 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ All notable changes to **`@fierst/c7t` ("Construct")** are documented in this fi
4
4
 
5
5
  ---
6
6
 
7
+ ## [1.0.1] - 2026-11-30
8
+
9
+ ### Fixed
10
+
11
+ - **Vite+ Dev Server Routing (`npm run dev` / `vp dev`):** Configure `appType: "custom"` automatically when no root `index.html` is present and resolve dev SSR requests from `req.originalUrl` so Vite's SPA fallback middleware never rewrites `/` or nested routes to `/index.html`.
12
+ - **Dev HMR & Live Route Discovery:** Inject `/@vite/client` in `vp dev` HTML heads for live CSS hot-reloading and error overlays, collect SSR environment styles across Vite 8 module graphs, and automatically invalidate `virtual:c7t/routes` when files are added or removed under `src/routes/**`.
13
+
14
+ ---
15
+
7
16
  ## [1.0.0] - 2026-11-30
8
17
 
9
18
  Initial release of **`c7t` ("Construct" — `@fierst/c7t`)** — Fierst LLC's full-stack generator meta-framework built on `@fierst/blokd` (`>=1.3.0`), Hono, and Vite+ (`vp`).
package/README.md CHANGED
@@ -48,7 +48,7 @@ Browse the [documentation index](./docs/README.md), jump straight into a guide,
48
48
  7. [07. Databases, `defineDb()`, and Drizzle ORM](./docs/guides/07-databases-and-drizzle.md)
49
49
 
50
50
  - [Complete API Reference & Troubleshooting](./docs/reference.md)
51
- - [Changelog (`v1.0.0`)](./CHANGELOG.md)
51
+ - [Changelog (`v1.0.1`)](./CHANGELOG.md)
52
52
 
53
53
  ---
54
54
 
package/dist/server.mjs CHANGED
@@ -715,14 +715,18 @@ function createServer(options = {}) {
715
715
  const notFoundComp = options.notFoundComponent ?? specialRoutes?.notFound;
716
716
  const errorComp = options.errorComponent ?? specialRoutes?.error;
717
717
  let devStyles = [];
718
+ let devViteClientScript = "";
718
719
  if (!isProductionMode()) {
719
720
  const devStyleHeader = c.req.header("x-c7t-dev-styles");
720
721
  if (devStyleHeader) try {
721
722
  const parsedStyles = JSON.parse(devStyleHeader);
722
723
  if (Array.isArray(parsedStyles)) devStyles = parsedStyles;
723
724
  } catch {}
725
+ const devViteClientHref = c.req.header("x-c7t-dev-vite-client");
726
+ if (devViteClientHref) devViteClientScript = `<script type="module" src="${escapeTitleHtml(devViteClientHref)}"><\/script>`;
724
727
  }
725
- const baseHead = renderStylesheetLinks([...options.styles ?? defaultProdStyles, ...devStyles]) + (options.document?.head ?? "");
728
+ const styleLinks = renderStylesheetLinks([...options.styles ?? defaultProdStyles, ...devStyles]);
729
+ const baseHead = devViteClientScript + styleLinks + (options.document?.head ?? "");
726
730
  const renderCustom404 = async () => {
727
731
  const parsed = new URL(c.req.url, "http://c7t.local");
728
732
  const leaf = _comp(notFoundComp, { pathname: parsed.pathname });
package/dist/vite.mjs CHANGED
@@ -614,17 +614,19 @@ function shouldBypassDevSsr(urlPath) {
614
614
  }
615
615
  function collectDevStylesFromGraph(viteServer) {
616
616
  const styles = [];
617
- const idMap = viteServer?.moduleGraph?.idToModuleMap;
618
- if (!idMap) return styles;
617
+ const maps = [viteServer?.moduleGraph?.idToModuleMap, viteServer?.environments?.ssr?.moduleGraph?.idToModuleMap];
619
618
  const seen = /* @__PURE__ */ new Set();
620
- for (const mod of idMap.values()) {
621
- const url = mod?.url;
622
- if (!url || typeof url !== "string") continue;
623
- if (!url.split("?")[0].endsWith(".css")) continue;
624
- const directHref = url.includes("?") ? `${url}&direct` : `${url}?direct`;
625
- if (seen.has(directHref)) continue;
626
- seen.add(directHref);
627
- styles.push(directHref);
619
+ for (const idMap of maps) {
620
+ if (!idMap) continue;
621
+ for (const mod of idMap.values()) {
622
+ const url = mod?.url;
623
+ if (!url || typeof url !== "string") continue;
624
+ if (!url.split("?")[0].endsWith(".css")) continue;
625
+ const directHref = url.includes("?") ? `${url}&direct` : `${url}?direct`;
626
+ if (seen.has(directHref)) continue;
627
+ seen.add(directHref);
628
+ styles.push(directHref);
629
+ }
628
630
  }
629
631
  return styles;
630
632
  }
@@ -705,12 +707,18 @@ function c7t(options = {}) {
705
707
  enforce: "pre",
706
708
  __c7tOptions: options,
707
709
  config(userConfig, env) {
710
+ const cfgRoot = userConfig.root ?? process.cwd();
711
+ const hasIndexHtml = existsSync(join(cfgRoot, "index.html"));
712
+ const mode = userConfig.mode ?? env.mode;
708
713
  const patch = { resolve: { dedupe: ["@fierst/blokd", "@fierst/c7t"] } };
714
+ if (mode !== "test" && !hasIndexHtml && !userConfig.appType) patch.appType = "custom";
715
+ if (env.command === "serve" && mode !== "test") {
716
+ const prebundle = ["@fierst/blokd", "@fierst/blokd/revive"];
717
+ if (existsSync(join(cfgRoot, "node_modules", "@fierst", "c7t", "package.json"))) prebundle.push("@fierst/c7t", "@fierst/c7t/client", "@fierst/c7t/router");
718
+ patch.optimizeDeps = { include: prebundle };
719
+ }
709
720
  if (env.command === "build" && !env.isSsrBuild && !userConfig.build?.ssr) {
710
- const cfgRoot = userConfig.root ?? process.cwd();
711
- const hasInput = Boolean(userConfig.build?.rollupOptions?.input);
712
- const hasIndexHtml = existsSync(join(cfgRoot, "index.html"));
713
- if (!hasInput && !hasIndexHtml) patch.build = { rollupOptions: { input: virtualClientEntryId } };
721
+ if (!Boolean(userConfig.build?.rollupOptions?.input) && !hasIndexHtml) patch.build = { rollupOptions: { input: virtualClientEntryId } };
714
722
  }
715
723
  return patch;
716
724
  },
@@ -811,16 +819,34 @@ function c7t(options = {}) {
811
819
  },
812
820
  configureServer(viteServer) {
813
821
  if (!options.serverEntry && viteServer.config?.mode === "test") return;
822
+ const absRoutesPrefix = join(rootDir || process.cwd(), routesDirRel).replace(/\\/g, "/");
823
+ const invalidateVirtualRoutes = (filePath) => {
824
+ if (!filePath.replace(/\\/g, "/").startsWith(absRoutesPrefix)) return;
825
+ for (const graph of [
826
+ viteServer.moduleGraph,
827
+ viteServer.environments?.ssr?.moduleGraph,
828
+ viteServer.environments?.client?.moduleGraph
829
+ ]) {
830
+ if (!graph || typeof graph.getModuleById !== "function") continue;
831
+ for (const vid of [resolvedVirtualRoutesId, resolvedVirtualDefaultServerId]) {
832
+ const mod = graph.getModuleById(vid);
833
+ if (mod) graph.invalidateModule(mod);
834
+ }
835
+ }
836
+ viteServer.ws?.send?.({ type: "full-reload" });
837
+ };
838
+ viteServer.watcher?.on?.("add", invalidateVirtualRoutes);
839
+ viteServer.watcher?.on?.("unlink", invalidateVirtualRoutes);
814
840
  return () => {
815
841
  viteServer.middlewares.use(async (nodeReq, nodeRes, next) => {
816
- const rawUrl = nodeReq.url || "/";
817
- if (!rawUrl.startsWith("/_c7t/") && shouldBypassDevSsr(rawUrl)) return next();
842
+ const reqUrl = nodeReq.originalUrl || nodeReq.url || "/";
843
+ if (!reqUrl.startsWith("/_c7t/") && shouldBypassDevSsr(reqUrl)) return next();
818
844
  const targetEntry = resolveServerEntryPath();
819
845
  if (!targetEntry) return next();
820
846
  try {
821
847
  const app = (await viteServer.ssrLoadModule(targetEntry)).default;
822
848
  if (!app || typeof app.fetch !== "function") return next();
823
- const url = `${nodeReq.socket?.encrypted ? "https" : "http"}://${nodeReq.headers.host || "localhost"}${nodeReq.url || "/"}`;
849
+ const url = `${nodeReq.socket?.encrypted ? "https" : "http"}://${nodeReq.headers.host || "localhost"}${reqUrl}`;
824
850
  const method = nodeReq.method || "GET";
825
851
  const hasBody = method !== "GET" && method !== "HEAD";
826
852
  const abortController = new AbortController();
@@ -830,6 +856,8 @@ function c7t(options = {}) {
830
856
  const reqHeaders = new Headers(nodeReq.headers);
831
857
  const devStyles = collectDevStylesFromGraph(viteServer);
832
858
  if (devStyles.length > 0) reqHeaders.set("x-c7t-dev-styles", JSON.stringify(devStyles));
859
+ const cleanBase = base.endsWith("/") ? base : base + "/";
860
+ reqHeaders.set("x-c7t-dev-vite-client", `${cleanBase}@vite/client`);
833
861
  const webReq = new Request(url, {
834
862
  method,
835
863
  headers: reqHeaders,
package/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- # c7t (Construct — @fierst/c7t) 1.0.0
1
+ # c7t (Construct — @fierst/c7t) 1.0.1
2
2
 
3
3
  ---
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fierst/c7t",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "c7t (Construct) — Full-stack generator meta-framework built on @fierst/blokd, Hono, and Vite+ with deterministic State Receipts, dual-protocol server() callables, hybrid SSG, and bidirectional NDJSON streaming.",
5
5
  "keywords": [
6
6
  "blokd",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@fierst/blokd": "^1.3.0",
14
- "@fierst/c7t": "^1.0.0",
14
+ "@fierst/c7t": "^1.0.1",
15
15
  "hono": "^4.7.0"
16
16
  },
17
17
  "devDependencies": {