revojs 0.1.9 → 0.1.11
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/index.d.ts +2 -1
- package/dist/index.js +6 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -125,6 +125,7 @@ declare class Router extends Radix<Route> implements Middleware {
|
|
|
125
125
|
}
|
|
126
126
|
declare function defineRoute<T extends Route>(route: T): T;
|
|
127
127
|
declare function defineMiddleware<T extends Middleware>(middleware: T): T;
|
|
128
|
+
declare function defineException<T extends Exception>(exception: T): T;
|
|
128
129
|
declare function useRouter(scope: Scope): RouterContext;
|
|
129
130
|
declare function useServer<T extends Context>(scope: Scope): ServerContext<T>;
|
|
130
131
|
declare function useUrl(scope: Scope, base?: string): URL;
|
|
@@ -192,4 +193,4 @@ declare const CLIENT = "client";
|
|
|
192
193
|
//#region src/client/index.d.ts
|
|
193
194
|
declare function $fetch<T>(scope: Scope, input: string | URL, options?: RequestInit): Promise<T>;
|
|
194
195
|
//#endregion
|
|
195
|
-
export { $fetch, App, BuildConfig, CLIENT, Config, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Exception, Failure, HttpMethod, InferInput, InferOutput, Issue, Mergeable, Middleware, MimeType, Module, Node, Output, PARAMETER, ParameterNode, PathNode, ROUTER_CONTEXT, Radix, ResponseConfig, Result, Route, Router, RouterContext, SERVER, SERVER_CONTEXT, STATES, Schema, Scope, Server, ServerContext, Source, States, StatusCode, StopEvent, Success, Virtual, WILDCARD, WildcardNode, createApp, createServer, defineContext, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useQuery, useRouter, useServer, useSetCookies, useUrl };
|
|
196
|
+
export { $fetch, App, BuildConfig, CLIENT, Config, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Exception, Failure, HttpMethod, InferInput, InferOutput, Issue, Mergeable, Middleware, MimeType, Module, Node, Output, PARAMETER, ParameterNode, PathNode, ROUTER_CONTEXT, Radix, ResponseConfig, Result, Route, Router, RouterContext, SERVER, SERVER_CONTEXT, STATES, Schema, Scope, Server, ServerContext, Source, States, StatusCode, StopEvent, Success, Virtual, WILDCARD, WildcardNode, createApp, createServer, defineContext, defineException, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useQuery, useRouter, useServer, useSetCookies, useUrl };
|
package/dist/index.js
CHANGED
|
@@ -88,6 +88,9 @@ function defineRoute(route) {
|
|
|
88
88
|
function defineMiddleware(middleware) {
|
|
89
89
|
return middleware;
|
|
90
90
|
}
|
|
91
|
+
function defineException(exception) {
|
|
92
|
+
return exception;
|
|
93
|
+
}
|
|
91
94
|
function useRouter(scope) {
|
|
92
95
|
return scope.getContext(ROUTER_CONTEXT);
|
|
93
96
|
}
|
|
@@ -132,8 +135,8 @@ function setCookie(scope, name, value, options) {
|
|
|
132
135
|
if (options?.priority) cookie += `; Priority=${options.priority}`;
|
|
133
136
|
if (options?.sameSite) cookie += `; SameSite=${options.sameSite}`;
|
|
134
137
|
if (options?.secure) cookie += `; Secure`;
|
|
135
|
-
if (import.meta.
|
|
136
|
-
else
|
|
138
|
+
if (import.meta.server) response.headers.append("Set-Cookie", cookie);
|
|
139
|
+
else document.cookie = cookie;
|
|
137
140
|
}
|
|
138
141
|
function getState(scope, name) {
|
|
139
142
|
if (import.meta.server) {
|
|
@@ -403,4 +406,4 @@ async function $fetch(scope, input, options) {
|
|
|
403
406
|
}
|
|
404
407
|
|
|
405
408
|
//#endregion
|
|
406
|
-
export { $fetch, CLIENT, PARAMETER, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, StopEvent, WILDCARD, createApp, createServer, defineContext, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useQuery, useRouter, useServer, useSetCookies, useUrl };
|
|
409
|
+
export { $fetch, CLIENT, PARAMETER, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, StopEvent, WILDCARD, createApp, createServer, defineContext, defineException, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useQuery, useRouter, useServer, useSetCookies, useUrl };
|