@ui5/builder 3.5.0 → 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,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/v3.5.0...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
+
6
12
 
7
13
  <a name="v3.5.0"></a>
8
- ## [v3.5.0] - 2024-06-21
14
+ ## [v3.5.0] - 2024-06-24
9
15
  ### Features
10
16
  - ES2023 Support [`097049d`](https://github.com/SAP/ui5-builder/commit/097049daeec5c54c2d5e858b12e0c54c826ff663)
11
17
 
@@ -878,6 +884,7 @@ to load the custom bundle file instead.
878
884
 
879
885
  ### Features
880
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
881
888
  [v3.5.0]: https://github.com/SAP/ui5-builder/compare/v3.4.1...v3.5.0
882
889
  [v3.4.1]: https://github.com/SAP/ui5-builder/compare/v3.4.0...v3.4.1
883
890
  [v3.4.0]: https://github.com/SAP/ui5-builder/compare/v3.3.1...v3.4.0
@@ -132,7 +132,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
132
132
  * @returns {boolean}
133
133
  */
134
134
  function possibleUI5Symbol(sName) {
135
- 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);
136
136
  }
137
137
 
138
138
  // Function is a copy from: LibraryInfo.js => LibraryInfo.prototype._getActualComponent => "match" inline method
@@ -1145,21 +1145,29 @@ function collectVisibilityInfo(settings, doclet, className, n) {
1145
1145
  let visibility = (settings.visibility && settings.visibility.value.value) || "public";
1146
1146
 
1147
1147
  if (!validVisibilities.has(visibility)) {
1148
- future(`${className}: Invalid visibility '${visibility}' in runtime metadata defined for managed setting '${n}. Valid options are ${Array.from(validVisibilities).join(', ')}.`);
1148
+ error(`${className}: Invalid visibility '${visibility}' in runtime metadata defined for managed setting '${n}. Valid options are ${Array.from(validVisibilities).join(', ')}.`);
1149
1149
  }
1150
1150
 
1151
1151
  if (doclet?.access) {
1152
- const access = doclet.access;
1152
+ let access = doclet.access;
1153
1153
 
1154
1154
  if (!validAccesses.has(access)) {
1155
- future(`${className}: Invalid JSDoc visibility '${access}' defined for managed setting '${n}'. Valid options are ${Array.from(validAccesses).join(', ')}.`);
1155
+ error(`${className}: Invalid JSDoc visibility '${access}' defined for managed setting '${n}'. Valid options are ${Array.from(validAccesses).join(', ')}.`);
1156
1156
  }
1157
1157
 
1158
1158
  if (visibility === 'hidden' && (access === 'public' || access === 'protected' || access === 'restricted')) {
1159
- future(`${className}: Inconsistent visibility settings detected. Runtime metadata sets visibility to '${visibility}', while JSDoc defines it as '${access}' for the managed setting '${n}'.`);
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";
1160
1162
  }
1161
1163
  if (visibility === 'public' && access === 'private') {
1162
- future(`${className}: Inconsistent visibility settings detected. Runtime metadata sets visibility to '${visibility}', while JSDoc defines it as '${access}' for the managed setting '${n}'.`);
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";
1163
1171
  }
1164
1172
 
1165
1173
  if (visibility == "public" && (access === "restricted" || access === "protected")) {
@@ -2678,7 +2686,14 @@ exports.defineTags = function(dictionary) {
2678
2686
  }
2679
2687
  }
2680
2688
  });
2681
-
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
+ });
2682
2697
  /**
2683
2698
  * Mark a doclet as synthetic.
2684
2699
  *
@@ -2857,6 +2872,11 @@ exports.handlers = {
2857
2872
  debug("found matching local declaration", e.doclet.longname, "'" + localDecl.export + "'", currentModule.defaultExport);
2858
2873
  _ui5data.export = localDecl.export;
2859
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
+ }
2860
2880
  }
2861
2881
 
2862
2882
 
@@ -2308,7 +2308,7 @@ function createAPIJSON4Symbol(symbol, omitDefaults) {
2308
2308
  if ( symbol.__ui5.stereotype !== 'xmlmacro' && ownMethods.length > 0 ) {
2309
2309
  collection("methods");
2310
2310
  ownMethods.forEach(function(member) {
2311
- writeMethod(member, undefined, symbol.kind === 'interface');
2311
+ writeMethod(member, undefined, symbol.kind === 'interface' || symbol.kind === 'class');
2312
2312
  if ( member.__ui5.members ) {
2313
2313
  // HACK: export nested static functions as siblings of the current function
2314
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.5.0",
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.7",
133
- "semver": "^7.6.2",
134
- "terser": "^5.31.1",
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.6",
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",