next 13.4.9-canary.2 → 13.4.9

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 (184) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +2 -2
  3. package/dist/build/swc/index.js +1 -1
  4. package/dist/build/utils.js +7 -5
  5. package/dist/build/utils.js.map +1 -1
  6. package/dist/build/webpack/config/blocks/css/index.js +30 -5
  7. package/dist/build/webpack/config/blocks/css/index.js.map +1 -1
  8. package/dist/build/webpack/config/blocks/css/loaders/getCssModuleLocalIdent.js +1 -1
  9. package/dist/build/webpack/config/blocks/css/loaders/getCssModuleLocalIdent.js.map +1 -1
  10. package/dist/build/webpack/loaders/next-flight-css-loader.d.ts +5 -2
  11. package/dist/build/webpack/loaders/next-flight-css-loader.js +12 -23
  12. package/dist/build/webpack/loaders/next-flight-css-loader.js.map +1 -1
  13. package/dist/build/webpack/loaders/next-font-loader/index.js +1 -1
  14. package/dist/build/webpack/loaders/next-font-loader/index.js.map +1 -1
  15. package/dist/build/webpack/plugins/{next-types-plugin.d.ts → next-types-plugin/index.d.ts} +1 -2
  16. package/dist/build/webpack/plugins/{next-types-plugin.js → next-types-plugin/index.js} +14 -26
  17. package/dist/build/webpack/plugins/next-types-plugin/index.js.map +1 -0
  18. package/dist/build/webpack/plugins/next-types-plugin/shared.d.ts +1 -0
  19. package/dist/build/webpack/plugins/next-types-plugin/shared.js +14 -0
  20. package/dist/build/webpack/plugins/next-types-plugin/shared.js.map +1 -0
  21. package/dist/build/webpack-config.js +2 -2
  22. package/dist/cli/next-dev.js +1 -1
  23. package/dist/cli/next-dev.js.map +1 -1
  24. package/dist/client/app-bootstrap.js +1 -1
  25. package/dist/client/components/app-router.js +57 -48
  26. package/dist/client/components/app-router.js.map +1 -1
  27. package/dist/client/components/async-local-storage.js +3 -2
  28. package/dist/client/components/async-local-storage.js.map +1 -1
  29. package/dist/client/components/react-dev-overlay/hot-reloader-client.js +1 -1
  30. package/dist/client/components/react-dev-overlay/hot-reloader-client.js.map +1 -1
  31. package/dist/client/index.js +1 -1
  32. package/dist/compiled/react/cjs/react-jsx-dev-runtime.development.js +8 -1
  33. package/dist/compiled/react/cjs/react-jsx-runtime.development.js +8 -1
  34. package/dist/compiled/react/cjs/react.development.js +9 -2
  35. package/dist/compiled/react/cjs/react.production.min.js +1 -1
  36. package/dist/compiled/react/cjs/react.shared-subset.development.js +9 -2
  37. package/dist/compiled/react/cjs/react.shared-subset.production.min.js +1 -1
  38. package/dist/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js +224 -205
  39. package/dist/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +120 -123
  40. package/dist/compiled/react-dom/cjs/react-dom-server-legacy.node.development.js +226 -206
  41. package/dist/compiled/react-dom/cjs/react-dom-server-legacy.node.production.min.js +131 -135
  42. package/dist/compiled/react-dom/cjs/react-dom-server-rendering-stub.development.js +9 -1
  43. package/dist/compiled/react-dom/cjs/react-dom-server-rendering-stub.production.min.js +3 -2
  44. package/dist/compiled/react-dom/cjs/react-dom-server.browser.development.js +227 -208
  45. package/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js +125 -128
  46. package/dist/compiled/react-dom/cjs/react-dom-server.edge.development.js +227 -208
  47. package/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js +135 -138
  48. package/dist/compiled/react-dom/cjs/react-dom-server.node.development.js +222 -203
  49. package/dist/compiled/react-dom/cjs/react-dom-server.node.production.min.js +136 -138
  50. package/dist/compiled/react-dom/cjs/react-dom.development.js +244 -251
  51. package/dist/compiled/react-dom/cjs/react-dom.production.min.js +300 -300
  52. package/dist/compiled/react-dom/cjs/react-dom.profiling.min.js +304 -305
  53. package/dist/compiled/react-dom/package.json +2 -2
  54. package/dist/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js +224 -205
  55. package/dist/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.min.js +123 -127
  56. package/dist/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.development.js +226 -206
  57. package/dist/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.production.min.js +134 -138
  58. package/dist/compiled/react-dom-experimental/cjs/react-dom-server-rendering-stub.development.js +9 -1
  59. package/dist/compiled/react-dom-experimental/cjs/react-dom-server-rendering-stub.production.min.js +3 -3
  60. package/dist/compiled/react-dom-experimental/cjs/react-dom-server.browser.development.js +227 -208
  61. package/dist/compiled/react-dom-experimental/cjs/react-dom-server.browser.production.min.js +129 -133
  62. package/dist/compiled/react-dom-experimental/cjs/react-dom-server.edge.development.js +227 -208
  63. package/dist/compiled/react-dom-experimental/cjs/react-dom-server.edge.production.min.js +140 -142
  64. package/dist/compiled/react-dom-experimental/cjs/react-dom-server.node.development.js +222 -203
  65. package/dist/compiled/react-dom-experimental/cjs/react-dom-server.node.production.min.js +139 -142
  66. package/dist/compiled/react-dom-experimental/cjs/react-dom-static.browser.development.js +227 -208
  67. package/dist/compiled/react-dom-experimental/cjs/react-dom-static.browser.production.min.js +129 -133
  68. package/dist/compiled/react-dom-experimental/cjs/react-dom-static.edge.development.js +227 -208
  69. package/dist/compiled/react-dom-experimental/cjs/react-dom-static.edge.production.min.js +130 -134
  70. package/dist/compiled/react-dom-experimental/cjs/react-dom-static.node.development.js +222 -203
  71. package/dist/compiled/react-dom-experimental/cjs/react-dom-static.node.production.min.js +141 -144
  72. package/dist/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.development.js +250 -255
  73. package/dist/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.production.min.js +328 -330
  74. package/dist/compiled/react-dom-experimental/cjs/react-dom.development.js +250 -255
  75. package/dist/compiled/react-dom-experimental/cjs/react-dom.production.min.js +327 -327
  76. package/dist/compiled/react-dom-experimental/cjs/react-dom.profiling.min.js +325 -325
  77. package/dist/compiled/react-dom-experimental/package.json +2 -2
  78. package/dist/compiled/react-experimental/cjs/react-jsx-dev-runtime.development.js +8 -1
  79. package/dist/compiled/react-experimental/cjs/react-jsx-runtime.development.js +8 -1
  80. package/dist/compiled/react-experimental/cjs/react.development.js +9 -2
  81. package/dist/compiled/react-experimental/cjs/react.production.min.js +1 -1
  82. package/dist/compiled/react-experimental/cjs/react.shared-subset.development.js +9 -2
  83. package/dist/compiled/react-experimental/cjs/react.shared-subset.production.min.js +1 -1
  84. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +299 -218
  85. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.min.js +24 -25
  86. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +326 -96
  87. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.min.js +26 -25
  88. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +325 -113
  89. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.min.js +26 -25
  90. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +304 -82
  91. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +24 -24
  92. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +144 -71
  93. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js +50 -48
  94. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +144 -71
  95. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +52 -50
  96. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +142 -68
  97. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js +44 -42
  98. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +119 -36
  99. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +58 -57
  100. package/dist/compiled/react-server-dom-webpack/package.json +2 -2
  101. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js +451 -218
  102. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.production.min.js +27 -26
  103. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.development.js +478 -96
  104. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.production.min.js +29 -25
  105. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.development.js +477 -113
  106. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.production.min.js +28 -25
  107. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.development.js +456 -82
  108. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +26 -24
  109. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.development.js +238 -71
  110. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.production.min.js +56 -52
  111. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.development.js +238 -71
  112. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.min.js +57 -53
  113. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.development.js +230 -68
  114. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.production.min.js +51 -47
  115. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.development.js +207 -36
  116. package/dist/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +61 -58
  117. package/dist/compiled/react-server-dom-webpack-experimental/package.json +2 -2
  118. package/dist/esm/build/index.js +2 -2
  119. package/dist/esm/build/swc/index.js +1 -1
  120. package/dist/esm/build/utils.js +7 -5
  121. package/dist/esm/build/utils.js.map +1 -1
  122. package/dist/esm/build/webpack/config/blocks/css/index.js +30 -5
  123. package/dist/esm/build/webpack/config/blocks/css/index.js.map +1 -1
  124. package/dist/esm/build/webpack/config/blocks/css/loaders/getCssModuleLocalIdent.js +1 -1
  125. package/dist/esm/build/webpack/config/blocks/css/loaders/getCssModuleLocalIdent.js.map +1 -1
  126. package/dist/esm/build/webpack/loaders/next-flight-css-loader.js +9 -8
  127. package/dist/esm/build/webpack/loaders/next-flight-css-loader.js.map +1 -1
  128. package/dist/esm/build/webpack/loaders/next-font-loader/index.js +1 -1
  129. package/dist/esm/build/webpack/loaders/next-font-loader/index.js.map +1 -1
  130. package/dist/esm/build/webpack/plugins/{next-types-plugin.js → next-types-plugin/index.js} +10 -10
  131. package/dist/esm/build/webpack/plugins/next-types-plugin/index.js.map +1 -0
  132. package/dist/esm/build/webpack/plugins/next-types-plugin/shared.js +4 -0
  133. package/dist/esm/build/webpack/plugins/next-types-plugin/shared.js.map +1 -0
  134. package/dist/esm/build/webpack-config.js +2 -2
  135. package/dist/esm/client/app-bootstrap.js +1 -1
  136. package/dist/esm/client/components/app-router.js +57 -48
  137. package/dist/esm/client/components/app-router.js.map +1 -1
  138. package/dist/esm/client/components/async-local-storage.js +3 -2
  139. package/dist/esm/client/components/async-local-storage.js.map +1 -1
  140. package/dist/esm/client/components/react-dev-overlay/hot-reloader-client.js +1 -1
  141. package/dist/esm/client/components/react-dev-overlay/hot-reloader-client.js.map +1 -1
  142. package/dist/esm/client/index.js +1 -1
  143. package/dist/esm/lib/find-pages-dir.js +0 -7
  144. package/dist/esm/lib/find-pages-dir.js.map +1 -1
  145. package/dist/esm/lib/metadata/resolve-metadata.js +2 -1
  146. package/dist/esm/lib/metadata/resolve-metadata.js.map +1 -1
  147. package/dist/esm/server/config.js +5 -3
  148. package/dist/esm/server/config.js.map +1 -1
  149. package/dist/esm/server/dev/hot-reloader.js +2 -2
  150. package/dist/esm/server/dev/hot-reloader.js.map +1 -1
  151. package/dist/esm/server/dev/next-dev-server.js +3 -3
  152. package/dist/esm/server/dev/next-dev-server.js.map +1 -1
  153. package/dist/esm/server/lib/incremental-cache/fetch-cache.js +34 -0
  154. package/dist/esm/server/lib/incremental-cache/fetch-cache.js.map +1 -1
  155. package/dist/esm/server/lib/incremental-cache/index.js +3 -1
  156. package/dist/esm/server/lib/incremental-cache/index.js.map +1 -1
  157. package/dist/esm/server/lib/render-server-standalone.js +4 -3
  158. package/dist/esm/server/lib/render-server-standalone.js.map +1 -1
  159. package/dist/lib/find-pages-dir.js +0 -46
  160. package/dist/lib/find-pages-dir.js.map +1 -1
  161. package/dist/lib/metadata/resolve-metadata.js +2 -1
  162. package/dist/lib/metadata/resolve-metadata.js.map +1 -1
  163. package/dist/lib/metadata/types/twitter-types.d.ts +1 -1
  164. package/dist/server/config.js +5 -3
  165. package/dist/server/config.js.map +1 -1
  166. package/dist/server/dev/hot-reloader.js +2 -2
  167. package/dist/server/dev/hot-reloader.js.map +1 -1
  168. package/dist/server/dev/next-dev-server.js +7 -7
  169. package/dist/server/dev/next-dev-server.js.map +1 -1
  170. package/dist/server/lib/incremental-cache/fetch-cache.d.ts +3 -0
  171. package/dist/server/lib/incremental-cache/fetch-cache.js +34 -0
  172. package/dist/server/lib/incremental-cache/fetch-cache.js.map +1 -1
  173. package/dist/server/lib/incremental-cache/index.js +3 -1
  174. package/dist/server/lib/incremental-cache/index.js.map +1 -1
  175. package/dist/server/lib/render-server-standalone.d.ts +2 -1
  176. package/dist/server/lib/render-server-standalone.js +4 -3
  177. package/dist/server/lib/render-server-standalone.js.map +1 -1
  178. package/dist/telemetry/anonymous-meta.js +1 -1
  179. package/dist/telemetry/events/session-stopped.js +2 -2
  180. package/dist/telemetry/events/version.js +2 -2
  181. package/package.json +16 -16
  182. package/dist/build/webpack/plugins/next-types-plugin.js.map +0 -1
  183. package/dist/esm/build/webpack/plugins/next-types-plugin.js.map +0 -1
  184. /package/dist/build/webpack/plugins/{next-types-plugin.test.d.ts → next-types-plugin/index.test.d.ts} +0 -0
@@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") {
17
17
  var React = require("next/dist/compiled/react-experimental");
18
18
  var ReactDOM = require('react-dom');
19
19
 
20
- var ReactVersion = '18.3.0-experimental-1cea38448-20230530';
20
+ var ReactVersion = '18.3.0-experimental-7118f5dd7-20230705';
21
21
 
22
22
  var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
23
23
 
@@ -85,11 +85,11 @@ function beginWriting(destination) {
85
85
  writtenBytes = 0;
86
86
  }
87
87
  function writeChunk(destination, chunk) {
88
- if (chunk.length === 0) {
88
+ if (chunk.byteLength === 0) {
89
89
  return;
90
90
  }
91
91
 
92
- if (chunk.length > VIEW_SIZE) {
92
+ if (chunk.byteLength > VIEW_SIZE) {
93
93
  {
94
94
  if (precomputedChunkSet.has(chunk)) {
95
95
  error('A large precomputed chunk was passed to writeChunk without being copied.' + ' Large chunks get enqueued directly and are not copied. This is incompatible with precomputed chunks because you cannot enqueue the same precomputed chunk twice.' + ' Use "cloneChunk" to make a copy of this large precomputed chunk before writing it. This is a bug in React.');
@@ -112,7 +112,7 @@ function writeChunk(destination, chunk) {
112
112
  var bytesToWrite = chunk;
113
113
  var allowableBytes = currentView.length - writtenBytes;
114
114
 
115
- if (allowableBytes < bytesToWrite.length) {
115
+ if (allowableBytes < bytesToWrite.byteLength) {
116
116
  // this chunk would overflow the current view. We enqueue a full view
117
117
  // and start a new view with the remaining chunk
118
118
  if (allowableBytes === 0) {
@@ -132,7 +132,7 @@ function writeChunk(destination, chunk) {
132
132
  }
133
133
 
134
134
  currentView.set(bytesToWrite, writtenBytes);
135
- writtenBytes += bytesToWrite.length;
135
+ writtenBytes += bytesToWrite.byteLength;
136
136
  }
137
137
  function writeChunkAndReturn(destination, chunk) {
138
138
  writeChunk(destination, chunk); // in web streams there is no backpressure so we can alwas write more
@@ -164,7 +164,7 @@ function stringToPrecomputedChunk(content) {
164
164
  return precomputedChunk;
165
165
  }
166
166
  function clonePrecomputedChunk(precomputedChunk) {
167
- return precomputedChunk.length > VIEW_SIZE ? precomputedChunk.slice() : precomputedChunk;
167
+ return precomputedChunk.byteLength > VIEW_SIZE ? precomputedChunk.slice() : precomputedChunk;
168
168
  }
169
169
  function closeWithError(destination, error) {
170
170
  // $FlowFixMe[method-unbinding]
@@ -1957,6 +1957,7 @@ var startScriptSrc = stringToPrecomputedChunk('<script src="');
1957
1957
  var startModuleSrc = stringToPrecomputedChunk('<script type="module" src="');
1958
1958
  var scriptNonce = stringToPrecomputedChunk('" nonce="');
1959
1959
  var scriptIntegirty = stringToPrecomputedChunk('" integrity="');
1960
+ var scriptCrossOrigin = stringToPrecomputedChunk('" crossorigin="');
1960
1961
  var endAsyncScript = stringToPrecomputedChunk('" async=""></script>');
1961
1962
  /**
1962
1963
  * This escaping function is designed to work with bootstrapScriptContent only.
@@ -1986,7 +1987,7 @@ var scriptReplacer = function (match, prefix, s, suffix) {
1986
1987
  // is set, the server will send instructions via data attributes (instead of inline scripts)
1987
1988
 
1988
1989
 
1989
- function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) {
1990
+ function createResponseState(resources, identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig) {
1990
1991
  var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix;
1991
1992
  var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk('<script nonce="' + escapeTextForBrowser(nonce) + '">');
1992
1993
  var bootstrapChunks = [];
@@ -2033,6 +2034,8 @@ function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bo
2033
2034
  var scriptConfig = bootstrapScripts[i];
2034
2035
  var src = typeof scriptConfig === 'string' ? scriptConfig : scriptConfig.src;
2035
2036
  var integrity = typeof scriptConfig === 'string' ? undefined : scriptConfig.integrity;
2037
+ var crossOrigin = typeof scriptConfig === 'string' || scriptConfig.crossOrigin == null ? undefined : scriptConfig.crossOrigin === 'use-credentials' ? 'use-credentials' : '';
2038
+ preloadBootstrapScript(resources, src, nonce, integrity, crossOrigin);
2036
2039
  bootstrapChunks.push(startScriptSrc, stringToChunk(escapeTextForBrowser(src)));
2037
2040
 
2038
2041
  if (nonce) {
@@ -2043,6 +2046,10 @@ function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bo
2043
2046
  bootstrapChunks.push(scriptIntegirty, stringToChunk(escapeTextForBrowser(integrity)));
2044
2047
  }
2045
2048
 
2049
+ if (typeof crossOrigin === 'string') {
2050
+ bootstrapChunks.push(scriptCrossOrigin, stringToChunk(escapeTextForBrowser(crossOrigin)));
2051
+ }
2052
+
2046
2053
  bootstrapChunks.push(endAsyncScript);
2047
2054
  }
2048
2055
  }
@@ -2055,6 +2062,9 @@ function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bo
2055
2062
 
2056
2063
  var _integrity = typeof _scriptConfig === 'string' ? undefined : _scriptConfig.integrity;
2057
2064
 
2065
+ var _crossOrigin = typeof _scriptConfig === 'string' || _scriptConfig.crossOrigin == null ? undefined : _scriptConfig.crossOrigin === 'use-credentials' ? 'use-credentials' : '';
2066
+
2067
+ preloadBootstrapModule(resources, _src, nonce, _integrity, _crossOrigin);
2058
2068
  bootstrapChunks.push(startModuleSrc, stringToChunk(escapeTextForBrowser(_src)));
2059
2069
 
2060
2070
  if (nonce) {
@@ -2065,6 +2075,10 @@ function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bo
2065
2075
  bootstrapChunks.push(scriptIntegirty, stringToChunk(escapeTextForBrowser(_integrity)));
2066
2076
  }
2067
2077
 
2078
+ if (typeof _crossOrigin === 'string') {
2079
+ bootstrapChunks.push(scriptCrossOrigin, stringToChunk(escapeTextForBrowser(_crossOrigin)));
2080
+ }
2081
+
2068
2082
  bootstrapChunks.push(endAsyncScript);
2069
2083
  }
2070
2084
  }
@@ -3447,31 +3461,13 @@ function pushLink(target, props, responseState, resources, textEmbedded, inserti
3447
3461
  }
3448
3462
  }
3449
3463
 
3450
- var resource = resources.preloadsMap.get(key);
3451
-
3452
- if (!resource) {
3453
- resource = {
3454
- type: 'preload',
3455
- chunks: [],
3456
- state: NoState,
3457
- props: preloadAsStylePropsFromProps(href, props)
3458
- };
3459
- resources.preloadsMap.set(key, resource);
3460
-
3461
- {
3462
- markAsImplicitResourceDEV(resource, props, resource.props);
3463
- }
3464
- }
3465
-
3466
- pushLinkImpl(resource.chunks, resource.props);
3467
- resources.usedStylesheets.add(resource);
3468
3464
  return pushLinkImpl(target, props);
3469
3465
  } else {
3470
3466
  // This stylesheet refers to a Resource and we create a new one if necessary
3471
- var _resource = resources.stylesMap.get(key);
3467
+ var resource = resources.stylesMap.get(key);
3472
3468
 
3473
3469
  {
3474
- var devResource = getAsResourceDEV(_resource);
3470
+ var devResource = getAsResourceDEV(resource);
3475
3471
 
3476
3472
  if (devResource) {
3477
3473
  switch (devResource.__provenance) {
@@ -3502,7 +3498,7 @@ function pushLink(target, props, responseState, resources, textEmbedded, inserti
3502
3498
  }
3503
3499
  }
3504
3500
 
3505
- if (!_resource) {
3501
+ if (!resource) {
3506
3502
  var resourceProps = stylesheetPropsFromRawProps(props);
3507
3503
  var preloadResource = resources.preloadsMap.get(key);
3508
3504
  var state = NoState;
@@ -3518,16 +3514,16 @@ function pushLink(target, props, responseState, resources, textEmbedded, inserti
3518
3514
  }
3519
3515
  }
3520
3516
 
3521
- _resource = {
3517
+ resource = {
3522
3518
  type: 'stylesheet',
3523
3519
  chunks: [],
3524
3520
  state: state,
3525
3521
  props: resourceProps
3526
3522
  };
3527
- resources.stylesMap.set(key, _resource);
3523
+ resources.stylesMap.set(key, resource);
3528
3524
 
3529
3525
  {
3530
- markAsRenderedResourceDEV(_resource, props);
3526
+ markAsRenderedResourceDEV(resource, props);
3531
3527
  }
3532
3528
 
3533
3529
  var precedenceSet = resources.precedences.get(precedence);
@@ -3555,11 +3551,11 @@ function pushLink(target, props, responseState, resources, textEmbedded, inserti
3555
3551
  resources.stylePrecedences.set(precedence, emptyStyleResource);
3556
3552
  }
3557
3553
 
3558
- precedenceSet.add(_resource);
3554
+ precedenceSet.add(resource);
3559
3555
  }
3560
3556
 
3561
3557
  if (resources.boundaryResources) {
3562
- resources.boundaryResources.add(_resource);
3558
+ resources.boundaryResources.add(resource);
3563
3559
  }
3564
3560
 
3565
3561
  if (textEmbedded) {
@@ -3937,114 +3933,78 @@ function pushStartHtml(target, props, responseState, insertionMode) {
3937
3933
 
3938
3934
  function pushScript(target, props, resources, textEmbedded, insertionMode, noscriptTagInScope) {
3939
3935
  {
3940
- if (insertionMode === SVG_MODE || noscriptTagInScope || props.itemProp != null || typeof props.src !== 'string' || !props.src) {
3941
- // This script will not be a resource nor can it be preloaded, we bailout early
3942
- // and emit it in place.
3936
+ var asyncProp = props.async;
3937
+
3938
+ if (typeof props.src !== 'string' || !props.src || !(asyncProp && typeof asyncProp !== 'function' && typeof asyncProp !== 'symbol') || props.onLoad || props.onError || insertionMode === SVG_MODE || noscriptTagInScope || props.itemProp != null) {
3939
+ // This script will not be a resource, we bailout early and emit it in place.
3943
3940
  return pushScriptImpl(target, props);
3944
3941
  }
3945
3942
 
3946
3943
  var src = props.src;
3947
- var key = getResourceKey('script', src);
3948
-
3949
- if (props.async !== true || props.onLoad || props.onError) {
3950
- // we don't want to preload nomodule scripts
3951
- if (props.noModule !== true) {
3952
- // We can't resourcify scripts with load listeners. To avoid ambiguity with
3953
- // other Resourcified async scripts on the server we omit them from the server
3954
- // stream and expect them to be inserted during hydration on the client.
3955
- // We can still preload them however so the client can start fetching the script
3956
- // as soon as possible
3957
- var resource = resources.preloadsMap.get(key);
3944
+ var key = getResourceKey('script', src); // We can make this <script> into a ScriptResource
3958
3945
 
3959
- if (!resource) {
3960
- resource = {
3961
- type: 'preload',
3962
- chunks: [],
3963
- state: NoState,
3964
- props: preloadAsScriptPropsFromProps(props.src, props)
3965
- };
3966
- resources.preloadsMap.set(key, resource);
3967
-
3968
- {
3969
- markAsImplicitResourceDEV(resource, props, resource.props);
3970
- }
3971
-
3972
- resources.usedScripts.add(resource);
3973
- pushLinkImpl(resource.chunks, resource.props);
3974
- }
3975
- }
3946
+ var resource = resources.scriptsMap.get(key);
3976
3947
 
3977
- if (props.async !== true) {
3978
- // This is not an async script, we can preloaded it but it still needs to
3979
- // be emitted in place since it needs to hydrate on the client
3980
- pushScriptImpl(target, props);
3981
- return null;
3982
- }
3983
- } else {
3984
- // We can make this <script> into a ScriptResource
3985
- var _resource2 = resources.scriptsMap.get(key);
3986
-
3987
- {
3988
- var devResource = getAsResourceDEV(_resource2);
3989
-
3990
- if (devResource) {
3991
- switch (devResource.__provenance) {
3992
- case 'rendered':
3993
- {
3994
- var differenceDescription = describeDifferencesForScripts( // Diff the props from the JSX element, not the derived resource props
3995
- props, devResource.__originalProps);
3948
+ {
3949
+ var devResource = getAsResourceDEV(resource);
3996
3950
 
3997
- if (differenceDescription) {
3998
- error('React encountered a <script async={true} src="%s" .../> that has props that conflict' + ' with another hoistable script with the same `src`. When rendering hoistable scripts (async scripts without any loading handlers)' + ' the props from the first encountered instance will be used and props from later instances will be ignored.' + ' Update the props on both <script async={true} .../> instance so they agree.%s', src, differenceDescription);
3999
- }
3951
+ if (devResource) {
3952
+ switch (devResource.__provenance) {
3953
+ case 'rendered':
3954
+ {
3955
+ var differenceDescription = describeDifferencesForScripts( // Diff the props from the JSX element, not the derived resource props
3956
+ props, devResource.__originalProps);
4000
3957
 
4001
- break;
3958
+ if (differenceDescription) {
3959
+ error('React encountered a <script async={true} src="%s" .../> that has props that conflict' + ' with another hoistable script with the same `src`. When rendering hoistable scripts (async scripts without any loading handlers)' + ' the props from the first encountered instance will be used and props from later instances will be ignored.' + ' Update the props on both <script async={true} .../> instance so they agree.%s', src, differenceDescription);
4002
3960
  }
4003
3961
 
4004
- case 'preinit':
4005
- {
4006
- var _differenceDescription2 = describeDifferencesForScriptOverPreinit( // Diff the props from the JSX element, not the derived resource props
4007
- props, devResource.__propsEquivalent);
3962
+ break;
3963
+ }
4008
3964
 
4009
- if (_differenceDescription2) {
4010
- error('React encountered a <script async={true} src="%s" .../> with props that conflict' + ' with the options provided to `ReactDOM.preinit("%s", { as: "script", ... })`. React will use the first props or preinitialization' + ' options encountered when rendering a hoistable script with a particular `src` and will ignore any newer props or' + ' options. The first instance of this script resource was created using the `ReactDOM.preinit()` function.' + ' Please note, `ReactDOM.preinit()` is modeled off of module import assertions capabilities and does not support' + ' arbitrary props. If you need to have props not included with the preinit options you will need to rely on rendering' + ' <script> tags only.%s', src, src, _differenceDescription2);
4011
- }
3965
+ case 'preinit':
3966
+ {
3967
+ var _differenceDescription2 = describeDifferencesForScriptOverPreinit( // Diff the props from the JSX element, not the derived resource props
3968
+ props, devResource.__propsEquivalent);
4012
3969
 
4013
- break;
3970
+ if (_differenceDescription2) {
3971
+ error('React encountered a <script async={true} src="%s" .../> with props that conflict' + ' with the options provided to `ReactDOM.preinit("%s", { as: "script", ... })`. React will use the first props or preinitialization' + ' options encountered when rendering a hoistable script with a particular `src` and will ignore any newer props or' + ' options. The first instance of this script resource was created using the `ReactDOM.preinit()` function.' + ' Please note, `ReactDOM.preinit()` is modeled off of module import assertions capabilities and does not support' + ' arbitrary props. If you need to have props not included with the preinit options you will need to rely on rendering' + ' <script> tags only.%s', src, src, _differenceDescription2);
4014
3972
  }
4015
- }
3973
+
3974
+ break;
3975
+ }
4016
3976
  }
4017
3977
  }
3978
+ }
4018
3979
 
4019
- if (!_resource2) {
4020
- _resource2 = {
4021
- type: 'script',
4022
- chunks: [],
4023
- state: NoState,
4024
- props: null
4025
- };
4026
- resources.scriptsMap.set(key, _resource2);
3980
+ if (!resource) {
3981
+ resource = {
3982
+ type: 'script',
3983
+ chunks: [],
3984
+ state: NoState,
3985
+ props: null
3986
+ };
3987
+ resources.scriptsMap.set(key, resource);
4027
3988
 
4028
- {
4029
- markAsRenderedResourceDEV(_resource2, props);
4030
- } // Add to the script flushing queue
3989
+ {
3990
+ markAsRenderedResourceDEV(resource, props);
3991
+ } // Add to the script flushing queue
4031
3992
 
4032
3993
 
4033
- resources.scripts.add(_resource2);
4034
- var scriptProps = props;
4035
- var preloadResource = resources.preloadsMap.get(key);
3994
+ resources.scripts.add(resource);
3995
+ var scriptProps = props;
3996
+ var preloadResource = resources.preloadsMap.get(key);
4036
3997
 
4037
- if (preloadResource) {
4038
- // If we already had a preload we don't want that resource to flush directly.
4039
- // We let the newly created resource govern flushing.
4040
- preloadResource.state |= Blocked;
4041
- scriptProps = assign({}, props);
4042
- adoptPreloadPropsForScriptProps(scriptProps, preloadResource.props);
4043
- } // encode the tag as Chunks
3998
+ if (preloadResource) {
3999
+ // If we already had a preload we don't want that resource to flush directly.
4000
+ // We let the newly created resource govern flushing.
4001
+ preloadResource.state |= Blocked;
4002
+ scriptProps = assign({}, props);
4003
+ adoptPreloadPropsForScriptProps(scriptProps, preloadResource.props);
4004
+ } // encode the tag as Chunks
4044
4005
 
4045
4006
 
4046
- pushScriptImpl(_resource2.chunks, scriptProps);
4047
- }
4007
+ pushScriptImpl(resource.chunks, scriptProps);
4048
4008
  }
4049
4009
 
4050
4010
  if (textEmbedded) {
@@ -5285,22 +5245,8 @@ function writePreamble(destination, resources, responseState, willFlushAllSegmen
5285
5245
  resources.fontPreloads.clear(); // Flush unblocked stylesheets by precedence
5286
5246
 
5287
5247
  resources.precedences.forEach(flushAllStylesInPreamble, destination);
5288
- resources.usedStylesheets.forEach(function (resource) {
5289
- var key = getResourceKey(resource.props.as, resource.props.href);
5290
-
5291
- if (resources.stylesMap.has(key)) ; else {
5292
- var _chunks = resource.chunks;
5293
-
5294
- for (i = 0; i < _chunks.length; i++) {
5295
- writeChunk(destination, _chunks[i]);
5296
- }
5297
- }
5298
- });
5299
- resources.usedStylesheets.clear();
5300
5248
  resources.scripts.forEach(flushResourceInPreamble, destination);
5301
5249
  resources.scripts.clear();
5302
- resources.usedScripts.forEach(flushResourceInPreamble, destination);
5303
- resources.usedScripts.clear();
5304
5250
  resources.explicitStylesheetPreloads.forEach(flushResourceInPreamble, destination);
5305
5251
  resources.explicitStylesheetPreloads.clear();
5306
5252
  resources.explicitScriptPreloads.forEach(flushResourceInPreamble, destination);
@@ -5358,22 +5304,8 @@ function writeHoistables(destination, resources, responseState) {
5358
5304
  // but we want to kick off preloading as soon as possible
5359
5305
 
5360
5306
  resources.precedences.forEach(preloadLateStyles, destination);
5361
- resources.usedStylesheets.forEach(function (resource) {
5362
- var key = getResourceKey(resource.props.as, resource.props.href);
5363
-
5364
- if (resources.stylesMap.has(key)) ; else {
5365
- var chunks = resource.chunks;
5366
-
5367
- for (i = 0; i < chunks.length; i++) {
5368
- writeChunk(destination, chunks[i]);
5369
- }
5370
- }
5371
- });
5372
- resources.usedStylesheets.clear();
5373
5307
  resources.scripts.forEach(flushResourceLate, destination);
5374
5308
  resources.scripts.clear();
5375
- resources.usedScripts.forEach(flushResourceLate, destination);
5376
- resources.usedScripts.clear();
5377
5309
  resources.explicitStylesheetPreloads.forEach(flushResourceLate, destination);
5378
5310
  resources.explicitStylesheetPreloads.clear();
5379
5311
  resources.explicitScriptPreloads.forEach(flushResourceLate, destination);
@@ -5799,9 +5731,7 @@ function createResources() {
5799
5731
  // usedImagePreloads: new Set(),
5800
5732
  precedences: new Map(),
5801
5733
  stylePrecedences: new Map(),
5802
- usedStylesheets: new Set(),
5803
5734
  scripts: new Set(),
5804
- usedScripts: new Set(),
5805
5735
  explicitStylesheetPreloads: new Set(),
5806
5736
  // explicitImagePreloads: new Set(),
5807
5737
  explicitScriptPreloads: new Set(),
@@ -5935,18 +5865,50 @@ function preload(href, options) {
5935
5865
  var resources = getResources(request);
5936
5866
 
5937
5867
  {
5868
+ var encountered = '';
5869
+
5938
5870
  if (typeof href !== 'string' || !href) {
5939
- error('ReactDOM.preload(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.', getValueDescriptorExpectingObjectForWarning(href));
5940
- } else if (options == null || typeof options !== 'object') {
5941
- error('ReactDOM.preload(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preloaded but encountered %s instead.', getValueDescriptorExpectingEnumForWarning(options));
5942
- } else if (typeof options.as !== 'string') {
5943
- error('ReactDOM.preload(): Expected the `as` property in the `options` argument (second) to contain a string value describing the type of resource to be preloaded but encountered %s instead. Values that are valid in for the `as` attribute of a `<link rel="preload" as="..." />` tag are valid here.', getValueDescriptorExpectingEnumForWarning(options.as));
5871
+ encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".";
5872
+ }
5873
+
5874
+ if (options == null || typeof options !== 'object') {
5875
+ encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + ".";
5876
+ } else if (typeof options.as !== 'string' || !options.as) {
5877
+ encountered += " The `as` option encountered was " + getValueDescriptorExpectingObjectForWarning(options.as) + ".";
5878
+ }
5879
+
5880
+ if (encountered) {
5881
+ 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);
5944
5882
  }
5945
5883
  }
5946
5884
 
5947
- if (typeof href === 'string' && href && typeof options === 'object' && options !== null && typeof options.as === 'string') {
5885
+ if (typeof href === 'string' && href && typeof options === 'object' && options !== null && typeof options.as === 'string' && options.as) {
5948
5886
  var as = options.as;
5949
- var key = getResourceKey(as, href);
5887
+ var key;
5888
+
5889
+ if (as === 'image') {
5890
+ // For image preloads the key contains either the imageSrcSet + imageSizes or the href but not
5891
+ // both. This is to prevent identical calls with the same srcSet and sizes to be duplicated
5892
+ // by varying the href. this is an edge case but it is the most correct behavior.
5893
+ var imageSrcSet = options.imageSrcSet,
5894
+ imageSizes = options.imageSizes;
5895
+ var uniquePart = '';
5896
+
5897
+ if (typeof imageSrcSet === 'string' && imageSrcSet !== '') {
5898
+ uniquePart += '[' + imageSrcSet + ']';
5899
+
5900
+ if (typeof imageSizes === 'string') {
5901
+ uniquePart += '[' + imageSizes + ']';
5902
+ }
5903
+ } else {
5904
+ uniquePart += '[][]' + href;
5905
+ }
5906
+
5907
+ key = getResourceKey(as, uniquePart);
5908
+ } else {
5909
+ key = getResourceKey(as, href);
5910
+ }
5911
+
5950
5912
  var resource = resources.preloadsMap.get(key);
5951
5913
 
5952
5914
  {
@@ -6161,10 +6123,10 @@ function preinit(href, options) {
6161
6123
 
6162
6124
  var _key = getResourceKey(as, src);
6163
6125
 
6164
- var _resource3 = resources.scriptsMap.get(_key);
6126
+ var _resource = resources.scriptsMap.get(_key);
6165
6127
 
6166
6128
  {
6167
- var _devResource = getAsResourceDEV(_resource3);
6129
+ var _devResource = getAsResourceDEV(_resource);
6168
6130
 
6169
6131
  if (_devResource) {
6170
6132
  var _propsEquivalent = scriptPropsFromPreinitOptions(src, options);
@@ -6197,23 +6159,23 @@ function preinit(href, options) {
6197
6159
  }
6198
6160
  }
6199
6161
 
6200
- if (!_resource3) {
6201
- _resource3 = {
6162
+ if (!_resource) {
6163
+ _resource = {
6202
6164
  type: 'script',
6203
6165
  chunks: [],
6204
6166
  state: NoState,
6205
6167
  props: null
6206
6168
  };
6207
- resources.scriptsMap.set(_key, _resource3);
6169
+ resources.scriptsMap.set(_key, _resource);
6208
6170
 
6209
6171
  var _resourceProps = scriptPropsFromPreinitOptions(src, options);
6210
6172
 
6211
6173
  {
6212
- markAsImperativeResourceDEV(_resource3, 'preinit', href, options, _resourceProps);
6174
+ markAsImperativeResourceDEV(_resource, 'preinit', href, options, _resourceProps);
6213
6175
  }
6214
6176
 
6215
- resources.scripts.add(_resource3);
6216
- pushScriptImpl(_resource3.chunks, _resourceProps);
6177
+ resources.scripts.add(_resource);
6178
+ pushScriptImpl(_resource.chunks, _resourceProps);
6217
6179
  flushResources(request);
6218
6180
  }
6219
6181
 
@@ -6221,6 +6183,76 @@ function preinit(href, options) {
6221
6183
  }
6222
6184
  }
6223
6185
  }
6186
+ } // This function is only safe to call at Request start time since it assumes
6187
+ // that each script has not already been preloaded. If we find a need to preload
6188
+ // scripts at any other point in time we will need to check whether the preload
6189
+ // already exists and not assume it
6190
+
6191
+
6192
+ function preloadBootstrapScript(resources, src, nonce, integrity, crossOrigin) {
6193
+ var key = getResourceKey('script', src);
6194
+
6195
+ {
6196
+ if (resources.preloadsMap.has(key)) {
6197
+ // This is coded as a React error because it should be impossible for a userspace preload to preempt this call
6198
+ // If a userspace preload can preempt it then this assumption is broken and we need to reconsider this strategy
6199
+ // rather than instruct the user to not preload their bootstrap scripts themselves
6200
+ error('Internal React Error: React expected bootstrap script with src "%s" to not have been preloaded already. please file an issue', src);
6201
+ }
6202
+ }
6203
+
6204
+ var props = {
6205
+ rel: 'preload',
6206
+ href: src,
6207
+ as: 'script',
6208
+ nonce: nonce,
6209
+ integrity: integrity,
6210
+ crossOrigin: crossOrigin
6211
+ };
6212
+ var resource = {
6213
+ type: 'preload',
6214
+ chunks: [],
6215
+ state: NoState,
6216
+ props: props
6217
+ };
6218
+ resources.preloadsMap.set(key, resource);
6219
+ resources.explicitScriptPreloads.add(resource);
6220
+ pushLinkImpl(resource.chunks, props);
6221
+ } // This function is only safe to call at Request start time since it assumes
6222
+ // that each module has not already been preloaded. If we find a need to preload
6223
+ // scripts at any other point in time we will need to check whether the preload
6224
+ // already exists and not assume it
6225
+
6226
+
6227
+ function preloadBootstrapModule(resources, src, nonce, integrity, crossOrigin) {
6228
+ var key = getResourceKey('script', src);
6229
+
6230
+ {
6231
+ if (resources.preloadsMap.has(key)) {
6232
+ // This is coded as a React error because it should be impossible for a userspace preload to preempt this call
6233
+ // If a userspace preload can preempt it then this assumption is broken and we need to reconsider this strategy
6234
+ // rather than instruct the user to not preload their bootstrap scripts themselves
6235
+ error('Internal React Error: React expected bootstrap module with src "%s" to not have been preloaded already. please file an issue', src);
6236
+ }
6237
+ }
6238
+
6239
+ var props = {
6240
+ rel: 'modulepreload',
6241
+ href: src,
6242
+ nonce: nonce,
6243
+ integrity: integrity,
6244
+ crossOrigin: crossOrigin
6245
+ };
6246
+ var resource = {
6247
+ type: 'preload',
6248
+ chunks: [],
6249
+ state: NoState,
6250
+ props: props
6251
+ };
6252
+ resources.preloadsMap.set(key, resource);
6253
+ resources.explicitScriptPreloads.add(resource);
6254
+ pushLinkImpl(resource.chunks, props);
6255
+ return;
6224
6256
  }
6225
6257
 
6226
6258
  function internalPreinitScript(resources, src, chunks) {
@@ -6245,10 +6277,18 @@ function preloadPropsFromPreloadOptions(href, as, options) {
6245
6277
  return {
6246
6278
  rel: 'preload',
6247
6279
  as: as,
6248
- href: href,
6280
+ // There is a bug in Safari where imageSrcSet is not respected on preload links
6281
+ // so we omit the href here if we have imageSrcSet b/c safari will load the wrong image.
6282
+ // This harms older browers that do not support imageSrcSet by making their preloads not work
6283
+ // but this population is shrinking fast and is already small so we accept this tradeoff.
6284
+ href: as === 'image' && options.imageSrcSet ? undefined : href,
6249
6285
  crossOrigin: as === 'font' ? '' : options.crossOrigin,
6250
6286
  integrity: options.integrity,
6251
- type: options.type
6287
+ type: options.type,
6288
+ nonce: options.nonce,
6289
+ fetchPriority: options.fetchPriority,
6290
+ imageSrcSet: options.imageSrcSet,
6291
+ imageSizes: options.imageSizes
6252
6292
  };
6253
6293
  }
6254
6294
 
@@ -6266,26 +6306,14 @@ function preloadAsStylePropsFromProps(href, props) {
6266
6306
  };
6267
6307
  }
6268
6308
 
6269
- function preloadAsScriptPropsFromProps(href, props) {
6270
- return {
6271
- rel: 'preload',
6272
- as: 'script',
6273
- href: href,
6274
- crossOrigin: props.crossOrigin,
6275
- fetchPriority: props.fetchPriority,
6276
- integrity: props.integrity,
6277
- nonce: props.nonce,
6278
- referrerPolicy: props.referrerPolicy
6279
- };
6280
- }
6281
-
6282
6309
  function stylesheetPropsFromPreinitOptions(href, precedence, options) {
6283
6310
  return {
6284
6311
  rel: 'stylesheet',
6285
6312
  href: href,
6286
6313
  'data-precedence': precedence,
6287
6314
  crossOrigin: options.crossOrigin,
6288
- integrity: options.integrity
6315
+ integrity: options.integrity,
6316
+ fetchPriority: options.fetchPriority
6289
6317
  };
6290
6318
  }
6291
6319
 
@@ -6307,7 +6335,8 @@ function scriptPropsFromPreinitOptions(src, options) {
6307
6335
  async: true,
6308
6336
  crossOrigin: options.crossOrigin,
6309
6337
  integrity: options.integrity,
6310
- nonce: options.nonce
6338
+ nonce: options.nonce,
6339
+ fetchPriority: options.fetchPriority
6311
6340
  };
6312
6341
  }
6313
6342
 
@@ -6356,20 +6385,6 @@ function markAsImperativeResourceDEV(resource, provenance, originalHref, origina
6356
6385
  }
6357
6386
  }
6358
6387
 
6359
- function markAsImplicitResourceDEV(resource, underlyingProps, impliedProps) {
6360
- {
6361
- var devResource = resource;
6362
-
6363
- if (typeof devResource.__provenance === 'string') {
6364
- error('Resource already marked for DEV type. This is a bug in React.');
6365
- }
6366
-
6367
- devResource.__provenance = 'implicit';
6368
- devResource.__underlyingProps = underlyingProps;
6369
- devResource.__impliedProps = impliedProps;
6370
- }
6371
- }
6372
-
6373
6388
  function getAsResourceDEV(resource) {
6374
6389
  {
6375
6390
  if (resource) {
@@ -6735,7 +6750,14 @@ function describeNativeComponentFrame(fn, construct) {
6735
6750
  // in simple components too
6736
6751
 
6737
6752
 
6738
- fn();
6753
+ var maybePromise = fn(); // If the function component returns a promise, it's likely an async
6754
+ // component, which we don't yet support. Attach a noop catch handler to
6755
+ // silence the error.
6756
+ // TODO: Implement component stacks for async client components?
6757
+
6758
+ if (maybePromise && typeof maybePromise.catch === 'function') {
6759
+ maybePromise.catch(function () {});
6760
+ }
6739
6761
  }
6740
6762
  } catch (sample) {
6741
6763
  // This is inlined manually because closure doesn't do it for us.
@@ -8355,13 +8377,6 @@ function throwOnUseEffectEventCall() {
8355
8377
  function useEffectEvent(callback) {
8356
8378
  // $FlowIgnore[incompatible-return]
8357
8379
  return throwOnUseEffectEventCall;
8358
- } // TODO Decide on how to implement this hook for server rendering.
8359
- // If a mutation occurs during render, consider triggering a Suspense boundary
8360
- // and falling back to client rendering.
8361
-
8362
- function useMutableSource(source, getSnapshot, subscribe) {
8363
- resolveCurrentlyRenderingComponent();
8364
- return getSnapshot(source._source);
8365
8380
  }
8366
8381
 
8367
8382
  function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
@@ -8482,7 +8497,6 @@ var HooksDispatcher = {
8482
8497
  useTransition: useTransition,
8483
8498
  useId: useId,
8484
8499
  // Subscriptions are not setup in a server environment.
8485
- useMutableSource: useMutableSource,
8486
8500
  useSyncExternalStore: useSyncExternalStore
8487
8501
  };
8488
8502
 
@@ -8590,11 +8604,10 @@ function defaultErrorHandler(error) {
8590
8604
 
8591
8605
  function noop() {}
8592
8606
 
8593
- function createRequest(children, responseState, rootFormatContext, progressiveChunkSize, onError, onAllReady, onShellReady, onShellError, onFatalError) {
8607
+ function createRequest(children, resources, responseState, rootFormatContext, progressiveChunkSize, onError, onAllReady, onShellReady, onShellError, onFatalError) {
8594
8608
  prepareHostDispatcher();
8595
8609
  var pingedTasks = [];
8596
8610
  var abortSet = new Set();
8597
- var resources = createResources();
8598
8611
  var request = {
8599
8612
  destination: null,
8600
8613
  flushScheduled: false,
@@ -10213,7 +10226,12 @@ function flushCompletedQueues(request, destination) {
10213
10226
  // We haven't flushed the root yet so we don't need to check any other branches further down
10214
10227
  return;
10215
10228
  }
10216
- } else if (enableFloat) {
10229
+ } else if (request.pendingRootTasks > 0) {
10230
+ // We have not yet flushed the root segment so we early return
10231
+ return;
10232
+ }
10233
+
10234
+ if (enableFloat) {
10217
10235
  writeHoistables(destination, request.resources, request.responseState);
10218
10236
  } // We emit client rendering instructions for already emitted boundaries first.
10219
10237
  // This is so that we can signal to the client to start client rendering them as
@@ -10415,7 +10433,8 @@ function prerender(children, options) {
10415
10433
  resolve(result);
10416
10434
  }
10417
10435
 
10418
- var request = createRequest(children, createResponseState(options ? options.identifierPrefix : undefined, undefined, options ? options.bootstrapScriptContent : undefined, options ? options.bootstrapScripts : undefined, options ? options.bootstrapModules : undefined, options ? options.unstable_externalRuntimeSrc : undefined), createRootFormatContext(options ? options.namespaceURI : undefined), options ? options.progressiveChunkSize : undefined, options ? options.onError : undefined, onAllReady, undefined, undefined, onFatalError);
10436
+ var resources = createResources();
10437
+ var request = createRequest(children, resources, createResponseState(resources, options ? options.identifierPrefix : undefined, undefined, options ? options.bootstrapScriptContent : undefined, options ? options.bootstrapScripts : undefined, options ? options.bootstrapModules : undefined, options ? options.unstable_externalRuntimeSrc : undefined), createRootFormatContext(options ? options.namespaceURI : undefined), options ? options.progressiveChunkSize : undefined, options ? options.onError : undefined, onAllReady, undefined, undefined, onFatalError);
10419
10438
 
10420
10439
  if (options && options.signal) {
10421
10440
  var signal = options.signal;