@abaplint/transpiler-cli 2.3.55 → 2.3.57
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 +5 -5
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -8816,7 +8816,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
8816
8816
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8817
8817
|
|
|
8818
8818
|
"use strict";
|
|
8819
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CharacterType = void 0;\r\nconst _abstract_type_1 = __webpack_require__(/*! ./_abstract_type */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/_abstract_type.js\");\r\nclass CharacterType extends _abstract_type_1.AbstractType {\r\n constructor(length, extra) {\r\n super(extra);\r\n if (length <= 0) {\r\n throw new Error(\"Bad LENGTH\");\r\n }\r\n this.length = length;\r\n }\r\n cloneType(qualifiedName) {\r\n const
|
|
8819
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CharacterType = void 0;\r\nconst _abstract_type_1 = __webpack_require__(/*! ./_abstract_type */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/_abstract_type.js\");\r\nclass CharacterType extends _abstract_type_1.AbstractType {\r\n constructor(length, extra) {\r\n super(extra);\r\n if (length <= 0) {\r\n throw new Error(\"Bad LENGTH\");\r\n }\r\n this.length = length;\r\n }\r\n cloneType(qualifiedName) {\r\n const clone = Object.assign({}, this.getAbstractTypeData()) || {};\r\n clone.qualifiedName = qualifiedName;\r\n return new CharacterType(this.length, clone);\r\n }\r\n getLength() {\r\n return this.length;\r\n }\r\n toText() {\r\n return \"```c LENGTH \" + this.getLength() + \"```\";\r\n }\r\n toABAP() {\r\n return \"c LENGTH \" + this.getLength();\r\n }\r\n isGeneric() {\r\n return false;\r\n }\r\n containsVoid() {\r\n return false;\r\n }\r\n getIdentifier() {\r\n return undefined;\r\n }\r\n toCDS() {\r\n return \"abap.char( \" + this.getLength() + \" )\";\r\n }\r\n}\r\nexports.CharacterType = CharacterType;\r\n//# sourceMappingURL=character_type.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/core/build/src/abap/types/basic/character_type.js?");
|
|
8820
8820
|
|
|
8821
8821
|
/***/ }),
|
|
8822
8822
|
|
|
@@ -11533,7 +11533,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11533
11533
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11534
11534
|
|
|
11535
11535
|
"use strict";
|
|
11536
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Registry = void 0;\nconst config_1 = __webpack_require__(/*! ./config */ \"./node_modules/@abaplint/core/build/src/config.js\");\nconst artifacts_objects_1 = __webpack_require__(/*! ./artifacts_objects */ \"./node_modules/@abaplint/core/build/src/artifacts_objects.js\");\nconst find_global_definitions_1 = __webpack_require__(/*! ./abap/5_syntax/global_definitions/find_global_definitions */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/global_definitions/find_global_definitions.js\");\nconst excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ \"./node_modules/@abaplint/core/build/src/utils/excludeHelper.js\");\nconst ddic_references_1 = __webpack_require__(/*! ./ddic_references */ \"./node_modules/@abaplint/core/build/src/ddic_references.js\");\nconst rules_runner_1 = __webpack_require__(/*! ./rules_runner */ \"./node_modules/@abaplint/core/build/src/rules_runner.js\");\n// todo, this should really be an instance in case there are multiple Registry'ies\nclass ParsingPerformance {\n static clear() {\n this.results = [];\n this.lexing = 0;\n this.statements = 0;\n this.structure = 0;\n }\n static push(obj, result) {\n if (result.runtimeExtra) {\n this.lexing += result.runtimeExtra.lexing;\n this.statements += result.runtimeExtra.statements;\n this.structure += result.runtimeExtra.structure;\n }\n if (result.runtime < 100) {\n return;\n }\n if (this.results === undefined) {\n this.results = [];\n }\n let extra = \"\";\n if (result.runtimeExtra) {\n extra = `\\t(lexing: ${result.runtimeExtra.lexing}ms, statements: ${result.runtimeExtra.statements}ms, structure: ${result.runtimeExtra.structure}ms)`;\n }\n this.results.push({\n runtime: result.runtime,\n extra,\n name: obj.getType() + \" \" + obj.getName(),\n });\n }\n static output() {\n const MAX = 10;\n this.results.sort((a, b) => { return b.runtime - a.runtime; });\n for (let i = 0; i < MAX; i++) {\n const row = this.results[i];\n if (row === undefined) {\n break;\n }\n process.stderr.write(`\\t${row.runtime}ms\\t${row.name} ${row.extra}\\n`);\n }\n process.stderr.write(`\\tTotal lexing: ${this.lexing}ms\\n`);\n process.stderr.write(`\\tTotal statements: ${this.statements}ms\\n`);\n process.stderr.write(`\\tTotal structure: ${this.structure}ms\\n`);\n }\n}\n///////////////////////////////////////////////////////////////////////////////////////////////\nclass Registry {\n constructor(conf) {\n this.objects = {};\n this.objectsByType = {};\n this.dependencies = {};\n this.conf = conf ? conf : config_1.Config.getDefault();\n this.references = new ddic_references_1.DDICReferences();\n }\n static abaplintVersion() {\n // magic, see build script \"version.sh\"\n return \"2.93.95\";\n }\n getDDICReferences() {\n return this.references;\n }\n *getObjects() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n yield this.objects[name][type];\n }\n }\n }\n *getObjectsByType(type) {\n for (const name in this.objectsByType[type] || []) {\n yield this.objectsByType[type][name];\n }\n }\n *getFiles() {\n for (const obj of this.getObjects()) {\n for (const file of obj.getFiles()) {\n yield file;\n }\n }\n }\n getFirstObject() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n return this.objects[name][type];\n }\n }\n return undefined;\n }\n getObjectCount(skipDependencies = true) {\n let res = 0;\n for (const o of this.getObjects()) {\n if (skipDependencies === true && this.isDependency(o)) {\n continue;\n }\n res = res + 1;\n }\n return res;\n }\n getFileByName(filename) {\n const upper = filename.toUpperCase();\n for (const o of this.getObjects()) {\n for (const f of o.getFiles()) {\n if (f.getFilename().toUpperCase() === upper) {\n return f;\n }\n }\n }\n return undefined;\n }\n getObject(type, name) {\n if (type === undefined || name === undefined) {\n return undefined;\n }\n const searchName = name.toUpperCase();\n if (this.objects[searchName]) {\n return this.objects[searchName][type];\n }\n return undefined;\n }\n getConfig() {\n return this.conf;\n }\n // assumption: Config is immutable, and can only be changed via this method\n setConfig(conf) {\n for (const obj of this.getObjects()) {\n obj.setDirty();\n }\n this.conf = conf;\n return this;\n }\n inErrorNamespace(name) {\n // todo: performance? cache regexp?\n const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\n return reg.test(name);\n }\n addFile(file) {\n return this.addFiles([file]);\n }\n updateFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.updateFile(file);\n return this;\n }\n removeFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.removeFile(file);\n if (obj.getFiles().length === 0) {\n this.references.clear(obj);\n this.removeObject(obj);\n }\n return this;\n }\n _addFiles(files, dependency) {\n var _a;\n const globalExclude = ((_a = this.conf.getGlobal().exclude) !== null && _a !== void 0 ? _a : [])\n .map(pattern => new RegExp(pattern, \"i\"));\n for (const f of files) {\n const filename = f.getFilename();\n const isNotAbapgitFile = filename.split(\".\").length <= 2;\n if (isNotAbapgitFile || excludeHelper_1.ExcludeHelper.isExcluded(filename, globalExclude)) {\n continue;\n }\n let found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n if (dependency === false && found && this.isDependency(found)) {\n this.removeDependency(found);\n found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n }\n found.addFile(f);\n }\n return this;\n }\n addFiles(files) {\n this._addFiles(files, false);\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.addDependency(f);\n }\n return this;\n }\n addDependency(file) {\n var _a;\n const type = (_a = file.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return this;\n }\n const name = file.getObjectName().toUpperCase();\n if (this.dependencies[type] === undefined) {\n this.dependencies[type] = {};\n }\n this.dependencies[type][name] = true;\n this._addFiles([file], true);\n return this;\n }\n removeDependency(obj) {\n var _a;\n (_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? true : delete _a[obj.getName()];\n this.removeObject(obj);\n }\n isDependency(obj) {\n var _a;\n return ((_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? void 0 : _a[obj.getName()]) === true;\n }\n isFileDependency(filename) {\n var _a, _b;\n const f = this.getFileByName(filename);\n if (f === undefined) {\n return false;\n }\n const type = (_a = f.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return false;\n }\n const name = f.getObjectName().toUpperCase();\n return ((_b = this.dependencies[type]) === null || _b === void 0 ? void 0 : _b[name]) === true;\n }\n // assumption: the file is already in the registry\n findObjectForFile(file) {\n const filename = file.getFilename();\n for (const obj of this.getObjects()) {\n for (const ofile of obj.getFiles()) {\n if (ofile.getFilename() === filename) {\n return obj;\n }\n }\n }\n return undefined;\n }\n // todo, this will be changed to async sometime\n findIssues(input) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return new rules_runner_1.RulesRunner(this).runRules(this.getObjects(), input);\n }\n // todo, this will be changed to async sometime\n findIssuesObject(iobj) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return new rules_runner_1.RulesRunner(this).runRules([iobj]);\n }\n // todo, this will be changed to async sometime\n parse() {\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n for (const o of this.getObjects()) {\n this.parsePrivate(o);\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run();\n return this;\n }\n async parseAsync(input) {\n var _a, _b;\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(this.getObjectCount(false), \"Lexing and parsing\");\n for (const o of this.getObjects()) {\n await ((_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Lexing and parsing(\" + this.conf.getVersion() + \") - \" + o.getType() + \" \" + o.getName()));\n this.parsePrivate(o);\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n ParsingPerformance.output();\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);\n return this;\n }\n //////////////////////////////////////////\n // todo, refactor, this is a mess, see where-used, a lot of the code should be in this method instead\n parsePrivate(input) {\n const config = this.getConfig();\n const result = input.parse(config.getVersion(), config.getSyntaxSetttings().globalMacros, this);\n ParsingPerformance.push(input, result);\n }\n isDirty() {\n for (const o of this.getObjects()) {\n const dirty = o.isDirty();\n if (dirty === true) {\n return true;\n }\n }\n return false;\n }\n findOrCreate(name, type) {\n try {\n return this.find(name, type);\n }\n catch (_a) {\n const newName = name.toUpperCase();\n const newType = type ? type : \"UNKNOWN\";\n const add = artifacts_objects_1.ArtifactsObjects.newObject(newName, newType);\n if (this.objects[newName] === undefined) {\n this.objects[newName] = {};\n }\n this.objects[newName][newType] = add;\n if (this.objectsByType[newType] === undefined) {\n this.objectsByType[newType] = {};\n }\n this.objectsByType[newType][newName] = add;\n return add;\n }\n }\n removeObject(remove) {\n if (remove === undefined) {\n return;\n }\n if (this.objects[remove.getName()][remove.getType()] === undefined) {\n throw new Error(\"removeObject: object not found\");\n }\n if (Object.keys(this.objects[remove.getName()]).length === 1) {\n delete this.objects[remove.getName()];\n }\n else {\n delete this.objects[remove.getName()][remove.getType()];\n }\n if (Object.keys(this.objectsByType[remove.getType()]).length === 1) {\n delete this.objectsByType[remove.getType()];\n }\n else {\n delete this.objectsByType[remove.getType()][remove.getName()];\n }\n }\n find(name, type) {\n const searchType = type ? type : \"UNKNOWN\";\n const searchName = name.toUpperCase();\n if (this.objects[searchName] !== undefined\n && this.objects[searchName][searchType]) {\n return this.objects[searchName][searchType];\n }\n throw new Error(\"find: object not found, \" + type + \" \" + name);\n }\n}\nexports.Registry = Registry;\n//# sourceMappingURL=registry.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/core/build/src/registry.js?");
|
|
11536
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Registry = void 0;\nconst config_1 = __webpack_require__(/*! ./config */ \"./node_modules/@abaplint/core/build/src/config.js\");\nconst artifacts_objects_1 = __webpack_require__(/*! ./artifacts_objects */ \"./node_modules/@abaplint/core/build/src/artifacts_objects.js\");\nconst find_global_definitions_1 = __webpack_require__(/*! ./abap/5_syntax/global_definitions/find_global_definitions */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/global_definitions/find_global_definitions.js\");\nconst excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ \"./node_modules/@abaplint/core/build/src/utils/excludeHelper.js\");\nconst ddic_references_1 = __webpack_require__(/*! ./ddic_references */ \"./node_modules/@abaplint/core/build/src/ddic_references.js\");\nconst rules_runner_1 = __webpack_require__(/*! ./rules_runner */ \"./node_modules/@abaplint/core/build/src/rules_runner.js\");\n// todo, this should really be an instance in case there are multiple Registry'ies\nclass ParsingPerformance {\n static clear() {\n this.results = [];\n this.lexing = 0;\n this.statements = 0;\n this.structure = 0;\n }\n static push(obj, result) {\n if (result.runtimeExtra) {\n this.lexing += result.runtimeExtra.lexing;\n this.statements += result.runtimeExtra.statements;\n this.structure += result.runtimeExtra.structure;\n }\n if (result.runtime < 100) {\n return;\n }\n if (this.results === undefined) {\n this.results = [];\n }\n let extra = \"\";\n if (result.runtimeExtra) {\n extra = `\\t(lexing: ${result.runtimeExtra.lexing}ms, statements: ${result.runtimeExtra.statements}ms, structure: ${result.runtimeExtra.structure}ms)`;\n }\n this.results.push({\n runtime: result.runtime,\n extra,\n name: obj.getType() + \" \" + obj.getName(),\n });\n }\n static output() {\n const MAX = 10;\n this.results.sort((a, b) => { return b.runtime - a.runtime; });\n for (let i = 0; i < MAX; i++) {\n const row = this.results[i];\n if (row === undefined) {\n break;\n }\n process.stderr.write(`\\t${row.runtime}ms\\t${row.name} ${row.extra}\\n`);\n }\n process.stderr.write(`\\tTotal lexing: ${this.lexing}ms\\n`);\n process.stderr.write(`\\tTotal statements: ${this.statements}ms\\n`);\n process.stderr.write(`\\tTotal structure: ${this.structure}ms\\n`);\n }\n}\n///////////////////////////////////////////////////////////////////////////////////////////////\nclass Registry {\n constructor(conf) {\n this.objects = {};\n this.objectsByType = {};\n this.dependencies = {};\n this.conf = conf ? conf : config_1.Config.getDefault();\n this.references = new ddic_references_1.DDICReferences();\n }\n static abaplintVersion() {\n // magic, see build script \"version.sh\"\n return \"2.93.96\";\n }\n getDDICReferences() {\n return this.references;\n }\n *getObjects() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n yield this.objects[name][type];\n }\n }\n }\n *getObjectsByType(type) {\n for (const name in this.objectsByType[type] || []) {\n yield this.objectsByType[type][name];\n }\n }\n *getFiles() {\n for (const obj of this.getObjects()) {\n for (const file of obj.getFiles()) {\n yield file;\n }\n }\n }\n getFirstObject() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n return this.objects[name][type];\n }\n }\n return undefined;\n }\n getObjectCount(skipDependencies = true) {\n let res = 0;\n for (const o of this.getObjects()) {\n if (skipDependencies === true && this.isDependency(o)) {\n continue;\n }\n res = res + 1;\n }\n return res;\n }\n getFileByName(filename) {\n const upper = filename.toUpperCase();\n for (const o of this.getObjects()) {\n for (const f of o.getFiles()) {\n if (f.getFilename().toUpperCase() === upper) {\n return f;\n }\n }\n }\n return undefined;\n }\n getObject(type, name) {\n if (type === undefined || name === undefined) {\n return undefined;\n }\n const searchName = name.toUpperCase();\n if (this.objects[searchName]) {\n return this.objects[searchName][type];\n }\n return undefined;\n }\n getConfig() {\n return this.conf;\n }\n // assumption: Config is immutable, and can only be changed via this method\n setConfig(conf) {\n for (const obj of this.getObjects()) {\n obj.setDirty();\n }\n this.conf = conf;\n return this;\n }\n inErrorNamespace(name) {\n // todo: performance? cache regexp?\n const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\n return reg.test(name);\n }\n addFile(file) {\n return this.addFiles([file]);\n }\n updateFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.updateFile(file);\n return this;\n }\n removeFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.removeFile(file);\n if (obj.getFiles().length === 0) {\n this.references.clear(obj);\n this.removeObject(obj);\n }\n return this;\n }\n _addFiles(files, dependency) {\n var _a;\n const globalExclude = ((_a = this.conf.getGlobal().exclude) !== null && _a !== void 0 ? _a : [])\n .map(pattern => new RegExp(pattern, \"i\"));\n for (const f of files) {\n const filename = f.getFilename();\n const isNotAbapgitFile = filename.split(\".\").length <= 2;\n if (isNotAbapgitFile || excludeHelper_1.ExcludeHelper.isExcluded(filename, globalExclude)) {\n continue;\n }\n let found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n if (dependency === false && found && this.isDependency(found)) {\n this.removeDependency(found);\n found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n }\n found.addFile(f);\n }\n return this;\n }\n addFiles(files) {\n this._addFiles(files, false);\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.addDependency(f);\n }\n return this;\n }\n addDependency(file) {\n var _a;\n const type = (_a = file.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return this;\n }\n const name = file.getObjectName().toUpperCase();\n if (this.dependencies[type] === undefined) {\n this.dependencies[type] = {};\n }\n this.dependencies[type][name] = true;\n this._addFiles([file], true);\n return this;\n }\n removeDependency(obj) {\n var _a;\n (_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? true : delete _a[obj.getName()];\n this.removeObject(obj);\n }\n isDependency(obj) {\n var _a;\n return ((_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? void 0 : _a[obj.getName()]) === true;\n }\n isFileDependency(filename) {\n var _a, _b;\n const f = this.getFileByName(filename);\n if (f === undefined) {\n return false;\n }\n const type = (_a = f.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return false;\n }\n const name = f.getObjectName().toUpperCase();\n return ((_b = this.dependencies[type]) === null || _b === void 0 ? void 0 : _b[name]) === true;\n }\n // assumption: the file is already in the registry\n findObjectForFile(file) {\n const filename = file.getFilename();\n for (const obj of this.getObjects()) {\n for (const ofile of obj.getFiles()) {\n if (ofile.getFilename() === filename) {\n return obj;\n }\n }\n }\n return undefined;\n }\n // todo, this will be changed to async sometime\n findIssues(input) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return new rules_runner_1.RulesRunner(this).runRules(this.getObjects(), input);\n }\n // todo, this will be changed to async sometime\n findIssuesObject(iobj) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return new rules_runner_1.RulesRunner(this).runRules([iobj]);\n }\n // todo, this will be changed to async sometime\n parse() {\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n for (const o of this.getObjects()) {\n this.parsePrivate(o);\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run();\n return this;\n }\n async parseAsync(input) {\n var _a, _b;\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(this.getObjectCount(false), \"Lexing and parsing\");\n for (const o of this.getObjects()) {\n await ((_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Lexing and parsing(\" + this.conf.getVersion() + \") - \" + o.getType() + \" \" + o.getName()));\n this.parsePrivate(o);\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n ParsingPerformance.output();\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);\n return this;\n }\n //////////////////////////////////////////\n // todo, refactor, this is a mess, see where-used, a lot of the code should be in this method instead\n parsePrivate(input) {\n const config = this.getConfig();\n const result = input.parse(config.getVersion(), config.getSyntaxSetttings().globalMacros, this);\n ParsingPerformance.push(input, result);\n }\n isDirty() {\n for (const o of this.getObjects()) {\n const dirty = o.isDirty();\n if (dirty === true) {\n return true;\n }\n }\n return false;\n }\n findOrCreate(name, type) {\n try {\n return this.find(name, type);\n }\n catch (_a) {\n const newName = name.toUpperCase();\n const newType = type ? type : \"UNKNOWN\";\n const add = artifacts_objects_1.ArtifactsObjects.newObject(newName, newType);\n if (this.objects[newName] === undefined) {\n this.objects[newName] = {};\n }\n this.objects[newName][newType] = add;\n if (this.objectsByType[newType] === undefined) {\n this.objectsByType[newType] = {};\n }\n this.objectsByType[newType][newName] = add;\n return add;\n }\n }\n removeObject(remove) {\n if (remove === undefined) {\n return;\n }\n if (this.objects[remove.getName()][remove.getType()] === undefined) {\n throw new Error(\"removeObject: object not found\");\n }\n if (Object.keys(this.objects[remove.getName()]).length === 1) {\n delete this.objects[remove.getName()];\n }\n else {\n delete this.objects[remove.getName()][remove.getType()];\n }\n if (Object.keys(this.objectsByType[remove.getType()]).length === 1) {\n delete this.objectsByType[remove.getType()];\n }\n else {\n delete this.objectsByType[remove.getType()][remove.getName()];\n }\n }\n find(name, type) {\n const searchType = type ? type : \"UNKNOWN\";\n const searchName = name.toUpperCase();\n if (this.objects[searchName] !== undefined\n && this.objects[searchName][searchType]) {\n return this.objects[searchName][searchType];\n }\n throw new Error(\"find: object not found, \" + type + \" \" + name);\n }\n}\nexports.Registry = Registry;\n//# sourceMappingURL=registry.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/core/build/src/registry.js?");
|
|
11537
11537
|
|
|
11538
11538
|
/***/ }),
|
|
11539
11539
|
|
|
@@ -13557,7 +13557,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13557
13557
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13558
13558
|
|
|
13559
13559
|
"use strict";
|
|
13560
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ConstantTranspiler = 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 ConstantTranspiler {\r\n constructor(addGet = false) {\r\n this.addGet = addGet;\r\n }\r\n transpile(node, traversal) {\r\n const int = node.findFirstExpression(core_1.Expressions.Integer);\r\n if (int) {\r\n const concat = int.concatTokens().trim();\r\n let code = `new abap.types.Integer().set(${concat})`;\r\n if (this.addGet === true) {\r\n code += \".get()\";\r\n }\r\n return new chunk_1.Chunk().append(code, node, traversal);\r\n }\r\n let str = node.findDirectExpression(core_1.Expressions.ConstantString);\r\n if (str === undefined) {\r\n str = node.findDirectExpression(core_1.Expressions.TextElementString);\r\n }\r\n if (str) {\r\n let res = str.getFirstToken().getStr();\r\n if (res.startsWith(\"'\") && this.addGet === false) {\r\n const code = \"new abap.types.Character(
|
|
13560
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ConstantTranspiler = 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 ConstantTranspiler {\r\n constructor(addGet = false) {\r\n this.addGet = addGet;\r\n }\r\n transpile(node, traversal) {\r\n const int = node.findFirstExpression(core_1.Expressions.Integer);\r\n if (int) {\r\n const concat = int.concatTokens().trim();\r\n let code = `new abap.types.Integer().set(${concat})`;\r\n if (this.addGet === true) {\r\n code += \".get()\";\r\n }\r\n return new chunk_1.Chunk().append(code, node, traversal);\r\n }\r\n let str = node.findDirectExpression(core_1.Expressions.ConstantString);\r\n if (str === undefined) {\r\n str = node.findDirectExpression(core_1.Expressions.TextElementString);\r\n }\r\n if (str) {\r\n let res = str.getFirstToken().getStr();\r\n if (res.startsWith(\"'\") && this.addGet === false) {\r\n const code = \"new abap.types.Character(\" + (res.length - 2) + \").set(\" + this.escape(res) + \")\";\r\n return new chunk_1.Chunk().append(code, node, traversal);\r\n }\r\n else if (res.startsWith(\"`\") && this.addGet === false) {\r\n const code = \"new abap.types.String().set(\" + this.escape(res) + \")\";\r\n return new chunk_1.Chunk().append(code, node, traversal);\r\n }\r\n else {\r\n if (res.startsWith(\"'\")) {\r\n res = \"'\" + res.substring(1, res.length - 1).trimEnd() + \"'\";\r\n }\r\n const code = this.escape(res);\r\n return new chunk_1.Chunk().append(code, node, traversal);\r\n }\r\n }\r\n const concat = node.findDirectExpression(core_1.Expressions.ConcatenatedConstant);\r\n if (concat) {\r\n const chunk = new chunk_1.Chunk().appendString(\"abap.operators.concat([\");\r\n let first = true;\r\n for (const child of concat.getChildren()) {\r\n const res = child.getFirstToken().getStr();\r\n if (first === true) {\r\n first = false;\r\n }\r\n else if (res !== \"&\") {\r\n chunk.appendString(\",\");\r\n }\r\n if (res.startsWith(\"'\") && this.addGet === false) {\r\n const code = \"new abap.types.Character(\" + (res.length - 2) + \").set(\" + this.escape(res) + \")\";\r\n chunk.append(code, node, traversal);\r\n }\r\n else if (res.startsWith(\"`\") && this.addGet === false) {\r\n const code = \"new abap.types.String().set(\" + this.escape(res) + \")\";\r\n chunk.append(code, node, traversal);\r\n }\r\n }\r\n chunk.appendString(\"])\");\r\n return chunk;\r\n }\r\n return new chunk_1.Chunk(`todo, Constant`);\r\n }\r\n escape(str) {\r\n str = str.replace(/\\\\/g, \"\\\\\\\\\");\r\n if (str.startsWith(\"'\")) {\r\n const reg = new RegExp(/(.+)''(.+)/g);\r\n while (reg.test(str)) {\r\n str = str.replace(reg, \"$1\\\\'$2\");\r\n }\r\n }\r\n if (str.startsWith(\"`\")) {\r\n const reg = new RegExp(/(.+)``(.+)/g);\r\n while (reg.test(str)) {\r\n str = str.replace(reg, \"$1\\\\`$2\");\r\n }\r\n }\r\n return str;\r\n }\r\n}\r\nexports.ConstantTranspiler = ConstantTranspiler;\r\n//# sourceMappingURL=constant.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/expressions/constant.js?");
|
|
13561
13561
|
|
|
13562
13562
|
/***/ }),
|
|
13563
13563
|
|
|
@@ -15603,7 +15603,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
15603
15603
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
15604
15604
|
|
|
15605
15605
|
"use strict";
|
|
15606
|
-
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 declareStaticSkipVoid(pre, t) {\r\n const type = t.getType();\r\n const code = this.toType(type);\r\n // todo, this should look at the configuration, for runtime vs compile time errors\r\n if (code.includes(\"Void type\") || code.includes(\"abap.types.typeTodo\")) {\r\n return \"\";\r\n }\r\n return pre + t.getName().toLowerCase() + \" = \" + code + \";\\n\";\r\n }\r\n toType(type) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\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 if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_a = type.getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) + \"\\\"}\";\r\n }\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 if (type.getQualifiedName() !== undefined) {\r\n extra += \", \\\"\" + type.getQualifiedName() + \"\\\"\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.IntegerType) {\r\n resolved = \"Integer\";\r\n if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_b = type.getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toUpperCase()) + \"\\\"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.StringType) {\r\n resolved = \"String\";\r\n if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_c = type.getQualifiedName()) === null || _c === void 0 ? void 0 : _c.toUpperCase()) + \"\\\"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.UTCLongType) {\r\n resolved = \"UTCLong\";\r\n if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_d = type.getQualifiedName()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) + \"\\\"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.DateType) {\r\n resolved = \"Date\";\r\n if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_e = type.getQualifiedName()) === null || _e === void 0 ? void 0 : _e.toUpperCase()) + \"\\\"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.TimeType) {\r\n resolved = \"Time\";\r\n if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_f = type.getQualifiedName()) === null || _f === void 0 ? void 0 : _f.toUpperCase()) + \"\\\"}\";\r\n }\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 = \"
|
|
15606
|
+
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 declareStaticSkipVoid(pre, t) {\r\n const type = t.getType();\r\n const code = this.toType(type);\r\n // todo, this should look at the configuration, for runtime vs compile time errors\r\n if (code.includes(\"Void type\") || code.includes(\"abap.types.typeTodo\")) {\r\n return \"\";\r\n }\r\n return pre + t.getName().toLowerCase() + \" = \" + code + \";\\n\";\r\n }\r\n toType(type) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\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 if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_a = type.getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) + \"\\\"}\";\r\n }\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 if (type.getQualifiedName() !== undefined) {\r\n extra += \", \\\"\" + type.getQualifiedName() + \"\\\"\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.IntegerType) {\r\n resolved = \"Integer\";\r\n if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_b = type.getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toUpperCase()) + \"\\\"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.StringType) {\r\n resolved = \"String\";\r\n if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_c = type.getQualifiedName()) === null || _c === void 0 ? void 0 : _c.toUpperCase()) + \"\\\"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.UTCLongType) {\r\n resolved = \"UTCLong\";\r\n if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_d = type.getQualifiedName()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) + \"\\\"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.DateType) {\r\n resolved = \"Date\";\r\n if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_e = type.getQualifiedName()) === null || _e === void 0 ? void 0 : _e.toUpperCase()) + \"\\\"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.TimeType) {\r\n resolved = \"Time\";\r\n if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_f = type.getQualifiedName()) === null || _f === void 0 ? void 0 : _f.toUpperCase()) + \"\\\"}\";\r\n }\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 = \"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 extra = type.getLength() + \", \" + JSON.stringify(type.getAbstractTypeData());\r\n }\r\n else if (type instanceof abaplint.BasicTypes.NumericType) {\r\n resolved = \"Numc\";\r\n if (type.getQualifiedName() && type.getLength() !== 1) {\r\n extra = \"{length: \" + type.getLength() + \", qualifiedName: \\\"\" + type.getQualifiedName() + \"\\\"}\";\r\n }\r\n else if (type.getLength() !== 1) {\r\n extra = \"{length: \" + type.getLength() + \"}\";\r\n }\r\n else if (type.getQualifiedName()) {\r\n extra = \"{qualifiedName: \\\"\" + type.getQualifiedName() + \"\\\"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.PackedType) {\r\n resolved = \"Packed\";\r\n if (type.getQualifiedName()) {\r\n extra = \"{length: \" + type.getLength() + \", decimals: \" + type.getDecimals() + \", qualifiedName: \\\"\" + type.getQualifiedName() + \"\\\"}\";\r\n }\r\n else {\r\n extra = \"{length: \" + type.getLength() + \", decimals: \" + type.getDecimals() + \"}\";\r\n }\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 if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_g = type.getQualifiedName()) === null || _g === void 0 ? void 0 : _g.toUpperCase()) + \"\\\"}\";\r\n }\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 if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_h = type.getQualifiedName()) === null || _h === void 0 ? void 0 : _h.toUpperCase()) + \"\\\"}\";\r\n }\r\n }\r\n else if (type instanceof abaplint.BasicTypes.FloatingPointType) {\r\n resolved = \"Float\";\r\n if (type.getQualifiedName() !== undefined) {\r\n extra = \"{qualifiedName: \\\"\" + ((_j = type.getQualifiedName()) === null || _j === void 0 ? void 0 : _j.toUpperCase()) + \"\\\"}\";\r\n }\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?");
|
|
15607
15607
|
|
|
15608
15608
|
/***/ }),
|
|
15609
15609
|
|
|
@@ -15636,7 +15636,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
15636
15636
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
15637
15637
|
|
|
15638
15638
|
"use strict";
|
|
15639
|
-
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.${this.escapeNamespace(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?");
|
|
15639
|
+
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(30), testclass_name: new abap.types.Character(30), method_name: new abap.types.Character(30})}), {\"withHeader\":false,\"type\":\"STANDARD\",\"isUnique\":false,\"keyFields\":[]});\r\n let ls_input = new abap.types.Structure({class_name: new abap.types.Character(30), testclass_name: new abap.types.Character(30), method_name: new abap.types.Character(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(30), testclass_name: new abap.types.Character(30), method_name: new abap.types.Character(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.${this.escapeNamespace(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?");
|
|
15640
15640
|
|
|
15641
15641
|
/***/ }),
|
|
15642
15642
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.57",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abap_transpile": "./abap_transpile"
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"author": "abaplint",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@abaplint/transpiler": "^2.3.
|
|
28
|
+
"@abaplint/transpiler": "^2.3.57",
|
|
29
29
|
"@types/glob": "^7.2.0",
|
|
30
30
|
"glob": "=7.2.0",
|
|
31
31
|
"@types/progress": "^2.0.5",
|
|
32
|
-
"@abaplint/core": "^2.93.
|
|
32
|
+
"@abaplint/core": "^2.93.96",
|
|
33
33
|
"progress": "^2.0.3",
|
|
34
34
|
"webpack": "^5.75.0",
|
|
35
35
|
"webpack-cli": "^5.0.0",
|