vinext 0.0.30 → 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 (435) 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 -571
  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 -380
  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 +442 -211
  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 +84 -113
  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 -3133
  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 +560 -670
  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 -14
  112. package/dist/server/dev-server.js +542 -869
  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 +181 -210
  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 +106 -128
  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 +270 -317
  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 +61 -61
  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 +273 -404
  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 +38 -30
  142. package/dist/server/pages-i18n.js +112 -139
  143. package/dist/server/pages-i18n.js.map +1 -1
  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 +20 -45
  162. package/dist/shims/cache-runtime.js +271 -422
  163. package/dist/shims/cache-runtime.js.map +1 -1
  164. package/dist/shims/cache.d.ts +130 -121
  165. package/dist/shims/cache.js +339 -427
  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 -164
  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 +16 -14
  191. package/dist/shims/fetch-cache.js +437 -645
  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 +8 -13
  208. package/dist/shims/head-state.js +25 -42
  209. package/dist/shims/head-state.js.map +1 -1
  210. package/dist/shims/head.d.ts +16 -20
  211. package/dist/shims/head.js +172 -250
  212. package/dist/shims/head.js.map +1 -1
  213. package/dist/shims/headers.d.ts +84 -78
  214. package/dist/shims/headers.js +447 -575
  215. package/dist/shims/headers.js.map +1 -1
  216. package/dist/shims/i18n-context.d.ts +16 -20
  217. package/dist/shims/i18n-context.js +35 -48
  218. package/dist/shims/i18n-context.js.map +1 -1
  219. package/dist/shims/i18n-state.d.ts +8 -14
  220. package/dist/shims/i18n-state.js +34 -42
  221. package/dist/shims/i18n-state.js.map +1 -1
  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 -46
  226. package/dist/shims/image.js +283 -308
  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 -37
  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 +255 -391
  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 -546
  258. package/dist/shims/metadata.js.map +1 -1
  259. package/dist/shims/navigation-state.d.ts +10 -18
  260. package/dist/shims/navigation-state.js +66 -74
  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 +505 -704
  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 -60
  272. package/dist/shims/request-context.js.map +1 -1
  273. package/dist/shims/request-state-types.d.ts +11 -11
  274. package/dist/shims/request-state-types.js +0 -1
  275. package/dist/shims/router-state.d.ts +13 -10
  276. package/dist/shims/router-state.js +34 -43
  277. package/dist/shims/router-state.js.map +1 -1
  278. package/dist/shims/router.d.ts +81 -85
  279. package/dist/shims/router.js +506 -628
  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 -164
  287. package/dist/shims/server.js +462 -478
  288. package/dist/shims/server.js.map +1 -1
  289. package/dist/shims/unified-request-context.d.ts +20 -20
  290. package/dist/shims/unified-request-context.js +81 -99
  291. package/dist/shims/unified-request-context.js.map +1 -1
  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 +17 -9
  305. package/dist/utils/domain-locale.js +36 -56
  306. package/dist/utils/domain-locale.js.map +1 -1
  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 +10 -9
  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/pages-i18n.d.ts.map +0 -1
  367. package/dist/server/prod-server.d.ts.map +0 -1
  368. package/dist/server/request-log.d.ts.map +0 -1
  369. package/dist/server/request-pipeline.d.ts.map +0 -1
  370. package/dist/server/worker-utils.d.ts.map +0 -1
  371. package/dist/shims/amp.d.ts.map +0 -1
  372. package/dist/shims/app.d.ts.map +0 -1
  373. package/dist/shims/app.js.map +0 -1
  374. package/dist/shims/cache-runtime.d.ts.map +0 -1
  375. package/dist/shims/cache.d.ts.map +0 -1
  376. package/dist/shims/client-only.d.ts.map +0 -1
  377. package/dist/shims/client-only.js.map +0 -1
  378. package/dist/shims/compat-router.d.ts.map +0 -1
  379. package/dist/shims/config.d.ts.map +0 -1
  380. package/dist/shims/constants.d.ts.map +0 -1
  381. package/dist/shims/document.d.ts.map +0 -1
  382. package/dist/shims/dynamic.d.ts.map +0 -1
  383. package/dist/shims/error-boundary.d.ts.map +0 -1
  384. package/dist/shims/error.d.ts.map +0 -1
  385. package/dist/shims/fetch-cache.d.ts.map +0 -1
  386. package/dist/shims/font-google-base.d.ts.map +0 -1
  387. package/dist/shims/font-google.d.ts.map +0 -1
  388. package/dist/shims/font-google.generated.d.ts.map +0 -1
  389. package/dist/shims/font-google.js.map +0 -1
  390. package/dist/shims/font-local.d.ts.map +0 -1
  391. package/dist/shims/form.d.ts.map +0 -1
  392. package/dist/shims/head-state.d.ts.map +0 -1
  393. package/dist/shims/head.d.ts.map +0 -1
  394. package/dist/shims/headers.d.ts.map +0 -1
  395. package/dist/shims/i18n-context.d.ts.map +0 -1
  396. package/dist/shims/i18n-state.d.ts.map +0 -1
  397. package/dist/shims/image-config.d.ts.map +0 -1
  398. package/dist/shims/image.d.ts.map +0 -1
  399. package/dist/shims/internal/api-utils.d.ts.map +0 -1
  400. package/dist/shims/internal/api-utils.js.map +0 -1
  401. package/dist/shims/internal/app-router-context.d.ts.map +0 -1
  402. package/dist/shims/internal/cookies.d.ts.map +0 -1
  403. package/dist/shims/internal/cookies.js.map +0 -1
  404. package/dist/shims/internal/parse-cookie-header.d.ts.map +0 -1
  405. package/dist/shims/internal/router-context.d.ts.map +0 -1
  406. package/dist/shims/internal/utils.d.ts.map +0 -1
  407. package/dist/shims/internal/work-unit-async-storage.d.ts.map +0 -1
  408. package/dist/shims/layout-segment-context.d.ts.map +0 -1
  409. package/dist/shims/legacy-image.d.ts.map +0 -1
  410. package/dist/shims/link.d.ts.map +0 -1
  411. package/dist/shims/metadata.d.ts.map +0 -1
  412. package/dist/shims/navigation-state.d.ts.map +0 -1
  413. package/dist/shims/navigation.d.ts.map +0 -1
  414. package/dist/shims/og.d.ts.map +0 -1
  415. package/dist/shims/og.js.map +0 -1
  416. package/dist/shims/readonly-url-search-params.d.ts.map +0 -1
  417. package/dist/shims/request-context.d.ts.map +0 -1
  418. package/dist/shims/request-state-types.d.ts.map +0 -1
  419. package/dist/shims/request-state-types.js.map +0 -1
  420. package/dist/shims/router-state.d.ts.map +0 -1
  421. package/dist/shims/router.d.ts.map +0 -1
  422. package/dist/shims/script.d.ts.map +0 -1
  423. package/dist/shims/server-only.d.ts.map +0 -1
  424. package/dist/shims/server-only.js.map +0 -1
  425. package/dist/shims/server.d.ts.map +0 -1
  426. package/dist/shims/unified-request-context.d.ts.map +0 -1
  427. package/dist/shims/url-safety.d.ts.map +0 -1
  428. package/dist/shims/url-utils.d.ts.map +0 -1
  429. package/dist/shims/web-vitals.d.ts.map +0 -1
  430. package/dist/utils/base-path.d.ts.map +0 -1
  431. package/dist/utils/domain-locale.d.ts.map +0 -1
  432. package/dist/utils/hash.d.ts.map +0 -1
  433. package/dist/utils/manifest-paths.d.ts.map +0 -1
  434. package/dist/utils/project.d.ts.map +0 -1
  435. package/dist/utils/query.d.ts.map +0 -1
@@ -1,377 +1,290 @@
1
+ //#region src/shims/font-google-base.ts
1
2
  /**
2
- * next/font/google shim
3
- *
4
- * Provides a compatible shim for Next.js Google Fonts.
5
- *
6
- * Two modes:
7
- * 1. **Dev / CDN mode** (default): Loads fonts from Google Fonts CDN via <link> tags.
8
- * 2. **Self-hosted mode** (production build): The vinext:google-fonts Vite plugin
9
- * fetches font CSS + .woff2 files at build time, caches them locally, and injects
10
- * @font-face CSS pointing at local assets. No requests to Google at runtime.
11
- *
12
- * Usage:
13
- * import { Inter } from 'next/font/google';
14
- * const inter = Inter({ subsets: ['latin'], weight: ['400', '700'] });
15
- * // inter.className -> unique CSS class
16
- * // inter.style -> { fontFamily: "'Inter', sans-serif" }
17
- * // inter.variable -> CSS variable name like '--font-inter'
18
- */
3
+ * next/font/google shim
4
+ *
5
+ * Provides a compatible shim for Next.js Google Fonts.
6
+ *
7
+ * Two modes:
8
+ * 1. **Dev / CDN mode** (default): Loads fonts from Google Fonts CDN via <link> tags.
9
+ * 2. **Self-hosted mode** (production build): The vinext:google-fonts Vite plugin
10
+ * fetches font CSS + .woff2 files at build time, caches them locally, and injects
11
+ * @font-face CSS pointing at local assets. No requests to Google at runtime.
12
+ *
13
+ * Usage:
14
+ * import { Inter } from 'next/font/google';
15
+ * const inter = Inter({ subsets: ['latin'], weight: ['400', '700'] });
16
+ * // inter.className -> unique CSS class
17
+ * // inter.style -> { fontFamily: "'Inter', sans-serif" }
18
+ * // inter.variable -> CSS variable name like '--font-inter'
19
+ */
19
20
  /**
20
- * Escape a string for safe interpolation inside a CSS single-quoted string.
21
- *
22
- * Prevents CSS injection by escaping characters that could break out of
23
- * a `'...'` CSS string context: backslashes, single quotes, and newlines.
24
- */
21
+ * Escape a string for safe interpolation inside a CSS single-quoted string.
22
+ *
23
+ * Prevents CSS injection by escaping characters that could break out of
24
+ * a `'...'` CSS string context: backslashes, single quotes, and newlines.
25
+ */
25
26
  function escapeCSSString(value) {
26
- return value
27
- .replace(/\\/g, "\\\\")
28
- .replace(/'/g, "\\'")
29
- .replace(/\n/g, "\\a ")
30
- .replace(/\r/g, "\\d ");
27
+ return value.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\a ").replace(/\r/g, "\\d ");
31
28
  }
32
29
  /**
33
- * Validate a CSS custom property name (e.g. `--font-inter`).
34
- *
35
- * Custom properties must start with `--` and only contain alphanumeric
36
- * characters, hyphens, and underscores. Anything else could be used to
37
- * break out of the CSS declaration and inject arbitrary rules.
38
- *
39
- * Returns the name if valid, undefined otherwise.
40
- */
30
+ * Validate a CSS custom property name (e.g. `--font-inter`).
31
+ *
32
+ * Custom properties must start with `--` and only contain alphanumeric
33
+ * characters, hyphens, and underscores. Anything else could be used to
34
+ * break out of the CSS declaration and inject arbitrary rules.
35
+ *
36
+ * Returns the name if valid, undefined otherwise.
37
+ */
41
38
  function sanitizeCSSVarName(name) {
42
- if (/^--[a-zA-Z0-9_-]+$/.test(name))
43
- return name;
44
- return undefined;
39
+ if (/^--[a-zA-Z0-9_-]+$/.test(name)) return name;
45
40
  }
46
41
  /**
47
- * Sanitize a CSS font-family fallback name.
48
- *
49
- * Generic family names (sans-serif, serif, monospace, etc.) are used as-is.
50
- * Named families are wrapped in escaped quotes. This prevents injection via
51
- * crafted fallback values like `); } body { color: red; } .x {`.
52
- */
42
+ * Sanitize a CSS font-family fallback name.
43
+ *
44
+ * Generic family names (sans-serif, serif, monospace, etc.) are used as-is.
45
+ * Named families are wrapped in escaped quotes. This prevents injection via
46
+ * crafted fallback values like `); } body { color: red; } .x {`.
47
+ */
53
48
  function sanitizeFallback(name) {
54
- // CSS generic font families — safe to use unquoted
55
- const generics = new Set([
56
- "serif",
57
- "sans-serif",
58
- "monospace",
59
- "cursive",
60
- "fantasy",
61
- "system-ui",
62
- "ui-serif",
63
- "ui-sans-serif",
64
- "ui-monospace",
65
- "ui-rounded",
66
- "emoji",
67
- "math",
68
- "fangsong",
69
- ]);
70
- const trimmed = name.trim();
71
- if (generics.has(trimmed))
72
- return trimmed;
73
- // Wrap in single quotes with escaping to prevent CSS injection
74
- return `'${escapeCSSString(trimmed)}'`;
49
+ const generics = new Set([
50
+ "serif",
51
+ "sans-serif",
52
+ "monospace",
53
+ "cursive",
54
+ "fantasy",
55
+ "system-ui",
56
+ "ui-serif",
57
+ "ui-sans-serif",
58
+ "ui-monospace",
59
+ "ui-rounded",
60
+ "emoji",
61
+ "math",
62
+ "fangsong"
63
+ ]);
64
+ const trimmed = name.trim();
65
+ if (generics.has(trimmed)) return trimmed;
66
+ return `'${escapeCSSString(trimmed)}'`;
75
67
  }
76
- // Counter for generating unique class names
77
68
  let classCounter = 0;
78
- // Track which font stylesheets have been injected (SSR + client)
79
- const injectedFonts = new Set();
69
+ const injectedFonts = /* @__PURE__ */ new Set();
80
70
  /**
81
- * Convert a font family name to a CSS variable name.
82
- * e.g., "Inter" -> "--font-inter", "Roboto Mono" -> "--font-roboto-mono"
83
- */
71
+ * Convert a font family name to a CSS variable name.
72
+ * e.g., "Inter" -> "--font-inter", "Roboto Mono" -> "--font-roboto-mono"
73
+ */
84
74
  function toVarName(family) {
85
- return "--font-" + family.toLowerCase().replace(/\s+/g, "-");
75
+ return "--font-" + family.toLowerCase().replace(/\s+/g, "-");
86
76
  }
87
77
  /**
88
- * Build a Google Fonts CSS URL.
89
- */
90
- export function buildGoogleFontsUrl(family, options) {
91
- const params = new URLSearchParams();
92
- // Don't pre-replace spaces with "+". URLSearchParams handles encoding:
93
- // spaces become "+" in application/x-www-form-urlencoded format.
94
- // Pre-replacing would cause double-encoding: "+" -> "%2B" (400 error).
95
- let spec = family;
96
- // Build weight/style specs
97
- const weights = options.weight
98
- ? Array.isArray(options.weight)
99
- ? options.weight
100
- : [options.weight]
101
- : [];
102
- const styles = options.style
103
- ? Array.isArray(options.style)
104
- ? options.style
105
- : [options.style]
106
- : [];
107
- if (weights.length > 0 || styles.length > 0) {
108
- const hasItalic = styles.includes("italic");
109
- if (weights.length > 0) {
110
- if (hasItalic) {
111
- // Use ital axis: ital,wght@0,400;0,700;1,400;1,700
112
- const pairs = [];
113
- for (const w of weights) {
114
- pairs.push(`0,${w}`);
115
- pairs.push(`1,${w}`);
116
- }
117
- spec += `:ital,wght@${pairs.join(";")}`;
118
- }
119
- else {
120
- spec += `:wght@${weights.join(";")}`;
121
- }
122
- }
123
- }
124
- else {
125
- // When no weight is specified, request the full variable weight range.
126
- // Without this, Google Fonts returns only weight 400 (the default).
127
- // Next.js loads the full variable font by default, so we match that
128
- // behavior to ensure all font weights render correctly.
129
- spec += `:wght@100..900`;
130
- }
131
- params.set("family", spec);
132
- params.set("display", options.display ?? "swap");
133
- return `https://fonts.googleapis.com/css2?${params.toString()}`;
78
+ * Build a Google Fonts CSS URL.
79
+ */
80
+ function buildGoogleFontsUrl(family, options) {
81
+ const params = new URLSearchParams();
82
+ let spec = family;
83
+ const weights = options.weight ? Array.isArray(options.weight) ? options.weight : [options.weight] : [];
84
+ const styles = options.style ? Array.isArray(options.style) ? options.style : [options.style] : [];
85
+ if (weights.length > 0 || styles.length > 0) {
86
+ const hasItalic = styles.includes("italic");
87
+ if (weights.length > 0) if (hasItalic) {
88
+ const pairs = [];
89
+ for (const w of weights) {
90
+ pairs.push(`0,${w}`);
91
+ pairs.push(`1,${w}`);
92
+ }
93
+ spec += `:ital,wght@${pairs.join(";")}`;
94
+ } else spec += `:wght@${weights.join(";")}`;
95
+ } else spec += `:wght@100..900`;
96
+ params.set("family", spec);
97
+ params.set("display", options.display ?? "swap");
98
+ return `https://fonts.googleapis.com/css2?${params.toString()}`;
134
99
  }
135
100
  /**
136
- * Inject a <link> tag for the font (client-side only).
137
- * On the server, we track font URLs for SSR head injection.
138
- */
101
+ * Inject a <link> tag for the font (client-side only).
102
+ * On the server, we track font URLs for SSR head injection.
103
+ */
139
104
  function injectFontStylesheet(url) {
140
- if (injectedFonts.has(url))
141
- return;
142
- injectedFonts.add(url);
143
- if (typeof document !== "undefined") {
144
- const link = document.createElement("link");
145
- link.rel = "stylesheet";
146
- link.href = url;
147
- document.head.appendChild(link);
148
- }
105
+ if (injectedFonts.has(url)) return;
106
+ injectedFonts.add(url);
107
+ if (typeof document !== "undefined") {
108
+ const link = document.createElement("link");
109
+ link.rel = "stylesheet";
110
+ link.href = url;
111
+ document.head.appendChild(link);
112
+ }
149
113
  }
150
114
  /** Track which className CSS rules have been injected. */
151
- const injectedClassRules = new Set();
115
+ const injectedClassRules = /* @__PURE__ */ new Set();
152
116
  /**
153
- * Inject a CSS rule that maps a className to a font-family.
154
- *
155
- * This is what makes `<div className={inter.className}>` apply the font.
156
- * Next.js generates equivalent rules at build time.
157
- *
158
- * In Next.js, the .className class ONLY sets font-family — it does NOT
159
- * set CSS variables. CSS variables are handled separately by the .variable class.
160
- */
117
+ * Inject a CSS rule that maps a className to a font-family.
118
+ *
119
+ * This is what makes `<div className={inter.className}>` apply the font.
120
+ * Next.js generates equivalent rules at build time.
121
+ *
122
+ * In Next.js, the .className class ONLY sets font-family — it does NOT
123
+ * set CSS variables. CSS variables are handled separately by the .variable class.
124
+ */
161
125
  function injectClassNameRule(className, fontFamily) {
162
- if (injectedClassRules.has(className))
163
- return;
164
- injectedClassRules.add(className);
165
- const css = `.${className} { font-family: ${fontFamily}; }\n`;
166
- // On server, store the CSS for SSR injection
167
- if (typeof document === "undefined") {
168
- ssrFontStyles.push(css);
169
- return;
170
- }
171
- // On client, inject a <style> tag
172
- const style = document.createElement("style");
173
- style.textContent = css;
174
- style.setAttribute("data-vinext-font-class", className);
175
- document.head.appendChild(style);
126
+ if (injectedClassRules.has(className)) return;
127
+ injectedClassRules.add(className);
128
+ const css = `.${className} { font-family: ${fontFamily}; }\n`;
129
+ if (typeof document === "undefined") {
130
+ ssrFontStyles.push(css);
131
+ return;
132
+ }
133
+ const style = document.createElement("style");
134
+ style.textContent = css;
135
+ style.setAttribute("data-vinext-font-class", className);
136
+ document.head.appendChild(style);
176
137
  }
177
138
  /** Track which variable class CSS rules have been injected. */
178
- const injectedVariableRules = new Set();
139
+ const injectedVariableRules = /* @__PURE__ */ new Set();
179
140
  /** Track which :root CSS variable rules have been injected. */
180
- const injectedRootVariables = new Set();
141
+ const injectedRootVariables = /* @__PURE__ */ new Set();
181
142
  /**
182
- * Inject a CSS rule that sets a CSS variable on an element.
183
- * This is what makes `<html className={inter.variable}>` set the CSS variable
184
- * that can be referenced by other styles (e.g., Tailwind's font-sans).
185
- *
186
- * In Next.js, the .variable class ONLY sets the CSS variable — it does NOT
187
- * set font-family. This is critical because apps commonly apply multiple
188
- * .variable classes to <body> (e.g., geistSans.variable + geistMono.variable).
189
- * If we also set font-family here, the last class wins due to CSS cascade,
190
- * causing all text to use that font (e.g., everything becomes monospace).
191
- */
143
+ * Inject a CSS rule that sets a CSS variable on an element.
144
+ * This is what makes `<html className={inter.variable}>` set the CSS variable
145
+ * that can be referenced by other styles (e.g., Tailwind's font-sans).
146
+ *
147
+ * In Next.js, the .variable class ONLY sets the CSS variable — it does NOT
148
+ * set font-family. This is critical because apps commonly apply multiple
149
+ * .variable classes to <body> (e.g., geistSans.variable + geistMono.variable).
150
+ * If we also set font-family here, the last class wins due to CSS cascade,
151
+ * causing all text to use that font (e.g., everything becomes monospace).
152
+ */
192
153
  function injectVariableClassRule(variableClassName, cssVarName, fontFamily) {
193
- if (injectedVariableRules.has(variableClassName))
194
- return;
195
- injectedVariableRules.add(variableClassName);
196
- // Only set the CSS variable — do NOT set font-family.
197
- // This matches Next.js behavior where .variable classes only define CSS variables.
198
- let css = `.${variableClassName} { ${cssVarName}: ${fontFamily}; }\n`;
199
- // Also inject at :root so CSS variable inheritance works throughout the page.
200
- // This ensures Tailwind utilities like `font-sans` that reference these
201
- // variables via var(--font-geist-sans) work correctly.
202
- if (!injectedRootVariables.has(cssVarName)) {
203
- injectedRootVariables.add(cssVarName);
204
- css += `:root { ${cssVarName}: ${fontFamily}; }\n`;
205
- }
206
- // On server, store the CSS for SSR injection
207
- if (typeof document === "undefined") {
208
- ssrFontStyles.push(css);
209
- return;
210
- }
211
- // On client, inject a <style> tag
212
- const style = document.createElement("style");
213
- style.textContent = css;
214
- style.setAttribute("data-vinext-font-variable", variableClassName);
215
- document.head.appendChild(style);
154
+ if (injectedVariableRules.has(variableClassName)) return;
155
+ injectedVariableRules.add(variableClassName);
156
+ let css = `.${variableClassName} { ${cssVarName}: ${fontFamily}; }\n`;
157
+ if (!injectedRootVariables.has(cssVarName)) {
158
+ injectedRootVariables.add(cssVarName);
159
+ css += `:root { ${cssVarName}: ${fontFamily}; }\n`;
160
+ }
161
+ if (typeof document === "undefined") {
162
+ ssrFontStyles.push(css);
163
+ return;
164
+ }
165
+ const style = document.createElement("style");
166
+ style.textContent = css;
167
+ style.setAttribute("data-vinext-font-variable", variableClassName);
168
+ document.head.appendChild(style);
216
169
  }
217
- // SSR: collect font class CSS for injection in <head>
218
170
  const ssrFontStyles = [];
219
171
  /**
220
- * Get collected SSR font class styles (used by the renderer).
221
- * Note: We don't clear the arrays because fonts are loaded at module import
222
- * time and need to persist across all requests in the Workers environment.
223
- */
224
- export function getSSRFontStyles() {
225
- return [...ssrFontStyles];
172
+ * Get collected SSR font class styles (used by the renderer).
173
+ * Note: We don't clear the arrays because fonts are loaded at module import
174
+ * time and need to persist across all requests in the Workers environment.
175
+ */
176
+ function getSSRFontStyles() {
177
+ return [...ssrFontStyles];
226
178
  }
227
- // SSR: collect font URLs to inject in <head>
228
179
  const ssrFontUrls = [];
229
180
  /**
230
- * Get collected SSR font URLs (used by the renderer).
231
- * Note: We don't clear the arrays because fonts are loaded at module import
232
- * time and need to persist across all requests in the Workers environment.
233
- */
234
- export function getSSRFontLinks() {
235
- return [...ssrFontUrls];
181
+ * Get collected SSR font URLs (used by the renderer).
182
+ * Note: We don't clear the arrays because fonts are loaded at module import
183
+ * time and need to persist across all requests in the Workers environment.
184
+ */
185
+ function getSSRFontLinks() {
186
+ return [...ssrFontUrls];
236
187
  }
237
- // SSR: collect font file URLs for <link rel="preload"> injection (self-hosted Google fonts)
238
188
  const ssrFontPreloads = [];
239
- const ssrFontPreloadHrefs = new Set();
189
+ const ssrFontPreloadHrefs = /* @__PURE__ */ new Set();
240
190
  /**
241
- * Get collected SSR font preload data (used by the renderer).
242
- * Returns an array of { href, type } objects for emitting
243
- * <link rel="preload" as="font" ...> tags.
244
- */
245
- export function getSSRFontPreloads() {
246
- return [...ssrFontPreloads];
191
+ * Get collected SSR font preload data (used by the renderer).
192
+ * Returns an array of { href, type } objects for emitting
193
+ * <link rel="preload" as="font" ...> tags.
194
+ */
195
+ function getSSRFontPreloads() {
196
+ return [...ssrFontPreloads];
247
197
  }
248
198
  /**
249
- * Determine the MIME type for a font file based on its extension.
250
- */
199
+ * Determine the MIME type for a font file based on its extension.
200
+ */
251
201
  function getFontMimeType(pathOrUrl) {
252
- if (pathOrUrl.endsWith(".woff2"))
253
- return "font/woff2";
254
- if (pathOrUrl.endsWith(".woff"))
255
- return "font/woff";
256
- if (pathOrUrl.endsWith(".ttf"))
257
- return "font/ttf";
258
- if (pathOrUrl.endsWith(".otf"))
259
- return "font/opentype";
260
- return "font/woff2";
202
+ if (pathOrUrl.endsWith(".woff2")) return "font/woff2";
203
+ if (pathOrUrl.endsWith(".woff")) return "font/woff";
204
+ if (pathOrUrl.endsWith(".ttf")) return "font/ttf";
205
+ if (pathOrUrl.endsWith(".otf")) return "font/opentype";
206
+ return "font/woff2";
261
207
  }
262
208
  /**
263
- * Extract font file URLs from @font-face CSS rules.
264
- * Parses url('...') references from the CSS text.
265
- */
209
+ * Extract font file URLs from @font-face CSS rules.
210
+ * Parses url('...') references from the CSS text.
211
+ */
266
212
  function extractFontUrlsFromCSS(css) {
267
- const urls = [];
268
- const urlRegex = /url\(['"]?([^'")]+)['"]?\)/g;
269
- let match;
270
- while ((match = urlRegex.exec(css)) !== null) {
271
- const url = match[1];
272
- // Only collect absolute paths (starting with /) — these are self-hosted font files
273
- if (url && url.startsWith("/")) {
274
- urls.push(url);
275
- }
276
- }
277
- return urls;
213
+ const urls = [];
214
+ const urlRegex = /url\(['"]?([^'")]+)['"]?\)/g;
215
+ let match;
216
+ while ((match = urlRegex.exec(css)) !== null) {
217
+ const url = match[1];
218
+ if (url && url.startsWith("/")) urls.push(url);
219
+ }
220
+ return urls;
278
221
  }
279
222
  /**
280
- * Collect font file URLs from self-hosted CSS for preload link generation.
281
- * Only collects on the server (SSR). Deduplicates by href using a Set for O(1) lookups.
282
- */
223
+ * Collect font file URLs from self-hosted CSS for preload link generation.
224
+ * Only collects on the server (SSR). Deduplicates by href using a Set for O(1) lookups.
225
+ */
283
226
  function collectFontPreloadsFromCSS(css) {
284
- if (typeof document !== "undefined")
285
- return; // client-side, skip
286
- const urls = extractFontUrlsFromCSS(css);
287
- for (const href of urls) {
288
- if (!ssrFontPreloadHrefs.has(href)) {
289
- ssrFontPreloadHrefs.add(href);
290
- ssrFontPreloads.push({ href, type: getFontMimeType(href) });
291
- }
292
- }
227
+ if (typeof document !== "undefined") return;
228
+ const urls = extractFontUrlsFromCSS(css);
229
+ for (const href of urls) if (!ssrFontPreloadHrefs.has(href)) {
230
+ ssrFontPreloadHrefs.add(href);
231
+ ssrFontPreloads.push({
232
+ href,
233
+ type: getFontMimeType(href)
234
+ });
235
+ }
293
236
  }
294
237
  /** Track injected self-hosted @font-face blocks (deduplicate) */
295
- const injectedSelfHosted = new Set();
238
+ const injectedSelfHosted = /* @__PURE__ */ new Set();
296
239
  /**
297
- * Inject self-hosted @font-face CSS (from the build plugin).
298
- * This replaces the CDN <link> tag with inline CSS.
299
- */
240
+ * Inject self-hosted @font-face CSS (from the build plugin).
241
+ * This replaces the CDN <link> tag with inline CSS.
242
+ */
300
243
  function injectSelfHostedCSS(css) {
301
- if (injectedSelfHosted.has(css))
302
- return;
303
- injectedSelfHosted.add(css);
304
- // Extract font file URLs for preload hints (SSR only)
305
- collectFontPreloadsFromCSS(css);
306
- if (typeof document === "undefined") {
307
- // SSR: add to collected styles
308
- ssrFontStyles.push(css);
309
- return;
310
- }
311
- // Client: inject <style> tag
312
- const style = document.createElement("style");
313
- style.textContent = css;
314
- style.setAttribute("data-vinext-font-selfhosted", "true");
315
- document.head.appendChild(style);
244
+ if (injectedSelfHosted.has(css)) return;
245
+ injectedSelfHosted.add(css);
246
+ collectFontPreloadsFromCSS(css);
247
+ if (typeof document === "undefined") {
248
+ ssrFontStyles.push(css);
249
+ return;
250
+ }
251
+ const style = document.createElement("style");
252
+ style.textContent = css;
253
+ style.setAttribute("data-vinext-font-selfhosted", "true");
254
+ document.head.appendChild(style);
316
255
  }
317
- export function createFontLoader(family) {
318
- return function fontLoader(options = {}) {
319
- const id = classCounter++;
320
- const className = `__font_${family.toLowerCase().replace(/\s+/g, "_")}_${id}`;
321
- const fallback = options.fallback ?? ["sans-serif"];
322
- // Sanitize each fallback name to prevent CSS injection via crafted values
323
- const fontFamily = `'${escapeCSSString(family)}', ${fallback.map(sanitizeFallback).join(", ")}`;
324
- // Validate CSS variable name reject anything that could inject CSS.
325
- // Fall back to auto-generated name if invalid.
326
- const defaultVarName = toVarName(family);
327
- const cssVarName = options.variable
328
- ? (sanitizeCSSVarName(options.variable) ?? defaultVarName)
329
- : defaultVarName;
330
- // In Next.js, `variable` returns a CLASS NAME that sets the CSS variable.
331
- // Users apply this class to set the CSS variable on that element.
332
- const variableClassName = `__variable_${family.toLowerCase().replace(/\s+/g, "_")}_${id}`;
333
- if (options._selfHostedCSS) {
334
- // Self-hosted mode: inject local @font-face CSS instead of CDN link
335
- injectSelfHostedCSS(options._selfHostedCSS);
336
- }
337
- else {
338
- // CDN mode: inject <link> to Google Fonts
339
- const url = buildGoogleFontsUrl(family, options);
340
- injectFontStylesheet(url);
341
- // On SSR, collect the URL for head injection
342
- if (typeof document === "undefined") {
343
- if (!ssrFontUrls.includes(url)) {
344
- ssrFontUrls.push(url);
345
- }
346
- }
347
- }
348
- // Inject a CSS rule that maps className to font-family.
349
- // This is what makes `<div className={inter.className}>` work.
350
- injectClassNameRule(className, fontFamily);
351
- // Inject a CSS rule for the variable class name.
352
- // This is what makes `<html className={inter.variable}>` set the CSS variable.
353
- injectVariableClassRule(variableClassName, cssVarName, fontFamily);
354
- return {
355
- className,
356
- style: { fontFamily },
357
- variable: variableClassName,
358
- };
359
- };
256
+ function createFontLoader(family) {
257
+ return function fontLoader(options = {}) {
258
+ const id = classCounter++;
259
+ const className = `__font_${family.toLowerCase().replace(/\s+/g, "_")}_${id}`;
260
+ const fallback = options.fallback ?? ["sans-serif"];
261
+ const fontFamily = `'${escapeCSSString(family)}', ${fallback.map(sanitizeFallback).join(", ")}`;
262
+ const defaultVarName = toVarName(family);
263
+ const cssVarName = options.variable ? sanitizeCSSVarName(options.variable) ?? defaultVarName : defaultVarName;
264
+ const variableClassName = `__variable_${family.toLowerCase().replace(/\s+/g, "_")}_${id}`;
265
+ if (options._selfHostedCSS) injectSelfHostedCSS(options._selfHostedCSS);
266
+ else {
267
+ const url = buildGoogleFontsUrl(family, options);
268
+ injectFontStylesheet(url);
269
+ if (typeof document === "undefined") {
270
+ if (!ssrFontUrls.includes(url)) ssrFontUrls.push(url);
271
+ }
272
+ }
273
+ injectClassNameRule(className, fontFamily);
274
+ injectVariableClassRule(variableClassName, cssVarName, fontFamily);
275
+ return {
276
+ className,
277
+ style: { fontFamily },
278
+ variable: variableClassName
279
+ };
280
+ };
360
281
  }
361
- // Export a Proxy that creates font loaders for any Google Font family.
362
- // Usage: import { Inter } from 'next/font/google'
363
- // The proxy intercepts property access and returns a loader for that font.
364
- const googleFonts = new Proxy({}, {
365
- get(_target, prop) {
366
- if (prop === "__esModule")
367
- return true;
368
- if (prop === "default")
369
- return googleFonts;
370
- // Convert camelCase/PascalCase to proper font family name
371
- // e.g., "Inter" -> "Inter", "RobotoMono" -> "Roboto Mono"
372
- const family = prop.replace(/([a-z])([A-Z])/g, "$1 $2");
373
- return createFontLoader(family);
374
- },
375
- });
376
- export default googleFonts;
282
+ const googleFonts = new Proxy({}, { get(_target, prop) {
283
+ if (prop === "__esModule") return true;
284
+ if (prop === "default") return googleFonts;
285
+ return createFontLoader(prop.replace(/([a-z])([A-Z])/g, "$1 $2"));
286
+ } });
287
+ //#endregion
288
+ export { buildGoogleFontsUrl, createFontLoader, googleFonts as default, getSSRFontLinks, getSSRFontPreloads, getSSRFontStyles };
289
+
377
290
  //# sourceMappingURL=font-google-base.js.map