dinou 7.0.0 → 7.2.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/package.json CHANGED
@@ -1,110 +1,110 @@
1
- {
2
- "name": "dinou",
3
- "version": "7.0.0",
4
- "description": "Full-stack React 19 framework with native RSC, Server Functions, progressive streaming, and zero vendor lock-in.",
5
- "main": "index.js",
6
- "bin": {
7
- "dinou": "./cli.js"
8
- },
9
- "exports": {
10
- ".": {
11
- "types": "./dinou/index.d.ts",
12
- "import": "./dinou/index.mjs",
13
- "require": "./dinou/index.js"
14
- },
15
- "./env": {
16
- "types": "./dinou/env.d.ts"
17
- },
18
- "./server": {
19
- "types": "./dinou/server.d.ts",
20
- "import": "./dinou/server.mjs",
21
- "require": "./dinou/server.js"
22
- },
23
- "./config": {
24
- "types": "./dinou/index.d.ts",
25
- "import": "./dinou/core/config.js",
26
- "require": "./dinou/core/config.js"
27
- },
28
- "./adapters/node": "./dinou/adapters/node.mjs",
29
- "./adapters/bun": "./dinou/adapters/bun.js",
30
- "./adapters/deno": "./dinou/adapters/deno.js",
31
- "./adapters/cloudflare": "./dinou/adapters/cloudflare.js",
32
- "./adapters/netlify": "./dinou/adapters/netlify.js"
33
- },
34
- "types": "./dinou/index.d.ts",
35
- "scripts": {
36
- "test": "echo \"Error: no test specified\" && exit 1"
37
- },
38
- "keywords": [
39
- "react",
40
- "react-19",
41
- "react-server-components",
42
- "rsc",
43
- "react-server-functions",
44
- "framework",
45
- "react-framework",
46
- "esbuild",
47
- "rollup",
48
- "webpack",
49
- "ssr",
50
- "streaming",
51
- "dinou"
52
- ],
53
- "author": "Roger Gomez Castells (https://github.com/roggc)",
54
- "license": "MIT",
55
- "repository": {
56
- "type": "git",
57
- "url": "https://github.com/roggc/dinou.git"
58
- },
59
- "dependencies": {
60
- "@babel/core": "^7.27.4",
61
- "@babel/parser": "^7.28.3",
62
- "@babel/plugin-syntax-import-meta": "^7.10.4",
63
- "@babel/preset-react": "^7.27.1",
64
- "@babel/preset-typescript": "^7.27.1",
65
- "@babel/traverse": "^7.28.3",
66
- "@esbuild-plugins/tsconfig-paths": "^0.1.2",
67
- "@roggc/react-server-dom-esm": "^19.3.0",
68
- "@rollup/plugin-babel": "^6.0.4",
69
- "@rollup/plugin-commonjs": "^28.0.6",
70
- "@rollup/plugin-json": "^6.1.0",
71
- "@rollup/plugin-node-resolve": "^16.0.1",
72
- "@rollup/plugin-replace": "^6.0.2",
73
- "@swc/core": "^1.15.10",
74
- "@tailwindcss/postcss": "^4.1.10",
75
- "autoprefixer": "^10.4.21",
76
- "babel-loader": "^10.0.0",
77
- "babel-plugin-react-compiler": "^1.0.0",
78
- "chokidar": "^4.0.3",
79
- "commander": "^14.0.0",
80
- "copy-webpack-plugin": "^14.0.0",
81
- "cross-env": "^7.0.3",
82
- "css-loader": "^7.1.2",
83
- "dotenv": "^16.5.0",
84
- "esbuild": "^0.27.0",
85
- "esbuild-copy-static-files": "^0.1.0",
86
- "generic-names": "^4.0.0",
87
- "mini-css-extract-plugin": "^2.9.4",
88
- "postcss": "^8.5.5",
89
- "postcss-import": "^16.1.1",
90
- "postcss-loader": "^8.2.0",
91
- "postcss-modules": "^6.0.1",
92
- "react-refresh": "^0.17.0",
93
- "react-server-dom-webpack": "^19.3.0",
94
- "rollup": "^4.46.2",
95
- "rollup-plugin-copy": "^3.5.0",
96
- "rollup-plugin-delete": "^3.0.1",
97
- "rollup-plugin-postcss": "^4.0.2",
98
- "rollup-plugin-tsconfig-paths": "^1.5.2",
99
- "tailwindcss": "^4.1.10",
100
- "tsconfig-paths-webpack-plugin": "^4.2.0",
101
- "webpack": "^5.103.0",
102
- "webpack-cli": "^6.0.1",
103
- "webpack-dev-server": "^5.2.2",
104
- "ws": "^8.18.3"
105
- },
106
- "peerDependencies": {
107
- "react": ">=19.3.0",
108
- "react-dom": ">=19.3.0"
109
- }
110
- }
1
+ {
2
+ "name": "dinou",
3
+ "version": "7.2.0",
4
+ "description": "Full-stack React 19 framework with native RSC, Server Functions, progressive streaming, and zero vendor lock-in.",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "dinou": "./cli.js"
8
+ },
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dinou/index.d.ts",
12
+ "import": "./dinou/index.mjs",
13
+ "require": "./dinou/index.js"
14
+ },
15
+ "./env": {
16
+ "types": "./dinou/env.d.ts"
17
+ },
18
+ "./server": {
19
+ "types": "./dinou/server.d.ts",
20
+ "import": "./dinou/server.mjs",
21
+ "require": "./dinou/server.js"
22
+ },
23
+ "./config": {
24
+ "types": "./dinou/index.d.ts",
25
+ "import": "./dinou/core/config.js",
26
+ "require": "./dinou/core/config.js"
27
+ },
28
+ "./adapters/node": "./dinou/adapters/node.mjs",
29
+ "./adapters/bun": "./dinou/adapters/bun.js",
30
+ "./adapters/deno": "./dinou/adapters/deno.js",
31
+ "./adapters/cloudflare": "./dinou/adapters/cloudflare.js",
32
+ "./adapters/netlify": "./dinou/adapters/netlify.js"
33
+ },
34
+ "types": "./dinou/index.d.ts",
35
+ "scripts": {
36
+ "test": "echo \"Error: no test specified\" && exit 1"
37
+ },
38
+ "keywords": [
39
+ "react",
40
+ "react-19",
41
+ "react-server-components",
42
+ "rsc",
43
+ "react-server-functions",
44
+ "framework",
45
+ "react-framework",
46
+ "esbuild",
47
+ "rollup",
48
+ "webpack",
49
+ "ssr",
50
+ "streaming",
51
+ "dinou"
52
+ ],
53
+ "author": "Roger Gomez Castells (https://github.com/roggc)",
54
+ "license": "MIT",
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "https://github.com/roggc/dinou.git"
58
+ },
59
+ "dependencies": {
60
+ "@babel/core": "^7.27.4",
61
+ "@babel/parser": "^7.28.3",
62
+ "@babel/plugin-syntax-import-meta": "^7.10.4",
63
+ "@babel/preset-react": "^7.27.1",
64
+ "@babel/preset-typescript": "^7.27.1",
65
+ "@babel/traverse": "^7.28.3",
66
+ "@esbuild-plugins/tsconfig-paths": "^0.1.2",
67
+ "@roggc/react-server-dom-esm": "^19.3.0",
68
+ "@rollup/plugin-babel": "^6.0.4",
69
+ "@rollup/plugin-commonjs": "^28.0.6",
70
+ "@rollup/plugin-json": "^6.1.0",
71
+ "@rollup/plugin-node-resolve": "^16.0.1",
72
+ "@rollup/plugin-replace": "^6.0.2",
73
+ "@swc/core": "^1.15.10",
74
+ "@tailwindcss/postcss": "^4.1.10",
75
+ "autoprefixer": "^10.4.21",
76
+ "babel-loader": "^10.0.0",
77
+ "babel-plugin-react-compiler": "^1.0.0",
78
+ "chokidar": "^4.0.3",
79
+ "commander": "^14.0.0",
80
+ "copy-webpack-plugin": "^14.0.0",
81
+ "cross-env": "^7.0.3",
82
+ "css-loader": "^7.1.2",
83
+ "dotenv": "^16.5.0",
84
+ "esbuild": "^0.27.0",
85
+ "esbuild-copy-static-files": "^0.1.0",
86
+ "generic-names": "^4.0.0",
87
+ "mini-css-extract-plugin": "^2.9.4",
88
+ "postcss": "^8.5.5",
89
+ "postcss-import": "^16.1.1",
90
+ "postcss-loader": "^8.2.0",
91
+ "postcss-modules": "^6.0.1",
92
+ "react-refresh": "^0.17.0",
93
+ "react-server-dom-webpack": "^19.3.0",
94
+ "rollup": "^4.46.2",
95
+ "rollup-plugin-copy": "^3.5.0",
96
+ "rollup-plugin-delete": "^3.0.1",
97
+ "rollup-plugin-postcss": "^4.0.2",
98
+ "rollup-plugin-tsconfig-paths": "^1.5.2",
99
+ "tailwindcss": "^4.1.10",
100
+ "tsconfig-paths-webpack-plugin": "^4.2.0",
101
+ "webpack": "^5.103.0",
102
+ "webpack-cli": "^6.0.1",
103
+ "webpack-dev-server": "^5.2.2",
104
+ "ws": "^8.18.3"
105
+ },
106
+ "peerDependencies": {
107
+ "react": ">=19.3.0",
108
+ "react-dom": ">=19.3.0"
109
+ }
110
+ }
@@ -1,267 +0,0 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const { transformAsync } = require("@babel/core");
4
- const { fileURLToPath, pathToFileURL } = require("url");
5
- const createScopedName = require("./createScopedName");
6
- const { extensionsWithDot } = require("./asset-extensions.js");
7
- const { getAbsPathWithExt } = require("./get-abs-path-with-ext.js");
8
-
9
- const { normalizePathCase } = require("./path-utils.js");
10
-
11
- const Module = require("module");
12
- const originalResolveFilename = Module._resolveFilename;
13
- const isWebpack = process.env.DINOU_BUILD_TOOL === "webpack";
14
-
15
- let reactServerPath, reactDomServerPath, reactJsxRuntimePath, reactJsxDevRuntimePath;
16
-
17
- const reactPkgJson = require.resolve("react/package.json");
18
- reactServerPath = path.join(path.dirname(reactPkgJson), "react.react-server.js");
19
- reactJsxRuntimePath = path.join(path.dirname(reactPkgJson), "jsx-runtime.react-server.js");
20
- reactJsxDevRuntimePath = path.join(path.dirname(reactPkgJson), "jsx-dev-runtime.react-server.js");
21
-
22
- const reactDomPkgJson = require.resolve("react-dom/package.json");
23
- reactDomServerPath = path.join(path.dirname(reactDomPkgJson), "react-dom.react-server.js");
24
-
25
- let roggcServerNodePath, webpackServerNodePath;
26
- try {
27
- const roggcPkg = require.resolve("@roggc/react-server-dom-esm/package.json");
28
- roggcServerNodePath = path.join(path.dirname(roggcPkg), "server.node.js");
29
- } catch (e) {}
30
-
31
- try {
32
- const wpPkg = require.resolve("react-server-dom-webpack/package.json");
33
- webpackServerNodePath = path.join(path.dirname(wpPkg), "server.node.js");
34
- } catch (e) {}
35
-
36
- Module._resolveFilename = function (request, parent, isMain, options) {
37
- if (request === "react") {
38
- return reactServerPath;
39
- } else if (request === "react-dom") {
40
- return reactDomServerPath;
41
- } else if (request === "react/jsx-runtime") {
42
- return reactJsxRuntimePath;
43
- } else if (request === "react/jsx-dev-runtime") {
44
- return reactJsxDevRuntimePath;
45
- } else if (request === "@roggc/react-server-dom-esm/server" && roggcServerNodePath) {
46
- return roggcServerNodePath;
47
- } else if (request === "react-server-dom-webpack/server" && webpackServerNodePath) {
48
- return webpackServerNodePath;
49
- }
50
- return originalResolveFilename.call(this, request, parent, isMain, options);
51
- };
52
-
53
- require("./css-require-hook.js")();
54
-
55
- function getMtimeParam(absPath) {
56
- try {
57
- const stats = fs.statSync(absPath);
58
- return Math.round(stats.mtimeMs);
59
- } catch (e) {
60
- return Date.now();
61
- }
62
- }
63
-
64
- exports.resolve = async function resolve(specifier, context, defaultResolve) {
65
- if (process.env.DINOU_PROCESS !== "ssr-html") {
66
- if (specifier === "react") {
67
- return { url: pathToFileURL(reactServerPath).href, shortCircuit: true };
68
- }
69
- if (specifier === "react/jsx-runtime") {
70
- return { url: pathToFileURL(reactJsxRuntimePath).href, shortCircuit: true };
71
- }
72
- if (specifier === "react/jsx-dev-runtime") {
73
- return { url: pathToFileURL(reactJsxDevRuntimePath).href, shortCircuit: true };
74
- }
75
- if (specifier === "react-dom") {
76
- return { url: pathToFileURL(reactDomServerPath).href, shortCircuit: true };
77
- }
78
- if (specifier === "@roggc/react-server-dom-esm/server" && roggcServerNodePath) {
79
- return { url: pathToFileURL(roggcServerNodePath).href, shortCircuit: true };
80
- }
81
- if (specifier === "react-server-dom-webpack/server" && webpackServerNodePath) {
82
- return { url: pathToFileURL(webpackServerNodePath).href, shortCircuit: true };
83
- }
84
- }
85
-
86
- const absPathWithExt = getAbsPathWithExt(specifier, context);
87
- if (absPathWithExt) {
88
- let url = pathToFileURL(absPathWithExt).href;
89
- if (process.env.NODE_ENV !== "production") {
90
- url += `?mtime=${getMtimeParam(absPathWithExt)}`;
91
- }
92
-
93
- return {
94
- url,
95
- shortCircuit: true,
96
- };
97
- }
98
-
99
- // Fallback to default resolver
100
- return defaultResolve(specifier, context, defaultResolve);
101
- };
102
-
103
- exports.load = async function load(url, context, defaultLoad) {
104
- // --- 🟢 Handle non-JS assets (png, jpg, etc.)
105
- const assetExts = extensionsWithDot;
106
- const ext = path.extname(url.split("?")[0]); // remove search params if any
107
-
108
- if (assetExts.includes(ext)) {
109
- // Return a tiny stub that mimics what asset-require-hook would do
110
- const filepath = fileURLToPath(url.split("?")[0]);
111
- const localName = path.basename(filepath, ext);
112
- const hashedName = createScopedName(localName, filepath);
113
- const virtualExport = `export default "/assets/${hashedName}${ext}";`;
114
-
115
- return {
116
- format: "module",
117
- source: virtualExport,
118
- shortCircuit: true,
119
- url,
120
- };
121
- }
122
-
123
- if (ext === ".css") {
124
- const mod = require(fileURLToPath(url.split("?")[0]));
125
- const source = `export default ${JSON.stringify(mod)};`;
126
- return { format: "module", source, shortCircuit: true, url };
127
- }
128
-
129
- const cleanUrl = url.split("?")[0];
130
- if (/\.(jsx|tsx|ts|js)$/.test(cleanUrl)) {
131
- let filename;
132
- try {
133
- filename = fileURLToPath(
134
- cleanUrl.startsWith("file://") ? cleanUrl : pathToFileURL(cleanUrl).href
135
- );
136
- } catch (e) {
137
- throw e;
138
- }
139
- const rel = path.relative(
140
- normalizePathCase(process.cwd()),
141
- normalizePathCase(filename)
142
- );
143
- const source = fs.readFileSync(filename, "utf-8");
144
- const urlToReturn = pathToFileURL(filename).href;
145
-
146
- const useClientRegex =
147
- /^\s*(?:(?:\/\/[^\n]*\n\s*)|(?:\/\*[\s\S]*?\*\/\s*))*['"]use client['"]/;
148
- const hasUseClient = useClientRegex.test(source);
149
-
150
- const esmSyntaxRegex = /^(?:import|export)\b/m;
151
- const hasESMSyntax = esmSyntaxRegex.test(source);
152
-
153
- if (ext === ".js" && !rel.startsWith("src" + path.sep) && !hasESMSyntax) {
154
- return defaultLoad(url, context, defaultLoad);
155
- }
156
-
157
- const isReactServer = process.env.DINOU_PROCESS !== "ssr-html";
158
- if (isReactServer && hasUseClient) {
159
- const parseExports = require("./parse-exports.js");
160
- const exports = parseExports(source);
161
- const clientPkgPath = isWebpack
162
- ? require.resolve("react-server-dom-webpack/package.json")
163
- : require.resolve("@roggc/react-server-dom-esm/package.json");
164
- const clientServerNodePath = path.join(path.dirname(clientPkgPath), "server.node.js");
165
- const clientServerNodeUrl = pathToFileURL(clientServerNodePath).href;
166
- let newSrc = `import pkg from ${JSON.stringify(clientServerNodeUrl)};\n`;
167
- newSrc += 'const {registerClientReference} = pkg;\n';
168
- for (const name of exports) {
169
- if (name === 'default') {
170
- newSrc += 'export default ';
171
- newSrc += 'registerClientReference(function() {';
172
- newSrc += 'throw new Error(' + JSON.stringify("Attempted to call the default export of " + urlToReturn + " from the server but it's on the client.") + ');';
173
- newSrc += '},';
174
- newSrc += JSON.stringify(urlToReturn) + ',';
175
- newSrc += JSON.stringify(name) + ');\n';
176
- } else {
177
- newSrc += 'export const ' + name + ' = ';
178
- newSrc += 'registerClientReference(function() {';
179
- newSrc += 'throw new Error(' + JSON.stringify("Attempted to call " + name + "() from the server but " + name + " is on the client.") + ');';
180
- newSrc += '},';
181
- newSrc += JSON.stringify(urlToReturn) + ',';
182
- newSrc += JSON.stringify(name) + ');\n';
183
- }
184
- }
185
- return {
186
- format: "module",
187
- source: newSrc,
188
- shortCircuit: true,
189
- url,
190
- };
191
- }
192
-
193
- const { useServerRegex } = require("../constants.js");
194
- const hasUseServer = useServerRegex.test(source);
195
-
196
- if (isReactServer && hasUseServer) {
197
- const parseExports = require("./parse-exports.js");
198
- const exports = parseExports(source);
199
-
200
- const { code } = await transformAsync(source, {
201
- filename,
202
- presets: [
203
- ["@babel/preset-react", { runtime: "automatic" }],
204
- "@babel/preset-typescript",
205
- ],
206
- sourceMaps: "inline",
207
- ast: false,
208
- });
209
-
210
- let newSrc = code + "\n\n";
211
-
212
- const serverPkgPath = isWebpack
213
- ? require.resolve("react-server-dom-webpack/package.json")
214
- : require.resolve("@roggc/react-server-dom-esm/package.json");
215
- const serverNodePath = path.join(path.dirname(serverPkgPath), "server.node.js");
216
- const serverNodeUrl = pathToFileURL(serverNodePath).href;
217
- newSrc += `import pkgServer from ${JSON.stringify(serverNodeUrl)};\n`;
218
- newSrc += 'const {registerServerReference} = pkgServer;\n';
219
-
220
- const relativeFileUrl = "file:///" + rel.replace(/\\/g, "/");
221
- for (const name of exports) {
222
- if (name !== 'default') {
223
- newSrc += `registerServerReference(${name}, ${JSON.stringify(relativeFileUrl)}, ${JSON.stringify(name)});\n`;
224
- }
225
- }
226
-
227
- return {
228
- format: "module",
229
- source: newSrc,
230
- shortCircuit: true,
231
- url,
232
- };
233
- }
234
-
235
- if (ext === ".js") {
236
- return {
237
- format: "module",
238
- source,
239
- shortCircuit: true,
240
- url,
241
- };
242
- }
243
-
244
- const { code } = await transformAsync(source, {
245
- filename,
246
- presets: [
247
- ["@babel/preset-react", { runtime: "automatic" }],
248
- "@babel/preset-typescript",
249
- ],
250
- sourceMaps: "inline",
251
- ast: false,
252
- });
253
-
254
- // const urlToReturn = pathToFileURL(filename).href;
255
-
256
- return {
257
- format: "module",
258
- source: code,
259
- shortCircuit: true,
260
- url,
261
- };
262
- }
263
-
264
- if (url) {
265
- return defaultLoad(url, context, defaultLoad);
266
- }
267
- };