rari 0.2.23 → 0.2.24

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.
@@ -0,0 +1,7 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ //#region rolldown:runtime
4
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
+
6
+ //#endregion
7
+ export { __require };
package/dist/cli.d.ts CHANGED
@@ -1,2 +1 @@
1
- #!/usr/bin/env node
2
- export {};
1
+ export { };
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { getBinaryPath, getInstallationInstructions } from "./platform-BI_YMKuR.js";
2
+ import { getBinaryPath, getInstallationInstructions } from "./platform-gndtVykV.js";
3
3
  import process from "node:process";
4
4
  import { spawn } from "node:child_process";
5
5
  import colors from "picocolors";
@@ -56,15 +56,14 @@ async function startRustServer() {
56
56
  logInfo(`Mode: ${mode}, Host: ${host}, Port: ${port}`);
57
57
  } else logInfo(`starting Rari server in ${mode} mode on port ${port}...`);
58
58
  logInfo(`using binary: ${binaryPath}`);
59
- const args$1 = [
59
+ const rustServer = spawn(binaryPath, [
60
60
  "--mode",
61
61
  mode,
62
62
  "--port",
63
63
  port,
64
64
  "--host",
65
65
  host
66
- ];
67
- const rustServer = spawn(binaryPath, args$1, {
66
+ ], {
68
67
  stdio: "inherit",
69
68
  cwd: process.cwd(),
70
69
  env: {
@@ -99,7 +98,7 @@ async function deployToRailway() {
99
98
  logError(`Already running in ${getPlatformName()} environment. Use "rari start" instead.`);
100
99
  process.exit(1);
101
100
  }
102
- const { createRailwayDeployment } = await import("./railway-XPhB0Ls4.js");
101
+ const { createRailwayDeployment } = await import("./railway-_SVjSy6_.js");
103
102
  await createRailwayDeployment();
104
103
  }
105
104
  async function deployToRender() {
@@ -108,7 +107,7 @@ async function deployToRender() {
108
107
  logError(`Already running in ${getPlatformName()} environment. Use "rari start" instead.`);
109
108
  process.exit(1);
110
109
  }
111
- const { createRenderDeployment } = await import("./render-BtA14L2P.js");
110
+ const { createRenderDeployment } = await import("./render-DZ66RSJC.js");
112
111
  await createRenderDeployment();
113
112
  }
114
113
  async function main() {
package/dist/client.js CHANGED
@@ -1,3 +1,3 @@
1
- import { HttpRuntimeClient, Link, Navigate, Outlet, RouteComponent, RouterProvider, Routes, buildSearchString, buildUrl, createHttpRuntimeClient, extractParamNames, findMatchingRoute, isDynamicRoute, isPathActive, joinPaths, normalizePathname, parseSearchParams, parseUrl, useNavigation, useParams, usePathname, useRoute, useRouter, useSearchParams, withRouter } from "./runtime-client-BXoadxa8.js";
1
+ import { HttpRuntimeClient, Link, Navigate, Outlet, RouteComponent, RouterProvider, Routes, buildSearchString, buildUrl, createHttpRuntimeClient, extractParamNames, findMatchingRoute, isDynamicRoute, isPathActive, joinPaths, normalizePathname, parseSearchParams, parseUrl, useNavigation, useParams, usePathname, useRoute, useRouter, useSearchParams, withRouter } from "./runtime-client-DgZI7OGo.js";
2
2
 
3
3
  export { HttpRuntimeClient, Link, Navigate, Outlet, RouteComponent as Route, RouterProvider, Routes, buildSearchString, buildUrl, createHttpRuntimeClient, extractParamNames, findMatchingRoute, isDynamicRoute, isPathActive, joinPaths, normalizePathname, parseSearchParams, parseUrl, useNavigation, useParams, usePathname, useRoute, useRouter, useSearchParams, withRouter };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { HttpRuntimeClient, Link, Navigate, Outlet, RouteComponent, RouterProvider, Routes, buildSearchString, buildUrl, createHttpRuntimeClient, extractParamNames, findMatchingRoute, getRoutePriority, isDynamicRoute, isPathActive, joinPaths, normalizePathname, parseSearchParams, parseUrl, useNavigation, useParams, usePathname, useRoute, useRouter, useSearchParams, withRouter } from "./runtime-client-BXoadxa8.js";
2
- import { FileRouteGenerator, convertFilePatternToRoutePattern, createRouteManifest, defineRariConfig, defineRariOptions, generateFileRoutes, loadRouteManifest, rari, rariRouter, validateRoutes, watchFileRoutes } from "./server-C3POnIbO.js";
3
- import "./server-build-DeJfuJb8.js";
1
+ import { HttpRuntimeClient, Link, Navigate, Outlet, RouteComponent, RouterProvider, Routes, buildSearchString, buildUrl, createHttpRuntimeClient, extractParamNames, findMatchingRoute, getRoutePriority, isDynamicRoute, isPathActive, joinPaths, normalizePathname, parseSearchParams, parseUrl, useNavigation, useParams, usePathname, useRoute, useRouter, useSearchParams, withRouter } from "./runtime-client-DgZI7OGo.js";
2
+ import { FileRouteGenerator, convertFilePatternToRoutePattern, createRouteManifest, defineRariConfig, defineRariOptions, generateFileRoutes, loadRouteManifest, rari, rariRouter, validateRoutes, watchFileRoutes } from "./server-BYQ_UgvJ.js";
3
+ import "./server-build-CC1DF9LZ.js";
4
4
 
5
5
  export { FileRouteGenerator, HttpRuntimeClient, Link, Navigate, Outlet, RouteComponent as Route, RouterProvider, Routes, buildSearchString, buildUrl, convertFilePatternToRoutePattern, createHttpRuntimeClient, createRouteManifest, defineRariConfig, defineRariOptions, extractParamNames, findMatchingRoute, generateFileRoutes, getRoutePriority, isDynamicRoute, isPathActive, joinPaths, loadRouteManifest, normalizePathname, parseSearchParams, parseUrl, rari, rariRouter, useNavigation, useParams, usePathname, useRoute, useRouter, useSearchParams, validateRoutes, watchFileRoutes, withRouter };
@@ -0,0 +1,3 @@
1
+ import { getBinaryPath, getInstallationInstructions } from "./platform-gndtVykV.js";
2
+
3
+ export { getBinaryPath, getInstallationInstructions };
@@ -1,4 +1,4 @@
1
- import { __require } from "./chunk-BLXvPPr8.js";
1
+ import { __require } from "./chunk-D2j_47x6.js";
2
2
  import { existsSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  import process from "node:process";
@@ -40,12 +40,11 @@ function getPlatformInfo() {
40
40
  const platformKey = `${normalizedPlatform}-${normalizedArch}`;
41
41
  const packageName = SUPPORTED_PLATFORMS[platformKey];
42
42
  if (!packageName) throw new Error(`Unsupported platform combination: ${normalizedPlatform}-${normalizedArch}. Supported platforms: ${Object.keys(SUPPORTED_PLATFORMS).join(", ")}`);
43
- const binaryName = normalizedPlatform === "win32" ? "rari.exe" : "rari";
44
43
  return {
45
44
  platform: normalizedPlatform,
46
45
  arch: normalizedArch,
47
46
  packageName,
48
- binaryName
47
+ binaryName: normalizedPlatform === "win32" ? "rari.exe" : "rari"
49
48
  };
50
49
  }
51
50
  function getBinaryPath() {
@@ -68,8 +67,7 @@ function getBinaryPath() {
68
67
  }
69
68
  } catch {}
70
69
  try {
71
- const packagePath = __require.resolve(`${packageName}/package.json`);
72
- const packageDir = packagePath.replace("/package.json", "");
70
+ const packageDir = __require.resolve(`${packageName}/package.json`).replace("/package.json", "");
73
71
  const binaryPath = join(packageDir, "bin", binaryName);
74
72
  if (existsSync(binaryPath)) return binaryPath;
75
73
  throw new Error(`Binary not found at ${binaryPath}`);
@@ -84,7 +84,7 @@ async function createRailwayDeployment() {
84
84
  logSuccess("Updated .gitignore with Railway entries");
85
85
  }
86
86
  } else {
87
- const defaultGitignore = `# Dependencies
87
+ writeFileSync(gitignorePath, `# Dependencies
88
88
  node_modules/
89
89
  .pnpm-store/
90
90
 
@@ -119,8 +119,7 @@ Thumbs.db
119
119
  # Temporary files
120
120
  .tmp/
121
121
  tmp/
122
- `;
123
- writeFileSync(gitignorePath, defaultGitignore);
122
+ `);
124
123
  logSuccess("Created .gitignore with Railway entries");
125
124
  }
126
125
  const readmePath = join(cwd, "README.md");
@@ -85,7 +85,7 @@ async function createRenderDeployment() {
85
85
  logSuccess("Updated .gitignore with Render entries");
86
86
  }
87
87
  } else {
88
- const defaultGitignore = `# Dependencies
88
+ writeFileSync(gitignorePath, `# Dependencies
89
89
  node_modules/
90
90
  .pnpm-store/
91
91
 
@@ -120,8 +120,7 @@ Thumbs.db
120
120
  # Temporary files
121
121
  .tmp/
122
122
  tmp/
123
- `;
124
- writeFileSync(gitignorePath, defaultGitignore);
123
+ `);
125
124
  logSuccess("Created .gitignore with Render entries");
126
125
  }
127
126
  const readmePath = join(cwd, "README.md");
@@ -15,8 +15,7 @@ function filePathToRoutePath(filePath) {
15
15
  }
16
16
  function extractParamNames(routePath) {
17
17
  const params = [];
18
- const paramRegex = /:([^/]+)/g;
19
- const matches = Array.from(routePath.matchAll(paramRegex));
18
+ const matches = Array.from(routePath.matchAll(/:([^/]+)/g));
20
19
  for (const match of matches) {
21
20
  let paramName = match[1];
22
21
  if (paramName.endsWith("*")) paramName = paramName.slice(0, -1);
@@ -45,10 +44,8 @@ function matchRoute(pathname, route) {
45
44
  for (let i = 0; i < paramNames.length; i++) {
46
45
  const paramName = paramNames[i];
47
46
  const paramValue = match[i + 1];
48
- if (paramValue !== void 0) if (route.path.includes(`:${paramName}*`)) {
49
- const segments = paramValue.split("/").filter(Boolean);
50
- params[paramName] = segments;
51
- } else params[paramName] = decodeURIComponent(paramValue);
47
+ if (paramValue !== void 0) if (route.path.includes(`:${paramName}*`)) params[paramName] = paramValue.split("/").filter(Boolean);
48
+ else params[paramName] = decodeURIComponent(paramValue);
52
49
  }
53
50
  return {
54
51
  route,
@@ -257,10 +254,9 @@ function RouterProvider({ config = DEFAULT_CONFIG, routes = DEFAULT_ROUTES, chil
257
254
  console.error("Error resolving initial route:", error);
258
255
  initialRoute = null;
259
256
  }
260
- const isReady$1 = true;
261
257
  return {
262
258
  currentRoute: initialRoute,
263
- isReady: isReady$1
259
+ isReady: true
264
260
  };
265
261
  });
266
262
  const currentRoute = routerState.currentRoute;
@@ -419,8 +415,7 @@ function RouteComponent({ path, component: Component, exact = false, render, chi
419
415
  const { currentRoute } = useRouter();
420
416
  const match = useMemo(() => {
421
417
  if (!currentRoute) return null;
422
- const isMatch = exact ? currentRoute.pathname === path : isPathActive(currentRoute.pathname, path, exact);
423
- return isMatch ? currentRoute : null;
418
+ return (exact ? currentRoute.pathname === path : isPathActive(currentRoute.pathname, path, exact)) ? currentRoute : null;
424
419
  }, [
425
420
  currentRoute,
426
421
  path,
@@ -481,8 +476,7 @@ function RouteRenderer({ routeMatch }) {
481
476
  searchParams: routeMatch.searchParams
482
477
  });
483
478
  for (let i = routeMatch.layouts.length - 1; i >= 0; i--) {
484
- const layout = routeMatch.layouts[i];
485
- const LayoutComponent = layout.component;
479
+ const LayoutComponent = routeMatch.layouts[i].component;
486
480
  if (LayoutComponent) rendered = /* @__PURE__ */ jsx(LayoutComponent, {
487
481
  route: routeMatch,
488
482
  children: rendered
@@ -513,10 +507,7 @@ function findDeepestChildMatch(routeMatch, pathname) {
513
507
  const remainingPath = `/${pathSegments.slice(routePathSegments.length).join("/")}`;
514
508
  for (const childRoute of routeMatch.route.children) {
515
509
  const childMatch = matchRoute(remainingPath, childRoute);
516
- if (childMatch) {
517
- const deeperChild = findDeepestChildMatch(childMatch, pathname);
518
- return deeperChild || childMatch;
519
- }
510
+ if (childMatch) return findDeepestChildMatch(childMatch, pathname) || childMatch;
520
511
  }
521
512
  return null;
522
513
  }
@@ -551,8 +542,7 @@ var HttpRuntimeClient = class {
551
542
  initialized = false;
552
543
  constructor(options = {}) {
553
544
  const { host = "127.0.0.1", port = 3e3, timeout = 3e4, ssl = false } = options;
554
- const protocol = ssl ? "https" : "http";
555
- this.baseUrl = `${protocol}://${host}:${port}`;
545
+ this.baseUrl = `${ssl ? "https" : "http"}://${host}:${port}`;
556
546
  this.timeout = timeout;
557
547
  }
558
548
  async request(endpoint, options = {}) {
@@ -573,8 +563,7 @@ var HttpRuntimeClient = class {
573
563
  const errorText = await response.text();
574
564
  throw new Error(`HTTP ${response.status}: ${errorText}`);
575
565
  }
576
- const contentType = response.headers.get("content-type");
577
- if (contentType?.includes("application/json")) return await response.json();
566
+ if (response.headers.get("content-type")?.includes("application/json")) return await response.json();
578
567
  else return await response.text();
579
568
  } catch (error) {
580
569
  if (error instanceof Error) {