@ui5/builder 4.0.8 → 4.0.10
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 +17 -2
- package/lib/lbt/bundle/AutoSplitter.js +42 -2
- package/lib/lbt/bundle/Builder.js +1 -17
- package/lib/lbt/utils/stringUtils.js +17 -0
- package/lib/tasks/minify.js +5 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,23 @@
|
|
|
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.0.
|
|
5
|
+
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v4.0.10...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v4.0.10"></a>
|
|
8
|
+
## [v4.0.10] - 2025-09-01
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
- Downgrade cheerio to v1.0.0 to resolve Node compatibility issues [`4dc3a6e`](https://github.com/SAP/ui5-builder/commit/4dc3a6ef3029fca50d6b3ab45ed9667c206c6435)
|
|
11
|
+
- **Bundler:** Include 'bundleInfo' section in multipart bundles [`e7ab31e`](https://github.com/SAP/ui5-builder/commit/e7ab31e859c5659612f0cc726e0410064f0b3174)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
<a name="v4.0.9"></a>
|
|
15
|
+
## [v4.0.9] - 2025-08-12
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
- **minify:** Apply value of a resource's OmitFromBuildResult-tag to derived resources [`112d204`](https://github.com/SAP/ui5-builder/commit/112d204b230c973b6c209105e4e8a383fc1da35d)
|
|
18
|
+
|
|
6
19
|
|
|
7
20
|
<a name="v4.0.8"></a>
|
|
8
|
-
## [v4.0.8] - 2025-07-
|
|
21
|
+
## [v4.0.8] - 2025-07-15
|
|
9
22
|
### Bug Fixes
|
|
10
23
|
- **bundle/Builder:** Skip source map for empty or trivia-only files [`4763253`](https://github.com/SAP/ui5-builder/commit/4763253985ae869c541875d82d0609cb5ef28216)
|
|
11
24
|
|
|
@@ -967,6 +980,8 @@ to load the custom bundle file instead.
|
|
|
967
980
|
|
|
968
981
|
### Features
|
|
969
982
|
- Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
|
|
983
|
+
[v4.0.10]: https://github.com/SAP/ui5-builder/compare/v4.0.9...v4.0.10
|
|
984
|
+
[v4.0.9]: https://github.com/SAP/ui5-builder/compare/v4.0.8...v4.0.9
|
|
970
985
|
[v4.0.8]: https://github.com/SAP/ui5-builder/compare/v4.0.7...v4.0.8
|
|
971
986
|
[v4.0.7]: https://github.com/SAP/ui5-builder/compare/v4.0.6...v4.0.7
|
|
972
987
|
[v4.0.6]: https://github.com/SAP/ui5-builder/compare/v4.0.5...v4.0.6
|
|
@@ -3,6 +3,7 @@ import {pd} from "pretty-data";
|
|
|
3
3
|
import {toRequireJSName} from "../utils/ModuleName.js";
|
|
4
4
|
import {SectionType} from "./BundleDefinition.js";
|
|
5
5
|
import escapePropertiesFile from "../utils/escapePropertiesFile.js";
|
|
6
|
+
import {makeStringLiteral} from "../utils/stringUtils.js";
|
|
6
7
|
import {getLogger} from "@ui5/logger";
|
|
7
8
|
const log = getLogger("lbt:bundle:AutoSplitter");
|
|
8
9
|
|
|
@@ -43,6 +44,7 @@ class AutoSplitter {
|
|
|
43
44
|
const moduleSizes = Object.create(null);
|
|
44
45
|
const depCacheSizes = [];
|
|
45
46
|
let depCacheLoaderSize = 0;
|
|
47
|
+
let bundleInfoLoaderSize = 0;
|
|
46
48
|
this.optimize = !!options.optimize;
|
|
47
49
|
|
|
48
50
|
// ---- resolve module definition
|
|
@@ -97,8 +99,14 @@ class AutoSplitter {
|
|
|
97
99
|
})());
|
|
98
100
|
});
|
|
99
101
|
break;
|
|
100
|
-
|
|
102
|
+
case SectionType.BundleInfo:
|
|
103
|
+
bundleInfoLoaderSize = "sap.ui.loader.config({bundlesUI5:{\n\n}});\n".length;
|
|
104
|
+
totalSize += bundleInfoLoaderSize;
|
|
105
|
+
totalSize +=
|
|
106
|
+
`"${section.name}":[${section.modules.map(makeStringLiteral).join(",")}]`.length;
|
|
101
107
|
break;
|
|
108
|
+
default:
|
|
109
|
+
throw new Error(`Unknown section mode: ${section.mode}`);
|
|
102
110
|
}
|
|
103
111
|
});
|
|
104
112
|
|
|
@@ -134,6 +142,7 @@ class AutoSplitter {
|
|
|
134
142
|
resolvedModule.sections.forEach( (section) => {
|
|
135
143
|
let currentSection;
|
|
136
144
|
let sequence;
|
|
145
|
+
let bundleInfoModuleStringLiterals;
|
|
137
146
|
switch ( section.mode ) {
|
|
138
147
|
case SectionType.Provided:
|
|
139
148
|
// 'provided' sections are no longer needed in a fully resolved module
|
|
@@ -233,8 +242,39 @@ class AutoSplitter {
|
|
|
233
242
|
}
|
|
234
243
|
});
|
|
235
244
|
break;
|
|
236
|
-
|
|
245
|
+
case SectionType.BundleInfo:
|
|
246
|
+
|
|
247
|
+
// Create new part if size is already exceeded
|
|
248
|
+
if (part + 1 < numberOfParts && totalSize > partSize) {
|
|
249
|
+
part++;
|
|
250
|
+
currentModule = {
|
|
251
|
+
name: moduleNameWithPart.replace(/__part__/, part),
|
|
252
|
+
sections: []
|
|
253
|
+
};
|
|
254
|
+
splittedModules.push(currentModule);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// bundleInfo sections are always copied as a whole
|
|
258
|
+
currentSection = {
|
|
259
|
+
mode: SectionType.BundleInfo,
|
|
260
|
+
name: section.name,
|
|
261
|
+
filters: []
|
|
262
|
+
};
|
|
263
|
+
currentModule.sections.push(currentSection);
|
|
264
|
+
|
|
265
|
+
bundleInfoModuleStringLiterals = [];
|
|
266
|
+
section.modules.forEach((module) => {
|
|
267
|
+
currentSection.filters.push(module);
|
|
268
|
+
bundleInfoModuleStringLiterals.push(makeStringLiteral(module));
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
totalSize += bundleInfoLoaderSize;
|
|
272
|
+
totalSize +=
|
|
273
|
+
`"${section.name}":[${bundleInfoModuleStringLiterals.join(",")}]`.length;
|
|
274
|
+
|
|
237
275
|
break;
|
|
276
|
+
default:
|
|
277
|
+
throw new Error(`Unknown section mode: ${section.mode}`);
|
|
238
278
|
}
|
|
239
279
|
});
|
|
240
280
|
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
MODULE__UI5LOADER, MODULE__UI5LOADER_AUTOCONFIG,
|
|
12
12
|
MODULE__JQUERY_SAP_GLOBAL, MODULE__SAP_UI_CORE_CORE} from "../UI5ClientConstants.js";
|
|
13
13
|
import escapePropertiesFile from "../utils/escapePropertiesFile.js";
|
|
14
|
+
import {makeStringLiteral, removeHashbang} from "../utils/stringUtils.js";
|
|
14
15
|
import BundleResolver from "./Resolver.js";
|
|
15
16
|
import BundleSplitter from "./AutoSplitter.js";
|
|
16
17
|
import {SectionType} from "./BundleDefinition.js";
|
|
@@ -23,23 +24,6 @@ const sourceMappingUrlPattern = /\/\/# sourceMappingURL=(\S+)\s*$/;
|
|
|
23
24
|
const httpPattern = /^https?:\/\//i;
|
|
24
25
|
const xmlHtmlPrePattern = /<(?:\w+:)?pre\b/;
|
|
25
26
|
|
|
26
|
-
const strReplacements = {
|
|
27
|
-
"\r": "\\r",
|
|
28
|
-
"\t": "\\t",
|
|
29
|
-
"\n": "\\n",
|
|
30
|
-
"'": "\\'",
|
|
31
|
-
"\\": "\\\\"
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
function makeStringLiteral(str) {
|
|
35
|
-
return "'" + String(str).replace(/['\r\n\t\\]/g, function(char) {
|
|
36
|
-
return strReplacements[char];
|
|
37
|
-
}) + "'";
|
|
38
|
-
}
|
|
39
|
-
function removeHashbang(str) {
|
|
40
|
-
return str.replace(/^#!(.*)/, "");
|
|
41
|
-
}
|
|
42
|
-
|
|
43
27
|
function isEmptyBundle(resolvedBundle) {
|
|
44
28
|
return resolvedBundle.sections.every((section) => section.modules.length === 0);
|
|
45
29
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const strReplacements = {
|
|
2
|
+
"\r": "\\r",
|
|
3
|
+
"\t": "\\t",
|
|
4
|
+
"\n": "\\n",
|
|
5
|
+
"'": "\\'",
|
|
6
|
+
"\\": "\\\\"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function makeStringLiteral(str) {
|
|
10
|
+
return "'" + String(str).replace(/['\r\n\t\\]/g, function(char) {
|
|
11
|
+
return strReplacements[char];
|
|
12
|
+
}) + "'";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function removeHashbang(str) {
|
|
16
|
+
return str.replace(/^#!(.*)/, "");
|
|
17
|
+
}
|
package/lib/tasks/minify.js
CHANGED
|
@@ -44,6 +44,11 @@ export default async function({
|
|
|
44
44
|
resource, dbgResource, sourceMapResource, dbgSourceMapResource
|
|
45
45
|
}) => {
|
|
46
46
|
if (taskUtil) {
|
|
47
|
+
// Carry over OmitFromBuildResult from input resource to all derived resources
|
|
48
|
+
if (taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.OmitFromBuildResult)) {
|
|
49
|
+
taskUtil.setTag(dbgResource, taskUtil.STANDARD_TAGS.OmitFromBuildResult);
|
|
50
|
+
taskUtil.setTag(sourceMapResource, taskUtil.STANDARD_TAGS.OmitFromBuildResult);
|
|
51
|
+
}
|
|
47
52
|
taskUtil.setTag(resource, taskUtil.STANDARD_TAGS.HasDebugVariant);
|
|
48
53
|
taskUtil.setTag(dbgResource, taskUtil.STANDARD_TAGS.IsDebugVariant);
|
|
49
54
|
taskUtil.setTag(sourceMapResource, taskUtil.STANDARD_TAGS.HasDebugVariant);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/builder",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.10",
|
|
4
4
|
"description": "UI5 Tooling - Builder",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SAP SE",
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
"url": "git@github.com:SAP/ui5-builder.git"
|
|
122
122
|
},
|
|
123
123
|
"dependencies": {
|
|
124
|
-
"@jridgewell/sourcemap-codec": "^1.5.
|
|
124
|
+
"@jridgewell/sourcemap-codec": "^1.5.5",
|
|
125
125
|
"@ui5/fs": "^4.0.1",
|
|
126
126
|
"@ui5/logger": "^4.0.1",
|
|
127
|
-
"cheerio": "1.
|
|
127
|
+
"cheerio": "1.0.0",
|
|
128
128
|
"escape-unicode": "^0.2.0",
|
|
129
129
|
"escope": "^4.0.0",
|
|
130
130
|
"espree": "^10.4.0",
|
|
@@ -140,17 +140,17 @@
|
|
|
140
140
|
"devDependencies": {
|
|
141
141
|
"@eslint/js": "^9.14.0",
|
|
142
142
|
"@istanbuljs/esm-loader-hook": "^0.3.0",
|
|
143
|
-
"@jridgewell/trace-mapping": "^0.3.
|
|
143
|
+
"@jridgewell/trace-mapping": "^0.3.30",
|
|
144
144
|
"@ui5/project": "^4.0.4",
|
|
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.34.0",
|
|
151
151
|
"eslint-config-google": "^0.14.0",
|
|
152
|
-
"eslint-plugin-ava": "^15.0
|
|
153
|
-
"eslint-plugin-jsdoc": "^
|
|
152
|
+
"eslint-plugin-ava": "^15.1.0",
|
|
153
|
+
"eslint-plugin-jsdoc": "^52.0.4",
|
|
154
154
|
"esmock": "^2.7.1",
|
|
155
155
|
"globals": "^16.3.0",
|
|
156
156
|
"line-column": "^1.0.2",
|