@ckeditor/ckeditor5-dev-docs 47.1.1 → 49.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/build.js CHANGED
@@ -4,10 +4,9 @@
4
4
  */
5
5
 
6
6
  import { glob } from 'glob';
7
- import TypeDoc from 'typedoc';
8
- import typedocPlugins from '@ckeditor/typedoc-plugins';
9
-
10
- import validators from './validators/index.js';
7
+ import upath from 'upath';
8
+ import { Application, OptionDefaults } from 'typedoc';
9
+ import * as plugins from '@ckeditor/typedoc-plugins';
11
10
 
12
11
  /**
13
12
  * Builds CKEditor 5 documentation using `typedoc`.
@@ -16,78 +15,76 @@ import validators from './validators/index.js';
16
15
  * @returns {Promise}
17
16
  */
18
17
  export default async function build( config ) {
19
- const { plugins } = typedocPlugins;
20
18
  const sourceFilePatterns = config.sourceFiles.filter( Boolean );
21
- const strictMode = config.strict || false;
22
19
  const extraPlugins = config.extraPlugins || [];
23
20
  const ignoreFiles = config.ignoreFiles || [];
24
- const validatorOptions = config.validatorOptions || {};
21
+ const validatorOptions = config.validatorOptions || {
22
+ strict: false
23
+ };
24
+ const verbose = config.verbose || false;
25
25
 
26
- const files = await glob( sourceFilePatterns, {
26
+ const files = ( await glob( sourceFilePatterns, {
27
27
  ignore: ignoreFiles
28
- } );
29
- const typeDoc = new TypeDoc.Application();
28
+ } ) ).map( upath.normalize );
30
29
 
31
- typeDoc.options.addReader( new TypeDoc.TSConfigReader() );
32
- typeDoc.options.addReader( new TypeDoc.TypeDocReader() );
33
-
34
- typeDoc.bootstrap( {
30
+ const app = await Application.bootstrapWithPlugins( {
35
31
  tsconfig: config.tsconfig,
36
32
  excludeExternals: true,
33
+ excludePrivate: false,
37
34
  entryPoints: files,
38
- logLevel: 'Warn',
35
+ logLevel: verbose ? 'Info' : 'Warn',
39
36
  basePath: config.cwd,
37
+ readme: 'none',
38
+
40
39
  blockTags: [
40
+ ...OptionDefaults.blockTags,
41
41
  '@eventName',
42
- '@default'
42
+ '@export',
43
+ '@fires',
44
+ '@label',
45
+ '@observable',
46
+ '@error'
43
47
  ],
44
48
  inlineTags: [
45
- '@link',
49
+ ...OptionDefaults.inlineTags,
46
50
  '@glink'
47
51
  ],
48
52
  modifierTags: [
53
+ ...OptionDefaults.modifierTags,
49
54
  '@publicApi',
50
- '@skipSource',
51
- '@internal'
55
+ '@skipSource'
52
56
  ],
53
57
  plugin: [
54
58
  // Fixes `"name": 'default" in the output project.
55
59
  'typedoc-plugin-rename-defaults',
56
-
57
- plugins[ 'typedoc-plugin-module-fixer' ],
58
- plugins[ 'typedoc-plugin-symbol-fixer' ],
59
- plugins[ 'typedoc-plugin-interface-augmentation-fixer' ],
60
- plugins[ 'typedoc-plugin-tag-error' ],
61
- plugins[ 'typedoc-plugin-tag-event' ],
62
- plugins[ 'typedoc-plugin-tag-observable' ],
63
- plugins[ 'typedoc-plugin-purge-private-api-docs' ],
64
-
65
- // The `event-inheritance-fixer` plugin must be loaded after `tag-event` plugin, as it depends on its output.
66
- plugins[ 'typedoc-plugin-event-inheritance-fixer' ],
67
-
68
- // The `event-param-fixer` plugin must be loaded after `tag-event` and `tag-observable` plugins, as it depends on their output.
69
- plugins[ 'typedoc-plugin-event-param-fixer' ],
70
-
71
60
  ...extraPlugins
72
61
  ]
73
62
  } );
74
63
 
64
+ plugins.typeDocRestoreProgramAfterConversion( app );
65
+ plugins.typeDocModuleFixer( app );
66
+ plugins.typeDocSymbolFixer( app );
67
+ plugins.typeDocTagError( app );
68
+ plugins.typeDocTagEvent( app );
69
+ plugins.typeDocTagObservable( app );
70
+ plugins.typeDocEventParamFixer( app );
71
+ plugins.typeDocEventInheritanceFixer( app );
72
+ plugins.typeDocInterfaceAugmentationFixer( app );
73
+ plugins.typeDocPurgePrivateApiDocs( app );
74
+ plugins.typeDocReferenceFixer( app );
75
+ plugins.typeDocOutputCleanUp( app );
76
+ plugins.validate( app, validatorOptions );
77
+
75
78
  console.log( 'Typedoc started...' );
76
79
 
77
- const conversionResult = typeDoc.convert();
80
+ const conversionResult = await app.convert();
78
81
 
79
82
  if ( !conversionResult ) {
80
83
  throw 'Something went wrong with TypeDoc.';
81
84
  }
82
85
 
83
- const validationResult = validators.validate( conversionResult, typeDoc, validatorOptions );
84
-
85
- if ( !validationResult && strictMode ) {
86
- throw 'Something went wrong with TypeDoc.';
87
- }
88
-
89
86
  if ( config.outputPath ) {
90
- await typeDoc.generateJson( conversionResult, config.outputPath );
87
+ await app.generateJson( conversionResult, config.outputPath );
91
88
  }
92
89
 
93
90
  console.log( `Documented ${ files.length } files!` );
@@ -108,6 +105,9 @@ export default async function build( config ) {
108
105
  *
109
106
  * @property {boolean} [strict=false] If `true`, errors found during the validation will finish the process
110
107
  * and exit code will be changed to `1`.
108
+ *
109
+ * @property {boolean} [verbose=false] If `true`, the output will be verbose.
110
+ *
111
111
  * @property {string} [outputPath] A path to the place where extracted doclets will be saved. Is an optional value due to tests.
112
112
  *
113
113
  * @property {string} [extraPlugins=[]] An array of path to extra plugins that will be added to Typedoc.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-dev-docs",
3
- "version": "47.1.1",
3
+ "version": "49.0.0",
4
4
  "description": "Tasks used to build and verify the documentation for CKEditor 5.",
5
5
  "keywords": [],
6
6
  "author": "CKSource (http://cksource.com/)",
@@ -22,12 +22,10 @@
22
22
  "lib"
23
23
  ],
24
24
  "dependencies": {
25
- "@ckeditor/ckeditor5-dev-utils": "^47.1.1",
26
- "@ckeditor/typedoc-plugins": "^47.1.1",
27
- "glob": "^10.0.0",
28
- "fs-extra": "^11.0.0",
29
- "tmp": "^0.2.1",
30
- "typedoc": "^0.23.15",
31
- "typedoc-plugin-rename-defaults": "0.6.6"
25
+ "@ckeditor/typedoc-plugins": "^49.0.0",
26
+ "glob": "^11.0.1",
27
+ "typedoc": "0.28.4",
28
+ "typedoc-plugin-rename-defaults": "^0.7.3",
29
+ "upath": "^2.0.1"
32
30
  }
33
31
  }
@@ -1,58 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md.
4
- */
5
-
6
- import { ReflectionKind } from 'typedoc';
7
- import typedocPlugins from '@ckeditor/typedoc-plugins';
8
-
9
- /**
10
- * Validates the output produced by TypeDoc.
11
- *
12
- * It checks if the event in the "@fires" tag exists.
13
- *
14
- * @param {object} project Generated output from TypeDoc to validate.
15
- * @param {function} onError A callback that is executed when a validation error is detected.
16
- */
17
- export default function validate( project, onError ) {
18
- const { utils } = typedocPlugins;
19
- const reflections = project
20
- .getReflectionsByKind( ReflectionKind.Class | ReflectionKind.CallSignature )
21
- .filter( utils.isReflectionValid );
22
-
23
- for ( const reflection of reflections ) {
24
- const identifiers = getIdentifiersFromFiresTag( reflection );
25
-
26
- if ( !identifiers.length ) {
27
- continue;
28
- }
29
-
30
- for ( const identifier of identifiers ) {
31
- const isValid = utils.isIdentifierValid( reflection, identifier );
32
-
33
- if ( !isValid ) {
34
- const eventName = identifier.replace( /^#event:/, '' );
35
-
36
- onError( `Incorrect event name: "${ eventName }" in the @fires tag`, reflection );
37
- }
38
- }
39
- }
40
- }
41
-
42
- function getIdentifiersFromFiresTag( reflection ) {
43
- const { utils } = typedocPlugins;
44
-
45
- if ( !reflection.comment ) {
46
- return [];
47
- }
48
-
49
- return reflection.comment.getTags( '@fires' )
50
- .flatMap( tag => tag.content.map( item => item.text.trim() ) )
51
- .map( identifier => {
52
- if ( utils.isAbsoluteIdentifier( identifier ) ) {
53
- return identifier;
54
- }
55
-
56
- return '#event:' + identifier;
57
- } );
58
- }
@@ -1,57 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md.
4
- */
5
-
6
- import typedocPlugins from '@ckeditor/typedoc-plugins';
7
- import seeValidator from './see-validator/index.js';
8
- import linkValidator from './link-validator/index.js';
9
- import firesValidator from './fires-validator/index.js';
10
- import moduleValidator from './module-validator/index.js';
11
- import overloadsValidator from './overloads-validator/index.js';
12
-
13
- /**
14
- * Validates the CKEditor 5 documentation.
15
- *
16
- * @param {object} project Generated output from TypeDoc to validate.
17
- * @param {object} typeDoc A TypeDoc application instance.
18
- * @param {TypedocValidator} [options={}] A configuration object.
19
- * @returns {boolean}
20
- */
21
- export default {
22
- validate( project, typeDoc, options = {} ) {
23
- const { utils } = typedocPlugins;
24
- const validators = [
25
- seeValidator,
26
- linkValidator,
27
- firesValidator,
28
- moduleValidator
29
- ];
30
-
31
- if ( options.enableOverloadValidator ) {
32
- validators.push( overloadsValidator );
33
- }
34
-
35
- typeDoc.logger.info( 'Starting validation...' );
36
-
37
- // The same error can be reported twice:
38
- //
39
- // 1. When processing types and events (comments are copied from a type to an event).
40
- // 2. When a parent class defines an invalid link, inherited members link to the invalid link too.
41
- const errors = new Map();
42
-
43
- for ( const validator of validators ) {
44
- validator( project, ( error, reflection ) => {
45
- const node = utils.getNode( reflection );
46
-
47
- errors.set( node, { error, node } );
48
- } );
49
- }
50
-
51
- errors.forEach( ( { error, node } ) => typeDoc.logger.warn( error, node ) );
52
-
53
- typeDoc.logger.info( 'Validation completed.' );
54
-
55
- return !errors.size;
56
- }
57
- };
@@ -1,58 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md.
4
- */
5
-
6
- import { ReflectionKind } from 'typedoc';
7
- import typedocPlugins from '@ckeditor/typedoc-plugins';
8
-
9
- /**
10
- * Validates the output produced by TypeDoc.
11
- *
12
- * It checks if the identifier in the "@link" tag points to an existing doclet.
13
- *
14
- * @param {object} project Generated output from TypeDoc to validate.
15
- * @param {function} onError A callback that is executed when a validation error is detected.
16
- */
17
- export default function validate( project, onError ) {
18
- const { utils } = typedocPlugins;
19
- const reflections = project.getReflectionsByKind( ReflectionKind.All ).filter( utils.isReflectionValid );
20
-
21
- for ( const reflection of reflections ) {
22
- const identifiers = getIdentifiersFromLinkTag( reflection );
23
-
24
- if ( !identifiers.length ) {
25
- continue;
26
- }
27
-
28
- for ( const identifier of identifiers ) {
29
- const isValid = utils.isIdentifierValid( reflection, identifier );
30
-
31
- if ( !isValid ) {
32
- onError( `Incorrect link: "${ identifier }"`, reflection );
33
- }
34
- }
35
- }
36
- }
37
-
38
- function getIdentifiersFromLinkTag( reflection ) {
39
- if ( !reflection.comment ) {
40
- return [];
41
- }
42
-
43
- // The "@link" tag can be located in the comment summary or it can be nested in other block tags.
44
- const parts = [
45
- ...reflection.comment.summary,
46
- ...reflection.comment.blockTags.flatMap( tag => tag.content )
47
- ];
48
-
49
- return parts
50
- .filter( part => part.kind === 'inline-tag' && part.tag === '@link' )
51
- .map( part => {
52
- // The "@link" tag may contain the actual identifier and the display name after a space.
53
- // Split by space to extract only the identifier from the whole tag.
54
- const [ identifier ] = part.text.split( ' ' );
55
-
56
- return identifier;
57
- } );
58
- }
@@ -1,55 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md.
4
- */
5
-
6
- import { ReflectionKind } from 'typedoc';
7
- import typedocPlugins from '@ckeditor/typedoc-plugins';
8
-
9
- const AUGMENTATION_MODULE_REGEXP = /[^\\/]+[\\/]src[\\/]augmentation/;
10
-
11
- /**
12
- * Validates the output produced by TypeDoc.
13
- *
14
- * It checks if the module name matches the path to the file where the module is defined.
15
- *
16
- * @param {object} project Generated output from TypeDoc to validate.
17
- * @param {function} onError A callback that is executed when a validation error is detected.
18
- */
19
- export default function validate( project, onError ) {
20
- const { utils } = typedocPlugins;
21
- const reflections = project.getReflectionsByKind( ReflectionKind.Module );
22
-
23
- for ( const reflection of reflections ) {
24
- // The augmentation module does not contain the `@module` annotation. We need to skip it.
25
- if ( reflection.name.match( AUGMENTATION_MODULE_REGEXP ) ) {
26
- continue;
27
- }
28
-
29
- const [ packageName, ...moduleName ] = reflection.name.split( '/' );
30
-
31
- // If there is no module name after the package name, skip it.
32
- if ( !moduleName.length ) {
33
- continue;
34
- }
35
-
36
- const node = utils.getNode( reflection );
37
-
38
- // Not a ES6 module.
39
- if ( !node ) {
40
- continue;
41
- }
42
-
43
- const filePath = node.fileName;
44
-
45
- if ( filePath.endsWith( 'src/augmentation.ts' ) ) {
46
- continue;
47
- }
48
-
49
- const expectedFilePath = `ckeditor5-${ packageName }/src/${ moduleName.join( '/' ) }.ts`;
50
-
51
- if ( !filePath.endsWith( expectedFilePath ) ) {
52
- onError( `Invalid module name: "${ reflection.name }"`, reflection );
53
- }
54
- }
55
- }
@@ -1,54 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md.
4
- */
5
-
6
- import { ReflectionKind } from 'typedoc';
7
- import typedocPlugins from '@ckeditor/typedoc-plugins';
8
-
9
- // The `@label` validator is currently not used.
10
- // See: https://github.com/ckeditor/ckeditor5/issues/13591.
11
-
12
- /**
13
- * Validates the output produced by TypeDoc.
14
- *
15
- * It checks if overloaded methods and functions are described with the mandatory "@label" tag.
16
- *
17
- * Also, it prevents using the same name twice for overloaded structures.
18
- *
19
- * @param {object} project Generated output from TypeDoc to validate.
20
- * @param {function} onError A callback that is executed when a validation error is detected.
21
- */
22
- export default function validate( project, onError ) {
23
- const { utils } = typedocPlugins;
24
- const kinds = ReflectionKind.Method | ReflectionKind.Constructor | ReflectionKind.Function;
25
- const reflections = project.getReflectionsByKind( kinds ).filter( utils.isReflectionValid );
26
-
27
- for ( const reflection of reflections ) {
28
- // Omit non-overloaded structures.
29
- if ( reflection.signatures.length === 1 ) {
30
- continue;
31
- }
32
-
33
- const uniqueValues = new Set();
34
-
35
- const isInherited = !!reflection.inheritedFrom;
36
- const errorMessageSuffix = isInherited ? ' due the inherited structure' : '';
37
-
38
- for ( const signature of reflection.signatures ) {
39
- // Check if a signature has a label...
40
- if ( signature.comment && signature.comment.getTag( '@label' ) ) {
41
- const [ { text: label } ] = signature.comment.getTag( '@label' ).content;
42
-
43
- // ...and whether it is a unique value.
44
- if ( uniqueValues.has( label ) ) {
45
- onError( `Duplicated name: "${ label }" in the @label tag` + errorMessageSuffix, signature );
46
- } else {
47
- uniqueValues.add( label );
48
- }
49
- } else {
50
- onError( 'Overloaded signature misses the @label tag' + errorMessageSuffix, signature );
51
- }
52
- }
53
- }
54
- }
@@ -1,58 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md.
4
- */
5
-
6
- import { ReflectionKind } from 'typedoc';
7
- import typedocPlugins from '@ckeditor/typedoc-plugins';
8
-
9
- /**
10
- * Validates the output produced by TypeDoc.
11
- *
12
- * It checks if the identifier in the "@see" tag points to an existing doclet.
13
- *
14
- * @param {object} project Generated output from TypeDoc to validate.
15
- * @param {function} onError A callback that is executed when a validation error is detected.
16
- */
17
- export default function validate( project, onError ) {
18
- const { utils } = typedocPlugins;
19
- const reflections = project.getReflectionsByKind( ReflectionKind.All ).filter( utils.isReflectionValid );
20
-
21
- for ( const reflection of reflections ) {
22
- const identifiers = getIdentifiersFromSeeTag( reflection );
23
-
24
- if ( !identifiers.length ) {
25
- continue;
26
- }
27
-
28
- for ( const identifier of identifiers ) {
29
- const isValid = utils.isIdentifierValid( reflection, identifier );
30
-
31
- if ( !isValid ) {
32
- onError( `Incorrect link: "${ identifier }"`, reflection );
33
- }
34
- }
35
- }
36
- }
37
-
38
- function getIdentifiersFromSeeTag( reflection ) {
39
- if ( !reflection.comment ) {
40
- return [];
41
- }
42
-
43
- return reflection.comment.getTags( '@see' )
44
- .flatMap( tag => tag.content.map( item => item.text.trim() ) )
45
- .filter( text => {
46
- // Remove list markers (e.g. "-").
47
- if ( text.length <= 1 ) {
48
- return false;
49
- }
50
-
51
- // Remove external links.
52
- if ( /^https?:\/\//.test( text ) ) {
53
- return false;
54
- }
55
-
56
- return true;
57
- } );
58
- }