mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
refactor!: remove polyfillDispose (#10776)
BREAKING CHANGE: The `polyfillDispose` function has been removed
This commit is contained in:
@@ -1,10 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { polyfillDispose } = require('@discordjs/util');
|
|
||||||
const { __exportStar } = require('tslib');
|
const { __exportStar } = require('tslib');
|
||||||
|
|
||||||
polyfillDispose();
|
|
||||||
|
|
||||||
// "Root" classes (starting points)
|
// "Root" classes (starting points)
|
||||||
exports.BaseClient = require('./client/BaseClient.js').BaseClient;
|
exports.BaseClient = require('./client/BaseClient.js').BaseClient;
|
||||||
exports.Client = require('./client/Client.js').Client;
|
exports.Client = require('./client/Client.js').Client;
|
||||||
|
|||||||
@@ -3,4 +3,3 @@ export * from './range.js';
|
|||||||
export * from './calculateShardId.js';
|
export * from './calculateShardId.js';
|
||||||
export * from './runtime.js';
|
export * from './runtime.js';
|
||||||
export * from './userAgentAppendix.js';
|
export * from './userAgentAppendix.js';
|
||||||
export * from './polyfillDispose.js';
|
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
/**
|
|
||||||
* Polyfill for `Symbol.dispose` and `Symbol.asyncDispose` which is used as a part of
|
|
||||||
* {@link https://github.com/tc39/proposal-explicit-resource-management}. Node versions below 18.x
|
|
||||||
* don't have these symbols by default, so we need to polyfill them.
|
|
||||||
*/
|
|
||||||
export function polyfillDispose() {
|
|
||||||
// Polyfill for `Symbol.dispose` and `Symbol.asyncDispose` if not available.
|
|
||||||
// Taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management
|
|
||||||
|
|
||||||
// @ts-expect-error This is a polyfill, so it's fine to write
|
|
||||||
Symbol.dispose ??= Symbol('Symbol.dispose');
|
|
||||||
// @ts-expect-error Same as above
|
|
||||||
Symbol.asyncDispose ??= Symbol('Symbol.asyncDispose');
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import type { REST } from '@discordjs/rest';
|
import type { REST } from '@discordjs/rest';
|
||||||
import { range, type Awaitable } from '@discordjs/util';
|
import { range, type Awaitable } from '@discordjs/util';
|
||||||
import { polyfillDispose } from '@discordjs/util';
|
|
||||||
import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter';
|
import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter';
|
||||||
import {
|
import {
|
||||||
Routes,
|
Routes,
|
||||||
@@ -18,9 +17,6 @@ import type { IIdentifyThrottler } from '../throttling/IIdentifyThrottler.js';
|
|||||||
import { DefaultWebSocketManagerOptions, type CompressionMethod, type Encoding } from '../utils/constants.js';
|
import { DefaultWebSocketManagerOptions, type CompressionMethod, type Encoding } from '../utils/constants.js';
|
||||||
import type { WebSocketShardDestroyOptions, WebSocketShardEvents } from './WebSocketShard.js';
|
import type { WebSocketShardDestroyOptions, WebSocketShardEvents } from './WebSocketShard.js';
|
||||||
|
|
||||||
// We put this here because in index.ts WebSocketManager seems to be outputted before polyfillDispose() is called from tsup.
|
|
||||||
polyfillDispose();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a range of shard ids
|
* Represents a range of shard ids
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user