Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

Deprecate process and Buffer globals when not in CJS #5

Closed
wants to merge 1 commit into from

Conversation

guybedford
Copy link
Contributor

Currently in ES modules we have the process and Buffer globals exactly as Node.js currently provides. This PR provides a deprecation path for these globals by only supporting them in CJS through a global proxy approach.

Most tests are passing, but this is still a work-in-progress. Opening early so we can start to discuss this.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

ljharb

This comment was marked as off-topic.

mcollina

This comment was marked as off-topic.

@guybedford
Copy link
Contributor Author

@mcollina is there a generic benchmark you would suggest trying here?

@ljharb
Copy link
Member

ljharb commented Aug 29, 2018

I think the globals should be the same everywhere, as porting code between the two module system should be as straightforward as possible.

This is a pretty strong point.

Introducing ESM should probably not be leveraged as an opportunity to "fix" things that need fixing in CJS anyways. In general, either we fix it in CJS, or we don't fix it in ESM.

devsnek

This comment was marked as off-topic.

devsnek

This comment was marked as off-topic.

@zenparsing
Copy link

Thanks @guybedford for opening a conversation on this - I agree with others that, as a design principle, we should probably stay focused on the one goal of supporting ESM in Node, and put other things to the side.

I would personally make the stronger claim that it's a non-goal to make the ESM-in-Node environment substitutable with a browser ESM environment.

@guybedford
Copy link
Contributor Author

Ok, agreed, and thanks for feedback.

@guybedford guybedford closed this Aug 29, 2018
@guybedford guybedford deleted the deprecate-globals branch August 29, 2018 17:55
@guybedford
Copy link
Contributor Author

@zenparsing it is important to clearly define what we mean by "substitutable". To ignore that these decisions affect browsers is to ignore the wider consequences of our decisions, and taking such a stance is not an option in my opinion.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants