Skip to content

bootstrap: consolidate global properties definition - #43357

Closed
legendecas wants to merge 1 commit into
nodejs:masterfrom
legendecas:global-process
Closed

bootstrap: consolidate global properties definition#43357
legendecas wants to merge 1 commit into
nodejs:masterfrom
legendecas:global-process

Conversation

@legendecas

Copy link
Copy Markdown
Member

globalThis.process and globalThis.Buffer has been re-defined with
a getter/setter pair.

atob and bota are defined as enumerable properties according to
WebIDL definition.

Refs: #26882
Refs: #37786 (comment)

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/startup

@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Jun 9, 2022
@legendecas
legendecas marked this pull request as ready for review June 9, 2022 04:01
@aduh95aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jun 9, 2022
Comment threadlib/internal/bootstrap/node.js Outdated
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 9, 2022
Comment threadlib/internal/bootstrap/node.js Outdated
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment threadlib/internal/bootstrap/node.js Outdated
@legendecaslegendecas added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 10, 2022
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 10, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment threadlib/internal/bootstrap/node.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
// globalThis.process is been installed at `internal/bootstrap/pre_execution.js`.
// globalThis.process will be installed at `internal/bootstrap/pre_execution.js`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But why are we removing these anyway? Removing these results in a breaking change for the embedders, which is why the tests have to be updated.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I was reviewing the installation point of globalThis.process and globalThis.Buffer. It can be more intuitive to install them once rather than duplicate the installation.

It is true that removing can cause breaking changes on embedders with custom entry points. What do you think about moving the actual installation here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the reason that they are overriden in pre_execution is that we thought we were going to make this optional for ESM (probably behind flags), which didn't seem to happen...

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yeah, that's true. From what I could tell, the current shape of the property descriptor is not going to be changed in anytime soon.

@legendecaslegendecas removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 10, 2022
@legendecas
legendecasforce-pushed the global-process branch 2 times, most recently from c64d580 to 39394c2CompareJune 10, 2022 15:07
Comment threadlib/internal/bootstrap/node.js Outdated
`globalThis.process` and `globalThis.Buffer` has been re-defined with
a getter/setter pair.
`atob` and `bota` are defined as enumerable properties according to
WebIDL definition.
@legendecaslegendecas added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 13, 2022
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 13, 2022
@legendecas

Copy link
Copy Markdown
MemberAuthor

Landed in 511e289

legendecas added a commit that referenced this pull request Jun 13, 2022
`globalThis.process` and `globalThis.Buffer` has been re-defined with
a getter/setter pair.
`atob` and `bota` are defined as enumerable properties according to
WebIDL definition.
PR-URL: #43357
Refs: #26882
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@legendecas
legendecas deleted the global-process branch June 13, 2022 16:07
danielleadams pushed a commit that referenced this pull request Jun 14, 2022
`globalThis.process` and `globalThis.Buffer` has been re-defined with
a getter/setter pair.
`atob` and `bota` are defined as enumerable properties according to
WebIDL definition.
PR-URL: #43357
Refs: #26882
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@danielleadamsdanielleadams mentioned this pull request Jun 14, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++Issues and PRs that require attention from people who are familiar with C++.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@legendecas@nodejs-github-bot@lpinca@joyeecheung@aduh95@targos