Eject Dinou
Gain complete ownership over your technology stack. Eject Dinou to unpack the entire React 19 Dual-Bundle compiler, runtime adapters, and server streaming engine directly into your repository—and revert anytime with a single command.
Ejecting Dinou: Framework Sovereignty
In most modern web frameworks, the server runtime, bundling logic, and React Server Component compiler are hidden behind opaque node_modules dependencies. If you encounter an edge-case bug, need a bespoke compilation transform, or want to deploy to an unsupported infrastructure, you are forced to wait for upstream releases or maintain fragile monkey-patches.
Ejecting extracts the entire framework into a local ./dinou directory at the root of your project, making your tech stack 100% transparent and editable—while keeping your application code in src/ untouched and allowing you to revert back to node_modules/dinou whenever you want via npm run uneject.
How to Eject (CLI & Scripts)
You can eject Dinou at any point in your project lifecycle with a single command:
# Using the Dinou CLI directly (npm, pnpm, yarn, or bun)
npx dinou eject
# Or using your package.json script (included in create-dinou starters)
npm run ejectOnce ejected, running dinou eject again safely exits without overwriting your local ./dinou customizations.
What Happens When You Eject?
When you run dinou eject, Dinou executes five automated steps across npm, pnpm, yarn, and bun:
Framework Source Extraction
Copies the complete Dinou engine into ./dinou at your project root—including the universal HTTP handler, Dual-Bundle RSC/SSR compilers, all three client bundlers (Esbuild, Rollup, and Webpack), all five runtime targets, TypeScript .d.ts definitions, and the 31 pre-compiled ESM toolchain vendors.
Selective Script Rewriting (Preserving Your package.json)
Inspects your existing package.json "scripts" and rewrites only the Dinou scripts you already had (e.g. "dev": "node dinou/cli.js dev", "build": "node dinou/cli.js build", "start": "node dinou/cli.js start")—leaving custom scripts like lint or test untouched—while replacing "eject" with "build:vendors" and "uneject".
Local Workspace Linking ("dinou": "file:./dinou")
Points dependencies.dinou to "file:./dinou", cleans up any duplicate entry in devDependencies, and automatically detects your package manager (npm, pnpm, yarn, or bun) to link all transitive peer/runtime dependencies and IDE TypeScript types.
Direct Live Module Resolution Across All Bundlers
Esbuild, Rollup, Webpack, and the server Dual-Bundle compilers automatically detect ./dinou and resolve "dinou", "dinou/server", "dinou/config", and "dinou/adapters/*" directly to your local ./dinou source files—even under pnpm or yarn where file:./dinou creates a static snapshot in node_modules. Every edit inside ./dinou takes effect immediately without reinstalling.
Zero Application Disruption
Your routes, layouts, slots, Server Functions, and styles in src/ remain 100% unchanged, and your root package.json stays completely clean.
// Example package.json after running "npx dinou eject" on a minimal project:
{
"scripts": {
"dev": "node dinou/cli.js dev",
"build": "node dinou/cli.js build",
"start": "node dinou/cli.js start",
"lint": "eslint src",
"build:vendors": "node dinou/cli.js build:vendors",
"uneject": "node dinou/cli.js uneject"
},
"dependencies": {
"dinou": "file:./dinou",
"react": "^19.3.1",
"react-dom": "^19.3.1"
}
}Anatomy of the Ejected dinou/ Directory
Once ejected, your repository contains a self-contained dinou/ package with its own encapsulated package.json, TypeScript declarations, and runtime modules:
dinou/
├── cli.js # Unified CLI orchestrator (dev, build, start, export-static, typegen, uneject)
├── index.js / index.d.ts # Public client & universal exports (Link, hooks, defineConfig, getContext)
├── server.js / server.d.ts # Server-only exports (DinouCacheSlot, revalidate*, StorageAdapters)
├── package.json # Encapsulated #... subpath imports & runtime dependencies
│
├── core/ # Universal Web-Standards Framework Engine
│ ├── handler.js # HTTP request pipeline, routing, ISR, PPR & Server Functions
│ ├── edge-ssr.js # Streaming Flight-to-HTML SSR renderer
│ ├── cache-slot.js # 3D Layered Micro-ISR (<DinouCacheSlot>) & surgical splicing
│ ├── cache-revalidate.js # O(1) path/page/layout/tag revalidation & lazy HTML re-composition
│ ├── storage-adapter.js # Pluggable KV & filesystem ISR cache adapters
│ ├── load-dinou-config.js # dinou.config.* & setupFiles loader + AOT server bootstrap
│ ├── resolve-contextual-dinou.js # Contextual "./dinou" route helpers & ejected specifier resolver
│ └── uneject.js # Transactional uneject engine & selective script rewriter
│
├── compiled/ # 31 Pre-bundled ESM Toolchain Vendors (Instant Cold Starts)
│ ├── babel-core/ # Bundled Babel AST & React Compiler bridge
│ ├── tailwindcss-postcss/ # Pre-compiled PostCSS & Tailwind v4 CSS pipeline
│ └── vendors-manifest.json # Vendor build sizes & timestamp manifest
│
├── scripts/
│ └── build-vendors.js # Multi-root compiler for regenerating ./dinou/compiled/
│
├── adapters/ # Thin Production Runtime Entrypoints
│ ├── node.js # Standalone Node.js HTTP streaming server
│ ├── netlify.js # Netlify Functions v2 entry wrapper (.dinou/netlify/functions/ssr.mjs)
│ ├── cloudflare.js # Cloudflare Workers Fetch handler (.dinou/cloudflare/worker.js)
│ ├── bun.js # Native Bun.serve() adapter (.dinou/bun/server.js)
│ └── deno.js # Native Deno.serve() adapter (.dinou/deno/main.js)
│
├── esbuild/ · rollup/ · webpack/ # Client Bundler Pipelines & Custom Plugins/Loaders
│
└── node/ · bun/ · deno/ · cloudflare/
└── ... # Dual-Bundle RSC/SSR compilers (bundle-dual-engine.js, dev.js, build.js)./dinou is unminified, readable ESM JavaScript built on standard Web Request / Response streams. Point Gemini Antigravity, Claude Code, Cursor, or Copilot directly at ./dinou to trace execution flows or implement custom runtime features with zero guesswork.Dual-Mode Vendoring in Ejected Projects (-u & build:vendors)
Ejected projects preserve Dinou's Dual-Mode Additive Vendoring through Node.js Subpath Imports (#commander, #babel/core, #postcss, etc.) encapsulated inside ./dinou/package.json—never polluting your root package.json:
Running npm run dev or npm run build loads all 31 internal toolchain dependencies directly from ./dinou/compiled/ for instant cold starts across Node.js and Bun.
-u)Passing -u / --unvendorized (or setting DINOU_UNVENDORIZED=true) activates --conditions=unvendorized, bypassing ./dinou/compiled/ and resolving live packages from node_modules.
# 1. Override or upgrade a toolchain package in your root package.json (e.g. autoprefixer or @babel/core),
# then test it live from node_modules with -u:
npm run dev -- -u
# 2. Recompile all 31 ESM bundles in ./dinou/compiled/ (resolving overrides from your project root first):
npm run build:vendorsWhen to Consider Ejecting
Most applications never need to eject—Dinou's Configuration & Plugin System (dinou.config.ts) deliberately covers onRequest middleware, Node configureServer hooks, setupFiles, pluggable storage adapters, custom assetExtensions, ppr, allowISG, reactCompiler, and reactStrictMode without adding configuration bloat. Ejecting becomes genuinely valuable when you need capabilities that live below dinou.config.ts:
Add specialized compiler plugins and loaders—such as MDX, SVGR (importing .svg as React components), .graphql, Sass/Less, bundle analyzers, or advanced babel-plugin-react-compiler options—or enable production source maps (for Sentry/Datadog) and custom JS targets directly inside dinou/esbuild/, dinou/rollup/, dinou/webpack/, and dinou/core/postcss-pipeline.js.
Inject strict CSP nonce attributes onto Dinou's inline bootstrap scripts and importmap, attach post-stream Server-Timing headers, customize the client SPA router in dinou/core/client.jsx (scroll restoration, View Transitions, stale-chunk recovery after deploys), or tune internal Cache-Control, CSRF origin, and anti-bot policies in dinou/core/handler.js and dinou/core/static-assets.js.
Package your app for Vercel, AWS Lambda Response Streaming, Fastly Compute, Electron / Tauri desktop shells, or custom internal microVMs by writing a dedicated runtime adapter in dinou/adapters/ and Dual-Bundle build script.
Trace subtle hydration, PPR, or cache-slot edge cases straight into readable repository files instead of node_modules, satisfy regulated environments requiring 100% auditable server code in Git, or ship a critical framework hotfix immediately—then run npm run uneject once the upstream release lands.
Give your coding agent full, grounded visibility into the exact server and compiler code your app runs—eliminating black-box guesswork during complex debugging or architectural prototyping—knowing you can cleanly return to the managed npm package anytime with npm run uneject.
Ejection in the Agentic Era
In the era of autonomous coding agents (Gemini Antigravity, Claude Code, Cursor, and Copilot), framework ejection evolves from a legacy last resort into a strategic superpower.
node_modules Boundary: Coding agents operate best on tracked source files inside your workspace. Ejecting places the entire RSC/SSR compiler and HTTP runtime inside your agent's editable workspace.npm run uneject anytime if you decide to stay on the managed package.Practical Customization Examples
Here are two real-world ways teams customize an ejected Dinou codebase:
1. Low-Level HTTP Pipeline & Edge Guards
While standard auth guards and request hooks are best implemented via plugin.onRequest in dinou.config.ts, ejecting lets you customize the raw Web Request / Response pipeline in dinou/core/handler.js—even ahead of static asset lookup or RSC Flight routing:
// dinou/core/handler.js
// Rename the built-in handleRequest() to runCorePipeline(), then wrap it:
async function handleRequest(request, platformContext = {}) {
const url = new URL(request.url);
// 1. Ultra-fast zero-allocation health probe before static/RSC routing
if (url.pathname === "/healthz") {
return Response.json({ status: "ok", region: platformContext?.env?.REGION ?? "local" });
}
// 2. Attach custom Server-Timing telemetry around the entire RSC/SSR stream
const t0 = performance.now();
const response = await runCorePipeline(request, platformContext);
const headers = new Headers(response.headers);
headers.append("Server-Timing", `dinou;dur=${(performance.now() - t0).toFixed(2)}`);
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers,
});
}2. Extending the Bundler Pipeline
To register a custom Esbuild plugin (such as a build-time SVG sprite compiler or MDX transform) across all client production builds, edit dinou/esbuild/helpers-esbuild/get-config-esbuild-prod.js:
// dinou/esbuild/helpers-esbuild/get-config-esbuild-prod.js
import { mySvgSpritePlugin } from "../plugins-esbuild/my-svg-sprite-plugin.js";
export default function getConfigEsbuildProd(options) {
// ...existing Dinou plugins (contextual ./dinou, tsconfig aliases, CSS, RSC manifest, React Compiler)
let plugins = [
mySvgSpritePlugin(),
esbuildContextualDinouPlugin({ projectRoot }),
// ...rest of pipeline
].filter(Boolean);
return {
// ...standard Esbuild ESM splitting configuration
plugins,
};
}Reverting an Eject (npm run uneject)
In traditional frameworks, ejecting is an irreversible one-way door. In Dinou, reverting an eject takes a single command.
# Revert to the latest published dinou release on npm (prompts for y/N confirmation):
npm run uneject
# Skip the interactive (y/N) prompt in CI or automated scripts with -y / --yes:
npm run uneject -- -y
# Or pin a specific version, tag, or local tarball:
npm run uneject -- 9.3.0
npm run uneject -- ../dinou.tgz -ydinou uneject Does Automatically (Transactionally)- Confirms Before Deleting
./dinou: PromptsAre you sure you want to uneject? This will permanently delete your local ./dinou directory. (y/N)(defaulting safely toNunless you confirm withyor pass-y/--yes). - Restores
package.jsonScripts: Rewrites everynode dinou/cli.js <cmd>script back todinou <cmd>, removesunejectandbuild:vendors, and restores"eject": "dinou eject"—preserving all your custom scripts untouched. - Installs Upstream
dinou: Detects your package manager (npm,pnpm,yarn, orbun) and installsdinou@latest(or your requested version/tarball) intonode_modules. If installation fails (for example, while offline), Dinou automatically rolls backpackage.jsonand leaves./dinouintact! - Removes
./dinou: Deletes the local./dinoudirectory once the package installation succeeds (pass--keep-dinouif you prefer to keep a local copy for reference, or--skip-installin offline CI environments).
True Zero Lock-In & Framework Sovereignty
Eject anytime to inspect an internal flow, benchmark custom compiler tweaks, or pair-program on the runtime with your AI coding agent—then run npm run uneject whenever you want to return to upstream releases. You never risk getting trapped in a dead-end fork.
Best Practices for Ejected Projects
- Commit
dinou/to Git: Track your ejected./dinoudirectory in version control so teammates, CI pipelines, and production Docker builds run identical framework code—and sogit diff dinou/gives you an instant changelog of your custom patches. - Prefer
dinou.config.tsPlugins First: Keep standard request middleware, auth redirects, and startup hooks indinou.config.tsso they survivenpm run unejectautomatically, reserving./dinouedits for deep compiler or runtime changes. - Validate Target Bundlers & Vendors: After upgrading toolchain packages or modifying bundler configs, verify your target pipeline (e.g.
npm run build:node:esbuild) and runnpm run build:vendorsif you want updated dependencies baked into./dinou/compiled/.