@teamvelix/velix 5.1.3 → 5.1.5

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.
@@ -98,6 +98,7 @@ import http from "http";
98
98
  import fs7 from "fs";
99
99
  import path7 from "path";
100
100
  import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL3 } from "url";
101
+ import { createRequire } from "module";
101
102
  import React2 from "react";
102
103
  import { renderToString } from "react-dom/server";
103
104
 
@@ -690,7 +691,7 @@ init_esm_shims();
690
691
 
691
692
  // version.ts
692
693
  init_esm_shims();
693
- var VERSION = "5.1.2";
694
+ var VERSION = "5.1.4";
694
695
 
695
696
  // logger.ts
696
697
  var colors = {
@@ -804,9 +805,6 @@ var logger = {
804
805
  };
805
806
  var logger_default = logger;
806
807
 
807
- // plugins/tailwind.ts
808
- var NPX = process.platform === "win32" ? "npx.cmd" : "npx";
809
-
810
808
  // metadata/index.ts
811
809
  init_esm_shims();
812
810
  function generateMetadataTags(metadata, baseUrl) {
@@ -1284,14 +1282,16 @@ var ICON_GEAR = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" str
1284
1282
  var ICON_MON = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>`;
1285
1283
  var ICON_TS = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 7 4 4 20 4 20 7"/><line x1="9" y1="20" x2="15" y2="20"/><line x1="12" y1="4" x2="12" y2="20"/></svg>`;
1286
1284
  var ICON_CLOCK = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>`;
1287
- var ICON_TRI = `<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2L2 19h20L12 2z"/></svg>`;
1288
1285
  var ICON_TERM = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></svg>`;
1286
+ var ICON_LOGO = `<img src="/__velix/logo.webp" alt="Velix Logo" width="14" height="14" style="border-radius:2px; object-fit:cover;" onerror="this.style.display='none'" />`;
1289
1287
  function generateDevToolsHtml(isDev, ctx = {}) {
1290
1288
  if (!isDev) return "";
1291
1289
  const version = ctx.version ?? "5.1.0";
1292
1290
  const port = ctx.port ?? 3e3;
1293
1291
  const host = ctx.host ?? "localhost";
1294
1292
  const nodeVersion = ctx.nodeVersion ?? process.version.replace("v", "");
1293
+ const reactVersion = ctx.reactVersion ?? "\u2014";
1294
+ const tsVersion = ctx.tsVersion ?? "\u2014";
1295
1295
  return `
1296
1296
  <style>
1297
1297
  /* \u2500\u2500 Velix DevTools v5.1 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
@@ -1360,7 +1360,7 @@ function generateDevToolsHtml(isDev, ctx = {}) {
1360
1360
 
1361
1361
  <!-- \u2500\u2500 Floating button \u2500\u2500 -->
1362
1362
  <button id="__vdt-btn" class="vdt-idle" onclick="__vdtOpen()" title="Velix DevTools (${version})">
1363
- ${ICON_TRI}
1363
+ ${ICON_LOGO}
1364
1364
  <div id="__vdt-dot" class="idle"></div>
1365
1365
  </button>
1366
1366
 
@@ -1369,7 +1369,7 @@ function generateDevToolsHtml(isDev, ctx = {}) {
1369
1369
  <!-- Header -->
1370
1370
  <div class="__vdt-header">
1371
1371
  <div class="__vdt-brand">
1372
- ${ICON_TRI}
1372
+ ${ICON_LOGO}
1373
1373
  Velix
1374
1374
  <span class="__vdt-badge">${version}</span>
1375
1375
  </div>
@@ -1435,12 +1435,12 @@ function generateDevToolsHtml(isDev, ctx = {}) {
1435
1435
  <!-- Tab: Info -->
1436
1436
  <div class="__vdt-body" id="__vtab-info" style="display:none;">
1437
1437
  <div class="__vdt-info-row">
1438
- <div class="__vdt-info-left">${ICON_TRI} <span>Velix</span></div>
1438
+ <div class="__vdt-info-left">${ICON_LOGO} <span>Velix</span></div>
1439
1439
  <span class="__vdt-info-val">${version}</span>
1440
1440
  </div>
1441
1441
  <div class="__vdt-info-row">
1442
1442
  <div class="__vdt-info-left">${ICON_GEAR} <span>React</span></div>
1443
- <span class="__vdt-info-val" id="__vdt-react-ver">\u2014</span>
1443
+ <span class="__vdt-info-val" id="__vdt-react-ver">${reactVersion}</span>
1444
1444
  </div>
1445
1445
  <div class="__vdt-info-row">
1446
1446
  <div class="__vdt-info-left">${ICON_MON} <span>Node.js</span></div>
@@ -1448,7 +1448,7 @@ function generateDevToolsHtml(isDev, ctx = {}) {
1448
1448
  </div>
1449
1449
  <div class="__vdt-info-row">
1450
1450
  <div class="__vdt-info-left">${ICON_TS} <span>TypeScript</span></div>
1451
- <span class="__vdt-info-val" id="__vdt-ts-ver">\u2014</span>
1451
+ <span class="__vdt-info-val" id="__vdt-ts-ver">${tsVersion}</span>
1452
1452
  </div>
1453
1453
  <div class="__vdt-dev-badge">
1454
1454
  ${ICON_TERM} Development mode active
@@ -1546,13 +1546,13 @@ function generateDevToolsHtml(isDev, ctx = {}) {
1546
1546
  var btel = document.getElementById('__vdt-build-time');
1547
1547
  if(btel) btel.textContent = bt ? bt + 'ms' : '\u2014';
1548
1548
 
1549
- /* React version from window.React */
1549
+ /* React version from window.React or server injection */
1550
1550
  var rv = document.getElementById('__vdt-react-ver');
1551
- if(rv && window.React) rv.textContent = window.React.version;
1551
+ if(rv && rv.textContent === '\u2014' && window.React) rv.textContent = window.React.version;
1552
1552
 
1553
1553
  /* TypeScript version (injected by server if available) */
1554
1554
  var tsv = document.getElementById('__vdt-ts-ver');
1555
- if(tsv) tsv.textContent = window.__VELIX_TS_VERSION__ || '\u2014';
1555
+ if(tsv && tsv.textContent === '\u2014') tsv.textContent = window.__VELIX_TS_VERSION__ || '\u2014';
1556
1556
 
1557
1557
  /* \u2500\u2500 HMR + Status \u2500\u2500 */
1558
1558
  var btn = document.getElementById('__vdt-btn');
@@ -2116,6 +2116,19 @@ function generate500Page(options) {
2116
2116
  }
2117
2117
 
2118
2118
  // server/index.ts
2119
+ function getProjectVersion(dep, projectRoot) {
2120
+ try {
2121
+ const projectRequire = createRequire(pathToFileURL3(path7.join(projectRoot, "package.json")).href);
2122
+ return projectRequire(`${dep}/package.json`).version;
2123
+ } catch (e) {
2124
+ try {
2125
+ const selfRequire = createRequire(import.meta.url);
2126
+ return selfRequire(`${dep}/package.json`).version;
2127
+ } catch (e2) {
2128
+ return "\u2014";
2129
+ }
2130
+ }
2131
+ }
2119
2132
  var MIME_TYPES = {
2120
2133
  ".html": "text/html; charset=utf-8",
2121
2134
  ".css": "text/css; charset=utf-8",
@@ -2426,11 +2439,15 @@ async function handlePageRoute(route, routes, req, res, url, config, isDev, proj
2426
2439
  }, baseUrl);
2427
2440
  const islands = getRegisteredIslands();
2428
2441
  const hydrationScript = generateAdvancedHydrationScript(islands);
2442
+ const reactVersion = getProjectVersion("react", projectRoot);
2443
+ const tsVersion = getProjectVersion("typescript", projectRoot);
2429
2444
  const devToolsHtml = generateDevToolsHtml(isDev, {
2430
2445
  version: VERSION,
2431
2446
  port: config.server.port,
2432
2447
  host: config.server.host,
2433
- nodeVersion: process.version.replace("v", "")
2448
+ nodeVersion: process.version.replace("v", ""),
2449
+ reactVersion,
2450
+ tsVersion
2434
2451
  });
2435
2452
  const headInjections = `
2436
2453
  <meta charset="utf-8">