File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,9 +130,15 @@ function patchInstanceOf(
130130 // @ts -ignore
131131 ctx [ Symbol . for ( `node:${ item } ` ) ] = eval ( item )
132132
133- const shouldPatchPrototype = patchedPrototypes . has ( item )
133+ const patchPrototype = ! patchedPrototypes . has ( item )
134+ ? ''
135+ : `Object.assign(globalThis.${ item } .prototype, {
136+ get constructor() {
137+ return proxy;
138+ }
139+ })`
134140
135- return runInContext (
141+ runInContext (
136142 `
137143 (() => {
138144 const proxy = new Proxy(${ item } , {
@@ -163,16 +169,7 @@ function patchInstanceOf(
163169 })
164170
165171 globalThis.${ item } = proxy;
166-
167- ${
168- ! shouldPatchPrototype
169- ? ''
170- : `Object.assign(globalThis.${ item } .prototype, {
171- get constructor() {
172- return proxy;
173- }
174- })`
175- }
172+ ${ patchPrototype }
176173 })()
177174 ` ,
178175 ctx ,
You can’t perform that action at this time.
0 commit comments