@abaplint/transpiler-cli 1.7.22 → 1.7.26
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 +28 -6
- package/package.json +3 -3
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 console.log(\"Clone: \" + l.url);\r\n const 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 let count = 0;\r\n for (let filename of glob.sync(dir + \"/src/**\", { nosort: true, nodir: true })) {\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 file_operations_1.FileOperations.deleteFolderRecursive(dir);\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
|
|
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 console.log(\"Clone: \" + l.url);\r\n const 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 let count = 0;\r\n for (let filename of glob.sync(dir + \"/src/**\", { nosort: true, nodir: true })) {\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 file_operations_1.FileOperations.deleteFolderRecursive(dir);\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 fs.writeFileSync(outputFolder + path.sep + \"index.mjs\", output.unitTestScript);\r\n }\r\n fs.writeFileSync(outputFolder + path.sep + \"init.mjs\", output.initializationScript);\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
|
|
|
@@ -13073,7 +13073,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13073
13073
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13074
13074
|
|
|
13075
13075
|
"use strict";
|
|
13076
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MethodSourceTranspiler = void 0;\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass MethodSourceTranspiler {\r\n transpile(node, traversal) {\r\n const ret = new chunk_1.Chunk();\r\n const children = node.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n const nextChild = children[i + 1];\r\n if (child.get() instanceof core_1.Expressions.ClassName) {\r\n ret.appendString(traversal.lookupClassOrInterface(child.concatTokens(), child.getFirstToken()));\r\n }\r\n else if (child.get() instanceof core_1.Expressions.Dynamic && nextChild.concatTokens() === \"=>\") {\r\n const second = child.getChildren()[1];\r\n if (second.get() instanceof core_1.Expressions.FieldChain) {\r\n ret.appendChunk(traversal.traverse(second));\r\n }\r\n else if (second.get() instanceof core_1.Expressions.Constant) {\r\n const lookup = traversal.lookupClassOrInterface(second.getFirstToken().getStr(), child.getFirstToken(), true);\r\n const lookupException = traversal.lookupClassOrInterface(\"'CX_SY_DYN_CALL_ILLEGAL_CLASS'\", child.getFirstToken(), true);\r\n // eslint-disable-next-line max-len\r\n ret.appendString(`if (${lookup} === undefined && ${lookupException} === undefined) { throw \"CX_SY_DYN_CALL_ILLEGAL_CLASS not found\"; }\\n`);\r\n ret.appendString(`if (${lookup} === undefined) { throw new ${lookupException}(); }\\n`);\r\n ret.appendString(lookup);\r\n }\r\n else {\r\n ret.appendString(\"MethodSourceTranspiler-Unexpected\");\r\n }\r\n }\r\n else if (child.get() instanceof core_1.Expressions.MethodName) {\r\n const methodName = child.concatTokens().toLowerCase().replace(\"~\", \"$\");\r\n ret.append(methodName, child.getFirstToken().getStart(), traversal);\r\n }\r\n else if (child.concatTokens() === \"=>\") {\r\n ret.append(\".\", child.getFirstToken().getStart(), traversal);\r\n }\r\n else if (child.concatTokens() === \"->\") {\r\n if (ret.getCode() === \"super\") {\r\n ret.append(\".\", child, traversal);\r\n }\r\n else {\r\n ret.append(\".get().\", child, traversal);\r\n }\r\n }\r\n else if (child.get() instanceof core_1.Expressions.FieldChain) {\r\n ret.appendChunk(traversal.traverse(child));\r\n }\r\n else {\r\n ret.appendString(\"MethodSourceTranspiler-\" + child.get().constructor.name + \"-todo\");\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.MethodSourceTranspiler = MethodSourceTranspiler;\r\n//# sourceMappingURL=method_source.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/expressions/method_source.js?");
|
|
13076
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MethodSourceTranspiler = void 0;\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass MethodSourceTranspiler {\r\n transpile(node, traversal) {\r\n const ret = new chunk_1.Chunk();\r\n const children = node.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n const nextChild = children[i + 1];\r\n if (child.get() instanceof core_1.Expressions.ClassName) {\r\n ret.appendString(traversal.lookupClassOrInterface(child.concatTokens(), child.getFirstToken()));\r\n }\r\n else if (child.get() instanceof core_1.Expressions.Dynamic && (nextChild === null || nextChild === void 0 ? void 0 : nextChild.concatTokens()) === \"=>\") {\r\n const second = child.getChildren()[1];\r\n if (second.get() instanceof core_1.Expressions.FieldChain) {\r\n ret.appendChunk(traversal.traverse(second));\r\n }\r\n else if (second.get() instanceof core_1.Expressions.Constant) {\r\n const lookup = traversal.lookupClassOrInterface(second.getFirstToken().getStr(), child.getFirstToken(), true);\r\n const lookupException = traversal.lookupClassOrInterface(\"'CX_SY_DYN_CALL_ILLEGAL_CLASS'\", child.getFirstToken(), true);\r\n // eslint-disable-next-line max-len\r\n ret.appendString(`if (${lookup} === undefined && ${lookupException} === undefined) { throw \"CX_SY_DYN_CALL_ILLEGAL_CLASS not found\"; }\\n`);\r\n ret.appendString(`if (${lookup} === undefined) { throw new ${lookupException}(); }\\n`);\r\n ret.appendString(lookup);\r\n }\r\n else {\r\n ret.appendString(\"MethodSourceTranspiler-Unexpected\");\r\n }\r\n }\r\n else if (child.get() instanceof core_1.Expressions.Dynamic) {\r\n const second = child.getChildren()[1];\r\n if (second.get() instanceof core_1.Expressions.FieldChain) {\r\n ret.appendChunk(traversal.traverse(second));\r\n }\r\n else if (second.get() instanceof core_1.Expressions.Constant) {\r\n ret.appendString(second.getFirstToken().getStr().replace(/\\'/g, \"\").toLowerCase().replace(\"~\", \"$\"));\r\n }\r\n else {\r\n ret.appendString(\"MethodSourceTranspiler-Unexpected\");\r\n }\r\n }\r\n else if (child.get() instanceof core_1.Expressions.MethodName) {\r\n const methodName = child.concatTokens().toLowerCase().replace(\"~\", \"$\");\r\n ret.append(methodName, child.getFirstToken().getStart(), traversal);\r\n }\r\n else if (child.concatTokens() === \"=>\") {\r\n ret.append(\".\", child.getFirstToken().getStart(), traversal);\r\n }\r\n else if (child.concatTokens() === \"->\") {\r\n if (ret.getCode() === \"super\") {\r\n ret.append(\".\", child, traversal);\r\n }\r\n else {\r\n ret.append(\".get().\", child, traversal);\r\n }\r\n }\r\n else if (child.get() instanceof core_1.Expressions.FieldChain) {\r\n ret.appendChunk(traversal.traverse(child));\r\n }\r\n else {\r\n ret.appendString(\"MethodSourceTranspiler-\" + child.get().constructor.name + \"-todo\");\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.MethodSourceTranspiler = MethodSourceTranspiler;\r\n//# sourceMappingURL=method_source.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/expressions/method_source.js?");
|
|
13077
13077
|
|
|
13078
13078
|
/***/ }),
|
|
13079
13079
|
|
|
@@ -13253,6 +13253,17 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13253
13253
|
|
|
13254
13254
|
/***/ }),
|
|
13255
13255
|
|
|
13256
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/handle_data_element.js":
|
|
13257
|
+
/*!****************************************************************************!*\
|
|
13258
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/handle_data_element.js ***!
|
|
13259
|
+
\****************************************************************************/
|
|
13260
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13261
|
+
|
|
13262
|
+
"use strict";
|
|
13263
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.HandleDataElement = void 0;\r\nconst chunk_1 = __webpack_require__(/*! ./chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nconst transpile_types_1 = __webpack_require__(/*! ./transpile_types */ \"./node_modules/@abaplint/transpiler/build/src/transpile_types.js\");\r\nclass HandleDataElement {\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 type = obj.parseType(reg);\r\n const chunk = new chunk_1.Chunk().appendString(`abap.DDIC[\"${obj.getName().toUpperCase()}\"] = {\r\n \"type\": ${new transpile_types_1.TranspileTypes().toType(type)},\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.HandleDataElement = HandleDataElement;\r\n//# sourceMappingURL=handle_data_element.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/handle_data_element.js?");
|
|
13264
|
+
|
|
13265
|
+
/***/ }),
|
|
13266
|
+
|
|
13256
13267
|
/***/ "./node_modules/@abaplint/transpiler/build/src/handle_table.js":
|
|
13257
13268
|
/*!*********************************************************************!*\
|
|
13258
13269
|
!*** ./node_modules/@abaplint/transpiler/build/src/handle_table.js ***!
|
|
@@ -13264,6 +13275,17 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13264
13275
|
|
|
13265
13276
|
/***/ }),
|
|
13266
13277
|
|
|
13278
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/handle_table_type.js":
|
|
13279
|
+
/*!**************************************************************************!*\
|
|
13280
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/handle_table_type.js ***!
|
|
13281
|
+
\**************************************************************************/
|
|
13282
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13283
|
+
|
|
13284
|
+
"use strict";
|
|
13285
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.HandleTableType = void 0;\r\nconst chunk_1 = __webpack_require__(/*! ./chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nconst transpile_types_1 = __webpack_require__(/*! ./transpile_types */ \"./node_modules/@abaplint/transpiler/build/src/transpile_types.js\");\r\nclass HandleTableType {\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 type = obj.parseType(reg);\r\n const chunk = new chunk_1.Chunk().appendString(`abap.DDIC[\"${obj.getName().toUpperCase()}\"] = {\r\n \"type\": ${new transpile_types_1.TranspileTypes().toType(type)},\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.HandleTableType = HandleTableType;\r\n//# sourceMappingURL=handle_table_type.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/handle_table_type.js?");
|
|
13286
|
+
|
|
13287
|
+
/***/ }),
|
|
13288
|
+
|
|
13267
13289
|
/***/ "./node_modules/@abaplint/transpiler/build/src/index.js":
|
|
13268
13290
|
/*!**************************************************************!*\
|
|
13269
13291
|
!*** ./node_modules/@abaplint/transpiler/build/src/index.js ***!
|
|
@@ -13271,7 +13293,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13271
13293
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13272
13294
|
|
|
13273
13295
|
"use strict";
|
|
13274
|
-
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 database_setup_1 = __webpack_require__(/*! ./database_setup */ \"./node_modules/@abaplint/transpiler/build/src/database_setup.js\");\r\nconst handle_table_1 = __webpack_require__(/*! ./handle_table */ \"./node_modules/@abaplint/transpiler/build/src/handle_table.js\");\r\nconst handle_abap_1 = __webpack_require__(/*! ./handle_abap */ \"./node_modules/@abaplint/transpiler/build/src/handle_abap.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;\r\n reg.parse();\r\n new keywords_1.Keywords().handle(reg);\r\n this.validate(reg);\r\n const dbSetup = new database_setup_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 initializationScript: new unit_test_1.UnitTest().initializationScript(reg, dbSetup),\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 }\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?");
|
|
13296
|
+
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 database_setup_1 = __webpack_require__(/*! ./database_setup */ \"./node_modules/@abaplint/transpiler/build/src/database_setup.js\");\r\nconst handle_table_1 = __webpack_require__(/*! ./handle_table */ \"./node_modules/@abaplint/transpiler/build/src/handle_table.js\");\r\nconst handle_abap_1 = __webpack_require__(/*! ./handle_abap */ \"./node_modules/@abaplint/transpiler/build/src/handle_abap.js\");\r\nconst handle_data_element_1 = __webpack_require__(/*! ./handle_data_element */ \"./node_modules/@abaplint/transpiler/build/src/handle_data_element.js\");\r\nconst handle_table_type_1 = __webpack_require__(/*! ./handle_table_type */ \"./node_modules/@abaplint/transpiler/build/src/handle_table_type.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;\r\n reg.parse();\r\n new keywords_1.Keywords().handle(reg);\r\n this.validate(reg);\r\n const dbSetup = new database_setup_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 initializationScript: new unit_test_1.UnitTest().initializationScript(reg, dbSetup),\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.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?");
|
|
13275
13297
|
|
|
13276
13298
|
/***/ }),
|
|
13277
13299
|
|
|
@@ -13557,7 +13579,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13557
13579
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13558
13580
|
|
|
13559
13581
|
"use strict";
|
|
13560
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CreateDataTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/transpiler/build/src/expressions/index.js\");\r\nclass CreateDataTranspiler {\r\n transpile(node, traversal) {\r\n var _a, _b;\r\n const targetNode = node.findDirectExpression(abaplint.Expressions.Target);\r\n const target = traversal.traverse(targetNode);\r\n const options = [];\r\n let dynamic = (_a = node.findDirectExpression(abaplint.Expressions.Dynamic)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(abaplint.Expressions.ConstantString);\r\n if (dynamic) {\r\n options.push(`\"name\": ` + dynamic.getFirstToken().getStr());\r\n }\r\n else {\r\n dynamic = (_b = node.findDirectExpression(abaplint.Expressions.Dynamic)) === null || _b === void 0 ? void 0 : _b.findFirstExpression(abaplint.Expressions.FieldChain);\r\n if (dynamic) {\r\n options.push(`\"name\": ` + new expressions_1.FieldChainTranspiler(true).transpile(dynamic, traversal).getCode());\r\n }\r\n }\r\n if (node.findDirectTokenByText(\"TABLE\")) {\r\n options.push(`\"table\": true`);\r\n }\r\n let add = \"\";\r\n if (options.length > 0) {\r\n add = \",{\" + options.join(\",\") + \"}\";\r\n }\r\n return new chunk_1.Chunk(\"abap.statements.createData(\" + target.getCode() + add + \");\");\r\n }\r\n}\r\nexports.CreateDataTranspiler = CreateDataTranspiler;\r\n//# sourceMappingURL=create_data.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/statements/create_data.js?");
|
|
13582
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CreateDataTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/transpiler/build/src/expressions/index.js\");\r\nconst transpile_types_1 = __webpack_require__(/*! ../transpile_types */ \"./node_modules/@abaplint/transpiler/build/src/transpile_types.js\");\r\nclass CreateDataTranspiler {\r\n transpile(node, traversal) {\r\n var _a, _b, _c;\r\n const targetNode = node.findDirectExpression(abaplint.Expressions.Target);\r\n const target = traversal.traverse(targetNode);\r\n const options = [];\r\n let dynamic = (_a = node.findDirectExpression(abaplint.Expressions.Dynamic)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(abaplint.Expressions.ConstantString);\r\n if (dynamic) {\r\n options.push(`\"name\": ` + dynamic.getFirstToken().getStr());\r\n }\r\n else {\r\n dynamic = (_b = node.findDirectExpression(abaplint.Expressions.Dynamic)) === null || _b === void 0 ? void 0 : _b.findFirstExpression(abaplint.Expressions.FieldChain);\r\n if (dynamic) {\r\n options.push(`\"name\": ` + new expressions_1.FieldChainTranspiler(true).transpile(dynamic, traversal).getCode());\r\n }\r\n }\r\n const typeNameNode = node.findDirectExpression(abaplint.Expressions.TypeName);\r\n if (typeNameNode) {\r\n const id = (_c = traversal.findCurrentScopeByToken(typeNameNode.getFirstToken())) === null || _c === void 0 ? void 0 : _c.findType(typeNameNode.concatTokens());\r\n if (id) {\r\n options.push(`\"type\": ` + new transpile_types_1.TranspileTypes().toType(id.getType()));\r\n }\r\n }\r\n if (node.findDirectTokenByText(\"TABLE\")) {\r\n options.push(`\"table\": true`);\r\n }\r\n let add = \"\";\r\n if (options.length > 0) {\r\n add = \",{\" + options.join(\",\") + \"}\";\r\n }\r\n return new chunk_1.Chunk(\"abap.statements.createData(\" + target.getCode() + add + \");\");\r\n }\r\n}\r\nexports.CreateDataTranspiler = CreateDataTranspiler;\r\n//# sourceMappingURL=create_data.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/statements/create_data.js?");
|
|
13561
13583
|
|
|
13562
13584
|
/***/ }),
|
|
13563
13585
|
|
|
@@ -14503,7 +14525,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
14503
14525
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
14504
14526
|
|
|
14505
14527
|
"use strict";
|
|
14506
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TranspileTypes = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass TranspileTypes {\r\n declare(t) {\r\n const type = t.getType();\r\n return \"let \" + t.getName().toLowerCase() + \" = \" + this.toType(type) + \";\";\r\n }\r\n toType(type) {\r\n let resolved = \"\";\r\n let extra = \"\";\r\n if (type instanceof abaplint.BasicTypes.ObjectReferenceType\r\n || type instanceof abaplint.BasicTypes.GenericObjectReferenceType) {\r\n resolved = \"ABAPObject\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.TableType) {\r\n resolved = \"Table\";\r\n extra = this.toType(type.getRowType());\r\n extra += \", \" + JSON.stringify(type.getOptions());\r\n }\r\n else if (type instanceof abaplint.BasicTypes.IntegerType) {\r\n resolved = \"Integer\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.StringType) {\r\n resolved = \"String\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.DateType) {\r\n resolved = \"Date\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.TimeType) {\r\n resolved = \"Time\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.DataReference) {\r\n resolved = \"DataReference\";\r\n extra = this.toType(type.getType());\r\n }\r\n else if (type instanceof abaplint.BasicTypes.StructureType) {\r\n resolved = \"Structure\";\r\n const list = [];\r\n for (const c of type.getComponents()) {\r\n list.push(c.name.toLowerCase() + \": \" + this.toType(c.type));\r\n }\r\n extra = \"{\" + list.join(\", \") + \"}\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.CLikeType\r\n || type instanceof abaplint.BasicTypes.CSequenceType) {\r\n // if not supplied its a Character(1)\r\n resolved = \"Character\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.AnyType) {\r\n // if not supplied its a Character(4)\r\n resolved = \"Character\";\r\n extra = \"{length: 4}\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.SimpleType) {\r\n // if not supplied its a Character(1)\r\n resolved = \"Character\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.CharacterType) {\r\n resolved = \"Character\";\r\n if (type.getLength() !== 1) {\r\n extra = \"{length: \" + type.getLength() + \", qualifiedName: \\\"\" + type.getQualifiedName() + \"\\\"}\";\r\n }\r\n else if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + type.getQualifiedName() + \"\\\"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.NumericType) {\r\n resolved = \"Numc\";\r\n if (type.getLength() !== 1) {\r\n extra = \"{length: \" + type.getLength() + \"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.PackedType) {\r\n resolved = \"Packed\";\r\n extra = \"{length: \" + type.getLength() + \", decimals: \" + type.getDecimals() + \"}\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.NumericGenericType) {\r\n resolved = \"Packed\";\r\n extra = \"{length: 8, decimals: 0}\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.XStringType) {\r\n resolved = \"XString\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.XSequenceType) {\r\n // if not supplied itsa a Hex(1)\r\n resolved = \"Hex\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.HexType) {\r\n resolved = \"Hex\";\r\n if (type.getLength() !== 1) {\r\n extra = \"{length: \" + type.getLength() + \"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.FloatType) {\r\n resolved = \"Float\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.DecFloat34Type) {\r\n resolved = \"DecFloat34\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.UnknownType) {\r\n return `(() => { throw \"Unknown type: ${type.getError()}\" })()`;\r\n }\r\n else if (type instanceof abaplint.BasicTypes.VoidType) {\r\n return `(() => { throw \"Void type: ${type.getVoided()}\" })()`;\r\n }\r\n else {\r\n resolved = \"typeTodo\" + type.constructor.name;\r\n }\r\n return \"new abap.types.\" + resolved + \"(\" + extra + \")\";\r\n }\r\n}\r\nexports.TranspileTypes = TranspileTypes;\r\n//# sourceMappingURL=transpile_types.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/transpile_types.js?");
|
|
14528
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TranspileTypes = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass TranspileTypes {\r\n declare(t) {\r\n const type = t.getType();\r\n return \"let \" + t.getName().toLowerCase() + \" = \" + this.toType(type) + \";\";\r\n }\r\n toType(type) {\r\n let resolved = \"\";\r\n let extra = \"\";\r\n if (type instanceof abaplint.BasicTypes.ObjectReferenceType\r\n || type instanceof abaplint.BasicTypes.GenericObjectReferenceType) {\r\n resolved = \"ABAPObject\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.TableType) {\r\n resolved = \"Table\";\r\n extra = this.toType(type.getRowType());\r\n extra += \", \" + JSON.stringify(type.getOptions());\r\n }\r\n else if (type instanceof abaplint.BasicTypes.IntegerType) {\r\n resolved = \"Integer\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.StringType) {\r\n resolved = \"String\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.DateType) {\r\n resolved = \"Date\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.TimeType) {\r\n resolved = \"Time\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.DataReference) {\r\n resolved = \"DataReference\";\r\n extra = this.toType(type.getType());\r\n }\r\n else if (type instanceof abaplint.BasicTypes.StructureType) {\r\n resolved = \"Structure\";\r\n const list = [];\r\n for (const c of type.getComponents()) {\r\n list.push(c.name.toLowerCase() + \": \" + this.toType(c.type));\r\n }\r\n extra = \"{\" + list.join(\", \") + \"}\";\r\n if (type.getQualifiedName() !== undefined) {\r\n extra += \", \\\"\" + type.getQualifiedName() + \"\\\"\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.CLikeType\r\n || type instanceof abaplint.BasicTypes.CSequenceType) {\r\n // if not supplied its a Character(1)\r\n resolved = \"Character\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.AnyType) {\r\n // if not supplied its a Character(4)\r\n resolved = \"Character\";\r\n extra = \"{length: 4}\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.SimpleType) {\r\n // if not supplied its a Character(1)\r\n resolved = \"Character\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.CharacterType) {\r\n resolved = \"Character\";\r\n if (type.getLength() !== 1) {\r\n extra = \"{length: \" + type.getLength() + \", qualifiedName: \\\"\" + type.getQualifiedName() + \"\\\"}\";\r\n }\r\n else if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + type.getQualifiedName() + \"\\\"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.NumericType) {\r\n resolved = \"Numc\";\r\n if (type.getLength() !== 1) {\r\n extra = \"{length: \" + type.getLength() + \"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.PackedType) {\r\n resolved = \"Packed\";\r\n extra = \"{length: \" + type.getLength() + \", decimals: \" + type.getDecimals() + \"}\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.NumericGenericType) {\r\n resolved = \"Packed\";\r\n extra = \"{length: 8, decimals: 0}\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.XStringType) {\r\n resolved = \"XString\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.XSequenceType) {\r\n // if not supplied itsa a Hex(1)\r\n resolved = \"Hex\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.HexType) {\r\n resolved = \"Hex\";\r\n if (type.getLength() !== 1) {\r\n extra = \"{length: \" + type.getLength() + \"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.FloatType) {\r\n resolved = \"Float\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.DecFloat34Type) {\r\n resolved = \"DecFloat34\";\r\n }\r\n else if (type instanceof abaplint.BasicTypes.UnknownType) {\r\n return `(() => { throw \"Unknown type: ${type.getError()}\" })()`;\r\n }\r\n else if (type instanceof abaplint.BasicTypes.VoidType) {\r\n return `(() => { throw \"Void type: ${type.getVoided()}\" })()`;\r\n }\r\n else {\r\n resolved = \"typeTodo\" + type.constructor.name;\r\n }\r\n return \"new abap.types.\" + resolved + \"(\" + extra + \")\";\r\n }\r\n}\r\nexports.TranspileTypes = TranspileTypes;\r\n//# sourceMappingURL=transpile_types.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/transpile_types.js?");
|
|
14507
14529
|
|
|
14508
14530
|
/***/ }),
|
|
14509
14531
|
|
|
@@ -14536,7 +14558,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
14536
14558
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
14537
14559
|
|
|
14538
14560
|
"use strict";
|
|
14539
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnitTest = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass UnitTest {\r\n // todo, move this somewhere else, its much more than just unit test relevant\r\n initializationScript(reg, dbSetup) {\r\n let ret = `import runtime from \"@abaplint/runtime\";\r\nglobal.abap = new runtime.ABAP();\r\n${this.buildImports(reg)}\r\nexport async function initializeABAP(settings) {\\n`;\r\n if (dbSetup === \"\") {\r\n ret += `// no database artifacts, skip DB initialization\\n`;\r\n }\r\n else {\r\n ret += ` await global.abap.initDB(\\`${dbSetup}\\`);\\n`;\r\n }\r\n ret += `}`;\r\n return ret;\r\n }\r\n unitTestScript(reg, skip, _only) {\r\n let ret = `import fs from \"fs\";\r\nimport path from \"path\";\r\nimport {dirname} from 'path';\r\nimport {fileURLToPath} from 'url';\r\nconst __dirname = dirname(fileURLToPath(import.meta.url));\r\nimport {initializeABAP} from \"./init.mjs\";\r\nimport runtime from \"@abaplint/runtime\";\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\ntry {\\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\r\n || def.isGlobal === true // todo, fix, there might be global test methods\r\n || def.methods.length === 0) {\r\n continue;\r\n }\r\n ret += `{\r\nconst {${def.name}} = await import(\"./${obj.getName().toLowerCase()}.${obj.getType().toLowerCase()}.testclasses.mjs\");\r\nlocl = clas.addTestClass(\"${def.name}\");\\n`;\r\n ret += `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\nconsole.log(abap.console.get());\r\nfs.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) {\r\n // note: ES modules are hoised, so use the dynamic import()\r\n // todo, some sorting might be required? eg. a class constructor using constant from interface?\r\n // temporary sorting: by filename\r\n const list = [];\r\n for (const obj of reg.getObjects()) {\r\n if (obj instanceof abaplint.Objects.Table) {\r\n list.push(`await import(\"./${obj.getName().toLowerCase()}.tabl.mjs\");`);\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(`await import(\"./${obj.getName().toLowerCase()}.fugr.${m.getName().toLowerCase()}.mjs\");`);\r\n }\r\n }\r\n else if (obj instanceof abaplint.Objects.Class) {\r\n list.push(`await import(\"./${obj.getName().toLowerCase()}.clas.mjs\");`);\r\n }\r\n else if (obj instanceof abaplint.Objects.Interface) {\r\n list.push(`await import(\"./${obj.getName().toLowerCase()}.intf.mjs\");`);\r\n }\r\n }\r\n list.sort();\r\n return list.join(\"\\n\") + \"\\n\";\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?");
|
|
14561
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnitTest = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass UnitTest {\r\n // todo, move this somewhere else, its much more than just unit test relevant\r\n initializationScript(reg, dbSetup) {\r\n let ret = `import runtime from \"@abaplint/runtime\";\r\nglobal.abap = new runtime.ABAP();\r\n${this.buildImports(reg)}\r\nexport async function initializeABAP(settings) {\\n`;\r\n if (dbSetup === \"\") {\r\n ret += `// no database artifacts, skip DB initialization\\n`;\r\n }\r\n else {\r\n ret += ` await global.abap.initDB(\\`${dbSetup}\\`);\\n`;\r\n }\r\n ret += `}`;\r\n return ret;\r\n }\r\n unitTestScript(reg, skip, _only) {\r\n let ret = `import fs from \"fs\";\r\nimport path from \"path\";\r\nimport {dirname} from 'path';\r\nimport {fileURLToPath} from 'url';\r\nconst __dirname = dirname(fileURLToPath(import.meta.url));\r\nimport {initializeABAP} from \"./init.mjs\";\r\nimport runtime from \"@abaplint/runtime\";\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\ntry {\\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\r\n || def.isGlobal === true // todo, fix, there might be global test methods\r\n || def.methods.length === 0) {\r\n continue;\r\n }\r\n ret += `{\r\nconst {${def.name}} = await import(\"./${obj.getName().toLowerCase()}.${obj.getType().toLowerCase()}.testclasses.mjs\");\r\nlocl = clas.addTestClass(\"${def.name}\");\\n`;\r\n ret += `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\nconsole.log(abap.console.get());\r\nfs.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) {\r\n // note: ES modules are hoised, so use the dynamic import()\r\n // todo, some sorting might be required? eg. a class constructor using constant from interface?\r\n // temporary sorting: by filename\r\n const list = [];\r\n for (const obj of reg.getObjects()) {\r\n if (obj instanceof abaplint.Objects.Table) {\r\n list.push(`await import(\"./${obj.getName().toLowerCase()}.tabl.mjs\");`);\r\n }\r\n else if (obj instanceof abaplint.Objects.DataElement) {\r\n list.push(`await import(\"./${obj.getName().toLowerCase()}.dtel.mjs\");`);\r\n }\r\n else if (obj instanceof abaplint.Objects.TableType) {\r\n list.push(`await import(\"./${obj.getName().toLowerCase()}.ttyp.mjs\");`);\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(`await import(\"./${obj.getName().toLowerCase()}.fugr.${m.getName().toLowerCase()}.mjs\");`);\r\n }\r\n }\r\n else if (obj instanceof abaplint.Objects.Class) {\r\n list.push(`await import(\"./${obj.getName().toLowerCase()}.clas.mjs\");`);\r\n }\r\n else if (obj instanceof abaplint.Objects.Interface) {\r\n list.push(`await import(\"./${obj.getName().toLowerCase()}.intf.mjs\");`);\r\n }\r\n }\r\n list.sort();\r\n return list.join(\"\\n\") + \"\\n\";\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?");
|
|
14540
14562
|
|
|
14541
14563
|
/***/ }),
|
|
14542
14564
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.26",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abap_transpile": "./abap_transpile"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"author": "abaplint",
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@abaplint/transpiler": "^1.7.
|
|
26
|
+
"@abaplint/transpiler": "^1.7.26",
|
|
27
27
|
"@types/glob": "^7.2.0",
|
|
28
28
|
"glob": "^7.2.0",
|
|
29
29
|
"@types/progress": "^2.0.5",
|
|
@@ -31,6 +31,6 @@
|
|
|
31
31
|
"progress": "^2.0.3",
|
|
32
32
|
"webpack": "^5.66.0",
|
|
33
33
|
"webpack-cli": "^4.9.1",
|
|
34
|
-
"typescript": "^4.5.
|
|
34
|
+
"typescript": "^4.5.5"
|
|
35
35
|
}
|
|
36
36
|
}
|