crelte 0.1.0 → 0.1.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.
Files changed (114) hide show
  1. package/dist/Crelte.d.ts +89 -25
  2. package/dist/Crelte.d.ts.map +1 -1
  3. package/dist/Crelte.js +79 -38
  4. package/dist/CrelteRequest.d.ts +63 -0
  5. package/dist/CrelteRequest.d.ts.map +1 -0
  6. package/dist/CrelteRequest.js +94 -0
  7. package/dist/blocks/Blocks.d.ts +27 -3
  8. package/dist/blocks/Blocks.d.ts.map +1 -1
  9. package/dist/blocks/Blocks.js +8 -0
  10. package/dist/blocks/Blocks.svelte +1 -1
  11. package/dist/blocks/Blocks.svelte.d.ts +36 -4
  12. package/dist/blocks/Blocks.svelte.d.ts.map +1 -1
  13. package/dist/blocks/index.d.ts +6 -3
  14. package/dist/blocks/index.d.ts.map +1 -1
  15. package/dist/blocks/index.js +3 -2
  16. package/dist/cookies/ServerCookies.d.ts +1 -1
  17. package/dist/cookies/ServerCookies.d.ts.map +1 -1
  18. package/dist/cookies/index.d.ts +7 -0
  19. package/dist/cookies/index.d.ts.map +1 -1
  20. package/dist/graphql/GraphQl.d.ts +53 -14
  21. package/dist/graphql/GraphQl.d.ts.map +1 -1
  22. package/dist/graphql/GraphQl.js +44 -23
  23. package/dist/graphql/index.d.ts +1 -1
  24. package/dist/graphql/index.d.ts.map +1 -1
  25. package/dist/graphql/index.js +2 -2
  26. package/dist/index.d.ts +55 -22
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +50 -23
  29. package/dist/init/client.d.ts +43 -2
  30. package/dist/init/client.d.ts.map +1 -1
  31. package/dist/init/client.js +26 -6
  32. package/dist/init/server.d.ts +49 -2
  33. package/dist/init/server.d.ts.map +1 -1
  34. package/dist/init/server.js +56 -6
  35. package/dist/init/shared.d.ts +5 -4
  36. package/dist/init/shared.d.ts.map +1 -1
  37. package/dist/init/shared.js +3 -3
  38. package/dist/loadData/Globals.d.ts +41 -2
  39. package/dist/loadData/Globals.d.ts.map +1 -1
  40. package/dist/loadData/Globals.js +33 -5
  41. package/dist/loadData/index.d.ts +74 -11
  42. package/dist/loadData/index.d.ts.map +1 -1
  43. package/dist/loadData/index.js +5 -8
  44. package/dist/plugins/Events.d.ts +18 -5
  45. package/dist/plugins/Events.d.ts.map +1 -1
  46. package/dist/plugins/Events.js +3 -0
  47. package/dist/plugins/Plugins.d.ts +28 -2
  48. package/dist/plugins/Plugins.d.ts.map +1 -1
  49. package/dist/plugins/Plugins.js +8 -0
  50. package/dist/routing/History.d.ts +6 -3
  51. package/dist/routing/History.d.ts.map +1 -1
  52. package/dist/routing/History.js +7 -1
  53. package/dist/routing/InnerRouter.d.ts +10 -9
  54. package/dist/routing/InnerRouter.d.ts.map +1 -1
  55. package/dist/routing/InnerRouter.js +47 -35
  56. package/dist/routing/PageLoader.d.ts +5 -5
  57. package/dist/routing/PageLoader.d.ts.map +1 -1
  58. package/dist/routing/PageLoader.js +7 -7
  59. package/dist/routing/Request.d.ts +102 -0
  60. package/dist/routing/Request.d.ts.map +1 -0
  61. package/dist/routing/Request.js +128 -0
  62. package/dist/routing/Route.d.ts +73 -5
  63. package/dist/routing/Route.d.ts.map +1 -1
  64. package/dist/routing/Route.js +71 -6
  65. package/dist/routing/Router.d.ts +59 -52
  66. package/dist/routing/Router.d.ts.map +1 -1
  67. package/dist/routing/Router.js +95 -116
  68. package/dist/routing/Site.d.ts +1 -1
  69. package/dist/routing/Site.js +1 -1
  70. package/dist/routing/index.d.ts +4 -3
  71. package/dist/routing/index.d.ts.map +1 -1
  72. package/dist/routing/index.js +2 -1
  73. package/dist/ssr/SsrCache.d.ts +17 -0
  74. package/dist/ssr/SsrCache.d.ts.map +1 -1
  75. package/dist/ssr/SsrCache.js +17 -4
  76. package/dist/ssr/SsrComponents.d.ts +1 -0
  77. package/dist/ssr/SsrComponents.d.ts.map +1 -1
  78. package/dist/ssr/SsrComponents.js +1 -0
  79. package/package.json +6 -6
  80. package/src/Crelte.ts +124 -52
  81. package/src/CrelteRequest.ts +124 -0
  82. package/src/blocks/Blocks.svelte +35 -18
  83. package/src/blocks/Blocks.ts +38 -6
  84. package/src/blocks/index.ts +19 -10
  85. package/src/cookies/ServerCookies.ts +1 -1
  86. package/src/cookies/index.ts +7 -1
  87. package/src/graphql/GraphQl.ts +79 -27
  88. package/src/graphql/index.ts +7 -1
  89. package/src/index.ts +65 -29
  90. package/src/init/client.ts +55 -10
  91. package/src/init/server.ts +70 -10
  92. package/src/init/shared.ts +8 -7
  93. package/src/loadData/Globals.ts +43 -7
  94. package/src/loadData/index.ts +76 -13
  95. package/src/plugins/Events.ts +16 -5
  96. package/src/plugins/Plugins.ts +28 -2
  97. package/src/routing/History.ts +13 -4
  98. package/src/routing/InnerRouter.ts +55 -39
  99. package/src/routing/PageLoader.ts +10 -10
  100. package/src/routing/Request.ts +175 -0
  101. package/src/routing/Route.ts +73 -8
  102. package/src/routing/Router.ts +108 -162
  103. package/src/routing/Site.ts +1 -1
  104. package/src/routing/index.ts +12 -3
  105. package/src/ssr/SsrCache.ts +17 -4
  106. package/src/ssr/SsrComponents.ts +1 -0
  107. package/dist/CrelteBase.d.ts +0 -16
  108. package/dist/CrelteBase.d.ts.map +0 -1
  109. package/dist/CrelteBase.js +0 -1
  110. package/dist/CrelteRouted.d.ts +0 -50
  111. package/dist/CrelteRouted.d.ts.map +0 -1
  112. package/dist/CrelteRouted.js +0 -88
  113. package/src/CrelteBase.ts +0 -24
  114. package/src/CrelteRouted.ts +0 -128
package/src/Crelte.ts CHANGED
@@ -1,18 +1,12 @@
1
1
  import ClientCookies from './cookies/ClientCookies.js';
2
2
  import { Cookies } from './cookies/index.js';
3
3
  import ServerCookies from './cookies/ServerCookies.js';
4
- import CrelteBase from './CrelteBase.js';
5
- import CrelteRouted, { GraphQlQuery } from './CrelteRouted.js';
6
- import GraphQl, {
7
- GraphQlOptions,
8
- GraphQlRequestOptions,
9
- } from './graphql/GraphQl.js';
10
- import Globals from './loadData/Globals.js';
4
+ import GraphQl, { GraphQlOptions, GraphQlQuery } from './graphql/GraphQl.js';
5
+ import Globals, { Global, GlobalData } from './loadData/Globals.js';
11
6
  import Events from './plugins/Events.js';
12
7
  import Plugins, { Plugin } from './plugins/Plugins.js';
13
- import Route from './routing/Route.js';
14
- import Router, { RouterOpts } from './routing/Router.js';
15
- import Site, { SiteFromGraphQl } from './routing/Site.js';
8
+ import Router, { RouterOptions } from './routing/Router.js';
9
+ import { SiteFromGraphQl } from './routing/Site.js';
16
10
  import SsrCache from './ssr/SsrCache.js';
17
11
 
18
12
  export class CrelteBuilder {
@@ -39,7 +33,7 @@ export class CrelteBuilder {
39
33
  this.graphQl = new GraphQl(endpoint, this.ssrCache, opts);
40
34
  }
41
35
 
42
- setupRouter(sites: SiteFromGraphQl[], opts: RouterOpts = {}) {
36
+ setupRouter(sites: SiteFromGraphQl[], opts: RouterOptions = {}) {
43
37
  this.router = new Router(sites, opts);
44
38
  }
45
39
 
@@ -51,80 +45,158 @@ export class CrelteBuilder {
51
45
  return new Crelte(this);
52
46
  }
53
47
  }
48
+ /**
49
+ * Options to configure the request
50
+ */
51
+ export type QueryOptions = {
52
+ /**
53
+ * Ignore the response status code
54
+ * @default false
55
+ */
56
+ ignoreStatusCode?: boolean;
54
57
 
55
- export default class Crelte implements CrelteBase {
56
- ssrCache: SsrCache;
57
- graphQl: GraphQl;
58
- router: Router;
59
- plugins: Plugins;
60
- events: Events;
61
- globals: Globals;
62
- cookies: Cookies;
58
+ /**
59
+ * Configure caching
60
+ * @default true
61
+ */
62
+ caching?: boolean;
63
63
 
64
- constructor(builder: CrelteBuilder) {
64
+ /**
65
+ * Status code of the response
66
+ * This will be set after the request if
67
+ * `ignoreStatusCode` is set to `true`
68
+ */
69
+ status?: number;
70
+ };
71
+
72
+ /**
73
+ * This is the main class of Crelte and can be accessed
74
+ * in component initialisation via `getCrelte()` and is the
75
+ * first parameter in `loadData`
76
+ */
77
+ export default class Crelte {
78
+ protected _ssrCache: SsrCache;
79
+ protected _graphQl: GraphQl;
80
+ protected _router: Router;
81
+ protected _plugins: Plugins;
82
+ protected _events: Events;
83
+ protected _globals: Globals;
84
+ protected _cookies: Cookies;
85
+
86
+ constructor(builder: CrelteBuilder | Crelte) {
65
87
  if (!builder.graphQl || !builder.router)
66
88
  throw new Error('builder not ready');
67
89
 
68
- this.ssrCache = builder.ssrCache;
69
- this.graphQl = builder.graphQl;
70
- this.router = builder.router;
71
- this.plugins = builder.plugins;
72
- this.events = builder.events;
73
- this.globals = builder.globals;
74
- this.cookies = builder.cookies;
90
+ this._ssrCache = builder.ssrCache;
91
+ this._graphQl = builder.graphQl;
92
+ this._router = builder.router;
93
+ this._plugins = builder.plugins;
94
+ this._events = builder.events;
95
+ this._globals = builder.globals;
96
+ this._cookies = builder.cookies;
97
+ }
98
+
99
+ /**
100
+ * Get the SSR cache
101
+ */
102
+ get ssrCache(): SsrCache {
103
+ return this._ssrCache;
104
+ }
105
+
106
+ /**
107
+ * Get the GraphQl instance
108
+ */
109
+ get graphQl(): GraphQl {
110
+ return this._graphQl;
111
+ }
112
+
113
+ /**
114
+ * Get the Router instance
115
+ */
116
+ get router(): Router {
117
+ return this._router;
118
+ }
119
+
120
+ /**
121
+ * Get the Plugins instance
122
+ */
123
+ get plugins(): Plugins {
124
+ return this._plugins;
125
+ }
126
+
127
+ /**
128
+ * Get the Events instance
129
+ */
130
+ get events(): Events {
131
+ return this._events;
132
+ }
133
+
134
+ /**
135
+ * Get the Globals instance
136
+ */
137
+ get globals(): Globals {
138
+ return this._globals;
139
+ }
140
+
141
+ /**
142
+ * Get the Cookies instance
143
+ */
144
+ get cookies(): Cookies {
145
+ return this._cookies;
75
146
  }
76
147
 
148
+ /**
149
+ * Get a Plugin by name
150
+ */
77
151
  getPlugin(name: string): Plugin | null {
78
152
  return this.plugins.get(name);
79
153
  }
80
154
 
81
155
  /**
82
- * returns an env Variables, always needs to be prefixed VITE_
83
- * Except ENDPOINT_URL and CRAFT_WEB_URL
156
+ * returns an env variable from the craft/.env file.
157
+ * All env variables need to start with VITE_
158
+ * except ENDPOINT_URL and CRAFT_WEB_URL
84
159
  */
160
+ getEnv(name: 'ENDPOINT_URL'): string;
161
+ getEnv(name: 'CRAFT_WEB_URL'): string;
162
+ getEnv(name: string): string | null;
85
163
  getEnv(name: string): string | null {
86
164
  return this.ssrCache.get(name);
87
165
  }
88
166
 
89
- /// calling this from loadGlobalData will always return null
90
- /// this does return the resolved store
91
- getGlobal(name: string): any | null {
167
+ /**
168
+ * returns a store which contains a globalSet
169
+ *
170
+ * ## Note
171
+ * This only works in loadData, in loadGlobalData this will
172
+ * always return null. In that context you should use
173
+ * `CrelteRequest.getGlobalAsync`
174
+ */
175
+ getGlobal<T extends GlobalData>(name: string): Global<T> | null {
92
176
  return this.globals.get(name) ?? null;
93
177
  }
94
178
 
95
- /// requires a site if the route does not contain a site
96
- toRouted(route?: Route, site?: Site): CrelteRouted {
97
- if (!route) {
98
- route = this.router.route.get();
99
- }
100
-
101
- if (!site) {
102
- if (!route.site) throw new Error('site is required');
103
- site = route.site;
104
- }
105
-
106
- return new CrelteRouted(this, route, site);
107
- }
108
-
109
179
  /**
110
180
  * Run a GraphQl Query
111
181
  *
112
- * @param query the default export from a graphql file
182
+ * @param query the default export from a graphql file or the gql`query {}`
183
+ * function
113
184
  * @param variables variables that should be passed to the
114
185
  * graphql query
115
- * @param options opts `{ caching: true, previewToken: string,
116
- * siteToken: string, ignoreStatusCode: false, headers: {} }`
117
186
  */
118
187
  async query(
119
188
  query: GraphQlQuery,
120
189
  variables: Record<string, unknown> = {},
121
- opts: GraphQlRequestOptions = {},
190
+ opts: QueryOptions = {},
122
191
  ): Promise<unknown> {
123
192
  // this function is added as convenience
124
- return this.toRouted().query(query, variables, opts);
193
+ return this.graphQl.query(query, variables, {
194
+ route: this.router.route.get(),
195
+ ...opts,
196
+ });
125
197
  }
126
198
 
127
- // don't use
199
+ /** @hidden */
128
200
  _getContext(): Map<string, any> {
129
201
  const map = new Map();
130
202
 
@@ -0,0 +1,124 @@
1
+ import Crelte, { QueryOptions } from './Crelte.js';
2
+ import { GraphQlQuery } from './graphql/GraphQl.js';
3
+ import Site from './routing/Site.js';
4
+ import Request from './routing/Request.js';
5
+ import Route from './routing/Route.js';
6
+ import { GlobalData } from './loadData/Globals.js';
7
+
8
+ export default class CrelteRequest extends Crelte {
9
+ /**
10
+ * The current request
11
+ */
12
+ req: Request;
13
+
14
+ /**
15
+ * The current site
16
+ */
17
+ site: Site;
18
+
19
+ private innerGlobals: Map<string, any>;
20
+
21
+ /// requires a site if the route does not contain a site
22
+ constructor(inner: Crelte, req: Request, site: Site) {
23
+ super(inner);
24
+
25
+ this.req = req;
26
+ this.site = site;
27
+ this.innerGlobals = new Map();
28
+ }
29
+
30
+ /**
31
+ * Create a CrelteRequest from a Crelte instance
32
+ *
33
+ * If you don't provide a route or request the current route
34
+ * will be used.
35
+ *
36
+ * ## Note
37
+ * If you provide a route it must contain a site or you must
38
+ * provide one,
39
+ */
40
+ static fromCrelte(
41
+ inner: Crelte,
42
+ req?: Route | Request,
43
+ site?: Site,
44
+ ): CrelteRequest {
45
+ if (!req) {
46
+ req = inner.router.route.get();
47
+ }
48
+
49
+ if (!site) {
50
+ if (!req.site) throw new Error('site is required');
51
+ site = req.site;
52
+ }
53
+
54
+ return new CrelteRequest(
55
+ inner,
56
+ req instanceof Request ? req : Request.fromRoute(req),
57
+ site,
58
+ );
59
+ }
60
+
61
+ /**
62
+ * Get the current request
63
+ * @deprecated
64
+ */
65
+ get route(): Request {
66
+ return this.req;
67
+ }
68
+
69
+ /**
70
+ * returns a globalSet
71
+ *
72
+ * ## Note
73
+ * This only works in loadData, in loadGlobalData this will
74
+ * always return null. In that context you should use
75
+ * `.getGlobalAsync`
76
+ */
77
+ getGlobal<T extends GlobalData>(name: string): T | null {
78
+ return this.innerGlobals.get(name) ?? null;
79
+ }
80
+
81
+ /**
82
+ * Get a globalSet and wait until it is loaded
83
+ *
84
+ * ## Note
85
+ * This is only useful in loadGlobalData in all other cases
86
+ * you can use `.getGlobal` which does return a Promise
87
+ */
88
+ async getGlobalAsync<T extends GlobalData>(
89
+ name: string,
90
+ ): Promise<T | null> {
91
+ const global = this.innerGlobals.get(name);
92
+ if (global) return global;
93
+
94
+ const r = await this.globals.getAsync<T>(name);
95
+ if (!r) return null;
96
+
97
+ return r.bySiteId(this.site.id);
98
+ }
99
+
100
+ /**
101
+ * Run a GraphQl Query
102
+ *
103
+ * @param query the default export from a graphql file or the gql`query {}`
104
+ * function
105
+ * @param variables variables that should be passed to the
106
+ * graphql query
107
+ */
108
+ async query(
109
+ query: GraphQlQuery,
110
+ variables: Record<string, unknown> = {},
111
+ opts: QueryOptions = {},
112
+ ): Promise<unknown> {
113
+ // this function is added as convenience
114
+ return this.graphQl.query(query, variables, {
115
+ route: this.req,
116
+ ...opts,
117
+ });
118
+ }
119
+
120
+ /** @hidden */
121
+ _globalDataLoaded() {
122
+ this.innerGlobals = this.globals._globalsBySite(this.site.id);
123
+ }
124
+ }
@@ -1,22 +1,10 @@
1
1
  <script context="module" lang="ts">
2
- import { CrelteRouted } from '../index.js';
2
+ import CrelteRequest from '../CrelteRequest.js';
3
3
 
4
4
  /*
5
5
  usage:
6
6
 
7
- const mods = import.meta.glob('./contentDetail/*.svelte', {
8
- // can either be eager loaded or not
9
- eager: true,
10
- });
11
-
12
- const mods = blockModules(
13
- import.meta.glob('./contentDetail/*.svelte', { eager: true }),
14
- {
15
- alias: {
16
- 'contentDetail': 'contentDetail',
17
- }
18
- }
19
- );
7
+ const mods = blockModules(import.meta.glob('./contentDetail/*.svelte'));
20
8
 
21
9
  export const loadData = {
22
10
  blocks: (cr, entry) => loadBlocksData(cr, entry.blocks, mods)
@@ -31,14 +19,32 @@
31
19
 
32
20
  import Blocks, {
33
21
  type AsyncModule,
34
- type Module,
35
22
  type BlockModulesOptions,
36
23
  BlockModules,
37
24
  newBlocks,
38
25
  } from './Blocks.js';
39
26
 
40
- export type { BlockModules, BlockModulesOptions, AsyncModule, Module };
41
-
27
+ /**
28
+ * Create a BlockModules instance from modules
29
+ *
30
+ * ## Example
31
+ * ```ts
32
+ * const mods = blockModules(
33
+ * import.meta.glob('./contentDetail/*.svelte', { eager: true })
34
+ );
35
+ * ```
36
+ *
37
+ * ## Example with alias
38
+ * ```ts
39
+ * const mods = blockModules(
40
+ * import.meta.glob('./contentDetail/*.svelte'),
41
+ * {
42
+ * alias: {
43
+ * fakename: 'filename',
44
+ * }
45
+ * }
46
+ * );
47
+ */
42
48
  export function blockModules(
43
49
  modules: Record<string, AsyncModule>,
44
50
  opts: BlockModulesOptions = {},
@@ -46,8 +52,19 @@
46
52
  return new BlockModules(modules, opts);
47
53
  }
48
54
 
55
+ /**
56
+ * Load blocks data
57
+ *
58
+ * ## Example
59
+ * ```ts
60
+ * const mods = blockModules(import.meta.glob('./contentDetail/*.svelte'));
61
+ *
62
+ * export const loadData = {
63
+ * blocks: (cr, entry) => loadBlocksData(cr, entry.blocks, mods)
64
+ * };
65
+ */
49
66
  export async function loadBlocksData(
50
- cr: CrelteRouted,
67
+ cr: CrelteRequest,
51
68
  blocks: any[],
52
69
  modules: BlockModules,
53
70
  ): Promise<Blocks> {
@@ -1,19 +1,40 @@
1
- import { CrelteRouted } from '../index.js';
1
+ import { CrelteRequest } from '../index.js';
2
2
  import { callLoadData } from '../loadData/index.js';
3
3
 
4
4
  export interface Module {
5
- // svelte component
5
+ /** Svelte component */
6
6
  default: any;
7
+
8
+ /** Handle of the block, this only works with { eager: true } */
7
9
  handle?: string | string[];
10
+
11
+ /** If true the typeHandle will be avaiable for this component */
8
12
  keepTypeHandle?: boolean;
9
13
 
10
- loadData?: (block: any) => Promise<any>;
14
+ loadData?: (
15
+ cr: CrelteRequest,
16
+ block: any,
17
+ opts: BlockOptions,
18
+ ) => Promise<any>;
11
19
  }
12
20
 
21
+ export type BlockOptions = {
22
+ /**
23
+ * The returns the sibling block or null if it does not exist
24
+ *
25
+ * -1 = previous block
26
+ * 0 = current block
27
+ * 1 = next block
28
+ */
29
+ getSibling: (offset: number) => Record<string, any> | null;
30
+ };
31
+
13
32
  export type AsyncModule = (() => Promise<Module>) | Module;
14
33
 
15
34
  export type BlockModulesOptions = {
16
- // if a block should handle multiple blocks
35
+ /**
36
+ * If a block should handle multiple typehandles
37
+ */
17
38
  alias?: Record<string, string>;
18
39
  };
19
40
 
@@ -81,7 +102,18 @@ export class BlockModules {
81
102
  }
82
103
  }
83
104
 
84
- export async function newBlocks(blocks: any[], modules: BlockModules) {
105
+ /**
106
+ * Creates a new Blocks instance
107
+ *
108
+ * Consider using the Blocks component instead
109
+ *
110
+ * @param blocks the blocks data each block must have a typeHandle
111
+ * @param modules the modules created with `blockModules`
112
+ */
113
+ export async function newBlocks(
114
+ blocks: any[],
115
+ modules: BlockModules,
116
+ ): Promise<Blocks> {
85
117
  // define all required modules
86
118
  const requiredModules: Set<string> = new Set();
87
119
 
@@ -107,7 +139,7 @@ export default class Blocks {
107
139
  this.data = blocks.map(() => null);
108
140
  }
109
141
 
110
- async loadData(cr: CrelteRouted) {
142
+ async loadData(cr: CrelteRequest) {
111
143
  this.data = await Promise.all(
112
144
  this.blocks.map((block, i) => {
113
145
  const mod = this.modules.get(block.typeHandle)!;
@@ -1,14 +1,23 @@
1
- import Blocks, {
2
- type BlockModules,
3
- type BlockModulesOptions,
4
- type AsyncModule,
5
- type Module,
6
- blockModules,
7
- loadBlocksData,
8
- } from './Blocks.svelte';
1
+ import Blocks, { blockModules, loadBlocksData } from './Blocks.svelte';
2
+ import type {
3
+ BlockModules,
4
+ BlockModulesOptions,
5
+ AsyncModule,
6
+ Module,
7
+ BlockOptions,
8
+ } from './Blocks.js';
9
+ import type BlocksInstance from './Blocks.js';
10
+ import { newBlocks } from './Blocks.js';
9
11
 
10
- export type { BlockModules, BlockModulesOptions, AsyncModule, Module };
12
+ export type {
13
+ BlocksInstance,
14
+ BlockModules,
15
+ BlockModulesOptions,
16
+ AsyncModule,
17
+ Module,
18
+ BlockOptions,
19
+ };
11
20
 
12
- export { Blocks, blockModules, loadBlocksData };
21
+ export { newBlocks, Blocks, blockModules, loadBlocksData };
13
22
 
14
23
  export default Blocks;
@@ -1,5 +1,5 @@
1
1
  import { Cookies, SetOptions } from './index.js';
2
- import { parseCookies, SetCookie, setCookieToString } from './utils.js';
2
+ import { parseCookies, type SetCookie, setCookieToString } from './utils.js';
3
3
 
4
4
  export default class ServerCookies implements Cookies {
5
5
  requestCookies: Map<string, string>;
@@ -14,11 +14,17 @@ export interface Cookies {
14
14
 
15
15
  /**
16
16
  * sets the value of the cookie
17
+ *
18
+ * ## Note
19
+ * in most cases you probably wan't to set the path to '/'
17
20
  */
18
21
  set(name: string, value: string, opts?: SetOptions): void;
19
22
 
23
+ /**
24
+ * removes the cookie
25
+ */
20
26
  remove(name: string): void;
21
27
 
22
- // doc hidden
28
+ /** @hidden */
23
29
  _init(cookies: string): void;
24
30
  }