bunja 2.0.0-alpha.2 → 2.0.0-alpha.3
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 +7 -6
- package/deno.json +1 -1
- package/dist/{bunja-wcx846sL.js → bunja-DGNjfjPa.js} +2 -1
- package/dist/{bunja-bUA1rGXy.cjs → bunja-RF4EuS_C.cjs} +2 -1
- package/dist/bunja.cjs +1 -1
- package/dist/bunja.js +1 -1
- package/dist/react.cjs +2 -1
- package/dist/react.js +2 -1
- package/package.json +1 -1
- package/react.ts +2 -0
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
|
@@ -55,12 +55,13 @@ var BunjaStore = class {
|
|
|
55
55
|
}
|
|
56
56
|
#getBaked(bunja$1, readScope) {
|
|
57
57
|
const scopeInstanceMap = new Map(bunja$1.relatedScopes.map((scope) => [scope, this.#getScopeInstance(scope, readScope(scope))]));
|
|
58
|
-
const bunjaInstanceMap = new Map(
|
|
58
|
+
const bunjaInstanceMap = new Map();
|
|
59
59
|
bunjaFn.use = (dep) => {
|
|
60
60
|
if (dep instanceof Bunja) return bunjaInstanceMap.get(dep).value;
|
|
61
61
|
if (dep instanceof Scope) return scopeInstanceMap.get(dep).value;
|
|
62
62
|
throw new Error("`bunja.use` can only be used with Bunja or Scope.");
|
|
63
63
|
};
|
|
64
|
+
for (const relatedBunja of bunja$1.relatedBunjas) bunjaInstanceMap.set(relatedBunja, this.#getBunjaInstance(relatedBunja, scopeInstanceMap));
|
|
64
65
|
const bunjaInstance = this.#getBunjaInstance(bunja$1, scopeInstanceMap);
|
|
65
66
|
return {
|
|
66
67
|
bunjaInstance,
|
|
@@ -56,12 +56,13 @@ var BunjaStore = class {
|
|
|
56
56
|
}
|
|
57
57
|
#getBaked(bunja$1, readScope) {
|
|
58
58
|
const scopeInstanceMap = new Map(bunja$1.relatedScopes.map((scope) => [scope, this.#getScopeInstance(scope, readScope(scope))]));
|
|
59
|
-
const bunjaInstanceMap = new Map(
|
|
59
|
+
const bunjaInstanceMap = new Map();
|
|
60
60
|
bunjaFn.use = (dep) => {
|
|
61
61
|
if (dep instanceof Bunja) return bunjaInstanceMap.get(dep).value;
|
|
62
62
|
if (dep instanceof Scope) return scopeInstanceMap.get(dep).value;
|
|
63
63
|
throw new Error("`bunja.use` can only be used with Bunja or Scope.");
|
|
64
64
|
};
|
|
65
|
+
for (const relatedBunja of bunja$1.relatedBunjas) bunjaInstanceMap.set(relatedBunja, this.#getBunjaInstance(relatedBunja, scopeInstanceMap));
|
|
65
66
|
const bunjaInstance = this.#getBunjaInstance(bunja$1, scopeInstanceMap);
|
|
66
67
|
return {
|
|
67
68
|
bunjaInstance,
|
package/dist/bunja.cjs
CHANGED
package/dist/bunja.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Bunja, BunjaStore, Scope, bunja, createBunjaStore, createScope } from "./bunja-
|
|
1
|
+
import { Bunja, BunjaStore, Scope, bunja, createBunjaStore, createScope } from "./bunja-DGNjfjPa.js";
|
|
2
2
|
|
|
3
3
|
export { Bunja, BunjaStore, Scope, bunja, createBunjaStore, createScope };
|
package/dist/react.cjs
CHANGED
|
@@ -22,10 +22,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
|
|
24
24
|
//#endregion
|
|
25
|
-
const require_bunja = require('./bunja-
|
|
25
|
+
const require_bunja = require('./bunja-RF4EuS_C.cjs');
|
|
26
26
|
const { createContext, createElement, use, useEffect, useState } = __toESM(require("react"));
|
|
27
27
|
|
|
28
28
|
//#region react.ts
|
|
29
|
+
"use client";
|
|
29
30
|
const BunjaStoreContext = createContext(require_bunja.createBunjaStore());
|
|
30
31
|
function BunjaStoreProvider({ children }) {
|
|
31
32
|
const [value] = useState(require_bunja.createBunjaStore);
|
package/dist/react.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { createBunjaStore, createScope } from "./bunja-
|
|
1
|
+
import { createBunjaStore, createScope } from "./bunja-DGNjfjPa.js";
|
|
2
2
|
import { createContext, createElement, use, useEffect, useState } from "react";
|
|
3
3
|
|
|
4
4
|
//#region react.ts
|
|
5
|
+
"use client";
|
|
5
6
|
const BunjaStoreContext = createContext(createBunjaStore());
|
|
6
7
|
function BunjaStoreProvider({ children }) {
|
|
7
8
|
const [value] = useState(createBunjaStore);
|
package/package.json
CHANGED