Skip to content

Export node-utils from package.json #3123

Description

@typhonrt

Before you lock down TypeDoc for the TSGO7 upgrade...

I have a small request for a custom deployment of TypeDoc where I have some advanced use cases that benefit from access to the runtime node utilities. I need to access discoverAllReferenceTypes. For programmatic deployments it may be useful to simply expose node-utils similar to how the browser-utils has an export of typedoc/browser. This can be accomplished simply by adding the proper sub-path export condition to package.json

{
   "exports": {
      "./node": {
         "typedoc-ts": "./src/lib/node-utils.ts",
         "types": "./dist/types/node-utils.d.ts",
         "default": "./dist/node-utils.js"
      }
   }
}

This allows:

import { discoverAllReferenceTypes } from 'typedoc/node';

At the end of the day... I can simply modify the package.json after TypeDoc installation into my specific project to add the above, but I think this is generally useful for more advanced programmatic use cases in general.


Also just a quick thing I noticed when looking at this enhancement request.. It appears the browser export condition for typedoc-ts is not pointing to the source. IE "typedoc-ts": "./src/lib/browser-utils/index.ts" likely should be "typedoc-ts": "./src/lib/browser-utils.ts", as there is no ./src/lib/browser-utils folder in the latest repo update that I see.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions