@flanksource/page-runtime 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vitest/gavel-reporter-3e3dfb64eda19344.mjs +59 -0
- package/.vitest/vitest-report-root-1793958008919344000.json +1 -0
- package/.vitest/vitest-report-root-1793958052786561000.json +1 -0
- package/.vitest/vitest-report-root-1793958143511414000.json +1 -0
- package/.vitest/vitest-report-root-1793958185908019000.json +1 -0
- package/.vitest/vitest-report-root-1793958252687550000.json +1 -0
- package/.vitest/vitest-report-root-1793958260385388000.json +1 -0
- package/.vitest/vitest-report-root-1793958312358683000.json +1 -0
- package/.vitest/vitest-report-root-1793958386118791000.json +1 -0
- package/.vitest/vitest-report-root-1793958388712140000.json +1 -0
- package/.vitest/vitest-report-root-1793958429135603000.json +1 -0
- package/.vitest/vitest-report-root-1793958433387809000.json +1 -0
- package/.vitest/vitest-report-root-1793958517322792000.json +1 -0
- package/.vitest/vitest-report-root-1793958542332252000.json +1 -0
- package/.vitest/vitest-report-root-1793958617698698000.json +1 -0
- package/.vitest/vitest-report-root-1793958676587753000.json +1 -0
- package/.vitest/vitest-report-root-1793958707827469000.json +1 -0
- package/.vitest/vitest-report-root-1793958729745028000.json +1 -0
- package/.vitest/vitest-report-root-1793958736696408000.json +1 -0
- package/.vitest/vitest-report-root-1793958740449993000.json +1 -0
- package/.vitest/vitest-report-root-1793958841510921000.json +1 -0
- package/.vitest/vitest-report-root-1793958847664582000.json +1 -0
- package/.vitest/vitest-report-root-1793958900327643000.json +1 -0
- package/.vitest/vitest-report-root-1793958950822823000.json +1 -0
- package/.vitest/vitest-report-root-1793959013655262000.json +1 -0
- package/.vitest/vitest-report-root-1793959017905881000.json +1 -0
- package/.vitest/vitest-report-root-1793959093169044000.json +1 -0
- package/.vitest/vitest-report-root-1793959093978087000.json +1 -0
- package/.vitest/vitest-report-root-1793959101111925000.json +1 -0
- package/.vitest/vitest-report-root-1793959145317906000.json +1 -0
- package/.vitest/vitest-report-root-1793959190760607000.json +1 -0
- package/.vitest/vitest-report-root-1793959249695805000.json +1 -0
- package/.vitest/vitest-report-root-1793959323191511000.json +1 -0
- package/.vitest/vitest-report-root-1793959453311564000.json +1 -0
- package/.vitest/vitest-report-root-1793959495806182000.json +1 -0
- package/.vitest/vitest-report-root-1793959499945435000.json +1 -0
- package/.vitest/vitest-report-root-1793959546773807000.json +1 -0
- package/.vitest/vitest-report-root-1793959583335593000.json +1 -0
- package/.vitest/vitest-report-root-1793959621479504000.json +1 -0
- package/.vitest/vitest-report-root-1793959651002360000.json +1 -0
- package/.vitest/vitest-report-root-1793959655646061000.json +1 -0
- package/.vitest/vitest-report-root-1793959741176826000.json +1 -0
- package/.vitest/vitest-report-root-1793959744743733000.json +1 -0
- package/.vitest/vitest-report-root-1793959833244182000.json +1 -0
- package/.vitest/vitest-report-root-1793959882131751000.json +1 -0
- package/.vitest/vitest-report-root-1793959887033254000.json +1 -0
- package/.vitest/vitest-report-root-1793960000631977000.json +1 -0
- package/.vitest/vitest-report-root-1793960011938504000.json +1 -0
- package/.vitest/vitest-report-root-1793961370018852000.json +1 -0
- package/.vitest/vitest-report-root-1793961745370827000.json +1 -0
- package/.vitest/vitest-report-root-1793961764143180000.json +1 -0
- package/.vitest/vitest-report-root-1793961835963066000.json +1 -0
- package/.vitest/vitest-report-root-1793961890729922000.json +1 -0
- package/.vitest/vitest-report-root-1793961968680074000.json +1 -0
- package/.vitest/vitest-report-root-1793962066862337000.json +1 -0
- package/.vitest/vitest-report-root-1793962087917497000.json +1 -0
- package/.vitest/vitest-report-root-1793962157254386000.json +1 -0
- package/.vitest/vitest-report-root-1793962171214865000.json +1 -0
- package/.vitest/vitest-report-root-1793962183290533000.json +1 -0
- package/.vitest/vitest-report-root-1793962184809932000.json +1 -0
- package/.vitest/vitest-report-root-1793962197715204000.json +1 -0
- package/.vitest/vitest-report-root-1793962244650717000.json +1 -0
- package/.vitest/vitest-report-root-1793962259802273000.json +1 -0
- package/.vitest/vitest-report-root-1793962278799745000.json +1 -0
- package/.vitest/vitest-report-root-1793962304412974000.json +1 -0
- package/.vitest/vitest-report-root-1793962328411454000.json +1 -0
- package/.vitest/vitest-report-root-1793962355747869000.json +1 -0
- package/.vitest/vitest-report-root-1793962381401572000.json +1 -0
- package/.vitest/vitest-report-root-1793962393326735000.json +1 -0
- package/.vitest/vitest-report-root-1793962393329206000.json +1 -0
- package/.vitest/vitest-report-root-1793962437796768000.json +1 -0
- package/.vitest/vitest-report-root-1793962444190384000.json +1 -0
- package/.vitest/vitest-report-root-1793962445347541000.json +1 -0
- package/.vitest/vitest-report-root-1793962473691143000.json +1 -0
- package/.vitest/vitest-report-root-1793962474291457000.json +1 -0
- package/.vitest/vitest-report-root-1793962499680468000.json +1 -0
- package/.vitest/vitest-report-root-1793962504410483000.json +1 -0
- package/.vitest/vitest-report-root-1793962516850524000.json +1 -0
- package/.vitest/vitest-report-root-1793962536736273000.json +1 -0
- package/.vitest/vitest-report-root-1793962551181783000.json +1 -0
- package/.vitest/vitest-report-root-1793962553575620000.json +1 -0
- package/.vitest/vitest-report-root-1793962555169730000.json +1 -0
- package/.vitest/vitest-report-root-1793962572639765000.json +1 -0
- package/.vitest/vitest-report-root-1793962597102952000.json +1 -0
- package/.vitest/vitest-report-root-1793962637156669000.json +1 -0
- package/.vitest/vitest-report-root-1793962653530027000.json +1 -0
- package/.vitest/vitest-report-root-1793962665824334000.json +1 -0
- package/.vitest/vitest-report-root-1793962682161714000.json +1 -0
- package/.vitest/vitest-report-root-1793962719526168000.json +1 -0
- package/.vitest/vitest-report-root-1793962723853934000.json +1 -0
- package/.vitest/vitest-report-root-1793962741927728000.json +1 -0
- package/.vitest/vitest-report-root-1793962794308371000.json +1 -0
- package/.vitest/vitest-report-root-1793962796334481000.json +1 -0
- package/.vitest/vitest-report-root-1793962798075169000.json +1 -0
- package/.vitest/vitest-report-root-1793962836466676000.json +1 -0
- package/.vitest/vitest-report-root-1793962846507317000.json +1 -0
- package/.vitest/vitest-report-root-1793962876266701000.json +1 -0
- package/.vitest/vitest-report-root-1793962922031308000.json +1 -0
- package/.vitest/vitest-report-root-1793962932957166000.json +1 -0
- package/.vitest/vitest-report-root-1793962946930725000.json +1 -0
- package/.vitest/vitest-report-root-1793963027896350000.json +1 -0
- package/.vitest/vitest-report-root-1793963036618707000.json +1 -0
- package/.vitest/vitest-report-root-1793963067365318000.json +1 -0
- package/.vitest/vitest-report-root-1793963077597641000.json +1 -0
- package/.vitest/vitest-report-root-1793963126365651000.json +1 -0
- package/.vitest/vitest-report-root-1793963208744553000.json +1 -0
- package/.vitest/vitest-report-root-1793963232806450000.json +1 -0
- package/.vitest/vitest-report-root-1793963325077422000.json +1 -0
- package/.vitest/vitest-report-root-1793963392172877000.json +1 -0
- package/.vitest/vitest-report-root-1793963398218324000.json +1 -0
- package/.vitest/vitest-report-root-1793963410749092000.json +1 -0
- package/.vitest/vitest-report-root-1793963437279580000.json +1 -0
- package/.vitest/vitest-report-root-1793963450096193000.json +1 -0
- package/.vitest/vitest-report-root-1793963478908641000.json +1 -0
- package/.vitest/vitest-report-root-1793963507838465000.json +1 -0
- package/.vitest/vitest-report-root-1793963528668174000.json +1 -0
- package/.vitest/vitest-report-root-1793963601860390000.json +1 -0
- package/.vitest/vitest-report-root-1793963611633446000.json +1 -0
- package/.vitest/vitest-report-root-1793963624713406000.json +1 -0
- package/.vitest/vitest-report-root-1793963680656685000.json +1 -0
- package/.vitest/vitest-report-root-1793963705231851000.json +1 -0
- package/.vitest/vitest-report-root-1793963708929500000.json +1 -0
- package/.vitest/vitest-report-root-1793963710267844000.json +1 -0
- package/.vitest/vitest-report-root-1793963713999248000.json +1 -0
- package/.vitest/vitest-report-root-1793963786513455000.json +1 -0
- package/.vitest/vitest-report-root-1793963792518765000.json +1 -0
- package/.vitest/vitest-report-root-1793963804089549000.json +1 -0
- package/.vitest/vitest-report-root-1793963840412921000.json +1 -0
- package/.vitest/vitest-report-root-1793963880361176000.json +1 -0
- package/.vitest/vitest-report-root-1793963935121106000.json +1 -0
- package/.vitest/vitest-report-root-1793963937290698000.json +1 -0
- package/.vitest/vitest-report-root-1793963977050773000.json +1 -0
- package/.vitest/vitest-report-root-1793963981229158000.json +1 -0
- package/.vitest/vitest-report-root-1793963989422080000.json +1 -0
- package/.vitest/vitest-report-root-1793964025924629000.json +1 -0
- package/.vitest/vitest-report-root-1793964027983705000.json +1 -0
- package/.vitest/vitest-report-root-1793964059969386000.json +1 -0
- package/.vitest/vitest-report-root-1793964071524069000.json +1 -0
- package/.vitest/vitest-report-root-1793964076285860000.json +1 -0
- package/.vitest/vitest-report-root-1793964077988100000.json +1 -0
- package/.vitest/vitest-report-root-1793964093289042000.json +1 -0
- package/.vitest/vitest-report-root-1793964102899356000.json +1 -0
- package/.vitest/vitest-report-root-1793964128089691000.json +1 -0
- package/.vitest/vitest-report-root-1793964129495156000.json +1 -0
- package/.vitest/vitest-report-root-1793964182849665000.json +1 -0
- package/.vitest/vitest-report-root-1793964223959893000.json +1 -0
- package/.vitest/vitest-report-root-1793964253351716000.json +1 -0
- package/.vitest/vitest-report-root-1793964290220122000.json +1 -0
- package/.vitest/vitest-report-root-1793964318037006000.json +1 -0
- package/.vitest/vitest-report-root-1793964334676691000.json +1 -0
- package/.vitest/vitest-report-root-1793964378520677000.json +1 -0
- package/.vitest/vitest-report-root-1793964383748994000.json +1 -0
- package/.vitest/vitest-report-root-1793964394042303000.json +1 -0
- package/.vitest/vitest-report-root-1793964466521881000.json +1 -0
- package/.vitest/vitest-report-root-1793964470478175000.json +1 -0
- package/.vitest/vitest-report-root-1793964484499019000.json +1 -0
- package/.vitest/vitest-report-root-1793964527645213000.json +1 -0
- package/.vitest/vitest-report-root-1793964608875865000.json +1 -0
- package/.vitest/vitest-report-root-1793964623608336000.json +1 -0
- package/.vitest/vitest-report-root-1793964629870846000.json +1 -0
- package/.vitest/vitest-report-root-1793964674515564000.json +1 -0
- package/.vitest/vitest-report-root-1793964706923651000.json +1 -0
- package/.vitest/vitest-report-root-1793964712832942000.json +1 -0
- package/.vitest/vitest-report-root-1793964714824633000.json +1 -0
- package/.vitest/vitest-report-root-1793964755433952000.json +1 -0
- package/.vitest/vitest-report-root-1793964783157670000.json +1 -0
- package/.vitest/vitest-report-root-1793964818963246000.json +1 -0
- package/.vitest/vitest-report-root-1793964843818548000.json +1 -0
- package/.vitest/vitest-report-root-1793964929824204000.json +1 -0
- package/.vitest/vitest-report-root-1793964973060713000.json +1 -0
- package/.vitest/vitest-report-root-1793964983122482000.json +1 -0
- package/.vitest/vitest-report-root-1793965107264567000.json +1 -0
- package/.vitest/vitest-report-root-1793965258759177000.json +1 -0
- package/.vitest/vitest-report-root-1793965277212091000.json +1 -0
- package/.vitest/vitest-report-root-1793965420648188000.json +1 -0
- package/.vitest/vitest-report-root-1793965611688414000.json +1 -0
- package/.vitest/vitest-report-root-1793965753407694000.json +1 -0
- package/.vitest/vitest-report-root-1793965766104309000.json +1 -0
- package/.vitest/vitest-report-root-1793965766823098000.json +1 -0
- package/.vitest/vitest-report-root-1793965806066109000.json +1 -0
- package/.vitest/vitest-report-root-1793965824697182000.json +1 -0
- package/.vitest/vitest-report-root-1793965904374564000.json +1 -0
- package/.vitest/vitest-report-root-1793965920838340000.json +1 -0
- package/.vitest/vitest-report-root-1793965932520617000.json +1 -0
- package/.vitest/vitest-report-root-1793965971574656000.json +1 -0
- package/.vitest/vitest-report-root-1793966049815024000.json +1 -0
- package/.vitest/vitest-report-root-1793966057888034000.json +1 -0
- package/.vitest/vitest-report-root-1793966066838868000.json +1 -0
- package/.vitest/vitest-report-root-1793966160347764000.json +1 -0
- package/.vitest/vitest-report-root-1793966196305985000.json +1 -0
- package/.vitest/vitest-report-root-1793966221538043000.json +1 -0
- package/.vitest/vitest-report-root-1793966251519918000.json +1 -0
- package/.vitest/vitest-report-root-1793966447000588000.json +1 -0
- package/.vitest/vitest-report-root-1793966463178249000.json +1 -0
- package/.vitest/vitest-report-root-1793966486995648000.json +1 -0
- package/.vitest/vitest-report-root-1793966726756953000.json +1 -0
- package/.vitest/vitest-report-root-1793966763656807000.json +1 -0
- package/.vitest/vitest-report-root-1793966979409799000.json +1 -0
- package/.vitest/vitest-report-root-1793967385250149000.json +1 -0
- package/.vitest/vitest-report-root-1793967617080163000.json +1 -0
- package/.vitest/vitest-report-root-1793967649428508000.json +1 -0
- package/.vitest/vitest-report-root-1793967773689520000.json +1 -0
- package/.vitest/vitest-report-root-1793968743743508000.json +1 -0
- package/.vitest/vitest-report-root-1793968846470407000.json +1 -0
- package/.vitest/vitest-report-root-1793968880878391000.json +1 -0
- package/.vitest/vitest-report-root-1793969027713529000.json +1 -0
- package/.vitest/vitest-report-root-1793969041841266000.json +1 -0
- package/.vitest/vitest-report-root-1793969142007468000.json +1 -0
- package/.vitest/vitest-report-root-1793969164867379000.json +1 -0
- package/.vitest/vitest-report-root-1793969193145858000.json +1 -0
- package/.vitest/vitest-report-root-1793969246818533000.json +1 -0
- package/.vitest/vitest-report-root-1793969270845486000.json +1 -0
- package/.vitest/vitest-report-root-1793969272514219000.json +1 -0
- package/.vitest/vitest-report-root-1793969302476105000.json +1 -0
- package/.vitest/vitest-report-root-1793969401697799000.json +1 -0
- package/.vitest/vitest-report-root-1793969433222630000.json +1 -0
- package/.vitest/vitest-report-root-1793969453350714000.json +1 -0
- package/.vitest/vitest-report-root-1793969567187400000.json +1 -0
- package/.vitest/vitest-report-root-1793969602230024000.json +1 -0
- package/.vitest/vitest-report-root-1793969633261063000.json +1 -0
- package/.vitest/vitest-report-root-1793969673876404000.json +1 -0
- package/.vitest/vitest-report-root-1793969702287010000.json +1 -0
- package/.vitest/vitest-report-root-1793969745828386000.json +1 -0
- package/.vitest/vitest-report-root-1793969893687205000.json +1 -0
- package/.vitest/vitest-report-root-1793969949642120000.json +1 -0
- package/.vitest/vitest-report-root-1793969981399076000.json +1 -0
- package/.vitest/vitest-report-root-1793970027152713000.json +1 -0
- package/.vitest/vitest-report-root-1793970030585158000.json +1 -0
- package/.vitest/vitest-report-root-1793970160195767000.json +1 -0
- package/.vitest/vitest-report-root-1793970215752422000.json +1 -0
- package/.vitest/vitest-report-root-1793970217114968000.json +1 -0
- package/.vitest/vitest-report-root-1793970329879319000.json +1 -0
- package/.vitest/vitest-report-root-1793970590586994000.json +1 -0
- package/.vitest/vitest-report-root-1793970625359990000.json +1 -0
- package/.vitest/vitest-report-root-1793970672590269000.json +1 -0
- package/.vitest/vitest-report-root-1793970796789022000.json +1 -0
- package/.vitest/vitest-report-root-1793970825710990000.json +1 -0
- package/.vitest/vitest-report-root-1793970884000509000.json +1 -0
- package/.vitest/vitest-report-root-1793970900444617000.json +1 -0
- package/.vitest/vitest-report-root-1793972186024681000.json +1 -0
- package/.vitest/vitest-report-root-1793972227757396000.json +1 -0
- package/.vitest/vitest-report-root-1793972736341600000.json +1 -0
- package/.vitest/vitest-report-root-1793972769249562000.json +1 -0
- package/.vitest/vitest-report-root-1793972859435283000.json +1 -0
- package/.vitest/vitest-report-root-1793972915169294000.json +1 -0
- package/.vitest/vitest-report-root-1793973081515450000.json +1 -0
- package/.vitest/vitest-report-root-1793973111336773000.json +1 -0
- package/.vitest/vitest-report-root-1793973253986969000.json +1 -0
- package/.vitest/vitest-report-root-1793973561283775000.json +1 -0
- package/.vitest/vitest-report-root-1793973593320977000.json +1 -0
- package/.vitest/vitest-report-root-1793973648302867000.json +1 -0
- package/.vitest/vitest-report-root-1793973819657242000.json +1 -0
- package/.vitest/vitest-report-root-1793973952727311000.json +1 -0
- package/.vitest/vitest-report-root-1793974334455876000.json +1 -0
- package/.vitest/vitest-report-root-1793974437074196000.json +1 -0
- package/.vitest/vitest-report-root-1793974437553146000.json +1 -0
- package/.vitest/vitest-report-root-1793974461818626000.json +1 -0
- package/.vitest/vitest-report-root-1793974515255198000.json +1 -0
- package/.vitest/vitest-report-root-1793974516267191000.json +1 -0
- package/.vitest/vitest-report-root-1793974621202824000.json +1 -0
- package/.vitest/vitest-report-root-1793974718450330000.json +1 -0
- package/.vitest/vitest-report-root-1793974834942373000.json +1 -0
- package/.vitest/vitest-report-root-1793974921367314000.json +1 -0
- package/.vitest/vitest-report-root-1793975019367156000.json +1 -0
- package/.vitest/vitest-report-root-1793975048166096000.json +1 -0
- package/.vitest/vitest-report-root-1793975133024339000.json +1 -0
- package/.vitest/vitest-report-root-1793975159711704000.json +1 -0
- package/.vitest/vitest-report-root-1793975517481736000.json +1 -0
- package/.vitest/vitest-report-root-1793975680008825000.json +1 -0
- package/.vitest/vitest-report-root-1793976067648494000.json +1 -0
- package/.vitest/vitest-report-root-1793976314122479000.json +1 -0
- package/.vitest/vitest-report-root-1793976513022402000.json +1 -0
- package/.vitest/vitest-report-root-1793976540410805000.json +1 -0
- package/.vitest/vitest-report-root-1793976555103273000.json +1 -0
- package/.vitest/vitest-report-root-1793976702974407000.json +1 -0
- package/.vitest/vitest-report-root-1793976721093108000.json +1 -0
- package/.vitest/vitest-report-root-1793976955473681000.json +1 -0
- package/.vitest/vitest-report-root-1793977049628483000.json +1 -0
- package/.vitest/vitest-report-root-1793977098467804000.json +1 -0
- package/.vitest/vitest-report-root-1793977132144900000.json +1 -0
- package/.vitest/vitest-report-root-1793977279648191000.json +1 -0
- package/.vitest/vitest-report-root-1793977365312127000.json +1 -0
- package/.vitest/vitest-report-root-1793978227796817000.json +1 -0
- package/.vitest/vitest-report-root-1793978255189735000.json +1 -0
- package/.vitest/vitest-report-root-1793978306509070000.json +1 -0
- package/.vitest/vitest-report-root-1793978418301216000.json +1 -0
- package/.vitest/vitest-report-root-1793978445072573000.json +1 -0
- package/.vitest/vitest-report-root-1793978546605517000.json +1 -0
- package/.vitest/vitest-report-root-1793978576060950000.json +1 -0
- package/.vitest/vitest-report-root-1793978590261408000.json +1 -0
- package/.vitest/vitest-report-root-1793978674733179000.json +1 -0
- package/.vitest/vitest-report-root-1793978718588785000.json +1 -0
- package/.vitest/vitest-report-root-1793978725363453000.json +1 -0
- package/.vitest/vitest-report-root-1793978729967285000.json +1 -0
- package/.vitest/vitest-report-root-1793978755641607000.json +1 -0
- package/.vitest/vitest-report-root-1793978782769802000.json +1 -0
- package/.vitest/vitest-report-root-1793978784870947000.json +1 -0
- package/.vitest/vitest-report-root-1793978806927335000.json +1 -0
- package/.vitest/vitest-report-root-1793978822508324000.json +1 -0
- package/.vitest/vitest-report-root-1793978836339794000.json +1 -0
- package/.vitest/vitest-report-root-1793978837947352000.json +1 -0
- package/.vitest/vitest-report-root-1793978891548295000.json +1 -0
- package/.vitest/vitest-report-root-1793978946172947000.json +1 -0
- package/.vitest/vitest-report-root-1793978947109807000.json +1 -0
- package/.vitest/vitest-report-root-1793979034208662000.json +1 -0
- package/.vitest/vitest-report-root-1793979070583608000.json +1 -0
- package/.vitest/vitest-report-root-1793979081187144000.json +1 -0
- package/.vitest/vitest-report-root-1793979085428673000.json +1 -0
- package/.vitest/vitest-report-root-1793979155097858000.json +1 -0
- package/.vitest/vitest-report-root-1793979233508873000.json +1 -0
- package/.vitest/vitest-report-root-1793979268653273000.json +1 -0
- package/.vitest/vitest-report-root-1793979341978843000.json +1 -0
- package/.vitest/vitest-report-root-1793979345344877000.json +1 -0
- package/.vitest/vitest-report-root-1793979389390374000.json +1 -0
- package/.vitest/vitest-report-root-1793979400063493000.json +1 -0
- package/.vitest/vitest-report-root-1793979432448725000.json +1 -0
- package/.vitest/vitest-report-root-1793979459139430000.json +1 -0
- package/.vitest/vitest-report-root-1793979480341961000.json +1 -0
- package/.vitest/vitest-report-root-1793979510130869000.json +1 -0
- package/.vitest/vitest-report-root-1793979524763924000.json +1 -0
- package/.vitest/vitest-report-root-1793979571563010000.json +1 -0
- package/.vitest/vitest-report-root-1793979627916920000.json +1 -0
- package/.vitest/vitest-report-root-1793979726395379000.json +1 -0
- package/.vitest/vitest-report-root-1793979752029533000.json +1 -0
- package/.vitest/vitest-report-root-1793979753365744000.json +1 -0
- package/.vitest/vitest-report-root-1793979759386206000.json +1 -0
- package/.vitest/vitest-report-root-1793979787819109000.json +1 -0
- package/.vitest/vitest-report-root-1793979827615051000.json +1 -0
- package/.vitest/vitest-report-root-1793979927737393000.json +1 -0
- package/.vitest/vitest-report-root-1793979929836169000.json +1 -0
- package/.vitest/vitest-report-root-1793979955780781000.json +1 -0
- package/.vitest/vitest-report-root-1793980200569636000.json +1 -0
- package/.vitest/vitest-report-root-1793980206045213000.json +1 -0
- package/.vitest/vitest-report-root-1793980285772027000.json +1 -0
- package/.vitest/vitest-report-root-1793980459229828000.json +1 -0
- package/.vitest/vitest-report-root-1793980460545874000.json +1 -0
- package/.vitest/vitest-report-root-1793980554484341000.json +1 -0
- package/.vitest/vitest-report-root-1793980674494388000.json +1 -0
- package/.vitest/vitest-report-root-1793980683752195000.json +1 -0
- package/.vitest/vitest-report-root-1793980947108651000.json +1 -0
- package/.vitest/vitest-report-root-1793981129616629000.json +1 -0
- package/.vitest/vitest-report-root-1793981196611441000.json +1 -0
- package/.vitest/vitest-report-root-1793981226583545000.json +1 -0
- package/.vitest/vitest-report-root-1793981294259721000.json +1 -0
- package/.vitest/vitest-report-root-1793981353393048000.json +1 -0
- package/.vitest/vitest-report-root-1793981424585368000.json +1 -0
- package/.vitest/vitest-report-root-1793981513266687000.json +1 -0
- package/.vitest/vitest-report-root-1793981526418218000.json +1 -0
- package/.vitest/vitest-report-root-1793981540069877000.json +1 -0
- package/.vitest/vitest-report-root-1793981761193625000.json +1 -0
- package/.vitest/vitest-report-root-1793981868520992000.json +1 -0
- package/.vitest/vitest-report-root-1793982048467772000.json +1 -0
- package/.vitest/vitest-report-root-1793982119518020000.json +1 -0
- package/.vitest/vitest-report-root-1793982243473651000.json +1 -0
- package/.vitest/vitest-report-root-1793982406880629000.json +1 -0
- package/.vitest/vitest-report-root-1793982433563632000.json +1 -0
- package/.vitest/vitest-report-root-1793982496753204000.json +1 -0
- package/.vitest/vitest-report-root-1793982500153311000.json +1 -0
- package/.vitest/vitest-report-root-1793982542086095000.json +1 -0
- package/.vitest/vitest-report-root-1793982659482988000.json +1 -0
- package/.vitest/vitest-report-root-1793983799132716000.json +1 -0
- package/.vitest/vitest-report-root-1793983822721833000.json +1 -0
- package/.vitest/vitest-report-root-1793984998618484000.json +1 -0
- package/.vitest/vitest-report-root-1793985050475750000.json +1 -0
- package/.vitest/vitest-report-root-1793985095516077000.json +1 -0
- package/.vitest/vitest-report-root-1793985130729074000.json +1 -0
- package/.vitest/vitest-report-root-1793985177150997000.json +1 -0
- package/.vitest/vitest-report-root-1793985267658626000.json +1 -0
- package/.vitest/vitest-report-root-1793985412705211000.json +1 -0
- package/.vitest/vitest-report-root-1793985433752853000.json +1 -0
- package/.vitest/vitest-report-root-1794087938302852000.json +1 -0
- package/.vitest/vitest-report-root-1794087978339022000.json +1 -0
- package/.vitest/vitest-report-root-1794088095283811000.json +1 -0
- package/.vitest/vitest-report-root-1794088129997065000.json +1 -0
- package/.vitest/vitest-report-root-1794088147336556000.json +1 -0
- package/.vitest/vitest-report-root-1794088173414593000.json +1 -0
- package/.vitest/vitest-report-root-1794088221289657000.json +1 -0
- package/.vitest/vitest-report-root-1794088250766611000.json +1 -0
- package/.vitest/vitest-report-root-1794088365553234000.json +1 -0
- package/.vitest/vitest-report-root-1794088395202655000.json +1 -0
- package/.vitest/vitest-report-root-1794090028732187000.json +1 -0
- package/.vitest/vitest-report-root-1794090054787283000.json +1 -0
- package/.vitest/vitest-report-root-1794090153955794000.json +1 -0
- package/.vitest/vitest-report-root-1794090161850160000.json +1 -0
- package/.vitest/vitest-report-root-1794091755693314000.json +1 -0
- package/.vitest/vitest-report-root-1794091765029349000.json +1 -0
- package/.vitest/vitest-report-root-1794091975649927000.json +1 -0
- package/.vitest/vitest-report-root-1794091994027950000.json +1 -0
- package/.vitest/vitest-report-root-1794092005178771000.json +1 -0
- package/.vitest/vitest-report-root-1794113295302382000.json +1 -0
- package/.vitest/vitest-report-root-1794114156337032000.json +1 -0
- package/.vitest/vitest-report-root-1794114198454137000.json +1 -0
- package/.vitest/vitest-report-root-1794114254064413000.json +1 -0
- package/.vitest/vitest-report-root-1794114280107510000.json +1 -0
- package/.vitest/vitest-report-root-1794114495199837000.json +1 -0
- package/.vitest/vitest-report-root-1794114646604233000.json +1 -0
- package/.vitest/vitest-report-root-1794114666311689000.json +1 -0
- package/.vitest/vitest-report-root-1794114974303438000.json +1 -0
- package/.vitest/vitest-report-root-1794115037361450000.json +1 -0
- package/.vitest/vitest-report-root-1794115097838937000.json +1 -0
- package/.vitest/vitest-report-root-1794115604669388000.json +1 -0
- package/.vitest/vitest-report-root-1794115633814500000.json +1 -0
- package/.vitest/vitest-report-root-1794115648756242000.json +1 -0
- package/.vitest/vitest-report-root-1794115873440741000.json +1 -0
- package/.vitest/vitest-report-root-1794115952930230000.json +1 -0
- package/.vitest/vitest-report-root-1794115963344701000.json +1 -0
- package/.vitest/vitest-report-root-1794116196067450000.json +1 -0
- package/.vitest/vitest-report-root-1794116254301280000.json +1 -0
- package/.vitest/vitest-report-root-1794116259342966000.json +1 -0
- package/.vitest/vitest-report-root-1794118178787879000.json +1 -0
- package/.vitest/vitest-report-root-1794137087891409000.json +1 -0
- package/.vitest/vitest-report-root-1794137100301214000.json +1 -0
- package/.vitest/vitest-report-root-1794137107377813000.json +1 -0
- package/.vitest/vitest-report-root-1794137171230704000.json +1 -0
- package/.vitest/vitest-report-root-1794137317761465000.json +1 -0
- package/.vitest/vitest-report-root-1794137320282368000.json +1 -0
- package/LICENSE +17 -0
- package/PACKAGE_PUBLICATIONS.md +26 -0
- package/builder-package.json +19 -0
- package/package.json +77 -3
- package/scripts/build-builder.ts +27 -0
- package/scripts/build-library-runtime.ts +9 -0
- package/scripts/build-static.ts +75 -0
- package/scripts/build.ts +6 -0
- package/scripts/check-fragment.ts +12 -0
- package/scripts/local-workspaces.test.ts +31 -0
- package/scripts/local-workspaces.ts +55 -0
- package/scripts/release-version-cli.test.ts +40 -0
- package/scripts/release-version.test.ts +29 -0
- package/scripts/release-version.ts +46 -0
- package/scripts/run-package-build.ts +8 -0
- package/scripts/serve-packages.ts +8 -0
- package/spikes/README.md +70 -0
- package/spikes/barrel-rewriting/README.md +97 -0
- package/spikes/barrel-rewriting/measure.ts +134 -0
- package/spikes/barrel-rewriting/readme.ts +174 -0
- package/spikes/barrel-rewriting/results.json +3440 -0
- package/spikes/barrel-rewriting/run.ts +330 -0
- package/spikes/barrel-rewriting/setup.ts +90 -0
- package/spikes/barrel-rewriting/sw.ts +148 -0
- package/spikes/barrel-rewriting/tenant.ts +91 -0
- package/spikes/barrel-rewriting/worker-config.ts +33 -0
- package/spikes/closure-fragments/README.md +157 -0
- package/spikes/closure-fragments/results.json +959 -0
- package/spikes/closure-fragments/run.ts +298 -0
- package/spikes/compiler/README.md +177 -0
- package/spikes/compiler/compile.test.ts +78 -0
- package/spikes/compiler/compile.ts +82 -0
- package/spikes/compiler/facet-redact.d.ts +5 -0
- package/spikes/compiler/markers.ts +88 -0
- package/spikes/compiler/pages.ts +43 -0
- package/spikes/compiler/readme.ts +116 -0
- package/spikes/compiler/reference.ts +81 -0
- package/spikes/compiler/render.ts +113 -0
- package/spikes/compiler/results.json +3310 -0
- package/spikes/compiler/run.ts +250 -0
- package/spikes/compiler/sucrase-parser.d.ts +8 -0
- package/spikes/compiler/sw.ts +62 -0
- package/spikes/diagram-readiness/README.md +134 -0
- package/spikes/diagram-readiness/analysis.test.ts +52 -0
- package/spikes/diagram-readiness/analysis.ts +35 -0
- package/spikes/diagram-readiness/browser.ts +209 -0
- package/spikes/diagram-readiness/readme.ts +65 -0
- package/spikes/diagram-readiness/results.json +30289 -0
- package/spikes/diagram-readiness/run.ts +103 -0
- package/spikes/diagram-readiness/server.ts +53 -0
- package/spikes/esm-sh/README.md +27 -0
- package/spikes/esm-sh/browser-client.ts +18 -0
- package/spikes/esm-sh/browser-server.ts +104 -0
- package/spikes/esm-sh/fixtures/copy-to-clipboard-entry.headers +15 -0
- package/spikes/esm-sh/fixtures/copy-to-clipboard-entry.mjs.txt +3 -0
- package/spikes/esm-sh/fixtures/copy-to-clipboard-module.headers +13 -0
- package/spikes/esm-sh/fixtures/copy-to-clipboard-module.mjs.txt +142 -0
- package/spikes/esm-sh/fixtures/react-copy-to-clipboard-entry.headers +15 -0
- package/spikes/esm-sh/fixtures/react-copy-to-clipboard-entry.mjs.txt +3 -0
- package/spikes/esm-sh/fixtures/react-copy-to-clipboard-module.headers +11 -0
- package/spikes/esm-sh/fixtures/react-copy-to-clipboard-module.mjs.txt +222 -0
- package/spikes/esm-sh/fixtures/toggle-selection-entry.headers +14 -0
- package/spikes/esm-sh/fixtures/toggle-selection-entry.mjs.txt +3 -0
- package/spikes/esm-sh/fixtures/toggle-selection-module.headers +11 -0
- package/spikes/esm-sh/fixtures/toggle-selection-module.mjs.txt +76 -0
- package/spikes/esm-sh/fixtures.ts +54 -0
- package/spikes/esm-sh/redact.ts +1 -0
- package/spikes/frame-commenting/README.md +183 -0
- package/spikes/frame-commenting/agent.ts +110 -0
- package/spikes/frame-commenting/hook.ts +1 -0
- package/spikes/frame-commenting/host.ts +66 -0
- package/spikes/frame-commenting/measure.ts +180 -0
- package/spikes/frame-commenting/model.test.ts +27 -0
- package/spikes/frame-commenting/model.ts +40 -0
- package/spikes/frame-commenting/readme.ts +61 -0
- package/spikes/frame-commenting/results.json +5320 -0
- package/spikes/frame-commenting/run.ts +73 -0
- package/spikes/frame-commenting/setup.ts +125 -0
- package/spikes/lib/barrels.test.ts +107 -0
- package/spikes/lib/barrels.ts +309 -0
- package/spikes/lib/cjs-export-names.mjs +22 -0
- package/spikes/lib/content-types.ts +28 -0
- package/spikes/lib/convert-commonjs.ts +168 -0
- package/spikes/lib/fragment.ts +108 -0
- package/spikes/lib/library-set.ts +194 -0
- package/spikes/lib/module-transform.test.ts +133 -0
- package/spikes/lib/module-transform.ts +351 -0
- package/spikes/lib/origin.ts +140 -0
- package/spikes/lib/pages.ts +290 -0
- package/spikes/lib/report.ts +23 -0
- package/spikes/lib/runtime-server.ts +282 -0
- package/spikes/lib/static-server.ts +82 -0
- package/spikes/lib/trace.ts +384 -0
- package/spikes/local-folder-link/README.md +85 -0
- package/spikes/local-folder-link/checkout.ts +132 -0
- package/spikes/local-folder-link/documents.ts +36 -0
- package/spikes/local-folder-link/readme.ts +42 -0
- package/spikes/local-folder-link/results.json +12815 -0
- package/spikes/local-folder-link/rewrite.test.ts +27 -0
- package/spikes/local-folder-link/rewrite.ts +38 -0
- package/spikes/local-folder-link/run.ts +123 -0
- package/spikes/local-folder-link/server.ts +100 -0
- package/spikes/local-folder-link/sw.ts +97 -0
- package/spikes/origin-isolation/README.md +426 -0
- package/spikes/origin-isolation/browsers.ts +43 -0
- package/spikes/origin-isolation/helper.ts +6 -0
- package/spikes/origin-isolation/host.ts +25 -0
- package/spikes/origin-isolation/measure.ts +118 -0
- package/spikes/origin-isolation/model.test.ts +45 -0
- package/spikes/origin-isolation/model.ts +49 -0
- package/spikes/origin-isolation/proxy.ts +35 -0
- package/spikes/origin-isolation/readme.ts +83 -0
- package/spikes/origin-isolation/results.json +3242 -0
- package/spikes/origin-isolation/run.ts +35 -0
- package/spikes/origin-isolation/server.ts +108 -0
- package/spikes/origin-isolation/sw.ts +28 -0
- package/spikes/origin-isolation/tenant.ts +165 -0
- package/spikes/react-runtime-set/README.md +48 -0
- package/spikes/react-runtime-set/convert.ts +118 -0
- package/spikes/react-runtime-set/export-names.mjs +8 -0
- package/spikes/react-runtime-set/page/page.js +46 -0
- package/spikes/react-runtime-set/results.json +84 -0
- package/spikes/react-runtime-set/run.ts +255 -0
- package/spikes/run.ts +15 -0
- package/spikes/sw-tenant-frame/README.md +95 -0
- package/spikes/sw-tenant-frame/results.json +1348 -0
- package/spikes/sw-tenant-frame/run.ts +373 -0
- package/spikes/sw-tenant-frame/site/frame.html +113 -0
- package/spikes/sw-tenant-frame/site/host.html +25 -0
- package/spikes/sw-tenant-frame/site/sw.js +10 -0
- package/spikes/tailwind-parity/README.md +78 -0
- package/spikes/tailwind-parity/compare.test.ts +70 -0
- package/spikes/tailwind-parity/compare.ts +91 -0
- package/spikes/tailwind-parity/facet-font-scale.d.ts +6 -0
- package/spikes/tailwind-parity/facet-styles.ts +77 -0
- package/spikes/tailwind-parity/results.json +885 -0
- package/spikes/tailwind-parity/run.ts +385 -0
- package/spikes/tailwind-parity/runtime-tailwind.ts +82 -0
- package/src/activity-schema.ts +91 -0
- package/src/activity.test.ts +57 -0
- package/src/build/README.md +94 -0
- package/src/build/barrels.test.ts +107 -0
- package/src/build/barrels.ts +306 -0
- package/src/build/base.ts +2 -0
- package/src/build/check-fragment.ts +45 -0
- package/src/build/cjs-export-names.mjs +24 -0
- package/src/build/commonjs-exports.ts +24 -0
- package/src/build/convert-commonjs.ts +183 -0
- package/src/build/dependencies.ts +4 -0
- package/src/build/dependency-barrels.ts +59 -0
- package/src/build/dependency-cache.ts +40 -0
- package/src/build/dependency-plugin.ts +58 -0
- package/src/build/dependency-runtime.test.ts +121 -0
- package/src/build/dependency-runtime.ts +147 -0
- package/src/build/errors.ts +9 -0
- package/src/build/fragment.ts +89 -0
- package/src/build/index.ts +7 -0
- package/src/build/library-runtime.test.ts +343 -0
- package/src/build/library-runtime.ts +98 -0
- package/src/build/module-utils.ts +11 -0
- package/src/build/recipe-dependencies.ts +14 -0
- package/src/build/runtime-entries.ts +10 -0
- package/src/build/trace.ts +429 -0
- package/src/design-schema.ts +25 -0
- package/src/dev/README.md +48 -0
- package/src/dev/catalog.ts +79 -0
- package/src/dev/cli.test.ts +12 -0
- package/src/dev/cli.ts +25 -0
- package/src/dev/index.ts +115 -0
- package/src/dev/packages.test.ts +175 -0
- package/src/editing.test.tsx +31 -0
- package/src/editing.ts +25 -0
- package/src/frame/activity.browser.ts +34 -0
- package/src/frame/activity.test.ts +27 -0
- package/src/frame/activity.ts +50 -0
- package/src/frame/agent/README.md +47 -0
- package/src/frame/agent/agent.browser.ts +127 -0
- package/src/frame/agent/design.ts +62 -0
- package/src/frame/agent/index.ts +148 -0
- package/src/frame/agent/overlay.test.ts +42 -0
- package/src/frame/agent/overlay.ts +91 -0
- package/src/frame/agent/owner.test.ts +78 -0
- package/src/frame/agent/owner.ts +58 -0
- package/src/frame/agent/provider.tsx +14 -0
- package/src/frame/agent/react-override.ts +55 -0
- package/src/frame/agent/review.browser.ts +65 -0
- package/src/frame/agent/review.ts +107 -0
- package/src/frame/agent/testing/callsite.tsx +5 -0
- package/src/frame/agent/testing/client.ts +99 -0
- package/src/frame/agent/testing/library.ts +3 -0
- package/src/frame/agent/testing/modal.tsx +5 -0
- package/src/frame/agent/testing/review-client.ts +43 -0
- package/src/frame/agent/testing/review-server.ts +31 -0
- package/src/frame/agent/testing/server.ts +72 -0
- package/src/frame/agent/testing/vocabulary-host.ts +20 -0
- package/src/frame/agent/testing/vocabulary.tsx +10 -0
- package/src/frame/agent/vitest.browser.config.ts +6 -0
- package/src/frame/agent/vocabulary.browser.ts +30 -0
- package/src/frame/agent/vocabulary.test.ts +36 -0
- package/src/frame/agent/vocabulary.ts +13 -0
- package/src/frame/agent.ts +2 -0
- package/src/frame/boot-bundle.test.ts +20 -0
- package/src/frame/boot-styles.test.ts +102 -0
- package/src/frame/boot-styles.ts +50 -0
- package/src/frame/boot.test.ts +108 -0
- package/src/frame/boot.ts +205 -0
- package/src/frame/bridge.ts +27 -0
- package/src/frame/devtools-hook.ts +1 -0
- package/src/frame/entry.ts +4 -0
- package/src/frame/export-compiler.test.ts +23 -0
- package/src/frame/export-compiler.ts +18 -0
- package/src/frame/export-page.ts +59 -0
- package/src/frame/export.test.ts +17 -0
- package/src/frame/export.ts +90 -0
- package/src/frame/index.ts +7 -0
- package/src/frame/local-runtime.browser.ts +36 -0
- package/src/frame/page-agent.ts +2 -0
- package/src/frame/readiness.ts +51 -0
- package/src/frame/review-integration.browser.ts +48 -0
- package/src/frame/runtime.browser.ts +71 -0
- package/src/frame/tailwind/README.md +49 -0
- package/src/frame/tailwind/boot-styles.browser.ts +18 -0
- package/src/frame/tailwind/cache.test.ts +53 -0
- package/src/frame/tailwind/cache.ts +20 -0
- package/src/frame/tailwind/load.test.ts +74 -0
- package/src/frame/tailwind/load.ts +66 -0
- package/src/frame/tailwind/recipe.ts +81 -0
- package/src/frame/tailwind/runtime-cache.test.ts +97 -0
- package/src/frame/tailwind/runtime.ts +113 -0
- package/src/frame/tailwind/store.test.ts +104 -0
- package/src/frame/tailwind/store.ts +55 -0
- package/src/frame/tailwind/stylesheets.ts +37 -0
- package/src/frame/tailwind/tailwind.browser.ts +71 -0
- package/src/frame/tailwind/tailwind.test.ts +119 -0
- package/src/frame/tailwind/testing/client.ts +132 -0
- package/src/frame/tailwind/testing/compare.ts +91 -0
- package/src/frame/tailwind/testing/pages.ts +14 -0
- package/src/frame/tailwind/testing/server.ts +89 -0
- package/src/frame/tailwind/vitest.browser.config.ts +7 -0
- package/src/frame/testing/boot-page.ts +3 -0
- package/src/frame/testing/host.ts +60 -0
- package/src/frame/testing/local-host.tsx +33 -0
- package/src/frame/testing/server.ts +120 -0
- package/src/host/BuildLog.test.tsx +40 -0
- package/src/host/BuildLog.tsx +27 -0
- package/src/host/PageFrame.test.tsx +39 -0
- package/src/host/PageFrame.tsx +41 -0
- package/src/host/RuntimeActivity.tsx +75 -0
- package/src/host/activity-state.test.ts +37 -0
- package/src/host/activity-state.ts +69 -0
- package/src/host/agent-source.test.ts +9 -0
- package/src/host/agent-source.ts +14 -0
- package/src/host/agent-validation.test.ts +40 -0
- package/src/host/agent-validation.ts +73 -0
- package/src/host/bridge-request.test.ts +87 -0
- package/src/host/bridge.test.ts +34 -0
- package/src/host/bridge.ts +55 -0
- package/src/host/build-log.test.ts +47 -0
- package/src/host/build-log.ts +29 -0
- package/src/host/clear-cache.test.ts +75 -0
- package/src/host/clear-cache.ts +66 -0
- package/src/host/design-validation.test.ts +38 -0
- package/src/host/design-validation.ts +96 -0
- package/src/host/index.ts +11 -0
- package/src/host/link/index.ts +66 -0
- package/src/host/link/transport.test.ts +10 -0
- package/src/host/link/transport.ts +67 -0
- package/src/host/link/watch.ts +62 -0
- package/src/host/message-values.ts +55 -0
- package/src/host/origin.test.ts +10 -0
- package/src/host/origin.ts +7 -0
- package/src/host/review/README.md +32 -0
- package/src/host/review/index.ts +42 -0
- package/src/host/review/remote.test.ts +21 -0
- package/src/host/review/source.test.ts +19 -0
- package/src/host/review/validation.test.ts +34 -0
- package/src/host/review/validation.ts +55 -0
- package/src/host/runtime-integration.test.ts +29 -0
- package/src/host/source-path.test.ts +14 -0
- package/src/host/validation.ts +111 -0
- package/src/host/vocabulary-validation.test.ts +60 -0
- package/src/link/README.md +115 -0
- package/src/link/barrels.ts +5 -0
- package/src/link/build-cli.ts +12 -0
- package/src/link/build.test.ts +25 -0
- package/src/link/build.ts +99 -0
- package/src/link/commonjs.test.ts +34 -0
- package/src/link/commonjs.ts +39 -0
- package/src/link/examples/server.ts +18 -0
- package/src/link/index.ts +6 -0
- package/src/link/link.browser.ts +66 -0
- package/src/link/local-relay.browser.ts +22 -0
- package/src/link/overrides.test.ts +103 -0
- package/src/link/overrides.ts +69 -0
- package/src/link/page-sources.test.ts +52 -0
- package/src/link/page-sources.ts +69 -0
- package/src/link/source.ts +25 -0
- package/src/link/storage.ts +32 -0
- package/src/link/testing/client.ts +96 -0
- package/src/link/testing/folder.ts +19 -0
- package/src/link/testing/local-client.ts +30 -0
- package/src/link/testing/local-server.ts +26 -0
- package/src/link/testing/local-worker.ts +17 -0
- package/src/link/testing/server.ts +128 -0
- package/src/link/testing/worker.ts +32 -0
- package/src/link/testing-cache.ts +20 -0
- package/src/link/testing-fixtures.ts +16 -0
- package/src/link/types.ts +27 -0
- package/src/link/validation.ts +44 -0
- package/src/link/vitest.browser.config.ts +3 -0
- package/src/markers.ts +18 -0
- package/src/publication/build.ts +27 -0
- package/src/publication/fixtures/build.mjs +2 -0
- package/src/publication/index.ts +3 -0
- package/src/publication/lock.ts +32 -0
- package/src/publication/manifest.ts +14 -0
- package/src/publication/publication.test.ts +89 -0
- package/src/publication/publish.ts +80 -0
- package/src/publication/runtime.ts +28 -0
- package/src/publication/schema.ts +13 -0
- package/src/review-schema.ts +17 -0
- package/src/schema.ts +149 -0
- package/src/storage/db.test.ts +52 -0
- package/src/storage/db.ts +64 -0
- package/src/sw/activity-router.test.ts +53 -0
- package/src/sw/activity.ts +66 -0
- package/src/sw/barrels.ts +44 -0
- package/src/sw/candidates.test.ts +9 -0
- package/src/sw/candidates.ts +14 -0
- package/src/sw/compile.test.ts +152 -0
- package/src/sw/compile.ts +92 -0
- package/src/sw/compiler-columns.ts +44 -0
- package/src/sw/compiler-internals.d.ts +8 -0
- package/src/sw/compiler-plugins.ts +18 -0
- package/src/sw/compiler.test.ts +51 -0
- package/src/sw/compiler.ts +86 -0
- package/src/sw/composition.test.ts +51 -0
- package/src/sw/composition.ts +86 -0
- package/src/sw/content-types.ts +28 -0
- package/src/sw/converted-resolver.test.ts +129 -0
- package/src/sw/converted-router.test.ts +91 -0
- package/src/sw/converted.browser.ts +31 -0
- package/src/sw/converted.test.ts +31 -0
- package/src/sw/converted.ts +64 -0
- package/src/sw/editable-sites.ts +42 -0
- package/src/sw/errors.test.ts +8 -0
- package/src/sw/errors.ts +17 -0
- package/src/sw/index.ts +7 -0
- package/src/sw/integrity.ts +10 -0
- package/src/sw/legacy-storage.ts +18 -0
- package/src/sw/link-activity.test.ts +126 -0
- package/src/sw/link-activity.ts +21 -0
- package/src/sw/link-cache.test.ts +15 -0
- package/src/sw/link-cache.ts +19 -0
- package/src/sw/link-compiler.ts +112 -0
- package/src/sw/link-folder.ts +29 -0
- package/src/sw/link-markdown.test.ts +52 -0
- package/src/sw/link-relay.ts +40 -0
- package/src/sw/link-route.test.ts +150 -0
- package/src/sw/link-route.ts +239 -0
- package/src/sw/link-source.test.ts +31 -0
- package/src/sw/link-source.ts +41 -0
- package/src/sw/markers.test.ts +33 -0
- package/src/sw/markers.ts +128 -0
- package/src/sw/module-transform.test.ts +131 -0
- package/src/sw/module-transform.ts +352 -0
- package/src/sw/package-generation.test.ts +33 -0
- package/src/sw/page-clients.test.ts +37 -0
- package/src/sw/page-clients.ts +45 -0
- package/src/sw/profile.test.ts +21 -0
- package/src/sw/profile.ts +88 -0
- package/src/sw/resolver.test.ts +183 -0
- package/src/sw/resolver.ts +220 -0
- package/src/sw/router-cache.test.ts +78 -0
- package/src/sw/router.ts +320 -0
- package/src/sw/runtime-module.test.ts +61 -0
- package/src/sw/runtime-module.ts +13 -0
- package/src/sw/source-hash.test.ts +7 -0
- package/src/sw/source-hash.ts +37 -0
- package/src/sw/storage.test.ts +108 -0
- package/src/sw/versions.ts +89 -0
- package/src/sw/worker.ts +87 -0
- package/static/README.md +15 -0
- package/static/profile.example.json +15 -0
- package/tsconfig.json +10 -0
- package/vitest.browser.config.ts +4 -0
- package/vitest.config.ts +9 -0
- package/README.md +0 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
import { build } from "rolldown";
|
|
3
|
+
import { init, parse } from "es-module-lexer";
|
|
4
|
+
import { expect, it } from "vitest";
|
|
5
|
+
|
|
6
|
+
it("boots without loading page dependencies before the frame has an import map", async () => {
|
|
7
|
+
const output = await build({
|
|
8
|
+
input: fileURLToPath(new URL("./entry.ts", import.meta.url)), platform: "browser", tsconfig: false,
|
|
9
|
+
external: ["./page-agent.js", "react", "react-dom/client", "react/jsx-runtime", "react/jsx-dev-runtime", "@flanksource/clicky-ui/comments"],
|
|
10
|
+
transform: { jsx: { runtime: "automatic" }, define: { "process.env.NODE_ENV": JSON.stringify("development") } },
|
|
11
|
+
output: { format: "es", codeSplitting: false }, write: false,
|
|
12
|
+
});
|
|
13
|
+
expect(output.output.map((file) => file.type)).toEqual(["chunk"]);
|
|
14
|
+
const chunk = output.output[0];
|
|
15
|
+
if (chunk?.type !== "chunk") throw new Error("boot did not emit a module");
|
|
16
|
+
await init();
|
|
17
|
+
const [imports] = parse(chunk.code);
|
|
18
|
+
expect(imports.filter((item) => item.type === "static")).toEqual([]);
|
|
19
|
+
expect(imports.map((item) => item.specifier)).toEqual(expect.arrayContaining(["react", "react-dom/client", "./page-agent.js"]));
|
|
20
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
import type { FrameConfig } from "../schema.ts";
|
|
4
|
+
|
|
5
|
+
const fixture = vi.hoisted(() => ({
|
|
6
|
+
loadLibraries: vi.fn(), baseStylesheetUrls: vi.fn(), loadTailwind: vi.fn(), prepareTailwind: vi.fn(), createTailwindStore: vi.fn(), lazyRuntimeDb: vi.fn(),
|
|
7
|
+
}));
|
|
8
|
+
vi.mock("./tailwind/load.ts", () => ({ loadLibraries: fixture.loadLibraries, baseStylesheetUrls: fixture.baseStylesheetUrls }));
|
|
9
|
+
vi.mock("./tailwind/runtime.ts", () => ({ loadTailwind: fixture.loadTailwind, prepareTailwind: fixture.prepareTailwind }));
|
|
10
|
+
vi.mock("./tailwind/store.ts", () => ({ createTailwindStore: fixture.createTailwindStore }));
|
|
11
|
+
vi.mock("../storage/db.ts", () => ({ lazyRuntimeDb: fixture.lazyRuntimeDb, tailwindCacheName: (version: string) => `tailwind-${version}` }));
|
|
12
|
+
import { loadPageStyles, pageTailwind, preparePageStyles } from "./boot-styles.ts";
|
|
13
|
+
|
|
14
|
+
const config = { page: "report.tsx", runtimeVersion: "v1", profile: { readinessTimeoutMs: 500 } } as FrameConfig;
|
|
15
|
+
const libraries = [{ name: "clicky" }, { name: "facet" }];
|
|
16
|
+
const urls = ["https://runtime.example/npm/clicky@1/styles.css?page=report.tsx", "https://runtime.example/npm/facet@1/styles.css?page=report.tsx"];
|
|
17
|
+
const links = () => [...document.head.querySelectorAll<HTMLLinkElement>("link[rel=stylesheet]")];
|
|
18
|
+
const settle = (event: "load" | "error") => links().forEach((link) => link.dispatchEvent(new Event(event)));
|
|
19
|
+
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
document.head.innerHTML = ""; document.body.innerHTML = '<div id="root"></div>';
|
|
22
|
+
fixture.loadLibraries.mockResolvedValue({ libraries, loaders: { loadStylesheet: vi.fn(), loadModule: vi.fn() } });
|
|
23
|
+
fixture.baseStylesheetUrls.mockReturnValue(urls);
|
|
24
|
+
fixture.loadTailwind.mockResolvedValue({});
|
|
25
|
+
fixture.prepareTailwind.mockResolvedValue({ warm: false, candidates: new Set(), ready: async () => {}, stop: vi.fn() });
|
|
26
|
+
fixture.lazyRuntimeDb.mockReturnValue(() => Promise.resolve({}));
|
|
27
|
+
fixture.createTailwindStore.mockReturnValue({ read: vi.fn(), write: vi.fn() });
|
|
28
|
+
vi.stubGlobal("caches", { open: vi.fn(async () => ({})) });
|
|
29
|
+
vi.stubGlobal("fetch", vi.fn(async () => ({ ok: true, json: async () => ["flex"] })));
|
|
30
|
+
});
|
|
31
|
+
afterEach(() => { vi.clearAllMocks(); vi.unstubAllGlobals(); });
|
|
32
|
+
|
|
33
|
+
describe("base stylesheets", () => {
|
|
34
|
+
it("links every library's base stylesheet in library order and resolves once they have all loaded", async () => {
|
|
35
|
+
const loading = loadPageStyles(config);
|
|
36
|
+
await vi.waitFor(() => expect(links()).toHaveLength(2));
|
|
37
|
+
expect(links().map((link) => link.href)).toEqual(urls);
|
|
38
|
+
let done = false; void loading.then(() => { done = true; });
|
|
39
|
+
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
40
|
+
expect(done).toBe(false);
|
|
41
|
+
settle("load");
|
|
42
|
+
expect((await loading).libraries).toBe(libraries);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("fails loudly naming the stylesheet that did not load", async () => {
|
|
46
|
+
const loading = loadPageStyles(config);
|
|
47
|
+
await vi.waitFor(() => expect(links()).toHaveLength(2));
|
|
48
|
+
links()[1]!.dispatchEvent(new Event("error"));
|
|
49
|
+
await expect(loading).rejects.toThrow(`${urls[1]}: base stylesheet failed to load`);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe("dynamic Tailwind opt-in", () => {
|
|
54
|
+
const styles = async () => { const loading = loadPageStyles(config); await vi.waitFor(() => expect(links()).toHaveLength(2)); settle("load"); return loading; };
|
|
55
|
+
const prepare = async (module: { meta?: unknown }) => preparePageStyles({ config, styles: await styles(), module, onError: vi.fn() });
|
|
56
|
+
|
|
57
|
+
it("never loads the compiler, fetches candidates or opens storage for a page without meta.tailwind", async () => {
|
|
58
|
+
for (const module of [{}, { meta: {} }, { meta: { tailwind: undefined } }]) {
|
|
59
|
+
const prepared = await prepare(module);
|
|
60
|
+
await prepared.ready();
|
|
61
|
+
prepared.stop();
|
|
62
|
+
}
|
|
63
|
+
expect({ compiled: fixture.loadTailwind.mock.calls.length, prepared: fixture.prepareTailwind.mock.calls.length, fetched: vi.mocked(fetch).mock.calls.length, stores: fixture.createTailwindStore.mock.calls.length, opened: fixture.lazyRuntimeDb.mock.calls.length }).toEqual({ compiled: 0, prepared: 0, fetched: 0, stores: 0, opened: 0 });
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("keeps a non-opted page's base stylesheets linked until stop", async () => {
|
|
67
|
+
const prepared = await prepare({});
|
|
68
|
+
expect(links()).toHaveLength(2);
|
|
69
|
+
prepared.stop();
|
|
70
|
+
expect(links()).toHaveLength(0);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it.each([["static"], ["Dynamic"], [true], [null], [1]])("rejects meta.tailwind %j naming the page", async (tailwind) => {
|
|
74
|
+
await expect(prepare({ meta: { tailwind } })).rejects.toThrow(`report.tsx: meta.tailwind must be "dynamic" or omitted, received ${JSON.stringify(tailwind)}`);
|
|
75
|
+
expect(fixture.loadTailwind).not.toHaveBeenCalled();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it.each([[null], ["dynamic"], [[]]])("rejects a meta export that is not an object: %j", async (meta) => {
|
|
79
|
+
await expect(prepare({ meta })).rejects.toThrow("report.tsx: meta must be an object");
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("loads the compiler, source candidates and storage for a page that opts in", async () => {
|
|
83
|
+
const onError = vi.fn();
|
|
84
|
+
const prepared = await preparePageStyles({ config, styles: await styles(), module: { meta: { tailwind: "dynamic" } }, onError });
|
|
85
|
+
expect(fixture.loadTailwind).toHaveBeenCalledWith(expect.objectContaining({ libraries, runtimeVersion: "v1" }));
|
|
86
|
+
expect(fetch).toHaveBeenCalledWith("/__runtime/candidates?page=report.tsx");
|
|
87
|
+
expect(fixture.prepareTailwind).toHaveBeenCalledWith(expect.objectContaining({ libraries, candidates: ["flex"], runtimeVersion: "v1", onError, store: fixture.createTailwindStore.mock.results[0]!.value }));
|
|
88
|
+
expect(fixture.createTailwindStore).toHaveBeenCalledWith(expect.objectContaining({ origin: location.origin }));
|
|
89
|
+
expect(vi.mocked(caches.open)).toHaveBeenCalledWith("tailwind-v1");
|
|
90
|
+
prepared.stop();
|
|
91
|
+
expect(links()).toHaveLength(0);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("fails when the candidates request fails", async () => {
|
|
95
|
+
vi.mocked(fetch).mockResolvedValueOnce({ ok: false, status: 500 } as Response);
|
|
96
|
+
await expect(prepare({ meta: { tailwind: "dynamic" } })).rejects.toThrow("source candidates: HTTP 500");
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("recognizes only an exact dynamic opt-in", () => {
|
|
100
|
+
expect([pageTailwind({ module: {}, page: "p" }), pageTailwind({ module: { meta: { tailwind: "dynamic" } }, page: "p" })]).toEqual([false, true]);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { FrameConfig } from "../schema.ts";
|
|
2
|
+
import { baseStylesheetUrls, loadLibraries } from "./tailwind/load.ts";
|
|
3
|
+
import { loadTailwind, prepareTailwind } from "./tailwind/runtime.ts";
|
|
4
|
+
import { createTailwindStore } from "./tailwind/store.ts";
|
|
5
|
+
import { insertBaseLinks } from "./tailwind/stylesheets.ts";
|
|
6
|
+
import { lazyRuntimeDb, tailwindCacheName } from "../storage/db.ts";
|
|
7
|
+
import type { TailwindActivity } from "../activity-schema.ts";
|
|
8
|
+
|
|
9
|
+
export type LoadedStyles = Awaited<ReturnType<typeof loadPageStyles>>;
|
|
10
|
+
|
|
11
|
+
/** A page opts in to runtime Tailwind with `export const meta = { tailwind: "dynamic" }`; anything else is an error. */
|
|
12
|
+
export function pageTailwind(options: { module: { meta?: unknown }; page: string }): boolean {
|
|
13
|
+
const { meta } = options.module;
|
|
14
|
+
if (meta === undefined) return false;
|
|
15
|
+
if (meta === null || typeof meta !== "object" || Array.isArray(meta)) throw new Error(`${options.page}: meta must be an object`);
|
|
16
|
+
const { tailwind } = meta as { tailwind?: unknown };
|
|
17
|
+
if (tailwind === undefined) return false;
|
|
18
|
+
if (tailwind === "dynamic") return true;
|
|
19
|
+
throw new Error(`${options.page}: meta.tailwind must be "dynamic" or omitted, received ${JSON.stringify(tailwind)}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Every page: load the libraries' recipes and link their published base stylesheets, awaiting their load. */
|
|
23
|
+
export async function loadPageStyles(config: FrameConfig) {
|
|
24
|
+
const styles = await loadLibraries({ config });
|
|
25
|
+
performance.mark("page-runtime:recipes");
|
|
26
|
+
const base = insertBaseLinks({ document, urls: baseStylesheetUrls({ libraries: styles.libraries, config }), timeoutMs: config.profile.readinessTimeoutMs });
|
|
27
|
+
await base.ready;
|
|
28
|
+
performance.mark("page-runtime:base-styles");
|
|
29
|
+
return { ...styles, links: base.links };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function preparePageStyles(options: { config: FrameConfig; styles: LoadedStyles; module: { meta?: unknown }; onError: (error: unknown) => void; onActivity?: (activity: TailwindActivity) => void }) {
|
|
33
|
+
const { config, styles } = options;
|
|
34
|
+
const removeLinks = () => { for (const link of styles.links) link.remove(); };
|
|
35
|
+
if (!pageTailwind({ module: options.module, page: config.page })) return { warm: false, ready: async () => {}, stop: removeLinks };
|
|
36
|
+
const root = document.getElementById("root");
|
|
37
|
+
if (!root) throw new Error("page root #root is missing");
|
|
38
|
+
const activity = options.onActivity ? { onActivity: options.onActivity } : {};
|
|
39
|
+
const compiling = loadTailwind({ ...styles, runtimeVersion: config.runtimeVersion, ...activity });
|
|
40
|
+
const response = await fetch(`/__runtime/candidates?page=${encodeURIComponent(config.page)}`);
|
|
41
|
+
if (!response.ok) throw new Error(`source candidates: HTTP ${response.status}`);
|
|
42
|
+
await compiling;
|
|
43
|
+
performance.mark("page-runtime:compiler");
|
|
44
|
+
const store = createTailwindStore({
|
|
45
|
+
db: lazyRuntimeDb({ onVersionChange: () => location.reload() }),
|
|
46
|
+
cache: await caches.open(tailwindCacheName(config.runtimeVersion)), origin: location.origin, fetch: (input) => fetch(input),
|
|
47
|
+
});
|
|
48
|
+
const dynamic = await prepareTailwind({ ...styles, root, candidates: await response.json() as string[], runtimeVersion: config.runtimeVersion, store, timeoutMs: config.profile.readinessTimeoutMs, onError: options.onError, ...activity });
|
|
49
|
+
return { warm: dynamic.warm, candidates: dynamic.candidates, ready: dynamic.ready, stop: () => { dynamic.stop(); removeLinks(); } };
|
|
50
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { afterEach, beforeEach, expect, it, vi } from "vitest";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
import type { BridgeEnvelope, FrameConfig, HostMessage } from "../schema.ts";
|
|
6
|
+
|
|
7
|
+
const fixture = vi.hoisted(() => ({
|
|
8
|
+
receive: undefined as ((value: BridgeEnvelope) => void) | undefined,
|
|
9
|
+
send: vi.fn(), disposeBridge: vi.fn(), receiveAgent: vi.fn(), disposeAgent: vi.fn(), stopStyles: vi.fn(),
|
|
10
|
+
start: vi.fn(), prepare: vi.fn(), mounted: vi.fn(), ready: vi.fn(),
|
|
11
|
+
}));
|
|
12
|
+
vi.mock("./bridge.ts", () => ({
|
|
13
|
+
createFrameBridge: (options: { receive: (value: BridgeEnvelope) => void }) => { fixture.receive = options.receive; return { send: fixture.send, dispose: fixture.disposeBridge }; },
|
|
14
|
+
workerRequest: vi.fn(async () => undefined),
|
|
15
|
+
}));
|
|
16
|
+
vi.mock("./boot-styles.ts", () => ({ loadPageStyles: vi.fn(), preparePageStyles: fixture.prepare }));
|
|
17
|
+
vi.mock("/__runtime/page-agent.js", () => ({ startPageAgent: fixture.start, PageAgentProvider: ({ children }: { children: unknown }) => children }));
|
|
18
|
+
vi.mock("./readiness.ts", () => ({ waitForReadiness: fixture.ready }));
|
|
19
|
+
vi.mock("../sw/profile.ts", () => ({ validateProfile: (profile: unknown) => profile }));
|
|
20
|
+
import { bootFrame } from "./boot.ts";
|
|
21
|
+
import { exampleLock } from "../link/testing-fixtures.ts";
|
|
22
|
+
import { workerRequest } from "./bridge.ts";
|
|
23
|
+
|
|
24
|
+
function command(message: HostMessage) { fixture.receive!({ bridge: "page-runtime-v1", session: "test", message }); }
|
|
25
|
+
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
vi.clearAllMocks();
|
|
28
|
+
performance.clearMarks();
|
|
29
|
+
vi.stubGlobal("requestAnimationFrame", vi.fn());
|
|
30
|
+
history.replaceState(null, "", `${location.pathname}?runtime-opened=1`);
|
|
31
|
+
location.hash = new URLSearchParams({ host: "https://host.example" }).toString();
|
|
32
|
+
const worker = { state: "activated" };
|
|
33
|
+
Object.defineProperty(navigator, "serviceWorker", { configurable: true, value: { controller: worker, register: vi.fn(), ready: Promise.resolve({ active: worker }), addEventListener: vi.fn(), removeEventListener: vi.fn() } });
|
|
34
|
+
const profile = { embedders: ["https://host.example"], readinessTimeoutMs: 1000, managed: {} };
|
|
35
|
+
const config = { profile, lock: exampleLock(), page: "report.tsx", entry: pathToFileURL(resolve("src/frame/testing/boot-page.ts")).href } as FrameConfig;
|
|
36
|
+
document.body.innerHTML = '<div id="root"></div><script id="page-runtime-config" type="application/json"></script><script type="importmap">{"imports":{}}</script>';
|
|
37
|
+
document.getElementById("page-runtime-config")!.textContent = JSON.stringify(config);
|
|
38
|
+
vi.stubGlobal("fetch", vi.fn(async (url: string) => ({ ok: true, json: async () => url === "/profile.json" ? profile : [] })));
|
|
39
|
+
fixture.prepare.mockImplementation(async () => { fixture.mounted("styles"); return { stop: fixture.stopStyles, ready: async () => {} }; });
|
|
40
|
+
fixture.start.mockImplementation(() => { fixture.mounted("agent"); return { receive: fixture.receiveAgent, dispose: fixture.disposeAgent }; });
|
|
41
|
+
fixture.ready.mockImplementation(async ({ mounted }: { mounted: Promise<void> }) => { await mounted; fixture.mounted("ready"); });
|
|
42
|
+
});
|
|
43
|
+
afterEach(() => { window.dispatchEvent(new Event("pagehide")); vi.unstubAllGlobals(); });
|
|
44
|
+
|
|
45
|
+
it("waits for this frame's host open before importing a page left in worker storage", async () => {
|
|
46
|
+
history.replaceState(null, "", `${location.pathname}${location.hash}`);
|
|
47
|
+
await bootFrame();
|
|
48
|
+
expect({ messages: fixture.send.mock.calls, agentStarts: fixture.start.mock.calls }).toEqual({ messages: [[{ type: "status", state: "connecting" }]], agentStarts: [] });
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("reports a worker-embedded navigation error to the host without importing the page", async () => {
|
|
52
|
+
const error = { phase: "link", file: "/frame/report.tsx", message: "Error: report.tsx: additional package entities is forbidden by policy none" };
|
|
53
|
+
document.body.innerHTML = `<div id="root"></div><script type="application/json" id="page-runtime-error">${JSON.stringify(error)}</script>`;
|
|
54
|
+
await bootFrame();
|
|
55
|
+
expect({ messages: fixture.send.mock.calls, registered: vi.mocked(navigator.serviceWorker.register).mock.calls, agentStarts: fixture.start.mock.calls }).toEqual({ messages: [[{ type: "error", error }, undefined]], registered: [], agentStarts: [] });
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("starts the agent after styles and before mounting, routes commands, and disposes on pagehide", async () => {
|
|
59
|
+
fixture.ready.mockImplementationOnce(async ({ mounted }: { mounted: Promise<void> }) => {
|
|
60
|
+
await mounted;
|
|
61
|
+
expect(fixture.send.mock.calls.filter(([message]) => message.type === "lock")).toEqual([]);
|
|
62
|
+
fixture.mounted("ready");
|
|
63
|
+
});
|
|
64
|
+
const boot = bootFrame();
|
|
65
|
+
command({ type: "data", data: null });
|
|
66
|
+
await boot;
|
|
67
|
+
const failures = fixture.send.mock.calls.filter(([message]) => message.type === "error").map(([message]) => message.error.message);
|
|
68
|
+
if (failures.length) throw new Error(failures.join("\n"));
|
|
69
|
+
expect(fixture.send.mock.calls[0]![0]).toEqual({ type: "status", state: "booting" });
|
|
70
|
+
expect(fixture.send.mock.calls.filter(([message]) => message.type !== "activity").slice(-2).map(([message]) => message.type === "status" ? message.state : message.type)).toEqual(["lock", "ready"]);
|
|
71
|
+
expect(navigator.serviceWorker.register).toHaveBeenCalledWith("/sw.js", { scope: "/frame/" });
|
|
72
|
+
expect(fixture.send.mock.calls.filter(([message]) => message.type === "error")).toEqual([]);
|
|
73
|
+
expect(fixture.mounted.mock.calls.map(([stage]) => stage)).toEqual(["styles", "agent", "ready"]);
|
|
74
|
+
expect(document.getElementById("root")!.textContent).toBe("Report");
|
|
75
|
+
const commands: HostMessage[] = [{ type: "mode", mode: "off" }, { type: "pick" }, { type: "page" }, { type: "pins", anchors: [] }, { type: "highlight", anchor: null }, { type: "scroll", anchor: "total" }, { type: "mode", mode: "design" }, { type: "design-override", requestId: "preview", source: "report.tsx:2:3#0@012345abcdef", props: { fill: "blue" } }, { type: "design-write", requestId: "write", page: "report", source: "report.tsx:2:3#0@012345abcdef", edit: { kind: "delete" } }, { type: "design-write-result", requestId: "write", result: { status: "invalid", error: "read-only fixture" } }];
|
|
76
|
+
commands.forEach(command);
|
|
77
|
+
const reviews: HostMessage[] = [{ type: "review-list", requestId: "list" }, { type: "review-select", requestId: "select", id: null }, { type: "review-visibility", requestId: "visibility", visible: true, showRejected: false }, { type: "review-action", requestId: "action", id: "summary", action: "approved" }];
|
|
78
|
+
reviews.forEach(command);
|
|
79
|
+
const removal: HostMessage = { type: "review-remove", requestId: "removal", id: "summary", removed: true };
|
|
80
|
+
command(removal);
|
|
81
|
+
expect(fixture.receiveAgent.mock.calls).toEqual([...commands, ...reviews, removal].map((message) => [message]));
|
|
82
|
+
window.dispatchEvent(new Event("pagehide"));
|
|
83
|
+
expect([fixture.disposeAgent.mock.calls.length, fixture.stopStyles.mock.calls.length, fixture.disposeBridge.mock.calls.length]).toEqual([1, 1, 1]);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("passes the lock's page roots into the page agent", async () => {
|
|
87
|
+
const element = document.getElementById("page-runtime-config")!;
|
|
88
|
+
const config = JSON.parse(element.textContent!) as FrameConfig;
|
|
89
|
+
const pageSources = [{ link: "pages", root: "src/pages", prefix: "", editable: true }];
|
|
90
|
+
element.textContent = JSON.stringify({ ...config, lock: { ...config.lock, pageSources } });
|
|
91
|
+
const boot = bootFrame(); command({ type: "data", data: null }); await boot;
|
|
92
|
+
expect(fixture.start).toHaveBeenCalledWith(expect.objectContaining({ pageSources }));
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("reports an agent command before startup instead of dropping it", async () => {
|
|
96
|
+
const boot = bootFrame(); command({ type: "pick" }); command({ type: "data", data: null });
|
|
97
|
+
await boot;
|
|
98
|
+
expect(fixture.send.mock.calls).toContainEqual([expect.objectContaining({ type: "error", error: expect.objectContaining({ message: expect.stringContaining("page agent is not ready") }) }), undefined]);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("retains worker diagnostics until after the first paint instead of delivering them on the render path", async () => {
|
|
102
|
+
const boot = bootFrame(); command({ type: "data", data: null }); await boot;
|
|
103
|
+
expect(workerRequest).not.toHaveBeenCalled();
|
|
104
|
+
const callbacks = vi.mocked(requestAnimationFrame).mock.calls;
|
|
105
|
+
callbacks[0];
|
|
106
|
+
callbacks[1];
|
|
107
|
+
expect(workerRequest).toHaveBeenCalledWith(expect.objectContaining({ message: "subscribe-activity" }), 15000);
|
|
108
|
+
});
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from "react";
|
|
2
|
+
import type { BridgeEnvelope, FrameConfig, JsonValue, RuntimeError, RuntimePhase, RuntimeProfile } from "../schema.ts";
|
|
3
|
+
import { createFrameBridge, workerRequest } from "./bridge.ts";
|
|
4
|
+
import { waitForReadiness } from "./readiness.ts";
|
|
5
|
+
import { exportHtml } from "./export.ts";
|
|
6
|
+
import { withExportRender } from "./export-page.ts";
|
|
7
|
+
import { runtimeError } from "../sw/errors.ts";
|
|
8
|
+
import { validateProfile } from "../sw/profile.ts";
|
|
9
|
+
import { validateFrameMessage } from "../host/validation.ts";
|
|
10
|
+
import { loadPageStyles, preparePageStyles } from "./boot-styles.ts";
|
|
11
|
+
import type { PageAgent } from "./agent/index.ts";
|
|
12
|
+
import { PAGE_AGENT_URL } from "../sw/runtime-module.ts";
|
|
13
|
+
import { createFrameActivity } from "./activity.ts";
|
|
14
|
+
|
|
15
|
+
/** `meta.tailwind` is `"dynamic"` for a page that builds Tailwind at runtime; it is validated when the page's styles are prepared. */
|
|
16
|
+
export type PageModule = { default: ComponentType<{ data: JsonValue }>; ready?: (() => Promise<void>) | Promise<void>; meta?: unknown };
|
|
17
|
+
export type PageStyles = Awaited<ReturnType<typeof preparePageStyles>>;
|
|
18
|
+
type ReactRuntime = [typeof import("react"), typeof import("react-dom/client"), typeof import("react-dom")];
|
|
19
|
+
|
|
20
|
+
function detail(error: unknown, phase: RuntimePhase, file: string): RuntimeError {
|
|
21
|
+
if (error && typeof error === "object" && "pageRuntime" in error) return error.pageRuntime as RuntimeError;
|
|
22
|
+
return runtimeError({ error, phase, file });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function ensureController(options: { timeoutMs?: number } = {}): Promise<boolean> {
|
|
26
|
+
if (!("serviceWorker" in navigator)) throw new Error("navigator.serviceWorker is unavailable");
|
|
27
|
+
const controlled = navigator.serviceWorker.controller;
|
|
28
|
+
await navigator.serviceWorker.register("/sw.js", { scope: "/frame/" });
|
|
29
|
+
const registration = await withTimeout(navigator.serviceWorker.ready, options.timeoutMs ?? 15000, "service worker activation timeout");
|
|
30
|
+
const active = registration.installing ?? registration.waiting ?? registration.active;
|
|
31
|
+
if (!active) throw new Error("service worker registration has no active worker");
|
|
32
|
+
if (active.state !== "activated") await withTimeout(new Promise<void>((resolve, reject) => active.addEventListener("statechange", () => {
|
|
33
|
+
if (active.state === "activated") resolve();
|
|
34
|
+
if (active.state === "redundant") reject(new Error("service worker installation failed"));
|
|
35
|
+
})), options.timeoutMs ?? 15000, "service worker activation timeout");
|
|
36
|
+
if (controlled && navigator.serviceWorker.controller === active) return true;
|
|
37
|
+
const url = new URL(location.href);
|
|
38
|
+
if (url.searchParams.has("runtime-reloaded")) throw new Error("service worker does not control frame after one reload");
|
|
39
|
+
url.searchParams.set("runtime-reloaded", "1"); location.replace(url); return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function bootFrame(): Promise<void> {
|
|
43
|
+
performance.mark("page-runtime:boot");
|
|
44
|
+
let phase: RuntimePhase = "resolve";
|
|
45
|
+
let config: FrameConfig | undefined;
|
|
46
|
+
let lockAnnounced = false;
|
|
47
|
+
const announceLock = () => { if (config && !lockAnnounced) { bridge.send({ type: "lock", lock: config.lock }); lockAnnounced = true; } };
|
|
48
|
+
let ready = false;
|
|
49
|
+
let agent: PageAgent | undefined;
|
|
50
|
+
let styles: PageStyles | undefined;
|
|
51
|
+
let unmount: (() => void) | undefined;
|
|
52
|
+
let updateData: ((value: JsonValue) => void) | undefined;
|
|
53
|
+
let latestData: JsonValue = null;
|
|
54
|
+
let exportMount: ((module: PageModule, root: HTMLElement) => { mounted: Promise<void>; unmount: () => void }) | undefined;
|
|
55
|
+
let receiveData!: (data: JsonValue) => void;
|
|
56
|
+
const data = new Promise<JsonValue>((resolve) => { receiveData = resolve; });
|
|
57
|
+
const bridge = createFrameBridge({ receive: (envelope) => { void receive(envelope).catch((error: unknown) => report(error, envelope.id)); }, error: (error) => report(error) });
|
|
58
|
+
const report = (error: unknown, re?: string) => { bridge.send({ type: "error", error: detail(error, phase, config?.page ?? location.pathname) }, re ? { re } : undefined); };
|
|
59
|
+
const activity = createFrameActivity({ send: (message) => bridge.send(message), error: report });
|
|
60
|
+
let controlled = false; let activitySubscribed = false;
|
|
61
|
+
const subscribeActivity = () => {
|
|
62
|
+
if (activitySubscribed) return;
|
|
63
|
+
activitySubscribed = true;
|
|
64
|
+
void workerRequest({ message: "subscribe-activity", load: activity.load, navigationStart: activity.navigationStart }, 15000).catch(report);
|
|
65
|
+
};
|
|
66
|
+
const dispose = () => { ready = false; unmount?.(); unmount = undefined; exportMount = undefined; agent?.dispose(); agent = undefined; styles?.stop(); styles = undefined; };
|
|
67
|
+
window.addEventListener("pagehide", () => { activity.stop(); dispose(); bridge.dispose(); }, { once: true });
|
|
68
|
+
async function receive(envelope: BridgeEnvelope) {
|
|
69
|
+
const m = envelope.message;
|
|
70
|
+
if (m.type === "open") {
|
|
71
|
+
phase = "resolve"; await workerRequest({ message: m }, 15000);
|
|
72
|
+
const url = new URL(location.href);
|
|
73
|
+
if (url.searchParams.has("runtime-opened")) location.reload();
|
|
74
|
+
else { url.searchParams.set("runtime-opened", "1"); location.replace(url); }
|
|
75
|
+
}
|
|
76
|
+
else if (m.type === "sources") { performance.mark("page-runtime:sources"); await workerRequest({ page: config?.page, message: m }, 15000); performance.mark("page-runtime:invalidated"); location.reload(); }
|
|
77
|
+
else if (m.type === "reload") location.reload();
|
|
78
|
+
else if (m.type === "theme") { document.documentElement.dataset.theme = m.theme; document.documentElement.dataset.density = m.density; }
|
|
79
|
+
else if (m.type === "data") { latestData = m.data; receiveData(m.data); updateData?.(m.data); }
|
|
80
|
+
else if (m.type === "mode" || m.type === "pick" || m.type === "page" || m.type === "pins" || m.type === "highlight" || m.type === "scroll" || m.type === "design-override" || m.type === "design-write" || m.type === "design-write-result" || m.type === "review-remove" || m.type === "review-list" || m.type === "review-select" || m.type === "review-visibility" || m.type === "review-action") {
|
|
81
|
+
if (!agent) throw new Error("page agent is not ready");
|
|
82
|
+
agent.receive(m);
|
|
83
|
+
}
|
|
84
|
+
else if (m.type === "capture-vocabulary") {
|
|
85
|
+
const reference = envelope.id ? { re: envelope.id } : undefined;
|
|
86
|
+
if (!ready || !agent) {
|
|
87
|
+
bridge.send({ type: "error", error: { phase: "render", message: "page is not ready for vocabulary capture", file: config?.page ?? location.pathname } }, reference);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
bridge.send(await agent.captureVocabulary({ ready }), reference);
|
|
91
|
+
}
|
|
92
|
+
else if (m.type === "export") {
|
|
93
|
+
if (!ready || !config || !exportMount) throw new Error("page is not ready for export");
|
|
94
|
+
const reference = envelope.id ? { re: envelope.id } : undefined;
|
|
95
|
+
const root = document.getElementById("root");
|
|
96
|
+
if (!(root instanceof HTMLElement)) throw new Error("frame root is missing");
|
|
97
|
+
await withExportRender({ config, root, mount: exportMount, request: (message) => workerRequest(message, 15000), run: async () => {
|
|
98
|
+
if (m.format === "print") { window.print(); bridge.send({ type: "status", state: "ready" }, reference); }
|
|
99
|
+
else bridge.send({ type: "snapshot", html: await exportHtml() }, reference);
|
|
100
|
+
} });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
const element = document.getElementById("page-runtime-config");
|
|
105
|
+
if (element) config = JSON.parse(element.textContent!) as FrameConfig;
|
|
106
|
+
let profile: RuntimeProfile;
|
|
107
|
+
if (config) profile = validateProfile(config.profile);
|
|
108
|
+
else {
|
|
109
|
+
const profileResponse = await withTimeout(fetch("/profile.json", { cache: "no-store" }), 15000, "profile fetch timeout");
|
|
110
|
+
if (!profileResponse.ok) throw new Error(`profile.json: HTTP ${profileResponse.status}`);
|
|
111
|
+
profile = validateProfile(await profileResponse.json());
|
|
112
|
+
}
|
|
113
|
+
const host = new URLSearchParams(location.hash.slice(1)).get("host");
|
|
114
|
+
if (!host || !profile.embedders.includes(host)) throw new Error(`host ${host} is not in profile.embedders`);
|
|
115
|
+
const navigationError = document.getElementById("page-runtime-error");
|
|
116
|
+
if (navigationError) {
|
|
117
|
+
const error = JSON.parse(navigationError.textContent!) as RuntimeError;
|
|
118
|
+
throw Object.assign(new Error(error.message), { pageRuntime: error });
|
|
119
|
+
}
|
|
120
|
+
if (!await ensureController({ timeoutMs: profile.readinessTimeoutMs })) { bridge.dispose(); return; }
|
|
121
|
+
controlled = true;
|
|
122
|
+
if (!config || !new URL(location.href).searchParams.has("runtime-opened")) { bridge.send({ type: "status", state: "connecting" }); return; }
|
|
123
|
+
bridge.send({ type: "status", state: "booting" });
|
|
124
|
+
performance.mark("page-runtime:controlled");
|
|
125
|
+
phase = "link";
|
|
126
|
+
let rejectModule!: (error: Error) => void;
|
|
127
|
+
const moduleFailure = new Promise<never>((_, reject) => { rejectModule = reject; });
|
|
128
|
+
const workerError = (event: MessageEvent<unknown>) => {
|
|
129
|
+
if (event.source !== navigator.serviceWorker.controller) return;
|
|
130
|
+
if (!event.data || typeof event.data !== "object" || !("type" in event.data) || event.data.type !== "error") return;
|
|
131
|
+
const message = validateFrameMessage(event.data);
|
|
132
|
+
if (message.type === "error") rejectModule(Object.assign(new Error(message.error.message), { pageRuntime: message.error }));
|
|
133
|
+
};
|
|
134
|
+
navigator.serviceWorker.addEventListener("message", workerError);
|
|
135
|
+
let pageModule: PageModule;
|
|
136
|
+
let libraryStyles: Awaited<ReturnType<typeof loadPageStyles>>;
|
|
137
|
+
let pageData: JsonValue;
|
|
138
|
+
let agentModule: typeof import("./page-agent.js");
|
|
139
|
+
let reactRuntime: ReactRuntime;
|
|
140
|
+
try { [pageModule, libraryStyles, pageData, agentModule, reactRuntime] = await Promise.race([Promise.all([
|
|
141
|
+
import(config.entry) as Promise<PageModule>, loadPageStyles(config),
|
|
142
|
+
withTimeout(data, config.profile.readinessTimeoutMs, "data bridge timeout"),
|
|
143
|
+
import(`${PAGE_AGENT_URL}${new URL(config.entry, location.href).search}`) as Promise<typeof import("./page-agent.js")>,
|
|
144
|
+
Promise.all([import("react"), import("react-dom/client"), import("react-dom")]),
|
|
145
|
+
]), moduleFailure]); }
|
|
146
|
+
finally { navigator.serviceWorker.removeEventListener("message", workerError); }
|
|
147
|
+
performance.mark("page-runtime:module");
|
|
148
|
+
performance.mark("page-runtime:libraries");
|
|
149
|
+
activity.resolve(config, { react: reactRuntime[0].version, "react-dom": reactRuntime[2].version });
|
|
150
|
+
if (typeof pageModule.default !== "function" && typeof pageModule.default !== "object") throw new Error(`${config.page}: missing default React component`);
|
|
151
|
+
const pageStyles = await preparePageStyles({ config, styles: libraryStyles, module: pageModule, onError: (error) => { ready = false; report(error); }, onActivity: activity.tailwind });
|
|
152
|
+
styles = pageStyles;
|
|
153
|
+
performance.mark("page-runtime:styles");
|
|
154
|
+
const pageRoot = document.getElementById("root");
|
|
155
|
+
if (!(pageRoot instanceof HTMLElement)) throw new Error("frame root is missing");
|
|
156
|
+
performance.mark("page-runtime:agent");
|
|
157
|
+
const { startPageAgent, PageAgentProvider } = agentModule;
|
|
158
|
+
agent = startPageAgent({ root: pageRoot, page: config.page, ...(config.lock.pageSources ? { pageSources: config.lock.pageSources } : {}), send: (message) => bridge.send(message), error: report });
|
|
159
|
+
phase = "render";
|
|
160
|
+
const mountedPage = mountPage({ module: pageModule, runtime: reactRuntime, agent, provider: PageAgentProvider, data: pageData, file: config.page, root: pageRoot, subscribe: (update) => { updateData = update; } });
|
|
161
|
+
unmount = mountedPage.unmount;
|
|
162
|
+
latestData = pageData;
|
|
163
|
+
const page = config.page; const pageAgent = agent; const runtime = reactRuntime;
|
|
164
|
+
exportMount = (module, root) => {
|
|
165
|
+
if (typeof module.default !== "function" && typeof module.default !== "object") throw new Error(`${page}: export compile has no default React component`);
|
|
166
|
+
return mountPage({ module, runtime, agent: pageAgent, provider: PageAgentProvider, data: latestData, file: page, root, subscribe: () => undefined });
|
|
167
|
+
};
|
|
168
|
+
performance.mark("page-runtime:render");
|
|
169
|
+
requestAnimationFrame(() => requestAnimationFrame(() => { performance.mark("page-runtime:visible"); subscribeActivity(); activity.schedule(); }));
|
|
170
|
+
phase = "readiness";
|
|
171
|
+
await waitForReadiness({ root: pageRoot, mounted: mountedPage.mounted.then(() => pageStyles.ready()), ...(pageModule.ready ? { hook: pageModule.ready } : {}), timeoutMs: config.profile.readinessTimeoutMs, status: (state) => { if (state !== "ready") bridge.send({ type: "status", state }); } });
|
|
172
|
+
await pageStyles.ready();
|
|
173
|
+
announceLock();
|
|
174
|
+
ready = true;
|
|
175
|
+
performance.mark("page-runtime:ready");
|
|
176
|
+
bridge.send({ type: "status", state: "ready" });
|
|
177
|
+
activity.schedule();
|
|
178
|
+
} catch (error) { if (controlled) subscribeActivity(); dispose(); announceLock(); report(error); }
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function mountPage(options: { module: PageModule; runtime: ReactRuntime; agent: PageAgent; provider: typeof import("./page-agent.js")["PageAgentProvider"]; data: JsonValue; file: string; root: HTMLElement; subscribe: (update: (value: JsonValue) => void) => void }): { mounted: Promise<void>; unmount: () => void } {
|
|
182
|
+
const [React, { createRoot }, { flushSync }] = options.runtime;
|
|
183
|
+
let resolve!: () => void; let reject!: (error: unknown) => void;
|
|
184
|
+
const mounted = new Promise<void>((yes, no) => { resolve = yes; reject = no; });
|
|
185
|
+
class Boundary extends React.Component<{ children: ReactNode }, { failed: boolean }> {
|
|
186
|
+
override state = { failed: false };
|
|
187
|
+
static getDerivedStateFromError() { return { failed: true }; }
|
|
188
|
+
override componentDidCatch(error: Error) { reject(Object.assign(error, { pageRuntime: detail(error, "render", options.file) })); }
|
|
189
|
+
override render() { return this.state.failed ? null : this.props.children; }
|
|
190
|
+
}
|
|
191
|
+
function Mounted() {
|
|
192
|
+
const [data, setData] = React.useState(options.data);
|
|
193
|
+
React.useLayoutEffect(() => { options.subscribe(setData); resolve(); }, []);
|
|
194
|
+
return React.createElement(options.module.default, { data });
|
|
195
|
+
}
|
|
196
|
+
const renderer = createRoot(options.root);
|
|
197
|
+
flushSync(() => renderer.render(React.createElement(Boundary, null, React.createElement(options.provider, { agent: options.agent, children: React.createElement(Mounted) }))));
|
|
198
|
+
return { mounted, unmount: () => renderer.unmount() };
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
async function withTimeout<T>(promise: Promise<T>, timeoutMs: number, message: string): Promise<T> {
|
|
202
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
203
|
+
try { return await Promise.race([promise, new Promise<never>((_, reject) => { timer = setTimeout(() => reject(new Error(message)), timeoutMs); })]); }
|
|
204
|
+
finally { clearTimeout(timer); }
|
|
205
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createBridge } from "../host/bridge.ts";
|
|
2
|
+
import type { BridgeEnvelope } from "../schema.ts";
|
|
3
|
+
import { validateFrameOrigin } from "../host/origin.ts";
|
|
4
|
+
|
|
5
|
+
export function createFrameBridge(options: { receive: (value: BridgeEnvelope) => void; error: (error: Error) => void }) {
|
|
6
|
+
const params = new URLSearchParams(location.hash.slice(1));
|
|
7
|
+
const origin = params.get("host"); const session = params.get("session");
|
|
8
|
+
if (!origin || !session || parent === window) throw new Error("frame requires a host origin and session");
|
|
9
|
+
const mode = params.get("origin") ?? "cross-origin";
|
|
10
|
+
if (mode !== "cross-origin" && mode !== "same-origin-local") throw new Error("invalid frame origin mode");
|
|
11
|
+
validateFrameOrigin({ runtimeOrigin: location.origin, hostOrigin: origin, origin: mode });
|
|
12
|
+
return createBridge({ target: parent, origin, session, direction: "frame", onMessage: options.receive, onError: options.error });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function workerRequest(message: unknown, timeoutMs: number): Promise<void> {
|
|
16
|
+
const controller = navigator.serviceWorker.controller;
|
|
17
|
+
if (!controller) throw new Error("service worker does not control frame");
|
|
18
|
+
await new Promise<void>((resolve, reject) => {
|
|
19
|
+
const channel = new MessageChannel();
|
|
20
|
+
const timer = setTimeout(() => { channel.port1.close(); reject(new Error("worker request timed out")); }, timeoutMs);
|
|
21
|
+
channel.port1.onmessage = (event: MessageEvent<{ ok: boolean; error?: unknown }>) => {
|
|
22
|
+
clearTimeout(timer); channel.port1.close();
|
|
23
|
+
if (event.data.ok) resolve(); else reject(Object.assign(new Error("worker rejected request"), { pageRuntime: event.data.error }));
|
|
24
|
+
};
|
|
25
|
+
controller.postMessage(message, [channel.port2]);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "bippy/install-hook-only";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { compileExportMdx } from "./export-compiler.ts";
|
|
3
|
+
|
|
4
|
+
const PAGE = "# Report\n\nPublic summary.\n\nInternal margin figures.\n";
|
|
5
|
+
type Tree = { children: Array<{ type: string; children?: Array<{ value?: string }> }> };
|
|
6
|
+
/** Drops paragraphs whose text starts with `options.prefix`, like a redaction plugin removing classified regions. */
|
|
7
|
+
const dropParagraphs = (options: { prefix: string }) => (tree: Tree) => {
|
|
8
|
+
tree.children = tree.children.filter((node) => !(node.type === "paragraph" && node.children?.[0]?.value?.startsWith(options.prefix)));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
describe("compileExportMdx", () => {
|
|
12
|
+
it.each([
|
|
13
|
+
["without plugins keeps every paragraph", [], ["Public summary.", "Internal margin figures."], []],
|
|
14
|
+
["applies a declared plugin with its options after the base set", [[dropParagraphs, { prefix: "Internal" }]], ["Public summary."], ["Internal margin figures."]],
|
|
15
|
+
])("%s", async (_case, remark, kept, removed) => {
|
|
16
|
+
const code = await compileExportMdx({ path: "report.md", code: PAGE, remark });
|
|
17
|
+
expect({ kept: kept.filter((text) => code.includes(text)), removed: removed.filter((text) => code.includes(text)) }).toEqual({ kept, removed: [] });
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("rejects a page that imports other Markdown, which the export plugins would not reach", async () => {
|
|
21
|
+
await expect(compileExportMdx({ path: "report.mdx", code: 'import Appendix from "./appendix.md";\n\n# Report\n\n<Appendix />\n', remark: [] })).rejects.toThrow("report.mdx: export compiler plugins do not apply to imported Markdown (./appendix.md)");
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { compile } from "@mdx-js/mdx";
|
|
2
|
+
import { init, parse } from "es-module-lexer";
|
|
3
|
+
import { compileMdx } from "../sw/compile.ts";
|
|
4
|
+
import { BASE_PLUGINS } from "../sw/compiler.ts";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Compiles a Markdown page for an HTML or PDF export: the base plugins, then the library-declared `remark` plugins.
|
|
8
|
+
* Imported Markdown is compiled by the worker without those plugins, so an export that would include it fails.
|
|
9
|
+
*/
|
|
10
|
+
export async function compileExportMdx(options: { path: string; code: string; remark: unknown[] }): Promise<string> {
|
|
11
|
+
const extension = options.path.slice(options.path.lastIndexOf("."));
|
|
12
|
+
const code = await compileMdx({ path: options.path, extension, code: options.code }, compile, BASE_PLUGINS, options.remark);
|
|
13
|
+
await init();
|
|
14
|
+
const [imports] = parse(code);
|
|
15
|
+
const markdown = imports.map((item) => item.specifier).filter((specifier): specifier is string => typeof specifier === "string" && /^\.{0,2}\//.test(specifier) && /\.mdx?(?:\?|$)/.test(specifier));
|
|
16
|
+
if (markdown.length) throw new Error(`${options.path}: export compiler plugins do not apply to imported Markdown (${markdown.join(", ")}); move that content into the exported page`);
|
|
17
|
+
return code;
|
|
18
|
+
}
|