mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:10:43 +00:00
perf(plugins): prefer native jiti for bundled plugin dist modules
This commit is contained in:
committed by
Gustavo Madeira Santana
parent
fe663de8c7
commit
314f11ba8f
@@ -916,12 +916,16 @@ describe("plugin sdk alias helpers", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps bundled plugin dist modules on the aliased Jiti path", () => {
|
||||
it("prefers native jiti for bundled plugin dist .js modules, keeps .ts on aliased path", () => {
|
||||
// Built .js/.mjs/.cjs files under dist/extensions/ should now delegate
|
||||
// to shouldPreferNativeJiti() — which returns true on Linux/macOS for
|
||||
// compiled artifacts, avoiding the slow jiti transform path.
|
||||
expect(
|
||||
resolvePluginLoaderJitiTryNative(`/repo/${bundledDistPluginFile("browser", "index.js")}`, {
|
||||
preferBuiltDist: true,
|
||||
}),
|
||||
).toBe(false);
|
||||
).toBe(true);
|
||||
// TypeScript source files still need jiti's transform pipeline.
|
||||
expect(
|
||||
resolvePluginLoaderJitiTryNative(`/repo/${bundledDistPluginFile("browser", "helper.ts")}`, {
|
||||
preferBuiltDist: true,
|
||||
|
||||
@@ -671,7 +671,7 @@ export function resolvePluginLoaderJitiTryNative(
|
||||
},
|
||||
): boolean {
|
||||
if (isBundledPluginDistModulePath(modulePath)) {
|
||||
return false;
|
||||
return shouldPreferNativeJiti(modulePath);
|
||||
}
|
||||
return (
|
||||
shouldPreferNativeJiti(modulePath) ||
|
||||
|
||||
Reference in New Issue
Block a user