fix(plugins): share public surface source extensions

This commit is contained in:
Vincent Koc
2026-04-14 17:29:16 +01:00
parent 1b73ce9193
commit f12d6bf3bb
7 changed files with 31 additions and 8 deletions

View File

@@ -13,8 +13,8 @@ import type {
PluginManifest,
PluginManifestChannelConfig,
} from "./manifest.js";
import { PUBLIC_SURFACE_SOURCE_EXTENSIONS } from "./public-surface-runtime.js";
const PUBLIC_SURFACE_SOURCE_EXTENSIONS = [".ts", ".mts", ".js", ".mjs", ".cts", ".cjs"] as const;
const SOURCE_CONFIG_SCHEMA_CANDIDATES = [
path.join("src", "config-schema.ts"),
path.join("src", "config-schema.js"),

View File

@@ -2,8 +2,8 @@ import fs from "node:fs";
import path from "node:path";
import { normalizeOptionalString } from "../shared/string-coerce.js";
import { normalizeTrimmedStringList } from "../shared/string-normalization.js";
import { PUBLIC_SURFACE_SOURCE_EXTENSIONS } from "./public-surface-runtime.js";
const PUBLIC_SURFACE_SOURCE_EXTENSIONS = [".ts", ".mts", ".js", ".mjs", ".cts", ".cjs"] as const;
const RUNTIME_SIDECAR_ARTIFACTS = new Set([
"helper-api.js",
"light-runtime-api.js",

View File

@@ -1,7 +1,21 @@
import { describe, expect, it } from "vitest";
import { normalizeBundledPluginArtifactSubpath } from "./public-surface-runtime.js";
import {
PUBLIC_SURFACE_SOURCE_EXTENSIONS,
normalizeBundledPluginArtifactSubpath,
} from "./public-surface-runtime.js";
describe("bundled plugin public surface runtime", () => {
it("exports the canonical public surface source extension list", () => {
expect(PUBLIC_SURFACE_SOURCE_EXTENSIONS).toEqual([
".ts",
".mts",
".js",
".mjs",
".cts",
".cjs",
]);
});
it("allows plugin-local nested artifact paths", () => {
expect(normalizeBundledPluginArtifactSubpath("src/outbound-adapter.js")).toBe(
"src/outbound-adapter.js",

View File

@@ -2,7 +2,14 @@ import fs from "node:fs";
import path from "node:path";
import { resolveBundledPluginsDir } from "./bundled-dir.js";
const PUBLIC_SURFACE_SOURCE_EXTENSIONS = [".ts", ".mts", ".js", ".mjs", ".cts", ".cjs"] as const;
export const PUBLIC_SURFACE_SOURCE_EXTENSIONS = [
".ts",
".mts",
".js",
".mjs",
".cts",
".cjs",
] as const;
export function normalizeBundledPluginArtifactSubpath(artifactBasename: string): string {
if (