krisztianb / typedoc-plugin-merge-modules Goto Github PK
View Code? Open in Web Editor NEWPlugin for TypeDoc that merges the content of modules
License: ISC License
Plugin for TypeDoc that merges the content of modules
License: ISC License
I am using the Beta for the packageOptions property of tsconfig.json, but would prefer if the modules were all under the name of the Module like this plugin does, is there any way I could use it with 0.26.0-beta.2?
package.json
:
{
"devDependencies": {
"typedoc": "0.22.13",
"typedoc-plugin-markdown": "3.11.14",
"typedoc-plugin-merge-modules": "3.1.0",
"typescript": "4.6.3"
},
"name": "issue",
"type": "module"
}
typedoc.json
:
{
"cleanOutputDir": true,
"entryPointStrategy": "expand",
"entryPoints": [
"src"
],
"gitRevision": "master",
"hideBreadcrumbs": true,
"hideInPageTOC": true,
"hideLegend": true,
"out": "_doc",
"readme": "none"
}
tsconfig.json
:
{
"compilerOptions": {
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true
},
"include": [
"src/**/*.js"
]
}
src/file.js
:
/**
* Some module.
*
* @module
*/
/**
* This description is not in the documentation!
*
* @callback Type1 This description is not in the documentation!
*
* @param {number} one This description is not in the documentation!
* @param {number} two This description is not in the documentation!
*
* @returns {number} This description is not in the documentation!
*/
/**
* @typedef {{(one: number, two: number) => number}} Type2
*
* Some type 2.
*/
/**
* This block will be placed in the `interfaces/Type3.md` file
* instead of the `README.md` file.
*
* @typedef Type3 Some type 3.
*
* @property {number} one property #1
* @property {number} two property #2
*/
/**
* @typedef {{
* one: number;
* two: number;
* }} Type4
*
* Some type 4.
*/
/**
* Some type 5.
*
* This block will be placed in the `modules/Type5.md` file
* instead of the `README.md` file.
*/
export const Type5 = {}
/**
* @param {number} n
*
* @returns {number}
*/
Type5.id = n => n
Type5.answer = 42
After running
npx typedoc
and
ls -R _doc
we got
README.md interfaces modules
_doc/interfaces:
Type3.md
_doc/modules:
Type5.md
output:
$ ./node_modules/.bin/typedoc --version
Error: The plugin typedoc-plugin-merge-modules could not be loaded.
Error: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/lib/converter' is not defined by "exports" in /home/osesov/tizen/vscode/zplayer/node_modules/typedoc/package.json
at new NodeError (node:internal/errors:371:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:413:9)
at packageExportsResolve (node:internal/modules/esm/resolve:652:3)
at resolveExports (node:internal/modules/cjs/loader:482:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at Object.<anonymous> (/home/osesov/tizen/vscode/zplayer/node_modules/typedoc-plugin-merge-modules/dist/plugin.js:4:21)
TypeDoc 0.22.3
Using TypeScript 4.4.2 from ./node_modules/typescript/lib
If that helps - recently the same situation used to be with typedoc-plugin-markdown #249
First of all: your plugin saved my life. Thank you so much!
This started at TypeStrong/typedoc#1521. So, now that all modules are merged, I think it does not make sense anymore to use "default" as the fieldname.
So, my point here is: should this plugin also replace "default" with the field name? I'm not asking to do, just discussing :).
Thank you very much for this plugin!
When I run:
npx typedoc --pretty --mergeModulesRenameDefaults true ./src
The plug does fix most of my 'default' naming problems, but it is not working with property names and interface names.
Interface:
export default interface CRUDServiceInterface {
Property... if that is what we'll call it:
function loggerFactory(): winston.Logger {
...
return logger;
}
export default loggerFactory();
Fixing the interface name would be the most helpful, and straightforward.
As for the 'property', I would recommend either a lowercase of the file name.
Or, something like: <filename>/@default
Hi!
First of all thanks for your plugin :)
We are having issues working with [email protected] and typedoc-plugin-merge-modules in a monorepo.
In the [email protected] release, the author rebuilt the way typedoc works and how it builts the documentation for monorepos.
Currently, we are not able to make typedoc-plugin-merge-modules work in a monorepo with multiple packages
This worked with [email protected] and the previous version of the plugin
The documentation generated for all the packages properly merge the different packages with the same @module @mergeTarget tags
Modules are not merged and are shown independently.
I will provide a repo with an example, we use Nx for the monorepo.
We have these projects in Nx
each one with his own package.json
[email protected] requires to split the configurations, we created a typedoc.json in both of them
the index.ts (entry point configured for typedoc) has the comments
and here the typedoc global config
I will provide an example repository this afternoon :)
Hello,
I was hoping I am able to specify a module-level documentation block by specifiying the @packageDocumentation annotation as per these docs.
I am currently using your package as a replacement for this obsolete package which provided such a feature.
See here.
Would it be too much work to include this functionality?
Hello, and thanks for updating this plugin to work with the latest TypeDoc!
Now, on to my issue. I was wondering if there could be a new option to merge things on to the same page.
For example, with the following typedoc.json
:
{
"$schema": "https://typedoc.org/schema.json",
"entryPointStrategy": "Resolve",
"entryPoints": [
"./src/foo.ts",
"./src/bar.ts"
]
}
And the following foo.ts
:
export enum FooEnum {
VALUE_1 = 0,
VALUE_2 = 1,
}
export interface FooInterface {
thing1: number;
thing2: number;
}
And the following bar.ts
:
// Same as "foo.ts", just different names.
export enum BarEnum {
VALUE_1 = 0,
VALUE_2 = 1,
}
export interface BarInterface {
thing1: number;
thing2: number;
}
Without any plugins, TypeDoc will generate docs that have FooEnum
, FooInterface
, BarEnum
, and BarInterface
all on separate HTML pages.
Instead, what I want is to have 2 HTML pages with 2 things each on them, because I have explicitly told TypeDoc to have 2 entry points.
(Essentially, this would allow people to document "chunks" or "features" of an app/library, and have everything concerning the feature be contained on a single HTML page.)
Is this possible?
When running typedoc I'm getting the following error:
The plugin C:**\base\node_modules\typedoc-plugin-merge-modules could not be loaded.
Error: C:**\base\node_modules\marked\src\marked.js:158
const prevRenderer = extensions.renderers?.[ext.name];
Version 2.1.0 introduced the possibility to turn the plugin off with an option.
The code that renames default exports does not honor that option.
hi, thx you for this plugin. is there any possible can add an option to prevent merge those same name modules which in different categories?
I have tried adding "mergeModulesMergeMode": "module"
to my typedoc.json
file, but now TypeDoc throws error Error: Tried to set an option (mergeModulesMergeMode) that was not declared.
.
It does load typedoc-plugin-merge-modules
right before throwing the error, so I believe I'm at fault for using the option the wrong way. How should I use it, though?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.