diff --git a/deno.json b/deno.json index 465e657..26822be 100644 --- a/deno.json +++ b/deno.json @@ -1,4 +1,5 @@ { + "importMap": "import.json", "compilerOptions": { "strict": true }, diff --git a/import.json b/import.json new file mode 100644 index 0000000..aec5955 --- /dev/null +++ b/import.json @@ -0,0 +1,9 @@ +{ + "imports": { + "revolt-api-types": "https://deno.land/x/revolt_api@0.4.0/types.ts", + "events": "https://deno.land/std@0.132.0/node/events.ts", + "crypto": "https://deno.land/std@0.132.0/node/crypto.ts", + "collection": "https://esm.sh/@discordjs/collection@0.6.0", + "@revoltio/rest": "https://deno.land/x/revoltio_rest@v1.1.0/mod.ts" + } +} \ No newline at end of file diff --git a/scripts/build_npm.ts b/scripts/build_npm.ts index 1641af0..9937133 100644 --- a/scripts/build_npm.ts +++ b/scripts/build_npm.ts @@ -15,28 +15,17 @@ await build({ outDir: './npm', shims: { webSocket: true, - custom: [{ - package: { - name: 'crypto', - }, - globalNames: ['randomBytes'], - }], }, + compilerOptions: { + target: 'ES2021', + }, + importMap: './import.json', mappings: { 'https://deno.land/x/revoltio_rest@v1.1.0/mod.ts': { name: '@revoltio/rest', version: '^1.1.0', }, - 'https://esm.sh/@discordjs/collection@0.6.0': { - name: '@discordjs/collection', - version: '^0.6.0', - }, - 'https://deno.land/x/revolt_api@0.4.0/types.ts': { - name: 'revolt-api', - version: '^0.5.3-5-patch.4', - }, }, - package: { name: 'revolt.io', version: Deno.args[0].replace(/[A-Z]+/gi, ''), @@ -45,7 +34,6 @@ await build({ devDependencies: { '@types/node': '^16', '@types/ws': '^8.5.3', - 'revolt-api': '^0.5.3-5-patch.4', }, repository: { type: 'git', diff --git a/src/client/BaseClient.ts b/src/client/BaseClient.ts index fc3df55..662f767 100644 --- a/src/client/BaseClient.ts +++ b/src/client/BaseClient.ts @@ -1,10 +1,7 @@ // deno-lint-ignore-file no-explicit-any -import { EventEmitter } from 'https://deno.land/std@0.132.0/node/events.ts'; +import { EventEmitter } from 'events'; import { Client } from './mod.ts'; -import { - REST, - RESTOptions, -} from 'https://deno.land/x/revoltio_rest@v1.1.0/mod.ts'; +import { REST, RESTOptions } from '@revoltio/rest'; import type { Channel, DMChannel, diff --git a/src/client/Client.ts b/src/client/Client.ts index edfa8bb..adbc722 100644 --- a/src/client/Client.ts +++ b/src/client/Client.ts @@ -1,4 +1,4 @@ -import type { RevoltConfig } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { RevoltConfig } from 'revolt-api-types'; import { BaseClient, WebSocketShard } from './mod.ts'; import { ActionManager } from './actions/ActionManager.ts'; import { Error } from '../errors/mod.ts'; diff --git a/src/client/actions/ChannelCreate.ts b/src/client/actions/ChannelCreate.ts index 7a0b989..76d4204 100644 --- a/src/client/actions/ChannelCreate.ts +++ b/src/client/actions/ChannelCreate.ts @@ -1,4 +1,4 @@ -import type { Channel as APIChannel } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Channel as APIChannel } from 'revolt-api-types'; import { Action } from './Action.ts'; import { Events } from '../../util/Constants.ts'; diff --git a/src/client/actions/ChannelUpdate.ts b/src/client/actions/ChannelUpdate.ts index 8b89473..bb93f4e 100644 --- a/src/client/actions/ChannelUpdate.ts +++ b/src/client/actions/ChannelUpdate.ts @@ -1,4 +1,4 @@ -import type { Channel as APIChannel } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Channel as APIChannel } from 'revolt-api-types'; import { Action } from './Action.ts'; import { Events } from '../../util/Constants.ts'; diff --git a/src/client/actions/Message.ts b/src/client/actions/Message.ts index ee1499f..ada4ce1 100644 --- a/src/client/actions/Message.ts +++ b/src/client/actions/Message.ts @@ -1,4 +1,4 @@ -import type { Message as APIMessage } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Message as APIMessage } from 'revolt-api-types'; import { Action } from './Action.ts'; import { Events, SYSTEM_USER_ID } from '../../util/Constants.ts'; diff --git a/src/client/actions/MessageUpdate.ts b/src/client/actions/MessageUpdate.ts index e387f1e..8692b0e 100644 --- a/src/client/actions/MessageUpdate.ts +++ b/src/client/actions/MessageUpdate.ts @@ -1,4 +1,4 @@ -import type { Message as APIMessage } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Message as APIMessage } from 'revolt-api-types'; import { Action } from './Action.ts'; import { Events } from '../../util/Constants.ts'; diff --git a/src/client/actions/ServerDelete.ts b/src/client/actions/ServerDelete.ts index 382dff9..f0b048e 100644 --- a/src/client/actions/ServerDelete.ts +++ b/src/client/actions/ServerDelete.ts @@ -1,4 +1,4 @@ -import type { Server as APIServer } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Server as APIServer } from 'revolt-api-types'; import { Action } from './Action.ts'; import { Events } from '../../util/Constants.ts'; diff --git a/src/client/actions/ServerMemberUpdate.ts b/src/client/actions/ServerMemberUpdate.ts index acbf30c..7d28897 100644 --- a/src/client/actions/ServerMemberUpdate.ts +++ b/src/client/actions/ServerMemberUpdate.ts @@ -1,4 +1,4 @@ -import type { Member as APIMember } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Member as APIMember } from 'revolt-api-types'; import { Action } from './Action.ts'; import { Events } from '../../util/Constants.ts'; diff --git a/src/client/actions/ServerUpdate.ts b/src/client/actions/ServerUpdate.ts index 1b0415a..8548cb3 100644 --- a/src/client/actions/ServerUpdate.ts +++ b/src/client/actions/ServerUpdate.ts @@ -1,4 +1,4 @@ -import type { Server as APIServer } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Server as APIServer } from 'revolt-api-types'; import { Action } from './Action.ts'; import { Events } from '../../util/Constants.ts'; diff --git a/src/client/actions/UserUpdate.ts b/src/client/actions/UserUpdate.ts index bb10283..0e906ce 100644 --- a/src/client/actions/UserUpdate.ts +++ b/src/client/actions/UserUpdate.ts @@ -1,4 +1,4 @@ -import type { User as APIUser } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { User as APIUser } from 'revolt-api-types'; import { Action } from './Action.ts'; import { ClientUser } from '../../structures/ClientUser.ts'; import { Events } from '../../util/Constants.ts'; diff --git a/src/managers/ChannelManager.ts b/src/managers/ChannelManager.ts index 56d249b..f795a08 100644 --- a/src/managers/ChannelManager.ts +++ b/src/managers/ChannelManager.ts @@ -1,4 +1,4 @@ -import type { Channel as APIChannel } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Channel as APIChannel } from 'revolt-api-types'; import { BaseManager } from './BaseManager.ts'; import { TypeError } from '../errors/mod.ts'; import { diff --git a/src/managers/MessageManager.ts b/src/managers/MessageManager.ts index eff85e1..3fef6c8 100644 --- a/src/managers/MessageManager.ts +++ b/src/managers/MessageManager.ts @@ -2,7 +2,7 @@ import type { Member as APIMember, Message as APIMessage, User as APIUser, -} from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +} from 'revolt-api-types'; import { BaseManager } from './BaseManager.ts'; import { TypeError } from '../errors/mod.ts'; import { Channel, Message, ServerMember, User } from '../structures/mod.ts'; diff --git a/src/managers/RoleManager.ts b/src/managers/RoleManager.ts index ec464a9..93ffec9 100644 --- a/src/managers/RoleManager.ts +++ b/src/managers/RoleManager.ts @@ -1,4 +1,4 @@ -import type { Role as APIRole } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Role as APIRole } from 'revolt-api-types'; import { BaseManager } from './BaseManager.ts'; import { TypeError } from '../errors/mod.ts'; import { Role, Server } from '../structures/mod.ts'; diff --git a/src/managers/ServerChannelManager.ts b/src/managers/ServerChannelManager.ts index fa89bf9..9520ae0 100644 --- a/src/managers/ServerChannelManager.ts +++ b/src/managers/ServerChannelManager.ts @@ -1,4 +1,4 @@ -import type { Channel as APIChannel } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Channel as APIChannel } from 'revolt-api-types'; import { BaseManager } from './BaseManager.ts'; import { TypeError } from '../errors/mod.ts'; import { diff --git a/src/managers/ServerManager.ts b/src/managers/ServerManager.ts index 618ca44..be33d96 100644 --- a/src/managers/ServerManager.ts +++ b/src/managers/ServerManager.ts @@ -1,4 +1,4 @@ -import type { Server as APIServer } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Server as APIServer } from 'revolt-api-types'; import { BaseManager } from './BaseManager.ts'; import { TypeError } from '../errors/mod.ts'; import { Server } from '../structures/mod.ts'; diff --git a/src/managers/ServerMemberManager.ts b/src/managers/ServerMemberManager.ts index 772e03f..036ec5f 100644 --- a/src/managers/ServerMemberManager.ts +++ b/src/managers/ServerMemberManager.ts @@ -1,4 +1,4 @@ -import type { Member as APIMember } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Member as APIMember } from 'revolt-api-types'; import { BaseManager } from './BaseManager.ts'; import { TypeError } from '../errors/mod.ts'; import { Server, ServerMember, User } from '../structures/mod.ts'; diff --git a/src/managers/UserManager.ts b/src/managers/UserManager.ts index 7fd26ba..b8157f3 100644 --- a/src/managers/UserManager.ts +++ b/src/managers/UserManager.ts @@ -1,4 +1,4 @@ -import type { User as APIUser } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { User as APIUser } from 'revolt-api-types'; import { BaseManager } from './BaseManager.ts'; import { TypeError } from '../errors/mod.ts'; import { Message, User } from '../structures/mod.ts'; diff --git a/src/structures/Category.ts b/src/structures/Category.ts index 61c51b0..ad481d8 100644 --- a/src/structures/Category.ts +++ b/src/structures/Category.ts @@ -1,4 +1,4 @@ -import type { Category as APICategory } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Category as APICategory } from 'revolt-api-types'; import { Base, Server, ServerChannel } from './mod.ts'; import { Collection } from '../util/mod.ts'; diff --git a/src/structures/Channel.ts b/src/structures/Channel.ts index 30ded30..d0be690 100644 --- a/src/structures/Channel.ts +++ b/src/structures/Channel.ts @@ -1,4 +1,4 @@ -import type { Channel as APIChannel } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Channel as APIChannel } from 'revolt-api-types'; import { Base, DMChannel, diff --git a/src/structures/DMChannel.ts b/src/structures/DMChannel.ts index a5b8914..78ded86 100644 --- a/src/structures/DMChannel.ts +++ b/src/structures/DMChannel.ts @@ -1,4 +1,4 @@ -import type { Channel as APIChannel } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Channel as APIChannel } from 'revolt-api-types'; import { Channel, Message } from './mod.ts'; import { TextBasedChannel } from './interfaces/mod.ts'; import { Client, MessageManager, MessageOptions } from '../lib.ts'; diff --git a/src/structures/GroupChannel.ts b/src/structures/GroupChannel.ts index 78d948d..b6994ef 100644 --- a/src/structures/GroupChannel.ts +++ b/src/structures/GroupChannel.ts @@ -1,4 +1,4 @@ -import type { Channel as APIChannel } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Channel as APIChannel } from 'revolt-api-types'; import type { Message, User } from './mod.ts'; import type { TextBasedChannel } from './interfaces/mod.ts'; import type { Client } from '../client/Client.ts'; diff --git a/src/structures/Message.ts b/src/structures/Message.ts index 124db85..eaf2b30 100644 --- a/src/structures/Message.ts +++ b/src/structures/Message.ts @@ -3,7 +3,7 @@ import type { File, Message as APIMessage, SystemMessage, -} from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +} from 'revolt-api-types'; import { Base, DMChannel, diff --git a/src/structures/MessageEmbed.ts b/src/structures/MessageEmbed.ts index 2010a32..0ada877 100644 --- a/src/structures/MessageEmbed.ts +++ b/src/structures/MessageEmbed.ts @@ -1,7 +1,4 @@ -import type { - Embed, - Special, -} from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Embed, Special } from 'revolt-api-types'; export type EmbedImage = Extract; export type EmbedVideo = Extract; diff --git a/src/structures/NotesChannel.ts b/src/structures/NotesChannel.ts index f7dbe47..c9d7198 100644 --- a/src/structures/NotesChannel.ts +++ b/src/structures/NotesChannel.ts @@ -1,4 +1,4 @@ -import type { Channel as APIChannel } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Channel as APIChannel } from 'revolt-api-types'; import { Channel, Message, User } from './mod.ts'; import { TextBasedChannel } from './interfaces/mod.ts'; import { Client } from '../client/Client.ts'; diff --git a/src/structures/Role.ts b/src/structures/Role.ts index 65a852f..03d4448 100644 --- a/src/structures/Role.ts +++ b/src/structures/Role.ts @@ -1,4 +1,4 @@ -import type { Role as APIRole } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Role as APIRole } from 'revolt-api-types'; import { Base, Overwrite, Server } from './mod.ts'; import { ChannelPermissions, UUID } from '../util/mod.ts'; diff --git a/src/structures/Server.ts b/src/structures/Server.ts index 68c9032..f0142b6 100644 --- a/src/structures/Server.ts +++ b/src/structures/Server.ts @@ -1,4 +1,4 @@ -import type { Server as APIServer } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Server as APIServer } from 'revolt-api-types'; import { Base, Category, ServerMember, User } from './mod.ts'; import { Client } from '../client/Client.ts'; import { diff --git a/src/structures/ServerChannel.ts b/src/structures/ServerChannel.ts index e408795..fc5d483 100644 --- a/src/structures/ServerChannel.ts +++ b/src/structures/ServerChannel.ts @@ -1,4 +1,4 @@ -import type { Channel as APIChannel } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Channel as APIChannel } from 'revolt-api-types'; import { Category, Channel, Server } from './mod.ts'; import { Client } from '../client/Client.ts'; import { ChannelPermissions, Collection } from '../util/mod.ts'; diff --git a/src/structures/ServerMember.ts b/src/structures/ServerMember.ts index 1e74fe3..d2e9759 100644 --- a/src/structures/ServerMember.ts +++ b/src/structures/ServerMember.ts @@ -1,7 +1,4 @@ -import type { - File, - Member as APIMember, -} from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { File, Member as APIMember } from 'revolt-api-types'; import { Base, Server, User } from './mod.ts'; import { Client } from '../client/Client.ts'; diff --git a/src/structures/TextChannel.ts b/src/structures/TextChannel.ts index 176addc..5172f8f 100644 --- a/src/structures/TextChannel.ts +++ b/src/structures/TextChannel.ts @@ -1,4 +1,4 @@ -import type { Channel as APIChannel } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Channel as APIChannel } from 'revolt-api-types'; import { Message, ServerChannel } from './mod.ts'; import { TextBasedChannel } from './interfaces/mod.ts'; import { Client } from '../client/Client.ts'; diff --git a/src/structures/User.ts b/src/structures/User.ts index d8b5a64..e3652f6 100644 --- a/src/structures/User.ts +++ b/src/structures/User.ts @@ -2,7 +2,7 @@ import type { File, Presence as APIPresence, User as APIUser, -} from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +} from 'revolt-api-types'; import { Base, DMChannel } from './mod.ts'; import { Client } from '../client/Client.ts'; import { Badges, Presence, UUID } from '../util/mod.ts'; diff --git a/src/structures/VoiceChannel.ts b/src/structures/VoiceChannel.ts index 6c5ab2f..a42aaa3 100644 --- a/src/structures/VoiceChannel.ts +++ b/src/structures/VoiceChannel.ts @@ -1,4 +1,4 @@ -import type { Channel as APIChannel } from 'https://deno.land/x/revolt_api@0.4.0/types.ts'; +import type { Channel as APIChannel } from 'revolt-api-types'; import { ServerChannel } from './mod.ts'; import { Client } from '../lib.ts'; import { ChannelTypes } from '../util/mod.ts'; diff --git a/src/util/UUID.ts b/src/util/UUID.ts index b86ab8f..f550592 100644 --- a/src/util/UUID.ts +++ b/src/util/UUID.ts @@ -1,4 +1,4 @@ -import { randomBytes } from 'https://deno.land/std@0.132.0/node/crypto.ts'; +import { randomBytes } from 'crypto'; export class UUID extends null { static readonly ENCODING = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';