@ui5/builder 3.4.1 → 3.5.1

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,10 +2,22 @@
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/v3.4.1...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.5.1...HEAD).
6
+
7
+ <a name="v3.5.1"></a>
8
+ ## [v3.5.1] - 2024-07-22
9
+ ### Bug Fixes
10
+ - **generateThemeDesignerResources:** Allow core .theming in sources ([#1062](https://github.com/SAP/ui5-builder/issues/1062)) [`dda3011`](https://github.com/SAP/ui5-builder/commit/dda30114461314e81da43bd739e709186744f592)
11
+
12
+
13
+ <a name="v3.5.0"></a>
14
+ ## [v3.5.0] - 2024-06-24
15
+ ### Features
16
+ - ES2023 Support [`097049d`](https://github.com/SAP/ui5-builder/commit/097049daeec5c54c2d5e858b12e0c54c826ff663)
17
+
6
18
 
7
19
  <a name="v3.4.1"></a>
8
- ## [v3.4.1] - 2024-05-10
20
+ ## [v3.4.1] - 2024-05-13
9
21
  ### Bug Fixes
10
22
  - **bundle/Builder:** Correct bundling of resources with empty source map [`1228db7`](https://github.com/SAP/ui5-builder/commit/1228db78e7e655cea58c20517662b08dd09db87b)
11
23
 
@@ -872,6 +884,8 @@ to load the custom bundle file instead.
872
884
 
873
885
  ### Features
874
886
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
887
+ [v3.5.1]: https://github.com/SAP/ui5-builder/compare/v3.5.0...v3.5.1
888
+ [v3.5.0]: https://github.com/SAP/ui5-builder/compare/v3.4.1...v3.5.0
875
889
  [v3.4.1]: https://github.com/SAP/ui5-builder/compare/v3.4.0...v3.4.1
876
890
  [v3.4.0]: https://github.com/SAP/ui5-builder/compare/v3.3.1...v3.4.0
877
891
  [v3.3.1]: https://github.com/SAP/ui5-builder/compare/v3.3.0...v3.3.1
@@ -36,6 +36,10 @@ function makeStringLiteral(str) {
36
36
  }) + "'";
37
37
  }
38
38
 
39
+ function removeHashbang(str) {
40
+ return str.replace(/^#!(.*)/, "");
41
+ }
42
+
39
43
  function isEmptyBundle(resolvedBundle) {
40
44
  return resolvedBundle.sections.every((section) => section.modules.length === 0);
41
45
  }
@@ -278,6 +282,7 @@ class BundleBuilder {
278
282
  async writeRawModule(moduleName, resource) {
279
283
  this.outW.ensureNewLine();
280
284
  let moduleContent = (await resource.buffer()).toString();
285
+ moduleContent = removeHashbang(moduleContent);
281
286
  if (this.options.sourceMap) {
282
287
  let moduleSourceMap;
283
288
  ({moduleContent, moduleSourceMap} =
@@ -384,6 +389,7 @@ class BundleBuilder {
384
389
  // console.log("Processing " + moduleName);
385
390
  const resource = await this.pool.findResourceWithInfo(moduleName);
386
391
  let moduleContent = (await resource.buffer()).toString();
392
+ moduleContent = removeHashbang(moduleContent);
387
393
  let moduleSourceMap;
388
394
  if (this.options.sourceMap) {
389
395
  ({moduleContent, moduleSourceMap} =
@@ -444,6 +450,7 @@ class BundleBuilder {
444
450
  // The module should be written to a new line in order for dev-tools to map breakpoints to it
445
451
  outW.ensureNewLine();
446
452
  let moduleContent = (await resource.buffer()).toString();
453
+ moduleContent = removeHashbang(moduleContent);
447
454
  if (this.options.sourceMap) {
448
455
  let moduleSourceMap;
449
456
  ({moduleContent, moduleSourceMap} =
@@ -463,6 +470,7 @@ class BundleBuilder {
463
470
  log.warn(
464
471
  `Module ${moduleName} requires top level scope and can only be embedded as a string (requires 'eval')`);
465
472
  let moduleContent = (await resource.buffer()).toString();
473
+ moduleContent = removeHashbang(moduleContent);
466
474
  if (this.options.sourceMap) {
467
475
  // We are actually not interested in the source map this module might contain,
468
476
  // but we should make sure to remove any "sourceMappingURL" from the module content before
@@ -9,7 +9,7 @@ const hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
9
9
  * - Adjust the JSModuleAnalyzer test "Check for consistency between VisitorKeys and EnrichedVisitorKeys"
10
10
  * (See comments in test for details)
11
11
  */
12
- export const ecmaVersion = 2022;
12
+ export const ecmaVersion = 2023;
13
13
 
14
14
  export function parseJS(code, userOptions = {}) {
15
15
  // allowed options and their defaults
@@ -36,6 +36,12 @@ function normalizeToUI5GlobalNotation(sModuleName){
36
36
  return sModuleName.replace(/\//g, ".");
37
37
  }
38
38
 
39
+ function fnCreateTypesArr(sTypes) {
40
+ return sTypes.split("|").map(function (sType) {
41
+ return { value: sType }
42
+ });
43
+ }
44
+
39
45
  /*
40
46
  * Transforms the api.json as created by the JSDoc build into a pre-processed api.json file suitable for the SDK.
41
47
  *
@@ -126,7 +132,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
126
132
  * @returns {boolean}
127
133
  */
128
134
  function possibleUI5Symbol(sName) {
129
- return /^[a-zA-Z][a-zA-Z.]*[a-zA-Z]$/.test(sName);
135
+ return /^[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9]$/.test(sName);
130
136
  }
131
137
 
132
138
  // Function is a copy from: LibraryInfo.js => LibraryInfo.prototype._getActualComponent => "match" inline method
@@ -439,6 +445,11 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
439
445
  // Name
440
446
  oProperty.name = formatters.formatEntityName(oProperty.name, oSymbol.name, oProperty.static);
441
447
 
448
+ // Type
449
+ if (oProperty.type) {
450
+ oProperty.types = fnCreateTypesArr(oProperty.type);
451
+ }
452
+
442
453
  // Description
443
454
  oProperty.description = formatters.formatDescriptionSince(oProperty.description, oProperty.since);
444
455
 
@@ -2061,11 +2072,6 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
2061
2072
  * @param aMethods - the methods array initially coming from the server
2062
2073
  */
2063
2074
  buildMethodsModel: function (aMethods) {
2064
- var fnCreateTypesArr = function (sTypes) {
2065
- return sTypes.split("|").map(function (sType) {
2066
- return {value: sType}
2067
- });
2068
- };
2069
2075
  var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) {
2070
2076
  if (oParameter.parameterProperties) {
2071
2077
  Object.keys(oParameter.parameterProperties).forEach(function (sProperty) {
@@ -1138,6 +1138,46 @@ function convertDragDropValue(node, cardinality) {
1138
1138
  return Object.assign(mDefaults, mDragDropValue);
1139
1139
  }
1140
1140
 
1141
+ function collectVisibilityInfo(settings, doclet, className, n) {
1142
+ const validVisibilities = new Set(['public', 'hidden']);
1143
+ const validAccesses = new Set(['public', 'protected', 'restricted', 'private']);
1144
+
1145
+ let visibility = (settings.visibility && settings.visibility.value.value) || "public";
1146
+
1147
+ if (!validVisibilities.has(visibility)) {
1148
+ error(`${className}: Invalid visibility '${visibility}' in runtime metadata defined for managed setting '${n}. Valid options are ${Array.from(validVisibilities).join(', ')}.`);
1149
+ }
1150
+
1151
+ if (doclet?.access) {
1152
+ let access = doclet.access;
1153
+
1154
+ if (!validAccesses.has(access)) {
1155
+ error(`${className}: Invalid JSDoc visibility '${access}' defined for managed setting '${n}'. Valid options are ${Array.from(validAccesses).join(', ')}.`);
1156
+ }
1157
+
1158
+ if (visibility === 'hidden' && (access === 'public' || access === 'protected' || access === 'restricted')) {
1159
+ // force access to private to avoid inconsistencies in libraries that ignore JSDoc errors
1160
+ error(`${className}: Inconsistent visibility settings detected. Runtime metadata sets visibility to '${visibility}', while JSDoc defines it as '${access}' for the managed setting '${n}'. Forcing visibility to 'hidden'.`);
1161
+ access = "private";
1162
+ }
1163
+ if (visibility === 'public' && access === 'private') {
1164
+ // force access to 'restricted' to avoid inconsistencies in libraries that ignore JSDoc errors
1165
+ ui5data(doclet).stakeholders ??= [];
1166
+ if ( !doclet.__ui5.stakeholders.includes(className) ) {
1167
+ doclet.__ui5.stakeholders.push(className);
1168
+ }
1169
+ error(`${className}: Inconsistent visibility settings detected. Runtime metadata sets visibility to '${visibility}', while JSDoc defines it as '${access}' for the managed setting '${n}'. Forcing visibility to 'restricted'.`);
1170
+ access = "restricted";
1171
+ }
1172
+
1173
+ if (visibility == "public" && (access === "restricted" || access === "protected")) {
1174
+ visibility = access;
1175
+ }
1176
+ }
1177
+
1178
+ return visibility;
1179
+ }
1180
+
1141
1181
  function collectClassInfo(extendCall, classDoclet) {
1142
1182
 
1143
1183
  let baseType;
@@ -1238,7 +1278,8 @@ function collectClassInfo(extendCall, classDoclet) {
1238
1278
  since : doclet && doclet.since,
1239
1279
  deprecation : doclet && doclet.deprecated,
1240
1280
  experimental : doclet && doclet.experimental,
1241
- visibility : (settings.visibility && settings.visibility.value.value) || "public",
1281
+ visibility: collectVisibilityInfo(settings, doclet, oClassInfo.name, n),
1282
+ stakeholders: doclet && doclet.__ui5 && doclet.__ui5.stakeholders,
1242
1283
  type : settings.type ? settings.type.value.value : "any"
1243
1284
  };
1244
1285
  });
@@ -1246,32 +1287,38 @@ function collectClassInfo(extendCall, classDoclet) {
1246
1287
  oClassInfo.defaultProperty = (metadata.defaultProperty && metadata.defaultProperty.value.value) || undefined;
1247
1288
 
1248
1289
  each(metadata.properties, "type", (n, settings, doclet) => {
1249
- let type;
1250
1290
  const N = upper(n);
1251
1291
  let methods;
1292
+ const dataType = settings.type ? settings.type.value.value : "string";
1252
1293
  oClassInfo.properties[n] = {
1253
- name : n,
1254
- doc : doclet && doclet.description,
1255
- since : doclet && doclet.since,
1256
- deprecation : doclet && doclet.deprecated,
1257
- experimental : doclet && doclet.experimental,
1258
- visibility : (settings.visibility && settings.visibility.value.value) || "public",
1259
- type : (type = settings.type ? settings.type.value.value : "string"),
1260
- defaultValue : settings.defaultValue ? convertValueWithRaw(settings.defaultValue.value, type, n) : null,
1261
- group : settings.group ? settings.group.value.value : 'Misc',
1262
- bindable : settings.bindable ? !!convertValue(settings.bindable.value) : false,
1294
+ name: n,
1295
+ doc: doclet && doclet.description,
1296
+ since: doclet && doclet.since,
1297
+ deprecation: doclet && doclet.deprecated,
1298
+ experimental: doclet && doclet.experimental,
1299
+ visibility: collectVisibilityInfo(settings, doclet, oClassInfo.name, n),
1300
+ stakeholders: doclet && doclet.__ui5 && doclet.__ui5.stakeholders,
1301
+ type: dataType,
1302
+ defaultValue: settings.defaultValue ? convertValueWithRaw(settings.defaultValue.value, dataType, n) : null,
1303
+ group: settings.group ? settings.group.value.value : 'Misc',
1304
+ bindable: settings.bindable ? !!convertValue(settings.bindable.value) : false,
1263
1305
  methods: (methods = {
1264
1306
  "get": "get" + N,
1265
1307
  "set": "set" + N
1266
1308
  })
1267
1309
  };
1268
- if ( oClassInfo.properties[n].bindable ) {
1310
+ if (oClassInfo.properties[n].bindable) {
1269
1311
  methods["bind"] = "bind" + N;
1270
1312
  methods["unbind"] = "unbind" + N;
1271
1313
  }
1272
- // if ( !settings.defaultValue ) {
1273
- // console.log("property without defaultValue: " + oClassInfo.name + "." + n);
1274
- //}
1314
+ // Check for @type definition
1315
+ if (doclet?.type?.names) {
1316
+ oClassInfo.properties[n].type = doclet?.type?.names.join('|');
1317
+
1318
+ if (oClassInfo.properties[n].type !== dataType) {
1319
+ oClassInfo.properties[n].dataType = dataType;
1320
+ }
1321
+ }
1275
1322
  });
1276
1323
 
1277
1324
  oClassInfo.defaultAggregation = (metadata.defaultAggregation && metadata.defaultAggregation.value.value) || undefined;
@@ -1279,13 +1326,15 @@ function collectClassInfo(extendCall, classDoclet) {
1279
1326
  each(metadata.aggregations, "type", (n, settings, doclet) => {
1280
1327
  const N = upper(n);
1281
1328
  let methods;
1329
+
1282
1330
  const aggr = oClassInfo.aggregations[n] = {
1283
1331
  name: n,
1284
1332
  doc : doclet && doclet.description,
1285
1333
  deprecation : doclet && doclet.deprecated,
1286
1334
  since : doclet && doclet.since,
1287
1335
  experimental : doclet && doclet.experimental,
1288
- visibility : (settings.visibility && settings.visibility.value.value) || "public",
1336
+ visibility: collectVisibilityInfo(settings, doclet, oClassInfo.name, n),
1337
+ stakeholders: doclet && doclet.__ui5 && doclet.__ui5.stakeholders,
1289
1338
  type : settings.type ? settings.type.value.value : "sap.ui.core.Control",
1290
1339
  altTypes: settings.altTypes ? convertStringArray(settings.altTypes.value) : undefined,
1291
1340
  singularName : settings.singularName ? settings.singularName.value.value : guessSingularName(n),
@@ -1318,13 +1367,15 @@ function collectClassInfo(extendCall, classDoclet) {
1318
1367
  each(metadata.associations, "type", (n, settings, doclet) => {
1319
1368
  const N = upper(n);
1320
1369
  let methods;
1370
+
1321
1371
  oClassInfo.associations[n] = {
1322
1372
  name: n,
1323
1373
  doc : doclet && doclet.description,
1324
1374
  deprecation : doclet && doclet.deprecated,
1325
1375
  since : doclet && doclet.since,
1326
1376
  experimental : doclet && doclet.experimental,
1327
- visibility : (settings.visibility && settings.visibility.value.value) || "public",
1377
+ visibility: collectVisibilityInfo(settings, doclet, oClassInfo.name, n),
1378
+ stakeholders: doclet && doclet.__ui5 && doclet.__ui5.stakeholders,
1328
1379
  type : settings.type ? settings.type.value.value : "sap.ui.core.Control",
1329
1380
  singularName : settings.singularName ? settings.singularName.value.value : guessSingularName(n),
1330
1381
  cardinality : (settings.multiple && settings.multiple.value.value) ? "0..n" : "0..1",
@@ -1344,13 +1395,15 @@ function collectClassInfo(extendCall, classDoclet) {
1344
1395
 
1345
1396
  each(metadata.events, null, (n, settings, doclet) => {
1346
1397
  const N = upper(n);
1398
+
1347
1399
  const info = oClassInfo.events[n] = {
1348
1400
  name: n,
1349
1401
  doc : doclet && doclet.description,
1350
1402
  deprecation : doclet && doclet.deprecated,
1351
1403
  since : doclet && doclet.since,
1352
1404
  experimental : doclet && doclet.experimental,
1353
- visibility : /* (settings.visibility && settings.visibility.value.value) || */ "public",
1405
+ visibility: collectVisibilityInfo(settings, doclet, oClassInfo.name, n),
1406
+ stakeholders: doclet && doclet.__ui5 && doclet.__ui5.stakeholders,
1354
1407
  allowPreventDefault : !!(settings.allowPreventDefault && settings.allowPreventDefault.value.value),
1355
1408
  enableEventBubbling : !!(settings.enableEventBubbling && settings.enableEventBubbling.value.value),
1356
1409
  parameters : {},
@@ -1710,17 +1763,24 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1710
1763
  // return s.slice(s.lastIndexOf('.') + 1);
1711
1764
  // }
1712
1765
 
1713
- function createVisibilityTags(doclet) {
1714
- const access = (doclet && doclet.access) || "public";
1766
+ function createVisibilityTags(access, stakeholders) {
1715
1767
  if ( access === "restricted" ) {
1716
1768
  return [
1717
1769
  "@private",
1718
- "@ui5-restricted" + (doclet.__ui5 && Array.isArray(doclet.__ui5.stakeholders) ? " " + doclet.__ui5.stakeholders.join(", ") : "")
1770
+ "@ui5-restricted" + (Array.isArray(stakeholders) ? " " + stakeholders.join(", ") : "")
1719
1771
  ];
1720
1772
  }
1721
1773
  return "@" + access;
1722
1774
  }
1723
1775
 
1776
+ function createVisibilityTagsForSetting(settingInfo, classAccess) {
1777
+ let access = settingInfo.visibility ?? "public";
1778
+ if ( classAccess === "restricted" && (access === "public" || access === "protected")) {
1779
+ access = "restricted";
1780
+ }
1781
+ return createVisibilityTags(access, settingInfo.stakeholders);
1782
+ }
1783
+
1724
1784
  const HUNGARIAN_PREFIXES = {
1725
1785
  'int' : 'i',
1726
1786
  'boolean' : 'b',
@@ -1761,7 +1821,8 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1761
1821
  const m = /(?:^|\r\n|\n|\r)[ \t]*\**[ \t]*@[a-zA-Z]/.exec(rawClassComment);
1762
1822
  const p = m ? m.index : -1;
1763
1823
  const hasSettingsDocs = rawClassComment.indexOf("The supported settings are:") >= 0;
1764
- const visibility = createVisibilityTags(doclet);
1824
+ const classAccess = doclet?.access ?? "public";
1825
+ const visibility = createVisibilityTags(classAccess, doclet?.__ui5?.stakeholders);
1765
1826
  const thisClass = 'this'; // oClassInfo.name
1766
1827
 
1767
1828
  // heuristic to recognize a ManagedObject
@@ -1916,6 +1977,8 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1916
1977
  if ( info.visibility === 'hidden' ) {
1917
1978
  continue;
1918
1979
  }
1980
+ const visibilityTags = createVisibilityTagsForSetting(info, classAccess);
1981
+
1919
1982
  // link = newStyle ? "{@link #setting:" + n + " " + n + "}" : "<code>" + n + "</code>";
1920
1983
  link = "{@link " + (newStyle ? "#setting:" + n : rname("get", n)) + " " + n + "}";
1921
1984
  newJSDoc([
@@ -1930,7 +1993,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1930
1993
  info.since ? "@since " + info.since : "",
1931
1994
  info.deprecation ? "@deprecated " + info.deprecation : "",
1932
1995
  info.experimental ? "@experimental " + info.experimental : "",
1933
- visibility,
1996
+ visibilityTags,
1934
1997
  "@name " + name("get", n),
1935
1998
  "@function"
1936
1999
  ]);
@@ -1949,7 +2012,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1949
2012
  info.since ? "@since " + info.since : "",
1950
2013
  info.deprecation ? "@deprecated " + info.deprecation : "",
1951
2014
  info.experimental ? "@experimental " + info.experimental : "",
1952
- visibility,
2015
+ visibilityTags,
1953
2016
  "@name " + name("set", n),
1954
2017
  "@function"
1955
2018
  ]);
@@ -1964,7 +2027,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1964
2027
  info.since ? "@since " + info.since : "",
1965
2028
  info.deprecation ? "@deprecated " + info.deprecation : "",
1966
2029
  info.experimental ? "@experimental " + info.experimental : "",
1967
- visibility,
2030
+ visibilityTags,
1968
2031
  "@name " + name("bind", n),
1969
2032
  "@function"
1970
2033
  ]);
@@ -1974,7 +2037,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1974
2037
  info.since ? "@since " + info.since : "",
1975
2038
  info.deprecation ? "@deprecated " + info.deprecation : "",
1976
2039
  info.experimental ? "@experimental " + info.experimental : "",
1977
- visibility,
2040
+ visibilityTags,
1978
2041
  "@name " + name("unbind", n),
1979
2042
  "@function"
1980
2043
  ]);
@@ -1986,6 +2049,8 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1986
2049
  if ( info.visibility === 'hidden' ) {
1987
2050
  continue;
1988
2051
  }
2052
+ const visibilityTags = createVisibilityTagsForSetting(info, classAccess);
2053
+
1989
2054
  // link = newStyle ? "{@link #setting:" + n + " " + n + "}" : "<code>" + n + "</code>";
1990
2055
  link = "{@link " + (newStyle ? "#setting:" + n : rname("get", n)) + " " + n + "}";
1991
2056
  newJSDoc([
@@ -1998,7 +2063,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1998
2063
  info.since ? "@since " + info.since : "",
1999
2064
  info.deprecation ? "@deprecated " + info.deprecation : "",
2000
2065
  info.experimental ? "@experimental " + info.experimental : "",
2001
- visibility,
2066
+ visibilityTags,
2002
2067
  "@name " + name("get", n),
2003
2068
  "@function"
2004
2069
  ]);
@@ -2018,7 +2083,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2018
2083
  info.since ? "@since " + info.since : "",
2019
2084
  info.deprecation ? "@deprecated " + info.deprecation : "",
2020
2085
  info.experimental ? "@experimental " + info.experimental : "",
2021
- visibility,
2086
+ visibilityTags,
2022
2087
  "@name " + name("insert", n1),
2023
2088
  "@function"
2024
2089
  ]);
@@ -2031,7 +2096,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2031
2096
  info.since ? "@since " + info.since : "",
2032
2097
  info.deprecation ? "@deprecated " + info.deprecation : "",
2033
2098
  info.experimental ? "@experimental " + info.experimental : "",
2034
- visibility,
2099
+ visibilityTags,
2035
2100
  "@name " + name("add", n1),
2036
2101
  "@function"
2037
2102
  ]);
@@ -2043,7 +2108,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2043
2108
  info.since ? "@since " + info.since : "",
2044
2109
  info.deprecation ? "@deprecated " + info.deprecation : "",
2045
2110
  info.experimental ? "@experimental " + info.experimental : "",
2046
- visibility,
2111
+ visibilityTags,
2047
2112
  "@name " + name("remove", n1),
2048
2113
  "@function"
2049
2114
  ]);
@@ -2055,7 +2120,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2055
2120
  info.since ? "@since " + info.since : "",
2056
2121
  info.deprecation ? "@deprecated " + info.deprecation : "",
2057
2122
  info.experimental ? "@experimental " + info.experimental : "",
2058
- visibility,
2123
+ visibilityTags,
2059
2124
  "@name " + name("removeAll", n),
2060
2125
  "@function"
2061
2126
  ]);
@@ -2068,7 +2133,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2068
2133
  info.since ? "@since " + info.since : "",
2069
2134
  info.deprecation ? "@deprecated " + info.deprecation : "",
2070
2135
  info.experimental ? "@experimental " + info.experimental : "",
2071
- visibility,
2136
+ visibilityTags,
2072
2137
  "@name " + name("indexOf", n1),
2073
2138
  "@function"
2074
2139
  ]);
@@ -2080,7 +2145,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2080
2145
  info.since ? "@since " + info.since : "",
2081
2146
  info.deprecation ? "@deprecated " + info.deprecation : "",
2082
2147
  info.experimental ? "@experimental " + info.experimental : "",
2083
- visibility,
2148
+ visibilityTags,
2084
2149
  "@name " + name("set", n),
2085
2150
  "@function"
2086
2151
  ]);
@@ -2091,7 +2156,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2091
2156
  info.since ? "@since " + info.since : "",
2092
2157
  info.deprecation ? "@deprecated " + info.deprecation : "",
2093
2158
  info.experimental ? "@experimental " + info.experimental : "",
2094
- visibility,
2159
+ visibilityTags,
2095
2160
  "@name " + name("destroy", n),
2096
2161
  "@function"
2097
2162
  ]);
@@ -2106,7 +2171,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2106
2171
  info.since ? "@since " + info.since : "",
2107
2172
  info.deprecation ? "@deprecated " + info.deprecation : "",
2108
2173
  info.experimental ? "@experimental " + info.experimental : "",
2109
- visibility,
2174
+ visibilityTags,
2110
2175
  "@name " + name("bind", n),
2111
2176
  "@function"
2112
2177
  ]);
@@ -2116,7 +2181,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2116
2181
  info.since ? "@since " + info.since : "",
2117
2182
  info.deprecation ? "@deprecated " + info.deprecation : "",
2118
2183
  info.experimental ? "@experimental " + info.experimental : "",
2119
- visibility,
2184
+ visibilityTags,
2120
2185
  "@name " + name("unbind", n),
2121
2186
  "@function"
2122
2187
  ]);
@@ -2128,6 +2193,8 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2128
2193
  if ( info.visibility === 'hidden' ) {
2129
2194
  continue;
2130
2195
  }
2196
+ const visibilityTags = createVisibilityTagsForSetting(info, classAccess);
2197
+
2131
2198
  // link = newStyle ? "{@link #setting:" + n + " " + n + "}" : "<code>" + n + "</code>";
2132
2199
  link = "{@link " + (newStyle ? "#setting:" + n : rname("get", n)) + " " + n + "}";
2133
2200
  newJSDoc([
@@ -2141,7 +2208,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2141
2208
  info.since ? "@since " + info.since : "",
2142
2209
  info.deprecation ? "@deprecated " + info.deprecation : "",
2143
2210
  info.experimental ? "@experimental " + info.experimental : "",
2144
- visibility,
2211
+ visibilityTags,
2145
2212
  "@name " + name("get", n),
2146
2213
  "@function"
2147
2214
  ]);
@@ -2155,7 +2222,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2155
2222
  info.since ? "@since " + info.since : "",
2156
2223
  info.deprecation ? "@deprecated " + info.deprecation : "",
2157
2224
  info.experimental ? "@experimental " + info.experimental : "",
2158
- visibility,
2225
+ visibilityTags,
2159
2226
  "@name " + name("add", n1),
2160
2227
  "@function"
2161
2228
  ]);
@@ -2166,7 +2233,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2166
2233
  info.since ? "@since " + info.since : "",
2167
2234
  info.deprecation ? "@deprecated " + info.deprecation : "",
2168
2235
  info.experimental ? "@experimental " + info.experimental : "",
2169
- visibility,
2236
+ visibilityTags,
2170
2237
  "@name " + name("remove", n1),
2171
2238
  "@function"
2172
2239
  ]);
@@ -2176,7 +2243,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2176
2243
  info.since ? "@since " + info.since : "",
2177
2244
  info.deprecation ? "@deprecated " + info.deprecation : "",
2178
2245
  info.experimental ? "@experimental " + info.experimental : "",
2179
- visibility,
2246
+ visibilityTags,
2180
2247
  "@name " + name("removeAll", n),
2181
2248
  "@function"
2182
2249
  ]);
@@ -2188,7 +2255,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2188
2255
  info.since ? "@since " + info.since : "",
2189
2256
  info.deprecation ? "@deprecated " + info.deprecation : "",
2190
2257
  info.experimental ? "@experimental " + info.experimental : "",
2191
- visibility,
2258
+ visibilityTags,
2192
2259
  "@name " + name("set", n),
2193
2260
  "@function"
2194
2261
  ]);
@@ -2197,6 +2264,8 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2197
2264
 
2198
2265
  for (let n in oClassInfo.events ) {
2199
2266
  const info = oClassInfo.events[n];
2267
+ const visibilityTags = createVisibilityTagsForSetting(info, classAccess);
2268
+
2200
2269
  //link = newStyle ? "{@link #event:" + n + " " + n + "}" : "<code>" + n + "</code>";
2201
2270
  link = "{@link #event:" + n + " " + n + "}";
2202
2271
 
@@ -2221,7 +2290,8 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2221
2290
  "@param {" + (info.parameters[pName].type || "") + "} oControlEvent.getParameters." + pName + " " + (info.parameters[pName].doc || "")
2222
2291
  );
2223
2292
  }
2224
- lines.push(visibility);
2293
+ lines.push(visibilityTags);
2294
+
2225
2295
  newJSDoc(lines);
2226
2296
 
2227
2297
  newJSDoc([
@@ -2240,7 +2310,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2240
2310
  " [oListener] Context object to call the event handler with. Defaults to this <code>" + oClassInfo.name + "</code> itself",
2241
2311
  "",
2242
2312
  "@returns {" + thisClass + "} Reference to <code>this</code> in order to allow method chaining",
2243
- visibility,
2313
+ visibilityTags,
2244
2314
  info.since ? "@since " + info.since : "",
2245
2315
  info.deprecation ? "@deprecated " + info.deprecation : "",
2246
2316
  info.experimental ? "@experimental " + info.experimental : "",
@@ -2260,7 +2330,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2260
2330
  info.since ? "@since " + info.since : "",
2261
2331
  info.deprecation ? "@deprecated " + info.deprecation : "",
2262
2332
  info.experimental ? "@experimental " + info.experimental : "",
2263
- visibility,
2333
+ visibilityTags,
2264
2334
  "@name " + name("detach", n),
2265
2335
  "@function"
2266
2336
  ]);
@@ -2293,8 +2363,17 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
2293
2363
  } else {
2294
2364
  lines.push("@returns {" + thisClass + "} Reference to <code>this</code> in order to allow method chaining");
2295
2365
  }
2366
+
2367
+ let vis = "protected"; // default, when event and class are public
2368
+ if (info.visibility !== "public") {
2369
+ vis = info.visibility; // reduced JSDoc visibility of event
2370
+ }
2371
+ if (classAccess === "restricted") {
2372
+ vis = "restricted"; // reduced visibility of class
2373
+ }
2374
+
2296
2375
  lines.push(
2297
- visibility === "@public" ? "@protected" : visibility,
2376
+ createVisibilityTags(vis, info.stakeholders),
2298
2377
  info.since ? "@since " + info.since : "",
2299
2378
  info.deprecation ? "@deprecated " + info.deprecation : "",
2300
2379
  info.experimental ? "@experimental " + info.experimental : "",
@@ -2607,7 +2686,14 @@ exports.defineTags = function(dictionary) {
2607
2686
  }
2608
2687
  }
2609
2688
  });
2610
-
2689
+ dictionary.defineTag('ui5-module-override', {
2690
+ onTagged: function(doclet, tag) {
2691
+ if ( tag.value ) {
2692
+ const args = tag.value.trim().split(/\s+/);
2693
+ ui5data(doclet).moduleOverride = [ args[0], args[1] ?? ""];
2694
+ }
2695
+ }
2696
+ });
2611
2697
  /**
2612
2698
  * Mark a doclet as synthetic.
2613
2699
  *
@@ -2786,6 +2872,11 @@ exports.handlers = {
2786
2872
  debug("found matching local declaration", e.doclet.longname, "'" + localDecl.export + "'", currentModule.defaultExport);
2787
2873
  _ui5data.export = localDecl.export;
2788
2874
  }
2875
+ if ( _ui5data.moduleOverride ) {
2876
+ _ui5data.resource = _ui5data.moduleOverride[0] + ".js";
2877
+ _ui5data.module = _ui5data.moduleOverride[0];
2878
+ _ui5data.export = _ui5data.moduleOverride[1];
2879
+ }
2789
2880
  }
2790
2881
 
2791
2882
 
@@ -1610,6 +1610,9 @@ function createAPIJSON4Symbol(symbol, omitDefaults) {
1610
1610
  attrib("name", special.name);
1611
1611
  attrib("type", special.type);
1612
1612
  attrib("visibility", special.visibility, 'public');
1613
+ if (special.stakeholders) {
1614
+ stakeholderList("allowedFor", special.stakeholders);
1615
+ }
1613
1616
  attribSince(special.since);
1614
1617
  tag("description", normalizeWS(special.doc), true);
1615
1618
  tagWithSince("experimental", special.experimental);
@@ -1632,9 +1635,18 @@ function createAPIJSON4Symbol(symbol, omitDefaults) {
1632
1635
  tag("property");
1633
1636
  attrib("name", prop.name);
1634
1637
  attrib("type", prop.type, 'string');
1638
+
1639
+ if (prop.dataType) {
1640
+ attrib("dataType", prop.dataType, 'string');
1641
+ }
1642
+
1635
1643
  attrib("defaultValue", defaultValue, null, /* raw = */true);
1636
1644
  attrib("group", prop.group, 'Misc');
1637
1645
  attrib("visibility", prop.visibility, 'public');
1646
+ if (prop.stakeholders) {
1647
+ stakeholderList("allowedFor", prop.stakeholders);
1648
+ }
1649
+
1638
1650
  attribSince(prop.since);
1639
1651
  if ( prop.bindable ) {
1640
1652
  attrib("bindable", prop.bindable, false, /* raw = */true);
@@ -1669,6 +1681,10 @@ function createAPIJSON4Symbol(symbol, omitDefaults) {
1669
1681
  }
1670
1682
  attrib("cardinality", aggr.cardinality, '0..n');
1671
1683
  attrib("visibility", aggr.visibility, 'public');
1684
+ if (aggr.stakeholders) {
1685
+ stakeholderList("allowedFor", aggr.stakeholders);
1686
+ }
1687
+
1672
1688
  attribSince(aggr.since);
1673
1689
  if ( aggr.bindable ) {
1674
1690
  attrib("bindable", aggr.bindable, false, /* raw = */true);
@@ -1699,6 +1715,10 @@ function createAPIJSON4Symbol(symbol, omitDefaults) {
1699
1715
  attrib("type", assoc.type, 'sap.ui.core.Control');
1700
1716
  attrib("cardinality", assoc.cardinality, '0..1');
1701
1717
  attrib("visibility", assoc.visibility, 'public');
1718
+ if (assoc.stakeholders) {
1719
+ stakeholderList("allowedFor", assoc.stakeholders);
1720
+ }
1721
+
1702
1722
  attribSince(assoc.since);
1703
1723
  tag("description", normalizeWS(assoc.doc), true);
1704
1724
  tagWithSince("experimental", assoc.experimental);
@@ -1716,6 +1736,9 @@ function createAPIJSON4Symbol(symbol, omitDefaults) {
1716
1736
  tag("event");
1717
1737
  attrib("name", event.name);
1718
1738
  attrib("visibility", event.visibility, 'public');
1739
+ if (event.stakeholders) {
1740
+ stakeholderList("allowedFor", event.stakeholders);
1741
+ }
1719
1742
  if ( event.allowPreventDefault ) {
1720
1743
  attrib("allowPreventDefault", event.allowPreventDefault, false, /* raw = */true);
1721
1744
  }
@@ -2285,7 +2308,7 @@ function createAPIJSON4Symbol(symbol, omitDefaults) {
2285
2308
  if ( symbol.__ui5.stereotype !== 'xmlmacro' && ownMethods.length > 0 ) {
2286
2309
  collection("methods");
2287
2310
  ownMethods.forEach(function(member) {
2288
- writeMethod(member, undefined, symbol.kind === 'interface');
2311
+ writeMethod(member, undefined, symbol.kind === 'interface' || symbol.kind === 'class');
2289
2312
  if ( member.__ui5.members ) {
2290
2313
  // HACK: export nested static functions as siblings of the current function
2291
2314
  // A correct representation has to be discussed with the SDK / WebIDE
@@ -2,6 +2,7 @@ import posixPath from "node:path/posix";
2
2
  import {getLogger} from "@ui5/logger";
3
3
  const log = getLogger("builder:tasks:generateThemeDesignerResources");
4
4
  import libraryLessGenerator from "../processors/libraryLessGenerator.js";
5
+ import {updateLibraryDotTheming} from "./utils/dotTheming.js";
5
6
  import ReaderCollectionPrioritized from "@ui5/fs/ReaderCollectionPrioritized";
6
7
  import Resource from "@ui5/fs/Resource";
7
8
  import fsInterface from "@ui5/fs/fsInterface";
@@ -44,6 +45,10 @@ function generateLibraryDotTheming({namespace, version, hasThemes}) {
44
45
  sVersion: version
45
46
  };
46
47
 
48
+ // Note that with sap.ui.core version 1.127.0 the .theming file has been put into
49
+ // the library sources so that "aFiles" can be maintained from there.
50
+ // The below configuration is still needed for older versions of sap.ui.core which do not
51
+ // contain the file.
47
52
  if (namespace === "sap/ui/core") {
48
53
  dotTheming.aFiles = [
49
54
  "library",
@@ -241,12 +246,33 @@ export default async function({workspace, dependencies, options}) {
241
246
  // Only for type "library". Type "theme-library" does not provide a namespace
242
247
  // Also needs to be created in case a library does not have any themes (see bIgnore flag)
243
248
  if (namespace) {
244
- log.verbose(`Generating .theming for namespace ${namespace}`);
245
- const libraryDotThemingResource = generateLibraryDotTheming({
246
- namespace,
247
- version,
248
- hasThemes
249
- });
249
+ let libraryDotThemingResource;
250
+
251
+ // Do not generate a .theming file for the sap.ui.core library
252
+ if (namespace === "sap/ui/core") {
253
+ // Check if the .theming file already exists
254
+ libraryDotThemingResource = await workspace.byPath(`/resources/${namespace}/.theming`);
255
+ if (libraryDotThemingResource) {
256
+ // Update the existing .theming resource
257
+ log.verbose(`Updating .theming for namespace ${namespace}`);
258
+ await updateLibraryDotTheming({
259
+ resource: libraryDotThemingResource,
260
+ namespace,
261
+ version,
262
+ hasThemes
263
+ });
264
+ }
265
+ }
266
+
267
+ if (!libraryDotThemingResource) {
268
+ log.verbose(`Generating .theming for namespace ${namespace}`);
269
+ libraryDotThemingResource = generateLibraryDotTheming({
270
+ namespace,
271
+ version,
272
+ hasThemes
273
+ });
274
+ }
275
+
250
276
  await workspace.write(libraryDotThemingResource);
251
277
  }
252
278
 
@@ -0,0 +1,33 @@
1
+ export async function updateLibraryDotTheming({resource, namespace, version, hasThemes}) {
2
+ const dotTheming = JSON.parse(await resource.getString());
3
+
4
+ if (!dotTheming.sEntity) {
5
+ throw new Error(`Missing 'sEntity' property in ${resource.getPath()}`);
6
+ }
7
+
8
+ if (dotTheming.sEntity !== "Library") {
9
+ throw new Error(
10
+ `Incorrect 'sEntity' value '${dotTheming.sEntity}' in ${resource.getPath()}: ` +
11
+ `Expected 'Library'`
12
+ );
13
+ }
14
+
15
+ if (!dotTheming.sId) {
16
+ throw new Error(`Missing 'sId' property in ${resource.getPath()}`);
17
+ }
18
+
19
+ if (dotTheming.sId !== namespace) {
20
+ throw new Error(`Incorrect 'sId' value '${dotTheming.sId}' in ${resource.getPath()}: Expected '${namespace}'`);
21
+ }
22
+
23
+ dotTheming.sVersion = version;
24
+
25
+ if (!hasThemes) {
26
+ // Set ignore flag when there are no themes at all
27
+ // This is important in case a library used to contain themes that have been removed
28
+ // in a later version of the library.
29
+ dotTheming.bIgnore = true;
30
+ }
31
+
32
+ resource.setString(JSON.stringify(dotTheming, null, 2));
33
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "3.4.1",
3
+ "version": "3.5.1",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -22,6 +22,7 @@
22
22
  "./processors/jsdoc/lib/*": null,
23
23
  "./tasks/*": "./lib/tasks/*.js",
24
24
  "./tasks/taskRepository": null,
25
+ "./tasks/utils/*": null,
25
26
  "./tasks/bundlers/utils/*": null,
26
27
  "./package.json": "./package.json",
27
28
  "./internal/taskRepository": "./lib/tasks/taskRepository.js",
@@ -118,7 +119,7 @@
118
119
  "url": "git@github.com:SAP/ui5-builder.git"
119
120
  },
120
121
  "dependencies": {
121
- "@jridgewell/sourcemap-codec": "^1.4.15",
122
+ "@jridgewell/sourcemap-codec": "^1.5.0",
122
123
  "@ui5/fs": "^3.0.5",
123
124
  "@ui5/logger": "^3.0.0",
124
125
  "cheerio": "1.0.0-rc.12",
@@ -129,16 +130,16 @@
129
130
  "jsdoc": "^4.0.3",
130
131
  "less-openui5": "^0.11.6",
131
132
  "pretty-data": "^0.40.0",
132
- "rimraf": "^5.0.6",
133
- "semver": "^7.6.2",
134
- "terser": "^5.31.0",
133
+ "rimraf": "^5.0.9",
134
+ "semver": "^7.6.3",
135
+ "terser": "^5.31.3",
135
136
  "workerpool": "^6.5.1",
136
137
  "xml2js": "^0.6.2"
137
138
  },
138
139
  "devDependencies": {
139
140
  "@istanbuljs/esm-loader-hook": "^0.2.0",
140
141
  "@jridgewell/trace-mapping": "^0.3.25",
141
- "@ui5/project": "^3.9.1",
142
+ "@ui5/project": "^3.9.2",
142
143
  "ava": "^5.3.1",
143
144
  "chai": "^4.4.1",
144
145
  "chai-fs": "^2.0.0",
@@ -150,7 +151,7 @@
150
151
  "eslint-config-google": "^0.14.0",
151
152
  "eslint-plugin-ava": "^14.0.0",
152
153
  "eslint-plugin-jsdoc": "^46.10.1",
153
- "esmock": "^2.6.5",
154
+ "esmock": "^2.6.7",
154
155
  "line-column": "^1.0.2",
155
156
  "nyc": "^15.1.0",
156
157
  "open-cli": "^7.2.0",