one 1.2.47 → 1.2.49

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 (818) hide show
  1. package/dist/cjs/Root.js +6 -1
  2. package/dist/cjs/Root.js.map +1 -1
  3. package/dist/cjs/Root.native.js.map +1 -1
  4. package/dist/cjs/babel-plugins/one-router-metro.js +4 -1
  5. package/dist/cjs/babel-plugins/one-router-metro.js.map +1 -1
  6. package/dist/cjs/babel-plugins/one-router-metro.native.js.map +1 -1
  7. package/dist/cjs/babel-plugins/remove-server-code.js +3 -1
  8. package/dist/cjs/babel-plugins/remove-server-code.js.map +1 -1
  9. package/dist/cjs/babel-plugins/remove-server-code.native.js.map +1 -1
  10. package/dist/cjs/cli/build.js +31 -8
  11. package/dist/cjs/cli/build.js.map +1 -1
  12. package/dist/cjs/cli/build.native.js.map +1 -1
  13. package/dist/cjs/cli/buildPage.js +14 -4
  14. package/dist/cjs/cli/buildPage.js.map +1 -1
  15. package/dist/cjs/cli/buildPage.native.js.map +1 -1
  16. package/dist/cjs/cli/generateRoutes.js +3 -1
  17. package/dist/cjs/cli/generateRoutes.js.map +1 -1
  18. package/dist/cjs/cli/generateRoutes.native.js.map +1 -1
  19. package/dist/cjs/cli/generateSitemap.js.map +1 -1
  20. package/dist/cjs/cli/generateSitemap.native.js.map +1 -1
  21. package/dist/cjs/cli/generateSitemap.test.js +14 -4
  22. package/dist/cjs/cli/generateSitemap.test.js.map +1 -1
  23. package/dist/cjs/cli/generateSitemap.test.native.js.map +1 -1
  24. package/dist/cjs/cli/main.js +4 -2
  25. package/dist/cjs/cli/main.js.map +1 -1
  26. package/dist/cjs/cli/main.native.js.map +1 -1
  27. package/dist/cjs/cli/prebuild.js.map +1 -1
  28. package/dist/cjs/cli/prebuild.native.js.map +1 -1
  29. package/dist/cjs/clientLoaderResolver.js.map +1 -1
  30. package/dist/cjs/clientLoaderResolver.native.js.map +1 -1
  31. package/dist/cjs/config.js +3 -1
  32. package/dist/cjs/config.js.map +1 -1
  33. package/dist/cjs/config.native.js.map +1 -1
  34. package/dist/cjs/constants.js.map +1 -1
  35. package/dist/cjs/constants.native.js.map +1 -1
  36. package/dist/cjs/createApp.js +9 -1
  37. package/dist/cjs/createApp.js.map +1 -1
  38. package/dist/cjs/createHandleRequest.js +9 -3
  39. package/dist/cjs/createHandleRequest.js.map +1 -1
  40. package/dist/cjs/createHandleRequest.native.js.map +1 -1
  41. package/dist/cjs/fork/__tests__/getPathFromState.test.js +90 -88
  42. package/dist/cjs/fork/__tests__/getPathFromState.test.js.map +1 -1
  43. package/dist/cjs/fork/__tests__/getPathFromState.test.native.js.map +1 -1
  44. package/dist/cjs/fork/__tests__/getStateFromPath.test.js +163 -86
  45. package/dist/cjs/fork/__tests__/getStateFromPath.test.js.map +1 -1
  46. package/dist/cjs/fork/__tests__/getStateFromPath.test.native.js.map +1 -1
  47. package/dist/cjs/fork/_shared.js.map +1 -1
  48. package/dist/cjs/fork/_shared.native.js.map +1 -1
  49. package/dist/cjs/fork/extractPathFromURL.js.map +1 -1
  50. package/dist/cjs/fork/extractPathFromURL.native.js.map +1 -1
  51. package/dist/cjs/fork/getPathFromState-mods.js +4 -1
  52. package/dist/cjs/fork/getPathFromState-mods.js.map +1 -1
  53. package/dist/cjs/fork/getPathFromState-mods.native.js.map +1 -1
  54. package/dist/cjs/fork/getPathFromState.js +3 -1
  55. package/dist/cjs/fork/getPathFromState.js.map +1 -1
  56. package/dist/cjs/fork/getPathFromState.native.js.map +1 -1
  57. package/dist/cjs/fork/getStateFromPath-mods.js.map +1 -1
  58. package/dist/cjs/fork/getStateFromPath-mods.native.js.map +1 -1
  59. package/dist/cjs/fork/getStateFromPath.js +7 -1
  60. package/dist/cjs/fork/getStateFromPath.js.map +1 -1
  61. package/dist/cjs/fork/getStateFromPath.native.js.map +1 -1
  62. package/dist/cjs/fork/getStateFromPath.test.js +21 -8
  63. package/dist/cjs/fork/getStateFromPath.test.js.map +1 -1
  64. package/dist/cjs/fork/getStateFromPath.test.native.js.map +1 -1
  65. package/dist/cjs/fork/useBackButton.js.map +1 -1
  66. package/dist/cjs/fork/useDocumentTitle.js +4 -1
  67. package/dist/cjs/fork/useDocumentTitle.js.map +1 -1
  68. package/dist/cjs/fork/useLinking.js +4 -1
  69. package/dist/cjs/fork/useLinking.js.map +1 -1
  70. package/dist/cjs/fork/validatePathConfig.js.map +1 -1
  71. package/dist/cjs/fork/validatePathConfig.native.js.map +1 -1
  72. package/dist/cjs/hooks.js.map +1 -1
  73. package/dist/cjs/hooks.native.js.map +1 -1
  74. package/dist/cjs/index.js.map +1 -1
  75. package/dist/cjs/layouts/Tabs.js.map +1 -1
  76. package/dist/cjs/layouts/Tabs.native.js.map +1 -1
  77. package/dist/cjs/layouts/withLayoutContext.js +10 -8
  78. package/dist/cjs/layouts/withLayoutContext.js.map +1 -1
  79. package/dist/cjs/layouts/withLayoutContext.native.js.map +1 -1
  80. package/dist/cjs/link/Link.js.map +1 -1
  81. package/dist/cjs/link/Link.native.js.map +1 -1
  82. package/dist/cjs/link/linking.js +3 -1
  83. package/dist/cjs/link/linking.js.map +1 -1
  84. package/dist/cjs/link/linking.native.js.map +1 -1
  85. package/dist/cjs/link/useLinkTo.js.map +1 -1
  86. package/dist/cjs/link/useLinkTo.native.js.map +1 -1
  87. package/dist/cjs/link/useLoadedNavigation.js.map +1 -1
  88. package/dist/cjs/link/useLoadedNavigation.native.js.map +1 -1
  89. package/dist/cjs/metro-config/getViteMetroPluginOptions.cjs +6 -8
  90. package/dist/cjs/metro-config/getViteMetroPluginOptions.js +8 -10
  91. package/dist/cjs/metro-config/getViteMetroPluginOptions.js.map +1 -1
  92. package/dist/cjs/metro-config/getViteMetroPluginOptions.native.js +9 -11
  93. package/dist/cjs/metro-config/getViteMetroPluginOptions.native.js.map +1 -1
  94. package/dist/cjs/router/Route.js.map +1 -1
  95. package/dist/cjs/router/Route.native.js.map +1 -1
  96. package/dist/cjs/router/RouteInfoContext.js +7 -1
  97. package/dist/cjs/router/RouteInfoContext.js.map +1 -1
  98. package/dist/cjs/router/RouteInfoContext.native.js.map +1 -1
  99. package/dist/cjs/router/filterRootHTML.js.map +1 -1
  100. package/dist/cjs/router/filterRootHTML.native.js.map +1 -1
  101. package/dist/cjs/router/getLinkingConfig.js.map +1 -1
  102. package/dist/cjs/router/getLinkingConfig.native.js.map +1 -1
  103. package/dist/cjs/router/getNormalizedStatePath.js.map +1 -1
  104. package/dist/cjs/router/getNormalizedStatePath.native.js.map +1 -1
  105. package/dist/cjs/router/getRoutes.js +3 -1
  106. package/dist/cjs/router/getRoutes.js.map +1 -1
  107. package/dist/cjs/router/getRoutes.native.js.map +1 -1
  108. package/dist/cjs/router/linkingConfig.js.map +1 -1
  109. package/dist/cjs/router/linkingConfig.native.js.map +1 -1
  110. package/dist/cjs/router/matchers.cjs +1 -1
  111. package/dist/cjs/router/matchers.js +1 -1
  112. package/dist/cjs/router/matchers.js.map +1 -1
  113. package/dist/cjs/router/matchers.native.js +1 -1
  114. package/dist/cjs/router/matchers.native.js.map +1 -1
  115. package/dist/cjs/router/matchers.test.js +6 -2
  116. package/dist/cjs/router/matchers.test.js.map +1 -1
  117. package/dist/cjs/router/matchers.test.native.js.map +1 -1
  118. package/dist/cjs/router/router.js +13 -3
  119. package/dist/cjs/router/router.js.map +1 -1
  120. package/dist/cjs/router/router.native.js.map +1 -1
  121. package/dist/cjs/router/useNavigation.js.map +1 -1
  122. package/dist/cjs/router/useNavigation.native.js.map +1 -1
  123. package/dist/cjs/router/useScreens.cjs +73 -51
  124. package/dist/cjs/router/useScreens.js +72 -45
  125. package/dist/cjs/router/useScreens.js.map +1 -1
  126. package/dist/cjs/router/useScreens.native.js +30 -19
  127. package/dist/cjs/router/useScreens.native.js.map +1 -1
  128. package/dist/cjs/router/useViteRoutes.cjs +26 -8
  129. package/dist/cjs/router/useViteRoutes.js +28 -9
  130. package/dist/cjs/router/useViteRoutes.js.map +1 -1
  131. package/dist/cjs/router/useViteRoutes.native.js +33 -13
  132. package/dist/cjs/router/useViteRoutes.native.js.map +1 -1
  133. package/dist/cjs/router/utils/getNavigateAction.js.map +1 -1
  134. package/dist/cjs/router/utils/getNavigateAction.native.js.map +1 -1
  135. package/dist/cjs/server/createRoutesManifest.js.map +1 -1
  136. package/dist/cjs/server/createRoutesManifest.native.js.map +1 -1
  137. package/dist/cjs/server/getServerManifest.js +3 -1
  138. package/dist/cjs/server/getServerManifest.js.map +1 -1
  139. package/dist/cjs/server/getServerManifest.native.js.map +1 -1
  140. package/dist/cjs/server/oneServe.js +9 -2
  141. package/dist/cjs/server/oneServe.js.map +1 -1
  142. package/dist/cjs/server/oneServe.native.js.map +1 -1
  143. package/dist/cjs/server/setupBuildOptions.js.map +1 -1
  144. package/dist/cjs/server/setupBuildOptions.native.js.map +1 -1
  145. package/dist/cjs/server/staticHtmlFetcher.js.map +1 -1
  146. package/dist/cjs/server/staticHtmlFetcher.native.js.map +1 -1
  147. package/dist/cjs/server-render.js.map +1 -1
  148. package/dist/cjs/server-render.native.js.map +1 -1
  149. package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.js +14 -2
  150. package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.js.map +1 -1
  151. package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.native.js.map +1 -1
  152. package/dist/cjs/typed-routes/injectRouteHelpers.js +4 -1
  153. package/dist/cjs/typed-routes/injectRouteHelpers.js.map +1 -1
  154. package/dist/cjs/typed-routes/injectRouteHelpers.native.js.map +1 -1
  155. package/dist/cjs/ui/Slot.js.map +1 -1
  156. package/dist/cjs/ui/Slot.native.js.map +1 -1
  157. package/dist/cjs/ui/TabContext.js +3 -1
  158. package/dist/cjs/ui/TabContext.js.map +1 -1
  159. package/dist/cjs/ui/TabContext.native.js.map +1 -1
  160. package/dist/cjs/ui/TabRouter.js.map +1 -1
  161. package/dist/cjs/ui/TabRouter.native.js.map +1 -1
  162. package/dist/cjs/ui/TabTrigger.js +17 -2
  163. package/dist/cjs/ui/TabTrigger.js.map +1 -1
  164. package/dist/cjs/ui/TabTrigger.native.js.map +1 -1
  165. package/dist/cjs/ui/Tabs.js +5 -1
  166. package/dist/cjs/ui/Tabs.js.map +1 -1
  167. package/dist/cjs/ui/Tabs.native.js.map +1 -1
  168. package/dist/cjs/ui/common.js +3 -1
  169. package/dist/cjs/ui/common.js.map +1 -1
  170. package/dist/cjs/ui/common.native.js.map +1 -1
  171. package/dist/cjs/useLoader.js +4 -1
  172. package/dist/cjs/useLoader.js.map +1 -1
  173. package/dist/cjs/useLoader.native.js.map +1 -1
  174. package/dist/cjs/utils/cleanUrl.js.map +1 -1
  175. package/dist/cjs/utils/cleanUrl.native.js.map +1 -1
  176. package/dist/cjs/utils/url.js +3 -1
  177. package/dist/cjs/utils/url.js.map +1 -1
  178. package/dist/cjs/utils/url.native.js.map +1 -1
  179. package/dist/cjs/vercel/build/buildVercelOutputDirectory.js +29 -10
  180. package/dist/cjs/vercel/build/buildVercelOutputDirectory.js.map +1 -1
  181. package/dist/cjs/vercel/build/buildVercelOutputDirectory.native.js.map +1 -1
  182. package/dist/cjs/vercel/build/generate/createApiServerlessFunction.js +11 -3
  183. package/dist/cjs/vercel/build/generate/createApiServerlessFunction.js.map +1 -1
  184. package/dist/cjs/vercel/build/generate/createApiServerlessFunction.native.js.map +1 -1
  185. package/dist/cjs/vercel/build/generate/createSsrServerlessFunction.js +9 -2
  186. package/dist/cjs/vercel/build/generate/createSsrServerlessFunction.js.map +1 -1
  187. package/dist/cjs/vercel/build/generate/createSsrServerlessFunction.native.js.map +1 -1
  188. package/dist/cjs/vercel/build/getPathFromRoute.js +4 -1
  189. package/dist/cjs/vercel/build/getPathFromRoute.js.map +1 -1
  190. package/dist/cjs/vercel/build/getPathFromRoute.native.js.map +1 -1
  191. package/dist/cjs/views/Navigator.js +16 -8
  192. package/dist/cjs/views/Navigator.js.map +1 -1
  193. package/dist/cjs/views/Navigator.native.js.map +1 -1
  194. package/dist/cjs/views/RootErrorBoundary.js +4 -2
  195. package/dist/cjs/views/RootErrorBoundary.js.map +1 -1
  196. package/dist/cjs/views/RootErrorBoundary.native.js.map +1 -1
  197. package/dist/cjs/views/Screen.js +4 -1
  198. package/dist/cjs/views/Screen.js.map +1 -1
  199. package/dist/cjs/views/Screen.native.js.map +1 -1
  200. package/dist/cjs/vite/DevHead.cjs +14 -0
  201. package/dist/cjs/vite/DevHead.js +18 -0
  202. package/dist/cjs/vite/DevHead.js.map +1 -1
  203. package/dist/cjs/vite/loadConfig.js +6 -2
  204. package/dist/cjs/vite/loadConfig.js.map +1 -1
  205. package/dist/cjs/vite/loadConfig.native.js.map +1 -1
  206. package/dist/cjs/vite/one-server-only.js +3 -1
  207. package/dist/cjs/vite/one-server-only.js.map +1 -1
  208. package/dist/cjs/vite/one.cjs +9 -2
  209. package/dist/cjs/vite/one.js +18 -5
  210. package/dist/cjs/vite/one.js.map +1 -1
  211. package/dist/cjs/vite/one.native.js +17 -12
  212. package/dist/cjs/vite/one.native.js.map +1 -1
  213. package/dist/cjs/vite/plugins/SSRCSSPlugin.js +5 -1
  214. package/dist/cjs/vite/plugins/SSRCSSPlugin.js.map +1 -1
  215. package/dist/cjs/vite/plugins/SSRCSSPlugin.native.js.map +1 -1
  216. package/dist/cjs/vite/plugins/clientTreeShakePlugin.js +8 -2
  217. package/dist/cjs/vite/plugins/clientTreeShakePlugin.js.map +1 -1
  218. package/dist/cjs/vite/plugins/clientTreeShakePlugin.native.js.map +1 -1
  219. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.cjs +1 -1
  220. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js +12 -5
  221. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
  222. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js +4 -1
  223. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
  224. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.cjs +1 -1
  225. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js +1 -1
  226. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
  227. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +6 -3
  228. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
  229. package/dist/cjs/vite/plugins/removeReactNativeWebAnimatedPlugin.js.map +1 -1
  230. package/dist/cjs/vite/plugins/removeReactNativeWebAnimatedPlugin.native.js.map +1 -1
  231. package/dist/cjs/vite/plugins/virtualEntryPlugin.js +13 -3
  232. package/dist/cjs/vite/plugins/virtualEntryPlugin.js.map +1 -1
  233. package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
  234. package/dist/cjs/vite/replaceLoader.js +4 -1
  235. package/dist/cjs/vite/replaceLoader.js.map +1 -1
  236. package/dist/cjs/vite/replaceLoader.native.js.map +1 -1
  237. package/dist/cjs/vite/resolveResponse.js.map +1 -1
  238. package/dist/cjs/vite/resolveResponse.native.js.map +1 -1
  239. package/dist/cjs/zero/subscribeToQuery.js.map +1 -1
  240. package/dist/cjs/zero/subscribeToQuery.native.js.map +1 -1
  241. package/dist/cjs/zero/useQueryZero.js +3 -1
  242. package/dist/cjs/zero/useQueryZero.js.map +1 -1
  243. package/dist/cjs/zero/useQueryZero.native.js.map +1 -1
  244. package/dist/esm/Root.js +6 -1
  245. package/dist/esm/Root.js.map +1 -1
  246. package/dist/esm/Root.mjs.map +1 -1
  247. package/dist/esm/Root.native.js.map +1 -1
  248. package/dist/esm/babel-plugins/one-router-metro.js +4 -1
  249. package/dist/esm/babel-plugins/one-router-metro.js.map +1 -1
  250. package/dist/esm/babel-plugins/one-router-metro.mjs.map +1 -1
  251. package/dist/esm/babel-plugins/one-router-metro.native.js.map +1 -1
  252. package/dist/esm/babel-plugins/remove-server-code.js +7 -2
  253. package/dist/esm/babel-plugins/remove-server-code.js.map +1 -1
  254. package/dist/esm/babel-plugins/remove-server-code.mjs.map +1 -1
  255. package/dist/esm/babel-plugins/remove-server-code.native.js.map +1 -1
  256. package/dist/esm/cli/build.js +31 -8
  257. package/dist/esm/cli/build.js.map +1 -1
  258. package/dist/esm/cli/build.mjs.map +1 -1
  259. package/dist/esm/cli/build.native.js.map +1 -1
  260. package/dist/esm/cli/buildPage.js +14 -4
  261. package/dist/esm/cli/buildPage.js.map +1 -1
  262. package/dist/esm/cli/buildPage.mjs.map +1 -1
  263. package/dist/esm/cli/buildPage.native.js.map +1 -1
  264. package/dist/esm/cli/generateRoutes.js +3 -1
  265. package/dist/esm/cli/generateRoutes.js.map +1 -1
  266. package/dist/esm/cli/generateRoutes.mjs.map +1 -1
  267. package/dist/esm/cli/generateRoutes.native.js.map +1 -1
  268. package/dist/esm/cli/generateSitemap.js.map +1 -1
  269. package/dist/esm/cli/generateSitemap.mjs.map +1 -1
  270. package/dist/esm/cli/generateSitemap.native.js.map +1 -1
  271. package/dist/esm/cli/generateSitemap.test.js +14 -4
  272. package/dist/esm/cli/generateSitemap.test.js.map +1 -1
  273. package/dist/esm/cli/generateSitemap.test.mjs.map +1 -1
  274. package/dist/esm/cli/generateSitemap.test.native.js.map +1 -1
  275. package/dist/esm/cli/main.js +4 -2
  276. package/dist/esm/cli/main.js.map +1 -1
  277. package/dist/esm/cli/main.mjs.map +1 -1
  278. package/dist/esm/cli/main.native.js.map +1 -1
  279. package/dist/esm/cli/prebuild.js.map +1 -1
  280. package/dist/esm/cli/prebuild.mjs.map +1 -1
  281. package/dist/esm/cli/prebuild.native.js.map +1 -1
  282. package/dist/esm/clientLoaderResolver.js.map +1 -1
  283. package/dist/esm/clientLoaderResolver.mjs.map +1 -1
  284. package/dist/esm/clientLoaderResolver.native.js.map +1 -1
  285. package/dist/esm/config.js +3 -1
  286. package/dist/esm/config.js.map +1 -1
  287. package/dist/esm/config.mjs.map +1 -1
  288. package/dist/esm/config.native.js.map +1 -1
  289. package/dist/esm/constants.js.map +1 -1
  290. package/dist/esm/constants.mjs.map +1 -1
  291. package/dist/esm/constants.native.js.map +1 -1
  292. package/dist/esm/createApp.js +9 -1
  293. package/dist/esm/createApp.js.map +1 -1
  294. package/dist/esm/createApp.mjs.map +1 -1
  295. package/dist/esm/createHandleRequest.js +9 -3
  296. package/dist/esm/createHandleRequest.js.map +1 -1
  297. package/dist/esm/createHandleRequest.mjs.map +1 -1
  298. package/dist/esm/createHandleRequest.native.js.map +1 -1
  299. package/dist/esm/fork/__tests__/getPathFromState.test.js +90 -88
  300. package/dist/esm/fork/__tests__/getPathFromState.test.js.map +1 -1
  301. package/dist/esm/fork/__tests__/getPathFromState.test.mjs.map +1 -1
  302. package/dist/esm/fork/__tests__/getPathFromState.test.native.js.map +1 -1
  303. package/dist/esm/fork/__tests__/getStateFromPath.test.js +163 -86
  304. package/dist/esm/fork/__tests__/getStateFromPath.test.js.map +1 -1
  305. package/dist/esm/fork/__tests__/getStateFromPath.test.mjs.map +1 -1
  306. package/dist/esm/fork/__tests__/getStateFromPath.test.native.js.map +1 -1
  307. package/dist/esm/fork/_shared.js.map +1 -1
  308. package/dist/esm/fork/_shared.mjs.map +1 -1
  309. package/dist/esm/fork/_shared.native.js.map +1 -1
  310. package/dist/esm/fork/extractPathFromURL.js.map +1 -1
  311. package/dist/esm/fork/extractPathFromURL.mjs.map +1 -1
  312. package/dist/esm/fork/extractPathFromURL.native.js.map +1 -1
  313. package/dist/esm/fork/getPathFromState-mods.js +4 -1
  314. package/dist/esm/fork/getPathFromState-mods.js.map +1 -1
  315. package/dist/esm/fork/getPathFromState-mods.mjs.map +1 -1
  316. package/dist/esm/fork/getPathFromState-mods.native.js.map +1 -1
  317. package/dist/esm/fork/getPathFromState.js +3 -1
  318. package/dist/esm/fork/getPathFromState.js.map +1 -1
  319. package/dist/esm/fork/getPathFromState.mjs.map +1 -1
  320. package/dist/esm/fork/getPathFromState.native.js.map +1 -1
  321. package/dist/esm/fork/getStateFromPath-mods.js.map +1 -1
  322. package/dist/esm/fork/getStateFromPath-mods.mjs.map +1 -1
  323. package/dist/esm/fork/getStateFromPath-mods.native.js.map +1 -1
  324. package/dist/esm/fork/getStateFromPath.js +7 -1
  325. package/dist/esm/fork/getStateFromPath.js.map +1 -1
  326. package/dist/esm/fork/getStateFromPath.mjs.map +1 -1
  327. package/dist/esm/fork/getStateFromPath.native.js.map +1 -1
  328. package/dist/esm/fork/getStateFromPath.test.js +25 -9
  329. package/dist/esm/fork/getStateFromPath.test.js.map +1 -1
  330. package/dist/esm/fork/getStateFromPath.test.mjs.map +1 -1
  331. package/dist/esm/fork/getStateFromPath.test.native.js.map +1 -1
  332. package/dist/esm/fork/useBackButton.js.map +1 -1
  333. package/dist/esm/fork/useBackButton.mjs.map +1 -1
  334. package/dist/esm/fork/useDocumentTitle.js +4 -1
  335. package/dist/esm/fork/useDocumentTitle.js.map +1 -1
  336. package/dist/esm/fork/useDocumentTitle.mjs.map +1 -1
  337. package/dist/esm/fork/useLinking.js +4 -1
  338. package/dist/esm/fork/useLinking.js.map +1 -1
  339. package/dist/esm/fork/useLinking.mjs.map +1 -1
  340. package/dist/esm/fork/validatePathConfig.js.map +1 -1
  341. package/dist/esm/fork/validatePathConfig.mjs.map +1 -1
  342. package/dist/esm/fork/validatePathConfig.native.js.map +1 -1
  343. package/dist/esm/hooks.js.map +1 -1
  344. package/dist/esm/hooks.mjs.map +1 -1
  345. package/dist/esm/hooks.native.js.map +1 -1
  346. package/dist/esm/index.js +3 -1
  347. package/dist/esm/index.js.map +1 -1
  348. package/dist/esm/index.mjs.map +1 -1
  349. package/dist/esm/index.native.js.map +1 -1
  350. package/dist/esm/layouts/Tabs.js.map +1 -1
  351. package/dist/esm/layouts/Tabs.mjs.map +1 -1
  352. package/dist/esm/layouts/Tabs.native.js.map +1 -1
  353. package/dist/esm/layouts/withLayoutContext.js +10 -8
  354. package/dist/esm/layouts/withLayoutContext.js.map +1 -1
  355. package/dist/esm/layouts/withLayoutContext.mjs.map +1 -1
  356. package/dist/esm/layouts/withLayoutContext.native.js.map +1 -1
  357. package/dist/esm/link/Link.js.map +1 -1
  358. package/dist/esm/link/Link.mjs.map +1 -1
  359. package/dist/esm/link/Link.native.js.map +1 -1
  360. package/dist/esm/link/linking.js +3 -1
  361. package/dist/esm/link/linking.js.map +1 -1
  362. package/dist/esm/link/linking.mjs.map +1 -1
  363. package/dist/esm/link/linking.native.js.map +1 -1
  364. package/dist/esm/link/useLinkTo.js.map +1 -1
  365. package/dist/esm/link/useLinkTo.mjs.map +1 -1
  366. package/dist/esm/link/useLinkTo.native.js.map +1 -1
  367. package/dist/esm/link/useLoadedNavigation.js +3 -1
  368. package/dist/esm/link/useLoadedNavigation.js.map +1 -1
  369. package/dist/esm/link/useLoadedNavigation.mjs.map +1 -1
  370. package/dist/esm/link/useLoadedNavigation.native.js.map +1 -1
  371. package/dist/esm/metro-config/getViteMetroPluginOptions.js +8 -10
  372. package/dist/esm/metro-config/getViteMetroPluginOptions.js.map +1 -1
  373. package/dist/esm/metro-config/getViteMetroPluginOptions.mjs +6 -8
  374. package/dist/esm/metro-config/getViteMetroPluginOptions.mjs.map +1 -1
  375. package/dist/esm/metro-config/getViteMetroPluginOptions.native.js +9 -11
  376. package/dist/esm/metro-config/getViteMetroPluginOptions.native.js.map +1 -1
  377. package/dist/esm/router/Route.js.map +1 -1
  378. package/dist/esm/router/Route.mjs.map +1 -1
  379. package/dist/esm/router/Route.native.js.map +1 -1
  380. package/dist/esm/router/RouteInfoContext.js +7 -1
  381. package/dist/esm/router/RouteInfoContext.js.map +1 -1
  382. package/dist/esm/router/RouteInfoContext.mjs.map +1 -1
  383. package/dist/esm/router/RouteInfoContext.native.js.map +1 -1
  384. package/dist/esm/router/filterRootHTML.js.map +1 -1
  385. package/dist/esm/router/filterRootHTML.mjs.map +1 -1
  386. package/dist/esm/router/filterRootHTML.native.js.map +1 -1
  387. package/dist/esm/router/getLinkingConfig.js.map +1 -1
  388. package/dist/esm/router/getLinkingConfig.mjs.map +1 -1
  389. package/dist/esm/router/getLinkingConfig.native.js.map +1 -1
  390. package/dist/esm/router/getNormalizedStatePath.js.map +1 -1
  391. package/dist/esm/router/getNormalizedStatePath.mjs.map +1 -1
  392. package/dist/esm/router/getNormalizedStatePath.native.js.map +1 -1
  393. package/dist/esm/router/getRoutes.js +3 -1
  394. package/dist/esm/router/getRoutes.js.map +1 -1
  395. package/dist/esm/router/getRoutes.mjs.map +1 -1
  396. package/dist/esm/router/getRoutes.native.js.map +1 -1
  397. package/dist/esm/router/linkingConfig.js +3 -1
  398. package/dist/esm/router/linkingConfig.js.map +1 -1
  399. package/dist/esm/router/linkingConfig.mjs.map +1 -1
  400. package/dist/esm/router/linkingConfig.native.js.map +1 -1
  401. package/dist/esm/router/matchers.js +1 -1
  402. package/dist/esm/router/matchers.js.map +1 -1
  403. package/dist/esm/router/matchers.mjs +1 -1
  404. package/dist/esm/router/matchers.mjs.map +1 -1
  405. package/dist/esm/router/matchers.native.js +1 -1
  406. package/dist/esm/router/matchers.native.js.map +1 -1
  407. package/dist/esm/router/matchers.test.js +6 -2
  408. package/dist/esm/router/matchers.test.js.map +1 -1
  409. package/dist/esm/router/matchers.test.mjs.map +1 -1
  410. package/dist/esm/router/router.js +16 -4
  411. package/dist/esm/router/router.js.map +1 -1
  412. package/dist/esm/router/router.mjs.map +1 -1
  413. package/dist/esm/router/router.native.js.map +1 -1
  414. package/dist/esm/router/useNavigation.js.map +1 -1
  415. package/dist/esm/router/useNavigation.mjs.map +1 -1
  416. package/dist/esm/router/useNavigation.native.js.map +1 -1
  417. package/dist/esm/router/useScreens.js +73 -46
  418. package/dist/esm/router/useScreens.js.map +1 -1
  419. package/dist/esm/router/useScreens.mjs +74 -52
  420. package/dist/esm/router/useScreens.mjs.map +1 -1
  421. package/dist/esm/router/useScreens.native.js +30 -19
  422. package/dist/esm/router/useScreens.native.js.map +1 -1
  423. package/dist/esm/router/useViteRoutes.js +28 -9
  424. package/dist/esm/router/useViteRoutes.js.map +1 -1
  425. package/dist/esm/router/useViteRoutes.mjs +26 -8
  426. package/dist/esm/router/useViteRoutes.mjs.map +1 -1
  427. package/dist/esm/router/useViteRoutes.native.js +33 -13
  428. package/dist/esm/router/useViteRoutes.native.js.map +1 -1
  429. package/dist/esm/router/utils/getNavigateAction.js.map +1 -1
  430. package/dist/esm/router/utils/getNavigateAction.mjs.map +1 -1
  431. package/dist/esm/router/utils/getNavigateAction.native.js.map +1 -1
  432. package/dist/esm/server/createRoutesManifest.js.map +1 -1
  433. package/dist/esm/server/createRoutesManifest.mjs.map +1 -1
  434. package/dist/esm/server/createRoutesManifest.native.js.map +1 -1
  435. package/dist/esm/server/getServerManifest.js +3 -1
  436. package/dist/esm/server/getServerManifest.js.map +1 -1
  437. package/dist/esm/server/getServerManifest.mjs.map +1 -1
  438. package/dist/esm/server/getServerManifest.native.js.map +1 -1
  439. package/dist/esm/server/oneServe.js +9 -2
  440. package/dist/esm/server/oneServe.js.map +1 -1
  441. package/dist/esm/server/oneServe.mjs.map +1 -1
  442. package/dist/esm/server/oneServe.native.js.map +1 -1
  443. package/dist/esm/server/setupBuildOptions.js.map +1 -1
  444. package/dist/esm/server/setupBuildOptions.mjs.map +1 -1
  445. package/dist/esm/server/setupBuildOptions.native.js.map +1 -1
  446. package/dist/esm/server/staticHtmlFetcher.js.map +1 -1
  447. package/dist/esm/server/staticHtmlFetcher.mjs.map +1 -1
  448. package/dist/esm/server/staticHtmlFetcher.native.js.map +1 -1
  449. package/dist/esm/server-render.js.map +1 -1
  450. package/dist/esm/server-render.mjs.map +1 -1
  451. package/dist/esm/server-render.native.js.map +1 -1
  452. package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.js +14 -2
  453. package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.js.map +1 -1
  454. package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.mjs.map +1 -1
  455. package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.native.js.map +1 -1
  456. package/dist/esm/typed-routes/injectRouteHelpers.js +4 -1
  457. package/dist/esm/typed-routes/injectRouteHelpers.js.map +1 -1
  458. package/dist/esm/typed-routes/injectRouteHelpers.mjs.map +1 -1
  459. package/dist/esm/typed-routes/injectRouteHelpers.native.js.map +1 -1
  460. package/dist/esm/ui/Slot.js.map +1 -1
  461. package/dist/esm/ui/Slot.mjs.map +1 -1
  462. package/dist/esm/ui/Slot.native.js.map +1 -1
  463. package/dist/esm/ui/TabContext.js +3 -1
  464. package/dist/esm/ui/TabContext.js.map +1 -1
  465. package/dist/esm/ui/TabContext.mjs.map +1 -1
  466. package/dist/esm/ui/TabContext.native.js.map +1 -1
  467. package/dist/esm/ui/TabRouter.js.map +1 -1
  468. package/dist/esm/ui/TabRouter.mjs.map +1 -1
  469. package/dist/esm/ui/TabRouter.native.js.map +1 -1
  470. package/dist/esm/ui/TabTrigger.js +21 -3
  471. package/dist/esm/ui/TabTrigger.js.map +1 -1
  472. package/dist/esm/ui/TabTrigger.mjs.map +1 -1
  473. package/dist/esm/ui/TabTrigger.native.js.map +1 -1
  474. package/dist/esm/ui/Tabs.js +5 -1
  475. package/dist/esm/ui/Tabs.js.map +1 -1
  476. package/dist/esm/ui/Tabs.mjs.map +1 -1
  477. package/dist/esm/ui/Tabs.native.js.map +1 -1
  478. package/dist/esm/ui/common.js +8 -2
  479. package/dist/esm/ui/common.js.map +1 -1
  480. package/dist/esm/ui/common.mjs.map +1 -1
  481. package/dist/esm/ui/common.native.js.map +1 -1
  482. package/dist/esm/useLoader.js +4 -1
  483. package/dist/esm/useLoader.js.map +1 -1
  484. package/dist/esm/useLoader.mjs.map +1 -1
  485. package/dist/esm/useLoader.native.js.map +1 -1
  486. package/dist/esm/utils/cleanUrl.js.map +1 -1
  487. package/dist/esm/utils/cleanUrl.mjs.map +1 -1
  488. package/dist/esm/utils/cleanUrl.native.js.map +1 -1
  489. package/dist/esm/utils/url.js +3 -1
  490. package/dist/esm/utils/url.js.map +1 -1
  491. package/dist/esm/utils/url.mjs.map +1 -1
  492. package/dist/esm/utils/url.native.js.map +1 -1
  493. package/dist/esm/vercel/build/buildVercelOutputDirectory.js +29 -10
  494. package/dist/esm/vercel/build/buildVercelOutputDirectory.js.map +1 -1
  495. package/dist/esm/vercel/build/buildVercelOutputDirectory.mjs.map +1 -1
  496. package/dist/esm/vercel/build/buildVercelOutputDirectory.native.js.map +1 -1
  497. package/dist/esm/vercel/build/generate/createApiServerlessFunction.js +11 -3
  498. package/dist/esm/vercel/build/generate/createApiServerlessFunction.js.map +1 -1
  499. package/dist/esm/vercel/build/generate/createApiServerlessFunction.mjs.map +1 -1
  500. package/dist/esm/vercel/build/generate/createApiServerlessFunction.native.js.map +1 -1
  501. package/dist/esm/vercel/build/generate/createSsrServerlessFunction.js +9 -2
  502. package/dist/esm/vercel/build/generate/createSsrServerlessFunction.js.map +1 -1
  503. package/dist/esm/vercel/build/generate/createSsrServerlessFunction.mjs.map +1 -1
  504. package/dist/esm/vercel/build/generate/createSsrServerlessFunction.native.js.map +1 -1
  505. package/dist/esm/vercel/build/getPathFromRoute.js +4 -1
  506. package/dist/esm/vercel/build/getPathFromRoute.js.map +1 -1
  507. package/dist/esm/vercel/build/getPathFromRoute.mjs.map +1 -1
  508. package/dist/esm/vercel/build/getPathFromRoute.native.js.map +1 -1
  509. package/dist/esm/views/Navigator.js +20 -9
  510. package/dist/esm/views/Navigator.js.map +1 -1
  511. package/dist/esm/views/Navigator.mjs.map +1 -1
  512. package/dist/esm/views/Navigator.native.js.map +1 -1
  513. package/dist/esm/views/RootErrorBoundary.js +4 -2
  514. package/dist/esm/views/RootErrorBoundary.js.map +1 -1
  515. package/dist/esm/views/RootErrorBoundary.mjs.map +1 -1
  516. package/dist/esm/views/RootErrorBoundary.native.js.map +1 -1
  517. package/dist/esm/views/Screen.js +4 -1
  518. package/dist/esm/views/Screen.js.map +1 -1
  519. package/dist/esm/views/Screen.mjs.map +1 -1
  520. package/dist/esm/views/Screen.native.js.map +1 -1
  521. package/dist/esm/vite/DevHead.js +18 -0
  522. package/dist/esm/vite/DevHead.js.map +1 -1
  523. package/dist/esm/vite/DevHead.mjs +14 -0
  524. package/dist/esm/vite/DevHead.mjs.map +1 -1
  525. package/dist/esm/vite/loadConfig.js +6 -2
  526. package/dist/esm/vite/loadConfig.js.map +1 -1
  527. package/dist/esm/vite/loadConfig.mjs.map +1 -1
  528. package/dist/esm/vite/loadConfig.native.js.map +1 -1
  529. package/dist/esm/vite/one-server-only.js +3 -1
  530. package/dist/esm/vite/one-server-only.js.map +1 -1
  531. package/dist/esm/vite/one-server-only.mjs.map +1 -1
  532. package/dist/esm/vite/one.js +18 -5
  533. package/dist/esm/vite/one.js.map +1 -1
  534. package/dist/esm/vite/one.mjs +9 -2
  535. package/dist/esm/vite/one.mjs.map +1 -1
  536. package/dist/esm/vite/one.native.js +17 -12
  537. package/dist/esm/vite/one.native.js.map +1 -1
  538. package/dist/esm/vite/plugins/SSRCSSPlugin.js +5 -1
  539. package/dist/esm/vite/plugins/SSRCSSPlugin.js.map +1 -1
  540. package/dist/esm/vite/plugins/SSRCSSPlugin.mjs.map +1 -1
  541. package/dist/esm/vite/plugins/SSRCSSPlugin.native.js.map +1 -1
  542. package/dist/esm/vite/plugins/clientTreeShakePlugin.js +12 -3
  543. package/dist/esm/vite/plugins/clientTreeShakePlugin.js.map +1 -1
  544. package/dist/esm/vite/plugins/clientTreeShakePlugin.mjs.map +1 -1
  545. package/dist/esm/vite/plugins/clientTreeShakePlugin.native.js.map +1 -1
  546. package/dist/esm/vite/plugins/fileSystemRouterPlugin.js +13 -6
  547. package/dist/esm/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
  548. package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs +2 -2
  549. package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs.map +1 -1
  550. package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js +5 -2
  551. package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
  552. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js +2 -2
  553. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
  554. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs +2 -2
  555. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs.map +1 -1
  556. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +7 -4
  557. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
  558. package/dist/esm/vite/plugins/removeReactNativeWebAnimatedPlugin.js.map +1 -1
  559. package/dist/esm/vite/plugins/removeReactNativeWebAnimatedPlugin.mjs.map +1 -1
  560. package/dist/esm/vite/plugins/removeReactNativeWebAnimatedPlugin.native.js.map +1 -1
  561. package/dist/esm/vite/plugins/virtualEntryPlugin.js +13 -3
  562. package/dist/esm/vite/plugins/virtualEntryPlugin.js.map +1 -1
  563. package/dist/esm/vite/plugins/virtualEntryPlugin.mjs.map +1 -1
  564. package/dist/esm/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
  565. package/dist/esm/vite/replaceLoader.js +4 -1
  566. package/dist/esm/vite/replaceLoader.js.map +1 -1
  567. package/dist/esm/vite/replaceLoader.mjs.map +1 -1
  568. package/dist/esm/vite/replaceLoader.native.js.map +1 -1
  569. package/dist/esm/vite/resolveResponse.js +5 -1
  570. package/dist/esm/vite/resolveResponse.js.map +1 -1
  571. package/dist/esm/vite/resolveResponse.mjs.map +1 -1
  572. package/dist/esm/vite/resolveResponse.native.js.map +1 -1
  573. package/dist/esm/zero/subscribeToQuery.js.map +1 -1
  574. package/dist/esm/zero/subscribeToQuery.mjs.map +1 -1
  575. package/dist/esm/zero/subscribeToQuery.native.js.map +1 -1
  576. package/dist/esm/zero/useQueryZero.js +3 -1
  577. package/dist/esm/zero/useQueryZero.js.map +1 -1
  578. package/dist/esm/zero/useQueryZero.mjs.map +1 -1
  579. package/dist/esm/zero/useQueryZero.native.js.map +1 -1
  580. package/metro-entry-ctx.js +2 -1
  581. package/package.json +10 -10
  582. package/src/Root.tsx +14 -5
  583. package/src/babel-plugins/one-router-metro.ts +4 -1
  584. package/src/babel-plugins/remove-server-code.ts +15 -4
  585. package/src/cli/build.ts +33 -8
  586. package/src/cli/buildPage.ts +15 -4
  587. package/src/cli/generateRoutes.ts +3 -1
  588. package/src/cli/generateSitemap.test.ts +14 -4
  589. package/src/cli/generateSitemap.ts +7 -2
  590. package/src/cli/main.ts +3 -1
  591. package/src/cli/prebuild.ts +5 -1
  592. package/src/clientLoaderResolver.ts +4 -1
  593. package/src/config.ts +6 -2
  594. package/src/constants.ts +4 -2
  595. package/src/createApp.tsx +11 -3
  596. package/src/createHandleRequest.ts +17 -6
  597. package/src/fork/__tests__/getPathFromState.test.tsx +128 -107
  598. package/src/fork/__tests__/getStateFromPath.test.tsx +181 -95
  599. package/src/fork/_shared.ts +2 -1
  600. package/src/fork/extractPathFromURL.ts +2 -1
  601. package/src/fork/getPathFromState-mods.ts +8 -2
  602. package/src/fork/getPathFromState.ts +16 -5
  603. package/src/fork/getStateFromPath-mods.ts +13 -3
  604. package/src/fork/getStateFromPath.test.ts +25 -9
  605. package/src/fork/getStateFromPath.ts +21 -5
  606. package/src/fork/useBackButton.native.tsx +3 -1
  607. package/src/fork/useBackButton.tsx +3 -1
  608. package/src/fork/useDocumentTitle.tsx +4 -1
  609. package/src/fork/useLinking.native.ts +3 -1
  610. package/src/fork/useLinking.ts +9 -3
  611. package/src/fork/validatePathConfig.ts +6 -1
  612. package/src/head/Head.ios.tsx +3 -1
  613. package/src/hooks.tsx +4 -2
  614. package/src/index.ts +4 -1
  615. package/src/interfaces/router.ts +29 -13
  616. package/src/layouts/Tabs.tsx +5 -1
  617. package/src/layouts/withLayoutContext.tsx +24 -21
  618. package/src/link/Link.tsx +3 -1
  619. package/src/link/linking.ts +3 -1
  620. package/src/link/useLinkTo.tsx +3 -1
  621. package/src/link/useLoadedNavigation.ts +5 -1
  622. package/src/metro-config/getViteMetroPluginOptions.ts +20 -22
  623. package/src/router/Route.tsx +3 -1
  624. package/src/router/RouteInfoContext.tsx +3 -1
  625. package/src/router/filterRootHTML.ts +5 -1
  626. package/src/router/getLinkingConfig.ts +4 -1
  627. package/src/router/getNormalizedStatePath.tsx +4 -1
  628. package/src/router/getRoutes.ts +13 -4
  629. package/src/router/linkingConfig.ts +4 -1
  630. package/src/router/matchers.test.ts +6 -2
  631. package/src/router/matchers.ts +1 -1
  632. package/src/router/router.ts +25 -6
  633. package/src/router/useNavigation.ts +4 -1
  634. package/src/router/useScreens.tsx +127 -64
  635. package/src/router/useViteRoutes.tsx +44 -2
  636. package/src/router/utils/getNavigateAction.ts +4 -2
  637. package/src/server/createRoutesManifest.ts +4 -1
  638. package/src/server/getServerManifest.ts +7 -2
  639. package/src/server/oneServe.ts +21 -8
  640. package/src/server/setupBuildOptions.ts +2 -1
  641. package/src/server/staticHtmlFetcher.ts +3 -1
  642. package/src/server-render.tsx +4 -1
  643. package/src/typed-routes/getTypedRoutesDeclarationFile.ts +20 -4
  644. package/src/typed-routes/injectRouteHelpers.ts +12 -3
  645. package/src/types.ts +2 -2
  646. package/src/ui/Slot.tsx +4 -2
  647. package/src/ui/TabContext.tsx +3 -1
  648. package/src/ui/TabRouter.tsx +7 -2
  649. package/src/ui/TabTrigger.tsx +20 -3
  650. package/src/ui/Tabs.tsx +8 -2
  651. package/src/ui/common.tsx +19 -5
  652. package/src/useLoader.ts +9 -4
  653. package/src/utils/cleanUrl.ts +5 -1
  654. package/src/utils/url.ts +3 -1
  655. package/src/vercel/build/buildVercelOutputDirectory.ts +31 -10
  656. package/src/vercel/build/generate/createApiServerlessFunction.ts +11 -3
  657. package/src/vercel/build/generate/createSsrServerlessFunction.ts +10 -3
  658. package/src/vercel/build/getPathFromRoute.ts +4 -1
  659. package/src/views/Navigator.tsx +21 -9
  660. package/src/views/RootErrorBoundary.tsx +3 -1
  661. package/src/views/Screen.tsx +4 -1
  662. package/src/vite/DevHead.tsx +15 -0
  663. package/src/vite/loadConfig.ts +6 -2
  664. package/src/vite/one-server-only.tsx +10 -4
  665. package/src/vite/one.ts +80 -47
  666. package/src/vite/plugins/SSRCSSPlugin.ts +9 -2
  667. package/src/vite/plugins/clientTreeShakePlugin.ts +22 -6
  668. package/src/vite/plugins/fileSystemRouterPlugin.tsx +14 -5
  669. package/src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx +6 -3
  670. package/src/vite/plugins/removeReactNativeWebAnimatedPlugin.ts +3 -1
  671. package/src/vite/plugins/virtualEntryPlugin.ts +22 -5
  672. package/src/vite/replaceLoader.ts +7 -1
  673. package/src/vite/resolveResponse.ts +6 -2
  674. package/src/vite/types.ts +6 -3
  675. package/src/zero/subscribeToQuery.ts +4 -1
  676. package/src/zero/types.ts +8 -9
  677. package/src/zero/useQuery.ts +1 -1
  678. package/src/zero/useQueryZero.ts +3 -1
  679. package/types/Root.d.ts.map +1 -1
  680. package/types/babel-plugins/one-router-metro.d.ts.map +1 -1
  681. package/types/babel-plugins/remove-server-code.d.ts.map +1 -1
  682. package/types/cli/build.d.ts.map +1 -1
  683. package/types/cli/buildPage.d.ts.map +1 -1
  684. package/types/cli/generateRoutes.d.ts.map +1 -1
  685. package/types/cli/generateSitemap.d.ts.map +1 -1
  686. package/types/cli/main.d.ts.map +1 -1
  687. package/types/cli/prebuild.d.ts.map +1 -1
  688. package/types/clientLoaderResolver.d.ts.map +1 -1
  689. package/types/config.d.ts.map +1 -1
  690. package/types/constants.d.ts.map +1 -1
  691. package/types/createApp.d.ts.map +1 -1
  692. package/types/createHandleRequest.d.ts +1 -1
  693. package/types/createHandleRequest.d.ts.map +1 -1
  694. package/types/fork/_shared.d.ts.map +1 -1
  695. package/types/fork/extractPathFromURL.d.ts.map +1 -1
  696. package/types/fork/getPathFromState.d.ts.map +1 -1
  697. package/types/fork/getStateFromPath-mods.d.ts.map +1 -1
  698. package/types/fork/getStateFromPath.d.ts.map +1 -1
  699. package/types/fork/useBackButton.d.ts.map +1 -1
  700. package/types/fork/useBackButton.native.d.ts.map +1 -1
  701. package/types/fork/useDocumentTitle.d.ts.map +1 -1
  702. package/types/fork/useLinking.d.ts.map +1 -1
  703. package/types/fork/useLinking.native.d.ts.map +1 -1
  704. package/types/fork/validatePathConfig.d.ts.map +1 -1
  705. package/types/head/Head.ios.d.ts.map +1 -1
  706. package/types/hooks.d.ts +2 -2
  707. package/types/hooks.d.ts.map +1 -1
  708. package/types/index.d.ts +1 -1
  709. package/types/index.d.ts.map +1 -1
  710. package/types/interfaces/router.d.ts.map +1 -1
  711. package/types/layouts/Tabs.d.ts.map +1 -1
  712. package/types/layouts/withLayoutContext.d.ts.map +1 -1
  713. package/types/link/Link.d.ts.map +1 -1
  714. package/types/link/linking.d.ts.map +1 -1
  715. package/types/link/useLinkTo.d.ts.map +1 -1
  716. package/types/link/useLoadedNavigation.d.ts.map +1 -1
  717. package/types/metro-config/getViteMetroPluginOptions.d.ts.map +1 -1
  718. package/types/router/Route.d.ts.map +1 -1
  719. package/types/router/RouteInfoContext.d.ts.map +1 -1
  720. package/types/router/filterRootHTML.d.ts.map +1 -1
  721. package/types/router/getNormalizedStatePath.d.ts.map +1 -1
  722. package/types/router/getRoutes.d.ts.map +1 -1
  723. package/types/router/linkingConfig.d.ts.map +1 -1
  724. package/types/router/router.d.ts.map +1 -1
  725. package/types/router/useNavigation.d.ts.map +1 -1
  726. package/types/router/useScreens.d.ts.map +1 -1
  727. package/types/router/useViteRoutes.d.ts.map +1 -1
  728. package/types/router/utils/getNavigateAction.d.ts.map +1 -1
  729. package/types/server/createRoutesManifest.d.ts.map +1 -1
  730. package/types/server/getServerManifest.d.ts.map +1 -1
  731. package/types/server/oneServe.d.ts.map +1 -1
  732. package/types/server/setupBuildOptions.d.ts.map +1 -1
  733. package/types/server/staticHtmlFetcher.d.ts.map +1 -1
  734. package/types/server-render.d.ts.map +1 -1
  735. package/types/types.d.ts +2 -2
  736. package/types/ui/Slot.d.ts.map +1 -1
  737. package/types/ui/TabContext.d.ts.map +1 -1
  738. package/types/ui/TabRouter.d.ts.map +1 -1
  739. package/types/ui/TabTrigger.d.ts.map +1 -1
  740. package/types/ui/Tabs.d.ts.map +1 -1
  741. package/types/ui/common.d.ts.map +1 -1
  742. package/types/useLoader.d.ts.map +1 -1
  743. package/types/utils/cleanUrl.d.ts.map +1 -1
  744. package/types/utils/url.d.ts.map +1 -1
  745. package/types/vercel/build/buildVercelOutputDirectory.d.ts.map +1 -1
  746. package/types/vercel/build/generate/createApiServerlessFunction.d.ts.map +1 -1
  747. package/types/vercel/build/generate/createSsrServerlessFunction.d.ts.map +1 -1
  748. package/types/vercel/build/getPathFromRoute.d.ts.map +1 -1
  749. package/types/views/Navigator.d.ts +1 -1
  750. package/types/views/Navigator.d.ts.map +1 -1
  751. package/types/views/RootErrorBoundary.d.ts.map +1 -1
  752. package/types/views/Screen.d.ts +1 -1
  753. package/types/views/Screen.d.ts.map +1 -1
  754. package/types/vite/DevHead.d.ts.map +1 -1
  755. package/types/vite/loadConfig.d.ts.map +1 -1
  756. package/types/vite/one-server-only.d.ts +2 -2
  757. package/types/vite/one-server-only.d.ts.map +1 -1
  758. package/types/vite/one.d.ts.map +1 -1
  759. package/types/vite/plugins/SSRCSSPlugin.d.ts.map +1 -1
  760. package/types/vite/plugins/clientTreeShakePlugin.d.ts.map +1 -1
  761. package/types/vite/plugins/fileSystemRouterPlugin.d.ts.map +1 -1
  762. package/types/vite/plugins/generateFileSystemRouteTypesPlugin.d.ts.map +1 -1
  763. package/types/vite/plugins/removeReactNativeWebAnimatedPlugin.d.ts.map +1 -1
  764. package/types/vite/plugins/virtualEntryPlugin.d.ts.map +1 -1
  765. package/types/vite/replaceLoader.d.ts +2 -2
  766. package/types/vite/replaceLoader.d.ts.map +1 -1
  767. package/types/vite/resolveResponse.d.ts.map +1 -1
  768. package/types/vite/types.d.ts +1 -1
  769. package/types/vite/types.d.ts.map +1 -1
  770. package/types/zero/subscribeToQuery.d.ts.map +1 -1
  771. package/types/zero/types.d.ts.map +1 -1
  772. package/types/zero/useQueryZero.d.ts.map +1 -1
  773. package/vendor/react/cjs/react-jsx-dev-runtime.development.js +1230 -1078
  774. package/vendor/react/cjs/react-jsx-dev-runtime.production.min.js +4 -1
  775. package/vendor/react/cjs/react-jsx-dev-runtime.profiling.min.js +4 -1
  776. package/vendor/react/cjs/react-jsx-runtime.development.js +1244 -1092
  777. package/vendor/react/cjs/react-jsx-runtime.production.min.js +23 -2
  778. package/vendor/react/cjs/react-jsx-runtime.profiling.min.js +23 -2
  779. package/vendor/react/cjs/react.development.js +2604 -2324
  780. package/vendor/react/cjs/react.production.min.js +360 -17
  781. package/vendor/react/cjs/react.shared-subset.development.js +9 -7
  782. package/vendor/react/cjs/react.shared-subset.production.min.js +2 -1
  783. package/vendor/react/index.js +3 -3
  784. package/vendor/react/jsx-dev-runtime.js +3 -3
  785. package/vendor/react/jsx-runtime.js +3 -3
  786. package/vendor/react/react.shared-subset.js +3 -3
  787. package/vendor/react/umd/react.development.js +1430 -1152
  788. package/vendor/react/umd/react.production.min.js +657 -22
  789. package/vendor/react/umd/react.profiling.min.js +657 -22
  790. package/vendor/react-dom/cjs/react-dom-server-legacy.browser.development.js +7183 -5938
  791. package/vendor/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +1941 -84
  792. package/vendor/react-dom/cjs/react-dom-server-legacy.node.development.js +7239 -5986
  793. package/vendor/react-dom/cjs/react-dom-server-legacy.node.production.min.js +2055 -92
  794. package/vendor/react-dom/cjs/react-dom-server.browser.development.js +7146 -5924
  795. package/vendor/react-dom/cjs/react-dom-server.browser.production.min.js +1997 -87
  796. package/vendor/react-dom/cjs/react-dom-server.node.development.js +7210 -5976
  797. package/vendor/react-dom/cjs/react-dom-server.node.production.min.js +2075 -93
  798. package/vendor/react-dom/cjs/react-dom-test-utils.development.js +1700 -1487
  799. package/vendor/react-dom/cjs/react-dom-test-utils.production.min.js +653 -31
  800. package/vendor/react-dom/cjs/react-dom.development.js +29568 -25248
  801. package/vendor/react-dom/cjs/react-dom.production.min.js +8208 -310
  802. package/vendor/react-dom/cjs/react-dom.profiling.min.js +8750 -343
  803. package/vendor/react-dom/client.js +15 -15
  804. package/vendor/react-dom/index.js +8 -8
  805. package/vendor/react-dom/profiling.js +8 -8
  806. package/vendor/react-dom/server.browser.js +12 -12
  807. package/vendor/react-dom/server.js +2 -2
  808. package/vendor/react-dom/server.node.js +12 -12
  809. package/vendor/react-dom/test-utils.js +3 -3
  810. package/vendor/react-dom/umd/react-dom-server-legacy.browser.development.js +3735 -2502
  811. package/vendor/react-dom/umd/react-dom-server-legacy.browser.production.min.js +1964 -66
  812. package/vendor/react-dom/umd/react-dom-server.browser.development.js +3724 -2511
  813. package/vendor/react-dom/umd/react-dom-server.browser.production.min.js +2017 -67
  814. package/vendor/react-dom/umd/react-dom-test-utils.development.js +777 -563
  815. package/vendor/react-dom/umd/react-dom-test-utils.production.min.js +678 -24
  816. package/vendor/react-dom/umd/react-dom.development.js +15978 -11854
  817. package/vendor/react-dom/umd/react-dom.production.min.js +8328 -256
  818. package/vendor/react-dom/umd/react-dom.profiling.min.js +8868 -274
@@ -8,1308 +8,1460 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
 
11
- 'use strict';
12
-
13
- if (process.env.NODE_ENV !== "production") {
14
- (function() {
15
- 'use strict';
16
-
17
- var React = require('react');
18
-
19
- // ATTENTION
20
- // When adding new symbols to this file,
21
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
22
- // The Symbol used to tag the ReactElement-like types.
23
- var REACT_ELEMENT_TYPE = Symbol.for('react.element');
24
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
25
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
26
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
27
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
28
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
29
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
30
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
31
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
32
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
33
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
34
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
35
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
36
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
37
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
38
- function getIteratorFn(maybeIterable) {
39
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
40
- return null;
41
- }
42
-
43
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
44
-
45
- if (typeof maybeIterator === 'function') {
46
- return maybeIterator;
47
- }
48
-
49
- return null;
50
- }
11
+ 'use strict'
12
+
13
+ if (process.env.NODE_ENV !== 'production') {
14
+ ;(function () {
15
+ 'use strict'
16
+
17
+ var React = require('react')
18
+
19
+ // ATTENTION
20
+ // When adding new symbols to this file,
21
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
22
+ // The Symbol used to tag the ReactElement-like types.
23
+ var REACT_ELEMENT_TYPE = Symbol.for('react.element')
24
+ var REACT_PORTAL_TYPE = Symbol.for('react.portal')
25
+ var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment')
26
+ var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode')
27
+ var REACT_PROFILER_TYPE = Symbol.for('react.profiler')
28
+ var REACT_PROVIDER_TYPE = Symbol.for('react.provider')
29
+ var REACT_CONTEXT_TYPE = Symbol.for('react.context')
30
+ var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref')
31
+ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense')
32
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list')
33
+ var REACT_MEMO_TYPE = Symbol.for('react.memo')
34
+ var REACT_LAZY_TYPE = Symbol.for('react.lazy')
35
+ var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen')
36
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator
37
+ var FAUX_ITERATOR_SYMBOL = '@@iterator'
38
+ function getIteratorFn(maybeIterable) {
39
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
40
+ return null
41
+ }
51
42
 
52
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
43
+ var maybeIterator =
44
+ (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
45
+ maybeIterable[FAUX_ITERATOR_SYMBOL]
53
46
 
54
- function error(format) {
55
- {
56
- {
57
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
58
- args[_key2 - 1] = arguments[_key2];
47
+ if (typeof maybeIterator === 'function') {
48
+ return maybeIterator
59
49
  }
60
50
 
61
- printWarning('error', format, args);
51
+ return null
62
52
  }
63
- }
64
- }
65
-
66
- function printWarning(level, format, args) {
67
- // When changing this logic, you might want to also
68
- // update consoleWithStackDev.www.js as well.
69
- {
70
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
71
- var stack = ReactDebugCurrentFrame.getStackAddendum();
72
-
73
- if (stack !== '') {
74
- format += '%s';
75
- args = args.concat([stack]);
76
- } // eslint-disable-next-line react-internal/safe-string-coercion
77
53
 
54
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
78
55
 
79
- var argsWithFormat = args.map(function (item) {
80
- return String(item);
81
- }); // Careful: RN currently depends on this prefix
56
+ function error(format) {
57
+ {
58
+ {
59
+ for (
60
+ var _len2 = arguments.length,
61
+ args = new Array(_len2 > 1 ? _len2 - 1 : 0),
62
+ _key2 = 1;
63
+ _key2 < _len2;
64
+ _key2++
65
+ ) {
66
+ args[_key2 - 1] = arguments[_key2]
67
+ }
82
68
 
83
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
84
- // breaks IE9: https://github.com/facebook/react/issues/13610
85
- // eslint-disable-next-line react-internal/no-production-logging
69
+ printWarning('error', format, args)
70
+ }
71
+ }
72
+ }
86
73
 
87
- Function.prototype.apply.call(console[level], console, argsWithFormat);
88
- }
89
- }
74
+ function printWarning(level, format, args) {
75
+ // When changing this logic, you might want to also
76
+ // update consoleWithStackDev.www.js as well.
77
+ {
78
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame
79
+ var stack = ReactDebugCurrentFrame.getStackAddendum()
90
80
 
91
- // -----------------------------------------------------------------------------
81
+ if (stack !== '') {
82
+ format += '%s'
83
+ args = args.concat([stack])
84
+ } // eslint-disable-next-line react-internal/safe-string-coercion
92
85
 
93
- var enableScopeAPI = false; // Experimental Create Event Handle API.
94
- var enableCacheElement = false;
95
- var enableTransitionTracing = false; // No known bugs, but needs performance testing
86
+ var argsWithFormat = args.map(function (item) {
87
+ return String(item)
88
+ }) // Careful: RN currently depends on this prefix
96
89
 
97
- var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
98
- // stuff. Intended to enable React core members to more easily debug scheduling
99
- // issues in DEV builds.
90
+ argsWithFormat.unshift('Warning: ' + format) // We intentionally don't use spread (or .apply) directly because it
91
+ // breaks IE9: https://github.com/facebook/react/issues/13610
92
+ // eslint-disable-next-line react-internal/no-production-logging
100
93
 
101
- var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
94
+ Function.prototype.apply.call(console[level], console, argsWithFormat)
95
+ }
96
+ }
102
97
 
103
- var REACT_MODULE_REFERENCE;
98
+ // -----------------------------------------------------------------------------
104
99
 
105
- {
106
- REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
107
- }
100
+ var enableScopeAPI = false // Experimental Create Event Handle API.
101
+ var enableCacheElement = false
102
+ var enableTransitionTracing = false // No known bugs, but needs performance testing
108
103
 
109
- function isValidElementType(type) {
110
- if (typeof type === 'string' || typeof type === 'function') {
111
- return true;
112
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
104
+ var enableLegacyHidden = false // Enables unstable_avoidThisFallback feature in Fiber
105
+ // stuff. Intended to enable React core members to more easily debug scheduling
106
+ // issues in DEV builds.
113
107
 
108
+ var enableDebugTracing = false // Track which Fiber(s) schedule render work.
114
109
 
115
- if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
116
- return true;
117
- }
110
+ var REACT_MODULE_REFERENCE
118
111
 
119
- if (typeof type === 'object' && type !== null) {
120
- if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
121
- // types supported by any Flight configuration anywhere since
122
- // we don't know which Flight build this will end up being used
123
- // with.
124
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
125
- return true;
112
+ {
113
+ REACT_MODULE_REFERENCE = Symbol.for('react.module.reference')
126
114
  }
127
- }
128
-
129
- return false;
130
- }
131
115
 
132
- function getWrappedName(outerType, innerType, wrapperName) {
133
- var displayName = outerType.displayName;
116
+ function isValidElementType(type) {
117
+ if (typeof type === 'string' || typeof type === 'function') {
118
+ return true
119
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
120
+
121
+ if (
122
+ type === REACT_FRAGMENT_TYPE ||
123
+ type === REACT_PROFILER_TYPE ||
124
+ enableDebugTracing ||
125
+ type === REACT_STRICT_MODE_TYPE ||
126
+ type === REACT_SUSPENSE_TYPE ||
127
+ type === REACT_SUSPENSE_LIST_TYPE ||
128
+ enableLegacyHidden ||
129
+ type === REACT_OFFSCREEN_TYPE ||
130
+ enableScopeAPI ||
131
+ enableCacheElement ||
132
+ enableTransitionTracing
133
+ ) {
134
+ return true
135
+ }
134
136
 
135
- if (displayName) {
136
- return displayName;
137
- }
137
+ if (typeof type === 'object' && type !== null) {
138
+ if (
139
+ type.$$typeof === REACT_LAZY_TYPE ||
140
+ type.$$typeof === REACT_MEMO_TYPE ||
141
+ type.$$typeof === REACT_PROVIDER_TYPE ||
142
+ type.$$typeof === REACT_CONTEXT_TYPE ||
143
+ type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
144
+ // types supported by any Flight configuration anywhere since
145
+ // we don't know which Flight build this will end up being used
146
+ // with.
147
+ type.$$typeof === REACT_MODULE_REFERENCE ||
148
+ type.getModuleId !== undefined
149
+ ) {
150
+ return true
151
+ }
152
+ }
138
153
 
139
- var functionName = innerType.displayName || innerType.name || '';
140
- return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
141
- } // Keep in sync with react-reconciler/getComponentNameFromFiber
154
+ return false
155
+ }
142
156
 
157
+ function getWrappedName(outerType, innerType, wrapperName) {
158
+ var displayName = outerType.displayName
143
159
 
144
- function getContextName(type) {
145
- return type.displayName || 'Context';
146
- } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
160
+ if (displayName) {
161
+ return displayName
162
+ }
147
163
 
164
+ var functionName = innerType.displayName || innerType.name || ''
165
+ return functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName
166
+ } // Keep in sync with react-reconciler/getComponentNameFromFiber
148
167
 
149
- function getComponentNameFromType(type) {
150
- if (type == null) {
151
- // Host root, text node or just invalid type.
152
- return null;
153
- }
168
+ function getContextName(type) {
169
+ return type.displayName || 'Context'
170
+ } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
154
171
 
155
- {
156
- if (typeof type.tag === 'number') {
157
- error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
158
- }
159
- }
172
+ function getComponentNameFromType(type) {
173
+ if (type == null) {
174
+ // Host root, text node or just invalid type.
175
+ return null
176
+ }
160
177
 
161
- if (typeof type === 'function') {
162
- return type.displayName || type.name || null;
163
- }
178
+ {
179
+ if (typeof type.tag === 'number') {
180
+ error(
181
+ 'Received an unexpected object in getComponentNameFromType(). ' +
182
+ 'This is likely a bug in React. Please file an issue.'
183
+ )
184
+ }
185
+ }
164
186
 
165
- if (typeof type === 'string') {
166
- return type;
167
- }
187
+ if (typeof type === 'function') {
188
+ return type.displayName || type.name || null
189
+ }
168
190
 
169
- switch (type) {
170
- case REACT_FRAGMENT_TYPE:
171
- return 'Fragment';
191
+ if (typeof type === 'string') {
192
+ return type
193
+ }
172
194
 
173
- case REACT_PORTAL_TYPE:
174
- return 'Portal';
195
+ switch (type) {
196
+ case REACT_FRAGMENT_TYPE:
197
+ return 'Fragment'
175
198
 
176
- case REACT_PROFILER_TYPE:
177
- return 'Profiler';
199
+ case REACT_PORTAL_TYPE:
200
+ return 'Portal'
178
201
 
179
- case REACT_STRICT_MODE_TYPE:
180
- return 'StrictMode';
202
+ case REACT_PROFILER_TYPE:
203
+ return 'Profiler'
181
204
 
182
- case REACT_SUSPENSE_TYPE:
183
- return 'Suspense';
205
+ case REACT_STRICT_MODE_TYPE:
206
+ return 'StrictMode'
184
207
 
185
- case REACT_SUSPENSE_LIST_TYPE:
186
- return 'SuspenseList';
208
+ case REACT_SUSPENSE_TYPE:
209
+ return 'Suspense'
187
210
 
188
- }
211
+ case REACT_SUSPENSE_LIST_TYPE:
212
+ return 'SuspenseList'
213
+ }
189
214
 
190
- if (typeof type === 'object') {
191
- switch (type.$$typeof) {
192
- case REACT_CONTEXT_TYPE:
193
- var context = type;
194
- return getContextName(context) + '.Consumer';
215
+ if (typeof type === 'object') {
216
+ switch (type.$$typeof) {
217
+ case REACT_CONTEXT_TYPE:
218
+ var context = type
219
+ return getContextName(context) + '.Consumer'
195
220
 
196
- case REACT_PROVIDER_TYPE:
197
- var provider = type;
198
- return getContextName(provider._context) + '.Provider';
221
+ case REACT_PROVIDER_TYPE:
222
+ var provider = type
223
+ return getContextName(provider._context) + '.Provider'
199
224
 
200
- case REACT_FORWARD_REF_TYPE:
201
- return getWrappedName(type, type.render, 'ForwardRef');
225
+ case REACT_FORWARD_REF_TYPE:
226
+ return getWrappedName(type, type.render, 'ForwardRef')
202
227
 
203
- case REACT_MEMO_TYPE:
204
- var outerName = type.displayName || null;
228
+ case REACT_MEMO_TYPE:
229
+ var outerName = type.displayName || null
205
230
 
206
- if (outerName !== null) {
207
- return outerName;
208
- }
231
+ if (outerName !== null) {
232
+ return outerName
233
+ }
209
234
 
210
- return getComponentNameFromType(type.type) || 'Memo';
235
+ return getComponentNameFromType(type.type) || 'Memo'
211
236
 
212
- case REACT_LAZY_TYPE:
213
- {
214
- var lazyComponent = type;
215
- var payload = lazyComponent._payload;
216
- var init = lazyComponent._init;
237
+ case REACT_LAZY_TYPE: {
238
+ var lazyComponent = type
239
+ var payload = lazyComponent._payload
240
+ var init = lazyComponent._init
217
241
 
218
- try {
219
- return getComponentNameFromType(init(payload));
220
- } catch (x) {
221
- return null;
242
+ try {
243
+ return getComponentNameFromType(init(payload))
244
+ } catch (x) {
245
+ return null
246
+ }
222
247
  }
248
+
249
+ // eslint-disable-next-line no-fallthrough
223
250
  }
251
+ }
224
252
 
225
- // eslint-disable-next-line no-fallthrough
253
+ return null
226
254
  }
227
- }
228
255
 
229
- return null;
230
- }
256
+ var assign = Object.assign
257
+
258
+ // Helpers to patch console.logs to avoid logging during side-effect free
259
+ // replaying on render function. This currently only patches the object
260
+ // lazily which won't cover if the log function was extracted eagerly.
261
+ // We could also eagerly patch the method.
262
+ var disabledDepth = 0
263
+ var prevLog
264
+ var prevInfo
265
+ var prevWarn
266
+ var prevError
267
+ var prevGroup
268
+ var prevGroupCollapsed
269
+ var prevGroupEnd
270
+
271
+ function disabledLog() {}
272
+
273
+ disabledLog.__reactDisabledLog = true
274
+ function disableLogs() {
275
+ {
276
+ if (disabledDepth === 0) {
277
+ /* eslint-disable react-internal/no-production-logging */
278
+ prevLog = console.log
279
+ prevInfo = console.info
280
+ prevWarn = console.warn
281
+ prevError = console.error
282
+ prevGroup = console.group
283
+ prevGroupCollapsed = console.groupCollapsed
284
+ prevGroupEnd = console.groupEnd // https://github.com/facebook/react/issues/19099
285
+
286
+ var props = {
287
+ configurable: true,
288
+ enumerable: true,
289
+ value: disabledLog,
290
+ writable: true,
291
+ } // $FlowFixMe Flow thinks console is immutable.
292
+
293
+ Object.defineProperties(console, {
294
+ info: props,
295
+ log: props,
296
+ warn: props,
297
+ error: props,
298
+ group: props,
299
+ groupCollapsed: props,
300
+ groupEnd: props,
301
+ })
302
+ /* eslint-enable react-internal/no-production-logging */
303
+ }
231
304
 
232
- var assign = Object.assign;
233
-
234
- // Helpers to patch console.logs to avoid logging during side-effect free
235
- // replaying on render function. This currently only patches the object
236
- // lazily which won't cover if the log function was extracted eagerly.
237
- // We could also eagerly patch the method.
238
- var disabledDepth = 0;
239
- var prevLog;
240
- var prevInfo;
241
- var prevWarn;
242
- var prevError;
243
- var prevGroup;
244
- var prevGroupCollapsed;
245
- var prevGroupEnd;
246
-
247
- function disabledLog() {}
248
-
249
- disabledLog.__reactDisabledLog = true;
250
- function disableLogs() {
251
- {
252
- if (disabledDepth === 0) {
253
- /* eslint-disable react-internal/no-production-logging */
254
- prevLog = console.log;
255
- prevInfo = console.info;
256
- prevWarn = console.warn;
257
- prevError = console.error;
258
- prevGroup = console.group;
259
- prevGroupCollapsed = console.groupCollapsed;
260
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
261
-
262
- var props = {
263
- configurable: true,
264
- enumerable: true,
265
- value: disabledLog,
266
- writable: true
267
- }; // $FlowFixMe Flow thinks console is immutable.
268
-
269
- Object.defineProperties(console, {
270
- info: props,
271
- log: props,
272
- warn: props,
273
- error: props,
274
- group: props,
275
- groupCollapsed: props,
276
- groupEnd: props
277
- });
278
- /* eslint-enable react-internal/no-production-logging */
305
+ disabledDepth++
306
+ }
279
307
  }
308
+ function reenableLogs() {
309
+ {
310
+ disabledDepth--
311
+
312
+ if (disabledDepth === 0) {
313
+ /* eslint-disable react-internal/no-production-logging */
314
+ var props = {
315
+ configurable: true,
316
+ enumerable: true,
317
+ writable: true,
318
+ } // $FlowFixMe Flow thinks console is immutable.
319
+
320
+ Object.defineProperties(console, {
321
+ log: assign({}, props, {
322
+ value: prevLog,
323
+ }),
324
+ info: assign({}, props, {
325
+ value: prevInfo,
326
+ }),
327
+ warn: assign({}, props, {
328
+ value: prevWarn,
329
+ }),
330
+ error: assign({}, props, {
331
+ value: prevError,
332
+ }),
333
+ group: assign({}, props, {
334
+ value: prevGroup,
335
+ }),
336
+ groupCollapsed: assign({}, props, {
337
+ value: prevGroupCollapsed,
338
+ }),
339
+ groupEnd: assign({}, props, {
340
+ value: prevGroupEnd,
341
+ }),
342
+ })
343
+ /* eslint-enable react-internal/no-production-logging */
344
+ }
280
345
 
281
- disabledDepth++;
282
- }
283
- }
284
- function reenableLogs() {
285
- {
286
- disabledDepth--;
287
-
288
- if (disabledDepth === 0) {
289
- /* eslint-disable react-internal/no-production-logging */
290
- var props = {
291
- configurable: true,
292
- enumerable: true,
293
- writable: true
294
- }; // $FlowFixMe Flow thinks console is immutable.
295
-
296
- Object.defineProperties(console, {
297
- log: assign({}, props, {
298
- value: prevLog
299
- }),
300
- info: assign({}, props, {
301
- value: prevInfo
302
- }),
303
- warn: assign({}, props, {
304
- value: prevWarn
305
- }),
306
- error: assign({}, props, {
307
- value: prevError
308
- }),
309
- group: assign({}, props, {
310
- value: prevGroup
311
- }),
312
- groupCollapsed: assign({}, props, {
313
- value: prevGroupCollapsed
314
- }),
315
- groupEnd: assign({}, props, {
316
- value: prevGroupEnd
317
- })
318
- });
319
- /* eslint-enable react-internal/no-production-logging */
346
+ if (disabledDepth < 0) {
347
+ error(
348
+ 'disabledDepth fell below zero. ' +
349
+ 'This is a bug in React. Please file an issue.'
350
+ )
351
+ }
352
+ }
320
353
  }
321
354
 
322
- if (disabledDepth < 0) {
323
- error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
324
- }
325
- }
326
- }
355
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher
356
+ var prefix
357
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
358
+ {
359
+ if (prefix === undefined) {
360
+ // Extract the VM specific prefix used by each line.
361
+ try {
362
+ throw Error()
363
+ } catch (x) {
364
+ var match = x.stack.trim().match(/\n( *(at )?)/)
365
+ prefix = (match && match[1]) || ''
366
+ }
367
+ } // We use the prefix to ensure our stacks line up with native stack frames.
327
368
 
328
- var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
329
- var prefix;
330
- function describeBuiltInComponentFrame(name, source, ownerFn) {
331
- {
332
- if (prefix === undefined) {
333
- // Extract the VM specific prefix used by each line.
334
- try {
335
- throw Error();
336
- } catch (x) {
337
- var match = x.stack.trim().match(/\n( *(at )?)/);
338
- prefix = match && match[1] || '';
369
+ return '\n' + prefix + name
339
370
  }
340
- } // We use the prefix to ensure our stacks line up with native stack frames.
341
-
371
+ }
372
+ var reentry = false
373
+ var componentFrameCache
342
374
 
343
- return '\n' + prefix + name;
344
- }
345
- }
346
- var reentry = false;
347
- var componentFrameCache;
375
+ {
376
+ var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map
377
+ componentFrameCache = new PossiblyWeakMap()
378
+ }
348
379
 
349
- {
350
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
351
- componentFrameCache = new PossiblyWeakMap();
352
- }
380
+ function describeNativeComponentFrame(fn, construct) {
381
+ // If something asked for a stack inside a fake render, it should get ignored.
382
+ if (!fn || reentry) {
383
+ return ''
384
+ }
353
385
 
354
- function describeNativeComponentFrame(fn, construct) {
355
- // If something asked for a stack inside a fake render, it should get ignored.
356
- if ( !fn || reentry) {
357
- return '';
358
- }
386
+ {
387
+ var frame = componentFrameCache.get(fn)
359
388
 
360
- {
361
- var frame = componentFrameCache.get(fn);
389
+ if (frame !== undefined) {
390
+ return frame
391
+ }
392
+ }
362
393
 
363
- if (frame !== undefined) {
364
- return frame;
365
- }
366
- }
394
+ var control
395
+ reentry = true
396
+ var previousPrepareStackTrace = Error.prepareStackTrace // $FlowFixMe It does accept undefined.
367
397
 
368
- var control;
369
- reentry = true;
370
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
398
+ Error.prepareStackTrace = undefined
399
+ var previousDispatcher
371
400
 
372
- Error.prepareStackTrace = undefined;
373
- var previousDispatcher;
401
+ {
402
+ previousDispatcher = ReactCurrentDispatcher.current // Set the dispatcher in DEV because this might be call in the render function
403
+ // for warnings.
374
404
 
375
- {
376
- previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
377
- // for warnings.
405
+ ReactCurrentDispatcher.current = null
406
+ disableLogs()
407
+ }
378
408
 
379
- ReactCurrentDispatcher.current = null;
380
- disableLogs();
381
- }
409
+ try {
410
+ // This should throw.
411
+ if (construct) {
412
+ // Something should be setting the props in the constructor.
413
+ var Fake = function () {
414
+ throw Error()
415
+ } // $FlowFixMe
416
+
417
+ Object.defineProperty(Fake.prototype, 'props', {
418
+ set: function () {
419
+ // We use a throwing setter instead of frozen or non-writable props
420
+ // because that won't throw in a non-strict mode function.
421
+ throw Error()
422
+ },
423
+ })
424
+
425
+ if (typeof Reflect === 'object' && Reflect.construct) {
426
+ // We construct a different control for this case to include any extra
427
+ // frames added by the construct call.
428
+ try {
429
+ Reflect.construct(Fake, [])
430
+ } catch (x) {
431
+ control = x
432
+ }
382
433
 
383
- try {
384
- // This should throw.
385
- if (construct) {
386
- // Something should be setting the props in the constructor.
387
- var Fake = function () {
388
- throw Error();
389
- }; // $FlowFixMe
434
+ Reflect.construct(fn, [], Fake)
435
+ } else {
436
+ try {
437
+ Fake.call()
438
+ } catch (x) {
439
+ control = x
440
+ }
390
441
 
442
+ fn.call(Fake.prototype)
443
+ }
444
+ } else {
445
+ try {
446
+ throw Error()
447
+ } catch (x) {
448
+ control = x
449
+ }
391
450
 
392
- Object.defineProperty(Fake.prototype, 'props', {
393
- set: function () {
394
- // We use a throwing setter instead of frozen or non-writable props
395
- // because that won't throw in a non-strict mode function.
396
- throw Error();
451
+ fn()
397
452
  }
398
- });
453
+ } catch (sample) {
454
+ // This is inlined manually because closure doesn't do it for us.
455
+ if (sample && control && typeof sample.stack === 'string') {
456
+ // This extracts the first frame from the sample that isn't also in the control.
457
+ // Skipping one frame that we assume is the frame that calls the two.
458
+ var sampleLines = sample.stack.split('\n')
459
+ var controlLines = control.stack.split('\n')
460
+ var s = sampleLines.length - 1
461
+ var c = controlLines.length - 1
462
+
463
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
464
+ // We expect at least one stack frame to be shared.
465
+ // Typically this will be the root most one. However, stack frames may be
466
+ // cut off due to maximum stack limits. In this case, one maybe cut off
467
+ // earlier than the other. We assume that the sample is longer or the same
468
+ // and there for cut off earlier. So we should find the root most frame in
469
+ // the sample somewhere in the control.
470
+ c--
471
+ }
399
472
 
400
- if (typeof Reflect === 'object' && Reflect.construct) {
401
- // We construct a different control for this case to include any extra
402
- // frames added by the construct call.
403
- try {
404
- Reflect.construct(Fake, []);
405
- } catch (x) {
406
- control = x;
407
- }
473
+ for (; s >= 1 && c >= 0; s--, c--) {
474
+ // Next we find the first one that isn't the same which should be the
475
+ // frame that called our sample function and the control.
476
+ if (sampleLines[s] !== controlLines[c]) {
477
+ // In V8, the first line is describing the message but other VMs don't.
478
+ // If we're about to return the first line, and the control is also on the same
479
+ // line, that's a pretty good indicator that our sample threw at same line as
480
+ // the control. I.e. before we entered the sample frame. So we ignore this result.
481
+ // This can happen if you passed a class to function component, or non-function.
482
+ if (s !== 1 || c !== 1) {
483
+ do {
484
+ s--
485
+ c-- // We may still have similar intermediate frames from the construct call.
486
+ // The next one that isn't the same should be our match though.
487
+
488
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
489
+ // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
490
+ var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ') // If our component frame is labeled "<anonymous>"
491
+ // but we have a user-provided "displayName"
492
+ // splice it in to make the stack more readable.
493
+
494
+ if (fn.displayName && _frame.includes('<anonymous>')) {
495
+ _frame = _frame.replace('<anonymous>', fn.displayName)
496
+ }
497
+
498
+ {
499
+ if (typeof fn === 'function') {
500
+ componentFrameCache.set(fn, _frame)
501
+ }
502
+ } // Return the line we found.
503
+
504
+ return _frame
505
+ }
506
+ } while (s >= 1 && c >= 0)
507
+ }
408
508
 
409
- Reflect.construct(fn, [], Fake);
410
- } else {
411
- try {
412
- Fake.call();
413
- } catch (x) {
414
- control = x;
509
+ break
510
+ }
511
+ }
415
512
  }
513
+ } finally {
514
+ reentry = false
416
515
 
417
- fn.call(Fake.prototype);
418
- }
419
- } else {
420
- try {
421
- throw Error();
422
- } catch (x) {
423
- control = x;
424
- }
425
-
426
- fn();
427
- }
428
- } catch (sample) {
429
- // This is inlined manually because closure doesn't do it for us.
430
- if (sample && control && typeof sample.stack === 'string') {
431
- // This extracts the first frame from the sample that isn't also in the control.
432
- // Skipping one frame that we assume is the frame that calls the two.
433
- var sampleLines = sample.stack.split('\n');
434
- var controlLines = control.stack.split('\n');
435
- var s = sampleLines.length - 1;
436
- var c = controlLines.length - 1;
437
-
438
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
439
- // We expect at least one stack frame to be shared.
440
- // Typically this will be the root most one. However, stack frames may be
441
- // cut off due to maximum stack limits. In this case, one maybe cut off
442
- // earlier than the other. We assume that the sample is longer or the same
443
- // and there for cut off earlier. So we should find the root most frame in
444
- // the sample somewhere in the control.
445
- c--;
446
- }
447
-
448
- for (; s >= 1 && c >= 0; s--, c--) {
449
- // Next we find the first one that isn't the same which should be the
450
- // frame that called our sample function and the control.
451
- if (sampleLines[s] !== controlLines[c]) {
452
- // In V8, the first line is describing the message but other VMs don't.
453
- // If we're about to return the first line, and the control is also on the same
454
- // line, that's a pretty good indicator that our sample threw at same line as
455
- // the control. I.e. before we entered the sample frame. So we ignore this result.
456
- // This can happen if you passed a class to function component, or non-function.
457
- if (s !== 1 || c !== 1) {
458
- do {
459
- s--;
460
- c--; // We may still have similar intermediate frames from the construct call.
461
- // The next one that isn't the same should be our match though.
462
-
463
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
464
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
465
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
466
- // but we have a user-provided "displayName"
467
- // splice it in to make the stack more readable.
468
-
469
-
470
- if (fn.displayName && _frame.includes('<anonymous>')) {
471
- _frame = _frame.replace('<anonymous>', fn.displayName);
472
- }
473
-
474
- {
475
- if (typeof fn === 'function') {
476
- componentFrameCache.set(fn, _frame);
477
- }
478
- } // Return the line we found.
516
+ {
517
+ ReactCurrentDispatcher.current = previousDispatcher
518
+ reenableLogs()
519
+ }
479
520
 
521
+ Error.prepareStackTrace = previousPrepareStackTrace
522
+ } // Fallback to just using the name if we couldn't make it throw.
480
523
 
481
- return _frame;
482
- }
483
- } while (s >= 1 && c >= 0);
484
- }
524
+ var name = fn ? fn.displayName || fn.name : ''
525
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''
485
526
 
486
- break;
527
+ {
528
+ if (typeof fn === 'function') {
529
+ componentFrameCache.set(fn, syntheticFrame)
487
530
  }
488
531
  }
489
- }
490
- } finally {
491
- reentry = false;
492
532
 
493
- {
494
- ReactCurrentDispatcher.current = previousDispatcher;
495
- reenableLogs();
533
+ return syntheticFrame
496
534
  }
497
-
498
- Error.prepareStackTrace = previousPrepareStackTrace;
499
- } // Fallback to just using the name if we couldn't make it throw.
500
-
501
-
502
- var name = fn ? fn.displayName || fn.name : '';
503
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
504
-
505
- {
506
- if (typeof fn === 'function') {
507
- componentFrameCache.set(fn, syntheticFrame);
535
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
536
+ {
537
+ return describeNativeComponentFrame(fn, false)
538
+ }
508
539
  }
509
- }
510
-
511
- return syntheticFrame;
512
- }
513
- function describeFunctionComponentFrame(fn, source, ownerFn) {
514
- {
515
- return describeNativeComponentFrame(fn, false);
516
- }
517
- }
518
-
519
- function shouldConstruct(Component) {
520
- var prototype = Component.prototype;
521
- return !!(prototype && prototype.isReactComponent);
522
- }
523
540
 
524
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
525
-
526
- if (type == null) {
527
- return '';
528
- }
529
-
530
- if (typeof type === 'function') {
531
- {
532
- return describeNativeComponentFrame(type, shouldConstruct(type));
541
+ function shouldConstruct(Component) {
542
+ var prototype = Component.prototype
543
+ return !!(prototype && prototype.isReactComponent)
533
544
  }
534
- }
535
-
536
- if (typeof type === 'string') {
537
- return describeBuiltInComponentFrame(type);
538
- }
539
-
540
- switch (type) {
541
- case REACT_SUSPENSE_TYPE:
542
- return describeBuiltInComponentFrame('Suspense');
543
545
 
544
- case REACT_SUSPENSE_LIST_TYPE:
545
- return describeBuiltInComponentFrame('SuspenseList');
546
- }
547
-
548
- if (typeof type === 'object') {
549
- switch (type.$$typeof) {
550
- case REACT_FORWARD_REF_TYPE:
551
- return describeFunctionComponentFrame(type.render);
552
-
553
- case REACT_MEMO_TYPE:
554
- // Memo may contain any component type so we recursively resolve it.
555
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
546
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
547
+ if (type == null) {
548
+ return ''
549
+ }
556
550
 
557
- case REACT_LAZY_TYPE:
551
+ if (typeof type === 'function') {
558
552
  {
559
- var lazyComponent = type;
560
- var payload = lazyComponent._payload;
561
- var init = lazyComponent._init;
562
-
563
- try {
564
- // Lazy may contain any component type so we recursively resolve it.
565
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
566
- } catch (x) {}
553
+ return describeNativeComponentFrame(type, shouldConstruct(type))
567
554
  }
568
- }
569
- }
555
+ }
570
556
 
571
- return '';
572
- }
557
+ if (typeof type === 'string') {
558
+ return describeBuiltInComponentFrame(type)
559
+ }
573
560
 
574
- var hasOwnProperty = Object.prototype.hasOwnProperty;
561
+ switch (type) {
562
+ case REACT_SUSPENSE_TYPE:
563
+ return describeBuiltInComponentFrame('Suspense')
575
564
 
576
- var loggedTypeFailures = {};
577
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
565
+ case REACT_SUSPENSE_LIST_TYPE:
566
+ return describeBuiltInComponentFrame('SuspenseList')
567
+ }
578
568
 
579
- function setCurrentlyValidatingElement(element) {
580
- {
581
- if (element) {
582
- var owner = element._owner;
583
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
584
- ReactDebugCurrentFrame.setExtraStackFrame(stack);
585
- } else {
586
- ReactDebugCurrentFrame.setExtraStackFrame(null);
587
- }
588
- }
589
- }
569
+ if (typeof type === 'object') {
570
+ switch (type.$$typeof) {
571
+ case REACT_FORWARD_REF_TYPE:
572
+ return describeFunctionComponentFrame(type.render)
590
573
 
591
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
592
- {
593
- // $FlowFixMe This is okay but Flow doesn't know it.
594
- var has = Function.call.bind(hasOwnProperty);
574
+ case REACT_MEMO_TYPE:
575
+ // Memo may contain any component type so we recursively resolve it.
576
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn)
595
577
 
596
- for (var typeSpecName in typeSpecs) {
597
- if (has(typeSpecs, typeSpecName)) {
598
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
599
- // fail the render phase where it didn't fail before. So we log it.
600
- // After these have been cleaned up, we'll let them throw.
578
+ case REACT_LAZY_TYPE: {
579
+ var lazyComponent = type
580
+ var payload = lazyComponent._payload
581
+ var init = lazyComponent._init
601
582
 
602
- try {
603
- // This is intentionally an invariant that gets caught. It's the same
604
- // behavior as without this statement except with a better message.
605
- if (typeof typeSpecs[typeSpecName] !== 'function') {
606
- // eslint-disable-next-line react-internal/prod-error-codes
607
- var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
608
- err.name = 'Invariant Violation';
609
- throw err;
583
+ try {
584
+ // Lazy may contain any component type so we recursively resolve it.
585
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn)
586
+ } catch (x) {}
610
587
  }
611
-
612
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
613
- } catch (ex) {
614
- error$1 = ex;
615
588
  }
589
+ }
616
590
 
617
- if (error$1 && !(error$1 instanceof Error)) {
618
- setCurrentlyValidatingElement(element);
619
-
620
- error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
621
-
622
- setCurrentlyValidatingElement(null);
623
- }
591
+ return ''
592
+ }
624
593
 
625
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
626
- // Only monitor this failure once because there tends to be a lot of the
627
- // same error.
628
- loggedTypeFailures[error$1.message] = true;
629
- setCurrentlyValidatingElement(element);
594
+ var hasOwnProperty = Object.prototype.hasOwnProperty
630
595
 
631
- error('Failed %s type: %s', location, error$1.message);
596
+ var loggedTypeFailures = {}
597
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame
632
598
 
633
- setCurrentlyValidatingElement(null);
599
+ function setCurrentlyValidatingElement(element) {
600
+ {
601
+ if (element) {
602
+ var owner = element._owner
603
+ var stack = describeUnknownElementTypeFrameInDEV(
604
+ element.type,
605
+ element._source,
606
+ owner ? owner.type : null
607
+ )
608
+ ReactDebugCurrentFrame.setExtraStackFrame(stack)
609
+ } else {
610
+ ReactDebugCurrentFrame.setExtraStackFrame(null)
634
611
  }
635
612
  }
636
613
  }
637
- }
638
- }
639
614
 
640
- var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
641
-
642
- function isArray(a) {
643
- return isArrayImpl(a);
644
- }
645
-
646
- /*
647
- * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
648
- * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
649
- *
650
- * The functions in this module will throw an easier-to-understand,
651
- * easier-to-debug exception with a clear errors message message explaining the
652
- * problem. (Instead of a confusing exception thrown inside the implementation
653
- * of the `value` object).
654
- */
655
- // $FlowFixMe only called in DEV, so void return is not possible.
656
- function typeName(value) {
657
- {
658
- // toStringTag is needed for namespaced types like Temporal.Instant
659
- var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
660
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
661
- return type;
662
- }
663
- } // $FlowFixMe only called in DEV, so void return is not possible.
664
-
665
-
666
- function willCoercionThrow(value) {
667
- {
668
- try {
669
- testStringCoercion(value);
670
- return false;
671
- } catch (e) {
672
- return true;
673
- }
674
- }
675
- }
615
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
616
+ {
617
+ // $FlowFixMe This is okay but Flow doesn't know it.
618
+ var has = Function.call.bind(hasOwnProperty)
619
+
620
+ for (var typeSpecName in typeSpecs) {
621
+ if (has(typeSpecs, typeSpecName)) {
622
+ var error$1 = void 0 // Prop type validation may throw. In case they do, we don't want to
623
+ // fail the render phase where it didn't fail before. So we log it.
624
+ // After these have been cleaned up, we'll let them throw.
625
+
626
+ try {
627
+ // This is intentionally an invariant that gets caught. It's the same
628
+ // behavior as without this statement except with a better message.
629
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
630
+ // eslint-disable-next-line react-internal/prod-error-codes
631
+ var err = Error(
632
+ (componentName || 'React class') +
633
+ ': ' +
634
+ location +
635
+ ' type `' +
636
+ typeSpecName +
637
+ '` is invalid; ' +
638
+ 'it must be a function, usually from the `prop-types` package, but received `' +
639
+ typeof typeSpecs[typeSpecName] +
640
+ '`.' +
641
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
642
+ )
643
+ err.name = 'Invariant Violation'
644
+ throw err
645
+ }
676
646
 
677
- function testStringCoercion(value) {
678
- // If you ended up here by following an exception call stack, here's what's
679
- // happened: you supplied an object or symbol value to React (as a prop, key,
680
- // DOM attribute, CSS property, string ref, etc.) and when React tried to
681
- // coerce it to a string using `'' + value`, an exception was thrown.
682
- //
683
- // The most common types that will cause this exception are `Symbol` instances
684
- // and Temporal objects like `Temporal.Instant`. But any object that has a
685
- // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
686
- // exception. (Library authors do this to prevent users from using built-in
687
- // numeric operators like `+` or comparison operators like `>=` because custom
688
- // methods are needed to perform accurate arithmetic or comparison.)
689
- //
690
- // To fix the problem, coerce this object or symbol value to a string before
691
- // passing it to React. The most reliable way is usually `String(value)`.
692
- //
693
- // To find which value is throwing, check the browser or debugger console.
694
- // Before this exception was thrown, there should be `console.error` output
695
- // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
696
- // problem and how that type was used: key, atrribute, input value prop, etc.
697
- // In most cases, this console output also shows the component and its
698
- // ancestor components where the exception happened.
699
- //
700
- // eslint-disable-next-line react-internal/safe-string-coercion
701
- return '' + value;
702
- }
703
- function checkKeyStringCoercion(value) {
704
- {
705
- if (willCoercionThrow(value)) {
706
- error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
647
+ error$1 = typeSpecs[typeSpecName](
648
+ values,
649
+ typeSpecName,
650
+ componentName,
651
+ location,
652
+ null,
653
+ 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
654
+ )
655
+ } catch (ex) {
656
+ error$1 = ex
657
+ }
707
658
 
708
- return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
709
- }
710
- }
711
- }
659
+ if (error$1 && !(error$1 instanceof Error)) {
660
+ setCurrentlyValidatingElement(element)
661
+
662
+ error(
663
+ '%s: type specification of %s' +
664
+ ' `%s` is invalid; the type checker ' +
665
+ 'function must return `null` or an `Error` but returned a %s. ' +
666
+ 'You may have forgotten to pass an argument to the type checker ' +
667
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
668
+ 'shape all require an argument).',
669
+ componentName || 'React class',
670
+ location,
671
+ typeSpecName,
672
+ typeof error$1
673
+ )
674
+
675
+ setCurrentlyValidatingElement(null)
676
+ }
712
677
 
713
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
714
- var RESERVED_PROPS = {
715
- key: true,
716
- ref: true,
717
- __self: true,
718
- __source: true
719
- };
720
- var specialPropKeyWarningShown;
721
- var specialPropRefWarningShown;
722
- var didWarnAboutStringRefs;
723
-
724
- {
725
- didWarnAboutStringRefs = {};
726
- }
678
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
679
+ // Only monitor this failure once because there tends to be a lot of the
680
+ // same error.
681
+ loggedTypeFailures[error$1.message] = true
682
+ setCurrentlyValidatingElement(element)
727
683
 
728
- function hasValidRef(config) {
729
- {
730
- if (hasOwnProperty.call(config, 'ref')) {
731
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
684
+ error('Failed %s type: %s', location, error$1.message)
732
685
 
733
- if (getter && getter.isReactWarning) {
734
- return false;
686
+ setCurrentlyValidatingElement(null)
687
+ }
688
+ }
689
+ }
735
690
  }
736
691
  }
737
- }
738
-
739
- return config.ref !== undefined;
740
- }
741
692
 
742
- function hasValidKey(config) {
743
- {
744
- if (hasOwnProperty.call(config, 'key')) {
745
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
693
+ var isArrayImpl = Array.isArray // eslint-disable-next-line no-redeclare
746
694
 
747
- if (getter && getter.isReactWarning) {
748
- return false;
749
- }
695
+ function isArray(a) {
696
+ return isArrayImpl(a)
750
697
  }
751
- }
752
-
753
- return config.key !== undefined;
754
- }
755
-
756
- function warnIfStringRefCannotBeAutoConverted(config, self) {
757
- {
758
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
759
- var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
760
-
761
- if (!didWarnAboutStringRefs[componentName]) {
762
- error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
763
698
 
764
- didWarnAboutStringRefs[componentName] = true;
699
+ /*
700
+ * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
701
+ * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
702
+ *
703
+ * The functions in this module will throw an easier-to-understand,
704
+ * easier-to-debug exception with a clear errors message message explaining the
705
+ * problem. (Instead of a confusing exception thrown inside the implementation
706
+ * of the `value` object).
707
+ */
708
+ // $FlowFixMe only called in DEV, so void return is not possible.
709
+ function typeName(value) {
710
+ {
711
+ // toStringTag is needed for namespaced types like Temporal.Instant
712
+ var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag
713
+ var type =
714
+ (hasToStringTag && value[Symbol.toStringTag]) ||
715
+ value.constructor.name ||
716
+ 'Object'
717
+ return type
765
718
  }
766
- }
767
- }
768
- }
719
+ } // $FlowFixMe only called in DEV, so void return is not possible.
769
720
 
770
- function defineKeyPropWarningGetter(props, displayName) {
771
- {
772
- var warnAboutAccessingKey = function () {
773
- if (!specialPropKeyWarningShown) {
774
- specialPropKeyWarningShown = true;
775
-
776
- error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
721
+ function willCoercionThrow(value) {
722
+ {
723
+ try {
724
+ testStringCoercion(value)
725
+ return false
726
+ } catch (e) {
727
+ return true
728
+ }
777
729
  }
778
- };
779
-
780
- warnAboutAccessingKey.isReactWarning = true;
781
- Object.defineProperty(props, 'key', {
782
- get: warnAboutAccessingKey,
783
- configurable: true
784
- });
785
- }
786
- }
787
-
788
- function defineRefPropWarningGetter(props, displayName) {
789
- {
790
- var warnAboutAccessingRef = function () {
791
- if (!specialPropRefWarningShown) {
792
- specialPropRefWarningShown = true;
730
+ }
793
731
 
794
- error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
732
+ function testStringCoercion(value) {
733
+ // If you ended up here by following an exception call stack, here's what's
734
+ // happened: you supplied an object or symbol value to React (as a prop, key,
735
+ // DOM attribute, CSS property, string ref, etc.) and when React tried to
736
+ // coerce it to a string using `'' + value`, an exception was thrown.
737
+ //
738
+ // The most common types that will cause this exception are `Symbol` instances
739
+ // and Temporal objects like `Temporal.Instant`. But any object that has a
740
+ // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
741
+ // exception. (Library authors do this to prevent users from using built-in
742
+ // numeric operators like `+` or comparison operators like `>=` because custom
743
+ // methods are needed to perform accurate arithmetic or comparison.)
744
+ //
745
+ // To fix the problem, coerce this object or symbol value to a string before
746
+ // passing it to React. The most reliable way is usually `String(value)`.
747
+ //
748
+ // To find which value is throwing, check the browser or debugger console.
749
+ // Before this exception was thrown, there should be `console.error` output
750
+ // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
751
+ // problem and how that type was used: key, atrribute, input value prop, etc.
752
+ // In most cases, this console output also shows the component and its
753
+ // ancestor components where the exception happened.
754
+ //
755
+ // eslint-disable-next-line react-internal/safe-string-coercion
756
+ return '' + value
757
+ }
758
+ function checkKeyStringCoercion(value) {
759
+ {
760
+ if (willCoercionThrow(value)) {
761
+ error(
762
+ 'The provided key is an unsupported type %s.' +
763
+ ' This value must be coerced to a string before before using it here.',
764
+ typeName(value)
765
+ )
766
+
767
+ return testStringCoercion(value) // throw (to help callers find troubleshooting comments)
768
+ }
795
769
  }
796
- };
797
-
798
- warnAboutAccessingRef.isReactWarning = true;
799
- Object.defineProperty(props, 'ref', {
800
- get: warnAboutAccessingRef,
801
- configurable: true
802
- });
803
- }
804
- }
805
- /**
806
- * Factory method to create a new React element. This no longer adheres to
807
- * the class pattern, so do not use new to call it. Also, instanceof check
808
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
809
- * if something is a React Element.
810
- *
811
- * @param {*} type
812
- * @param {*} props
813
- * @param {*} key
814
- * @param {string|object} ref
815
- * @param {*} owner
816
- * @param {*} self A *temporary* helper to detect places where `this` is
817
- * different from the `owner` when React.createElement is called, so that we
818
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
819
- * functions, and as long as `this` and owner are the same, there will be no
820
- * change in behavior.
821
- * @param {*} source An annotation object (added by a transpiler or otherwise)
822
- * indicating filename, line number, and/or other information.
823
- * @internal
824
- */
770
+ }
825
771
 
772
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner
773
+ var RESERVED_PROPS = {
774
+ key: true,
775
+ ref: true,
776
+ __self: true,
777
+ __source: true,
778
+ }
779
+ var specialPropKeyWarningShown
780
+ var specialPropRefWarningShown
781
+ var didWarnAboutStringRefs
826
782
 
827
- var ReactElement = function (type, key, ref, self, source, owner, props) {
828
- var element = {
829
- // This tag allows us to uniquely identify this as a React Element
830
- $$typeof: REACT_ELEMENT_TYPE,
831
- // Built-in properties that belong on the element
832
- type: type,
833
- key: key,
834
- ref: ref,
835
- props: props,
836
- // Record the component responsible for creating this element.
837
- _owner: owner
838
- };
839
-
840
- {
841
- // The validation flag is currently mutative. We put it on
842
- // an external backing store so that we can freeze the whole object.
843
- // This can be replaced with a WeakMap once they are implemented in
844
- // commonly used development environments.
845
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
846
- // the validation flag non-enumerable (where possible, which should
847
- // include every environment we run tests in), so the test framework
848
- // ignores it.
849
-
850
- Object.defineProperty(element._store, 'validated', {
851
- configurable: false,
852
- enumerable: false,
853
- writable: true,
854
- value: false
855
- }); // self and source are DEV only properties.
856
-
857
- Object.defineProperty(element, '_self', {
858
- configurable: false,
859
- enumerable: false,
860
- writable: false,
861
- value: self
862
- }); // Two elements created in two different places should be considered
863
- // equal for testing purposes and therefore we hide it from enumeration.
864
-
865
- Object.defineProperty(element, '_source', {
866
- configurable: false,
867
- enumerable: false,
868
- writable: false,
869
- value: source
870
- });
871
-
872
- if (Object.freeze) {
873
- Object.freeze(element.props);
874
- Object.freeze(element);
783
+ {
784
+ didWarnAboutStringRefs = {}
875
785
  }
876
- }
877
786
 
878
- return element;
879
- };
880
- /**
881
- * https://github.com/reactjs/rfcs/pull/107
882
- * @param {*} type
883
- * @param {object} props
884
- * @param {string} key
885
- */
787
+ function hasValidRef(config) {
788
+ {
789
+ if (hasOwnProperty.call(config, 'ref')) {
790
+ var getter = Object.getOwnPropertyDescriptor(config, 'ref').get
886
791
 
887
- function jsxDEV(type, config, maybeKey, source, self) {
888
- {
889
- var propName; // Reserved names are extracted
792
+ if (getter && getter.isReactWarning) {
793
+ return false
794
+ }
795
+ }
796
+ }
890
797
 
891
- var props = {};
892
- var key = null;
893
- var ref = null; // Currently, key can be spread in as a prop. This causes a potential
894
- // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
895
- // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
896
- // but as an intermediary step, we will use jsxDEV for everything except
897
- // <div {...props} key="Hi" />, because we aren't currently able to tell if
898
- // key is explicitly declared to be undefined or not.
798
+ return config.ref !== undefined
799
+ }
899
800
 
900
- if (maybeKey !== undefined) {
801
+ function hasValidKey(config) {
901
802
  {
902
- checkKeyStringCoercion(maybeKey);
803
+ if (hasOwnProperty.call(config, 'key')) {
804
+ var getter = Object.getOwnPropertyDescriptor(config, 'key').get
805
+
806
+ if (getter && getter.isReactWarning) {
807
+ return false
808
+ }
809
+ }
903
810
  }
904
811
 
905
- key = '' + maybeKey;
812
+ return config.key !== undefined
906
813
  }
907
814
 
908
- if (hasValidKey(config)) {
815
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
909
816
  {
910
- checkKeyStringCoercion(config.key);
817
+ if (
818
+ typeof config.ref === 'string' &&
819
+ ReactCurrentOwner.current &&
820
+ self &&
821
+ ReactCurrentOwner.current.stateNode !== self
822
+ ) {
823
+ var componentName = getComponentNameFromType(ReactCurrentOwner.current.type)
824
+
825
+ if (!didWarnAboutStringRefs[componentName]) {
826
+ error(
827
+ 'Component "%s" contains the string ref "%s". ' +
828
+ 'Support for string refs will be removed in a future major release. ' +
829
+ 'This case cannot be automatically converted to an arrow function. ' +
830
+ 'We ask you to manually fix this case by using useRef() or createRef() instead. ' +
831
+ 'Learn more about using refs safely here: ' +
832
+ 'https://reactjs.org/link/strict-mode-string-ref',
833
+ getComponentNameFromType(ReactCurrentOwner.current.type),
834
+ config.ref
835
+ )
836
+
837
+ didWarnAboutStringRefs[componentName] = true
838
+ }
839
+ }
911
840
  }
912
-
913
- key = '' + config.key;
914
841
  }
915
842
 
916
- if (hasValidRef(config)) {
917
- ref = config.ref;
918
- warnIfStringRefCannotBeAutoConverted(config, self);
919
- } // Remaining properties are added to a new props object
920
-
843
+ function defineKeyPropWarningGetter(props, displayName) {
844
+ {
845
+ var warnAboutAccessingKey = function () {
846
+ if (!specialPropKeyWarningShown) {
847
+ specialPropKeyWarningShown = true
848
+
849
+ error(
850
+ '%s: `key` is not a prop. Trying to access it will result ' +
851
+ 'in `undefined` being returned. If you need to access the same ' +
852
+ 'value within the child component, you should pass it as a different ' +
853
+ 'prop. (https://reactjs.org/link/special-props)',
854
+ displayName
855
+ )
856
+ }
857
+ }
921
858
 
922
- for (propName in config) {
923
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
924
- props[propName] = config[propName];
859
+ warnAboutAccessingKey.isReactWarning = true
860
+ Object.defineProperty(props, 'key', {
861
+ get: warnAboutAccessingKey,
862
+ configurable: true,
863
+ })
925
864
  }
926
- } // Resolve default props
927
-
928
-
929
- if (type && type.defaultProps) {
930
- var defaultProps = type.defaultProps;
865
+ }
931
866
 
932
- for (propName in defaultProps) {
933
- if (props[propName] === undefined) {
934
- props[propName] = defaultProps[propName];
867
+ function defineRefPropWarningGetter(props, displayName) {
868
+ {
869
+ var warnAboutAccessingRef = function () {
870
+ if (!specialPropRefWarningShown) {
871
+ specialPropRefWarningShown = true
872
+
873
+ error(
874
+ '%s: `ref` is not a prop. Trying to access it will result ' +
875
+ 'in `undefined` being returned. If you need to access the same ' +
876
+ 'value within the child component, you should pass it as a different ' +
877
+ 'prop. (https://reactjs.org/link/special-props)',
878
+ displayName
879
+ )
880
+ }
935
881
  }
882
+
883
+ warnAboutAccessingRef.isReactWarning = true
884
+ Object.defineProperty(props, 'ref', {
885
+ get: warnAboutAccessingRef,
886
+ configurable: true,
887
+ })
936
888
  }
937
889
  }
890
+ /**
891
+ * Factory method to create a new React element. This no longer adheres to
892
+ * the class pattern, so do not use new to call it. Also, instanceof check
893
+ * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
894
+ * if something is a React Element.
895
+ *
896
+ * @param {*} type
897
+ * @param {*} props
898
+ * @param {*} key
899
+ * @param {string|object} ref
900
+ * @param {*} owner
901
+ * @param {*} self A *temporary* helper to detect places where `this` is
902
+ * different from the `owner` when React.createElement is called, so that we
903
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
904
+ * functions, and as long as `this` and owner are the same, there will be no
905
+ * change in behavior.
906
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
907
+ * indicating filename, line number, and/or other information.
908
+ * @internal
909
+ */
910
+
911
+ var ReactElement = function (type, key, ref, self, source, owner, props) {
912
+ var element = {
913
+ // This tag allows us to uniquely identify this as a React Element
914
+ $$typeof: REACT_ELEMENT_TYPE,
915
+ // Built-in properties that belong on the element
916
+ type: type,
917
+ key: key,
918
+ ref: ref,
919
+ props: props,
920
+ // Record the component responsible for creating this element.
921
+ _owner: owner,
922
+ }
938
923
 
939
- if (key || ref) {
940
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
924
+ {
925
+ // The validation flag is currently mutative. We put it on
926
+ // an external backing store so that we can freeze the whole object.
927
+ // This can be replaced with a WeakMap once they are implemented in
928
+ // commonly used development environments.
929
+ element._store = {} // To make comparing ReactElements easier for testing purposes, we make
930
+ // the validation flag non-enumerable (where possible, which should
931
+ // include every environment we run tests in), so the test framework
932
+ // ignores it.
933
+
934
+ Object.defineProperty(element._store, 'validated', {
935
+ configurable: false,
936
+ enumerable: false,
937
+ writable: true,
938
+ value: false,
939
+ }) // self and source are DEV only properties.
940
+
941
+ Object.defineProperty(element, '_self', {
942
+ configurable: false,
943
+ enumerable: false,
944
+ writable: false,
945
+ value: self,
946
+ }) // Two elements created in two different places should be considered
947
+ // equal for testing purposes and therefore we hide it from enumeration.
948
+
949
+ Object.defineProperty(element, '_source', {
950
+ configurable: false,
951
+ enumerable: false,
952
+ writable: false,
953
+ value: source,
954
+ })
941
955
 
942
- if (key) {
943
- defineKeyPropWarningGetter(props, displayName);
956
+ if (Object.freeze) {
957
+ Object.freeze(element.props)
958
+ Object.freeze(element)
959
+ }
944
960
  }
945
961
 
946
- if (ref) {
947
- defineRefPropWarningGetter(props, displayName);
948
- }
962
+ return element
949
963
  }
964
+ /**
965
+ * https://github.com/reactjs/rfcs/pull/107
966
+ * @param {*} type
967
+ * @param {object} props
968
+ * @param {string} key
969
+ */
970
+
971
+ function jsxDEV(type, config, maybeKey, source, self) {
972
+ {
973
+ var propName // Reserved names are extracted
974
+
975
+ var props = {}
976
+ var key = null
977
+ var ref = null // Currently, key can be spread in as a prop. This causes a potential
978
+ // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
979
+ // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
980
+ // but as an intermediary step, we will use jsxDEV for everything except
981
+ // <div {...props} key="Hi" />, because we aren't currently able to tell if
982
+ // key is explicitly declared to be undefined or not.
983
+
984
+ if (maybeKey !== undefined) {
985
+ {
986
+ checkKeyStringCoercion(maybeKey)
987
+ }
950
988
 
951
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
952
- }
953
- }
989
+ key = '' + maybeKey
990
+ }
954
991
 
955
- var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
956
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
957
-
958
- function setCurrentlyValidatingElement$1(element) {
959
- {
960
- if (element) {
961
- var owner = element._owner;
962
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
963
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
964
- } else {
965
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
966
- }
967
- }
968
- }
992
+ if (hasValidKey(config)) {
993
+ {
994
+ checkKeyStringCoercion(config.key)
995
+ }
969
996
 
970
- var propTypesMisspellWarningShown;
997
+ key = '' + config.key
998
+ }
971
999
 
972
- {
973
- propTypesMisspellWarningShown = false;
974
- }
975
- /**
976
- * Verifies the object is a ReactElement.
977
- * See https://reactjs.org/docs/react-api.html#isvalidelement
978
- * @param {?object} object
979
- * @return {boolean} True if `object` is a ReactElement.
980
- * @final
981
- */
1000
+ if (hasValidRef(config)) {
1001
+ ref = config.ref
1002
+ warnIfStringRefCannotBeAutoConverted(config, self)
1003
+ } // Remaining properties are added to a new props object
1004
+
1005
+ for (propName in config) {
1006
+ if (
1007
+ hasOwnProperty.call(config, propName) &&
1008
+ !RESERVED_PROPS.hasOwnProperty(propName)
1009
+ ) {
1010
+ props[propName] = config[propName]
1011
+ }
1012
+ } // Resolve default props
982
1013
 
1014
+ if (type && type.defaultProps) {
1015
+ var defaultProps = type.defaultProps
983
1016
 
984
- function isValidElement(object) {
985
- {
986
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
987
- }
988
- }
1017
+ for (propName in defaultProps) {
1018
+ if (props[propName] === undefined) {
1019
+ props[propName] = defaultProps[propName]
1020
+ }
1021
+ }
1022
+ }
989
1023
 
990
- function getDeclarationErrorAddendum() {
991
- {
992
- if (ReactCurrentOwner$1.current) {
993
- var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
1024
+ if (key || ref) {
1025
+ var displayName =
1026
+ typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type
994
1027
 
995
- if (name) {
996
- return '\n\nCheck the render method of `' + name + '`.';
997
- }
998
- }
1028
+ if (key) {
1029
+ defineKeyPropWarningGetter(props, displayName)
1030
+ }
999
1031
 
1000
- return '';
1001
- }
1002
- }
1032
+ if (ref) {
1033
+ defineRefPropWarningGetter(props, displayName)
1034
+ }
1035
+ }
1003
1036
 
1004
- function getSourceInfoErrorAddendum(source) {
1005
- {
1006
- if (source !== undefined) {
1007
- var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1008
- var lineNumber = source.lineNumber;
1009
- return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1037
+ return ReactElement(
1038
+ type,
1039
+ key,
1040
+ ref,
1041
+ self,
1042
+ source,
1043
+ ReactCurrentOwner.current,
1044
+ props
1045
+ )
1046
+ }
1010
1047
  }
1011
1048
 
1012
- return '';
1013
- }
1014
- }
1015
- /**
1016
- * Warn if there's no key explicitly set on dynamic arrays of children or
1017
- * object keys are not valid. This allows us to keep track of children between
1018
- * updates.
1019
- */
1020
-
1021
-
1022
- var ownerHasKeyUseWarning = {};
1023
-
1024
- function getCurrentComponentErrorInfo(parentType) {
1025
- {
1026
- var info = getDeclarationErrorAddendum();
1027
-
1028
- if (!info) {
1029
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1049
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner
1050
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame
1030
1051
 
1031
- if (parentName) {
1032
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1052
+ function setCurrentlyValidatingElement$1(element) {
1053
+ {
1054
+ if (element) {
1055
+ var owner = element._owner
1056
+ var stack = describeUnknownElementTypeFrameInDEV(
1057
+ element.type,
1058
+ element._source,
1059
+ owner ? owner.type : null
1060
+ )
1061
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack)
1062
+ } else {
1063
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null)
1064
+ }
1033
1065
  }
1034
1066
  }
1035
1067
 
1036
- return info;
1037
- }
1038
- }
1039
- /**
1040
- * Warn if the element doesn't have an explicit key assigned to it.
1041
- * This element is in an array. The array could grow and shrink or be
1042
- * reordered. All children that haven't already been validated are required to
1043
- * have a "key" property assigned to it. Error statuses are cached so a warning
1044
- * will only be shown once.
1045
- *
1046
- * @internal
1047
- * @param {ReactElement} element Element that requires a key.
1048
- * @param {*} parentType element's parent's type.
1049
- */
1050
-
1068
+ var propTypesMisspellWarningShown
1051
1069
 
1052
- function validateExplicitKey(element, parentType) {
1053
- {
1054
- if (!element._store || element._store.validated || element.key != null) {
1055
- return;
1070
+ {
1071
+ propTypesMisspellWarningShown = false
1056
1072
  }
1057
-
1058
- element._store.validated = true;
1059
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1060
-
1061
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1062
- return;
1073
+ /**
1074
+ * Verifies the object is a ReactElement.
1075
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
1076
+ * @param {?object} object
1077
+ * @return {boolean} True if `object` is a ReactElement.
1078
+ * @final
1079
+ */
1080
+
1081
+ function isValidElement(object) {
1082
+ {
1083
+ return (
1084
+ typeof object === 'object' &&
1085
+ object !== null &&
1086
+ object.$$typeof === REACT_ELEMENT_TYPE
1087
+ )
1088
+ }
1063
1089
  }
1064
1090
 
1065
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1066
- // property, it may be the creator of the child that's responsible for
1067
- // assigning it a key.
1091
+ function getDeclarationErrorAddendum() {
1092
+ {
1093
+ if (ReactCurrentOwner$1.current) {
1094
+ var name = getComponentNameFromType(ReactCurrentOwner$1.current.type)
1068
1095
 
1069
- var childOwner = '';
1096
+ if (name) {
1097
+ return '\n\nCheck the render method of `' + name + '`.'
1098
+ }
1099
+ }
1070
1100
 
1071
- if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1072
- // Give the component that originally created this child.
1073
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1101
+ return ''
1102
+ }
1074
1103
  }
1075
1104
 
1076
- setCurrentlyValidatingElement$1(element);
1077
-
1078
- error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1105
+ function getSourceInfoErrorAddendum(source) {
1106
+ {
1107
+ if (source !== undefined) {
1108
+ var fileName = source.fileName.replace(/^.*[\\\/]/, '')
1109
+ var lineNumber = source.lineNumber
1110
+ return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'
1111
+ }
1079
1112
 
1080
- setCurrentlyValidatingElement$1(null);
1081
- }
1082
- }
1083
- /**
1084
- * Ensure that every element either is passed in a static location, in an
1085
- * array with an explicit keys property defined, or in an object literal
1086
- * with valid key property.
1087
- *
1088
- * @internal
1089
- * @param {ReactNode} node Statically passed child of any type.
1090
- * @param {*} parentType node's parent's type.
1091
- */
1113
+ return ''
1114
+ }
1115
+ }
1116
+ /**
1117
+ * Warn if there's no key explicitly set on dynamic arrays of children or
1118
+ * object keys are not valid. This allows us to keep track of children between
1119
+ * updates.
1120
+ */
1092
1121
 
1122
+ var ownerHasKeyUseWarning = {}
1093
1123
 
1094
- function validateChildKeys(node, parentType) {
1095
- {
1096
- if (typeof node !== 'object') {
1097
- return;
1098
- }
1124
+ function getCurrentComponentErrorInfo(parentType) {
1125
+ {
1126
+ var info = getDeclarationErrorAddendum()
1099
1127
 
1100
- if (isArray(node)) {
1101
- for (var i = 0; i < node.length; i++) {
1102
- var child = node[i];
1128
+ if (!info) {
1129
+ var parentName =
1130
+ typeof parentType === 'string'
1131
+ ? parentType
1132
+ : parentType.displayName || parentType.name
1103
1133
 
1104
- if (isValidElement(child)) {
1105
- validateExplicitKey(child, parentType);
1106
- }
1107
- }
1108
- } else if (isValidElement(node)) {
1109
- // This element was passed in a valid location.
1110
- if (node._store) {
1111
- node._store.validated = true;
1112
- }
1113
- } else if (node) {
1114
- var iteratorFn = getIteratorFn(node);
1115
-
1116
- if (typeof iteratorFn === 'function') {
1117
- // Entry iterators used to provide implicit keys,
1118
- // but now we print a separate warning for them later.
1119
- if (iteratorFn !== node.entries) {
1120
- var iterator = iteratorFn.call(node);
1121
- var step;
1122
-
1123
- while (!(step = iterator.next()).done) {
1124
- if (isValidElement(step.value)) {
1125
- validateExplicitKey(step.value, parentType);
1126
- }
1134
+ if (parentName) {
1135
+ info = '\n\nCheck the top-level render call using <' + parentName + '>.'
1127
1136
  }
1128
1137
  }
1138
+
1139
+ return info
1129
1140
  }
1130
1141
  }
1131
- }
1132
- }
1133
- /**
1134
- * Given an element, validate that its props follow the propTypes definition,
1135
- * provided by the type.
1136
- *
1137
- * @param {ReactElement} element
1138
- */
1142
+ /**
1143
+ * Warn if the element doesn't have an explicit key assigned to it.
1144
+ * This element is in an array. The array could grow and shrink or be
1145
+ * reordered. All children that haven't already been validated are required to
1146
+ * have a "key" property assigned to it. Error statuses are cached so a warning
1147
+ * will only be shown once.
1148
+ *
1149
+ * @internal
1150
+ * @param {ReactElement} element Element that requires a key.
1151
+ * @param {*} parentType element's parent's type.
1152
+ */
1153
+
1154
+ function validateExplicitKey(element, parentType) {
1155
+ {
1156
+ if (!element._store || element._store.validated || element.key != null) {
1157
+ return
1158
+ }
1139
1159
 
1160
+ element._store.validated = true
1161
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType)
1140
1162
 
1141
- function validatePropTypes(element) {
1142
- {
1143
- var type = element.type;
1163
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1164
+ return
1165
+ }
1144
1166
 
1145
- if (type === null || type === undefined || typeof type === 'string') {
1146
- return;
1147
- }
1167
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true // Usually the current owner is the offender, but if it accepts children as a
1168
+ // property, it may be the creator of the child that's responsible for
1169
+ // assigning it a key.
1148
1170
 
1149
- var propTypes;
1171
+ var childOwner = ''
1150
1172
 
1151
- if (typeof type === 'function') {
1152
- propTypes = type.propTypes;
1153
- } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1154
- // Inner props are checked in the reconciler.
1155
- type.$$typeof === REACT_MEMO_TYPE)) {
1156
- propTypes = type.propTypes;
1157
- } else {
1158
- return;
1159
- }
1173
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1174
+ // Give the component that originally created this child.
1175
+ childOwner =
1176
+ ' It was passed a child from ' +
1177
+ getComponentNameFromType(element._owner.type) +
1178
+ '.'
1179
+ }
1160
1180
 
1161
- if (propTypes) {
1162
- // Intentionally inside to avoid triggering lazy initializers:
1163
- var name = getComponentNameFromType(type);
1164
- checkPropTypes(propTypes, element.props, 'prop', name, element);
1165
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1166
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1181
+ setCurrentlyValidatingElement$1(element)
1167
1182
 
1168
- var _name = getComponentNameFromType(type);
1183
+ error(
1184
+ 'Each child in a list should have a unique "key" prop.' +
1185
+ '%s%s See https://reactjs.org/link/warning-keys for more information.',
1186
+ currentComponentErrorInfo,
1187
+ childOwner
1188
+ )
1169
1189
 
1170
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
1190
+ setCurrentlyValidatingElement$1(null)
1191
+ }
1171
1192
  }
1193
+ /**
1194
+ * Ensure that every element either is passed in a static location, in an
1195
+ * array with an explicit keys property defined, or in an object literal
1196
+ * with valid key property.
1197
+ *
1198
+ * @internal
1199
+ * @param {ReactNode} node Statically passed child of any type.
1200
+ * @param {*} parentType node's parent's type.
1201
+ */
1202
+
1203
+ function validateChildKeys(node, parentType) {
1204
+ {
1205
+ if (typeof node !== 'object') {
1206
+ return
1207
+ }
1208
+
1209
+ if (isArray(node)) {
1210
+ for (var i = 0; i < node.length; i++) {
1211
+ var child = node[i]
1172
1212
 
1173
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
1174
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1213
+ if (isValidElement(child)) {
1214
+ validateExplicitKey(child, parentType)
1215
+ }
1216
+ }
1217
+ } else if (isValidElement(node)) {
1218
+ // This element was passed in a valid location.
1219
+ if (node._store) {
1220
+ node._store.validated = true
1221
+ }
1222
+ } else if (node) {
1223
+ var iteratorFn = getIteratorFn(node)
1224
+
1225
+ if (typeof iteratorFn === 'function') {
1226
+ // Entry iterators used to provide implicit keys,
1227
+ // but now we print a separate warning for them later.
1228
+ if (iteratorFn !== node.entries) {
1229
+ var iterator = iteratorFn.call(node)
1230
+ var step
1231
+
1232
+ while (!(step = iterator.next()).done) {
1233
+ if (isValidElement(step.value)) {
1234
+ validateExplicitKey(step.value, parentType)
1235
+ }
1236
+ }
1237
+ }
1238
+ }
1239
+ }
1240
+ }
1175
1241
  }
1176
- }
1177
- }
1178
- /**
1179
- * Given a fragment, validate that it can only be provided with fragment props
1180
- * @param {ReactElement} fragment
1181
- */
1242
+ /**
1243
+ * Given an element, validate that its props follow the propTypes definition,
1244
+ * provided by the type.
1245
+ *
1246
+ * @param {ReactElement} element
1247
+ */
1248
+
1249
+ function validatePropTypes(element) {
1250
+ {
1251
+ var type = element.type
1182
1252
 
1253
+ if (type === null || type === undefined || typeof type === 'string') {
1254
+ return
1255
+ }
1183
1256
 
1184
- function validateFragmentProps(fragment) {
1185
- {
1186
- var keys = Object.keys(fragment.props);
1257
+ var propTypes
1258
+
1259
+ if (typeof type === 'function') {
1260
+ propTypes = type.propTypes
1261
+ } else if (
1262
+ typeof type === 'object' &&
1263
+ (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1264
+ // Inner props are checked in the reconciler.
1265
+ type.$$typeof === REACT_MEMO_TYPE)
1266
+ ) {
1267
+ propTypes = type.propTypes
1268
+ } else {
1269
+ return
1270
+ }
1187
1271
 
1188
- for (var i = 0; i < keys.length; i++) {
1189
- var key = keys[i];
1272
+ if (propTypes) {
1273
+ // Intentionally inside to avoid triggering lazy initializers:
1274
+ var name = getComponentNameFromType(type)
1275
+ checkPropTypes(propTypes, element.props, 'prop', name, element)
1276
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1277
+ propTypesMisspellWarningShown = true // Intentionally inside to avoid triggering lazy initializers:
1190
1278
 
1191
- if (key !== 'children' && key !== 'key') {
1192
- setCurrentlyValidatingElement$1(fragment);
1279
+ var _name = getComponentNameFromType(type)
1193
1280
 
1194
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1281
+ error(
1282
+ 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?',
1283
+ _name || 'Unknown'
1284
+ )
1285
+ }
1195
1286
 
1196
- setCurrentlyValidatingElement$1(null);
1197
- break;
1287
+ if (
1288
+ typeof type.getDefaultProps === 'function' &&
1289
+ !type.getDefaultProps.isReactClassApproved
1290
+ ) {
1291
+ error(
1292
+ 'getDefaultProps is only used on classic React.createClass ' +
1293
+ 'definitions. Use a static property named `defaultProps` instead.'
1294
+ )
1295
+ }
1198
1296
  }
1199
1297
  }
1298
+ /**
1299
+ * Given a fragment, validate that it can only be provided with fragment props
1300
+ * @param {ReactElement} fragment
1301
+ */
1200
1302
 
1201
- if (fragment.ref !== null) {
1202
- setCurrentlyValidatingElement$1(fragment);
1203
-
1204
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
1303
+ function validateFragmentProps(fragment) {
1304
+ {
1305
+ var keys = Object.keys(fragment.props)
1205
1306
 
1206
- setCurrentlyValidatingElement$1(null);
1207
- }
1208
- }
1209
- }
1307
+ for (var i = 0; i < keys.length; i++) {
1308
+ var key = keys[i]
1210
1309
 
1211
- var didWarnAboutKeySpread = {};
1212
- function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1213
- {
1214
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1215
- // succeed and there will likely be errors in render.
1310
+ if (key !== 'children' && key !== 'key') {
1311
+ setCurrentlyValidatingElement$1(fragment)
1216
1312
 
1217
- if (!validType) {
1218
- var info = '';
1313
+ error(
1314
+ 'Invalid prop `%s` supplied to `React.Fragment`. ' +
1315
+ 'React.Fragment can only have `key` and `children` props.',
1316
+ key
1317
+ )
1219
1318
 
1220
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1221
- info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
1222
- }
1319
+ setCurrentlyValidatingElement$1(null)
1320
+ break
1321
+ }
1322
+ }
1223
1323
 
1224
- var sourceInfo = getSourceInfoErrorAddendum(source);
1324
+ if (fragment.ref !== null) {
1325
+ setCurrentlyValidatingElement$1(fragment)
1225
1326
 
1226
- if (sourceInfo) {
1227
- info += sourceInfo;
1228
- } else {
1229
- info += getDeclarationErrorAddendum();
1230
- }
1327
+ error('Invalid attribute `ref` supplied to `React.Fragment`.')
1231
1328
 
1232
- var typeString;
1233
-
1234
- if (type === null) {
1235
- typeString = 'null';
1236
- } else if (isArray(type)) {
1237
- typeString = 'array';
1238
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1239
- typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
1240
- info = ' Did you accidentally export a JSX literal instead of a component?';
1241
- } else {
1242
- typeString = typeof type;
1329
+ setCurrentlyValidatingElement$1(null)
1330
+ }
1243
1331
  }
1244
-
1245
- error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
1246
1332
  }
1247
1333
 
1248
- var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1249
- // TODO: Drop this when these are no longer allowed as the type argument.
1250
-
1251
- if (element == null) {
1252
- return element;
1253
- } // Skip key warning if the type isn't valid since our key validation logic
1254
- // doesn't expect a non-string/function type and can throw confusing errors.
1255
- // We don't want exception behavior to differ between dev and prod.
1256
- // (Rendering will throw with a helpful message and as soon as the type is
1257
- // fixed, the key warnings will appear.)
1334
+ var didWarnAboutKeySpread = {}
1335
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1336
+ {
1337
+ var validType = isValidElementType(type) // We warn in this case but don't throw. We expect the element creation to
1338
+ // succeed and there will likely be errors in render.
1339
+
1340
+ if (!validType) {
1341
+ var info = ''
1342
+
1343
+ if (
1344
+ type === undefined ||
1345
+ (typeof type === 'object' && type !== null && Object.keys(type).length === 0)
1346
+ ) {
1347
+ info +=
1348
+ ' You likely forgot to export your component from the file ' +
1349
+ "it's defined in, or you might have mixed up default and named imports."
1350
+ }
1258
1351
 
1352
+ var sourceInfo = getSourceInfoErrorAddendum(source)
1259
1353
 
1260
- if (validType) {
1261
- var children = props.children;
1354
+ if (sourceInfo) {
1355
+ info += sourceInfo
1356
+ } else {
1357
+ info += getDeclarationErrorAddendum()
1358
+ }
1262
1359
 
1263
- if (children !== undefined) {
1264
- if (isStaticChildren) {
1265
- if (isArray(children)) {
1266
- for (var i = 0; i < children.length; i++) {
1267
- validateChildKeys(children[i], type);
1268
- }
1360
+ var typeString
1269
1361
 
1270
- if (Object.freeze) {
1271
- Object.freeze(children);
1272
- }
1362
+ if (type === null) {
1363
+ typeString = 'null'
1364
+ } else if (isArray(type)) {
1365
+ typeString = 'array'
1366
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1367
+ typeString = '<' + (getComponentNameFromType(type.type) || 'Unknown') + ' />'
1368
+ info = ' Did you accidentally export a JSX literal instead of a component?'
1273
1369
  } else {
1274
- error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
1370
+ typeString = typeof type
1275
1371
  }
1276
- } else {
1277
- validateChildKeys(children, type);
1278
- }
1279
- }
1280
- }
1281
1372
 
1282
- {
1283
- if (hasOwnProperty.call(props, 'key')) {
1284
- var componentName = getComponentNameFromType(type);
1285
- var keys = Object.keys(props).filter(function (k) {
1286
- return k !== 'key';
1287
- });
1288
- var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
1373
+ error(
1374
+ 'React.jsx: type is invalid -- expected a string (for ' +
1375
+ 'built-in components) or a class/function (for composite ' +
1376
+ 'components) but got: %s.%s',
1377
+ typeString,
1378
+ info
1379
+ )
1380
+ }
1289
1381
 
1290
- if (!didWarnAboutKeySpread[componentName + beforeExample]) {
1291
- var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
1382
+ var element = jsxDEV(type, props, key, source, self) // The result can be nullish if a mock or a custom function is used.
1383
+ // TODO: Drop this when these are no longer allowed as the type argument.
1384
+
1385
+ if (element == null) {
1386
+ return element
1387
+ } // Skip key warning if the type isn't valid since our key validation logic
1388
+ // doesn't expect a non-string/function type and can throw confusing errors.
1389
+ // We don't want exception behavior to differ between dev and prod.
1390
+ // (Rendering will throw with a helpful message and as soon as the type is
1391
+ // fixed, the key warnings will appear.)
1392
+
1393
+ if (validType) {
1394
+ var children = props.children
1395
+
1396
+ if (children !== undefined) {
1397
+ if (isStaticChildren) {
1398
+ if (isArray(children)) {
1399
+ for (var i = 0; i < children.length; i++) {
1400
+ validateChildKeys(children[i], type)
1401
+ }
1292
1402
 
1293
- error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
1403
+ if (Object.freeze) {
1404
+ Object.freeze(children)
1405
+ }
1406
+ } else {
1407
+ error(
1408
+ 'React.jsx: Static children should always be an array. ' +
1409
+ 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' +
1410
+ 'Use the Babel transform instead.'
1411
+ )
1412
+ }
1413
+ } else {
1414
+ validateChildKeys(children, type)
1415
+ }
1416
+ }
1417
+ }
1294
1418
 
1295
- didWarnAboutKeySpread[componentName + beforeExample] = true;
1419
+ {
1420
+ if (hasOwnProperty.call(props, 'key')) {
1421
+ var componentName = getComponentNameFromType(type)
1422
+ var keys = Object.keys(props).filter(function (k) {
1423
+ return k !== 'key'
1424
+ })
1425
+ var beforeExample =
1426
+ keys.length > 0
1427
+ ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}'
1428
+ : '{key: someKey}'
1429
+
1430
+ if (!didWarnAboutKeySpread[componentName + beforeExample]) {
1431
+ var afterExample =
1432
+ keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}'
1433
+
1434
+ error(
1435
+ 'A props object containing a "key" prop is being spread into JSX:\n' +
1436
+ ' let props = %s;\n' +
1437
+ ' <%s {...props} />\n' +
1438
+ 'React keys must be passed directly to JSX without using spread:\n' +
1439
+ ' let props = %s;\n' +
1440
+ ' <%s key={someKey} {...props} />',
1441
+ beforeExample,
1442
+ componentName,
1443
+ afterExample,
1444
+ componentName
1445
+ )
1446
+
1447
+ didWarnAboutKeySpread[componentName + beforeExample] = true
1448
+ }
1449
+ }
1296
1450
  }
1297
- }
1298
- }
1299
1451
 
1300
- if (type === REACT_FRAGMENT_TYPE) {
1301
- validateFragmentProps(element);
1302
- } else {
1303
- validatePropTypes(element);
1304
- }
1452
+ if (type === REACT_FRAGMENT_TYPE) {
1453
+ validateFragmentProps(element)
1454
+ } else {
1455
+ validatePropTypes(element)
1456
+ }
1305
1457
 
1306
- return element;
1307
- }
1308
- } // These two functions exist to still get child warnings in dev
1458
+ return element
1459
+ }
1460
+ } // These two functions exist to still get child warnings in dev
1309
1461
 
1310
- var jsxDEV$1 = jsxWithValidation ;
1462
+ var jsxDEV$1 = jsxWithValidation
1311
1463
 
1312
- exports.Fragment = REACT_FRAGMENT_TYPE;
1313
- exports.jsxDEV = jsxDEV$1;
1314
- })();
1464
+ exports.Fragment = REACT_FRAGMENT_TYPE
1465
+ exports.jsxDEV = jsxDEV$1
1466
+ })()
1315
1467
  }