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(compat): inject Node globals #12342

Merged
merged 6 commits into from
Oct 6, 2021

Conversation

bartlomieju
Copy link
Member

@bartlomieju bartlomieju commented Oct 6, 2021

This commit adds automatic injection of Node globals when "--compat" flag
is present.

This is done by executing "https://deno.land/std/node/global.ts" as a "side module",
before main module is executed.

This commit makes "--compat" required to be used with "--unstable" flag, as some
of Node globals require unstable Deno APIs.

Towards #12295

@bartlomieju
Copy link
Member Author

bartlomieju commented Oct 6, 2021

This works fine with JS files, but fails type checking for TS files. I need to somehow tell TSC that this file is already in scope.

Nevermind, @kitsonk helped me figure this out.

@bartlomieju bartlomieju mentioned this pull request Oct 6, 2021
7 tasks
@bartlomieju bartlomieju requested review from ry and kitsonk October 6, 2021 03:41
Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bartlomieju bartlomieju merged commit b686907 into denoland:main Oct 6, 2021
bartlomieju added a commit to bartlomieju/deno that referenced this pull request Oct 10, 2021
This commit adds automatic injection of Node globals when "--compat" flag
is present.

This is done by executing "https://deno.land/std/node/global.ts" as a "side module",
before main module is executed.

This commit makes "--compat" required to be used with "--unstable" flag, as some
of Node globals require unstable Deno APIs.
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