entexto-cli 1.4.8 → 1.4.9

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.
@@ -130,7 +130,28 @@ module.exports = async function tunnel(opts) {
130
130
  const chunks = [];
131
131
  localRes.on('data', (chunk) => chunks.push(chunk));
132
132
  localRes.on('end', () => {
133
- const bodyBuf = Buffer.concat(chunks);
133
+ let bodyBuf = Buffer.concat(chunks);
134
+
135
+ // Reescribir el host local → URL pública del túnel en respuestas de texto.
136
+ // Esto cubre el caso de Elementor/webpack cuyo __webpack_public_path__
137
+ // queda hardcodeado como cmy-rent-car.local (o el dominio local) en el JS.
138
+ const ct = (localRes.headers['content-type'] || '').toLowerCase();
139
+ const isText = /\b(javascript|css|html|json|xml|svg|text\/)/i.test(ct);
140
+ if (isText && publicUrl && bodyBuf.length > 0) {
141
+ const localOrigins = [
142
+ parsedTarget.origin, // http://cmy-rent-car.local
143
+ parsedTarget.origin.replace(/^http:/, 'https:'), // https://cmy-rent-car.local
144
+ parsedTarget.host, // cmy-rent-car.local
145
+ ];
146
+ let text = bodyBuf.toString('utf8');
147
+ for (const origin of localOrigins) {
148
+ // Reemplazar como origen completo primero, luego como host suelto
149
+ text = text.split(origin).join(publicUrl);
150
+ }
151
+ bodyBuf = Buffer.from(text, 'utf8');
152
+ // Corregir Content-Length si venía fijo
153
+ localRes.headers['content-length'] = String(bodyBuf.length);
154
+ }
134
155
 
135
156
  // Color del status
136
157
  const status = localRes.statusCode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "entexto-cli",
3
- "version": "1.4.8",
3
+ "version": "1.4.9",
4
4
  "description": "CLI oficial de Entexto — Deploy y gestión de proyectos desde tu terminal",
5
5
  "main": "lib/index.js",
6
6
  "bin": {