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

Update tooling for new IDL and MDN #920

Merged
merged 5 commits into from
Sep 29, 2020
Merged

Update tooling for new IDL and MDN #920

merged 5 commits into from
Sep 29, 2020

Conversation

MattiasBuelens
Copy link
Contributor

This PR updates the tooling around extracting and transforming the IDL and MDN sources to support recent changes to the specifications and MDN.

  • Specifications such as Screen Orientation seem to be using a newer version of the W3C spec template, which now includes a <span class="idlHeader">WebIDL</span> element at the top of every WebIDL block (for example in this block). With the current code, we would naively include this header in the IDL content, which broke the WebIDL parser. We now strip this header when fetching new IDLs.
  • Web IDL has switched from void to undefined, see add a type to represent the undefined value whatwg/webidl#60 and void -> undefined, and allow it anywhere. whatwg/webidl#906. We chose to have a bit of special handling for this, to better match the existing semantics and expectations around TypeScript's void and undefined types:
    • Emit undefined if it appears in a union type, i.e. Element | undefined instead of Element | void.
    • Otherwise we emit void, i.e. void and Promise<void> instead of undefined and Promise<undefined>.
  • When an MDN article for an interface redirects to a different one, we now recognize this as a signal that the interface has been deprecated and should be marked as such in the type definitions.

These tooling changes were extracted from #893, but without the actual updates to the IDL and MDN sources. These sources can be updated in separate PRs, as suggested by @saschanaz.

src/emitter.ts Outdated Show resolved Hide resolved
src/emitter.ts Outdated Show resolved Hide resolved
@orta orta merged commit cf24210 into microsoft:master Sep 29, 2020
@orta
Copy link
Contributor

orta commented Sep 29, 2020

Thanks!

Copy link

@I-Cat I-Cat left a comment

Choose a reason for hiding this comment

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

What is
"pre.idl:not(.extract):not(.example)", // bikeshed and ReSpec
"bikeshed" ?

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.

4 participants