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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@done-coding/component-dev-tools

v0.1.1

Published

## vite vue组件按需加载

Readme

@done-coding/component-dev-tools

vite vue组件按需加载

import { defineConfig } from "vite";
import Components from "unplugin-vue-components/vite";
import { vCResolver } from "@done-coding/component-dev-tools";

export default defineConfig({
  plugin: [
    Components({
      resolvers: [
        vCResolver({
          checkIsSeries: (name) => name.startsWith("V"),
          getComponentName: (name) => name,
          getStylePath: ({ kebabComponentName }) =>
            `YOUR_PACKAGE_MODULE/es/styles/${kebabComponentName}/index.less`,
          componentsDir: "YOUR_PACKAGE_MODULE/es",
          debug: true,
        }),
      ],
    }),
  ],
});

组件库组件管理

组件创建

dc-component add [name]

组件移除

dc-component remvoe

组件库配置文件

// 配置文件
// 项目根目录 /.dc/component.json5
{
  series: "Dc",
  src: "src",
  component: {
    /**
     * @description: 组件的目录
     */
    dir: "${src}/${dir}",
    /**
     * @description: 组件的模板文件路径
     */
    templateFilePath: "./template/componentTemplate.m",
    /**
     * @description: 组件的文件名
     */
    fileName: "index.tsx",
    /**
     * @description: 组件的入口模板
     */
    entryTemplate: '\n\
export { default as ${name} } from "./${dir}";\n\
export type * from "./${dir}";',
    /**
     * @description: 组件的入口路径
     */
    entryPath: "${src}/components.ts",
  },
  type: {
    /**
     * @description: 类型的目录
     */
    dir: "${src}/types",
    /**
     * @description: 类型的模板文件路径
     */
    templateFilePath: "./template/typeTemplate.m",
    /**
     * @description: 类型的文件名
     */
    fileName: "${dir}.tsx",
    /**
     * @description: 类型的入口模板
     */
    entryTemplate: '\n\
@import "./${dir}.tsx";',
    /**
     * @description: 类型的入口路径
     */
    entryPath: "${src}/types/index.ts",
  },
  style: {
    /**
     * @description: 样式的目录
     */
    dir: "${src}/styles",
    /**
     * @description: 样式的模板文件路径
     */
    templateFilePath: "./template/styleTemplate.m",
    /**
     * @description: 样式的文件名
     */
    fileName: "${dir}.less",
    /**
     * @description: 样式的变量模板
     */
    varTemplate: "\n\
\n\
// ------------------ ${name} ------------------\n\
@${nameLowerFirst}Prefix: ~'@{prefix}-${dir}';",
    /**
     * @description: 样式的变量路径
     */
    varPath: "${src}/styles/var.less",
    /**
     * @description: 样式的入口模板
     */
    entryTemplate: '\n\
@import "./${dir}.less";',
    /**
     * @description: 样式的入口路径
     */
    entryPath: "${src}/styles/index.less",
  },
  srcExample: "src-docs",
  example: {
    /**
     * @description: 组件示例的目录
     */
    dir: "${srcExample}/${dir}",
    /**
     * @description: 组件示例的模板文件路径
     */
    templateFilePath: "./template/exampleTemplate.m",
    /**
     * @description: 组件示例的文件名
     */
    fileName: "index.tsx",
    /**
     * @description: 组件示例的入口模板
     */
    entryTemplate: '\n\
export { default as ${name} } from "./${dir}"',
    /**
     * @description: 组件示例的入口路径
     */
    entryPath: "${srcExample}/components.ts",
  },
}
// 模板环境变量
interface EnvData {
  series: string;
  name: string;
  full: string;
  cls: string;
  dir: string;
  rootPath: string;
  src: string;
  srcExample: string;
  nameLowerFirst: string;
  $: "$";
}