Expand description
The commons barrel: an aggregating out/<name>.ts for a multi-file commons or context.
Production output (#1820): a multi-file context’s barrel is part of a production bundle
build, so it lives here and not in testgen. Moved out of the test-harness generator
unchanged (1B.2a, #4028).
Functions§
- duplicated_
export_ reexports - #1820: the explicit re-exports a multi-file context’s barrel needs where
two or more of its files’ modules export one name. User names are unique
across a unit, but each file emits its own copy of what its declarations
need from outside it: the context’s rebrand of a
usesd commons type, that commons type’s codecs re-exported, a boundary type’s codecs (wherever the type is declared). Each copy is a function of the type alone, so the barrel re-exports the name from the first module (sorted by path) that exports it, which takes precedence overexport *; without it,export *is ambiguous (TS2308) and drops the name at runtime.mergednames the helpers the barrel defines itself (merged_unit_helpers), which are skipped. - emit_
commons_ barrel - v0.132: an aggregating barrel for a commons split across a directory.
- emit_
worker_ handlers_ barrel - #1820:
handlers.tsfor a context split across files, on Workers. It re-exports each file’s module, so the Worker’s entry point, its composition root and every consuming context see the context as one module, as they do a single-file context’shandlers.ts. Like a multi-file unit’s test barrel (emit_commons_barrel), it also defines the merged helpers each file generates for itself (merged_unit_helpers), whichexport *alone would leave ambiguous: only__resetAgents, since a Worker’s files export no surface. - merged_
unit_ helpers - #1844 review: the barrel’s own definitions of the helpers every file of a
multi-file context generates for itself. User names are unique across a
unit, but these are not: each file with agents exports
__resetAgents(over its own agents), and each file with services exports__makeSurfaceand the context’s__<Ctx>Deps(over its own services). Two files of either kind made the barrel’sexport *ambiguous (TS2308), and at runtime the ambiguous name is dropped from the namespace, so a test’s__resetAgents()wasundefined. Where two or more files contribute one, the barrel exports a merged definition, which takes precedence over the star exports: reset every file’s agents; combine every file’s surface over the intersection of their deps.