-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
chore(plugin): expose optional features for wasm plugin test #4351
base: main
Are you sure you want to change the base?
Conversation
crates/swc/Cargo.toml
Outdated
@@ -29,6 +29,9 @@ concurrent = [ | |||
debug = ["swc_ecma_visit/debug"] | |||
node = ["napi", "napi-derive"] | |||
plugin = ["swc_plugin_runner", "swc_plugin_proxy/plugin-rt"] | |||
swc_plugin_runner_default = ["swc_plugin_runner/default"] |
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.
I'm against this change.
This will make CI much slower.
Users can depend on wasmer
by themselves
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.
Users can depend on wasmer by themselves
won't solve the problem well.
But I agree with the latter point of view. I can turn off this PR first and wait for your solution~
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.
Mainly, I'm a bit hesitant to expose explicitly wasmer_*
as features to the downstream who want to use. Runtime we use should be implementation detail we can change anytime.
@kwonoj I think you are right. So we should expose a feature, right? |
yes, I think it makes sense swc* exposes a feature to let user controls. But name should not include anything 'wasmer'. |
So I am waiting for you to add this feature, should this PR be closed? |
I think you can update PR to rename features, also to not to try to include some features by default. |
I'll think about it and update it later |
1d8376d
to
919c858
Compare
I thought again about the related issue I found that in addition to the problem I reported above, after enabling the
Combined with the problems here, I think it is necessary to expose an additional feature to use swc with plugin function for rust developers. So I re-integrated and called this feature For rust developers, just use
how about this? @kwonoj |
919c858
to
7a094df
Compare
Plugin authors are not supposed to depend on |
emm, Is this sample code(just for test) not recommended? @kdy1 |
Yes, it's not recommended |
As already explained, it is discouraged to have swc, or anything else as a dependency to the plugin. The only deps plugin may rely on is |
I know this But I do sometimes want to write a little rust test in the plugin repository, so I hope to introduce swc in
But you don't seem to recommend this approach, I'm very confused now. So how to write rust test code for the plugin (Mock a real calling environment instead of simple unit tests)? @kwonoj |
Most of cases test would be performed with It is not impossible to run whole via swc, but we do not recommend it as standard practice, and you may try it on your own. |
Thank you, I understand what you mean I don't seem to have any more ideas for this PR (although If no feature is to be added, It is hard to use swc to test the whole case in rust, like i said before. Maybe I just have to give up using it like this) |
Description:
At present, the default features of
wasmer
are not exposed by default, so if third-party plugin developers want to use the swc to write some test code, it will be difficult.For example, if there is no default feature of
wasmer
, developers using related capabilities will report errors like the following:Moreover, I haven't found a way to directly specify the dependency's dependency features in rust, so I think adding some optional features to swc may be a solution. This will not affect normal use.
Of course, if there are other ways to accomplish this ability, it is also OK
BREAKING CHANGE:
None
Related issue (if exists):
None