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

uni-auto-page

v0.1.0-alpha.1

Published

Auto generate pages.json for Uniapp

Downloads

3

Readme

Uni Auto Pages

当前版本为测试版本,仅供测试、试用,切勿在生产使用

一个用于 UniApp 项目的 Vite 插件,可以根据项目目录结构自动构建 pages.json 文件。

特性

  • 🚀 自动扫描目录结构,生成 pages.json
  • 📝 支持通过 defineOptions 在页面文件中直接配置页面属性
  • 📦 支持分包配置
  • 🔧 支持自定义页面模板
  • 🎨 支持根据路径匹配应用不同的样式
  • 🧩 支持忽略路径配置,使用 glob 模式匹配,类似于 .gitignore
  • 🔄 支持热更新,修改配置文件或页面文件后自动重新生成 pages.json

安装

npm install uni-auto-page --save-dev

或者使用 yarn:

yarn add uni-auto-page -D

使用方法

1. 在 Vite 配置中引入插件

// vite.config.ts
import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import uniAutoPages from 'uni-auto-page';

export default defineConfig({
  plugins: [
    uni(),
    uniAutoPages(),
  ],
});

2. 创建配置文件

在项目根目录下创建 auto.pages.config.ts 文件:

// auto.pages.config.ts
import { AutoPagesConfig } from 'uni-auto-page';

const config: AutoPagesConfig = {
  entryDir: 'src/pages',
  fileTypes: ['vue', 'nvue', 'uvue'],
  ignore: [],
  outputPath: 'pages.json',
  defaultPageConfig: {
    style: {
      navigationStyle: 'custom'
    }
  },
  pages: [],
  subPackages: [],
  other: {
    globalStyle: {
      navigationBarTextStyle: 'black',
      navigationBarTitleText: '',
      navigationBarBackgroundColor: '#F8F8F8',
      backgroundColor: '#F8F8F8',
    },
  },
  // 其他配置项...
};

export default config;

3. 在页面中使用 defineOptions 配置页面

<template>
  <view>页面内容</view>
</template>

<script lang="ts" setup>
// 使用 defineOptions 配置页面
defineOptions({
  // 页面配置,会在构建时被提取并写入 pages.json
  uniPage: {
    style: {
      navigationBarTitleText: '示例页面',
      navigationBarBackgroundColor: '#007AFF',
      navigationBarTextStyle: 'white',
      enablePullDownRefresh: true,
    }
  },
  
  // 其他非页面配置
  name: 'ExamplePage',
});
</script>