versacompiler 1.0.1 → 1.0.2
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/dist/index.js +17 -5
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -163,7 +163,16 @@ const deleteFile = async ruta => {
|
|
|
163
163
|
try {
|
|
164
164
|
log(chalk.yellow(`🗑️ :Eliminando ${newPath}`));
|
|
165
165
|
|
|
166
|
-
const stats = await stat(newPath);
|
|
166
|
+
const stats = await stat(newPath).catch(() => null); // Verificar si el archivo existe
|
|
167
|
+
if (!stats) {
|
|
168
|
+
log(
|
|
169
|
+
chalk.yellow(
|
|
170
|
+
`⚠️ :El archivo o directorio no existe: ${newPath}`,
|
|
171
|
+
),
|
|
172
|
+
);
|
|
173
|
+
return { extension: null, normalizedPath: null, fileName: null }; // Devolver un objeto válido
|
|
174
|
+
}
|
|
175
|
+
|
|
167
176
|
if (stats.isDirectory()) {
|
|
168
177
|
await rmdir(newPath, { recursive: true });
|
|
169
178
|
} else if (stats.isFile()) {
|
|
@@ -302,13 +311,16 @@ const removeCodeTagImport = async data => {
|
|
|
302
311
|
* @returns {Promise<string>} - Una promesa que se resuelve con la cadena modificada con las importaciones actualizadas.
|
|
303
312
|
*/
|
|
304
313
|
const addImportEndJs = async data => {
|
|
305
|
-
const importRegExp = /import\s+[\s\S]*?\s+from\s+['"].*['"]
|
|
314
|
+
const importRegExp = /import\s+[\s\S]*?\s+from\s+['"](.*)['"]/g;
|
|
306
315
|
|
|
307
316
|
return data.replace(importRegExp, match => {
|
|
308
|
-
const ruta = match.match(/from\s+['"](.*)['"]
|
|
317
|
+
const ruta = match.match(/from\s+['"](.*)['"]/)[1];
|
|
309
318
|
|
|
310
|
-
if (ruta.
|
|
311
|
-
|
|
319
|
+
if (ruta.startsWith('@/')) {
|
|
320
|
+
// Manejar alias de ruta como @/
|
|
321
|
+
return match.replace(ruta, `${ruta}.js`);
|
|
322
|
+
} else if (ruta.endsWith('.vue')) {
|
|
323
|
+
const resultVue = match.match(/from\s+['"](.+\/(\w+))\.vue['"]/);
|
|
312
324
|
if (resultVue) {
|
|
313
325
|
const fullPath = resultVue[1].replace('.vue', '');
|
|
314
326
|
const fileName = resultVue[2];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "versacompiler",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Una herramienta para compilar y minificar archivos .vue, .js y .ts para proyectos de Vue 3 con soporte para TypeScript.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"chalk": "5.4.1",
|
|
36
36
|
"chokidar": "^4.0.3",
|
|
37
|
-
"oxc-minify": "^0.
|
|
37
|
+
"oxc-minify": "^0.68.1",
|
|
38
38
|
"acorn": "^8.14.1",
|
|
39
39
|
"vue": "3.5.13",
|
|
40
40
|
"get-port": "^7.1.0",
|
|
41
41
|
"typescript": "^5.8.3",
|
|
42
|
-
"oxlint": "^0.16.
|
|
42
|
+
"oxlint": "^0.16.10",
|
|
43
43
|
"browser-sync": "^3.0.4"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"prettier": "3.5.3",
|
|
47
|
-
"@types/node": "^22.15.
|
|
47
|
+
"@types/node": "^22.15.17",
|
|
48
48
|
"code-tag": "^1.2.0"
|
|
49
49
|
}
|
|
50
50
|
}
|