akanjs 2.2.10 → 2.2.12

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.
@@ -1,7 +1,8 @@
1
+ type InlineRscChunk = [1, string] | [3, string];
1
2
  declare global {
2
- var __RSC_CHUNKS__: string[] | undefined;
3
+ var __RSC_CHUNKS__: InlineRscChunk[] | undefined;
3
4
  var __RSC_CLOSED__: boolean | undefined;
4
- var __RSC_PUSH__: ((b64: string) => void) | undefined;
5
+ var __RSC_PUSH__: ((type: InlineRscChunk[0], data: string) => void) | undefined;
5
6
  var __RSC_CLOSE__: (() => void) | undefined;
6
7
  var __AKAN_RSC_NAVIGATE__: ((href: string, options?: {
7
8
  replace?: boolean;
@@ -0,0 +1,2 @@
1
+ export declare const RSC_CONTENT_TYPE = "text/x-component; charset=utf-8";
2
+ export declare function isRscPayloadResponse(res: Response): boolean;
@@ -4,6 +4,7 @@ import type { AkanMetricsReport } from "akanjs/service";
4
4
  import type { ClientManifest } from "./artifact.d.ts";
5
5
  import type { BaseBuildArtifact, CssAsset } from "./types.d.ts";
6
6
  export type RscRedirectMethod = "replace" | "push";
7
+ export type RscRedirectStatus = 303 | 307 | 308;
7
8
  export type RscRenderResult = {
8
9
  type: "stream";
9
10
  stream: ReadableStream<Uint8Array>;
@@ -13,6 +14,7 @@ export type RscRenderResult = {
13
14
  type: "redirect";
14
15
  location: string;
15
16
  method: RscRedirectMethod;
17
+ status: RscRedirectStatus;
16
18
  } | {
17
19
  type: "not-found";
18
20
  };
@@ -1,4 +1,17 @@
1
1
  import type { SsrChunkRegistryStats, SsrFromRscInput } from "./ssrTypes.d.ts";
2
+ export declare class SsrChunkRegistry<T> {
3
+ #private;
4
+ readonly maxEntries: number;
5
+ constructor(maxEntries?: number);
6
+ get size(): number;
7
+ get evictionCount(): number;
8
+ get(key: string): T | undefined;
9
+ set(keys: string[], value: T): void;
10
+ }
11
+ export type InlineRscChunk = readonly [1, string] | readonly [3, string];
12
+ export declare function encodeInlineRscChunk(chunk: Uint8Array): InlineRscChunk;
13
+ export declare function htmlEscapeJsonString(value: string): string;
14
+ export declare function createInlineRscScript(chunk: Uint8Array): string;
2
15
  export declare class SsrFromRscRenderer {
3
16
  #private;
4
17
  static getChunkRegistryStats(): SsrChunkRegistryStats;
@@ -16,6 +16,7 @@ export interface SsrChunkRegistryStats {
16
16
  ssrChunkRegistrySize: number;
17
17
  ssrChunkLoadCount: number;
18
18
  ssrChunkCacheHitCount: number;
19
+ ssrChunkEvictionCount: number;
19
20
  }
20
21
  export interface SsrFromRscInput {
21
22
  request?: Request;
@@ -2,8 +2,10 @@ import { type AkanI18nConfig } from "akanjs/common";
2
2
  import type { AkanMetricsReport } from "akanjs/service";
3
3
  import { type BuilderRpc, type RouteSeedIndex } from "./artifact.d.ts";
4
4
  import type { HmrWsData, HmrWsHub } from "./hmr/wsHub.d.ts";
5
- import { RscWorker } from "./rscWorkerHost.d.ts";
5
+ import { type RscRedirectMethod, type RscRedirectStatus, RscWorker } from "./rscWorkerHost.d.ts";
6
6
  import type { BaseBuildArtifact, HttpRoutes, RenderState } from "./types.d.ts";
7
+ export declare function createRscRedirectResponse(location: string, method: RscRedirectMethod, status?: RscRedirectStatus): Response;
8
+ export declare function createRscStreamResponse(stream: BodyInit, status?: number): Response;
7
9
  export declare function normalizeRscTargetUrlForHostBasePath(targetUrl: URL, options: {
8
10
  basePath: string | null;
9
11
  basePaths?: readonly string[];
@@ -99,6 +99,7 @@ export interface AkanMetricsReport {
99
99
  ssrChunkRegistrySize?: number;
100
100
  ssrChunkLoadCount?: number;
101
101
  ssrChunkCacheHitCount?: number;
102
+ ssrChunkEvictionCount?: number;
102
103
  httpFullSsrCount?: number;
103
104
  httpRscNavigationCount?: number;
104
105
  httpStaticAssetCount?: number;