From a9508eb01f9e76d40beafca06276a460d7ad81ac Mon Sep 17 00:00:00 2001 From: cy-moi Date: Tue, 18 Nov 2025 17:16:00 +0100 Subject: [PATCH 1/3] Add debug msg --- packages/plugins/rum/src/privacy/index.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/plugins/rum/src/privacy/index.ts b/packages/plugins/rum/src/privacy/index.ts index c43f6a97..fd5d16ef 100644 --- a/packages/plugins/rum/src/privacy/index.ts +++ b/packages/plugins/rum/src/privacy/index.ts @@ -36,7 +36,17 @@ export const getPrivacyPlugin = ( }, handler(code, id) { try { - const result = instrument({ id, code }, transformOptions); + if(this.getInputSourceMap) { + console.log('this keys:', Object.keys(this)); + } + const inputSourceMap = this.getInputSourceMap?.(); + let map = undefined; + if(typeof inputSourceMap !== 'string') { + map = inputSourceMap?.mappings; + } else { + map = inputSourceMap; + } + const result = instrument({ id, code, map }, transformOptions); if (result.privacyDictionarySize === 0) { return { // This should be the same as the result from js-instrumentation-wasm From 077ff2f39e2728b23bf3986c84378a9e4edb2d5d Mon Sep 17 00:00:00 2001 From: cy-moi Date: Wed, 19 Nov 2025 10:57:14 +0100 Subject: [PATCH 2/3] Fix input sourcemaps format --- packages/plugins/rum/src/privacy/index.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/plugins/rum/src/privacy/index.ts b/packages/plugins/rum/src/privacy/index.ts index fd5d16ef..dca17c3c 100644 --- a/packages/plugins/rum/src/privacy/index.ts +++ b/packages/plugins/rum/src/privacy/index.ts @@ -36,13 +36,10 @@ export const getPrivacyPlugin = ( }, handler(code, id) { try { - if(this.getInputSourceMap) { - console.log('this keys:', Object.keys(this)); - } const inputSourceMap = this.getInputSourceMap?.(); - let map = undefined; - if(typeof inputSourceMap !== 'string') { - map = inputSourceMap?.mappings; + let map; + if (typeof inputSourceMap !== 'string') { + map = JSON.stringify(inputSourceMap); } else { map = inputSourceMap; } From a4089d2eb96283f444a6c0f5572a41a605b2c1d2 Mon Sep 17 00:00:00 2001 From: cy-moi Date: Wed, 19 Nov 2025 17:27:13 +0100 Subject: [PATCH 3/3] Improve code --- packages/plugins/rum/src/privacy/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/plugins/rum/src/privacy/index.ts b/packages/plugins/rum/src/privacy/index.ts index dca17c3c..764a9f01 100644 --- a/packages/plugins/rum/src/privacy/index.ts +++ b/packages/plugins/rum/src/privacy/index.ts @@ -37,11 +37,11 @@ export const getPrivacyPlugin = ( handler(code, id) { try { const inputSourceMap = this.getInputSourceMap?.(); - let map; - if (typeof inputSourceMap !== 'string') { - map = JSON.stringify(inputSourceMap); - } else { + let map: string | undefined; + if (typeof inputSourceMap === 'string') { map = inputSourceMap; + } else if (inputSourceMap) { + map = JSON.stringify(inputSourceMap); } const result = instrument({ id, code, map }, transformOptions); if (result.privacyDictionarySize === 0) {