fix: enable native require fast path on Windows for plugin-sdk root a… · openclaw/openclaw@4223dd2
medns
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -342,6 +342,7 @@ Docs: https://docs.openclaw.ai
|
342 | 342 | - Agents: abort generic repeated no-progress tool loops at the critical threshold when identical calls keep returning identical outcomes. (#80668) Thanks @frankekn. |
343 | 343 | - Exec approvals: omit generated command highlights for non-POSIX Windows and shell-wrapper approval commands until those command languages have native highlighting support. (#80566) Thanks @jesse-merhi. |
344 | 344 | - Telegram: keep verbose tool progress and result drafts separate from the final assistant answer so tool output no longer blends into the final Telegram message. (#80294) Thanks @jalehman. |
| 345 | +- Plugin SDK/Windows: enable the native require fast path for root `openclaw/plugin-sdk` dist aliases instead of forcing Jiti transforms. (#80878) Thanks @medns. |
345 | 346 | |
346 | 347 | ## 2026.5.9 |
347 | 348 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -195,22 +195,20 @@ function buildPluginSdkAliasMap(useDist) {
|
195 | 195 | } |
196 | 196 | |
197 | 197 | function getModuleLoader(tryNative) { |
198 | | -const effectiveTryNative = process.platform === "win32" ? false : tryNative; |
199 | | - |
200 | | -if (moduleLoaders.has(effectiveTryNative)) { |
201 | | -return moduleLoaders.get(effectiveTryNative); |
| 198 | +if (moduleLoaders.has(tryNative)) { |
| 199 | +return moduleLoaders.get(tryNative); |
202 | 200 | } |
203 | 201 | |
204 | 202 | const { createJiti } = require("jiti"); |
205 | 203 | const moduleLoader = createJiti(__filename, { |
206 | | -alias: buildPluginSdkAliasMap(effectiveTryNative), |
| 204 | +alias: buildPluginSdkAliasMap(tryNative), |
207 | 205 | interopDefault: true, |
208 | 206 | // Prefer Node's native sync ESM loader for built dist/plugin-sdk/*.js files |
209 | 207 | // so local plugins do not create a second transpiled OpenClaw core graph. |
210 | | -tryNative: effectiveTryNative, |
| 208 | + tryNative, |
211 | 209 | extensions: [".ts", ".tsx", ".mts", ".cts", ".mtsx", ".ctsx", ".js", ".mjs", ".cjs", ".json"], |
212 | 210 | }); |
213 | | -moduleLoaders.set(effectiveTryNative, moduleLoader); |
| 211 | +moduleLoaders.set(tryNative, moduleLoader); |
214 | 212 | return moduleLoader; |
215 | 213 | } |
216 | 214 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -327,7 +327,7 @@ describe("plugin-sdk root alias", () => {
|
327 | 327 | expectedTryNative: false, |
328 | 328 | }, |
329 | 329 | { |
330 | | -name: "prefers source loading on Windows even when compat resolves to dist", |
| 330 | +name: "prefers native loading on Windows when compat resolves to dist", |
331 | 331 | options: { |
332 | 332 | distExists: true, |
333 | 333 | env: { NODE_ENV: "production" }, |
@@ -336,7 +336,7 @@ describe("plugin-sdk root alias", () => {
|
336 | 336 | slowHelper: (): string => "loaded", |
337 | 337 | }, |
338 | 338 | }, |
339 | | -expectedTryNative: false, |
| 339 | +expectedTryNative: true, |
340 | 340 | }, |
341 | 341 | ])("$name", ({ options, expectedTryNative }) => { |
342 | 342 | const lazyModule = loadRootAliasWithStubs(options); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。