hightjs 0.4.0 → 0.5.1

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 (117) hide show
  1. package/README.md +42 -126
  2. package/dist/bin/hightjs.js +51 -23
  3. package/dist/builder.js +139 -4
  4. package/dist/client/DefaultNotFound.d.ts +1 -1
  5. package/dist/client/DefaultNotFound.js +72 -46
  6. package/dist/client/client.d.ts +3 -0
  7. package/dist/{client.js → client/client.js} +4 -4
  8. package/dist/client/entry.client.js +39 -29
  9. package/dist/global/global.d.ts +117 -0
  10. package/dist/{auth/types.js → global/global.js} +0 -1
  11. package/dist/helpers.js +80 -2
  12. package/dist/hotReload.js +2 -2
  13. package/dist/index.js +16 -16
  14. package/dist/loaders.d.ts +1 -0
  15. package/dist/loaders.js +46 -0
  16. package/dist/renderer.js +158 -4
  17. package/dist/types.d.ts +44 -0
  18. package/package.json +37 -31
  19. package/src/bin/hightjs.js +59 -29
  20. package/src/builder.js +163 -4
  21. package/src/client/DefaultNotFound.tsx +88 -53
  22. package/src/{client.ts → client/client.ts} +4 -3
  23. package/src/client/entry.client.tsx +44 -29
  24. package/src/global/global.ts +171 -0
  25. package/src/helpers.ts +91 -2
  26. package/src/hotReload.ts +2 -2
  27. package/src/index.ts +2 -0
  28. package/src/loaders.js +53 -0
  29. package/src/renderer.tsx +162 -4
  30. package/src/types.ts +51 -0
  31. package/.idea/HightJS.iml +0 -9
  32. package/.idea/copilot.data.migration.agent.xml +0 -6
  33. package/.idea/copilot.data.migration.ask.xml +0 -6
  34. package/.idea/copilot.data.migration.ask2agent.xml +0 -6
  35. package/.idea/copilot.data.migration.edit.xml +0 -6
  36. package/.idea/copilotDiffState.xml +0 -67
  37. package/.idea/inspectionProfiles/Project_Default.xml +0 -13
  38. package/.idea/libraries/test_package.xml +0 -9
  39. package/.idea/libraries/ts_commonjs_default_export.xml +0 -9
  40. package/.idea/misc.xml +0 -7
  41. package/.idea/modules.xml +0 -8
  42. package/.idea/vcs.xml +0 -6
  43. package/dist/auth/client.d.ts +0 -24
  44. package/dist/auth/client.js +0 -146
  45. package/dist/auth/components.d.ts +0 -29
  46. package/dist/auth/components.js +0 -100
  47. package/dist/auth/core.d.ts +0 -55
  48. package/dist/auth/core.js +0 -189
  49. package/dist/auth/index.d.ts +0 -7
  50. package/dist/auth/index.js +0 -45
  51. package/dist/auth/jwt.d.ts +0 -41
  52. package/dist/auth/jwt.js +0 -185
  53. package/dist/auth/providers/credentials.d.ts +0 -60
  54. package/dist/auth/providers/credentials.js +0 -97
  55. package/dist/auth/providers/discord.d.ts +0 -63
  56. package/dist/auth/providers/discord.js +0 -190
  57. package/dist/auth/providers/google.d.ts +0 -63
  58. package/dist/auth/providers/google.js +0 -186
  59. package/dist/auth/providers/index.d.ts +0 -2
  60. package/dist/auth/providers/index.js +0 -35
  61. package/dist/auth/providers.d.ts +0 -3
  62. package/dist/auth/providers.js +0 -26
  63. package/dist/auth/react/index.d.ts +0 -6
  64. package/dist/auth/react/index.js +0 -48
  65. package/dist/auth/react.d.ts +0 -22
  66. package/dist/auth/react.js +0 -199
  67. package/dist/auth/routes.d.ts +0 -16
  68. package/dist/auth/routes.js +0 -152
  69. package/dist/auth/types.d.ts +0 -76
  70. package/dist/client.d.ts +0 -3
  71. package/docs/README.md +0 -58
  72. package/docs/arquivos-especiais.md +0 -10
  73. package/docs/autenticacao.md +0 -212
  74. package/docs/checklist.md +0 -9
  75. package/docs/cli.md +0 -72
  76. package/docs/config.md +0 -216
  77. package/docs/estrutura.md +0 -20
  78. package/docs/faq.md +0 -10
  79. package/docs/hot-reload.md +0 -5
  80. package/docs/integracoes.md +0 -240
  81. package/docs/middlewares.md +0 -73
  82. package/docs/rotas-backend.md +0 -45
  83. package/docs/rotas-frontend.md +0 -66
  84. package/docs/seguranca.md +0 -8
  85. package/docs/websocket.md +0 -45
  86. package/example/certs/cert.pem +0 -20
  87. package/example/certs/key.pem +0 -27
  88. package/example/hightjs.config.ts +0 -87
  89. package/example/package-lock.json +0 -1174
  90. package/example/package.json +0 -26
  91. package/example/postcss.config.js +0 -8
  92. package/example/src/backend/auth.ts +0 -42
  93. package/example/src/backend/routes/auth.ts +0 -3
  94. package/example/src/backend/routes/version.ts +0 -13
  95. package/example/src/web/components/Home.tsx +0 -140
  96. package/example/src/web/components/LoginPage.tsx +0 -149
  97. package/example/src/web/globals.css +0 -5
  98. package/example/src/web/layout.tsx +0 -100
  99. package/example/src/web/routes/index.tsx +0 -13
  100. package/example/src/web/routes/login.tsx +0 -30
  101. package/example/tailwind.config.js +0 -12
  102. package/example/tsconfig.json +0 -15
  103. package/src/auth/client.ts +0 -171
  104. package/src/auth/components.tsx +0 -125
  105. package/src/auth/core.ts +0 -215
  106. package/src/auth/index.ts +0 -25
  107. package/src/auth/jwt.ts +0 -210
  108. package/src/auth/providers/credentials.ts +0 -139
  109. package/src/auth/providers/discord.ts +0 -239
  110. package/src/auth/providers/google.ts +0 -234
  111. package/src/auth/providers/index.ts +0 -20
  112. package/src/auth/providers.ts +0 -20
  113. package/src/auth/react/index.ts +0 -25
  114. package/src/auth/react.tsx +0 -234
  115. package/src/auth/routes.ts +0 -183
  116. package/src/auth/types.ts +0 -108
  117. package/tsconfig.json +0 -17
package/package.json CHANGED
@@ -1,14 +1,24 @@
1
1
  {
2
2
  "name": "hightjs",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "HightJS is a high-level framework for building web applications with ease and speed. It provides a robust set of tools and features to streamline development and enhance productivity.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "author": "itsmuzin",
8
8
  "license": "Apache-2.0",
9
- "scripts": {
10
- "build": "tsc"
11
- },
9
+ "keywords": [
10
+ "hightjs",
11
+ "framework",
12
+ "web",
13
+ "typescript",
14
+ "react"
15
+ ],
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "dist/global/global.d.ts",
20
+ "src"
21
+ ],
12
22
  "bin": {
13
23
  "hight": "./dist/bin/hightjs.js"
14
24
  },
@@ -18,25 +28,18 @@
18
28
  "import": "./dist/index.js",
19
29
  "require": "./dist/index.js"
20
30
  },
21
- "./client": {
22
- "types": "./dist/client.d.ts",
23
- "import": "./dist/client.js",
24
- "require": "./dist/client.js"
31
+ "./react": {
32
+ "types": "./dist/client/client.d.ts",
33
+ "import": "./dist/client/client.js",
34
+ "require": "./dist/client/client.js"
25
35
  },
26
36
  "./helpers": {
27
37
  "types": "./dist/helpers.d.ts",
28
38
  "import": "./dist/helpers.js",
29
39
  "require": "./dist/helpers.js"
30
40
  },
31
- "./auth": {
32
- "types": "./dist/auth/index.d.ts",
33
- "import": "./dist/auth/index.js",
34
- "require": "./dist/auth/index.js"
35
- },
36
- "./auth/react": {
37
- "types": "./dist/auth/react/index.d.ts",
38
- "import": "./dist/auth/react/index.js",
39
- "require": "./dist/auth/react/index.js"
41
+ "./global": {
42
+ "types": "./dist/global/global.d.ts"
40
43
  },
41
44
  "./eslint": {
42
45
  "types": "./dist/eslint/index.d.ts",
@@ -44,16 +47,9 @@
44
47
  "require": "./dist/eslint/index.js"
45
48
  }
46
49
  },
47
- "devDependencies": {
48
- "@types/express": "^4.17.21",
49
- "@types/fs-extra": "^11.0.4",
50
- "@types/node": "^20.11.24",
51
- "@types/react": "^19.2.0",
52
- "@types/react-dom": "^19.2.0",
53
- "@types/ws": "^8.18.1",
54
- "ts-loader": "^9.5.4",
55
- "ts-node": "^10.9.2",
56
- "typescript": "^5.9.3"
50
+ "peerDependencies": {
51
+ "react": "^19.2.0",
52
+ "react-dom": "^19.2.0"
57
53
  },
58
54
  "dependencies": {
59
55
  "@fastify/cookie": "^11.0.2",
@@ -69,8 +65,18 @@
69
65
  "fs-extra": "^11.3.2",
70
66
  "ws": "^8.18.1"
71
67
  },
72
- "peerDependency": {
73
- "react": "^19.2.0",
74
- "react-dom": "^19.2.0"
68
+ "devDependencies": {
69
+ "@types/express": "^4.17.21",
70
+ "@types/fs-extra": "^11.0.4",
71
+ "@types/node": "^20.11.24",
72
+ "@types/react": "^19.2.0",
73
+ "@types/react-dom": "^19.2.0",
74
+ "@types/ws": "^8.18.1",
75
+ "ts-loader": "^9.5.4",
76
+ "ts-node": "^10.9.2",
77
+ "typescript": "^5.9.3"
78
+ },
79
+ "scripts": {
80
+ "build": "tsc"
75
81
  }
76
- }
82
+ }
@@ -21,6 +21,10 @@
21
21
  // Registra o ts-node para que o Node.js entenda TypeScript/TSX
22
22
  require('ts-node').register();
23
23
 
24
+ // Registra loaders customizados para arquivos markdown, imagens, etc.
25
+ const { registerLoaders } = require('../loaders');
26
+ registerLoaders();
27
+
24
28
  const { program } = require('commander');
25
29
 
26
30
 
@@ -106,14 +110,48 @@ program
106
110
  initializeApp(options, false); // Chama a função com dev: false
107
111
  });
108
112
 
109
- // --- Comando EXPORT ---
113
+ /**
114
+ * Função corrigida para copiar diretórios recursivamente.
115
+ * Ela agora verifica se um item é um arquivo ou um diretório.
116
+ */
117
+ function copyDirRecursive(src, dest) {
118
+ try {
119
+ // Garante que o diretório de destino exista
120
+ fs.mkdirSync(dest, { recursive: true });
121
+
122
+ // Usamos { withFileTypes: true } para evitar uma chamada extra de fs.statSync
123
+ const entries = fs.readdirSync(src, { withFileTypes: true });
124
+
125
+ for (let entry of entries) {
126
+ const srcPath = path.join(src, entry.name);
127
+ const destPath = path.join(dest, entry.name);
128
+
129
+ if (entry.isDirectory()) {
130
+ // Se for um diretório, chama a si mesma (recursão)
131
+ copyDirRecursive(srcPath, destPath);
132
+ } else {
133
+ // Se for um arquivo, apenas copia
134
+ fs.copyFileSync(srcPath, destPath);
135
+ }
136
+ }
137
+ } catch (error) {
138
+ console.error(`❌ Erro ao copiar ${src} para ${dest}:`, error);
139
+ // Lança o erro para parar o processo de exportação se a cópia falhar
140
+ throw error;
141
+ }
142
+ }
143
+
144
+
145
+ // --- INÍCIO DO SEU CÓDIGO (AGORA CORRIGIDO) ---
146
+
110
147
  program
111
148
  .command('export')
112
149
  .description('Exports the application as static HTML to the "exported" folder.')
113
150
  .option('-o, --output <path>', 'Specifies the output directory', 'exported')
114
151
  .action(async (options) => {
115
152
  const projectDir = process.cwd();
116
- const exportDir = path.join(projectDir, options.output);
153
+ // Usar path.resolve é mais seguro para garantir um caminho absoluto
154
+ const exportDir = path.resolve(projectDir, options.output);
117
155
 
118
156
  console.log('🚀 Starting export...\n');
119
157
 
@@ -128,51 +166,43 @@ program
128
166
 
129
167
  // 2. Inicializa e prepara o build
130
168
  console.log('🔨 Building application...');
169
+ // ATENÇÃO: Ajuste o caminho deste 'require' conforme a estrutura do seu projeto!
131
170
  const teste = require("../helpers");
132
171
  const app = teste.default({ dev: false, port: 3000, hostname: '0.0.0.0', framework: 'native' });
133
172
  await app.prepare();
134
173
  console.log('✅ Build complete\n');
135
174
 
136
- // 3. Copia a pasta .hight para exported
175
+ // 3. Copia a pasta .hight para exported (*** CORRIGIDO ***)
137
176
  const distDir = path.join(projectDir, '.hight');
138
177
  if (fs.existsSync(distDir)) {
139
178
  console.log('📦 Copying JavaScript files...');
140
179
  const exportDistDir = path.join(exportDir, '.hight');
141
- fs.mkdirSync(exportDistDir, { recursive: true });
142
-
143
- const files = fs.readdirSync(distDir);
144
- files.forEach(file => {
145
- fs.copyFileSync(
146
- path.join(distDir, file),
147
- path.join(exportDistDir, file)
148
- );
149
- });
180
+
181
+ // --- Lógica de cópia substituída ---
182
+ // A função copyDirRecursive agora lida com tudo (arquivos e subpastas)
183
+ copyDirRecursive(distDir, exportDistDir);
184
+ // --- Fim da substituição ---
185
+
150
186
  console.log('✅ JavaScript files copied\n');
151
187
  }
152
188
 
153
- // 4. Copia a pasta public se existir
189
+ // 4. Copia a pasta public se existir (*** CORRIGIDO ***)
154
190
  const publicDir = path.join(projectDir, 'public');
155
191
  if (fs.existsSync(publicDir)) {
156
192
  console.log('📁 Copying public files...');
157
193
  const exportPublicDir = path.join(exportDir, 'public');
158
194
 
159
- function copyRecursive(src, dest) {
160
- if (fs.statSync(src).isDirectory()) {
161
- fs.mkdirSync(dest, { recursive: true });
162
- fs.readdirSync(src).forEach(file => {
163
- copyRecursive(path.join(src, file), path.join(dest, file));
164
- });
165
- } else {
166
- fs.copyFileSync(src, dest);
167
- }
168
- }
169
-
170
- copyRecursive(publicDir, exportPublicDir);
195
+ // --- Lógica de cópia substituída ---
196
+ // Reutilizamos a mesma função corrigida
197
+ copyDirRecursive(publicDir, exportPublicDir);
198
+ // --- Fim da substituição ---
199
+
171
200
  console.log('✅ Public files copied\n');
172
201
  }
173
202
 
174
203
  // 5. Gera o index.html
175
204
  console.log('📝 Generating index.html...');
205
+ // ATENÇÃO: Ajuste os caminhos destes 'requires' conforme a estrutura do seu projeto!
176
206
  const { render } = require('../renderer');
177
207
  const { loadRoutes, loadLayout, loadNotFound } = require('../router');
178
208
 
@@ -202,9 +232,9 @@ program
202
232
  params: {},
203
233
  allRoutes: routes
204
234
  });
205
-
235
+ const scriptReplaced = html.replace('/_hight/', './.hight/');
206
236
  const indexPath = path.join(exportDir, 'index.html');
207
- fs.writeFileSync(indexPath, html, 'utf8');
237
+ fs.writeFileSync(indexPath, scriptReplaced, 'utf8');
208
238
  console.log('✅ index.html generated\n');
209
239
  }
210
240
 
@@ -212,11 +242,11 @@ program
212
242
  console.log(`📂 Files exported to: ${exportDir}\n`);
213
243
 
214
244
  } catch (error) {
215
- console.error('❌ Error during export:', error.message);
245
+ // Logar o erro completo (com stack trace) é mais útil
246
+ console.error('❌ Error during export:', error);
216
247
  process.exit(1);
217
248
  }
218
249
  });
219
250
 
220
-
221
251
  // Faz o "parse" dos argumentos passados na linha de comando
222
252
  program.parse(process.argv);
package/src/builder.js CHANGED
@@ -230,6 +230,166 @@ if (typeof window !== 'undefined' && window.__HWEB_HMR__) {
230
230
  }
231
231
  };
232
232
 
233
+ /**
234
+ * Plugin para suportar importação de arquivos Markdown (.md)
235
+ */
236
+ const markdownPlugin = {
237
+ name: 'markdown-plugin',
238
+ setup(build) {
239
+ build.onLoad({ filter: /\.md$/ }, async (args) => {
240
+ const fs = require('fs');
241
+ const content = await fs.promises.readFile(args.path, 'utf8');
242
+
243
+ return {
244
+ contents: `export default ${JSON.stringify(content)};`,
245
+ loader: 'js'
246
+ };
247
+ });
248
+ }
249
+ };
250
+
251
+ /**
252
+ * Plugin para suportar importação de arquivos de imagem e outros assets
253
+ */
254
+ const assetsPlugin = {
255
+ name: 'assets-plugin',
256
+ setup(build) {
257
+ // Suporte para imagens (PNG, JPG, JPEG, GIF, SVG, WEBP, etc)
258
+ build.onLoad({ filter: /\.(png|jpe?g|gif|webp|avif|ico|bmp|tiff?)$/i }, async (args) => {
259
+ const fs = require('fs');
260
+ const buffer = await fs.promises.readFile(args.path);
261
+ const base64 = buffer.toString('base64');
262
+ const ext = path.extname(args.path).slice(1).toLowerCase();
263
+
264
+ // Mapeamento de extensões para MIME types
265
+ const mimeTypes = {
266
+ 'png': 'image/png',
267
+ 'jpg': 'image/jpeg',
268
+ 'jpeg': 'image/jpeg',
269
+ 'gif': 'image/gif',
270
+ 'webp': 'image/webp',
271
+ 'avif': 'image/avif',
272
+ 'ico': 'image/x-icon',
273
+ 'bmp': 'image/bmp',
274
+ 'tif': 'image/tiff',
275
+ 'tiff': 'image/tiff'
276
+ };
277
+
278
+ const mimeType = mimeTypes[ext] || 'application/octet-stream';
279
+
280
+ return {
281
+ contents: `export default "data:${mimeType};base64,${base64}";`,
282
+ loader: 'js'
283
+ };
284
+ });
285
+
286
+ // Suporte especial para SVG (pode ser usado como string ou data URL)
287
+ build.onLoad({ filter: /\.svg$/i }, async (args) => {
288
+ const fs = require('fs');
289
+ const content = await fs.promises.readFile(args.path, 'utf8');
290
+ const base64 = Buffer.from(content).toString('base64');
291
+
292
+ return {
293
+ contents: `
294
+ export default "data:image/svg+xml;base64,${base64}";
295
+ export const svgContent = ${JSON.stringify(content)};
296
+ `,
297
+ loader: 'js'
298
+ };
299
+ });
300
+
301
+ // Suporte para arquivos JSON
302
+ build.onLoad({ filter: /\.json$/i }, async (args) => {
303
+ const fs = require('fs');
304
+ const content = await fs.promises.readFile(args.path, 'utf8');
305
+
306
+ return {
307
+ contents: `export default ${content};`,
308
+ loader: 'js'
309
+ };
310
+ });
311
+
312
+ // Suporte para arquivos de texto (.txt)
313
+ build.onLoad({ filter: /\.txt$/i }, async (args) => {
314
+ const fs = require('fs');
315
+ const content = await fs.promises.readFile(args.path, 'utf8');
316
+
317
+ return {
318
+ contents: `export default ${JSON.stringify(content)};`,
319
+ loader: 'js'
320
+ };
321
+ });
322
+
323
+ // Suporte para arquivos de fonte (WOFF, WOFF2, TTF, OTF, EOT)
324
+ build.onLoad({ filter: /\.(woff2?|ttf|otf|eot)$/i }, async (args) => {
325
+ const fs = require('fs');
326
+ const buffer = await fs.promises.readFile(args.path);
327
+ const base64 = buffer.toString('base64');
328
+ const ext = path.extname(args.path).slice(1).toLowerCase();
329
+
330
+ const mimeTypes = {
331
+ 'woff': 'font/woff',
332
+ 'woff2': 'font/woff2',
333
+ 'ttf': 'font/ttf',
334
+ 'otf': 'font/otf',
335
+ 'eot': 'application/vnd.ms-fontobject'
336
+ };
337
+
338
+ const mimeType = mimeTypes[ext] || 'application/octet-stream';
339
+
340
+ return {
341
+ contents: `export default "data:${mimeType};base64,${base64}";`,
342
+ loader: 'js'
343
+ };
344
+ });
345
+
346
+ // Suporte para arquivos de áudio (MP3, WAV, OGG, etc)
347
+ build.onLoad({ filter: /\.(mp3|wav|ogg|m4a|aac|flac)$/i }, async (args) => {
348
+ const fs = require('fs');
349
+ const buffer = await fs.promises.readFile(args.path);
350
+ const base64 = buffer.toString('base64');
351
+ const ext = path.extname(args.path).slice(1).toLowerCase();
352
+
353
+ const mimeTypes = {
354
+ 'mp3': 'audio/mpeg',
355
+ 'wav': 'audio/wav',
356
+ 'ogg': 'audio/ogg',
357
+ 'm4a': 'audio/mp4',
358
+ 'aac': 'audio/aac',
359
+ 'flac': 'audio/flac'
360
+ };
361
+
362
+ const mimeType = mimeTypes[ext] || 'audio/mpeg';
363
+
364
+ return {
365
+ contents: `export default "data:${mimeType};base64,${base64}";`,
366
+ loader: 'js'
367
+ };
368
+ });
369
+
370
+ // Suporte para arquivos de vídeo (MP4, WEBM, OGV)
371
+ build.onLoad({ filter: /\.(mp4|webm|ogv)$/i }, async (args) => {
372
+ const fs = require('fs');
373
+ const buffer = await fs.promises.readFile(args.path);
374
+ const base64 = buffer.toString('base64');
375
+ const ext = path.extname(args.path).slice(1).toLowerCase();
376
+
377
+ const mimeTypes = {
378
+ 'mp4': 'video/mp4',
379
+ 'webm': 'video/webm',
380
+ 'ogv': 'video/ogg'
381
+ };
382
+
383
+ const mimeType = mimeTypes[ext] || 'video/mp4';
384
+
385
+ return {
386
+ contents: `export default "data:${mimeType};base64,${base64}";`,
387
+ loader: 'js'
388
+ };
389
+ });
390
+ }
391
+ };
392
+
233
393
  /**
234
394
  * Builds with code splitting into multiple chunks based on module types.
235
395
  * @param {string} entryPoint - The path to the entry file.
@@ -251,7 +411,7 @@ async function buildWithChunks(entryPoint, outdir, isProduction = false) {
251
411
  outdir: outdir,
252
412
  loader: { '.js': 'jsx', '.ts': 'tsx' },
253
413
  external: nodeBuiltIns,
254
- plugins: [postcssPlugin, npmDependenciesPlugin, reactResolvePlugin],
414
+ plugins: [postcssPlugin, npmDependenciesPlugin, reactResolvePlugin, markdownPlugin, assetsPlugin],
255
415
  format: 'esm', // ESM suporta melhor o code splitting
256
416
  jsx: 'automatic',
257
417
  define: {
@@ -313,7 +473,7 @@ async function watchWithChunks(entryPoint, outdir, hotReloadManager = null) {
313
473
  outdir: outdir,
314
474
  loader: { '.js': 'jsx', '.ts': 'tsx' },
315
475
  external: nodeBuiltIns,
316
- plugins: [postcssPlugin, npmDependenciesPlugin, reactResolvePlugin, hmrPlugin, buildCompletePlugin],
476
+ plugins: [postcssPlugin, npmDependenciesPlugin, reactResolvePlugin, hmrPlugin, buildCompletePlugin, markdownPlugin, assetsPlugin],
317
477
  format: 'esm',
318
478
  jsx: 'automatic',
319
479
  define: {
@@ -359,7 +519,7 @@ async function build(entryPoint, outfile, isProduction = false) {
359
519
  outfile: outfile,
360
520
  loader: { '.js': 'jsx', '.ts': 'tsx' },
361
521
  external: nodeBuiltIns,
362
- plugins: [postcssPlugin, npmDependenciesPlugin, reactResolvePlugin],
522
+ plugins: [postcssPlugin, npmDependenciesPlugin, reactResolvePlugin, markdownPlugin, assetsPlugin],
363
523
  format: 'iife',
364
524
  globalName: 'HwebApp',
365
525
  jsx: 'automatic',
@@ -422,7 +582,6 @@ async function watch(entryPoint, outfile, hotReloadManager = null) {
422
582
  outfile: outfile,
423
583
  loader: { '.js': 'jsx', '.ts': 'tsx' },
424
584
  external: nodeBuiltIns,
425
- plugins: [postcssPlugin, npmDependenciesPlugin, reactResolvePlugin, buildCompletePlugin],
426
585
  format: 'iife',
427
586
  globalName: 'HwebApp',
428
587
  jsx: 'automatic',
@@ -16,69 +16,104 @@
16
16
  */
17
17
  import React from 'react';
18
18
 
19
- export default function DefaultNotFound() {
20
- return (
21
- <div style={{
22
- fontFamily: 'system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',
23
- height: '100vh',
24
- textAlign: 'center',
25
- display: 'flex',
26
- flexDirection: 'column',
27
- alignItems: 'center',
28
- justifyContent: 'center'
29
- }}>
30
- <div>
31
- <style dangerouslySetInnerHTML={{
32
- __html: `
33
- body {
34
- color: #000;
35
- /* Alterado de cor sólida para gradiente */
36
- background: linear-gradient(to bottom, #e9e9e9, #ffffff);
37
- margin: 0;
38
- }
19
+ export default function App() {
39
20
 
40
- .next-error-h1 {
41
- border-right: 1px solid rgba(0, 0, 0, .3);
42
- }
43
21
 
44
- @media (prefers-color-scheme: dark) {
45
- body {
46
- color: #fff;
47
- /* Alterado de cor sólida para gradiente escuro */
48
- background: linear-gradient(to bottom, #222, #000);
49
- }
22
+ const globalStyles = `
23
+
24
+ html, body {
25
+ margin: 0;
26
+ padding: 0;
27
+ width: 100%;
28
+ height: 100%;
29
+ font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
30
+ -webkit-font-smoothing: antialiased;
31
+ -moz-osx-font-smoothing: grayscale;
32
+ box-sizing: border-box;
33
+ }
50
34
 
51
- .next-error-h1 {
52
- border-right: 1px solid rgba(255, 255, 255, .3);
53
- }
54
- }
55
- `
56
- }} />
35
+ *, *:before, *:after {
36
+ box-sizing: inherit;
37
+ }
38
+
39
+ body {
40
+ color: #000;
41
+ background: linear-gradient(to bottom, #e9e9e9, #ffffff);
42
+ background-attachment: fixed;
43
+
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ min-height: 100vh;
48
+ text-align: center;
49
+ padding: 20px;
50
+ }
51
+
52
+ .error-container {
53
+ /* Remove qualquer estilo de "card" anterior */
54
+ }
55
+
56
+ .hight-error-h1 {
57
+ border-right: 1px solid rgba(0, 0, 0, .3);
58
+ }
59
+
60
+ @media (prefers-color-scheme: dark) {
61
+ body {
62
+ color: #fff;
63
+ background: linear-gradient(to bottom, #222, #000);
64
+ }
65
+ .hight-error-h2 {
66
+ color: white;
67
+ }
68
+ .hight-error-h1 {
69
+ color: white;
70
+ border-right: 1px solid rgba(255, 255, 255, .3);
71
+ }
72
+ }
73
+ `;
74
+
75
+ // Estilos inline do seu exemplo original
76
+ const h1Styles = {
77
+ display: 'inline-block',
78
+ margin: '0px 20px 0px 0px',
79
+ padding: '0px 23px 0px 0px',
80
+ fontSize: '24px',
81
+ fontWeight: '500',
82
+ verticalAlign: 'top',
83
+ lineHeight: '49px'
84
+ };
85
+
86
+ const h2ContainerStyles = {
87
+ display: 'inline-block',
88
+ verticalAlign: 'top', // Alinha com o topo do H1
89
+ };
90
+
91
+ const h2Styles = {
92
+ fontSize: '14px',
93
+ fontWeight: '400',
94
+ lineHeight: '49px',
95
+ margin: '0px'
96
+ };
97
+
98
+
99
+ return (
100
+ <>
101
+ <style dangerouslySetInnerHTML={{ __html: globalStyles }} />
102
+
103
+ <div className="error-container">
57
104
  <h1
58
- className="next-error-h1"
59
- style={{
60
- display: 'inline-block',
61
- margin: '0px 20px 0px 0px',
62
- padding: '0px 23px 0px 0px',
63
- fontSize: '24px',
64
- fontWeight: '500',
65
- verticalAlign: 'top',
66
- lineHeight: '49px'
67
- }}
105
+ className="hight-error-h1"
106
+ style={h1Styles}
68
107
  >
69
108
  404
70
109
  </h1>
71
- <div style={{ display: 'inline-block' }}>
72
- <h2 style={{
73
- fontSize: '14px',
74
- fontWeight: '400',
75
- lineHeight: '49px',
76
- margin: '0px'
77
- }}>
110
+ <div style={h2ContainerStyles}>
111
+ <h2 style={h2Styles} className="hight-error-h2">
78
112
  This page cannot be found.
79
113
  </h2>
80
114
  </div>
81
115
  </div>
82
- </div>
116
+ </>
83
117
  );
84
118
  }
119
+
@@ -14,10 +14,11 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+
17
18
  // Este arquivo exporta apenas código seguro para o cliente (navegador)
18
- export { Link } from './components/Link';
19
- export { RouteConfig, Metadata } from "./types";
20
- export { router } from './client/clientRouter';
19
+ export { Link } from '../components/Link';
20
+ export { RouteConfig, Metadata } from "../types";
21
+ export { router } from './clientRouter';
21
22
 
22
23
 
23
24