@ui5/builder 2.11.7 → 2.11.9

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,26 @@
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/v2.11.7...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v2.11.9...HEAD).
6
+
7
+ <a name="v2.11.9"></a>
8
+ ## [v2.11.9] - 2022-11-30
9
+ ### Bug Fixes
10
+ - **transformApiJson:** Fix regression in UI5 Tooling scenario [`819c808`](https://github.com/SAP/ui5-builder/commit/819c808010963b84bfe33e109a7b2a5412096f78)
11
+
12
+ ### Dependency Updates
13
+ - Bump less-openui5 from 0.11.2 to 0.11.3 [`1bbe5f5`](https://github.com/SAP/ui5-builder/commit/1bbe5f561fb35c646a27cbe4d03050101ff68d7c)
14
+
15
+
16
+ <a name="v2.11.8"></a>
17
+ ## [v2.11.8] - 2022-10-28
18
+ ### Bug Fixes
19
+ - **ComponentAnalyzer:** Fix detection of rootView [`acb3d9f`](https://github.com/SAP/ui5-builder/commit/acb3d9fd7fc60ad61ac88d68cb0fd5296b795e9f)
20
+ - **XMLTemplateAnalyzer:** Fix detection of nested views [`1cbfd82`](https://github.com/SAP/ui5-builder/commit/1cbfd82396e5fa78455e0a696e9229a2e8a337fc)
21
+
6
22
 
7
23
  <a name="v2.11.7"></a>
8
- ## [v2.11.7] - 2022-10-16
24
+ ## [v2.11.7] - 2022-10-20
9
25
  ### Dependency Updates
10
26
  - Bump escope from 3.6.0 to 4.0.0 [`852b37f`](https://github.com/SAP/ui5-builder/commit/852b37f549f3927decbc1b40cc6055325472d625)
11
27
 
@@ -663,6 +679,8 @@ to load the custom bundle file instead.
663
679
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
664
680
 
665
681
 
682
+ [v2.11.9]: https://github.com/SAP/ui5-builder/compare/v2.11.8...v2.11.9
683
+ [v2.11.8]: https://github.com/SAP/ui5-builder/compare/v2.11.7...v2.11.8
666
684
  [v2.11.7]: https://github.com/SAP/ui5-builder/compare/v2.11.6...v2.11.7
667
685
  [v2.11.6]: https://github.com/SAP/ui5-builder/compare/v2.11.5...v2.11.6
668
686
  [v2.11.5]: https://github.com/SAP/ui5-builder/compare/v2.11.4...v2.11.5
@@ -66,6 +66,53 @@ class ComponentAnalyzer {
66
66
  return info;
67
67
  }
68
68
 
69
+ _getRootViewModule(rootView) {
70
+ // For runtime logic see sap/ui/core/UIComponent#createContent and sap/ui/core/mvc/View#_getModuleName
71
+
72
+ if (typeof rootView === "string") {
73
+ rootView = {
74
+ viewName: rootView
75
+ };
76
+ }
77
+ if (!rootView.type) {
78
+ rootView.type = "XML";
79
+ }
80
+
81
+ if (!rootView.viewName) {
82
+ log.warn(`Unable to analyze sap.ui5/rootView: Missing viewName`);
83
+ return null;
84
+ }
85
+
86
+ if (rootView.viewName.startsWith("module:")) {
87
+ return rootView.viewName.slice("module:".length) + ".js";
88
+ }
89
+
90
+ let viewTypeExtension;
91
+
92
+ switch (rootView.type) {
93
+ case "JS":
94
+ viewTypeExtension = ".view.js";
95
+ break;
96
+ case "JSON":
97
+ viewTypeExtension = ".view.json";
98
+ break;
99
+ case "Template":
100
+ viewTypeExtension = ".view.tmpl";
101
+ break;
102
+ case "XML":
103
+ viewTypeExtension = ".view.xml";
104
+ break;
105
+ case "HTML":
106
+ viewTypeExtension = ".view.html";
107
+ break;
108
+ default:
109
+ log.warn(`Unable to analyze sap.ui5/rootView: Unknown type '${rootView.type}'`);
110
+ return null;
111
+ }
112
+
113
+ return ModuleName.fromUI5LegacyName(rootView.viewName, viewTypeExtension);
114
+ }
115
+
69
116
  /**
70
117
  * Evaluates a manifest after it has been read and parsed
71
118
  * and adds any newly found dependencies to the given info object.
@@ -88,20 +135,11 @@ class ComponentAnalyzer {
88
135
  }
89
136
 
90
137
  if ( ui5.rootView ) {
91
- let rootView;
92
- if ( typeof ui5.rootView === "string" ) {
93
- rootView = {
94
- viewName: ui5.rootView,
95
- type: "XML"
96
- };
97
- } else {
98
- rootView = ui5.rootView;
138
+ const module = this._getRootViewModule(ui5.rootView);
139
+ if (module) {
140
+ log.verbose("adding root view dependency ", module);
141
+ info.addDependency( module );
99
142
  }
100
- const module = ModuleName.fromUI5LegacyName(
101
- rootView.viewName,
102
- ".view." + rootView.type.toLowerCase() );
103
- log.verbose("adding root view dependency ", module);
104
- info.addDependency( module );
105
143
  }
106
144
 
107
145
  each( ui5.dependencies && ui5.dependencies.libs, (options, lib) => {
@@ -37,10 +37,12 @@ const FRAGMENT_FRAGMENTNAME_ATTRIBUTE = "fragmentName";
37
37
  const FRAGMENT_TYPE_ATTRIBUTE = "type";
38
38
 
39
39
  // different view types
40
+ const VIEW_MODULE = "sap/ui/core/mvc/View.js";
40
41
  const HTMLVIEW_MODULE = "sap/ui/core/mvc/HTMLView.js";
41
42
  const JSVIEW_MODULE = "sap/ui/core/mvc/JSView.js";
42
43
  const JSONVIEW_MODULE = "sap/ui/core/mvc/JSONView.js";
43
44
  const XMLVIEW_MODULE = "sap/ui/core/mvc/XMLView.js";
45
+ const TEMPLATEVIEW_MODULE = "sap/ui/core/mvc/TemplateView.js";
44
46
  const ANYVIEW_VIEWNAME_ATTRIBUTE = "viewName";
45
47
  const XMLVIEW_CONTROLLERNAME_ATTRIBUTE = "controllerName";
46
48
  const XMLVIEW_RESBUNDLENAME_ATTRIBUTE = "resourceBundleName";
@@ -48,6 +50,7 @@ const XMLVIEW_CORE_REQUIRE_ATTRIBUTE_NS = {
48
50
  uri: "sap.ui.core",
49
51
  local: "require"
50
52
  };
53
+ const VIEW_TYPE_ATTRIBUTE = "type";
51
54
 
52
55
  /*
53
56
  * Helper to simplify access to node attributes.
@@ -347,6 +350,54 @@ class XMLTemplateAnalyzer {
347
350
  // console.log("child view detected %s", childViewModuleName);
348
351
  this._addDependency(childViewModuleName, conditional);
349
352
  }
353
+ } else if ( moduleName === TEMPLATEVIEW_MODULE ) {
354
+ const viewName = getAttribute(node, ANYVIEW_VIEWNAME_ATTRIBUTE);
355
+ if ( viewName ) {
356
+ const childViewModuleName = ModuleName.fromUI5LegacyName( viewName, ".view.tmpl" );
357
+ // console.log("child view detected %s", childViewModuleName);
358
+ this._addDependency(childViewModuleName, conditional);
359
+ }
360
+ } else if ( moduleName === VIEW_MODULE ) {
361
+ const viewName = getAttribute(node, ANYVIEW_VIEWNAME_ATTRIBUTE);
362
+ if ( viewName ) {
363
+ let childViewModuleName;
364
+
365
+ if (viewName.startsWith("module:")) {
366
+ childViewModuleName = viewName.slice("module:".length) + ".js";
367
+ } else {
368
+ const viewType = getAttribute(node, VIEW_TYPE_ATTRIBUTE);
369
+
370
+ let viewTypeExtension;
371
+
372
+ switch (viewType) {
373
+ case "JS":
374
+ viewTypeExtension = ".view.js";
375
+ break;
376
+ case "JSON":
377
+ viewTypeExtension = ".view.json";
378
+ break;
379
+ case "Template":
380
+ viewTypeExtension = ".view.tmpl";
381
+ break;
382
+ case "XML":
383
+ viewTypeExtension = ".view.xml";
384
+ break;
385
+ case "HTML":
386
+ viewTypeExtension = ".view.html";
387
+ break;
388
+ default:
389
+ log.warn(`Unable to analyze sap.ui5/rootView: Unknown type '${viewType}'`);
390
+ }
391
+
392
+ if (viewTypeExtension) {
393
+ childViewModuleName = ModuleName.fromUI5LegacyName(viewName, viewTypeExtension);
394
+ }
395
+ }
396
+ if (childViewModuleName) {
397
+ // console.log("child view detected %s", childViewModuleName);
398
+ this._addDependency(childViewModuleName, conditional);
399
+ }
400
+ }
350
401
  }
351
402
  } catch (err) {
352
403
  // ignore missing resources
@@ -989,11 +989,12 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
989
989
  const {sources} = options;
990
990
  let {librarySrcDir, libraryTestDir} = options;
991
991
 
992
- // Using path.join to normalize POSIX paths to Windows paths on Windows
993
- librarySrcDir = path.join(librarySrcDir);
994
- libraryTestDir = path.join(libraryTestDir);
995
-
996
992
  if (Array.isArray(sources) && typeof librarySrcDir === "string" && typeof libraryTestDir === "string") {
993
+
994
+ // Using path.join to normalize POSIX paths to Windows paths on Windows
995
+ librarySrcDir = path.join(librarySrcDir);
996
+ libraryTestDir = path.join(libraryTestDir);
997
+
997
998
  /**
998
999
  * Calculate prefix to check
999
1000
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "2.11.7",
3
+ "version": "2.11.9",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -113,7 +113,7 @@
113
113
  "globby": "^11.1.0",
114
114
  "graceful-fs": "^4.2.10",
115
115
  "jsdoc": "^3.6.11",
116
- "less-openui5": "^0.11.2",
116
+ "less-openui5": "^0.11.3",
117
117
  "make-dir": "^3.1.0",
118
118
  "pretty-data": "^0.40.0",
119
119
  "pretty-hrtime": "^1.0.3",
@@ -139,7 +139,7 @@
139
139
  "mock-require": "^3.0.3",
140
140
  "nyc": "^15.1.0",
141
141
  "open-cli": "^6.0.1",
142
- "recursive-readdir": "^2.1.1",
142
+ "recursive-readdir": "^2.2.3",
143
143
  "sinon": "^11.1.2",
144
144
  "tap-nyan": "^1.1.0",
145
145
  "tap-xunit": "^2.4.1"