@abaplint/transpiler-cli 2.6.41 → 2.6.43
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 +93 -34
- package/package.json +6 -6
package/build/bundle.js
CHANGED
|
@@ -21625,7 +21625,23 @@ class BasicTypes {
|
|
|
21625
21625
|
}
|
|
21626
21626
|
const constant = val.findFirstExpression(Expressions.Constant);
|
|
21627
21627
|
if (constant) {
|
|
21628
|
-
|
|
21628
|
+
const conc = val.findFirstExpression(Expressions.ConcatenatedConstant);
|
|
21629
|
+
if (conc) {
|
|
21630
|
+
const first = conc.getFirstToken().getStr().substring(0, 1);
|
|
21631
|
+
let result = "";
|
|
21632
|
+
for (const token of conc.getAllTokens()) {
|
|
21633
|
+
if (token.getStr() === "&") {
|
|
21634
|
+
continue;
|
|
21635
|
+
}
|
|
21636
|
+
else {
|
|
21637
|
+
result += token.getStr().substring(1, token.getStr().length - 1);
|
|
21638
|
+
}
|
|
21639
|
+
}
|
|
21640
|
+
return first + result + first;
|
|
21641
|
+
}
|
|
21642
|
+
else {
|
|
21643
|
+
return constant.concatTokens();
|
|
21644
|
+
}
|
|
21629
21645
|
}
|
|
21630
21646
|
const chain = val.findFirstExpression(Expressions.SimpleFieldChain);
|
|
21631
21647
|
if (chain) {
|
|
@@ -32978,7 +32994,7 @@ class CharacterType extends _abstract_type_1.AbstractType {
|
|
|
32978
32994
|
constructor(length, extra) {
|
|
32979
32995
|
super(extra);
|
|
32980
32996
|
if (length <= 0) {
|
|
32981
|
-
throw new Error("Bad LENGTH");
|
|
32997
|
+
throw new Error("Bad LENGTH, Character");
|
|
32982
32998
|
}
|
|
32983
32999
|
this.length = length;
|
|
32984
33000
|
}
|
|
@@ -33349,7 +33365,7 @@ class FloatingPointType extends _abstract_type_1.AbstractType {
|
|
|
33349
33365
|
constructor(length, qualifiedName) {
|
|
33350
33366
|
super({ qualifiedName: qualifiedName });
|
|
33351
33367
|
if (length <= 0) {
|
|
33352
|
-
throw new Error("Bad LENGTH");
|
|
33368
|
+
throw new Error("Bad LENGTH, Floating Point");
|
|
33353
33369
|
}
|
|
33354
33370
|
this.length = length;
|
|
33355
33371
|
}
|
|
@@ -33426,7 +33442,7 @@ class HexType extends _abstract_type_1.AbstractType {
|
|
|
33426
33442
|
constructor(length, qualifiedName) {
|
|
33427
33443
|
super({ qualifiedName: qualifiedName });
|
|
33428
33444
|
if (length <= 0) {
|
|
33429
|
-
throw new Error("Bad
|
|
33445
|
+
throw new Error("Bad LENGTHm, Hex");
|
|
33430
33446
|
}
|
|
33431
33447
|
this.length = length;
|
|
33432
33448
|
}
|
|
@@ -33591,7 +33607,7 @@ class NumericType extends _abstract_type_1.AbstractType {
|
|
|
33591
33607
|
constructor(length, qualifiedName) {
|
|
33592
33608
|
super({ qualifiedName: qualifiedName });
|
|
33593
33609
|
if (length <= 0) {
|
|
33594
|
-
throw new Error("Bad LENGTH");
|
|
33610
|
+
throw new Error("Bad LENGTH, Numeric");
|
|
33595
33611
|
}
|
|
33596
33612
|
this.length = length;
|
|
33597
33613
|
}
|
|
@@ -33678,10 +33694,10 @@ class PackedType extends _abstract_type_1.AbstractType {
|
|
|
33678
33694
|
constructor(length, decimals, extra) {
|
|
33679
33695
|
super(extra);
|
|
33680
33696
|
if (length <= 0) {
|
|
33681
|
-
throw new Error("Bad LENGTH");
|
|
33697
|
+
throw new Error("Bad LENGTH, Packed");
|
|
33682
33698
|
}
|
|
33683
33699
|
else if (decimals < 0) {
|
|
33684
|
-
throw new Error("Bad DECIMALS");
|
|
33700
|
+
throw new Error("Bad DECIMALS, Packed");
|
|
33685
33701
|
}
|
|
33686
33702
|
this.length = length;
|
|
33687
33703
|
this.decimals = decimals;
|
|
@@ -36793,9 +36809,10 @@ class Config {
|
|
|
36793
36809
|
return new Config(JSON.stringify(config));
|
|
36794
36810
|
}
|
|
36795
36811
|
getEnabledRules() {
|
|
36812
|
+
var _a;
|
|
36796
36813
|
const rules = [];
|
|
36797
36814
|
for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {
|
|
36798
|
-
const ruleConfig = this.config["rules"][rule.getMetadata().key];
|
|
36815
|
+
const ruleConfig = (_a = this.config["rules"]) === null || _a === void 0 ? void 0 : _a[rule.getMetadata().key];
|
|
36799
36816
|
const ruleExists = ruleConfig !== undefined;
|
|
36800
36817
|
if (ruleExists) {
|
|
36801
36818
|
if (ruleConfig === false) { // "rule": false
|
|
@@ -44150,6 +44167,7 @@ class RenameDataElement {
|
|
|
44150
44167
|
changes = changes.concat(helper.renameDDICCodeReferences(obj, oldName, newName));
|
|
44151
44168
|
changes = changes.concat(helper.renameDDICTABLReferences(obj, oldName, newName));
|
|
44152
44169
|
changes = changes.concat(helper.renameDDICTTYPReferences(obj, oldName, newName));
|
|
44170
|
+
changes = changes.concat(helper.renameDDICAUTHReferences(obj, oldName, newName));
|
|
44153
44171
|
return {
|
|
44154
44172
|
documentChanges: changes,
|
|
44155
44173
|
};
|
|
@@ -44619,6 +44637,21 @@ class RenamerHelper {
|
|
|
44619
44637
|
}
|
|
44620
44638
|
return changes;
|
|
44621
44639
|
}
|
|
44640
|
+
renameDDICAUTHReferences(obj, oldName, newName) {
|
|
44641
|
+
const changes = [];
|
|
44642
|
+
const used = this.reg.getDDICReferences().listWhereUsed(obj);
|
|
44643
|
+
for (const u of used) {
|
|
44644
|
+
if (u.type !== "AUTH") {
|
|
44645
|
+
continue;
|
|
44646
|
+
}
|
|
44647
|
+
const tabl = this.reg.getObject(u.type, u.name);
|
|
44648
|
+
if (tabl === undefined) {
|
|
44649
|
+
continue;
|
|
44650
|
+
}
|
|
44651
|
+
changes.push(...this.buildXMLFileEdits(tabl, "ROLLNAME", oldName, newName));
|
|
44652
|
+
}
|
|
44653
|
+
return changes;
|
|
44654
|
+
}
|
|
44622
44655
|
buildXMLFileEdits(object, xmlTag, oldName, newName) {
|
|
44623
44656
|
const changes = [];
|
|
44624
44657
|
const xml = object.getXMLFile();
|
|
@@ -46612,7 +46645,7 @@ class Registry {
|
|
|
46612
46645
|
}
|
|
46613
46646
|
static abaplintVersion() {
|
|
46614
46647
|
// magic, see build script "version.sh"
|
|
46615
|
-
return "2.99.
|
|
46648
|
+
return "2.99.7";
|
|
46616
46649
|
}
|
|
46617
46650
|
getDDICReferences() {
|
|
46618
46651
|
return this.references;
|
|
@@ -48901,10 +48934,12 @@ class CheckComments extends _abap_rule_1.ABAPRule {
|
|
|
48901
48934
|
shortDescription: `
|
|
48902
48935
|
Various checks for comment usage.`,
|
|
48903
48936
|
extendedInformation: `
|
|
48904
|
-
|
|
48937
|
+
Detects end of line comments. Comments starting with "#EC" or "##" are ignored
|
|
48905
48938
|
|
|
48906
48939
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#put-comments-before-the-statement-they-relate-to`,
|
|
48907
48940
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
48941
|
+
badExample: `WRITE 2. " descriptive comment`,
|
|
48942
|
+
goodExample: `" descriptive comment\nWRITE 2.`,
|
|
48908
48943
|
};
|
|
48909
48944
|
}
|
|
48910
48945
|
getDescription(issueType) {
|
|
@@ -62775,6 +62810,10 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
|
|
|
62775
62810
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
62776
62811
|
const __1 = __webpack_require__(/*! .. */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
62777
62812
|
class SelectSingleFullKeyConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
62813
|
+
constructor() {
|
|
62814
|
+
super(...arguments);
|
|
62815
|
+
this.allowPseudo = true;
|
|
62816
|
+
}
|
|
62778
62817
|
}
|
|
62779
62818
|
exports.SelectSingleFullKeyConf = SelectSingleFullKeyConf;
|
|
62780
62819
|
class SelectSingleFullKey {
|
|
@@ -62796,6 +62835,14 @@ class SelectSingleFullKey {
|
|
|
62796
62835
|
return this;
|
|
62797
62836
|
}
|
|
62798
62837
|
getConfig() {
|
|
62838
|
+
if (this.conf === undefined) {
|
|
62839
|
+
this.conf = {
|
|
62840
|
+
allowPseudo: true,
|
|
62841
|
+
};
|
|
62842
|
+
}
|
|
62843
|
+
if (this.conf.allowPseudo === undefined) {
|
|
62844
|
+
this.conf.allowPseudo = true;
|
|
62845
|
+
}
|
|
62799
62846
|
return this.conf;
|
|
62800
62847
|
}
|
|
62801
62848
|
setConfig(conf) {
|
|
@@ -62827,7 +62874,11 @@ class SelectSingleFullKey {
|
|
|
62827
62874
|
continue;
|
|
62828
62875
|
}
|
|
62829
62876
|
const next = statements[i + 1];
|
|
62830
|
-
if ((next === null || next === void 0 ? void 0 : next.get()) instanceof __1.Comment
|
|
62877
|
+
if ((next === null || next === void 0 ? void 0 : next.get()) instanceof __1.Comment
|
|
62878
|
+
&& next.concatTokens().includes(this.getMetadata().pseudoComment + "")) {
|
|
62879
|
+
if (this.getConfig().allowPseudo !== true) {
|
|
62880
|
+
issues.push(issue_1.Issue.atStatement(file, s, "Pseudo comment not allowed", this.getMetadata().key, this.getConfig().severity));
|
|
62881
|
+
}
|
|
62831
62882
|
continue;
|
|
62832
62883
|
}
|
|
62833
62884
|
const tabl = this.findReference(databaseTable.getFirstToken().getStart(), syntax.spaghetti, file);
|
|
@@ -62836,7 +62887,6 @@ class SelectSingleFullKey {
|
|
|
62836
62887
|
continue;
|
|
62837
62888
|
}
|
|
62838
62889
|
const keys = table.listKeys(this.reg);
|
|
62839
|
-
// const type = table.parseType(this.reg);
|
|
62840
62890
|
const cond = s.findFirstExpression(__1.Expressions.SQLCond);
|
|
62841
62891
|
const set = new Set();
|
|
62842
62892
|
for (const key of keys) {
|
|
@@ -63920,7 +63970,7 @@ https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenopensql_strict_mo
|
|
|
63920
63970
|
Also see separate rule sql_escape_host_variables
|
|
63921
63971
|
|
|
63922
63972
|
Activates from v750 and up`,
|
|
63923
|
-
tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.
|
|
63973
|
+
tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Quickfix],
|
|
63924
63974
|
};
|
|
63925
63975
|
}
|
|
63926
63976
|
getConfig() {
|
|
@@ -65103,6 +65153,7 @@ ENDIF.`,
|
|
|
65103
65153
|
&& !(statement.get() instanceof Statements.DataEnd)
|
|
65104
65154
|
&& !(statement.get() instanceof Statements.Type)
|
|
65105
65155
|
&& !(statement.get() instanceof Statements.Form)
|
|
65156
|
+
&& !(statement.get() instanceof Statements.Tables)
|
|
65106
65157
|
&& !(statement.get() instanceof Statements.TypeEnd)
|
|
65107
65158
|
&& !(statement.get() instanceof Statements.Constant)
|
|
65108
65159
|
&& !(statement.get() instanceof Statements.ConstantEnd)
|
|
@@ -68665,14 +68716,14 @@ class ConstantTranspiler {
|
|
|
68665
68716
|
return new chunk_1.Chunk().append(code, node, traversal);
|
|
68666
68717
|
}
|
|
68667
68718
|
else if (res.startsWith("`") && this.addGet === false) {
|
|
68668
|
-
const code = "new abap.types.String().set(" +
|
|
68719
|
+
const code = "new abap.types.String().set(" + ConstantTranspiler.escape(res) + ")";
|
|
68669
68720
|
return new chunk_1.Chunk().append(code, node, traversal);
|
|
68670
68721
|
}
|
|
68671
68722
|
else {
|
|
68672
68723
|
if (res.startsWith("'")) {
|
|
68673
68724
|
res = "'" + res.substring(1, res.length - 1).trimEnd() + "'";
|
|
68674
68725
|
}
|
|
68675
|
-
const code =
|
|
68726
|
+
const code = ConstantTranspiler.escape(res);
|
|
68676
68727
|
return new chunk_1.Chunk().append(code, node, traversal);
|
|
68677
68728
|
}
|
|
68678
68729
|
}
|
|
@@ -68693,7 +68744,7 @@ class ConstantTranspiler {
|
|
|
68693
68744
|
chunk.append(code, node, traversal);
|
|
68694
68745
|
}
|
|
68695
68746
|
else if (res.startsWith("`") && this.addGet === false) {
|
|
68696
|
-
const code = "new abap.types.String().set(" +
|
|
68747
|
+
const code = "new abap.types.String().set(" + ConstantTranspiler.escape(res) + ")";
|
|
68697
68748
|
chunk.append(code, node, traversal);
|
|
68698
68749
|
}
|
|
68699
68750
|
}
|
|
@@ -68709,10 +68760,10 @@ class ConstantTranspiler {
|
|
|
68709
68760
|
// note: Characters cannot have length = zero, 1 is minimum
|
|
68710
68761
|
length = 1;
|
|
68711
68762
|
}
|
|
68712
|
-
const code = "new abap.types.Character(" + length + ").set(" +
|
|
68763
|
+
const code = "new abap.types.Character(" + length + ").set(" + ConstantTranspiler.escape(res) + ")";
|
|
68713
68764
|
return code;
|
|
68714
68765
|
}
|
|
68715
|
-
escape(str) {
|
|
68766
|
+
static escape(str) {
|
|
68716
68767
|
str = str.replace(/\\/g, "\\\\");
|
|
68717
68768
|
if (str.startsWith("'")) {
|
|
68718
68769
|
const reg = new RegExp(/(.+)''(.+)/g);
|
|
@@ -72865,7 +72916,13 @@ class DataTranspiler {
|
|
|
72865
72916
|
if (found === undefined) {
|
|
72866
72917
|
throw new Error("DataTranspiler, var not found, \"" + token.getStr() + "\"");
|
|
72867
72918
|
}
|
|
72868
|
-
|
|
72919
|
+
let value = "";
|
|
72920
|
+
if (found.getValue() !== undefined && node.concatTokens().includes(" & ")) {
|
|
72921
|
+
value = "\n" + traversal.setValues(found, found.getName());
|
|
72922
|
+
}
|
|
72923
|
+
else {
|
|
72924
|
+
value = DataTranspiler.buildValue(node, found.getName().toLowerCase(), traversal);
|
|
72925
|
+
}
|
|
72869
72926
|
const ret = new chunk_1.Chunk()
|
|
72870
72927
|
.appendString("let ")
|
|
72871
72928
|
.append(found.getName().toLowerCase(), token, traversal)
|
|
@@ -72883,7 +72940,7 @@ class DataTranspiler {
|
|
|
72883
72940
|
int = val.findFirstExpression(abaplint.Expressions.ConstantString);
|
|
72884
72941
|
}
|
|
72885
72942
|
if (int) {
|
|
72886
|
-
const escaped =
|
|
72943
|
+
const escaped = constant_1.ConstantTranspiler.escape(int.concatTokens());
|
|
72887
72944
|
value = "\n" + name + ".set(" + escaped + ");";
|
|
72888
72945
|
}
|
|
72889
72946
|
else if (val.getChildren()[1].get() instanceof abaplint.Expressions.SimpleFieldChain) {
|
|
@@ -77525,7 +77582,7 @@ class InterfaceTranspiler {
|
|
|
77525
77582
|
const valExpression = constantStatement === null || constantStatement === void 0 ? void 0 : constantStatement.findFirstExpression(abaplint.Expressions.Value);
|
|
77526
77583
|
if ((valExpression === null || valExpression === void 0 ? void 0 : valExpression.getChildren()[1].get()) instanceof abaplint.Expressions.SimpleFieldChain) {
|
|
77527
77584
|
const s = new expressions_1.FieldChainTranspiler().transpile(valExpression.getChildren()[1], traversal, false).getCode();
|
|
77528
|
-
const e =
|
|
77585
|
+
const e = expressions_1.ConstantTranspiler.escape(s);
|
|
77529
77586
|
ret += name + ".set(" + e + ");\n";
|
|
77530
77587
|
continue;
|
|
77531
77588
|
}
|
|
@@ -78556,21 +78613,23 @@ class Traversal {
|
|
|
78556
78613
|
static setValues(identifier, name) {
|
|
78557
78614
|
const val = identifier.getValue();
|
|
78558
78615
|
let ret = "";
|
|
78559
|
-
|
|
78560
|
-
|
|
78561
|
-
|
|
78562
|
-
|
|
78563
|
-
|
|
78564
|
-
|
|
78565
|
-
|
|
78566
|
-
|
|
78567
|
-
|
|
78568
|
-
|
|
78616
|
+
const handle = (val, name) => {
|
|
78617
|
+
if (typeof val === "string") {
|
|
78618
|
+
const e = expressions_1.ConstantTranspiler.escape(val);
|
|
78619
|
+
ret += name + ".set(" + e + ");\n";
|
|
78620
|
+
}
|
|
78621
|
+
else if (typeof val === "object") {
|
|
78622
|
+
const a = val;
|
|
78623
|
+
for (const v of Object.keys(val)) {
|
|
78624
|
+
const s = a[v];
|
|
78625
|
+
if (s === undefined) {
|
|
78626
|
+
continue;
|
|
78627
|
+
}
|
|
78628
|
+
handle(s, name + ".get()." + v);
|
|
78569
78629
|
}
|
|
78570
|
-
s = new expressions_1.ConstantTranspiler().escape(s);
|
|
78571
|
-
ret += name + ".get()." + v + ".set(" + s + ");\n";
|
|
78572
78630
|
}
|
|
78573
|
-
}
|
|
78631
|
+
};
|
|
78632
|
+
handle(val, name);
|
|
78574
78633
|
return ret;
|
|
78575
78634
|
}
|
|
78576
78635
|
buildInternalName(name, def) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.43",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abap_transpile": "./abap_transpile"
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"author": "abaplint",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@abaplint/transpiler": "^2.6.
|
|
28
|
+
"@abaplint/transpiler": "^2.6.43",
|
|
29
29
|
"@types/glob": "^7.2.0",
|
|
30
30
|
"glob": "=7.2.0",
|
|
31
31
|
"@types/progress": "^2.0.5",
|
|
32
|
-
"@types/node": "^
|
|
33
|
-
"@abaplint/core": "^2.99.
|
|
32
|
+
"@types/node": "^20.1.0",
|
|
33
|
+
"@abaplint/core": "^2.99.7",
|
|
34
34
|
"progress": "^2.0.3",
|
|
35
|
-
"webpack": "^5.
|
|
36
|
-
"webpack-cli": "^5.0
|
|
35
|
+
"webpack": "^5.82.0",
|
|
36
|
+
"webpack-cli": "^5.1.0",
|
|
37
37
|
"typescript": "^5.0.4"
|
|
38
38
|
}
|
|
39
39
|
}
|