@ui5/builder 3.0.0-alpha.8 → 3.0.0-alpha.9

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,10 +2,16 @@
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-alpha.8...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.9...HEAD).
6
+
7
+ <a name="v3.0.0-alpha.9"></a>
8
+ ## [v3.0.0-alpha.9] - 2022-07-27
9
+ ### Bug Fixes
10
+ - **minify:** Change default to not omit source map resources [`6d75a49`](https://github.com/SAP/ui5-builder/commit/6d75a495224590097332fc061c66cfe0e8f4c151)
11
+
6
12
 
7
13
  <a name="v3.0.0-alpha.8"></a>
8
- ## [v3.0.0-alpha.8] - 2022-07-14
14
+ ## [v3.0.0-alpha.8] - 2022-07-15
9
15
 
10
16
  <a name="v3.0.0-alpha.7"></a>
11
17
  ## [v3.0.0-alpha.7] - 2022-06-14
@@ -744,6 +750,7 @@ to load the custom bundle file instead.
744
750
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
745
751
 
746
752
 
753
+ [v3.0.0-alpha.9]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.8...v3.0.0-alpha.9
747
754
  [v3.0.0-alpha.8]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.7...v3.0.0-alpha.8
748
755
  [v3.0.0-alpha.7]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.6...v3.0.0-alpha.7
749
756
  [v3.0.0-alpha.6]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.5...v3.0.0-alpha.6
package/index.js CHANGED
@@ -152,10 +152,6 @@ module.exports = {
152
152
  * @type {import('./lib/tasks/taskRepository')}
153
153
  */
154
154
  taskRepository: "./lib/tasks/taskRepository",
155
- /**
156
- * @type {import('./lib/tasks/TaskUtil')}
157
- */
158
- TaskUtil: "./lib/tasks/TaskUtil"
159
155
  }
160
156
  };
161
157
 
@@ -10,7 +10,7 @@ const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritiz
10
10
  * @param {object} parameters Parameters
11
11
  * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
12
12
  * @param {module:@ui5/fs.ReaderCollection} parameters.dependencies Collection to read dependency files
13
- * @param {module:@ui5/builder.tasks.TaskUtil|object} [parameters.taskUtil] TaskUtil
13
+ * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
14
14
  * @param {object} parameters.options Options
15
15
  * @param {string} parameters.options.projectName Project name
16
16
  * @param {ModuleBundleDefinition} parameters.options.bundleDefinition Module bundle definition
@@ -10,7 +10,7 @@ const {negateFilters} = require("../../lbt/resources/ResourceFilterList");
10
10
  * @alias module:@ui5/builder.tasks.generateComponentPreload
11
11
  * @param {object} parameters Parameters
12
12
  * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
13
- * @param {module:@ui5/builder.tasks.TaskUtil|object} [parameters.taskUtil] TaskUtil
13
+ * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
14
14
  * @param {object} parameters.options Options
15
15
  * @param {string} parameters.options.projectName Project name
16
16
  * @param {string[]} [parameters.options.excludes=[]] List of modules declared as glob patterns (resource name patterns)
@@ -15,7 +15,7 @@ const semver = require("semver");
15
15
  * @alias module:@ui5/builder.tasks.generateFlexChangesBundle
16
16
  * @param {object} parameters Parameters
17
17
  * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
18
- * @param {module:@ui5/builder.tasks.TaskUtil|object} [parameters.taskUtil] TaskUtil
18
+ * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
19
19
  * @param {object} [parameters.options] Options
20
20
  * @param {string} [parameters.options.projectNamespace] Project Namespace
21
21
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
@@ -223,7 +223,7 @@ function getSapUiCoreBunDef(name, filters, preload) {
223
223
  * @alias module:@ui5/builder.tasks.generateLibraryPreload
224
224
  * @param {object} parameters Parameters
225
225
  * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
226
- * @param {module:@ui5/builder.tasks.TaskUtil} [parameters.taskUtil] TaskUtil
226
+ * @param {module:@ui5/project.build.helpers.TaskUtil} [parameters.taskUtil] TaskUtil
227
227
  * @param {object} parameters.options Options
228
228
  * @param {string} parameters.options.projectName Project name
229
229
  * @param {string[]} [parameters.options.skipBundles] Names of bundles that should not be created
@@ -67,7 +67,7 @@ function getBundleDefinition(config) {
67
67
  * @param {object} parameters Parameters
68
68
  * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
69
69
  * @param {module:@ui5/fs.AbstractReader} parameters.dependencies Reader or Collection to read dependency files
70
- * @param {module:@ui5/builder.tasks.TaskUtil|object} [parameters.taskUtil] TaskUtil
70
+ * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
71
71
  * @param {object} parameters.options Options
72
72
  * @param {string} parameters.options.projectName Project name
73
73
  * @param {string} [parameters.options.projectNamespace] Project namespace
@@ -11,7 +11,7 @@ const ModuleName = require("../../../lbt/utils/ModuleName");
11
11
  * @private
12
12
  * @param {object} parameters Parameters
13
13
  * @param {module:@ui5/fs.Resource[]} parameters.resources List of resources
14
- * @param {module:@ui5/builder.tasks.TaskUtil|object} parameters.taskUtil TaskUtil
14
+ * @param {module:@ui5/project.build.helpers.TaskUtil|object} parameters.taskUtil TaskUtil
15
15
  * @returns {object} Module name mapping
16
16
  */
17
17
  module.exports = function({resources, taskUtil}) {
@@ -11,7 +11,7 @@ const manifestCreator = require("../processors/manifestCreator");
11
11
  * @alias module:@ui5/builder.tasks.generateLibraryManifest
12
12
  * @param {object} parameters Parameters
13
13
  * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
14
- * @param {module:@ui5/builder.tasks.TaskUtil|object} [parameters.taskUtil] TaskUtil
14
+ * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
15
15
  * @param {object} parameters.options Options
16
16
  * @param {string} parameters.options.projectName Project name
17
17
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
@@ -97,7 +97,7 @@ function getCreatorOptions(projectName) {
97
97
  * @param {object} parameters Parameters
98
98
  * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
99
99
  * @param {module:@ui5/fs.AbstractReader} parameters.dependencies Reader or Collection to read dependency files
100
- * @param {module:@ui5/builder.tasks.TaskUtil|object} [parameters.taskUtil] TaskUtil
100
+ * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
101
101
  * @param {object} parameters.options Options
102
102
  * @param {string} parameters.options.projectName Project name
103
103
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
@@ -28,7 +28,7 @@ const {resourceFactory} = require("@ui5/fs");
28
28
  * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
29
29
  * @param {module:@ui5/fs.AbstractReader} parameters.dependencies Reader or Collection to read dependency files
30
30
  * @param {GenerateJsdocOptions} parameters.options Options
31
- * @param {module:@ui5/builder.tasks.TaskUtil|object} [parameters.taskUtil] TaskUtil
31
+ * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
32
32
  * @param {object} [parameters.buildContext] Internal, deprecated parameter
33
33
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
34
34
  */
@@ -7,14 +7,14 @@ const minifier = require("../processors/minifier");
7
7
  * @alias module:@ui5/builder.tasks.minify
8
8
  * @param {object} parameters Parameters
9
9
  * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
10
- * @param {module:@ui5/builder.tasks.TaskUtil|object} [parameters.taskUtil] TaskUtil
10
+ * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
11
11
  * @param {object} parameters.options Options
12
12
  * @param {string} parameters.options.pattern Pattern to locate the files to be processed
13
- * @param {boolean} [parameters.options.omitSourceMapResources=true] Whether source map resources shall
13
+ * @param {boolean} [parameters.options.omitSourceMapResources=false] Whether source map resources shall
14
14
  * be tagged as "OmitFromBuildResult" and no sourceMappingURL shall be added to the minified resource
15
15
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
16
16
  */
17
- module.exports = async function({workspace, taskUtil, options: {pattern, omitSourceMapResources = true}}) {
17
+ module.exports = async function({workspace, taskUtil, options: {pattern, omitSourceMapResources = false}}) {
18
18
  const resources = await workspace.byGlob(pattern);
19
19
  const processedResources = await minifier({
20
20
  resources,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "3.0.0-alpha.8",
3
+ "version": "3.0.0-alpha.9",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -125,7 +125,7 @@
125
125
  "yazl": "^2.5.1"
126
126
  },
127
127
  "devDependencies": {
128
- "@ui5/project": "github:SAP/ui5-project#178dedbfe80ab890d134ce12ccb29fc709595a52",
128
+ "@ui5/project": "^3.0.0-alpha.6",
129
129
  "ava": "^3.15.0",
130
130
  "chai": "^4.3.4",
131
131
  "chai-fs": "^2.0.0",
@@ -1,237 +0,0 @@
1
- /**
2
- * Convenience functions for UI5 Builder tasks.
3
- * An instance of this class is passed to every standard UI5 Builder task that requires it.
4
- *
5
- * Custom tasks that define a specification version >= 2.2 will receive an interface
6
- * to an instance of this class when called.
7
- * The set of available functions on that interface depends on the specification
8
- * version defined for the extension.
9
- *
10
- * @public
11
- * @memberof module:@ui5/builder.tasks
12
- */
13
- class TaskUtil {
14
- /**
15
- * Standard Build Tags. See UI5 Tooling
16
- * [RFC 0008]{@link https://github.com/SAP/ui5-tooling/blob/master/rfcs/0008-resource-tagging-during-build.md}
17
- * for details.
18
- *
19
- * @public
20
- * @typedef {object} module:@ui5/builder.tasks.TaskUtil~StandardBuildTags
21
- * @property {string} OmitFromBuildResult
22
- * Setting this tag to true will prevent the resource from being written to the build target directory
23
- * @property {string} IsBundle
24
- * This tag identifies resources that contain (i.e. bundle) multiple other resources
25
- * @property {string} IsDebugVariant
26
- * This tag identifies resources that are a debug variant (typically named with a "-dbg" suffix)
27
- * of another resource. This tag is part of the build manifest.
28
- * @property {string} HasDebugVariant
29
- * This tag identifies resources for which a debug variant has been created.
30
- * This tag is part of the build manifest.
31
- */
32
-
33
- /**
34
- * Since <code>@ui5/builder.builder.ProjectBuildContext</code> is a private class, TaskUtil must not be
35
- * instantiated by modules other than @ui5/builder itself.
36
- *
37
- * @param {object} parameters
38
- * @param {module:@ui5/builder.builder.ProjectBuildContext} parameters.projectBuildContext ProjectBuildContext
39
- * @public
40
- */
41
- constructor({projectBuildContext}) {
42
- this._projectBuildContext = projectBuildContext;
43
- /**
44
- * @member {module:@ui5/builder.tasks.TaskUtil~StandardBuildTags}
45
- * @public
46
- */
47
- this.STANDARD_TAGS = Object.freeze({
48
- // "Project" tags:
49
- // Will be stored on project instance and are hence part of the build manifest
50
- IsDebugVariant: "ui5:IsDebugVariant",
51
- HasDebugVariant: "ui5:HasDebugVariant",
52
-
53
- // "Build" tags:
54
- // Will be stored on the project build context
55
- // They are only available to the build tasks of a single project
56
- OmitFromBuildResult: "ui5:OmitFromBuildResult",
57
- IsBundle: "ui5:IsBundle"
58
- });
59
- }
60
-
61
- /**
62
- * Stores a tag with value for a given resource's path. Note that the tag is independent of the supplied
63
- * resource instance. For two resource instances with the same path, the same tag value is returned.
64
- * If the path of a resource is changed, any tag information previously stored for that resource is lost.
65
- *
66
- * </br></br>
67
- * This method is only available to custom task extensions defining
68
- * <b>Specification Version 2.2 and above</b>.
69
- *
70
- * @param {module:@ui5/fs.Resource} resource Resource-instance the tag should be stored for
71
- * @param {string} tag Name of the tag.
72
- * Currently only the [STANDARD_TAGS]{@link module:@ui5/builder.tasks.TaskUtil#STANDARD_TAGS} are allowed
73
- * @param {string|boolean|integer} [value=true] Tag value. Must be primitive
74
- * @public
75
- */
76
- setTag(resource, tag, value) {
77
- if (typeof resource === "string") {
78
- throw new Error("Deprecated parameter: " +
79
- "Since UI5 Tooling 3.0, #setTag requires a resource instance. Strings are no longer accepted");
80
- }
81
-
82
- const collection = this._projectBuildContext.getResourceTagCollection(resource, tag);
83
- return collection.setTag(resource, tag, value);
84
- }
85
-
86
- /**
87
- * Retrieves the value for a stored tag. If no value is stored, <code>undefined</code> is returned.
88
- *
89
- * </br></br>
90
- * This method is only available to custom task extensions defining
91
- * <b>Specification Version 2.2 and above</b>.
92
- *
93
- * @param {module:@ui5/fs.Resource} resource Resource-instance the tag should be retrieved for
94
- * @param {string} tag Name of the tag
95
- * @returns {string|boolean|integer|undefined} Tag value for the given resource.
96
- * <code>undefined</code> if no value is available
97
- * @public
98
- */
99
- getTag(resource, tag) {
100
- if (typeof resource === "string") {
101
- throw new Error("Deprecated parameter: " +
102
- "Since UI5 Tooling 3.0, #getTag requires a resource instance. Strings are no longer accepted");
103
- }
104
- const collection = this._projectBuildContext.getResourceTagCollection(resource, tag);
105
- return collection.getTag(resource, tag);
106
- }
107
-
108
- /**
109
- * Clears the value of a tag stored for the given resource's path.
110
- * It's like the tag was never set for that resource.
111
- *
112
- * </br></br>
113
- * This method is only available to custom task extensions defining
114
- * <b>Specification Version 2.2 and above</b>.
115
- *
116
- * @param {module:@ui5/fs.Resource} resource Resource-instance the tag should be cleared for
117
- * @param {string} tag Tag
118
- * @public
119
- */
120
- clearTag(resource, tag) {
121
- if (typeof resource === "string") {
122
- throw new Error("Deprecated parameter: " +
123
- "Since UI5 Tooling 3.0, #clearTag requires a resource instance. Strings are no longer accepted");
124
- }
125
- const collection = this._projectBuildContext.getResourceTagCollection(resource, tag);
126
- return collection.clearTag(resource, tag);
127
- }
128
-
129
- /**
130
- * Check whether the project currently being built is the root project.
131
- *
132
- * </br></br>
133
- * This method is only available to custom task extensions defining
134
- * <b>Specification Version 2.2 and above</b>.
135
- *
136
- * @returns {boolean} <code>true</code> if the currently built project is the root project
137
- * @public
138
- */
139
- isRootProject() {
140
- return this._projectBuildContext.isRootProject();
141
- }
142
-
143
- /**
144
- * Retrieves a build option defined by its <code>key</code.
145
- * If no option with the given <code>key</code> is stored, <code>undefined</code> is returned.
146
- *
147
- * @param {string} key The option key
148
- * @returns {any|undefined} The build option (or undefined)
149
- * @private
150
- */
151
- getBuildOption(key) {
152
- return this._projectBuildContext.getOption(key);
153
- }
154
-
155
- /**
156
- * Register a function that must be executed once the build is finished. This can be used to, for example,
157
- * clean up files temporarily created on the file system. If the callback returns a Promise, it will be waited for.
158
- * It will also be executed in cases where the build has failed or has been aborted.
159
- *
160
- * </br></br>
161
- * This method is only available to custom task extensions defining
162
- * <b>Specification Version 2.2 and above</b>.
163
- *
164
- * @param {Function} callback Callback to register. If it returns a Promise, it will be waited for
165
- * @public
166
- */
167
- registerCleanupTask(callback) {
168
- return this._projectBuildContext.registerCleanupTask(callback);
169
- }
170
-
171
- /**
172
- * Retrieve a single project from the dependency graph
173
- *
174
- * </br></br>
175
- * This method is only available to custom task extensions defining
176
- * <b>Specification Version 3.0 and above</b>.
177
- *
178
- * @param {string} projectName Name of the project to retrieve
179
- * @returns {module:@ui5/project.specifications.Project|undefined}
180
- * project instance or undefined if the project is unknown to the graph
181
- * @public
182
- */
183
- getProject(projectName) {
184
- return this._projectBuildContext.getProject(projectName);
185
- }
186
-
187
- /**
188
- * Get an interface to an instance of this class that only provides those functions
189
- * that are supported by the given custom task extension specification version.
190
- *
191
- * @param {string} specVersion Specification version of custom task extension
192
- * @returns {object} An object with bound instance methods supported by the given specification version
193
- */
194
- getInterface(specVersion) {
195
- if (["0.1", "1.0", "1.1", "2.0", "2.1"].includes(specVersion)) {
196
- return undefined;
197
- }
198
-
199
- const baseInterface = {
200
- STANDARD_TAGS: this.STANDARD_TAGS,
201
- };
202
- bindFunctions(this, baseInterface, [
203
- "setTag", "clearTag", "getTag", "isRootProject", "registerCleanupTask"
204
- ]);
205
- switch (specVersion) {
206
- case "2.2":
207
- case "2.3":
208
- case "2.4":
209
- case "2.5":
210
- case "2.6":
211
- return baseInterface;
212
- case "3.0":
213
- baseInterface.getProject = (projectName) => {
214
- const project = this.getProject(projectName);
215
- const baseProjectInterface = {};
216
- bindFunctions(project, baseProjectInterface, [
217
- "getName", "getVersion", "getNamespace"
218
- ]);
219
- switch (specVersion) {
220
- case "3.0":
221
- return baseProjectInterface;
222
- }
223
- };
224
- return baseInterface;
225
- default:
226
- throw new Error(`TaskUtil: Unknown or unsupported Specification Version ${specVersion}`);
227
- }
228
- }
229
- }
230
-
231
- function bindFunctions(sourceObject, targetObject, funcNames) {
232
- funcNames.forEach((funcName) => {
233
- targetObject[funcName] = sourceObject[funcName].bind(sourceObject);
234
- });
235
- }
236
-
237
- module.exports = TaskUtil;