@salla.sa/twilight-theme-engine 1.0.112 → 1.0.113

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 (126) hide show
  1. package/dist/{AddToCartForm-TE3GVAWH.js → AddToCartForm-2QHYDDSR.js} +3 -3
  2. package/dist/{AddToCartForm-TE3GVAWH.js.map → AddToCartForm-2QHYDDSR.js.map} +1 -1
  3. package/dist/{BlogAuthorPage-2SDU4OWN.js → BlogAuthorPage-VYXM5U3T.js} +7 -7
  4. package/dist/{BlogAuthorPage-2SDU4OWN.js.map → BlogAuthorPage-VYXM5U3T.js.map} +1 -1
  5. package/dist/{BlogCategoryPage-FIVKW3XC.js → BlogCategoryPage-ZPUSHJCU.js} +7 -7
  6. package/dist/{BlogCategoryPage-FIVKW3XC.js.map → BlogCategoryPage-ZPUSHJCU.js.map} +1 -1
  7. package/dist/{BlogPage-ACG6RRFH.js → BlogPage-DR4V5LJX.js} +6 -6
  8. package/dist/{BlogPage-ACG6RRFH.js.map → BlogPage-DR4V5LJX.js.map} +1 -1
  9. package/dist/{BlogSinglePage-6UKPKSWI.js → BlogSinglePage-3N3J245D.js} +6 -6
  10. package/dist/{BlogSinglePage-6UKPKSWI.js.map → BlogSinglePage-3N3J245D.js.map} +1 -1
  11. package/dist/{BlogTagPage-NIYLXK4A.js → BlogTagPage-CDVZT6RU.js} +7 -7
  12. package/dist/{BlogTagPage-NIYLXK4A.js.map → BlogTagPage-CDVZT6RU.js.map} +1 -1
  13. package/dist/{BrandsPage-WUP47ULO.js → BrandsPage-5HF3XIJL.js} +6 -6
  14. package/dist/{BrandsPage-WUP47ULO.js.map → BrandsPage-5HF3XIJL.js.map} +1 -1
  15. package/dist/{Breadcrumb-O2QYMZF5.js → Breadcrumb-E5Q5PVSO.js} +6 -6
  16. package/dist/{Breadcrumb-O2QYMZF5.js.map → Breadcrumb-E5Q5PVSO.js.map} +1 -1
  17. package/dist/{CartItem-PEZFT565.js → CartItem-CV7PUPXD.js} +6 -6
  18. package/dist/{CartItem-PEZFT565.js.map → CartItem-CV7PUPXD.js.map} +1 -1
  19. package/dist/{CartSummary-CKYQASQD.js → CartSummary-JZXPVR67.js} +6 -6
  20. package/dist/{CartSummary-CKYQASQD.js.map → CartSummary-JZXPVR67.js.map} +1 -1
  21. package/dist/{Copyright-5BVWX3J2.js → Copyright-YDWUDCKS.js} +3 -3
  22. package/dist/{Copyright-5BVWX3J2.js.map → Copyright-YDWUDCKS.js.map} +1 -1
  23. package/dist/{CustomerLayout-K6MDTJAK.js → CustomerLayout-7XCEWCDO.js} +6 -6
  24. package/dist/{CustomerLayout-K6MDTJAK.js.map → CustomerLayout-7XCEWCDO.js.map} +1 -1
  25. package/dist/{Footer-VG7H4NDU.js → Footer-FANYENUN.js} +4 -4
  26. package/dist/{Footer-VG7H4NDU.js.map → Footer-FANYENUN.js.map} +1 -1
  27. package/dist/{Header-77E24UCH.js → Header-XFY3BWV2.js} +4 -4
  28. package/dist/{Header-77E24UCH.js.map → Header-XFY3BWV2.js.map} +1 -1
  29. package/dist/{LoyaltyPage-TZ2ZCN7D.js → LoyaltyPage-HZASEZXX.js} +6 -6
  30. package/dist/{LoyaltyPage-TZ2ZCN7D.js.map → LoyaltyPage-HZASEZXX.js.map} +1 -1
  31. package/dist/{LoyaltyPointsPage-SNNE2LPO.js → LoyaltyPointsPage-6VPCZVUO.js} +3 -3
  32. package/dist/{LoyaltyPointsPage-SNNE2LPO.js.map → LoyaltyPointsPage-6VPCZVUO.js.map} +1 -1
  33. package/dist/{MainMenu-OLTQHNRC.js → MainMenu-ZOP6ESHR.js} +3 -3
  34. package/dist/{MainMenu-OLTQHNRC.js.map → MainMenu-ZOP6ESHR.js.map} +1 -1
  35. package/dist/{MasterLayout-2YXSDPYR.js → MasterLayout-UR6MGE2Q.js} +6 -6
  36. package/dist/{MasterLayout-2YXSDPYR.js.map → MasterLayout-UR6MGE2Q.js.map} +1 -1
  37. package/dist/{MobileMenu-3GTTROW7.js → MobileMenu-NJUO7Y36.js} +6 -6
  38. package/dist/{MobileMenu-3GTTROW7.js.map → MobileMenu-NJUO7Y36.js.map} +1 -1
  39. package/dist/{NotificationsPage-CLFV2RZP.js → NotificationsPage-IWCKW3EV.js} +6 -6
  40. package/dist/{NotificationsPage-CLFV2RZP.js.map → NotificationsPage-IWCKW3EV.js.map} +1 -1
  41. package/dist/{OrderSinglePage-G23VZHUU.js → OrderSinglePage-JZWJ2GBH.js} +6 -6
  42. package/dist/{OrderSinglePage-G23VZHUU.js.map → OrderSinglePage-JZWJ2GBH.js.map} +1 -1
  43. package/dist/{OrdersPage-3IOOHWHB.js → OrdersPage-M7UFWWH6.js} +6 -6
  44. package/dist/{OrdersPage-3IOOHWHB.js.map → OrdersPage-M7UFWWH6.js.map} +1 -1
  45. package/dist/{PageSingle-H4YBIV6N.js → PageSingle-ZJCRWIBB.js} +3 -3
  46. package/dist/{PageSingle-H4YBIV6N.js.map → PageSingle-ZJCRWIBB.js.map} +1 -1
  47. package/dist/{ProductDetails-DVMOV456.js → ProductDetails-BN36YHSM.js} +3 -3
  48. package/dist/{ProductDetails-DVMOV456.js.map → ProductDetails-BN36YHSM.js.map} +1 -1
  49. package/dist/{ProfilePage-PB5GTUML.js → ProfilePage-FVHXZZQC.js} +6 -6
  50. package/dist/{ProfilePage-PB5GTUML.js.map → ProfilePage-FVHXZZQC.js.map} +1 -1
  51. package/dist/{ReviewsPage-RVUZDDRM.js → ReviewsPage-WLKU2IPF.js} +3 -3
  52. package/dist/{ReviewsPage-RVUZDDRM.js.map → ReviewsPage-WLKU2IPF.js.map} +1 -1
  53. package/dist/{SeoCartWidget-WV4KPH2S.js → SeoCartWidget-A3CJPENY.js} +6 -6
  54. package/dist/{SeoCartWidget-WV4KPH2S.js.map → SeoCartWidget-A3CJPENY.js.map} +1 -1
  55. package/dist/{SettingsPage-GOSZA5LT.js → SettingsPage-MPJFT64A.js} +6 -6
  56. package/dist/{SettingsPage-GOSZA5LT.js.map → SettingsPage-MPJFT64A.js.map} +1 -1
  57. package/dist/{StoreClosedNotification-DJ7OAWQC.js → StoreClosedNotification-MCNOQKFD.js} +7 -7
  58. package/dist/{StoreClosedNotification-DJ7OAWQC.js.map → StoreClosedNotification-MCNOQKFD.js.map} +1 -1
  59. package/dist/{TestimonialsPage-JQTZ6YJH.js → TestimonialsPage-JAJOAI7A.js} +3 -3
  60. package/dist/{TestimonialsPage-JQTZ6YJH.js.map → TestimonialsPage-JAJOAI7A.js.map} +1 -1
  61. package/dist/{ThankYouPage-LPVQDOLE.js → ThankYouPage-KS25YF2G.js} +6 -6
  62. package/dist/{ThankYouPage-LPVQDOLE.js.map → ThankYouPage-KS25YF2G.js.map} +1 -1
  63. package/dist/{WalletPage-HEQOSBJH.js → WalletPage-ANE5FDL6.js} +6 -6
  64. package/dist/{WalletPage-HEQOSBJH.js.map → WalletPage-ANE5FDL6.js.map} +1 -1
  65. package/dist/{WishlistPage-OLQQJD5V.js → WishlistPage-IG5BBBCY.js} +6 -6
  66. package/dist/{WishlistPage-OLQQJD5V.js.map → WishlistPage-IG5BBBCY.js.map} +1 -1
  67. package/dist/{chunk-NFRSUW4L.js → chunk-2J5AW75K.js} +8 -8
  68. package/dist/{chunk-NFRSUW4L.js.map → chunk-2J5AW75K.js.map} +1 -1
  69. package/dist/{chunk-VDV26OPG.js → chunk-3SYYPERF.js} +3 -3
  70. package/dist/{chunk-VDV26OPG.js.map → chunk-3SYYPERF.js.map} +1 -1
  71. package/dist/{chunk-6HSMXFAW.js → chunk-6V4TKT7O.js} +5 -5
  72. package/dist/{chunk-6HSMXFAW.js.map → chunk-6V4TKT7O.js.map} +1 -1
  73. package/dist/{chunk-NQRA3MRH.js → chunk-BLTF544K.js} +4 -4
  74. package/dist/{chunk-NQRA3MRH.js.map → chunk-BLTF544K.js.map} +1 -1
  75. package/dist/{chunk-Z5EAIRR3.js → chunk-D5EPCVPX.js} +4 -4
  76. package/dist/{chunk-Z5EAIRR3.js.map → chunk-D5EPCVPX.js.map} +1 -1
  77. package/dist/{chunk-KXCMUORW.js → chunk-FQWF2V5C.js} +3 -3
  78. package/dist/{chunk-KXCMUORW.js.map → chunk-FQWF2V5C.js.map} +1 -1
  79. package/dist/{chunk-JYGIC54K.js → chunk-IEU7LOKW.js} +3 -3
  80. package/dist/{chunk-JYGIC54K.js.map → chunk-IEU7LOKW.js.map} +1 -1
  81. package/dist/chunk-KFOKCJOJ.js +14 -0
  82. package/dist/{chunk-2BBIVHKI.js.map → chunk-KFOKCJOJ.js.map} +1 -1
  83. package/dist/{chunk-DILJT76E.js → chunk-OTRQB2ZJ.js} +7 -7
  84. package/dist/{chunk-DILJT76E.js.map → chunk-OTRQB2ZJ.js.map} +1 -1
  85. package/dist/{chunk-CZEYFBMN.js → chunk-RRTDXKV5.js} +3 -3
  86. package/dist/{chunk-CZEYFBMN.js.map → chunk-RRTDXKV5.js.map} +1 -1
  87. package/dist/{chunk-6XTOZHW4.js → chunk-T6IIPRRQ.js} +6 -6
  88. package/dist/{chunk-6XTOZHW4.js.map → chunk-T6IIPRRQ.js.map} +1 -1
  89. package/dist/{chunk-73CUZ7LC.js → chunk-TMSDWRCO.js} +3 -3
  90. package/dist/{chunk-73CUZ7LC.js.map → chunk-TMSDWRCO.js.map} +1 -1
  91. package/dist/{chunk-DE7OGVOT.js → chunk-ZODMX2OQ.js} +4 -4
  92. package/dist/{chunk-DE7OGVOT.js.map → chunk-ZODMX2OQ.js.map} +1 -1
  93. package/dist/components/cart/index.js +1 -1
  94. package/dist/components/common/index.js +1 -1
  95. package/dist/components/drawer/index.js +4 -4
  96. package/dist/components/home/index.js +6 -6
  97. package/dist/components/layout/index.js +1 -1
  98. package/dist/components/product/index.js +5 -5
  99. package/dist/components/store/index.js +5 -5
  100. package/dist/{document-class-ODK66AC7.js → document-class-BUEFLHYC.js} +3 -3
  101. package/dist/{document-class-ODK66AC7.js.map → document-class-BUEFLHYC.js.map} +1 -1
  102. package/dist/hooks/index.js +4 -4
  103. package/dist/hooks/useGtm.js +4 -4
  104. package/dist/hooks/useMoney.js +4 -4
  105. package/dist/hooks/useStore.js +4 -4
  106. package/dist/index.js +4 -4
  107. package/dist/{not-found-7BJGV2CA.js → not-found-LFQUSYZE.js} +6 -6
  108. package/dist/{not-found-7BJGV2CA.js.map → not-found-LFQUSYZE.js.map} +1 -1
  109. package/dist/providers/index.js +4 -4
  110. package/dist/routes/account/orders.js +1 -1
  111. package/dist/routes/account.js +6 -6
  112. package/dist/routes/blog.js +5 -5
  113. package/dist/routes/brands.js +1 -1
  114. package/dist/routes/cart.js +8 -8
  115. package/dist/routes/home.js +7 -7
  116. package/dist/routes/loyalty.js +2 -2
  117. package/dist/routes/page.js +1 -1
  118. package/dist/routes/product-listing.js +6 -6
  119. package/dist/routes/product.js +6 -6
  120. package/dist/routes/testimonials.js +2 -2
  121. package/dist/routes/thank-you.js +1 -1
  122. package/dist/skeleton.js +7 -7
  123. package/dist/tanstack.js +2 -2
  124. package/dist/tanstack.js.map +1 -1
  125. package/package.json +1 -1
  126. package/dist/chunk-2BBIVHKI.js +0 -14
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/tanstack/stylesheet.tsx","../src/tanstack/middleware/store-not-found.ts","../src/tanstack/middleware/twilight.ts","../src/tanstack/middleware/earlyHints.ts"],"names":["createMiddleware"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,IAAM,gBAAA,GAAmB,MAAM,MAAM;AAAC,CAAA;AAG/B,SAAS,gBAAgB,EAAE,IAAA,EAAM,QAAA,GAAW,IAAG,EAAyB;AAC7E,EAAA,MAAM,UAAU,cAAA,CAAe;AAAA,IAC7B,MAAA,EAAQ,CAAC,KAAA,KACP,KAAA,CAAM,QAAQ,IAAA,CAAK,CAAC,KAAA,KAAU,MAAA,CAAO,MAAA,CAAO,QAAA,EAAU,KAAA,CAAM,OAAO,CAAC,CAAA,EAAG;AAAA,GAC1E,CAAA;AAED,EAAA,MAAM,CAAC,aAAa,CAAA,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OAAO,IAAI,QAAA,CAAS,QAAA,CAAS,IAAA,EAAM;AAAA,MACjC,QAAQ,QAAA,CAAS,MAAA;AAAA,MACjB,YAAY,QAAA,CAAS,UAAA;AAAA,MACrB;AAAA,KACD,CAAA;AAAA,EACH,CAAC,CAAA;AACH","file":"tanstack.js","sourcesContent":["import { useState, useSyncExternalStore } from 'react';\nimport { Asset, useRouter, useRouterState, useTags } from '@tanstack/react-router';\nimport { CRITICAL_STYLE_HREF } from '../boot/critical-style';\n\nexport interface ThemeStylesheetProps {\n /** The full stylesheet's URL (`app.css?url`). */\n href: string;\n /**\n * Inline critical CSS by route id. A page server-rendered as one of these routes paints from it,\n * and `bootClient` adds `href` once its first screen has painted. Pass the same route ids on the\n * client with empty strings, so hydration renders the same tags without shipping the CSS twice.\n */\n critical?: Readonly<Record<string, string>>;\n}\n\nconst subscribeNothing = () => () => {};\n\n/** The theme's stylesheet: inline critical CSS for the routes that have it, the full sheet otherwise. */\nexport function ThemeStylesheet({ href, critical = {} }: ThemeStylesheetProps) {\n const routeId = useRouterState({\n select: (state): string | undefined =>\n state.matches.find((match) => Object.hasOwn(critical, match.routeId))?.routeId,\n });\n // The route the page was server-rendered as: never added or removed on client-side navigations.\n const [criticalRoute] = useState(routeId);\n const hydrated = useSyncExternalStore(\n subscribeNothing,\n () => true,\n () => false\n );\n\n return (\n <>\n {criticalRoute && (\n // Its own precedence, so it lands before the full sheet; React renders the CSS verbatim.\n <style href={CRITICAL_STYLE_HREF} precedence=\"critical\">\n {critical[criticalRoute]}\n </style>\n )}\n {(!criticalRoute || hydrated) && (\n <link id=\"salla-theme-css\" rel=\"stylesheet\" href={href} precedence=\"default\" />\n )}\n {criticalRoute && (\n <noscript>\n <link rel=\"stylesheet\" href={href} />\n </noscript>\n )}\n </>\n );\n}\n\n/** The route's head tags without module preloads: they raced the LCP image, and the entry loads every chunk anyway. */\nexport function ThemeHeadContent() {\n const tags = useTags();\n const nonce = useRouter().options.ssr?.nonce;\n return tags\n .filter((tag) => !(tag.tag === 'link' && tag.attrs?.rel === 'modulepreload'))\n .map((tag) => <Asset {...tag} key={`tsr-meta-${JSON.stringify(tag)}`} nonce={nonce} />);\n}\n","/**\n * Which address was not found, as Twig's `checkUsername` (SallaApp/Store) tells them\n * apart: a store the request named (a username, `?storeId=`), or the domain itself.\n */\nexport type StoreNotFoundKind = 'store' | 'domain';\n\n/** Twig's copy (`error::errors.<kind>.not_found_*`). Arabic in every language, as there. */\nconst COPY: Record<StoreNotFoundKind, { title: string; message: string }> = {\n store: {\n title: 'المتجر غير موجود!',\n message: 'نأسف هذا المتجر غير موجود حاليا!.',\n },\n domain: {\n title: 'نطاق المتجر غير موجود!',\n message: 'نأسف نطاق المتجر المطلوب غير موجود حاليا!.',\n },\n};\n\n/**\n * The page Twig answers with a 410 when no store has the address it was asked for,\n * with what a visitor sees kept: the same markup and the same stylesheet. Dropped: the\n * feedback form, which Twig renders hidden, and the jQuery and legacy scripts behind\n * it. `iframe-embed` is on `<body>` from the start because Twig's script adds it on\n * every load, and it is what hides the `body--bg` background; the empty `msg-container`\n * keeps the block where Twig's sits. The link is absolute because `/register` exists\n * only on salla.sa.\n *\n * One constant document, and only {@link COPY} is ever put into it: nothing from the\n * request reaches this page.\n */\nconst PAGE = `<!DOCTYPE html>\n<html lang=\"ar\" dir=\"rtl\">\n<head>\n<meta charset=\"UTF-8\">\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n<meta name=\"theme-color\" content=\"#37a495\">\n<meta name=\"author\" content=\"منصة سلة\">\n<meta name=\"robots\" content=\"noindex, follow\">\n<meta name=\"copyright\" content=\"Salla.sa\">\n<title>{title}</title>\n<link rel=\"icon\" type=\"image/png\" href=\"https://cdn.salla.network/images/logo/logo-square.png\">\n<link rel=\"apple-touch-icon-precomposed\" href=\"https://cdn.salla.network/images/logo/logo-square.png\">\n<link rel=\"stylesheet\" href=\"https://cdn.salla.network/fonts/pingarlt.css?v=0.2\">\n<link rel=\"stylesheet\" href=\"https://cdn.assets.salla.network/prod/stores/vendor/salla/errors/css/app.css?id=0d7e71fbf018a0d5c478129a56c7a71f\">\n</head>\n<body class=\"body body--rtl body--bg iframe-embed\">\n<header id=\"header\" class=\"header header--404\"></header>\n<main id=\"main\" class=\"main main--404\">\n<div class=\"container container--wide\">\n<div class=\"e404-container\">\n<div class=\"landing\">\n<h1 class=\"title title--giant title--404\"><img src=\"https://cdn.assets.salla.network/prod/stores/vendor/salla/errors/images/error.svg\" alt=\"\"/> 410</h1>\n<h3>{title}</h3>\n<p>{message}<br> بإمكانك العودة للصفحة لرئيسية أو التسجيل للتمتع بمتجر رائع!</p>\n<a href=\"https://salla.sa/register\">سجل متجرك الأن</a>\n</div>\n</div>\n<div class=\"form-group msg-container\"></div>\n</div>\n</main>\n<footer id=\"footer\" class=\"footer\"></footer>\n</body>\n</html>\n`;\n\n/** Twig's 410 page for `kind`. */\nexport function storeNotFoundPage(kind: StoreNotFoundKind): string {\n const { title, message } = COPY[kind];\n return PAGE.replaceAll('{title}', title).replace('{message}', message);\n}\n\n/** {@link storeNotFoundPage} as Twig sends it: a 410 that no cache keeps. */\nexport function storeNotFoundResponse(kind: StoreNotFoundKind): Response {\n return new Response(storeNotFoundPage(kind), {\n status: 410,\n headers: {\n 'content-type': 'text/html; charset=UTF-8',\n 'cache-control': 'max-age=0, must-revalidate, no-cache, no-store, private',\n },\n });\n}\n","import type { AnyRequestMiddleware } from '@tanstack/react-start';\nimport { createMiddleware } from '@tanstack/react-start';\nimport {\n extractTokenFromCookies,\n resolveAddressedStore,\n resolveRequestScope,\n resolveRequestVersionId,\n AUTH_TOKEN_COOKIE_NAME,\n STORE_BASE_HEADER,\n} from '../../utils/cookies';\nimport { getTwilightContext, runWithTwilightContext } from '../../twilight/context';\nimport { requestHostOf } from '../../utils/request-host';\nimport { legacyLocaleRedirectHref } from '../../utils/store-base';\nimport { readNativeAppHeaders } from '../../utils/native-app-headers';\nimport { storeNotFoundResponse } from './store-not-found';\n\n/**\n * A 503 for the maintenance page, so search engines read it as temporary and keep\n * the store indexed. TanStack sets the SSR status from the router alone (200, 404,\n * 500) and ignores `setResponseStatus`, so the status is applied here, on the\n * response the render produced, from the decision `rootBeforeLoad` left in the\n * request context. Only a 200 is rewritten: a redirect or an error keeps its own.\n *\n * `next()` resolves to the middleware context, whose `response` is the render; a\n * bare `Response` is accepted too. The rewrite keeps the body stream, so TanStack\n * treats it as the same response rather than a replacement to cancel.\n */\nexport function withMaintenanceStatus<T>(result: T): T | Response {\n const response =\n result instanceof Response\n ? result\n : (result as { response?: unknown } | null)?.response instanceof Response\n ? ((result as { response: Response }).response as Response)\n : null;\n if (!response || response.status !== 200 || !getTwilightContext().maintenance) return result;\n const unavailable = new Response(response.body, {\n status: 503,\n statusText: 'Service Unavailable',\n headers: response.headers,\n });\n return result instanceof Response ? unavailable : { ...result, response: unavailable };\n}\n\n/**\n * Twig's 410 page in place of the render, once rootBeforeLoad has learned that no store\n * has this request's identifier: there is no store to render, so nothing of it is kept.\n * The page says \"domain\" when the host was the identifier (nothing in the request named\n * a store), as Twig's `checkUsername` does for a host that is not salla.sa.\n *\n * A render that threw is answered the same way. A theme's shell renders even when the\n * root route failed, and one that reads the settings there throws, which h3 would\n * otherwise answer with a bare `{\"status\":500,\"unhandled\":true}`.\n */\nexport function withStoreNotFoundPage<T>(result: T): T | Response {\n if (!getTwilightContext().storeNotFound) return result;\n const page = storeNotFoundAnswer();\n const carried = (result as { response?: unknown } | null)?.response;\n return carried instanceof Response ? { ...result, response: page } : page;\n}\n\n/** The render's failure, unless {@link withStoreNotFoundPage} has an answer for it. */\nexport function storeNotFoundOrThrow(error: unknown): Response {\n if (getTwilightContext().storeNotFound) return storeNotFoundAnswer();\n throw error;\n}\n\n/** A store the request named (`?storeId=`, a path segment, a username), else the host's. */\nfunction storeNotFoundAnswer(): Response {\n const { storeId, storeBase } = getTwilightContext();\n return storeNotFoundResponse(storeId || storeBase ? 'store' : 'domain');\n}\n\ninterface TwilightMiddlewareOptions {\n cookieName?: string;\n}\n\nexport const twilightMiddleware = (options?: TwilightMiddlewareOptions): AnyRequestMiddleware => {\n const cookieName = options?.cookieName ?? AUTH_TOKEN_COOKIE_NAME;\n\n return createMiddleware().server(async ({ request, next }) => {\n const cookieHeader = request.headers.get('Cookie');\n const authToken = extractTokenFromCookies(cookieHeader, cookieName);\n // `?scope=` before the cookie: it is how a market is switched (see resolveRequestScope).\n const scope = resolveRequestScope(request.url, cookieHeader);\n const requestHost = requestHostOf(request);\n // Read here and nowhere else: a deployed theme worker has no vars and no\n // bindings, so the request is the only thing that knows which store it is\n // serving. Everything downstream reads it off the context rather than\n // reaching for a build-time constant that is not there in production.\n //\n // The host goes in because it decides whether the request is allowed to name\n // a store at all. On a merchant's own domain it is not: the hostname is the\n // store, and `?storeId=` there would serve a stranger's shop from a domain\n // its owner controls.\n //\n // On those same hosts the store is also the first segment of the path, the\n // root of every URL there, and a store named that way takes the cookie's\n // place: the path is the address the visitor can see.\n //\n // On a Salla shared host the dispatcher names the store instead, from the\n // segment after the locale, and that is where it stays in every URL.\n const { storeId, storeBase, storeBaseFollowsLocale } = resolveAddressedStore(\n request.url,\n cookieHeader,\n requestHost,\n request.headers.get(STORE_BASE_HEADER)\n );\n // The version is read here for the same reason and behind the same gate. A\n // theme editor previews a draft version of a merchant's settings before it is\n // published, and a partner running the theme locally renders against one —\n // both open the storefront in an iframe and say which version in the URL.\n const versionId = resolveRequestVersionId(request.url, cookieHeader, requestHost);\n const nativeAppHeaders = readNativeAppHeaders(request.headers);\n\n // A shared host's address has no language in it any more: `/dev-x/cart`, not\n // `/ar/dev-x/cart`. An old link is sent to the new one once, keeping its language as\n // `?lang=`. Only a page load is redirected; anything else is answered as asked.\n if (\n storeBase &&\n storeBaseFollowsLocale &&\n (request.method === 'GET' || request.method === 'HEAD')\n ) {\n const location = legacyLocaleRedirectHref(request.url, storeBase);\n if (location) return new Response(null, { status: 302, headers: { Location: location } });\n }\n\n const response = await runWithTwilightContext(\n {\n authToken,\n scope,\n storeId,\n storeBase,\n storeBaseFollowsLocale,\n versionId,\n requestHost,\n nativeAppHeaders,\n },\n () => {\n const result = next({ context: { authToken } });\n const settle = <R>(rendered: R) => withMaintenanceStatus(withStoreNotFoundPage(rendered));\n // The continuation stays in this request's scope: it was registered inside `run`.\n return result instanceof Promise\n ? result.then(settle, storeNotFoundOrThrow)\n : settle(result);\n }\n );\n // On a shared host the same URL is answered in the language the `s-lang` cookie names, so\n // a cache in front of the worker must not serve one visitor's page to another.\n return storeBaseFollowsLocale ? varyOnCookie(response) : response;\n });\n};\n\n/** A copy of `response` with `Vary: Cookie` added (the original's headers may be immutable). */\nfunction withVaryCookie(response: Response): Response {\n const headers = new Headers(response.headers);\n headers.append('Vary', 'Cookie');\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers,\n });\n}\n\n/**\n * Adds `Vary: Cookie` to what `next()` produced: its result carries the page's `response`,\n * and a middleware may also pass a bare `Response` through. Anything else is left as it is.\n */\nfunction varyOnCookie<T>(result: T): T {\n if (result instanceof Response) return withVaryCookie(result) as T;\n const carried = (result as { response?: unknown } | null)?.response;\n if (carried instanceof Response) {\n (result as { response: Response }).response = withVaryCookie(carried);\n }\n return result;\n}\n","import type { AnyRequestMiddleware } from '@tanstack/react-start';\nimport { createMiddleware } from '@tanstack/react-start';\nimport { tsrStartManifest } from 'tanstack-start-manifest:v';\nimport { rootHead } from '../../routes/root/head';\n\n/** Known critical assets that should always be preloaded */\nconst CRITICAL_ASSETS = [\n { rel: 'preconnect', href: 'https://api.salla.dev' },\n { rel: 'preconnect', href: 'https://cdn.salla.sa' },\n { rel: 'preconnect', href: 'https://cdn.assets.salla.network', crossOrigin: 'anonymous' },\n { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossOrigin: 'anonymous' },\n] as const;\n\n/** Extract locale from URL path (e.g., /ar/products → 'ar') */\nfunction extractLocale(url: string): string | undefined {\n const match = url.match(/^\\/([a-z]{2})(\\/|$)/);\n return match?.[1];\n}\n\n/** Build Link header value from a link descriptor */\nfunction buildLinkHeader(link: Record<string, unknown>): string | null {\n const href = link.href as string | undefined;\n const rel = link.rel as string | undefined;\n if (!href || !rel) return null;\n\n // Skip print-media stylesheets (already non-blocking)\n if (rel === 'stylesheet') {\n const media = link.media as string | undefined;\n if (media === 'print') return null;\n return `<${href}>; rel=preload; as=style`;\n }\n\n if (rel === 'preload') {\n const asType = link.as as string | undefined;\n if (!asType) return null;\n const parts = [`<${href}>`, 'rel=preload', `as=${asType}`];\n if (asType === 'font' || link.crossOrigin) {\n parts.push('crossorigin');\n }\n return parts.join('; ');\n }\n\n if (rel === 'modulepreload') {\n return `<${href}>; rel=modulepreload`;\n }\n\n return null;\n}\n\nexport const earlyHintsMiddleware = (): AnyRequestMiddleware => {\n let cachedManifestPaths: string[] | null = null;\n\n return createMiddleware().server(async ({ request, next }) => {\n const response = await next();\n\n const accept = request.headers.get('Accept') ?? '';\n if (!accept.includes('text/html') && accept !== '*/*') return response;\n if (!(response instanceof Response)) return response;\n\n const linkHeaders: string[] = [];\n\n // 1. Add critical assets from rootHead (fonts, icons, SDK, etc.)\n try {\n const url = new URL(request.url);\n const locale = extractLocale(url.pathname);\n if (locale) {\n const headResult = rootHead({ params: { locale } });\n const links = (headResult.links as Record<string, unknown>[]) ?? [];\n for (const link of links) {\n const header = buildLinkHeader(link);\n if (header) linkHeaders.push(header);\n }\n }\n } catch (e) {\n // rootHead failed — log why, then fall back to known critical assets\n console.warn('[earlyHints] rootHead failed:', e instanceof Error ? e.message : e);\n for (const asset of CRITICAL_ASSETS) {\n const co = 'crossOrigin' in asset ? asset.crossOrigin : undefined;\n linkHeaders.push(`<${asset.href}>; rel=${asset.rel}${co ? '; crossorigin' : ''}`);\n }\n }\n\n // 2. Add CSS from TanStack Start manifest (bundled theme CSS)\n if (!cachedManifestPaths) {\n try {\n const manifest = tsrStartManifest();\n const rootAssets = manifest.routes['__root__']?.assets ?? [];\n const seen = new Set<string>();\n cachedManifestPaths = [];\n for (const asset of rootAssets) {\n if (asset.tag === 'link' && asset.attrs?.href?.endsWith('.css')) {\n if (!seen.has(asset.attrs.href)) {\n seen.add(asset.attrs.href);\n cachedManifestPaths.push(asset.attrs.href);\n }\n }\n }\n } catch (e) {\n // manifest not available — skip\n console.warn('[earlyHints] tsrStartManifest failed:', e instanceof Error ? e.message : e);\n }\n }\n\n if (cachedManifestPaths) {\n for (const href of cachedManifestPaths) {\n linkHeaders.push(`<${href}>; rel=preload; as=style`);\n }\n }\n\n // Apply Link headers if we have any\n if (linkHeaders.length === 0) {\n console.warn('[earlyHints] no critical assets found — no Link headers added');\n return response;\n }\n\n const headers = new Headers(response.headers);\n for (const linkHeader of linkHeaders) {\n headers.append('Link', linkHeader);\n }\n\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers,\n });\n });\n};\n"]}
1
+ {"version":3,"sources":["../src/tanstack/stylesheet.tsx","../src/tanstack/middleware/store-not-found.ts","../src/tanstack/middleware/twilight.ts","../src/tanstack/middleware/earlyHints.ts"],"names":["createMiddleware"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,IAAM,gBAAA,GAAmB,MAAM,MAAM;AAAC,CAAA;AAG/B,SAAS,gBAAgB,EAAE,IAAA,EAAM,QAAA,GAAW,IAAG,EAAyB;AAC7E,EAAA,MAAM,UAAU,cAAA,CAAe;AAAA,IAC7B,MAAA,EAAQ,CAAC,KAAA,KACP,KAAA,CAAM,QAAQ,IAAA,CAAK,CAAC,KAAA,KAAU,MAAA,CAAO,MAAA,CAAO,QAAA,EAAU,KAAA,CAAM,OAAO,CAAC,CAAA,EAAG;AAAA,GAC1E,CAAA;AAED,EAAA,MAAM,CAAC,aAAa,CAAA,GAAI,QAAA,CAAS,OAAO,CAAA;AACxC,EAAA,MAAM,QAAA,GAAW,oBAAA;AAAA,IACf,gBAAA;AAAA,IACA,MAAM,IAAA;AAAA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S,UAAA;AAAA,MACrB;AAAA,KACD,CAAA;AAAA,EACH,CAAC,CAAA;AACH","file":"tanstack.js","sourcesContent":["import { useState, useSyncExternalStore } from 'react';\nimport { Asset, useRouter, useRouterState, useTags } from '@tanstack/react-router';\nimport { CRITICAL_STYLE_HREF } from '../boot/critical-style';\n\nexport interface ThemeStylesheetProps {\n /** The full stylesheet's URL (`app.css?url`). */\n href: string;\n /**\n * Inline critical CSS by route id. A page server-rendered as one of these routes paints from it,\n * and `bootClient` adds `href` once its first screen has painted. Pass the same route ids on the\n * client with empty strings, so hydration renders the same tags without shipping the CSS twice.\n */\n critical?: Readonly<Record<string, string>>;\n}\n\nconst subscribeNothing = () => () => {};\n\n/** The theme's stylesheet: inline critical CSS for the routes that have it, the full sheet otherwise. */\nexport function ThemeStylesheet({ href, critical = {} }: ThemeStylesheetProps) {\n const routeId = useRouterState({\n select: (state): string | undefined =>\n state.matches.find((match) => Object.hasOwn(critical, match.routeId))?.routeId,\n });\n // The route the page was server-rendered as: never added or removed on client-side navigations.\n const [criticalRoute] = useState(routeId);\n const hydrated = useSyncExternalStore(\n subscribeNothing,\n () => true,\n () => false\n );\n\n return (\n <>\n {criticalRoute && (\n // Its own precedence, so it lands before the full sheet; React renders the CSS verbatim.\n <style href={CRITICAL_STYLE_HREF} precedence=\"critical\">\n {critical[criticalRoute]}\n </style>\n )}\n {(!criticalRoute || hydrated) && (\n <link id=\"salla-theme-css\" rel=\"stylesheet\" href={href} precedence=\"default\" />\n )}\n {criticalRoute && (\n <noscript>\n <link rel=\"stylesheet\" href={href} />\n </noscript>\n )}\n </>\n );\n}\n\n/** The route's head tags without module preloads: they raced the LCP image, and the entry loads every chunk anyway. */\nexport function ThemeHeadContent() {\n const tags = useTags();\n const nonce = useRouter().options.ssr?.nonce;\n return tags\n .filter((tag) => !(tag.tag === 'link' && tag.attrs?.rel === 'modulepreload'))\n .map((tag) => <Asset {...tag} key={`tsr-meta-${JSON.stringify(tag)}`} nonce={nonce} />);\n}\n","/**\n * Which address was not found, as Twig's `checkUsername` (SallaApp/Store) tells them\n * apart: a store the request named (a username, `?storeId=`), or the domain itself.\n */\nexport type StoreNotFoundKind = 'store' | 'domain';\n\n/** Twig's copy (`error::errors.<kind>.not_found_*`). Arabic in every language, as there. */\nconst COPY: Record<StoreNotFoundKind, { title: string; message: string }> = {\n store: {\n title: 'المتجر غير موجود!',\n message: 'نأسف هذا المتجر غير موجود حاليا!.',\n },\n domain: {\n title: 'نطاق المتجر غير موجود!',\n message: 'نأسف نطاق المتجر المطلوب غير موجود حاليا!.',\n },\n};\n\n/**\n * The page Twig answers with a 410 when no store has the address it was asked for,\n * with what a visitor sees kept: the same markup and the same stylesheet. Dropped: the\n * feedback form, which Twig renders hidden, and the jQuery and legacy scripts behind\n * it. `iframe-embed` is on `<body>` from the start because Twig's script adds it on\n * every load, and it is what hides the `body--bg` background; the empty `msg-container`\n * keeps the block where Twig's sits. The link goes to merchant sign-up on s.salla.sa;\n * Twig's relative `/register` would reach the theme on any host but salla.sa.\n *\n * One constant document, and only {@link COPY} is ever put into it: nothing from the\n * request reaches this page.\n */\nconst PAGE = `<!DOCTYPE html>\n<html lang=\"ar\" dir=\"rtl\">\n<head>\n<meta charset=\"UTF-8\">\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n<meta name=\"theme-color\" content=\"#37a495\">\n<meta name=\"author\" content=\"منصة سلة\">\n<meta name=\"robots\" content=\"noindex, follow\">\n<meta name=\"copyright\" content=\"Salla.sa\">\n<title>{title}</title>\n<link rel=\"icon\" type=\"image/png\" href=\"https://cdn.salla.network/images/logo/logo-square.png\">\n<link rel=\"apple-touch-icon-precomposed\" href=\"https://cdn.salla.network/images/logo/logo-square.png\">\n<link rel=\"stylesheet\" href=\"https://cdn.salla.network/fonts/pingarlt.css?v=0.2\">\n<link rel=\"stylesheet\" href=\"https://cdn.assets.salla.network/prod/stores/vendor/salla/errors/css/app.css?id=0d7e71fbf018a0d5c478129a56c7a71f\">\n</head>\n<body class=\"body body--rtl body--bg iframe-embed\">\n<header id=\"header\" class=\"header header--404\"></header>\n<main id=\"main\" class=\"main main--404\">\n<div class=\"container container--wide\">\n<div class=\"e404-container\">\n<div class=\"landing\">\n<h1 class=\"title title--giant title--404\"><img src=\"https://cdn.assets.salla.network/prod/stores/vendor/salla/errors/images/error.svg\" alt=\"\"/> 410</h1>\n<h3>{title}</h3>\n<p>{message}<br> بإمكانك العودة للصفحة لرئيسية أو التسجيل للتمتع بمتجر رائع!</p>\n<a href=\"https://s.salla.sa/register\">سجل متجرك الأن</a>\n</div>\n</div>\n<div class=\"form-group msg-container\"></div>\n</div>\n</main>\n<footer id=\"footer\" class=\"footer\"></footer>\n</body>\n</html>\n`;\n\n/** Twig's 410 page for `kind`. */\nexport function storeNotFoundPage(kind: StoreNotFoundKind): string {\n const { title, message } = COPY[kind];\n return PAGE.replaceAll('{title}', title).replace('{message}', message);\n}\n\n/** {@link storeNotFoundPage} as Twig sends it: a 410 that no cache keeps. */\nexport function storeNotFoundResponse(kind: StoreNotFoundKind): Response {\n return new Response(storeNotFoundPage(kind), {\n status: 410,\n headers: {\n 'content-type': 'text/html; charset=UTF-8',\n 'cache-control': 'max-age=0, must-revalidate, no-cache, no-store, private',\n },\n });\n}\n","import type { AnyRequestMiddleware } from '@tanstack/react-start';\nimport { createMiddleware } from '@tanstack/react-start';\nimport {\n extractTokenFromCookies,\n resolveAddressedStore,\n resolveRequestScope,\n resolveRequestVersionId,\n AUTH_TOKEN_COOKIE_NAME,\n STORE_BASE_HEADER,\n} from '../../utils/cookies';\nimport { getTwilightContext, runWithTwilightContext } from '../../twilight/context';\nimport { requestHostOf } from '../../utils/request-host';\nimport { legacyLocaleRedirectHref } from '../../utils/store-base';\nimport { readNativeAppHeaders } from '../../utils/native-app-headers';\nimport { storeNotFoundResponse } from './store-not-found';\n\n/**\n * A 503 for the maintenance page, so search engines read it as temporary and keep\n * the store indexed. TanStack sets the SSR status from the router alone (200, 404,\n * 500) and ignores `setResponseStatus`, so the status is applied here, on the\n * response the render produced, from the decision `rootBeforeLoad` left in the\n * request context. Only a 200 is rewritten: a redirect or an error keeps its own.\n *\n * `next()` resolves to the middleware context, whose `response` is the render; a\n * bare `Response` is accepted too. The rewrite keeps the body stream, so TanStack\n * treats it as the same response rather than a replacement to cancel.\n */\nexport function withMaintenanceStatus<T>(result: T): T | Response {\n const response =\n result instanceof Response\n ? result\n : (result as { response?: unknown } | null)?.response instanceof Response\n ? ((result as { response: Response }).response as Response)\n : null;\n if (!response || response.status !== 200 || !getTwilightContext().maintenance) return result;\n const unavailable = new Response(response.body, {\n status: 503,\n statusText: 'Service Unavailable',\n headers: response.headers,\n });\n return result instanceof Response ? unavailable : { ...result, response: unavailable };\n}\n\n/**\n * Twig's 410 page in place of the render, once rootBeforeLoad has learned that no store\n * has this request's identifier: there is no store to render, so nothing of it is kept.\n * The page says \"domain\" when the host was the identifier (nothing in the request named\n * a store), as Twig's `checkUsername` does for a host that is not salla.sa.\n *\n * A render that threw is answered the same way. A theme's shell renders even when the\n * root route failed, and one that reads the settings there throws, which h3 would\n * otherwise answer with a bare `{\"status\":500,\"unhandled\":true}`.\n */\nexport function withStoreNotFoundPage<T>(result: T): T | Response {\n if (!getTwilightContext().storeNotFound) return result;\n const page = storeNotFoundAnswer();\n const carried = (result as { response?: unknown } | null)?.response;\n return carried instanceof Response ? { ...result, response: page } : page;\n}\n\n/** The render's failure, unless {@link withStoreNotFoundPage} has an answer for it. */\nexport function storeNotFoundOrThrow(error: unknown): Response {\n if (getTwilightContext().storeNotFound) return storeNotFoundAnswer();\n throw error;\n}\n\n/** A store the request named (`?storeId=`, a path segment, a username), else the host's. */\nfunction storeNotFoundAnswer(): Response {\n const { storeId, storeBase } = getTwilightContext();\n return storeNotFoundResponse(storeId || storeBase ? 'store' : 'domain');\n}\n\ninterface TwilightMiddlewareOptions {\n cookieName?: string;\n}\n\nexport const twilightMiddleware = (options?: TwilightMiddlewareOptions): AnyRequestMiddleware => {\n const cookieName = options?.cookieName ?? AUTH_TOKEN_COOKIE_NAME;\n\n return createMiddleware().server(async ({ request, next }) => {\n const cookieHeader = request.headers.get('Cookie');\n const authToken = extractTokenFromCookies(cookieHeader, cookieName);\n // `?scope=` before the cookie: it is how a market is switched (see resolveRequestScope).\n const scope = resolveRequestScope(request.url, cookieHeader);\n const requestHost = requestHostOf(request);\n // Read here and nowhere else: a deployed theme worker has no vars and no\n // bindings, so the request is the only thing that knows which store it is\n // serving. Everything downstream reads it off the context rather than\n // reaching for a build-time constant that is not there in production.\n //\n // The host goes in because it decides whether the request is allowed to name\n // a store at all. On a merchant's own domain it is not: the hostname is the\n // store, and `?storeId=` there would serve a stranger's shop from a domain\n // its owner controls.\n //\n // On those same hosts the store is also the first segment of the path, the\n // root of every URL there, and a store named that way takes the cookie's\n // place: the path is the address the visitor can see.\n //\n // On a Salla shared host the dispatcher names the store instead, from the\n // segment after the locale, and that is where it stays in every URL.\n const { storeId, storeBase, storeBaseFollowsLocale } = resolveAddressedStore(\n request.url,\n cookieHeader,\n requestHost,\n request.headers.get(STORE_BASE_HEADER)\n );\n // The version is read here for the same reason and behind the same gate. A\n // theme editor previews a draft version of a merchant's settings before it is\n // published, and a partner running the theme locally renders against one —\n // both open the storefront in an iframe and say which version in the URL.\n const versionId = resolveRequestVersionId(request.url, cookieHeader, requestHost);\n const nativeAppHeaders = readNativeAppHeaders(request.headers);\n\n // A shared host's address has no language in it any more: `/dev-x/cart`, not\n // `/ar/dev-x/cart`. An old link is sent to the new one once, keeping its language as\n // `?lang=`. Only a page load is redirected; anything else is answered as asked.\n if (\n storeBase &&\n storeBaseFollowsLocale &&\n (request.method === 'GET' || request.method === 'HEAD')\n ) {\n const location = legacyLocaleRedirectHref(request.url, storeBase);\n if (location) return new Response(null, { status: 302, headers: { Location: location } });\n }\n\n const response = await runWithTwilightContext(\n {\n authToken,\n scope,\n storeId,\n storeBase,\n storeBaseFollowsLocale,\n versionId,\n requestHost,\n nativeAppHeaders,\n },\n () => {\n const result = next({ context: { authToken } });\n const settle = <R>(rendered: R) => withMaintenanceStatus(withStoreNotFoundPage(rendered));\n // The continuation stays in this request's scope: it was registered inside `run`.\n return result instanceof Promise\n ? result.then(settle, storeNotFoundOrThrow)\n : settle(result);\n }\n );\n // On a shared host the same URL is answered in the language the `s-lang` cookie names, so\n // a cache in front of the worker must not serve one visitor's page to another.\n return storeBaseFollowsLocale ? varyOnCookie(response) : response;\n });\n};\n\n/** A copy of `response` with `Vary: Cookie` added (the original's headers may be immutable). */\nfunction withVaryCookie(response: Response): Response {\n const headers = new Headers(response.headers);\n headers.append('Vary', 'Cookie');\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers,\n });\n}\n\n/**\n * Adds `Vary: Cookie` to what `next()` produced: its result carries the page's `response`,\n * and a middleware may also pass a bare `Response` through. Anything else is left as it is.\n */\nfunction varyOnCookie<T>(result: T): T {\n if (result instanceof Response) return withVaryCookie(result) as T;\n const carried = (result as { response?: unknown } | null)?.response;\n if (carried instanceof Response) {\n (result as { response: Response }).response = withVaryCookie(carried);\n }\n return result;\n}\n","import type { AnyRequestMiddleware } from '@tanstack/react-start';\nimport { createMiddleware } from '@tanstack/react-start';\nimport { tsrStartManifest } from 'tanstack-start-manifest:v';\nimport { rootHead } from '../../routes/root/head';\n\n/** Known critical assets that should always be preloaded */\nconst CRITICAL_ASSETS = [\n { rel: 'preconnect', href: 'https://api.salla.dev' },\n { rel: 'preconnect', href: 'https://cdn.salla.sa' },\n { rel: 'preconnect', href: 'https://cdn.assets.salla.network', crossOrigin: 'anonymous' },\n { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossOrigin: 'anonymous' },\n] as const;\n\n/** Extract locale from URL path (e.g., /ar/products → 'ar') */\nfunction extractLocale(url: string): string | undefined {\n const match = url.match(/^\\/([a-z]{2})(\\/|$)/);\n return match?.[1];\n}\n\n/** Build Link header value from a link descriptor */\nfunction buildLinkHeader(link: Record<string, unknown>): string | null {\n const href = link.href as string | undefined;\n const rel = link.rel as string | undefined;\n if (!href || !rel) return null;\n\n // Skip print-media stylesheets (already non-blocking)\n if (rel === 'stylesheet') {\n const media = link.media as string | undefined;\n if (media === 'print') return null;\n return `<${href}>; rel=preload; as=style`;\n }\n\n if (rel === 'preload') {\n const asType = link.as as string | undefined;\n if (!asType) return null;\n const parts = [`<${href}>`, 'rel=preload', `as=${asType}`];\n if (asType === 'font' || link.crossOrigin) {\n parts.push('crossorigin');\n }\n return parts.join('; ');\n }\n\n if (rel === 'modulepreload') {\n return `<${href}>; rel=modulepreload`;\n }\n\n return null;\n}\n\nexport const earlyHintsMiddleware = (): AnyRequestMiddleware => {\n let cachedManifestPaths: string[] | null = null;\n\n return createMiddleware().server(async ({ request, next }) => {\n const response = await next();\n\n const accept = request.headers.get('Accept') ?? '';\n if (!accept.includes('text/html') && accept !== '*/*') return response;\n if (!(response instanceof Response)) return response;\n\n const linkHeaders: string[] = [];\n\n // 1. Add critical assets from rootHead (fonts, icons, SDK, etc.)\n try {\n const url = new URL(request.url);\n const locale = extractLocale(url.pathname);\n if (locale) {\n const headResult = rootHead({ params: { locale } });\n const links = (headResult.links as Record<string, unknown>[]) ?? [];\n for (const link of links) {\n const header = buildLinkHeader(link);\n if (header) linkHeaders.push(header);\n }\n }\n } catch (e) {\n // rootHead failed — log why, then fall back to known critical assets\n console.warn('[earlyHints] rootHead failed:', e instanceof Error ? e.message : e);\n for (const asset of CRITICAL_ASSETS) {\n const co = 'crossOrigin' in asset ? asset.crossOrigin : undefined;\n linkHeaders.push(`<${asset.href}>; rel=${asset.rel}${co ? '; crossorigin' : ''}`);\n }\n }\n\n // 2. Add CSS from TanStack Start manifest (bundled theme CSS)\n if (!cachedManifestPaths) {\n try {\n const manifest = tsrStartManifest();\n const rootAssets = manifest.routes['__root__']?.assets ?? [];\n const seen = new Set<string>();\n cachedManifestPaths = [];\n for (const asset of rootAssets) {\n if (asset.tag === 'link' && asset.attrs?.href?.endsWith('.css')) {\n if (!seen.has(asset.attrs.href)) {\n seen.add(asset.attrs.href);\n cachedManifestPaths.push(asset.attrs.href);\n }\n }\n }\n } catch (e) {\n // manifest not available — skip\n console.warn('[earlyHints] tsrStartManifest failed:', e instanceof Error ? e.message : e);\n }\n }\n\n if (cachedManifestPaths) {\n for (const href of cachedManifestPaths) {\n linkHeaders.push(`<${href}>; rel=preload; as=style`);\n }\n }\n\n // Apply Link headers if we have any\n if (linkHeaders.length === 0) {\n console.warn('[earlyHints] no critical assets found — no Link headers added');\n return response;\n }\n\n const headers = new Headers(response.headers);\n for (const linkHeader of linkHeaders) {\n headers.append('Link', linkHeader);\n }\n\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers,\n });\n });\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/twilight-theme-engine",
3
- "version": "1.0.112",
3
+ "version": "1.0.113",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,14 +0,0 @@
1
- import { lazy } from 'react';
2
-
3
- // src/components/cart/lazy.ts
4
- var LazyCartItem = lazy(() => import('./CartItem-PEZFT565.js').then((m) => ({ default: m.CartItem })));
5
- var LazyCartSummary = lazy(
6
- () => import('./CartSummary-CKYQASQD.js').then((m) => ({ default: m.CartSummary }))
7
- );
8
- var LazySeoCartWidget = lazy(
9
- () => import('./SeoCartWidget-WV4KPH2S.js').then((m) => ({ default: m.SeoCartWidget }))
10
- );
11
-
12
- export { LazyCartItem, LazyCartSummary, LazySeoCartWidget };
13
- //# sourceMappingURL=chunk-2BBIVHKI.js.map
14
- //# sourceMappingURL=chunk-2BBIVHKI.js.map