@webjsdev/cli 0.10.48 → 0.10.49

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/bin/webjs.js CHANGED
@@ -875,7 +875,7 @@ components/schema with the actual app the user requested. Use Drizzle +
875
875
  SQLite for persistence (already wired up). Never store app data in JSON
876
876
  files.
877
877
 
878
- Full docs: https://docs.webjs.dev`);
878
+ Full docs: https://webjs.dev/docs`);
879
879
  process.exit(1);
880
880
  }
881
881
  const noInstall = rest.includes('--no-install');
package/lib/create.js CHANGED
@@ -1292,7 +1292,7 @@ export default function RootLayout({ children }: { children: unknown }) {
1292
1292
  WebJs Gallery
1293
1293
  </a>
1294
1294
  <nav class="flex items-center gap-4 text-sm" aria-label="Primary">
1295
- <a href="https://docs.webjs.dev" target="_blank" rel="noopener" class="hidden sm:inline text-muted-foreground hover:text-foreground no-underline transition-colors">Docs</a>
1295
+ <a href="https://webjs.dev/docs" target="_blank" rel="noopener" class="hidden sm:inline text-muted-foreground hover:text-foreground no-underline transition-colors">Docs</a>
1296
1296
  <a href="https://github.com/webjsdev/webjs" target="_blank" rel="noopener" class="hidden sm:inline text-muted-foreground hover:text-foreground no-underline transition-colors">GitHub</a>
1297
1297
  <theme-toggle></theme-toggle>
1298
1298
  </nav>
@@ -1363,7 +1363,7 @@ export default function Home() {
1363
1363
  <!-- Footer: docs + source -->
1364
1364
  <footer class="flex flex-col items-center gap-3">
1365
1365
  <nav class="flex items-center gap-6 text-sm text-muted-foreground" aria-label="WebJs links">
1366
- <a href="https://docs.webjs.dev" target="_blank" rel="noopener" class="inline-flex items-center gap-2 hover:text-foreground transition-colors no-underline">\${iconBook()}<span>Docs</span></a>
1366
+ <a href="https://webjs.dev/docs" target="_blank" rel="noopener" class="inline-flex items-center gap-2 hover:text-foreground transition-colors no-underline">\${iconBook()}<span>Docs</span></a>
1367
1367
  <a href="https://github.com/webjsdev/webjs" target="_blank" rel="noopener" class="inline-flex items-center gap-2 hover:text-foreground transition-colors no-underline">\${iconGithub()}<span>GitHub</span></a>
1368
1368
  </nav>
1369
1369
  <p class="text-[0.7rem] uppercase tracking-[0.15em] text-muted-foreground m-0 text-center">
@@ -1497,7 +1497,7 @@ ThemeToggle.register('theme-toggle');
1497
1497
  • Use the wired-up database (Drizzle): define real models in
1498
1498
  db/schema.server.ts, then run 'npm run db:generate' and 'npm run db:migrate'.
1499
1499
  Never store app data in JSON files, in-memory arrays, or localStorage.
1500
- • Full hosted docs are at https://docs.webjs.dev.
1500
+ • Full hosted docs are at https://webjs.dev/docs.
1501
1501
  `);
1502
1502
 
1503
1503
  // Auto-install (default). Detect the package manager from the env so
@@ -51,7 +51,11 @@ export function planDevSupervisor({ isBun, argv, noHot, exists }) {
51
51
  for (const dir of ['app', 'components', 'modules', 'lib', 'actions']) {
52
52
  if (exists(dir)) watchPaths.push('--watch-path', dir);
53
53
  }
54
- for (const f of ['middleware.ts', 'middleware.js']) {
54
+ // Every extension the server's root-middleware lookup accepts, in the same
55
+ // order. If these two lists diverge, an app gets a middleware that loads but
56
+ // never restarts the dev server when edited, which is the quiet half of the
57
+ // bug where a `middleware.ts` was loaded by neither.
58
+ for (const f of ['middleware.ts', 'middleware.js', 'middleware.mts', 'middleware.mjs']) {
55
59
  if (exists(f)) watchPaths.push('--watch-path', f);
56
60
  }
57
61
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webjsdev/cli",
3
- "version": "0.10.48",
3
+ "version": "0.10.49",
4
4
  "type": "module",
5
5
  "description": "webjs CLI - dev, start, create, db",
6
6
  "bin": {
@@ -4,7 +4,7 @@ You are working on a WebJs app (AI-first, no-build, web-components-first). This
4
4
  file is the WORKFLOW contract (git, tests, review). For HOW to build (routing,
5
5
  components, actions, styling, the framework API), read
6
6
  `.agents/skills/webjs/SKILL.md`, which routes to focused references on demand.
7
- Read `AGENTS.md` first. Full hosted docs are at https://docs.webjs.dev.
7
+ Read `AGENTS.md` first. Full hosted docs are at https://webjs.dev/docs.
8
8
 
9
9
  ## Grow the app in place (non-negotiable)
10
10
 
@@ -9,7 +9,7 @@ Use this skill for end-to-end WebJs app work. It helps you choose the right laye
9
9
 
10
10
  ## Full Documentation
11
11
 
12
- This skill is the quick guide. When you need the full API reference for a surface, load the matching file in `references/` (listed below). For even deeper framework detail, WebJs ships buildless, so the source you run IS the source you read: look in `node_modules/@webjsdev/{core,server,cli}/` (each package ships its own `AGENTS.md`). The complete hosted docs live at https://docs.webjs.dev.
12
+ This skill is the quick guide. When you need the full API reference for a surface, load the matching file in `references/` (listed below). For even deeper framework detail, WebJs ships buildless, so the source you run IS the source you read: look in `node_modules/@webjsdev/{core,server,cli}/` (each package ships its own `AGENTS.md`). The complete hosted docs live at https://webjs.dev/docs.
13
13
 
14
14
  ## What WebJs Is
15
15
 
@@ -96,7 +96,7 @@ const [updated] = await db.update(posts).set({ title }).where(eq(posts.id, id)).
96
96
  await db.delete(posts).where(eq(posts.id, id));
97
97
  ```
98
98
 
99
- A `.returning()` row is the table's own columns only, never `with` relations. When the caller wants a joined shape, re-read with `db.query.*` or splice the already-known related value in by hand. Full surface at https://docs.webjs.dev.
99
+ A `.returning()` row is the table's own columns only, never `with` relations. When the caller wants a joined shape, re-read with `db.query.*` or splice the already-known related value in by hand. Full surface at https://webjs.dev/docs.
100
100
 
101
101
  ## Input validation at the boundary
102
102
 
@@ -201,4 +201,4 @@ import type { Post } from '#db/schema.server.ts';
201
201
  import { posts } from '#db/schema.server.ts';
202
202
  ```
203
203
 
204
- Keep the wire shape in a browser-safe `modules/<feature>/types.ts` with NO runtime import from a `.server.ts` file or from `db/`. Define a hand-written DTO, or a type-only derivation (`import type { Post } ...; export type PostFormatted = Omit<Post, 'createdAt'> & { createdAt: string }`). Never `export *` or a value re-export from a `.server.ts` in `types.ts`; that carries the runtime table bindings and breaks any component importing the types. Full reference at https://docs.webjs.dev.
204
+ Keep the wire shape in a browser-safe `modules/<feature>/types.ts` with NO runtime import from a `.server.ts` file or from `db/`. Define a hand-written DTO, or a type-only derivation (`import type { Post } ...; export type PostFormatted = Omit<Post, 'createdAt'> & { createdAt: string }`). Never `export *` or a value re-export from a `.server.ts` in `types.ts`; that carries the runtime table bindings and breaks any component importing the types. Full reference at https://webjs.dev/docs.
@@ -94,6 +94,8 @@ export async function POST(req: Request) {
94
94
 
95
95
  Optional root-level plus per-segment. The default export is `async (req, next) => Response`. Return a Response to short-circuit, or call `next()` and post-process. Per-segment middleware applies to its subtree, outermost to innermost.
96
96
 
97
+ The root file sits beside `app/`, not inside it, and may be `middleware.ts` / `.js` / `.mts` / `.mjs` (`.ts` wins if more than one exists). A per-segment `app/<segment>/middleware.*` takes any of the same extensions.
98
+
97
99
  ## Metadata and `generateMetadata`
98
100
 
99
101
  A page exports `metadata` (static) or `generateMetadata(ctx)` (request-scoped, takes precedence). Values flow into `<head>` at SSR and merge across nested layouts (deeper wins). Type both with `Metadata`; `MetadataContext` types the argument. The surface is Next.js-compatible.
@@ -108,7 +110,7 @@ export async function generateMetadata(ctx: MetadataContext): Promise<Metadata>
108
110
  }
109
111
  ```
110
112
 
111
- Common fields: `title` (string or `{ template, default, absolute }`), `description`, `keywords`, `metadataBase` (resolves relative URLs in `openGraph` / `twitter` / `alternates` / `icons`), `openGraph`, `twitter`, `robots`, `alternates.canonical`, `icons`, `manifest`, and `jsonLd` (schema.org structured data, single object or array, HTML-safe-escaped automatically). `viewport`, `themeColor`, and `colorScheme` may also be set via a split `export const viewport = { ... }`. `cacheControl` is emitted as a response HEADER (not a `<meta>`); pages default to `no-store`, and a `public` value enables conditional GET (a weak `ETag` + `304`). See https://docs.webjs.dev for the full field list.
113
+ Common fields: `title` (string or `{ template, default, absolute }`), `description`, `keywords`, `metadataBase` (resolves relative URLs in `openGraph` / `twitter` / `alternates` / `icons`), `openGraph`, `twitter`, `robots`, `alternates.canonical`, `icons`, `manifest`, and `jsonLd` (schema.org structured data, single object or array, HTML-safe-escaped automatically). `viewport`, `themeColor`, and `colorScheme` may also be set via a split `export const viewport = { ... }`. `cacheControl` is emitted as a response HEADER (not a `<meta>`); pages default to `no-store`, and a `public` value enables conditional GET (a weak `ETag` + `304`). See https://webjs.dev/docs for the full field list.
112
114
 
113
115
  ## Control-flow throws
114
116
 
@@ -35,9 +35,14 @@ Three seams pick a runtime-specific implementation, all inside the framework, no
35
35
  | Hot reload | `node --watch` | `bun --hot` |
36
36
  | WebSocket | the `ws` library | native `Bun.serve` + a bridge adapter |
37
37
  | 103 Early Hints | yes | no (`Bun.serve` has no informational-response API) |
38
+ | Reverse-proxy headers | `X-Forwarded-Proto` / `X-Forwarded-Host` honored | same |
38
39
 
39
40
  The 103 Early Hints gap costs only a small first-load latency edge where an edge proxy forwards the 103, never correctness. The `modulepreload` hints still ship in the document head on both runtimes.
40
41
 
42
+ Behind a TLS-terminating proxy (Railway, Fly, Render, Cloudflare, nginx), both shells rewrite the request URL from `X-Forwarded-Proto` / `X-Forwarded-Host`, so `ctx.url` in a page, `req.url` in a `route.{js,ts}` handler, and every absolute URL you build from either carry the ORIGINAL scheme and host rather than the internal `http://container` hop. A comma-separated chain (a CDN in front of a load balancer) takes the value closest to the client, only `http` and `https` are accepted as a scheme, and a malformed host is ignored rather than failing the request. This was Bun-only broken before #1090, which shipped an `http://` `og:image` on an HTTPS site.
43
+
44
+ Two limits worth knowing. `WEBJS_NO_TRUST_PROXY=1` stops the URL rewrite (and the HSTS scheme check) from trusting the headers when the container is directly exposed, but it is not a global switch: the CSRF host check still reads `X-Forwarded-Host` regardless. And this rewrite belongs to `startServer`. An app embedded through `createRequestHandler` gets the `Request` its host adapter built, so that adapter owns the correction, the same boundary that already applies to the trusted client IP.
45
+
41
46
  ## Scaffolding a Bun app
42
47
 
43
48
  `webjs create <name>` defaults to Node. Add `--runtime bun` for a Bun-flavored app (or run `bun create webjs <name>`, which auto-detects Bun from the invoking package manager):
@@ -25,7 +25,7 @@ This is what separates a working app from a broken one.
25
25
  native ES modules, so the source you run IS the source you read. When you
26
26
  need a precise API signature or behavior, open the package source under
27
27
  `node_modules/@webjsdev/*` directly (each package ships its own `AGENTS.md`).
28
- The full hosted docs are at https://docs.webjs.dev.
28
+ The full hosted docs are at https://webjs.dev/docs.
29
29
 
30
30
  {{PLAYBOOK}}
31
31
 
@@ -163,7 +163,7 @@ export default function Home() {
163
163
  app from here. The guide is <code class="text-[0.9em]">.agents/skills/webjs/SKILL.md</code>.
164
164
  </p>
165
165
  <nav class="flex items-center gap-5 text-sm opacity-70">
166
- <a href="https://docs.webjs.dev" target="_blank" rel="noopener" class="hover:opacity-100 transition-opacity no-underline">Docs</a>
166
+ <a href="https://webjs.dev/docs" target="_blank" rel="noopener" class="hover:opacity-100 transition-opacity no-underline">Docs</a>
167
167
  <a href="https://github.com/webjsdev/webjs" target="_blank" rel="noopener" class="hover:opacity-100 transition-opacity no-underline">GitHub</a>
168
168
  </nav>
169
169
  </div>