Skip to content

Commit

Permalink
feat: Add import map
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulrahman1s committed May 29, 2022
1 parent 23dceb5 commit 4fcbfab
Show file tree
Hide file tree
Showing 35 changed files with 47 additions and 58 deletions.
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"importMap": "import.json",
"compilerOptions": {
"strict": true
},
Expand Down
9 changes: 9 additions & 0 deletions import.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"imports": {
"revolt-api-types": "https://deno.land/x/[email protected]/types.ts",
"events": "https://deno.land/[email protected]/node/events.ts",
"crypto": "https://deno.land/[email protected]/node/crypto.ts",
"collection": "https://esm.sh/@discordjs/[email protected]",
"@revoltio/rest": "https://deno.land/x/[email protected]/mod.ts"
}
}
20 changes: 4 additions & 16 deletions scripts/build_npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]/mod.ts': {
name: '@revoltio/rest',
version: '^1.1.0',
},
'https://esm.sh/@discordjs/[email protected]': {
name: '@discordjs/collection',
version: '^0.6.0',
},
'https://deno.land/x/[email protected]/types.ts': {
name: 'revolt-api',
version: '^0.5.3-5-patch.4',
},
},

package: {
name: 'revolt.io',
version: Deno.args[0].replace(/[A-Z]+/gi, ''),
Expand All @@ -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',
Expand Down
7 changes: 2 additions & 5 deletions src/client/BaseClient.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// deno-lint-ignore-file no-explicit-any
import { EventEmitter } from 'https://deno.land/[email protected]/node/events.ts';
import { EventEmitter } from 'events';
import { Client } from './mod.ts';
import {
REST,
RESTOptions,
} from 'https://deno.land/x/[email protected]/mod.ts';
import { REST, RESTOptions } from '@revoltio/rest';
import type {
Channel,
DMChannel,
Expand Down
2 changes: 1 addition & 1 deletion src/client/Client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { RevoltConfig } from 'https://deno.land/x/[email protected]/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';
Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/ChannelCreate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Channel as APIChannel } from 'https://deno.land/x/[email protected]/types.ts';
import type { Channel as APIChannel } from 'revolt-api-types';
import { Action } from './Action.ts';
import { Events } from '../../util/Constants.ts';

Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/ChannelUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Channel as APIChannel } from 'https://deno.land/x/[email protected]/types.ts';
import type { Channel as APIChannel } from 'revolt-api-types';
import { Action } from './Action.ts';
import { Events } from '../../util/Constants.ts';

Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/Message.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Message as APIMessage } from 'https://deno.land/x/[email protected]/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';

Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/MessageUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Message as APIMessage } from 'https://deno.land/x/[email protected]/types.ts';
import type { Message as APIMessage } from 'revolt-api-types';
import { Action } from './Action.ts';
import { Events } from '../../util/Constants.ts';

Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/ServerDelete.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Server as APIServer } from 'https://deno.land/x/[email protected]/types.ts';
import type { Server as APIServer } from 'revolt-api-types';
import { Action } from './Action.ts';
import { Events } from '../../util/Constants.ts';

Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/ServerMemberUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Member as APIMember } from 'https://deno.land/x/[email protected]/types.ts';
import type { Member as APIMember } from 'revolt-api-types';
import { Action } from './Action.ts';
import { Events } from '../../util/Constants.ts';

Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/ServerUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Server as APIServer } from 'https://deno.land/x/[email protected]/types.ts';
import type { Server as APIServer } from 'revolt-api-types';
import { Action } from './Action.ts';
import { Events } from '../../util/Constants.ts';

Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/UserUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { User as APIUser } from 'https://deno.land/x/[email protected]/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';
Expand Down
2 changes: 1 addition & 1 deletion src/managers/ChannelManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Channel as APIChannel } from 'https://deno.land/x/[email protected]/types.ts';
import type { Channel as APIChannel } from 'revolt-api-types';
import { BaseManager } from './BaseManager.ts';
import { TypeError } from '../errors/mod.ts';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/managers/MessageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type {
Member as APIMember,
Message as APIMessage,
User as APIUser,
} from 'https://deno.land/x/[email protected]/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';
Expand Down
2 changes: 1 addition & 1 deletion src/managers/RoleManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Role as APIRole } from 'https://deno.land/x/[email protected]/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';
Expand Down
2 changes: 1 addition & 1 deletion src/managers/ServerChannelManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Channel as APIChannel } from 'https://deno.land/x/[email protected]/types.ts';
import type { Channel as APIChannel } from 'revolt-api-types';
import { BaseManager } from './BaseManager.ts';
import { TypeError } from '../errors/mod.ts';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/managers/ServerManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Server as APIServer } from 'https://deno.land/x/[email protected]/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';
Expand Down
2 changes: 1 addition & 1 deletion src/managers/ServerMemberManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Member as APIMember } from 'https://deno.land/x/[email protected]/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';
Expand Down
2 changes: 1 addition & 1 deletion src/managers/UserManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { User as APIUser } from 'https://deno.land/x/[email protected]/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';
Expand Down
2 changes: 1 addition & 1 deletion src/structures/Category.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Category as APICategory } from 'https://deno.land/x/[email protected]/types.ts';
import type { Category as APICategory } from 'revolt-api-types';
import { Base, Server, ServerChannel } from './mod.ts';
import { Collection } from '../util/mod.ts';

Expand Down
2 changes: 1 addition & 1 deletion src/structures/Channel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Channel as APIChannel } from 'https://deno.land/x/[email protected]/types.ts';
import type { Channel as APIChannel } from 'revolt-api-types';
import {
Base,
DMChannel,
Expand Down
2 changes: 1 addition & 1 deletion src/structures/DMChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Channel as APIChannel } from 'https://deno.land/x/[email protected]/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';
Expand Down
2 changes: 1 addition & 1 deletion src/structures/GroupChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Channel as APIChannel } from 'https://deno.land/x/[email protected]/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';
Expand Down
2 changes: 1 addition & 1 deletion src/structures/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
File,
Message as APIMessage,
SystemMessage,
} from 'https://deno.land/x/[email protected]/types.ts';
} from 'revolt-api-types';
import {
Base,
DMChannel,
Expand Down
5 changes: 1 addition & 4 deletions src/structures/MessageEmbed.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import type {
Embed,
Special,
} from 'https://deno.land/x/[email protected]/types.ts';
import type { Embed, Special } from 'revolt-api-types';

export type EmbedImage = Extract<Embed, { type: 'Image' }>;
export type EmbedVideo = Extract<Embed, { type: 'Video' }>;
Expand Down
2 changes: 1 addition & 1 deletion src/structures/NotesChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Channel as APIChannel } from 'https://deno.land/x/[email protected]/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';
Expand Down
2 changes: 1 addition & 1 deletion src/structures/Role.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Role as APIRole } from 'https://deno.land/x/[email protected]/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';

Expand Down
2 changes: 1 addition & 1 deletion src/structures/Server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Server as APIServer } from 'https://deno.land/x/[email protected]/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 {
Expand Down
2 changes: 1 addition & 1 deletion src/structures/ServerChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Channel as APIChannel } from 'https://deno.land/x/[email protected]/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';
Expand Down
5 changes: 1 addition & 4 deletions src/structures/ServerMember.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import type {
File,
Member as APIMember,
} from 'https://deno.land/x/[email protected]/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';

Expand Down
2 changes: 1 addition & 1 deletion src/structures/TextChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Channel as APIChannel } from 'https://deno.land/x/[email protected]/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';
Expand Down
2 changes: 1 addition & 1 deletion src/structures/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type {
File,
Presence as APIPresence,
User as APIUser,
} from 'https://deno.land/x/[email protected]/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';
Expand Down
2 changes: 1 addition & 1 deletion src/structures/VoiceChannel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Channel as APIChannel } from 'https://deno.land/x/[email protected]/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';
Expand Down
2 changes: 1 addition & 1 deletion src/util/UUID.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { randomBytes } from 'https://deno.land/[email protected]/node/crypto.ts';
import { randomBytes } from 'crypto';

export class UUID extends null {
static readonly ENCODING = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
Expand Down

0 comments on commit 4fcbfab

Please sign in to comment.