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.browser.production.js
3
+ * react-server-dom-rspack-server.browser.production.js
4
4
  *
5
5
  * Copyright (c) Meta Platforms, Inc. and affiliates.
6
6
  *
@@ -11,6 +11,50 @@
11
11
  "use strict";
12
12
  var ReactDOM = require("react-dom"),
13
13
  React = require("react"),
14
+ assign = Object.assign,
15
+ CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
16
+ SERVER_REFERENCE_TAG = Symbol.for("react.server.reference"),
17
+ FunctionBind = Function.prototype.bind,
18
+ ArraySlice = Array.prototype.slice;
19
+ function bind() {
20
+ var newFn = FunctionBind.apply(this, arguments);
21
+ if (this.$$typeof === SERVER_REFERENCE_TAG) {
22
+ var args = ArraySlice.call(arguments, 1),
23
+ $$typeof = { value: SERVER_REFERENCE_TAG },
24
+ $$id = { value: this.$$id };
25
+ args = { value: this.$$bound ? this.$$bound.concat(args) : args };
26
+ return Object.defineProperties(newFn, {
27
+ $$typeof: $$typeof,
28
+ $$id: $$id,
29
+ $$bound: args,
30
+ bind: { value: bind, configurable: !0 }
31
+ });
32
+ }
33
+ return newFn;
34
+ }
35
+ var serverReferenceToString = {
36
+ value: function () {
37
+ return "function () { [omitted code] }";
38
+ },
39
+ configurable: !0,
40
+ writable: !0
41
+ },
42
+ currentStrategy = {
43
+ encrypt: function (_actionId) {
44
+ for (
45
+ var _len = arguments.length,
46
+ args = Array(1 < _len ? _len - 1 : 0),
47
+ _key = 1;
48
+ _key < _len;
49
+ _key++
50
+ )
51
+ args[_key - 1] = arguments[_key];
52
+ return Promise.resolve(args);
53
+ },
54
+ decrypt: function (_actionId, payloadPromise) {
55
+ return payloadPromise;
56
+ }
57
+ },
14
58
  channel = new MessageChannel(),
15
59
  taskQueue = [];
16
60
  channel.port1.onmessage = function () {
@@ -74,180 +118,7 @@ function closeWithError(destination, error) {
74
118
  ? destination.error(error)
75
119
  : destination.close();
76
120
  }
77
- var CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
78
- SERVER_REFERENCE_TAG = Symbol.for("react.server.reference");
79
- function registerClientReferenceImpl(proxyImplementation, id, async) {
80
- return Object.defineProperties(proxyImplementation, {
81
- $$typeof: { value: CLIENT_REFERENCE_TAG$1 },
82
- $$id: { value: id },
83
- $$async: { value: async }
84
- });
85
- }
86
- var FunctionBind = Function.prototype.bind,
87
- ArraySlice = Array.prototype.slice;
88
- function bind() {
89
- var newFn = FunctionBind.apply(this, arguments);
90
- if (this.$$typeof === SERVER_REFERENCE_TAG) {
91
- var args = ArraySlice.call(arguments, 1),
92
- $$typeof = { value: SERVER_REFERENCE_TAG },
93
- $$id = { value: this.$$id };
94
- args = { value: this.$$bound ? this.$$bound.concat(args) : args };
95
- return Object.defineProperties(newFn, {
96
- $$typeof: $$typeof,
97
- $$id: $$id,
98
- $$bound: args,
99
- bind: { value: bind, configurable: !0 }
100
- });
101
- }
102
- return newFn;
103
- }
104
- var serverReferenceToString = {
105
- value: function () {
106
- return "function () { [omitted code] }";
107
- },
108
- configurable: !0,
109
- writable: !0
110
- },
111
- PROMISE_PROTOTYPE = Promise.prototype,
112
- deepProxyHandlers = {
113
- get: function (target, name) {
114
- switch (name) {
115
- case "$$typeof":
116
- return target.$$typeof;
117
- case "$$id":
118
- return target.$$id;
119
- case "$$async":
120
- return target.$$async;
121
- case "name":
122
- return target.name;
123
- case "displayName":
124
- return;
125
- case "defaultProps":
126
- return;
127
- case "_debugInfo":
128
- return;
129
- case "toJSON":
130
- return;
131
- case Symbol.toPrimitive:
132
- return Object.prototype[Symbol.toPrimitive];
133
- case Symbol.toStringTag:
134
- return Object.prototype[Symbol.toStringTag];
135
- case "Provider":
136
- throw Error(
137
- "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
138
- );
139
- case "then":
140
- throw Error(
141
- "Cannot await or return from a thenable. You cannot await a client module from a server component."
142
- );
143
- }
144
- throw Error(
145
- "Cannot access " +
146
- (String(target.name) + "." + String(name)) +
147
- " on the server. You cannot dot into a client module from a server component. You can only pass the imported name through."
148
- );
149
- },
150
- set: function () {
151
- throw Error("Cannot assign to a client module from a server module.");
152
- }
153
- };
154
- function getReference(target, name) {
155
- switch (name) {
156
- case "$$typeof":
157
- return target.$$typeof;
158
- case "$$id":
159
- return target.$$id;
160
- case "$$async":
161
- return target.$$async;
162
- case "name":
163
- return target.name;
164
- case "defaultProps":
165
- return;
166
- case "_debugInfo":
167
- return;
168
- case "toJSON":
169
- return;
170
- case Symbol.toPrimitive:
171
- return Object.prototype[Symbol.toPrimitive];
172
- case Symbol.toStringTag:
173
- return Object.prototype[Symbol.toStringTag];
174
- case "__esModule":
175
- var moduleId = target.$$id;
176
- target.default = registerClientReferenceImpl(
177
- function () {
178
- throw Error(
179
- "Attempted to call the default export of " +
180
- moduleId +
181
- " 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."
182
- );
183
- },
184
- target.$$id + "#",
185
- target.$$async
186
- );
187
- return !0;
188
- case "then":
189
- if (target.then) return target.then;
190
- if (target.$$async) return;
191
- var clientReference = registerClientReferenceImpl({}, target.$$id, !0),
192
- proxy = new Proxy(clientReference, proxyHandlers$1);
193
- target.status = "fulfilled";
194
- target.value = proxy;
195
- return (target.then = registerClientReferenceImpl(
196
- function (resolve) {
197
- return Promise.resolve(resolve(proxy));
198
- },
199
- target.$$id + "#then",
200
- !1
201
- ));
202
- }
203
- if ("symbol" === typeof name)
204
- throw Error(
205
- "Cannot read Symbol exports. Only named exports are supported on a client module imported on the server."
206
- );
207
- clientReference = target[name];
208
- clientReference ||
209
- ((clientReference = registerClientReferenceImpl(
210
- function () {
211
- throw Error(
212
- "Attempted to call " +
213
- String(name) +
214
- "() from the server but " +
215
- String(name) +
216
- " 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."
217
- );
218
- },
219
- target.$$id + "#" + name,
220
- target.$$async
221
- )),
222
- Object.defineProperty(clientReference, "name", { value: name }),
223
- (clientReference = target[name] =
224
- new Proxy(clientReference, deepProxyHandlers)));
225
- return clientReference;
226
- }
227
- var proxyHandlers$1 = {
228
- get: function (target, name) {
229
- return getReference(target, name);
230
- },
231
- getOwnPropertyDescriptor: function (target, name) {
232
- var descriptor = Object.getOwnPropertyDescriptor(target, name);
233
- descriptor ||
234
- ((descriptor = {
235
- value: getReference(target, name),
236
- writable: !1,
237
- configurable: !1,
238
- enumerable: !1
239
- }),
240
- Object.defineProperty(target, name, descriptor));
241
- return descriptor;
242
- },
243
- getPrototypeOf: function () {
244
- return PROMISE_PROTOTYPE;
245
- },
246
- set: function () {
247
- throw Error("Cannot assign to a client module from a server module.");
248
- }
249
- },
250
- ReactDOMSharedInternals =
121
+ var ReactDOMSharedInternals =
251
122
  ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
252
123
  previousDispatcher = ReactDOMSharedInternals.d;
253
124
  ReactDOMSharedInternals.d = {
@@ -466,7 +337,7 @@ function getChildFormatContext(parentContext, type, props) {
466
337
  });
467
338
  break;
468
339
  case "stylesheet":
469
- preload(srcSet, "stylesheet", {
340
+ preload(srcSet, "style", {
470
341
  crossOrigin: props.crossOrigin,
471
342
  integrity: props.integrity,
472
343
  nonce: props.nonce,
@@ -546,9 +417,9 @@ var REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
546
417
  REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
547
418
  REACT_MEMO_TYPE = Symbol.for("react.memo"),
548
419
  REACT_LAZY_TYPE = Symbol.for("react.lazy"),
549
- REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
550
- Symbol.for("react.postpone");
551
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
420
+ REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"),
421
+ REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
422
+ MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
552
423
  function getIteratorFn(maybeIterable) {
553
424
  if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
554
425
  maybeIterable =
@@ -556,7 +427,8 @@ function getIteratorFn(maybeIterable) {
556
427
  maybeIterable["@@iterator"];
557
428
  return "function" === typeof maybeIterable ? maybeIterable : null;
558
429
  }
559
- var ASYNC_ITERATOR = Symbol.asyncIterator;
430
+ var ASYNC_ITERATOR = Symbol.asyncIterator,
431
+ REACT_OPTIMISTIC_KEY = Symbol.for("react.optimistic_key");
560
432
  function noop() {}
561
433
  var SuspenseException = Error(
562
434
  "Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`."
@@ -750,6 +622,8 @@ function describeElementType(type) {
750
622
  return "Suspense";
751
623
  case REACT_SUSPENSE_LIST_TYPE:
752
624
  return "SuspenseList";
625
+ case REACT_VIEW_TRANSITION_TYPE:
626
+ return "ViewTransition";
753
627
  }
754
628
  if ("object" === typeof type)
755
629
  switch (type.$$typeof) {
@@ -824,7 +698,7 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
824
698
  : "\n " + str;
825
699
  }
826
700
  var hasOwnProperty = Object.prototype.hasOwnProperty,
827
- ObjectPrototype = Object.prototype,
701
+ ObjectPrototype$1 = Object.prototype,
828
702
  stringify = JSON.stringify;
829
703
  function defaultErrorHandler(error) {
830
704
  console.error(error);
@@ -834,7 +708,6 @@ function RequestInstance(
834
708
  model,
835
709
  bundlerConfig,
836
710
  onError,
837
- onPostpone,
838
711
  onAllReady,
839
712
  onFatalError,
840
713
  identifierPrefix,
@@ -873,7 +746,6 @@ function RequestInstance(
873
746
  this.identifierCount = 1;
874
747
  this.taintCleanupQueue = [];
875
748
  this.onError = void 0 === onError ? defaultErrorHandler : onError;
876
- this.onPostpone = void 0 === onPostpone ? noop : onPostpone;
877
749
  this.onAllReady = onAllReady;
878
750
  this.onFatalError = onFatalError;
879
751
  type = createTask(this, model, null, !1, 0, abortSet);
@@ -949,9 +821,17 @@ function serializeReadableStream(request, task, stream) {
949
821
  callOnAllReadyIfReady(request);
950
822
  else
951
823
  try {
952
- (streamTask.model = entry.value),
953
- request.pendingChunks++,
954
- tryStreamTask(request, streamTask),
824
+ request.pendingChunks++,
825
+ (streamTask.model = entry.value),
826
+ isByteStream
827
+ ? emitTypedArrayChunk(
828
+ request,
829
+ streamTask.id,
830
+ "b",
831
+ streamTask.model,
832
+ !1
833
+ )
834
+ : tryStreamTask(request, streamTask),
955
835
  enqueueFlush(request),
956
836
  reader.read().then(progress, error);
957
837
  } catch (x$11) {
@@ -985,7 +865,8 @@ function serializeReadableStream(request, task, stream) {
985
865
  } catch (x) {
986
866
  supportsBYOB = !1;
987
867
  }
988
- var reader = stream.getReader(),
868
+ var isByteStream = supportsBYOB,
869
+ reader = stream.getReader(),
989
870
  streamTask = createTask(
990
871
  request,
991
872
  task.model,
@@ -995,7 +876,7 @@ function serializeReadableStream(request, task, stream) {
995
876
  request.abortableTasks
996
877
  );
997
878
  request.pendingChunks++;
998
- task = streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
879
+ task = streamTask.id.toString(16) + ":" + (isByteStream ? "r" : "R") + "\n";
999
880
  request.completedRegularChunks.push(stringToChunk(task));
1000
881
  request.cacheController.signal.addEventListener("abort", abortStream);
1001
882
  reader.read().then(progress, error);
@@ -1165,7 +1046,12 @@ function renderFunctionComponent(request, task, key, Component, props) {
1165
1046
  Component = task.keyPath;
1166
1047
  prevThenableState = task.implicitSlot;
1167
1048
  null !== key
1168
- ? (task.keyPath = null === Component ? key : Component + "," + key)
1049
+ ? (task.keyPath =
1050
+ key === REACT_OPTIMISTIC_KEY || Component === REACT_OPTIMISTIC_KEY
1051
+ ? REACT_OPTIMISTIC_KEY
1052
+ : null === Component
1053
+ ? key
1054
+ : Component + "," + key)
1169
1055
  : null === Component && (task.implicitSlot = !0);
1170
1056
  request = renderModelDestructive(request, task, emptyRoot, "", props);
1171
1057
  task.keyPath = Component;
@@ -1248,7 +1134,11 @@ function renderElement(request, task, type, key, ref, props) {
1248
1134
  key = task.keyPath;
1249
1135
  null === request
1250
1136
  ? (request = key)
1251
- : null !== key && (request = key + "," + request);
1137
+ : null !== key &&
1138
+ (request =
1139
+ key === REACT_OPTIMISTIC_KEY || request === REACT_OPTIMISTIC_KEY
1140
+ ? REACT_OPTIMISTIC_KEY
1141
+ : key + "," + request);
1252
1142
  props = [REACT_ELEMENT_TYPE, type, request, props];
1253
1143
  task = task.implicitSlot && null !== request ? [props] : props;
1254
1144
  return task;
@@ -1688,7 +1578,7 @@ function renderModelDestructive(
1688
1578
  if (value instanceof Date) return "$D" + value.toJSON();
1689
1579
  request = getPrototypeOf(value);
1690
1580
  if (
1691
- request !== ObjectPrototype &&
1581
+ request !== ObjectPrototype$1 &&
1692
1582
  (null === request || null !== getPrototypeOf(request))
1693
1583
  )
1694
1584
  throw Error(
@@ -2190,6 +2080,7 @@ function resolveServerReference(bundlerConfig, id) {
2190
2080
  ? [resolvedModuleData.id, resolvedModuleData.chunks, name, 1]
2191
2081
  : [resolvedModuleData.id, resolvedModuleData.chunks, name];
2192
2082
  }
2083
+ var chunkCache = new Map();
2193
2084
  function requireAsyncModule(id) {
2194
2085
  var promise = __webpack_require__(id);
2195
2086
  if ("function" !== typeof promise.then || "fulfilled" === promise.status)
@@ -2209,11 +2100,17 @@ function requireAsyncModule(id) {
2209
2100
  function ignoreReject() {}
2210
2101
  function preloadModule(metadata) {
2211
2102
  for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; ) {
2212
- var chunkId = chunks[i++];
2213
- i++;
2214
- var thenable = __webpack_chunk_load__(chunkId);
2215
- promises.push(thenable);
2216
- thenable.catch(ignoreReject);
2103
+ var chunkId = chunks[i++],
2104
+ chunkFilename = chunks[i++],
2105
+ entry = chunkCache.get(chunkId);
2106
+ void 0 === entry
2107
+ ? (chunkMap.set(chunkId, chunkFilename),
2108
+ (chunkFilename = __webpack_chunk_load__(chunkId)),
2109
+ promises.push(chunkFilename),
2110
+ (entry = chunkCache.set.bind(chunkCache, chunkId, null)),
2111
+ chunkFilename.then(entry, ignoreReject),
2112
+ chunkCache.set(chunkId, chunkFilename))
2113
+ : null !== entry && promises.push(entry);
2217
2114
  }
2218
2115
  return 4 === metadata.length
2219
2116
  ? 0 === promises.length
@@ -2238,12 +2135,10 @@ function requireModule(metadata) {
2238
2135
  return moduleExports[metadata[2]];
2239
2136
  }
2240
2137
  var chunkMap = new Map(),
2241
- webpackGetChunkFilename = __webpack_require__.u;
2138
+ rspackGetChunkFilename = __webpack_require__.u;
2242
2139
  __webpack_require__.u = function (chunkId) {
2243
2140
  var flightChunk = chunkMap.get(chunkId);
2244
- return void 0 !== flightChunk
2245
- ? flightChunk
2246
- : webpackGetChunkFilename(chunkId);
2141
+ return void 0 !== flightChunk ? flightChunk : rspackGetChunkFilename(chunkId);
2247
2142
  };
2248
2143
  var RESPONSE_SYMBOL = Symbol();
2249
2144
  function ReactPromise(status, value, reason) {
@@ -2261,16 +2156,23 @@ ReactPromise.prototype.then = function (resolve, reject) {
2261
2156
  case "fulfilled":
2262
2157
  if ("function" === typeof resolve) {
2263
2158
  for (
2264
- var inspectedValue = this.value, cycleProtection = 0;
2159
+ var inspectedValue = this.value,
2160
+ cycleProtection = 0,
2161
+ visited = new Set();
2265
2162
  inspectedValue instanceof ReactPromise;
2266
2163
 
2267
2164
  ) {
2268
2165
  cycleProtection++;
2269
- if (inspectedValue === this || 1e3 < cycleProtection) {
2166
+ if (
2167
+ inspectedValue === this ||
2168
+ visited.has(inspectedValue) ||
2169
+ 1e3 < cycleProtection
2170
+ ) {
2270
2171
  "function" === typeof reject &&
2271
2172
  reject(Error("Cannot have cyclic thenables."));
2272
2173
  return;
2273
2174
  }
2175
+ visited.add(inspectedValue);
2274
2176
  if ("fulfilled" === inspectedValue.status)
2275
2177
  inspectedValue = inspectedValue.value;
2276
2178
  else break;
@@ -2289,6 +2191,8 @@ ReactPromise.prototype.then = function (resolve, reject) {
2289
2191
  "function" === typeof reject && reject(this.reason);
2290
2192
  }
2291
2193
  };
2194
+ var ObjectPrototype = Object.prototype,
2195
+ ArrayPrototype = Array.prototype;
2292
2196
  function wakeChunk(response, listeners, value) {
2293
2197
  for (var i = 0; i < listeners.length; i++) {
2294
2198
  var listener = listeners[i];
@@ -2601,8 +2505,10 @@ function fulfillReference(response, reference, value) {
2601
2505
  var name = path[i];
2602
2506
  if (
2603
2507
  "object" !== typeof value ||
2604
- !hasOwnProperty.call(value, name) ||
2605
- value instanceof Promise
2508
+ null === value ||
2509
+ (getPrototypeOf(value) !== ObjectPrototype &&
2510
+ getPrototypeOf(value) !== ArrayPrototype) ||
2511
+ !hasOwnProperty.call(value, name)
2606
2512
  )
2607
2513
  throw Error("Invalid reference.");
2608
2514
  value = value[name];
@@ -2650,8 +2556,10 @@ function getOutlinedModel(response, reference, parentObject, key, map) {
2650
2556
  var name = reference[i];
2651
2557
  if (
2652
2558
  "object" !== typeof id ||
2653
- !hasOwnProperty.call(id, name) ||
2654
- id instanceof Promise
2559
+ null === id ||
2560
+ (getPrototypeOf(id) !== ObjectPrototype &&
2561
+ getPrototypeOf(id) !== ArrayPrototype) ||
2562
+ !hasOwnProperty.call(id, name)
2655
2563
  )
2656
2564
  throw Error("Invalid reference.");
2657
2565
  id = id[name];
@@ -3097,9 +3005,17 @@ function decodeBoundActionMetaData(body, serverManifest, formFieldPrefix) {
3097
3005
  if ("fulfilled" !== body.status) throw body.reason;
3098
3006
  return body.value;
3099
3007
  }
3100
- exports.createClientModuleProxy = function (moduleId) {
3101
- moduleId = registerClientReferenceImpl({}, moduleId, !1);
3102
- return new Proxy(moduleId, proxyHandlers$1);
3008
+ exports.createServerEntry = function (value, resource) {
3009
+ var entryJsFiles = __rspack_rsc_manifest__.entryJsFiles || [],
3010
+ entryCssFiles = __rspack_rsc_manifest__.entryCssFiles[resource] || [];
3011
+ ("function" === typeof value ||
3012
+ ("object" === typeof value && null !== value)) &&
3013
+ assign(value, {
3014
+ resource: resource,
3015
+ entryJsFiles: entryJsFiles,
3016
+ entryCssFiles: entryCssFiles
3017
+ });
3018
+ return value;
3103
3019
  };
3104
3020
  exports.createTemporaryReferenceSet = function () {
3105
3021
  return new WeakMap();
@@ -3141,30 +3057,58 @@ exports.decodeFormState = function (actionResult, body, serverManifest) {
3141
3057
  : [actionResult, keyPath, referenceId, bound.length - 1];
3142
3058
  });
3143
3059
  };
3144
- exports.decodeReply = function (body, webpackMap, options) {
3060
+ exports.decodeReply = function (body, options) {
3145
3061
  if ("string" === typeof body) {
3146
3062
  var form = new FormData();
3147
3063
  form.append("0", body);
3148
3064
  body = form;
3149
3065
  }
3150
3066
  body = createResponse(
3151
- webpackMap,
3067
+ __rspack_rsc_manifest__.serverManifest,
3152
3068
  "",
3153
3069
  options ? options.temporaryReferences : void 0,
3154
3070
  body
3155
3071
  );
3156
- webpackMap = getChunk(body, 0);
3072
+ options = getChunk(body, 0);
3157
3073
  close(body);
3158
- return webpackMap;
3074
+ return options;
3075
+ };
3076
+ exports.decryptServerActionBoundArgs = function (actionId, encryptedPromise) {
3077
+ return currentStrategy.decrypt(actionId, encryptedPromise);
3078
+ };
3079
+ exports.encryptServerActionBoundArgs = function (actionId) {
3080
+ for (
3081
+ var _currentStrategy,
3082
+ _len2 = arguments.length,
3083
+ args = Array(1 < _len2 ? _len2 - 1 : 0),
3084
+ _key2 = 1;
3085
+ _key2 < _len2;
3086
+ _key2++
3087
+ )
3088
+ args[_key2 - 1] = arguments[_key2];
3089
+ return (_currentStrategy = currentStrategy).encrypt.apply(
3090
+ _currentStrategy,
3091
+ [actionId].concat(args)
3092
+ );
3159
3093
  };
3160
- exports.prerender = function (model, webpackMap, options) {
3094
+ exports.ensureServerActions = function (actions) {
3095
+ for (var i = 0; i < actions.length; i++) {
3096
+ var action = actions[i];
3097
+ if ("function" !== typeof action)
3098
+ throw Error(
3099
+ 'A "use server" file can only export async functions, found ' +
3100
+ typeof action +
3101
+ "."
3102
+ );
3103
+ }
3104
+ };
3105
+ exports.prerender = function (model, options) {
3161
3106
  return new Promise(function (resolve, reject) {
3162
3107
  var request = new RequestInstance(
3163
3108
  21,
3164
3109
  model,
3165
- webpackMap,
3110
+ __rspack_rsc_manifest__.clientManifest,
3166
3111
  options ? options.onError : void 0,
3167
- options ? options.onPostpone : void 0,
3168
3112
  function () {
3169
3113
  var stream = new ReadableStream(
3170
3114
  {
@@ -3204,11 +3148,11 @@ exports.registerClientReference = function (
3204
3148
  id,
3205
3149
  exportName
3206
3150
  ) {
3207
- return registerClientReferenceImpl(
3208
- proxyImplementation,
3209
- id + "#" + exportName,
3210
- !1
3211
- );
3151
+ return Object.defineProperties(proxyImplementation, {
3152
+ $$typeof: { value: CLIENT_REFERENCE_TAG$1 },
3153
+ $$id: { value: id + "#" + exportName },
3154
+ $$async: { value: !1 }
3155
+ });
3212
3156
  };
3213
3157
  exports.registerServerReference = function (reference, id, exportName) {
3214
3158
  return Object.defineProperties(reference, {
@@ -3222,13 +3166,12 @@ exports.registerServerReference = function (reference, id, exportName) {
3222
3166
  toString: serverReferenceToString
3223
3167
  });
3224
3168
  };
3225
- exports.renderToReadableStream = function (model, webpackMap, options) {
3169
+ exports.renderToReadableStream = function (model, options) {
3226
3170
  var request = new RequestInstance(
3227
3171
  20,
3228
3172
  model,
3229
- webpackMap,
3173
+ __rspack_rsc_manifest__.clientManifest,
3230
3174
  options ? options.onError : void 0,
3231
- options ? options.onPostpone : void 0,
3232
3175
  noop,
3233
3176
  noop,
3234
3177
  options ? options.identifierPrefix : void 0,
@@ -3262,3 +3205,6 @@ exports.renderToReadableStream = function (model, webpackMap, options) {
3262
3205
  { highWaterMark: 0 }
3263
3206
  );
3264
3207
  };
3208
+ exports.setServerActionBoundArgsEncryption = function (strategy) {
3209
+ currentStrategy = strategy;
3210
+ };