@abaplint/transpiler-cli 2.8.29 → 2.9.0
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/build/bundle.js +112 -13
- package/package.json +2 -2
package/build/bundle.js
CHANGED
|
@@ -75488,16 +75488,11 @@ class FunctionParametersTranspiler {
|
|
|
75488
75488
|
if (ch) {
|
|
75489
75489
|
params.changing = traversal.traverse(ch).getCode();
|
|
75490
75490
|
}
|
|
75491
|
-
|
|
75491
|
+
const ret = [];
|
|
75492
75492
|
for (const p of Object.keys(params)) {
|
|
75493
|
-
|
|
75494
|
-
ret += p + ": " + params[p];
|
|
75495
|
-
}
|
|
75496
|
-
else {
|
|
75497
|
-
ret += ", " + p + ": " + params[p];
|
|
75498
|
-
}
|
|
75493
|
+
ret.push(p + ": " + params[p]);
|
|
75499
75494
|
}
|
|
75500
|
-
return new chunk_1.Chunk(`{${ret}}`);
|
|
75495
|
+
return new chunk_1.Chunk(`{${ret.join(", ")}}`);
|
|
75501
75496
|
}
|
|
75502
75497
|
}
|
|
75503
75498
|
exports.FunctionParametersTranspiler = FunctionParametersTranspiler;
|
|
@@ -76087,11 +76082,12 @@ exports.ParameterListTTranspiler = ParameterListTTranspiler;
|
|
|
76087
76082
|
|
|
76088
76083
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
76089
76084
|
exports.ParameterNameTranspiler = void 0;
|
|
76085
|
+
const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
76090
76086
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
76091
76087
|
class ParameterNameTranspiler {
|
|
76092
76088
|
transpile(node, traversal) {
|
|
76093
76089
|
const nameToken = node.getFirstToken();
|
|
76094
|
-
const name = nameToken.getStr().toLowerCase();
|
|
76090
|
+
const name = traversal_1.Traversal.escapeNamespace(nameToken.getStr().toLowerCase());
|
|
76095
76091
|
return new chunk_1.Chunk().append(name, nameToken, traversal);
|
|
76096
76092
|
}
|
|
76097
76093
|
}
|
|
@@ -77508,6 +77504,57 @@ exports.HandleEnqu = HandleEnqu;
|
|
|
77508
77504
|
|
|
77509
77505
|
/***/ }),
|
|
77510
77506
|
|
|
77507
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/handlers/handle_fugr.js":
|
|
77508
|
+
/*!*****************************************************************************!*\
|
|
77509
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/handlers/handle_fugr.js ***!
|
|
77510
|
+
\*****************************************************************************/
|
|
77511
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
77512
|
+
|
|
77513
|
+
"use strict";
|
|
77514
|
+
|
|
77515
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
77516
|
+
exports.HandleFUGR = void 0;
|
|
77517
|
+
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
77518
|
+
const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
77519
|
+
const rearranger_1 = __webpack_require__(/*! ../rearranger */ "./node_modules/@abaplint/transpiler/build/src/rearranger.js");
|
|
77520
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
77521
|
+
class HandleFUGR {
|
|
77522
|
+
constructor(options) {
|
|
77523
|
+
this.options = options;
|
|
77524
|
+
}
|
|
77525
|
+
// function groups are compiled into a single file, with one closure for the function groups top variables
|
|
77526
|
+
runObject(obj, reg) {
|
|
77527
|
+
const spaghetti = new abaplint.SyntaxLogic(reg, obj).run().spaghetti;
|
|
77528
|
+
const chunk = new chunk_1.Chunk().appendString("{\n");
|
|
77529
|
+
for (const file of obj.getSequencedFiles()) {
|
|
77530
|
+
if (this.options?.addFilenames === true) {
|
|
77531
|
+
chunk.appendString("// " + file.getFilename() + "\n");
|
|
77532
|
+
}
|
|
77533
|
+
const rearranged = new rearranger_1.Rearranger().run(obj.getType(), file.getStructure());
|
|
77534
|
+
const contents = new traversal_1.Traversal(spaghetti, file, obj, reg, this.options).traverse(rearranged);
|
|
77535
|
+
chunk.appendChunk(contents);
|
|
77536
|
+
chunk.stripLastNewline();
|
|
77537
|
+
chunk.runIndentationLogic(this.options?.ignoreSourceMap);
|
|
77538
|
+
}
|
|
77539
|
+
chunk.appendString("\n}");
|
|
77540
|
+
const output = {
|
|
77541
|
+
object: {
|
|
77542
|
+
name: obj.getName(),
|
|
77543
|
+
type: obj.getType(),
|
|
77544
|
+
},
|
|
77545
|
+
filename: obj.getName().toLowerCase().replace(/\//g, "#") + ".fugr.mjs",
|
|
77546
|
+
chunk: chunk,
|
|
77547
|
+
requires: [],
|
|
77548
|
+
exports: [],
|
|
77549
|
+
};
|
|
77550
|
+
return [output];
|
|
77551
|
+
}
|
|
77552
|
+
}
|
|
77553
|
+
exports.HandleFUGR = HandleFUGR;
|
|
77554
|
+
//# sourceMappingURL=handle_fugr.js.map
|
|
77555
|
+
|
|
77556
|
+
/***/ }),
|
|
77557
|
+
|
|
77511
77558
|
/***/ "./node_modules/@abaplint/transpiler/build/src/handlers/handle_msag.js":
|
|
77512
77559
|
/*!*****************************************************************************!*\
|
|
77513
77560
|
!*** ./node_modules/@abaplint/transpiler/build/src/handlers/handle_msag.js ***!
|
|
@@ -77902,6 +77949,7 @@ const handle_w3mi_1 = __webpack_require__(/*! ./handlers/handle_w3mi */ "./node_
|
|
|
77902
77949
|
const handle_smim_1 = __webpack_require__(/*! ./handlers/handle_smim */ "./node_modules/@abaplint/transpiler/build/src/handlers/handle_smim.js");
|
|
77903
77950
|
const handle_msag_1 = __webpack_require__(/*! ./handlers/handle_msag */ "./node_modules/@abaplint/transpiler/build/src/handlers/handle_msag.js");
|
|
77904
77951
|
const handle_oa2p_1 = __webpack_require__(/*! ./handlers/handle_oa2p */ "./node_modules/@abaplint/transpiler/build/src/handlers/handle_oa2p.js");
|
|
77952
|
+
const handle_fugr_1 = __webpack_require__(/*! ./handlers/handle_fugr */ "./node_modules/@abaplint/transpiler/build/src/handlers/handle_fugr.js");
|
|
77905
77953
|
class Transpiler {
|
|
77906
77954
|
constructor(options) {
|
|
77907
77955
|
this.options = options;
|
|
@@ -77938,6 +77986,9 @@ class Transpiler {
|
|
|
77938
77986
|
if (obj instanceof abaplint.Objects.TypePool) {
|
|
77939
77987
|
output.objects.push(...new handle_type_pool_1.HandleTypePool().runObject(obj, reg));
|
|
77940
77988
|
}
|
|
77989
|
+
else if (obj instanceof abaplint.Objects.FunctionGroup) {
|
|
77990
|
+
output.objects.push(...new handle_fugr_1.HandleFUGR(this.options).runObject(obj, reg));
|
|
77991
|
+
}
|
|
77941
77992
|
else if (obj instanceof abaplint.ABAPObject) {
|
|
77942
77993
|
output.objects.push(...new handle_abap_1.HandleABAP(this.options).runObject(obj, reg));
|
|
77943
77994
|
}
|
|
@@ -78294,6 +78345,20 @@ class Requires {
|
|
|
78294
78345
|
});
|
|
78295
78346
|
}
|
|
78296
78347
|
}
|
|
78348
|
+
/*
|
|
78349
|
+
else if (obj.getType() === "FUGR") {
|
|
78350
|
+
const fugr = obj as abaplint.Objects.FunctionGroup;
|
|
78351
|
+
const functionModules = fugr.getModules();
|
|
78352
|
+
const isFunctionModule = functionModules.find((f) => filename.includes("." + f.getName().toLowerCase() + ".")) !== undefined;
|
|
78353
|
+
if (isFunctionModule) {
|
|
78354
|
+
const name = Traversal.escapeNamespace(fugr.getName())?.toLowerCase();
|
|
78355
|
+
add({
|
|
78356
|
+
filename: name + ".fugr.sapl" + name + ".abap",
|
|
78357
|
+
name: undefined,
|
|
78358
|
+
});
|
|
78359
|
+
}
|
|
78360
|
+
}
|
|
78361
|
+
*/
|
|
78297
78362
|
// always add CX_ROOT, it is used for CATCH, no catches in global interfaces
|
|
78298
78363
|
// todo, it might be possible to remove this, as CATCH uses instanceof with dynamic registered classes
|
|
78299
78364
|
if (obj.getType() !== "INTF") {
|
|
@@ -80968,9 +81033,30 @@ exports.ImportTranspiler = ImportTranspiler;
|
|
|
80968
81033
|
|
|
80969
81034
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
80970
81035
|
exports.IncludeTranspiler = void 0;
|
|
81036
|
+
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
81037
|
+
const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
80971
81038
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
81039
|
+
const rearranger_1 = __webpack_require__(/*! ../rearranger */ "./node_modules/@abaplint/transpiler/build/src/rearranger.js");
|
|
80972
81040
|
class IncludeTranspiler {
|
|
80973
|
-
transpile(
|
|
81041
|
+
transpile(node, traversal) {
|
|
81042
|
+
const includeName = node.findDirectExpression(abaplint.Expressions.IncludeName)?.concatTokens();
|
|
81043
|
+
if (includeName === undefined) {
|
|
81044
|
+
throw new Error("INCLUDE, IncludeName not found");
|
|
81045
|
+
}
|
|
81046
|
+
const obj = traversal.getCurrentObject();
|
|
81047
|
+
if (obj instanceof abaplint.Objects.FunctionGroup) {
|
|
81048
|
+
if (includeName.toUpperCase().endsWith("XX") === false) {
|
|
81049
|
+
const include = obj.getInclude(includeName);
|
|
81050
|
+
if (include === undefined) {
|
|
81051
|
+
throw new Error(`Include ${includeName} not found`);
|
|
81052
|
+
}
|
|
81053
|
+
const sub = new traversal_1.Traversal(traversal.getSpaghetti(), include, traversal.getCurrentObject(), traversal.reg, traversal.options);
|
|
81054
|
+
const rearranged = new rearranger_1.Rearranger().run(obj.getType(), include.getStructure());
|
|
81055
|
+
const chunk = sub.traverse(rearranged);
|
|
81056
|
+
// console.dir(chunk.getCode());
|
|
81057
|
+
return chunk;
|
|
81058
|
+
}
|
|
81059
|
+
}
|
|
80974
81060
|
// todo, this will not work
|
|
80975
81061
|
return new chunk_1.Chunk("");
|
|
80976
81062
|
}
|
|
@@ -85392,8 +85478,23 @@ class Traversal {
|
|
|
85392
85478
|
else {
|
|
85393
85479
|
this.scopeCache = undefined;
|
|
85394
85480
|
}
|
|
85481
|
+
if (node === undefined
|
|
85482
|
+
&& this.obj instanceof abaplint.Objects.FunctionGroup
|
|
85483
|
+
&& this.obj.getInclude(filename.split(".")[2])) {
|
|
85484
|
+
// workaround for INCLUDEs in function groups
|
|
85485
|
+
return this.fuctionGroupWorkaround(token);
|
|
85486
|
+
}
|
|
85395
85487
|
return node;
|
|
85396
85488
|
}
|
|
85489
|
+
fuctionGroupWorkaround(token) {
|
|
85490
|
+
// check the function group level, it might be an INCLUDE defining the DATA
|
|
85491
|
+
const functionGroupLevel = this.spaghetti.getFirstChild()?.getFirstChild();
|
|
85492
|
+
const variable = functionGroupLevel?.getData().vars[token.getStr().toUpperCase()];
|
|
85493
|
+
if (variable?.getStart().equals(token.getStart())) {
|
|
85494
|
+
return functionGroupLevel;
|
|
85495
|
+
}
|
|
85496
|
+
return undefined;
|
|
85497
|
+
}
|
|
85397
85498
|
getInterfaceDefinition(token) {
|
|
85398
85499
|
let scope = this.findCurrentScopeByToken(token);
|
|
85399
85500
|
while (scope !== undefined) {
|
|
@@ -86361,9 +86462,7 @@ run().then(() => {
|
|
|
86361
86462
|
}
|
|
86362
86463
|
for (const obj of reg.getObjects()) {
|
|
86363
86464
|
if (obj instanceof abaplint.Objects.FunctionGroup) {
|
|
86364
|
-
|
|
86365
|
-
list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.fugr.${this.escapeNamespace(m.getName().toLowerCase())}`));
|
|
86366
|
-
}
|
|
86465
|
+
list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.fugr`));
|
|
86367
86466
|
}
|
|
86368
86467
|
else if (obj instanceof abaplint.Objects.Class) {
|
|
86369
86468
|
if (obj.getName().toUpperCase() !== "CL_ABAP_CHAR_UTILITIES"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"author": "abaplint",
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@abaplint/transpiler": "^2.
|
|
29
|
+
"@abaplint/transpiler": "^2.9.0",
|
|
30
30
|
"@types/glob": "^8.1.0",
|
|
31
31
|
"glob": "=7.2.0",
|
|
32
32
|
"@types/progress": "^2.0.7",
|