@abaplint/transpiler-cli 2.2.19 → 2.3.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.
Files changed (2) hide show
  1. package/build/bundle.js +15 -4
  2. package/package.json +2 -2
package/build/bundle.js CHANGED
@@ -38,7 +38,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
38
38
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
39
39
 
40
40
  "use strict";
41
- eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst fs = __webpack_require__(/*! fs */ \"fs\");\r\nconst path = __webpack_require__(/*! path */ \"path\");\r\nconst glob = __webpack_require__(/*! glob */ \"./node_modules/glob/glob.js\");\r\nconst childProcess = __webpack_require__(/*! child_process */ \"child_process\");\r\nconst os = __webpack_require__(/*! os */ \"os\");\r\nconst ProgressBar = __webpack_require__(/*! progress */ \"./node_modules/progress/index.js\");\r\nconst Transpiler = __webpack_require__(/*! @abaplint/transpiler */ \"./node_modules/@abaplint/transpiler/build/src/index.js\");\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst config_1 = __webpack_require__(/*! ./config */ \"./build/config.js\");\r\nconst file_operations_1 = __webpack_require__(/*! ./file_operations */ \"./build/file_operations.js\");\r\nclass Progress {\r\n set(total, _text) {\r\n this.bar = new ProgressBar(\":percent - :elapseds - :text\", { total, renderThrottle: 100 });\r\n }\r\n async tick(text) {\r\n this.bar.tick({ text });\r\n this.bar.render();\r\n }\r\n}\r\nfunction loadLib(config) {\r\n const files = [];\r\n if (config.lib && config.lib !== \"\" && config.libs === undefined) {\r\n config.libs = [{ url: config.lib }];\r\n }\r\n for (const l of config.libs || []) {\r\n let dir = \"\";\r\n let cleanupFolder = false;\r\n if (l.folder !== undefined && l.folder !== \"\" && fs.existsSync(process.cwd() + l.folder)) {\r\n console.log(\"From folder: \" + l.folder);\r\n dir = process.cwd() + l.folder;\r\n }\r\n else {\r\n console.log(\"Clone: \" + l.url);\r\n dir = fs.mkdtempSync(path.join(os.tmpdir(), \"abap_transpile-\"));\r\n childProcess.execSync(\"git clone --quiet --depth 1 \" + l.url + \" .\", { cwd: dir, stdio: \"inherit\" });\r\n cleanupFolder = true;\r\n }\r\n let count = 0;\r\n let pattern = \"/src/**\";\r\n if (l.files !== undefined && l.files !== \"\") {\r\n pattern = l.files;\r\n }\r\n for (let filename of glob.sync(dir + pattern, { nosort: true, nodir: true })) {\r\n if (filename.endsWith(\".clas.testclasses.abap\")) {\r\n continue;\r\n }\r\n const contents = fs.readFileSync(filename, \"utf8\");\r\n filename = path.basename(filename);\r\n files.push({ filename, contents });\r\n count++;\r\n }\r\n console.log(count + \" files added from lib\");\r\n if (cleanupFolder === true) {\r\n file_operations_1.FileOperations.deleteFolderRecursive(dir);\r\n }\r\n }\r\n return files;\r\n}\r\nfunction writeObjects(objects, writeSourceMaps, outputFolder, files) {\r\n for (const o of objects) {\r\n let contents = o.chunk.getCode();\r\n if (writeSourceMaps === true\r\n && o.object.type.toUpperCase() !== \"TABL\"\r\n && o.object.type.toUpperCase() !== \"DTEL\"\r\n && o.object.type.toUpperCase() !== \"TTYP\") {\r\n const name = o.filename + \".map\";\r\n contents = contents + `\\n//# sourceMappingURL=` + name;\r\n let map = o.chunk.getMap(o.filename);\r\n for (const f of files) { // hack the paths to the original files\r\n if (f.relative === undefined) {\r\n continue;\r\n }\r\n if (map.includes(`\"${f.filename}\"`)) {\r\n let withPath = `\"${f.relative}${path.sep}${f.filename}\"`;\r\n withPath = withPath.replace(/\\\\/g, \"\\\\\\\\\");\r\n map = map.replace(`\"${f.filename}\"`, withPath);\r\n }\r\n }\r\n fs.writeFileSync(outputFolder + path.sep + name, map);\r\n }\r\n fs.writeFileSync(outputFolder + path.sep + o.filename, contents);\r\n }\r\n}\r\nasync function run() {\r\n console.log(\"Transpiler CLI\");\r\n const config = config_1.TranspilerConfig.find(process.argv[2]);\r\n const libFiles = loadLib(config);\r\n const files = file_operations_1.FileOperations.loadFiles(config);\r\n console.log(\"\\nBuilding\");\r\n const t = new Transpiler.Transpiler(config.options);\r\n const reg = new abaplint.Registry();\r\n for (const f of files) {\r\n reg.addFile(new abaplint.MemoryFile(f.filename, f.contents));\r\n }\r\n for (const l of libFiles) {\r\n reg.addDependency(new abaplint.MemoryFile(l.filename, l.contents));\r\n }\r\n reg.parse();\r\n const output = await t.run(reg, new Progress());\r\n console.log(\"\\nOutput\");\r\n const outputFolder = config.output_folder;\r\n if (!fs.existsSync(outputFolder)) {\r\n fs.mkdirSync(outputFolder);\r\n }\r\n writeObjects(output.objects, config.write_source_map, outputFolder, files);\r\n console.log(output.objects.length + \" objects written to disk\");\r\n if (config.write_unit_tests === true) {\r\n // breaking change? rename this output file,\r\n fs.writeFileSync(outputFolder + path.sep + \"index.mjs\", output.unitTestScript);\r\n fs.writeFileSync(outputFolder + path.sep + \"_unit_open.mjs\", output.unitTestScriptOpen);\r\n }\r\n // breaking change? rename this output file,\r\n fs.writeFileSync(outputFolder + path.sep + \"init.mjs\", output.initializationScript);\r\n // new static referenced imports,\r\n fs.writeFileSync(outputFolder + path.sep + \"_init.mjs\", output.initializationScript2);\r\n fs.writeFileSync(outputFolder + path.sep + \"_top.mjs\", `import runtime from \"@abaplint/runtime\";\r\nglobalThis.abap = new runtime.ABAP();`);\r\n}\r\nrun().then(() => {\r\n process.exit();\r\n}).catch((err) => {\r\n console.log(err);\r\n process.exit(1);\r\n});\r\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./build/index.js?");
41
+ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst fs = __webpack_require__(/*! fs */ \"fs\");\r\nconst path = __webpack_require__(/*! path */ \"path\");\r\nconst glob = __webpack_require__(/*! glob */ \"./node_modules/glob/glob.js\");\r\nconst childProcess = __webpack_require__(/*! child_process */ \"child_process\");\r\nconst os = __webpack_require__(/*! os */ \"os\");\r\nconst ProgressBar = __webpack_require__(/*! progress */ \"./node_modules/progress/index.js\");\r\nconst Transpiler = __webpack_require__(/*! @abaplint/transpiler */ \"./node_modules/@abaplint/transpiler/build/src/index.js\");\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst config_1 = __webpack_require__(/*! ./config */ \"./build/config.js\");\r\nconst file_operations_1 = __webpack_require__(/*! ./file_operations */ \"./build/file_operations.js\");\r\nclass Progress {\r\n set(total, _text) {\r\n this.bar = new ProgressBar(\":percent - :elapseds - :text\", { total, renderThrottle: 100 });\r\n }\r\n async tick(text) {\r\n this.bar.tick({ text });\r\n this.bar.render();\r\n }\r\n}\r\nfunction loadLib(config) {\r\n const files = [];\r\n if (config.lib && config.lib !== \"\" && config.libs === undefined) {\r\n config.libs = [{ url: config.lib }];\r\n }\r\n for (const l of config.libs || []) {\r\n let dir = \"\";\r\n let cleanupFolder = false;\r\n if (l.folder !== undefined && l.folder !== \"\" && fs.existsSync(process.cwd() + l.folder)) {\r\n console.log(\"From folder: \" + l.folder);\r\n dir = process.cwd() + l.folder;\r\n }\r\n else {\r\n console.log(\"Clone: \" + l.url);\r\n dir = fs.mkdtempSync(path.join(os.tmpdir(), \"abap_transpile-\"));\r\n childProcess.execSync(\"git clone --quiet --depth 1 \" + l.url + \" .\", { cwd: dir, stdio: \"inherit\" });\r\n cleanupFolder = true;\r\n }\r\n let count = 0;\r\n let pattern = \"/src/**\";\r\n if (l.files !== undefined && l.files !== \"\") {\r\n pattern = l.files;\r\n }\r\n for (let filename of glob.sync(dir + pattern, { nosort: true, nodir: true })) {\r\n if (filename.endsWith(\".clas.testclasses.abap\")) {\r\n continue;\r\n }\r\n const contents = fs.readFileSync(filename, \"utf8\");\r\n filename = path.basename(filename);\r\n files.push({ filename, contents });\r\n count++;\r\n }\r\n console.log(count + \" files added from lib\");\r\n if (cleanupFolder === true) {\r\n file_operations_1.FileOperations.deleteFolderRecursive(dir);\r\n }\r\n }\r\n return files;\r\n}\r\nfunction writeObjects(objects, writeSourceMaps, outputFolder, files) {\r\n for (const o of objects) {\r\n let contents = o.chunk.getCode();\r\n if (writeSourceMaps === true\r\n && o.object.type.toUpperCase() !== \"TABL\"\r\n && o.object.type.toUpperCase() !== \"DTEL\"\r\n && o.object.type.toUpperCase() !== \"ENQU\"\r\n && o.object.type.toUpperCase() !== \"TTYP\") {\r\n const name = o.filename + \".map\";\r\n contents = contents + `\\n//# sourceMappingURL=` + name;\r\n let map = o.chunk.getMap(o.filename);\r\n for (const f of files) { // hack the paths to the original files\r\n if (f.relative === undefined) {\r\n continue;\r\n }\r\n if (map.includes(`\"${f.filename}\"`)) {\r\n let withPath = `\"${f.relative}${path.sep}${f.filename}\"`;\r\n withPath = withPath.replace(/\\\\/g, \"\\\\\\\\\");\r\n map = map.replace(`\"${f.filename}\"`, withPath);\r\n }\r\n }\r\n fs.writeFileSync(outputFolder + path.sep + name, map);\r\n }\r\n fs.writeFileSync(outputFolder + path.sep + o.filename, contents);\r\n }\r\n}\r\nasync function run() {\r\n console.log(\"Transpiler CLI\");\r\n const config = config_1.TranspilerConfig.find(process.argv[2]);\r\n const libFiles = loadLib(config);\r\n const files = file_operations_1.FileOperations.loadFiles(config);\r\n console.log(\"\\nBuilding\");\r\n const t = new Transpiler.Transpiler(config.options);\r\n const reg = new abaplint.Registry();\r\n for (const f of files) {\r\n reg.addFile(new abaplint.MemoryFile(f.filename, f.contents));\r\n }\r\n for (const l of libFiles) {\r\n reg.addDependency(new abaplint.MemoryFile(l.filename, l.contents));\r\n }\r\n reg.parse();\r\n const output = await t.run(reg, new Progress());\r\n console.log(\"\\nOutput\");\r\n const outputFolder = config.output_folder;\r\n if (!fs.existsSync(outputFolder)) {\r\n fs.mkdirSync(outputFolder);\r\n }\r\n writeObjects(output.objects, config.write_source_map, outputFolder, files);\r\n console.log(output.objects.length + \" objects written to disk\");\r\n if (config.write_unit_tests === true) {\r\n // breaking change? rename this output file,\r\n fs.writeFileSync(outputFolder + path.sep + \"index.mjs\", output.unitTestScript);\r\n fs.writeFileSync(outputFolder + path.sep + \"_unit_open.mjs\", output.unitTestScriptOpen);\r\n }\r\n // breaking change? rename this output file,\r\n fs.writeFileSync(outputFolder + path.sep + \"init.mjs\", output.initializationScript);\r\n // new static referenced imports,\r\n fs.writeFileSync(outputFolder + path.sep + \"_init.mjs\", output.initializationScript2);\r\n fs.writeFileSync(outputFolder + path.sep + \"_top.mjs\", `import runtime from \"@abaplint/runtime\";\r\nglobalThis.abap = new runtime.ABAP();`);\r\n}\r\nrun().then(() => {\r\n process.exit();\r\n}).catch((err) => {\r\n console.log(err);\r\n process.exit(1);\r\n});\r\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./build/index.js?");
42
42
 
43
43
  /***/ }),
44
44
 
@@ -13759,6 +13759,17 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
13759
13759
 
13760
13760
  /***/ }),
13761
13761
 
13762
+ /***/ "./node_modules/@abaplint/transpiler/build/src/handlers/handle_enqu.js":
13763
+ /*!*****************************************************************************!*\
13764
+ !*** ./node_modules/@abaplint/transpiler/build/src/handlers/handle_enqu.js ***!
13765
+ \*****************************************************************************/
13766
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
13767
+
13768
+ "use strict";
13769
+ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.HandleEnqu = void 0;\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\n// view, much like the tables\r\nclass HandleEnqu {\r\n runObject(obj, _reg) {\r\n var _a;\r\n const filename = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename().replace(\".xml\", \".mjs\").toLowerCase();\r\n if (filename === undefined) {\r\n return [];\r\n }\r\n const chunk = new chunk_1.Chunk().appendString(`// enqueue object\r\nabap.FunctionModules[\"ENQUEUE_${obj.getName().toUpperCase()}\"] = async (INPUT) => {\r\n const lookup = abap.Classes[\"KERNEL_LOCK\"];\r\n if (lookup === undefined) {\r\n throw new Error(\"Lock, kernel class missing\");\r\n }\r\n await lookup.enqueue(INPUT);\r\n};\r\nabap.FunctionModules[\"DEQUEUE_${obj.getName().toUpperCase()}\"] = async (INPUT) => {\r\n const lookup = abap.Classes[\"KERNEL_LOCK\"];\r\n if (lookup === undefined) {\r\n throw new Error(\"Lock, kernel class missing\");\r\n }\r\n await lookup.dequeue(INPUT);\r\n};`);\r\n const output = {\r\n object: {\r\n name: obj.getName(),\r\n type: obj.getType(),\r\n },\r\n filename: filename,\r\n chunk: chunk,\r\n requires: [],\r\n exports: [],\r\n };\r\n return [output];\r\n }\r\n}\r\nexports.HandleEnqu = HandleEnqu;\r\n//# sourceMappingURL=handle_enqu.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/handlers/handle_enqu.js?");
13770
+
13771
+ /***/ }),
13772
+
13762
13773
  /***/ "./node_modules/@abaplint/transpiler/build/src/handlers/handle_table.js":
13763
13774
  /*!******************************************************************************!*\
13764
13775
  !*** ./node_modules/@abaplint/transpiler/build/src/handlers/handle_table.js ***!
@@ -13799,7 +13810,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
13799
13810
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
13800
13811
 
13801
13812
  "use strict";
13802
- eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Transpiler = exports.config = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst validation_1 = __webpack_require__(/*! ./validation */ \"./node_modules/@abaplint/transpiler/build/src/validation.js\");\r\nObject.defineProperty(exports, \"config\", ({ enumerable: true, get: function () { return validation_1.config; } }));\r\nconst unit_test_1 = __webpack_require__(/*! ./unit_test */ \"./node_modules/@abaplint/transpiler/build/src/unit_test.js\");\r\nconst keywords_1 = __webpack_require__(/*! ./keywords */ \"./node_modules/@abaplint/transpiler/build/src/keywords.js\");\r\nconst db_1 = __webpack_require__(/*! ./db */ \"./node_modules/@abaplint/transpiler/build/src/db/index.js\");\r\nconst handle_table_1 = __webpack_require__(/*! ./handlers/handle_table */ \"./node_modules/@abaplint/transpiler/build/src/handlers/handle_table.js\");\r\nconst handle_abap_1 = __webpack_require__(/*! ./handlers/handle_abap */ \"./node_modules/@abaplint/transpiler/build/src/handlers/handle_abap.js\");\r\nconst handle_data_element_1 = __webpack_require__(/*! ./handlers/handle_data_element */ \"./node_modules/@abaplint/transpiler/build/src/handlers/handle_data_element.js\");\r\nconst handle_table_type_1 = __webpack_require__(/*! ./handlers/handle_table_type */ \"./node_modules/@abaplint/transpiler/build/src/handlers/handle_table_type.js\");\r\nconst handle_view_1 = __webpack_require__(/*! ./handlers/handle_view */ \"./node_modules/@abaplint/transpiler/build/src/handlers/handle_view.js\");\r\nclass Transpiler {\r\n constructor(options) {\r\n this.options = options;\r\n if (this.options === undefined) {\r\n this.options = {};\r\n }\r\n if (this.options.unknownTypes === undefined) {\r\n this.options.unknownTypes = \"compileError\";\r\n }\r\n }\r\n // workaround for web/webpack\r\n async runRaw(files) {\r\n const memory = files.map(f => new abaplint.MemoryFile(f.filename, f.contents));\r\n const reg = new abaplint.Registry().addFiles(memory).parse();\r\n return new Transpiler().run(reg);\r\n }\r\n async run(reg, progress) {\r\n var _a, _b, _c, _d, _e, _f;\r\n reg.parse();\r\n new keywords_1.Keywords().handle(reg);\r\n this.validate(reg);\r\n const dbSetup = new db_1.DatabaseSetup(reg).run();\r\n const output = {\r\n objects: [],\r\n unitTestScript: new unit_test_1.UnitTest().unitTestScript(reg, (_a = this.options) === null || _a === void 0 ? void 0 : _a.skip, (_b = this.options) === null || _b === void 0 ? void 0 : _b.only),\r\n unitTestScriptOpen: new unit_test_1.UnitTest().unitTestScriptOpen(reg, (_c = this.options) === null || _c === void 0 ? void 0 : _c.skip, (_d = this.options) === null || _d === void 0 ? void 0 : _d.only),\r\n initializationScript: new unit_test_1.UnitTest().initializationScript(reg, dbSetup, (_e = this.options) === null || _e === void 0 ? void 0 : _e.extraSetup),\r\n initializationScript2: new unit_test_1.UnitTest().initializationScript(reg, dbSetup, (_f = this.options) === null || _f === void 0 ? void 0 : _f.extraSetup, true),\r\n databaseSetup: dbSetup,\r\n reg: reg,\r\n };\r\n progress === null || progress === void 0 ? void 0 : progress.set(reg.getObjectCount(false), \"Building, Syntax Logic\");\r\n for (const obj of reg.getObjects()) {\r\n await (progress === null || progress === void 0 ? void 0 : progress.tick(\"Building, Syntax Logic, \" + obj.getName()));\r\n if (obj instanceof abaplint.ABAPObject) {\r\n // todo, this is already done inside reg.parse()?\r\n new abaplint.SyntaxLogic(reg, obj).run();\r\n }\r\n }\r\n progress === null || progress === void 0 ? void 0 : progress.set(reg.getObjectCount(false), \"Building\");\r\n for (const obj of reg.getObjects()) {\r\n await (progress === null || progress === void 0 ? void 0 : progress.tick(\"Building, \" + obj.getName()));\r\n if (obj instanceof abaplint.ABAPObject && !(obj instanceof abaplint.Objects.TypePool)) {\r\n output.objects.push(...new handle_abap_1.HandleABAP(this.options).runObject(obj, reg));\r\n }\r\n else if (obj instanceof abaplint.Objects.Table) {\r\n output.objects.push(...new handle_table_1.HandleTable().runObject(obj, reg));\r\n }\r\n else if (obj instanceof abaplint.Objects.View) {\r\n output.objects.push(...new handle_view_1.HandleView().runObject(obj, reg));\r\n }\r\n else if (obj instanceof abaplint.Objects.DataElement) {\r\n output.objects.push(...new handle_data_element_1.HandleDataElement().runObject(obj, reg));\r\n }\r\n else if (obj instanceof abaplint.Objects.TableType) {\r\n output.objects.push(...new handle_table_type_1.HandleTableType().runObject(obj, reg));\r\n }\r\n }\r\n return output;\r\n }\r\n // ///////////////////////////////\r\n validate(reg) {\r\n const issues = new validation_1.Validation(this.options).run(reg);\r\n if (issues.length > 0) {\r\n const messages = issues.map(i => i.getKey() + \", \" +\r\n i.getMessage() + \", \" +\r\n i.getFilename() + \":\" +\r\n i.getStart().getRow());\r\n throw new Error(messages.join(\"\\n\"));\r\n }\r\n }\r\n}\r\nexports.Transpiler = Transpiler;\r\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/index.js?");
13813
+ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Transpiler = exports.config = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst validation_1 = __webpack_require__(/*! ./validation */ \"./node_modules/@abaplint/transpiler/build/src/validation.js\");\r\nObject.defineProperty(exports, \"config\", ({ enumerable: true, get: function () { return validation_1.config; } }));\r\nconst unit_test_1 = __webpack_require__(/*! ./unit_test */ \"./node_modules/@abaplint/transpiler/build/src/unit_test.js\");\r\nconst keywords_1 = __webpack_require__(/*! ./keywords */ \"./node_modules/@abaplint/transpiler/build/src/keywords.js\");\r\nconst db_1 = __webpack_require__(/*! ./db */ \"./node_modules/@abaplint/transpiler/build/src/db/index.js\");\r\nconst handle_table_1 = __webpack_require__(/*! ./handlers/handle_table */ \"./node_modules/@abaplint/transpiler/build/src/handlers/handle_table.js\");\r\nconst handle_abap_1 = __webpack_require__(/*! ./handlers/handle_abap */ \"./node_modules/@abaplint/transpiler/build/src/handlers/handle_abap.js\");\r\nconst handle_data_element_1 = __webpack_require__(/*! ./handlers/handle_data_element */ \"./node_modules/@abaplint/transpiler/build/src/handlers/handle_data_element.js\");\r\nconst handle_table_type_1 = __webpack_require__(/*! ./handlers/handle_table_type */ \"./node_modules/@abaplint/transpiler/build/src/handlers/handle_table_type.js\");\r\nconst handle_view_1 = __webpack_require__(/*! ./handlers/handle_view */ \"./node_modules/@abaplint/transpiler/build/src/handlers/handle_view.js\");\r\nconst handle_enqu_1 = __webpack_require__(/*! ./handlers/handle_enqu */ \"./node_modules/@abaplint/transpiler/build/src/handlers/handle_enqu.js\");\r\nclass Transpiler {\r\n constructor(options) {\r\n this.options = options;\r\n if (this.options === undefined) {\r\n this.options = {};\r\n }\r\n if (this.options.unknownTypes === undefined) {\r\n this.options.unknownTypes = \"compileError\";\r\n }\r\n }\r\n // workaround for web/webpack\r\n async runRaw(files) {\r\n const memory = files.map(f => new abaplint.MemoryFile(f.filename, f.contents));\r\n const reg = new abaplint.Registry().addFiles(memory).parse();\r\n return new Transpiler().run(reg);\r\n }\r\n async run(reg, progress) {\r\n var _a, _b, _c, _d, _e, _f;\r\n reg.parse();\r\n new keywords_1.Keywords().handle(reg);\r\n this.validate(reg);\r\n const dbSetup = new db_1.DatabaseSetup(reg).run();\r\n const output = {\r\n objects: [],\r\n unitTestScript: new unit_test_1.UnitTest().unitTestScript(reg, (_a = this.options) === null || _a === void 0 ? void 0 : _a.skip, (_b = this.options) === null || _b === void 0 ? void 0 : _b.only),\r\n unitTestScriptOpen: new unit_test_1.UnitTest().unitTestScriptOpen(reg, (_c = this.options) === null || _c === void 0 ? void 0 : _c.skip, (_d = this.options) === null || _d === void 0 ? void 0 : _d.only),\r\n initializationScript: new unit_test_1.UnitTest().initializationScript(reg, dbSetup, (_e = this.options) === null || _e === void 0 ? void 0 : _e.extraSetup),\r\n initializationScript2: new unit_test_1.UnitTest().initializationScript(reg, dbSetup, (_f = this.options) === null || _f === void 0 ? void 0 : _f.extraSetup, true),\r\n databaseSetup: dbSetup,\r\n reg: reg,\r\n };\r\n progress === null || progress === void 0 ? void 0 : progress.set(reg.getObjectCount(false), \"Building, Syntax Logic\");\r\n for (const obj of reg.getObjects()) {\r\n await (progress === null || progress === void 0 ? void 0 : progress.tick(\"Building, Syntax Logic, \" + obj.getName()));\r\n if (obj instanceof abaplint.ABAPObject) {\r\n // todo, this is already done inside reg.parse()?\r\n new abaplint.SyntaxLogic(reg, obj).run();\r\n }\r\n }\r\n progress === null || progress === void 0 ? void 0 : progress.set(reg.getObjectCount(false), \"Building\");\r\n for (const obj of reg.getObjects()) {\r\n await (progress === null || progress === void 0 ? void 0 : progress.tick(\"Building, \" + obj.getName()));\r\n if (obj instanceof abaplint.ABAPObject && !(obj instanceof abaplint.Objects.TypePool)) {\r\n output.objects.push(...new handle_abap_1.HandleABAP(this.options).runObject(obj, reg));\r\n }\r\n else if (obj instanceof abaplint.Objects.Table) {\r\n output.objects.push(...new handle_table_1.HandleTable().runObject(obj, reg));\r\n }\r\n else if (obj instanceof abaplint.Objects.View) {\r\n output.objects.push(...new handle_view_1.HandleView().runObject(obj, reg));\r\n }\r\n else if (obj instanceof abaplint.Objects.LockObject) {\r\n output.objects.push(...new handle_enqu_1.HandleEnqu().runObject(obj, reg));\r\n }\r\n else if (obj instanceof abaplint.Objects.DataElement) {\r\n output.objects.push(...new handle_data_element_1.HandleDataElement().runObject(obj, reg));\r\n }\r\n else if (obj instanceof abaplint.Objects.TableType) {\r\n output.objects.push(...new handle_table_type_1.HandleTableType().runObject(obj, reg));\r\n }\r\n }\r\n return output;\r\n }\r\n // ///////////////////////////////\r\n validate(reg) {\r\n const issues = new validation_1.Validation(this.options).run(reg);\r\n if (issues.length > 0) {\r\n const messages = issues.map(i => i.getKey() + \", \" +\r\n i.getMessage() + \", \" +\r\n i.getFilename() + \":\" +\r\n i.getStart().getRow());\r\n throw new Error(messages.join(\"\\n\"));\r\n }\r\n }\r\n}\r\nexports.Transpiler = Transpiler;\r\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/index.js?");
13803
13814
 
13804
13815
  /***/ }),
13805
13816
 
@@ -15372,7 +15383,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
15372
15383
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
15373
15384
 
15374
15385
  "use strict";
15375
- eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnitTest = void 0;\r\n/* eslint-disable max-len */\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass UnitTest {\r\n // todo, move this method somewhere else, its much more than just unit test relevant\r\n initializationScript(reg, dbSetup, extraSetup, useImport) {\r\n let ret = \"\";\r\n if (useImport === true) {\r\n ret = `/* eslint-disable import/newline-after-import */\r\nimport \"./_top.mjs\";\\n`;\r\n }\r\n else {\r\n ret = `/* eslint-disable import/newline-after-import */\r\nimport runtime from \"@abaplint/runtime\";\r\nglobalThis.abap = new runtime.ABAP();\\n`;\r\n }\r\n ret += `${this.buildImports(reg, useImport)}\r\n\r\nexport async function initializeABAP() {\\n`;\r\n ret += ` const sqlite = [];\\n`;\r\n for (const i of dbSetup.schemas.sqlite) {\r\n ret += `sqlite.push(\\`${i}\\`);\\n`;\r\n }\r\n ret += ` const hdb = \\`${dbSetup.schemas.hdb}\\`;\\n`;\r\n ret += ` const pg = \\`${dbSetup.schemas.pg}\\`;\\n`;\r\n ret += ` const schemas = {sqlite, hdb, pg};\\n`;\r\n ret += ` const insert = [];\\n`;\r\n for (const i of dbSetup.insert) {\r\n ret += ` insert.push(\\`${i}\\`);\\n`;\r\n }\r\n if (extraSetup === undefined) {\r\n ret += `// no setup logic specified in config\\n`;\r\n }\r\n else {\r\n ret += ` const {setup} = await import(\"${extraSetup}\");\\n` +\r\n ` await setup(globalThis.abap, schemas, insert);\\n`;\r\n }\r\n ret += `}`;\r\n return ret;\r\n }\r\n escapeNamespace(filename) {\r\n // ES modules are resolved and cached as URLs. This means that special characters must be percent-encoded, such as # with %23 and ? with %3F.\r\n return filename.replace(/\\//g, \"%23\");\r\n }\r\n unitTestScriptOpen(reg, _skip, _only) {\r\n let ret = `/* eslint-disable curly */\r\nimport fs from \"fs\";\r\nimport path from \"path\";\r\nimport {fileURLToPath} from \"url\";\r\nimport {initializeABAP} from \"./init.mjs\";\r\n\r\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\r\n\r\nasync function run() {\r\n await initializeABAP();\r\n let lt_input = new abap.types.Table(new abap.types.Structure({class_name: new abap.types.Character({length: 30}), testclass_name: new abap.types.Character({length: 30}), method_name: new abap.types.Character({length: 30})}), {\"withHeader\":false,\"type\":\"STANDARD\",\"isUnique\":false,\"keyFields\":[]});\r\n let ls_input = new abap.types.Structure({class_name: new abap.types.Character({length: 30}), testclass_name: new abap.types.Character({length: 30}), method_name: new abap.types.Character({length: 30})});\r\n let ls_result = new abap.types.Structure({list: new abap.types.Table(new abap.types.Structure({class_name: new abap.types.Character({length: 30}), testclass_name: new abap.types.Character({length: 30}), method_name: new abap.types.Character({length: 30}), expected: new abap.types.String(), actual: new abap.types.String(), status: new abap.types.String(), runtime: new abap.types.Integer(), message: new abap.types.String(), js_location: new abap.types.String()}), {\"withHeader\":false,\"type\":\"STANDARD\",\"isUnique\":false,\"keyFields\":[]}), json: new abap.types.String()});\r\n`;\r\n for (const obj of reg.getObjects()) {\r\n if (reg.isDependency(obj) || !(obj instanceof abaplint.Objects.Class)) {\r\n continue;\r\n }\r\n const hasTestFile = obj.getFiles().some(f => { return f.getFilename().includes(\".testclasses.\"); });\r\n if (hasTestFile === true) {\r\n ret += ` await import(\"./${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}.testclasses.mjs\");\\n`;\r\n }\r\n for (const file of obj.getABAPFiles()) {\r\n for (const def of file.getInfo().listClassDefinitions()) {\r\n if (def.isForTesting === false || def.isGlobal === true || def.methods.length === 0) {\r\n // todo, fix, there might be global test methods\r\n continue;\r\n }\r\n for (const m of def.methods) {\r\n if (m.isForTesting === false) {\r\n continue;\r\n }\r\n ret += ` ls_input.get().class_name.set(\"${obj.getName()}\");\r\n ls_input.get().testclass_name.set(\"${def.name.toUpperCase()}\");\r\n ls_input.get().method_name.set(\"${m.name.toUpperCase()}\");\r\n abap.statements.append({source: ls_input, target: lt_input});\\n`;\r\n }\r\n }\r\n }\r\n }\r\n ret += `\r\n\r\n ls_result.set(await abap.Classes[\"KERNEL_UNIT_RUNNER\"].run({it_input: lt_input}));\r\n fs.writeFileSync(__dirname + path.sep + \"output.json\", ls_result.get().json.get());\r\n}\r\n\r\nrun().then(() => {\r\n process.exit(0);\r\n}).catch((err) => {\r\n console.log(err);\r\n process.exit(1);\r\n});`;\r\n return ret;\r\n }\r\n unitTestScript(reg, skip, _only) {\r\n let ret = `/* eslint-disable curly */\r\nimport fs from \"fs\";\r\nimport path from \"path\";\r\nimport {fileURLToPath} from \"url\";\r\nimport {initializeABAP} from \"./init.mjs\";\r\nimport runtime from \"@abaplint/runtime\";\r\n\r\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\r\n\r\nasync function run() {\r\n await initializeABAP();\r\n const unit = new runtime.UnitTestResult();\r\n let clas;\r\n let locl;\r\n let meth;\r\n try {\\n`;\r\n for (const obj of reg.getObjects()) {\r\n if (reg.isDependency(obj) || !(obj instanceof abaplint.Objects.Class)) {\r\n continue;\r\n }\r\n ret += `// --------------------------------------------\\n`;\r\n ret += ` clas = unit.addObject(\"${obj.getName()}\");\\n`;\r\n for (const file of obj.getABAPFiles()) {\r\n for (const def of file.getInfo().listClassDefinitions()) {\r\n if (def.isForTesting === false || def.isGlobal === true || def.methods.length === 0) {\r\n // todo, fix, there might be global test methods\r\n continue;\r\n }\r\n ret += ` {\r\n const {${def.name}} = await import(\"./${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}.testclasses.mjs\");\r\n locl = clas.addTestClass(\"${def.name}\");\r\n if (${def.name}.class_setup) await ${def.name}.class_setup();\\n`;\r\n for (const m of def.methods) {\r\n if (m.isForTesting === false) {\r\n continue;\r\n }\r\n const skipThis = (skip || []).some(a => a.object === obj.getName() && a.class === def.name && a.method === m.name);\r\n if (skipThis) {\r\n ret += ` console.log('${obj.getName()}: running ${def.name}->${m.name}, skipped');\\n`;\r\n ret += ` meth = locl.addMethod(\"${m.name}\");\\n`;\r\n ret += ` meth.skip();\\n`;\r\n continue;\r\n }\r\n ret += ` {\\n const test = await (new ${def.name}()).constructor_();\\n`;\r\n ret += ` if (test.setup) await test.setup();\\n`;\r\n ret += ` console.log(\"${obj.getName()}: running ${def.name}->${m.name}\");\\n`;\r\n ret += ` meth = locl.addMethod(\"${m.name}\");\\n`;\r\n ret += ` await test.${m.name}();\\n`;\r\n ret += ` meth.pass();\\n`;\r\n ret += ` if (test.teardown) await test.teardown();\\n`;\r\n ret += ` }\\n`;\r\n }\r\n ret += ` if (${def.name}.class_teardown) await ${def.name}.class_teardown();\\n`;\r\n ret += ` }\\n`;\r\n }\r\n }\r\n }\r\n ret += `// -------------------END-------------------\r\n console.log(abap.console.get());\r\n fs.writeFileSync(__dirname + path.sep + \"_output.xml\", unit.xUnitXML());\r\n } catch (e) {\r\n if (meth) {\r\n meth.fail();\r\n }\r\n console.log(abap.console.get());\r\n fs.writeFileSync(__dirname + path.sep + \"_output.xml\", unit.xUnitXML());\r\n throw e;\r\n }\r\n}\r\n\r\nrun().then(() => {\r\n process.exit(0);\r\n}).catch((err) => {\r\n console.log(err);\r\n process.exit(1);\r\n});`;\r\n return ret;\r\n }\r\n buildImports(reg, useImport) {\r\n // note: ES modules are hoised, so use the dynamic import(), due to setting of globalThis.abap\r\n // some sorting required: eg. a class constructor using constant from interface\r\n const list = [];\r\n const late = [];\r\n const imp = (filename) => {\r\n if (useImport === true) {\r\n return `import \"./${filename}.mjs\";`;\r\n }\r\n else {\r\n return `await import(\"./${filename}.mjs\");`;\r\n }\r\n };\r\n for (const obj of reg.getObjects()) {\r\n if (obj instanceof abaplint.Objects.Table\r\n || obj instanceof abaplint.Objects.DataElement\r\n || obj instanceof abaplint.Objects.TableType) {\r\n list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));\r\n }\r\n }\r\n for (const obj of reg.getObjects()) {\r\n if (obj instanceof abaplint.Objects.FunctionGroup) {\r\n for (const m of obj.getModules()) {\r\n list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.fugr.${m.getName().toLowerCase()}`));\r\n }\r\n }\r\n else if (obj instanceof abaplint.Objects.Class) {\r\n if (obj.getName().toUpperCase() !== \"CL_ABAP_CHAR_UTILITIES\"\r\n && this.hasClassConstructor(reg, obj)) {\r\n // this will not solve all problems with class constors 100%, but probably good enough\r\n late.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));\r\n }\r\n else {\r\n list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));\r\n }\r\n }\r\n else if (obj instanceof abaplint.Objects.Interface) {\r\n list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));\r\n }\r\n }\r\n return [...list.sort(), ...late].join(\"\\n\");\r\n }\r\n // class constructors might make early use of eg. constants from interfaces\r\n // sub classes will import() super classes and trigger a class constructor of the super\r\n hasClassConstructor(reg, clas) {\r\n var _a, _b;\r\n if (((_a = clas.getDefinition()) === null || _a === void 0 ? void 0 : _a.getMethodDefinitions().getByName(\"CLASS_CONSTRUCTOR\")) !== undefined) {\r\n return true;\r\n }\r\n const sup = (_b = clas.getDefinition()) === null || _b === void 0 ? void 0 : _b.getSuperClass();\r\n if (sup !== undefined) {\r\n const superClass = reg.getObject(\"CLAS\", sup);\r\n if (superClass) {\r\n return this.hasClassConstructor(reg, superClass);\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.UnitTest = UnitTest;\r\n//# sourceMappingURL=unit_test.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/unit_test.js?");
15386
+ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnitTest = void 0;\r\n/* eslint-disable max-len */\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass UnitTest {\r\n // todo, move this method somewhere else, its much more than just unit test relevant\r\n initializationScript(reg, dbSetup, extraSetup, useImport) {\r\n let ret = \"\";\r\n if (useImport === true) {\r\n ret = `/* eslint-disable import/newline-after-import */\r\nimport \"./_top.mjs\";\\n`;\r\n }\r\n else {\r\n ret = `/* eslint-disable import/newline-after-import */\r\nimport runtime from \"@abaplint/runtime\";\r\nglobalThis.abap = new runtime.ABAP();\\n`;\r\n }\r\n ret += `${this.buildImports(reg, useImport)}\r\n\r\nexport async function initializeABAP() {\\n`;\r\n ret += ` const sqlite = [];\\n`;\r\n for (const i of dbSetup.schemas.sqlite) {\r\n ret += `sqlite.push(\\`${i}\\`);\\n`;\r\n }\r\n ret += ` const hdb = \\`${dbSetup.schemas.hdb}\\`;\\n`;\r\n ret += ` const pg = \\`${dbSetup.schemas.pg}\\`;\\n`;\r\n ret += ` const schemas = {sqlite, hdb, pg};\\n`;\r\n ret += ` const insert = [];\\n`;\r\n for (const i of dbSetup.insert) {\r\n ret += ` insert.push(\\`${i}\\`);\\n`;\r\n }\r\n if (extraSetup === undefined) {\r\n ret += `// no setup logic specified in config\\n`;\r\n }\r\n else {\r\n ret += ` const {setup} = await import(\"${extraSetup}\");\\n` +\r\n ` await setup(globalThis.abap, schemas, insert);\\n`;\r\n }\r\n ret += `}`;\r\n return ret;\r\n }\r\n escapeNamespace(filename) {\r\n // ES modules are resolved and cached as URLs. This means that special characters must be percent-encoded, such as # with %23 and ? with %3F.\r\n return filename.replace(/\\//g, \"%23\");\r\n }\r\n unitTestScriptOpen(reg, _skip, _only) {\r\n let ret = `/* eslint-disable curly */\r\nimport fs from \"fs\";\r\nimport path from \"path\";\r\nimport {fileURLToPath} from \"url\";\r\nimport {initializeABAP} from \"./init.mjs\";\r\n\r\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\r\n\r\nasync function run() {\r\n await initializeABAP();\r\n let lt_input = new abap.types.Table(new abap.types.Structure({class_name: new abap.types.Character({length: 30}), testclass_name: new abap.types.Character({length: 30}), method_name: new abap.types.Character({length: 30})}), {\"withHeader\":false,\"type\":\"STANDARD\",\"isUnique\":false,\"keyFields\":[]});\r\n let ls_input = new abap.types.Structure({class_name: new abap.types.Character({length: 30}), testclass_name: new abap.types.Character({length: 30}), method_name: new abap.types.Character({length: 30})});\r\n let ls_result = new abap.types.Structure({list: new abap.types.Table(new abap.types.Structure({class_name: new abap.types.Character({length: 30}), testclass_name: new abap.types.Character({length: 30}), method_name: new abap.types.Character({length: 30}), expected: new abap.types.String(), actual: new abap.types.String(), status: new abap.types.String(), runtime: new abap.types.Integer(), message: new abap.types.String(), js_location: new abap.types.String()}), {\"withHeader\":false,\"type\":\"STANDARD\",\"isUnique\":false,\"keyFields\":[]}), json: new abap.types.String()});\r\n`;\r\n for (const obj of reg.getObjects()) {\r\n if (reg.isDependency(obj) || !(obj instanceof abaplint.Objects.Class)) {\r\n continue;\r\n }\r\n const hasTestFile = obj.getFiles().some(f => { return f.getFilename().includes(\".testclasses.\"); });\r\n if (hasTestFile === true) {\r\n ret += ` await import(\"./${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}.testclasses.mjs\");\\n`;\r\n }\r\n for (const file of obj.getABAPFiles()) {\r\n for (const def of file.getInfo().listClassDefinitions()) {\r\n if (def.isForTesting === false || def.isGlobal === true || def.methods.length === 0) {\r\n // todo, fix, there might be global test methods\r\n continue;\r\n }\r\n for (const m of def.methods) {\r\n if (m.isForTesting === false) {\r\n continue;\r\n }\r\n ret += ` ls_input.get().class_name.set(\"${obj.getName()}\");\r\n ls_input.get().testclass_name.set(\"${def.name.toUpperCase()}\");\r\n ls_input.get().method_name.set(\"${m.name.toUpperCase()}\");\r\n abap.statements.append({source: ls_input, target: lt_input});\\n`;\r\n }\r\n }\r\n }\r\n }\r\n ret += `\r\n\r\n ls_result.set(await abap.Classes[\"KERNEL_UNIT_RUNNER\"].run({it_input: lt_input}));\r\n fs.writeFileSync(__dirname + path.sep + \"output.json\", ls_result.get().json.get());\r\n}\r\n\r\nrun().then(() => {\r\n process.exit(0);\r\n}).catch((err) => {\r\n console.log(err);\r\n process.exit(1);\r\n});`;\r\n return ret;\r\n }\r\n unitTestScript(reg, skip, _only) {\r\n let ret = `/* eslint-disable curly */\r\nimport fs from \"fs\";\r\nimport path from \"path\";\r\nimport {fileURLToPath} from \"url\";\r\nimport {initializeABAP} from \"./init.mjs\";\r\nimport runtime from \"@abaplint/runtime\";\r\n\r\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\r\n\r\nasync function run() {\r\n await initializeABAP();\r\n const unit = new runtime.UnitTestResult();\r\n let clas;\r\n let locl;\r\n let meth;\r\n try {\\n`;\r\n for (const obj of reg.getObjects()) {\r\n if (reg.isDependency(obj) || !(obj instanceof abaplint.Objects.Class)) {\r\n continue;\r\n }\r\n ret += `// --------------------------------------------\\n`;\r\n ret += ` clas = unit.addObject(\"${obj.getName()}\");\\n`;\r\n for (const file of obj.getABAPFiles()) {\r\n for (const def of file.getInfo().listClassDefinitions()) {\r\n if (def.isForTesting === false || def.isGlobal === true || def.methods.length === 0) {\r\n // todo, fix, there might be global test methods\r\n continue;\r\n }\r\n ret += ` {\r\n const {${def.name}} = await import(\"./${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}.testclasses.mjs\");\r\n locl = clas.addTestClass(\"${def.name}\");\r\n if (${def.name}.class_setup) await ${def.name}.class_setup();\\n`;\r\n for (const m of def.methods) {\r\n if (m.isForTesting === false) {\r\n continue;\r\n }\r\n const skipThis = (skip || []).some(a => a.object === obj.getName() && a.class === def.name && a.method === m.name);\r\n if (skipThis) {\r\n ret += ` console.log('${obj.getName()}: running ${def.name}->${m.name}, skipped');\\n`;\r\n ret += ` meth = locl.addMethod(\"${m.name}\");\\n`;\r\n ret += ` meth.skip();\\n`;\r\n continue;\r\n }\r\n ret += ` {\\n const test = await (new ${def.name}()).constructor_();\\n`;\r\n ret += ` if (test.setup) await test.setup();\\n`;\r\n ret += ` console.log(\"${obj.getName()}: running ${def.name}->${m.name}\");\\n`;\r\n ret += ` meth = locl.addMethod(\"${m.name}\");\\n`;\r\n ret += ` await test.${m.name}();\\n`;\r\n ret += ` meth.pass();\\n`;\r\n ret += ` if (test.teardown) await test.teardown();\\n`;\r\n ret += ` }\\n`;\r\n }\r\n ret += ` if (${def.name}.class_teardown) await ${def.name}.class_teardown();\\n`;\r\n ret += ` }\\n`;\r\n }\r\n }\r\n }\r\n ret += `// -------------------END-------------------\r\n console.log(abap.console.get());\r\n fs.writeFileSync(__dirname + path.sep + \"_output.xml\", unit.xUnitXML());\r\n } catch (e) {\r\n if (meth) {\r\n meth.fail();\r\n }\r\n console.log(abap.console.get());\r\n fs.writeFileSync(__dirname + path.sep + \"_output.xml\", unit.xUnitXML());\r\n throw e;\r\n }\r\n}\r\n\r\nrun().then(() => {\r\n process.exit(0);\r\n}).catch((err) => {\r\n console.log(err);\r\n process.exit(1);\r\n});`;\r\n return ret;\r\n }\r\n buildImports(reg, useImport) {\r\n // note: ES modules are hoised, so use the dynamic import(), due to setting of globalThis.abap\r\n // some sorting required: eg. a class constructor using constant from interface\r\n const list = [];\r\n const late = [];\r\n const imp = (filename) => {\r\n if (useImport === true) {\r\n return `import \"./${filename}.mjs\";`;\r\n }\r\n else {\r\n return `await import(\"./${filename}.mjs\");`;\r\n }\r\n };\r\n for (const obj of reg.getObjects()) {\r\n if (obj instanceof abaplint.Objects.Table\r\n || obj instanceof abaplint.Objects.DataElement\r\n || obj instanceof abaplint.Objects.LockObject\r\n || obj instanceof abaplint.Objects.TableType) {\r\n list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));\r\n }\r\n }\r\n for (const obj of reg.getObjects()) {\r\n if (obj instanceof abaplint.Objects.FunctionGroup) {\r\n for (const m of obj.getModules()) {\r\n list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.fugr.${m.getName().toLowerCase()}`));\r\n }\r\n }\r\n else if (obj instanceof abaplint.Objects.Class) {\r\n if (obj.getName().toUpperCase() !== \"CL_ABAP_CHAR_UTILITIES\"\r\n && this.hasClassConstructor(reg, obj)) {\r\n // this will not solve all problems with class constors 100%, but probably good enough\r\n late.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));\r\n }\r\n else {\r\n list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));\r\n }\r\n }\r\n else if (obj instanceof abaplint.Objects.Interface) {\r\n list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));\r\n }\r\n }\r\n return [...list.sort(), ...late].join(\"\\n\");\r\n }\r\n // class constructors might make early use of eg. constants from interfaces\r\n // sub classes will import() super classes and trigger a class constructor of the super\r\n hasClassConstructor(reg, clas) {\r\n var _a, _b;\r\n if (((_a = clas.getDefinition()) === null || _a === void 0 ? void 0 : _a.getMethodDefinitions().getByName(\"CLASS_CONSTRUCTOR\")) !== undefined) {\r\n return true;\r\n }\r\n const sup = (_b = clas.getDefinition()) === null || _b === void 0 ? void 0 : _b.getSuperClass();\r\n if (sup !== undefined) {\r\n const superClass = reg.getObject(\"CLAS\", sup);\r\n if (superClass) {\r\n return this.hasClassConstructor(reg, superClass);\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.UnitTest = UnitTest;\r\n//# sourceMappingURL=unit_test.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/unit_test.js?");
15376
15387
 
15377
15388
  /***/ }),
15378
15389
 
@@ -15383,7 +15394,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
15383
15394
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
15384
15395
 
15385
15396
  "use strict";
15386
- eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Validation = exports.config = void 0;\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nexports.config = {\r\n \"global\": {\r\n \"files\": \"/**/*.*\",\r\n \"skipGeneratedGatewayClasses\": true,\r\n \"skipGeneratedPersistentClasses\": true,\r\n \"skipGeneratedFunctionGroups\": true,\r\n },\r\n \"syntax\": {\r\n \"version\": core_1.Version.OpenABAP,\r\n \"errorNamespace\": \".\",\r\n },\r\n \"rules\": {\r\n \"when_others_last\": true,\r\n \"avoid_use\": {\r\n // \"define\": true,\r\n \"execSQL\": true,\r\n \"kernelCall\": true,\r\n \"communication\": true,\r\n \"systemCall\": true,\r\n \"break\": true,\r\n \"statics\": true,\r\n \"endselect\": false,\r\n \"defaultKey\": false,\r\n },\r\n \"parser_error\": true,\r\n \"allowed_object_types\": {\r\n \"allowed\": [\"INTF\", \"CLAS\", \"PROG\", \"DEVC\", \"TABL\", \"SHLP\", \"VIEW\", \"XSLT\", \"SHMA\", \"SICF\", \"NROB\", \"TYPE\", \"DTEL\", \"DOMA\", \"TTYP\", \"MSAG\", \"FUGR\"],\r\n },\r\n /*\r\n \"exit_or_check\": {\r\n \"allowCheck\": true,\r\n \"allowExit\": false,\r\n },\r\n */\r\n \"unknown_types\": true,\r\n \"ambiguous_statement\": true,\r\n \"implement_methods\": true,\r\n \"begin_end_names\": true,\r\n // \"no_chained_assignment\": true,\r\n \"check_syntax\": true,\r\n \"form_no_dash\": true,\r\n \"omit_preceding_zeros\": true,\r\n \"obsolete_statement\": {\r\n \"compute\": true,\r\n \"setExtended\": true,\r\n \"occurs\": true,\r\n },\r\n \"forbidden_identifier\": {\r\n \"check\": [\r\n \"^abstract$\", \"^arguments$\", \"^await$\",\r\n \"^break$\", \"^byte$\", \"^catch$\",\r\n \"^char$\", \"^class$\", \"^const$\", \"^continue$\",\r\n \"^debugger$\", \"^default$\", \"^do$\",\r\n \"^double$\", \"^else$\", \"^enum$\", \"^eval$\",\r\n \"^export$\", \"^extends$\", \"^false$\", \"^final$\",\r\n \"^finally$\", \"^for$\", \"^function$\",\r\n \"^goto$\", \"^if$\", \"^implements$\", \"^import$\",\r\n \"^in$\", \"^instanceof$\", \"^interface$\",\r\n \"^let$\", \"^long$\", \"^native$\", \"^new$\",\r\n \"^null$\", \"^package$\", \"^private$\",\r\n // \"^protected$\",\r\n \"^public$\", \"^return$\", \"^short$\", \"^static$\",\r\n \"^switch$\", \"^synchronized$\", \"^this$\",\r\n \"^throw$\", \"^throws$\", \"^transient$\", \"^true$\",\r\n \"^try$\", \"^typeof$\", \"^var$\", \"^void$\",\r\n \"^volatile$\", \"^while$\", \"^yield$\",\r\n \"^unique\\\\d+$\", \"^constant_\\\\d+$\"\r\n ],\r\n },\r\n },\r\n};\r\n// todo, make sure nothing is overloaded, eg \"lines()\", there is a rule for this in abaplint now\r\nclass Validation {\r\n constructor(options) {\r\n this.options = options;\r\n }\r\n run(reg) {\r\n var _a, _b;\r\n if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.ignoreSyntaxCheck) === true) {\r\n exports.config.rules.check_syntax = false;\r\n }\r\n else {\r\n exports.config.rules.check_syntax = true;\r\n }\r\n if (((_b = this.options) === null || _b === void 0 ? void 0 : _b.unknownTypes) === \"runtimeError\") {\r\n exports.config.syntax.errorNamespace = \"VOID_EVERYTHING\"; // this is not a constant, just a regex that happens to not match anything\r\n // config.rules[\"unknown_types\"] = false;\r\n }\r\n const conf = new core_1.Config(JSON.stringify(exports.config));\r\n reg.setConfig(conf);\r\n const issues = reg.findIssues();\r\n return issues;\r\n }\r\n}\r\nexports.Validation = Validation;\r\n//# sourceMappingURL=validation.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/validation.js?");
15397
+ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Validation = exports.config = void 0;\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nexports.config = {\r\n \"global\": {\r\n \"files\": \"/**/*.*\",\r\n \"skipGeneratedGatewayClasses\": true,\r\n \"skipGeneratedPersistentClasses\": true,\r\n \"skipGeneratedFunctionGroups\": true,\r\n },\r\n \"syntax\": {\r\n \"version\": core_1.Version.OpenABAP,\r\n \"errorNamespace\": \".\",\r\n },\r\n \"rules\": {\r\n \"when_others_last\": true,\r\n \"avoid_use\": {\r\n \"execSQL\": true,\r\n \"kernelCall\": true,\r\n \"communication\": true,\r\n \"systemCall\": true,\r\n \"break\": true,\r\n \"statics\": true,\r\n \"endselect\": false,\r\n \"defaultKey\": false,\r\n },\r\n \"parser_error\": true,\r\n \"allowed_object_types\": {\r\n \"allowed\": [\"INTF\", \"CLAS\", \"PROG\", \"DEVC\", \"TABL\", \"SHLP\", \"VIEW\", \"XSLT\", \"ENQU\", \"SHMA\", \"SICF\", \"NROB\", \"TYPE\", \"DTEL\", \"DOMA\", \"TTYP\", \"MSAG\", \"FUGR\"],\r\n },\r\n \"unknown_types\": true,\r\n \"ambiguous_statement\": true,\r\n \"implement_methods\": true,\r\n \"begin_end_names\": true,\r\n \"check_syntax\": true,\r\n \"form_no_dash\": true,\r\n \"omit_preceding_zeros\": true,\r\n \"obsolete_statement\": {\r\n \"compute\": true,\r\n \"setExtended\": true,\r\n \"occurs\": true,\r\n },\r\n \"forbidden_identifier\": {\r\n \"check\": [\r\n \"^abstract$\", \"^arguments$\", \"^await$\",\r\n \"^break$\", \"^byte$\", \"^catch$\",\r\n \"^char$\", \"^class$\", \"^const$\", \"^continue$\",\r\n \"^debugger$\", \"^default$\", \"^do$\",\r\n \"^double$\", \"^else$\", \"^enum$\", \"^eval$\",\r\n \"^export$\", \"^extends$\", \"^false$\", \"^final$\",\r\n \"^finally$\", \"^for$\", \"^function$\",\r\n \"^goto$\", \"^if$\", \"^implements$\", \"^import$\",\r\n \"^in$\", \"^instanceof$\", \"^interface$\",\r\n \"^let$\", \"^long$\", \"^native$\", \"^new$\",\r\n \"^null$\", \"^package$\", \"^private$\",\r\n // \"^protected$\",\r\n \"^public$\", \"^return$\", \"^short$\", \"^static$\",\r\n \"^switch$\", \"^synchronized$\", \"^this$\",\r\n \"^throw$\", \"^throws$\", \"^transient$\", \"^true$\",\r\n \"^try$\", \"^typeof$\", \"^var$\", \"^void$\",\r\n \"^volatile$\", \"^while$\", \"^yield$\",\r\n \"^unique\\\\d+$\", \"^constant_\\\\d+$\"\r\n ],\r\n },\r\n },\r\n};\r\n// todo, make sure nothing is overloaded, eg \"lines()\", there is a rule for this in abaplint now\r\nclass Validation {\r\n constructor(options) {\r\n this.options = options;\r\n }\r\n run(reg) {\r\n var _a, _b;\r\n if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.ignoreSyntaxCheck) === true) {\r\n exports.config.rules.check_syntax = false;\r\n }\r\n else {\r\n exports.config.rules.check_syntax = true;\r\n }\r\n if (((_b = this.options) === null || _b === void 0 ? void 0 : _b.unknownTypes) === \"runtimeError\") {\r\n exports.config.syntax.errorNamespace = \"VOID_EVERYTHING\"; // this is not a constant, just a regex that happens to not match anything\r\n // config.rules[\"unknown_types\"] = false;\r\n }\r\n const conf = new core_1.Config(JSON.stringify(exports.config));\r\n reg.setConfig(conf);\r\n const issues = reg.findIssues();\r\n return issues;\r\n }\r\n}\r\nexports.Validation = Validation;\r\n//# sourceMappingURL=validation.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/validation.js?");
15387
15398
 
15388
15399
  /***/ }),
15389
15400
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.2.19",
3
+ "version": "2.3.1",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,7 +25,7 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.2.19",
28
+ "@abaplint/transpiler": "^2.3.1",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",