How the tree-shaking transform works
mainThe transform converts the side-effect-heavy Closure output into a tree-shakeable format through several stages:
- Variable Conversion: Converts singly-assigned
$APP.p = rhsproperties into localvar p = rhsdeclarations. - Arity Folding: Folds contiguous arity installs (
p.h = ..) into pure IIFEs:var p = /* @__PURE__ */ (function(){var $self=..;..;return $self})(). - Type Constructor Merging: Merges type constructors with their prototype stamps into single
/* @__PURE__ */initializers. - Hoisting Cleanup: Converts hoisted
varnames with exactly one top-level assignment into declaration-at-assignment. - Statement Splitting: Splits multi-declarator
varstatements and folds remaining cursor segments into type initializers. - Pure Annotation: Marks remaining call/new initializers (dispatch-builders, singletons, etc.) with the
/* @__PURE__ */annotation.