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

@nightgale/vite-plugin-pages

v1.0.2

Published

File system based routing for uni-app applications using Vite

Downloads

5

Readme

vite-plugin-pages

基于 vite 驱动的 uni-app 文件路由系统插件。

安装

pnpm add -D @nightgale/vite-plugin-pages

使用

vite.config

// vite.config.ts
import { defineConfig } from 'vite'
import Uni from '@dcloudio/vite-plugin-uni'
import RoutePages from '@nightgale/vite-plugin-pages'

// It is recommended to put it in front of Uni
export default defineConfig({
  plugins: [
    RoutePages(),
    Uni()
  ],
})

现在所有的页面都将被自动找到!

选项配置

interface SubPagesOptions {
 /**
  * 子包的根目录
  * @description 可配置多个子包根目录
  */
 base: string | string[];

 /**
  * 子包目录搜索深度
  * @default 1
  */
 depth: number;
}

interface Options {
 /**
  * UniApp 编译平台类型
  * @default 'h5'
  */
 platform: Platform;

 /**
  * 默认启动首页
  * @default 'pages/index' or 'pages/index/index'
  */
 homePage: string;

 /**
  * 页面搜索路径
  * @default 'src/pages'
  */
 pages: string;

 /**
  * 子包页面搜索路径
  * @default []
  */
 subPackages: string[] | SubPagesOptions;

 /**
  * SFC 文件扩展名
  * @default ['vue', 'nvue', 'uvue']
  */
 extensions: string[];

 /**
  * pages.json 输出地址
  * @default "src"
  */
 outDir: string;

 /**
  * 路由信息块默认解释语言
  * @default 'json5'
  * @description 或通过在SFC单文件中 `<route lang="xxx">` 配置
  */
 routeBlockLang: RouteLang;

 /**
  * 是否输出日志
  * @default false
  */
 debug: boolean;

 /**
  * 需排除的页面
  * @default []
  */
 exclude: string[];

 /**
  * 移除 SFC 文件中 Template 中的注释项
  * @default 'none'
  * @description all: 全部移除,region: 只移除region注释块,none: 不移除
  */
 removeComment: 'all' | 'region' | 'none';

 /**
  * 是否强制开启 UniPage 路由模式,只支持 H5 平台
  * @default false
  * @description 默认根据 pages.json 中 pages 配置是否使用路由模式,
  *              当 pages 页面配置数量 >1 时会自动开启 UniRouter 模式,
  *              也可以通过该配置强制开启 UniRouter 模式
  */
 uniRouter: boolean;

 /**
  * 默认 UniPage 生成的 routes 信息中不带有 name,使用该配置可以为 routes 加上 name,只适合 H5 平台
  * @default false
  * @description 注意:同时也可以使用 VueRouter 的路由名称进行跳转
  */
 routeNamePatch: boolean;
}

route 块

route 块数据会合拼并覆盖 pages.json 中同名数据

|名称|说明|可选值|默认 |----|----|----|---- |type|页面类型|'page' | 'home' |'page' |lang|块默认解释语言|'json5' | 'json' | 'yaml' | 'yml' | json5 |platform|指定平台类型,为空即全平台,只能是或关系,例: h5 || mp| 同UniApp的平台类型 | h5

<!-- 可通过设置 type='home' 为首页 -->
<!-- 暂不支持 UniApp 的条件编译,可通过配置 platform 属性指定平台 -->
<route type="home">
{
  "style": { "navigationBarTitleText": "@nightgale" }
}
</route>