Files
klz-cables.com/.pnpm-store/v10/files/12/d8ba14510a28b3ae5cd20f227efbd48d5f20fe7281eca84bd5152ac2da63918f34982547ed44f8d2154970cdfdf1082bf209b4ac4d9b675c07ba3b9d651db7
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.8 KiB
Plaintext

{"version":3,"file":"valueInjectionLoader.js","sources":["../../../../src/config/loaders/valueInjectionLoader.ts"],"sourcesContent":["// Rollup doesn't like if we put the directive regex as a literal (?). No idea why.\n/* eslint-disable @sentry-internal/sdk/no-regexp-constructor */\n\nimport type { LoaderThis } from './types';\n\nexport type ValueInjectionLoaderOptions = {\n values: Record<string, unknown>;\n};\n\n// We need to be careful not to inject anything before any `\"use strict\";`s or \"use client\"s or really any other directive.\n// As an additional complication directives may come after any number of comments.\n// This regex is shamelessly stolen from: https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/7f984482c73e4284e8b12a08dfedf23b5a82f0af/packages/bundler-plugin-core/src/index.ts#L535-L539\nconst SKIP_COMMENT_AND_DIRECTIVE_REGEX =\n // Note: CodeQL complains that this regex potentially has n^2 runtime. This likely won't affect realistic files.\n new RegExp('^(?:\\\\s*|/\\\\*(?:.|\\\\r|\\\\n)*?\\\\*/|//.*[\\\\n\\\\r])*(?:\"[^\"]*\";?|\\'[^\\']*\\';?)?');\n\n/**\n * Set values on the global/window object at the start of a module.\n *\n * Options:\n * - `values`: An object where the keys correspond to the keys of the global values to set and the values\n * correspond to the values of the values on the global object. Values must be JSON serializable.\n */\nexport default function valueInjectionLoader(this: LoaderThis<ValueInjectionLoaderOptions>, userCode: string): string {\n // We know one or the other will be defined, depending on the version of webpack being used\n const { values } = 'getOptions' in this ? this.getOptions() : this.query;\n\n // We do not want to cache injected values across builds\n this.cacheable(false);\n\n // Not putting any newlines in the generated code will decrease the likelihood of sourcemaps breaking\n const injectedCode =\n // eslint-disable-next-line prefer-template\n ';' +\n Object.entries(values)\n .map(([key, value]) => `globalThis[\"${key}\"] = ${JSON.stringify(value)};`)\n .join('');\n\n return userCode.replace(SKIP_COMMENT_AND_DIRECTIVE_REGEX, match => {\n return match + injectedCode;\n });\n}\n"],"names":[],"mappings":"AASA;AACA;AACA;AACA,MAAM,gCAAA;AACN;AACA,EAAE,IAAI,MAAM,CAAC,4EAA4E,CAAC;;AAE1F;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS,oBAAoB,EAAgD,QAAQ,EAAkB;AACtH;AACA,EAAE,MAAM,EAAE,MAAA,EAAO,GAAI,gBAAgB,IAAA,GAAO,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,KAAK;;AAE1E;AACA,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;;AAEvB;AACA,EAAE,MAAM,YAAA;AACR;AACA,IAAI,GAAA;AACJ,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM;AACzB,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC/E,OAAO,IAAI,CAAC,EAAE,CAAC;;AAEf,EAAE,OAAO,QAAQ,CAAC,OAAO,CAAC,gCAAgC,EAAE,SAAS;AACrE,IAAI,OAAO,KAAA,GAAQ,YAAY;AAC/B,EAAE,CAAC,CAAC;AACJ;;;;"}