diff --git a/patches/rrweb@2.0.0-alpha.13.patch b/patches/rrweb@2.0.0-alpha.13.patch index 26b8a6cd262fb..a4931ad085a20 100644 --- a/patches/rrweb@2.0.0-alpha.13.patch +++ b/patches/rrweb@2.0.0-alpha.13.patch @@ -489,41 +489,65 @@ index 0d49411b1f6d31103bed898c0e81d1d74ab51234..0b2160ef08aa3ae5310f63c295abc0a5 } applyMutation(d, isSync) { diff --git a/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js b/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js -index 38a23aaae8d683fa584329eced277dd8de55d1ff..44efee95395f6612204e051724a108833741a492 100644 +index 38a23aaae8d683fa584329eced277dd8de55d1ff..1090307f2974c2eb6259d650fd02ef2e2c40e790 100644 --- a/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +++ b/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js -@@ -1271,15 +1271,22 @@ function parse(css, options = {}) { - .replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, (m) => { - return m.replace(/,/g, '\u200C'); +@@ -1255,54 +1255,15 @@ function parse(css, options = {}) { }); -- return customSplit(cleanedInput).map((s) => s.replace(/\u200C/g, ',').trim()); -+ return cleanedInput.split(/\s*(?![^(]*\)),\s*/).map((s) => s.replace(/\u200C/g, ',').trim()); } - function customSplit(input) { - const result = []; - let currentSegment = ''; - let depthParentheses = 0; - let depthBrackets = 0; -+ let currentStringChar = null; - for (const char of input) { + function selector() { +- whitespace(); +- while (css[0] == '}') { +- error('extra closing bracket'); +- css = css.slice(1); +- whitespace(); +- } +- const m = match(/^(("(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^{])+)/); ++ const m = match(/^([^{]+)/); + if (!m) { + return; + } +- const cleanedInput = m[0] +- .trim() ++ return trim(m[0]) + .replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '') + .replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, (m) => { +- return m.replace(/,/g, '\u200C'); +- }); +- return customSplit(cleanedInput).map((s) => s.replace(/\u200C/g, ',').trim()); +- } +- function customSplit(input) { +- const result = []; +- let currentSegment = ''; +- let depthParentheses = 0; +- let depthBrackets = 0; +- for (const char of input) { - if (char === '(') { -+ const hasStringEscape = currentSegment.endsWith('\\'); -+ if (currentStringChar) { -+ if (currentStringChar === char && !hasStringEscape) { -+ currentStringChar = null; -+ } -+ } -+ else if (char === '(') { - depthParentheses++; - } - else if (char === ')') { -@@ -1291,6 +1298,9 @@ function parse(css, options = {}) { - else if (char === ']') { - depthBrackets--; - } -+ else if ('\'"'.includes(char)) { -+ currentStringChar = char; -+ } - if (char === ',' && depthParentheses === 0 && depthBrackets === 0) { - result.push(currentSegment); - currentSegment = ''; +- depthParentheses++; +- } +- else if (char === ')') { +- depthParentheses--; +- } +- else if (char === '[') { +- depthBrackets++; +- } +- else if (char === ']') { +- depthBrackets--; +- } +- if (char === ',' && depthParentheses === 0 && depthBrackets === 0) { +- result.push(currentSegment); +- currentSegment = ''; +- } +- else { +- currentSegment += char; +- } +- } +- if (currentSegment) { +- result.push(currentSegment); +- } +- return result; ++ return m.replace(/,/g, '\u200C'); ++ }); + } + function declaration() { + const pos = position(); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0df3d13eaf730..b777970699e71 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,7 +12,7 @@ patchedDependencies: hash: gydrxrztd4ruyhouu6tu7zh43e path: patches/heatmap.js@2.0.5.patch rrweb@2.0.0-alpha.13: - hash: yb2e6fk2apwhhkdrx63qgi45uq + hash: 7hn7wcvbq3pr4fuxwsrydmkjv4 path: patches/rrweb@2.0.0-alpha.13.patch dependencies: @@ -333,7 +333,7 @@ dependencies: version: 1.5.1 rrweb: specifier: 2.0.0-alpha.13 - version: 2.0.0-alpha.13(patch_hash=yb2e6fk2apwhhkdrx63qgi45uq) + version: 2.0.0-alpha.13(patch_hash=7hn7wcvbq3pr4fuxwsrydmkjv4) sass: specifier: ^1.26.2 version: 1.56.0 @@ -19277,7 +19277,7 @@ packages: resolution: {integrity: sha512-slbhNBCYjxLGCeH95a67ECCy5a22nloXp1F5wF7DCzUNw80FN7tF9Lef1sRGLNo32g3mNqTc2sWLATlKejMxYw==} dev: false - /rrweb@2.0.0-alpha.13(patch_hash=yb2e6fk2apwhhkdrx63qgi45uq): + /rrweb@2.0.0-alpha.13(patch_hash=7hn7wcvbq3pr4fuxwsrydmkjv4): resolution: {integrity: sha512-a8GXOCnzWHNaVZPa7hsrLZtNZ3CGjiL+YrkpLo0TfmxGLhjNZbWY2r7pE06p+FcjFNlgUVTmFrSJbK3kO7yxvw==} dependencies: '@rrweb/types': 2.0.0-alpha.13