@webjsdev/server 0.8.29 → 0.8.30

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webjsdev/server",
3
- "version": "0.8.29",
3
+ "version": "0.8.30",
4
4
  "type": "module",
5
5
  "description": "webjs dev/prod server: SSR, router, API, server actions, live reload",
6
6
  "main": "index.js",
package/src/actions.js CHANGED
@@ -150,7 +150,7 @@ async function rpcResponse(payload, init = {}) {
150
150
  * module (the hash index is all the analysis needs; a module is imported on
151
151
  * demand by `invokeAction` / `serveActionStub`), so it is safe for a read-only
152
152
  * introspection caller (the MCP `list_actions` tool, #262) with no top-level
153
- * side effects (Prisma init, DB connect).
153
+ * side effects (DB driver init, DB connect).
154
154
  *
155
155
  * @param {string} appDir
156
156
  * @param {boolean} dev
@@ -181,7 +181,7 @@ export async function buildActionIndex(appDir, dev) {
181
181
  // Pure-RPC actions are NOT executed at boot: invokeAction and
182
182
  // serveActionStub import the module on demand (first RPC call / first stub
183
183
  // fetch), so the hash index above is all the analysis needs. Eagerly
184
- // running every server module (and its transitive Prisma init, DB
184
+ // running every server module (and its transitive DB driver init, DB
185
185
  // connects, etc.) would be wasted work.
186
186
  }
187
187
 
package/src/cache-fn.js CHANGED
@@ -8,7 +8,7 @@
8
8
  * import { cache } from '@webjsdev/server';
9
9
  *
10
10
  * export const listPosts = cache(
11
- * async () => prisma.post.findMany({ orderBy: { createdAt: 'desc' } }),
11
+ * async () => db.query.posts.findMany({ orderBy: { createdAt: 'desc' } }),
12
12
  * { key: 'posts', ttl: 60 }
13
13
  * );
14
14
  *
@@ -107,7 +107,7 @@ export function cache(fn, opts) {
107
107
  *
108
108
  * ```js
109
109
  * export async function createPost(input) {
110
- * await prisma.post.create({ data: input });
110
+ * await db.insert(posts).values(input);
111
111
  * await listPosts.invalidate();
112
112
  * }
113
113
  * ```
package/src/cache-tags.js CHANGED
@@ -104,7 +104,7 @@ export async function addKeyToTags(tags, cacheKey, ttlMs) {
104
104
  * 'use server';
105
105
  * import { revalidateTag } from '@webjsdev/server';
106
106
  * export async function createComment(input) {
107
- * await prisma.comment.create({ data: input });
107
+ * await db.insert(comments).values(input);
108
108
  * await revalidateTag('post:' + input.postId); // postById(postId) recomputes
109
109
  * return { success: true };
110
110
  * }
package/src/dev.js CHANGED
@@ -1353,16 +1353,18 @@ export async function createRequestHandler(opts) {
1353
1353
  * artefact dir (the #258 routes.d.ts and the vendor pin) that the dev server
1354
1354
  * itself writes on startup and on every rebuild, so without this skip the
1355
1355
  * write fires a watch event, triggers a rebuild, re-writes the file, and loops
1356
- * forever. `prisma/dev*` / `prisma/migrations` churn during db:migrate. The
1357
- * prisma branch is prefix-only (no trailing separator) so the SQLite sidecars
1358
- * `prisma/dev.db` / `prisma/dev.db-journal` match too; the others stay
1356
+ * forever. `db/dev.db*` (the SQLite file + sidecars) and `db/migrations`
1357
+ * (drizzle-kit output) churn during db:migrate. The `db/dev.db` branch is
1358
+ * prefix-only (no trailing separator) so the `-journal` / `-wal` sidecars match
1359
+ * too, while staying anchored to `db/dev.db` so a SOURCE file like
1360
+ * `db/schema.server.ts` still triggers a reload. The others stay
1359
1361
  * separator-anchored so an unrelated name like `node_modules.bak/foo` does not.
1360
1362
  *
1361
1363
  * @param {string} filename relative path from an fs.watch `event.filename`
1362
1364
  * @returns {boolean} true when the change should be ignored
1363
1365
  */
1364
1366
  export function shouldIgnoreWatchPath(filename) {
1365
- return /(?:^|[\\/])(?:node_modules|\.git|\.webjs)(?:[\\/]|$)|(?:^|[\\/])prisma[\\/](?:dev|migrations)/.test(filename || '');
1367
+ return /(?:^|[\\/])(?:node_modules|\.git|\.webjs)(?:[\\/]|$)|(?:^|[\\/])db[\\/](?:dev\.db|migrations)/.test(filename || '');
1366
1368
  }
1367
1369
 
1368
1370
  /**
@@ -1414,7 +1416,7 @@ export async function startServer(opts) {
1414
1416
  //
1415
1417
  // fs.watch returns relative paths in event.filename. `shouldIgnoreWatchPath`
1416
1418
  // (module-level, exported for tests) skips node_modules, .git, .webjs/, and
1417
- // prisma's dev artefacts so a file the dev server itself writes never loops.
1419
+ // the SQLite dev DB (db/dev.db) + db/migrations so a file the dev server itself writes never loops.
1418
1420
  const rebuild = debounce(() => app.rebuild(), 80);
1419
1421
  watcherAbort = new AbortController();
1420
1422
  (async () => {
package/src/env-schema.js CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * webjs auto-loads `<appDir>/.env` into `process.env` at boot, but does no
5
5
  * validation, so a missing or misconfigured required var (DATABASE_URL,
6
- * AUTH_SECRET, ...) fails late and cryptically (a Prisma connect error
6
+ * AUTH_SECRET, ...) fails late and cryptically (a database connect error
7
7
  * mid-request, an undefined secret signing a token). This module adds an
8
8
  * optional boot-time validation hook that fails fast with one clear message
9
9
  * listing EVERY missing or invalid var at once, before the app serves a
package/src/json.js CHANGED
@@ -9,7 +9,7 @@ import { readTextBounded, BodyLimitError, DEFAULT_MAX_BODY_BYTES } from './body-
9
9
  * // GET /api/posts
10
10
  * import { json } from '@webjsdev/server';
11
11
  * export async function GET() {
12
- * return json(await listPosts()); // plain Prisma rows with Date columns
12
+ * return json(await listPosts()); // plain Drizzle rows with Date columns
13
13
  * }
14
14
  *
15
15
  * The helper reads the in-flight Request from the AsyncLocalStorage
package/src/vendor.js CHANGED
@@ -409,7 +409,7 @@ async function jspmCall(installs, provider) {
409
409
  // A 5xx/429 is a transient jspm problem worth retrying. A 401/4xx
410
410
  // means at least one install is genuinely unresolvable (jspm uses
411
411
  // 401 for that): a private / workspace / server-only package (e.g.
412
- // @webjsdev/server, @prisma/client) the browser never fetches
412
+ // @webjsdev/server, better-sqlite3) the browser never fetches
413
413
  // anyway. Permanent failures must NOT block readiness.
414
414
  const transient = response.status >= 500 || response.status === 429;
415
415
  return { ok: false, imports: {}, transient };
@@ -2,8 +2,8 @@
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "$id": "https://webjs.dev/schemas/webjs-config.schema.json",
4
4
  "title": "webjs config block",
5
- "description": "Schema for the `webjs` object in a webjs app's package.json. Each key maps to a documented server reader. An unknown key is flagged (additionalProperties is false) so a typo no longer silently falls back to the default.",
6
- "$comment": "Single source of truth lives in THREE co-located places that must stay in lockstep: this schema, the TS type at packages/core/src/webjs-config.d.ts, and the server reader functions (readElideEnabled in dev.js, readSeedEnabled in dev.js, compileHeaderRules in headers.js, compileRedirectRules / readTrailingSlashPolicy in redirects.js, readBasePath in base-path.js, readCspConfig in csp.js, readBodyLimits / computeServerTimeouts in body-limit.js). Adding a webjs.* key means updating all three. See packages/server/AGENTS.md for the one documented procedure.",
5
+ "description": "Schema for the `webjs` object in a webjs app's package.json. Each key maps to a documented reader (a server reader, or for `dev`/`start` the CLI's readAppTasks). An unknown key is flagged (additionalProperties is false) so a typo no longer silently falls back to the default.",
6
+ "$comment": "Single source of truth lives in THREE co-located places that must stay in lockstep: this schema, the TS type at packages/core/src/webjs-config.d.ts, and the reader functions (readElideEnabled in dev.js, readSeedEnabled in dev.js, compileHeaderRules in headers.js, compileRedirectRules / readTrailingSlashPolicy in redirects.js, readBasePath in base-path.js, readCspConfig in csp.js, readBodyLimits / computeServerTimeouts in body-limit.js, and the CLI's readAppTasks in packages/cli/lib/app-tasks.js for dev/start, #550). Adding a webjs.* key means updating all three. See packages/server/AGENTS.md for the one documented procedure.",
7
7
  "type": "object",
8
8
  "additionalProperties": false,
9
9
  "properties": {
@@ -147,6 +147,35 @@
147
147
  "type": "integer",
148
148
  "minimum": 0,
149
149
  "default": 5000
150
+ },
151
+ "dev": {
152
+ "description": "Dev task orchestration (#550). Read by the CLI (readAppTasks in packages/cli/lib/app-tasks.js), NOT the server. webjs dev runs `before` (one-shot, e.g. webjs db migrate) to completion, then `parallel` (long-lived watchers, e.g. tailwindcss --watch) alongside the server. Replaces the old predev hook + concurrently watchers.",
153
+ "type": "object",
154
+ "additionalProperties": false,
155
+ "properties": {
156
+ "before": {
157
+ "description": "One-shot commands run sequentially to completion before the dev server boots. A non-zero exit aborts the boot.",
158
+ "type": "array",
159
+ "items": { "type": "string" }
160
+ },
161
+ "parallel": {
162
+ "description": "Long-lived commands run as child processes alongside the dev server, torn down on exit so a watcher cannot leak past it.",
163
+ "type": "array",
164
+ "items": { "type": "string" }
165
+ }
166
+ }
167
+ },
168
+ "start": {
169
+ "description": "Start task orchestration (#550). Read by the CLI (readAppTasks in packages/cli/lib/app-tasks.js), NOT the server. webjs start runs `before` (one-shot, e.g. webjs db migrate) to completion before serving. Replaces the old prestart hook.",
170
+ "type": "object",
171
+ "additionalProperties": false,
172
+ "properties": {
173
+ "before": {
174
+ "description": "One-shot commands run sequentially to completion before the prod server boots. A non-zero exit aborts the boot.",
175
+ "type": "array",
176
+ "items": { "type": "string" }
177
+ }
178
+ }
150
179
  }
151
180
  }
152
181
  }