@abaplint/transpiler-cli 2.10.39 → 2.10.41
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/abap_transpile +1 -1
- package/build/bundle.js +54 -29
- package/package.json +3 -3
- package/schema.json +161 -0
package/abap_transpile
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
require("./build/bundle");
|
package/build/bundle.js
CHANGED
|
@@ -89112,7 +89112,8 @@ run().then(() => {
|
|
|
89112
89112
|
}
|
|
89113
89113
|
tests.push({
|
|
89114
89114
|
obj,
|
|
89115
|
-
|
|
89115
|
+
filename: `./${(0, initialization_1.escapeNamespaceFilename)(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}.testclasses.mjs`,
|
|
89116
|
+
localClass: def.name.toLowerCase(),
|
|
89116
89117
|
riskLevel: def.riskLevel,
|
|
89117
89118
|
duration: def.duration,
|
|
89118
89119
|
methods: methods,
|
|
@@ -89168,41 +89169,65 @@ run().then(() => {
|
|
|
89168
89169
|
return tests;
|
|
89169
89170
|
}
|
|
89170
89171
|
unitTestScript(reg, skip) {
|
|
89172
|
+
const callSpecial = (name) => {
|
|
89173
|
+
let ret = "";
|
|
89174
|
+
ret += `if (test.${name}) await test.${name}();\n`;
|
|
89175
|
+
ret += ` if (test.FRIENDS_ACCESS_INSTANCE.${name}) await test.FRIENDS_ACCESS_INSTANCE.${name}();\n`;
|
|
89176
|
+
ret += ` if (test.FRIENDS_ACCESS_INSTANCE.SUPER && test.FRIENDS_ACCESS_INSTANCE.SUPER.${name}) await test.FRIENDS_ACCESS_INSTANCE.SUPER.${name}();`;
|
|
89177
|
+
return ret;
|
|
89178
|
+
};
|
|
89171
89179
|
let ret = `/* eslint-disable curly */
|
|
89180
|
+
/* eslint-disable max-len */
|
|
89172
89181
|
import {initializeABAP} from "./init.mjs";
|
|
89173
89182
|
|
|
89174
|
-
|
|
89175
|
-
|
|
89183
|
+
function getData() {
|
|
89184
|
+
const ret = [];\n`;
|
|
89176
89185
|
for (const st of this.getSortedTests(reg)) {
|
|
89177
|
-
|
|
89178
|
-
const lc = st.localClass.toLowerCase();
|
|
89179
|
-
ret += ` {
|
|
89180
|
-
const {${lc}} = await import("./${(0, initialization_1.escapeNamespaceFilename)(st.obj.getName().toLowerCase())}.${st.obj.getType().toLowerCase()}.testclasses.mjs");
|
|
89181
|
-
if (${lc}.class_setup) await ${lc}.class_setup();\n`;
|
|
89186
|
+
const methods = [];
|
|
89182
89187
|
for (const m of st.methods) {
|
|
89183
|
-
const skipThis = (skip || []).some(a => a.object === st.obj.getName()
|
|
89184
|
-
|
|
89185
|
-
|
|
89186
|
-
|
|
89187
|
-
|
|
89188
|
-
|
|
89189
|
-
|
|
89190
|
-
ret += ` if (test.${name}) await test.${name}();\n`;
|
|
89191
|
-
ret += ` if (test.FRIENDS_ACCESS_INSTANCE.${name}) await test.FRIENDS_ACCESS_INSTANCE.${name}();\n`;
|
|
89192
|
-
ret += ` if (test.FRIENDS_ACCESS_INSTANCE.SUPER && test.FRIENDS_ACCESS_INSTANCE.SUPER.${name}) await test.FRIENDS_ACCESS_INSTANCE.SUPER.${name}();\n`;
|
|
89193
|
-
return ret;
|
|
89194
|
-
};
|
|
89195
|
-
ret += ` {\n const test = await (new ${lc}()).constructor_();\n`;
|
|
89196
|
-
ret += callSpecial("setup");
|
|
89197
|
-
ret += ` console.log("${st.obj.getName()}: running ${lc}->${m}");\n`;
|
|
89198
|
-
ret += ` await test.FRIENDS_ACCESS_INSTANCE.${m}();\n`;
|
|
89199
|
-
ret += callSpecial("teardown");
|
|
89200
|
-
ret += ` }\n`;
|
|
89188
|
+
const skipThis = (skip || []).some(a => a.object.toUpperCase() === st.obj.getName().toUpperCase()
|
|
89189
|
+
&& a.class.toUpperCase() === st.localClass.toUpperCase()
|
|
89190
|
+
&& a.method.toUpperCase() === m.toUpperCase());
|
|
89191
|
+
methods.push({
|
|
89192
|
+
name: m,
|
|
89193
|
+
skip: skipThis,
|
|
89194
|
+
});
|
|
89201
89195
|
}
|
|
89202
|
-
ret += `
|
|
89203
|
-
|
|
89196
|
+
ret += ` ret.push({objectName: "${st.obj.getName()}",
|
|
89197
|
+
localClass: "${st.localClass}",
|
|
89198
|
+
methods: ${JSON.stringify(methods)},
|
|
89199
|
+
riskLevel: "${st.riskLevel}",
|
|
89200
|
+
filename: "${st.filename}"});\n`;
|
|
89204
89201
|
}
|
|
89205
|
-
ret +=
|
|
89202
|
+
ret += ` return ret;
|
|
89203
|
+
}
|
|
89204
|
+
|
|
89205
|
+
async function run() {
|
|
89206
|
+
const skipCritical = process.argv[2] === "--skip-critical";
|
|
89207
|
+
const onlyCritical = process.argv[2] === "--only-critical";
|
|
89208
|
+
await initializeABAP();
|
|
89209
|
+
for (const st of getData()) {
|
|
89210
|
+
const imported = await import(st.filename);
|
|
89211
|
+
const localClass = imported[st.localClass];
|
|
89212
|
+
if (localClass.class_setup) await localClass.class_setup();
|
|
89213
|
+
for (const m of st.methods) {
|
|
89214
|
+
const prefix = st.objectName + ": running " + st.localClass + "->" + m.name;
|
|
89215
|
+
if (m.skip) {
|
|
89216
|
+
console.log(prefix + ", skipped due to configuration");
|
|
89217
|
+
} else if (skipCritical && st.riskLevel === "CRITICAL") {
|
|
89218
|
+
console.log(prefix + ", skipped due to risk level " + st.riskLevel);
|
|
89219
|
+
} else if (onlyCritical && st.riskLevel !== "CRITICAL") {
|
|
89220
|
+
console.log(prefix + ", skipped due to risk level " + st.riskLevel);
|
|
89221
|
+
} else {
|
|
89222
|
+
const test = await (new localClass()).constructor_();
|
|
89223
|
+
${callSpecial("setup")}
|
|
89224
|
+
console.log(prefix);
|
|
89225
|
+
await test.FRIENDS_ACCESS_INSTANCE[m.name]();
|
|
89226
|
+
${callSpecial("teardown")}
|
|
89227
|
+
}
|
|
89228
|
+
}
|
|
89229
|
+
if (localClass.class_teardown) await localClass.class_teardown();
|
|
89230
|
+
}
|
|
89206
89231
|
}
|
|
89207
89232
|
|
|
89208
89233
|
run().then(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.41",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@abaplint/core": "^2.113.108",
|
|
31
|
-
"@abaplint/transpiler": "^2.10.
|
|
31
|
+
"@abaplint/transpiler": "^2.10.41",
|
|
32
32
|
"@types/glob": "^8.1.0",
|
|
33
33
|
"@types/node": "^22.14.0",
|
|
34
34
|
"@types/progress": "^2.0.7",
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"ts-json-schema-generator": "^2.4.0",
|
|
38
38
|
"typescript": "^5.8.3",
|
|
39
39
|
"webpack-cli": "^6.0.1",
|
|
40
|
-
"webpack": "^5.99.
|
|
40
|
+
"webpack": "^5.99.5"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/schema.json
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/ITranspilerConfig",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"ITranspilerConfig": {
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"input_filter": {
|
|
9
|
+
"description": "list of regex, case insensitive, empty gives all files, positive list",
|
|
10
|
+
"items": {
|
|
11
|
+
"type": "string"
|
|
12
|
+
},
|
|
13
|
+
"type": "array"
|
|
14
|
+
},
|
|
15
|
+
"input_folder": {
|
|
16
|
+
"anyOf": [
|
|
17
|
+
{
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"items": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"type": "array"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"lib": {
|
|
29
|
+
"deprecated": true,
|
|
30
|
+
"description": "to be deprecated, \"lib\", use \"libs\" instead",
|
|
31
|
+
"type": "string"
|
|
32
|
+
},
|
|
33
|
+
"libs": {
|
|
34
|
+
"items": {
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"properties": {
|
|
37
|
+
"files": {
|
|
38
|
+
"anyOf": [
|
|
39
|
+
{
|
|
40
|
+
"type": "string"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"items": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
},
|
|
46
|
+
"type": "array"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
"folder": {
|
|
51
|
+
"type": "string"
|
|
52
|
+
},
|
|
53
|
+
"url": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"type": "object"
|
|
58
|
+
},
|
|
59
|
+
"type": "array"
|
|
60
|
+
},
|
|
61
|
+
"options": {
|
|
62
|
+
"$ref": "#/definitions/ITranspilerOptions"
|
|
63
|
+
},
|
|
64
|
+
"output_folder": {
|
|
65
|
+
"type": "string"
|
|
66
|
+
},
|
|
67
|
+
"write_source_map": {
|
|
68
|
+
"type": "boolean"
|
|
69
|
+
},
|
|
70
|
+
"write_unit_tests": {
|
|
71
|
+
"type": "boolean"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"required": [
|
|
75
|
+
"input_folder",
|
|
76
|
+
"output_folder",
|
|
77
|
+
"options"
|
|
78
|
+
],
|
|
79
|
+
"type": "object"
|
|
80
|
+
},
|
|
81
|
+
"ITranspilerOptions": {
|
|
82
|
+
"additionalProperties": false,
|
|
83
|
+
"properties": {
|
|
84
|
+
"addCommonJS": {
|
|
85
|
+
"description": "adds common js modules",
|
|
86
|
+
"type": "boolean"
|
|
87
|
+
},
|
|
88
|
+
"addFilenames": {
|
|
89
|
+
"description": "adds filenames as comments in the output js",
|
|
90
|
+
"type": "boolean"
|
|
91
|
+
},
|
|
92
|
+
"extraSetup": {
|
|
93
|
+
"description": "extra setup script to be executed during initialization",
|
|
94
|
+
"type": "string"
|
|
95
|
+
},
|
|
96
|
+
"ignoreSourceMap": {
|
|
97
|
+
"description": "ignore source map",
|
|
98
|
+
"type": "boolean"
|
|
99
|
+
},
|
|
100
|
+
"ignoreSyntaxCheck": {
|
|
101
|
+
"description": "ignore syntax check, used for internal testing",
|
|
102
|
+
"type": "boolean"
|
|
103
|
+
},
|
|
104
|
+
"keywords": {
|
|
105
|
+
"description": "list of keywords to rename, if not supplied default will be used",
|
|
106
|
+
"items": {
|
|
107
|
+
"type": "string"
|
|
108
|
+
},
|
|
109
|
+
"type": "array"
|
|
110
|
+
},
|
|
111
|
+
"skip": {
|
|
112
|
+
"$ref": "#/definitions/TestMethodList",
|
|
113
|
+
"description": "list of unit tests to skip"
|
|
114
|
+
},
|
|
115
|
+
"skipConstants": {
|
|
116
|
+
"description": "skip outputing constants, used for internal testing",
|
|
117
|
+
"type": "boolean"
|
|
118
|
+
},
|
|
119
|
+
"skipReposrc": {
|
|
120
|
+
"description": "dont insert into REPOSRC",
|
|
121
|
+
"type": "boolean"
|
|
122
|
+
},
|
|
123
|
+
"unknownTypes": {
|
|
124
|
+
"$ref": "#/definitions/UnknownTypesEnum",
|
|
125
|
+
"description": "sets behavior for unknown types, either fail at compile- or run-time"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"type": "object"
|
|
129
|
+
},
|
|
130
|
+
"TestMethodList": {
|
|
131
|
+
"items": {
|
|
132
|
+
"additionalProperties": false,
|
|
133
|
+
"properties": {
|
|
134
|
+
"class": {
|
|
135
|
+
"type": "string"
|
|
136
|
+
},
|
|
137
|
+
"method": {
|
|
138
|
+
"type": "string"
|
|
139
|
+
},
|
|
140
|
+
"object": {
|
|
141
|
+
"type": "string"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"required": [
|
|
145
|
+
"object",
|
|
146
|
+
"class",
|
|
147
|
+
"method"
|
|
148
|
+
],
|
|
149
|
+
"type": "object"
|
|
150
|
+
},
|
|
151
|
+
"type": "array"
|
|
152
|
+
},
|
|
153
|
+
"UnknownTypesEnum": {
|
|
154
|
+
"enum": [
|
|
155
|
+
"compileError",
|
|
156
|
+
"runtimeError"
|
|
157
|
+
],
|
|
158
|
+
"type": "string"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|