
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
swc-plugin-formatjs
Advanced tools
SWC-plugin-formatjs
swc-plugin-formatjs is a port of babel-plugin-formatjs for the SWC. Transform can be performed either via SWC's wasm-based plugin, or using custom passes in rust side transform chains.
This plugin attempts to mimic most of defined behavior of original plugin's test fixture. However, due to differences of plugin interfaces, as well as known limitations there are numbers of unsupported features with differences. You may able to check the list of github issues, as well as checking test fixtures.
Notably, any dynamic configuration options (overrideFn, onMsg...) are not supported, and few internal behaviors relying on static evaluation won't work.
NOTE: Package can have breaking changes without major semver bump
Given SWC's plugin interface itself is under experimental stage does not gaurantee semver-based major bump yet, this package also does not gaurantee semver compliant breaking changes yet. Please refer changelogs if you're encountering unexpected breaking behavior across versions.
Also, current implementation is largely unoptimized, and may have performance issues as initial focus was to pass existing test fixtures only.
First, install package via npm:
npm install --save-dev swc-plugin-formatjs
Then add plugin into swc's configuration:
interface PluginOptions {
pragma: string;
removeDefaultMessage: bool,
idInterpolationPattern?: string,
ast: bool,
extractSorceLocation: bool,
preserveWhitespace: bool,
additionalFunctionNames: Array<string>,
additionalComponentNames: Array<string>
}
jsc: {
...
experimental: {
plugins: [
["SWC-plugin-formatjs", {
//pluginOptions
}]
]
}
}
There is a single interface exposed to create a visitor for the transform, which you can pass into before_custom_pass.
create_formatjs_visitor<C: Clone + Comments, S: SourceMapper>(
source_map: std::sync::Arc<S>,
comments: C,
plugin_options: FormatJSPluginOptions,
filename: &str,
) -> FormatJSVisitor<C, S>
This package runs slightly modified original plugin's fixture tests against SWC with its wasm plugin & custom transform both. spec contains set of the fixtures & unit test to run it, as well as supplimental packages to interop between instrumentation visitor to node.js runtime.
Few npm scripts are supported for wrapping those setups.
build:all: Build all relative packages as debug build.test: Runs unit test for wasm plugin & custom transform.FAQs
SWC plugin for formatjs
We found that swc-plugin-formatjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.