Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
swc-plugin-import-meta-env
Advanced tools
@swc plugin for handling the transformation of import.meta.env
Simple plugin to transform
import.meta.env
toprocess.env
This @swc
plugin provides a simple transformation from import.meta.env
to process.env
.
The original purpose of this was to allow @swc
usage in a large Jest test suite while also using Vite for bundling.
npm i -D swc-plugin-import-meta-env
Simply add this to the plugins field of your .swcrc
.
{
"jsc": {
"experimental": {
"plugins": [["swc-plugin-import-meta-env", {}]]
}
}
}
Or programmatically as an extension to your existing .swcrc
parsing:
const swcrc = JSON.parse(fs.readFileSync(".swcrc", "utf8"));
((swcrc.jsc ??= {}).experimental ??= {}).plugins = [
["swc-plugin-import-meta-env", {}],
]; // This may need updating to suit your requirements
The purpose of this plugin currently is to keep this transformation simple. There are many tools and utilities to load .env
files into your environment already, such as performing this during your setupTests
phase of testing.
dotenv
If there is enough demand I can investigate adding this as core functionality to this plugin.
#141
#142
#143
#139
#140
#138
#137
#133
#136
#135
#134
FAQs
@swc plugin for handling the transformation of import.meta.env
The npm package swc-plugin-import-meta-env receives a total of 1,643 weekly downloads. As such, swc-plugin-import-meta-env popularity was classified as popular.
We found that swc-plugin-import-meta-env demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.