dinou 8.1.0 → 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 CHANGED
@@ -5,6 +5,21 @@ 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
+
15
+ ## [8.1.1] - 2026-10-24
16
+
17
+ ### Fixed
18
+ - **HMR & Fast Refresh Full-Reload Regression (`dev.js`)**: Fixed an issue where minor keystrokes or text edits inside documentation and markdown pages falsely triggered a full browser reload (`location.reload()`) instead of Fast Refresh or an in-place RSC stream update.
19
+ - Replaced naive substring matching (`content.includes("use server")`) with AST-level Server Function action detection (`transformServerFunctions`) during development watcher cycles, preventing pages containing mentions or snippets of `"use server"` from being erroneously treated as server action modules.
20
+ - Dynamically synchronized `knownServerFiles` and `knownClientFiles` tracking sets after each rebuild batch to prevent perpetual `serverDirectiveChanged` false positives on subsequent keystrokes.
21
+ - Excluded pure Server Component route entries (`page.tsx`, `layout.tsx` without `"use client"`) from the client bundler queue (`!isPageRoute`), reducing incremental rebuild times to ~140ms and reliably streaming targeted `{ type: "rsc-update" }` events without reloading the page.
22
+
8
23
  ## [8.1.0] - 2026-10-23
9
24
 
10
25
  ### Added
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # **Dinou**
2
2
 
3
- [![Documentation](https://img.shields.io/badge/docs-dinou.dev-blue?style=flat-square)](https://dinou.dev) [![Version](https://img.shields.io/badge/version-8.1.0-orange?style=flat-square)](https://www.npmjs.com/package/dinou)
3
+ [![Documentation](https://img.shields.io/badge/docs-dinou.dev-blue?style=flat-square)](https://dinou.dev) [![Version](https://img.shields.io/badge/version-8.1.2-orange?style=flat-square)](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
- ? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
141
- : `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
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
- ? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
248
- : `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
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
- ? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
313
- : `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
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 || state.isDeclined) {
113
+ if (!state) {
114
+ return true;
115
+ }
116
+ if (state.isDeclined) {
114
117
  return false;
115
118
  }
116
119
 
package/dinou/node/dev.js CHANGED
@@ -177,6 +177,15 @@ async function findClientComponents(parsedClientManifest = {}) {
177
177
  const content = fs.readFileSync(full, "utf8");
178
178
  if (useClientRegex.test(content.trim()) && isSupportedClientModule(full, content)) {
179
179
  clientFiles.add(path.resolve(full));
180
+ } else if (useServerRegex.test(content.trim())) {
181
+ knownServerFiles.add(path.resolve(full));
182
+ } else if (hasServerFunctions(content)) {
183
+ try {
184
+ const sfRes = transformServerFunctions(content, full);
185
+ if (sfRes?.actions?.length > 0) {
186
+ knownServerFiles.add(path.resolve(full));
187
+ }
188
+ } catch (e) {}
180
189
  }
181
190
  } catch (e) {}
182
191
  }
@@ -585,7 +594,6 @@ async function updateManifestsState(options = {}) {
585
594
  }
586
595
  }
587
596
 
588
- knownServerFiles.clear();
589
597
  for (const f of Object.keys(parsedServerFunctionsManifest)) {
590
598
  knownServerFiles.add(path.resolve(projectRoot, f));
591
599
  }
@@ -1762,7 +1770,16 @@ async function doRebuildBatch(changesMap) {
1762
1770
  try {
1763
1771
  const content = fs.readFileSync(absFilePath, "utf8");
1764
1772
  isClientFile = useClientRegex.test(content.trim());
1765
- isServerFile = useServerRegex.test(content.trim()) || hasServerFunctions(content);
1773
+ if (useServerRegex.test(content.trim())) {
1774
+ isServerFile = true;
1775
+ } else if (hasServerFunctions(content)) {
1776
+ try {
1777
+ const sfRes = transformServerFunctions(content, absFilePath);
1778
+ isServerFile = Boolean(sfRes?.actions?.length > 0);
1779
+ } catch (e) {
1780
+ isServerFile = false;
1781
+ }
1782
+ }
1766
1783
  } catch (e) {}
1767
1784
  }
1768
1785
 
@@ -1772,18 +1789,32 @@ async function doRebuildBatch(changesMap) {
1772
1789
  const wasServerFile = knownServerFiles.has(absFilePath);
1773
1790
  const serverDirectiveChanged = isServerFile !== wasServerFile;
1774
1791
 
1792
+ if (isClientFile) {
1793
+ knownClientFiles.add(absFilePath);
1794
+ } else {
1795
+ knownClientFiles.delete(absFilePath);
1796
+ }
1797
+
1798
+ if (isServerFile) {
1799
+ knownServerFiles.add(absFilePath);
1800
+ } else {
1801
+ knownServerFiles.delete(absFilePath);
1802
+ }
1803
+
1775
1804
  const isJsTsSource =
1776
1805
  normLower.endsWith(".tsx") ||
1777
1806
  normLower.endsWith(".jsx") ||
1778
1807
  normLower.endsWith(".ts") ||
1779
1808
  normLower.endsWith(".js");
1780
1809
 
1810
+ const isPageRoute = /(?:^|[\\/])(page|layout)\.[jt]sx?$/i.test(absFilePath);
1811
+
1781
1812
  const isClientRelevant =
1782
1813
  isClientFile ||
1783
1814
  wasClientFile ||
1784
1815
  clientDirectiveChanged ||
1785
1816
  isCssFile ||
1786
- isJsTsSource;
1817
+ (isJsTsSource && !isPageRoute);
1787
1818
 
1788
1819
  if (isClientFile) {
1789
1820
  getCachedFileExports(absFilePath);
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
2
+ Copyright (c) 2013 Arnout Kazemier and contributors
3
+ Copyright (c) 2016 Luigi Pinca and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.