crelte 0.5.0-alpha.10 → 0.5.0-alpha.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.
Files changed (144) hide show
  1. package/dist/blocks/Blocks.svelte +1 -1
  2. package/dist/blocks/Blocks.svelte.d.ts +1 -1
  3. package/dist/blocks/Blocks.svelte.d.ts.map +1 -1
  4. package/dist/cookies/ClientCookies.d.ts +2 -2
  5. package/dist/cookies/ClientCookies.d.ts.map +1 -1
  6. package/dist/cookies/ClientCookies.js +3 -3
  7. package/dist/cookies/ServerCookies.d.ts +2 -2
  8. package/dist/cookies/ServerCookies.d.ts.map +1 -1
  9. package/dist/cookies/ServerCookies.js +3 -3
  10. package/dist/cookies/index.d.ts +3 -2
  11. package/dist/cookies/index.d.ts.map +1 -1
  12. package/dist/crelte.d.ts +196 -0
  13. package/dist/crelte.d.ts.map +1 -0
  14. package/dist/crelte.js +52 -0
  15. package/dist/entry/index.d.ts +5 -28
  16. package/dist/entry/index.d.ts.map +1 -1
  17. package/dist/entry/index.js +7 -35
  18. package/dist/index.d.ts +9 -10
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +27 -28
  21. package/dist/init/InternalApp.d.ts +2 -2
  22. package/dist/init/InternalApp.d.ts.map +1 -1
  23. package/dist/init/InternalApp.js +3 -6
  24. package/dist/init/client.d.ts.map +1 -1
  25. package/dist/init/client.js +35 -36
  26. package/dist/init/server.d.ts +1 -0
  27. package/dist/init/server.d.ts.map +1 -1
  28. package/dist/init/server.js +30 -24
  29. package/dist/init/shared.d.ts +7 -3
  30. package/dist/init/shared.d.ts.map +1 -1
  31. package/dist/init/shared.js +72 -31
  32. package/dist/loadData/index.d.ts +3 -3
  33. package/dist/loadData/index.d.ts.map +1 -1
  34. package/dist/loadData/index.js +2 -2
  35. package/dist/plugins/Events.d.ts +16 -1
  36. package/dist/plugins/Events.d.ts.map +1 -1
  37. package/dist/plugins/Events.js +3 -10
  38. package/dist/plugins/Plugins.d.ts +2 -2
  39. package/dist/plugins/Plugins.d.ts.map +1 -1
  40. package/dist/queries/Queries.d.ts +84 -0
  41. package/dist/queries/Queries.d.ts.map +1 -0
  42. package/dist/queries/Queries.js +192 -0
  43. package/dist/queries/QueryError.d.ts +22 -0
  44. package/dist/queries/QueryError.d.ts.map +1 -0
  45. package/dist/queries/QueryError.js +27 -0
  46. package/dist/queries/gql.d.ts +13 -0
  47. package/dist/queries/gql.d.ts.map +1 -0
  48. package/dist/queries/gql.js +34 -0
  49. package/dist/queries/index.d.ts +5 -0
  50. package/dist/queries/index.d.ts.map +1 -0
  51. package/dist/queries/index.js +4 -0
  52. package/dist/routing/History.d.ts +1 -1
  53. package/dist/routing/History.d.ts.map +1 -1
  54. package/dist/routing/index.d.ts +4 -4
  55. package/dist/routing/index.d.ts.map +1 -1
  56. package/dist/routing/index.js +4 -4
  57. package/dist/routing/{BaseRoute.d.ts → route/BaseRoute.d.ts} +1 -1
  58. package/dist/routing/route/BaseRoute.d.ts.map +1 -0
  59. package/dist/routing/{BaseRoute.js → route/BaseRoute.js} +2 -2
  60. package/dist/routing/{Request.d.ts → route/Request.d.ts} +2 -2
  61. package/dist/routing/route/Request.d.ts.map +1 -0
  62. package/dist/routing/{Request.js → route/Request.js} +1 -1
  63. package/dist/routing/{Route.d.ts → route/Route.d.ts} +3 -3
  64. package/dist/routing/route/Route.d.ts.map +1 -0
  65. package/dist/routing/{Route.js → route/Route.js} +1 -1
  66. package/dist/routing/{BaseRouter.d.ts → router/BaseRouter.d.ts} +6 -6
  67. package/dist/routing/router/BaseRouter.d.ts.map +1 -0
  68. package/dist/routing/{BaseRouter.js → router/BaseRouter.js} +5 -5
  69. package/dist/routing/{ClientRouter.d.ts → router/ClientRouter.d.ts} +4 -4
  70. package/dist/routing/router/ClientRouter.d.ts.map +1 -0
  71. package/dist/routing/{Router.d.ts → router/Router.d.ts} +3 -3
  72. package/dist/routing/router/Router.d.ts.map +1 -0
  73. package/dist/routing/{ServerRouter.d.ts → router/ServerRouter.d.ts} +3 -3
  74. package/dist/routing/router/ServerRouter.d.ts.map +1 -0
  75. package/dist/static/index.d.ts +35 -0
  76. package/dist/static/index.d.ts.map +1 -0
  77. package/dist/static/index.js +40 -0
  78. package/dist/utils.d.ts +0 -1
  79. package/dist/utils.d.ts.map +1 -1
  80. package/dist/utils.js +0 -2
  81. package/package.json +8 -4
  82. package/src/blocks/Blocks.svelte +1 -2
  83. package/src/cookies/ClientCookies.ts +4 -4
  84. package/src/cookies/ServerCookies.ts +4 -4
  85. package/src/cookies/index.ts +4 -2
  86. package/src/crelte.ts +290 -0
  87. package/src/entry/index.ts +15 -50
  88. package/src/index.ts +43 -35
  89. package/src/init/InternalApp.ts +5 -11
  90. package/src/init/client.ts +38 -41
  91. package/src/init/server.ts +33 -23
  92. package/src/init/shared.ts +96 -38
  93. package/src/loadData/index.ts +4 -4
  94. package/src/plugins/Events.ts +31 -24
  95. package/src/plugins/Plugins.ts +2 -2
  96. package/src/queries/Queries.ts +331 -0
  97. package/src/queries/QueryError.ts +37 -0
  98. package/src/queries/gql.ts +39 -0
  99. package/src/queries/index.ts +18 -0
  100. package/src/routing/History.ts +1 -1
  101. package/src/routing/index.ts +7 -4
  102. package/src/routing/{BaseRoute.ts → route/BaseRoute.ts} +3 -3
  103. package/src/routing/{Request.ts → route/Request.ts} +3 -3
  104. package/src/routing/{Route.ts → route/Route.ts} +4 -4
  105. package/src/routing/{BaseRouter.ts → router/BaseRouter.ts} +8 -8
  106. package/src/routing/{ClientRouter.ts → router/ClientRouter.ts} +4 -4
  107. package/src/routing/{Router.ts → router/Router.ts} +3 -3
  108. package/src/routing/{ServerRouter.ts → router/ServerRouter.ts} +3 -3
  109. package/src/static/index.ts +81 -0
  110. package/src/utils.ts +0 -3
  111. package/dist/Crelte.d.ts +0 -172
  112. package/dist/Crelte.d.ts.map +0 -1
  113. package/dist/Crelte.js +0 -172
  114. package/dist/CrelteRequest.d.ts +0 -70
  115. package/dist/CrelteRequest.d.ts.map +0 -1
  116. package/dist/CrelteRequest.js +0 -103
  117. package/dist/entry/EntryRouter.d.ts +0 -30
  118. package/dist/entry/EntryRouter.d.ts.map +0 -1
  119. package/dist/entry/EntryRouter.js +0 -45
  120. package/dist/graphql/GraphQl.d.ts +0 -108
  121. package/dist/graphql/GraphQl.d.ts.map +0 -1
  122. package/dist/graphql/GraphQl.js +0 -234
  123. package/dist/graphql/gql.test.d.ts +0 -2
  124. package/dist/graphql/gql.test.d.ts.map +0 -1
  125. package/dist/graphql/gql.test.js +0 -80
  126. package/dist/graphql/index.d.ts +0 -3
  127. package/dist/graphql/index.d.ts.map +0 -1
  128. package/dist/graphql/index.js +0 -2
  129. package/dist/routing/BaseRoute.d.ts.map +0 -1
  130. package/dist/routing/BaseRouter.d.ts.map +0 -1
  131. package/dist/routing/ClientRouter.d.ts.map +0 -1
  132. package/dist/routing/Request.d.ts.map +0 -1
  133. package/dist/routing/Route.d.ts.map +0 -1
  134. package/dist/routing/Router.d.ts.map +0 -1
  135. package/dist/routing/ServerRouter.d.ts.map +0 -1
  136. package/src/Crelte.ts +0 -285
  137. package/src/CrelteRequest.ts +0 -135
  138. package/src/entry/EntryRouter.ts +0 -71
  139. package/src/graphql/GraphQl.ts +0 -359
  140. package/src/graphql/gql.test.ts +0 -123
  141. package/src/graphql/index.ts +0 -14
  142. /package/dist/routing/{ClientRouter.js → router/ClientRouter.js} +0 -0
  143. /package/dist/routing/{Router.js → router/Router.js} +0 -0
  144. /package/dist/routing/{ServerRouter.js → router/ServerRouter.js} +0 -0
@@ -1,4 +1,4 @@
1
- <script context="module" lang="ts">import CrelteRequest from "../CrelteRequest.js";
1
+ <script context="module" lang="ts">import {} from "../index.js";
2
2
  import Blocks, {
3
3
  BlockModules,
4
4
  newBlocks
@@ -1,4 +1,4 @@
1
- import CrelteRequest from '../CrelteRequest.js';
1
+ import { type CrelteRequest } from '../index.js';
2
2
  import Blocks, { type AsyncModule, type BlockModulesOptions, BlockModules } from './Blocks.js';
3
3
  /**
4
4
  * Create a BlockModules instance from modules
@@ -1 +1 @@
1
- {"version":3,"file":"Blocks.svelte.d.ts","sourceRoot":"","sources":["../../src/blocks/Blocks.svelte.ts"],"names":[],"mappings":"AAGC,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAkBhD,OAAO,MAAM,EAAE,EACd,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,YAAY,EAEZ,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACpC,IAAI,GAAE,mBAAwB,GAC5B,YAAY,CAEd;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CACnC,EAAE,EAAE,aAAa,EACjB,MAAM,EAAE,GAAG,EAAE,EACb,OAAO,EAAE,YAAY,GACnB,OAAO,CAAC,MAAM,CAAC,CAMjB;AAuBF,QAAA,MAAM,MAAM,KAAsG,CAAC;AACjG,KAAK,MAAM,GAAG,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC;AAC5C,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Blocks.svelte.d.ts","sourceRoot":"","sources":["../../src/blocks/Blocks.svelte.ts"],"names":[],"mappings":"AAGC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAiBjD,OAAO,MAAM,EAAE,EACd,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,YAAY,EAEZ,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACpC,IAAI,GAAE,mBAAwB,GAC5B,YAAY,CAEd;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CACnC,EAAE,EAAE,aAAa,EACjB,MAAM,EAAE,GAAG,EAAE,EACb,OAAO,EAAE,YAAY,GACnB,OAAO,CAAC,MAAM,CAAC,CAMjB;AAuBF,QAAA,MAAM,MAAM,KAAsG,CAAC;AACjG,KAAK,MAAM,GAAG,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC;AAC5C,eAAe,MAAM,CAAC"}
@@ -1,8 +1,8 @@
1
- import { Cookies, SetOptions } from './index.js';
1
+ import { Cookies, RemoveOptions, SetOptions } from './index.js';
2
2
  export default class ClientCookies implements Cookies {
3
3
  constructor();
4
4
  get(name: string): string | null;
5
5
  set(name: string, value: string, opts?: SetOptions): void;
6
- remove(name: string): void;
6
+ remove(name: string, opts?: RemoveOptions): void;
7
7
  }
8
8
  //# sourceMappingURL=ClientCookies.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClientCookies.d.ts","sourceRoot":"","sources":["../../src/cookies/ClientCookies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAMjD,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,OAAO;;IAGpD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAKhC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI;IAMzD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAG1B"}
1
+ {"version":3,"file":"ClientCookies.d.ts","sourceRoot":"","sources":["../../src/cookies/ClientCookies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAMhE,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,OAAO;;IAGpD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAKhC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI;IAMzD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI;CAGhD"}
@@ -9,11 +9,11 @@ export default class ClientCookies {
9
9
  return cookies.get(name) ?? null;
10
10
  }
11
11
  set(name, value, opts) {
12
- const setCookie = { name, value, ...opts };
12
+ const setCookie = { name, value, path: '/', ...opts };
13
13
  document.cookie = setCookieToString(setCookie);
14
14
  }
15
- remove(name) {
16
- this.set(name, '', { maxAge: 0 });
15
+ remove(name, opts) {
16
+ this.set(name, '', { ...opts, maxAge: 0 });
17
17
  }
18
18
  }
19
19
  function getCookies() {
@@ -1,4 +1,4 @@
1
- import { Cookies, SetOptions } from './index.js';
1
+ import { Cookies, RemoveOptions, SetOptions } from './index.js';
2
2
  import { type SetCookie } from './utils.js';
3
3
  /**
4
4
  * ## Warning
@@ -10,7 +10,7 @@ export default class ServerCookies implements Cookies {
10
10
  constructor(cookies: string);
11
11
  get(name: string): string | null;
12
12
  set(name: string, value: string, opts?: SetOptions): void;
13
- remove(name: string): void;
13
+ remove(name: string, opts?: RemoveOptions): void;
14
14
  _getSetCookiesHeaders(): string[];
15
15
  }
16
16
  //# sourceMappingURL=ServerCookies.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ServerCookies.d.ts","sourceRoot":"","sources":["../../src/cookies/ServerCookies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAgB,KAAK,SAAS,EAAqB,MAAM,YAAY,CAAC;AAE7E;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,OAAO;IACpD,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;gBAEvB,OAAO,EAAE,MAAM;IAM3B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAUhC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI;IAIzD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI1B,qBAAqB,IAAI,MAAM,EAAE;CAKjC"}
1
+ {"version":3,"file":"ServerCookies.d.ts","sourceRoot":"","sources":["../../src/cookies/ServerCookies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAgB,KAAK,SAAS,EAAqB,MAAM,YAAY,CAAC;AAE7E;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,OAAO;IACpD,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;gBAEvB,OAAO,EAAE,MAAM;IAM3B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAUhC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI;IAIzD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI;IAIhD,qBAAqB,IAAI,MAAM,EAAE;CAKjC"}
@@ -20,10 +20,10 @@ export default class ServerCookies {
20
20
  return this.requestCookies.get(name) ?? null;
21
21
  }
22
22
  set(name, value, opts) {
23
- this.setCookies.set(name, { name, value, ...opts });
23
+ this.setCookies.set(name, { name, value, path: '/', ...opts });
24
24
  }
25
- remove(name) {
26
- this.set(name, '', { maxAge: 0 });
25
+ remove(name, opts) {
26
+ this.set(name, '', { ...opts, maxAge: 0 });
27
27
  }
28
28
  _getSetCookiesHeaders() {
29
29
  return Array.from(this.setCookies.values()).map(setCookie => setCookieToString(setCookie));
@@ -5,6 +5,7 @@ export type SetOptions = {
5
5
  secure?: boolean;
6
6
  httpOnly?: boolean;
7
7
  };
8
+ export type RemoveOptions = Omit<SetOptions, 'maxAge'>;
8
9
  export interface Cookies {
9
10
  /**
10
11
  * returns the value of the cookie
@@ -14,12 +15,12 @@ export interface Cookies {
14
15
  * sets the value of the cookie
15
16
  *
16
17
  * ## Note
17
- * in most cases you probably wan't to set the path to '/'
18
+ * path defaults to '/'
18
19
  */
19
20
  set(name: string, value: string, opts?: SetOptions): void;
20
21
  /**
21
22
  * removes the cookie
22
23
  */
23
- remove(name: string): void;
24
+ remove(name: string, opts?: RemoveOptions): void;
24
25
  }
25
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cookies/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,OAAO;IACvB;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAEjC;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAE1D;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cookies/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AAEvD,MAAM,WAAW,OAAO;IACvB;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAEjC;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAE1D;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;CACjD"}
@@ -0,0 +1,196 @@
1
+ import { Cookies } from './cookies/index.js';
2
+ import Globals from './loadData/Globals.js';
3
+ import Events from './plugins/Events.js';
4
+ import Plugins, { Plugin } from './plugins/Plugins.js';
5
+ import { type Route, Request, Router } from './routing/index.js';
6
+ import SsrCache from './ssr/SsrCache.js';
7
+ import { Readable } from 'crelte-std/stores';
8
+ import Site from './routing/Site.js';
9
+ import { Entry } from './entry/index.js';
10
+ import Queries, { Query, QueryOptions } from './queries/Queries.js';
11
+ export type Config = {
12
+ /**
13
+ * Preload pages on mouse over
14
+ * @default false
15
+ */
16
+ preloadOnMouseOver?: boolean;
17
+ /**
18
+ * Use view transitions
19
+ * @default false
20
+ */
21
+ viewTransition?: boolean;
22
+ /**
23
+ * Play the intro animation
24
+ * @default false
25
+ */
26
+ playIntro?: boolean;
27
+ /**
28
+ * Enable X-Craft-Site Header
29
+ * @default false
30
+ */
31
+ XCraftSiteHeader?: boolean;
32
+ /**
33
+ * Enable graphql query debugging
34
+ * @default false
35
+ */
36
+ debugQueries?: boolean;
37
+ /**
38
+ * Enable request and render timing measurement
39
+ * @default false
40
+ */
41
+ debugTiming?: boolean;
42
+ };
43
+ export declare function configWithDefaults(config?: Config): Required<Config>;
44
+ /**
45
+ * This is Crelte a container of useful features and functions.
46
+ *
47
+ * In svelte contexts for each of these functions and classes there
48
+ * should be a getter function like `getCrelte()` or `getRouter()`.
49
+ *
50
+ * ## Note
51
+ * Plugins and other instances could modify this type, so when extending cloning
52
+ * or similar use the spread operator instead of naming all "properties".
53
+ */
54
+ export type Crelte = {
55
+ /**
56
+ * Config
57
+ */
58
+ config: Required<Config>;
59
+ /**
60
+ * Get the SSR cache
61
+ */
62
+ ssrCache: SsrCache;
63
+ /**
64
+ * Get the Queries instance
65
+ */
66
+ queries: Queries;
67
+ /**
68
+ * Get the Router instance
69
+ */
70
+ router: Router;
71
+ /**
72
+ * Get the Plugins instance
73
+ */
74
+ plugins: Plugins;
75
+ /**
76
+ * Get the Events instance
77
+ */
78
+ events: Events;
79
+ /**
80
+ * Get the Globals instance
81
+ */
82
+ globals: Globals;
83
+ /**
84
+ * Get the Cookies instance
85
+ */
86
+ cookies: Cookies;
87
+ /**
88
+ * Get a Plugin by name
89
+ */
90
+ getPlugin(name: string): Plugin | null;
91
+ /**
92
+ * returns an env variable from the craft/.env file.
93
+ * All env variables need to start with VITE_
94
+ * except ENDPOINT_URL, CRAFT_WEB_URL and FRONTEND_URL
95
+ */
96
+ getEnv(name: 'ENDPOINT_URL'): string;
97
+ getEnv(name: 'CRAFT_WEB_URL'): string;
98
+ getEnv(name: 'FRONTEND_URL'): string;
99
+ getEnv(name: string): string | null;
100
+ /**
101
+ * returns a store which contains a globalSet
102
+ *
103
+ * ## Note
104
+ * This only works in loadData, in loadGlobalData this will
105
+ * always return null. In that context you should use
106
+ * `CrelteRequest.getGlobalAsync`
107
+ */
108
+ getGlobalStore<T = any>(name: string): Readable<T> | null;
109
+ /**
110
+ * returns a new CrelteRequest instance either with the current
111
+ * route or a provided one
112
+ *
113
+ * ## Note
114
+ * This is useful if you want to create a stateful crelte
115
+ * to use in loadData context
116
+ */
117
+ toRequest(req?: Route | Request): CrelteRequest;
118
+ /**
119
+ * Run a GraphQl Query
120
+ *
121
+ * @param query the default export from a graphql file or the gql`query {}`
122
+ * function
123
+ * @param variables variables that should be passed to the
124
+ * graphql query
125
+ */
126
+ query(query: Query, variables?: Record<string, unknown>, opts?: QueryOptions): Promise<unknown>;
127
+ };
128
+ /**
129
+ * This is Crelte a container of useful features and functions.
130
+ *
131
+ * In svelte contexts for each of these functions and classes there
132
+ * should be a getter function like `getCrelte()` or `getRouter()`.
133
+ *
134
+ * ## Note
135
+ * Plugins and other instances could modify this type, so when extending cloning
136
+ * or similar use the spread operator instead of naming all "properties".
137
+ */
138
+ export type CrelteWithRoute = Crelte & {
139
+ /** The route */
140
+ get route(): Readable<Route>;
141
+ get site(): Readable<Site>;
142
+ get entry(): Readable<Entry>;
143
+ /**
144
+ * returns a store which contains a globalSet
145
+ *
146
+ * ## Note
147
+ * This only works in loadData, in loadGlobalData this will
148
+ * always return null. In that context you should use
149
+ * `CrelteRequest.getGlobalAsync`
150
+ */
151
+ getGlobal<T = any>(name: string): Readable<T> | null;
152
+ };
153
+ export type CrelteRequest = Crelte & {
154
+ /**
155
+ * The current request
156
+ */
157
+ req: Request;
158
+ /**
159
+ * Easy access to this.req.site
160
+ *
161
+ * ## Note
162
+ * The site might not always match with the current route
163
+ * but be the site default site or one that matches the
164
+ * users language.
165
+ */
166
+ get site(): Site;
167
+ /**
168
+ * returns 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
+ * `.getGlobalAsync`
174
+ */
175
+ getGlobal<T = any>(name: string): T | null;
176
+ /**
177
+ * Get a globalSet and wait until it is loaded
178
+ *
179
+ * ## Note
180
+ * This is only useful in loadGlobalData in all other cases
181
+ * you can use `.getGlobal` which does not return a Promise
182
+ */
183
+ getGlobalAsync<T = any>(name: string): T | Promise<T | null> | null;
184
+ };
185
+ export declare function newCrelte({ config, ssrCache, plugins, events, globals, router, queries, cookies, }: {
186
+ config: Required<Config>;
187
+ ssrCache: SsrCache;
188
+ plugins: Plugins;
189
+ events: Events;
190
+ globals: Globals;
191
+ router: Router;
192
+ queries: Queries;
193
+ cookies: Cookies;
194
+ }): Crelte;
195
+ export declare function crelteToRequest(crelte: Crelte, req?: Route | Request): CrelteRequest;
196
+ //# sourceMappingURL=crelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crelte.d.ts","sourceRoot":"","sources":["../src/crelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,OAAO,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,IAAI,MAAM,mBAAmB,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,OAAO,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpE,MAAM,MAAM,MAAM,GAAG;IACpB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAI3B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,MAAM,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C,EAAE,KAAK,GAAG,OAAO,GACnB,aAAa,CAkBf"}
package/dist/crelte.js ADDED
@@ -0,0 +1,52 @@
1
+ import { Request } from './routing/index.js';
2
+ export function configWithDefaults(config = {}) {
3
+ return {
4
+ preloadOnMouseOver: config.preloadOnMouseOver ?? false,
5
+ viewTransition: config.viewTransition ?? false,
6
+ playIntro: config.playIntro ?? false,
7
+ XCraftSiteHeader: config.XCraftSiteHeader ?? false,
8
+ debugQueries: config.debugQueries ?? false,
9
+ debugTiming: config.debugTiming ?? false,
10
+ };
11
+ }
12
+ export function newCrelte({ config, ssrCache, plugins, events, globals, router, queries, cookies, }) {
13
+ return {
14
+ config,
15
+ ssrCache,
16
+ plugins,
17
+ events,
18
+ globals,
19
+ router,
20
+ queries,
21
+ cookies,
22
+ getPlugin: name => plugins.get(name),
23
+ getEnv: key => ssrCache.get(key),
24
+ getGlobalStore: name => globals.getStore(name),
25
+ toRequest(req) {
26
+ // @ts-ignore
27
+ if (this === globalThis)
28
+ throw new Error('need to call toRequest with a this context');
29
+ return crelteToRequest(this, req);
30
+ },
31
+ query: (query, vars, opts) => queries.query(query, vars, opts),
32
+ };
33
+ }
34
+ export function crelteToRequest(crelte, req) {
35
+ req = req ?? crelte.req;
36
+ if (!req) {
37
+ req = crelte.router.route.get() ?? undefined;
38
+ // this will only occur in the first loadData call
39
+ if (!req)
40
+ throw new Error('router does not contain a route');
41
+ }
42
+ return {
43
+ ...crelte,
44
+ req: req instanceof Request ? req : Request.fromRoute(req),
45
+ get site() {
46
+ return this.req.site;
47
+ },
48
+ getGlobal: name => crelte.globals.get(name),
49
+ getGlobalAsync: name => crelte.globals.getAsync(name),
50
+ query: (query, vars, opts) => crelte.queries.query(query, vars, opts),
51
+ };
52
+ }
@@ -1,8 +1,5 @@
1
- import { GraphQlQuery } from '../graphql/index.js';
2
- import { Crelte, CrelteRequest } from '../index.js';
3
- import { Request, RequestOptions, Site } from '../routing/index.js';
4
- import EntryRouter, { EntryRouteHandler, EntryRoutes } from './EntryRouter.js';
5
- export { EntryRouter, type EntryRouteHandler, type EntryRoutes };
1
+ import { CrelteRequest } from '../index.js';
2
+ import { Query } from '../queries/Queries.js';
6
3
  export type Entry = {
7
4
  sectionHandle: string;
8
5
  typeHandle: string;
@@ -13,29 +10,9 @@ export type EntryQueryVars = {
13
10
  siteId: number;
14
11
  [key: string]: any;
15
12
  };
16
- export type EntryRequestOptions = RequestOptions & {
17
- params?: Map<string, string>;
18
- };
19
- export declare class EntryRequest extends Request {
20
- private params;
21
- constructor(url: string | URL, site: Site, opts?: EntryRequestOptions);
22
- /**
23
- * returns the url params from the request
24
- *
25
- * @example
26
- * ```js
27
- * router.get('/blog/:slug', async (cs, req) => {
28
- * return Response.json({ slug: cs.getParam('slug') });
29
- * });
30
- * ```
31
- */
32
- getParam(name: string): string | null;
33
- }
34
- export declare class CrelteEntryRequest extends CrelteRequest {
35
- req: EntryRequest;
36
- constructor(inner: Crelte, req: EntryRequest);
37
- }
38
- export declare function queryEntry(cr: CrelteRequest, entryQuery: GraphQlQuery): Promise<Entry>;
13
+ export declare function entryQueryVars(cr: CrelteRequest): EntryQueryVars;
14
+ export declare function queryEntry(cr: CrelteRequest, entryQuery: Query, vars: EntryQueryVars): Promise<Entry>;
15
+ export declare const ENTRY_ERROR_404: Entry;
39
16
  /**
40
17
  * Get the entry from the page
41
18
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,WAAW,EAAE,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,E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AAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IAGf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACnB,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAAE,EAAE,aAAa,GAAG,cAAc,CAchE;AAED,wBAAsB,UAAU,CAC/B,EAAE,EAAE,aAAa,EACjB,UAAU,EAAE,KAAK,EACjB,IAAI,EAAE,cAAc,GAClB,OAAO,CAAC,KAAK,CAAC,CAGhB;AAED,eAAO,MAAM,eAAe,EAAE,KAG7B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,KAAK,GAAG,IAAI,CAUpD"}
@@ -1,35 +1,4 @@
1
- import { CrelteRequest } from '../index.js';
2
- import { Request } from '../routing/index.js';
3
- import EntryRouter from './EntryRouter.js';
4
- export { EntryRouter };
5
- export class EntryRequest extends Request {
6
- params;
7
- constructor(url, site, opts = {}) {
8
- super(url, site, opts);
9
- this.params = opts.params ?? new Map();
10
- }
11
- /**
12
- * returns the url params from the request
13
- *
14
- * @example
15
- * ```js
16
- * router.get('/blog/:slug', async (cs, req) => {
17
- * return Response.json({ slug: cs.getParam('slug') });
18
- * });
19
- * ```
20
- */
21
- getParam(name) {
22
- return this.params.get(name) ?? null;
23
- }
24
- }
25
- export class CrelteEntryRequest extends CrelteRequest {
26
- req;
27
- constructor(inner, req) {
28
- super(inner, req);
29
- this.req = req;
30
- }
31
- }
32
- export async function queryEntry(cr, entryQuery) {
1
+ export function entryQueryVars(cr) {
33
2
  if (!cr.req.siteMatches())
34
3
  throw new Error('to run the entryQuery the request needs to have a matching site');
35
4
  let uri = decodeURI(cr.req.uri);
@@ -37,14 +6,16 @@ export async function queryEntry(cr, entryQuery) {
37
6
  uri = uri.substring(1);
38
7
  if (uri === '' || uri === '/')
39
8
  uri = '__home__';
40
- const vars = {
9
+ return {
41
10
  uri,
42
11
  siteId: cr.site.id,
43
12
  };
13
+ }
14
+ export async function queryEntry(cr, entryQuery, vars) {
44
15
  const page = await cr.query(entryQuery, vars);
45
- return extractEntry(page) ?? ERROR_404_ENTRY;
16
+ return extractEntry(page) ?? ENTRY_ERROR_404;
46
17
  }
47
- const ERROR_404_ENTRY = {
18
+ export const ENTRY_ERROR_404 = {
48
19
  sectionHandle: 'error',
49
20
  typeHandle: '404',
50
21
  };
@@ -57,6 +28,7 @@ const ERROR_404_ENTRY = {
57
28
  * sectionHandle will be automatically set to product
58
29
  */
59
30
  export function extractEntry(page) {
31
+ // todo instead of only spreading we should maybe objClone?
60
32
  if (page?.entry)
61
33
  return { ...page.entry };
62
34
  if (page?.product)
package/dist/index.d.ts CHANGED
@@ -1,15 +1,13 @@
1
- import type Route from './routing/Route.js';
2
- import type Router from './routing/Router.js';
1
+ import { type Route, type Router } from './routing/index.js';
3
2
  import type SsrCache from './ssr/SsrCache.js';
4
3
  import type Site from './routing/Site.js';
5
- import type GraphQl from './graphql/GraphQl.js';
6
- import Crelte, { type QueryOptions, type Config } from './Crelte.js';
7
- import CrelteRequest from './CrelteRequest.js';
4
+ import { type Crelte, type CrelteRequest, type CrelteWithRoute, type Config } from './crelte.js';
8
5
  import type { Cookies } from './cookies/index.js';
9
6
  import type { Readable } from 'crelte-std/stores';
10
7
  import { LoadData, LoadDataArray, LoadDataFn, LoadDataObj } from './loadData/index.js';
11
8
  import { Entry } from './entry/index.js';
12
- export { Crelte, CrelteRequest, type Config, type QueryOptions, type LoadData, type LoadDataFn, type LoadDataObj, type LoadDataArray, };
9
+ import Queries from './queries/Queries.js';
10
+ export { type Crelte, type CrelteWithRoute, type CrelteRequest, type Config, type LoadData, type LoadDataFn, type LoadDataObj, type LoadDataArray, };
13
11
  export type Init = (crelte: Crelte) => void;
14
12
  /**
15
13
  * Get Crelte from the current context
@@ -17,7 +15,7 @@ export type Init = (crelte: Crelte) => void;
17
15
  * ## Note
18
16
  * This only works during component initialisation.
19
17
  */
20
- export declare function getCrelte(): Crelte;
18
+ export declare function getCrelte(): CrelteWithRoute;
21
19
  /**
22
20
  * Get the router from the current context
23
21
  *
@@ -33,12 +31,12 @@ export declare function getRouter(): Router;
33
31
  */
34
32
  export declare function getSsrCache(): SsrCache;
35
33
  /**
36
- * Get the GraphQl from the current context
34
+ * Get the Queries from the current context
37
35
  *
38
36
  * ## Note
39
37
  * This only works during component initialisation.
40
38
  */
41
- export declare function getGraphQl(): GraphQl;
39
+ export declare function getQueries(): Queries;
42
40
  /**
43
41
  * Get a store with the current route
44
42
  *
@@ -63,13 +61,14 @@ export declare function getEntry(): Readable<Entry>;
63
61
  /**
64
62
  * returns an env variable from the craft/.env file.
65
63
  * All env variables need to start with VITE_
66
- * except ENDPOINT_URL and CRAFT_WEB_URL
64
+ * except ENDPOINT_URL, CRAFT_WEB_URL and FRONTEND_URL
67
65
  *
68
66
  * ## Note
69
67
  * This only works during component initialisation.
70
68
  */
71
69
  export declare function getEnv(name: 'ENDPOINT_URL'): string;
72
70
  export declare function getEnv(name: 'CRAFT_WEB_URL'): string;
71
+ export declare function getEnv(name: 'FRONTEND_URL'): string;
73
72
  export declare function getEnv(name: string): string | null;
74
73
  /**
75
74
  * returns a store which indicates if the a page is loading
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,MAAM,EAAE,EAAE,KAAK,YAAY,EA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