Fixes Sources interceptor and names Patcher function (#1647)
* Make patches easily spotted as opposed to 'anonymous' * reset source back to original method instead of getting the interceptor back in `BdApi.Webpack.modules` * fixes d5ce64
This commit is contained in:
parent
28b8c15e7f
commit
f986a7fc4d
|
@ -50,7 +50,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
static makeOverride(patch) {
|
static makeOverride(patch) {
|
||||||
return function () {
|
return function BDPatcher() {
|
||||||
let returnValue;
|
let returnValue;
|
||||||
if (!patch.children || !patch.children.length) return patch.originalFunction.apply(this, arguments);
|
if (!patch.children || !patch.children.length) return patch.originalFunction.apply(this, arguments);
|
||||||
for (const superPatch of patch.children.filter(c => c.type === "before")) {
|
for (const superPatch of patch.children.filter(c => c.type === "before")) {
|
||||||
|
|
|
@ -524,6 +524,9 @@ export default class WebpackModules {
|
||||||
catch (error) {
|
catch (error) {
|
||||||
Logger.stacktrace("WebpackModules", "Could not patch pushed module", error);
|
Logger.stacktrace("WebpackModules", "Could not patch pushed module", error);
|
||||||
}
|
}
|
||||||
|
finally{
|
||||||
|
require.m[moduleId] = originalModule;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.assign(modules[moduleId], originalModule, {
|
Object.assign(modules[moduleId], originalModule, {
|
||||||
|
|
Loading…
Reference in New Issue