maticzav / graphql-shield

🛡 A GraphQL tool to ease the creation of permission layer.
https://graphql-shield.com
MIT License
3.55k stars 172 forks source link

fix: Changed judgment of undefined to not use a function #1552

Open chimame opened 4 weeks ago

chimame commented 4 weeks ago

Overview

Changed to not use isUndefined, which is deprecated in Node.js.

Reason for change

As written in the overview, it is deprecated in Node.js. I changed it because it is possible to determine without using it.

Also, this may be a personal opinion, but I use this library with Cloudflare Workers. There are two options to use Node.js API with Cloudflare Workers.

I won't go into detail on how these two options are different, but the only way to make this library work is to use the former node_compat. Because to use the nodejs_compat option, you need to specify node: (node:util in this library) when using the Node.js API.

Initially, I used this library with the node_compat option, but started to migrate to using the nodejs_compat option. However, I noticed that this library cannot be built with the nodejs_compat option. Those are the isUndefined and util in this case. I could have patched it to reference node:util, but when I looked at the Node.js documentation I noticed that it was deprecated, so I submitted a pull request to fix the library.

chimame commented 2 weeks ago

@maticzav ping