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

feat(parse5): use string types for node names #631

Merged
merged 1 commit into from Aug 4, 2022

Conversation

43081j
Copy link
Collaborator

@43081j 43081j commented Jul 28, 2022

This was initially to change NodeType into a union, but that doesn't make sense since we wouldn't make use of the type then, we'd just use the string literal types anyway.

Nothing references NodeType outside the tree adapter and it isn't exported publicly (index.ts) currently.

So instead i just dropped NodeType and used a string literal type for each node type.

@fb55 what do you think? this matches how it was originally (pre-rewrite) and allows people to create nodes without pulling the (currently not exported afaict) enum in.

if anyone wants the type union, they can do Node['nodeName'], which we could alias into NodeType if its still of any use

@43081j 43081j requested review from fb55 and wooorm July 28, 2022 18:47
@43081j
Copy link
Collaborator Author

43081j commented Aug 2, 2022

@fb55 similarly, we can't get at DOCUMENT_MODE and NS for these cases:

edit:

ignore me, those two are exported!

import {html} from 'parse5';

// html.NS
// html.DOCUMENT_MODE

all good on that

Copy link
Collaborator

@fb55 fb55 left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@43081j 43081j merged commit 0f11697 into inikulin:master Aug 4, 2022
@43081j 43081j deleted the string-types branch August 4, 2022 13:46
@43081j
Copy link
Collaborator Author

43081j commented Aug 8, 2022

@fb55 any chance you could prep a release for this? im not sure what process you've been following so probably better you cut it

@fb55
Copy link
Collaborator

fb55 commented Aug 15, 2022

I tried to publish a new release yesterday and didn't remember exactly what I did. Will try to figure things out next weekend, and document it for future releases.

@fb55
Copy link
Collaborator

fb55 commented Sep 2, 2022

After pushing this in front of me for a while, I've now published parse5@7.1.0. Sorry for the delay!

The other modules didn't change, so no need to publish new versions for them. This also allowed me to not reproduce the npm --workspaces magic that I used the first time.

@fb55
Copy link
Collaborator

fb55 commented Sep 2, 2022

Turns out that I did forget one thing, and that is opening a PR with the version bump before publishing. Opened #662 with the change.

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.

None yet

2 participants