import type { Rolldown } from 'vite'; import type { MiniContract, MiniProjectSkeletonInput } from '../mini/mini-contract.ts'; /** * Generates the Alipay templates that project one React ownership tree through two independent native Page data roots. * * ## Native data ownership * * Every native Page owns `app`, the latest singleton App projection, and `page`, that Page instance's compact React root. The App * document broadcasts granular `app.*` payloads to mounted Pages while each Page writes only `page.*`. The two projections meet * at `vpt_page_outlet`; the Page Fiber remains beneath App `children` in React memory for context, lifecycle, refs, effects, * removal, and HMR, but Page compact nodes never enter the App payload. * * ## AXML execution * * ```text * Page AXML (owns app, page, and optional page-meta) * -> crosses both roots into one recursive component scope * -> comp.axml imports base.axml owns named-template lookup and event dispatch * -> tmpl_0_vpt_fragment(i, p) iterates the real compact App roots * -> stock templates(i, p) recursively render App descendants while forwarding p * -> tmpl_0_vpt_page_outlet(p) * -> taro_tmpl(root: p) renders this Page's compact children at the exact outlet * ``` * * Alipay supports recursive named-template calls, so both trees stay inside one `comp` instance and need neither WX's depth-reset * components nor a second Page-renderer component. `vpt_fragment` adapts zero, one, or many App roots to `comp`'s one-node `i` * contract. It has no Fiber, sid, event source, ref, lifecycle, or native layout; only its real `cn` entries are keyed by sid. * The outlet is equally transparent and adds no native layout node. * * Every named `