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

@winner-fed/plugin-did-you-know

v1.0.1

Published

Did you know WinJS?

Readme

@winner-fed/plugin-did-you-know

你知道吗?WinJS 开发技巧提示插件

功能介绍

这是一个为 WinJS 框架提供开发技巧提示的插件。它会在你执行 setupdevbuild 等命令时,随机显示一个有用的开发技巧或最佳实践,帮助你更好地使用 WinJS 框架。

特性

  • 🎯 智能提示算法: 避免重复显示相同的技巧,优先显示未曾提示过的内容
  • 🔗 链接支持: 提示内容支持链接,可直接跳转到详细文档
  • 📱 多框架支持: 支持根据不同框架和版本过滤相关技巧
  • 💾 记录缓存: 自动记录提示历史,避免频繁重复显示
  • 🎨 终端美化: 支持终端链接美化显示

安装

npm install @winner-fed/plugin-did-you-know --save-dev

使用方法

基本使用

plugin.ts 文件中启用插件:

import { defineConfig } from 'winjs';

export default defineConfig({
  plugins: [
    // ... 其他插件
    '@winner-fed/plugin-did-you-know'
  ]
});

触发时机

插件会在以下命令执行时自动显示技巧提示:

  • win setup - 项目初始化时
  • win dev - 开发服务器启动时
  • win build - 项目构建时

提示示例

$ win dev
[你知道吗?] dev 模式下访问 /__win 路由,可以发现很多有用的内部信息

$ win build
[你知道吗?] 想要试试闪电般的构建速度吗?那还不赶紧一键开启 Rsbuild 构建工具:点我查看

工作原理

智能提示算法

  1. 内容过滤: 根据当前框架和版本过滤相关技巧
  2. 优先级排序: 优先显示未曾提示过的内容
  3. 频率控制: 每个技巧最多显示 5 次,避免过度重复
  4. 时间记录: 记录每次显示的时间,避免连续显示相同内容

缓存机制

插件会在 node_modules/.cache/ 目录下创建 did-you-know.json 文件,记录提示历史:

{
  "技巧内容": {
    "lastTime": 1704067200000,
    "count": 2
  }
}

内置技巧

插件内置了丰富的 WinJS 开发技巧,包括:

  • 🛠️ 开发调试: 如何使用 /__win 路由查看内部信息
  • 📦 构建优化: MFSU、代码压缩、产物分析等技巧
  • 🎨 样式处理: Tailwind CSS、全局样式等配置方法
  • 📱 移动端开发: 移动端布局、视口配置等
  • 🔧 工具集成: TypeScript、Prettier、代码检查等配置
  • 🚀 性能优化: 代码拆分、懒加载等优化技巧
  • 📋 状态管理: Pinia、Vuex 等状态管理方案

自定义技巧

你可以通过修改 package.json 中的 didYouKnow 字段来自定义技巧内容:

{
  "didYouKnow": [
    {
      "text": "你的自定义技巧内容",
      "url": "https://example.com/docs",
      "majorVersion": 0,
      "framework": ["win"]
    }
  ]
}

字段说明

  • text: 技巧的文本内容(支持模板变量)
  • url: 可选,相关文档链接
  • majorVersion: 可选,适用的主版本号
  • framework: 可选,适用的框架列表

模板变量

技巧内容支持以下模板变量:

  • %%frameworkName%%: 当前框架名称(如 WinJS)
  • %%frameworkCliName%%: 当前框架CLI名称(如 win)

配置选项

当前版本插件无需额外配置,开箱即用。

开发指南

本地开发

# 安装依赖
npm install

# 开发模式
npm run dev

# 构建
npm run build

目录结构

packages/plugin-did-you-know/
├── src/
│   └── plugin.ts          # 插件主文件
├── compiled/              # 编译后的依赖
├── package.json          # 包配置和技巧数据
└── README.md            # 说明文档

常见问题

Q: 如何禁用技巧提示? A: 从 plugin.ts 中移除该插件即可。

Q: 技巧显示频率如何控制? A: 插件内置智能算法,每个技巧最多显示 5 次,会自动避免重复显示。

Q: 如何清除提示历史? A: 删除 node_modules/.cache/did-you-know.json 文件即可重置。

Q: 提示内容支持多语言吗? A: 当前版本仅支持中文,未来版本可能会支持多语言。

许可证

MIT License

贡献指南

欢迎提交问题和功能建议到 GitHub Issues


让 WinJS 开发更加高效!🚀