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

default tree adapter doesn't seem to be exported via export map #619

Closed
43081j opened this issue Jul 15, 2022 · 6 comments
Closed

default tree adapter doesn't seem to be exported via export map #619

43081j opened this issue Jul 15, 2022 · 6 comments

Comments

@43081j
Copy link
Collaborator

43081j commented Jul 15, 2022

trying to use it in the p5 tools package:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/tree-adapters/default.js' is not defined by "exports" in /parse5-tools/node_modules/parse5/package.json

trying to import parse5/dist/tree-adapters/default.js.

is it because we have ./dist/index.js in our export map but nothing else? so we need dist/tree-adapters/* too maybe?

cc @fb55

@fb55
Copy link
Collaborator

fb55 commented Jul 23, 2022

I was trying to avoid deep exports, as it is difficult to update relevant paths for CJS and ESM. Ways of accessing the default adapter were discussed in #555.

@43081j
Copy link
Collaborator Author

43081j commented Jul 23, 2022

we actually want the exported values in this case though, not only the types.

as we want to make use of the default tree adapter's functions. so im not sure how else we can get that other than exposing the default tree adapter module.

do you have another way in mind?

@43081j
Copy link
Collaborator Author

43081j commented Jul 26, 2022

@fb55 happy to have a go at doing a PR for this but im not 100% sure what the right export map is...

if i try something like:

    "exports": {
        ".": {
            "import": "./dist/index.js",
            "require": "./dist/cjs/index.js"
        },
        "./dist/tree-adapters/default.js": {
            "import": "./dist/tree-adapters/default.js"
        }
    },

we're also forced to add anything the default tree adapter depends on (e.g. dist/common/html). it which point we're edging on just exposing everything 🤷‍♂️

if you can help me out knowing what the right solution is here i can try write it up

@wooorm
Copy link
Collaborator

wooorm commented Jul 27, 2022

Why not export it from the main module?

@43081j
Copy link
Collaborator Author

43081j commented Jul 27, 2022

@wooorm that would make life a lot easier! ill open a PR, no clue why i didn't consider that :D

@43081j
Copy link
Collaborator Author

43081j commented Aug 4, 2022

This is fixed by #631 i think, the rest of the symbols were already exported top level

@43081j 43081j closed this as completed Aug 4, 2022
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

3 participants