dinou 7.2.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.
- package/CHANGELOG.md +37 -0
- package/README.md +1 -1
- package/cli.js +124 -121
- package/dinou/adapters/netlify.js +1 -0
- package/dinou/adapters/{node.mjs → node.js} +9 -3
- package/dinou/bun/{build.mjs → build.js} +20 -8
- package/dinou/cloudflare/{build.mjs → build.js} +23 -8
- package/dinou/cloudflare/shims/fs.js +3 -0
- package/dinou/constants.js +3 -3
- package/dinou/core/asset-extensions.js +5 -5
- package/dinou/core/bailout-proxy.js +3 -3
- package/dinou/core/build-static-pages.js +21 -17
- package/dinou/core/cache-revalidate.js +14 -33
- package/dinou/core/cache-slot.js +21 -10
- package/dinou/core/config.js +2 -5
- package/dinou/core/createScopedName.js +3 -3
- package/dinou/core/dinou-paths.js +15 -12
- package/dinou/core/generate-route-types.js +8 -3
- package/dinou/core/generate-static-page.js +6 -5
- package/dinou/core/generate-static-rsc.js +15 -10
- package/dinou/core/generate-static.js +11 -10
- package/dinou/core/generating-isg.js +12 -11
- package/dinou/core/get-abs-path-with-ext.js +8 -6
- package/dinou/core/get-asset-from-manifest.js +4 -4
- package/dinou/core/get-error-jsx.js +12 -9
- package/dinou/core/get-file-path-and-dynamic-params.js +7 -4
- package/dinou/core/get-jsx.js +19 -13
- package/dinou/core/handler.js +73 -33
- package/dinou/core/http-adapter.js +6 -2
- package/dinou/core/import-module.js +5 -4
- package/dinou/core/layout-functions.js +11 -6
- package/dinou/core/load-dinou-config.js +10 -4
- package/dinou/core/manifest-provider.js +11 -4
- package/dinou/core/parse-exports.js +11 -6
- package/dinou/core/path-utils.js +2 -2
- package/dinou/core/ppr-context.js +11 -11
- package/dinou/core/ppr-runtime.js +10 -6
- package/dinou/core/render-jsx-to-client-jsx.js +6 -3
- package/dinou/core/request-context.js +11 -7
- package/dinou/core/resolve-module-ppr.js +2 -2
- package/dinou/core/resolve-setup-files.js +70 -0
- package/dinou/core/revalidating.js +14 -25
- package/dinou/core/route-generator.js +12 -8
- package/dinou/core/rsc-renderer.js +13 -2
- package/dinou/core/run-ssg.js +9 -4
- package/dinou/core/safe-rename.js +3 -3
- package/dinou/core/scan-dependency-components.js +9 -3
- package/dinou/core/status-manifest.js +5 -5
- package/dinou/core/storage-adapter.js +13 -3
- package/dinou/core/url-resolver.js +2 -2
- package/dinou/core/vfs.js +7 -7
- package/dinou/deno/{build.mjs → build.js} +20 -8
- package/dinou/esbuild/{build.mjs → build.js} +4 -4
- package/dinou/esbuild/{dev.mjs → dev.js} +6 -6
- package/dinou/esbuild/helpers-esbuild/{get-config-esbuild-prod.mjs → get-config-esbuild-prod.js} +7 -7
- package/dinou/esbuild/helpers-esbuild/{get-config-esbuild.mjs → get-config-esbuild.js} +8 -8
- package/dinou/esbuild/helpers-esbuild/{get-esbuild-entries.mjs → get-esbuild-entries.js} +2 -2
- package/dinou/esbuild/plugins-esbuild/{assets-plugin.mjs → assets-plugin.js} +1 -1
- package/dinou/esbuild/plugins-esbuild/{stable-chunk-names-and-maps-plugin.mjs → stable-chunk-names-and-maps-plugin.js} +1 -1
- package/dinou/esbuild/plugins-esbuild/{write-plugin.mjs → write-plugin.js} +1 -1
- package/dinou/esbuild/plugins-postcss/postcss-extract-plugin.js +4 -3
- package/dinou/esbuild/react-refresh/babel-config.js +5 -1
- package/dinou/esbuild/react-refresh/esm-hmr/server.js +7 -4
- package/dinou/esbuild/react-refresh/{esm-hmr-plugin.mjs → esm-hmr-plugin.js} +4 -4
- package/dinou/esbuild/react-refresh/{react-refresh-runtime.mjs → react-refresh-runtime.js} +1 -1
- package/dinou/index.d.ts +13 -0
- package/dinou/index.js +40 -19
- package/dinou/node/{build.mjs → build.js} +10 -6
- package/dinou/node/{bundle-dual-engine.mjs → bundle-dual-engine.js} +22 -10
- package/dinou/node/{dev.mjs → dev.js} +43 -20
- package/dinou/package.json +8 -7
- package/dinou/rollup/postcss.config.js +1 -1
- package/dinou/rollup/react-refresh/esm-hmr/server.js +7 -4
- package/dinou/rollup/react-refresh/react-refresh-wrap-modules.js +2 -1
- package/dinou/rollup/react-refresh/rollup-plugin-esm-hmr.js +23 -16
- package/dinou/rollup/rollup-plugins/dinou-asset-plugin.js +6 -5
- package/dinou/rollup/rollup-plugins/manifest-generator-plugin.js +2 -1
- package/dinou/rollup/rollup-plugins/rollup-plugin-memory.js +3 -2
- package/dinou/rollup/rollup-plugins/rollup-plugin-react-client-manifest.js +16 -13
- package/dinou/rollup/rollup-plugins/rollup-plugin-server-functions.js +7 -6
- package/dinou/rollup/rollup-plugins/rollup-plugin-swc.js +6 -3
- package/dinou/rollup/rollup.config.js +27 -23
- package/dinou/server.js +21 -26
- package/dinou/webpack/helpers/get-webpack-entries.js +14 -11
- package/dinou/webpack/loaders/server-functions-loader.js +5 -6
- package/dinou/webpack/loaders/swc-loader.js +4 -2
- package/dinou/webpack/plugins/manifest-generator-plugin.js +3 -1
- package/dinou/webpack/plugins/server-functions-plugin.js +4 -3
- package/dinou/webpack/plugins/webpack-memory-plugin.js +3 -2
- package/dinou/webpack/postcss.config.js +1 -1
- package/dinou/webpack/webpack.config.js +22 -20
- package/eject.js +198 -191
- package/package.json +111 -110
- package/dinou/config.js +0 -1
- package/dinou/config.mjs +0 -2
- package/dinou/core/css-require-hook.js +0 -64
- package/dinou/index.mjs +0 -43
- package/dinou/server.mjs +0 -30
- /package/dinou/core/{export-static.mjs → export-static.js} +0 -0
- /package/dinou/esbuild/helpers-esbuild/{normalize-path.mjs → normalize-path.js} +0 -0
- /package/dinou/esbuild/helpers-esbuild/{strip-namespace.mjs → strip-namespace.js} +0 -0
- /package/dinou/esbuild/helpers-esbuild/{swc-disk-cache.mjs → swc-disk-cache.js} +0 -0
- /package/dinou/esbuild/helpers-esbuild/{update-manifest-for-module.mjs → update-manifest-for-module.js} +0 -0
- /package/dinou/esbuild/helpers-esbuild/{write.mjs → write.js} +0 -0
- /package/dinou/esbuild/plugins-esbuild/{babel-react-compiler-plugin.mjs → babel-react-compiler-plugin.js} +0 -0
- /package/dinou/esbuild/plugins-esbuild/{css-processor-plugin.mjs → css-processor-plugin.js} +0 -0
- /package/dinou/esbuild/plugins-esbuild/{manifest-generator-plugin.mjs → manifest-generator-plugin.js} +0 -0
- /package/dinou/esbuild/plugins-esbuild/{react-client-manifest-plugin.mjs → react-client-manifest-plugin.js} +0 -0
- /package/dinou/esbuild/plugins-esbuild/{server-functions-plugin.mjs → server-functions-plugin.js} +0 -0
- /package/dinou/esbuild/plugins-esbuild/{skip-missing-entry-points-plugin.mjs → skip-missing-entry-points-plugin.js} +0 -0
- /package/dinou/esbuild/react-refresh/esm-hmr/{client.mjs → client.js} +0 -0
- /package/dinou/esbuild/react-refresh/{is-react-refresh-boundary.mjs → is-react-refresh-boundary.js} +0 -0
- /package/dinou/node/{port-selector.mjs → port-selector.js} +0 -0
- /package/dinou/node/{terminal-status.mjs → terminal-status.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,43 @@ 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
|
+
|
|
30
|
+
## [7.3.0]
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
- **Universal Setup Files & Environment Polyfills**:
|
|
34
|
+
- Early-stage execution guarantee: Setup scripts are injected at Line 1 of all compilation bundles before any module imports or engine code run, enabling browser/canvas polyfills (`DOMMatrix`, `ImageData`, `Path2D`) and APM/telemetry agents without ejecting.
|
|
35
|
+
- Unified configuration hierarchy: `plugin.setupFiles` (plugins run first) -> explicit `setupFiles: [...]` in `dinou.config.*` (strict source of truth; replaces convention) -> zero-config root convention `./dinou.setup.(mjs|js|ts)`.
|
|
36
|
+
- Comprehensive multi-platform support: Injected uniformly across Node.js (`Pass A`, `Pass B`, `Pass C`), Bun native AOT, Cloudflare Workers, Deno / Deno Deploy, Static Site Generation (SSG), and Hot-Reload Dev Server.
|
|
37
|
+
- Added TypeScript definitions for `setupFiles?: string[]` in both `DinouConfig` and `DinouPlugin`.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
- **Bun Standalone Compilation Port Collision (`EADDRINUSE`)**:
|
|
41
|
+
- Resolved port binding conflict when compiling the Node.js orchestrator into a standalone executable using `bun build --compile`.
|
|
42
|
+
- Separated exports in `.dinou/node/server.mjs`: `fetch` is now exported exclusively as a named export (`export { fetch }`), while `export default` exposes `{ port, startServer }`, preventing Bun's runtime from launching a duplicate background `Bun.serve` instance over Node's `http.createServer()`.
|
|
43
|
+
- Robust `isMain` execution detection supporting both Node.js (`process.argv[1]`) and compiled Bun binaries (`import.meta.main`).
|
|
44
|
+
|
|
8
45
|
## [7.2.0]
|
|
9
46
|
|
|
10
47
|
### Added
|
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
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
51
|
+
runCommand(`cross-env DINOU_BUILD_TOOL=webpack node ${p("node/dev.js")}`);
|
|
50
52
|
});
|
|
51
53
|
|
|
52
54
|
// --- NODE (BUILD & START) ---
|
|
@@ -55,185 +57,185 @@ 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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
123
|
+
runCommand(`cross-env NODE_ENV=production DINOU_BUILD_TOOL=webpack node ${p("adapters/node.js")}`);
|
|
122
124
|
});
|
|
123
125
|
|
|
124
|
-
// --- NODE (COMPILE VIA BUN) ---
|
|
125
|
-
|
|
126
|
-
const nodeTargets = [
|
|
127
|
-
{ name: "", flags: "", outfile: "dist/server" },
|
|
128
|
-
{ name: ":linux", flags: "--target=bun-linux-x64 ", outfile: "dist/server-linux" },
|
|
129
|
-
{ name: ":linux_arm", flags: "--target=bun-linux-arm64 ", outfile: "dist/server-linux-arm" },
|
|
130
|
-
{ name: ":mac", flags: "--target=bun-darwin-arm64 ", outfile: "dist/server-mac" },
|
|
131
|
-
{ name: ":win", flags: "--target=bun-windows-x64 ", outfile: "dist/server-win" },
|
|
132
|
-
];
|
|
133
|
-
|
|
134
|
-
const runNodeBuild = (bundler) => {
|
|
135
|
-
const bundlerCmd = bundler === "rollup"
|
|
136
|
-
? `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")}`
|
|
137
|
-
: bundler === "webpack"
|
|
138
|
-
? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
|
|
139
|
-
: `cross-env NODE_ENV=production node ${p("esbuild/build.
|
|
140
|
-
|
|
141
|
-
const envPrefix = bundler === "webpack" ? "cross-env DINOU_BUILD_TOOL=webpack " : "";
|
|
142
|
-
return `${bundlerCmd} && ${envPrefix}node ${p("node/build.
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
for (const t of nodeTargets) {
|
|
146
|
-
for (const b of ["esbuild", "rollup", "webpack"]) {
|
|
147
|
-
const cmdNames = b === "esbuild"
|
|
148
|
-
? [`build:node:compile${t.name}`, `build:node:compile${t.name}:esbuild`]
|
|
149
|
-
: [`build:node:compile${t.name}:${b}`];
|
|
150
|
-
for (const cmdName of cmdNames) {
|
|
151
|
-
program
|
|
152
|
-
.command(cmdName)
|
|
153
|
-
.description(`Compile standalone Node.js server executable with Bun (${t.name || "host"}, ${b})`)
|
|
154
|
-
.action(() => {
|
|
155
|
-
runCommand(`${runNodeBuild(b)} && bun build --compile ${t.flags}.dinou/node/server.mjs --outfile ${t.outfile}`);
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// --- NODE (PURE BUN RUNNER COMPILE) ---
|
|
162
|
-
|
|
163
|
-
const runNodePureBuild = (bundler) => {
|
|
164
|
-
if (bundler === "rollup") {
|
|
165
|
-
return `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && bun ${p("node/build.
|
|
166
|
-
}
|
|
167
|
-
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.
|
|
169
|
-
}
|
|
170
|
-
return `cross-env NODE_ENV=production bun ${p("esbuild/build.
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
program
|
|
174
|
-
.command("build:node:pure")
|
|
175
|
-
.description("Build the app for Node.js with 100% Bun (using esbuild)")
|
|
176
|
-
.action(() => { runCommand(runNodePureBuild("esbuild")); });
|
|
177
|
-
|
|
178
|
-
program
|
|
179
|
-
.command("build:node:pure:esbuild")
|
|
180
|
-
.description("Build the app for Node.js with 100% Bun (Esbuild)")
|
|
181
|
-
.action(() => { runCommand(runNodePureBuild("esbuild")); });
|
|
182
|
-
|
|
183
|
-
program
|
|
184
|
-
.command("build:node:pure:rollup")
|
|
185
|
-
.description("Build the app for Node.js with 100% Bun (Rollup)")
|
|
186
|
-
.action(() => { runCommand(runNodePureBuild("rollup")); });
|
|
187
|
-
|
|
188
|
-
program
|
|
189
|
-
.command("build:node:pure:webpack")
|
|
190
|
-
.description("Build the app for Node.js with 100% Bun (Webpack)")
|
|
191
|
-
.action(() => { runCommand(runNodePureBuild("webpack")); });
|
|
192
|
-
|
|
193
|
-
for (const t of nodeTargets) {
|
|
194
|
-
for (const b of ["esbuild", "rollup", "webpack"]) {
|
|
195
|
-
const cmdNames = b === "esbuild"
|
|
196
|
-
? [`build:node:pure:compile${t.name}`, `build:node:pure:compile${t.name}:esbuild`]
|
|
197
|
-
: [`build:node:pure:compile${t.name}:${b}`];
|
|
198
|
-
for (const cmdName of cmdNames) {
|
|
199
|
-
program
|
|
200
|
-
.command(cmdName)
|
|
201
|
-
.description(`Compile standalone Node.js server executable with 100% Bun (${t.name || "host"}, ${b})`)
|
|
202
|
-
.action(() => {
|
|
203
|
-
runCommand(`${runNodePureBuild(b)} && bun build --compile ${t.flags}.dinou/node/server.mjs --outfile ${t.outfile}`);
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
126
|
+
// --- NODE (COMPILE VIA BUN) ---
|
|
127
|
+
|
|
128
|
+
const nodeTargets = [
|
|
129
|
+
{ name: "", flags: "", outfile: "dist/server" },
|
|
130
|
+
{ name: ":linux", flags: "--target=bun-linux-x64 ", outfile: "dist/server-linux" },
|
|
131
|
+
{ name: ":linux_arm", flags: "--target=bun-linux-arm64 ", outfile: "dist/server-linux-arm" },
|
|
132
|
+
{ name: ":mac", flags: "--target=bun-darwin-arm64 ", outfile: "dist/server-mac" },
|
|
133
|
+
{ name: ":win", flags: "--target=bun-windows-x64 ", outfile: "dist/server-win" },
|
|
134
|
+
];
|
|
135
|
+
|
|
136
|
+
const runNodeBuild = (bundler) => {
|
|
137
|
+
const bundlerCmd = bundler === "rollup"
|
|
138
|
+
? `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")}`
|
|
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")}`;
|
|
142
|
+
|
|
143
|
+
const envPrefix = bundler === "webpack" ? "cross-env DINOU_BUILD_TOOL=webpack " : "";
|
|
144
|
+
return `${bundlerCmd} && ${envPrefix}node ${p("node/build.js")}`;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
for (const t of nodeTargets) {
|
|
148
|
+
for (const b of ["esbuild", "rollup", "webpack"]) {
|
|
149
|
+
const cmdNames = b === "esbuild"
|
|
150
|
+
? [`build:node:compile${t.name}`, `build:node:compile${t.name}:esbuild`]
|
|
151
|
+
: [`build:node:compile${t.name}:${b}`];
|
|
152
|
+
for (const cmdName of cmdNames) {
|
|
153
|
+
program
|
|
154
|
+
.command(cmdName)
|
|
155
|
+
.description(`Compile standalone Node.js server executable with Bun (${t.name || "host"}, ${b})`)
|
|
156
|
+
.action(() => {
|
|
157
|
+
runCommand(`${runNodeBuild(b)} && bun build --compile ${t.flags}.dinou/node/server.mjs --outfile ${t.outfile}`);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// --- NODE (PURE BUN RUNNER COMPILE) ---
|
|
164
|
+
|
|
165
|
+
const runNodePureBuild = (bundler) => {
|
|
166
|
+
if (bundler === "rollup") {
|
|
167
|
+
return `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && bun ${p("node/build.js")}`;
|
|
168
|
+
}
|
|
169
|
+
if (bundler === "webpack") {
|
|
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")}`;
|
|
171
|
+
}
|
|
172
|
+
return `cross-env NODE_ENV=production bun ${p("esbuild/build.js")} && bun ${p("node/build.js")}`;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
program
|
|
176
|
+
.command("build:node:pure")
|
|
177
|
+
.description("Build the app for Node.js with 100% Bun (using esbuild)")
|
|
178
|
+
.action(() => { runCommand(runNodePureBuild("esbuild")); });
|
|
179
|
+
|
|
180
|
+
program
|
|
181
|
+
.command("build:node:pure:esbuild")
|
|
182
|
+
.description("Build the app for Node.js with 100% Bun (Esbuild)")
|
|
183
|
+
.action(() => { runCommand(runNodePureBuild("esbuild")); });
|
|
184
|
+
|
|
185
|
+
program
|
|
186
|
+
.command("build:node:pure:rollup")
|
|
187
|
+
.description("Build the app for Node.js with 100% Bun (Rollup)")
|
|
188
|
+
.action(() => { runCommand(runNodePureBuild("rollup")); });
|
|
189
|
+
|
|
190
|
+
program
|
|
191
|
+
.command("build:node:pure:webpack")
|
|
192
|
+
.description("Build the app for Node.js with 100% Bun (Webpack)")
|
|
193
|
+
.action(() => { runCommand(runNodePureBuild("webpack")); });
|
|
194
|
+
|
|
195
|
+
for (const t of nodeTargets) {
|
|
196
|
+
for (const b of ["esbuild", "rollup", "webpack"]) {
|
|
197
|
+
const cmdNames = b === "esbuild"
|
|
198
|
+
? [`build:node:pure:compile${t.name}`, `build:node:pure:compile${t.name}:esbuild`]
|
|
199
|
+
: [`build:node:pure:compile${t.name}:${b}`];
|
|
200
|
+
for (const cmdName of cmdNames) {
|
|
201
|
+
program
|
|
202
|
+
.command(cmdName)
|
|
203
|
+
.description(`Compile standalone Node.js server executable with 100% Bun (${t.name || "host"}, ${b})`)
|
|
204
|
+
.action(() => {
|
|
205
|
+
runCommand(`${runNodePureBuild(b)} && bun build --compile ${t.flags}.dinou/node/server.mjs --outfile ${t.outfile}`);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
209
211
|
// --- CLOUDFLARE WORKERS ---
|
|
210
212
|
|
|
211
213
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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,23 +7,30 @@
|
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
}
|
|
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));
|
|
22
23
|
|
|
23
24
|
const projectRoot = process.cwd();
|
|
24
25
|
const bunDir = path.resolve(projectRoot, ".dinou/bun");
|
|
25
26
|
fs.mkdirSync(bunDir, { recursive: true });
|
|
26
27
|
|
|
28
|
+
const dinouConfig = await getDinouConfig(projectRoot);
|
|
29
|
+
const setupFiles = resolveSetupFiles(projectRoot, dinouConfig);
|
|
30
|
+
if (setupFiles.length > 0) {
|
|
31
|
+
console.log(` 🔌 [Dinou Setup] Active setup files (${setupFiles.length}): ${setupFiles.map((f) => path.basename(f)).join(", ")}`);
|
|
32
|
+
}
|
|
33
|
+
|
|
27
34
|
try {
|
|
28
35
|
generateRouteTypes(projectRoot);
|
|
29
36
|
} catch (e) {}
|
|
@@ -661,6 +668,8 @@ fs.writeFileSync(ssrClientManifestPath, ssrManifestCode, "utf8");
|
|
|
661
668
|
const rscEntryContent = `// Auto-generated RSC Engine entry for Bun (Dual-Bundle)
|
|
662
669
|
import "./env-setup.js";
|
|
663
670
|
import "./route-modules.js";
|
|
671
|
+
import * as edgeRenderer from "react-server-dom-webpack/server.edge";
|
|
672
|
+
globalThis.__DINOU_EDGE_RENDERER__ = edgeRenderer;
|
|
664
673
|
export { handleRequest } from "${dinouDirSlash}/core/handler.js";
|
|
665
674
|
`;
|
|
666
675
|
const rscEntryPath = path.join(bunDir, "rsc-entry.js");
|
|
@@ -1012,6 +1021,7 @@ try {
|
|
|
1012
1021
|
alias: commonAlias,
|
|
1013
1022
|
loader: commonLoader,
|
|
1014
1023
|
jsx: "automatic",
|
|
1024
|
+
inject: setupFiles.length > 0 ? setupFiles : undefined,
|
|
1015
1025
|
define: {
|
|
1016
1026
|
"process.env.NODE_ENV": '"production"',
|
|
1017
1027
|
"process.env.DINOU_RUNTIME": '"bun-bundle"',
|
|
@@ -1035,6 +1045,7 @@ try {
|
|
|
1035
1045
|
alias: commonAlias,
|
|
1036
1046
|
loader: commonLoader,
|
|
1037
1047
|
jsx: "automatic",
|
|
1048
|
+
inject: setupFiles.length > 0 ? setupFiles : undefined,
|
|
1038
1049
|
define: {
|
|
1039
1050
|
"process.env.NODE_ENV": '"production"',
|
|
1040
1051
|
"process.env.DINOU_RUNTIME": '"bun-bundle"',
|
|
@@ -1056,6 +1067,7 @@ try {
|
|
|
1056
1067
|
conditions: ["bun", "worker", "browser"],
|
|
1057
1068
|
external: externalList,
|
|
1058
1069
|
banner,
|
|
1070
|
+
inject: setupFiles.length > 0 ? setupFiles : undefined,
|
|
1059
1071
|
alias: commonAlias,
|
|
1060
1072
|
loader: commonLoader,
|
|
1061
1073
|
define: {
|