@reckona/mreact-router 0.0.109 → 0.0.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reckona/mreact-router",
3
- "version": "0.0.109",
3
+ "version": "0.0.111",
4
4
  "description": "File-system app router, SSR, actions, and deployment adapters for mreact.",
5
5
  "keywords": [
6
6
  "jsx",
@@ -105,20 +105,20 @@
105
105
  },
106
106
  "dependencies": {
107
107
  "typescript": "^6.0.3",
108
- "@reckona/mreact": "0.0.109",
109
- "@reckona/mreact-compat": "0.0.109",
110
- "@reckona/mreact-query": "0.0.109",
111
- "@reckona/mreact-reactive-core": "0.0.109",
112
- "@reckona/mreact-devtools": "0.0.109",
113
- "@reckona/mreact-compiler": "0.0.109",
114
- "@reckona/mreact-reactive-dom": "0.0.109",
115
- "@reckona/mreact-server": "0.0.109",
116
- "@reckona/mreact-shared": "0.0.109"
108
+ "@reckona/mreact": "0.0.111",
109
+ "@reckona/mreact-compat": "0.0.111",
110
+ "@reckona/mreact-devtools": "0.0.111",
111
+ "@reckona/mreact-query": "0.0.111",
112
+ "@reckona/mreact-reactive-core": "0.0.111",
113
+ "@reckona/mreact-compiler": "0.0.111",
114
+ "@reckona/mreact-reactive-dom": "0.0.111",
115
+ "@reckona/mreact-shared": "0.0.111",
116
+ "@reckona/mreact-server": "0.0.111"
117
117
  },
118
118
  "peerDependencies": {
119
119
  "vite": ">=8 <9"
120
120
  },
121
121
  "optionalDependencies": {
122
- "@reckona/mreact-router-native": "0.0.109"
122
+ "@reckona/mreact-router-native": "0.0.111"
123
123
  }
124
124
  }
package/src/build.ts CHANGED
@@ -2609,8 +2609,11 @@ async function writeCloudflareRouteModules(options: {
2609
2609
  }
2610
2610
 
2611
2611
  function cloudflarePageRouteFacadeModuleSource(componentImport: string): string {
2612
- return `import { default as componentDefault, App as componentApp, slots as componentSlots } from ${JSON.stringify(componentImport)};
2612
+ return `import * as componentModule from ${JSON.stringify(componentImport)};
2613
2613
 
2614
+ const componentDefault = readComponentModuleExport(componentModule, "default");
2615
+ const componentApp = readComponentModuleExport(componentModule, "App");
2616
+ const componentSlots = readComponentModuleExport(componentModule, "slots");
2614
2617
  const routeComponent = typeof componentDefault === "function"
2615
2618
  ? componentDefault
2616
2619
  : typeof componentApp === "function"
@@ -2624,7 +2627,20 @@ export const App = routeComponent === undefined
2624
2627
  };
2625
2628
  export default App;
2626
2629
  export const CloudflareRouteComponent = App;
2627
- export const slots = componentSlots === undefined ? undefined : { ...componentSlots };`;
2630
+ export const slots = componentSlots === undefined ? undefined : { ...componentSlots };
2631
+
2632
+ function readComponentModuleExport(module, name) {
2633
+ const descriptor = Object.getOwnPropertyDescriptor(module, name);
2634
+ if (descriptor === undefined) {
2635
+ return undefined;
2636
+ }
2637
+
2638
+ if ("value" in descriptor) {
2639
+ return descriptor.value;
2640
+ }
2641
+
2642
+ return descriptor.get?.call(module);
2643
+ }`;
2628
2644
  }
2629
2645
 
2630
2646
  async function collectCloudflareDirectComponentRoutes(options: {
@@ -2953,8 +2969,10 @@ ${shellModules.join("\n")}
2953
2969
  const pageComponent = selectComponent(pageModule, ${JSON.stringify(options.filename)});
2954
2970
  const shells = [${shellDefinitions.join(", ")}];
2955
2971
  export const slots = pageModule.slots;
2956
- export const App = renderCloudflareStringRoute;
2957
- export default renderCloudflareStringRoute;
2972
+ export function App(props) {
2973
+ return renderCloudflareStringRoute(props);
2974
+ }
2975
+ export default App;
2958
2976
 
2959
2977
  async function renderCloudflareStringRoute(props) {
2960
2978
  const slotHtml = await renderRouteSlots(pageModule.slots, props);
@@ -3124,8 +3142,10 @@ ${shellImports.join("\n")}
3124
3142
  const pageComponent = selectComponent(pageModule, ${JSON.stringify(options.filename)});
3125
3143
  const shells = [${shellDefinitions.join(", ")}];
3126
3144
  export const slots = pageModule.slots;
3127
- export const App = renderCloudflareStringRoute;
3128
- export default renderCloudflareStringRoute;
3145
+ export function App(props) {
3146
+ return renderCloudflareStringRoute(props);
3147
+ }
3148
+ export default App;
3129
3149
 
3130
3150
  async function renderCloudflareStringRoute(props) {
3131
3151
  const slotHtml = await renderRouteSlots(pageModule.slots, props);