@abaplint/cli 2.113.117 → 2.113.119

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.
Files changed (2) hide show
  1. package/build/cli.js +283 -48
  2. package/package.json +5 -5
package/build/cli.js CHANGED
@@ -83,12 +83,15 @@ exports.CompressedFile = CompressedFile;
83
83
 
84
84
  Object.defineProperty(exports, "__esModule", ({ value: true }));
85
85
  exports.FileOperations = void 0;
86
- const fs = __webpack_require__(/*! fs */ "fs");
87
- const path = __webpack_require__(/*! path */ "path");
88
- const zlib = __webpack_require__(/*! zlib */ "zlib");
89
- const glob = __webpack_require__(/*! glob */ "./node_modules/glob/glob.js");
90
- const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
91
86
  const compressed_file_1 = __webpack_require__(/*! ./compressed_file */ "./build/src/compressed_file.js");
87
+ const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
88
+ const fs = __webpack_require__(/*! node:fs */ "node:fs");
89
+ const fsPromises = __webpack_require__(/*! node:fs/promises */ "node:fs/promises");
90
+ const glob = __webpack_require__(/*! glob */ "./node_modules/glob/glob.js");
91
+ const os = __webpack_require__(/*! node:os */ "node:os");
92
+ const path = __webpack_require__(/*! node:path */ "node:path");
93
+ const pLimit = __webpack_require__(/*! p-limit */ "./node_modules/p-limit/index.js");
94
+ const zlib = __webpack_require__(/*! node:zlib */ "node:zlib");
92
95
  class FileOperations {
93
96
  static deleteFolderRecursive(dir) {
94
97
  if (fs.existsSync(dir) === false) {
@@ -103,26 +106,54 @@ class FileOperations {
103
106
  }
104
107
  return files;
105
108
  }
109
+ static async readFile(filename, compress) {
110
+ // note that readFileSync is typically faster than async readFile,
111
+ // https://medium.com/@adamhooper/node-synchronous-code-runs-faster-than-asynchronous-code-b0553d5cf54e
112
+ const raw = await fsPromises.readFile(filename, { encoding: "utf8" });
113
+ if (compress === true) {
114
+ // todo, util.promisify(zlib.deflate) does not seem to work?
115
+ return new compressed_file_1.CompressedFile(filename, zlib.deflateSync(raw).toString("base64"));
116
+ }
117
+ else {
118
+ return new core_1.MemoryFile(filename, raw);
119
+ }
120
+ }
106
121
  static async loadFiles(compress, input, bar) {
107
- const files = [];
108
- bar.set(input.length, "Reading files");
109
- for (const filename of input) {
110
- bar.tick("Reading files - " + path.basename(filename));
122
+ let concurrency = os.cpus().length;
123
+ if (concurrency > 8) {
124
+ concurrency = 8;
125
+ }
126
+ else if (concurrency < 1) {
127
+ concurrency = 1;
128
+ }
129
+ const limit = pLimit(concurrency);
130
+ input = input.filter((filename) => {
111
131
  const base = filename.split("/").reverse()[0];
112
132
  if (base.split(".").length <= 2) {
113
- continue; // not a abapGit file
114
- }
115
- // note that readFileSync is typically faster than async readFile,
116
- // https://medium.com/@adamhooper/node-synchronous-code-runs-faster-than-asynchronous-code-b0553d5cf54e
117
- const raw = fs.readFileSync(filename, "utf8");
118
- if (compress === true) {
119
- // todo, util.promisify(zlib.deflate) does not seem to work?
120
- files.push(new compressed_file_1.CompressedFile(filename, zlib.deflateSync(raw).toString("base64")));
121
- }
122
- else {
123
- files.push(new core_1.MemoryFile(filename, raw));
133
+ return false;
124
134
  }
135
+ return true;
136
+ });
137
+ bar.set(input.length, "Reading files");
138
+ const promises = input.map((filename) => {
139
+ return limit(async () => {
140
+ bar.tick("Reading files - " + path.basename(filename));
141
+ return this.readFile(filename, compress);
142
+ });
143
+ });
144
+ const files = await Promise.all(promises);
145
+ /*
146
+ for (const filename of input) {
147
+ bar.tick("Reading files - " + path.basename(filename));
148
+
149
+ const base = filename.split("/").reverse()[0];
150
+ if (base.split(".").length <= 2) {
151
+ continue; // not a abapGit file
152
+ }
153
+
154
+ files.push(await this.readFile(filename, compress));
125
155
  }
156
+ */
126
157
  return files;
127
158
  }
128
159
  }
@@ -19676,7 +19707,7 @@ const _combi_1 = __webpack_require__(/*! ./_combi */ "./node_modules/@abaplint/c
19676
19707
  const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
19677
19708
  class Loop {
19678
19709
  getMatcher() {
19679
- return (0, _combi_1.beginEnd)((0, _combi_1.sta)(Statements.Loop), (0, _combi_1.star)((0, _combi_1.sub)(_1.Body)), (0, _combi_1.sta)(Statements.EndLoop));
19710
+ return (0, _combi_1.beginEnd)((0, _combi_1.sta)(Statements.Loop), (0, _combi_1.alt)((0, _combi_1.sub)(_1.Chain), (0, _combi_1.star)((0, _combi_1.sub)(_1.Body))), (0, _combi_1.sta)(Statements.EndLoop));
19680
19711
  }
19681
19712
  }
19682
19713
  exports.Loop = Loop;
@@ -19839,9 +19870,10 @@ exports.ProcessAfterInput = void 0;
19839
19870
  const Statements = __webpack_require__(/*! ../../2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
19840
19871
  const _combi_1 = __webpack_require__(/*! ./_combi */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/_combi.js");
19841
19872
  const chain_1 = __webpack_require__(/*! ./chain */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/chain.js");
19873
+ const loop_1 = __webpack_require__(/*! ./loop */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/loop.js");
19842
19874
  class ProcessAfterInput {
19843
19875
  getMatcher() {
19844
- const pai = (0, _combi_1.star)((0, _combi_1.alt)((0, _combi_1.sta)(Statements.Module), (0, _combi_1.sta)(Statements.Field), (0, _combi_1.sta)(Statements.CallSubscreen), (0, _combi_1.sub)(chain_1.Chain)));
19876
+ const pai = (0, _combi_1.star)((0, _combi_1.alt)((0, _combi_1.sta)(Statements.Module), (0, _combi_1.sta)(Statements.Field), (0, _combi_1.sta)(Statements.CallSubscreen), (0, _combi_1.sub)(chain_1.Chain), (0, _combi_1.sub)(loop_1.Loop)));
19845
19877
  return (0, _combi_1.seq)((0, _combi_1.sta)(Statements.ProcessAfterInput), pai);
19846
19878
  }
19847
19879
  }
@@ -29019,11 +29051,11 @@ class FindGlobalDefinitions {
29019
29051
  candidates.push(o);
29020
29052
  }
29021
29053
  else if (o instanceof objects_1.DataElement
29022
- || o instanceof objects_1.View
29054
+ || o instanceof objects_1.Table
29023
29055
  || o instanceof objects_1.TableType
29056
+ || o instanceof objects_1.View
29024
29057
  || o instanceof objects_1.LockObject
29025
- || o instanceof objects_1.AuthorizationCheckField
29026
- || o instanceof objects_1.Table) {
29058
+ || o instanceof objects_1.AuthorizationCheckField) {
29027
29059
  o.parseType(this.reg); // make sure the references are set after parsing finishes
29028
29060
  }
29029
29061
  }
@@ -32877,6 +32909,7 @@ const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_module
32877
32909
  const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
32878
32910
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
32879
32911
  const assert_error_1 = __webpack_require__(/*! ../assert_error */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/assert_error.js");
32912
+ const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js");
32880
32913
  class Perform {
32881
32914
  runSyntax(node, input) {
32882
32915
  if (!(node.get() instanceof Statements.Perform)) {
@@ -32904,7 +32937,9 @@ class Perform {
32904
32937
  if (node.findFirstExpression(Expressions.IncludeName)) {
32905
32938
  return; // in external program, not checked, todo
32906
32939
  }
32907
- if (node.findFirstExpression(Expressions.Dynamic)) {
32940
+ const dynamic = node.findFirstExpression(Expressions.Dynamic);
32941
+ if (dynamic) {
32942
+ new dynamic_1.Dynamic().runSyntax(dynamic, input);
32908
32943
  return; // todo, maybe some parts can be checked
32909
32944
  }
32910
32945
  const expr = node.findFirstExpression(Expressions.FormName);
@@ -47896,6 +47931,7 @@ class DataElement extends _abstract_object_1.AbstractObject {
47896
47931
  constructor() {
47897
47932
  super(...arguments);
47898
47933
  this.parsedXML = undefined;
47934
+ this.parsedType = undefined;
47899
47935
  }
47900
47936
  getType() {
47901
47937
  return "DTEL";
@@ -47913,6 +47949,7 @@ class DataElement extends _abstract_object_1.AbstractObject {
47913
47949
  }
47914
47950
  setDirty() {
47915
47951
  this.parsedXML = undefined;
47952
+ this.parsedType = undefined;
47916
47953
  super.setDirty();
47917
47954
  }
47918
47955
  getDomainName() {
@@ -47933,6 +47970,9 @@ class DataElement extends _abstract_object_1.AbstractObject {
47933
47970
  lookup = { type: new Types.UnknownType("Data Element " + this.getName() + ", parser error") };
47934
47971
  }
47935
47972
  else {
47973
+ if (this.parsedType) {
47974
+ return this.parsedType;
47975
+ }
47936
47976
  const ddic = new ddic_1.DDIC(reg);
47937
47977
  if (this.parsedXML.refkind === "D") {
47938
47978
  if (this.parsedXML.domname === undefined || this.parsedXML.domname === "") {
@@ -47972,7 +48012,8 @@ class DataElement extends _abstract_object_1.AbstractObject {
47972
48012
  references.push({ object: lookup.object });
47973
48013
  }
47974
48014
  reg.getDDICReferences().setUsing(this, references);
47975
- return lookup.type;
48015
+ this.parsedType = lookup.type;
48016
+ return this.parsedType;
47976
48017
  }
47977
48018
  parse() {
47978
48019
  var _a, _b, _c;
@@ -52528,6 +52569,10 @@ var TableCategory;
52528
52569
  TableCategory["Append"] = "APPEND";
52529
52570
  })(TableCategory || (exports.TableCategory = TableCategory = {}));
52530
52571
  class Table extends _abstract_object_1.AbstractObject {
52572
+ constructor() {
52573
+ super(...arguments);
52574
+ this.parsedType = undefined;
52575
+ }
52531
52576
  getType() {
52532
52577
  return "TABL";
52533
52578
  }
@@ -52552,6 +52597,7 @@ class Table extends _abstract_object_1.AbstractObject {
52552
52597
  }
52553
52598
  setDirty() {
52554
52599
  this.parsedData = undefined;
52600
+ this.parsedType = undefined;
52555
52601
  super.setDirty();
52556
52602
  }
52557
52603
  listKeys(reg) {
@@ -52589,6 +52635,9 @@ class Table extends _abstract_object_1.AbstractObject {
52589
52635
  && this.parsedData.dataClass === "USER3") {
52590
52636
  return new Types.UnknownType("Data class = USER3 not allowed in cloud");
52591
52637
  }
52638
+ if (this.parsedType) {
52639
+ return this.parsedType;
52640
+ }
52592
52641
  const references = [];
52593
52642
  const components = [];
52594
52643
  const ddic = new ddic_1.DDIC(reg);
@@ -52639,25 +52688,6 @@ class Table extends _abstract_object_1.AbstractObject {
52639
52688
  else {
52640
52689
  components.push({ name: field.FIELDNAME, type: found });
52641
52690
  }
52642
- /*
52643
- } else if (comptype === "S" && field.FIELDNAME.startsWith(".INCLU-")) {
52644
- const lookup = ddic.lookupTableOrView(field.PRECFIELD);
52645
- if (lookup.object) {
52646
- references.push({object: lookup.object});
52647
- }
52648
- const found = lookup.type;
52649
- if (found instanceof Types.VoidType) {
52650
- // set the full structure to void
52651
- return found;
52652
- } else if (found instanceof Types.StructureType) {
52653
- const suffix = field.FIELDNAME.split("-")[1];
52654
- for (const c of found.getComponents()) {
52655
- components.push({name: c.name + suffix, type: c.type});
52656
- }
52657
- } else if (found instanceof Types.UnknownType) {
52658
- return found;
52659
- }
52660
- */
52661
52691
  }
52662
52692
  else if (comptype === "S") {
52663
52693
  const lookup = ddic.lookupTableOrView(field.ROLLNAME);
@@ -52752,7 +52782,8 @@ class Table extends _abstract_object_1.AbstractObject {
52752
52782
  return new Types.UnknownType("Table/Structure " + this.getName() + " does not contain any components");
52753
52783
  }
52754
52784
  reg.getDDICReferences().setUsing(this, references);
52755
- return new Types.StructureType(components, this.getName(), this.getName(), this.getDescription());
52785
+ this.parsedType = new Types.StructureType(components, this.getName(), this.getName(), this.getDescription());
52786
+ return this.parsedType;
52756
52787
  }
52757
52788
  getTableCategory() {
52758
52789
  var _a;
@@ -54157,7 +54188,7 @@ class Registry {
54157
54188
  }
54158
54189
  static abaplintVersion() {
54159
54190
  // magic, see build script "version.sh"
54160
- return "2.113.117";
54191
+ return "2.113.119";
54161
54192
  }
54162
54193
  getDDICReferences() {
54163
54194
  return this.ddicReferences;
@@ -83613,6 +83644,88 @@ function onceStrict (fn) {
83613
83644
  }
83614
83645
 
83615
83646
 
83647
+ /***/ }),
83648
+
83649
+ /***/ "./node_modules/p-limit/index.js":
83650
+ /*!***************************************!*\
83651
+ !*** ./node_modules/p-limit/index.js ***!
83652
+ \***************************************/
83653
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
83654
+
83655
+ "use strict";
83656
+
83657
+ const Queue = __webpack_require__(/*! yocto-queue */ "./node_modules/yocto-queue/index.js");
83658
+
83659
+ const pLimit = concurrency => {
83660
+ if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
83661
+ throw new TypeError('Expected `concurrency` to be a number from 1 and up');
83662
+ }
83663
+
83664
+ const queue = new Queue();
83665
+ let activeCount = 0;
83666
+
83667
+ const next = () => {
83668
+ activeCount--;
83669
+
83670
+ if (queue.size > 0) {
83671
+ queue.dequeue()();
83672
+ }
83673
+ };
83674
+
83675
+ const run = async (fn, resolve, ...args) => {
83676
+ activeCount++;
83677
+
83678
+ const result = (async () => fn(...args))();
83679
+
83680
+ resolve(result);
83681
+
83682
+ try {
83683
+ await result;
83684
+ } catch {}
83685
+
83686
+ next();
83687
+ };
83688
+
83689
+ const enqueue = (fn, resolve, ...args) => {
83690
+ queue.enqueue(run.bind(null, fn, resolve, ...args));
83691
+
83692
+ (async () => {
83693
+ // This function needs to wait until the next microtask before comparing
83694
+ // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
83695
+ // when the run function is dequeued and called. The comparison in the if-statement
83696
+ // needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
83697
+ await Promise.resolve();
83698
+
83699
+ if (activeCount < concurrency && queue.size > 0) {
83700
+ queue.dequeue()();
83701
+ }
83702
+ })();
83703
+ };
83704
+
83705
+ const generator = (fn, ...args) => new Promise(resolve => {
83706
+ enqueue(fn, resolve, ...args);
83707
+ });
83708
+
83709
+ Object.defineProperties(generator, {
83710
+ activeCount: {
83711
+ get: () => activeCount
83712
+ },
83713
+ pendingCount: {
83714
+ get: () => queue.size
83715
+ },
83716
+ clearQueue: {
83717
+ value: () => {
83718
+ queue.clear();
83719
+ }
83720
+ }
83721
+ });
83722
+
83723
+ return generator;
83724
+ };
83725
+
83726
+ module.exports = pLimit;
83727
+
83728
+
83616
83729
  /***/ }),
83617
83730
 
83618
83731
  /***/ "./node_modules/path-is-absolute/index.js":
@@ -88681,6 +88794,84 @@ module.exports = function(xml, userOptions) {
88681
88794
  };
88682
88795
 
88683
88796
 
88797
+ /***/ }),
88798
+
88799
+ /***/ "./node_modules/yocto-queue/index.js":
88800
+ /*!*******************************************!*\
88801
+ !*** ./node_modules/yocto-queue/index.js ***!
88802
+ \*******************************************/
88803
+ /***/ ((module) => {
88804
+
88805
+ class Node {
88806
+ /// value;
88807
+ /// next;
88808
+
88809
+ constructor(value) {
88810
+ this.value = value;
88811
+
88812
+ // TODO: Remove this when targeting Node.js 12.
88813
+ this.next = undefined;
88814
+ }
88815
+ }
88816
+
88817
+ class Queue {
88818
+ // TODO: Use private class fields when targeting Node.js 12.
88819
+ // #_head;
88820
+ // #_tail;
88821
+ // #_size;
88822
+
88823
+ constructor() {
88824
+ this.clear();
88825
+ }
88826
+
88827
+ enqueue(value) {
88828
+ const node = new Node(value);
88829
+
88830
+ if (this._head) {
88831
+ this._tail.next = node;
88832
+ this._tail = node;
88833
+ } else {
88834
+ this._head = node;
88835
+ this._tail = node;
88836
+ }
88837
+
88838
+ this._size++;
88839
+ }
88840
+
88841
+ dequeue() {
88842
+ const current = this._head;
88843
+ if (!current) {
88844
+ return;
88845
+ }
88846
+
88847
+ this._head = this._head.next;
88848
+ this._size--;
88849
+ return current.value;
88850
+ }
88851
+
88852
+ clear() {
88853
+ this._head = undefined;
88854
+ this._tail = undefined;
88855
+ this._size = 0;
88856
+ }
88857
+
88858
+ get size() {
88859
+ return this._size;
88860
+ }
88861
+
88862
+ * [Symbol.iterator]() {
88863
+ let current = this._head;
88864
+
88865
+ while (current) {
88866
+ yield current.value;
88867
+ current = current.next;
88868
+ }
88869
+ }
88870
+ }
88871
+
88872
+ module.exports = Queue;
88873
+
88874
+
88684
88875
  /***/ }),
88685
88876
 
88686
88877
  /***/ "assert":
@@ -88749,6 +88940,28 @@ module.exports = require("node:crypto");
88749
88940
 
88750
88941
  /***/ }),
88751
88942
 
88943
+ /***/ "node:fs":
88944
+ /*!**************************!*\
88945
+ !*** external "node:fs" ***!
88946
+ \**************************/
88947
+ /***/ ((module) => {
88948
+
88949
+ "use strict";
88950
+ module.exports = require("node:fs");
88951
+
88952
+ /***/ }),
88953
+
88954
+ /***/ "node:fs/promises":
88955
+ /*!***********************************!*\
88956
+ !*** external "node:fs/promises" ***!
88957
+ \***********************************/
88958
+ /***/ ((module) => {
88959
+
88960
+ "use strict";
88961
+ module.exports = require("node:fs/promises");
88962
+
88963
+ /***/ }),
88964
+
88752
88965
  /***/ "node:os":
88753
88966
  /*!**************************!*\
88754
88967
  !*** external "node:os" ***!
@@ -88760,6 +88973,17 @@ module.exports = require("node:os");
88760
88973
 
88761
88974
  /***/ }),
88762
88975
 
88976
+ /***/ "node:path":
88977
+ /*!****************************!*\
88978
+ !*** external "node:path" ***!
88979
+ \****************************/
88980
+ /***/ ((module) => {
88981
+
88982
+ "use strict";
88983
+ module.exports = require("node:path");
88984
+
88985
+ /***/ }),
88986
+
88763
88987
  /***/ "node:process":
88764
88988
  /*!*******************************!*\
88765
88989
  !*** external "node:process" ***!
@@ -88782,6 +89006,17 @@ module.exports = require("node:tty");
88782
89006
 
88783
89007
  /***/ }),
88784
89008
 
89009
+ /***/ "node:zlib":
89010
+ /*!****************************!*\
89011
+ !*** external "node:zlib" ***!
89012
+ \****************************/
89013
+ /***/ ((module) => {
89014
+
89015
+ "use strict";
89016
+ module.exports = require("node:zlib");
89017
+
89018
+ /***/ }),
89019
+
88785
89020
  /***/ "os":
88786
89021
  /*!*********************!*\
88787
89022
  !*** external "os" ***!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.113.117",
3
+ "version": "2.113.119",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.113.117",
41
+ "@abaplint/core": "^2.113.119",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/glob": "^8.1.0",
44
44
  "@types/minimist": "^1.2.5",
@@ -46,18 +46,18 @@
46
46
  "@types/node": "^22.15.19",
47
47
  "@types/progress": "^2.0.7",
48
48
  "chai": "^4.5.0",
49
+ "p-limit": "^3.1.0",
49
50
  "chalk": "^5.4.1",
50
51
  "eslint": "^9.27.0",
51
52
  "glob": "^7.2.3",
52
53
  "json5": "^2.2.3",
53
54
  "memfs": "^4.17.2",
54
55
  "minimist": "^1.2.8",
55
- "mocha": "^11.3.0",
56
+ "mocha": "^11.4.0",
56
57
  "progress": "^2.0.3",
57
58
  "typescript": "^5.8.3",
58
59
  "webpack": "^5.99.8",
59
60
  "webpack-cli": "^6.0.1",
60
61
  "xml-js": "^1.6.11"
61
- },
62
- "dependencies": {}
62
+ }
63
63
  }