dinou 8.0.2 → 8.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 +25 -0
- package/README.md +15 -3
- package/dinou/bun/build.js +15 -6
- package/dinou/cloudflare/build.js +15 -6
- package/dinou/core/load-dinou-config.js +10 -0
- package/dinou/core/route-generator.js +1 -1
- package/dinou/core/transform-server-functions.js +291 -0
- package/dinou/deno/build.js +15 -6
- package/dinou/esbuild/build.js +7 -2
- package/dinou/esbuild/helpers-esbuild/get-config-esbuild-prod.js +3 -3
- package/dinou/esbuild/helpers-esbuild/get-esbuild-entries.js +17 -6
- package/dinou/esbuild/plugins-esbuild/manifest-generator-plugin.js +4 -2
- package/dinou/esbuild/plugins-esbuild/server-functions-plugin.js +43 -29
- package/dinou/index.d.ts +9 -3
- package/dinou/index.js +1 -4
- package/dinou/node/bundle-dual-engine.js +15 -6
- package/dinou/node/dev.js +16 -7
- package/dinou/package.json +48 -48
- package/dinou/rollup/rollup-plugins/rollup-plugin-react-client-manifest.js +32 -7
- package/dinou/rollup/rollup-plugins/rollup-plugin-server-functions.js +44 -6
- package/dinou/webpack/helpers/get-webpack-entries.js +24 -4
- package/dinou/webpack/helpers/patch-webpack-internals.js +35 -0
- package/dinou/webpack/plugins/server-functions-plugin.js +44 -2
- package/dinou/webpack/webpack.config.js +2 -0
- package/package.json +48 -48
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import module from "node:module";
|
|
2
|
+
|
|
3
|
+
// Compatibility shim for Webpack 5.112+ internal file reorganization with react-server-dom-webpack
|
|
4
|
+
const originalResolveFilename = module._resolveFilename;
|
|
5
|
+
if (originalResolveFilename) {
|
|
6
|
+
module._resolveFilename = function (request, parent, isMain, options) {
|
|
7
|
+
if (request === "webpack/lib/dependencies/ModuleDependency") {
|
|
8
|
+
try {
|
|
9
|
+
return originalResolveFilename.call(this, request, parent, isMain, options);
|
|
10
|
+
} catch {
|
|
11
|
+
return originalResolveFilename.call(
|
|
12
|
+
this,
|
|
13
|
+
"webpack/lib/dependencies/core/ModuleDependency",
|
|
14
|
+
parent,
|
|
15
|
+
isMain,
|
|
16
|
+
options
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (request === "webpack/lib/Template") {
|
|
21
|
+
try {
|
|
22
|
+
return originalResolveFilename.call(this, request, parent, isMain, options);
|
|
23
|
+
} catch {
|
|
24
|
+
return originalResolveFilename.call(
|
|
25
|
+
this,
|
|
26
|
+
"webpack/lib/template/Template",
|
|
27
|
+
parent,
|
|
28
|
+
isMain,
|
|
29
|
+
options
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return originalResolveFilename.call(this, request, parent, isMain, options);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import fs from "node:fs";
|
|
2
3
|
import manifestGeneratorPlugin from "./manifest-generator-plugin.js";
|
|
4
|
+
import parseExports from "../../core/parse-exports.js";
|
|
5
|
+
import { useServerRegex } from "../../constants.js";
|
|
6
|
+
import { extractServerFunctions, hasServerFunctions } from "../../core/transform-server-functions.js";
|
|
3
7
|
|
|
4
8
|
class WebpackServerFunctionsPluginSimple {
|
|
5
|
-
constructor() {
|
|
9
|
+
constructor(options = {}) {
|
|
6
10
|
this.serverFunctions = new Map();
|
|
11
|
+
this.serverFiles = options.serverFiles || null;
|
|
7
12
|
}
|
|
8
13
|
|
|
9
14
|
apply(compiler) {
|
|
@@ -45,6 +50,34 @@ class WebpackServerFunctionsPluginSimple {
|
|
|
45
50
|
}
|
|
46
51
|
}
|
|
47
52
|
|
|
53
|
+
if (this.serverFiles && this.serverFiles.size > 0) {
|
|
54
|
+
for (const filePath of this.serverFiles) {
|
|
55
|
+
const rel = path.relative(process.cwd(), filePath).replace(/\\/g, "/");
|
|
56
|
+
if (!serverFunctionsManifest[rel]) {
|
|
57
|
+
try {
|
|
58
|
+
const fileCode = fs.readFileSync(filePath, "utf8");
|
|
59
|
+
if (useServerRegex.test(fileCode.trim())) {
|
|
60
|
+
const exports = parseExports(fileCode);
|
|
61
|
+
if (exports && exports.length > 0) {
|
|
62
|
+
serverFunctionsManifest[rel] = exports;
|
|
63
|
+
serverFunctionPaths.add(
|
|
64
|
+
path.resolve(process.cwd(), rel).replace(/\\/g, "/").toLowerCase()
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
} else if (hasServerFunctions(fileCode)) {
|
|
68
|
+
const actions = extractServerFunctions(fileCode, filePath);
|
|
69
|
+
if (actions && actions.length > 0) {
|
|
70
|
+
serverFunctionsManifest[rel] = actions;
|
|
71
|
+
serverFunctionPaths.add(
|
|
72
|
+
path.resolve(process.cwd(), rel).replace(/\\/g, "/").toLowerCase()
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} catch (e) {}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
48
81
|
// 2. Generate final manifest
|
|
49
82
|
const manifestContent = JSON.stringify(
|
|
50
83
|
serverFunctionsManifest,
|
|
@@ -105,8 +138,17 @@ class WebpackServerFunctionsPluginSimple {
|
|
|
105
138
|
}
|
|
106
139
|
|
|
107
140
|
// 5. Replace placeholder ONLY in chunks that actually contain server functions
|
|
141
|
+
const isProd =
|
|
142
|
+
process.env.NODE_ENV === "production" &&
|
|
143
|
+
process.env.DINOU_DEV !== "true";
|
|
108
144
|
const manifest = manifestGeneratorPlugin.manifestData;
|
|
109
|
-
const
|
|
145
|
+
const proxyName = manifest["serverFunctionProxy.js"];
|
|
146
|
+
if (isProd && !proxyName) {
|
|
147
|
+
throw new Error(
|
|
148
|
+
"[Dinou] webpack serverFunctionsPlugin: could not find hashed 'serverFunctionProxy.js' in manifest during production build."
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
const hashedPath = proxyName || "serverFunctionProxy.js";
|
|
110
152
|
|
|
111
153
|
for (const filename of targetAssetFiles) {
|
|
112
154
|
if (filename.endsWith(".js") && assets[filename]) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./helpers/patch-webpack-internals.js";
|
|
1
2
|
import "dotenv/config";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import fs from "node:fs";
|
|
@@ -336,6 +337,7 @@ export default async () => {
|
|
|
336
337
|
}),
|
|
337
338
|
new ServerFunctionsPlugin({
|
|
338
339
|
manifest: manifestGeneratorPlugin.manifestData,
|
|
340
|
+
serverFiles,
|
|
339
341
|
}),
|
|
340
342
|
isDevelopment && new WebpackMemoryPlugin(),
|
|
341
343
|
!isDevelopment && {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dinou",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "Full-stack React 19 framework with native RSC, Server Functions, progressive streaming, and zero vendor lock-in.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dinou/index.js",
|
|
@@ -58,54 +58,54 @@
|
|
|
58
58
|
"url": "https://github.com/roggc/dinou.git"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@babel/core": "
|
|
62
|
-
"@babel/parser": "
|
|
63
|
-
"@babel/plugin-syntax-import-meta": "
|
|
64
|
-
"@babel/preset-react": "
|
|
65
|
-
"@babel/preset-typescript": "
|
|
66
|
-
"@babel/traverse": "
|
|
67
|
-
"@esbuild-plugins/tsconfig-paths": "
|
|
68
|
-
"@roggc/react-server-dom-esm": "
|
|
69
|
-
"@rollup/plugin-babel": "
|
|
70
|
-
"@rollup/plugin-commonjs": "
|
|
71
|
-
"@rollup/plugin-json": "
|
|
72
|
-
"@rollup/plugin-node-resolve": "
|
|
73
|
-
"@rollup/plugin-replace": "
|
|
74
|
-
"@swc/core": "
|
|
75
|
-
"@tailwindcss/postcss": "
|
|
76
|
-
"autoprefixer": "
|
|
77
|
-
"babel-loader": "
|
|
78
|
-
"babel-plugin-react-compiler": "
|
|
79
|
-
"chokidar": "
|
|
80
|
-
"commander": "
|
|
81
|
-
"copy-webpack-plugin": "
|
|
82
|
-
"cross-env": "
|
|
83
|
-
"css-loader": "
|
|
84
|
-
"dotenv": "
|
|
85
|
-
"esbuild": "
|
|
86
|
-
"esbuild-copy-static-files": "
|
|
87
|
-
"generic-names": "
|
|
88
|
-
"mini-css-extract-plugin": "
|
|
89
|
-
"postcss": "
|
|
90
|
-
"postcss-import": "
|
|
91
|
-
"postcss-loader": "
|
|
92
|
-
"postcss-modules": "
|
|
93
|
-
"react-refresh": "
|
|
94
|
-
"react-server-dom-webpack": "
|
|
95
|
-
"rollup": "
|
|
96
|
-
"rollup-plugin-copy": "
|
|
97
|
-
"rollup-plugin-delete": "
|
|
98
|
-
"rollup-plugin-postcss": "
|
|
99
|
-
"rollup-plugin-tsconfig-paths": "
|
|
100
|
-
"tailwindcss": "
|
|
101
|
-
"tsconfig-paths-webpack-plugin": "
|
|
102
|
-
"webpack": "
|
|
103
|
-
"webpack-cli": "
|
|
104
|
-
"webpack-dev-server": "
|
|
105
|
-
"ws": "
|
|
61
|
+
"@babel/core": "7.29.7",
|
|
62
|
+
"@babel/parser": "7.29.11",
|
|
63
|
+
"@babel/plugin-syntax-import-meta": "7.10.4",
|
|
64
|
+
"@babel/preset-react": "7.29.7",
|
|
65
|
+
"@babel/preset-typescript": "7.29.7",
|
|
66
|
+
"@babel/traverse": "7.29.10",
|
|
67
|
+
"@esbuild-plugins/tsconfig-paths": "0.1.2",
|
|
68
|
+
"@roggc/react-server-dom-esm": "19.3.1",
|
|
69
|
+
"@rollup/plugin-babel": "6.1.0",
|
|
70
|
+
"@rollup/plugin-commonjs": "28.0.9",
|
|
71
|
+
"@rollup/plugin-json": "6.1.0",
|
|
72
|
+
"@rollup/plugin-node-resolve": "16.0.3",
|
|
73
|
+
"@rollup/plugin-replace": "6.0.3",
|
|
74
|
+
"@swc/core": "1.16.20",
|
|
75
|
+
"@tailwindcss/postcss": "4.3.3",
|
|
76
|
+
"autoprefixer": "10.6.1",
|
|
77
|
+
"babel-loader": "10.1.1",
|
|
78
|
+
"babel-plugin-react-compiler": "1.0.0",
|
|
79
|
+
"chokidar": "4.0.3",
|
|
80
|
+
"commander": "14.0.3",
|
|
81
|
+
"copy-webpack-plugin": "14.0.0",
|
|
82
|
+
"cross-env": "7.0.3",
|
|
83
|
+
"css-loader": "7.1.5",
|
|
84
|
+
"dotenv": "16.6.1",
|
|
85
|
+
"esbuild": "0.27.7",
|
|
86
|
+
"esbuild-copy-static-files": "0.1.0",
|
|
87
|
+
"generic-names": "4.0.0",
|
|
88
|
+
"mini-css-extract-plugin": "2.10.2",
|
|
89
|
+
"postcss": "8.5.31",
|
|
90
|
+
"postcss-import": "16.2.0",
|
|
91
|
+
"postcss-loader": "8.2.1",
|
|
92
|
+
"postcss-modules": "6.0.1",
|
|
93
|
+
"react-refresh": "0.17.0",
|
|
94
|
+
"react-server-dom-webpack": "19.3.1",
|
|
95
|
+
"rollup": "4.65.0",
|
|
96
|
+
"rollup-plugin-copy": "3.5.0",
|
|
97
|
+
"rollup-plugin-delete": "3.0.2",
|
|
98
|
+
"rollup-plugin-postcss": "4.0.2",
|
|
99
|
+
"rollup-plugin-tsconfig-paths": "1.5.2",
|
|
100
|
+
"tailwindcss": "4.3.3",
|
|
101
|
+
"tsconfig-paths-webpack-plugin": "4.2.0",
|
|
102
|
+
"webpack": "5.112.2",
|
|
103
|
+
"webpack-cli": "6.0.1",
|
|
104
|
+
"webpack-dev-server": "5.2.7",
|
|
105
|
+
"ws": "8.22.0"
|
|
106
106
|
},
|
|
107
107
|
"peerDependencies": {
|
|
108
|
-
"react": ">=19.3.
|
|
109
|
-
"react-dom": ">=19.3.
|
|
108
|
+
"react": ">=19.3.1",
|
|
109
|
+
"react-dom": ">=19.3.1"
|
|
110
110
|
}
|
|
111
111
|
}
|