@ui5/builder 2.10.0 → 2.11.3
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 +34 -2
- package/index.js +4 -0
- package/lib/builder/ProjectBuildContext.js +2 -0
- package/lib/lbt/bundle/Builder.js +6 -0
- package/lib/processors/manifestCreator.js +24 -14
- package/lib/tasks/TaskUtil.js +3 -0
- package/lib/tasks/buildThemes.js +6 -2
- package/lib/tasks/bundlers/generateLibraryPreload.js +49 -49
- package/lib/tasks/generateResourcesJson.js +1 -13
- package/lib/types/AbstractBuilder.js +23 -0
- package/lib/types/application/ApplicationBuilder.js +12 -2
- package/lib/types/library/LibraryBuilder.js +11 -3
- package/lib/types/themeLibrary/ThemeLibraryBuilder.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,38 @@
|
|
|
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/v2.
|
|
5
|
+
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v2.11.3...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v2.11.3"></a>
|
|
8
|
+
## [v2.11.3] - 2021-12-12
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
- Enable buildThemes for libraries without .library [`7b941a7`](https://github.com/SAP/ui5-builder/commit/7b941a797210463a9fa8ca50753662c5db373aa6)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<a name="v2.11.2"></a>
|
|
14
|
+
## [v2.11.2] - 2021-11-17
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
- **Builder:** Emit warning on bundleInfo name without extension [`ed0da12`](https://github.com/SAP/ui5-builder/commit/ed0da123ac084d126a28f0f34d9740c310d91902)
|
|
17
|
+
- **manifestCreator:** Trim whitespace/new-lines for sap.app/title [`019cfd7`](https://github.com/SAP/ui5-builder/commit/019cfd7031a2bd63ce93801ad027413151a3b060)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
<a name="v2.11.1"></a>
|
|
21
|
+
## [v2.11.1] - 2021-10-19
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
- Minification excludes for application projects [`7f6fd68`](https://github.com/SAP/ui5-builder/commit/7f6fd68e1aed9131896723f1231816287eaf2fce)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
<a name="v2.11.0"></a>
|
|
27
|
+
## [v2.11.0] - 2021-10-19
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
- **manifestCreator:** supportedThemes should only list relevant themes [`01f3859`](https://github.com/SAP/ui5-builder/commit/01f3859070b6955b9824b0949e633c6d40244633)
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
- Support build minification excludes ([#653](https://github.com/SAP/ui5-builder/issues/653)) [`0aa2301`](https://github.com/SAP/ui5-builder/commit/0aa2301df4c5d40c531da52e2d6314955b95b396)
|
|
33
|
+
|
|
6
34
|
|
|
7
35
|
<a name="v2.10.0"></a>
|
|
8
|
-
## [v2.10.0] - 2021-10-
|
|
36
|
+
## [v2.10.0] - 2021-10-05
|
|
9
37
|
### Features
|
|
10
38
|
- Introduce build task replaceBuildtime [`2ad0960`](https://github.com/SAP/ui5-builder/commit/2ad09603deee3bc26eae36aa36a7a4ac10f83cb0)
|
|
11
39
|
|
|
@@ -611,6 +639,10 @@ to load the custom bundle file instead.
|
|
|
611
639
|
- Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
|
|
612
640
|
|
|
613
641
|
|
|
642
|
+
[v2.11.3]: https://github.com/SAP/ui5-builder/compare/v2.11.2...v2.11.3
|
|
643
|
+
[v2.11.2]: https://github.com/SAP/ui5-builder/compare/v2.11.1...v2.11.2
|
|
644
|
+
[v2.11.1]: https://github.com/SAP/ui5-builder/compare/v2.11.0...v2.11.1
|
|
645
|
+
[v2.11.0]: https://github.com/SAP/ui5-builder/compare/v2.10.0...v2.11.0
|
|
614
646
|
[v2.10.0]: https://github.com/SAP/ui5-builder/compare/v2.9.5...v2.10.0
|
|
615
647
|
[v2.9.5]: https://github.com/SAP/ui5-builder/compare/v2.9.4...v2.9.5
|
|
616
648
|
[v2.9.4]: https://github.com/SAP/ui5-builder/compare/v2.9.3...v2.9.4
|
package/index.js
CHANGED
|
@@ -49,6 +49,10 @@ module.exports = {
|
|
|
49
49
|
* @type {import('./lib/processors/libraryLessGenerator')}
|
|
50
50
|
*/
|
|
51
51
|
libraryLessGenerator: "./lib/processors/libraryLessGenerator",
|
|
52
|
+
/**
|
|
53
|
+
* @type {import('./lib/processors/manifestCreator')}
|
|
54
|
+
*/
|
|
55
|
+
manifestCreator: "./lib/processors/manifestCreator",
|
|
52
56
|
/**
|
|
53
57
|
* @type {import('./lib/processors/resourceCopier')}
|
|
54
58
|
*/
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const ResourceTagCollection = require("@ui5/fs").ResourceTagCollection;
|
|
2
2
|
|
|
3
|
+
// Note: When adding standard tags, always update the public documentation in TaskUtil
|
|
4
|
+
// (Type "module:@ui5/builder.tasks.TaskUtil~StandardBuildTags")
|
|
3
5
|
const STANDARD_TAGS = Object.freeze({
|
|
4
6
|
OmitFromBuildResult: "ui5:OmitFromBuildResult",
|
|
5
7
|
IsBundle: "ui5:IsBundle"
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// for consistency of write calls, we generally allow template literals
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
|
+
const path = require("path");
|
|
5
6
|
const terser = require("terser");
|
|
6
7
|
const {pd} = require("pretty-data");
|
|
7
8
|
const {parseJS, Syntax} = require("../utils/parseUtils");
|
|
@@ -486,6 +487,11 @@ class BundleBuilder {
|
|
|
486
487
|
if (!section.name) {
|
|
487
488
|
throw new Error(`A 'bundleInfo' section is missing the mandatory 'name' property.` );
|
|
488
489
|
}
|
|
490
|
+
if (!path.extname(section.name)) {
|
|
491
|
+
log.warn(`bundleInfo section name '${section.name}' is missing a file extension. ` +
|
|
492
|
+
`The info might not work as expected. ` +
|
|
493
|
+
`The name must match the bundle filename (incl. extension such as '.js')`);
|
|
494
|
+
}
|
|
489
495
|
this.outW.write(`"${section.name}":[${section.modules.map(makeStringLiteral).join(",")}]`);
|
|
490
496
|
});
|
|
491
497
|
this.outW.writeln();
|
|
@@ -157,10 +157,12 @@ class LibraryBundle {
|
|
|
157
157
|
/*
|
|
158
158
|
* Creates the library manifest.json file for a UILibrary.
|
|
159
159
|
*/
|
|
160
|
-
async function createManifest(libraryResource, libBundle, descriptorVersion, _include3rdParty) {
|
|
160
|
+
async function createManifest(libraryResource, libBundle, descriptorVersion, _include3rdParty, omitMinVersions) {
|
|
161
161
|
// create a Library wrapper around the .library XML
|
|
162
162
|
const library = await Library.from(libraryResource);
|
|
163
163
|
|
|
164
|
+
const libraryPathPrefix = posixPath.dirname(libraryResource.getPath()) + "/";
|
|
165
|
+
|
|
164
166
|
// collect information from library.js file
|
|
165
167
|
const libraryJSInfo = await analyzeLibraryJS(libBundle.findResource("library.js"));
|
|
166
168
|
const includeSupportedLocalesInformation = descriptorVersion.compare(APP_DESCRIPTOR_V22) >= 0;
|
|
@@ -183,7 +185,7 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
|
|
|
183
185
|
}
|
|
184
186
|
|
|
185
187
|
function createSapApp() {
|
|
186
|
-
function hasManifest(componentPath
|
|
188
|
+
function hasManifest(componentPath) {
|
|
187
189
|
const manifestPath = componentPath + "/manifest.json";
|
|
188
190
|
|
|
189
191
|
const manifestResource = libBundle.findResource(manifestPath.substring(libraryPathPrefix.length));
|
|
@@ -196,17 +198,19 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
|
|
|
196
198
|
|
|
197
199
|
function findEmbeddedComponents() {
|
|
198
200
|
const result = [];
|
|
199
|
-
const prefix = posixPath.dirname(libraryResource.getPath()) + "/";
|
|
200
201
|
const components = libBundle.getResources(/^\/(?:[^/]+\/)*Component\.js$/);
|
|
201
202
|
for (const comp of components) {
|
|
202
203
|
const componentPath = posixPath.dirname(comp.getPath());
|
|
203
204
|
log.verbose("checking component at %s", componentPath);
|
|
204
|
-
if ( componentPath.startsWith(
|
|
205
|
-
result.push( componentPath.substring(
|
|
206
|
-
} else if (
|
|
205
|
+
if ( componentPath.startsWith(libraryPathPrefix) && hasManifest(componentPath) ) {
|
|
206
|
+
result.push( componentPath.substring(libraryPathPrefix.length) );
|
|
207
|
+
} else if ( libraryPathPrefix === "/resources/sap/apf/" ) {
|
|
207
208
|
log.verbose("Package %s contains both '*.library' and 'Component.js'. " +
|
|
208
209
|
"This is a known issue but can't be solved due to backward compatibility.", componentPath);
|
|
209
|
-
} else if (
|
|
210
|
+
} else if (
|
|
211
|
+
libraryPathPrefix === (componentPath + "/") &&
|
|
212
|
+
libraryPathPrefix !== "/resources/sap/ui/core/"
|
|
213
|
+
) {
|
|
210
214
|
log.error("Package %s contains both '*.library' and 'Component.js'. " +
|
|
211
215
|
"This is not supported by manifests, therefore the component won't be " +
|
|
212
216
|
"listed in the library's manifest.", componentPath);
|
|
@@ -233,7 +237,7 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
|
|
|
233
237
|
if ( library.getDocumentation() ) {
|
|
234
238
|
let desc = library.getDocumentation();
|
|
235
239
|
// remove all tags
|
|
236
|
-
desc = desc.replace(
|
|
240
|
+
desc = desc.replace(/\s+/g, " ").replace(/<\/?[a-zA-Z][a-zA-Z0-9_$.]*(\s[^>]*)>/g, "");
|
|
237
241
|
// extract summary (first sentence)
|
|
238
242
|
const m = /^([\w\W]+?[.;!?])[^a-zA-Z0-9_$]/.exec(desc);
|
|
239
243
|
return m ? m[1] : desc;
|
|
@@ -353,13 +357,17 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
|
|
|
353
357
|
|
|
354
358
|
// find theme resources and determine theme names from their paths
|
|
355
359
|
libBundle.getResources(/(?:[^/]+\/)*themes\//).forEach((res) => {
|
|
360
|
+
if ( !res.getPath().startsWith(libraryPathPrefix + "themes/") ) {
|
|
361
|
+
// only consider themes within direct "themes" sub-directory
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
356
364
|
const match = /\/themes\/([^/]+)\//.exec(res.getPath());
|
|
357
365
|
if ( match ) {
|
|
358
366
|
themes[match[1]] = true;
|
|
359
367
|
}
|
|
360
368
|
});
|
|
361
369
|
|
|
362
|
-
// merge with
|
|
370
|
+
// merge with supportedTheme info from .library file
|
|
363
371
|
const elems = findChildren(manifestAppData, "supportedTheme");
|
|
364
372
|
if ( elems ) {
|
|
365
373
|
elems.forEach((elem) => {
|
|
@@ -395,14 +403,14 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
|
|
|
395
403
|
|
|
396
404
|
function dependencies() {
|
|
397
405
|
const dependencies = {
|
|
398
|
-
minUI5Version: getUI5Version(),
|
|
406
|
+
minUI5Version: omitMinVersions ? "" : getUI5Version(),
|
|
399
407
|
libs: {
|
|
400
408
|
}
|
|
401
409
|
};
|
|
402
410
|
if ( library.getDependencies() != null ) {
|
|
403
411
|
for (const dep of library.getDependencies()) {
|
|
404
412
|
dependencies.libs[dep.getLibraryName()] = {
|
|
405
|
-
minVersion: getVersion(dep),
|
|
413
|
+
minVersion: omitMinVersions ? "" : getVersion(dep),
|
|
406
414
|
lazy: dep.isLazy() || undefined // suppress default (false)
|
|
407
415
|
};
|
|
408
416
|
}
|
|
@@ -652,9 +660,10 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
|
|
|
652
660
|
module.exports = function({libraryResource, resources, options}) {
|
|
653
661
|
// merge options with defaults
|
|
654
662
|
options = Object.assign({
|
|
655
|
-
descriptorVersion: APP_DESCRIPTOR_V22, // TODO change this to type string instead of a semver object
|
|
663
|
+
descriptorVersion: APP_DESCRIPTOR_V22, // TODO 3.0: change this to type string instead of a semver object
|
|
656
664
|
include3rdParty: true,
|
|
657
|
-
prettyPrint: true
|
|
665
|
+
prettyPrint: true,
|
|
666
|
+
omitMinVersions: false
|
|
658
667
|
}, options);
|
|
659
668
|
|
|
660
669
|
const resourcePathPrefix = libraryResource.getPath().slice(0, -".library".length);
|
|
@@ -667,7 +676,8 @@ module.exports = function({libraryResource, resources, options}) {
|
|
|
667
676
|
return Promise.resolve(null); // a fulfillment of null indicates that no manifest has been created
|
|
668
677
|
}
|
|
669
678
|
|
|
670
|
-
return createManifest(libraryResource, libBundle, options.descriptorVersion, options.include3rdParty
|
|
679
|
+
return createManifest(libraryResource, libBundle, options.descriptorVersion, options.include3rdParty,
|
|
680
|
+
options.omitMinVersions)
|
|
671
681
|
.then((manifest) => {
|
|
672
682
|
return new EvoResource({
|
|
673
683
|
path: resourcePathPrefix + "manifest.json",
|
package/lib/tasks/TaskUtil.js
CHANGED
|
@@ -20,6 +20,8 @@ class TaskUtil {
|
|
|
20
20
|
* @typedef {object} module:@ui5/builder.tasks.TaskUtil~StandardBuildTags
|
|
21
21
|
* @property {string} OmitFromBuildResult
|
|
22
22
|
* Setting this tag to true for a resource will prevent it from being written to the build target
|
|
23
|
+
* @property {string} IsBundle
|
|
24
|
+
* This tag identifies resources that contain (i.e. bundle) multiple other resources
|
|
23
25
|
*/
|
|
24
26
|
|
|
25
27
|
/**
|
|
@@ -147,6 +149,7 @@ class TaskUtil {
|
|
|
147
149
|
case "2.3":
|
|
148
150
|
case "2.4":
|
|
149
151
|
case "2.5":
|
|
152
|
+
case "2.6":
|
|
150
153
|
return baseInterface;
|
|
151
154
|
default:
|
|
152
155
|
throw new Error(`TaskUtil: Unknown or unsupported Specification Version ${specVersion}`);
|
package/lib/tasks/buildThemes.js
CHANGED
|
@@ -54,8 +54,12 @@ module.exports = async function({
|
|
|
54
54
|
*/
|
|
55
55
|
let availableLibraries;
|
|
56
56
|
if (pAvailableLibraries) {
|
|
57
|
-
availableLibraries =
|
|
58
|
-
|
|
57
|
+
availableLibraries = [];
|
|
58
|
+
(await pAvailableLibraries).forEach((resource) => {
|
|
59
|
+
const library = path.dirname(resource.getPath());
|
|
60
|
+
if (!availableLibraries.includes(library)) {
|
|
61
|
+
availableLibraries.push(library);
|
|
62
|
+
}
|
|
59
63
|
});
|
|
60
64
|
}
|
|
61
65
|
let availableThemes;
|
|
@@ -280,59 +280,59 @@ module.exports = function({workspace, dependencies, taskUtil, options: {projectN
|
|
|
280
280
|
return combo.byGlob("/**/*.{js,json,xml,html,properties,library}").then((resources) => {
|
|
281
281
|
// Find all libraries and create a library-preload.js bundle
|
|
282
282
|
|
|
283
|
-
let p;
|
|
283
|
+
let p = Promise.resolve();
|
|
284
284
|
|
|
285
|
-
// Create
|
|
286
|
-
//
|
|
285
|
+
// Create core bundles for older versions (<1.97.0) which don't define bundle configuration in the ui5.yaml
|
|
286
|
+
// See: https://github.com/SAP/openui5/commit/ff127fd2d009162ea43ad312dec99d759ebc23a0
|
|
287
287
|
if (projectName === "sap.ui.core") {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
filters
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
moduleBundler({
|
|
310
|
-
options: getModuleBundlerOptions({name: "sap-ui-core-dbg.js", filters, preload: false}),
|
|
311
|
-
resources
|
|
312
|
-
}),
|
|
313
|
-
moduleBundler({
|
|
314
|
-
options: getModuleBundlerOptions({
|
|
315
|
-
name: "sap-ui-core-nojQuery.js", filters, preload: true, provided: true
|
|
288
|
+
const coreProject = resources[0]._project;
|
|
289
|
+
const coreSpecVersion = coreProject && coreProject.specVersion;
|
|
290
|
+
// Instead of checking the sap.ui.core library version, the specVersion is checked against all versions
|
|
291
|
+
// that have been defined for sap.ui.core before the bundle configuration has been introduced.
|
|
292
|
+
// This is mainly to have an easier check without version parsing or using semver.
|
|
293
|
+
// If no project/specVersion is available, the bundles should also be created to not break potential
|
|
294
|
+
// existing use cases without a properly formed/formatted project tree.
|
|
295
|
+
if (!coreSpecVersion || ["0.1", "1.1", "2.0"].includes(coreSpecVersion)) {
|
|
296
|
+
const isEvo = resources.find((resource) => {
|
|
297
|
+
return resource.getPath() === "/resources/ui5loader.js";
|
|
298
|
+
});
|
|
299
|
+
let filters;
|
|
300
|
+
if (isEvo) {
|
|
301
|
+
filters = ["ui5loader-autoconfig.js"];
|
|
302
|
+
} else {
|
|
303
|
+
filters = ["jquery.sap.global.js"];
|
|
304
|
+
}
|
|
305
|
+
p = Promise.all([
|
|
306
|
+
moduleBundler({
|
|
307
|
+
options: getModuleBundlerOptions({name: "sap-ui-core.js", filters, preload: true}),
|
|
308
|
+
resources
|
|
316
309
|
}),
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
options: getModuleBundlerOptions({
|
|
321
|
-
name: "sap-ui-core-nojQuery-dbg.js", filters, preload: false, provided: true
|
|
310
|
+
moduleBundler({
|
|
311
|
+
options: getModuleBundlerOptions({name: "sap-ui-core-dbg.js", filters, preload: false}),
|
|
312
|
+
resources
|
|
322
313
|
}),
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
314
|
+
moduleBundler({
|
|
315
|
+
options: getModuleBundlerOptions({
|
|
316
|
+
name: "sap-ui-core-nojQuery.js", filters, preload: true, provided: true
|
|
317
|
+
}),
|
|
318
|
+
resources
|
|
319
|
+
}),
|
|
320
|
+
moduleBundler({
|
|
321
|
+
options: getModuleBundlerOptions({
|
|
322
|
+
name: "sap-ui-core-nojQuery-dbg.js", filters, preload: false, provided: true
|
|
323
|
+
}),
|
|
324
|
+
resources
|
|
325
|
+
}),
|
|
326
|
+
]).then((results) => {
|
|
327
|
+
const bundles = Array.prototype.concat.apply([], results);
|
|
328
|
+
return Promise.all(bundles.map((bundle) => {
|
|
329
|
+
if (taskUtil) {
|
|
330
|
+
taskUtil.setTag(bundle, taskUtil.STANDARD_TAGS.IsBundle);
|
|
331
|
+
}
|
|
332
|
+
return workspace.write(bundle);
|
|
333
|
+
}));
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
return p.then(() => {
|
|
@@ -24,19 +24,7 @@ function getCreatorOptions(projectName) {
|
|
|
24
24
|
"sap/base/",
|
|
25
25
|
"sap/ui/"
|
|
26
26
|
]
|
|
27
|
-
}
|
|
28
|
-
mergedResourcesFilters: [
|
|
29
|
-
"jquery-sap*.js",
|
|
30
|
-
"sap-ui-core*.js",
|
|
31
|
-
"**/Component-preload.js",
|
|
32
|
-
"**/library-preload.js",
|
|
33
|
-
"**/library-preload-dbg.js",
|
|
34
|
-
"**/library-preload.json",
|
|
35
|
-
"**/library-all.js",
|
|
36
|
-
"**/library-all-dbg.js",
|
|
37
|
-
"**/designtime/library-preload.designtime.js",
|
|
38
|
-
"**/library-preload.support.js"
|
|
39
|
-
]
|
|
27
|
+
}
|
|
40
28
|
});
|
|
41
29
|
} else if ( projectName === "sap.ui.integration" ) {
|
|
42
30
|
Object.assign(creatorOptions, {
|
|
@@ -242,6 +242,29 @@ class AbstractBuilder {
|
|
|
242
242
|
return taskFunction().then(() => this.taskLog.completeWork(1));
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Appends the list of 'excludes' to the list of 'patterns'. To harmonize both lists, the 'excludes'
|
|
248
|
+
* are negated and the 'patternPrefix' is added to make them absolute.
|
|
249
|
+
*
|
|
250
|
+
* @private
|
|
251
|
+
* @param {string[]} patterns
|
|
252
|
+
* List of absolute default patterns.
|
|
253
|
+
* @param {string[]} excludes
|
|
254
|
+
* List of relative patterns to be excluded. Excludes with a leading "!" are meant to be re-included.
|
|
255
|
+
* @param {string} patternPrefix
|
|
256
|
+
* Prefix to be added to the excludes to make them absolute. The prefix must have a leading and a
|
|
257
|
+
* trailing "/".
|
|
258
|
+
*/
|
|
259
|
+
enhancePatternWithExcludes(patterns, excludes, patternPrefix) {
|
|
260
|
+
excludes.forEach((exclude) => {
|
|
261
|
+
if (exclude.startsWith("!")) {
|
|
262
|
+
patterns.push(`${patternPrefix}${exclude.slice(1)}`);
|
|
263
|
+
} else {
|
|
264
|
+
patterns.push(`!${patternPrefix}${exclude}`);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
245
268
|
}
|
|
246
269
|
|
|
247
270
|
module.exports = AbstractBuilder;
|
|
@@ -138,12 +138,22 @@ class ApplicationBuilder extends AbstractBuilder {
|
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
const minificationPattern = ["/**/*.js"];
|
|
142
|
+
if (["2.6"].includes(project.specVersion)) {
|
|
143
|
+
const minificationExcludes = project.builder && project.builder.minification &&
|
|
144
|
+
project.builder.minification.excludes;
|
|
145
|
+
if (minificationExcludes) {
|
|
146
|
+
// TODO 3.0: namespaces should become mandatory, see existing check above
|
|
147
|
+
const patternPrefix = project.metadata.namespace ? "/resources/" : "/";
|
|
148
|
+
this.enhancePatternWithExcludes(minificationPattern, minificationExcludes, patternPrefix);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
141
151
|
this.addTask("createDebugFiles", async () => {
|
|
142
152
|
const createDebugFiles = getTask("createDebugFiles").task;
|
|
143
153
|
return createDebugFiles({
|
|
144
154
|
workspace: resourceCollections.workspace,
|
|
145
155
|
options: {
|
|
146
|
-
pattern:
|
|
156
|
+
pattern: minificationPattern
|
|
147
157
|
}
|
|
148
158
|
});
|
|
149
159
|
});
|
|
@@ -154,7 +164,7 @@ class ApplicationBuilder extends AbstractBuilder {
|
|
|
154
164
|
workspace: resourceCollections.workspace,
|
|
155
165
|
taskUtil,
|
|
156
166
|
options: {
|
|
157
|
-
pattern:
|
|
167
|
+
pattern: minificationPattern
|
|
158
168
|
}
|
|
159
169
|
});
|
|
160
170
|
});
|
|
@@ -176,7 +176,7 @@ class LibraryBuilder extends AbstractBuilder {
|
|
|
176
176
|
dependencies: resourceCollections.dependencies,
|
|
177
177
|
options: {
|
|
178
178
|
projectName: project.metadata.name,
|
|
179
|
-
librariesPattern: !taskUtil.isRootProject() ? "/resources
|
|
179
|
+
librariesPattern: !taskUtil.isRootProject() ? "/resources/**/(*.library|library.js)" : undefined,
|
|
180
180
|
themesPattern: !taskUtil.isRootProject() ? "/resources/sap/ui/core/themes/*" : undefined,
|
|
181
181
|
inputPattern
|
|
182
182
|
}
|
|
@@ -195,11 +195,19 @@ class LibraryBuilder extends AbstractBuilder {
|
|
|
195
195
|
});
|
|
196
196
|
});
|
|
197
197
|
|
|
198
|
+
const minificationPattern = ["/resources/**/*.js"];
|
|
199
|
+
if (["2.6"].includes(project.specVersion)) {
|
|
200
|
+
const minificationExcludes = project.builder && project.builder.minification &&
|
|
201
|
+
project.builder.minification.excludes;
|
|
202
|
+
if (minificationExcludes) {
|
|
203
|
+
this.enhancePatternWithExcludes(minificationPattern, minificationExcludes, "/resources/");
|
|
204
|
+
}
|
|
205
|
+
}
|
|
198
206
|
this.addTask("createDebugFiles", async () => {
|
|
199
207
|
return getTask("createDebugFiles").task({
|
|
200
208
|
workspace: resourceCollections.workspace,
|
|
201
209
|
options: {
|
|
202
|
-
pattern:
|
|
210
|
+
pattern: minificationPattern
|
|
203
211
|
}
|
|
204
212
|
});
|
|
205
213
|
});
|
|
@@ -209,7 +217,7 @@ class LibraryBuilder extends AbstractBuilder {
|
|
|
209
217
|
workspace: resourceCollections.workspace,
|
|
210
218
|
taskUtil,
|
|
211
219
|
options: {
|
|
212
|
-
pattern:
|
|
220
|
+
pattern: minificationPattern
|
|
213
221
|
}
|
|
214
222
|
});
|
|
215
223
|
});
|
|
@@ -29,7 +29,7 @@ class ThemeLibraryBuilder extends AbstractBuilder {
|
|
|
29
29
|
dependencies: resourceCollections.dependencies,
|
|
30
30
|
options: {
|
|
31
31
|
projectName: project.metadata.name,
|
|
32
|
-
librariesPattern: !taskUtil.isRootProject() ? "/resources
|
|
32
|
+
librariesPattern: !taskUtil.isRootProject() ? "/resources/**/(*.library|library.js)" : undefined,
|
|
33
33
|
themesPattern: !taskUtil.isRootProject() ? "/resources/sap/ui/core/themes/*" : undefined,
|
|
34
34
|
inputPattern: "/resources/**/themes/*/library.source.less"
|
|
35
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/builder",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.3",
|
|
4
4
|
"description": "UI5 Tooling - Builder",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SAP SE",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"replacestream": "^4.0.3",
|
|
121
121
|
"rimraf": "^3.0.2",
|
|
122
122
|
"semver": "^7.3.5",
|
|
123
|
-
"terser": "^5.
|
|
123
|
+
"terser": "^5.10.0",
|
|
124
124
|
"xml2js": "^0.4.23",
|
|
125
125
|
"yazl": "^2.5.1"
|
|
126
126
|
},
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"docdash": "^1.2.0",
|
|
135
135
|
"eslint": "^7.32.0",
|
|
136
136
|
"eslint-config-google": "^0.14.0",
|
|
137
|
-
"eslint-plugin-jsdoc": "^
|
|
137
|
+
"eslint-plugin-jsdoc": "^37.2.0",
|
|
138
138
|
"extract-zip": "^2.0.1",
|
|
139
139
|
"mock-require": "^3.0.3",
|
|
140
140
|
"nyc": "^15.1.0",
|