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

package.json exports support #1934

Closed
nicholasio opened this issue May 23, 2022 · 3 comments
Closed

package.json exports support #1934

nicholasio opened this issue May 23, 2022 · 3 comments
Labels
enhancement Improved functionality

Comments

@nicholasio
Copy link

Search Terms

multiple exports packages, node.js exports, package.json exports. which allow this kind of behavior

Problem

I have a monorepo where some packages exposes multiple exports through package.json exports directive.

import { something } from '@vendor/my-package/react'`
import { somethingElse }  from '@vendor/my-package/next'

I noticed with the package entryPointStrategy it will only look for a single entry point. Is there a easy way typedoc could be extended via plugins to search for every exports and create a module for each?

Alternatively I'm open to workaround but I couldn't find a way to have each export be treated as a separate module. What I ended up doing was creating a separate entry point that contains all of the exports but doing that groups separate exports into the same module.

For context, those packages are built separately which is why I'm using the packages strategy.

Suggested Solution

@nicholasio nicholasio added the enhancement Improved functionality label May 23, 2022
@nicholasio
Copy link
Author

I made some progress by creating doing this in the entry point I created for the docs

/**
 * The default export of the `@10up/headless-core` package.
 *
 * ```tsx
 * import { PostsArchiveFetchStrategy } from "@10up/headless-core";
 * ```
 */
export * as core from './index';

/**
 * The react export
 *
 */
export * as react from './react';

Which does this
image

and this

image

The only thing I couldn't do was rename the core module so it doesn become "@10up/headless-core/core" in the docs. It looks like @module doesn't wokr when using packages mode?

@nicholasio
Copy link
Author

nicholasio commented May 23, 2022

I could stop renaming the "index" export (core) but If I don't rename the index export I lose the ability to document the namespace (not sure if that's expected).

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 26, 2022

I'm going to track this in #1937 since it more fully describes how I'd like TypeDoc to work

@Gerrit0 Gerrit0 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved functionality
Projects
None yet
Development

No branches or pull requests

2 participants