@ui5/builder 4.1.0 → 4.1.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.
- package/CHANGELOG.md +10 -2
- package/CONTRIBUTING.md +1 -1
- package/README.md +2 -2
- package/lib/lbt/bundle/Resolver.js +2 -1
- package/lib/processors/manifestCreator.js +8 -1
- package/lib/processors/manifestEnhancer.js +6 -0
- package/lib/tasks/bundlers/generateLibraryPreload.js +202 -36
- package/package.json +6 -6
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/v4.1.
|
|
5
|
+
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v4.1.2...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v4.1.2"></a>
|
|
8
|
+
## [v4.1.2] - 2025-11-13
|
|
9
|
+
|
|
10
|
+
<a name="v4.1.1"></a>
|
|
11
|
+
## [v4.1.1] - 2025-10-30
|
|
6
12
|
|
|
7
13
|
<a name="v4.1.0"></a>
|
|
8
|
-
## [v4.1.0] - 2025-10-
|
|
14
|
+
## [v4.1.0] - 2025-10-23
|
|
9
15
|
### Features
|
|
10
16
|
- Enhance generateFlexChangeBundle task to add new 'flexBundle' property to the manifest.json ([#1164](https://github.com/SAP/ui5-builder/issues/1164)) [`a48e474`](https://github.com/SAP/ui5-builder/commit/a48e474b1bfb9f2f11da44e908341af370711309)
|
|
11
17
|
|
|
@@ -998,6 +1004,8 @@ to load the custom bundle file instead.
|
|
|
998
1004
|
|
|
999
1005
|
### Features
|
|
1000
1006
|
- Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
|
|
1007
|
+
[v4.1.2]: https://github.com/SAP/ui5-builder/compare/v4.1.1...v4.1.2
|
|
1008
|
+
[v4.1.1]: https://github.com/SAP/ui5-builder/compare/v4.1.0...v4.1.1
|
|
1001
1009
|
[v4.1.0]: https://github.com/SAP/ui5-builder/compare/v4.0.13...v4.1.0
|
|
1002
1010
|
[v4.0.13]: https://github.com/SAP/ui5-builder/compare/v4.0.11...v4.0.13
|
|
1003
1011
|
[v4.0.11]: https://github.com/SAP/ui5-builder/compare/v4.0.10...v4.0.11
|
package/CONTRIBUTING.md
CHANGED
package/README.md
CHANGED
|
@@ -24,10 +24,10 @@ UI5 Builder documentation can be found here: [ui5.github.io/cli](https://ui5.git
|
|
|
24
24
|
The UI5 Builder API Reference can be found here: [`@ui5/builder`](https://ui5.github.io/cli/v4/api/)
|
|
25
25
|
|
|
26
26
|
## Contributing
|
|
27
|
-
Please check our [Contribution Guidelines](https://github.com/UI5/cli/blob/
|
|
27
|
+
Please check our [Contribution Guidelines](https://github.com/UI5/cli/blob/v4/CONTRIBUTING.md).
|
|
28
28
|
|
|
29
29
|
## Support
|
|
30
|
-
Please follow our [Contribution Guidelines](https://github.com/UI5/cli/blob/
|
|
30
|
+
Please follow our [Contribution Guidelines](https://github.com/UI5/cli/blob/v4/CONTRIBUTING.md#report-an-issue) on how to report an issue.
|
|
31
31
|
|
|
32
32
|
Please report issues in the main [UI5 CLI](https://github.com/UI5/cli) repository.
|
|
33
33
|
|
|
@@ -56,6 +56,7 @@ class BundleResolver {
|
|
|
56
56
|
* in the resource pool.
|
|
57
57
|
*/
|
|
58
58
|
const missingModules = Object.create(null);
|
|
59
|
+
const ignoreMissingModules = pool.getIgnoreMissingModules();
|
|
59
60
|
/**
|
|
60
61
|
* Names of modules that are included in non-decomposable bundles.
|
|
61
62
|
* If they occur in the missingModules, then this is not an error.
|
|
@@ -123,7 +124,7 @@ class BundleResolver {
|
|
|
123
124
|
done = pool.findResourceWithInfo(resourceName)
|
|
124
125
|
.catch( (err) => {
|
|
125
126
|
// if the caller provided an error message, log it
|
|
126
|
-
if ( msg ) {
|
|
127
|
+
if ( msg && !ignoreMissingModules ) {
|
|
127
128
|
missingModules[resourceName] ??= [];
|
|
128
129
|
missingModules[resourceName].push(msg);
|
|
129
130
|
}
|
|
@@ -491,11 +491,18 @@ async function createManifest(
|
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
|
|
494
|
-
|
|
494
|
+
const libraryMetadata = {
|
|
495
495
|
i18n: i18n(),
|
|
496
496
|
css: css(),
|
|
497
497
|
content: content()
|
|
498
498
|
};
|
|
499
|
+
|
|
500
|
+
if (process.env.UI5_CLI_EXPERIMENTAL_BUNDLE_INFO_PRELOAD) {
|
|
501
|
+
// Add flag indicating that the (currently experimental) bundleVersion 2 preload bundling is used
|
|
502
|
+
libraryMetadata.bundleVersion = 2;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
return libraryMetadata;
|
|
499
506
|
}
|
|
500
507
|
|
|
501
508
|
const sapUI5 = {
|
|
@@ -441,6 +441,12 @@ class ManifestEnhancer {
|
|
|
441
441
|
|
|
442
442
|
if (this.manifest["sap.app"].type === "library") {
|
|
443
443
|
await this.processSapUi5LibraryI18n();
|
|
444
|
+
|
|
445
|
+
if (process.env.UI5_CLI_EXPERIMENTAL_BUNDLE_INFO_PRELOAD) {
|
|
446
|
+
// Add flag indicating that the (currently experimental) bundleVersion 2 preload bundling is used
|
|
447
|
+
this.manifest["sap.ui5"].library ??= {};
|
|
448
|
+
this.manifest["sap.ui5"].library.bundleVersion = 2;
|
|
449
|
+
}
|
|
444
450
|
} else {
|
|
445
451
|
await Promise.all([
|
|
446
452
|
this.processSapAppI18n(),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import semver from "semver";
|
|
1
2
|
import {getLogger} from "@ui5/logger";
|
|
2
3
|
const log = getLogger("builder:tasks:bundlers:generateLibraryPreload");
|
|
3
4
|
import moduleBundler from "../../processors/bundlers/moduleBundler.js";
|
|
@@ -32,6 +33,32 @@ function getDefaultLibraryPreloadFilters(namespace, excludes) {
|
|
|
32
33
|
return filters;
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
function getExperimentalDefaultLibraryPreloadFilters(namespace, excludes) {
|
|
37
|
+
const filters = [
|
|
38
|
+
`${namespace}/library.js`,
|
|
39
|
+
`!${namespace}/**/*-preload.js`, // exclude all bundles
|
|
40
|
+
`!${namespace}/designtime/`,
|
|
41
|
+
`!${namespace}/**/*.designtime.js`,
|
|
42
|
+
`!${namespace}/**/*.support.js`
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
if (Array.isArray(excludes)) {
|
|
46
|
+
const allFilterExcludes = negateFilters(excludes);
|
|
47
|
+
// Add configured excludes at the end of filter list
|
|
48
|
+
allFilterExcludes.forEach((filterExclude) => {
|
|
49
|
+
// Allow all excludes (!) and limit re-includes (+) to the library namespace
|
|
50
|
+
if (filterExclude.startsWith("!") || filterExclude.startsWith(`+${namespace}/`)) {
|
|
51
|
+
filters.push(filterExclude);
|
|
52
|
+
} else {
|
|
53
|
+
log.warn(`Configured preload exclude contains invalid re-include: !${filterExclude.substr(1)}. ` +
|
|
54
|
+
`Re-includes must start with the library's namespace ${namespace}`);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return filters;
|
|
60
|
+
}
|
|
61
|
+
|
|
35
62
|
function getBundleDefinition(namespace, excludes) {
|
|
36
63
|
// Note: This configuration is only used when no bundle definition in ui5.yaml exists (see "skipBundles" parameter)
|
|
37
64
|
|
|
@@ -106,6 +133,69 @@ function getBundleDefinition(namespace, excludes) {
|
|
|
106
133
|
};
|
|
107
134
|
}
|
|
108
135
|
|
|
136
|
+
function getBundleInfoPreloadDefinition(namespace, excludes, coreVersion) {
|
|
137
|
+
const sections = [{
|
|
138
|
+
mode: "preload",
|
|
139
|
+
filters: getExperimentalDefaultLibraryPreloadFilters(namespace, excludes),
|
|
140
|
+
resolve: true
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
mode: "bundleInfo",
|
|
144
|
+
name: `${namespace}/_library-content.js`,
|
|
145
|
+
filters: getDefaultLibraryPreloadFilters(namespace, excludes),
|
|
146
|
+
resolve: false,
|
|
147
|
+
resolveConditional: false,
|
|
148
|
+
renderer: true
|
|
149
|
+
}];
|
|
150
|
+
|
|
151
|
+
if (coreVersion) {
|
|
152
|
+
const parsedVersion = semver.parse(coreVersion);
|
|
153
|
+
let targetUi5CoreVersionMajor = parsedVersion.major;
|
|
154
|
+
|
|
155
|
+
// legacy-free versions include changes of the upcoming major version
|
|
156
|
+
// so we should treat them the same as the next major version
|
|
157
|
+
if (
|
|
158
|
+
parsedVersion.prerelease.includes("legacy-free") ||
|
|
159
|
+
parsedVersion.prerelease.includes("legacy-free-SNAPSHOT") // Maven snapshot version
|
|
160
|
+
) {
|
|
161
|
+
targetUi5CoreVersionMajor += 1;
|
|
162
|
+
}
|
|
163
|
+
if (parsedVersion) {
|
|
164
|
+
if (targetUi5CoreVersionMajor >= 2) {
|
|
165
|
+
// Do not include manifest.json in UI5 2.x and higher to allow for loading it upfront for all libraries
|
|
166
|
+
sections.unshift({
|
|
167
|
+
mode: "provided",
|
|
168
|
+
filters: [
|
|
169
|
+
`${namespace}/manifest.json`,
|
|
170
|
+
]
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return {
|
|
177
|
+
name: `${namespace}/library-preload.js`,
|
|
178
|
+
sections,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function getContentBundleDefinition(namespace, excludes) {
|
|
183
|
+
return {
|
|
184
|
+
name: `${namespace}/_library-content.js`,
|
|
185
|
+
sections: [{
|
|
186
|
+
mode: "provided",
|
|
187
|
+
filters: getExperimentalDefaultLibraryPreloadFilters(namespace, excludes),
|
|
188
|
+
resolve: true
|
|
189
|
+
}, {
|
|
190
|
+
mode: "preload",
|
|
191
|
+
filters: getDefaultLibraryPreloadFilters(namespace, excludes),
|
|
192
|
+
resolve: false,
|
|
193
|
+
resolveConditional: false,
|
|
194
|
+
renderer: true
|
|
195
|
+
}]
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
109
199
|
function getDesigntimeBundleDefinition(namespace) {
|
|
110
200
|
return {
|
|
111
201
|
name: `${namespace}/designtime/library-preload.designtime.js`,
|
|
@@ -258,6 +348,7 @@ export default async function({workspace, taskUtil, options: {skipBundles = [],
|
|
|
258
348
|
}
|
|
259
349
|
const coreVersion = taskUtil?.getProject("sap.ui.core")?.getVersion();
|
|
260
350
|
const allowStringBundling = taskUtil?.getProject().getSpecVersion().lt("4.0");
|
|
351
|
+
const createBundleInfoPreload = !!process.env.UI5_CLI_EXPERIMENTAL_BUNDLE_INFO_PRELOAD;
|
|
261
352
|
const execModuleBundlerIfNeeded = ({options, resources}) => {
|
|
262
353
|
if (skipBundles.includes(options.bundleDefinition.name)) {
|
|
263
354
|
log.verbose(`Skipping generation of bundle ${options.bundleDefinition.name}`);
|
|
@@ -390,42 +481,117 @@ export default async function({workspace, taskUtil, options: {skipBundles = [],
|
|
|
390
481
|
const libraryNamespaceMatch = libraryIndicatorPath.match(libraryNamespacePattern);
|
|
391
482
|
if (libraryNamespaceMatch && libraryNamespaceMatch[1]) {
|
|
392
483
|
const libraryNamespace = libraryNamespaceMatch[1];
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
484
|
+
let results;
|
|
485
|
+
if (!createBundleInfoPreload) {
|
|
486
|
+
// Regular bundling
|
|
487
|
+
results = await Promise.all([
|
|
488
|
+
execModuleBundlerIfNeeded({
|
|
489
|
+
options: {
|
|
490
|
+
bundleDefinition: getBundleDefinition(libraryNamespace, excludes),
|
|
491
|
+
bundleOptions: {
|
|
492
|
+
optimize: true,
|
|
493
|
+
ignoreMissingModules: true
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
resources
|
|
497
|
+
}),
|
|
498
|
+
execModuleBundlerIfNeeded({
|
|
499
|
+
options: {
|
|
500
|
+
bundleDefinition: getDesigntimeBundleDefinition(libraryNamespace),
|
|
501
|
+
bundleOptions: {
|
|
502
|
+
optimize: true,
|
|
503
|
+
ignoreMissingModules: true,
|
|
504
|
+
skipIfEmpty: true
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
resources
|
|
508
|
+
}),
|
|
509
|
+
execModuleBundlerIfNeeded({
|
|
510
|
+
options: {
|
|
511
|
+
bundleDefinition: getSupportFilesBundleDefinition(libraryNamespace),
|
|
512
|
+
bundleOptions: {
|
|
513
|
+
optimize: false,
|
|
514
|
+
ignoreMissingModules: true,
|
|
515
|
+
skipIfEmpty: true
|
|
516
|
+
}
|
|
517
|
+
// Note: Although the bundle uses optimize=false, there is
|
|
518
|
+
// no moduleNameMapping needed, as support files are excluded from minification.
|
|
519
|
+
},
|
|
520
|
+
resources
|
|
521
|
+
})
|
|
522
|
+
]);
|
|
523
|
+
} else {
|
|
524
|
+
log.info(
|
|
525
|
+
`Using experimental bundling with bundle info preload ` +
|
|
526
|
+
`for library ${libraryNamespace} in project ${projectName}`);
|
|
527
|
+
log.info(`Detected sap.ui.core version is ${coreVersion || "unknown"}`);
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
if (skipBundles.includes(`${libraryNamespace}/library-preload.js`) &&
|
|
531
|
+
!skipBundles.includes(`${libraryNamespace}/_library-content.js`)) {
|
|
532
|
+
// If the standard preload bundle is skipped, ensure to also skip the content bundle,
|
|
533
|
+
// since they depend on each other
|
|
534
|
+
skipBundles.push(`${libraryNamespace}/_library-content.js`);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
if (skipBundles.includes(`${libraryNamespace}/_library-content.js`) &&
|
|
538
|
+
!skipBundles.includes(`${libraryNamespace}/library-preload.js`)) {
|
|
539
|
+
// If the content bundle is skipped, the default preload bundle must be skipped as well
|
|
540
|
+
throw new Error(
|
|
541
|
+
`A custom bundle '${libraryNamespace}/_library-content.js' has been defined, ` +
|
|
542
|
+
`but it also requires a corresponding custom bundle definition for ` +
|
|
543
|
+
`'${libraryNamespace}/library-preload.js'`);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// Experimental bundling with bundle info preload
|
|
547
|
+
results = await Promise.all([
|
|
548
|
+
execModuleBundlerIfNeeded({
|
|
549
|
+
options: {
|
|
550
|
+
bundleDefinition:
|
|
551
|
+
getBundleInfoPreloadDefinition(libraryNamespace, excludes, coreVersion),
|
|
552
|
+
bundleOptions: {
|
|
553
|
+
optimize: true,
|
|
554
|
+
ignoreMissingModules: true
|
|
555
|
+
}
|
|
556
|
+
},
|
|
557
|
+
resources
|
|
558
|
+
}),
|
|
559
|
+
execModuleBundlerIfNeeded({
|
|
560
|
+
options: {
|
|
561
|
+
bundleDefinition: getContentBundleDefinition(libraryNamespace, excludes),
|
|
562
|
+
bundleOptions: {
|
|
563
|
+
optimize: true,
|
|
564
|
+
ignoreMissingModules: true
|
|
565
|
+
}
|
|
566
|
+
},
|
|
567
|
+
resources
|
|
568
|
+
}),
|
|
569
|
+
execModuleBundlerIfNeeded({
|
|
570
|
+
options: {
|
|
571
|
+
bundleDefinition: getDesigntimeBundleDefinition(libraryNamespace),
|
|
572
|
+
bundleOptions: {
|
|
573
|
+
optimize: true,
|
|
574
|
+
ignoreMissingModules: true,
|
|
575
|
+
skipIfEmpty: true
|
|
576
|
+
}
|
|
577
|
+
},
|
|
578
|
+
resources
|
|
579
|
+
}),
|
|
580
|
+
execModuleBundlerIfNeeded({
|
|
581
|
+
options: {
|
|
582
|
+
bundleDefinition: getSupportFilesBundleDefinition(libraryNamespace),
|
|
583
|
+
bundleOptions: {
|
|
584
|
+
optimize: false,
|
|
585
|
+
ignoreMissingModules: true,
|
|
586
|
+
skipIfEmpty: true
|
|
587
|
+
}
|
|
588
|
+
// Note: Although the bundle uses optimize=false, there is
|
|
589
|
+
// no moduleNameMapping needed, as support files are excluded from minification.
|
|
590
|
+
},
|
|
591
|
+
resources
|
|
592
|
+
})
|
|
593
|
+
]);
|
|
594
|
+
}
|
|
429
595
|
const bundles = Array.prototype.concat.apply([], results).filter(Boolean);
|
|
430
596
|
return Promise.all(bundles.map(({bundle, sourceMap} = {}) => {
|
|
431
597
|
if (bundle) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/builder",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.2",
|
|
4
4
|
"description": "UI5 CLI - Builder",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SAP SE",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"less-openui5": "^0.11.6",
|
|
134
134
|
"pretty-data": "^0.40.0",
|
|
135
135
|
"semver": "^7.7.3",
|
|
136
|
-
"terser": "^5.44.
|
|
136
|
+
"terser": "^5.44.1",
|
|
137
137
|
"workerpool": "^9.3.4",
|
|
138
138
|
"xml2js": "^0.6.2"
|
|
139
139
|
},
|
|
@@ -141,22 +141,22 @@
|
|
|
141
141
|
"@eslint/js": "^9.14.0",
|
|
142
142
|
"@istanbuljs/esm-loader-hook": "^0.3.0",
|
|
143
143
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
144
|
-
"@ui5/project": "^4.0.
|
|
144
|
+
"@ui5/project": "^4.0.8",
|
|
145
145
|
"ava": "^6.4.1",
|
|
146
146
|
"chokidar-cli": "^3.0.0",
|
|
147
147
|
"cross-env": "^7.0.3",
|
|
148
148
|
"depcheck": "^1.4.7",
|
|
149
149
|
"docdash": "^2.0.2",
|
|
150
|
-
"eslint": "^9.
|
|
150
|
+
"eslint": "^9.39.1",
|
|
151
151
|
"eslint-config-google": "^0.14.0",
|
|
152
152
|
"eslint-plugin-ava": "^15.1.0",
|
|
153
153
|
"eslint-plugin-jsdoc": "^52.0.4",
|
|
154
154
|
"esmock": "^2.7.3",
|
|
155
|
-
"globals": "^16.
|
|
155
|
+
"globals": "^16.5.0",
|
|
156
156
|
"line-column": "^1.0.2",
|
|
157
157
|
"nyc": "^17.1.0",
|
|
158
158
|
"open-cli": "^8.0.0",
|
|
159
|
-
"rimraf": "^6.0
|
|
159
|
+
"rimraf": "^6.1.0",
|
|
160
160
|
"sinon": "^21.0.0",
|
|
161
161
|
"tap-xunit": "^2.4.1"
|
|
162
162
|
}
|