crelte 0.5.8 → 0.5.10
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/blocks/Blocks.d.ts +41 -4
- package/dist/blocks/Blocks.d.ts.map +1 -1
- package/dist/blocks/Blocks.js +47 -2
- package/dist/blocks/Blocks.svelte +2 -16
- package/dist/blocks/Blocks.svelte.d.ts +20 -37
- package/dist/blocks/Blocks.svelte.d.ts.map +1 -1
- package/dist/blocks/index.d.ts +2 -2
- package/dist/blocks/index.d.ts.map +1 -1
- package/dist/blocks/index.js +2 -2
- package/dist/cookies/ServerCookies.d.ts +1 -1
- package/dist/cookies/ServerCookies.js +1 -1
- package/dist/cookies/index.d.ts +1 -1
- package/dist/crelte.d.ts +21 -10
- package/dist/crelte.d.ts.map +1 -1
- package/dist/index.d.ts +19 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -13
- package/dist/init/client.d.ts +2 -2
- package/dist/init/client.d.ts.map +1 -1
- package/dist/init/client.js +3 -2
- package/dist/init/server.d.ts +7 -6
- package/dist/init/server.d.ts.map +1 -1
- package/dist/init/server.js +6 -6
- package/dist/loadData/Globals.d.ts +3 -3
- package/dist/loadData/Globals.js +3 -3
- package/dist/loadData/loadData.d.ts +8 -18
- package/dist/loadData/loadData.d.ts.map +1 -1
- package/dist/loadData/loadData.js +2 -2
- package/dist/node/index.d.ts +5 -0
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +84 -35
- package/dist/plugins/Events.d.ts +4 -4
- package/dist/plugins/Plugins.d.ts +2 -2
- package/dist/plugins/index.d.ts +2 -3
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +2 -1
- package/dist/queries/Queries.d.ts +9 -0
- package/dist/queries/Queries.d.ts.map +1 -1
- package/dist/queries/Queries.js +29 -17
- package/dist/queries/QueryError.d.ts +2 -0
- package/dist/queries/QueryError.d.ts.map +1 -1
- package/dist/queries/QueryError.js +6 -1
- package/dist/queries/gql.d.ts +2 -2
- package/dist/queries/gql.js +2 -2
- package/dist/queries/index.d.ts +7 -5
- package/dist/queries/index.d.ts.map +1 -1
- package/dist/queries/vars.d.ts +7 -7
- package/dist/queries/vars.d.ts.map +1 -1
- package/dist/queries/vars.js +10 -8
- package/dist/routing/LoadRunner.d.ts +1 -1
- package/dist/routing/LoadRunner.js +1 -1
- package/dist/routing/index.d.ts +4 -4
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/route/BaseRoute.d.ts +25 -25
- package/dist/routing/route/BaseRoute.js +24 -24
- package/dist/routing/route/Request.d.ts +4 -4
- package/dist/routing/route/Request.js +4 -4
- package/dist/routing/route/Route.d.ts +2 -2
- package/dist/routing/route/Route.js +2 -2
- package/dist/routing/router/BaseRouter.d.ts +4 -4
- package/dist/routing/router/BaseRouter.js +3 -3
- package/dist/routing/router/ClientRouter.d.ts +1 -1
- package/dist/routing/router/ClientRouter.js +1 -1
- package/dist/routing/router/Router.d.ts +27 -25
- package/dist/routing/router/Router.d.ts.map +1 -1
- package/dist/routing/router/Router.js +24 -21
- package/dist/routing/router/ServerRouter.d.ts +1 -1
- package/dist/routing/router/ServerRouter.js +1 -1
- package/dist/server/CrelteServer.d.ts +5 -5
- package/dist/server/CrelteServer.d.ts.map +1 -1
- package/dist/server/CrelteServer.js +4 -4
- package/dist/server/Request.d.ts +7 -1
- package/dist/server/Request.d.ts.map +1 -1
- package/dist/server/Request.js +7 -1
- package/dist/server/ServerRouter.d.ts +1 -1
- package/dist/server/ServerRouter.d.ts.map +1 -1
- package/dist/server/index.d.ts +4 -4
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/shared.d.ts +7 -13
- package/dist/server/shared.d.ts.map +1 -1
- package/dist/server/shared.js +14 -16
- package/dist/ssr/SsrCache.d.ts +56 -4
- package/dist/ssr/SsrCache.d.ts.map +1 -1
- package/dist/ssr/SsrCache.js +94 -20
- package/dist/std/index.d.ts +13 -0
- package/dist/std/index.d.ts.map +1 -1
- package/dist/std/index.js +13 -0
- package/dist/std/rand/index.d.ts +34 -0
- package/dist/std/rand/index.d.ts.map +1 -0
- package/dist/std/rand/index.js +45 -0
- package/dist/std/rand/internal.d.ts +8 -0
- package/dist/std/rand/internal.d.ts.map +1 -0
- package/dist/std/rand/internal.js +15 -0
- package/dist/std/stores/Writable.d.ts +1 -1
- package/dist/std/stores/Writable.js +1 -1
- package/dist/translations/index.d.ts +28 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/translations/index.js +31 -0
- package/dist/translations/loadTranslations.d.ts +23 -0
- package/dist/translations/loadTranslations.d.ts.map +1 -0
- package/dist/translations/loadTranslations.js +26 -0
- package/dist/translations/loader/GlobalLoader.d.ts +34 -0
- package/dist/translations/loader/GlobalLoader.d.ts.map +1 -0
- package/dist/translations/loader/GlobalLoader.js +45 -0
- package/dist/translations/loader/fileLoader/ClientFileLoader.d.ts +10 -0
- package/dist/translations/loader/fileLoader/ClientFileLoader.d.ts.map +1 -0
- package/dist/translations/loader/fileLoader/ClientFileLoader.js +24 -0
- package/dist/translations/loader/fileLoader/NodeFileLoader.d.ts +9 -0
- package/dist/translations/loader/fileLoader/NodeFileLoader.d.ts.map +1 -0
- package/dist/translations/loader/fileLoader/NodeFileLoader.js +21 -0
- package/dist/translations/loader/fileLoader/fileLoader.d.ts +5 -0
- package/dist/translations/loader/fileLoader/fileLoader.d.ts.map +1 -0
- package/dist/translations/loader/fileLoader/fileLoader.js +16 -0
- package/dist/translations/loader/index.d.ts +7 -0
- package/dist/translations/loader/index.d.ts.map +1 -0
- package/dist/translations/loader/index.js +1 -0
- package/dist/translations/translationsPlugin.d.ts +64 -0
- package/dist/translations/translationsPlugin.d.ts.map +1 -0
- package/dist/translations/translationsPlugin.js +110 -0
- package/dist/translations/utils.d.ts +8 -0
- package/dist/translations/utils.d.ts.map +1 -0
- package/dist/translations/utils.js +15 -0
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +30 -38
- package/package.json +9 -1
- package/src/blocks/Blocks.svelte +3 -78
- package/src/blocks/Blocks.ts +63 -6
- package/src/blocks/index.ts +2 -2
- package/src/cookies/ServerCookies.ts +1 -1
- package/src/cookies/index.ts +1 -1
- package/src/crelte.ts +21 -10
- package/src/index.ts +19 -14
- package/src/init/client.ts +3 -2
- package/src/init/server.ts +14 -8
- package/src/loadData/Globals.ts +3 -3
- package/src/loadData/loadData.ts +8 -18
- package/src/node/index.ts +100 -39
- package/src/plugins/Events.ts +4 -4
- package/src/plugins/Plugins.ts +2 -2
- package/src/plugins/index.ts +2 -3
- package/src/queries/Queries.ts +35 -18
- package/src/queries/QueryError.ts +10 -1
- package/src/queries/gql.ts +2 -2
- package/src/queries/index.ts +7 -4
- package/src/queries/vars.ts +12 -8
- package/src/routing/LoadRunner.ts +1 -1
- package/src/routing/index.ts +13 -3
- package/src/routing/route/BaseRoute.ts +25 -25
- package/src/routing/route/Request.ts +4 -4
- package/src/routing/route/Route.ts +2 -2
- package/src/routing/router/BaseRouter.ts +4 -4
- package/src/routing/router/ClientRouter.ts +1 -1
- package/src/routing/router/Router.ts +28 -25
- package/src/routing/router/ServerRouter.ts +1 -1
- package/src/server/CrelteServer.ts +5 -5
- package/src/server/Request.ts +7 -1
- package/src/server/ServerRouter.ts +1 -2
- package/src/server/index.ts +17 -3
- package/src/server/shared.ts +28 -33
- package/src/ssr/SsrCache.ts +104 -22
- package/src/std/index.ts +14 -0
- package/src/std/rand/index.ts +55 -0
- package/src/std/rand/internal.ts +17 -0
- package/src/std/stores/Writable.ts +1 -1
- package/src/translations/index.ts +56 -0
- package/src/translations/loadTranslations.ts +33 -0
- package/src/translations/loader/GlobalLoader.ts +62 -0
- package/src/translations/loader/fileLoader/ClientFileLoader.ts +40 -0
- package/src/translations/loader/fileLoader/NodeFileLoader.ts +32 -0
- package/src/translations/loader/fileLoader/fileLoader.ts +19 -0
- package/src/translations/loader/index.ts +8 -0
- package/src/translations/translationsPlugin.ts +145 -0
- package/src/translations/utils.ts +17 -0
- package/src/vite/index.ts +43 -39
|
@@ -70,12 +70,12 @@ export default class Request extends BaseRoute {
|
|
|
70
70
|
* With delayRender you can make sure that the render waits
|
|
71
71
|
* until you are ready. This is useful for building page transitions.
|
|
72
72
|
*
|
|
73
|
-
*
|
|
73
|
+
* #### Important
|
|
74
74
|
* If you call delayRender you need to call `ready/remove` or the render
|
|
75
75
|
* will never happen
|
|
76
76
|
*
|
|
77
|
-
*
|
|
78
|
-
* ```
|
|
77
|
+
* #### Example
|
|
78
|
+
* ```js
|
|
79
79
|
* import { onRequest } from 'crelte';
|
|
80
80
|
* import { animate } from 'motion';
|
|
81
81
|
*
|
|
@@ -110,7 +110,7 @@ export default class Request extends BaseRoute {
|
|
|
110
110
|
/**
|
|
111
111
|
* Create a Route from the Request
|
|
112
112
|
*
|
|
113
|
-
*
|
|
113
|
+
* #### Throws
|
|
114
114
|
* if the entry, template or loadedData is missing
|
|
115
115
|
* or the request was cancelled
|
|
116
116
|
*/
|
|
@@ -75,12 +75,12 @@ export default class Request extends BaseRoute {
|
|
|
75
75
|
* With delayRender you can make sure that the render waits
|
|
76
76
|
* until you are ready. This is useful for building page transitions.
|
|
77
77
|
*
|
|
78
|
-
*
|
|
78
|
+
* #### Important
|
|
79
79
|
* If you call delayRender you need to call `ready/remove` or the render
|
|
80
80
|
* will never happen
|
|
81
81
|
*
|
|
82
|
-
*
|
|
83
|
-
* ```
|
|
82
|
+
* #### Example
|
|
83
|
+
* ```js
|
|
84
84
|
* import { onRequest } from 'crelte';
|
|
85
85
|
* import { animate } from 'motion';
|
|
86
86
|
*
|
|
@@ -139,7 +139,7 @@ export default class Request extends BaseRoute {
|
|
|
139
139
|
/**
|
|
140
140
|
* Create a Route from the Request
|
|
141
141
|
*
|
|
142
|
-
*
|
|
142
|
+
* #### Throws
|
|
143
143
|
* if the entry, template or loadedData is missing
|
|
144
144
|
* or the request was cancelled
|
|
145
145
|
*/
|
|
@@ -37,14 +37,14 @@ export default class Route extends BaseRoute {
|
|
|
37
37
|
/**
|
|
38
38
|
* Create a new Route
|
|
39
39
|
*
|
|
40
|
-
*
|
|
40
|
+
* #### Note
|
|
41
41
|
* This should only be created by crelte
|
|
42
42
|
*/
|
|
43
43
|
constructor(url: string | URL, site: Site, entry: Entry, template: TemplateModule, loadedData: Record<string, any>, opts?: RouteOptions);
|
|
44
44
|
/**
|
|
45
45
|
* Create a copy of the EntryRoute
|
|
46
46
|
*
|
|
47
|
-
*
|
|
47
|
+
* #### Note
|
|
48
48
|
* This does not make a copy of the entry, template or loadedData.
|
|
49
49
|
*/
|
|
50
50
|
clone(): Route;
|
|
@@ -25,7 +25,7 @@ export default class Route extends BaseRoute {
|
|
|
25
25
|
/**
|
|
26
26
|
* Create a new Route
|
|
27
27
|
*
|
|
28
|
-
*
|
|
28
|
+
* #### Note
|
|
29
29
|
* This should only be created by crelte
|
|
30
30
|
*/
|
|
31
31
|
constructor(url, site, entry, template, loadedData, opts = {}) {
|
|
@@ -38,7 +38,7 @@ export default class Route extends BaseRoute {
|
|
|
38
38
|
/**
|
|
39
39
|
* Create a copy of the EntryRoute
|
|
40
40
|
*
|
|
41
|
-
*
|
|
41
|
+
* #### Note
|
|
42
42
|
* This does not make a copy of the entry, template or loadedData.
|
|
43
43
|
*/
|
|
44
44
|
clone() {
|
|
@@ -17,14 +17,14 @@ export default class BaseRouter {
|
|
|
17
17
|
/**
|
|
18
18
|
* The current route
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* #### Note
|
|
21
21
|
* Will always contain a route except in the first loadData call
|
|
22
22
|
*/
|
|
23
23
|
route: Writable<Route | null>;
|
|
24
24
|
/**
|
|
25
25
|
* The current site
|
|
26
26
|
*
|
|
27
|
-
*
|
|
27
|
+
* #### Note
|
|
28
28
|
* Will always contain a site except in the first loadData call
|
|
29
29
|
*/
|
|
30
30
|
site: Writable<Site | null>;
|
|
@@ -55,7 +55,7 @@ export default class BaseRouter {
|
|
|
55
55
|
onRouteListeners: Listeners<[Route]>;
|
|
56
56
|
onRender: (cr: CrelteRequest,
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* #### Throws
|
|
59
59
|
* if the route is missing entry, template or loadedData
|
|
60
60
|
*/
|
|
61
61
|
readyForRoute: () => Route, domUpdated: (cr: CrelteRequest, route: Route) => void) => Promise<Route> | Route;
|
|
@@ -103,7 +103,7 @@ export default class BaseRouter {
|
|
|
103
103
|
preload(target: string | URL | Route | Request): Promise<void>;
|
|
104
104
|
cancelRequest(): void;
|
|
105
105
|
/**
|
|
106
|
-
*
|
|
106
|
+
* #### Throws
|
|
107
107
|
* If the request completed but had an error
|
|
108
108
|
*/
|
|
109
109
|
handleRequest(req: Request, updateHistory: (route: Route) => void): Promise<Route | void>;
|
|
@@ -16,7 +16,7 @@ export default class BaseRouter {
|
|
|
16
16
|
/**
|
|
17
17
|
* The current route
|
|
18
18
|
*
|
|
19
|
-
*
|
|
19
|
+
* #### Note
|
|
20
20
|
* Will always contain a route except in the first loadData call
|
|
21
21
|
*/
|
|
22
22
|
route;
|
|
@@ -24,7 +24,7 @@ export default class BaseRouter {
|
|
|
24
24
|
/**
|
|
25
25
|
* The current site
|
|
26
26
|
*
|
|
27
|
-
*
|
|
27
|
+
* #### Note
|
|
28
28
|
* Will always contain a site except in the first loadData call
|
|
29
29
|
*/
|
|
30
30
|
site;
|
|
@@ -190,7 +190,7 @@ export default class BaseRouter {
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
/**
|
|
193
|
-
*
|
|
193
|
+
* #### Throws
|
|
194
194
|
* If the request completed but had an error
|
|
195
195
|
*/
|
|
196
196
|
async handleRequest(req, updateHistory) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import BaseRouter from './BaseRouter.js';
|
|
2
1
|
import { Request, RequestOptions, Route, Site } from '../index.js';
|
|
3
2
|
import { CrelteRequest } from '../../crelte.js';
|
|
4
3
|
import { Readable } from '../../std/stores/index.js';
|
|
@@ -8,20 +7,23 @@ import { Entry } from '../../loadData/index.js';
|
|
|
8
7
|
*
|
|
9
8
|
* If you return `false` the request will be aborted
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
* ```
|
|
10
|
+
* #### Example
|
|
11
|
+
* ```js
|
|
13
12
|
* router.replace(req => (req.hash = ''));
|
|
14
13
|
* ```
|
|
15
14
|
*/
|
|
16
15
|
export type UpdateRequest = (req: Request) => boolean | null | undefined | void;
|
|
16
|
+
/**
|
|
17
|
+
* The Crelte Router
|
|
18
|
+
*/
|
|
17
19
|
export default class Router {
|
|
18
20
|
private inner;
|
|
19
21
|
private _request;
|
|
20
|
-
constructor(inner:
|
|
22
|
+
constructor(inner: any);
|
|
21
23
|
/**
|
|
22
24
|
* returns a store with the current route
|
|
23
25
|
*
|
|
24
|
-
*
|
|
26
|
+
* #### Note
|
|
25
27
|
* Will always contain a route except in the first loadData call this
|
|
26
28
|
* is intentional since you will get the wrong route in a loadData call.
|
|
27
29
|
* In a loadData you should always use the `CrelteRequest` provided
|
|
@@ -31,10 +33,10 @@ export default class Router {
|
|
|
31
33
|
/**
|
|
32
34
|
* returns a store with the current site
|
|
33
35
|
*
|
|
34
|
-
*
|
|
36
|
+
* #### Note
|
|
35
37
|
* Will always contain a site except in the first loadData call this
|
|
36
38
|
* is intentional since you might get the wrong site if a site switch
|
|
37
|
-
* is happening and you call this in loadData. If possible use the CrelteRequest
|
|
39
|
+
* is happening and you call this in loadData. If possible use the {@link CrelteRequest#site}
|
|
38
40
|
* provided in each loadData call.
|
|
39
41
|
*
|
|
40
42
|
* Else use `router.site.get() ?? router.req.site`
|
|
@@ -43,7 +45,7 @@ export default class Router {
|
|
|
43
45
|
/**
|
|
44
46
|
* returns a store with the current entry
|
|
45
47
|
*
|
|
46
|
-
*
|
|
48
|
+
* #### Note
|
|
47
49
|
* Will always contain an entry except in the first loadData call this
|
|
48
50
|
* is intentional since you might get the wrong entry if a request is happening
|
|
49
51
|
* and you call this in loadData. If possible use the CrelteRequest
|
|
@@ -53,8 +55,8 @@ export default class Router {
|
|
|
53
55
|
/**
|
|
54
56
|
* returns the latest request in progress otherwise returns null.
|
|
55
57
|
*
|
|
56
|
-
*
|
|
57
|
-
* If at all possible prefer using the
|
|
58
|
+
* #### Important !!
|
|
59
|
+
* If at all possible prefer using the {@link CrelteRequest} provided in each
|
|
58
60
|
* loadData call. For example in a preload request this will return null.
|
|
59
61
|
* Or a user has clicked multiple times on different links you might get
|
|
60
62
|
* the url of the newer request.
|
|
@@ -83,7 +85,7 @@ export default class Router {
|
|
|
83
85
|
*/
|
|
84
86
|
primarySite(): Site;
|
|
85
87
|
/**
|
|
86
|
-
* Returns a site which is
|
|
88
|
+
* Returns a site which is preferred based on the users language
|
|
87
89
|
*
|
|
88
90
|
* Returns null if no site could be determined
|
|
89
91
|
*/
|
|
@@ -95,11 +97,11 @@ export default class Router {
|
|
|
95
97
|
* the url needs to start with http or with a / which will be considered as
|
|
96
98
|
* the site baseUrl
|
|
97
99
|
*
|
|
98
|
-
*
|
|
100
|
+
* #### Note
|
|
99
101
|
* The origin will always be set to 'manual'
|
|
100
102
|
*
|
|
101
|
-
*
|
|
102
|
-
* ```
|
|
103
|
+
* #### Example
|
|
104
|
+
* ```js
|
|
103
105
|
* import { getRouter } from 'crelte';
|
|
104
106
|
*
|
|
105
107
|
* const router = getRouter();
|
|
@@ -116,13 +118,13 @@ export default class Router {
|
|
|
116
118
|
* You can use this when using pagination for example change the route object
|
|
117
119
|
* (search argument) and then call push
|
|
118
120
|
*
|
|
119
|
-
*
|
|
121
|
+
* #### Note
|
|
120
122
|
* This will always set the origin to 'push'
|
|
121
123
|
* And will clear the scrollY value if you dont provide a new one via the `opts`
|
|
122
124
|
* This will disableLoadData by default if you dont provide an override via the `opts`
|
|
123
125
|
*
|
|
124
|
-
*
|
|
125
|
-
* ```
|
|
126
|
+
* #### Example using the update function
|
|
127
|
+
* ```js
|
|
126
128
|
* import { getRouter } from 'crelte';
|
|
127
129
|
*
|
|
128
130
|
* const router = getRouter();
|
|
@@ -131,8 +133,8 @@ export default class Router {
|
|
|
131
133
|
* router.push(req => req.setSearchParam('page', page || null));
|
|
132
134
|
* ```
|
|
133
135
|
*
|
|
134
|
-
*
|
|
135
|
-
* ```
|
|
136
|
+
* #### Example using the route object
|
|
137
|
+
* ```js
|
|
136
138
|
* import { getRouter } from 'crelte';
|
|
137
139
|
*
|
|
138
140
|
* const router = getRouter();
|
|
@@ -153,13 +155,13 @@ export default class Router {
|
|
|
153
155
|
*
|
|
154
156
|
* You can use this when using some filters for example a search filter
|
|
155
157
|
*
|
|
156
|
-
*
|
|
158
|
+
* #### Note
|
|
157
159
|
* This will always set the origin to 'replace'
|
|
158
160
|
* And will clear the scrollY value if you don't provide a new one via the `opts`
|
|
159
161
|
* This will disableLoadData by default if you don't provide an override via the `opts`
|
|
160
162
|
*
|
|
161
|
-
*
|
|
162
|
-
* ```
|
|
163
|
+
* #### Example using the update function
|
|
164
|
+
* ```js
|
|
163
165
|
* import { getRouter } from 'crelte';
|
|
164
166
|
*
|
|
165
167
|
* const router = getRouter();
|
|
@@ -168,8 +170,8 @@ export default class Router {
|
|
|
168
170
|
* router.replace(req => req.setSearchParam('search', search));
|
|
169
171
|
* ```
|
|
170
172
|
*
|
|
171
|
-
*
|
|
172
|
-
* ```
|
|
173
|
+
* #### Example using the route object
|
|
174
|
+
* ```js
|
|
173
175
|
* import { getRouter } from 'crelte';
|
|
174
176
|
*
|
|
175
177
|
* const router = getRouter();
|
|
@@ -223,7 +225,7 @@ export default class Router {
|
|
|
223
225
|
* Resolve a url or Route and convert it to a Request
|
|
224
226
|
*
|
|
225
227
|
* @param target
|
|
226
|
-
* @param opts
|
|
228
|
+
* @param opts any option present will override the value in target
|
|
227
229
|
* @return Returns null if the url does not match our host (the protocol get's ignored)
|
|
228
230
|
*/
|
|
229
231
|
targetToRequest(target: string | URL | Route | Request, opts?: RequestOptions): Request;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../../src/routing/router/Router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../../src/routing/router/Router.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;AAEhF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IAC1B,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,QAAQ,CAAiB;gBAErB,KAAK,EAAE,GAAG;IAKtB;;;;;;;;OAQG;IACH,IAAI,KAAK,IAAI,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,CAElC;IAED;;;;;;;;;;OAUG;IACH,IAAI,IAAI,IAAI,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,CAEhC;IAED;;;;;;;;OAQG;IACH,IAAI,KAAK,IAAI,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,CAElC;IAED;;;;;;;;OAQG;IACH,IAAI,GAAG,IAAI,OAAO,GAAG,IAAI,CAMxB;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,IAAI,EAAE,CAElB;IAED;;;;OAIG;IACH,IAAI,kBAAkB,IAAI,MAAM,EAAE,CAEjC;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,CAE/B;IAED;;OAEG;IACH,IAAI,eAAe,IAAI,QAAQ,CAAC,MAAM,CAAC,CAEtC;IAED;;OAEG;IACH,W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CAGjB"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Crelte Router
|
|
3
|
+
*/
|
|
1
4
|
export default class Router {
|
|
2
5
|
inner;
|
|
3
6
|
_request;
|
|
@@ -8,7 +11,7 @@ export default class Router {
|
|
|
8
11
|
/**
|
|
9
12
|
* returns a store with the current route
|
|
10
13
|
*
|
|
11
|
-
*
|
|
14
|
+
* #### Note
|
|
12
15
|
* Will always contain a route except in the first loadData call this
|
|
13
16
|
* is intentional since you will get the wrong route in a loadData call.
|
|
14
17
|
* In a loadData you should always use the `CrelteRequest` provided
|
|
@@ -20,10 +23,10 @@ export default class Router {
|
|
|
20
23
|
/**
|
|
21
24
|
* returns a store with the current site
|
|
22
25
|
*
|
|
23
|
-
*
|
|
26
|
+
* #### Note
|
|
24
27
|
* Will always contain a site except in the first loadData call this
|
|
25
28
|
* is intentional since you might get the wrong site if a site switch
|
|
26
|
-
* is happening and you call this in loadData. If possible use the CrelteRequest
|
|
29
|
+
* is happening and you call this in loadData. If possible use the {@link CrelteRequest#site}
|
|
27
30
|
* provided in each loadData call.
|
|
28
31
|
*
|
|
29
32
|
* Else use `router.site.get() ?? router.req.site`
|
|
@@ -34,7 +37,7 @@ export default class Router {
|
|
|
34
37
|
/**
|
|
35
38
|
* returns a store with the current entry
|
|
36
39
|
*
|
|
37
|
-
*
|
|
40
|
+
* #### Note
|
|
38
41
|
* Will always contain an entry except in the first loadData call this
|
|
39
42
|
* is intentional since you might get the wrong entry if a request is happening
|
|
40
43
|
* and you call this in loadData. If possible use the CrelteRequest
|
|
@@ -46,8 +49,8 @@ export default class Router {
|
|
|
46
49
|
/**
|
|
47
50
|
* returns the latest request in progress otherwise returns null.
|
|
48
51
|
*
|
|
49
|
-
*
|
|
50
|
-
* If at all possible prefer using the
|
|
52
|
+
* #### Important !!
|
|
53
|
+
* If at all possible prefer using the {@link CrelteRequest} provided in each
|
|
51
54
|
* loadData call. For example in a preload request this will return null.
|
|
52
55
|
* Or a user has clicked multiple times on different links you might get
|
|
53
56
|
* the url of the newer request.
|
|
@@ -92,7 +95,7 @@ export default class Router {
|
|
|
92
95
|
return this.inner.primarySite();
|
|
93
96
|
}
|
|
94
97
|
/**
|
|
95
|
-
* Returns a site which is
|
|
98
|
+
* Returns a site which is preferred based on the users language
|
|
96
99
|
*
|
|
97
100
|
* Returns null if no site could be determined
|
|
98
101
|
*/
|
|
@@ -106,11 +109,11 @@ export default class Router {
|
|
|
106
109
|
* the url needs to start with http or with a / which will be considered as
|
|
107
110
|
* the site baseUrl
|
|
108
111
|
*
|
|
109
|
-
*
|
|
112
|
+
* #### Note
|
|
110
113
|
* The origin will always be set to 'manual'
|
|
111
114
|
*
|
|
112
|
-
*
|
|
113
|
-
* ```
|
|
115
|
+
* #### Example
|
|
116
|
+
* ```js
|
|
114
117
|
* import { getRouter } from 'crelte';
|
|
115
118
|
*
|
|
116
119
|
* const router = getRouter();
|
|
@@ -145,13 +148,13 @@ export default class Router {
|
|
|
145
148
|
* You can use this when using pagination for example change the route object
|
|
146
149
|
* (search argument) and then call push
|
|
147
150
|
*
|
|
148
|
-
*
|
|
151
|
+
* #### Note
|
|
149
152
|
* This will always set the origin to 'push'
|
|
150
153
|
* And will clear the scrollY value if you dont provide a new one via the `opts`
|
|
151
154
|
* This will disableLoadData by default if you dont provide an override via the `opts`
|
|
152
155
|
*
|
|
153
|
-
*
|
|
154
|
-
* ```
|
|
156
|
+
* #### Example using the update function
|
|
157
|
+
* ```js
|
|
155
158
|
* import { getRouter } from 'crelte';
|
|
156
159
|
*
|
|
157
160
|
* const router = getRouter();
|
|
@@ -160,8 +163,8 @@ export default class Router {
|
|
|
160
163
|
* router.push(req => req.setSearchParam('page', page || null));
|
|
161
164
|
* ```
|
|
162
165
|
*
|
|
163
|
-
*
|
|
164
|
-
* ```
|
|
166
|
+
* #### Example using the route object
|
|
167
|
+
* ```js
|
|
165
168
|
* import { getRouter } from 'crelte';
|
|
166
169
|
*
|
|
167
170
|
* const router = getRouter();
|
|
@@ -204,13 +207,13 @@ export default class Router {
|
|
|
204
207
|
*
|
|
205
208
|
* You can use this when using some filters for example a search filter
|
|
206
209
|
*
|
|
207
|
-
*
|
|
210
|
+
* #### Note
|
|
208
211
|
* This will always set the origin to 'replace'
|
|
209
212
|
* And will clear the scrollY value if you don't provide a new one via the `opts`
|
|
210
213
|
* This will disableLoadData by default if you don't provide an override via the `opts`
|
|
211
214
|
*
|
|
212
|
-
*
|
|
213
|
-
* ```
|
|
215
|
+
* #### Example using the update function
|
|
216
|
+
* ```js
|
|
214
217
|
* import { getRouter } from 'crelte';
|
|
215
218
|
*
|
|
216
219
|
* const router = getRouter();
|
|
@@ -219,8 +222,8 @@ export default class Router {
|
|
|
219
222
|
* router.replace(req => req.setSearchParam('search', search));
|
|
220
223
|
* ```
|
|
221
224
|
*
|
|
222
|
-
*
|
|
223
|
-
* ```
|
|
225
|
+
* #### Example using the route object
|
|
226
|
+
* ```js
|
|
224
227
|
* import { getRouter } from 'crelte';
|
|
225
228
|
*
|
|
226
229
|
* const router = getRouter();
|
|
@@ -306,7 +309,7 @@ export default class Router {
|
|
|
306
309
|
* Resolve a url or Route and convert it to a Request
|
|
307
310
|
*
|
|
308
311
|
* @param target
|
|
309
|
-
* @param opts
|
|
312
|
+
* @param opts any option present will override the value in target
|
|
310
313
|
* @return Returns null if the url does not match our host (the protocol get's ignored)
|
|
311
314
|
*/
|
|
312
315
|
targetToRequest(target, opts = {}) {
|
|
@@ -11,7 +11,7 @@ export type CrelteServerRequestOptions = {
|
|
|
11
11
|
};
|
|
12
12
|
export default class CrelteServerRequest {
|
|
13
13
|
/**
|
|
14
|
-
* The current request
|
|
14
|
+
* The current request {@link ServerRequest}
|
|
15
15
|
*/
|
|
16
16
|
req: ServerRequest;
|
|
17
17
|
private _env;
|
|
@@ -19,12 +19,12 @@ export default class CrelteServerRequest {
|
|
|
19
19
|
private _sites;
|
|
20
20
|
private _langs;
|
|
21
21
|
private _queries;
|
|
22
|
-
|
|
22
|
+
private _cookies;
|
|
23
23
|
constructor(req: ServerRequest, opts: CrelteServerRequestOptions);
|
|
24
24
|
/**
|
|
25
25
|
* Easy access to this.req.site
|
|
26
26
|
*
|
|
27
|
-
*
|
|
27
|
+
* #### Note
|
|
28
28
|
* The site might not always match with the current route
|
|
29
29
|
* but be the site default site or one that matches the
|
|
30
30
|
* users language.
|
|
@@ -56,14 +56,14 @@ export default class CrelteServerRequest {
|
|
|
56
56
|
/**
|
|
57
57
|
* returns the frontend url with an optional path
|
|
58
58
|
*
|
|
59
|
-
*
|
|
59
|
+
* #### Note
|
|
60
60
|
* For the origin the `FRONTEND_URL` env variable is used
|
|
61
61
|
*/
|
|
62
62
|
frontendUrl(path?: string): URL;
|
|
63
63
|
/**
|
|
64
64
|
* returns the backend url with an optional path
|
|
65
65
|
*
|
|
66
|
-
*
|
|
66
|
+
* #### Note
|
|
67
67
|
* For the origin the `ENDPOINT_URL` env variable is used
|
|
68
68
|
*/
|
|
69
69
|
backendUrl(path?: string): URL;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrelteServer.d.ts","sourceRoot":"","sources":["../../src/server/CrelteServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAW,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,aAAa,MAAM,cAAc,CAAC;AAEzC,MAAM,MAAM,0BAA0B,GAAG;IACxC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,CAAC,OAAO,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AAO,CAErB;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,IAAI,EAAE,CAElB;IAED;;OAEG;IACH,IAAI,kBAAkB,IAAI,MAAM,EAAE,CAEjC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM;IACpC,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM;IACrC,MAAM,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM;IACpC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAKnC;;;;;OAKG;IACH,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG;IAI/B;;;;;OAKG;IACH,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG;IAI9B;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;;;OAIG;IACH,aAAa,IAAI,IAAI,GAAG,IAAI;IAI5B;;;;;;;OAOG;IACG,KAAK,CACV,KAAK,EAAE,KAAK,EACZ,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACvC,IAAI,GAAE,YAAiB,GACrB,OAAO,CAAC,OAAO,CAAC;IAInB,cAAc;IACd,gBAAgB,CAAC,IAAI,EAAE,QAAQ;CAG/B"}
|
|
@@ -3,7 +3,7 @@ import { Request } from '../routing/index.js';
|
|
|
3
3
|
import { urlWithPath } from '../utils.js';
|
|
4
4
|
export default class CrelteServerRequest {
|
|
5
5
|
/**
|
|
6
|
-
* The current request
|
|
6
|
+
* The current request {@link ServerRequest}
|
|
7
7
|
*/
|
|
8
8
|
req;
|
|
9
9
|
_env;
|
|
@@ -24,7 +24,7 @@ export default class CrelteServerRequest {
|
|
|
24
24
|
/**
|
|
25
25
|
* Easy access to this.req.site
|
|
26
26
|
*
|
|
27
|
-
*
|
|
27
|
+
* #### Note
|
|
28
28
|
* The site might not always match with the current route
|
|
29
29
|
* but be the site default site or one that matches the
|
|
30
30
|
* users language.
|
|
@@ -62,7 +62,7 @@ export default class CrelteServerRequest {
|
|
|
62
62
|
/**
|
|
63
63
|
* returns the frontend url with an optional path
|
|
64
64
|
*
|
|
65
|
-
*
|
|
65
|
+
* #### Note
|
|
66
66
|
* For the origin the `FRONTEND_URL` env variable is used
|
|
67
67
|
*/
|
|
68
68
|
frontendUrl(path) {
|
|
@@ -71,7 +71,7 @@ export default class CrelteServerRequest {
|
|
|
71
71
|
/**
|
|
72
72
|
* returns the backend url with an optional path
|
|
73
73
|
*
|
|
74
|
-
*
|
|
74
|
+
* #### Note
|
|
75
75
|
* For the origin the `ENDPOINT_URL` env variable is used
|
|
76
76
|
*/
|
|
77
77
|
backendUrl(path) {
|
package/dist/server/Request.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { Site } from '../routing/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Extended Request class for server requests
|
|
4
|
+
*
|
|
5
|
+
* This extends the WebApi [Request](https://developer.mozilla.org/docs/Web/API/Request)
|
|
6
|
+
* and adds three properties {@link site}, {@link getParam} and {@link siteMatches}.
|
|
7
|
+
*/
|
|
2
8
|
export default class ServerRequest extends Request {
|
|
3
9
|
private params;
|
|
4
10
|
/**
|
|
5
11
|
* The site of the route
|
|
6
12
|
*
|
|
7
|
-
*
|
|
13
|
+
* #### Note
|
|
8
14
|
* The site might not always match with the current route
|
|
9
15
|
* but be the site default site or one that matches the
|
|
10
16
|
* users language.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../src/server/Request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IACjD,OAAO,CAAC,MAAM,CAAsB;IAEpC;;;;;;;;;OASG;IACH,IAAI,EAAE,IAAI,CAAC;gBAEC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI;IAOnE;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIrC;;OAEG;IACH,WAAW,IAAI,OAAO;CAUtB"}
|
|
1
|
+
{"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../src/server/Request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IACjD,OAAO,CAAC,MAAM,CAAsB;IAEpC;;;;;;;;;OASG;IACH,IAAI,EAAE,IAAI,CAAC;gBAEC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI;IAOnE;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIrC;;OAEG;IACH,WAAW,IAAI,OAAO;CAUtB"}
|
package/dist/server/Request.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extended Request class for server requests
|
|
3
|
+
*
|
|
4
|
+
* This extends the WebApi [Request](https://developer.mozilla.org/docs/Web/API/Request)
|
|
5
|
+
* and adds three properties {@link site}, {@link getParam} and {@link siteMatches}.
|
|
6
|
+
*/
|
|
1
7
|
export default class ServerRequest extends Request {
|
|
2
8
|
params;
|
|
3
9
|
/**
|
|
4
10
|
* The site of the route
|
|
5
11
|
*
|
|
6
|
-
*
|
|
12
|
+
* #### Note
|
|
7
13
|
* The site might not always match with the current route
|
|
8
14
|
* but be the site default site or one that matches the
|
|
9
15
|
* users language.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Methods, Pattern } from 'trouter';
|
|
2
2
|
import CrelteServerRequest from './CrelteServer.js';
|
|
3
|
-
import { SiteFromGraphQl } from './shared.js';
|
|
4
3
|
import { Query, QueryOptions } from '../queries/index.js';
|
|
5
4
|
import { Site } from '../routing/index.js';
|
|
5
|
+
import { SiteFromGraphQl } from '../routing/Site.js';
|
|
6
6
|
export type Handler = (csr: CrelteServerRequest) => Promise<Response | null | undefined> | Response | null | undefined;
|
|
7
7
|
export type RouterOptions = {
|
|
8
8
|
endpointToken?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerRouter.d.ts","sourceRoot":"","sources":["../../src/server/ServerRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAW,MAAM,SAAS,CAAC;AACpD,OAAO,mBAAmB,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ServerRouter.d.ts","sourceRoot":"","sources":["../../src/server/ServerRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAW,MAAM,SAAS,CAAC;AACpD,OAAO,mBAAmB,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAW,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG3C,OAAO,EAAE,eAAe,EAAe,MAAM,oBAAoB,CAAC;AAGlE,MAAM,MAAM,OAAO,GAAG,CACrB,GAAG,EAAE,mBAAmB,KACpB,OAAO,CAAC,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC;AAExE,MAAM,MAAM,aAAa,GAAG;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,YAAY;IAChC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,GAAG,CAAsB;IACj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K,IAAI,CAAC;IACzD,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAExD;;OAEG;IACH,IAAI,KAAK,IAAI,IAAI,EAAE,CAElB;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM;IACpC,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM;IACrC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAKnC;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;;;;;;OAOG;IACG,KAAK,CACV,KAAK,EAAE,KAAK,EACZ,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACvC,IAAI,GAAE,YAAiB,GACrB,OAAO,CAAC,OAAO,CAAC;IAKnB,cAAc;IACR,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;CAkDtD"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ServerRequest from './Request.js';
|
|
2
|
-
import ServerRouter, { Handler } from './ServerRouter.js';
|
|
3
|
-
import CrelteServerRequest from './CrelteServer.js';
|
|
4
|
-
export { type ServerData, type MainData, main, type Error, type MainErrorData, mainError, } from '../init/server.js';
|
|
5
|
-
export { CrelteServerRequest, ServerRouter,
|
|
2
|
+
import ServerRouter, { type RouterOptions, type Handler } from './ServerRouter.js';
|
|
3
|
+
import CrelteServerRequest, { type CrelteServerRequestOptions } from './CrelteServer.js';
|
|
4
|
+
export { type ServerData, type RenderRequest, type RenderResponse, type MainData, main, type Error, type MainErrorData, mainError, } from '../init/server.js';
|
|
5
|
+
export { CrelteServerRequest, CrelteServerRequestOptions, ServerRouter, RouterOptions, Handler, ServerRequest, };
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|