@ui5/builder 3.0.0-beta.5 → 3.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,10 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
- A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.5...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.6...HEAD).
6
+
7
+ <a name="v3.0.0-beta.6"></a>
8
+ ## [v3.0.0-beta.6] - 2022-12-13
6
9
 
7
10
  <a name="v3.0.0-beta.5"></a>
8
11
  ## [v3.0.0-beta.5] - 2022-12-12
@@ -825,6 +828,7 @@ to load the custom bundle file instead.
825
828
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
826
829
 
827
830
 
831
+ [v3.0.0-beta.6]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.5...v3.0.0-beta.6
828
832
  [v3.0.0-beta.5]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.4...v3.0.0-beta.5
829
833
  [v3.0.0-beta.4]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.3...v3.0.0-beta.4
830
834
  [v3.0.0-beta.3]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.2...v3.0.0-beta.3
@@ -1,3 +1,18 @@
1
+ import {createRequire} from "node:module";
2
+
3
+ /**
4
+ * Repository providing access to all UI5 Builder tasks and various metadata required by the build process.
5
+ * This module is designed to be imported by @ui5/project or to be passed as a private parameter
6
+ * to the <code>build</code> function of a [@ui5/project/graph/ProjectGraph]{@link @ui5/project/graph/ProjectGraph}.
7
+ *
8
+ * For other use cases, it is recommended to import the required tasks directly.
9
+ *
10
+ * Therefore, all API of this module is private.
11
+ *
12
+ * @private
13
+ * @module @ui5/builder/tasks/taskRepository
14
+ */
15
+
1
16
  const taskInfos = {
2
17
  replaceCopyright: {path: "./replaceCopyright.js"},
3
18
  replaceVersion: {path: "./replaceVersion.js"},
@@ -21,11 +36,29 @@ const taskInfos = {
21
36
  generateCachebusterInfo: {path: "./generateCachebusterInfo.js"}
22
37
  };
23
38
 
39
+
40
+ /**
41
+ * TaskInfo object returned by the getTask function
42
+ *
43
+ * @private
44
+ * @typedef {object} @ui5/builder/tasks/taskRepository~TaskInfo
45
+ * @property {Function} task Task function
46
+ */
47
+
48
+ /**
49
+ * Returns the module for a given task name
50
+ *
51
+ * @private
52
+ * @static
53
+ * @param {string} taskName Name of the task to retrieve
54
+ * @throws {Error} In case the specified task does not exist
55
+ * @returns {Promise<@ui5/builder/tasks/taskRepository~TaskInfo>} Object containing the task module
56
+ */
24
57
  export async function getTask(taskName) {
25
58
  const taskInfo = taskInfos[taskName];
26
59
 
27
60
  if (!taskInfo) {
28
- if (["createDebugFiles", "uglify", "generateManifestBundle"].includes(taskName)) {
61
+ if (getRemovedTaskNames().includes(taskName)) {
29
62
  throw new Error(
30
63
  `Standard task ${taskName} has been removed in UI5 Tooling 3.0. ` +
31
64
  `Please see the migration guide at https://sap.github.io/ui5-tooling/updates/migrate-v3/`);
@@ -42,6 +75,54 @@ export async function getTask(taskName) {
42
75
  }
43
76
  }
44
77
 
78
+ /**
79
+ * Returns a list of the names of all available tasks
80
+ *
81
+ * @private
82
+ * @static
83
+ * @returns {string[]} Array containing the names of all available tasks
84
+ */
45
85
  export function getAllTaskNames() {
46
86
  return Object.keys(taskInfos);
47
87
  }
88
+
89
+ /**
90
+ * Returns a list of the names of all tasks that have been removed
91
+ * in this or previous versions of ui5-builder.
92
+ *
93
+ * @private
94
+ * @static
95
+ * @returns {string[]} Array containing the names of all removed tasks
96
+ */
97
+ export function getRemovedTaskNames() {
98
+ return ["createDebugFiles", "uglify", "generateManifestBundle"];
99
+ }
100
+
101
+ // Using CommonsJS require as importing json files causes an ExperimentalWarning
102
+ const require = createRequire(import.meta.url);
103
+ function getVersion(pkg) {
104
+ return require(`${pkg}/package.json`).version;
105
+ }
106
+
107
+ /**
108
+ * Object containing the versions of the ui5-builder module and relevant dependencies
109
+ *
110
+ * @private
111
+ * @typedef {object} @ui5/builder/tasks/taskRepository~Versions
112
+ * @property {string} builderVersion Version of the ui5-builder module
113
+ * @property {string} fsVersion Version of the ui5-fs module in use
114
+ */
115
+
116
+ /**
117
+ * Provides version information on all relevant modules, used by ui5-builder
118
+ *
119
+ * @private
120
+ * @static
121
+ * @returns {@ui5/builder/tasks/taskRepository~Versions} Object containing version information
122
+ */
123
+ export async function getVersions() {
124
+ return {
125
+ builderVersion: getVersion("@ui5/builder"),
126
+ fsVersion: getVersion("@ui5/fs"),
127
+ };
128
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "3.0.0-beta.5",
3
+ "version": "3.0.0-beta.6",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",