Skip to content

Commit

Permalink
fix: DomListener has side effects
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Mangeonjean committed Apr 11, 2024
1 parent 9990401 commit 291a600
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rollup/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
])
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 291a600

Please sign in to comment.