dinou 5.0.0 → 5.0.1

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/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
+ ## [5.0.1] - 2026-07-07
9
+
10
+ ### Fixed
11
+ - **ESM SSR Navigation Context Resolution**: Replaced direct `require` with a dynamic loader hook (`__dinou_require__` or `module.require`) in `navigation.js` to resolve the request context inside ESM SSR execution trees (e.g., Esbuild and Rollup client bundlers), preventing `ReferenceError: require is not defined` and resolving client component hydration mismatches during route resolution.
12
+
8
13
  ## [5.0.0] - 2026-07-05
9
14
 
10
15
  ### Added
@@ -58,11 +58,11 @@ export function useRouter() {
58
58
  if (!context) {
59
59
  // On the server we return empty functions to not break the rendering
60
60
  return {
61
- push: () => {},
62
- replace: () => {},
63
- back: () => {},
64
- forward: () => {},
65
- refresh: () => {},
61
+ push: () => { },
62
+ replace: () => { },
63
+ back: () => { },
64
+ forward: () => { },
65
+ refresh: () => { },
66
66
  };
67
67
  }
68
68
 
@@ -95,16 +95,24 @@ export function usePathname() {
95
95
  // 🟢 1. SERVER LOGIC (SSR)
96
96
  if (typeof window === "undefined") {
97
97
  try {
98
- const dynamicRequire = require;
99
- // 🛡️ webpackIgnore to avoid bundling server things
100
- const { getContext } = dynamicRequire(
101
- /* webpackIgnore: true */ "./request-context.js"
102
- );
103
- const ctx = getContext();
104
- if (ctx && ctx.req) {
105
- return normalizePath(ctx.req.path);
98
+ const dynamicRequire =
99
+ typeof __dinou_require__ !== "undefined"
100
+ ? __dinou_require__
101
+ : typeof module !== "undefined" && typeof module.require === "function"
102
+ ? module.require.bind(module)
103
+ : null;
104
+ if (dynamicRequire) {
105
+ const { getContext } = dynamicRequire(
106
+ /* webpackIgnore: true */ "./request-context.js"
107
+ );
108
+ const ctx = getContext();
109
+ if (ctx && ctx.req) {
110
+ return normalizePath(ctx.req.path);
111
+ }
106
112
  }
107
- } catch (e) {}
113
+ } catch (e) {
114
+ console.log("error getContext usePathname", e);
115
+ }
108
116
  }
109
117
 
110
118
  // 🔵 2. CLIENT LOGIC
@@ -126,20 +134,27 @@ export function useSearchParams() {
126
134
  // 🟢 1. SERVER LOGIC
127
135
  if (typeof window === "undefined") {
128
136
  try {
129
- const dynamicRequire = require;
130
- const { getContext } = dynamicRequire(
131
- /* webpackIgnore: true */ "./request-context.js"
132
- );
133
- const ctx = getContext();
134
- if (ctx && ctx.req && ctx.req.query) {
135
- const params = new URLSearchParams();
136
- Object.entries(ctx.req.query).forEach(([key, val]) => {
137
- if (Array.isArray(val)) val.forEach((v) => params.append(key, v));
138
- else if (val) params.append(key, val);
139
- });
140
- return params;
137
+ const dynamicRequire =
138
+ typeof __dinou_require__ !== "undefined"
139
+ ? __dinou_require__
140
+ : typeof module !== "undefined" && typeof module.require === "function"
141
+ ? module.require.bind(module)
142
+ : null;
143
+ if (dynamicRequire) {
144
+ const { getContext } = dynamicRequire(
145
+ /* webpackIgnore: true */ "./request-context.js"
146
+ );
147
+ const ctx = getContext();
148
+ if (ctx && ctx.req && ctx.req.query) {
149
+ const params = new URLSearchParams();
150
+ Object.entries(ctx.req.query).forEach(([key, val]) => {
151
+ if (Array.isArray(val)) val.forEach((v) => params.append(key, v));
152
+ else if (val) params.append(key, val);
153
+ });
154
+ return params;
155
+ }
141
156
  }
142
- } catch (e) {}
157
+ } catch (e) { }
143
158
  }
144
159
 
145
160
  // 🔵 2. CLIENT LOGIC
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dinou-ejected",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "main": "index.js",
5
5
  "private": true,
6
6
  "exports": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dinou",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Lightweight-Ejectable Full-Stack React 19 Framework with support for React Server Components (RSC), Server Functions, Server-Side Rendering (SSR), Static Generation (SSG), Incremental Static Generation (ISG), and Incremental Static Regeneration (ISR)",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -96,4 +96,4 @@
96
96
  "react": ">=19.2.3",
97
97
  "react-dom": ">=19.2.3"
98
98
  }
99
- }
99
+ }