From a59b2f295824ab57b6e82a3fadc7db0e75ff786f Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Tue, 23 Jun 2026 10:35:28 +0200 Subject: [PATCH] fix(scripts): catch namespace plugin sdk wildcard exports --- scripts/check-plugin-sdk-wildcard-reexports.mjs | 2 +- test/scripts/check-plugin-sdk-wildcard-reexports.test.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/check-plugin-sdk-wildcard-reexports.mjs b/scripts/check-plugin-sdk-wildcard-reexports.mjs index e37dcb9c6897..4ee967317cef 100644 --- a/scripts/check-plugin-sdk-wildcard-reexports.mjs +++ b/scripts/check-plugin-sdk-wildcard-reexports.mjs @@ -9,7 +9,7 @@ const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".." const extensionsRoot = path.join(repoRoot, "extensions"); const WILDCARD_PLUGIN_SDK_REEXPORT_PATTERN = - /^\s*export\s+(?:type\s+)?\*\s+from\s+["']openclaw\/plugin-sdk\//u; + /^\s*export\s+(?:type\s+)?\*\s+(?:as\s+[$\w]+\s+)?from\s+["']openclaw\/plugin-sdk\//u; async function listExtensionApiFiles(rootDir = extensionsRoot) { const entries = await fs.readdir(rootDir, { withFileTypes: true }); diff --git a/test/scripts/check-plugin-sdk-wildcard-reexports.test.ts b/test/scripts/check-plugin-sdk-wildcard-reexports.test.ts index e0f9eacba061..2f18adcc65f9 100644 --- a/test/scripts/check-plugin-sdk-wildcard-reexports.test.ts +++ b/test/scripts/check-plugin-sdk-wildcard-reexports.test.ts @@ -8,13 +8,17 @@ describe("check-plugin-sdk-wildcard-reexports", () => { findPluginSdkWildcardReexports( [ 'export * from "openclaw/plugin-sdk/foo";', + 'export * as sdk from "openclaw/plugin-sdk/foo";', 'export type * from "openclaw/plugin-sdk/bar";', + 'export type * as sdkTypes from "openclaw/plugin-sdk/bar";', 'export { named } from "openclaw/plugin-sdk/foo";', ].join("\n"), ), ).toEqual([ { line: 1, text: 'export * from "openclaw/plugin-sdk/foo";' }, - { line: 2, text: 'export type * from "openclaw/plugin-sdk/bar";' }, + { line: 2, text: 'export * as sdk from "openclaw/plugin-sdk/foo";' }, + { line: 3, text: 'export type * from "openclaw/plugin-sdk/bar";' }, + { line: 4, text: 'export type * as sdkTypes from "openclaw/plugin-sdk/bar";' }, ]); }); @@ -25,6 +29,7 @@ describe("check-plugin-sdk-wildcard-reexports", () => { 'export { named } from "openclaw/plugin-sdk/foo";', 'export type { Named } from "openclaw/plugin-sdk/foo";', 'export * from "./src/runtime-api.js";', + 'export * as runtime from "./src/runtime-api.js";', ].join("\n"), ), ).toStrictEqual([]);