@@ -16,7 +16,7 @@ if (process.env.NODE_ENV !== "production") {
16
16
17
17
var React = require ( "next/dist/compiled/react-experimental" ) ;
18
18
19
- var ReactVersion = '18.3.0-experimental-09285d5a7-20230925 ' ;
19
+ var ReactVersion = '18.3.0-experimental-d900fadbf-20230929 ' ;
20
20
21
21
var Internals = {
22
22
usingClientEntryPoint : false ,
@@ -65,6 +65,25 @@ function printWarning(level, format, args) {
65
65
}
66
66
}
67
67
68
+ function getCrossOriginString ( input ) {
69
+ if ( typeof input === 'string' ) {
70
+ return input === 'use-credentials' ? input : '' ;
71
+ }
72
+
73
+ return undefined ;
74
+ }
75
+ function getCrossOriginStringAs ( as , input ) {
76
+ if ( as === 'font' ) {
77
+ return '' ;
78
+ }
79
+
80
+ if ( typeof input === 'string' ) {
81
+ return input === 'use-credentials' ? input : '' ;
82
+ }
83
+
84
+ return undefined ;
85
+ }
86
+
68
87
var Dispatcher = Internals . Dispatcher ;
69
88
function prefetchDNS ( href ) {
70
89
{
@@ -104,7 +123,7 @@ function preconnect(href, options) {
104
123
var dispatcher = Dispatcher . current ;
105
124
106
125
if ( dispatcher && typeof href === 'string' ) {
107
- var crossOrigin = options ? getCrossOrigin ( 'preconnect' , options . crossOrigin ) : null ;
126
+ var crossOrigin = options ? getCrossOriginString ( options . crossOrigin ) : null ;
108
127
dispatcher . preconnect ( href , crossOrigin ) ;
109
128
} // We don't error because preconnect needs to be resilient to being called in a variety of scopes
110
129
// and the runtime may not be capable of responding. The function is optimistic and not critical
@@ -135,7 +154,7 @@ function preload(href, options) {
135
154
if ( dispatcher && typeof href === 'string' && // We check existence because we cannot enforce this function is actually called with the stated type
136
155
typeof options === 'object' && options !== null && typeof options . as === 'string' ) {
137
156
var as = options . as ;
138
- var crossOrigin = getCrossOrigin ( as , options . crossOrigin ) ;
157
+ var crossOrigin = getCrossOriginStringAs ( as , options . crossOrigin ) ;
139
158
dispatcher . preload ( href , as , {
140
159
crossOrigin : crossOrigin ,
141
160
integrity : typeof options . integrity === 'string' ? options . integrity : undefined ,
@@ -174,7 +193,7 @@ function preloadModule(href, options) {
174
193
175
194
if ( dispatcher && typeof href === 'string' ) {
176
195
if ( options ) {
177
- var crossOrigin = getCrossOrigin ( options . as , options . crossOrigin ) ;
196
+ var crossOrigin = getCrossOriginStringAs ( options . as , options . crossOrigin ) ;
178
197
dispatcher . preloadModule ( href , {
179
198
as : typeof options . as === 'string' && options . as !== 'script' ? options . as : undefined ,
180
199
crossOrigin : crossOrigin ,
@@ -203,7 +222,7 @@ function preinit(href, options) {
203
222
204
223
if ( dispatcher && typeof href === 'string' && options && typeof options . as === 'string' ) {
205
224
var as = options . as ;
206
- var crossOrigin = getCrossOrigin ( as , options . crossOrigin ) ;
225
+ var crossOrigin = getCrossOriginStringAs ( as , options . crossOrigin ) ;
207
226
var integrity = typeof options . integrity === 'string' ? options . integrity : undefined ;
208
227
var fetchPriority = typeof options . fetchPriority === 'string' ? options . fetchPriority : undefined ;
209
228
@@ -265,23 +284,24 @@ function preinitModule(href, options) {
265
284
var dispatcher = Dispatcher . current ;
266
285
267
286
if ( dispatcher && typeof href === 'string' ) {
268
- if ( options == null || typeof options === 'object' && ( options . as == null || options . as === 'script' ) ) {
269
- var crossOrigin = options ? getCrossOrigin ( undefined , options . crossOrigin ) : undefined ;
270
- dispatcher . preinitModuleScript ( href , {
271
- crossOrigin : crossOrigin ,
272
- integrity : options && typeof options . integrity === 'string' ? options . integrity : undefined
273
- } ) ;
287
+ if ( typeof options === 'object' && options !== null ) {
288
+ if ( options . as == null || options . as === 'script' ) {
289
+ var crossOrigin = getCrossOriginStringAs ( options . as , options . crossOrigin ) ;
290
+ dispatcher . preinitModuleScript ( href , {
291
+ crossOrigin : crossOrigin ,
292
+ integrity : typeof options . integrity === 'string' ? options . integrity : undefined ,
293
+ nonce : typeof options . nonce === 'string' ? options . nonce : undefined
294
+ } ) ;
295
+ }
296
+ } else if ( options == null ) {
297
+ dispatcher . preinitModuleScript ( href ) ;
274
298
}
275
299
} // We don't error because preinit needs to be resilient to being called in a variety of scopes
276
300
// and the runtime may not be capable of responding. The function is optimistic and not critical
277
301
// so we favor silent bailout over warning or erroring.
278
302
279
303
}
280
304
281
- function getCrossOrigin ( as , crossOrigin ) {
282
- return as === 'font' ? '' : typeof crossOrigin === 'string' ? crossOrigin === 'use-credentials' ? 'use-credentials' : '' : undefined ;
283
- }
284
-
285
305
function getValueDescriptorExpectingObjectForWarning ( thing ) {
286
306
return thing === null ? '`null`' : thing === undefined ? '`undefined`' : thing === '' ? 'an empty string' : "something with type \"" + typeof thing + "\"" ;
287
307
}
0 commit comments