@@ -11,7 +11,7 @@ module.exports = {
11
11
return {
12
12
ObjectExpression ( node ) {
13
13
// Not adding __proto__ to module.exports as it will break a lot of libraries
14
- if ( isModuleExportsObject ( node ) ) {
14
+ if ( isModuleExportsObject ( node ) || isModifiedExports ( node ) ) {
15
15
return ;
16
16
}
17
17
@@ -97,3 +97,42 @@ function isModuleExportsObject(node) {
97
97
node . parent . left . property . name === 'exports'
98
98
) ;
99
99
}
100
+
101
+ function isModifiedExports ( node ) {
102
+ return (
103
+ node . parent &&
104
+ ( isObjectAssignCall ( node . parent ) || isObjectDefinePropertiesCall ( node . parent ) )
105
+ ) ;
106
+ }
107
+
108
+ // Helper function to check if the node represents an ObjectAssign call
109
+ function isObjectAssignCall ( node ) {
110
+ return (
111
+ node . type === 'CallExpression' &&
112
+ node . callee &&
113
+ node . callee . type === 'Identifier' &&
114
+ node . callee . name === 'ObjectAssign' &&
115
+ node . arguments . length > 1 &&
116
+ node . arguments . some ( arg =>
117
+ arg . type === 'MemberExpression' &&
118
+ arg . object . name === 'module' &&
119
+ arg . property . name === 'exports'
120
+ )
121
+ ) ;
122
+ }
123
+
124
+ // Helper function to check if the node represents an ObjectDefineProperties call
125
+ function isObjectDefinePropertiesCall ( node ) {
126
+ return (
127
+ node . type === 'CallExpression' &&
128
+ node . callee &&
129
+ node . callee . type === 'Identifier' &&
130
+ node . callee . name === 'ObjectDefineProperties' &&
131
+ node . arguments . length > 1 &&
132
+ node . arguments . some ( arg =>
133
+ arg . type === 'MemberExpression' &&
134
+ arg . object . name === 'module' &&
135
+ arg . property . name === 'exports'
136
+ )
137
+ ) ;
138
+ }
0 commit comments