rari 0.7.2 → 0.7.4

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/dist/client.mjs CHANGED
@@ -889,8 +889,20 @@ function ClientRouter({ children, initialRoute }) {
889
889
  signal: abortController.signal
890
890
  });
891
891
  if (!response.ok) throw new Error(`Failed to fetch: ${response.status}`);
892
+ const finalPath = new URL(response.url).pathname;
893
+ const actualTargetPath = finalPath !== targetPath ? finalPath : targetPath;
894
+ if (finalPath !== targetPath) window.history.replaceState({
895
+ route: finalPath,
896
+ navigationId,
897
+ scrollPosition: {
898
+ x: window.scrollX,
899
+ y: window.scrollY
900
+ },
901
+ timestamp: Date.now(),
902
+ key: options.historyKey || generateHistoryKey()
903
+ }, "", finalPath);
892
904
  if (abortController.signal.aborted) {
893
- cleanupAbortedNavigation(targetPath, navigationId);
905
+ cleanupAbortedNavigation(actualTargetPath, navigationId);
894
906
  return;
895
907
  }
896
908
  try {
@@ -910,7 +922,7 @@ function ClientRouter({ children, initialRoute }) {
910
922
  if (done) break;
911
923
  if (abortController.signal.aborted) {
912
924
  await reader.cancel();
913
- cleanupAbortedNavigation(targetPath, navigationId);
925
+ cleanupAbortedNavigation(actualTargetPath, navigationId);
914
926
  return;
915
927
  }
916
928
  buffer += decoder.decode(value, { stream: true });
@@ -921,7 +933,7 @@ function ClientRouter({ children, initialRoute }) {
921
933
  if (buffer.trim()) window.dispatchEvent(new CustomEvent("rari:rsc-row", { detail: { rscRow: buffer } }));
922
934
  window.dispatchEvent(new CustomEvent("rari:navigate", { detail: {
923
935
  from: fromRoute,
924
- to: targetPath,
936
+ to: actualTargetPath,
925
937
  navigationId,
926
938
  options,
927
939
  routeInfo,
@@ -936,7 +948,7 @@ function ClientRouter({ children, initialRoute }) {
936
948
  const rscWireFormat = await response.text();
937
949
  window.dispatchEvent(new CustomEvent("rari:navigate", { detail: {
938
950
  from: fromRoute,
939
- to: targetPath,
951
+ to: actualTargetPath,
940
952
  navigationId,
941
953
  options,
942
954
  routeInfo,
@@ -945,19 +957,19 @@ function ClientRouter({ children, initialRoute }) {
945
957
  } }));
946
958
  }
947
959
  if (abortController.signal.aborted) {
948
- cleanupAbortedNavigation(targetPath, navigationId);
960
+ cleanupAbortedNavigation(actualTargetPath, navigationId);
949
961
  return;
950
962
  }
951
963
  if (isMountedRef.current) {
952
- currentRouteRef.current = targetPath;
964
+ currentRouteRef.current = actualTargetPath;
953
965
  setNavigationState((prev) => ({
954
966
  ...prev,
955
- currentRoute: targetPath,
967
+ currentRoute: actualTargetPath,
956
968
  error: null
957
969
  }));
958
- errorHandlerRef.current.resetRetry(targetPath);
970
+ errorHandlerRef.current.resetRetry(actualTargetPath);
959
971
  if (options.historyKey) requestAnimationFrame(() => {
960
- statePreserverRef.current.restoreState(targetPath);
972
+ statePreserverRef.current.restoreState(actualTargetPath);
961
973
  });
962
974
  }
963
975
  pendingNavigationsRef.current.delete(targetPath);
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/image/constants.d.ts
4
4
  type ImageFormat = 'avif' | 'webp';
@@ -61,6 +61,6 @@ declare function Image({
61
61
  loader,
62
62
  overrideSrc,
63
63
  decoding
64
- }: ImageProps): react_jsx_runtime1.JSX.Element;
64
+ }: ImageProps): react_jsx_runtime0.JSX.Element;
65
65
  //#endregion
66
66
  export { DEFAULT_DEVICE_SIZES, DEFAULT_FORMATS, DEFAULT_IMAGE_SIZES, DEFAULT_MAX_CACHE_SIZE, DEFAULT_MINIMUM_CACHE_TTL, DEFAULT_QUALITY_LEVELS, Image, type ImageProps, type StaticImageData };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { A as extractMetadata, C as RouteSegment, D as StaticParamsResult, E as ServerPropsResult, M as extractServerPropsWithCache, N as extractStaticParams, O as clearPropsCache, P as hasServerSideDataFetching, S as PageProps, T as MetadataResult, _ as GenerateStaticParams, b as LoadingEntry, d as AppRouteEntry, f as AppRouteManifest, g as GenerateMetadata, h as ErrorProps, i as HttpRuntimeClient, j as extractServerProps, k as clearPropsCacheForComponent, l as createHttpRuntimeClient, m as ErrorEntry, p as AppRouteMatch, s as RuntimeClient, v as LayoutEntry, w as RouteSegmentType, x as NotFoundEntry, y as LayoutProps } from "./runtime-client-C2xNyif4.mjs";
2
- import { C as ApiRouteHandlers, D as RobotsRule, E as Robots, S as ApiResponse, T as RouteHandler, _ as ProxyResult, a as rari, b as RequestCookies, c as ProxyPluginOptions, d as RariRequest, f as CookieOptions, g as ProxyModule, h as ProxyMatcher, i as defineRariOptions, l as rariProxy, m as ProxyFunction, n as Response, o as rariRouter, p as ProxyConfig, r as defineRariConfig, s as generateAppRouteManifest, t as Request, u as RariResponse, v as RariFetchEvent, w as RouteContext, x as ResponseCookies, y as RariURL } from "./vite-O3u7f8Q_.mjs";
2
+ import { C as ApiRouteHandlers, D as RobotsRule, E as Robots, S as ApiResponse, T as RouteHandler, _ as ProxyResult, a as rari, b as RequestCookies, c as ProxyPluginOptions, d as RariRequest, f as CookieOptions, g as ProxyModule, h as ProxyMatcher, i as defineRariOptions, l as rariProxy, m as ProxyFunction, n as Response, o as rariRouter, p as ProxyConfig, r as defineRariConfig, s as generateAppRouteManifest, t as Request, u as RariResponse, v as RariFetchEvent, w as RouteContext, x as ResponseCookies, y as RariURL } from "./vite-BmkmtVrY.mjs";
3
3
  import "./runtime-executor-NBcG4boA.mjs";
4
4
  export { ApiResponse, ApiRouteHandlers, AppRouteEntry, AppRouteManifest, AppRouteMatch, CookieOptions, ErrorEntry, ErrorProps, GenerateMetadata, GenerateStaticParams, HttpRuntimeClient, LayoutEntry, LayoutProps, LoadingEntry, MetadataResult, NotFoundEntry, PageProps, ProxyConfig, ProxyFunction, ProxyMatcher, ProxyModule, ProxyPluginOptions, ProxyResult, RariFetchEvent, RariRequest, RariResponse, RariURL, Request, RequestCookies, Response, ResponseCookies, type Robots, type RobotsRule, RouteContext, RouteHandler, RouteSegment, RouteSegmentType, RuntimeClient, ServerPropsResult, StaticParamsResult, clearPropsCache, clearPropsCacheForComponent, createHttpRuntimeClient, defineRariConfig, defineRariOptions, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, generateAppRouteManifest, hasServerSideDataFetching, rari, rariProxy, rariRouter };
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { a as rariProxy, i as rariRouter, n as defineRariOptions, o as RariResponse, r as rari, s as ApiResponse, t as defineRariConfig } from "./vite-DJhQmKAk.mjs";
1
+ import { a as rariProxy, i as rariRouter, n as defineRariOptions, o as RariResponse, r as rari, s as ApiResponse, t as defineRariConfig } from "./vite-4h_gIEDe.mjs";
2
2
  import { t as RariRequest } from "./RariRequest-DM6Q4JDB.mjs";
3
3
  import { c as createHttpRuntimeClient, d as clearPropsCacheForComponent, f as extractMetadata, g as hasServerSideDataFetching, h as extractStaticParams, i as HttpRuntimeClient, m as extractServerPropsWithCache, p as extractServerProps, u as clearPropsCache } from "./runtime-client-B7wmvKD3.mjs";
4
4
  import { t as generateAppRouteManifest } from "./routes-B_KAzmbj.mjs";
5
5
  import "./image-CL9iVW32.mjs";
6
- import "./server-build-DadtZ6wc.mjs";
6
+ import "./server-build-y4PwbtX3.mjs";
7
7
 
8
8
  export { ApiResponse, HttpRuntimeClient, RariRequest, RariResponse, clearPropsCache, clearPropsCacheForComponent, createHttpRuntimeClient, defineRariConfig, defineRariOptions, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, generateAppRouteManifest, hasServerSideDataFetching, rari, rariProxy, rariRouter };
@@ -0,0 +1,3 @@
1
+ import { n as createServerBuildPlugin, r as scanDirectory, t as ServerComponentBuilder } from "./server-build-y4PwbtX3.mjs";
2
+
3
+ export { ServerComponentBuilder, scanDirectory };
@@ -55,7 +55,8 @@ var ServerComponentBuilder = class {
55
55
  minify: options.minify ?? process.env.NODE_ENV === "production",
56
56
  alias: options.alias || {},
57
57
  csp: options.csp,
58
- rateLimit: options.rateLimit
58
+ rateLimit: options.rateLimit,
59
+ spamBlocker: options.spamBlocker
59
60
  };
60
61
  }
61
62
  isServerComponent(filePath) {
@@ -427,7 +428,8 @@ const ${importName} = (props) => {
427
428
  version: "1.0.0",
428
429
  buildTime: (/* @__PURE__ */ new Date()).toISOString(),
429
430
  csp: this.options.csp,
430
- rateLimit: this.options.rateLimit
431
+ rateLimit: this.options.rateLimit,
432
+ spamBlocker: this.options.spamBlocker
431
433
  };
432
434
  for (const [filePath, component] of this.serverComponents) {
433
435
  const relativePath = path.relative(this.projectRoot, filePath);
@@ -978,7 +980,8 @@ function registerClientReference(clientReference, id, exportName) {
978
980
  version: "1.0.0",
979
981
  buildTime: (/* @__PURE__ */ new Date()).toISOString(),
980
982
  csp: this.options.csp,
981
- rateLimit: this.options.rateLimit
983
+ rateLimit: this.options.rateLimit,
984
+ spamBlocker: this.options.spamBlocker
982
985
  };
983
986
  this.manifestCache = manifest;
984
987
  }
@@ -1,6 +1,6 @@
1
1
  import { t as __require } from "./chunk-DViRIILg.mjs";
2
2
  import { a as DEFAULT_MAX_CACHE_SIZE, i as DEFAULT_IMAGE_SIZES, n as DEFAULT_DEVICE_SIZES, o as DEFAULT_MINIMUM_CACHE_TTL, r as DEFAULT_FORMATS, s as DEFAULT_QUALITY_LEVELS } from "./image-CL9iVW32.mjs";
3
- import { n as createServerBuildPlugin } from "./server-build-DadtZ6wc.mjs";
3
+ import { n as createServerBuildPlugin } from "./server-build-y4PwbtX3.mjs";
4
4
  import fs, { promises, stat, unwatchFile, watch, watchFile } from "node:fs";
5
5
  import * as sp from "node:path";
6
6
  import path, { join, relative, resolve, sep } from "node:path";
@@ -2846,14 +2846,15 @@ const ${componentName$1} = registerClientReference(
2846
2846
  let serverComponentBuilder = null;
2847
2847
  const discoverAndRegisterComponents = async () => {
2848
2848
  try {
2849
- const { ServerComponentBuilder, scanDirectory } = await import("./server-build-D005lG4Y.mjs");
2849
+ const { ServerComponentBuilder, scanDirectory } = await import("./server-build-Qxg1F-98.mjs");
2850
2850
  const builder = new ServerComponentBuilder(projectRoot, {
2851
2851
  outDir: "dist",
2852
2852
  serverDir: "server",
2853
2853
  manifestPath: "server/manifest.json",
2854
2854
  alias: resolvedAlias,
2855
2855
  csp: options.csp,
2856
- rateLimit: options.rateLimit
2856
+ rateLimit: options.rateLimit,
2857
+ spamBlocker: options.spamBlocker
2857
2858
  });
2858
2859
  serverComponentBuilder = builder;
2859
2860
  if (!hmrCoordinator && serverComponentBuilder) {
@@ -3010,14 +3011,15 @@ const ${componentName$1} = registerClientReference(
3010
3011
  const handleServerComponentHMR = async (filePath) => {
3011
3012
  try {
3012
3013
  if (!isServerComponent(filePath)) return;
3013
- const { ServerComponentBuilder } = await import("./server-build-D005lG4Y.mjs");
3014
+ const { ServerComponentBuilder } = await import("./server-build-Qxg1F-98.mjs");
3014
3015
  const builder = new ServerComponentBuilder(projectRoot, {
3015
3016
  outDir: "dist",
3016
3017
  serverDir: "server",
3017
3018
  manifestPath: "server/manifest.json",
3018
3019
  alias: resolvedAlias,
3019
3020
  csp: options.csp,
3020
- rateLimit: options.rateLimit
3021
+ rateLimit: options.rateLimit,
3022
+ spamBlocker: options.spamBlocker
3021
3023
  });
3022
3024
  builder.addServerComponent(filePath);
3023
3025
  const components = await builder.getTransformedComponentsForDevelopment();
@@ -3321,7 +3323,8 @@ globalThis['~clientComponentPaths']["${ext.path}"] = "${exportName}";`;
3321
3323
  }, createServerBuildPlugin({
3322
3324
  ...options.serverBuild,
3323
3325
  csp: options.csp,
3324
- rateLimit: options.rateLimit
3326
+ rateLimit: options.rateLimit,
3327
+ spamBlocker: options.spamBlocker
3325
3328
  })];
3326
3329
  if (options.proxy !== false) plugins.push(rariProxy(options.proxy || {}));
3327
3330
  if (options.router !== false) plugins.push(rariRouter(options.router || {}));
@@ -226,6 +226,9 @@ interface ServerBuildOptions {
226
226
  burstSize?: number;
227
227
  revalidateRequestsPerMinute?: number;
228
228
  };
229
+ spamBlocker?: {
230
+ enabled?: boolean;
231
+ };
229
232
  }
230
233
  //#endregion
231
234
  //#region src/vite/index.d.ts
@@ -272,6 +275,9 @@ interface RariOptions {
272
275
  burstSize?: number;
273
276
  revalidateRequestsPerMinute?: number;
274
277
  };
278
+ spamBlocker?: {
279
+ enabled?: boolean;
280
+ };
275
281
  }
276
282
  declare function defineRariOptions(config: RariOptions): RariOptions;
277
283
  declare function rari(options?: RariOptions): Plugin[];
package/dist/vite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { A as extractMetadata, C as RouteSegment, D as StaticParamsResult, E as ServerPropsResult, M as extractServerPropsWithCache, N as extractStaticParams, O as clearPropsCache, P as hasServerSideDataFetching, S as PageProps, T as MetadataResult, _ as GenerateStaticParams, b as LoadingEntry, d as AppRouteEntry, f as AppRouteManifest, g as GenerateMetadata, h as ErrorProps, i as HttpRuntimeClient, j as extractServerProps, k as clearPropsCacheForComponent, l as createHttpRuntimeClient, m as ErrorEntry, p as AppRouteMatch, s as RuntimeClient, v as LayoutEntry, w as RouteSegmentType, x as NotFoundEntry, y as LayoutProps } from "./runtime-client-C2xNyif4.mjs";
2
- import { C as ApiRouteHandlers, D as RobotsRule, E as Robots, S as ApiResponse, T as RouteHandler, _ as ProxyResult, a as rari, b as RequestCookies, c as ProxyPluginOptions, d as RariRequest, f as CookieOptions, g as ProxyModule, h as ProxyMatcher, i as defineRariOptions, l as rariProxy, m as ProxyFunction, n as Response, o as rariRouter, p as ProxyConfig, r as defineRariConfig, s as generateAppRouteManifest, t as Request, u as RariResponse, v as RariFetchEvent, w as RouteContext, x as ResponseCookies, y as RariURL } from "./vite-O3u7f8Q_.mjs";
2
+ import { C as ApiRouteHandlers, D as RobotsRule, E as Robots, S as ApiResponse, T as RouteHandler, _ as ProxyResult, a as rari, b as RequestCookies, c as ProxyPluginOptions, d as RariRequest, f as CookieOptions, g as ProxyModule, h as ProxyMatcher, i as defineRariOptions, l as rariProxy, m as ProxyFunction, n as Response, o as rariRouter, p as ProxyConfig, r as defineRariConfig, s as generateAppRouteManifest, t as Request, u as RariResponse, v as RariFetchEvent, w as RouteContext, x as ResponseCookies, y as RariURL } from "./vite-BmkmtVrY.mjs";
3
3
  import "./runtime-executor-NBcG4boA.mjs";
4
4
  export { ApiResponse, ApiRouteHandlers, AppRouteEntry, AppRouteManifest, AppRouteMatch, CookieOptions, ErrorEntry, ErrorProps, GenerateMetadata, GenerateStaticParams, HttpRuntimeClient, LayoutEntry, LayoutProps, LoadingEntry, MetadataResult, NotFoundEntry, PageProps, ProxyConfig, ProxyFunction, ProxyMatcher, ProxyModule, ProxyPluginOptions, ProxyResult, RariFetchEvent, RariRequest, RariResponse, RariURL, Request, RequestCookies, Response, ResponseCookies, Robots, RobotsRule, RouteContext, RouteHandler, RouteSegment, RouteSegmentType, RuntimeClient, ServerPropsResult, StaticParamsResult, clearPropsCache, clearPropsCacheForComponent, createHttpRuntimeClient, defineRariConfig, defineRariOptions, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, generateAppRouteManifest, hasServerSideDataFetching, rari, rariProxy, rariRouter };
package/dist/vite.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { a as rariProxy, i as rariRouter, n as defineRariOptions, o as RariResponse, r as rari, s as ApiResponse, t as defineRariConfig } from "./vite-DJhQmKAk.mjs";
1
+ import { a as rariProxy, i as rariRouter, n as defineRariOptions, o as RariResponse, r as rari, s as ApiResponse, t as defineRariConfig } from "./vite-4h_gIEDe.mjs";
2
2
  import { t as RariRequest } from "./RariRequest-DM6Q4JDB.mjs";
3
3
  import { c as createHttpRuntimeClient, d as clearPropsCacheForComponent, f as extractMetadata, g as hasServerSideDataFetching, h as extractStaticParams, i as HttpRuntimeClient, m as extractServerPropsWithCache, p as extractServerProps, u as clearPropsCache } from "./runtime-client-B7wmvKD3.mjs";
4
4
  import { t as generateAppRouteManifest } from "./routes-B_KAzmbj.mjs";
5
5
  import "./image-CL9iVW32.mjs";
6
- import "./server-build-DadtZ6wc.mjs";
6
+ import "./server-build-y4PwbtX3.mjs";
7
7
 
8
8
  export { ApiResponse, HttpRuntimeClient, RariRequest, RariResponse, clearPropsCache, clearPropsCacheForComponent, createHttpRuntimeClient, defineRariConfig, defineRariOptions, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, generateAppRouteManifest, hasServerSideDataFetching, rari, rariProxy, rariRouter };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rari",
3
3
  "type": "module",
4
- "version": "0.7.2",
4
+ "version": "0.7.4",
5
5
  "description": "Runtime Accelerated Rendering Infrastructure (Rari)",
6
6
  "author": "Ryan Skinner",
7
7
  "license": "MIT",
@@ -93,16 +93,16 @@
93
93
  "picocolors": "^1.1.1"
94
94
  },
95
95
  "optionalDependencies": {
96
- "rari-darwin-arm64": "0.7.2",
97
- "rari-darwin-x64": "0.7.2",
98
- "rari-linux-arm64": "0.7.2",
99
- "rari-linux-x64": "0.7.2",
100
- "rari-win32-x64": "0.7.2"
96
+ "rari-darwin-arm64": "0.7.4",
97
+ "rari-darwin-x64": "0.7.4",
98
+ "rari-linux-arm64": "0.7.4",
99
+ "rari-linux-x64": "0.7.4",
100
+ "rari-win32-x64": "0.7.4"
101
101
  },
102
102
  "devDependencies": {
103
103
  "@types/node": "^25.0.8",
104
104
  "@types/react": "^19.2.8",
105
- "@typescript/native-preview": "^7.0.0-dev.20260113.1",
105
+ "@typescript/native-preview": "^7.0.0-dev.20260114.1",
106
106
  "chokidar": "^5.0.0",
107
107
  "eslint": "^9.39.2",
108
108
  "oxlint": "^1.39.0",
@@ -354,8 +354,26 @@ export function ClientRouter({ children, initialRoute }: ClientRouterProps) {
354
354
  if (!response.ok)
355
355
  throw new Error(`Failed to fetch: ${response.status}`)
356
356
 
357
+ const finalUrl = new URL(response.url)
358
+ const finalPath = finalUrl.pathname
359
+ const actualTargetPath = finalPath !== targetPath ? finalPath : targetPath
360
+
361
+ if (finalPath !== targetPath) {
362
+ window.history.replaceState(
363
+ {
364
+ route: finalPath,
365
+ navigationId,
366
+ scrollPosition: { x: window.scrollX, y: window.scrollY },
367
+ timestamp: Date.now(),
368
+ key: options.historyKey || generateHistoryKey(),
369
+ },
370
+ '',
371
+ finalPath,
372
+ )
373
+ }
374
+
357
375
  if (abortController.signal.aborted) {
358
- cleanupAbortedNavigation(targetPath, navigationId)
376
+ cleanupAbortedNavigation(actualTargetPath, navigationId)
359
377
  return
360
378
  }
361
379
 
@@ -386,7 +404,7 @@ export function ClientRouter({ children, initialRoute }: ClientRouterProps) {
386
404
 
387
405
  if (abortController.signal.aborted) {
388
406
  await reader.cancel()
389
- cleanupAbortedNavigation(targetPath, navigationId)
407
+ cleanupAbortedNavigation(actualTargetPath, navigationId)
390
408
  return
391
409
  }
392
410
 
@@ -413,7 +431,7 @@ export function ClientRouter({ children, initialRoute }: ClientRouterProps) {
413
431
  window.dispatchEvent(new CustomEvent('rari:navigate', {
414
432
  detail: {
415
433
  from: fromRoute,
416
- to: targetPath,
434
+ to: actualTargetPath,
417
435
  navigationId,
418
436
  options,
419
437
  routeInfo,
@@ -433,7 +451,7 @@ export function ClientRouter({ children, initialRoute }: ClientRouterProps) {
433
451
  window.dispatchEvent(new CustomEvent('rari:navigate', {
434
452
  detail: {
435
453
  from: fromRoute,
436
- to: targetPath,
454
+ to: actualTargetPath,
437
455
  navigationId,
438
456
  options,
439
457
  routeInfo,
@@ -444,24 +462,24 @@ export function ClientRouter({ children, initialRoute }: ClientRouterProps) {
444
462
  }
445
463
 
446
464
  if (abortController.signal.aborted) {
447
- cleanupAbortedNavigation(targetPath, navigationId)
465
+ cleanupAbortedNavigation(actualTargetPath, navigationId)
448
466
  return
449
467
  }
450
468
 
451
469
  if (isMountedRef.current) {
452
- currentRouteRef.current = targetPath
470
+ currentRouteRef.current = actualTargetPath
453
471
 
454
472
  setNavigationState(prev => ({
455
473
  ...prev,
456
- currentRoute: targetPath,
474
+ currentRoute: actualTargetPath,
457
475
  error: null,
458
476
  }))
459
477
 
460
- errorHandlerRef.current.resetRetry(targetPath)
478
+ errorHandlerRef.current.resetRetry(actualTargetPath)
461
479
 
462
480
  if (options.historyKey) {
463
481
  requestAnimationFrame(() => {
464
- statePreserverRef.current.restoreState(targetPath)
482
+ statePreserverRef.current.restoreState(actualTargetPath)
465
483
  })
466
484
  }
467
485
  }
package/src/vite/index.ts CHANGED
@@ -65,6 +65,9 @@ interface RariOptions {
65
65
  burstSize?: number
66
66
  revalidateRequestsPerMinute?: number
67
67
  }
68
+ spamBlocker?: {
69
+ enabled?: boolean
70
+ }
68
71
  }
69
72
 
70
73
  const DEFAULT_IMAGE_CONFIG = {
@@ -905,6 +908,7 @@ const ${componentName} = registerClientReference(
905
908
  alias: resolvedAlias,
906
909
  csp: options.csp,
907
910
  rateLimit: options.rateLimit,
911
+ spamBlocker: options.spamBlocker,
908
912
  })
909
913
 
910
914
  serverComponentBuilder = builder
@@ -1182,6 +1186,7 @@ const ${componentName} = registerClientReference(
1182
1186
  alias: resolvedAlias,
1183
1187
  csp: options.csp,
1184
1188
  rateLimit: options.rateLimit,
1189
+ spamBlocker: options.spamBlocker,
1185
1190
  })
1186
1191
 
1187
1192
  builder.addServerComponent(filePath)
@@ -1676,6 +1681,7 @@ globalThis['~clientComponentPaths']["${ext.path}"] = "${exportName}";`
1676
1681
  ...options.serverBuild,
1677
1682
  csp: options.csp,
1678
1683
  rateLimit: options.rateLimit,
1684
+ spamBlocker: options.spamBlocker,
1679
1685
  })
1680
1686
 
1681
1687
  const plugins: Plugin[] = [mainPlugin, serverBuildPlugin]
@@ -71,6 +71,9 @@ interface ServerComponentManifest {
71
71
  burstSize?: number
72
72
  revalidateRequestsPerMinute?: number
73
73
  }
74
+ spamBlocker?: {
75
+ enabled?: boolean
76
+ }
74
77
  }
75
78
 
76
79
  export interface ServerBuildOptions {
@@ -93,6 +96,9 @@ export interface ServerBuildOptions {
93
96
  burstSize?: number
94
97
  revalidateRequestsPerMinute?: number
95
98
  }
99
+ spamBlocker?: {
100
+ enabled?: boolean
101
+ }
96
102
  }
97
103
 
98
104
  export interface ComponentRebuildResult {
@@ -102,9 +108,10 @@ export interface ComponentRebuildResult {
102
108
  error?: string
103
109
  }
104
110
 
105
- type ResolvedServerBuildOptions = Required<Omit<ServerBuildOptions, 'csp' | 'rateLimit'>> & {
111
+ type ResolvedServerBuildOptions = Required<Omit<ServerBuildOptions, 'csp' | 'rateLimit' | 'spamBlocker'>> & {
106
112
  csp?: ServerBuildOptions['csp']
107
113
  rateLimit?: ServerBuildOptions['rateLimit']
114
+ spamBlocker?: ServerBuildOptions['spamBlocker']
108
115
  }
109
116
 
110
117
  export class ServerComponentBuilder {
@@ -151,6 +158,7 @@ export class ServerComponentBuilder {
151
158
  alias: options.alias || {},
152
159
  csp: options.csp,
153
160
  rateLimit: options.rateLimit,
161
+ spamBlocker: options.spamBlocker,
154
162
  }
155
163
  }
156
164
 
@@ -639,6 +647,7 @@ const ${importName} = (props) => {
639
647
  buildTime: new Date().toISOString(),
640
648
  csp: this.options.csp,
641
649
  rateLimit: this.options.rateLimit,
650
+ spamBlocker: this.options.spamBlocker,
642
651
  }
643
652
 
644
653
  for (const [filePath, component] of this.serverComponents) {
@@ -1432,6 +1441,7 @@ function registerClientReference(clientReference, id, exportName) {
1432
1441
  buildTime: new Date().toISOString(),
1433
1442
  csp: this.options.csp,
1434
1443
  rateLimit: this.options.rateLimit,
1444
+ spamBlocker: this.options.spamBlocker,
1435
1445
  }
1436
1446
  this.manifestCache = manifest
1437
1447
  }
@@ -1,3 +0,0 @@
1
- import { n as createServerBuildPlugin, r as scanDirectory, t as ServerComponentBuilder } from "./server-build-DadtZ6wc.mjs";
2
-
3
- export { ServerComponentBuilder, scanDirectory };