@appweaver/common

中文文档
2.4.1发布于 2026/11/01MITTypeScriptCommonJS近 30 天下载 4299

Appweaver - the backend framework for AI-first development (@common)

原始使用文档
文档目录5 节
  1. Description
  2. Installation
  3. Usage
  4. Documentation
  5. License

Appweaver Logo

Shared configuration, logger, types, and utilities of Appweaver.

NPM Version Package License NPM Downloads

Description

@appweaver/common holds what every other Appweaver package builds on:

  • Configuration – defineConfig, declaring the config sections every package and application reads by their short key names (appConfig.ENV), each validated by its TypeBox schema, from appweaver.json with its environments sections, the optional appweaver.<env>.json overlay, .env files, and environment variables, and the config accessors (config.str(), config.int(), ...) reading any flattened key as it is.
  • Logger – the logger instance, a configured Pino logger.
  • Types – the resource model, query filter, sort, aggregate, policy, and route types, and the ResourceRegistry that weaver generate fills so the factories infer the model types from a model name.
  • Infrastructure contracts – the abstract Database, Cache, Memory, Queue, Scheduler, Storage, Mailer, Events, TemplateEngine, ImageProcessor, and SecurityStore classes the drivers implement.
  • Modules – defineModule, the manifest of a module declaring its contracts, providers, services, setup, resources and startup code, the same format for the framework's own modules, npm packages, and the src/modules/ of an app.
  • Lifecycle – the OnInit, OnReady, OnShutdown, and OnDestroy hooks of the application services.
  • Utilities – string, object, date, and version helpers such as randomString and compareVersions.

Installation

It is installed with @appweaver/core, and is rarely added on its own:

npm install @appweaver/common

Usage

import { appConfig, logger, randomString } from '@appweaver/common';

logger.info({ env: appConfig.ENV }, 'Starting the application');

const token = randomString(32);

Documentation

  • Appweaver README – getting started, configuration, and the overview of every package
  • Agent skill – the complete framework reference shipped to every scaffolded project

License

Appweaver is MIT licensed.

版本与发布记录

@appweaver/common 共发布 71 个版本,首次发布于 2026/05/18;过去 12 个月发布了 71 个版本。

版本发布日期距今
2.4.1latest2026/11/016 天前
2.4.02026/11/016 天前
2.3.02026/11/016 天前
2.2.02026/10/317 天前
2.1.22026/10/2513 天前
2.1.12026/10/2513 天前

关于 @appweaver/common 的常见问题

@appweaver/common 是什么?

Appweaver - the backend framework for AI-first development (@common)

如何安装 @appweaver/common?

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

@appweaver/common 支持 TypeScript 吗?

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

@appweaver/common 支持 ESM 还是 CommonJS?

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

@appweaver/common 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >= 24.7。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@appweaver/common 可以商用吗?

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

@appweaver/common 的下载量有多少?

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

@appweaver/common 还在维护吗?

最新版本 2.4.1 发布于 2026/11/01(6 天前);至今共发布 71 个版本,其中过去 12 个月发布了 71 个;首次发布于 2026/05/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。