@abaplint/transpiler-cli 2.8.29 → 2.10.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/build/bundle.js +137 -16
- 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
|
}
|
|
@@ -84652,19 +84738,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
84652
84738
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
84653
84739
|
};
|
|
84654
84740
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
84655
|
-
__exportStar(__webpack_require__(/*! ./
|
|
84741
|
+
__exportStar(__webpack_require__(/*! ./at_first */ "./node_modules/@abaplint/transpiler/build/src/structures/at_first.js"), exports);
|
|
84742
|
+
__exportStar(__webpack_require__(/*! ./at_last */ "./node_modules/@abaplint/transpiler/build/src/structures/at_last.js"), exports);
|
|
84656
84743
|
__exportStar(__webpack_require__(/*! ./case_type */ "./node_modules/@abaplint/transpiler/build/src/structures/case_type.js"), exports);
|
|
84744
|
+
__exportStar(__webpack_require__(/*! ./case */ "./node_modules/@abaplint/transpiler/build/src/structures/case.js"), exports);
|
|
84657
84745
|
__exportStar(__webpack_require__(/*! ./class_definition */ "./node_modules/@abaplint/transpiler/build/src/structures/class_definition.js"), exports);
|
|
84658
84746
|
__exportStar(__webpack_require__(/*! ./class_implementation */ "./node_modules/@abaplint/transpiler/build/src/structures/class_implementation.js"), exports);
|
|
84659
84747
|
__exportStar(__webpack_require__(/*! ./constants */ "./node_modules/@abaplint/transpiler/build/src/structures/constants.js"), exports);
|
|
84660
84748
|
__exportStar(__webpack_require__(/*! ./data */ "./node_modules/@abaplint/transpiler/build/src/structures/data.js"), exports);
|
|
84661
84749
|
__exportStar(__webpack_require__(/*! ./define */ "./node_modules/@abaplint/transpiler/build/src/structures/define.js"), exports);
|
|
84662
84750
|
__exportStar(__webpack_require__(/*! ./do */ "./node_modules/@abaplint/transpiler/build/src/structures/do.js"), exports);
|
|
84663
|
-
__exportStar(__webpack_require__(/*! ./at_first */ "./node_modules/@abaplint/transpiler/build/src/structures/at_first.js"), exports);
|
|
84664
|
-
__exportStar(__webpack_require__(/*! ./at_last */ "./node_modules/@abaplint/transpiler/build/src/structures/at_last.js"), exports);
|
|
84665
84751
|
__exportStar(__webpack_require__(/*! ./function_module */ "./node_modules/@abaplint/transpiler/build/src/structures/function_module.js"), exports);
|
|
84666
84752
|
__exportStar(__webpack_require__(/*! ./interface */ "./node_modules/@abaplint/transpiler/build/src/structures/interface.js"), exports);
|
|
84667
84753
|
__exportStar(__webpack_require__(/*! ./loop */ "./node_modules/@abaplint/transpiler/build/src/structures/loop.js"), exports);
|
|
84754
|
+
__exportStar(__webpack_require__(/*! ./module */ "./node_modules/@abaplint/transpiler/build/src/structures/module.js"), exports);
|
|
84668
84755
|
__exportStar(__webpack_require__(/*! ./select */ "./node_modules/@abaplint/transpiler/build/src/structures/select.js"), exports);
|
|
84669
84756
|
__exportStar(__webpack_require__(/*! ./try */ "./node_modules/@abaplint/transpiler/build/src/structures/try.js"), exports);
|
|
84670
84757
|
__exportStar(__webpack_require__(/*! ./types */ "./node_modules/@abaplint/transpiler/build/src/structures/types.js"), exports);
|
|
@@ -84869,6 +84956,27 @@ exports.LoopTranspiler = LoopTranspiler;
|
|
|
84869
84956
|
|
|
84870
84957
|
/***/ }),
|
|
84871
84958
|
|
|
84959
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/structures/module.js":
|
|
84960
|
+
/*!**************************************************************************!*\
|
|
84961
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/structures/module.js ***!
|
|
84962
|
+
\**************************************************************************/
|
|
84963
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
84964
|
+
|
|
84965
|
+
"use strict";
|
|
84966
|
+
|
|
84967
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
84968
|
+
exports.ModuleTranspiler = void 0;
|
|
84969
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
84970
|
+
class ModuleTranspiler {
|
|
84971
|
+
transpile(_node, _traversal) {
|
|
84972
|
+
return new chunk_1.Chunk().appendString("// MODULE skipped by transpiler\n");
|
|
84973
|
+
}
|
|
84974
|
+
}
|
|
84975
|
+
exports.ModuleTranspiler = ModuleTranspiler;
|
|
84976
|
+
//# sourceMappingURL=module.js.map
|
|
84977
|
+
|
|
84978
|
+
/***/ }),
|
|
84979
|
+
|
|
84872
84980
|
/***/ "./node_modules/@abaplint/transpiler/build/src/structures/select.js":
|
|
84873
84981
|
/*!**************************************************************************!*\
|
|
84874
84982
|
!*** ./node_modules/@abaplint/transpiler/build/src/structures/select.js ***!
|
|
@@ -85392,8 +85500,23 @@ class Traversal {
|
|
|
85392
85500
|
else {
|
|
85393
85501
|
this.scopeCache = undefined;
|
|
85394
85502
|
}
|
|
85503
|
+
if (node === undefined
|
|
85504
|
+
&& this.obj instanceof abaplint.Objects.FunctionGroup
|
|
85505
|
+
&& this.obj.getInclude(filename.split(".")[2].replace(/#/g, "/"))) {
|
|
85506
|
+
// workaround for INCLUDEs in function groups
|
|
85507
|
+
return this.fuctionGroupWorkaround(token);
|
|
85508
|
+
}
|
|
85395
85509
|
return node;
|
|
85396
85510
|
}
|
|
85511
|
+
fuctionGroupWorkaround(token) {
|
|
85512
|
+
// check the function group level, it might be an INCLUDE defining the DATA
|
|
85513
|
+
const functionGroupLevel = this.spaghetti.getFirstChild()?.getFirstChild();
|
|
85514
|
+
const variable = functionGroupLevel?.getData().vars[token.getStr().toUpperCase()];
|
|
85515
|
+
if (variable?.getStart().equals(token.getStart())) {
|
|
85516
|
+
return functionGroupLevel;
|
|
85517
|
+
}
|
|
85518
|
+
return undefined;
|
|
85519
|
+
}
|
|
85397
85520
|
getInterfaceDefinition(token) {
|
|
85398
85521
|
let scope = this.findCurrentScopeByToken(token);
|
|
85399
85522
|
while (scope !== undefined) {
|
|
@@ -86361,9 +86484,7 @@ run().then(() => {
|
|
|
86361
86484
|
}
|
|
86362
86485
|
for (const obj of reg.getObjects()) {
|
|
86363
86486
|
if (obj instanceof abaplint.Objects.FunctionGroup) {
|
|
86364
|
-
|
|
86365
|
-
list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.fugr.${this.escapeNamespace(m.getName().toLowerCase())}`));
|
|
86366
|
-
}
|
|
86487
|
+
list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.fugr`));
|
|
86367
86488
|
}
|
|
86368
86489
|
else if (obj instanceof abaplint.Objects.Class) {
|
|
86369
86490
|
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.10.1",
|
|
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.10.1",
|
|
30
30
|
"@types/glob": "^8.1.0",
|
|
31
31
|
"glob": "=7.2.0",
|
|
32
32
|
"@types/progress": "^2.0.7",
|