react-dom 19.0.0-rc.0 → 19.0.0-rc.1

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.
@@ -8,412 +8,333 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
 
11
- 'use strict';
12
-
13
- if (process.env.NODE_ENV !== "production") {
14
- (function() {
15
- 'use strict';
16
-
17
- var React = require('react');
18
-
19
- var ReactVersion = '19.0.0';
20
-
21
- var ReactSharedInternalsServer = // $FlowFixMe: It's defined in the one we resolve to.
22
- React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
23
-
24
- if (!ReactSharedInternalsServer) {
25
- throw new Error('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.');
26
- }
27
-
28
- function error(format) {
29
- {
30
- {
31
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
32
- args[_key2 - 1] = arguments[_key2];
33
- }
34
-
35
- printWarning('error', format, args);
36
- }
37
- }
38
- } // eslint-disable-next-line react-internal/no-production-logging
39
-
40
- function printWarning(level, format, args) {
41
- // When changing this logic, you might want to also
42
- // update consoleWithStackDev.www.js as well.
43
- {
44
- var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n';
45
-
46
- if (ReactSharedInternalsServer.getCurrentStack) {
47
- // We only add the current stack to the console when createTask is not supported.
48
- // Since createTask requires DevTools to be open to work, this means that stacks
49
- // can be lost while DevTools isn't open but we can't detect this.
50
- var stack = ReactSharedInternalsServer.getCurrentStack();
51
-
52
- if (stack !== '') {
53
- format += '%s';
54
- args = args.concat([stack]);
55
- }
56
- }
57
-
58
- if (isErrorLogger) {
59
- // Don't prefix our default logging formatting in ReactFiberErrorLoggger.
60
- // Don't toString the arguments.
61
- args.unshift(format);
62
- } else {
63
- // TODO: Remove this prefix and stop toStringing in the wrapper and
64
- // instead do it at each callsite as needed.
65
- // Careful: RN currently depends on this prefix
66
- // eslint-disable-next-line react-internal/safe-string-coercion
67
- args = args.map(function (item) {
68
- return String(item);
69
- });
70
- args.unshift('Warning: ' + format);
71
- } // We intentionally don't use spread (or .apply) directly because it
72
- // breaks IE9: https://github.com/facebook/react/issues/13610
73
- // eslint-disable-next-line react-internal/no-production-logging
74
-
75
-
76
- Function.prototype.apply.call(console[level], console, args);
77
- }
78
- }
79
-
80
- var NoLane =
81
- /* */
82
- 0;
83
-
84
- var NoEventPriority = NoLane;
85
-
86
- function noop() {}
87
-
88
- function requestFormReset(element) {
89
- throw new Error('Invalid form element. requestFormReset must be passed a form that was ' + 'rendered by React.');
90
- }
91
-
92
- var DefaultDispatcher = {
93
- f
94
- /* flushSyncWork */
95
- : noop,
96
- r
97
- /* requestFormReset */
98
- : requestFormReset,
99
- D
100
- /* prefetchDNS */
101
- : noop,
102
- C
103
- /* preconnect */
104
- : noop,
105
- L
106
- /* preload */
107
- : noop,
108
- m
109
- /* preloadModule */
110
- : noop,
111
- X
112
- /* preinitScript */
113
- : noop,
114
- S
115
- /* preinitStyle */
116
- : noop,
117
- M
118
- /* preinitModuleScript */
119
- : noop
120
- };
121
- var Internals = {
122
- d
123
- /* ReactDOMCurrentDispatcher */
124
- : DefaultDispatcher,
125
- p
126
- /* currentUpdatePriority */
127
- : NoEventPriority,
128
- findDOMNode: null
129
- };
130
-
131
- {
132
- if (typeof Map !== 'function' || // $FlowFixMe[prop-missing] Flow incorrectly thinks Map has no prototype
133
- Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || // $FlowFixMe[prop-missing] Flow incorrectly thinks Set has no prototype
134
- Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
135
- error('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');
136
- }
137
- }
138
-
139
- var ReactDOMSharedInternals = Internals;
140
-
141
- function getCrossOriginString(input) {
142
- if (typeof input === 'string') {
143
- return input === 'use-credentials' ? input : '';
144
- }
145
-
146
- return undefined;
147
- }
148
- function getCrossOriginStringAs(as, input) {
149
- if (as === 'font') {
150
- return '';
151
- }
152
-
153
- if (typeof input === 'string') {
154
- return input === 'use-credentials' ? input : '';
155
- }
156
-
157
- return undefined;
158
- }
159
-
160
- function prefetchDNS(href) {
161
- {
162
- if (typeof href !== 'string' || !href) {
163
- error('ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.', getValueDescriptorExpectingObjectForWarning(href));
164
- } else if (arguments.length > 1) {
165
- var options = arguments[1];
166
-
167
- if (typeof options === 'object' && options.hasOwnProperty('crossOrigin')) {
168
- error('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`.', getValueDescriptorExpectingEnumForWarning(options));
169
- } else {
170
- error('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`.', getValueDescriptorExpectingEnumForWarning(options));
171
- }
172
- }
173
- }
174
-
175
- if (typeof href === 'string') {
176
- ReactDOMSharedInternals.d
177
- /* ReactDOMCurrentDispatcher */
178
- .D(
179
- /* prefetchDNS */
180
- href);
181
- } // We don't error because preconnect needs to be resilient to being called in a variety of scopes
182
- // and the runtime may not be capable of responding. The function is optimistic and not critical
183
- // so we favor silent bailout over warning or erroring.
184
-
185
- }
186
- function preconnect(href, options) {
187
- {
188
- if (typeof href !== 'string' || !href) {
189
- error('ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.', getValueDescriptorExpectingObjectForWarning(href));
190
- } else if (options != null && typeof options !== 'object') {
191
- error('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.', getValueDescriptorExpectingEnumForWarning(options));
192
- } else if (options != null && typeof options.crossOrigin !== 'string') {
193
- error('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.', getValueDescriptorExpectingObjectForWarning(options.crossOrigin));
194
- }
195
- }
196
-
197
- if (typeof href === 'string') {
198
- var crossOrigin = options ? getCrossOriginString(options.crossOrigin) : null;
199
- ReactDOMSharedInternals.d
200
- /* ReactDOMCurrentDispatcher */
201
- .C(
202
- /* preconnect */
203
- href, crossOrigin);
204
- } // We don't error because preconnect needs to be resilient to being called in a variety of scopes
205
- // and the runtime may not be capable of responding. The function is optimistic and not critical
206
- // so we favor silent bailout over warning or erroring.
207
-
208
- }
209
- function preload(href, options) {
210
- {
211
- var encountered = '';
212
-
213
- if (typeof href !== 'string' || !href) {
214
- encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".";
215
- }
216
-
217
- if (options == null || typeof options !== 'object') {
218
- encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + ".";
219
- } else if (typeof options.as !== 'string' || !options.as) {
220
- encountered += " The `as` option encountered was " + getValueDescriptorExpectingObjectForWarning(options.as) + ".";
221
- }
222
-
223
- if (encountered) {
224
- error('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', encountered);
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 : "";
225
19
  }
226
- }
227
-
228
- if (typeof href === 'string' && // We check existence because we cannot enforce this function is actually called with the stated type
229
- typeof options === 'object' && options !== null && typeof options.as === 'string') {
230
- var as = options.as;
231
- var crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
232
- ReactDOMSharedInternals.d
233
- /* ReactDOMCurrentDispatcher */
234
- .L(
235
- /* preload */
236
- href, as, {
237
- crossOrigin: crossOrigin,
238
- integrity: typeof options.integrity === 'string' ? options.integrity : undefined,
239
- nonce: typeof options.nonce === 'string' ? options.nonce : undefined,
240
- type: typeof options.type === 'string' ? options.type : undefined,
241
- fetchPriority: typeof options.fetchPriority === 'string' ? options.fetchPriority : undefined,
242
- referrerPolicy: typeof options.referrerPolicy === 'string' ? options.referrerPolicy : undefined,
243
- imageSrcSet: typeof options.imageSrcSet === 'string' ? options.imageSrcSet : undefined,
244
- imageSizes: typeof options.imageSizes === 'string' ? options.imageSizes : undefined,
245
- media: typeof options.media === 'string' ? options.media : undefined
246
- });
247
- } // We don't error because preload needs to be resilient to being called in a variety of scopes
248
- // and the runtime may not be capable of responding. The function is optimistic and not critical
249
- // so we favor silent bailout over warning or erroring.
250
-
251
- }
252
- function preloadModule(href, options) {
253
- {
254
- var encountered = '';
255
-
256
- if (typeof href !== 'string' || !href) {
257
- encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".";
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 + '"';
258
28
  }
259
-
260
- if (options !== undefined && typeof options !== 'object') {
261
- encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + ".";
262
- } else if (options && 'as' in options && typeof options.as !== 'string') {
263
- encountered += " The `as` option encountered was " + getValueDescriptorExpectingObjectForWarning(options.as) + ".";
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 + '"';
264
41
  }
265
-
266
- if (encountered) {
267
- error('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', encountered);
268
- }
269
- }
270
-
271
- if (typeof href === 'string') {
272
- if (options) {
273
- var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
274
- ReactDOMSharedInternals.d
275
- /* ReactDOMCurrentDispatcher */
276
- .m(
277
- /* preloadModule */
278
- href, {
279
- as: typeof options.as === 'string' && options.as !== 'script' ? options.as : undefined,
280
- crossOrigin: crossOrigin,
281
- integrity: typeof options.integrity === 'string' ? options.integrity : undefined
282
- });
283
- } else {
284
- ReactDOMSharedInternals.d
285
- /* ReactDOMCurrentDispatcher */
286
- .m(
287
- /* preloadModule */
288
- href);
289
- }
290
- } // We don't error because preload needs to be resilient to being called in a variety of scopes
291
- // and the runtime may not be capable of responding. The function is optimistic and not critical
292
- // so we favor silent bailout over warning or erroring.
293
-
294
- }
295
- function preinit(href, options) {
296
- {
297
- if (typeof href !== 'string' || !href) {
298
- error('ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.', getValueDescriptorExpectingObjectForWarning(href));
299
- } else if (options == null || typeof options !== 'object') {
300
- error('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.', getValueDescriptorExpectingEnumForWarning(options));
301
- } else if (options.as !== 'style' && options.as !== 'script') {
302
- error('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".', getValueDescriptorExpectingEnumForWarning(options.as));
303
- }
304
- }
305
-
306
- if (typeof href === 'string' && options && typeof options.as === 'string') {
307
- var as = options.as;
308
- var crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
309
- var integrity = typeof options.integrity === 'string' ? options.integrity : undefined;
310
- var fetchPriority = typeof options.fetchPriority === 'string' ? options.fetchPriority : undefined;
311
-
312
- if (as === 'style') {
313
- ReactDOMSharedInternals.d
314
- /* ReactDOMCurrentDispatcher */
315
- .S(
316
- /* preinitStyle */
317
- href, typeof options.precedence === 'string' ? options.precedence : undefined, {
318
- crossOrigin: crossOrigin,
319
- integrity: integrity,
320
- fetchPriority: fetchPriority
321
- });
322
- } else if (as === 'script') {
323
- ReactDOMSharedInternals.d
324
- /* ReactDOMCurrentDispatcher */
325
- .X(
326
- /* preinitScript */
327
- href, {
328
- crossOrigin: crossOrigin,
329
- integrity: integrity,
330
- fetchPriority: fetchPriority,
331
- nonce: typeof options.nonce === 'string' ? options.nonce : undefined
332
- });
333
- }
334
- } // We don't error because preinit needs to be resilient to being called in a variety of scopes
335
- // and the runtime may not be capable of responding. The function is optimistic and not critical
336
- // so we favor silent bailout over warning or erroring.
337
-
338
- }
339
- function preinitModule(href, options) {
340
- {
341
- var encountered = '';
342
-
343
- if (typeof href !== 'string' || !href) {
344
- encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".";
345
- }
346
-
347
- if (options !== undefined && typeof options !== 'object') {
348
- encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + ".";
349
- } else if (options && 'as' in options && options.as !== 'script') {
350
- encountered += " The `as` option encountered was " + getValueDescriptorExpectingEnumForWarning(options.as) + ".";
351
- }
352
-
353
- if (encountered) {
354
- error('ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s', encountered);
355
- } else {
356
- var as = options && typeof options.as === 'string' ? options.as : 'script';
357
-
358
- switch (as) {
359
- case 'script':
360
- {
361
- break;
362
- }
363
- // We have an invalid as type and need to warn
364
-
365
- default:
366
- {
367
- var typeOfAs = getValueDescriptorExpectingEnumForWarning(as);
368
-
369
- error('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)', typeOfAs, href);
370
- }
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
+ );
371
124
  }
372
- }
373
- }
374
-
375
- if (typeof href === 'string') {
376
- if (typeof options === 'object' && options !== null) {
377
- if (options.as == null || options.as === 'script') {
378
- var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
379
- ReactDOMSharedInternals.d
380
- /* ReactDOMCurrentDispatcher */
381
- .M(
382
- /* preinitModuleScript */
383
- href, {
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, {
384
271
  crossOrigin: crossOrigin,
385
- integrity: typeof options.integrity === 'string' ? options.integrity : undefined,
386
- nonce: typeof options.nonce === 'string' ? options.nonce : undefined
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
387
293
  });
388
294
  }
389
- } else if (options == null) {
390
- ReactDOMSharedInternals.d
391
- /* ReactDOMCurrentDispatcher */
392
- .M(
393
- /* preinitModuleScript */
394
- href);
395
- }
396
- } // We don't error because preinit needs to be resilient to being called in a variety of scopes
397
- // and the runtime may not be capable of responding. The function is optimistic and not critical
398
- // so we favor silent bailout over warning or erroring.
399
-
400
- }
401
-
402
- function getValueDescriptorExpectingObjectForWarning(thing) {
403
- return thing === null ? '`null`' : thing === undefined ? '`undefined`' : thing === '' ? 'an empty string' : "something with type \"" + typeof thing + "\"";
404
- }
405
-
406
- function getValueDescriptorExpectingEnumForWarning(thing) {
407
- return thing === null ? '`null`' : thing === undefined ? '`undefined`' : thing === '' ? 'an empty string' : typeof thing === 'string' ? JSON.stringify(thing) : typeof thing === 'number' ? '`' + thing + '`' : "something with type \"" + typeof thing + "\"";
408
- }
409
-
410
- exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = Internals;
411
- exports.preconnect = preconnect;
412
- exports.prefetchDNS = prefetchDNS;
413
- exports.preinit = preinit;
414
- exports.preinitModule = preinitModule;
415
- exports.preload = preload;
416
- exports.preloadModule = preloadModule;
417
- exports.version = ReactVersion;
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.0.0";
418
340
  })();
419
- }