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

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 +59 -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 +119 -77
  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 +6 -9
  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 +2 -3
  28. package/lib/lbt/resources/Resource.js +3 -4
  29. package/lib/lbt/resources/ResourceCollector.js +8 -9
  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 +60 -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 +4 -4
  38. package/lib/lbt/utils/parseUtils.js +5 -11
  39. package/lib/processors/bootstrapHtmlTransformer.js +15 -7
  40. package/lib/processors/bundlers/flexChangesBundler.js +16 -8
  41. package/lib/processors/bundlers/moduleBundler.js +26 -15
  42. package/lib/processors/jsdoc/apiIndexGenerator.js +16 -9
  43. package/lib/processors/jsdoc/jsdocGenerator.js +37 -25
  44. package/lib/processors/jsdoc/lib/{createIndexFiles.js → createIndexFiles.cjs} +0 -0
  45. package/lib/processors/jsdoc/lib/{transformApiJson.js → transformApiJson.cjs} +59 -2
  46. package/lib/processors/jsdoc/lib/ui5/{plugin.js → plugin.cjs} +310 -119
  47. package/lib/processors/jsdoc/lib/ui5/template/{publish.js → publish.cjs} +6 -2
  48. package/lib/processors/jsdoc/lib/ui5/template/utils/{versionUtil.js → versionUtil.cjs} +0 -0
  49. package/lib/processors/jsdoc/sdkTransformer.js +18 -11
  50. package/lib/processors/libraryLessGenerator.js +28 -16
  51. package/lib/processors/manifestCreator.js +15 -14
  52. package/lib/processors/minifier.js +22 -16
  53. package/lib/processors/nonAsciiEscaper.js +17 -7
  54. package/lib/processors/resourceListCreator.js +13 -13
  55. package/lib/processors/stringReplacer.js +13 -6
  56. package/lib/processors/themeBuilder.js +33 -24
  57. package/lib/processors/versionInfoGenerator.js +40 -30
  58. package/lib/tasks/buildThemes.js +18 -11
  59. package/lib/tasks/bundlers/generateBundle.js +23 -12
  60. package/lib/tasks/bundlers/generateComponentPreload.js +23 -12
  61. package/lib/tasks/bundlers/generateFlexChangesBundle.js +16 -8
  62. package/lib/tasks/bundlers/generateLibraryPreload.js +33 -17
  63. package/lib/tasks/bundlers/generateStandaloneAppBundle.js +21 -13
  64. package/lib/tasks/bundlers/utils/createModuleNameMapping.js +7 -7
  65. package/lib/tasks/escapeNonAsciiCharacters.js +12 -5
  66. package/lib/tasks/generateCachebusterInfo.js +17 -9
  67. package/lib/tasks/generateLibraryManifest.js +14 -8
  68. package/lib/tasks/generateResourcesJson.js +15 -9
  69. package/lib/tasks/generateThemeDesignerResources.js +19 -9
  70. package/lib/tasks/generateVersionInfo.js +12 -5
  71. package/lib/tasks/jsdoc/executeJsdocSdkTransformation.js +17 -9
  72. package/lib/tasks/jsdoc/generateApiIndex.js +16 -10
  73. package/lib/tasks/jsdoc/generateJsdoc.js +131 -119
  74. package/lib/tasks/minify.js +13 -6
  75. package/lib/tasks/replaceBuildtime.js +12 -5
  76. package/lib/tasks/replaceCopyright.js +12 -5
  77. package/lib/tasks/replaceVersion.js +12 -5
  78. package/lib/tasks/taskRepository.js +24 -30
  79. package/lib/tasks/transformBootstrapHtml.js +6 -5
  80. package/package.json +44 -31
  81. package/index.js +0 -173
  82. package/lib/processors/bundlers/manifestBundler.js +0 -172
  83. package/lib/tasks/bundlers/generateManifestBundle.js +0 -49
@@ -1,13 +1,20 @@
1
- const log = require("@ui5/logger").getLogger("builder:tasks:jsdoc:generateJsdoc");
2
- const path = require("path");
3
- const makeDir = require("make-dir");
4
- const os = require("os");
5
- const fs = require("graceful-fs");
6
- const {promisify} = require("util");
1
+ import logger from "@ui5/logger";
2
+ const log = logger.getLogger("builder:tasks:jsdoc:generateJsdoc");
3
+ import path from "node:path";
4
+ import makeDir from "make-dir";
5
+ import os from "node:os";
6
+ import fs from "graceful-fs";
7
+ import _rimraf from "rimraf";
8
+ import {promisify} from "node:util";
7
9
  const mkdtemp = promisify(fs.mkdtemp);
8
- const rimraf = promisify(require("rimraf"));
9
- const jsdocGenerator = require("../../processors/jsdoc/jsdocGenerator");
10
- const {resourceFactory} = require("@ui5/fs");
10
+ const rimraf = promisify(_rimraf);
11
+ import jsdocGenerator from "../../processors/jsdoc/jsdocGenerator.js";
12
+ import {createAdapter} from "@ui5/fs/resourceFactory";
13
+
14
+ /**
15
+ * @public
16
+ * @module @ui5/builder/tasks/jsdoc/generateJsdoc
17
+ */
11
18
 
12
19
  /**
13
20
  *
@@ -23,30 +30,33 @@ const {resourceFactory} = require("@ui5/fs");
23
30
  * Task to execute a JSDoc build for UI5 projects
24
31
  *
25
32
  * @public
26
- * @alias module:@ui5/builder.tasks.generateJsdoc
33
+ * @function default
34
+ * @static
35
+ *
27
36
  * @param {object} parameters Parameters
28
- * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
29
- * @param {module:@ui5/fs.AbstractReader} parameters.dependencies Reader or Collection to read dependency files
30
- * @param {GenerateJsdocOptions} parameters.options Options
31
- * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
37
+ * @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
38
+ * @param {@ui5/fs/AbstractReader} parameters.dependencies Reader or Collection to read dependency files
39
+ * @param {module:@ui5/builder/tasks/jsdoc/generateJsdoc~GenerateJsdocOptions} parameters.options Options
40
+ * @param {@ui5/project/build/helpers/TaskUtil|object} [parameters.taskUtil] TaskUtil
32
41
  * @param {object} [parameters.buildContext] Internal, deprecated parameter
33
42
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
34
43
  */
35
- const generateJsdoc = async function({
44
+ export default async function generateJsdoc({
36
45
  taskUtil,
37
46
  buildContext,
38
47
  workspace,
39
48
  dependencies,
40
49
  options = {}
41
50
  }) {
42
- const {projectName, namespace, version, pattern} = /** @type {GenerateJsdocOptions} */ (options);
51
+ const {projectName, namespace, version, pattern} =
52
+ /** @type {module:@ui5/builder/tasks/jsdoc/generateJsdoc~GenerateJsdocOptions} */ (options);
43
53
 
44
54
  if (!projectName || !namespace || !version || !pattern) {
45
55
  throw new Error("[generateJsdoc]: One or more mandatory options not provided");
46
56
  }
47
57
 
48
58
  const {sourcePath: resourcePath, targetPath, tmpPath, cleanup} =
49
- await generateJsdoc._createTmpDirs(projectName);
59
+ await utils.createTmpDirs(projectName);
50
60
 
51
61
  // TODO 3.0: remove buildContext
52
62
  const _taskUtil = taskUtil || buildContext;
@@ -55,12 +65,12 @@ const generateJsdoc = async function({
55
65
  }
56
66
 
57
67
  const [writtenResourcesCount] = await Promise.all([
58
- generateJsdoc._writeResourcesToDir({
68
+ utils.writeResourcesToDir({
59
69
  workspace,
60
70
  pattern,
61
71
  targetPath: resourcePath
62
72
  }),
63
- generateJsdoc._writeDependencyApisToDir({
73
+ utils.writeDependencyApisToDir({
64
74
  dependencies,
65
75
  targetPath: path.join(tmpPath, "dependency-apis")
66
76
  })
@@ -87,110 +97,112 @@ const generateJsdoc = async function({
87
97
  await Promise.all(createdResources.map((resource) => {
88
98
  return workspace.write(resource);
89
99
  }));
90
- };
91
-
92
- /**
93
- * Create temporary directories for JSDoc generation processor
94
- *
95
- * @private
96
- * @param {string} projectName Project name used for naming the temporary working directory
97
- * @returns {Promise<object>} Promise resolving with sourcePath, targetPath and tmpPath strings
98
- */
99
- async function createTmpDirs(projectName) {
100
- const tmpDirPath = await generateJsdoc._createTmpDir(projectName);
101
-
102
- const sourcePath = path.join(tmpDirPath, "src"); // dir will be created by writing project resources below
103
- await makeDir(sourcePath, {fs});
104
- const targetPath = path.join(tmpDirPath, "target"); // dir will be created by jsdoc itself
105
- await makeDir(targetPath, {fs});
106
-
107
- const tmpPath = path.join(tmpDirPath, "tmp"); // dir needs to be created by us
108
- await makeDir(tmpPath, {fs});
109
-
110
- return {
111
- sourcePath,
112
- targetPath,
113
- tmpPath,
114
- cleanup: async () => {
115
- return rimraf(tmpDirPath);
116
- }
117
- };
118
- }
119
-
120
- /**
121
- * Create a temporary directory on the host system
122
- *
123
- * @private
124
- * @param {string} projectName Project name used for naming the temporary directory
125
- * @returns {Promise<string>} Promise resolving with path of the temporary directory
126
- */
127
- async function createTmpDir(projectName) {
128
- const sanitizedProjectName = projectName.replace(/[^A-Za-z0-9]/g, "");
129
-
130
- const tmpRootPath = path.join(os.tmpdir(), "ui5-tooling");
131
- await makeDir(tmpRootPath, {fs});
132
-
133
- // Appending minus sign also because node docs advise to "avoid trailing X characters in prefix"
134
- return mkdtemp(path.join(tmpRootPath, `jsdoc-${sanitizedProjectName}-`));
135
100
  }
136
101
 
137
- /**
138
- * Write resources from workspace matching the given pattern to the given fs destination
139
- *
140
- * @private
141
- * @param {object} parameters Parameters
142
- * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
143
- * @param {string} parameters.pattern Pattern to match resources in workspace against
144
- * @param {string} parameters.targetPath Path to write the resources to
145
- * @returns {Promise<number>} Promise resolving with number of resources written to given directory
146
- */
147
- async function writeResourcesToDir({workspace, pattern, targetPath}) {
148
- const fsTarget = resourceFactory.createAdapter({
149
- fsBasePath: targetPath,
150
- virBasePath: "/resources/"
151
- });
152
-
153
- let allResources;
154
- if (workspace.byGlobSource) { // API only available on duplex collections
155
- allResources = await workspace.byGlobSource(pattern);
156
- } else {
157
- allResources = await workspace.byGlob(pattern);
158
- }
159
-
160
- // write all resources to the tmp folder
161
- await Promise.all(allResources.map((resource) => fsTarget.write(resource)));
162
- return allResources.length;
163
- }
164
-
165
- /**
166
- * Write api.json files of dependencies to given target path in a flat structure
167
- *
168
- * @private
169
- * @param {object} parameters Parameters
170
- * @param {module:@ui5/fs.AbstractReader} parameters.dependencies Reader or Collection to read dependency files
171
- * @param {string} parameters.targetPath Path to write the resources to
172
- * @returns {Promise<number>} Promise resolving with number of resources written to given directory
173
- */
174
- async function writeDependencyApisToDir({dependencies, targetPath}) {
175
- const depApis = await dependencies.byGlob("/test-resources/**/designtime/api.json");
102
+ const utils = {
103
+ /**
104
+ * Create temporary directories for JSDoc generation processor
105
+ *
106
+ * @private
107
+ * @param {string} projectName Project name used for naming the temporary working directory
108
+ * @returns {Promise<object>} Promise resolving with sourcePath, targetPath and tmpPath strings
109
+ */
110
+ createTmpDirs: async function(projectName) {
111
+ const tmpDirPath = await utils.createTmpDir(projectName);
112
+
113
+ const sourcePath = path.join(tmpDirPath, "src"); // dir will be created by writing project resources below
114
+ await makeDir(sourcePath, {fs});
115
+ const targetPath = path.join(tmpDirPath, "target"); // dir will be created by jsdoc itself
116
+ await makeDir(targetPath, {fs});
117
+
118
+ const tmpPath = path.join(tmpDirPath, "tmp"); // dir needs to be created by us
119
+ await makeDir(tmpPath, {fs});
120
+
121
+ return {
122
+ sourcePath,
123
+ targetPath,
124
+ tmpPath,
125
+ cleanup: async () => {
126
+ return rimraf(tmpDirPath);
127
+ }
128
+ };
129
+ },
130
+
131
+ /**
132
+ * Create a temporary directory on the host system
133
+ *
134
+ * @private
135
+ * @param {string} projectName Project name used for naming the temporary directory
136
+ * @returns {Promise<string>} Promise resolving with path of the temporary directory
137
+ */
138
+ createTmpDir: async function(projectName) {
139
+ const sanitizedProjectName = projectName.replace(/[^A-Za-z0-9]/g, "");
140
+
141
+ const tmpRootPath = path.join(os.tmpdir(), "ui5-tooling");
142
+ await makeDir(tmpRootPath, {fs});
143
+
144
+ // Appending minus sign also because node docs advise to "avoid trailing X characters in prefix"
145
+ return mkdtemp(path.join(tmpRootPath, `jsdoc-${sanitizedProjectName}-`));
146
+ },
147
+
148
+ /**
149
+ * Write resources from workspace matching the given pattern to the given fs destination
150
+ *
151
+ * @private
152
+ * @param {object} parameters Parameters
153
+ * @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
154
+ * @param {string} parameters.pattern Pattern to match resources in workspace against
155
+ * @param {string} parameters.targetPath Path to write the resources to
156
+ * @returns {Promise<number>} Promise resolving with number of resources written to given directory
157
+ */
158
+ writeResourcesToDir: async function({workspace, pattern, targetPath}) {
159
+ const fsTarget = createAdapter({
160
+ fsBasePath: targetPath,
161
+ virBasePath: "/resources/"
162
+ });
163
+
164
+ let allResources;
165
+ if (workspace.byGlobSource) { // API only available on duplex collections
166
+ allResources = await workspace.byGlobSource(pattern);
167
+ } else {
168
+ allResources = await workspace.byGlob(pattern);
169
+ }
176
170
 
177
- // Clone resources before changing their path
178
- const apis = await Promise.all(depApis.map((resource) => resource.clone()));
171
+ // write all resources to the tmp folder
172
+ await Promise.all(allResources.map((resource) => fsTarget.write(resource)));
173
+ return allResources.length;
174
+ },
175
+
176
+ /**
177
+ * Write api.json files of dependencies to given target path in a flat structure
178
+ *
179
+ * @private
180
+ * @param {object} parameters Parameters
181
+ * @param {@ui5/fs/AbstractReader} parameters.dependencies Reader or Collection to read dependency files
182
+ * @param {string} parameters.targetPath Path to write the resources to
183
+ * @returns {Promise<number>} Promise resolving with number of resources written to given directory
184
+ */
185
+ writeDependencyApisToDir: async function({dependencies, targetPath}) {
186
+ const depApis = await dependencies.byGlob("/test-resources/**/designtime/api.json");
187
+
188
+ // Clone resources before changing their path
189
+ const apis = await Promise.all(depApis.map((resource) => resource.clone()));
190
+
191
+ for (let i = 0; i < apis.length; i++) {
192
+ apis[i].setPath(`/api-${i}.json`);
193
+ }
179
194
 
180
- for (let i = 0; i < apis.length; i++) {
181
- apis[i].setPath(`/api-${i}.json`);
195
+ const fsTarget = createAdapter({
196
+ fsBasePath: targetPath,
197
+ virBasePath: "/"
198
+ });
199
+ await Promise.all(apis.map((resource) => fsTarget.write(resource)));
200
+ return apis.length;
182
201
  }
202
+ };
183
203
 
184
- const fsTarget = resourceFactory.createAdapter({
185
- fsBasePath: targetPath,
186
- virBasePath: "/"
187
- });
188
- await Promise.all(apis.map((resource) => fsTarget.write(resource)));
189
- return apis.length;
204
+ // Export utils for testing only
205
+ /* istanbul ignore else */
206
+ if (process.env.NODE_ENV === "test") {
207
+ generateJsdoc._utils = utils;
190
208
  }
191
-
192
- module.exports = generateJsdoc;
193
- module.exports._createTmpDirs = createTmpDirs;
194
- module.exports._createTmpDir = createTmpDir;
195
- module.exports._writeResourcesToDir = writeResourcesToDir;
196
- module.exports._writeDependencyApisToDir = writeDependencyApisToDir;
@@ -1,20 +1,27 @@
1
- const minifier = require("../processors/minifier");
1
+ import minifier from "../processors/minifier.js";
2
+
3
+ /**
4
+ * @public
5
+ * @module @ui5/builder/tasks/minify
6
+ */
2
7
 
3
8
  /**
4
9
  * Task to minify resources.
5
10
  *
6
11
  * @public
7
- * @alias module:@ui5/builder.tasks.minify
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
10
- * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
16
+ * @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
17
+ * @param {@ui5/project/build/helpers/TaskUtil|object} [parameters.taskUtil] TaskUtil
11
18
  * @param {object} parameters.options Options
12
19
  * @param {string} parameters.options.pattern Pattern to locate the files to be processed
13
20
  * @param {boolean} [parameters.options.omitSourceMapResources=false] Whether source map resources shall
14
21
  * be tagged as "OmitFromBuildResult" and no sourceMappingURL shall be added to the minified resource
15
22
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
16
23
  */
17
- module.exports = async function({workspace, taskUtil, options: {pattern, omitSourceMapResources = false}}) {
24
+ export default async function({workspace, taskUtil, options: {pattern, omitSourceMapResources = false}}) {
18
25
  const resources = await workspace.byGlob(pattern);
19
26
  const processedResources = await minifier({
20
27
  resources,
@@ -38,4 +45,4 @@ module.exports = async function({workspace, taskUtil, options: {pattern, omitSou
38
45
  workspace.write(sourceMapResource)
39
46
  ]);
40
47
  }));
41
- };
48
+ }
@@ -1,4 +1,4 @@
1
- const stringReplacer = require("../processors/stringReplacer");
1
+ import stringReplacer from "../processors/stringReplacer.js";
2
2
 
3
3
  function pad(v) {
4
4
  return String(v).padStart(2, "0");
@@ -14,18 +14,25 @@ function getTimestamp() {
14
14
  return year + month + day + "-" + hours + minutes;
15
15
  }
16
16
 
17
+ /**
18
+ * @public
19
+ * @module @ui5/builder/tasks/replaceBuildtime
20
+ */
21
+
17
22
  /**
18
23
  * Task to replace the buildtime <code>${buildtime}</code>.
19
24
  *
20
25
  * @public
21
- * @alias module:@ui5/builder.tasks.replaceBuildtime
26
+ * @function default
27
+ * @static
28
+ *
22
29
  * @param {object} parameters Parameters
23
- * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
30
+ * @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
24
31
  * @param {object} parameters.options Options
25
32
  * @param {string} parameters.options.pattern Pattern to locate the files to be processed
26
33
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
27
34
  */
28
- module.exports = function({workspace, options: {pattern}}) {
35
+ export default function({workspace, options: {pattern}}) {
29
36
  const timestamp = getTimestamp();
30
37
 
31
38
  return workspace.byGlob(pattern)
@@ -43,4 +50,4 @@ module.exports = function({workspace, options: {pattern}}) {
43
50
  return workspace.write(resource);
44
51
  }));
45
52
  });
46
- };
53
+ }
@@ -1,4 +1,9 @@
1
- const stringReplacer = require("../processors/stringReplacer");
1
+ import stringReplacer from "../processors/stringReplacer.js";
2
+
3
+ /**
4
+ * @public
5
+ * @module @ui5/builder/tasks/replaceCopyright
6
+ */
2
7
 
3
8
  /**
4
9
  * Task to to replace the copyright.
@@ -14,15 +19,17 @@ const stringReplacer = require("../processors/stringReplacer");
14
19
  * If no copyright string is given, no replacement is being done.
15
20
  *
16
21
  * @public
17
- * @alias module:@ui5/builder.tasks.replaceCopyright
22
+ * @function default
23
+ * @static
24
+ *
18
25
  * @param {object} parameters Parameters
19
- * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
26
+ * @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
20
27
  * @param {object} parameters.options Options
21
28
  * @param {string} parameters.options.copyright Replacement copyright
22
29
  * @param {string} parameters.options.pattern Pattern to locate the files to be processed
23
30
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
24
31
  */
25
- module.exports = function({workspace, options: {copyright, pattern}}) {
32
+ export default function({workspace, options: {copyright, pattern}}) {
26
33
  if (!copyright) {
27
34
  return Promise.resolve();
28
35
  }
@@ -45,4 +52,4 @@ module.exports = function({workspace, options: {copyright, pattern}}) {
45
52
  return workspace.write(resource);
46
53
  }));
47
54
  });
48
- };
55
+ }
@@ -1,18 +1,25 @@
1
- const stringReplacer = require("../processors/stringReplacer");
1
+ import stringReplacer from "../processors/stringReplacer.js";
2
+
3
+ /**
4
+ * @public
5
+ * @module @ui5/builder/tasks/replaceVersion
6
+ */
2
7
 
3
8
  /**
4
9
  * Task to replace the version <code>${version}</code>.
5
10
  *
6
11
  * @public
7
- * @alias module:@ui5/builder.tasks.replaceVersion
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 Pattern to locate the files to be processed
12
19
  * @param {string} parameters.options.version Replacement version
13
20
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
14
21
  */
15
- module.exports = function({workspace, options: {pattern, version}}) {
22
+ export default function({workspace, options: {pattern, version}}) {
16
23
  return workspace.byGlob(pattern)
17
24
  .then((allResources) => {
18
25
  return stringReplacer({
@@ -28,4 +35,4 @@ module.exports = function({workspace, options: {pattern, version}}) {
28
35
  return workspace.write(resource);
29
36
  }));
30
37
  });
31
- };
38
+ }
@@ -1,32 +1,31 @@
1
1
  const taskInfos = {
2
- replaceCopyright: {path: "./replaceCopyright"},
3
- replaceVersion: {path: "./replaceVersion"},
4
- replaceBuildtime: {path: "./replaceBuildtime"},
5
- escapeNonAsciiCharacters: {path: "./escapeNonAsciiCharacters"},
6
- executeJsdocSdkTransformation: {path: "./jsdoc/executeJsdocSdkTransformation"},
7
- generateApiIndex: {path: "./jsdoc/generateApiIndex"},
8
- generateJsdoc: {path: "./jsdoc/generateJsdoc"},
9
- minify: {path: "./minify"},
10
- buildThemes: {path: "./buildThemes"},
11
- transformBootstrapHtml: {path: "./transformBootstrapHtml"},
12
- generateLibraryManifest: {path: "./generateLibraryManifest"},
13
- generateVersionInfo: {path: "./generateVersionInfo"},
14
- generateManifestBundle: {path: "./bundlers/generateManifestBundle"},
15
- generateFlexChangesBundle: {path: "./bundlers/generateFlexChangesBundle"},
16
- generateComponentPreload: {path: "./bundlers/generateComponentPreload"},
17
- generateResourcesJson: {path: "./generateResourcesJson"},
18
- generateThemeDesignerResources: {path: "./generateThemeDesignerResources"},
19
- generateStandaloneAppBundle: {path: "./bundlers/generateStandaloneAppBundle"},
20
- generateBundle: {path: "./bundlers/generateBundle"},
21
- generateLibraryPreload: {path: "./bundlers/generateLibraryPreload"},
22
- generateCachebusterInfo: {path: "./generateCachebusterInfo"}
2
+ replaceCopyright: {path: "./replaceCopyright.js"},
3
+ replaceVersion: {path: "./replaceVersion.js"},
4
+ replaceBuildtime: {path: "./replaceBuildtime.js"},
5
+ escapeNonAsciiCharacters: {path: "./escapeNonAsciiCharacters.js"},
6
+ executeJsdocSdkTransformation: {path: "./jsdoc/executeJsdocSdkTransformation.js"},
7
+ generateApiIndex: {path: "./jsdoc/generateApiIndex.js"},
8
+ generateJsdoc: {path: "./jsdoc/generateJsdoc.js"},
9
+ minify: {path: "./minify.js"},
10
+ buildThemes: {path: "./buildThemes.js"},
11
+ transformBootstrapHtml: {path: "./transformBootstrapHtml.js"},
12
+ generateLibraryManifest: {path: "./generateLibraryManifest.js"},
13
+ generateVersionInfo: {path: "./generateVersionInfo.js"},
14
+ generateFlexChangesBundle: {path: "./bundlers/generateFlexChangesBundle.js"},
15
+ generateComponentPreload: {path: "./bundlers/generateComponentPreload.js"},
16
+ generateResourcesJson: {path: "./generateResourcesJson.js"},
17
+ generateThemeDesignerResources: {path: "./generateThemeDesignerResources.js"},
18
+ generateStandaloneAppBundle: {path: "./bundlers/generateStandaloneAppBundle.js"},
19
+ generateBundle: {path: "./bundlers/generateBundle.js"},
20
+ generateLibraryPreload: {path: "./bundlers/generateLibraryPreload.js"},
21
+ generateCachebusterInfo: {path: "./generateCachebusterInfo.js"}
23
22
  };
24
23
 
25
- function getTask(taskName) {
24
+ export async function getTask(taskName) {
26
25
  const taskInfo = taskInfos[taskName];
27
26
 
28
27
  if (!taskInfo) {
29
- if (["createDebugFiles", "uglify"].includes(taskName)) {
28
+ if (["createDebugFiles", "uglify", "generateManifestBundle"].includes(taskName)) {
30
29
  throw new Error(
31
30
  `Standard task ${taskName} has been removed in UI5 Tooling 3.0. ` +
32
31
  `Please see the migration guide at https://sap.github.io/ui5-tooling/updates/migrate-v3/`);
@@ -34,7 +33,7 @@ function getTask(taskName) {
34
33
  throw new Error(`taskRepository: Unknown Task ${taskName}`);
35
34
  }
36
35
  try {
37
- const task = require(taskInfo.path);
36
+ const {default: task} = await import(taskInfo.path);
38
37
  return {
39
38
  task
40
39
  };
@@ -43,11 +42,6 @@ function getTask(taskName) {
43
42
  }
44
43
  }
45
44
 
46
- function getAllTaskNames() {
45
+ export function getAllTaskNames() {
47
46
  return Object.keys(taskInfos);
48
47
  }
49
-
50
- module.exports = {
51
- getTask,
52
- getAllTaskNames
53
- };
@@ -1,5 +1,6 @@
1
- const log = require("@ui5/logger").getLogger("builder:tasks:transformBootstrapHtml");
2
- const bootstrapHtmlTransformer = require("../processors/bootstrapHtmlTransformer");
1
+ import logger from "@ui5/logger";
2
+ const log = logger.getLogger("builder:tasks:transformBootstrapHtml");
3
+ import bootstrapHtmlTransformer from "../processors/bootstrapHtmlTransformer.js";
3
4
 
4
5
  /* eslint "jsdoc/check-param-names": ["error", {"disableExtraPropertyReporting":true}] */
5
6
  /**
@@ -7,13 +8,13 @@ const bootstrapHtmlTransformer = require("../processors/bootstrapHtmlTransformer
7
8
  *
8
9
  * @module builder/tasks/transformBootstrapHtml
9
10
  * @param {object} parameters Parameters
10
- * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
11
+ * @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
11
12
  * @param {object} parameters.options Options
12
13
  * @param {string} parameters.options.projectName Project name
13
14
  * @param {string} [parameters.options.namespace] Project namespace
14
15
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
15
16
  */
16
- module.exports = async function({workspace, options}) {
17
+ export default async function({workspace, options}) {
17
18
  const {projectName} = options;
18
19
  // Backward compatibility: "namespace" option got renamed to "projectNamespace"
19
20
  const namespace = options.projectNamespace || options.namespace;
@@ -36,4 +37,4 @@ module.exports = async function({workspace, options}) {
36
37
  }
37
38
  });
38
39
  await Promise.all(processedResources.map((resource) => workspace.write(resource)));
39
- };
40
+ }