FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Don't expose loadPyodide as global variable from ES6 module by hoodmane · Pull Request #2249 · pyodide/pyodide · GitHub

Don't expose loadPyodide as global variable from ES6 module - #2249

Merged
hoodmane merged 8 commits into
pyodide:mainfrom
hoodmane:es6-module-no-global
Mar 16, 2022
Merged

Don't expose loadPyodide as global variable from ES6 module#2249
hoodmane merged 8 commits into
pyodide:mainfrom
hoodmane:es6-module-no-global

Conversation

hoodmane commented Mar 3, 2022

Copy link
Copy Markdown
Member

No description provided.

hoodmane force-pushed the es6-module-no-global branch from fdc2a1b to 2a8d8fd Compare March 3, 2022 05:40

Copy link
Copy Markdown
Member Author

@alexmojaki @leopsidom @ryanking13 could someone review this? I have a plan to fix #2255 but I would prefer to merge this first.

ryanking13 left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks, @hoodmane, LGTM and sorry for the late review. Please update the changelog.

Copy link
Copy Markdown
Contributor

Ideally it feels more natural to let rollup handle different target with the same input. But since we have a preference to use loadPyodide as global, this LGTM.

Comment thread src/js/pyodide.umd.ts
@@ -0,0 +1,3 @@
import { loadPyodide } from "./pyodide";
export { loadPyodide };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think we don't need to export loadPyodide if we are attaching it to global.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'm not even sure what export does for umd, but this is redundant.

Copy link
Copy Markdown
Member Author

Ideally it feels more natural to let rollup handle different target with the same input. But since we have a preference to use loadPyodide as global, this LGTM.

Can you explain what you mean? I think we discussed this before but I'm still not sure what the alternative looks like.

Copy link
Copy Markdown
Member Author

In particular, we want the non-es6 pyodide.js to be loadable in a <script> tag, where I think there is no option except to attach loadPyodide as a global?

Copy link
Copy Markdown
Contributor

Can you explain what you mean? I think we discussed this before but I'm still not sure what the alternative looks like.

Yeah, it might be a while ago. But I think if default to rollup config, the alternative is to give the global object a name such as pyodide and then reference loadPyodide from it as pyodide.loadPyodide.

Copy link
Copy Markdown
Contributor

In particular, we want the non-es6 pyodide.js to be loadable in a <script> tag, where I think there is no option except to attach loadPyodide as a global?

With current implementation, it's possible to use pyodide.loadPyodide if we do not attach loadPyodide to global. But we need to change the name in rollup config to pyodide.

Copy link
Copy Markdown
Contributor

But since you are looking to fix this issue: #2255. It's likely there will be some changes made to the API. So it makes more sense to consolidate it over there.

Copy link
Copy Markdown
Member Author

Right, well as I said before, I don't love having to call it pyodide.loadPyodide. Maybe we should just leave the global variable in the umd file and encourage people to use the es6 module.

hoodmane merged commit 245e8e7 into pyodide:main Mar 16, 2022
hoodmane deleted the es6-module-no-global branch March 16, 2022 01:59

Copy link
Copy Markdown
Member Author

Thanks for the reviews @leopsidom and @ryanking13!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL