@webjsdev/core 0.7.46 → 0.7.48

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.
@@ -7,22 +7,18 @@
7
7
  * import type { WebjsConfig } from '@webjsdev/core';
8
8
  * const config: WebjsConfig = { trailingSlash: 'never', csp: true };
9
9
  *
10
- * The server reads this object key by key. Without a type or schema a
11
- * typo'd key (e.g. `redirect` for `redirects`) was silently dropped and
12
- * the feature stayed at its default with no diagnostic. This type plus
13
- * the published JSON Schema close that gap.
10
+ * This object is read key by key, mostly by the server and for a few keys
11
+ * by the CLI. Without a type or schema a typo'd key (e.g. `redirect` for
12
+ * `redirects`) was silently dropped and the feature stayed at its default
13
+ * with no diagnostic. This type plus the published JSON Schema close that
14
+ * gap.
14
15
  *
15
16
  * LOCKSTEP: this file, the JSON Schema at
16
- * packages/server/webjs-config.schema.json, and the server reader
17
- * functions MUST stay in sync. The readers are: readElideEnabled
18
- * (dev.js, elide), readSeedEnabled (dev.js, seed), readClientRouterEnabled
19
- * (dev.js, clientRouter), compileHeaderRules (headers.js, headers),
20
- * compileRedirectRules / readTrailingSlashPolicy (redirects.js,
21
- * redirects / trailingSlash), readBasePath (base-path.js, basePath),
22
- * readCspConfig (csp.js, csp), and
23
- * readBodyLimits / computeServerTimeouts (body-limit.js, the byte caps
24
- * and timeouts). Adding a `webjs.*` key means updating all three places.
25
- * See packages/server/AGENTS.md for the one documented procedure.
17
+ * packages/server/webjs-config.schema.json, and the reader functions MUST
18
+ * stay in sync, so adding a `webjs.*` key means updating all three places
19
+ * (plus the KNOWN_KEYS drift test). The reader inventory is NOT repeated
20
+ * here on purpose: packages/server/AGENTS.md holds the one canonical list
21
+ * along with the procedure, and every copy of it that existed drifted.
26
22
  *
27
23
  * Every key is optional (the whole block is optional and every key has a
28
24
  * default). Zero runtime cost: nothing in this file ships to the browser.
@@ -91,18 +87,19 @@ export interface WebjsRegenerateRule {
91
87
  inputs?: string[];
92
88
  }
93
89
 
94
- /** Dev task orchestration in `webjs.dev` (#550). `before`/`parallel` read by the CLI, `regenerate` by the server. */
90
+ /** Dev task orchestration in `webjs.dev` (#550). `before`/`parallel` read by the CLI, `regenerate` and `watch` by the server (each sub-key names its own reader below). */
95
91
  export interface WebjsDevTasks {
96
92
  /**
97
93
  * One-shot commands run sequentially to completion BEFORE the dev server
98
94
  * boots (the old `predev` hook: `webjs db migrate`, a registry copy). A
99
- * non-zero exit aborts the boot.
95
+ * non-zero exit aborts the boot. Read by the CLI (`readAppTasks`).
100
96
  */
101
97
  before?: string[];
102
98
  /**
103
99
  * Long-lived commands run as child processes ALONGSIDE the dev server (the
104
100
  * old `concurrently` watchers). Spawned once in the parent and torn down on
105
- * exit, so a watcher cannot leak past the server.
101
+ * exit, so a watcher cannot leak past the server. Read by the CLI
102
+ * (`readAppTasks`).
106
103
  */
107
104
  parallel?: string[];
108
105
  /**
@@ -136,6 +133,34 @@ export interface WebjsStartTasks {
136
133
  before?: string[];
137
134
  }
138
135
 
136
+ /**
137
+ * A severity a `webjs.doctor.gate` entry may declare, mirroring ESLint's
138
+ * three-level scale. `error` fails the `webjs doctor` exit, `warn` reports
139
+ * without failing, and `off` silences the check: its finding is not printed and
140
+ * it cannot fail the exit, including under `--strict`. A silenced check still
141
+ * appears on the checklist as `[off]` and in the summary's silenced count, and
142
+ * `--json` still carries its whole result.
143
+ */
144
+ export type WebjsDoctorSeverity = 'off' | 'warn' | 'error';
145
+
146
+ /** The object form of `webjs.doctor` (#1257). */
147
+ export interface WebjsDoctorConfig {
148
+ /**
149
+ * Per-check severity, keyed by the stable doctor code (`NODE_VERSION`,
150
+ * `UNMARKED_ASSET_LINKS`, `ELISION_CARRIERS`, and so on; `webjs doctor --json`
151
+ * carries the code on every result). A code with no entry keeps its default:
152
+ * `error` for a hard toolchain failure, `warn` otherwise. This is how CI gates
153
+ * on a chosen subset without `--strict` making every warning fatal.
154
+ *
155
+ * A malformed gate is a hard error, so a typo cannot silently un-gate CI:
156
+ * that covers an unknown code, a bad severity, a wrong SHAPE (a non-object
157
+ * `doctor` or `gate`), and a misspelled sibling of `gate` such as `gates`.
158
+ * A result that could not check (a network or toolchain outage) is capped at
159
+ * `warn` and can never be escalated to `error`.
160
+ */
161
+ gate?: Record<string, WebjsDoctorSeverity>;
162
+ }
163
+
139
164
  /** The object form of `webjs.csp` (the non-boolean shape). */
140
165
  export interface WebjsCspConfig {
141
166
  /**
@@ -191,6 +216,13 @@ export interface WebjsConfig {
191
216
  dev?: WebjsDevTasks;
192
217
  start?: WebjsStartTasks;
193
218
 
219
+ /**
220
+ * `webjs doctor` policy (#1257): which project-health checks the project
221
+ * treats as fatal. Read by the CLI (`packages/cli/lib/doctor.js`), NOT the
222
+ * server readers.
223
+ */
224
+ doctor?: WebjsDoctorConfig;
225
+
194
226
  /** Per-path response-header rules, shaped like Next's. */
195
227
  headers?: WebjsHeaderRule[];
196
228