edges-svelte 0.5.1 → 0.5.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.
@@ -3,7 +3,7 @@ export interface ContextData {
3
3
  event?: RequestEvent;
4
4
  symbol?: symbol;
5
5
  data: {
6
- providers?: unknown;
6
+ providers?: Map<symbol, unknown>;
7
7
  [p: string]: unknown;
8
8
  };
9
9
  }
@@ -13,6 +13,7 @@ export const createProvider = (options) => {
13
13
  };
14
14
  const cacheKey = Symbol();
15
15
  const cache = options.cache ?? true;
16
+ console.log('cache-key', cacheKey);
16
17
  return () => {
17
18
  if (!cache) {
18
19
  return options.factory(deps);
@@ -28,6 +29,7 @@ export const createProvider = (options) => {
28
29
  if (!context.data.providers) {
29
30
  context.data.providers = new Map();
30
31
  }
32
+ console.log(RequestContext.current().data.providers);
31
33
  const map = context.data.providers;
32
34
  if (!map.has(cacheKey)) {
33
35
  map.set(cacheKey, options.factory(deps));
@@ -14,7 +14,7 @@ const storage = new AsyncLocalStorage();
14
14
  * and returns a 204 No Content response instead of a 404 error.
15
15
  */
16
16
  export const edgesHandle = async (event, callback, silentChromeDevtools = false) => {
17
- return await storage.run({ event: event, symbol: Symbol(), data: {} }, async () => {
17
+ return await storage.run({ event: event, symbol: Symbol(), data: { providers: new Map() } }, async () => {
18
18
  RequestContext.current = () => {
19
19
  const context = storage.getStore();
20
20
  if (context === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edges-svelte",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "license": "MIT",
5
5
  "author": "Pixel1917",
6
6
  "description": "A blazing-fast, extremely lightweight and SSR-friendly store for Svelte",