slicejs-cli 1.0.26 → 1.0.27
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.
|
@@ -90,24 +90,20 @@ function addGetterSetterIfNeeded(componentContent, property) {
|
|
|
90
90
|
|
|
91
91
|
function removePropertyIfNeeded(componentContent, property) {
|
|
92
92
|
let updatedComponentContent = componentContent;
|
|
93
|
-
|
|
94
|
-
// Verificar si la propiedad está en debuggerProps
|
|
95
|
-
const propIndex = componentContent.indexOf(`'${property}'`);
|
|
96
|
-
if (propIndex !== -1) {
|
|
97
|
-
// Eliminar la propiedad de debuggerProps
|
|
98
|
-
const startIndex = componentContent.lastIndexOf('[', propIndex);
|
|
99
|
-
const endIndex = componentContent.indexOf(']', propIndex);
|
|
100
|
-
updatedComponentContent = componentContent.slice(0, startIndex) + componentContent.slice(endIndex + 1);
|
|
101
|
-
console.log(`Property '${property}' removed from debuggerProps.`);
|
|
102
|
-
}
|
|
103
93
|
|
|
104
|
-
//
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
94
|
+
// Eliminar la propiedad de debuggerProps si está presente
|
|
95
|
+
const debuggerPropsRegex = /this\.debuggerProps\s*=\s*\[(.*?)\];/s;
|
|
96
|
+
updatedComponentContent = updatedComponentContent.replace(debuggerPropsRegex, (match, propsList) => {
|
|
97
|
+
const props = propsList.split(',').map(prop => prop.trim().replace(/['"]/g, ''));
|
|
98
|
+
const propIndex = props.indexOf(property);
|
|
99
|
+
if (propIndex !== -1) {
|
|
100
|
+
props.splice(propIndex, 1);
|
|
101
|
+
}
|
|
102
|
+
return `this.debuggerProps = [${props.map(prop => `'${prop}'`).join(', ')}];`;
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Eliminar los getters y setters de la propiedad
|
|
106
|
+
updatedComponentContent = removeGetterSetter(updatedComponentContent, property);
|
|
111
107
|
|
|
112
108
|
return updatedComponentContent;
|
|
113
109
|
}
|