fix smoke test
This commit is contained in:
12
.changeset/fix-prepack-dist-exports.md
Normal file
12
.changeset/fix-prepack-dist-exports.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
"@runfusion/fusion": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: keep `./dist/*` subpaths resolvable in the packed manifest
|
||||||
|
|
||||||
|
The prepack transform injects an `exports` field for the plugin-sdk subpath,
|
||||||
|
which flips Node into strict subpath mode and hid every other `./dist/*` file.
|
||||||
|
That broke the runfusion.ai alias (which imports
|
||||||
|
`@runfusion/fusion/dist/bin.js`) with `ERR_PACKAGE_PATH_NOT_EXPORTED`, failing
|
||||||
|
the pre-publish smoke test. Add a `./dist/*` passthrough so the alias bin and
|
||||||
|
the pi `./dist/extension.js` loader keep resolving after pack.
|
||||||
@@ -18,12 +18,19 @@ export function applyPrepackTransform(pkg) {
|
|||||||
devDependencies,
|
devDependencies,
|
||||||
// Inject exports only for the packed manifest so workspace/dev resolution
|
// Inject exports only for the packed manifest so workspace/dev resolution
|
||||||
// remains unchanged (postpack restore reverts this file to original state).
|
// remains unchanged (postpack restore reverts this file to original state).
|
||||||
|
//
|
||||||
|
// Declaring any `exports` field flips Node into strict subpath mode, which
|
||||||
|
// would otherwise hide every other `./dist/*` file. The runfusion.ai alias
|
||||||
|
// imports `@runfusion/fusion/dist/bin.js` and the pi loader reads
|
||||||
|
// `./dist/extension.js`, so a `./dist/*` passthrough is required to keep
|
||||||
|
// those subpaths resolvable post-pack.
|
||||||
exports: {
|
exports: {
|
||||||
...(pkg.exports || {}),
|
...(pkg.exports || {}),
|
||||||
"./plugin-sdk": {
|
"./plugin-sdk": {
|
||||||
types: "./dist/plugin-sdk/index.d.ts",
|
types: "./dist/plugin-sdk/index.d.ts",
|
||||||
import: "./dist/plugin-sdk/index.js",
|
import: "./dist/plugin-sdk/index.js",
|
||||||
},
|
},
|
||||||
|
"./dist/*": "./dist/*",
|
||||||
"./package.json": "./package.json",
|
"./package.json": "./package.json",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ describe("plugin-sdk export surface", () => {
|
|||||||
import: "./dist/plugin-sdk/index.js",
|
import: "./dist/plugin-sdk/index.js",
|
||||||
});
|
});
|
||||||
expect(transformed.exports["./package.json"]).toBe("./package.json");
|
expect(transformed.exports["./package.json"]).toBe("./package.json");
|
||||||
|
// The runfusion.ai alias imports `@runfusion/fusion/dist/bin.js`; the
|
||||||
|
// injected exports field must keep `./dist/*` subpaths resolvable or the
|
||||||
|
// pre-publish smoke test fails with ERR_PACKAGE_PATH_NOT_EXPORTED.
|
||||||
|
expect(transformed.exports["./dist/*"]).toBe("./dist/*");
|
||||||
expect(transformed.bin).toEqual(pkg.bin);
|
expect(transformed.bin).toEqual(pkg.bin);
|
||||||
expect(transformed.pi).toEqual(pkg.pi);
|
expect(transformed.pi).toEqual(pkg.pi);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user