react-dom 16.12.0 → 16.13.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.
Files changed (42) hide show
  1. package/build-info.json +4 -4
  2. package/cjs/react-dom-server.browser.development.js +331 -594
  3. package/cjs/react-dom-server.browser.production.min.js +37 -37
  4. package/cjs/react-dom-server.node.development.js +330 -593
  5. package/cjs/react-dom-server.node.production.min.js +38 -38
  6. package/cjs/react-dom-test-utils.development.js +171 -328
  7. package/cjs/react-dom-test-utils.production.min.js +17 -17
  8. package/cjs/react-dom-unstable-fizz.browser.development.js +3 -21
  9. package/cjs/react-dom-unstable-fizz.browser.production.min.js +2 -2
  10. package/cjs/react-dom-unstable-fizz.node.development.js +2 -18
  11. package/cjs/react-dom-unstable-fizz.node.production.min.js +3 -3
  12. package/cjs/react-dom-unstable-native-dependencies.development.js +190 -305
  13. package/cjs/react-dom-unstable-native-dependencies.production.min.js +23 -27
  14. package/cjs/react-dom.development.js +11227 -13976
  15. package/cjs/react-dom.production.min.js +280 -278
  16. package/cjs/react-dom.profiling.min.js +287 -284
  17. package/package.json +3 -8
  18. package/umd/react-dom-server.browser.development.js +3320 -3594
  19. package/umd/react-dom-server.browser.production.min.js +35 -35
  20. package/umd/react-dom-test-utils.development.js +1200 -1357
  21. package/umd/react-dom-test-utils.production.min.js +23 -23
  22. package/umd/react-dom-unstable-fizz.browser.development.js +105 -123
  23. package/umd/react-dom-unstable-fizz.browser.production.min.js +3 -3
  24. package/umd/react-dom-unstable-native-dependencies.development.js +1333 -1449
  25. package/umd/react-dom-unstable-native-dependencies.production.min.js +21 -22
  26. package/umd/react-dom.development.js +19953 -22713
  27. package/umd/react-dom.production.min.js +229 -232
  28. package/umd/react-dom.profiling.min.js +236 -239
  29. package/cjs/react-dom-unstable-flight-client.development.js +0 -357
  30. package/cjs/react-dom-unstable-flight-client.production.min.js +0 -16
  31. package/cjs/react-dom-unstable-flight-server.browser.development.js +0 -392
  32. package/cjs/react-dom-unstable-flight-server.browser.production.min.js +0 -16
  33. package/cjs/react-dom-unstable-flight-server.node.development.js +0 -415
  34. package/cjs/react-dom-unstable-flight-server.node.production.min.js +0 -16
  35. package/umd/react-dom-unstable-flight-client.development.js +0 -357
  36. package/umd/react-dom-unstable-flight-client.production.min.js +0 -14
  37. package/umd/react-dom-unstable-flight-server.browser.development.js +0 -390
  38. package/umd/react-dom-unstable-flight-server.browser.production.min.js +0 -14
  39. package/unstable-flight-client.js +0 -7
  40. package/unstable-flight-server.browser.js +0 -7
  41. package/unstable-flight-server.js +0 -3
  42. package/unstable-flight-server.node.js +0 -7
@@ -1,390 +0,0 @@
1
- /** @license React v16.12.0
2
- * react-dom-unstable-flight-server.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
-
10
- 'use strict';
11
-
12
- (function (global, factory) {
13
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react-dom/server')) :
14
- typeof define === 'function' && define.amd ? define(['react-dom/server'], factory) :
15
- (global.ReactFlightDOMServer = factory(global.ReactDOMServer));
16
- }(this, (function (ReactDOMServer) { 'use strict';
17
-
18
- function scheduleWork(callback) {
19
- callback();
20
- }
21
-
22
-
23
- function writeChunk(destination, buffer) {
24
- destination.enqueue(buffer);
25
- return destination.desiredSize > 0;
26
- }
27
-
28
- function close(destination) {
29
- destination.close();
30
- }
31
- var textEncoder = new TextEncoder();
32
- function convertStringToBuffer(content) {
33
- return textEncoder.encode(content);
34
- }
35
-
36
- function renderHostChildrenToString(children) {
37
- // TODO: This file is used to actually implement a server renderer
38
- // so we can't actually reference the renderer here. Instead, we
39
- // should replace this method with a reference to Fizz which
40
- // then uses this file to implement the server renderer.
41
- return ReactDOMServer.renderToStaticMarkup(children);
42
- }
43
-
44
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
45
- // nor polyfill, then a plain number is used for performance.
46
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
47
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
48
-
49
-
50
-
51
-
52
-
53
- // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
54
- // (unstable) APIs that have been removed. Can we remove the symbols?
55
-
56
- /*
57
-
58
- FLIGHT PROTOCOL GRAMMAR
59
-
60
- Response
61
- - JSONData RowSequence
62
- - JSONData
63
-
64
- RowSequence
65
- - Row RowSequence
66
- - Row
67
-
68
- Row
69
- - "J" RowID JSONData
70
- - "H" RowID HTMLData
71
- - "B" RowID BlobData
72
- - "U" RowID URLData
73
- - "E" RowID ErrorData
74
-
75
- RowID
76
- - HexDigits ":"
77
-
78
- HexDigits
79
- - HexDigit HexDigits
80
- - HexDigit
81
-
82
- HexDigit
83
- - 0-F
84
-
85
- URLData
86
- - (UTF8 encoded URL) "\n"
87
-
88
- ErrorData
89
- - (UTF8 encoded JSON: {message: "...", stack: "..."}) "\n"
90
-
91
- JSONData
92
- - (UTF8 encoded JSON) "\n"
93
- - String values that begin with $ are escaped with a "$" prefix.
94
- - References to other rows are encoding as JSONReference strings.
95
-
96
- JSONReference
97
- - "$" HexDigits
98
-
99
- HTMLData
100
- - ByteSize (UTF8 encoded HTML)
101
-
102
- BlobData
103
- - ByteSize (Binary Data)
104
-
105
- ByteSize
106
- - (unsigned 32-bit integer)
107
- */
108
- // TODO: Implement HTMLData, BlobData and URLData.
109
-
110
- var stringify = JSON.stringify;
111
- function createRequest(model, destination) {
112
- var pingedSegments = [];
113
- var request = {
114
- destination: destination,
115
- nextChunkId: 0,
116
- pendingChunks: 0,
117
- pingedSegments: pingedSegments,
118
- completedJSONChunks: [],
119
- completedErrorChunks: [],
120
- flowing: false,
121
- toJSON: function (key, value) {
122
- return resolveModelToJSON(request, value);
123
- }
124
- };
125
- request.pendingChunks++;
126
- var rootSegment = createSegment(request, model);
127
- pingedSegments.push(rootSegment);
128
- return request;
129
- }
130
-
131
- function attemptResolveModelComponent(element) {
132
- var type = element.type;
133
- var props = element.props;
134
-
135
- if (typeof type === 'function') {
136
- // This is a nested view model.
137
- return type(props);
138
- } else if (typeof type === 'string') {
139
- // This is a host element. E.g. HTML.
140
- return renderHostChildrenToString(element);
141
- } else {
142
- throw new Error('Unsupported type.');
143
- }
144
- }
145
-
146
- function pingSegment(request, segment) {
147
- var pingedSegments = request.pingedSegments;
148
- pingedSegments.push(segment);
149
-
150
- if (pingedSegments.length === 1) {
151
- scheduleWork(function () {
152
- return performWork(request);
153
- });
154
- }
155
- }
156
-
157
- function createSegment(request, model) {
158
- var id = request.nextChunkId++;
159
- var segment = {
160
- id: id,
161
- model: model,
162
- ping: function () {
163
- return pingSegment(request, segment);
164
- }
165
- };
166
- return segment;
167
- }
168
-
169
- function serializeIDRef(id) {
170
- return '$' + id.toString(16);
171
- }
172
-
173
- function serializeRowHeader(tag, id) {
174
- return tag + id.toString(16) + ':';
175
- }
176
-
177
- function escapeStringValue(value) {
178
- if (value[0] === '$') {
179
- // We need to escape $ prefixed strings since we use that to encode
180
- // references to IDs.
181
- return '$' + value;
182
- } else {
183
- return value;
184
- }
185
- }
186
-
187
- function resolveModelToJSON(request, value) {
188
- if (typeof value === 'string') {
189
- return escapeStringValue(value);
190
- }
191
-
192
- while (typeof value === 'object' && value !== null && value.$$typeof === REACT_ELEMENT_TYPE) {
193
- var element = value;
194
-
195
- try {
196
- value = attemptResolveModelComponent(element);
197
- } catch (x) {
198
- if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
199
- // Something suspended, we'll need to create a new segment and resolve it later.
200
- request.pendingChunks++;
201
- var newSegment = createSegment(request, element);
202
- var ping = newSegment.ping;
203
- x.then(ping, ping);
204
- return serializeIDRef(newSegment.id);
205
- } else {
206
- request.pendingChunks++;
207
- var errorId = request.nextChunkId++;
208
- emitErrorChunk(request, errorId, x);
209
- return serializeIDRef(errorId);
210
- }
211
- }
212
- }
213
-
214
- return value;
215
- }
216
-
217
- function emitErrorChunk(request, id, error) {
218
- // TODO: We should not leak error messages to the client in prod.
219
- // Give this an error code instead and log on the server.
220
- // We can serialize the error in DEV as a convenience.
221
- var message;
222
- var stack = '';
223
-
224
- try {
225
- if (error instanceof Error) {
226
- message = '' + error.message;
227
- stack = '' + error.stack;
228
- } else {
229
- message = 'Error: ' + error;
230
- }
231
- } catch (x) {
232
- message = 'An error occurred but serializing the error message failed.';
233
- }
234
-
235
- var errorInfo = {
236
- message: message,
237
- stack: stack
238
- };
239
- var row = serializeRowHeader('E', id) + stringify(errorInfo) + '\n';
240
- request.completedErrorChunks.push(convertStringToBuffer(row));
241
- }
242
-
243
- function retrySegment(request, segment) {
244
- var value = segment.model;
245
-
246
- try {
247
- while (typeof value === 'object' && value !== null && value.$$typeof === REACT_ELEMENT_TYPE) {
248
- // If this is a nested model, there's no need to create another chunk,
249
- // we can reuse the existing one and try again.
250
- var element = value;
251
- segment.model = element;
252
- value = attemptResolveModelComponent(element);
253
- }
254
-
255
- var json = stringify(value, request.toJSON);
256
- var row;
257
- var id = segment.id;
258
-
259
- if (id === 0) {
260
- row = json + '\n';
261
- } else {
262
- row = serializeRowHeader('J', id) + json + '\n';
263
- }
264
-
265
- request.completedJSONChunks.push(convertStringToBuffer(row));
266
- } catch (x) {
267
- if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
268
- // Something suspended again, let's pick it back up later.
269
- var ping = segment.ping;
270
- x.then(ping, ping);
271
- return;
272
- } else {
273
- // This errored, we need to serialize this error to the
274
- emitErrorChunk(request, segment.id, x);
275
- }
276
- }
277
- }
278
-
279
- function performWork(request) {
280
- var pingedSegments = request.pingedSegments;
281
- request.pingedSegments = [];
282
-
283
- for (var i = 0; i < pingedSegments.length; i++) {
284
- var segment = pingedSegments[i];
285
- retrySegment(request, segment);
286
- }
287
-
288
- if (request.flowing) {
289
- flushCompletedChunks(request);
290
- }
291
- }
292
-
293
- var reentrant = false;
294
-
295
- function flushCompletedChunks(request) {
296
- if (reentrant) {
297
- return;
298
- }
299
-
300
- reentrant = true;
301
- var destination = request.destination;
302
- try {
303
- var jsonChunks = request.completedJSONChunks;
304
- var i = 0;
305
-
306
- for (; i < jsonChunks.length; i++) {
307
- request.pendingChunks--;
308
- var chunk = jsonChunks[i];
309
-
310
- if (!writeChunk(destination, chunk)) {
311
- request.flowing = false;
312
- i++;
313
- break;
314
- }
315
- }
316
-
317
- jsonChunks.splice(0, i);
318
- var errorChunks = request.completedErrorChunks;
319
- i = 0;
320
-
321
- for (; i < errorChunks.length; i++) {
322
- request.pendingChunks--;
323
- var _chunk = errorChunks[i];
324
-
325
- if (!writeChunk(destination, _chunk)) {
326
- request.flowing = false;
327
- i++;
328
- break;
329
- }
330
- }
331
-
332
- errorChunks.splice(0, i);
333
- } finally {
334
- reentrant = false;
335
-
336
- }
337
-
338
- if (request.pendingChunks === 0) {
339
- // We're done.
340
- close(destination);
341
- }
342
- }
343
-
344
- function startWork(request) {
345
- request.flowing = true;
346
- scheduleWork(function () {
347
- return performWork(request);
348
- });
349
- }
350
- function startFlowing(request) {
351
- request.flowing = true;
352
- flushCompletedChunks(request);
353
- }
354
-
355
- // This file intentionally does *not* have the Flow annotation.
356
- // Don't add it. See `./inline-typed.js` for an explanation.
357
-
358
- function renderToReadableStream(model) {
359
- var request;
360
- return new ReadableStream({
361
- start: function (controller) {
362
- request = createRequest(model, controller);
363
- startWork(request);
364
- },
365
- pull: function (controller) {
366
- startFlowing(request);
367
- },
368
- cancel: function (reason) {}
369
- });
370
- }
371
-
372
- var ReactFlightDOMServerBrowser = {
373
- renderToReadableStream: renderToReadableStream
374
- };
375
-
376
- var ReactFlightDOMServerBrowser$1 = Object.freeze({
377
- default: ReactFlightDOMServerBrowser
378
- });
379
-
380
- var ReactFlightDOMServerBrowser$2 = ( ReactFlightDOMServerBrowser$1 && ReactFlightDOMServerBrowser ) || ReactFlightDOMServerBrowser$1;
381
-
382
- // TODO: decide on the top-level export form.
383
- // This is hacky but makes it work with both Rollup and Jest
384
-
385
-
386
- var unstableFlightServer_browser = ReactFlightDOMServerBrowser$2.default || ReactFlightDOMServerBrowser$2;
387
-
388
- return unstableFlightServer_browser;
389
-
390
- })));
@@ -1,14 +0,0 @@
1
- /** @license React v16.12.0
2
- * react-dom-unstable-flight-server.browser.production.min.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';(function(k,g){"object"===typeof exports&&"undefined"!==typeof module?module.exports=g(require("react-dom/server")):"function"===typeof define&&define.amd?define(["react-dom/server"],g):k.ReactFlightDOMServer=g(k.ReactDOMServer)})(this,function(k){function g(a,b){var c=[],d={destination:b,nextChunkId:0,pendingChunks:0,pingedSegments:c,completedJSONChunks:[],completedErrorChunks:[],flowing:!1,toJSON:function(a,b){return z(d,b)}};d.pendingChunks++;a=p(d,a);c.push(a);return d}function q(a){var b=
10
- a.type,c=a.props;if("function"===typeof b)return b(c);if("string"===typeof b)return k.renderToStaticMarkup(a);throw Error("Unsupported type.");}function p(a,b){var c={id:a.nextChunkId++,model:b,ping:function(){var b=a.pingedSegments;b.push(c);1===b.length&&r(a)}};return c}function z(a,b){if("string"===typeof b)return a="$"===b[0]?"$"+b:b,a;for(;"object"===typeof b&&null!==b&&b.$$typeof===t;){var c=b;try{b=q(c)}catch(d){if("object"===typeof d&&null!==d&&"function"===typeof d.then)return a.pendingChunks++,
11
- a=p(a,c),b=a.ping,d.then(b,b),"$"+a.id.toString(16);a.pendingChunks++;b=a.nextChunkId++;u(a,b,d);return"$"+b.toString(16)}}return b}function u(a,b,c){var d="";try{if(c instanceof Error){var e=""+c.message;d=""+c.stack}else e="Error: "+c}catch(f){e="An error occurred but serializing the error message failed."}c={message:e,stack:d};b="E"+b.toString(16)+":"+v(c)+"\n";a.completedErrorChunks.push(w.encode(b))}function r(a){var b=a.pingedSegments;a.pingedSegments=[];for(var c=0;c<b.length;c++){var d=void 0,
12
- e=a,f=b[c],l=f.model;try{for(;"object"===typeof l&&null!==l&&l.$$typeof===t;){var g=l;f.model=g;l=q(g)}var h=v(l,e.toJSON),k=f.id;d=0===k?h+"\n":"J"+k.toString(16)+":"+h+"\n";e.completedJSONChunks.push(w.encode(d))}catch(m){"object"===typeof m&&null!==m&&"function"===typeof m.then?(d=f.ping,m.then(d,d)):u(e,f.id,m)}}a.flowing&&x(a)}function x(a){if(!n){n=!0;var b=a.destination;try{for(var c=a.completedJSONChunks,d=0;d<c.length;d++){a.pendingChunks--;var e=b;e.enqueue(c[d]);if(!(0<e.desiredSize)){a.flowing=
13
- !1;d++;break}}c.splice(0,d);var f=a.completedErrorChunks;for(d=0;d<f.length;d++)if(a.pendingChunks--,c=b,c.enqueue(f[d]),!(0<c.desiredSize)){a.flowing=!1;d++;break}f.splice(0,d)}finally{n=!1}0===a.pendingChunks&&b.close()}}var w=new TextEncoder,t="function"===typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103,v=JSON.stringify,n=!1,h={renderToReadableStream:function(a){var b;return new ReadableStream({start:function(c){c=b=g(a,c);c.flowing=!0;r(c)},pull:function(a){a=b;a.flowing=!0;x(a)},
14
- cancel:function(a){}})}},y={default:h};h=y&&h||y;return h.default||h});
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./cjs/react-dom-unstable-flight-client.production.min.js');
5
- } else {
6
- module.exports = require('./cjs/react-dom-unstable-flight-client.development.js');
7
- }
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./cjs/react-dom-unstable-flight-server.browser.production.min.js');
5
- } else {
6
- module.exports = require('./cjs/react-dom-unstable-flight-server.browser.development.js');
7
- }
@@ -1,3 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = require('./unstable-flight-server.node');
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./cjs/react-dom-unstable-flight-server.node.production.min.js');
5
- } else {
6
- module.exports = require('./cjs/react-dom-unstable-flight-server.node.development.js');
7
- }