@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,21 @@
1
+ // Lazy owns a record so it can also read frozen promises. use() adopts the
2
+ // status fields shared with React and Flight on the thenable itself.
3
+ export function readThenable<T>(thenable: PromiseLike<T>, state: any = thenable): T {
4
+ if (state.status === undefined) {
5
+ state.status = 'pending'
6
+ thenable.then(value => {
7
+ if (state.status === 'pending') {
8
+ state.status = 'fulfilled'
9
+ state.value = value
10
+ }
11
+ }, reason => {
12
+ if (state.status === 'pending') {
13
+ state.status = 'rejected'
14
+ state.reason = reason
15
+ }
16
+ })
17
+ }
18
+ if (state.status === 'fulfilled') return state.value
19
+ if (state.status === 'rejected') throw state.reason
20
+ throw thenable
21
+ }
@@ -0,0 +1,41 @@
1
+ import type { ReactNode } from '../core'
2
+ import { ReactSharedInternals } from './shared-internals'
3
+
4
+ export const REACT_VIEW_TRANSITION_TYPE = Symbol.for('react.view_transition')
5
+
6
+ export type ViewTransitionClass = string | Record<string, string>
7
+ export interface ViewTransitionPseudoElement {
8
+ animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation
9
+ getAnimations(): Animation[]
10
+ getComputedStyle(): CSSStyleDeclaration
11
+ }
12
+
13
+ export interface ViewTransitionInstance {
14
+ name: string
15
+ group: ViewTransitionPseudoElement
16
+ imagePair: ViewTransitionPseudoElement
17
+ old: ViewTransitionPseudoElement
18
+ new: ViewTransitionPseudoElement
19
+ }
20
+
21
+ type ViewTransitionEvent = (instance: ViewTransitionInstance, types: string[]) => void | (() => void)
22
+ export interface ViewTransitionProps {
23
+ children?: ReactNode
24
+ name?: string | Record<string, string> | undefined
25
+ default?: ViewTransitionClass | undefined
26
+ enter?: ViewTransitionClass | undefined
27
+ exit?: ViewTransitionClass | undefined
28
+ update?: ViewTransitionClass | undefined
29
+ share?: ViewTransitionClass | undefined
30
+ onEnter?: ViewTransitionEvent | undefined
31
+ onExit?: ViewTransitionEvent | undefined
32
+ onUpdate?: ViewTransitionEvent | undefined
33
+ onShare?: ViewTransitionEvent | undefined
34
+ }
35
+
36
+ // Animation support belongs to the optional DOM feature, not this public entry.
37
+ export const ViewTransition = REACT_VIEW_TRANSITION_TYPE as unknown as (props: ViewTransitionProps) => any
38
+
39
+ export function addTransitionType(type: string): void {
40
+ ReactSharedInternals.T?.add(type)
41
+ }
@@ -0,0 +1,124 @@
1
+ // Minimal `scheduler` package surface — enough for React-ecosystem libraries
2
+ // (react-three/fiber, react-query's older scheduler calls, some devtools) to
3
+ // resolve the import without crashing. We don't implement priority lanes or
4
+ // interruptible work; everything runs on microtask or the next task.
5
+
6
+ const PRIORITY_IMMEDIATE = 1
7
+ const PRIORITY_USER_BLOCKING = 2
8
+ const PRIORITY_NORMAL = 3
9
+ const PRIORITY_LOW = 4
10
+ const PRIORITY_IDLE = 5
11
+
12
+ type Callback = () => unknown
13
+
14
+ interface Task {
15
+ id: number
16
+ callback: Callback | null
17
+ priority: number
18
+ cancelled: boolean
19
+ }
20
+
21
+ let nextId = 0
22
+
23
+ export function unstable_scheduleCallback(priority: number, cb: Callback): Task {
24
+ const task: Task = {
25
+ id: ++nextId,
26
+ callback: cb,
27
+ priority,
28
+ cancelled: false,
29
+ }
30
+ const run = () => {
31
+ if (task.cancelled || !task.callback) return
32
+ const fn = task.callback
33
+ task.callback = null
34
+ try {
35
+ fn()
36
+ } catch (e) {
37
+ // Re-throw on next task so the host sees it
38
+ setTimeout(() => {
39
+ throw e
40
+ }, 0)
41
+ }
42
+ }
43
+ // Immediate → microtask so ordering is predictable; everything else → next task.
44
+ if (priority <= PRIORITY_IMMEDIATE) {
45
+ queueMicrotask(run)
46
+ } else {
47
+ setTimeout(run, 0)
48
+ }
49
+ return task
50
+ }
51
+
52
+ export function unstable_cancelCallback(task: Task): void {
53
+ task.cancelled = true
54
+ task.callback = null
55
+ }
56
+
57
+ export function unstable_shouldYield(): boolean {
58
+ // We never yield — work runs to completion on whichever task schedules it.
59
+ return false
60
+ }
61
+
62
+ export function unstable_requestPaint(): void {
63
+ // no-op
64
+ }
65
+
66
+ export function unstable_now(): number {
67
+ return typeof performance !== 'undefined' ? performance.now() : Date.now()
68
+ }
69
+
70
+ export function unstable_getCurrentPriorityLevel(): number {
71
+ return PRIORITY_NORMAL
72
+ }
73
+
74
+ export function unstable_runWithPriority<T>(_priority: number, fn: () => T): T {
75
+ return fn()
76
+ }
77
+
78
+ export function unstable_next<T>(fn: () => T): T {
79
+ return fn()
80
+ }
81
+
82
+ export function unstable_wrapCallback<T extends (...args: any[]) => any>(fn: T): T {
83
+ return fn
84
+ }
85
+
86
+ export function unstable_continueExecution(): void {
87
+ // no-op
88
+ }
89
+
90
+ export function unstable_pauseExecution(): void {
91
+ // no-op
92
+ }
93
+
94
+ export function unstable_getFirstCallbackNode(): Task | null {
95
+ return null
96
+ }
97
+
98
+ export const unstable_IdlePriority = PRIORITY_IDLE
99
+ export const unstable_ImmediatePriority = PRIORITY_IMMEDIATE
100
+ export const unstable_LowPriority = PRIORITY_LOW
101
+ export const unstable_NormalPriority = PRIORITY_NORMAL
102
+ export const unstable_UserBlockingPriority = PRIORITY_USER_BLOCKING
103
+
104
+ // Some libraries (e.g. @react-three/fiber) import `scheduler` with a default
105
+ // binding expecting the namespace object. Provide one.
106
+ export default {
107
+ unstable_scheduleCallback,
108
+ unstable_cancelCallback,
109
+ unstable_shouldYield,
110
+ unstable_requestPaint,
111
+ unstable_now,
112
+ unstable_getCurrentPriorityLevel,
113
+ unstable_runWithPriority,
114
+ unstable_next,
115
+ unstable_wrapCallback,
116
+ unstable_continueExecution,
117
+ unstable_pauseExecution,
118
+ unstable_getFirstCallbackNode,
119
+ unstable_IdlePriority,
120
+ unstable_ImmediatePriority,
121
+ unstable_LowPriority,
122
+ unstable_NormalPriority,
123
+ unstable_UserBlockingPriority,
124
+ }
@@ -0,0 +1,92 @@
1
+ import { boundaryId, segmentId, scriptId } from './stream-ids'
2
+ /**
3
+ * Inline client runtime injected into the streamed HTML. Two jobs:
4
+ *
5
+ * 1. Reveal suspense boundaries as their resolved chunks arrive ($RC).
6
+ * 2. Capture interaction events from the moment the shell is visible so the
7
+ * main bundle can replay them against un-hydrated subtrees ($RE_q buffer).
8
+ *
9
+ * Wire format:
10
+ * Fallback: <!--$?ID--><template id="PREFIXB:HEX"></template>fallback<!--/$-->
11
+ * Resolved: a context-specific hidden segment followed by $RC(boundaryID, segmentID).
12
+ * Reveal removes the entire fallback range, moves the segment's
13
+ * children inline, and rewrites the opening comment to <!--$ID-->.
14
+ *
15
+ * Client hydration calls $RH(boundaryID, cb) to register a callback invoked once the
16
+ * boundary has been revealed (or immediately, if it was already revealed).
17
+ *
18
+ * Early-event buffering: before the main bundle is parsed, we attach capture
19
+ * listeners for a small set of interactive events and push them into a buffer.
20
+ * The bundle drains and replays them via the replay code in @tanstack/redact/dom.
21
+ */
22
+ import { escapeAttr } from './escape'
23
+
24
+ export const BOUNDARY_REVEAL_RUNTIME =
25
+ `(function(){` +
26
+ // All independently prefixed streams in a document share one reveal registry.
27
+ `if(!window.$RH){` +
28
+ `var c={},r=new Map;` +
29
+ `function place(n,v){` +
30
+ `var a=document.head.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),t=a.length?a[a.length-1]:null,p=t;` +
31
+ `for(var k=0;k<a.length;k++){if(a[k].getAttribute("data-precedence")===v)p=a[k];else if(p!==t)break}` +
32
+ `document.head.insertBefore(n,p?p.nextSibling:document.head.firstChild);` +
33
+ `}` +
34
+ `function drop(s){var w=/^(TBODY|TR|COLGROUP|mtext)$/.test(s.nodeName)?s.closest("table,math"):s;w.remove()}` +
35
+ `function load(n,e){return new Promise(function(y,x){n.onload=function(){e.p=null;y()};n.onerror=function(){e.p=null;x()}})}` +
36
+ `window.$RH=function(i,f){` +
37
+ `if(!document.getElementById(i))f();` +
38
+ `else{c[i]=f;return function(){if(c[i]===f)delete c[i]}}` +
39
+ `};` +
40
+ `window.$RC=function(i,j){` +
41
+ `var s=document.getElementById(j),b=document.getElementById(i);` +
42
+ `if(!b){delete c[i];if(s)drop(s);return}if(!s)return;` +
43
+ `var a=document.querySelectorAll('body link[rel="stylesheet"][data-precedence],body style[data-precedence]');` +
44
+ `for(var j=0;j<a.length;j++){` +
45
+ `var n=a[j];if(n.getAttribute("media")==="not all")n.removeAttribute("media");place(n,n.getAttribute("data-precedence"));` +
46
+ `}` +
47
+ `var p=b.parentNode,m=b.previousSibling;` +
48
+ `var n=b.nextSibling,d=0;while(n){var t=n.nextSibling;if(n.nodeType===8){if(n.data==="/$"){if(d===0)break;d--}else if(/^\\$(?:[?!E~])?\\d*$/.test(n.data))d++}p.removeChild(n);n=t}` +
49
+ `while(s.firstChild)p.insertBefore(s.firstChild,b);` +
50
+ `drop(s);` +
51
+ `p.removeChild(b);` +
52
+ `if(m&&m.nodeType===8)m.data=m.data.replace("$?","$");` +
53
+ `if(c[i]){var f=c[i];delete c[i];f()}` +
54
+ `};` +
55
+ `window.$RR=function(i,s,d){` +
56
+ `var w=[];for(var j=0;j<d.length;j++){` +
57
+ `var a=d[j],e=r.get(a[0]);if(!e){` +
58
+ `var n=null,l=document.querySelectorAll('link[rel="stylesheet"]');for(var k=0;k<l.length;k++)if(l[k].getAttribute("href")===a[0]){n=l[k];break}` +
59
+ `e={n:n,p:null};r.set(a[0],e);if(!n){` +
60
+ `n=e.n=document.createElement("link");n.rel="stylesheet";n.href=a[0];n.setAttribute("data-precedence",a[1]);` +
61
+ `for(var k=2;k<a.length;k+=2)n.setAttribute(a[k],a[k+1]);` +
62
+ `e.p=load(n,e);place(n,a[1]);` +
63
+ `}` +
64
+ `}` +
65
+ `var m=e.n.getAttribute("media");if(e.p&&(!m||matchMedia(m).matches))w.push(e.p);` +
66
+ `}` +
67
+ `Promise.all(w).then(function(){$RC(i,s)},function(){$RB(i,1,s)});` +
68
+ `};` +
69
+ `window.$RB=function(i,e,j){` +
70
+ `var s=j&&document.getElementById(j);if(s)drop(s);` +
71
+ `var b=document.getElementById(i);if(!b){delete c[i];return}` +
72
+ `var m=b.previousSibling;if(m&&m.nodeType===8)m.data=(e?"$E":"$!")+m.data.replace(/^\\$[?~!E]?/,"");` +
73
+ `b.removeAttribute("id");if(c[i]){var f=c[i];delete c[i];f()}` +
74
+ `};` +
75
+ `}` +
76
+ `var q=[];window.$RE_q=q;` +
77
+ `var evs=["click","submit","input","change","keydown"];` +
78
+ `function h(e){q.push([e.type,e.target,e.timeStamp])}` +
79
+ `for(var j=0;j<evs.length;j++)document.addEventListener(evs[j],h,true);` +
80
+ `window.$RE_stop=function(){for(var j=0;j<evs.length;j++)document.removeEventListener(evs[j],h,true)};` +
81
+ `})();`
82
+
83
+ export function injectBootstrapScript(nonce?: string): string {
84
+ const n = nonce ? ` nonce="${escapeAttr(nonce)}"` : ''
85
+ return `<script${n}>${BOUNDARY_REVEAL_RUNTIME}</script>`
86
+ }
87
+
88
+ export function revealScript(id: number, nonce?: string, styles?: string[][], identifierPrefix = ''): string {
89
+ const n = nonce ? ` nonce="${escapeAttr(nonce)}"` : ''
90
+ const b = scriptId(boundaryId(id, identifierPrefix)), s = scriptId(segmentId(id, identifierPrefix))
91
+ return `<script${n}>${styles?.length ? `$RR(${b},${s},${JSON.stringify(styles).replace(/</g, '\\u003c')})` : `$RC(${b},${s})`}</script>`
92
+ }
@@ -0,0 +1,168 @@
1
+ import { leadingBit } from '../dom/react-ids'
2
+ import { isFunction } from '../core/functions'
3
+ import { readThenable } from '../react/thenable'
4
+ import { idleFormStatus } from '../react/form-state'
5
+ import { ReactSharedInternals, REACT_CONTEXT_TYPE } from '../react'
6
+ import { isBrowserToken, browserError } from '../core/browser'
7
+ import { resourceHintDispatcher } from '../core/resource-hints'
8
+ import { createResourceHints, type ResourceScope } from './resource-hints'
9
+
10
+ export interface SSRFrame {
11
+ treeId: bigint
12
+ localId: number
13
+ identifierPrefix: string
14
+ contextStack: Array<{ context: any; prev: any }>
15
+ resources?: ReturnType<typeof createResourceHints>
16
+ shellFlushed?: boolean
17
+ styleNonce?: string | undefined
18
+ }
19
+
20
+ let frame: SSRFrame | null = null
21
+
22
+ resourceHintDispatcher.emit = (kind, href, options) => {
23
+ if (!frame) return false
24
+ ;(frame.resources ||= createResourceHints(!!frame.shellFlushed, frame.styleNonce)).add(kind, href, options)
25
+ return true
26
+ }
27
+
28
+ export function beginSSR(identifierPrefix = '', nextFrame?: SSRFrame) {
29
+ const previous = { frame, dispatcher: ReactSharedInternals.H }
30
+ frame = nextFrame ?? { treeId: 1n, localId: 0, identifierPrefix, contextStack: [] }
31
+ ReactSharedInternals.H = ssrDispatcher as any
32
+ return previous
33
+ }
34
+
35
+ export function currentSSRFrame(): SSRFrame {
36
+ return frame!
37
+ }
38
+
39
+ export function recordHostResource(type: string, props: any, scope?: ResourceScope): boolean {
40
+ return !!frame && (frame.resources ||= createResourceHints(!!frame.shellFlushed, frame.styleNonce)).addHost(type, props, scope)
41
+ }
42
+
43
+ export function endSSR(previous?: ReturnType<typeof beginSSR>): void {
44
+ // Restore any remaining pushed contexts (defensive)
45
+ if (frame) {
46
+ for (let i = frame.contextStack.length - 1; i >= 0; i--) {
47
+ const { context, prev } = frame.contextStack[i]!
48
+ context._currentValue = prev
49
+ }
50
+ }
51
+ // Only synchronous renders restore their caller. A stream can finish
52
+ // after its caller has returned, so it must not reinstall that dispatcher.
53
+ ReactSharedInternals.H = previous?.dispatcher ?? null
54
+ frame = previous?.frame ?? null
55
+ }
56
+
57
+ export function pushContext(context: any, value: any): void {
58
+ if (!frame) throw new Error(process.env.NODE_ENV !== 'production' ? 'pushContext called outside SSR' : '')
59
+ frame.contextStack.push({ context, prev: context._currentValue })
60
+ context._currentValue = value
61
+ }
62
+
63
+ export function popContext(context: any): void {
64
+ if (!frame) return
65
+ const top = frame.contextStack.pop()
66
+ if (top && top.context === context) context._currentValue = top.prev
67
+ }
68
+
69
+ export type ContextSnapshot = Array<{ context: any; value: any }>
70
+
71
+ export function snapshotContexts(): ContextSnapshot {
72
+ if (!frame) return []
73
+ const out: ContextSnapshot = []
74
+ for (const entry of frame.contextStack) {
75
+ out.push({ context: entry.context, value: entry.context._currentValue })
76
+ }
77
+ return out
78
+ }
79
+
80
+ /**
81
+ * Push snapshot values and return a function that pops them.
82
+ * Called when we re-render a suspended boundary so it sees the same provider
83
+ * values that were active at suspension time.
84
+ */
85
+ export function applyContextSnapshot(snapshot: ContextSnapshot): () => void {
86
+ for (const { context, value } of snapshot) pushContext(context, value)
87
+ return () => {
88
+ for (let i = snapshot.length - 1; i >= 0; i--) popContext(snapshot[i]!.context)
89
+ }
90
+ }
91
+
92
+ export const ssrDispatcher = {
93
+ useCacheRefresh() {
94
+ return () => { throw new Error('Refreshing the cache is not supported during server rendering.') }
95
+ },
96
+ useState<S>(initial: S | (() => S)) {
97
+ const v = isFunction(initial) ? (initial as () => S)() : initial
98
+ return [v, (() => {}) as any] as [S, any]
99
+ },
100
+ useReducer<S, A>(_reducer: (s: S, a: A) => S, initialArg: any, init?: (a: any) => S) {
101
+ const v = init ? init(initialArg) : initialArg
102
+ return [v, (() => {}) as any]
103
+ },
104
+ useEffect() {
105
+ // noop on server
106
+ },
107
+ useLayoutEffect() {
108
+ // noop on server
109
+ },
110
+ useInsertionEffect() {
111
+ // noop on server
112
+ },
113
+ useRef<T>(initial: T) {
114
+ return { current: initial }
115
+ },
116
+ useMemo<T>(factory: () => T) {
117
+ return factory()
118
+ },
119
+ useCallback<T extends Function>(fn: T) {
120
+ return fn
121
+ },
122
+ useContext<T>(ctx: any): T {
123
+ return ctx._currentValue
124
+ },
125
+ useImperativeHandle() {
126
+ // noop on server
127
+ },
128
+ useDebugValue() {
129
+ // noop
130
+ },
131
+ useId(): string {
132
+ if (!frame) return ':r0:'
133
+ const local = frame.localId++
134
+ const tree = frame.treeId
135
+ return '_' + frame.identifierPrefix + 'R_' + (tree ^ leadingBit(tree)).toString(32) + (local ? 'H' + local.toString(32) : '') + '_'
136
+ },
137
+ useTransition(): [boolean, (fn: () => void) => void] {
138
+ return [false, (fn) => fn()]
139
+ },
140
+ useActionState<S, P>(_action: (state: Awaited<S>, payload: P) => S | Promise<S>, initial: Awaited<S>): [Awaited<S>, (payload: P) => void, boolean] {
141
+ return [initial, () => {}, false]
142
+ },
143
+ useOptimistic<S, A>(state: S): [S, (action: A) => void] {
144
+ return [state, () => {}]
145
+ },
146
+ useFormStatus() { return idleFormStatus },
147
+ useDeferredValue<T>(v: T): T {
148
+ return v
149
+ },
150
+ useSyncExternalStore<T>(
151
+ _subscribe: (cb: () => void) => () => void,
152
+ getSnapshot: () => T,
153
+ getServerSnapshot?: () => T,
154
+ ): T {
155
+ return getServerSnapshot ? getServerSnapshot() : getSnapshot()
156
+ },
157
+ use<T>(resource: any): T {
158
+ if (resource == null) throw new Error('use() received null or undefined')
159
+ if (isBrowserToken(resource)) throw browserError(resource)
160
+ if (resource.$$typeof === REACT_CONTEXT_TYPE) {
161
+ return resource._currentValue
162
+ }
163
+ if (isFunction(resource.then)) {
164
+ return readThenable(resource) as T
165
+ }
166
+ throw new Error('use() expected a Promise or Context')
167
+ },
168
+ }
@@ -0,0 +1,102 @@
1
+ import { UNITLESS_STYLE } from '../core/unitless-style'
2
+ import { isFunction } from '../core/functions'
3
+ import { attributeName, STRING_BOOLEAN_ATTRS, BOOLEAN_ATTRS } from '../core/attributes'
4
+
5
+ function escape(value: string, pattern: RegExp): string {
6
+ return value.replace(pattern, char => char === '&' ? '&amp;' : char === '<' ? '&lt;' : char === '>' ? '&gt;' : '&quot;')
7
+ }
8
+
9
+ export function escapeAttr(value: string): string {
10
+ return /[&"<>]/.test(value) ? escape(value, /[&"<>]/g) : value
11
+ }
12
+
13
+ export function escapeText(value: string): string {
14
+ return /[&<>]/.test(value) ? escape(value, /[&<>]/g) : value
15
+ }
16
+
17
+ // Raw-text element body escaping: prevent any closing tag for the raw-text
18
+ // elements (<script>, <style>) from terminating the element early, plus
19
+ // `<!--` (which would start an HTML comment that survives even inside
20
+ // raw-text bodies and can be exploited to alter following script content).
21
+ // React's serializer follows the same approach.
22
+ export function escapeScript(value: string): string {
23
+ return value
24
+ .replace(/<\/(script|style)/gi, '<\\/$1')
25
+ .replace(/<!--/g, '<\\!--')
26
+ }
27
+
28
+ export const VOID_ELEMENTS = new Set([
29
+ 'area',
30
+ 'base',
31
+ 'br',
32
+ 'col',
33
+ 'embed',
34
+ 'hr',
35
+ 'img',
36
+ 'input',
37
+ 'link',
38
+ 'meta',
39
+ 'param',
40
+ 'source',
41
+ 'track',
42
+ 'wbr',
43
+ ])
44
+
45
+ export const RAW_TEXT_ELEMENTS = new Set(['script', 'style'])
46
+
47
+ export function attrToHtml(name: string, value: unknown, isSvg = false): string {
48
+ if (
49
+ name === 'children' ||
50
+ name === 'key' ||
51
+ name === 'ref' ||
52
+ name === 'dangerouslySetInnerHTML' ||
53
+ name === 'defaultValue' ||
54
+ name === 'defaultChecked' ||
55
+ name === 'suppressHydrationWarning' ||
56
+ name === 'suppressContentEditableWarning'
57
+ ) {
58
+ return ''
59
+ }
60
+ if (name[0] === 'o' && name[1] === 'n' && isFunction(value)) return ''
61
+ if (value == null) return ''
62
+
63
+ const htmlName = attributeName(name, isSvg)
64
+
65
+ // These attributes need explicit "false", not boolean-attribute absence.
66
+ if (
67
+ STRING_BOOLEAN_ATTRS.test(htmlName) ||
68
+ name.startsWith('aria-') ||
69
+ name.startsWith('data-')
70
+ ) {
71
+ return ` ${htmlName}="${escapeAttr(String(value))}"`
72
+ }
73
+
74
+ if (value === false) return ''
75
+
76
+ if (value === true || BOOLEAN_ATTRS.test(htmlName)) {
77
+ return value ? ` ${htmlName}=""` : ''
78
+ }
79
+
80
+ if (name === 'style' && typeof value === 'object' && value !== null) {
81
+ return ` style="${escapeAttr(styleToString(value as Record<string, unknown>))}"`
82
+ }
83
+
84
+ return ` ${htmlName}="${escapeAttr(String(value))}"`
85
+ }
86
+
87
+
88
+
89
+ function styleToString(style: Record<string, unknown>): string {
90
+ let out = ''
91
+ for (const key in style) {
92
+ const v = style[key]
93
+ if (v == null || v === false) continue
94
+ const kebab = key.startsWith('--')
95
+ ? key
96
+ : key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase()).replace(/^ms-/, '-ms-')
97
+ const value =
98
+ typeof v === 'number' && !UNITLESS_STYLE.test(key) && v !== 0 ? v + 'px' : v
99
+ out += `${kebab}:${value};`
100
+ }
101
+ return out
102
+ }
@@ -0,0 +1,26 @@
1
+ export { renderToString, renderToStaticMarkup } from './renderToString'
2
+ export { renderToReadableStream, renderToPipeableStream } from './stream'
3
+ export type {
4
+ StreamOptions,
5
+ PipeableOptions,
6
+ PipeableHandle,
7
+ ReadableStreamResult,
8
+ } from './stream'
9
+ export { BOUNDARY_REVEAL_RUNTIME } from './bootstrap-script'
10
+
11
+ export const version = '19.2.3'
12
+
13
+ // Default export — React's real `react-dom/server` ships one, and TanStack
14
+ // Router's SSR code does `import ReactDOMServer from 'react-dom/server'` and
15
+ // reads `.renderToReadableStream` off the default.
16
+ import { renderToString, renderToStaticMarkup } from './renderToString'
17
+ import { renderToReadableStream, renderToPipeableStream } from './stream'
18
+ import { BOUNDARY_REVEAL_RUNTIME } from './bootstrap-script'
19
+ export default {
20
+ renderToString,
21
+ renderToStaticMarkup,
22
+ renderToReadableStream,
23
+ renderToPipeableStream,
24
+ BOUNDARY_REVEAL_RUNTIME,
25
+ version: '19.2.3',
26
+ }
@@ -0,0 +1,28 @@
1
+ import { escapeAttr } from './escape'
2
+
3
+ // The context belongs to the *parent* of a suspended subtree. It must survive
4
+ // retries: looking at the first resolved child cannot recover HTML insertion mode.
5
+ export type InsertionContext = 'html' | 'svg' | 'math' | 'mtext' | 'table' | 'tbody' | 'tr' | 'colgroup'
6
+
7
+ export function childInsertionContext(tag: string, props: Record<string, any>, parent: InsertionContext): InsertionContext {
8
+ if (tag === 'svg') return 'svg'
9
+ if (tag === 'math') return 'math'
10
+ if ((parent === 'svg' && (tag === 'foreignObject' || tag === 'desc' || tag === 'title')) || (tag === 'annotation-xml' && /^(text\/html|application\/xhtml\+xml)$/i.test(props.encoding ?? ''))) return 'html'
11
+ // WHATWG tree-construction dispatcher: MathML text integration points use
12
+ // HTML rules except for mglyph/malignmark. Keep that mixed context on retries.
13
+ if (parent === 'math' && /^(mi|mo|mn|ms|mtext)$/.test(tag)) return 'mtext'
14
+ if (parent === 'mtext' && (tag === 'mglyph' || tag === 'malignmark')) return 'math'
15
+ if (parent === 'svg' || parent === 'math') return parent
16
+ if (tag === 'table' || tag === 'tr' || tag === 'colgroup') return tag
17
+ if (tag === 'tbody' || tag === 'thead' || tag === 'tfoot') return 'tbody'
18
+ return 'html'
19
+ }
20
+
21
+ export function segmentHtml(content: string, id: string, context: InsertionContext): string {
22
+ const mathText = context === 'mtext'
23
+ const nested = mathText || context === 'tbody' || context === 'tr' || context === 'colgroup'
24
+ const tag = context === 'html' ? 'div' : context
25
+ const hidden = nested ? '' : context === 'svg' || context === 'math' ? ' aria-hidden="true" style="display:none"' : ' hidden'
26
+ const wrapper = mathText ? '<math style="display:none">' : '<table hidden>'
27
+ return `${nested ? wrapper : ''}<${tag}${hidden} id="${escapeAttr(id)}">${content}</${tag}>${nested ? mathText ? '</math>' : '</table>' : ''}`
28
+ }
@@ -0,0 +1,35 @@
1
+ import type { ReactNode } from '../core'
2
+ import { beginSSR, currentSSRFrame, endSSR } from './dispatcher'
3
+ import { walk } from './walk'
4
+
5
+ export function renderToString(
6
+ children: ReactNode,
7
+ options: { identifierPrefix?: string } = {},
8
+ ): string {
9
+ const previous = beginSSR(options.identifierPrefix)
10
+ let output = ''
11
+ let id = 0
12
+ let head = 0
13
+ try {
14
+ walk(children, {
15
+ emit: (s) => {
16
+ output += s
17
+ },
18
+ nextBoundaryId: () => id++,
19
+ onHead: () => { head = output.length },
20
+ })
21
+ const hints = currentSSRFrame().resources?.drain()
22
+ if (hints) output = output.slice(0, head) + hints + output.slice(head)
23
+ } finally {
24
+ endSSR(previous)
25
+ }
26
+ return output
27
+ }
28
+
29
+ export function renderToStaticMarkup(
30
+ children: ReactNode,
31
+ options: { identifierPrefix?: string } = {},
32
+ ): string {
33
+ // For our purposes identical to renderToString (no hydration markers in static output)
34
+ return renderToString(children, options).replace(/<!--[^>]*-->/g, '')
35
+ }