Vendor OpenClaw source as Adolf fork baseline
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
This commit is contained in:
316
scripts/lib/bundled-plugin-build-entries.mjs
Normal file
316
scripts/lib/bundled-plugin-build-entries.mjs
Normal file
@@ -0,0 +1,316 @@
|
||||
// Discovers bundled plugin source entries, package artifacts, and root excludes for builds.
|
||||
import { spawnSync } from "node:child_process";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import {
|
||||
BUNDLED_PLUGIN_ROOT_DIR,
|
||||
bundledDistPluginFile,
|
||||
bundledPluginFile,
|
||||
} from "./bundled-plugin-paths.mjs";
|
||||
import { shouldBuildBundledCluster } from "./optional-bundled-clusters.mjs";
|
||||
|
||||
const TOP_LEVEL_PUBLIC_SURFACE_EXTENSIONS = new Set([".ts", ".js", ".mts", ".cts", ".mjs", ".cjs"]);
|
||||
/** Bundled plugin directories built with core but not packaged as standalone npm plugins. */
|
||||
export const NON_PACKAGED_BUNDLED_PLUGIN_DIRS = new Set(["qa-channel", "qa-lab", "qa-matrix"]);
|
||||
const EXCLUDED_CORE_BUNDLED_PLUGIN_DIRS = new Set(["qqbot", "whatsapp"]);
|
||||
const BUNDLED_PLUGIN_BUILD_IDS_ENV = "OPENCLAW_BUNDLED_PLUGIN_BUILD_IDS";
|
||||
const TOP_LEVEL_PRIVATE_TEST_SURFACE_RE =
|
||||
/(?:^|[._-])(?:test|spec|test-support|test-helpers|test-fixtures|test-harness|mock-setup)(?:[._-]|$)/u;
|
||||
const toPosixPath = (value) => value.replaceAll("\\", "/");
|
||||
|
||||
function parseBundledPluginBuildIdFilter(env = process.env) {
|
||||
const raw = env[BUNDLED_PLUGIN_BUILD_IDS_ENV];
|
||||
if (typeof raw !== "string" || raw.trim() === "") {
|
||||
return null;
|
||||
}
|
||||
return new Set(
|
||||
raw
|
||||
.split(",")
|
||||
.map((entry) => entry.trim())
|
||||
.filter((entry) => entry.length > 0),
|
||||
);
|
||||
}
|
||||
|
||||
function readBundledPluginPackageJson(packageJsonPath, options = {}) {
|
||||
if (!(options.hasPackageJson ?? fs.existsSync(packageJsonPath))) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function isManifestlessBundledRuntimeSupportPackage(params) {
|
||||
if (params.packageJson?.openclaw?.release?.publishToNpm === true) {
|
||||
return false;
|
||||
}
|
||||
const packageName = typeof params.packageJson?.name === "string" ? params.packageJson.name : "";
|
||||
if (packageName !== `@openclaw/${params.dirName}`) {
|
||||
return false;
|
||||
}
|
||||
return params.topLevelPublicSurfaceEntries.length > 0;
|
||||
}
|
||||
|
||||
function shouldBuildBundledDistEntry(packageJson) {
|
||||
return packageJson?.openclaw?.build?.bundledDist !== false;
|
||||
}
|
||||
|
||||
function isExcludedTopLevelPublicSurfaceFile(fileName) {
|
||||
const normalizedName = fileName.toLowerCase();
|
||||
return (
|
||||
normalizedName.endsWith(".d.ts") ||
|
||||
/^config-api\.(?:[cm]?[jt]s)$/u.test(normalizedName) ||
|
||||
TOP_LEVEL_PRIVATE_TEST_SURFACE_RE.test(normalizedName) ||
|
||||
normalizedName.includes(".fixture.") ||
|
||||
normalizedName.includes(".snap")
|
||||
);
|
||||
}
|
||||
|
||||
/** Collect plugin source entry files declared by package export metadata. */
|
||||
export function collectPluginSourceEntries(packageJson) {
|
||||
let packageEntries = Array.isArray(packageJson?.openclaw?.extensions)
|
||||
? packageJson.openclaw.extensions.filter(
|
||||
(entry) => typeof entry === "string" && entry.trim().length > 0,
|
||||
)
|
||||
: [];
|
||||
const setupEntry =
|
||||
typeof packageJson?.openclaw?.setupEntry === "string" &&
|
||||
packageJson.openclaw.setupEntry.trim().length > 0
|
||||
? packageJson.openclaw.setupEntry
|
||||
: undefined;
|
||||
if (setupEntry) {
|
||||
packageEntries = Array.from(new Set([...packageEntries, setupEntry]));
|
||||
}
|
||||
return packageEntries.length > 0 ? packageEntries : ["./index.ts"];
|
||||
}
|
||||
|
||||
/** Collect top-level public plugin surface files that should be built. */
|
||||
export function collectTopLevelPublicSurfaceEntries(pluginDir) {
|
||||
if (!fs.existsSync(pluginDir)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return fs
|
||||
.readdirSync(pluginDir, { withFileTypes: true })
|
||||
.flatMap((dirent) => {
|
||||
if (!dirent.isFile()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const ext = path.extname(dirent.name);
|
||||
if (!TOP_LEVEL_PUBLIC_SURFACE_EXTENSIONS.has(ext)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (isExcludedTopLevelPublicSurfaceFile(dirent.name)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [`./${dirent.name}`];
|
||||
})
|
||||
.toSorted((left, right) => left.localeCompare(right));
|
||||
}
|
||||
|
||||
function collectTopLevelPublicSurfaceEntriesFromFiles(relativeFiles) {
|
||||
return relativeFiles
|
||||
.flatMap((relativeFile) => {
|
||||
if (relativeFile.includes("/")) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const ext = path.extname(relativeFile);
|
||||
if (!TOP_LEVEL_PUBLIC_SURFACE_EXTENSIONS.has(ext)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (isExcludedTopLevelPublicSurfaceFile(relativeFile)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [`./${relativeFile}`];
|
||||
})
|
||||
.toSorted((left, right) => left.localeCompare(right));
|
||||
}
|
||||
|
||||
function collectTrackedBundledPluginFiles(cwd) {
|
||||
const result = spawnSync("git", ["ls-files", "--", BUNDLED_PLUGIN_ROOT_DIR], {
|
||||
cwd,
|
||||
encoding: "utf8",
|
||||
stdio: ["ignore", "pipe", "ignore"],
|
||||
});
|
||||
if (result.status !== 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const filesByPlugin = new Map();
|
||||
for (const rawLine of result.stdout.split("\n")) {
|
||||
const line = toPosixPath(rawLine.trim());
|
||||
const match = new RegExp(`^${BUNDLED_PLUGIN_ROOT_DIR}/([^/]+)/(.+)$`).exec(line);
|
||||
if (!match) {
|
||||
continue;
|
||||
}
|
||||
const [, dirName, relativeFile] = match;
|
||||
const files = filesByPlugin.get(dirName) ?? [];
|
||||
files.push(relativeFile);
|
||||
filesByPlugin.set(dirName, files);
|
||||
}
|
||||
|
||||
return filesByPlugin;
|
||||
}
|
||||
|
||||
function collectBundledPluginCandidates(cwd, extensionsRoot) {
|
||||
const trackedFiles = collectTrackedBundledPluginFiles(cwd);
|
||||
if (trackedFiles) {
|
||||
return [...trackedFiles.entries()]
|
||||
.map(([dirName, relativeFiles]) => ({
|
||||
dirName,
|
||||
pluginDir: path.join(extensionsRoot, dirName),
|
||||
relativeFiles,
|
||||
topLevelPublicSurfaceEntries: collectTopLevelPublicSurfaceEntriesFromFiles(relativeFiles),
|
||||
}))
|
||||
.toSorted((left, right) => left.dirName.localeCompare(right.dirName));
|
||||
}
|
||||
|
||||
return fs
|
||||
.readdirSync(extensionsRoot, { withFileTypes: true })
|
||||
.filter((dirent) => dirent.isDirectory())
|
||||
.map((dirent) => {
|
||||
const pluginDir = path.join(extensionsRoot, dirent.name);
|
||||
return {
|
||||
dirName: dirent.name,
|
||||
pluginDir,
|
||||
relativeFiles: null,
|
||||
topLevelPublicSurfaceEntries: collectTopLevelPublicSurfaceEntries(pluginDir),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/** Collect all bundled plugin build entries for the current checkout. */
|
||||
export function collectBundledPluginBuildEntries(params = {}) {
|
||||
const cwd = params.cwd ?? process.cwd();
|
||||
const env = params.env ?? process.env;
|
||||
const extensionsRoot = path.join(cwd, BUNDLED_PLUGIN_ROOT_DIR);
|
||||
const entries = [];
|
||||
|
||||
for (const candidate of collectBundledPluginCandidates(cwd, extensionsRoot)) {
|
||||
const { dirName, pluginDir, relativeFiles, topLevelPublicSurfaceEntries } = candidate;
|
||||
const manifestPath = path.join(pluginDir, "openclaw.plugin.json");
|
||||
const hasManifest =
|
||||
relativeFiles?.includes("openclaw.plugin.json") ?? fs.existsSync(manifestPath);
|
||||
const packageJsonPath = path.join(pluginDir, "package.json");
|
||||
const packageJson = readBundledPluginPackageJson(packageJsonPath, {
|
||||
hasPackageJson: relativeFiles?.includes("package.json"),
|
||||
});
|
||||
if (
|
||||
!hasManifest &&
|
||||
!isManifestlessBundledRuntimeSupportPackage({
|
||||
dirName,
|
||||
packageJson,
|
||||
topLevelPublicSurfaceEntries,
|
||||
})
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (!shouldBuildBundledCluster(dirName, env, { packageJson })) {
|
||||
continue;
|
||||
}
|
||||
if (!shouldBuildBundledDistEntry(packageJson)) {
|
||||
continue;
|
||||
}
|
||||
if (EXCLUDED_CORE_BUNDLED_PLUGIN_DIRS.has(dirName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entries.push({
|
||||
id: dirName,
|
||||
hasManifest,
|
||||
hasPackageJson: packageJson !== null,
|
||||
packageJson,
|
||||
sourceEntries: Array.from(
|
||||
new Set([
|
||||
...(hasManifest ? collectPluginSourceEntries(packageJson) : []),
|
||||
...topLevelPublicSurfaceEntries,
|
||||
]),
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
const filteredBuildIds = parseBundledPluginBuildIdFilter(env);
|
||||
if (!filteredBuildIds) {
|
||||
return entries;
|
||||
}
|
||||
const buildableIds = new Set(entries.map((entry) => entry.id));
|
||||
const missingIds = [...filteredBuildIds].filter((id) => !buildableIds.has(id));
|
||||
if (missingIds.length > 0) {
|
||||
throw new Error(
|
||||
`${BUNDLED_PLUGIN_BUILD_IDS_ENV} references unknown bundled plugin id(s): ${missingIds
|
||||
.toSorted((left, right) => left.localeCompare(right))
|
||||
.join(", ")}`,
|
||||
);
|
||||
}
|
||||
return entries.filter((entry) => filteredBuildIds.has(entry.id));
|
||||
}
|
||||
|
||||
/** Return buildable bundled plugin entries with optional CLI filtering applied. */
|
||||
export function listBundledPluginBuildEntries(params = {}) {
|
||||
return Object.fromEntries(
|
||||
collectBundledPluginBuildEntries(params).flatMap(({ id, sourceEntries }) =>
|
||||
sourceEntries.map((entry) => {
|
||||
const normalizedEntry = entry.replace(/^\.\//, "");
|
||||
const entryKey = bundledPluginFile(id, normalizedEntry.replace(/\.[^.]+$/u, ""));
|
||||
return [entryKey, toPosixPath(path.join(BUNDLED_PLUGIN_ROOT_DIR, id, normalizedEntry))];
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/** Collect bundled extension dirs that root package builds should exclude. */
|
||||
export function collectRootPackageExcludedExtensionDirs(params = {}) {
|
||||
const cwd = params.cwd ?? process.cwd();
|
||||
const packageJsonPath = path.join(cwd, "package.json");
|
||||
const excluded = new Set();
|
||||
if (!fs.existsSync(packageJsonPath)) {
|
||||
return excluded;
|
||||
}
|
||||
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
||||
for (const entry of packageJson.files ?? []) {
|
||||
if (typeof entry !== "string") {
|
||||
continue;
|
||||
}
|
||||
const match = /^!dist\/extensions\/([^/]+)\/\*\*$/u.exec(entry);
|
||||
if (match?.[1]) {
|
||||
excluded.add(match[1]);
|
||||
}
|
||||
}
|
||||
return excluded;
|
||||
}
|
||||
|
||||
/** List package artifact files generated for bundled plugins. */
|
||||
export function listBundledPluginPackArtifacts(params = {}) {
|
||||
const excludedPackageDirs =
|
||||
params.includeRootPackageExcludedDirs === true
|
||||
? new Set()
|
||||
: collectRootPackageExcludedExtensionDirs(params);
|
||||
const entries = collectBundledPluginBuildEntries(params).filter(
|
||||
({ id }) => !NON_PACKAGED_BUNDLED_PLUGIN_DIRS.has(id) && !excludedPackageDirs.has(id),
|
||||
);
|
||||
const artifacts = new Set();
|
||||
|
||||
for (const { id, hasManifest, hasPackageJson, sourceEntries } of entries) {
|
||||
if (hasManifest) {
|
||||
artifacts.add(bundledDistPluginFile(id, "openclaw.plugin.json"));
|
||||
}
|
||||
if (hasPackageJson) {
|
||||
artifacts.add(bundledDistPluginFile(id, "package.json"));
|
||||
}
|
||||
for (const entry of sourceEntries) {
|
||||
const normalizedEntry = entry.replace(/^\.\//, "").replace(/\.[^.]+$/u, "");
|
||||
artifacts.add(bundledDistPluginFile(id, `${normalizedEntry}.js`));
|
||||
}
|
||||
}
|
||||
|
||||
return [...artifacts].toSorted((left, right) => left.localeCompare(right));
|
||||
}
|
||||
Reference in New Issue
Block a user