@abaplint/transpiler-cli 2.1.31 → 2.1.34

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/abap_transpile CHANGED
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  require("./build/bundle");
package/build/bundle.js CHANGED
@@ -13799,7 +13799,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
13799
13799
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
13800
13800
 
13801
13801
  "use strict";
13802
- eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ClassImplementationTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst traversal_1 = __webpack_require__(/*! ../traversal */ \"./node_modules/@abaplint/transpiler/build/src/traversal.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass ClassImplementationTranspiler {\r\n transpile(node, traversal) {\r\n var _a;\r\n const token = node.findFirstExpression(abaplint.Expressions.ClassName).getFirstToken();\r\n const def = traversal.getClassDefinition(token);\r\n let ret = \"class \" + traversal_1.Traversal.escapeClassName(token.getStr().toLowerCase());\r\n if (token.getStr().toLowerCase() === \"cx_root\") {\r\n // special case for exceptions\r\n ret += \" extends Error\";\r\n }\r\n else if (def === null || def === void 0 ? void 0 : def.getSuperClass()) {\r\n ret += \" extends \" + ((_a = def === null || def === void 0 ? void 0 : def.getSuperClass()) === null || _a === void 0 ? void 0 : _a.toLowerCase());\r\n }\r\n return new chunk_1.Chunk().append(ret + \" {\", node, traversal);\r\n }\r\n}\r\nexports.ClassImplementationTranspiler = ClassImplementationTranspiler;\r\n//# sourceMappingURL=class_implementation.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/statements/class_implementation.js?");
13802
+ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ClassImplementationTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst traversal_1 = __webpack_require__(/*! ../traversal */ \"./node_modules/@abaplint/transpiler/build/src/traversal.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass ClassImplementationTranspiler {\r\n transpile(node, traversal) {\r\n var _a;\r\n const token = node.findFirstExpression(abaplint.Expressions.ClassName).getFirstToken();\r\n const def = traversal.getClassDefinition(token);\r\n let ret = \"class \" + traversal_1.Traversal.escapeClassName(token.getStr().toLowerCase());\r\n if (token.getStr().toLowerCase() === \"cx_root\") {\r\n // special case for exceptions\r\n ret += \" extends Error\";\r\n }\r\n else if (def === null || def === void 0 ? void 0 : def.getSuperClass()) {\r\n ret += \" extends \" + ((_a = def === null || def === void 0 ? void 0 : def.getSuperClass()) === null || _a === void 0 ? void 0 : _a.toLowerCase());\r\n }\r\n return new chunk_1.Chunk().append(ret + ` {\r\nstatic INTERNAL_TYPE = 'CLAS';\r\nstatic IMPLEMENTED_INTERFACES = [${def === null || def === void 0 ? void 0 : def.getImplementing().map(e => `\"` + e.name.toUpperCase() + `\"`).join(\",\")}];`, node, traversal);\r\n }\r\n}\r\nexports.ClassImplementationTranspiler = ClassImplementationTranspiler;\r\n//# sourceMappingURL=class_implementation.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/statements/class_implementation.js?");
13803
13803
 
13804
13804
  /***/ }),
13805
13805
 
@@ -14866,7 +14866,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
14866
14866
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
14867
14867
 
14868
14868
  "use strict";
14869
- eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ClassDefinitionTranspiler = 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\nclass ClassDefinitionTranspiler {\r\n transpile(node, traversal) {\r\n var _a;\r\n const className = (_a = node.findFirstExpression(abaplint.Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n let found = false;\r\n if (className !== undefined) {\r\n for (const a of traversal.getCurrentObject().getABAPFiles()) {\r\n if (a.getInfo().getClassImplementationByName(className) !== undefined) {\r\n found = true;\r\n }\r\n }\r\n }\r\n if (found) {\r\n return new chunk_1.Chunk(\"\");\r\n }\r\n else {\r\n // its an abstract class with only abstract methods\r\n return new chunk_1.Chunk(`\r\nclass ${className === null || className === void 0 ? void 0 : className.toLowerCase()} {\r\n async constructor_() {\r\n this.me = new abap.types.ABAPObject();\r\n this.me.set(this);\r\n return this;\r\n }\r\n}`);\r\n }\r\n }\r\n}\r\nexports.ClassDefinitionTranspiler = ClassDefinitionTranspiler;\r\n//# sourceMappingURL=class_definition.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/structures/class_definition.js?");
14869
+ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ClassDefinitionTranspiler = 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\nclass ClassDefinitionTranspiler {\r\n transpile(node, traversal) {\r\n var _a;\r\n const className = (_a = node.findFirstExpression(abaplint.Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n let found = false;\r\n if (className !== undefined) {\r\n for (const a of traversal.getCurrentObject().getABAPFiles()) {\r\n if (a.getInfo().getClassImplementationByName(className) !== undefined) {\r\n found = true;\r\n }\r\n }\r\n }\r\n if (found) {\r\n return new chunk_1.Chunk(\"\");\r\n }\r\n else {\r\n // its an abstract class with only abstract methods\r\n return new chunk_1.Chunk(`\r\nclass ${className === null || className === void 0 ? void 0 : className.toLowerCase()} {\r\n static INTERNAL_TYPE = 'CLAS';\r\n async constructor_() {\r\n this.me = new abap.types.ABAPObject();\r\n this.me.set(this);\r\n return this;\r\n }\r\n}`);\r\n }\r\n }\r\n}\r\nexports.ClassDefinitionTranspiler = ClassDefinitionTranspiler;\r\n//# sourceMappingURL=class_definition.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/structures/class_definition.js?");
14870
14870
 
14871
14871
  /***/ }),
14872
14872
 
@@ -14932,7 +14932,7 @@ eval("\r\nvar __createBinding = (this && this.__createBinding) || (Object.create
14932
14932
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
14933
14933
 
14934
14934
  "use strict";
14935
- eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.InterfaceTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst traversal_1 = __webpack_require__(/*! ../traversal */ \"./node_modules/@abaplint/transpiler/build/src/traversal.js\");\r\nconst transpile_types_1 = __webpack_require__(/*! ../transpile_types */ \"./node_modules/@abaplint/transpiler/build/src/transpile_types.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/transpiler/build/src/expressions/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass InterfaceTranspiler {\r\n transpile(node, traversal) {\r\n var _a;\r\n let ret = \"\";\r\n let name;\r\n for (const c of node.getChildren()) {\r\n if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.Interface) {\r\n name = (_a = c.findDirectExpression(abaplint.Expressions.InterfaceName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr().toLowerCase();\r\n name = traversal_1.Traversal.escapeClassName(name);\r\n ret += `class ${name} {\\n`;\r\n }\r\n else if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.EndInterface) {\r\n ret += \"}\\n\";\r\n const def = traversal.getInterfaceDefinition(node.getFirstToken());\r\n ret += traversal.registerClassOrInterface(def);\r\n }\r\n }\r\n ret += this.buildConstants(node.findFirstExpression(abaplint.Expressions.InterfaceName), traversal);\r\n return new chunk_1.Chunk(ret);\r\n }\r\n buildConstants(node, traversal) {\r\n if (node === undefined) {\r\n return \"\";\r\n }\r\n const scope = traversal.findCurrentScopeByToken(node.getFirstToken());\r\n const vars = scope === null || scope === void 0 ? void 0 : scope.getData().vars;\r\n if (vars === undefined || Object.keys(vars).length === 0) {\r\n return \"\";\r\n }\r\n let ret = \"\\n\";\r\n for (const n in vars) {\r\n const identifier = vars[n];\r\n if (identifier.getMeta().includes(\"static\" /* abaplint.IdentifierMeta.Static */) === false\r\n || identifier.getMeta().includes(\"read_only\" /* abaplint.IdentifierMeta.ReadOnly */) === false) {\r\n continue;\r\n }\r\n const interfaceName = traversal_1.Traversal.escapeClassName(node.getFirstToken().getStr().toLowerCase());\r\n const name = interfaceName + \".\" + interfaceName + \"$\" + n.toLowerCase();\r\n ret += name + \" = \" + new transpile_types_1.TranspileTypes().toType(identifier.getType()) + \";\\n\";\r\n const constantStatement = traversal.findStatementInFile(identifier.getStart());\r\n const valExpression = constantStatement === null || constantStatement === void 0 ? void 0 : constantStatement.findFirstExpression(abaplint.Expressions.Value);\r\n if ((valExpression === null || valExpression === void 0 ? void 0 : valExpression.getChildren()[1].get()) instanceof abaplint.Expressions.SimpleFieldChain) {\r\n const s = new expressions_1.FieldChainTranspiler().transpile(valExpression.getChildren()[1], traversal, false).getCode();\r\n const e = new expressions_1.ConstantTranspiler().escape(s);\r\n ret += name + \".set(\" + e + \");\\n\";\r\n continue;\r\n }\r\n const val = identifier.getValue();\r\n if (typeof val === \"string\") {\r\n const e = new expressions_1.ConstantTranspiler().escape(val);\r\n ret += name + \".set(\" + e + \");\\n\";\r\n }\r\n else if (typeof val === \"object\") {\r\n const a = val;\r\n for (const v of Object.keys(val)) {\r\n const s = a[v];\r\n if (s === undefined) {\r\n continue;\r\n }\r\n ret += name + \".get().\" + v + \".set(\" + s + \");\\n\";\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.InterfaceTranspiler = InterfaceTranspiler;\r\n//# sourceMappingURL=interface.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/structures/interface.js?");
14935
+ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.InterfaceTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst traversal_1 = __webpack_require__(/*! ../traversal */ \"./node_modules/@abaplint/transpiler/build/src/traversal.js\");\r\nconst transpile_types_1 = __webpack_require__(/*! ../transpile_types */ \"./node_modules/@abaplint/transpiler/build/src/transpile_types.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/transpiler/build/src/expressions/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass InterfaceTranspiler {\r\n transpile(node, traversal) {\r\n var _a;\r\n let ret = \"\";\r\n let name;\r\n for (const c of node.getChildren()) {\r\n const def = traversal.getInterfaceDefinition(node.getFirstToken());\r\n if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.Interface) {\r\n name = (_a = c.findDirectExpression(abaplint.Expressions.InterfaceName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr().toLowerCase();\r\n name = traversal_1.Traversal.escapeClassName(name);\r\n ret += `class ${name} {\\n`;\r\n ret += `static INTERNAL_TYPE = 'INTF';\\n`;\r\n ret += `static IMPLEMENTED_INTERFACES = [${def === null || def === void 0 ? void 0 : def.getImplementing().map(e => `\"` + e.name.toUpperCase() + `\"`).join(\",\")}];\\n`;\r\n }\r\n else if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.EndInterface) {\r\n ret += \"}\\n\";\r\n ret += traversal.registerClassOrInterface(def);\r\n }\r\n }\r\n ret += this.buildConstants(node.findFirstExpression(abaplint.Expressions.InterfaceName), traversal);\r\n return new chunk_1.Chunk(ret);\r\n }\r\n buildConstants(node, traversal) {\r\n if (node === undefined) {\r\n return \"\";\r\n }\r\n const scope = traversal.findCurrentScopeByToken(node.getFirstToken());\r\n const vars = scope === null || scope === void 0 ? void 0 : scope.getData().vars;\r\n if (vars === undefined || Object.keys(vars).length === 0) {\r\n return \"\";\r\n }\r\n let ret = \"\\n\";\r\n for (const n in vars) {\r\n const identifier = vars[n];\r\n if (identifier.getMeta().includes(\"static\" /* abaplint.IdentifierMeta.Static */) === false\r\n || identifier.getMeta().includes(\"read_only\" /* abaplint.IdentifierMeta.ReadOnly */) === false) {\r\n continue;\r\n }\r\n const interfaceName = traversal_1.Traversal.escapeClassName(node.getFirstToken().getStr().toLowerCase());\r\n const name = interfaceName + \".\" + interfaceName + \"$\" + n.toLowerCase();\r\n ret += name + \" = \" + new transpile_types_1.TranspileTypes().toType(identifier.getType()) + \";\\n\";\r\n const constantStatement = traversal.findStatementInFile(identifier.getStart());\r\n const valExpression = constantStatement === null || constantStatement === void 0 ? void 0 : constantStatement.findFirstExpression(abaplint.Expressions.Value);\r\n if ((valExpression === null || valExpression === void 0 ? void 0 : valExpression.getChildren()[1].get()) instanceof abaplint.Expressions.SimpleFieldChain) {\r\n const s = new expressions_1.FieldChainTranspiler().transpile(valExpression.getChildren()[1], traversal, false).getCode();\r\n const e = new expressions_1.ConstantTranspiler().escape(s);\r\n ret += name + \".set(\" + e + \");\\n\";\r\n continue;\r\n }\r\n const val = identifier.getValue();\r\n if (typeof val === \"string\") {\r\n const e = new expressions_1.ConstantTranspiler().escape(val);\r\n ret += name + \".set(\" + e + \");\\n\";\r\n }\r\n else if (typeof val === \"object\") {\r\n const a = val;\r\n for (const v of Object.keys(val)) {\r\n const s = a[v];\r\n if (s === undefined) {\r\n continue;\r\n }\r\n ret += name + \".get().\" + v + \".set(\" + s + \");\\n\";\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.InterfaceTranspiler = InterfaceTranspiler;\r\n//# sourceMappingURL=interface.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/structures/interface.js?");
14936
14936
 
14937
14937
  /***/ }),
14938
14938
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.1.31",
3
+ "version": "2.1.34",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,7 +25,7 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.1.31",
28
+ "@abaplint/transpiler": "^2.1.34",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",