chore: initialize my-pi extension bundle

This commit is contained in:
云服务部-叶林立
2026-08-18 12:30:48 +08:00
parent 7b7b332912
commit 0637139a16
62 changed files with 11055 additions and 1 deletions
@@ -0,0 +1,14 @@
/**
* Creates a memoized lazy loader for a dynamically imported module.
*
* The first call triggers `import(specifier)`; subsequent calls reuse the
* cached promise. This avoids re-importing the module on every invocation
* while keeping the heavy module out of the synchronous startup path.
*/
export function createLazyModuleLoader<T>(specifier: string): () => Promise<T> {
let cached: Promise<T> | undefined;
return (): Promise<T> => {
cached ??= import(specifier) as Promise<T>;
return cached;
};
}