mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-07 13:43:03 -04:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
be9657269c
14 changed files with 98 additions and 45 deletions
|
@ -261,7 +261,7 @@ page.on("console", async e => {
|
||||||
const [, tag, message, otherMessage] = args as Array<string>;
|
const [, tag, message, otherMessage] = args as Array<string>;
|
||||||
|
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case "WebpackInterceptor:":
|
case "WebpackPatcher:":
|
||||||
const patchFailMatch = message.match(/Patch by (.+?) (had no effect|errored|found no module) \(Module id is (.+?)\): (.+)/);
|
const patchFailMatch = message.match(/Patch by (.+?) (had no effect|errored|found no module) \(Module id is (.+?)\): (.+)/);
|
||||||
const patchSlowMatch = message.match(/Patch by (.+?) (took [\d.]+?ms) \(Module id is (.+?)\): (.+)/);
|
const patchSlowMatch = message.match(/Patch by (.+?) (took [\d.]+?ms) \(Module id is (.+?)\): (.+)/);
|
||||||
const match = patchFailMatch ?? patchSlowMatch;
|
const match = patchFailMatch ?? patchSlowMatch;
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { LazyComponent, LazyComponentWrapper } from "@utils/lazyReact";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import { LazyComponent, LazyComponentWrapper } from "@utils/react";
|
import type { React } from "@webpack/common";
|
||||||
import { React } from "@webpack/common";
|
|
||||||
|
|
||||||
import { ErrorCard } from "./ErrorCard";
|
import { ErrorCard } from "./ErrorCard";
|
||||||
|
|
||||||
|
@ -46,7 +46,9 @@ const NO_ERROR = {};
|
||||||
// We might want to import this in a place where React isn't ready yet.
|
// We might want to import this in a place where React isn't ready yet.
|
||||||
// Thus, wrap in a LazyComponent
|
// Thus, wrap in a LazyComponent
|
||||||
const ErrorBoundary = LazyComponent(() => {
|
const ErrorBoundary = LazyComponent(() => {
|
||||||
return class ErrorBoundary extends React.PureComponent<React.PropsWithChildren<Props>> {
|
// This component is used in a lot of files which end up importing other Webpack commons and causing circular imports.
|
||||||
|
// For this reason, use a non import access here.
|
||||||
|
return class ErrorBoundary extends Vencord.Webpack.Common.React.PureComponent<React.PropsWithChildren<Props>> {
|
||||||
state = {
|
state = {
|
||||||
error: NO_ERROR as any,
|
error: NO_ERROR as any,
|
||||||
stack: "",
|
stack: "",
|
||||||
|
|
|
@ -48,7 +48,7 @@ async function runReporter() {
|
||||||
|
|
||||||
for (const patch of patches) {
|
for (const patch of patches) {
|
||||||
if (!patch.all) {
|
if (!patch.all) {
|
||||||
new Logger("WebpackInterceptor").warn(`Patch by ${patch.plugin} found no module (Module id is -): ${patch.find}`);
|
new Logger("WebpackPatcher").warn(`Patch by ${patch.plugin} found no module (Module id is -): ${patch.find}`);
|
||||||
if (IS_COMPANION_TEST)
|
if (IS_COMPANION_TEST)
|
||||||
reporterData.failedPatches.foundNoModule.push(patch);
|
reporterData.failedPatches.foundNoModule.push(patch);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ async function runReporter() {
|
||||||
|
|
||||||
for (const [plugin, moduleId, match, totalTime] of patchTimings) {
|
for (const [plugin, moduleId, match, totalTime] of patchTimings) {
|
||||||
if (totalTime > 5) {
|
if (totalTime > 5) {
|
||||||
new Logger("WebpackInterceptor").warn(`Patch by ${plugin} took ${Math.round(totalTime * 100) / 100}ms (Module id is ${String(moduleId)}): ${match}`);
|
new Logger("WebpackPatcher").warn(`Patch by ${plugin} took ${Math.round(totalTime * 100) / 100}ms (Module id is ${String(moduleId)}): ${match}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ export default definePlugin({
|
||||||
group: true,
|
group: true,
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /let{ref:\i/,
|
match: /let{ref:\i,speaking:\i/,
|
||||||
replace: "$self.useAccountPanelRef();$&"
|
replace: "$self.useAccountPanelRef();$&"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
import { proxyLazy } from "@utils/lazy";
|
import { proxyLazy } from "@utils/lazy";
|
||||||
import { sleep } from "@utils/misc";
|
import { sleep } from "@utils/misc";
|
||||||
import { Queue } from "@utils/Queue";
|
import { Queue } from "@utils/Queue";
|
||||||
import { Flux, FluxDispatcher, GuildChannelStore, PrivateChannelsStore } from "@webpack/common";
|
import { ChannelActionCreators, Flux, FluxDispatcher, GuildChannelStore } from "@webpack/common";
|
||||||
|
|
||||||
export const OnlineMemberCountStore = proxyLazy(() => {
|
export const OnlineMemberCountStore = proxyLazy(() => {
|
||||||
const preloadQueue = new Queue();
|
const preloadQueue = new Queue();
|
||||||
|
@ -22,7 +22,7 @@ export const OnlineMemberCountStore = proxyLazy(() => {
|
||||||
async _ensureCount(guildId: string) {
|
async _ensureCount(guildId: string) {
|
||||||
if (onlineMemberMap.has(guildId)) return;
|
if (onlineMemberMap.has(guildId)) return;
|
||||||
|
|
||||||
await PrivateChannelsStore.preload(guildId, GuildChannelStore.getDefaultChannel(guildId).id);
|
await ChannelActionCreators.preload(guildId, GuildChannelStore.getDefaultChannel(guildId).id);
|
||||||
}
|
}
|
||||||
|
|
||||||
ensureCount(guildId?: string) {
|
ensureCount(guildId?: string) {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
import { ILanguageRegistration } from "@vap/shiki";
|
import { ILanguageRegistration } from "@vap/shiki";
|
||||||
|
|
||||||
export const VPC_REPO = "Vap0r1ze/vapcord";
|
export const VPC_REPO = "Vap0r1ze/vapcord";
|
||||||
export const VPC_REPO_COMMIT = "88a7032a59cca40da170926651b08201ea3b965a";
|
export const VPC_REPO_COMMIT = "4d0e4b420fb1e4358852bbd18c804a6f5e54c0d7";
|
||||||
export const vpcRepoAssets = `https://raw.githubusercontent.com/${VPC_REPO}/${VPC_REPO_COMMIT}/assets/shiki-codeblocks`;
|
export const vpcRepoAssets = `https://raw.githubusercontent.com/${VPC_REPO}/${VPC_REPO_COMMIT}/assets/shiki-codeblocks`;
|
||||||
export const vpcRepoGrammar = (fileName: string) => `${vpcRepoAssets}/${fileName}`;
|
export const vpcRepoGrammar = (fileName: string) => `${vpcRepoAssets}/${fileName}`;
|
||||||
export const vpcRepoLanguages = `${vpcRepoAssets}/languages.json`;
|
export const vpcRepoLanguages = `${vpcRepoAssets}/languages.json`;
|
||||||
|
@ -46,7 +46,7 @@ export interface LanguageJson {
|
||||||
export const languages: Record<string, Language> = {};
|
export const languages: Record<string, Language> = {};
|
||||||
|
|
||||||
export const loadLanguages = async () => {
|
export const loadLanguages = async () => {
|
||||||
const langsJson: LanguageJson[] = await fetch(vpcRepoLanguages).then(res => res.json());
|
const langsJson: LanguageJson[] = await fetch(vpcRepoLanguages).then(res => res.ok ? res.json() : []);
|
||||||
const loadedLanguages = Object.fromEntries(
|
const loadedLanguages = Object.fromEntries(
|
||||||
langsJson.map(lang => [lang.id, {
|
langsJson.map(lang => [lang.id, {
|
||||||
...lang,
|
...lang,
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { MessageObject } from "@api/MessageEvents";
|
import { MessageObject } from "@api/MessageEvents";
|
||||||
import { ChannelStore, ComponentDispatch, Constants, FluxDispatcher, GuildStore, i18n, IconUtils, InviteActions, MessageActions, PrivateChannelsStore, RestAPI, SelectedChannelStore, SelectedGuildStore, UserProfileActions, UserProfileStore, UserSettingsActionCreators, UserUtils } from "@webpack/common";
|
import { ChannelActionCreators, ChannelStore, ComponentDispatch, Constants, FluxDispatcher, GuildStore, i18n, IconUtils, InviteActions, MessageActions, RestAPI, SelectedChannelStore, SelectedGuildStore, UserProfileActions, UserProfileStore, UserSettingsActionCreators, UserUtils } from "@webpack/common";
|
||||||
import { Channel, Guild, Message, User } from "discord-types/general";
|
import { Channel, Guild, Message, User } from "discord-types/general";
|
||||||
import { Except } from "type-fest";
|
import { Except } from "type-fest";
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ export function getCurrentGuild(): Guild | undefined {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openPrivateChannel(userId: string) {
|
export function openPrivateChannel(userId: string) {
|
||||||
PrivateChannelsStore.openPrivateChannel(userId);
|
ChannelActionCreators.openPrivateChannel(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum Theme {
|
export const enum Theme {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Settings, SettingsStore } from "@api/Settings";
|
import { Settings, SettingsStore } from "@api/Settings";
|
||||||
import { findByCodeLazy } from "@webpack";
|
import { ThemeStore } from "@webpack/common";
|
||||||
|
|
||||||
let style: HTMLStyleElement;
|
let style: HTMLStyleElement;
|
||||||
let themesStyle: HTMLStyleElement;
|
let themesStyle: HTMLStyleElement;
|
||||||
|
@ -61,8 +61,10 @@ async function initThemes() {
|
||||||
|
|
||||||
const enabledlinks: string[] = [...enabledThemeLinks];
|
const enabledlinks: string[] = [...enabledThemeLinks];
|
||||||
// "darker" and "midnight" both count as dark
|
// "darker" and "midnight" both count as dark
|
||||||
const ThemeStore = findByCodeLazy("ThemeStore");
|
// This function is first called on DOMContentLoaded, so ThemeStore may not have been loaded yet
|
||||||
const activeTheme = ThemeStore.theme === "light" ? "light" : "dark";
|
const activeTheme = ThemeStore == null
|
||||||
|
? undefined
|
||||||
|
: ThemeStore.theme === "light" ? "light" : "dark";
|
||||||
|
|
||||||
const links = enabledlinks
|
const links = enabledlinks
|
||||||
.map(rawLink => {
|
.map(rawLink => {
|
||||||
|
@ -91,7 +93,6 @@ async function initThemes() {
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
initSystemValues();
|
initSystemValues();
|
||||||
initThemes();
|
|
||||||
|
|
||||||
toggle(Settings.useQuickCss);
|
toggle(Settings.useQuickCss);
|
||||||
SettingsStore.addChangeListener("useQuickCss", toggle);
|
SettingsStore.addChangeListener("useQuickCss", toggle);
|
||||||
|
@ -99,6 +100,21 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
SettingsStore.addChangeListener("enabledThemeLinks", initThemes);
|
SettingsStore.addChangeListener("enabledThemeLinks", initThemes);
|
||||||
SettingsStore.addChangeListener("enabledThemes", initThemes);
|
SettingsStore.addChangeListener("enabledThemes", initThemes);
|
||||||
|
|
||||||
if (!IS_WEB)
|
if (!IS_WEB) {
|
||||||
VencordNative.quickCss.addThemeChangeListener(initThemes);
|
VencordNative.quickCss.addThemeChangeListener(initThemes);
|
||||||
|
}
|
||||||
|
|
||||||
|
initThemes();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export function initQuickCssThemeStore() {
|
||||||
|
initThemes();
|
||||||
|
|
||||||
|
let currentTheme = ThemeStore.theme;
|
||||||
|
ThemeStore.addChangeListener(() => {
|
||||||
|
if (currentTheme === ThemeStore.theme) return;
|
||||||
|
|
||||||
|
currentTheme = ThemeStore.theme;
|
||||||
|
initThemes();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -17,8 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { LazyComponent, LazyComponentWrapper } from "@utils/react";
|
import { LazyComponent, LazyComponentWrapper } from "@utils/react";
|
||||||
|
import { FilterFn, filters, lazyWebpackSearchHistory, waitFor } from "@webpack";
|
||||||
import { FilterFn, filters, lazyWebpackSearchHistory, waitFor } from "../webpack";
|
|
||||||
|
|
||||||
export function waitForComponent<T extends React.ComponentType<any> = React.ComponentType<any> & Record<string, any>>(name: string, filter: FilterFn | string | string[]) {
|
export function waitForComponent<T extends React.ComponentType<any> = React.ComponentType<any> & Record<string, any>>(name: string, filter: FilterFn | string | string[]) {
|
||||||
if (IS_REPORTER) lazyWebpackSearchHistory.push(["waitForComponent", Array.isArray(filter) ? filter : [filter]]);
|
if (IS_REPORTER) lazyWebpackSearchHistory.push(["waitForComponent", Array.isArray(filter) ? filter : [filter]]);
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { filters, mapMangledModuleLazy, waitFor, wreq } from "../webpack";
|
import { filters, mapMangledModuleLazy, waitFor, wreq } from "@webpack";
|
||||||
|
|
||||||
import type * as t from "./types/menu";
|
import type * as t from "./types/menu";
|
||||||
|
|
||||||
export const Menu = {} as t.Menu;
|
export const Menu = {} as t.Menu;
|
||||||
|
|
|
@ -32,7 +32,7 @@ export let MessageStore: Omit<Stores.MessageStore, "getMessages"> & GenericStore
|
||||||
getMessages(chanId: string): any;
|
getMessages(chanId: string): any;
|
||||||
};
|
};
|
||||||
|
|
||||||
// this is not actually a FluxStore
|
// TODO: The correct name for this is ChannelActionCreators and it has already been exported again from utils. Remove this export once enough time has passed
|
||||||
export const PrivateChannelsStore = findByPropsLazy("openPrivateChannel");
|
export const PrivateChannelsStore = findByPropsLazy("openPrivateChannel");
|
||||||
export let PermissionStore: GenericStore;
|
export let PermissionStore: GenericStore;
|
||||||
export let GuildChannelStore: GenericStore;
|
export let GuildChannelStore: GenericStore;
|
||||||
|
@ -89,4 +89,8 @@ waitForStore("WindowStore", m => WindowStore = m);
|
||||||
waitForStore("EmojiStore", m => EmojiStore = m);
|
waitForStore("EmojiStore", m => EmojiStore = m);
|
||||||
waitForStore("StickersStore", m => StickersStore = m);
|
waitForStore("StickersStore", m => StickersStore = m);
|
||||||
waitForStore("TypingStore", m => TypingStore = m);
|
waitForStore("TypingStore", m => TypingStore = m);
|
||||||
waitForStore("ThemeStore", m => ThemeStore = m);
|
waitForStore("ThemeStore", m => {
|
||||||
|
ThemeStore = m;
|
||||||
|
// Importing this directly can easily cause circular imports. For this reason, use a non import access here.
|
||||||
|
Vencord.QuickCss.initQuickCssThemeStore();
|
||||||
|
});
|
||||||
|
|
|
@ -16,15 +16,15 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { _resolveReady, filters, findByCodeLazy, findByPropsLazy, findLazy, mapMangledModuleLazy, waitFor } from "@webpack";
|
||||||
import type { Channel } from "discord-types/general";
|
import type { Channel } from "discord-types/general";
|
||||||
|
|
||||||
import { _resolveReady, filters, findByCodeLazy, findByPropsLazy, findLazy, mapMangledModuleLazy, waitFor } from "../webpack";
|
|
||||||
import type * as t from "./types/utils";
|
import type * as t from "./types/utils";
|
||||||
|
|
||||||
export let FluxDispatcher: t.FluxDispatcher;
|
export let FluxDispatcher: t.FluxDispatcher;
|
||||||
waitFor(["dispatch", "subscribe"], m => {
|
waitFor(["dispatch", "subscribe"], m => {
|
||||||
FluxDispatcher = m;
|
FluxDispatcher = m;
|
||||||
// Non import call to avoid circular dependency
|
// Non import access to avoid circular dependency
|
||||||
Vencord.Plugins.subscribeAllPluginsFluxEvents(m);
|
Vencord.Plugins.subscribeAllPluginsFluxEvents(m);
|
||||||
|
|
||||||
const cb = () => {
|
const cb = () => {
|
||||||
|
@ -34,7 +34,7 @@ waitFor(["dispatch", "subscribe"], m => {
|
||||||
m.subscribe("CONNECTION_OPEN", cb);
|
m.subscribe("CONNECTION_OPEN", cb);
|
||||||
});
|
});
|
||||||
|
|
||||||
export let ComponentDispatch;
|
export let ComponentDispatch: any;
|
||||||
waitFor(["dispatchToLastSubscribed"], m => ComponentDispatch = m);
|
waitFor(["dispatchToLastSubscribed"], m => ComponentDispatch = m);
|
||||||
|
|
||||||
export const Constants: t.Constants = mapMangledModuleLazy('ME:"/users/@me"', {
|
export const Constants: t.Constants = mapMangledModuleLazy('ME:"/users/@me"', {
|
||||||
|
@ -179,6 +179,7 @@ export const MessageActions = findByPropsLazy("editMessage", "sendMessage");
|
||||||
export const MessageCache = findByPropsLazy("clearCache", "_channelMessages");
|
export const MessageCache = findByPropsLazy("clearCache", "_channelMessages");
|
||||||
export const UserProfileActions = findByPropsLazy("openUserProfileModal", "closeUserProfileModal");
|
export const UserProfileActions = findByPropsLazy("openUserProfileModal", "closeUserProfileModal");
|
||||||
export const InviteActions = findByPropsLazy("resolveInvite");
|
export const InviteActions = findByPropsLazy("resolveInvite");
|
||||||
|
export const ChannelActionCreators = findByPropsLazy("openPrivateChannel");
|
||||||
|
|
||||||
export const IconUtils: t.IconUtils = findByPropsLazy("getGuildBannerURL", "getUserAvatarURL");
|
export const IconUtils: t.IconUtils = findByPropsLazy("getGuildBannerURL", "getUserAvatarURL");
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ export function getFactoryPatchedBy(moduleId: PropertyKey, webpackRequire = wreq
|
||||||
return webpackRequire.m[moduleId]?.[SYM_PATCHED_BY];
|
return webpackRequire.m[moduleId]?.[SYM_PATCHED_BY];
|
||||||
}
|
}
|
||||||
|
|
||||||
const logger = new Logger("WebpackInterceptor", "#8caaee");
|
const logger = new Logger("WebpackPatcher", "#8caaee");
|
||||||
|
|
||||||
/** Whether we tried to fallback to the WebpackRequire of the factory, or disabled patches */
|
/** Whether we tried to fallback to the WebpackRequire of the factory, or disabled patches */
|
||||||
let wreqFallbackApplied = false;
|
let wreqFallbackApplied = false;
|
||||||
|
@ -436,12 +436,21 @@ function runFactoryWithWrap(patchedFactory: PatchedModuleFactory, thisArg: unkno
|
||||||
callback(exports, module.id);
|
callback(exports, module.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
logger.error(
|
||||||
|
"Error while filtering or firing callback for Webpack waitFor subscription:\n", err,
|
||||||
|
"\n\nModule exports:", exports,
|
||||||
|
"\n\nFilter:", filter,
|
||||||
|
"\n\nCallback:", callback
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof exports !== "object") {
|
if (typeof exports !== "object") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const exportKey in exports) {
|
for (const exportKey in exports) {
|
||||||
|
try {
|
||||||
// Some exports might have not been initialized yet due to circular imports, so try catch it.
|
// Some exports might have not been initialized yet due to circular imports, so try catch it.
|
||||||
try {
|
try {
|
||||||
var exportValue = exports[exportKey];
|
var exportValue = exports[exportKey];
|
||||||
|
@ -454,9 +463,14 @@ function runFactoryWithWrap(patchedFactory: PatchedModuleFactory, thisArg: unkno
|
||||||
callback(exportValue, module.id);
|
callback(exportValue, module.id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
logger.error(
|
||||||
|
"Error while filtering or firing callback for Webpack waitFor subscription:\n", err,
|
||||||
|
"\n\nExport value:", exports,
|
||||||
|
"\n\nFilter:", filter,
|
||||||
|
"\n\nCallback:", callback
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
logger.error("Error while firing callback for Webpack waitFor subscription:\n", err, filter, callback);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,9 +145,17 @@ function makePropertyNonEnumerable(target: Record<PropertyKey, any>, key: Proper
|
||||||
}
|
}
|
||||||
|
|
||||||
export function _blacklistBadModules(requireCache: NonNullable<AnyWebpackRequire["c"]>, exports: ModuleExports, moduleId: PropertyKey) {
|
export function _blacklistBadModules(requireCache: NonNullable<AnyWebpackRequire["c"]>, exports: ModuleExports, moduleId: PropertyKey) {
|
||||||
if (shouldIgnoreValue(exports)) {
|
try {
|
||||||
makePropertyNonEnumerable(requireCache, moduleId);
|
if (shouldIgnoreValue(exports)) {
|
||||||
return true;
|
makePropertyNonEnumerable(requireCache, moduleId);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
logger.error(
|
||||||
|
"Error while blacklisting module:\n", err,
|
||||||
|
"\n\nModule id:", moduleId,
|
||||||
|
"\n\nModule exports:", exports,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof exports !== "object") {
|
if (typeof exports !== "object") {
|
||||||
|
@ -156,17 +164,25 @@ export function _blacklistBadModules(requireCache: NonNullable<AnyWebpackRequire
|
||||||
|
|
||||||
let hasOnlyBadProperties = true;
|
let hasOnlyBadProperties = true;
|
||||||
for (const exportKey in exports) {
|
for (const exportKey in exports) {
|
||||||
// Some exports might have not been initialized yet due to circular imports, so try catch it.
|
|
||||||
try {
|
try {
|
||||||
var exportValue = exports[exportKey];
|
// Some exports might have not been initialized yet due to circular imports, so try catch it.
|
||||||
} catch {
|
try {
|
||||||
continue;
|
var exportValue = exports[exportKey];
|
||||||
}
|
} catch {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldIgnoreValue(exportValue)) {
|
if (shouldIgnoreValue(exportValue)) {
|
||||||
makePropertyNonEnumerable(exports, exportKey);
|
makePropertyNonEnumerable(exports, exportKey);
|
||||||
} else {
|
} else {
|
||||||
hasOnlyBadProperties = false;
|
hasOnlyBadProperties = false;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
logger.error(
|
||||||
|
"Error while blacklistng module:\n", err,
|
||||||
|
"\n\nModule id:", moduleId,
|
||||||
|
"\n\nExport value:", exportValue,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue