react-server-dom-rspack 0.0.1-alpha.8 → 0.0.1-beta.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.
Files changed (65) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +3 -1
  3. package/{vendor/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js → cjs/react-server-dom-rspack-client.browser.development.js} +372 -203
  4. package/{vendor/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js → cjs/react-server-dom-rspack-client.browser.production.js} +133 -83
  5. package/{vendor/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js → cjs/react-server-dom-rspack-client.edge.development.js} +304 -160
  6. package/{vendor/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js → cjs/react-server-dom-rspack-client.edge.production.js} +119 -79
  7. package/{vendor/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js → cjs/react-server-dom-rspack-client.node.development.js} +326 -191
  8. package/{vendor/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js → cjs/react-server-dom-rspack-client.node.production.js} +127 -95
  9. package/{vendor/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js → cjs/react-server-dom-rspack-server.browser.development.js} +263 -297
  10. package/{vendor/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js → cjs/react-server-dom-rspack-server.browser.production.js} +170 -224
  11. package/{vendor/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js → cjs/react-server-dom-rspack-server.edge.development.js} +283 -309
  12. package/{vendor/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js → cjs/react-server-dom-rspack-server.edge.production.js} +186 -231
  13. package/{vendor/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js → cjs/react-server-dom-rspack-server.node.development.js} +543 -522
  14. package/{vendor/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js → cjs/react-server-dom-rspack-server.node.production.js} +197 -243
  15. package/client.browser.js +7 -0
  16. package/client.edge.js +7 -0
  17. package/client.node.js +7 -0
  18. package/{vendor/react-server-dom-webpack/index.js → index.js} +1 -1
  19. package/package.json +66 -128
  20. package/plugin.js +3 -0
  21. package/server.browser.js +24 -0
  22. package/server.edge.js +25 -0
  23. package/{vendor/react-server-dom-webpack/server.node.js → server.node.js} +10 -3
  24. package/static.browser.js +10 -0
  25. package/static.edge.js +10 -0
  26. package/{vendor/react-server-dom-webpack/static.node.js → static.node.js} +2 -2
  27. package/dist/client.browser.d.ts +0 -23
  28. package/dist/client.browser.js +0 -41
  29. package/dist/client.d.ts +0 -1
  30. package/dist/client.edge.d.ts +0 -28
  31. package/dist/client.edge.js +0 -27
  32. package/dist/client.js +0 -1
  33. package/dist/client.node.d.ts +0 -11
  34. package/dist/client.node.js +0 -10
  35. package/dist/index.d.ts +0 -0
  36. package/dist/index.js +0 -2
  37. package/dist/server.browser.d.ts +0 -30
  38. package/dist/server.browser.js +0 -68
  39. package/dist/server.d.ts +0 -0
  40. package/dist/server.edge.d.ts +0 -32
  41. package/dist/server.edge.js +0 -71
  42. package/dist/server.js +0 -3
  43. package/dist/server.node.d.ts +0 -33
  44. package/dist/server.node.js +0 -75
  45. package/dist/types.d.ts +0 -45
  46. package/dist/types.js +0 -1
  47. package/vendor/react-server-dom-webpack/LICENSE +0 -21
  48. package/vendor/react-server-dom-webpack/README.md +0 -5
  49. package/vendor/react-server-dom-webpack/cjs/react-server-dom-webpack-node-register.js +0 -69
  50. package/vendor/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js +0 -404
  51. package/vendor/react-server-dom-webpack/client.browser.js +0 -7
  52. package/vendor/react-server-dom-webpack/client.edge.js +0 -7
  53. package/vendor/react-server-dom-webpack/client.node.js +0 -7
  54. package/vendor/react-server-dom-webpack/esm/react-server-dom-webpack-node-loader.production.js +0 -515
  55. package/vendor/react-server-dom-webpack/node-register.js +0 -3
  56. package/vendor/react-server-dom-webpack/package.json +0 -96
  57. package/vendor/react-server-dom-webpack/plugin.js +0 -3
  58. package/vendor/react-server-dom-webpack/server.browser.js +0 -17
  59. package/vendor/react-server-dom-webpack/server.edge.js +0 -18
  60. package/vendor/react-server-dom-webpack/static.browser.js +0 -10
  61. package/vendor/react-server-dom-webpack/static.edge.js +0 -10
  62. /package/{vendor/react-server-dom-webpack/client.js → client.js} +0 -0
  63. /package/{vendor/react-server-dom-webpack/esm → esm}/package.json +0 -0
  64. /package/{vendor/react-server-dom-webpack/server.js → server.js} +0 -0
  65. /package/{vendor/react-server-dom-webpack/static.js → static.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license React
3
- * react-server-dom-webpack-server.node.production.js
3
+ * react-server-dom-rspack-server.node.production.js
4
4
  *
5
5
  * Copyright (c) Meta Platforms, Inc. and affiliates.
6
6
  *
@@ -15,6 +15,50 @@ require("crypto");
15
15
  var async_hooks = require("async_hooks"),
16
16
  ReactDOM = require("react-dom"),
17
17
  React = require("react"),
18
+ assign = Object.assign,
19
+ CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
20
+ SERVER_REFERENCE_TAG = Symbol.for("react.server.reference"),
21
+ FunctionBind = Function.prototype.bind,
22
+ ArraySlice = Array.prototype.slice;
23
+ function bind() {
24
+ var newFn = FunctionBind.apply(this, arguments);
25
+ if (this.$$typeof === SERVER_REFERENCE_TAG) {
26
+ var args = ArraySlice.call(arguments, 1),
27
+ $$typeof = { value: SERVER_REFERENCE_TAG },
28
+ $$id = { value: this.$$id };
29
+ args = { value: this.$$bound ? this.$$bound.concat(args) : args };
30
+ return Object.defineProperties(newFn, {
31
+ $$typeof: $$typeof,
32
+ $$id: $$id,
33
+ $$bound: args,
34
+ bind: { value: bind, configurable: !0 }
35
+ });
36
+ }
37
+ return newFn;
38
+ }
39
+ var serverReferenceToString = {
40
+ value: function () {
41
+ return "function () { [omitted code] }";
42
+ },
43
+ configurable: !0,
44
+ writable: !0
45
+ },
46
+ currentStrategy = {
47
+ encrypt: function (_actionId) {
48
+ for (
49
+ var _len = arguments.length,
50
+ args = Array(1 < _len ? _len - 1 : 0),
51
+ _key = 1;
52
+ _key < _len;
53
+ _key++
54
+ )
55
+ args[_key - 1] = arguments[_key];
56
+ return Promise.resolve(args);
57
+ },
58
+ decrypt: function (_actionId, payloadPromise) {
59
+ return payloadPromise;
60
+ }
61
+ },
18
62
  REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
19
63
  REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
20
64
  REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
@@ -24,9 +68,9 @@ var async_hooks = require("async_hooks"),
24
68
  REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
25
69
  REACT_MEMO_TYPE = Symbol.for("react.memo"),
26
70
  REACT_LAZY_TYPE = Symbol.for("react.lazy"),
27
- REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
28
- Symbol.for("react.postpone");
29
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
71
+ REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"),
72
+ REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
73
+ MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
30
74
  function getIteratorFn(maybeIterable) {
31
75
  if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
32
76
  maybeIterable =
@@ -35,6 +79,7 @@ function getIteratorFn(maybeIterable) {
35
79
  return "function" === typeof maybeIterable ? maybeIterable : null;
36
80
  }
37
81
  var ASYNC_ITERATOR = Symbol.asyncIterator,
82
+ REACT_OPTIMISTIC_KEY = Symbol.for("react.optimistic_key"),
38
83
  scheduleMicrotask = queueMicrotask,
39
84
  currentView = null,
40
85
  writtenBytes = 0,
@@ -46,13 +91,13 @@ function writeToDestination(destination, view) {
46
91
  function writeChunkAndReturn(destination, chunk) {
47
92
  if ("string" === typeof chunk) {
48
93
  if (0 !== chunk.length)
49
- if (2048 < 3 * chunk.length)
94
+ if (4096 < 3 * chunk.length)
50
95
  0 < writtenBytes &&
51
96
  (writeToDestination(
52
97
  destination,
53
98
  currentView.subarray(0, writtenBytes)
54
99
  ),
55
- (currentView = new Uint8Array(2048)),
100
+ (currentView = new Uint8Array(4096)),
56
101
  (writtenBytes = 0)),
57
102
  writeToDestination(destination, chunk);
58
103
  else {
@@ -66,25 +111,25 @@ function writeChunkAndReturn(destination, chunk) {
66
111
  destination,
67
112
  currentView.subarray(0, writtenBytes)
68
113
  ),
69
- (currentView = new Uint8Array(2048)),
114
+ (currentView = new Uint8Array(4096)),
70
115
  (writtenBytes = textEncoder.encodeInto(
71
116
  chunk.slice(read),
72
117
  currentView
73
118
  ).written));
74
- 2048 === writtenBytes &&
119
+ 4096 === writtenBytes &&
75
120
  (writeToDestination(destination, currentView),
76
- (currentView = new Uint8Array(2048)),
121
+ (currentView = new Uint8Array(4096)),
77
122
  (writtenBytes = 0));
78
123
  }
79
124
  } else
80
125
  0 !== chunk.byteLength &&
81
- (2048 < chunk.byteLength
126
+ (4096 < chunk.byteLength
82
127
  ? (0 < writtenBytes &&
83
128
  (writeToDestination(
84
129
  destination,
85
130
  currentView.subarray(0, writtenBytes)
86
131
  ),
87
- (currentView = new Uint8Array(2048)),
132
+ (currentView = new Uint8Array(4096)),
88
133
  (writtenBytes = 0)),
89
134
  writeToDestination(destination, chunk))
90
135
  : ((target = currentView.length - writtenBytes),
@@ -95,13 +140,13 @@ function writeChunkAndReturn(destination, chunk) {
95
140
  (writtenBytes += target),
96
141
  writeToDestination(destination, currentView),
97
142
  (chunk = chunk.subarray(target))),
98
- (currentView = new Uint8Array(2048)),
143
+ (currentView = new Uint8Array(4096)),
99
144
  (writtenBytes = 0)),
100
145
  currentView.set(chunk, writtenBytes),
101
146
  (writtenBytes += chunk.byteLength),
102
- 2048 === writtenBytes &&
147
+ 4096 === writtenBytes &&
103
148
  (writeToDestination(destination, currentView),
104
- (currentView = new Uint8Array(2048)),
149
+ (currentView = new Uint8Array(4096)),
105
150
  (writtenBytes = 0))));
106
151
  return destinationHasCapacity;
107
152
  }
@@ -111,180 +156,7 @@ function byteLengthOfChunk(chunk) {
111
156
  ? Buffer.byteLength(chunk, "utf8")
112
157
  : chunk.byteLength;
113
158
  }
114
- var CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
115
- SERVER_REFERENCE_TAG = Symbol.for("react.server.reference");
116
- function registerClientReferenceImpl(proxyImplementation, id, async) {
117
- return Object.defineProperties(proxyImplementation, {
118
- $$typeof: { value: CLIENT_REFERENCE_TAG$1 },
119
- $$id: { value: id },
120
- $$async: { value: async }
121
- });
122
- }
123
- var FunctionBind = Function.prototype.bind,
124
- ArraySlice = Array.prototype.slice;
125
- function bind() {
126
- var newFn = FunctionBind.apply(this, arguments);
127
- if (this.$$typeof === SERVER_REFERENCE_TAG) {
128
- var args = ArraySlice.call(arguments, 1),
129
- $$typeof = { value: SERVER_REFERENCE_TAG },
130
- $$id = { value: this.$$id };
131
- args = { value: this.$$bound ? this.$$bound.concat(args) : args };
132
- return Object.defineProperties(newFn, {
133
- $$typeof: $$typeof,
134
- $$id: $$id,
135
- $$bound: args,
136
- bind: { value: bind, configurable: !0 }
137
- });
138
- }
139
- return newFn;
140
- }
141
- var serverReferenceToString = {
142
- value: function () {
143
- return "function () { [omitted code] }";
144
- },
145
- configurable: !0,
146
- writable: !0
147
- },
148
- PROMISE_PROTOTYPE = Promise.prototype,
149
- deepProxyHandlers = {
150
- get: function (target, name) {
151
- switch (name) {
152
- case "$$typeof":
153
- return target.$$typeof;
154
- case "$$id":
155
- return target.$$id;
156
- case "$$async":
157
- return target.$$async;
158
- case "name":
159
- return target.name;
160
- case "displayName":
161
- return;
162
- case "defaultProps":
163
- return;
164
- case "_debugInfo":
165
- return;
166
- case "toJSON":
167
- return;
168
- case Symbol.toPrimitive:
169
- return Object.prototype[Symbol.toPrimitive];
170
- case Symbol.toStringTag:
171
- return Object.prototype[Symbol.toStringTag];
172
- case "Provider":
173
- throw Error(
174
- "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
175
- );
176
- case "then":
177
- throw Error(
178
- "Cannot await or return from a thenable. You cannot await a client module from a server component."
179
- );
180
- }
181
- throw Error(
182
- "Cannot access " +
183
- (String(target.name) + "." + String(name)) +
184
- " on the server. You cannot dot into a client module from a server component. You can only pass the imported name through."
185
- );
186
- },
187
- set: function () {
188
- throw Error("Cannot assign to a client module from a server module.");
189
- }
190
- };
191
- function getReference(target, name) {
192
- switch (name) {
193
- case "$$typeof":
194
- return target.$$typeof;
195
- case "$$id":
196
- return target.$$id;
197
- case "$$async":
198
- return target.$$async;
199
- case "name":
200
- return target.name;
201
- case "defaultProps":
202
- return;
203
- case "_debugInfo":
204
- return;
205
- case "toJSON":
206
- return;
207
- case Symbol.toPrimitive:
208
- return Object.prototype[Symbol.toPrimitive];
209
- case Symbol.toStringTag:
210
- return Object.prototype[Symbol.toStringTag];
211
- case "__esModule":
212
- var moduleId = target.$$id;
213
- target.default = registerClientReferenceImpl(
214
- function () {
215
- throw Error(
216
- "Attempted to call the default export of " +
217
- moduleId +
218
- " from the server but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
219
- );
220
- },
221
- target.$$id + "#",
222
- target.$$async
223
- );
224
- return !0;
225
- case "then":
226
- if (target.then) return target.then;
227
- if (target.$$async) return;
228
- var clientReference = registerClientReferenceImpl({}, target.$$id, !0),
229
- proxy = new Proxy(clientReference, proxyHandlers$1);
230
- target.status = "fulfilled";
231
- target.value = proxy;
232
- return (target.then = registerClientReferenceImpl(
233
- function (resolve) {
234
- return Promise.resolve(resolve(proxy));
235
- },
236
- target.$$id + "#then",
237
- !1
238
- ));
239
- }
240
- if ("symbol" === typeof name)
241
- throw Error(
242
- "Cannot read Symbol exports. Only named exports are supported on a client module imported on the server."
243
- );
244
- clientReference = target[name];
245
- clientReference ||
246
- ((clientReference = registerClientReferenceImpl(
247
- function () {
248
- throw Error(
249
- "Attempted to call " +
250
- String(name) +
251
- "() from the server but " +
252
- String(name) +
253
- " is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
254
- );
255
- },
256
- target.$$id + "#" + name,
257
- target.$$async
258
- )),
259
- Object.defineProperty(clientReference, "name", { value: name }),
260
- (clientReference = target[name] =
261
- new Proxy(clientReference, deepProxyHandlers)));
262
- return clientReference;
263
- }
264
- var proxyHandlers$1 = {
265
- get: function (target, name) {
266
- return getReference(target, name);
267
- },
268
- getOwnPropertyDescriptor: function (target, name) {
269
- var descriptor = Object.getOwnPropertyDescriptor(target, name);
270
- descriptor ||
271
- ((descriptor = {
272
- value: getReference(target, name),
273
- writable: !1,
274
- configurable: !1,
275
- enumerable: !1
276
- }),
277
- Object.defineProperty(target, name, descriptor));
278
- return descriptor;
279
- },
280
- getPrototypeOf: function () {
281
- return PROMISE_PROTOTYPE;
282
- },
283
- set: function () {
284
- throw Error("Cannot assign to a client module from a server module.");
285
- }
286
- },
287
- ReactDOMSharedInternals =
159
+ var ReactDOMSharedInternals =
288
160
  ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
289
161
  previousDispatcher = ReactDOMSharedInternals.d;
290
162
  ReactDOMSharedInternals.d = {
@@ -503,7 +375,7 @@ function getChildFormatContext(parentContext, type, props) {
503
375
  });
504
376
  break;
505
377
  case "stylesheet":
506
- preload(srcSet, "stylesheet", {
378
+ preload(srcSet, "style", {
507
379
  crossOrigin: props.crossOrigin,
508
380
  integrity: props.integrity,
509
381
  nonce: props.nonce,
@@ -767,6 +639,8 @@ function describeElementType(type) {
767
639
  return "Suspense";
768
640
  case REACT_SUSPENSE_LIST_TYPE:
769
641
  return "SuspenseList";
642
+ case REACT_VIEW_TRANSITION_TYPE:
643
+ return "ViewTransition";
770
644
  }
771
645
  if ("object" === typeof type)
772
646
  switch (type.$$typeof) {
@@ -841,7 +715,7 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
841
715
  : "\n " + str;
842
716
  }
843
717
  var hasOwnProperty = Object.prototype.hasOwnProperty,
844
- ObjectPrototype = Object.prototype,
718
+ ObjectPrototype$1 = Object.prototype,
845
719
  stringify = JSON.stringify;
846
720
  function defaultErrorHandler(error) {
847
721
  console.error(error);
@@ -851,7 +725,6 @@ function RequestInstance(
851
725
  model,
852
726
  bundlerConfig,
853
727
  onError,
854
- onPostpone,
855
728
  onAllReady,
856
729
  onFatalError,
857
730
  identifierPrefix,
@@ -890,7 +763,6 @@ function RequestInstance(
890
763
  this.identifierCount = 1;
891
764
  this.taintCleanupQueue = [];
892
765
  this.onError = void 0 === onError ? defaultErrorHandler : onError;
893
- this.onPostpone = void 0 === onPostpone ? noop : onPostpone;
894
766
  this.onAllReady = onAllReady;
895
767
  this.onFatalError = onFatalError;
896
768
  type = createTask(this, model, null, !1, 0, abortSet);
@@ -971,9 +843,17 @@ function serializeReadableStream(request, task, stream) {
971
843
  callOnAllReadyIfReady(request);
972
844
  else
973
845
  try {
974
- (streamTask.model = entry.value),
975
- request.pendingChunks++,
976
- tryStreamTask(request, streamTask),
846
+ request.pendingChunks++,
847
+ (streamTask.model = entry.value),
848
+ isByteStream
849
+ ? emitTypedArrayChunk(
850
+ request,
851
+ streamTask.id,
852
+ "b",
853
+ streamTask.model,
854
+ !1
855
+ )
856
+ : tryStreamTask(request, streamTask),
977
857
  enqueueFlush(request),
978
858
  reader.read().then(progress, error);
979
859
  } catch (x$11) {
@@ -1007,7 +887,8 @@ function serializeReadableStream(request, task, stream) {
1007
887
  } catch (x) {
1008
888
  supportsBYOB = !1;
1009
889
  }
1010
- var reader = stream.getReader(),
890
+ var isByteStream = supportsBYOB,
891
+ reader = stream.getReader(),
1011
892
  streamTask = createTask(
1012
893
  request,
1013
894
  task.model,
@@ -1017,7 +898,7 @@ function serializeReadableStream(request, task, stream) {
1017
898
  request.abortableTasks
1018
899
  );
1019
900
  request.pendingChunks++;
1020
- task = streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
901
+ task = streamTask.id.toString(16) + ":" + (isByteStream ? "r" : "R") + "\n";
1021
902
  request.completedRegularChunks.push(task);
1022
903
  request.cacheController.signal.addEventListener("abort", abortStream);
1023
904
  reader.read().then(progress, error);
@@ -1186,7 +1067,12 @@ function renderFunctionComponent(request, task, key, Component, props) {
1186
1067
  Component = task.keyPath;
1187
1068
  prevThenableState = task.implicitSlot;
1188
1069
  null !== key
1189
- ? (task.keyPath = null === Component ? key : Component + "," + key)
1070
+ ? (task.keyPath =
1071
+ key === REACT_OPTIMISTIC_KEY || Component === REACT_OPTIMISTIC_KEY
1072
+ ? REACT_OPTIMISTIC_KEY
1073
+ : null === Component
1074
+ ? key
1075
+ : Component + "," + key)
1190
1076
  : null === Component && (task.implicitSlot = !0);
1191
1077
  request = renderModelDestructive(request, task, emptyRoot, "", props);
1192
1078
  task.keyPath = Component;
@@ -1269,7 +1155,11 @@ function renderElement(request, task, type, key, ref, props) {
1269
1155
  key = task.keyPath;
1270
1156
  null === request
1271
1157
  ? (request = key)
1272
- : null !== key && (request = key + "," + request);
1158
+ : null !== key &&
1159
+ (request =
1160
+ key === REACT_OPTIMISTIC_KEY || request === REACT_OPTIMISTIC_KEY
1161
+ ? REACT_OPTIMISTIC_KEY
1162
+ : key + "," + request);
1273
1163
  props = [REACT_ELEMENT_TYPE, type, request, props];
1274
1164
  task = task.implicitSlot && null !== request ? [props] : props;
1275
1165
  return task;
@@ -1707,7 +1597,7 @@ function renderModelDestructive(
1707
1597
  if (value instanceof Date) return "$D" + value.toJSON();
1708
1598
  request = getPrototypeOf(value);
1709
1599
  if (
1710
- request !== ObjectPrototype &&
1600
+ request !== ObjectPrototype$1 &&
1711
1601
  (null === request || null !== getPrototypeOf(request))
1712
1602
  )
1713
1603
  throw Error(
@@ -2025,7 +1915,7 @@ function finishHaltedTask(task, request) {
2025
1915
  function flushCompletedChunks(request) {
2026
1916
  var destination = request.destination;
2027
1917
  if (null !== destination) {
2028
- currentView = new Uint8Array(2048);
1918
+ currentView = new Uint8Array(4096);
2029
1919
  writtenBytes = 0;
2030
1920
  destinationHasCapacity = !0;
2031
1921
  try {
@@ -2224,6 +2114,7 @@ function resolveServerReference(bundlerConfig, id) {
2224
2114
  ? [resolvedModuleData.id, resolvedModuleData.chunks, name, 1]
2225
2115
  : [resolvedModuleData.id, resolvedModuleData.chunks, name];
2226
2116
  }
2117
+ var chunkCache = new Map();
2227
2118
  function requireAsyncModule(id) {
2228
2119
  var promise = __webpack_require__(id);
2229
2120
  if ("function" !== typeof promise.then || "fulfilled" === promise.status)
@@ -2244,10 +2135,15 @@ function ignoreReject() {}
2244
2135
  function preloadModule(metadata) {
2245
2136
  for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; ) {
2246
2137
  var chunkId = chunks[i++];
2247
- i++;
2248
- var thenable = __webpack_chunk_load__(chunkId);
2249
- promises.push(thenable);
2250
- thenable.catch(ignoreReject);
2138
+ chunks[i++];
2139
+ var entry = chunkCache.get(chunkId);
2140
+ if (void 0 === entry) {
2141
+ entry = __webpack_chunk_load__(chunkId);
2142
+ promises.push(entry);
2143
+ var resolve = chunkCache.set.bind(chunkCache, chunkId, null);
2144
+ entry.then(resolve, ignoreReject);
2145
+ chunkCache.set(chunkId, entry);
2146
+ } else null !== entry && promises.push(entry);
2251
2147
  }
2252
2148
  return 4 === metadata.length
2253
2149
  ? 0 === promises.length
@@ -2287,16 +2183,23 @@ ReactPromise.prototype.then = function (resolve, reject) {
2287
2183
  case "fulfilled":
2288
2184
  if ("function" === typeof resolve) {
2289
2185
  for (
2290
- var inspectedValue = this.value, cycleProtection = 0;
2186
+ var inspectedValue = this.value,
2187
+ cycleProtection = 0,
2188
+ visited = new Set();
2291
2189
  inspectedValue instanceof ReactPromise;
2292
2190
 
2293
2191
  ) {
2294
2192
  cycleProtection++;
2295
- if (inspectedValue === this || 1e3 < cycleProtection) {
2193
+ if (
2194
+ inspectedValue === this ||
2195
+ visited.has(inspectedValue) ||
2196
+ 1e3 < cycleProtection
2197
+ ) {
2296
2198
  "function" === typeof reject &&
2297
2199
  reject(Error("Cannot have cyclic thenables."));
2298
2200
  return;
2299
2201
  }
2202
+ visited.add(inspectedValue);
2300
2203
  if ("fulfilled" === inspectedValue.status)
2301
2204
  inspectedValue = inspectedValue.value;
2302
2205
  else break;
@@ -2315,6 +2218,8 @@ ReactPromise.prototype.then = function (resolve, reject) {
2315
2218
  "function" === typeof reject && reject(this.reason);
2316
2219
  }
2317
2220
  };
2221
+ var ObjectPrototype = Object.prototype,
2222
+ ArrayPrototype = Array.prototype;
2318
2223
  function wakeChunk(response, listeners, value) {
2319
2224
  for (var i = 0; i < listeners.length; i++) {
2320
2225
  var listener = listeners[i];
@@ -2627,8 +2532,10 @@ function fulfillReference(response, reference, value) {
2627
2532
  var name = path[i];
2628
2533
  if (
2629
2534
  "object" !== typeof value ||
2630
- !hasOwnProperty.call(value, name) ||
2631
- value instanceof Promise
2535
+ null === value ||
2536
+ (getPrototypeOf(value) !== ObjectPrototype &&
2537
+ getPrototypeOf(value) !== ArrayPrototype) ||
2538
+ !hasOwnProperty.call(value, name)
2632
2539
  )
2633
2540
  throw Error("Invalid reference.");
2634
2541
  value = value[name];
@@ -2676,8 +2583,10 @@ function getOutlinedModel(response, reference, parentObject, key, map) {
2676
2583
  var name = reference[i];
2677
2584
  if (
2678
2585
  "object" !== typeof id ||
2679
- !hasOwnProperty.call(id, name) ||
2680
- id instanceof Promise
2586
+ null === id ||
2587
+ (getPrototypeOf(id) !== ObjectPrototype &&
2588
+ getPrototypeOf(id) !== ArrayPrototype) ||
2589
+ !hasOwnProperty.call(id, name)
2681
2590
  )
2682
2591
  throw Error("Invalid reference.");
2683
2592
  id = id[name];
@@ -3174,9 +3083,17 @@ function createFakeWritableFromNodeReadable(readable) {
3174
3083
  }
3175
3084
  };
3176
3085
  }
3177
- exports.createClientModuleProxy = function (moduleId) {
3178
- moduleId = registerClientReferenceImpl({}, moduleId, !1);
3179
- return new Proxy(moduleId, proxyHandlers$1);
3086
+ exports.createServerEntry = function (value, resource) {
3087
+ var entryJsFiles = __rspack_rsc_manifest__.entryJsFiles || [],
3088
+ entryCssFiles = __rspack_rsc_manifest__.entryCssFiles[resource] || [];
3089
+ ("function" === typeof value ||
3090
+ ("object" === typeof value && null !== value)) &&
3091
+ assign(value, {
3092
+ resource: resource,
3093
+ entryJsFiles: entryJsFiles,
3094
+ entryCssFiles: entryCssFiles
3095
+ });
3096
+ return value;
3180
3097
  };
3181
3098
  exports.createTemporaryReferenceSet = function () {
3182
3099
  return new WeakMap();
@@ -3218,27 +3135,23 @@ exports.decodeFormState = function (actionResult, body, serverManifest) {
3218
3135
  : [actionResult, keyPath, referenceId, bound.length - 1];
3219
3136
  });
3220
3137
  };
3221
- exports.decodeReply = function (body, webpackMap, options) {
3138
+ exports.decodeReply = function (body, options) {
3222
3139
  if ("string" === typeof body) {
3223
3140
  var form = new FormData();
3224
3141
  form.append("0", body);
3225
3142
  body = form;
3226
3143
  }
3227
3144
  body = createResponse(
3228
- webpackMap,
3145
+ __rspack_rsc_manifest__.serverManifest,
3229
3146
  "",
3230
3147
  options ? options.temporaryReferences : void 0,
3231
3148
  body
3232
3149
  );
3233
- webpackMap = getChunk(body, 0);
3150
+ options = getChunk(body, 0);
3234
3151
  close(body);
3235
- return webpackMap;
3152
+ return options;
3236
3153
  };
3237
- exports.decodeReplyFromAsyncIterable = function (
3238
- iterable,
3239
- webpackMap,
3240
- options
3241
- ) {
3154
+ exports.decodeReplyFromAsyncIterable = function (iterable, options) {
3242
3155
  function progress(entry) {
3243
3156
  if (entry.done) close(response);
3244
3157
  else {
@@ -3258,16 +3171,16 @@ exports.decodeReplyFromAsyncIterable = function (
3258
3171
  }
3259
3172
  var iterator = iterable[ASYNC_ITERATOR](),
3260
3173
  response = createResponse(
3261
- webpackMap,
3174
+ __rspack_rsc_manifest__.serverManifest,
3262
3175
  "",
3263
3176
  options ? options.temporaryReferences : void 0
3264
3177
  );
3265
3178
  iterator.next().then(progress, error);
3266
3179
  return getChunk(response, 0);
3267
3180
  };
3268
- exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) {
3181
+ exports.decodeReplyFromBusboy = function (busboyStream, options) {
3269
3182
  var response = createResponse(
3270
- webpackMap,
3183
+ __rspack_rsc_manifest__.serverManifest,
3271
3184
  "",
3272
3185
  options ? options.temporaryReferences : void 0
3273
3186
  ),
@@ -3327,14 +3240,55 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) {
3327
3240
  });
3328
3241
  return getChunk(response, 0);
3329
3242
  };
3330
- exports.prerender = function (model, webpackMap, options) {
3243
+ exports.decryptServerActionBoundArgs = function (actionId, encryptedPromise) {
3244
+ return currentStrategy.decrypt(actionId, encryptedPromise);
3245
+ };
3246
+ exports.encryptServerActionBoundArgs = function (actionId) {
3247
+ for (
3248
+ var _currentStrategy,
3249
+ _len2 = arguments.length,
3250
+ args = Array(1 < _len2 ? _len2 - 1 : 0),
3251
+ _key2 = 1;
3252
+ _key2 < _len2;
3253
+ _key2++
3254
+ )
3255
+ args[_key2 - 1] = arguments[_key2];
3256
+ return (_currentStrategy = currentStrategy).encrypt.apply(
3257
+ _currentStrategy,
3258
+ [actionId].concat(args)
3259
+ );
3260
+ };
3261
+ exports.ensureServerActions = function (actions) {
3262
+ for (var i = 0; i < actions.length; i++) {
3263
+ var action = actions[i];
3264
+ if ("function" !== typeof action)
3265
+ throw Error(
3266
+ 'A "use server" file can only export async functions, found ' +
3267
+ typeof action +
3268
+ "."
3269
+ );
3270
+ }
3271
+ };
3272
+ exports.loadServerAction = function (actionId) {
3273
+ var actionModId = __rspack_rsc_manifest__.serverManifest[actionId].id;
3274
+ if (!actionModId)
3275
+ throw Error(
3276
+ 'Failed to find Server Action "' +
3277
+ actionId +
3278
+ '". This request might be from an older or newer deployment.'
3279
+ );
3280
+ actionId = __webpack_require__(actionModId)[actionId];
3281
+ if ("function" !== typeof actionId)
3282
+ throw Error("Server actions must be functions");
3283
+ return actionId;
3284
+ };
3285
+ exports.prerender = function (model, options) {
3331
3286
  return new Promise(function (resolve, reject) {
3332
3287
  var request = new RequestInstance(
3333
3288
  21,
3334
3289
  model,
3335
- webpackMap,
3290
+ __rspack_rsc_manifest__.clientManifest,
3336
3291
  options ? options.onError : void 0,
3337
- options ? options.onPostpone : void 0,
3338
3292
  function () {
3339
3293
  var writable,
3340
3294
  stream = new ReadableStream(
@@ -3374,14 +3328,13 @@ exports.prerender = function (model, webpackMap, options) {
3374
3328
  startWork(request);
3375
3329
  });
3376
3330
  };
3377
- exports.prerenderToNodeStream = function (model, webpackMap, options) {
3331
+ exports.prerenderToNodeStream = function (model, options) {
3378
3332
  return new Promise(function (resolve, reject) {
3379
3333
  var request = new RequestInstance(
3380
3334
  21,
3381
3335
  model,
3382
- webpackMap,
3336
+ __rspack_rsc_manifest__.clientManifest,
3383
3337
  options ? options.onError : void 0,
3384
- options ? options.onPostpone : void 0,
3385
3338
  function () {
3386
3339
  var readable = new stream.Readable({
3387
3340
  read: function () {
@@ -3414,11 +3367,11 @@ exports.registerClientReference = function (
3414
3367
  id,
3415
3368
  exportName
3416
3369
  ) {
3417
- return registerClientReferenceImpl(
3418
- proxyImplementation,
3419
- id + "#" + exportName,
3420
- !1
3421
- );
3370
+ return Object.defineProperties(proxyImplementation, {
3371
+ $$typeof: { value: CLIENT_REFERENCE_TAG$1 },
3372
+ $$id: { value: id + "#" + exportName },
3373
+ $$async: { value: !1 }
3374
+ });
3422
3375
  };
3423
3376
  exports.registerServerReference = function (reference, id, exportName) {
3424
3377
  return Object.defineProperties(reference, {
@@ -3432,13 +3385,12 @@ exports.registerServerReference = function (reference, id, exportName) {
3432
3385
  toString: serverReferenceToString
3433
3386
  });
3434
3387
  };
3435
- exports.renderToPipeableStream = function (model, webpackMap, options) {
3388
+ exports.renderToPipeableStream = function (model, options) {
3436
3389
  var request = new RequestInstance(
3437
3390
  20,
3438
3391
  model,
3439
- webpackMap,
3392
+ __rspack_rsc_manifest__.clientManifest,
3440
3393
  options ? options.onError : void 0,
3441
- options ? options.onPostpone : void 0,
3442
3394
  noop,
3443
3395
  noop,
3444
3396
  options ? options.identifierPrefix : void 0,
@@ -3473,13 +3425,12 @@ exports.renderToPipeableStream = function (model, webpackMap, options) {
3473
3425
  }
3474
3426
  };
3475
3427
  };
3476
- exports.renderToReadableStream = function (model, webpackMap, options) {
3428
+ exports.renderToReadableStream = function (model, options) {
3477
3429
  var request = new RequestInstance(
3478
3430
  20,
3479
3431
  model,
3480
- webpackMap,
3432
+ __rspack_rsc_manifest__.clientManifest,
3481
3433
  options ? options.onError : void 0,
3482
- options ? options.onPostpone : void 0,
3483
3434
  noop,
3484
3435
  noop,
3485
3436
  options ? options.identifierPrefix : void 0,
@@ -3515,3 +3466,6 @@ exports.renderToReadableStream = function (model, webpackMap, options) {
3515
3466
  { highWaterMark: 0 }
3516
3467
  );
3517
3468
  };
3469
+ exports.setServerActionBoundArgsEncryption = function (strategy) {
3470
+ currentStrategy = strategy;
3471
+ };