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

fix: export ERR as ErrorCodes from error-codes.js #704

Merged
merged 1 commit into from
Oct 21, 2022

Conversation

milahu
Copy link
Contributor

@milahu milahu commented Oct 18, 2022

export error codes

fix #555

#418 (comment)

this breaks rehype/test/parse-error.js in rehypejs/rehype#113

import p5errors from 'parse5/lib/common/error-codes.js'

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/common/error-codes.js' is not defined by "exports" in node_modules/parse5/package.json imported from test/parse-error.js

wontfix in rehype, as ERR is not exported by parse5

→ export as ErrorCodes?

https://nodejs.org/api/esm.html

module files within packages can be accessed by appending a path to the package name unless the package's package.json contains an "exports" field, in which case files within packages can only be accessed via the paths defined in "exports".

Copy link
Collaborator

@43081j 43081j 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, lets see what @fb55 or @wooorm thinks

@wooorm
Copy link
Collaborator

wooorm commented Oct 18, 2022

I’m not sure if this is enough for rehype (refs #555), and if TS enums will work for it.
I am not objecting, assuming @fb55 thinks this is good to go in the public API surface.

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.

Happy to add this. One nit, then this should be good to go.

packages/parse5/lib/index.ts Outdated Show resolved Hide resolved
@fb55 fb55 enabled auto-merge (squash) October 21, 2022 08:59
@fb55 fb55 merged commit ede8907 into inikulin:master Oct 21, 2022
@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.31% when pulling c43378b on milahu:patch-1 into 618fb8c on inikulin:master.

@fb55
Copy link
Collaborator

fb55 commented Oct 21, 2022

Thanks a lot @milahu!

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.

Types of things like Document, etc, seem not exported in v7
5 participants