@automattic/lasagna

中文文档
0.8.1发布于 2024/09/27MITTypeScriptCommonJS近 30 天下载 3.4万

lasagna.js, the reference client for the Lasagna web service

原始使用文档
文档目录3 节
  1. Getting Started
  2. Contributing
  3. Additional Tips

Lasagna.js

Lasagna.js is the official client of the Lasagna web service. Lasagna is a real-time "layer" in between serverside properties and web/mobile clients, functioning as a lightweight message bus.

This client provides:

  • ⏩ Websocket Connectivity: keepin' it real(time).
  • 🧬 Multiplexing: one tube, myriad of topics.
  • 🗝️ JWT Auth Management: we reach out to you, you sign, we send.
  • 📘 TypeScript Types: to tell thee truth to thy terminal.

Getting Started

  1. npm install @automattic/lasagna
  2. import Lasagna from '@automattic/lasagna'
  3. const lasagna = new Lasagna( myJwtFetcherCallback );

myJwtFetcherCallback is any function with the following signature:

("socket" | "channel", params) => Promise<JWT>

params is a passthrough of the params given to initSocket or initChannel. The function should make a request to your domain's Lasagna JWT issuer endpoint and return a JWT appropriate for the concern.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss the change.

Please attach tests when appropriate. Use judgement.

Additional Tips

To run unit tests:

npm test

To run type-checking manually:

npm run lint

版本与发布记录

@automattic/lasagna 共发布 20 个版本,首次发布于 2020/04/21;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.8.1latest2024/09/272 年前
0.8.02020/10/226 年前
0.7.22020/08/266 年前
0.7.12020/07/026 年前
0.7.02020/06/156 年前
0.6.12020/06/116 年前

关于 @automattic/lasagna 的常见问题

@automattic/lasagna 是什么?

lasagna.js, the reference client for the Lasagna web service

如何安装 @automattic/lasagna?

在项目目录运行 npm install @automattic/lasagna,或使用 pnpm add / yarn add / bun add。

@automattic/lasagna 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@automattic/lasagna 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@automattic/lasagna 可以商用吗?

@automattic/lasagna 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@automattic/lasagna 的下载量有多少?

根据 npm 官方下载统计,@automattic/lasagna 在 2026/10/07 – 2026/11/05 这 30 天内被下载 33,677 次,日均约 1,123 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@automattic/lasagna 还在维护吗?

最新版本 0.8.1 发布于 2024/09/27(2 年前);至今共发布 20 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/04/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。