react-server-dom-webpack 19.0.0-canary-33a32441e9-20240418 → 19.0.0-canary-cb151849e1-20240424
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/cjs/react-server-dom-webpack-client.browser.development.js +36 -8
- package/cjs/react-server-dom-webpack-client.browser.production.js +768 -1652
- package/cjs/react-server-dom-webpack-client.edge.development.js +36 -8
- package/cjs/react-server-dom-webpack-client.edge.production.js +894 -1863
- package/cjs/react-server-dom-webpack-client.node.development.js +36 -8
- package/cjs/react-server-dom-webpack-client.node.production.js +870 -1818
- package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +36 -8
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.js +854 -1776
- package/cjs/react-server-dom-webpack-node-register.js +68 -13
- package/cjs/react-server-dom-webpack-plugin.js +398 -23
- package/cjs/react-server-dom-webpack-server.browser.development.js +87 -15
- package/cjs/react-server-dom-webpack-server.browser.production.js +1590 -3050
- package/cjs/react-server-dom-webpack-server.edge.development.js +87 -15
- package/cjs/react-server-dom-webpack-server.edge.production.js +1586 -3029
- package/cjs/react-server-dom-webpack-server.node.development.js +87 -15
- package/cjs/react-server-dom-webpack-server.node.production.js +1720 -3239
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +87 -15
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +1702 -3180
- package/client.browser.js +1 -1
- package/client.edge.js +1 -1
- package/client.node.js +1 -1
- package/client.node.unbundled.js +1 -1
- package/esm/{react-server-dom-webpack-node-loader.production.min.js → react-server-dom-webpack-node-loader.production.js} +1 -1
- package/package.json +4 -4
- package/server.browser.js +1 -1
- package/server.edge.js +1 -1
- package/server.node.js +1 -1
- package/server.node.unbundled.js +1 -1
- package/cjs/react-server-dom-webpack-client.browser.production.min.js +0 -40
- package/cjs/react-server-dom-webpack-client.browser.production.min.js.map +0 -1
- package/cjs/react-server-dom-webpack-client.edge.production.min.js +0 -46
- package/cjs/react-server-dom-webpack-client.edge.production.min.js.map +0 -1
- package/cjs/react-server-dom-webpack-client.node.production.min.js +0 -45
- package/cjs/react-server-dom-webpack-client.node.production.min.js.map +0 -1
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +0 -44
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js.map +0 -1
- package/cjs/react-server-dom-webpack-node-register.js.map +0 -1
- package/cjs/react-server-dom-webpack-plugin.js.map +0 -1
- package/cjs/react-server-dom-webpack-server.browser.production.min.js +0 -82
- package/cjs/react-server-dom-webpack-server.browser.production.min.js.map +0 -1
- package/cjs/react-server-dom-webpack-server.edge.production.min.js +0 -83
- package/cjs/react-server-dom-webpack-server.edge.production.min.js.map +0 -1
- package/cjs/react-server-dom-webpack-server.node.production.min.js +0 -86
- package/cjs/react-server-dom-webpack-server.node.production.min.js.map +0 -1
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +0 -84
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js.map +0 -1
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* @license React
|
3
|
-
* react-server-dom-webpack-server.edge.production.
|
3
|
+
* react-server-dom-webpack-server.edge.production.js
|
4
4
|
*
|
5
5
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
6
6
|
*
|
@@ -8,964 +8,483 @@
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
9
9
|
*/
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
// -----------------------------------------------------------------------------
|
17
|
-
const enablePostpone = false;
|
18
|
-
|
19
|
-
function scheduleWork(callback) {
|
20
|
-
setTimeout(callback, 0);
|
21
|
-
}
|
22
|
-
const VIEW_SIZE = 2048;
|
23
|
-
let currentView = null;
|
24
|
-
let writtenBytes = 0;
|
25
|
-
function beginWriting(destination) {
|
26
|
-
currentView = new Uint8Array(VIEW_SIZE);
|
11
|
+
"use strict";
|
12
|
+
var ReactDOM = require("react-dom"),
|
13
|
+
React = require("react"),
|
14
|
+
currentView = null,
|
27
15
|
writtenBytes = 0;
|
28
|
-
}
|
29
|
-
function writeChunk(destination, chunk) {
|
30
|
-
if (chunk.byteLength === 0) {
|
31
|
-
return;
|
32
|
-
}
|
33
|
-
|
34
|
-
if (chunk.byteLength > VIEW_SIZE) {
|
35
|
-
// this chunk may overflow a single view which implies it was not
|
36
|
-
// one that is cached by the streaming renderer. We will enqueu
|
37
|
-
// it directly and expect it is not re-used
|
38
|
-
if (writtenBytes > 0) {
|
39
|
-
destination.enqueue(new Uint8Array(currentView.buffer, 0, writtenBytes));
|
40
|
-
currentView = new Uint8Array(VIEW_SIZE);
|
41
|
-
writtenBytes = 0;
|
42
|
-
}
|
43
|
-
|
44
|
-
destination.enqueue(chunk);
|
45
|
-
return;
|
46
|
-
}
|
47
|
-
|
48
|
-
let bytesToWrite = chunk;
|
49
|
-
const allowableBytes = currentView.length - writtenBytes;
|
50
|
-
|
51
|
-
if (allowableBytes < bytesToWrite.byteLength) {
|
52
|
-
// this chunk would overflow the current view. We enqueue a full view
|
53
|
-
// and start a new view with the remaining chunk
|
54
|
-
if (allowableBytes === 0) {
|
55
|
-
// the current view is already full, send it
|
56
|
-
destination.enqueue(currentView);
|
57
|
-
} else {
|
58
|
-
// fill up the current view and apply the remaining chunk bytes
|
59
|
-
// to a new view.
|
60
|
-
currentView.set(bytesToWrite.subarray(0, allowableBytes), writtenBytes); // writtenBytes += allowableBytes; // this can be skipped because we are going to immediately reset the view
|
61
|
-
|
62
|
-
destination.enqueue(currentView);
|
63
|
-
bytesToWrite = bytesToWrite.subarray(allowableBytes);
|
64
|
-
}
|
65
|
-
|
66
|
-
currentView = new Uint8Array(VIEW_SIZE);
|
67
|
-
writtenBytes = 0;
|
68
|
-
}
|
69
|
-
|
70
|
-
currentView.set(bytesToWrite, writtenBytes);
|
71
|
-
writtenBytes += bytesToWrite.byteLength;
|
72
|
-
}
|
73
16
|
function writeChunkAndReturn(destination, chunk) {
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
17
|
+
if (0 !== chunk.byteLength)
|
18
|
+
if (2048 < chunk.byteLength)
|
19
|
+
0 < writtenBytes &&
|
20
|
+
(destination.enqueue(
|
21
|
+
new Uint8Array(currentView.buffer, 0, writtenBytes)
|
22
|
+
),
|
23
|
+
(currentView = new Uint8Array(2048)),
|
24
|
+
(writtenBytes = 0)),
|
25
|
+
destination.enqueue(chunk);
|
26
|
+
else {
|
27
|
+
var allowableBytes = currentView.length - writtenBytes;
|
28
|
+
allowableBytes < chunk.byteLength &&
|
29
|
+
(0 === allowableBytes
|
30
|
+
? destination.enqueue(currentView)
|
31
|
+
: (currentView.set(chunk.subarray(0, allowableBytes), writtenBytes),
|
32
|
+
destination.enqueue(currentView),
|
33
|
+
(chunk = chunk.subarray(allowableBytes))),
|
34
|
+
(currentView = new Uint8Array(2048)),
|
35
|
+
(writtenBytes = 0));
|
36
|
+
currentView.set(chunk, writtenBytes);
|
37
|
+
writtenBytes += chunk.byteLength;
|
38
|
+
}
|
39
|
+
return !0;
|
40
|
+
}
|
41
|
+
var textEncoder = new TextEncoder();
|
95
42
|
function closeWithError(destination, error) {
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
destination.error(error);
|
100
|
-
} else {
|
101
|
-
// Earlier implementations doesn't support this method. In that environment you're
|
102
|
-
// supposed to throw from a promise returned but we don't return a promise in our
|
103
|
-
// approach. We could fork this implementation but this is environment is an edge
|
104
|
-
// case to begin with. It's even less common to run this in an older environment.
|
105
|
-
// Even then, this is not where errors are supposed to happen and they get reported
|
106
|
-
// to a global callback in addition to this anyway. So it's fine just to close this.
|
107
|
-
destination.close();
|
108
|
-
}
|
109
|
-
}
|
110
|
-
|
111
|
-
// eslint-disable-next-line no-unused-vars
|
112
|
-
const CLIENT_REFERENCE_TAG$1 = Symbol.for('react.client.reference');
|
113
|
-
const SERVER_REFERENCE_TAG = Symbol.for('react.server.reference');
|
114
|
-
function isClientReference(reference) {
|
115
|
-
return reference.$$typeof === CLIENT_REFERENCE_TAG$1;
|
116
|
-
}
|
117
|
-
function isServerReference(reference) {
|
118
|
-
return reference.$$typeof === SERVER_REFERENCE_TAG;
|
43
|
+
"function" === typeof destination.error
|
44
|
+
? destination.error(error)
|
45
|
+
: destination.close();
|
119
46
|
}
|
120
|
-
|
121
|
-
|
122
|
-
}
|
123
|
-
|
47
|
+
var CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
|
48
|
+
SERVER_REFERENCE_TAG = Symbol.for("react.server.reference");
|
124
49
|
function registerClientReferenceImpl(proxyImplementation, id, async) {
|
125
50
|
return Object.defineProperties(proxyImplementation, {
|
126
|
-
$$typeof: {
|
127
|
-
|
128
|
-
}
|
129
|
-
$$id: {
|
130
|
-
value: id
|
131
|
-
},
|
132
|
-
$$async: {
|
133
|
-
value: async
|
134
|
-
}
|
51
|
+
$$typeof: { value: CLIENT_REFERENCE_TAG$1 },
|
52
|
+
$$id: { value: id },
|
53
|
+
$$async: { value: async }
|
135
54
|
});
|
136
|
-
}
|
137
|
-
|
138
|
-
|
139
|
-
const FunctionBind = Function.prototype.bind; // $FlowFixMe[method-unbinding]
|
140
|
-
|
141
|
-
const ArraySlice = Array.prototype.slice;
|
142
|
-
|
55
|
+
}
|
56
|
+
var FunctionBind = Function.prototype.bind,
|
57
|
+
ArraySlice = Array.prototype.slice;
|
143
58
|
function bind() {
|
144
|
-
|
145
|
-
const newFn = FunctionBind.apply(this, arguments);
|
146
|
-
|
59
|
+
var newFn = FunctionBind.apply(this, arguments);
|
147
60
|
if (this.$$typeof === SERVER_REFERENCE_TAG) {
|
148
|
-
|
149
|
-
const args = ArraySlice.call(arguments, 1);
|
61
|
+
var args = ArraySlice.call(arguments, 1);
|
150
62
|
return Object.defineProperties(newFn, {
|
151
|
-
$$typeof: {
|
152
|
-
|
153
|
-
},
|
154
|
-
|
155
|
-
value: this.$$id
|
156
|
-
},
|
157
|
-
$$bound: {
|
158
|
-
value: this.$$bound ? this.$$bound.concat(args) : args
|
159
|
-
},
|
160
|
-
bind: {
|
161
|
-
value: bind
|
162
|
-
}
|
63
|
+
$$typeof: { value: SERVER_REFERENCE_TAG },
|
64
|
+
$$id: { value: this.$$id },
|
65
|
+
$$bound: { value: this.$$bound ? this.$$bound.concat(args) : args },
|
66
|
+
bind: { value: bind }
|
163
67
|
});
|
164
68
|
}
|
165
|
-
|
166
69
|
return newFn;
|
167
70
|
}
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
71
|
+
var PROMISE_PROTOTYPE = Promise.prototype,
|
72
|
+
deepProxyHandlers = {
|
73
|
+
get: function (target, name) {
|
74
|
+
switch (name) {
|
75
|
+
case "$$typeof":
|
76
|
+
return target.$$typeof;
|
77
|
+
case "$$id":
|
78
|
+
return target.$$id;
|
79
|
+
case "$$async":
|
80
|
+
return target.$$async;
|
81
|
+
case "name":
|
82
|
+
return target.name;
|
83
|
+
case "displayName":
|
84
|
+
return;
|
85
|
+
case "defaultProps":
|
86
|
+
return;
|
87
|
+
case "toJSON":
|
88
|
+
return;
|
89
|
+
case Symbol.toPrimitive:
|
90
|
+
return Object.prototype[Symbol.toPrimitive];
|
91
|
+
case Symbol.toStringTag:
|
92
|
+
return Object.prototype[Symbol.toStringTag];
|
93
|
+
case "Provider":
|
94
|
+
throw Error(
|
95
|
+
"Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
|
96
|
+
);
|
97
|
+
}
|
98
|
+
throw Error(
|
99
|
+
"Cannot access " +
|
100
|
+
(String(target.name) + "." + String(name)) +
|
101
|
+
" on the server. You cannot dot into a client module from a server component. You can only pass the imported name through."
|
102
|
+
);
|
181
103
|
},
|
182
|
-
|
183
|
-
|
184
|
-
configurable: true
|
104
|
+
set: function () {
|
105
|
+
throw Error("Cannot assign to a client module from a server module.");
|
185
106
|
}
|
186
|
-
}
|
187
|
-
}
|
188
|
-
const PROMISE_PROTOTYPE = Promise.prototype;
|
189
|
-
const deepProxyHandlers = {
|
190
|
-
get: function (target, name, receiver) {
|
191
|
-
switch (name) {
|
192
|
-
// These names are read by the Flight runtime if you end up using the exports object.
|
193
|
-
case '$$typeof':
|
194
|
-
// These names are a little too common. We should probably have a way to
|
195
|
-
// have the Flight runtime extract the inner target instead.
|
196
|
-
return target.$$typeof;
|
197
|
-
|
198
|
-
case '$$id':
|
199
|
-
return target.$$id;
|
200
|
-
|
201
|
-
case '$$async':
|
202
|
-
return target.$$async;
|
203
|
-
|
204
|
-
case 'name':
|
205
|
-
return target.name;
|
206
|
-
|
207
|
-
case 'displayName':
|
208
|
-
return undefined;
|
209
|
-
// We need to special case this because createElement reads it if we pass this
|
210
|
-
// reference.
|
211
|
-
|
212
|
-
case 'defaultProps':
|
213
|
-
return undefined;
|
214
|
-
// Avoid this attempting to be serialized.
|
215
|
-
|
216
|
-
case 'toJSON':
|
217
|
-
return undefined;
|
218
|
-
|
219
|
-
case Symbol.toPrimitive:
|
220
|
-
// $FlowFixMe[prop-missing]
|
221
|
-
return Object.prototype[Symbol.toPrimitive];
|
222
|
-
|
223
|
-
case Symbol.toStringTag:
|
224
|
-
// $FlowFixMe[prop-missing]
|
225
|
-
return Object.prototype[Symbol.toStringTag];
|
226
|
-
|
227
|
-
case 'Provider':
|
228
|
-
throw new Error("Cannot render a Client Context Provider on the Server. " + "Instead, you can export a Client Component wrapper " + "that itself renders a Client Context Provider.");
|
229
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
230
|
-
|
231
|
-
|
232
|
-
const expression = String(target.name) + '.' + String(name);
|
233
|
-
throw new Error("Cannot access " + expression + " on the server. " + 'You cannot dot into a client module from a server component. ' + 'You can only pass the imported name through.');
|
234
|
-
},
|
235
|
-
set: function () {
|
236
|
-
throw new Error('Cannot assign to a client module from a server module.');
|
237
|
-
}
|
238
|
-
};
|
239
|
-
|
107
|
+
};
|
240
108
|
function getReference(target, name) {
|
241
109
|
switch (name) {
|
242
|
-
|
243
|
-
case '$$typeof':
|
110
|
+
case "$$typeof":
|
244
111
|
return target.$$typeof;
|
245
|
-
|
246
|
-
case '$$id':
|
112
|
+
case "$$id":
|
247
113
|
return target.$$id;
|
248
|
-
|
249
|
-
case '$$async':
|
114
|
+
case "$$async":
|
250
115
|
return target.$$async;
|
251
|
-
|
252
|
-
case 'name':
|
116
|
+
case "name":
|
253
117
|
return target.name;
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
return undefined;
|
259
|
-
// Avoid this attempting to be serialized.
|
260
|
-
|
261
|
-
case 'toJSON':
|
262
|
-
return undefined;
|
263
|
-
|
118
|
+
case "defaultProps":
|
119
|
+
return;
|
120
|
+
case "toJSON":
|
121
|
+
return;
|
264
122
|
case Symbol.toPrimitive:
|
265
|
-
// $FlowFixMe[prop-missing]
|
266
123
|
return Object.prototype[Symbol.toPrimitive];
|
267
|
-
|
268
124
|
case Symbol.toStringTag:
|
269
|
-
// $FlowFixMe[prop-missing]
|
270
125
|
return Object.prototype[Symbol.toStringTag];
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
if (
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
target.status = 'fulfilled';
|
295
|
-
target.value = proxy;
|
296
|
-
const then = target.then = registerClientReferenceImpl(function then(resolve, reject) {
|
297
|
-
// Expose to React.
|
126
|
+
case "__esModule":
|
127
|
+
var moduleId = target.$$id;
|
128
|
+
target.default = registerClientReferenceImpl(
|
129
|
+
function () {
|
130
|
+
throw Error(
|
131
|
+
"Attempted to call the default export of " +
|
132
|
+
moduleId +
|
133
|
+
" 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."
|
134
|
+
);
|
135
|
+
},
|
136
|
+
target.$$id + "#",
|
137
|
+
target.$$async
|
138
|
+
);
|
139
|
+
return !0;
|
140
|
+
case "then":
|
141
|
+
if (target.then) return target.then;
|
142
|
+
if (target.$$async) return;
|
143
|
+
var clientReference = registerClientReferenceImpl({}, target.$$id, !0),
|
144
|
+
proxy = new Proxy(clientReference, proxyHandlers$1);
|
145
|
+
target.status = "fulfilled";
|
146
|
+
target.value = proxy;
|
147
|
+
return (target.then = registerClientReferenceImpl(
|
148
|
+
function (resolve) {
|
298
149
|
return Promise.resolve(resolve(proxy));
|
299
|
-
},
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
Object.defineProperty(
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
150
|
+
},
|
151
|
+
target.$$id + "#then",
|
152
|
+
!1
|
153
|
+
));
|
154
|
+
}
|
155
|
+
if ("symbol" === typeof name)
|
156
|
+
throw Error(
|
157
|
+
"Cannot read Symbol exports. Only named exports are supported on a client module imported on the server."
|
158
|
+
);
|
159
|
+
clientReference = target[name];
|
160
|
+
clientReference ||
|
161
|
+
((clientReference = registerClientReferenceImpl(
|
162
|
+
function () {
|
163
|
+
throw Error(
|
164
|
+
"Attempted to call " +
|
165
|
+
String(name) +
|
166
|
+
"() from the server but " +
|
167
|
+
String(name) +
|
168
|
+
" 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."
|
169
|
+
);
|
170
|
+
},
|
171
|
+
target.$$id + "#" + name,
|
172
|
+
target.$$async
|
173
|
+
)),
|
174
|
+
Object.defineProperty(clientReference, "name", { value: name }),
|
175
|
+
(clientReference = target[name] =
|
176
|
+
new Proxy(clientReference, deepProxyHandlers)));
|
177
|
+
return clientReference;
|
178
|
+
}
|
179
|
+
var proxyHandlers$1 = {
|
180
|
+
get: function (target, name) {
|
181
|
+
return getReference(target, name);
|
182
|
+
},
|
183
|
+
getOwnPropertyDescriptor: function (target, name) {
|
184
|
+
var descriptor = Object.getOwnPropertyDescriptor(target, name);
|
185
|
+
descriptor ||
|
186
|
+
((descriptor = {
|
187
|
+
value: getReference(target, name),
|
188
|
+
writable: !1,
|
189
|
+
configurable: !1,
|
190
|
+
enumerable: !1
|
191
|
+
}),
|
192
|
+
Object.defineProperty(target, name, descriptor));
|
193
|
+
return descriptor;
|
194
|
+
},
|
195
|
+
getPrototypeOf: function () {
|
196
|
+
return PROMISE_PROTOTYPE;
|
197
|
+
},
|
198
|
+
set: function () {
|
199
|
+
throw Error("Cannot assign to a client module from a server module.");
|
347
200
|
}
|
348
|
-
|
349
|
-
return descriptor;
|
350
|
-
},
|
351
|
-
|
352
|
-
getPrototypeOf(target) {
|
353
|
-
// Pretend to be a Promise in case anyone asks.
|
354
|
-
return PROMISE_PROTOTYPE;
|
355
201
|
},
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
}
|
370
|
-
function resolveClientReferenceMetadata(config, clientReference) {
|
371
|
-
const modulePath = clientReference.$$id;
|
372
|
-
let name = '';
|
373
|
-
let resolvedModuleData = config[modulePath];
|
374
|
-
|
375
|
-
if (resolvedModuleData) {
|
376
|
-
// The potentially aliased name.
|
377
|
-
name = resolvedModuleData.name;
|
378
|
-
} else {
|
379
|
-
// We didn't find this specific export name but we might have the * export
|
380
|
-
// which contains this name as well.
|
381
|
-
// TODO: It's unfortunate that we now have to parse this string. We should
|
382
|
-
// probably go back to encoding path and name separately on the client reference.
|
383
|
-
const idx = modulePath.lastIndexOf('#');
|
384
|
-
|
385
|
-
if (idx !== -1) {
|
386
|
-
name = modulePath.slice(idx + 1);
|
387
|
-
resolvedModuleData = config[modulePath.slice(0, idx)];
|
388
|
-
}
|
389
|
-
|
390
|
-
if (!resolvedModuleData) {
|
391
|
-
throw new Error('Could not find the module "' + modulePath + '" in the React Client Manifest. ' + 'This is probably a bug in the React Server Components bundler.');
|
392
|
-
}
|
393
|
-
}
|
394
|
-
|
395
|
-
if (clientReference.$$async === true) {
|
396
|
-
return [resolvedModuleData.id, resolvedModuleData.chunks, name, 1];
|
397
|
-
} else {
|
398
|
-
return [resolvedModuleData.id, resolvedModuleData.chunks, name];
|
399
|
-
}
|
400
|
-
}
|
401
|
-
function getServerReferenceId(config, serverReference) {
|
402
|
-
return serverReference.$$id;
|
403
|
-
}
|
404
|
-
function getServerReferenceBoundArguments(config, serverReference) {
|
405
|
-
return serverReference.$$bound;
|
406
|
-
}
|
407
|
-
|
408
|
-
const ReactDOMSharedInternals = ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
409
|
-
|
410
|
-
const previousDispatcher = ReactDOMSharedInternals.d;
|
411
|
-
/* ReactDOMCurrentDispatcher */
|
412
|
-
|
413
|
-
ReactDOMSharedInternals.d
|
414
|
-
/* ReactDOMCurrentDispatcher */
|
415
|
-
= {
|
416
|
-
f
|
417
|
-
/* flushSyncWork */
|
418
|
-
: previousDispatcher.f
|
419
|
-
/* flushSyncWork */
|
420
|
-
,
|
421
|
-
r
|
422
|
-
/* requestFormReset */
|
423
|
-
: previousDispatcher.r
|
424
|
-
/* requestFormReset */
|
425
|
-
,
|
426
|
-
D
|
427
|
-
/* prefetchDNS */
|
428
|
-
: prefetchDNS,
|
429
|
-
C
|
430
|
-
/* preconnect */
|
431
|
-
: preconnect,
|
432
|
-
L
|
433
|
-
/* preload */
|
434
|
-
: preload,
|
435
|
-
m
|
436
|
-
/* preloadModule */
|
437
|
-
: preloadModule$1,
|
438
|
-
X
|
439
|
-
/* preinitScript */
|
440
|
-
: preinitScript,
|
441
|
-
S
|
442
|
-
/* preinitStyle */
|
443
|
-
: preinitStyle,
|
444
|
-
M
|
445
|
-
/* preinitModuleScript */
|
446
|
-
: preinitModuleScript
|
202
|
+
ReactDOMSharedInternals =
|
203
|
+
ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
|
204
|
+
previousDispatcher = ReactDOMSharedInternals.d;
|
205
|
+
ReactDOMSharedInternals.d = {
|
206
|
+
f: previousDispatcher.f,
|
207
|
+
r: previousDispatcher.r,
|
208
|
+
D: prefetchDNS,
|
209
|
+
C: preconnect,
|
210
|
+
L: preload,
|
211
|
+
m: preloadModule$1,
|
212
|
+
X: preinitScript,
|
213
|
+
S: preinitStyle,
|
214
|
+
M: preinitModuleScript
|
447
215
|
};
|
448
|
-
|
449
216
|
function prefetchDNS(href) {
|
450
|
-
if (typeof href
|
451
|
-
|
452
|
-
|
217
|
+
if ("string" === typeof href && href) {
|
218
|
+
var request = resolveRequest();
|
453
219
|
if (request) {
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
// duplicate hint
|
459
|
-
return;
|
460
|
-
}
|
461
|
-
|
462
|
-
hints.add(key);
|
463
|
-
emitHint(request, 'D', href);
|
464
|
-
} else {
|
465
|
-
previousDispatcher.D(
|
466
|
-
/* prefetchDNS */
|
467
|
-
href);
|
468
|
-
}
|
220
|
+
var hints = request.hints,
|
221
|
+
key = "D|" + href;
|
222
|
+
hints.has(key) || (hints.add(key), emitHint(request, "D", href));
|
223
|
+
} else previousDispatcher.D(href);
|
469
224
|
}
|
470
225
|
}
|
471
|
-
|
472
226
|
function preconnect(href, crossOrigin) {
|
473
|
-
if (typeof href
|
474
|
-
|
475
|
-
|
227
|
+
if ("string" === typeof href) {
|
228
|
+
var request = resolveRequest();
|
476
229
|
if (request) {
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
hints.add(key);
|
486
|
-
|
487
|
-
if (typeof crossOrigin === 'string') {
|
488
|
-
emitHint(request, 'C', [href, crossOrigin]);
|
489
|
-
} else {
|
490
|
-
emitHint(request, 'C', href);
|
491
|
-
}
|
492
|
-
} else {
|
493
|
-
previousDispatcher.C(
|
494
|
-
/* preconnect */
|
495
|
-
href, crossOrigin);
|
496
|
-
}
|
230
|
+
var hints = request.hints,
|
231
|
+
key = "C|" + (null == crossOrigin ? "null" : crossOrigin) + "|" + href;
|
232
|
+
hints.has(key) ||
|
233
|
+
(hints.add(key),
|
234
|
+
"string" === typeof crossOrigin
|
235
|
+
? emitHint(request, "C", [href, crossOrigin])
|
236
|
+
: emitHint(request, "C", href));
|
237
|
+
} else previousDispatcher.C(href, crossOrigin);
|
497
238
|
}
|
498
239
|
}
|
499
|
-
|
500
240
|
function preload(href, as, options) {
|
501
|
-
if (typeof href
|
502
|
-
|
503
|
-
|
241
|
+
if ("string" === typeof href) {
|
242
|
+
var request = resolveRequest();
|
504
243
|
if (request) {
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
}
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
} else {
|
525
|
-
emitHint(request, 'L', [href, as]);
|
526
|
-
}
|
527
|
-
} else {
|
528
|
-
previousDispatcher.L(
|
529
|
-
/* preload */
|
530
|
-
href, as, options);
|
531
|
-
}
|
244
|
+
var hints = request.hints,
|
245
|
+
key = "L";
|
246
|
+
if ("image" === as && options) {
|
247
|
+
var imageSrcSet = options.imageSrcSet,
|
248
|
+
imageSizes = options.imageSizes,
|
249
|
+
uniquePart = "";
|
250
|
+
"string" === typeof imageSrcSet && "" !== imageSrcSet
|
251
|
+
? ((uniquePart += "[" + imageSrcSet + "]"),
|
252
|
+
"string" === typeof imageSizes &&
|
253
|
+
(uniquePart += "[" + imageSizes + "]"))
|
254
|
+
: (uniquePart += "[][]" + href);
|
255
|
+
key += "[image]" + uniquePart;
|
256
|
+
} else key += "[" + as + "]" + href;
|
257
|
+
hints.has(key) ||
|
258
|
+
(hints.add(key),
|
259
|
+
(options = trimOptions(options))
|
260
|
+
? emitHint(request, "L", [href, as, options])
|
261
|
+
: emitHint(request, "L", [href, as]));
|
262
|
+
} else previousDispatcher.L(href, as, options);
|
532
263
|
}
|
533
264
|
}
|
534
|
-
|
535
265
|
function preloadModule$1(href, options) {
|
536
|
-
if (typeof href
|
537
|
-
|
538
|
-
|
266
|
+
if ("string" === typeof href) {
|
267
|
+
var request = resolveRequest();
|
539
268
|
if (request) {
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
if (hints.has(key)) {
|
544
|
-
// duplicate hint
|
545
|
-
return;
|
546
|
-
}
|
547
|
-
|
269
|
+
var hints = request.hints,
|
270
|
+
key = "m|" + href;
|
271
|
+
if (hints.has(key)) return;
|
548
272
|
hints.add(key);
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
return emitHint(request, 'm', [href, trimmed]);
|
553
|
-
} else {
|
554
|
-
return emitHint(request, 'm', href);
|
555
|
-
}
|
556
|
-
} else {
|
557
|
-
previousDispatcher.m(
|
558
|
-
/* preloadModule */
|
559
|
-
href, options);
|
273
|
+
return (options = trimOptions(options))
|
274
|
+
? emitHint(request, "m", [href, options])
|
275
|
+
: emitHint(request, "m", href);
|
560
276
|
}
|
277
|
+
previousDispatcher.m(href, options);
|
561
278
|
}
|
562
279
|
}
|
563
|
-
|
564
280
|
function preinitStyle(href, precedence, options) {
|
565
|
-
if (typeof href
|
566
|
-
|
567
|
-
|
281
|
+
if ("string" === typeof href) {
|
282
|
+
var request = resolveRequest();
|
568
283
|
if (request) {
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
if (hints.has(key)) {
|
573
|
-
// duplicate hint
|
574
|
-
return;
|
575
|
-
}
|
576
|
-
|
284
|
+
var hints = request.hints,
|
285
|
+
key = "S|" + href;
|
286
|
+
if (hints.has(key)) return;
|
577
287
|
hints.add(key);
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
} else {
|
588
|
-
previousDispatcher.S(
|
589
|
-
/* preinitStyle */
|
590
|
-
href, precedence, options);
|
288
|
+
return (options = trimOptions(options))
|
289
|
+
? emitHint(request, "S", [
|
290
|
+
href,
|
291
|
+
"string" === typeof precedence ? precedence : 0,
|
292
|
+
options
|
293
|
+
])
|
294
|
+
: "string" === typeof precedence
|
295
|
+
? emitHint(request, "S", [href, precedence])
|
296
|
+
: emitHint(request, "S", href);
|
591
297
|
}
|
298
|
+
previousDispatcher.S(href, precedence, options);
|
592
299
|
}
|
593
300
|
}
|
594
|
-
|
595
301
|
function preinitScript(src, options) {
|
596
|
-
if (typeof src
|
597
|
-
|
598
|
-
|
302
|
+
if ("string" === typeof src) {
|
303
|
+
var request = resolveRequest();
|
599
304
|
if (request) {
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
if (hints.has(key)) {
|
604
|
-
// duplicate hint
|
605
|
-
return;
|
606
|
-
}
|
607
|
-
|
305
|
+
var hints = request.hints,
|
306
|
+
key = "X|" + src;
|
307
|
+
if (hints.has(key)) return;
|
608
308
|
hints.add(key);
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
return emitHint(request, 'X', [src, trimmed]);
|
613
|
-
} else {
|
614
|
-
return emitHint(request, 'X', src);
|
615
|
-
}
|
616
|
-
} else {
|
617
|
-
previousDispatcher.X(
|
618
|
-
/* preinitScript */
|
619
|
-
src, options);
|
309
|
+
return (options = trimOptions(options))
|
310
|
+
? emitHint(request, "X", [src, options])
|
311
|
+
: emitHint(request, "X", src);
|
620
312
|
}
|
313
|
+
previousDispatcher.X(src, options);
|
621
314
|
}
|
622
315
|
}
|
623
|
-
|
624
316
|
function preinitModuleScript(src, options) {
|
625
|
-
if (typeof src
|
626
|
-
|
627
|
-
|
317
|
+
if ("string" === typeof src) {
|
318
|
+
var request = resolveRequest();
|
628
319
|
if (request) {
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
if (hints.has(key)) {
|
633
|
-
// duplicate hint
|
634
|
-
return;
|
635
|
-
}
|
636
|
-
|
320
|
+
var hints = request.hints,
|
321
|
+
key = "M|" + src;
|
322
|
+
if (hints.has(key)) return;
|
637
323
|
hints.add(key);
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
return emitHint(request, 'M', [src, trimmed]);
|
642
|
-
} else {
|
643
|
-
return emitHint(request, 'M', src);
|
644
|
-
}
|
645
|
-
} else {
|
646
|
-
previousDispatcher.M(
|
647
|
-
/* preinitModuleScript */
|
648
|
-
src, options);
|
324
|
+
return (options = trimOptions(options))
|
325
|
+
? emitHint(request, "M", [src, options])
|
326
|
+
: emitHint(request, "M", src);
|
649
327
|
}
|
328
|
+
previousDispatcher.M(src, options);
|
650
329
|
}
|
651
|
-
}
|
652
|
-
// arguments we don't want to send unnecessary keys and bloat the payload so we create a
|
653
|
-
// trimmed object which omits any keys with null or undefined values.
|
654
|
-
// This is only typesafe because these option objects have entirely optional fields where
|
655
|
-
// null and undefined represent the same thing as no property.
|
656
|
-
|
657
|
-
|
330
|
+
}
|
658
331
|
function trimOptions(options) {
|
659
|
-
if (
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
for (
|
664
|
-
|
665
|
-
hasProperties =
|
666
|
-
trimmed[key] = options[key];
|
667
|
-
}
|
668
|
-
}
|
669
|
-
|
332
|
+
if (null == options) return null;
|
333
|
+
var hasProperties = !1,
|
334
|
+
trimmed = {},
|
335
|
+
key;
|
336
|
+
for (key in options)
|
337
|
+
null != options[key] &&
|
338
|
+
((hasProperties = !0), (trimmed[key] = options[key]));
|
670
339
|
return hasProperties ? trimmed : null;
|
671
340
|
}
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
341
|
+
var supportsRequestStorage = "function" === typeof AsyncLocalStorage,
|
342
|
+
requestStorage = supportsRequestStorage ? new AsyncLocalStorage() : null;
|
343
|
+
"object" === typeof async_hooks
|
344
|
+
? async_hooks.createHook
|
345
|
+
: function () {
|
346
|
+
return { enable: function () {}, disable: function () {} };
|
347
|
+
};
|
348
|
+
"object" === typeof async_hooks ? async_hooks.executionAsyncId : null;
|
349
|
+
var TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
|
350
|
+
proxyHandlers = {
|
351
|
+
get: function (target, name) {
|
352
|
+
switch (name) {
|
353
|
+
case "$$typeof":
|
354
|
+
return target.$$typeof;
|
355
|
+
case "$$id":
|
356
|
+
return target.$$id;
|
357
|
+
case "$$async":
|
358
|
+
return target.$$async;
|
359
|
+
case "name":
|
360
|
+
return;
|
361
|
+
case "displayName":
|
362
|
+
return;
|
363
|
+
case "defaultProps":
|
364
|
+
return;
|
365
|
+
case "toJSON":
|
366
|
+
return;
|
367
|
+
case Symbol.toPrimitive:
|
368
|
+
return Object.prototype[Symbol.toPrimitive];
|
369
|
+
case Symbol.toStringTag:
|
370
|
+
return Object.prototype[Symbol.toStringTag];
|
371
|
+
case "Provider":
|
372
|
+
throw Error(
|
373
|
+
"Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
|
374
|
+
);
|
375
|
+
}
|
376
|
+
throw Error(
|
377
|
+
"Cannot access " +
|
378
|
+
String(name) +
|
379
|
+
" on the server. You cannot dot into a temporary client reference from a server component. You can only pass the value through to the client."
|
380
|
+
);
|
381
|
+
},
|
382
|
+
set: function () {
|
383
|
+
throw Error(
|
384
|
+
"Cannot assign to a temporary client reference from a server module."
|
385
|
+
);
|
681
386
|
}
|
682
|
-
} else {
|
683
|
-
uniquePart += '[][]' + href;
|
684
|
-
}
|
685
|
-
|
686
|
-
return "[image]" + uniquePart;
|
687
|
-
}
|
688
|
-
|
689
|
-
// This module registers the host dispatcher so it needs to be imported
|
690
|
-
// small, smaller than how we encode undefined, and is unambiguous. We could use
|
691
|
-
// a different tuple structure to encode this instead but this makes the runtime
|
692
|
-
// cost cheaper by eliminating a type checks in more positions.
|
693
|
-
// prettier-ignore
|
694
|
-
|
695
|
-
function createHints() {
|
696
|
-
return new Set();
|
697
|
-
}
|
698
|
-
|
699
|
-
const supportsRequestStorage = typeof AsyncLocalStorage === 'function';
|
700
|
-
const requestStorage = supportsRequestStorage ? new AsyncLocalStorage() : null; // We use the Node version but get access to async_hooks from a global.
|
701
|
-
|
702
|
-
typeof async_hooks === 'object' ? async_hooks.createHook : function () {
|
703
|
-
return {
|
704
|
-
enable() {},
|
705
|
-
|
706
|
-
disable() {}
|
707
|
-
|
708
387
|
};
|
709
|
-
};
|
710
|
-
typeof async_hooks === 'object' ? async_hooks.executionAsyncId : null;
|
711
|
-
|
712
|
-
const TEMPORARY_REFERENCE_TAG = Symbol.for('react.temporary.reference'); // eslint-disable-next-line no-unused-vars
|
713
|
-
|
714
|
-
function isTemporaryReference(reference) {
|
715
|
-
return reference.$$typeof === TEMPORARY_REFERENCE_TAG;
|
716
|
-
}
|
717
|
-
function resolveTemporaryReferenceID(temporaryReference) {
|
718
|
-
return temporaryReference.$$id;
|
719
|
-
}
|
720
|
-
const proxyHandlers = {
|
721
|
-
get: function (target, name, receiver) {
|
722
|
-
switch (name) {
|
723
|
-
// These names are read by the Flight runtime if you end up using the exports object.
|
724
|
-
case '$$typeof':
|
725
|
-
// These names are a little too common. We should probably have a way to
|
726
|
-
// have the Flight runtime extract the inner target instead.
|
727
|
-
return target.$$typeof;
|
728
|
-
|
729
|
-
case '$$id':
|
730
|
-
return target.$$id;
|
731
|
-
|
732
|
-
case '$$async':
|
733
|
-
return target.$$async;
|
734
|
-
|
735
|
-
case 'name':
|
736
|
-
return undefined;
|
737
|
-
|
738
|
-
case 'displayName':
|
739
|
-
return undefined;
|
740
|
-
// We need to special case this because createElement reads it if we pass this
|
741
|
-
// reference.
|
742
|
-
|
743
|
-
case 'defaultProps':
|
744
|
-
return undefined;
|
745
|
-
// Avoid this attempting to be serialized.
|
746
|
-
|
747
|
-
case 'toJSON':
|
748
|
-
return undefined;
|
749
|
-
|
750
|
-
case Symbol.toPrimitive:
|
751
|
-
// $FlowFixMe[prop-missing]
|
752
|
-
return Object.prototype[Symbol.toPrimitive];
|
753
|
-
|
754
|
-
case Symbol.toStringTag:
|
755
|
-
// $FlowFixMe[prop-missing]
|
756
|
-
return Object.prototype[Symbol.toStringTag];
|
757
|
-
|
758
|
-
case 'Provider':
|
759
|
-
throw new Error("Cannot render a Client Context Provider on the Server. " + "Instead, you can export a Client Component wrapper " + "that itself renders a Client Context Provider.");
|
760
|
-
}
|
761
|
-
|
762
|
-
throw new Error( // eslint-disable-next-line react-internal/safe-string-coercion
|
763
|
-
"Cannot access " + String(name) + " on the server. " + 'You cannot dot into a temporary client reference from a server component. ' + 'You can only pass the value through to the client.');
|
764
|
-
},
|
765
|
-
set: function () {
|
766
|
-
throw new Error('Cannot assign to a temporary client reference from a server module.');
|
767
|
-
}
|
768
|
-
};
|
769
388
|
function createTemporaryReference(id) {
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
value: TEMPORARY_REFERENCE_TAG
|
389
|
+
id = Object.defineProperties(
|
390
|
+
function () {
|
391
|
+
throw Error(
|
392
|
+
"Attempted to call a temporary Client Reference from the server but it 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."
|
393
|
+
);
|
776
394
|
},
|
777
|
-
$$id: {
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
const REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
793
|
-
const REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
794
|
-
const REACT_MEMO_TYPE = Symbol.for('react.memo');
|
795
|
-
const REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
796
|
-
const REACT_MEMO_CACHE_SENTINEL = Symbol.for('react.memo_cache_sentinel');
|
797
|
-
const REACT_POSTPONE_TYPE = Symbol.for('react.postpone');
|
798
|
-
const MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
799
|
-
const FAUX_ITERATOR_SYMBOL = '@@iterator';
|
395
|
+
{ $$typeof: { value: TEMPORARY_REFERENCE_TAG }, $$id: { value: id } }
|
396
|
+
);
|
397
|
+
return new Proxy(id, proxyHandlers);
|
398
|
+
}
|
399
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
400
|
+
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
401
|
+
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
402
|
+
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
403
|
+
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
404
|
+
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
405
|
+
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
406
|
+
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
407
|
+
REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
|
408
|
+
Symbol.for("react.postpone");
|
409
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
800
410
|
function getIteratorFn(maybeIterable) {
|
801
|
-
if (
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
return null;
|
812
|
-
}
|
813
|
-
|
814
|
-
// Corresponds to ReactFiberWakeable and ReactFizzWakeable modules. Generally,
|
815
|
-
// changes to one module should be reflected in the others.
|
816
|
-
// TODO: Rename this module and the corresponding Fiber one to "Thenable"
|
817
|
-
// instead of "Wakeable". Or some other more appropriate name.
|
818
|
-
// An error that is thrown (e.g. by `use`) to trigger Suspense. If we
|
819
|
-
// detect this is caught by userspace, we'll log a warning in development.
|
820
|
-
const SuspenseException = new Error("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\n' + 'To handle async errors, wrap your component in an error boundary, or ' + "call the promise's `.catch` method and pass the result to `use`");
|
821
|
-
function createThenableState() {
|
822
|
-
// The ThenableState is created the first time a component suspends. If it
|
823
|
-
// suspends again, we'll reuse the same state.
|
824
|
-
return [];
|
825
|
-
}
|
826
|
-
|
411
|
+
if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
|
412
|
+
maybeIterable =
|
413
|
+
(MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
|
414
|
+
maybeIterable["@@iterator"];
|
415
|
+
return "function" === typeof maybeIterable ? maybeIterable : null;
|
416
|
+
}
|
417
|
+
var SuspenseException = Error(
|
418
|
+
"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`"
|
419
|
+
);
|
827
420
|
function noop() {}
|
828
|
-
|
829
421
|
function trackUsedThenable(thenableState, thenable, index) {
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
} else {
|
835
|
-
if (previous !== thenable) {
|
836
|
-
// Reuse the previous thenable, and drop the new one. We can assume
|
837
|
-
// they represent the same value, because components are idempotent.
|
838
|
-
// Avoid an unhandled rejection errors for the Promises that we'll
|
839
|
-
// intentionally ignore.
|
840
|
-
thenable.then(noop, noop);
|
841
|
-
thenable = previous;
|
842
|
-
}
|
843
|
-
} // We use an expando to track the status and result of a thenable so that we
|
844
|
-
// can synchronously unwrap the value. Think of this as an extension of the
|
845
|
-
// Promise API, or a custom interface that is a superset of Thenable.
|
846
|
-
//
|
847
|
-
// If the thenable doesn't have a status, set it to "pending" and attach
|
848
|
-
// a listener that will update its status and result when it resolves.
|
849
|
-
|
850
|
-
|
422
|
+
index = thenableState[index];
|
423
|
+
void 0 === index
|
424
|
+
? thenableState.push(thenable)
|
425
|
+
: index !== thenable && (thenable.then(noop, noop), (thenable = index));
|
851
426
|
switch (thenable.status) {
|
852
|
-
case
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
}
|
857
|
-
|
858
|
-
case 'rejected':
|
859
|
-
{
|
860
|
-
const rejectedError = thenable.reason;
|
861
|
-
throw rejectedError;
|
862
|
-
}
|
863
|
-
|
427
|
+
case "fulfilled":
|
428
|
+
return thenable.value;
|
429
|
+
case "rejected":
|
430
|
+
throw thenable.reason;
|
864
431
|
default:
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
if (thenable.status === 'pending') {
|
884
|
-
const rejectedThenable = thenable;
|
885
|
-
rejectedThenable.status = 'rejected';
|
886
|
-
rejectedThenable.reason = error;
|
887
|
-
}
|
888
|
-
});
|
889
|
-
} // Check one more time in case the thenable resolved synchronously
|
890
|
-
|
891
|
-
|
892
|
-
switch (thenable.status) {
|
893
|
-
case 'fulfilled':
|
894
|
-
{
|
895
|
-
const fulfilledThenable = thenable;
|
896
|
-
return fulfilledThenable.value;
|
897
|
-
}
|
898
|
-
|
899
|
-
case 'rejected':
|
900
|
-
{
|
901
|
-
const rejectedThenable = thenable;
|
902
|
-
throw rejectedThenable.reason;
|
432
|
+
"string" === typeof thenable.status
|
433
|
+
? thenable.then(noop, noop)
|
434
|
+
: ((thenableState = thenable),
|
435
|
+
(thenableState.status = "pending"),
|
436
|
+
thenableState.then(
|
437
|
+
function (fulfilledValue) {
|
438
|
+
if ("pending" === thenable.status) {
|
439
|
+
var fulfilledThenable = thenable;
|
440
|
+
fulfilledThenable.status = "fulfilled";
|
441
|
+
fulfilledThenable.value = fulfilledValue;
|
442
|
+
}
|
443
|
+
},
|
444
|
+
function (error) {
|
445
|
+
if ("pending" === thenable.status) {
|
446
|
+
var rejectedThenable = thenable;
|
447
|
+
rejectedThenable.status = "rejected";
|
448
|
+
rejectedThenable.reason = error;
|
449
|
+
}
|
903
450
|
}
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
// something in userspace must have caught it.
|
911
|
-
|
912
|
-
|
913
|
-
suspendedThenable = thenable;
|
914
|
-
throw SuspenseException;
|
451
|
+
));
|
452
|
+
switch (thenable.status) {
|
453
|
+
case "fulfilled":
|
454
|
+
return thenable.value;
|
455
|
+
case "rejected":
|
456
|
+
throw thenable.reason;
|
915
457
|
}
|
458
|
+
suspendedThenable = thenable;
|
459
|
+
throw SuspenseException;
|
916
460
|
}
|
917
|
-
}
|
918
|
-
|
919
|
-
// reasons, expects to receive a thenable.
|
920
|
-
|
921
|
-
let suspendedThenable = null;
|
461
|
+
}
|
462
|
+
var suspendedThenable = null;
|
922
463
|
function getSuspendedThenable() {
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
throw new Error('Expected a suspended thenable. This is a bug in React. Please file ' + 'an issue.');
|
929
|
-
}
|
930
|
-
|
931
|
-
const thenable = suspendedThenable;
|
464
|
+
if (null === suspendedThenable)
|
465
|
+
throw Error(
|
466
|
+
"Expected a suspended thenable. This is a bug in React. Please file an issue."
|
467
|
+
);
|
468
|
+
var thenable = suspendedThenable;
|
932
469
|
suspendedThenable = null;
|
933
470
|
return thenable;
|
934
471
|
}
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
let thenableState = null;
|
939
|
-
function prepareToUseHooksForRequest(request) {
|
940
|
-
currentRequest$1 = request;
|
941
|
-
}
|
942
|
-
function resetHooksForRequest() {
|
943
|
-
currentRequest$1 = null;
|
944
|
-
}
|
945
|
-
function prepareToUseHooksForComponent(prevThenableState, componentDebugInfo) {
|
946
|
-
thenableIndexCounter = 0;
|
947
|
-
thenableState = prevThenableState;
|
948
|
-
}
|
472
|
+
var currentRequest$1 = null,
|
473
|
+
thenableIndexCounter = 0,
|
474
|
+
thenableState = null;
|
949
475
|
function getThenableStateAfterSuspending() {
|
950
|
-
|
951
|
-
// which is not really supported anymore, it will be empty. We use the empty set as a
|
952
|
-
// marker to know if this was a replay of the same component or first attempt.
|
953
|
-
const state = thenableState || createThenableState();
|
954
|
-
|
476
|
+
var state = thenableState || [];
|
955
477
|
thenableState = null;
|
956
478
|
return state;
|
957
479
|
}
|
958
|
-
|
959
|
-
useMemo(nextCreate) {
|
480
|
+
var HooksDispatcher = {
|
481
|
+
useMemo: function (nextCreate) {
|
960
482
|
return nextCreate();
|
961
483
|
},
|
962
|
-
|
963
|
-
useCallback(callback) {
|
484
|
+
useCallback: function (callback) {
|
964
485
|
return callback;
|
965
486
|
},
|
966
|
-
|
967
|
-
useDebugValue() {},
|
968
|
-
|
487
|
+
useDebugValue: function () {},
|
969
488
|
useDeferredValue: unsupportedHook,
|
970
489
|
useTransition: unsupportedHook,
|
971
490
|
readContext: unsupportedContext,
|
@@ -977,365 +496,215 @@ const HooksDispatcher = {
|
|
977
496
|
useLayoutEffect: unsupportedHook,
|
978
497
|
useImperativeHandle: unsupportedHook,
|
979
498
|
useEffect: unsupportedHook,
|
980
|
-
useId,
|
499
|
+
useId: useId,
|
981
500
|
useSyncExternalStore: unsupportedHook,
|
982
|
-
|
983
|
-
useCacheRefresh() {
|
501
|
+
useCacheRefresh: function () {
|
984
502
|
return unsupportedRefresh;
|
985
503
|
},
|
986
|
-
|
987
|
-
|
988
|
-
const data = new Array(size);
|
989
|
-
|
990
|
-
for (let i = 0; i < size; i++) {
|
504
|
+
useMemoCache: function (size) {
|
505
|
+
for (var data = Array(size), i = 0; i < size; i++)
|
991
506
|
data[i] = REACT_MEMO_CACHE_SENTINEL;
|
992
|
-
}
|
993
|
-
|
994
507
|
return data;
|
995
508
|
},
|
996
|
-
|
997
|
-
use
|
509
|
+
use: use
|
998
510
|
};
|
999
|
-
|
1000
511
|
function unsupportedHook() {
|
1001
|
-
throw
|
512
|
+
throw Error("This Hook is not supported in Server Components.");
|
1002
513
|
}
|
1003
|
-
|
1004
514
|
function unsupportedRefresh() {
|
1005
|
-
throw
|
515
|
+
throw Error("Refreshing the cache is not supported in Server Components.");
|
1006
516
|
}
|
1007
|
-
|
1008
517
|
function unsupportedContext() {
|
1009
|
-
throw
|
518
|
+
throw Error("Cannot read a Client Context from a Server Component.");
|
1010
519
|
}
|
1011
|
-
|
1012
520
|
function useId() {
|
1013
|
-
if (currentRequest$1
|
1014
|
-
throw
|
1015
|
-
|
1016
|
-
|
1017
|
-
const id = currentRequest$1.identifierCount++; // use 'S' for Flight components to distinguish from 'R' and 'r' in Fizz/Client
|
1018
|
-
|
1019
|
-
return ':' + currentRequest$1.identifierPrefix + 'S' + id.toString(32) + ':';
|
521
|
+
if (null === currentRequest$1)
|
522
|
+
throw Error("useId can only be used while React is rendering");
|
523
|
+
var id = currentRequest$1.identifierCount++;
|
524
|
+
return ":" + currentRequest$1.identifierPrefix + "S" + id.toString(32) + ":";
|
1020
525
|
}
|
1021
|
-
|
1022
526
|
function use(usable) {
|
1023
|
-
if (
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
const index = thenableIndexCounter;
|
527
|
+
if (
|
528
|
+
(null !== usable && "object" === typeof usable) ||
|
529
|
+
"function" === typeof usable
|
530
|
+
) {
|
531
|
+
if ("function" === typeof usable.then) {
|
532
|
+
var index = thenableIndexCounter;
|
1030
533
|
thenableIndexCounter += 1;
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
}
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
function resolveCache() {
|
1056
|
-
const request = resolveRequest();
|
1057
|
-
|
1058
|
-
if (request) {
|
1059
|
-
return getCache(request);
|
1060
|
-
}
|
1061
|
-
|
1062
|
-
return new Map();
|
1063
|
-
}
|
1064
|
-
|
1065
|
-
const DefaultCacheDispatcher = {
|
1066
|
-
getCacheForType(resourceType) {
|
1067
|
-
const cache = resolveCache();
|
1068
|
-
let entry = cache.get(resourceType);
|
1069
|
-
|
1070
|
-
if (entry === undefined) {
|
1071
|
-
entry = resourceType(); // TODO: Warn if undefined?
|
1072
|
-
|
1073
|
-
cache.set(resourceType, entry);
|
534
|
+
null === thenableState && (thenableState = []);
|
535
|
+
return trackUsedThenable(thenableState, usable, index);
|
536
|
+
}
|
537
|
+
usable.$$typeof === REACT_CONTEXT_TYPE && unsupportedContext();
|
538
|
+
}
|
539
|
+
if (usable.$$typeof === CLIENT_REFERENCE_TAG$1) {
|
540
|
+
if (null != usable.value && usable.value.$$typeof === REACT_CONTEXT_TYPE)
|
541
|
+
throw Error("Cannot read a Client Context from a Server Component.");
|
542
|
+
throw Error("Cannot use() an already resolved Client Reference.");
|
543
|
+
}
|
544
|
+
throw Error("An unsupported type was passed to use(): " + String(usable));
|
545
|
+
}
|
546
|
+
var DefaultCacheDispatcher = {
|
547
|
+
getCacheForType: function (resourceType) {
|
548
|
+
var JSCompiler_inline_result = (JSCompiler_inline_result =
|
549
|
+
resolveRequest())
|
550
|
+
? JSCompiler_inline_result.cache
|
551
|
+
: new Map();
|
552
|
+
var entry = JSCompiler_inline_result.get(resourceType);
|
553
|
+
void 0 === entry &&
|
554
|
+
((entry = resourceType()),
|
555
|
+
JSCompiler_inline_result.set(resourceType, entry));
|
556
|
+
return entry;
|
1074
557
|
}
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
};
|
1080
|
-
|
1081
|
-
const isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
1082
|
-
|
1083
|
-
function isArray(a) {
|
1084
|
-
return isArrayImpl(a);
|
1085
|
-
}
|
1086
|
-
|
1087
|
-
const getPrototypeOf = Object.getPrototypeOf;
|
1088
|
-
|
558
|
+
},
|
559
|
+
isArrayImpl = Array.isArray,
|
560
|
+
getPrototypeOf = Object.getPrototypeOf;
|
1089
561
|
function objectName(object) {
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
}
|
1096
|
-
|
1097
|
-
function describeKeyForErrorMessage(key) {
|
1098
|
-
const encodedKey = JSON.stringify(key);
|
1099
|
-
return '"' + key + '"' === encodedKey ? key : encodedKey;
|
562
|
+
return Object.prototype.toString
|
563
|
+
.call(object)
|
564
|
+
.replace(/^\[object (.*)\]$/, function (m, p0) {
|
565
|
+
return p0;
|
566
|
+
});
|
1100
567
|
}
|
1101
|
-
|
1102
568
|
function describeValueForErrorMessage(value) {
|
1103
569
|
switch (typeof value) {
|
1104
|
-
case
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
if (name === 'Object') {
|
1122
|
-
return '{...}';
|
1123
|
-
}
|
1124
|
-
|
1125
|
-
return name;
|
1126
|
-
}
|
1127
|
-
|
1128
|
-
case 'function':
|
1129
|
-
{
|
1130
|
-
if (value.$$typeof === CLIENT_REFERENCE_TAG) {
|
1131
|
-
return describeClientReference();
|
1132
|
-
}
|
1133
|
-
|
1134
|
-
const name = value.displayName || value.name;
|
1135
|
-
return name ? 'function ' + name : 'function';
|
1136
|
-
}
|
1137
|
-
|
570
|
+
case "string":
|
571
|
+
return JSON.stringify(
|
572
|
+
10 >= value.length ? value : value.slice(0, 10) + "..."
|
573
|
+
);
|
574
|
+
case "object":
|
575
|
+
if (isArrayImpl(value)) return "[...]";
|
576
|
+
if (null !== value && value.$$typeof === CLIENT_REFERENCE_TAG)
|
577
|
+
return "client";
|
578
|
+
value = objectName(value);
|
579
|
+
return "Object" === value ? "{...}" : value;
|
580
|
+
case "function":
|
581
|
+
return value.$$typeof === CLIENT_REFERENCE_TAG
|
582
|
+
? "client"
|
583
|
+
: (value = value.displayName || value.name)
|
584
|
+
? "function " + value
|
585
|
+
: "function";
|
1138
586
|
default:
|
1139
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
1140
587
|
return String(value);
|
1141
588
|
}
|
1142
589
|
}
|
1143
|
-
|
1144
590
|
function describeElementType(type) {
|
1145
|
-
if (typeof type
|
1146
|
-
return type;
|
1147
|
-
}
|
1148
|
-
|
591
|
+
if ("string" === typeof type) return type;
|
1149
592
|
switch (type) {
|
1150
593
|
case REACT_SUSPENSE_TYPE:
|
1151
|
-
return
|
1152
|
-
|
594
|
+
return "Suspense";
|
1153
595
|
case REACT_SUSPENSE_LIST_TYPE:
|
1154
|
-
return
|
596
|
+
return "SuspenseList";
|
1155
597
|
}
|
1156
|
-
|
1157
|
-
if (typeof type === 'object') {
|
598
|
+
if ("object" === typeof type)
|
1158
599
|
switch (type.$$typeof) {
|
1159
600
|
case REACT_FORWARD_REF_TYPE:
|
1160
601
|
return describeElementType(type.render);
|
1161
|
-
|
1162
602
|
case REACT_MEMO_TYPE:
|
1163
603
|
return describeElementType(type.type);
|
1164
|
-
|
1165
604
|
case REACT_LAZY_TYPE:
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
try {
|
1172
|
-
// Lazy may contain any component type so we recursively resolve it.
|
1173
|
-
return describeElementType(init(payload));
|
1174
|
-
} catch (x) {}
|
1175
|
-
}
|
605
|
+
var payload = type._payload;
|
606
|
+
type = type._init;
|
607
|
+
try {
|
608
|
+
return describeElementType(type(payload));
|
609
|
+
} catch (x) {}
|
1176
610
|
}
|
1177
|
-
|
1178
|
-
|
1179
|
-
return '';
|
1180
|
-
}
|
1181
|
-
|
1182
|
-
const CLIENT_REFERENCE_TAG = Symbol.for('react.client.reference');
|
1183
|
-
|
1184
|
-
function describeClientReference(ref) {
|
1185
|
-
return 'client';
|
611
|
+
return "";
|
1186
612
|
}
|
1187
|
-
|
613
|
+
var CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference");
|
1188
614
|
function describeObjectForErrorMessage(objectOrArray, expandedName) {
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
if (typeof value === 'object' && value !== null) {
|
1254
|
-
substr = describeObjectForErrorMessage(value);
|
1255
|
-
} else {
|
1256
|
-
substr = describeValueForErrorMessage(value);
|
1257
|
-
}
|
1258
|
-
|
1259
|
-
if (name === expandedName) {
|
1260
|
-
start = str.length;
|
1261
|
-
length = substr.length;
|
1262
|
-
str += substr;
|
1263
|
-
} else if (substr.length < 10 && str.length + substr.length < 40) {
|
1264
|
-
str += substr;
|
1265
|
-
} else {
|
1266
|
-
str += '...';
|
1267
|
-
}
|
1268
|
-
}
|
1269
|
-
|
1270
|
-
str += '}';
|
1271
|
-
}
|
1272
|
-
}
|
1273
|
-
|
1274
|
-
if (expandedName === undefined) {
|
1275
|
-
return str;
|
1276
|
-
}
|
1277
|
-
|
1278
|
-
if (start > -1 && length > 0) {
|
1279
|
-
const highlight = ' '.repeat(start) + '^'.repeat(length);
|
1280
|
-
return '\n ' + str + '\n ' + highlight;
|
1281
|
-
}
|
1282
|
-
|
1283
|
-
return '\n ' + str;
|
1284
|
-
}
|
1285
|
-
|
1286
|
-
const ReactSharedInternalsServer = // $FlowFixMe: It's defined in the one we resolve to.
|
1287
|
-
React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
1288
|
-
|
1289
|
-
if (!ReactSharedInternalsServer) {
|
1290
|
-
throw new Error('The "react" package in this environment is not configured correctly. ' + 'The "react-server" condition must be enabled in any environment that ' + 'runs React Server Components.');
|
1291
|
-
}
|
1292
|
-
|
1293
|
-
const ReactSharedInternals = ReactSharedInternalsServer;
|
1294
|
-
|
1295
|
-
const ObjectPrototype = Object.prototype;
|
1296
|
-
const stringify = JSON.stringify; // Serializable values
|
1297
|
-
// Thenable<ReactClientValue>
|
1298
|
-
// task status
|
1299
|
-
|
1300
|
-
const PENDING$1 = 0;
|
1301
|
-
const COMPLETED = 1;
|
1302
|
-
const ABORTED = 3;
|
1303
|
-
const ERRORED$1 = 4; // object reference status
|
1304
|
-
|
1305
|
-
const SEEN_BUT_NOT_YET_OUTLINED = -1;
|
1306
|
-
const NEVER_OUTLINED = -2;
|
1307
|
-
|
615
|
+
var objKind = objectName(objectOrArray);
|
616
|
+
if ("Object" !== objKind && "Array" !== objKind) return objKind;
|
617
|
+
objKind = -1;
|
618
|
+
var length = 0;
|
619
|
+
if (isArrayImpl(objectOrArray)) {
|
620
|
+
var str = "[";
|
621
|
+
for (var i = 0; i < objectOrArray.length; i++) {
|
622
|
+
0 < i && (str += ", ");
|
623
|
+
var value = objectOrArray[i];
|
624
|
+
value =
|
625
|
+
"object" === typeof value && null !== value
|
626
|
+
? describeObjectForErrorMessage(value)
|
627
|
+
: describeValueForErrorMessage(value);
|
628
|
+
"" + i === expandedName
|
629
|
+
? ((objKind = str.length), (length = value.length), (str += value))
|
630
|
+
: (str =
|
631
|
+
10 > value.length && 40 > str.length + value.length
|
632
|
+
? str + value
|
633
|
+
: str + "...");
|
634
|
+
}
|
635
|
+
str += "]";
|
636
|
+
} else if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE)
|
637
|
+
str = "<" + describeElementType(objectOrArray.type) + "/>";
|
638
|
+
else {
|
639
|
+
if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) return "client";
|
640
|
+
str = "{";
|
641
|
+
i = Object.keys(objectOrArray);
|
642
|
+
for (value = 0; value < i.length; value++) {
|
643
|
+
0 < value && (str += ", ");
|
644
|
+
var name = i[value],
|
645
|
+
encodedKey = JSON.stringify(name);
|
646
|
+
str += ('"' + name + '"' === encodedKey ? name : encodedKey) + ": ";
|
647
|
+
encodedKey = objectOrArray[name];
|
648
|
+
encodedKey =
|
649
|
+
"object" === typeof encodedKey && null !== encodedKey
|
650
|
+
? describeObjectForErrorMessage(encodedKey)
|
651
|
+
: describeValueForErrorMessage(encodedKey);
|
652
|
+
name === expandedName
|
653
|
+
? ((objKind = str.length),
|
654
|
+
(length = encodedKey.length),
|
655
|
+
(str += encodedKey))
|
656
|
+
: (str =
|
657
|
+
10 > encodedKey.length && 40 > str.length + encodedKey.length
|
658
|
+
? str + encodedKey
|
659
|
+
: str + "...");
|
660
|
+
}
|
661
|
+
str += "}";
|
662
|
+
}
|
663
|
+
return void 0 === expandedName
|
664
|
+
? str
|
665
|
+
: -1 < objKind && 0 < length
|
666
|
+
? ((objectOrArray = " ".repeat(objKind) + "^".repeat(length)),
|
667
|
+
"\n " + str + "\n " + objectOrArray)
|
668
|
+
: "\n " + str;
|
669
|
+
}
|
670
|
+
var ReactSharedInternalsServer =
|
671
|
+
React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
672
|
+
if (!ReactSharedInternalsServer)
|
673
|
+
throw Error(
|
674
|
+
'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
|
675
|
+
);
|
676
|
+
var ObjectPrototype = Object.prototype,
|
677
|
+
stringify = JSON.stringify;
|
1308
678
|
function defaultErrorHandler(error) {
|
1309
|
-
console
|
1310
|
-
}
|
1311
|
-
|
1312
|
-
function
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
if (
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
flushScheduled: false,
|
679
|
+
console.error(error);
|
680
|
+
}
|
681
|
+
function defaultPostponeHandler() {}
|
682
|
+
function createRequest(
|
683
|
+
model,
|
684
|
+
bundlerConfig,
|
685
|
+
onError,
|
686
|
+
identifierPrefix,
|
687
|
+
onPostpone
|
688
|
+
) {
|
689
|
+
if (
|
690
|
+
null !== ReactSharedInternalsServer.C &&
|
691
|
+
ReactSharedInternalsServer.C !== DefaultCacheDispatcher
|
692
|
+
)
|
693
|
+
throw Error("Currently React only supports one RSC renderer at a time.");
|
694
|
+
ReactSharedInternalsServer.C = DefaultCacheDispatcher;
|
695
|
+
var abortSet = new Set(),
|
696
|
+
pingedTasks = [],
|
697
|
+
hints = new Set();
|
698
|
+
bundlerConfig = {
|
699
|
+
status: 0,
|
700
|
+
flushScheduled: !1,
|
1332
701
|
fatalError: null,
|
1333
702
|
destination: null,
|
1334
|
-
bundlerConfig,
|
703
|
+
bundlerConfig: bundlerConfig,
|
1335
704
|
cache: new Map(),
|
1336
705
|
nextChunkId: 0,
|
1337
706
|
pendingChunks: 0,
|
1338
|
-
hints,
|
707
|
+
hints: hints,
|
1339
708
|
abortListeners: new Set(),
|
1340
709
|
abortableTasks: abortSet,
|
1341
710
|
pingedTasks: pingedTasks,
|
@@ -1347,2053 +716,1241 @@ function createRequest(model, bundlerConfig, onError, identifierPrefix, onPostpo
|
|
1347
716
|
writtenClientReferences: new Map(),
|
1348
717
|
writtenServerReferences: new Map(),
|
1349
718
|
writtenObjects: new WeakMap(),
|
1350
|
-
identifierPrefix: identifierPrefix ||
|
719
|
+
identifierPrefix: identifierPrefix || "",
|
1351
720
|
identifierCount: 1,
|
1352
|
-
taintCleanupQueue:
|
1353
|
-
onError:
|
1354
|
-
onPostpone:
|
721
|
+
taintCleanupQueue: [],
|
722
|
+
onError: void 0 === onError ? defaultErrorHandler : onError,
|
723
|
+
onPostpone: void 0 === onPostpone ? defaultPostponeHandler : onPostpone
|
1355
724
|
};
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
return request;
|
725
|
+
model = createTask(bundlerConfig, model, null, !1, abortSet);
|
726
|
+
pingedTasks.push(model);
|
727
|
+
return bundlerConfig;
|
1360
728
|
}
|
1361
|
-
|
729
|
+
var currentRequest = null;
|
1362
730
|
function resolveRequest() {
|
1363
731
|
if (currentRequest) return currentRequest;
|
1364
|
-
|
1365
732
|
if (supportsRequestStorage) {
|
1366
|
-
|
733
|
+
var store = requestStorage.getStore();
|
1367
734
|
if (store) return store;
|
1368
735
|
}
|
1369
|
-
|
1370
736
|
return null;
|
1371
737
|
}
|
1372
|
-
|
1373
738
|
function serializeThenable(request, task, thenable) {
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
739
|
+
var newTask = createTask(
|
740
|
+
request,
|
741
|
+
null,
|
742
|
+
task.keyPath,
|
743
|
+
task.implicitSlot,
|
744
|
+
request.abortableTasks
|
745
|
+
);
|
1377
746
|
switch (thenable.status) {
|
1378
|
-
case
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
const x = thenable.reason;
|
1389
|
-
|
1390
|
-
{
|
1391
|
-
const digest = logRecoverableError(request, x);
|
1392
|
-
emitErrorChunk(request, newTask.id, digest);
|
1393
|
-
}
|
1394
|
-
|
1395
|
-
return newTask.id;
|
1396
|
-
}
|
1397
|
-
|
747
|
+
case "fulfilled":
|
748
|
+
return (
|
749
|
+
(newTask.model = thenable.value), pingTask(request, newTask), newTask.id
|
750
|
+
);
|
751
|
+
case "rejected":
|
752
|
+
return (
|
753
|
+
(task = logRecoverableError(request, thenable.reason)),
|
754
|
+
emitErrorChunk(request, newTask.id, task),
|
755
|
+
newTask.id
|
756
|
+
);
|
1398
757
|
default:
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
if (thenable.status === 'pending') {
|
1411
|
-
const fulfilledThenable = thenable;
|
1412
|
-
fulfilledThenable.status = 'fulfilled';
|
1413
|
-
fulfilledThenable.value = fulfilledValue;
|
1414
|
-
}
|
1415
|
-
}, error => {
|
1416
|
-
if (thenable.status === 'pending') {
|
1417
|
-
const rejectedThenable = thenable;
|
1418
|
-
rejectedThenable.status = 'rejected';
|
1419
|
-
rejectedThenable.reason = error;
|
758
|
+
"string" !== typeof thenable.status &&
|
759
|
+
((thenable.status = "pending"),
|
760
|
+
thenable.then(
|
761
|
+
function (fulfilledValue) {
|
762
|
+
"pending" === thenable.status &&
|
763
|
+
((thenable.status = "fulfilled"),
|
764
|
+
(thenable.value = fulfilledValue));
|
765
|
+
},
|
766
|
+
function (error) {
|
767
|
+
"pending" === thenable.status &&
|
768
|
+
((thenable.status = "rejected"), (thenable.reason = error));
|
1420
769
|
}
|
1421
|
-
|
1422
|
-
break;
|
1423
|
-
}
|
770
|
+
));
|
1424
771
|
}
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
{
|
1431
|
-
newTask.status =
|
1432
|
-
|
1433
|
-
emitErrorChunk(request, newTask.id,
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
});
|
772
|
+
thenable.then(
|
773
|
+
function (value) {
|
774
|
+
newTask.model = value;
|
775
|
+
pingTask(request, newTask);
|
776
|
+
},
|
777
|
+
function (reason) {
|
778
|
+
newTask.status = 4;
|
779
|
+
reason = logRecoverableError(request, reason);
|
780
|
+
emitErrorChunk(request, newTask.id, reason);
|
781
|
+
request.abortableTasks.delete(newTask);
|
782
|
+
enqueueFlush(request);
|
783
|
+
}
|
784
|
+
);
|
1439
785
|
return newTask.id;
|
1440
786
|
}
|
1441
|
-
|
1442
787
|
function emitHint(request, code, model) {
|
1443
|
-
|
788
|
+
model = stringify(model);
|
789
|
+
var id = request.nextChunkId++;
|
790
|
+
code = "H" + code;
|
791
|
+
code = id.toString(16) + ":" + code;
|
792
|
+
model = textEncoder.encode(code + model + "\n");
|
793
|
+
request.completedHintChunks.push(model);
|
1444
794
|
enqueueFlush(request);
|
1445
795
|
}
|
1446
|
-
function getHints(request) {
|
1447
|
-
return request.hints;
|
1448
|
-
}
|
1449
|
-
function getCache(request) {
|
1450
|
-
return request.cache;
|
1451
|
-
}
|
1452
|
-
|
1453
796
|
function readThenable(thenable) {
|
1454
|
-
if (thenable.status
|
1455
|
-
|
1456
|
-
} else if (thenable.status === 'rejected') {
|
1457
|
-
throw thenable.reason;
|
1458
|
-
}
|
1459
|
-
|
797
|
+
if ("fulfilled" === thenable.status) return thenable.value;
|
798
|
+
if ("rejected" === thenable.status) throw thenable.reason;
|
1460
799
|
throw thenable;
|
1461
800
|
}
|
1462
|
-
|
1463
801
|
function createLazyWrapperAroundWakeable(wakeable) {
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
switch (thenable.status) {
|
1469
|
-
case 'fulfilled':
|
1470
|
-
case 'rejected':
|
802
|
+
switch (wakeable.status) {
|
803
|
+
case "fulfilled":
|
804
|
+
case "rejected":
|
1471
805
|
break;
|
1472
|
-
|
1473
806
|
default:
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
if (thenable.status === 'pending') {
|
1486
|
-
const fulfilledThenable = thenable;
|
1487
|
-
fulfilledThenable.status = 'fulfilled';
|
1488
|
-
fulfilledThenable.value = fulfilledValue;
|
807
|
+
"string" !== typeof wakeable.status &&
|
808
|
+
((wakeable.status = "pending"),
|
809
|
+
wakeable.then(
|
810
|
+
function (fulfilledValue) {
|
811
|
+
"pending" === wakeable.status &&
|
812
|
+
((wakeable.status = "fulfilled"),
|
813
|
+
(wakeable.value = fulfilledValue));
|
814
|
+
},
|
815
|
+
function (error) {
|
816
|
+
"pending" === wakeable.status &&
|
817
|
+
((wakeable.status = "rejected"), (wakeable.reason = error));
|
1489
818
|
}
|
1490
|
-
|
1491
|
-
if (thenable.status === 'pending') {
|
1492
|
-
const rejectedThenable = thenable;
|
1493
|
-
rejectedThenable.status = 'rejected';
|
1494
|
-
rejectedThenable.reason = error;
|
1495
|
-
}
|
1496
|
-
});
|
1497
|
-
break;
|
1498
|
-
}
|
819
|
+
));
|
1499
820
|
}
|
1500
|
-
|
1501
|
-
const lazyType = {
|
1502
|
-
$$typeof: REACT_LAZY_TYPE,
|
1503
|
-
_payload: thenable,
|
1504
|
-
_init: readThenable
|
1505
|
-
};
|
1506
|
-
|
1507
|
-
return lazyType;
|
821
|
+
return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable };
|
1508
822
|
}
|
1509
|
-
|
1510
|
-
|
1511
|
-
// Reset the task's thenable state before continuing, so that if a later
|
1512
|
-
// component suspends we can reuse the same task object. If the same
|
1513
|
-
// component suspends again, the thenable state will be restored.
|
1514
|
-
const prevThenableState = task.thenableState;
|
823
|
+
function renderFunctionComponent(request, task, key, Component, props) {
|
824
|
+
var prevThenableState = task.thenableState;
|
1515
825
|
task.thenableState = null;
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
// Append the key to the path. Technically a null key should really add the child
|
1546
|
-
// index. We don't do that to hold the payload small and implementation simple.
|
1547
|
-
task.keyPath = prevKeyPath === null ? key : prevKeyPath + ',' + key;
|
1548
|
-
} else if (prevKeyPath === null) {
|
1549
|
-
// This sequence of Server Components has no keys. This means that it was rendered
|
1550
|
-
// in a slot that needs to assign an implicit key. Even if children below have
|
1551
|
-
// explicit keys, they should not be used for the outer most key since it might
|
1552
|
-
// collide with other slots in that set.
|
1553
|
-
task.implicitSlot = true;
|
1554
|
-
}
|
1555
|
-
|
1556
|
-
const json = renderModelDestructive(request, task, emptyRoot, '', result);
|
1557
|
-
task.keyPath = prevKeyPath;
|
1558
|
-
task.implicitSlot = prevImplicitSlot;
|
1559
|
-
return json;
|
826
|
+
thenableIndexCounter = 0;
|
827
|
+
thenableState = prevThenableState;
|
828
|
+
Component = Component(props, void 0);
|
829
|
+
if ("object" === typeof Component && null !== Component) {
|
830
|
+
if ("function" === typeof Component.then) {
|
831
|
+
props = Component;
|
832
|
+
if ("fulfilled" === props.status) return props.value;
|
833
|
+
Component = createLazyWrapperAroundWakeable(Component);
|
834
|
+
}
|
835
|
+
var iteratorFn = getIteratorFn(Component);
|
836
|
+
if (iteratorFn) {
|
837
|
+
var iterableChild = Component;
|
838
|
+
Component = {};
|
839
|
+
Component =
|
840
|
+
((Component[Symbol.iterator] = function () {
|
841
|
+
return iteratorFn.call(iterableChild);
|
842
|
+
}),
|
843
|
+
Component);
|
844
|
+
}
|
845
|
+
}
|
846
|
+
props = task.keyPath;
|
847
|
+
prevThenableState = task.implicitSlot;
|
848
|
+
null !== key
|
849
|
+
? (task.keyPath = null === props ? key : props + "," + key)
|
850
|
+
: null === props && (task.implicitSlot = !0);
|
851
|
+
request = renderModelDestructive(request, task, emptyRoot, "", Component);
|
852
|
+
task.keyPath = props;
|
853
|
+
task.implicitSlot = prevThenableState;
|
854
|
+
return request;
|
1560
855
|
}
|
1561
|
-
|
1562
856
|
function renderFragment(request, task, children) {
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
return
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
function renderClientElement(task, type, key, props, owner) // DEV-only
|
1594
|
-
{
|
1595
|
-
// the keys of any Server Components which are not serialized.
|
1596
|
-
|
1597
|
-
|
1598
|
-
const keyPath = task.keyPath;
|
1599
|
-
|
1600
|
-
if (key === null) {
|
1601
|
-
key = keyPath;
|
1602
|
-
} else if (keyPath !== null) {
|
1603
|
-
key = keyPath + ',' + key;
|
1604
|
-
}
|
1605
|
-
|
1606
|
-
const element = [REACT_ELEMENT_TYPE, type, key, props];
|
1607
|
-
|
1608
|
-
if (task.implicitSlot && key !== null) {
|
1609
|
-
// The root Server Component had no key so it was in an implicit slot.
|
1610
|
-
// If we had a key lower, it would end up in that slot with an explicit key.
|
1611
|
-
// We wrap the element in a fragment to give it an implicit key slot with
|
1612
|
-
// an inner explicit key.
|
1613
|
-
return [element];
|
1614
|
-
} // Since we're yielding here, that implicitly resets the keyPath context on the
|
1615
|
-
// way up. Which is what we want since we've consumed it. If this changes to
|
1616
|
-
// be recursive serialization, we need to reset the keyPath and implicitSlot,
|
1617
|
-
// before recursing here. We also need to reset it once we render into an array
|
1618
|
-
// or anything else too which we also get implicitly.
|
1619
|
-
|
1620
|
-
|
1621
|
-
return element;
|
1622
|
-
} // The chunk ID we're currently rendering that we can assign debug data to.
|
1623
|
-
|
1624
|
-
|
1625
|
-
let debugID = null;
|
1626
|
-
|
1627
|
-
function renderElement(request, task, type, key, ref, props, owner) // DEV only
|
1628
|
-
{
|
1629
|
-
if (ref !== null && ref !== undefined) {
|
1630
|
-
// When the ref moves to the regular props object this will implicitly
|
1631
|
-
// throw for functions. We could probably relax it to a DEV warning for other
|
1632
|
-
// cases.
|
1633
|
-
// TODO: `ref` is now just a prop when `enableRefAsProp` is on. Should we
|
1634
|
-
// do what the above comment says?
|
1635
|
-
throw new Error('Refs cannot be used in Server Components, nor passed to Client Components.');
|
1636
|
-
}
|
1637
|
-
|
1638
|
-
if (typeof type === 'function') {
|
1639
|
-
if (isClientReference(type) || isTemporaryReference(type)) {
|
1640
|
-
// This is a reference to a Client Component.
|
1641
|
-
return renderClientElement(task, type, key, props);
|
1642
|
-
} // This is a Server Component.
|
1643
|
-
|
1644
|
-
|
1645
|
-
return renderFunctionComponent(request, task, key, type, props);
|
1646
|
-
} else if (typeof type === 'string') {
|
1647
|
-
// This is a host element. E.g. HTML.
|
1648
|
-
return renderClientElement(task, type, key, props);
|
1649
|
-
} else if (typeof type === 'symbol') {
|
1650
|
-
if (type === REACT_FRAGMENT_TYPE && key === null) {
|
1651
|
-
// For key-less fragments, we add a small optimization to avoid serializing
|
1652
|
-
// it as a wrapper.
|
1653
|
-
const prevImplicitSlot = task.implicitSlot;
|
1654
|
-
|
1655
|
-
if (task.keyPath === null) {
|
1656
|
-
task.implicitSlot = true;
|
1657
|
-
}
|
1658
|
-
|
1659
|
-
const json = renderModelDestructive(request, task, emptyRoot, '', props.children);
|
1660
|
-
task.implicitSlot = prevImplicitSlot;
|
1661
|
-
return json;
|
1662
|
-
} // This might be a built-in React component. We'll let the client decide.
|
1663
|
-
// Any built-in works as long as its props are serializable.
|
1664
|
-
|
1665
|
-
|
857
|
+
return null !== task.keyPath
|
858
|
+
? ((request = [
|
859
|
+
REACT_ELEMENT_TYPE,
|
860
|
+
REACT_FRAGMENT_TYPE,
|
861
|
+
task.keyPath,
|
862
|
+
{ children: children }
|
863
|
+
]),
|
864
|
+
task.implicitSlot ? [request] : request)
|
865
|
+
: children;
|
866
|
+
}
|
867
|
+
function renderClientElement(task, type, key, props) {
|
868
|
+
var keyPath = task.keyPath;
|
869
|
+
null === key
|
870
|
+
? (key = keyPath)
|
871
|
+
: null !== keyPath && (key = keyPath + "," + key);
|
872
|
+
type = [REACT_ELEMENT_TYPE, type, key, props];
|
873
|
+
return task.implicitSlot && null !== key ? [type] : type;
|
874
|
+
}
|
875
|
+
function renderElement(request, task, type, key, ref, props) {
|
876
|
+
if (null !== ref && void 0 !== ref)
|
877
|
+
throw Error(
|
878
|
+
"Refs cannot be used in Server Components, nor passed to Client Components."
|
879
|
+
);
|
880
|
+
if ("function" === typeof type)
|
881
|
+
return type.$$typeof === CLIENT_REFERENCE_TAG$1 ||
|
882
|
+
type.$$typeof === TEMPORARY_REFERENCE_TAG
|
883
|
+
? renderClientElement(task, type, key, props)
|
884
|
+
: renderFunctionComponent(request, task, key, type, props);
|
885
|
+
if ("string" === typeof type)
|
1666
886
|
return renderClientElement(task, type, key, props);
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
887
|
+
if ("symbol" === typeof type)
|
888
|
+
return type === REACT_FRAGMENT_TYPE && null === key
|
889
|
+
? ((key = task.implicitSlot),
|
890
|
+
null === task.keyPath && (task.implicitSlot = !0),
|
891
|
+
(request = renderModelDestructive(
|
892
|
+
request,
|
893
|
+
task,
|
894
|
+
emptyRoot,
|
895
|
+
"",
|
896
|
+
props.children
|
897
|
+
)),
|
898
|
+
(task.implicitSlot = key),
|
899
|
+
request)
|
900
|
+
: renderClientElement(task, type, key, props);
|
901
|
+
if (null != type && "object" === typeof type) {
|
902
|
+
if (type.$$typeof === CLIENT_REFERENCE_TAG$1)
|
1670
903
|
return renderClientElement(task, type, key, props);
|
1671
|
-
}
|
1672
|
-
|
1673
904
|
switch (type.$$typeof) {
|
1674
905
|
case REACT_LAZY_TYPE:
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
const wrappedType = init(payload);
|
1679
|
-
return renderElement(request, task, wrappedType, key, ref, props);
|
1680
|
-
}
|
1681
|
-
|
906
|
+
var init = type._init;
|
907
|
+
type = init(type._payload);
|
908
|
+
return renderElement(request, task, type, key, ref, props);
|
1682
909
|
case REACT_FORWARD_REF_TYPE:
|
1683
|
-
|
1684
|
-
return renderFunctionComponent(request, task, key, type.render, props);
|
1685
|
-
}
|
1686
|
-
|
910
|
+
return renderFunctionComponent(request, task, key, type.render, props);
|
1687
911
|
case REACT_MEMO_TYPE:
|
1688
|
-
|
1689
|
-
return renderElement(request, task, type.type, key, ref, props);
|
1690
|
-
}
|
912
|
+
return renderElement(request, task, type.type, key, ref, props);
|
1691
913
|
}
|
1692
914
|
}
|
1693
|
-
|
1694
|
-
|
915
|
+
throw Error(
|
916
|
+
"Unsupported Server Component type: " + describeValueForErrorMessage(type)
|
917
|
+
);
|
1695
918
|
}
|
1696
|
-
|
1697
919
|
function pingTask(request, task) {
|
1698
|
-
|
920
|
+
var pingedTasks = request.pingedTasks;
|
1699
921
|
pingedTasks.push(task);
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
922
|
+
1 === pingedTasks.length &&
|
923
|
+
((request.flushScheduled = null !== request.destination),
|
924
|
+
setTimeout(function () {
|
925
|
+
return performWork(request);
|
926
|
+
}, 0));
|
1705
927
|
}
|
1706
|
-
|
1707
928
|
function createTask(request, model, keyPath, implicitSlot, abortSet) {
|
1708
929
|
request.pendingChunks++;
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
implicitSlot,
|
1725
|
-
ping: () => pingTask(request, task),
|
930
|
+
var id = request.nextChunkId++;
|
931
|
+
"object" !== typeof model ||
|
932
|
+
null === model ||
|
933
|
+
null !== keyPath ||
|
934
|
+
implicitSlot ||
|
935
|
+
request.writtenObjects.set(model, id);
|
936
|
+
var task = {
|
937
|
+
id: id,
|
938
|
+
status: 0,
|
939
|
+
model: model,
|
940
|
+
keyPath: keyPath,
|
941
|
+
implicitSlot: implicitSlot,
|
942
|
+
ping: function () {
|
943
|
+
return pingTask(request, task);
|
944
|
+
},
|
1726
945
|
toJSON: function (parentPropertyName, value) {
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
946
|
+
var prevKeyPath = task.keyPath,
|
947
|
+
prevImplicitSlot = task.implicitSlot;
|
948
|
+
try {
|
949
|
+
var JSCompiler_inline_result = renderModelDestructive(
|
950
|
+
request,
|
951
|
+
task,
|
952
|
+
this,
|
953
|
+
parentPropertyName,
|
954
|
+
value
|
955
|
+
);
|
956
|
+
} catch (thrownValue) {
|
957
|
+
if (
|
958
|
+
((parentPropertyName =
|
959
|
+
thrownValue === SuspenseException
|
960
|
+
? getSuspendedThenable()
|
961
|
+
: thrownValue),
|
962
|
+
(value = task.model),
|
963
|
+
(value =
|
964
|
+
"object" === typeof value &&
|
965
|
+
null !== value &&
|
966
|
+
(value.$$typeof === REACT_ELEMENT_TYPE ||
|
967
|
+
value.$$typeof === REACT_LAZY_TYPE)),
|
968
|
+
"object" === typeof parentPropertyName &&
|
969
|
+
null !== parentPropertyName &&
|
970
|
+
"function" === typeof parentPropertyName.then)
|
971
|
+
) {
|
972
|
+
JSCompiler_inline_result = createTask(
|
973
|
+
request,
|
974
|
+
task.model,
|
975
|
+
task.keyPath,
|
976
|
+
task.implicitSlot,
|
977
|
+
request.abortableTasks
|
978
|
+
);
|
979
|
+
var ping = JSCompiler_inline_result.ping;
|
980
|
+
parentPropertyName.then(ping, ping);
|
981
|
+
JSCompiler_inline_result.thenableState =
|
982
|
+
getThenableStateAfterSuspending();
|
983
|
+
task.keyPath = prevKeyPath;
|
984
|
+
task.implicitSlot = prevImplicitSlot;
|
985
|
+
JSCompiler_inline_result = value
|
986
|
+
? "$L" + JSCompiler_inline_result.id.toString(16)
|
987
|
+
: serializeByValueID(JSCompiler_inline_result.id);
|
988
|
+
} else if (
|
989
|
+
((task.keyPath = prevKeyPath),
|
990
|
+
(task.implicitSlot = prevImplicitSlot),
|
991
|
+
value)
|
992
|
+
)
|
993
|
+
request.pendingChunks++,
|
994
|
+
(prevKeyPath = request.nextChunkId++),
|
995
|
+
(prevImplicitSlot = logRecoverableError(
|
996
|
+
request,
|
997
|
+
parentPropertyName
|
998
|
+
)),
|
999
|
+
emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
|
1000
|
+
(JSCompiler_inline_result = "$L" + prevKeyPath.toString(16));
|
1001
|
+
else throw parentPropertyName;
|
1002
|
+
}
|
1003
|
+
return JSCompiler_inline_result;
|
1730
1004
|
},
|
1731
1005
|
thenableState: null
|
1732
1006
|
};
|
1733
1007
|
abortSet.add(task);
|
1734
1008
|
return task;
|
1735
1009
|
}
|
1736
|
-
|
1737
1010
|
function serializeByValueID(id) {
|
1738
|
-
return
|
1739
|
-
}
|
1740
|
-
|
1741
|
-
function serializeLazyID(id) {
|
1742
|
-
return '$L' + id.toString(16);
|
1011
|
+
return "$" + id.toString(16);
|
1743
1012
|
}
|
1744
|
-
|
1745
|
-
function serializePromiseID(id) {
|
1746
|
-
return '$@' + id.toString(16);
|
1747
|
-
}
|
1748
|
-
|
1749
|
-
function serializeServerReferenceID(id) {
|
1750
|
-
return '$F' + id.toString(16);
|
1751
|
-
}
|
1752
|
-
|
1753
|
-
function serializeTemporaryReferenceID(id) {
|
1754
|
-
return '$T' + id;
|
1755
|
-
}
|
1756
|
-
|
1757
|
-
function serializeSymbolReference(name) {
|
1758
|
-
return '$S' + name;
|
1759
|
-
}
|
1760
|
-
|
1761
|
-
function serializeNumber(number) {
|
1762
|
-
if (Number.isFinite(number)) {
|
1763
|
-
if (number === 0 && 1 / number === -Infinity) {
|
1764
|
-
return '$-0';
|
1765
|
-
} else {
|
1766
|
-
return number;
|
1767
|
-
}
|
1768
|
-
} else {
|
1769
|
-
if (number === Infinity) {
|
1770
|
-
return '$Infinity';
|
1771
|
-
} else if (number === -Infinity) {
|
1772
|
-
return '$-Infinity';
|
1773
|
-
} else {
|
1774
|
-
return '$NaN';
|
1775
|
-
}
|
1776
|
-
}
|
1777
|
-
}
|
1778
|
-
|
1779
|
-
function serializeUndefined() {
|
1780
|
-
return '$undefined';
|
1781
|
-
}
|
1782
|
-
|
1783
|
-
function serializeDateFromDateJSON(dateJSON) {
|
1784
|
-
// JSON.stringify automatically calls Date.prototype.toJSON which calls toISOString.
|
1785
|
-
// We need only tack on a $D prefix.
|
1786
|
-
return '$D' + dateJSON;
|
1787
|
-
}
|
1788
|
-
|
1789
|
-
function serializeBigInt(n) {
|
1790
|
-
return '$n' + n.toString(10);
|
1791
|
-
}
|
1792
|
-
|
1793
|
-
function serializeRowHeader(tag, id) {
|
1794
|
-
return id.toString(16) + ':' + tag;
|
1795
|
-
}
|
1796
|
-
|
1797
1013
|
function encodeReferenceChunk(request, id, reference) {
|
1798
|
-
|
1799
|
-
|
1800
|
-
return
|
1801
|
-
}
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
return serializeByValueID(existingId);
|
1819
|
-
}
|
1820
|
-
|
1014
|
+
request = stringify(reference);
|
1015
|
+
id = id.toString(16) + ":" + request + "\n";
|
1016
|
+
return textEncoder.encode(id);
|
1017
|
+
}
|
1018
|
+
function serializeClientReference(
|
1019
|
+
request,
|
1020
|
+
parent,
|
1021
|
+
parentPropertyName,
|
1022
|
+
clientReference
|
1023
|
+
) {
|
1024
|
+
var clientReferenceKey = clientReference.$$async
|
1025
|
+
? clientReference.$$id + "#async"
|
1026
|
+
: clientReference.$$id,
|
1027
|
+
writtenClientReferences = request.writtenClientReferences,
|
1028
|
+
existingId = writtenClientReferences.get(clientReferenceKey);
|
1029
|
+
if (void 0 !== existingId)
|
1030
|
+
return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
|
1031
|
+
? "$L" + existingId.toString(16)
|
1032
|
+
: serializeByValueID(existingId);
|
1821
1033
|
try {
|
1822
|
-
|
1034
|
+
var config = request.bundlerConfig,
|
1035
|
+
modulePath = clientReference.$$id;
|
1036
|
+
existingId = "";
|
1037
|
+
var resolvedModuleData = config[modulePath];
|
1038
|
+
if (resolvedModuleData) existingId = resolvedModuleData.name;
|
1039
|
+
else {
|
1040
|
+
var idx = modulePath.lastIndexOf("#");
|
1041
|
+
-1 !== idx &&
|
1042
|
+
((existingId = modulePath.slice(idx + 1)),
|
1043
|
+
(resolvedModuleData = config[modulePath.slice(0, idx)]));
|
1044
|
+
if (!resolvedModuleData)
|
1045
|
+
throw Error(
|
1046
|
+
'Could not find the module "' +
|
1047
|
+
modulePath +
|
1048
|
+
'" in the React Client Manifest. This is probably a bug in the React Server Components bundler.'
|
1049
|
+
);
|
1050
|
+
}
|
1051
|
+
var JSCompiler_inline_result =
|
1052
|
+
!0 === clientReference.$$async
|
1053
|
+
? [resolvedModuleData.id, resolvedModuleData.chunks, existingId, 1]
|
1054
|
+
: [resolvedModuleData.id, resolvedModuleData.chunks, existingId];
|
1823
1055
|
request.pendingChunks++;
|
1824
|
-
|
1825
|
-
|
1056
|
+
var importId = request.nextChunkId++,
|
1057
|
+
json = stringify(JSCompiler_inline_result),
|
1058
|
+
row = importId.toString(16) + ":I" + json + "\n",
|
1059
|
+
processedChunk = textEncoder.encode(row);
|
1060
|
+
request.completedImportChunks.push(processedChunk);
|
1826
1061
|
writtenClientReferences.set(clientReferenceKey, importId);
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
// to that by a lazy reference instead of directly since React
|
1831
|
-
// knows how to deal with lazy values. This lets us suspend
|
1832
|
-
// on this component rather than its parent until the code has
|
1833
|
-
// loaded.
|
1834
|
-
return serializeLazyID(importId);
|
1835
|
-
}
|
1836
|
-
|
1837
|
-
return serializeByValueID(importId);
|
1062
|
+
return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
|
1063
|
+
? "$L" + importId.toString(16)
|
1064
|
+
: serializeByValueID(importId);
|
1838
1065
|
} catch (x) {
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1066
|
+
return (
|
1067
|
+
request.pendingChunks++,
|
1068
|
+
(parent = request.nextChunkId++),
|
1069
|
+
(parentPropertyName = logRecoverableError(request, x)),
|
1070
|
+
emitErrorChunk(request, parent, parentPropertyName),
|
1071
|
+
serializeByValueID(parent)
|
1072
|
+
);
|
1844
1073
|
}
|
1845
1074
|
}
|
1846
|
-
|
1847
1075
|
function outlineModel(request, value) {
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
const serverReferenceMetadata = {
|
1865
|
-
id: getServerReferenceId(request.bundlerConfig, serverReference),
|
1866
|
-
bound: bound ? Promise.resolve(bound) : null
|
1867
|
-
};
|
1868
|
-
const metadataId = outlineModel(request, serverReferenceMetadata);
|
1869
|
-
writtenServerReferences.set(serverReference, metadataId);
|
1870
|
-
return serializeServerReferenceID(metadataId);
|
1871
|
-
}
|
1872
|
-
|
1873
|
-
function serializeTemporaryReference(request, temporaryReference) {
|
1874
|
-
const id = resolveTemporaryReferenceID(temporaryReference);
|
1875
|
-
return serializeTemporaryReferenceID(id);
|
1876
|
-
}
|
1877
|
-
|
1878
|
-
function serializeLargeTextString(request, text) {
|
1879
|
-
request.pendingChunks++;
|
1880
|
-
const textId = request.nextChunkId++;
|
1881
|
-
emitTextChunk(request, textId, text);
|
1882
|
-
return serializeByValueID(textId);
|
1883
|
-
}
|
1884
|
-
|
1885
|
-
function serializeMap(request, map) {
|
1886
|
-
const entries = Array.from(map);
|
1887
|
-
|
1888
|
-
for (let i = 0; i < entries.length; i++) {
|
1889
|
-
const key = entries[i][0];
|
1890
|
-
|
1891
|
-
if (typeof key === 'object' && key !== null) {
|
1892
|
-
const writtenObjects = request.writtenObjects;
|
1893
|
-
const existingId = writtenObjects.get(key);
|
1894
|
-
|
1895
|
-
if (existingId === undefined) {
|
1896
|
-
writtenObjects.set(key, SEEN_BUT_NOT_YET_OUTLINED);
|
1897
|
-
}
|
1898
|
-
}
|
1899
|
-
}
|
1900
|
-
|
1901
|
-
const id = outlineModel(request, entries);
|
1902
|
-
return '$Q' + id.toString(16);
|
1903
|
-
}
|
1904
|
-
|
1905
|
-
function serializeFormData(request, formData) {
|
1906
|
-
const entries = Array.from(formData.entries());
|
1907
|
-
const id = outlineModel(request, entries);
|
1908
|
-
return '$K' + id.toString(16);
|
1909
|
-
}
|
1910
|
-
|
1911
|
-
function serializeSet(request, set) {
|
1912
|
-
const entries = Array.from(set);
|
1913
|
-
|
1914
|
-
for (let i = 0; i < entries.length; i++) {
|
1915
|
-
const key = entries[i];
|
1916
|
-
|
1917
|
-
if (typeof key === 'object' && key !== null) {
|
1918
|
-
const writtenObjects = request.writtenObjects;
|
1919
|
-
const existingId = writtenObjects.get(key);
|
1920
|
-
|
1921
|
-
if (existingId === undefined) {
|
1922
|
-
writtenObjects.set(key, SEEN_BUT_NOT_YET_OUTLINED);
|
1923
|
-
}
|
1924
|
-
}
|
1925
|
-
}
|
1926
|
-
|
1927
|
-
const id = outlineModel(request, entries);
|
1928
|
-
return '$W' + id.toString(16);
|
1929
|
-
}
|
1930
|
-
|
1931
|
-
function escapeStringValue(value) {
|
1932
|
-
if (value[0] === '$') {
|
1933
|
-
// We need to escape $ prefixed strings since we use those to encode
|
1934
|
-
// references to IDs and as special symbol values.
|
1935
|
-
return '$' + value;
|
1936
|
-
} else {
|
1937
|
-
return value;
|
1938
|
-
}
|
1939
|
-
}
|
1940
|
-
|
1941
|
-
let modelRoot = false;
|
1942
|
-
|
1943
|
-
function renderModel(request, task, parent, key, value) {
|
1944
|
-
const prevKeyPath = task.keyPath;
|
1945
|
-
const prevImplicitSlot = task.implicitSlot;
|
1946
|
-
|
1947
|
-
try {
|
1948
|
-
return renderModelDestructive(request, task, parent, key, value);
|
1949
|
-
} catch (thrownValue) {
|
1950
|
-
const x = thrownValue === SuspenseException ? // This is a special type of exception used for Suspense. For historical
|
1951
|
-
// reasons, the rest of the Suspense implementation expects the thrown
|
1952
|
-
// value to be a thenable, because before `use` existed that was the
|
1953
|
-
// (unstable) API for suspending. This implementation detail can change
|
1954
|
-
// later, once we deprecate the old API in favor of `use`.
|
1955
|
-
getSuspendedThenable() : thrownValue; // If the suspended/errored value was an element or lazy it can be reduced
|
1956
|
-
// to a lazy reference, so that it doesn't error the parent.
|
1957
|
-
|
1958
|
-
const model = task.model;
|
1959
|
-
const wasReactNode = typeof model === 'object' && model !== null && (model.$$typeof === REACT_ELEMENT_TYPE || model.$$typeof === REACT_LAZY_TYPE);
|
1960
|
-
|
1961
|
-
if (typeof x === 'object' && x !== null) {
|
1962
|
-
// $FlowFixMe[method-unbinding]
|
1963
|
-
if (typeof x.then === 'function') {
|
1964
|
-
// Something suspended, we'll need to create a new task and resolve it later.
|
1965
|
-
const newTask = createTask(request, task.model, task.keyPath, task.implicitSlot, request.abortableTasks);
|
1966
|
-
const ping = newTask.ping;
|
1967
|
-
x.then(ping, ping);
|
1968
|
-
newTask.thenableState = getThenableStateAfterSuspending(); // Restore the context. We assume that this will be restored by the inner
|
1969
|
-
// functions in case nothing throws so we don't use "finally" here.
|
1970
|
-
|
1971
|
-
task.keyPath = prevKeyPath;
|
1972
|
-
task.implicitSlot = prevImplicitSlot;
|
1973
|
-
|
1974
|
-
if (wasReactNode) {
|
1975
|
-
return serializeLazyID(newTask.id);
|
1976
|
-
}
|
1977
|
-
|
1978
|
-
return serializeByValueID(newTask.id);
|
1979
|
-
}
|
1980
|
-
} // Restore the context. We assume that this will be restored by the inner
|
1981
|
-
// functions in case nothing throws so we don't use "finally" here.
|
1982
|
-
|
1983
|
-
|
1984
|
-
task.keyPath = prevKeyPath;
|
1985
|
-
task.implicitSlot = prevImplicitSlot;
|
1986
|
-
|
1987
|
-
if (wasReactNode) {
|
1988
|
-
// Something errored. We'll still send everything we have up until this point.
|
1989
|
-
// We'll replace this element with a lazy reference that throws on the client
|
1990
|
-
// once it gets rendered.
|
1991
|
-
request.pendingChunks++;
|
1992
|
-
const errorId = request.nextChunkId++;
|
1993
|
-
const digest = logRecoverableError(request, x);
|
1994
|
-
emitErrorChunk(request, errorId, digest);
|
1995
|
-
return serializeLazyID(errorId);
|
1996
|
-
} // Something errored but it was not in a React Node. There's no need to serialize
|
1997
|
-
// it by value because it'll just error the whole parent row anyway so we can
|
1998
|
-
// just stop any siblings and error the whole parent row.
|
1999
|
-
|
2000
|
-
|
2001
|
-
throw x;
|
2002
|
-
}
|
2003
|
-
}
|
2004
|
-
|
2005
|
-
function renderModelDestructive(request, task, parent, parentPropertyName, value) {
|
2006
|
-
// Set the currently rendering model
|
2007
|
-
task.model = value; // Special Symbol, that's very common.
|
2008
|
-
|
2009
|
-
if (value === REACT_ELEMENT_TYPE) {
|
2010
|
-
return '$';
|
2011
|
-
}
|
2012
|
-
|
2013
|
-
if (value === null) {
|
2014
|
-
return null;
|
2015
|
-
}
|
2016
|
-
|
2017
|
-
if (typeof value === 'object') {
|
1076
|
+
value = createTask(request, value, null, !1, request.abortableTasks);
|
1077
|
+
retryTask(request, value);
|
1078
|
+
return value.id;
|
1079
|
+
}
|
1080
|
+
var modelRoot = !1;
|
1081
|
+
function renderModelDestructive(
|
1082
|
+
request,
|
1083
|
+
task,
|
1084
|
+
parent,
|
1085
|
+
parentPropertyName,
|
1086
|
+
value
|
1087
|
+
) {
|
1088
|
+
task.model = value;
|
1089
|
+
if (value === REACT_ELEMENT_TYPE) return "$";
|
1090
|
+
if (null === value) return null;
|
1091
|
+
if ("object" === typeof value) {
|
2018
1092
|
switch (value.$$typeof) {
|
2019
1093
|
case REACT_ELEMENT_TYPE:
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
|
2025
|
-
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2041
|
-
// case we can refer to it synchronously and only make it lazy otherwise.
|
2042
|
-
// We currently don't have a data structure that lets us see that though.
|
2043
|
-
return serializeByValueID(existingId);
|
2044
|
-
}
|
2045
|
-
} else {
|
2046
|
-
// This is the first time we've seen this object. We may never see it again
|
2047
|
-
// so we'll inline it. Mark it as seen. If we see it again, we'll outline.
|
2048
|
-
writtenObjects.set(value, SEEN_BUT_NOT_YET_OUTLINED); // The element's props are marked as "never outlined" so that they are inlined into
|
2049
|
-
// the same row as the element itself.
|
2050
|
-
|
2051
|
-
writtenObjects.set(value.props, NEVER_OUTLINED);
|
2052
|
-
}
|
2053
|
-
|
2054
|
-
const element = value;
|
2055
|
-
|
2056
|
-
const props = element.props;
|
2057
|
-
let ref;
|
2058
|
-
|
2059
|
-
{
|
2060
|
-
// TODO: This is a temporary, intermediate step. Once the feature
|
2061
|
-
// flag is removed, we should get the ref off the props object right
|
2062
|
-
// before using it.
|
2063
|
-
const refProp = props.ref;
|
2064
|
-
ref = refProp !== undefined ? refProp : null;
|
2065
|
-
} // Attempt to render the Server Component.
|
2066
|
-
|
2067
|
-
|
2068
|
-
return renderElement(request, task, element.type, // $FlowFixMe[incompatible-call] the key of an element is null | string
|
2069
|
-
element.key, ref, props);
|
2070
|
-
}
|
2071
|
-
|
1094
|
+
parent = request.writtenObjects;
|
1095
|
+
parentPropertyName = parent.get(value);
|
1096
|
+
if (void 0 !== parentPropertyName) {
|
1097
|
+
if (null === task.keyPath && !task.implicitSlot)
|
1098
|
+
if (modelRoot === value) modelRoot = null;
|
1099
|
+
else
|
1100
|
+
return -1 === parentPropertyName
|
1101
|
+
? ((request = outlineModel(request, value)),
|
1102
|
+
serializeByValueID(request))
|
1103
|
+
: serializeByValueID(parentPropertyName);
|
1104
|
+
} else parent.set(value, -1), parent.set(value.props, -2);
|
1105
|
+
parent = value.props;
|
1106
|
+
parentPropertyName = parent.ref;
|
1107
|
+
return renderElement(
|
1108
|
+
request,
|
1109
|
+
task,
|
1110
|
+
value.type,
|
1111
|
+
value.key,
|
1112
|
+
void 0 !== parentPropertyName ? parentPropertyName : null,
|
1113
|
+
parent
|
1114
|
+
);
|
2072
1115
|
case REACT_LAZY_TYPE:
|
2073
|
-
|
2074
|
-
|
2075
|
-
|
2076
|
-
|
2077
|
-
|
2078
|
-
|
2079
|
-
|
2080
|
-
|
2081
|
-
|
2082
|
-
|
2083
|
-
|
2084
|
-
|
2085
|
-
|
2086
|
-
|
2087
|
-
|
2088
|
-
|
2089
|
-
|
2090
|
-
|
2091
|
-
|
2092
|
-
|
2093
|
-
|
2094
|
-
|
2095
|
-
if ((task.keyPath !== null || task.implicitSlot)) {
|
2096
|
-
// If we're in some kind of context we can't reuse the result of this render or
|
2097
|
-
// previous renders of this element. We only reuse Promises if they're not wrapped
|
2098
|
-
// by another Server Component.
|
2099
|
-
const promiseId = serializeThenable(request, task, value);
|
2100
|
-
return serializePromiseID(promiseId);
|
2101
|
-
} else if (modelRoot === value) {
|
2102
|
-
// This is the ID we're currently emitting so we need to write it
|
2103
|
-
// once but if we discover it again, we refer to it by id.
|
2104
|
-
modelRoot = null;
|
2105
|
-
} else {
|
2106
|
-
// We've seen this promise before, so we can just refer to the same result.
|
2107
|
-
return serializePromiseID(existingId);
|
2108
|
-
}
|
2109
|
-
} // We assume that any object with a .then property is a "Thenable" type,
|
2110
|
-
// or a Promise type. Either of which can be represented by a Promise.
|
2111
|
-
|
2112
|
-
|
2113
|
-
const promiseId = serializeThenable(request, task, value);
|
2114
|
-
writtenObjects.set(value, promiseId);
|
2115
|
-
return serializePromiseID(promiseId);
|
2116
|
-
}
|
2117
|
-
|
2118
|
-
if (existingId !== undefined) {
|
2119
|
-
if (modelRoot === value) {
|
2120
|
-
// This is the ID we're currently emitting so we need to write it
|
2121
|
-
// once but if we discover it again, we refer to it by id.
|
2122
|
-
modelRoot = null;
|
2123
|
-
} else if (existingId === SEEN_BUT_NOT_YET_OUTLINED) {
|
2124
|
-
const newId = outlineModel(request, value);
|
2125
|
-
return serializeByValueID(newId);
|
2126
|
-
} else if (existingId !== NEVER_OUTLINED) {
|
2127
|
-
// We've already emitted this as an outlined object, so we can
|
2128
|
-
// just refer to that by its existing ID.
|
2129
|
-
return serializeByValueID(existingId);
|
1116
|
+
return (
|
1117
|
+
(task.thenableState = null),
|
1118
|
+
(parent = value._init),
|
1119
|
+
(value = parent(value._payload)),
|
1120
|
+
renderModelDestructive(request, task, emptyRoot, "", value)
|
1121
|
+
);
|
1122
|
+
}
|
1123
|
+
if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
|
1124
|
+
return serializeClientReference(
|
1125
|
+
request,
|
1126
|
+
parent,
|
1127
|
+
parentPropertyName,
|
1128
|
+
value
|
1129
|
+
);
|
1130
|
+
parent = request.writtenObjects;
|
1131
|
+
parentPropertyName = parent.get(value);
|
1132
|
+
if ("function" === typeof value.then) {
|
1133
|
+
if (void 0 !== parentPropertyName) {
|
1134
|
+
if (null !== task.keyPath || task.implicitSlot)
|
1135
|
+
return "$@" + serializeThenable(request, task, value).toString(16);
|
1136
|
+
if (modelRoot === value) modelRoot = null;
|
1137
|
+
else return "$@" + parentPropertyName.toString(16);
|
2130
1138
|
}
|
2131
|
-
|
2132
|
-
|
2133
|
-
|
2134
|
-
|
2135
|
-
|
2136
|
-
|
2137
|
-
|
2138
|
-
|
2139
|
-
|
2140
|
-
|
1139
|
+
request = serializeThenable(request, task, value);
|
1140
|
+
parent.set(value, request);
|
1141
|
+
return "$@" + request.toString(16);
|
1142
|
+
}
|
1143
|
+
if (void 0 !== parentPropertyName)
|
1144
|
+
if (modelRoot === value) modelRoot = null;
|
1145
|
+
else {
|
1146
|
+
if (-1 === parentPropertyName)
|
1147
|
+
return (
|
1148
|
+
(request = outlineModel(request, value)),
|
1149
|
+
serializeByValueID(request)
|
1150
|
+
);
|
1151
|
+
if (-2 !== parentPropertyName)
|
1152
|
+
return serializeByValueID(parentPropertyName);
|
1153
|
+
}
|
1154
|
+
else parent.set(value, -1);
|
1155
|
+
if (isArrayImpl(value)) return renderFragment(request, task, value);
|
2141
1156
|
if (value instanceof Map) {
|
2142
|
-
|
1157
|
+
value = Array.from(value);
|
1158
|
+
for (task = 0; task < value.length; task++)
|
1159
|
+
(parent = value[task][0]),
|
1160
|
+
"object" === typeof parent &&
|
1161
|
+
null !== parent &&
|
1162
|
+
((parentPropertyName = request.writtenObjects),
|
1163
|
+
void 0 === parentPropertyName.get(parent) &&
|
1164
|
+
parentPropertyName.set(parent, -1));
|
1165
|
+
return "$Q" + outlineModel(request, value).toString(16);
|
2143
1166
|
}
|
2144
|
-
|
2145
1167
|
if (value instanceof Set) {
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
if (
|
2157
|
-
return
|
2158
|
-
|
2159
|
-
|
2160
|
-
|
2161
|
-
|
2162
|
-
|
2163
|
-
|
2164
|
-
|
2165
|
-
|
2166
|
-
|
2167
|
-
|
1168
|
+
value = Array.from(value);
|
1169
|
+
for (task = 0; task < value.length; task++)
|
1170
|
+
(parent = value[task]),
|
1171
|
+
"object" === typeof parent &&
|
1172
|
+
null !== parent &&
|
1173
|
+
((parentPropertyName = request.writtenObjects),
|
1174
|
+
void 0 === parentPropertyName.get(parent) &&
|
1175
|
+
parentPropertyName.set(parent, -1));
|
1176
|
+
return "$W" + outlineModel(request, value).toString(16);
|
1177
|
+
}
|
1178
|
+
if ("function" === typeof FormData && value instanceof FormData)
|
1179
|
+
return (
|
1180
|
+
(value = Array.from(value.entries())),
|
1181
|
+
"$K" + outlineModel(request, value).toString(16)
|
1182
|
+
);
|
1183
|
+
if ((parent = getIteratorFn(value)))
|
1184
|
+
return (
|
1185
|
+
(parent = parent.call(value)),
|
1186
|
+
parent === value
|
1187
|
+
? "$i" + outlineModel(request, Array.from(parent)).toString(16)
|
1188
|
+
: renderFragment(request, task, Array.from(parent))
|
1189
|
+
);
|
1190
|
+
request = getPrototypeOf(value);
|
1191
|
+
if (
|
1192
|
+
request !== ObjectPrototype &&
|
1193
|
+
(null === request || null !== getPrototypeOf(request))
|
1194
|
+
)
|
1195
|
+
throw Error(
|
1196
|
+
"Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported."
|
1197
|
+
);
|
2168
1198
|
return value;
|
2169
1199
|
}
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2179
|
-
|
2180
|
-
|
2181
|
-
|
2182
|
-
|
2183
|
-
|
2184
|
-
|
2185
|
-
|
2186
|
-
|
2187
|
-
|
2188
|
-
|
2189
|
-
|
2190
|
-
|
2191
|
-
|
2192
|
-
|
2193
|
-
|
2194
|
-
|
2195
|
-
|
2196
|
-
|
2197
|
-
|
2198
|
-
if (typeof value
|
2199
|
-
|
2200
|
-
|
2201
|
-
|
2202
|
-
|
2203
|
-
|
2204
|
-
|
2205
|
-
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2209
|
-
|
2210
|
-
|
2211
|
-
|
2212
|
-
|
2213
|
-
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2219
|
-
|
2220
|
-
|
2221
|
-
|
2222
|
-
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2226
|
-
|
2227
|
-
|
2228
|
-
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2232
|
-
|
2233
|
-
|
2234
|
-
|
2235
|
-
|
2236
|
-
|
2237
|
-
if (
|
2238
|
-
|
2239
|
-
|
2240
|
-
|
2241
|
-
|
1200
|
+
if ("string" === typeof value) {
|
1201
|
+
if (
|
1202
|
+
"Z" === value[value.length - 1] &&
|
1203
|
+
parent[parentPropertyName] instanceof Date
|
1204
|
+
)
|
1205
|
+
return "$D" + value;
|
1206
|
+
if (1024 <= value.length)
|
1207
|
+
return (
|
1208
|
+
request.pendingChunks++,
|
1209
|
+
(task = request.nextChunkId++),
|
1210
|
+
emitTextChunk(request, task, value),
|
1211
|
+
serializeByValueID(task)
|
1212
|
+
);
|
1213
|
+
request = "$" === value[0] ? "$" + value : value;
|
1214
|
+
return request;
|
1215
|
+
}
|
1216
|
+
if ("boolean" === typeof value) return value;
|
1217
|
+
if ("number" === typeof value)
|
1218
|
+
return Number.isFinite(value)
|
1219
|
+
? 0 === value && -Infinity === 1 / value
|
1220
|
+
? "$-0"
|
1221
|
+
: value
|
1222
|
+
: Infinity === value
|
1223
|
+
? "$Infinity"
|
1224
|
+
: -Infinity === value
|
1225
|
+
? "$-Infinity"
|
1226
|
+
: "$NaN";
|
1227
|
+
if ("undefined" === typeof value) return "$undefined";
|
1228
|
+
if ("function" === typeof value) {
|
1229
|
+
if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
|
1230
|
+
return serializeClientReference(
|
1231
|
+
request,
|
1232
|
+
parent,
|
1233
|
+
parentPropertyName,
|
1234
|
+
value
|
1235
|
+
);
|
1236
|
+
if (value.$$typeof === SERVER_REFERENCE_TAG)
|
1237
|
+
return (
|
1238
|
+
(task = request.writtenServerReferences),
|
1239
|
+
(parent = task.get(value)),
|
1240
|
+
void 0 !== parent
|
1241
|
+
? (request = "$F" + parent.toString(16))
|
1242
|
+
: ((parent = value.$$bound),
|
1243
|
+
(parent = {
|
1244
|
+
id: value.$$id,
|
1245
|
+
bound: parent ? Promise.resolve(parent) : null
|
1246
|
+
}),
|
1247
|
+
(request = outlineModel(request, parent)),
|
1248
|
+
task.set(value, request),
|
1249
|
+
(request = "$F" + request.toString(16))),
|
1250
|
+
request
|
1251
|
+
);
|
1252
|
+
if (value.$$typeof === TEMPORARY_REFERENCE_TAG) return "$T" + value.$$id;
|
1253
|
+
if (/^on[A-Z]/.test(parentPropertyName))
|
1254
|
+
throw Error(
|
1255
|
+
"Event handlers cannot be passed to Client Component props." +
|
1256
|
+
describeObjectForErrorMessage(parent, parentPropertyName) +
|
1257
|
+
"\nIf you need interactivity, consider converting part of this to a Client Component."
|
1258
|
+
);
|
1259
|
+
throw Error(
|
1260
|
+
'Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.' +
|
1261
|
+
describeObjectForErrorMessage(parent, parentPropertyName)
|
1262
|
+
);
|
1263
|
+
}
|
1264
|
+
if ("symbol" === typeof value) {
|
1265
|
+
task = request.writtenSymbols;
|
1266
|
+
var existingId$10 = task.get(value);
|
1267
|
+
if (void 0 !== existingId$10) return serializeByValueID(existingId$10);
|
1268
|
+
existingId$10 = value.description;
|
1269
|
+
if (Symbol.for(existingId$10) !== value)
|
1270
|
+
throw Error(
|
1271
|
+
"Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" +
|
1272
|
+
(value.description + ") cannot be found among global symbols.") +
|
1273
|
+
describeObjectForErrorMessage(parent, parentPropertyName)
|
1274
|
+
);
|
2242
1275
|
request.pendingChunks++;
|
2243
|
-
|
2244
|
-
|
2245
|
-
|
2246
|
-
|
2247
|
-
|
2248
|
-
|
2249
|
-
|
2250
|
-
|
2251
|
-
return
|
2252
|
-
}
|
2253
|
-
|
2254
|
-
throw
|
2255
|
-
|
2256
|
-
|
2257
|
-
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2261
|
-
try {
|
2262
|
-
const onPostpone = request.onPostpone;
|
2263
|
-
|
2264
|
-
if (supportsRequestStorage) {
|
2265
|
-
// Exit the request context while running callbacks.
|
2266
|
-
requestStorage.run(undefined, onPostpone, reason);
|
2267
|
-
} else {
|
2268
|
-
onPostpone(reason);
|
2269
|
-
}
|
2270
|
-
} finally {
|
2271
|
-
currentRequest = prevRequest;
|
2272
|
-
}
|
1276
|
+
parent = request.nextChunkId++;
|
1277
|
+
parentPropertyName = encodeReferenceChunk(
|
1278
|
+
request,
|
1279
|
+
parent,
|
1280
|
+
"$S" + existingId$10
|
1281
|
+
);
|
1282
|
+
request.completedImportChunks.push(parentPropertyName);
|
1283
|
+
task.set(value, parent);
|
1284
|
+
return serializeByValueID(parent);
|
1285
|
+
}
|
1286
|
+
if ("bigint" === typeof value) return "$n" + value.toString(10);
|
1287
|
+
throw Error(
|
1288
|
+
"Type " +
|
1289
|
+
typeof value +
|
1290
|
+
" is not supported in Client Component props." +
|
1291
|
+
describeObjectForErrorMessage(parent, parentPropertyName)
|
1292
|
+
);
|
2273
1293
|
}
|
2274
|
-
|
2275
1294
|
function logRecoverableError(request, error) {
|
2276
|
-
|
1295
|
+
var prevRequest = currentRequest;
|
2277
1296
|
currentRequest = null;
|
2278
|
-
let errorDigest;
|
2279
|
-
|
2280
1297
|
try {
|
2281
|
-
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
errorDigest = requestStorage.run(undefined, onError, error);
|
2286
|
-
} else {
|
2287
|
-
errorDigest = onError(error);
|
2288
|
-
}
|
1298
|
+
var onError = request.onError;
|
1299
|
+
var errorDigest = supportsRequestStorage
|
1300
|
+
? requestStorage.run(void 0, onError, error)
|
1301
|
+
: onError(error);
|
2289
1302
|
} finally {
|
2290
1303
|
currentRequest = prevRequest;
|
2291
1304
|
}
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2295
|
-
|
2296
|
-
|
2297
|
-
|
2298
|
-
return errorDigest ||
|
1305
|
+
if (null != errorDigest && "string" !== typeof errorDigest)
|
1306
|
+
throw Error(
|
1307
|
+
'onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "' +
|
1308
|
+
typeof errorDigest +
|
1309
|
+
'" instead'
|
1310
|
+
);
|
1311
|
+
return errorDigest || "";
|
2299
1312
|
}
|
2300
|
-
|
2301
1313
|
function fatalError(request, error) {
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
request.status = CLOSED;
|
2306
|
-
closeWithError(request.destination, error);
|
2307
|
-
} else {
|
2308
|
-
request.status = CLOSING;
|
2309
|
-
request.fatalError = error;
|
2310
|
-
}
|
2311
|
-
}
|
2312
|
-
|
2313
|
-
function emitPostponeChunk(request, id, postponeInstance) {
|
2314
|
-
let row;
|
2315
|
-
|
2316
|
-
{
|
2317
|
-
// No reason included in prod.
|
2318
|
-
row = serializeRowHeader('P', id) + '\n';
|
2319
|
-
}
|
2320
|
-
|
2321
|
-
const processedChunk = stringToChunk(row);
|
2322
|
-
request.completedErrorChunks.push(processedChunk);
|
2323
|
-
}
|
2324
|
-
|
2325
|
-
function emitErrorChunk(request, id, digest, error) {
|
2326
|
-
let errorInfo;
|
2327
|
-
|
2328
|
-
{
|
2329
|
-
errorInfo = {
|
2330
|
-
digest
|
2331
|
-
};
|
2332
|
-
}
|
2333
|
-
|
2334
|
-
const row = serializeRowHeader('E', id) + stringify(errorInfo) + '\n';
|
2335
|
-
const processedChunk = stringToChunk(row);
|
2336
|
-
request.completedErrorChunks.push(processedChunk);
|
2337
|
-
}
|
2338
|
-
|
2339
|
-
function emitImportChunk(request, id, clientReferenceMetadata) {
|
2340
|
-
// $FlowFixMe[incompatible-type] stringify can return null
|
2341
|
-
const json = stringify(clientReferenceMetadata);
|
2342
|
-
const row = serializeRowHeader('I', id) + json + '\n';
|
2343
|
-
const processedChunk = stringToChunk(row);
|
2344
|
-
request.completedImportChunks.push(processedChunk);
|
2345
|
-
}
|
2346
|
-
|
2347
|
-
function emitHintChunk(request, code, model) {
|
2348
|
-
const json = stringify(model);
|
2349
|
-
const id = request.nextChunkId++;
|
2350
|
-
const row = serializeRowHeader('H' + code, id) + json + '\n';
|
2351
|
-
const processedChunk = stringToChunk(row);
|
2352
|
-
request.completedHintChunks.push(processedChunk);
|
1314
|
+
null !== request.destination
|
1315
|
+
? ((request.status = 2), closeWithError(request.destination, error))
|
1316
|
+
: ((request.status = 1), (request.fatalError = error));
|
2353
1317
|
}
|
2354
|
-
|
2355
|
-
|
2356
|
-
|
2357
|
-
|
2358
|
-
request.
|
1318
|
+
function emitErrorChunk(request, id, digest) {
|
1319
|
+
digest = { digest: digest };
|
1320
|
+
id = id.toString(16) + ":E" + stringify(digest) + "\n";
|
1321
|
+
id = textEncoder.encode(id);
|
1322
|
+
request.completedErrorChunks.push(id);
|
2359
1323
|
}
|
2360
|
-
|
2361
1324
|
function emitModelChunk(request, id, json) {
|
2362
|
-
|
2363
|
-
|
2364
|
-
request.completedRegularChunks.push(
|
1325
|
+
id = id.toString(16) + ":" + json + "\n";
|
1326
|
+
id = textEncoder.encode(id);
|
1327
|
+
request.completedRegularChunks.push(id);
|
2365
1328
|
}
|
2366
|
-
|
2367
1329
|
function emitTextChunk(request, id, text) {
|
2368
|
-
request.pendingChunks++;
|
2369
|
-
|
2370
|
-
|
2371
|
-
|
2372
|
-
|
2373
|
-
|
2374
|
-
request.completedRegularChunks.push(headerChunk, textChunk);
|
2375
|
-
}
|
2376
|
-
|
2377
|
-
function emitChunk(request, task, value) {
|
2378
|
-
const id = task.id; // For certain types we have special types, we typically outlined them but
|
2379
|
-
// we can emit them directly for this row instead of through an indirection.
|
2380
|
-
|
2381
|
-
if (typeof value === 'string') {
|
2382
|
-
|
2383
|
-
emitTextChunk(request, id, value);
|
2384
|
-
return;
|
2385
|
-
}
|
2386
|
-
// $FlowFixMe[incompatible-type] stringify can return null for undefined but we never do
|
2387
|
-
|
2388
|
-
|
2389
|
-
const json = stringify(value, task.toJSON);
|
2390
|
-
emitModelChunk(request, task.id, json);
|
1330
|
+
request.pendingChunks++;
|
1331
|
+
text = textEncoder.encode(text);
|
1332
|
+
var binaryLength = text.byteLength;
|
1333
|
+
id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
|
1334
|
+
id = textEncoder.encode(id);
|
1335
|
+
request.completedRegularChunks.push(id, text);
|
2391
1336
|
}
|
2392
|
-
|
2393
|
-
const emptyRoot = {};
|
2394
|
-
|
1337
|
+
var emptyRoot = {};
|
2395
1338
|
function retryTask(request, task) {
|
2396
|
-
if (task.status
|
2397
|
-
|
2398
|
-
|
2399
|
-
|
2400
|
-
|
2401
|
-
|
2402
|
-
|
2403
|
-
|
2404
|
-
|
2405
|
-
|
2406
|
-
|
2407
|
-
|
2408
|
-
|
2409
|
-
|
2410
|
-
|
2411
|
-
|
2412
|
-
|
2413
|
-
|
2414
|
-
|
2415
|
-
|
2416
|
-
|
2417
|
-
|
2418
|
-
|
2419
|
-
|
2420
|
-
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
2424
|
-
|
2425
|
-
|
2426
|
-
|
2427
|
-
|
2428
|
-
|
2429
|
-
|
2430
|
-
emitModelChunk(request, task.id, json);
|
2431
|
-
}
|
2432
|
-
|
2433
|
-
request.abortableTasks.delete(task);
|
2434
|
-
task.status = COMPLETED;
|
2435
|
-
} catch (thrownValue) {
|
2436
|
-
const x = thrownValue === SuspenseException ? // This is a special type of exception used for Suspense. For historical
|
2437
|
-
// reasons, the rest of the Suspense implementation expects the thrown
|
2438
|
-
// value to be a thenable, because before `use` existed that was the
|
2439
|
-
// (unstable) API for suspending. This implementation detail can change
|
2440
|
-
// later, once we deprecate the old API in favor of `use`.
|
2441
|
-
getSuspendedThenable() : thrownValue;
|
2442
|
-
|
2443
|
-
if (typeof x === 'object' && x !== null) {
|
2444
|
-
// $FlowFixMe[method-unbinding]
|
2445
|
-
if (typeof x.then === 'function') {
|
2446
|
-
// Something suspended again, let's pick it back up later.
|
2447
|
-
const ping = task.ping;
|
1339
|
+
if (0 === task.status)
|
1340
|
+
try {
|
1341
|
+
modelRoot = task.model;
|
1342
|
+
var resolvedModel = renderModelDestructive(
|
1343
|
+
request,
|
1344
|
+
task,
|
1345
|
+
emptyRoot,
|
1346
|
+
"",
|
1347
|
+
task.model
|
1348
|
+
);
|
1349
|
+
modelRoot = resolvedModel;
|
1350
|
+
task.keyPath = null;
|
1351
|
+
task.implicitSlot = !1;
|
1352
|
+
if ("object" === typeof resolvedModel && null !== resolvedModel) {
|
1353
|
+
var id = task.id;
|
1354
|
+
if ("string" === typeof resolvedModel)
|
1355
|
+
emitTextChunk(request, id, resolvedModel);
|
1356
|
+
else {
|
1357
|
+
var json = stringify(resolvedModel, task.toJSON);
|
1358
|
+
emitModelChunk(request, task.id, json);
|
1359
|
+
}
|
1360
|
+
} else {
|
1361
|
+
var json$jscomp$0 = stringify(resolvedModel);
|
1362
|
+
emitModelChunk(request, task.id, json$jscomp$0);
|
1363
|
+
}
|
1364
|
+
request.abortableTasks.delete(task);
|
1365
|
+
task.status = 1;
|
1366
|
+
} catch (thrownValue) {
|
1367
|
+
var x =
|
1368
|
+
thrownValue === SuspenseException
|
1369
|
+
? getSuspendedThenable()
|
1370
|
+
: thrownValue;
|
1371
|
+
if ("object" === typeof x && null !== x && "function" === typeof x.then) {
|
1372
|
+
var ping = task.ping;
|
2448
1373
|
x.then(ping, ping);
|
2449
1374
|
task.thenableState = getThenableStateAfterSuspending();
|
2450
|
-
|
1375
|
+
} else {
|
1376
|
+
request.abortableTasks.delete(task);
|
1377
|
+
task.status = 4;
|
1378
|
+
var digest = logRecoverableError(request, x);
|
1379
|
+
emitErrorChunk(request, task.id, digest);
|
2451
1380
|
}
|
1381
|
+
} finally {
|
2452
1382
|
}
|
2453
|
-
|
2454
|
-
request.abortableTasks.delete(task);
|
2455
|
-
task.status = ERRORED$1;
|
2456
|
-
const digest = logRecoverableError(request, x);
|
2457
|
-
emitErrorChunk(request, task.id, digest);
|
2458
|
-
} finally {
|
2459
|
-
}
|
2460
1383
|
}
|
2461
|
-
|
2462
1384
|
function performWork(request) {
|
2463
|
-
|
2464
|
-
|
2465
|
-
|
2466
|
-
currentRequest = request;
|
2467
|
-
prepareToUseHooksForRequest(request);
|
2468
|
-
|
1385
|
+
var prevDispatcher = ReactSharedInternalsServer.H;
|
1386
|
+
ReactSharedInternalsServer.H = HooksDispatcher;
|
1387
|
+
var prevRequest = currentRequest;
|
1388
|
+
currentRequest$1 = currentRequest = request;
|
2469
1389
|
try {
|
2470
|
-
|
1390
|
+
var pingedTasks = request.pingedTasks;
|
2471
1391
|
request.pingedTasks = [];
|
2472
|
-
|
2473
|
-
|
2474
|
-
|
2475
|
-
retryTask(request, task);
|
2476
|
-
}
|
2477
|
-
|
2478
|
-
if (request.destination !== null) {
|
1392
|
+
for (var i = 0; i < pingedTasks.length; i++)
|
1393
|
+
retryTask(request, pingedTasks[i]);
|
1394
|
+
null !== request.destination &&
|
2479
1395
|
flushCompletedChunks(request, request.destination);
|
2480
|
-
}
|
2481
1396
|
} catch (error) {
|
2482
|
-
logRecoverableError(request, error);
|
2483
|
-
fatalError(request, error);
|
1397
|
+
logRecoverableError(request, error), fatalError(request, error);
|
2484
1398
|
} finally {
|
2485
|
-
|
2486
|
-
|
2487
|
-
|
1399
|
+
(ReactSharedInternalsServer.H = prevDispatcher),
|
1400
|
+
(currentRequest$1 = null),
|
1401
|
+
(currentRequest = prevRequest);
|
2488
1402
|
}
|
2489
1403
|
}
|
2490
|
-
|
2491
|
-
function abortTask(task, request, errorId) {
|
2492
|
-
task.status = ABORTED; // Instead of emitting an error per task.id, we emit a model that only
|
2493
|
-
// has a single value referencing the error.
|
2494
|
-
|
2495
|
-
const ref = serializeByValueID(errorId);
|
2496
|
-
const processedChunk = encodeReferenceChunk(request, task.id, ref);
|
2497
|
-
request.completedErrorChunks.push(processedChunk);
|
2498
|
-
}
|
2499
|
-
|
2500
1404
|
function flushCompletedChunks(request, destination) {
|
2501
|
-
|
2502
|
-
|
1405
|
+
currentView = new Uint8Array(2048);
|
1406
|
+
writtenBytes = 0;
|
2503
1407
|
try {
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2517
|
-
|
2518
|
-
|
2519
|
-
|
2520
|
-
i
|
2521
|
-
|
2522
|
-
for (; i <
|
2523
|
-
|
2524
|
-
const keepWriting = writeChunkAndReturn(destination, chunk);
|
2525
|
-
|
2526
|
-
if (!keepWriting) ;
|
2527
|
-
}
|
2528
|
-
|
2529
|
-
hintChunks.splice(0, i); // Next comes model data.
|
2530
|
-
|
2531
|
-
const regularChunks = request.completedRegularChunks;
|
2532
|
-
i = 0;
|
2533
|
-
|
2534
|
-
for (; i < regularChunks.length; i++) {
|
2535
|
-
request.pendingChunks--;
|
2536
|
-
const chunk = regularChunks[i];
|
2537
|
-
const keepWriting = writeChunkAndReturn(destination, chunk);
|
2538
|
-
|
2539
|
-
if (!keepWriting) ;
|
2540
|
-
}
|
2541
|
-
|
2542
|
-
regularChunks.splice(0, i); // Finally, errors are sent. The idea is that it's ok to delay
|
2543
|
-
// any error messages and prioritize display of other parts of
|
2544
|
-
// the page.
|
2545
|
-
|
2546
|
-
const errorChunks = request.completedErrorChunks;
|
2547
|
-
i = 0;
|
2548
|
-
|
2549
|
-
for (; i < errorChunks.length; i++) {
|
2550
|
-
request.pendingChunks--;
|
2551
|
-
const chunk = errorChunks[i];
|
2552
|
-
const keepWriting = writeChunkAndReturn(destination, chunk);
|
2553
|
-
|
2554
|
-
if (!keepWriting) ;
|
2555
|
-
}
|
2556
|
-
|
1408
|
+
for (
|
1409
|
+
var importsChunks = request.completedImportChunks, i = 0;
|
1410
|
+
i < importsChunks.length;
|
1411
|
+
i++
|
1412
|
+
)
|
1413
|
+
request.pendingChunks--,
|
1414
|
+
writeChunkAndReturn(destination, importsChunks[i]);
|
1415
|
+
importsChunks.splice(0, i);
|
1416
|
+
var hintChunks = request.completedHintChunks;
|
1417
|
+
for (i = 0; i < hintChunks.length; i++)
|
1418
|
+
writeChunkAndReturn(destination, hintChunks[i]);
|
1419
|
+
hintChunks.splice(0, i);
|
1420
|
+
var regularChunks = request.completedRegularChunks;
|
1421
|
+
for (i = 0; i < regularChunks.length; i++)
|
1422
|
+
request.pendingChunks--,
|
1423
|
+
writeChunkAndReturn(destination, regularChunks[i]);
|
1424
|
+
regularChunks.splice(0, i);
|
1425
|
+
var errorChunks = request.completedErrorChunks;
|
1426
|
+
for (i = 0; i < errorChunks.length; i++)
|
1427
|
+
request.pendingChunks--, writeChunkAndReturn(destination, errorChunks[i]);
|
2557
1428
|
errorChunks.splice(0, i);
|
2558
1429
|
} finally {
|
2559
|
-
request.flushScheduled =
|
2560
|
-
|
2561
|
-
|
2562
|
-
|
2563
|
-
|
2564
|
-
|
2565
|
-
|
2566
|
-
|
2567
|
-
}
|
1430
|
+
(request.flushScheduled = !1),
|
1431
|
+
currentView &&
|
1432
|
+
0 < writtenBytes &&
|
1433
|
+
(destination.enqueue(
|
1434
|
+
new Uint8Array(currentView.buffer, 0, writtenBytes)
|
1435
|
+
),
|
1436
|
+
(currentView = null),
|
1437
|
+
(writtenBytes = 0));
|
1438
|
+
}
|
1439
|
+
0 === request.pendingChunks &&
|
1440
|
+
(destination.close(), (request.destination = null));
|
2568
1441
|
}
|
2569
|
-
|
2570
1442
|
function startWork(request) {
|
2571
|
-
request.flushScheduled = request.destination
|
2572
|
-
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2577
|
-
|
1443
|
+
request.flushScheduled = null !== request.destination;
|
1444
|
+
supportsRequestStorage
|
1445
|
+
? setTimeout(function () {
|
1446
|
+
return requestStorage.run(request, performWork, request);
|
1447
|
+
}, 0)
|
1448
|
+
: setTimeout(function () {
|
1449
|
+
return performWork(request);
|
1450
|
+
}, 0);
|
2578
1451
|
}
|
2579
|
-
|
2580
1452
|
function enqueueFlush(request) {
|
2581
|
-
if (
|
2582
|
-
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2586
|
-
|
2587
|
-
|
2588
|
-
|
2589
|
-
|
2590
|
-
|
2591
|
-
function startFlowing(request, destination) {
|
2592
|
-
if (request.status === CLOSING) {
|
2593
|
-
request.status = CLOSED;
|
2594
|
-
closeWithError(destination, request.fatalError);
|
2595
|
-
return;
|
2596
|
-
}
|
2597
|
-
|
2598
|
-
if (request.status === CLOSED) {
|
2599
|
-
return;
|
2600
|
-
}
|
2601
|
-
|
2602
|
-
if (request.destination !== null) {
|
2603
|
-
// We're already flowing.
|
2604
|
-
return;
|
2605
|
-
}
|
2606
|
-
|
2607
|
-
request.destination = destination;
|
2608
|
-
|
2609
|
-
try {
|
2610
|
-
flushCompletedChunks(request, destination);
|
2611
|
-
} catch (error) {
|
2612
|
-
logRecoverableError(request, error);
|
2613
|
-
fatalError(request, error);
|
1453
|
+
if (
|
1454
|
+
!1 === request.flushScheduled &&
|
1455
|
+
0 === request.pingedTasks.length &&
|
1456
|
+
null !== request.destination
|
1457
|
+
) {
|
1458
|
+
var destination = request.destination;
|
1459
|
+
request.flushScheduled = !0;
|
1460
|
+
setTimeout(function () {
|
1461
|
+
return flushCompletedChunks(request, destination);
|
1462
|
+
}, 0);
|
2614
1463
|
}
|
2615
1464
|
}
|
2616
|
-
function stopFlowing(request) {
|
2617
|
-
request.destination = null;
|
2618
|
-
} // This is called to early terminate a request. It creates an error at all pending tasks.
|
2619
|
-
|
2620
1465
|
function abort(request, reason) {
|
2621
1466
|
try {
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
if (abortableTasks.size > 0) {
|
1467
|
+
var abortableTasks = request.abortableTasks;
|
1468
|
+
if (0 < abortableTasks.size) {
|
2626
1469
|
request.pendingChunks++;
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
1470
|
+
var errorId = request.nextChunkId++,
|
1471
|
+
error =
|
1472
|
+
void 0 === reason
|
1473
|
+
? Error("The render was aborted by the server without a reason.")
|
1474
|
+
: reason,
|
1475
|
+
digest = logRecoverableError(request, error);
|
1476
|
+
emitErrorChunk(request, errorId, digest, error);
|
1477
|
+
abortableTasks.forEach(function (task) {
|
1478
|
+
task.status = 3;
|
1479
|
+
var ref = serializeByValueID(errorId);
|
1480
|
+
task = encodeReferenceChunk(request, task.id, ref);
|
1481
|
+
request.completedErrorChunks.push(task);
|
1482
|
+
});
|
2636
1483
|
abortableTasks.clear();
|
2637
1484
|
}
|
2638
|
-
|
2639
|
-
|
2640
|
-
|
2641
|
-
|
2642
|
-
|
2643
|
-
|
2644
|
-
|
2645
|
-
|
2646
|
-
}
|
2647
|
-
|
2648
|
-
abortListeners.forEach(callback => callback(error));
|
1485
|
+
var abortListeners = request.abortListeners;
|
1486
|
+
if (0 < abortListeners.size) {
|
1487
|
+
var error$17 =
|
1488
|
+
void 0 === reason
|
1489
|
+
? Error("The render was aborted by the server without a reason.")
|
1490
|
+
: reason;
|
1491
|
+
abortListeners.forEach(function (callback) {
|
1492
|
+
return callback(error$17);
|
1493
|
+
});
|
2649
1494
|
abortListeners.clear();
|
2650
1495
|
}
|
2651
|
-
|
2652
|
-
if (request.destination !== null) {
|
1496
|
+
null !== request.destination &&
|
2653
1497
|
flushCompletedChunks(request, request.destination);
|
2654
|
-
|
2655
|
-
|
2656
|
-
logRecoverableError(request, error);
|
2657
|
-
fatalError(request, error);
|
1498
|
+
} catch (error$18) {
|
1499
|
+
logRecoverableError(request, error$18), fatalError(request, error$18);
|
2658
1500
|
}
|
2659
1501
|
}
|
2660
|
-
|
2661
|
-
// This is the parsed shape of the wire format which is why it is
|
2662
|
-
// condensed to only the essentialy information
|
2663
|
-
const ID = 0;
|
2664
|
-
const CHUNKS = 1;
|
2665
|
-
const NAME = 2; // export const ASYNC = 3;
|
2666
|
-
// This logic is correct because currently only include the 4th tuple member
|
2667
|
-
// when the module is async. If that changes we will need to actually assert
|
2668
|
-
// the value is true. We don't index into the 4th slot because flow does not
|
2669
|
-
// like the potential out of bounds access
|
2670
|
-
|
2671
|
-
function isAsyncImport(metadata) {
|
2672
|
-
return metadata.length === 4;
|
2673
|
-
}
|
2674
|
-
|
2675
1502
|
function resolveServerReference(bundlerConfig, id) {
|
2676
|
-
|
2677
|
-
|
2678
|
-
|
2679
|
-
|
2680
|
-
|
2681
|
-
|
2682
|
-
|
2683
|
-
|
2684
|
-
|
2685
|
-
|
2686
|
-
|
2687
|
-
|
2688
|
-
|
2689
|
-
|
2690
|
-
|
2691
|
-
resolvedModuleData = bundlerConfig[id.slice(0, idx)];
|
2692
|
-
}
|
2693
|
-
|
2694
|
-
if (!resolvedModuleData) {
|
2695
|
-
throw new Error('Could not find the module "' + id + '" in the React Server Manifest. ' + 'This is probably a bug in the React Server Components bundler.');
|
2696
|
-
}
|
2697
|
-
} // TODO: This needs to return async: true if it's an async module.
|
2698
|
-
|
2699
|
-
|
1503
|
+
var name = "",
|
1504
|
+
resolvedModuleData = bundlerConfig[id];
|
1505
|
+
if (resolvedModuleData) name = resolvedModuleData.name;
|
1506
|
+
else {
|
1507
|
+
var idx = id.lastIndexOf("#");
|
1508
|
+
-1 !== idx &&
|
1509
|
+
((name = id.slice(idx + 1)),
|
1510
|
+
(resolvedModuleData = bundlerConfig[id.slice(0, idx)]));
|
1511
|
+
if (!resolvedModuleData)
|
1512
|
+
throw Error(
|
1513
|
+
'Could not find the module "' +
|
1514
|
+
id +
|
1515
|
+
'" in the React Server Manifest. This is probably a bug in the React Server Components bundler.'
|
1516
|
+
);
|
1517
|
+
}
|
2700
1518
|
return [resolvedModuleData.id, resolvedModuleData.chunks, name];
|
2701
|
-
}
|
2702
|
-
|
2703
|
-
// in Webpack but unfortunately it's not exposed so we have to
|
2704
|
-
// replicate it in user space. null means that it has already loaded.
|
2705
|
-
|
2706
|
-
const chunkCache = new Map();
|
2707
|
-
|
1519
|
+
}
|
1520
|
+
var chunkCache = new Map();
|
2708
1521
|
function requireAsyncModule(id) {
|
2709
|
-
|
2710
|
-
|
2711
|
-
|
2712
|
-
if (typeof promise.then !== 'function') {
|
2713
|
-
// This wasn't a promise after all.
|
1522
|
+
var promise = __webpack_require__(id);
|
1523
|
+
if ("function" !== typeof promise.then || "fulfilled" === promise.status)
|
2714
1524
|
return null;
|
2715
|
-
|
2716
|
-
|
2717
|
-
|
2718
|
-
|
2719
|
-
|
2720
|
-
|
2721
|
-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2725
|
-
|
2726
|
-
rejectedThenable.status = 'rejected';
|
2727
|
-
rejectedThenable.reason = reason;
|
2728
|
-
});
|
2729
|
-
return promise;
|
2730
|
-
}
|
1525
|
+
promise.then(
|
1526
|
+
function (value) {
|
1527
|
+
promise.status = "fulfilled";
|
1528
|
+
promise.value = value;
|
1529
|
+
},
|
1530
|
+
function (reason) {
|
1531
|
+
promise.status = "rejected";
|
1532
|
+
promise.reason = reason;
|
1533
|
+
}
|
1534
|
+
);
|
1535
|
+
return promise;
|
2731
1536
|
}
|
2732
|
-
|
2733
|
-
function ignoreReject() {// We rely on rejected promises to be handled by another listener.
|
2734
|
-
} // Start preloading the modules since we might need them soon.
|
2735
|
-
// This function doesn't suspend.
|
2736
|
-
|
2737
|
-
|
1537
|
+
function ignoreReject() {}
|
2738
1538
|
function preloadModule(metadata) {
|
2739
|
-
|
2740
|
-
|
2741
|
-
let i = 0;
|
2742
|
-
|
2743
|
-
while (i < chunks.length) {
|
2744
|
-
const chunkId = chunks[i++];
|
1539
|
+
for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; ) {
|
1540
|
+
var chunkId = chunks[i++];
|
2745
1541
|
chunks[i++];
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2749
|
-
const thenable = loadChunk(chunkId);
|
2750
|
-
promises.push(thenable); // $FlowFixMe[method-unbinding]
|
2751
|
-
|
2752
|
-
const resolve = chunkCache.set.bind(chunkCache, chunkId, null);
|
2753
|
-
thenable.then(resolve, ignoreReject);
|
2754
|
-
chunkCache.set(chunkId, thenable);
|
2755
|
-
} else if (entry !== null) {
|
1542
|
+
var entry = chunkCache.get(chunkId);
|
1543
|
+
if (void 0 === entry) {
|
1544
|
+
entry = __webpack_chunk_load__(chunkId);
|
2756
1545
|
promises.push(entry);
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2761
|
-
|
2762
|
-
|
2763
|
-
|
2764
|
-
|
2765
|
-
|
2766
|
-
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
}
|
2773
|
-
} // Actually require the module or suspend if it's not yet ready.
|
2774
|
-
// Increase priority if necessary.
|
2775
|
-
|
1546
|
+
var resolve = chunkCache.set.bind(chunkCache, chunkId, null);
|
1547
|
+
entry.then(resolve, ignoreReject);
|
1548
|
+
chunkCache.set(chunkId, entry);
|
1549
|
+
} else null !== entry && promises.push(entry);
|
1550
|
+
}
|
1551
|
+
return 4 === metadata.length
|
1552
|
+
? 0 === promises.length
|
1553
|
+
? requireAsyncModule(metadata[0])
|
1554
|
+
: Promise.all(promises).then(function () {
|
1555
|
+
return requireAsyncModule(metadata[0]);
|
1556
|
+
})
|
1557
|
+
: 0 < promises.length
|
1558
|
+
? Promise.all(promises)
|
1559
|
+
: null;
|
1560
|
+
}
|
2776
1561
|
function requireModule(metadata) {
|
2777
|
-
|
2778
|
-
|
2779
|
-
|
2780
|
-
if (typeof moduleExports.then !== 'function') ; else if (moduleExports.status === 'fulfilled') {
|
2781
|
-
// This Promise should've been instrumented by preloadModule.
|
1562
|
+
var moduleExports = __webpack_require__(metadata[0]);
|
1563
|
+
if (4 === metadata.length && "function" === typeof moduleExports.then)
|
1564
|
+
if ("fulfilled" === moduleExports.status)
|
2782
1565
|
moduleExports = moduleExports.value;
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2786
|
-
|
2787
|
-
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2791
|
-
return moduleExports;
|
2792
|
-
}
|
2793
|
-
|
2794
|
-
if (metadata[NAME] === '') {
|
2795
|
-
// This is a placeholder value that represents that the caller accessed the
|
2796
|
-
// default property of this if it was an ESM interop module.
|
2797
|
-
return moduleExports.__esModule ? moduleExports.default : moduleExports;
|
2798
|
-
}
|
2799
|
-
|
2800
|
-
return moduleExports[metadata[NAME]];
|
1566
|
+
else throw moduleExports.reason;
|
1567
|
+
return "*" === metadata[2]
|
1568
|
+
? moduleExports
|
1569
|
+
: "" === metadata[2]
|
1570
|
+
? moduleExports.__esModule
|
1571
|
+
? moduleExports.default
|
1572
|
+
: moduleExports
|
1573
|
+
: moduleExports[metadata[2]];
|
2801
1574
|
}
|
2802
|
-
|
2803
|
-
function loadChunk(chunkId, filename) {
|
2804
|
-
return __webpack_chunk_load__(chunkId);
|
2805
|
-
}
|
2806
|
-
|
2807
|
-
// The server acts as a Client of itself when resolving Server References.
|
2808
|
-
const PENDING = 'pending';
|
2809
|
-
const BLOCKED = 'blocked';
|
2810
|
-
const RESOLVED_MODEL = 'resolved_model';
|
2811
|
-
const INITIALIZED = 'fulfilled';
|
2812
|
-
const ERRORED = 'rejected'; // $FlowFixMe[missing-this-annot]
|
2813
|
-
|
2814
1575
|
function Chunk(status, value, reason, response) {
|
2815
1576
|
this.status = status;
|
2816
1577
|
this.value = value;
|
2817
1578
|
this.reason = reason;
|
2818
1579
|
this._response = response;
|
2819
|
-
}
|
2820
|
-
|
2821
|
-
|
2822
|
-
Chunk.prototype = Object.create(Promise.prototype); // TODO: This doesn't return a new Promise chain unlike the real .then
|
2823
|
-
|
1580
|
+
}
|
1581
|
+
Chunk.prototype = Object.create(Promise.prototype);
|
2824
1582
|
Chunk.prototype.then = function (resolve, reject) {
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
} // The status might have changed after initialization.
|
2833
|
-
|
2834
|
-
|
2835
|
-
switch (chunk.status) {
|
2836
|
-
case INITIALIZED:
|
2837
|
-
resolve(chunk.value);
|
1583
|
+
switch (this.status) {
|
1584
|
+
case "resolved_model":
|
1585
|
+
initializeModelChunk(this);
|
1586
|
+
}
|
1587
|
+
switch (this.status) {
|
1588
|
+
case "fulfilled":
|
1589
|
+
resolve(this.value);
|
2838
1590
|
break;
|
2839
|
-
|
2840
|
-
case
|
2841
|
-
|
2842
|
-
|
2843
|
-
|
2844
|
-
|
2845
|
-
}
|
2846
|
-
|
2847
|
-
chunk.value.push(resolve);
|
2848
|
-
}
|
2849
|
-
|
2850
|
-
if (reject) {
|
2851
|
-
if (chunk.reason === null) {
|
2852
|
-
chunk.reason = [];
|
2853
|
-
}
|
2854
|
-
|
2855
|
-
chunk.reason.push(reject);
|
2856
|
-
}
|
2857
|
-
|
1591
|
+
case "pending":
|
1592
|
+
case "blocked":
|
1593
|
+
resolve &&
|
1594
|
+
(null === this.value && (this.value = []), this.value.push(resolve));
|
1595
|
+
reject &&
|
1596
|
+
(null === this.reason && (this.reason = []), this.reason.push(reject));
|
2858
1597
|
break;
|
2859
|
-
|
2860
1598
|
default:
|
2861
|
-
reject(
|
2862
|
-
break;
|
1599
|
+
reject(this.reason);
|
2863
1600
|
}
|
2864
1601
|
};
|
2865
|
-
|
2866
|
-
function getRoot(response) {
|
2867
|
-
const chunk = getChunk(response, 0);
|
2868
|
-
return chunk;
|
2869
|
-
}
|
2870
|
-
|
2871
|
-
function createPendingChunk(response) {
|
2872
|
-
// $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors
|
2873
|
-
return new Chunk(PENDING, null, null, response);
|
2874
|
-
}
|
2875
|
-
|
2876
1602
|
function wakeChunk(listeners, value) {
|
2877
|
-
for (
|
2878
|
-
const listener = listeners[i];
|
2879
|
-
listener(value);
|
2880
|
-
}
|
1603
|
+
for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value);
|
2881
1604
|
}
|
2882
|
-
|
2883
1605
|
function triggerErrorOnChunk(chunk, error) {
|
2884
|
-
if (chunk.status
|
2885
|
-
|
2886
|
-
|
2887
|
-
|
2888
|
-
|
2889
|
-
|
2890
|
-
|
2891
|
-
|
2892
|
-
|
2893
|
-
|
2894
|
-
|
2895
|
-
|
2896
|
-
|
2897
|
-
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
|
2902
|
-
|
2903
|
-
|
2904
|
-
|
2905
|
-
|
2906
|
-
}
|
2907
|
-
|
2908
|
-
function loadServerReference$1(response, id, bound, parentChunk, parentObject, key) {
|
2909
|
-
const serverReference = resolveServerReference(response._bundlerConfig, id); // We expect most servers to not really need this because you'd just have all
|
2910
|
-
// the relevant modules already loaded but it allows for lazy loading of code
|
2911
|
-
// if needed.
|
2912
|
-
|
2913
|
-
const preloadPromise = preloadModule(serverReference);
|
2914
|
-
let promise;
|
2915
|
-
|
2916
|
-
if (bound) {
|
2917
|
-
promise = Promise.all([bound, preloadPromise]).then((_ref) => {
|
2918
|
-
let args = _ref[0];
|
2919
|
-
return bindArgs$1(requireModule(serverReference), args);
|
1606
|
+
if ("pending" === chunk.status || "blocked" === chunk.status) {
|
1607
|
+
var listeners = chunk.reason;
|
1608
|
+
chunk.status = "rejected";
|
1609
|
+
chunk.reason = error;
|
1610
|
+
null !== listeners && wakeChunk(listeners, error);
|
1611
|
+
}
|
1612
|
+
}
|
1613
|
+
function loadServerReference$1(
|
1614
|
+
response,
|
1615
|
+
id,
|
1616
|
+
bound,
|
1617
|
+
parentChunk,
|
1618
|
+
parentObject,
|
1619
|
+
key
|
1620
|
+
) {
|
1621
|
+
var serverReference = resolveServerReference(response._bundlerConfig, id);
|
1622
|
+
response = preloadModule(serverReference);
|
1623
|
+
if (bound)
|
1624
|
+
bound = Promise.all([bound, response]).then(function (_ref) {
|
1625
|
+
_ref = _ref[0];
|
1626
|
+
var fn = requireModule(serverReference);
|
1627
|
+
return fn.bind.apply(fn, [null].concat(_ref));
|
2920
1628
|
});
|
2921
|
-
|
2922
|
-
|
2923
|
-
promise = Promise.resolve(preloadPromise).then(() => requireModule(serverReference));
|
2924
|
-
} else {
|
2925
|
-
// Synchronously available
|
1629
|
+
else if (response)
|
1630
|
+
bound = Promise.resolve(response).then(function () {
|
2926
1631
|
return requireModule(serverReference);
|
2927
|
-
}
|
2928
|
-
|
2929
|
-
|
2930
|
-
|
2931
|
-
|
1632
|
+
});
|
1633
|
+
else return requireModule(serverReference);
|
1634
|
+
bound.then(
|
1635
|
+
createModelResolver(parentChunk, parentObject, key),
|
1636
|
+
createModelReject(parentChunk)
|
1637
|
+
);
|
2932
1638
|
return null;
|
2933
1639
|
}
|
2934
|
-
|
2935
|
-
|
2936
|
-
let initializingChunkBlockedModel = null;
|
2937
|
-
|
1640
|
+
var initializingChunk = null,
|
1641
|
+
initializingChunkBlockedModel = null;
|
2938
1642
|
function initializeModelChunk(chunk) {
|
2939
|
-
|
2940
|
-
|
1643
|
+
var prevChunk = initializingChunk,
|
1644
|
+
prevBlocked = initializingChunkBlockedModel;
|
2941
1645
|
initializingChunk = chunk;
|
2942
1646
|
initializingChunkBlockedModel = null;
|
2943
|
-
|
2944
1647
|
try {
|
2945
|
-
|
2946
|
-
|
2947
|
-
|
2948
|
-
initializingChunkBlockedModel.value = value
|
2949
|
-
|
2950
|
-
|
2951
|
-
|
2952
|
-
|
2953
|
-
blockedChunk.value = null;
|
2954
|
-
blockedChunk.reason = null;
|
2955
|
-
} else {
|
2956
|
-
const initializedChunk = chunk;
|
2957
|
-
initializedChunk.status = INITIALIZED;
|
2958
|
-
initializedChunk.value = value;
|
2959
|
-
}
|
1648
|
+
var value = JSON.parse(chunk.value, chunk._response._fromJSON);
|
1649
|
+
null !== initializingChunkBlockedModel &&
|
1650
|
+
0 < initializingChunkBlockedModel.deps
|
1651
|
+
? ((initializingChunkBlockedModel.value = value),
|
1652
|
+
(chunk.status = "blocked"),
|
1653
|
+
(chunk.value = null),
|
1654
|
+
(chunk.reason = null))
|
1655
|
+
: ((chunk.status = "fulfilled"), (chunk.value = value));
|
2960
1656
|
} catch (error) {
|
2961
|
-
|
2962
|
-
erroredChunk.status = ERRORED;
|
2963
|
-
erroredChunk.reason = error;
|
1657
|
+
(chunk.status = "rejected"), (chunk.reason = error);
|
2964
1658
|
} finally {
|
2965
|
-
initializingChunk = prevChunk
|
2966
|
-
|
1659
|
+
(initializingChunk = prevChunk),
|
1660
|
+
(initializingChunkBlockedModel = prevBlocked);
|
2967
1661
|
}
|
2968
|
-
}
|
2969
|
-
// error upon read. Also notify any pending promises.
|
2970
|
-
|
2971
|
-
|
1662
|
+
}
|
2972
1663
|
function reportGlobalError(response, error) {
|
2973
|
-
response._chunks.forEach(chunk
|
2974
|
-
|
2975
|
-
// trigger an error but if it wasn't then we need to
|
2976
|
-
// because we won't be getting any new data to resolve it.
|
2977
|
-
if (chunk.status === PENDING) {
|
2978
|
-
triggerErrorOnChunk(chunk, error);
|
2979
|
-
}
|
1664
|
+
response._chunks.forEach(function (chunk) {
|
1665
|
+
"pending" === chunk.status && triggerErrorOnChunk(chunk, error);
|
2980
1666
|
});
|
2981
1667
|
}
|
2982
|
-
|
2983
1668
|
function getChunk(response, id) {
|
2984
|
-
|
2985
|
-
|
2986
|
-
|
2987
|
-
|
2988
|
-
|
2989
|
-
|
2990
|
-
|
2991
|
-
|
2992
|
-
|
2993
|
-
if (backingEntry != null) {
|
2994
|
-
// We assume that this is a string entry for now.
|
2995
|
-
chunk = createResolvedModelChunk(response, backingEntry);
|
2996
|
-
} else {
|
2997
|
-
// We're still waiting on this entry to stream in.
|
2998
|
-
chunk = createPendingChunk(response);
|
2999
|
-
}
|
3000
|
-
|
3001
|
-
chunks.set(id, chunk);
|
3002
|
-
}
|
3003
|
-
|
1669
|
+
var chunks = response._chunks,
|
1670
|
+
chunk = chunks.get(id);
|
1671
|
+
chunk ||
|
1672
|
+
((chunk = response._formData.get(response._prefix + id)),
|
1673
|
+
(chunk =
|
1674
|
+
null != chunk
|
1675
|
+
? new Chunk("resolved_model", chunk, null, response)
|
1676
|
+
: new Chunk("pending", null, null, response)),
|
1677
|
+
chunks.set(id, chunk));
|
3004
1678
|
return chunk;
|
3005
1679
|
}
|
3006
|
-
|
3007
1680
|
function createModelResolver(chunk, parentObject, key) {
|
3008
|
-
let blocked;
|
3009
|
-
|
3010
1681
|
if (initializingChunkBlockedModel) {
|
3011
|
-
blocked = initializingChunkBlockedModel;
|
1682
|
+
var blocked = initializingChunkBlockedModel;
|
3012
1683
|
blocked.deps++;
|
3013
|
-
} else {
|
3014
|
-
|
3015
|
-
deps: 1,
|
3016
|
-
value: null
|
3017
|
-
};
|
3018
|
-
}
|
3019
|
-
|
3020
|
-
return value => {
|
1684
|
+
} else blocked = initializingChunkBlockedModel = { deps: 1, value: null };
|
1685
|
+
return function (value) {
|
3021
1686
|
parentObject[key] = value;
|
3022
1687
|
blocked.deps--;
|
3023
|
-
|
3024
|
-
|
3025
|
-
|
3026
|
-
|
3027
|
-
|
3028
|
-
|
3029
|
-
const resolveListeners = chunk.value;
|
3030
|
-
const initializedChunk = chunk;
|
3031
|
-
initializedChunk.status = INITIALIZED;
|
3032
|
-
initializedChunk.value = blocked.value;
|
3033
|
-
|
3034
|
-
if (resolveListeners !== null) {
|
3035
|
-
wakeChunk(resolveListeners, blocked.value);
|
3036
|
-
}
|
3037
|
-
}
|
1688
|
+
0 === blocked.deps &&
|
1689
|
+
"blocked" === chunk.status &&
|
1690
|
+
((value = chunk.value),
|
1691
|
+
(chunk.status = "fulfilled"),
|
1692
|
+
(chunk.value = blocked.value),
|
1693
|
+
null !== value && wakeChunk(value, blocked.value));
|
3038
1694
|
};
|
3039
1695
|
}
|
3040
|
-
|
3041
1696
|
function createModelReject(chunk) {
|
3042
|
-
return
|
1697
|
+
return function (error) {
|
1698
|
+
return triggerErrorOnChunk(chunk, error);
|
1699
|
+
};
|
3043
1700
|
}
|
3044
|
-
|
3045
1701
|
function getOutlinedModel(response, id) {
|
3046
|
-
|
3047
|
-
|
3048
|
-
if (
|
3049
|
-
|
3050
|
-
}
|
3051
|
-
|
3052
|
-
if (chunk.status !== INITIALIZED) {
|
3053
|
-
// We know that this is emitted earlier so otherwise it's an error.
|
3054
|
-
throw chunk.reason;
|
3055
|
-
}
|
3056
|
-
|
3057
|
-
return chunk.value;
|
1702
|
+
response = getChunk(response, id);
|
1703
|
+
"resolved_model" === response.status && initializeModelChunk(response);
|
1704
|
+
if ("fulfilled" !== response.status) throw response.reason;
|
1705
|
+
return response.value;
|
3058
1706
|
}
|
3059
|
-
|
3060
1707
|
function parseModelString(response, obj, key, value) {
|
3061
|
-
if (value[0]
|
1708
|
+
if ("$" === value[0]) {
|
3062
1709
|
switch (value[1]) {
|
3063
|
-
case
|
3064
|
-
|
3065
|
-
|
3066
|
-
|
3067
|
-
|
3068
|
-
|
3069
|
-
|
3070
|
-
|
3071
|
-
|
3072
|
-
|
3073
|
-
|
3074
|
-
|
3075
|
-
|
3076
|
-
|
3077
|
-
|
3078
|
-
|
3079
|
-
|
3080
|
-
|
3081
|
-
|
3082
|
-
|
3083
|
-
|
3084
|
-
|
3085
|
-
|
3086
|
-
|
3087
|
-
|
3088
|
-
|
3089
|
-
|
3090
|
-
|
3091
|
-
|
3092
|
-
|
3093
|
-
|
3094
|
-
|
3095
|
-
|
3096
|
-
|
3097
|
-
|
3098
|
-
|
3099
|
-
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3108
|
-
case
|
3109
|
-
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
3117
|
-
|
3118
|
-
|
3119
|
-
|
3120
|
-
|
3121
|
-
|
3122
|
-
|
3123
|
-
|
3124
|
-
|
3125
|
-
|
3126
|
-
|
3127
|
-
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
}
|
3141
|
-
}
|
3142
|
-
|
3143
|
-
case 'N':
|
3144
|
-
{
|
3145
|
-
// $NaN
|
3146
|
-
return NaN;
|
3147
|
-
}
|
3148
|
-
|
3149
|
-
case 'u':
|
3150
|
-
{
|
3151
|
-
// matches "$undefined"
|
3152
|
-
// Special encoding for `undefined` which can't be serialized as JSON otherwise.
|
3153
|
-
return undefined;
|
3154
|
-
}
|
3155
|
-
|
3156
|
-
case 'D':
|
3157
|
-
{
|
3158
|
-
// Date
|
3159
|
-
return new Date(Date.parse(value.slice(2)));
|
3160
|
-
}
|
3161
|
-
|
3162
|
-
case 'n':
|
3163
|
-
{
|
3164
|
-
// BigInt
|
3165
|
-
return BigInt(value.slice(2));
|
3166
|
-
}
|
3167
|
-
}
|
3168
|
-
|
3169
|
-
|
3170
|
-
const id = parseInt(value.slice(1), 16);
|
3171
|
-
const chunk = getChunk(response, id);
|
3172
|
-
|
3173
|
-
switch (chunk.status) {
|
3174
|
-
case RESOLVED_MODEL:
|
3175
|
-
initializeModelChunk(chunk);
|
3176
|
-
break;
|
3177
|
-
} // The status might have changed after initialization.
|
3178
|
-
|
3179
|
-
|
3180
|
-
switch (chunk.status) {
|
3181
|
-
case INITIALIZED:
|
3182
|
-
return chunk.value;
|
3183
|
-
|
3184
|
-
case PENDING:
|
3185
|
-
case BLOCKED:
|
3186
|
-
const parentChunk = initializingChunk;
|
3187
|
-
chunk.then(createModelResolver(parentChunk, obj, key), createModelReject(parentChunk));
|
3188
|
-
return null;
|
3189
|
-
|
1710
|
+
case "$":
|
1711
|
+
return value.slice(1);
|
1712
|
+
case "@":
|
1713
|
+
return (obj = parseInt(value.slice(2), 16)), getChunk(response, obj);
|
1714
|
+
case "F":
|
1715
|
+
return (
|
1716
|
+
(value = parseInt(value.slice(2), 16)),
|
1717
|
+
(value = getOutlinedModel(response, value)),
|
1718
|
+
loadServerReference$1(
|
1719
|
+
response,
|
1720
|
+
value.id,
|
1721
|
+
value.bound,
|
1722
|
+
initializingChunk,
|
1723
|
+
obj,
|
1724
|
+
key
|
1725
|
+
)
|
1726
|
+
);
|
1727
|
+
case "T":
|
1728
|
+
return createTemporaryReference(value.slice(2));
|
1729
|
+
case "Q":
|
1730
|
+
return (
|
1731
|
+
(obj = parseInt(value.slice(2), 16)),
|
1732
|
+
(response = getOutlinedModel(response, obj)),
|
1733
|
+
new Map(response)
|
1734
|
+
);
|
1735
|
+
case "W":
|
1736
|
+
return (
|
1737
|
+
(obj = parseInt(value.slice(2), 16)),
|
1738
|
+
(response = getOutlinedModel(response, obj)),
|
1739
|
+
new Set(response)
|
1740
|
+
);
|
1741
|
+
case "K":
|
1742
|
+
obj = value.slice(2);
|
1743
|
+
var formPrefix = response._prefix + obj + "_",
|
1744
|
+
data$23 = new FormData();
|
1745
|
+
response._formData.forEach(function (entry, entryKey) {
|
1746
|
+
entryKey.startsWith(formPrefix) &&
|
1747
|
+
data$23.append(entryKey.slice(formPrefix.length), entry);
|
1748
|
+
});
|
1749
|
+
return data$23;
|
1750
|
+
case "i":
|
1751
|
+
return (
|
1752
|
+
(obj = parseInt(value.slice(2), 16)),
|
1753
|
+
getOutlinedModel(response, obj)[Symbol.iterator]()
|
1754
|
+
);
|
1755
|
+
case "I":
|
1756
|
+
return Infinity;
|
1757
|
+
case "-":
|
1758
|
+
return "$-0" === value ? -0 : -Infinity;
|
1759
|
+
case "N":
|
1760
|
+
return NaN;
|
1761
|
+
case "u":
|
1762
|
+
return;
|
1763
|
+
case "D":
|
1764
|
+
return new Date(Date.parse(value.slice(2)));
|
1765
|
+
case "n":
|
1766
|
+
return BigInt(value.slice(2));
|
1767
|
+
}
|
1768
|
+
value = parseInt(value.slice(1), 16);
|
1769
|
+
response = getChunk(response, value);
|
1770
|
+
switch (response.status) {
|
1771
|
+
case "resolved_model":
|
1772
|
+
initializeModelChunk(response);
|
1773
|
+
}
|
1774
|
+
switch (response.status) {
|
1775
|
+
case "fulfilled":
|
1776
|
+
return response.value;
|
1777
|
+
case "pending":
|
1778
|
+
case "blocked":
|
1779
|
+
return (
|
1780
|
+
(value = initializingChunk),
|
1781
|
+
response.then(
|
1782
|
+
createModelResolver(value, obj, key),
|
1783
|
+
createModelReject(value)
|
1784
|
+
),
|
1785
|
+
null
|
1786
|
+
);
|
3190
1787
|
default:
|
3191
|
-
throw
|
1788
|
+
throw response.reason;
|
3192
1789
|
}
|
3193
1790
|
}
|
3194
|
-
|
3195
1791
|
return value;
|
3196
1792
|
}
|
3197
|
-
|
3198
1793
|
function createResponse(bundlerConfig, formFieldPrefix) {
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
1794
|
+
var backingFormData =
|
1795
|
+
2 < arguments.length && void 0 !== arguments[2]
|
1796
|
+
? arguments[2]
|
1797
|
+
: new FormData(),
|
1798
|
+
chunks = new Map(),
|
1799
|
+
response = {
|
1800
|
+
_bundlerConfig: bundlerConfig,
|
1801
|
+
_prefix: formFieldPrefix,
|
1802
|
+
_formData: backingFormData,
|
1803
|
+
_chunks: chunks,
|
1804
|
+
_fromJSON: function (key, value) {
|
1805
|
+
return "string" === typeof value
|
1806
|
+
? parseModelString(response, this, key, value)
|
1807
|
+
: value;
|
3210
1808
|
}
|
3211
|
-
|
3212
|
-
return value;
|
3213
|
-
}
|
3214
|
-
};
|
1809
|
+
};
|
3215
1810
|
return response;
|
3216
1811
|
}
|
3217
1812
|
function close(response) {
|
3218
|
-
|
3219
|
-
// be resolved now. So we need to issue an error to those.
|
3220
|
-
// Ideally we should be able to early bail out if we kept a
|
3221
|
-
// ref count of pending chunks.
|
3222
|
-
reportGlobalError(response, new Error('Connection closed.'));
|
3223
|
-
}
|
3224
|
-
|
3225
|
-
function bindArgs(fn, args) {
|
3226
|
-
return fn.bind.apply(fn, [null].concat(args));
|
1813
|
+
reportGlobalError(response, Error("Connection closed."));
|
3227
1814
|
}
|
3228
|
-
|
3229
1815
|
function loadServerReference(bundlerConfig, id, bound) {
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
} else {
|
3244
|
-
// Synchronously available
|
3245
|
-
return Promise.resolve(requireModule(serverReference));
|
3246
|
-
}
|
1816
|
+
var serverReference = resolveServerReference(bundlerConfig, id);
|
1817
|
+
bundlerConfig = preloadModule(serverReference);
|
1818
|
+
return bound
|
1819
|
+
? Promise.all([bound, bundlerConfig]).then(function (_ref) {
|
1820
|
+
_ref = _ref[0];
|
1821
|
+
var fn = requireModule(serverReference);
|
1822
|
+
return fn.bind.apply(fn, [null].concat(_ref));
|
1823
|
+
})
|
1824
|
+
: bundlerConfig
|
1825
|
+
? Promise.resolve(bundlerConfig).then(function () {
|
1826
|
+
return requireModule(serverReference);
|
1827
|
+
})
|
1828
|
+
: Promise.resolve(requireModule(serverReference));
|
3247
1829
|
}
|
3248
|
-
|
3249
1830
|
function decodeBoundActionMetaData(body, serverManifest, formFieldPrefix) {
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
|
3255
|
-
|
3256
|
-
|
3257
|
-
|
3258
|
-
|
3259
|
-
|
3260
|
-
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
formData.append(key, value);
|
3275
|
-
return;
|
3276
|
-
} // Later actions may override earlier actions if a button is used to override the default
|
3277
|
-
// form action.
|
3278
|
-
|
3279
|
-
|
3280
|
-
if (key.startsWith('$ACTION_REF_')) {
|
3281
|
-
const formFieldPrefix = '$ACTION_' + key.slice(12) + ':';
|
3282
|
-
const metaData = decodeBoundActionMetaData(body, serverManifest, formFieldPrefix);
|
3283
|
-
action = loadServerReference(serverManifest, metaData.id, metaData.bound);
|
3284
|
-
return;
|
3285
|
-
}
|
3286
|
-
|
3287
|
-
if (key.startsWith('$ACTION_ID_')) {
|
3288
|
-
const id = key.slice(11);
|
3289
|
-
action = loadServerReference(serverManifest, id, null);
|
3290
|
-
return;
|
3291
|
-
}
|
1831
|
+
body = createResponse(serverManifest, formFieldPrefix, body);
|
1832
|
+
close(body);
|
1833
|
+
body = getChunk(body, 0);
|
1834
|
+
body.then(function () {});
|
1835
|
+
if ("fulfilled" !== body.status) throw body.reason;
|
1836
|
+
return body.value;
|
1837
|
+
}
|
1838
|
+
exports.createClientModuleProxy = function (moduleId) {
|
1839
|
+
moduleId = registerClientReferenceImpl({}, moduleId, !1);
|
1840
|
+
return new Proxy(moduleId, proxyHandlers$1);
|
1841
|
+
};
|
1842
|
+
exports.decodeAction = function (body, serverManifest) {
|
1843
|
+
var formData = new FormData(),
|
1844
|
+
action = null;
|
1845
|
+
body.forEach(function (value, key) {
|
1846
|
+
key.startsWith("$ACTION_")
|
1847
|
+
? key.startsWith("$ACTION_REF_")
|
1848
|
+
? ((value = "$ACTION_" + key.slice(12) + ":"),
|
1849
|
+
(value = decodeBoundActionMetaData(body, serverManifest, value)),
|
1850
|
+
(action = loadServerReference(serverManifest, value.id, value.bound)))
|
1851
|
+
: key.startsWith("$ACTION_ID_") &&
|
1852
|
+
((value = key.slice(11)),
|
1853
|
+
(action = loadServerReference(serverManifest, value, null)))
|
1854
|
+
: formData.append(key, value);
|
3292
1855
|
});
|
3293
|
-
|
3294
|
-
|
3295
|
-
|
3296
|
-
|
3297
|
-
|
3298
|
-
|
3299
|
-
|
3300
|
-
|
3301
|
-
|
3302
|
-
|
3303
|
-
|
3304
|
-
|
3305
|
-
|
3306
|
-
|
3307
|
-
} // Search through the form data object to get the reference id and the number
|
3308
|
-
// of bound arguments. This repeats some of the work done in decodeAction.
|
3309
|
-
|
3310
|
-
|
3311
|
-
let metaData = null; // $FlowFixMe[prop-missing]
|
3312
|
-
|
3313
|
-
body.forEach((value, key) => {
|
3314
|
-
if (key.startsWith('$ACTION_REF_')) {
|
3315
|
-
const formFieldPrefix = '$ACTION_' + key.slice(12) + ':';
|
3316
|
-
metaData = decodeBoundActionMetaData(body, serverManifest, formFieldPrefix);
|
3317
|
-
} // We don't check for the simple $ACTION_ID_ case because form state actions
|
3318
|
-
// are always bound to the state argument.
|
3319
|
-
|
1856
|
+
return null === action
|
1857
|
+
? null
|
1858
|
+
: action.then(function (fn) {
|
1859
|
+
return fn.bind(null, formData);
|
1860
|
+
});
|
1861
|
+
};
|
1862
|
+
exports.decodeFormState = function (actionResult, body, serverManifest) {
|
1863
|
+
var keyPath = body.get("$ACTION_KEY");
|
1864
|
+
if ("string" !== typeof keyPath) return Promise.resolve(null);
|
1865
|
+
var metaData = null;
|
1866
|
+
body.forEach(function (value, key) {
|
1867
|
+
key.startsWith("$ACTION_REF_") &&
|
1868
|
+
((value = "$ACTION_" + key.slice(12) + ":"),
|
1869
|
+
(metaData = decodeBoundActionMetaData(body, serverManifest, value)));
|
3320
1870
|
});
|
3321
|
-
|
3322
|
-
|
3323
|
-
|
3324
|
-
return
|
1871
|
+
if (null === metaData) return Promise.resolve(null);
|
1872
|
+
var referenceId = metaData.id;
|
1873
|
+
return Promise.resolve(metaData.bound).then(function (bound) {
|
1874
|
+
return null === bound
|
1875
|
+
? null
|
1876
|
+
: [actionResult, keyPath, referenceId, bound.length - 1];
|
1877
|
+
});
|
1878
|
+
};
|
1879
|
+
exports.decodeReply = function (body, webpackMap) {
|
1880
|
+
if ("string" === typeof body) {
|
1881
|
+
var form = new FormData();
|
1882
|
+
form.append("0", body);
|
1883
|
+
body = form;
|
3325
1884
|
}
|
3326
|
-
|
3327
|
-
|
3328
|
-
|
3329
|
-
|
3330
|
-
|
3331
|
-
|
3332
|
-
|
3333
|
-
|
3334
|
-
|
3335
|
-
|
3336
|
-
|
3337
|
-
|
3338
|
-
|
3339
|
-
|
1885
|
+
body = createResponse(webpackMap, "", body);
|
1886
|
+
webpackMap = getChunk(body, 0);
|
1887
|
+
close(body);
|
1888
|
+
return webpackMap;
|
1889
|
+
};
|
1890
|
+
exports.registerClientReference = function (
|
1891
|
+
proxyImplementation,
|
1892
|
+
id,
|
1893
|
+
exportName
|
1894
|
+
) {
|
1895
|
+
return registerClientReferenceImpl(
|
1896
|
+
proxyImplementation,
|
1897
|
+
id + "#" + exportName,
|
1898
|
+
!1
|
1899
|
+
);
|
1900
|
+
};
|
1901
|
+
exports.registerServerReference = function (reference, id, exportName) {
|
1902
|
+
return Object.defineProperties(reference, {
|
1903
|
+
$$typeof: { value: SERVER_REFERENCE_TAG },
|
1904
|
+
$$id: {
|
1905
|
+
value: null === exportName ? id : id + "#" + exportName,
|
1906
|
+
configurable: !0
|
1907
|
+
},
|
1908
|
+
$$bound: { value: null, configurable: !0 },
|
1909
|
+
bind: { value: bind, configurable: !0 }
|
3340
1910
|
});
|
3341
|
-
}
|
3342
|
-
|
3343
|
-
|
3344
|
-
|
3345
|
-
|
1911
|
+
};
|
1912
|
+
exports.renderToReadableStream = function (model, webpackMap, options) {
|
1913
|
+
var request = createRequest(
|
1914
|
+
model,
|
1915
|
+
webpackMap,
|
1916
|
+
options ? options.onError : void 0,
|
1917
|
+
options ? options.identifierPrefix : void 0,
|
1918
|
+
options ? options.onPostpone : void 0
|
1919
|
+
);
|
3346
1920
|
if (options && options.signal) {
|
3347
|
-
|
3348
|
-
|
3349
|
-
|
3350
|
-
|
3351
|
-
} else {
|
3352
|
-
const listener = () => {
|
1921
|
+
var signal = options.signal;
|
1922
|
+
if (signal.aborted) abort(request, signal.reason);
|
1923
|
+
else {
|
1924
|
+
var listener = function () {
|
3353
1925
|
abort(request, signal.reason);
|
3354
|
-
signal.removeEventListener(
|
1926
|
+
signal.removeEventListener("abort", listener);
|
3355
1927
|
};
|
3356
|
-
|
3357
|
-
signal.addEventListener('abort', listener);
|
1928
|
+
signal.addEventListener("abort", listener);
|
3358
1929
|
}
|
3359
1930
|
}
|
3360
|
-
|
3361
|
-
|
3362
|
-
|
3363
|
-
|
3364
|
-
|
3365
|
-
|
3366
|
-
|
3367
|
-
|
1931
|
+
return new ReadableStream(
|
1932
|
+
{
|
1933
|
+
type: "bytes",
|
1934
|
+
start: function () {
|
1935
|
+
startWork(request);
|
1936
|
+
},
|
1937
|
+
pull: function (controller) {
|
1938
|
+
if (1 === request.status)
|
1939
|
+
(request.status = 2), closeWithError(controller, request.fatalError);
|
1940
|
+
else if (2 !== request.status && null === request.destination) {
|
1941
|
+
request.destination = controller;
|
1942
|
+
try {
|
1943
|
+
flushCompletedChunks(request, controller);
|
1944
|
+
} catch (error) {
|
1945
|
+
logRecoverableError(request, error), fatalError(request, error);
|
1946
|
+
}
|
1947
|
+
}
|
1948
|
+
},
|
1949
|
+
cancel: function (reason) {
|
1950
|
+
request.destination = null;
|
1951
|
+
abort(request, reason);
|
1952
|
+
}
|
3368
1953
|
},
|
3369
|
-
|
3370
|
-
|
3371
|
-
|
3372
|
-
}
|
3373
|
-
}, // $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
|
3374
|
-
{
|
3375
|
-
highWaterMark: 0
|
3376
|
-
});
|
3377
|
-
return stream;
|
3378
|
-
}
|
3379
|
-
|
3380
|
-
function decodeReply(body, webpackMap) {
|
3381
|
-
if (typeof body === 'string') {
|
3382
|
-
const form = new FormData();
|
3383
|
-
form.append('0', body);
|
3384
|
-
body = form;
|
3385
|
-
}
|
3386
|
-
|
3387
|
-
const response = createResponse(webpackMap, '', body);
|
3388
|
-
const root = getRoot(response);
|
3389
|
-
close(response);
|
3390
|
-
return root;
|
3391
|
-
}
|
3392
|
-
|
3393
|
-
exports.createClientModuleProxy = createClientModuleProxy;
|
3394
|
-
exports.decodeAction = decodeAction;
|
3395
|
-
exports.decodeFormState = decodeFormState;
|
3396
|
-
exports.decodeReply = decodeReply;
|
3397
|
-
exports.registerClientReference = registerClientReference;
|
3398
|
-
exports.registerServerReference = registerServerReference;
|
3399
|
-
exports.renderToReadableStream = renderToReadableStream;
|
1954
|
+
{ highWaterMark: 0 }
|
1955
|
+
);
|
1956
|
+
};
|