@ui5/builder 3.0.0-alpha.9 → 3.0.0-beta.2
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/.reuse/dep5 +2 -2
- package/CHANGELOG.md +59 -1
- package/CONTRIBUTING.md +1 -1
- package/README.md +4 -4
- package/jsdoc.json +2 -2
- package/lib/lbt/UI5ClientConstants.js +7 -8
- package/lib/lbt/analyzer/ComponentAnalyzer.js +60 -22
- package/lib/lbt/analyzer/FioriElementsAnalyzer.js +31 -20
- package/lib/lbt/analyzer/JSModuleAnalyzer.js +119 -77
- package/lib/lbt/analyzer/SmartTemplateAnalyzer.js +31 -20
- package/lib/lbt/analyzer/XMLCompositeAnalyzer.js +35 -25
- package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +71 -18
- package/lib/lbt/analyzer/analyzeLibraryJS.js +22 -6
- package/lib/lbt/bundle/AutoSplitter.js +10 -11
- package/lib/lbt/bundle/Builder.js +33 -36
- package/lib/lbt/bundle/BundleDefinition.js +1 -5
- package/lib/lbt/bundle/BundleWriter.js +1 -2
- package/lib/lbt/bundle/ResolvedBundleDefinition.js +6 -7
- package/lib/lbt/bundle/Resolver.js +11 -12
- package/lib/lbt/calls/SapUiDefine.js +16 -11
- package/lib/lbt/graph/dependencyGraph.js +3 -4
- package/lib/lbt/graph/dominatorTree.js +3 -3
- package/lib/lbt/graph/topologicalSort.js +3 -3
- package/lib/lbt/resources/LibraryFileAnalyzer.js +6 -9
- package/lib/lbt/resources/LocatorResource.js +2 -2
- package/lib/lbt/resources/LocatorResourcePool.js +3 -3
- package/lib/lbt/resources/ModuleInfo.js +2 -3
- package/lib/lbt/resources/Resource.js +3 -4
- package/lib/lbt/resources/ResourceCollector.js +8 -9
- package/lib/lbt/resources/ResourceFilterList.js +38 -40
- package/lib/lbt/resources/ResourceInfo.js +1 -1
- package/lib/lbt/resources/ResourceInfoList.js +5 -3
- package/lib/lbt/resources/ResourcePool.js +15 -21
- package/lib/lbt/utils/ASTUtils.js +60 -44
- package/lib/lbt/utils/JSTokenizer.js +4 -4
- package/lib/lbt/utils/ModuleName.js +10 -20
- package/lib/lbt/utils/escapePropertiesFile.js +4 -4
- package/lib/lbt/utils/parseUtils.js +5 -11
- package/lib/processors/bootstrapHtmlTransformer.js +15 -7
- package/lib/processors/bundlers/flexChangesBundler.js +16 -8
- package/lib/processors/bundlers/moduleBundler.js +26 -15
- package/lib/processors/jsdoc/apiIndexGenerator.js +16 -9
- package/lib/processors/jsdoc/jsdocGenerator.js +37 -25
- package/lib/processors/jsdoc/lib/{createIndexFiles.js → createIndexFiles.cjs} +0 -0
- package/lib/processors/jsdoc/lib/{transformApiJson.js → transformApiJson.cjs} +59 -2
- package/lib/processors/jsdoc/lib/ui5/{plugin.js → plugin.cjs} +310 -119
- package/lib/processors/jsdoc/lib/ui5/template/{publish.js → publish.cjs} +6 -2
- package/lib/processors/jsdoc/lib/ui5/template/utils/{versionUtil.js → versionUtil.cjs} +0 -0
- package/lib/processors/jsdoc/sdkTransformer.js +18 -11
- package/lib/processors/libraryLessGenerator.js +28 -16
- package/lib/processors/manifestCreator.js +15 -14
- package/lib/processors/minifier.js +22 -16
- package/lib/processors/nonAsciiEscaper.js +17 -7
- package/lib/processors/resourceListCreator.js +13 -13
- package/lib/processors/stringReplacer.js +13 -6
- package/lib/processors/themeBuilder.js +33 -24
- package/lib/processors/versionInfoGenerator.js +40 -30
- package/lib/tasks/buildThemes.js +18 -11
- package/lib/tasks/bundlers/generateBundle.js +23 -12
- package/lib/tasks/bundlers/generateComponentPreload.js +23 -12
- package/lib/tasks/bundlers/generateFlexChangesBundle.js +16 -8
- package/lib/tasks/bundlers/generateLibraryPreload.js +33 -17
- package/lib/tasks/bundlers/generateStandaloneAppBundle.js +21 -13
- package/lib/tasks/bundlers/utils/createModuleNameMapping.js +7 -7
- package/lib/tasks/escapeNonAsciiCharacters.js +12 -5
- package/lib/tasks/generateCachebusterInfo.js +17 -9
- package/lib/tasks/generateLibraryManifest.js +14 -8
- package/lib/tasks/generateResourcesJson.js +15 -9
- package/lib/tasks/generateThemeDesignerResources.js +19 -9
- package/lib/tasks/generateVersionInfo.js +12 -5
- package/lib/tasks/jsdoc/executeJsdocSdkTransformation.js +17 -9
- package/lib/tasks/jsdoc/generateApiIndex.js +16 -10
- package/lib/tasks/jsdoc/generateJsdoc.js +131 -119
- package/lib/tasks/minify.js +13 -6
- package/lib/tasks/replaceBuildtime.js +12 -5
- package/lib/tasks/replaceCopyright.js +12 -5
- package/lib/tasks/replaceVersion.js +12 -5
- package/lib/tasks/taskRepository.js +24 -30
- package/lib/tasks/transformBootstrapHtml.js +6 -5
- package/package.json +44 -31
- package/index.js +0 -173
- package/lib/processors/bundlers/manifestBundler.js +0 -172
- package/lib/tasks/bundlers/generateManifestBundle.js +0 -49
package/.reuse/dep5
CHANGED
|
@@ -25,9 +25,9 @@ Disclaimer: The code in this project may include calls to APIs (“API Calls”)
|
|
|
25
25
|
parties the right to use of access any SAP External Product, through API Calls.
|
|
26
26
|
|
|
27
27
|
Files: *
|
|
28
|
-
Copyright: 2018-
|
|
28
|
+
Copyright: 2018-2022 SAP SE or an SAP affiliate company and UI5 Tooling contributors
|
|
29
29
|
License: Apache-2.0
|
|
30
30
|
|
|
31
31
|
Files: lib/processors/jsdoc/lib/*
|
|
32
|
-
Copyright: 2009-
|
|
32
|
+
Copyright: 2009-2022 SAP SE or an SAP affiliate company and OpenUI5 contributors
|
|
33
33
|
License: Apache-2.0
|
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,60 @@
|
|
|
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.0.0-
|
|
5
|
+
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.2...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v3.0.0-beta.2"></a>
|
|
8
|
+
## [v3.0.0-beta.2] - 2022-11-17
|
|
9
|
+
### Breaking Changes
|
|
10
|
+
- Removal of manifestBundler and generateManifestBundle ([#838](https://github.com/SAP/ui5-builder/issues/838)) [`07a5be2`](https://github.com/SAP/ui5-builder/commit/07a5be2b6d9aa23cf78ddd17951c832d6dec7bef)
|
|
11
|
+
- **JSDoc:** Fail build when jsdoc command failed ([#845](https://github.com/SAP/ui5-builder/issues/845)) [`c2916b4`](https://github.com/SAP/ui5-builder/commit/c2916b4f1d49b5500e4b51143d4e6065ac200eef)
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
- Support ES2022 language features ([#848](https://github.com/SAP/ui5-builder/issues/848)) [`f9b8457`](https://github.com/SAP/ui5-builder/commit/f9b845726731a0e02ec4a499e2a1a82a639174a8)
|
|
15
|
+
|
|
16
|
+
### BREAKING CHANGE
|
|
17
|
+
|
|
18
|
+
The `jsdocGenerator` processor and the corresponding `generateJsdoc` task will now throw an error when JSDoc reports an error (exit code != 0). This will also fail the build when running `ui5 build jsdoc`.
|
|
19
|
+
|
|
20
|
+
The manifestBundler processor and generateManifestBundle task has been removed because it is no longer required for the HTML5 repository in Cloud Foundry.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<a name="v3.0.0-beta.1"></a>
|
|
24
|
+
## [v3.0.0-beta.1] - 2022-11-07
|
|
25
|
+
|
|
26
|
+
<a name="v3.0.0-alpha.12"></a>
|
|
27
|
+
## [v3.0.0-alpha.12] - 2022-10-24
|
|
28
|
+
### Breaking Changes
|
|
29
|
+
- Transform to native ESM ([#790](https://github.com/SAP/ui5-builder/issues/790)) [`a439aa9`](https://github.com/SAP/ui5-builder/commit/a439aa9f679dfe2e18b8c540f54876f94c0de119)
|
|
30
|
+
|
|
31
|
+
### BREAKING CHANGE
|
|
32
|
+
|
|
33
|
+
This package has been transformed to native ESM. Therefore it no longer provides a CommonJS export.
|
|
34
|
+
If your project uses CommonJS, it needs to be converted to ESM or use a dynamic import.
|
|
35
|
+
|
|
36
|
+
For more information see also:
|
|
37
|
+
- https://sap.github.io/ui5-tooling/updates/migrate-v3/
|
|
38
|
+
- https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
<a name="v3.0.0-alpha.11"></a>
|
|
42
|
+
## [v3.0.0-alpha.11] - 2022-10-20
|
|
43
|
+
### Bug Fixes
|
|
44
|
+
- **package.json:** Downgrade es5-ext dependency [`2b71707`](https://github.com/SAP/ui5-builder/commit/2b71707683480b26aab9957c09e5d22bce8a6450)
|
|
45
|
+
|
|
46
|
+
### Dependency Updates
|
|
47
|
+
- Bump escope from 3.6.0 to 4.0.0 [`e25af0d`](https://github.com/SAP/ui5-builder/commit/e25af0d9c1184916aa037b4b4ca23d15c5f2a408)
|
|
48
|
+
|
|
49
|
+
### Features
|
|
50
|
+
- **builder:** Improve support for ES6+ syntax ([#774](https://github.com/SAP/ui5-builder/issues/774)) [`90385fe`](https://github.com/SAP/ui5-builder/commit/90385feb7cea1e5b864cff035b01263a492972a9)
|
|
51
|
+
- **jsdoc:** Improve support for ES6+ syntax ([#785](https://github.com/SAP/ui5-builder/issues/785)) [`187a6a3`](https://github.com/SAP/ui5-builder/commit/187a6a35000145d70bf41e0d8b724e5ea8d8dc78)
|
|
52
|
+
|
|
53
|
+
### Reverts
|
|
54
|
+
- [FIX] package.json: Downgrade es5-ext dependency
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
<a name="v3.0.0-alpha.10"></a>
|
|
58
|
+
## [v3.0.0-alpha.10] - 2022-08-09
|
|
6
59
|
|
|
7
60
|
<a name="v3.0.0-alpha.9"></a>
|
|
8
61
|
## [v3.0.0-alpha.9] - 2022-07-27
|
|
@@ -750,6 +803,11 @@ to load the custom bundle file instead.
|
|
|
750
803
|
- Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
|
|
751
804
|
|
|
752
805
|
|
|
806
|
+
[v3.0.0-beta.2]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.1...v3.0.0-beta.2
|
|
807
|
+
[v3.0.0-beta.1]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.12...v3.0.0-beta.1
|
|
808
|
+
[v3.0.0-alpha.12]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.11...v3.0.0-alpha.12
|
|
809
|
+
[v3.0.0-alpha.11]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.10...v3.0.0-alpha.11
|
|
810
|
+
[v3.0.0-alpha.10]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.9...v3.0.0-alpha.10
|
|
753
811
|
[v3.0.0-alpha.9]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.8...v3.0.0-alpha.9
|
|
754
812
|
[v3.0.0-alpha.8]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.7...v3.0.0-alpha.8
|
|
755
813
|
[v3.0.0-alpha.7]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.6...v3.0.0-alpha.7
|
package/CONTRIBUTING.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
# Contributing to the UI5 Tooling
|
|
2
2
|
|
|
3
|
-
See CONTRIBUTING.md in the [SAP/ui5-tooling](https://github.com/SAP/ui5-tooling/blob/
|
|
3
|
+
See CONTRIBUTING.md in the [SAP/ui5-tooling](https://github.com/SAP/ui5-tooling/blob/main/CONTRIBUTING.md) repository.
|
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
3
|
# ui5-builder
|
|
4
4
|
> Modules for building UI5 projects
|
|
5
5
|
> Part of the [UI5 Tooling](https://github.com/SAP/ui5-tooling)
|
|
6
6
|
|
|
7
7
|
[](https://api.reuse.software/info/github.com/SAP/ui5-builder)
|
|
8
|
-
[](https://dev.azure.com/sap/opensource/_build/latest?definitionId=26&branchName=main)
|
|
9
9
|
[](https://www.npmjs.com/package/@ui5/builder)
|
|
10
10
|
[](https://coveralls.io/github/SAP/ui5-builder)
|
|
11
11
|
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
Can be found here: [sap.github.io/ui5-tooling](https://sap.github.io/ui5-tooling/pages/Builder/)
|
|
14
14
|
|
|
15
15
|
## Contributing
|
|
16
|
-
Please check our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/
|
|
16
|
+
Please check our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/main/CONTRIBUTING.md).
|
|
17
17
|
|
|
18
18
|
## Support
|
|
19
|
-
Please follow our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/
|
|
19
|
+
Please follow our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/main/CONTRIBUTING.md#report-an-issue) on how to report an issue.
|
|
20
20
|
|
|
21
21
|
Please report issues in the main [UI5 Tooling](https://github.com/SAP/ui5-tooling) repository.
|
|
22
22
|
|
package/jsdoc.json
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
"allowUnknownTags": false
|
|
4
4
|
},
|
|
5
5
|
"source": {
|
|
6
|
-
"include": ["README.md"
|
|
6
|
+
"include": ["README.md"],
|
|
7
7
|
"exclude": ["lib/lbt/utils/JSTokenizer.js"],
|
|
8
8
|
"includePattern": ".+\\.js$",
|
|
9
9
|
"excludePattern": "(node_modules(\\\\|/))"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
|
-
"./jsdoc-plugin"
|
|
12
|
+
"./jsdoc-plugin.cjs"
|
|
13
13
|
],
|
|
14
14
|
"opts": {
|
|
15
15
|
"encoding": "utf8",
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
export const MODULE__UI5LOADER = "ui5loader.js";
|
|
3
|
+
export const MODULE__UI5LOADER_AUTOCONFIG = "ui5loader-autoconfig.js";
|
|
4
|
+
export const MODULE__JQUERY_SAP_GLOBAL = "jquery.sap.global.js";
|
|
5
|
+
export const MODULE__SAP_UI_CORE_CORE = "sap/ui/core/Core.js";
|
|
6
|
+
export const EVO_MARKER_RESOURCE = MODULE__UI5LOADER;
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
export function getRendererName( module ) {
|
|
10
9
|
if ( /\.js$/.test(module) ) {
|
|
11
10
|
return module.replace(/\.js$/, "Renderer.js");
|
|
12
11
|
}
|
|
13
|
-
}
|
|
12
|
+
}
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
* This class can handle multiple concurrent analysis calls, it has no instance state
|
|
19
19
|
* other than the pool (which is readonly).
|
|
20
20
|
*/
|
|
21
|
-
"use strict";
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
import {fromUI5LegacyName} from "../utils/ModuleName.js";
|
|
23
|
+
import logger from "@ui5/logger";
|
|
24
|
+
const log = logger.getLogger("lbt:analyzer:ComponentAnalyzer");
|
|
25
25
|
|
|
26
26
|
// ---------------------------------------------------------------------------------------------------------
|
|
27
27
|
|
|
@@ -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 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,30 +135,21 @@ class ComponentAnalyzer {
|
|
|
88
135
|
}
|
|
89
136
|
|
|
90
137
|
if ( ui5.rootView ) {
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
|
|
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) => {
|
|
108
|
-
const module =
|
|
146
|
+
const module = fromUI5LegacyName(lib, "/library.js");
|
|
109
147
|
log.verbose("adding library dependency ", module, options.lazy || false);
|
|
110
148
|
info.addDependency( module, options.lazy ); // lazy -> conditional dependency
|
|
111
149
|
});
|
|
112
150
|
|
|
113
151
|
each( ui5.dependencies && ui5.dependencies.components, (options, component) => {
|
|
114
|
-
const module =
|
|
152
|
+
const module = fromUI5LegacyName(component, "/Component.js");
|
|
115
153
|
log.verbose("adding component dependency ", module, options.lazy || false);
|
|
116
154
|
info.addDependency( module, options.lazy ); // lazy -> conditional dependency
|
|
117
155
|
});
|
|
@@ -163,7 +201,7 @@ class ComponentAnalyzer {
|
|
|
163
201
|
log.warn(`Neither a type nor a dataSource has been defined for model "${model}".`);
|
|
164
202
|
return;
|
|
165
203
|
}
|
|
166
|
-
const module =
|
|
204
|
+
const module = fromUI5LegacyName( modelType );
|
|
167
205
|
log.verbose("derived model implementation dependency ", module);
|
|
168
206
|
info.addDependency(module);
|
|
169
207
|
});
|
|
@@ -175,7 +213,7 @@ class ComponentAnalyzer {
|
|
|
175
213
|
// See sap/ui/core/UIComponent#init
|
|
176
214
|
if (routing.routes) {
|
|
177
215
|
const routerClassName = routingConfig.routerClass || "sap.ui.core.routing.Router";
|
|
178
|
-
const routerClassModule =
|
|
216
|
+
const routerClassModule = fromUI5LegacyName(routerClassName);
|
|
179
217
|
log.verbose(`adding router dependency '${routerClassModule}'`);
|
|
180
218
|
info.addDependency(routerClassModule);
|
|
181
219
|
} else if (routing.targets) {
|
|
@@ -194,7 +232,7 @@ class ComponentAnalyzer {
|
|
|
194
232
|
if (target && target.viewName) {
|
|
195
233
|
// merge target config with default config
|
|
196
234
|
const config = Object.assign({}, routing.config, target);
|
|
197
|
-
const module =
|
|
235
|
+
const module = fromUI5LegacyName(
|
|
198
236
|
(config.viewPath ? config.viewPath + "." : "") +
|
|
199
237
|
config.viewName, ".view." + config.viewType.toLowerCase() );
|
|
200
238
|
log.verbose("converting routing target '%s' to view dependency '%s'", targetName, module);
|
|
@@ -209,4 +247,4 @@ class ComponentAnalyzer {
|
|
|
209
247
|
}
|
|
210
248
|
}
|
|
211
249
|
|
|
212
|
-
|
|
250
|
+
export default ComponentAnalyzer;
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
* This class can handle multiple concurrent analysis calls, it has no instance state other than the pool
|
|
57
57
|
* (which is readonly).
|
|
58
58
|
*/
|
|
59
|
-
"use strict";
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
import {fromUI5LegacyName} from "../utils/ModuleName.js";
|
|
61
|
+
import SapUiDefine from "../calls/SapUiDefine.js";
|
|
62
|
+
import {parseJS, Syntax} from "../utils/parseUtils.js";
|
|
63
|
+
import {getValue, isMethodCall, getStringValue} from "../utils/ASTUtils.js";
|
|
64
|
+
import logger from "@ui5/logger";
|
|
65
|
+
const log = logger.getLogger("lbt:analyzer:FioriElementAnalyzer");
|
|
66
66
|
|
|
67
67
|
// ---------------------------------------------------------------------------------------------------------
|
|
68
68
|
|
|
@@ -129,7 +129,7 @@ class FioriElementsAnalyzer {
|
|
|
129
129
|
}
|
|
130
130
|
each(activityCfg, (actionCfg) => {
|
|
131
131
|
if ( actionCfg.template ) {
|
|
132
|
-
const module =
|
|
132
|
+
const module = fromUI5LegacyName( "sap.fe.templates." +
|
|
133
133
|
actionCfg.template + ".Component" );
|
|
134
134
|
log.verbose("template app: add dependency to template component %s", module);
|
|
135
135
|
info.addDependency(module);
|
|
@@ -151,7 +151,7 @@ class FioriElementsAnalyzer {
|
|
|
151
151
|
const templateName = (pageConfig.component && pageConfig.component.settings &&
|
|
152
152
|
pageConfig.component.settings.templateName) || defaultTemplateName;
|
|
153
153
|
if ( templateName ) {
|
|
154
|
-
const templateModuleName =
|
|
154
|
+
const templateModuleName = fromUI5LegacyName( templateName, ".view.xml" );
|
|
155
155
|
log.verbose("template app: add dependency to template view %s", templateModuleName);
|
|
156
156
|
appInfo.addDependency(templateModuleName);
|
|
157
157
|
}
|
|
@@ -165,25 +165,36 @@ class FioriElementsAnalyzer {
|
|
|
165
165
|
const TA = defineCall.findImportName("sap/fe/core/TemplateAssembler.js");
|
|
166
166
|
// console.log("local name for TemplateAssembler: %s", TA);
|
|
167
167
|
if ( TA && defineCall.factory ) {
|
|
168
|
-
defineCall.factory.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
templateName = this._analyzeTemplateClassDefinition(stmt.argument.arguments[2]) || templateName;
|
|
168
|
+
if (defineCall.factory.type === Syntax.ArrowFunctionExpression &&
|
|
169
|
+
defineCall.factory.expression === true) {
|
|
170
|
+
if ( this._isTemplateClassDefinition(TA, defineCall.factory.body) ) {
|
|
171
|
+
templateName =
|
|
172
|
+
this._analyzeTemplateClassDefinition(defineCall.factory.body.arguments[2]) || templateName;
|
|
174
173
|
}
|
|
175
|
-
}
|
|
174
|
+
} else {
|
|
175
|
+
defineCall.factory.body.body.forEach( (stmt) => {
|
|
176
|
+
if ( stmt.type === Syntax.ReturnStatement &&
|
|
177
|
+
this._isTemplateClassDefinition(TA, stmt.argument)
|
|
178
|
+
) {
|
|
179
|
+
templateName =
|
|
180
|
+
this._analyzeTemplateClassDefinition(stmt.argument.arguments[2]) || templateName;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
176
184
|
}
|
|
177
185
|
}
|
|
178
186
|
return templateName;
|
|
179
187
|
}
|
|
180
188
|
|
|
189
|
+
_isTemplateClassDefinition(TA, node) {
|
|
190
|
+
return isMethodCall(node, [TA, "getTemplateComponent"]) &&
|
|
191
|
+
node.arguments.length > 2 &&
|
|
192
|
+
node.arguments[2].type === "ObjectExpression";
|
|
193
|
+
}
|
|
194
|
+
|
|
181
195
|
_analyzeTemplateClassDefinition(clazz) {
|
|
182
|
-
|
|
183
|
-
if ( isString(defaultValue) ) {
|
|
184
|
-
return defaultValue.value;
|
|
185
|
-
}
|
|
196
|
+
return getStringValue(getValue(clazz, ["metadata", "properties", "templateName", "defaultValue"]));
|
|
186
197
|
}
|
|
187
198
|
}
|
|
188
199
|
|
|
189
|
-
|
|
200
|
+
export default FioriElementsAnalyzer;
|