@ui5/builder 3.0.0-alpha.9 → 3.0.0-beta.1

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 (83) hide show
  1. package/.reuse/dep5 +2 -2
  2. package/CHANGELOG.md +42 -1
  3. package/CONTRIBUTING.md +1 -1
  4. package/README.md +4 -4
  5. package/jsdoc.json +2 -2
  6. package/lib/lbt/UI5ClientConstants.js +7 -8
  7. package/lib/lbt/analyzer/ComponentAnalyzer.js +60 -22
  8. package/lib/lbt/analyzer/FioriElementsAnalyzer.js +31 -20
  9. package/lib/lbt/analyzer/JSModuleAnalyzer.js +107 -65
  10. package/lib/lbt/analyzer/SmartTemplateAnalyzer.js +31 -20
  11. package/lib/lbt/analyzer/XMLCompositeAnalyzer.js +35 -25
  12. package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +71 -18
  13. package/lib/lbt/analyzer/analyzeLibraryJS.js +22 -6
  14. package/lib/lbt/bundle/AutoSplitter.js +10 -11
  15. package/lib/lbt/bundle/Builder.js +33 -36
  16. package/lib/lbt/bundle/BundleDefinition.js +1 -5
  17. package/lib/lbt/bundle/BundleWriter.js +1 -2
  18. package/lib/lbt/bundle/ResolvedBundleDefinition.js +6 -7
  19. package/lib/lbt/bundle/Resolver.js +11 -12
  20. package/lib/lbt/calls/SapUiDefine.js +16 -11
  21. package/lib/lbt/graph/dependencyGraph.js +3 -4
  22. package/lib/lbt/graph/dominatorTree.js +3 -3
  23. package/lib/lbt/graph/topologicalSort.js +3 -3
  24. package/lib/lbt/resources/LibraryFileAnalyzer.js +5 -8
  25. package/lib/lbt/resources/LocatorResource.js +2 -2
  26. package/lib/lbt/resources/LocatorResourcePool.js +3 -3
  27. package/lib/lbt/resources/ModuleInfo.js +1 -2
  28. package/lib/lbt/resources/Resource.js +3 -4
  29. package/lib/lbt/resources/ResourceCollector.js +7 -8
  30. package/lib/lbt/resources/ResourceFilterList.js +38 -40
  31. package/lib/lbt/resources/ResourceInfo.js +1 -1
  32. package/lib/lbt/resources/ResourceInfoList.js +5 -3
  33. package/lib/lbt/resources/ResourcePool.js +15 -21
  34. package/lib/lbt/utils/ASTUtils.js +58 -44
  35. package/lib/lbt/utils/JSTokenizer.js +4 -4
  36. package/lib/lbt/utils/ModuleName.js +10 -20
  37. package/lib/lbt/utils/escapePropertiesFile.js +3 -3
  38. package/lib/lbt/utils/parseUtils.js +4 -10
  39. package/lib/processors/bootstrapHtmlTransformer.js +15 -7
  40. package/lib/processors/bundlers/flexChangesBundler.js +16 -8
  41. package/lib/processors/bundlers/manifestBundler.js +19 -10
  42. package/lib/processors/bundlers/moduleBundler.js +26 -15
  43. package/lib/processors/jsdoc/apiIndexGenerator.js +16 -9
  44. package/lib/processors/jsdoc/jsdocGenerator.js +31 -17
  45. package/lib/processors/jsdoc/lib/{createIndexFiles.js → createIndexFiles.cjs} +0 -0
  46. package/lib/processors/jsdoc/lib/{transformApiJson.js → transformApiJson.cjs} +58 -2
  47. package/lib/processors/jsdoc/lib/ui5/{plugin.js → plugin.cjs} +306 -119
  48. package/lib/processors/jsdoc/lib/ui5/template/{publish.js → publish.cjs} +1 -1
  49. package/lib/processors/jsdoc/lib/ui5/template/utils/{versionUtil.js → versionUtil.cjs} +0 -0
  50. package/lib/processors/jsdoc/sdkTransformer.js +18 -11
  51. package/lib/processors/libraryLessGenerator.js +28 -16
  52. package/lib/processors/manifestCreator.js +14 -13
  53. package/lib/processors/minifier.js +22 -16
  54. package/lib/processors/nonAsciiEscaper.js +16 -6
  55. package/lib/processors/resourceListCreator.js +13 -13
  56. package/lib/processors/stringReplacer.js +13 -6
  57. package/lib/processors/themeBuilder.js +33 -24
  58. package/lib/processors/versionInfoGenerator.js +33 -23
  59. package/lib/tasks/buildThemes.js +18 -11
  60. package/lib/tasks/bundlers/generateBundle.js +23 -12
  61. package/lib/tasks/bundlers/generateComponentPreload.js +18 -10
  62. package/lib/tasks/bundlers/generateFlexChangesBundle.js +16 -8
  63. package/lib/tasks/bundlers/generateLibraryPreload.js +22 -12
  64. package/lib/tasks/bundlers/generateManifestBundle.js +15 -6
  65. package/lib/tasks/bundlers/generateStandaloneAppBundle.js +21 -13
  66. package/lib/tasks/bundlers/utils/createModuleNameMapping.js +6 -6
  67. package/lib/tasks/escapeNonAsciiCharacters.js +12 -5
  68. package/lib/tasks/generateCachebusterInfo.js +16 -8
  69. package/lib/tasks/generateLibraryManifest.js +14 -8
  70. package/lib/tasks/generateResourcesJson.js +15 -9
  71. package/lib/tasks/generateThemeDesignerResources.js +19 -9
  72. package/lib/tasks/generateVersionInfo.js +12 -5
  73. package/lib/tasks/jsdoc/executeJsdocSdkTransformation.js +17 -9
  74. package/lib/tasks/jsdoc/generateApiIndex.js +16 -10
  75. package/lib/tasks/jsdoc/generateJsdoc.js +131 -119
  76. package/lib/tasks/minify.js +13 -6
  77. package/lib/tasks/replaceBuildtime.js +12 -5
  78. package/lib/tasks/replaceCopyright.js +12 -5
  79. package/lib/tasks/replaceVersion.js +12 -5
  80. package/lib/tasks/taskRepository.js +24 -29
  81. package/lib/tasks/transformBootstrapHtml.js +6 -5
  82. package/package.json +33 -18
  83. package/index.js +0 -173
@@ -1,6 +1,5 @@
1
- "use strict";
2
1
 
3
- const {Syntax} = require("../utils/parseUtils");
2
+ import {Syntax} from "../utils/parseUtils.js";
4
3
 
5
4
  /**
6
5
  * Checks whether the given node is a string literal.
@@ -12,21 +11,42 @@ const {Syntax} = require("../utils/parseUtils");
12
11
  * @param {string} [literal]
13
12
  * @returns {boolean} Whether the node is a literal and whether its value matches the given string
14
13
  */
15
- function isString(node, literal) {
16
- if ( node == null || node.type !== Syntax.Literal || typeof node.value !== "string" ) {
14
+ export function isString(node, literal) {
15
+ const value = getStringValue(node);
16
+ if (value === undefined) {
17
17
  return false;
18
18
  }
19
- return literal == null ? true : node.value === literal;
19
+ return literal == null ? true: value === literal;
20
+ }
21
+
22
+ export function getStringValue(node) {
23
+ if (isLiteral(node)) {
24
+ return node.value;
25
+ } else if (isTemplateLiteralWithoutExpression(node)) {
26
+ return node?.quasis?.[0]?.value?.cooked;
27
+ } else {
28
+ return undefined;
29
+ }
30
+ }
31
+
32
+ export function isLiteral(node) {
33
+ return node && node.type === Syntax.Literal && typeof node.value === "string";
34
+ }
35
+
36
+ export function isTemplateLiteralWithoutExpression(node) {
37
+ return node?.type === Syntax.TemplateLiteral &&
38
+ node?.expressions?.length === 0 &&
39
+ node?.quasis?.length === 1;
20
40
  }
21
41
 
22
- function isBoolean(node, literal) {
42
+ export function isBoolean(node, literal) {
23
43
  if ( node == null || node.type !== Syntax.Literal || typeof node.value !== "boolean" ) {
24
44
  return false;
25
45
  }
26
46
  return literal == null ? true : node.value === literal;
27
47
  }
28
48
 
29
- function isMethodCall(node, methodPath) {
49
+ export function isMethodCall(node, methodPath) {
30
50
  if ( node.type !== Syntax.CallExpression ) {
31
51
  return false;
32
52
  }
@@ -35,7 +55,7 @@ function isMethodCall(node, methodPath) {
35
55
  return isNamedObject(node.callee, methodPath, methodPath.length);
36
56
  }
37
57
 
38
- function isNamedObject(node, objectPath, length) {
58
+ export function isNamedObject(node, objectPath, length) {
39
59
  // console.log("checking for named object ", node, objectPath, length);
40
60
  while ( length > 1 &&
41
61
  node.type === Syntax.MemberExpression &&
@@ -46,37 +66,37 @@ function isNamedObject(node, objectPath, length) {
46
66
  return length === 1 && isIdentifier(node, objectPath[0]);
47
67
  }
48
68
 
49
- function isIdentifier(node, name) {
50
- if ( node.type != Syntax.Identifier ) {
51
- return false;
52
- }
53
- if ( typeof name == "string" ) {
69
+ export function isIdentifier(node, name) {
70
+ if ( node.type === Syntax.Identifier && typeof name == "string" ) {
54
71
  return name === node.name;
72
+ } else if ( node.type === Syntax.Identifier && Array.isArray(name) ) {
73
+ return name.find((name) => name === node.name || name === "*") !== undefined;
74
+ } else if ( node.type === Syntax.ObjectPattern ) {
75
+ return node.properties.filter((childnode) => isIdentifier(childnode.key, name)).length > 0;
76
+ } else if ( node.type === Syntax.ArrayPattern ) {
77
+ return node.elements.filter((childnode) => isIdentifier(childnode, name)).length > 0;
78
+ } else {
79
+ return false;
55
80
  }
56
- for (let i = 0; i < name.length; i++) {
57
- if ( name[i] === node.name || name[i] === "*" ) {
58
- return true;
59
- }
60
- }
61
- return false;
62
81
  }
63
82
 
64
- function getPropertyKey(property) {
65
- if ( property.key.type === Syntax.Identifier ) {
83
+ export function getPropertyKey(property) {
84
+ if ( property.type === Syntax.SpreadElement ) {
85
+ // TODO: Support interpreting SpreadElements
86
+ return;
87
+ } else if ( property.key.type === Syntax.Identifier && property.computed !== true ) {
66
88
  return property.key.name;
67
89
  } else if ( property.key.type === Syntax.Literal ) {
68
90
  return String(property.key.value);
69
- } else {
70
- throw new Error();
71
91
  }
72
92
  }
73
93
 
74
- function findOwnProperty(obj, name) {
94
+ export function findOwnProperty(obj, name) {
75
95
  const property = obj && obj.properties.find((property) => getPropertyKey(property) === name);
76
96
  return property && property.value;
77
97
  }
78
98
 
79
- function getValue(obj, names) {
99
+ export function getValue(obj, names) {
80
100
  let i = 0;
81
101
  while ( i < names.length ) {
82
102
  if ( obj == null || obj.type !== Syntax.ObjectExpression ) {
@@ -100,29 +120,23 @@ function getValue(obj, names) {
100
120
  * @throws {TypeError}
101
121
  * @returns {string[]}
102
122
  */
103
- function getStringArray(array, skipNonStringLiterals) {
123
+ export function getStringArray(array, skipNonStringLiterals) {
104
124
  return array.elements.reduce( (result, item) => {
105
- if ( isString(item) ) {
106
- result.push(item.value);
125
+ const value = getStringValue(item);
126
+ if ( value !== undefined ) {
127
+ result.push(value);
107
128
  } else if ( !skipNonStringLiterals ) {
108
- throw new TypeError("array element is not a string literal:" + item.type);
129
+ if (item.type === Syntax.TemplateLiteral) {
130
+ throw new TypeError("array element is a template literal with expressions");
131
+ } else {
132
+ throw new TypeError("array element is not a string literal: " + item.type);
133
+ }
109
134
  }
110
135
  return result;
111
136
  }, []);
112
137
  }
113
138
 
114
- module.exports = {
115
- isString,
116
- isBoolean,
117
- isMethodCall,
118
- isNamedObject,
119
- isIdentifier,
120
- getLocation: function(args) {
121
- // NODE-TODO include line information in future
122
- return args[0].value;
123
- },
124
- getPropertyKey,
125
- findOwnProperty,
126
- getValue,
127
- getStringArray
128
- };
139
+ export function getLocation(args) {
140
+ // NODE-TODO include line information in future
141
+ return args[0].value;
142
+ }
@@ -13,7 +13,7 @@
13
13
  * Code other than the OpenUI5 libraries must not introduce dependencies to this module.
14
14
  */
15
15
  //sap.ui.define([], function() {
16
- "use strict";
16
+ //"use strict";
17
17
 
18
18
  /*
19
19
  * The following code has been taken from the component JSON in JavaScript
@@ -25,7 +25,7 @@
25
25
  */
26
26
 
27
27
  /**
28
- * @class Tokenizer for JS values.
28
+ * Tokenizer for JS values.
29
29
  *
30
30
  * Contains functions to consume tokens on an input string.
31
31
  *
@@ -34,7 +34,7 @@
34
34
  * JSTokenizer().parseJS("{test:'123'}"); // {test:'123'}
35
35
  * });
36
36
  *
37
- * @alias module:sap/base/util/JSTokenizer
37
+ * @class sap/base/util/JSTokenizer
38
38
  * @since 1.58
39
39
  * @private
40
40
  * @ui5-restricted sap.ui.core
@@ -384,4 +384,4 @@
384
384
  // return JSTokenizer;
385
385
  //});
386
386
 
387
- module.exports = JSTokenizer;
387
+ export default JSTokenizer;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
 
3
2
  /**
4
3
  * Creates a ModuleName from a string in UI5 module name syntax.
@@ -8,7 +7,7 @@
8
7
  * @param {string} [suffix='.js'] Suffix to add to the resulting resource name
9
8
  * @returns {string} URN representing the same resource
10
9
  */
11
- function fromUI5LegacyName(name, suffix) {
10
+ export function fromUI5LegacyName(name, suffix) {
12
11
  // UI5 only supports a few names with dots in them, anything else will be converted to slashes
13
12
  if ( name.startsWith("sap.ui.thirdparty.jquery.jquery-") ) {
14
13
  name = "sap/ui/thirdparty/jquery/jquery-" + name.slice("sap.ui.thirdparty.jquery.jquery-".length);
@@ -20,7 +19,7 @@ function fromUI5LegacyName(name, suffix) {
20
19
  return name + (suffix || ".js");
21
20
  }
22
21
 
23
- function toUI5LegacyName(path) {
22
+ export function toUI5LegacyName(path) {
24
23
  if ( !path.endsWith(".js") ) {
25
24
  throw new Error("can't convert a non-JS resource name " + path + " to a UI5 module name");
26
25
  }
@@ -34,11 +33,11 @@ function toUI5LegacyName(path) {
34
33
  }
35
34
  }
36
35
 
37
- function fromRequireJSName(name) {
36
+ export function fromRequireJSName(name) {
38
37
  return name + ".js";
39
38
  }
40
39
 
41
- function toRequireJSName(path) {
40
+ export function toRequireJSName(path) {
42
41
  if ( !path.endsWith(".js") ) {
43
42
  throw new Error("can't convert a non-JS resource name " + path + " to a requireJS module name");
44
43
  }
@@ -47,7 +46,7 @@ function toRequireJSName(path) {
47
46
 
48
47
  const KNOWN_TYPES = /\.(properties|css|(?:(?:view\.|fragment\.)?(?:html|json|xml|js))|(?:(?:controller\.|designtime\.|support\.)?js))$/;
49
48
 
50
- function getDebugName(name) {
49
+ export function getDebugName(name) {
51
50
  const m = KNOWN_TYPES.exec(name);
52
51
  if ( m && ( m[0].endsWith(".css") || m[0].endsWith(".js") ) && !name.slice(0, m.index).endsWith("-dbg") ) {
53
52
  return name.slice(0, m.index) + "-dbg" + m[0];
@@ -55,7 +54,7 @@ function getDebugName(name) {
55
54
  return null;
56
55
  }
57
56
 
58
- function getNonDebugName(name) {
57
+ export function getNonDebugName(name) {
59
58
  const m = KNOWN_TYPES.exec(name);
60
59
  if ( m && ( m[0].endsWith(".css") || m[0].endsWith(".js") ) && name.slice(0, m.index).endsWith("-dbg") ) {
61
60
  return name.slice(0, m.index - "-dbg".length) + m[0];
@@ -66,7 +65,7 @@ function getNonDebugName(name) {
66
65
  const ANY_SPECIAL_PATH_SEGMENT = /(?:^|\/)\.+\//;
67
66
  const SPECIAL_PATH_SEGMENT = /^\.+$/;
68
67
 
69
- function resolveRelativePath(path, relativePath) {
68
+ export function resolveRelativePath(path, relativePath) {
70
69
  // while has segment
71
70
  // if ( segment == . )
72
71
  // ignore segment
@@ -117,16 +116,7 @@ function resolveRelativePath(path, relativePath) {
117
116
  return relativePath;
118
117
  }
119
118
 
120
- module.exports = {
121
- getDebugName,
122
- getNonDebugName,
123
- fromUI5LegacyName,
124
- fromRequireJSName,
125
- resolveRelativePath,
126
- resolveRelativeRequireJSName: function(path, relativeName) {
127
- return resolveRelativePath(path, relativeName + ".js");
128
- },
129
- toUI5LegacyName,
130
- toRequireJSName
131
- };
119
+ export function resolveRelativeRequireJSName(path, relativeName) {
120
+ return resolveRelativePath(path, relativeName + ".js");
121
+ }
132
122
 
@@ -1,4 +1,4 @@
1
- const nonAsciiEscaper = require("../../processors/nonAsciiEscaper");
1
+ import nonAsciiEscaper from "../../processors/nonAsciiEscaper.js";
2
2
 
3
3
  /**
4
4
  * Can be used to escape *.properties files.
@@ -10,7 +10,7 @@ const nonAsciiEscaper = require("../../processors/nonAsciiEscaper");
10
10
  * @param {Resource} resource the resource for which the content will be escaped
11
11
  * @returns {Promise<string>} resolves with the escaped string content of the given Resource
12
12
  */
13
- module.exports = async function(resource) {
13
+ export default async function(resource) {
14
14
  const project = resource.getProject();
15
15
  let propertiesFileSourceEncoding = project && project.getPropertiesFileSourceEncoding();
16
16
 
@@ -34,4 +34,4 @@ module.exports = async function(resource) {
34
34
  const fileContent = await resource.buffer();
35
35
 
36
36
  return fileContent.toString();
37
- };
37
+ }
@@ -1,11 +1,9 @@
1
- "use strict";
2
1
 
3
- const espree = require("espree");
4
- const {Syntax, VisitorKeys} = espree;
2
+ import {parse} from "espree";
5
3
 
6
4
  const hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
7
5
 
8
- function parseJS(code, userOptions = {}) {
6
+ export function parseJS(code, userOptions = {}) {
9
7
  // allowed options and their defaults
10
8
  const options = {
11
9
  comment: false,
@@ -22,11 +20,7 @@ function parseJS(code, userOptions = {}) {
22
20
  options[name] = value;
23
21
  }
24
22
 
25
- return espree.parse(code, options);
23
+ return parse(code, options);
26
24
  }
27
25
 
28
- module.exports = {
29
- parseJS,
30
- Syntax,
31
- VisitorKeys
32
- };
26
+ export {Syntax, VisitorKeys} from "espree";
@@ -1,17 +1,25 @@
1
- const log = require("@ui5/logger").getLogger("builder:processors:bootstrapHtmlTransformer");
2
- const cheerio = require("cheerio");
1
+ import logger from "@ui5/logger";
2
+ const log = logger.getLogger("builder:processors:bootstrapHtmlTransformer");
3
+ import cheerio from "cheerio";
4
+
5
+ /**
6
+ * @module @ui5/builder/processors/bootstrapHtmlTransformer
7
+ */
3
8
 
4
9
  /**
5
10
  * Transforms the UI5 bootstrap of a HTML resource files.
6
11
  *
7
- * @module builder/processors/bootstrapHtmlTransformer
12
+ * @public
13
+ * @function default
14
+ * @static
15
+ *
8
16
  * @param {object} parameters Parameters
9
- * @param {module:@ui5/fs.Resource[]} parameters.resources List of resources to be processed
17
+ * @param {@ui5/fs/Resource[]} parameters.resources List of resources to be processed
10
18
  * @param {object} parameters.options Options
11
19
  * @param {string} parameters.options.src Bootstrap "src" that should be used
12
- * @returns {Promise<module:@ui5/fs.Resource[]>} Promise resolving with the cloned resources
20
+ * @returns {Promise<@ui5/fs/Resource[]>} Promise resolving with the cloned resources
13
21
  */
14
- module.exports = function({resources, options: {src}}) {
22
+ export default function({resources, options: {src}}) {
15
23
  async function processResource(resource) {
16
24
  const content = await resource.getString();
17
25
  const $ = cheerio.load(content);
@@ -30,4 +38,4 @@ module.exports = function({resources, options: {src}}) {
30
38
  }
31
39
 
32
40
  return Promise.all(resources.map(processResource));
33
- };
41
+ }
@@ -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/bundlers/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/bundlers/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/bundlers/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/bundlers/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/bundlers/moduleBundler~ModuleBundleDefinition} parameters.options.bundleDefinition Module
133
+ bundle definition
134
+ * @param {module:@ui5/builder/processors/bundlers/moduleBundler~ModuleBundleOptions} [parameters.options.bundleOptions] Module
135
+ bundle options
136
+ * @returns {Promise<module:@ui5/builder/processors/bundlers/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/jsdoc/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;