Files
klz-cables.com/.pnpm-store/v10/files/63/2d23aab01b3ad6af0decaf9cc8c5d9f92ee711273df6d3683c67e122d36e0c0f8e878609b90329002557c30e5288727435520121708ba918e8d4661d0dddd7
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

1 line
2.4 KiB
Plaintext

{"version":3,"file":"randomSafeContext.js","sources":["../../../src/utils/randomSafeContext.ts"],"sourcesContent":["import { GLOBAL_OBJ } from './worldwide';\n\nexport type RandomSafeContextRunner = <T>(callback: () => T) => T;\n\n// undefined = not yet resolved, null = no runner found, function = runner found\nlet RESOLVED_RUNNER: RandomSafeContextRunner | null | undefined;\n\n/**\n * Simple wrapper that allows SDKs to *secretly* set context wrapper to generate safe random IDs in cache components contexts\n */\nexport function withRandomSafeContext<T>(cb: () => T): T {\n // Skips future symbol lookups if we've already resolved (or attempted to resolve) the runner once\n if (RESOLVED_RUNNER !== undefined) {\n return RESOLVED_RUNNER ? RESOLVED_RUNNER(cb) : cb();\n }\n\n const sym = Symbol.for('__SENTRY_SAFE_RANDOM_ID_WRAPPER__');\n const globalWithSymbol: typeof GLOBAL_OBJ & { [sym]?: RandomSafeContextRunner } = GLOBAL_OBJ;\n\n if (sym in globalWithSymbol && typeof globalWithSymbol[sym] === 'function') {\n RESOLVED_RUNNER = globalWithSymbol[sym];\n return RESOLVED_RUNNER(cb);\n }\n\n RESOLVED_RUNNER = null;\n return cb();\n}\n\n/**\n * Identical to Math.random() but wrapped in withRandomSafeContext\n * to ensure safe random number generation in certain contexts (e.g., Next.js Cache Components).\n */\nexport function safeMathRandom(): number {\n return withRandomSafeContext(() => Math.random());\n}\n\n/**\n * Identical to Date.now() but wrapped in withRandomSafeContext\n * to ensure safe time value generation in certain contexts (e.g., Next.js Cache Components).\n */\nexport function safeDateNow(): number {\n return withRandomSafeContext(() => Date.now());\n}\n"],"names":["GLOBAL_OBJ"],"mappings":";;;;AAIA;AACA,IAAI,eAAe;;AAEnB;AACA;AACA;AACO,SAAS,qBAAqB,CAAI,EAAE,EAAc;AACzD;AACA,EAAE,IAAI,eAAA,KAAoB,SAAS,EAAE;AACrC,IAAI,OAAO,eAAA,GAAkB,eAAe,CAAC,EAAE,CAAA,GAAI,EAAE,EAAE;AACvD,EAAE;;AAEF,EAAE,MAAM,MAAM,MAAM,CAAC,GAAG,CAAC,mCAAmC,CAAC;AAC7D,EAAE,MAAM,gBAAgB,GAA4DA,oBAAU;;AAE9F,EAAE,IAAI,GAAA,IAAO,gBAAA,IAAoB,OAAO,gBAAgB,CAAC,GAAG,CAAA,KAAM,UAAU,EAAE;AAC9E,IAAI,eAAA,GAAkB,gBAAgB,CAAC,GAAG,CAAC;AAC3C,IAAI,OAAO,eAAe,CAAC,EAAE,CAAC;AAC9B,EAAE;;AAEF,EAAE,eAAA,GAAkB,IAAI;AACxB,EAAE,OAAO,EAAE,EAAE;AACb;;AAEA;AACA;AACA;AACA;AACO,SAAS,cAAc,GAAW;AACzC,EAAE,OAAO,qBAAqB,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;AACnD;;AAEA;AACA;AACA;AACA;AACO,SAAS,WAAW,GAAW;AACtC,EAAE,OAAO,qBAAqB,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;AAChD;;;;;;"}