graphql-js icon indicating copy to clipboard operation
graphql-js copied to clipboard

fix: remove `globalThis` check and align with what bundlers can accept

Open JoviDeCroock opened this issue 1 year ago • 3 comments

As surfaced in Discord this currently is a breaking change in the 16.x.x release line which is preventing folks from upgrading towards a security fix. This PR should result in a patch release on the 16 release line.

This change was originally introduced to support CFW and browser environments which should still be supported with the typeof check CC @n1ru4l

This also adds a check whether .env is present as in the DOM using id="process" defines that as a global which we don't want to access on accident. as shown in https://github.com/graphql/graphql-js/pull/4017

Bundles also target process.env.NODE_ENV specifically which fails when it replaces globalThis.process.env.NODE_ENV as this becomes globalThis."production" which is invalid syntax.

Fixes https://github.com/graphql/graphql-js/issues/3978 Fixes https://github.com/graphql/graphql-js/issues/3918 Fixes https://github.com/graphql/graphql-js/issues/3758

This purposefully does not account for https://github.com/graphql/graphql-js/issues/3925 as we can't address this without breaking CF/plain browsers so the small byte-size increase will be expected for bundled browser environments. As a middle ground we did optimise the performance here. We can revisit this for v17

Supersedes https://github.com/graphql/graphql-js/pull/4021 Supersedes https://github.com/graphql/graphql-js/pull/4019 Supersedes https://github.com/graphql/graphql-js/pull/3927

JoviDeCroock avatar Feb 14 '24 13:02 JoviDeCroock

Hi @JoviDeCroock, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

github-actions[bot] avatar Feb 14 '24 13:02 github-actions[bot]

CC @graphql/graphql-js-reviewers

JoviDeCroock avatar Apr 14 '24 14:04 JoviDeCroock

CI is failing with a rate limit issue, I can't force a retry 😅

JoviDeCroock avatar May 29 '24 19:05 JoviDeCroock

Love love love the documentation page; excellent work! :raised_hands:

benjie avatar Jun 04 '24 14:06 benjie