@ui5/builder 4.0.3 → 4.0.5

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,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.0.3...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v4.0.5...HEAD).
6
+
7
+ <a name="v4.0.5"></a>
8
+ ## [v4.0.5] - 2024-12-10
9
+
10
+ <a name="v4.0.4"></a>
11
+ ## [v4.0.4] - 2024-11-29
12
+ ### Dependency Updates
13
+ - Switch from "rimraf" to native "fs.rm" ([#1098](https://github.com/SAP/ui5-builder/issues/1098)) [`0adf4da`](https://github.com/SAP/ui5-builder/commit/0adf4da0e747f1fb46cf0bf0da7b3e0af8e9bcec)
14
+
6
15
 
7
16
  <a name="v4.0.3"></a>
8
17
  ## [v4.0.3] - 2024-08-27
@@ -935,6 +944,8 @@ to load the custom bundle file instead.
935
944
 
936
945
  ### Features
937
946
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
947
+ [v4.0.5]: https://github.com/SAP/ui5-builder/compare/v4.0.4...v4.0.5
948
+ [v4.0.4]: https://github.com/SAP/ui5-builder/compare/v4.0.3...v4.0.4
938
949
  [v4.0.3]: https://github.com/SAP/ui5-builder/compare/v4.0.2...v4.0.3
939
950
  [v4.0.2]: https://github.com/SAP/ui5-builder/compare/v4.0.1...v4.0.2
940
951
  [v4.0.1]: https://github.com/SAP/ui5-builder/compare/v4.0.0...v4.0.1
@@ -39,12 +39,12 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
39
39
  log.info("Using custom fs");
40
40
  }
41
41
  if (returnOutputFiles) {
42
- log.info("Returning output files instead of writing to fs.")
42
+ log.info("Returning output files instead of writing to fs.");
43
43
  }
44
44
  log.info("");
45
45
 
46
46
  // Deprecated, Experimental and Since collections
47
- let oListCollection = {
47
+ const oListCollection = {
48
48
  deprecated: {
49
49
  noVersion: {
50
50
  apis: []
@@ -63,13 +63,11 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
63
63
  fs.readFile(file, 'utf8', function (err, data) {
64
64
  if (err) {
65
65
  reject(err);
66
- } else {
66
+ } else if (data.trim() === "") {
67
67
  // Handle empty files scenario
68
- if (data.trim() === "") {
69
- resolve({});
70
- } else {
71
- resolve(JSON.parse(String(data)));
72
- }
68
+ resolve({});
69
+ } else {
70
+ resolve(JSON.parse(String(data)));
73
71
  }
74
72
  });
75
73
  });
@@ -102,20 +100,20 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
102
100
  * Returns a promise that resolves with an array of symbols.
103
101
  */
104
102
  function createSymbolSummaryForLib(lib) {
105
- let file = path.join(unpackedTestresourcesRoot, lib.replace(/\./g, "/"), "designtime/api.json");
103
+ const file = path.join(unpackedTestresourcesRoot, lib.replace(/\./g, "/"), "designtime/api.json");
106
104
 
107
105
  return readJSONFile(file).then(function (apijson) {
108
106
  if (!apijson.hasOwnProperty("symbols") || !Array.isArray(apijson.symbols)) {
109
107
  // Ignore libraries with invalid api.json content like empty object or non-array "symbols" property.
110
108
  return [];
111
109
  }
112
- return apijson.symbols.map(symbol => {
113
- let oReturn = {
110
+ return apijson.symbols.map((symbol) => {
111
+ const oReturn = {
114
112
  name: symbol.name,
115
113
  kind: symbol.kind,
116
114
  visibility: symbol.visibility,
117
- extends: symbol.extends,
118
- implements: symbol.implements,
115
+ "extends": symbol.extends,
116
+ "implements": symbol.implements,
119
117
  lib: lib
120
118
  };
121
119
  // We add deprecated member only when the control is deprecated to keep file size at check
@@ -132,7 +130,7 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
132
130
  collectLists(symbol);
133
131
  return oReturn;
134
132
  });
135
- })
133
+ });
136
134
  }
137
135
 
138
136
  /*
@@ -146,7 +144,7 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
146
144
  const sText = oDataType !== "since" ? oEntityObject[oDataType].text : oEntityObject.description;
147
145
  const oData = {
148
146
  control: sSymbolName,
149
- text: sText || undefined,
147
+ text: sText || undefined,
150
148
  type: sObjectType,
151
149
  "static": !!oEntityObject.static,
152
150
  visibility: oEntityObject.visibility
@@ -159,7 +157,7 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
159
157
 
160
158
  if (sSince && sSince !== "undefined" /* Sometimes sSince comes as string "undefined" */) {
161
159
  // take only major and minor versions
162
- let sVersion = sSince.split(".").slice(0, 2).join(".");
160
+ const sVersion = sSince.split(".").slice(0, 2).join(".");
163
161
 
164
162
  oData.since = sSince;
165
163
 
@@ -190,7 +188,7 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
190
188
  }
191
189
 
192
190
  // Methods
193
- oSymbol.methods && oSymbol.methods.forEach(oMethod => {
191
+ oSymbol.methods?.forEach((oMethod) => {
194
192
  if (oMethod.deprecated) {
195
193
  addData("deprecated", oMethod, "methods", oSymbol.name);
196
194
  }
@@ -205,7 +203,7 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
205
203
  });
206
204
 
207
205
  // Events
208
- oSymbol.events && oSymbol.events.forEach(oEvent => {
206
+ oSymbol.events?.forEach((oEvent) => {
209
207
  if (oEvent.deprecated) {
210
208
  addData("deprecated", oEvent, "events", oSymbol.name);
211
209
  }
@@ -229,24 +227,24 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
229
227
  }
230
228
 
231
229
  function expandHierarchyInfo(symbols) {
232
- let byName = new Map();
233
- symbols.forEach(symbol => {
230
+ const byName = new Map();
231
+ symbols.forEach((symbol) => {
234
232
  byName.set(symbol.name, symbol);
235
233
  });
236
- symbols.forEach(symbol => {
237
- let parent = symbol.extends && byName.get(symbol.extends);
234
+ symbols.forEach((symbol) => {
235
+ const parent = symbol.extends && byName.get(symbol.extends);
238
236
  if (parent) {
239
- parent.extendedBy = parent.extendedBy ||  [];
237
+ parent.extendedBy = parent.extendedBy || [];
240
238
  parent.extendedBy.push({
241
239
  name: symbol.name,
242
240
  visibility: symbol.visibility
243
241
  });
244
242
  }
245
243
  if (symbol.implements) {
246
- symbol.implements.forEach(intfName => {
247
- let intf = byName.get(intfName);
244
+ symbol.implements.forEach((intfName) => {
245
+ const intf = byName.get(intfName);
248
246
  if (intf) {
249
- intf.implementedBy = intf.implementedBy ||  [];
247
+ intf.implementedBy = intf.implementedBy || [];
250
248
  intf.implementedBy.push({
251
249
  name: symbol.name,
252
250
  visibility: symbol.visibility
@@ -259,23 +257,23 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
259
257
  }
260
258
 
261
259
  function convertListToTree(symbols) {
262
- let aTree = [];
260
+ const aTree = [];
263
261
 
264
262
  // Filter out excluded libraries
265
263
  symbols = symbols.filter(({lib}) => ["sap.ui.documentation"].indexOf(lib) === -1);
266
264
 
267
265
  // Create treeName and displayName
268
- symbols.forEach(oSymbol => {
266
+ symbols.forEach((oSymbol) => {
269
267
  oSymbol.treeName = oSymbol.name.replace(/^module:/, "").replace(/\//g, ".");
270
268
  oSymbol.displayName = oSymbol.treeName.split(".").pop();
271
269
  });
272
270
 
273
271
  // Create missing - virtual namespaces
274
- symbols.forEach(oSymbol => {
272
+ symbols.forEach((oSymbol) => {
275
273
  oSymbol.treeName.split(".").forEach((sPart, i, a) => {
276
- let sName = a.slice(0, (i + 1)).join(".");
274
+ const sName = a.slice(0, (i + 1)).join(".");
277
275
 
278
- if (!symbols.find(o => o.treeName === sName)) {
276
+ if (!symbols.find((o) => o.treeName === sName)) {
279
277
  symbols.push({
280
278
  name: sName,
281
279
  treeName: sName,
@@ -289,13 +287,12 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
289
287
  });
290
288
 
291
289
  // Discover parents
292
- symbols.forEach(oSymbol => {
293
- let aParent = oSymbol.treeName.split("."),
294
- sParent;
290
+ symbols.forEach((oSymbol) => {
291
+ const aParent = oSymbol.treeName.split(".");
295
292
 
296
293
  // Extract parent name
297
294
  aParent.pop();
298
- sParent = aParent.join(".");
295
+ const sParent = aParent.join(".");
299
296
 
300
297
  // Mark parent
301
298
  if (symbols.find(({treeName}) => treeName === sParent)) {
@@ -305,20 +302,20 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
305
302
 
306
303
  // Sort the list before building the tree
307
304
  symbols.sort((a, b) => {
308
- let sA = a.treeName.toUpperCase(),
305
+ const sA = a.treeName.toUpperCase(),
309
306
  sB = b.treeName.toUpperCase();
310
307
 
311
- if (sA < sB) return -1;
312
- if (sA > sB) return 1;
308
+ if (sA < sB) {return -1;}
309
+ if (sA > sB) {return 1;}
313
310
  return 0;
314
311
  });
315
312
 
316
313
  // Build tree
317
- symbols.forEach(oSymbol => {
314
+ symbols.forEach((oSymbol) => {
318
315
  if (oSymbol.parent) {
319
- let oParent = symbols.find(({treeName}) => treeName === oSymbol.parent);
316
+ const oParent = symbols.find(({treeName}) => treeName === oSymbol.parent);
320
317
 
321
- if (!oParent.nodes) oParent.nodes = [];
318
+ if (!oParent.nodes) {oParent.nodes = [];}
322
319
  oParent.nodes.push(oSymbol);
323
320
  } else {
324
321
  aTree.push(oSymbol);
@@ -327,13 +324,13 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
327
324
 
328
325
  // Custom sort first level tree items - "sap" namespace should be on top
329
326
  aTree.sort((a, b) => {
330
- let sA = a.displayName.toUpperCase(),
327
+ const sA = a.displayName.toUpperCase(),
331
328
  sB = b.displayName.toUpperCase();
332
329
 
333
- if (sA === "SAP") return -1;
334
- if (sB === "SAP") return 1;
335
- if (sA < sB) return -1;
336
- if (sA > sB) return 1;
330
+ if (sA === "SAP") {return -1;}
331
+ if (sB === "SAP") {return 1;}
332
+ if (sA < sB) {return -1;}
333
+ if (sA > sB) {return 1;}
337
334
 
338
335
  return 0;
339
336
  });
@@ -349,10 +346,10 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
349
346
  delete oSymbol.treeName;
350
347
  delete oSymbol.parent;
351
348
  if (oSymbol.nodes) {
352
- oSymbol.nodes.forEach(o => cleanTree(o));
349
+ oSymbol.nodes.forEach((o) => cleanTree(o));
353
350
  }
354
351
  }
355
- aTree.forEach(o => cleanTree(o));
352
+ aTree.forEach((o) => cleanTree(o));
356
353
 
357
354
  return aTree;
358
355
  }
@@ -401,7 +398,7 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
401
398
  propagateFlags(oSymbol, { bAllContentDeprecated: true });
402
399
  } else {
403
400
  // 3. If all children are deprecated, then the parent is marked as content-deprecated
404
- oSymbol.bAllContentDeprecated = !!oSymbol.nodes && oSymbol.nodes.every(node => node.bAllContentDeprecated);
401
+ oSymbol.bAllContentDeprecated = !!oSymbol.nodes && oSymbol.nodes.every((node) => node.bAllContentDeprecated);
405
402
  }
406
403
  }
407
404
 
@@ -413,9 +410,9 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
413
410
  function propagateFlags(oSymbol, oFlags) {
414
411
  Object.assign(oSymbol, oFlags);
415
412
  if (oSymbol.nodes) {
416
- oSymbol.nodes.forEach(node => {
413
+ oSymbol.nodes.forEach((node) => {
417
414
  propagateFlags(node, oFlags);
418
- })
415
+ });
419
416
  }
420
417
  }
421
418
 
@@ -424,11 +421,11 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
424
421
  const filesToReturn = {};
425
422
 
426
423
  var p = readJSONFile(versionInfoFile)
427
- .then(versionInfo => {
424
+ .then((versionInfo) => {
428
425
  version = versionInfo.version;
429
426
  return Promise.all(
430
427
  versionInfo.libraries.map(
431
- lib => createSymbolSummaryForLib(lib.name).catch(err => {
428
+ (lib) => createSymbolSummaryForLib(lib.name).catch((err) => {
432
429
  // ignore 'file not found' errors as some libs don't have an api.json (themes, server libs)
433
430
  if (err.code === 'ENOENT') {
434
431
  return [];
@@ -441,8 +438,8 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
441
438
  .then(deepMerge)
442
439
  .then(expandHierarchyInfo)
443
440
  .then(convertListToTree)
444
- .then(symbols => {
445
- let result = {
441
+ .then((symbols) => {
442
+ const result = {
446
443
  "$schema-ref": "http://schemas.sap.com/sapui5/designtime/api-index.json/1.0",
447
444
  version: version,
448
445
  library: "*",
@@ -456,13 +453,13 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
456
453
  })
457
454
  .then(() => {
458
455
  /* Lists - modify and cleanup */
459
- let sortList = function (oList) {
456
+ const sortList = function (oList) {
460
457
  /* Sorting since records */
461
- let aKeys = Object.keys(oList),
458
+ const aKeys = Object.keys(oList),
462
459
  oSorted = {};
463
460
 
464
461
  aKeys.sort((a, b) => {
465
- let aA = a.split("."),
462
+ const aA = a.split("."),
466
463
  aB = b.split(".");
467
464
 
468
465
  if (a === "noVersion") {
@@ -478,7 +475,7 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
478
475
  b = [aB[0], ('0' + aB[1]).slice(-2)].join("");
479
476
 
480
477
  // Sort descending
481
- return parseInt(b, 10) - parseInt(a, 10);
478
+ return parseInt(b) - parseInt(a);
482
479
  });
483
480
 
484
481
  aKeys.forEach((sKey) => {
@@ -529,8 +526,8 @@ function createIndexFiles(versionInfoFile, unpackedTestresourcesRoot, targetFile
529
526
  ]);
530
527
  }
531
528
  })
532
- .catch(err => {
533
- log.error("**** failed to create API index for libraries:", err)
529
+ .catch((err) => {
530
+ log.error("**** failed to create API index for libraries:", err);
534
531
  throw err;
535
532
  });
536
533