Skip to content

ENH Add a check for the browser shim of process when determining if the runtime is Node#2010

Merged
rth merged 3 commits intopyodide:mainfrom
bartbroere:patch-1
Dec 2, 2021
Merged

ENH Add a check for the browser shim of process when determining if the runtime is Node#2010
rth merged 3 commits intopyodide:mainfrom
bartbroere:patch-1

Conversation

@bartbroere
Copy link
Copy Markdown
Contributor

@bartbroere bartbroere commented Nov 30, 2021

Description

There's a browser shim for process, in which case we don't want to set IN_NODE to true.

From: https://www.npmjs.com/package/process

It also exposes a "browser" member (i.e. process.browser) which is true in this implementation but undefined in node. This can be used in isomorphic code that adjusts it's behavior depending on which environment it's running in.

This fixes that packages like starboard-notebook have to patch pyodide at install time.

@bartbroere bartbroere changed the title Add a check for the browser shim of process Add a check for the browser shim of process when determining if the runtime is Node Nov 30, 2021
@rth
Copy link
Copy Markdown
Member

rth commented Nov 30, 2021

Thanks! Please remove the checklist entries in your issue description if you don't plan to add them. I think this is probably fine without a test.

Generally LGTM.

@bartbroere
Copy link
Copy Markdown
Contributor Author

Thanks! Please remove the checklist entries in your issue description if you don't plan to add them. I think this is probably fine without a test.

Generally LGTM.

Cool! Thanks for the reply; I removed the checklist.

@bartbroere
Copy link
Copy Markdown
Contributor Author

Could this be merged perhaps, despite the timed out and therefore failed build? It would help the starboard-notebook project quite a bit if it doesn't have to patch the pyodide package after installation. I'm hoping this fix gets in the next pyodide release.

Copy link
Copy Markdown
Member

@rth rth left a comment

Choose a reason for hiding this comment

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

Sure, that works, thanks! The CI failure is due to #2013

@rth rth changed the title Add a check for the browser shim of process when determining if the runtime is Node ENH Add a check for the browser shim of process when determining if the runtime is Node Dec 2, 2021
@rth rth merged commit d2c6eca into pyodide:main Dec 2, 2021
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