hightjs 0.2.52 → 0.3.0

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 (60) hide show
  1. package/dist/adapters/express.js +1 -1
  2. package/dist/api/console.d.ts +6 -4
  3. package/dist/api/console.js +27 -9
  4. package/dist/auth/components.js +16 -0
  5. package/dist/auth/core.js +16 -0
  6. package/dist/auth/index.js +16 -0
  7. package/dist/auth/jwt.js +16 -0
  8. package/dist/auth/providers/index.js +16 -0
  9. package/dist/auth/providers.js +16 -0
  10. package/dist/auth/react/index.js +16 -0
  11. package/dist/auth/react.js +16 -0
  12. package/dist/auth/routes.js +16 -0
  13. package/dist/auth/types.js +16 -0
  14. package/dist/bin/hightjs.js +68 -11
  15. package/dist/builder.js +16 -0
  16. package/dist/client/clientRouter.js +16 -0
  17. package/dist/client/entry.client.js +16 -0
  18. package/dist/client.js +16 -0
  19. package/dist/helpers.d.ts +7 -6
  20. package/dist/helpers.js +284 -198
  21. package/dist/hotReload.js +23 -7
  22. package/dist/index.js +49 -25
  23. package/dist/router.js +16 -0
  24. package/dist/types.d.ts +6 -0
  25. package/docs/cli.md +4 -5
  26. package/package.json +1 -1
  27. package/src/adapters/express.ts +18 -1
  28. package/src/adapters/factory.ts +16 -0
  29. package/src/adapters/fastify.ts +16 -0
  30. package/src/adapters/native.ts +16 -0
  31. package/src/api/console.ts +28 -10
  32. package/src/api/http.ts +16 -0
  33. package/src/auth/client.ts +16 -0
  34. package/src/auth/components.tsx +16 -0
  35. package/src/auth/core.ts +16 -0
  36. package/src/auth/index.ts +16 -0
  37. package/src/auth/jwt.ts +16 -0
  38. package/src/auth/providers/credentials.ts +16 -0
  39. package/src/auth/providers/discord.ts +16 -0
  40. package/src/auth/providers/google.ts +16 -0
  41. package/src/auth/providers/index.ts +16 -0
  42. package/src/auth/providers.ts +16 -0
  43. package/src/auth/react/index.ts +16 -0
  44. package/src/auth/react.tsx +16 -0
  45. package/src/auth/routes.ts +17 -0
  46. package/src/auth/types.ts +17 -0
  47. package/src/bin/hightjs.js +79 -11
  48. package/src/builder.js +16 -0
  49. package/src/client/DefaultNotFound.tsx +16 -0
  50. package/src/client/clientRouter.ts +16 -0
  51. package/src/client/entry.client.tsx +16 -0
  52. package/src/client.ts +16 -0
  53. package/src/components/Link.tsx +16 -0
  54. package/src/helpers.ts +327 -215
  55. package/src/hotReload.ts +24 -8
  56. package/src/index.ts +54 -25
  57. package/src/renderer.tsx +16 -0
  58. package/src/router.ts +16 -0
  59. package/src/types/framework.ts +16 -0
  60. package/src/types.ts +22 -0
@@ -14,7 +14,7 @@ class ExpressAdapter {
14
14
  query: req.query,
15
15
  params: req.params,
16
16
  cookies: req.cookies || {},
17
- raw: req
17
+ raw: req,
18
18
  };
19
19
  }
20
20
  createResponse(res) {
@@ -34,6 +34,7 @@ export declare enum Colors {
34
34
  FgMagenta = "\u001B[35m",
35
35
  FgCyan = "\u001B[36m",
36
36
  FgWhite = "\u001B[37m",
37
+ FgGray = "\u001B[90m",// ← adicionado
37
38
  BgBlack = "\u001B[40m",
38
39
  BgRed = "\u001B[41m",
39
40
  BgGreen = "\u001B[42m",
@@ -41,7 +42,8 @@ export declare enum Colors {
41
42
  BgBlue = "\u001B[44m",
42
43
  BgMagenta = "\u001B[45m",
43
44
  BgCyan = "\u001B[46m",
44
- BgWhite = "\u001B[47m"
45
+ BgWhite = "\u001B[47m",
46
+ BgGray = "\u001B[100m"
45
47
  }
46
48
  export declare enum Levels {
47
49
  ERROR = "ERROR",
@@ -73,9 +75,9 @@ export default class Console {
73
75
  static info(...args: any[]): void;
74
76
  static success(...args: any[]): void;
75
77
  static debug(...args: any[]): void;
76
- static logCustomLevel(levelName: string, without?: boolean, ...args: any[]): void;
77
- static logWithout(level: Levels, ...args: any[]): void;
78
- static log(level: Levels, ...args: any[]): void;
78
+ static logCustomLevel(levelName: string, without?: boolean, color?: Colors, ...args: any[]): void;
79
+ static logWithout(level: Levels, colors?: Colors, ...args: any[]): void;
80
+ static log(level: Levels, colors?: Colors, ...args: any[]): void;
79
81
  static ask(question: string, defaultValue?: string): Promise<string>;
80
82
  static confirm(message: string, defaultYes?: boolean): Promise<boolean>;
81
83
  static table(data: Record<string, any> | Array<{
@@ -4,6 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Levels = exports.Colors = exports.DynamicLine = void 0;
7
+ /*
8
+ * This file is part of the HightJS Project.
9
+ * Copyright (c) 2025 itsmuzin
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ */
7
23
  const boxen_1 = __importDefault(require("boxen"));
8
24
  const node_readline_1 = __importDefault(require("node:readline"));
9
25
  /**
@@ -51,6 +67,7 @@ var Colors;
51
67
  Colors["FgMagenta"] = "\u001B[35m";
52
68
  Colors["FgCyan"] = "\u001B[36m";
53
69
  Colors["FgWhite"] = "\u001B[37m";
70
+ Colors["FgGray"] = "\u001B[90m";
54
71
  Colors["BgBlack"] = "\u001B[40m";
55
72
  Colors["BgRed"] = "\u001B[41m";
56
73
  Colors["BgGreen"] = "\u001B[42m";
@@ -59,6 +76,7 @@ var Colors;
59
76
  Colors["BgMagenta"] = "\u001B[45m";
60
77
  Colors["BgCyan"] = "\u001B[46m";
61
78
  Colors["BgWhite"] = "\u001B[47m";
79
+ Colors["BgGray"] = "\u001B[100m";
62
80
  })(Colors || (exports.Colors = Colors = {}));
63
81
  var Levels;
64
82
  (function (Levels) {
@@ -158,31 +176,31 @@ class Console {
158
176
  static info(...args) { this.log(Levels.INFO, ...args); }
159
177
  static success(...args) { this.log(Levels.SUCCESS, ...args); }
160
178
  static debug(...args) { this.log(Levels.DEBUG, ...args); }
161
- static logCustomLevel(levelName, without = true, ...args) {
179
+ static logCustomLevel(levelName, without = true, color, ...args) {
162
180
  if (without) {
163
- this.logWithout(levelName, ...args);
181
+ this.logWithout(levelName, color, ...args);
164
182
  }
165
183
  else {
166
- this.log(levelName, ...args);
184
+ this.log(levelName, color, ...args);
167
185
  }
168
186
  }
169
- static logWithout(level, ...args) {
170
- const color = level === Levels.ERROR ? Colors.FgRed : level === Levels.WARN ? Colors.FgYellow : level === Levels.INFO ? Colors.FgMagenta : level === Levels.SUCCESS ? Colors.FgGreen : Colors.FgCyan;
187
+ static logWithout(level, colors, ...args) {
188
+ const color = colors || level === Levels.ERROR ? Colors.BgRed : level === Levels.WARN ? Colors.BgYellow : level === Levels.INFO ? Colors.BgMagenta : level === Levels.SUCCESS ? Colors.BgGreen : Colors.BgCyan;
171
189
  let output = "";
172
190
  for (const arg of args) {
173
191
  let msg = (arg instanceof Error) ? arg.stack : (typeof arg === 'string') ? arg : JSON.stringify(arg, null, 2);
174
192
  if (msg)
175
- output += ` ${color}${level} ${Colors.Reset}${msg}\n`;
193
+ output += ` ${color} ${level} ${Colors.Reset} ${msg}\n`;
176
194
  }
177
195
  this.writeStatic(output);
178
196
  }
179
- static log(level, ...args) {
180
- const color = level === Levels.ERROR ? Colors.FgRed : level === Levels.WARN ? Colors.FgYellow : level === Levels.INFO ? Colors.FgMagenta : level === Levels.SUCCESS ? Colors.FgGreen : Colors.FgCyan;
197
+ static log(level, colors, ...args) {
198
+ const color = colors || level === Levels.ERROR ? Colors.BgRed : level === Levels.WARN ? Colors.BgYellow : level === Levels.INFO ? Colors.BgMagenta : level === Levels.SUCCESS ? Colors.BgGreen : Colors.BgCyan;
181
199
  let output = "\n";
182
200
  for (const arg of args) {
183
201
  let msg = (arg instanceof Error) ? arg.stack : (typeof arg === 'string') ? arg : JSON.stringify(arg, null, 2);
184
202
  if (msg)
185
- output += ` ${color}${level} ${Colors.Reset}${msg}\n`;
203
+ output += ` ${color} ${level} ${Colors.Reset} ${msg}\n`;
186
204
  }
187
205
  this.writeStatic(output);
188
206
  }
@@ -8,6 +8,22 @@ exports.AuthGuard = AuthGuard;
8
8
  exports.GuestOnly = GuestOnly;
9
9
  exports.useAuthRedirect = useAuthRedirect;
10
10
  const jsx_runtime_1 = require("react/jsx-runtime");
11
+ /*
12
+ * This file is part of the HightJS Project.
13
+ * Copyright (c) 2025 itsmuzin
14
+ *
15
+ * Licensed under the Apache License, Version 2.0 (the "License");
16
+ * you may not use this file except in compliance with the License.
17
+ * You may obtain a copy of the License at
18
+ *
19
+ * http://www.apache.org/licenses/LICENSE-2.0
20
+ *
21
+ * Unless required by applicable law or agreed to in writing, software
22
+ * distributed under the License is distributed on an "AS IS" BASIS,
23
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
+ * See the License for the specific language governing permissions and
25
+ * limitations under the License.
26
+ */
11
27
  const react_1 = __importDefault(require("react"));
12
28
  const react_2 = require("./react");
13
29
  const clientRouter_1 = require("../client/clientRouter");
package/dist/auth/core.js CHANGED
@@ -1,6 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HWebAuth = void 0;
4
+ /*
5
+ * This file is part of the HightJS Project.
6
+ * Copyright (c) 2025 itsmuzin
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
4
20
  const http_1 = require("../api/http");
5
21
  const jwt_1 = require("./jwt");
6
22
  class HWebAuth {
@@ -15,6 +15,22 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.createAuthRoutes = exports.GoogleProvider = exports.DiscordProvider = exports.CredentialsProvider = void 0;
18
+ /*
19
+ * This file is part of the HightJS Project.
20
+ * Copyright (c) 2025 itsmuzin
21
+ *
22
+ * Licensed under the Apache License, Version 2.0 (the "License");
23
+ * you may not use this file except in compliance with the License.
24
+ * You may obtain a copy of the License at
25
+ *
26
+ * http://www.apache.org/licenses/LICENSE-2.0
27
+ *
28
+ * Unless required by applicable law or agreed to in writing, software
29
+ * distributed under the License is distributed on an "AS IS" BASIS,
30
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
+ * See the License for the specific language governing permissions and
32
+ * limitations under the License.
33
+ */
18
34
  // Exportações principais do sistema de autenticação
19
35
  __exportStar(require("./types"), exports);
20
36
  __exportStar(require("./providers"), exports);
package/dist/auth/jwt.js CHANGED
@@ -4,6 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SessionManager = exports.JWTManager = void 0;
7
+ /*
8
+ * This file is part of the HightJS Project.
9
+ * Copyright (c) 2025 itsmuzin
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ */
7
23
  const crypto_1 = __importDefault(require("crypto"));
8
24
  class JWTManager {
9
25
  constructor(secret) {
@@ -14,6 +14,22 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ /*
18
+ * This file is part of the HightJS Project.
19
+ * Copyright (c) 2025 itsmuzin
20
+ *
21
+ * Licensed under the Apache License, Version 2.0 (the "License");
22
+ * you may not use this file except in compliance with the License.
23
+ * You may obtain a copy of the License at
24
+ *
25
+ * http://www.apache.org/licenses/LICENSE-2.0
26
+ *
27
+ * Unless required by applicable law or agreed to in writing, software
28
+ * distributed under the License is distributed on an "AS IS" BASIS,
29
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30
+ * See the License for the specific language governing permissions and
31
+ * limitations under the License.
32
+ */
17
33
  // Exportações dos providers
18
34
  __exportStar(require("./credentials"), exports);
19
35
  __exportStar(require("./discord"), exports);
@@ -1,6 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GoogleProvider = exports.DiscordProvider = exports.CredentialsProvider = void 0;
4
+ /*
5
+ * This file is part of the HightJS Project.
6
+ * Copyright (c) 2025 itsmuzin
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
4
20
  // Exportações dos providers
5
21
  var credentials_1 = require("./providers/credentials");
6
22
  Object.defineProperty(exports, "CredentialsProvider", { enumerable: true, get: function () { return credentials_1.CredentialsProvider; } });
@@ -15,6 +15,22 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.GuestOnly = exports.AuthGuard = exports.ProtectedRoute = exports.SessionProvider = exports.useAuth = exports.useSession = exports.getSession = void 0;
18
+ /*
19
+ * This file is part of the HightJS Project.
20
+ * Copyright (c) 2025 itsmuzin
21
+ *
22
+ * Licensed under the Apache License, Version 2.0 (the "License");
23
+ * you may not use this file except in compliance with the License.
24
+ * You may obtain a copy of the License at
25
+ *
26
+ * http://www.apache.org/licenses/LICENSE-2.0
27
+ *
28
+ * Unless required by applicable law or agreed to in writing, software
29
+ * distributed under the License is distributed on an "AS IS" BASIS,
30
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
+ * See the License for the specific language governing permissions and
32
+ * limitations under the License.
33
+ */
18
34
  // Exportações do frontend
19
35
  __exportStar(require("../react"), exports);
20
36
  __exportStar(require("../client"), exports);
@@ -4,6 +4,22 @@ exports.SessionProvider = SessionProvider;
4
4
  exports.useSession = useSession;
5
5
  exports.useAuth = useAuth;
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
+ /*
8
+ * This file is part of the HightJS Project.
9
+ * Copyright (c) 2025 itsmuzin
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ */
7
23
  const react_1 = require("react");
8
24
  const clientRouter_1 = require("../client/clientRouter");
9
25
  const SessionContext = (0, react_1.createContext)(undefined);
@@ -1,6 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createAuthRoutes = createAuthRoutes;
4
+ /*
5
+ * This file is part of the HightJS Project.
6
+ * Copyright (c) 2025 itsmuzin
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
4
20
  const http_1 = require("../api/http");
5
21
  const core_1 = require("./core");
6
22
  /**
@@ -1,2 +1,18 @@
1
1
  "use strict";
2
+ /*
3
+ * This file is part of the HightJS Project.
4
+ * Copyright (c) 2025 itsmuzin
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
2
18
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,25 +1,83 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ /*
4
+ * This file is part of the HightJS Project.
5
+ * Copyright (c) 2025 itsmuzin
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
3
19
  // Registra o ts-node para que o Node.js entenda TypeScript/TSX
4
20
  require('ts-node').register();
5
21
  const { program } = require('commander');
6
- const teste = require("../helpers");
7
- const fs = require('fs');
8
- const path = require('path');
9
22
  program
10
23
  .version('1.0.0')
11
24
  .description('CLI para gerenciar a aplicação.');
12
25
  // --- Comando DEV ---
26
+ const fs = require('fs');
27
+ const path = require('path');
28
+ // 'program' já deve estar definido no seu arquivo
29
+ // const { program } = require('commander');
30
+ /**
31
+ * Função centralizada para iniciar a aplicação
32
+ * @param {object} options - Opções vindas do commander
33
+ * @param {boolean} isDev - Define se é modo de desenvolvimento
34
+ */
35
+ function initializeApp(options, isDev) {
36
+ const appOptions = {
37
+ dev: isDev,
38
+ port: options.port,
39
+ hostname: options.hostname,
40
+ framework: 'native',
41
+ ssl: null, // Default
42
+ };
43
+ // 1. Verifica se a flag --ssl foi ativada
44
+ if (options.ssl) {
45
+ const C = require("../api/console");
46
+ const { Levels } = C;
47
+ const Console = C.default;
48
+ const sslDir = path.resolve(process.cwd(), 'certs');
49
+ const keyPath = path.join(sslDir, 'key.pem'); // Padrão 1: key.pem
50
+ const certPath = path.join(sslDir, 'cert.pem'); // Padrão 2: cert.pem
51
+ // (Você pode mudar para 'cert.key' se preferir, apenas ajuste os nomes aqui)
52
+ // 2. Verifica se os arquivos existem
53
+ if (fs.existsSync(keyPath) && fs.existsSync(certPath)) {
54
+ appOptions.ssl = {
55
+ key: keyPath,
56
+ cert: certPath
57
+ };
58
+ // 3. Adiciona a porta de redirecionamento (útil para o initNativeServer)
59
+ appOptions.ssl.redirectPort = options.httpRedirectPort || 80;
60
+ }
61
+ else {
62
+ Console.logWithout(Levels.ERROR, null, `Certifique-se que './certs/key.pem' e './certs/cert.pem' existem.`, `Flag --ssl foi usada, mas os arquivos não foram encontrados.`);
63
+ process.exit(1); // Encerra o processo com erro
64
+ }
65
+ }
66
+ // 4. Inicia o helper com as opções
67
+ const teste = require("../helpers");
68
+ const t = teste.default(appOptions);
69
+ t.init();
70
+ }
71
+ // --- Comando DEV ---
13
72
  program
14
73
  .command('dev')
15
74
  .description('Inicia a aplicação em modo de desenvolvimento.')
16
75
  .option('-p, --port <number>', 'Especifica a porta para rodar', '3000')
17
76
  .option('-H, --hostname <string>', 'Especifica o hostname para rodar', '0.0.0.0')
18
- .option('-f, --framework <string>', 'Especifica o framework a ser usado (native/express/fastify)', 'native')
77
+ .option('--ssl', 'Ativa o modo HTTPS/SSL (requer ./ssl/key.pem e ./ssl/cert.pem)')
78
+ .option('--http-redirect-port <number>', 'Porta para redirecionamento HTTP->HTTPS', '80')
19
79
  .action((options) => {
20
- const teste = require("../helpers");
21
- const t = teste.default({ dev: true, port: options.port, hostname: options.hostname, framework: options.framework });
22
- t.init();
80
+ initializeApp(options, true); // Chama a função com dev: true
23
81
  });
24
82
  // --- Comando START (Produção) ---
25
83
  program
@@ -27,11 +85,10 @@ program
27
85
  .description('Inicia a aplicação em modo produção.')
28
86
  .option('-p, --port <number>', 'Especifica a porta para rodar', '3000')
29
87
  .option('-H, --hostname <string>', 'Especifica o hostname para rodar', '0.0.0.0')
30
- .option('-f, --framework <string>', 'Especifica o framework a ser usado (native/express/fastify)', 'native')
88
+ .option('--ssl', 'Ativa o modo HTTPS/SSL (requer ./ssl/key.pem e ./ssl/cert.pem)')
89
+ .option('--http-redirect-port <number>', 'Porta para redirecionamento HTTP->HTTPS', '80')
31
90
  .action((options) => {
32
- const teste = require("../helpers");
33
- const t = teste.default({ dev: false, port: options.port, hostname: options.hostname, framework: options.framework });
34
- t.init();
91
+ initializeApp(options, false); // Chama a função com dev: false
35
92
  });
36
93
  // --- Comando EXPORT ---
37
94
  program
package/dist/builder.js CHANGED
@@ -1,4 +1,20 @@
1
1
  "use strict";
2
+ /*
3
+ * This file is part of the HightJS Project.
4
+ * Copyright (c) 2025 itsmuzin
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
2
18
  const esbuild = require('esbuild');
3
19
  const path = require('path');
4
20
  const Console = require("./api/console");
@@ -1,4 +1,20 @@
1
1
  "use strict";
2
+ /*
3
+ * This file is part of the HightJS Project.
4
+ * Copyright (c) 2025 itsmuzin
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
2
18
  // Sistema de roteamento do lado do cliente para hweb-sdk
3
19
  Object.defineProperty(exports, "__esModule", { value: true });
4
20
  exports.router = void 0;
@@ -34,6 +34,22 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  const jsx_runtime_1 = require("react/jsx-runtime");
37
+ /*
38
+ * This file is part of the HightJS Project.
39
+ * Copyright (c) 2025 itsmuzin
40
+ *
41
+ * Licensed under the Apache License, Version 2.0 (the "License");
42
+ * you may not use this file except in compliance with the License.
43
+ * You may obtain a copy of the License at
44
+ *
45
+ * http://www.apache.org/licenses/LICENSE-2.0
46
+ *
47
+ * Unless required by applicable law or agreed to in writing, software
48
+ * distributed under the License is distributed on an "AS IS" BASIS,
49
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
50
+ * See the License for the specific language governing permissions and
51
+ * limitations under the License.
52
+ */
37
53
  const react_1 = __importStar(require("react"));
38
54
  const client_1 = require("react-dom/client");
39
55
  const clientRouter_1 = require("./clientRouter");
package/dist/client.js CHANGED
@@ -1,6 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.router = exports.Link = void 0;
4
+ /*
5
+ * This file is part of the HightJS Project.
6
+ * Copyright (c) 2025 itsmuzin
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
4
20
  // Este arquivo exporta apenas código seguro para o cliente (navegador)
5
21
  var Link_1 = require("./components/Link");
6
22
  Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return Link_1.Link; } });
package/dist/helpers.d.ts CHANGED
@@ -1,18 +1,19 @@
1
+ import http, { Server } from 'http';
1
2
  import type { HightJSOptions } from './types';
2
- export default app;
3
+ import https from 'https';
3
4
  export declare function app(options?: HightJSOptions): {
4
5
  /**
5
6
  * Integra com uma aplicação de qualquer framework (Express, Fastify, etc)
7
+ * O 'serverApp: any' é mantido para flexibilidade, já que pode ser de tipos diferentes.
6
8
  */
7
9
  integrate: (serverApp: any) => Promise<any>;
8
10
  /**
9
11
  * Inicia um servidor HightJS fechado (o usuário não tem acesso ao framework)
10
12
  */
11
- init: () => Promise<any>;
13
+ init: () => Promise<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse> | https.Server<typeof http.IncomingMessage, typeof http.ServerResponse>>;
12
14
  prepare: () => Promise<void>;
15
+ getRequestHandler: () => (req: any, res: any, next?: any) => Promise<void> | void;
16
+ setupWebSocket: (server: Server | any) => void;
13
17
  executeInstrumentation: () => void;
14
- getRequestHandler: () => import("./types").RequestHandler;
15
- setupWebSocket: (server: any) => void;
16
- build: () => Promise<void>;
17
- stop: () => void;
18
18
  };
19
+ export default app;