Export Filters from WebpackModules
This commit is contained in:
parent
a4e51dd4a7
commit
6bc2e0cca5
|
@ -1,4 +1,4 @@
|
||||||
import WebpackModules from './webpackmodules';
|
import { WebpackModules } from './webpackmodules';
|
||||||
import { $ } from 'vendor';
|
import { $ } from 'vendor';
|
||||||
|
|
||||||
class List extends Array {
|
class List extends Array {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
import EventListener from './eventlistener';
|
import EventListener from './eventlistener';
|
||||||
import { Utils } from 'common';
|
import { Utils } from 'common';
|
||||||
import Events from './events';
|
import Events from './events';
|
||||||
import WebpackModules from './webpackmodules';
|
import { WebpackModules } from './webpackmodules';
|
||||||
|
|
||||||
import * as SocketStructs from '../structs/socketstructs';
|
import * as SocketStructs from '../structs/socketstructs';
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ export { default as PluginManager } from './pluginmanager';
|
||||||
export { default as ThemeManager } from './thememanager';
|
export { default as ThemeManager } from './thememanager';
|
||||||
export { default as Globals } from './globals';
|
export { default as Globals } from './globals';
|
||||||
export { default as Vendor } from './vendor';
|
export { default as Vendor } from './vendor';
|
||||||
export { default as WebpackModules } from './webpackmodules';
|
export * from './webpackmodules';
|
||||||
export { default as ModuleManager } from './modulemanager';
|
export { default as ModuleManager } from './modulemanager';
|
||||||
export { default as EventListener } from './eventlistener';
|
export { default as EventListener } from './eventlistener';
|
||||||
export { default as SocketProxy } from './socketproxy';
|
export { default as SocketProxy } from './socketproxy';
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import WebpackModules from './webpackmodules';
|
import { WebpackModules } from './webpackmodules';
|
||||||
import { ClientLogger as Logger } from 'common';
|
import { ClientLogger as Logger } from 'common';
|
||||||
|
|
||||||
export default class Patcher {
|
export default class Patcher {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import PluginManager from './pluginmanager';
|
||||||
import ThemeManager from './thememanager';
|
import ThemeManager from './thememanager';
|
||||||
import Events from './events';
|
import Events from './events';
|
||||||
import EventsWrapper from './eventswrapper';
|
import EventsWrapper from './eventswrapper';
|
||||||
import WebpackModules from './webpackmodules';
|
import { WebpackModules } from './webpackmodules';
|
||||||
import { SettingsSet, SettingsCategory, Setting, SettingsScheme } from 'structs';
|
import { SettingsSet, SettingsCategory, Setting, SettingsScheme } from 'structs';
|
||||||
import { BdMenuItems, Modals, DOM } from 'ui';
|
import { BdMenuItems, Modals, DOM } from 'ui';
|
||||||
import SettingsModal from '../ui/components/bd/modals/SettingsModal.vue';
|
import SettingsModal from '../ui/components/bd/modals/SettingsModal.vue';
|
||||||
|
|
|
@ -10,40 +10,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Patcher from './patcher';
|
import Patcher from './patcher';
|
||||||
import WebpackModules from './webpackmodules';
|
import { WebpackModules, Filters } from './webpackmodules';
|
||||||
import DiscordApi from './discordapi';
|
import DiscordApi from './discordapi';
|
||||||
import { EmoteModule } from 'builtin';
|
import { EmoteModule } from 'builtin';
|
||||||
import { Reflection } from 'ui';
|
import { Reflection } from 'ui';
|
||||||
|
|
||||||
class Filters {
|
|
||||||
static get byPrototypeFields() {
|
|
||||||
return (fields, selector = x => x) => (module) => {
|
|
||||||
const component = selector(module);
|
|
||||||
if (!component) return false;
|
|
||||||
if (!component.prototype) return false;
|
|
||||||
for (const field of fields) {
|
|
||||||
if (!component.prototype[field]) return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static get byCode() {
|
|
||||||
return (search, selector = x => x) => (module) => {
|
|
||||||
const method = selector(module);
|
|
||||||
if (!method) return false;
|
|
||||||
return method.toString().search(search) !== -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static get and() {
|
|
||||||
return (...filters) => (module) => {
|
|
||||||
for (const filter of filters) {
|
|
||||||
if (!filter(module)) return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Helpers {
|
class Helpers {
|
||||||
static get plannedActions() {
|
static get plannedActions() {
|
||||||
return this._plannedActions || (this._plannedActions = new Map());
|
return this._plannedActions || (this._plannedActions = new Map());
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import WebpackModules from './webpackmodules';
|
import { WebpackModules } from './webpackmodules';
|
||||||
import jQuery from 'jquery';
|
import jQuery from 'jquery';
|
||||||
import lodash from 'lodash';
|
import lodash from 'lodash';
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Filters {
|
export class Filters {
|
||||||
static byProperties(props, selector = m => m) {
|
static byProperties(props, selector = m => m) {
|
||||||
return module => {
|
return module => {
|
||||||
const component = selector(module);
|
const component = selector(module);
|
||||||
|
@ -205,7 +205,7 @@ const KnownModules = {
|
||||||
ExternalLink: Filters.byCode(/\.trusted\b/)
|
ExternalLink: Filters.byCode(/\.trusted\b/)
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class WebpackModules {
|
export class WebpackModules {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds a module using a filter function.
|
* Finds a module using a filter function.
|
||||||
|
|
Loading…
Reference in New Issue