@ui5/builder 3.0.0-alpha.1 → 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.
- package/CHANGELOG.md +850 -0
- package/index.js +0 -43
- package/lib/lbt/analyzer/JSModuleAnalyzer.js +27 -8
- package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +2 -1
- package/lib/lbt/bundle/Builder.js +364 -137
- package/lib/lbt/bundle/BundleWriter.js +17 -0
- package/lib/lbt/bundle/Resolver.js +2 -2
- package/lib/lbt/resources/LocatorResource.js +7 -7
- package/lib/lbt/resources/LocatorResourcePool.js +8 -4
- package/lib/lbt/resources/ResourceCollector.js +22 -15
- package/lib/lbt/resources/ResourceInfoList.js +0 -1
- package/lib/lbt/resources/ResourcePool.js +7 -6
- package/lib/lbt/utils/escapePropertiesFile.js +3 -6
- package/lib/lbt/utils/parseUtils.js +1 -1
- package/lib/processors/bundlers/moduleBundler.js +31 -10
- package/lib/processors/jsdoc/lib/createIndexFiles.js +1 -1
- package/lib/processors/jsdoc/lib/transformApiJson.js +20 -20
- 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/processors/manifestCreator.js +8 -45
- package/lib/processors/minifier.js +11 -5
- package/lib/tasks/buildThemes.js +1 -1
- package/lib/tasks/bundlers/generateBundle.js +70 -30
- package/lib/tasks/bundlers/generateComponentPreload.js +26 -19
- package/lib/tasks/bundlers/generateFlexChangesBundle.js +10 -5
- package/lib/tasks/bundlers/generateLibraryPreload.js +113 -94
- package/lib/tasks/bundlers/generateManifestBundle.js +8 -10
- package/lib/tasks/bundlers/generateStandaloneAppBundle.js +42 -10
- package/lib/tasks/bundlers/utils/createModuleNameMapping.js +31 -0
- package/lib/tasks/generateCachebusterInfo.js +7 -3
- package/lib/tasks/generateLibraryManifest.js +6 -8
- package/lib/tasks/generateResourcesJson.js +3 -3
- package/lib/tasks/generateThemeDesignerResources.js +118 -2
- package/lib/tasks/generateVersionInfo.js +5 -5
- package/lib/tasks/jsdoc/generateJsdoc.js +1 -1
- package/lib/tasks/minify.js +14 -4
- package/lib/tasks/taskRepository.js +1 -13
- package/lib/tasks/transformBootstrapHtml.js +6 -1
- package/package.json +11 -10
- package/lib/builder/BuildContext.js +0 -56
- package/lib/builder/ProjectBuildContext.js +0 -57
- package/lib/builder/builder.js +0 -419
- package/lib/tasks/TaskUtil.js +0 -160
- package/lib/types/AbstractBuilder.js +0 -270
- package/lib/types/AbstractFormatter.js +0 -66
- package/lib/types/AbstractUi5Formatter.js +0 -95
- package/lib/types/application/ApplicationBuilder.js +0 -211
- package/lib/types/application/ApplicationFormatter.js +0 -227
- package/lib/types/application/applicationType.js +0 -15
- package/lib/types/library/LibraryBuilder.js +0 -231
- package/lib/types/library/LibraryFormatter.js +0 -519
- package/lib/types/library/libraryType.js +0 -15
- package/lib/types/module/ModuleBuilder.js +0 -7
- package/lib/types/module/ModuleFormatter.js +0 -54
- package/lib/types/module/moduleType.js +0 -15
- package/lib/types/themeLibrary/ThemeLibraryBuilder.js +0 -63
- package/lib/types/themeLibrary/ThemeLibraryFormatter.js +0 -90
- package/lib/types/themeLibrary/themeLibraryType.js +0 -15
- package/lib/types/typeRepository.js +0 -46
|
@@ -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) {
|
|
@@ -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(
|
|
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
|
-
|
|
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 ? "" :
|
|
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",
|
|
@@ -34,10 +34,13 @@ const debugFileRegex = /((?:\.view|\.fragment|\.controller|\.designtime|\.suppor
|
|
|
34
34
|
* @alias module:@ui5/builder.processors.minifier
|
|
35
35
|
* @param {object} parameters Parameters
|
|
36
36
|
* @param {module:@ui5/fs.Resource[]} parameters.resources List of resources to be processed
|
|
37
|
+
* @param {object} [parameters.options] Options
|
|
38
|
+
* @param {boolean} [parameters.options.addSourceMappingUrl=true]
|
|
39
|
+
* Whether to add a sourceMappingURL reference to the end of the minified resource
|
|
37
40
|
* @returns {Promise<module:@ui5/builder.processors.MinifierResult[]>}
|
|
38
41
|
* Promise resolving with object of resource, dbgResource and sourceMap
|
|
39
42
|
*/
|
|
40
|
-
module.exports = async function({resources}) {
|
|
43
|
+
module.exports = async function({resources, options: {addSourceMappingUrl = true} = {}}) {
|
|
41
44
|
return Promise.all(resources.map(async (resource) => {
|
|
42
45
|
const dbgPath = resource.getPath().replace(debugFileRegex, "-dbg$1");
|
|
43
46
|
const dbgResource = await resource.clone();
|
|
@@ -46,6 +49,12 @@ module.exports = async function({resources}) {
|
|
|
46
49
|
const filename = path.posix.basename(resource.getPath());
|
|
47
50
|
const code = await resource.getString();
|
|
48
51
|
try {
|
|
52
|
+
const sourceMapOptions = {
|
|
53
|
+
filename
|
|
54
|
+
};
|
|
55
|
+
if (addSourceMappingUrl) {
|
|
56
|
+
sourceMapOptions.url = filename + ".map";
|
|
57
|
+
}
|
|
49
58
|
const dbgFilename = path.posix.basename(dbgPath);
|
|
50
59
|
const result = await terser.minify({
|
|
51
60
|
// Use debug-name since this will be referenced in the source map "sources"
|
|
@@ -63,10 +72,7 @@ module.exports = async function({resources}) {
|
|
|
63
72
|
"sap",
|
|
64
73
|
]
|
|
65
74
|
},
|
|
66
|
-
sourceMap:
|
|
67
|
-
filename,
|
|
68
|
-
url: filename + ".map"
|
|
69
|
-
}
|
|
75
|
+
sourceMap: sourceMapOptions
|
|
70
76
|
});
|
|
71
77
|
resource.setString(result.code);
|
|
72
78
|
const sourceMapResource = new Resource({
|
package/lib/tasks/buildThemes.js
CHANGED
|
@@ -97,7 +97,7 @@ module.exports = async function({
|
|
|
97
97
|
|
|
98
98
|
if (log.isLevelEnabled("verbose")) {
|
|
99
99
|
if (!libraryAvailable) {
|
|
100
|
-
log.
|
|
100
|
+
log.silly(`Skipping ${resourcePath}: Library is not available`);
|
|
101
101
|
}
|
|
102
102
|
if (!themeAvailable) {
|
|
103
103
|
log.verbose(`Skipping ${resourcePath}: sap.ui.core theme '${themeName}' is not available. ` +
|