@ui5/builder 2.11.5 → 3.0.0-alpha.10

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +125 -12
  2. package/index.js +4 -59
  3. package/jsdoc.json +0 -1
  4. package/lib/lbt/analyzer/JSModuleAnalyzer.js +31 -5
  5. package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +2 -1
  6. package/lib/lbt/bundle/AutoSplitter.js +10 -24
  7. package/lib/lbt/bundle/Builder.js +367 -168
  8. package/lib/lbt/bundle/BundleWriter.js +17 -0
  9. package/lib/lbt/bundle/Resolver.js +3 -3
  10. package/lib/lbt/resources/LocatorResource.js +7 -9
  11. package/lib/lbt/resources/LocatorResourcePool.js +8 -4
  12. package/lib/lbt/resources/Resource.js +7 -0
  13. package/lib/lbt/resources/ResourceCollector.js +43 -18
  14. package/lib/lbt/resources/ResourceInfoList.js +0 -1
  15. package/lib/lbt/resources/ResourcePool.js +7 -6
  16. package/lib/lbt/utils/escapePropertiesFile.js +3 -6
  17. package/lib/lbt/utils/parseUtils.js +1 -1
  18. package/lib/processors/bundlers/moduleBundler.js +42 -17
  19. package/lib/processors/jsdoc/lib/createIndexFiles.js +1 -1
  20. package/lib/processors/jsdoc/lib/transformApiJson.js +7 -16
  21. package/lib/processors/jsdoc/lib/ui5/plugin.js +111 -6
  22. package/lib/processors/jsdoc/lib/ui5/template/publish.js +112 -91
  23. package/lib/processors/jsdoc/lib/ui5/template/utils/versionUtil.js +1 -1
  24. package/lib/processors/manifestCreator.js +8 -45
  25. package/lib/processors/minifier.js +90 -0
  26. package/lib/processors/resourceListCreator.js +2 -16
  27. package/lib/tasks/buildThemes.js +1 -1
  28. package/lib/tasks/bundlers/generateBundle.js +82 -14
  29. package/lib/tasks/bundlers/generateComponentPreload.js +31 -17
  30. package/lib/tasks/bundlers/generateFlexChangesBundle.js +7 -3
  31. package/lib/tasks/bundlers/generateLibraryPreload.js +127 -79
  32. package/lib/tasks/bundlers/generateManifestBundle.js +8 -10
  33. package/lib/tasks/bundlers/generateStandaloneAppBundle.js +54 -15
  34. package/lib/tasks/bundlers/utils/createModuleNameMapping.js +31 -0
  35. package/lib/tasks/generateCachebusterInfo.js +7 -3
  36. package/lib/tasks/generateLibraryManifest.js +6 -8
  37. package/lib/tasks/generateResourcesJson.js +15 -9
  38. package/lib/tasks/generateThemeDesignerResources.js +118 -2
  39. package/lib/tasks/generateVersionInfo.js +5 -5
  40. package/lib/tasks/jsdoc/generateJsdoc.js +1 -1
  41. package/lib/tasks/minify.js +41 -0
  42. package/lib/tasks/replaceVersion.js +1 -1
  43. package/lib/tasks/taskRepository.js +7 -15
  44. package/lib/tasks/transformBootstrapHtml.js +6 -1
  45. package/package.json +20 -19
  46. package/lib/builder/BuildContext.js +0 -39
  47. package/lib/builder/ProjectBuildContext.js +0 -55
  48. package/lib/builder/builder.js +0 -420
  49. package/lib/processors/debugFileCreator.js +0 -52
  50. package/lib/processors/resourceCopier.js +0 -24
  51. package/lib/processors/uglifier.js +0 -45
  52. package/lib/tasks/TaskUtil.js +0 -160
  53. package/lib/tasks/createDebugFiles.js +0 -30
  54. package/lib/tasks/uglify.js +0 -33
  55. package/lib/types/AbstractBuilder.js +0 -270
  56. package/lib/types/AbstractFormatter.js +0 -66
  57. package/lib/types/AbstractUi5Formatter.js +0 -95
  58. package/lib/types/application/ApplicationBuilder.js +0 -220
  59. package/lib/types/application/ApplicationFormatter.js +0 -227
  60. package/lib/types/application/applicationType.js +0 -15
  61. package/lib/types/library/LibraryBuilder.js +0 -237
  62. package/lib/types/library/LibraryFormatter.js +0 -519
  63. package/lib/types/library/libraryType.js +0 -15
  64. package/lib/types/module/ModuleBuilder.js +0 -7
  65. package/lib/types/module/ModuleFormatter.js +0 -54
  66. package/lib/types/module/moduleType.js +0 -15
  67. package/lib/types/themeLibrary/ThemeLibraryBuilder.js +0 -62
  68. package/lib/types/themeLibrary/ThemeLibraryFormatter.js +0 -90
  69. package/lib/types/themeLibrary/themeLibraryType.js +0 -15
  70. package/lib/types/typeRepository.js +0 -46
@@ -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 : "",
@@ -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,107 @@ 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.
2693
+ *
2694
+ * JSDoc is copyright (c) 2011-present Michael Mathews micmath@gmail.com and the contributors to JSDoc.
2695
+ */
2696
+ function getTypeStrings(parsedType, isOutermostType) {
2697
+ let applications;
2698
+ let typeString;
2699
+ let types = [];
2700
+ switch (parsedType.type) {
2701
+ case TYPES.AllLiteral:
2702
+ types.push('*');
2703
+ break;
2704
+ case TYPES.FunctionType:
2705
+ typeString = 'function';
2706
+ // #### BEGIN: MODIFIED BY SAP
2707
+ const paramTypes = [];
2708
+ if (parsedType.new) {
2709
+ paramTypes.push(toTypeString(parsedType.new));
2710
+ }
2711
+ if (Array.isArray(parsedType.params)) {
2712
+ paramTypes.push(...parsedType.params.map(toTypeString));
2713
+ }
2714
+ if (paramTypes.length || parsedType.result) {
2715
+ typeString += `(${paramTypes.join(", ")})`;
2716
+ }
2717
+ if (parsedType.result) {
2718
+ typeString += `:${toTypeString(parsedType.result)}`;
2719
+ }
2720
+ types.push(typeString);
2721
+ // #### END: MODIFIED BY SAP
2722
+ break;
2723
+ case TYPES.NameExpression:
2724
+ types.push(parsedType.name);
2725
+ break;
2726
+ case TYPES.NullLiteral:
2727
+ types.push('null');
2728
+ break;
2729
+ case TYPES.RecordType:
2730
+ // #### BEGIN: MODIFIED BY SAP
2731
+ // types.push('Object');
2732
+ if (Array.isArray(parsedType.fields)) {
2733
+ typeString = `{${parsedType.fields.map(
2734
+ ({key,value}) => `${catharsis.stringify(key)}: ${toTypeString(value)}`
2735
+ ).join(', ')}}`;
2736
+ types.push(typeString);
2737
+ } else {
2738
+ types.push('Object');
2739
+ }
2740
+ // #### END: MODIFIED BY SAP
2741
+ break;
2742
+ case TYPES.TypeApplication:
2743
+ // if this is the outermost type, we strip the modifiers; otherwise, we keep them
2744
+ if (isOutermostType) {
2745
+ applications = parsedType.applications.map(application =>
2746
+ catharsis.stringify(application)).join(', ');
2747
+ typeString = `${getTypeStrings(parsedType.expression)[0]}.<${applications}>`;
2748
+ types.push(typeString);
2749
+ }
2750
+ else {
2751
+ types.push( catharsis.stringify(parsedType) );
2752
+ }
2753
+ break;
2754
+ case TYPES.TypeUnion:
2755
+ parsedType.elements.forEach(element => {
2756
+ types = types.concat( getTypeStrings(element) );
2757
+ });
2758
+ break;
2759
+ case TYPES.UndefinedLiteral:
2760
+ types.push('undefined');
2761
+ break;
2762
+ case TYPES.UnknownLiteral:
2763
+ types.push('?');
2764
+ break;
2765
+ default:
2766
+ // this shouldn't happen
2767
+ throw new Error(`unrecognized type ${parsedType.type} in parsed type: ${parsedType}`);
2768
+ }
2769
+ return types;
2770
+ }
2771
+
2772
+ const origParse = jsdocType.parse;
2773
+ jsdocType.parse = function() {
2774
+ const tagInfo = origParse.apply(this, arguments);
2775
+ if ( tagInfo && /function/.test(tagInfo.typeExpression) && tagInfo.parsedType ) {
2776
+ // console.info("old typeExpression", tagInfo.typeExpression);
2777
+ // console.info("old parse tree", tagInfo.parsedType);
2778
+ // console.info("old parse result", tagInfo.type);
2779
+ tagInfo.type = getTypeStrings(tagInfo.parsedType);
2780
+ // console.info("new parse result", tagInfo.type);
2781
+ }
2782
+ return tagInfo;
2783
+ }
2784
+ }());
@@ -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) {
@@ -157,7 +157,9 @@ class LibraryBundle {
157
157
  /*
158
158
  * Creates the library manifest.json file for a UILibrary.
159
159
  */
160
- async function createManifest(libraryResource, libBundle, descriptorVersion, _include3rdParty, omitMinVersions) {
160
+ async function createManifest(
161
+ libraryResource, libBundle, descriptorVersion, _include3rdParty, omitMinVersions, getProjectVersion
162
+ ) {
161
163
  // create a Library wrapper around the .library XML
162
164
  const library = await Library.from(libraryResource);
163
165
 
@@ -223,13 +225,6 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
223
225
  return version && version !== "@version@" && version !== "${version}";
224
226
  }
225
227
 
226
- function getProjectVersion() {
227
- const project = libraryResource._project;
228
- if ( project ) {
229
- return project.version;
230
- }
231
- }
232
-
233
228
  function getLibraryTitle() {
234
229
  if ( library.getTitle() ) {
235
230
  return library.getTitle();
@@ -321,7 +316,7 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
321
316
  embeds: findEmbeddedComponents(),
322
317
  i18n,
323
318
  applicationVersion: {
324
- version: isValid(library.getVersion()) ? library.getVersion() : getProjectVersion()
319
+ version: isValid(library.getVersion()) ? library.getVersion() : getProjectVersion(library.getName())
325
320
  },
326
321
  title: getLibraryTitle(),
327
322
  description: library.getDocumentation(),
@@ -393,12 +388,7 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
393
388
 
394
389
  function createSapUI5() {
395
390
  function getUI5Version() {
396
- const dummy = new Dependency({
397
- libraryName: [{
398
- _: "sap.ui.core"
399
- }]
400
- });
401
- return normalizeVersion(getVersion(dummy));
391
+ return normalizeVersion(getProjectVersion("sap.ui.core"));
402
392
  }
403
393
 
404
394
  function dependencies() {
@@ -410,7 +400,7 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
410
400
  if ( library.getDependencies() != null ) {
411
401
  for (const dep of library.getDependencies()) {
412
402
  dependencies.libs[dep.getLibraryName()] = {
413
- minVersion: omitMinVersions ? "" : getVersion(dep),
403
+ minVersion: omitMinVersions ? "" : getProjectVersion(dep.getLibraryName()),
414
404
  lazy: dep.isLazy() || undefined // suppress default (false)
415
405
  };
416
406
  }
@@ -619,33 +609,6 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
619
609
  return v.major + "." + v.minor;
620
610
  }
621
611
 
622
- function getVersion(dependency) {
623
- const version = dependency.getVersion();
624
- if ( version != null ) {
625
- return version;
626
- }
627
-
628
- function hasName(entity) {
629
- return entity.metadata && entity.metadata.name === dependency.getLibraryName();
630
- }
631
-
632
- const project = libraryResource._project;
633
- if ( project ) {
634
- if ( Array.isArray(project.dependencies) ) {
635
- const lib = project.dependencies.find(hasName);
636
- if ( lib ) {
637
- return lib.version;
638
- }
639
- }
640
- if ( hasName(project) ) {
641
- return project.version;
642
- }
643
- }
644
-
645
- throw new Error(
646
- `Couldn't find version for library '${dependency.getLibraryName()}', project dependency missing?`);
647
- }
648
-
649
612
  return {
650
613
  "_version": descriptorVersion.toString(),
651
614
  "sap.app": createSapApp(),
@@ -657,7 +620,7 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
657
620
  };
658
621
  }
659
622
 
660
- module.exports = function({libraryResource, resources, options}) {
623
+ module.exports = function({libraryResource, resources, getProjectVersion, options}) {
661
624
  // merge options with defaults
662
625
  options = Object.assign({
663
626
  descriptorVersion: APP_DESCRIPTOR_V22, // TODO 3.0: change this to type string instead of a semver object
@@ -677,7 +640,7 @@ module.exports = function({libraryResource, resources, options}) {
677
640
  }
678
641
 
679
642
  return createManifest(libraryResource, libBundle, options.descriptorVersion, options.include3rdParty,
680
- options.omitMinVersions)
643
+ options.omitMinVersions, getProjectVersion)
681
644
  .then((manifest) => {
682
645
  return new EvoResource({
683
646
  path: resourcePathPrefix + "manifest.json",