@ui5/builder 4.0.5 → 4.0.7

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,20 @@
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...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v4.0.7...HEAD).
6
+
7
+ <a name="v4.0.7"></a>
8
+ ## [v4.0.7] - 2025-05-18
9
+ ### Bug Fixes
10
+ - **manifestEnhancer:** Only use valid files for supportedLocales ([#1080](https://github.com/SAP/ui5-builder/issues/1080)) [`a6c04d2`](https://github.com/SAP/ui5-builder/commit/a6c04d26ae964566c82e82d1be2ef6a7fd836530)
11
+
12
+
13
+ <a name="v4.0.6"></a>
14
+ ## [v4.0.6] - 2025-04-29
15
+ ### Bug Fixes
16
+ - Handle legacy-free UI5 versions [`8b38316`](https://github.com/SAP/ui5-builder/commit/8b38316bae02edfe4da1876884345c040f260c10)
17
+ - **minify:** In case of error, include full resource path in the error messsage [`aadb463`](https://github.com/SAP/ui5-builder/commit/aadb4639461998b2c113d5a4962adbdb135c9762)
18
+
6
19
 
7
20
  <a name="v4.0.5"></a>
8
21
  ## [v4.0.5] - 2024-12-10
@@ -944,6 +957,8 @@ to load the custom bundle file instead.
944
957
 
945
958
  ### Features
946
959
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
960
+ [v4.0.7]: https://github.com/SAP/ui5-builder/compare/v4.0.6...v4.0.7
961
+ [v4.0.6]: https://github.com/SAP/ui5-builder/compare/v4.0.5...v4.0.6
947
962
  [v4.0.5]: https://github.com/SAP/ui5-builder/compare/v4.0.4...v4.0.5
948
963
  [v4.0.4]: https://github.com/SAP/ui5-builder/compare/v4.0.3...v4.0.4
949
964
  [v4.0.3]: https://github.com/SAP/ui5-builder/compare/v4.0.2...v4.0.3
package/LICENSE.txt CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2018-2024 SAP SE or an SAP affiliate company and UI5 Tooling contributors
189
+ Copyright [yyyy] [name of copyright owner]
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -54,13 +54,23 @@ class BundleBuilder {
54
54
  this.allowStringBundling = allowStringBundling;
55
55
  }
56
56
 
57
- getUi5MajorVersion() {
57
+ getEffectiveUi5MajorVersion() {
58
58
  if (this.targetUi5CoreVersionMajor !== undefined) {
59
59
  return this.targetUi5CoreVersionMajor;
60
60
  }
61
61
 
62
- if (this.targetUi5CoreVersion && semver.valid(this.targetUi5CoreVersion)) {
63
- this.targetUi5CoreVersionMajor = semver.major(this.targetUi5CoreVersion);
62
+ const parsedVersion = semver.parse(this.targetUi5CoreVersion);
63
+ if (parsedVersion) {
64
+ this.targetUi5CoreVersionMajor = parsedVersion.major;
65
+
66
+ // legacy-free versions include changes of the upcoming major version
67
+ // so we should treat them the same as the next major version
68
+ if (
69
+ parsedVersion.prerelease.includes("legacy-free") ||
70
+ parsedVersion.prerelease.includes("legacy-free-SNAPSHOT") // Maven snapshot version
71
+ ) {
72
+ this.targetUi5CoreVersionMajor += 1;
73
+ }
64
74
  } else {
65
75
  // Assume legacy version if unable to determine the version
66
76
  this.targetUi5CoreVersionMajor = null;
@@ -85,7 +95,7 @@ class BundleBuilder {
85
95
  }
86
96
 
87
97
  determineRequireCallback(modules) {
88
- if (this.getUi5MajorVersion() >= 2) {
98
+ if (this.getEffectiveUi5MajorVersion() >= 2) {
89
99
  // Starting with UI5 2.0.0, method Core.boot does not exist anymore
90
100
  return;
91
101
  }
@@ -212,7 +222,7 @@ class BundleBuilder {
212
222
 
213
223
  closeModule(resolvedModule) {
214
224
  if ( resolvedModule.containsCoreSync ) {
215
- if ( this.getUi5MajorVersion() >= 2 ) {
225
+ if ( this.getEffectiveUi5MajorVersion() >= 2 ) {
216
226
  throw new Error("Requiring sap/ui/core/Core synchronously is not supported as of UI5 Version 2");
217
227
  }
218
228
  this.outW.ensureNewLine(); // for clarity and to avoid issues with single line comments
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Node script to create cross-library API index files for use in the UI5 SDKs.
3
3
  *
4
- * (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
4
+ * (c) Copyright 2025 SAP SE or an SAP affiliate company.
5
5
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Node script to preprocess api.json files for use in the UI5 SDKs.
3
3
  *
4
- * (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
4
+ * (c) Copyright 2025 SAP SE or an SAP affiliate company.
5
5
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * JSDoc3 plugin for UI5 documentation generation.
3
3
  *
4
- * (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
4
+ * (c) Copyright 2025 SAP SE or an SAP affiliate company.
5
5
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * JSDoc3 template for UI5 documentation generation.
3
3
  *
4
- * (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
4
+ * (c) Copyright 2025 SAP SE or an SAP affiliate company.
5
5
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Node script to parse type strings.
3
3
  *
4
- * (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
4
+ * (c) Copyright 2025 SAP SE or an SAP affiliate company.
5
5
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
6
6
  */
7
7
 
@@ -7,6 +7,58 @@ const log = getLogger("builder:processors:manifestEnhancer");
7
7
 
8
8
  const APP_DESCRIPTOR_V22 = new Version("1.21.0");
9
9
 
10
+ /*
11
+ * Matches a legacy Java locale string, which is the format used by the UI5 Runtime (ResourceBundle)
12
+ * to load i18n properties files.
13
+ * Special case: "sr_Latn" is also supported, although the BCP47 script part is not supported by the Java locale format.
14
+ *
15
+ * Variants are limited to the format from BCP47, but with underscores instead of hyphens.
16
+ */
17
+ // [ language ] [ region ][ variants ]
18
+ const rLegacyJavaLocale = /^([a-z]{2,3}|sr_Latn)(?:_([A-Z]{2}|\d{3})((?:_[0-9a-zA-Z]{5,8}|_[0-9][0-9a-zA-Z]{3})*)?)?$/;
19
+
20
+ // See https://github.com/SAP/openui5/blob/d7ecf2792788719d35b4eee3085a327d545bab24/src/sap.ui.core/src/sap/base/i18n/LanguageFallback.js#L10
21
+ const sapSupportabilityVariants = ["saptrc", "sappsd", "saprigi"];
22
+
23
+ function getBCP47LocaleFromPropertiesFilename(locale) {
24
+ const match = rLegacyJavaLocale.exec(locale);
25
+ if (!match) {
26
+ return null;
27
+ }
28
+ let [, language, region, variants] = match;
29
+ let script;
30
+
31
+ variants = variants?.slice(1); // Remove leading underscore
32
+
33
+ // Special handling of sr_Latn (see regex above)
34
+ // Note: This needs to be in sync with the runtime logic:
35
+ // https://github.com/SAP/openui5/blob/d7ecf2792788719d35b4eee3085a327d545bab24/src/sap.ui.core/src/sap/base/i18n/LanguageFallback.js#L87
36
+ if (language === "sr_Latn") {
37
+ language = "sr";
38
+ script = "Latn";
39
+ }
40
+
41
+ if (language === "en" && region === "US" && sapSupportabilityVariants.includes(variants)) {
42
+ // Convert to private use section
43
+ // Note: This needs to be in sync with the runtime logic:
44
+ // https://github.com/SAP/openui5/blob/d7ecf2792788719d35b4eee3085a327d545bab24/src/sap.ui.core/src/sap/base/i18n/LanguageFallback.js#L75
45
+ variants = `x-${variants}`;
46
+ }
47
+
48
+ let bcp47Locale = language;
49
+ if (script) {
50
+ bcp47Locale += `-${script}`;
51
+ }
52
+ if (region) {
53
+ bcp47Locale += `-${region}`;
54
+ }
55
+ if (variants) {
56
+ // Convert to BCP47 variant format
57
+ bcp47Locale += `-${variants.replace(/_/g, "-")}`;
58
+ }
59
+ return bcp47Locale;
60
+ }
61
+
10
62
  function isAbsoluteUrl(url) {
11
63
  if (url.startsWith("/")) {
12
64
  return true;
@@ -132,6 +184,8 @@ class ManifestEnhancer {
132
184
 
133
185
  this.isModified = false;
134
186
  this.runInvoked = false;
187
+
188
+ this.supportedLocalesCache = new Map();
135
189
  }
136
190
 
137
191
  markModified() {
@@ -151,7 +205,14 @@ class ManifestEnhancer {
151
205
  }
152
206
  }
153
207
 
154
- async findSupportedLocales(i18nBundleUrl) {
208
+ findSupportedLocales(i18nBundleUrl) {
209
+ if (!this.supportedLocalesCache.has(i18nBundleUrl)) {
210
+ this.supportedLocalesCache.set(i18nBundleUrl, this._findSupportedLocales(i18nBundleUrl));
211
+ }
212
+ return this.supportedLocalesCache.get(i18nBundleUrl);
213
+ }
214
+
215
+ async _findSupportedLocales(i18nBundleUrl) {
155
216
  const i18nBundleName = path.basename(i18nBundleUrl, ".properties");
156
217
  const i18nBundlePrefix = `${i18nBundleName}_`;
157
218
  const i18nBundleDir = path.dirname(i18nBundleUrl);
@@ -165,8 +226,13 @@ class ManifestEnhancer {
165
226
  if (fileNameWithoutExtension === i18nBundleName) {
166
227
  supportedLocales.push("");
167
228
  } else if (fileNameWithoutExtension.startsWith(i18nBundlePrefix)) {
168
- const locale = fileNameWithoutExtension.replace(i18nBundlePrefix, "");
169
- supportedLocales.push(locale);
229
+ const fileNameLocale = fileNameWithoutExtension.replace(i18nBundlePrefix, "");
230
+ const bcp47Locale = getBCP47LocaleFromPropertiesFilename(fileNameLocale);
231
+ if (bcp47Locale) {
232
+ supportedLocales.push(bcp47Locale);
233
+ } else {
234
+ log.warn(`Ignoring unexpected locale in filename '${fileName}' for bundle '${i18nBundleUrl}'`);
235
+ }
170
236
  }
171
237
  });
172
238
  return supportedLocales.sort();
@@ -274,6 +274,7 @@ export default async function({
274
274
  filename,
275
275
  dbgFilename,
276
276
  code,
277
+ resourcePath,
277
278
  sourceMapOptions
278
279
  }, taskUtil);
279
280
  resource.setString(result.code);
@@ -30,6 +30,7 @@ const copyrightCommentsAndBundleCommentPattern = /copyright|\(c\)(?:[0-9]+|\s+[0
30
30
  * @param {string} parameters.filename
31
31
  * @param {string} parameters.dbgFilename
32
32
  * @param {string} parameters.code
33
+ * @param {string} parameters.resourcePath
33
34
  * @param {object} parameters.sourceMapOptions
34
35
  * @returns {Promise<undefined>} Promise resolving once minification of the resource has finished
35
36
  */
@@ -37,6 +38,7 @@ export default async function execMinification({
37
38
  filename,
38
39
  dbgFilename,
39
40
  code,
41
+ resourcePath,
40
42
  sourceMapOptions
41
43
  }) {
42
44
  try {
@@ -61,7 +63,7 @@ export default async function execMinification({
61
63
  } catch (err) {
62
64
  // Note: err.filename contains the debug-name
63
65
  throw new Error(
64
- `Minification failed with error: ${err.message} in file ${filename} ` +
66
+ `Minification failed with error: ${err.message} in file ${resourcePath} ` +
65
67
  `(line ${err.line}, col ${err.col}, pos ${err.pos})`, {
66
68
  cause: err
67
69
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "4.0.5",
3
+ "version": "4.0.7",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -132,32 +132,32 @@
132
132
  "jsdoc": "^4.0.4",
133
133
  "less-openui5": "^0.11.6",
134
134
  "pretty-data": "^0.40.0",
135
- "semver": "^7.6.3",
136
- "terser": "^5.37.0",
135
+ "semver": "^7.7.2",
136
+ "terser": "^5.39.2",
137
137
  "workerpool": "^9.2.0",
138
138
  "xml2js": "^0.6.2"
139
139
  },
140
140
  "devDependencies": {
141
141
  "@eslint/js": "^9.14.0",
142
- "@istanbuljs/esm-loader-hook": "^0.2.0",
142
+ "@istanbuljs/esm-loader-hook": "^0.3.0",
143
143
  "@jridgewell/trace-mapping": "^0.3.25",
144
144
  "@ui5/project": "^4.0.4",
145
- "ava": "^6.2.0",
145
+ "ava": "^6.3.0",
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.16.0",
150
+ "eslint": "^9.27.0",
151
151
  "eslint-config-google": "^0.14.0",
152
152
  "eslint-plugin-ava": "^15.0.1",
153
- "eslint-plugin-jsdoc": "^50.6.0",
154
- "esmock": "^2.6.9",
155
- "globals": "^15.13.0",
153
+ "eslint-plugin-jsdoc": "^50.6.17",
154
+ "esmock": "^2.7.0",
155
+ "globals": "^16.1.0",
156
156
  "line-column": "^1.0.2",
157
157
  "nyc": "^17.1.0",
158
158
  "open-cli": "^8.0.0",
159
159
  "rimraf": "^6.0.1",
160
- "sinon": "^19.0.2",
160
+ "sinon": "^20.0.0",
161
161
  "tap-xunit": "^2.4.1"
162
162
  }
163
163
  }
package/.reuse/dep5 DELETED
@@ -1,33 +0,0 @@
1
- Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2
- Upstream-Name: ui5-builder
3
- Upstream-Contact: SAP OpenUI5 <openui5@sap.com>
4
- Source: https://github.com/SAP/ui5-builder
5
- Disclaimer: The code in this project may include calls to APIs (“API Calls”) of
6
- SAP or third-party products or services developed outside of this project
7
- (“External Products”).
8
- “APIs” means application programming interfaces, as well as their respective
9
- specifications and implementing code that allows software to communicate with
10
- other software.
11
- API Calls to External Products are not licensed under the open source license
12
- that governs this project. The use of such API Calls and related External
13
- Products are subject to applicable additional agreements with the relevant
14
- provider of the External Products. In no event shall the open source license
15
- that governs this project grant any rights in or to any External Products,or
16
- alter, expand or supersede any terms of the applicable additional agreements.
17
- If you have a valid license agreement with SAP for the use of a particular SAP
18
- External Product, then you may make use of any API Calls included in this
19
- project’s code for that SAP External Product, subject to the terms of such
20
- license agreement. If you do not have a valid license agreement for the use of
21
- a particular SAP External Product, then you may only make use of any API Calls
22
- in this project for that SAP External Product for your internal, non-productive
23
- and non-commercial test and evaluation of such API Calls. Nothing herein grants
24
- you any rights to use or access any SAP External Product, or provide any third
25
- parties the right to use of access any SAP External Product, through API Calls.
26
-
27
- Files: *
28
- Copyright: 2018-2024 SAP SE or an SAP affiliate company and UI5 Tooling contributors
29
- License: Apache-2.0
30
-
31
- Files: lib/processors/jsdoc/lib/*
32
- Copyright: 2009-2024 SAP SE or an SAP affiliate company and OpenUI5 contributors
33
- License: Apache-2.0