Skip to content

Commit f4c4874

Browse files
committed
JSDoc cleanup
1 parent f4e3f6d commit f4c4874

File tree

6 files changed

+66
-58
lines changed

6 files changed

+66
-58
lines changed

lib/graph/Module.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,21 @@ class Module {
8080
return this._modulePath;
8181
}
8282

83+
/**
84+
* Specifications found in the module
85+
*
86+
* @public
87+
* @typedef {object} SpecificationsResult
88+
* @property {@ui5/project.specifications.Project|undefined} Project found in the module (if one is found)
89+
* @property {@ui5/project.specifications.Extension[]} Array of extensions found in the module
90+
*
91+
*/
92+
93+
/**
94+
* Get any available project and extensions of the module
95+
*
96+
* @returns {SpecificationsResult} Project and extensions found in the module
97+
*/
8398
async getSpecifications() {
8499
if (this._pGetSpecifications) {
85100
return this._pGetSpecifications;

lib/graph/ProjectGraph.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ class ProjectGraph {
2727
this._shouldResolveOptionalDependencies = false; // Performance optimization flag
2828
}
2929

30+
/**
31+
* @public
32+
* @returns {module:@ui5/project.specification.Project} Root project
33+
*/
3034
getRoot() {
3135
const rootProject = this._projects[this._rootProjectName];
3236
if (!rootProject) {
@@ -224,9 +228,14 @@ class ProjectGraph {
224228
}
225229

226230
/**
231+
* Transforms any optional dependencies in the graph for which the target is referenced by
232+
* at least one non-optional project
233+
* into a non-optional dependency.
234+
*
227235
* @public
228236
*/
229237
resolveOptionalDependencies() {
238+
// TODO: If a project is referenced as non-optional by an *optional* dependency, it should still be optional
230239
if (!this._shouldResolveOptionalDependencies) {
231240
log.verbose(`Skipping resolution of optional dependencies since none have been declared`);
232241
return;

lib/graph/projectGraphBuilder.js

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,43 @@ function _handleExtensions(graph, shimCollection, extensions) {
2424
}
2525

2626
/**
27-
* Tree node
27+
* Dependency graph node representing a module
2828
*
2929
* @public
30-
* @typedef {object} TreeNode
30+
* @typedef {object} Node
3131
* @property {string} node.id Unique ID for the project
3232
* @property {string} node.version Version of the project
3333
* @property {string} node.path File System path to access the projects resources
3434
* @property {object|object[]} [node.configuration]
3535
* Configuration object or array of objects to use instead of reading from a configuration file
3636
* @property {string} [node.configPath] Configuration file to use instead the default ui5.yaml
37-
* @property {TreeNode[]} dependencies
37+
* @property {boolean} [node.optional]
38+
* Whether the node is an optional dependency of the parent it has been requested for
39+
* @property {*} * Additional attributes are allowed but ignored.
40+
* These can be used to pass information internally in the provider.
41+
*/
42+
43+
/**
44+
* Node Provider interface
45+
*
46+
* @interface NodeProvider
47+
*/
48+
49+
/**
50+
* Retrieve information on the root module
51+
*
52+
* @function
53+
* @name NodeProvider#getRootNode
54+
* @returns {Node} The root node of the dependency graph
55+
*/
56+
57+
/**
58+
* Retrieve information on given a nodes dependencies
59+
*
60+
* @function
61+
* @name NodeProvider#getDependencies
62+
* @param {Node} The root node of the dependency graph
63+
* @returns {Node[]} Array of nodes which are direct dependencies of the given node
3864
*/
3965

4066
/**
@@ -43,7 +69,7 @@ function _handleExtensions(graph, shimCollection, extensions) {
4369
*
4470
* @public
4571
* @alias module:@ui5/project.graph.projectGraphBuilder
46-
* @param {ModuleProvider} nodeProvider Dependency tree as returned by a translator
72+
* @param {NodeProvider} nodeProvider
4773
* @returns {module:@ui5/project.graph.ProjectGraph} A new project graph instance
4874
*/
4975
module.exports = async function(nodeProvider) {

lib/specifications/Configuration.js

Lines changed: 0 additions & 54 deletions
This file was deleted.

lib/specifications/Project.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,30 @@ class Project extends Specification {
5151

5252
/* === Resource Access === */
5353
/**
54+
* Get a resource reader for the sources of the project (excluding any test resources)
55+
*
5456
* @public
57+
* @returns {module:@ui5/fs.ReaderCollection} Reader collection
5558
*/
5659
getSourceReader() {
5760
throw new Error(`getSourceReader must be implemented by subclass ${this.constructor.name}`);
5861
}
5962

6063
/**
64+
* Get a resource reader for accessing the project resources the same way the UI5 runtime would do
65+
*
6166
* @public
67+
* @returns {module:@ui5/fs.ReaderCollection} Reader collection
6268
*/
6369
getRuntimeReader() {
6470
throw new Error(`getRuntimeReader must be implemented by subclass ${this.constructor.name}`);
6571
}
6672

6773
/**
74+
* Get a resource reader for accessing the project resources during the build process
75+
*
6876
* @public
77+
* @returns {module:@ui5/fs.ReaderCollection} Reader collection
6978
*/
7079
getBuildtimeReader() {
7180
throw new Error(`getBuildtimeReader must be implemented by subclass ${this.constructor.name}`);

lib/specifications/Specification.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ class Specification {
130130

131131
/* === Resource Access === */
132132
/**
133+
* Get a resource reader for the root directory of the project
134+
*
133135
* @public
136+
* @returns {module:@ui5/fs.ReaderCollection} Reader collection
134137
*/
135138
getRootReader() {
136139
return resourceFactory.createReader({

0 commit comments

Comments
 (0)