npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pamenv/next

v1.2.1

Published

Load PAM env into process.env before Next.js reads its config

Readme

@pamenv/next

在 Next 读取配置之前,把 PAM 环境写进当前进程的 process.env。dev 脚本可以继续是 next dev,不必再包 pamenv run。

pnpm add @pamenv/next pamenv-cli
# 或 npm i @pamenv/next pamenv-cli

依赖 pamenv-cli(注入与登录逻辑)。从项目目录向上需有可用的 .pam(与 CLI 相同;monorepo 可在仓库根登录一次)。

import { createPamenvPlugin } from '@pamenv/next';

const withPamenv = createPamenvPlugin({
  slug: 'pam',
  env: process.env.PAM_ENV,
  keepEnv: ['PAM_ENV', 'VERCEL', 'VERCEL_ENV', 'NODE_ENV'],
  oidc: 'vercel',
  debug: true,
  enabled: true
});

export default withPamenv(withNextIntl(nextConfig));

Token 解析与 CLI 自动模式一致:优先向上查找最近的项目 .pam;没有则回落 ~/.pam。不要把 token 写进这个对象。仓库内已有 .pam 但未登录时,在仓库根或项目目录执行 pamenv login --local;仅全局登录亦可。

总开关与自动时机

| 选项 | 含义 | | --- | --- | | enabled | 总开关:false 整插件不注入;省略 / true 允许注入 | | (内部)自动时机 | 本地仅 next dev;有 oidc 且在匹配 CI 时 production build/server | | dev / ci | 分别关掉本地或 CI 侧的自动时机 |

PAMENV_PROJECT_SLUG / PAMENV_ENV_NAME 优先于入参 slug / env。debug 可传 true;省略则读 PAMENV_DEBUG。

两层 API(进程级 / 运行时级)

| API | 时机 | | --- | --- | | createPamenvPlugin(进程级) | 本地 next dev:inject → 当前进程 process.env;CI next build:inject + 写密封快照 | | createPamenv(运行时级) | Vercel runtime:解封 → 返回 PamenvBag;默认不写 process.env。Edge 内 no-op(空袋) |

import { createPamenv } from '@pamenv/next';

const bag = await createPamenv(); // 整表按键解密(快照 v2)→ PamenvBag
bag.get('SESSION_SECRET');
const only = await createPamenv({ only: ['SESSION_SECRET'] });
// 遗留裸读 process.env 时才开:
await createPamenv({ writeProcessEnv: true });

| 参数 | 含义 | 默认 | | --- | --- | --- | | only | 白名单;缺键且进程也没有 → 抛错;袋内只含这些键 | 不传 = 全部 | | omit | 黑名单(与 only 互斥) | 不传 = 不排除 | | keepEnv | writeProcessEnv: true 时:进程已有则不覆盖 | runtime 内置 CI 键 | | cache | 进程内解封缓存 | true | | writeProcessEnv | 是否把袋写入 process.env | false |

应用侧把袋挂到配置(袋优先,平台键回落 process):

const bag = await createPamenv();
serverConfig.bindPamenvBag(bag);

平台矩阵

见主包 packages/pamenv/README.md。