source: node_modules/react-dom/cjs/react-dom.react-server.development.js

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 13.9 KB
Line 
1/**
2 * @license React
3 * react-dom.react-server.development.js
4 *
5 * Copyright (c) Meta Platforms, Inc. and affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */
10
11"use strict";
12"production" !== process.env.NODE_ENV &&
13 (function () {
14 function noop() {}
15 function getCrossOriginStringAs(as, input) {
16 if ("font" === as) return "";
17 if ("string" === typeof input)
18 return "use-credentials" === input ? input : "";
19 }
20 function getValueDescriptorExpectingObjectForWarning(thing) {
21 return null === thing
22 ? "`null`"
23 : void 0 === thing
24 ? "`undefined`"
25 : "" === thing
26 ? "an empty string"
27 : 'something with type "' + typeof thing + '"';
28 }
29 function getValueDescriptorExpectingEnumForWarning(thing) {
30 return null === thing
31 ? "`null`"
32 : void 0 === thing
33 ? "`undefined`"
34 : "" === thing
35 ? "an empty string"
36 : "string" === typeof thing
37 ? JSON.stringify(thing)
38 : "number" === typeof thing
39 ? "`" + thing + "`"
40 : 'something with type "' + typeof thing + '"';
41 }
42 var React = require("react"),
43 Internals = {
44 d: {
45 f: noop,
46 r: function () {
47 throw Error(
48 "Invalid form element. requestFormReset must be passed a form that was rendered by React."
49 );
50 },
51 D: noop,
52 C: noop,
53 L: noop,
54 m: noop,
55 X: noop,
56 S: noop,
57 M: noop
58 },
59 p: 0,
60 findDOMNode: null
61 };
62 if (!React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE)
63 throw Error(
64 'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
65 );
66 ("function" === typeof Map &&
67 null != Map.prototype &&
68 "function" === typeof Map.prototype.forEach &&
69 "function" === typeof Set &&
70 null != Set.prototype &&
71 "function" === typeof Set.prototype.clear &&
72 "function" === typeof Set.prototype.forEach) ||
73 console.error(
74 "React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"
75 );
76 exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
77 Internals;
78 exports.preconnect = function (href, options) {
79 "string" === typeof href && href
80 ? null != options && "object" !== typeof options
81 ? console.error(
82 "ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.",
83 getValueDescriptorExpectingEnumForWarning(options)
84 )
85 : null != options &&
86 "string" !== typeof options.crossOrigin &&
87 console.error(
88 "ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.",
89 getValueDescriptorExpectingObjectForWarning(options.crossOrigin)
90 )
91 : console.error(
92 "ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
93 getValueDescriptorExpectingObjectForWarning(href)
94 );
95 "string" === typeof href &&
96 (options
97 ? ((options = options.crossOrigin),
98 (options =
99 "string" === typeof options
100 ? "use-credentials" === options
101 ? options
102 : ""
103 : void 0))
104 : (options = null),
105 Internals.d.C(href, options));
106 };
107 exports.prefetchDNS = function (href) {
108 if ("string" !== typeof href || !href)
109 console.error(
110 "ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
111 getValueDescriptorExpectingObjectForWarning(href)
112 );
113 else if (1 < arguments.length) {
114 var options = arguments[1];
115 "object" === typeof options && options.hasOwnProperty("crossOrigin")
116 ? console.error(
117 "ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",
118 getValueDescriptorExpectingEnumForWarning(options)
119 )
120 : console.error(
121 "ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",
122 getValueDescriptorExpectingEnumForWarning(options)
123 );
124 }
125 "string" === typeof href && Internals.d.D(href);
126 };
127 exports.preinit = function (href, options) {
128 "string" === typeof href && href
129 ? null == options || "object" !== typeof options
130 ? console.error(
131 "ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.",
132 getValueDescriptorExpectingEnumForWarning(options)
133 )
134 : "style" !== options.as &&
135 "script" !== options.as &&
136 console.error(
137 'ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".',
138 getValueDescriptorExpectingEnumForWarning(options.as)
139 )
140 : console.error(
141 "ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
142 getValueDescriptorExpectingObjectForWarning(href)
143 );
144 if (
145 "string" === typeof href &&
146 options &&
147 "string" === typeof options.as
148 ) {
149 var as = options.as,
150 crossOrigin = getCrossOriginStringAs(as, options.crossOrigin),
151 integrity =
152 "string" === typeof options.integrity ? options.integrity : void 0,
153 fetchPriority =
154 "string" === typeof options.fetchPriority
155 ? options.fetchPriority
156 : void 0;
157 "style" === as
158 ? Internals.d.S(
159 href,
160 "string" === typeof options.precedence
161 ? options.precedence
162 : void 0,
163 {
164 crossOrigin: crossOrigin,
165 integrity: integrity,
166 fetchPriority: fetchPriority
167 }
168 )
169 : "script" === as &&
170 Internals.d.X(href, {
171 crossOrigin: crossOrigin,
172 integrity: integrity,
173 fetchPriority: fetchPriority,
174 nonce: "string" === typeof options.nonce ? options.nonce : void 0
175 });
176 }
177 };
178 exports.preinitModule = function (href, options) {
179 var encountered = "";
180 ("string" === typeof href && href) ||
181 (encountered +=
182 " The `href` argument encountered was " +
183 getValueDescriptorExpectingObjectForWarning(href) +
184 ".");
185 void 0 !== options && "object" !== typeof options
186 ? (encountered +=
187 " The `options` argument encountered was " +
188 getValueDescriptorExpectingObjectForWarning(options) +
189 ".")
190 : options &&
191 "as" in options &&
192 "script" !== options.as &&
193 (encountered +=
194 " The `as` option encountered was " +
195 getValueDescriptorExpectingEnumForWarning(options.as) +
196 ".");
197 if (encountered)
198 console.error(
199 "ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s",
200 encountered
201 );
202 else
203 switch (
204 ((encountered =
205 options && "string" === typeof options.as ? options.as : "script"),
206 encountered)
207 ) {
208 case "script":
209 break;
210 default:
211 (encountered =
212 getValueDescriptorExpectingEnumForWarning(encountered)),
213 console.error(
214 'ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script" but received "%s" instead. This warning was generated for `href` "%s". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',
215 encountered,
216 href
217 );
218 }
219 if ("string" === typeof href)
220 if ("object" === typeof options && null !== options) {
221 if (null == options.as || "script" === options.as)
222 (encountered = getCrossOriginStringAs(
223 options.as,
224 options.crossOrigin
225 )),
226 Internals.d.M(href, {
227 crossOrigin: encountered,
228 integrity:
229 "string" === typeof options.integrity
230 ? options.integrity
231 : void 0,
232 nonce:
233 "string" === typeof options.nonce ? options.nonce : void 0
234 });
235 } else null == options && Internals.d.M(href);
236 };
237 exports.preload = function (href, options) {
238 var encountered = "";
239 ("string" === typeof href && href) ||
240 (encountered +=
241 " The `href` argument encountered was " +
242 getValueDescriptorExpectingObjectForWarning(href) +
243 ".");
244 null == options || "object" !== typeof options
245 ? (encountered +=
246 " The `options` argument encountered was " +
247 getValueDescriptorExpectingObjectForWarning(options) +
248 ".")
249 : ("string" === typeof options.as && options.as) ||
250 (encountered +=
251 " The `as` option encountered was " +
252 getValueDescriptorExpectingObjectForWarning(options.as) +
253 ".");
254 encountered &&
255 console.error(
256 'ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s',
257 encountered
258 );
259 if (
260 "string" === typeof href &&
261 "object" === typeof options &&
262 null !== options &&
263 "string" === typeof options.as
264 ) {
265 encountered = options.as;
266 var crossOrigin = getCrossOriginStringAs(
267 encountered,
268 options.crossOrigin
269 );
270 Internals.d.L(href, encountered, {
271 crossOrigin: crossOrigin,
272 integrity:
273 "string" === typeof options.integrity ? options.integrity : void 0,
274 nonce: "string" === typeof options.nonce ? options.nonce : void 0,
275 type: "string" === typeof options.type ? options.type : void 0,
276 fetchPriority:
277 "string" === typeof options.fetchPriority
278 ? options.fetchPriority
279 : void 0,
280 referrerPolicy:
281 "string" === typeof options.referrerPolicy
282 ? options.referrerPolicy
283 : void 0,
284 imageSrcSet:
285 "string" === typeof options.imageSrcSet
286 ? options.imageSrcSet
287 : void 0,
288 imageSizes:
289 "string" === typeof options.imageSizes
290 ? options.imageSizes
291 : void 0,
292 media: "string" === typeof options.media ? options.media : void 0
293 });
294 }
295 };
296 exports.preloadModule = function (href, options) {
297 var encountered = "";
298 ("string" === typeof href && href) ||
299 (encountered +=
300 " The `href` argument encountered was " +
301 getValueDescriptorExpectingObjectForWarning(href) +
302 ".");
303 void 0 !== options && "object" !== typeof options
304 ? (encountered +=
305 " The `options` argument encountered was " +
306 getValueDescriptorExpectingObjectForWarning(options) +
307 ".")
308 : options &&
309 "as" in options &&
310 "string" !== typeof options.as &&
311 (encountered +=
312 " The `as` option encountered was " +
313 getValueDescriptorExpectingObjectForWarning(options.as) +
314 ".");
315 encountered &&
316 console.error(
317 'ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s',
318 encountered
319 );
320 "string" === typeof href &&
321 (options
322 ? ((encountered = getCrossOriginStringAs(
323 options.as,
324 options.crossOrigin
325 )),
326 Internals.d.m(href, {
327 as:
328 "string" === typeof options.as && "script" !== options.as
329 ? options.as
330 : void 0,
331 crossOrigin: encountered,
332 integrity:
333 "string" === typeof options.integrity
334 ? options.integrity
335 : void 0
336 }))
337 : Internals.d.m(href));
338 };
339 exports.version = "19.2.3";
340 })();
Note: See TracBrowser for help on using the repository browser.