From 4b76836f352988773ee27ec379ca8008ebe5b00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Thu, 11 Apr 2024 18:32:02 +0200 Subject: [PATCH] fix: DomListener has side effects --- rollup/rollup.config.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rollup/rollup.config.ts b/rollup/rollup.config.ts index 2f10d2fb..d61e04ee 100644 --- a/rollup/rollup.config.ts +++ b/rollup/rollup.config.ts @@ -64,6 +64,10 @@ const PURE_FUNCTIONS = new Set([ 'negate' ]) +const SIDE_EFFECT_CONSTRUCTORS = new Set([ + 'DomListener' +]) + const PURE_OR_TO_REMOVE_FUNCTIONS = new Set([ ...PURE_FUNCTIONS ]) @@ -197,7 +201,7 @@ function transformVSCodeCode (id: string, code: string) { }, visitNewExpression (path) { const node = path.node - if (node.callee.type === 'Identifier') { + if (node.callee.type === 'Identifier' && !SIDE_EFFECT_CONSTRUCTORS.has(node.callee.name)) { path.replace(addComment(node)) } this.traverse(path)