@abaplint/transpiler-cli 2.12.4 → 2.12.6

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 CHANGED
@@ -22879,9 +22879,30 @@ class TypeUtils {
22879
22879
  return true;
22880
22880
  }
22881
22881
  else if (source instanceof basic_1.StructureType) {
22882
- if (this.structureContainsString(target) && !this.structureContainsString(source)) {
22882
+ const targetDeep = this.structureContainsString(target);
22883
+ const sourceDeep = this.structureContainsString(source);
22884
+ if (targetDeep && !sourceDeep) {
22883
22885
  return false;
22884
22886
  }
22887
+ const targetComponents = target.getComponents();
22888
+ const sourceComponents = source.getComponents();
22889
+ if (targetComponents.length !== sourceComponents.length) {
22890
+ if (targetDeep === true || sourceDeep === true) {
22891
+ return false;
22892
+ }
22893
+ }
22894
+ for (let i = 0; i < targetComponents.length; i++) {
22895
+ if (sourceComponents[i] === undefined) {
22896
+ continue;
22897
+ }
22898
+ // hmm
22899
+ if (sourceComponents[i].type instanceof basic_1.StringType && !(targetComponents[i].type instanceof basic_1.StringType)) {
22900
+ return false;
22901
+ }
22902
+ else if (!(sourceComponents[i].type instanceof basic_1.StringType) && targetComponents[i].type instanceof basic_1.StringType) {
22903
+ return false;
22904
+ }
22905
+ }
22885
22906
  return true;
22886
22907
  }
22887
22908
  else if (target.containsVoid() === true) {
@@ -24877,7 +24898,7 @@ class FieldAssignment {
24877
24898
  const text = c.concatTokens();
24878
24899
  if (text !== "-" && context instanceof basic_1.StructureType) {
24879
24900
  context = context.getComponentByName(text);
24880
- if (context === undefined && targetType.containsVoid() === false) {
24901
+ if (context === undefined) {
24881
24902
  const message = `field ${text} does not exist in structure`;
24882
24903
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
24883
24904
  return;
@@ -32031,6 +32052,7 @@ const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./nod
32031
32052
  const _scope_type_1 = __webpack_require__(/*! ../_scope_type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js");
32032
32053
  const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
32033
32054
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
32055
+ const visibility_1 = __webpack_require__(/*! ../../4_file_information/visibility */ "./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js");
32034
32056
  class MethodImplementation {
32035
32057
  runSyntax(node, input) {
32036
32058
  const helper = new _object_oriented_1.ObjectOriented(input.scope);
@@ -32044,6 +32066,13 @@ class MethodImplementation {
32044
32066
  return;
32045
32067
  }
32046
32068
  const { method: methodDefinition } = helper.searchMethodName(classDefinition, methodName);
32069
+ if (classDefinition.isForTesting()
32070
+ && (methodDefinition === null || methodDefinition === void 0 ? void 0 : methodDefinition.getVisibility()) !== visibility_1.Visibility.Private
32071
+ && ["SETUP", "TEARDOWN", "CLASS_SETUP", "CLASS_TEARDOWN"].includes(methodName.toUpperCase())) {
32072
+ const message = "Special test method \"" + methodName + "\" must be private";
32073
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
32074
+ return;
32075
+ }
32047
32076
  const start = node.getFirstToken().getStart();
32048
32077
  if ((methodDefinition === null || methodDefinition === void 0 ? void 0 : methodDefinition.isStatic()) === false) {
32049
32078
  input.scope.push(_scope_type_1.ScopeType.MethodInstance, methodName, start, input.filename);
@@ -32884,6 +32913,11 @@ class ReadTable {
32884
32913
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
32885
32914
  return;
32886
32915
  }
32916
+ else if (sourceType instanceof basic_1.TableType && sourceType.getAccessType() === basic_1.TableAccessType.hashed) {
32917
+ const message = "INDEX on hashed table not possible";
32918
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
32919
+ return;
32920
+ }
32887
32921
  }
32888
32922
  const fromSource = node.findExpressionAfterToken("FROM");
32889
32923
  if (fromSource) {
@@ -53637,7 +53671,7 @@ class Registry {
53637
53671
  }
53638
53672
  static abaplintVersion() {
53639
53673
  // magic, see build script "version.sh"
53640
- return "2.113.232";
53674
+ return "2.113.233";
53641
53675
  }
53642
53676
  getDDICReferences() {
53643
53677
  return this.ddicReferences;
@@ -84600,7 +84634,7 @@ static INTERNAL_TYPE = 'CLAS';
84600
84634
  static INTERNAL_NAME = '${traversal.buildInternalName(token.getStr(), def)}';
84601
84635
  static IMPLEMENTED_INTERFACES = [${this.findImplementedByClass(traversal, def, scope).map(e => `"` + e.toUpperCase() + `"`).join(",")}];
84602
84636
  static ATTRIBUTES = {${Array.from(traversal.buildAttributes(def, scope)).join(",\n")}};
84603
- static METHODS = {${traversal.buildMethods(def, scope).join(",\n")}};`, node, traversal);
84637
+ static METHODS = {${traversal.buildMethods(def).join(",\n")}};`, node, traversal);
84604
84638
  }
84605
84639
  findImplementedInterface(traversal, def, scope) {
84606
84640
  if (def === undefined || scope === undefined) {
@@ -90736,7 +90770,7 @@ class InterfaceTranspiler {
90736
90770
  ret += `static INTERNAL_TYPE = 'INTF';\n`;
90737
90771
  ret += `static INTERNAL_NAME = '${traversal.buildInternalName(token.getStr(), def)}';\n`;
90738
90772
  ret += `static ATTRIBUTES = {${Array.from(traversal.buildAttributes(def, scope)).join(",\n")}};\n`;
90739
- ret += `static METHODS = {${traversal.buildMethods(def, scope).join(",\n")}};\n`;
90773
+ ret += `static METHODS = {${traversal.buildMethods(def).join(",\n")}};\n`;
90740
90774
  // todo, add IMPLEMENTED_INTERFACES ?
90741
90775
  }
90742
90776
  else if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.EndInterface) {
@@ -91632,7 +91666,7 @@ class Traversal {
91632
91666
  }
91633
91667
  return undefined;
91634
91668
  }
91635
- buildMethods(def, _scope) {
91669
+ buildMethods(def) {
91636
91670
  const methods = [];
91637
91671
  if (def === undefined) {
91638
91672
  return methods;
@@ -103651,32 +103685,36 @@ class Progress {
103651
103685
  }
103652
103686
  async function loadLib(config) {
103653
103687
  const files = [];
103654
- for (const l of config.libs || []) {
103688
+ for (const lib of config.libs || []) {
103655
103689
  let dir = "";
103656
103690
  let cleanupFolder = false;
103657
- if (l.folder !== undefined && l.folder !== "" && fs.existsSync(process.cwd() + l.folder)) {
103658
- console.log("From folder: " + l.folder);
103659
- dir = process.cwd() + l.folder;
103691
+ if (lib.folder !== undefined && lib.folder !== "" && fs.existsSync(process.cwd() + lib.folder)) {
103692
+ console.log("From folder: " + lib.folder);
103693
+ dir = process.cwd() + lib.folder;
103660
103694
  }
103661
103695
  else {
103662
- console.log("Clone: " + l.url);
103696
+ console.log("Clone: " + lib.url);
103663
103697
  dir = fs.mkdtempSync(path.join(os.tmpdir(), "abap_transpile-"));
103664
- childProcess.execSync("git clone --quiet --depth 1 " + l.url + " .", { cwd: dir, stdio: "inherit" });
103698
+ childProcess.execSync("git clone --quiet --depth 1 " + lib.url + " .", { cwd: dir, stdio: "inherit" });
103665
103699
  cleanupFolder = true;
103666
103700
  }
103667
103701
  let patterns = ["/src/**"];
103668
- if (l.files !== undefined && typeof l.files === "string" && l.files !== "") {
103669
- patterns = [l.files];
103702
+ if (lib.files !== undefined && typeof lib.files === "string" && lib.files !== "") {
103703
+ patterns = [lib.files];
103670
103704
  }
103671
- else if (Array.isArray(l.files)) {
103672
- patterns = l.files;
103705
+ else if (Array.isArray(lib.files)) {
103706
+ patterns = lib.files;
103673
103707
  }
103708
+ const excludeFilters = (lib.exclude_filter ?? []).map(pattern => new RegExp(pattern, "i"));
103674
103709
  const filesToRead = [];
103675
103710
  for (const pattern of patterns) {
103676
103711
  for (const filename of glob.sync(dir + pattern, { nosort: true, nodir: true })) {
103677
103712
  if (filename.endsWith(".clas.testclasses.abap")) {
103678
103713
  continue;
103679
103714
  }
103715
+ else if (excludeFilters.length > 0 && excludeFilters.some(a => a.test(filename)) === true) {
103716
+ continue;
103717
+ }
103680
103718
  filesToRead.push(filename);
103681
103719
  }
103682
103720
  }
package/build/types.d.ts CHANGED
@@ -1,15 +1,23 @@
1
1
  import { ITranspilerOptions } from "@abaplint/transpiler";
2
2
  export interface ITranspilerConfig {
3
3
  input_folder: string | string[];
4
- /** list of regex, case insensitive, empty gives all files, positive list */
4
+ /** list of regex, case insensitive, empty gives all files, positive list
5
+ * @uniqueItems true
6
+ */
5
7
  input_filter?: string[];
6
- /** list of regex, case insensitive */
8
+ /** list of regex, case insensitive
9
+ * @uniqueItems true
10
+ */
7
11
  exclude_filter?: string[];
8
12
  output_folder: string;
9
13
  libs?: {
10
14
  url?: string;
11
15
  folder?: string;
12
16
  files?: string | string[];
17
+ /** list of regex, case insensitive
18
+ * @uniqueItems true
19
+ */
20
+ exclude_filter?: string[];
13
21
  }[];
14
22
  write_unit_tests?: boolean;
15
23
  write_source_map?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.12.4",
3
+ "version": "2.12.6",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -27,10 +27,10 @@
27
27
  "author": "abaplint",
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@abaplint/core": "^2.113.232",
31
- "@abaplint/transpiler": "^2.12.4",
30
+ "@abaplint/core": "^2.113.233",
31
+ "@abaplint/transpiler": "^2.12.6",
32
32
  "@types/glob": "^8.1.0",
33
- "@types/node": "^24.8.1",
33
+ "@types/node": "^24.9.1",
34
34
  "@types/progress": "^2.0.7",
35
35
  "glob": "=7.2.0",
36
36
  "progress": "^2.0.3",
package/schema.json ADDED
@@ -0,0 +1,219 @@
1
+ {
2
+ "$ref": "#/definitions/ITranspilerConfig",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "definitions": {
5
+ "ITranspilerConfig": {
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "exclude_filter": {
9
+ "description": "list of regex, case insensitive",
10
+ "items": {
11
+ "type": "string"
12
+ },
13
+ "type": "array",
14
+ "uniqueItems": true
15
+ },
16
+ "input_filter": {
17
+ "description": "list of regex, case insensitive, empty gives all files, positive list",
18
+ "items": {
19
+ "type": "string"
20
+ },
21
+ "type": "array",
22
+ "uniqueItems": true
23
+ },
24
+ "input_folder": {
25
+ "anyOf": [
26
+ {
27
+ "type": "string"
28
+ },
29
+ {
30
+ "items": {
31
+ "type": "string"
32
+ },
33
+ "type": "array"
34
+ }
35
+ ]
36
+ },
37
+ "libs": {
38
+ "items": {
39
+ "additionalProperties": false,
40
+ "properties": {
41
+ "exclude_filter": {
42
+ "description": "list of regex, case insensitive",
43
+ "items": {
44
+ "type": "string"
45
+ },
46
+ "type": "array",
47
+ "uniqueItems": true
48
+ },
49
+ "files": {
50
+ "anyOf": [
51
+ {
52
+ "type": "string"
53
+ },
54
+ {
55
+ "items": {
56
+ "type": "string"
57
+ },
58
+ "type": "array"
59
+ }
60
+ ]
61
+ },
62
+ "folder": {
63
+ "type": "string"
64
+ },
65
+ "url": {
66
+ "type": "string"
67
+ }
68
+ },
69
+ "type": "object"
70
+ },
71
+ "type": "array"
72
+ },
73
+ "options": {
74
+ "$ref": "#/definitions/ITranspilerOptions"
75
+ },
76
+ "output_folder": {
77
+ "type": "string"
78
+ },
79
+ "write_source_map": {
80
+ "type": "boolean"
81
+ },
82
+ "write_unit_tests": {
83
+ "type": "boolean"
84
+ }
85
+ },
86
+ "required": [
87
+ "input_folder",
88
+ "output_folder",
89
+ "options"
90
+ ],
91
+ "type": "object"
92
+ },
93
+ "ITranspilerOptions": {
94
+ "additionalProperties": false,
95
+ "properties": {
96
+ "addCommonJS": {
97
+ "description": "adds common js modules",
98
+ "type": "boolean"
99
+ },
100
+ "addFilenames": {
101
+ "description": "adds filenames as comments in the output js",
102
+ "type": "boolean"
103
+ },
104
+ "ignoreSourceMap": {
105
+ "description": "ignore source map",
106
+ "type": "boolean"
107
+ },
108
+ "ignoreSyntaxCheck": {
109
+ "description": "ignore syntax check, used for internal testing",
110
+ "type": "boolean"
111
+ },
112
+ "importProg": {
113
+ "description": "import programs",
114
+ "type": "boolean"
115
+ },
116
+ "keywords": {
117
+ "description": "list of keywords to rename, if not supplied default will be used",
118
+ "items": {
119
+ "type": "string"
120
+ },
121
+ "type": "array"
122
+ },
123
+ "populateTables": {
124
+ "additionalProperties": false,
125
+ "description": "populate tables, all tables are populated if undefined and they exist",
126
+ "properties": {
127
+ "reposrc": {
128
+ "description": "insert into REPOSRC, skips if equals false",
129
+ "type": "boolean"
130
+ },
131
+ "seosubco": {
132
+ "description": "insert into SEOSUBCO, skips if equals false",
133
+ "type": "boolean"
134
+ },
135
+ "seosubcodf": {
136
+ "description": "insert into SEOSUBCODF, skips if equals false",
137
+ "type": "boolean"
138
+ },
139
+ "seosubcotx": {
140
+ "description": "insert into SEOSUBCOTX, skips if equals false",
141
+ "type": "boolean"
142
+ }
143
+ },
144
+ "type": "object"
145
+ },
146
+ "setup": {
147
+ "additionalProperties": false,
148
+ "description": "extra setup script to be executed during initialization",
149
+ "properties": {
150
+ "filename": {
151
+ "type": "string"
152
+ },
153
+ "postFunction": {
154
+ "type": "string"
155
+ },
156
+ "preFunction": {
157
+ "type": "string"
158
+ }
159
+ },
160
+ "required": [
161
+ "filename"
162
+ ],
163
+ "type": "object"
164
+ },
165
+ "skip": {
166
+ "$ref": "#/definitions/TestMethodList",
167
+ "description": "list of unit tests to skip"
168
+ },
169
+ "skipVersionCheck": {
170
+ "description": "skips version check, not recommended",
171
+ "type": "boolean"
172
+ },
173
+ "unknownTypes": {
174
+ "$ref": "#/definitions/UnknownTypesEnum",
175
+ "description": "sets behavior for unknown types, either fail at compile- or run-time"
176
+ }
177
+ },
178
+ "type": "object"
179
+ },
180
+ "TestMethodList": {
181
+ "items": {
182
+ "additionalProperties": false,
183
+ "properties": {
184
+ "class": {
185
+ "pattern": "^[a-zA-Z0-9_\\/]+$",
186
+ "type": "string"
187
+ },
188
+ "method": {
189
+ "pattern": "^[a-zA-Z0-9_\\/]+$",
190
+ "type": "string"
191
+ },
192
+ "note": {
193
+ "type": "string"
194
+ },
195
+ "object": {
196
+ "pattern": "^[a-zA-Z0-9_\\/]+$",
197
+ "type": "string"
198
+ }
199
+ },
200
+ "required": [
201
+ "object",
202
+ "class",
203
+ "method"
204
+ ],
205
+ "type": "object"
206
+ },
207
+ "type": "array",
208
+ "uniqueItems": true
209
+ },
210
+ "UnknownTypesEnum": {
211
+ "enum": [
212
+ "compileError",
213
+ "runtimeError"
214
+ ],
215
+ "type": "string"
216
+ }
217
+ }
218
+ }
219
+