dinou 7.3.0 → 8.0.0

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 (113) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +1 -1
  3. package/cli.js +44 -41
  4. package/dinou/adapters/netlify.js +1 -0
  5. package/dinou/adapters/{node.mjs → node.js} +9 -3
  6. package/dinou/bun/{build.mjs → build.js} +11 -10
  7. package/dinou/cloudflare/{build.mjs → build.js} +14 -10
  8. package/dinou/cloudflare/shims/fs.js +3 -0
  9. package/dinou/constants.js +3 -3
  10. package/dinou/core/asset-extensions.js +5 -5
  11. package/dinou/core/bailout-proxy.js +3 -3
  12. package/dinou/core/build-static-pages.js +21 -17
  13. package/dinou/core/cache-revalidate.js +14 -33
  14. package/dinou/core/cache-slot.js +21 -10
  15. package/dinou/core/config.js +2 -5
  16. package/dinou/core/createScopedName.js +3 -3
  17. package/dinou/core/dinou-paths.js +15 -12
  18. package/dinou/core/generate-route-types.js +8 -3
  19. package/dinou/core/generate-static-page.js +6 -5
  20. package/dinou/core/generate-static-rsc.js +15 -10
  21. package/dinou/core/generate-static.js +11 -10
  22. package/dinou/core/generating-isg.js +12 -11
  23. package/dinou/core/get-abs-path-with-ext.js +8 -6
  24. package/dinou/core/get-asset-from-manifest.js +4 -4
  25. package/dinou/core/get-error-jsx.js +12 -9
  26. package/dinou/core/get-file-path-and-dynamic-params.js +7 -4
  27. package/dinou/core/get-jsx.js +19 -13
  28. package/dinou/core/handler.js +73 -33
  29. package/dinou/core/http-adapter.js +6 -2
  30. package/dinou/core/import-module.js +5 -4
  31. package/dinou/core/layout-functions.js +11 -6
  32. package/dinou/core/load-dinou-config.js +10 -4
  33. package/dinou/core/manifest-provider.js +11 -4
  34. package/dinou/core/parse-exports.js +11 -6
  35. package/dinou/core/path-utils.js +2 -2
  36. package/dinou/core/ppr-context.js +11 -11
  37. package/dinou/core/ppr-runtime.js +10 -6
  38. package/dinou/core/render-jsx-to-client-jsx.js +6 -3
  39. package/dinou/core/request-context.js +11 -7
  40. package/dinou/core/resolve-module-ppr.js +2 -2
  41. package/dinou/core/resolve-setup-files.js +70 -69
  42. package/dinou/core/revalidating.js +14 -25
  43. package/dinou/core/route-generator.js +12 -8
  44. package/dinou/core/rsc-renderer.js +13 -2
  45. package/dinou/core/run-ssg.js +9 -4
  46. package/dinou/core/safe-rename.js +3 -3
  47. package/dinou/core/scan-dependency-components.js +9 -3
  48. package/dinou/core/status-manifest.js +5 -5
  49. package/dinou/core/storage-adapter.js +13 -3
  50. package/dinou/core/url-resolver.js +2 -2
  51. package/dinou/core/vfs.js +7 -7
  52. package/dinou/deno/{build.mjs → build.js} +11 -10
  53. package/dinou/esbuild/{build.mjs → build.js} +4 -4
  54. package/dinou/esbuild/{dev.mjs → dev.js} +6 -6
  55. package/dinou/esbuild/helpers-esbuild/{get-config-esbuild-prod.mjs → get-config-esbuild-prod.js} +7 -7
  56. package/dinou/esbuild/helpers-esbuild/{get-config-esbuild.mjs → get-config-esbuild.js} +8 -8
  57. package/dinou/esbuild/helpers-esbuild/{get-esbuild-entries.mjs → get-esbuild-entries.js} +2 -2
  58. package/dinou/esbuild/plugins-esbuild/{assets-plugin.mjs → assets-plugin.js} +1 -1
  59. package/dinou/esbuild/plugins-esbuild/{stable-chunk-names-and-maps-plugin.mjs → stable-chunk-names-and-maps-plugin.js} +1 -1
  60. package/dinou/esbuild/plugins-esbuild/{write-plugin.mjs → write-plugin.js} +1 -1
  61. package/dinou/esbuild/plugins-postcss/postcss-extract-plugin.js +4 -3
  62. package/dinou/esbuild/react-refresh/babel-config.js +5 -1
  63. package/dinou/esbuild/react-refresh/esm-hmr/server.js +7 -4
  64. package/dinou/esbuild/react-refresh/{esm-hmr-plugin.mjs → esm-hmr-plugin.js} +4 -4
  65. package/dinou/esbuild/react-refresh/{react-refresh-runtime.mjs → react-refresh-runtime.js} +1 -1
  66. package/dinou/index.js +40 -19
  67. package/dinou/node/{build.mjs → build.js} +1 -1
  68. package/dinou/node/{bundle-dual-engine.mjs → bundle-dual-engine.js} +13 -12
  69. package/dinou/node/{dev.mjs → dev.js} +27 -22
  70. package/dinou/package.json +8 -7
  71. package/dinou/rollup/postcss.config.js +1 -1
  72. package/dinou/rollup/react-refresh/esm-hmr/server.js +7 -4
  73. package/dinou/rollup/react-refresh/react-refresh-wrap-modules.js +2 -1
  74. package/dinou/rollup/react-refresh/rollup-plugin-esm-hmr.js +23 -16
  75. package/dinou/rollup/rollup-plugins/dinou-asset-plugin.js +6 -5
  76. package/dinou/rollup/rollup-plugins/manifest-generator-plugin.js +2 -1
  77. package/dinou/rollup/rollup-plugins/rollup-plugin-memory.js +3 -2
  78. package/dinou/rollup/rollup-plugins/rollup-plugin-react-client-manifest.js +16 -13
  79. package/dinou/rollup/rollup-plugins/rollup-plugin-server-functions.js +7 -6
  80. package/dinou/rollup/rollup-plugins/rollup-plugin-swc.js +6 -3
  81. package/dinou/rollup/rollup.config.js +27 -23
  82. package/dinou/server.js +21 -26
  83. package/dinou/webpack/helpers/get-webpack-entries.js +14 -11
  84. package/dinou/webpack/loaders/server-functions-loader.js +5 -6
  85. package/dinou/webpack/loaders/swc-loader.js +4 -2
  86. package/dinou/webpack/plugins/manifest-generator-plugin.js +3 -1
  87. package/dinou/webpack/plugins/server-functions-plugin.js +4 -3
  88. package/dinou/webpack/plugins/webpack-memory-plugin.js +3 -2
  89. package/dinou/webpack/postcss.config.js +1 -1
  90. package/dinou/webpack/webpack.config.js +22 -20
  91. package/eject.js +224 -217
  92. package/package.json +111 -110
  93. package/dinou/config.js +0 -1
  94. package/dinou/config.mjs +0 -2
  95. package/dinou/core/css-require-hook.js +0 -64
  96. package/dinou/index.mjs +0 -43
  97. package/dinou/server.mjs +0 -30
  98. /package/dinou/core/{export-static.mjs → export-static.js} +0 -0
  99. /package/dinou/esbuild/helpers-esbuild/{normalize-path.mjs → normalize-path.js} +0 -0
  100. /package/dinou/esbuild/helpers-esbuild/{strip-namespace.mjs → strip-namespace.js} +0 -0
  101. /package/dinou/esbuild/helpers-esbuild/{swc-disk-cache.mjs → swc-disk-cache.js} +0 -0
  102. /package/dinou/esbuild/helpers-esbuild/{update-manifest-for-module.mjs → update-manifest-for-module.js} +0 -0
  103. /package/dinou/esbuild/helpers-esbuild/{write.mjs → write.js} +0 -0
  104. /package/dinou/esbuild/plugins-esbuild/{babel-react-compiler-plugin.mjs → babel-react-compiler-plugin.js} +0 -0
  105. /package/dinou/esbuild/plugins-esbuild/{css-processor-plugin.mjs → css-processor-plugin.js} +0 -0
  106. /package/dinou/esbuild/plugins-esbuild/{manifest-generator-plugin.mjs → manifest-generator-plugin.js} +0 -0
  107. /package/dinou/esbuild/plugins-esbuild/{react-client-manifest-plugin.mjs → react-client-manifest-plugin.js} +0 -0
  108. /package/dinou/esbuild/plugins-esbuild/{server-functions-plugin.mjs → server-functions-plugin.js} +0 -0
  109. /package/dinou/esbuild/plugins-esbuild/{skip-missing-entry-points-plugin.mjs → skip-missing-entry-points-plugin.js} +0 -0
  110. /package/dinou/esbuild/react-refresh/esm-hmr/{client.mjs → client.js} +0 -0
  111. /package/dinou/esbuild/react-refresh/{is-react-refresh-boundary.mjs → is-react-refresh-boundary.js} +0 -0
  112. /package/dinou/node/{port-selector.mjs → port-selector.js} +0 -0
  113. /package/dinou/node/{terminal-status.mjs → terminal-status.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,28 @@ 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.0.0] - 2026-10-20
9
+
10
+ ### ⚠️ Breaking Changes
11
+ > **Note**: For standard Dinou applications using `import` and the Dinou CLI, upgrading from v7 to v8 is completely seamless and requires zero code changes.
12
+
13
+ - **Native ESM Framework (`"type": "module"`)**: Dinou is now distributed and executed strictly as native ECMAScript Modules (ESM). `package.json` includes `"type": "module"`, allowing all framework and consumer code to run with modern ESM semantics.
14
+ - **Source & Extension Unification (`.mjs` -> `.js`)**: Eliminated the hybrid extension fragmentation (`.mjs` vs `.js`). All framework build scripts, CLI commands, adapters, and entrypoints now use standard `.js` extension across the codebase.
15
+ - **Package Exports Modernization**: Dropped legacy CommonJS conditional exports (`"require"`) and `.mjs` targets in `package.json`. All public subpaths (`dinou`, `dinou/server`, `dinou/config`, `dinou/adapters/*`) resolve directly to standard ESM `.js` targets.
16
+ - **Universal Edge Renderer Singleton (`__DINOU_EDGE_RENDERER__`)**: Replaced dynamic module resolution in dual-bundle compilation with an explicit global singleton (`globalThis.__DINOU_EDGE_RENDERER__`), guaranteeing that React 19 RSC streaming and Server Function serialization share identical context across runtime engines.
17
+
18
+ ### Changed
19
+ - **CLI & Eject Architecture Modernization**:
20
+ - Migrated `cli.js` to native ESM imports using Commander.
21
+ - Refactored `eject.js` into an idiomatic ESM module exporting `eject()`.
22
+ - Updated all ejected `npm run` scripts to reference standard `.js` entry points across all adapters and bundlers (Esbuild, Rollup, Webpack).
23
+ - **Core Cleanup & Canonical Config Resolution**:
24
+ - Removed obsolete root wrapper `dinou/config.js`, establishing `dinou/core/config.js` as the sole canonical implementation for the `"dinou/config"` export.
25
+ - Formatted and aligned root `package.json` fields according to modern ecosystem conventions.
26
+
27
+ ### Fixed
28
+ - **Layout `allowISG: false` False 404 on Static Routes**: Fixed a bug in `handler.js` where setting `allowISG: false` in layout functions caused production requests to prematurely return an unconditional `404 Not Found`. The handler now properly verifies parameter matches against `staticPathsSet` (`getStaticPaths`) and confirms whether pre-rendered layout artifacts (`layout.rsc`) exist on disk before blocking unauthorized dynamic paths.
29
+
8
30
  ## [7.3.0]
9
31
 
10
32
  ### 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-7.3.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.0.0-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
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { program } = require("commander");
4
- const { execSync } = require("child_process");
5
- const path = require("path");
6
-
3
+ import { program } from "commander";
4
+ import { execSync } from "node:child_process";
5
+ import path from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
9
  const dinouPath = path.resolve(__dirname, "dinou");
8
10
  const projectRoot = process.cwd();
9
11
 
@@ -25,28 +27,28 @@ program
25
27
  .command("dev")
26
28
  .description("Start development server with Esbuild")
27
29
  .action(() => {
28
- runCommand(`cross-env DINOU_BUILD_TOOL=esbuild node ${p("node/dev.mjs")}`);
30
+ runCommand(`cross-env DINOU_BUILD_TOOL=esbuild node ${p("node/dev.js")}`);
29
31
  });
30
32
 
31
33
  program
32
34
  .command("dev:esbuild")
33
35
  .description("Start development server with Esbuild")
34
36
  .action(() => {
35
- runCommand(`cross-env DINOU_BUILD_TOOL=esbuild node ${p("node/dev.mjs")}`);
37
+ runCommand(`cross-env DINOU_BUILD_TOOL=esbuild node ${p("node/dev.js")}`);
36
38
  });
37
39
 
38
40
  program
39
41
  .command("dev:rollup")
40
42
  .description("Start development server with Rollup")
41
43
  .action(() => {
42
- runCommand(`cross-env DINOU_BUILD_TOOL=rollup node ${p("node/dev.mjs")}`);
44
+ runCommand(`cross-env DINOU_BUILD_TOOL=rollup node ${p("node/dev.js")}`);
43
45
  });
44
46
 
45
47
  program
46
48
  .command("dev:webpack")
47
49
  .description("Start development server with Webpack")
48
50
  .action(() => {
49
- runCommand(`cross-env DINOU_BUILD_TOOL=webpack node ${p("node/dev.mjs")}`);
51
+ runCommand(`cross-env DINOU_BUILD_TOOL=webpack node ${p("node/dev.js")}`);
50
52
  });
51
53
 
52
54
  // --- NODE (BUILD & START) ---
@@ -55,70 +57,70 @@ program
55
57
  .command("build")
56
58
  .description("Build the app for Node.js production (using esbuild)")
57
59
  .action(() => {
58
- runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.mjs")} && node ${p("node/build.mjs")}`);
60
+ runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("node/build.js")}`);
59
61
  });
60
62
 
61
63
  program
62
64
  .command("build:node")
63
65
  .description("Build the app for Node.js production (using esbuild)")
64
66
  .action(() => {
65
- runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.mjs")} && node ${p("node/build.mjs")}`);
67
+ runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("node/build.js")}`);
66
68
  });
67
69
 
68
70
  program
69
71
  .command("build:node:esbuild")
70
72
  .description("Build the app for Node.js with Esbuild")
71
73
  .action(() => {
72
- runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.mjs")} && node ${p("node/build.mjs")}`);
74
+ runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("node/build.js")}`);
73
75
  });
74
76
 
75
77
  program
76
78
  .command("build:node:rollup")
77
79
  .description("Build the app for Node.js with Rollup")
78
80
  .action(() => {
79
- runCommand(`cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && node ${p("node/build.mjs")}`);
81
+ runCommand(`cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && node ${p("node/build.js")}`);
80
82
  });
81
83
 
82
84
  program
83
85
  .command("build:node:webpack")
84
86
  .description("Build the app for Node.js with Webpack")
85
87
  .action(() => {
86
- runCommand(`cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")} && cross-env DINOU_BUILD_TOOL=webpack node ${p("node/build.mjs")}`);
88
+ runCommand(`cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")} && cross-env DINOU_BUILD_TOOL=webpack node ${p("node/build.js")}`);
87
89
  });
88
90
 
89
91
  program
90
92
  .command("start")
91
93
  .description("Start the app in production mode (Node.js)")
92
94
  .action(() => {
93
- runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.mjs")}`);
95
+ runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.js")}`);
94
96
  });
95
97
 
96
98
  program
97
99
  .command("start:node")
98
100
  .description("Start the app in production mode (Node.js)")
99
101
  .action(() => {
100
- runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.mjs")}`);
102
+ runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.js")}`);
101
103
  });
102
104
 
103
105
  program
104
106
  .command("start:node:esbuild")
105
107
  .description("Start the app in production mode (Esbuild build)")
106
108
  .action(() => {
107
- runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.mjs")}`);
109
+ runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.js")}`);
108
110
  });
109
111
 
110
112
  program
111
113
  .command("start:node:rollup")
112
114
  .description("Start the app in production mode (Rollup build)")
113
115
  .action(() => {
114
- runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.mjs")}`);
116
+ runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.js")}`);
115
117
  });
116
118
 
117
119
  program
118
120
  .command("start:node:webpack")
119
121
  .description("Start the app in production mode (Webpack build)")
120
122
  .action(() => {
121
- runCommand(`cross-env NODE_ENV=production DINOU_BUILD_TOOL=webpack node ${p("adapters/node.mjs")}`);
123
+ runCommand(`cross-env NODE_ENV=production DINOU_BUILD_TOOL=webpack node ${p("adapters/node.js")}`);
122
124
  });
123
125
 
124
126
  // --- NODE (COMPILE VIA BUN) ---
@@ -136,10 +138,10 @@ const runNodeBuild = (bundler) => {
136
138
  ? `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")}`
137
139
  : bundler === "webpack"
138
140
  ? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
139
- : `cross-env NODE_ENV=production node ${p("esbuild/build.mjs")}`;
141
+ : `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
140
142
 
141
143
  const envPrefix = bundler === "webpack" ? "cross-env DINOU_BUILD_TOOL=webpack " : "";
142
- return `${bundlerCmd} && ${envPrefix}node ${p("node/build.mjs")}`;
144
+ return `${bundlerCmd} && ${envPrefix}node ${p("node/build.js")}`;
143
145
  };
144
146
 
145
147
  for (const t of nodeTargets) {
@@ -162,12 +164,12 @@ for (const t of nodeTargets) {
162
164
 
163
165
  const runNodePureBuild = (bundler) => {
164
166
  if (bundler === "rollup") {
165
- return `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && bun ${p("node/build.mjs")}`;
167
+ return `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && bun ${p("node/build.js")}`;
166
168
  }
167
169
  if (bundler === "webpack") {
168
- return `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")} && cross-env DINOU_BUILD_TOOL=webpack bun ${p("node/build.mjs")}`;
170
+ return `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")} && cross-env DINOU_BUILD_TOOL=webpack bun ${p("node/build.js")}`;
169
171
  }
170
- return `cross-env NODE_ENV=production bun ${p("esbuild/build.mjs")} && bun ${p("node/build.mjs")}`;
172
+ return `cross-env NODE_ENV=production bun ${p("esbuild/build.js")} && bun ${p("node/build.js")}`;
171
173
  };
172
174
 
173
175
  program
@@ -212,28 +214,28 @@ program
212
214
  .command("build:cloudflare")
213
215
  .description("Build the app for Cloudflare Workers (using esbuild)")
214
216
  .action(() => {
215
- runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.mjs")} && node ${p("cloudflare/build.mjs")}`);
217
+ runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("cloudflare/build.js")}`);
216
218
  });
217
219
 
218
220
  program
219
221
  .command("build:cloudflare:esbuild")
220
222
  .description("Build the app for Cloudflare Workers with Esbuild")
221
223
  .action(() => {
222
- runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.mjs")} && node ${p("cloudflare/build.mjs")}`);
224
+ runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("cloudflare/build.js")}`);
223
225
  });
224
226
 
225
227
  program
226
228
  .command("build:cloudflare:rollup")
227
229
  .description("Build the app for Cloudflare Workers with Rollup")
228
230
  .action(() => {
229
- runCommand(`cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && node ${p("cloudflare/build.mjs")}`);
231
+ runCommand(`cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && node ${p("cloudflare/build.js")}`);
230
232
  });
231
233
 
232
234
  program
233
235
  .command("build:cloudflare:webpack")
234
236
  .description("Build the app for Cloudflare Workers with Webpack")
235
237
  .action(() => {
236
- runCommand(`cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")} && cross-env DINOU_BUILD_TOOL=webpack node ${p("cloudflare/build.mjs")}`);
238
+ runCommand(`cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")} && cross-env DINOU_BUILD_TOOL=webpack node ${p("cloudflare/build.js")}`);
237
239
  });
238
240
 
239
241
  // --- DENO DEPLOY / EDGE ---
@@ -243,10 +245,10 @@ const runDenoBuild = (bundler) => {
243
245
  ? `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")}`
244
246
  : bundler === "webpack"
245
247
  ? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
246
- : `cross-env NODE_ENV=production node ${p("esbuild/build.mjs")}`;
248
+ : `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
247
249
 
248
250
  const envPrefix = bundler === "webpack" ? "cross-env DINOU_BUILD_TOOL=webpack " : "";
249
- return `${bundlerCmd} && ${envPrefix}node ${p("deno/build.mjs")} && deno run --unstable-kv --allow-net --allow-read --allow-write --allow-env ${p("deno/seed-kv.js")}`;
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")}`;
250
252
  };
251
253
 
252
254
  program
@@ -308,10 +310,10 @@ const runBunBuild = (bundler) => {
308
310
  ? `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")}`
309
311
  : bundler === "webpack"
310
312
  ? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
311
- : `cross-env NODE_ENV=production node ${p("esbuild/build.mjs")}`;
313
+ : `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
312
314
 
313
315
  const envPrefix = bundler === "webpack" ? "cross-env DINOU_BUILD_TOOL=webpack " : "";
314
- return `${bundlerCmd} && ${envPrefix}node ${p("bun/build.mjs")}`;
316
+ return `${bundlerCmd} && ${envPrefix}node ${p("bun/build.js")}`;
315
317
  };
316
318
 
317
319
  program
@@ -390,12 +392,12 @@ for (const t of bunTargets) {
390
392
 
391
393
  const runBunPureBuild = (bundler) => {
392
394
  if (bundler === "rollup") {
393
- return `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && bun ${p("bun/build.mjs")}`;
395
+ return `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && bun ${p("bun/build.js")}`;
394
396
  }
395
397
  if (bundler === "webpack") {
396
- return `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")} && cross-env DINOU_BUILD_TOOL=webpack bun ${p("bun/build.mjs")}`;
398
+ return `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")} && cross-env DINOU_BUILD_TOOL=webpack bun ${p("bun/build.js")}`;
397
399
  }
398
- return `cross-env NODE_ENV=production bun ${p("esbuild/build.mjs")} && bun ${p("bun/build.mjs")}`;
400
+ return `cross-env NODE_ENV=production bun ${p("esbuild/build.js")} && bun ${p("bun/build.js")}`;
399
401
  };
400
402
 
401
403
  program
@@ -440,28 +442,28 @@ program
440
442
  .command("export-static")
441
443
  .description("Export standalone static website (using esbuild)")
442
444
  .action(() => {
443
- runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.mjs")} && node ${p("core/export-static.mjs")}`);
445
+ runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("core/export-static.js")}`);
444
446
  });
445
447
 
446
448
  program
447
449
  .command("export-static:esbuild")
448
450
  .description("Export standalone static website with Esbuild")
449
451
  .action(() => {
450
- runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.mjs")} && node ${p("core/export-static.mjs")}`);
452
+ runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("core/export-static.js")}`);
451
453
  });
452
454
 
453
455
  program
454
456
  .command("export-static:rollup")
455
457
  .description("Export standalone static website with Rollup")
456
458
  .action(() => {
457
- runCommand(`cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && node ${p("core/export-static.mjs")}`);
459
+ runCommand(`cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && node ${p("core/export-static.js")}`);
458
460
  });
459
461
 
460
462
  program
461
463
  .command("export-static:webpack")
462
464
  .description("Export standalone static website with Webpack")
463
465
  .action(() => {
464
- runCommand(`cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")} && node ${p("core/export-static.mjs")}`);
466
+ runCommand(`cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")} && node ${p("core/export-static.js")}`);
465
467
  });
466
468
 
467
469
  // --- EJECT ---
@@ -469,9 +471,10 @@ program
469
471
  program
470
472
  .command("eject")
471
473
  .description("Copy the framework to the root of the project")
472
- .action(() => {
473
- console.log("Executing eject...");
474
- require("./eject");
474
+ .action(async () => {
475
+ console.log("Executing eject...");
476
+ const { eject } = await import("./eject.js");
477
+ eject();
475
478
  });
476
479
 
477
480
  program.parse(process.argv);
@@ -6,6 +6,7 @@ Object.assign(process.env, { NODE_ENV: "production" });
6
6
  import path from "node:path";
7
7
  import Module from "node:module";
8
8
 
9
+ const require = Module.createRequire(import.meta.url);
9
10
 
10
11
  let reactServerPath, reactDomServerPath, reactJsxRuntimePath, reactJsxDevRuntimePath;
11
12
  let roggcServerNodePath, webpackServerNodePath;
@@ -1,4 +1,4 @@
1
- // dinou/adapters/node.mjs
1
+ // dinou/adapters/node.js
2
2
  // Native Node.js Pre-Bundled Adapter for Dinou v7.
3
3
  // Serves the standalone pre-bundled server from .dinou/node/server.mjs.
4
4
 
@@ -12,10 +12,16 @@ if (typeof globalThis.AsyncLocalStorage === "undefined" && typeof AsyncLocalStor
12
12
  }
13
13
 
14
14
  const cwd = typeof process !== "undefined" && typeof process.cwd === "function" ? process.cwd() : ".";
15
- const bundlePath = path.resolve(cwd, ".dinou/node/server.mjs");
15
+ let bundlePath = path.resolve(cwd, ".dinou/node/server.js");
16
+ if (!fs.existsSync(bundlePath)) {
17
+ const mjsFallback = path.resolve(cwd, ".dinou/node/server.mjs");
18
+ if (fs.existsSync(mjsFallback)) {
19
+ bundlePath = mjsFallback;
20
+ }
21
+ }
16
22
 
17
23
  if (!fs.existsSync(bundlePath)) {
18
- console.error("❌ [Dinou Node Adapter] .dinou/node/server.mjs not found. Please run 'npm run build:node' first.");
24
+ console.error("❌ [Dinou Node Adapter] .dinou/node/server.js not found. Please run 'npm run build:node' first.");
19
25
  process.exit(1);
20
26
  }
21
27
 
@@ -7,20 +7,19 @@
7
7
  import fs from "node:fs";
8
8
  import path from "node:path";
9
9
  import esbuild from "esbuild";
10
- import { createRequire } from "node:module";
11
10
  import { fileURLToPath, pathToFileURL } from "node:url";
12
11
 
13
- const require = createRequire(import.meta.url);
14
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
15
- const { generateRouteModulesCode, generateRouteTypes } = require("../core/route-generator.js");
16
- const parseExports = require("../core/parse-exports.js");
17
- const { useClientRegex, useServerRegex } = require("../constants.js");
18
- const {
12
+ import { generateRouteModulesCode, generateRouteTypes } from "../core/route-generator.js";
13
+ import parseExports from "../core/parse-exports.js";
14
+ import { useClientRegex, useServerRegex } from "../constants.js";
15
+ import {
19
16
  isSupportedClientModule,
20
17
  scanProjectDependenciesForClientComponents,
21
- } = require("../core/scan-dependency-components.js");
22
- const { getDinouConfig } = require("../core/load-dinou-config.js");
23
- const { resolveSetupFiles } = require("../core/resolve-setup-files.js");
18
+ } from "../core/scan-dependency-components.js";
19
+ import { getDinouConfig } from "../core/load-dinou-config.js";
20
+ import { resolveSetupFiles } from "../core/resolve-setup-files.js";
21
+
22
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
24
23
 
25
24
  const projectRoot = process.cwd();
26
25
  const bunDir = path.resolve(projectRoot, ".dinou/bun");
@@ -669,6 +668,8 @@ fs.writeFileSync(ssrClientManifestPath, ssrManifestCode, "utf8");
669
668
  const rscEntryContent = `// Auto-generated RSC Engine entry for Bun (Dual-Bundle)
670
669
  import "./env-setup.js";
671
670
  import "./route-modules.js";
671
+ import * as edgeRenderer from "react-server-dom-webpack/server.edge";
672
+ globalThis.__DINOU_EDGE_RENDERER__ = edgeRenderer;
672
673
  export { handleRequest } from "${dinouDirSlash}/core/handler.js";
673
674
  `;
674
675
  const rscEntryPath = path.join(bunDir, "rsc-entry.js");
@@ -7,20 +7,19 @@
7
7
  import fs from "node:fs";
8
8
  import path from "node:path";
9
9
  import esbuild from "esbuild";
10
- import { createRequire } from "node:module";
11
10
  import { fileURLToPath, pathToFileURL } from "node:url";
12
11
 
13
- const require = createRequire(import.meta.url);
14
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
15
- const { generateRouteModulesCode, generateRouteTypes } = require("../core/route-generator.js");
16
- const parseExports = require("../core/parse-exports.js");
17
- const { useClientRegex, useServerRegex } = require("../constants.js");
18
- const {
12
+ import { generateRouteModulesCode, generateRouteTypes } from "../core/route-generator.js";
13
+ import parseExports from "../core/parse-exports.js";
14
+ import { useClientRegex, useServerRegex } from "../constants.js";
15
+ import {
19
16
  isSupportedClientModule,
20
17
  scanProjectDependenciesForClientComponents,
21
- } = require("../core/scan-dependency-components.js");
22
- const { getDinouConfig } = require("../core/load-dinou-config.js");
23
- const { resolveSetupFiles } = require("../core/resolve-setup-files.js");
18
+ } from "../core/scan-dependency-components.js";
19
+ import { getDinouConfig } from "../core/load-dinou-config.js";
20
+ import { resolveSetupFiles } from "../core/resolve-setup-files.js";
21
+
22
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
24
23
 
25
24
  const projectRoot = process.cwd();
26
25
  const cloudflareDir = path.resolve(projectRoot, ".dinou/cloudflare");
@@ -696,6 +695,8 @@ fs.writeFileSync(ssrClientManifestPath, ssrManifestCode, "utf8");
696
695
  const rscEntryContent = `// Auto-generated RSC Engine entry for Cloudflare Workers
697
696
  import "./env-setup.js";
698
697
  import "./route-modules.js";
698
+ import * as edgeRenderer from "react-server-dom-webpack/server.edge";
699
+ globalThis.__DINOU_EDGE_RENDERER__ = edgeRenderer;
699
700
  export { handleRequest } from "${dinouDirSlash}/core/handler.js";
700
701
  `;
701
702
  const rscEntryPath = path.join(cloudflareDir, "rsc-entry.js");
@@ -1070,6 +1071,7 @@ try {
1070
1071
  "process.env.NODE_ENV": '"production"',
1071
1072
  "process.env.DINOU_RUNTIME": '"edge"',
1072
1073
  "process.env.DINOU_BUILD_TOOL": JSON.stringify(isWebpackBuild ? "webpack" : (process.env.DINOU_BUILD_TOOL || "esbuild")),
1074
+ "import.meta.url": '"file:///worker.js"',
1073
1075
  },
1074
1076
  logLevel: "warning",
1075
1077
  });
@@ -1094,6 +1096,7 @@ try {
1094
1096
  "process.env.NODE_ENV": '"production"',
1095
1097
  "process.env.DINOU_RUNTIME": '"edge"',
1096
1098
  "process.env.DINOU_BUILD_TOOL": JSON.stringify(isWebpackBuild ? "webpack" : (process.env.DINOU_BUILD_TOOL || "esbuild")),
1099
+ "import.meta.url": '"file:///worker.js"',
1097
1100
  },
1098
1101
  logLevel: "warning",
1099
1102
  });
@@ -1118,6 +1121,7 @@ try {
1118
1121
  "process.env.NODE_ENV": '"production"',
1119
1122
  "process.env.DINOU_RUNTIME": '"edge"',
1120
1123
  "process.env.DINOU_BUILD_TOOL": JSON.stringify(isWebpackBuild ? "webpack" : (process.env.DINOU_BUILD_TOOL || "esbuild")),
1124
+ "import.meta.url": '"file:///worker.js"',
1121
1125
  },
1122
1126
  logLevel: "warning",
1123
1127
  });
@@ -77,6 +77,7 @@ export const statSync = (p) => {
77
77
  export const mkdirSync = () => {};
78
78
  export const writeFileSync = () => {};
79
79
  export const rmSync = () => {};
80
+ export const copyFileSync = () => {};
80
81
 
81
82
  export const promises = {
82
83
  readFile: async (p) => readFileSync(p),
@@ -85,6 +86,7 @@ export const promises = {
85
86
  stat: async (p) => statSync(p),
86
87
  mkdir: async () => {},
87
88
  rm: async () => {},
89
+ copyFile: async () => {},
88
90
  };
89
91
 
90
92
  export default {
@@ -95,5 +97,6 @@ export default {
95
97
  mkdirSync,
96
98
  writeFileSync,
97
99
  rmSync,
100
+ copyFileSync,
98
101
  promises,
99
102
  };
@@ -11,7 +11,7 @@ function hasDirective(code, directive) {
11
11
  );
12
12
  }
13
13
 
14
- const useClientRegex = {
14
+ export const useClientRegex = {
15
15
  test(code) {
16
16
  return hasDirective(code, "use client");
17
17
  },
@@ -20,7 +20,7 @@ const useClientRegex = {
20
20
  },
21
21
  };
22
22
 
23
- const useServerRegex = {
23
+ export const useServerRegex = {
24
24
  test(code) {
25
25
  return hasDirective(code, "use server");
26
26
  },
@@ -29,4 +29,4 @@ const useServerRegex = {
29
29
  },
30
30
  };
31
31
 
32
- module.exports = { useClientRegex, useServerRegex };
32
+ export default { useClientRegex, useServerRegex };
@@ -1,4 +1,4 @@
1
- const extensions = [
1
+ export const extensions = [
2
2
  "png",
3
3
  "jpg",
4
4
  "jpeg",
@@ -22,12 +22,12 @@ const extensions = [
22
22
  "mjpg",
23
23
  ];
24
24
 
25
- const globPattern = `**/*.{${extensions.join(",")}}`;
25
+ export const globPattern = `**/*.{${extensions.join(",")}}`;
26
26
 
27
27
  // 🔹 regex useful for Rollup/PostCSS type plugins
28
- const regex = new RegExp(`\\.(${extensions.join("|")})$`, "i");
28
+ export const regex = new RegExp(`\\.(${extensions.join("|")})$`, "i");
29
29
 
30
30
  // 🔹 version with dot for direct comparisons
31
- const extensionsWithDot = extensions.map((ext) => `.${ext}`);
31
+ export const extensionsWithDot = extensions.map((ext) => `.${ext}`);
32
32
 
33
- module.exports = { extensions, extensionsWithDot, regex, globPattern };
33
+ export default { extensions, extensionsWithDot, regex, globPattern };
@@ -1,4 +1,4 @@
1
- const { isPprBuildActive, isInsideSuspense, markDynamicAccess } = require("./ppr-context.js");
1
+ import { isPprBuildActive, isInsideSuspense, markDynamicAccess } from "./ppr-context.js";
2
2
 
3
3
  function triggerBailout(label, onBailout) {
4
4
  if (isPprBuildActive() && isInsideSuspense()) {
@@ -17,7 +17,7 @@ function triggerBailout(label, onBailout) {
17
17
  * @param {Function} onBailout - Callback invoked when property access occurs
18
18
  * @returns {Proxy}
19
19
  */
20
- function createBailoutProxy(target, label = "Context", onBailout) {
20
+ export function createBailoutProxy(target, label = "Context", onBailout) {
21
21
  const safeTarget = target || {};
22
22
 
23
23
  return new Proxy(safeTarget, {
@@ -56,6 +56,6 @@ function createBailoutProxy(target, label = "Context", onBailout) {
56
56
  });
57
57
  }
58
58
 
59
- module.exports = {
59
+ export default {
60
60
  createBailoutProxy,
61
61
  };
@@ -1,16 +1,15 @@
1
- const path = require("path");
2
- const { existsSync, readdirSync, mkdirSync, rmSync } = require("fs");
3
- const React = require("react");
4
- const { asyncRenderJSXToClientJSX } = require("./render-jsx-to-client-jsx");
5
- const {
6
- getFilePathAndDynamicParams,
7
- } = require("./get-file-path-and-dynamic-params");
8
- const importModule = require("./import-module");
9
- const { requestStorage } = require("./request-context.js");
10
- const { getLayoutProps, resolveLayoutFunctionsConfig } = require("./layout-functions");
11
- const { runWithPprContext, getRegisteredHoles } = require("./ppr-context.js");
12
- const { resolveModulePpr } = require("./resolve-module-ppr");
13
- const { getDinouConfig } = require("./load-dinou-config");
1
+ import path from "node:path";
2
+ import { existsSync, readdirSync, mkdirSync, rmSync } from "node:fs";
3
+ import React from "react";
4
+ import { asyncRenderJSXToClientJSX } from "./render-jsx-to-client-jsx.js";
5
+ import { getFilePathAndDynamicParams } from "./get-file-path-and-dynamic-params.js";
6
+ import importModule from "./import-module.js";
7
+ import { requestStorage } from "./request-context.js";
8
+ import { getLayoutProps, resolveLayoutFunctionsConfig, getLayoutFunctionsPath } from "./layout-functions.js";
9
+ import { runWithPprContext, getRegisteredHoles } from "./ppr-context.js";
10
+ import { resolveModulePpr } from "./resolve-module-ppr.js";
11
+ import { getDinouConfig } from "./load-dinou-config.js";
12
+ import { createBailoutProxy } from "./bailout-proxy.js";
14
13
 
15
14
  async function resolveBuildPprForRoute(segments, pagePath, pageFunctionsPath, srcFolder) {
16
15
  const globalCfg = await getDinouConfig();
@@ -76,7 +75,6 @@ async function isDynamicRoute(revalidate) {
76
75
  return typeof val === "number" && val < 1;
77
76
  }
78
77
 
79
- const { createBailoutProxy } = require("./bailout-proxy.js");
80
78
 
81
79
  /**
82
80
  * Compiles all static pages in the application.
@@ -108,7 +106,6 @@ async function buildStaticPages(onProgress = null) {
108
106
  const candidateLayout = path.join(currentPath, `layout${ext}`);
109
107
  if (existsSync(candidateLayout)) {
110
108
  const routePath = segments.length ? "/" + segments.join("/") : "/";
111
- const { resolveLayoutFunctionsConfig } = require("./layout-functions");
112
109
  const layoutConfig = await resolveLayoutFunctionsConfig(candidateLayout, params);
113
110
  if (!layoutConfig.isDynamic) {
114
111
  staticLayouts.set(routePath, {
@@ -552,7 +549,6 @@ async function buildStaticPages(onProgress = null) {
552
549
  getStaticPaths = module.getStaticPaths || defMod?.getStaticPaths;
553
550
  revalidate = module.revalidate || defMod?.revalidate;
554
551
  }
555
- const { getLayoutFunctionsPath } = require("./layout-functions");
556
552
  const lfPath = getLayoutFunctionsPath(dynamicPath);
557
553
  if (lfPath) {
558
554
  const lmod = await importModule(lfPath);
@@ -1507,7 +1503,15 @@ function getStaticLayouts() {
1507
1503
  return Array.from(staticLayouts.values());
1508
1504
  }
1509
1505
 
1510
- module.exports = {
1506
+ export {
1507
+ buildStaticPages,
1508
+ buildStaticPage,
1509
+ getStaticPaths,
1510
+ getStaticMetadata,
1511
+ getStaticLayouts,
1512
+ isDynamicRoute,
1513
+ };
1514
+ export default {
1511
1515
  buildStaticPages,
1512
1516
  buildStaticPage,
1513
1517
  getStaticPaths,