@decohere/core 0.0.1-dev.20261106.224 → 0.0.1-dev.20261106.228

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.
@@ -21,6 +21,10 @@ export class Builder {
21
21
  this.containerBuilder = containerBuilder;
22
22
  this.applicationName = options?.applicationName;
23
23
  }
24
+ use(plugin) {
25
+ plugin(this);
26
+ return this;
27
+ }
24
28
  withServices(userServices) {
25
29
  this.userServices.push(userServices);
26
30
  return this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decohere/core",
3
- "version": "0.0.1-dev.20261106.224",
3
+ "version": "0.0.1-dev.20261106.228",
4
4
  "description": "The runtime base every Decohere package builds on: reflection, composition, configuration types, extensibility, collections, objects, caching on a Map, and basic file IO. No side effects on import.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -68,7 +68,7 @@
68
68
  "test": "echo \"Error: no test specified\" && exit 1"
69
69
  },
70
70
  "dependencies": {
71
- "@decohere/scribe": "0.0.1-dev.20261106.224",
71
+ "@decohere/scribe": "0.0.1-dev.20261106.228",
72
72
  "reflect-metadata": "^0.2.2"
73
73
  },
74
74
  "devDependencies": {}
@@ -6,6 +6,11 @@ import type { HostedService } from "./hosted-service.js";
6
6
  export type BuilderOptions = {
7
7
  applicationName?: string;
8
8
  };
9
+ /**
10
+ * A feature an app adds with `builder.use(...)`, such as `http(...)` or `config(...)`. A plugin is
11
+ * a plain function: it registers what it needs on the builder it gets.
12
+ */
13
+ export type BuilderPlugin = (builder: Builder) => void;
9
14
  export declare class Builder<T extends App = App> {
10
15
  /**
11
16
  * @param containerBuilder The container the app runs on: `new ServiceContainerBuilder()` from
@@ -20,6 +25,7 @@ export declare class Builder<T extends App = App> {
20
25
  private postBuildSteps;
21
26
  private readonly hostedServices;
22
27
  constructor(containerBuilder: ContainerBuilder, options?: BuilderOptions);
28
+ use(plugin: BuilderPlugin): this;
23
29
  withServices(userServices: (containerBuilder: ContainerBuilder) => void): Builder<T>;
24
30
  /**
25
31
  * Run {@link HostedService}s for the life of the app: started in this order before the
@@ -25,7 +25,7 @@ export interface HostedService {
25
25
  stop?(): Promise<void> | void;
26
26
  /**
27
27
  * Readiness while the service is started but still warming up: throw until it can serve, and
28
- * `GET /ready` answers 503 (`withHealth()`). Optional.
28
+ * `GET /ready` answers 503 (`health()`). Optional.
29
29
  */
30
30
  check?(): Promise<void>;
31
31
  }