dinou 8.1.1 → 8.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/cli.js +7 -7
- package/dinou/esbuild/react-refresh/esm-hmr/client.js +5 -2
- package/dinou/package.json +1 -1
- package/dinou/rollup/react-refresh/esm-hmr/client.js +5 -2
- package/dinou/rollup/react-refresh/rollup-plugin-esm-hmr.js +3 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ 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
|
+
## [8.1.2] - 2026-10-25
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **HMR & Fast Refresh Granular Module Resolution (`rollup-plugin-esm-hmr` & client runtime)**: Resolved an issue where saving components with common names or navigating code-split routes caused unintended full-browser reloads (`location.reload()`) and wiped React state in active tabs.
|
|
12
|
+
- **Exact Relative Chunk Matching (Rollup)**: Removed loose substring matching on `path.basename()` (`.includes(baseName)`) in `rollup-plugin-esm-hmr.js`, which falsely flagged unrelated chunks sharing similar names (e.g. multiple `counter.tsx`, `button.tsx`, or `card.tsx` across different directories) as modified. Replaced with exact normalized relative path matching (`chunkFileNameLower === relClean`).
|
|
13
|
+
- **Code-Splitting Safe Client Runtime (`esm-hmr/client.js`)**: Updated `applyUpdate()` across both Rollup and esbuild client runtimes to gracefully ignore (`return true`) update events for chunks that are not currently mounted in the active page (`!state`). Full page reload is now strictly reserved for active modules that explicitly decline HMR (`state.isDeclined`), ensuring open tabs, multi-page workflows, and independent route states remain intact.
|
|
14
|
+
|
|
8
15
|
## [8.1.1] - 2026-10-24
|
|
9
16
|
|
|
10
17
|
### Fixed
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# **Dinou**
|
|
2
2
|
|
|
3
|
-
[](https://dinou.dev) [](https://dinou.dev) [](https://www.npmjs.com/package/dinou)
|
|
4
4
|
|
|
5
5
|
### **Full-Stack React 19 Framework**
|
|
6
6
|
|
package/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ const runCommand = (command, options = {}) => {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
// Helper paths
|
|
22
|
-
const p = (rel) => path.join(dinouPath, rel)
|
|
22
|
+
const p = (rel) => `"${path.join(dinouPath, rel).replaceAll("\\", "/")}"`;
|
|
23
23
|
|
|
24
24
|
// --- DEV ---
|
|
25
25
|
|
|
@@ -137,8 +137,8 @@ const runNodeBuild = (bundler) => {
|
|
|
137
137
|
const bundlerCmd = bundler === "rollup"
|
|
138
138
|
? `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")}`
|
|
139
139
|
: bundler === "webpack"
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
|
|
141
|
+
: `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
|
|
142
142
|
|
|
143
143
|
const envPrefix = bundler === "webpack" ? "cross-env DINOU_BUILD_TOOL=webpack " : "";
|
|
144
144
|
return `${bundlerCmd} && ${envPrefix}node ${p("node/build.js")}`;
|
|
@@ -244,8 +244,8 @@ const runDenoBuild = (bundler) => {
|
|
|
244
244
|
const bundlerCmd = bundler === "rollup"
|
|
245
245
|
? `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")}`
|
|
246
246
|
: bundler === "webpack"
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
|
|
248
|
+
: `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
|
|
249
249
|
|
|
250
250
|
const envPrefix = bundler === "webpack" ? "cross-env DINOU_BUILD_TOOL=webpack " : "";
|
|
251
251
|
return `${bundlerCmd} && ${envPrefix}node ${p("deno/build.js")} && deno run --unstable-kv --allow-net --allow-read --allow-write --allow-env ${p("deno/seed-kv.js")}`;
|
|
@@ -309,8 +309,8 @@ const runBunBuild = (bundler) => {
|
|
|
309
309
|
const bundlerCmd = bundler === "rollup"
|
|
310
310
|
? `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")}`
|
|
311
311
|
: bundler === "webpack"
|
|
312
|
-
|
|
313
|
-
|
|
312
|
+
? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
|
|
313
|
+
: `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
|
|
314
314
|
|
|
315
315
|
const envPrefix = bundler === "webpack" ? "cross-env DINOU_BUILD_TOOL=webpack " : "";
|
|
316
316
|
return `${bundlerCmd} && ${envPrefix}node ${p("bun/build.js")}`;
|
|
@@ -76,7 +76,7 @@ class HotModuleState {
|
|
|
76
76
|
_deps = [];
|
|
77
77
|
}
|
|
78
78
|
if (callback === true) {
|
|
79
|
-
callback = () => {};
|
|
79
|
+
callback = () => { };
|
|
80
80
|
}
|
|
81
81
|
const deps = _deps.map((dep) => {
|
|
82
82
|
const ext = dep.split(".").pop();
|
|
@@ -110,7 +110,10 @@ export function createHotContext(id) {
|
|
|
110
110
|
async function applyUpdate(id) {
|
|
111
111
|
const normId = id.startsWith("/") ? id : "/" + id;
|
|
112
112
|
const state = REGISTERED_MODULES[normId] || REGISTERED_MODULES[id];
|
|
113
|
-
if (!state
|
|
113
|
+
if (!state) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
if (state.isDeclined) {
|
|
114
117
|
return false;
|
|
115
118
|
}
|
|
116
119
|
|
package/dinou/package.json
CHANGED
|
@@ -77,7 +77,7 @@ class HotModuleState {
|
|
|
77
77
|
_deps = [];
|
|
78
78
|
}
|
|
79
79
|
if (callback === true) {
|
|
80
|
-
callback = () => {};
|
|
80
|
+
callback = () => { };
|
|
81
81
|
}
|
|
82
82
|
const deps = _deps.map((dep) => {
|
|
83
83
|
const ext = dep.split(".").pop();
|
|
@@ -113,7 +113,10 @@ async function applyUpdate(id) {
|
|
|
113
113
|
const clean = id ? id.split("?")[0] : "";
|
|
114
114
|
const normId = clean.startsWith("/") ? clean : "/" + clean;
|
|
115
115
|
const state = REGISTERED_MODULES[normId] || REGISTERED_MODULES[clean] || REGISTERED_MODULES[id];
|
|
116
|
-
if (!state
|
|
116
|
+
if (!state) {
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
if (state.isDeclined) {
|
|
117
120
|
return false;
|
|
118
121
|
}
|
|
119
122
|
|
|
@@ -133,7 +133,7 @@ function esmHmrPlugin() {
|
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
// 3. Fallback: match chunk filename with
|
|
136
|
+
// 3. Fallback: match chunk filename with exact normalized relative path of changedId
|
|
137
137
|
if (!isChangedByJs) {
|
|
138
138
|
const chunkFileNameLower = fileName.toLowerCase().replace(/\.[jt]sx?$/, "");
|
|
139
139
|
for (const changedId of changedIds) {
|
|
@@ -142,12 +142,7 @@ function esmHmrPlugin() {
|
|
|
142
142
|
.replace(/\.[jt]sx?$/, "")
|
|
143
143
|
.replace(/[^a-zA-Z0-9_-]/g, "_")
|
|
144
144
|
.toLowerCase();
|
|
145
|
-
if (relClean && chunkFileNameLower.
|
|
146
|
-
isChangedByJs = true;
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
const baseName = path.basename(changedId).replace(/\.[jt]sx?$/, "").toLowerCase();
|
|
150
|
-
if (baseName.length > 2 && baseName !== "page" && baseName !== "layout" && baseName !== "index" && chunkFileNameLower.includes(baseName)) {
|
|
145
|
+
if (relClean && (chunkFileNameLower === relClean || chunkFileNameLower.endsWith("/" + relClean))) {
|
|
151
146
|
isChangedByJs = true;
|
|
152
147
|
break;
|
|
153
148
|
}
|
|
@@ -235,7 +230,7 @@ const closeHmrServer = () => {
|
|
|
235
230
|
if (activeServer) {
|
|
236
231
|
try {
|
|
237
232
|
activeServer.close();
|
|
238
|
-
} catch (e) {}
|
|
233
|
+
} catch (e) { }
|
|
239
234
|
activeServer = null;
|
|
240
235
|
activeHmrEngine = null;
|
|
241
236
|
}
|
package/package.json
CHANGED