dinou 9.0.2 → 9.1.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 +65 -0
- package/README.md +379 -9742
- package/dinou/bun/build.js +38 -1
- package/{cli.js → dinou/cli.js} +8 -7
- package/dinou/cloudflare/build.js +37 -0
- package/dinou/core/bailout-proxy.js +2 -2
- package/dinou/core/build-static-pages.js +17 -7
- package/dinou/core/cache-revalidate.js +977 -152
- package/dinou/core/cache-slot.js +848 -103
- package/dinou/core/client-webpack.jsx +60 -9
- package/dinou/core/client.jsx +60 -9
- package/dinou/core/edge-ssr.js +33 -5
- package/dinou/core/generate-static.js +109 -47
- package/dinou/core/get-jsx.js +35 -27
- package/dinou/core/handler.js +786 -54
- package/dinou/core/layout-functions.js +102 -1
- package/dinou/core/no-dynamic.js +25 -0
- package/dinou/core/ppr-context.js +293 -10
- package/dinou/core/ppr-runtime.js +373 -37
- package/dinou/core/render-jsx-to-client-jsx.js +205 -74
- package/dinou/core/slot.js +246 -33
- package/dinou/core/storage-adapter.js +117 -11
- package/dinou/deno/build.js +38 -1
- package/dinou/deno/seed-kv.js +43 -11
- package/dinou/esbuild/helpers-esbuild/swc-disk-cache.js +242 -225
- package/dinou/esbuild/plugins-esbuild/server-functions-plugin.js +253 -226
- package/dinou/esbuild/react-refresh/esm-hmr/client.js +209 -209
- package/dinou/index.d.ts +10 -0
- package/dinou/index.js +3 -0
- package/dinou/node/build.js +2 -2
- package/dinou/node/bundle-dual-engine.js +2 -0
- package/dinou/node/dev.js +2853 -2704
- package/dinou/package.json +4 -1
- package/dinou/rollup/react-refresh/esm-hmr/client.js +220 -220
- package/dinou/rollup/rollup-plugins/rollup-plugin-server-functions.js +182 -160
- package/dinou/server.d.ts +65 -12
- package/dinou/server.js +11 -0
- package/dinou/webpack/loaders/server-functions-loader.js +101 -94
- package/dinou/webpack/webpack.config.js +9 -4
- package/eject.js +219 -223
- package/package.json +2 -2
package/dinou/bun/build.js
CHANGED
|
@@ -141,6 +141,7 @@ function findClientComponents() {
|
|
|
141
141
|
const coreCandidates = [
|
|
142
142
|
...Array.from(candidateLinkPaths),
|
|
143
143
|
...Array.from(candidateRedirectPaths),
|
|
144
|
+
...Array.from(candidateSlotPaths),
|
|
144
145
|
];
|
|
145
146
|
for (const f of coreCandidates) {
|
|
146
147
|
if (fs.existsSync(f)) {
|
|
@@ -406,6 +407,17 @@ if (!isWebpackBuild && Object.keys(parsedClientManifest).length > 0) {
|
|
|
406
407
|
}
|
|
407
408
|
}
|
|
408
409
|
}
|
|
410
|
+
if (slotChunkId) {
|
|
411
|
+
imports["dinou/core/slot.js"] = slotChunkId;
|
|
412
|
+
imports["dinou/core/slot"] = slotChunkId;
|
|
413
|
+
imports["/dinou/core/slot.js"] = slotChunkId;
|
|
414
|
+
imports["./dinou/core/slot.js"] = slotChunkId;
|
|
415
|
+
for (const sp of candidateSlotPaths) {
|
|
416
|
+
for (const u of generateAllUrlVariants(sp)) {
|
|
417
|
+
imports[u] = slotChunkId;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
409
421
|
|
|
410
422
|
importMapHtml = `<script type="importmap">{"imports":${JSON.stringify(imports)}}</script>`;
|
|
411
423
|
}
|
|
@@ -421,6 +433,8 @@ function findLayoutRoutes(dir, rel = "") {
|
|
|
421
433
|
findLayoutRoutes(path.join(dir, entry.name), rel ? `${rel}/${entry.name}` : entry.name);
|
|
422
434
|
} else if (/^layout\.[jt]sx?$/.test(entry.name)) {
|
|
423
435
|
discoveredLayouts.push(rel);
|
|
436
|
+
} else if (entry.name === "no_layout") {
|
|
437
|
+
discoveredLayouts.push("!" + rel);
|
|
424
438
|
}
|
|
425
439
|
}
|
|
426
440
|
}
|
|
@@ -557,6 +571,17 @@ if (redirectChunkId) {
|
|
|
557
571
|
}
|
|
558
572
|
}
|
|
559
573
|
}
|
|
574
|
+
if (slotChunkId) {
|
|
575
|
+
const slotCompIndex = clientComponents.findIndex((c) => candidateSlotPaths.has(path.resolve(c)));
|
|
576
|
+
if (slotCompIndex !== -1) {
|
|
577
|
+
addClientModule(slotChunkId, `mod_${slotCompIndex}`);
|
|
578
|
+
for (const sp of candidateSlotPaths) {
|
|
579
|
+
for (const u of generateAllUrlVariants(sp)) {
|
|
580
|
+
addClientModule(u, `mod_${slotCompIndex}`);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
560
585
|
|
|
561
586
|
serverFunctionFiles.forEach((relPath, index) => {
|
|
562
587
|
const normRel = relPath.replace(/\\/g, "/");
|
|
@@ -628,6 +653,18 @@ if (redirectChunkId) {
|
|
|
628
653
|
}
|
|
629
654
|
}
|
|
630
655
|
}
|
|
656
|
+
if (slotChunkId) {
|
|
657
|
+
const slotCompIndex = clientComponents.findIndex((c) => candidateSlotPaths.has(path.resolve(c)));
|
|
658
|
+
if (slotCompIndex !== -1) {
|
|
659
|
+
const fileUrl = pathToFileURL(clientComponents[slotCompIndex]).href;
|
|
660
|
+
addModuleMap(slotChunkId, `{ "*": { id: ${JSON.stringify(fileUrl)}, chunks: [], name: "*" } }`);
|
|
661
|
+
for (const sp of candidateSlotPaths) {
|
|
662
|
+
for (const u of generateAllUrlVariants(sp)) {
|
|
663
|
+
addModuleMap(u, `{ "*": { id: ${JSON.stringify(fileUrl)}, chunks: [], name: "*" } }`);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
631
668
|
ssrManifestCode += ` },\n serverModuleMap: {\n`;
|
|
632
669
|
|
|
633
670
|
const emittedServerModuleMap = new Set();
|
|
@@ -766,7 +803,7 @@ export async function fetch(req) {
|
|
|
766
803
|
}
|
|
767
804
|
|
|
768
805
|
export default {
|
|
769
|
-
port: PORT,
|
|
806
|
+
port: PORT, ...(process.env.HOST ? { hostname: process.env.HOST } : {}),
|
|
770
807
|
fetch,
|
|
771
808
|
idleTimeout: IDLE_TIMEOUT,
|
|
772
809
|
};
|
package/{cli.js → dinou/cli.js}
RENAMED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { program } from "commander";
|
|
3
|
+
|
|
4
|
+
import { program } from "#commander";
|
|
5
5
|
import { execSync } from "node:child_process";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
|
|
9
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const dinouPath =
|
|
10
|
+
const dinouPath = __dirname;
|
|
11
11
|
const projectRoot = process.cwd();
|
|
12
12
|
|
|
13
13
|
// Global CLI options for Dinou v9 (Dual-Mode Vendoring)
|
|
14
14
|
program
|
|
15
15
|
.name("dinou")
|
|
16
16
|
.description("Full-stack React 19 framework with native RSC, progressive streaming, and dual-mode vendoring")
|
|
17
|
-
.version("9.0
|
|
17
|
+
.version("9.1.0")
|
|
18
18
|
.option("-u, --unvendorized", "Run with standard node_modules dependencies instead of pre-bundled vendor packages");
|
|
19
19
|
|
|
20
20
|
const isUnvendorizedRequested = () =>
|
|
@@ -27,7 +27,8 @@ const isUnvendorizedRequested = () =>
|
|
|
27
27
|
const pathKey = Object.keys(process.env).find((k) => k.toLowerCase() === "path") || "PATH";
|
|
28
28
|
const projectBin = path.join(projectRoot, "node_modules", ".bin");
|
|
29
29
|
const dinouBin = path.join(dinouPath, "node_modules", ".bin");
|
|
30
|
-
const
|
|
30
|
+
const dinouParentBin = path.resolve(dinouPath, "..", "node_modules", ".bin");
|
|
31
|
+
const extendedPath = [projectBin, dinouBin, dinouParentBin, process.env[pathKey]].filter(Boolean).join(path.delimiter);
|
|
31
32
|
|
|
32
33
|
const runCommand = (command, options = {}) => {
|
|
33
34
|
try {
|
|
@@ -338,7 +339,7 @@ for (const t of denoTargets) {
|
|
|
338
339
|
.command(cmdName)
|
|
339
340
|
.description(`Compile standalone Deno executable (${t.name || "host"}, ${b})`)
|
|
340
341
|
.action(() => {
|
|
341
|
-
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`);
|
|
342
|
+
runCommand(`${runDenoBuild(b)} && deno compile ${t.flags}--unstable-kv --no-check --no-config --allow-net --allow-read --allow-write --allow-env --allow-sys --output ${t.outfile} .dinou/deno/main.js`);
|
|
342
343
|
});
|
|
343
344
|
}
|
|
344
345
|
}
|
|
@@ -524,7 +525,7 @@ program
|
|
|
524
525
|
.description("Copy the framework to the root of the project")
|
|
525
526
|
.action(async () => {
|
|
526
527
|
console.log("Executing eject...");
|
|
527
|
-
const { eject } = await import("
|
|
528
|
+
const { eject } = await import("../eject.js");
|
|
528
529
|
eject();
|
|
529
530
|
});
|
|
530
531
|
|
|
@@ -166,6 +166,7 @@ function findClientComponents() {
|
|
|
166
166
|
const coreCandidates = [
|
|
167
167
|
...Array.from(candidateLinkPaths),
|
|
168
168
|
...Array.from(candidateRedirectPaths),
|
|
169
|
+
...Array.from(candidateSlotPaths),
|
|
169
170
|
];
|
|
170
171
|
for (const f of coreCandidates) {
|
|
171
172
|
if (fs.existsSync(f)) {
|
|
@@ -433,6 +434,17 @@ if (!isWebpackBuild && Object.keys(parsedClientManifest).length > 0) {
|
|
|
433
434
|
}
|
|
434
435
|
}
|
|
435
436
|
}
|
|
437
|
+
if (slotChunkId) {
|
|
438
|
+
imports["dinou/core/slot.js"] = slotChunkId;
|
|
439
|
+
imports["dinou/core/slot"] = slotChunkId;
|
|
440
|
+
imports["/dinou/core/slot.js"] = slotChunkId;
|
|
441
|
+
imports["./dinou/core/slot.js"] = slotChunkId;
|
|
442
|
+
for (const sp of candidateSlotPaths) {
|
|
443
|
+
for (const u of generateAllUrlVariants(sp)) {
|
|
444
|
+
imports[u] = slotChunkId;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
436
448
|
|
|
437
449
|
importMapHtml = `<script type="importmap">{"imports":${JSON.stringify(imports)}}</script>`;
|
|
438
450
|
}
|
|
@@ -448,6 +460,8 @@ function findLayoutRoutes(dir, rel = "") {
|
|
|
448
460
|
findLayoutRoutes(path.join(dir, entry.name), rel ? `${rel}/${entry.name}` : entry.name);
|
|
449
461
|
} else if (/^layout\.[jt]sx?$/.test(entry.name)) {
|
|
450
462
|
discoveredLayouts.push(rel);
|
|
463
|
+
} else if (entry.name === "no_layout") {
|
|
464
|
+
discoveredLayouts.push("!" + rel);
|
|
451
465
|
}
|
|
452
466
|
}
|
|
453
467
|
}
|
|
@@ -584,6 +598,17 @@ if (redirectChunkId) {
|
|
|
584
598
|
}
|
|
585
599
|
}
|
|
586
600
|
}
|
|
601
|
+
if (slotChunkId) {
|
|
602
|
+
const slotCompIndex = clientComponents.findIndex((c) => candidateSlotPaths.has(path.resolve(c)));
|
|
603
|
+
if (slotCompIndex !== -1) {
|
|
604
|
+
addClientModule(slotChunkId, `mod_${slotCompIndex}`);
|
|
605
|
+
for (const sp of candidateSlotPaths) {
|
|
606
|
+
for (const u of generateAllUrlVariants(sp)) {
|
|
607
|
+
addClientModule(u, `mod_${slotCompIndex}`);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
587
612
|
|
|
588
613
|
serverFunctionFiles.forEach((relPath, index) => {
|
|
589
614
|
const normRel = relPath.replace(/\\/g, "/");
|
|
@@ -655,6 +680,18 @@ if (redirectChunkId) {
|
|
|
655
680
|
}
|
|
656
681
|
}
|
|
657
682
|
}
|
|
683
|
+
if (slotChunkId) {
|
|
684
|
+
const slotCompIndex = clientComponents.findIndex((c) => candidateSlotPaths.has(path.resolve(c)));
|
|
685
|
+
if (slotCompIndex !== -1) {
|
|
686
|
+
const fileUrl = pathToFileURL(clientComponents[slotCompIndex]).href;
|
|
687
|
+
addModuleMap(slotChunkId, `{ "*": { id: ${JSON.stringify(fileUrl)}, chunks: [], name: "*" } }`);
|
|
688
|
+
for (const sp of candidateSlotPaths) {
|
|
689
|
+
for (const u of generateAllUrlVariants(sp)) {
|
|
690
|
+
addModuleMap(u, `{ "*": { id: ${JSON.stringify(fileUrl)}, chunks: [], name: "*" } }`);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
658
695
|
ssrManifestCode += ` },\n serverModuleMap: {\n`;
|
|
659
696
|
|
|
660
697
|
const emittedServerModuleMap = new Set();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isPprBuildActive,
|
|
1
|
+
import { isPprBuildActive, isInsideOuterSuspenseOutsideSlot, markDynamicAccess } from "./ppr-context.js";
|
|
2
2
|
|
|
3
3
|
function triggerBailout(label, onBailout) {
|
|
4
|
-
if (isPprBuildActive() &&
|
|
4
|
+
if (isPprBuildActive() && isInsideOuterSuspenseOutsideSlot()) {
|
|
5
5
|
markDynamicAccess(label);
|
|
6
6
|
} else if (typeof onBailout === "function") {
|
|
7
7
|
onBailout();
|
|
@@ -6,7 +6,7 @@ import { getFilePathAndDynamicParams } from "./get-file-path-and-dynamic-params.
|
|
|
6
6
|
import importModule from "./import-module.js";
|
|
7
7
|
import { requestStorage } from "./request-context.js";
|
|
8
8
|
import { getLayoutProps, resolveLayoutFunctionsConfig, getLayoutFunctionsPath } from "./layout-functions.js";
|
|
9
|
-
import { runWithPprContext, getRegisteredHoles } from "./ppr-context.js";
|
|
9
|
+
import { runWithPprContext, getRegisteredHoles, resetPprHoles } from "./ppr-context.js";
|
|
10
10
|
import { resolveModulePpr } from "./resolve-module-ppr.js";
|
|
11
11
|
import { getDinouConfig } from "./load-dinou-config.js";
|
|
12
12
|
import { createBailoutProxy } from "./bailout-proxy.js";
|
|
@@ -912,10 +912,12 @@ async function buildStaticPages(onProgress = null) {
|
|
|
912
912
|
const mockContext = {
|
|
913
913
|
req: mockReq,
|
|
914
914
|
res: mockRes,
|
|
915
|
+
_markDynamic: markAsDynamic,
|
|
915
916
|
};
|
|
916
917
|
|
|
917
918
|
let revalidate;
|
|
918
919
|
let cacheTags = [];
|
|
920
|
+
let capturedHoles = [];
|
|
919
921
|
const jsx = await requestStorage.run(mockContext, async () => {
|
|
920
922
|
return await runWithPprContext({ isPpr: Boolean(pageIsPpr) }, async () => {
|
|
921
923
|
const [pagePath] = getFilePathAndDynamicParams(
|
|
@@ -1083,11 +1085,14 @@ async function buildStaticPages(onProgress = null) {
|
|
|
1083
1085
|
}
|
|
1084
1086
|
|
|
1085
1087
|
// Render the layout-nested React element tree to client-side RSC JSON format
|
|
1086
|
-
|
|
1088
|
+
resetPprHoles();
|
|
1089
|
+
const renderedSingleJsx = await asyncRenderJSXToClientJSX(jsx);
|
|
1090
|
+
capturedHoles = pageIsPpr ? getRegisteredHoles() : [];
|
|
1091
|
+
return renderedSingleJsx;
|
|
1087
1092
|
});
|
|
1088
1093
|
});
|
|
1089
1094
|
|
|
1090
|
-
if (!isStatic
|
|
1095
|
+
if (!isStatic) {
|
|
1091
1096
|
// ❌ DO NOT save file.
|
|
1092
1097
|
// Will behave as pure SSR at runtime.
|
|
1093
1098
|
if (process.env.DINOU_DEBUG) {
|
|
@@ -1105,7 +1110,7 @@ async function buildStaticPages(onProgress = null) {
|
|
|
1105
1110
|
cookies: mockRes._cookies,
|
|
1106
1111
|
};
|
|
1107
1112
|
|
|
1108
|
-
const holes = pageIsPpr ?
|
|
1113
|
+
const holes = pageIsPpr ? capturedHoles : [];
|
|
1109
1114
|
staticRoutes.add(reqPath);
|
|
1110
1115
|
staticMetadata.set(reqPath, {
|
|
1111
1116
|
revalidate: typeof revalidate === "function" ? await revalidate() : revalidate,
|
|
@@ -1270,6 +1275,7 @@ async function buildStaticPage(reqPath, isDynamic = null) {
|
|
|
1270
1275
|
const mockContext = {
|
|
1271
1276
|
req: mockReq,
|
|
1272
1277
|
res: mockRes,
|
|
1278
|
+
_markDynamic: markAsDynamic,
|
|
1273
1279
|
};
|
|
1274
1280
|
|
|
1275
1281
|
let revalidate;
|
|
@@ -1303,6 +1309,7 @@ async function buildStaticPage(reqPath, isDynamic = null) {
|
|
|
1303
1309
|
);
|
|
1304
1310
|
|
|
1305
1311
|
pageIsPpr = await resolveBuildPprForRoute(segments, pagePath, pageFunctionsPath, srcFolder);
|
|
1312
|
+
let capturedHoles = [];
|
|
1306
1313
|
|
|
1307
1314
|
return await runWithPprContext({ isPpr: pageIsPpr }, async () => {
|
|
1308
1315
|
let props = { params: dParams };
|
|
@@ -1447,11 +1454,14 @@ async function buildStaticPage(reqPath, isDynamic = null) {
|
|
|
1447
1454
|
}
|
|
1448
1455
|
}
|
|
1449
1456
|
|
|
1450
|
-
|
|
1457
|
+
resetPprHoles();
|
|
1458
|
+
const renderedSingleJsx = await asyncRenderJSXToClientJSX(jsx);
|
|
1459
|
+
capturedHoles = pageIsPpr ? getRegisteredHoles() : [];
|
|
1460
|
+
return renderedSingleJsx;
|
|
1451
1461
|
});
|
|
1452
1462
|
});
|
|
1453
1463
|
|
|
1454
|
-
if (!isStatic
|
|
1464
|
+
if (!isStatic) {
|
|
1455
1465
|
// ❌ DO NOT save file.
|
|
1456
1466
|
// It will behave as pure SSR at runtime.
|
|
1457
1467
|
if (process.env.DINOU_DEBUG) {
|
|
@@ -1472,7 +1482,7 @@ async function buildStaticPage(reqPath, isDynamic = null) {
|
|
|
1472
1482
|
cookies: mockRes._cookies,
|
|
1473
1483
|
};
|
|
1474
1484
|
|
|
1475
|
-
const holes = pageIsPpr ?
|
|
1485
|
+
const holes = pageIsPpr ? capturedHoles : [];
|
|
1476
1486
|
staticRoutes.add(reqPath);
|
|
1477
1487
|
staticMetadata.set(reqPath, {
|
|
1478
1488
|
revalidate: typeof revalidate === "function" ? await revalidate() : revalidate,
|