Path aliases, better lazyWebpack (#268)

This commit is contained in:
Ven 2022-11-28 13:37:55 +01:00 committed by GitHub
parent 7a4402f142
commit bad96b7887
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
138 changed files with 572 additions and 547 deletions

View file

@ -16,9 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { FilterFn, find } from "../webpack";
import { React } from "../webpack/common";
import { proxyLazy } from "./proxyLazy";
import { React } from "@webpack/common";
/**
* Makes a lazy function. On first call, the value is computed.
@ -29,16 +27,6 @@ export function makeLazy<T>(factory: () => T): () => T {
let cache: T;
return () => cache ?? (cache = factory());
}
export const lazy = makeLazy;
/**
* Do a lazy webpack search. Searches the module on first property access
* @param filter Filter function
* @returns A proxy to the webpack module. Not all traps are implemented, may produce unexpected results.
*/
export function lazyWebpack<T = any>(filter: FilterFn): T {
return proxyLazy(() => find(filter));
}
type AwaiterRes<T> = [T, any, boolean, () => void];
/**