@ui5/task-adaptation 1.4.0 → 1.4.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 +8 -1
- package/dist/bundle.js +2032 -97
- package/dist/util/commonUtil.js +3 -0
- package/dist/util/requestUtil.js +1 -1
- package/package.json +4 -3
- package/scripts/rollup/amdToEsm.ts +22 -0
- package/scripts/rollup/overrides/sap/base/config.js +11 -0
- package/scripts/rollup/project/ui5.yaml +1 -1
- package/scripts/rollup/ui5Resolve.ts +6 -1
- package/scripts/rollup.ts +1 -1
package/dist/util/commonUtil.js
CHANGED
|
@@ -69,6 +69,9 @@ export function removePropertiesExtension(filePath) {
|
|
|
69
69
|
return filePath.substring(0, lastIndexOf);
|
|
70
70
|
}
|
|
71
71
|
export function traverse(json, paths, callback) {
|
|
72
|
+
if (!json) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
72
75
|
for (const key of Object.keys(json)) {
|
|
73
76
|
const internPaths = [...paths];
|
|
74
77
|
internPaths.push(key);
|
package/dist/util/requestUtil.js
CHANGED
|
@@ -5,7 +5,7 @@ export default class RequestUtil {
|
|
|
5
5
|
return this.request(url, axios.head);
|
|
6
6
|
}
|
|
7
7
|
static async get(url, options) {
|
|
8
|
-
return this.request(url, axios.get, options);
|
|
8
|
+
return this.request(url, axios.get, options).then(response => response.data);
|
|
9
9
|
}
|
|
10
10
|
static async request(url, method, options) {
|
|
11
11
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/task-adaptation",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Custom task for ui5-builder which allows building UI5 Flexibility Adaptation Projects for SAP BTP, Cloud Foundry environment",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -41,15 +41,16 @@
|
|
|
41
41
|
"@ui5/fs": "^4.0.1",
|
|
42
42
|
"@ui5/logger": "^4.0.1",
|
|
43
43
|
"adm-zip": "^0.5.5",
|
|
44
|
-
"axios": "^1.
|
|
44
|
+
"axios": "^1.7.9",
|
|
45
45
|
"crc": "^4.3.2",
|
|
46
46
|
"dotenv": "^16.0.3",
|
|
47
47
|
"jsdom": "^23.0.1",
|
|
48
|
+
"meriyah": "^6.0.3",
|
|
48
49
|
"temp-dir": "^2.0.0",
|
|
49
50
|
"xml-js": "^1.6.11"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@buxlabs/amd-to-es6": "^0.16.
|
|
53
|
+
"@buxlabs/amd-to-es6": "^0.16.3",
|
|
53
54
|
"@istanbuljs/nyc-config-typescript": "^1.0.1",
|
|
54
55
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
55
56
|
"@types/adm-zip": "^0.4.34",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { parse } from "meriyah";
|
|
2
|
+
import { traverse } from "../../src/util/commonUtil.js";
|
|
3
|
+
|
|
4
|
+
export default function convert(content: string) {
|
|
5
|
+
return [
|
|
6
|
+
extractEsmClass
|
|
7
|
+
].reduce((result, converter) => converter(result), content);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function extractEsmClass(content: string) {
|
|
11
|
+
const result = parse(content, { ranges: true });
|
|
12
|
+
let classCode: { start: number, end: number } | undefined;
|
|
13
|
+
traverse(result, [], (json, key) => {
|
|
14
|
+
if (key === "type" && json[key] === "ClassDeclaration") {
|
|
15
|
+
if (classCode) {
|
|
16
|
+
throw new Error("Only one class declaration per module is allowed");
|
|
17
|
+
}
|
|
18
|
+
classCode = json;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return classCode && "export default " + content.substring(classCode.start, classCode.end) || content;
|
|
22
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export default class config {
|
|
2
|
+
config = new Map();
|
|
2
3
|
static get Type() {
|
|
3
4
|
return {
|
|
4
5
|
String: "string"
|
|
@@ -7,4 +8,14 @@ export default class config {
|
|
|
7
8
|
static get({ name }) {
|
|
8
9
|
return name === "sapUiLogLevel" ? "Error" : undefined;
|
|
9
10
|
}
|
|
11
|
+
static getWritableInstance() {
|
|
12
|
+
return {
|
|
13
|
+
get(obj) {
|
|
14
|
+
config.get(obj.name);
|
|
15
|
+
},
|
|
16
|
+
set(name, obj) {
|
|
17
|
+
config.set(name, obj);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
10
21
|
}
|
|
@@ -4,6 +4,7 @@ import * as path from "path";
|
|
|
4
4
|
|
|
5
5
|
//@ts-ignore
|
|
6
6
|
import convertAMDtoES6 from "@buxlabs/amd-to-es6";
|
|
7
|
+
import convertAMDtoESM from "./amdToEsm.js";
|
|
7
8
|
import { dirname } from "node:path";
|
|
8
9
|
import { fileURLToPath } from "node:url";
|
|
9
10
|
import { getLogger } from "@ui5/logger";
|
|
@@ -93,7 +94,11 @@ export default function (options: any) {
|
|
|
93
94
|
.replace(/\, \/\* bExport\= \*\/ true\)/g, ")")
|
|
94
95
|
.replace(/},.*(true|false)\);$/g, "});")
|
|
95
96
|
.replace(/},.*(true|false)\);(\n\/\/# sourceMappingURL=)*/g, "});\n//# sourceMappingURL=");
|
|
96
|
-
|
|
97
|
+
try {
|
|
98
|
+
return convertAMDtoES6(code);
|
|
99
|
+
} catch (_: any) {
|
|
100
|
+
return convertAMDtoESM(code);
|
|
101
|
+
}
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
};
|