Files
orca/config/scripts/telemetry-bundle-constant-patterns.mjs
T

8 lines
636 B
JavaScript

// The unminified bundle keeps these names. Production minification may rename
// them, but the injected identity and key remain adjacent in the declaration.
export const BUILD_IDENTITY_RE = /\b(?:const|let|var)\s+BUILD_IDENTITY\s*=\s*["`](rc|stable)["`]/
export const WRITE_KEY_RE = /\b(?:const|let|var)\s+WRITE_KEY\s*=\s*["`](phc_[A-Za-z0-9_-]+)["`]/
// Why the `,` alternative: the identity can be a later declarator in a shared `var` (`var a=!0,b=\`stable\``).
export const MINIFIED_TELEMETRY_RE =
/(?:\b(?:const|let|var)\s+|,\s*)[$\w]+\s*=\s*["'`](rc|stable)["'`][\s\S]{0,200}?[,$]\s*[$\w]+\s*=\s*["'`](phc_[A-Za-z0-9_-]+)["'`]/