@ui5/builder 3.0.0-alpha.7 → 3.0.0-alpha.8
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 +5 -1
- package/lib/lbt/bundle/Builder.js +1 -1
- package/lib/processors/jsdoc/lib/createIndexFiles.js +1 -1
- package/lib/processors/jsdoc/lib/transformApiJson.js +7 -16
- package/lib/processors/jsdoc/lib/ui5/plugin.js +111 -6
- package/lib/processors/jsdoc/lib/ui5/template/publish.js +112 -91
- package/lib/processors/jsdoc/lib/ui5/template/utils/versionUtil.js +1 -1
- package/lib/tasks/TaskUtil.js +3 -3
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
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/v3.0.0-alpha.
|
|
5
|
+
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.8...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v3.0.0-alpha.8"></a>
|
|
8
|
+
## [v3.0.0-alpha.8] - 2022-07-14
|
|
6
9
|
|
|
7
10
|
<a name="v3.0.0-alpha.7"></a>
|
|
8
11
|
## [v3.0.0-alpha.7] - 2022-06-14
|
|
@@ -741,6 +744,7 @@ to load the custom bundle file instead.
|
|
|
741
744
|
- Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
|
|
742
745
|
|
|
743
746
|
|
|
747
|
+
[v3.0.0-alpha.8]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.7...v3.0.0-alpha.8
|
|
744
748
|
[v3.0.0-alpha.7]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.6...v3.0.0-alpha.7
|
|
745
749
|
[v3.0.0-alpha.6]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.5...v3.0.0-alpha.6
|
|
746
750
|
[v3.0.0-alpha.5]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.4...v3.0.0-alpha.5
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const {pd} = require("pretty-data");
|
|
7
7
|
const {parseJS, Syntax} = require("../utils/parseUtils");
|
|
8
|
-
const {encode: encodeMappings, decode: decodeMappings} = require("sourcemap-codec");
|
|
8
|
+
const {encode: encodeMappings, decode: decodeMappings} = require("@jridgewell/sourcemap-codec");
|
|
9
9
|
|
|
10
10
|
const {isMethodCall} = require("../utils/ASTUtils");
|
|
11
11
|
const ModuleName = require("../utils/ModuleName");
|
|
@@ -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-
|
|
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-
|
|
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
|
|
|
@@ -1154,7 +1154,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1154
1154
|
},
|
|
1155
1155
|
|
|
1156
1156
|
formatMethodCode: function (sName, aParams, aReturnValue) {
|
|
1157
|
-
var result = '<pre
|
|
1157
|
+
var result = '<pre>' + sName + '(';
|
|
1158
1158
|
|
|
1159
1159
|
if (aParams && aParams.length > 0) {
|
|
1160
1160
|
/* We consider only root level parameters so we get rid of all that are not on the root level */
|
|
@@ -1258,7 +1258,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1258
1258
|
* @returns string - The code needed to create an object of that class
|
|
1259
1259
|
*/
|
|
1260
1260
|
formatConstructor: function (name, params) {
|
|
1261
|
-
var result = '<pre
|
|
1261
|
+
var result = '<pre>new ';
|
|
1262
1262
|
|
|
1263
1263
|
if (name) {
|
|
1264
1264
|
result += name + '(';
|
|
@@ -1508,8 +1508,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1508
1508
|
name: oResult.static ? [self.name, oResult.name].join(".") : oResult.name,
|
|
1509
1509
|
type: "methods",
|
|
1510
1510
|
className: className,
|
|
1511
|
-
text: text
|
|
1512
|
-
local: true
|
|
1511
|
+
text: text
|
|
1513
1512
|
});
|
|
1514
1513
|
}
|
|
1515
1514
|
}
|
|
@@ -1549,7 +1548,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1549
1548
|
* @param {string} [hrefAppend=""]
|
|
1550
1549
|
* @returns {string} link
|
|
1551
1550
|
*/
|
|
1552
|
-
createLink: function ({name, type, className, text=name,
|
|
1551
|
+
createLink: function ({name, type, className, text=name, hrefAppend=""}) {
|
|
1553
1552
|
let sLink;
|
|
1554
1553
|
|
|
1555
1554
|
// handling module's
|
|
@@ -1564,12 +1563,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1564
1563
|
sLink += hrefAppend;
|
|
1565
1564
|
}
|
|
1566
1565
|
|
|
1567
|
-
|
|
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>`;
|
|
1566
|
+
return `<a target="_self" href="api/${sLink}">${text}</a>`;
|
|
1573
1567
|
},
|
|
1574
1568
|
|
|
1575
1569
|
/**
|
|
@@ -1597,7 +1591,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1597
1591
|
}
|
|
1598
1592
|
|
|
1599
1593
|
// topic:xxx Topic
|
|
1600
|
-
aMatch = sTarget.match(/^topic:(\w{32})$/);
|
|
1594
|
+
aMatch = sTarget.match(/^topic:(\w{32}(?:#\w*)?(?:\/\w*)?)$/);
|
|
1601
1595
|
if (aMatch) {
|
|
1602
1596
|
return '<a target="_self" href="topic/' + aMatch[1] + '">' + sText + '</a>';
|
|
1603
1597
|
}
|
|
@@ -1665,7 +1659,6 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1665
1659
|
name: aMatch[1] ? `${oSelf.name}.${aMatch[2]}` : aMatch[2],
|
|
1666
1660
|
type: "methods",
|
|
1667
1661
|
className: oSelf.name,
|
|
1668
|
-
local: true,
|
|
1669
1662
|
text: sText
|
|
1670
1663
|
});
|
|
1671
1664
|
}
|
|
@@ -1677,7 +1670,6 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1677
1670
|
name: aMatch[1],
|
|
1678
1671
|
type: "annotations",
|
|
1679
1672
|
className: oSelf.name,
|
|
1680
|
-
local: true,
|
|
1681
1673
|
text: sText
|
|
1682
1674
|
});
|
|
1683
1675
|
}
|
|
@@ -1704,7 +1696,6 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1704
1696
|
name: aMatch[1],
|
|
1705
1697
|
type: "events",
|
|
1706
1698
|
className: oSelf.name,
|
|
1707
|
-
local: true,
|
|
1708
1699
|
text: sText
|
|
1709
1700
|
});
|
|
1710
1701
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* JSDoc3 plugin for UI5 documentation generation.
|
|
3
3
|
*
|
|
4
|
-
* (c) Copyright 2009-
|
|
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
|
-
|
|
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:
|
|
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-
|
|
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:
|
|
1663
|
+
type: "literal",
|
|
1664
1664
|
value: str
|
|
1665
1665
|
};
|
|
1666
1666
|
}
|
|
1667
1667
|
simpleType(type) {
|
|
1668
1668
|
return {
|
|
1669
|
-
type:
|
|
1669
|
+
type: "simpleType",
|
|
1670
1670
|
name: type
|
|
1671
1671
|
};
|
|
1672
1672
|
}
|
|
1673
1673
|
array(componentType) {
|
|
1674
1674
|
return {
|
|
1675
|
-
type:
|
|
1675
|
+
type: "array",
|
|
1676
1676
|
component: componentType
|
|
1677
1677
|
};
|
|
1678
1678
|
}
|
|
1679
1679
|
object(keyType, valueType) {
|
|
1680
1680
|
return {
|
|
1681
|
-
type:
|
|
1681
|
+
type: "object",
|
|
1682
1682
|
key: keyType,
|
|
1683
1683
|
value: valueType
|
|
1684
1684
|
};
|
|
1685
1685
|
}
|
|
1686
1686
|
set(elementType) {
|
|
1687
1687
|
return {
|
|
1688
|
-
type:
|
|
1688
|
+
type: "set",
|
|
1689
1689
|
element: elementType
|
|
1690
1690
|
};
|
|
1691
1691
|
}
|
|
1692
1692
|
promise(fulfillmentType) {
|
|
1693
1693
|
return {
|
|
1694
|
-
type:
|
|
1694
|
+
type: "promise",
|
|
1695
1695
|
fulfill: fulfillmentType
|
|
1696
1696
|
};
|
|
1697
1697
|
}
|
|
1698
1698
|
"function"(paramTypes, returnType, thisType, constructorType) {
|
|
1699
1699
|
return {
|
|
1700
|
-
type:
|
|
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:
|
|
1709
|
+
type: "structure",
|
|
1710
1710
|
fields: structure
|
|
1711
1711
|
};
|
|
1712
1712
|
}
|
|
1713
1713
|
union(types) {
|
|
1714
1714
|
return {
|
|
1715
|
-
type:
|
|
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:
|
|
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
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
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(
|
|
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] &&
|
|
1875
|
+
token = match[1] || (match[2] && "literal") || (match[3] && "symbol");
|
|
1878
1876
|
if ( !token ) {
|
|
1879
|
-
throw new SyntaxError(`TypeParser: unexpected '${
|
|
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 ===
|
|
1897
|
+
if ( token === "literal" ) {
|
|
1900
1898
|
type = builder.literal(tokenStr);
|
|
1901
1899
|
next();
|
|
1902
|
-
} else if ( token ===
|
|
1900
|
+
} else if ( token === "Array.<" || token === "Array<" ) {
|
|
1903
1901
|
next();
|
|
1904
|
-
const componentType =
|
|
1905
|
-
next(
|
|
1902
|
+
const componentType = parseTypes();
|
|
1903
|
+
next(">");
|
|
1906
1904
|
type = builder.array(componentType);
|
|
1907
|
-
} else if ( token ===
|
|
1905
|
+
} else if ( token === "Object.<" || token === "Object<" ) {
|
|
1908
1906
|
next();
|
|
1909
1907
|
let keyType;
|
|
1910
|
-
let valueType =
|
|
1911
|
-
if ( token ===
|
|
1908
|
+
let valueType = parseTypes();
|
|
1909
|
+
if ( token === "," ) {
|
|
1912
1910
|
next();
|
|
1913
1911
|
keyType = valueType;
|
|
1914
|
-
valueType =
|
|
1912
|
+
valueType = parseTypes();
|
|
1915
1913
|
} else {
|
|
1916
|
-
keyType = builder.synthetic(builder.simpleType(
|
|
1914
|
+
keyType = builder.synthetic(builder.simpleType("string"));
|
|
1917
1915
|
}
|
|
1918
|
-
next(
|
|
1916
|
+
next(">");
|
|
1919
1917
|
type = builder.object(keyType, valueType);
|
|
1920
|
-
} else if ( token ===
|
|
1918
|
+
} else if ( token === "Set.<" || token === "Set<" ) {
|
|
1921
1919
|
next();
|
|
1922
|
-
const elementType =
|
|
1923
|
-
next(
|
|
1920
|
+
const elementType = parseTypes();
|
|
1921
|
+
next(">");
|
|
1924
1922
|
type = builder.set(elementType);
|
|
1925
|
-
} else if ( token ===
|
|
1923
|
+
} else if ( token === "Promise.<" || token === "Promise<" ) {
|
|
1926
1924
|
next();
|
|
1927
|
-
const resultType =
|
|
1928
|
-
next(
|
|
1925
|
+
const resultType = parseTypes();
|
|
1926
|
+
next(">");
|
|
1929
1927
|
type = builder.promise(resultType);
|
|
1930
|
-
} else if ( token ===
|
|
1928
|
+
} else if ( token === "function(" ) {
|
|
1931
1929
|
next();
|
|
1932
|
-
let thisType
|
|
1933
|
-
|
|
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 ===
|
|
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
|
|
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 =
|
|
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
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
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(
|
|
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(
|
|
1997
|
+
next("symbol");
|
|
1985
1998
|
let propType;
|
|
1986
|
-
if ( token ===
|
|
1999
|
+
if ( token === ":" ) {
|
|
1987
2000
|
next();
|
|
1988
|
-
propType =
|
|
2001
|
+
propType = parseTypes();
|
|
1989
2002
|
} else {
|
|
1990
|
-
propType = builder.synthetic(builder.simpleType(
|
|
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(
|
|
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
|
-
|
|
2015
|
-
const templateType =
|
|
2027
|
+
do {
|
|
2028
|
+
const templateType = parseTypes();
|
|
2016
2029
|
templateTypes.push(templateType);
|
|
2017
|
-
if ( token ===
|
|
2018
|
-
|
|
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
|
-
|
|
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:
|
|
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+|[
|
|
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) {
|
package/lib/tasks/TaskUtil.js
CHANGED
|
@@ -173,7 +173,7 @@ class TaskUtil {
|
|
|
173
173
|
*
|
|
174
174
|
* </br></br>
|
|
175
175
|
* This method is only available to custom task extensions defining
|
|
176
|
-
* <b>Specification Version
|
|
176
|
+
* <b>Specification Version 3.0 and above</b>.
|
|
177
177
|
*
|
|
178
178
|
* @param {string} projectName Name of the project to retrieve
|
|
179
179
|
* @returns {module:@ui5/project.specifications.Project|undefined}
|
|
@@ -209,7 +209,7 @@ class TaskUtil {
|
|
|
209
209
|
case "2.5":
|
|
210
210
|
case "2.6":
|
|
211
211
|
return baseInterface;
|
|
212
|
-
case "
|
|
212
|
+
case "3.0":
|
|
213
213
|
baseInterface.getProject = (projectName) => {
|
|
214
214
|
const project = this.getProject(projectName);
|
|
215
215
|
const baseProjectInterface = {};
|
|
@@ -217,7 +217,7 @@ class TaskUtil {
|
|
|
217
217
|
"getName", "getVersion", "getNamespace"
|
|
218
218
|
]);
|
|
219
219
|
switch (specVersion) {
|
|
220
|
-
case "
|
|
220
|
+
case "3.0":
|
|
221
221
|
return baseProjectInterface;
|
|
222
222
|
}
|
|
223
223
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/builder",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.8",
|
|
4
4
|
"description": "UI5 Tooling - Builder",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SAP SE",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"version": "git-chglog --sort semver --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 --sort semver -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",
|
|
@@ -105,7 +105,8 @@
|
|
|
105
105
|
"url": "git@github.com:SAP/ui5-builder.git"
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
|
-
"@
|
|
108
|
+
"@jridgewell/sourcemap-codec": "^1.4.14",
|
|
109
|
+
"@ui5/fs": "^3.0.0-alpha.5",
|
|
109
110
|
"@ui5/logger": "^3.0.1-alpha.1",
|
|
110
111
|
"cheerio": "1.0.0-rc.9",
|
|
111
112
|
"escape-unicode": "^0.2.0",
|
|
@@ -119,13 +120,12 @@
|
|
|
119
120
|
"replacestream": "^4.0.3",
|
|
120
121
|
"rimraf": "^3.0.2",
|
|
121
122
|
"semver": "^7.3.5",
|
|
122
|
-
"
|
|
123
|
-
"terser": "^5.14.1",
|
|
123
|
+
"terser": "^5.14.2",
|
|
124
124
|
"xml2js": "^0.4.23",
|
|
125
125
|
"yazl": "^2.5.1"
|
|
126
126
|
},
|
|
127
127
|
"devDependencies": {
|
|
128
|
-
"@ui5/project": "SAP/ui5-project#
|
|
128
|
+
"@ui5/project": "github:SAP/ui5-project#178dedbfe80ab890d134ce12ccb29fc709595a52",
|
|
129
129
|
"ava": "^3.15.0",
|
|
130
130
|
"chai": "^4.3.4",
|
|
131
131
|
"chai-fs": "^2.0.0",
|