ui5_easy_use
Version:
A utility package for UI5 projects
1,676 lines (1,381 loc) • 468 kB
JavaScript
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 181:
/***/ ((module) => {
"use strict";
module.exports = require("buffer");
/***/ }),
/***/ 264:
/***/ ((module) => {
"use strict";
module.exports = require("inspector");
/***/ }),
/***/ 481:
/***/ ((module) => {
"use strict";
module.exports = require("node:readline");
/***/ }),
/***/ 734:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
const conversions = __webpack_require__(8040);
const route = __webpack_require__(8507);
const convert = {};
const models = Object.keys(conversions);
function wrapRaw(fn) {
const wrappedFn = function (...args) {
const arg0 = args[0];
if (arg0 === undefined || arg0 === null) {
return arg0;
}
if (arg0.length > 1) {
args = arg0;
}
return fn(args);
};
// Preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
function wrapRounded(fn) {
const wrappedFn = function (...args) {
const arg0 = args[0];
if (arg0 === undefined || arg0 === null) {
return arg0;
}
if (arg0.length > 1) {
args = arg0;
}
const result = fn(args);
// We're assuming the result is an array here.
// see notice in conversions.js; don't use box types
// in conversion functions.
if (typeof result === 'object') {
for (let len = result.length, i = 0; i < len; i++) {
result[i] = Math.round(result[i]);
}
}
return result;
};
// Preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
models.forEach(fromModel => {
convert[fromModel] = {};
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
const routes = route(fromModel);
const routeModels = Object.keys(routes);
routeModels.forEach(toModel => {
const fn = routes[toModel];
convert[fromModel][toModel] = wrapRounded(fn);
convert[fromModel][toModel].raw = wrapRaw(fn);
});
});
module.exports = convert;
/***/ }),
/***/ 846:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
const { XMLi18nTranslator } = __webpack_require__(8199);
const mainPath = 'i18n';
/**
* Handler function to allow users to select files and folders interactively.
* @param {Object} context - The context object containing `fileHandler` and `cliHandler`.
* @returns {Promise<string[]>} - Array of selected file paths.
*/
const handlerGetPaths = async (context) => {
const { fileHandler, cliHandler } = context;
let selectedPaths = [];
/**
* Recursively process directories and collect selected files.
* @param {string} currentPath - The current directory path to process.
*/
const recursiveSelect = async (currentPath) => {
try {
const items = fileHandler.listItemsWithMetadata(currentPath);
const selectedItems = await cliHandler.displayCheckboxList(
items.map(item => ({
name: item.name,
value: item.path,
short: item.name
})),
`Select files or folders inside: ${currentPath || 'root'}`
);
const selectedFolders = selectedItems.filter(item =>
items.find(choice => choice.path === item && choice.isFolder)
);
const selectedFiles = selectedItems.filter(item =>
!selectedFolders.includes(item)
);
selectedPaths.push(...selectedFiles);
for (const folder of selectedFolders) {
if (selectedItems.length === 1 && selectedFolders.length === 1) {
await recursiveSelect(folder);
} else {
const allFilesInFolder = fileHandler.getAllFilesRecursively(folder);
selectedPaths.push(...allFilesInFolder);
}
}
} catch (error) {
console.error("An error occurred during selection:", error.message);
throw error;
}
};
try {
await recursiveSelect(fileHandler.currentPath);
return selectedPaths;
} catch (error) {
console.error("Operation aborted or failed:", error.message);
return [];
}
};
/**
* Main i18n handler object.
*/
const main_i18n = {
message: '\n-----------\nSelect Action:',
parent: 'main',
choices: [
{
name: 'Auto Binding',
value: 'full',
handler: async (context) => {
const helper = new context.Helper();
const selectedPathsXML = await helper.handlerGetPaths(context);
if (!selectedPathsXML.length) {
return;
}
for (const selectedPathXML of selectedPathsXML) {
const pageName = selectedPathXML;
const xmlString = context.fileHandler.readFile(selectedPathXML);
const config = JSON.parse(context.fileHandler.readFile(context.constant.env.configPath("i18n")));
const keysI18N = config.keys;
const translator = new XMLi18nTranslator(xmlString, pageName, keysI18N, context.Logger);
if (!translator.i18nProperties) {
continue;
}
context.fileHandler.writeFile(selectedPathXML, translator.xmlString);
context.fileHandler.addKeysToI18nFile(`${mainPath}/i18n_en_US.properties`, translator.i18nProperties, selectedPathXML);
}
}
}
]
};
const i18nAll = {
main_i18n
};
module.exports = i18nAll;
/***/ }),
/***/ 857:
/***/ ((module) => {
"use strict";
module.exports = require("os");
/***/ }),
/***/ 1146:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
const form_menu = __webpack_require__(8403);
const table_menu = __webpack_require__(8973);
const main_components = {
message: '\n-----------\nSelect Action',
parent: 'main', // Allows navigating back to the main menu
choices: [
{ name: '📄 Form Menu:', value: 'form_menu', submenu: 'form_menu' },
{ name: '📊 Table Menu:', value: 'table_menu', submenu: 'table_menu' },]
};
const componentsAll = {
main_components,
...form_menu,
...table_menu
}
module.exports = componentsAll;
/***/ }),
/***/ 1391:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
const fs = __webpack_require__(9896);
const path = __webpack_require__(6928);
class JSONFileManager {
constructor(filePath, fileHandler) {
this.fileHandler = fileHandler;
this.filePath = filePath;
}
// Read and parse the JSON file
getContents() {
const content = this.fileHandler.readFile(this.filePath, 'utf-8');
return JSON.parse(content);
}
// Update JSON file with new content
updateFile(newContent) {
const jsonData = JSON.stringify(newContent, null, 2);
this.fileHandler.writeFile(this.filePath, jsonData);
this.fileHandler.logger.log(`File updated: ${this.filePath}`);
}
// Apply a template to the JSON file
applyTemplate(template) {
const currentContent = this.getContents();
const updatedContent = { ...currentContent, ...template };
this.updateFile(updatedContent);
}
// Update specific key-value pair
updateKeyValue(key, value) {
const content = this.getContents();
content[key] = value;
this.updateFile(content);
}
}
module.exports = { JSONFileManager };
/***/ }),
/***/ 1708:
/***/ ((module) => {
"use strict";
module.exports = require("node:process");
/***/ }),
/***/ 1746:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
const { JSONFileManager } = __webpack_require__(1391);
class NavListManager extends JSONFileManager {
constructor(fileHandler) {
super('model/navList.json', fileHandler); // Initialize with the navList.json file
}
/**
* Get the navigation entry for a specific page.
* @param {string} pageName - The name of the page.
* @returns {Object[]} - The navigation entry for the page.
*/
getNavigation(pageName) {
const navList = this.getContents(); // Load the current contents of navList.json
return [
{
title: pageName,
icon: "sap-icon://settings", // Default icon, can be customized
key: `Route${pageName}`
}
];
}
/**
* Add or update a navigation entry for a specific page.
* @param {string} pageName - The name of the page.
* @param {string} [icon="sap-icon://settings"] - The icon for the navigation entry.
*/
setNavigation(pageName, icon = "sap-icon://settings") {
const navList = this.getContents(); // Load the current contents of navList.json
// Ensure the structure exists
navList.navigation = navList.navigation || [];
navList.AddtionNavigation = navList.AddtionNavigation || [];
// Check if the navigation entry already exists
const existingEntry = navList.navigation.find(nav => nav.key === `Route${pageName}`);
if (!existingEntry) {
// Add a new navigation entry
navList.navigation.push({
title: pageName,
icon: icon,
key: `Route${pageName}`
});
}
// Save the updated navigation list back to the file
this.updateFile(navList);
}
/**
* Get all navigation entries.
* @returns {Object} - The entire navigation data.
*/
getAllNavigation() {
return this.getContents();
}
/**
* Clear all navigation entries (for testing or reset purposes).
*/
clearNavigation() {
this.updateFile({
navigation: [],
AddtionNavigation: []
});
}
}
module.exports = { NavListManager };
/***/ }),
/***/ 2018:
/***/ ((module) => {
"use strict";
module.exports = require("tty");
/***/ }),
/***/ 2109:
/***/ ((module) => {
class Helper {
/**
* Handler function to allow users to select files and folders interactively.
* @param {Object} context - The context object containing `fileHandler` and `cliHandler`.
* @returns {Promise<string[]>} - Array of selected file paths.
*/
async handlerGetPaths(context) {
const { fileHandler, cliHandler } = context;
let selectedPaths = [];
/**
* Recursively process directories and collect selected files.
* @param {string} currentPath - The current directory path to process.
*/
const recursiveSelect = async (currentPath) => {
try {
const items = fileHandler.listItemsWithMetadata(currentPath);
const selectedItems = await cliHandler.displayCheckboxList(
items.map(item => ({
name: item.name,
value: item.path,
short: item.name
})),
`Select files or folders inside: ${currentPath || 'root'}`
);
const selectedFolders = selectedItems.filter(item =>
items.find(choice => choice.path === item && choice.isFolder)
);
const selectedFiles = selectedItems.filter(item =>
!selectedFolders.includes(item)
);
selectedPaths.push(...selectedFiles);
for (const folder of selectedFolders) {
if (selectedItems.length === 1 && selectedFolders.length === 1) {
await recursiveSelect(folder);
} else {
const allFilesInFolder = fileHandler.getAllFilesRecursively(folder);
selectedPaths.push(...allFilesInFolder);
}
}
} catch (error) {
console.error("An error occurred during selection:", error.message);
throw error;
}
};
try {
await recursiveSelect(fileHandler.currentPath);
return selectedPaths;
} catch (error) {
console.error("Operation aborted or failed:", error.message);
return [];
}
}
}
module.exports = { Helper };
/***/ }),
/***/ 2203:
/***/ ((module) => {
"use strict";
module.exports = require("stream");
/***/ }),
/***/ 2268:
/***/ (function(__unused_webpack_module, exports) {
(function (global, factory) {
true ? factory(exports) :
0;
})(this, (function (exports) { 'use strict';
// AST walker module for ESTree compatible trees
// A simple walk is one where you simply specify callbacks to be
// called on specific nodes. The last two arguments are optional. A
// simple use would be
//
// walk.simple(myTree, {
// Expression: function(node) { ... }
// });
//
// to do something with all expressions. All ESTree node types
// can be used to identify node types, as well as Expression and
// Statement, which denote categories of nodes.
//
// The base argument can be used to pass a custom (recursive)
// walker, and state can be used to give this walked an initial
// state.
function simple(node, visitors, baseVisitor, state, override) {
if (!baseVisitor) { baseVisitor = base
; }(function c(node, st, override) {
var type = override || node.type;
baseVisitor[type](node, st, c);
if (visitors[type]) { visitors[type](node, st); }
})(node, state, override);
}
// An ancestor walk keeps an array of ancestor nodes (including the
// current node) and passes them to the callback as third parameter
// (and also as state parameter when no other state is present).
function ancestor(node, visitors, baseVisitor, state, override) {
var ancestors = [];
if (!baseVisitor) { baseVisitor = base
; }(function c(node, st, override) {
var type = override || node.type;
var isNew = node !== ancestors[ancestors.length - 1];
if (isNew) { ancestors.push(node); }
baseVisitor[type](node, st, c);
if (visitors[type]) { visitors[type](node, st || ancestors, ancestors); }
if (isNew) { ancestors.pop(); }
})(node, state, override);
}
// A recursive walk is one where your functions override the default
// walkers. They can modify and replace the state parameter that's
// threaded through the walk, and can opt how and whether to walk
// their child nodes (by calling their third argument on these
// nodes).
function recursive(node, state, funcs, baseVisitor, override) {
var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor
;(function c(node, st, override) {
visitor[override || node.type](node, st, c);
})(node, state, override);
}
function makeTest(test) {
if (typeof test === "string")
{ return function (type) { return type === test; } }
else if (!test)
{ return function () { return true; } }
else
{ return test }
}
var Found = function Found(node, state) { this.node = node; this.state = state; };
// A full walk triggers the callback on each node
function full(node, callback, baseVisitor, state, override) {
if (!baseVisitor) { baseVisitor = base; }
var last
;(function c(node, st, override) {
var type = override || node.type;
baseVisitor[type](node, st, c);
if (last !== node) {
callback(node, st, type);
last = node;
}
})(node, state, override);
}
// An fullAncestor walk is like an ancestor walk, but triggers
// the callback on each node
function fullAncestor(node, callback, baseVisitor, state) {
if (!baseVisitor) { baseVisitor = base; }
var ancestors = [], last
;(function c(node, st, override) {
var type = override || node.type;
var isNew = node !== ancestors[ancestors.length - 1];
if (isNew) { ancestors.push(node); }
baseVisitor[type](node, st, c);
if (last !== node) {
callback(node, st || ancestors, ancestors, type);
last = node;
}
if (isNew) { ancestors.pop(); }
})(node, state);
}
// Find a node with a given start, end, and type (all are optional,
// null can be used as wildcard). Returns a {node, state} object, or
// undefined when it doesn't find a matching node.
function findNodeAt(node, start, end, test, baseVisitor, state) {
if (!baseVisitor) { baseVisitor = base; }
test = makeTest(test);
try {
(function c(node, st, override) {
var type = override || node.type;
if ((start == null || node.start <= start) &&
(end == null || node.end >= end))
{ baseVisitor[type](node, st, c); }
if ((start == null || node.start === start) &&
(end == null || node.end === end) &&
test(type, node))
{ throw new Found(node, st) }
})(node, state);
} catch (e) {
if (e instanceof Found) { return e }
throw e
}
}
// Find the innermost node of a given type that contains the given
// position. Interface similar to findNodeAt.
function findNodeAround(node, pos, test, baseVisitor, state) {
test = makeTest(test);
if (!baseVisitor) { baseVisitor = base; }
try {
(function c(node, st, override) {
var type = override || node.type;
if (node.start > pos || node.end < pos) { return }
baseVisitor[type](node, st, c);
if (test(type, node)) { throw new Found(node, st) }
})(node, state);
} catch (e) {
if (e instanceof Found) { return e }
throw e
}
}
// Find the outermost matching node after a given position.
function findNodeAfter(node, pos, test, baseVisitor, state) {
test = makeTest(test);
if (!baseVisitor) { baseVisitor = base; }
try {
(function c(node, st, override) {
if (node.end < pos) { return }
var type = override || node.type;
if (node.start >= pos && test(type, node)) { throw new Found(node, st) }
baseVisitor[type](node, st, c);
})(node, state);
} catch (e) {
if (e instanceof Found) { return e }
throw e
}
}
// Find the outermost matching node before a given position.
function findNodeBefore(node, pos, test, baseVisitor, state) {
test = makeTest(test);
if (!baseVisitor) { baseVisitor = base; }
var max
;(function c(node, st, override) {
if (node.start > pos) { return }
var type = override || node.type;
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
{ max = new Found(node, st); }
baseVisitor[type](node, st, c);
})(node, state);
return max
}
// Used to create a custom walker. Will fill in all missing node
// type properties with the defaults.
function make(funcs, baseVisitor) {
var visitor = Object.create(baseVisitor || base);
for (var type in funcs) { visitor[type] = funcs[type]; }
return visitor
}
function skipThrough(node, st, c) { c(node, st); }
function ignore(_node, _st, _c) {}
// Node walkers.
var base = {};
base.Program = base.BlockStatement = base.StaticBlock = function (node, st, c) {
for (var i = 0, list = node.body; i < list.length; i += 1)
{
var stmt = list[i];
c(stmt, st, "Statement");
}
};
base.Statement = skipThrough;
base.EmptyStatement = ignore;
base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression =
function (node, st, c) { return c(node.expression, st, "Expression"); };
base.IfStatement = function (node, st, c) {
c(node.test, st, "Expression");
c(node.consequent, st, "Statement");
if (node.alternate) { c(node.alternate, st, "Statement"); }
};
base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
base.BreakStatement = base.ContinueStatement = ignore;
base.WithStatement = function (node, st, c) {
c(node.object, st, "Expression");
c(node.body, st, "Statement");
};
base.SwitchStatement = function (node, st, c) {
c(node.discriminant, st, "Expression");
for (var i = 0, list = node.cases; i < list.length; i += 1) {
var cs = list[i];
c(cs, st);
}
};
base.SwitchCase = function (node, st, c) {
if (node.test) { c(node.test, st, "Expression"); }
for (var i = 0, list = node.consequent; i < list.length; i += 1)
{
var cons = list[i];
c(cons, st, "Statement");
}
};
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
if (node.argument) { c(node.argument, st, "Expression"); }
};
base.ThrowStatement = base.SpreadElement =
function (node, st, c) { return c(node.argument, st, "Expression"); };
base.TryStatement = function (node, st, c) {
c(node.block, st, "Statement");
if (node.handler) { c(node.handler, st); }
if (node.finalizer) { c(node.finalizer, st, "Statement"); }
};
base.CatchClause = function (node, st, c) {
if (node.param) { c(node.param, st, "Pattern"); }
c(node.body, st, "Statement");
};
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
c(node.test, st, "Expression");
c(node.body, st, "Statement");
};
base.ForStatement = function (node, st, c) {
if (node.init) { c(node.init, st, "ForInit"); }
if (node.test) { c(node.test, st, "Expression"); }
if (node.update) { c(node.update, st, "Expression"); }
c(node.body, st, "Statement");
};
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
c(node.left, st, "ForInit");
c(node.right, st, "Expression");
c(node.body, st, "Statement");
};
base.ForInit = function (node, st, c) {
if (node.type === "VariableDeclaration") { c(node, st); }
else { c(node, st, "Expression"); }
};
base.DebuggerStatement = ignore;
base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
base.VariableDeclaration = function (node, st, c) {
for (var i = 0, list = node.declarations; i < list.length; i += 1)
{
var decl = list[i];
c(decl, st);
}
};
base.VariableDeclarator = function (node, st, c) {
c(node.id, st, "Pattern");
if (node.init) { c(node.init, st, "Expression"); }
};
base.Function = function (node, st, c) {
if (node.id) { c(node.id, st, "Pattern"); }
for (var i = 0, list = node.params; i < list.length; i += 1)
{
var param = list[i];
c(param, st, "Pattern");
}
c(node.body, st, node.expression ? "Expression" : "Statement");
};
base.Pattern = function (node, st, c) {
if (node.type === "Identifier")
{ c(node, st, "VariablePattern"); }
else if (node.type === "MemberExpression")
{ c(node, st, "MemberPattern"); }
else
{ c(node, st); }
};
base.VariablePattern = ignore;
base.MemberPattern = skipThrough;
base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
base.ArrayPattern = function (node, st, c) {
for (var i = 0, list = node.elements; i < list.length; i += 1) {
var elt = list[i];
if (elt) { c(elt, st, "Pattern"); }
}
};
base.ObjectPattern = function (node, st, c) {
for (var i = 0, list = node.properties; i < list.length; i += 1) {
var prop = list[i];
if (prop.type === "Property") {
if (prop.computed) { c(prop.key, st, "Expression"); }
c(prop.value, st, "Pattern");
} else if (prop.type === "RestElement") {
c(prop.argument, st, "Pattern");
}
}
};
base.Expression = skipThrough;
base.ThisExpression = base.Super = base.MetaProperty = ignore;
base.ArrayExpression = function (node, st, c) {
for (var i = 0, list = node.elements; i < list.length; i += 1) {
var elt = list[i];
if (elt) { c(elt, st, "Expression"); }
}
};
base.ObjectExpression = function (node, st, c) {
for (var i = 0, list = node.properties; i < list.length; i += 1)
{
var prop = list[i];
c(prop, st);
}
};
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
base.SequenceExpression = function (node, st, c) {
for (var i = 0, list = node.expressions; i < list.length; i += 1)
{
var expr = list[i];
c(expr, st, "Expression");
}
};
base.TemplateLiteral = function (node, st, c) {
for (var i = 0, list = node.quasis; i < list.length; i += 1)
{
var quasi = list[i];
c(quasi, st);
}
for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1)
{
var expr = list$1[i$1];
c(expr, st, "Expression");
}
};
base.TemplateElement = ignore;
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
c(node.argument, st, "Expression");
};
base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
c(node.left, st, "Expression");
c(node.right, st, "Expression");
};
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
c(node.left, st, "Pattern");
c(node.right, st, "Expression");
};
base.ConditionalExpression = function (node, st, c) {
c(node.test, st, "Expression");
c(node.consequent, st, "Expression");
c(node.alternate, st, "Expression");
};
base.NewExpression = base.CallExpression = function (node, st, c) {
c(node.callee, st, "Expression");
if (node.arguments)
{ for (var i = 0, list = node.arguments; i < list.length; i += 1)
{
var arg = list[i];
c(arg, st, "Expression");
} }
};
base.MemberExpression = function (node, st, c) {
c(node.object, st, "Expression");
if (node.computed) { c(node.property, st, "Expression"); }
};
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
if (node.declaration)
{ c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
if (node.source) { c(node.source, st, "Expression"); }
};
base.ExportAllDeclaration = function (node, st, c) {
if (node.exported)
{ c(node.exported, st); }
c(node.source, st, "Expression");
};
base.ImportDeclaration = function (node, st, c) {
for (var i = 0, list = node.specifiers; i < list.length; i += 1)
{
var spec = list[i];
c(spec, st);
}
c(node.source, st, "Expression");
};
base.ImportExpression = function (node, st, c) {
c(node.source, st, "Expression");
};
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore;
base.TaggedTemplateExpression = function (node, st, c) {
c(node.tag, st, "Expression");
c(node.quasi, st, "Expression");
};
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
base.Class = function (node, st, c) {
if (node.id) { c(node.id, st, "Pattern"); }
if (node.superClass) { c(node.superClass, st, "Expression"); }
c(node.body, st);
};
base.ClassBody = function (node, st, c) {
for (var i = 0, list = node.body; i < list.length; i += 1)
{
var elt = list[i];
c(elt, st);
}
};
base.MethodDefinition = base.PropertyDefinition = base.Property = function (node, st, c) {
if (node.computed) { c(node.key, st, "Expression"); }
if (node.value) { c(node.value, st, "Expression"); }
};
exports.ancestor = ancestor;
exports.base = base;
exports.findNodeAfter = findNodeAfter;
exports.findNodeAround = findNodeAround;
exports.findNodeAt = findNodeAt;
exports.findNodeBefore = findNodeBefore;
exports.full = full;
exports.fullAncestor = fullAncestor;
exports.make = make;
exports.recursive = recursive;
exports.simple = simple;
}));
/***/ }),
/***/ 2595:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
const { JSONFileManager } = __webpack_require__(1391);
class ConfigInitapp extends JSONFileManager {
constructor(fileHandler, configInitappPath) {
super(configInitappPath, fileHandler); // Initialize with the navList.json file
}
setRouterClass(routerClassType) {
const allContents = this.getContents(); // Load the current contents of navList.json
allContents.routerClass = routerClassType || "sap.m.routing.Router";
// Save the updated navigation list back to the file
this.updateFile(allContents);
}
getRouterClass() {
const allContents = this.getContents(); // Load the current contents of navList.json
return allContents.routerClass
}
}
module.exports = { ConfigInitapp };
/***/ }),
/***/ 2991:
/***/ ((module) => {
"use strict";
const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
const ESCAPES = new Map([
['n', '\n'],
['r', '\r'],
['t', '\t'],
['b', '\b'],
['f', '\f'],
['v', '\v'],
['0', '\0'],
['\\', '\\'],
['e', '\u001B'],
['a', '\u0007']
]);
function unescape(c) {
const u = c[0] === 'u';
const bracket = c[1] === '{';
if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
return String.fromCharCode(parseInt(c.slice(1), 16));
}
if (u && bracket) {
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
}
return ESCAPES.get(c) || c;
}
function parseArguments(name, arguments_) {
const results = [];
const chunks = arguments_.trim().split(/\s*,\s*/g);
let matches;
for (const chunk of chunks) {
const number = Number(chunk);
if (!Number.isNaN(number)) {
results.push(number);
} else if ((matches = chunk.match(STRING_REGEX))) {
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
} else {
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
}
}
return results;
}
function parseStyle(style) {
STYLE_REGEX.lastIndex = 0;
const results = [];
let matches;
while ((matches = STYLE_REGEX.exec(style)) !== null) {
const name = matches[1];
if (matches[2]) {
const args = parseArguments(name, matches[2]);
results.push([name].concat(args));
} else {
results.push([name]);
}
}
return results;
}
function buildStyle(chalk, styles) {
const enabled = {};
for (const layer of styles) {
for (const style of layer.styles) {
enabled[style[0]] = layer.inverse ? null : style.slice(1);
}
}
let current = chalk;
for (const [styleName, styles] of Object.entries(enabled)) {
if (!Array.isArray(styles)) {
continue;
}
if (!(styleName in current)) {
throw new Error(`Unknown Chalk style: ${styleName}`);
}
current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
}
return current;
}
module.exports = (chalk, temporary) => {
const styles = [];
const chunks = [];
let chunk = [];
// eslint-disable-next-line max-params
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
if (escapeCharacter) {
chunk.push(unescape(escapeCharacter));
} else if (style) {
const string = chunk.join('');
chunk = [];
chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
styles.push({inverse, styles: parseStyle(style)});
} else if (close) {
if (styles.length === 0) {
throw new Error('Found extraneous } in Chalk template literal');
}
chunks.push(buildStyle(chalk, styles)(chunk.join('')));
chunk = [];
styles.pop();
} else {
chunk.push(character);
}
});
chunks.push(chunk.join(''));
if (styles.length > 0) {
const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
throw new Error(errMessage);
}
return chunks.join('');
};
/***/ }),
/***/ 3193:
/***/ ((module) => {
"use strict";
module.exports = require("string_decoder");
/***/ }),
/***/ 3299:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// Import inquirer dynamically (ES module support in Node.js)
async function loadInquirer() {
const inquirer = await __webpack_require__.e(/* import() */ 535).then(__webpack_require__.bind(__webpack_require__, 7535));
return inquirer.default;
}
class CLIHandler {
/**
* Initialize the CLIHandler instance.
* @param {Logger} Logger - A logger class or instance for logging.
*/
constructor(Logger) {
if (!Logger) {
throw new Error('Logger must be provided.');
}
this.logger = typeof Logger === 'function' ? new Logger() : Logger; // Support both classes and instances
}
/**
* Map a list of items to choices for inquirer prompts.
* @param {Array<string | { name: string, value: any }>} list - The list of items to display.
* @returns {Array<{ name: string, value: any }>} - The mapped choices.
*/
_mapToChoices(list) {
console.log("0------------------")
return list.map(item =>
typeof item === 'string' ? { name: item, value: item } : item
);
}
/**
* Display a list of items for the user to select from.
* @param {Array<string | { name: string, value: any }>} list - The list of items to display.
* @param {string} message - The message to display to the user.
* @returns {Promise<any>} - The selected item(s) from the list.
*/
async displayList(list, message = 'Please select an option:') {
return this._prompt({
type: 'list',
name: 'selected',
message: message,
choices: this._mapToChoices(list)
});
}
/**
* Display a checkbox list of items for the user to select multiple options.
* @param {Array<string | { name: string, value: any }>} list - The list of items to display.
* @param {string} message - The message to display to the user.
* @returns {Promise<any[]>} - The array of selected items.
*/
async displayCheckboxList(list, message = 'Please select one or more options:') {
return this._prompt({
type: 'checkbox',
name: 'selected',
message: message,
choices: this._mapToChoices(list)
});
}
/**
* Prompt the user for confirmation.
* @param {string} message - The message to display to the user.
* @returns {Promise<boolean>} - True if the user confirms, false otherwise.
*/
async confirm(message = 'Do you want to proceed?') {
return this._prompt({
type: 'confirm',
name: 'confirmed',
message: message,
default: false
});
}
/**
* Prompt the user for input.
* @param {string} message - The message to display to the user.
* @param {string} defaultValue - The default value for the input.
* @returns {Promise<string>} - The user's input.
*/
async promptInput(message = 'Please enter a value:', defaultValue = '') {
return this._prompt({
type: 'input',
name: 'input',
message: message,
default: defaultValue
});
}
/**
* Prompt the user for a password.
* @param {string} message - The message to display to the user.
* @returns {Promise<string>} - The user's input.
*/
async promptPassword(message = 'Please enter your password:') {
return this._prompt({
type: 'password',
name: 'password',
message: message,
mask: '*'
});
}
/**
* Prompt the user with a raw list.
* @param {Array<string | { name: string, value: any }>} list - The list of items to display.
* @param {string} message - The message to display to the user.
* @returns {Promise<any>} - The selected item from the list.
*/
async displayRawList(list, message = 'Please select an option:') {
return this._prompt({
type: 'rawlist',
name: 'selected',
message: message,
choices: this._mapToChoices(list)
});
}
/**
* General method to handle different types of prompts.
* @param {Object} promptConfig - The configuration object for the prompt.
* @returns {Promise<any>} - The user's response.
*/
async _prompt(promptConfig) {
try {
const inquirer = await loadInquirer();
const answer = await inquirer.prompt([promptConfig]);
return answer[promptConfig.name];
} catch (error) {
this.handleError(error);
throw error;
}
}
/**
* Handle errors during CLI interactions.
* @param {Error} error - The error object.
*/
handleError(error) {
if (error?.isTtyError) {
this.logger.error("Prompt couldn't be rendered in the current environment.");
} else if (error instanceof Error && error.name === 'ExitPromptError') {
this.logger.log("Prompt was forcefully exited by the user.");
} else {
this.logger.error("An unexpected error occurred:", error.message || 'Unknown error');
}
}
}
module.exports = { CLIHandler };
/***/ }),
/***/ 3785:
/***/ ((module) => {
"use strict";
module.exports = require("readline");
/***/ }),
/***/ 4058:
/***/ ((module) => {
"use strict";
const stringReplaceAll = (string, substring, replacer) => {
let index = string.indexOf(substring);
if (index === -1) {
return string;
}
const substringLength = substring.length;
let endIndex = 0;
let returnValue = '';
do {
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
endIndex = index + substringLength;
index = string.indexOf(substring, endIndex);
} while (index !== -1);
returnValue += string.substr(endIndex);
return returnValue;
};
const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
let endIndex = 0;
let returnValue = '';
do {
const gotCR = string[index - 1] === '\r';
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
endIndex = index + 1;
index = string.indexOf('\n', endIndex);
} while (index !== -1);
returnValue += string.substr(endIndex);
return returnValue;
};
module.exports = {
stringReplaceAll,
stringEncaseCRLFWithFirstIndex
};
/***/ }),
/***/ 4083:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
const wrapAnsi16 = (fn, offset) => (...args) => {
const code = fn(...args);
return `\u001B[${code + offset}m`;
};
const wrapAnsi256 = (fn, offset) => (...args) => {
const code = fn(...args);
return `\u001B[${38 + offset};5;${code}m`;
};
const wrapAnsi16m = (fn, offset) => (...args) => {
const rgb = fn(...args);
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
};
const ansi2ansi = n => n;
const rgb2rgb = (r, g, b) => [r, g, b];
const setLazyProperty = (object, property, get) => {
Object.defineProperty(object, property, {
get: () => {
const value = get();
Object.defineProperty(object, property, {
value,
enumerable: true,
configurable: true
});
return value;
},
enumerable: true,
configurable: true
});
};
/** @type {typeof import('color-convert')} */
let colorConvert;
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
if (colorConvert === undefined) {
colorConvert = __webpack_require__(734);
}
const offset = isBackground ? 10 : 0;
const styles = {};
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
if (sourceSpace === targetSpace) {
styles[name] = wrap(identity, offset);
} else if (typeof suite === 'object') {
styles[name] = wrap(suite[targetSpace], offset);
}
}
return styles;
};
function assembleStyles() {
const codes = new Map();
const styles = {
modifier: {
reset: [0, 0],
// 21 isn't widely supported and 22 does the same thing
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
// Bright color
blackBright: [90, 39],
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39]
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
// Bright color
bgBlackBright: [100, 49],
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
}
};
// Alias bright black as gray (and grey)
styles.color.gray = styles.color.blackBright;
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
styles.color.grey = styles.color.blackBright;
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
for (const [groupName, group] of Object.entries(styles)) {
for (const [styleName, style] of Object.entries(group)) {
styles[styleName] = {
open: `\u001B[${style[0]}m`,
close: `\u001B[${style[1]}m`
};
group[styleName] = styles[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
}
Object.defineProperty(styles, 'codes', {
value: codes,
enumerable: false
});
styles.color.close = '\u001B[39m';
styles.bgColor.close = '\u001B[49m';
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
return styles;
}
// Make the export immutable
Object.defineProperty(module, 'exports', {
enumerable: true,
get: assembleStyles
});
/***/ }),
/***/ 4236:
/***/ ((module) => {
"use strict";
module.exports = require("console");
/***/ }),
/***/ 4669:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
const fs = __webpack_require__(9896);
const path = __webpack_require__(6928);
const { PathResolver } = __webpack_require__(8783);
const DEFAULT_DESTINATION_FOLDER = 'ez5';
class DirectoryCopier {
static copyDirectories(sourcePath, destinationPath, logger, skipItems = []) {
if (!sourcePath || !destinationPath || typeof logger !== 'object') {
throw new Error('Invalid arguments provided.');
}
const fullSourcePath = path.resolve(sourcePath);
const fullDestinationPath = path.join(destinationPath, DEFAULT_DESTINATION_FOLDER);
PathResolver.validatePath(fullSourcePath);
if (!fs.existsSync(fullDestinationPath)) {
logger.log(`Creating destination directory: ${fullDestinationPath}`);
fs.mkdirSync(fullDestinationPath, { recursive: true });
}
const items = fs.readdirSync(fullSourcePath, { withFileTypes: true });
for (const item of items) {
if (item.isDirectory() && !skipItems.includes(item.name)) {
const srcDir = path.join(fullSourcePath, item.name);
const destDir = path.join(fullDestinationPath, item.name);
logger.log(`Copying folder: ${item.name} to ez5`);
fs.cpSync(srcDir, destDir, { recursive: true });
} else if (skipItems.includes(item.name)) {
logger.log(`Skipping folder: ${item.name}`);
}
}
logger.log(`All eligible folders inside ${sourcePath} copied to ${destinationPath}/ez5.`);
}
static moveFilesFromSubdir(targetDir, dirName, filterCondition, logger) {
if (!DirectoryCopier._isValidDir(targetDir)) throw new Error('Invalid targetDir: Must be a non-empty string.');
if (!DirectoryCopier._isValidDir(dirName)) throw new Error('Invalid dirName: Must be a non-empty string.');
if (typeof filterCondition !== 'function') throw new Error('Invalid filterCondition: Must be a function.');
DirectoryCopier._traverseAndProcess(targetDir, dirName, filterCondition, logger);
}
static _isValidDir(dir) {
return typeof dir === 'string' && dir.trim().length > 0;
}
static _traverseAndProcess(currentDir, dirName, filterFn, logger) {
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
for (const entry of entries) {
const fullPath = path.join(currentDir, entry.name);
if (entry.isDirectory()) {
if (entry.name === dirName) {
DirectoryCopier._processTargetSubdir(fullPath, filterFn, logger);
DirectoryCopier._removeDirectory(fullPath, logger);
} else {
DirectoryCopier._traverseAndProcess(fullPath, dirName, filterFn, logger);
}
}
}
}
static _processTargetSubdir(subdirPath, filterFn, logger) {
const items = fs.readdirSync(subdirPath, { withFileTypes: true });
const parentDir = path.dirname(subdirPath);
for (const item of items) {
const itemPath = path.join(subdirPath, item.name);
const destinationPath = path.join(parentDir, item.name);
if (item.isFile()) {
if (filterFn(item.name)) {
logger.log(`Skipped file: ${item.name}`);
continue;
}
DirectoryCopier._moveFile(itemPath, parentDir, logger);
} else if (item.isDirectory()) {
// Move entire directory to parent of 'content'
logger.log(`Moving folder: ${itemPath} -> ${destinationPath}`);
try {
fs.renameSync(itemPath, destinationPath);
} catch (err) {
logger.error(`Error moving directory ${itemPath} -> ${destinationPath}: ${err.message}`);
}
}
}
}
static _moveFile(fromPath, toDir, logger) {
const fileName = path.basename(fromPath);
const toPath = path.join(toDir, fileName);
try {
fs.renameSync(fromPath, toPath);
logger.log(`Moved file: ${fromPath} -> ${toPath}`);
} catch (err) {
logger.error(`Error moving file ${fromPath} -> ${toPath}: ${err.message}`);
}
}
static _removeDirectory(dirPath, logger) {
try {
fs.rmSync(dirPath, { recursive: true, force: true });
logger.log(`Removed directory: ${dirPath}`);
} catch (err) {
logger.error(`Error removing directory ${dirPath}: ${err.message}`);
}
}
}
module.exports = { DirectoryCopier };
/***/ }),
/***/ 5248:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
const ansiStyles = __webpack_require__(4083);
const {stdout: stdoutColor, stderr: stderrColor} = __webpack_require__(7687);
const {
stringReplaceAll,
stringEncaseCRLFWithFirstIndex
} = __webpack_require__(4058);
const {isArray} = Array;
// `supportsColor.level` → `ansiStyles.color[name]` mapping
const levelMapping = [
'ansi',
'ansi',
'ansi256',
'ansi16m'
];
const styles = Object.create(null);
const applyOptions = (object, options = {}) => {
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
throw new Error('The `level` option should be an integer from 0 to 3');
}
// Detect level if not set manually
const colorLevel = stdoutColor ? stdoutColor.level : 0;
object.level = options.level === undefined ? colorLevel : options.level;
};
class ChalkClass {
constructor(options) {
// eslint-disable-next-line no-constructor-return
return chalkFactory(options);
}
}
const chalkFactory = opt