elit 3.7.0 → 3.7.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.
package/Cargo.lock CHANGED
@@ -1213,7 +1213,7 @@ dependencies = [
1213
1213
 
1214
1214
  [[package]]
1215
1215
  name = "elit-desktop"
1216
- version = "3.7.0"
1216
+ version = "3.7.1"
1217
1217
  dependencies = [
1218
1218
  "eframe",
1219
1219
  "http",
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "elit-desktop"
3
- version = "3.7.0"
3
+ version = "3.7.1"
4
4
  edition = "2021"
5
5
  build = "desktop/build.rs"
6
6
 
package/dist/cli.cjs CHANGED
@@ -78831,7 +78831,7 @@ init_runtime();
78831
78831
  // package.json
78832
78832
  var package_default = {
78833
78833
  name: "elit",
78834
- version: "3.7.0",
78834
+ version: "3.7.1",
78835
78835
  description: "Optimized lightweight library for creating DOM elements with reactive state",
78836
78836
  main: "dist/index.js",
78837
78837
  module: "dist/index.mjs",
@@ -79734,6 +79734,13 @@ function rewriteAliasSpecifiers(source, importerPath, clientRoot, alias) {
79734
79734
  }
79735
79735
  );
79736
79736
  }
79737
+ function isHistoryNavigationRequest(req, filePath) {
79738
+ if (req.method !== "GET") return false;
79739
+ const accept = req.headers.accept;
79740
+ if (typeof accept !== "string" || !accept.includes("text/html")) return false;
79741
+ const ext = extname(filePath).toLowerCase();
79742
+ return ext === "" || ext === ".html";
79743
+ }
79737
79744
  var defaultOptions2 = {
79738
79745
  port: 3e3,
79739
79746
  host: "localhost",
@@ -79748,7 +79755,8 @@ var defaultOptions2 = {
79748
79755
  logging: true,
79749
79756
  worker: [],
79750
79757
  mode: "dev",
79751
- serverWatch: true
79758
+ serverWatch: true,
79759
+ historyApiFallback: true
79752
79760
  };
79753
79761
  var ELIT_INTERNAL_WS_PATH2 = "/__elit_ws";
79754
79762
  var createHMRScript = (port) => `<script>(function(){let ws;let retries=0;let maxRetries=5;const protocol=window.location.protocol==='https:'?'wss://':'ws://';function connect(){ws=new WebSocket(protocol+window.location.hostname+':${port}${ELIT_INTERNAL_WS_PATH2}');ws.onopen=()=>{console.log('[Elit HMR] Connected');retries=0};ws.onmessage=(e)=>{const d=JSON.parse(e.data);if(d.type==='update'){console.log('[Elit HMR] File updated:',d.path);window.location.reload()}else if(d.type==='reload'){console.log('[Elit HMR] Reloading...');window.location.reload()}else if(d.type==='error')console.error('[Elit HMR] Error:',d.error)};ws.onclose=()=>{if(retries<maxRetries){retries++;setTimeout(connect,1000*retries)}else if(retries===maxRetries){console.log('[Elit HMR] Connection closed. Start dev server to reconnect.')}};ws.onerror=()=>{ws.close()}}connect()})();</script>`;
@@ -80813,7 +80821,7 @@ function createDevServer(options) {
80813
80821
  clearImportMapCache();
80814
80822
  }
80815
80823
  const usesClientArray = Boolean(config.clients?.length);
80816
- const clientsToNormalize = usesClientArray ? config.clients : config.root ? [{ root: config.root, fallbackRoot: config.fallbackRoot, basePath: config.basePath || "", index: config.index, ssr: config.ssr, api: config.api, proxy: config.proxy, ws: config.ws, mode: config.mode }] : null;
80824
+ const clientsToNormalize = usesClientArray ? config.clients : config.root ? [{ root: config.root, fallbackRoot: config.fallbackRoot, basePath: config.basePath || "", index: config.index, historyApiFallback: config.historyApiFallback, ssr: config.ssr, api: config.api, proxy: config.proxy, ws: config.ws, mode: config.mode }] : null;
80817
80825
  if (!clientsToNormalize) {
80818
80826
  throw new Error('DevServerOptions must include either "clients" array or "root" directory');
80819
80827
  }
@@ -80838,6 +80846,7 @@ function createDevServer(options) {
80838
80846
  fallbackRoot: useFallbackRoot ? void 0 : client.fallbackRoot,
80839
80847
  basePath,
80840
80848
  index: useFallbackRoot ? void 0 : indexPath,
80849
+ historyApiFallback: client.historyApiFallback ?? config.historyApiFallback ?? true,
80841
80850
  ssr: useFallbackRoot ? void 0 : client.ssr,
80842
80851
  api: client.api,
80843
80852
  ws: normalizeWebSocketEndpoints(client.ws, basePath),
@@ -80972,6 +80981,18 @@ function createDevServer(options) {
80972
80981
  if (filePath === "/index.html" && matchedClient.ssr) {
80973
80982
  return await serveSSR(res, matchedClient);
80974
80983
  }
80984
+ if (matchedClient.historyApiFallback && isHistoryNavigationRequest(req, filePath)) {
80985
+ if (matchedClient.ssr) {
80986
+ return await serveSSR(res, matchedClient);
80987
+ }
80988
+ const indexPath = matchedClient.index || "/index.html";
80989
+ for (const baseDir of baseDirs) {
80990
+ const indexFull = await resolveClientPathFromBaseDir(baseDir, indexPath);
80991
+ if (indexFull) {
80992
+ return await serveFile(indexFull, req, res, matchedClient, false);
80993
+ }
80994
+ }
80995
+ }
80975
80996
  if (config.logging) console.log(`[404] ${filePath}`);
80976
80997
  return send404(res, "404 Not Found");
80977
80998
  }
package/dist/cli.mjs CHANGED
@@ -78810,7 +78810,7 @@ init_runtime();
78810
78810
  // package.json
78811
78811
  var package_default = {
78812
78812
  name: "elit",
78813
- version: "3.7.0",
78813
+ version: "3.7.1",
78814
78814
  description: "Optimized lightweight library for creating DOM elements with reactive state",
78815
78815
  main: "dist/index.js",
78816
78816
  module: "dist/index.mjs",
@@ -79713,6 +79713,13 @@ function rewriteAliasSpecifiers(source, importerPath, clientRoot, alias) {
79713
79713
  }
79714
79714
  );
79715
79715
  }
79716
+ function isHistoryNavigationRequest(req, filePath) {
79717
+ if (req.method !== "GET") return false;
79718
+ const accept = req.headers.accept;
79719
+ if (typeof accept !== "string" || !accept.includes("text/html")) return false;
79720
+ const ext = extname(filePath).toLowerCase();
79721
+ return ext === "" || ext === ".html";
79722
+ }
79716
79723
  var defaultOptions2 = {
79717
79724
  port: 3e3,
79718
79725
  host: "localhost",
@@ -79727,7 +79734,8 @@ var defaultOptions2 = {
79727
79734
  logging: true,
79728
79735
  worker: [],
79729
79736
  mode: "dev",
79730
- serverWatch: true
79737
+ serverWatch: true,
79738
+ historyApiFallback: true
79731
79739
  };
79732
79740
  var ELIT_INTERNAL_WS_PATH2 = "/__elit_ws";
79733
79741
  var createHMRScript = (port) => `<script>(function(){let ws;let retries=0;let maxRetries=5;const protocol=window.location.protocol==='https:'?'wss://':'ws://';function connect(){ws=new WebSocket(protocol+window.location.hostname+':${port}${ELIT_INTERNAL_WS_PATH2}');ws.onopen=()=>{console.log('[Elit HMR] Connected');retries=0};ws.onmessage=(e)=>{const d=JSON.parse(e.data);if(d.type==='update'){console.log('[Elit HMR] File updated:',d.path);window.location.reload()}else if(d.type==='reload'){console.log('[Elit HMR] Reloading...');window.location.reload()}else if(d.type==='error')console.error('[Elit HMR] Error:',d.error)};ws.onclose=()=>{if(retries<maxRetries){retries++;setTimeout(connect,1000*retries)}else if(retries===maxRetries){console.log('[Elit HMR] Connection closed. Start dev server to reconnect.')}};ws.onerror=()=>{ws.close()}}connect()})();</script>`;
@@ -80792,7 +80800,7 @@ function createDevServer(options) {
80792
80800
  clearImportMapCache();
80793
80801
  }
80794
80802
  const usesClientArray = Boolean(config.clients?.length);
80795
- const clientsToNormalize = usesClientArray ? config.clients : config.root ? [{ root: config.root, fallbackRoot: config.fallbackRoot, basePath: config.basePath || "", index: config.index, ssr: config.ssr, api: config.api, proxy: config.proxy, ws: config.ws, mode: config.mode }] : null;
80803
+ const clientsToNormalize = usesClientArray ? config.clients : config.root ? [{ root: config.root, fallbackRoot: config.fallbackRoot, basePath: config.basePath || "", index: config.index, historyApiFallback: config.historyApiFallback, ssr: config.ssr, api: config.api, proxy: config.proxy, ws: config.ws, mode: config.mode }] : null;
80796
80804
  if (!clientsToNormalize) {
80797
80805
  throw new Error('DevServerOptions must include either "clients" array or "root" directory');
80798
80806
  }
@@ -80817,6 +80825,7 @@ function createDevServer(options) {
80817
80825
  fallbackRoot: useFallbackRoot ? void 0 : client.fallbackRoot,
80818
80826
  basePath,
80819
80827
  index: useFallbackRoot ? void 0 : indexPath,
80828
+ historyApiFallback: client.historyApiFallback ?? config.historyApiFallback ?? true,
80820
80829
  ssr: useFallbackRoot ? void 0 : client.ssr,
80821
80830
  api: client.api,
80822
80831
  ws: normalizeWebSocketEndpoints(client.ws, basePath),
@@ -80951,6 +80960,18 @@ function createDevServer(options) {
80951
80960
  if (filePath === "/index.html" && matchedClient.ssr) {
80952
80961
  return await serveSSR(res, matchedClient);
80953
80962
  }
80963
+ if (matchedClient.historyApiFallback && isHistoryNavigationRequest(req, filePath)) {
80964
+ if (matchedClient.ssr) {
80965
+ return await serveSSR(res, matchedClient);
80966
+ }
80967
+ const indexPath = matchedClient.index || "/index.html";
80968
+ for (const baseDir of baseDirs) {
80969
+ const indexFull = await resolveClientPathFromBaseDir(baseDir, indexPath);
80970
+ if (indexFull) {
80971
+ return await serveFile(indexFull, req, res, matchedClient, false);
80972
+ }
80973
+ }
80974
+ }
80954
80975
  if (config.logging) console.log(`[404] ${filePath}`);
80955
80976
  return send404(res, "404 Not Found");
80956
80977
  }
package/dist/config.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { E as ElitConfig } from './types-CLGrLRTl.js';
2
- export { D as DesktopConfig, h as DesktopMode, i as DesktopNativeConfig, M as MobileAndroidConfig, j as MobileConfig, k as MobileIosConfig, l as MobileMode, m as MobileNativeAndroidConfig, n as MobileNativeConfig, o as MobileNativeIosConfig, g as PmAppConfig, f as PmConfig, p as PmHealthCheckConfig, d as PmMemoryAction, b as PmProxyConfig, a as PmProxyStrategy, c as PmRestartPolicy, P as PmRuntimeName, q as WapkConfig, e as WapkGoogleDriveConfig, r as WapkLiveSyncConfig, s as WapkLockConfig, W as WapkRunConfig, t as defineConfig } from './types-CLGrLRTl.js';
3
- import './types-CYEpzeEi.js';
1
+ import { E as ElitConfig } from './types-DdL_S7pL.js';
2
+ export { D as DesktopConfig, h as DesktopMode, i as DesktopNativeConfig, M as MobileAndroidConfig, j as MobileConfig, k as MobileIosConfig, l as MobileMode, m as MobileNativeAndroidConfig, n as MobileNativeConfig, o as MobileNativeIosConfig, g as PmAppConfig, f as PmConfig, p as PmHealthCheckConfig, d as PmMemoryAction, b as PmProxyConfig, a as PmProxyStrategy, c as PmRestartPolicy, P as PmRuntimeName, q as WapkConfig, e as WapkGoogleDriveConfig, r as WapkLiveSyncConfig, s as WapkLockConfig, W as WapkRunConfig, t as defineConfig } from './types-DdL_S7pL.js';
3
+ import './types-BjkTamLI.js';
4
4
  import './types-DPOgoGs-.js';
5
5
  import 'node:events';
6
6
  import './websocket-BLBEAnhp.js';
@@ -1,4 +1,4 @@
1
- import { D as DevServerOptions } from './types-CYEpzeEi.js';
1
+ import { D as DevServerOptions } from './types-BjkTamLI.js';
2
2
  import './types-DPOgoGs-.js';
3
3
  import 'node:events';
4
4
  import './websocket-BLBEAnhp.js';
package/dist/pm.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PmRuntimeName, a as PmProxyStrategy, W as WapkRunConfig, b as PmProxyConfig, c as PmRestartPolicy, d as PmMemoryAction, e as WapkGoogleDriveConfig, f as PmConfig, g as PmAppConfig, E as ElitConfig } from './types-CLGrLRTl.js';
2
- import './types-CYEpzeEi.js';
1
+ import { P as PmRuntimeName, a as PmProxyStrategy, W as WapkRunConfig, b as PmProxyConfig, c as PmRestartPolicy, d as PmMemoryAction, e as WapkGoogleDriveConfig, f as PmConfig, g as PmAppConfig, E as ElitConfig } from './types-DdL_S7pL.js';
2
+ import './types-BjkTamLI.js';
3
3
  import './types-DPOgoGs-.js';
4
4
  import 'node:events';
5
5
  import './websocket-BLBEAnhp.js';
@@ -1,5 +1,5 @@
1
1
  import { B as BuildOptions } from './contracts-Av9yuqDM.js';
2
- import { P as PreviewOptions } from './types-CYEpzeEi.js';
2
+ import { P as PreviewOptions } from './types-BjkTamLI.js';
3
3
  import './types-DPOgoGs-.js';
4
4
  import 'node:events';
5
5
  import './websocket-BLBEAnhp.js';
package/dist/server.cjs CHANGED
@@ -50456,7 +50456,7 @@ init_runtime();
50456
50456
  // package.json
50457
50457
  var package_default = {
50458
50458
  name: "elit",
50459
- version: "3.7.0",
50459
+ version: "3.7.1",
50460
50460
  description: "Optimized lightweight library for creating DOM elements with reactive state",
50461
50461
  main: "dist/index.js",
50462
50462
  module: "dist/index.mjs",
@@ -51841,6 +51841,13 @@ function rewriteAliasSpecifiers(source, importerPath, clientRoot, alias) {
51841
51841
  }
51842
51842
  );
51843
51843
  }
51844
+ function isHistoryNavigationRequest(req, filePath) {
51845
+ if (req.method !== "GET") return false;
51846
+ const accept = req.headers.accept;
51847
+ if (typeof accept !== "string" || !accept.includes("text/html")) return false;
51848
+ const ext = extname(filePath).toLowerCase();
51849
+ return ext === "" || ext === ".html";
51850
+ }
51844
51851
  var defaultOptions = {
51845
51852
  port: 3e3,
51846
51853
  host: "localhost",
@@ -51855,7 +51862,8 @@ var defaultOptions = {
51855
51862
  logging: true,
51856
51863
  worker: [],
51857
51864
  mode: "dev",
51858
- serverWatch: true
51865
+ serverWatch: true,
51866
+ historyApiFallback: true
51859
51867
  };
51860
51868
  var ELIT_INTERNAL_WS_PATH = "/__elit_ws";
51861
51869
  var createHMRScript = (port) => `<script>(function(){let ws;let retries=0;let maxRetries=5;const protocol=window.location.protocol==='https:'?'wss://':'ws://';function connect(){ws=new WebSocket(protocol+window.location.hostname+':${port}${ELIT_INTERNAL_WS_PATH}');ws.onopen=()=>{console.log('[Elit HMR] Connected');retries=0};ws.onmessage=(e)=>{const d=JSON.parse(e.data);if(d.type==='update'){console.log('[Elit HMR] File updated:',d.path);window.location.reload()}else if(d.type==='reload'){console.log('[Elit HMR] Reloading...');window.location.reload()}else if(d.type==='error')console.error('[Elit HMR] Error:',d.error)};ws.onclose=()=>{if(retries<maxRetries){retries++;setTimeout(connect,1000*retries)}else if(retries===maxRetries){console.log('[Elit HMR] Connection closed. Start dev server to reconnect.')}};ws.onerror=()=>{ws.close()}}connect()})();</script>`;
@@ -52922,7 +52930,7 @@ function createDevServer(options) {
52922
52930
  clearImportMapCache();
52923
52931
  }
52924
52932
  const usesClientArray = Boolean(config.clients?.length);
52925
- const clientsToNormalize = usesClientArray ? config.clients : config.root ? [{ root: config.root, fallbackRoot: config.fallbackRoot, basePath: config.basePath || "", index: config.index, ssr: config.ssr, api: config.api, proxy: config.proxy, ws: config.ws, mode: config.mode }] : null;
52933
+ const clientsToNormalize = usesClientArray ? config.clients : config.root ? [{ root: config.root, fallbackRoot: config.fallbackRoot, basePath: config.basePath || "", index: config.index, historyApiFallback: config.historyApiFallback, ssr: config.ssr, api: config.api, proxy: config.proxy, ws: config.ws, mode: config.mode }] : null;
52926
52934
  if (!clientsToNormalize) {
52927
52935
  throw new Error('DevServerOptions must include either "clients" array or "root" directory');
52928
52936
  }
@@ -52947,6 +52955,7 @@ function createDevServer(options) {
52947
52955
  fallbackRoot: useFallbackRoot ? void 0 : client.fallbackRoot,
52948
52956
  basePath,
52949
52957
  index: useFallbackRoot ? void 0 : indexPath,
52958
+ historyApiFallback: client.historyApiFallback ?? config.historyApiFallback ?? true,
52950
52959
  ssr: useFallbackRoot ? void 0 : client.ssr,
52951
52960
  api: client.api,
52952
52961
  ws: normalizeWebSocketEndpoints(client.ws, basePath),
@@ -53081,6 +53090,18 @@ function createDevServer(options) {
53081
53090
  if (filePath === "/index.html" && matchedClient.ssr) {
53082
53091
  return await serveSSR(res, matchedClient);
53083
53092
  }
53093
+ if (matchedClient.historyApiFallback && isHistoryNavigationRequest(req, filePath)) {
53094
+ if (matchedClient.ssr) {
53095
+ return await serveSSR(res, matchedClient);
53096
+ }
53097
+ const indexPath = matchedClient.index || "/index.html";
53098
+ for (const baseDir of baseDirs) {
53099
+ const indexFull = await resolveClientPathFromBaseDir(baseDir, indexPath);
53100
+ if (indexFull) {
53101
+ return await serveFile(indexFull, req, res, matchedClient, false);
53102
+ }
53103
+ }
53104
+ }
53084
53105
  if (config.logging) console.log(`[404] ${filePath}`);
53085
53106
  return send404(res, "404 Not Found");
53086
53107
  }
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as DevServerOptions, a as DevServer, M as Middleware, b as ProxyConfig } from './types-CYEpzeEi.js';
2
- export { E as ElitRequest, c as ElitResponse, H as HttpMethod, S as ServerRouteContext, d as ServerRouteHandler, e as ServerRouter, f as SharedState, g as SharedStateOptions, h as StateChangeHandler, i as StateManager } from './types-CYEpzeEi.js';
1
+ import { D as DevServerOptions, a as DevServer, M as Middleware, b as ProxyConfig } from './types-BjkTamLI.js';
2
+ export { E as ElitRequest, c as ElitResponse, H as HttpMethod, S as ServerRouteContext, d as ServerRouteHandler, e as ServerRouter, f as SharedState, g as SharedStateOptions, h as StateChangeHandler, i as StateManager } from './types-BjkTamLI.js';
3
3
  import { I as IncomingMessage, c as ServerResponse } from './types-DPOgoGs-.js';
4
4
  import './websocket-BLBEAnhp.js';
5
5
  import 'events';
package/dist/server.js CHANGED
@@ -67362,7 +67362,7 @@ tell application "System Events" to get value of property list item "CFBundleNam
67362
67362
  // package.json
67363
67363
  var package_default = {
67364
67364
  name: "elit",
67365
- version: "3.7.0",
67365
+ version: "3.7.1",
67366
67366
  description: "Optimized lightweight library for creating DOM elements with reactive state",
67367
67367
  main: "dist/index.js",
67368
67368
  module: "dist/index.mjs",
@@ -68747,6 +68747,13 @@ tell application "System Events" to get value of property list item "CFBundleNam
68747
68747
  }
68748
68748
  );
68749
68749
  }
68750
+ function isHistoryNavigationRequest(req, filePath) {
68751
+ if (req.method !== "GET") return false;
68752
+ const accept = req.headers.accept;
68753
+ if (typeof accept !== "string" || !accept.includes("text/html")) return false;
68754
+ const ext = extname(filePath).toLowerCase();
68755
+ return ext === "" || ext === ".html";
68756
+ }
68750
68757
  var defaultOptions = {
68751
68758
  port: 3e3,
68752
68759
  host: "localhost",
@@ -68761,7 +68768,8 @@ tell application "System Events" to get value of property list item "CFBundleNam
68761
68768
  logging: true,
68762
68769
  worker: [],
68763
68770
  mode: "dev",
68764
- serverWatch: true
68771
+ serverWatch: true,
68772
+ historyApiFallback: true
68765
68773
  };
68766
68774
  var ELIT_INTERNAL_WS_PATH = "/__elit_ws";
68767
68775
  var createHMRScript = (port) => `<script>(function(){let ws;let retries=0;let maxRetries=5;const protocol=window.location.protocol==='https:'?'wss://':'ws://';function connect(){ws=new WebSocket(protocol+window.location.hostname+':${port}${ELIT_INTERNAL_WS_PATH}');ws.onopen=()=>{console.log('[Elit HMR] Connected');retries=0};ws.onmessage=(e)=>{const d=JSON.parse(e.data);if(d.type==='update'){console.log('[Elit HMR] File updated:',d.path);window.location.reload()}else if(d.type==='reload'){console.log('[Elit HMR] Reloading...');window.location.reload()}else if(d.type==='error')console.error('[Elit HMR] Error:',d.error)};ws.onclose=()=>{if(retries<maxRetries){retries++;setTimeout(connect,1000*retries)}else if(retries===maxRetries){console.log('[Elit HMR] Connection closed. Start dev server to reconnect.')}};ws.onerror=()=>{ws.close()}}connect()})();</script>`;
@@ -76586,7 +76594,7 @@ tell application "System Events" to get value of property list item "CFBundleNam
76586
76594
  clearImportMapCache();
76587
76595
  }
76588
76596
  const usesClientArray = Boolean(config.clients?.length);
76589
- const clientsToNormalize = usesClientArray ? config.clients : config.root ? [{ root: config.root, fallbackRoot: config.fallbackRoot, basePath: config.basePath || "", index: config.index, ssr: config.ssr, api: config.api, proxy: config.proxy, ws: config.ws, mode: config.mode }] : null;
76597
+ const clientsToNormalize = usesClientArray ? config.clients : config.root ? [{ root: config.root, fallbackRoot: config.fallbackRoot, basePath: config.basePath || "", index: config.index, historyApiFallback: config.historyApiFallback, ssr: config.ssr, api: config.api, proxy: config.proxy, ws: config.ws, mode: config.mode }] : null;
76590
76598
  if (!clientsToNormalize) {
76591
76599
  throw new Error('DevServerOptions must include either "clients" array or "root" directory');
76592
76600
  }
@@ -76611,6 +76619,7 @@ tell application "System Events" to get value of property list item "CFBundleNam
76611
76619
  fallbackRoot: useFallbackRoot ? void 0 : client.fallbackRoot,
76612
76620
  basePath,
76613
76621
  index: useFallbackRoot ? void 0 : indexPath,
76622
+ historyApiFallback: client.historyApiFallback ?? config.historyApiFallback ?? true,
76614
76623
  ssr: useFallbackRoot ? void 0 : client.ssr,
76615
76624
  api: client.api,
76616
76625
  ws: normalizeWebSocketEndpoints(client.ws, basePath),
@@ -76745,6 +76754,18 @@ tell application "System Events" to get value of property list item "CFBundleNam
76745
76754
  if (filePath === "/index.html" && matchedClient.ssr) {
76746
76755
  return await serveSSR(res, matchedClient);
76747
76756
  }
76757
+ if (matchedClient.historyApiFallback && isHistoryNavigationRequest(req, filePath)) {
76758
+ if (matchedClient.ssr) {
76759
+ return await serveSSR(res, matchedClient);
76760
+ }
76761
+ const indexPath = matchedClient.index || "/index.html";
76762
+ for (const baseDir of baseDirs) {
76763
+ const indexFull = await resolveClientPathFromBaseDir(baseDir, indexPath);
76764
+ if (indexFull) {
76765
+ return await serveFile(indexFull, req, res, matchedClient, false);
76766
+ }
76767
+ }
76768
+ }
76748
76769
  if (config.logging) console.log(`[404] ${filePath}`);
76749
76770
  return send404(res, "404 Not Found");
76750
76771
  }
package/dist/server.mjs CHANGED
@@ -50436,7 +50436,7 @@ init_runtime();
50436
50436
  // package.json
50437
50437
  var package_default = {
50438
50438
  name: "elit",
50439
- version: "3.7.0",
50439
+ version: "3.7.1",
50440
50440
  description: "Optimized lightweight library for creating DOM elements with reactive state",
50441
50441
  main: "dist/index.js",
50442
50442
  module: "dist/index.mjs",
@@ -51821,6 +51821,13 @@ function rewriteAliasSpecifiers(source, importerPath, clientRoot, alias) {
51821
51821
  }
51822
51822
  );
51823
51823
  }
51824
+ function isHistoryNavigationRequest(req, filePath) {
51825
+ if (req.method !== "GET") return false;
51826
+ const accept = req.headers.accept;
51827
+ if (typeof accept !== "string" || !accept.includes("text/html")) return false;
51828
+ const ext = extname(filePath).toLowerCase();
51829
+ return ext === "" || ext === ".html";
51830
+ }
51824
51831
  var defaultOptions = {
51825
51832
  port: 3e3,
51826
51833
  host: "localhost",
@@ -51835,7 +51842,8 @@ var defaultOptions = {
51835
51842
  logging: true,
51836
51843
  worker: [],
51837
51844
  mode: "dev",
51838
- serverWatch: true
51845
+ serverWatch: true,
51846
+ historyApiFallback: true
51839
51847
  };
51840
51848
  var ELIT_INTERNAL_WS_PATH = "/__elit_ws";
51841
51849
  var createHMRScript = (port) => `<script>(function(){let ws;let retries=0;let maxRetries=5;const protocol=window.location.protocol==='https:'?'wss://':'ws://';function connect(){ws=new WebSocket(protocol+window.location.hostname+':${port}${ELIT_INTERNAL_WS_PATH}');ws.onopen=()=>{console.log('[Elit HMR] Connected');retries=0};ws.onmessage=(e)=>{const d=JSON.parse(e.data);if(d.type==='update'){console.log('[Elit HMR] File updated:',d.path);window.location.reload()}else if(d.type==='reload'){console.log('[Elit HMR] Reloading...');window.location.reload()}else if(d.type==='error')console.error('[Elit HMR] Error:',d.error)};ws.onclose=()=>{if(retries<maxRetries){retries++;setTimeout(connect,1000*retries)}else if(retries===maxRetries){console.log('[Elit HMR] Connection closed. Start dev server to reconnect.')}};ws.onerror=()=>{ws.close()}}connect()})();</script>`;
@@ -52902,7 +52910,7 @@ function createDevServer(options) {
52902
52910
  clearImportMapCache();
52903
52911
  }
52904
52912
  const usesClientArray = Boolean(config.clients?.length);
52905
- const clientsToNormalize = usesClientArray ? config.clients : config.root ? [{ root: config.root, fallbackRoot: config.fallbackRoot, basePath: config.basePath || "", index: config.index, ssr: config.ssr, api: config.api, proxy: config.proxy, ws: config.ws, mode: config.mode }] : null;
52913
+ const clientsToNormalize = usesClientArray ? config.clients : config.root ? [{ root: config.root, fallbackRoot: config.fallbackRoot, basePath: config.basePath || "", index: config.index, historyApiFallback: config.historyApiFallback, ssr: config.ssr, api: config.api, proxy: config.proxy, ws: config.ws, mode: config.mode }] : null;
52906
52914
  if (!clientsToNormalize) {
52907
52915
  throw new Error('DevServerOptions must include either "clients" array or "root" directory');
52908
52916
  }
@@ -52927,6 +52935,7 @@ function createDevServer(options) {
52927
52935
  fallbackRoot: useFallbackRoot ? void 0 : client.fallbackRoot,
52928
52936
  basePath,
52929
52937
  index: useFallbackRoot ? void 0 : indexPath,
52938
+ historyApiFallback: client.historyApiFallback ?? config.historyApiFallback ?? true,
52930
52939
  ssr: useFallbackRoot ? void 0 : client.ssr,
52931
52940
  api: client.api,
52932
52941
  ws: normalizeWebSocketEndpoints(client.ws, basePath),
@@ -53061,6 +53070,18 @@ function createDevServer(options) {
53061
53070
  if (filePath === "/index.html" && matchedClient.ssr) {
53062
53071
  return await serveSSR(res, matchedClient);
53063
53072
  }
53073
+ if (matchedClient.historyApiFallback && isHistoryNavigationRequest(req, filePath)) {
53074
+ if (matchedClient.ssr) {
53075
+ return await serveSSR(res, matchedClient);
53076
+ }
53077
+ const indexPath = matchedClient.index || "/index.html";
53078
+ for (const baseDir of baseDirs) {
53079
+ const indexFull = await resolveClientPathFromBaseDir(baseDir, indexPath);
53080
+ if (indexFull) {
53081
+ return await serveFile(indexFull, req, res, matchedClient, false);
53082
+ }
53083
+ }
53084
+ }
53064
53085
  if (config.logging) console.log(`[404] ${filePath}`);
53065
53086
  return send404(res, "404 Not Found");
53066
53087
  }
@@ -114,6 +114,8 @@ interface ClientConfig {
114
114
  fallbackRoot?: string;
115
115
  basePath: string;
116
116
  index?: string;
117
+ /** When `true` (default), navigation requests for non-existent paths serve `index.html` (or SSR output) so client-side history-mode routing works on reload. Set to `false` to return strict 404s. */
118
+ historyApiFallback?: boolean;
117
119
  ssr?: () => Child | string;
118
120
  watch?: string[];
119
121
  ignore?: string[];
@@ -171,6 +173,8 @@ interface DevServerOptions {
171
173
  standalone?: boolean;
172
174
  outDir?: string;
173
175
  outFile?: string;
176
+ /** When `true` (default), navigation requests (`GET` with `Accept: text/html`) for non-existent paths serve `index.html` (or SSR output) so client-side history-mode routing works on reload. Set to `false` to return strict 404s. */
177
+ historyApiFallback?: boolean;
174
178
  }
175
179
  interface DevServer {
176
180
  server: Server;
@@ -1,4 +1,4 @@
1
- import { D as DevServerOptions, P as PreviewOptions } from './types-CYEpzeEi.js';
1
+ import { D as DevServerOptions, P as PreviewOptions } from './types-BjkTamLI.js';
2
2
  import { B as BuildOptions, R as ResolveConfig } from './contracts-Av9yuqDM.js';
3
3
  import { T as TestOptions } from './contracts-_0p1-15U.js';
4
4
 
package/dist/types.d.ts CHANGED
@@ -297,6 +297,8 @@ interface ClientConfig {
297
297
  fallbackRoot?: string;
298
298
  basePath: string;
299
299
  index?: string;
300
+ /** When `true` (default), navigation requests for non-existent paths serve `index.html` (or SSR output) so client-side history-mode routing works on reload. Set to `false` to return strict 404s. */
301
+ historyApiFallback?: boolean;
300
302
  ssr?: () => Child | string;
301
303
  watch?: string[];
302
304
  ignore?: string[];
@@ -354,6 +356,8 @@ interface DevServerOptions {
354
356
  standalone?: boolean;
355
357
  outDir?: string;
356
358
  outFile?: string;
359
+ /** When `true` (default), navigation requests (`GET` with `Accept: text/html`) for non-existent paths serve `index.html` (or SSR output) so client-side history-mode routing works on reload. Set to `false` to return strict 404s. */
360
+ historyApiFallback?: boolean;
357
361
  }
358
362
  interface DevServer {
359
363
  server: Server$1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elit",
3
- "version": "3.7.0",
3
+ "version": "3.7.1",
4
4
  "description": "Optimized lightweight library for creating DOM elements with reactive state",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",