fix(channels): resolve bundled plugin mts candidates

This commit is contained in:
Vincent Koc
2026-04-14 18:01:29 +01:00
parent acd4e0a32f
commit 6b2d418973
2 changed files with 5 additions and 1 deletions

View File

@@ -46,15 +46,17 @@ describe("channel plugin module loader helpers", () => {
it("resolves plugin module candidates and picks the first existing extension", () => {
const rootDir = createTempDir();
const expectedPath = path.join(rootDir, "src", "checker.mjs");
const expectedPath = path.join(rootDir, "src", "checker.mts");
fs.mkdirSync(path.dirname(expectedPath), { recursive: true });
fs.writeFileSync(expectedPath, "export const ok = true;\n", "utf8");
expect(resolvePluginModuleCandidates(rootDir, "./src/checker")).toEqual([
path.join(rootDir, "src", "checker"),
path.join(rootDir, "src", "checker.ts"),
path.join(rootDir, "src", "checker.mts"),
path.join(rootDir, "src", "checker.js"),
path.join(rootDir, "src", "checker.mjs"),
path.join(rootDir, "src", "checker.cts"),
path.join(rootDir, "src", "checker.cjs"),
]);
expect(resolveExistingPluginModulePath(rootDir, "./src/checker")).toBe(expectedPath);

View File

@@ -53,8 +53,10 @@ export function resolvePluginModuleCandidates(rootDir: string, specifier: string
return [
resolvedPath,
`${resolvedPath}.ts`,
`${resolvedPath}.mts`,
`${resolvedPath}.js`,
`${resolvedPath}.mjs`,
`${resolvedPath}.cts`,
`${resolvedPath}.cjs`,
];
}