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

Sunset UMD support #514

Closed
saschanaz opened this issue Nov 29, 2020 · 5 comments
Closed

Sunset UMD support #514

saschanaz opened this issue Nov 29, 2020 · 5 comments

Comments

@saschanaz
Copy link
Member

saschanaz commented Nov 29, 2020

Node.js 15.3.0 marked ESM support as stable. Since Node.js and browsers have supported ESM for years (with two Node.js LTS versions), it should be okay to sunset the UMD one.

See also #494

@saschanaz
Copy link
Member Author

Hey @foolip, would this be okay for WPT and the BCD collector?

@foolip
Copy link
Member

foolip commented Feb 20, 2021

I'm sure I can adapt mdn-bcd-collector to whatever the change is, but for WPT I'm not sure. Will the generated script we use be different in some way?

@saschanaz
Copy link
Member Author

saschanaz commented Feb 20, 2021

Yeah, sunsetting UMD will force the consumers to use ES module instead. For Node.js I guess it hopefully shouldn't be a breaking change unless anyone is still using pre-module version of Node.js (... that is Node 12, which still is an active LTS. 🤔), but in browsers <script module> will be required. The simplest way would be:

- <script src=/resources/WebIDLParser.js></script>
+ <script module>
+ import * as WebIDL2 from "/resources/webidl2/lib/webidl2.js";
+ globalThis.WebIDL2 = WebIDL2;
+ </script>

All targets of WPT support <script module> by now, right?

Edit:

Will the generated script we use be different in some way?

I think I misunderstood this. The API and its output shouldn't change.

@foolip
Copy link
Member

foolip commented Feb 21, 2021

<script type=module> is supported in all browsers that we run WPT on and I do see it used elsewhere in WPT. I expect it would be a fair amount of work since there's a mix of handwritten and generated idlharness.js tests, so I expect we'd just not upgrade until a new webidl2.js release is absolutely required.

@saschanaz
Copy link
Member Author

This isn't doable without a serious breaking change since require() in Node.js cannot import ESM. CommonJS use is still allowed with #565 and it will be kept that way at least in the foreseeable future.

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

No branches or pull requests

2 participants