@cedarjs/router 0.0.4

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 (275) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/dist/ActivePageContext.d.ts +15 -0
  4. package/dist/ActivePageContext.d.ts.map +1 -0
  5. package/dist/ActivePageContext.js +17 -0
  6. package/dist/AuthenticatedRoute.d.ts +11 -0
  7. package/dist/AuthenticatedRoute.d.ts.map +1 -0
  8. package/dist/AuthenticatedRoute.js +49 -0
  9. package/dist/PageLoadingContext.d.ts +14 -0
  10. package/dist/PageLoadingContext.d.ts.map +1 -0
  11. package/dist/PageLoadingContext.js +29 -0
  12. package/dist/Route.d.ts +32 -0
  13. package/dist/Route.d.ts.map +1 -0
  14. package/dist/Route.js +7 -0
  15. package/dist/Set.d.ts +58 -0
  16. package/dist/Set.d.ts.map +1 -0
  17. package/dist/Set.js +28 -0
  18. package/dist/a11yUtils.d.ts +14 -0
  19. package/dist/a11yUtils.d.ts.map +1 -0
  20. package/dist/a11yUtils.js +35 -0
  21. package/dist/active-route-loader.d.ts +12 -0
  22. package/dist/active-route-loader.d.ts.map +1 -0
  23. package/dist/active-route-loader.js +82 -0
  24. package/dist/analyzeRoutes.d.ts +44 -0
  25. package/dist/analyzeRoutes.d.ts.map +1 -0
  26. package/dist/analyzeRoutes.js +128 -0
  27. package/dist/cjs/ActivePageContext.d.ts +15 -0
  28. package/dist/cjs/ActivePageContext.d.ts.map +1 -0
  29. package/dist/cjs/ActivePageContext.js +42 -0
  30. package/dist/cjs/AuthenticatedRoute.d.ts +11 -0
  31. package/dist/cjs/AuthenticatedRoute.d.ts.map +1 -0
  32. package/dist/cjs/AuthenticatedRoute.js +83 -0
  33. package/dist/cjs/PageLoadingContext.d.ts +14 -0
  34. package/dist/cjs/PageLoadingContext.d.ts.map +1 -0
  35. package/dist/cjs/PageLoadingContext.js +64 -0
  36. package/dist/cjs/Route.d.ts +32 -0
  37. package/dist/cjs/Route.d.ts.map +1 -0
  38. package/dist/cjs/Route.js +41 -0
  39. package/dist/cjs/Set.d.ts +58 -0
  40. package/dist/cjs/Set.d.ts.map +1 -0
  41. package/dist/cjs/Set.js +67 -0
  42. package/dist/cjs/a11yUtils.d.ts +14 -0
  43. package/dist/cjs/a11yUtils.d.ts.map +1 -0
  44. package/dist/cjs/a11yUtils.js +61 -0
  45. package/dist/cjs/active-route-loader.d.ts +12 -0
  46. package/dist/cjs/active-route-loader.d.ts.map +1 -0
  47. package/dist/cjs/active-route-loader.js +116 -0
  48. package/dist/cjs/analyzeRoutes.d.ts +44 -0
  49. package/dist/cjs/analyzeRoutes.d.ts.map +1 -0
  50. package/dist/cjs/analyzeRoutes.js +143 -0
  51. package/dist/cjs/createNamedContext.d.ts +3 -0
  52. package/dist/cjs/createNamedContext.d.ts.map +1 -0
  53. package/dist/cjs/createNamedContext.js +33 -0
  54. package/dist/cjs/dummyComponent.d.ts +3 -0
  55. package/dist/cjs/dummyComponent.d.ts.map +1 -0
  56. package/dist/cjs/dummyComponent.js +24 -0
  57. package/dist/cjs/history.d.ts +24 -0
  58. package/dist/cjs/history.d.ts.map +1 -0
  59. package/dist/cjs/history.js +146 -0
  60. package/dist/cjs/index.d.ts +35 -0
  61. package/dist/cjs/index.d.ts.map +1 -0
  62. package/dist/cjs/index.js +110 -0
  63. package/dist/cjs/link.d.ts +9 -0
  64. package/dist/cjs/link.d.ts.map +1 -0
  65. package/dist/cjs/link.js +62 -0
  66. package/dist/cjs/location.d.ts +28 -0
  67. package/dist/cjs/location.d.ts.map +1 -0
  68. package/dist/cjs/location.js +110 -0
  69. package/dist/cjs/namedRoutes.d.ts +3 -0
  70. package/dist/cjs/namedRoutes.d.ts.map +1 -0
  71. package/dist/cjs/namedRoutes.js +28 -0
  72. package/dist/cjs/navLink.d.ts +11 -0
  73. package/dist/cjs/navLink.d.ts.map +1 -0
  74. package/dist/cjs/navLink.js +70 -0
  75. package/dist/cjs/package.json +1 -0
  76. package/dist/cjs/page.d.ts +28 -0
  77. package/dist/cjs/page.d.ts.map +1 -0
  78. package/dist/cjs/page.js +42 -0
  79. package/dist/cjs/params.d.ts +13 -0
  80. package/dist/cjs/params.d.ts.map +1 -0
  81. package/dist/cjs/params.js +64 -0
  82. package/dist/cjs/react-util.d.ts +3 -0
  83. package/dist/cjs/react-util.d.ts.map +1 -0
  84. package/dist/cjs/react-util.js +37 -0
  85. package/dist/cjs/redirect.d.ts +12 -0
  86. package/dist/cjs/redirect.d.ts.map +1 -0
  87. package/dist/cjs/redirect.js +35 -0
  88. package/dist/cjs/route-announcement.d.ts +13 -0
  89. package/dist/cjs/route-announcement.d.ts.map +1 -0
  90. package/dist/cjs/route-announcement.js +61 -0
  91. package/dist/cjs/route-focus.d.ts +12 -0
  92. package/dist/cjs/route-focus.d.ts.map +1 -0
  93. package/dist/cjs/route-focus.js +36 -0
  94. package/dist/cjs/route-validators.d.ts +21 -0
  95. package/dist/cjs/route-validators.d.ts.map +1 -0
  96. package/dist/cjs/route-validators.js +71 -0
  97. package/dist/cjs/routeParamsTypes.d.ts +49 -0
  98. package/dist/cjs/routeParamsTypes.d.ts.map +1 -0
  99. package/dist/cjs/routeParamsTypes.js +16 -0
  100. package/dist/cjs/router-context.d.ts +21 -0
  101. package/dist/cjs/router-context.d.ts.map +1 -0
  102. package/dist/cjs/router-context.js +69 -0
  103. package/dist/cjs/router.d.ts +11 -0
  104. package/dist/cjs/router.d.ts.map +1 -0
  105. package/dist/cjs/router.js +207 -0
  106. package/dist/cjs/rsc/ClientRouter.d.ts +4 -0
  107. package/dist/cjs/rsc/ClientRouter.d.ts.map +1 -0
  108. package/dist/cjs/rsc/ClientRouter.js +90 -0
  109. package/dist/cjs/rsc/RscCache.d.ts +23 -0
  110. package/dist/cjs/rsc/RscCache.d.ts.map +1 -0
  111. package/dist/cjs/rsc/RscCache.js +110 -0
  112. package/dist/cjs/rsc/RscRoutes.d.ts +7 -0
  113. package/dist/cjs/rsc/RscRoutes.d.ts.map +1 -0
  114. package/dist/cjs/rsc/RscRoutes.js +124 -0
  115. package/dist/cjs/rsc/ServerRouteLoader.d.ts +12 -0
  116. package/dist/cjs/rsc/ServerRouteLoader.d.ts.map +1 -0
  117. package/dist/cjs/rsc/ServerRouteLoader.js +65 -0
  118. package/dist/cjs/rsc/ServerRouter.d.ts +11 -0
  119. package/dist/cjs/rsc/ServerRouter.d.ts.map +1 -0
  120. package/dist/cjs/rsc/ServerRouter.js +170 -0
  121. package/dist/cjs/rsc/SsrRouter.d.ts +4 -0
  122. package/dist/cjs/rsc/SsrRouter.d.ts.map +1 -0
  123. package/dist/cjs/rsc/SsrRouter.js +56 -0
  124. package/dist/cjs/rsc/clientSsr.d.ts +2 -0
  125. package/dist/cjs/rsc/clientSsr.d.ts.map +1 -0
  126. package/dist/cjs/rsc/clientSsr.js +114 -0
  127. package/dist/cjs/rsc/rscCss.d.ts +2 -0
  128. package/dist/cjs/rsc/rscCss.d.ts.map +1 -0
  129. package/dist/cjs/rsc/rscCss.js +94 -0
  130. package/dist/cjs/rsc/ssrModuleMap.d.ts +14 -0
  131. package/dist/cjs/rsc/ssrModuleMap.d.ts.map +1 -0
  132. package/dist/cjs/rsc/ssrModuleMap.js +49 -0
  133. package/dist/cjs/rsc/utils.d.ts +20 -0
  134. package/dist/cjs/rsc/utils.d.ts.map +1 -0
  135. package/dist/cjs/rsc/utils.js +68 -0
  136. package/dist/cjs/rsc-link.d.ts +6 -0
  137. package/dist/cjs/rsc-link.d.ts.map +1 -0
  138. package/dist/cjs/rsc-link.js +41 -0
  139. package/dist/cjs/skipNav.d.ts +81 -0
  140. package/dist/cjs/skipNav.d.ts.map +1 -0
  141. package/dist/cjs/skipNav.js +69 -0
  142. package/dist/cjs/splash-page.d.ts +12 -0
  143. package/dist/cjs/splash-page.d.ts.map +1 -0
  144. package/dist/cjs/splash-page.js +515 -0
  145. package/dist/cjs/useBlocker.d.ts +11 -0
  146. package/dist/cjs/useBlocker.d.ts.map +1 -0
  147. package/dist/cjs/useBlocker.js +65 -0
  148. package/dist/cjs/useIsMounted.d.ts +2 -0
  149. package/dist/cjs/useIsMounted.d.ts.map +1 -0
  150. package/dist/cjs/useIsMounted.js +37 -0
  151. package/dist/cjs/useMatch.d.ts +43 -0
  152. package/dist/cjs/useMatch.d.ts.map +1 -0
  153. package/dist/cjs/useMatch.js +72 -0
  154. package/dist/cjs/useRouteName.d.ts +3 -0
  155. package/dist/cjs/useRouteName.d.ts.map +1 -0
  156. package/dist/cjs/useRouteName.js +40 -0
  157. package/dist/cjs/useRoutePaths.d.ts +4 -0
  158. package/dist/cjs/useRoutePaths.d.ts.map +1 -0
  159. package/dist/cjs/useRoutePaths.js +50 -0
  160. package/dist/cjs/util.d.ts +121 -0
  161. package/dist/cjs/util.d.ts.map +1 -0
  162. package/dist/cjs/util.js +214 -0
  163. package/dist/createNamedContext.d.ts +3 -0
  164. package/dist/createNamedContext.d.ts.map +1 -0
  165. package/dist/createNamedContext.js +9 -0
  166. package/dist/dummyComponent.d.ts +3 -0
  167. package/dist/dummyComponent.d.ts.map +1 -0
  168. package/dist/dummyComponent.js +4 -0
  169. package/dist/history.d.ts +24 -0
  170. package/dist/history.d.ts.map +1 -0
  171. package/dist/history.js +118 -0
  172. package/dist/index.d.ts +35 -0
  173. package/dist/index.d.ts.map +1 -0
  174. package/dist/index.js +49 -0
  175. package/dist/link.d.ts +9 -0
  176. package/dist/link.d.ts.map +1 -0
  177. package/dist/link.js +28 -0
  178. package/dist/location.d.ts +28 -0
  179. package/dist/location.d.ts.map +1 -0
  180. package/dist/location.js +74 -0
  181. package/dist/namedRoutes.d.ts +3 -0
  182. package/dist/namedRoutes.d.ts.map +1 -0
  183. package/dist/namedRoutes.js +4 -0
  184. package/dist/navLink.d.ts +11 -0
  185. package/dist/navLink.d.ts.map +1 -0
  186. package/dist/navLink.js +36 -0
  187. package/dist/page.d.ts +28 -0
  188. package/dist/page.d.ts.map +1 -0
  189. package/dist/page.js +17 -0
  190. package/dist/params.d.ts +13 -0
  191. package/dist/params.d.ts.map +1 -0
  192. package/dist/params.js +28 -0
  193. package/dist/react-util.d.ts +3 -0
  194. package/dist/react-util.d.ts.map +1 -0
  195. package/dist/react-util.js +13 -0
  196. package/dist/redirect.d.ts +12 -0
  197. package/dist/redirect.d.ts.map +1 -0
  198. package/dist/redirect.js +11 -0
  199. package/dist/route-announcement.d.ts +13 -0
  200. package/dist/route-announcement.d.ts.map +1 -0
  201. package/dist/route-announcement.js +31 -0
  202. package/dist/route-focus.d.ts +12 -0
  203. package/dist/route-focus.d.ts.map +1 -0
  204. package/dist/route-focus.js +6 -0
  205. package/dist/route-validators.d.ts +21 -0
  206. package/dist/route-validators.d.ts.map +1 -0
  207. package/dist/route-validators.js +44 -0
  208. package/dist/routeParamsTypes.d.ts +49 -0
  209. package/dist/routeParamsTypes.d.ts.map +1 -0
  210. package/dist/routeParamsTypes.js +0 -0
  211. package/dist/router-context.d.ts +21 -0
  212. package/dist/router-context.d.ts.map +1 -0
  213. package/dist/router-context.js +34 -0
  214. package/dist/router.d.ts +11 -0
  215. package/dist/router.d.ts.map +1 -0
  216. package/dist/router.js +173 -0
  217. package/dist/rsc/ClientRouter.d.ts +4 -0
  218. package/dist/rsc/ClientRouter.d.ts.map +1 -0
  219. package/dist/rsc/ClientRouter.js +56 -0
  220. package/dist/rsc/RscCache.d.ts +23 -0
  221. package/dist/rsc/RscCache.d.ts.map +1 -0
  222. package/dist/rsc/RscCache.js +86 -0
  223. package/dist/rsc/RscRoutes.d.ts +7 -0
  224. package/dist/rsc/RscRoutes.d.ts.map +1 -0
  225. package/dist/rsc/RscRoutes.js +100 -0
  226. package/dist/rsc/ServerRouteLoader.d.ts +12 -0
  227. package/dist/rsc/ServerRouteLoader.d.ts.map +1 -0
  228. package/dist/rsc/ServerRouteLoader.js +31 -0
  229. package/dist/rsc/ServerRouter.d.ts +11 -0
  230. package/dist/rsc/ServerRouter.d.ts.map +1 -0
  231. package/dist/rsc/ServerRouter.js +136 -0
  232. package/dist/rsc/SsrRouter.d.ts +4 -0
  233. package/dist/rsc/SsrRouter.d.ts.map +1 -0
  234. package/dist/rsc/SsrRouter.js +22 -0
  235. package/dist/rsc/clientSsr.d.ts +2 -0
  236. package/dist/rsc/clientSsr.d.ts.map +1 -0
  237. package/dist/rsc/clientSsr.js +80 -0
  238. package/dist/rsc/rscCss.d.ts +2 -0
  239. package/dist/rsc/rscCss.d.ts.map +1 -0
  240. package/dist/rsc/rscCss.js +60 -0
  241. package/dist/rsc/ssrModuleMap.d.ts +14 -0
  242. package/dist/rsc/ssrModuleMap.d.ts.map +1 -0
  243. package/dist/rsc/ssrModuleMap.js +25 -0
  244. package/dist/rsc/utils.d.ts +20 -0
  245. package/dist/rsc/utils.d.ts.map +1 -0
  246. package/dist/rsc/utils.js +31 -0
  247. package/dist/rsc-link.d.ts +6 -0
  248. package/dist/rsc-link.d.ts.map +1 -0
  249. package/dist/rsc-link.js +7 -0
  250. package/dist/skipNav.d.ts +81 -0
  251. package/dist/skipNav.d.ts.map +1 -0
  252. package/dist/skipNav.js +34 -0
  253. package/dist/splash-page.d.ts +12 -0
  254. package/dist/splash-page.d.ts.map +1 -0
  255. package/dist/splash-page.js +481 -0
  256. package/dist/useBlocker.d.ts +11 -0
  257. package/dist/useBlocker.d.ts.map +1 -0
  258. package/dist/useBlocker.js +41 -0
  259. package/dist/useIsMounted.d.ts +2 -0
  260. package/dist/useIsMounted.d.ts.map +1 -0
  261. package/dist/useIsMounted.js +13 -0
  262. package/dist/useMatch.d.ts +43 -0
  263. package/dist/useMatch.d.ts.map +1 -0
  264. package/dist/useMatch.js +48 -0
  265. package/dist/useRouteName.d.ts +3 -0
  266. package/dist/useRouteName.d.ts.map +1 -0
  267. package/dist/useRouteName.js +16 -0
  268. package/dist/useRoutePaths.d.ts +4 -0
  269. package/dist/useRoutePaths.d.ts.map +1 -0
  270. package/dist/useRoutePaths.js +25 -0
  271. package/dist/util.d.ts +121 -0
  272. package/dist/util.d.ts.map +1 -0
  273. package/dist/util.js +183 -0
  274. package/package.json +127 -0
  275. package/skip-nav.css +31 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServerRouter.d.ts","sourceRoot":"","sources":["../../../src/rsc/ServerRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAA;AAEtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAKtD,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,0BAA0B,EAAE,QAAQ,GAAG,iBAAiB,CAAC;IACtE,eAAe,CAAC,EAAE,oBAAoB,CAAA;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA4GxC,CAAA"}
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var ServerRouter_exports = {};
30
+ __export(ServerRouter_exports, {
31
+ Router: () => Router
32
+ });
33
+ module.exports = __toCommonJS(ServerRouter_exports);
34
+ var import_react = __toESM(require("react"), 1);
35
+ var import_server_store = require("@cedarjs/server-store");
36
+ var import_analyzeRoutes = require("../analyzeRoutes.js");
37
+ var import_namedRoutes = require("../namedRoutes.js");
38
+ var import_page = require("../page.js");
39
+ var import_splash_page = require("../splash-page.js");
40
+ var import_util = require("../util.js");
41
+ var import_ServerRouteLoader = require("./ServerRouteLoader.js");
42
+ const Router = ({ paramTypes, children }) => {
43
+ const location = (0, import_server_store.getLocation)();
44
+ console.log("ServerRouter.tsx location", location);
45
+ const analyzedRoutes = (0, import_analyzeRoutes.analyzeRoutes)(children, {
46
+ currentPathName: location.pathname,
47
+ // @TODO We haven't handled this with SSR/Streaming yet.
48
+ // May need a babel plugin to extract userParamTypes from Routes.tsx
49
+ userParamTypes: paramTypes
50
+ });
51
+ const {
52
+ pathRouteMap,
53
+ hasRootRoute,
54
+ namedRoutesMap,
55
+ NotFoundPage,
56
+ activeRoutePath
57
+ } = analyzedRoutes;
58
+ Object.assign(import_namedRoutes.namedRoutes, namedRoutesMap);
59
+ const hasGeneratedRoutes = Object.keys(import_namedRoutes.namedRoutes).length > 0;
60
+ const shouldShowSplash = !hasRootRoute && location.pathname === "/" || !hasGeneratedRoutes;
61
+ if (shouldShowSplash && typeof import_splash_page.SplashPage !== "undefined") {
62
+ return /* @__PURE__ */ import_react.default.createElement(
63
+ import_splash_page.SplashPage,
64
+ {
65
+ hasGeneratedRoutes,
66
+ allStandardRoutes: pathRouteMap
67
+ }
68
+ );
69
+ }
70
+ if (!activeRoutePath) {
71
+ if (NotFoundPage) {
72
+ return /* @__PURE__ */ import_react.default.createElement(
73
+ import_ServerRouteLoader.ServerRouteLoader,
74
+ {
75
+ spec: (0, import_page.normalizePage)(NotFoundPage),
76
+ path: location.pathname
77
+ }
78
+ );
79
+ }
80
+ return null;
81
+ }
82
+ const { path, page, name, redirect, whileLoadingPage, sets } = pathRouteMap[activeRoutePath];
83
+ if (!path) {
84
+ throw new Error(`Route "${name}" needs to specify a path`);
85
+ }
86
+ (0, import_util.validatePath)(path, name || path);
87
+ const { params: pathParams } = (0, import_util.matchPath)(path, location.pathname, {
88
+ userParamTypes: paramTypes
89
+ });
90
+ const searchParams = (0, import_util.parseSearch)(location.search);
91
+ const allParams = { ...searchParams, ...pathParams };
92
+ let redirectPath = void 0;
93
+ if (redirect) {
94
+ if (redirect.startsWith("/")) {
95
+ redirectPath = (0, import_util.replaceParams)(redirect, allParams);
96
+ } else {
97
+ const redirectRouteObject = Object.values(pathRouteMap).find(
98
+ (route) => route.name === redirect
99
+ );
100
+ if (!redirectRouteObject) {
101
+ throw new Error(
102
+ `Redirect target route "${redirect}" does not exist for route "${name}"`
103
+ );
104
+ }
105
+ redirectPath = (0, import_util.replaceParams)(redirectRouteObject.path, allParams);
106
+ }
107
+ }
108
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, !redirectPath && page && /* @__PURE__ */ import_react.default.createElement(
109
+ WrappedPage,
110
+ {
111
+ sets,
112
+ routeLoaderElement: /* @__PURE__ */ import_react.default.createElement(
113
+ import_ServerRouteLoader.ServerRouteLoader,
114
+ {
115
+ path,
116
+ spec: (0, import_page.normalizePage)(page),
117
+ params: allParams,
118
+ whileLoadingPage
119
+ }
120
+ )
121
+ }
122
+ ));
123
+ };
124
+ function hasRole(requiredRoles) {
125
+ const { roles } = (0, import_server_store.getAuthState)();
126
+ const requiredRolesArray = Array.isArray(requiredRoles) ? requiredRoles : [requiredRoles];
127
+ return requiredRolesArray.some((role) => roles.includes(role));
128
+ }
129
+ const AuthenticatedRoute = ({
130
+ children,
131
+ roles
132
+ }) => {
133
+ const { isAuthenticated } = (0, import_server_store.getAuthState)();
134
+ const isAuthorized = isAuthenticated && (!roles || hasRole(roles));
135
+ if (isAuthorized) {
136
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, children);
137
+ }
138
+ if (!isAuthenticated) {
139
+ throw new Error("401 Unauthorized");
140
+ }
141
+ throw new Error("403 Forbidden");
142
+ };
143
+ const WrappedPage = ({ routeLoaderElement, sets }) => {
144
+ if (!sets || sets.length === 0) {
145
+ return routeLoaderElement;
146
+ }
147
+ return sets.reduceRight((acc, set) => {
148
+ let wrapped = set.wrappers.reduceRight((acc2, Wrapper, index) => {
149
+ return import_react.default.createElement(
150
+ Wrapper,
151
+ { ...set.props, key: set.id + "-" + index },
152
+ acc2
153
+ );
154
+ }, acc);
155
+ if (set.isPrivate) {
156
+ const unauthenticated = set.props.unauthenticated;
157
+ if (!unauthenticated || typeof unauthenticated !== "string") {
158
+ throw new Error(
159
+ "You must specify an `unauthenticated` route when using PrivateSet"
160
+ );
161
+ }
162
+ wrapped = /* @__PURE__ */ import_react.default.createElement(AuthenticatedRoute, { ...set.props, unauthenticated }, wrapped);
163
+ }
164
+ return wrapped;
165
+ }, routeLoaderElement);
166
+ };
167
+ // Annotate the CommonJS export names for ESM import in node:
168
+ 0 && (module.exports = {
169
+ Router
170
+ });
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { RouterProps } from '../router.js';
3
+ export declare const Router: ({ paramTypes, children }: RouterProps) => React.JSX.Element;
4
+ //# sourceMappingURL=SsrRouter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SsrRouter.d.ts","sourceRoot":"","sources":["../../../src/rsc/SsrRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAKtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAI/C,eAAO,MAAM,MAAM,6BAA8B,WAAW,sBAQ3D,CAAA"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var SsrRouter_exports = {};
30
+ __export(SsrRouter_exports, {
31
+ Router: () => Router
32
+ });
33
+ module.exports = __toCommonJS(SsrRouter_exports);
34
+ var import_react = __toESM(require("react"), 1);
35
+ var import_analyzeRoutes = require("../analyzeRoutes.js");
36
+ var import_location = require("../location.js");
37
+ var import_namedRoutes = require("../namedRoutes.js");
38
+ var import_clientSsr = require("./clientSsr.js");
39
+ const Router = ({ paramTypes, children }) => {
40
+ return /* @__PURE__ */ import_react.default.createElement(import_location.LocationProvider, null, /* @__PURE__ */ import_react.default.createElement(LocationAwareRouter, { paramTypes }, children));
41
+ };
42
+ const LocationAwareRouter = ({ paramTypes, children }) => {
43
+ const { pathname } = (0, import_location.useLocation)();
44
+ const { namedRoutesMap } = (0, import_react.useMemo)(() => {
45
+ return (0, import_analyzeRoutes.analyzeRoutes)(children, {
46
+ currentPathName: pathname,
47
+ userParamTypes: paramTypes
48
+ });
49
+ }, [pathname, children, paramTypes]);
50
+ Object.assign(import_namedRoutes.namedRoutes, namedRoutesMap);
51
+ return (0, import_clientSsr.renderRoutesSsr)(pathname);
52
+ };
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
55
+ Router
56
+ });
@@ -0,0 +1,2 @@
1
+ export declare function renderRoutesSsr(pathname: string): Promise<any>;
2
+ //# sourceMappingURL=clientSsr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientSsr.d.ts","sourceRoot":"","sources":["../../../src/rsc/clientSsr.ts"],"names":[],"mappings":"AAuEA,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,gBA2DrD"}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var clientSsr_exports = {};
30
+ __export(clientSsr_exports, {
31
+ renderRoutesSsr: () => renderRoutesSsr
32
+ });
33
+ module.exports = __toCommonJS(clientSsr_exports);
34
+ var import_node_path = __toESM(require("node:path"), 1);
35
+ var import_project_config = require("@cedarjs/project-config");
36
+ var import_ssrModuleMap = require("./ssrModuleMap.js");
37
+ var import_utils = require("./utils.js");
38
+ var import_utils2 = require("./utils.js");
39
+ async function getEntries() {
40
+ const entriesPath = (0, import_project_config.getPaths)().web.distRscEntries;
41
+ const entries = await import((0, import_utils2.makeFilePath)(entriesPath));
42
+ return entries;
43
+ }
44
+ async function getRoutesComponent() {
45
+ const { serverEntries } = await getEntries();
46
+ const entryPath = import_node_path.default.join(
47
+ (0, import_project_config.getPaths)().web.distRsc,
48
+ serverEntries["__rwjs__Routes"]
49
+ );
50
+ console.log("getRoutesComponent entryPath", entryPath);
51
+ const routesModule = await import((0, import_utils2.makeFilePath)(entryPath));
52
+ return routesModule.default;
53
+ }
54
+ function resolveClientEntryForProd(filePath, clientEntries) {
55
+ const basePath = (0, import_project_config.getPaths)().web.distSsr;
56
+ const entriesFile = (0, import_project_config.getPaths)().web.distRscEntries;
57
+ const baseDir = import_node_path.default.dirname(entriesFile);
58
+ const absoluteClientEntries = Object.fromEntries(
59
+ Object.entries(clientEntries).map(([key, val]) => {
60
+ let fullKey = import_node_path.default.join(baseDir, key);
61
+ if (process.platform === "win32") {
62
+ fullKey = fullKey.replaceAll("\\", "/");
63
+ }
64
+ return [fullKey, basePath + import_node_path.default.sep + val];
65
+ })
66
+ );
67
+ const filePathSlash = filePath.replaceAll("\\", "/");
68
+ const clientEntry = absoluteClientEntries[filePathSlash];
69
+ console.log("resolveClientEntryForProd during SSR - clientEntry", clientEntry);
70
+ if (!clientEntry) {
71
+ if (absoluteClientEntries["*"] === "*") {
72
+ return basePath + import_node_path.default.relative((0, import_project_config.getPaths)().base, filePathSlash);
73
+ }
74
+ throw new Error("No client entry found for " + filePathSlash);
75
+ }
76
+ return clientEntry;
77
+ }
78
+ const rscCache = /* @__PURE__ */ new Map();
79
+ async function renderRoutesSsr(pathname) {
80
+ console.log("renderRoutesSsr pathname", pathname);
81
+ const cached = rscCache.get(pathname);
82
+ if (cached) {
83
+ return cached;
84
+ }
85
+ const Routes = await getRoutesComponent();
86
+ console.log("clientSsr.ts getEntries()", await getEntries());
87
+ const clientEntries = (await getEntries()).ssrEntries;
88
+ const bundlerConfig = new Proxy(
89
+ {},
90
+ {
91
+ get(_target, encodedId) {
92
+ console.log("Proxy get encodedId", encodedId);
93
+ const [filePath, name] = encodedId.split("#");
94
+ const id = resolveClientEntryForProd(filePath, clientEntries);
95
+ console.log("clientSsr.ts::Proxy id", id);
96
+ return { id, chunks: [id], name, async: true };
97
+ }
98
+ }
99
+ );
100
+ const { createElement } = await (0, import_utils.importReact)();
101
+ const { renderToReadableStream } = await (0, import_utils.importRsdwServer)();
102
+ console.log("clientSsr.ts right before renderToReadableStream");
103
+ const stream = renderToReadableStream(createElement(Routes), bundlerConfig);
104
+ const { createFromReadableStream } = await (0, import_utils.importRsdwClient)();
105
+ const data = createFromReadableStream(stream, {
106
+ ssrManifest: { moduleMap: import_ssrModuleMap.moduleMap, moduleLoading: null }
107
+ });
108
+ rscCache.set(pathname, data);
109
+ return data;
110
+ }
111
+ // Annotate the CommonJS export names for ESM import in node:
112
+ 0 && (module.exports = {
113
+ renderRoutesSsr
114
+ });
@@ -0,0 +1,2 @@
1
+ export declare function getRscStylesheetLinkGenerator(existingLinks?: string[]): () => string[];
2
+ //# sourceMappingURL=rscCss.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rscCss.d.ts","sourceRoot":"","sources":["../../../src/rsc/rscCss.ts"],"names":[],"mappings":"AAaA,wBAAgB,6BAA6B,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,kBAiCrE"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var rscCss_exports = {};
30
+ __export(rscCss_exports, {
31
+ getRscStylesheetLinkGenerator: () => getRscStylesheetLinkGenerator
32
+ });
33
+ module.exports = __toCommonJS(rscCss_exports);
34
+ var import_node_fs = __toESM(require("node:fs"), 1);
35
+ var import_node_path = __toESM(require("node:path"), 1);
36
+ var import_project_config = require("@cedarjs/project-config");
37
+ function getRscStylesheetLinkGenerator(existingLinks) {
38
+ const clientBuildManifestPath = import_node_path.default.join(
39
+ (0, import_project_config.getPaths)().web.distBrowser,
40
+ "client-build-manifest.json"
41
+ );
42
+ const clientBuildManifest = JSON.parse(
43
+ import_node_fs.default.readFileSync(clientBuildManifestPath, "utf-8")
44
+ );
45
+ const clientCss = extractCssMappingFromManifest(clientBuildManifest);
46
+ const serverBuildManifestPath = import_node_path.default.join(
47
+ (0, import_project_config.getPaths)().web.distRsc,
48
+ "server-build-manifest.json"
49
+ );
50
+ const serverBuildManifest = JSON.parse(
51
+ import_node_fs.default.readFileSync(serverBuildManifestPath, "utf-8")
52
+ );
53
+ const serverCss = extractCssMappingFromManifest(serverBuildManifest);
54
+ const allCss = /* @__PURE__ */ new Set();
55
+ for (const cssList of clientCss.values()) {
56
+ for (const css of cssList) {
57
+ allCss.add(css);
58
+ }
59
+ }
60
+ for (const cssList of serverCss.values()) {
61
+ for (const css of cssList) {
62
+ allCss.add(css);
63
+ }
64
+ }
65
+ const cssLinks = Array.from(allCss);
66
+ return () => [...existingLinks || [], ...cssLinks];
67
+ }
68
+ function extractCssMappingFromManifest(manifest) {
69
+ const manifestCss = /* @__PURE__ */ new Map();
70
+ const lookupCssAssets = (id) => {
71
+ const assets = [];
72
+ const asset = manifest[id];
73
+ if (!asset) {
74
+ return assets;
75
+ }
76
+ if (asset.css) {
77
+ assets.push(...asset.css);
78
+ }
79
+ if (asset.imports) {
80
+ for (const importId of asset.imports) {
81
+ assets.push(...lookupCssAssets(importId));
82
+ }
83
+ }
84
+ return assets;
85
+ };
86
+ for (const key of Object.keys(manifest)) {
87
+ manifestCss.set(key, lookupCssAssets(key));
88
+ }
89
+ return manifestCss;
90
+ }
91
+ // Annotate the CommonJS export names for ESM import in node:
92
+ 0 && (module.exports = {
93
+ getRscStylesheetLinkGenerator
94
+ });
@@ -0,0 +1,14 @@
1
+ type SSRModuleMap = null | {
2
+ [clientId: string]: {
3
+ [clientExportName: string]: ClientReferenceManifestEntry;
4
+ };
5
+ };
6
+ type ClientReferenceManifestEntry = ImportManifestEntry;
7
+ type ImportManifestEntry = {
8
+ id: string;
9
+ chunks: string[];
10
+ name: string;
11
+ };
12
+ export declare const moduleMap: SSRModuleMap;
13
+ export {};
14
+ //# sourceMappingURL=ssrModuleMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssrModuleMap.d.ts","sourceRoot":"","sources":["../../../src/rsc/ssrModuleMap.ts"],"names":[],"mappings":"AAEA,KAAK,YAAY,GAAG,IAAI,GAAG;IACzB,CAAC,QAAQ,EAAE,MAAM,GAAG;QAClB,CAAC,gBAAgB,EAAE,MAAM,GAAG,4BAA4B,CAAA;KACzD,CAAA;CACF,CAAA;AACD,KAAK,4BAA4B,GAAG,mBAAmB,CAAA;AACvD,KAAK,mBAAmB,GAAG;IACzB,EAAE,EAAE,MAAM,CAAA;IAEV,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAMD,eAAO,MAAM,SAAS,EAAE,YAuBvB,CAAA"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var ssrModuleMap_exports = {};
20
+ __export(ssrModuleMap_exports, {
21
+ moduleMap: () => moduleMap
22
+ });
23
+ module.exports = __toCommonJS(ssrModuleMap_exports);
24
+ var import_utils = require("./utils.js");
25
+ const moduleMap = new Proxy(
26
+ {},
27
+ {
28
+ get(_target, filePath) {
29
+ return new Proxy(
30
+ {},
31
+ {
32
+ get(_target2, name) {
33
+ filePath = (0, import_utils.makeFilePath)(filePath);
34
+ const manifestEntry = {
35
+ id: filePath,
36
+ chunks: [filePath],
37
+ name
38
+ };
39
+ return manifestEntry;
40
+ }
41
+ }
42
+ );
43
+ }
44
+ }
45
+ );
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ moduleMap
49
+ });
@@ -0,0 +1,20 @@
1
+ import type { default as RSDWClientModule } from 'react-server-dom-webpack/client.edge';
2
+ import type { default as RSDWServerModule } from 'react-server-dom-webpack/server.edge';
3
+ type RSDWClientType = typeof RSDWClientModule;
4
+ type RSDWServerType = typeof RSDWServerModule;
5
+ export declare function makeFilePath(path: string): string;
6
+ /**
7
+ * See vite/streamHelpers.ts.
8
+ *
9
+ * This function ensures we load the same version of rsdw_client to prevent multiple instances of React
10
+ */
11
+ export declare function importReact(): Promise<any>;
12
+ /**
13
+ * See vite/streamHelpers.ts.
14
+ *
15
+ * This function ensures we load the same version of rsdw_client to prevent multiple instances of React
16
+ */
17
+ export declare function importRsdwClient(): Promise<RSDWClientType>;
18
+ export declare function importRsdwServer(): Promise<RSDWServerType>;
19
+ export {};
20
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/rsc/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AACvF,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AAIvF,KAAK,cAAc,GAAG,OAAO,gBAAgB,CAAA;AAC7C,KAAK,cAAc,GAAG,OAAO,gBAAgB,CAAA;AAE7C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC;AAED;;;;GAIG;AACH,wBAAsB,WAAW,iBAKhC;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,cAAc,CAAC,CAOhE;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,cAAc,CAAC,CAWhE"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var utils_exports = {};
30
+ __export(utils_exports, {
31
+ importReact: () => importReact,
32
+ importRsdwClient: () => importRsdwClient,
33
+ importRsdwServer: () => importRsdwServer,
34
+ makeFilePath: () => makeFilePath
35
+ });
36
+ module.exports = __toCommonJS(utils_exports);
37
+ var import_node_path = __toESM(require("node:path"), 1);
38
+ var import_node_url = require("node:url");
39
+ var import_project_config = require("@cedarjs/project-config");
40
+ function makeFilePath(path2) {
41
+ return (0, import_node_url.pathToFileURL)(path2).href;
42
+ }
43
+ async function importReact() {
44
+ const distSsr = (0, import_project_config.getPaths)().web.distSsr;
45
+ const reactPath = makeFilePath(import_node_path.default.join(distSsr, "__rwjs__react.mjs"));
46
+ return (await import(reactPath)).default;
47
+ }
48
+ async function importRsdwClient() {
49
+ const distSsr = (0, import_project_config.getPaths)().web.distSsr;
50
+ const rsdwClientPath = makeFilePath(
51
+ import_node_path.default.join(distSsr, "__rwjs__rsdw-client.mjs")
52
+ );
53
+ return (await import(rsdwClientPath)).default;
54
+ }
55
+ async function importRsdwServer() {
56
+ const dynamicImport = "";
57
+ return import(
58
+ /* @vite-ignore */
59
+ dynamicImport + "react-server-dom-webpack/server.edge"
60
+ );
61
+ }
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {
64
+ importReact,
65
+ importRsdwClient,
66
+ importRsdwServer,
67
+ makeFilePath
68
+ });
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface LinkProps {
3
+ to: string;
4
+ }
5
+ export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>;
6
+ //# sourceMappingURL=rsc-link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rsc-link.d.ts","sourceRoot":"","sources":["../../src/rsc-link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;CACX;AAmBD,eAAO,MAAM,IAAI,qIAKf,CAAA"}