IF Commons GitHub

engine/handle

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-engine FR-009

A handle: what an extension is given to act with, and nothing more (commons data 0002-engine FR-009). A layer defines the handles it offers (the trace graph, the statements to emit, the files to write) with handle; a project provides a value for each with provide; an extension says in its manifest which it uses, and its activate can use only those. This is a discipline, not a sandbox: code that runs in the same process can import what it likes, and the layers check keeps it to public surfaces.

Source: commons/data/engine/handle.ts

2 of 6 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

Contextinterfaceno test imports it
interface Context

What activate is given.

MemberTypeWhat it is
use<T>(h: Handle<T>) => Result<T, HandleError>The value of a handle the manifest declared and the project provided.
Handleinterfaceno test imports it
interface Handle<T>

A handle: a named place for a value of type T, which the project provides.

MemberTypeWhat it is
name`${string}.${string}`The handle's name, a namespace and a name like a contribution point's.
__gives?TNever set: carries what the handle gives, for the compiler.
handlefunction
function handle<T>(name: `${string}.${string}`): Handle<T>

Declares a handle.

ParameterWhat it is
nameits namespace and name, such as physical.statements

Returns: the handle, frozen

Imported by 12 tests of the run (12 passed, 0 failed): the library's results

HandleErrortypeno test imports it
type HandleError =
  { readonly kind: "undeclared"; readonly handle: PointName } | { readonly kind: "unprovided"; readonly handle: PointName };

Why use gave nothing: the extension did not declare the handle, or the project did not provide it.

Providedinterfaceno test imports it
interface Provided

A value the project provides for a handle, made by provide.

MemberTypeWhat it is
name`${string}.${string}`
valueunknown
providefunction
function provide<T>(h: Handle<T>, value: T): Provided

Provides a value for a handle, typed by it.

ParameterWhat it is
hthe handle
valuewhat it gives

Returns: the provision, frozen

Imported by 12 tests of the run (12 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.