FN-6409: inline core types in plugin SDK declarations

Make the published plugin SDK declaration bundle self-contained for external plugins.

- Resolve private @fusion/core specifiers while emitting plugin-sdk declarations.
- Add a regression test covering built plugin-sdk .d.ts artifacts when present.
- Record a patch changeset for the published @runfusion/fusion package.

Files changed:
 .changeset/FN-6409-plugin-sdk-dts-inline.md          |  5 +++++
 packages/cli/src/__tests__/plugin-sdk-export.test.ts |  9 +++++++++
 packages/cli/tsup.config.ts                          | 11 ++++++++++-
 3 files changed, 24 insertions(+), 1 deletion(-)

Fusion-Task-Id: FN-6409

Fusion-Task-Lineage: b7590e39-763d-48ca-9301-5131d0a94b89
This commit is contained in:
gsxdsm
2026-06-13 18:27:39 -07:00
parent df01ab71dd
commit 740c7127e5
3 changed files with 24 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@runfusion/fusion": patch
---
Inline the private `@fusion/core` types into the published `@runfusion/fusion/plugin-sdk` declaration entry so standalone external plugins created with `fn plugin new` can typecheck and `pnpm build` cleanly against released Fusion. Human spot-check: `npx @runfusion/fusion@0.42.0 plugin new proof-point-plugin && cd proof-point-plugin && pnpm install && pnpm build`.

View File

@@ -51,4 +51,13 @@ describe("plugin-sdk export surface", () => {
const built = readFileSync(distPath, "utf-8");
expect(built.includes("@fusion/")).toBe(false);
});
it("has no @fusion specifiers in built plugin-sdk declaration artifact when present", () => {
const distPath = join(workspaceRoot, "packages", "cli", "dist", "plugin-sdk", "index.d.ts");
if (!existsSync(distPath)) {
return;
}
const built = readFileSync(distPath, "utf-8");
expect(built.includes("@fusion/")).toBe(false);
});
});

View File

@@ -316,9 +316,18 @@ const pluginSdkBuildConfig = {
target: "node22",
tsconfig: join(__dirname, "..", "plugin-sdk", "tsconfig.json"),
dts: {
resolve: true,
/*
* FNXC:PluginSDK 2026-06-13-12:00:
* FN-6409 requires the published @runfusion/fusion/plugin-sdk declaration entry to be self-contained. External plugin authors cannot resolve private @fusion/core types from scaffolded projects, so leaving @fusion/* imports in dist/plugin-sdk/index.d.ts makes tsc fail with TS2307 before ctx parameters can typecheck.
*/
resolve: [/^@fusion\//],
compilerOptions: {
rootDir: join(__dirname, ".."),
baseUrl: ".",
paths: {
"@fusion/core": ["../core/src/index.ts"],
},
removeComments: true,
},
},
noExternal: [/^@fusion\//],