Written to: 5 requirements: 5 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-engine FR-005, 0002-engine FR-006, 0002-engine FR-007, 0002-engine FR-008, 0002-engine FR-009
Composition (commons data 0002-engine FR-005 to FR-009): a project passes its extensions, an explicit list, to compose, which puts them in an order that satisfies requires (the project's own order where requires does not decide), finds every mistake in the list and returns it as a value, and gives back a Composition. The composition answers contributions(point) (what a layer needs of its extensions reaches it as a value, in order), starts the extensions that are not lazy, and activates a lazy one when fire is given one of its events, once, even when two events fire at once.
The engine keeps no registry: everything is in the composition compose returns, and nothing registers by being imported. An activation that failed stays failed in its composition.
Source: commons/data/engine/compose.ts
3 of 5 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.
ActivationErrortypeno test imports ittype ActivationError =
| { readonly kind: "failed"; readonly id: ExtensionId; readonly message: string }
| { readonly kind: "mismatch"; readonly id: ExtensionId; readonly loaded: string }
| { readonly kind: "contract"; readonly id: ExtensionId; readonly wanted: number; readonly have: number }
| { readonly kind: "handle"; readonly id: ExtensionId; readonly error: HandleError };
Why an extension did not activate.
type ComposeError =
| { readonly kind: "duplicate"; readonly id: ExtensionId }
| { readonly kind: "missing"; readonl… (443 characters)
type ComposeError =
| { readonly kind: "duplicate"; readonly id: ExtensionId }
| { readonly kind: "missing"; readonly id: ExtensionId; readonly requiredBy: ExtensionId }
| { readonly kind: "cycle"; readonly nodes: readonly ExtensionId[] }
| { readonly kind: "contract"; readonly id: ExtensionId; readonly wanted: number; readonly have: number }
| { readonly kind: "unprovided"; readonly id: ExtensionId; readonly handle: PointName };
What is wrong with a list of extensions; compose returns all of it together.
Imported by 5 tests of the run (5 passed, 0 failed): the library's results
ComposeOptionsinterfaceno test imports itinterface ComposeOptions
What a project gives compose besides the list.
| Member | Type | What it is |
|---|
provided? | readonly Provided[] | The values for the handles the extensions use. |
interface Composition
The extensions of a project, in order, and what they add.
| Member | Type | What it is |
|---|
order | readonly ExtensionId[] | The identifiers in the order that satisfies requires. |
contributions | <T>(point: ContributionPoint<T>) => readonly T[] | What the extensions contribute to a point, in order: those that are not lazy at once, a lazy one once it is activated. |
start | () => Promise<Result<readonly ExtensionId[], readonly ActivationError[]>> | Activates the extensions that are not lazy, in order, once each; gives the identifiers it activated now. |
fire | (event: `${string}:${string}`) => Promise<Result<readonly ExtensionId[], readonly ActivationError[]>> | Activates the lazy extensions that an event starts, after what they require, once each; gives the identifiers it activated now. |
activated | () => readonly ExtensionId[] | The identifiers activated so far, in the order they were. |
Imported by 7 tests of the run (7 passed, 0 failed): the library's results
function compose(entries: readonly Entry[], options?: ComposeOptions): Result<Composition, readonly ComposeError[]>
Composes a project's extensions.
| Parameter | What it is |
|---|
entries | the extensions, the project's list |
options | the values for the handles they use |
Returns: the composition, or everything that is wrong with the list
Imported by 99 tests of the run (99 passed, 0 failed): the library's results