@ui5/builder 4.0.3 → 4.0.5

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.
@@ -1,15 +1,14 @@
1
- /*
1
+ /**
2
2
  * Node script to preprocess api.json files for use in the UI5 SDKs.
3
3
  *
4
4
  * (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
5
5
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
6
6
  */
7
7
 
8
- /* eslint-disable */
9
-
10
8
  "use strict";
11
9
  const cheerio = require("cheerio");
12
10
  const path = require('path');
11
+ const {TypeParser} = require("./ui5/template/utils/typeParser");
13
12
  const log = (function() {
14
13
  try {
15
14
  return require("@ui5/logger").getLogger("builder:processors:jsdoc:transformApiJson");
@@ -36,13 +35,9 @@ function normalizeToUI5GlobalNotation(sModuleName){
36
35
  return sModuleName.replace(/\//g, ".");
37
36
  }
38
37
 
39
- function fnCreateTypesArr(sTypes) {
40
- return sTypes.split("|").map(function (sType) {
41
- return { value: sType }
42
- });
43
- }
38
+ const typeParser = new TypeParser();
44
39
 
45
- /*
40
+ /**
46
41
  * Transforms the api.json as created by the JSDoc build into a pre-processed api.json file suitable for the SDK.
47
42
  *
48
43
  * The pre-processing includes formatting of type references, rewriting of links and other time consuming calculations.
@@ -69,72 +64,208 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
69
64
  log.info("Using custom fs.");
70
65
  }
71
66
  if (returnOutputFiles) {
72
- log.info("Returning output files instead of writing to fs.")
67
+ log.info("Returning output files instead of writing to fs.");
73
68
  }
74
69
  log.info("");
75
70
 
76
71
  function resolveTypeParameters(func) {
77
- if ( func.typeParameters ) {
78
- const replacements = Object.create(null);
79
- let regex;
80
- const _resolve = (str) =>
81
- str && regex ? str.replace(regex, (_,prefix,token,suffix) => prefix + replacements[token] + suffix) : str;
82
-
83
- func.typeParameters.forEach((typeParam) => {
84
- typeParam.type = _resolve(typeParam.type);
85
- replacements[typeParam.name] = typeParam.type || "any";
86
- regex = new RegExp("(^|\\W)(" + Object.keys(replacements).join("|") + ")(\\W|$)");
87
- typeParam.default = _resolve(typeParam.default);
88
- });
89
-
90
- function _resolveParamProperties(param) {
91
- if ( param.parameterProperties ) {
92
- Object.keys(param.parameterProperties).forEach((key) => {
93
- const prop = param.parameterProperties[key];
94
- prop.type = _resolve(prop.type);
95
- _resolveParamProperties(prop);
96
- });
97
- }
98
- }
72
+ if ( !func.typeParameters ) {
73
+ return func;
74
+ }
75
+ const replacements = Object.create(null);
76
+ let regex;
77
+ const _resolve = (str) =>
78
+ (str && regex ? str.replace(regex, (_,prefix,token,suffix) => prefix + replacements[token] + suffix) : str);
79
+
80
+ func.typeParameters.forEach((typeParam) => {
81
+ typeParam.type = _resolve(typeParam.type);
82
+ replacements[typeParam.name] = typeParam.type || "any";
83
+ regex = new RegExp("(^|\\W)(" + Object.keys(replacements).join("|") + ")(\\W|$)");
84
+ typeParam.default = _resolve(typeParam.default);
85
+ });
99
86
 
100
- if ( func.returnValue ) {
101
- func.returnValue.type = _resolve(func.returnValue.type);
102
- }
103
- if ( func.parameters ) {
104
- func.parameters.forEach((param) => {
105
- param.type = _resolve(param.type);
106
- _resolveParamProperties(param);
107
- });
108
- }
109
- if ( func.throws ) {
110
- func.throws.forEach((ex) => {
111
- ex.type = _resolve(ex.type);
87
+ function _resolveParamProperties(param) {
88
+ if ( param.parameterProperties ) {
89
+ Object.keys(param.parameterProperties).forEach((key) => {
90
+ const prop = param.parameterProperties[key];
91
+ prop.type = _resolve(prop.type);
92
+ _resolveParamProperties(prop);
112
93
  });
113
94
  }
114
- console.log(func);
95
+ }
96
+
97
+ if ( func.returnValue ) {
98
+ func.returnValue.type = _resolve(func.returnValue.type);
99
+ }
100
+ if ( func.parameters ) {
101
+ func.parameters.forEach((param) => {
102
+ param.type = _resolve(param.type);
103
+ _resolveParamProperties(param);
104
+ });
105
+ }
106
+ if ( func.throws ) {
107
+ func.throws.forEach((ex) => {
108
+ ex.type = _resolve(ex.type);
109
+ });
115
110
  }
116
111
  return func;
117
112
  }
118
113
 
114
+ function isUI5Type(sType) {
115
+ return !isBuiltInType(sType) && possibleUI5Symbol(sType);
116
+ }
117
+
119
118
  /**
120
- * Transforms api.json file
121
- * @param {object} oChainObject chain object
119
+ * Returns an object with the parsed custom-type information, namely:
120
+ * - types: array of the parsed UI5 types inside the given complex type
121
+ * - template: the template string with placeholders for the parsed UI5 types
122
+ *
123
+ * Examples:
124
+ *
125
+ * - parseUI5Types("sap.ui.core.ID | sap.ui.core.Control") returns
126
+ * {
127
+ * template: "${0} | ${1}",
128
+ * UI5Types: ["sap.ui.core.ID", "sap.ui.core.Control"]
129
+ * }
130
+ *
131
+ * - parseUI5Types("Array<sap.ui.core.Control>") returns
132
+ * {
133
+ * template: "Array<${0}>",
134
+ * UI5Types: ["sap.ui.core.Control"]
135
+ * }
136
+ *
137
+ * - parseUI5Types("Array<sap.ui.core.ID|string>") returns
138
+ * {
139
+ * template: "Array<${0} | string>", // built-in types remain unchanged in the template
140
+ * UI5Types: ["sap.ui.core.ID"]
141
+ * }
142
+ *
143
+ * - parseUI5Types("Object<string, sap.ui.core.Control>") returns
144
+ * {
145
+ * template: "Object<string, ${0}>", // built-in types remain unchanged in the template
146
+ * UI5Types: ["sap.ui.core.Control"]
147
+ * }
148
+ *
149
+ * - parseUI5Types("string") returns
150
+ * {
151
+ * template: "string" // skip the types array if empty
152
+ * }
153
+ *
154
+ * - parseUI5Types("sap.ui.core.Control") returns
155
+ * {
156
+ * UI5Types: ["sap.ui.core.Control"] // skip template if its value is "${0}" (default value)
157
+ * }
158
+ * @param {string} sComplexType
159
+ * @returns {{template=: string, UI5Types=: string[]}}
122
160
  */
123
- let transformApiJson = function (oChainObject) {
124
- function isBuiltInType(type) {
125
- return formatters._baseTypes.indexOf(type) >= 0;
161
+ function parseUI5Types(sComplexType) {
162
+ let oParsed;
163
+ try {
164
+ oParsed = typeParser.parseSimpleTypes(sComplexType, isUI5Type);
165
+ } catch (e) {
166
+ log.error("Error parsing type: " + sComplexType);
167
+ log.error(e);
168
+ oParsed = { template: sComplexType };
126
169
  }
127
170
 
128
- /**
129
- * Heuristically determining if there is a possibility the given input string
130
- * to be a UI5 symbol
131
- * @param {string} sName
132
- * @returns {boolean}
133
- */
134
- function possibleUI5Symbol(sName) {
135
- return /^[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9]$/.test(sName);
171
+ const result = {};
172
+
173
+ if (oParsed.template !== '${0}') { // default is '${0}', so omit if not required
174
+ result.template = oParsed.template;
175
+ }
176
+
177
+ if (oParsed.simpleTypes?.length) { // it can be empty if none of the included simple types satisfied the filter function
178
+ result.UI5Types = oParsed.simpleTypes;
179
+ }
180
+
181
+ return result;
182
+ }
183
+
184
+ function includesIgnoreCase(array, string) {
185
+ return array.some((item) => item.toLowerCase() === string.toLowerCase());
186
+ }
187
+
188
+ /**
189
+ * Check if a type is a built-in type, handling both simple
190
+ * and compound types gracefully.
191
+ *
192
+ * @param {string} type A type to check
193
+ * @returns {boolean} true if the type is built-in, otherwise false
194
+ */
195
+ function isBuiltInType(type) {
196
+ const builtInTypes = formatters._baseTypes;
197
+
198
+ // Early return if the type is directly in baseTypes
199
+ if (includesIgnoreCase(builtInTypes, type)) {
200
+ return true;
201
+ }
202
+
203
+ // Check if the type is a union type
204
+ if (type.includes("|")) {
205
+ const unionParts = type.split("|").map((part) => part.trim());
206
+ return unionParts.every((part) => isBuiltInType(part));
207
+ }
208
+
209
+ // Handle array notation directly
210
+ if (type.endsWith("[]")) {
211
+ return builtInTypes.includes(type.slice(0, -2));
212
+ }
213
+
214
+ // Predefined regex patterns for reuse
215
+ const arrayRegex = /Array<(.+)>/;
216
+ const arrayDotRegex = /Array\.<(.+)>/;
217
+ const objectRegex = /Object<([^,]+),([^>]+)>/;
218
+ const objectDotRegex = /Object\.<([^,]+),([^>]+)>/;
219
+
220
+ // Check if the type is a generic Array type
221
+ const arrayMatch = arrayRegex.exec(type);
222
+ if (arrayMatch) {
223
+ const innerType = arrayMatch[1];
224
+ return isBuiltInType(innerType);
225
+ }
226
+
227
+ const arrayDotMatch = arrayDotRegex.exec(type);
228
+ if (arrayDotMatch) {
229
+ const innerType = arrayDotMatch[1];
230
+ return isBuiltInType(innerType);
136
231
  }
137
232
 
233
+ // Check if the type is a generic Object type
234
+ const objectMatch = objectRegex.exec(type);
235
+ if (objectMatch) {
236
+ const innerTypes = [objectMatch[1], objectMatch[2]].map((t) => t.trim());
237
+ return innerTypes.every((innerType) => isBuiltInType(innerType));
238
+ }
239
+
240
+ const objectDotMatch = objectDotRegex.exec(type);
241
+ if (objectDotMatch) {
242
+ const innerTypes = [objectDotMatch[1], objectDotMatch[2]].map((t) => t.trim());
243
+ return innerTypes.every((innerType) => isBuiltInType(innerType));
244
+ }
245
+
246
+ // Fallback case: if none of the above matched, return false
247
+ return false;
248
+ }
249
+
250
+ /**
251
+ * Heuristically determining if there is a possibility the given input string
252
+ * to be a UI5 symbol
253
+ * Examples of UI5 symbols:
254
+ * -"sap.ui.core.date.UI5Date"
255
+ * -"module:sap/ui/core/date/UI5Date"
256
+ * @param {string} sName
257
+ * @returns {boolean}
258
+ */
259
+ function possibleUI5Symbol(sName) {
260
+ const ui5SymbolRegex = /^(module:)?sap[/.][a-zA-Z][a-zA-Z0-9/.$]*[a-zA-Z0-9]$/;
261
+ return ui5SymbolRegex.test(sName);
262
+ }
263
+
264
+ /**
265
+ * Transforms api.json file
266
+ * @param {object} oChainObject chain object
267
+ */
268
+ const transformApiJson = function (oChainObject) {
138
269
  // Function is a copy from: LibraryInfo.js => LibraryInfo.prototype._getActualComponent => "match" inline method
139
270
  function matchComponent(sModuleName, sPattern) {
140
271
  sModuleName = sModuleName.toLowerCase();
@@ -153,18 +284,18 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
153
284
  */
154
285
  function preProcessSymbols(symbols) {
155
286
  // Create treeName and modify module names
156
- symbols.forEach(oSymbol => {
157
- let sModuleClearName = oSymbol.name.replace(/^module:/, "");
287
+ symbols.forEach((oSymbol) => {
288
+ const sModuleClearName = oSymbol.name.replace(/^module:/, "");
158
289
  oSymbol.displayName = sModuleClearName;
159
290
  oSymbol.treeName = normalizeToUI5GlobalNotation(sModuleClearName);
160
291
  });
161
292
 
162
293
  // Create missing - virtual namespaces
163
- symbols.forEach(oSymbol => {
294
+ symbols.forEach((oSymbol) => {
164
295
  oSymbol.treeName.split(".").forEach((sPart, i, a) => {
165
- let sName = a.slice(0, (i + 1)).join(".");
296
+ const sName = a.slice(0, (i + 1)).join(".");
166
297
 
167
- if (!symbols.find(o => o.treeName === sName)) {
298
+ if (!symbols.find((o) => o.treeName === sName)) {
168
299
  symbols.push({
169
300
  name: sName,
170
301
  displayName: sName,
@@ -177,13 +308,12 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
177
308
  });
178
309
 
179
310
  // Discover parents
180
- symbols.forEach(oSymbol => {
181
- let aParent = oSymbol.treeName.split("."),
182
- sParent;
311
+ symbols.forEach((oSymbol) => {
312
+ const aParent = oSymbol.treeName.split(".");
183
313
 
184
314
  // Extract parent name
185
315
  aParent.pop();
186
- sParent = aParent.join(".");
316
+ const sParent = aParent.join(".");
187
317
 
188
318
  // Mark parent
189
319
  if (symbols.find(({treeName}) => treeName === sParent)) {
@@ -192,14 +322,13 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
192
322
  });
193
323
 
194
324
  // Attach children info
195
- symbols.forEach(oSymbol => {
325
+ symbols.forEach((oSymbol) => {
196
326
  if (oSymbol.parent) {
197
- let oParent = symbols.find(({treeName}) => treeName === oSymbol.parent),
198
- oNode;
327
+ const oParent = symbols.find(({treeName}) => treeName === oSymbol.parent);
199
328
 
200
- if (!oParent.nodes) oParent.nodes = [];
329
+ if (!oParent.nodes) {oParent.nodes = [];}
201
330
 
202
- oNode = {
331
+ const oNode = {
203
332
  name: oSymbol.displayName,
204
333
  description: formatters._preProcessLinksInTextBlock(
205
334
  extractFirstSentence(oSymbol.description)
@@ -216,14 +345,14 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
216
345
  });
217
346
 
218
347
  // Clean list - keep file size down
219
- symbols.forEach(o => {
348
+ symbols.forEach((o) => {
220
349
  delete o.treeName;
221
350
  delete o.parent;
222
351
  });
223
352
  }
224
353
 
225
354
  // Transform to object
226
- let oData = oChainObject.fileData;
355
+ const oData = oChainObject.fileData;
227
356
 
228
357
  // Attach default component for the library if available
229
358
  if (oChainObject.defaultComponent) {
@@ -246,7 +375,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
246
375
  // Attach symbol specific component if available (special cases)
247
376
  // Note: Last hit wins as there may be a more specific component pattern
248
377
  if (oChainObject.customSymbolComponents) {
249
- Object.keys(oChainObject.customSymbolComponents).forEach(sComponent => {
378
+ Object.keys(oChainObject.customSymbolComponents).forEach((sComponent) => {
250
379
  if (matchComponent(normalizeToUI5GlobalNotation(oSymbol.displayName), sComponent)) {
251
380
  oSymbol.component = oChainObject.customSymbolComponents[sComponent];
252
381
  }
@@ -268,7 +397,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
268
397
 
269
398
  // Constructor
270
399
  if (oSymbol.constructor) {
271
- let oConstructor = resolveTypeParameters(oSymbol.constructor);
400
+ const oConstructor = resolveTypeParameters(oSymbol.constructor);
272
401
 
273
402
  // Description
274
403
  if (oConstructor.description) {
@@ -300,21 +429,13 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
300
429
  if (oConstructor.parameters) {
301
430
  oConstructor.parameters = methods.buildConstructorParameters(oConstructor.parameters);
302
431
 
303
- let aParameters = oConstructor.parameters;
304
- aParameters.forEach(oParameter => {
432
+ const aParameters = oConstructor.parameters;
433
+ aParameters.forEach((oParameter) => {
305
434
 
306
435
  // Types
307
436
  oParameter.types = [];
308
437
  if (oParameter.type) {
309
- let aTypes = oParameter.type.split("|");
310
-
311
- for (let i = 0; i < aTypes.length; i++) {
312
- oParameter.types.push({
313
- name: aTypes[i],
314
- linkEnabled: !isBuiltInType(aTypes[i])
315
- });
316
- }
317
-
438
+ oParameter.typeInfo = parseUI5Types(oParameter.type);
318
439
  // Keep file size in check
319
440
  delete oParameter.type;
320
441
  }
@@ -327,12 +448,12 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
327
448
  oParameter.description = formatters.formatDescription(oParameter.description);
328
449
  }
329
450
 
330
- })
451
+ });
331
452
  }
332
453
 
333
454
  // Throws
334
455
  if (oConstructor.throws) {
335
- oConstructor.throws.forEach(oThrows => {
456
+ oConstructor.throws.forEach((oThrows) => {
336
457
 
337
458
  // Description
338
459
  if (oThrows.description) {
@@ -399,17 +520,9 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
399
520
  // Type
400
521
  if (oSymbol.kind !== "enum") { // enum properties don't have an own type
401
522
  if (oProperty.type) {
402
- oProperty.types = oProperty.type.split("|").map((sType) => {
403
- const oType = {
404
- value: sType
405
- };
406
- // Link Enabled
407
- if (!isBuiltInType(oType.value) && possibleUI5Symbol(oType.value)) {
408
- oType.linkEnabled = true;
409
- oType.href = "api/" + oType.value.replace("[]", "");
410
- }
411
- return oType;
412
- });
523
+ oProperty.typeInfo = parseUI5Types(oProperty.type);
524
+ // Keep file size in check
525
+ delete oProperty.type;
413
526
  }
414
527
  }
415
528
 
@@ -425,7 +538,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
425
538
 
426
539
  // UI5 Metadata
427
540
  if (oSymbol["ui5-metadata"]) {
428
- let oMeta = oSymbol["ui5-metadata"];
541
+ const oMeta = oSymbol["ui5-metadata"];
429
542
 
430
543
  // Properties
431
544
  if (oMeta.properties) {
@@ -447,17 +560,14 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
447
560
 
448
561
  // Type
449
562
  if (oProperty.type) {
450
- oProperty.types = fnCreateTypesArr(oProperty.type);
563
+ oProperty.typeInfo = parseUI5Types(oProperty.type);
564
+ // Keep file size in check
565
+ delete oProperty.type;
451
566
  }
452
567
 
453
568
  // Description
454
569
  oProperty.description = formatters.formatDescriptionSince(oProperty.description, oProperty.since);
455
570
 
456
- // Link Enabled
457
- if (!isBuiltInType(oProperty.type)) {
458
- oProperty.linkEnabled = true;
459
- }
460
-
461
571
  // Default value
462
572
  oProperty.defaultValue = formatters.formatDefaultValue(oProperty.defaultValue);
463
573
 
@@ -540,29 +650,31 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
540
650
  // Events
541
651
  if (oMeta.events) {
542
652
 
543
- oMeta.events.forEach(oEvent => {
544
- let aParams = oEvent.parameters;
545
-
546
- aParams && Object.keys(aParams).forEach(sParam => {
547
- let sSince = aParams[sParam].since;
548
- let oDeprecated = aParams[sParam].deprecated;
549
- let oEvtInSymbol = oSymbol.events.find(e => e.name === oEvent.name);
550
- let oParamInSymbol = oEvtInSymbol && oEvtInSymbol.parameters[0] &&
551
- oEvtInSymbol.parameters[0].parameterProperties &&
552
- oEvtInSymbol.parameters[0].parameterProperties.getParameters &&
553
- oEvtInSymbol.parameters[0].parameterProperties.getParameters.parameterProperties &&
554
- oEvtInSymbol.parameters[0].parameterProperties.getParameters.parameterProperties[sParam];
555
-
556
- if (typeof oParamInSymbol === 'object' && oParamInSymbol !== null) {
557
- if (sSince) {
558
- oParamInSymbol.since = sSince;
559
- }
653
+ oMeta.events.forEach((oEvent) => {
654
+ const aParams = oEvent.parameters;
655
+
656
+ if (aParams) {
657
+ Object.keys(aParams).forEach((sParam) => {
658
+ const sSince = aParams[sParam].since;
659
+ const oDeprecated = aParams[sParam].deprecated;
660
+ const oEvtInSymbol = oSymbol.events.find((e) => e.name === oEvent.name);
661
+ const oParamInSymbol = oEvtInSymbol && oEvtInSymbol.parameters[0] &&
662
+ oEvtInSymbol.parameters[0].parameterProperties &&
663
+ oEvtInSymbol.parameters[0].parameterProperties.getParameters &&
664
+ oEvtInSymbol.parameters[0].parameterProperties.getParameters.parameterProperties &&
665
+ oEvtInSymbol.parameters[0].parameterProperties.getParameters.parameterProperties[sParam];
666
+
667
+ if (typeof oParamInSymbol === 'object' && oParamInSymbol !== null) {
668
+ if (sSince) {
669
+ oParamInSymbol.since = sSince;
670
+ }
560
671
 
561
- if (oDeprecated) {
562
- oParamInSymbol.deprecated = oDeprecated;
672
+ if (oDeprecated) {
673
+ oParamInSymbol.deprecated = oDeprecated;
674
+ }
563
675
  }
564
- }
565
- })
676
+ });
677
+ }
566
678
  });
567
679
 
568
680
  // We don't need event's data from the UI5-metadata for now. Keep file size in check
@@ -571,11 +683,12 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
571
683
 
572
684
  // Special Settings
573
685
  if (oMeta.specialSettings) {
574
- oMeta.specialSettings.forEach(oSetting => {
686
+ oMeta.specialSettings.forEach((oSetting) => {
575
687
 
576
688
  // Link Enabled
577
- if (!isBuiltInType(oSetting.type)) {
578
- oSetting.linkEnabled = true;
689
+ if (oSetting.type) {
690
+ oSetting.typeInfo = parseUI5Types(oSetting.type);
691
+ delete oSetting.type; // Keep file size in check
579
692
  }
580
693
 
581
694
  // Description
@@ -591,7 +704,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
591
704
 
592
705
  // Annotations
593
706
  if (oMeta.annotations) {
594
- oMeta.annotations.forEach(oAnnotation => {
707
+ oMeta.annotations.forEach((oAnnotation) => {
595
708
 
596
709
  // Description
597
710
  oAnnotation.description = formatters.formatAnnotationDescription(oAnnotation.description,
@@ -617,7 +730,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
617
730
  // Pre-process events
618
731
  methods.buildEventsModel(oSymbol.events);
619
732
 
620
- oSymbol.events.forEach(oEvent => {
733
+ oSymbol.events.forEach((oEvent) => {
621
734
 
622
735
  // Description
623
736
  if (oEvent.description) {
@@ -632,11 +745,11 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
632
745
 
633
746
  // Parameters
634
747
  if (oEvent.parameters && Array.isArray(oEvent.parameters)) {
635
- oEvent.parameters.forEach(oParameter => {
748
+ oEvent.parameters.forEach((oParameter) => {
636
749
 
637
- // Link Enabled
638
- if (!isBuiltInType(oParameter.type)) {
639
- oParameter.linkEnabled = true;
750
+ if (oParameter.type) {
751
+ oParameter.typeInfo = parseUI5Types(oParameter.type);
752
+ delete oParameter.type; // Keep file size in check
640
753
  }
641
754
 
642
755
  // Description
@@ -662,7 +775,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
662
775
  // Pre-process methods
663
776
  methods.buildMethodsModel(oSymbol.methods);
664
777
 
665
- oSymbol.methods.forEach(oMethod => {
778
+ oSymbol.methods.forEach((oMethod) => {
666
779
 
667
780
  // Name and link
668
781
  if (oMethod.name) {
@@ -681,7 +794,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
681
794
  }
682
795
 
683
796
  // Examples
684
- oMethod.examples && oMethod.examples.forEach(oExample => {
797
+ oMethod.examples?.forEach((oExample) => {
685
798
  oExample = formatters.formatExample(oExample.caption, oExample.text);
686
799
  });
687
800
 
@@ -696,20 +809,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
696
809
 
697
810
  // Parameters
698
811
  if (oMethod.parameters) {
699
- oMethod.parameters.forEach(oParameter => {
700
-
701
- // Types
702
- if (oParameter.types) {
703
- oParameter.types.forEach(oType => {
704
-
705
- // Link Enabled
706
- if (!isBuiltInType(oType.value) && possibleUI5Symbol(oType.value)) {
707
- oType.linkEnabled = true;
708
- oType.href = "api/" + oType.value.replace("[]", "");
709
- }
710
-
711
- });
712
- }
812
+ oMethod.parameters?.forEach((oParameter) => {
713
813
 
714
814
  // Default value
715
815
  oParameter.defaultValue = formatters.formatDefaultValue(oParameter.defaultValue);
@@ -731,24 +831,11 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
731
831
  // Description
732
832
  oMethod.returnValue.description = formatters.formatDescription(oMethod.returnValue.description);
733
833
 
734
- // Types
735
- if (oMethod.returnValue.types) {
736
- oMethod.returnValue.types.forEach(oType => {
737
-
738
- // Link Enabled
739
- if (!isBuiltInType(oType.value) && possibleUI5Symbol(oType.value)) {
740
- oType.href = "api/" + oType.value.replace("[]", "");
741
- oType.linkEnabled = true;
742
- }
743
-
744
- });
745
- }
746
-
747
834
  }
748
835
 
749
836
  // Throws
750
837
  if (oMethod.throws) {
751
- oMethod.throws.forEach(oThrows => {
838
+ oMethod.throws.forEach((oThrows) => {
752
839
 
753
840
  // Description
754
841
  if (oThrows.description) {
@@ -832,11 +919,11 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
832
919
  }
833
920
 
834
921
  // otherwise, it names a directory that has to be scanned for the files
835
- return new Promise(oResolve => {
922
+ return new Promise((oResolve) => {
836
923
  fs.readdir(vDependencyAPIFiles, function (oError, aItems) {
837
924
  if (!oError && aItems && aItems.length) {
838
- let aFiles = [];
839
- aItems.forEach(sItem => {
925
+ const aFiles = [];
926
+ aItems.forEach((sItem) => {
840
927
  aFiles.push(path.join(vDependencyAPIFiles, sItem));
841
928
  });
842
929
  oChainObject.aDependentLibraryFiles = aFiles;
@@ -850,18 +937,18 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
850
937
  if (!oChainObject.aDependentLibraryFiles) {
851
938
  return oChainObject;
852
939
  }
853
- let aPromises = [];
854
- oChainObject.aDependentLibraryFiles.forEach(sFile => {
855
- aPromises.push(new Promise(oResolve => {
940
+ const aPromises = [];
941
+ oChainObject.aDependentLibraryFiles.forEach((sFile) => {
942
+ aPromises.push(new Promise((oResolve) => {
856
943
  fs.readFile(sFile, 'utf8', (oError, oData) => {
857
944
  oResolve(oError ? false : oData);
858
945
  });
859
946
  }));
860
947
  });
861
- return Promise.all(aPromises).then(aValues => {
862
- let oDependentAPIs = {};
948
+ return Promise.all(aPromises).then((aValues) => {
949
+ const oDependentAPIs = {};
863
950
 
864
- aValues.forEach(sData => {
951
+ aValues.forEach((sData) => {
865
952
  let oData;
866
953
 
867
954
  try {
@@ -880,7 +967,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
880
967
 
881
968
  oChainObject.oDependentAPIs = oDependentAPIs;
882
969
  return oChainObject;
883
- })
970
+ });
884
971
  }
885
972
 
886
973
  /**
@@ -894,9 +981,9 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
894
981
  if (!sFAQDir) {
895
982
  return oChainObject;
896
983
  }
897
- let slibName = oChainObject.fileData.library;
984
+ const slibName = oChainObject.fileData.library;
898
985
  oChainObject.fileData.symbols.forEach(function(symbol) {
899
- let sfile = symbol.name.replace(slibName, "").replace(/[.]/g, "/") + ".md";
986
+ const sfile = symbol.name.replace(slibName, "").replace(/[.]/g, "/") + ".md";
900
987
  if (fs.existsSync(path.join(sFAQDir, sfile))) {
901
988
  symbol.hasFAQ = true;
902
989
  }
@@ -913,7 +1000,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
913
1000
  // If requested, return data instead of writing to FS (required by UI5 Tooling/UI5 Builder)
914
1001
  return JSON.stringify(oChainObject.parsedData);
915
1002
  }
916
- let sOutputDir = path.dirname(oChainObject.outputFile);
1003
+ const sOutputDir = path.dirname(oChainObject.outputFile);
917
1004
 
918
1005
  // Create dir if it does not exist
919
1006
  if (!fs.existsSync(sOutputDir)) {
@@ -947,7 +1034,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
947
1034
  oChainObject.modules = [];
948
1035
 
949
1036
  if (oChainObject.libraryFileData) {
950
- let $ = cheerio.load(oChainObject.libraryFileData, {
1037
+ const $ = cheerio.load(oChainObject.libraryFileData, {
951
1038
  ignoreWhitespace: true,
952
1039
  xmlMode: true,
953
1040
  lowerCaseTags: false
@@ -963,8 +1050,8 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
963
1050
  if (oComponent.children.length === 1) {
964
1051
  oChainObject.defaultComponent = $(oComponent).text();
965
1052
  } else {
966
- let sCurrentComponentName = $(oComponent).find("name").text();
967
- let aCurrentModules = [];
1053
+ const sCurrentComponentName = $(oComponent).find("name").text();
1054
+ const aCurrentModules = [];
968
1055
  $(oComponent).find("module").each((a, oC) => {
969
1056
  aCurrentModules.push($(oC).text().replace(/\//g, "."));
970
1057
  });
@@ -992,9 +1079,9 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
992
1079
  function flattenComponents(oChainObject) {
993
1080
  if (oChainObject.modules && oChainObject.modules.length > 0) {
994
1081
  oChainObject.customSymbolComponents = {};
995
- oChainObject.modules.forEach(oComponent => {
996
- let sCurrentComponent = oComponent.componentName;
997
- oComponent.modules.forEach(sModule => {
1082
+ oChainObject.modules.forEach((oComponent) => {
1083
+ const sCurrentComponent = oComponent.componentName;
1084
+ oComponent.modules.forEach((sModule) => {
998
1085
  oChainObject.customSymbolComponents[sModule] = sCurrentComponent;
999
1086
  });
1000
1087
  });
@@ -1076,7 +1163,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1076
1163
  oFileData = JSON.parse(oFileData);
1077
1164
  if (oFileData.explored && oFileData.explored.entities && oFileData.explored.entities.length > 0) {
1078
1165
  oChainObject.entitiesWithSamples = [];
1079
- oFileData.explored.entities.forEach(oEntity => {
1166
+ oFileData.explored.entities.forEach((oEntity) => {
1080
1167
  oChainObject.entitiesWithSamples.push(oEntity.id);
1081
1168
  });
1082
1169
  }
@@ -1106,22 +1193,20 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1106
1193
  });
1107
1194
  }
1108
1195
 
1109
- /*
1196
+ /**
1110
1197
  * =====================================================================================================================
1111
1198
  * IMPORTANT NOTE: Formatter code is a copy from APIDetail.controller.js with a very little modification and mocking and
1112
1199
  * code can be significantly improved
1113
1200
  * =====================================================================================================================
1114
1201
  */
1115
- let formatters = {
1116
-
1202
+ const formatters = {
1117
1203
  _sTopicId: "",
1118
1204
  _oTopicData: {},
1119
1205
  _baseTypes: [
1120
- // TODO this list URGENTLY needs to be replaced by the Type parser and a much smaller list
1121
1206
  "sap.ui.core.any",
1122
1207
  "sap.ui.core.object",
1123
1208
  "sap.ui.core.function",
1124
- "sap.ui.core.number", // TODO discuss with Thomas, type does not exist
1209
+ "sap.ui.core.number",
1125
1210
  "sap.ui.core.float",
1126
1211
  "sap.ui.core.int",
1127
1212
  "sap.ui.core.boolean",
@@ -1129,31 +1214,26 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1129
1214
  "sap.ui.core.void",
1130
1215
  "null",
1131
1216
  "any",
1132
- "any[]",
1133
1217
  "Error",
1134
- "Error[]",
1135
1218
  "array",
1136
1219
  "element",
1137
1220
  "Element",
1221
+ "HTMLElement",
1222
+ "Node",
1223
+ "Attr",
1138
1224
  "Date",
1139
1225
  "DomRef",
1226
+ "jQuery",
1140
1227
  "jQuery.promise",
1228
+ "jQuery.event",
1141
1229
  "QUnit.Assert",
1142
1230
  "object",
1143
1231
  "Object",
1144
- "object[]",
1145
- "object|object[]",
1146
- "[object Object][]",
1147
- "Array<[object Object]>",
1148
- "Array.<[object Object]>",
1149
- "Object<string,string>",
1150
- "Object.<string,string>",
1151
1232
  "function",
1152
1233
  "float",
1153
1234
  "int",
1154
1235
  "boolean",
1155
1236
  "string",
1156
- "string[]",
1157
1237
  "number",
1158
1238
  "map",
1159
1239
  "promise",
@@ -1163,7 +1243,12 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1163
1243
  "Touch",
1164
1244
  "TouchList",
1165
1245
  "undefined",
1166
- "this"
1246
+ "this",
1247
+ "Blob",
1248
+ "RegExp",
1249
+ "void",
1250
+ "ArrayBuffer",
1251
+ "[object Object]"
1167
1252
  ],
1168
1253
  ANNOTATIONS_LINK: 'http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part3-csdl.html',
1169
1254
  ANNOTATIONS_NAMESPACE_LINK: 'http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/vocabularies/',
@@ -1251,7 +1336,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1251
1336
 
1252
1337
  if (aParams && aParams.length > 0) {
1253
1338
  /* We consider only root level parameters so we get rid of all that are not on the root level */
1254
- aParams = aParams.filter(oElem => {
1339
+ aParams = aParams.filter((oElem) => {
1255
1340
  return oElem.depth === undefined;
1256
1341
  });
1257
1342
  aParams.forEach(function (element, index, array) {
@@ -1487,7 +1572,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1487
1572
 
1488
1573
  handleExternalUrl: function (sTarget, sText) {
1489
1574
  // Check if the external domain is SAP hosted
1490
- let bSAPHosted = /^https?:\/\/([\w.]*\.)?(?:sap|hana\.ondemand|sapfioritrial)\.com/.test(sTarget);
1575
+ const bSAPHosted = /^https?:\/\/([\w.]*\.)?(?:sap|hana\.ondemand|sapfioritrial)\.com/.test(sTarget);
1491
1576
  return this.formatUrlToLink(sTarget, sText, bSAPHosted);
1492
1577
  },
1493
1578
 
@@ -1540,7 +1625,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1540
1625
  return true;
1541
1626
  }
1542
1627
  if (oSymbol.name === className) {
1543
- let oProperty = findProperty(oSymbol, methodName, target);
1628
+ const oProperty = findProperty(oSymbol, methodName, target);
1544
1629
  if (oProperty) {
1545
1630
  sResult = this.createLink({
1546
1631
  name: className,
@@ -1548,7 +1633,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1548
1633
  });
1549
1634
  return true;
1550
1635
  }
1551
- let oMethod = findMethod(oSymbol, methodName, target);
1636
+ const oMethod = findMethod(oSymbol, methodName, target);
1552
1637
  if (oMethod) {
1553
1638
  sResult = this.createLink({
1554
1639
  name: oMethod.static ? target : oMethod.name,
@@ -1559,7 +1644,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1559
1644
  return true;
1560
1645
  }
1561
1646
 
1562
- let oEvent = findEvent(oSymbol, methodName);
1647
+ const oEvent = findEvent(oSymbol, methodName);
1563
1648
  if (oEvent) {
1564
1649
  sResult = this.createLink({
1565
1650
  name: oEvent.name,
@@ -1570,7 +1655,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1570
1655
  return true;
1571
1656
  }
1572
1657
 
1573
- let oAnnotation = findAnnotation(oSymbol, methodName);
1658
+ const oAnnotation = findAnnotation(oSymbol, methodName);
1574
1659
  if (oAnnotation) {
1575
1660
  sResult = this.createLink({
1576
1661
  name: oAnnotation.name,
@@ -1595,7 +1680,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1595
1680
 
1596
1681
  // Own methods search
1597
1682
  if (self.name === className && self.methods) {
1598
- let oResult = self.methods.find(({name}) => name === methodName);
1683
+ const oResult = self.methods.find(({name}) => name === methodName);
1599
1684
  if (oResult) {
1600
1685
  return this.createLink({
1601
1686
  name: oResult.static ? [self.name, oResult.name].join(".") : oResult.name,
@@ -1607,26 +1692,28 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1607
1692
  }
1608
1693
 
1609
1694
  // Local library symbols
1610
- ownLibrary.symbols.find(oSymbol => {
1695
+ ownLibrary.symbols.find((oSymbol) => {
1611
1696
  return searchInSymbol.call(this, oSymbol);
1612
1697
  });
1613
1698
 
1614
- if (sResult) return sResult;
1699
+ if (sResult) {return sResult;}
1615
1700
 
1616
1701
  // Dependent library symbols
1617
- dependencyLibs && Object.keys(dependencyLibs).find(sLib => {
1618
- if (sLib === target) {
1619
- sResult = this.createLink({
1620
- name: sLib,
1621
- text: text
1702
+ if (dependencyLibs) {
1703
+ Object.keys(dependencyLibs).find((sLib) => {
1704
+ if (sLib === target) {
1705
+ sResult = this.createLink({
1706
+ name: sLib,
1707
+ text: text
1708
+ });
1709
+ return true;
1710
+ }
1711
+ const oLib = dependencyLibs[sLib];
1712
+ return oLib && oLib.find((oSymbol) => {
1713
+ return searchInSymbol.call(this, oSymbol);
1622
1714
  });
1623
- return true;
1624
- }
1625
- let oLib = dependencyLibs[sLib];
1626
- return oLib && oLib.find(oSymbol => {
1627
- return searchInSymbol.call(this, oSymbol);
1628
1715
  });
1629
- });
1716
+ }
1630
1717
 
1631
1718
  return sResult;
1632
1719
  },
@@ -1641,7 +1728,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1641
1728
  * @param {string} [hrefAppend=""]
1642
1729
  * @returns {string} link
1643
1730
  */
1644
- createLink: function ({name, type, className, text=name, hrefAppend=""}) {
1731
+ createLink: function ({name, type, className, text = name, hrefAppend = ""}) {
1645
1732
  let sLink;
1646
1733
 
1647
1734
  // handling module's
@@ -1667,13 +1754,12 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1667
1754
  * @private
1668
1755
  */
1669
1756
  _preProcessLinksInTextBlock: function (sText, bSkipParagraphs) {
1670
- let oSelf = this._oTopicData,
1757
+ const oSelf = this._oTopicData,
1671
1758
  oOwnLibrary = this._oOwnLibrary,
1672
1759
  oDependencyLibs = oChainObject.oDependentAPIs,
1673
1760
  oOptions = {
1674
1761
  linkFormatter: function (sTarget, sText) {
1675
- let aMatch,
1676
- aTarget;
1762
+ let aMatch;
1677
1763
 
1678
1764
  // keep the full target in the fallback text
1679
1765
  sText = sText || sTarget;
@@ -1711,7 +1797,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1711
1797
  // module:sap/x/Xxx.extend
1712
1798
  aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)\.extend$/);
1713
1799
  if (aMatch) {
1714
- let [, sModule, sClass] = aMatch;
1800
+ const [, sModule, sClass] = aMatch;
1715
1801
  return this.createLink({
1716
1802
  name: sTarget.replace(/^module:/, ""),
1717
1803
  type: "methods",
@@ -1727,13 +1813,13 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1727
1813
  // #constructor
1728
1814
  aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)?[\.#]constructor$/i);
1729
1815
  if (aMatch) {
1730
- let [, sModule, sClass] = aMatch,
1731
- sName;
1816
+ const [, sModule, sClass] = aMatch;
1732
1817
 
1818
+ let sName;
1733
1819
  if (sClass) {
1734
1820
  sName = (sModule ? sModule : "") + sClass;
1735
1821
  } else {
1736
- sName = oSelf.name
1822
+ sName = oSelf.name;
1737
1823
  }
1738
1824
 
1739
1825
  return this.createLink({
@@ -1773,7 +1859,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1773
1859
  // module:sap/ui/comp/smartfield/SmartField#annotation:TextArrangement
1774
1860
  aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)[.#]annotation:([a-zA-Z0-9$_]+)$/);
1775
1861
  if (aMatch) {
1776
- let [, sModule, sClass, sAnnotation] = aMatch;
1862
+ const [, sModule, sClass, sAnnotation] = aMatch;
1777
1863
  return this.createLink({
1778
1864
  name: sAnnotation,
1779
1865
  type: "annotations",
@@ -1799,7 +1885,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1799
1885
  // module:sap/m/Button#event:press
1800
1886
  aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)[.#]event:([a-zA-Z0-9$_]+)$/);
1801
1887
  if (aMatch) {
1802
- let [, sModule, sClass, sEvent] = aMatch;
1888
+ const [, sModule, sClass, sEvent] = aMatch;
1803
1889
  return this.createLink({
1804
1890
  name: sEvent,
1805
1891
  type: "events",
@@ -1812,7 +1898,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1812
1898
  // module:sap/m/Button#setText
1813
1899
  aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+)#([a-zA-Z0-9.$_]+)$/);
1814
1900
  if (aMatch) {
1815
- let [, sModule, sClass, sMethod] = aMatch;
1901
+ const [, sModule, sClass, sMethod] = aMatch;
1816
1902
  return this.createLink({
1817
1903
  name: sMethod,
1818
1904
  type: "methods",
@@ -1825,8 +1911,8 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1825
1911
  // sap.x.Xxx.xxx
1826
1912
  // module:sap/x/Xxx.xxx
1827
1913
  if (/^(?:module:)?([a-zA-Z0-9.$_\/]+?)\.([a-zA-Z0-9$_]+)$/.test(sTarget)) {
1828
- let [,sClass, sName] = sTarget.match(/^((?:module:)?[a-zA-Z0-9.$_\/]+?)\.([a-zA-Z0-9$_]+)$/),
1829
- sResult = this.createLinkFromTargetType({
1914
+ const [,sClass, sName] = sTarget.match(/^((?:module:)?[a-zA-Z0-9.$_\/]+?)\.([a-zA-Z0-9$_]+)$/);
1915
+ const sResult = this.createLinkFromTargetType({
1830
1916
  className: sClass,
1831
1917
  methodName: sName,
1832
1918
  target: sTarget,
@@ -1841,9 +1927,9 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1841
1927
  }
1842
1928
 
1843
1929
  // Possible nested functions discovery - currently we do this only for regular symbols
1844
- aTarget = sTarget.split(".");
1930
+ const aTarget = sTarget.split(".");
1845
1931
  if (aTarget.length >= 3) {
1846
- let sResult = this.createLinkFromTargetType({
1932
+ const sResult = this.createLinkFromTargetType({
1847
1933
  methodName: aTarget.splice(-2).join("."),
1848
1934
  className: aTarget.join("."),
1849
1935
  target: sTarget,
@@ -1972,7 +2058,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1972
2058
  var bHeaderDocuLinkFound = false,
1973
2059
  bUXGuidelinesLinkFound = false,
1974
2060
  aReferences = [],
1975
- entity = bCalledOnConstructor? oSymbol.constructor.references : oSymbol.references;
2061
+ entity = bCalledOnConstructor ? oSymbol.constructor.references : oSymbol.references;
1976
2062
 
1977
2063
  const UX_GUIDELINES_BASE_URL = "https://experience.sap.com/fiori-design-web/";
1978
2064
 
@@ -2016,7 +2102,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
2016
2102
  aParts = sReference.match(/^(?:{@link\s)?fiori:(?:https:\/\/experience\.sap\.com\/fiori-design-web\/)?\/?(\S+\b)\/?\s?(.*[^\s}])?}?$/);
2017
2103
 
2018
2104
  if (aParts) {
2019
- let [, sTarget, sTargetName] = aParts;
2105
+ const [, sTarget, sTargetName] = aParts;
2020
2106
 
2021
2107
  if (bCalledOnConstructor && !bUXGuidelinesLinkFound) {
2022
2108
  // Extract first found UX Guidelines link as primary
@@ -2032,9 +2118,11 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
2032
2118
 
2033
2119
  aReferences.push(sReference);
2034
2120
  });
2035
- bCalledOnConstructor? oSymbol.constructor.references = aReferences : oSymbol.references = aReferences;
2121
+ }
2122
+ if (bCalledOnConstructor) {
2123
+ oSymbol.constructor.references = aReferences;
2036
2124
  } else {
2037
- bCalledOnConstructor? oSymbol.constructor.references = [] : oSymbol.references = [];
2125
+ oSymbol.references = aReferences;
2038
2126
  }
2039
2127
  },
2040
2128
 
@@ -2045,13 +2133,13 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
2045
2133
  */
2046
2134
  formatReferencesInDescription: function(oEntity) {
2047
2135
  if (oEntity.references && Array.isArray(oEntity.references)) {
2048
- oEntity.references = oEntity.references.map(sReference => {
2136
+ oEntity.references = oEntity.references.map((sReference) => {
2049
2137
  if (/{@link.*}/.test(sReference)) {
2050
2138
  return "<li>" + sReference + "</li>";
2051
2139
  } else {
2052
2140
  return "<li>{@link " + sReference + "}</li>";
2053
2141
 
2054
- };
2142
+ }
2055
2143
  });
2056
2144
  if (!oEntity.description) {
2057
2145
  // If there is no method description - references should be the first line of it
@@ -2065,7 +2153,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
2065
2153
  };
2066
2154
 
2067
2155
  /* Methods direct copy from API Detail */
2068
- let methods = {
2156
+ const methods = {
2069
2157
 
2070
2158
  /**
2071
2159
  * Adjusts methods info so that it can be easily displayed in a table
@@ -2081,7 +2169,9 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
2081
2169
 
2082
2170
  // Handle types
2083
2171
  if (oProperty.type) {
2084
- oProperty.types = fnCreateTypesArr(oProperty.type);
2172
+ oProperty.typeInfo = parseUI5Types(oProperty.type);
2173
+ // Keep file size in check
2174
+ delete oProperty.type;
2085
2175
  }
2086
2176
 
2087
2177
  // Phone name - available only for parameters
@@ -2111,12 +2201,11 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
2111
2201
  if (oMethod.parameters) {
2112
2202
  oMethod.parameters.forEach(function (oParameter) {
2113
2203
  if (oParameter.type) {
2114
- oParameter.types = fnCreateTypesArr(oParameter.type);
2204
+ oParameter.typeInfo = parseUI5Types(oParameter.type);
2205
+ // Keep file size in check
2206
+ delete oParameter.type;
2115
2207
  }
2116
2208
 
2117
- // Keep file size in check
2118
- delete oParameter.type;
2119
-
2120
2209
  // Add the parameter before the properties
2121
2210
  aParameters.push(oParameter);
2122
2211
 
@@ -2133,7 +2222,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
2133
2222
  // Handle return values
2134
2223
  if (oMethod.returnValue && oMethod.returnValue.type) {
2135
2224
  // Handle types
2136
- oMethod.returnValue.types = fnCreateTypesArr(oMethod.returnValue.type);
2225
+ oMethod.returnValue.typeInfo = parseUI5Types(oMethod.returnValue.type);
2137
2226
  }
2138
2227
 
2139
2228
  });
@@ -2266,7 +2355,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
2266
2355
  };
2267
2356
 
2268
2357
  // Create the chain object
2269
- let oChainObject = {
2358
+ const oChainObject = {
2270
2359
  inputFile: sInputFile,
2271
2360
  outputFile: sOutputFile,
2272
2361
  libraryFile: sLibraryFile,
@@ -2274,7 +2363,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
2274
2363
  };
2275
2364
 
2276
2365
  // Start the work here
2277
- let p = getLibraryPromise(oChainObject)
2366
+ const p = getLibraryPromise(oChainObject)
2278
2367
  .then(extractComponentAndDocuindexUrl)
2279
2368
  .then(flattenComponents)
2280
2369
  .then(extractSamplesFromDocuIndex)
@@ -2286,7 +2375,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
2286
2375
  .then(createApiRefApiJson);
2287
2376
  return p;
2288
2377
 
2289
- };
2378
+ }
2290
2379
 
2291
2380
  module.exports = transformer;
2292
2381