Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
vite-register
Advanced tools
Readme
Use Vite env variables inside Node scripts and test runners via a require hook.
npm install --save-dev vite-register
Pretty much like Vite does, vite-register will statically replace variables.
import.meta.env.MODE
import.meta.env.DEV
import.meta.env.PROD
import.meta.env.SSR
(defaults to false
)import.meta.env.BASE_URL
.env
file.env.local
file.env.[mode]
file.env.[mode].local
file<UserConfig>.envPrefix
(defaults to VITE_
)<UserConfig>.envDir
(defaults to project root)This hook can be used with the Node CLI and some test runners supporting hooks via the -r
(--require
) option.
# Assuming envPrefix => 'VITE_'
echo 'VITE_FOO="hello world"' > .env
echo 'console.log(import.meta.env.VITE_FOO);' > index.js
node -r vite-register index.js
> hello world
vite-register can look into Vite configuration files (vite.config.[ext]
) and retrieve base
and mode
.
In most cases, TypeScript/JSX/ESM support in configuration files and scripts can be provided by third-party hooks like tsm, esbuild-runner or esbuild-register, before vite-register hook.
node -r esbuild-runner/register -r vite-register index.ts
Can be combined with esbuild-runner for TypeScript/JSX/ESM support.
mocha -r esbuild-runner/register -r vite-register [pattern]
↪️ lukeed/uvu
Can be combined with tsm or esbuild-runner for TypeScript/JSX/ESM support.
uvu -r tsm -r vite-register [pattern]
require
(no hooks support) based on vm
, see facebook/jest#11295.MIT
FAQs
Use Vite env variables inside Node scripts and tests runners via a require hook.
The npm package vite-register receives a total of 15 weekly downloads. As such, vite-register popularity was classified as not popular.
We found that vite-register 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.