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.
- package/dist/adapters/express.js +1 -1
- package/dist/api/console.d.ts +6 -4
- package/dist/api/console.js +27 -9
- package/dist/auth/components.js +16 -0
- package/dist/auth/core.js +16 -0
- package/dist/auth/index.js +16 -0
- package/dist/auth/jwt.js +16 -0
- package/dist/auth/providers/index.js +16 -0
- package/dist/auth/providers.js +16 -0
- package/dist/auth/react/index.js +16 -0
- package/dist/auth/react.js +16 -0
- package/dist/auth/routes.js +16 -0
- package/dist/auth/types.js +16 -0
- package/dist/bin/hightjs.js +68 -11
- package/dist/builder.js +16 -0
- package/dist/client/clientRouter.js +16 -0
- package/dist/client/entry.client.js +16 -0
- package/dist/client.js +16 -0
- package/dist/helpers.d.ts +7 -6
- package/dist/helpers.js +284 -198
- package/dist/hotReload.js +23 -7
- package/dist/index.js +49 -25
- package/dist/router.js +16 -0
- package/dist/types.d.ts +6 -0
- package/docs/cli.md +4 -5
- package/package.json +1 -1
- package/src/adapters/express.ts +18 -1
- package/src/adapters/factory.ts +16 -0
- package/src/adapters/fastify.ts +16 -0
- package/src/adapters/native.ts +16 -0
- package/src/api/console.ts +28 -10
- package/src/api/http.ts +16 -0
- package/src/auth/client.ts +16 -0
- package/src/auth/components.tsx +16 -0
- package/src/auth/core.ts +16 -0
- package/src/auth/index.ts +16 -0
- package/src/auth/jwt.ts +16 -0
- package/src/auth/providers/credentials.ts +16 -0
- package/src/auth/providers/discord.ts +16 -0
- package/src/auth/providers/google.ts +16 -0
- package/src/auth/providers/index.ts +16 -0
- package/src/auth/providers.ts +16 -0
- package/src/auth/react/index.ts +16 -0
- package/src/auth/react.tsx +16 -0
- package/src/auth/routes.ts +17 -0
- package/src/auth/types.ts +17 -0
- package/src/bin/hightjs.js +79 -11
- package/src/builder.js +16 -0
- package/src/client/DefaultNotFound.tsx +16 -0
- package/src/client/clientRouter.ts +16 -0
- package/src/client/entry.client.tsx +16 -0
- package/src/client.ts +16 -0
- package/src/components/Link.tsx +16 -0
- package/src/helpers.ts +327 -215
- package/src/hotReload.ts +24 -8
- package/src/index.ts +54 -25
- package/src/renderer.tsx +16 -0
- package/src/router.ts +16 -0
- package/src/types/framework.ts +16 -0
- package/src/types.ts +22 -0
package/src/auth/types.ts
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the HightJS Project.
|
|
3
|
+
* Copyright (c) 2025 itsmuzin
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
1
18
|
// Tipos para o sistema de autenticação
|
|
2
19
|
export type User = Record<string, any>;
|
|
3
20
|
|
package/src/bin/hightjs.js
CHANGED
|
@@ -1,28 +1,97 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
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
|
+
*/
|
|
19
|
+
|
|
20
|
+
|
|
3
21
|
// Registra o ts-node para que o Node.js entenda TypeScript/TSX
|
|
4
22
|
require('ts-node').register();
|
|
5
23
|
|
|
6
24
|
const { program } = require('commander');
|
|
7
|
-
|
|
8
|
-
const fs = require('fs');
|
|
9
|
-
const path = require('path');
|
|
25
|
+
|
|
10
26
|
|
|
11
27
|
program
|
|
12
28
|
.version('1.0.0')
|
|
13
29
|
.description('CLI para gerenciar a aplicação.');
|
|
14
30
|
|
|
31
|
+
// --- Comando DEV ---
|
|
32
|
+
const fs = require('fs');
|
|
33
|
+
const path = require('path');
|
|
34
|
+
// 'program' já deve estar definido no seu arquivo
|
|
35
|
+
// const { program } = require('commander');
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Função centralizada para iniciar a aplicação
|
|
39
|
+
* @param {object} options - Opções vindas do commander
|
|
40
|
+
* @param {boolean} isDev - Define se é modo de desenvolvimento
|
|
41
|
+
*/
|
|
42
|
+
function initializeApp(options, isDev) {
|
|
43
|
+
const appOptions = {
|
|
44
|
+
dev: isDev,
|
|
45
|
+
port: options.port,
|
|
46
|
+
hostname: options.hostname,
|
|
47
|
+
framework: 'native',
|
|
48
|
+
ssl: null, // Default
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// 1. Verifica se a flag --ssl foi ativada
|
|
52
|
+
if (options.ssl) {
|
|
53
|
+
const C = require("../api/console")
|
|
54
|
+
const { Levels } = C;
|
|
55
|
+
const Console = C.default
|
|
56
|
+
const sslDir = path.resolve(process.cwd(), 'certs');
|
|
57
|
+
const keyPath = path.join(sslDir, 'key.pem'); // Padrão 1: key.pem
|
|
58
|
+
const certPath = path.join(sslDir, 'cert.pem'); // Padrão 2: cert.pem
|
|
59
|
+
// (Você pode mudar para 'cert.key' se preferir, apenas ajuste os nomes aqui)
|
|
60
|
+
|
|
61
|
+
// 2. Verifica se os arquivos existem
|
|
62
|
+
if (fs.existsSync(keyPath) && fs.existsSync(certPath)) {
|
|
63
|
+
appOptions.ssl = {
|
|
64
|
+
key: keyPath,
|
|
65
|
+
cert: certPath
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// 3. Adiciona a porta de redirecionamento (útil para o initNativeServer)
|
|
69
|
+
appOptions.ssl.redirectPort = options.httpRedirectPort || 80;
|
|
70
|
+
|
|
71
|
+
} else {
|
|
72
|
+
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.`)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
process.exit(1); // Encerra o processo com erro
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 4. Inicia o helper com as opções
|
|
80
|
+
const teste = require("../helpers");
|
|
81
|
+
const t = teste.default(appOptions);
|
|
82
|
+
t.init();
|
|
83
|
+
}
|
|
84
|
+
|
|
15
85
|
// --- Comando DEV ---
|
|
16
86
|
program
|
|
17
87
|
.command('dev')
|
|
18
88
|
.description('Inicia a aplicação em modo de desenvolvimento.')
|
|
19
89
|
.option('-p, --port <number>', 'Especifica a porta para rodar', '3000')
|
|
20
90
|
.option('-H, --hostname <string>', 'Especifica o hostname para rodar', '0.0.0.0')
|
|
21
|
-
.option('
|
|
91
|
+
.option('--ssl', 'Ativa o modo HTTPS/SSL (requer ./ssl/key.pem e ./ssl/cert.pem)')
|
|
92
|
+
.option('--http-redirect-port <number>', 'Porta para redirecionamento HTTP->HTTPS', '80')
|
|
22
93
|
.action((options) => {
|
|
23
|
-
|
|
24
|
-
const t = teste.default({ dev: true, port: options.port, hostname: options.hostname, framework: options.framework });
|
|
25
|
-
t.init()
|
|
94
|
+
initializeApp(options, true); // Chama a função com dev: true
|
|
26
95
|
});
|
|
27
96
|
|
|
28
97
|
// --- Comando START (Produção) ---
|
|
@@ -31,11 +100,10 @@ program
|
|
|
31
100
|
.description('Inicia a aplicação em modo produção.')
|
|
32
101
|
.option('-p, --port <number>', 'Especifica a porta para rodar', '3000')
|
|
33
102
|
.option('-H, --hostname <string>', 'Especifica o hostname para rodar', '0.0.0.0')
|
|
34
|
-
.option('
|
|
103
|
+
.option('--ssl', 'Ativa o modo HTTPS/SSL (requer ./ssl/key.pem e ./ssl/cert.pem)')
|
|
104
|
+
.option('--http-redirect-port <number>', 'Porta para redirecionamento HTTP->HTTPS', '80')
|
|
35
105
|
.action((options) => {
|
|
36
|
-
|
|
37
|
-
const t = teste.default({ dev: false, port: options.port, hostname: options.hostname, framework: options.framework });
|
|
38
|
-
t.init()
|
|
106
|
+
initializeApp(options, false); // Chama a função com dev: false
|
|
39
107
|
});
|
|
40
108
|
|
|
41
109
|
// --- Comando EXPORT ---
|
package/src/builder.js
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the HightJS Project.
|
|
3
|
+
* Copyright (c) 2025 itsmuzin
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
1
17
|
const esbuild = require('esbuild');
|
|
2
18
|
const path = require('path');
|
|
3
19
|
const Console = require("./api/console")
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the HightJS Project.
|
|
3
|
+
* Copyright (c) 2025 itsmuzin
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
1
17
|
import React from 'react';
|
|
2
18
|
|
|
3
19
|
export default function DefaultNotFound() {
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the HightJS Project.
|
|
3
|
+
* Copyright (c) 2025 itsmuzin
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
1
17
|
// Sistema de roteamento do lado do cliente para hweb-sdk
|
|
2
18
|
|
|
3
19
|
export interface RouterEvents {
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the HightJS Project.
|
|
3
|
+
* Copyright (c) 2025 itsmuzin
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
1
17
|
import React, {useState, useEffect, useCallback, useRef} from 'react';
|
|
2
18
|
import { createRoot } from 'react-dom/client';
|
|
3
19
|
import { router } from './clientRouter';
|
package/src/client.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the HightJS Project.
|
|
3
|
+
* Copyright (c) 2025 itsmuzin
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
1
17
|
// Este arquivo exporta apenas código seguro para o cliente (navegador)
|
|
2
18
|
export { Link } from './components/Link';
|
|
3
19
|
export { RouteConfig, Metadata } from "./types";
|
package/src/components/Link.tsx
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the HightJS Project.
|
|
3
|
+
* Copyright (c) 2025 itsmuzin
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
1
17
|
import React, { type AnchorHTMLAttributes, type ReactNode } from 'react';
|
|
2
18
|
import { router } from '../client/clientRouter';
|
|
3
19
|
|