rari 0.15.4 → 0.15.6

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.
Files changed (77) hide show
  1. package/dist/alias-resolver-Cigam7Y7.mjs +1 -0
  2. package/dist/cli.mjs +39 -39
  3. package/dist/define-BafO1-XT.d.mts +13 -0
  4. package/dist/define-CzFpVAjt.mjs +1 -0
  5. package/dist/feed-Ixvy9L12.mjs +3 -0
  6. package/dist/get-client-component-CLpyIcLJ.mjs +1 -0
  7. package/dist/headers.d.mts +1 -36
  8. package/dist/headers.mjs +1 -1
  9. package/dist/image.d.mts +38 -34
  10. package/dist/image.mjs +1 -1
  11. package/dist/index.d.mts +3 -4
  12. package/dist/mdx/define.d.mts +1 -1
  13. package/dist/mdx/define.mjs +1 -1
  14. package/dist/mdx.d.mts +5 -19
  15. package/dist/mdx.mjs +1 -1
  16. package/dist/og.d.mts +18 -8
  17. package/dist/og.mjs +1 -1
  18. package/dist/platform.mjs +2 -2
  19. package/dist/preload-modules-QmSvKk0Q.mjs +2 -0
  20. package/dist/proxy/RariRequest.d.mts +10 -11
  21. package/dist/proxy/RariRequest.mjs +1 -1
  22. package/dist/proxy/RariResponse.d.mts +1 -16
  23. package/dist/proxy/RariResponse.mjs +1 -1
  24. package/dist/proxy/runtime-executor.d.mts +1 -27
  25. package/dist/proxy/runtime-executor.mjs +1 -1
  26. package/dist/{railway-fmDbDigI.mjs → railway-HYTbx27C.mjs} +1 -1
  27. package/dist/rari-global-5vGzhToD.mjs +1 -0
  28. package/dist/{render-2I7-kFd_.mjs → render-CG5rxWXV.mjs} +1 -1
  29. package/dist/robots-BGCTYwKN.mjs +2 -0
  30. package/dist/router-D6mkoDqJ.mjs +1 -0
  31. package/dist/router.d.mts +8 -10
  32. package/dist/router.mjs +1 -1
  33. package/dist/runtime/AppRouterProvider.d.mts +25 -19
  34. package/dist/runtime/AppRouterProvider.mjs +1 -1
  35. package/dist/runtime/ErrorBoundaryWrapper.d.mts +2 -3
  36. package/dist/runtime/ErrorBoundaryWrapper.mjs +1 -1
  37. package/dist/runtime/LoadingErrorBoundary.d.mts +0 -1
  38. package/dist/runtime/action-flight-refresh.d.mts +2 -4
  39. package/dist/runtime/action-flight-refresh.mjs +1 -1
  40. package/dist/runtime/action-revalidation-kind.mjs +1 -1
  41. package/dist/runtime/call-server.d.mts +1 -1
  42. package/dist/runtime/call-server.mjs +1 -1
  43. package/dist/runtime/entry-client.d.mts +2 -0
  44. package/dist/runtime/entry-client.mjs +3 -3
  45. package/dist/runtime/flight-route-cache.d.mts +0 -1
  46. package/dist/runtime/flight-route-cache.mjs +1 -1
  47. package/dist/runtime/flight-router-state.d.mts +3 -3
  48. package/dist/runtime/merge-flight-refresh.d.mts +0 -1
  49. package/dist/runtime/merge-flight-refresh.mjs +1 -1
  50. package/dist/runtime/rsc-client-runtime.d.mts +8 -1
  51. package/dist/runtime/rsc-client-runtime.mjs +1 -1
  52. package/dist/runtime/rsc-references.d.mts +1 -1
  53. package/dist/runtime/rsc-references.mjs +1 -1
  54. package/dist/sitemap-1n5BIACA.mjs +7 -0
  55. package/dist/type-guards-CTkEL8zw.mjs +1 -0
  56. package/dist/types-BYob0lqv.d.mts +185 -0
  57. package/dist/types-DAdRjhuk.d.mts +130 -0
  58. package/dist/{types-DlF9FHQc.d.mts → types-DCEyvFz7.d.mts} +22 -19
  59. package/dist/types-_vPM8QuJ.d.mts +125 -0
  60. package/dist/utils-C-LVG9QI-D-IHIad5.mjs +37 -0
  61. package/dist/vite.d.mts +199 -161
  62. package/dist/vite.mjs +35 -35
  63. package/package.json +16 -15
  64. package/dist/alias-resolver-CHTPYtdq.mjs +0 -1
  65. package/dist/define-CRFUKkcA.d.mts +0 -14
  66. package/dist/define-rCXgNOOk.mjs +0 -1
  67. package/dist/feed-B3mYPCnT.mjs +0 -3
  68. package/dist/get-client-component-CDaY3lOP.mjs +0 -1
  69. package/dist/http-C5Y9ZrK9.mjs +0 -1
  70. package/dist/preload-modules-CJQ_IouX.mjs +0 -2
  71. package/dist/rari-global-Dygfa818.mjs +0 -1
  72. package/dist/robots-CsTVq3Jp.mjs +0 -2
  73. package/dist/router-Ctpd1kcp.mjs +0 -1
  74. package/dist/sitemap-BekxZtgA.mjs +0 -7
  75. package/dist/types-BC33STEP.d.mts +0 -97
  76. package/dist/types-DJQFFYSj.d.mts +0 -160
  77. package/dist/utils-CW4FEV95-DI7wf2Fu.mjs +0 -37
@@ -0,0 +1 @@
1
+ function e(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function t(e){return e instanceof Error&&`code`in e}function n(e){return typeof e==`function`}function r(t){try{let n=JSON.parse(t);return e(n)?n:null}catch{return null}}function i(e){let t=e.packageManager;return typeof t==`string`?t.startsWith(`pnpm`)?`pnpm`:t.startsWith(`yarn`)?`yarn`:t.startsWith(`bun`)?`bun`:t.startsWith(`npm`)?`npm`:null:null}function a(t){let n=e(t.dependencies)?t.dependencies:{},r=e(t.devDependencies)?t.devDependencies:{},i={...n,...r};return typeof i[`vite-plus`]==`string`?`vp`:typeof i.vite==`string`?`vite`:null}function o(e,t){if(!(e instanceof CustomEvent))return;let n=e.detail;if(t(n))return n}function s(e){return t(e)?e.code:void 0}function c(t,n){let i=r(t);if(!i)return null;let a=i[n];return Array.isArray(a)?a.filter(e):null}function l(t){return Array.isArray(t)?t.every(t=>{if(!e(t))return!1;let{find:n,replacement:r}=t;return(typeof n==`string`||n instanceof RegExp)&&typeof r==`string`}):!1}function u(t){return typeof t==`function`||e(t)&&(`$$typeof`in t||`render`in t)}function d(e){return`type`in e}function f(e){return Array.isArray(e)&&typeof e[0]==`string`}function p(t){return e(t)&&t.$$typeof===Symbol.for(`react.client.reference`)}function m(t){return e(t)&&typeof t.$$id==`string`}function h(e){return e.props}function g(e){return Object.entries(e).flatMap(([e,t])=>typeof t==`string`?[{find:e,replacement:t}]:[])}function _(t){return e(t)&&typeof t.route==`string`&&typeof t.navigationId==`number`&&typeof t.timestamp==`number`&&typeof t.key==`string`}function v(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function y(t){return Array.isArray(t)?t.every(t=>e(t)?Object.values(t).every(e=>typeof e==`string`||v(e)):!1):!1}function b(e){console.warn(`[rari] generateStaticParams() in ${e} returned invalid params. Expected Array<Record<string, string | string[]>> (e.g. [{ slug: "post" }]). Static routes for this page will not be generated.`)}export{i as _,m as a,u as c,_ as d,d as f,r as g,c as h,h as i,f as l,y as m,o as n,l as o,e as p,s as r,p as s,g as t,n as u,a as v,b as y};
@@ -0,0 +1,185 @@
1
+ /// <reference types="vite-plus/client" />
2
+ //#region src/ambient.d.ts
3
+ declare module 'virtual:react-flight-client' {
4
+ export interface Thenable<T> extends Promise<T> {
5
+ readonly status?: 'pending' | 'fulfilled' | 'rejected';
6
+ readonly value?: T;
7
+ readonly reason?: unknown;
8
+ }
9
+ export function createServerReference<A extends unknown[] = unknown[], R = unknown>(id: string, callServer: (id: string, args: A) => Promise<R>, encodeFormAction?: (args: A) => Promise<FormData | string>): unknown;
10
+ export function createFromReadableStream<T>(stream: ReadableStream<Uint8Array>, options?: Readonly<{
11
+ readonly callServer?: (id: string, args: readonly unknown[]) => Promise<unknown>;
12
+ readonly moduleMap?: unknown;
13
+ readonly moduleLoading?: unknown;
14
+ }>): Thenable<T>;
15
+ export function createFromFetch<T>(promiseForResponse: Promise<Response>, options?: Readonly<{
16
+ readonly callServer?: (id: string, args: readonly unknown[]) => Promise<unknown>;
17
+ readonly temporaryReferences?: Map<string, unknown>;
18
+ }>): Promise<T>;
19
+ export function createTemporaryReferenceSet(): Map<string, unknown>;
20
+ export function encodeReply(value: unknown, options?: Readonly<{
21
+ readonly temporaryReferences?: Map<string, unknown>;
22
+ readonly signal?: AbortSignal;
23
+ }>): Promise<FormData | string>;
24
+ }
25
+ declare module 'react-server-dom-webpack/client' {
26
+ export type { Thenable } from 'virtual:react-flight-client';
27
+ export { createFromReadableStream, createServerReference, encodeReply } from 'virtual:react-flight-client';
28
+ }
29
+ declare module 'react-server-dom-webpack/server' {
30
+ export function registerClientReference<T>(clientReference: T, id: string, exportName: string): T;
31
+ export function createClientModuleProxy(moduleId: string): unknown;
32
+ export function registerServerReference<T>(serverReference: T, id: string, exportName: string | null): T;
33
+ }
34
+ declare global {
35
+ interface RequestInit {
36
+ rari?: {
37
+ revalidate?: number | false;
38
+ tags?: string[];
39
+ timeout?: number;
40
+ };
41
+ }
42
+ interface GlobalThis {
43
+ '~rariExecuteProxy'?: (request: Readonly<{
44
+ readonly url: string;
45
+ readonly method: string;
46
+ readonly headers: {
47
+ readonly [key: string]: string;
48
+ };
49
+ }>) => Promise<{
50
+ continue: boolean;
51
+ redirect?: {
52
+ destination: string;
53
+ permanent: boolean;
54
+ };
55
+ rewrite?: string;
56
+ requestHeaders?: Record<string, string | string[]>;
57
+ responseHeaders?: Record<string, string | string[]>;
58
+ response?: {
59
+ status: number;
60
+ headers: Record<string, string | string[]>;
61
+ body?: string;
62
+ };
63
+ }>;
64
+ }
65
+ }
66
+ //#endregion
67
+ //#region src/router/build/api-routes.d.ts
68
+ interface RouteContext<TParams extends Record<string, string> = Record<string, string>> {
69
+ readonly params: TParams;
70
+ }
71
+ type RouteHandler<TParams extends Record<string, string> = Record<string, string>> = (request: Request, context?: RouteContext<TParams>) => Response | Promise<Response>;
72
+ interface ApiRouteHandlers<TParams extends Record<string, string> = Record<string, string>> {
73
+ GET?: RouteHandler<TParams>;
74
+ POST?: RouteHandler<TParams>;
75
+ PUT?: RouteHandler<TParams>;
76
+ DELETE?: RouteHandler<TParams>;
77
+ PATCH?: RouteHandler<TParams>;
78
+ HEAD?: RouteHandler<TParams>;
79
+ OPTIONS?: RouteHandler<TParams>;
80
+ }
81
+ declare class ApiResponse extends Response {
82
+ static json(data: unknown, init?: ResponseInit): Response;
83
+ static redirect(url: string, status?: number): Response;
84
+ static noContent(init?: ResponseInit): Response;
85
+ }
86
+ //#endregion
87
+ //#region src/router/metadata/types.d.ts
88
+ interface RobotsRule {
89
+ readonly userAgent?: string | readonly string[];
90
+ readonly allow?: string | readonly string[];
91
+ readonly disallow?: string | readonly string[];
92
+ readonly crawlDelay?: number;
93
+ }
94
+ interface Robots {
95
+ readonly rules: RobotsRule | readonly RobotsRule[];
96
+ readonly sitemap?: string | readonly string[];
97
+ readonly host?: string;
98
+ }
99
+ interface SitemapImage {
100
+ readonly loc: string;
101
+ readonly title?: string;
102
+ readonly caption?: string;
103
+ readonly geoLocation?: string;
104
+ readonly license?: string;
105
+ }
106
+ interface SitemapVideo {
107
+ readonly title: string;
108
+ readonly thumbnail_loc: string;
109
+ readonly description: string;
110
+ readonly content_loc?: string;
111
+ readonly player_loc?: string;
112
+ readonly duration?: number;
113
+ readonly expiration_date?: string;
114
+ readonly rating?: number;
115
+ readonly view_count?: number;
116
+ readonly publication_date?: string;
117
+ readonly family_friendly?: boolean;
118
+ readonly restriction?: {
119
+ readonly relationship: 'allow' | 'deny';
120
+ readonly content: string;
121
+ };
122
+ readonly platform?: {
123
+ readonly relationship: 'allow' | 'deny';
124
+ readonly content: string;
125
+ };
126
+ readonly requires_subscription?: boolean;
127
+ readonly uploader?: {
128
+ readonly name: string;
129
+ readonly info?: string;
130
+ };
131
+ readonly live?: boolean;
132
+ readonly tag?: readonly string[];
133
+ }
134
+ interface SitemapEntry {
135
+ readonly url: string;
136
+ readonly lastModified?: string | Date;
137
+ readonly changeFrequency?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
138
+ readonly priority?: number;
139
+ readonly alternates?: {
140
+ readonly languages?: {
141
+ readonly [key: string]: string;
142
+ };
143
+ };
144
+ readonly images?: readonly (string | SitemapImage)[];
145
+ readonly videos?: readonly SitemapVideo[];
146
+ }
147
+ type Sitemap = readonly SitemapEntry[];
148
+ interface FeedEntry {
149
+ readonly title: string;
150
+ readonly url: string;
151
+ readonly description?: string;
152
+ readonly content?: string;
153
+ readonly author?: string | {
154
+ readonly name: string;
155
+ readonly email?: string;
156
+ readonly url?: string;
157
+ };
158
+ readonly pubDate?: string | Date;
159
+ readonly guid?: string;
160
+ readonly categories?: readonly string[];
161
+ readonly enclosure?: {
162
+ readonly url: string;
163
+ readonly length?: number;
164
+ readonly type?: string;
165
+ };
166
+ }
167
+ interface Feed {
168
+ readonly title: string;
169
+ readonly description: string;
170
+ readonly link: string;
171
+ readonly language?: string;
172
+ readonly copyright?: string;
173
+ readonly lastBuildDate?: string | Date;
174
+ readonly ttl?: number;
175
+ readonly image?: {
176
+ readonly url: string;
177
+ readonly title: string;
178
+ readonly link: string;
179
+ readonly width?: number;
180
+ readonly height?: number;
181
+ };
182
+ readonly items: readonly FeedEntry[];
183
+ }
184
+ //#endregion
185
+ export { Sitemap as a, SitemapVideo as c, RouteContext as d, RouteHandler as f, RobotsRule as i, ApiResponse as l, FeedEntry as n, SitemapEntry as o, Robots as r, SitemapImage as s, Feed as t, ApiRouteHandlers as u };
@@ -0,0 +1,130 @@
1
+ //#region src/proxy/http/response.d.ts
2
+ declare class RariResponse extends Response {
3
+ readonly cookies: ResponseCookies;
4
+ constructor(body?: BodyInit | null, init?: ResponseInit);
5
+ static next(init?: Readonly<{
6
+ readonly request?: {
7
+ readonly headers?: Headers | {
8
+ readonly [key: string]: string;
9
+ };
10
+ };
11
+ }>): RariResponse;
12
+ static redirect(url: string | URL, status?: number): RariResponse;
13
+ static rewrite(destination: string | URL): RariResponse;
14
+ static json(data: unknown, init?: ResponseInit): RariResponse;
15
+ }
16
+ //#endregion
17
+ //#region src/proxy/http/types.d.ts
18
+ interface RariRequest {
19
+ readonly url: string;
20
+ readonly method: string;
21
+ readonly headers: Headers;
22
+ readonly cookies: RequestCookies;
23
+ readonly rariUrl: RariURL;
24
+ readonly ip?: string;
25
+ readonly geo?: Readonly<{
26
+ city?: string;
27
+ country?: string;
28
+ region?: string;
29
+ latitude?: string;
30
+ longitude?: string;
31
+ }>;
32
+ }
33
+ interface RariURL {
34
+ readonly href: string;
35
+ readonly origin: string;
36
+ readonly protocol: string;
37
+ readonly hostname: string;
38
+ readonly port: string;
39
+ readonly pathname: string;
40
+ readonly search: string;
41
+ readonly searchParams: URLSearchParams;
42
+ readonly hash: string;
43
+ }
44
+ interface RequestCookies {
45
+ readonly get: (name: string) => Readonly<{
46
+ name: string;
47
+ value: string;
48
+ path?: string;
49
+ }> | undefined;
50
+ readonly getAll: () => ReadonlyArray<Readonly<{
51
+ name: string;
52
+ value: string;
53
+ path?: string;
54
+ }>>;
55
+ readonly has: (name: string) => boolean;
56
+ readonly delete: (name: string) => void;
57
+ readonly set: ((name: string, value: string, options?: Readonly<CookieOptions>) => void) & ((options: Readonly<{
58
+ name: string;
59
+ value: string;
60
+ } & CookieOptions>) => void);
61
+ }
62
+ interface ResponseCookies {
63
+ readonly get: (name: string) => Readonly<{
64
+ name: string;
65
+ value: string;
66
+ path?: string;
67
+ }> | undefined;
68
+ readonly getAll: () => ReadonlyArray<Readonly<{
69
+ name: string;
70
+ value: string;
71
+ path?: string;
72
+ }>>;
73
+ readonly set: ((name: string, value: string, options?: Readonly<CookieOptions>) => void) & ((options: Readonly<{
74
+ name: string;
75
+ value: string;
76
+ } & CookieOptions>) => void);
77
+ readonly delete: (name: string) => void;
78
+ readonly toSetCookieHeaders: () => string[];
79
+ }
80
+ interface CookieOptions {
81
+ readonly path?: string;
82
+ readonly domain?: string;
83
+ readonly maxAge?: number;
84
+ readonly expires?: Date;
85
+ readonly httpOnly?: boolean;
86
+ readonly secure?: boolean;
87
+ readonly sameSite?: 'strict' | 'lax' | 'none';
88
+ }
89
+ interface RariFetchEvent {
90
+ readonly waitUntil: (promise: Promise<unknown>) => void;
91
+ }
92
+ type ProxyFunctionResult = Response | RariResponse | null | undefined;
93
+ type ProxyFunction = (request: RariRequest, event?: RariFetchEvent) => Promise<ProxyFunctionResult> | ProxyFunctionResult;
94
+ interface ProxyCondition {
95
+ readonly type: 'header' | 'query' | 'cookie';
96
+ readonly key: string;
97
+ readonly value?: string;
98
+ }
99
+ type ProxyRuleCondition = ProxyCondition | {
100
+ readonly type: 'host';
101
+ readonly key: string;
102
+ readonly value?: string;
103
+ };
104
+ interface ProxyMatcher {
105
+ readonly source: string;
106
+ readonly locale?: boolean;
107
+ readonly has?: ReadonlyArray<ProxyRuleCondition>;
108
+ readonly missing?: ReadonlyArray<ProxyRuleCondition>;
109
+ }
110
+ interface ProxyConfig {
111
+ readonly matcher?: string | readonly string[] | ProxyMatcher | readonly ProxyMatcher[];
112
+ }
113
+ interface ProxyModule {
114
+ readonly proxy?: ProxyFunction;
115
+ readonly default?: ProxyFunction;
116
+ readonly config?: ProxyConfig;
117
+ }
118
+ interface ProxyResult {
119
+ readonly continue: boolean;
120
+ readonly response?: Response;
121
+ readonly requestHeaders?: Readonly<Record<string, string | readonly string[]>>;
122
+ readonly responseHeaders?: Readonly<Record<string, string | readonly string[]>>;
123
+ readonly rewrite?: string;
124
+ readonly redirect?: {
125
+ readonly destination: string;
126
+ readonly permanent: boolean;
127
+ };
128
+ }
129
+ //#endregion
130
+ export { ProxyModule as a, RariURL as c, RariResponse as d, ProxyMatcher as i, RequestCookies as l, ProxyConfig as n, ProxyResult as o, ProxyFunction as r, RariFetchEvent as s, CookieOptions as t, ResponseCookies as u };
@@ -1,5 +1,4 @@
1
1
  import { ReactNode } from "react";
2
-
3
2
  //#region src/router/build/types.d.ts
4
3
  type RouteSegmentType = 'static' | 'dynamic' | 'catch-all' | 'optional-catch-all';
5
4
  interface RouteSegment {
@@ -162,35 +161,39 @@ interface RouteMetadata {
162
161
  };
163
162
  }
164
163
  type Metadata = RouteMetadata;
165
- type RouteParams = Record<string, string | string[]>;
166
- type SearchParams = Record<string, string | string[] | undefined>;
167
- interface PageProps<TParams extends RouteParams = RouteParams, TSearchParams extends SearchParams = SearchParams> {
164
+ interface RouteParams {
165
+ readonly [key: string]: string | readonly string[];
166
+ }
167
+ interface SearchParams {
168
+ readonly [key: string]: string | readonly string[] | undefined;
169
+ }
170
+ type PageProps<TParams extends RouteParams = RouteParams, TSearchParams extends SearchParams = SearchParams> = Readonly<{
168
171
  params: TParams;
169
172
  searchParams: TSearchParams;
170
- }
171
- interface LayoutProps<TParams extends RouteParams = RouteParams> {
173
+ }>;
174
+ type LayoutProps<TParams extends RouteParams = RouteParams> = Readonly<{
172
175
  children: ReactNode;
173
176
  params?: TParams;
174
177
  pathname?: string;
175
- }
178
+ }>;
176
179
  interface ErrorProps {
177
- error: Error;
178
- reset: () => void;
180
+ readonly error: Error;
181
+ readonly reset: () => void;
179
182
  }
180
183
  interface AppRouteMatch {
181
- route: AppRouteEntry;
182
- params: RouteParams;
183
- searchParams: SearchParams;
184
- layouts: LayoutEntry[];
185
- loading?: LoadingEntry;
186
- error?: ErrorEntry;
187
- templates: TemplateEntry[];
188
- pathname: string;
184
+ readonly route: AppRouteEntry;
185
+ readonly params: RouteParams;
186
+ readonly searchParams: SearchParams;
187
+ readonly layouts: readonly LayoutEntry[];
188
+ readonly loading?: LoadingEntry;
189
+ readonly error?: ErrorEntry;
190
+ readonly templates: readonly TemplateEntry[];
191
+ readonly pathname: string;
189
192
  }
190
- type GenerateMetadata<TParams extends RouteParams = RouteParams, TSearchParams extends SearchParams = SearchParams> = (props: {
193
+ type GenerateMetadata<TParams extends RouteParams = RouteParams, TSearchParams extends SearchParams = SearchParams> = (props: Readonly<{
191
194
  params: TParams;
192
195
  searchParams: TSearchParams;
193
- }) => RouteMetadata | Promise<RouteMetadata>;
196
+ }>) => RouteMetadata | Promise<RouteMetadata>;
194
197
  type GenerateStaticParams<TParams extends RouteParams = RouteParams> = () => TParams[] | Promise<TParams[]>;
195
198
  //#endregion
196
199
  export { ErrorProps as a, LayoutEntry as c, Metadata as d, NotFoundEntry as f, TemplateEntry as g, RouteSegmentType as h, ErrorEntry as i, LayoutProps as l, RouteSegment as m, AppRouteManifest as n, GenerateMetadata as o, PageProps as p, AppRouteMatch as r, GenerateStaticParams as s, AppRouteEntry as t, LoadingEntry as u };
@@ -0,0 +1,125 @@
1
+ //#region src/runtime/shared/types.d.ts
2
+ interface CookieOptions {
3
+ readonly path?: string;
4
+ readonly domain?: string;
5
+ readonly expires?: Date;
6
+ readonly maxAge?: number;
7
+ readonly httpOnly?: boolean;
8
+ readonly secure?: boolean;
9
+ readonly sameSite?: boolean | 'lax' | 'strict' | 'none';
10
+ readonly priority?: 'low' | 'medium' | 'high';
11
+ readonly partitioned?: boolean;
12
+ }
13
+ interface ReadonlyCookie {
14
+ readonly name: string;
15
+ readonly value: string;
16
+ }
17
+ interface ReadonlyHeaders {
18
+ readonly get: (name: string) => string | null;
19
+ readonly has: (name: string) => boolean;
20
+ readonly entries: () => IterableIterator<[string, string]>;
21
+ readonly forEach: (callback: (value: string, key: string) => void) => void;
22
+ readonly keys: () => IterableIterator<string>;
23
+ readonly values: () => IterableIterator<string>;
24
+ }
25
+ interface CookieStore {
26
+ readonly get: (name: string) => ReadonlyCookie | undefined;
27
+ readonly getAll: (name?: string) => readonly ReadonlyCookie[];
28
+ readonly has: (name: string) => boolean;
29
+ readonly set: ((name: string, value: string, options?: Readonly<CookieOptions>) => void) & ((options: Readonly<{
30
+ name: string;
31
+ value: string;
32
+ } & CookieOptions>) => void);
33
+ readonly delete: (name: string) => void;
34
+ readonly toString: () => string;
35
+ }
36
+ interface ComponentInfo {
37
+ id: string;
38
+ path: string;
39
+ type: string;
40
+ component?: any;
41
+ registered: boolean;
42
+ loader?: () => Promise<any>;
43
+ loading?: boolean;
44
+ loadPromise?: Promise<any>;
45
+ loadError?: unknown;
46
+ exportName?: string;
47
+ displayName?: string;
48
+ }
49
+ interface GlobalWithRari {
50
+ '~rari'?: {
51
+ isDevelopment?: boolean;
52
+ navigationId?: number;
53
+ AppRouterProvider?: any;
54
+ ClientRouter?: any;
55
+ getClientComponent?: (id: string) => Promise<any>;
56
+ preloadClientComponent?: (id: string) => Promise<void>;
57
+ streaming?: {
58
+ enabled?: boolean;
59
+ complete?: boolean;
60
+ bufferedRows: string[];
61
+ streamingBridgeInstalled?: boolean;
62
+ };
63
+ serverComponents?: Set<string>;
64
+ routeInfoCache?: {
65
+ clear: () => void;
66
+ invalidate?: (path: string) => void;
67
+ };
68
+ cookies?: () => CookieStore;
69
+ headers?: () => ReadonlyHeaders;
70
+ useCacheDynamicDepth?: number;
71
+ useCacheBuildId?: string;
72
+ useCachePrivateKey?: string;
73
+ pageCacheTags?: Set<string>;
74
+ invalidateUseCache?: (input: Readonly<{
75
+ tag?: string;
76
+ path?: string;
77
+ }>) => Promise<void>;
78
+ markUseCacheDynamic?: () => void;
79
+ };
80
+ '~clientComponents'?: Record<string, ComponentInfo>;
81
+ '~clientComponentPaths'?: Record<string, string>;
82
+ '~clientComponentNames'?: Record<string, string>;
83
+ }
84
+ declare global {
85
+ interface GlobalThis {
86
+ '~rari'?: GlobalWithRari['~rari'];
87
+ '~clientComponents'?: GlobalWithRari['~clientComponents'];
88
+ '~clientComponentPaths'?: GlobalWithRari['~clientComponentPaths'];
89
+ '~clientComponentNames'?: GlobalWithRari['~clientComponentNames'];
90
+ '~rariExecuteProxy'?: (request: Readonly<{
91
+ readonly url: string;
92
+ readonly method: string;
93
+ readonly headers: {
94
+ readonly [key: string]: string;
95
+ };
96
+ }>) => Promise<{
97
+ continue: boolean;
98
+ redirect?: {
99
+ destination: string;
100
+ permanent: boolean;
101
+ };
102
+ rewrite?: string;
103
+ requestHeaders?: Record<string, string | string[]>;
104
+ responseHeaders?: Record<string, string | string[]>;
105
+ response?: {
106
+ status: number;
107
+ headers: Record<string, string | string[]>;
108
+ body?: string;
109
+ };
110
+ }>;
111
+ 'registerClientComponent'?: (key: string, id: string, reference: unknown) => void;
112
+ '__rari_rsc_require__'?: (id: string) => unknown;
113
+ '__rari_client_ready'?: boolean;
114
+ '__rari_f'?: ReadonlyArray<0 | string | readonly [2, string]>;
115
+ '__rari_chunk_load__'?: (chunkId: string) => Promise<unknown>;
116
+ }
117
+ interface Window {
118
+ '~rari'?: GlobalWithRari['~rari'];
119
+ '~clientComponents'?: GlobalWithRari['~clientComponents'];
120
+ '~clientComponentPaths'?: GlobalWithRari['~clientComponentPaths'];
121
+ '~clientComponentNames'?: GlobalWithRari['~clientComponentNames'];
122
+ }
123
+ }
124
+ //#endregion
125
+ export { ReadonlyHeaders as i, CookieStore as n, ReadonlyCookie as r, CookieOptions as t };
@@ -0,0 +1,37 @@
1
+ import{existsSync as e,readFileSync as t,writeFileSync as n}from"node:fs";import{join as r}from"node:path";import i from"node:process";import{styleText as a}from"node:util";function o(e){console.warn(`${a(`blue`,`info`)} ${e}`)}function s(e){console.warn(`${a(`green`,`✓`)} ${e}`)}function c(e){console.error(`${a(`red`,`✗`)} ${e}`)}function l(e){console.warn(`${a(`yellow`,`⚠`)} ${e}`)}const u=/\s+(?:&&\s+)?/,d=/^>=?\s*(\d+)/,f=/^>=?\s*(\d+)\.(\d+)\.(\d+)/,p=/^=?\s*(\d+)\.(\d+)\.(\d+)/,m=/^\^\s*(\d+)\.(\d+)\.(\d+)/,h=/^~\s*(\d+)\.(\d+)\.(\d+)/,g=/^(?:>=?|<=?|[=~^])?\s*(\d+)\.(\d+)/,_=/^(\d+)\.(?:x|\*)/i,v=/^(?:>=?|[=~^])\s*(\d+)(?:\s|$)/,y=/^(\d+)$/;function b(e){return typeof e==`object`&&!!e}function x(e){let t=JSON.parse(e);if(!b(t))throw Error(`Invalid package.json`);return t}function S(e,t=`>=22.18.0`){if(e.engines=e.engines??{},e.engines.node){if(!C(e.engines.node,t))return l(`Current engines.node value "${e.engines.node}" may not meet the required minimum of ${t}`),l(`Updating to ${t} for deployment compatibility`),e.engines.node=t,!0}else return e.engines.node=t,!0;return!1}function C(e,t){let n=w(e),r=w(t);return!n||!r?!1:T(n,r)>=0}function w(e){let t=e.trim(),n=e=>e!==null;if(t.includes(`||`)){let e=t.split(`||`).map(e=>e.trim()).map(e=>w(e)).filter(n);return e.length===0?null:e.reduce((e,t)=>T(t,e)<0?t:e)}let r=t.split(u).filter(e=>e!==``&&e!==`&&`);if(r.length>1){let e=r.filter(e=>d.test(e)).map(e=>w(e)).filter(n);return e.length===0?null:e.reduce((e,t)=>T(t,e)>0?t:e)}let i=null;return i=f.exec(t),i||(i=p.exec(t),i)||(i=m.exec(t),i)||(i=h.exec(t),i)?{major:Number.parseInt(i[1],10),minor:Number.parseInt(i[2],10),patch:Number.parseInt(i[3],10)}:(i=g.exec(t),i?{major:Number.parseInt(i[1],10),minor:Number.parseInt(i[2],10),patch:0}:(i=_.exec(t),i||(i=v.exec(t),i)||(i=y.exec(t),i)?{major:Number.parseInt(i[1],10),minor:0,patch:0}:null))}function T(e,t){return e.major===t.major?e.minor===t.minor?e.patch-t.patch:e.minor-t.minor:e.major-t.major}function E(n=i.cwd()){let a=r(n,`node_modules/rari/package.json`);if(!e(a))return c(`rari is not installed. Please run "npm install rari" first.`),i.exit(1),``;try{let e=x(t(a,`utf-8`));return e.version!=null&&e.version!==``?`^${e.version}`:(c(`Could not determine rari version from package.json`),i.exit(1),``)}catch(e){return c(`Failed to read rari package.json: ${e instanceof Error?e.message:`Unknown error`}`),i.exit(1),``}}function D(a,u){let d=r(a,`package.json`);e(d)||(c(`No package.json found. Please run this command from your project root.`),i.exit(1));try{let e=x(t(d,`utf-8`));e.scripts=e.scripts??{};let r=u.startScript??`rari start`;e.scripts.start&&e.scripts.start!==r&&!e.scripts[`start:original`]&&(l(`Existing start script found: "${e.scripts.start}"`),l(`Backing up to start:original and replacing with "${r}"`),e.scripts[`start:original`]=e.scripts.start),e.scripts.start=r,e.scripts[`start:local`]=`rari start`,e.scripts[`deploy:${u.providerName.toLowerCase()}`]=u.deployScript,S(e),(e.dependencies?.rari==null||e.dependencies.rari===``)&&(o(`Adding rari dependency...`),e.dependencies=e.dependencies??{},e.dependencies.rari=u.dependency??E(a)),n(d,`${JSON.stringify(e,null,2)}\n`),s(`Updated package.json for ${u.providerName} deployment`)}catch(e){c(`Failed to update package.json: ${e instanceof Error?e.message:`Unknown error`}`),i.exit(1)}}function O(i,a,o){let c=r(i,`.gitignore`),l=[``,`# ${a}`,`${o}/`,``].join(`
2
+ `);if(e(c)){let e=t(c,`utf-8`),r=e.split(`
3
+ `).map(e=>e.trim());r.includes(`${o}/`)||r.includes(o)||(n(c,e+l),s(`Updated .gitignore with ${a} entries`))}else n(c,`# Dependencies
4
+ node_modules
5
+ .pnpm-store
6
+
7
+ # Build outputs
8
+ dist
9
+
10
+ # Environment variables
11
+ .env
12
+ .env.local
13
+ .env.production
14
+
15
+ # ${a}
16
+ ${o}
17
+
18
+ # Logs
19
+ *.log
20
+ npm-debug.log*
21
+ pnpm-debug.log*
22
+
23
+ # OS files
24
+ .DS_Store
25
+ Thumbs.db
26
+
27
+ # IDE files
28
+ .vscode
29
+ .idea
30
+ *.swp
31
+ *.swo
32
+ *~
33
+
34
+ # Temporary files
35
+ .tmp
36
+ tmp
37
+ `),s(`Created .gitignore with ${a} entries`)}function k(a,o,u){let d=r(a,o);try{if(e(d)){let i=t(d,`utf-8`),s=`${o}.backup`,c=r(a,s);e(c)&&(s=`${o}.backup.${Date.now()}`,c=r(a,s)),l(`${o} already exists, backing up to ${s}`),n(c,i,{flag:`wx`})}n(d,u),s(`Created ${o} configuration`)}catch(e){c(`Failed to create or backup ${o}: ${e instanceof Error?e.message:`Unknown error`}`),i.exit(1)}}export{o as a,O as i,E as n,s as o,D as r,k as t};