@bleedingdev/tanstack-redact 0.0.0-stage → 0.2.2

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.
Files changed (476) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cloudflare/index.d.ts +6 -0
  3. package/dist/cloudflare/index.js +39 -0
  4. package/dist/cloudflare/index.js.map +7 -0
  5. package/dist/core/attributes.d.ts +4 -0
  6. package/dist/core/attributes.js +30 -0
  7. package/dist/core/attributes.js.map +7 -0
  8. package/dist/core/browser.d.ts +9 -0
  9. package/dist/core/browser.js +32 -0
  10. package/dist/core/browser.js.map +7 -0
  11. package/dist/core/class-props.d.ts +1 -0
  12. package/dist/core/class-props.js +15 -0
  13. package/dist/core/class-props.js.map +7 -0
  14. package/dist/core/devtools.d.ts +26 -0
  15. package/dist/core/devtools.js +70 -0
  16. package/dist/core/devtools.js.map +7 -0
  17. package/dist/core/functions.d.ts +6 -0
  18. package/dist/core/functions.js +14 -0
  19. package/dist/core/functions.js.map +7 -0
  20. package/dist/core/index.d.ts +2 -0
  21. package/dist/core/index.js +3 -0
  22. package/dist/core/index.js.map +7 -0
  23. package/dist/core/internal.d.ts +103 -0
  24. package/dist/core/internal.js +43 -0
  25. package/dist/core/internal.js.map +7 -0
  26. package/dist/core/resource-hints.d.ts +7 -0
  27. package/dist/core/resource-hints.js +20 -0
  28. package/dist/core/resource-hints.js.map +7 -0
  29. package/dist/core/types.d.ts +23 -0
  30. package/dist/core/types.js +8 -0
  31. package/dist/core/types.js.map +7 -0
  32. package/dist/core/unitless-style.d.ts +1 -0
  33. package/dist/core/unitless-style.js +5 -0
  34. package/dist/core/unitless-style.js.map +7 -0
  35. package/dist/dom/_all.d.ts +27 -0
  36. package/dist/dom/_all.js +51 -0
  37. package/dist/dom/_all.js.map +7 -0
  38. package/dist/dom/client.d.ts +9 -0
  39. package/dist/dom/client.js +13 -0
  40. package/dist/dom/client.js.map +7 -0
  41. package/dist/dom/commit.d.ts +27 -0
  42. package/dist/dom/commit.js +237 -0
  43. package/dist/dom/commit.js.map +7 -0
  44. package/dist/dom/devtools-effects.d.ts +8 -0
  45. package/dist/dom/devtools-effects.js +80 -0
  46. package/dist/dom/devtools-effects.js.map +7 -0
  47. package/dist/dom/devtools.d.ts +33 -0
  48. package/dist/dom/devtools.js +635 -0
  49. package/dist/dom/devtools.js.map +7 -0
  50. package/dist/dom/dispatcher.d.ts +4 -0
  51. package/dist/dom/dispatcher.js +437 -0
  52. package/dist/dom/dispatcher.js.map +7 -0
  53. package/dist/dom/document-metadata.d.ts +7 -0
  54. package/dist/dom/document-metadata.js +44 -0
  55. package/dist/dom/document-metadata.js.map +7 -0
  56. package/dist/dom/dom.d.ts +11 -0
  57. package/dist/dom/dom.js +165 -0
  58. package/dist/dom/dom.js.map +7 -0
  59. package/dist/dom/error-info.d.ts +2 -0
  60. package/dist/dom/error-info.js +19 -0
  61. package/dist/dom/error-info.js.map +7 -0
  62. package/dist/dom/event-replay.d.ts +13 -0
  63. package/dist/dom/event-replay.js +24 -0
  64. package/dist/dom/event-replay.js.map +7 -0
  65. package/dist/dom/features/activity/full.d.ts +1 -0
  66. package/dist/dom/features/activity/full.js +140 -0
  67. package/dist/dom/features/activity/full.js.map +7 -0
  68. package/dist/dom/features/activity/index.d.ts +1 -0
  69. package/dist/dom/features/activity/index.js +2 -0
  70. package/dist/dom/features/activity/index.js.map +7 -0
  71. package/dist/dom/features/activity/stub.d.ts +1 -0
  72. package/dist/dom/features/activity/stub.js +10 -0
  73. package/dist/dom/features/activity/stub.js.map +7 -0
  74. package/dist/dom/features/class/full.d.ts +1 -0
  75. package/dist/dom/features/class/full.js +208 -0
  76. package/dist/dom/features/class/full.js.map +7 -0
  77. package/dist/dom/features/class/index.d.ts +1 -0
  78. package/dist/dom/features/class/index.js +2 -0
  79. package/dist/dom/features/class/index.js.map +7 -0
  80. package/dist/dom/features/class/stub.d.ts +1 -0
  81. package/dist/dom/features/class/stub.js +46 -0
  82. package/dist/dom/features/class/stub.js.map +7 -0
  83. package/dist/dom/features/context/full.d.ts +4 -0
  84. package/dist/dom/features/context/full.js +103 -0
  85. package/dist/dom/features/context/full.js.map +7 -0
  86. package/dist/dom/features/context/index.d.ts +1 -0
  87. package/dist/dom/features/context/index.js +2 -0
  88. package/dist/dom/features/context/index.js.map +7 -0
  89. package/dist/dom/features/context/stub.d.ts +4 -0
  90. package/dist/dom/features/context/stub.js +21 -0
  91. package/dist/dom/features/context/stub.js.map +7 -0
  92. package/dist/dom/features/forward-ref/full.d.ts +1 -0
  93. package/dist/dom/features/forward-ref/full.js +9 -0
  94. package/dist/dom/features/forward-ref/full.js.map +7 -0
  95. package/dist/dom/features/forward-ref/index.d.ts +1 -0
  96. package/dist/dom/features/forward-ref/index.js +2 -0
  97. package/dist/dom/features/forward-ref/index.js.map +7 -0
  98. package/dist/dom/features/forward-ref/stub.d.ts +1 -0
  99. package/dist/dom/features/forward-ref/stub.js +9 -0
  100. package/dist/dom/features/forward-ref/stub.js.map +7 -0
  101. package/dist/dom/features/fragment-refs/index.d.ts +1 -0
  102. package/dist/dom/features/fragment-refs/index.js +9 -0
  103. package/dist/dom/features/fragment-refs/index.js.map +7 -0
  104. package/dist/dom/features/fragment-refs/stub.d.ts +5 -0
  105. package/dist/dom/features/fragment-refs/stub.js +17 -0
  106. package/dist/dom/features/fragment-refs/stub.js.map +7 -0
  107. package/dist/dom/features/hydration/full.d.ts +68 -0
  108. package/dist/dom/features/hydration/full.js +493 -0
  109. package/dist/dom/features/hydration/full.js.map +7 -0
  110. package/dist/dom/features/hydration/index.d.ts +1 -0
  111. package/dist/dom/features/hydration/index.js +2 -0
  112. package/dist/dom/features/hydration/index.js.map +7 -0
  113. package/dist/dom/features/hydration/stub.d.ts +36 -0
  114. package/dist/dom/features/hydration/stub.js +80 -0
  115. package/dist/dom/features/hydration/stub.js.map +7 -0
  116. package/dist/dom/features/index.d.ts +8 -0
  117. package/dist/dom/features/index.js +9 -0
  118. package/dist/dom/features/index.js.map +7 -0
  119. package/dist/dom/features/lazy/full.d.ts +1 -0
  120. package/dist/dom/features/lazy/full.js +23 -0
  121. package/dist/dom/features/lazy/full.js.map +7 -0
  122. package/dist/dom/features/lazy/index.d.ts +1 -0
  123. package/dist/dom/features/lazy/index.js +2 -0
  124. package/dist/dom/features/lazy/index.js.map +7 -0
  125. package/dist/dom/features/lazy/stub.d.ts +1 -0
  126. package/dist/dom/features/lazy/stub.js +19 -0
  127. package/dist/dom/features/lazy/stub.js.map +7 -0
  128. package/dist/dom/features/memo/full.d.ts +1 -0
  129. package/dist/dom/features/memo/full.js +34 -0
  130. package/dist/dom/features/memo/full.js.map +7 -0
  131. package/dist/dom/features/memo/index.d.ts +1 -0
  132. package/dist/dom/features/memo/index.js +2 -0
  133. package/dist/dom/features/memo/index.js.map +7 -0
  134. package/dist/dom/features/memo/stub.d.ts +1 -0
  135. package/dist/dom/features/memo/stub.js +9 -0
  136. package/dist/dom/features/memo/stub.js.map +7 -0
  137. package/dist/dom/features/portal/full.d.ts +1 -0
  138. package/dist/dom/features/portal/full.js +11 -0
  139. package/dist/dom/features/portal/full.js.map +7 -0
  140. package/dist/dom/features/portal/index.d.ts +1 -0
  141. package/dist/dom/features/portal/index.js +2 -0
  142. package/dist/dom/features/portal/index.js.map +7 -0
  143. package/dist/dom/features/portal/stub.d.ts +1 -0
  144. package/dist/dom/features/portal/stub.js +5 -0
  145. package/dist/dom/features/portal/stub.js.map +7 -0
  146. package/dist/dom/features/suspense/full.d.ts +1 -0
  147. package/dist/dom/features/suspense/full.js +389 -0
  148. package/dist/dom/features/suspense/full.js.map +7 -0
  149. package/dist/dom/features/suspense/index.d.ts +1 -0
  150. package/dist/dom/features/suspense/index.js +2 -0
  151. package/dist/dom/features/suspense/index.js.map +7 -0
  152. package/dist/dom/features/suspense/stub.d.ts +1 -0
  153. package/dist/dom/features/suspense/stub.js +4 -0
  154. package/dist/dom/features/suspense/stub.js.map +7 -0
  155. package/dist/dom/features/suspense-runtime/index.d.ts +1 -0
  156. package/dist/dom/features/suspense-runtime/index.js +2 -0
  157. package/dist/dom/features/suspense-runtime/index.js.map +7 -0
  158. package/dist/dom/features/suspense-runtime/stub.d.ts +1 -0
  159. package/dist/dom/features/suspense-runtime/stub.js +11 -0
  160. package/dist/dom/features/suspense-runtime/stub.js.map +7 -0
  161. package/dist/dom/features/view-transition/full.d.ts +7 -0
  162. package/dist/dom/features/view-transition/full.js +324 -0
  163. package/dist/dom/features/view-transition/full.js.map +7 -0
  164. package/dist/dom/features/view-transition/index.d.ts +1 -0
  165. package/dist/dom/features/view-transition/index.js +2 -0
  166. package/dist/dom/features/view-transition/index.js.map +7 -0
  167. package/dist/dom/features/view-transition/resources.d.ts +11 -0
  168. package/dist/dom/features/view-transition/resources.js +117 -0
  169. package/dist/dom/features/view-transition/resources.js.map +7 -0
  170. package/dist/dom/features/view-transition/stub.d.ts +7 -0
  171. package/dist/dom/features/view-transition/stub.js +21 -0
  172. package/dist/dom/features/view-transition/stub.js.map +7 -0
  173. package/dist/dom/features/view-transition/visual.d.ts +14 -0
  174. package/dist/dom/features/view-transition/visual.js +404 -0
  175. package/dist/dom/features/view-transition/visual.js.map +7 -0
  176. package/dist/dom/form-actions.d.ts +4 -0
  177. package/dist/dom/form-actions.js +74 -0
  178. package/dist/dom/form-actions.js.map +7 -0
  179. package/dist/dom/form-controls.d.ts +3 -0
  180. package/dist/dom/form-controls.js +91 -0
  181. package/dist/dom/form-controls.js.map +7 -0
  182. package/dist/dom/fragment-instance.d.ts +33 -0
  183. package/dist/dom/fragment-instance.js +449 -0
  184. package/dist/dom/fragment-instance.js.map +7 -0
  185. package/dist/dom/index.d.ts +61 -0
  186. package/dist/dom/index.js +71 -0
  187. package/dist/dom/index.js.map +7 -0
  188. package/dist/dom/portal.d.ts +2 -0
  189. package/dist/dom/portal.js +14 -0
  190. package/dist/dom/portal.js.map +7 -0
  191. package/dist/dom/react-ids.d.ts +6 -0
  192. package/dist/dom/react-ids.js +38 -0
  193. package/dist/dom/react-ids.js.map +7 -0
  194. package/dist/dom/reconcile.d.ts +86 -0
  195. package/dist/dom/reconcile.js +1305 -0
  196. package/dist/dom/reconcile.js.map +7 -0
  197. package/dist/dom/refresh.d.ts +12 -0
  198. package/dist/dom/refresh.js +174 -0
  199. package/dist/dom/refresh.js.map +7 -0
  200. package/dist/dom/resource-hints.d.ts +6 -0
  201. package/dist/dom/resource-hints.js +107 -0
  202. package/dist/dom/resource-hints.js.map +7 -0
  203. package/dist/dom/resource-store.d.ts +13 -0
  204. package/dist/dom/resource-store.js +47 -0
  205. package/dist/dom/resource-store.js.map +7 -0
  206. package/dist/dom/resources.d.ts +1 -0
  207. package/dist/dom/resources.js +46 -0
  208. package/dist/dom/resources.js.map +7 -0
  209. package/dist/dom/retained-effects.d.ts +6 -0
  210. package/dist/dom/retained-effects.js +67 -0
  211. package/dist/dom/retained-effects.js.map +7 -0
  212. package/dist/dom/root-internal.d.ts +11 -0
  213. package/dist/dom/root-internal.js +35 -0
  214. package/dist/dom/root-internal.js.map +7 -0
  215. package/dist/dom/root.d.ts +17 -0
  216. package/dist/dom/root.js +38 -0
  217. package/dist/dom/root.js.map +7 -0
  218. package/dist/dom/synthetic-event.d.ts +1 -0
  219. package/dist/dom/synthetic-event.js +37 -0
  220. package/dist/dom/synthetic-event.js.map +7 -0
  221. package/dist/dom/test-utils.d.ts +1 -0
  222. package/dist/dom/test-utils.js +5 -0
  223. package/dist/dom/test-utils.js.map +7 -0
  224. package/dist/dom/transitions.d.ts +9 -0
  225. package/dist/dom/transitions.js +147 -0
  226. package/dist/dom/transitions.js.map +7 -0
  227. package/dist/dom/tree.d.ts +5 -0
  228. package/dist/dom/tree.js +62 -0
  229. package/dist/dom/tree.js.map +7 -0
  230. package/dist/dom/walk.d.ts +2 -0
  231. package/dist/dom/walk.js +14 -0
  232. package/dist/dom/walk.js.map +7 -0
  233. package/dist/next/client.d.ts +9 -0
  234. package/dist/next/client.js +14 -0
  235. package/dist/next/client.js.map +7 -0
  236. package/dist/next/dev-cache-loader.cjs +13 -0
  237. package/dist/next/index.d.ts +2 -0
  238. package/dist/next/index.js +97 -0
  239. package/dist/next/index.js.map +7 -0
  240. package/dist/next/loader.cjs +10 -0
  241. package/dist/next/react.d.ts +71 -0
  242. package/dist/next/react.js +9 -0
  243. package/dist/next/react.js.map +7 -0
  244. package/dist/react/act.d.ts +3 -0
  245. package/dist/react/act.js +124 -0
  246. package/dist/react/act.js.map +7 -0
  247. package/dist/react/action-scope.d.ts +17 -0
  248. package/dist/react/action-scope.js +60 -0
  249. package/dist/react/action-scope.js.map +7 -0
  250. package/dist/react/activity.d.ts +7 -0
  251. package/dist/react/activity.js +7 -0
  252. package/dist/react/activity.js.map +7 -0
  253. package/dist/react/children.d.ts +8 -0
  254. package/dist/react/children.js +76 -0
  255. package/dist/react/children.js.map +7 -0
  256. package/dist/react/class.d.ts +36 -0
  257. package/dist/react/class.js +39 -0
  258. package/dist/react/class.js.map +7 -0
  259. package/dist/react/compiler-runtime.d.ts +1 -0
  260. package/dist/react/compiler-runtime.js +9 -0
  261. package/dist/react/compiler-runtime.js.map +7 -0
  262. package/dist/react/context.d.ts +32 -0
  263. package/dist/react/context.js +25 -0
  264. package/dist/react/context.js.map +7 -0
  265. package/dist/react/element.d.ts +13 -0
  266. package/dist/react/element.js +70 -0
  267. package/dist/react/element.js.map +7 -0
  268. package/dist/react/form-state.d.ts +26 -0
  269. package/dist/react/form-state.js +30 -0
  270. package/dist/react/form-state.js.map +7 -0
  271. package/dist/react/hooks.d.ts +67 -0
  272. package/dist/react/hooks.js +165 -0
  273. package/dist/react/hooks.js.map +7 -0
  274. package/dist/react/index.d.ts +99 -0
  275. package/dist/react/index.js +143 -0
  276. package/dist/react/index.js.map +7 -0
  277. package/dist/react/jsx-runtime.d.ts +24 -0
  278. package/dist/react/jsx-runtime.js +37 -0
  279. package/dist/react/jsx-runtime.js.map +7 -0
  280. package/dist/react/memo.d.ts +20 -0
  281. package/dist/react/memo.js +27 -0
  282. package/dist/react/memo.js.map +7 -0
  283. package/dist/react/portal.d.ts +1 -0
  284. package/dist/react/portal.js +5 -0
  285. package/dist/react/portal.js.map +7 -0
  286. package/dist/react/shared-internals.d.ts +52 -0
  287. package/dist/react/shared-internals.js +22 -0
  288. package/dist/react/shared-internals.js.map +7 -0
  289. package/dist/react/suspense.d.ts +15 -0
  290. package/dist/react/suspense.js +15 -0
  291. package/dist/react/suspense.js.map +7 -0
  292. package/dist/react/thenable.d.ts +1 -0
  293. package/dist/react/thenable.js +25 -0
  294. package/dist/react/thenable.js.map +7 -0
  295. package/dist/react/view-transition.d.ts +32 -0
  296. package/dist/react/view-transition.js +12 -0
  297. package/dist/react/view-transition.js.map +7 -0
  298. package/dist/scheduler/index.d.ts +44 -0
  299. package/dist/scheduler/index.js +109 -0
  300. package/dist/scheduler/index.js.map +7 -0
  301. package/dist/server/bootstrap-script.d.ts +3 -0
  302. package/dist/server/bootstrap-script.js +17 -0
  303. package/dist/server/bootstrap-script.js.map +7 -0
  304. package/dist/server/dispatcher.d.ts +57 -0
  305. package/dist/server/dispatcher.js +157 -0
  306. package/dist/server/dispatcher.js.map +7 -0
  307. package/dist/server/escape.d.ts +6 -0
  308. package/dist/server/escape.js +75 -0
  309. package/dist/server/escape.js.map +7 -0
  310. package/dist/server/index.d.ts +16 -0
  311. package/dist/server/index.js +25 -0
  312. package/dist/server/index.js.map +7 -0
  313. package/dist/server/insertion-context.d.ts +3 -0
  314. package/dist/server/insertion-context.js +32 -0
  315. package/dist/server/renderToString.d.ts +7 -0
  316. package/dist/server/renderToString.js +33 -0
  317. package/dist/server/renderToString.js.map +7 -0
  318. package/dist/server/resource-hints.d.ts +22 -0
  319. package/dist/server/resource-hints.js +168 -0
  320. package/dist/server/resource-hints.js.map +7 -0
  321. package/dist/server/stream-ids.d.ts +3 -0
  322. package/dist/server/stream-ids.js +8 -0
  323. package/dist/server/stream.d.ts +61 -0
  324. package/dist/server/stream.js +418 -0
  325. package/dist/server/stream.js.map +7 -0
  326. package/dist/server/walk.d.ts +58 -0
  327. package/dist/server/walk.js +378 -0
  328. package/dist/server/walk.js.map +7 -0
  329. package/dist/vinext/compatibility.d.ts +23 -0
  330. package/dist/vinext/compatibility.js +127 -0
  331. package/dist/vinext/compatibility.js.map +7 -0
  332. package/dist/vinext/flight-timing.d.ts +1 -0
  333. package/dist/vinext/flight-timing.js +46 -0
  334. package/dist/vinext/flight-timing.js.map +7 -0
  335. package/dist/vinext/index.d.ts +5 -0
  336. package/dist/vinext/index.js +50 -0
  337. package/dist/vinext/index.js.map +7 -0
  338. package/dist/vite/index.d.ts +102 -0
  339. package/dist/vite/index.js +291 -0
  340. package/dist/vite/index.js.map +7 -0
  341. package/dist/vite/react18.d.ts +4 -0
  342. package/dist/vite/react18.js +74 -0
  343. package/dist/vite/react18.js.map +7 -0
  344. package/package.json +121 -4
  345. package/src/cloudflare/index.ts +44 -0
  346. package/src/core/attributes.ts +20 -0
  347. package/src/core/browser.ts +34 -0
  348. package/src/core/class-props.ts +12 -0
  349. package/src/core/devtools.ts +69 -0
  350. package/src/core/functions.ts +11 -0
  351. package/src/core/index.ts +2 -0
  352. package/src/core/internal.ts +123 -0
  353. package/src/core/resource-hints.ts +39 -0
  354. package/src/core/types.ts +39 -0
  355. package/src/core/unitless-style.ts +1 -0
  356. package/src/dom/_all.ts +46 -0
  357. package/src/dom/client.ts +17 -0
  358. package/src/dom/commit.ts +223 -0
  359. package/src/dom/devtools-effects.ts +78 -0
  360. package/src/dom/devtools.ts +527 -0
  361. package/src/dom/dispatcher.ts +476 -0
  362. package/src/dom/document-metadata.ts +41 -0
  363. package/src/dom/dom.ts +181 -0
  364. package/src/dom/error-info.ts +20 -0
  365. package/src/dom/event-replay.ts +39 -0
  366. package/src/dom/features/activity/full.ts +150 -0
  367. package/src/dom/features/activity/index.ts +1 -0
  368. package/src/dom/features/activity/stub.ts +12 -0
  369. package/src/dom/features/class/full.ts +202 -0
  370. package/src/dom/features/class/index.ts +1 -0
  371. package/src/dom/features/class/stub.ts +58 -0
  372. package/src/dom/features/context/full.ts +107 -0
  373. package/src/dom/features/context/index.ts +1 -0
  374. package/src/dom/features/context/stub.ts +26 -0
  375. package/src/dom/features/forward-ref/full.ts +9 -0
  376. package/src/dom/features/forward-ref/index.ts +1 -0
  377. package/src/dom/features/forward-ref/stub.ts +15 -0
  378. package/src/dom/features/fragment-refs/index.ts +1 -0
  379. package/src/dom/features/fragment-refs/stub.ts +6 -0
  380. package/src/dom/features/hydration/full.ts +563 -0
  381. package/src/dom/features/hydration/index.ts +1 -0
  382. package/src/dom/features/hydration/stub.ts +86 -0
  383. package/src/dom/features/index.ts +12 -0
  384. package/src/dom/features/lazy/full.ts +27 -0
  385. package/src/dom/features/lazy/index.ts +1 -0
  386. package/src/dom/features/lazy/stub.ts +24 -0
  387. package/src/dom/features/memo/full.ts +39 -0
  388. package/src/dom/features/memo/index.ts +1 -0
  389. package/src/dom/features/memo/stub.ts +13 -0
  390. package/src/dom/features/portal/full.ts +14 -0
  391. package/src/dom/features/portal/index.ts +1 -0
  392. package/src/dom/features/portal/stub.ts +11 -0
  393. package/src/dom/features/suspense/full.ts +469 -0
  394. package/src/dom/features/suspense/index.ts +1 -0
  395. package/src/dom/features/suspense/stub.ts +13 -0
  396. package/src/dom/features/suspense-runtime/index.ts +1 -0
  397. package/src/dom/features/suspense-runtime/stub.ts +1 -0
  398. package/src/dom/features/view-transition/full.ts +292 -0
  399. package/src/dom/features/view-transition/index.ts +1 -0
  400. package/src/dom/features/view-transition/resources.ts +123 -0
  401. package/src/dom/features/view-transition/stub.ts +8 -0
  402. package/src/dom/features/view-transition/visual.ts +454 -0
  403. package/src/dom/form-actions.ts +69 -0
  404. package/src/dom/form-controls.ts +91 -0
  405. package/src/dom/fragment-instance.ts +462 -0
  406. package/src/dom/index.ts +49 -0
  407. package/src/dom/portal.ts +16 -0
  408. package/src/dom/react-ids.ts +36 -0
  409. package/src/dom/reconcile.ts +1423 -0
  410. package/src/dom/refresh.ts +171 -0
  411. package/src/dom/resource-hints.ts +104 -0
  412. package/src/dom/resource-store.ts +50 -0
  413. package/src/dom/resources.ts +47 -0
  414. package/src/dom/retained-effects.ts +57 -0
  415. package/src/dom/root-internal.ts +37 -0
  416. package/src/dom/root.ts +59 -0
  417. package/src/dom/synthetic-event.ts +27 -0
  418. package/src/dom/test-utils.ts +1 -0
  419. package/src/dom/transitions.ts +141 -0
  420. package/src/dom/tree.ts +56 -0
  421. package/src/dom/walk.ts +8 -0
  422. package/src/next/client.ts +10 -0
  423. package/src/next/dev-cache-loader.cjs +13 -0
  424. package/src/next/index.ts +95 -0
  425. package/src/next/loader.cjs +10 -0
  426. package/src/next/react.ts +7 -0
  427. package/src/react/act.ts +105 -0
  428. package/src/react/action-scope.ts +57 -0
  429. package/src/react/activity.ts +10 -0
  430. package/src/react/children.ts +86 -0
  431. package/src/react/class.ts +66 -0
  432. package/src/react/compiler-runtime.ts +8 -0
  433. package/src/react/context.ts +46 -0
  434. package/src/react/element.ts +82 -0
  435. package/src/react/form-state.ts +35 -0
  436. package/src/react/hooks.ts +214 -0
  437. package/src/react/index.ts +91 -0
  438. package/src/react/jsx-runtime.ts +50 -0
  439. package/src/react/memo.ts +42 -0
  440. package/src/react/portal.ts +1 -0
  441. package/src/react/shared-internals.ts +80 -0
  442. package/src/react/suspense.ts +18 -0
  443. package/src/react/thenable.ts +21 -0
  444. package/src/react/view-transition.ts +41 -0
  445. package/src/scheduler/index.ts +124 -0
  446. package/src/server/bootstrap-script.ts +92 -0
  447. package/src/server/dispatcher.ts +168 -0
  448. package/src/server/escape.ts +102 -0
  449. package/src/server/index.ts +26 -0
  450. package/src/server/insertion-context.ts +28 -0
  451. package/src/server/renderToString.ts +35 -0
  452. package/src/server/resource-hints.ts +166 -0
  453. package/src/server/stream-ids.ts +5 -0
  454. package/src/server/stream.ts +525 -0
  455. package/src/server/walk.ts +555 -0
  456. package/src/vinext/compatibility.ts +122 -0
  457. package/src/vinext/flight-timing.ts +37 -0
  458. package/src/vinext/index.ts +47 -0
  459. package/src/vite/index.ts +476 -0
  460. package/src/vite/react18.ts +74 -0
  461. package/vendor/cloudflare-vite-plugin/LICENSE +25 -0
  462. package/vendor/cloudflare-vite-plugin/README.md +9 -0
  463. package/vendor/cloudflare-vite-plugin/dist/chunk-U6NEESU5-BmLHqeIt.mjs +43 -0
  464. package/vendor/cloudflare-vite-plugin/dist/index.d.mts +155 -0
  465. package/vendor/cloudflare-vite-plugin/dist/index.mjs +94700 -0
  466. package/vendor/cloudflare-vite-plugin/dist/open-PCXX3ZDZ-DYH87NhH.mjs +530 -0
  467. package/vendor/cloudflare-vite-plugin/dist/package-4cnqy5mM.mjs +84 -0
  468. package/vendor/cloudflare-vite-plugin/dist/workers/asset-worker/index.js +5996 -0
  469. package/vendor/cloudflare-vite-plugin/dist/workers/router-worker/index.js +6414 -0
  470. package/vendor/cloudflare-vite-plugin/dist/workers/runner-worker/index.js +457 -0
  471. package/vendor/cloudflare-vite-plugin/dist/workers/runner-worker/module-runner-legacy.js +1129 -0
  472. package/vendor/cloudflare-vite-plugin/dist/workers/runner-worker/module-runner.js +1259 -0
  473. package/vendor/cloudflare-vite-plugin/dist/workers/vite-proxy-worker/index.js +31 -0
  474. package/vendor/cloudflare-vite-plugin/package.json +90 -0
  475. package/vendor/cloudflare-vite-plugin/provenance.json +26 -0
  476. package/README.md +0 -3
@@ -0,0 +1,418 @@
1
+ // ultramodern-redact-patch: v1
2
+ import { boundaryId, segmentId, scriptId } from "./stream-ids.js";
3
+ import { segmentHtml } from "./insertion-context.js";
4
+ import { isThenable } from "../core/functions.js";
5
+ import { beginSSR, endSSR, applyContextSnapshot, currentSSRFrame } from "./dispatcher.js";
6
+ import { walk, boundaryEdges } from "./walk.js";
7
+ import { browserError, isBrowserToken, isBrowserError } from "../core/browser.js";
8
+ import { BOUNDARY_REVEAL_RUNTIME, revealScript } from "./bootstrap-script.js";
9
+ import { escapeAttr, escapeScript } from "./escape.js";
10
+ import { resourceURL } from "../core/resource-hints.js";
11
+ function createState() {
12
+ let wake;
13
+ const state = {
14
+ nextId: 0,
15
+ pending: /* @__PURE__ */ new Set(),
16
+ closed: false,
17
+ errored: null,
18
+ aborted: false,
19
+ reason: void 0,
20
+ cancelled: new Promise((resolve) => {
21
+ wake = resolve;
22
+ }),
23
+ abort(reason) {
24
+ if (state.closed || state.aborted)
25
+ return;
26
+ state.aborted = true;
27
+ state.reason = isBrowserToken(reason) ? browserError(reason) : reason ?? new Error("The render was aborted by the server without a reason.");
28
+ wake();
29
+ }
30
+ };
31
+ return state;
32
+ }
33
+ async function streamHtml(children, emit, options, state) {
34
+ const nonce = scriptNonce(options);
35
+ try {
36
+ const boundaries = [];
37
+ const shellChunks = [];
38
+ let head = 0;
39
+ const bufferedEmit = (chunk) => {
40
+ shellChunks.push(chunk);
41
+ };
42
+ let shellRendered = false;
43
+ let rootRetries = 0;
44
+ let resources;
45
+ while (!shellRendered) {
46
+ const shellErrors = [];
47
+ const chunkCount = shellChunks.length;
48
+ const boundaryCount = boundaries.length;
49
+ const nextId = state.nextId;
50
+ head = 0;
51
+ const previous = beginSSR(options.identifierPrefix);
52
+ currentSSRFrame().styleNonce = typeof options.nonce === "object" ? options.nonce?.style : void 0;
53
+ if (resources)
54
+ currentSSRFrame().resources = resources;
55
+ let suspended;
56
+ try {
57
+ if (state.aborted)
58
+ throw state.reason;
59
+ walk(children, {
60
+ emit: bufferedEmit,
61
+ onSuspend: (b) => boundaries.push(b),
62
+ nextBoundaryId: () => state.nextId++,
63
+ onBrowserBailout: options.onBrowserBailout,
64
+ onError: (error) => {
65
+ shellErrors.push(error);
66
+ },
67
+ onHead: () => {
68
+ head = shellChunks.length;
69
+ }
70
+ });
71
+ shellRendered = true;
72
+ state.frame = currentSSRFrame();
73
+ } catch (err) {
74
+ shellChunks.length = chunkCount;
75
+ boundaries.length = boundaryCount;
76
+ state.nextId = nextId;
77
+ if (!isThenable(err))
78
+ throw err;
79
+ if (++rootRetries > 50) {
80
+ throw new Error("renderToReadableStream exceeded 50 root suspension retries.");
81
+ }
82
+ suspended = err;
83
+ } finally {
84
+ resources = currentSSRFrame().resources;
85
+ endSSR(previous);
86
+ }
87
+ if (shellRendered)
88
+ for (const error of shellErrors)
89
+ options.onError?.(error);
90
+ if (suspended)
91
+ await Promise.race([suspended, state.cancelled]);
92
+ }
93
+ let written = false;
94
+ state.flush = () => {
95
+ if (written)
96
+ return;
97
+ written = true;
98
+ const hints = state.frame?.resources?.drain();
99
+ if (hints)
100
+ shellChunks.splice(head, 0, hints);
101
+ if (state.frame)
102
+ state.frame.shellFlushed = true;
103
+ let html = partsHtml(shellChunks, state, options);
104
+ const hasBootstrap = bootstrapScriptContentToArray(options.bootstrapScriptContent).length > 0 || (options.bootstrapScripts?.length ?? 0) > 0 || (options.bootstrapModules?.length ?? 0) > 0;
105
+ if (state.outlined || hasBootstrap) {
106
+ html += `<script${nonce ? ` nonce="${escapeAttr(nonce)}"` : ""}>${BOUNDARY_REVEAL_RUNTIME}<\/script>`;
107
+ for (const content of bootstrapScriptContentToArray(options.bootstrapScriptContent)) {
108
+ html += inlineBootstrapTag(content, nonce);
109
+ }
110
+ for (const s of options.bootstrapScripts ?? []) {
111
+ html += bootstrapTag(s, "script", nonce);
112
+ }
113
+ for (const m of options.bootstrapModules ?? []) {
114
+ html += bootstrapTag(m, "module", nonce);
115
+ }
116
+ }
117
+ if (html)
118
+ emit(normalizeDocumentShell(html));
119
+ };
120
+ if (state.flowing)
121
+ state.flush();
122
+ state.onShellReady?.();
123
+ for (const b of boundaries)
124
+ streamBoundary(b, emit, options, state);
125
+ await drain(state);
126
+ } catch (err) {
127
+ if (isBrowserError(err)) {
128
+ err = new Error("The server render could not complete because client rendering was requested outside a Suspense boundary.", Object.hasOwn(err, "cause") ? { cause: err.cause } : void 0);
129
+ }
130
+ state.errored = err;
131
+ if (options.onError)
132
+ options.onError(err);
133
+ throw err;
134
+ } finally {
135
+ state.closed = true;
136
+ }
137
+ }
138
+ function streamBoundary(b, emit, options, state) {
139
+ const nonce = scriptNonce(options);
140
+ const task = (async () => {
141
+ try {
142
+ await Promise.race([b.thenable, state.cancelled]);
143
+ } catch {
144
+ }
145
+ if (state.closed)
146
+ return;
147
+ const defer = (error) => {
148
+ if (isBrowserError(error))
149
+ options.onBrowserBailout?.(error, { componentStack: error.componentStack || b.componentStack });
150
+ else
151
+ options.onError?.(error);
152
+ if (b.written)
153
+ emit(`<script${nonce ? ` nonce="${escapeAttr(nonce)}"` : ""}>$RB(${scriptId(boundaryId(b.id, options.identifierPrefix))}${isBrowserError(error) ? "" : ",1"})<\/script>`);
154
+ else
155
+ b.marker = isBrowserError(error) ? "$!" : "$E";
156
+ };
157
+ if (state.aborted) {
158
+ defer(state.reason);
159
+ return;
160
+ }
161
+ const written = b.written;
162
+ const parts = [];
163
+ const sub = [];
164
+ const resourceScope = {};
165
+ let styles;
166
+ const previous = beginSSR(options.identifierPrefix, state.frame);
167
+ if (written)
168
+ state.frame?.resources?.takeStylesheets();
169
+ const restore = applyContextSnapshot(b.contextSnapshot);
170
+ try {
171
+ walk(b.children, {
172
+ insertionContext: b.insertionContext,
173
+ treeId: b.treeId,
174
+ emit: (s) => parts.push(s),
175
+ onSuspend: (n) => sub.push(n),
176
+ nextBoundaryId: () => state.nextId++,
177
+ onBrowserBailout: options.onBrowserBailout,
178
+ onError: options.onError,
179
+ componentStack: b.componentStack,
180
+ resourceScope
181
+ });
182
+ state.frame?.resources?.mergeScope(resourceScope);
183
+ } catch (err) {
184
+ if (isThenable(err)) {
185
+ b.thenable = err;
186
+ streamBoundary(b, emit, options, state);
187
+ } else
188
+ defer(err);
189
+ return;
190
+ } finally {
191
+ restore();
192
+ endSSR(previous);
193
+ if (written) {
194
+ const hints = state.frame?.resources?.drain();
195
+ styles = state.frame?.resources?.takeStylesheets();
196
+ if (hints)
197
+ emit(hints);
198
+ }
199
+ }
200
+ if (written)
201
+ emit(segmentHtml(partsHtml(parts, state, options), segmentId(b.id, options.identifierPrefix), b.insertionContext) + revealScript(b.id, nonce, styles, options.identifierPrefix));
202
+ else
203
+ b.content = parts;
204
+ for (const s of sub)
205
+ streamBoundary(s, emit, options, state);
206
+ })();
207
+ state.pending.add(task);
208
+ task.then(() => state.pending.delete(task), () => state.pending.delete(task));
209
+ }
210
+ function partsHtml(parts, state, options) {
211
+ let html = "";
212
+ for (const part of parts) {
213
+ if (typeof part === "string") {
214
+ html += part;
215
+ continue;
216
+ }
217
+ const marker = part.content ? "$" : part.marker ?? "$?";
218
+ if (marker === "$?")
219
+ part.written = state.outlined = true;
220
+ const [open, close] = boundaryEdges(part.id, marker, part.insertionContext, options.identifierPrefix ?? "");
221
+ html += open + partsHtml(part.content ?? part.fallback, state, options) + close;
222
+ }
223
+ return html;
224
+ }
225
+ async function drain(state) {
226
+ while (state.pending.size > 0) {
227
+ await Promise.race(state.pending);
228
+ }
229
+ }
230
+ function scriptNonce(options) {
231
+ return typeof options.nonce === "string" ? options.nonce : options.nonce?.script;
232
+ }
233
+ function bootstrapScriptContentToArray(content) {
234
+ if (content === void 0)
235
+ return [];
236
+ return typeof content === "string" ? [content] : [...content];
237
+ }
238
+ function inlineBootstrapTag(content, defaultNonce) {
239
+ const nAttr = defaultNonce ? ` nonce="${escapeAttr(defaultNonce)}"` : "";
240
+ return `<script${nAttr}>${escapeScript(content)}<\/script>`;
241
+ }
242
+ function normalizeDocumentShell(html) {
243
+ const doctypeIndex = html.indexOf("<!DOCTYPE html><html");
244
+ if (doctypeIndex <= 0)
245
+ return html;
246
+ const headPrefix = html.slice(0, doctypeIndex);
247
+ if (!isHeadPrefix(headPrefix))
248
+ return html;
249
+ const documentHtml = html.slice(doctypeIndex);
250
+ const headOpen = documentHtml.match(/<head(?:\s[^>]*)?>/);
251
+ if (!headOpen || headOpen.index === void 0)
252
+ return html;
253
+ const insertAt = headOpen.index + headOpen[0].length;
254
+ return documentHtml.slice(0, insertAt) + headPrefix + documentHtml.slice(insertAt);
255
+ }
256
+ function isHeadPrefix(value) {
257
+ if (!value)
258
+ return false;
259
+ return stripLeadingHeadTags(value).trim() === "";
260
+ }
261
+ function stripLeadingHeadTags(value) {
262
+ let rest = value;
263
+ let changed = true;
264
+ while (changed) {
265
+ changed = false;
266
+ const next = rest.replace(/^\s*(?:<meta\b[^>]*>|<link\b[^>]*>|<base\b[^>]*>|<title\b[^>]*>[\s\S]*?<\/title>|<style\b[^>]*>[\s\S]*?<\/style>|<script\b[^>]*>[\s\S]*?<\/script>)/i, "");
267
+ if (next !== rest) {
268
+ rest = next;
269
+ changed = true;
270
+ }
271
+ }
272
+ return rest;
273
+ }
274
+ function bootstrapTag(entry, kind, defaultNonce) {
275
+ const src = escapeAttr(resourceURL(typeof entry === "string" ? entry : entry.src));
276
+ const nonce = typeof entry === "string" ? defaultNonce : entry.nonce ?? defaultNonce;
277
+ const nAttr = nonce ? ` nonce="${escapeAttr(nonce)}"` : "";
278
+ if (kind === "module")
279
+ return `<script type="module"${nAttr} src="${src}"><\/script>`;
280
+ return `<script async${nAttr} src="${src}"><\/script>`;
281
+ }
282
+ function renderToReadableStream(children, options = {}) {
283
+ const state = createState();
284
+ const encoder = new TextEncoder();
285
+ let abortListener;
286
+ const detachAbortListener = () => {
287
+ if (abortListener) {
288
+ options.signal?.removeEventListener("abort", abortListener);
289
+ abortListener = void 0;
290
+ }
291
+ };
292
+ let allReadyResolve;
293
+ let allReadyReject;
294
+ const allReady = new Promise((r, rej) => {
295
+ allReadyResolve = r;
296
+ allReadyReject = rej;
297
+ });
298
+ allReady.catch(() => {
299
+ });
300
+ let shellResolve;
301
+ let shellReject;
302
+ const shell = new Promise((resolve, reject) => {
303
+ shellResolve = resolve;
304
+ shellReject = reject;
305
+ });
306
+ state.onShellReady = () => queueMicrotask(() => shellResolve(Object.assign(stream, { allReady })));
307
+ const close = (controller) => {
308
+ try {
309
+ controller.close();
310
+ } catch {
311
+ }
312
+ };
313
+ const stream = new ReadableStream({
314
+ start(controller) {
315
+ const emit = (chunk) => {
316
+ try {
317
+ controller.enqueue(encoder.encode(chunk));
318
+ } catch {
319
+ }
320
+ };
321
+ if (options.signal) {
322
+ abortListener = () => {
323
+ detachAbortListener();
324
+ state.abort(options.signal.reason);
325
+ };
326
+ options.signal.addEventListener("abort", abortListener);
327
+ if (options.signal.aborted)
328
+ abortListener();
329
+ }
330
+ streamHtml(children, emit, options, state).then(() => {
331
+ detachAbortListener();
332
+ if (state.flowing)
333
+ close(controller);
334
+ allReadyResolve();
335
+ }, (err) => {
336
+ detachAbortListener();
337
+ try {
338
+ controller.error(err);
339
+ } catch {
340
+ }
341
+ allReadyReject(err);
342
+ shellReject(err);
343
+ });
344
+ },
345
+ pull(controller) {
346
+ state.flowing = true;
347
+ state.flush?.();
348
+ if (state.closed && !state.errored)
349
+ close(controller);
350
+ },
351
+ cancel(reason) {
352
+ state.abort(reason);
353
+ detachAbortListener();
354
+ }
355
+ }, { highWaterMark: 0 });
356
+ return shell;
357
+ }
358
+ function renderToPipeableStream(children, options = {}) {
359
+ const state = createState();
360
+ let dest = null;
361
+ let shellReady = false;
362
+ let shellFailed = false;
363
+ let finished = false;
364
+ let failed = false;
365
+ let failure;
366
+ const finishDestination = (target) => {
367
+ if (failed && target.destroy)
368
+ target.destroy(failure);
369
+ else
370
+ target.end();
371
+ };
372
+ const emit = (chunk) => {
373
+ if (!failed)
374
+ dest.write(chunk);
375
+ };
376
+ state.onShellReady = () => queueMicrotask(() => {
377
+ if (shellFailed)
378
+ return;
379
+ shellReady = true;
380
+ options.onShellReady?.();
381
+ });
382
+ streamHtml(children, emit, options, state).then(() => {
383
+ finished = true;
384
+ if (dest)
385
+ dest.end();
386
+ options.onAllReady?.();
387
+ }, (err) => {
388
+ finished = true;
389
+ failed = true;
390
+ failure = err;
391
+ if (!shellReady) {
392
+ shellFailed = true;
393
+ options.onShellError?.(err);
394
+ } else {
395
+ if (dest)
396
+ finishDestination(dest);
397
+ }
398
+ });
399
+ return {
400
+ pipe(target) {
401
+ dest = target;
402
+ state.flowing = true;
403
+ if (!failed)
404
+ state.flush?.();
405
+ if (finished)
406
+ finishDestination(target);
407
+ return target;
408
+ },
409
+ abort(reason) {
410
+ state.abort(reason);
411
+ }
412
+ };
413
+ }
414
+ export {
415
+ renderToPipeableStream,
416
+ renderToReadableStream,
417
+ streamHtml
418
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/server/stream.ts"],
4
+ "sourcesContent": ["import { isFunction, isThenable } from '../core/functions'\nimport type { ReactNode } from '../core'\nimport {\n beginSSR,\n endSSR,\n applyContextSnapshot,\n currentSSRFrame,\n type SSRFrame,\n} from './dispatcher'\nimport { walk, type SuspendedBoundary, type BrowserBailoutCallback } from './walk'\nimport { browserError, isBrowserToken, isBrowserError } from '../core/browser'\nimport { BOUNDARY_REVEAL_RUNTIME, revealScript } from './bootstrap-script'\nimport { escapeAttr, escapeScript } from './escape'\nimport { resourceURL } from '../core/resource-hints'\nimport type { ResourceScope } from './resource-hints'\n\nexport interface StreamOptions {\n identifierPrefix?: string\n nonce?: string | { script?: string; style?: string }\n bootstrapScriptContent?: string | ReadonlyArray<string>\n bootstrapScripts?: ReadonlyArray<string | { src: string; async?: boolean; nonce?: string }>\n bootstrapModules?: ReadonlyArray<string | { src: string; nonce?: string }>\n onError?: (error: unknown) => string | void\n onBrowserBailout?: BrowserBailoutCallback\n signal?: AbortSignal\n progressiveChunkSize?: number\n}\n\nexport interface ReadableStreamResult extends ReadableStream<Uint8Array> {\n allReady: Promise<void>\n}\n\nexport interface PipeableWritable {\n write(chunk: string): unknown\n end(): unknown\n destroy?(error?: unknown): unknown\n}\n\nexport interface OrchestratorState {\n nextId: number\n pending: Set<Promise<void>>\n closed: boolean\n errored: unknown | null\n aborted: boolean\n reason: unknown\n abort: (reason?: unknown) => void\n cancelled: Promise<void>\n onShellReady?: () => void\n frame?: SSRFrame\n}\n\nfunction createState(): OrchestratorState {\n let wake!: () => void\n const state: OrchestratorState = {\n nextId: 0, pending: new Set(), closed: false, errored: null,\n aborted: false, reason: undefined,\n cancelled: new Promise<void>((resolve) => { wake = resolve }),\n abort(reason) {\n if (state.closed || state.aborted) return\n state.aborted = true\n state.reason = isBrowserToken(reason) ? browserError(reason) : reason ?? new Error('The render was aborted by the server without a reason.')\n wake()\n },\n }\n return state\n}\n\ntype Emit = (chunk: string) => void\n\nexport async function streamHtml(\n children: ReactNode,\n emit: Emit,\n options: StreamOptions,\n state: OrchestratorState,\n): Promise<void> {\n const nonce = scriptNonce(options)\n\n try {\n const boundaries: SuspendedBoundary[] = []\n\n // Buffer shell + bootstrap into a string[] and flush as a single emit.\n // Per-emit overhead in renderToReadableStream is TextEncoder.encode +\n // controller.enqueue — each walkHost normally fires 3+ emits (opening\n // tag, per-attribute, closing bracket), which for a ~30-component tree\n // is ~100 stream-controller round-trips. Batching collapses those into\n // one encode and one enqueue per shell — measured ~2-4% of total SSR\n // time on CPU profiles.\n const shellChunks: string[] = []\n let head = 0\n const bufferedEmit: Emit = (chunk) => {\n shellChunks.push(chunk)\n }\n\n // 1. Render the shell. A root-level `use(promise)` has no Suspense\n // boundary to capture it, but App Router SSR commonly suspends at this\n // level while resolving the RSC stream. Wait and retry without leaking\n // partial shell chunks or boundary ids from the aborted attempt.\n let shellRendered = false\n let rootRetries = 0\n let resources: SSRFrame['resources']\n while (!shellRendered) {\n const shellErrors: unknown[] = []\n const chunkCount = shellChunks.length\n const boundaryCount = boundaries.length\n const nextId = state.nextId\n head = 0\n const previous = beginSSR(options.identifierPrefix)\n currentSSRFrame().styleNonce = typeof options.nonce === 'object' ? options.nonce?.style : undefined\n if (resources) currentSSRFrame().resources = resources\n let suspended: Promise<unknown> | undefined\n try {\n if (state.aborted) throw state.reason\n walk(children, {\n emit: bufferedEmit,\n onSuspend: (b) => boundaries.push(b),\n nextBoundaryId: () => state.nextId++,\n onBrowserBailout: options.onBrowserBailout,\n onError: error => { shellErrors.push(error) },\n onHead: () => { head = shellChunks.length },\n })\n shellRendered = true\n state.frame = currentSSRFrame()\n } catch (err) {\n shellChunks.length = chunkCount\n boundaries.length = boundaryCount\n state.nextId = nextId\n if (!isThenable(err)) throw err\n if (++rootRetries > 50) {\n throw new Error('renderToReadableStream exceeded 50 root suspension retries.')\n }\n suspended = err\n } finally {\n resources = currentSSRFrame().resources\n endSSR(previous)\n }\n if (shellRendered) for (const error of shellErrors) options.onError?.(error)\n if (suspended) await Promise.race([suspended, state.cancelled])\n }\n\n const hints = state.frame?.resources?.drain()\n if (hints) shellChunks.splice(head, 0, hints)\n if (state.frame) state.frame.shellFlushed = true\n\n // 2. Inject runtime + bootstrap scripts (once, after shell). Skip the\n // reveal/event-replay runtime when nothing needs it — no suspensions to\n // reveal and no bootstrap scripts to guard against early user input. That\n // keeps fully-static SSR responses byte-equivalent to a plain walk and\n // matches React's behavior where `renderToReadableStream` of a static\n // tree emits only the markup.\n const hasBootstrap =\n bootstrapScriptContentToArray(options.bootstrapScriptContent).length > 0 ||\n (options.bootstrapScripts?.length ?? 0) > 0 ||\n (options.bootstrapModules?.length ?? 0) > 0\n if (boundaries.length > 0 || hasBootstrap) {\n shellChunks.push(`<script${nonce ? ` nonce=\"${escapeAttr(nonce)}\"` : ''}>${BOUNDARY_REVEAL_RUNTIME}</script>`)\n for (const content of bootstrapScriptContentToArray(options.bootstrapScriptContent)) {\n shellChunks.push(inlineBootstrapTag(content, nonce))\n }\n for (const s of options.bootstrapScripts ?? []) {\n shellChunks.push(bootstrapTag(s, 'script', nonce))\n }\n for (const m of options.bootstrapModules ?? []) {\n shellChunks.push(bootstrapTag(m, 'module', nonce))\n }\n }\n\n if (shellChunks.length) emit(normalizeDocumentShell(shellChunks.join('')))\n state.onShellReady?.()\n\n // 3. Stream suspended boundaries as they resolve\n for (const b of boundaries) streamBoundary(b, emit, options, state)\n await drain(state)\n } catch (err) {\n if (isBrowserError(err)) {\n err = new Error('The server render could not complete because client rendering was requested outside a Suspense boundary.',\n Object.hasOwn(err, 'cause') ? { cause: err.cause } : undefined)\n }\n state.errored = err\n if (options.onError) options.onError(err)\n throw err\n } finally {\n state.closed = true\n }\n}\n\nfunction streamBoundary(\n b: SuspendedBoundary,\n emit: Emit,\n options: StreamOptions,\n state: OrchestratorState,\n): void {\n const nonce = scriptNonce(options)\n const task = (async () => {\n try {\n await Promise.race([b.thenable, state.cancelled])\n } catch {}\n if (state.closed) return\n\n const defer = (error: unknown) => {\n if (isBrowserError(error)) options.onBrowserBailout?.(error, { componentStack: (error as any).componentStack || b.componentStack })\n else options.onError?.(error)\n emit(`<script${nonce ? ` nonce=\"${escapeAttr(nonce)}\"` : ''}>$RB(${b.id}${isBrowserError(error) ? '' : ',1'})</script>`)\n }\n if (state.aborted) { defer(state.reason); return }\n\n // Re-render the boundary's children into a string, restoring the\n // provider stack from when the boundary first suspended.\n const parts: string[] = []\n const sub: SuspendedBoundary[] = []\n const resourceScope: ResourceScope = {}\n let styles: string[][] | undefined\n const previous = beginSSR(options.identifierPrefix, state.frame)\n state.frame?.resources?.takeStylesheets()\n const restore = applyContextSnapshot(b.contextSnapshot)\n try {\n walk(b.children, {\n emit: (s) => parts.push(s),\n onSuspend: (n) => sub.push(n),\n nextBoundaryId: () => state.nextId++,\n onBrowserBailout: options.onBrowserBailout,\n onError: options.onError,\n componentStack: b.componentStack,\n resourceScope,\n })\n state.frame?.resources?.mergeScope(resourceScope)\n } catch (err) {\n if (isThenable(err)) {\n streamBoundary({ ...b, thenable: err }, emit, options, state)\n } else defer(err)\n return\n } finally {\n restore()\n endSSR(previous)\n const hints = state.frame?.resources?.drain()\n styles = state.frame?.resources?.takeStylesheets()\n if (hints) emit(hints)\n }\n\n emit(`<div hidden id=\"S:${b.id}\">${parts.join('')}</div>${revealScript(b.id, nonce, styles)}`)\n\n // Recurse: any nested suspensions inside the now-revealed content\n for (const s of sub) streamBoundary(s, emit, options, state)\n })()\n state.pending.add(task)\n task.then(() => state.pending.delete(task), () => state.pending.delete(task))\n}\n\nasync function drain(state: OrchestratorState): Promise<void> {\n while (state.pending.size > 0) {\n await Promise.race(state.pending)\n }\n}\n\nfunction scriptNonce(options: StreamOptions): string | undefined {\n return typeof options.nonce === 'string' ? options.nonce : options.nonce?.script\n}\n\nfunction bootstrapScriptContentToArray(\n content: StreamOptions['bootstrapScriptContent'],\n): string[] {\n if (content === undefined) return []\n return typeof content === 'string' ? [content] : [...content]\n}\n\nfunction inlineBootstrapTag(content: string, defaultNonce: string | undefined): string {\n const nAttr = defaultNonce ? ` nonce=\"${escapeAttr(defaultNonce)}\"` : ''\n return `<script${nAttr}>${escapeScript(content)}</script>`\n}\n\nfunction normalizeDocumentShell(html: string): string {\n const doctypeIndex = html.indexOf('<!DOCTYPE html><html')\n if (doctypeIndex <= 0) return html\n\n const headPrefix = html.slice(0, doctypeIndex)\n if (!isHeadPrefix(headPrefix)) return html\n\n const documentHtml = html.slice(doctypeIndex)\n const headOpen = documentHtml.match(/<head(?:\\s[^>]*)?>/)\n if (!headOpen || headOpen.index === undefined) return html\n\n const insertAt = headOpen.index + headOpen[0].length\n return documentHtml.slice(0, insertAt) + headPrefix + documentHtml.slice(insertAt)\n}\n\nfunction isHeadPrefix(value: string): boolean {\n if (!value) return false\n return stripLeadingHeadTags(value).trim() === ''\n}\n\nfunction stripLeadingHeadTags(value: string): string {\n let rest = value\n let changed = true\n while (changed) {\n changed = false\n const next = rest.replace(\n /^\\s*(?:<meta\\b[^>]*>|<link\\b[^>]*>|<base\\b[^>]*>|<title\\b[^>]*>[\\s\\S]*?<\\/title>|<style\\b[^>]*>[\\s\\S]*?<\\/style>|<script\\b[^>]*>[\\s\\S]*?<\\/script>)/i,\n '',\n )\n if (next !== rest) {\n rest = next\n changed = true\n }\n }\n return rest\n}\n\nfunction bootstrapTag(\n entry: string | { src: string; async?: boolean; nonce?: string },\n kind: 'script' | 'module',\n defaultNonce: string | undefined,\n): string {\n const src = escapeAttr(resourceURL(typeof entry === 'string' ? entry : entry.src))\n const nonce = typeof entry === 'string' ? defaultNonce : entry.nonce ?? defaultNonce\n const nAttr = nonce ? ` nonce=\"${escapeAttr(nonce)}\"` : ''\n if (kind === 'module') return `<script type=\"module\"${nAttr} src=\"${src}\"></script>`\n return `<script async${nAttr} src=\"${src}\"></script>`\n}\n\n// ---------------------------------------------------------------------------\n// Web Streams: renderToReadableStream\n// ---------------------------------------------------------------------------\n\nexport function renderToReadableStream(\n children: ReactNode,\n options: StreamOptions = {},\n): Promise<ReadableStreamResult> {\n const state = createState()\n const encoder = new TextEncoder()\n let abortListener: (() => void) | undefined\n const detachAbortListener = () => {\n if (abortListener) {\n options.signal?.removeEventListener('abort', abortListener)\n abortListener = undefined\n }\n }\n\n let allReadyResolve!: () => void\n let allReadyReject!: (e: unknown) => void\n const allReady = new Promise<void>((r, rej) => {\n allReadyResolve = r\n allReadyReject = rej\n })\n // Shell failures reject the outer promise before callers receive allReady.\n allReady.catch(() => {})\n let shellResolve!: (stream: ReadableStreamResult) => void\n let shellReject!: (error: unknown) => void\n const shell = new Promise<ReadableStreamResult>((resolve, reject) => {\n shellResolve = resolve\n shellReject = reject\n })\n state.onShellReady = () => queueMicrotask(() => shellResolve(Object.assign(stream, { allReady })))\n\n const stream = new ReadableStream<Uint8Array>({\n start(controller) {\n const emit = (chunk: string) => {\n try {\n controller.enqueue(encoder.encode(chunk))\n } catch {}\n }\n\n if (options.signal) {\n abortListener = () => {\n detachAbortListener()\n state.abort(options.signal!.reason)\n }\n options.signal.addEventListener('abort', abortListener)\n if (options.signal.aborted) abortListener()\n }\n\n streamHtml(children, emit, options, state).then(\n () => {\n detachAbortListener()\n try {\n controller.close()\n } catch {}\n allReadyResolve()\n },\n (err) => {\n detachAbortListener()\n try {\n controller.error(err)\n } catch {}\n allReadyReject(err)\n shellReject(err)\n },\n )\n\n },\n cancel(reason) {\n state.abort(reason)\n detachAbortListener()\n },\n })\n\n return shell\n}\n\n// ---------------------------------------------------------------------------\n// Node Streams: renderToPipeableStream\n// ---------------------------------------------------------------------------\n\nexport interface PipeableHandle {\n pipe<T extends PipeableWritable>(dest: T): T\n abort(reason?: unknown): void\n}\n\nexport interface PipeableOptions extends StreamOptions {\n onShellReady?: () => void\n onShellError?: (err: unknown) => void\n onAllReady?: () => void\n}\n\nexport function renderToPipeableStream(\n children: ReactNode,\n options: PipeableOptions = {},\n): PipeableHandle {\n const state = createState()\n\n const buffers: string[] = []\n let dest: PipeableWritable | null = null\n let shellReady = false\n let shellFailed = false\n let finished = false\n let failed = false\n let failure: unknown\n\n const finishDestination = (target: PipeableWritable) => {\n if (failed && target.destroy) target.destroy(failure)\n else target.end()\n }\n\n const flushTo = (w: PipeableWritable) => {\n if (!buffers.length) return\n for (const b of buffers) w.write(b)\n buffers.length = 0\n }\n\n const emit: Emit = (chunk) => {\n if (finished) return\n if (dest) dest.write(chunk)\n else buffers.push(chunk)\n }\n\n state.onShellReady = () => queueMicrotask(() => {\n if (shellFailed) return\n shellReady = true\n options.onShellReady?.()\n })\n\n // Kick off rendering\n streamHtml(children, emit, options, state).then(\n () => {\n finished = true\n if (dest) dest.end()\n options.onAllReady?.()\n },\n (err) => {\n finished = true\n failed = true\n failure = err\n if (!shellReady) {\n shellFailed = true\n options.onShellError?.(err)\n } else {\n if (dest) finishDestination(dest)\n }\n },\n )\n\n return {\n pipe<T extends PipeableWritable>(target: T): T {\n dest = target\n if (!failed) flushTo(target)\n if (finished) finishDestination(target)\n return target\n },\n abort(reason?: unknown) {\n state.abort(reason)\n },\n }\n}\n"],
5
+ "mappings": "AAAA,SAAqB,kBAAkB;AAEvC,SACE,UACA,QACA,sBACA,uBAEK;AACP,SAAS,YAAiE;AAC1E,SAAS,cAAc,gBAAgB,sBAAsB;AAC7D,SAAS,yBAAyB,oBAAoB;AACtD,SAAS,YAAY,oBAAoB;AACzC,SAAS,mBAAmB;AAsC5B,SAAS,cAAW;AAClB,MAAI;AACJ,QAAM,QAA2B;IAC/B,QAAQ;IAAG,SAAS,oBAAI,IAAG;IAAI,QAAQ;IAAO,SAAS;IACvD,SAAS;IAAO,QAAQ;IACxB,WAAW,IAAI,QAAc,CAAC,YAAW;AAAG,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AG;EACjB;AAEA,QAAM,UAAU,CAAC,MAAuB;AACtC,QAAI,CAAC,QAAQ;AAAQ;AACrB,eAAW,KAAK;AAAS,QAAE,MAAM,CAAC;AAClC,YAAQ,SAAS;EACnB;AAEA,QAAM,OAAa,CAAC,UAAS;AAC3B,QAAI;AAAU;AACd,QAAI;AAAM,WAAK,MAAM,KAAK;;AACrB,cAAQ,KAAK,KAAK;EACzB;AAEA,QAAM,eAAe,MAAM,eAAe,MAAK;AAC7C,QAAI;AAAa;AACjB,iBAAa;AACb,YAAQ,eAAc;EACxB,CAAC;AAGD,aAAW,UAAU,MAAM,SAAS,KAAK,EAAE,KACzC,MAAK;AACH,eAAW;AACX,QAAI;AAAM,WAAK,IAAG;AAClB,YAAQ,aAAY;EACtB,GACA,CAAC,QAAO;AACN,eAAW;AACX,aAAS;AACT,cAAU;AACV,QAAI,CAAC,YAAY;AACf,oBAAc;AACd,cAAQ,eAAe,GAAG;IAC5B,OAAO;AACL,UAAI;AAAM,0BAAkB,IAAI;IAClC;EACF,CAAC;AAGH,SAAO;IACL,KAAiC,QAAS;AACxC,aAAO;AACP,UAAI,CAAC;AAAQ,gBAAQ,MAAM;AAC3B,UAAI;AAAU,0BAAkB,MAAM;AACtC,aAAO;IACT;IACA,MAAM,QAAgB;AACpB,YAAM,MAAM,MAAM;IACpB;;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,58 @@
1
+ import { type InsertionContext } from './insertion-context.js';
2
+ import { type ReactNode } from '../core/index.js';
3
+ import { type ContextSnapshot } from './dispatcher.js';
4
+ import type { ResourceScope } from './resource-hints.js';
5
+ export interface ServerErrorInfo {
6
+ componentStack: string;
7
+ }
8
+ export type BrowserBailoutCallback = (error: Error, errorInfo: ServerErrorInfo) => void;
9
+ /** Streamed output keeps pending boundaries addressable until it is written. */
10
+ export type HtmlPart = string | SuspendedBoundary;
11
+ export interface SuspendedBoundary {
12
+ id: number;
13
+ treeId: bigint;
14
+ insertionContext: InsertionContext;
15
+ fallback: HtmlPart[];
16
+ children: ReactNode;
17
+ thenable: Promise<any>;
18
+ contextSnapshot: ContextSnapshot;
19
+ componentStack: string;
20
+ content?: HtmlPart[];
21
+ marker?: string;
22
+ written?: boolean;
23
+ }
24
+ export interface WalkOptions {
25
+ insertionContext?: InsertionContext | undefined;
26
+ treeId?: bigint | undefined;
27
+ emit: (chunk: HtmlPart) => void;
28
+ onHead?: () => void;
29
+ onSuspend?: ((boundary: SuspendedBoundary) => void) | undefined;
30
+ onBrowserBailout?: BrowserBailoutCallback | undefined;
31
+ onError?: ((error: unknown) => unknown) | undefined;
32
+ componentStack?: string | undefined;
33
+ thrownInfo?: {
34
+ componentStack?: string | undefined;
35
+ };
36
+ nextBoundaryId: () => number;
37
+ bootstrapped?: boolean | undefined;
38
+ isBoundaryResolution?: boolean | undefined;
39
+ resourceScope?: ResourceScope | undefined;
40
+ textState?: {
41
+ bits: number;
42
+ };
43
+ }
44
+ /**
45
+ * Synchronously walk a React node and emit HTML string pieces to `opts.emit`.
46
+ * Suspended boundaries are emitted as fallbacks with marker IDs; if `opts.onSuspend`
47
+ * is provided, the suspension is recorded for later streaming.
48
+ */
49
+ export declare function walk(node: ReactNode, opts: WalkOptions): void;
50
+ /**
51
+ * Boundary markers: `$` completed, `$E`/`$!` client-rendered, `$?` pending.
52
+ * A pending template is allowed in table insertion modes and does not break
53
+ * out of SVG/MathML. The visible fallback is a sibling, not an HTML div wrapper.
54
+ * Bare rows/columns create implicit containers. Close them on both sides so
55
+ * neither preceding rows nor the fallback can move a marker inside one.
56
+ * These end tags are ignored when no such container is open.
57
+ */
58
+ export declare function boundaryEdges(id: number, marker: string, context: InsertionContext | undefined, prefix: string): [string, string];