Dashboard sipadu mbip
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

react-dom-unstable-fizz.node.development.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /** @license React v16.12.0
  2. * react-dom-unstable-fizz.node.development.js
  3. *
  4. * Copyright (c) Facebook, Inc. and its affiliates.
  5. *
  6. * This source code is licensed under the MIT license found in the
  7. * LICENSE file in the root directory of this source tree.
  8. */
  9. 'use strict';
  10. if (process.env.NODE_ENV !== "production") {
  11. (function() {
  12. 'use strict';
  13. function scheduleWork(callback) {
  14. setImmediate(callback);
  15. }
  16. function flushBuffered(destination) {
  17. // If we don't have any more data to send right now.
  18. // Flush whatever is in the buffer to the wire.
  19. if (typeof destination.flush === 'function') {
  20. // http.createServer response have flush(), but it has a different meaning and
  21. // is deprecated in favor of flushHeaders(). Detect to avoid a warning.
  22. if (typeof destination.flushHeaders !== 'function') {
  23. // By convention the Zlib streams provide a flush function for this purpose.
  24. destination.flush();
  25. }
  26. }
  27. }
  28. function beginWriting(destination) {
  29. // Older Node streams like http.createServer don't have this.
  30. if (typeof destination.cork === 'function') {
  31. destination.cork();
  32. }
  33. }
  34. function writeChunk(destination, buffer) {
  35. var nodeBuffer = buffer; // close enough
  36. return destination.write(nodeBuffer);
  37. }
  38. function completeWriting(destination) {
  39. // Older Node streams like http.createServer don't have this.
  40. if (typeof destination.uncork === 'function') {
  41. destination.uncork();
  42. }
  43. }
  44. function close(destination) {
  45. destination.end();
  46. }
  47. function convertStringToBuffer(content) {
  48. return Buffer.from(content, 'utf8');
  49. }
  50. function formatChunkAsString(type, props) {
  51. var str = '<' + type + '>';
  52. if (typeof props.children === 'string') {
  53. str += props.children;
  54. }
  55. str += '</' + type + '>';
  56. return str;
  57. }
  58. function formatChunk(type, props) {
  59. return convertStringToBuffer(formatChunkAsString(type, props));
  60. }
  61. // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
  62. // nor polyfill, then a plain number is used for performance.
  63. var hasSymbol = typeof Symbol === 'function' && Symbol.for;
  64. var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
  65. // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
  66. // (unstable) APIs that have been removed. Can we remove the symbols?
  67. function createRequest(children, destination) {
  68. return {
  69. destination: destination,
  70. children: children,
  71. completedChunks: [],
  72. flowing: false
  73. };
  74. }
  75. function performWork(request) {
  76. var element = request.children;
  77. request.children = null;
  78. if (element && element.$$typeof !== REACT_ELEMENT_TYPE) {
  79. return;
  80. }
  81. var type = element.type;
  82. var props = element.props;
  83. if (typeof type !== 'string') {
  84. return;
  85. }
  86. request.completedChunks.push(formatChunk(type, props));
  87. if (request.flowing) {
  88. flushCompletedChunks(request);
  89. }
  90. flushBuffered(request.destination);
  91. }
  92. function flushCompletedChunks(request) {
  93. var destination = request.destination;
  94. var chunks = request.completedChunks;
  95. request.completedChunks = [];
  96. beginWriting(destination);
  97. try {
  98. for (var i = 0; i < chunks.length; i++) {
  99. var chunk = chunks[i];
  100. writeChunk(destination, chunk);
  101. }
  102. } finally {
  103. completeWriting(destination);
  104. }
  105. close(destination);
  106. }
  107. function startWork(request) {
  108. request.flowing = true;
  109. scheduleWork(function () {
  110. return performWork(request);
  111. });
  112. }
  113. function startFlowing(request) {
  114. request.flowing = false;
  115. flushCompletedChunks(request);
  116. }
  117. // This file intentionally does *not* have the Flow annotation.
  118. // Don't add it. See `./inline-typed.js` for an explanation.
  119. function createDrainHandler(destination, request) {
  120. return function () {
  121. return startFlowing(request);
  122. };
  123. }
  124. function pipeToNodeWritable(children, destination) {
  125. var request = createRequest(children, destination);
  126. destination.on('drain', createDrainHandler(destination, request));
  127. startWork(request);
  128. }
  129. var ReactDOMFizzServerNode = {
  130. pipeToNodeWritable: pipeToNodeWritable
  131. };
  132. var ReactDOMFizzServerNode$1 = Object.freeze({
  133. default: ReactDOMFizzServerNode
  134. });
  135. var ReactDOMFizzServerNode$2 = ( ReactDOMFizzServerNode$1 && ReactDOMFizzServerNode ) || ReactDOMFizzServerNode$1;
  136. // TODO: decide on the top-level export form.
  137. // This is hacky but makes it work with both Rollup and Jest
  138. var unstableFizz_node = ReactDOMFizzServerNode$2.default || ReactDOMFizzServerNode$2;
  139. module.exports = unstableFizz_node;
  140. })();
  141. }