Ironclad / rivet

The open-source visual AI programming environment and TypeScript library
https://rivet.ironcladapp.com
MIT License
2.56k stars 226 forks source link

[Bug]: Plugin path starting with dot not found during installation #303

Open mloenow opened 5 months ago

mloenow commented 5 months ago

What happened?

I'm attempting to fix an issue with type definitions for rivet-plugin-mongodb with my pull request https://github.com/a-rothwell/rivet-plugin-mongodb/pull/3, which has an exports field defined in package.json. I can now use the plugin in my TypeScript environment and run the graph just fine from Node.

However, when trying to install the plugin Rivet cannot find the plugin entry file for CommonJS. I believe this happens because entries in exports must begin with a dot, which result in an incorrect absolute path when joined during installation of the plugin in Rivet.

What was the expected functionality?

Rivet installs the plugin without any errors

Describe your environment

MacOS 14.2.1, Node 20.10

Relevant log output

Installing plugin: rivet-plugin-mongodb...
Checking for plugin updates: rivet-plugin-mongodb@main
Plugin is a git repository, skipping reinstall: rivet-plugin-mongodb@main

Error installing plugin: path: /Users/ml/Library/Application Support/com.ironcladapp.rivet/plugins/rivet-plugin-mongodb-main/package/./dist/cjs/index.js: No such file or directory (os error 2)

Relevant screenshots

No response

Code of Conduct

abrenneke commented 5 months ago

Hmm Rivet doesn't actually parse the exports field, only the main field, which still doesn't have a dot in your PR. I'm puzzled as to where it's getting cjs at all from the package.json...

a-rothwell commented 5 months ago

I don't think the bundle script needs changing as the original issue was caused by me forgetting to add the skipInstall to the V3 release.

The V4 release should work as expected, as I was able to manually verify a successful install with a fresh download of the 1.7.4 bundled release. All cookbooks in the mongo plugin repo were run successfully with V4