create-nextify 0.1.18 → 0.1.20

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 (2) hide show
  1. package/dist/devServer.js +32 -30
  2. package/package.json +1 -1
package/dist/devServer.js CHANGED
@@ -47,34 +47,34 @@ function buildHtmlShell(routePath) {
47
47
  const candidates = JSON.stringify([
48
48
  `${fileHint}.tsx`, `${fileHint}.jsx`, `${fileHint}.ts`, `${fileHint}.js`,
49
49
  ]);
50
- return `<!DOCTYPE html>
51
- <html lang="pt-BR">
52
- <head>
53
- <meta charset="UTF-8" />
54
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
55
- <title>Nextify.js</title>
56
- </head>
57
- <body>
58
- <div id="root"></div>
59
- <script type="module">
60
- import { createElement } from 'react';
61
- import { createRoot } from 'react-dom/client';
62
- const candidates = ${candidates};
63
- async function loadPage() {
64
- let mod;
65
- for (const c of candidates) { try { mod = await import(c); break; } catch {} }
66
- const root = document.getElementById('root');
67
- if (!mod?.default) {
68
- root.innerHTML = '<div style="font-family:monospace;padding:2rem;color:#e53e3e"><h2>404 — Página não encontrada</h2></div>';
69
- return;
70
- }
71
- createRoot(root).render(createElement(mod.default));
72
- }
73
- loadPage().catch((err) => {
74
- document.getElementById('root').innerHTML = '<pre style="color:red;padding:2rem">' + err.stack + '</pre>';
75
- });
76
- </script>
77
- </body>
50
+ return `<!DOCTYPE html>
51
+ <html lang="pt-BR">
52
+ <head>
53
+ <meta charset="UTF-8" />
54
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
55
+ <title>Nextify.js</title>
56
+ </head>
57
+ <body>
58
+ <div id="root"></div>
59
+ <script type="module">
60
+ import { createElement } from 'react';
61
+ import { createRoot } from 'react-dom/client';
62
+ const candidates = ${candidates};
63
+ async function loadPage() {
64
+ let mod;
65
+ for (const c of candidates) { try { mod = await import(c); break; } catch {} }
66
+ const root = document.getElementById('root');
67
+ if (!mod?.default) {
68
+ root.innerHTML = '<div style="font-family:monospace;padding:2rem;color:#e53e3e"><h2>404 — Página não encontrada</h2></div>';
69
+ return;
70
+ }
71
+ createRoot(root).render(createElement(mod.default));
72
+ }
73
+ loadPage().catch((err) => {
74
+ document.getElementById('root').innerHTML = '<pre style="color:red;padding:2rem">' + err.stack + '</pre>';
75
+ });
76
+ </script>
77
+ </body>
78
78
  </html>`;
79
79
  }
80
80
  export async function startDevServer(options = {}) {
@@ -82,7 +82,9 @@ export async function startDevServer(options = {}) {
82
82
  const port = options.port ?? PORT;
83
83
  // pathToFileURL converte C:\... para file:///C:/... — obrigatório no Windows
84
84
  const vitePath = pathToFileURL(path.join(root, 'node_modules', 'vite', 'dist', 'node', 'index.js')).href;
85
- const reactPluginPath = pathToFileURL(path.join(root, 'node_modules', '@vitejs', 'plugin-react', 'dist', 'index.mjs')).href;
85
+ const reactPluginPath = pathToFileURL(
86
+ path.join(root, 'node_modules', '@vitejs', 'plugin-react', 'dist', 'index.js')
87
+ ).href;
86
88
  let createViteServer, react;
87
89
  try {
88
90
  ({ createServer: createViteServer } = await import(vitePath));
@@ -156,4 +158,4 @@ export async function startDevServer(options = {}) {
156
158
  });
157
159
  return { server, vite };
158
160
  }
159
- startDevServer();
161
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nextify",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "CLI para criar aplicações Nextify.js",
5
5
  "type": "module",
6
6
  "bin": {