@abaplint/cli 2.84.3 → 2.84.7
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/cli.js +9 -9
- package/build/src/fixes.js +68 -56
- package/build/src/index.js +1 -1
- package/build/src/rename.js +20 -1
- package/package.json +9 -9
package/build/cli.js
CHANGED
|
@@ -60,7 +60,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
60
60
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
61
61
|
|
|
62
62
|
"use strict";
|
|
63
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.
|
|
63
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ApplyFixes = void 0;\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass ApplyFixes {\r\n constructor() {\r\n this.changedFiles = new Set();\r\n }\r\n applyFixes(inputIssues, reg, fs, bar) {\r\n let changed = [];\r\n let iteration = 1;\r\n let issues = inputIssues;\r\n this.changedFiles.clear();\r\n const MAX_ITERATIONS = 50000;\r\n bar === null || bar === void 0 ? void 0 : bar.set(MAX_ITERATIONS, \"Apply Fixes\");\r\n while (iteration <= MAX_ITERATIONS) {\r\n bar === null || bar === void 0 ? void 0 : bar.tick(\"Apply Fixes, iteration \" + iteration + \", \" + issues.length + \" candidates\");\r\n changed = this.applyList(issues, reg);\r\n if (changed.length === 0) {\r\n break;\r\n }\r\n iteration++;\r\n issues = reg.parse().findIssues();\r\n }\r\n this.writeChangesToFS(fs, reg);\r\n // always end the progress indicator at 100%\r\n while (iteration <= MAX_ITERATIONS) {\r\n bar === null || bar === void 0 ? void 0 : bar.tick(\"Fixes Applied\");\r\n iteration++;\r\n }\r\n return issues;\r\n }\r\n writeChangesToFS(fs, reg) {\r\n for (const filename of this.changedFiles.values()) {\r\n const file = reg.getFileByName(filename);\r\n if (file === undefined) {\r\n continue;\r\n }\r\n fs.writeFileSync(file.getFilename(), file.getRaw());\r\n }\r\n }\r\n possibleOverlap(edit, list) {\r\n // only checks if the edits have changes in the same rows\r\n for (const e of list) {\r\n for (const file1 of Object.keys(e)) {\r\n for (const file2 of Object.keys(edit)) {\r\n if (file1 === file2) {\r\n for (const list1 of e[file1]) {\r\n for (const list2 of edit[file2]) {\r\n if (list2.range.start.getRow() <= list1.range.start.getRow()\r\n && list2.range.end.getRow() >= list1.range.start.getRow()) {\r\n return true;\r\n }\r\n if (list2.range.start.getRow() <= list1.range.start.getRow()\r\n && list2.range.end.getRow() >= list1.range.end.getRow()) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n applyList(issues, reg) {\r\n const edits = [];\r\n for (const i of issues) {\r\n const edit = i.getFix();\r\n if (edit === undefined) {\r\n continue;\r\n }\r\n else if (this.possibleOverlap(edit, edits) === true) {\r\n continue;\r\n }\r\n edits.push(edit);\r\n }\r\n const changed = (0, core_1.applyEditList)(reg, edits);\r\n for (const filename of changed) {\r\n this.changedFiles.add(filename);\r\n }\r\n return changed;\r\n }\r\n}\r\nexports.ApplyFixes = ApplyFixes;\r\n//# sourceMappingURL=fixes.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./build/src/fixes.js?");
|
|
64
64
|
|
|
65
65
|
/***/ }),
|
|
66
66
|
|
|
@@ -148,7 +148,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
148
148
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
149
149
|
|
|
150
150
|
"use strict";
|
|
151
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.run = exports.GENERIC_ERROR = void 0;\r\nconst fs = __webpack_require__(/*! fs */ \"fs\");\r\nconst os = __webpack_require__(/*! os */ \"os\");\r\nconst path = __webpack_require__(/*! path */ \"path\");\r\nconst ProgressBar = __webpack_require__(/*! progress */ \"./node_modules/progress/index.js\");\r\nconst childProcess = __webpack_require__(/*! child_process */ \"child_process\");\r\nconst JSON5 = __webpack_require__(/*! json5 */ \"./node_modules/json5/dist/index.mjs\");\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst _format_1 = __webpack_require__(/*! ./formatters/_format */ \"./build/src/formatters/_format.js\");\r\nconst file_operations_1 = __webpack_require__(/*! ./file_operations */ \"./build/src/file_operations.js\");\r\nconst apack_dependency_provider_1 = __webpack_require__(/*! ./apack_dependency_provider */ \"./build/src/apack_dependency_provider.js\");\r\nconst fixes_1 = __webpack_require__(/*! ./fixes */ \"./build/src/fixes.js\");\r\nconst rename_1 = __webpack_require__(/*! ./rename */ \"./build/src/rename.js\");\r\nexports.GENERIC_ERROR = \"generic_error\";\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 tickSync(text) {\r\n this.bar.tick({ text });\r\n this.bar.render();\r\n }\r\n}\r\nfunction loadConfig(filename) {\r\n // possible cases:\r\n // a) nothing specified, using abaplint.json from cwd\r\n // b) nothing specified, no abaplint.json in cwd\r\n // c) specified and found\r\n // d) specified and not found => use default\r\n // e) supplied but a directory => use default\r\n let f = \"\";\r\n if (filename === undefined) {\r\n f = process.cwd() + path.sep + \"abaplint.json\";\r\n if (fs.existsSync(f) === false) {\r\n f = process.cwd() + path.sep + \"abaplint.jsonc\";\r\n }\r\n if (fs.existsSync(f) === false) {\r\n f = process.cwd() + path.sep + \"abaplint.json5\";\r\n }\r\n if (fs.existsSync(f) === false) {\r\n process.stderr.write(\"Using default config\\n\");\r\n return { config: core_1.Config.getDefault(), base: \".\" };\r\n }\r\n }\r\n else {\r\n if (fs.existsSync(filename) === false) {\r\n process.stderr.write(\"ERROR: Specified abaplint configuration file does not exist, using default config\\n\");\r\n return { config: core_1.Config.getDefault(), base: \".\" };\r\n }\r\n else if (fs.statSync(filename).isDirectory() === true) {\r\n process.stderr.write(\"Supply filename, not directory, using default config\\n\");\r\n return { config: core_1.Config.getDefault(), base: \".\" };\r\n }\r\n f = filename;\r\n }\r\n // evil hack to get JSON5 working\r\n if (JSON5.parse === undefined) {\r\n // @ts-ignore\r\n JSON5.parse = JSON5.default.parse;\r\n }\r\n process.stderr.write(\"Using config: \" + f + \"\\n\");\r\n const json = fs.readFileSync(f, \"utf8\");\r\n const parsed = JSON5.parse(json);\r\n const vers = core_1.Version;\r\n if (Object.keys(core_1.Version).some(v => vers[v] === parsed.syntax.version) === false) {\r\n throw \"Error: Unknown version in abaplint.json\";\r\n }\r\n return {\r\n config: new core_1.Config(json),\r\n base: path.dirname(f) === process.cwd() ? \".\" : path.dirname(f),\r\n };\r\n}\r\nasync function loadDependencies(config, compress, bar, base) {\r\n let files = [];\r\n const deps = config.get().dependencies || [];\r\n const useApack = config.get().global.useApackDependencies;\r\n if (useApack) {\r\n const apackPath = path.join(base, \".apack-manifest.xml\");\r\n if (fs.existsSync(apackPath)) {\r\n const apackManifest = fs.readFileSync(apackPath, \"utf8\");\r\n deps.push(...apack_dependency_provider_1.ApackDependencyProvider.fromManifest(apackManifest));\r\n }\r\n }\r\n if (!deps) {\r\n return [];\r\n }\r\n for (const d of deps) {\r\n if (d.folder) {\r\n const g = base + d.folder + d.files;\r\n const names = file_operations_1.FileOperations.loadFileNames(g, false);\r\n if (names.length > 0) {\r\n process.stderr.write(\"Using dependency from: \" + g + \"\\n\");\r\n files = files.concat(await file_operations_1.FileOperations.loadFiles(compress, names, bar));\r\n continue;\r\n }\r\n }\r\n if (d.url) {\r\n process.stderr.write(\"Clone: \" + d.url + \"\\n\");\r\n const dir = fs.mkdtempSync(path.join(os.tmpdir(), \"abaplint-\"));\r\n childProcess.execSync(\"git clone --quiet --depth 1 \" + d.url + \" .\", { cwd: dir, stdio: \"inherit\" });\r\n const names = file_operations_1.FileOperations.loadFileNames(dir + d.files);\r\n files = files.concat(await file_operations_1.FileOperations.loadFiles(compress, names, bar));\r\n file_operations_1.FileOperations.deleteFolderRecursive(dir);\r\n }\r\n }\r\n return files;\r\n}\r\nfunction displayHelp() {\r\n // follow https://docopt.org conventions,\r\n return \"Usage:\\n\" +\r\n \" abaplint [<abaplint.json> -f <format> -c --outformat <format> --outfile <file> --fix] \\n\" +\r\n \" abaplint -h | --help show this help\\n\" +\r\n \" abaplint -v | --version show version\\n\" +\r\n \" abaplint -d | --default show default configuration\\n\" +\r\n \"\\n\" +\r\n \"Options:\\n\" +\r\n \" -f, --format <format> output format (standard, total, json, summary, junit, codeframe)\\n\" +\r\n \" --outformat <format> output format, use in combination with outfile\\n\" +\r\n \" --outfile <file> output issues to file in format\\n\" +\r\n \" --fix apply quick fixes to files\\n\" +\r\n \" --rename rename object according to rules in abaplint.json\\n\" +\r\n \" -p output performance information\\n\" +\r\n \" -c compress files in memory\\n\";\r\n}\r\nfunction out(issues, length, arg) {\r\n const output = _format_1.Formatter.format(issues, arg.format, length);\r\n if (arg.outFormat && arg.outFile) {\r\n const fileContents = _format_1.Formatter.format(issues, arg.outFormat, length);\r\n fs.writeFileSync(arg.outFile, fileContents, \"utf-8\");\r\n }\r\n return output;\r\n}\r\nasync function run(arg) {\r\n var _a, _b;\r\n // evil hack to get JSON5 working\r\n if (JSON5.parse === undefined) {\r\n // @ts-ignore\r\n JSON5.parse = JSON5.default.parse;\r\n }\r\n if (JSON5.stringify === undefined) {\r\n // @ts-ignore\r\n JSON5.stringify = JSON5.default.stringify;\r\n }\r\n let output = \"\";\r\n let issues = [];\r\n let reg = undefined;\r\n const progress = new Progress();\r\n if (arg.showHelp === true) {\r\n output = output + displayHelp();\r\n }\r\n else if (arg.showVersion === true) {\r\n output = output + core_1.Registry.abaplintVersion() + \"\\n\";\r\n }\r\n else if (arg.outputDefaultConfig === true) {\r\n output = output + JSON.stringify(core_1.Config.getDefault().get(), undefined, 2) + \"\\n\";\r\n }\r\n else {\r\n process.stderr.write(\"abaplint \" + core_1.Registry.abaplintVersion() + \"\\n\");\r\n let loaded = [];\r\n let deps = [];\r\n const { config, base } = loadConfig(arg.configFilename);\r\n try {\r\n if (config.get().global.files === undefined) {\r\n throw \"Error: Update abaplint configuration file to latest format\";\r\n }\r\n const files = file_operations_1.FileOperations.loadFileNames(base + config.get().global.files);\r\n loaded = await file_operations_1.FileOperations.loadFiles(arg.compress, files, progress);\r\n deps = await loadDependencies(config, arg.compress, progress, base);\r\n reg = new core_1.Registry(config);\r\n reg.addDependencies(deps);\r\n reg.addFiles(loaded); // if the object exists in repo, it should take precedence over deps\r\n await reg.parseAsync({ progress, outputPerformance: arg.parsingPerformance });\r\n issues = issues.concat(reg.findIssues({ progress, outputPerformance: arg.parsingPerformance }));\r\n }\r\n catch (error) {\r\n const file = new core_1.MemoryFile(\"generic\", \"dummy\");\r\n const message = error.toString() + \" \" + ((_b = (_a = error.stack) === null || _a === void 0 ? void 0 : _a.split(\"\\n\")[1]) === null || _b === void 0 ? void 0 : _b.trim());\r\n const issue = core_1.Issue.atPosition(file, new core_1.Position(1, 1), message, exports.GENERIC_ERROR);\r\n issues = [issue];\r\n }\r\n let extra = \"\";\r\n if (arg.runFix === true && reg) {\r\n issues = (0, fixes_1.applyFixes)(issues, reg, fs, progress);\r\n extra = \"Fixes applied\";\r\n }\r\n else if (arg.runRename === true && reg) {\r\n if (issues.length === 0) {\r\n new rename_1.Rename(reg).run(config, base);\r\n extra = \"Renames applied\";\r\n }\r\n else {\r\n extra = \"Renames NOT applied, issues found\";\r\n }\r\n }\r\n output = out(issues, loaded.length, arg) + extra;\r\n }\r\n return { output, issues, reg };\r\n}\r\nexports.run = run;\r\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./build/src/index.js?");
|
|
151
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.run = exports.GENERIC_ERROR = void 0;\r\nconst fs = __webpack_require__(/*! fs */ \"fs\");\r\nconst os = __webpack_require__(/*! os */ \"os\");\r\nconst path = __webpack_require__(/*! path */ \"path\");\r\nconst ProgressBar = __webpack_require__(/*! progress */ \"./node_modules/progress/index.js\");\r\nconst childProcess = __webpack_require__(/*! child_process */ \"child_process\");\r\nconst JSON5 = __webpack_require__(/*! json5 */ \"./node_modules/json5/dist/index.mjs\");\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst _format_1 = __webpack_require__(/*! ./formatters/_format */ \"./build/src/formatters/_format.js\");\r\nconst file_operations_1 = __webpack_require__(/*! ./file_operations */ \"./build/src/file_operations.js\");\r\nconst apack_dependency_provider_1 = __webpack_require__(/*! ./apack_dependency_provider */ \"./build/src/apack_dependency_provider.js\");\r\nconst fixes_1 = __webpack_require__(/*! ./fixes */ \"./build/src/fixes.js\");\r\nconst rename_1 = __webpack_require__(/*! ./rename */ \"./build/src/rename.js\");\r\nexports.GENERIC_ERROR = \"generic_error\";\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 tickSync(text) {\r\n this.bar.tick({ text });\r\n this.bar.render();\r\n }\r\n}\r\nfunction loadConfig(filename) {\r\n // possible cases:\r\n // a) nothing specified, using abaplint.json from cwd\r\n // b) nothing specified, no abaplint.json in cwd\r\n // c) specified and found\r\n // d) specified and not found => use default\r\n // e) supplied but a directory => use default\r\n let f = \"\";\r\n if (filename === undefined) {\r\n f = process.cwd() + path.sep + \"abaplint.json\";\r\n if (fs.existsSync(f) === false) {\r\n f = process.cwd() + path.sep + \"abaplint.jsonc\";\r\n }\r\n if (fs.existsSync(f) === false) {\r\n f = process.cwd() + path.sep + \"abaplint.json5\";\r\n }\r\n if (fs.existsSync(f) === false) {\r\n process.stderr.write(\"Using default config\\n\");\r\n return { config: core_1.Config.getDefault(), base: \".\" };\r\n }\r\n }\r\n else {\r\n if (fs.existsSync(filename) === false) {\r\n process.stderr.write(\"ERROR: Specified abaplint configuration file does not exist, using default config\\n\");\r\n return { config: core_1.Config.getDefault(), base: \".\" };\r\n }\r\n else if (fs.statSync(filename).isDirectory() === true) {\r\n process.stderr.write(\"Supply filename, not directory, using default config\\n\");\r\n return { config: core_1.Config.getDefault(), base: \".\" };\r\n }\r\n f = filename;\r\n }\r\n // evil hack to get JSON5 working\r\n if (JSON5.parse === undefined) {\r\n // @ts-ignore\r\n JSON5.parse = JSON5.default.parse;\r\n }\r\n process.stderr.write(\"Using config: \" + f + \"\\n\");\r\n const json = fs.readFileSync(f, \"utf8\");\r\n const parsed = JSON5.parse(json);\r\n const vers = core_1.Version;\r\n if (Object.keys(core_1.Version).some(v => vers[v] === parsed.syntax.version) === false) {\r\n throw \"Error: Unknown version in abaplint.json\";\r\n }\r\n return {\r\n config: new core_1.Config(json),\r\n base: path.dirname(f) === process.cwd() ? \".\" : path.dirname(f),\r\n };\r\n}\r\nasync function loadDependencies(config, compress, bar, base) {\r\n let files = [];\r\n const deps = config.get().dependencies || [];\r\n const useApack = config.get().global.useApackDependencies;\r\n if (useApack) {\r\n const apackPath = path.join(base, \".apack-manifest.xml\");\r\n if (fs.existsSync(apackPath)) {\r\n const apackManifest = fs.readFileSync(apackPath, \"utf8\");\r\n deps.push(...apack_dependency_provider_1.ApackDependencyProvider.fromManifest(apackManifest));\r\n }\r\n }\r\n if (!deps) {\r\n return [];\r\n }\r\n for (const d of deps) {\r\n if (d.folder) {\r\n const g = base + d.folder + d.files;\r\n const names = file_operations_1.FileOperations.loadFileNames(g, false);\r\n if (names.length > 0) {\r\n process.stderr.write(\"Using dependency from: \" + g + \"\\n\");\r\n files = files.concat(await file_operations_1.FileOperations.loadFiles(compress, names, bar));\r\n continue;\r\n }\r\n }\r\n if (d.url) {\r\n process.stderr.write(\"Clone: \" + d.url + \"\\n\");\r\n const dir = fs.mkdtempSync(path.join(os.tmpdir(), \"abaplint-\"));\r\n childProcess.execSync(\"git clone --quiet --depth 1 \" + d.url + \" .\", { cwd: dir, stdio: \"inherit\" });\r\n const names = file_operations_1.FileOperations.loadFileNames(dir + d.files);\r\n files = files.concat(await file_operations_1.FileOperations.loadFiles(compress, names, bar));\r\n file_operations_1.FileOperations.deleteFolderRecursive(dir);\r\n }\r\n }\r\n return files;\r\n}\r\nfunction displayHelp() {\r\n // follow https://docopt.org conventions,\r\n return \"Usage:\\n\" +\r\n \" abaplint [<abaplint.json> -f <format> -c --outformat <format> --outfile <file> --fix] \\n\" +\r\n \" abaplint -h | --help show this help\\n\" +\r\n \" abaplint -v | --version show version\\n\" +\r\n \" abaplint -d | --default show default configuration\\n\" +\r\n \"\\n\" +\r\n \"Options:\\n\" +\r\n \" -f, --format <format> output format (standard, total, json, summary, junit, codeframe)\\n\" +\r\n \" --outformat <format> output format, use in combination with outfile\\n\" +\r\n \" --outfile <file> output issues to file in format\\n\" +\r\n \" --fix apply quick fixes to files\\n\" +\r\n \" --rename rename object according to rules in abaplint.json\\n\" +\r\n \" -p output performance information\\n\" +\r\n \" -c compress files in memory\\n\";\r\n}\r\nfunction out(issues, length, arg) {\r\n const output = _format_1.Formatter.format(issues, arg.format, length);\r\n if (arg.outFormat && arg.outFile) {\r\n const fileContents = _format_1.Formatter.format(issues, arg.outFormat, length);\r\n fs.writeFileSync(arg.outFile, fileContents, \"utf-8\");\r\n }\r\n return output;\r\n}\r\nasync function run(arg) {\r\n var _a, _b;\r\n // evil hack to get JSON5 working\r\n if (JSON5.parse === undefined) {\r\n // @ts-ignore\r\n JSON5.parse = JSON5.default.parse;\r\n }\r\n if (JSON5.stringify === undefined) {\r\n // @ts-ignore\r\n JSON5.stringify = JSON5.default.stringify;\r\n }\r\n let output = \"\";\r\n let issues = [];\r\n let reg = undefined;\r\n const progress = new Progress();\r\n if (arg.showHelp === true) {\r\n output = output + displayHelp();\r\n }\r\n else if (arg.showVersion === true) {\r\n output = output + core_1.Registry.abaplintVersion() + \"\\n\";\r\n }\r\n else if (arg.outputDefaultConfig === true) {\r\n output = output + JSON.stringify(core_1.Config.getDefault().get(), undefined, 2) + \"\\n\";\r\n }\r\n else {\r\n process.stderr.write(\"abaplint \" + core_1.Registry.abaplintVersion() + \"\\n\");\r\n let loaded = [];\r\n let deps = [];\r\n const { config, base } = loadConfig(arg.configFilename);\r\n try {\r\n if (config.get().global.files === undefined) {\r\n throw \"Error: Update abaplint configuration file to latest format\";\r\n }\r\n const files = file_operations_1.FileOperations.loadFileNames(base + config.get().global.files);\r\n loaded = await file_operations_1.FileOperations.loadFiles(arg.compress, files, progress);\r\n deps = await loadDependencies(config, arg.compress, progress, base);\r\n reg = new core_1.Registry(config);\r\n reg.addDependencies(deps);\r\n reg.addFiles(loaded); // if the object exists in repo, it should take precedence over deps\r\n await reg.parseAsync({ progress, outputPerformance: arg.parsingPerformance });\r\n issues = issues.concat(reg.findIssues({ progress, outputPerformance: arg.parsingPerformance }));\r\n }\r\n catch (error) {\r\n const file = new core_1.MemoryFile(\"generic\", \"dummy\");\r\n const message = error.toString() + \" \" + ((_b = (_a = error.stack) === null || _a === void 0 ? void 0 : _a.split(\"\\n\")[1]) === null || _b === void 0 ? void 0 : _b.trim());\r\n const issue = core_1.Issue.atPosition(file, new core_1.Position(1, 1), message, exports.GENERIC_ERROR);\r\n issues = [issue];\r\n }\r\n let extra = \"\";\r\n if (arg.runFix === true && reg) {\r\n issues = new fixes_1.ApplyFixes().applyFixes(issues, reg, fs, progress);\r\n extra = \"Fixes applied\";\r\n }\r\n else if (arg.runRename === true && reg) {\r\n if (issues.length === 0) {\r\n new rename_1.Rename(reg).run(config, base);\r\n extra = \"Renames applied\";\r\n }\r\n else {\r\n extra = \"Renames NOT applied, issues found\";\r\n }\r\n }\r\n output = out(issues, loaded.length, arg) + extra;\r\n }\r\n return { output, issues, reg };\r\n}\r\nexports.run = run;\r\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./build/src/index.js?");
|
|
152
152
|
|
|
153
153
|
/***/ }),
|
|
154
154
|
|
|
@@ -159,7 +159,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
159
159
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
160
160
|
|
|
161
161
|
"use strict";
|
|
162
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Rename = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst path = __webpack_require__(/*! path */ \"path\");\r\nconst fs = __webpack_require__(/*! fs */ \"fs\");\r\nconst file_operations_1 = __webpack_require__(/*! ./file_operations */ \"./build/src/file_operations.js\");\r\nclass Rename {\r\n constructor(reg) {\r\n this.reg = reg;\r\n }\r\n run(config, base) {\r\n const rconfig = config.get().rename;\r\n if (rconfig === undefined) {\r\n return;\r\n }\r\n this.skip(rconfig);\r\n this.rename(rconfig);\r\n this.write(rconfig, base);\r\n }\r\n ////////////////////////\r\n write(rconfig, base) {\r\n const outputFolder = base + path.sep + rconfig.output;\r\n console.log(\"Base: \" + base);\r\n console.log(\"Output folder: \" + outputFolder);\r\n file_operations_1.FileOperations.deleteFolderRecursive(outputFolder);\r\n for (const o of this.reg.getObjects()) {\r\n if (this.reg.isDependency(o) === true) {\r\n continue;\r\n }\r\n for (const f of o.getFiles()) {\r\n const n = outputFolder + f.getFilename().replace(base, \"\");\r\n console.log(\"Write \" + n);\r\n fs.mkdirSync(path.dirname(n), { recursive: true });\r\n fs.writeFileSync(n, f.getRaw());\r\n }\r\n }\r\n }\r\n rename(rconfig) {\r\n const renamer = new abaplint.Rename(this.reg);\r\n for (const o of this.reg.getObjects()) {\r\n if (this.reg.isDependency(o) === true) {\r\n continue;\r\n }\r\n for (const p of rconfig.patterns || []) {\r\n if (!(o.getType().match(p.type))) {\r\n continue;\r\n }\r\n const regex = new RegExp(p.oldName, \"i\");\r\n const match = regex.exec(o.getName());\r\n if (!match) {\r\n continue;\r\n }\r\n const newStr = o.getName().replace(regex, p.newName);\r\n console.log(\"Renaming \" + o.getName().padEnd(30, \" \") + \" -> \" + newStr);\r\n renamer.rename(o.getType(), o.getName(), newStr);\r\n }\r\n }\r\n }\r\n skip(rconfig) {\r\n if (rconfig.skip) {\r\n for (const s of rconfig.skip) {\r\n const all = [];\r\n for (const f of this.reg.getFiles()) {\r\n all.push(f);\r\n }\r\n for (const n of all) {\r\n if (n.getFilename().match(s)) {\r\n console.log(n.getFilename() + \" skipped\");\r\n this.reg.removeFile(n);\r\n }\r\n }\r\n }\r\n this.reg.parse();\r\n }\r\n }\r\n}\r\nexports.Rename = Rename;\r\n//# sourceMappingURL=rename.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./build/src/rename.js?");
|
|
162
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Rename = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst path = __webpack_require__(/*! path */ \"path\");\r\nconst fs = __webpack_require__(/*! fs */ \"fs\");\r\nconst file_operations_1 = __webpack_require__(/*! ./file_operations */ \"./build/src/file_operations.js\");\r\nclass Rename {\r\n constructor(reg) {\r\n this.deletedFiles = [];\r\n this.addedFiles = [];\r\n this.reg = reg;\r\n }\r\n run(config, base) {\r\n const rconfig = config.get().rename;\r\n if (rconfig === undefined) {\r\n return;\r\n }\r\n this.skip(rconfig);\r\n this.rename(rconfig);\r\n if (rconfig.output === undefined || rconfig.output === \"\") {\r\n // write changes inline\r\n this.deletedFiles.forEach(f => {\r\n console.log(\"rm \" + f);\r\n fs.rmSync(f);\r\n });\r\n this.addedFiles.forEach(f => {\r\n console.log(\"write \" + f.getFilename());\r\n fs.writeFileSync(f.getFilename(), f.getRaw());\r\n });\r\n }\r\n else {\r\n // output full registry contents to output folder\r\n this.write(rconfig, base);\r\n }\r\n }\r\n ////////////////////////\r\n write(rconfig, base) {\r\n const outputFolder = base + path.sep + rconfig.output;\r\n console.log(\"Base: \" + base);\r\n console.log(\"Output folder: \" + outputFolder);\r\n file_operations_1.FileOperations.deleteFolderRecursive(outputFolder);\r\n for (const o of this.reg.getObjects()) {\r\n if (this.reg.isDependency(o) === true) {\r\n continue;\r\n }\r\n for (const f of o.getFiles()) {\r\n const n = outputFolder + f.getFilename().replace(base, \"\");\r\n console.log(\"Write \" + n);\r\n fs.mkdirSync(path.dirname(n), { recursive: true });\r\n fs.writeFileSync(n, f.getRaw());\r\n }\r\n }\r\n }\r\n rename(rconfig) {\r\n const renamer = new abaplint.Rename(this.reg);\r\n for (const o of this.reg.getObjects()) {\r\n if (this.reg.isDependency(o) === true) {\r\n continue;\r\n }\r\n for (const p of rconfig.patterns || []) {\r\n if (!(o.getType().match(p.type))) {\r\n continue;\r\n }\r\n const regex = new RegExp(p.oldName, \"i\");\r\n const match = regex.exec(o.getName());\r\n if (!match) {\r\n continue;\r\n }\r\n o.getFiles().forEach(f => this.deletedFiles.push(f.getFilename()));\r\n const newStr = o.getName().replace(regex, p.newName);\r\n console.log(\"Renaming \" + o.getName().padEnd(30, \" \") + \" -> \" + newStr);\r\n renamer.rename(o.getType(), o.getName(), newStr);\r\n const newObject = this.reg.getObject(o.getType(), newStr);\r\n newObject === null || newObject === void 0 ? void 0 : newObject.getFiles().forEach(f => this.addedFiles.push(f));\r\n }\r\n }\r\n }\r\n skip(rconfig) {\r\n if (rconfig.skip) {\r\n for (const s of rconfig.skip) {\r\n const all = [];\r\n for (const f of this.reg.getFiles()) {\r\n all.push(f);\r\n }\r\n for (const n of all) {\r\n if (n.getFilename().match(s)) {\r\n console.log(n.getFilename() + \" skipped\");\r\n this.reg.removeFile(n);\r\n }\r\n }\r\n }\r\n this.reg.parse();\r\n }\r\n }\r\n}\r\nexports.Rename = Rename;\r\n//# sourceMappingURL=rename.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./build/src/rename.js?");
|
|
163
163
|
|
|
164
164
|
/***/ }),
|
|
165
165
|
|
|
@@ -500,7 +500,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
500
500
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
501
501
|
|
|
502
502
|
"use strict";
|
|
503
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CallTransformationParameters = void 0;\r\nconst
|
|
503
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CallTransformationParameters = void 0;\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst dynamic_1 = __webpack_require__(/*! ./dynamic */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/dynamic.js\");\r\nconst field_1 = __webpack_require__(/*! ./field */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/field.js\");\r\nconst integer_1 = __webpack_require__(/*! ./integer */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/integer.js\");\r\nclass CallTransformationParameters extends combi_1.Expression {\r\n getRunnable() {\r\n const field = (0, combi_1.seq)((0, combi_1.alt)(field_1.Field, integer_1.Integer), \"=\", _1.SimpleSource3);\r\n return (0, combi_1.alt)((0, combi_1.plus)(field), dynamic_1.Dynamic);\r\n }\r\n}\r\nexports.CallTransformationParameters = CallTransformationParameters;\r\n//# sourceMappingURL=call_transformation_parameters.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/call_transformation_parameters.js?");
|
|
504
504
|
|
|
505
505
|
/***/ }),
|
|
506
506
|
|
|
@@ -2788,7 +2788,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
2788
2788
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2789
2789
|
|
|
2790
2790
|
"use strict";
|
|
2791
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CallTransformation = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass CallTransformation {\r\n getMatcher() {\r\n const options = (0, combi_1.seq)(\"OPTIONS\", expressions_1.CallTransformationOptions);\r\n const parameters = (0, combi_1.seq)(\"PARAMETERS\", expressions_1.CallTransformationParameters);\r\n const objects = (0, combi_1.seq)(\"OBJECTS\", expressions_1.CallTransformationParameters);\r\n const source2 = (0, combi_1.seq)(\"XML\", expressions_1.
|
|
2791
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CallTransformation = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass CallTransformation {\r\n getMatcher() {\r\n const options = (0, combi_1.seq)(\"OPTIONS\", expressions_1.CallTransformationOptions);\r\n const parameters = (0, combi_1.seq)(\"PARAMETERS\", expressions_1.CallTransformationParameters);\r\n const objects = (0, combi_1.seq)(\"OBJECTS\", expressions_1.CallTransformationParameters);\r\n const source2 = (0, combi_1.seq)(\"XML\", expressions_1.SimpleSource3);\r\n const source = (0, combi_1.seq)(\"SOURCE\", (0, combi_1.alt)(expressions_1.CallTransformationParameters, source2));\r\n const result2 = (0, combi_1.seq)(\"XML\", expressions_1.Target);\r\n const result = (0, combi_1.seq)(\"RESULT\", (0, combi_1.alt)(expressions_1.CallTransformationParameters, result2));\r\n const call = (0, combi_1.seq)(\"CALL TRANSFORMATION\", (0, combi_1.alt)(expressions_1.NamespaceSimpleName, expressions_1.Dynamic), (0, combi_1.per)(options, parameters, objects, source, result));\r\n return call;\r\n }\r\n}\r\nexports.CallTransformation = CallTransformation;\r\n//# sourceMappingURL=call_transformation.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/statements/call_transformation.js?");
|
|
2792
2792
|
|
|
2793
2793
|
/***/ }),
|
|
2794
2794
|
|
|
@@ -7210,7 +7210,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
7210
7210
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
7211
7211
|
|
|
7212
7212
|
"use strict";
|
|
7213
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CallTransformation = void 0;\r\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst target_1 = __webpack_require__(/*! ../expressions/target */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js\");\r\nconst source_1 = __webpack_require__(/*! ../expressions/source */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js\");\r\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js\");\r\nconst dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js\");\r\nclass CallTransformation {\r\n runSyntax(node, scope, filename) {\r\n for (const s of node.findAllExpressions(Expressions.
|
|
7213
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CallTransformation = void 0;\r\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst target_1 = __webpack_require__(/*! ../expressions/target */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js\");\r\nconst source_1 = __webpack_require__(/*! ../expressions/source */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js\");\r\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js\");\r\nconst dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js\");\r\nclass CallTransformation {\r\n runSyntax(node, scope, filename) {\r\n for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {\r\n new source_1.Source().runSyntax(s, scope, filename);\r\n }\r\n for (const d of node.findAllExpressions(Expressions.Dynamic)) {\r\n new dynamic_1.Dynamic().runSyntax(d, scope, filename);\r\n }\r\n for (const t of node.findAllExpressions(Expressions.Target)) {\r\n const inline = t === null || t === void 0 ? void 0 : t.findDirectExpression(Expressions.InlineData);\r\n if (inline) {\r\n new inline_data_1.InlineData().runSyntax(inline, scope, filename, new basic_1.XStringType());\r\n }\r\n else {\r\n new target_1.Target().runSyntax(t, scope, filename);\r\n }\r\n }\r\n }\r\n}\r\nexports.CallTransformation = CallTransformation;\r\n//# sourceMappingURL=call_transformation.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/call_transformation.js?");
|
|
7214
7214
|
|
|
7215
7215
|
/***/ }),
|
|
7216
7216
|
|
|
@@ -8365,7 +8365,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
8365
8365
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8366
8366
|
|
|
8367
8367
|
"use strict";
|
|
8368
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Data = void 0;\r\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Structures = __webpack_require__(/*! ../../3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../../nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\r\nconst Basic = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst data_1 = __webpack_require__(/*! ../statements/data */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/data.js\");\r\nclass Data {\r\n runSyntax(node, scope, filename) {\r\n var _a
|
|
8368
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Data = void 0;\r\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../../2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Structures = __webpack_require__(/*! ../../3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../../nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\r\nconst Basic = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst data_1 = __webpack_require__(/*! ../statements/data */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/data.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nclass Data {\r\n runSyntax(node, scope, filename) {\r\n var _a;\r\n const name = node.findFirstExpression(Expressions.DefinitionName).getFirstToken();\r\n let table = false;\r\n const components = [];\r\n for (const c of node.getChildren()) {\r\n const ctyp = c.get();\r\n if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.Data) {\r\n const found = new data_1.Data().runSyntax(c, scope, filename);\r\n if (found) {\r\n components.push({ name: found.getName(), type: found.getType() });\r\n }\r\n }\r\n else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Data) {\r\n const found = new Data().runSyntax(c, scope, filename);\r\n if (found) {\r\n components.push({ name: found.getName(), type: found.getType() });\r\n }\r\n }\r\n else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.DataBegin) {\r\n if (c.findDirectTokenByText(\"OCCURS\")) {\r\n table = true;\r\n }\r\n }\r\n else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.IncludeType) {\r\n // INCLUDES\r\n const typeToken = (_a = c.findFirstExpression(Expressions.TypeName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n const typeName = typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr();\r\n const foundId = scope.findType(typeName);\r\n let found = foundId === null || foundId === void 0 ? void 0 : foundId.getType();\r\n if (found === undefined) {\r\n const f = scope.getDDIC().lookupTableOrView(typeName).type;\r\n if (f instanceof _typed_identifier_1.TypedIdentifier) {\r\n found = f.getType();\r\n }\r\n else {\r\n found = f;\r\n }\r\n }\r\n else {\r\n scope.addReference(typeToken, foundId, _reference_1.ReferenceType.TypeReference, filename);\r\n }\r\n if (found instanceof Basic.VoidType) {\r\n if (table === true) {\r\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(found, { withHeader: true }));\r\n }\r\n else {\r\n return new _typed_identifier_1.TypedIdentifier(name, filename, found);\r\n }\r\n }\r\n if (found instanceof Basic.UnknownType) {\r\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.UnknownType(\"unknown type, \" + typeName));\r\n }\r\n if (!(found instanceof Basic.StructureType)) {\r\n throw new Error(\"not structured, \" + typeName);\r\n }\r\n for (const c of found.getComponents()) {\r\n components.push(c);\r\n }\r\n }\r\n }\r\n if (table === true) {\r\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(new Basic.StructureType(components), { withHeader: true }));\r\n }\r\n else {\r\n return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components));\r\n }\r\n }\r\n}\r\nexports.Data = Data;\r\n//# sourceMappingURL=data.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/data.js?");
|
|
8369
8369
|
|
|
8370
8370
|
/***/ }),
|
|
8371
8371
|
|
|
@@ -8827,7 +8827,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
8827
8827
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8828
8828
|
|
|
8829
8829
|
"use strict";
|
|
8830
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.StructureType = 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 StructureType extends _abstract_type_1.AbstractType {\r\n constructor(components,
|
|
8830
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.StructureType = 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 StructureType extends _abstract_type_1.AbstractType {\r\n constructor(components, qualifiedName) {\r\n super(qualifiedName);\r\n if (components.length === 0) {\r\n throw new Error(\"Structure does not contain any components\");\r\n }\r\n this.indexed = {};\r\n for (const c of components) {\r\n const upper = c.name.toUpperCase();\r\n if (this.indexed[upper] !== undefined) {\r\n throw new Error(\"Structure, duplicate field name \\\"\" + upper + \"\\\", \" + qualifiedName);\r\n }\r\n this.indexed[upper] = c.type;\r\n }\r\n this.components = components;\r\n }\r\n getComponents() {\r\n return this.components;\r\n }\r\n getComponentByName(name) {\r\n return this.indexed[name.toUpperCase()];\r\n }\r\n toText(level) {\r\n const compo = [];\r\n for (const c of this.components) {\r\n compo.push(c.name + \" TYPE \" + c.type.toText(level + 1));\r\n }\r\n const spaces = \" \".repeat(level);\r\n return \"Structure\\n\" + spaces + \"* \" + compo.join(\"\\n\" + spaces + \"* \");\r\n }\r\n isGeneric() {\r\n return false;\r\n }\r\n toABAP() {\r\n const ret = this.getQualifiedName();\r\n if (ret) {\r\n return ret;\r\n }\r\n return \"StructureTypetoABAPtodo\";\r\n }\r\n containsVoid() {\r\n return this.getComponents().some(c => { c.type.containsVoid(); });\r\n }\r\n toCDS() {\r\n return \"abap.TODO_STRUCTURE\";\r\n }\r\n}\r\nexports.StructureType = StructureType;\r\n//# sourceMappingURL=structure_type.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/types/basic/structure_type.js?");
|
|
8831
8831
|
|
|
8832
8832
|
/***/ }),
|
|
8833
8833
|
|
|
@@ -11170,7 +11170,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11170
11170
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11171
11171
|
|
|
11172
11172
|
"use strict";
|
|
11173
|
-
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 artifacts_rules_1 = __webpack_require__(/*! ./artifacts_rules */ \"./node_modules/@abaplint/core/build/src/artifacts_rules.js\");\nconst skip_logic_1 = __webpack_require__(/*! ./skip_logic */ \"./node_modules/@abaplint/core/build/src/skip_logic.js\");\nconst _abap_object_1 = __webpack_require__(/*! ./objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.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 syntax_1 = __webpack_require__(/*! ./abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.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\");\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 /** object containing filenames of dependencies */\n this.dependencies = {};\n this.issues = [];\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.84.3\";\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 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) {\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 const found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n found.addFile(f);\n }\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.dependencies[f.getFilename().toUpperCase()] = true;\n }\n return this.addFiles(files);\n }\n addDependency(file) {\n this.dependencies[file.getFilename().toUpperCase()] = true;\n this.addFile(file);\n return this;\n }\n isDependency(obj) {\n const filename = obj.getFiles()[0].getFilename().toUpperCase();\n return this.dependencies[filename] === true;\n }\n isFileDependency(filename) {\n return this.dependencies[filename.toUpperCase()] === 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 this.runRules(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 this.runRules(undefined, 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 this.issues = [];\n for (const o of this.getObjects()) {\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\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 this.issues = [];\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 this.issues.push(...o.getParsingIssues());\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);\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 runRules(input, iobj) {\n var _a, _b, _c, _d, _e, _f;\n const rulePerformance = {};\n const issues = this.issues.slice(0);\n const objects = iobj ? [iobj] : this.getObjects();\n const rules = this.conf.getEnabledRules();\n const skipLogic = new skip_logic_1.SkipLogic(this);\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(iobj ? 1 : this.getObjectCount(false), \"Run Syntax\");\n const check = [];\n for (const obj of objects) {\n (_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Run Syntax - \" + obj.getName());\n if (skipLogic.skip(obj) || this.isDependency(obj)) {\n continue;\n }\n if (obj instanceof _abap_object_1.ABAPObject) {\n new syntax_1.SyntaxLogic(this, obj).run();\n }\n check.push(obj);\n }\n (_c = input === null || input === void 0 ? void 0 : input.progress) === null || _c === void 0 ? void 0 : _c.set(rules.length, \"Initialize Rules\");\n for (const rule of rules) {\n (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick(\"Initialize Rules - \" + rule.getMetadata().key);\n if (rule.initialize === undefined) {\n throw new Error(rule.getMetadata().key + \" missing initialize method\");\n }\n rule.initialize(this);\n rulePerformance[rule.getMetadata().key] = 0;\n }\n (_e = input === null || input === void 0 ? void 0 : input.progress) === null || _e === void 0 ? void 0 : _e.set(check.length, \"Finding Issues\");\n for (const obj of check) {\n (_f = input === null || input === void 0 ? void 0 : input.progress) === null || _f === void 0 ? void 0 : _f.tick(\"Finding Issues - \" + obj.getType() + \" \" + obj.getName());\n for (const rule of rules) {\n const before = Date.now();\n issues.push(...rule.run(obj));\n const runtime = Date.now() - before;\n rulePerformance[rule.getMetadata().key] = rulePerformance[rule.getMetadata().key] + runtime;\n }\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n const perf = [];\n for (const p in rulePerformance) {\n if (rulePerformance[p] > 100) { // ignore rules if it takes less than 100ms\n perf.push({ name: p, time: rulePerformance[p] });\n }\n }\n perf.sort((a, b) => { return b.time - a.time; });\n for (const p of perf) {\n process.stderr.write(\"\\t\" + p.time + \"ms\\t\" + p.name + \"\\n\");\n }\n }\n return this.excludeIssues(issues);\n }\n excludeIssues(issues) {\n var _a;\n const ret = issues;\n const globalNoIssues = this.conf.getGlobal().noIssues || [];\n const globalNoIssuesPatterns = globalNoIssues.map(x => new RegExp(x, \"i\"));\n if (globalNoIssuesPatterns.length > 0) {\n for (let i = ret.length - 1; i >= 0; i--) {\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, globalNoIssuesPatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n // exclude issues, as now we know both the filename and issue key\n for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {\n const key = rule.getMetadata().key;\n const ruleExclude = (_a = this.conf.readByKey(key, \"exclude\")) !== null && _a !== void 0 ? _a : [];\n if (ruleExclude.length === 0) {\n continue;\n }\n const ruleExcludePatterns = ruleExclude.map(x => new RegExp(x, \"i\"));\n for (let i = ret.length - 1; i >= 0; i--) {\n if (ret[i].getKey() !== key) {\n continue;\n }\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, ruleExcludePatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n return ret;\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/cli/./node_modules/@abaplint/core/build/src/registry.js?");
|
|
11173
|
+
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 artifacts_rules_1 = __webpack_require__(/*! ./artifacts_rules */ \"./node_modules/@abaplint/core/build/src/artifacts_rules.js\");\nconst skip_logic_1 = __webpack_require__(/*! ./skip_logic */ \"./node_modules/@abaplint/core/build/src/skip_logic.js\");\nconst _abap_object_1 = __webpack_require__(/*! ./objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.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 syntax_1 = __webpack_require__(/*! ./abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.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\");\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 /** object containing filenames of dependencies */\n this.dependencies = {};\n this.issues = [];\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.84.7\";\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 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) {\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 const found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n found.addFile(f);\n }\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.dependencies[f.getFilename().toUpperCase()] = true;\n }\n return this.addFiles(files);\n }\n addDependency(file) {\n this.dependencies[file.getFilename().toUpperCase()] = true;\n this.addFile(file);\n return this;\n }\n isDependency(obj) {\n const filename = obj.getFiles()[0].getFilename().toUpperCase();\n return this.dependencies[filename] === true;\n }\n isFileDependency(filename) {\n return this.dependencies[filename.toUpperCase()] === 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 this.runRules(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 this.runRules(undefined, 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 this.issues = [];\n for (const o of this.getObjects()) {\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\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 this.issues = [];\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 this.issues.push(...o.getParsingIssues());\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);\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 runRules(input, iobj) {\n var _a, _b, _c, _d, _e, _f;\n const rulePerformance = {};\n const issues = this.issues.slice(0);\n const objects = iobj ? [iobj] : this.getObjects();\n const rules = this.conf.getEnabledRules();\n const skipLogic = new skip_logic_1.SkipLogic(this);\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(iobj ? 1 : this.getObjectCount(false), \"Run Syntax\");\n const check = [];\n for (const obj of objects) {\n (_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Run Syntax - \" + obj.getName());\n if (skipLogic.skip(obj) || this.isDependency(obj)) {\n continue;\n }\n if (obj instanceof _abap_object_1.ABAPObject) {\n new syntax_1.SyntaxLogic(this, obj).run();\n }\n check.push(obj);\n }\n (_c = input === null || input === void 0 ? void 0 : input.progress) === null || _c === void 0 ? void 0 : _c.set(rules.length, \"Initialize Rules\");\n for (const rule of rules) {\n (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick(\"Initialize Rules - \" + rule.getMetadata().key);\n if (rule.initialize === undefined) {\n throw new Error(rule.getMetadata().key + \" missing initialize method\");\n }\n rule.initialize(this);\n rulePerformance[rule.getMetadata().key] = 0;\n }\n (_e = input === null || input === void 0 ? void 0 : input.progress) === null || _e === void 0 ? void 0 : _e.set(check.length, \"Finding Issues\");\n for (const obj of check) {\n (_f = input === null || input === void 0 ? void 0 : input.progress) === null || _f === void 0 ? void 0 : _f.tick(\"Finding Issues - \" + obj.getType() + \" \" + obj.getName());\n for (const rule of rules) {\n const before = Date.now();\n issues.push(...rule.run(obj));\n const runtime = Date.now() - before;\n rulePerformance[rule.getMetadata().key] = rulePerformance[rule.getMetadata().key] + runtime;\n }\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n const perf = [];\n for (const p in rulePerformance) {\n if (rulePerformance[p] > 100) { // ignore rules if it takes less than 100ms\n perf.push({ name: p, time: rulePerformance[p] });\n }\n }\n perf.sort((a, b) => { return b.time - a.time; });\n for (const p of perf) {\n process.stderr.write(\"\\t\" + p.time + \"ms\\t\" + p.name + \"\\n\");\n }\n }\n return this.excludeIssues(issues);\n }\n excludeIssues(issues) {\n var _a;\n const ret = issues;\n const globalNoIssues = this.conf.getGlobal().noIssues || [];\n const globalNoIssuesPatterns = globalNoIssues.map(x => new RegExp(x, \"i\"));\n if (globalNoIssuesPatterns.length > 0) {\n for (let i = ret.length - 1; i >= 0; i--) {\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, globalNoIssuesPatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n // exclude issues, as now we know both the filename and issue key\n for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {\n const key = rule.getMetadata().key;\n const ruleExclude = (_a = this.conf.readByKey(key, \"exclude\")) !== null && _a !== void 0 ? _a : [];\n if (ruleExclude.length === 0) {\n continue;\n }\n const ruleExcludePatterns = ruleExclude.map(x => new RegExp(x, \"i\"));\n for (let i = ret.length - 1; i >= 0; i--) {\n if (ret[i].getKey() !== key) {\n continue;\n }\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, ruleExcludePatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n return ret;\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/cli/./node_modules/@abaplint/core/build/src/registry.js?");
|
|
11174
11174
|
|
|
11175
11175
|
/***/ }),
|
|
11176
11176
|
|
package/build/src/fixes.js
CHANGED
|
@@ -1,74 +1,86 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ApplyFixes = void 0;
|
|
4
4
|
const core_1 = require("@abaplint/core");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
class ApplyFixes {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.changedFiles = new Set();
|
|
8
|
+
}
|
|
9
|
+
applyFixes(inputIssues, reg, fs, bar) {
|
|
10
|
+
let changed = [];
|
|
11
|
+
let iteration = 1;
|
|
12
|
+
let issues = inputIssues;
|
|
13
|
+
this.changedFiles.clear();
|
|
14
|
+
const MAX_ITERATIONS = 50000;
|
|
15
|
+
bar === null || bar === void 0 ? void 0 : bar.set(MAX_ITERATIONS, "Apply Fixes");
|
|
16
|
+
while (iteration <= MAX_ITERATIONS) {
|
|
17
|
+
bar === null || bar === void 0 ? void 0 : bar.tick("Apply Fixes, iteration " + iteration + ", " + issues.length + " candidates");
|
|
18
|
+
changed = this.applyList(issues, reg);
|
|
19
|
+
if (changed.length === 0) {
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
iteration++;
|
|
23
|
+
issues = reg.parse().findIssues();
|
|
24
|
+
}
|
|
25
|
+
this.writeChangesToFS(fs, reg);
|
|
26
|
+
// always end the progress indicator at 100%
|
|
27
|
+
while (iteration <= MAX_ITERATIONS) {
|
|
28
|
+
bar === null || bar === void 0 ? void 0 : bar.tick("Fixes Applied");
|
|
29
|
+
iteration++;
|
|
16
30
|
}
|
|
17
|
-
|
|
18
|
-
issues = reg.parse().findIssues();
|
|
31
|
+
return issues;
|
|
19
32
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
writeChangesToFS(fs, reg) {
|
|
34
|
+
for (const filename of this.changedFiles.values()) {
|
|
35
|
+
const file = reg.getFileByName(filename);
|
|
36
|
+
if (file === undefined) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
fs.writeFileSync(file.getFilename(), file.getRaw());
|
|
40
|
+
}
|
|
24
41
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
&& list2.range.end.getRow() >= list1.range.end.getRow()) {
|
|
42
|
-
return true;
|
|
42
|
+
possibleOverlap(edit, list) {
|
|
43
|
+
// only checks if the edits have changes in the same rows
|
|
44
|
+
for (const e of list) {
|
|
45
|
+
for (const file1 of Object.keys(e)) {
|
|
46
|
+
for (const file2 of Object.keys(edit)) {
|
|
47
|
+
if (file1 === file2) {
|
|
48
|
+
for (const list1 of e[file1]) {
|
|
49
|
+
for (const list2 of edit[file2]) {
|
|
50
|
+
if (list2.range.start.getRow() <= list1.range.start.getRow()
|
|
51
|
+
&& list2.range.end.getRow() >= list1.range.start.getRow()) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (list2.range.start.getRow() <= list1.range.start.getRow()
|
|
55
|
+
&& list2.range.end.getRow() >= list1.range.end.getRow()) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
43
58
|
}
|
|
44
59
|
}
|
|
45
60
|
}
|
|
46
61
|
}
|
|
47
62
|
}
|
|
48
63
|
}
|
|
64
|
+
return false;
|
|
49
65
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
applyList(issues, reg) {
|
|
67
|
+
const edits = [];
|
|
68
|
+
for (const i of issues) {
|
|
69
|
+
const edit = i.getFix();
|
|
70
|
+
if (edit === undefined) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
else if (this.possibleOverlap(edit, edits) === true) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
edits.push(edit);
|
|
61
77
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
for (const filename of changed) {
|
|
66
|
-
const file = reg.getFileByName(filename);
|
|
67
|
-
if (file === undefined) {
|
|
68
|
-
continue;
|
|
78
|
+
const changed = (0, core_1.applyEditList)(reg, edits);
|
|
79
|
+
for (const filename of changed) {
|
|
80
|
+
this.changedFiles.add(filename);
|
|
69
81
|
}
|
|
70
|
-
|
|
82
|
+
return changed;
|
|
71
83
|
}
|
|
72
|
-
return changed;
|
|
73
84
|
}
|
|
85
|
+
exports.ApplyFixes = ApplyFixes;
|
|
74
86
|
//# sourceMappingURL=fixes.js.map
|
package/build/src/index.js
CHANGED
|
@@ -186,7 +186,7 @@ async function run(arg) {
|
|
|
186
186
|
}
|
|
187
187
|
let extra = "";
|
|
188
188
|
if (arg.runFix === true && reg) {
|
|
189
|
-
issues =
|
|
189
|
+
issues = new fixes_1.ApplyFixes().applyFixes(issues, reg, fs, progress);
|
|
190
190
|
extra = "Fixes applied";
|
|
191
191
|
}
|
|
192
192
|
else if (arg.runRename === true && reg) {
|
package/build/src/rename.js
CHANGED
|
@@ -7,6 +7,8 @@ const fs = require("fs");
|
|
|
7
7
|
const file_operations_1 = require("./file_operations");
|
|
8
8
|
class Rename {
|
|
9
9
|
constructor(reg) {
|
|
10
|
+
this.deletedFiles = [];
|
|
11
|
+
this.addedFiles = [];
|
|
10
12
|
this.reg = reg;
|
|
11
13
|
}
|
|
12
14
|
run(config, base) {
|
|
@@ -16,7 +18,21 @@ class Rename {
|
|
|
16
18
|
}
|
|
17
19
|
this.skip(rconfig);
|
|
18
20
|
this.rename(rconfig);
|
|
19
|
-
|
|
21
|
+
if (rconfig.output === undefined || rconfig.output === "") {
|
|
22
|
+
// write changes inline
|
|
23
|
+
this.deletedFiles.forEach(f => {
|
|
24
|
+
console.log("rm " + f);
|
|
25
|
+
fs.rmSync(f);
|
|
26
|
+
});
|
|
27
|
+
this.addedFiles.forEach(f => {
|
|
28
|
+
console.log("write " + f.getFilename());
|
|
29
|
+
fs.writeFileSync(f.getFilename(), f.getRaw());
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
// output full registry contents to output folder
|
|
34
|
+
this.write(rconfig, base);
|
|
35
|
+
}
|
|
20
36
|
}
|
|
21
37
|
////////////////////////
|
|
22
38
|
write(rconfig, base) {
|
|
@@ -51,9 +67,12 @@ class Rename {
|
|
|
51
67
|
if (!match) {
|
|
52
68
|
continue;
|
|
53
69
|
}
|
|
70
|
+
o.getFiles().forEach(f => this.deletedFiles.push(f.getFilename()));
|
|
54
71
|
const newStr = o.getName().replace(regex, p.newName);
|
|
55
72
|
console.log("Renaming " + o.getName().padEnd(30, " ") + " -> " + newStr);
|
|
56
73
|
renamer.rename(o.getType(), o.getName(), newStr);
|
|
74
|
+
const newObject = this.reg.getObject(o.getType(), newStr);
|
|
75
|
+
newObject === null || newObject === void 0 ? void 0 : newObject.getFiles().forEach(f => this.addedFiles.push(f));
|
|
57
76
|
}
|
|
58
77
|
}
|
|
59
78
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.84.
|
|
3
|
+
"version": "2.84.7",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abaplint": "./abaplint"
|
|
@@ -39,25 +39,25 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://abaplint.org",
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@abaplint/core": "^2.84.
|
|
42
|
+
"@abaplint/core": "^2.84.7",
|
|
43
43
|
"@types/chai": "^4.3.0",
|
|
44
44
|
"@types/glob": "^7.2.0",
|
|
45
45
|
"@types/minimist": "^1.2.2",
|
|
46
|
-
"@types/mocha": "^9.
|
|
47
|
-
"@types/node": "^17.0.
|
|
46
|
+
"@types/mocha": "^9.1.0",
|
|
47
|
+
"@types/node": "^17.0.12",
|
|
48
48
|
"@types/progress": "^2.0.5",
|
|
49
|
-
"chai": "^4.3.
|
|
49
|
+
"chai": "^4.3.5",
|
|
50
50
|
"chalk": "=4.1.2",
|
|
51
51
|
"eslint": "^8.7.0",
|
|
52
52
|
"glob": "^7.2.0",
|
|
53
53
|
"json5": "^2.2.0",
|
|
54
54
|
"memfs": "^3.4.1",
|
|
55
55
|
"minimist": "^1.2.5",
|
|
56
|
-
"mocha": "^9.
|
|
56
|
+
"mocha": "^9.2.0",
|
|
57
57
|
"progress": "^2.0.3",
|
|
58
|
-
"typescript": "^4.5.
|
|
59
|
-
"webpack": "^5.
|
|
60
|
-
"webpack-cli": "^4.9.
|
|
58
|
+
"typescript": "^4.5.5",
|
|
59
|
+
"webpack": "^5.67.0",
|
|
60
|
+
"webpack-cli": "^4.9.2",
|
|
61
61
|
"xml-js": "^1.6.11"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {}
|