@ui5/builder 3.0.0-alpha.10 → 3.0.0-alpha.11
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 +19 -2
- package/lib/lbt/analyzer/FioriElementsAnalyzer.js +23 -12
- package/lib/lbt/analyzer/JSModuleAnalyzer.js +88 -53
- package/lib/lbt/analyzer/SmartTemplateAnalyzer.js +23 -12
- package/lib/lbt/analyzer/XMLCompositeAnalyzer.js +29 -19
- package/lib/lbt/analyzer/analyzeLibraryJS.js +15 -0
- package/lib/lbt/bundle/Builder.js +1 -1
- package/lib/lbt/calls/SapUiDefine.js +13 -7
- package/lib/lbt/utils/ASTUtils.js +45 -18
- package/lib/processors/jsdoc/lib/transformApiJson.js +58 -2
- package/lib/processors/jsdoc/lib/ui5/plugin.js +306 -119
- package/package.json +4 -3
|
@@ -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
|
|
1050
|
+
// We always resolve as this data is not mandatory
|
|
995
1051
|
oResolve(oChainObject);
|
|
996
1052
|
});
|
|
997
1053
|
|