versacompiler 1.0.0 → 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 +18 -5
- package/dist/utils/utils.js +1 -1
- package/package.json +7 -4
package/dist/index.js
CHANGED
|
@@ -157,12 +157,22 @@ const deleteFile = async ruta => {
|
|
|
157
157
|
.replace('.vue', '.js')
|
|
158
158
|
.replace('.ts', '.js'),
|
|
159
159
|
PATH_DIST,
|
|
160
|
+
PATH_SOURCE,
|
|
160
161
|
)
|
|
161
162
|
).toString();
|
|
162
163
|
try {
|
|
163
164
|
log(chalk.yellow(`🗑️ :Eliminando ${newPath}`));
|
|
164
165
|
|
|
165
|
-
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
|
+
|
|
166
176
|
if (stats.isDirectory()) {
|
|
167
177
|
await rmdir(newPath, { recursive: true });
|
|
168
178
|
} else if (stats.isFile()) {
|
|
@@ -301,13 +311,16 @@ const removeCodeTagImport = async data => {
|
|
|
301
311
|
* @returns {Promise<string>} - Una promesa que se resuelve con la cadena modificada con las importaciones actualizadas.
|
|
302
312
|
*/
|
|
303
313
|
const addImportEndJs = async data => {
|
|
304
|
-
const importRegExp = /import\s+[\s\S]*?\s+from\s+['"].*['"]
|
|
314
|
+
const importRegExp = /import\s+[\s\S]*?\s+from\s+['"](.*)['"]/g;
|
|
305
315
|
|
|
306
316
|
return data.replace(importRegExp, match => {
|
|
307
|
-
const ruta = match.match(/from\s+['"](.*)['"]
|
|
317
|
+
const ruta = match.match(/from\s+['"](.*)['"]/)[1];
|
|
308
318
|
|
|
309
|
-
if (ruta.
|
|
310
|
-
|
|
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['"]/);
|
|
311
324
|
if (resultVue) {
|
|
312
325
|
const fullPath = resultVue[1].replace('.vue', '');
|
|
313
326
|
const fileName = resultVue[2];
|
package/dist/utils/utils.js
CHANGED
|
@@ -22,5 +22,5 @@ export const showTimingForHumans = timing => {
|
|
|
22
22
|
* @param {string} ruta - La ruta de origen.
|
|
23
23
|
* @returns {Promise<string>} - La ruta mapeada en el directorio de distribución.
|
|
24
24
|
*/
|
|
25
|
-
export const mapRuta = async (ruta, PATH_DIST) =>
|
|
25
|
+
export const mapRuta = async (ruta, PATH_DIST, PATH_SOURCE) =>
|
|
26
26
|
path.join(PATH_DIST, path.relative(PATH_SOURCE, ruta));
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
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": {
|
|
7
7
|
"versacompiler": "dist/index.js"
|
|
8
8
|
},
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
9
12
|
"files": [
|
|
10
13
|
"dist",
|
|
11
14
|
"LICENSE",
|
|
@@ -31,17 +34,17 @@
|
|
|
31
34
|
"dependencies": {
|
|
32
35
|
"chalk": "5.4.1",
|
|
33
36
|
"chokidar": "^4.0.3",
|
|
34
|
-
"oxc-minify": "^0.
|
|
37
|
+
"oxc-minify": "^0.68.1",
|
|
35
38
|
"acorn": "^8.14.1",
|
|
36
39
|
"vue": "3.5.13",
|
|
37
40
|
"get-port": "^7.1.0",
|
|
38
41
|
"typescript": "^5.8.3",
|
|
39
|
-
"oxlint": "^0.16.
|
|
42
|
+
"oxlint": "^0.16.10",
|
|
40
43
|
"browser-sync": "^3.0.4"
|
|
41
44
|
},
|
|
42
45
|
"devDependencies": {
|
|
43
46
|
"prettier": "3.5.3",
|
|
44
|
-
"@types/node": "^22.15.
|
|
47
|
+
"@types/node": "^22.15.17",
|
|
45
48
|
"code-tag": "^1.2.0"
|
|
46
49
|
}
|
|
47
50
|
}
|