dinou 7.3.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +1 -1
- package/cli.js +44 -41
- package/dinou/adapters/netlify.js +1 -0
- package/dinou/adapters/{node.mjs → node.js} +9 -3
- package/dinou/bun/{build.mjs → build.js} +11 -10
- package/dinou/cloudflare/{build.mjs → build.js} +14 -10
- 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 -69
- 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} +11 -10
- 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.js +40 -19
- package/dinou/node/{build.mjs → build.js} +1 -1
- package/dinou/node/{bundle-dual-engine.mjs → bundle-dual-engine.js} +13 -12
- package/dinou/node/{dev.mjs → dev.js} +27 -22
- 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 +224 -217
- 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
|
@@ -1,35 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
let _buildStaticPage = null;
|
|
10
|
-
function getBuildStaticPage() {
|
|
11
|
-
if (!_buildStaticPage) _buildStaticPage = require("./build-static-pages").buildStaticPage;
|
|
12
|
-
return _buildStaticPage;
|
|
13
|
-
}
|
|
14
|
-
let _generateStaticRSC = null;
|
|
15
|
-
function getGenerateStaticRSC() {
|
|
16
|
-
if (!_generateStaticRSC) _generateStaticRSC = require("./generate-static-rsc");
|
|
17
|
-
return _generateStaticRSC;
|
|
18
|
-
}
|
|
19
|
-
let _safeRename = null;
|
|
20
|
-
function getSafeRename() {
|
|
21
|
-
if (!_safeRename) _safeRename = require("./safe-rename").safeRename;
|
|
22
|
-
return _safeRename;
|
|
23
|
-
}
|
|
24
|
-
let _updateStatus = null;
|
|
25
|
-
function getUpdateStatus() {
|
|
26
|
-
if (!_updateStatus) _updateStatus = require("./status-manifest").updateStatus;
|
|
27
|
-
return _updateStatus;
|
|
28
|
-
}
|
|
29
|
-
const { getContext } = require("./request-context");
|
|
30
|
-
const { resolveRelativeUrl } = require("./url-resolver");
|
|
31
|
-
const { getStorageAdapter } = require("./storage-adapter");
|
|
32
|
-
const { isEdgeRuntime } = require("./rsc-renderer");
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import { existsSync, copyFileSync } from "node:fs";
|
|
4
|
+
import { getContext } from "./request-context.js";
|
|
5
|
+
import { resolveRelativeUrl } from "./url-resolver.js";
|
|
6
|
+
import { getStorageAdapter } from "./storage-adapter.js";
|
|
7
|
+
import { isEdgeRuntime } from "./rsc-renderer.js";
|
|
33
8
|
|
|
34
9
|
async function walkMetadataFiles(dir, fileList = []) {
|
|
35
10
|
try {
|
|
@@ -463,7 +438,13 @@ async function revalidateTag(tag, options = {}) {
|
|
|
463
438
|
await Promise.all(revalidatePromises);
|
|
464
439
|
}
|
|
465
440
|
|
|
466
|
-
|
|
441
|
+
export {
|
|
442
|
+
revalidatePath,
|
|
443
|
+
revalidatePage,
|
|
444
|
+
revalidateTag,
|
|
445
|
+
revalidateLayout,
|
|
446
|
+
};
|
|
447
|
+
export default {
|
|
467
448
|
revalidatePath,
|
|
468
449
|
revalidatePage,
|
|
469
450
|
revalidateTag,
|
package/dinou/core/cache-slot.js
CHANGED
|
@@ -2,11 +2,18 @@
|
|
|
2
2
|
// Primitive for Vertical Segmentation (Micro-ISR) in React Server Components.
|
|
3
3
|
// Caches and invalidates component sub-trees inside pages using revalidate & revalidateTag.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { pathToFileURL, fileURLToPath } from "node:url";
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { getStorageAdapter } from "./storage-adapter.js";
|
|
9
|
+
import { asyncRenderJSXToClientJSX } from "./render-jsx-to-client-jsx.js";
|
|
10
|
+
import { DinouCacheSlotBoundary as RawDinouCacheSlotBoundary } from "./slot.js";
|
|
11
|
+
import { getContext } from "./request-context.js";
|
|
12
|
+
import { getJSX } from "./get-jsx.js";
|
|
13
|
+
import { createRequire } from "node:module";
|
|
14
|
+
|
|
15
|
+
const require = createRequire(import.meta.url);
|
|
16
|
+
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
10
17
|
|
|
11
18
|
const INFLIGHT_KEY = Symbol.for("dinou.slot.inflight.renders");
|
|
12
19
|
if (!globalThis[INFLIGHT_KEY]) {
|
|
@@ -29,12 +36,12 @@ const slotRegistry = globalThis[SLOT_REGISTRY_KEY];
|
|
|
29
36
|
let _DinouCacheSlotBoundary = null;
|
|
30
37
|
function getCacheSlotBoundary() {
|
|
31
38
|
if (!_DinouCacheSlotBoundary) {
|
|
32
|
-
let
|
|
39
|
+
let DinouCacheSlotBoundary = RawDinouCacheSlotBoundary;
|
|
33
40
|
if (
|
|
34
41
|
typeof DinouCacheSlotBoundary === "function" &&
|
|
35
42
|
DinouCacheSlotBoundary.$$typeof !== Symbol.for("react.client.reference")
|
|
36
43
|
) {
|
|
37
|
-
const slotPath = path.resolve(
|
|
44
|
+
const slotPath = path.resolve(currentDir, "slot.js");
|
|
38
45
|
const fileUrl = pathToFileURL(slotPath).href;
|
|
39
46
|
let regFn = null;
|
|
40
47
|
try {
|
|
@@ -255,7 +262,6 @@ async function DinouCacheSlot(props) {
|
|
|
255
262
|
})();
|
|
256
263
|
|
|
257
264
|
try {
|
|
258
|
-
const { getContext } = require("./request-context.js");
|
|
259
265
|
const reqContext = getContext();
|
|
260
266
|
const ctx = reqContext?.ctx || reqContext?.platformContext?.ctx || reqContext?.req?.ctx;
|
|
261
267
|
if (ctx && typeof ctx.waitUntil === "function") {
|
|
@@ -342,7 +348,6 @@ async function getSlotJSX(slotId, options = {}) {
|
|
|
342
348
|
// 2. If missing from storage (e.g. was invalidated) or expired or forced fresh:
|
|
343
349
|
if (!slotRegistry.has(slotId) && options.currentPath) {
|
|
344
350
|
try {
|
|
345
|
-
const { getJSX } = require("./get-jsx.js");
|
|
346
351
|
const isNotFound = { value: false };
|
|
347
352
|
await getJSX(options.currentPath, {}, isNotFound, false, false, { segment: "page" });
|
|
348
353
|
} catch (e) {
|
|
@@ -379,7 +384,13 @@ async function getSlotJSX(slotId, options = {}) {
|
|
|
379
384
|
return null;
|
|
380
385
|
}
|
|
381
386
|
|
|
382
|
-
|
|
387
|
+
export {
|
|
388
|
+
DinouCacheSlot,
|
|
389
|
+
getSlotJSX,
|
|
390
|
+
serializeJSX,
|
|
391
|
+
deserializeJSX,
|
|
392
|
+
};
|
|
393
|
+
export default {
|
|
383
394
|
DinouCacheSlot,
|
|
384
395
|
getSlotJSX,
|
|
385
396
|
serializeJSX,
|
package/dinou/core/config.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
// dinou/core/config.js
|
|
2
2
|
// Type helper for defining Dinou configuration and plugins
|
|
3
3
|
|
|
4
|
-
function defineConfig(config) {
|
|
4
|
+
export function defineConfig(config) {
|
|
5
5
|
return config;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
defineConfig,
|
|
10
|
-
};
|
|
11
|
-
module.exports.default = defineConfig;
|
|
8
|
+
export default defineConfig;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import genericNames from "generic-names";
|
|
2
|
+
import path from "node:path";
|
|
3
3
|
|
|
4
4
|
const generate = genericNames("[hash:base64]", {
|
|
5
5
|
context: path.resolve(process.cwd(), "src"),
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
export default generate;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
|
|
9
|
+
export function getDinouCoreDir() {
|
|
5
10
|
// Edge runtime guard: en Cloudflare Workers / Deno Edge no hay sistema de archivos dinámico
|
|
6
11
|
if (typeof process !== "undefined" && process.env && process.env.DINOU_RUNTIME === "edge") {
|
|
7
12
|
return "/dinou/core";
|
|
@@ -15,13 +20,11 @@ function getDinouCoreDir() {
|
|
|
15
20
|
} catch (e) {}
|
|
16
21
|
|
|
17
22
|
// 2. Modo librería sin empaquetar: dinou-paths.js ya está en dinou/core
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} catch (e) {}
|
|
24
|
-
}
|
|
23
|
+
try {
|
|
24
|
+
if (fs.existsSync && fs.existsSync(path.join(currentDir, "handler.js"))) {
|
|
25
|
+
return currentDir;
|
|
26
|
+
}
|
|
27
|
+
} catch (e) {}
|
|
25
28
|
|
|
26
29
|
// 3. Resolución estándar de Node
|
|
27
30
|
try {
|
|
@@ -44,9 +47,9 @@ function getDinouCoreDir() {
|
|
|
44
47
|
return "/dinou/core";
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
const dinouCoreDir = getDinouCoreDir();
|
|
50
|
+
export const dinouCoreDir = getDinouCoreDir();
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
export default {
|
|
50
53
|
dinouCoreDir,
|
|
51
54
|
getDinouCoreDir,
|
|
52
55
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// dinou/core/generate-route-types.js
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
4
|
|
|
5
5
|
const PAGE_EXTENSIONS = [".tsx", ".jsx", ".ts", ".js"];
|
|
6
6
|
|
|
@@ -245,7 +245,12 @@ ${paramsEntries}
|
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
|
|
248
|
+
export {
|
|
249
|
+
collectRoutes,
|
|
250
|
+
generateRouteDefinitions,
|
|
251
|
+
generateRouteTypes,
|
|
252
|
+
};
|
|
253
|
+
export default {
|
|
249
254
|
collectRoutes,
|
|
250
255
|
generateRouteDefinitions,
|
|
251
256
|
generateRouteTypes,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Generates static HTML for a given path using the in-memory Dual-Bundle streaming engine.
|
|
3
3
|
// Completely eliminates child_process.fork() and render-app-to-html.js.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import fs from "node:fs/promises";
|
|
7
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
8
|
+
import { pathToFileURL } from "node:url";
|
|
9
9
|
|
|
10
10
|
const OUT_DIR = path.resolve(".dinou/dist2");
|
|
11
11
|
|
|
@@ -78,4 +78,5 @@ async function generateStaticPage(reqPath) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
export { generateStaticPage };
|
|
82
|
+
export default generateStaticPage;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { PassThrough } from "node:stream";
|
|
4
|
+
import url from "node:url";
|
|
5
|
+
import getJSX from "./get-jsx.js";
|
|
6
|
+
import { requestStorage } from "./request-context.js";
|
|
7
|
+
import { createRequire } from "node:module";
|
|
8
|
+
|
|
9
|
+
const require = createRequire(import.meta.url);
|
|
6
10
|
let _renderToPipeableStream = null;
|
|
7
11
|
function getRenderToPipeableStream() {
|
|
8
12
|
if (!_renderToPipeableStream) {
|
|
@@ -14,7 +18,6 @@ function getRenderToPipeableStream() {
|
|
|
14
18
|
}
|
|
15
19
|
return _renderToPipeableStream;
|
|
16
20
|
}
|
|
17
|
-
const { requestStorage } = require("./request-context.js");
|
|
18
21
|
|
|
19
22
|
const OUT_DIR = path.resolve(".dinou/dist2");
|
|
20
23
|
const isWebpack = process.env.DINOU_BUILD_TOOL === "webpack";
|
|
@@ -159,7 +162,9 @@ async function generateStaticLayoutRSC(layoutFolderPath, layoutFilePath, options
|
|
|
159
162
|
});
|
|
160
163
|
}
|
|
161
164
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
export {
|
|
166
|
+
generateStaticRSC,
|
|
167
|
+
generateStaticPageRSC,
|
|
168
|
+
generateStaticLayoutRSC,
|
|
169
|
+
};
|
|
170
|
+
export default generateStaticRSC;
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
// Unified Static Site Generation runner using the in-memory Dual-Bundle Engine.
|
|
3
3
|
// Guarantees 100% parity with runtime Incremental Static Generation (ISG).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { existsSync, rmSync, mkdirSync, renameSync } from "node:fs";
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
8
|
+
import { setStorageAdapter, FileSystemStorage } from "./storage-adapter.js";
|
|
9
|
+
import {
|
|
10
10
|
generateStaticPageRSC,
|
|
11
11
|
generateStaticLayoutRSC,
|
|
12
|
-
}
|
|
12
|
+
} from "./generate-static-rsc.js";
|
|
13
|
+
import { resolveLayoutFunctionsConfig } from "./layout-functions.js";
|
|
13
14
|
|
|
14
15
|
async function generateStatic() {
|
|
15
16
|
const distFolder2 = path.resolve(process.cwd(), ".dinou/dist2");
|
|
@@ -19,12 +20,12 @@ async function generateStatic() {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
const { updateBuildProgress, clearBuildProgress, isTTY } = await import(
|
|
22
|
-
"../node/terminal-status.
|
|
23
|
+
"../node/terminal-status.js"
|
|
23
24
|
);
|
|
24
25
|
|
|
25
26
|
// 1. Compile or ensure Dual-Bundle engines (Pass A & Pass B)
|
|
26
27
|
updateBuildProgress("[SSG] Compiling Dual-Engine for static generation...");
|
|
27
|
-
const { bundleDualEngine } = await import("../node/bundle-dual-engine.
|
|
28
|
+
const { bundleDualEngine } = await import("../node/bundle-dual-engine.js");
|
|
28
29
|
const { rscEnginePath, ssrEnginePath } = await bundleDualEngine({
|
|
29
30
|
isDev: false,
|
|
30
31
|
projectRoot: process.cwd(),
|
|
@@ -84,7 +85,6 @@ async function generateStatic() {
|
|
|
84
85
|
tags: [],
|
|
85
86
|
};
|
|
86
87
|
try {
|
|
87
|
-
const { resolveLayoutFunctionsConfig } = require("./layout-functions.js");
|
|
88
88
|
const layoutConfig = await resolveLayoutFunctionsConfig(
|
|
89
89
|
layoutInfo.layoutPath,
|
|
90
90
|
layoutInfo.params || {}
|
|
@@ -221,4 +221,5 @@ async function generateStatic() {
|
|
|
221
221
|
);
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
export { generateStatic };
|
|
225
|
+
export default generateStatic;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { regenerating } = require("./revalidating"); // We share the Set of locks
|
|
8
|
-
const { safeRename } = require("./safe-rename");
|
|
9
|
-
const { updateStatus } = require("./status-manifest");
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { existsSync, copyFileSync } from "node:fs";
|
|
4
|
+
import { regenerating } from "./revalidating.js";
|
|
5
|
+
import { safeRename } from "./safe-rename.js";
|
|
6
|
+
import { updateStatus } from "./status-manifest.js";
|
|
10
7
|
|
|
11
|
-
function generatingISG(reqPath, isDynamicFromServer) {
|
|
8
|
+
export function generatingISG(reqPath, isDynamicFromServer) {
|
|
12
9
|
const dist2Folder = path.resolve(process.cwd(), ".dinou/dist2");
|
|
13
10
|
// 1. Concurrency Protection
|
|
14
11
|
if (regenerating.has(reqPath)) return;
|
|
@@ -36,6 +33,10 @@ function generatingISG(reqPath, isDynamicFromServer) {
|
|
|
36
33
|
(async () => {
|
|
37
34
|
try {
|
|
38
35
|
console.log(`[ISG] Promoting new page to static: ${reqPath}...`);
|
|
36
|
+
const { buildStaticPage } = await import("./build-static-pages.js");
|
|
37
|
+
const { default: generateStaticRSC } = await import("./generate-static-rsc.js");
|
|
38
|
+
const { default: generateStaticPage } = await import("./generate-static-page.js");
|
|
39
|
+
|
|
39
40
|
const isDynamic = {};
|
|
40
41
|
// A. Build Data (with dynamic check)
|
|
41
42
|
await buildStaticPage(reqPath, isDynamic);
|
|
@@ -76,4 +77,4 @@ function generatingISG(reqPath, isDynamicFromServer) {
|
|
|
76
77
|
})();
|
|
77
78
|
}
|
|
78
79
|
|
|
79
|
-
|
|
80
|
+
export default { generatingISG };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
4
|
|
|
5
5
|
// Reads tsconfig/jsconfig and builds a map of alias -> targetBase
|
|
6
6
|
function loadTsconfigAliases() {
|
|
@@ -62,7 +62,7 @@ const aliasMap = loadTsconfigAliases();
|
|
|
62
62
|
function tryExtensions(filePath) {
|
|
63
63
|
if (fs.existsSync(filePath) && fs.statSync(filePath).isFile())
|
|
64
64
|
return filePath;
|
|
65
|
-
const exts = [".js", ".ts", ".jsx", ".tsx"];
|
|
65
|
+
const exts = [".js", ".mjs", ".ts", ".jsx", ".tsx"];
|
|
66
66
|
for (const ext of exts) {
|
|
67
67
|
const f = filePath + ext;
|
|
68
68
|
if (fs.existsSync(f) && fs.statSync(f).isFile()) return f;
|
|
@@ -77,7 +77,7 @@ function tryExtensions(filePath) {
|
|
|
77
77
|
return null;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
export function getAbsPathWithExt(specifier, context) {
|
|
81
81
|
const cleanSpecifier = specifier ? specifier.split("?")[0] : specifier;
|
|
82
82
|
if (!cleanSpecifier) return null;
|
|
83
83
|
|
|
@@ -102,4 +102,6 @@ exports.getAbsPathWithExt = function getAbsPathWithExt(specifier, context) {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
return null;
|
|
105
|
-
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export default { getAbsPathWithExt };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
3
|
|
|
4
4
|
let manifest = {};
|
|
5
5
|
let read = false;
|
|
6
6
|
const isWebpack = process.env.DINOU_BUILD_TOOL === "webpack";
|
|
7
7
|
|
|
8
|
-
function getAssetFromManifest(name) {
|
|
8
|
+
export function getAssetFromManifest(name) {
|
|
9
9
|
if (typeof globalThis !== "undefined" && globalThis.__DINOU_ASSET_MANIFEST__) {
|
|
10
10
|
return "/" + (globalThis.__DINOU_ASSET_MANIFEST__[name] || name);
|
|
11
11
|
}
|
|
@@ -28,4 +28,4 @@ function getAssetFromManifest(name) {
|
|
|
28
28
|
return "/" + (manifest[name] || name);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
export default getAssetFromManifest;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { existsSync } from "./vfs.js";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import {
|
|
5
5
|
getFilePathAndDynamicParams,
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
} from "./get-file-path-and-dynamic-params.js";
|
|
7
|
+
import importModule from "./import-module.js";
|
|
8
|
+
import { asyncRenderJSXToClientJSX } from "./render-jsx-to-client-jsx.js";
|
|
9
|
+
import { getLayoutProps } from "./layout-functions.js";
|
|
10
10
|
|
|
11
11
|
function cleanErrorStack(stack) {
|
|
12
12
|
if (!stack || typeof stack !== "string") return "";
|
|
@@ -377,6 +377,9 @@ async function getErrorJSX(reqPath, query, error, isDevelopment = false, options
|
|
|
377
377
|
return jsx;
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
-
|
|
380
|
+
export {
|
|
381
|
+
getErrorJSX,
|
|
382
|
+
};
|
|
383
|
+
export default {
|
|
381
384
|
getErrorJSX,
|
|
382
385
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { existsSync, readdirSync } from "./vfs.js";
|
|
3
3
|
|
|
4
4
|
function safeDecode(val) {
|
|
5
5
|
try {
|
|
@@ -61,7 +61,7 @@ function getFilePathAndDynamicParams(
|
|
|
61
61
|
accumulative = false,
|
|
62
62
|
accumulate = [],
|
|
63
63
|
isFound = { value: false },
|
|
64
|
-
possibleExtensions = [".tsx", ".ts", ".jsx", ".js"]
|
|
64
|
+
possibleExtensions = [".tsx", ".ts", ".jsx", ".js", ".mjs"]
|
|
65
65
|
) {
|
|
66
66
|
let foundInCurrentPath;
|
|
67
67
|
if (index > reqSegments.length - 1 || !finalDestination) {
|
|
@@ -422,6 +422,9 @@ function getFilePathAndDynamicParams(
|
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
-
|
|
425
|
+
export {
|
|
426
|
+
getFilePathAndDynamicParams,
|
|
427
|
+
};
|
|
428
|
+
export default {
|
|
426
429
|
getFilePathAndDynamicParams,
|
|
427
430
|
};
|
package/dinou/core/get-jsx.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { pathToFileURL, fileURLToPath } from "node:url";
|
|
3
|
+
import { existsSync } from "./vfs.js";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import {
|
|
6
6
|
getFilePathAndDynamicParams,
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
} from "./get-file-path-and-dynamic-params.js";
|
|
8
|
+
import importModule from "./import-module.js";
|
|
9
|
+
import { asyncRenderJSXToClientJSX } from "./render-jsx-to-client-jsx.js";
|
|
10
|
+
import { getLayoutProps } from "./layout-functions.js";
|
|
11
|
+
import { DinouPageSlot as RawDinouPageSlot } from "./slot.js";
|
|
12
|
+
import { getErrorJSX } from "./get-error-jsx.js";
|
|
13
|
+
import { createRequire } from "node:module";
|
|
14
|
+
|
|
15
|
+
const require = createRequire(import.meta.url);
|
|
16
|
+
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
11
17
|
|
|
12
18
|
async function getJSX(
|
|
13
19
|
reqPath,
|
|
@@ -27,12 +33,12 @@ async function getJSX(
|
|
|
27
33
|
|
|
28
34
|
// 1. Segmented handling for Layout: If only the layout is requested
|
|
29
35
|
if (options && options.segment === "layout") {
|
|
30
|
-
let
|
|
36
|
+
let DinouPageSlot = RawDinouPageSlot;
|
|
31
37
|
if (
|
|
32
38
|
typeof DinouPageSlot === "function" &&
|
|
33
39
|
DinouPageSlot.$$typeof !== Symbol.for("react.client.reference")
|
|
34
40
|
) {
|
|
35
|
-
const slotPath = path.resolve(
|
|
41
|
+
const slotPath = path.resolve(currentDir, "slot.js");
|
|
36
42
|
const fileUrl = pathToFileURL(slotPath).href;
|
|
37
43
|
let regFn = null;
|
|
38
44
|
try {
|
|
@@ -296,7 +302,6 @@ async function getJSX(
|
|
|
296
302
|
`[Dinou] Layout ${layoutPath} failed during render, isolating layout error:`,
|
|
297
303
|
layoutErr?.message || layoutErr
|
|
298
304
|
);
|
|
299
|
-
const { getErrorJSX } = require("./get-error-jsx");
|
|
300
305
|
const serializedError = {
|
|
301
306
|
message: layoutErr.message || "Unknown Error",
|
|
302
307
|
name: layoutErr.name || "Error",
|
|
@@ -320,4 +325,5 @@ async function getJSX(
|
|
|
320
325
|
return jsx;
|
|
321
326
|
}
|
|
322
327
|
|
|
323
|
-
|
|
328
|
+
export { getJSX };
|
|
329
|
+
export default getJSX;
|