Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
unenv-nightly
Advanced tools
<!-- automd:badges color=yellow packagephobia -->
unenv provides a collection of Node.js and Web polyfills and mocking utilities with configurable presets for converting JavaScript code and libraries to be platform and runtime agnostic, working in any environment including Browsers, Workers, Node.js, Cloudflare Workers, Deno.
Unenv is used by Nitro and Nuxt today.
[!NOTE] You are on the development (v2) branch. Check out v1 for the current release.
# ✨ Auto-detect
npx nypm install -D unenv
# npm
npm install -D unenv
# yarn
yarn add -D unenv
# pnpm
pnpm install -D unenv
# bun
bun install -D unenv
# deno
deno install --dev unenv
Using env
utility and built-in presets, unenv
will provide an abstract configuration that can be used in bundlers (rollup.js, webpack, etc.).
import { env } from "unenv";
const { alias, inject, polyfill, external } = env({}, {}, {});
Note: You can provide as many presets as you want. unenv will merge them internally and the right-most preset has a higher priority.
node
Suitable to convert universal libraries working in Node.js.
fetch
APIimport { env, node } from "unenv";
const envConfig = env(node, {});
nodeless
Suitable to transform libraries made for Node.js to run in other JavaScript runtimes.
import { env, nodeless } from "unenv";
const envConfig = env(nodeless, {});
deno
This preset can be used to extend nodeless
to use Deno's Node.js API Compatibility (docs, docs).
[!WARNING] This preset is experimental and behavior might change!
import { env, nodeless, deno } from "unenv";
const envConfig = env(nodeless, deno, {});
cloudflare
This preset can be used to extend nodeless
to use Cloudflare Worker Node.js API Compatibility (docs).
[!WARNING] This preset is experimental and behavior might change!
[!NOTE] Make sure to enable
nodejs_compat
compatibility flag.
import { env, nodeless, cloudflare } from "unenv";
const envConfig = env(nodeless, cloudflare, {});
vercel
This preset can be used to extend nodeless
to use Vercel Edge Node.js API Compatibility (docs).
[!WARNING] This preset is experimental and behavior might change!
import { env, nodeless, vercel } from "unenv";
const envConfig = env(nodeless, vercel, {});
unenv
provides a replacement for Node.js built-in modules compatible with any runtime.
unenv
provides a replacement for common npm packages for cross-platform compatibility.
// Magic proxy to replace any unknown API
import MockProxy from "unenv/runtime/mock/proxy";
// You can also create named mocks
const lib = MockProxy.__createMock__("lib", {
/* overrides */
});
To discover other polyfills, please check ./src/runtime.
You can use the nightly release channel to try the latest changes in the main
branch via unenv-nightly
.
If directly using unenv
in your project:
{
"devDependencies": {
"unenv": "npm:unenv-nightly"
}
}
If using unenv
via another tool (Nuxt or Nitro) in your project:
{
"resolutions": {
"unenv": "npm:unenv-nightly"
}
}
Published under the MIT license.
Made by @pi0 and community 💛
🤖 auto updated with automd
FAQs
<!-- automd:badges color=yellow packagephobia -->
The npm package unenv-nightly receives a total of 350,606 weekly downloads. As such, unenv-nightly popularity was classified as popular.
We found that unenv-nightly demonstrated a healthy version release cadence and project activity because the last version was released less than 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.