@ui5/builder 2.11.5 → 2.11.7

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/CHANGELOG.md CHANGED
@@ -2,7 +2,22 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
- A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v2.11.5...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v2.11.7...HEAD).
6
+
7
+ <a name="v2.11.7"></a>
8
+ ## [v2.11.7] - 2022-10-16
9
+ ### Dependency Updates
10
+ - Bump escope from 3.6.0 to 4.0.0 [`852b37f`](https://github.com/SAP/ui5-builder/commit/852b37f549f3927decbc1b40cc6055325472d625)
11
+
12
+ ### Reverts
13
+ - [FIX] package.json: Downgrade es5-ext dependency ([#798](https://github.com/SAP/ui5-builder/issues/798))
14
+
15
+
16
+ <a name="v2.11.6"></a>
17
+ ## [v2.11.6] - 2022-10-12
18
+ ### Bug Fixes
19
+ - **package.json:** Downgrade es5-ext dependency ([#798](https://github.com/SAP/ui5-builder/issues/798)) [`0e18008`](https://github.com/SAP/ui5-builder/commit/0e18008d86da93c5c8743b17ac0091afc3064d78)
20
+
6
21
 
7
22
  <a name="v2.11.5"></a>
8
23
  ## [v2.11.5] - 2022-05-04
@@ -648,6 +663,8 @@ to load the custom bundle file instead.
648
663
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
649
664
 
650
665
 
666
+ [v2.11.7]: https://github.com/SAP/ui5-builder/compare/v2.11.6...v2.11.7
667
+ [v2.11.6]: https://github.com/SAP/ui5-builder/compare/v2.11.5...v2.11.6
651
668
  [v2.11.5]: https://github.com/SAP/ui5-builder/compare/v2.11.4...v2.11.5
652
669
  [v2.11.4]: https://github.com/SAP/ui5-builder/compare/v2.11.3...v2.11.4
653
670
  [v2.11.3]: https://github.com/SAP/ui5-builder/compare/v2.11.2...v2.11.3
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Node script to create cross-library API index files for use in the UI5 SDKs.
3
3
  *
4
- * (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
4
+ * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
5
5
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Node script to preprocess api.json files for use in the UI5 SDKs.
3
3
  *
4
- * (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
4
+ * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
5
5
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
6
6
  */
7
7
 
@@ -25,6 +25,11 @@ const log = (function() {
25
25
  }
26
26
  }());
27
27
 
28
+ function replaceLastPathSegment(p, replacement) {
29
+ // Note: path.join also correctly normalizes any POSIX paths on Windows
30
+ return path.join(path.dirname(p), replacement);
31
+ }
32
+
28
33
  /*
29
34
  * Transforms the api.json as created by the JSDoc build into a pre-processed api.json file suitable for the SDK.
30
35
  *
@@ -698,7 +703,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
698
703
  oMethod.returnValue.types.forEach(oType => {
699
704
 
700
705
  // Link Enabled
701
- if (!isBuiltInType(oType.value)) {
706
+ if (!isBuiltInType(oType.value) && possibleUI5Symbol(oType.value)) {
702
707
  oType.href = "api/" + oType.value.replace("[]", "");
703
708
  oType.linkEnabled = true;
704
709
  }
@@ -981,6 +986,57 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
981
986
  // Normalize path to resolve relative path
982
987
  sPath = path.normalize(sPath);
983
988
 
989
+ const {sources} = options;
990
+ let {librarySrcDir, libraryTestDir} = options;
991
+
992
+ // Using path.join to normalize POSIX paths to Windows paths on Windows
993
+ librarySrcDir = path.join(librarySrcDir);
994
+ libraryTestDir = path.join(libraryTestDir);
995
+
996
+ if (Array.isArray(sources) && typeof librarySrcDir === "string" && typeof libraryTestDir === "string") {
997
+ /**
998
+ * Calculate prefix to check
999
+ *
1000
+ * Example 1:
1001
+ * - sSource: /path/to/project/src
1002
+ * - sLibrarySrcDir: src
1003
+ *
1004
+ * Prefix: /path/to/project/test-resources
1005
+ *
1006
+ * Example 2:
1007
+ * - sSource: /path/to/project/src/main/js
1008
+ * - sLibrarySrcDir: src/main/js
1009
+ *
1010
+ * Prefix: /path/to/project/src/main/test-resources
1011
+ */
1012
+ const librarySrcDirWithTestResources = replaceLastPathSegment(librarySrcDir, "test-resources");
1013
+
1014
+ for (const sourcePath of sources) {
1015
+ /**
1016
+ * Replace prefix with file system path
1017
+ *
1018
+ * Example 1:
1019
+ * - sPath: /path/to/project/test-resources/sap/test/demokit/docuindex.json
1020
+ *
1021
+ * New sPath: /path/to/project/test/sap/test/demokit/docuindex.json
1022
+ *
1023
+ * Example 2:
1024
+ * - sPath: /path/to/project/src/main/test-resources/sap/test/demokit/docuindex.json
1025
+ *
1026
+ * New sPath: /path/to/project/src/main/test/sap/test/demokit/docuindex.json
1027
+ */
1028
+ if (!sourcePath.endsWith(librarySrcDir)) {
1029
+ continue;
1030
+ }
1031
+ const libraryDir = sourcePath.substring(0, sourcePath.lastIndexOf(librarySrcDir) - 1);
1032
+ const prefix = path.join(libraryDir, librarySrcDirWithTestResources);
1033
+ if (sPath.startsWith(prefix)) {
1034
+ sPath = path.join(libraryDir, libraryTestDir, sPath.substring(prefix.length));
1035
+ break;
1036
+ }
1037
+ }
1038
+ }
1039
+
984
1040
  fs.readFile(sPath, 'utf8', (oError, oFileData) => {
985
1041
  if (!oError) {
986
1042
  oFileData = JSON.parse(oFileData);
@@ -991,7 +1047,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
991
1047
  });
992
1048
  }
993
1049
  }
994
- // We aways resolve as this data is not mandatory
1050
+ // We always resolve as this data is not mandatory
995
1051
  oResolve(oChainObject);
996
1052
  });
997
1053
 
@@ -1154,7 +1210,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1154
1210
  },
1155
1211
 
1156
1212
  formatMethodCode: function (sName, aParams, aReturnValue) {
1157
- var result = '<pre class="prettyprint">' + sName + '(';
1213
+ var result = '<pre>' + sName + '(';
1158
1214
 
1159
1215
  if (aParams && aParams.length > 0) {
1160
1216
  /* We consider only root level parameters so we get rid of all that are not on the root level */
@@ -1258,7 +1314,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1258
1314
  * @returns string - The code needed to create an object of that class
1259
1315
  */
1260
1316
  formatConstructor: function (name, params) {
1261
- var result = '<pre class="prettyprint">new ';
1317
+ var result = '<pre>new ';
1262
1318
 
1263
1319
  if (name) {
1264
1320
  result += name + '(';
@@ -1508,8 +1564,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1508
1564
  name: oResult.static ? [self.name, oResult.name].join(".") : oResult.name,
1509
1565
  type: "methods",
1510
1566
  className: className,
1511
- text: text,
1512
- local: true
1567
+ text: text
1513
1568
  });
1514
1569
  }
1515
1570
  }
@@ -1549,7 +1604,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1549
1604
  * @param {string} [hrefAppend=""]
1550
1605
  * @returns {string} link
1551
1606
  */
1552
- createLink: function ({name, type, className, text=name, local=false, hrefAppend=""}) {
1607
+ createLink: function ({name, type, className, text=name, hrefAppend=""}) {
1553
1608
  let sLink;
1554
1609
 
1555
1610
  // handling module's
@@ -1564,12 +1619,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1564
1619
  sLink += hrefAppend;
1565
1620
  }
1566
1621
 
1567
- if (local) {
1568
- let sScrollClass = "scrollTo" + type[0].toUpperCase() + type.slice(1, -1);
1569
- return `<a target="_self" class="jsdoclink ${sScrollClass}" data-target="${name}" href="api/${sLink}">${text}</a>`;
1570
- }
1571
-
1572
- return `<a target="_self" class="jsdoclink" href="api/${sLink}">${text}</a>`;
1622
+ return `<a target="_self" href="api/${sLink}">${text}</a>`;
1573
1623
  },
1574
1624
 
1575
1625
  /**
@@ -1597,7 +1647,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1597
1647
  }
1598
1648
 
1599
1649
  // topic:xxx Topic
1600
- aMatch = sTarget.match(/^topic:(\w{32})$/);
1650
+ aMatch = sTarget.match(/^topic:(\w{32}(?:#\w*)?(?:\/\w*)?)$/);
1601
1651
  if (aMatch) {
1602
1652
  return '<a target="_self" href="topic/' + aMatch[1] + '">' + sText + '</a>';
1603
1653
  }
@@ -1665,7 +1715,6 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1665
1715
  name: aMatch[1] ? `${oSelf.name}.${aMatch[2]}` : aMatch[2],
1666
1716
  type: "methods",
1667
1717
  className: oSelf.name,
1668
- local: true,
1669
1718
  text: sText
1670
1719
  });
1671
1720
  }
@@ -1677,7 +1726,6 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1677
1726
  name: aMatch[1],
1678
1727
  type: "annotations",
1679
1728
  className: oSelf.name,
1680
- local: true,
1681
1729
  text: sText
1682
1730
  });
1683
1731
  }
@@ -1704,7 +1752,6 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
1704
1752
  name: aMatch[1],
1705
1753
  type: "events",
1706
1754
  className: oSelf.name,
1707
- local: true,
1708
1755
  text: sText
1709
1756
  });
1710
1757
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * JSDoc3 plugin for UI5 documentation generation.
3
3
  *
4
- * (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
4
+ * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
5
5
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
6
6
  */
7
7
 
@@ -288,10 +288,11 @@ function collectShortcuts(body) {
288
288
  } else if ( valueNode.type === Syntax.MemberExpression ) {
289
289
  const _import = getLeftmostName(valueNode);
290
290
  const local = _import && currentModule.localNames[_import];
291
- if ( typeof local === 'object' && local.module ) {
291
+ const objectName = getObjectName(valueNode);
292
+ if ( objectName && typeof local === 'object' && local.module ) {
292
293
  currentModule.localNames[name] = {
293
294
  module: local.module,
294
- path: getObjectName(valueNode).split('.').slice(1).join('.') // TODO chaining if local has path
295
+ path: objectName.split('.').slice(1).join('.') // TODO chaining if local has path
295
296
  };
296
297
  debug(` found local shortcut: ${name} ${currentModule.localNames[name]}`);
297
298
  }
@@ -1617,7 +1618,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1617
1618
  "Removes a " + n1 + " from the aggregation " + link + ".",
1618
1619
  "",
1619
1620
  "@param {int | string | " + makeTypeString(info, true) + "} " + varname(n1, "variant") + " The " + n1 + " to remove or its index or id",
1620
- "@returns {" + makeTypeString(info, true) + "} The removed " + n1 + " or <code>null</code>",
1621
+ "@returns {" + makeTypeString(info, true) + "|null} The removed " + n1 + " or <code>null</code>",
1621
1622
  info.since ? "@since " + info.since : "",
1622
1623
  info.deprecation ? "@deprecated " + info.deprecation : "",
1623
1624
  info.experimental ? "@experimental " + info.experimental : "",
@@ -1740,7 +1741,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1740
1741
  newJSDoc([
1741
1742
  "Removes an " + n1 + " from the association named " + link + ".",
1742
1743
  "@param {int | sap.ui.core.ID | " + info.type + "} " + varname(n1, "variant") + " The " + n1 + " to be removed or its index or ID",
1743
- "@returns {sap.ui.core.ID} The removed " + n1 + " or <code>null</code>",
1744
+ "@returns {sap.ui.core.ID|null} The removed " + n1 + " or <code>null</code>",
1744
1745
  info.since ? "@since " + info.since : "",
1745
1746
  info.deprecation ? "@deprecated " + info.deprecation : "",
1746
1747
  info.experimental ? "@experimental " + info.experimental : "",
@@ -1812,7 +1813,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1812
1813
  "",
1813
1814
  "@param {object}",
1814
1815
  " [oData] An application-specific payload object that will be passed to the event handler along with the event object when firing the event",
1815
- "@param {function}",
1816
+ "@param {function(sap.ui.base.Event):void}",
1816
1817
  " fnFunction The function to be called when the event occurs",
1817
1818
  "@param {object}",
1818
1819
  " [oListener] Context object to call the event handler with. Defaults to this <code>" + oClassInfo.name + "</code> itself",
@@ -1830,7 +1831,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1830
1831
  "",
1831
1832
  "The passed function and listener object must match the ones used for event registration.",
1832
1833
  "",
1833
- "@param {function}",
1834
+ "@param {function(sap.ui.base.Event):void}",
1834
1835
  " fnFunction The function to be called, when the event occurs",
1835
1836
  "@param {object}",
1836
1837
  " [oListener] Context object on which the given function had to be called",
@@ -2677,3 +2678,132 @@ exports.astNodeVisitor = {
2677
2678
  }
2678
2679
 
2679
2680
  };
2681
+
2682
+ (function() {
2683
+ const jsdocType = require("jsdoc/lib/jsdoc/tag/type");
2684
+ const catharsis = require('catharsis');
2685
+ const TYPES = catharsis.Types;
2686
+
2687
+ const toTypeString = (type) => getTypeStrings(type).join("|");
2688
+
2689
+ /*
2690
+ * This function has been copied from jsdoc/lib/jsdoc/tag/type (version 3.6.7)
2691
+ * The copy has been enhanced with the changes from https://github.com/jsdoc/jsdoc/pull/1735
2692
+ * to retain the full function signature for function types and with a further change
2693
+ * to retain the full record type structure.
2694
+ *
2695
+ * JSDoc is copyright (c) 2011-present Michael Mathews micmath@gmail.com and the contributors to JSDoc.
2696
+ */
2697
+ function getTypeStrings(parsedType, isOutermostType) {
2698
+ let applications;
2699
+ let typeString;
2700
+ let types = [];
2701
+ switch (parsedType.type) {
2702
+ case TYPES.AllLiteral:
2703
+ types.push('*');
2704
+ break;
2705
+ case TYPES.FunctionType:
2706
+ typeString = 'function';
2707
+ // #### BEGIN: MODIFIED BY SAP
2708
+ const paramTypes = [];
2709
+ if (parsedType.new) {
2710
+ paramTypes.push(toTypeString(parsedType.new));
2711
+ }
2712
+ if (Array.isArray(parsedType.params)) {
2713
+ paramTypes.push(...parsedType.params.map(toTypeString));
2714
+ }
2715
+ if (paramTypes.length || parsedType.result) {
2716
+ typeString += `(${paramTypes.join(", ")})`;
2717
+ }
2718
+ if (parsedType.result) {
2719
+ typeString += `:${toTypeString(parsedType.result)}`;
2720
+ }
2721
+ types.push(typeString);
2722
+ // #### END: MODIFIED BY SAP
2723
+ break;
2724
+ case TYPES.NameExpression:
2725
+ types.push(parsedType.name);
2726
+ break;
2727
+ case TYPES.NullLiteral:
2728
+ types.push('null');
2729
+ break;
2730
+ case TYPES.RecordType:
2731
+ // #### BEGIN: MODIFIED BY SAP
2732
+ // types.push('Object');
2733
+ if (Array.isArray(parsedType.fields)) {
2734
+ typeString = `{${parsedType.fields.map(
2735
+ ({key,value}) => {
2736
+ const keyString = catharsis.stringify(key);
2737
+ if (value) {
2738
+ var propertyPlusType = `${keyString}: ${toTypeString(value)}`;
2739
+ return propertyPlusType;
2740
+ } else {
2741
+ let pos;
2742
+ if (keyString && (pos = keyString.indexOf(":")) > -1) {
2743
+ // When no space is present between colon and type (e.g. the structure looks like "{x:number}" with no space after
2744
+ // the colon), then Catharsis parses this as property name "x:number" with no type given.
2745
+ // In this case give a clear hint that this space is needed and throw an error to prevent such issues from being merged
2746
+ const realName = keyString.substring(0, pos);
2747
+ const realValue = keyString.substring(pos + 1, keyString.length);
2748
+ let message = `Cannot parse the "${keyString}" part of "${parsedType.typeExpression}" in RecordType (log output above may give a hint in which file).\n`;
2749
+ message += `Did you mean to specify a property "${realName}" of type "${realValue}"? Then insert a space after the colon and write "${realName}: ${realValue}".`
2750
+ error(message);
2751
+ return "x: any"; // unparseable property set to "any" - but the JSDoc run will fail now, anyway
2752
+ } else {
2753
+ // only property given without type; this will be turned into type "any" further downstream
2754
+ return keyString;
2755
+ }
2756
+ }
2757
+ }
2758
+ ).join(', ')}}`;
2759
+ types.push(typeString);
2760
+ } else {
2761
+ types.push('Object');
2762
+ }
2763
+ // #### END: MODIFIED BY SAP
2764
+ break;
2765
+ case TYPES.TypeApplication:
2766
+ // if this is the outermost type, we strip the modifiers; otherwise, we keep them
2767
+ if (isOutermostType) {
2768
+ applications = parsedType.applications.map(application =>
2769
+ catharsis.stringify(application)).join(', ');
2770
+ typeString = `${getTypeStrings(parsedType.expression)[0]}.<${applications}>`;
2771
+ types.push(typeString);
2772
+ }
2773
+ else {
2774
+ types.push( catharsis.stringify(parsedType) );
2775
+ }
2776
+ break;
2777
+ case TYPES.TypeUnion:
2778
+ parsedType.elements.forEach(element => {
2779
+ types = types.concat( getTypeStrings(element) );
2780
+ });
2781
+ break;
2782
+ case TYPES.UndefinedLiteral:
2783
+ types.push('undefined');
2784
+ break;
2785
+ case TYPES.UnknownLiteral:
2786
+ types.push('?');
2787
+ break;
2788
+ default:
2789
+ // this shouldn't happen
2790
+ throw new Error(`unrecognized type ${parsedType.type} in parsed type: ${parsedType}`);
2791
+ }
2792
+ return types;
2793
+ }
2794
+
2795
+ const origParse = jsdocType.parse;
2796
+ jsdocType.parse = function() {
2797
+ const tagInfo = origParse.apply(this, arguments);
2798
+ // #### BEGIN: MODIFIED BY SAP
2799
+ if ( tagInfo && (/function/.test(tagInfo.typeExpression) || /\{.*\}/.test(tagInfo.typeExpression)) && tagInfo.parsedType ) {
2800
+ // #### END: MODIFIED BY SAP
2801
+ // console.info("old typeExpression", tagInfo.typeExpression);
2802
+ // console.info("old parse tree", tagInfo.parsedType);
2803
+ // console.info("old parse result", tagInfo.type);
2804
+ tagInfo.type = getTypeStrings(tagInfo.parsedType);
2805
+ // console.info("new parse result", tagInfo.type);
2806
+ }
2807
+ return tagInfo;
2808
+ }
2809
+ }());
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * JSDoc3 template for UI5 documentation generation.
3
3
  *
4
- * (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
4
+ * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
5
5
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
6
6
  */
7
7
 
@@ -1660,59 +1660,59 @@ function makeLinkList(aSymbols) {
1660
1660
  class ASTBuilder {
1661
1661
  literal(str) {
1662
1662
  return {
1663
- type: 'literal',
1663
+ type: "literal",
1664
1664
  value: str
1665
1665
  };
1666
1666
  }
1667
1667
  simpleType(type) {
1668
1668
  return {
1669
- type: 'simpleType',
1669
+ type: "simpleType",
1670
1670
  name: type
1671
1671
  };
1672
1672
  }
1673
1673
  array(componentType) {
1674
1674
  return {
1675
- type: 'array',
1675
+ type: "array",
1676
1676
  component: componentType
1677
1677
  };
1678
1678
  }
1679
1679
  object(keyType, valueType) {
1680
1680
  return {
1681
- type: 'object',
1681
+ type: "object",
1682
1682
  key: keyType,
1683
1683
  value: valueType
1684
1684
  };
1685
1685
  }
1686
1686
  set(elementType) {
1687
1687
  return {
1688
- type: 'set',
1688
+ type: "set",
1689
1689
  element: elementType
1690
1690
  };
1691
1691
  }
1692
1692
  promise(fulfillmentType) {
1693
1693
  return {
1694
- type: 'promise',
1694
+ type: "promise",
1695
1695
  fulfill: fulfillmentType
1696
1696
  };
1697
1697
  }
1698
1698
  "function"(paramTypes, returnType, thisType, constructorType) {
1699
1699
  return {
1700
- type: 'function',
1701
- params: paramTypes,
1700
+ "type": "function",
1701
+ "params": paramTypes,
1702
1702
  "return": returnType,
1703
1703
  "this": thisType,
1704
- constructor: constructorType
1704
+ "constructor": constructorType
1705
1705
  };
1706
1706
  }
1707
1707
  structure(structure) {
1708
1708
  return {
1709
- type: 'structure',
1709
+ type: "structure",
1710
1710
  fields: structure
1711
1711
  };
1712
1712
  }
1713
1713
  union(types) {
1714
1714
  return {
1715
- type: 'union',
1715
+ type: "union",
1716
1716
  types: types
1717
1717
  };
1718
1718
  }
@@ -1737,7 +1737,7 @@ class ASTBuilder {
1737
1737
  }
1738
1738
  typeApplication(type, templateTypes) {
1739
1739
  return {
1740
- type: 'typeApplication',
1740
+ type: "typeApplication",
1741
1741
  baseType: type,
1742
1742
  templateTypes: templateTypes
1743
1743
  };
@@ -1855,28 +1855,26 @@ class TypeStringBuilder {
1855
1855
  }
1856
1856
 
1857
1857
  function TypeParser(defaultBuilder = new ASTBuilder()) {
1858
+ const rLexer = /\s*(Array\.?<|Object\.?<|Set\.?<|Promise\.?<|function\(|\{|:|\(|\||\}|\.?<|>|\)|,|\[\]|\*|\?|!|=|\.\.\.)|\s*(false|true|(?:\+|-)?(?:\d+(?:\.\d+)?|NaN|Infinity)|'[^']*'|"[^"]*"|null|undefined)|\s*((?:module:)?\w+(?:[/.#~]\w+)*)|./g;
1858
1859
 
1859
- /* TODO
1860
- * - function(this:) // type of this
1861
- * - function(new:) // constructor
1862
- */
1863
- const rLexer = /\s*(Array\.?<|Object\.?<|Set\.?<|Promise\.?<|function\(|\{|:|\(|\||\}|\.?<|>|\)|,|\[\]|\*|\?|!|=|\.\.\.)|\s*(false|true|(?:\+|-)?(?:\d+(?:\.\d+)?|NaN|Infinity)|'[^']*'|"[^"]*"|null|undefined)|\s*((?:module:)?\w+(?:[\/.#~]\w+)*)|./g;
1864
-
1865
- let input,
1866
- builder,
1867
- token,
1868
- tokenStr;
1860
+ let input;
1861
+ let builder;
1862
+ let token;
1863
+ let tokenStr;
1869
1864
 
1870
1865
  function next(expected) {
1871
1866
  if ( expected !== undefined && token !== expected ) {
1872
- throw new SyntaxError(`TypeParser: expected '${expected}', but found '${tokenStr}' (pos: ${rLexer.lastIndex}, input='${input}')`);
1867
+ throw new SyntaxError(
1868
+ `TypeParser: expected '${expected}', but found '${tokenStr}' ` +
1869
+ `(pos: ${rLexer.lastIndex}, input='${input}')`
1870
+ );
1873
1871
  }
1874
1872
  const match = rLexer.exec(input);
1875
1873
  if ( match ) {
1876
1874
  tokenStr = match[1] || match[2] || match[3];
1877
- token = match[1] || (match[2] && 'literal') || (match[3] && 'symbol');
1875
+ token = match[1] || (match[2] && "literal") || (match[3] && "symbol");
1878
1876
  if ( !token ) {
1879
- throw new SyntaxError(`TypeParser: unexpected '${tokenStr}' (pos: ${match.index}, input='${input}')`);
1877
+ throw new SyntaxError(`TypeParser: unexpected '${match[0]}' (pos: ${match.index}, input='${input}')`);
1880
1878
  }
1881
1879
  } else {
1882
1880
  tokenStr = token = null;
@@ -1886,147 +1884,166 @@ function TypeParser(defaultBuilder = new ASTBuilder()) {
1886
1884
  function parseType() {
1887
1885
  let nullable = false;
1888
1886
  let mandatory = false;
1889
- if ( token === '?' ) {
1887
+ if ( token === "?" ) {
1890
1888
  next();
1891
1889
  nullable = true;
1892
- } else if ( token === '!' ) {
1890
+ } else if ( token === "!" ) {
1893
1891
  next();
1894
1892
  mandatory = true;
1895
1893
  }
1896
1894
 
1897
1895
  let type;
1898
1896
 
1899
- if ( token === 'literal' ) {
1897
+ if ( token === "literal" ) {
1900
1898
  type = builder.literal(tokenStr);
1901
1899
  next();
1902
- } else if ( token === 'Array.<' || token === 'Array<' ) {
1900
+ } else if ( token === "Array.<" || token === "Array<" ) {
1903
1901
  next();
1904
- const componentType = parseType();
1905
- next('>');
1902
+ const componentType = parseTypes();
1903
+ next(">");
1906
1904
  type = builder.array(componentType);
1907
- } else if ( token === 'Object.<' || token === 'Object<' ) {
1905
+ } else if ( token === "Object.<" || token === "Object<" ) {
1908
1906
  next();
1909
1907
  let keyType;
1910
- let valueType = parseType();
1911
- if ( token === ',' ) {
1908
+ let valueType = parseTypes();
1909
+ if ( token === "," ) {
1912
1910
  next();
1913
1911
  keyType = valueType;
1914
- valueType = parseType();
1912
+ valueType = parseTypes();
1915
1913
  } else {
1916
- keyType = builder.synthetic(builder.simpleType('string'));
1914
+ keyType = builder.synthetic(builder.simpleType("string"));
1917
1915
  }
1918
- next('>');
1916
+ next(">");
1919
1917
  type = builder.object(keyType, valueType);
1920
- } else if ( token === 'Set.<' || token === 'Set<' ) {
1918
+ } else if ( token === "Set.<" || token === "Set<" ) {
1921
1919
  next();
1922
- const elementType = parseType();
1923
- next('>');
1920
+ const elementType = parseTypes();
1921
+ next(">");
1924
1922
  type = builder.set(elementType);
1925
- } else if ( token === 'Promise.<' || token === 'Promise<' ) {
1923
+ } else if ( token === "Promise.<" || token === "Promise<" ) {
1926
1924
  next();
1927
- const resultType = parseType();
1928
- next('>');
1925
+ const resultType = parseTypes();
1926
+ next(">");
1929
1927
  type = builder.promise(resultType);
1930
- } else if ( token === 'function(' ) {
1928
+ } else if ( token === "function(" ) {
1931
1929
  next();
1932
- let thisType, constructorType, paramTypes = [], returnType;
1933
- if ( tokenStr === 'this' ) {
1930
+ let thisType;
1931
+ let constructorType;
1932
+ const paramTypes = [];
1933
+ let returnType;
1934
+ if ( tokenStr === "this" ) {
1934
1935
  next();
1935
- next(':');
1936
+ next(":");
1936
1937
  thisType = parseType();
1937
- if ( token === ',' ) {
1938
- next();
1938
+ if ( token !== ")" ) {
1939
+ next(",");
1939
1940
  }
1940
- } else if ( tokenStr === 'new' ) {
1941
+ } else if ( tokenStr === "new" ) {
1941
1942
  next();
1942
- next(':');
1943
+ next(":");
1943
1944
  constructorType = parseType();
1944
- if ( token === ',' ) {
1945
- next();
1945
+ if ( token !== ")" ) {
1946
+ next(",");
1946
1947
  }
1947
1948
  }
1948
- while ( token === 'symbol' || token === '...' ) {
1949
- const repeatable = token === '...';
1950
- if ( repeatable) {
1949
+ while ( token !== ")" ) {
1950
+ const repeatable = token === "...";
1951
+ if ( repeatable ) {
1951
1952
  next();
1952
1953
  }
1953
- let paramType = parseType();
1954
+ let paramType = parseTypes();
1954
1955
  if ( repeatable ) {
1955
1956
  paramType = builder.repeatable(paramType);
1956
1957
  }
1957
- const optional = token === '=';
1958
+ const optional = token === "=";
1958
1959
  if ( optional ) {
1959
1960
  builder.optional(paramType);
1960
1961
  next();
1961
1962
  }
1962
1963
  paramTypes.push(paramType);
1963
- if ( token === ',' ) {
1964
- if ( repeatable ) {
1965
- throw new SyntaxError(`TypeParser: only the last parameter of a function can be repeatable (pos: ${rLexer.lastIndex}, input='${input}')`);
1966
- }
1967
- next();
1964
+
1965
+ // exit if there are no more parameters
1966
+ if ( token !== "," ) {
1967
+ break;
1968
1968
  }
1969
+
1970
+ if ( repeatable ) {
1971
+ throw new SyntaxError(
1972
+ `TypeParser: only the last parameter of a function can be repeatable ` +
1973
+ `(pos: ${rLexer.lastIndex}, input='${input}')`
1974
+ );
1975
+ }
1976
+
1977
+ // consume the comma
1978
+ next();
1969
1979
  }
1970
- next(')');
1971
- if ( token === ':' ) {
1972
- next(':');
1980
+ next(")");
1981
+ if ( token === ":" ) {
1982
+ next(":");
1973
1983
  returnType = parseType();
1974
1984
  }
1975
1985
  type = builder.function(paramTypes, returnType, thisType, constructorType);
1976
- } else if ( token === '{' ) {
1986
+ } else if ( token === "{" ) {
1977
1987
  const structure = Object.create(null);
1978
1988
  next();
1979
1989
  do {
1980
1990
  const propName = tokenStr;
1981
1991
  if ( !/^\w+$/.test(propName) ) {
1982
- throw new SyntaxError(`TypeParser: structure field must have a simple name (pos: ${rLexer.lastIndex}, input='${input}', field:'${propName}')`);
1992
+ throw new SyntaxError(
1993
+ `TypeParser: structure field must have a simple name ` +
1994
+ `(pos: ${rLexer.lastIndex}, input='${input}', field:'${propName}')`
1995
+ );
1983
1996
  }
1984
- next('symbol');
1997
+ next("symbol");
1985
1998
  let propType;
1986
- if ( token === ':' ) {
1999
+ if ( token === ":" ) {
1987
2000
  next();
1988
- propType = parseType();
2001
+ propType = parseTypes();
1989
2002
  } else {
1990
- propType = builder.synthetic(builder.simpleType('any'));
2003
+ propType = builder.synthetic(builder.simpleType("any"));
1991
2004
  }
1992
2005
  structure[propName] = propType;
1993
- if ( token === '}' ) {
2006
+ if ( token === "}" ) {
1994
2007
  break;
1995
2008
  }
1996
- next(',');
2009
+ next(",");
1997
2010
  } while (token);
1998
- next('}');
2011
+ next("}");
1999
2012
  type = builder.structure(structure);
2000
- } else if ( token === '(' ) {
2013
+ } else if ( token === "(" ) {
2001
2014
  next();
2002
2015
  type = parseTypes();
2003
- next(')');
2004
- } else if ( token === '*' ) {
2016
+ next(")");
2017
+ } else if ( token === "*" ) {
2005
2018
  next();
2006
- type = builder.simpleType('*');
2019
+ type = builder.simpleType("*");
2007
2020
  } else {
2008
2021
  type = builder.simpleType(tokenStr);
2009
- next('symbol');
2022
+ next("symbol");
2010
2023
  // check for suffix operators: either 'type application' (generics) or 'array', but not both of them
2011
2024
  if ( token === "<" || token === ".<" ) {
2012
2025
  next();
2013
2026
  const templateTypes = [];
2014
- while ( token !== ">" ) {
2015
- const templateType = parseType();
2027
+ do {
2028
+ const templateType = parseTypes();
2016
2029
  templateTypes.push(templateType);
2017
- if ( token === ',' ) {
2018
- next();
2030
+ if ( token === ">" ) {
2031
+ break;
2019
2032
  }
2020
- }
2033
+ next(",");
2034
+ } while (token);
2021
2035
  next(">");
2022
2036
  type = builder.typeApplication(type, templateTypes);
2023
2037
  } else {
2024
- while ( token === '[]' ) {
2038
+ while ( token === "[]" ) {
2025
2039
  next();
2026
2040
  type = builder.array(type);
2027
2041
  }
2028
2042
  }
2029
2043
  }
2044
+ if ( builder.normalizeType ) {
2045
+ type = builder.normalizeType(type);
2046
+ }
2030
2047
  if ( nullable ) {
2031
2048
  type = builder.nullable(type);
2032
2049
  }
@@ -2040,7 +2057,7 @@ function TypeParser(defaultBuilder = new ASTBuilder()) {
2040
2057
  const types = [];
2041
2058
  do {
2042
2059
  types.push(parseType());
2043
- if ( token !== '|' ) {
2060
+ if ( token !== "|" ) {
2044
2061
  break;
2045
2062
  }
2046
2063
  next();
@@ -2065,7 +2082,6 @@ function TypeParser(defaultBuilder = new ASTBuilder()) {
2065
2082
  next(null);
2066
2083
  return type;
2067
2084
  };
2068
-
2069
2085
  }
2070
2086
 
2071
2087
  class TypeLinkBuilder extends TypeStringBuilder {
@@ -3428,17 +3444,22 @@ const builtinTypes = {
3428
3444
  WeakMap: true,
3429
3445
 
3430
3446
  // Web APIs
3447
+ Attr:true,
3431
3448
  Blob:true,
3449
+ DataTransfer:true,
3432
3450
  Document:true,
3433
3451
  Element:true,
3434
3452
  Event:true,
3435
3453
  File:true,
3436
- HTMLElement: true,
3454
+ FileList:true,
3455
+ HTMLDocument:true,
3456
+ HTMLElement:true,
3437
3457
  Node:true,
3438
3458
  Storage:true,
3439
3459
  Touch:true,
3440
3460
  TouchList:true,
3441
- Window: true
3461
+ Window:true,
3462
+ XMLDocument:true
3442
3463
 
3443
3464
  };
3444
3465
 
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- const rSinceVersion = /^([0-9]+(?:\.[0-9]+(?:\.[0-9]+)?)?([-.][0-9A-Z]+)?)(\.$|\.\s+|[,:]\s*|\s-\s*|\s|$)/i;
3
+ const rSinceVersion = /^([0-9]+(?:\.[0-9]+(?:\.[0-9]+)?)?([-.][0-9A-Z]+)?)(\.$|\.\s+|[,:;]\s*|\s-\s*|\s|$)/i;
4
4
  function _parseVersion(value) {
5
5
  const m = rSinceVersion.exec(value);
6
6
  if (m) {
@@ -43,7 +43,7 @@ function getCreatorOptions(projectName) {
43
43
  *
44
44
  * <p>
45
45
  * The detailed structure can be found in the documentation:
46
- * {@link https://openui5.hana.ondemand.com/#topic/adcbcf8b50924556ab3f321fcd9353ea}
46
+ * {@link https://sdk.openui5.org/topic/adcbcf8b50924556ab3f321fcd9353ea}
47
47
  * </p>
48
48
  *
49
49
  * <p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "2.11.5",
3
+ "version": "2.11.7",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -40,7 +40,7 @@
40
40
  "version": "git-chglog --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
41
41
  "postversion": "git push --follow-tags",
42
42
  "release-note": "git-chglog -c .chglog/release-config.yml v$npm_package_version",
43
- "depcheck": "depcheck --ignores docdash"
43
+ "depcheck": "depcheck --ignores docdash --ignore-patterns lib/processors/jsdoc/lib/ui5"
44
44
  },
45
45
  "files": [
46
46
  "index.js",
@@ -108,19 +108,19 @@
108
108
  "@ui5/logger": "^2.0.1",
109
109
  "cheerio": "1.0.0-rc.9",
110
110
  "escape-unicode": "^0.2.0",
111
- "escope": "^3.6.0",
111
+ "escope": "^4.0.0",
112
112
  "espree": "^6.2.1",
113
113
  "globby": "^11.1.0",
114
114
  "graceful-fs": "^4.2.10",
115
- "jsdoc": "^3.6.10",
115
+ "jsdoc": "^3.6.11",
116
116
  "less-openui5": "^0.11.2",
117
117
  "make-dir": "^3.1.0",
118
118
  "pretty-data": "^0.40.0",
119
119
  "pretty-hrtime": "^1.0.3",
120
120
  "replacestream": "^4.0.3",
121
121
  "rimraf": "^3.0.2",
122
- "semver": "^7.3.7",
123
- "terser": "^5.13.1",
122
+ "semver": "^7.3.8",
123
+ "terser": "^5.15.1",
124
124
  "xml2js": "^0.4.23",
125
125
  "yazl": "^2.5.1"
126
126
  },