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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@zenweb/core

v5.1.0

Published

ZenWeb Core Module - Module loader and Server

Downloads

1,041

Readme

core - 核心

核心模块用于模块的加载与服务启动

依赖模块

配置项

| 配置项 | 类型 | 默认值 | 功能 | | ----- | --- | ----- | ---- | | env | string | development | 执行环境,开发环境为 development 生产环境为 production,一般通过 NODE_ENV 环境变量指定 | keys | string[] | 无 | Cookie 签名密钥 | proxy | boolean | false | 信任代理头信息,例如前级为 Nginx 为了取得真实客户端 ip 地址需要设置为 true | subdomainOffset | number | 无 | 子域名位置 | proxyIpHeader | string | X-Forwarded-For | 代理后客户端真实 ip 头字段名 | maxIpsCount | number | 0 | 多级代理后允许的 ip 数量,0 无限制

Core 挂载项

| 挂载项 | 类型 | 功能 | | ----- | --- | ---- | | name | string | 应用名称,获取顺序: env.APP_NAME、hostname | startTime | number | 启动时间: 毫秒时间戳 | app | Koa | 取得 Koa 实例 | loadedModules | LoadedModule[] | 已载入的模块 | server | Server | 取得 http.Server 实例 | debug | Debugger | core debug 方法

Context 挂载项

| 挂载项 | 类型 | 功能 | | ----- | --- | ---- | | core | Core | Core 模块实例

全局方法

| 名称 | 功能 | | ----- | ---- | | $initCore | 初始化全局 Core 对象 | $getCore | 取得全局 Core 对象 | $getContext | 取得当前请求上下文对象 | $core | 等于 $getCore() | $ctx | 等于 $getContext(true) | $debug | 输出 debug 信息支持上下文请求并打印所在行信息

自定义模块入口样例代码

import { SetupFunction } from '@zenweb/core';

// 自定义模块配置项
export interface MyModOption {}

// 是否有 opt 参数或者其他参数由模块开发者自定义
export default function (opt?: MyModOption): SetupFunction {
  // 返回函数的名称将作为模块名称显示
  return function mymodname(setup) {}
}