Dashboard sipadu mbip
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

react-dom-unstable-fizz.browser.development.js 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /** @license React v16.12.0
  2. * react-dom-unstable-fizz.browser.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. (function (global, factory) {
  11. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  12. typeof define === 'function' && define.amd ? define(factory) :
  13. (global.ReactDOMFizzServer = factory());
  14. }(this, (function () { 'use strict';
  15. function scheduleWork(callback) {
  16. callback();
  17. }
  18. function flushBuffered(destination) {// WHATWG Streams do not yet have a way to flush the underlying
  19. // transform streams. https://github.com/whatwg/streams/issues/960
  20. }
  21. function writeChunk(destination, buffer) {
  22. destination.enqueue(buffer);
  23. return destination.desiredSize > 0;
  24. }
  25. function close(destination) {
  26. destination.close();
  27. }
  28. var textEncoder = new TextEncoder();
  29. function convertStringToBuffer(content) {
  30. return textEncoder.encode(content);
  31. }
  32. function formatChunkAsString(type, props) {
  33. var str = '<' + type + '>';
  34. if (typeof props.children === 'string') {
  35. str += props.children;
  36. }
  37. str += '</' + type + '>';
  38. return str;
  39. }
  40. function formatChunk(type, props) {
  41. return convertStringToBuffer(formatChunkAsString(type, props));
  42. }
  43. // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
  44. // nor polyfill, then a plain number is used for performance.
  45. var hasSymbol = typeof Symbol === 'function' && Symbol.for;
  46. var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
  47. // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
  48. // (unstable) APIs that have been removed. Can we remove the symbols?
  49. function createRequest(children, destination) {
  50. return {
  51. destination: destination,
  52. children: children,
  53. completedChunks: [],
  54. flowing: false
  55. };
  56. }
  57. function performWork(request) {
  58. var element = request.children;
  59. request.children = null;
  60. if (element && element.$$typeof !== REACT_ELEMENT_TYPE) {
  61. return;
  62. }
  63. var type = element.type;
  64. var props = element.props;
  65. if (typeof type !== 'string') {
  66. return;
  67. }
  68. request.completedChunks.push(formatChunk(type, props));
  69. if (request.flowing) {
  70. flushCompletedChunks(request);
  71. }
  72. flushBuffered(request.destination);
  73. }
  74. function flushCompletedChunks(request) {
  75. var destination = request.destination;
  76. var chunks = request.completedChunks;
  77. request.completedChunks = [];
  78. try {
  79. for (var i = 0; i < chunks.length; i++) {
  80. var chunk = chunks[i];
  81. writeChunk(destination, chunk);
  82. }
  83. } finally {
  84. }
  85. close(destination);
  86. }
  87. function startWork(request) {
  88. request.flowing = true;
  89. scheduleWork(function () {
  90. return performWork(request);
  91. });
  92. }
  93. function startFlowing(request) {
  94. request.flowing = false;
  95. flushCompletedChunks(request);
  96. }
  97. // This file intentionally does *not* have the Flow annotation.
  98. // Don't add it. See `./inline-typed.js` for an explanation.
  99. function renderToReadableStream(children) {
  100. var request;
  101. return new ReadableStream({
  102. start: function (controller) {
  103. request = createRequest(children, controller);
  104. startWork(request);
  105. },
  106. pull: function (controller) {
  107. startFlowing(request);
  108. },
  109. cancel: function (reason) {}
  110. });
  111. }
  112. var ReactDOMFizzServerBrowser = {
  113. renderToReadableStream: renderToReadableStream
  114. };
  115. var ReactDOMFizzServerBrowser$1 = Object.freeze({
  116. default: ReactDOMFizzServerBrowser
  117. });
  118. var ReactDOMFizzServerBrowser$2 = ( ReactDOMFizzServerBrowser$1 && ReactDOMFizzServerBrowser ) || ReactDOMFizzServerBrowser$1;
  119. // TODO: decide on the top-level export form.
  120. // This is hacky but makes it work with both Rollup and Jest
  121. var unstableFizz_browser = ReactDOMFizzServerBrowser$2.default || ReactDOMFizzServerBrowser$2;
  122. return unstableFizz_browser;
  123. })));