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-client.edge.production.
|
3
|
+
* react-server-dom-webpack-client.edge.production.js
|
4
4
|
*
|
5
5
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
6
6
|
*
|
@@ -8,2055 +8,1086 @@
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
9
9
|
*/
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
// -----------------------------------------------------------------------------
|
16
|
-
const enableBinaryFlight = false;
|
17
|
-
|
18
|
-
function createStringDecoder() {
|
19
|
-
return new TextDecoder();
|
20
|
-
}
|
21
|
-
const decoderOptions = {
|
22
|
-
stream: true
|
23
|
-
};
|
24
|
-
function readPartialStringChunk(decoder, buffer) {
|
25
|
-
return decoder.decode(buffer, decoderOptions);
|
26
|
-
}
|
27
|
-
function readFinalStringChunk(decoder, buffer) {
|
28
|
-
return decoder.decode(buffer);
|
29
|
-
}
|
30
|
-
|
31
|
-
// This is the parsed shape of the wire format which is why it is
|
32
|
-
// condensed to only the essentialy information
|
33
|
-
const ID = 0;
|
34
|
-
const CHUNKS = 1;
|
35
|
-
const NAME = 2; // export const ASYNC = 3;
|
36
|
-
// This logic is correct because currently only include the 4th tuple member
|
37
|
-
// when the module is async. If that changes we will need to actually assert
|
38
|
-
// the value is true. We don't index into the 4th slot because flow does not
|
39
|
-
// like the potential out of bounds access
|
40
|
-
|
41
|
-
function isAsyncImport(metadata) {
|
42
|
-
return metadata.length === 4;
|
43
|
-
}
|
44
|
-
|
45
|
-
// The reason this function needs to defined here in this file instead of just
|
46
|
-
// being exported directly from the WebpackDestination... file is because the
|
47
|
-
// ClientReferenceMetadata is opaque and we can't unwrap it there.
|
48
|
-
// This should get inlined and we could also just implement an unwrapping function
|
49
|
-
// though that risks it getting used in places it shouldn't be. This is unfortunate
|
50
|
-
// but currently it seems to be the best option we have.
|
51
|
-
|
52
|
-
function prepareDestinationForModule(moduleLoading, nonce, metadata) {
|
53
|
-
prepareDestinationWithChunks(moduleLoading, metadata[CHUNKS], nonce);
|
54
|
-
}
|
11
|
+
"use strict";
|
12
|
+
var ReactDOM = require("react-dom"),
|
13
|
+
decoderOptions = { stream: !0 };
|
55
14
|
function resolveClientReference(bundlerConfig, metadata) {
|
56
15
|
if (bundlerConfig) {
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
throw new Error('Could not find the module "' + metadata[ID] + '" in the React SSR Manifest. ' + 'This is probably a bug in the React Server Components bundler.');
|
70
|
-
}
|
71
|
-
|
72
|
-
name = metadata[NAME];
|
73
|
-
}
|
74
|
-
|
75
|
-
if (isAsyncImport(metadata)) {
|
76
|
-
return [resolvedModuleData.id, resolvedModuleData.chunks, name, 1
|
77
|
-
/* async */
|
78
|
-
];
|
79
|
-
} else {
|
80
|
-
return [resolvedModuleData.id, resolvedModuleData.chunks, name];
|
16
|
+
var moduleExports = bundlerConfig[metadata[0]];
|
17
|
+
if ((bundlerConfig = moduleExports[metadata[2]]))
|
18
|
+
moduleExports = bundlerConfig.name;
|
19
|
+
else {
|
20
|
+
bundlerConfig = moduleExports["*"];
|
21
|
+
if (!bundlerConfig)
|
22
|
+
throw Error(
|
23
|
+
'Could not find the module "' +
|
24
|
+
metadata[0] +
|
25
|
+
'" in the React SSR Manifest. This is probably a bug in the React Server Components bundler.'
|
26
|
+
);
|
27
|
+
moduleExports = metadata[2];
|
81
28
|
}
|
29
|
+
return 4 === metadata.length
|
30
|
+
? [bundlerConfig.id, bundlerConfig.chunks, moduleExports, 1]
|
31
|
+
: [bundlerConfig.id, bundlerConfig.chunks, moduleExports];
|
82
32
|
}
|
83
|
-
|
84
33
|
return metadata;
|
85
34
|
}
|
86
|
-
|
87
|
-
// in Webpack but unfortunately it's not exposed so we have to
|
88
|
-
// replicate it in user space. null means that it has already loaded.
|
89
|
-
|
90
|
-
const chunkCache = new Map();
|
91
|
-
|
35
|
+
var chunkCache = new Map();
|
92
36
|
function requireAsyncModule(id) {
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
if (typeof promise.then !== 'function') {
|
97
|
-
// This wasn't a promise after all.
|
98
|
-
return null;
|
99
|
-
} else if (promise.status === 'fulfilled') {
|
100
|
-
// This module was already resolved earlier.
|
37
|
+
var promise = __webpack_require__(id);
|
38
|
+
if ("function" !== typeof promise.then || "fulfilled" === promise.status)
|
101
39
|
return null;
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
return promise;
|
114
|
-
}
|
40
|
+
promise.then(
|
41
|
+
function (value) {
|
42
|
+
promise.status = "fulfilled";
|
43
|
+
promise.value = value;
|
44
|
+
},
|
45
|
+
function (reason) {
|
46
|
+
promise.status = "rejected";
|
47
|
+
promise.reason = reason;
|
48
|
+
}
|
49
|
+
);
|
50
|
+
return promise;
|
115
51
|
}
|
116
|
-
|
117
|
-
function ignoreReject() {// We rely on rejected promises to be handled by another listener.
|
118
|
-
} // Start preloading the modules since we might need them soon.
|
119
|
-
// This function doesn't suspend.
|
120
|
-
|
121
|
-
|
52
|
+
function ignoreReject() {}
|
122
53
|
function preloadModule(metadata) {
|
123
|
-
|
124
|
-
|
125
|
-
let i = 0;
|
126
|
-
|
127
|
-
while (i < chunks.length) {
|
128
|
-
const chunkId = chunks[i++];
|
54
|
+
for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; ) {
|
55
|
+
var chunkId = chunks[i++];
|
129
56
|
chunks[i++];
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
const thenable = loadChunk(chunkId);
|
134
|
-
promises.push(thenable); // $FlowFixMe[method-unbinding]
|
135
|
-
|
136
|
-
const resolve = chunkCache.set.bind(chunkCache, chunkId, null);
|
137
|
-
thenable.then(resolve, ignoreReject);
|
138
|
-
chunkCache.set(chunkId, thenable);
|
139
|
-
} else if (entry !== null) {
|
57
|
+
var entry = chunkCache.get(chunkId);
|
58
|
+
if (void 0 === entry) {
|
59
|
+
entry = __webpack_chunk_load__(chunkId);
|
140
60
|
promises.push(entry);
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
if (promises.length === 0) {
|
146
|
-
return requireAsyncModule(metadata[ID]);
|
147
|
-
} else {
|
148
|
-
return Promise.all(promises).then(() => {
|
149
|
-
return requireAsyncModule(metadata[ID]);
|
150
|
-
});
|
151
|
-
}
|
152
|
-
} else if (promises.length > 0) {
|
153
|
-
return Promise.all(promises);
|
154
|
-
} else {
|
155
|
-
return null;
|
156
|
-
}
|
157
|
-
} // Actually require the module or suspend if it's not yet ready.
|
158
|
-
// Increase priority if necessary.
|
159
|
-
|
160
|
-
function requireModule(metadata) {
|
161
|
-
let moduleExports = __webpack_require__(metadata[ID]);
|
162
|
-
|
163
|
-
if (isAsyncImport(metadata)) {
|
164
|
-
if (typeof moduleExports.then !== 'function') ; else if (moduleExports.status === 'fulfilled') {
|
165
|
-
// This Promise should've been instrumented by preloadModule.
|
166
|
-
moduleExports = moduleExports.value;
|
167
|
-
} else {
|
168
|
-
throw moduleExports.reason;
|
169
|
-
}
|
170
|
-
}
|
171
|
-
|
172
|
-
if (metadata[NAME] === '*') {
|
173
|
-
// This is a placeholder value that represents that the caller imported this
|
174
|
-
// as a CommonJS module as is.
|
175
|
-
return moduleExports;
|
176
|
-
}
|
177
|
-
|
178
|
-
if (metadata[NAME] === '') {
|
179
|
-
// This is a placeholder value that represents that the caller accessed the
|
180
|
-
// default property of this if it was an ESM interop module.
|
181
|
-
return moduleExports.__esModule ? moduleExports.default : moduleExports;
|
61
|
+
var resolve = chunkCache.set.bind(chunkCache, chunkId, null);
|
62
|
+
entry.then(resolve, ignoreReject);
|
63
|
+
chunkCache.set(chunkId, entry);
|
64
|
+
} else null !== entry && promises.push(entry);
|
182
65
|
}
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
66
|
+
return 4 === metadata.length
|
67
|
+
? 0 === promises.length
|
68
|
+
? requireAsyncModule(metadata[0])
|
69
|
+
: Promise.all(promises).then(function () {
|
70
|
+
return requireAsyncModule(metadata[0]);
|
71
|
+
})
|
72
|
+
: 0 < promises.length
|
73
|
+
? Promise.all(promises)
|
74
|
+
: null;
|
75
|
+
}
|
76
|
+
function prepareDestinationWithChunks(moduleLoading, chunks, nonce$jscomp$0) {
|
77
|
+
if (null !== moduleLoading)
|
78
|
+
for (var i = 1; i < chunks.length; i += 2) {
|
79
|
+
var nonce = nonce$jscomp$0,
|
80
|
+
JSCompiler_temp_const = ReactDOMSharedInternals.d,
|
81
|
+
JSCompiler_temp_const$jscomp$0 = JSCompiler_temp_const.X,
|
82
|
+
JSCompiler_temp_const$jscomp$1 = moduleLoading.prefix + chunks[i];
|
83
|
+
var JSCompiler_inline_result = moduleLoading.crossOrigin;
|
84
|
+
JSCompiler_inline_result =
|
85
|
+
"string" === typeof JSCompiler_inline_result
|
86
|
+
? "use-credentials" === JSCompiler_inline_result
|
87
|
+
? JSCompiler_inline_result
|
88
|
+
: ""
|
89
|
+
: void 0;
|
90
|
+
JSCompiler_temp_const$jscomp$0.call(
|
91
|
+
JSCompiler_temp_const,
|
92
|
+
JSCompiler_temp_const$jscomp$1,
|
93
|
+
{ crossOrigin: JSCompiler_inline_result, nonce: nonce }
|
94
|
+
);
|
196
95
|
}
|
197
|
-
}
|
198
|
-
}
|
199
|
-
|
200
|
-
const ReactDOMSharedInternals = ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
201
|
-
|
202
|
-
function getCrossOriginString(input) {
|
203
|
-
if (typeof input === 'string') {
|
204
|
-
return input === 'use-credentials' ? input : '';
|
205
|
-
}
|
206
|
-
|
207
|
-
return undefined;
|
208
96
|
}
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
switch (code) {
|
216
|
-
case 'D':
|
217
|
-
{
|
218
|
-
const refined = refineModel(code, model);
|
219
|
-
const href = refined;
|
220
|
-
dispatcher.D(
|
221
|
-
/* prefetchDNS */
|
222
|
-
href);
|
223
|
-
return;
|
224
|
-
}
|
225
|
-
|
226
|
-
case 'C':
|
227
|
-
{
|
228
|
-
const refined = refineModel(code, model);
|
229
|
-
|
230
|
-
if (typeof refined === 'string') {
|
231
|
-
const href = refined;
|
232
|
-
dispatcher.C(
|
233
|
-
/* preconnect */
|
234
|
-
href);
|
235
|
-
} else {
|
236
|
-
const href = refined[0];
|
237
|
-
const crossOrigin = refined[1];
|
238
|
-
dispatcher.C(
|
239
|
-
/* preconnect */
|
240
|
-
href, crossOrigin);
|
241
|
-
}
|
242
|
-
|
243
|
-
return;
|
244
|
-
}
|
245
|
-
|
246
|
-
case 'L':
|
247
|
-
{
|
248
|
-
const refined = refineModel(code, model);
|
249
|
-
const href = refined[0];
|
250
|
-
const as = refined[1];
|
251
|
-
|
252
|
-
if (refined.length === 3) {
|
253
|
-
const options = refined[2];
|
254
|
-
dispatcher.L(
|
255
|
-
/* preload */
|
256
|
-
href, as, options);
|
257
|
-
} else {
|
258
|
-
dispatcher.L(
|
259
|
-
/* preload */
|
260
|
-
href, as);
|
261
|
-
}
|
262
|
-
|
263
|
-
return;
|
264
|
-
}
|
265
|
-
|
266
|
-
case 'm':
|
267
|
-
{
|
268
|
-
const refined = refineModel(code, model);
|
269
|
-
|
270
|
-
if (typeof refined === 'string') {
|
271
|
-
const href = refined;
|
272
|
-
dispatcher.m(
|
273
|
-
/* preloadModule */
|
274
|
-
href);
|
275
|
-
} else {
|
276
|
-
const href = refined[0];
|
277
|
-
const options = refined[1];
|
278
|
-
dispatcher.m(
|
279
|
-
/* preloadModule */
|
280
|
-
href, options);
|
281
|
-
}
|
282
|
-
|
283
|
-
return;
|
284
|
-
}
|
285
|
-
|
286
|
-
case 'X':
|
287
|
-
{
|
288
|
-
const refined = refineModel(code, model);
|
289
|
-
|
290
|
-
if (typeof refined === 'string') {
|
291
|
-
const href = refined;
|
292
|
-
dispatcher.X(
|
293
|
-
/* preinitScript */
|
294
|
-
href);
|
295
|
-
} else {
|
296
|
-
const href = refined[0];
|
297
|
-
const options = refined[1];
|
298
|
-
dispatcher.X(
|
299
|
-
/* preinitScript */
|
300
|
-
href, options);
|
301
|
-
}
|
302
|
-
|
303
|
-
return;
|
304
|
-
}
|
305
|
-
|
306
|
-
case 'S':
|
307
|
-
{
|
308
|
-
const refined = refineModel(code, model);
|
309
|
-
|
310
|
-
if (typeof refined === 'string') {
|
311
|
-
const href = refined;
|
312
|
-
dispatcher.S(
|
313
|
-
/* preinitStyle */
|
314
|
-
href);
|
315
|
-
} else {
|
316
|
-
const href = refined[0];
|
317
|
-
const precedence = refined[1] === 0 ? undefined : refined[1];
|
318
|
-
const options = refined.length === 3 ? refined[2] : undefined;
|
319
|
-
dispatcher.S(
|
320
|
-
/* preinitStyle */
|
321
|
-
href, precedence, options);
|
322
|
-
}
|
323
|
-
|
324
|
-
return;
|
325
|
-
}
|
326
|
-
|
327
|
-
case 'M':
|
328
|
-
{
|
329
|
-
const refined = refineModel(code, model);
|
330
|
-
|
331
|
-
if (typeof refined === 'string') {
|
332
|
-
const href = refined;
|
333
|
-
dispatcher.M(
|
334
|
-
/* preinitModuleScript */
|
335
|
-
href);
|
336
|
-
} else {
|
337
|
-
const href = refined[0];
|
338
|
-
const options = refined[1];
|
339
|
-
dispatcher.M(
|
340
|
-
/* preinitModuleScript */
|
341
|
-
href, options);
|
342
|
-
}
|
343
|
-
|
344
|
-
return;
|
345
|
-
}
|
346
|
-
}
|
347
|
-
} // Flow is having trouble refining the HintModels so we help it a bit.
|
348
|
-
// This should be compiled out in the production build.
|
349
|
-
|
350
|
-
function refineModel(code, model) {
|
351
|
-
return model;
|
352
|
-
}
|
353
|
-
function preinitScriptForSSR(href, nonce, crossOrigin) {
|
354
|
-
ReactDOMSharedInternals.d
|
355
|
-
/* ReactDOMCurrentDispatcher */
|
356
|
-
.X(
|
357
|
-
/* preinitScript */
|
358
|
-
href, {
|
359
|
-
crossOrigin: getCrossOriginString(crossOrigin),
|
360
|
-
nonce
|
361
|
-
});
|
362
|
-
}
|
363
|
-
|
364
|
-
// ATTENTION
|
365
|
-
// When adding new symbols to this file,
|
366
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
367
|
-
// The Symbol used to tag the ReactElement-like types.
|
368
|
-
const REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
369
|
-
const REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
370
|
-
const MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
371
|
-
const FAUX_ITERATOR_SYMBOL = '@@iterator';
|
97
|
+
var ReactDOMSharedInternals =
|
98
|
+
ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
|
99
|
+
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
100
|
+
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
101
|
+
MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
372
102
|
function getIteratorFn(maybeIterable) {
|
373
|
-
if (
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
}
|
382
|
-
|
383
|
-
return null;
|
384
|
-
}
|
385
|
-
|
386
|
-
const isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
387
|
-
|
388
|
-
function isArray(a) {
|
389
|
-
return isArrayImpl(a);
|
390
|
-
}
|
391
|
-
|
392
|
-
const getPrototypeOf = Object.getPrototypeOf;
|
393
|
-
|
394
|
-
function createTemporaryReferenceSet() {
|
395
|
-
return [];
|
396
|
-
}
|
103
|
+
if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
|
104
|
+
maybeIterable =
|
105
|
+
(MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
|
106
|
+
maybeIterable["@@iterator"];
|
107
|
+
return "function" === typeof maybeIterable ? maybeIterable : null;
|
108
|
+
}
|
109
|
+
var isArrayImpl = Array.isArray,
|
110
|
+
getPrototypeOf = Object.getPrototypeOf;
|
397
111
|
function writeTemporaryReference(set, object) {
|
398
|
-
|
399
|
-
// object. This ensures that we always generate a deterministic encoding of
|
400
|
-
// each slot in the reply for cacheability.
|
401
|
-
const newId = set.length;
|
112
|
+
var newId = set.length;
|
402
113
|
set.push(object);
|
403
114
|
return newId;
|
404
115
|
}
|
405
|
-
|
406
|
-
|
407
|
-
throw new Error("The RSC response contained a reference that doesn't exist in the temporary reference set. " + 'Always pass the matching set that was used to create the reply when parsing its response.');
|
408
|
-
}
|
409
|
-
|
410
|
-
return set[id];
|
411
|
-
}
|
412
|
-
|
413
|
-
const ObjectPrototype = Object.prototype;
|
414
|
-
const knownServerReferences = new WeakMap(); // Serializable values
|
415
|
-
// Thenable<ReactServerValue>
|
416
|
-
|
417
|
-
function serializeByValueID(id) {
|
418
|
-
return '$' + id.toString(16);
|
419
|
-
}
|
420
|
-
|
421
|
-
function serializePromiseID(id) {
|
422
|
-
return '$@' + id.toString(16);
|
423
|
-
}
|
424
|
-
|
425
|
-
function serializeServerReferenceID(id) {
|
426
|
-
return '$F' + id.toString(16);
|
427
|
-
}
|
428
|
-
|
429
|
-
function serializeTemporaryReferenceID(id) {
|
430
|
-
return '$T' + id.toString(16);
|
431
|
-
}
|
432
|
-
|
433
|
-
function serializeFormDataReference(id) {
|
434
|
-
// Why K? F is "Function". D is "Date". What else?
|
435
|
-
return '$K' + id.toString(16);
|
436
|
-
}
|
437
|
-
|
116
|
+
var ObjectPrototype = Object.prototype,
|
117
|
+
knownServerReferences = new WeakMap();
|
438
118
|
function serializeNumber(number) {
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
function serializeUndefined() {
|
457
|
-
return '$undefined';
|
458
|
-
}
|
459
|
-
|
460
|
-
function serializeDateFromDateJSON(dateJSON) {
|
461
|
-
// JSON.stringify automatically calls Date.prototype.toJSON which calls toISOString.
|
462
|
-
// We need only tack on a $D prefix.
|
463
|
-
return '$D' + dateJSON;
|
464
|
-
}
|
465
|
-
|
466
|
-
function serializeBigInt(n) {
|
467
|
-
return '$n' + n.toString(10);
|
468
|
-
}
|
469
|
-
|
470
|
-
function serializeMapID(id) {
|
471
|
-
return '$Q' + id.toString(16);
|
472
|
-
}
|
473
|
-
|
474
|
-
function serializeSetID(id) {
|
475
|
-
return '$W' + id.toString(16);
|
476
|
-
}
|
477
|
-
|
478
|
-
function escapeStringValue(value) {
|
479
|
-
if (value[0] === '$') {
|
480
|
-
// We need to escape $ prefixed strings since we use those to encode
|
481
|
-
// references to IDs and as special symbol values.
|
482
|
-
return '$' + value;
|
483
|
-
} else {
|
484
|
-
return value;
|
485
|
-
}
|
486
|
-
}
|
487
|
-
|
488
|
-
function processReply(root, formFieldPrefix, temporaryReferences, resolve, reject) {
|
489
|
-
let nextPartId = 1;
|
490
|
-
let pendingParts = 0;
|
491
|
-
let formData = null;
|
492
|
-
|
119
|
+
return Number.isFinite(number)
|
120
|
+
? 0 === number && -Infinity === 1 / number
|
121
|
+
? "$-0"
|
122
|
+
: number
|
123
|
+
: Infinity === number
|
124
|
+
? "$Infinity"
|
125
|
+
: -Infinity === number
|
126
|
+
? "$-Infinity"
|
127
|
+
: "$NaN";
|
128
|
+
}
|
129
|
+
function processReply(
|
130
|
+
root,
|
131
|
+
formFieldPrefix,
|
132
|
+
temporaryReferences,
|
133
|
+
resolve,
|
134
|
+
reject
|
135
|
+
) {
|
493
136
|
function resolveToJSON(key, value) {
|
494
|
-
|
495
|
-
|
496
|
-
if (value === null) {
|
497
|
-
return null;
|
498
|
-
}
|
499
|
-
|
500
|
-
if (typeof value === 'object') {
|
137
|
+
if (null === value) return null;
|
138
|
+
if ("object" === typeof value) {
|
501
139
|
switch (value.$$typeof) {
|
502
140
|
case REACT_ELEMENT_TYPE:
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
141
|
+
if (void 0 === temporaryReferences)
|
142
|
+
throw Error(
|
143
|
+
"React Element cannot be passed to Server Functions from the Client without a temporary reference set. Pass a TemporaryReferenceSet to the options."
|
144
|
+
);
|
145
|
+
return (
|
146
|
+
"$T" +
|
147
|
+
writeTemporaryReference(temporaryReferences, value).toString(16)
|
148
|
+
);
|
511
149
|
case REACT_LAZY_TYPE:
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
const retry = function () {
|
544
|
-
// While the first promise resolved, its value isn't necessarily what we'll
|
545
|
-
// resolve into because we might suspend again.
|
546
|
-
try {
|
547
|
-
const partJSON = JSON.stringify(value, resolveToJSON); // $FlowFixMe[incompatible-type] We know it's not null because we assigned it above.
|
548
|
-
|
549
|
-
const data = formData; // eslint-disable-next-line react-internal/safe-string-coercion
|
550
|
-
|
551
|
-
data.append(formFieldPrefix + lazyId, partJSON);
|
552
|
-
pendingParts--;
|
553
|
-
|
554
|
-
if (pendingParts === 0) {
|
555
|
-
resolve(data);
|
556
|
-
}
|
557
|
-
} catch (reason) {
|
558
|
-
reject(reason);
|
559
|
-
}
|
560
|
-
};
|
561
|
-
|
562
|
-
thenable.then(retry, retry);
|
563
|
-
return serializeByValueID(lazyId);
|
564
|
-
} else {
|
565
|
-
// In the future we could consider serializing this as an error
|
566
|
-
// that throws on the server instead.
|
567
|
-
reject(x);
|
568
|
-
return null;
|
569
|
-
}
|
570
|
-
} finally {
|
571
|
-
pendingParts--;
|
150
|
+
key = value._payload;
|
151
|
+
var init = value._init;
|
152
|
+
null === formData && (formData = new FormData());
|
153
|
+
pendingParts++;
|
154
|
+
try {
|
155
|
+
var resolvedModel = init(key),
|
156
|
+
lazyId = nextPartId++,
|
157
|
+
partJSON = JSON.stringify(resolvedModel, resolveToJSON);
|
158
|
+
formData.append(formFieldPrefix + lazyId, partJSON);
|
159
|
+
return "$" + lazyId.toString(16);
|
160
|
+
} catch (x) {
|
161
|
+
if (
|
162
|
+
"object" === typeof x &&
|
163
|
+
null !== x &&
|
164
|
+
"function" === typeof x.then
|
165
|
+
) {
|
166
|
+
pendingParts++;
|
167
|
+
var lazyId$21 = nextPartId++;
|
168
|
+
resolvedModel = function () {
|
169
|
+
try {
|
170
|
+
var partJSON$22 = JSON.stringify(value, resolveToJSON),
|
171
|
+
data$23 = formData;
|
172
|
+
data$23.append(formFieldPrefix + lazyId$21, partJSON$22);
|
173
|
+
pendingParts--;
|
174
|
+
0 === pendingParts && resolve(data$23);
|
175
|
+
} catch (reason) {
|
176
|
+
reject(reason);
|
177
|
+
}
|
178
|
+
};
|
179
|
+
x.then(resolvedModel, resolvedModel);
|
180
|
+
return "$" + lazyId$21.toString(16);
|
572
181
|
}
|
182
|
+
reject(x);
|
183
|
+
return null;
|
184
|
+
} finally {
|
185
|
+
pendingParts--;
|
573
186
|
}
|
574
|
-
}
|
575
|
-
|
576
|
-
|
577
|
-
if (typeof value.then === 'function') {
|
578
|
-
// We assume that any object with a .then property is a "Thenable" type,
|
579
|
-
// or a Promise type. Either of which can be represented by a Promise.
|
580
|
-
if (formData === null) {
|
581
|
-
// Upgrade to use FormData to allow us to stream this value.
|
582
|
-
formData = new FormData();
|
583
|
-
}
|
584
|
-
|
187
|
+
}
|
188
|
+
if ("function" === typeof value.then) {
|
189
|
+
null === formData && (formData = new FormData());
|
585
190
|
pendingParts++;
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
if (pendingParts === 0) {
|
598
|
-
resolve(data);
|
191
|
+
var promiseId = nextPartId++;
|
192
|
+
value.then(
|
193
|
+
function (partValue) {
|
194
|
+
try {
|
195
|
+
var partJSON$25 = JSON.stringify(partValue, resolveToJSON);
|
196
|
+
partValue = formData;
|
197
|
+
partValue.append(formFieldPrefix + promiseId, partJSON$25);
|
198
|
+
pendingParts--;
|
199
|
+
0 === pendingParts && resolve(partValue);
|
200
|
+
} catch (reason) {
|
201
|
+
reject(reason);
|
599
202
|
}
|
600
|
-
}
|
203
|
+
},
|
204
|
+
function (reason) {
|
601
205
|
reject(reason);
|
602
206
|
}
|
603
|
-
|
604
|
-
|
605
|
-
// that throws on the server instead.
|
606
|
-
reject(reason);
|
607
|
-
});
|
608
|
-
return serializePromiseID(promiseId);
|
207
|
+
);
|
208
|
+
return "$@" + promiseId.toString(16);
|
609
209
|
}
|
610
|
-
|
611
|
-
if (isArray(value)) {
|
612
|
-
// $FlowFixMe[incompatible-return]
|
613
|
-
return value;
|
614
|
-
} // TODO: Should we the Object.prototype.toString.call() to test for cross-realm objects?
|
615
|
-
|
616
|
-
|
210
|
+
if (isArrayImpl(value)) return value;
|
617
211
|
if (value instanceof FormData) {
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
const refId = nextPartId++; // Copy all the form fields with a prefix for this reference.
|
625
|
-
// These must come first in the form order because we assume that all the
|
626
|
-
// fields are available before this is referenced.
|
627
|
-
|
628
|
-
const prefix = formFieldPrefix + refId + '_'; // $FlowFixMe[prop-missing]: FormData has forEach.
|
629
|
-
|
630
|
-
value.forEach((originalValue, originalKey) => {
|
631
|
-
data.append(prefix + originalKey, originalValue);
|
212
|
+
null === formData && (formData = new FormData());
|
213
|
+
var data$27 = formData;
|
214
|
+
resolvedModel = nextPartId++;
|
215
|
+
var prefix = formFieldPrefix + resolvedModel + "_";
|
216
|
+
value.forEach(function (originalValue, originalKey) {
|
217
|
+
data$27.append(prefix + originalKey, originalValue);
|
632
218
|
});
|
633
|
-
return
|
634
|
-
}
|
635
|
-
|
636
|
-
if (value instanceof Map) {
|
637
|
-
const partJSON = JSON.stringify(Array.from(value), resolveToJSON);
|
638
|
-
|
639
|
-
if (formData === null) {
|
640
|
-
formData = new FormData();
|
641
|
-
}
|
642
|
-
|
643
|
-
const mapId = nextPartId++;
|
644
|
-
formData.append(formFieldPrefix + mapId, partJSON);
|
645
|
-
return serializeMapID(mapId);
|
646
|
-
}
|
647
|
-
|
648
|
-
if (value instanceof Set) {
|
649
|
-
const partJSON = JSON.stringify(Array.from(value), resolveToJSON);
|
650
|
-
|
651
|
-
if (formData === null) {
|
652
|
-
formData = new FormData();
|
653
|
-
}
|
654
|
-
|
655
|
-
const setId = nextPartId++;
|
656
|
-
formData.append(formFieldPrefix + setId, partJSON);
|
657
|
-
return serializeSetID(setId);
|
658
|
-
}
|
659
|
-
|
660
|
-
const iteratorFn = getIteratorFn(value);
|
661
|
-
|
662
|
-
if (iteratorFn) {
|
663
|
-
return Array.from(value);
|
664
|
-
} // Verify that this is a simple plain object.
|
665
|
-
|
666
|
-
|
667
|
-
const proto = getPrototypeOf(value);
|
668
|
-
|
669
|
-
if (proto !== ObjectPrototype && (proto === null || getPrototypeOf(proto) !== null)) {
|
670
|
-
if (temporaryReferences === undefined) {
|
671
|
-
throw new Error('Only plain objects, and a few built-ins, can be passed to Server Actions. ' + 'Classes or null prototypes are not supported.');
|
672
|
-
} // We can serialize class instances as temporary references.
|
673
|
-
|
674
|
-
|
675
|
-
return serializeTemporaryReferenceID(writeTemporaryReference(temporaryReferences, value));
|
219
|
+
return "$K" + resolvedModel.toString(16);
|
676
220
|
}
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
221
|
+
if (value instanceof Map)
|
222
|
+
return (
|
223
|
+
(resolvedModel = JSON.stringify(Array.from(value), resolveToJSON)),
|
224
|
+
null === formData && (formData = new FormData()),
|
225
|
+
(lazyId = nextPartId++),
|
226
|
+
formData.append(formFieldPrefix + lazyId, resolvedModel),
|
227
|
+
"$Q" + lazyId.toString(16)
|
228
|
+
);
|
229
|
+
if (value instanceof Set)
|
230
|
+
return (
|
231
|
+
(resolvedModel = JSON.stringify(Array.from(value), resolveToJSON)),
|
232
|
+
null === formData && (formData = new FormData()),
|
233
|
+
(lazyId = nextPartId++),
|
234
|
+
formData.append(formFieldPrefix + lazyId, resolvedModel),
|
235
|
+
"$W" + lazyId.toString(16)
|
236
|
+
);
|
237
|
+
if ((resolvedModel = getIteratorFn(value)))
|
238
|
+
return (
|
239
|
+
(resolvedModel = resolvedModel.call(value)),
|
240
|
+
resolvedModel === value
|
241
|
+
? ((resolvedModel = JSON.stringify(
|
242
|
+
Array.from(resolvedModel),
|
243
|
+
resolveToJSON
|
244
|
+
)),
|
245
|
+
null === formData && (formData = new FormData()),
|
246
|
+
(lazyId = nextPartId++),
|
247
|
+
formData.append(formFieldPrefix + lazyId, resolvedModel),
|
248
|
+
"$i" + lazyId.toString(16))
|
249
|
+
: Array.from(resolvedModel)
|
250
|
+
);
|
251
|
+
resolvedModel = getPrototypeOf(value);
|
252
|
+
if (
|
253
|
+
resolvedModel !== ObjectPrototype &&
|
254
|
+
(null === resolvedModel || null !== getPrototypeOf(resolvedModel))
|
255
|
+
) {
|
256
|
+
if (void 0 === temporaryReferences)
|
257
|
+
throw Error(
|
258
|
+
"Only plain objects, and a few built-ins, can be passed to Server Actions. Classes or null prototypes are not supported."
|
259
|
+
);
|
260
|
+
return (
|
261
|
+
"$T" +
|
262
|
+
writeTemporaryReference(temporaryReferences, value).toString(16)
|
263
|
+
);
|
692
264
|
}
|
693
|
-
|
694
|
-
return escapeStringValue(value);
|
695
|
-
}
|
696
|
-
|
697
|
-
if (typeof value === 'boolean') {
|
698
265
|
return value;
|
699
266
|
}
|
700
|
-
|
701
|
-
|
702
|
-
|
267
|
+
if ("string" === typeof value) {
|
268
|
+
if ("Z" === value[value.length - 1] && this[key] instanceof Date)
|
269
|
+
return "$D" + value;
|
270
|
+
resolvedModel = "$" === value[0] ? "$" + value : value;
|
271
|
+
return resolvedModel;
|
703
272
|
}
|
704
|
-
|
705
|
-
if (typeof value
|
706
|
-
|
273
|
+
if ("boolean" === typeof value) return value;
|
274
|
+
if ("number" === typeof value) return serializeNumber(value);
|
275
|
+
if ("undefined" === typeof value) return "$undefined";
|
276
|
+
if ("function" === typeof value) {
|
277
|
+
resolvedModel = knownServerReferences.get(value);
|
278
|
+
if (void 0 !== resolvedModel)
|
279
|
+
return (
|
280
|
+
(resolvedModel = JSON.stringify(resolvedModel, resolveToJSON)),
|
281
|
+
null === formData && (formData = new FormData()),
|
282
|
+
(lazyId = nextPartId++),
|
283
|
+
formData.set(formFieldPrefix + lazyId, resolvedModel),
|
284
|
+
"$F" + lazyId.toString(16)
|
285
|
+
);
|
286
|
+
if (void 0 === temporaryReferences)
|
287
|
+
throw Error(
|
288
|
+
"Client Functions cannot be passed directly to Server Functions. Only Functions passed from the Server can be passed back again."
|
289
|
+
);
|
290
|
+
return (
|
291
|
+
"$T" + writeTemporaryReference(temporaryReferences, value).toString(16)
|
292
|
+
);
|
707
293
|
}
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
// Upgrade to use FormData to allow us to stream this value.
|
717
|
-
formData = new FormData();
|
718
|
-
} // The reference to this function came from the same client so we can pass it back.
|
719
|
-
|
720
|
-
|
721
|
-
const refId = nextPartId++; // eslint-disable-next-line react-internal/safe-string-coercion
|
722
|
-
|
723
|
-
formData.set(formFieldPrefix + refId, metaDataJSON);
|
724
|
-
return serializeServerReferenceID(refId);
|
725
|
-
}
|
726
|
-
|
727
|
-
if (temporaryReferences === undefined) {
|
728
|
-
throw new Error('Client Functions cannot be passed directly to Server Functions. ' + 'Only Functions passed from the Server can be passed back again.');
|
729
|
-
}
|
730
|
-
|
731
|
-
return serializeTemporaryReferenceID(writeTemporaryReference(temporaryReferences, value));
|
732
|
-
}
|
733
|
-
|
734
|
-
if (typeof value === 'symbol') {
|
735
|
-
if (temporaryReferences === undefined) {
|
736
|
-
throw new Error('Symbols cannot be passed to a Server Function without a ' + 'temporary reference set. Pass a TemporaryReferenceSet to the options.' + (''));
|
737
|
-
}
|
738
|
-
|
739
|
-
return serializeTemporaryReferenceID(writeTemporaryReference(temporaryReferences, value));
|
740
|
-
}
|
741
|
-
|
742
|
-
if (typeof value === 'bigint') {
|
743
|
-
return serializeBigInt(value);
|
744
|
-
}
|
745
|
-
|
746
|
-
throw new Error("Type " + typeof value + " is not supported as an argument to a Server Function.");
|
747
|
-
} // $FlowFixMe[incompatible-type] it's not going to be undefined because we'll encode it.
|
748
|
-
|
749
|
-
|
750
|
-
const json = JSON.stringify(root, resolveToJSON);
|
751
|
-
|
752
|
-
if (formData === null) {
|
753
|
-
// If it's a simple data structure, we just use plain JSON.
|
754
|
-
resolve(json);
|
755
|
-
} else {
|
756
|
-
// Otherwise, we use FormData to let us stream in the result.
|
757
|
-
formData.set(formFieldPrefix + '0', json);
|
758
|
-
|
759
|
-
if (pendingParts === 0) {
|
760
|
-
// $FlowFixMe[incompatible-call] this has already been refined.
|
761
|
-
resolve(formData);
|
294
|
+
if ("symbol" === typeof value) {
|
295
|
+
if (void 0 === temporaryReferences)
|
296
|
+
throw Error(
|
297
|
+
"Symbols cannot be passed to a Server Function without a temporary reference set. Pass a TemporaryReferenceSet to the options."
|
298
|
+
);
|
299
|
+
return (
|
300
|
+
"$T" + writeTemporaryReference(temporaryReferences, value).toString(16)
|
301
|
+
);
|
762
302
|
}
|
303
|
+
if ("bigint" === typeof value) return "$n" + value.toString(10);
|
304
|
+
throw Error(
|
305
|
+
"Type " +
|
306
|
+
typeof value +
|
307
|
+
" is not supported as an argument to a Server Function."
|
308
|
+
);
|
763
309
|
}
|
764
|
-
|
765
|
-
|
766
|
-
|
310
|
+
var nextPartId = 1,
|
311
|
+
pendingParts = 0,
|
312
|
+
formData = null;
|
313
|
+
root = JSON.stringify(root, resolveToJSON);
|
314
|
+
null === formData
|
315
|
+
? resolve(root)
|
316
|
+
: (formData.set(formFieldPrefix + "0", root),
|
317
|
+
0 === pendingParts && resolve(formData));
|
318
|
+
}
|
319
|
+
var boundCache = new WeakMap();
|
767
320
|
function encodeFormData(reference) {
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
321
|
+
var resolve,
|
322
|
+
reject,
|
323
|
+
thenable = new Promise(function (res, rej) {
|
324
|
+
resolve = res;
|
325
|
+
reject = rej;
|
326
|
+
});
|
327
|
+
processReply(
|
328
|
+
reference,
|
329
|
+
"",
|
330
|
+
void 0,
|
331
|
+
function (body) {
|
332
|
+
if ("string" === typeof body) {
|
333
|
+
var data = new FormData();
|
334
|
+
data.append("0", body);
|
335
|
+
body = data;
|
336
|
+
}
|
337
|
+
thenable.status = "fulfilled";
|
338
|
+
thenable.value = body;
|
339
|
+
resolve(body);
|
340
|
+
},
|
341
|
+
function (e) {
|
342
|
+
thenable.status = "rejected";
|
343
|
+
thenable.reason = e;
|
344
|
+
reject(e);
|
781
345
|
}
|
782
|
-
|
783
|
-
const fulfilled = thenable;
|
784
|
-
fulfilled.status = 'fulfilled';
|
785
|
-
fulfilled.value = body;
|
786
|
-
resolve(body);
|
787
|
-
}, e => {
|
788
|
-
const rejected = thenable;
|
789
|
-
rejected.status = 'rejected';
|
790
|
-
rejected.reason = e;
|
791
|
-
reject(e);
|
792
|
-
});
|
346
|
+
);
|
793
347
|
return thenable;
|
794
348
|
}
|
795
|
-
|
796
349
|
function defaultEncodeFormAction(identifierPrefix) {
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
}
|
814
|
-
|
815
|
-
if (thenable.status === 'rejected') {
|
816
|
-
throw thenable.reason;
|
817
|
-
} else if (thenable.status !== 'fulfilled') {
|
818
|
-
throw thenable;
|
819
|
-
}
|
820
|
-
|
821
|
-
const encodedFormData = thenable.value; // This is hacky but we need the identifier prefix to be added to
|
822
|
-
// all fields but the suspense cache would break since we might get
|
823
|
-
// a new identifier each time. So we just append it at the end instead.
|
824
|
-
|
825
|
-
const prefixedData = new FormData(); // $FlowFixMe[prop-missing]
|
826
|
-
|
827
|
-
encodedFormData.forEach((value, key) => {
|
828
|
-
prefixedData.append('$ACTION_' + identifierPrefix + ':' + key, value);
|
350
|
+
var reference = knownServerReferences.get(this);
|
351
|
+
if (!reference)
|
352
|
+
throw Error(
|
353
|
+
"Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
|
354
|
+
);
|
355
|
+
var data = null;
|
356
|
+
if (null !== reference.bound) {
|
357
|
+
data = boundCache.get(reference);
|
358
|
+
data ||
|
359
|
+
((data = encodeFormData(reference)), boundCache.set(reference, data));
|
360
|
+
if ("rejected" === data.status) throw data.reason;
|
361
|
+
if ("fulfilled" !== data.status) throw data;
|
362
|
+
reference = data.value;
|
363
|
+
var prefixedData = new FormData();
|
364
|
+
reference.forEach(function (value, key) {
|
365
|
+
prefixedData.append("$ACTION_" + identifierPrefix + ":" + key, value);
|
829
366
|
});
|
830
|
-
data = prefixedData;
|
831
|
-
|
832
|
-
|
833
|
-
} else {
|
834
|
-
// This is the simple case so we can just encode the ID.
|
835
|
-
name = '$ACTION_ID_' + reference.id;
|
836
|
-
}
|
837
|
-
|
367
|
+
data = prefixedData;
|
368
|
+
reference = "$ACTION_REF_" + identifierPrefix;
|
369
|
+
} else reference = "$ACTION_ID_" + reference.id;
|
838
370
|
return {
|
839
|
-
name:
|
840
|
-
method:
|
841
|
-
encType:
|
371
|
+
name: reference,
|
372
|
+
method: "POST",
|
373
|
+
encType: "multipart/form-data",
|
842
374
|
data: data
|
843
375
|
};
|
844
376
|
}
|
845
|
-
|
846
|
-
function customEncodeFormAction(proxy, identifierPrefix, encodeFormAction) {
|
847
|
-
const reference = knownServerReferences.get(proxy);
|
848
|
-
|
849
|
-
if (!reference) {
|
850
|
-
throw new Error('Tried to encode a Server Action from a different instance than the encoder is from. ' + 'This is a bug in React.');
|
851
|
-
}
|
852
|
-
|
853
|
-
let boundPromise = reference.bound;
|
854
|
-
|
855
|
-
if (boundPromise === null) {
|
856
|
-
boundPromise = Promise.resolve([]);
|
857
|
-
}
|
858
|
-
|
859
|
-
return encodeFormAction(reference.id, boundPromise);
|
860
|
-
}
|
861
|
-
|
862
377
|
function isSignatureEqual(referenceId, numberOfBoundArgs) {
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
return false;
|
872
|
-
} // Now check if the number of bound arguments is the same.
|
873
|
-
|
874
|
-
|
875
|
-
const boundPromise = reference.bound;
|
876
|
-
|
877
|
-
if (boundPromise === null) {
|
878
|
-
// No bound arguments.
|
879
|
-
return numberOfBoundArgs === 0;
|
880
|
-
} // Unwrap the bound arguments array by suspending, if necessary. As with
|
881
|
-
// encodeFormData, this means isSignatureEqual can only be called while React
|
882
|
-
// is rendering.
|
883
|
-
|
884
|
-
|
378
|
+
var reference = knownServerReferences.get(this);
|
379
|
+
if (!reference)
|
380
|
+
throw Error(
|
381
|
+
"Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
|
382
|
+
);
|
383
|
+
if (reference.id !== referenceId) return !1;
|
384
|
+
var boundPromise = reference.bound;
|
385
|
+
if (null === boundPromise) return 0 === numberOfBoundArgs;
|
885
386
|
switch (boundPromise.status) {
|
886
|
-
case
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
case 'pending':
|
893
|
-
{
|
894
|
-
throw boundPromise;
|
895
|
-
}
|
896
|
-
|
897
|
-
case 'rejected':
|
898
|
-
{
|
899
|
-
throw boundPromise.reason;
|
900
|
-
}
|
901
|
-
|
387
|
+
case "fulfilled":
|
388
|
+
return boundPromise.value.length === numberOfBoundArgs;
|
389
|
+
case "pending":
|
390
|
+
throw boundPromise;
|
391
|
+
case "rejected":
|
392
|
+
throw boundPromise.reason;
|
902
393
|
default:
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
throw boundPromise;
|
919
|
-
}
|
394
|
+
throw (
|
395
|
+
("string" !== typeof boundPromise.status &&
|
396
|
+
((boundPromise.status = "pending"),
|
397
|
+
boundPromise.then(
|
398
|
+
function (boundArgs) {
|
399
|
+
boundPromise.status = "fulfilled";
|
400
|
+
boundPromise.value = boundArgs;
|
401
|
+
},
|
402
|
+
function (error) {
|
403
|
+
boundPromise.status = "rejected";
|
404
|
+
boundPromise.reason = error;
|
405
|
+
}
|
406
|
+
)),
|
407
|
+
boundPromise)
|
408
|
+
);
|
920
409
|
}
|
921
410
|
}
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
const FunctionBind = Function.prototype.bind; // $FlowFixMe[method-unbinding]
|
948
|
-
|
949
|
-
const ArraySlice = Array.prototype.slice;
|
950
|
-
|
411
|
+
function registerServerReference(proxy, reference$jscomp$0, encodeFormAction) {
|
412
|
+
Object.defineProperties(proxy, {
|
413
|
+
$$FORM_ACTION: {
|
414
|
+
value:
|
415
|
+
void 0 === encodeFormAction
|
416
|
+
? defaultEncodeFormAction
|
417
|
+
: function () {
|
418
|
+
var reference = knownServerReferences.get(this);
|
419
|
+
if (!reference)
|
420
|
+
throw Error(
|
421
|
+
"Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
|
422
|
+
);
|
423
|
+
var boundPromise = reference.bound;
|
424
|
+
null === boundPromise && (boundPromise = Promise.resolve([]));
|
425
|
+
return encodeFormAction(reference.id, boundPromise);
|
426
|
+
}
|
427
|
+
},
|
428
|
+
$$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
|
429
|
+
bind: { value: bind }
|
430
|
+
});
|
431
|
+
knownServerReferences.set(proxy, reference$jscomp$0);
|
432
|
+
}
|
433
|
+
var FunctionBind = Function.prototype.bind,
|
434
|
+
ArraySlice = Array.prototype.slice;
|
951
435
|
function bind() {
|
952
|
-
|
953
|
-
|
954
|
-
const reference = knownServerReferences.get(this);
|
955
|
-
|
436
|
+
var newFn = FunctionBind.apply(this, arguments),
|
437
|
+
reference = knownServerReferences.get(this);
|
956
438
|
if (reference) {
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
{
|
970
|
-
// Only expose this in builds that would actually use it. Not needed on the client.
|
971
|
-
Object.defineProperties(newFn, {
|
972
|
-
$$FORM_ACTION: {
|
973
|
-
value: this.$$FORM_ACTION
|
974
|
-
},
|
975
|
-
$$IS_SIGNATURE_EQUAL: {
|
976
|
-
value: isSignatureEqual
|
977
|
-
},
|
978
|
-
bind: {
|
979
|
-
value: bind
|
980
|
-
}
|
981
|
-
});
|
982
|
-
}
|
983
|
-
|
984
|
-
knownServerReferences.set(newFn, {
|
985
|
-
id: reference.id,
|
986
|
-
bound: boundPromise
|
439
|
+
var args = ArraySlice.call(arguments, 1),
|
440
|
+
boundPromise = null;
|
441
|
+
boundPromise =
|
442
|
+
null !== reference.bound
|
443
|
+
? Promise.resolve(reference.bound).then(function (boundArgs) {
|
444
|
+
return boundArgs.concat(args);
|
445
|
+
})
|
446
|
+
: Promise.resolve(args);
|
447
|
+
Object.defineProperties(newFn, {
|
448
|
+
$$FORM_ACTION: { value: this.$$FORM_ACTION },
|
449
|
+
$$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
|
450
|
+
bind: { value: bind }
|
987
451
|
});
|
452
|
+
knownServerReferences.set(newFn, { id: reference.id, bound: boundPromise });
|
988
453
|
}
|
989
|
-
|
990
454
|
return newFn;
|
991
455
|
}
|
992
|
-
|
993
456
|
function createServerReference$1(id, callServer, encodeFormAction) {
|
994
|
-
|
995
|
-
|
996
|
-
const args = Array.prototype.slice.call(arguments);
|
457
|
+
function proxy() {
|
458
|
+
var args = Array.prototype.slice.call(arguments);
|
997
459
|
return callServer(id, args);
|
998
|
-
}
|
999
|
-
|
1000
|
-
registerServerReference(proxy, {
|
1001
|
-
id,
|
1002
|
-
bound: null
|
1003
|
-
}, encodeFormAction);
|
460
|
+
}
|
461
|
+
registerServerReference(proxy, { id: id, bound: null }, encodeFormAction);
|
1004
462
|
return proxy;
|
1005
463
|
}
|
1006
|
-
|
1007
|
-
const ROW_ID = 0;
|
1008
|
-
const ROW_TAG = 1;
|
1009
|
-
const ROW_LENGTH = 2;
|
1010
|
-
const ROW_CHUNK_BY_NEWLINE = 3;
|
1011
|
-
const ROW_CHUNK_BY_LENGTH = 4;
|
1012
|
-
const PENDING = 'pending';
|
1013
|
-
const BLOCKED = 'blocked';
|
1014
|
-
const CYCLIC = 'cyclic';
|
1015
|
-
const RESOLVED_MODEL = 'resolved_model';
|
1016
|
-
const RESOLVED_MODULE = 'resolved_module';
|
1017
|
-
const INITIALIZED = 'fulfilled';
|
1018
|
-
const ERRORED = 'rejected'; // $FlowFixMe[missing-this-annot]
|
1019
|
-
|
1020
464
|
function Chunk(status, value, reason, response) {
|
1021
465
|
this.status = status;
|
1022
466
|
this.value = value;
|
1023
467
|
this.reason = reason;
|
1024
468
|
this._response = response;
|
1025
|
-
}
|
1026
|
-
|
1027
|
-
|
1028
|
-
Chunk.prototype = Object.create(Promise.prototype); // TODO: This doesn't return a new Promise chain unlike the real .then
|
1029
|
-
|
469
|
+
}
|
470
|
+
Chunk.prototype = Object.create(Promise.prototype);
|
1030
471
|
Chunk.prototype.then = function (resolve, reject) {
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
switch (chunk.status) {
|
1035
|
-
case RESOLVED_MODEL:
|
1036
|
-
initializeModelChunk(chunk);
|
1037
|
-
break;
|
1038
|
-
|
1039
|
-
case RESOLVED_MODULE:
|
1040
|
-
initializeModuleChunk(chunk);
|
472
|
+
switch (this.status) {
|
473
|
+
case "resolved_model":
|
474
|
+
initializeModelChunk(this);
|
1041
475
|
break;
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
switch (
|
1046
|
-
case
|
1047
|
-
resolve(
|
476
|
+
case "resolved_module":
|
477
|
+
initializeModuleChunk(this);
|
478
|
+
}
|
479
|
+
switch (this.status) {
|
480
|
+
case "fulfilled":
|
481
|
+
resolve(this.value);
|
1048
482
|
break;
|
1049
|
-
|
1050
|
-
case
|
1051
|
-
case
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
}
|
1057
|
-
|
1058
|
-
chunk.value.push(resolve);
|
1059
|
-
}
|
1060
|
-
|
1061
|
-
if (reject) {
|
1062
|
-
if (chunk.reason === null) {
|
1063
|
-
chunk.reason = [];
|
1064
|
-
}
|
1065
|
-
|
1066
|
-
chunk.reason.push(reject);
|
1067
|
-
}
|
1068
|
-
|
483
|
+
case "pending":
|
484
|
+
case "blocked":
|
485
|
+
case "cyclic":
|
486
|
+
resolve &&
|
487
|
+
(null === this.value && (this.value = []), this.value.push(resolve));
|
488
|
+
reject &&
|
489
|
+
(null === this.reason && (this.reason = []), this.reason.push(reject));
|
1069
490
|
break;
|
1070
|
-
|
1071
491
|
default:
|
1072
|
-
|
1073
|
-
reject(chunk.reason);
|
1074
|
-
}
|
1075
|
-
|
1076
|
-
break;
|
492
|
+
reject && reject(this.reason);
|
1077
493
|
}
|
1078
494
|
};
|
1079
|
-
|
1080
495
|
function readChunk(chunk) {
|
1081
|
-
// If we have resolved content, we try to initialize it first which
|
1082
|
-
// might put us back into one of the other states.
|
1083
496
|
switch (chunk.status) {
|
1084
|
-
case
|
497
|
+
case "resolved_model":
|
1085
498
|
initializeModelChunk(chunk);
|
1086
499
|
break;
|
1087
|
-
|
1088
|
-
case RESOLVED_MODULE:
|
500
|
+
case "resolved_module":
|
1089
501
|
initializeModuleChunk(chunk);
|
1090
|
-
|
1091
|
-
} // The status might have changed after initialization.
|
1092
|
-
|
1093
|
-
|
502
|
+
}
|
1094
503
|
switch (chunk.status) {
|
1095
|
-
case
|
504
|
+
case "fulfilled":
|
1096
505
|
return chunk.value;
|
1097
|
-
|
1098
|
-
case
|
1099
|
-
case
|
1100
|
-
case CYCLIC:
|
1101
|
-
// eslint-disable-next-line no-throw-literal
|
506
|
+
case "pending":
|
507
|
+
case "blocked":
|
508
|
+
case "cyclic":
|
1102
509
|
throw chunk;
|
1103
|
-
|
1104
510
|
default:
|
1105
511
|
throw chunk.reason;
|
1106
512
|
}
|
1107
513
|
}
|
1108
|
-
|
1109
|
-
function getRoot(response) {
|
1110
|
-
const chunk = getChunk(response, 0);
|
1111
|
-
return chunk;
|
1112
|
-
}
|
1113
|
-
|
1114
|
-
function createPendingChunk(response) {
|
1115
|
-
// $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors
|
1116
|
-
return new Chunk(PENDING, null, null, response);
|
1117
|
-
}
|
1118
|
-
|
1119
|
-
function createBlockedChunk(response) {
|
1120
|
-
// $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors
|
1121
|
-
return new Chunk(BLOCKED, null, null, response);
|
1122
|
-
}
|
1123
|
-
|
1124
|
-
function createErrorChunk(response, error) {
|
1125
|
-
// $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors
|
1126
|
-
return new Chunk(ERRORED, null, error, response);
|
1127
|
-
}
|
1128
|
-
|
1129
514
|
function wakeChunk(listeners, value) {
|
1130
|
-
for (
|
1131
|
-
const listener = listeners[i];
|
1132
|
-
listener(value);
|
1133
|
-
}
|
515
|
+
for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value);
|
1134
516
|
}
|
1135
|
-
|
1136
517
|
function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) {
|
1137
518
|
switch (chunk.status) {
|
1138
|
-
case
|
519
|
+
case "fulfilled":
|
1139
520
|
wakeChunk(resolveListeners, chunk.value);
|
1140
521
|
break;
|
1141
|
-
|
1142
|
-
case
|
1143
|
-
case
|
1144
|
-
case CYCLIC:
|
522
|
+
case "pending":
|
523
|
+
case "blocked":
|
524
|
+
case "cyclic":
|
1145
525
|
chunk.value = resolveListeners;
|
1146
526
|
chunk.reason = rejectListeners;
|
1147
527
|
break;
|
1148
|
-
|
1149
|
-
|
1150
|
-
if (rejectListeners) {
|
1151
|
-
wakeChunk(rejectListeners, chunk.reason);
|
1152
|
-
}
|
1153
|
-
|
1154
|
-
break;
|
528
|
+
case "rejected":
|
529
|
+
rejectListeners && wakeChunk(rejectListeners, chunk.reason);
|
1155
530
|
}
|
1156
531
|
}
|
1157
|
-
|
1158
532
|
function triggerErrorOnChunk(chunk, error) {
|
1159
|
-
if (chunk.status
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
const listeners = chunk.reason;
|
1165
|
-
const erroredChunk = chunk;
|
1166
|
-
erroredChunk.status = ERRORED;
|
1167
|
-
erroredChunk.reason = error;
|
1168
|
-
|
1169
|
-
if (listeners !== null) {
|
1170
|
-
wakeChunk(listeners, error);
|
1171
|
-
}
|
1172
|
-
}
|
1173
|
-
|
1174
|
-
function createResolvedModelChunk(response, value) {
|
1175
|
-
// $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors
|
1176
|
-
return new Chunk(RESOLVED_MODEL, value, null, response);
|
1177
|
-
}
|
1178
|
-
|
1179
|
-
function createResolvedModuleChunk(response, value) {
|
1180
|
-
// $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors
|
1181
|
-
return new Chunk(RESOLVED_MODULE, value, null, response);
|
1182
|
-
}
|
1183
|
-
|
1184
|
-
function createInitializedTextChunk(response, value) {
|
1185
|
-
// $FlowFixMe[invalid-constructor] Flow doesn't support functions as constructors
|
1186
|
-
return new Chunk(INITIALIZED, value, null, response);
|
1187
|
-
}
|
1188
|
-
|
1189
|
-
function resolveModelChunk(chunk, value) {
|
1190
|
-
if (chunk.status !== PENDING) {
|
1191
|
-
|
1192
|
-
return;
|
1193
|
-
}
|
1194
|
-
|
1195
|
-
const resolveListeners = chunk.value;
|
1196
|
-
const rejectListeners = chunk.reason;
|
1197
|
-
const resolvedChunk = chunk;
|
1198
|
-
resolvedChunk.status = RESOLVED_MODEL;
|
1199
|
-
resolvedChunk.value = value;
|
1200
|
-
|
1201
|
-
if (resolveListeners !== null) {
|
1202
|
-
// This is unfortunate that we're reading this eagerly if
|
1203
|
-
// we already have listeners attached since they might no
|
1204
|
-
// longer be rendered or might not be the highest pri.
|
1205
|
-
initializeModelChunk(resolvedChunk); // The status might have changed after initialization.
|
1206
|
-
|
1207
|
-
wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners);
|
533
|
+
if ("pending" === chunk.status || "blocked" === chunk.status) {
|
534
|
+
var listeners = chunk.reason;
|
535
|
+
chunk.status = "rejected";
|
536
|
+
chunk.reason = error;
|
537
|
+
null !== listeners && wakeChunk(listeners, error);
|
1208
538
|
}
|
1209
539
|
}
|
1210
|
-
|
1211
540
|
function resolveModuleChunk(chunk, value) {
|
1212
|
-
if (chunk.status
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
resolvedChunk.status = RESOLVED_MODULE;
|
1221
|
-
resolvedChunk.value = value;
|
1222
|
-
|
1223
|
-
if (resolveListeners !== null) {
|
1224
|
-
initializeModuleChunk(resolvedChunk);
|
1225
|
-
wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners);
|
541
|
+
if ("pending" === chunk.status || "blocked" === chunk.status) {
|
542
|
+
var resolveListeners = chunk.value,
|
543
|
+
rejectListeners = chunk.reason;
|
544
|
+
chunk.status = "resolved_module";
|
545
|
+
chunk.value = value;
|
546
|
+
null !== resolveListeners &&
|
547
|
+
(initializeModuleChunk(chunk),
|
548
|
+
wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners));
|
1226
549
|
}
|
1227
550
|
}
|
1228
|
-
|
1229
|
-
|
1230
|
-
let initializingChunkBlockedModel = null;
|
1231
|
-
|
551
|
+
var initializingChunk = null,
|
552
|
+
initializingChunkBlockedModel = null;
|
1232
553
|
function initializeModelChunk(chunk) {
|
1233
|
-
|
1234
|
-
|
554
|
+
var prevChunk = initializingChunk,
|
555
|
+
prevBlocked = initializingChunkBlockedModel;
|
1235
556
|
initializingChunk = chunk;
|
1236
557
|
initializingChunkBlockedModel = null;
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
const cyclicChunk = chunk;
|
1242
|
-
cyclicChunk.status = CYCLIC;
|
1243
|
-
cyclicChunk.value = null;
|
1244
|
-
cyclicChunk.reason = null;
|
1245
|
-
|
558
|
+
var resolvedModel = chunk.value;
|
559
|
+
chunk.status = "cyclic";
|
560
|
+
chunk.value = null;
|
561
|
+
chunk.reason = null;
|
1246
562
|
try {
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
initializedChunk.value = value;
|
1262
|
-
|
1263
|
-
if (resolveListeners !== null) {
|
1264
|
-
wakeChunk(resolveListeners, value);
|
1265
|
-
}
|
563
|
+
var value = JSON.parse(resolvedModel, chunk._response._fromJSON);
|
564
|
+
if (
|
565
|
+
null !== initializingChunkBlockedModel &&
|
566
|
+
0 < initializingChunkBlockedModel.deps
|
567
|
+
)
|
568
|
+
(initializingChunkBlockedModel.value = value),
|
569
|
+
(chunk.status = "blocked"),
|
570
|
+
(chunk.value = null),
|
571
|
+
(chunk.reason = null);
|
572
|
+
else {
|
573
|
+
var resolveListeners = chunk.value;
|
574
|
+
chunk.status = "fulfilled";
|
575
|
+
chunk.value = value;
|
576
|
+
null !== resolveListeners && wakeChunk(resolveListeners, value);
|
1266
577
|
}
|
1267
578
|
} catch (error) {
|
1268
|
-
|
1269
|
-
erroredChunk.status = ERRORED;
|
1270
|
-
erroredChunk.reason = error;
|
579
|
+
(chunk.status = "rejected"), (chunk.reason = error);
|
1271
580
|
} finally {
|
1272
|
-
initializingChunk = prevChunk
|
1273
|
-
|
581
|
+
(initializingChunk = prevChunk),
|
582
|
+
(initializingChunkBlockedModel = prevBlocked);
|
1274
583
|
}
|
1275
584
|
}
|
1276
|
-
|
1277
585
|
function initializeModuleChunk(chunk) {
|
1278
586
|
try {
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
587
|
+
var metadata = chunk.value,
|
588
|
+
moduleExports = __webpack_require__(metadata[0]);
|
589
|
+
if (4 === metadata.length && "function" === typeof moduleExports.then)
|
590
|
+
if ("fulfilled" === moduleExports.status)
|
591
|
+
moduleExports = moduleExports.value;
|
592
|
+
else throw moduleExports.reason;
|
593
|
+
var JSCompiler_inline_result =
|
594
|
+
"*" === metadata[2]
|
595
|
+
? moduleExports
|
596
|
+
: "" === metadata[2]
|
597
|
+
? moduleExports.__esModule
|
598
|
+
? moduleExports.default
|
599
|
+
: moduleExports
|
600
|
+
: moduleExports[metadata[2]];
|
601
|
+
chunk.status = "fulfilled";
|
602
|
+
chunk.value = JSCompiler_inline_result;
|
1283
603
|
} catch (error) {
|
1284
|
-
|
1285
|
-
erroredChunk.status = ERRORED;
|
1286
|
-
erroredChunk.reason = error;
|
604
|
+
(chunk.status = "rejected"), (chunk.reason = error);
|
1287
605
|
}
|
1288
|
-
}
|
1289
|
-
// error upon read. Also notify any pending promises.
|
1290
|
-
|
1291
|
-
|
606
|
+
}
|
1292
607
|
function reportGlobalError(response, error) {
|
1293
|
-
response._chunks.forEach(chunk
|
1294
|
-
|
1295
|
-
// trigger an error but if it wasn't then we need to
|
1296
|
-
// because we won't be getting any new data to resolve it.
|
1297
|
-
if (chunk.status === PENDING) {
|
1298
|
-
triggerErrorOnChunk(chunk, error);
|
1299
|
-
}
|
608
|
+
response._chunks.forEach(function (chunk) {
|
609
|
+
"pending" === chunk.status && triggerErrorOnChunk(chunk, error);
|
1300
610
|
});
|
1301
611
|
}
|
1302
|
-
|
1303
|
-
function createElement(type, key, props, owner) // DEV-only
|
1304
|
-
{
|
1305
|
-
let element;
|
1306
|
-
|
1307
|
-
{
|
1308
|
-
element = {
|
1309
|
-
// This tag allows us to uniquely identify this as a React Element
|
1310
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
1311
|
-
type,
|
1312
|
-
key,
|
1313
|
-
ref: null,
|
1314
|
-
props
|
1315
|
-
};
|
1316
|
-
}
|
1317
|
-
|
1318
|
-
return element;
|
1319
|
-
}
|
1320
|
-
|
1321
|
-
function createLazyChunkWrapper(chunk) {
|
1322
|
-
const lazyType = {
|
1323
|
-
$$typeof: REACT_LAZY_TYPE,
|
1324
|
-
_payload: chunk,
|
1325
|
-
_init: readChunk
|
1326
|
-
};
|
1327
|
-
|
1328
|
-
return lazyType;
|
1329
|
-
}
|
1330
|
-
|
1331
612
|
function getChunk(response, id) {
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
chunk
|
1337
|
-
chunks.set(id, chunk);
|
1338
|
-
}
|
1339
|
-
|
613
|
+
var chunks = response._chunks,
|
614
|
+
chunk = chunks.get(id);
|
615
|
+
chunk ||
|
616
|
+
((chunk = new Chunk("pending", null, null, response)),
|
617
|
+
chunks.set(id, chunk));
|
1340
618
|
return chunk;
|
1341
619
|
}
|
1342
|
-
|
1343
620
|
function createModelResolver(chunk, parentObject, key, cyclic, response, map) {
|
1344
|
-
let blocked;
|
1345
|
-
|
1346
621
|
if (initializingChunkBlockedModel) {
|
1347
|
-
blocked = initializingChunkBlockedModel;
|
1348
|
-
|
1349
|
-
|
1350
|
-
blocked.deps++;
|
1351
|
-
}
|
1352
|
-
} else {
|
622
|
+
var blocked = initializingChunkBlockedModel;
|
623
|
+
cyclic || blocked.deps++;
|
624
|
+
} else
|
1353
625
|
blocked = initializingChunkBlockedModel = {
|
1354
626
|
deps: cyclic ? 0 : 1,
|
1355
|
-
value: null
|
1356
|
-
};
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
blocked.deps--;
|
1368
|
-
|
1369
|
-
if (blocked.deps === 0) {
|
1370
|
-
if (chunk.status !== BLOCKED) {
|
1371
|
-
return;
|
1372
|
-
}
|
1373
|
-
|
1374
|
-
const resolveListeners = chunk.value;
|
1375
|
-
const initializedChunk = chunk;
|
1376
|
-
initializedChunk.status = INITIALIZED;
|
1377
|
-
initializedChunk.value = blocked.value;
|
1378
|
-
|
1379
|
-
if (resolveListeners !== null) {
|
1380
|
-
wakeChunk(resolveListeners, blocked.value);
|
1381
|
-
}
|
1382
|
-
}
|
627
|
+
value: null
|
628
|
+
};
|
629
|
+
return function (value) {
|
630
|
+
parentObject[key] = map(response, value);
|
631
|
+
"" === key && null === blocked.value && (blocked.value = parentObject[key]);
|
632
|
+
blocked.deps--;
|
633
|
+
0 === blocked.deps &&
|
634
|
+
"blocked" === chunk.status &&
|
635
|
+
((value = chunk.value),
|
636
|
+
(chunk.status = "fulfilled"),
|
637
|
+
(chunk.value = blocked.value),
|
638
|
+
null !== value && wakeChunk(value, blocked.value));
|
1383
639
|
};
|
1384
640
|
}
|
1385
|
-
|
1386
641
|
function createModelReject(chunk) {
|
1387
|
-
return
|
642
|
+
return function (error) {
|
643
|
+
return triggerErrorOnChunk(chunk, error);
|
644
|
+
};
|
1388
645
|
}
|
1389
|
-
|
1390
646
|
function createServerReferenceProxy(response, metaData) {
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
const bound = p.value;
|
1404
|
-
return callServer(metaData.id, bound.concat(args));
|
1405
|
-
} // Since this is a fake Promise whose .then doesn't chain, we have to wrap it.
|
1406
|
-
// TODO: Remove the wrapper once that's fixed.
|
1407
|
-
|
1408
|
-
|
1409
|
-
return Promise.resolve(p).then(function (bound) {
|
1410
|
-
return callServer(metaData.id, bound.concat(args));
|
1411
|
-
});
|
1412
|
-
};
|
1413
|
-
|
647
|
+
function proxy() {
|
648
|
+
var args = Array.prototype.slice.call(arguments),
|
649
|
+
p = metaData.bound;
|
650
|
+
return p
|
651
|
+
? "fulfilled" === p.status
|
652
|
+
? callServer(metaData.id, p.value.concat(args))
|
653
|
+
: Promise.resolve(p).then(function (bound) {
|
654
|
+
return callServer(metaData.id, bound.concat(args));
|
655
|
+
})
|
656
|
+
: callServer(metaData.id, args);
|
657
|
+
}
|
658
|
+
var callServer = response._callServer;
|
1414
659
|
registerServerReference(proxy, metaData, response._encodeFormAction);
|
1415
660
|
return proxy;
|
1416
661
|
}
|
1417
|
-
|
1418
662
|
function getOutlinedModel(response, id, parentObject, key, map) {
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
initializeModelChunk(chunk);
|
663
|
+
id = getChunk(response, id);
|
664
|
+
switch (id.status) {
|
665
|
+
case "resolved_model":
|
666
|
+
initializeModelChunk(id);
|
1424
667
|
break;
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
case
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
668
|
+
case "resolved_module":
|
669
|
+
initializeModuleChunk(id);
|
670
|
+
}
|
671
|
+
switch (id.status) {
|
672
|
+
case "fulfilled":
|
673
|
+
return map(response, id.value);
|
674
|
+
case "pending":
|
675
|
+
case "blocked":
|
676
|
+
case "cyclic":
|
677
|
+
var parentChunk = initializingChunk;
|
678
|
+
id.then(
|
679
|
+
createModelResolver(
|
680
|
+
parentChunk,
|
681
|
+
parentObject,
|
682
|
+
key,
|
683
|
+
"cyclic" === id.status,
|
684
|
+
response,
|
685
|
+
map
|
686
|
+
),
|
687
|
+
createModelReject(parentChunk)
|
688
|
+
);
|
1443
689
|
return null;
|
1444
|
-
|
1445
690
|
default:
|
1446
|
-
throw
|
691
|
+
throw id.reason;
|
1447
692
|
}
|
1448
693
|
}
|
1449
|
-
|
1450
694
|
function createMap(response, model) {
|
1451
695
|
return new Map(model);
|
1452
696
|
}
|
1453
|
-
|
1454
697
|
function createSet(response, model) {
|
1455
698
|
return new Set(model);
|
1456
699
|
}
|
1457
|
-
|
1458
700
|
function createFormData(response, model) {
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
return
|
701
|
+
response = new FormData();
|
702
|
+
for (var i = 0; i < model.length; i++)
|
703
|
+
response.append(model[i][0], model[i][1]);
|
704
|
+
return response;
|
705
|
+
}
|
706
|
+
function extractIterator(response, model) {
|
707
|
+
return model[Symbol.iterator]();
|
1466
708
|
}
|
1467
|
-
|
1468
709
|
function createModel(response, model) {
|
1469
710
|
return model;
|
1470
711
|
}
|
1471
|
-
|
1472
712
|
function parseModelString(response, parentObject, key, value) {
|
1473
|
-
if (value[0]
|
1474
|
-
if (
|
1475
|
-
// A very common symbol.
|
1476
|
-
return REACT_ELEMENT_TYPE;
|
1477
|
-
}
|
1478
|
-
|
713
|
+
if ("$" === value[0]) {
|
714
|
+
if ("$" === value) return REACT_ELEMENT_TYPE;
|
1479
715
|
switch (value[1]) {
|
1480
|
-
case
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
case
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
case
|
1550
|
-
|
1551
|
-
|
1552
|
-
return undefined;
|
1553
|
-
}
|
1554
|
-
|
1555
|
-
case 'K':
|
1556
|
-
{
|
1557
|
-
// FormData
|
1558
|
-
const id = parseInt(value.slice(2), 16);
|
1559
|
-
return getOutlinedModel(response, id, parentObject, key, createFormData);
|
1560
|
-
}
|
1561
|
-
|
1562
|
-
case 'I':
|
1563
|
-
{
|
1564
|
-
// $Infinity
|
1565
|
-
return Infinity;
|
1566
|
-
}
|
1567
|
-
|
1568
|
-
case '-':
|
1569
|
-
{
|
1570
|
-
// $-0 or $-Infinity
|
1571
|
-
if (value === '$-0') {
|
1572
|
-
return -0;
|
1573
|
-
} else {
|
1574
|
-
return -Infinity;
|
1575
|
-
}
|
1576
|
-
}
|
1577
|
-
|
1578
|
-
case 'N':
|
1579
|
-
{
|
1580
|
-
// $NaN
|
1581
|
-
return NaN;
|
1582
|
-
}
|
1583
|
-
|
1584
|
-
case 'u':
|
1585
|
-
{
|
1586
|
-
// matches "$undefined"
|
1587
|
-
// Special encoding for `undefined` which can't be serialized as JSON otherwise.
|
1588
|
-
return undefined;
|
1589
|
-
}
|
1590
|
-
|
1591
|
-
case 'D':
|
1592
|
-
{
|
1593
|
-
// Date
|
1594
|
-
return new Date(Date.parse(value.slice(2)));
|
1595
|
-
}
|
1596
|
-
|
1597
|
-
case 'n':
|
1598
|
-
{
|
1599
|
-
// BigInt
|
1600
|
-
return BigInt(value.slice(2));
|
1601
|
-
}
|
1602
|
-
|
1603
|
-
case 'E':
|
1604
|
-
|
716
|
+
case "$":
|
717
|
+
return value.slice(1);
|
718
|
+
case "L":
|
719
|
+
return (
|
720
|
+
(parentObject = parseInt(value.slice(2), 16)),
|
721
|
+
(response = getChunk(response, parentObject)),
|
722
|
+
{ $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk }
|
723
|
+
);
|
724
|
+
case "@":
|
725
|
+
if (2 === value.length) return new Promise(function () {});
|
726
|
+
parentObject = parseInt(value.slice(2), 16);
|
727
|
+
return getChunk(response, parentObject);
|
728
|
+
case "S":
|
729
|
+
return Symbol.for(value.slice(2));
|
730
|
+
case "F":
|
731
|
+
return (
|
732
|
+
(value = parseInt(value.slice(2), 16)),
|
733
|
+
getOutlinedModel(
|
734
|
+
response,
|
735
|
+
value,
|
736
|
+
parentObject,
|
737
|
+
key,
|
738
|
+
createServerReferenceProxy
|
739
|
+
)
|
740
|
+
);
|
741
|
+
case "T":
|
742
|
+
parentObject = parseInt(value.slice(2), 16);
|
743
|
+
response = response._tempRefs;
|
744
|
+
if (null == response)
|
745
|
+
throw Error(
|
746
|
+
"Missing a temporary reference set but the RSC response returned a temporary reference. Pass a temporaryReference option with the set that was used with the reply."
|
747
|
+
);
|
748
|
+
if (0 > parentObject || parentObject >= response.length)
|
749
|
+
throw Error(
|
750
|
+
"The RSC response contained a reference that doesn't exist in the temporary reference set. Always pass the matching set that was used to create the reply when parsing its response."
|
751
|
+
);
|
752
|
+
return response[parentObject];
|
753
|
+
case "Q":
|
754
|
+
return (
|
755
|
+
(value = parseInt(value.slice(2), 16)),
|
756
|
+
getOutlinedModel(response, value, parentObject, key, createMap)
|
757
|
+
);
|
758
|
+
case "W":
|
759
|
+
return (
|
760
|
+
(value = parseInt(value.slice(2), 16)),
|
761
|
+
getOutlinedModel(response, value, parentObject, key, createSet)
|
762
|
+
);
|
763
|
+
case "B":
|
764
|
+
return;
|
765
|
+
case "K":
|
766
|
+
return (
|
767
|
+
(value = parseInt(value.slice(2), 16)),
|
768
|
+
getOutlinedModel(response, value, parentObject, key, createFormData)
|
769
|
+
);
|
770
|
+
case "i":
|
771
|
+
return (
|
772
|
+
(value = parseInt(value.slice(2), 16)),
|
773
|
+
getOutlinedModel(response, value, parentObject, key, extractIterator)
|
774
|
+
);
|
775
|
+
case "I":
|
776
|
+
return Infinity;
|
777
|
+
case "-":
|
778
|
+
return "$-0" === value ? -0 : -Infinity;
|
779
|
+
case "N":
|
780
|
+
return NaN;
|
781
|
+
case "u":
|
782
|
+
return;
|
783
|
+
case "D":
|
784
|
+
return new Date(Date.parse(value.slice(2)));
|
785
|
+
case "n":
|
786
|
+
return BigInt(value.slice(2));
|
1605
787
|
default:
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
}
|
788
|
+
return (
|
789
|
+
(value = parseInt(value.slice(1), 16)),
|
790
|
+
getOutlinedModel(response, value, parentObject, key, createModel)
|
791
|
+
);
|
1611
792
|
}
|
1612
793
|
}
|
1613
|
-
|
1614
|
-
return value;
|
1615
|
-
}
|
1616
|
-
|
1617
|
-
function parseModelTuple(response, value) {
|
1618
|
-
const tuple = value;
|
1619
|
-
|
1620
|
-
if (tuple[0] === REACT_ELEMENT_TYPE) {
|
1621
|
-
// TODO: Consider having React just directly accept these arrays as elements.
|
1622
|
-
// Or even change the ReactElement type to be an array.
|
1623
|
-
return createElement(tuple[1], tuple[2], tuple[3]);
|
1624
|
-
}
|
1625
|
-
|
1626
794
|
return value;
|
1627
795
|
}
|
1628
|
-
|
1629
796
|
function missingCall() {
|
1630
|
-
throw
|
797
|
+
throw Error(
|
798
|
+
'Trying to call a function from "use server" but the callServer option was not implemented in your router runtime.'
|
799
|
+
);
|
1631
800
|
}
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
801
|
+
function resolveModule(response, id, model) {
|
802
|
+
var chunks = response._chunks,
|
803
|
+
chunk = chunks.get(id);
|
804
|
+
model = JSON.parse(model, response._fromJSON);
|
805
|
+
var clientReference = resolveClientReference(response._bundlerConfig, model);
|
806
|
+
prepareDestinationWithChunks(
|
807
|
+
response._moduleLoading,
|
808
|
+
model[1],
|
809
|
+
response._nonce
|
810
|
+
);
|
811
|
+
if ((model = preloadModule(clientReference))) {
|
812
|
+
if (chunk) {
|
813
|
+
var blockedChunk = chunk;
|
814
|
+
blockedChunk.status = "blocked";
|
815
|
+
} else
|
816
|
+
(blockedChunk = new Chunk("blocked", null, null, response)),
|
817
|
+
chunks.set(id, blockedChunk);
|
818
|
+
model.then(
|
819
|
+
function () {
|
820
|
+
return resolveModuleChunk(blockedChunk, clientReference);
|
821
|
+
},
|
822
|
+
function (error) {
|
823
|
+
return triggerErrorOnChunk(blockedChunk, error);
|
824
|
+
}
|
825
|
+
);
|
826
|
+
} else
|
827
|
+
chunk
|
828
|
+
? resolveModuleChunk(chunk, clientReference)
|
829
|
+
: chunks.set(
|
830
|
+
id,
|
831
|
+
new Chunk("resolved_module", clientReference, null, response)
|
832
|
+
);
|
833
|
+
}
|
834
|
+
function createFromJSONCallback(response) {
|
835
|
+
return function (key, value) {
|
836
|
+
return "string" === typeof value
|
837
|
+
? parseModelString(response, this, key, value)
|
838
|
+
: "object" === typeof value && null !== value
|
839
|
+
? ((key =
|
840
|
+
value[0] === REACT_ELEMENT_TYPE
|
841
|
+
? {
|
842
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
843
|
+
type: value[1],
|
844
|
+
key: value[2],
|
845
|
+
ref: null,
|
846
|
+
props: value[3]
|
847
|
+
}
|
848
|
+
: value),
|
849
|
+
key)
|
850
|
+
: value;
|
851
|
+
};
|
852
|
+
}
|
853
|
+
function noServerCall() {
|
854
|
+
throw Error(
|
855
|
+
"Server Functions cannot be called during initial render. This would create a fetch waterfall. Try to use a Server Component to pass data to Client Components instead."
|
856
|
+
);
|
857
|
+
}
|
858
|
+
function createResponseFromOptions(options) {
|
859
|
+
var bundlerConfig = options.ssrManifest.moduleMap,
|
860
|
+
moduleLoading = options.ssrManifest.moduleLoading,
|
861
|
+
encodeFormAction = options.encodeFormAction,
|
862
|
+
nonce = "string" === typeof options.nonce ? options.nonce : void 0;
|
863
|
+
options =
|
864
|
+
options && options.temporaryReferences
|
865
|
+
? options.temporaryReferences
|
866
|
+
: void 0;
|
867
|
+
var chunks = new Map();
|
868
|
+
bundlerConfig = {
|
1636
869
|
_bundlerConfig: bundlerConfig,
|
1637
870
|
_moduleLoading: moduleLoading,
|
1638
|
-
_callServer:
|
871
|
+
_callServer: void 0 !== noServerCall ? noServerCall : missingCall,
|
1639
872
|
_encodeFormAction: encodeFormAction,
|
1640
873
|
_nonce: nonce,
|
1641
874
|
_chunks: chunks,
|
1642
|
-
_stringDecoder:
|
875
|
+
_stringDecoder: new TextDecoder(),
|
1643
876
|
_fromJSON: null,
|
1644
877
|
_rowState: 0,
|
1645
878
|
_rowID: 0,
|
1646
879
|
_rowTag: 0,
|
1647
880
|
_rowLength: 0,
|
1648
881
|
_buffer: [],
|
1649
|
-
_tempRefs:
|
1650
|
-
};
|
1651
|
-
|
1652
|
-
|
1653
|
-
return response;
|
1654
|
-
}
|
1655
|
-
|
1656
|
-
function resolveModel(response, id, model) {
|
1657
|
-
const chunks = response._chunks;
|
1658
|
-
const chunk = chunks.get(id);
|
1659
|
-
|
1660
|
-
if (!chunk) {
|
1661
|
-
chunks.set(id, createResolvedModelChunk(response, model));
|
1662
|
-
} else {
|
1663
|
-
resolveModelChunk(chunk, model);
|
1664
|
-
}
|
1665
|
-
}
|
1666
|
-
|
1667
|
-
function resolveText(response, id, text) {
|
1668
|
-
const chunks = response._chunks;
|
1669
|
-
|
1670
|
-
chunks.set(id, createInitializedTextChunk(response, text));
|
1671
|
-
}
|
1672
|
-
|
1673
|
-
function resolveModule(response, id, model) {
|
1674
|
-
const chunks = response._chunks;
|
1675
|
-
const chunk = chunks.get(id);
|
1676
|
-
const clientReferenceMetadata = parseModel(response, model);
|
1677
|
-
const clientReference = resolveClientReference(response._bundlerConfig, clientReferenceMetadata);
|
1678
|
-
prepareDestinationForModule(response._moduleLoading, response._nonce, clientReferenceMetadata); // TODO: Add an option to encode modules that are lazy loaded.
|
1679
|
-
// For now we preload all modules as early as possible since it's likely
|
1680
|
-
// that we'll need them.
|
1681
|
-
|
1682
|
-
const promise = preloadModule(clientReference);
|
1683
|
-
|
1684
|
-
if (promise) {
|
1685
|
-
let blockedChunk;
|
1686
|
-
|
1687
|
-
if (!chunk) {
|
1688
|
-
// Technically, we should just treat promise as the chunk in this
|
1689
|
-
// case. Because it'll just behave as any other promise.
|
1690
|
-
blockedChunk = createBlockedChunk(response);
|
1691
|
-
chunks.set(id, blockedChunk);
|
1692
|
-
} else {
|
1693
|
-
// This can't actually happen because we don't have any forward
|
1694
|
-
// references to modules.
|
1695
|
-
blockedChunk = chunk;
|
1696
|
-
blockedChunk.status = BLOCKED;
|
1697
|
-
}
|
1698
|
-
|
1699
|
-
promise.then(() => resolveModuleChunk(blockedChunk, clientReference), error => triggerErrorOnChunk(blockedChunk, error));
|
1700
|
-
} else {
|
1701
|
-
if (!chunk) {
|
1702
|
-
chunks.set(id, createResolvedModuleChunk(response, clientReference));
|
1703
|
-
} else {
|
1704
|
-
// This can't actually happen because we don't have any forward
|
1705
|
-
// references to modules.
|
1706
|
-
resolveModuleChunk(chunk, clientReference);
|
1707
|
-
}
|
1708
|
-
}
|
1709
|
-
}
|
1710
|
-
|
1711
|
-
function resolveErrorProd(response, id, digest) {
|
1712
|
-
|
1713
|
-
const error = new Error('An error occurred in the Server Components render. The specific message is omitted in production' + ' builds to avoid leaking sensitive details. A digest property is included on this error instance which' + ' may provide additional details about the nature of the error.');
|
1714
|
-
error.stack = 'Error: ' + error.message;
|
1715
|
-
error.digest = digest;
|
1716
|
-
const errorWithDigest = error;
|
1717
|
-
const chunks = response._chunks;
|
1718
|
-
const chunk = chunks.get(id);
|
1719
|
-
|
1720
|
-
if (!chunk) {
|
1721
|
-
chunks.set(id, createErrorChunk(response, errorWithDigest));
|
1722
|
-
} else {
|
1723
|
-
triggerErrorOnChunk(chunk, errorWithDigest);
|
1724
|
-
}
|
1725
|
-
}
|
1726
|
-
|
1727
|
-
function resolveHint(response, code, model) {
|
1728
|
-
const hintModel = parseModel(response, model);
|
1729
|
-
dispatchHint(code, hintModel);
|
1730
|
-
}
|
1731
|
-
|
1732
|
-
function processFullRow(response, id, tag, buffer, chunk) {
|
1733
|
-
|
1734
|
-
const stringDecoder = response._stringDecoder;
|
1735
|
-
let row = '';
|
1736
|
-
|
1737
|
-
for (let i = 0; i < buffer.length; i++) {
|
1738
|
-
row += readPartialStringChunk(stringDecoder, buffer[i]);
|
1739
|
-
}
|
1740
|
-
|
1741
|
-
row += readFinalStringChunk(stringDecoder, chunk);
|
1742
|
-
|
1743
|
-
switch (tag) {
|
1744
|
-
case 73
|
1745
|
-
/* "I" */
|
1746
|
-
:
|
1747
|
-
{
|
1748
|
-
resolveModule(response, id, row);
|
1749
|
-
return;
|
1750
|
-
}
|
1751
|
-
|
1752
|
-
case 72
|
1753
|
-
/* "H" */
|
1754
|
-
:
|
1755
|
-
{
|
1756
|
-
const code = row[0];
|
1757
|
-
resolveHint(response, code, row.slice(1));
|
1758
|
-
return;
|
1759
|
-
}
|
1760
|
-
|
1761
|
-
case 69
|
1762
|
-
/* "E" */
|
1763
|
-
:
|
1764
|
-
{
|
1765
|
-
const errorInfo = JSON.parse(row);
|
1766
|
-
|
1767
|
-
{
|
1768
|
-
resolveErrorProd(response, id, errorInfo.digest);
|
1769
|
-
}
|
1770
|
-
|
1771
|
-
return;
|
1772
|
-
}
|
1773
|
-
|
1774
|
-
case 84
|
1775
|
-
/* "T" */
|
1776
|
-
:
|
1777
|
-
{
|
1778
|
-
resolveText(response, id, row);
|
1779
|
-
return;
|
1780
|
-
}
|
1781
|
-
|
1782
|
-
case 68
|
1783
|
-
/* "D" */
|
1784
|
-
:
|
1785
|
-
|
1786
|
-
case 87
|
1787
|
-
/* "W" */
|
1788
|
-
:
|
1789
|
-
{
|
1790
|
-
|
1791
|
-
throw new Error('Failed to read a RSC payload created by a development version of React ' + 'on the server while using a production version on the client. Always use ' + 'matching versions on the server and the client.');
|
1792
|
-
}
|
1793
|
-
|
1794
|
-
case 82
|
1795
|
-
/* "R" */
|
1796
|
-
:
|
1797
|
-
// Fallthrough
|
1798
|
-
|
1799
|
-
case 114
|
1800
|
-
/* "r" */
|
1801
|
-
:
|
1802
|
-
// Fallthrough
|
1803
|
-
|
1804
|
-
case 88
|
1805
|
-
/* "X" */
|
1806
|
-
:
|
1807
|
-
// Fallthrough
|
1808
|
-
|
1809
|
-
case 120
|
1810
|
-
/* "x" */
|
1811
|
-
:
|
1812
|
-
// Fallthrough
|
1813
|
-
|
1814
|
-
case 67
|
1815
|
-
/* "C" */
|
1816
|
-
:
|
1817
|
-
// Fallthrough
|
1818
|
-
|
1819
|
-
case 80
|
1820
|
-
/* "P" */
|
1821
|
-
:
|
1822
|
-
// Fallthrough
|
1823
|
-
|
1824
|
-
default:
|
1825
|
-
/* """ "{" "[" "t" "f" "n" "0" - "9" */
|
1826
|
-
{
|
1827
|
-
// We assume anything else is JSON.
|
1828
|
-
resolveModel(response, id, row);
|
1829
|
-
return;
|
1830
|
-
}
|
1831
|
-
}
|
882
|
+
_tempRefs: options
|
883
|
+
};
|
884
|
+
bundlerConfig._fromJSON = createFromJSONCallback(bundlerConfig);
|
885
|
+
return bundlerConfig;
|
1832
886
|
}
|
1833
|
-
|
1834
|
-
function
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
resolvedRowTag === 114
|
1878
|
-
/* "r" */
|
1879
|
-
|| resolvedRowTag === 120
|
1880
|
-
/* "x" */
|
1881
|
-
) {
|
1882
|
-
rowTag = resolvedRowTag;
|
1883
|
-
rowState = ROW_CHUNK_BY_NEWLINE;
|
1884
|
-
i++;
|
1885
|
-
} else {
|
1886
|
-
rowTag = 0;
|
1887
|
-
rowState = ROW_CHUNK_BY_NEWLINE; // This was an unknown tag so it was probably part of the data.
|
1888
|
-
}
|
1889
|
-
|
1890
|
-
continue;
|
1891
|
-
}
|
1892
|
-
|
1893
|
-
case ROW_LENGTH:
|
1894
|
-
{
|
1895
|
-
const byte = chunk[i++];
|
1896
|
-
|
1897
|
-
if (byte === 44
|
1898
|
-
/* "," */
|
1899
|
-
) {
|
1900
|
-
// Finished the rowLength, next we'll buffer up to that length.
|
1901
|
-
rowState = ROW_CHUNK_BY_LENGTH;
|
1902
|
-
} else {
|
1903
|
-
rowLength = rowLength << 4 | (byte > 96 ? byte - 87 : byte - 48);
|
1904
|
-
}
|
1905
|
-
|
1906
|
-
continue;
|
1907
|
-
}
|
1908
|
-
|
1909
|
-
case ROW_CHUNK_BY_NEWLINE:
|
1910
|
-
{
|
1911
|
-
// We're looking for a newline
|
1912
|
-
lastIdx = chunk.indexOf(10
|
1913
|
-
/* "\n" */
|
1914
|
-
, i);
|
1915
|
-
break;
|
887
|
+
function startReadingFromStream(response, stream) {
|
888
|
+
function progress(_ref) {
|
889
|
+
var value = _ref.value;
|
890
|
+
if (_ref.done) reportGlobalError(response, Error("Connection closed."));
|
891
|
+
else {
|
892
|
+
var i = 0,
|
893
|
+
rowState = response._rowState,
|
894
|
+
rowID = response._rowID,
|
895
|
+
rowTag = response._rowTag,
|
896
|
+
rowLength = response._rowLength;
|
897
|
+
_ref = response._buffer;
|
898
|
+
for (var chunkLength = value.length; i < chunkLength; ) {
|
899
|
+
var lastIdx = -1;
|
900
|
+
switch (rowState) {
|
901
|
+
case 0:
|
902
|
+
lastIdx = value[i++];
|
903
|
+
58 === lastIdx
|
904
|
+
? (rowState = 1)
|
905
|
+
: (rowID =
|
906
|
+
(rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
|
907
|
+
continue;
|
908
|
+
case 1:
|
909
|
+
rowState = value[i];
|
910
|
+
84 === rowState
|
911
|
+
? ((rowTag = rowState), (rowState = 2), i++)
|
912
|
+
: (64 < rowState && 91 > rowState) ||
|
913
|
+
114 === rowState ||
|
914
|
+
120 === rowState
|
915
|
+
? ((rowTag = rowState), (rowState = 3), i++)
|
916
|
+
: ((rowTag = 0), (rowState = 3));
|
917
|
+
continue;
|
918
|
+
case 2:
|
919
|
+
lastIdx = value[i++];
|
920
|
+
44 === lastIdx
|
921
|
+
? (rowState = 4)
|
922
|
+
: (rowLength =
|
923
|
+
(rowLength << 4) |
|
924
|
+
(96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
|
925
|
+
continue;
|
926
|
+
case 3:
|
927
|
+
lastIdx = value.indexOf(10, i);
|
928
|
+
break;
|
929
|
+
case 4:
|
930
|
+
(lastIdx = i + rowLength), lastIdx > value.length && (lastIdx = -1);
|
1916
931
|
}
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
932
|
+
var offset = value.byteOffset + i;
|
933
|
+
if (-1 < lastIdx) {
|
934
|
+
i = new Uint8Array(value.buffer, offset, lastIdx - i);
|
935
|
+
rowLength = response;
|
936
|
+
offset = rowTag;
|
937
|
+
var stringDecoder = rowLength._stringDecoder;
|
938
|
+
rowTag = "";
|
939
|
+
for (var i$jscomp$0 = 0; i$jscomp$0 < _ref.length; i$jscomp$0++)
|
940
|
+
rowTag += stringDecoder.decode(_ref[i$jscomp$0], decoderOptions);
|
941
|
+
rowTag += stringDecoder.decode(i);
|
942
|
+
switch (offset) {
|
943
|
+
case 73:
|
944
|
+
resolveModule(rowLength, rowID, rowTag);
|
945
|
+
break;
|
946
|
+
case 72:
|
947
|
+
rowID = rowTag[0];
|
948
|
+
rowTag = rowTag.slice(1);
|
949
|
+
rowLength = JSON.parse(rowTag, rowLength._fromJSON);
|
950
|
+
rowTag = ReactDOMSharedInternals.d;
|
951
|
+
switch (rowID) {
|
952
|
+
case "D":
|
953
|
+
rowTag.D(rowLength);
|
954
|
+
break;
|
955
|
+
case "C":
|
956
|
+
"string" === typeof rowLength
|
957
|
+
? rowTag.C(rowLength)
|
958
|
+
: rowTag.C(rowLength[0], rowLength[1]);
|
959
|
+
break;
|
960
|
+
case "L":
|
961
|
+
rowID = rowLength[0];
|
962
|
+
i = rowLength[1];
|
963
|
+
3 === rowLength.length
|
964
|
+
? rowTag.L(rowID, i, rowLength[2])
|
965
|
+
: rowTag.L(rowID, i);
|
966
|
+
break;
|
967
|
+
case "m":
|
968
|
+
"string" === typeof rowLength
|
969
|
+
? rowTag.m(rowLength)
|
970
|
+
: rowTag.m(rowLength[0], rowLength[1]);
|
971
|
+
break;
|
972
|
+
case "X":
|
973
|
+
"string" === typeof rowLength
|
974
|
+
? rowTag.X(rowLength)
|
975
|
+
: rowTag.X(rowLength[0], rowLength[1]);
|
976
|
+
break;
|
977
|
+
case "S":
|
978
|
+
"string" === typeof rowLength
|
979
|
+
? rowTag.S(rowLength)
|
980
|
+
: rowTag.S(
|
981
|
+
rowLength[0],
|
982
|
+
0 === rowLength[1] ? void 0 : rowLength[1],
|
983
|
+
3 === rowLength.length ? rowLength[2] : void 0
|
984
|
+
);
|
985
|
+
break;
|
986
|
+
case "M":
|
987
|
+
"string" === typeof rowLength
|
988
|
+
? rowTag.M(rowLength)
|
989
|
+
: rowTag.M(rowLength[0], rowLength[1]);
|
990
|
+
}
|
991
|
+
break;
|
992
|
+
case 69:
|
993
|
+
rowTag = JSON.parse(rowTag);
|
994
|
+
i = rowTag.digest;
|
995
|
+
rowTag = Error(
|
996
|
+
"An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error."
|
997
|
+
);
|
998
|
+
rowTag.stack = "Error: " + rowTag.message;
|
999
|
+
rowTag.digest = i;
|
1000
|
+
i = rowLength._chunks;
|
1001
|
+
(offset = i.get(rowID))
|
1002
|
+
? triggerErrorOnChunk(offset, rowTag)
|
1003
|
+
: i.set(rowID, new Chunk("rejected", null, rowTag, rowLength));
|
1004
|
+
break;
|
1005
|
+
case 84:
|
1006
|
+
rowLength._chunks.set(
|
1007
|
+
rowID,
|
1008
|
+
new Chunk("fulfilled", rowTag, null, rowLength)
|
1009
|
+
);
|
1010
|
+
break;
|
1011
|
+
case 68:
|
1012
|
+
case 87:
|
1013
|
+
throw Error(
|
1014
|
+
"Failed to read a RSC payload created by a development version of React on the server while using a production version on the client. Always use matching versions on the server and the client."
|
1015
|
+
);
|
1016
|
+
default:
|
1017
|
+
(i = rowLength._chunks),
|
1018
|
+
(offset = i.get(rowID))
|
1019
|
+
? ((rowLength = offset),
|
1020
|
+
(rowID = rowTag),
|
1021
|
+
"pending" === rowLength.status &&
|
1022
|
+
((rowTag = rowLength.value),
|
1023
|
+
(i = rowLength.reason),
|
1024
|
+
(rowLength.status = "resolved_model"),
|
1025
|
+
(rowLength.value = rowID),
|
1026
|
+
null !== rowTag &&
|
1027
|
+
(initializeModelChunk(rowLength),
|
1028
|
+
wakeChunkIfInitialized(rowLength, rowTag, i))))
|
1029
|
+
: i.set(
|
1030
|
+
rowID,
|
1031
|
+
new Chunk("resolved_model", rowTag, null, rowLength)
|
1032
|
+
);
|
1925
1033
|
}
|
1926
|
-
|
1034
|
+
i = lastIdx;
|
1035
|
+
3 === rowState && i++;
|
1036
|
+
rowLength = rowID = rowTag = rowState = 0;
|
1037
|
+
_ref.length = 0;
|
1038
|
+
} else {
|
1039
|
+
value = new Uint8Array(value.buffer, offset, value.byteLength - i);
|
1040
|
+
_ref.push(value);
|
1041
|
+
rowLength -= value.byteLength;
|
1927
1042
|
break;
|
1928
1043
|
}
|
1929
|
-
}
|
1930
|
-
|
1931
|
-
const offset = chunk.byteOffset + i;
|
1932
|
-
|
1933
|
-
if (lastIdx > -1) {
|
1934
|
-
// We found the last chunk of the row
|
1935
|
-
const length = lastIdx - i;
|
1936
|
-
const lastChunk = new Uint8Array(chunk.buffer, offset, length);
|
1937
|
-
processFullRow(response, rowID, rowTag, buffer, lastChunk); // Reset state machine for a new row
|
1938
|
-
|
1939
|
-
i = lastIdx;
|
1940
|
-
|
1941
|
-
if (rowState === ROW_CHUNK_BY_NEWLINE) {
|
1942
|
-
// If we're trailing by a newline we need to skip it.
|
1943
|
-
i++;
|
1944
1044
|
}
|
1945
|
-
|
1946
|
-
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
buffer.length = 0;
|
1951
|
-
} else {
|
1952
|
-
// The rest of this row is in a future chunk. We stash the rest of the
|
1953
|
-
// current chunk until we can process the full row.
|
1954
|
-
const length = chunk.byteLength - i;
|
1955
|
-
const remainingSlice = new Uint8Array(chunk.buffer, offset, length);
|
1956
|
-
buffer.push(remainingSlice); // Update how many bytes we're still waiting for. If we're looking for
|
1957
|
-
// a newline, this doesn't hurt since we'll just ignore it.
|
1958
|
-
|
1959
|
-
rowLength -= remainingSlice.byteLength;
|
1960
|
-
break;
|
1961
|
-
}
|
1962
|
-
}
|
1963
|
-
|
1964
|
-
response._rowState = rowState;
|
1965
|
-
response._rowID = rowID;
|
1966
|
-
response._rowTag = rowTag;
|
1967
|
-
response._rowLength = rowLength;
|
1968
|
-
}
|
1969
|
-
|
1970
|
-
function parseModel(response, json) {
|
1971
|
-
return JSON.parse(json, response._fromJSON);
|
1972
|
-
}
|
1973
|
-
|
1974
|
-
function createFromJSONCallback(response) {
|
1975
|
-
// $FlowFixMe[missing-this-annot]
|
1976
|
-
return function (key, value) {
|
1977
|
-
if (typeof value === 'string') {
|
1978
|
-
// We can't use .bind here because we need the "this" value.
|
1979
|
-
return parseModelString(response, this, key, value);
|
1980
|
-
}
|
1981
|
-
|
1982
|
-
if (typeof value === 'object' && value !== null) {
|
1983
|
-
return parseModelTuple(response, value);
|
1984
|
-
}
|
1985
|
-
|
1986
|
-
return value;
|
1987
|
-
};
|
1988
|
-
}
|
1989
|
-
|
1990
|
-
function close(response) {
|
1991
|
-
// In case there are any remaining unresolved chunks, they won't
|
1992
|
-
// be resolved now. So we need to issue an error to those.
|
1993
|
-
// Ideally we should be able to early bail out if we kept a
|
1994
|
-
// ref count of pending chunks.
|
1995
|
-
reportGlobalError(response, new Error('Connection closed.'));
|
1996
|
-
}
|
1997
|
-
|
1998
|
-
function noServerCall() {
|
1999
|
-
throw new Error('Server Functions cannot be called during initial render. ' + 'This would create a fetch waterfall. Try to use a Server Component ' + 'to pass data to Client Components instead.');
|
2000
|
-
}
|
2001
|
-
|
2002
|
-
function createServerReference(id, callServer) {
|
2003
|
-
return createServerReference$1(id, noServerCall);
|
2004
|
-
}
|
2005
|
-
|
2006
|
-
function createResponseFromOptions(options) {
|
2007
|
-
return createResponse(options.ssrManifest.moduleMap, options.ssrManifest.moduleLoading, noServerCall, options.encodeFormAction, typeof options.nonce === 'string' ? options.nonce : undefined, options && options.temporaryReferences ? options.temporaryReferences : undefined);
|
2008
|
-
}
|
2009
|
-
|
2010
|
-
function startReadingFromStream(response, stream) {
|
2011
|
-
const reader = stream.getReader();
|
2012
|
-
|
2013
|
-
function progress(_ref) {
|
2014
|
-
let done = _ref.done,
|
2015
|
-
value = _ref.value;
|
2016
|
-
|
2017
|
-
if (done) {
|
2018
|
-
close(response);
|
2019
|
-
return;
|
1045
|
+
response._rowState = rowState;
|
1046
|
+
response._rowID = rowID;
|
1047
|
+
response._rowTag = rowTag;
|
1048
|
+
response._rowLength = rowLength;
|
1049
|
+
return reader.read().then(progress).catch(error);
|
2020
1050
|
}
|
2021
|
-
|
2022
|
-
const buffer = value;
|
2023
|
-
processBinaryChunk(response, buffer);
|
2024
|
-
return reader.read().then(progress).catch(error);
|
2025
1051
|
}
|
2026
|
-
|
2027
1052
|
function error(e) {
|
2028
1053
|
reportGlobalError(response, e);
|
2029
1054
|
}
|
2030
|
-
|
1055
|
+
var reader = stream.getReader();
|
2031
1056
|
reader.read().then(progress).catch(error);
|
2032
1057
|
}
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
}
|
2039
|
-
|
2040
|
-
|
2041
|
-
|
2042
|
-
|
2043
|
-
|
2044
|
-
|
2045
|
-
|
2046
|
-
|
2047
|
-
|
2048
|
-
|
2049
|
-
|
2050
|
-
function
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
1058
|
+
exports.createFromFetch = function (promiseForResponse, options) {
|
1059
|
+
var response = createResponseFromOptions(options);
|
1060
|
+
promiseForResponse.then(
|
1061
|
+
function (r) {
|
1062
|
+
startReadingFromStream(response, r.body);
|
1063
|
+
},
|
1064
|
+
function (e) {
|
1065
|
+
reportGlobalError(response, e);
|
1066
|
+
}
|
1067
|
+
);
|
1068
|
+
return getChunk(response, 0);
|
1069
|
+
};
|
1070
|
+
exports.createFromReadableStream = function (stream, options) {
|
1071
|
+
options = createResponseFromOptions(options);
|
1072
|
+
startReadingFromStream(options, stream);
|
1073
|
+
return getChunk(options, 0);
|
1074
|
+
};
|
1075
|
+
exports.createServerReference = function (id) {
|
1076
|
+
return createServerReference$1(id, noServerCall);
|
1077
|
+
};
|
1078
|
+
exports.createTemporaryReferenceSet = function () {
|
1079
|
+
return [];
|
1080
|
+
};
|
1081
|
+
exports.encodeReply = function (value, options) {
|
1082
|
+
return new Promise(function (resolve, reject) {
|
1083
|
+
processReply(
|
1084
|
+
value,
|
1085
|
+
"",
|
1086
|
+
options && options.temporaryReferences
|
1087
|
+
? options.temporaryReferences
|
1088
|
+
: void 0,
|
1089
|
+
resolve,
|
1090
|
+
reject
|
1091
|
+
);
|
2055
1092
|
});
|
2056
|
-
}
|
2057
|
-
|
2058
|
-
exports.createFromFetch = createFromFetch;
|
2059
|
-
exports.createFromReadableStream = createFromReadableStream;
|
2060
|
-
exports.createServerReference = createServerReference;
|
2061
|
-
exports.createTemporaryReferenceSet = createTemporaryReferenceSet;
|
2062
|
-
exports.encodeReply = encodeReply;
|
1093
|
+
};
|