react-server-dom-webpack 19.0.0-rc.0 → 19.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/react-server-dom-webpack-client.browser.development.js +2483 -3269
- package/cjs/react-server-dom-webpack-client.browser.production.js +420 -215
- package/cjs/react-server-dom-webpack-client.edge.development.js +2656 -3546
- package/cjs/react-server-dom-webpack-client.edge.production.js +424 -218
- package/cjs/react-server-dom-webpack-client.node.development.js +2693 -3498
- package/cjs/react-server-dom-webpack-client.node.production.js +546 -263
- package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +2638 -3434
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.js +526 -257
- package/cjs/react-server-dom-webpack-plugin.js +11 -11
- package/cjs/react-server-dom-webpack-server.browser.development.js +3700 -5229
- package/cjs/react-server-dom-webpack-server.browser.production.js +447 -276
- package/cjs/react-server-dom-webpack-server.edge.development.js +3730 -5241
- package/cjs/react-server-dom-webpack-server.edge.production.js +435 -283
- package/cjs/react-server-dom-webpack-server.node.development.js +3794 -5384
- package/cjs/react-server-dom-webpack-server.node.production.js +428 -289
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +3756 -5310
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +421 -284
- package/esm/react-server-dom-webpack-node-loader.production.js +238 -44
- package/package.json +27 -4
- package/server.browser.js +12 -2
- package/server.edge.js +12 -2
- package/server.node.js +13 -2
- package/server.node.unbundled.js +13 -2
- package/static.browser.js +12 -0
- package/static.edge.js +12 -0
- package/static.js +6 -0
- package/static.node.js +12 -0
- package/static.node.unbundled.js +12 -0
@@ -14,15 +14,15 @@ var util = require("util"),
|
|
14
14
|
decoderOptions = { stream: !0 };
|
15
15
|
function resolveClientReference(bundlerConfig, metadata) {
|
16
16
|
var moduleExports = bundlerConfig[metadata[0]];
|
17
|
-
if ((bundlerConfig = moduleExports[metadata[2]]))
|
17
|
+
if ((bundlerConfig = moduleExports && moduleExports[metadata[2]]))
|
18
18
|
moduleExports = bundlerConfig.name;
|
19
19
|
else {
|
20
|
-
bundlerConfig = moduleExports["*"];
|
20
|
+
bundlerConfig = moduleExports && moduleExports["*"];
|
21
21
|
if (!bundlerConfig)
|
22
22
|
throw Error(
|
23
23
|
'Could not find the module "' +
|
24
24
|
metadata[0] +
|
25
|
-
'" in the React
|
25
|
+
'" in the React Server Consumer Manifest. This is probably a bug in the React Server Components bundler.'
|
26
26
|
);
|
27
27
|
moduleExports = metadata[2];
|
28
28
|
}
|
@@ -32,6 +32,12 @@ function resolveClientReference(bundlerConfig, metadata) {
|
|
32
32
|
async: 4 === metadata.length
|
33
33
|
};
|
34
34
|
}
|
35
|
+
function resolveServerReference(bundlerConfig, id) {
|
36
|
+
var idx = id.lastIndexOf("#");
|
37
|
+
bundlerConfig = id.slice(0, idx);
|
38
|
+
id = id.slice(idx + 1);
|
39
|
+
return { specifier: bundlerConfig, name: id };
|
40
|
+
}
|
35
41
|
var asyncModuleCache = new Map();
|
36
42
|
function preloadModule(metadata) {
|
37
43
|
var existingPromise = asyncModuleCache.get(metadata.specifier);
|
@@ -57,6 +63,16 @@ function preloadModule(metadata) {
|
|
57
63
|
asyncModuleCache.set(metadata.specifier, modulePromise);
|
58
64
|
return modulePromise;
|
59
65
|
}
|
66
|
+
function requireModule(metadata) {
|
67
|
+
var moduleExports = asyncModuleCache.get(metadata.specifier);
|
68
|
+
if ("fulfilled" === moduleExports.status) moduleExports = moduleExports.value;
|
69
|
+
else throw moduleExports.reason;
|
70
|
+
return "*" === metadata.name
|
71
|
+
? moduleExports
|
72
|
+
: "" === metadata.name
|
73
|
+
? moduleExports.default
|
74
|
+
: moduleExports[metadata.name];
|
75
|
+
}
|
60
76
|
function prepareDestinationWithChunks(moduleLoading, chunks, nonce$jscomp$0) {
|
61
77
|
if (null !== moduleLoading)
|
62
78
|
for (var i = 1; i < chunks.length; i += 2) {
|
@@ -101,10 +117,10 @@ function serializeNumber(number) {
|
|
101
117
|
? "$-0"
|
102
118
|
: number
|
103
119
|
: Infinity === number
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
120
|
+
? "$Infinity"
|
121
|
+
: -Infinity === number
|
122
|
+
? "$-Infinity"
|
123
|
+
: "$NaN";
|
108
124
|
}
|
109
125
|
function processReply(
|
110
126
|
root,
|
@@ -453,12 +469,17 @@ function processReply(
|
|
453
469
|
pendingParts = 0,
|
454
470
|
formData = null,
|
455
471
|
writtenObjects = new WeakMap(),
|
456
|
-
modelRoot = root
|
457
|
-
|
472
|
+
modelRoot = root,
|
473
|
+
json = serializeModel(root, 0);
|
458
474
|
null === formData
|
459
|
-
? resolve(
|
460
|
-
: (formData.set(formFieldPrefix + "0",
|
475
|
+
? resolve(json)
|
476
|
+
: (formData.set(formFieldPrefix + "0", json),
|
461
477
|
0 === pendingParts && resolve(formData));
|
478
|
+
return function () {
|
479
|
+
0 < pendingParts &&
|
480
|
+
((pendingParts = 0),
|
481
|
+
null === formData ? resolve(json) : resolve(formData));
|
482
|
+
};
|
462
483
|
}
|
463
484
|
var boundCache = new WeakMap();
|
464
485
|
function encodeFormData(reference) {
|
@@ -597,22 +618,38 @@ function bind() {
|
|
597
618
|
}
|
598
619
|
return newFn;
|
599
620
|
}
|
621
|
+
function createBoundServerReference(metaData, callServer, encodeFormAction) {
|
622
|
+
function action() {
|
623
|
+
var args = Array.prototype.slice.call(arguments);
|
624
|
+
return bound
|
625
|
+
? "fulfilled" === bound.status
|
626
|
+
? callServer(id, bound.value.concat(args))
|
627
|
+
: Promise.resolve(bound).then(function (boundArgs) {
|
628
|
+
return callServer(id, boundArgs.concat(args));
|
629
|
+
})
|
630
|
+
: callServer(id, args);
|
631
|
+
}
|
632
|
+
var id = metaData.id,
|
633
|
+
bound = metaData.bound;
|
634
|
+
registerServerReference(action, { id: id, bound: bound }, encodeFormAction);
|
635
|
+
return action;
|
636
|
+
}
|
600
637
|
function createServerReference$1(id, callServer, encodeFormAction) {
|
601
|
-
function
|
638
|
+
function action() {
|
602
639
|
var args = Array.prototype.slice.call(arguments);
|
603
640
|
return callServer(id, args);
|
604
641
|
}
|
605
|
-
registerServerReference(
|
606
|
-
return
|
642
|
+
registerServerReference(action, { id: id, bound: null }, encodeFormAction);
|
643
|
+
return action;
|
607
644
|
}
|
608
|
-
function
|
645
|
+
function ReactPromise(status, value, reason, response) {
|
609
646
|
this.status = status;
|
610
647
|
this.value = value;
|
611
648
|
this.reason = reason;
|
612
649
|
this._response = response;
|
613
650
|
}
|
614
|
-
|
615
|
-
|
651
|
+
ReactPromise.prototype = Object.create(Promise.prototype);
|
652
|
+
ReactPromise.prototype.then = function (resolve, reject) {
|
616
653
|
switch (this.status) {
|
617
654
|
case "resolved_model":
|
618
655
|
initializeModelChunk(this);
|
@@ -626,7 +663,6 @@ Chunk.prototype.then = function (resolve, reject) {
|
|
626
663
|
break;
|
627
664
|
case "pending":
|
628
665
|
case "blocked":
|
629
|
-
case "cyclic":
|
630
666
|
resolve &&
|
631
667
|
(null === this.value && (this.value = []), this.value.push(resolve));
|
632
668
|
reject &&
|
@@ -649,14 +685,13 @@ function readChunk(chunk) {
|
|
649
685
|
return chunk.value;
|
650
686
|
case "pending":
|
651
687
|
case "blocked":
|
652
|
-
case "cyclic":
|
653
688
|
throw chunk;
|
654
689
|
default:
|
655
690
|
throw chunk.reason;
|
656
691
|
}
|
657
692
|
}
|
658
693
|
function createPendingChunk(response) {
|
659
|
-
return new
|
694
|
+
return new ReactPromise("pending", null, null, response);
|
660
695
|
}
|
661
696
|
function wakeChunk(listeners, value) {
|
662
697
|
for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value);
|
@@ -668,7 +703,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) {
|
|
668
703
|
break;
|
669
704
|
case "pending":
|
670
705
|
case "blocked":
|
671
|
-
case "cyclic":
|
672
706
|
if (chunk.value)
|
673
707
|
for (var i = 0; i < resolveListeners.length; i++)
|
674
708
|
chunk.value.push(resolveListeners[i]);
|
@@ -698,7 +732,7 @@ function triggerErrorOnChunk(chunk, error) {
|
|
698
732
|
}
|
699
733
|
}
|
700
734
|
function createResolvedIteratorResultChunk(response, value, done) {
|
701
|
-
return new
|
735
|
+
return new ReactPromise(
|
702
736
|
"resolved_model",
|
703
737
|
(done ? '{"done":true,"value":' : '{"done":false,"value":') + value + "}",
|
704
738
|
null,
|
@@ -734,51 +768,42 @@ function resolveModuleChunk(chunk, value) {
|
|
734
768
|
wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners));
|
735
769
|
}
|
736
770
|
}
|
737
|
-
var
|
738
|
-
initializingChunkBlockedModel = null;
|
771
|
+
var initializingHandler = null;
|
739
772
|
function initializeModelChunk(chunk) {
|
740
|
-
var
|
741
|
-
|
742
|
-
initializingChunk = chunk;
|
743
|
-
initializingChunkBlockedModel = null;
|
773
|
+
var prevHandler = initializingHandler;
|
774
|
+
initializingHandler = null;
|
744
775
|
var resolvedModel = chunk.value;
|
745
|
-
chunk.status = "
|
776
|
+
chunk.status = "blocked";
|
746
777
|
chunk.value = null;
|
747
778
|
chunk.reason = null;
|
748
779
|
try {
|
749
|
-
var value = JSON.parse(resolvedModel, chunk._response._fromJSON)
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
(
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
780
|
+
var value = JSON.parse(resolvedModel, chunk._response._fromJSON),
|
781
|
+
resolveListeners = chunk.value;
|
782
|
+
null !== resolveListeners &&
|
783
|
+
((chunk.value = null),
|
784
|
+
(chunk.reason = null),
|
785
|
+
wakeChunk(resolveListeners, value));
|
786
|
+
if (null !== initializingHandler) {
|
787
|
+
if (initializingHandler.errored) throw initializingHandler.value;
|
788
|
+
if (0 < initializingHandler.deps) {
|
789
|
+
initializingHandler.value = value;
|
790
|
+
initializingHandler.chunk = chunk;
|
791
|
+
return;
|
792
|
+
}
|
760
793
|
}
|
794
|
+
chunk.status = "fulfilled";
|
795
|
+
chunk.value = value;
|
761
796
|
} catch (error) {
|
762
797
|
(chunk.status = "rejected"), (chunk.reason = error);
|
763
798
|
} finally {
|
764
|
-
|
765
|
-
(initializingChunkBlockedModel = prevBlocked);
|
799
|
+
initializingHandler = prevHandler;
|
766
800
|
}
|
767
801
|
}
|
768
802
|
function initializeModuleChunk(chunk) {
|
769
803
|
try {
|
770
|
-
var
|
771
|
-
promise = asyncModuleCache.get(metadata.specifier);
|
772
|
-
if ("fulfilled" === promise.status) var moduleExports = promise.value;
|
773
|
-
else throw promise.reason;
|
774
|
-
var JSCompiler_inline_result =
|
775
|
-
"*" === metadata.name
|
776
|
-
? moduleExports
|
777
|
-
: "" === metadata.name
|
778
|
-
? moduleExports.default
|
779
|
-
: moduleExports[metadata.name];
|
804
|
+
var value = requireModule(chunk.value);
|
780
805
|
chunk.status = "fulfilled";
|
781
|
-
chunk.value =
|
806
|
+
chunk.value = value;
|
782
807
|
} catch (error) {
|
783
808
|
(chunk.status = "rejected"), (chunk.reason = error);
|
784
809
|
}
|
@@ -788,62 +813,151 @@ function reportGlobalError(response, error) {
|
|
788
813
|
"pending" === chunk.status && triggerErrorOnChunk(chunk, error);
|
789
814
|
});
|
790
815
|
}
|
816
|
+
function createLazyChunkWrapper(chunk) {
|
817
|
+
return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk };
|
818
|
+
}
|
791
819
|
function getChunk(response, id) {
|
792
820
|
var chunks = response._chunks,
|
793
821
|
chunk = chunks.get(id);
|
794
822
|
chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk));
|
795
823
|
return chunk;
|
796
824
|
}
|
797
|
-
function
|
798
|
-
|
825
|
+
function waitForReference(
|
826
|
+
referencedChunk,
|
799
827
|
parentObject,
|
800
828
|
key,
|
801
|
-
cyclic,
|
802
829
|
response,
|
803
830
|
map,
|
804
831
|
path
|
805
832
|
) {
|
806
|
-
|
807
|
-
var
|
808
|
-
|
833
|
+
function fulfill(value) {
|
834
|
+
for (var i = 1; i < path.length; i++) {
|
835
|
+
for (; value.$$typeof === REACT_LAZY_TYPE; )
|
836
|
+
if (((value = value._payload), value === handler.chunk))
|
837
|
+
value = handler.value;
|
838
|
+
else if ("fulfilled" === value.status) value = value.value;
|
839
|
+
else {
|
840
|
+
path.splice(0, i - 1);
|
841
|
+
value.then(fulfill, reject);
|
842
|
+
return;
|
843
|
+
}
|
844
|
+
value = value[path[i]];
|
845
|
+
}
|
846
|
+
i = map(response, value, parentObject, key);
|
847
|
+
parentObject[key] = i;
|
848
|
+
"" === key && null === handler.value && (handler.value = i);
|
849
|
+
if (
|
850
|
+
parentObject[0] === REACT_ELEMENT_TYPE &&
|
851
|
+
"object" === typeof handler.value &&
|
852
|
+
null !== handler.value &&
|
853
|
+
handler.value.$$typeof === REACT_ELEMENT_TYPE
|
854
|
+
)
|
855
|
+
switch (((value = handler.value), key)) {
|
856
|
+
case "3":
|
857
|
+
value.props = i;
|
858
|
+
}
|
859
|
+
handler.deps--;
|
860
|
+
0 === handler.deps &&
|
861
|
+
((i = handler.chunk),
|
862
|
+
null !== i &&
|
863
|
+
"blocked" === i.status &&
|
864
|
+
((value = i.value),
|
865
|
+
(i.status = "fulfilled"),
|
866
|
+
(i.value = handler.value),
|
867
|
+
null !== value && wakeChunk(value, handler.value)));
|
868
|
+
}
|
869
|
+
function reject(error) {
|
870
|
+
if (!handler.errored) {
|
871
|
+
handler.errored = !0;
|
872
|
+
handler.value = error;
|
873
|
+
var chunk = handler.chunk;
|
874
|
+
null !== chunk &&
|
875
|
+
"blocked" === chunk.status &&
|
876
|
+
triggerErrorOnChunk(chunk, error);
|
877
|
+
}
|
878
|
+
}
|
879
|
+
if (initializingHandler) {
|
880
|
+
var handler = initializingHandler;
|
881
|
+
handler.deps++;
|
809
882
|
} else
|
810
|
-
|
811
|
-
|
812
|
-
|
883
|
+
handler = initializingHandler = {
|
884
|
+
parent: null,
|
885
|
+
chunk: null,
|
886
|
+
value: null,
|
887
|
+
deps: 1,
|
888
|
+
errored: !1
|
813
889
|
};
|
814
|
-
|
815
|
-
|
816
|
-
parentObject[key] = map(response, value);
|
817
|
-
"" === key && null === blocked.value && (blocked.value = parentObject[key]);
|
818
|
-
blocked.deps--;
|
819
|
-
0 === blocked.deps &&
|
820
|
-
"blocked" === chunk.status &&
|
821
|
-
((value = chunk.value),
|
822
|
-
(chunk.status = "fulfilled"),
|
823
|
-
(chunk.value = blocked.value),
|
824
|
-
null !== value && wakeChunk(value, blocked.value));
|
825
|
-
};
|
890
|
+
referencedChunk.then(fulfill, reject);
|
891
|
+
return null;
|
826
892
|
}
|
827
|
-
function
|
828
|
-
|
829
|
-
return
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
893
|
+
function loadServerReference(response, metaData, parentObject, key) {
|
894
|
+
if (!response._serverReferenceConfig)
|
895
|
+
return createBoundServerReference(
|
896
|
+
metaData,
|
897
|
+
response._callServer,
|
898
|
+
response._encodeFormAction
|
899
|
+
);
|
900
|
+
var serverReference = resolveServerReference(
|
901
|
+
response._serverReferenceConfig,
|
902
|
+
metaData.id
|
903
|
+
);
|
904
|
+
if ((response = preloadModule(serverReference)))
|
905
|
+
metaData.bound && (response = Promise.all([response, metaData.bound]));
|
906
|
+
else if (metaData.bound) response = Promise.resolve(metaData.bound);
|
907
|
+
else return requireModule(serverReference);
|
908
|
+
if (initializingHandler) {
|
909
|
+
var handler = initializingHandler;
|
910
|
+
handler.deps++;
|
911
|
+
} else
|
912
|
+
handler = initializingHandler = {
|
913
|
+
parent: null,
|
914
|
+
chunk: null,
|
915
|
+
value: null,
|
916
|
+
deps: 1,
|
917
|
+
errored: !1
|
918
|
+
};
|
919
|
+
response.then(
|
920
|
+
function () {
|
921
|
+
var resolvedValue = requireModule(serverReference);
|
922
|
+
if (metaData.bound) {
|
923
|
+
var boundArgs = metaData.bound.value.slice(0);
|
924
|
+
boundArgs.unshift(null);
|
925
|
+
resolvedValue = resolvedValue.bind.apply(resolvedValue, boundArgs);
|
926
|
+
}
|
927
|
+
parentObject[key] = resolvedValue;
|
928
|
+
"" === key && null === handler.value && (handler.value = resolvedValue);
|
929
|
+
if (
|
930
|
+
parentObject[0] === REACT_ELEMENT_TYPE &&
|
931
|
+
"object" === typeof handler.value &&
|
932
|
+
null !== handler.value &&
|
933
|
+
handler.value.$$typeof === REACT_ELEMENT_TYPE
|
934
|
+
)
|
935
|
+
switch (((boundArgs = handler.value), key)) {
|
936
|
+
case "3":
|
937
|
+
boundArgs.props = resolvedValue;
|
938
|
+
}
|
939
|
+
handler.deps--;
|
940
|
+
0 === handler.deps &&
|
941
|
+
((resolvedValue = handler.chunk),
|
942
|
+
null !== resolvedValue &&
|
943
|
+
"blocked" === resolvedValue.status &&
|
944
|
+
((boundArgs = resolvedValue.value),
|
945
|
+
(resolvedValue.status = "fulfilled"),
|
946
|
+
(resolvedValue.value = handler.value),
|
947
|
+
null !== boundArgs && wakeChunk(boundArgs, handler.value)));
|
948
|
+
},
|
949
|
+
function (error) {
|
950
|
+
if (!handler.errored) {
|
951
|
+
handler.errored = !0;
|
952
|
+
handler.value = error;
|
953
|
+
var chunk = handler.chunk;
|
954
|
+
null !== chunk &&
|
955
|
+
"blocked" === chunk.status &&
|
956
|
+
triggerErrorOnChunk(chunk, error);
|
957
|
+
}
|
958
|
+
}
|
959
|
+
);
|
960
|
+
return null;
|
847
961
|
}
|
848
962
|
function getOutlinedModel(response, reference, parentObject, key, map) {
|
849
963
|
reference = reference.split(":");
|
@@ -858,29 +972,40 @@ function getOutlinedModel(response, reference, parentObject, key, map) {
|
|
858
972
|
}
|
859
973
|
switch (id.status) {
|
860
974
|
case "fulfilled":
|
861
|
-
|
862
|
-
for (
|
863
|
-
|
864
|
-
|
975
|
+
var value = id.value;
|
976
|
+
for (id = 1; id < reference.length; id++) {
|
977
|
+
for (; value.$$typeof === REACT_LAZY_TYPE; )
|
978
|
+
if (((value = value._payload), "fulfilled" === value.status))
|
979
|
+
value = value.value;
|
980
|
+
else
|
981
|
+
return waitForReference(
|
982
|
+
value,
|
983
|
+
parentObject,
|
984
|
+
key,
|
985
|
+
response,
|
986
|
+
map,
|
987
|
+
reference.slice(id - 1)
|
988
|
+
);
|
989
|
+
value = value[reference[id]];
|
990
|
+
}
|
991
|
+
return map(response, value, parentObject, key);
|
865
992
|
case "pending":
|
866
993
|
case "blocked":
|
867
|
-
|
868
|
-
var parentChunk = initializingChunk;
|
869
|
-
id.then(
|
870
|
-
createModelResolver(
|
871
|
-
parentChunk,
|
872
|
-
parentObject,
|
873
|
-
key,
|
874
|
-
"cyclic" === id.status,
|
875
|
-
response,
|
876
|
-
map,
|
877
|
-
reference
|
878
|
-
),
|
879
|
-
createModelReject(parentChunk)
|
880
|
-
);
|
881
|
-
return null;
|
994
|
+
return waitForReference(id, parentObject, key, response, map, reference);
|
882
995
|
default:
|
883
|
-
|
996
|
+
return (
|
997
|
+
initializingHandler
|
998
|
+
? ((initializingHandler.errored = !0),
|
999
|
+
(initializingHandler.value = id.reason))
|
1000
|
+
: (initializingHandler = {
|
1001
|
+
parent: null,
|
1002
|
+
chunk: null,
|
1003
|
+
value: id.reason,
|
1004
|
+
deps: 0,
|
1005
|
+
errored: !0
|
1006
|
+
}),
|
1007
|
+
null
|
1008
|
+
);
|
884
1009
|
}
|
885
1010
|
}
|
886
1011
|
function createMap(response, model) {
|
@@ -906,7 +1031,19 @@ function createModel(response, model) {
|
|
906
1031
|
}
|
907
1032
|
function parseModelString(response, parentObject, key, value) {
|
908
1033
|
if ("$" === value[0]) {
|
909
|
-
if ("$" === value)
|
1034
|
+
if ("$" === value)
|
1035
|
+
return (
|
1036
|
+
null !== initializingHandler &&
|
1037
|
+
"0" === key &&
|
1038
|
+
(initializingHandler = {
|
1039
|
+
parent: initializingHandler,
|
1040
|
+
chunk: null,
|
1041
|
+
value: null,
|
1042
|
+
deps: 0,
|
1043
|
+
errored: !1
|
1044
|
+
}),
|
1045
|
+
REACT_ELEMENT_TYPE
|
1046
|
+
);
|
910
1047
|
switch (value[1]) {
|
911
1048
|
case "$":
|
912
1049
|
return value.slice(1);
|
@@ -914,7 +1051,7 @@ function parseModelString(response, parentObject, key, value) {
|
|
914
1051
|
return (
|
915
1052
|
(parentObject = parseInt(value.slice(2), 16)),
|
916
1053
|
(response = getChunk(response, parentObject)),
|
917
|
-
|
1054
|
+
createLazyChunkWrapper(response)
|
918
1055
|
);
|
919
1056
|
case "@":
|
920
1057
|
if (2 === value.length) return new Promise(function () {});
|
@@ -930,7 +1067,7 @@ function parseModelString(response, parentObject, key, value) {
|
|
930
1067
|
value,
|
931
1068
|
parentObject,
|
932
1069
|
key,
|
933
|
-
|
1070
|
+
loadServerReference
|
934
1071
|
)
|
935
1072
|
);
|
936
1073
|
case "T":
|
@@ -961,6 +1098,8 @@ function parseModelString(response, parentObject, key, value) {
|
|
961
1098
|
(value = value.slice(2)),
|
962
1099
|
getOutlinedModel(response, value, parentObject, key, createFormData)
|
963
1100
|
);
|
1101
|
+
case "Z":
|
1102
|
+
return resolveErrorProd();
|
964
1103
|
case "i":
|
965
1104
|
return (
|
966
1105
|
(value = value.slice(2)),
|
@@ -992,8 +1131,9 @@ function missingCall() {
|
|
992
1131
|
'Trying to call a function from "use server" but the callServer option was not implemented in your router runtime.'
|
993
1132
|
);
|
994
1133
|
}
|
995
|
-
function
|
1134
|
+
function ResponseInstance(
|
996
1135
|
bundlerConfig,
|
1136
|
+
serverReferenceConfig,
|
997
1137
|
moduleLoading,
|
998
1138
|
callServer,
|
999
1139
|
encodeFormAction,
|
@@ -1001,31 +1141,26 @@ function createResponse(
|
|
1001
1141
|
temporaryReferences
|
1002
1142
|
) {
|
1003
1143
|
var chunks = new Map();
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
_buffer: [],
|
1018
|
-
_tempRefs: temporaryReferences
|
1019
|
-
};
|
1020
|
-
bundlerConfig._fromJSON = createFromJSONCallback(bundlerConfig);
|
1021
|
-
return bundlerConfig;
|
1144
|
+
this._bundlerConfig = bundlerConfig;
|
1145
|
+
this._serverReferenceConfig = serverReferenceConfig;
|
1146
|
+
this._moduleLoading = moduleLoading;
|
1147
|
+
this._callServer = void 0 !== callServer ? callServer : missingCall;
|
1148
|
+
this._encodeFormAction = encodeFormAction;
|
1149
|
+
this._nonce = nonce;
|
1150
|
+
this._chunks = chunks;
|
1151
|
+
this._stringDecoder = new util.TextDecoder();
|
1152
|
+
this._fromJSON = null;
|
1153
|
+
this._rowLength = this._rowTag = this._rowID = this._rowState = 0;
|
1154
|
+
this._buffer = [];
|
1155
|
+
this._tempRefs = temporaryReferences;
|
1156
|
+
this._fromJSON = createFromJSONCallback(this);
|
1022
1157
|
}
|
1023
1158
|
function resolveBuffer(response, id, buffer) {
|
1024
1159
|
var chunks = response._chunks,
|
1025
1160
|
chunk = chunks.get(id);
|
1026
1161
|
chunk && "pending" !== chunk.status
|
1027
1162
|
? chunk.reason.enqueueValue(buffer)
|
1028
|
-
: chunks.set(id, new
|
1163
|
+
: chunks.set(id, new ReactPromise("fulfilled", buffer, null, response));
|
1029
1164
|
}
|
1030
1165
|
function resolveModule(response, id, model) {
|
1031
1166
|
var chunks = response._chunks,
|
@@ -1042,7 +1177,7 @@ function resolveModule(response, id, model) {
|
|
1042
1177
|
var blockedChunk = chunk;
|
1043
1178
|
blockedChunk.status = "blocked";
|
1044
1179
|
} else
|
1045
|
-
(blockedChunk = new
|
1180
|
+
(blockedChunk = new ReactPromise("blocked", null, null, response)),
|
1046
1181
|
chunks.set(id, blockedChunk);
|
1047
1182
|
model.then(
|
1048
1183
|
function () {
|
@@ -1057,7 +1192,7 @@ function resolveModule(response, id, model) {
|
|
1057
1192
|
? resolveModuleChunk(chunk, clientReference)
|
1058
1193
|
: chunks.set(
|
1059
1194
|
id,
|
1060
|
-
new
|
1195
|
+
new ReactPromise("resolved_module", clientReference, null, response)
|
1061
1196
|
);
|
1062
1197
|
}
|
1063
1198
|
function resolveStream(response, id, stream, controller) {
|
@@ -1070,7 +1205,10 @@ function resolveStream(response, id, stream, controller) {
|
|
1070
1205
|
(chunk.value = stream),
|
1071
1206
|
(chunk.reason = controller),
|
1072
1207
|
null !== response && wakeChunk(response, chunk.value))
|
1073
|
-
: chunks.set(
|
1208
|
+
: chunks.set(
|
1209
|
+
id,
|
1210
|
+
new ReactPromise("fulfilled", stream, controller, response)
|
1211
|
+
);
|
1074
1212
|
}
|
1075
1213
|
function startReadableStream(response, id, type) {
|
1076
1214
|
var controller = null;
|
@@ -1091,7 +1229,7 @@ function startReadableStream(response, id, type) {
|
|
1091
1229
|
},
|
1092
1230
|
enqueueModel: function (json) {
|
1093
1231
|
if (null === previousBlockedChunk) {
|
1094
|
-
var chunk = new
|
1232
|
+
var chunk = new ReactPromise("resolved_model", json, null, response);
|
1095
1233
|
initializeModelChunk(chunk);
|
1096
1234
|
"fulfilled" === chunk.status
|
1097
1235
|
? controller.enqueue(chunk.value)
|
@@ -1106,8 +1244,8 @@ function startReadableStream(response, id, type) {
|
|
1106
1244
|
(previousBlockedChunk = chunk));
|
1107
1245
|
} else {
|
1108
1246
|
chunk = previousBlockedChunk;
|
1109
|
-
var chunk$
|
1110
|
-
chunk$
|
1247
|
+
var chunk$52 = createPendingChunk(response);
|
1248
|
+
chunk$52.then(
|
1111
1249
|
function (v) {
|
1112
1250
|
return controller.enqueue(v);
|
1113
1251
|
},
|
@@ -1115,10 +1253,10 @@ function startReadableStream(response, id, type) {
|
|
1115
1253
|
return controller.error(e);
|
1116
1254
|
}
|
1117
1255
|
);
|
1118
|
-
previousBlockedChunk = chunk$
|
1256
|
+
previousBlockedChunk = chunk$52;
|
1119
1257
|
chunk.then(function () {
|
1120
|
-
previousBlockedChunk === chunk$
|
1121
|
-
resolveModelChunk(chunk$
|
1258
|
+
previousBlockedChunk === chunk$52 && (previousBlockedChunk = null);
|
1259
|
+
resolveModelChunk(chunk$52, json);
|
1122
1260
|
});
|
1123
1261
|
}
|
1124
1262
|
},
|
@@ -1167,7 +1305,7 @@ function startAsyncIterable(response, id, iterator) {
|
|
1167
1305
|
);
|
1168
1306
|
if (nextReadIndex === buffer.length) {
|
1169
1307
|
if (closed)
|
1170
|
-
return new
|
1308
|
+
return new ReactPromise(
|
1171
1309
|
"fulfilled",
|
1172
1310
|
{ done: !0, value: void 0 },
|
1173
1311
|
null,
|
@@ -1186,7 +1324,7 @@ function startAsyncIterable(response, id, iterator) {
|
|
1186
1324
|
{
|
1187
1325
|
enqueueValue: function (value) {
|
1188
1326
|
if (nextWriteIndex === buffer.length)
|
1189
|
-
buffer[nextWriteIndex] = new
|
1327
|
+
buffer[nextWriteIndex] = new ReactPromise(
|
1190
1328
|
"fulfilled",
|
1191
1329
|
{ done: !1, value: value },
|
1192
1330
|
null,
|
@@ -1242,12 +1380,19 @@ function startAsyncIterable(response, id, iterator) {
|
|
1242
1380
|
}
|
1243
1381
|
);
|
1244
1382
|
}
|
1383
|
+
function resolveErrorProd() {
|
1384
|
+
var error = Error(
|
1385
|
+
"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."
|
1386
|
+
);
|
1387
|
+
error.stack = "Error: " + error.message;
|
1388
|
+
return error;
|
1389
|
+
}
|
1245
1390
|
function mergeBuffer(buffer, lastChunk) {
|
1246
1391
|
for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++)
|
1247
1392
|
byteLength += buffer[i].byteLength;
|
1248
1393
|
byteLength = new Uint8Array(byteLength);
|
1249
|
-
for (var i$
|
1250
|
-
var chunk = buffer[i$
|
1394
|
+
for (var i$53 = (i = 0); i$53 < l; i$53++) {
|
1395
|
+
var chunk = buffer[i$53];
|
1251
1396
|
byteLength.set(chunk, i);
|
1252
1397
|
i += chunk.byteLength;
|
1253
1398
|
}
|
@@ -1273,7 +1418,7 @@ function resolveTypedArray(
|
|
1273
1418
|
);
|
1274
1419
|
resolveBuffer(response, id, constructor);
|
1275
1420
|
}
|
1276
|
-
function
|
1421
|
+
function processFullBinaryRow(response, id, tag, buffer, chunk) {
|
1277
1422
|
switch (tag) {
|
1278
1423
|
case 65:
|
1279
1424
|
resolveBuffer(response, id, mergeBuffer(buffer, chunk).buffer);
|
@@ -1326,6 +1471,9 @@ function processFullRow(response, id, tag, buffer, chunk) {
|
|
1326
1471
|
)
|
1327
1472
|
row += stringDecoder.decode(buffer[i], decoderOptions);
|
1328
1473
|
row += stringDecoder.decode(chunk);
|
1474
|
+
processFullStringRow(response, id, tag, row);
|
1475
|
+
}
|
1476
|
+
function processFullStringRow(response, id, tag, row) {
|
1329
1477
|
switch (tag) {
|
1330
1478
|
case 73:
|
1331
1479
|
resolveModule(response, id, row);
|
@@ -1375,22 +1523,20 @@ function processFullRow(response, id, tag, buffer, chunk) {
|
|
1375
1523
|
}
|
1376
1524
|
break;
|
1377
1525
|
case 69:
|
1378
|
-
tag = JSON.parse(row)
|
1379
|
-
row =
|
1380
|
-
|
1381
|
-
);
|
1382
|
-
row.stack = "Error: " + row.message;
|
1383
|
-
row.digest = tag;
|
1526
|
+
tag = JSON.parse(row);
|
1527
|
+
row = resolveErrorProd();
|
1528
|
+
row.digest = tag.digest;
|
1384
1529
|
tag = response._chunks;
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1530
|
+
var chunk = tag.get(id);
|
1531
|
+
chunk
|
1532
|
+
? triggerErrorOnChunk(chunk, row)
|
1533
|
+
: tag.set(id, new ReactPromise("rejected", null, row, response));
|
1388
1534
|
break;
|
1389
1535
|
case 84:
|
1390
1536
|
tag = response._chunks;
|
1391
|
-
(
|
1392
|
-
?
|
1393
|
-
: tag.set(id, new
|
1537
|
+
(chunk = tag.get(id)) && "pending" !== chunk.status
|
1538
|
+
? chunk.reason.enqueueValue(row)
|
1539
|
+
: tag.set(id, new ReactPromise("fulfilled", row, null, response));
|
1394
1540
|
break;
|
1395
1541
|
case 68:
|
1396
1542
|
case 87:
|
@@ -1416,28 +1562,52 @@ function processFullRow(response, id, tag, buffer, chunk) {
|
|
1416
1562
|
break;
|
1417
1563
|
default:
|
1418
1564
|
(tag = response._chunks),
|
1419
|
-
(
|
1420
|
-
? resolveModelChunk(
|
1421
|
-
: tag.set(
|
1565
|
+
(chunk = tag.get(id))
|
1566
|
+
? resolveModelChunk(chunk, row)
|
1567
|
+
: tag.set(
|
1568
|
+
id,
|
1569
|
+
new ReactPromise("resolved_model", row, null, response)
|
1570
|
+
);
|
1422
1571
|
}
|
1423
1572
|
}
|
1424
1573
|
function createFromJSONCallback(response) {
|
1425
1574
|
return function (key, value) {
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1575
|
+
if ("string" === typeof value)
|
1576
|
+
return parseModelString(response, this, key, value);
|
1577
|
+
if ("object" === typeof value && null !== value) {
|
1578
|
+
if (value[0] === REACT_ELEMENT_TYPE) {
|
1579
|
+
if (
|
1580
|
+
((key = {
|
1581
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
1582
|
+
type: value[1],
|
1583
|
+
key: value[2],
|
1584
|
+
ref: null,
|
1585
|
+
props: value[3]
|
1586
|
+
}),
|
1587
|
+
null !== initializingHandler)
|
1588
|
+
)
|
1589
|
+
if (
|
1590
|
+
((value = initializingHandler),
|
1591
|
+
(initializingHandler = value.parent),
|
1592
|
+
value.errored)
|
1593
|
+
)
|
1594
|
+
(key = new ReactPromise("rejected", null, value.value, response)),
|
1595
|
+
(key = createLazyChunkWrapper(key));
|
1596
|
+
else if (0 < value.deps) {
|
1597
|
+
var blockedChunk = new ReactPromise(
|
1598
|
+
"blocked",
|
1599
|
+
null,
|
1600
|
+
null,
|
1601
|
+
response
|
1602
|
+
);
|
1603
|
+
value.value = key;
|
1604
|
+
value.chunk = blockedChunk;
|
1605
|
+
key = createLazyChunkWrapper(blockedChunk);
|
1606
|
+
}
|
1607
|
+
} else key = value;
|
1608
|
+
return key;
|
1609
|
+
}
|
1610
|
+
return value;
|
1441
1611
|
};
|
1442
1612
|
}
|
1443
1613
|
function noServerCall() {
|
@@ -1445,92 +1615,191 @@ function noServerCall() {
|
|
1445
1615
|
"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."
|
1446
1616
|
);
|
1447
1617
|
}
|
1448
|
-
exports.createFromNodeStream = function (
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1618
|
+
exports.createFromNodeStream = function (
|
1619
|
+
stream,
|
1620
|
+
serverConsumerManifest,
|
1621
|
+
options
|
1622
|
+
) {
|
1623
|
+
var response = new ResponseInstance(
|
1624
|
+
serverConsumerManifest.moduleMap,
|
1625
|
+
serverConsumerManifest.serverModuleMap,
|
1626
|
+
serverConsumerManifest.moduleLoading,
|
1452
1627
|
noServerCall,
|
1453
1628
|
options ? options.encodeFormAction : void 0,
|
1454
1629
|
options && "string" === typeof options.nonce ? options.nonce : void 0,
|
1455
1630
|
void 0
|
1456
1631
|
);
|
1457
1632
|
stream.on("data", function (chunk) {
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1633
|
+
if ("string" === typeof chunk) {
|
1634
|
+
for (
|
1635
|
+
var i = 0,
|
1636
|
+
rowState = response._rowState,
|
1637
|
+
rowID = response._rowID,
|
1638
|
+
rowTag = response._rowTag,
|
1639
|
+
rowLength = response._rowLength,
|
1640
|
+
buffer = response._buffer,
|
1641
|
+
chunkLength = chunk.length;
|
1642
|
+
i < chunkLength;
|
1467
1643
|
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
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
|
-
|
1644
|
+
) {
|
1645
|
+
var lastIdx = -1;
|
1646
|
+
switch (rowState) {
|
1647
|
+
case 0:
|
1648
|
+
lastIdx = chunk.charCodeAt(i++);
|
1649
|
+
58 === lastIdx
|
1650
|
+
? (rowState = 1)
|
1651
|
+
: (rowID =
|
1652
|
+
(rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
|
1653
|
+
continue;
|
1654
|
+
case 1:
|
1655
|
+
rowState = chunk.charCodeAt(i);
|
1656
|
+
84 === rowState ||
|
1657
|
+
65 === rowState ||
|
1658
|
+
79 === rowState ||
|
1659
|
+
111 === rowState ||
|
1660
|
+
85 === rowState ||
|
1661
|
+
83 === rowState ||
|
1662
|
+
115 === rowState ||
|
1663
|
+
76 === rowState ||
|
1664
|
+
108 === rowState ||
|
1665
|
+
71 === rowState ||
|
1666
|
+
103 === rowState ||
|
1667
|
+
77 === rowState ||
|
1668
|
+
109 === rowState ||
|
1669
|
+
86 === rowState
|
1670
|
+
? ((rowTag = rowState), (rowState = 2), i++)
|
1671
|
+
: (64 < rowState && 91 > rowState) ||
|
1672
|
+
114 === rowState ||
|
1673
|
+
120 === rowState
|
1674
|
+
? ((rowTag = rowState), (rowState = 3), i++)
|
1675
|
+
: ((rowTag = 0), (rowState = 3));
|
1676
|
+
continue;
|
1677
|
+
case 2:
|
1678
|
+
lastIdx = chunk.charCodeAt(i++);
|
1679
|
+
44 === lastIdx
|
1680
|
+
? (rowState = 4)
|
1681
|
+
: (rowLength =
|
1682
|
+
(rowLength << 4) |
|
1683
|
+
(96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
|
1684
|
+
continue;
|
1685
|
+
case 3:
|
1686
|
+
lastIdx = chunk.indexOf("\n", i);
|
1687
|
+
break;
|
1688
|
+
case 4:
|
1689
|
+
if (84 !== rowTag)
|
1690
|
+
throw Error(
|
1691
|
+
"Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams."
|
1692
|
+
);
|
1693
|
+
if (rowLength < chunk.length || chunk.length > 3 * rowLength)
|
1694
|
+
throw Error(
|
1695
|
+
"String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams."
|
1696
|
+
);
|
1697
|
+
lastIdx = chunk.length;
|
1698
|
+
}
|
1699
|
+
if (-1 < lastIdx) {
|
1700
|
+
if (0 < buffer.length)
|
1701
|
+
throw Error(
|
1702
|
+
"String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams."
|
1703
|
+
);
|
1704
|
+
i = chunk.slice(i, lastIdx);
|
1705
|
+
processFullStringRow(response, rowID, rowTag, i);
|
1706
|
+
i = lastIdx;
|
1707
|
+
3 === rowState && i++;
|
1708
|
+
rowLength = rowID = rowTag = rowState = 0;
|
1709
|
+
buffer.length = 0;
|
1710
|
+
} else if (chunk.length !== i)
|
1711
|
+
throw Error(
|
1712
|
+
"String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams."
|
1713
|
+
);
|
1514
1714
|
}
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1715
|
+
response._rowState = rowState;
|
1716
|
+
response._rowID = rowID;
|
1717
|
+
response._rowTag = rowTag;
|
1718
|
+
response._rowLength = rowLength;
|
1719
|
+
} else {
|
1720
|
+
rowLength = 0;
|
1721
|
+
chunkLength = response._rowState;
|
1722
|
+
rowID = response._rowID;
|
1723
|
+
i = response._rowTag;
|
1724
|
+
rowState = response._rowLength;
|
1725
|
+
buffer = response._buffer;
|
1726
|
+
for (rowTag = chunk.length; rowLength < rowTag; ) {
|
1727
|
+
lastIdx = -1;
|
1728
|
+
switch (chunkLength) {
|
1729
|
+
case 0:
|
1730
|
+
lastIdx = chunk[rowLength++];
|
1731
|
+
58 === lastIdx
|
1732
|
+
? (chunkLength = 1)
|
1733
|
+
: (rowID =
|
1734
|
+
(rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
|
1735
|
+
continue;
|
1736
|
+
case 1:
|
1737
|
+
chunkLength = chunk[rowLength];
|
1738
|
+
84 === chunkLength ||
|
1739
|
+
65 === chunkLength ||
|
1740
|
+
79 === chunkLength ||
|
1741
|
+
111 === chunkLength ||
|
1742
|
+
85 === chunkLength ||
|
1743
|
+
83 === chunkLength ||
|
1744
|
+
115 === chunkLength ||
|
1745
|
+
76 === chunkLength ||
|
1746
|
+
108 === chunkLength ||
|
1747
|
+
71 === chunkLength ||
|
1748
|
+
103 === chunkLength ||
|
1749
|
+
77 === chunkLength ||
|
1750
|
+
109 === chunkLength ||
|
1751
|
+
86 === chunkLength
|
1752
|
+
? ((i = chunkLength), (chunkLength = 2), rowLength++)
|
1753
|
+
: (64 < chunkLength && 91 > chunkLength) ||
|
1754
|
+
35 === chunkLength ||
|
1755
|
+
114 === chunkLength ||
|
1756
|
+
120 === chunkLength
|
1757
|
+
? ((i = chunkLength), (chunkLength = 3), rowLength++)
|
1758
|
+
: ((i = 0), (chunkLength = 3));
|
1759
|
+
continue;
|
1760
|
+
case 2:
|
1761
|
+
lastIdx = chunk[rowLength++];
|
1762
|
+
44 === lastIdx
|
1763
|
+
? (chunkLength = 4)
|
1764
|
+
: (rowState =
|
1765
|
+
(rowState << 4) |
|
1766
|
+
(96 < lastIdx ? lastIdx - 87 : lastIdx - 48));
|
1767
|
+
continue;
|
1768
|
+
case 3:
|
1769
|
+
lastIdx = chunk.indexOf(10, rowLength);
|
1770
|
+
break;
|
1771
|
+
case 4:
|
1772
|
+
(lastIdx = rowLength + rowState),
|
1773
|
+
lastIdx > chunk.length && (lastIdx = -1);
|
1774
|
+
}
|
1775
|
+
var offset = chunk.byteOffset + rowLength;
|
1776
|
+
if (-1 < lastIdx)
|
1777
|
+
(rowState = new Uint8Array(
|
1778
|
+
chunk.buffer,
|
1779
|
+
offset,
|
1780
|
+
lastIdx - rowLength
|
1781
|
+
)),
|
1782
|
+
processFullBinaryRow(response, rowID, i, buffer, rowState),
|
1783
|
+
(rowLength = lastIdx),
|
1784
|
+
3 === chunkLength && rowLength++,
|
1785
|
+
(rowState = rowID = i = chunkLength = 0),
|
1786
|
+
(buffer.length = 0);
|
1787
|
+
else {
|
1788
|
+
chunk = new Uint8Array(
|
1789
|
+
chunk.buffer,
|
1790
|
+
offset,
|
1791
|
+
chunk.byteLength - rowLength
|
1792
|
+
);
|
1793
|
+
buffer.push(chunk);
|
1794
|
+
rowState -= chunk.byteLength;
|
1795
|
+
break;
|
1796
|
+
}
|
1528
1797
|
}
|
1798
|
+
response._rowState = chunkLength;
|
1799
|
+
response._rowID = rowID;
|
1800
|
+
response._rowTag = i;
|
1801
|
+
response._rowLength = rowState;
|
1529
1802
|
}
|
1530
|
-
response._rowState = rowState;
|
1531
|
-
response._rowID = rowID;
|
1532
|
-
response._rowTag = rowTag;
|
1533
|
-
response._rowLength = rowLength;
|
1534
1803
|
});
|
1535
1804
|
stream.on("error", function (error) {
|
1536
1805
|
reportGlobalError(response, error);
|