@ui5/builder 3.0.0-alpha.10 → 3.0.0-alpha.12

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 (80) hide show
  1. package/CHANGELOG.md +35 -2
  2. package/jsdoc.json +2 -2
  3. package/lib/lbt/UI5ClientConstants.js +7 -8
  4. package/lib/lbt/analyzer/ComponentAnalyzer.js +10 -10
  5. package/lib/lbt/analyzer/FioriElementsAnalyzer.js +31 -20
  6. package/lib/lbt/analyzer/JSModuleAnalyzer.js +107 -65
  7. package/lib/lbt/analyzer/SmartTemplateAnalyzer.js +31 -20
  8. package/lib/lbt/analyzer/XMLCompositeAnalyzer.js +35 -25
  9. package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +19 -17
  10. package/lib/lbt/analyzer/analyzeLibraryJS.js +22 -6
  11. package/lib/lbt/bundle/AutoSplitter.js +10 -11
  12. package/lib/lbt/bundle/Builder.js +30 -33
  13. package/lib/lbt/bundle/BundleDefinition.js +1 -5
  14. package/lib/lbt/bundle/BundleWriter.js +1 -2
  15. package/lib/lbt/bundle/ResolvedBundleDefinition.js +6 -7
  16. package/lib/lbt/bundle/Resolver.js +9 -10
  17. package/lib/lbt/calls/SapUiDefine.js +16 -11
  18. package/lib/lbt/graph/dependencyGraph.js +3 -4
  19. package/lib/lbt/graph/dominatorTree.js +3 -3
  20. package/lib/lbt/graph/topologicalSort.js +3 -3
  21. package/lib/lbt/resources/LibraryFileAnalyzer.js +5 -8
  22. package/lib/lbt/resources/LocatorResource.js +2 -2
  23. package/lib/lbt/resources/LocatorResourcePool.js +3 -3
  24. package/lib/lbt/resources/ModuleInfo.js +1 -2
  25. package/lib/lbt/resources/Resource.js +3 -4
  26. package/lib/lbt/resources/ResourceCollector.js +7 -8
  27. package/lib/lbt/resources/ResourceFilterList.js +38 -40
  28. package/lib/lbt/resources/ResourceInfo.js +1 -1
  29. package/lib/lbt/resources/ResourceInfoList.js +2 -2
  30. package/lib/lbt/resources/ResourcePool.js +15 -21
  31. package/lib/lbt/utils/ASTUtils.js +58 -44
  32. package/lib/lbt/utils/JSTokenizer.js +4 -4
  33. package/lib/lbt/utils/ModuleName.js +10 -20
  34. package/lib/lbt/utils/escapePropertiesFile.js +3 -3
  35. package/lib/lbt/utils/parseUtils.js +4 -10
  36. package/lib/processors/bootstrapHtmlTransformer.js +15 -7
  37. package/lib/processors/bundlers/flexChangesBundler.js +16 -8
  38. package/lib/processors/bundlers/manifestBundler.js +19 -10
  39. package/lib/processors/bundlers/moduleBundler.js +26 -15
  40. package/lib/processors/jsdoc/apiIndexGenerator.js +16 -9
  41. package/lib/processors/jsdoc/jsdocGenerator.js +31 -17
  42. package/lib/processors/jsdoc/lib/{createIndexFiles.js → createIndexFiles.cjs} +0 -0
  43. package/lib/processors/jsdoc/lib/{transformApiJson.js → transformApiJson.cjs} +58 -2
  44. package/lib/processors/jsdoc/lib/ui5/{plugin.js → plugin.cjs} +306 -119
  45. package/lib/processors/jsdoc/lib/ui5/template/{publish.js → publish.cjs} +1 -1
  46. package/lib/processors/jsdoc/lib/ui5/template/utils/{versionUtil.js → versionUtil.cjs} +0 -0
  47. package/lib/processors/jsdoc/sdkTransformer.js +18 -11
  48. package/lib/processors/libraryLessGenerator.js +28 -16
  49. package/lib/processors/manifestCreator.js +14 -13
  50. package/lib/processors/minifier.js +21 -15
  51. package/lib/processors/nonAsciiEscaper.js +16 -6
  52. package/lib/processors/resourceListCreator.js +13 -13
  53. package/lib/processors/stringReplacer.js +13 -6
  54. package/lib/processors/themeBuilder.js +30 -22
  55. package/lib/processors/versionInfoGenerator.js +33 -23
  56. package/lib/tasks/buildThemes.js +17 -10
  57. package/lib/tasks/bundlers/generateBundle.js +23 -12
  58. package/lib/tasks/bundlers/generateComponentPreload.js +18 -10
  59. package/lib/tasks/bundlers/generateFlexChangesBundle.js +16 -8
  60. package/lib/tasks/bundlers/generateLibraryPreload.js +22 -12
  61. package/lib/tasks/bundlers/generateManifestBundle.js +15 -6
  62. package/lib/tasks/bundlers/generateStandaloneAppBundle.js +21 -13
  63. package/lib/tasks/bundlers/utils/createModuleNameMapping.js +6 -6
  64. package/lib/tasks/escapeNonAsciiCharacters.js +12 -5
  65. package/lib/tasks/generateCachebusterInfo.js +16 -8
  66. package/lib/tasks/generateLibraryManifest.js +14 -8
  67. package/lib/tasks/generateResourcesJson.js +15 -9
  68. package/lib/tasks/generateThemeDesignerResources.js +19 -9
  69. package/lib/tasks/generateVersionInfo.js +12 -5
  70. package/lib/tasks/jsdoc/executeJsdocSdkTransformation.js +17 -9
  71. package/lib/tasks/jsdoc/generateApiIndex.js +16 -10
  72. package/lib/tasks/jsdoc/generateJsdoc.js +131 -119
  73. package/lib/tasks/minify.js +13 -6
  74. package/lib/tasks/replaceBuildtime.js +12 -5
  75. package/lib/tasks/replaceCopyright.js +12 -5
  76. package/lib/tasks/replaceVersion.js +12 -5
  77. package/lib/tasks/taskRepository.js +24 -29
  78. package/lib/tasks/transformBootstrapHtml.js +6 -5
  79. package/package.json +30 -15
  80. package/index.js +0 -173
@@ -1,20 +1,28 @@
1
- const log = require("@ui5/logger").getLogger("builder:processors:bundlers:flexChangesBundler");
2
- const resourceFactory = require("@ui5/fs").resourceFactory;
1
+ import logger from "@ui5/logger";
2
+ const log = logger.getLogger("builder:processors:bundlers:flexChangesBundler");
3
+ import {createResource} from "@ui5/fs/resourceFactory";
4
+
5
+ /**
6
+ * @public
7
+ * @module @ui5/builder/processors/flexChangesBundler
8
+ */
3
9
 
4
10
  /**
5
11
  * Bundles all supplied changes.
6
12
  *
7
13
  * @public
8
- * @alias module:@ui5/builder.processors.flexChangesBundler
14
+ * @function default
15
+ * @static
16
+ *
9
17
  * @param {object} parameters Parameters
10
- * @param {module:@ui5/fs.Resource[]} parameters.resources List of resources to be processed
18
+ * @param {@ui5/fs/Resource[]} parameters.resources List of resources to be processed
11
19
  * @param {object} parameters.options Options
12
20
  * @param {string} parameters.options.pathPrefix Prefix for bundle path
13
21
  * @param {string} parameters.options.hasFlexBundleVersion true if minUI5Version >= 1.73 than
14
22
  * create flexibility-bundle.json
15
- * @returns {Promise<module:@ui5/fs.Resource[]>} Promise resolving with flex changes bundle resources
23
+ * @returns {Promise<@ui5/fs/Resource[]>} Promise resolving with flex changes bundle resources
16
24
  */
17
- module.exports = function({resources, options: {pathPrefix, hasFlexBundleVersion}}) {
25
+ export default function({resources, options: {pathPrefix, hasFlexBundleVersion}}) {
18
26
  let bundleName = "changes-bundle.json";
19
27
 
20
28
  function sortByTimeStamp(a, b) {
@@ -101,11 +109,11 @@ module.exports = function({resources, options: {pathPrefix, hasFlexBundleVersion
101
109
  const result = [];
102
110
  if (nNumberOfChanges > 0) {
103
111
  changesContent = sortAndStringifyInFlexFormat(changesContent);
104
- result.push(resourceFactory.createResource({
112
+ result.push(createResource({
105
113
  path: `${pathPrefix}/changes/${bundleName}`,
106
114
  string: changesContent
107
115
  }));
108
116
  }
109
117
  return result;
110
118
  });
111
- };
119
+ }
@@ -1,7 +1,8 @@
1
- const posixPath = require("path").posix;
2
- const yazl = require("yazl");
3
- const resourceFactory = require("@ui5/fs").resourceFactory;
4
- const log = require("@ui5/logger").getLogger("builder:processors:bundlers:manifestBundler");
1
+ import posixPath from "node:path/posix";
2
+ import yazl from "yazl";
3
+ import {createResource} from "@ui5/fs/resourceFactory";
4
+ import logger from "@ui5/logger";
5
+ const log = logger.getLogger("builder:processors:bundlers:manifestBundler");
5
6
 
6
7
  /**
7
8
  * Repository to handle i18n resource files
@@ -20,7 +21,7 @@ class I18nResourceList {
20
21
  * Adds a i18n resource to the repository
21
22
  *
22
23
  * @param {string} directory Path to the i18n resource
23
- * @param {module:@ui5/fs.Resource} resource i18n resource
24
+ * @param {@ui5/fs/Resource} resource i18n resource
24
25
  */
25
26
  add(directory, resource) {
26
27
  const normalizedDirectory = posixPath.normalize(directory);
@@ -42,21 +43,29 @@ class I18nResourceList {
42
43
  }
43
44
  }
44
45
 
46
+
47
+ /**
48
+ * @public
49
+ * @module @ui5/builder/processors/manifestBundler
50
+ */
51
+
45
52
  /**
46
53
  * Creates a manifest bundle from the provided resources.
47
54
  *
48
- * @alias module:@ui5/builder.processors.manifestBundler
49
55
  * @public
56
+ * @function default
57
+ * @static
58
+ *
50
59
  * @param {object} parameters Parameters
51
- * @param {module:@ui5/fs.Resource[]} parameters.resources List of resources to be processed
60
+ * @param {@ui5/fs/Resource[]} parameters.resources List of resources to be processed
52
61
  * @param {object} parameters.options Options
53
62
  * @param {string} parameters.options.namespace Namespace of the project
54
63
  * @param {string} parameters.options.bundleName Name of the bundled zip file
55
64
  * @param {string} parameters.options.propertiesExtension Extension name of the properties files, e.g. ".properties"
56
65
  * @param {string} parameters.options.descriptor Descriptor name
57
- * @returns {Promise<module:@ui5/fs.Resource[]>} Promise resolving with manifest bundle resources
66
+ * @returns {Promise<@ui5/fs/Resource[]>} Promise resolving with manifest bundle resources
58
67
  */
59
- module.exports = ({resources, options: {namespace, bundleName, propertiesExtension, descriptor}}) => {
68
+ export default ({resources, options: {namespace, bundleName, propertiesExtension, descriptor}}) => {
60
69
  function bundleNameToUrl(bundleName, appId) {
61
70
  if (!bundleName.startsWith(appId)) {
62
71
  return null;
@@ -163,7 +172,7 @@ module.exports = ({resources, options: {namespace, bundleName, propertiesExtensi
163
172
  zip.end();
164
173
 
165
174
  const pathPrefix = "/resources/" + namespace + "/";
166
- const res = resourceFactory.createResource({
175
+ const res = createResource({
167
176
  path: pathPrefix + bundleName,
168
177
  stream: zip.outputStream
169
178
  });
@@ -1,7 +1,13 @@
1
- const BundleBuilder = require("../../lbt/bundle/Builder");
2
- const LocatorResourcePool = require("../../lbt/resources/LocatorResourcePool");
3
- const EvoResource = require("@ui5/fs").Resource;
4
- const log = require("@ui5/logger").getLogger("builder:processors:bundlers:moduleBundler");
1
+ import BundleBuilder from "../../lbt/bundle/Builder.js";
2
+ import LocatorResourcePool from "../../lbt/resources/LocatorResourcePool.js";
3
+ import EvoResource from "@ui5/fs/Resource";
4
+ import logger from "@ui5/logger";
5
+ const log = logger.getLogger("builder:processors:bundlers:moduleBundler");
6
+
7
+ /**
8
+ * @public
9
+ * @module @ui5/builder/processors/moduleBundler
10
+ */
5
11
 
6
12
  /**
7
13
  * A ModuleBundleDefinitionSection specifies the embedding mode (either 'provided', 'raw', 'preload', 'require'
@@ -80,7 +86,7 @@ const log = require("@ui5/logger").getLogger("builder:processors:bundlers:module
80
86
  * @property {string} name The module bundle name
81
87
  * @property {string[]} [defaultFileTypes=[".js", ".control.xml", ".fragment.html", ".fragment.json", ".fragment.xml", ".view.html", ".view.json", ".view.xml"]]
82
88
  * List of default file types to be included in the bundle
83
- * @property {ModuleBundleDefinitionSection[]} sections List of module bundle definition sections.
89
+ * @property {module:@ui5/builder/processors/moduleBundler~ModuleBundleDefinitionSection[]} sections List of module bundle definition sections.
84
90
  */
85
91
  /* eslint-enable max-len */
86
92
 
@@ -106,27 +112,32 @@ const log = require("@ui5/logger").getLogger("builder:processors:bundlers:module
106
112
  *
107
113
  * @public
108
114
  * @typedef {object} ModuleBundlerResult
109
- * @property {module:@ui5/fs.Resource} bundle Bundle resource
110
- * @property {module:@ui5/fs.Resource} sourceMap Source Map
111
- * @memberof module:@ui5/builder.processors
115
+ * @property {@ui5/fs/Resource} bundle Bundle resource
116
+ * @property {@ui5/fs/Resource} sourceMap Source Map
112
117
  */
113
118
 
119
+ /* eslint-disable max-len */
114
120
  /**
115
121
  * Legacy module bundler.
116
122
  *
117
123
  * @public
118
- * @alias module:@ui5/builder.processors.moduleBundler
124
+ * @function default
125
+ * @static
126
+ *
119
127
  * @param {object} parameters Parameters
120
- * @param {module:@ui5/fs.Resource[]} parameters.resources Resources
128
+ * @param {@ui5/fs/Resource[]} parameters.resources Resources
121
129
  * @param {object} parameters.options Options
122
130
  * @param {object} [parameters.options.moduleNameMapping]
123
131
  Optional mapping of resource paths to module name in order to overwrite the default determination
124
- * @param {ModuleBundleDefinition} parameters.options.bundleDefinition Module bundle definition
125
- * @param {ModuleBundleOptions} [parameters.options.bundleOptions] Module bundle options
126
- * @returns {Promise<module:@ui5/builder.processors.ModuleBundlerResult[]>}
132
+ * @param {module:@ui5/builder/processors/moduleBundler~ModuleBundleDefinition} parameters.options.bundleDefinition Module
133
+ bundle definition
134
+ * @param {module:@ui5/builder/processors/moduleBundler~ModuleBundleOptions} [parameters.options.bundleOptions] Module
135
+ bundle options
136
+ * @returns {Promise<module:@ui5/builder/processors/moduleBundler~ModuleBundlerResult[]>}
127
137
  * Promise resolving with module bundle resources
128
138
  */
129
- module.exports = function({resources, options: {bundleDefinition, bundleOptions, moduleNameMapping}}) {
139
+ /* eslint-enable max-len */
140
+ export default function({resources, options: {bundleDefinition, bundleOptions, moduleNameMapping}}) {
130
141
  // Apply defaults without modifying the passed object
131
142
  bundleOptions = Object.assign({}, {
132
143
  optimize: true,
@@ -177,4 +188,4 @@ module.exports = function({resources, options: {bundleDefinition, bundleOptions,
177
188
  }
178
189
  }));
179
190
  });
180
- };
191
+ }
@@ -1,14 +1,21 @@
1
- const resourceFactory = require("@ui5/fs").resourceFactory;
2
- const createIndex = require("./lib/createIndexFiles");
1
+ import {createResource} from "@ui5/fs/resourceFactory";
2
+ import createIndex from "./lib/createIndexFiles.cjs";
3
+
4
+ /**
5
+ * @public
6
+ * @module @ui5/builder/processors/apiIndexGenerator
7
+ */
3
8
 
4
9
  /**
5
10
  * Compiles API index resources from all <code>api.json</code> resources available in the given test resources directory
6
- * as created by the [sdkTransformer]{@link module:@ui5/builder.processors.sdkTransformer} processor.
11
+ * as created by the [sdkTransformer]{@link @ui5/builder/processors/sdkTransformer} processor.
7
12
  * The resulting index resources (e.g. <code>api-index.json</code>, <code>api-index-deprecated.json</code>,
8
13
  * <code>api-index-experimental.json</code> and <code>api-index-since.json</code>) are mainly to be used in the SDK.
9
14
  *
10
15
  * @public
11
- * @alias module:@ui5/builder.processors.apiIndexGenerator
16
+ * @function default
17
+ * @static
18
+ *
12
19
  * @param {object} parameters Parameters
13
20
  * @param {string} parameters.versionInfoPath Path to <code>sap-ui-version.json</code> resource
14
21
  * @param {string} parameters.testResourcesRootPath Path to <code>/test-resources</code> root directory in the
@@ -19,9 +26,9 @@ const createIndex = require("./lib/createIndexFiles");
19
26
  * @param {string} parameters.targetApiIndexExperimentalPath Path to create the generated API index "experimental" JSON
20
27
  * resource for
21
28
  * @param {string} parameters.targetApiIndexSincePath Path to create the generated API index "since" JSON resource for
22
- * @param {fs|module:@ui5/fs.fsInterface} parameters.fs Node fs or
23
- * custom [fs interface]{@link module:resources/module:@ui5/fs.fsInterface} to use
24
- * @returns {Promise<module:@ui5/fs.Resource[]>} Promise resolving with created resources <code>api-index.json</code>,
29
+ * @param {fs|module:@ui5/fs/fsInterface} parameters.fs Node fs or
30
+ * custom [fs interface]{@link module:@ui5/fs/fsInterface} to use
31
+ * @returns {Promise<@ui5/fs/Resource[]>} Promise resolving with created resources <code>api-index.json</code>,
25
32
  * <code>api-index-deprecated.json</code>, <code>api-index-experimental.json</code> and
26
33
  * <code>api-index-since.json</code> (names depend on the supplied paths)
27
34
  */
@@ -41,11 +48,11 @@ const apiIndexGenerator = async function({
41
48
  });
42
49
 
43
50
  return Object.keys(resourceMap).map((resPath) => {
44
- return resourceFactory.createResource({
51
+ return createResource({
45
52
  path: resPath,
46
53
  string: resourceMap[resPath]
47
54
  });
48
55
  });
49
56
  };
50
57
 
51
- module.exports = apiIndexGenerator;
58
+ export default apiIndexGenerator;
@@ -1,15 +1,27 @@
1
- const spawn = require("child_process").spawn;
2
- const fs = require("graceful-fs");
3
- const path = require("path");
4
- const {promisify} = require("util");
1
+ import {spawn} from "node:child_process";
2
+ import fs from "graceful-fs";
3
+ import path from "node:path";
4
+ import {promisify} from "node:util";
5
5
  const writeFile = promisify(fs.writeFile);
6
- const {resourceFactory} = require("@ui5/fs");
6
+ import {createAdapter} from "@ui5/fs/resourceFactory";
7
+ import {createRequire} from "node:module";
8
+ import {fileURLToPath} from "node:url";
9
+
10
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
+ const require = createRequire(import.meta.url);
12
+
13
+ /**
14
+ * @public
15
+ * @module @ui5/builder/processors/jsdocGenerator
16
+ */
7
17
 
8
18
  /**
9
19
  * JSDoc generator
10
20
  *
11
21
  * @public
12
- * @alias module:@ui5/builder.processors.jsdocGenerator
22
+ * @function default
23
+ * @static
24
+ *
13
25
  * @param {object} parameters Parameters
14
26
  * @param {string} parameters.sourcePath Path of the source files to be processed
15
27
  * @param {string} parameters.targetPath Path to write any output files
@@ -19,9 +31,9 @@ const {resourceFactory} = require("@ui5/fs");
19
31
  * @param {string} parameters.options.namespace Namespace to build (e.g. <code>some/project/name</code>)
20
32
  * @param {string} parameters.options.version Project version
21
33
  * @param {Array} [parameters.options.variants=["apijson"]] JSDoc variants to be built
22
- * @returns {Promise<module:@ui5/fs.Resource[]>} Promise resolving with newly created resources
34
+ * @returns {Promise<@ui5/fs/Resource[]>} Promise resolving with newly created resources
23
35
  */
24
- const jsdocGenerator = async function(
36
+ export default async function jsdocGenerator(
25
37
  {sourcePath, targetPath, tmpPath, options: {projectName, namespace, version, variants}} = {}
26
38
  ) {
27
39
  if (!sourcePath || !targetPath || !tmpPath || !projectName || !namespace || !version) {
@@ -48,7 +60,7 @@ const jsdocGenerator = async function(
48
60
  configPath
49
61
  });
50
62
 
51
- const fsTarget = resourceFactory.createAdapter({
63
+ const fsTarget = createAdapter({
52
64
  fsBasePath: targetPath,
53
65
  virBasePath: "/"
54
66
  });
@@ -58,7 +70,7 @@ const jsdocGenerator = async function(
58
70
  fsTarget.byPath(`/test-resources/${namespace}/designtime/api.json`)
59
71
  // fsTarget.byPath(`/libraries/${options.projectName}.js`)
60
72
  ]).then((res) => res.filter(($)=>$));
61
- };
73
+ }
62
74
 
63
75
 
64
76
  /**
@@ -82,8 +94,11 @@ async function generateJsdocConfig({targetPath, tmpPath, namespace, projectName,
82
94
 
83
95
  // Resolve path to this script to get the path to the JSDoc extensions folder
84
96
  const jsdocPath = path.normalize(__dirname);
85
- const pluginPath = path.join(jsdocPath, "lib", "ui5", "plugin.js").replace(backslashRegex, "\\\\");
86
- const templatePath = path.join(jsdocPath, "lib", "ui5", "template").replace(backslashRegex, "\\\\");
97
+ const pluginPath = path.join(jsdocPath, "lib", "ui5", "plugin.cjs").replace(backslashRegex, "\\\\");
98
+ // Using export via package.json to allow loading the CJS template.
99
+ // jsdoc appends /publish to the provided path but doesn't allow to
100
+ // add the .cjs extension, so loading won't work otherwise.
101
+ const templatePath = "@ui5/builder/internal/jsdoc/template";
87
102
  const destinationPath = path.normalize(tmpPath).replace(backslashRegex, "\\\\");
88
103
  const jsapiFilePath = path.join(targetPath, "libraries", projectName + ".js").replace(backslashRegex, "\\\\");
89
104
  const apiJsonFolderPath = path.join(tmpPath, "dependency-apis").replace(backslashRegex, "\\\\");
@@ -157,7 +172,7 @@ async function buildJsdoc({sourcePath, configPath}) {
157
172
  ];
158
173
  return new Promise((resolve, reject) => {
159
174
  const child = spawn("node", args, {
160
- stdio: ["ignore", "ignore", process.stderr]
175
+ stdio: ["ignore", "ignore", "inherit"]
161
176
  });
162
177
  child.on("close", function(code) {
163
178
  if (code === 0 || code === 1) {
@@ -169,7 +184,6 @@ async function buildJsdoc({sourcePath, configPath}) {
169
184
  });
170
185
  }
171
186
 
172
- module.exports = jsdocGenerator;
173
- module.exports._generateJsdocConfig = generateJsdocConfig;
174
- module.exports._writeJsdocConfig = writeJsdocConfig;
175
- module.exports._buildJsdoc = buildJsdoc;
187
+ jsdocGenerator._generateJsdocConfig = generateJsdocConfig;
188
+ jsdocGenerator._writeJsdocConfig = writeJsdocConfig;
189
+ jsdocGenerator._buildJsdoc = buildJsdoc;
@@ -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