Add $$vencordPatchedSource
This commit is contained in:
parent
6cc2f53501
commit
50bb6d867b
|
@ -209,6 +209,10 @@ function defineModulesFactoryGetter(id: PropertyKey, factory: WrappedModuleFacto
|
||||||
if (factory.$$vencordOriginal != null) {
|
if (factory.$$vencordOriginal != null) {
|
||||||
factory.toString = newFactory.toString.bind(newFactory);
|
factory.toString = newFactory.toString.bind(newFactory);
|
||||||
factory.$$vencordOriginal = newFactory;
|
factory.$$vencordOriginal = newFactory;
|
||||||
|
|
||||||
|
if (factory.$$vencordPatchedSource != null) {
|
||||||
|
newFactory.$$vencordPatchedSource = newFactory.$$vencordPatchedSource;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
factory = newFactory;
|
factory = newFactory;
|
||||||
}
|
}
|
||||||
|
@ -366,6 +370,13 @@ function wrapAndPatchFactory(id: PropertyKey, originalFactory: AnyModuleFactory)
|
||||||
wrappedFactory.toString = originalFactory.toString.bind(originalFactory);
|
wrappedFactory.toString = originalFactory.toString.bind(originalFactory);
|
||||||
wrappedFactory.$$vencordOriginal = originalFactory;
|
wrappedFactory.$$vencordOriginal = originalFactory;
|
||||||
|
|
||||||
|
if (patchedFactory !== originalFactory) {
|
||||||
|
const patchedSource = String(patchedFactory);
|
||||||
|
|
||||||
|
wrappedFactory.$$vencordPatchedSource = patchedSource;
|
||||||
|
originalFactory.$$vencordPatchedSource = patchedSource;
|
||||||
|
}
|
||||||
|
|
||||||
return wrappedFactory;
|
return wrappedFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
src/webpack/wreq.d.ts
vendored
5
src/webpack/wreq.d.ts
vendored
|
@ -193,10 +193,13 @@ export type AnyWebpackRequire = ((moduleId: PropertyKey) => ModuleExports) & Par
|
||||||
};
|
};
|
||||||
|
|
||||||
/** exports can be anything, however initially it is always an empty object */
|
/** exports can be anything, however initially it is always an empty object */
|
||||||
export type AnyModuleFactory = (this: ModuleExports, module: Module, exports: ModuleExports, require: AnyWebpackRequire) => void;
|
export type AnyModuleFactory = ((this: ModuleExports, module: Module, exports: ModuleExports, require: AnyWebpackRequire) => void) & {
|
||||||
|
$$vencordPatchedSource?: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type WrappedModuleFactory = AnyModuleFactory & {
|
export type WrappedModuleFactory = AnyModuleFactory & {
|
||||||
$$vencordOriginal?: AnyModuleFactory;
|
$$vencordOriginal?: AnyModuleFactory;
|
||||||
|
$$vencordPatchedSource?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WrappedModuleFactories = Record<PropertyKey, WrappedModuleFactory>;
|
export type WrappedModuleFactories = Record<PropertyKey, WrappedModuleFactory>;
|
||||||
|
|
Loading…
Reference in a new issue