-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add a short explaining about plugins usages #7031
Conversation
test_plugin/README.md
Outdated
[dependencies] | ||
... | ||
|
||
deno_core = { path = "../core" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not how you'd usually add deno_core
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, outside the deno project we rely on the Rust community’s crate registry! Change done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR title says explaining plugin usage
but this looks more like a tutorial to how to build the test_plugin
😅
test_plugin/README.md
Outdated
|
||
```js | ||
// in test.js | ||
const rid = Deno.openPlugin(<path to *.dylib>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lib is not always a.dylib
.
Windows: .dll
Linux: .so
MacOS: .dylib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
test_plugin/README.md
Outdated
└── test.js | ||
``` | ||
|
||
It is a rust repo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be specified?
|
||
```rust | ||
// in lib.rs | ||
fn op_test_sync( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also cover op_test_async
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async ops are managed the same way!
#[no_mangle] | ||
pub fn deno_plugin_init(interface: &mut dyn Interface) { | ||
interface.register_op("testSync", op_test_sync); | ||
... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testAsync
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
#### 4- build your lib with cargo : `cargo build -p <name of the crate>` | ||
|
||
```shell | ||
$ cargo build -p test_plugin --release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just cargo build --release
should be enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and why not?
I do not agree! test_plugin is a good start to check... If you have other ideas, please suggest something! |
I think it's a really good idea to actually explain how to create a simple test plugin, what it uses, how it works, what these methods do etc. Then a user can use this information to be confident enough to build whatever they want |
Solving #7030