-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(es): Add analysis API and refactor output API #10288
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
Conversation
🦋 Changeset detectedLatest commit: dedc6ef The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Performance ReportMerging #10288 will degrade performances by 1.05%Comparing Summary
Benchmarks breakdown
|
a6ce558 to
88cccf9
Compare
81039ba to
88c53f1
Compare
6c5f82e to
4704673
Compare
4704673 to
36c509d
Compare
**Description:**
A JS API is required to use it from JS world.
```js
import { experimental_analyze } as '@swc/core';
const result = await analyze(
`console.log('boo')`,
{
plugins: [[getPluginAbsolutePath(feature), {}]],
}
);
expect(result).toMatchInlineSnapshot(
`"{"test":"test"}"`
);
```
Wasm plugin code:
```rust
use swc_core::{
ecma::ast::Program,
plugin::{plugin_transform, proxies::TransformPluginProgramMetadata},
transform_common::output::experimental_emit,
};
#[plugin_transform]
pub fn process(program: Program, _metadata: TransformPluginProgramMetadata) -> Program {
experimental_emit("test".into(), "test".into());
program
}
```

Description:
A JS API is required to use it from JS world.
Wasm plugin code:
Related issue: