mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
feat: adding pure annotation for better tree shaking
This commit is contained in:
@@ -22,6 +22,7 @@ export function single<T extends NotFunction>(cb: T): () => T;
|
||||
*/
|
||||
export function single<T extends () => unknown>(cb: T): T;
|
||||
/**
|
||||
* @__PURE__
|
||||
* Please note that on intellij, the deprecation is for all signatures, which is unintended behavior (and
|
||||
* very annoying).
|
||||
* For future versions, ensure that single is being passed as a **callback!!**
|
||||
@@ -39,6 +40,7 @@ export function single<T>(cb: T) {
|
||||
export function transient<T extends NotFunction>(cb: T): () => () => T;
|
||||
export function transient<T extends () => () => unknown>(cb: T): T;
|
||||
/**
|
||||
* @__PURE__
|
||||
* Following iti's singleton and transient implementation,
|
||||
* use transient if you want a new dependency every time your container getter is called
|
||||
* @param cb
|
||||
@@ -49,6 +51,7 @@ export function transient<T>(cb: (() => () => T) | T) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @__PURE__
|
||||
* @deprecated
|
||||
* @param value
|
||||
* Please use the transient function instead
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Err, Ok } from 'ts-results-es';
|
||||
* A function that returns whatever value is provided.
|
||||
* Warning: this evaluates { @param value }. It does not defer a value.
|
||||
* @param value
|
||||
* @__PURE__
|
||||
*/
|
||||
// prettier-ignore
|
||||
export const _const = <T>(value: T) => () => value;
|
||||
|
||||
@@ -13,7 +13,6 @@ export default defineConfig([
|
||||
target: 'node16',
|
||||
tsconfig: './tsconfig-esm.json',
|
||||
outDir: './dist/esm',
|
||||
external: ['discord.js'],
|
||||
treeshake: true,
|
||||
outExtension() {
|
||||
return {
|
||||
@@ -25,7 +24,6 @@ export default defineConfig([
|
||||
{
|
||||
format: 'cjs',
|
||||
splitting: false,
|
||||
external: ['discord.js'],
|
||||
target: 'node16',
|
||||
tsconfig: './tsconfig-cjs.json',
|
||||
outDir: './dist/cjs',
|
||||
|
||||
Reference in New Issue
Block a user