hightjs 0.5.2 → 0.5.3

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.
Files changed (48) hide show
  1. package/package.json +1 -1
  2. package/src/builder.js +8 -8
  3. package/src/hotReload.ts +4 -7
  4. package/src/router.ts +14 -26
  5. package/dist/adapters/express.d.ts +0 -7
  6. package/dist/adapters/express.js +0 -63
  7. package/dist/adapters/factory.d.ts +0 -23
  8. package/dist/adapters/factory.js +0 -122
  9. package/dist/adapters/fastify.d.ts +0 -25
  10. package/dist/adapters/fastify.js +0 -61
  11. package/dist/adapters/native.d.ts +0 -8
  12. package/dist/adapters/native.js +0 -198
  13. package/dist/api/console.d.ts +0 -94
  14. package/dist/api/console.js +0 -294
  15. package/dist/api/http.d.ts +0 -180
  16. package/dist/api/http.js +0 -469
  17. package/dist/bin/hightjs.d.ts +0 -2
  18. package/dist/bin/hightjs.js +0 -214
  19. package/dist/builder.d.ts +0 -32
  20. package/dist/builder.js +0 -581
  21. package/dist/client/DefaultNotFound.d.ts +0 -1
  22. package/dist/client/DefaultNotFound.js +0 -79
  23. package/dist/client/client.d.ts +0 -3
  24. package/dist/client/client.js +0 -24
  25. package/dist/client/clientRouter.d.ts +0 -58
  26. package/dist/client/clientRouter.js +0 -132
  27. package/dist/client/entry.client.d.ts +0 -1
  28. package/dist/client/entry.client.js +0 -455
  29. package/dist/components/Link.d.ts +0 -7
  30. package/dist/components/Link.js +0 -13
  31. package/dist/global/global.d.ts +0 -117
  32. package/dist/global/global.js +0 -17
  33. package/dist/helpers.d.ts +0 -20
  34. package/dist/helpers.js +0 -583
  35. package/dist/hotReload.d.ts +0 -32
  36. package/dist/hotReload.js +0 -548
  37. package/dist/index.d.ts +0 -18
  38. package/dist/index.js +0 -494
  39. package/dist/loaders.d.ts +0 -1
  40. package/dist/loaders.js +0 -46
  41. package/dist/renderer.d.ts +0 -14
  42. package/dist/renderer.js +0 -380
  43. package/dist/router.d.ts +0 -101
  44. package/dist/router.js +0 -667
  45. package/dist/types/framework.d.ts +0 -37
  46. package/dist/types/framework.js +0 -2
  47. package/dist/types.d.ts +0 -192
  48. package/dist/types.js +0 -2
@@ -1,37 +0,0 @@
1
- export interface GenericRequest {
2
- method: string;
3
- url: string;
4
- headers: Record<string, string | string[]>;
5
- body?: any;
6
- query?: Record<string, any>;
7
- params?: Record<string, string>;
8
- cookies?: Record<string, string>;
9
- raw?: any;
10
- }
11
- export interface GenericResponse {
12
- status(code: number): GenericResponse;
13
- header(name: string, value: string): GenericResponse;
14
- cookie(name: string, value: string, options?: CookieOptions): GenericResponse;
15
- clearCookie(name: string, options?: CookieOptions): GenericResponse;
16
- json(data: any): void;
17
- text(data: string): void;
18
- send(data: any): void;
19
- redirect(url: string): void;
20
- raw?: any;
21
- }
22
- export interface CookieOptions {
23
- domain?: string;
24
- expires?: Date;
25
- httpOnly?: boolean;
26
- maxAge?: number;
27
- path?: string;
28
- secure?: boolean;
29
- signed?: boolean;
30
- sameSite?: boolean | 'lax' | 'strict' | 'none';
31
- }
32
- export type FrameworkType = 'express' | 'fastify' | 'native';
33
- export interface FrameworkAdapter {
34
- type: FrameworkType;
35
- parseRequest(req: any): GenericRequest;
36
- createResponse(res: any): GenericResponse;
37
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/dist/types.d.ts DELETED
@@ -1,192 +0,0 @@
1
- import type { ComponentType } from 'react';
2
- import type { GenericRequest } from './types/framework';
3
- import { HightJSRequest, HightJSResponse } from "./api/http";
4
- import { WebSocket } from 'ws';
5
- import { IncomingMessage } from 'http';
6
- export interface WebSocketContext {
7
- ws: WebSocket;
8
- req: IncomingMessage;
9
- hightReq: HightJSRequest;
10
- url: URL;
11
- params: Record<string, string>;
12
- query: Record<string, string>;
13
- send: (data: any) => void;
14
- close: (code?: number, reason?: string) => void;
15
- broadcast: (data: any, exclude?: WebSocket[]) => void;
16
- }
17
- export interface HightJSOptions {
18
- dev?: boolean;
19
- hostname?: string;
20
- port?: number;
21
- dir?: string;
22
- framework?: 'express' | 'fastify' | 'native';
23
- ssl?: {
24
- redirectPort: number;
25
- key: string;
26
- cert: string;
27
- ca?: string;
28
- };
29
- }
30
- /**
31
- * Interface para as configurações avançadas do servidor HightJS.
32
- * Essas configurações podem ser definidas no arquivo hightjs.config.js
33
- */
34
- export interface HightConfig {
35
- /**
36
- * Limita o número máximo de headers HTTP permitidos por requisição.
37
- * Padrão: 100
38
- */
39
- maxHeadersCount?: number;
40
- /**
41
- * Timeout em milissegundos para receber os headers HTTP.
42
- * Padrão: 60000 (60 segundos)
43
- */
44
- headersTimeout?: number;
45
- /**
46
- * Timeout em milissegundos para uma requisição completa.
47
- * Padrão: 30000 (30 segundos)
48
- */
49
- requestTimeout?: number;
50
- /**
51
- * Timeout geral do servidor em milissegundos.
52
- * Padrão: 35000 (35 segundos)
53
- */
54
- serverTimeout?: number;
55
- /**
56
- * Timeout por requisição individual em milissegundos.
57
- * Padrão: 30000 (30 segundos)
58
- */
59
- individualRequestTimeout?: number;
60
- /**
61
- * Tamanho máximo permitido para a URL em caracteres.
62
- * Padrão: 2048
63
- */
64
- maxUrlLength?: number;
65
- /**
66
- * Habilita o log de acesso HTTP (ex: GET /api/users 200 15ms).
67
- * Padrão: false
68
- */
69
- accessLogging?: boolean;
70
- /**
71
- * Configurações de CORS (Cross-Origin Resource Sharing).
72
- * Define quais origens podem acessar seus recursos.
73
- */
74
- cors?: {
75
- /**
76
- * Origens permitidas. Pode ser:
77
- * - Uma string específica: 'https://exemplo.com'
78
- * - Um array de strings: ['https://exemplo.com', 'https://outro.com']
79
- * - Um wildcard: '*' (permite todas as origens - não recomendado em produção)
80
- * - Uma função que retorna boolean: (origin) => origin.endsWith('.exemplo.com')
81
- */
82
- origin?: string | string[] | ((origin: string) => boolean);
83
- /**
84
- * Métodos HTTP permitidos.
85
- * Padrão: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS']
86
- */
87
- methods?: string[];
88
- /**
89
- * Headers permitidos nas requisições.
90
- * Padrão: ['Content-Type', 'Authorization']
91
- */
92
- allowedHeaders?: string[];
93
- /**
94
- * Headers que serão expostos ao cliente.
95
- * Padrão: []
96
- */
97
- exposedHeaders?: string[];
98
- /**
99
- * Permite o envio de credenciais (cookies, headers de autenticação).
100
- * Padrão: false
101
- */
102
- credentials?: boolean;
103
- /**
104
- * Tempo em segundos que o navegador deve cachear a resposta preflight.
105
- * Padrão: 86400 (24 horas)
106
- */
107
- maxAge?: number;
108
- /**
109
- * Habilita ou desabilita completamente o CORS.
110
- * Padrão: false
111
- */
112
- enabled?: boolean;
113
- };
114
- }
115
- /**
116
- * Tipo da função de configuração que pode ser exportada no hightjs.config.js
117
- */
118
- export type HightConfigFunction = (phase: string, context: {
119
- defaultConfig: HightConfig;
120
- }) => HightConfig | Promise<HightConfig>;
121
- export interface Metadata {
122
- title?: string;
123
- description?: string;
124
- keywords?: string | string[];
125
- author?: string;
126
- favicon?: string;
127
- viewport?: string;
128
- themeColor?: string;
129
- canonical?: string;
130
- robots?: string;
131
- openGraph?: {
132
- title?: string;
133
- description?: string;
134
- type?: string;
135
- url?: string;
136
- image?: string | {
137
- url: string;
138
- width?: number;
139
- height?: number;
140
- alt?: string;
141
- };
142
- siteName?: string;
143
- locale?: string;
144
- };
145
- twitter?: {
146
- card?: 'summary' | 'summary_large_image' | 'app' | 'player';
147
- site?: string;
148
- creator?: string;
149
- title?: string;
150
- description?: string;
151
- image?: string;
152
- imageAlt?: string;
153
- };
154
- language?: string;
155
- charset?: string;
156
- appleTouchIcon?: string;
157
- manifest?: string;
158
- other?: Record<string, string>;
159
- }
160
- export interface RouteConfig {
161
- pattern: string;
162
- component: ComponentType<any>;
163
- generateMetadata?: (params: any, req: GenericRequest) => Promise<Metadata> | Metadata;
164
- }
165
- export type RequestHandler = (req: any, res: any) => Promise<void>;
166
- /**
167
- * Define o formato de uma função que manipula uma rota da API.
168
- */
169
- export type BackendHandler = (request: HightJSRequest, // HWebRequest será importado onde necessário
170
- params: {
171
- [key: string]: string;
172
- }) => Promise<HightJSResponse> | HightJSResponse;
173
- export type HightMiddleware = (request: HightJSRequest, // HWebRequest será importado onde necessário
174
- params: {
175
- [key: string]: string;
176
- }, next: () => Promise<HightJSResponse>) => Promise<HightJSResponse> | HightJSResponse;
177
- /**
178
- * Define o formato de uma função que manipula uma rota WebSocket.
179
- */
180
- export type WebSocketHandler = (context: WebSocketContext) => Promise<void> | void;
181
- /**
182
- * Define a estrutura de cada rota da API, com suporte para métodos HTTP e WebSocket.
183
- */
184
- export interface BackendRouteConfig {
185
- pattern: string;
186
- GET?: BackendHandler;
187
- POST?: BackendHandler;
188
- PUT?: BackendHandler;
189
- DELETE?: BackendHandler;
190
- WS?: WebSocketHandler;
191
- middleware?: HightMiddleware[];
192
- }
package/dist/types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });