Skip to content

Commit

Permalink
chore(discord-player): release 6.6.8
Browse files Browse the repository at this point in the history
  • Loading branch information
twlite committed Apr 1, 2024
1 parent 0441e01 commit 2a0b3d2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 29 deletions.
2 changes: 1 addition & 1 deletion apps/website/src/data/docs.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/discord-player/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "discord-player",
"version": "6.6.7",
"version": "6.6.8",
"description": "Complete framework to facilitate music commands using discord.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -55,7 +55,7 @@
"@discord-player/utils": "workspace:^",
"discord-voip": "^0.1.3",
"ip": "^1.1.8",
"libsodium-wrappers": "^0.7.10"
"libsodium-wrappers": "^0.7.13"
},
"peerDependencies": {
"@discord-player/extractor": "workspace:^"
Expand Down
22 changes: 6 additions & 16 deletions packages/discord-player/src/hooks/context/async-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,6 @@ type unsafe = any;
*/
export type ContextReceiver<R> = () => R;

/**
* The props for the context provider
*/
export interface ContextProviderProps<T, R> {
/**
* The value to provide
*/
value: T;
/**
* The receiver function that will be called when the context is provided
*/
receiver: ContextReceiver<R>;
}

export class Context<T> {
private storage = new AsyncLocalStorage<T>();

Expand Down Expand Up @@ -55,11 +41,15 @@ export class Context<T> {
/**
* Run a function within the context of this provider
*/
public provide<R = unsafe>({ receiver, value }: ContextProviderProps<T, R>): R {
public provide<R = unsafe>(value: T, receiver: ContextReceiver<R>): R {
if (value === undefined) {
throw new Error('Context value may not be undefined');
}

if (typeof receiver !== 'function') {
throw new Error('Context receiver must be a function');
}

return this.storage.run(value, receiver);
}
}
Expand All @@ -76,7 +66,7 @@ export class Context<T> {
* };
*
* // provide the context value to the receiver
* context.provide({ value: user, receiver: handler });
* context.provide(user, handler);
*
* function handler() {
* // get the context value
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4896,7 +4896,7 @@ __metadata:
discord-voip: "npm:^0.1.3"
discord.js: "npm:^14.1.2"
ip: "npm:^1.1.8"
libsodium-wrappers: "npm:^0.7.10"
libsodium-wrappers: "npm:^0.7.13"
opusscript: "npm:^0.0.8"
tsup: "npm:^7.2.0"
typescript: "npm:^5.2.2"
Expand Down Expand Up @@ -7444,19 +7444,19 @@ __metadata:
languageName: node
linkType: hard

"libsodium-wrappers@npm:^0.7.10":
version: 0.7.10
resolution: "libsodium-wrappers@npm:0.7.10"
"libsodium-wrappers@npm:^0.7.13":
version: 0.7.13
resolution: "libsodium-wrappers@npm:0.7.13"
dependencies:
libsodium: "npm:^0.7.0"
checksum: 7bba87d464bc914d57bec85c9901529746b706083ffdba1642f2860a11a4f71351fecb94406330c5c0cc6ec493ebc019a706a70d976ba508831d63a93236c44f
libsodium: "npm:^0.7.13"
checksum: e5f7f5baf37095a764e3f5037ab47d65343db0c0efca4add80a5c2037ac2cb9fb05f00646f7b75220bd4f30bccc02e9742603ceb8eb97e5c305103cd4f86392d
languageName: node
linkType: hard

"libsodium@npm:^0.7.0":
version: 0.7.9
resolution: "libsodium@npm:0.7.9"
checksum: 3ad30dc469fad658d716f4160a8b2143e9f7337bbaef6fe9a983b6611f2f68f6f2fc094b53e73dc79a3b1e810fafff768609ab885f151469cff5a4372ae4a586
"libsodium@npm:^0.7.13":
version: 0.7.13
resolution: "libsodium@npm:0.7.13"
checksum: 0105523135c1ed1c4ee853a36cd3b3b562ed150f5888ae61be4b2945f0b1010e7ecaad4cdc9333beac034a88bdf470a93f22609877a06f15f5d690a9591e0d7c
languageName: node
linkType: hard

Expand Down

0 comments on commit 2a0b3d2

Please sign in to comment.