dinou 9.0.0 → 9.0.1
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 +5 -0
- package/README.md +1 -1
- package/cli.js +525 -525
- package/dinou/package.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,11 @@ 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
|
+
## [9.0.1] - 2026-10-27
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **CLI Unvendorized Mode Path Resolution and Command Rewriting (`-u`)**: Fixed an issue in `dinou/cli.js` where running in unvendorized mode (`-u` / `--unvendorized` / `DINOU_UNVENDORIZED=true`) inside directories containing spaces caused the flag to be incorrectly injected within directory paths, resulting in `MODULE_NOT_FOUND` errors. The internal command parser now reliably handles double-quoted paths and compound command chains (`&&`, `||`, `;`), ensuring robust and idempotent `-u` flag placement across all child Node processes.
|
|
12
|
+
|
|
8
13
|
## [9.0.0] - 2026-10-25
|
|
9
14
|
|
|
10
15
|
### 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,525 +1,525 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import fs from "node:fs";
|
|
4
|
-
import { program } from "commander";
|
|
5
|
-
import { execSync } from "node:child_process";
|
|
6
|
-
import path from "node:path";
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
8
|
-
|
|
9
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const dinouPath = fs.existsSync(path.resolve(__dirname, "dinou")) ? path.resolve(__dirname, "dinou") : __dirname;
|
|
11
|
-
const projectRoot = process.cwd();
|
|
12
|
-
|
|
13
|
-
// Global CLI options for Dinou v9 (Dual-Mode Vendoring)
|
|
14
|
-
program
|
|
15
|
-
.name("dinou")
|
|
16
|
-
.description("Full-stack React 19 framework with native RSC, progressive streaming, and dual-mode vendoring")
|
|
17
|
-
.version("9.0.
|
|
18
|
-
.option("-u, --unvendorized", "Run with standard node_modules dependencies instead of pre-bundled vendor packages");
|
|
19
|
-
|
|
20
|
-
const isUnvendorizedRequested = () =>
|
|
21
|
-
process.argv.includes("-u") ||
|
|
22
|
-
process.argv.includes("--unvendorized") ||
|
|
23
|
-
process.env.DINOU_UNVENDORIZED === "true" ||
|
|
24
|
-
process.env.DINOU_UNVENDORIZED === "1" ||
|
|
25
|
-
Boolean(program.opts?.().unvendorized);
|
|
26
|
-
|
|
27
|
-
const pathKey = Object.keys(process.env).find((k) => k.toLowerCase() === "path") || "PATH";
|
|
28
|
-
const projectBin = path.join(projectRoot, "node_modules", ".bin");
|
|
29
|
-
const dinouBin = path.join(dinouPath, "node_modules", ".bin");
|
|
30
|
-
const extendedPath = [projectBin, dinouBin, process.env[pathKey]].filter(Boolean).join(path.delimiter);
|
|
31
|
-
|
|
32
|
-
const runCommand = (command, options = {}) => {
|
|
33
|
-
try {
|
|
34
|
-
const unvendorized = isUnvendorizedRequested();
|
|
35
|
-
const env = {
|
|
36
|
-
...process.env,
|
|
37
|
-
[pathKey]: extendedPath,
|
|
38
|
-
Path: extendedPath,
|
|
39
|
-
PATH: extendedPath,
|
|
40
|
-
...(unvendorized ? { DINOU_UNVENDORIZED: "true" } : {}),
|
|
41
|
-
...(options.env || {}),
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
let finalCommand = command;
|
|
45
|
-
if (unvendorized) {
|
|
46
|
-
finalCommand = finalCommand.replace(/(node\s+[^\s&|]+
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
execSync(finalCommand, { stdio: "inherit", cwd: projectRoot, ...options, env });
|
|
50
|
-
} catch (error) {
|
|
51
|
-
console.error(`Error executing "${command}":`, error.message);
|
|
52
|
-
process.exit(1);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// Helper paths
|
|
57
|
-
const p = (rel) => `"${path.join(dinouPath, rel).replaceAll("\\", "/")}"`;
|
|
58
|
-
|
|
59
|
-
// --- DEV ---
|
|
60
|
-
|
|
61
|
-
program
|
|
62
|
-
.command("dev")
|
|
63
|
-
.description("Start development server with Esbuild")
|
|
64
|
-
.action(() => {
|
|
65
|
-
runCommand(`cross-env DINOU_BUILD_TOOL=esbuild node ${p("node/dev.js")}`);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
program
|
|
69
|
-
.command("dev:esbuild")
|
|
70
|
-
.description("Start development server with Esbuild")
|
|
71
|
-
.action(() => {
|
|
72
|
-
runCommand(`cross-env DINOU_BUILD_TOOL=esbuild node ${p("node/dev.js")}`);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
program
|
|
76
|
-
.command("dev:rollup")
|
|
77
|
-
.description("Start development server with Rollup")
|
|
78
|
-
.action(() => {
|
|
79
|
-
runCommand(`cross-env DINOU_BUILD_TOOL=rollup node ${p("node/dev.js")}`);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
program
|
|
83
|
-
.command("dev:webpack")
|
|
84
|
-
.description("Start development server with Webpack")
|
|
85
|
-
.action(() => {
|
|
86
|
-
runCommand(`cross-env DINOU_BUILD_TOOL=webpack node ${p("node/dev.js")}`);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
// --- NODE (BUILD & START) ---
|
|
90
|
-
|
|
91
|
-
program
|
|
92
|
-
.command("build")
|
|
93
|
-
.description("Build the app for Node.js production (using esbuild)")
|
|
94
|
-
.action(() => {
|
|
95
|
-
runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("node/build.js")}`);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
program
|
|
99
|
-
.command("build:node")
|
|
100
|
-
.description("Build the app for Node.js production (using esbuild)")
|
|
101
|
-
.action(() => {
|
|
102
|
-
runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("node/build.js")}`);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
program
|
|
106
|
-
.command("build:node:esbuild")
|
|
107
|
-
.description("Build the app for Node.js with Esbuild")
|
|
108
|
-
.action(() => {
|
|
109
|
-
runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("node/build.js")}`);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
program
|
|
113
|
-
.command("build:node:rollup")
|
|
114
|
-
.description("Build the app for Node.js with Rollup")
|
|
115
|
-
.action(() => {
|
|
116
|
-
runCommand(`cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && node ${p("node/build.js")}`);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
program
|
|
120
|
-
.command("build:node:webpack")
|
|
121
|
-
.description("Build the app for Node.js with Webpack")
|
|
122
|
-
.action(() => {
|
|
123
|
-
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")}`);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
program
|
|
127
|
-
.command("start")
|
|
128
|
-
.description("Start the app in production mode (Node.js)")
|
|
129
|
-
.action(() => {
|
|
130
|
-
runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.js")}`);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
program
|
|
134
|
-
.command("start:node")
|
|
135
|
-
.description("Start the app in production mode (Node.js)")
|
|
136
|
-
.action(() => {
|
|
137
|
-
runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.js")}`);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
program
|
|
141
|
-
.command("start:node:esbuild")
|
|
142
|
-
.description("Start the app in production mode (Esbuild build)")
|
|
143
|
-
.action(() => {
|
|
144
|
-
runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.js")}`);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
program
|
|
148
|
-
.command("start:node:rollup")
|
|
149
|
-
.description("Start the app in production mode (Rollup build)")
|
|
150
|
-
.action(() => {
|
|
151
|
-
runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.js")}`);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
program
|
|
155
|
-
.command("start:node:webpack")
|
|
156
|
-
.description("Start the app in production mode (Webpack build)")
|
|
157
|
-
.action(() => {
|
|
158
|
-
runCommand(`cross-env NODE_ENV=production DINOU_BUILD_TOOL=webpack node ${p("adapters/node.js")}`);
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// --- NODE (COMPILE VIA BUN) ---
|
|
162
|
-
|
|
163
|
-
const nodeTargets = [
|
|
164
|
-
{ name: "", flags: "", outfile: "dist/server" },
|
|
165
|
-
{ name: ":linux", flags: "--target=bun-linux-x64 ", outfile: "dist/server-linux" },
|
|
166
|
-
{ name: ":linux_arm", flags: "--target=bun-linux-arm64 ", outfile: "dist/server-linux-arm" },
|
|
167
|
-
{ name: ":mac", flags: "--target=bun-darwin-arm64 ", outfile: "dist/server-mac" },
|
|
168
|
-
{ name: ":win", flags: "--target=bun-windows-x64 ", outfile: "dist/server-win" },
|
|
169
|
-
];
|
|
170
|
-
|
|
171
|
-
const runNodeBuild = (bundler) => {
|
|
172
|
-
const bundlerCmd = bundler === "rollup"
|
|
173
|
-
? `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")}`
|
|
174
|
-
: bundler === "webpack"
|
|
175
|
-
? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
|
|
176
|
-
: `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
|
|
177
|
-
|
|
178
|
-
const envPrefix = bundler === "webpack" ? "cross-env DINOU_BUILD_TOOL=webpack " : "";
|
|
179
|
-
return `${bundlerCmd} && ${envPrefix}node ${p("node/build.js")}`;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
for (const t of nodeTargets) {
|
|
183
|
-
for (const b of ["esbuild", "rollup", "webpack"]) {
|
|
184
|
-
const cmdNames = b === "esbuild"
|
|
185
|
-
? [`build:node:compile${t.name}`, `build:node:compile${t.name}:esbuild`]
|
|
186
|
-
: [`build:node:compile${t.name}:${b}`];
|
|
187
|
-
for (const cmdName of cmdNames) {
|
|
188
|
-
program
|
|
189
|
-
.command(cmdName)
|
|
190
|
-
.description(`Compile standalone Node.js server executable with Bun (${t.name || "host"}, ${b})`)
|
|
191
|
-
.action(() => {
|
|
192
|
-
runCommand(`${runNodeBuild(b)} && bun build --compile ${t.flags}.dinou/node/server.mjs --outfile ${t.outfile}`);
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// --- NODE (PURE BUN RUNNER COMPILE) ---
|
|
199
|
-
|
|
200
|
-
const runNodePureBuild = (bundler) => {
|
|
201
|
-
if (bundler === "rollup") {
|
|
202
|
-
return `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && bun ${p("node/build.js")}`;
|
|
203
|
-
}
|
|
204
|
-
if (bundler === "webpack") {
|
|
205
|
-
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")}`;
|
|
206
|
-
}
|
|
207
|
-
return `cross-env NODE_ENV=production bun ${p("esbuild/build.js")} && bun ${p("node/build.js")}`;
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
program
|
|
211
|
-
.command("build:node:pure")
|
|
212
|
-
.description("Build the app for Node.js with 100% Bun (using esbuild)")
|
|
213
|
-
.action(() => { runCommand(runNodePureBuild("esbuild")); });
|
|
214
|
-
|
|
215
|
-
program
|
|
216
|
-
.command("build:node:pure:esbuild")
|
|
217
|
-
.description("Build the app for Node.js with 100% Bun (Esbuild)")
|
|
218
|
-
.action(() => { runCommand(runNodePureBuild("esbuild")); });
|
|
219
|
-
|
|
220
|
-
program
|
|
221
|
-
.command("build:node:pure:rollup")
|
|
222
|
-
.description("Build the app for Node.js with 100% Bun (Rollup)")
|
|
223
|
-
.action(() => { runCommand(runNodePureBuild("rollup")); });
|
|
224
|
-
|
|
225
|
-
program
|
|
226
|
-
.command("build:node:pure:webpack")
|
|
227
|
-
.description("Build the app for Node.js with 100% Bun (Webpack)")
|
|
228
|
-
.action(() => { runCommand(runNodePureBuild("webpack")); });
|
|
229
|
-
|
|
230
|
-
for (const t of nodeTargets) {
|
|
231
|
-
for (const b of ["esbuild", "rollup", "webpack"]) {
|
|
232
|
-
const cmdNames = b === "esbuild"
|
|
233
|
-
? [`build:node:pure:compile${t.name}`, `build:node:pure:compile${t.name}:esbuild`]
|
|
234
|
-
: [`build:node:pure:compile${t.name}:${b}`];
|
|
235
|
-
for (const cmdName of cmdNames) {
|
|
236
|
-
program
|
|
237
|
-
.command(cmdName)
|
|
238
|
-
.description(`Compile standalone Node.js server executable with 100% Bun (${t.name || "host"}, ${b})`)
|
|
239
|
-
.action(() => {
|
|
240
|
-
runCommand(`${runNodePureBuild(b)} && bun build --compile ${t.flags}.dinou/node/server.mjs --outfile ${t.outfile}`);
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// --- CLOUDFLARE WORKERS ---
|
|
247
|
-
|
|
248
|
-
program
|
|
249
|
-
.command("build:cloudflare")
|
|
250
|
-
.description("Build the app for Cloudflare Workers (using esbuild)")
|
|
251
|
-
.action(() => {
|
|
252
|
-
runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("cloudflare/build.js")}`);
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
program
|
|
256
|
-
.command("build:cloudflare:esbuild")
|
|
257
|
-
.description("Build the app for Cloudflare Workers with Esbuild")
|
|
258
|
-
.action(() => {
|
|
259
|
-
runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("cloudflare/build.js")}`);
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
program
|
|
263
|
-
.command("build:cloudflare:rollup")
|
|
264
|
-
.description("Build the app for Cloudflare Workers with Rollup")
|
|
265
|
-
.action(() => {
|
|
266
|
-
runCommand(`cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && node ${p("cloudflare/build.js")}`);
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
program
|
|
270
|
-
.command("build:cloudflare:webpack")
|
|
271
|
-
.description("Build the app for Cloudflare Workers with Webpack")
|
|
272
|
-
.action(() => {
|
|
273
|
-
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")}`);
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
// --- DENO DEPLOY / EDGE ---
|
|
277
|
-
|
|
278
|
-
const runDenoBuild = (bundler) => {
|
|
279
|
-
const bundlerCmd = bundler === "rollup"
|
|
280
|
-
? `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")}`
|
|
281
|
-
: bundler === "webpack"
|
|
282
|
-
? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
|
|
283
|
-
: `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
|
|
284
|
-
|
|
285
|
-
const envPrefix = bundler === "webpack" ? "cross-env DINOU_BUILD_TOOL=webpack " : "";
|
|
286
|
-
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")}`;
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
program
|
|
290
|
-
.command("build:deno")
|
|
291
|
-
.description("Build the app for Deno Deploy / Edge (using esbuild)")
|
|
292
|
-
.action(() => { runCommand(runDenoBuild("esbuild")); });
|
|
293
|
-
|
|
294
|
-
program
|
|
295
|
-
.command("build:deno:esbuild")
|
|
296
|
-
.description("Build the app for Deno Deploy with Esbuild")
|
|
297
|
-
.action(() => { runCommand(runDenoBuild("esbuild")); });
|
|
298
|
-
|
|
299
|
-
program
|
|
300
|
-
.command("build:deno:rollup")
|
|
301
|
-
.description("Build the app for Deno Deploy with Rollup")
|
|
302
|
-
.action(() => { runCommand(runDenoBuild("rollup")); });
|
|
303
|
-
|
|
304
|
-
program
|
|
305
|
-
.command("build:deno:webpack")
|
|
306
|
-
.description("Build the app for Deno Deploy with Webpack")
|
|
307
|
-
.action(() => { runCommand(runDenoBuild("webpack")); });
|
|
308
|
-
|
|
309
|
-
program
|
|
310
|
-
.command("start:deno")
|
|
311
|
-
.description("Start the app in production mode with Deno")
|
|
312
|
-
.action(() => {
|
|
313
|
-
runCommand(`deno run --unstable-kv --allow-net --allow-read --allow-write --allow-env --allow-sys ${p("adapters/deno.js")}`);
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
// Deno compile commands
|
|
317
|
-
const denoTargets = [
|
|
318
|
-
{ name: "", flags: "", outfile: "dist/deno-server" },
|
|
319
|
-
{ name: ":linux", flags: "--target x86_64-unknown-linux-gnu ", outfile: "dist/deno-server-linux" },
|
|
320
|
-
{ name: ":linux_arm", flags: "--target aarch64-unknown-linux-gnu ", outfile: "dist/deno-server-linux-arm" },
|
|
321
|
-
{ name: ":mac", flags: "--target aarch64-apple-darwin ", outfile: "dist/deno-server-mac" },
|
|
322
|
-
{ name: ":win", flags: "--target x86_64-pc-windows-msvc ", outfile: "dist/deno-server-win" },
|
|
323
|
-
];
|
|
324
|
-
|
|
325
|
-
for (const t of denoTargets) {
|
|
326
|
-
for (const b of ["esbuild", "rollup", "webpack"]) {
|
|
327
|
-
const cmdNames = b === "esbuild"
|
|
328
|
-
? [`build:deno:compile${t.name}`, `build:deno:compile${t.name}:esbuild`]
|
|
329
|
-
: [`build:deno:compile${t.name}:${b}`];
|
|
330
|
-
for (const cmdName of cmdNames) {
|
|
331
|
-
program
|
|
332
|
-
.command(cmdName)
|
|
333
|
-
.description(`Compile standalone Deno executable (${t.name || "host"}, ${b})`)
|
|
334
|
-
.action(() => {
|
|
335
|
-
runCommand(`${runDenoBuild(b)} && deno compile ${t.flags}--no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output ${t.outfile} .dinou/deno/main.js`);
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
// --- BUN (STANDARD) ---
|
|
342
|
-
|
|
343
|
-
const runBunBuild = (bundler) => {
|
|
344
|
-
const bundlerCmd = bundler === "rollup"
|
|
345
|
-
? `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")}`
|
|
346
|
-
: bundler === "webpack"
|
|
347
|
-
? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
|
|
348
|
-
: `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
|
|
349
|
-
|
|
350
|
-
const envPrefix = bundler === "webpack" ? "cross-env DINOU_BUILD_TOOL=webpack " : "";
|
|
351
|
-
return `${bundlerCmd} && ${envPrefix}node ${p("bun/build.js")}`;
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
program
|
|
355
|
-
.command("build:bun")
|
|
356
|
-
.description("Build the app for Bun (using esbuild)")
|
|
357
|
-
.action(() => { runCommand(runBunBuild("esbuild")); });
|
|
358
|
-
|
|
359
|
-
program
|
|
360
|
-
.command("build:bun:esbuild")
|
|
361
|
-
.description("Build the app for Bun with Esbuild")
|
|
362
|
-
.action(() => { runCommand(runBunBuild("esbuild")); });
|
|
363
|
-
|
|
364
|
-
program
|
|
365
|
-
.command("build:bun:rollup")
|
|
366
|
-
.description("Build the app for Bun with Rollup")
|
|
367
|
-
.action(() => { runCommand(runBunBuild("rollup")); });
|
|
368
|
-
|
|
369
|
-
program
|
|
370
|
-
.command("build:bun:webpack")
|
|
371
|
-
.description("Build the app for Bun with Webpack")
|
|
372
|
-
.action(() => { runCommand(runBunBuild("webpack")); });
|
|
373
|
-
|
|
374
|
-
program
|
|
375
|
-
.command("start:bun")
|
|
376
|
-
.description("Start the app in production mode with Bun")
|
|
377
|
-
.action(() => {
|
|
378
|
-
runCommand(`cross-env NODE_ENV=production bun ${p("adapters/bun.js")}`);
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
program
|
|
382
|
-
.command("start:bun:esbuild")
|
|
383
|
-
.description("Start the app in production mode with Bun (Esbuild)")
|
|
384
|
-
.action(() => {
|
|
385
|
-
runCommand(`cross-env NODE_ENV=production bun ${p("adapters/bun.js")}`);
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
program
|
|
389
|
-
.command("start:bun:rollup")
|
|
390
|
-
.description("Start the app in production mode with Bun (Rollup)")
|
|
391
|
-
.action(() => {
|
|
392
|
-
runCommand(`cross-env NODE_ENV=production bun ${p("adapters/bun.js")}`);
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
program
|
|
396
|
-
.command("start:bun:webpack")
|
|
397
|
-
.description("Start the app in production mode with Bun (Webpack)")
|
|
398
|
-
.action(() => {
|
|
399
|
-
runCommand(`cross-env NODE_ENV=production DINOU_BUILD_TOOL=webpack bun ${p("adapters/bun.js")}`);
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
const bunTargets = [
|
|
403
|
-
{ name: "", flags: "", outfile: "dist/server" },
|
|
404
|
-
{ name: ":linux", flags: "--target=bun-linux-x64 ", outfile: "dist/server-linux" },
|
|
405
|
-
{ name: ":linux_arm", flags: "--target=bun-linux-arm64 ", outfile: "dist/server-linux-arm" },
|
|
406
|
-
{ name: ":mac", flags: "--target=bun-darwin-arm64 ", outfile: "dist/server-mac" },
|
|
407
|
-
{ name: ":win", flags: "--target=bun-windows-x64 ", outfile: "dist/server-win" },
|
|
408
|
-
];
|
|
409
|
-
|
|
410
|
-
for (const t of bunTargets) {
|
|
411
|
-
for (const b of ["esbuild", "rollup", "webpack"]) {
|
|
412
|
-
const cmdNames = b === "esbuild"
|
|
413
|
-
? [`build:bun:compile${t.name}`, `build:bun:compile${t.name}:esbuild`]
|
|
414
|
-
: [`build:bun:compile${t.name}:${b}`];
|
|
415
|
-
for (const cmdName of cmdNames) {
|
|
416
|
-
program
|
|
417
|
-
.command(cmdName)
|
|
418
|
-
.description(`Compile standalone Bun executable (${t.name || "host"}, ${b})`)
|
|
419
|
-
.action(() => {
|
|
420
|
-
runCommand(`${runBunBuild(b)} && bun build --compile ${t.flags}.dinou/bun/server.js --outfile ${t.outfile}`);
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
// --- BUN (PURE) ---
|
|
427
|
-
|
|
428
|
-
const runBunPureBuild = (bundler) => {
|
|
429
|
-
if (bundler === "rollup") {
|
|
430
|
-
return `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && bun ${p("bun/build.js")}`;
|
|
431
|
-
}
|
|
432
|
-
if (bundler === "webpack") {
|
|
433
|
-
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")}`;
|
|
434
|
-
}
|
|
435
|
-
return `cross-env NODE_ENV=production bun ${p("esbuild/build.js")} && bun ${p("bun/build.js")}`;
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
program
|
|
439
|
-
.command("build:bun:pure")
|
|
440
|
-
.description("Build the app with 100% Bun (using esbuild)")
|
|
441
|
-
.action(() => { runCommand(runBunPureBuild("esbuild")); });
|
|
442
|
-
|
|
443
|
-
program
|
|
444
|
-
.command("build:bun:pure:esbuild")
|
|
445
|
-
.description("Build the app with 100% Bun (Esbuild)")
|
|
446
|
-
.action(() => { runCommand(runBunPureBuild("esbuild")); });
|
|
447
|
-
|
|
448
|
-
program
|
|
449
|
-
.command("build:bun:pure:rollup")
|
|
450
|
-
.description("Build the app with 100% Bun (Rollup)")
|
|
451
|
-
.action(() => { runCommand(runBunPureBuild("rollup")); });
|
|
452
|
-
|
|
453
|
-
program
|
|
454
|
-
.command("build:bun:pure:webpack")
|
|
455
|
-
.description("Build the app with 100% Bun (Webpack)")
|
|
456
|
-
.action(() => { runCommand(runBunPureBuild("webpack")); });
|
|
457
|
-
|
|
458
|
-
for (const t of bunTargets) {
|
|
459
|
-
for (const b of ["esbuild", "rollup", "webpack"]) {
|
|
460
|
-
const cmdNames = b === "esbuild"
|
|
461
|
-
? [`build:bun:pure:compile${t.name}`, `build:bun:pure:compile${t.name}:esbuild`]
|
|
462
|
-
: [`build:bun:pure:compile${t.name}:${b}`];
|
|
463
|
-
for (const cmdName of cmdNames) {
|
|
464
|
-
program
|
|
465
|
-
.command(cmdName)
|
|
466
|
-
.description(`Compile standalone Bun Pure executable (${t.name || "host"}, ${b})`)
|
|
467
|
-
.action(() => {
|
|
468
|
-
runCommand(`${runBunPureBuild(b)} && bun build --compile ${t.flags}.dinou/bun/server.js --outfile ${t.outfile}`);
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
// --- EXPORT STATIC ---
|
|
475
|
-
|
|
476
|
-
program
|
|
477
|
-
.command("export-static")
|
|
478
|
-
.description("Export standalone static website (using esbuild)")
|
|
479
|
-
.action(() => {
|
|
480
|
-
runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("core/export-static.js")}`);
|
|
481
|
-
});
|
|
482
|
-
|
|
483
|
-
program
|
|
484
|
-
.command("export-static:esbuild")
|
|
485
|
-
.description("Export standalone static website with Esbuild")
|
|
486
|
-
.action(() => {
|
|
487
|
-
runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("core/export-static.js")}`);
|
|
488
|
-
});
|
|
489
|
-
|
|
490
|
-
program
|
|
491
|
-
.command("export-static:rollup")
|
|
492
|
-
.description("Export standalone static website with Rollup")
|
|
493
|
-
.action(() => {
|
|
494
|
-
runCommand(`cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && node ${p("core/export-static.js")}`);
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
program
|
|
498
|
-
.command("export-static:webpack")
|
|
499
|
-
.description("Export standalone static website with Webpack")
|
|
500
|
-
.action(() => {
|
|
501
|
-
runCommand(`cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")} && node ${p("core/export-static.js")}`);
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
// --- VENDORS ---
|
|
506
|
-
|
|
507
|
-
program
|
|
508
|
-
.command("build:vendors")
|
|
509
|
-
.description("Bundle dependencies into dinou/compiled vendors")
|
|
510
|
-
.action(() => {
|
|
511
|
-
runCommand(`node ${p("scripts/build-vendors.js")}`);
|
|
512
|
-
});
|
|
513
|
-
|
|
514
|
-
// --- EJECT ---
|
|
515
|
-
|
|
516
|
-
program
|
|
517
|
-
.command("eject")
|
|
518
|
-
.description("Copy the framework to the root of the project")
|
|
519
|
-
.action(async () => {
|
|
520
|
-
console.log("Executing eject...");
|
|
521
|
-
const { eject } = await import("./eject.js");
|
|
522
|
-
eject();
|
|
523
|
-
});
|
|
524
|
-
|
|
525
|
-
program.parse(process.argv);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import { execSync } from "node:child_process";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const dinouPath = fs.existsSync(path.resolve(__dirname, "dinou")) ? path.resolve(__dirname, "dinou") : __dirname;
|
|
11
|
+
const projectRoot = process.cwd();
|
|
12
|
+
|
|
13
|
+
// Global CLI options for Dinou v9 (Dual-Mode Vendoring)
|
|
14
|
+
program
|
|
15
|
+
.name("dinou")
|
|
16
|
+
.description("Full-stack React 19 framework with native RSC, progressive streaming, and dual-mode vendoring")
|
|
17
|
+
.version("9.0.1")
|
|
18
|
+
.option("-u, --unvendorized", "Run with standard node_modules dependencies instead of pre-bundled vendor packages");
|
|
19
|
+
|
|
20
|
+
const isUnvendorizedRequested = () =>
|
|
21
|
+
process.argv.includes("-u") ||
|
|
22
|
+
process.argv.includes("--unvendorized") ||
|
|
23
|
+
process.env.DINOU_UNVENDORIZED === "true" ||
|
|
24
|
+
process.env.DINOU_UNVENDORIZED === "1" ||
|
|
25
|
+
Boolean(program.opts?.().unvendorized);
|
|
26
|
+
|
|
27
|
+
const pathKey = Object.keys(process.env).find((k) => k.toLowerCase() === "path") || "PATH";
|
|
28
|
+
const projectBin = path.join(projectRoot, "node_modules", ".bin");
|
|
29
|
+
const dinouBin = path.join(dinouPath, "node_modules", ".bin");
|
|
30
|
+
const extendedPath = [projectBin, dinouBin, process.env[pathKey]].filter(Boolean).join(path.delimiter);
|
|
31
|
+
|
|
32
|
+
const runCommand = (command, options = {}) => {
|
|
33
|
+
try {
|
|
34
|
+
const unvendorized = isUnvendorizedRequested();
|
|
35
|
+
const env = {
|
|
36
|
+
...process.env,
|
|
37
|
+
[pathKey]: extendedPath,
|
|
38
|
+
Path: extendedPath,
|
|
39
|
+
PATH: extendedPath,
|
|
40
|
+
...(unvendorized ? { DINOU_UNVENDORIZED: "true" } : {}),
|
|
41
|
+
...(options.env || {}),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
let finalCommand = command;
|
|
45
|
+
if (unvendorized) {
|
|
46
|
+
finalCommand = finalCommand.replace(/(node\s+(?:"[^"]+"|[^\s"&|]+))(?!\s+-u\b)(?=\s|$|[&|;])/g, "$1 -u");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
execSync(finalCommand, { stdio: "inherit", cwd: projectRoot, ...options, env });
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error(`Error executing "${command}":`, error.message);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Helper paths
|
|
57
|
+
const p = (rel) => `"${path.join(dinouPath, rel).replaceAll("\\", "/")}"`;
|
|
58
|
+
|
|
59
|
+
// --- DEV ---
|
|
60
|
+
|
|
61
|
+
program
|
|
62
|
+
.command("dev")
|
|
63
|
+
.description("Start development server with Esbuild")
|
|
64
|
+
.action(() => {
|
|
65
|
+
runCommand(`cross-env DINOU_BUILD_TOOL=esbuild node ${p("node/dev.js")}`);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
program
|
|
69
|
+
.command("dev:esbuild")
|
|
70
|
+
.description("Start development server with Esbuild")
|
|
71
|
+
.action(() => {
|
|
72
|
+
runCommand(`cross-env DINOU_BUILD_TOOL=esbuild node ${p("node/dev.js")}`);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
program
|
|
76
|
+
.command("dev:rollup")
|
|
77
|
+
.description("Start development server with Rollup")
|
|
78
|
+
.action(() => {
|
|
79
|
+
runCommand(`cross-env DINOU_BUILD_TOOL=rollup node ${p("node/dev.js")}`);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
program
|
|
83
|
+
.command("dev:webpack")
|
|
84
|
+
.description("Start development server with Webpack")
|
|
85
|
+
.action(() => {
|
|
86
|
+
runCommand(`cross-env DINOU_BUILD_TOOL=webpack node ${p("node/dev.js")}`);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// --- NODE (BUILD & START) ---
|
|
90
|
+
|
|
91
|
+
program
|
|
92
|
+
.command("build")
|
|
93
|
+
.description("Build the app for Node.js production (using esbuild)")
|
|
94
|
+
.action(() => {
|
|
95
|
+
runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("node/build.js")}`);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
program
|
|
99
|
+
.command("build:node")
|
|
100
|
+
.description("Build the app for Node.js production (using esbuild)")
|
|
101
|
+
.action(() => {
|
|
102
|
+
runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("node/build.js")}`);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
program
|
|
106
|
+
.command("build:node:esbuild")
|
|
107
|
+
.description("Build the app for Node.js with Esbuild")
|
|
108
|
+
.action(() => {
|
|
109
|
+
runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("node/build.js")}`);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
program
|
|
113
|
+
.command("build:node:rollup")
|
|
114
|
+
.description("Build the app for Node.js with Rollup")
|
|
115
|
+
.action(() => {
|
|
116
|
+
runCommand(`cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && node ${p("node/build.js")}`);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
program
|
|
120
|
+
.command("build:node:webpack")
|
|
121
|
+
.description("Build the app for Node.js with Webpack")
|
|
122
|
+
.action(() => {
|
|
123
|
+
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")}`);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
program
|
|
127
|
+
.command("start")
|
|
128
|
+
.description("Start the app in production mode (Node.js)")
|
|
129
|
+
.action(() => {
|
|
130
|
+
runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.js")}`);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
program
|
|
134
|
+
.command("start:node")
|
|
135
|
+
.description("Start the app in production mode (Node.js)")
|
|
136
|
+
.action(() => {
|
|
137
|
+
runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.js")}`);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
program
|
|
141
|
+
.command("start:node:esbuild")
|
|
142
|
+
.description("Start the app in production mode (Esbuild build)")
|
|
143
|
+
.action(() => {
|
|
144
|
+
runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.js")}`);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
program
|
|
148
|
+
.command("start:node:rollup")
|
|
149
|
+
.description("Start the app in production mode (Rollup build)")
|
|
150
|
+
.action(() => {
|
|
151
|
+
runCommand(`cross-env NODE_ENV=production node ${p("adapters/node.js")}`);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
program
|
|
155
|
+
.command("start:node:webpack")
|
|
156
|
+
.description("Start the app in production mode (Webpack build)")
|
|
157
|
+
.action(() => {
|
|
158
|
+
runCommand(`cross-env NODE_ENV=production DINOU_BUILD_TOOL=webpack node ${p("adapters/node.js")}`);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// --- NODE (COMPILE VIA BUN) ---
|
|
162
|
+
|
|
163
|
+
const nodeTargets = [
|
|
164
|
+
{ name: "", flags: "", outfile: "dist/server" },
|
|
165
|
+
{ name: ":linux", flags: "--target=bun-linux-x64 ", outfile: "dist/server-linux" },
|
|
166
|
+
{ name: ":linux_arm", flags: "--target=bun-linux-arm64 ", outfile: "dist/server-linux-arm" },
|
|
167
|
+
{ name: ":mac", flags: "--target=bun-darwin-arm64 ", outfile: "dist/server-mac" },
|
|
168
|
+
{ name: ":win", flags: "--target=bun-windows-x64 ", outfile: "dist/server-win" },
|
|
169
|
+
];
|
|
170
|
+
|
|
171
|
+
const runNodeBuild = (bundler) => {
|
|
172
|
+
const bundlerCmd = bundler === "rollup"
|
|
173
|
+
? `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")}`
|
|
174
|
+
: bundler === "webpack"
|
|
175
|
+
? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
|
|
176
|
+
: `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
|
|
177
|
+
|
|
178
|
+
const envPrefix = bundler === "webpack" ? "cross-env DINOU_BUILD_TOOL=webpack " : "";
|
|
179
|
+
return `${bundlerCmd} && ${envPrefix}node ${p("node/build.js")}`;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
for (const t of nodeTargets) {
|
|
183
|
+
for (const b of ["esbuild", "rollup", "webpack"]) {
|
|
184
|
+
const cmdNames = b === "esbuild"
|
|
185
|
+
? [`build:node:compile${t.name}`, `build:node:compile${t.name}:esbuild`]
|
|
186
|
+
: [`build:node:compile${t.name}:${b}`];
|
|
187
|
+
for (const cmdName of cmdNames) {
|
|
188
|
+
program
|
|
189
|
+
.command(cmdName)
|
|
190
|
+
.description(`Compile standalone Node.js server executable with Bun (${t.name || "host"}, ${b})`)
|
|
191
|
+
.action(() => {
|
|
192
|
+
runCommand(`${runNodeBuild(b)} && bun build --compile ${t.flags}.dinou/node/server.mjs --outfile ${t.outfile}`);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// --- NODE (PURE BUN RUNNER COMPILE) ---
|
|
199
|
+
|
|
200
|
+
const runNodePureBuild = (bundler) => {
|
|
201
|
+
if (bundler === "rollup") {
|
|
202
|
+
return `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && bun ${p("node/build.js")}`;
|
|
203
|
+
}
|
|
204
|
+
if (bundler === "webpack") {
|
|
205
|
+
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")}`;
|
|
206
|
+
}
|
|
207
|
+
return `cross-env NODE_ENV=production bun ${p("esbuild/build.js")} && bun ${p("node/build.js")}`;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
program
|
|
211
|
+
.command("build:node:pure")
|
|
212
|
+
.description("Build the app for Node.js with 100% Bun (using esbuild)")
|
|
213
|
+
.action(() => { runCommand(runNodePureBuild("esbuild")); });
|
|
214
|
+
|
|
215
|
+
program
|
|
216
|
+
.command("build:node:pure:esbuild")
|
|
217
|
+
.description("Build the app for Node.js with 100% Bun (Esbuild)")
|
|
218
|
+
.action(() => { runCommand(runNodePureBuild("esbuild")); });
|
|
219
|
+
|
|
220
|
+
program
|
|
221
|
+
.command("build:node:pure:rollup")
|
|
222
|
+
.description("Build the app for Node.js with 100% Bun (Rollup)")
|
|
223
|
+
.action(() => { runCommand(runNodePureBuild("rollup")); });
|
|
224
|
+
|
|
225
|
+
program
|
|
226
|
+
.command("build:node:pure:webpack")
|
|
227
|
+
.description("Build the app for Node.js with 100% Bun (Webpack)")
|
|
228
|
+
.action(() => { runCommand(runNodePureBuild("webpack")); });
|
|
229
|
+
|
|
230
|
+
for (const t of nodeTargets) {
|
|
231
|
+
for (const b of ["esbuild", "rollup", "webpack"]) {
|
|
232
|
+
const cmdNames = b === "esbuild"
|
|
233
|
+
? [`build:node:pure:compile${t.name}`, `build:node:pure:compile${t.name}:esbuild`]
|
|
234
|
+
: [`build:node:pure:compile${t.name}:${b}`];
|
|
235
|
+
for (const cmdName of cmdNames) {
|
|
236
|
+
program
|
|
237
|
+
.command(cmdName)
|
|
238
|
+
.description(`Compile standalone Node.js server executable with 100% Bun (${t.name || "host"}, ${b})`)
|
|
239
|
+
.action(() => {
|
|
240
|
+
runCommand(`${runNodePureBuild(b)} && bun build --compile ${t.flags}.dinou/node/server.mjs --outfile ${t.outfile}`);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// --- CLOUDFLARE WORKERS ---
|
|
247
|
+
|
|
248
|
+
program
|
|
249
|
+
.command("build:cloudflare")
|
|
250
|
+
.description("Build the app for Cloudflare Workers (using esbuild)")
|
|
251
|
+
.action(() => {
|
|
252
|
+
runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("cloudflare/build.js")}`);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
program
|
|
256
|
+
.command("build:cloudflare:esbuild")
|
|
257
|
+
.description("Build the app for Cloudflare Workers with Esbuild")
|
|
258
|
+
.action(() => {
|
|
259
|
+
runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("cloudflare/build.js")}`);
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
program
|
|
263
|
+
.command("build:cloudflare:rollup")
|
|
264
|
+
.description("Build the app for Cloudflare Workers with Rollup")
|
|
265
|
+
.action(() => {
|
|
266
|
+
runCommand(`cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && node ${p("cloudflare/build.js")}`);
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
program
|
|
270
|
+
.command("build:cloudflare:webpack")
|
|
271
|
+
.description("Build the app for Cloudflare Workers with Webpack")
|
|
272
|
+
.action(() => {
|
|
273
|
+
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")}`);
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
// --- DENO DEPLOY / EDGE ---
|
|
277
|
+
|
|
278
|
+
const runDenoBuild = (bundler) => {
|
|
279
|
+
const bundlerCmd = bundler === "rollup"
|
|
280
|
+
? `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")}`
|
|
281
|
+
: bundler === "webpack"
|
|
282
|
+
? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
|
|
283
|
+
: `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
|
|
284
|
+
|
|
285
|
+
const envPrefix = bundler === "webpack" ? "cross-env DINOU_BUILD_TOOL=webpack " : "";
|
|
286
|
+
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")}`;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
program
|
|
290
|
+
.command("build:deno")
|
|
291
|
+
.description("Build the app for Deno Deploy / Edge (using esbuild)")
|
|
292
|
+
.action(() => { runCommand(runDenoBuild("esbuild")); });
|
|
293
|
+
|
|
294
|
+
program
|
|
295
|
+
.command("build:deno:esbuild")
|
|
296
|
+
.description("Build the app for Deno Deploy with Esbuild")
|
|
297
|
+
.action(() => { runCommand(runDenoBuild("esbuild")); });
|
|
298
|
+
|
|
299
|
+
program
|
|
300
|
+
.command("build:deno:rollup")
|
|
301
|
+
.description("Build the app for Deno Deploy with Rollup")
|
|
302
|
+
.action(() => { runCommand(runDenoBuild("rollup")); });
|
|
303
|
+
|
|
304
|
+
program
|
|
305
|
+
.command("build:deno:webpack")
|
|
306
|
+
.description("Build the app for Deno Deploy with Webpack")
|
|
307
|
+
.action(() => { runCommand(runDenoBuild("webpack")); });
|
|
308
|
+
|
|
309
|
+
program
|
|
310
|
+
.command("start:deno")
|
|
311
|
+
.description("Start the app in production mode with Deno")
|
|
312
|
+
.action(() => {
|
|
313
|
+
runCommand(`deno run --unstable-kv --allow-net --allow-read --allow-write --allow-env --allow-sys ${p("adapters/deno.js")}`);
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
// Deno compile commands
|
|
317
|
+
const denoTargets = [
|
|
318
|
+
{ name: "", flags: "", outfile: "dist/deno-server" },
|
|
319
|
+
{ name: ":linux", flags: "--target x86_64-unknown-linux-gnu ", outfile: "dist/deno-server-linux" },
|
|
320
|
+
{ name: ":linux_arm", flags: "--target aarch64-unknown-linux-gnu ", outfile: "dist/deno-server-linux-arm" },
|
|
321
|
+
{ name: ":mac", flags: "--target aarch64-apple-darwin ", outfile: "dist/deno-server-mac" },
|
|
322
|
+
{ name: ":win", flags: "--target x86_64-pc-windows-msvc ", outfile: "dist/deno-server-win" },
|
|
323
|
+
];
|
|
324
|
+
|
|
325
|
+
for (const t of denoTargets) {
|
|
326
|
+
for (const b of ["esbuild", "rollup", "webpack"]) {
|
|
327
|
+
const cmdNames = b === "esbuild"
|
|
328
|
+
? [`build:deno:compile${t.name}`, `build:deno:compile${t.name}:esbuild`]
|
|
329
|
+
: [`build:deno:compile${t.name}:${b}`];
|
|
330
|
+
for (const cmdName of cmdNames) {
|
|
331
|
+
program
|
|
332
|
+
.command(cmdName)
|
|
333
|
+
.description(`Compile standalone Deno executable (${t.name || "host"}, ${b})`)
|
|
334
|
+
.action(() => {
|
|
335
|
+
runCommand(`${runDenoBuild(b)} && deno compile ${t.flags}--no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output ${t.outfile} .dinou/deno/main.js`);
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// --- BUN (STANDARD) ---
|
|
342
|
+
|
|
343
|
+
const runBunBuild = (bundler) => {
|
|
344
|
+
const bundlerCmd = bundler === "rollup"
|
|
345
|
+
? `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")}`
|
|
346
|
+
: bundler === "webpack"
|
|
347
|
+
? `cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")}`
|
|
348
|
+
: `cross-env NODE_ENV=production node ${p("esbuild/build.js")}`;
|
|
349
|
+
|
|
350
|
+
const envPrefix = bundler === "webpack" ? "cross-env DINOU_BUILD_TOOL=webpack " : "";
|
|
351
|
+
return `${bundlerCmd} && ${envPrefix}node ${p("bun/build.js")}`;
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
program
|
|
355
|
+
.command("build:bun")
|
|
356
|
+
.description("Build the app for Bun (using esbuild)")
|
|
357
|
+
.action(() => { runCommand(runBunBuild("esbuild")); });
|
|
358
|
+
|
|
359
|
+
program
|
|
360
|
+
.command("build:bun:esbuild")
|
|
361
|
+
.description("Build the app for Bun with Esbuild")
|
|
362
|
+
.action(() => { runCommand(runBunBuild("esbuild")); });
|
|
363
|
+
|
|
364
|
+
program
|
|
365
|
+
.command("build:bun:rollup")
|
|
366
|
+
.description("Build the app for Bun with Rollup")
|
|
367
|
+
.action(() => { runCommand(runBunBuild("rollup")); });
|
|
368
|
+
|
|
369
|
+
program
|
|
370
|
+
.command("build:bun:webpack")
|
|
371
|
+
.description("Build the app for Bun with Webpack")
|
|
372
|
+
.action(() => { runCommand(runBunBuild("webpack")); });
|
|
373
|
+
|
|
374
|
+
program
|
|
375
|
+
.command("start:bun")
|
|
376
|
+
.description("Start the app in production mode with Bun")
|
|
377
|
+
.action(() => {
|
|
378
|
+
runCommand(`cross-env NODE_ENV=production bun ${p("adapters/bun.js")}`);
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
program
|
|
382
|
+
.command("start:bun:esbuild")
|
|
383
|
+
.description("Start the app in production mode with Bun (Esbuild)")
|
|
384
|
+
.action(() => {
|
|
385
|
+
runCommand(`cross-env NODE_ENV=production bun ${p("adapters/bun.js")}`);
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
program
|
|
389
|
+
.command("start:bun:rollup")
|
|
390
|
+
.description("Start the app in production mode with Bun (Rollup)")
|
|
391
|
+
.action(() => {
|
|
392
|
+
runCommand(`cross-env NODE_ENV=production bun ${p("adapters/bun.js")}`);
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
program
|
|
396
|
+
.command("start:bun:webpack")
|
|
397
|
+
.description("Start the app in production mode with Bun (Webpack)")
|
|
398
|
+
.action(() => {
|
|
399
|
+
runCommand(`cross-env NODE_ENV=production DINOU_BUILD_TOOL=webpack bun ${p("adapters/bun.js")}`);
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
const bunTargets = [
|
|
403
|
+
{ name: "", flags: "", outfile: "dist/server" },
|
|
404
|
+
{ name: ":linux", flags: "--target=bun-linux-x64 ", outfile: "dist/server-linux" },
|
|
405
|
+
{ name: ":linux_arm", flags: "--target=bun-linux-arm64 ", outfile: "dist/server-linux-arm" },
|
|
406
|
+
{ name: ":mac", flags: "--target=bun-darwin-arm64 ", outfile: "dist/server-mac" },
|
|
407
|
+
{ name: ":win", flags: "--target=bun-windows-x64 ", outfile: "dist/server-win" },
|
|
408
|
+
];
|
|
409
|
+
|
|
410
|
+
for (const t of bunTargets) {
|
|
411
|
+
for (const b of ["esbuild", "rollup", "webpack"]) {
|
|
412
|
+
const cmdNames = b === "esbuild"
|
|
413
|
+
? [`build:bun:compile${t.name}`, `build:bun:compile${t.name}:esbuild`]
|
|
414
|
+
: [`build:bun:compile${t.name}:${b}`];
|
|
415
|
+
for (const cmdName of cmdNames) {
|
|
416
|
+
program
|
|
417
|
+
.command(cmdName)
|
|
418
|
+
.description(`Compile standalone Bun executable (${t.name || "host"}, ${b})`)
|
|
419
|
+
.action(() => {
|
|
420
|
+
runCommand(`${runBunBuild(b)} && bun build --compile ${t.flags}.dinou/bun/server.js --outfile ${t.outfile}`);
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// --- BUN (PURE) ---
|
|
427
|
+
|
|
428
|
+
const runBunPureBuild = (bundler) => {
|
|
429
|
+
if (bundler === "rollup") {
|
|
430
|
+
return `cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && bun ${p("bun/build.js")}`;
|
|
431
|
+
}
|
|
432
|
+
if (bundler === "webpack") {
|
|
433
|
+
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")}`;
|
|
434
|
+
}
|
|
435
|
+
return `cross-env NODE_ENV=production bun ${p("esbuild/build.js")} && bun ${p("bun/build.js")}`;
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
program
|
|
439
|
+
.command("build:bun:pure")
|
|
440
|
+
.description("Build the app with 100% Bun (using esbuild)")
|
|
441
|
+
.action(() => { runCommand(runBunPureBuild("esbuild")); });
|
|
442
|
+
|
|
443
|
+
program
|
|
444
|
+
.command("build:bun:pure:esbuild")
|
|
445
|
+
.description("Build the app with 100% Bun (Esbuild)")
|
|
446
|
+
.action(() => { runCommand(runBunPureBuild("esbuild")); });
|
|
447
|
+
|
|
448
|
+
program
|
|
449
|
+
.command("build:bun:pure:rollup")
|
|
450
|
+
.description("Build the app with 100% Bun (Rollup)")
|
|
451
|
+
.action(() => { runCommand(runBunPureBuild("rollup")); });
|
|
452
|
+
|
|
453
|
+
program
|
|
454
|
+
.command("build:bun:pure:webpack")
|
|
455
|
+
.description("Build the app with 100% Bun (Webpack)")
|
|
456
|
+
.action(() => { runCommand(runBunPureBuild("webpack")); });
|
|
457
|
+
|
|
458
|
+
for (const t of bunTargets) {
|
|
459
|
+
for (const b of ["esbuild", "rollup", "webpack"]) {
|
|
460
|
+
const cmdNames = b === "esbuild"
|
|
461
|
+
? [`build:bun:pure:compile${t.name}`, `build:bun:pure:compile${t.name}:esbuild`]
|
|
462
|
+
: [`build:bun:pure:compile${t.name}:${b}`];
|
|
463
|
+
for (const cmdName of cmdNames) {
|
|
464
|
+
program
|
|
465
|
+
.command(cmdName)
|
|
466
|
+
.description(`Compile standalone Bun Pure executable (${t.name || "host"}, ${b})`)
|
|
467
|
+
.action(() => {
|
|
468
|
+
runCommand(`${runBunPureBuild(b)} && bun build --compile ${t.flags}.dinou/bun/server.js --outfile ${t.outfile}`);
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// --- EXPORT STATIC ---
|
|
475
|
+
|
|
476
|
+
program
|
|
477
|
+
.command("export-static")
|
|
478
|
+
.description("Export standalone static website (using esbuild)")
|
|
479
|
+
.action(() => {
|
|
480
|
+
runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("core/export-static.js")}`);
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
program
|
|
484
|
+
.command("export-static:esbuild")
|
|
485
|
+
.description("Export standalone static website with Esbuild")
|
|
486
|
+
.action(() => {
|
|
487
|
+
runCommand(`cross-env NODE_ENV=production node ${p("esbuild/build.js")} && node ${p("core/export-static.js")}`);
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
program
|
|
491
|
+
.command("export-static:rollup")
|
|
492
|
+
.description("Export standalone static website with Rollup")
|
|
493
|
+
.action(() => {
|
|
494
|
+
runCommand(`cross-env NODE_ENV=production npx rollup -c ${p("rollup/rollup.config.js")} && node ${p("core/export-static.js")}`);
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
program
|
|
498
|
+
.command("export-static:webpack")
|
|
499
|
+
.description("Export standalone static website with Webpack")
|
|
500
|
+
.action(() => {
|
|
501
|
+
runCommand(`cross-env NODE_ENV=production npx webpack --config ${p("webpack/webpack.config.js")} && node ${p("core/export-static.js")}`);
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
// --- VENDORS ---
|
|
506
|
+
|
|
507
|
+
program
|
|
508
|
+
.command("build:vendors")
|
|
509
|
+
.description("Bundle dependencies into dinou/compiled vendors")
|
|
510
|
+
.action(() => {
|
|
511
|
+
runCommand(`node ${p("scripts/build-vendors.js")}`);
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
// --- EJECT ---
|
|
515
|
+
|
|
516
|
+
program
|
|
517
|
+
.command("eject")
|
|
518
|
+
.description("Copy the framework to the root of the project")
|
|
519
|
+
.action(async () => {
|
|
520
|
+
console.log("Executing eject...");
|
|
521
|
+
const { eject } = await import("./eject.js");
|
|
522
|
+
eject();
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
program.parse(process.argv);
|
package/dinou/package.json
CHANGED
package/package.json
CHANGED