@ui5/builder 3.0.0-alpha.11 → 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 +18 -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 +9 -9
  6. package/lib/lbt/analyzer/JSModuleAnalyzer.js +32 -25
  7. package/lib/lbt/analyzer/SmartTemplateAnalyzer.js +9 -9
  8. package/lib/lbt/analyzer/XMLCompositeAnalyzer.js +8 -8
  9. package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +19 -17
  10. package/lib/lbt/analyzer/analyzeLibraryJS.js +8 -7
  11. package/lib/lbt/bundle/AutoSplitter.js +10 -11
  12. package/lib/lbt/bundle/Builder.js +29 -32
  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 +5 -6
  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 +17 -30
  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} +0 -0
  44. package/lib/processors/jsdoc/lib/ui5/{plugin.js → plugin.cjs} +0 -0
  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 +29 -15
  80. package/index.js +0 -173
@@ -1,6 +1,12 @@
1
- const log = require("@ui5/logger").getLogger("builder:processors:versionInfoGenerator");
2
- const resourceFactory = require("@ui5/fs").resourceFactory;
3
- const posixPath = require("path").posix;
1
+ import logger from "@ui5/logger";
2
+ const log = logger.getLogger("builder:processors:versionInfoGenerator");
3
+ import {createResource} from "@ui5/fs/resourceFactory";
4
+ import posixPath from "node:path/posix";
5
+
6
+ /**
7
+ * @public
8
+ * @module @ui5/builder/processors/versionInfoGenerator
9
+ */
4
10
 
5
11
  function pad(v) {
6
12
  return String(v).padStart(2, "0");
@@ -40,15 +46,16 @@ function getTimestamp() {
40
46
  * @property {string} id The library name, e.g. "lib.x"
41
47
  * @property {string} embeddedBy the library this component is embedded in, e.g. "lib.x"
42
48
  * @property {string[]} embeds the embedded component names, e.g. ["lib.x.sub"]
43
- * @property {ManifestLibraries} libs the dependencies, e.g. {"sap.chart":{"lazy": true}, "sap.f":{}}
49
+ * @property {module:@ui5/builder/processors/versionInfoGenerator~ManifestLibraries} libs the dependencies, e.g.
50
+ * {"sap.chart":{"lazy": true}, "sap.f":{}}
44
51
  */
45
52
 
46
53
 
47
54
  /**
48
55
  * Processes manifest resource and extracts information.
49
56
  *
50
- * @param {module:@ui5/fs.Resource} manifestResource
51
- * @returns {Promise<ManifestInfo>}
57
+ * @param {@ui5/fs/Resource} manifestResource
58
+ * @returns {Promise<module:@ui5/builder/processors/versionInfoGenerator~ManifestInfo>}
52
59
  */
53
60
  const processManifest = async (manifestResource) => {
54
61
  const manifestContent = await manifestResource.getString();
@@ -145,7 +152,7 @@ const getManifestPath = (filePath, subPath) => {
145
152
  class DependencyInfo {
146
153
  /**
147
154
  *
148
- * @param {ManifestLibraries} libs
155
+ * @param {module:@ui5/builder/processors/versionInfoGenerator~ManifestLibraries} libs
149
156
  * @param {string} name library name, e.g. "lib.x"
150
157
  */
151
158
  constructor(libs, name) {
@@ -182,7 +189,7 @@ class DependencyInfo {
182
189
  * - resolved children become lazy if their parent is lazy
183
190
  *
184
191
  * @param {Map<string,DependencyInfo>} dependencyInfoMap
185
- * @returns {ManifestLibraries} resolved libraries
192
+ * @returns {module:@ui5/builder/processors/versionInfoGenerator~ManifestLibraries} resolved libraries
186
193
  */
187
194
  getResolvedLibraries(dependencyInfoMap) {
188
195
  if (!this._libsResolved) {
@@ -260,14 +267,14 @@ const getManifestHints = (dependencyInfo, dependencyInfoMap) => {
260
267
  * @property {string} componentName The library name, e.g. "lib.x"
261
268
  * @property {Set<string>} bundledComponents The embedded components which have an embeddedBy reference to the library
262
269
  * @property {DependencyInfo} dependencyInfo The dependency info object
263
- * @property {ArtifactInfo[]} embeds The embedded artifact infos
270
+ * @property {module:@ui5/builder/processors/versionInfoGenerator~ArtifactInfo[]} embeds The embedded artifact infos
264
271
  */
265
272
 
266
273
 
267
274
  /**
268
275
  * Processes the manifest and creates a ManifestInfo and an ArtifactInfo.
269
276
  *
270
- * @param {module:@ui5/fs.Resource} libraryManifest
277
+ * @param {@ui5/fs/Resource} libraryManifest
271
278
  * @param {string} [name] library name, if not provided using the ManifestInfo's id
272
279
  * @returns {Promise<{manifestInfo: ManifestInfo, libraryArtifactInfo: ArtifactInfo}>}
273
280
  */
@@ -283,8 +290,8 @@ async function processManifestAndGetArtifactInfo(libraryManifest, name) {
283
290
  /**
284
291
  * Processes the library info and fills the maps <code>dependencyInfoMap</code> and <code>embeddedInfoMap</code>.
285
292
  *
286
- * @param {LibraryInfo} libraryInfo
287
- * @returns {Promise<ArtifactInfo|undefined>}
293
+ * @param {module:@ui5/builder/processors/versionInfoGenerator~LibraryInfo} libraryInfo
294
+ * @returns {Promise<module:@ui5/builder/processors/versionInfoGenerator~ArtifactInfo|undefined>}
288
295
  */
289
296
  const processLibraryInfo = async (libraryInfo) => {
290
297
  if (!libraryInfo.libraryManifest) {
@@ -338,38 +345,41 @@ const processLibraryInfo = async (libraryInfo) => {
338
345
  *
339
346
  * contains information about the name and the version of the library and its manifest, as well as the nested manifests.
340
347
  *
348
+ * @public
341
349
  * @typedef {object} LibraryInfo
342
350
  * @property {string} name The library name, e.g. "lib.x"
343
351
  * @property {string} version The library version, e.g. "1.0.0"
344
- * @property {module:@ui5/fs.Resource} libraryManifest library manifest resource,
352
+ * @property {@ui5/fs/Resource} libraryManifest library manifest resource,
345
353
  * e.g. resource with path "lib/x/manifest.json"
346
- * @property {module:@ui5/fs.Resource[]} embeddedManifests list of embedded manifest resources,
354
+ * @property {@ui5/fs/Resource[]} embeddedManifests list of embedded manifest resources,
347
355
  * e.g. resource with path "lib/x/sub/manifest.json"
348
- * @public
349
356
  */
350
357
 
351
358
  /**
352
359
  * Creates sap-ui-version.json.
353
360
  *
354
361
  * @public
355
- * @alias module:@ui5/builder.processors.versionInfoGenerator
362
+ * @function default
363
+ * @static
364
+ *
356
365
  * @param {object} parameters Parameters
357
366
  * @param {object} parameters.options Options
358
367
  * @param {string} parameters.options.rootProjectName Name of the root project
359
368
  * @param {string} parameters.options.rootProjectVersion Version of the root project
360
- * @param {LibraryInfo[]} parameters.options.libraryInfos Array of objects representing libraries,
369
+ * @param {module:@ui5/builder/processors/versionInfoGenerator~LibraryInfo[]} parameters.options.libraryInfos Array of
370
+ * objects representing libraries,
361
371
  * e.g. <pre>
362
372
  * {
363
373
  * name: "lib.x",
364
374
  * version: "1.0.0",
365
- * libraryManifest: module:@ui5/fs.Resource,
366
- * embeddedManifests: module:@ui5/fs.Resource[]
375
+ * libraryManifest: @ui5/fs/Resource,
376
+ * embeddedManifests: @ui5/fs/Resource[]
367
377
  * }
368
378
  * </pre>
369
- * @returns {Promise<module:@ui5/fs.Resource[]>} Promise resolving with an array containing the versionInfo resource
379
+ * @returns {Promise<@ui5/fs/Resource[]>} Promise resolving with an array containing the versionInfo resource
370
380
  */
371
381
 
372
- module.exports = async function({options}) {
382
+ export default async function({options}) {
373
383
  if (!options.rootProjectName || options.rootProjectVersion === undefined || options.libraryInfos === undefined) {
374
384
  throw new Error("[versionInfoGenerator]: Missing options parameters");
375
385
  }
@@ -454,8 +464,8 @@ module.exports = async function({options}) {
454
464
  components
455
465
  };
456
466
 
457
- return [resourceFactory.createResource({
467
+ return [createResource({
458
468
  path: "/resources/sap-ui-version.json",
459
469
  string: JSON.stringify(versionJson, null, "\t")
460
470
  })];
461
- };
471
+ }
@@ -1,17 +1,24 @@
1
- const path = require("path");
2
- const themeBuilder = require("../processors/themeBuilder");
3
- const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritized;
4
- const fsInterface = require("@ui5/fs").fsInterface;
5
- const log = require("@ui5/logger").getLogger("builder:tasks:buildThemes");
1
+ import path from "node:path";
2
+ import themeBuilder from "../processors/themeBuilder.js";
3
+ import fsInterface from "@ui5/fs/fsInterface";
4
+ import ReaderCollectionPrioritized from "@ui5/fs/ReaderCollectionPrioritized";
5
+ import logger from "@ui5/logger";
6
+ const log = logger.getLogger("builder:tasks:buildThemes");
6
7
 
8
+ /**
9
+ * @public
10
+ * @module @ui5/builder/tasks/buildThemes
11
+ */
7
12
  /**
8
13
  * Task to build a library theme.
9
14
  *
10
15
  * @public
11
- * @alias module:@ui5/builder.tasks.buildThemes
16
+ * @function default
17
+ * @static
18
+ *
12
19
  * @param {object} parameters Parameters
13
- * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
14
- * @param {module:@ui5/fs.AbstractReader} parameters.dependencies Reader or Collection to read dependency files
20
+ * @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
21
+ * @param {@ui5/fs/AbstractReader} parameters.dependencies Reader or Collection to read dependency files
15
22
  * @param {object} parameters.options Options
16
23
  * @param {string} parameters.options.projectName Project name
17
24
  * @param {string} parameters.options.inputPattern Search pattern for *.less files to be built
@@ -21,7 +28,7 @@ const log = require("@ui5/logger").getLogger("builder:tasks:buildThemes");
21
28
  * @param {boolean} [parameters.options.cssVariables=false]
22
29
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
23
30
  */
24
- module.exports = async function({
31
+ export default async function({
25
32
  workspace, dependencies,
26
33
  options: {
27
34
  projectName, inputPattern, librariesPattern, themesPattern, compress, cssVariables
@@ -136,4 +143,4 @@ module.exports = async function({
136
143
  await Promise.all(processedResources.map((resource) => {
137
144
  return workspace.write(resource);
138
145
  }));
139
- };
146
+ }
@@ -1,23 +1,34 @@
1
- const moduleBundler = require("../../processors/bundlers/moduleBundler");
2
- const createModuleNameMapping = require("./utils/createModuleNameMapping");
3
- const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritized;
1
+ import moduleBundler from "../../processors/bundlers/moduleBundler.js";
2
+ import createModuleNameMapping from "./utils/createModuleNameMapping.js";
3
+ import ReaderCollectionPrioritized from "@ui5/fs/ReaderCollectionPrioritized";
4
4
 
5
+ /**
6
+ * @public
7
+ * @module @ui5/builder/tasks/generateBundle
8
+ */
9
+
10
+ /* eslint-disable max-len */
5
11
  /**
6
12
  * Generates a bundle based on the given bundle definition
7
13
  *
8
14
  * @public
9
- * @alias module:@ui5/builder.tasks.generateBundle
15
+ * @function default
16
+ * @static
17
+ *
10
18
  * @param {object} parameters Parameters
11
- * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
12
- * @param {module:@ui5/fs.ReaderCollection} parameters.dependencies Collection to read dependency files
13
- * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
19
+ * @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
20
+ * @param {@ui5/fs/ReaderCollection} parameters.dependencies Collection to read dependency files
21
+ * @param {@ui5/project/build/helpers/TaskUtil|object} [parameters.taskUtil] TaskUtil
14
22
  * @param {object} parameters.options Options
15
23
  * @param {string} parameters.options.projectName Project name
16
- * @param {ModuleBundleDefinition} parameters.options.bundleDefinition Module bundle definition
17
- * @param {ModuleBundleOptions} [parameters.options.bundleOptions] Module bundle options
24
+ * @param {module:@ui5/builder/processors/moduleBundler~ModuleBundleDefinition} parameters.options.bundleDefinition Module
25
+ * bundle definition
26
+ * @param {module:@ui5/builder/processors/moduleBundler~ModuleBundleOptions} [parameters.options.bundleOptions] Module
27
+ * bundle options
18
28
  * @returns {Promise} Promise resolving with <code>undefined</code> once data has been written
19
29
  */
20
- module.exports = function({
30
+ /* eslint-enable max-len */
31
+ export default async function({
21
32
  workspace, dependencies, taskUtil, options: {projectName, bundleDefinition, bundleOptions}
22
33
  }) {
23
34
  let combo = new ReaderCollectionPrioritized({
@@ -76,7 +87,7 @@ module.exports = function({
76
87
  // Omit -dbg files for optimize bundles and vice versa
77
88
  const filterTag = optimize ?
78
89
  taskUtil.STANDARD_TAGS.IsDebugVariant : taskUtil.STANDARD_TAGS.HasDebugVariant;
79
- combo = combo.filter(function(resource) {
90
+ combo = await combo.filter(function(resource) {
80
91
  return !taskUtil.getTag(resource, filterTag);
81
92
  });
82
93
  }
@@ -108,4 +119,4 @@ module.exports = function({
108
119
  }));
109
120
  });
110
121
  });
111
- };
122
+ }
@@ -1,16 +1,24 @@
1
- const path = require("path");
2
- const moduleBundler = require("../../processors/bundlers/moduleBundler");
3
- const log = require("@ui5/logger").getLogger("builder:tasks:bundlers:generateComponentPreload");
4
- const {negateFilters} = require("../../lbt/resources/ResourceFilterList");
1
+ import path from "node:path";
2
+ import moduleBundler from "../../processors/bundlers/moduleBundler.js";
3
+ import logger from "@ui5/logger";
4
+ const log = logger.getLogger("builder:tasks:bundlers:generateComponentPreload");
5
+ import {negateFilters} from "../../lbt/resources/ResourceFilterList.js";
6
+
7
+ /**
8
+ * @public
9
+ * @module @ui5/builder/tasks/generateComponentPreload
10
+ */
5
11
 
6
12
  /**
7
13
  * Task to for application bundling.
8
14
  *
9
15
  * @public
10
- * @alias module:@ui5/builder.tasks.generateComponentPreload
16
+ * @function default
17
+ * @static
18
+ *
11
19
  * @param {object} parameters Parameters
12
- * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
13
- * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
20
+ * @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
21
+ * @param {@ui5/project/build/helpers/TaskUtil|object} [parameters.taskUtil] TaskUtil
14
22
  * @param {object} parameters.options Options
15
23
  * @param {string} parameters.options.projectName Project name
16
24
  * @param {string[]} [parameters.options.excludes=[]] List of modules declared as glob patterns (resource name patterns)
@@ -24,12 +32,12 @@ const {negateFilters} = require("../../lbt/resources/ResourceFilterList");
24
32
  * @param {string[]} [parameters.options.skipBundles] Names of bundles that should not be created
25
33
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
26
34
  */
27
- module.exports = function({
35
+ export default async function({
28
36
  workspace, taskUtil, options: {projectName, paths, namespaces, skipBundles = [], excludes = []}
29
37
  }) {
30
38
  let nonDbgWorkspace = workspace;
31
39
  if (taskUtil) {
32
- nonDbgWorkspace = workspace.filter(function(resource) {
40
+ nonDbgWorkspace = await workspace.filter(function(resource) {
33
41
  // Remove any debug variants
34
42
  return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.IsDebugVariant);
35
43
  });
@@ -163,4 +171,4 @@ module.exports = function({
163
171
  ]);
164
172
  }));
165
173
  });
166
- };
174
+ }
@@ -1,6 +1,12 @@
1
- const log = require("@ui5/logger").getLogger("builder:tasks:bundlers:generateFlexChangesBundle");
2
- const flexChangesBundler = require("../../processors/bundlers/flexChangesBundler");
3
- const semver = require("semver");
1
+ import logger from "@ui5/logger";
2
+ const log = logger.getLogger("builder:tasks:bundlers:generateFlexChangesBundle");
3
+ import flexChangesBundler from "../../processors/bundlers/flexChangesBundler.js";
4
+ import semver from "semver";
5
+
6
+ /**
7
+ * @public
8
+ * @module @ui5/builder/tasks/generateFlexChangesBundle
9
+ */
4
10
 
5
11
  /* eslint "jsdoc/check-param-names": ["error", {"disableExtraPropertyReporting":true}] */
6
12
  /**
@@ -12,15 +18,17 @@ const semver = require("semver");
12
18
  * If there are control variants and minUI5Version < 1.73 build will break and throw an error.
13
19
  *
14
20
  * @public
15
- * @alias module:@ui5/builder.tasks.generateFlexChangesBundle
21
+ * @function default
22
+ * @static
23
+ *
16
24
  * @param {object} parameters Parameters
17
- * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
18
- * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
25
+ * @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
26
+ * @param {@ui5/project/build/helpers/TaskUtil|object} [parameters.taskUtil] TaskUtil
19
27
  * @param {object} [parameters.options] Options
20
28
  * @param {string} [parameters.options.projectNamespace] Project Namespace
21
29
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
22
30
  */
23
- module.exports = async function({workspace, taskUtil, options = {}}) {
31
+ export default async function({workspace, taskUtil, options = {}}) {
24
32
  // Backward compatibility: "namespace" option got renamed to "projectNamespace"
25
33
  const namespace = options.projectNamespace || options.namespace;
26
34
 
@@ -101,4 +109,4 @@ module.exports = async function({workspace, taskUtil, options = {}}) {
101
109
  });
102
110
  }
103
111
  }
104
- };
112
+ }
@@ -1,7 +1,8 @@
1
- const log = require("@ui5/logger").getLogger("builder:tasks:bundlers:generateLibraryPreload");
2
- const moduleBundler = require("../../processors/bundlers/moduleBundler");
3
- const {negateFilters} = require("../../lbt/resources/ResourceFilterList");
4
- const createModuleNameMapping = require("./utils/createModuleNameMapping");
1
+ import logger from "@ui5/logger";
2
+ const log = logger.getLogger("builder:tasks:bundlers:generateLibraryPreload");
3
+ import moduleBundler from "../../processors/bundlers/moduleBundler.js";
4
+ import {negateFilters} from "../../lbt/resources/ResourceFilterList.js";
5
+ import createModuleNameMapping from "./utils/createModuleNameMapping.js";
5
6
 
6
7
  function getDefaultLibraryPreloadFilters(namespace, excludes) {
7
8
  const filters = [
@@ -216,14 +217,21 @@ function getSapUiCoreBunDef(name, filters, preload) {
216
217
  return bundleDefinition;
217
218
  }
218
219
 
220
+ /**
221
+ * @public
222
+ * @module @ui5/builder/tasks/generateLibraryPreload
223
+ */
224
+
219
225
  /**
220
226
  * Task for library bundling.
221
227
  *
222
228
  * @public
223
- * @alias module:@ui5/builder.tasks.generateLibraryPreload
229
+ * @function default
230
+ * @static
231
+ *
224
232
  * @param {object} parameters Parameters
225
- * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
226
- * @param {module:@ui5/project.build.helpers.TaskUtil} [parameters.taskUtil] TaskUtil
233
+ * @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
234
+ * @param {@ui5/project/build/helpers/TaskUtil} [parameters.taskUtil] TaskUtil
227
235
  * @param {object} parameters.options Options
228
236
  * @param {string} parameters.options.projectName Project name
229
237
  * @param {string[]} [parameters.options.skipBundles] Names of bundles that should not be created
@@ -235,10 +243,10 @@ function getSapUiCoreBunDef(name, filters, preload) {
235
243
  * inclusion overrides an earlier exclusion, and vice versa.
236
244
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
237
245
  */
238
- module.exports = function({workspace, taskUtil, options: {skipBundles = [], excludes = [], projectName}}) {
246
+ export default async function({workspace, taskUtil, options: {skipBundles = [], excludes = [], projectName}}) {
239
247
  let nonDbgWorkspace = workspace;
240
248
  if (taskUtil) {
241
- nonDbgWorkspace = workspace.filter(function(resource) {
249
+ nonDbgWorkspace = await workspace.filter(function(resource) {
242
250
  // Remove any debug variants
243
251
  return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.IsDebugVariant);
244
252
  });
@@ -273,10 +281,12 @@ module.exports = function({workspace, taskUtil, options: {skipBundles = [], excl
273
281
  let unoptimizedModuleNameMapping;
274
282
  let unoptimizedResources = resources;
275
283
  if (taskUtil) {
276
- unoptimizedResources = await workspace.filter(function(resource) {
284
+ const unoptimizedWorkspace = await workspace.filter(function(resource) {
277
285
  // Remove any non-debug variants
278
286
  return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.HasDebugVariant);
279
- }).byGlob("/**/*.{js,json,xml,html,properties,library,js.map}");
287
+ });
288
+ unoptimizedResources =
289
+ await unoptimizedWorkspace.byGlob("/**/*.{js,json,xml,html,properties,library,js.map}");
280
290
 
281
291
  unoptimizedModuleNameMapping = createModuleNameMapping({
282
292
  resources: unoptimizedResources,
@@ -434,4 +444,4 @@ module.exports = function({workspace, taskUtil, options: {skipBundles = [], excl
434
444
  });
435
445
  });
436
446
  });
437
- };
447
+ }
@@ -1,23 +1,32 @@
1
- const log = require("@ui5/logger").getLogger("builder:tasks:bundlers:generateManifestBundle");
2
- const manifestBundler = require("../../processors/bundlers/manifestBundler");
1
+ import logger from "@ui5/logger";
2
+ const log = logger.getLogger("builder:tasks:bundlers:generateManifestBundle");
3
+ import manifestBundler from "../../processors/bundlers/manifestBundler.js";
4
+
3
5
  const DESCRIPTOR = "manifest.json";
4
6
  const PROPERTIES_EXT = ".properties";
5
7
  const BUNDLE_NAME = "manifest-bundle.zip";
6
8
 
9
+ /**
10
+ * @public
11
+ * @module @ui5/builder/tasks/generateManifestBundle
12
+ */
13
+
7
14
  /* eslint "jsdoc/check-param-names": ["error", {"disableExtraPropertyReporting":true}] */
8
15
  /**
9
16
  * Task for manifestBundler.
10
17
  *
11
18
  * @public
12
- * @alias module:@ui5/builder.tasks.generateManifestBundle
19
+ * @function default
20
+ * @static
21
+ *
13
22
  * @param {object} parameters Parameters
14
- * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
23
+ * @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
15
24
  * @param {object} parameters.options Options
16
25
  * @param {string} parameters.options.projectName Project name
17
26
  * @param {string} parameters.options.projectNamespace Project namespace
18
27
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
19
28
  */
20
- module.exports = async function({workspace, options = {}}) {
29
+ export default async function({workspace, options = {}}) {
21
30
  const {projectName} = options;
22
31
  // Backward compatibility: "namespace" option got renamed to "projectNamespace"
23
32
  const namespace = options.projectNamespace || options.namespace;
@@ -46,4 +55,4 @@ module.exports = async function({workspace, options = {}}) {
46
55
  await Promise.all(processedResources.map((resource) => {
47
56
  return workspace.write(resource);
48
57
  }));
49
- };
58
+ }
@@ -1,7 +1,8 @@
1
- const log = require("@ui5/logger").getLogger("builder:tasks:bundlers:generateStandaloneAppBundle");
2
- const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritized;
3
- const moduleBundler = require("../../processors/bundlers/moduleBundler");
4
- const createModuleNameMapping = require("./utils/createModuleNameMapping");
1
+ import logger from "@ui5/logger";
2
+ const log = logger.getLogger("builder:tasks:bundlers:generateStandaloneAppBundle");
3
+ import ReaderCollectionPrioritized from "@ui5/fs/ReaderCollectionPrioritized";
4
+ import moduleBundler from "../../processors/bundlers/moduleBundler.js";
5
+ import createModuleNameMapping from "./utils/createModuleNameMapping.js";
5
6
 
6
7
  function getBundleDefinition(config) {
7
8
  const bundleDefinition = {
@@ -58,22 +59,29 @@ function getBundleDefinition(config) {
58
59
  return bundleDefinition;
59
60
  }
60
61
 
62
+ /**
63
+ * @public
64
+ * @module @ui5/builder/tasks/generateStandaloneAppBundle
65
+ */
66
+
61
67
  /* eslint "jsdoc/check-param-names": ["error", {"disableExtraPropertyReporting":true}] */
62
68
  /**
63
69
  * Task for bundling standalone applications.
64
70
  *
65
71
  * @public
66
- * @alias module:@ui5/builder.tasks.generateStandaloneAppBundle
72
+ * @function default
73
+ * @static
74
+ *
67
75
  * @param {object} parameters Parameters
68
- * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
69
- * @param {module:@ui5/fs.AbstractReader} parameters.dependencies Reader or Collection to read dependency files
70
- * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
76
+ * @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
77
+ * @param {@ui5/fs/AbstractReader} parameters.dependencies Reader or Collection to read dependency files
78
+ * @param {@ui5/project/build/helpers/TaskUtil|object} [parameters.taskUtil] TaskUtil
71
79
  * @param {object} parameters.options Options
72
80
  * @param {string} parameters.options.projectName Project name
73
81
  * @param {string} [parameters.options.projectNamespace] Project namespace
74
82
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
75
83
  */
76
- module.exports = async function({workspace, dependencies, taskUtil, options}) {
84
+ export default async function({workspace, dependencies, taskUtil, options}) {
77
85
  const {projectName} = options;
78
86
  // Backward compatibility: "namespace" option got renamed to "projectNamespace"
79
87
  const namespace = options.projectNamespace || options.namespace;
@@ -90,7 +98,7 @@ module.exports = async function({workspace, dependencies, taskUtil, options}) {
90
98
 
91
99
  if (taskUtil) {
92
100
  // Omit -dbg files
93
- combo = combo.filter(function(resource) {
101
+ combo = await combo.filter(function(resource) {
94
102
  return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.IsDebugVariant);
95
103
  });
96
104
  }
@@ -109,13 +117,13 @@ module.exports = async function({workspace, dependencies, taskUtil, options}) {
109
117
  let unoptimizedModuleNameMapping;
110
118
  let unoptimizedResources = resources;
111
119
  if (taskUtil) {
112
- unoptimizedResources = await new ReaderCollectionPrioritized({
120
+ unoptimizedResources = await (await new ReaderCollectionPrioritized({
113
121
  name: `generateStandaloneAppBundle - prioritize workspace over dependencies: ${projectName}`,
114
122
  readers: [workspace, dependencies]
115
123
  }).filter(function(resource) {
116
124
  // Remove any non-debug variants
117
125
  return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.HasDebugVariant);
118
- }).byGlob("/resources/**/*.{js,json,xml,html,properties,library,js.map}");
126
+ })).byGlob("/resources/**/*.{js,json,xml,html,properties,library,js.map}");
119
127
 
120
128
  unoptimizedModuleNameMapping = createModuleNameMapping({
121
129
  resources: unoptimizedResources,
@@ -167,4 +175,4 @@ module.exports = async function({workspace, dependencies, taskUtil, options}) {
167
175
  return Promise.all(writes);
168
176
  }));
169
177
  });
170
- };
178
+ }
@@ -1,4 +1,4 @@
1
- const ModuleName = require("../../../lbt/utils/ModuleName");
1
+ import {getNonDebugName} from "../../../lbt/utils/ModuleName.js";
2
2
 
3
3
  /**
4
4
  * For "unoptimized" bundles, the non-debug files have already been filtered out above.
@@ -10,17 +10,17 @@ const ModuleName = require("../../../lbt/utils/ModuleName");
10
10
  *
11
11
  * @private
12
12
  * @param {object} parameters Parameters
13
- * @param {module:@ui5/fs.Resource[]} parameters.resources List of resources
14
- * @param {module:@ui5/project.build.helpers.TaskUtil|object} parameters.taskUtil TaskUtil
13
+ * @param {@ui5/fs/Resource[]} parameters.resources List of resources
14
+ * @param {@ui5/project/build/helpers/TaskUtil|object} parameters.taskUtil TaskUtil
15
15
  * @returns {object} Module name mapping
16
16
  */
17
- module.exports = function({resources, taskUtil}) {
17
+ export default function({resources, taskUtil}) {
18
18
  const moduleNameMapping = {};
19
19
  for (let i = resources.length - 1; i >= 0; i--) {
20
20
  const resource = resources[i];
21
21
  if (taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.IsDebugVariant)) {
22
22
  const resourcePath = resource.getPath();
23
- const nonDbgPath = ModuleName.getNonDebugName(resourcePath);
23
+ const nonDbgPath = getNonDebugName(resourcePath);
24
24
  if (!nonDbgPath) {
25
25
  throw new Error(`Failed to resolve non-debug name for ${resourcePath}`);
26
26
  }
@@ -28,4 +28,4 @@ module.exports = function({resources, taskUtil}) {
28
28
  }
29
29
  }
30
30
  return moduleNameMapping;
31
- };
31
+ }
@@ -1,18 +1,25 @@
1
- const nonAsciiEscaper = require("../processors/nonAsciiEscaper");
1
+ import nonAsciiEscaper from "../processors/nonAsciiEscaper.js";
2
+
3
+ /**
4
+ * @public
5
+ * @module @ui5/builder/tasks/escapeNonAsciiCharacters
6
+ */
2
7
 
3
8
  /**
4
9
  * Task to escape non ascii characters in properties files resources.
5
10
  *
6
11
  * @public
7
- * @alias module:@ui5/builder.tasks.escapeNonAsciiCharacters
12
+ * @function default
13
+ * @static
14
+ *
8
15
  * @param {object} parameters Parameters
9
- * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
16
+ * @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
10
17
  * @param {object} parameters.options Options
11
18
  * @param {string} parameters.options.pattern Glob pattern to locate the files to be processed
12
19
  * @param {string} parameters.options.encoding source file encoding either "UTF-8" or "ISO-8859-1"
13
20
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
14
21
  */
15
- module.exports = async function({workspace, options: {pattern, encoding}}) {
22
+ export default async function({workspace, options: {pattern, encoding}}) {
16
23
  if (!encoding) {
17
24
  throw new Error("[escapeNonAsciiCharacters] Mandatory option 'encoding' not provided");
18
25
  }
@@ -27,4 +34,4 @@ module.exports = async function({workspace, options: {pattern, encoding}}) {
27
34
  });
28
35
 
29
36
  await Promise.all(processedResources.map((resource) => workspace.write(resource)));
30
- };
37
+ }