rari 0.3.0 → 0.3.2
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/{app-types-BQxfIqaQ.d.ts → app-types-DUzcpcTH.d.ts} +1 -0
- package/dist/client.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/server.d.ts +5 -2
- package/dist/server.js +16 -1
- package/package.json +6 -6
- package/src/async-context.ts +34 -0
- package/src/router/app-types.ts +1 -0
- package/src/server.ts +2 -0
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as RouteSegmentType, S as RouteSegment, _ as NotFoundEntry, b as PageProps, c as GenerateMetadata, d as LayoutEntry, f as LayoutProps, h as LoadingProps, l as GenerateStaticParams, m as LoadingEntry, n as AppRouteManifest, o as ErrorEntry, r as AppRouteMatch, s as ErrorProps, t as AppRouteEntry, v as NotFoundProps } from "./app-types-
|
|
1
|
+
import { C as RouteSegmentType, S as RouteSegment, _ as NotFoundEntry, b as PageProps, c as GenerateMetadata, d as LayoutEntry, f as LayoutProps, h as LoadingProps, l as GenerateStaticParams, m as LoadingEntry, n as AppRouteManifest, o as ErrorEntry, r as AppRouteMatch, s as ErrorProps, t as AppRouteEntry, v as NotFoundProps } from "./app-types-DUzcpcTH.js";
|
|
2
2
|
import { _ as extractServerProps, a as LoadingSpinner, b as hasServerSideDataFetching, c as createErrorBoundary, d as MetadataResult, f as ServerPropsResult, g as extractMetadata, h as clearPropsCacheForComponent, i as HttpRuntimeClient, l as createHttpRuntimeClient, m as clearPropsCache, n as DefaultLoading, o as NotFound, p as StaticParamsResult, r as ErrorBoundary, s as RuntimeClient, t as DefaultError, u as createLoadingBoundary, v as extractServerPropsWithCache, y as extractStaticParams } from "./runtime-client-DXTHjUDN.js";
|
|
3
3
|
export { type AppRouteEntry, type AppRouteManifest, type AppRouteMatch, DefaultError, DefaultLoading, ErrorBoundary, type ErrorEntry, type ErrorProps, type GenerateMetadata, type GenerateStaticParams, HttpRuntimeClient, type LayoutEntry, type LayoutProps, type LoadingEntry, type LoadingProps, LoadingSpinner, type MetadataResult, NotFound, type NotFoundEntry, type NotFoundProps, type PageProps, type RouteSegment, type RouteSegmentType, type RuntimeClient, type ServerPropsResult, type StaticParamsResult, clearPropsCache, clearPropsCacheForComponent, createErrorBoundary, createHttpRuntimeClient, createLoadingBoundary, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, hasServerSideDataFetching };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as RouteSegmentType, S as RouteSegment, _ as NotFoundEntry, a as ErrorComponent, b as PageProps, c as GenerateMetadata, d as LayoutEntry, f as LayoutProps, g as NotFoundComponent, h as LoadingProps, i as AppRouterConfig, l as GenerateStaticParams, m as LoadingEntry, n as AppRouteManifest, o as ErrorEntry, p as LoadingComponent, r as AppRouteMatch, s as ErrorProps, t as AppRouteEntry, u as LayoutComponent, v as NotFoundProps, w as ServerPropsResult, x as RouteMetadata, y as PageComponent } from "./app-types-
|
|
1
|
+
import { C as RouteSegmentType, S as RouteSegment, _ as NotFoundEntry, a as ErrorComponent, b as PageProps, c as GenerateMetadata, d as LayoutEntry, f as LayoutProps, g as NotFoundComponent, h as LoadingProps, i as AppRouterConfig, l as GenerateStaticParams, m as LoadingEntry, n as AppRouteManifest, o as ErrorEntry, p as LoadingComponent, r as AppRouteMatch, s as ErrorProps, t as AppRouteEntry, u as LayoutComponent, v as NotFoundProps, w as ServerPropsResult, x as RouteMetadata, y as PageComponent } from "./app-types-DUzcpcTH.js";
|
|
2
2
|
import { a as useOptimisticAction, i as useActionStateWithFallback, n as ActionState, o as useValidatedAction, r as useActionState, t as ActionFunction } from "./useActionState-5zFMIoLK.js";
|
|
3
3
|
import { a as createServerReference, i as createFormAction, n as ServerActionResponse, o as enhanceFormWithAction, r as bindServerActions, t as ServerActionOptions } from "./actions-Ctw8vS6Y.js";
|
|
4
4
|
import { n as defineRariOptions, r as rari, t as defineRariConfig } from "./index-BlvegZl_.js";
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as RouteSegmentType, S as RouteSegment, _ as NotFoundEntry, b as PageProps, c as GenerateMetadata, d as LayoutEntry, f as LayoutProps, h as LoadingProps, l as GenerateStaticParams, m as LoadingEntry, n as AppRouteManifest, o as ErrorEntry, r as AppRouteMatch, s as ErrorProps, t as AppRouteEntry, v as NotFoundProps } from "./app-types-
|
|
1
|
+
import { C as RouteSegmentType, S as RouteSegment, _ as NotFoundEntry, b as PageProps, c as GenerateMetadata, d as LayoutEntry, f as LayoutProps, h as LoadingProps, l as GenerateStaticParams, m as LoadingEntry, n as AppRouteManifest, o as ErrorEntry, r as AppRouteMatch, s as ErrorProps, t as AppRouteEntry, v as NotFoundProps } from "./app-types-DUzcpcTH.js";
|
|
2
2
|
import { _ as extractServerProps, b as hasServerSideDataFetching, d as MetadataResult, f as ServerPropsResult, g as extractMetadata, h as clearPropsCacheForComponent, i as HttpRuntimeClient, l as createHttpRuntimeClient, m as clearPropsCache, p as StaticParamsResult, s as RuntimeClient, v as extractServerPropsWithCache, y as extractStaticParams } from "./runtime-client-DXTHjUDN.js";
|
|
3
3
|
import { n as defineRariOptions, r as rari, t as defineRariConfig } from "./index-BlvegZl_.js";
|
|
4
4
|
import { Plugin } from "rolldown-vite";
|
|
@@ -39,4 +39,7 @@ interface RariRouterPluginOptions {
|
|
|
39
39
|
}
|
|
40
40
|
declare function rariRouter(options?: RariRouterPluginOptions): Plugin;
|
|
41
41
|
//#endregion
|
|
42
|
-
|
|
42
|
+
//#region src/async-context.d.ts
|
|
43
|
+
declare function headers(): Promise<Headers>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { type AppRouteEntry, AppRouteGenerator, type AppRouteManifest, type AppRouteMatch, type ErrorEntry, type ErrorProps, type GenerateMetadata, type GenerateStaticParams, HttpRuntimeClient, type LayoutEntry, type LayoutProps, type LoadingEntry, type LoadingProps, type MetadataResult, type NotFoundEntry, type NotFoundProps, type PageProps, type RouteSegment, type RouteSegmentType, type RuntimeClient, type ServerPropsResult, type StaticParamsResult, clearPropsCache, clearPropsCacheForComponent, createHttpRuntimeClient, defineRariConfig, defineRariOptions, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, generateAppRouteManifest, hasServerSideDataFetching, headers, loadManifest, rari, rariRouter, writeManifest };
|
package/dist/server.js
CHANGED
|
@@ -1795,4 +1795,19 @@ function rariRouter(options = {}) {
|
|
|
1795
1795
|
}
|
|
1796
1796
|
|
|
1797
1797
|
//#endregion
|
|
1798
|
-
|
|
1798
|
+
//#region src/async-context.ts
|
|
1799
|
+
let currentContext = null;
|
|
1800
|
+
function getRequestContext() {
|
|
1801
|
+
return currentContext;
|
|
1802
|
+
}
|
|
1803
|
+
async function headers() {
|
|
1804
|
+
const context = getRequestContext();
|
|
1805
|
+
if (!context) return new Headers();
|
|
1806
|
+
const headersObj = new Headers();
|
|
1807
|
+
for (const [key, value] of Object.entries(context.headers)) headersObj.set(key, value);
|
|
1808
|
+
headersObj.set("x-pathname", context.pathname);
|
|
1809
|
+
return headersObj;
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
//#endregion
|
|
1813
|
+
export { AppRouteGenerator, HttpRuntimeClient, clearPropsCache, clearPropsCacheForComponent, createHttpRuntimeClient, defineRariConfig, defineRariOptions, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, generateAppRouteManifest, hasServerSideDataFetching, headers, loadManifest, rari, rariRouter, writeManifest };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rari",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.2",
|
|
5
5
|
"description": "Runtime Accelerated Rendering Infrastructure (Rari)",
|
|
6
6
|
"author": "Ryan Skinner",
|
|
7
7
|
"license": "MIT",
|
|
@@ -89,11 +89,11 @@
|
|
|
89
89
|
"picocolors": "^1.1.1"
|
|
90
90
|
},
|
|
91
91
|
"optionalDependencies": {
|
|
92
|
-
"rari-darwin-arm64": "0.3.
|
|
93
|
-
"rari-darwin-x64": "0.3.
|
|
94
|
-
"rari-linux-arm64": "0.3.
|
|
95
|
-
"rari-linux-x64": "0.3.
|
|
96
|
-
"rari-win32-x64": "0.3.
|
|
92
|
+
"rari-darwin-arm64": "0.3.2",
|
|
93
|
+
"rari-darwin-x64": "0.3.2",
|
|
94
|
+
"rari-linux-arm64": "0.3.2",
|
|
95
|
+
"rari-linux-x64": "0.3.2",
|
|
96
|
+
"rari-win32-x64": "0.3.2"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@types/node": "^24.9.1",
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
interface RequestContext {
|
|
2
|
+
headers: Record<string, string>
|
|
3
|
+
pathname: string
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
let currentContext: RequestContext | null = null
|
|
7
|
+
|
|
8
|
+
export function setRequestContext(context: RequestContext) {
|
|
9
|
+
currentContext = context
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function getRequestContext(): RequestContext | null {
|
|
13
|
+
return currentContext
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function clearRequestContext() {
|
|
17
|
+
currentContext = null
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function headers(): Promise<Headers> {
|
|
21
|
+
const context = getRequestContext()
|
|
22
|
+
if (!context) {
|
|
23
|
+
return new Headers()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const headersObj = new Headers()
|
|
27
|
+
for (const [key, value] of Object.entries(context.headers)) {
|
|
28
|
+
headersObj.set(key, value)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
headersObj.set('x-pathname', context.pathname)
|
|
32
|
+
|
|
33
|
+
return headersObj
|
|
34
|
+
}
|
package/src/router/app-types.ts
CHANGED