

























@@ -15,6 +15,7 @@ type BundledPluginSource = {
1515 manifest: {
1616 id: string;
1717channels?: unknown;
18+channelEnvVars?: unknown;
1819name?: string;
1920description?: string;
2021} & Record<string, unknown>;
@@ -61,6 +62,10 @@ const { writeGeneratedOutput } = (await import(
6162type BundledChannelConfigMetadata = {
6263pluginId: string;
6364channelId: string;
65+aliases?: readonly string[];
66+order?: number;
67+configurable?: boolean;
68+channelEnvVars?: readonly string[];
6469label?: string;
6570description?: string;
6671schema: Record<string, unknown>;
@@ -134,6 +139,56 @@ function resolveRootDescription(
134139return undefined;
135140}
136141142+function resolveRootAliases(source: BundledPluginSource, channelId: string): string[] {
143+const channelMeta = resolvePackageChannelMeta(source);
144+if (channelMeta?.id !== channelId || !Array.isArray(channelMeta.aliases)) {
145+return [];
146+}
147+return [
148+ ...new Set(
149+channelMeta.aliases
150+.map((alias) => (typeof alias === "string" ? alias.trim().toLowerCase() : ""))
151+.filter((alias) => alias.length > 0),
152+),
153+].toSorted((left, right) => left.localeCompare(right));
154+}
155+156+function resolveRootOrder(source: BundledPluginSource, channelId: string): number | undefined {
157+const channelMeta = resolvePackageChannelMeta(source);
158+const order = channelMeta?.id === channelId ? channelMeta.order : undefined;
159+return typeof order === "number" && Number.isFinite(order) ? order : undefined;
160+}
161+162+function resolveRootConfigurable(source: BundledPluginSource, channelId: string): boolean {
163+const channelMeta = resolvePackageChannelMeta(source);
164+const exposure =
165+channelMeta?.id === channelId &&
166+channelMeta.exposure &&
167+typeof channelMeta.exposure === "object" &&
168+!Array.isArray(channelMeta.exposure)
169+ ? (channelMeta.exposure as Record<string, unknown>)
170+ : null;
171+return exposure?.configured !== false;
172+}
173+174+function resolveRootChannelEnvVars(source: BundledPluginSource, channelId: string): string[] {
175+ const raw = source.manifest.channelEnvVars;
176+if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
177+return [];
178+}
179+const value = (raw as Record<string, unknown>)[channelId];
180+if (!Array.isArray(value)) {
181+return [];
182+}
183+return [
184+ ...new Set(
185+value
186+.map((entry) => (typeof entry === "string" ? entry.trim() : ""))
187+.filter((entry) => entry.length > 0),
188+),
189+].toSorted((left, right) => left.localeCompare(right));
190+}
191+137192function formatTypeScriptModule(source: string, outputPath: string, repoRoot: string): string {
138193return formatGeneratedModule(source, {
139194 repoRoot,
@@ -202,6 +257,10 @@ export async function collectBundledChannelConfigMetadata(params?: { repoRoot?:
202257 continue;
203258}
204259for (const channelId of channelIds) {
260+const aliases = resolveRootAliases(source, channelId);
261+const order = resolveRootOrder(source, channelId);
262+const configurable = resolveRootConfigurable(source, channelId);
263+const channelEnvVars = resolveRootChannelEnvVars(source, channelId);
205264const label = resolveRootLabel(source, channelId);
206265const description = resolveRootDescription(source, channelId);
207266const unsupportedSecretRefSurfacePatterns = resolveChannelUnsupportedSecretRefSurfacePatterns(
@@ -211,6 +270,10 @@ export async function collectBundledChannelConfigMetadata(params?: { repoRoot?:
211270entries.push({
212271pluginId: source.manifest.id,
213272 channelId,
273+ ...(aliases.length > 0 ? { aliases } : {}),
274+ ...(order === undefined ? {} : { order }),
275+ ...(configurable ? {} : { configurable }),
276+ ...(channelEnvVars.length > 0 ? { channelEnvVars } : {}),
214277 ...(label ? { label } : {}),
215278 ...(description ? { description } : {}),
216279schema: surface.schema,
@@ -240,6 +303,10 @@ export async function writeBundledChannelConfigMetadataModule(params?: {
240303type BundledChannelConfigMetadata = {
241304 pluginId: string;
242305 channelId: string;
306+ aliases?: readonly string[];
307+ order?: number;
308+ configurable?: boolean;
309+ channelEnvVars?: readonly string[];
243310 label?: string;
244311 description?: string;
245312 schema: Record<string, unknown>;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。