@extk/expressive 0.10.0 → 0.10.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/README.md CHANGED
@@ -224,6 +224,17 @@ addRoute({
224
224
  }, handler);
225
225
  ```
226
226
 
227
+ Pass `enabled: false` to skip swagger registration conditionally without breaking the chain:
228
+
229
+ ```ts
230
+ .withSwagger(
231
+ b => b.withInfo({ title: 'My API', version: '1.0' }),
232
+ { path: '/api-docs', enabled: isDev() },
233
+ )
234
+ ```
235
+
236
+ When `enabled` is `false`, `withSwagger` is a no-op and the chain continues normally. Omitting `enabled` (or passing `true`) keeps existing behavior.
237
+
227
238
  Configure security schemes via the `configure` callback in `withSwagger`:
228
239
 
229
240
  ```ts
package/dist/index.d.mts CHANGED
@@ -229,6 +229,7 @@ type SwaggerRef = {
229
229
  };
230
230
  type ExpressiveSwaggerOptions = {
231
231
  path: ExpressRoute;
232
+ enabled?: boolean;
232
233
  uiOpts?: SwaggerUiOptions;
233
234
  options?: SwaggerOptions;
234
235
  customCss?: string;
package/dist/index.d.ts CHANGED
@@ -229,6 +229,7 @@ type SwaggerRef = {
229
229
  };
230
230
  type ExpressiveSwaggerOptions = {
231
231
  path: ExpressRoute;
232
+ enabled?: boolean;
232
233
  uiOpts?: SwaggerUiOptions;
233
234
  options?: SwaggerOptions;
234
235
  customCss?: string;
package/dist/index.js CHANGED
@@ -241,6 +241,7 @@ var ServerBuilder = class {
241
241
  return this;
242
242
  }
243
243
  withSwagger(configure, opts, ...handlers) {
244
+ if (opts.enabled === false) return this;
244
245
  const config = this.swaggerRef.doc;
245
246
  if (!config) throw new Error("withSwagger must be called before build()");
246
247
  configure(new SwaggerBuilder(config));
package/dist/index.mjs CHANGED
@@ -180,6 +180,7 @@ var ServerBuilder = class {
180
180
  return this;
181
181
  }
182
182
  withSwagger(configure, opts, ...handlers) {
183
+ if (opts.enabled === false) return this;
183
184
  const config = this.swaggerRef.doc;
184
185
  if (!config) throw new Error("withSwagger must be called before build()");
185
186
  configure(new SwaggerBuilder(config));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extk/expressive",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"