tinify webpacks (#1975)

* tinify webpack

* meme

* fix long version

* more changes

* even smoler

* fix up logic

* fix build

* undo changes to user agent manager because its not webpack'd anymore

* the heck

* fix stupid

* clean up browser rules

* typo
This commit is contained in:
Gus Caplan
2017-09-26 00:18:12 -05:00
committed by Crawl
parent 4d4d2f2db7
commit 27ccad1f1c
21 changed files with 85 additions and 80 deletions

View File

@@ -17,7 +17,7 @@ const ChannelStore = require('../stores/ChannelStore');
const GuildStore = require('../stores/GuildStore');
const ClientPresenceStore = require('../stores/ClientPresenceStore');
const EmojiStore = require('../stores/EmojiStore');
const { Events } = require('../util/Constants');
const { Events, browser } = require('../util/Constants');
const DataResolver = require('../util/DataResolver');
const { Error, TypeError, RangeError } = require('../errors');
@@ -33,8 +33,10 @@ class Client extends BaseClient {
super(Object.assign({ _tokenType: 'Bot' }, options));
// Obtain shard details from environment
if (!this.options.shardId && 'SHARD_ID' in process.env) this.options.shardId = Number(process.env.SHARD_ID);
if (!this.options.shardCount && 'SHARD_COUNT' in process.env) {
if (!browser && !this.options.shardId && 'SHARD_ID' in process.env) {
this.options.shardId = Number(process.env.SHARD_ID);
}
if (!browser && !this.options.shardCount && 'SHARD_COUNT' in process.env) {
this.options.shardCount = Number(process.env.SHARD_COUNT);
}
@@ -73,14 +75,14 @@ class Client extends BaseClient {
* @type {?ClientVoiceManager}
* @private
*/
this.voice = !this.browser ? new ClientVoiceManager(this) : null;
this.voice = !browser ? new ClientVoiceManager(this) : null;
/**
* The shard helpers for the client
* (only if the process was spawned as a child, such as from a {@link ShardingManager})
* @type {?ShardClientUtil}
*/
this.shard = process.send ? ShardClientUtil.singleton(this) : null;
this.shard = !browser && process.send ? ShardClientUtil.singleton(this) : null;
/**
* All of the {@link User} objects that have been cached at any point, mapped by their IDs
@@ -110,7 +112,7 @@ class Client extends BaseClient {
this.presences = new ClientPresenceStore(this);
Object.defineProperty(this, 'token', { writable: true });
if (!this.token && 'CLIENT_TOKEN' in process.env) {
if (!browser && !this.token && 'CLIENT_TOKEN' in process.env) {
/**
* Authorization token for the logged in user/bot
* <warn>This should be kept private at all times.</warn>
@@ -207,7 +209,7 @@ class Client extends BaseClient {
* @readonly
*/
get voiceConnections() {
if (this.browser) return new Collection();
if (browser) return new Collection();
return this.voice.connections;
}