@pandacss/shared 1.9.1 → 1.10.0
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/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +18 -1
- package/dist/index.mjs +18 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -23,6 +23,8 @@ declare class CacheMap<K, V> implements Map<K, V> {
|
|
|
23
23
|
keys(): MapIterator<K>;
|
|
24
24
|
values(): MapIterator<V>;
|
|
25
25
|
entries(): MapIterator<[K, V]>;
|
|
26
|
+
getOrInsert(key: K, defaultValue: V): V;
|
|
27
|
+
getOrInsertComputed(key: K, callback: (key: K) => V): V;
|
|
26
28
|
[Symbol.iterator](): MapIterator<[K, V]>;
|
|
27
29
|
[Symbol.toStringTag]: string;
|
|
28
30
|
toJSON: () => Map<K, V>;
|
|
@@ -73,6 +75,7 @@ declare class PandaError extends Error {
|
|
|
73
75
|
readonly hint?: string;
|
|
74
76
|
constructor(code: PandaErrorCode, message: string, opts?: {
|
|
75
77
|
hint?: string;
|
|
78
|
+
cause?: unknown;
|
|
76
79
|
});
|
|
77
80
|
}
|
|
78
81
|
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ declare class CacheMap<K, V> implements Map<K, V> {
|
|
|
23
23
|
keys(): MapIterator<K>;
|
|
24
24
|
values(): MapIterator<V>;
|
|
25
25
|
entries(): MapIterator<[K, V]>;
|
|
26
|
+
getOrInsert(key: K, defaultValue: V): V;
|
|
27
|
+
getOrInsertComputed(key: K, callback: (key: K) => V): V;
|
|
26
28
|
[Symbol.iterator](): MapIterator<[K, V]>;
|
|
27
29
|
[Symbol.toStringTag]: string;
|
|
28
30
|
toJSON: () => Map<K, V>;
|
|
@@ -73,6 +75,7 @@ declare class PandaError extends Error {
|
|
|
73
75
|
readonly hint?: string;
|
|
74
76
|
constructor(code: PandaErrorCode, message: string, opts?: {
|
|
75
77
|
hint?: string;
|
|
78
|
+
cause?: unknown;
|
|
76
79
|
});
|
|
77
80
|
}
|
|
78
81
|
|
package/dist/index.js
CHANGED
|
@@ -228,6 +228,23 @@ var CacheMap = class {
|
|
|
228
228
|
entries() {
|
|
229
229
|
return this.cache.entries();
|
|
230
230
|
}
|
|
231
|
+
getOrInsert(key, defaultValue) {
|
|
232
|
+
if (this.cache.has(key)) {
|
|
233
|
+
this.updateKeyUsage(key);
|
|
234
|
+
return this.cache.get(key);
|
|
235
|
+
}
|
|
236
|
+
this.set(key, defaultValue);
|
|
237
|
+
return defaultValue;
|
|
238
|
+
}
|
|
239
|
+
getOrInsertComputed(key, callback2) {
|
|
240
|
+
if (this.cache.has(key)) {
|
|
241
|
+
this.updateKeyUsage(key);
|
|
242
|
+
return this.cache.get(key);
|
|
243
|
+
}
|
|
244
|
+
const value = callback2(key);
|
|
245
|
+
this.set(key, value);
|
|
246
|
+
return value;
|
|
247
|
+
}
|
|
231
248
|
[Symbol.iterator]() {
|
|
232
249
|
return this.cache[Symbol.iterator]();
|
|
233
250
|
}
|
|
@@ -556,7 +573,7 @@ var PandaError = class extends Error {
|
|
|
556
573
|
code;
|
|
557
574
|
hint;
|
|
558
575
|
constructor(code, message, opts) {
|
|
559
|
-
super(message);
|
|
576
|
+
super(message, { cause: opts?.cause });
|
|
560
577
|
this.code = `ERR_PANDA_${code}`;
|
|
561
578
|
this.hint = opts?.hint;
|
|
562
579
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -133,6 +133,23 @@ var CacheMap = class {
|
|
|
133
133
|
entries() {
|
|
134
134
|
return this.cache.entries();
|
|
135
135
|
}
|
|
136
|
+
getOrInsert(key, defaultValue) {
|
|
137
|
+
if (this.cache.has(key)) {
|
|
138
|
+
this.updateKeyUsage(key);
|
|
139
|
+
return this.cache.get(key);
|
|
140
|
+
}
|
|
141
|
+
this.set(key, defaultValue);
|
|
142
|
+
return defaultValue;
|
|
143
|
+
}
|
|
144
|
+
getOrInsertComputed(key, callback2) {
|
|
145
|
+
if (this.cache.has(key)) {
|
|
146
|
+
this.updateKeyUsage(key);
|
|
147
|
+
return this.cache.get(key);
|
|
148
|
+
}
|
|
149
|
+
const value = callback2(key);
|
|
150
|
+
this.set(key, value);
|
|
151
|
+
return value;
|
|
152
|
+
}
|
|
136
153
|
[Symbol.iterator]() {
|
|
137
154
|
return this.cache[Symbol.iterator]();
|
|
138
155
|
}
|
|
@@ -461,7 +478,7 @@ var PandaError = class extends Error {
|
|
|
461
478
|
code;
|
|
462
479
|
hint;
|
|
463
480
|
constructor(code, message, opts) {
|
|
464
|
-
super(message);
|
|
481
|
+
super(message, { cause: opts?.cause });
|
|
465
482
|
this.code = `ERR_PANDA_${code}`;
|
|
466
483
|
this.hint = opts?.hint;
|
|
467
484
|
}
|