Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
/ bun-plugin Public archive

A proto WASM plugin for Bun.

License

Notifications You must be signed in to change notification settings

moonrepo/bun-plugin

Repository files navigation

Migrated to a new repository: https://github.com/moonrepo/tools

Bun plugin

Bun WASM plugin for proto.

Installation

This plugin is built-in to proto, but if you want to override it with an explicit version, add the following to .prototools.

[plugins]
bun = "source:https://github.com/moonrepo/bun-plugin/releases/download/vX.Y.Z/bun_plugin.wasm"

Configuration

Bun plugin can be configured with a .prototools file.

  • dist-url (string) - The distribution URL to download Bun archives from. Supports {version} and {file} tokens.
[tools.bun]
dist-url = "https://..."

Hooks

Bun plugin does not support hooks.

Caveats

Bun supports a bunx executable, which is a shortcut for bun x (note the space). It achieves this through some file name magic, as the bunx file is exactly the same as the bun file, jsut the exec functionality is toggled on/off based on the file name (derived from args[0]).

Supporting this in proto is tricky. For symlinked binaries, we can easily support this, as we symlink the bun binary to ~/.proto/bin/bunx. However, for the shim ~/.proto/shims/bunx, we can't do this, as we execute bun as a child process, as there's no bunx file to execute (Bun doesn't provide it), and the file name magic doesn't happen. So for the shim, we execute bun x under the hood instead.

This caveat only really matters in regards to the --bun flag, which works for bins, but not for shims.

Contributing

Build the plugin:

cargo build --target wasm32-wasi

Test the plugin by running proto commands.

proto install bun-test
proto list-remote bun-test

About

A proto WASM plugin for Bun.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages