react-server-dom-webpack 18.3.0-next-c08d8b804-20221118 → 18.3.0-next-2655c9354-20221121

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.
@@ -76,9 +76,15 @@ function writeChunk(destination, chunk) {
76
76
  }
77
77
 
78
78
  if (chunk.length > VIEW_SIZE) {
79
- // this chunk may overflow a single view which implies it was not
79
+ {
80
+ if (precomputedChunkSet.has(chunk)) {
81
+ error('A large precomputed chunk was passed to writeChunk without being copied.' + ' Large chunks get enqueued directly and are not copied. This is incompatible with precomputed chunks because you cannot enqueue the same precomputed chunk twice.' + ' Use "cloneChunk" to make a copy of this large precomputed chunk before writing it. This is a bug in React.');
82
+ }
83
+ } // this chunk may overflow a single view which implies it was not
80
84
  // one that is cached by the streaming renderer. We will enqueu
81
85
  // it directly and expect it is not re-used
86
+
87
+
82
88
  if (writtenBytes > 0) {
83
89
  destination.enqueue(new Uint8Array(currentView.buffer, 0, writtenBytes));
84
90
  currentView = new Uint8Array(VIEW_SIZE);
@@ -133,8 +139,15 @@ var textEncoder = new TextEncoder();
133
139
  function stringToChunk(content) {
134
140
  return textEncoder.encode(content);
135
141
  }
142
+ var precomputedChunkSet = new Set() ;
136
143
  function stringToPrecomputedChunk(content) {
137
- return textEncoder.encode(content);
144
+ var precomputedChunk = textEncoder.encode(content);
145
+
146
+ {
147
+ precomputedChunkSet.add(precomputedChunk);
148
+ }
149
+
150
+ return precomputedChunk;
138
151
  }
139
152
  function closeWithError(destination, error) {
140
153
  // $FlowFixMe[method-unbinding]
@@ -130,9 +130,15 @@ function writeViewChunk(destination, chunk) {
130
130
  }
131
131
 
132
132
  if (chunk.byteLength > VIEW_SIZE) {
133
- // this chunk may overflow a single view which implies it was not
133
+ {
134
+ if (precomputedChunkSet && precomputedChunkSet.has(chunk)) {
135
+ error('A large precomputed chunk was passed to writeChunk without being copied.' + ' Large chunks get enqueued directly and are not copied. This is incompatible with precomputed chunks because you cannot enqueue the same precomputed chunk twice.' + ' Use "cloneChunk" to make a copy of this large precomputed chunk before writing it. This is a bug in React.');
136
+ }
137
+ } // this chunk may overflow a single view which implies it was not
134
138
  // one that is cached by the streaming renderer. We will enqueu
135
139
  // it directly and expect it is not re-used
140
+
141
+
136
142
  if (writtenBytes > 0) {
137
143
  writeToDestination(destination, currentView.subarray(0, writtenBytes));
138
144
  currentView = new Uint8Array(VIEW_SIZE);
@@ -208,8 +214,17 @@ var textEncoder = new util.TextEncoder();
208
214
  function stringToChunk(content) {
209
215
  return content;
210
216
  }
217
+ var precomputedChunkSet = new Set() ;
211
218
  function stringToPrecomputedChunk(content) {
212
- return textEncoder.encode(content);
219
+ var precomputedChunk = textEncoder.encode(content);
220
+
221
+ {
222
+ if (precomputedChunkSet) {
223
+ precomputedChunkSet.add(precomputedChunk);
224
+ }
225
+ }
226
+
227
+ return precomputedChunk;
213
228
  }
214
229
  function closeWithError(destination, error) {
215
230
  // $FlowFixMe: This is an Error object or the destination accepts other types.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-server-dom-webpack",
3
3
  "description": "React Server Components bindings for DOM using Webpack. This is intended to be integrated into meta-frameworks. It is not intended to be imported directly.",
4
- "version": "18.3.0-next-c08d8b804-20221118",
4
+ "version": "18.3.0-next-2655c9354-20221121",
5
5
  "keywords": [
6
6
  "react"
7
7
  ],
@@ -49,8 +49,8 @@
49
49
  "node": ">=0.10.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "react": "18.3.0-next-c08d8b804-20221118",
53
- "react-dom": "18.3.0-next-c08d8b804-20221118",
52
+ "react": "18.3.0-next-2655c9354-20221121",
53
+ "react-dom": "18.3.0-next-2655c9354-20221121",
54
54
  "webpack": "^5.59.0"
55
55
  },
56
56
  "dependencies": {
@@ -72,9 +72,15 @@
72
72
  }
73
73
 
74
74
  if (chunk.length > VIEW_SIZE) {
75
- // this chunk may overflow a single view which implies it was not
75
+ {
76
+ if (precomputedChunkSet.has(chunk)) {
77
+ error('A large precomputed chunk was passed to writeChunk without being copied.' + ' Large chunks get enqueued directly and are not copied. This is incompatible with precomputed chunks because you cannot enqueue the same precomputed chunk twice.' + ' Use "cloneChunk" to make a copy of this large precomputed chunk before writing it. This is a bug in React.');
78
+ }
79
+ } // this chunk may overflow a single view which implies it was not
76
80
  // one that is cached by the streaming renderer. We will enqueu
77
81
  // it directly and expect it is not re-used
82
+
83
+
78
84
  if (writtenBytes > 0) {
79
85
  destination.enqueue(new Uint8Array(currentView.buffer, 0, writtenBytes));
80
86
  currentView = new Uint8Array(VIEW_SIZE);
@@ -129,8 +135,15 @@
129
135
  function stringToChunk(content) {
130
136
  return textEncoder.encode(content);
131
137
  }
138
+ var precomputedChunkSet = new Set() ;
132
139
  function stringToPrecomputedChunk(content) {
133
- return textEncoder.encode(content);
140
+ var precomputedChunk = textEncoder.encode(content);
141
+
142
+ {
143
+ precomputedChunkSet.add(precomputedChunk);
144
+ }
145
+
146
+ return precomputedChunk;
134
147
  }
135
148
  function closeWithError(destination, error) {
136
149
  // $FlowFixMe[method-unbinding]