pub fn instantiate_provider_ts_expr(
provider_ctx: &str,
cap: &str,
unit_tables: &HashMap<String, UnitTable>,
unit_consumes: &HashMap<String, Vec<String>>,
unit_consumes_aliases: &HashMap<String, HashMap<String, String>>,
unit_flattened: &HashMap<String, HashMap<String, String>>,
namespaces: ProviderNamespaces<'_>,
env_ident: Option<&str>,
locale_negotiation: Option<&LocaleNegotiationArgs>,
referenced_units: &mut BTreeSet<String>,
) -> TsExprExpand description
namespaces selects the namespace convention (ProviderNamespaces): a
bodied provider’s class lives in {ns} under the bundle root,
handlers_{ns} in a Worker compose and __ns_{ns} in a test module;
external (binding) classes are {ns}__binding in the first two, and a
test module has none. When env_ident is set (workers), env-taking
first-party providers receive it as a constructor argument.
Locale capability track, slice 2 (#882): locale_negotiation, when
Some, is threaded to exactly the (bynk, LocaleProvider) pair, the same
way env_ident is threaded to provider_takes_env’s pairs — a small,
closed set of first-party providers that need ambient, request-scoped
construction data no ordinary given clause could express.
Originally a TsExpr-returning twin alongside a String-returning
instantiate_provider_expr (the same “structural converter added
alongside the String one” pattern Decision B already uses for
TypeRef -> TsType) — #1321 (Arc C slice 3): emitter::workers:: emit_worker_compose now builds a real TsProgram directly, and its own
cross-context capability-provider const {key} = {expr}; lines need a
real TsExpr, not a String to splice. workers.rs’s own
emit_worker_compose (Workers mode, workers_ns: true) and
emit_composition_root’s own Bundle-mode compose.ts (#1327, Arc C
slice 6, workers_ns: false) called this twin from the start. Originally
hardcoded workers_ns = true (the only mode emit_worker_compose’s own
call site used at the time) — #1327 restored the workers_ns: bool
parameter its then-String-returning sibling always had, matching that
signature exactly, once a second real caller needed false.
Arc F slice 2 (#1452): plan_agent_given_deps/native_platforms_of_context
(below in this file) repointed here too — instantiate_provider_expr
itself had no callers left and is deleted; its parameter-contract prose
and body rationale comments (below) moved here rather than being lost.