@ui5/task-adaptation 1.0.11 → 1.0.12
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 +5 -1
- package/README.md +1 -25
- package/dist/bundle.js +14 -11
- package/package.json +1 -1
- package/scripts/rollup/overrides/sap/ui/fl/Change.js +4 -2
- package/scripts/rollup/overrides/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +16 -0
- package/scripts/rollup/project/ui5.yaml +1 -1
- package/scripts/rollup/ui5Resolve.ts +3 -3
- package/scripts/rollup.ts +14 -11
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
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-task-adaptation/compare/v1.0.
|
|
5
|
+
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.0.12...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v1.0.12"></a>
|
|
8
|
+
## [v1.0.12] - 2022-11-16
|
|
6
9
|
|
|
7
10
|
<a name="v1.0.11"></a>
|
|
8
11
|
## [v1.0.11] - 2022-03-01
|
|
@@ -43,6 +46,7 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
|
|
|
43
46
|
<a name="v1.0.0"></a>
|
|
44
47
|
## v1.0.0 - 2020-12-09
|
|
45
48
|
|
|
49
|
+
[v1.0.12]: https://github.com/SAP/ui5-task-adaptation/compare/v1.0.11...v1.0.12
|
|
46
50
|
[v1.0.11]: https://github.com/SAP/ui5-task-adaptation/compare/v1.0.10...v1.0.11
|
|
47
51
|
[v1.0.10]: https://github.com/SAP/ui5-task-adaptation/compare/v1.0.9...v1.0.10
|
|
48
52
|
[v1.0.9]: https://github.com/SAP/ui5-task-adaptation/compare/v1.0.8...v1.0.9
|
package/README.md
CHANGED
|
@@ -1,35 +1,11 @@
|
|
|
1
1
|
# ui5-task-adaptation
|
|
2
2
|
[](https://api.reuse.software/info/github.com/SAP/ui5-task-adaptation)
|
|
3
|
-
[](https://travis-ci.
|
|
3
|
+
[](https://app.travis-ci.com/github/SAP/ui5-task-adaptation)
|
|
4
4
|
[](https://badge.fury.io/js/@ui5%2Ftask-adaptation)
|
|
5
5
|
|
|
6
6
|
## Description
|
|
7
7
|
A custom task for [ui5-builder](https://github.com/SAP/ui5-builder) that allows building [UI5 Flexibility adaptation projects](https://help.sap.com/viewer/584e0bcbfd4a4aff91c815cefa0bce2d/Cloud/en-US/019b0c38a6b043d1a66b11d992eed290.html) for SAP BTP, Cloud Foundry environment.
|
|
8
8
|
|
|
9
|
-
## How to specify a UI5 version
|
|
10
|
-
ui5-task-adaptation is based on the UI5 implementation. In order to use a certain UI5 version, go to a module that contains the ui5.yaml and edit the ui5.yaml specifying the desired UI5 version (1.89.0 in the example below):
|
|
11
|
-
|
|
12
|
-
```yaml
|
|
13
|
-
---
|
|
14
|
-
specVersion: "2.2"
|
|
15
|
-
type: application
|
|
16
|
-
metadata:
|
|
17
|
-
name: example
|
|
18
|
-
framework:
|
|
19
|
-
name: SAPUI5
|
|
20
|
-
version: 1.89.0
|
|
21
|
-
libraries:
|
|
22
|
-
- name: sap.ui.fl
|
|
23
|
-
- name: sap.suite.ui.generic.template
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
open a terminal and execute:
|
|
27
|
-
|
|
28
|
-
```shell
|
|
29
|
-
npm run build-ui5
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
|
|
33
9
|
## How to obtain support
|
|
34
10
|
In case you need any support, please create a GitHub issue.
|
|
35
11
|
|
package/dist/bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//1.
|
|
1
|
+
//1.108.0
|
|
2
2
|
var window = {};
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -33,7 +33,7 @@ var Change = function (oFile) {
|
|
|
33
33
|
};
|
|
34
34
|
Change.prototype.getChangeType = function () {
|
|
35
35
|
if (this._oDefinition) {
|
|
36
|
-
return this._oDefinition.changeType;
|
|
36
|
+
return this._oDefinition.flexObjectMetadata ? this._oDefinition.flexObjectMetadata.changeType : this._oDefinition.changeType;
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
Change.prototype.getLayer = function () {
|
|
@@ -739,6 +739,13 @@ var DeleteCard = {
|
|
|
739
739
|
}
|
|
740
740
|
};
|
|
741
741
|
|
|
742
|
+
var fnAssert = function (bResult, vMessage) {
|
|
743
|
+
if (!bResult) {
|
|
744
|
+
var sMessage = typeof vMessage === "function" ? vMessage() : vMessage;
|
|
745
|
+
console.assert(bResult, sMessage);
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
|
|
742
749
|
var fnNow = !(typeof window != "undefined" && window.performance && performance.now && performance.timing) ? Date.now : (function () {
|
|
743
750
|
var iNavigationStart = performance.timing.navigationStart;
|
|
744
751
|
return function perfnow() {
|
|
@@ -988,13 +995,6 @@ Log.getLogger = function (sComponent, iDefaultLogLevel) {
|
|
|
988
995
|
return new Logger(sComponent);
|
|
989
996
|
};
|
|
990
997
|
|
|
991
|
-
var fnAssert = function (bResult, vMessage) {
|
|
992
|
-
if (!bResult) {
|
|
993
|
-
var sMessage = typeof vMessage === "function" ? vMessage() : vMessage;
|
|
994
|
-
console.assert(bResult, sMessage);
|
|
995
|
-
}
|
|
996
|
-
};
|
|
997
|
-
|
|
998
998
|
var fnUniqueSort = function (aArray) {
|
|
999
999
|
fnAssert(Array.isArray(aArray), "uniqueSort: input parameter must be an Array");
|
|
1000
1000
|
var iLength = aArray.length;
|
|
@@ -1352,7 +1352,8 @@ function getMethods(sClassName, oLog) {
|
|
|
1352
1352
|
oLog.addLogListener(oListener);
|
|
1353
1353
|
},
|
|
1354
1354
|
getLogger: function () {
|
|
1355
|
-
|
|
1355
|
+
var oRet = oLog.getLogger(sFullClassName);
|
|
1356
|
+
return oRet;
|
|
1356
1357
|
}
|
|
1357
1358
|
};
|
|
1358
1359
|
}
|
|
@@ -1514,7 +1515,8 @@ function applyChange(manifest, change) {
|
|
|
1514
1515
|
var targets = ((_manifest$sapUi = manifest["sap.ui5"]) === null || _manifest$sapUi === void 0 ? void 0 : (_manifest$sapUi$routi = _manifest$sapUi.routing) === null || _manifest$sapUi$routi === void 0 ? void 0 : _manifest$sapUi$routi.targets) || ({});
|
|
1515
1516
|
var pageSettings;
|
|
1516
1517
|
var propertyChange = changeContent === null || changeContent === void 0 ? void 0 : changeContent.entityPropertyChange;
|
|
1517
|
-
if ((propertyChange === null || propertyChange === void 0 ? void 0 : propertyChange.operation) !== "UPSERT" || !(propertyChange !== null && propertyChange !== void 0 && propertyChange.propertyPath) ||
|
|
1518
|
+
if ((propertyChange === null || propertyChange === void 0 ? void 0 : propertyChange.operation) !== "UPSERT" || !(propertyChange !== null && propertyChange !== void 0 && propertyChange.propertyPath) || (propertyChange === null || propertyChange === void 0 ? void 0 : propertyChange.propertyValue) === undefined || propertyChange !== null && propertyChange !== void 0 && propertyChange.propertyPath.startsWith("/")) {
|
|
1519
|
+
Log.error("Change content is not a valid");
|
|
1518
1520
|
return manifest;
|
|
1519
1521
|
}
|
|
1520
1522
|
for (var p in targets) {
|
|
@@ -1528,6 +1530,7 @@ function applyChange(manifest, change) {
|
|
|
1528
1530
|
}
|
|
1529
1531
|
}
|
|
1530
1532
|
if (!pageSettings) {
|
|
1533
|
+
Log.error(("No Fiori elements page with ID ").concat(pageID, " found in routing targets."));
|
|
1531
1534
|
return manifest;
|
|
1532
1535
|
}
|
|
1533
1536
|
var propertyPath = propertyChange.propertyPath.split("/");
|
package/package.json
CHANGED
|
@@ -33,7 +33,9 @@ sap.ui.define([
|
|
|
33
33
|
*/
|
|
34
34
|
Change.prototype.getChangeType = function () {
|
|
35
35
|
if (this._oDefinition) {
|
|
36
|
-
return this._oDefinition.
|
|
36
|
+
return this._oDefinition.flexObjectMetadata
|
|
37
|
+
? this._oDefinition.flexObjectMetadata.changeType
|
|
38
|
+
: this._oDefinition.changeType
|
|
37
39
|
}
|
|
38
40
|
};
|
|
39
41
|
|
|
@@ -43,7 +45,7 @@ sap.ui.define([
|
|
|
43
45
|
*
|
|
44
46
|
* @public
|
|
45
47
|
*/
|
|
46
|
-
|
|
48
|
+
Change.prototype.getLayer = function () {
|
|
47
49
|
return this._oDefinition.layer;
|
|
48
50
|
};
|
|
49
51
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2020 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
sap.ui.define([
|
|
8
|
+
|
|
9
|
+
], function (
|
|
10
|
+
|
|
11
|
+
) {
|
|
12
|
+
var FlexObjectFactory = function () {
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return FlexObjectFactory;
|
|
16
|
+
}, true);
|
|
@@ -97,8 +97,8 @@ export default function (options: any) {
|
|
|
97
97
|
code = code
|
|
98
98
|
.replace(/sap\.ui\.define/g, "define")
|
|
99
99
|
.replace(/\, \/\* bExport\= \*\/ true\)/g, ")")
|
|
100
|
-
.replace(/}
|
|
101
|
-
.replace(/}
|
|
100
|
+
.replace(/},.*(true|false)\);$/g, "});")
|
|
101
|
+
.replace(/},.*(true|false)\);(\n\/\/# sourceMappingURL=)*/g, "});\n//# sourceMappingURL=");
|
|
102
102
|
return convertAMDtoES6(code);
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -108,7 +108,7 @@ export default function (options: any) {
|
|
|
108
108
|
|
|
109
109
|
function replaceRequireAsync(code: string) {
|
|
110
110
|
const requireAsyncPattern = /requireAsync((.bind\(this, ")|(\("))+(?<url>[\/\w]*)"\)/mg;
|
|
111
|
-
let match, defineUrls =
|
|
111
|
+
let match, defineUrls = new Array<string>(), defineVars = new Array<string>(), matches = new Map();
|
|
112
112
|
while (match = requireAsyncPattern.exec(code)) {
|
|
113
113
|
if (match.groups?.url) {
|
|
114
114
|
const varaibleName = match.groups.url.split("/").pop() + crypto.randomBytes(16).toString("hex");
|
package/scripts/rollup.ts
CHANGED
|
@@ -14,28 +14,30 @@ const log = require("@ui5/logger").getLogger("rollup-plugin-ui5-resolve-task-ada
|
|
|
14
14
|
const projectPaths = [
|
|
15
15
|
path.resolve(__dirname, "rollup", "project")
|
|
16
16
|
];
|
|
17
|
+
const LATEST_VERSION_PLACEHOLDER = "0.0.0";
|
|
17
18
|
|
|
18
19
|
export default class Builder {
|
|
19
20
|
|
|
20
21
|
static async getProjectInfo(projectPaths: string[]) {
|
|
21
22
|
for (const cwd of projectPaths) {
|
|
22
23
|
try {
|
|
23
|
-
|
|
24
|
-
cwd
|
|
25
|
-
|
|
24
|
+
const options = <any>{
|
|
25
|
+
cwd
|
|
26
|
+
};
|
|
27
|
+
const version = this.validateProjectSettings(cwd);
|
|
28
|
+
if (version === LATEST_VERSION_PLACEHOLDER) {
|
|
29
|
+
options.frameworkOptions = {
|
|
26
30
|
versionOverride: "latest"
|
|
27
31
|
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
this.validateProjectSettings(cwd);
|
|
31
|
-
return project;
|
|
32
|
+
}
|
|
33
|
+
return normalizer.generateProjectTree(options);
|
|
32
34
|
} catch (error: any) {
|
|
33
35
|
log.info(`${error.message}`);
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
static validateProjectSettings(projectPath: string) {
|
|
40
|
+
static validateProjectSettings(projectPath: string): string {
|
|
39
41
|
const FRAMEWORK_TYPES = ["OpenUI5", "SAPUI5"];
|
|
40
42
|
const content = fs.readFileSync(path.join(projectPath, "ui5.yaml"), { encoding: "utf-8" });
|
|
41
43
|
const yamlJson = <any>yaml.load(content);
|
|
@@ -46,6 +48,7 @@ export default class Builder {
|
|
|
46
48
|
if (!semver.valid(framework.version)) {
|
|
47
49
|
throw new Error(`UI5 framework version should correspond semantic version standard, e.g: 1.85.2`);
|
|
48
50
|
}
|
|
51
|
+
return framework.version;
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
static getBundledUI5Version(destination: string) {
|
|
@@ -65,9 +68,9 @@ export default class Builder {
|
|
|
65
68
|
}
|
|
66
69
|
const isSapUiFl = (dependency: any) => dependency.id.endsWith("/sap.ui.fl");
|
|
67
70
|
const sapUiFlDependency = project.dependencies.find(isSapUiFl);
|
|
68
|
-
if (bundledUI5Version == null || sapUiFlDependency && semver.
|
|
71
|
+
if (bundledUI5Version == null || sapUiFlDependency && semver.neq(bundledUI5Version, sapUiFlDependency.version)) {
|
|
69
72
|
if (sapUiFlDependency.version) {
|
|
70
|
-
log.info(`
|
|
73
|
+
log.info(`Using UI5 version ${sapUiFlDependency.version.toString()} to bundle`);
|
|
71
74
|
}
|
|
72
75
|
const inputOptions = <rollup.RollupOptions>{
|
|
73
76
|
input: "bundleDefinition.js",
|
|
@@ -100,7 +103,7 @@ export default class Builder {
|
|
|
100
103
|
await bundle.write(outputOptions);
|
|
101
104
|
await bundle.close();
|
|
102
105
|
} else {
|
|
103
|
-
log.info(`
|
|
106
|
+
log.info(`UI5 version ${bundledUI5Version!.toString()} is already bundled`);
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
}
|