mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
fix(plugins): keep test helpers out of contract barrels (#63311)
Merged via squash.
Prepared head SHA: 769e90c6af
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
loadPluginManifestRegistry,
|
||||
type PluginManifestRecord,
|
||||
} from "../plugins/manifest-registry.js";
|
||||
import { normalizeBundledPluginArtifactSubpath } from "../plugins/public-surface-runtime.js";
|
||||
|
||||
const ALWAYS_ALLOWED_RUNTIME_DIR_NAMES = new Set([
|
||||
"image-generation-core",
|
||||
@@ -166,7 +167,7 @@ export function resolveRegistryPluginModuleLocation(params: {
|
||||
(plugin) => path.basename(plugin.rootDir) === params.dirName,
|
||||
(plugin) => plugin.channels.includes(params.dirName),
|
||||
];
|
||||
const artifactBasename = params.artifactBasename.replace(/^\.\//u, "");
|
||||
const artifactBasename = normalizeBundledPluginArtifactSubpath(params.artifactBasename);
|
||||
const sourceBaseName = artifactBasename.replace(/\.js$/u, "");
|
||||
for (const matchFn of tiers) {
|
||||
for (const record of registry.filter(matchFn)) {
|
||||
|
||||
@@ -4,7 +4,10 @@ import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { openBoundaryFileSync } from "../infra/boundary-file-read.js";
|
||||
import { resolveBundledPluginsDir } from "../plugins/bundled-dir.js";
|
||||
import { resolveBundledPluginPublicSurfacePath } from "../plugins/public-surface-runtime.js";
|
||||
import {
|
||||
normalizeBundledPluginArtifactSubpath,
|
||||
resolveBundledPluginPublicSurfacePath,
|
||||
} from "../plugins/public-surface-runtime.js";
|
||||
import {
|
||||
buildPluginLoaderJitiOptions,
|
||||
resolvePluginLoaderJitiConfig,
|
||||
@@ -62,7 +65,8 @@ function resolveSourceFirstPublicSurfacePath(params: {
|
||||
dirName: string;
|
||||
artifactBasename: string;
|
||||
}): string | null {
|
||||
const sourceBaseName = params.artifactBasename.replace(/\.js$/u, "");
|
||||
const artifactBasename = normalizeBundledPluginArtifactSubpath(params.artifactBasename);
|
||||
const sourceBaseName = artifactBasename.replace(/\.js$/u, "");
|
||||
const sourceRoot =
|
||||
params.bundledPluginsDir ?? path.resolve(getOpenClawPackageRoot(), "extensions");
|
||||
for (const ext of PUBLIC_SURFACE_SOURCE_EXTENSIONS) {
|
||||
|
||||
@@ -4,7 +4,10 @@ import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { resolveBundledPluginsDir } from "../plugins/bundled-dir.js";
|
||||
import type { PluginManifestRecord } from "../plugins/manifest-registry.js";
|
||||
import { resolveBundledPluginPublicSurfacePath } from "../plugins/public-surface-runtime.js";
|
||||
import {
|
||||
normalizeBundledPluginArtifactSubpath,
|
||||
resolveBundledPluginPublicSurfacePath,
|
||||
} from "../plugins/public-surface-runtime.js";
|
||||
import { resolveLoaderPackageRoot } from "../plugins/sdk-alias.js";
|
||||
import {
|
||||
loadBundledPluginPublicSurfaceModuleSync as loadBundledPluginPublicSurfaceModuleSyncLight,
|
||||
@@ -44,7 +47,8 @@ function resolveSourceFirstPublicSurfacePath(params: {
|
||||
dirName: string;
|
||||
artifactBasename: string;
|
||||
}): string | null {
|
||||
const sourceBaseName = params.artifactBasename.replace(/\.js$/u, "");
|
||||
const artifactBasename = normalizeBundledPluginArtifactSubpath(params.artifactBasename);
|
||||
const sourceBaseName = artifactBasename.replace(/\.js$/u, "");
|
||||
const sourceRoot = params.bundledPluginsDir ?? path.resolve(OPENCLAW_PACKAGE_ROOT, "extensions");
|
||||
for (const ext of PUBLIC_SURFACE_SOURCE_EXTENSIONS) {
|
||||
const candidate = path.resolve(sourceRoot, params.dirName, `${sourceBaseName}${ext}`);
|
||||
@@ -66,7 +70,7 @@ function resolveRegistryPluginModuleLocationFromRegistry(params: {
|
||||
(plugin) => path.basename(plugin.rootDir) === params.dirName,
|
||||
(plugin) => plugin.channels.includes(params.dirName),
|
||||
];
|
||||
const artifactBasename = params.artifactBasename.replace(/^\.\//u, "");
|
||||
const artifactBasename = normalizeBundledPluginArtifactSubpath(params.artifactBasename);
|
||||
const sourceBaseName = artifactBasename.replace(/\.js$/u, "");
|
||||
for (const matchFn of tiers) {
|
||||
for (const record of params.registry.filter(matchFn)) {
|
||||
|
||||
Reference in New Issue
Block a user