vinext 0.0.29 → 0.0.31

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 (428) hide show
  1. package/README.md +12 -6
  2. package/dist/build/prerender.d.ts +188 -0
  3. package/dist/build/prerender.js +675 -0
  4. package/dist/build/prerender.js.map +1 -0
  5. package/dist/build/report.d.ts +45 -46
  6. package/dist/build/report.js +247 -276
  7. package/dist/build/report.js.map +1 -1
  8. package/dist/build/run-prerender.d.ts +62 -0
  9. package/dist/build/run-prerender.js +183 -0
  10. package/dist/build/run-prerender.js.map +1 -0
  11. package/dist/build/server-manifest.d.ts +19 -0
  12. package/dist/build/server-manifest.js +29 -0
  13. package/dist/build/server-manifest.js.map +1 -0
  14. package/dist/build/static-export.d.ts +51 -66
  15. package/dist/build/static-export.js +51 -545
  16. package/dist/build/static-export.js.map +1 -1
  17. package/dist/check.d.ts +26 -24
  18. package/dist/check.js +591 -567
  19. package/dist/check.js.map +1 -1
  20. package/dist/cli.d.ts +1 -15
  21. package/dist/cli.js +430 -491
  22. package/dist/cli.js.map +1 -1
  23. package/dist/client/entry.d.ts +1 -2
  24. package/dist/client/entry.js +49 -62
  25. package/dist/client/entry.js.map +1 -1
  26. package/dist/client/validate-module-path.d.ts +4 -1
  27. package/dist/client/validate-module-path.js +23 -28
  28. package/dist/client/validate-module-path.js.map +1 -1
  29. package/dist/client/vinext-next-data.d.ts +15 -20
  30. package/dist/client/vinext-next-data.js +0 -1
  31. package/dist/cloudflare/index.d.ts +3 -8
  32. package/dist/cloudflare/index.js +3 -8
  33. package/dist/cloudflare/kv-cache-handler.d.ts +95 -105
  34. package/dist/cloudflare/kv-cache-handler.js +354 -366
  35. package/dist/cloudflare/kv-cache-handler.js.map +1 -1
  36. package/dist/cloudflare/tpr.d.ts +36 -34
  37. package/dist/cloudflare/tpr.js +460 -603
  38. package/dist/cloudflare/tpr.js.map +1 -1
  39. package/dist/config/config-matchers.d.ts +31 -40
  40. package/dist/config/config-matchers.js +727 -936
  41. package/dist/config/config-matchers.js.map +1 -1
  42. package/dist/config/dotenv.d.ts +18 -11
  43. package/dist/config/dotenv.js +79 -84
  44. package/dist/config/dotenv.js.map +1 -1
  45. package/dist/config/next-config.d.ts +156 -146
  46. package/dist/config/next-config.js +374 -464
  47. package/dist/config/next-config.js.map +1 -1
  48. package/dist/deploy.d.ts +87 -96
  49. package/dist/deploy.js +490 -628
  50. package/dist/deploy.js.map +1 -1
  51. package/dist/entries/app-browser-entry.d.ts +4 -1
  52. package/dist/entries/app-browser-entry.js +12 -8
  53. package/dist/entries/app-browser-entry.js.map +1 -1
  54. package/dist/entries/app-rsc-entry.d.ts +33 -20
  55. package/dist/entries/app-rsc-entry.js +618 -343
  56. package/dist/entries/app-rsc-entry.js.map +1 -1
  57. package/dist/entries/app-ssr-entry.d.ts +9 -1
  58. package/dist/entries/app-ssr-entry.js +61 -28
  59. package/dist/entries/app-ssr-entry.js.map +1 -1
  60. package/dist/entries/pages-client-entry.d.ts +6 -2
  61. package/dist/entries/pages-client-entry.js +30 -33
  62. package/dist/entries/pages-client-entry.js.map +1 -1
  63. package/dist/entries/pages-entry-helpers.d.ts +5 -1
  64. package/dist/entries/pages-entry-helpers.js +17 -14
  65. package/dist/entries/pages-entry-helpers.js.map +1 -1
  66. package/dist/entries/pages-server-entry.d.ts +6 -2
  67. package/dist/entries/pages-server-entry.js +229 -207
  68. package/dist/entries/pages-server-entry.js.map +1 -1
  69. package/dist/index.d.ts +82 -62
  70. package/dist/index.js +2172 -3125
  71. package/dist/index.js.map +1 -1
  72. package/dist/init.d.ts +40 -37
  73. package/dist/init.js +201 -258
  74. package/dist/init.js.map +1 -1
  75. package/dist/plugins/async-hooks-stub.d.ts +7 -3
  76. package/dist/plugins/async-hooks-stub.js +39 -42
  77. package/dist/plugins/async-hooks-stub.js.map +1 -1
  78. package/dist/plugins/client-reference-dedup.d.ts +7 -3
  79. package/dist/plugins/client-reference-dedup.js +63 -88
  80. package/dist/plugins/client-reference-dedup.js.map +1 -1
  81. package/dist/routing/app-router.d.ts +100 -96
  82. package/dist/routing/app-router.js +563 -659
  83. package/dist/routing/app-router.js.map +1 -1
  84. package/dist/routing/file-matcher.d.ts +18 -15
  85. package/dist/routing/file-matcher.js +65 -65
  86. package/dist/routing/file-matcher.js.map +1 -1
  87. package/dist/routing/pages-router.d.ts +23 -24
  88. package/dist/routing/pages-router.js +147 -172
  89. package/dist/routing/pages-router.js.map +1 -1
  90. package/dist/routing/route-trie.d.ts +23 -20
  91. package/dist/routing/route-trie.js +131 -151
  92. package/dist/routing/route-trie.js.map +1 -1
  93. package/dist/routing/route-validation.d.ts +5 -2
  94. package/dist/routing/route-validation.js +98 -130
  95. package/dist/routing/route-validation.js.map +1 -1
  96. package/dist/routing/utils.d.ts +10 -7
  97. package/dist/routing/utils.js +75 -111
  98. package/dist/routing/utils.js.map +1 -1
  99. package/dist/server/api-handler.d.ts +8 -13
  100. package/dist/server/api-handler.js +161 -193
  101. package/dist/server/api-handler.js.map +1 -1
  102. package/dist/server/app-router-entry.d.ts +6 -16
  103. package/dist/server/app-router-entry.js +26 -54
  104. package/dist/server/app-router-entry.js.map +1 -1
  105. package/dist/server/dev-module-runner.d.ts +11 -64
  106. package/dist/server/dev-module-runner.js +89 -101
  107. package/dist/server/dev-module-runner.js.map +1 -1
  108. package/dist/server/dev-origin-check.d.ts +12 -10
  109. package/dist/server/dev-origin-check.js +98 -108
  110. package/dist/server/dev-origin-check.js.map +1 -1
  111. package/dist/server/dev-server.d.ts +17 -13
  112. package/dist/server/dev-server.js +547 -874
  113. package/dist/server/dev-server.js.map +1 -1
  114. package/dist/server/html.d.ts +4 -1
  115. package/dist/server/html.js +25 -26
  116. package/dist/server/html.js.map +1 -1
  117. package/dist/server/image-optimization.d.ts +31 -28
  118. package/dist/server/image-optimization.js +183 -200
  119. package/dist/server/image-optimization.js.map +1 -1
  120. package/dist/server/instrumentation.d.ts +25 -22
  121. package/dist/server/instrumentation.js +110 -122
  122. package/dist/server/instrumentation.js.map +1 -1
  123. package/dist/server/isr-cache.d.ts +16 -26
  124. package/dist/server/isr-cache.js +109 -126
  125. package/dist/server/isr-cache.js.map +1 -1
  126. package/dist/server/metadata-routes.d.ts +85 -88
  127. package/dist/server/metadata-routes.js +277 -286
  128. package/dist/server/metadata-routes.js.map +1 -1
  129. package/dist/server/middleware-codegen.d.ts +7 -4
  130. package/dist/server/middleware-codegen.js +98 -65
  131. package/dist/server/middleware-codegen.js.map +1 -1
  132. package/dist/server/middleware-request-headers.d.ts +8 -6
  133. package/dist/server/middleware-request-headers.js +47 -65
  134. package/dist/server/middleware-request-headers.js.map +1 -1
  135. package/dist/server/middleware.d.ts +31 -47
  136. package/dist/server/middleware.js +276 -363
  137. package/dist/server/middleware.js.map +1 -1
  138. package/dist/server/normalize-path.d.ts +4 -1
  139. package/dist/server/normalize-path.js +33 -47
  140. package/dist/server/normalize-path.js.map +1 -1
  141. package/dist/server/pages-i18n.d.ts +58 -0
  142. package/dist/server/pages-i18n.js +125 -0
  143. package/dist/server/pages-i18n.js.map +1 -0
  144. package/dist/server/prod-server.d.ts +19 -31
  145. package/dist/server/prod-server.js +714 -945
  146. package/dist/server/prod-server.js.map +1 -1
  147. package/dist/server/request-log.d.ts +18 -12
  148. package/dist/server/request-log.js +45 -52
  149. package/dist/server/request-log.js.map +1 -1
  150. package/dist/server/request-pipeline.d.ts +9 -17
  151. package/dist/server/request-pipeline.js +133 -184
  152. package/dist/server/request-pipeline.js.map +1 -1
  153. package/dist/server/worker-utils.d.ts +4 -1
  154. package/dist/server/worker-utils.js +31 -37
  155. package/dist/server/worker-utils.js.map +1 -1
  156. package/dist/shims/amp.d.ts +5 -2
  157. package/dist/shims/amp.js +19 -15
  158. package/dist/shims/amp.js.map +1 -1
  159. package/dist/shims/app.d.ts +8 -10
  160. package/dist/shims/app.js +0 -1
  161. package/dist/shims/cache-runtime.d.ts +21 -43
  162. package/dist/shims/cache-runtime.js +271 -405
  163. package/dist/shims/cache-runtime.js.map +1 -1
  164. package/dist/shims/cache.d.ts +131 -119
  165. package/dist/shims/cache.js +339 -418
  166. package/dist/shims/cache.js.map +1 -1
  167. package/dist/shims/client-only.d.ts +1 -18
  168. package/dist/shims/client-only.js +0 -17
  169. package/dist/shims/compat-router.d.ts +4 -1
  170. package/dist/shims/compat-router.js +23 -19
  171. package/dist/shims/compat-router.js.map +1 -1
  172. package/dist/shims/config.d.ts +7 -5
  173. package/dist/shims/config.js +16 -23
  174. package/dist/shims/config.js.map +1 -1
  175. package/dist/shims/constants.d.ts +119 -118
  176. package/dist/shims/constants.js +159 -165
  177. package/dist/shims/constants.js.map +1 -1
  178. package/dist/shims/document.d.ts +20 -16
  179. package/dist/shims/document.js +41 -22
  180. package/dist/shims/document.js.map +1 -1
  181. package/dist/shims/dynamic.d.ts +13 -22
  182. package/dist/shims/dynamic.js +122 -136
  183. package/dist/shims/dynamic.js.map +1 -1
  184. package/dist/shims/error-boundary.d.ts +22 -15
  185. package/dist/shims/error-boundary.js +81 -79
  186. package/dist/shims/error-boundary.js.map +1 -1
  187. package/dist/shims/error.d.ts +11 -12
  188. package/dist/shims/error.js +35 -39
  189. package/dist/shims/error.js.map +1 -1
  190. package/dist/shims/fetch-cache.d.ts +26 -10
  191. package/dist/shims/fetch-cache.js +443 -586
  192. package/dist/shims/fetch-cache.js.map +1 -1
  193. package/dist/shims/font-google-base.d.ts +28 -26
  194. package/dist/shims/font-google-base.js +238 -325
  195. package/dist/shims/font-google-base.js.map +1 -1
  196. package/dist/shims/font-google.d.ts +3 -3
  197. package/dist/shims/font-google.generated.d.ts +1928 -1924
  198. package/dist/shims/font-google.generated.js +1928 -2133
  199. package/dist/shims/font-google.generated.js.map +1 -1
  200. package/dist/shims/font-google.js +3 -3
  201. package/dist/shims/font-local.d.ts +28 -26
  202. package/dist/shims/font-local.js +204 -260
  203. package/dist/shims/font-local.js.map +1 -1
  204. package/dist/shims/form.d.ts +13 -27
  205. package/dist/shims/form.js +128 -180
  206. package/dist/shims/form.js.map +1 -1
  207. package/dist/shims/head-state.d.ts +9 -10
  208. package/dist/shims/head-state.js +25 -39
  209. package/dist/shims/head-state.js.map +1 -1
  210. package/dist/shims/head.d.ts +16 -18
  211. package/dist/shims/head.js +185 -153
  212. package/dist/shims/head.js.map +1 -1
  213. package/dist/shims/headers.d.ts +84 -71
  214. package/dist/shims/headers.js +447 -583
  215. package/dist/shims/headers.js.map +1 -1
  216. package/dist/shims/i18n-context.d.ts +23 -0
  217. package/dist/shims/i18n-context.js +44 -0
  218. package/dist/shims/i18n-context.js.map +1 -0
  219. package/dist/shims/i18n-state.d.ts +14 -0
  220. package/dist/shims/i18n-state.js +45 -0
  221. package/dist/shims/i18n-state.js.map +1 -0
  222. package/dist/shims/image-config.d.ts +11 -8
  223. package/dist/shims/image-config.js +50 -83
  224. package/dist/shims/image-config.js.map +1 -1
  225. package/dist/shims/image.d.ts +37 -44
  226. package/dist/shims/image.js +284 -301
  227. package/dist/shims/image.js.map +1 -1
  228. package/dist/shims/internal/api-utils.d.ts +7 -4
  229. package/dist/shims/internal/api-utils.js +0 -6
  230. package/dist/shims/internal/app-router-context.d.ts +22 -17
  231. package/dist/shims/internal/app-router-context.js +17 -13
  232. package/dist/shims/internal/app-router-context.js.map +1 -1
  233. package/dist/shims/internal/cookies.d.ts +2 -9
  234. package/dist/shims/internal/cookies.js +2 -9
  235. package/dist/shims/internal/parse-cookie-header.d.ts +4 -1
  236. package/dist/shims/internal/parse-cookie-header.js +29 -29
  237. package/dist/shims/internal/parse-cookie-header.js.map +1 -1
  238. package/dist/shims/internal/router-context.d.ts +6 -1
  239. package/dist/shims/internal/router-context.js +11 -7
  240. package/dist/shims/internal/router-context.js.map +1 -1
  241. package/dist/shims/internal/utils.d.ts +40 -36
  242. package/dist/shims/internal/utils.js +24 -30
  243. package/dist/shims/internal/utils.js.map +1 -1
  244. package/dist/shims/internal/work-unit-async-storage.d.ts +6 -10
  245. package/dist/shims/internal/work-unit-async-storage.js +14 -11
  246. package/dist/shims/internal/work-unit-async-storage.js.map +1 -1
  247. package/dist/shims/layout-segment-context.d.ts +11 -14
  248. package/dist/shims/layout-segment-context.js +24 -23
  249. package/dist/shims/layout-segment-context.js.map +1 -1
  250. package/dist/shims/legacy-image.d.ts +39 -46
  251. package/dist/shims/legacy-image.js +47 -42
  252. package/dist/shims/legacy-image.js.map +1 -1
  253. package/dist/shims/link.d.ts +32 -36
  254. package/dist/shims/link.js +262 -382
  255. package/dist/shims/link.js.map +1 -1
  256. package/dist/shims/metadata.d.ts +210 -202
  257. package/dist/shims/metadata.js +545 -544
  258. package/dist/shims/metadata.js.map +1 -1
  259. package/dist/shims/navigation-state.d.ts +19 -13
  260. package/dist/shims/navigation-state.js +68 -58
  261. package/dist/shims/navigation-state.js.map +1 -1
  262. package/dist/shims/navigation.d.ts +59 -63
  263. package/dist/shims/navigation.js +508 -690
  264. package/dist/shims/navigation.js.map +1 -1
  265. package/dist/shims/og.d.ts +2 -20
  266. package/dist/shims/og.js +2 -19
  267. package/dist/shims/readonly-url-search-params.d.ts +8 -5
  268. package/dist/shims/readonly-url-search-params.js +26 -22
  269. package/dist/shims/readonly-url-search-params.js.map +1 -1
  270. package/dist/shims/request-context.d.ts +8 -5
  271. package/dist/shims/request-context.js +50 -51
  272. package/dist/shims/request-context.js.map +1 -1
  273. package/dist/shims/request-state-types.d.ts +11 -0
  274. package/dist/shims/request-state-types.js +1 -0
  275. package/dist/shims/router-state.d.ts +15 -1
  276. package/dist/shims/router-state.js +34 -41
  277. package/dist/shims/router-state.js.map +1 -1
  278. package/dist/shims/router.d.ts +81 -81
  279. package/dist/shims/router.js +517 -543
  280. package/dist/shims/router.js.map +1 -1
  281. package/dist/shims/script.d.ts +39 -48
  282. package/dist/shims/script.js +107 -160
  283. package/dist/shims/script.js.map +1 -1
  284. package/dist/shims/server-only.d.ts +1 -19
  285. package/dist/shims/server-only.js +0 -18
  286. package/dist/shims/server.d.ts +175 -157
  287. package/dist/shims/server.js +462 -432
  288. package/dist/shims/server.js.map +1 -1
  289. package/dist/shims/unified-request-context.d.ts +66 -0
  290. package/dist/shims/unified-request-context.js +98 -0
  291. package/dist/shims/unified-request-context.js.map +1 -0
  292. package/dist/shims/url-safety.d.ts +4 -1
  293. package/dist/shims/url-safety.js +15 -11
  294. package/dist/shims/url-safety.js.map +1 -1
  295. package/dist/shims/url-utils.d.ts +8 -5
  296. package/dist/shims/url-utils.js +62 -93
  297. package/dist/shims/url-utils.js.map +1 -1
  298. package/dist/shims/web-vitals.d.ts +10 -8
  299. package/dist/shims/web-vitals.js +9 -15
  300. package/dist/shims/web-vitals.js.map +1 -1
  301. package/dist/utils/base-path.d.ts +5 -2
  302. package/dist/utils/base-path.js +21 -19
  303. package/dist/utils/base-path.js.map +1 -1
  304. package/dist/utils/domain-locale.d.ts +26 -0
  305. package/dist/utils/domain-locale.js +44 -0
  306. package/dist/utils/domain-locale.js.map +1 -0
  307. package/dist/utils/hash.d.ts +4 -1
  308. package/dist/utils/hash.js +19 -17
  309. package/dist/utils/hash.js.map +1 -1
  310. package/dist/utils/manifest-paths.d.ts +6 -3
  311. package/dist/utils/manifest-paths.js +15 -16
  312. package/dist/utils/manifest-paths.js.map +1 -1
  313. package/dist/utils/project.d.ts +13 -11
  314. package/dist/utils/project.js +169 -216
  315. package/dist/utils/project.js.map +1 -1
  316. package/dist/utils/query.d.ts +8 -6
  317. package/dist/utils/query.js +57 -67
  318. package/dist/utils/query.js.map +1 -1
  319. package/package.json +11 -10
  320. package/dist/build/report.d.ts.map +0 -1
  321. package/dist/build/static-export.d.ts.map +0 -1
  322. package/dist/check.d.ts.map +0 -1
  323. package/dist/cli.d.ts.map +0 -1
  324. package/dist/client/entry.d.ts.map +0 -1
  325. package/dist/client/validate-module-path.d.ts.map +0 -1
  326. package/dist/client/vinext-next-data.d.ts.map +0 -1
  327. package/dist/client/vinext-next-data.js.map +0 -1
  328. package/dist/cloudflare/index.d.ts.map +0 -1
  329. package/dist/cloudflare/index.js.map +0 -1
  330. package/dist/cloudflare/kv-cache-handler.d.ts.map +0 -1
  331. package/dist/cloudflare/tpr.d.ts.map +0 -1
  332. package/dist/config/config-matchers.d.ts.map +0 -1
  333. package/dist/config/dotenv.d.ts.map +0 -1
  334. package/dist/config/next-config.d.ts.map +0 -1
  335. package/dist/deploy.d.ts.map +0 -1
  336. package/dist/entries/app-browser-entry.d.ts.map +0 -1
  337. package/dist/entries/app-rsc-entry.d.ts.map +0 -1
  338. package/dist/entries/app-ssr-entry.d.ts.map +0 -1
  339. package/dist/entries/pages-client-entry.d.ts.map +0 -1
  340. package/dist/entries/pages-entry-helpers.d.ts.map +0 -1
  341. package/dist/entries/pages-server-entry.d.ts.map +0 -1
  342. package/dist/index.d.ts.map +0 -1
  343. package/dist/init.d.ts.map +0 -1
  344. package/dist/plugins/async-hooks-stub.d.ts.map +0 -1
  345. package/dist/plugins/client-reference-dedup.d.ts.map +0 -1
  346. package/dist/routing/app-router.d.ts.map +0 -1
  347. package/dist/routing/file-matcher.d.ts.map +0 -1
  348. package/dist/routing/pages-router.d.ts.map +0 -1
  349. package/dist/routing/route-trie.d.ts.map +0 -1
  350. package/dist/routing/route-validation.d.ts.map +0 -1
  351. package/dist/routing/utils.d.ts.map +0 -1
  352. package/dist/server/api-handler.d.ts.map +0 -1
  353. package/dist/server/app-router-entry.d.ts.map +0 -1
  354. package/dist/server/dev-module-runner.d.ts.map +0 -1
  355. package/dist/server/dev-origin-check.d.ts.map +0 -1
  356. package/dist/server/dev-server.d.ts.map +0 -1
  357. package/dist/server/html.d.ts.map +0 -1
  358. package/dist/server/image-optimization.d.ts.map +0 -1
  359. package/dist/server/instrumentation.d.ts.map +0 -1
  360. package/dist/server/isr-cache.d.ts.map +0 -1
  361. package/dist/server/metadata-routes.d.ts.map +0 -1
  362. package/dist/server/middleware-codegen.d.ts.map +0 -1
  363. package/dist/server/middleware-request-headers.d.ts.map +0 -1
  364. package/dist/server/middleware.d.ts.map +0 -1
  365. package/dist/server/normalize-path.d.ts.map +0 -1
  366. package/dist/server/prod-server.d.ts.map +0 -1
  367. package/dist/server/request-log.d.ts.map +0 -1
  368. package/dist/server/request-pipeline.d.ts.map +0 -1
  369. package/dist/server/worker-utils.d.ts.map +0 -1
  370. package/dist/shims/amp.d.ts.map +0 -1
  371. package/dist/shims/app.d.ts.map +0 -1
  372. package/dist/shims/app.js.map +0 -1
  373. package/dist/shims/cache-runtime.d.ts.map +0 -1
  374. package/dist/shims/cache.d.ts.map +0 -1
  375. package/dist/shims/client-only.d.ts.map +0 -1
  376. package/dist/shims/client-only.js.map +0 -1
  377. package/dist/shims/compat-router.d.ts.map +0 -1
  378. package/dist/shims/config.d.ts.map +0 -1
  379. package/dist/shims/constants.d.ts.map +0 -1
  380. package/dist/shims/document.d.ts.map +0 -1
  381. package/dist/shims/dynamic.d.ts.map +0 -1
  382. package/dist/shims/error-boundary.d.ts.map +0 -1
  383. package/dist/shims/error.d.ts.map +0 -1
  384. package/dist/shims/fetch-cache.d.ts.map +0 -1
  385. package/dist/shims/font-google-base.d.ts.map +0 -1
  386. package/dist/shims/font-google.d.ts.map +0 -1
  387. package/dist/shims/font-google.generated.d.ts.map +0 -1
  388. package/dist/shims/font-google.js.map +0 -1
  389. package/dist/shims/font-local.d.ts.map +0 -1
  390. package/dist/shims/form.d.ts.map +0 -1
  391. package/dist/shims/head-state.d.ts.map +0 -1
  392. package/dist/shims/head.d.ts.map +0 -1
  393. package/dist/shims/headers.d.ts.map +0 -1
  394. package/dist/shims/image-config.d.ts.map +0 -1
  395. package/dist/shims/image.d.ts.map +0 -1
  396. package/dist/shims/internal/api-utils.d.ts.map +0 -1
  397. package/dist/shims/internal/api-utils.js.map +0 -1
  398. package/dist/shims/internal/app-router-context.d.ts.map +0 -1
  399. package/dist/shims/internal/cookies.d.ts.map +0 -1
  400. package/dist/shims/internal/cookies.js.map +0 -1
  401. package/dist/shims/internal/parse-cookie-header.d.ts.map +0 -1
  402. package/dist/shims/internal/router-context.d.ts.map +0 -1
  403. package/dist/shims/internal/utils.d.ts.map +0 -1
  404. package/dist/shims/internal/work-unit-async-storage.d.ts.map +0 -1
  405. package/dist/shims/layout-segment-context.d.ts.map +0 -1
  406. package/dist/shims/legacy-image.d.ts.map +0 -1
  407. package/dist/shims/link.d.ts.map +0 -1
  408. package/dist/shims/metadata.d.ts.map +0 -1
  409. package/dist/shims/navigation-state.d.ts.map +0 -1
  410. package/dist/shims/navigation.d.ts.map +0 -1
  411. package/dist/shims/og.d.ts.map +0 -1
  412. package/dist/shims/og.js.map +0 -1
  413. package/dist/shims/readonly-url-search-params.d.ts.map +0 -1
  414. package/dist/shims/request-context.d.ts.map +0 -1
  415. package/dist/shims/router-state.d.ts.map +0 -1
  416. package/dist/shims/router.d.ts.map +0 -1
  417. package/dist/shims/script.d.ts.map +0 -1
  418. package/dist/shims/server-only.d.ts.map +0 -1
  419. package/dist/shims/server-only.js.map +0 -1
  420. package/dist/shims/server.d.ts.map +0 -1
  421. package/dist/shims/url-safety.d.ts.map +0 -1
  422. package/dist/shims/url-utils.d.ts.map +0 -1
  423. package/dist/shims/web-vitals.d.ts.map +0 -1
  424. package/dist/utils/base-path.d.ts.map +0 -1
  425. package/dist/utils/hash.d.ts.map +0 -1
  426. package/dist/utils/manifest-paths.d.ts.map +0 -1
  427. package/dist/utils/project.d.ts.map +0 -1
  428. package/dist/utils/query.d.ts.map +0 -1
@@ -1,333 +1,316 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- /**
3
- * next/image shim
4
- *
5
- * Translates Next.js Image props to @unpic/react Image component.
6
- * @unpic/react auto-detects CDN from URL and uses native transforms.
7
- * For local images (relative paths), routes through `/_vinext/image`
8
- * for server-side optimization (resize, format negotiation, quality).
9
- *
10
- * Remote images are validated against `images.remotePatterns` and
11
- * `images.domains` from next.config.js. Unmatched URLs are blocked
12
- * in production and warn in development, matching Next.js behavior.
13
- */
14
- import { forwardRef } from "react";
15
- import { Image as UnpicImage } from "@unpic/react";
16
1
  import { hasRemoteMatch } from "./image-config.js";
2
+ import { forwardRef } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { Image as Image$1 } from "@unpic/react";
5
+ //#region src/shims/image.tsx
6
+ /**
7
+ * next/image shim
8
+ *
9
+ * Translates Next.js Image props to @unpic/react Image component.
10
+ * @unpic/react auto-detects CDN from URL and uses native transforms.
11
+ * For local images (relative paths), routes through `/_vinext/image`
12
+ * for server-side optimization (resize, format negotiation, quality).
13
+ *
14
+ * Remote images are validated against `images.remotePatterns` and
15
+ * `images.domains` from next.config.js. Unmatched URLs are blocked
16
+ * in production and warn in development, matching Next.js behavior.
17
+ */
17
18
  /**
18
- * Image config injected at build time via Vite define.
19
- * Serialized as JSON — parsed once at module level.
20
- */
19
+ * Image config injected at build time via Vite define.
20
+ * Serialized as JSON — parsed once at module level.
21
+ */
21
22
  const __imageRemotePatterns = (() => {
22
- try {
23
- return JSON.parse(process.env.__VINEXT_IMAGE_REMOTE_PATTERNS ?? "[]");
24
- }
25
- catch {
26
- return [];
27
- }
23
+ try {
24
+ return JSON.parse(process.env.__VINEXT_IMAGE_REMOTE_PATTERNS ?? "[]");
25
+ } catch {
26
+ return [];
27
+ }
28
28
  })();
29
29
  const __imageDomains = (() => {
30
- try {
31
- return JSON.parse(process.env.__VINEXT_IMAGE_DOMAINS ?? "[]");
32
- }
33
- catch {
34
- return [];
35
- }
30
+ try {
31
+ return JSON.parse(process.env.__VINEXT_IMAGE_DOMAINS ?? "[]");
32
+ } catch {
33
+ return [];
34
+ }
36
35
  })();
37
36
  const __hasImageConfig = __imageRemotePatterns.length > 0 || __imageDomains.length > 0;
38
37
  const __isDev = process.env.NODE_ENV !== "production";
39
38
  const __imageDeviceSizes = (() => {
40
- try {
41
- return JSON.parse(process.env.__VINEXT_IMAGE_DEVICE_SIZES ?? "[640,750,828,1080,1200,1920,2048,3840]");
42
- }
43
- catch {
44
- return [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
45
- }
39
+ try {
40
+ return JSON.parse(process.env.__VINEXT_IMAGE_DEVICE_SIZES ?? "[640,750,828,1080,1200,1920,2048,3840]");
41
+ } catch {
42
+ return [
43
+ 640,
44
+ 750,
45
+ 828,
46
+ 1080,
47
+ 1200,
48
+ 1920,
49
+ 2048,
50
+ 3840
51
+ ];
52
+ }
46
53
  })();
47
54
  /**
48
- * Whether dangerouslyAllowSVG is enabled in next.config.js.
49
- * When false (default), .svg sources auto-skip the optimization endpoint
50
- * and are served directly, matching Next.js behavior.
51
- * When true, .svg sources are routed through the optimizer (served as-is
52
- * with security headers).
53
- */
55
+ * Whether dangerouslyAllowSVG is enabled in next.config.js.
56
+ * When false (default), .svg sources auto-skip the optimization endpoint
57
+ * and are served directly, matching Next.js behavior.
58
+ * When true, .svg sources are routed through the optimizer (served as-is
59
+ * with security headers).
60
+ */
54
61
  const __dangerouslyAllowSVG = process.env.__VINEXT_IMAGE_DANGEROUSLY_ALLOW_SVG === "true";
55
62
  /**
56
- * Validate that a remote URL is allowed by the configured remote patterns.
57
- * Returns true if the URL is allowed, false otherwise.
58
- *
59
- * When no remotePatterns/domains are configured, all remote URLs are allowed
60
- * (backwards-compatible — user hasn't opted into restriction).
61
- *
62
- * When patterns ARE configured, only matching URLs are allowed.
63
- * In development, non-matching URLs produce a console warning.
64
- * In production, non-matching URLs are blocked (src replaced with empty string).
65
- */
63
+ * Validate that a remote URL is allowed by the configured remote patterns.
64
+ * Returns true if the URL is allowed, false otherwise.
65
+ *
66
+ * When no remotePatterns/domains are configured, all remote URLs are allowed
67
+ * (backwards-compatible — user hasn't opted into restriction).
68
+ *
69
+ * When patterns ARE configured, only matching URLs are allowed.
70
+ * In development, non-matching URLs produce a console warning.
71
+ * In production, non-matching URLs are blocked (src replaced with empty string).
72
+ */
66
73
  function validateRemoteUrl(src) {
67
- if (!__hasImageConfig) {
68
- // No image config — allow everything (backwards-compatible)
69
- return { allowed: true };
70
- }
71
- let url;
72
- try {
73
- url = new URL(src, "http://n");
74
- }
75
- catch {
76
- return { allowed: false, reason: `Invalid URL: ${src}` };
77
- }
78
- if (hasRemoteMatch(__imageDomains, __imageRemotePatterns, url)) {
79
- return { allowed: true };
80
- }
81
- return {
82
- allowed: false,
83
- reason: `Image URL "${src}" is not configured in images.remotePatterns or images.domains in next.config.js. See: https://nextjs.org/docs/messages/next-image-unconfigured-host`,
84
- };
74
+ if (!__hasImageConfig) return { allowed: true };
75
+ let url;
76
+ try {
77
+ url = new URL(src, "http://n");
78
+ } catch {
79
+ return {
80
+ allowed: false,
81
+ reason: `Invalid URL: ${src}`
82
+ };
83
+ }
84
+ if (hasRemoteMatch(__imageDomains, __imageRemotePatterns, url)) return { allowed: true };
85
+ return {
86
+ allowed: false,
87
+ reason: `Image URL "${src}" is not configured in images.remotePatterns or images.domains in next.config.js. See: https://nextjs.org/docs/messages/next-image-unconfigured-host`
88
+ };
85
89
  }
86
90
  /**
87
- * Sanitize a blurDataURL to prevent CSS injection.
88
- *
89
- * A crafted data URL containing `)` can break out of the `url()` CSS function,
90
- * allowing injection of arbitrary CSS properties or rules. Characters like `{`,
91
- * `}`, and `\` can also assist in crafting injection payloads.
92
- *
93
- * This validates the URL starts with `data:image/` and rejects characters that
94
- * could escape the `url()` context. Semicolons are allowed since they're part
95
- * of valid data URLs (`data:image/png;base64,...`) and harmless inside `url()`.
96
- *
97
- * Returns undefined for invalid URLs, which causes the blur placeholder to be
98
- * skipped gracefully.
99
- */
91
+ * Sanitize a blurDataURL to prevent CSS injection.
92
+ *
93
+ * A crafted data URL containing `)` can break out of the `url()` CSS function,
94
+ * allowing injection of arbitrary CSS properties or rules. Characters like `{`,
95
+ * `}`, and `\` can also assist in crafting injection payloads.
96
+ *
97
+ * This validates the URL starts with `data:image/` and rejects characters that
98
+ * could escape the `url()` context. Semicolons are allowed since they're part
99
+ * of valid data URLs (`data:image/png;base64,...`) and harmless inside `url()`.
100
+ *
101
+ * Returns undefined for invalid URLs, which causes the blur placeholder to be
102
+ * skipped gracefully.
103
+ */
100
104
  function sanitizeBlurDataURL(url) {
101
- // Must be a data: image URL
102
- if (!url.startsWith("data:image/"))
103
- return undefined;
104
- // Reject characters that can break out of CSS url():
105
- // ) - closes url()
106
- // ( - could open nested functions
107
- // { } - CSS rule boundaries
108
- // \ - CSS escape sequences
109
- // newlines - break CSS parsing
110
- if (/[)(}{\\'"\n\r]/.test(url))
111
- return undefined;
112
- return url;
105
+ if (!url.startsWith("data:image/")) return void 0;
106
+ if (/[)(}{\\'"\n\r]/.test(url)) return void 0;
107
+ return url;
113
108
  }
114
109
  /**
115
- * Determine if a src is a remote URL (CDN-optimizable) or local.
116
- */
110
+ * Determine if a src is a remote URL (CDN-optimizable) or local.
111
+ */
117
112
  function isRemoteUrl(src) {
118
- return src.startsWith("http://") || src.startsWith("https://") || src.startsWith("//");
113
+ return src.startsWith("http://") || src.startsWith("https://") || src.startsWith("//");
119
114
  }
120
115
  /**
121
- * Responsive image widths matching Next.js's device sizes config.
122
- * These are the breakpoints used for srcSet generation.
123
- * Configurable via `images.deviceSizes` in next.config.js.
124
- */
116
+ * Responsive image widths matching Next.js's device sizes config.
117
+ * These are the breakpoints used for srcSet generation.
118
+ * Configurable via `images.deviceSizes` in next.config.js.
119
+ */
125
120
  const RESPONSIVE_WIDTHS = __imageDeviceSizes;
126
121
  /**
127
- * Build a `/_vinext/image` optimization URL.
128
- *
129
- * In production (Cloudflare Workers), the worker intercepts this path and uses
130
- * the Images binding to resize/transcode on the fly. In dev, the Vite dev
131
- * server handles it as a passthrough (serves the original file).
132
- */
133
- export function imageOptimizationUrl(src, width, quality = 75) {
134
- return `/_vinext/image?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`;
122
+ * Build a `/_vinext/image` optimization URL.
123
+ *
124
+ * In production (Cloudflare Workers), the worker intercepts this path and uses
125
+ * the Images binding to resize/transcode on the fly. In dev, the Vite dev
126
+ * server handles it as a passthrough (serves the original file).
127
+ */
128
+ function imageOptimizationUrl(src, width, quality = 75) {
129
+ return `/_vinext/image?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`;
135
130
  }
136
131
  /**
137
- * Generate a srcSet string for responsive images.
138
- *
139
- * Each width points to the `/_vinext/image` optimization endpoint so the
140
- * server can resize and transcode the image. Only includes widths that are
141
- * <= 2x the original image width to avoid pointless upscaling.
142
- */
132
+ * Generate a srcSet string for responsive images.
133
+ *
134
+ * Each width points to the `/_vinext/image` optimization endpoint so the
135
+ * server can resize and transcode the image. Only includes widths that are
136
+ * <= 2x the original image width to avoid pointless upscaling.
137
+ */
143
138
  function generateSrcSet(src, originalWidth, quality = 75) {
144
- const widths = RESPONSIVE_WIDTHS.filter((w) => w <= originalWidth * 2);
145
- if (widths.length === 0)
146
- return `${imageOptimizationUrl(src, originalWidth, quality)} ${originalWidth}w`;
147
- return widths.map((w) => `${imageOptimizationUrl(src, w, quality)} ${w}w`).join(", ");
139
+ const widths = RESPONSIVE_WIDTHS.filter((w) => w <= originalWidth * 2);
140
+ if (widths.length === 0) return `${imageOptimizationUrl(src, originalWidth, quality)} ${originalWidth}w`;
141
+ return widths.map((w) => `${imageOptimizationUrl(src, w, quality)} ${w}w`).join(", ");
148
142
  }
149
- const Image = forwardRef(function Image({ src: srcProp, alt, width, height, fill, priority, quality, placeholder, blurDataURL, loader, sizes, className, style, unoptimized: _unoptimized, overrideSrc: _overrideSrc, loading, ...rest }, ref) {
150
- // Handle StaticImageData (import result)
151
- const src = typeof srcProp === "string" ? srcProp : srcProp.src;
152
- const imgWidth = width ?? (typeof srcProp === "object" ? srcProp.width : undefined);
153
- const imgHeight = height ?? (typeof srcProp === "object" ? srcProp.height : undefined);
154
- const imgBlurDataURL = blurDataURL ?? (typeof srcProp === "object" ? srcProp.blurDataURL : undefined);
155
- // If a custom loader is provided, use basic img with loader URL
156
- if (loader) {
157
- const resolvedSrc = loader({ src, width: imgWidth ?? 0, quality: quality ?? 75 });
158
- return (_jsx("img", { ref: ref, src: resolvedSrc, alt: alt, width: fill ? undefined : imgWidth, height: fill ? undefined : imgHeight, loading: priority ? "eager" : (loading ?? "lazy"), decoding: "async", sizes: sizes, className: className, style: fill
159
- ? {
160
- position: "absolute",
161
- inset: 0,
162
- width: "100%",
163
- height: "100%",
164
- objectFit: "cover",
165
- ...style,
166
- }
167
- : style, ...rest }));
168
- }
169
- // For remote URLs, validate against remotePatterns then use @unpic/react
170
- if (isRemoteUrl(src)) {
171
- const validation = validateRemoteUrl(src);
172
- if (!validation.allowed) {
173
- if (__isDev) {
174
- console.warn(`[next/image] ${validation.reason}`);
175
- // In dev, render the image but with a warning — matches Next.js dev behavior
176
- }
177
- else {
178
- // In production, block the image entirely
179
- console.error(`[next/image] ${validation.reason}`);
180
- return null;
181
- }
182
- }
183
- const sanitizedBlur = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;
184
- const bg = placeholder === "blur" && sanitizedBlur ? `url(${sanitizedBlur})` : undefined;
185
- if (fill) {
186
- return (_jsx(UnpicImage, { src: src, alt: alt, layout: "fullWidth", priority: priority, sizes: sizes, className: className, background: bg }));
187
- }
188
- // constrained layout requires width+height or aspectRatio
189
- if (imgWidth && imgHeight) {
190
- return (_jsx(UnpicImage, { src: src, alt: alt, width: imgWidth, height: imgHeight, layout: "constrained", priority: priority, sizes: sizes, className: className, background: bg }));
191
- }
192
- // Fall through to basic <img> if dimensions not provided
193
- // (unpic requires them for constrained layout)
194
- }
195
- // Route local images through the /_vinext/image optimization endpoint.
196
- // In production on Cloudflare Workers, this resizes and transcodes via
197
- // the Images binding. In dev, it serves the original file as a passthrough.
198
- // When `unoptimized` is true, bypass the endpoint entirely (Next.js compat).
199
- // SVG sources auto-skip unless dangerouslyAllowSVG is enabled, matching
200
- // Next.js behavior where .svg triggers unoptimized=true by default.
201
- const imgQuality = quality ?? 75;
202
- const isSvg = src.endsWith(".svg");
203
- const skipOptimization = _unoptimized === true || (isSvg && !__dangerouslyAllowSVG);
204
- // Build srcSet for responsive local images (common breakpoints).
205
- // Each entry points to /_vinext/image with the appropriate width.
206
- const srcSet = imgWidth && !fill && !skipOptimization
207
- ? generateSrcSet(src, imgWidth, imgQuality)
208
- : imgWidth && !fill
209
- ? RESPONSIVE_WIDTHS.filter((w) => w <= imgWidth * 2)
210
- .map((w) => `${src} ${w}w`)
211
- .join(", ") || `${src} ${imgWidth}w`
212
- : undefined;
213
- // The main `src` also goes through the optimization endpoint. Use the
214
- // declared width (or the first responsive width as fallback).
215
- const optimizedSrc = skipOptimization
216
- ? src
217
- : imgWidth
218
- ? imageOptimizationUrl(src, imgWidth, imgQuality)
219
- : imageOptimizationUrl(src, RESPONSIVE_WIDTHS[0], imgQuality);
220
- // Blur placeholder: show a low-quality background while the image loads.
221
- // Sanitize blurDataURL to prevent CSS injection via crafted data URLs.
222
- const sanitizedLocalBlur = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;
223
- const blurStyle = placeholder === "blur" && sanitizedLocalBlur
224
- ? {
225
- backgroundImage: `url(${sanitizedLocalBlur})`,
226
- backgroundSize: "cover",
227
- backgroundRepeat: "no-repeat",
228
- backgroundPosition: "center",
229
- }
230
- : undefined;
231
- // For local images, render a standard <img> tag with srcSet and blur support.
232
- // The src and srcSet point to the /_vinext/image optimization endpoint.
233
- return (_jsx("img", { ref: ref, src: optimizedSrc, alt: alt, width: fill ? undefined : imgWidth, height: fill ? undefined : imgHeight, loading: priority ? "eager" : (loading ?? "lazy"), fetchPriority: priority ? "high" : undefined, decoding: "async", srcSet: srcSet, sizes: sizes ?? (fill ? "100vw" : undefined), className: className, "data-nimg": fill ? "fill" : "1", style: fill
234
- ? {
235
- position: "absolute",
236
- inset: 0,
237
- width: "100%",
238
- height: "100%",
239
- objectFit: "cover",
240
- ...blurStyle,
241
- ...style,
242
- }
243
- : { ...blurStyle, ...style }, ...rest }));
143
+ const Image = forwardRef(function Image({ src: srcProp, alt, width, height, fill, priority, quality, placeholder, blurDataURL, loader, sizes, className, style, onLoad, onLoadingComplete, unoptimized: _unoptimized, overrideSrc: _overrideSrc, loading, ...rest }, ref) {
144
+ const handleLoad = onLoadingComplete ? (e) => {
145
+ onLoad?.(e);
146
+ onLoadingComplete(e.currentTarget);
147
+ } : onLoad;
148
+ const src = typeof srcProp === "string" ? srcProp : srcProp.src;
149
+ const imgWidth = width ?? (typeof srcProp === "object" ? srcProp.width : void 0);
150
+ const imgHeight = height ?? (typeof srcProp === "object" ? srcProp.height : void 0);
151
+ const imgBlurDataURL = blurDataURL ?? (typeof srcProp === "object" ? srcProp.blurDataURL : void 0);
152
+ if (loader) return /* @__PURE__ */ jsx("img", {
153
+ ref,
154
+ src: loader({
155
+ src,
156
+ width: imgWidth ?? 0,
157
+ quality: quality ?? 75
158
+ }),
159
+ alt,
160
+ width: fill ? void 0 : imgWidth,
161
+ height: fill ? void 0 : imgHeight,
162
+ loading: priority ? "eager" : loading ?? "lazy",
163
+ decoding: "async",
164
+ sizes,
165
+ className,
166
+ onLoad: handleLoad,
167
+ style: fill ? {
168
+ position: "absolute",
169
+ inset: 0,
170
+ width: "100%",
171
+ height: "100%",
172
+ objectFit: "cover",
173
+ ...style
174
+ } : style,
175
+ ...rest
176
+ });
177
+ if (isRemoteUrl(src)) {
178
+ const validation = validateRemoteUrl(src);
179
+ if (!validation.allowed) if (__isDev) console.warn(`[next/image] ${validation.reason}`);
180
+ else {
181
+ console.error(`[next/image] ${validation.reason}`);
182
+ return null;
183
+ }
184
+ const sanitizedBlur = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : void 0;
185
+ const bg = placeholder === "blur" && sanitizedBlur ? `url(${sanitizedBlur})` : void 0;
186
+ if (fill) return /* @__PURE__ */ jsx(Image$1, {
187
+ src,
188
+ alt,
189
+ layout: "fullWidth",
190
+ priority,
191
+ sizes,
192
+ className,
193
+ background: bg,
194
+ onLoad: handleLoad
195
+ });
196
+ if (imgWidth && imgHeight) return /* @__PURE__ */ jsx(Image$1, {
197
+ src,
198
+ alt,
199
+ width: imgWidth,
200
+ height: imgHeight,
201
+ layout: "constrained",
202
+ priority,
203
+ sizes,
204
+ className,
205
+ background: bg,
206
+ onLoad: handleLoad
207
+ });
208
+ }
209
+ const imgQuality = quality ?? 75;
210
+ const isSvg = src.endsWith(".svg");
211
+ const skipOptimization = _unoptimized === true || isSvg && !__dangerouslyAllowSVG;
212
+ const srcSet = imgWidth && !fill && !skipOptimization ? generateSrcSet(src, imgWidth, imgQuality) : imgWidth && !fill ? RESPONSIVE_WIDTHS.filter((w) => w <= imgWidth * 2).map((w) => `${src} ${w}w`).join(", ") || `${src} ${imgWidth}w` : void 0;
213
+ const optimizedSrc = skipOptimization ? src : imgWidth ? imageOptimizationUrl(src, imgWidth, imgQuality) : imageOptimizationUrl(src, RESPONSIVE_WIDTHS[0], imgQuality);
214
+ const sanitizedLocalBlur = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : void 0;
215
+ const blurStyle = placeholder === "blur" && sanitizedLocalBlur ? {
216
+ backgroundImage: `url(${sanitizedLocalBlur})`,
217
+ backgroundSize: "cover",
218
+ backgroundRepeat: "no-repeat",
219
+ backgroundPosition: "center"
220
+ } : void 0;
221
+ return /* @__PURE__ */ jsx("img", {
222
+ ref,
223
+ src: optimizedSrc,
224
+ alt,
225
+ width: fill ? void 0 : imgWidth,
226
+ height: fill ? void 0 : imgHeight,
227
+ loading: priority ? "eager" : loading ?? "lazy",
228
+ fetchPriority: priority ? "high" : void 0,
229
+ decoding: "async",
230
+ srcSet,
231
+ sizes: sizes ?? (fill ? "100vw" : void 0),
232
+ className,
233
+ "data-nimg": fill ? "fill" : "1",
234
+ onLoad: handleLoad,
235
+ style: fill ? {
236
+ position: "absolute",
237
+ inset: 0,
238
+ width: "100%",
239
+ height: "100%",
240
+ objectFit: "cover",
241
+ ...blurStyle,
242
+ ...style
243
+ } : {
244
+ ...blurStyle,
245
+ ...style
246
+ },
247
+ ...rest
248
+ });
244
249
  });
245
250
  /**
246
- * getImageProps — for advanced use cases (picture elements, background images).
247
- * Returns the props that would be passed to the underlying <img> element.
248
- */
249
- export function getImageProps(props) {
250
- const { src: srcProp, alt, width, height, fill, priority, quality: _quality, placeholder, blurDataURL: blurDataURLProp, loader, sizes, className, style, unoptimized: _unoptimized, overrideSrc: _overrideSrc, loading, ...rest } = props;
251
- const src = typeof srcProp === "string" ? srcProp : srcProp.src;
252
- const imgWidth = width ?? (typeof srcProp === "object" ? srcProp.width : undefined);
253
- const imgHeight = height ?? (typeof srcProp === "object" ? srcProp.height : undefined);
254
- const imgBlurDataURL = blurDataURLProp ?? (typeof srcProp === "object" ? srcProp.blurDataURL : undefined);
255
- // Validate remote URLs against configured patterns
256
- let blockedInProd = false;
257
- if (isRemoteUrl(src)) {
258
- const validation = validateRemoteUrl(src);
259
- if (!validation.allowed) {
260
- if (__isDev) {
261
- console.warn(`[next/image] ${validation.reason}`);
262
- }
263
- else {
264
- console.error(`[next/image] ${validation.reason}`);
265
- blockedInProd = true;
266
- }
267
- }
268
- }
269
- // Resolve src through custom loader if provided
270
- const imgQuality = _quality ?? 75;
271
- const resolvedSrc = blockedInProd
272
- ? ""
273
- : loader
274
- ? loader({ src, width: imgWidth ?? 0, quality: imgQuality })
275
- : src;
276
- // For local images (no loader, not remote), route through optimization endpoint.
277
- // When `unoptimized` is true, bypass the endpoint entirely (Next.js compat).
278
- // SVG sources auto-skip unless dangerouslyAllowSVG is enabled.
279
- const isSvg = resolvedSrc.endsWith(".svg");
280
- const skipOpt = _unoptimized === true ||
281
- (isSvg && !__dangerouslyAllowSVG) ||
282
- blockedInProd ||
283
- !!loader ||
284
- isRemoteUrl(resolvedSrc);
285
- const optimizedSrc = skipOpt
286
- ? resolvedSrc
287
- : imgWidth
288
- ? imageOptimizationUrl(resolvedSrc, imgWidth, imgQuality)
289
- : imageOptimizationUrl(resolvedSrc, RESPONSIVE_WIDTHS[0], imgQuality);
290
- // Build srcSet for local images each width points to /_vinext/image
291
- const srcSet = imgWidth && !fill && !isRemoteUrl(resolvedSrc) && !loader && !skipOpt
292
- ? generateSrcSet(resolvedSrc, imgWidth, imgQuality)
293
- : undefined;
294
- // Blur placeholder styles — sanitize to prevent CSS injection
295
- const sanitizedBlurURL = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : undefined;
296
- const blurStyle = placeholder === "blur" && sanitizedBlurURL
297
- ? {
298
- backgroundImage: `url(${sanitizedBlurURL})`,
299
- backgroundSize: "cover",
300
- backgroundRepeat: "no-repeat",
301
- backgroundPosition: "center",
302
- }
303
- : undefined;
304
- return {
305
- props: {
306
- src: optimizedSrc,
307
- alt,
308
- width: fill ? undefined : imgWidth,
309
- height: fill ? undefined : imgHeight,
310
- loading: priority ? "eager" : (loading ?? "lazy"),
311
- fetchPriority: priority ? "high" : undefined,
312
- decoding: "async",
313
- srcSet,
314
- sizes: sizes ?? (fill ? "100vw" : undefined),
315
- className,
316
- "data-nimg": fill ? "fill" : "1",
317
- style: fill
318
- ? {
319
- position: "absolute",
320
- inset: 0,
321
- width: "100%",
322
- height: "100%",
323
- objectFit: "cover",
324
- ...blurStyle,
325
- ...style,
326
- }
327
- : { ...blurStyle, ...style },
328
- ...rest,
329
- },
330
- };
251
+ * getImageProps — for advanced use cases (picture elements, background images).
252
+ * Returns the props that would be passed to the underlying <img> element.
253
+ */
254
+ function getImageProps(props) {
255
+ const { src: srcProp, alt, width, height, fill, priority, quality: _quality, placeholder, blurDataURL: blurDataURLProp, loader, sizes, className, style, onLoad: _onLoad, onLoadingComplete: _onLoadingComplete, unoptimized: _unoptimized, overrideSrc: _overrideSrc, loading, ...rest } = props;
256
+ const src = typeof srcProp === "string" ? srcProp : srcProp.src;
257
+ const imgWidth = width ?? (typeof srcProp === "object" ? srcProp.width : void 0);
258
+ const imgHeight = height ?? (typeof srcProp === "object" ? srcProp.height : void 0);
259
+ const imgBlurDataURL = blurDataURLProp ?? (typeof srcProp === "object" ? srcProp.blurDataURL : void 0);
260
+ let blockedInProd = false;
261
+ if (isRemoteUrl(src)) {
262
+ const validation = validateRemoteUrl(src);
263
+ if (!validation.allowed) if (__isDev) console.warn(`[next/image] ${validation.reason}`);
264
+ else {
265
+ console.error(`[next/image] ${validation.reason}`);
266
+ blockedInProd = true;
267
+ }
268
+ }
269
+ const imgQuality = _quality ?? 75;
270
+ const resolvedSrc = blockedInProd ? "" : loader ? loader({
271
+ src,
272
+ width: imgWidth ?? 0,
273
+ quality: imgQuality
274
+ }) : src;
275
+ const isSvg = resolvedSrc.endsWith(".svg");
276
+ const skipOpt = _unoptimized === true || isSvg && !__dangerouslyAllowSVG || blockedInProd || !!loader || isRemoteUrl(resolvedSrc);
277
+ const optimizedSrc = skipOpt ? resolvedSrc : imgWidth ? imageOptimizationUrl(resolvedSrc, imgWidth, imgQuality) : imageOptimizationUrl(resolvedSrc, RESPONSIVE_WIDTHS[0], imgQuality);
278
+ const srcSet = imgWidth && !fill && !isRemoteUrl(resolvedSrc) && !loader && !skipOpt ? generateSrcSet(resolvedSrc, imgWidth, imgQuality) : void 0;
279
+ const sanitizedBlurURL = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : void 0;
280
+ const blurStyle = placeholder === "blur" && sanitizedBlurURL ? {
281
+ backgroundImage: `url(${sanitizedBlurURL})`,
282
+ backgroundSize: "cover",
283
+ backgroundRepeat: "no-repeat",
284
+ backgroundPosition: "center"
285
+ } : void 0;
286
+ return { props: {
287
+ src: optimizedSrc,
288
+ alt,
289
+ width: fill ? void 0 : imgWidth,
290
+ height: fill ? void 0 : imgHeight,
291
+ loading: priority ? "eager" : loading ?? "lazy",
292
+ fetchPriority: priority ? "high" : void 0,
293
+ decoding: "async",
294
+ srcSet,
295
+ sizes: sizes ?? (fill ? "100vw" : void 0),
296
+ className,
297
+ "data-nimg": fill ? "fill" : "1",
298
+ style: fill ? {
299
+ position: "absolute",
300
+ inset: 0,
301
+ width: "100%",
302
+ height: "100%",
303
+ objectFit: "cover",
304
+ ...blurStyle,
305
+ ...style
306
+ } : {
307
+ ...blurStyle,
308
+ ...style
309
+ },
310
+ ...rest
311
+ } };
331
312
  }
332
- export default Image;
313
+ //#endregion
314
+ export { Image as default, getImageProps, imageOptimizationUrl };
315
+
333
316
  //# sourceMappingURL=image.js.map