hightjs 0.3.3 → 0.3.4

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/builder.js CHANGED
@@ -82,7 +82,7 @@ const postcssPlugin = {
82
82
  plugins.push(pluginModule(pluginOptions || {}));
83
83
  }
84
84
  catch (error) {
85
- Console.warn(`Não foi possível carregar plugin ${pluginName}:`, error.message);
85
+ Console.warn(`Unable to load plugin ${pluginName}:`, error.message);
86
86
  }
87
87
  }
88
88
  }
@@ -96,8 +96,8 @@ const postcssPlugin = {
96
96
  processedCss = result.css;
97
97
  }
98
98
  catch (postcssError) {
99
- Console.warn(`Erro ao processar CSS com PostCSS:`, postcssError.message);
100
- Console.warn(`Usando CSS original sem processamento.`);
99
+ Console.warn(`Error processing CSS with PostCSS:`, postcssError.message);
100
+ Console.warn(`Using raw CSS without processing.`);
101
101
  }
102
102
  }
103
103
  return {
@@ -185,9 +185,6 @@ const reactResolvePlugin = {
185
185
  async function buildWithChunks(entryPoint, outdir, isProduction = false) {
186
186
  // limpar diretorio
187
187
  fs.rmSync(outdir, { recursive: true, force: true });
188
- if (!isProduction) {
189
- console.log(`Iniciando o build com chunks de \"${entryPoint}\"...`);
190
- }
191
188
  try {
192
189
  await esbuild.build({
193
190
  entryPoints: [entryPoint],
@@ -214,12 +211,9 @@ async function buildWithChunks(entryPoint, outdir, isProduction = false) {
214
211
  keepNames: true,
215
212
  treeShaking: true,
216
213
  });
217
- if (!isProduction) {
218
- console.log(`Build com chunks finalizado! Saída: \"${outdir}\".`);
219
- }
220
214
  }
221
215
  catch (error) {
222
- console.error('Ocorreu um erro durante o build com chunks:', error);
216
+ console.error('An error occurred while building:', error);
223
217
  process.exit(1);
224
218
  }
225
219
  }
@@ -281,7 +275,7 @@ async function watchWithChunks(entryPoint, outdir, hotReloadManager = null) {
281
275
  }
282
276
  catch (error) {
283
277
  console.error(error);
284
- Console.error('Erro ao iniciar o modo watch com chunks:', error);
278
+ Console.error('Error starting watch mode with chunks:', error);
285
279
  throw error;
286
280
  }
287
281
  }
@@ -296,9 +290,6 @@ async function build(entryPoint, outfile, isProduction = false) {
296
290
  // limpar diretorio do outfile
297
291
  const outdir = path.dirname(outfile);
298
292
  fs.rmSync(outdir, { recursive: true, force: true });
299
- if (!isProduction) {
300
- console.log(`Iniciando o build de \"${entryPoint}\"...`);
301
- }
302
293
  try {
303
294
  await esbuild.build({
304
295
  entryPoints: [entryPoint],
@@ -328,12 +319,9 @@ async function build(entryPoint, outfile, isProduction = false) {
328
319
  treeShaking: true,
329
320
  drop: [], // Não remove nada automaticamente
330
321
  });
331
- if (!isProduction) {
332
- console.log(`Build finalizado com sucesso! Saída: \"${outfile}\".`);
333
- }
334
322
  }
335
323
  catch (error) {
336
- console.error('Ocorreu um erro durante o build:', error);
324
+ console.error('An error occurred during build:', error);
337
325
  process.exit(1);
338
326
  }
339
327
  }
@@ -396,7 +384,7 @@ async function watch(entryPoint, outfile, hotReloadManager = null) {
396
384
  await context.watch();
397
385
  }
398
386
  catch (error) {
399
- Console.error('Erro ao iniciar o modo watch:', error);
387
+ Console.error('Error starting watch mode:', error);
400
388
  throw error;
401
389
  }
402
390
  }
@@ -49,5 +49,5 @@ function DefaultNotFound() {
49
49
  fontWeight: '400',
50
50
  lineHeight: '49px',
51
51
  margin: '0px'
52
- }, children: "Esta p\u00E1gina n\u00E3o pode ser achada." }) })] }) }));
52
+ }, children: "This page cannot be found." }) })] }) }));
53
53
  }
@@ -265,7 +265,7 @@ function DevIndicator() {
265
265
  function initializeClient() {
266
266
  const initialData = window.__HWEB_INITIAL_DATA__;
267
267
  if (!initialData) {
268
- console.error('[hweb] Dados iniciais não encontrados na página.');
268
+ console.error('[hweb] Initial data not found on page.');
269
269
  return;
270
270
  }
271
271
  // Cria o mapa de componentes dinamicamente a partir dos módulos carregados
@@ -276,7 +276,7 @@ function initializeClient() {
276
276
  }
277
277
  const container = document.getElementById('root');
278
278
  if (!container) {
279
- console.error('[hweb] Container #root não encontrado.');
279
+ console.error('[hweb] Container #root not found.');
280
280
  return;
281
281
  }
282
282
  try {
@@ -285,7 +285,7 @@ function initializeClient() {
285
285
  root.render((0, jsx_runtime_1.jsx)(App, { componentMap: componentMap, routes: initialData.routes, initialComponentPath: initialData.initialComponentPath, initialParams: initialData.initialParams, layoutComponent: window.__HWEB_LAYOUT__ }));
286
286
  }
287
287
  catch (error) {
288
- console.error('[hweb] Erro ao renderizar aplicação:', error);
288
+ console.error('[hweb] Error rendering application:', error);
289
289
  }
290
290
  }
291
291
  // Executa quando o DOM estiver pronto
package/dist/helpers.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  import http, { Server } from 'http';
2
3
  import type { HightJSOptions } from './types';
3
4
  import https from 'https';
package/dist/helpers.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  "use strict";
2
3
  /*
3
4
  * This file is part of the HightJS Project.
@@ -57,6 +58,7 @@ exports.app = app;
57
58
  const http_1 = __importDefault(require("http"));
58
59
  const os_1 = __importDefault(require("os"));
59
60
  const url_1 = require("url"); // API moderna, substitui 'querystring'
61
+ const path_1 = __importDefault(require("path"));
60
62
  // Helpers para integração com diferentes frameworks
61
63
  const index_1 = __importStar(require("./index")); // Importando o tipo
62
64
  const console_1 = __importStar(require("./api/console"));
@@ -81,28 +83,85 @@ function getLocalExternalIp() {
81
83
  return 'localhost'; // Fallback
82
84
  }
83
85
  const sendBox = (options) => {
84
- const isDev = options.dev ? "Rodando em modo de desenvolvimento" : null;
86
+ const isDev = options.dev ? "Running in development mode" : null;
85
87
  // 1. Verifica se o SSL está ativado (baseado na mesma lógica do initNativeServer)
86
88
  const isSSL = options.ssl && options.ssl.key && options.ssl.cert;
87
89
  const protocol = isSSL ? 'https' : 'http';
88
90
  const localIp = getLocalExternalIp(); // Assume que getLocalExternalIp() existe
89
91
  // 2. Monta as mensagens com o protocolo correto
90
92
  const messages = [
91
- ` ${console_1.Colors.FgGray}┃${console_1.Colors.Reset} Local: ${console_1.Colors.FgGreen}${protocol}://localhost:${options.port}${console_1.Colors.Reset}`,
93
+ ` ${console_1.Colors.FgGray}┃${console_1.Colors.Reset} Local: ${console_1.Colors.FgGreen}${protocol}://localhost:${options.port}${console_1.Colors.Reset}`,
92
94
  ];
93
95
  // Só adiciona a rede se o IP local for encontrado
94
96
  if (localIp) {
95
- messages.push(` ${console_1.Colors.FgGray}┃${console_1.Colors.Reset} Rede: ${console_1.Colors.FgGreen}${protocol}://${localIp}:${options.port}${console_1.Colors.Reset}`);
97
+ messages.push(` ${console_1.Colors.FgGray}┃${console_1.Colors.Reset} Network: ${console_1.Colors.FgGreen}${protocol}://${localIp}:${options.port}${console_1.Colors.Reset}`);
96
98
  }
97
99
  if (isDev) {
98
100
  messages.push(` ${console_1.Colors.FgGray}┃${console_1.Colors.Reset} ${isDev}`);
99
101
  }
100
102
  // Adiciona aviso de redirecionamento se estiver em modo SSL
101
103
  if (isSSL && options.ssl?.redirectPort) {
102
- messages.push(` ${console_1.Colors.FgGray}┃${console_1.Colors.Reset} HTTP (porta ${options.ssl?.redirectPort}) está redirecionando para HTTPS.`);
104
+ messages.push(` ${console_1.Colors.FgGray}┃${console_1.Colors.Reset} HTTP (port ${options.ssl?.redirectPort}) is redirecting to HTTPS.`);
103
105
  }
104
- console_1.default.box(messages.join("\n"), { title: "Acesse em:" });
106
+ console_1.default.box(messages.join("\n"), { title: "Access on:" });
105
107
  };
108
+ /**
109
+ * Carrega o arquivo de configuração hightjs.config.ts ou hightjs.config.js do projeto
110
+ * @param projectDir Diretório raiz do projeto
111
+ * @param phase Fase de execução ('development' ou 'production')
112
+ * @returns Configuração mesclada com os valores padrão
113
+ */
114
+ async function loadHightConfig(projectDir, phase) {
115
+ const defaultConfig = {
116
+ maxHeadersCount: 100,
117
+ headersTimeout: 60000,
118
+ requestTimeout: 30000,
119
+ serverTimeout: 35000,
120
+ individualRequestTimeout: 30000,
121
+ maxUrlLength: 2048,
122
+ };
123
+ try {
124
+ // Tenta primeiro .ts, depois .js
125
+ const possiblePaths = [
126
+ path_1.default.join(projectDir, 'hightjs.config.ts'),
127
+ path_1.default.join(projectDir, 'hightjs.config.js'),
128
+ ];
129
+ let configPath = null;
130
+ for (const p of possiblePaths) {
131
+ if (fs_1.default.existsSync(p)) {
132
+ configPath = p;
133
+ break;
134
+ }
135
+ }
136
+ if (!configPath) {
137
+ return defaultConfig;
138
+ }
139
+ // Remove do cache para permitir hot reload da configuração em dev
140
+ delete require.cache[require.resolve(configPath)];
141
+ const configModule = require(configPath);
142
+ const configExport = configModule.default || configModule;
143
+ let userConfig;
144
+ if (typeof configExport === 'function') {
145
+ // Suporta tanto função síncrona quanto assíncrona
146
+ userConfig = await Promise.resolve(configExport(phase, { defaultConfig }));
147
+ }
148
+ else {
149
+ userConfig = configExport;
150
+ }
151
+ // Mescla a configuração do usuário com a padrão
152
+ const mergedConfig = { ...defaultConfig, ...userConfig };
153
+ const configFileName = path_1.default.basename(configPath);
154
+ console_1.default.info(`${console_1.Colors.FgCyan}[Config]${console_1.Colors.Reset} Loaded ${configFileName}`);
155
+ return mergedConfig;
156
+ }
157
+ catch (error) {
158
+ if (error instanceof Error) {
159
+ console_1.default.warn(`${console_1.Colors.FgYellow}[Config]${console_1.Colors.Reset} Error loading hightjs.config: ${error.message}`);
160
+ console_1.default.warn(`${console_1.Colors.FgYellow}[Config]${console_1.Colors.Reset} Using default configuration`);
161
+ }
162
+ return defaultConfig;
163
+ }
164
+ }
106
165
  /**
107
166
  * Middleware para parsing do body com proteções de segurança (versão melhorada).
108
167
  * Rejeita a promise em caso de erro de parsing ou estouro de limite.
@@ -181,8 +240,12 @@ const parseBody = (req) => {
181
240
  async function initNativeServer(hwebApp, options, port, hostname) {
182
241
  const time = Date.now();
183
242
  await hwebApp.prepare();
243
+ // Carrega a configuração do arquivo hightjs.config.js
244
+ const projectDir = options.dir || process.cwd();
245
+ const phase = options.dev ? 'development' : 'production';
246
+ const hightConfig = await loadHightConfig(projectDir, phase);
184
247
  const handler = hwebApp.getRequestHandler();
185
- const msg = console_1.default.dynamicLine(` ${console_1.Colors.BgYellow} ready ${console_1.Colors.Reset} ${console_1.Colors.Bright}Iniciando HightJS na porta ${options.port}${console_1.Colors.Reset}`);
248
+ const msg = console_1.default.dynamicLine(` ${console_1.Colors.BgYellow} ready ${console_1.Colors.Reset} ${console_1.Colors.Bright}Starting HightJS on port ${options.port}${console_1.Colors.Reset}`);
186
249
  // --- LÓGICA DO LISTENER (REUTILIZÁVEL) ---
187
250
  // Extraímos a lógica principal para uma variável
188
251
  // para que possa ser usada tanto pelo servidor HTTP quanto HTTPS.
@@ -197,15 +260,16 @@ async function initNativeServer(hwebApp, options, port, hostname) {
197
260
  if (options.ssl) {
198
261
  res.setHeader('Strict-Transport-Security', 'max-age=31536000; includeSubDomains');
199
262
  }
200
- // Timeout por requisição
201
- req.setTimeout(30000, () => {
263
+ // Timeout por requisição (usa configuração personalizada)
264
+ req.setTimeout(hightConfig.individualRequestTimeout || 30000, () => {
202
265
  res.statusCode = 408; // Request Timeout
203
266
  res.end('Request timeout');
204
267
  });
205
268
  try {
206
- // Validação básica de URL
269
+ // Validação básica de URL (usa configuração personalizada)
207
270
  const url = req.url || '/';
208
- if (url.length > 2048) {
271
+ const maxUrlLength = hightConfig.maxUrlLength || 2048;
272
+ if (url.length > maxUrlLength) {
209
273
  res.statusCode = 414; // URI Too Long
210
274
  res.end('URL too long');
211
275
  return;
@@ -220,10 +284,10 @@ async function initNativeServer(hwebApp, options, port, hostname) {
220
284
  catch (error) {
221
285
  // Log do erro no servidor
222
286
  if (error instanceof Error) {
223
- console_1.default.error(`Erro no servidor nativo: ${error.message}`);
287
+ console_1.default.error(`Native server error: ${error.message}`);
224
288
  }
225
289
  else {
226
- console_1.default.error('Erro desconhecido no servidor nativo:', error);
290
+ console_1.default.error('Unknown native server error:', error);
227
291
  }
228
292
  // Tratamento de erro (idêntico ao seu original)
229
293
  if (!res.headersSent) {
@@ -286,14 +350,14 @@ async function initNativeServer(hwebApp, options, port, hostname) {
286
350
  // Cria o servidor HTTP nativo
287
351
  server = http_1.default.createServer(requestListener); // (any para contornar HWebIncomingMessage)
288
352
  }
289
- // Configurações de segurança do servidor (Comum a ambos)
290
- server.setTimeout(35000); // Timeout geral do servidor
291
- server.maxHeadersCount = 100; // Limita número de headers
292
- server.headersTimeout = 60000; // Timeout para headers
293
- server.requestTimeout = 30000; // Timeout para requisições
353
+ // Configurações de segurança do servidor (usa configuração personalizada)
354
+ server.setTimeout(hightConfig.serverTimeout || 35000); // Timeout geral do servidor
355
+ server.maxHeadersCount = hightConfig.maxHeadersCount || 100; // Limita número de headers
356
+ server.headersTimeout = hightConfig.headersTimeout || 60000; // Timeout para headers
357
+ server.requestTimeout = hightConfig.requestTimeout || 30000; // Timeout para requisições
294
358
  server.listen(port, hostname, () => {
295
359
  sendBox({ ...options, port });
296
- msg.end(` ${console_1.Colors.BgGreen} ready ${console_1.Colors.Reset} ${console_1.Colors.Bright}Pronto na porta ${console_1.Colors.BgGreen} ${options.port} ${console_1.Colors.Reset}${console_1.Colors.Bright} em ${Date.now() - time}ms${console_1.Colors.Reset}\n`);
360
+ msg.end(` ${console_1.Colors.BgGreen} ready ${console_1.Colors.Reset} ${console_1.Colors.Bright}Ready on port ${console_1.Colors.BgGreen} ${options.port} ${console_1.Colors.Reset}${console_1.Colors.Bright} in ${Date.now() - time}ms${console_1.Colors.Reset}\n`);
297
361
  });
298
362
  // Configura WebSocket para hot reload (Comum a ambos)
299
363
  hwebApp.setupWebSocket(server);
@@ -325,7 +389,7 @@ function app(options = {}) {
325
389
  serverApp.use(cookieParser());
326
390
  }
327
391
  catch (e) {
328
- console_1.default.error("Não foi possivel achar cookie-parser");
392
+ console_1.default.error("Could not find cookie-parser");
329
393
  }
330
394
  serverApp.use(express.json());
331
395
  serverApp.use(express.urlencoded({ extended: true }));
@@ -337,13 +401,13 @@ function app(options = {}) {
337
401
  await serverApp.register(require('@fastify/cookie'));
338
402
  }
339
403
  catch (e) {
340
- console_1.default.error("Não foi possivel achar @fastify/cookie");
404
+ console_1.default.error("Could not find @fastify/cookie");
341
405
  }
342
406
  try {
343
407
  await serverApp.register(require('@fastify/formbody'));
344
408
  }
345
409
  catch (e) {
346
- console_1.default.error("Não foi possivel achar @fastify/formbody");
410
+ console_1.default.error("Could not find @fastify/formbody");
347
411
  }
348
412
  await serverApp.register(async (fastify) => {
349
413
  fastify.all('*', handler);
@@ -371,7 +435,7 @@ function app(options = {}) {
371
435
  return data.version;
372
436
  }
373
437
  catch (error) {
374
- console_1.default.error('Não foi possível verificar a versão mais recente do HightJS:', error);
438
+ console_1.default.error('Could not check for the latest HightJS version:', error);
375
439
  return currentVersion; // Retorna a versão atual em caso de erro
376
440
  }
377
441
  }
@@ -379,22 +443,20 @@ function app(options = {}) {
379
443
  const isUpToDate = latestVersion === currentVersion;
380
444
  let message;
381
445
  if (!isUpToDate) {
382
- message = `${console_1.Colors.FgGreen} uma nova versão disponível (v${latestVersion})${console_1.Colors.FgMagenta}`;
446
+ message = `${console_1.Colors.FgGreen} A new version is available (v${latestVersion})${console_1.Colors.FgMagenta}`;
383
447
  }
384
448
  else {
385
- message = `${console_1.Colors.FgGreen} Você está na versão mais recente${console_1.Colors.FgMagenta}`;
449
+ message = `${console_1.Colors.FgGreen} You are on the latest version${console_1.Colors.FgMagenta}`;
386
450
  }
387
451
  console.log(`${console_1.Colors.FgMagenta}
388
452
  __ ___ ${console_1.Colors.FgGreen} __ ${console_1.Colors.FgMagenta}
389
453
  |__| | / _\` |__| | ${console_1.Colors.FgGreen} | /__\` ${console_1.Colors.FgMagenta} ${console_1.Colors.FgMagenta}HightJS ${console_1.Colors.FgGray}(v${require('../package.json').version}) - itsmuzin${console_1.Colors.FgMagenta}
390
- | | | \\__> | | | ${console_1.Colors.FgGreen}\\__/ .__/ ${message}
391
-
392
-
454
+ | | | \\__> | | | ${console_1.Colors.FgGreen}\\__/ .__/ ${message}
393
455
  ${console_1.Colors.Reset}`);
394
456
  const actualPort = options.port || 3000;
395
457
  const actualHostname = options.hostname || "0.0.0.0";
396
458
  if (framework !== 'native') {
397
- console_1.default.warn(`O framework "${framework}" foi selecionado, mas o método init() funciona com o framework "native". Iniciando servidor nativo...`);
459
+ console_1.default.warn(`The "${framework}" framework was selected, but the init() method only works with the "native" framework. Starting native server...`);
398
460
  }
399
461
  return await initNativeServer(hwebApp, options, actualPort, actualHostname);
400
462
  }
package/dist/hotReload.js CHANGED
@@ -202,7 +202,7 @@ class HotReloadManager {
202
202
  this.clearBackendCache(filePath);
203
203
  // Se for arquivo de frontend, aguarda o build terminar antes de recarregar
204
204
  if (isFrontendFile) {
205
- console_1.default.logWithout(console_1.Levels.INFO, console_1.Colors.BgRed, `📄 Aguardando build do frontend...`);
205
+ console_1.default.logWithout(console_1.Levels.INFO, console_1.Colors.BgRed, `📄 Waiting for frontend build...`);
206
206
  // Marca que estamos esperando um build
207
207
  this.isBuilding = true;
208
208
  // Cria uma promise que será resolvida quando o build terminar
@@ -215,12 +215,12 @@ class HotReloadManager {
215
215
  });
216
216
  try {
217
217
  await Promise.race([buildPromise, timeoutPromise]);
218
- console_1.default.logWithout(console_1.Levels.INFO, console_1.Colors.BgRed, `✅ Build concluído, recarregando frontend...`);
218
+ console_1.default.logWithout(console_1.Levels.INFO, console_1.Colors.BgRed, `✅ Build complete, reloading frontend...`);
219
219
  this.frontendChangeCallback?.();
220
220
  this.notifyClients('frontend-reload', { file: filePath, event: 'change' });
221
221
  }
222
222
  catch (error) {
223
- console_1.default.logWithout(console_1.Levels.ERROR, console_1.Colors.BgRed, `⚠️ Timeout no build, recarregando mesmo assim...`);
223
+ console_1.default.logWithout(console_1.Levels.ERROR, console_1.Colors.BgRed, `⚠️ Timeout in build, reloading anyway...`);
224
224
  this.frontendChangeCallback?.();
225
225
  this.notifyClients('frontend-reload', { file: filePath, event: 'change' });
226
226
  }
@@ -231,13 +231,13 @@ class HotReloadManager {
231
231
  }
232
232
  // Se for arquivo de backend, recarrega o módulo e notifica
233
233
  if (isBackendFile) {
234
- console_1.default.logWithout(console_1.Levels.INFO, console_1.Colors.BgRed, `⚙️ Recarregando backend...`);
234
+ console_1.default.logWithout(console_1.Levels.INFO, console_1.Colors.BgRed, `⚙️ Reloading backend...`);
235
235
  this.backendApiChangeCallback?.();
236
236
  this.notifyClients('backend-api-reload', { file: filePath, event: 'change' });
237
237
  }
238
238
  // Fallback: se não for nem frontend nem backend detectado, recarrega tudo
239
239
  if (!isFrontendFile && !isBackendFile) {
240
- console_1.default.logWithout(console_1.Levels.INFO, console_1.Colors.BgRed, `🔄 Recarregando aplicação...`);
240
+ console_1.default.logWithout(console_1.Levels.INFO, console_1.Colors.BgRed, `🔄 Reloading application...`);
241
241
  this.frontendChangeCallback?.();
242
242
  this.backendApiChangeCallback?.();
243
243
  this.notifyClients('src-reload', { file: filePath, event: 'change' });
@@ -249,7 +249,7 @@ class HotReloadManager {
249
249
  }
250
250
  catch (error) {
251
251
  // @ts-ignore
252
- console_1.default.logWithout(console_1.Levels.ERROR, `Erro no listener customizado: ${error.message}`);
252
+ console_1.default.logWithout(console_1.Levels.ERROR, `Error in custom listener: ${error.message}`);
253
253
  }
254
254
  }
255
255
  }
@@ -265,7 +265,7 @@ class HotReloadManager {
265
265
  ws.send(message);
266
266
  }
267
267
  catch (error) {
268
- console_1.default.logWithout(console_1.Levels.ERROR, console_1.Colors.BgRed, `Erro ao enviar mensagem WebSocket: ${error}`);
268
+ console_1.default.logWithout(console_1.Levels.ERROR, console_1.Colors.BgRed, `Error sending WebSocket message: ${error}`);
269
269
  deadClients.push(ws);
270
270
  }
271
271
  }
@@ -327,7 +327,7 @@ class HotReloadManager {
327
327
  ws = new WebSocket('ws://localhost:3000/hweb-hotreload/');
328
328
 
329
329
  ws.onopen = function() {
330
- console.log('🔌 Hot-reload conectado');
330
+ console.log('🔌 Hot-reload connected');
331
331
  isConnected = true;
332
332
  reconnectAttempts = 0;
333
333
  reconnectInterval = 1000;
@@ -347,13 +347,13 @@ class HotReloadManager {
347
347
  window.location.reload();
348
348
  break;
349
349
  case 'server-restart':
350
- console.log('🔄 Servidor reiniciando...');
350
+ console.log('🔄 Server restarting...');
351
351
  break;
352
352
  case 'server-ready':
353
353
  setTimeout(() => window.location.reload(), 500);
354
354
  break;
355
355
  case 'frontend-error':
356
- console.error('❌ Erro no frontend:', message.data);
356
+ console.error('❌ Frontend error:', message.data);
357
357
  break;
358
358
  }
359
359
  } catch (e) {
@@ -378,7 +378,7 @@ class HotReloadManager {
378
378
  };
379
379
 
380
380
  } catch (error) {
381
- console.error('Erro ao criar WebSocket:', error);
381
+ console.error('Error creating WebSocket:', error);
382
382
  scheduleReconnect();
383
383
  }
384
384
  }
@@ -443,7 +443,7 @@ class HotReloadManager {
443
443
  }
444
444
  setHotReloadListener(listener) {
445
445
  this.customHotReloadListener = listener;
446
- console_1.default.info('🔌 Hot reload listener customizado registrado');
446
+ console_1.default.info('🔌 Hot reload custom listener registered');
447
447
  }
448
448
  removeHotReloadListener() {
449
449
  this.customHotReloadListener = null;
package/dist/index.d.ts CHANGED
@@ -8,11 +8,11 @@ export { FrameworkAdapterFactory } from './adapters/factory';
8
8
  export type { GenericRequest, GenericResponse, CookieOptions } from './types/framework';
9
9
  export { app } from './helpers';
10
10
  export type { WebSocketContext, WebSocketHandler } from './types';
11
+ export type { HightConfig, HightConfigFunction } from './types';
11
12
  export default function hweb(options: HightJSOptions): {
12
13
  prepare: () => Promise<void>;
13
14
  executeInstrumentation: () => void;
14
15
  getRequestHandler: () => RequestHandler;
15
16
  setupWebSocket: (server: any) => void;
16
- build: () => Promise<void>;
17
17
  stop: () => void;
18
18
  };
package/dist/index.js CHANGED
@@ -236,23 +236,20 @@ function hweb(options) {
236
236
  await hotReloadManager.start();
237
237
  // Adiciona callback para recarregar TUDO quando qualquer arquivo mudar
238
238
  hotReloadManager.onBackendApiChange(() => {
239
- console_1.default.info('🔄 Recarregando backend e dependências...');
240
239
  (0, router_1.loadBackendRoutes)(userBackendRoutesDir);
241
240
  (0, router_1.processWebSocketRoutes)(); // Processa rotas WS após recarregar backend
242
241
  });
243
242
  // Adiciona callback para regenerar entry file quando frontend mudar
244
243
  hotReloadManager.onFrontendChange(() => {
245
- console_1.default.info('🔄 Regenerando frontend...');
246
244
  regenerateEntryFile();
247
245
  });
248
246
  }
249
247
  const now = Date.now();
250
- const timee = console_1.default.dynamicLine(` ${console_1.Colors.BgYellow} router ${console_1.Colors.Reset} Carregando rotas e componentes do frontend e backend`);
248
+ const timee = console_1.default.dynamicLine(` ${console_1.Colors.BgYellow} router ${console_1.Colors.Reset} Loading routes and components`);
251
249
  const spinnerFrames1 = ['|', '/', '-', '\\'];
252
250
  let frameIndex1 = 0;
253
251
  const spinner1 = setInterval(() => {
254
- console_1.default.info('aaaa');
255
- timee.update(` ${console_1.Colors.FgYellow}${spinnerFrames1[frameIndex1]}${console_1.Colors.Reset} Carregando rotas e componentes...`);
252
+ timee.update(` ${console_1.Colors.FgYellow}${spinnerFrames1[frameIndex1]}${console_1.Colors.Reset} Loading routes and components...`);
256
253
  frameIndex1 = (frameIndex1 + 1) % spinnerFrames1.length;
257
254
  }, 100); // muda a cada 100ms
258
255
  // ORDEM IMPORTANTE: Carrega TUDO antes de criar o arquivo de entrada
@@ -267,14 +264,14 @@ function hweb(options) {
267
264
  fs_1.default.mkdirSync(outDir, { recursive: true });
268
265
  entryPoint = createEntryFile(dir, frontendRoutes);
269
266
  clearInterval(spinner1);
270
- timee.end(` ${console_1.Colors.BgGreen} router ${console_1.Colors.Reset} Rotas e componentes carregados em ${Date.now() - now}ms`);
267
+ timee.end(` ${console_1.Colors.BgGreen} router ${console_1.Colors.Reset} Routes and components loaded in ${Date.now() - now}ms`);
271
268
  if (isProduction) {
272
- const time = console_1.default.dynamicLine(` ${console_1.Colors.BgYellow} build ${console_1.Colors.Reset} Iniciando build do cliente para produção`);
269
+ const time = console_1.default.dynamicLine(` ${console_1.Colors.BgYellow} build ${console_1.Colors.Reset} Starting client build`);
273
270
  // Spinner
274
271
  const spinnerFrames = ['|', '/', '-', '\\'];
275
272
  let frameIndex = 0;
276
273
  const spinner = setInterval(() => {
277
- time.update(` ${console_1.Colors.FgYellow}${spinnerFrames[frameIndex]}${console_1.Colors.Reset} Buildando para produção...`);
274
+ time.update(` ${console_1.Colors.FgYellow}${spinnerFrames[frameIndex]}${console_1.Colors.Reset} Building...`);
278
275
  frameIndex = (frameIndex + 1) % spinnerFrames.length;
279
276
  }, 100); // muda a cada 100ms
280
277
  const now = Date.now();
@@ -282,14 +279,14 @@ function hweb(options) {
282
279
  const elapsed = Date.now() - now;
283
280
  clearInterval(spinner); // para o spinner
284
281
  time.update(""); // limpa a linha
285
- time.end(` ${console_1.Colors.BgGreen} build ${console_1.Colors.Reset} Build do cliente concluído em ${elapsed}ms`);
282
+ time.end(` ${console_1.Colors.BgGreen} build ${console_1.Colors.Reset} Client build completed in ${elapsed}ms`);
286
283
  }
287
284
  else {
288
- const time = console_1.default.dynamicLine(` ${console_1.Colors.BgYellow} watcher ${console_1.Colors.Reset} Iniciando watch do cliente`);
285
+ const time = console_1.default.dynamicLine(` ${console_1.Colors.BgYellow} watcher ${console_1.Colors.Reset} Starting client watch`);
289
286
  (0, builder_1.watchWithChunks)(entryPoint, outDir, hotReloadManager).catch(err => {
290
- console_1.default.error(`Erro ao iniciar o watch`, err);
287
+ console_1.default.error(`Error starting watch`, err);
291
288
  });
292
- time.end(` ${console_1.Colors.BgGreen} watcher ${console_1.Colors.Reset} Watch do cliente iniciado`);
289
+ time.end(` ${console_1.Colors.BgGreen} watcher ${console_1.Colors.Reset} Client Watch started`);
293
290
  }
294
291
  },
295
292
  executeInstrumentation: () => {
@@ -303,7 +300,6 @@ function hweb(options) {
303
300
  if (instrumentation.hotReloadListener && typeof instrumentation.hotReloadListener === 'function') {
304
301
  if (hotReloadManager) {
305
302
  hotReloadManager.setHotReloadListener(instrumentation.hotReloadListener);
306
- console_1.default.info('✅ Hot reload listener registrado');
307
303
  }
308
304
  }
309
305
  if (typeof instrumentation === 'function') {
@@ -313,7 +309,7 @@ function hweb(options) {
313
309
  instrumentation.default();
314
310
  }
315
311
  else {
316
- console_1.default.warn(`O arquivo de instrumentação ${instrumentationFile} não exporta uma função padrão.`);
312
+ console_1.default.warn(`The instrumentation file ${instrumentationFile} does not export a default function.`);
317
313
  }
318
314
  }
319
315
  },
@@ -420,8 +416,8 @@ function hweb(options) {
420
416
  }
421
417
  }
422
418
  catch (error) {
423
- console_1.default.error(`Erro na rota de API ${pathname}:`, error);
424
- genericRes.status(500).text('Erro interno do servidor na API');
419
+ console_1.default.error(`API route error ${pathname}:`, error);
420
+ genericRes.status(500).text('Internal server error in API');
425
421
  return;
426
422
  }
427
423
  }
@@ -446,8 +442,8 @@ function hweb(options) {
446
442
  return;
447
443
  }
448
444
  catch (error) {
449
- console_1.default.error(`Erro ao renderizar página 404:`, error);
450
- genericRes.status(404).text('Página não encontrada');
445
+ console_1.default.error(`Error rendering page 404:`, error);
446
+ genericRes.status(404).text('Page not found');
451
447
  return;
452
448
  }
453
449
  }
@@ -461,8 +457,8 @@ function hweb(options) {
461
457
  genericRes.status(200).header('Content-Type', 'text/html').send(html);
462
458
  }
463
459
  catch (error) {
464
- console_1.default.error(`Erro ao renderizar a página ${pathname}:`, error);
465
- genericRes.status(500).text('Erro interno do servidor');
460
+ console_1.default.error(`Error rendering page ${pathname}:`, error);
461
+ genericRes.status(500).text('Internal server error');
466
462
  }
467
463
  };
468
464
  },
@@ -474,16 +470,6 @@ function hweb(options) {
474
470
  // Usa o sistema coordenado de WebSocket upgrade que integra hot-reload e rotas de usuário
475
471
  (0, router_1.setupWebSocketUpgrade)(actualServer, hotReloadManager);
476
472
  },
477
- build: async () => {
478
- const msg = console_1.default.dynamicLine(` ${console_1.Colors.FgYellow}● ${console_1.Colors.Reset}Iniciando build do cliente para produção`);
479
- const outDir = path_1.default.join(dir, 'hweb-dist');
480
- fs_1.default.mkdirSync(outDir, { recursive: true });
481
- const routes = (0, router_1.loadRoutes)(userWebRoutesDir);
482
- const entryPoint = createEntryFile(dir, routes);
483
- const outfile = path_1.default.join(outDir, 'main.js');
484
- await (0, builder_1.build)(entryPoint, outfile, true); // Força produção no build manual
485
- msg.end(` ${console_1.Colors.FgGreen}● ${console_1.Colors.Reset}Build do cliente concluído: ${outfile}`);
486
- },
487
473
  stop: () => {
488
474
  if (hotReloadManager) {
489
475
  hotReloadManager.stop();