dinou 2.0.0 → 2.0.2

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.
Files changed (24) hide show
  1. package/dinou/client-error.jsx +1 -1
  2. package/package.json +1 -1
  3. package/packages/vendor/react-server-dom-esm/LICENSE +21 -21
  4. package/packages/vendor/react-server-dom-esm/README.md +5 -5
  5. package/packages/vendor/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js +4477 -4477
  6. package/packages/vendor/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.production.js +1783 -1783
  7. package/packages/vendor/react-server-dom-esm/cjs/react-server-dom-esm-client.node.development.js +4544 -4544
  8. package/packages/vendor/react-server-dom-esm/cjs/react-server-dom-esm-client.node.production.js +2016 -2016
  9. package/packages/vendor/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +5672 -5672
  10. package/packages/vendor/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js +2907 -2907
  11. package/packages/vendor/react-server-dom-esm/client.browser.js +7 -7
  12. package/packages/vendor/react-server-dom-esm/client.js +3 -3
  13. package/packages/vendor/react-server-dom-esm/client.node.js +7 -7
  14. package/packages/vendor/react-server-dom-esm/esm/package.json +3 -3
  15. package/packages/vendor/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js +5586 -5586
  16. package/packages/vendor/react-server-dom-esm/esm/react-server-dom-esm-client.browser.production.js +2620 -2620
  17. package/packages/vendor/react-server-dom-esm/esm/react-server-dom-esm-node-loader.production.js +515 -515
  18. package/packages/vendor/react-server-dom-esm/index.js +12 -12
  19. package/packages/vendor/react-server-dom-esm/package.json +62 -62
  20. package/packages/vendor/react-server-dom-esm/server.js +6 -6
  21. package/packages/vendor/react-server-dom-esm/server.node.js +17 -17
  22. package/packages/vendor/react-server-dom-esm/static.js +6 -6
  23. package/packages/vendor/react-server-dom-esm/static.node.js +12 -12
  24. package/rollup-plugins/rollup-plugin-react-client-manifest.js +126 -4
@@ -1,12 +1,12 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
- 'use strict';
11
-
12
- throw new Error('Use react-server-dom-esm/client instead.');
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ throw new Error('Use react-server-dom-esm/client instead.');
@@ -1,63 +1,63 @@
1
- {
2
- "name": "@matthamlin/react-server-dom-esm",
3
- "description": "React Server Components bindings for DOM using ESM. This is intended to be integrated into meta-frameworks. It is not intended to be imported directly.",
4
- "version": "0.0.0-experimental-594fb5e9-20250811",
5
- "keywords": [
6
- "react"
7
- ],
8
- "homepage": "https://react.dev/",
9
- "bugs": "https://github.com/facebook/react/issues",
10
- "license": "MIT",
11
- "files": [
12
- "LICENSE",
13
- "README.md",
14
- "index.js",
15
- "client.js",
16
- "client.browser.js",
17
- "client.node.js",
18
- "server.js",
19
- "server.node.js",
20
- "static.js",
21
- "static.node.js",
22
- "cjs/",
23
- "esm/"
24
- ],
25
- "exports": {
26
- ".": "./index.js",
27
- "./client": {
28
- "node": "./client.node.js",
29
- "default": "./client.browser.js"
30
- },
31
- "./client.browser": "./client.browser.js",
32
- "./client.node": "./client.node.js",
33
- "./server": {
34
- "react-server": "./server.node.js",
35
- "default": "./server.js"
36
- },
37
- "./server.node": "./server.node.js",
38
- "./static": {
39
- "react-server": "./static.node.js",
40
- "default": "./static.js"
41
- },
42
- "./static.node": "./static.node.js",
43
- "./node-loader": "./esm/react-server-dom-esm-node-loader.production.js",
44
- "./package.json": "./package.json"
45
- },
46
- "main": "index.js",
47
- "repository": {
48
- "type": "git",
49
- "url": "https://github.com/facebook/react.git",
50
- "directory": "packages/react-server-dom-esm"
51
- },
52
- "engines": {
53
- "node": ">=0.10.0"
54
- },
55
- "peerDependencies": {
56
- "react": ">=19.1.0",
57
- "react-dom": ">=19.1.0"
58
- },
59
- "dependencies": {
60
- "acorn-loose": "^8.3.0",
61
- "webpack-sources": "^3.2.0"
62
- }
1
+ {
2
+ "name": "@matthamlin/react-server-dom-esm",
3
+ "description": "React Server Components bindings for DOM using ESM. This is intended to be integrated into meta-frameworks. It is not intended to be imported directly.",
4
+ "version": "0.0.0-experimental-594fb5e9-20250811",
5
+ "keywords": [
6
+ "react"
7
+ ],
8
+ "homepage": "https://react.dev/",
9
+ "bugs": "https://github.com/facebook/react/issues",
10
+ "license": "MIT",
11
+ "files": [
12
+ "LICENSE",
13
+ "README.md",
14
+ "index.js",
15
+ "client.js",
16
+ "client.browser.js",
17
+ "client.node.js",
18
+ "server.js",
19
+ "server.node.js",
20
+ "static.js",
21
+ "static.node.js",
22
+ "cjs/",
23
+ "esm/"
24
+ ],
25
+ "exports": {
26
+ ".": "./index.js",
27
+ "./client": {
28
+ "node": "./client.node.js",
29
+ "default": "./client.browser.js"
30
+ },
31
+ "./client.browser": "./client.browser.js",
32
+ "./client.node": "./client.node.js",
33
+ "./server": {
34
+ "react-server": "./server.node.js",
35
+ "default": "./server.js"
36
+ },
37
+ "./server.node": "./server.node.js",
38
+ "./static": {
39
+ "react-server": "./static.node.js",
40
+ "default": "./static.js"
41
+ },
42
+ "./static.node": "./static.node.js",
43
+ "./node-loader": "./esm/react-server-dom-esm-node-loader.production.js",
44
+ "./package.json": "./package.json"
45
+ },
46
+ "main": "index.js",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "https://github.com/facebook/react.git",
50
+ "directory": "packages/react-server-dom-esm"
51
+ },
52
+ "engines": {
53
+ "node": ">=0.10.0"
54
+ },
55
+ "peerDependencies": {
56
+ "react": ">=19.1.0",
57
+ "react-dom": ">=19.1.0"
58
+ },
59
+ "dependencies": {
60
+ "acorn-loose": "^8.3.0",
61
+ "webpack-sources": "^3.2.0"
62
+ }
63
63
  }
@@ -1,6 +1,6 @@
1
- 'use strict';
2
-
3
- throw new Error(
4
- 'The React Server Writer cannot be used outside a react-server environment. ' +
5
- 'You must configure Node.js using the `--conditions react-server` flag.'
6
- );
1
+ 'use strict';
2
+
3
+ throw new Error(
4
+ 'The React Server Writer cannot be used outside a react-server environment. ' +
5
+ 'You must configure Node.js using the `--conditions react-server` flag.'
6
+ );
@@ -1,17 +1,17 @@
1
- 'use strict';
2
-
3
- var s;
4
- if (process.env.NODE_ENV === 'production') {
5
- s = require('./cjs/react-server-dom-esm-server.node.production.js');
6
- } else {
7
- s = require('./cjs/react-server-dom-esm-server.node.development.js');
8
- }
9
-
10
- exports.renderToPipeableStream = s.renderToPipeableStream;
11
- exports.decodeReplyFromBusboy = s.decodeReplyFromBusboy;
12
- exports.decodeReply = s.decodeReply;
13
- exports.decodeAction = s.decodeAction;
14
- exports.decodeFormState = s.decodeFormState;
15
- exports.registerServerReference = s.registerServerReference;
16
- exports.registerClientReference = s.registerClientReference;
17
- exports.createTemporaryReferenceSet = s.createTemporaryReferenceSet;
1
+ 'use strict';
2
+
3
+ var s;
4
+ if (process.env.NODE_ENV === 'production') {
5
+ s = require('./cjs/react-server-dom-esm-server.node.production.js');
6
+ } else {
7
+ s = require('./cjs/react-server-dom-esm-server.node.development.js');
8
+ }
9
+
10
+ exports.renderToPipeableStream = s.renderToPipeableStream;
11
+ exports.decodeReplyFromBusboy = s.decodeReplyFromBusboy;
12
+ exports.decodeReply = s.decodeReply;
13
+ exports.decodeAction = s.decodeAction;
14
+ exports.decodeFormState = s.decodeFormState;
15
+ exports.registerServerReference = s.registerServerReference;
16
+ exports.registerClientReference = s.registerClientReference;
17
+ exports.createTemporaryReferenceSet = s.createTemporaryReferenceSet;
@@ -1,6 +1,6 @@
1
- 'use strict';
2
-
3
- throw new Error(
4
- 'The React Server Writer cannot be used outside a react-server environment. ' +
5
- 'You must configure Node.js using the `--conditions react-server` flag.'
6
- );
1
+ 'use strict';
2
+
3
+ throw new Error(
4
+ 'The React Server Writer cannot be used outside a react-server environment. ' +
5
+ 'You must configure Node.js using the `--conditions react-server` flag.'
6
+ );
@@ -1,12 +1,12 @@
1
- 'use strict';
2
-
3
- var s;
4
- if (process.env.NODE_ENV === 'production') {
5
- s = require('./cjs/react-server-dom-esm-server.node.production.js');
6
- } else {
7
- s = require('./cjs/react-server-dom-esm-server.node.development.js');
8
- }
9
-
10
- if (s.unstable_prerenderToNodeStream) {
11
- exports.unstable_prerenderToNodeStream = s.unstable_prerenderToNodeStream;
12
- }
1
+ 'use strict';
2
+
3
+ var s;
4
+ if (process.env.NODE_ENV === 'production') {
5
+ s = require('./cjs/react-server-dom-esm-server.node.production.js');
6
+ } else {
7
+ s = require('./cjs/react-server-dom-esm-server.node.development.js');
8
+ }
9
+
10
+ if (s.unstable_prerenderToNodeStream) {
11
+ exports.unstable_prerenderToNodeStream = s.unstable_prerenderToNodeStream;
12
+ }
@@ -12,6 +12,7 @@ function reactClientManifestPlugin({
12
12
  } = {}) {
13
13
  const manifest = {};
14
14
  const clientModules = new Set();
15
+ const serverModules = new Set();
15
16
 
16
17
  function parseExports(code) {
17
18
  const ast = parser.parse(code, {
@@ -77,6 +78,102 @@ function reactClientManifestPlugin({
77
78
  }
78
79
  }
79
80
 
81
+ function getImports(code, baseFilePath, visited = new Set()) {
82
+ if (visited.has(baseFilePath)) {
83
+ return [];
84
+ }
85
+ visited.add(baseFilePath);
86
+
87
+ const ast = parser.parse(code, {
88
+ sourceType: "module",
89
+ plugins: ["jsx", "typescript"],
90
+ });
91
+ const imports = new Set();
92
+
93
+ traverse(ast, {
94
+ ImportDeclaration(nodePath) {
95
+ const source = nodePath.node.source.value;
96
+ if (source.startsWith(".")) {
97
+ let absImportPath = path.resolve(path.dirname(baseFilePath), source);
98
+ const extensions = [".js", ".jsx", ".ts", ".tsx"];
99
+ if (!extensions.some((ext) => absImportPath.endsWith(ext))) {
100
+ for (const ext of extensions) {
101
+ const potentialPath = absImportPath + ext;
102
+ if (existsSync(potentialPath)) {
103
+ absImportPath = potentialPath;
104
+ break;
105
+ }
106
+ }
107
+ }
108
+ if (existsSync(absImportPath)) {
109
+ imports.add(absImportPath);
110
+ try {
111
+ const importCode = readFileSync(absImportPath, "utf8");
112
+ const nestedImports = getImports(
113
+ importCode,
114
+ absImportPath,
115
+ visited
116
+ );
117
+ nestedImports.forEach((nestedPath) => imports.add(nestedPath));
118
+ } catch (err) {
119
+ console.warn(
120
+ `[react-client-manifest] Could not read import: ${absImportPath}`,
121
+ err.message
122
+ );
123
+ }
124
+ } else {
125
+ console.warn(
126
+ `[react-client-manifest] Import path not found: ${absImportPath}`
127
+ );
128
+ }
129
+ }
130
+ },
131
+ });
132
+
133
+ return Array.from(imports);
134
+ }
135
+
136
+ function isPageOrLayout(absPath) {
137
+ const fileName = path.basename(absPath);
138
+ return fileName.startsWith("page.") || fileName.startsWith("layout.");
139
+ }
140
+
141
+ function isAsyncDefaultExport(code) {
142
+ const ast = parser.parse(code, {
143
+ sourceType: "module",
144
+ plugins: ["jsx", "typescript"],
145
+ });
146
+
147
+ let isAsync = false;
148
+
149
+ traverse(ast, {
150
+ ExportDefaultDeclaration(path) {
151
+ let decl = path.node.declaration;
152
+
153
+ if (decl.type === "Identifier") {
154
+ const binding = path.scope.getBinding(decl.name);
155
+ if (binding && binding.path) {
156
+ decl = binding.path.node;
157
+ if (decl.type === "VariableDeclarator") {
158
+ decl = decl.init;
159
+ }
160
+ }
161
+ }
162
+
163
+ if (
164
+ decl &&
165
+ (decl.type === "FunctionDeclaration" ||
166
+ decl.type === "ArrowFunctionExpression" ||
167
+ decl.type === "FunctionExpression")
168
+ ) {
169
+ isAsync = decl.async;
170
+ }
171
+ },
172
+ });
173
+
174
+ return isAsync;
175
+ }
176
+
80
177
  return {
81
178
  name: "react-client-manifest",
82
179
  async buildStart() {
@@ -93,12 +190,23 @@ function reactClientManifestPlugin({
93
190
  if (isClientModule) {
94
191
  clientModules.add(normalizedPath);
95
192
  updateManifestForModule(absPath, code, true);
96
-
97
193
  this.emitFile({
98
194
  type: "chunk",
99
195
  id: absPath,
100
196
  name: path.basename(absPath, path.extname(absPath)),
101
197
  });
198
+ } else if (isPageOrLayout(absPath)) {
199
+ if (!isAsyncDefaultExport(code)) {
200
+ this.warn(
201
+ `[react-client-manifest] The file ${normalizedPath} is a page or layout without "use client" directive, but its default export is not an async function. Add "use client" if it's a client component, or make the default export async if it's a server component.`
202
+ );
203
+ }
204
+ serverModules.add(normalizedPath);
205
+ this.addWatchFile(absPath);
206
+ const imports = getImports(code, absPath);
207
+ for (const importPath of imports) {
208
+ this.addWatchFile(importPath);
209
+ }
102
210
  }
103
211
  }
104
212
  },
@@ -119,6 +227,7 @@ function reactClientManifestPlugin({
119
227
  }
120
228
  }
121
229
  clientModules.delete(normalizedId);
230
+ serverModules.delete(normalizedId);
122
231
  return;
123
232
  }
124
233
  const code = readFileSync(id, "utf8");
@@ -128,19 +237,33 @@ function reactClientManifestPlugin({
128
237
 
129
238
  if (isClientModule) {
130
239
  clientModules.add(normalizedId);
240
+ serverModules.delete(normalizedId);
131
241
  this.addWatchFile(id);
132
242
  } else {
133
243
  clientModules.delete(normalizedId);
244
+ if (isPageOrLayout(id)) {
245
+ if (!isAsyncDefaultExport(code)) {
246
+ this.warn(
247
+ `[react-client-manifest] The file ${normalizedId} is a page or layout without "use client" directive, but its default export is not an async function. Add "use client" if it's a client component, or make the default export async if it's a server component.`
248
+ );
249
+ }
250
+ serverModules.add(normalizedId);
251
+ this.addWatchFile(id);
252
+ const imports = getImports(code, id);
253
+ for (const importPath of imports) {
254
+ this.addWatchFile(importPath);
255
+ }
256
+ } else {
257
+ serverModules.delete(normalizedId);
258
+ }
134
259
  }
135
260
  },
136
261
  generateBundle(outputOptions, bundle) {
137
262
  for (const [fileName, chunk] of Object.entries(bundle)) {
138
263
  if (chunk.type !== "chunk") continue;
139
-
140
264
  for (const modulePath of Object.keys(chunk.modules)) {
141
265
  const absModulePath = path.resolve(modulePath);
142
266
  const baseFileUrl = pathToFileURL(absModulePath).href;
143
-
144
267
  for (const manifestKey in manifest) {
145
268
  if (manifestKey.startsWith(baseFileUrl)) {
146
269
  manifest[manifestKey].id = "/" + fileName;
@@ -148,7 +271,6 @@ function reactClientManifestPlugin({
148
271
  }
149
272
  }
150
273
  }
151
-
152
274
  const serialized = JSON.stringify(manifest, null, 2);
153
275
  mkdirSync(dirname(manifestPath), { recursive: true });
154
276
  writeFileSync(manifestPath, serialized);