Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for Next.JS edge runtime #136

Merged
merged 3 commits into from
Sep 12, 2024
Merged

feat: add support for Next.JS edge runtime #136

merged 3 commits into from
Sep 12, 2024

Conversation

snyamathi
Copy link
Collaborator

Next.JS middleware's Edge Runtime has a proxy over the Object and Array making some of the type checks invalid in that environment invalid. This PR fixes that in a backward compatible way.

The existing tests are run in the default environment and then again in a posttest step with a (loosely) simulated edge runtime where Object and Array are proxied.

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@redonkulus
Copy link
Collaborator

Should we add a test case for this?

@snyamathi
Copy link
Collaborator Author

I'm re-using all of the existing test cases with

"posttest": "node -r ./tests/edgeRuntime.js ./node_modules/.bin/mocha tests/unit --recursive --reporter spec"

which runs the full test suite after patching the global Object and Array with Proxy. If you were to run that tests without the fix, it errors.

@snyamathi snyamathi merged commit 7abffb5 into main Sep 12, 2024
2 checks passed
@snyamathi snyamathi deleted the ipo branch September 12, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants