@ui5/builder 4.0.6 → 4.0.8

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,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.6...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v4.0.8...HEAD).
6
+
7
+ <a name="v4.0.8"></a>
8
+ ## [v4.0.8] - 2025-07-14
9
+ ### Bug Fixes
10
+ - **bundle/Builder:** Skip source map for empty or trivia-only files [`4763253`](https://github.com/SAP/ui5-builder/commit/4763253985ae869c541875d82d0609cb5ef28216)
11
+
12
+ ### Dependency Updates
13
+ - Bump cheerio from 1.0.0 to 1.1.0 ([#1126](https://github.com/SAP/ui5-builder/issues/1126)) [`bade2bc`](https://github.com/SAP/ui5-builder/commit/bade2bc9f8a623a332d5768dc4ce6bd0036ba4bf)
14
+ - Bump terser from 5.39.2 to 5.40.0 ([#1118](https://github.com/SAP/ui5-builder/issues/1118)) [`80a5975`](https://github.com/SAP/ui5-builder/commit/80a5975c037e7c0bf9a041c284ec4a510bf2cbfd)
15
+
16
+
17
+ <a name="v4.0.7"></a>
18
+ ## [v4.0.7] - 2025-05-19
19
+ ### Bug Fixes
20
+ - **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)
21
+
6
22
 
7
23
  <a name="v4.0.6"></a>
8
24
  ## [v4.0.6] - 2025-04-29
@@ -951,6 +967,8 @@ to load the custom bundle file instead.
951
967
 
952
968
  ### Features
953
969
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
970
+ [v4.0.8]: https://github.com/SAP/ui5-builder/compare/v4.0.7...v4.0.8
971
+ [v4.0.7]: https://github.com/SAP/ui5-builder/compare/v4.0.6...v4.0.7
954
972
  [v4.0.6]: https://github.com/SAP/ui5-builder/compare/v4.0.5...v4.0.6
955
973
  [v4.0.5]: https://github.com/SAP/ui5-builder/compare/v4.0.4...v4.0.5
956
974
  [v4.0.4]: https://github.com/SAP/ui5-builder/compare/v4.0.3...v4.0.4
@@ -383,9 +383,10 @@ class BundleBuilder {
383
383
  if (map.mappings) {
384
384
  map.mappings = "AAAA," + map.mappings;
385
385
  } else {
386
- // If there are no existing mappings (e.g. if the file is empty or only comments),
387
- // make sure to still define a single mapping
388
- map.mappings = "AAAA";
386
+ // If there are no existing mappings (e.g. if the file is empty or contains only comments),
387
+ // do not specify any mapping. Especially Safari would otherwise reject the source map due to
388
+ // "Invalid Mappings"
389
+ map.mappings = "";
389
390
  }
390
391
  }
391
392
 
@@ -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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "4.0.6",
3
+ "version": "4.0.8",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -121,43 +121,43 @@
121
121
  "url": "git@github.com:SAP/ui5-builder.git"
122
122
  },
123
123
  "dependencies": {
124
- "@jridgewell/sourcemap-codec": "^1.5.0",
124
+ "@jridgewell/sourcemap-codec": "^1.5.4",
125
125
  "@ui5/fs": "^4.0.1",
126
126
  "@ui5/logger": "^4.0.1",
127
- "cheerio": "1.0.0",
127
+ "cheerio": "1.1.0",
128
128
  "escape-unicode": "^0.2.0",
129
129
  "escope": "^4.0.0",
130
- "espree": "^10.3.0",
130
+ "espree": "^10.4.0",
131
131
  "graceful-fs": "^4.2.11",
132
132
  "jsdoc": "^4.0.4",
133
133
  "less-openui5": "^0.11.6",
134
134
  "pretty-data": "^0.40.0",
135
- "semver": "^7.7.1",
136
- "terser": "^5.39.0",
137
- "workerpool": "^9.2.0",
135
+ "semver": "^7.7.2",
136
+ "terser": "^5.43.1",
137
+ "workerpool": "^9.3.3",
138
138
  "xml2js": "^0.6.2"
139
139
  },
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.25",
143
+ "@jridgewell/trace-mapping": "^0.3.29",
144
144
  "@ui5/project": "^4.0.4",
145
- "ava": "^6.2.0",
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.25.1",
150
+ "eslint": "^9.31.0",
151
151
  "eslint-config-google": "^0.14.0",
152
152
  "eslint-plugin-ava": "^15.0.1",
153
- "eslint-plugin-jsdoc": "^50.6.11",
154
- "esmock": "^2.7.0",
155
- "globals": "^16.0.0",
153
+ "eslint-plugin-jsdoc": "^51.3.4",
154
+ "esmock": "^2.7.1",
155
+ "globals": "^16.3.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": "^20.0.0",
160
+ "sinon": "^21.0.0",
161
161
  "tap-xunit": "^2.4.1"
162
162
  }
163
163
  }