mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-09 15:59:30 +00:00
fix(scripts): catch namespace plugin sdk wildcard exports
This commit is contained in:
parent
c061373ede
commit
a59b2f2958
2 changed files with 7 additions and 2 deletions
|
|
@ -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 });
|
||||
|
|
|
|||
|
|
@ -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([]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue