bunja 2.0.0-alpha.2 → 2.0.0-alpha.4

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/bunja.ts CHANGED
@@ -94,12 +94,7 @@ export class BunjaStore {
94
94
  this.#getScopeInstance(scope, readScope(scope)),
95
95
  ]),
96
96
  );
97
- const bunjaInstanceMap = new Map(
98
- bunja.relatedBunjas.map((relatedBunja) => [
99
- relatedBunja,
100
- this.#getBunjaInstance(relatedBunja, scopeInstanceMap),
101
- ]),
102
- );
97
+ const bunjaInstanceMap = new Map();
103
98
  bunjaFn.use = <T>(dep: Dep<T>) => {
104
99
  if (dep instanceof Bunja) {
105
100
  return bunjaInstanceMap.get(dep as Bunja<unknown>)!.value as T;
@@ -109,6 +104,12 @@ export class BunjaStore {
109
104
  }
110
105
  throw new Error("`bunja.use` can only be used with Bunja or Scope.");
111
106
  };
107
+ for (const relatedBunja of bunja.relatedBunjas) {
108
+ bunjaInstanceMap.set(
109
+ relatedBunja,
110
+ this.#getBunjaInstance(relatedBunja, scopeInstanceMap),
111
+ );
112
+ }
112
113
  const bunjaInstance = this.#getBunjaInstance(bunja, scopeInstanceMap);
113
114
  return { bunjaInstance, bunjaInstanceMap, scopeInstanceMap };
114
115
  }
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@disjukr/bunja",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.4",
4
4
  "license": "Zlib",
5
5
  "exports": {
6
6
  ".": "./bunja.ts",