Coder Social home page Coder Social logo

typedoc-plugin-external-module-name's Introduction

typedoc-plugin-external-module-name

What

A Typedoc plugin which allows code documentation to be organized into custom Modules.

Note: In Typedoc 0.17.0 and above, Module refers to an ES6 Module. In Typedoc 0.16.x and below, an ES6 Module was called an External Module. Although the plugin's name includes "External Module", it modifies Modules (ES6 Modules)

By default, Typedoc creates a Module for each ES6 Module (each file).

This plugin allows documentation to be moved to arbitrary modules. It also supports merging multiple modules into a single module. By default, all Modules in a given directory will be merged into a single module.

Suppose your source files are organized like this:

thing1/foo.ts
thing1/bar.ts
thing2/baz.ts
thing2/qux.ts

By default, Typedoc would create four Modules:

  • thing1/foo: contains foo documentation
  • thing1/bar: contains bar documentation
  • thing2/baz: contains baz documentation
  • thing2/qux: contains qux documentation

With this plugin, Typedoc creates two Modules:

  • thing1: contains foo and bar documentation
  • thing2: contains baz and qux documentation

Installing

Typedoc has the ability to discover and load typedoc plugins found in node_modules. Simply install the package usng your package manager and run typedoc.

npm install -D typedoc-plugin-external-module-name
typedoc

Using

Directory Based

This plugin will combine documentation from the files in each given directory into a new Module. The new module name is generated from the directory's location in the source tree.

Explicit via Annotation

You can explicitly specify a Module name using the @module annotation. Add a comment block at the top of a Typescript file with @module modulename. Mark the comment block as @packageDocumentation to let typedoc know that this is documentation for the file (Module) itself (see: Typedoc Docs).

/**
 * @packageDocumentation
 * @module module1
 */

Top level module comments

When multiple modules are merged, the merged module summary is chosen arbitrarily from the first file processed. To use a specific file's comment block as the Module page summary, use @preferred.

/**
 * This comment will be used as the summary for the "thing2" module.

 * @packageDocumentation
 * @module thing2
 * @preferred
 */

Custom Module Name Generation

Create a file named .typedoc-plugin-external-module-name.js in the folder you launch typedoc from. Create a custom mapping function in that file and export it using CommonJS. For each Module, the plugin will call your function and use the return value as the Module Name.

module.exports = function customMappingFunction() {
  return "custom" // everything goes into "custom"
}

The Function should have the following signature:

type CustomModuleNameMappingFn = (
  explicitModuleAnnotation: string,
  implicitFromDirectory: string,
  path: string,
  reflection: Reflection,
  context: Context,
) => string;

The arguments are:

  • moduleAnnotation: If the module has an explicit annotation, i.e., @module explicit
  • implicitFromDirectory: The plugin's default mapping
  • path: The path to the file
  • reflection: The Module ContainerReflection
  • context: The typedoc Context

Example:

const subpackage = new RegExp("packages/([^/]+)/");
module.exports = function customMappingFunction(explicit, implicit, path, reflection, context) {
  // extract the monorepo package from the path
  const package = subpackage.match(path)[1];
  // build the module name
  return `${package}/${implicit}`;
}

typedoc-plugin-external-module-name's People

Contributors

abettadapur avatar arlanthir avatar chharvey avatar christopherthielen avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar dependencies-bot avatar devlee avatar fd avatar ferhtgoldaraz avatar filips-alpe avatar greenkeeper[bot] avatar haraldf avatar n8n8baby avatar panayotcankov avatar romakita avatar sbryois avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

typedoc-plugin-external-module-name's Issues

Plugin does not remap `symbolMapping` entry when merging reflections

When the plugin merges external module reflections it calls CommentsPlugin.removeReflection, which deletes the entry in project.symbolMapping and can break resolution.

Consider tracking the symbol id in https://github.com/christopherthielen/typedoc-plugin-external-module-name/blob/master/plugin.ts#L75 via a call to context.getSymbolID(node.symbol), and updating the entry in project.symbolMapping before calling CommentsPlugin.removeReflection on https://github.com/christopherthielen/typedoc-plugin-external-module-name/blob/master/plugin.ts#L132.

not working with TypeDoc 0.15.0

This plugin somehow does not work with latest typedoc 0.15 version. It still works with the older one, but only if I remove the typescript 3.5.x dependency to get my scripts compiled.

I get the output that the module is loaded when I just compiling:
Loaded plugin /home/simon/Dev/Web/hokify-server/node_modules/typedoc-plugin-external-module-name

I run the command without any special arugments, have tested it with several different appraoches already though:
typedoc --out ./docs ./src/

I have several

/**
 * @module MyModule1
*/

definitions as first line in several files, but the output modules are not comibed at all (every file is a single module listed in globals), it's just the same as without the module. Is there an issue with 0.15 or do I miss something here to get this running?

Just to clarify: I first thought I cannot test it with typedoc 0.14, but as it turns out, the only problem was the older typescript version that is defined in typedoc package.json. If I remove the reference and let typedoc let use my latest installed typescript (3.6.3) everything works fine with 0.14.2.

Thanks a lot
Simon

Using typedoc option 'disableSources' results runtime error: Cannot read property '0' of undefined

Per the summary.

<@coherence-js-client>-<⎇ master>-<±>-1-> npx typedoc
Loaded plugin /Users/rlubke/files/gitlab/coherence-js-client/node_modules/typedoc-plugin-external-module-name

Using TypeScript 3.9.7 from /Users/rlubke/files/gitlab/coherence-js-client/node_modules/typescript/lib
Cannot read property '0' of undefined

typedoc.json is as follows:

{
  "inputFiles": [
    "./src"
  ],
  "out": "docs",
  "excludeNotExported": true,
  "excludePrivate": true,
  "module": "commonjs",
  "target": "ES6",
  "includeVersion": true,
  "readme": "README.md",
  "hideGenerator": true,
  "disableSources": true,
  "includeDeclarations": true,
  "excludeExternals": true,
  "stripInternal": true,
  "exclude": [
    "**/*+(index|package-internal).ts"
  ],
}

Using version 4.0.3 of the plugin and typedoc 0.17.8.

Removing the option results in a successful documentation run.

Easier support for monorepos

Hi All:

Problem:

  • Currently, this plugin requires declaring @module on each of the .ts file that we want to be merged together.
  • In a monorepo setup, we can have nested repositories. And each of those repositories will have their own package.json.
  • A monorepo user would like to have the symbols (functions, enums, interfaces, etc.) clubbed together based on the child repository they are in, but adding a @module declaration in each of the numerous possible files is very tedious.

Proposed Solution:

  • It will be very useful if an option can be provided in typedoc.json via this plugin which specifies the relative path of all those "children" repositories and then the plugin can merge all the symbols appropriately based on child repository name.
  • A fork of this plugin does it well but doesn't seem to have active maintenance schedule. typedoc-plugin-external-module-name is probably the most up-to-date and active plugin amongst all its forks in terms of TypeDoc version compatibility.
  • Will be super helpful if this feature can be provided. This plugin seems to already have all the tools needed for this functionality.

Plugin not working with typescript 2.0.3

There seem to be an issue where the plugin does not work for me when using typescript 2.0.3. I fixed this by removing the ones this plugin installed in the node_modules folder, making it use a higher typedoc and typescript version, i.e. the ones in the root node_modules folder.

TypeError: Cannot read property 'filter' of undefined

There was a recent change to my codebase that is causing typedoc-plugin-external-module-name to crash.

I will investigate more closely to determine why parent.children is undefined in onBeginResolve.

> typedoc --options typedoc.json

Loaded plugin typedoc-plugin-external-module-name

Using TypeScript 4.3.2 from /Users/raine/projects/em/node_modules/typescript/lib
/Users/raine/projects/em/node_modules/typedoc-plugin-external-module-name/typedoc-plugin-external-module-name.js:187
                let mergeTarget = parent.children.filter((ref) => ref.kind === renaming.kind && ref.name === nameParts[nameParts.length - 1])[0];
                                                  ^

TypeError: Cannot read property 'filter' of undefined
    at /Users/raine/projects/em/node_modules/typedoc-plugin-external-module-name/typedoc-plugin-external-module-name.js:187:51
    at Array.forEach (<anonymous>)
    at ExternalModuleNamePlugin.onBeginResolve (/Users/raine/projects/em/node_modules/typedoc-plugin-external-module-name/typedoc-plugin-external-module-name.js:170:32)
    at triggerEvents (/Users/raine/projects/em/node_modules/typedoc/dist/lib/utils/events.js:128:43)
    at triggerApi (/Users/raine/projects/em/node_modules/typedoc/dist/lib/utils/events.js:110:13)
    at eventsApi (/Users/raine/projects/em/node_modules/typedoc/dist/lib/utils/events.js:21:18)
    at Converter.trigger (/Users/raine/projects/em/node_modules/typedoc/dist/lib/utils/events.js:264:13)
    at Converter.resolve (/Users/raine/projects/em/node_modules/typedoc/dist/lib/converter/converter.js:164:14)
    at Converter.convert (/Users/raine/projects/em/node_modules/typedoc/dist/lib/converter/converter.js:91:30)
    at CliApplication.convert (/Users/raine/projects/em/node_modules/typedoc/dist/lib/application.js:79:39)

Second comment block

From the readme,
A known issue: The comment block must be followed by another comment block for some reason (?)

Is this a typedoc issue or an issue with this plugin? Is there any info on any progress being made to solve it?

Thanks 😄

What would you say to implement Angular2 NgModules logic?

Hi,

recently, A2 (developed on TS) team introduced NgModule concept for A2. It organizes the application and extend it with capabilities from external libraries (components, directives and pipes). Because of the fact that most of developed app code is created in the schema 1 class = 1 file, NgModules describe main relations among them.

I tested your plugin and it seams that there would be a great befefit to implement NgModules logic and have automaticaly defined relations among classes. The final result of docs would be that NgModules will be taken as root classes and others nested and linked by defined rules.

What is your opinion about this idea?

[QUESTION] Special `@module name` for classes in root src directory?

I'm close to getting the documentation the way I'd like to see it generated, thanks to this plugin, however, I've hit a snag with classes that are part of the root (for lack of a better term) directory of the sources. I want these classes to be in the top-level TOC of the index with the modules based on the sub-directories listed below.

Instead, the resulting documentation creates a module named <em>Module</em> and the results are buried away in there.

Is there a special identifier for the top-level module that I'm missing or some trick to accomplish this?

Using version 4.0.3 of the plugin and typedoc 0.17.8.

Description of module won't display

TLDR:

When there is one module containing at least 2 files and one of those files contains a function, the module's description won't show up in the module's docs.

Setup

Lets say we have three files:

collections-helpers.ts:

export function pickRandom<T>(collection: T[]): T | undefined { ... }
function doTimes<T>(times: number, action: (index: number) => T): T[] { ... }

subscribers-set.ts:

export class SubscribersSet<T> implements Iterable<T> { ... }

time-helpers.ts:

export async function delay(ms: number): Promise<void> { ... }

When problem happens

When I'll add the collections-helpers.ts to the module with any other file, the module description won't show up.

A module containing:

  • collections-helpers.ts - will display the description
  • subscribers-set.ts - will display the description
  • time-helpers.ts - will display the description
  • collections-helpers.ts and subscribers-set.ts - WON'T display the description
  • collections-helpers.ts and time-helpers.ts - WON'T display the description
  • subscribers-set.ts and time-helpers.ts - WON'T display the description

I have other module that doesn't have this functions only file problem and then the module description is displayed just fine.

Environment:

package.json:

"scripts": {
  "docs": "typedoc --tsconfig"
},
"dependencies": {
  "@nestjs/common": "^7.4.2",
  "@nestjs/config": "^0.5.0",
  "@nestjs/core": "^7.4.2",
  "@nestjs/platform-express": "^7.4.2",
  "faker": "^4.1.0",
  "node-fetch": "^2.6.0",
  "reflect-metadata": "^0.1.13",
  "rimraf": "^3.0.2",
  "rxjs": "^6.6.2"
},
"devDependencies": {
  "@nestjs/cli": "^7.4.0",
  "@nestjs/schematics": "^7.0.0",
  "@nestjs/testing": "^7.4.0",
  "@types/express": "^4.17.0",
  "@types/faker": "^4.1.12",
  "@types/jest": "^26.0.0",
  "@types/node": "^14.0.0",
  "@types/supertest": "^2.0.10",
  "@typescript-eslint/eslint-plugin": "^3.9.0",
  "@typescript-eslint/parser": "^3.9.0",
  "eslint": "^7.7.0",
  "eslint-config-airbnb-base": "^14.2.0",
  "eslint-config-prettier": "^6.11.0",
  "eslint-plugin-import": "^2.22.0",
  "jest": "^26.4.0",
  "prettier": "^2.0.0",
  "supertest": "^4.0.0",
  "ts-jest": "26.2.0",
  "ts-loader": "^8.0.0",
  "ts-node": "^8.10.0",
  "tsconfig-paths": "^3.9.0",
  "typedoc": "0.18.0",
  "typedoc-plugin-external-module-name": "4.0.3",
  "typescript": "^3.9.7"
}

tsconfig.json:

{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "es2018",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "strictNullChecks": true
  },
  "typedocOptions": {
    "inputFiles": ["./src"],
    "mode": "modules",
    "out": "docs",
    "exclude": "**/*+(index|.spec|.e2e).ts",
    "excludePrivate": true,
    "excludeExternals": true,
    "stripInternal": true,
    "name": "HubHazard Core",
    "includeVersion": true
  }
}

Doesn't seem to be working with typedoc 0.11.1 and typescript 2.7

Is there something else that needs to be done besides what is specified in the readme? The plugin does get loaded but it doesn't seem to do anyting:

npx typedoc src --out web
Loaded plugin typedoc-plugin-external-module-name

Using TypeScript 2.7.2 from S:\Workspace\node_modules\typedoc\node_modules\typescript\lib
Rendering [========================================] 100%

Documentation generated at S:\Workspace\web

I've been trying to generate per module documentation in a simple project with no success. I tried to reduce the documentation to the minimum (keeping mostly just the @module tags) to eliminate the problem but I still get separate modules for all files.

Issue with TypeScript 2.0.6

I'm facing this issue using [email protected], [email protected] and [email protected] on Windows 10

typedoc "--options" "typedoc.json" "--exclude" "'**/*.spec.ts'" "./src/"

Loaded plugin typedoc-plugin-external-module-name

Using TypeScript 2.0.6 from C:\Users\XXXXX\node_modules\typedoc\node_modules\typescript\lib

C:\Users\XXXX\node_modules\typedoc-plugin-external-module-name\node_modules\typedoc\dist\lib\converter\factories\comment.js:47
    var comments = _ts.getJSDocCommentRanges(node, sourceFile.text);
                                                             ^

TypeError: Cannot read property 'text' of undefined
    at Object.getRawComment (C:\Users\XXXXX\node_modules\typedoc-plugin-external-module-name\node_modules\typedoc\dist\lib\converter\factories\comment.js:47:62)
    at ExternalModuleNamePlugin.onDeclaration (C:\Users\XXXXX\node_modules\typedoc-plugin-external-module-name\plugin.js:82:41)
    at triggerEvents (C:\Users\XXXXX\node_modules\typedoc\lib\utils\events.js:129:43)
    at triggerApi (C:\Users\XXXXX\node_modules\typedoc\lib\utils\events.js:106:13)
    at eventsApi (C:\Users\XXXXX\node_modules\typedoc\lib\utils\events.js:20:18)
    at Converter.EventDispatcher.trigger (C:\Users\XXXXX\node_modules\typedoc\lib\utils\events.js:261:13)
    at Context.trigger (C:\Users\XXXXX\node_modules\typedoc\lib\converter\context.js:56:24)
    at Object.createDeclaration (C:\Users\XXXXX\node_modules\typedoc\lib\converter\factories\declaration.js:85:17)
    at C:\Users\XXXXX\node_modules\typedoc\lib\converter\nodes\block.js:53:34
    at Context.withSourceFile (C:\Users\XXXXX\node_modules\typedoc\lib\converter\context.js:79:9)

typedoc.json

{
  "mode": "modules",
  "out": "doc",
  "theme": "default",
  "ignoreCompilerErrors": "true",
  "experimentalDecorators": "true",
  "emitDecoratorMetadata": "true",
  "target": "ES5",
  "moduleResolution": "node",
  "preserveConstEnums": "true",
  "stripInternal": "true",
  "suppressExcessPropertyErrors": "true",
  "suppressImplicitAnyIndexErrors": "true",
  "module": "commonjs"
}

Removing the plugin solves it and the docs are correctly rendered.

Error when using this plugin

After installing typedoc-plugin-external-module-name in devDependencies and executing typedoc -v I get this:

Error: The plugin /Users/marc/bude/glut.ts/node_modules/typedoc-plugin-external-module-name could not be loaded.

Error: Cannot find module 'typedoc/dist/lib/models/reflections/abstract'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:611:15)
    at Function.Module._load (internal/modules/cjs/loader.js:537:25)
    at Module.require (internal/modules/cjs/loader.js:665:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at /Users/marc/bude/glut.ts/node_modules/typedoc-plugin-external-module-name/plugin.js:18:24
    at /Users/marc/bude/glut.ts/node_modules/typedoc-plugin-external-module-name/plugin.js:9:17
    at Object.<anonymous> (/Users/marc/bude/glut.ts/node_modules/typedoc-plugin-external-module-name/plugin.js:15:3)
    at Module._compile (internal/modules/cjs/loader.js:736:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:747:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)

TypeDoc 0.14.2
Using TypeScript 3.2.4 from /usr/local/lib/node_modules/typedoc/node_modules/typescript/lib

Module types reflection is broken with this plugin

If the code being documented has a structure like the this one (gist doesn't allow folder, so i mimic it with dashes (-) instead of (/)).

I think that the issue is here: https://github.com/christopherthielen/typedoc-plugin-external-module-name/blob/master/plugin.ts#L132, this line removes the declaration of the sub/index.ts module that is being imported in the index.ts file.

The type will get resolve as a absolute path because typedoc can not found that module anymore.

image

Docs generation breaks with custom module name generation when using typedoc v0.19.2

Screenshot 2020-10-22 at 2 58 44 PM

The typedoc generation fails with v0.19.2 when a custom module name generation mapper is used because it's assumed that the rootFileNames would always be a non-empty array.

Screenshot 2020-10-22 at 2 44 01 PM

There's no such expectation in the method definition in though - check getRootFileNames method (taken from Typescript)

As a result, the function breaks unexpectedly when there are no rootFileNames

The solution might be fiddlier than it seems, but adding an empty array check on this line prevents unexpected errors for now.

AssertionError: "Tried to access Context.program when not converting a source file."

In 4.0.0 and beyond, I get this error, on my template project that only has a single.ts trivial file and a couple README.md files.

Info: Loaded plugin /Users/rwk/p/npm-typescript-rollup-template/node_modules/typedoc-plugin-external-module-name
Info: Loaded plugin /Users/rwk/p/npm-typescript-rollup-template/node_modules/typedoc-plugin-mermaid
Info: Loaded plugin /Users/rwk/p/npm-typescript-rollup-template/node_modules/typedoc-plugin-npm-externals
TypeDoc exiting with unexpected error:
AssertionError [ERR_ASSERTION]: Tried to access Context.program when not converting a source file
at Context.get program [as program] (/Users/rwk/p/npm-typescript-rollup-template/node_modules/typedoc/dist/lib/converter/context.js:39:18)
at ExternalModuleNamePlugin.onBegin (/Users/rwk/p/npm-typescript-rollup-template/node_modules/typedoc-plugin-external-module-name/typedoc-plugin-external-module-name.js:85:37)
at triggerEvents (/Users/rwk/p/npm-typescript-rollup-template/node_modules/typedoc/dist/lib/utils/events.js:173:43)
at triggerApi (/Users/rwk/p/npm-typescript-rollup-template/node_modules/typedoc/dist/lib/utils/events.js:149:13)
at eventsApi (/Users/rwk/p/npm-typescript-rollup-template/node_modules/typedoc/dist/lib/utils/events.js:42:18)
at Converter.trigger (/Users/rwk/p/npm-typescript-rollup-template/node_modules/typedoc/dist/lib/utils/events.js:371:13)
at Converter.convert (/Users/rwk/p/npm-typescript-rollup-template/node_modules/typedoc/dist/lib/converter/converter.js:41:14)
at Application.convert (/Users/rwk/p/npm-typescript-rollup-template/node_modules/typedoc/dist/lib/application.js:151:31)
at run (/Users/rwk/p/npm-typescript-rollup-template/node_modules/typedoc/bin/typedoc:59:25)
at Object. (/Users/rwk/p/npm-typescript-rollup-template/node_modules/typedoc/bin/typedoc:26:1) {
generatedMessage: false,
code: 'ERR_ASSERTION',
actual: undefined,
expected: true,
operator: '=='
}

It works in 3.1.0

Typedoc: 0.20.4
Typescript: 4.1.3

Namespaces are need to use this plugin?

Hello,

I'm playing with typedoc and finded this module very useful, but I don't know if I'm using it properly. For reference, here is my sample code:

//File: users.module.ts

import { Module } from '@nestjs/common';
import { UsersController } from './users.controller';

/**
 * @module Users
 * @preferred
 * 
 * Module to handle users.
 */
/**
 * Users Nest module.
 * 
 * @class UsersModule
 */
@Module({
  controllers: [ UsersController ]
})
export class UsersModule {}

//File: users.controller.ts

import { Controller, Get, Post, HttpStatus } from '@nestjs/common';
import { Response, Request, NextFunction } from 'express';

/**
 * @module Users
 */
/**
 * Controller for the users resource.
 * 
 * @class UsersController
 */
@Controller()
export class UsersController {

  /**
   * Get all users registred.
   * 
   * @param {Request} req        Request object
   * @param {Response} res       Response object
   * @param {NextFunction} next          Next middleware to be executed
   * @memberof UsersController
   */
  @Get('users')
  getAllUsers(req: Request, res: Response, next: NextFunction){
    res.status(HttpStatus.OK).send({
      id: 1, name: 'Caio'
    });
  }

  @Get('users/:id')
  getUser() {}

  @Post('users')
  addUser() {}
}

I'm using a framework called Nest, but I don't know if it's relevant.
I was thinking if its plugin needs of formal namespaces to proper work, or if I'm messing with something else.

Thanks for all the effort, and I'm sorry for the formating, I included the code in the quotation but its getting weird.

Using submodules fails on getKindString

Reference: PR #213

Submodules working is very hit and miss for me.

In my project, I do not have folders like:

src\comp\index.ts

I just have:

src\comp\thing1.ts
src\comp\thing2.ts
src\comp\sub\thing1.ts

In some cases, submodules will just work without an issue, but in most cases I am presented with the following error:

node_modules/typedoc/dist/lib/converter/plugins/GroupPlugin.js:90
        str = str.replace(/(.)([A-Z])/g, (m, a, b) => a + ' ' + b.toLowerCase());

TypeError: Cannot read property 'replace' of undefined

When it fails I know it's looking for the base module key.

ex: a submodule for Chips.entities would fail on Chips as the value for kind ( aka b ), it is not found in the index_1.ReflectionKind array

NOTE: I never see a string value for kind except for when it errors, every other case it's a short int

Here is some debugging console.log output:


--------------KIND--------------
Chips
--------------index_1.ReflectionKind--------------
{ '0': 'Global',
  '1': 'ExternalModule',
  '2': 'Module',
  '3': 'SomeModule',
  '4': 'Enum',
  '16': 'EnumMember',
  '32': 'Variable',
  '64': 'Function',
  '128': 'Class',
  '256': 'Interface',
  '384': 'ClassOrInterface',
  '512': 'Constructor',
  '1024': 'Property',
  '1056': 'VariableOrProperty',
  '2048': 'Method',
  '2112': 'FunctionOrMethod',
  '4096': 'CallSignature',
  '8192': 'IndexSignature',
  '16384': 'ConstructorSignature',
  '32768': 'Parameter',
  '65536': 'TypeLiteral',
  '131072': 'TypeParameter',
  '262144': 'Accessor',
  '524288': 'GetSignature',
  '1048576': 'SetSignature',
  '1601536': 'SomeSignature',
  '2097152': 'ObjectLiteral',
  '4194304': 'TypeAlias',
  '8388608': 'Event',
  Global: 0,
  ExternalModule: 1,
  Module: 2,
  Enum: 4,
  EnumMember: 16,
  Variable: 32,
  Function: 64,
  Class: 128,
  Interface: 256,
  Constructor: 512,
  Property: 1024,
  Method: 2048,
  CallSignature: 4096,
  IndexSignature: 8192,
  ConstructorSignature: 16384,
  Parameter: 32768,
  TypeLiteral: 65536,
  TypeParameter: 131072,
  Accessor: 262144,
  GetSignature: 524288,
  SetSignature: 1048576,
  ObjectLiteral: 2097152,
  TypeAlias: 4194304,
  Event: 8388608,
  ClassOrInterface: 384,
  VariableOrProperty: 1056,
  FunctionOrMethod: 2112,
  SomeSignature: 1601536,
  SomeModule: 3 }

It seems clear to me that Chips is the wrong value for kind; it's a module name and not a kind.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Module names not fully working (partially ignored)

I have a problem that I am unable to solve by looking at the documentation alone.

In my project https://github.com/AlCalzone/shared-utils/tree/master/src I have a bunch of folders, each of which should be treated like a module and can be imported separately (e.g. require("alcalzone-shared/math")). Each folder has an index.ts which exposes the functionality of that "module". These index.ts files are annotated with /** @module module-name */.

I'm generating the documentation with typedoc and this module. That partially works:
grafik

As you can see, helpers, math, strings and typeguards have the correct module name format. The other modules don't - collections/index has the annotation /** @module collections */.
And there are links to the internal implementation files of the modules (e.g. collections/expiring-set) that don't even have an @module annotation and are still included in the table of contents.

Am I doing something wrong or is this a bug?

typedoc-plugin-folder-modules is not working

Plugin typedoc-plugin-folder-modules is not working and giving below error:

admin@localhost typedoc]$ typedoc --options typedocconfig.ts --plugin "typedoc-plugin-folder-modules"
Error: The plugin typedoc-plugin-folder-modules could not be loaded.

TypeError: Class constructor ConverterComponent cannot be invoked without 'new'
at new FolderModulesPlugin (/home/admin/node-v8.11.4-linux-x64/lib/node_modules/npm/node_modules/typedoc-plugin-folder-modules/plugin.js:43:46)
at Converter.addComponent (/home/admin/node-v8.11.4-linux-x64/lib/node_modules/npm/node_modules/typedoc/dist/lib/utils/component.js:123:19)
at Converter.addComponent (/home/admin/node-v8.11.4-linux-x64/lib/node_modules/npm/node_modules/typedoc/dist/lib/converter/converter.js:28:33)
at module.exports (/home/admin/node-v8.11.4-linux-x64/lib/node_modules/npm/node_modules/typedoc-plugin-folder-modules/index.js:4:17)
at PluginHost.load (/home/admin/node-v8.11.4-linux-x64/lib/node_modules/npm/node_modules/typedoc/dist/lib/utils/plugins.js:36:21)
at CliApplication.bootstrap (/home/admin/node-v8.11.4-linux-x64/lib/node_modules/npm/node_modules/typedoc/dist/lib/application.js:42:22)
at CliApplication.bootstrap (/home/admin/node-v8.11.4-linux-x64/lib/node_modules/npm/node_modules/typedoc/dist/lib/cli.js:24:30)
at new Application (/home/admin/node-v8.11.4-linux-x64/lib/node_modules/npm/node_modules/typedoc/dist/lib/application.js:31:14)
at new CliApplication (/home/admin/node-v8.11.4-linux-x64/lib/node_modules/npm/node_modules/typedoc/dist/lib/cli.js:22:1)
at Object. (/home/admin/node-v8.11.4-linux-x64/lib/node_modules/npm/node_modules/typedoc/bin/typedoc:4:1)

Using TypeScript 3.2.2 from /home/admin/node-v8.11.4-linux-x64/lib/node_modules/npm/node_modules/typescript/lib
Rendering [====================================----] 88%
Error: Documentation could not be generated due to the errors above.

Issue with [[include:filename]]

Issue

Looks like that if you use this plugin, [[include:filename]] syntax with @module Name doesn't output the content in the docs.

Reproduction

In detail:

/**
 * @module Sample
 * 
 * [[include:sample.md]]
 */
/** DO NOT REMOVE */

Does not actually include sample.md.

On the other hand, this works, without having the plugin installed:

/**
 * [[include:sample.md]]
 */

But you then lack the module feature, which is key in large applications.

The only workaround is:

/**
 * @module Sample
 * 
 */
/** DO NOT REMOVE */

/**
 * [[include:sample.md]]
 */
export const description = "";

In which the initial "paragraph" is still blank, but at least you can finally include an external file by attaching it to a fake exported member.

##Asks
Support the [[include:filename]] syntax with @module Name

Versions

[email protected] or @2.2.1
[email protected]
[email protected]

Submodules

Is it possible to declare/reference submodules, e.g. thing1.subthing1?

If so, how can we do it (I tried the obvious @module thing1.subthing1 and only the first part is identified as the module name)?

If not, is it a design decision not to support it?

Thanks

Module names with dots are broken

If I try to use module names with dots (to seperate them in root and submodules) I get the following error sometimes:

...GroupPlugin.js:89
str = str.replace(/(.)([A-Z])/g, (m, a, b) => a + ' ' + b.toLowerCase());
^
TypeError: Cannot read property 'replace' of undefined
at Function.getKindString ...\node_modules\typedoc\dist\lib\converter\plugins\GroupPlugin.js:89:19)
at Function.getKindSingular ...\node_modules\typedoc\dist\lib\converter\plugins\GroupPlugin.js:97:34)
at GroupPlugin.onResolve ...\node_modules\typedoc\dist\lib\converter\plugins\GroupPlugin.js:22:47)
at triggerEvents ...\node_modules\typedoc\dist\lib\utils\events.js:133:43)
at triggerApi ...\node_modules\typedoc\dist\lib\utils\events.js:110:13)
at eventsApi ...\node_modules\typedoc\dist\lib\utils\events.js:21:18)
at Converter.trigger ...\node_modules\typedoc\dist\lib\utils\events.js:264:13)
at Converter.resolve ...\node_modules\typedoc\dist\lib\converter\converter.js:170:18)
at Converter.convert ...\node_modules\typedoc\dist\lib\converter\converter.js:91:30)
at CliApplication.convert ...\mtsm-webapp\node_modules\typedoc\dist\lib\application.js:70:39)

I think this has something to do with the order in which the files are processed. for example, If I create the following files:

A1.ts

/**
* @packageDocumentation
* @module foo
*/
export class A1 {}

A2.ts

/**
* @packageDocumentation
* @module foo.bar
*/
export class A2 {}

Then everything works as expected. If I change the order of the module declerations (i.e. foo.bar in A1 and foo in A2) the error mentioned above occurs.

@preferred comment text missing in module description

When I'm describing a module using @preferred like this:

/**
 * @module ApiModule
 * @preferred
 * This module yada yada
 */ /** */

The text will never show up in the generated typedoc, and in general there doesn't seem to be a way to add a description that the plugin successfully picks up.

When debugging, I found that part of the problem seems to lie in this line, as removing the preferred-tag also gets rid of the text in this specific CommentTag (as typedoc adds the description text to the "CommentTag" object, not the "Comment" itself).

Also, I didn't quite understand why this removal at this place was necessary, as it is done again (?) down here.

I fixed the problem locally by a little hack in the generated JS, right after this line and by removing the removeTags in the onDeclaration handler.

if (renaming.comment.tags.filter((item) => { return item.tagName == 'preferred'}).length > 0) {
    renaming.comment.text = renaming.comment.tags.filter((item) => { return item.tagName == 'preferred'})[0].text;
}

If you are able to reproduce this bug, I'll write a PR to fix the problem for good.
I'm using [email protected] and the [email protected].

Can not use module names with dots

I am trying to achieve module names with dots e.g.: LT.Graphics

image

Generated help file only shows LT. The rest of the name (.Graphics) is missing.

image

My opinion your regex expression does not allow dots.

Can you please add dot ( . ) in your regex expression as valid character?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.