-
Notifications
You must be signed in to change notification settings - Fork 84
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(feature-detector): introduces findGlobals() utility #234
feat(feature-detector): introduces findGlobals() utility #234
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 353d9a4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
a2d6b9b
to
b709b27
Compare
99c3a61
to
3a4e146
Compare
b699a76
to
9a9013e
Compare
04c847d
to
3e7ee60
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Nice work!
Co-authored-by: Kiko Beats <josefrancisco.verdu@gmail.com>
📖 What's in there?
Second (out of 3) part of the feature detector: returning a list of globals used in a given file.
All global variables, that is, identifiers that are not considered as ES2019 builtins and Edge-runtime globals (AbortController, Request, Response...) will be reported.
🧪 How to test?
Besides unit tests, there's an documented example:
We don't need
patch-type-definition
script any more. The previous solution was pulling to many type definition: we must not load the full DOM types because many of them are not supported in the edge runtime.If we do, TS compiler will not consider
window
to be a global, for example.I couldn't find a way to reuse
@edge-runtime/types
or@edge-runtime/primitives
: they have too much adherence with Node.js types, and it bringing too much for the global detection.This is documented in the type-definition.txt file.
I made a unit test to detect globals in axios. There's a new script to build the test fixture, so axios is bundled as will the user code be. This script should only run manually, when someone needs to change the fixture.
I'm very sorry about this, but I had to disable turbo cache for build scripts. We're getting poisoned built artifacts which are constantly failing the tests.