@snipl/official-registry 1.0.0-next.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/LICENSE +21 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/items/clamp.d.ts +2 -0
- package/dist/src/items/clamp.d.ts.map +1 -0
- package/dist/src/items/clamp.js +7 -0
- package/dist/src/items/clamp.js.map +1 -0
- package/dist/src/items/debounce.d.ts +11 -0
- package/dist/src/items/debounce.d.ts.map +1 -0
- package/dist/src/items/debounce.js +45 -0
- package/dist/src/items/debounce.js.map +1 -0
- package/dist/src/items/deep-clone.d.ts +5 -0
- package/dist/src/items/deep-clone.d.ts.map +1 -0
- package/dist/src/items/deep-clone.js +45 -0
- package/dist/src/items/deep-clone.js.map +1 -0
- package/dist/src/items/memoize.d.ts +6 -0
- package/dist/src/items/memoize.d.ts.map +1 -0
- package/dist/src/items/memoize.js +19 -0
- package/dist/src/items/memoize.js.map +1 -0
- package/dist/src/items/retry.d.ts +9 -0
- package/dist/src/items/retry.d.ts.map +1 -0
- package/dist/src/items/retry.js +24 -0
- package/dist/src/items/retry.js.map +1 -0
- package/dist/src/items/sleep.d.ts +4 -0
- package/dist/src/items/sleep.d.ts.map +1 -0
- package/dist/src/items/sleep.js +17 -0
- package/dist/src/items/sleep.js.map +1 -0
- package/dist/src/items/slugify.d.ts +7 -0
- package/dist/src/items/slugify.d.ts.map +1 -0
- package/dist/src/items/slugify.js +20 -0
- package/dist/src/items/slugify.js.map +1 -0
- package/dist/src/items/throttle.d.ts +10 -0
- package/dist/src/items/throttle.d.ts.map +1 -0
- package/dist/src/items/throttle.js +31 -0
- package/dist/src/items/throttle.js.map +1 -0
- package/dist/src/registry.d.ts +3 -0
- package/dist/src/registry.d.ts.map +1 -0
- package/dist/src/registry.js +370 -0
- package/dist/src/registry.js.map +1 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Snippet CLI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clamp.d.ts","sourceRoot":"","sources":["../../../src/items/clamp.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKrE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function clamp(value, min, max) {
|
|
2
|
+
if (typeof value !== 'number' || typeof min !== 'number' || typeof max !== 'number') {
|
|
3
|
+
throw new TypeError('All arguments must be numbers');
|
|
4
|
+
}
|
|
5
|
+
return Math.min(max, Math.max(min, value));
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=clamp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clamp.js","sourceRoot":"","sources":["../../../src/items/clamp.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IAC3D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACpF,MAAM,IAAI,SAAS,CAAC,+BAA+B,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface DebounceOptions {
|
|
2
|
+
leading?: boolean;
|
|
3
|
+
trailing?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface DebouncedFunction<T extends (...args: any[]) => any> {
|
|
6
|
+
(...args: Parameters<T>): void;
|
|
7
|
+
cancel: () => void;
|
|
8
|
+
flush: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function debounce<T extends (...args: any[]) => any>(fn: T, wait: number, options?: DebounceOptions): DebouncedFunction<T>;
|
|
11
|
+
//# sourceMappingURL=debounce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../../src/items/debounce.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG;IAClE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,EAAE,EAAE,CAAC,EACL,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,eAAe,GACxB,iBAAiB,CAAC,CAAC,CAAC,CA8CtB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function debounce(fn, wait, options) {
|
|
2
|
+
let timer = null;
|
|
3
|
+
let lastArgs = null;
|
|
4
|
+
let leadingInvoked = false;
|
|
5
|
+
const { leading = false, trailing = true } = options ?? {};
|
|
6
|
+
function invoke() {
|
|
7
|
+
if (lastArgs) {
|
|
8
|
+
fn(...lastArgs);
|
|
9
|
+
lastArgs = null;
|
|
10
|
+
leadingInvoked = true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const debounced = function (...args) {
|
|
14
|
+
lastArgs = args;
|
|
15
|
+
if (timer)
|
|
16
|
+
clearTimeout(timer);
|
|
17
|
+
if (leading && !leadingInvoked) {
|
|
18
|
+
invoke();
|
|
19
|
+
leadingInvoked = true;
|
|
20
|
+
}
|
|
21
|
+
timer = setTimeout(() => {
|
|
22
|
+
if (trailing)
|
|
23
|
+
invoke();
|
|
24
|
+
timer = null;
|
|
25
|
+
leadingInvoked = false;
|
|
26
|
+
}, wait);
|
|
27
|
+
};
|
|
28
|
+
debounced.cancel = () => {
|
|
29
|
+
if (timer)
|
|
30
|
+
clearTimeout(timer);
|
|
31
|
+
timer = null;
|
|
32
|
+
lastArgs = null;
|
|
33
|
+
leadingInvoked = false;
|
|
34
|
+
};
|
|
35
|
+
debounced.flush = () => {
|
|
36
|
+
if (timer) {
|
|
37
|
+
clearTimeout(timer);
|
|
38
|
+
timer = null;
|
|
39
|
+
invoke();
|
|
40
|
+
leadingInvoked = false;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return debounced;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=debounce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../../src/items/debounce.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,QAAQ,CACtB,EAAK,EACL,IAAY,EACZ,OAAyB;IAEzB,IAAI,KAAK,GAAyC,IAAI,CAAC;IACvD,IAAI,QAAQ,GAAyB,IAAI,CAAC;IAC1C,IAAI,cAAc,GAAG,KAAK,CAAC;IAE3B,MAAM,EAAE,OAAO,GAAG,KAAK,EAAE,QAAQ,GAAG,IAAI,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE3D,SAAS,MAAM;QACb,IAAI,QAAQ,EAAE,CAAC;YACb,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC;YAChB,QAAQ,GAAG,IAAI,CAAC;YAChB,cAAc,GAAG,IAAI,CAAC;QACxB,CAAC;IACH,CAAC;IAED,MAAM,SAAS,GAAyB,UAAU,GAAG,IAAmB;QACtE,QAAQ,GAAG,IAAI,CAAC;QAChB,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;YAC/B,MAAM,EAAE,CAAC;YACT,cAAc,GAAG,IAAI,CAAC;QACxB,CAAC;QACD,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YACtB,IAAI,QAAQ;gBAAE,MAAM,EAAE,CAAC;YACvB,KAAK,GAAG,IAAI,CAAC;YACb,cAAc,GAAG,KAAK,CAAC;QACzB,CAAC,EAAE,IAAI,CAAC,CAAC;IACX,CAAC,CAAC;IAEF,SAAS,CAAC,MAAM,GAAG,GAAG,EAAE;QACtB,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/B,KAAK,GAAG,IAAI,CAAC;QACb,QAAQ,GAAG,IAAI,CAAC;QAChB,cAAc,GAAG,KAAK,CAAC;IACzB,CAAC,CAAC;IAEF,SAAS,CAAC,KAAK,GAAG,GAAG,EAAE;QACrB,IAAI,KAAK,EAAE,CAAC;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,KAAK,GAAG,IAAI,CAAC;YACb,MAAM,EAAE,CAAC;YACT,cAAc,GAAG,KAAK,CAAC;QACzB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep-clone.d.ts","sourceRoot":"","sources":["../../../src/items/deep-clone.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,CAAC,CAuCpE"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function deepClone(value, options) {
|
|
2
|
+
const seen = new WeakMap();
|
|
3
|
+
const { maxDepth = 100 } = options ?? {};
|
|
4
|
+
function clone(val, depth) {
|
|
5
|
+
if (depth > maxDepth)
|
|
6
|
+
throw new Error('Maximum clone depth exceeded');
|
|
7
|
+
if (val === null || typeof val !== 'object')
|
|
8
|
+
return val;
|
|
9
|
+
if (seen.has(val))
|
|
10
|
+
return seen.get(val);
|
|
11
|
+
if (val instanceof Date)
|
|
12
|
+
return new Date(val.getTime());
|
|
13
|
+
if (val instanceof RegExp)
|
|
14
|
+
return new RegExp(val.source, val.flags);
|
|
15
|
+
if (val instanceof Map) {
|
|
16
|
+
const result = new Map();
|
|
17
|
+
seen.set(val, result);
|
|
18
|
+
for (const [k, v] of val)
|
|
19
|
+
result.set(clone(k, depth + 1), clone(v, depth + 1));
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
if (val instanceof Set) {
|
|
23
|
+
const result = new Set();
|
|
24
|
+
seen.set(val, result);
|
|
25
|
+
for (const v of val)
|
|
26
|
+
result.add(clone(v, depth + 1));
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
if (Array.isArray(val)) {
|
|
30
|
+
const result = [];
|
|
31
|
+
seen.set(val, result);
|
|
32
|
+
for (const v of val)
|
|
33
|
+
result.push(clone(v, depth + 1));
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
const result = {};
|
|
37
|
+
seen.set(val, result);
|
|
38
|
+
for (const key of Object.keys(val)) {
|
|
39
|
+
result[key] = clone(val[key], depth + 1);
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
return clone(value, 0);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=deep-clone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep-clone.js","sourceRoot":"","sources":["../../../src/items/deep-clone.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,SAAS,CAAI,KAAQ,EAAE,OAA0B;IAC/D,MAAM,IAAI,GAAG,IAAI,OAAO,EAAkB,CAAC;IAC3C,MAAM,EAAE,QAAQ,GAAG,GAAG,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAEzC,SAAS,KAAK,CAAC,GAAY,EAAE,KAAa;Q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,EAAE,CAAC;YACvB,MAAM,MAAM,GAAc,EAAE,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YACtB,KAAK,MAAM,CAAC,IAAI,GAAG;gBAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;YACtD,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,MAAM,GAA4B,EAAE,CAAC;QAC3C,IAAI,CAAC,GAAG,CAAC,GAAa,EAAE,MAAM,CAAC,CAAC;QAChC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAa,CAAC,EAAE,CAAC;YAC7C,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAE,GAA+B,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC,CAAM,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoize.d.ts","sourceRoot":"","sources":["../../../src/items/memoize.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAC;CACpC;AAED,wBAAgB,OAAO,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,CAAC,CAiB7F"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function memoize(fn, options) {
|
|
2
|
+
const cache = new Map();
|
|
3
|
+
const { maxSize = Infinity, keyFn = (...args) => JSON.stringify(args) } = options ?? {};
|
|
4
|
+
const memoized = function (...args) {
|
|
5
|
+
const key = keyFn(...args);
|
|
6
|
+
if (cache.has(key))
|
|
7
|
+
return cache.get(key);
|
|
8
|
+
const result = fn(...args);
|
|
9
|
+
cache.set(key, result);
|
|
10
|
+
if (cache.size > maxSize) {
|
|
11
|
+
const first = cache.keys().next().value;
|
|
12
|
+
if (first !== undefined)
|
|
13
|
+
cache.delete(first);
|
|
14
|
+
}
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
17
|
+
return memoized;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=memoize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoize.js","sourceRoot":"","sources":["../../../src/items/memoize.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,OAAO,CAAoC,EAAK,EAAE,OAAwB;IACxF,MAAM,KAAK,GAAG,IAAI,GAAG,EAAyB,CAAC;IAC/C,MAAM,EAAE,OAAO,GAAG,QAAQ,EAAE,KAAK,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE/F,MAAM,QAAQ,GAAG,UAAU,GAAG,IAAW;QACvC,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;QAC3B,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QAC3B,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACvB,IAAI,KAAK,CAAC,IAAI,GAAG,OAAO,EAAE,CAAC;YACzB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;YACxC,IAAI,KAAK,KAAK,SAAS;gBAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO,QAAwB,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface RetryOptions {
|
|
2
|
+
attempts?: number;
|
|
3
|
+
baseDelay?: number;
|
|
4
|
+
maxDelay?: number;
|
|
5
|
+
jitter?: boolean;
|
|
6
|
+
retryPredicate?: (error: unknown) => boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function retry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
|
|
9
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/items/retry.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CAC9C;AAED,wBAAsB,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,CAuBvF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export async function retry(fn, options) {
|
|
2
|
+
const { attempts = 3, baseDelay = 1000, maxDelay = 30000, jitter = false, retryPredicate, } = options ?? {};
|
|
3
|
+
let lastError;
|
|
4
|
+
for (let attempt = 0; attempt < attempts; attempt++) {
|
|
5
|
+
try {
|
|
6
|
+
return await fn();
|
|
7
|
+
}
|
|
8
|
+
catch (err) {
|
|
9
|
+
lastError = err;
|
|
10
|
+
if (retryPredicate && !retryPredicate(err))
|
|
11
|
+
throw err;
|
|
12
|
+
if (attempt === attempts - 1)
|
|
13
|
+
throw err;
|
|
14
|
+
let delay = baseDelay * Math.pow(2, attempt);
|
|
15
|
+
if (jitter)
|
|
16
|
+
delay = delay * (0.5 + Math.random() * 0.5);
|
|
17
|
+
if (delay > maxDelay)
|
|
18
|
+
delay = maxDelay;
|
|
19
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
throw lastError;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../../src/items/retry.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,KAAK,UAAU,KAAK,CAAI,EAAoB,EAAE,OAAsB;IACzE,MAAM,EACJ,QAAQ,GAAG,CAAC,EACZ,SAAS,GAAG,IAAI,EAChB,QAAQ,GAAG,KAAK,EAChB,MAAM,GAAG,KAAK,EACd,cAAc,GACf,GAAG,OAAO,IAAI,EAAE,CAAC;IAClB,IAAI,SAAkB,CAAC;IACvB,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC;QACpD,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,EAAE,CAAC;QACpB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,SAAS,GAAG,GAAG,CAAC;YAChB,IAAI,cAAc,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC;gBAAE,MAAM,GAAG,CAAC;YACtD,IAAI,OAAO,KAAK,QAAQ,GAAG,CAAC;gBAAE,MAAM,GAAG,CAAC;YACxC,IAAI,KAAK,GAAG,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YAC7C,IAAI,MAAM;gBAAE,KAAK,GAAG,KAAK,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC;YACxD,IAAI,KAAK,GAAG,QAAQ;gBAAE,KAAK,GAAG,QAAQ,CAAC;YACvC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IACD,MAAM,SAAS,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../src/items/sleep.ts"],"names":[],"mappings":"AAAA,wBAAsB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAczF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export async function sleep(ms, options) {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
if (ms < 0)
|
|
4
|
+
ms = 0;
|
|
5
|
+
if (options?.signal?.aborted) {
|
|
6
|
+
reject(new Error('The operation was aborted'));
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const timer = setTimeout(resolve, ms);
|
|
10
|
+
const onAbort = () => {
|
|
11
|
+
clearTimeout(timer);
|
|
12
|
+
reject(new Error('The operation was aborted'));
|
|
13
|
+
};
|
|
14
|
+
options?.signal?.addEventListener('abort', onAbort, { once: true });
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=sleep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../../src/items/sleep.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,EAAU,EAAE,OAAkC;IACxE,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,IAAI,EAAE,GAAG,CAAC;YAAE,EAAE,GAAG,CAAC,CAAC;QACnB,IAAI,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;YAC7B,MAAM,CAAC,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAC;YAC/C,OAAO;QACT,CAAC;QACD,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACtC,MAAM,OAAO,GAAG,GAAS,EAAE;YACzB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACjD,CAAC,CAAC;QACF,OAAO,EAAE,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugify.d.ts","sourceRoot":"","sources":["../../../src/items/slugify.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAgBrE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function slugify(str, options) {
|
|
2
|
+
const { separator = '-', lower = true, strict = true } = options ?? {};
|
|
3
|
+
let result = str.normalize('NFKD').replace(/[\u0300-\u036f]/g, '');
|
|
4
|
+
if (lower)
|
|
5
|
+
result = result.toLowerCase();
|
|
6
|
+
if (strict) {
|
|
7
|
+
result = result.replace(/[^a-z0-9\s-]/g, '');
|
|
8
|
+
result = result.replace(/[^a-z0-9]/g, separator);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
result = result.replace(/[^a-z0-9\s-]/g, '');
|
|
12
|
+
}
|
|
13
|
+
result = result.trim().replace(/\s+/g, separator);
|
|
14
|
+
const escaped = separator.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
15
|
+
const multiSep = new RegExp(`${escaped}+`, 'g');
|
|
16
|
+
const edgeSep = new RegExp(`^${escaped}|${escaped}$`, 'g');
|
|
17
|
+
result = result.replace(multiSep, separator).replace(edgeSep, '');
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=slugify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugify.js","sourceRoot":"","sources":["../../../src/items/slugify.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,OAAO,CAAC,GAAW,EAAE,OAAwB;IAC3D,MAAM,EAAE,SAAS,GAAG,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IACvE,IAAI,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IACnE,IAAI,KAAK;QAAE,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACzC,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;QAC7C,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,GAAG,OAAO,GAAG,EAAE,GAAG,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,IAAI,OAAO,IAAI,OAAO,GAAG,EAAE,GAAG,CAAC,CAAC;IAC3D,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAClE,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ThrottleOptions {
|
|
2
|
+
leading?: boolean;
|
|
3
|
+
trailing?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface ThrottledFunction<T extends (...args: any[]) => any> {
|
|
6
|
+
(...args: Parameters<T>): void;
|
|
7
|
+
cancel: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function throttle<T extends (...args: any[]) => any>(fn: T, wait: number, options?: ThrottleOptions): ThrottledFunction<T>;
|
|
10
|
+
//# sourceMappingURL=throttle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../../src/items/throttle.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG;IAClE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,EAAE,EAAE,CAAC,EACL,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,eAAe,GACxB,iBAAiB,CAAC,CAAC,CAAC,CA8BtB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function throttle(fn, wait, options) {
|
|
2
|
+
let timer = null;
|
|
3
|
+
let lastArgs = null;
|
|
4
|
+
const { leading = true, trailing = true } = options ?? {};
|
|
5
|
+
function invoke(args) {
|
|
6
|
+
fn(...args);
|
|
7
|
+
lastArgs = null;
|
|
8
|
+
}
|
|
9
|
+
const throttled = function (...args) {
|
|
10
|
+
if (timer) {
|
|
11
|
+
if (trailing)
|
|
12
|
+
lastArgs = args;
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (leading)
|
|
16
|
+
invoke(args);
|
|
17
|
+
timer = setTimeout(() => {
|
|
18
|
+
if (trailing && lastArgs)
|
|
19
|
+
invoke(lastArgs);
|
|
20
|
+
timer = null;
|
|
21
|
+
}, wait);
|
|
22
|
+
};
|
|
23
|
+
throttled.cancel = () => {
|
|
24
|
+
if (timer)
|
|
25
|
+
clearTimeout(timer);
|
|
26
|
+
timer = null;
|
|
27
|
+
lastArgs = null;
|
|
28
|
+
};
|
|
29
|
+
return throttled;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=throttle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttle.js","sourceRoot":"","sources":["../../../src/items/throttle.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,QAAQ,CACtB,EAAK,EACL,IAAY,EACZ,OAAyB;IAEzB,IAAI,KAAK,GAAyC,IAAI,CAAC;IACvD,IAAI,QAAQ,GAAyB,IAAI,CAAC;IAE1C,MAAM,EAAE,OAAO,GAAG,IAAI,EAAE,QAAQ,GAAG,IAAI,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE1D,SAAS,MAAM,CAAC,IAAmB;QACjC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QACZ,QAAQ,GAAG,IAAI,CAAC;IAClB,CAAC;IAED,MAAM,SAAS,GAAyB,UAAU,GAAG,IAAmB;QACtE,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,QAAQ;gBAAE,QAAQ,GAAG,IAAI,CAAC;YAC9B,OAAO;QACT,CAAC;QACD,IAAI,OAAO;YAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAC1B,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YACtB,IAAI,QAAQ,IAAI,QAAQ;gBAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC3C,KAAK,GAAG,IAAI,CAAC;QACf,CAAC,EAAE,IAAI,CAAC,CAAC;IACX,CAAC,CAAC;IAEF,SAAS,CAAC,MAAM,GAAG,GAAG,EAAE;QACtB,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/B,KAAK,GAAG,IAAI,CAAC;QACb,QAAQ,GAAG,IAAI,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AA8V3D,wBAAgB,kBAAkB,IAAI,YAAY,EAAE,CA+BnD"}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import * as crypto from 'crypto';
|
|
2
|
+
import { RegistryItemSchema, safeParse } from '@snipl/registry-schema';
|
|
3
|
+
const itemDefs = [
|
|
4
|
+
{
|
|
5
|
+
name: 'sleep',
|
|
6
|
+
summary: 'Delay execution for a given duration',
|
|
7
|
+
tags: ['async', 'timer', 'utility'],
|
|
8
|
+
environments: ['node', 'browser'],
|
|
9
|
+
exports: [{ name: 'sleep', kind: 'function' }],
|
|
10
|
+
getSource: () => {
|
|
11
|
+
// Keep in sync with src/items/sleep.ts
|
|
12
|
+
return `export async function sleep(ms: number, options?: { signal?: AbortSignal }): Promise<void> {
|
|
13
|
+
return new Promise<void>((resolve, reject) => {
|
|
14
|
+
if (ms < 0) ms = 0;
|
|
15
|
+
if (options?.signal?.aborted) {
|
|
16
|
+
reject(new Error('The operation was aborted'));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const timer = setTimeout(resolve, ms);
|
|
20
|
+
const onAbort = (): void => {
|
|
21
|
+
clearTimeout(timer);
|
|
22
|
+
reject(new Error('The operation was aborted'));
|
|
23
|
+
};
|
|
24
|
+
options?.signal?.addEventListener('abort', onAbort, { once: true });
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'retry',
|
|
32
|
+
summary: 'Retry an async operation with configurable backoff',
|
|
33
|
+
tags: ['async', 'retry', 'resilience'],
|
|
34
|
+
environments: ['node', 'browser', 'universal'],
|
|
35
|
+
exports: [
|
|
36
|
+
{ name: 'retry', kind: 'function' },
|
|
37
|
+
{ name: 'RetryOptions', kind: 'type' },
|
|
38
|
+
],
|
|
39
|
+
getSource: () => {
|
|
40
|
+
// Keep in sync with src/items/retry.ts
|
|
41
|
+
return `export interface RetryOptions {
|
|
42
|
+
attempts?: number;
|
|
43
|
+
baseDelay?: number;
|
|
44
|
+
maxDelay?: number;
|
|
45
|
+
jitter?: boolean;
|
|
46
|
+
retryPredicate?: (error: unknown) => boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function retry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T> {
|
|
50
|
+
const { attempts = 3, baseDelay = 1000, maxDelay = 30000, jitter = false, retryPredicate } = options ?? {};
|
|
51
|
+
let lastError: unknown;
|
|
52
|
+
for (let attempt = 0; attempt < attempts; attempt++) {
|
|
53
|
+
try {
|
|
54
|
+
return await fn();
|
|
55
|
+
} catch (err) {
|
|
56
|
+
lastError = err;
|
|
57
|
+
if (retryPredicate && !retryPredicate(err)) throw err;
|
|
58
|
+
if (attempt === attempts - 1) throw err;
|
|
59
|
+
let delay = baseDelay * Math.pow(2, attempt);
|
|
60
|
+
if (jitter) delay = delay * (0.5 + Math.random() * 0.5);
|
|
61
|
+
if (delay > maxDelay) delay = maxDelay;
|
|
62
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
throw lastError;
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'debounce',
|
|
72
|
+
summary: 'Create a debounced function that delays invocation',
|
|
73
|
+
tags: ['async', 'timer', 'performance'],
|
|
74
|
+
environments: ['node', 'browser', 'universal'],
|
|
75
|
+
exports: [{ name: 'debounce', kind: 'function' }],
|
|
76
|
+
getSource: () => {
|
|
77
|
+
// Keep in sync with src/items/debounce.ts
|
|
78
|
+
return `export interface DebounceOptions {
|
|
79
|
+
leading?: boolean;
|
|
80
|
+
trailing?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface DebouncedFunction<T extends (...args: any[]) => any> {
|
|
84
|
+
(...args: Parameters<T>): void;
|
|
85
|
+
cancel: () => void;
|
|
86
|
+
flush: () => void;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function debounce<T extends (...args: any[]) => any>(
|
|
90
|
+
fn: T,
|
|
91
|
+
wait: number,
|
|
92
|
+
options?: DebounceOptions,
|
|
93
|
+
): DebouncedFunction<T> {
|
|
94
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
95
|
+
let lastArgs: Parameters<T> | null = null;
|
|
96
|
+
let leadingInvoked = false;
|
|
97
|
+
|
|
98
|
+
const { leading = false, trailing = true } = options ?? {};
|
|
99
|
+
|
|
100
|
+
function invoke(): void {
|
|
101
|
+
if (lastArgs) {
|
|
102
|
+
fn(...lastArgs);
|
|
103
|
+
lastArgs = null;
|
|
104
|
+
leadingInvoked = true;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const debounced: DebouncedFunction<T> = function (...args: Parameters<T>) {
|
|
109
|
+
lastArgs = args;
|
|
110
|
+
if (timer) clearTimeout(timer);
|
|
111
|
+
if (leading && !leadingInvoked) {
|
|
112
|
+
invoke();
|
|
113
|
+
leadingInvoked = true;
|
|
114
|
+
}
|
|
115
|
+
timer = setTimeout(() => {
|
|
116
|
+
if (trailing) invoke();
|
|
117
|
+
timer = null;
|
|
118
|
+
leadingInvoked = false;
|
|
119
|
+
}, wait);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
debounced.cancel = () => {
|
|
123
|
+
if (timer) clearTimeout(timer);
|
|
124
|
+
timer = null;
|
|
125
|
+
lastArgs = null;
|
|
126
|
+
leadingInvoked = false;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
debounced.flush = () => {
|
|
130
|
+
if (timer) {
|
|
131
|
+
clearTimeout(timer);
|
|
132
|
+
timer = null;
|
|
133
|
+
invoke();
|
|
134
|
+
leadingInvoked = false;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
return debounced;
|
|
139
|
+
}
|
|
140
|
+
`;
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'throttle',
|
|
145
|
+
summary: 'Create a throttled function that limits invocation rate',
|
|
146
|
+
tags: ['async', 'timer', 'performance'],
|
|
147
|
+
environments: ['node', 'browser', 'universal'],
|
|
148
|
+
exports: [{ name: 'throttle', kind: 'function' }],
|
|
149
|
+
getSource: () => {
|
|
150
|
+
// Keep in sync with src/items/throttle.ts
|
|
151
|
+
return `export interface ThrottleOptions {
|
|
152
|
+
leading?: boolean;
|
|
153
|
+
trailing?: boolean;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface ThrottledFunction<T extends (...args: any[]) => any> {
|
|
157
|
+
(...args: Parameters<T>): void;
|
|
158
|
+
cancel: () => void;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function throttle<T extends (...args: any[]) => any>(
|
|
162
|
+
fn: T,
|
|
163
|
+
wait: number,
|
|
164
|
+
options?: ThrottleOptions,
|
|
165
|
+
): ThrottledFunction<T> {
|
|
166
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
167
|
+
let lastArgs: Parameters<T> | null = null;
|
|
168
|
+
|
|
169
|
+
const { leading = true, trailing = true } = options ?? {};
|
|
170
|
+
|
|
171
|
+
function invoke(args: Parameters<T>): void {
|
|
172
|
+
fn(...args);
|
|
173
|
+
lastArgs = null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const throttled: ThrottledFunction<T> = function (...args: Parameters<T>) {
|
|
177
|
+
if (timer) {
|
|
178
|
+
if (trailing) lastArgs = args;
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (leading) invoke(args);
|
|
182
|
+
timer = setTimeout(() => {
|
|
183
|
+
if (trailing && lastArgs) invoke(lastArgs);
|
|
184
|
+
timer = null;
|
|
185
|
+
}, wait);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
throttled.cancel = () => {
|
|
189
|
+
if (timer) clearTimeout(timer);
|
|
190
|
+
timer = null;
|
|
191
|
+
lastArgs = null;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
return throttled;
|
|
195
|
+
}
|
|
196
|
+
`;
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: 'memoize',
|
|
201
|
+
summary: 'Memoize a function with configurable cache key',
|
|
202
|
+
tags: ['cache', 'performance', 'utility'],
|
|
203
|
+
environments: ['node', 'browser', 'universal'],
|
|
204
|
+
exports: [{ name: 'memoize', kind: 'function' }],
|
|
205
|
+
getSource: () => {
|
|
206
|
+
// Keep in sync with src/items/memoize.ts
|
|
207
|
+
return `export interface MemoizeOptions {
|
|
208
|
+
maxSize?: number;
|
|
209
|
+
keyFn?: (...args: any[]) => string;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export function memoize<T extends (...args: any[]) => any>(fn: T, options?: MemoizeOptions): T {
|
|
213
|
+
const cache = new Map<string, ReturnType<T>>();
|
|
214
|
+
const { maxSize = Infinity, keyFn = (...args: any[]) => JSON.stringify(args) } = options ?? {};
|
|
215
|
+
|
|
216
|
+
const memoized = function (...args: any[]): any {
|
|
217
|
+
const key = keyFn(...args);
|
|
218
|
+
if (cache.has(key)) return cache.get(key);
|
|
219
|
+
const result = fn(...args);
|
|
220
|
+
cache.set(key, result);
|
|
221
|
+
if (cache.size > maxSize) {
|
|
222
|
+
const first = cache.keys().next().value;
|
|
223
|
+
if (first !== undefined) cache.delete(first);
|
|
224
|
+
}
|
|
225
|
+
return result;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
return memoized as unknown as T;
|
|
229
|
+
}
|
|
230
|
+
`;
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: 'deep-clone',
|
|
235
|
+
summary: 'Deep clone a value with circular reference handling',
|
|
236
|
+
tags: ['clone', 'object', 'utility'],
|
|
237
|
+
environments: ['node', 'browser', 'universal'],
|
|
238
|
+
exports: [{ name: 'deepClone', kind: 'function' }],
|
|
239
|
+
getSource: () => {
|
|
240
|
+
// Keep in sync with src/items/deep-clone.ts
|
|
241
|
+
return `export interface DeepCloneOptions {
|
|
242
|
+
maxDepth?: number;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export function deepClone<T>(value: T, options?: DeepCloneOptions): T {
|
|
246
|
+
const seen = new WeakMap<object, object>();
|
|
247
|
+
const { maxDepth = 100 } = options ?? {};
|
|
248
|
+
|
|
249
|
+
function clone(val: unknown, depth: number): unknown {
|
|
250
|
+
if (depth > maxDepth) throw new Error('Maximum clone depth exceeded');
|
|
251
|
+
if (val === null || typeof val !== 'object') return val;
|
|
252
|
+
if (seen.has(val as object)) return seen.get(val as object);
|
|
253
|
+
|
|
254
|
+
if (val instanceof Date) return new Date(val.getTime());
|
|
255
|
+
if (val instanceof RegExp) return new RegExp(val.source, val.flags);
|
|
256
|
+
if (val instanceof Map) {
|
|
257
|
+
const result = new Map();
|
|
258
|
+
seen.set(val, result);
|
|
259
|
+
for (const [k, v] of val) result.set(clone(k, depth + 1), clone(v, depth + 1));
|
|
260
|
+
return result;
|
|
261
|
+
}
|
|
262
|
+
if (val instanceof Set) {
|
|
263
|
+
const result = new Set();
|
|
264
|
+
seen.set(val, result);
|
|
265
|
+
for (const v of val) result.add(clone(v, depth + 1));
|
|
266
|
+
return result;
|
|
267
|
+
}
|
|
268
|
+
if (Array.isArray(val)) {
|
|
269
|
+
const result: unknown[] = [];
|
|
270
|
+
seen.set(val, result);
|
|
271
|
+
for (const v of val) result.push(clone(v, depth + 1));
|
|
272
|
+
return result;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const result: Record<string, unknown> = {};
|
|
276
|
+
seen.set(val as object, result);
|
|
277
|
+
for (const key of Object.keys(val as object)) {
|
|
278
|
+
result[key] = clone((val as Record<string, unknown>)[key], depth + 1);
|
|
279
|
+
}
|
|
280
|
+
return result;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return clone(value, 0) as T;
|
|
284
|
+
}
|
|
285
|
+
`;
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
name: 'clamp',
|
|
290
|
+
summary: 'Clamp a number within a specified range',
|
|
291
|
+
tags: ['math', 'utility'],
|
|
292
|
+
environments: ['node', 'browser', 'universal'],
|
|
293
|
+
exports: [{ name: 'clamp', kind: 'function' }],
|
|
294
|
+
getSource: () => {
|
|
295
|
+
// Keep in sync with src/items/clamp.ts
|
|
296
|
+
return `export function clamp(value: number, min: number, max: number): number {
|
|
297
|
+
if (typeof value !== 'number' || typeof min !== 'number' || typeof max !== 'number') {
|
|
298
|
+
throw new TypeError('All arguments must be numbers');
|
|
299
|
+
}
|
|
300
|
+
return Math.min(max, Math.max(min, value));
|
|
301
|
+
}
|
|
302
|
+
`;
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
name: 'slugify',
|
|
307
|
+
summary: 'Convert a string to a URL-friendly slug',
|
|
308
|
+
tags: ['string', 'url', 'utility'],
|
|
309
|
+
environments: ['node', 'browser', 'universal'],
|
|
310
|
+
exports: [{ name: 'slugify', kind: 'function' }],
|
|
311
|
+
getSource: () => {
|
|
312
|
+
// Keep in sync with src/items/slugify.ts
|
|
313
|
+
return `export interface SlugifyOptions {
|
|
314
|
+
separator?: string;
|
|
315
|
+
lower?: boolean;
|
|
316
|
+
strict?: boolean;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export function slugify(str: string, options?: SlugifyOptions): string {
|
|
320
|
+
const { separator = '-', lower = true, strict = true } = options ?? {};
|
|
321
|
+
let result = str.normalize('NFKD').replace(/[\\u0300-\\u036f]/g, '');
|
|
322
|
+
if (lower) result = result.toLowerCase();
|
|
323
|
+
if (strict) {
|
|
324
|
+
result = result.replace(/[^a-z0-9\\s-]/g, '');
|
|
325
|
+
result = result.replace(/[^a-z0-9]/g, separator);
|
|
326
|
+
} else {
|
|
327
|
+
result = result.replace(/[^a-z0-9\\s-]/g, '');
|
|
328
|
+
}
|
|
329
|
+
result = result.trim().replace(/\\s+/g, separator);
|
|
330
|
+
const escaped = separator.replace(/[.*+?^\${}()|[\\]\\\\]/g, '\\\\$&');
|
|
331
|
+
const multiSep = new RegExp(escaped + '+', 'g');
|
|
332
|
+
const edgeSep = new RegExp('^' + escaped + '|' + escaped + '$', 'g');
|
|
333
|
+
result = result.replace(multiSep, separator).replace(edgeSep, '');
|
|
334
|
+
return result;
|
|
335
|
+
}
|
|
336
|
+
`;
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
];
|
|
340
|
+
export function buildRegistryItems() {
|
|
341
|
+
return itemDefs.map((def) => {
|
|
342
|
+
const content = def.getSource();
|
|
343
|
+
const sha256 = crypto.createHash('sha256').update(content, 'utf-8').digest('hex');
|
|
344
|
+
const item = {
|
|
345
|
+
schemaVersion: 1,
|
|
346
|
+
name: def.name,
|
|
347
|
+
version: '0.1.0',
|
|
348
|
+
summary: def.summary,
|
|
349
|
+
tags: def.tags,
|
|
350
|
+
language: 'ts',
|
|
351
|
+
environments: def.environments,
|
|
352
|
+
exports: def.exports,
|
|
353
|
+
files: [{ path: `${def.name}.ts`, content, sha256 }],
|
|
354
|
+
dependencies: [],
|
|
355
|
+
templateVariables: [],
|
|
356
|
+
license: { spdx: 'MIT', source: 'original' },
|
|
357
|
+
tests: [],
|
|
358
|
+
docs: {
|
|
359
|
+
usage: `import { ${def.exports.map((e) => e.name).join(', ')} } from './${def.name}.js';`,
|
|
360
|
+
caveats: [],
|
|
361
|
+
},
|
|
362
|
+
};
|
|
363
|
+
const result = safeParse(RegistryItemSchema, item);
|
|
364
|
+
if (!result.success) {
|
|
365
|
+
throw new Error(`Builtin item "${def.name}" failed schema validation: ${JSON.stringify(result.errors)}`);
|
|
366
|
+
}
|
|
367
|
+
return result.data;
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAWvE,MAAM,QAAQ,GAAqB;IACjC;QACE,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,sCAAsC;QAC/C,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC;QACnC,YAAY,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;QACjC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QAC9C,SAAS,EAAE,GAAW,EAAE;Y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AAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,CAAC,IAAI,OAAO;gBACzF,OAAO,EAAE,EAAE;aACZ;SACF,CAAC;QACF,MAAM,MAAM,GAAG,SAAS,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CACb,iBAAiB,GAAG,CAAC,IAAI,+BAA+B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CACxF,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@snipl/official-registry",
|
|
3
|
+
"version": "1.0.0-next.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/ysr-hameed/snipl.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/ysr-hameed/snipl/issues"
|
|
13
|
+
},
|
|
14
|
+
"main": "./dist/src/index.js",
|
|
15
|
+
"types": "./dist/src/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/src/index.d.ts",
|
|
19
|
+
"default": "./dist/src/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist/src",
|
|
24
|
+
"!dist/src/**/*.tsbuildinfo"
|
|
25
|
+
],
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@snipl/registry-schema": "1.0.0-next.1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"typescript": "^5.7.0",
|
|
31
|
+
"vitest": "^3.0.0"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=22.0.0"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc -b",
|
|
38
|
+
"typecheck": "tsc -b",
|
|
39
|
+
"test": "vitest run"
|
|
40
|
+
}
|
|
41
|
+
}
|